import '../styles/EditDescriptorModelProperties.scss'
+
+
function getDescriptorMetaBasicForType(type) {
- const basicPropertiesFilter = d => _.contains(DESCRIPTOR_MODEL_FIELDS[type], d.name);
+ const basicPropertiesFilter = d => _.includes(DESCRIPTOR_MODEL_FIELDS[type], d.name);
return DescriptorModelMetaFactory.getModelMetaForType(type, basicPropertiesFilter) || {properties: []};
}
function getDescriptorMetaAdvancedForType(type) {
- const advPropertiesFilter = d => !_.contains(DESCRIPTOR_MODEL_FIELDS[type], d.name);
+ const advPropertiesFilter = d => !_.includes(DESCRIPTOR_MODEL_FIELDS[type], d.name);
return DescriptorModelMetaFactory.getModelMetaForType(type, advPropertiesFilter) || {properties: []};
}
return model.id;
}
}
-
-export default function EditDescriptorModelProperties(props) {
-
- const container = props.container;
-
- if (!(DescriptorModelFactory.isContainer(container))) {
- return
- }
-
- function startEditing() {
+function startEditing() {
DeletionManager.removeEventListeners();
}
});
}
- function buildChoice(container, property, path, value, key) {
+ function buildChoice(container, property, path, value, key, props={}) {
function onFormFieldValueChanged(event) {
if (DescriptorModelFactory.isContainer(this)) {
if (isMissingDescriptorMeta) {
field = <span key={key.concat('warning').join(':')} className="warning">No Descriptor Meta for {property.name}</span>;
} else if (property.type === 'choice') {
- field = buildChoice(container, property, valuePath, value, key.join(':'));
+ field = buildChoice(container, property, valuePath, value, key.join(':'), props);
} else if (isSimpleListView) {
- field = buildSimpleListItem(container, property, valuePath, value, key, index);
+ field = buildSimpleListItem(container, property, valuePath, value, key, index, props);
} else if (isLeafList) {
- field = buildLeafListItem(container, property, valuePath, value, key, index);
+ field = buildLeafListItem(container, property, valuePath, value, key, index, props);
} else if (hasProperties) {
- field = buildElement(container, property, valuePath, value, key.join(':'))
+ field = buildElement(container, property, valuePath, value, key.join(':'), props)
} else {
- field = buildField(container, property, valuePath, value, key.join(':'));
+ field = buildField(container, property, valuePath, value, key.join(':'), props);
}
function onClickLeaf(property, path, value, event) {
);
}
+export default function EditDescriptorModelProperties(props, type) {
+
+ const container = props.container;
+
+ if (!(DescriptorModelFactory.isContainer(container))) {
+ return
+ }
+
+
- const containerType = container.uiState['qualified-type'] || container.uiState.type;
+ const containerType = (_.isEmpty(type) ? false : type)|| container.uiState['qualified-type'] || container.uiState.type;
const basicProperties = getDescriptorMetaBasicForType(containerType).properties;
function buildBasicGroup() {
{properties.map(property => {
const path = [property.name];
const value = container.model[property.name];
- return build(container, property, path, value, {toggle: true, width: props.width});
+ return build(container, property, path, value, _.assign({toggle: true, width: props.width}, props));
})}
</div>
<div className="toggle-bottom-spacer" style={{visibility: 'hidden', 'height': '50%', position: 'absolute'}}>We need this so when the user closes the panel it won't shift away and scare the bj out of them!</div>
);
}
+export {build}
+// export buildElement;
+// export buildChoice;