X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Fcomponents%2FEditDescriptorModelProperties.js;h=2a5da2191323c17c03296b13dc0995c13f95e8ef;hb=98ee84ae45e88a9e2197914e7613a2fc3d3a7915;hp=4ee4345b7ebc2ba652e15cf4b6e144e2d0dcaf64;hpb=2d500b28cb1de263137d562547e492c67971e273;p=osm%2FUI.git diff --git a/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js b/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js index 4ee4345b7..2a5da2191 100644 --- a/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js +++ b/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js @@ -46,6 +46,8 @@ import imgRemove from '../../../node_modules/open-iconic/svg/trash.svg' import '../styles/EditDescriptorModelProperties.scss' + + function getDescriptorMetaBasicForType(type) { const basicPropertiesFilter = d => _.includes(DESCRIPTOR_MODEL_FIELDS[type], d.name); return DescriptorModelMetaFactory.getModelMetaForType(type, basicPropertiesFilter) || {properties: []}; @@ -70,16 +72,7 @@ function getTitle(model = {}) { return model.id; } } - -export default function EditDescriptorModelProperties(props) { - - const container = props.container; - - if (!(DescriptorModelFactory.isContainer(container))) { - return - } - - function startEditing() { +function startEditing() { DeletionManager.removeEventListeners(); } @@ -262,7 +255,7 @@ export default function EditDescriptorModelProperties(props) { }); } - function buildChoice(container, property, path, value, key) { + function buildChoice(container, property, path, value, key, props={}) { function onFormFieldValueChanged(event) { if (DescriptorModelFactory.isContainer(this)) { @@ -516,15 +509,15 @@ export default function EditDescriptorModelProperties(props) { if (isMissingDescriptorMeta) { field = No Descriptor Meta for {property.name}; } 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) { @@ -594,8 +587,17 @@ export default function EditDescriptorModelProperties(props) { ); } +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() { @@ -633,7 +635,7 @@ export default function EditDescriptorModelProperties(props) { {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)); })}
We need this so when the user closes the panel it won't shift away and scare the bj out of them!
@@ -665,3 +667,6 @@ export default function EditDescriptorModelProperties(props) { ); } +export {build} +// export buildElement; +// export buildChoice;