diff options
Diffstat (limited to 'plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js')
-rw-r--r-- | plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js b/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js index 00fe79523f..ebfc0df6cb 100644 --- a/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js +++ b/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js @@ -214,6 +214,39 @@ return flatValues; } + if (hasUiControl(field, 'expandable-select')) { + var availableValues = field.availableValues; + var flatValues = []; + + var groups = {}; + angular.forEach(availableValues, function (value) { + + if (!value.group) { + value.group = ''; + } + + if (!(value.group in groups) || !groups[value.group]) { + groups[value.group] = {values: [], group: value.group} + } + + var formatted = {key: value.key, value: value.value}; + + if ('tooltip' in value && value.tooltip) { + formatted.tooltip = value.tooltip; + } + + groups[value.group].values.push(formatted); + }); + + angular.forEach(groups, function (group) { + if (group.values.length) { + flatValues.push(group); + } + }); + + return flatValues; + } + if (isSelectControl(field)) { var availableValues = field.availableValues; |