forked from OptimalBPM/angular-schema-form-dynamic-select
-
Notifications
You must be signed in to change notification settings - Fork 0
/
angular-schema-form-dynamic-select.min.js
1 lines (1 loc) · 24.7 KB
/
angular-schema-form-dynamic-select.min.js
1
!function(e,t){"function"==typeof define&&define.amd?define(["angular-schema-form"],t):"object"==typeof exports?module.exports=t(require("angular-schema-form")):e.angularSchemaFormDynamicSelect=t(e.schemaForm)}(this,function(e){return angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/strap/strapmultiselect.html",'<div ng-controller="dynamicSelectController" class="form-group {{form.htmlClass}}" ng-class="{\'has-error\': hasError(), \'has-success\': hasSuccess()}"><label class="control-label {{form.labelHtmlClass}}" ng-show="showTitle()">{{form.title}}</label><div class="form-group {{form.fieldHtmlClass}}" ng-init="populateTitleMap(form)"><button type="button" class="btn btn-default" sf-changed="form" schema-validate="form" ng-model="$$value$$" data-placeholder="{{form.placeholder || form.schema.placeholder || (\'placeholders.select\')}}" data-html="1" data-multiple="1" data-max-length="{{form.options.inlineMaxLength}}" data-max-length-html="{{form.options.inlineMaxLengthHtml}}" bs-options="item.value as item.name for item in form.titleMap | selectFilter:this:$$value$$:"$$value$$"" bs-select=""></button> <span class="help-block">{{ (hasError() && errorMessage(schemaError())) || form.description}}</span></div></div>'),e.put("directives/decorators/bootstrap/strap/strapselect.html",'<div ng-controller="dynamicSelectController" class="form-group {{form.htmlClass}}" ng-class="{\'has-error\': hasError(), \'has-success\': hasSuccess()}"><label class="control-label {{form.labelHtmlClass}}" ng-show="showTitle()">{{form.title}}</label><div class="form-group {{form.fieldHtmlClass}}" ng-init="populateTitleMap(form)"><button ng-if="(form.options.multiple == \'true\') || (form.options.multiple == true)" type="button" class="btn btn-default" sf-changed="form" schema-validate="form" ng-model="$$value$$" data-placeholder="{{form.placeholder || form.schema.placeholder || (\'placeholders.select\')}}" data-html="1" data-multiple="1" data-max-length="{{form.options.inlineMaxLength}}" data-max-length-html="{{form.options.inlineMaxLengthHtml}}" bs-options="item.value as item.name for item in form.titleMap | selectFilter:this:$$value$$:"$$value$$"" bs-select=""></button> <button ng-if="!((form.options.multiple == \'true\') || (form.options.multiple == true))" type="button" class="btn btn-default" sf-changed="form" schema-validate="form" ng-model="$$value$$" data-placeholder="{{form.placeholder || form.schema.placeholder || (\'placeholders.select\')}}" data-html="1" bs-options="item.value as item.name for item in form.titleMap | selectFilter:this:$$value$$:"$$value$$"" bs-select=""></button> <span class="help-block">{{ (hasError() && errorMessage(schemaError())) || form.description}}</span></div></div>'),e.put("directives/decorators/bootstrap/strap/uiselect.html",'<div ng-controller="dynamicSelectController" class="form-group" ng-class="{\'has-error\': hasError(), \'has-success\': hasSuccess(), \'has-feedback\': form.feedback !== false}" ng-init="insideModel=$$value$$;"><label class="control-label" ng-show="showTitle()">{{form.title}}</label><div class="form-group"><ui-select ng-model="select_model.selected" ng-if="!(form.options.tagging||false)" theme="bootstrap" ng-disabled="form.disabled" on-select="$$value$$=$item.value" class="{{form.options.uiClass}}"><ui-select-match placeholder="{{form.placeholder || form.schema.placeholder || (\'placeholders.select\' | translate)}}">{{select_model.selected.name}}</ui-select-match><ui-select-choices refresh="populateTitleMap(form, $select.search)" refresh-delay="form.options.refreshDelay" group-by="form.options.groupBy" repeat="item in form.titleMap | propsFilter: {name: $select.search, description: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\') }"><div ng-bind-html="item.name | highlight: $select.search"></div><div ng-if="item.description"><span ng-bind-html="\'<small>\' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\'))+ \'</small>\'"></span></div></ui-select-choices></ui-select><ui-select ng-controller="dynamicSelectController" ng-model="select_model.selected" ng-if="(form.options.tagging||false) && !(form.options.groupBy || false)" tagging="form.options.tagging||false" tagging-label="form.options.taggingLabel" tagging-tokens="form.options.taggingTokens" theme="bootstrap" ng-disabled="form.disabled" on-select="$$value$$=$item.value" class="{{form.options.uiClass}}"><ui-select-match placeholder="{{form.placeholder || form.schema.placeholder || (\'placeholders.select\' | translate)}}">{{select_model.selected.name}} <small>{{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}</small></ui-select-match><ui-select-choices refresh="populateTitleMap(form, $select.search))" refresh-delay="form.options.refreshDelay" repeat="item in form.titleMap | propsFilter: {name: $select.search, description: (form.options.searchDescription===true ? $select.search : \'NOTSEARCHINGFORTHIS\') }"><div ng-if="item.isTag" ng-bind-html="\'<div>\' + (item.name | highlight: $select.search) + \' \' + form.options.taggingLabel + \'</div><div class="divider"></div>\'"></div><div ng-if="!item.isTag" ng-bind-html="item.name + item.isTag| highlight: $select.search"></div><div ng-if="item.description"><span ng-bind-html="\'<small>\' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\')) + \'</small>\'"></span></div></ui-select-choices></ui-select><ui-select ng-controller="dynamicSelectController" ng-model="select_model.selected" ng-if="(form.options.tagging||false) && (form.options.groupBy || false)" tagging="form.options.tagging||false" tagging-label="form.options.taggingLabel" tagging-tokens="form.options.taggingTokens" theme="bootstrap" ng-disabled="form.disabled" on-select="$$value$$=$item.value" class="{{form.options.uiClass}}"><ui-select-match placeholder="{{form.placeholder || form.schema.placeholder || (\'placeholders.select\' | translate)}}">{{select_model.selected.name}} <small>{{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}</small></ui-select-match><ui-select-choices group-by="form.options.groupBy" refresh="populateTitleMap(form, $select.search)" refresh-delay="form.options.refreshDelay" repeat="item in form.titleMap | propsFilter: {name: $select.search, description: (form.options.searchDescription===true ? $select.search : \'NOTSEARCHINGFORTHIS\') }"><div ng-if="item.isTag" ng-bind-html="\'<div>\' + (item.name | highlight: $select.search) + \' \' + form.options.taggingLabel + \'</div><div class="divider"></div>\'"></div><div ng-if="!item.isTag" ng-bind-html="item.name + item.isTag| highlight: $select.search"></div><div ng-if="item.description"><span ng-bind-html="\'<small>\' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\')) + \'</small>\'"></span></div></ui-select-choices></ui-select><input type="hidden" toggle-single-model="" sf-changed="form" ng-model="insideModel" schema-validate="form"> <span ng-if="form.feedback !== false" class="form-control-feedback" ng-class="evalInScope(form.feedback) || {\'glyphicon\': true, \'glyphicon-ok\': hasSuccess(), \'glyphicon-remove\': hasError() }"></span><div class="help-block" ng-show="(hasError() && errorMessage(schemaError())) || form.description" ng-bind-html="(hasError() && errorMessage(schemaError())) || form.description"></div></div></div>'),e.put("directives/decorators/bootstrap/strap/uiselectmultiple.html",'<div class="form-group" ng-class="{\'has-error\': hasError(), \'has-success\': hasSuccess(), \'has-feedback\': form.feedback !== false}" ng-controller="dynamicSelectController" ng-init="uiMultiSelectInitInternalModel($$value$$)"><label class="control-label" ng-show="showTitle()">{{form.title}}</label><div class="form-group"><ui-select multiple="" sortable-options="{{form.sortableOptions}}" ng-model="internalModel" theme="bootstrap" on-select="$$value$$.push($item.value)" on-remove="$$value$$.splice($$value$$.indexOf($item.value), 1)" class="{{form.options.uiClass}}"><ui-select-match placeholder="{{form.placeholder || form.schema.placeholder || (\'placeholders.select\' | translate)}}">{{$item.name}}</ui-select-match><ui-select-choices repeat="item in form.titleMap | propsFilter: {name: $select.search}" refresh="populateTitleMap(form, $select.search)" refresh-delay="form.options.refreshDelay"><div ng-bind-html="item.name | highlight: $select.search"></div></ui-select-choices></ui-select><span ng-if="form.feedback !== false" class="form-control-feedback" ng-class="evalInScope(form.feedback) || {\'glyphicon\': true, \'glyphicon-ok\': hasSuccess(), \'glyphicon-remove\': hasError() }"></span><div class="help-block" ng-show="(hasError() && errorMessage(schemaError())) || form.description" ng-bind-html="(hasError() && errorMessage(schemaError())) || form.description"></div></div></div>')}]),angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/strap/strapmultiselect.html",'<div ng-controller="dynamicSelectController" class="form-group {{form.htmlClass}}" ng-class="{\'has-error\': hasError(), \'has-success\': hasSuccess()}"><label class="control-label {{form.labelHtmlClass}}" ng-show="showTitle()">{{form.title}}</label><div class="form-group {{form.fieldHtmlClass}}" ng-init="populateTitleMap(form)"><button type="button" class="btn btn-default" sf-changed="form" schema-validate="form" ng-model="$$value$$" data-placeholder="{{form.placeholder || form.schema.placeholder || (\'placeholders.select\')}}" data-html="1" data-multiple="1" data-max-length="{{form.options.inlineMaxLength}}" data-max-length-html="{{form.options.inlineMaxLengthHtml}}" bs-options="item.value as item.name for item in form.titleMap | selectFilter:this:$$value$$:"$$value$$"" bs-select=""></button> <span class="help-block">{{ (hasError() && errorMessage(schemaError())) || form.description}}</span></div></div>'),e.put("directives/decorators/bootstrap/strap/strapselect.html",'<div ng-controller="dynamicSelectController" class="form-group {{form.htmlClass}}" ng-class="{\'has-error\': hasError(), \'has-success\': hasSuccess()}"><label class="control-label {{form.labelHtmlClass}}" ng-show="showTitle()">{{form.title}}</label><div class="form-group {{form.fieldHtmlClass}}" ng-init="populateTitleMap(form)"><button ng-if="(form.options.multiple == \'true\') || (form.options.multiple == true)" type="button" class="btn btn-default" sf-changed="form" schema-validate="form" ng-model="$$value$$" data-placeholder="{{form.placeholder || form.schema.placeholder || (\'placeholders.select\')}}" data-html="1" data-multiple="1" data-max-length="{{form.options.inlineMaxLength}}" data-max-length-html="{{form.options.inlineMaxLengthHtml}}" bs-options="item.value as item.name for item in form.titleMap | selectFilter:this:$$value$$:"$$value$$"" bs-select=""></button> <button ng-if="!((form.options.multiple == \'true\') || (form.options.multiple == true))" type="button" class="btn btn-default" sf-changed="form" schema-validate="form" ng-model="$$value$$" data-placeholder="{{form.placeholder || form.schema.placeholder || (\'placeholders.select\')}}" data-html="1" bs-options="item.value as item.name for item in form.titleMap | selectFilter:this:$$value$$:"$$value$$"" bs-select=""></button> <span class="help-block">{{ (hasError() && errorMessage(schemaError())) || form.description}}</span></div></div>')}]),angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/uiselect/uiselect.html",'<div ng-controller="dynamicSelectController" class="form-group" ng-class="{\'has-error\': hasError(), \'has-success\': hasSuccess(), \'has-feedback\': form.feedback !== false}" ng-init="insideModel=$$value$$;"><label class="control-label" ng-show="showTitle()">{{form.title}}</label><div class="form-group"><ui-select ng-model="select_model.selected" ng-if="!(form.options.tagging||false)" theme="bootstrap" ng-disabled="form.disabled" on-select="$$value$$=$item.value" class="{{form.options.uiClass}}"><ui-select-match placeholder="{{form.placeholder || form.schema.placeholder || (\'placeholders.select\' | translate)}}">{{select_model.selected.name}}</ui-select-match><ui-select-choices refresh="populateTitleMap(form, $select.search)" refresh-delay="form.options.refreshDelay" group-by="form.options.groupBy" repeat="item in form.titleMap | propsFilter: {name: $select.search, description: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\') }"><div ng-bind-html="item.name | highlight: $select.search"></div><div ng-if="item.description"><span ng-bind-html="\'<small>\' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\'))+ \'</small>\'"></span></div></ui-select-choices></ui-select><ui-select ng-controller="dynamicSelectController" ng-model="select_model.selected" ng-if="(form.options.tagging||false) && !(form.options.groupBy || false)" tagging="form.options.tagging||false" tagging-label="form.options.taggingLabel" tagging-tokens="form.options.taggingTokens" theme="bootstrap" ng-disabled="form.disabled" on-select="$$value$$=$item.value" class="{{form.options.uiClass}}"><ui-select-match placeholder="{{form.placeholder || form.schema.placeholder || (\'placeholders.select\' | translate)}}">{{select_model.selected.name}} <small>{{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}</small></ui-select-match><ui-select-choices refresh="populateTitleMap(form, $select.search))" refresh-delay="form.options.refreshDelay" repeat="item in form.titleMap | propsFilter: {name: $select.search, description: (form.options.searchDescription===true ? $select.search : \'NOTSEARCHINGFORTHIS\') }"><div ng-if="item.isTag" ng-bind-html="\'<div>\' + (item.name | highlight: $select.search) + \' \' + form.options.taggingLabel + \'</div><div class="divider"></div>\'"></div><div ng-if="!item.isTag" ng-bind-html="item.name + item.isTag| highlight: $select.search"></div><div ng-if="item.description"><span ng-bind-html="\'<small>\' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\')) + \'</small>\'"></span></div></ui-select-choices></ui-select><ui-select ng-controller="dynamicSelectController" ng-model="select_model.selected" ng-if="(form.options.tagging||false) && (form.options.groupBy || false)" tagging="form.options.tagging||false" tagging-label="form.options.taggingLabel" tagging-tokens="form.options.taggingTokens" theme="bootstrap" ng-disabled="form.disabled" on-select="$$value$$=$item.value" class="{{form.options.uiClass}}"><ui-select-match placeholder="{{form.placeholder || form.schema.placeholder || (\'placeholders.select\' | translate)}}">{{select_model.selected.name}} <small>{{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}</small></ui-select-match><ui-select-choices group-by="form.options.groupBy" refresh="populateTitleMap(form, $select.search)" refresh-delay="form.options.refreshDelay" repeat="item in form.titleMap | propsFilter: {name: $select.search, description: (form.options.searchDescription===true ? $select.search : \'NOTSEARCHINGFORTHIS\') }"><div ng-if="item.isTag" ng-bind-html="\'<div>\' + (item.name | highlight: $select.search) + \' \' + form.options.taggingLabel + \'</div><div class="divider"></div>\'"></div><div ng-if="!item.isTag" ng-bind-html="item.name + item.isTag| highlight: $select.search"></div><div ng-if="item.description"><span ng-bind-html="\'<small>\' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\')) + \'</small>\'"></span></div></ui-select-choices></ui-select><input type="hidden" toggle-single-model="" sf-changed="form" ng-model="insideModel" schema-validate="form"> <span ng-if="form.feedback !== false" class="form-control-feedback" ng-class="evalInScope(form.feedback) || {\'glyphicon\': true, \'glyphicon-ok\': hasSuccess(), \'glyphicon-remove\': hasError() }"></span><div class="help-block" ng-show="(hasError() && errorMessage(schemaError())) || form.description" ng-bind-html="(hasError() && errorMessage(schemaError())) || form.description"></div></div></div>'),e.put("directives/decorators/bootstrap/uiselect/uiselectmultiple.html",'<div class="form-group" ng-class="{\'has-error\': hasError(), \'has-success\': hasSuccess(), \'has-feedback\': form.feedback !== false}" ng-controller="dynamicSelectController" ng-init="uiMultiSelectInitInternalModel($$value$$)"><label class="control-label" ng-show="showTitle()">{{form.title}}</label><div class="form-group"><ui-select multiple="" sortable-options="{{form.sortableOptions}}" ng-model="internalModel" theme="bootstrap" on-select="$$value$$.push($item.value)" on-remove="$$value$$.splice($$value$$.indexOf($item.value), 1)" class="{{form.options.uiClass}}"><ui-select-match placeholder="{{form.placeholder || form.schema.placeholder || (\'placeholders.select\' | translate)}}">{{$item.name}}</ui-select-match><ui-select-choices repeat="item in form.titleMap | propsFilter: {name: $select.search}" refresh="populateTitleMap(form, $select.search)" refresh-delay="form.options.refreshDelay"><div ng-bind-html="item.name | highlight: $select.search"></div></ui-select-choices></ui-select><span ng-if="form.feedback !== false" class="form-control-feedback" ng-class="evalInScope(form.feedback) || {\'glyphicon\': true, \'glyphicon-ok\': hasSuccess(), \'glyphicon-remove\': hasError() }"></span><div class="help-block" ng-show="(hasError() && errorMessage(schemaError())) || form.description" ng-bind-html="(hasError() && errorMessage(schemaError())) || form.description"></div></div></div>')}]),angular.module("schemaForm").config(["schemaFormProvider","schemaFormDecoratorsProvider","sfPathProvider",function(e,t,o){var l=function(t,l,s){if("string"===l.type&&"enum"in l){var a=e.stdFormObj(t,l,s);return a.key=s.path,a.type="strapselect",s.lookup[o.stringify(s.path)]=a,a}};e.defaults.string.unshift(l),t.addMapping("bootstrapDecorator","strapselect","directives/decorators/bootstrap/strap/strapselect.html"),t.addMapping("bootstrapDecorator","strapmultiselect","directives/decorators/bootstrap/strap/strapmultiselect.html"),t.addMapping("bootstrapDecorator","strapselectdynamic","directives/decorators/bootstrap/strap/strapselect.html"),t.addMapping("bootstrapDecorator","strapmultiselectdynamic","directives/decorators/bootstrap/strap/strapmultiselect.html"),t.addMapping("bootstrapDecorator","uiselect","directives/decorators/bootstrap/uiselect/uiselect.html"),t.addMapping("bootstrapDecorator","uiselectmultiple","directives/decorators/bootstrap/uiselect/uiselectmultiple.html")}]).directive("toggleSingleModel",function(){return{require:"ngModel",restrict:"A",scope:{},replace:!0,controller:["$scope",function(e){e.$parent.$watch("select_model.selected",function(){void 0!=e.$parent.select_model.selected&&(e.$parent.insideModel=e.$parent.select_model.selected.value,e.$parent.ngModel.$setViewValue(e.$parent.select_model.selected.value))})}]}}).directive("multipleOn",function(){return{link:function(e,t,o){e.$watch(function(){return t.attr("multiple-on")},function(e){if("true"==e){var o=angular.element(t).scope().$$childTail;o.$isMultiple=!0,o.options.multiple=!0,o.$select.$element.addClass("select-multiple")}else angular.element(t).scope().$$childTail.$isMultiple=!1})}}}).filter("whereMulti",function(){return function(e,t,o){var l=[];return angular.isArray(o)&&void 0!==e?o.forEach(function(o){for(var s=0;s<e.length;s++)if(o==e[s][t]){l.push(e[s]);break}}):l=e,l}}).filter("propsFilter",function(){return function(e,t){var o=[];return angular.isArray(e)?e.forEach(function(e){for(var l=!1,s=Object.keys(t),a=0;a<s.length;a++){var r=s[a];if(e.hasOwnProperty(r)){var i=t[r].toLowerCase();if(0===e[r].toString().toLowerCase().indexOf(i)||-1!==e[r].toString().toLowerCase().indexOf(" "+i)){l=!0;break}}}l&&o.push(e)}):o=e,o}}),angular.module("schemaForm").controller("dynamicSelectController",["$scope","$http","$timeout",function(e,t,o){e.form.options||(e.form.options={}),e.select_model={},console.log("Setting options."+e.form.options.toString()),e.form.options.scope=e,e.triggerTitleMap=function(){console.log("listener triggered"),e.form.titleMap.push({value:"345890u340598u3405u9",name:"34095u3p4ouij"}),o(function(){e.form.titleMap.pop()})},e.initFiltering=function(t){e.form.options.filterTriggers&&e.form.options.filterTriggers.forEach(function(t){e.$parent.$watch(t,e.triggerTitleMap)}),e.localModelType=Object.prototype.toString.call(t),e.filteringInitialized=!0},e.finalizeTitleMap=function(t,o,l){if(t.titleMap=[],l&&"map"in l&&l.map){var s=l.map.nameProperty.length-1,a=l.map.separatorValue?l.map.separatorValue:" - ";o.forEach(function(e){if(e.value=e[l.map.valueProperty],"string"!=typeof l.map.nameProperty){var o="";for(var r in l.map.nameProperty)o+=e[l.map.nameProperty[r]],r!=s&&(o+=a);e.name=o}else e.name=e[l.map.nameProperty];t.titleMap.push(e)})}else o.forEach(function(e){"text"in e&&(e.name=e.text)}),t.titleMap=o;e.insideModel&&void 0===e.select_model.selected&&(e.select_model.selected=e.find_in_titleMap(e.insideModel)),e.internalModel&&(console.log("Call uiMultiSelectInitInternalModel"),e.uiMultiSelectInitInternalModel(e.externalModel))},e.clone=function(t){if(null==t||"object"!=typeof t)return t;var o=t.constructor();for(var l in t)t[l]!=e&&t.hasOwnProperty(l)&&(o[l]=e.clone(t[l]));return o},e.getCallback=function(t){if("string"==typeof t){var o=e.$parent.evalExpr(t);if("function"==typeof o)return o;throw"A callback string must match name of a function in the parent scope"}if("function"==typeof t)return t;throw"A callback must either be a string matching the name of a function in the parent scope or a direct function reference"},e.getOptions=function(t,o){return t.httpPost&&t.httpPost.optionsCallback?(newOptionInstance=e.clone(t),e.getCallback(t.httpPost.optionsCallback)(newOptionInstance,o)):t.httpGet&&t.httpGet.optionsCallback?(newOptionInstance=e.clone(t),e.getCallback(t.httpGet.optionsCallback)(newOptionInstance,o)):t},e.test=function(e){e.titleMap.pop()},e.populateTitleMap=function(o,l){if(o.schema&&"enum"in o.schema)o.titleMap=[],o.schema["enum"].forEach(function(e){o.titleMap.push({value:e,name:e})});else if(o.options)if(o.options.callback)o.titleMap=e.getCallback(o.options.callback)(o.options,l),e.finalizeTitleMap(o,o.titleMap,o.options),console.log("callback items: ",o.titleMap);else{if(o.options.asyncCallback)return e.getCallback(o.options.asyncCallback)(o.options,l).then(function(t){e.finalizeTitleMap(o,t.data,o.options),console.log("asyncCallback items",o.titleMap)},function(e,t){alert("Loading select items failed(Options: '"+String(o.options)+"\nError: "+t)});if(o.options.httpPost){var s=e.getOptions(o.options,l);return t.post(s.httpPost.url,s.httpPost.parameter).then(function(t){e.finalizeTitleMap(o,t.data,s),console.log("httpPost items",o.titleMap)},function(e,t){alert("Loading select items failed (URL: '"+String(s.httpPost.url)+"' Parameter: "+String(s.httpPost.parameter)+"\nError: "+t)})}if(o.options.httpGet){var s=e.getOptions(o.options,l);return t.get(s.httpGet.url,s.httpGet.parameter).then(function(t){e.finalizeTitleMap(o,t.data,s),console.log("httpGet items",o.titleMap)},function(e,t){alert("Loading select items failed (URL: '"+String(s.httpGet.url)+"\nError: "+t)})}}else console.log("dynamicSelectController.populateTitleMap(key:"+o.key+") : No options set, needed for dynamic selects")},e.find_in_titleMap=function(t){for(i=0;i<e.form.titleMap.length;i++)if(e.form.titleMap[i].value==t)return{value:e.form.titleMap[i].value,name:e.form.titleMap[i].name}},e.uiMultiSelectInitInternalModel=function(t){console.log("$scope.externalModel: Key: "+e.form.key.toString()+" Model: "+t.toString()),e.externalModel=t,e.internalModel=[],e.form.titleMap&&void 0!==t&&angular.isArray(t)&&t.forEach(function(t){e.internalModel.push(e.find_in_titleMap(t))})}}]),angular.module("schemaForm").filter("selectFilter",[function(e){return function(e,t,o,l){if(!angular.isDefined(e)||!angular.isDefined(t.form.options)||!angular.isDefined(t.form.options.filter)||""==t.form.options.filter)return e;console.log("----- In filtering for "+t.form.key+"("+t.form.title+"), model value: "+JSON.stringify(o)+"----"),console.log("Filter:"+t.form.options.filter),t.filteringInitialized||(console.log("Initialize filter"),t.initFiltering(o));var s=[];return angular.forEach(e,function(e){t.$eval(t.form.options.filter,{item:e})?s.push(e):o&&("[object Array]"==t.localModelType&&o.indexOf(e.value)>-1?o.splice(o.indexOf(e.value),1):o==e.value&&(console.log("Setting model of type "+t.localModelType+"to null."),o=null))}),"[object Array]"!=t.localModelType||o||(console.log("Resetting model of type "+t.localModelType+" to []."),t.$eval(l+"=[]")),console.log("----- Exiting filter for "+t.form.title+"-----"),s}}]),undefined});