From: Bob Gallagher Date: Thu, 30 Mar 2017 14:52:13 +0000 (-0400) Subject: RIFT-15944 - editing an ‘id’ field is troublesome as focus is lost on each char typed X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=commitdiff_plain;h=a74726581355bf8dfa748f340e0632993e2328ed;hp=117596f705c2af2a837847b5d91c7318b6ff3ce4 RIFT-15944 - editing an ‘id’ field is troublesome as focus is lost on each char typed - fixed use of id as html element id - bit of code clean up - made use of knowing when a ‘key’ on a component needs to be unique (only amongst siblings) Change-Id: If90de3090b77341a8857ea80630c539430e6498b Signed-off-by: Bob Gallagher --- diff --git a/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js b/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js index 2615c6e8e..f3b2c7a73 100644 --- a/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js +++ b/skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js @@ -175,11 +175,11 @@ export default function EditDescriptorModelProperties(props) { } } - function buildField(container, property, path, value, fieldKey) { + function buildField(container, property, path, value, fieldId) { let cds = CatalogDataStore; let catalogs = cds.getTransientCatalogs(); - const name = path.join('.'); + const pathToProperty = path.join('.'); const isEditable = true; const isGuid = Property.isGuid(property); const isBoolean = Property.isBoolean(property); @@ -197,81 +197,139 @@ export default function EditDescriptorModelProperties(props) { // so we categorically ignore them // https://trello.com/c/uzEwVx6W/230-bug-enum-should-not-use-index-only-name //return ; - return ; + return ; }); const isValueSet = enumeration.filter(d => d.isSelected).length > 0; if (!isValueSet || property.cardinality === '0..1') { const noValueDisplayText = changeCase.title(property.name); - options.unshift(); + options.unshift(); } - return ; + return ( + + ); } if (isLeafRef) { - let fullFieldKey = _isArray(fieldKey) ? fieldKey.join(':') : fieldKey; + let fullPathString = container.key + ':' + path.join(':'); let containerRef = container; while (containerRef.parent) { - fullFieldKey = containerRef.parent.key + ':' + fullFieldKey; + fullPathString = containerRef.parent.key + ':' + fullPathString; containerRef = containerRef.parent; } - const leafRefPathValues = Property.getLeafRef(property, path, value, fullFieldKey, catalogs, container); + const leafRefPathValues = Property.getLeafRef(property, path, value, fullPathString, catalogs, container); const options = leafRefPathValues && leafRefPathValues.map((d, i) => { - return ; + return ; }); const isValueSet = leafRefPathValues.filter(d => d.isSelected).length > 0; if (!isValueSet || property.cardinality === '0..1') { const noValueDisplayText = changeCase.title(property.name); - options.unshift(); + options.unshift(); } - return ; + return ( + + ); } if (isBoolean) { - let fullFieldKey = _isArray(fieldKey) ? fieldKey.join(':') : fieldKey; - let containerRef = container; - while (containerRef.parent) { - fullFieldKey = containerRef.parent.key + ':' + fullFieldKey; - containerRef = containerRef.parent; - } - const options = [ - , - + , + ] // if (!isValueSet) { const noValueDisplayText = changeCase.title(property.name); - options.unshift(); + options.unshift(); // } let val = value; if(typeof(val) == 'number') { val = value ? "TRUE" : "FALSE" } const isValueSet = (val != '' && val) - return ; + return ( + + ); } if (property['preserve-line-breaks']) { - return