diff --git a/angular-schema-form-dynamic-select.js b/angular-schema-form-dynamic-select.js index 585a138..93bd135 100644 --- a/angular-schema-form-dynamic-select.js +++ b/angular-schema-form-dynamic-select.js @@ -7,10 +7,10 @@ root.angularSchemaFormDynamicSelect = factory(root.angularSchemaFormDynamicSelect); } }(this, function(angularSchemaFormDynamicSelect) { -angular.module("schemaForm").run(["$templateCache", function($templateCache) {$templateCache.put("directives/decorators/bootstrap/strap/strapmultiselect.html","
\n \n\n
\n \n {{ (hasError() && errorMessage(schemaError())) || form.description}}\n
\n
\n"); -$templateCache.put("directives/decorators/bootstrap/strap/strapselect.html","
\n \n\n
\n \n \n {{ (hasError() && errorMessage(schemaError())) || form.description}} \n
\n
\n\n");}]); -angular.module("schemaForm").run(["$templateCache", function($templateCache) {$templateCache.put("directives/decorators/bootstrap/uiselect/uiselect.html","
\n \n\n
\n \n \n {{select_model.selected.name}}\n \n \n
\n
\n \' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\'))+ \'\'\">\n
\n
\n
\n \n \n {{select_model.selected.name}} \n {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}\n \n \n \n
\' + (item.name | highlight: $select.search) + \' \' + form.options.taggingLabel + \'
\'\">
\n
\n
\n \' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\')) + \'\'\">\n
\n \n \n\n \n\n \n \n {{select_model.selected.name}} \n {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}\n \n \n
\' + (item.name | highlight: $select.search) + \' \' + form.options.taggingLabel + \'
\'\">
\n
\n
\n \' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\')) + \'\'\">\n
\n \n \n\n \n \n\n
\n \n"); -$templateCache.put("directives/decorators/bootstrap/uiselect/uiselectmultiple.html","\n
\n \n
\n \n {{$item.name}}\n \n
\n
\n
\n \n
\n
\n
");}]); +angular.module("schemaForm").run(["$templateCache", function($templateCache) {$templateCache.put("directives/decorators/bootstrap/strap/strapmultiselect.html","
\r\n \r\n\r\n
\r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n {{ (hasError() && errorMessage(schemaError())) || form.description}}\r\n
\r\n
\r\n"); +$templateCache.put("directives/decorators/bootstrap/strap/strapselect.html","
\r\n \r\n\r\n
\r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n {{ (hasError() && errorMessage(schemaError())) || form.description}} \r\n
\r\n
");}]); +angular.module("schemaForm").run(["$templateCache", function($templateCache) {$templateCache.put("directives/decorators/bootstrap/uiselect/uiselect.html","
\r\n \r\n\r\n
\r\n \r\n \r\n {{select_model.selected.name}}\r\n \r\n \r\n
\r\n
\r\n \' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\'))+ \'\'\">\r\n
\r\n
\r\n
\r\n \r\n \r\n {{select_model.selected.name}} \r\n {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}\r\n \r\n \r\n \r\n
\' + (item.name | highlight: $select.search) + \' \' + form.options.taggingLabel + \'
\'\">
\r\n
\r\n
\r\n \' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\')) + \'\'\">\r\n
\r\n \r\n \r\n\r\n \r\n\r\n \r\n \r\n {{select_model.selected.name}} \r\n {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}\r\n \r\n \r\n
\' + (item.name | highlight: $select.search) + \' \' + form.options.taggingLabel + \'
\'\">
\r\n
\r\n
\r\n \' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\')) + \'\'\">\r\n
\r\n \r\n \r\n\r\n \r\n \r\n\r\n
\r\n \r\n"); +$templateCache.put("directives/decorators/bootstrap/uiselect/uiselectmultiple.html","\r\n
\r\n \r\n
\r\n \r\n {{$item.name}}\r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
");}]); angular.module('schemaForm').config( ['schemaFormProvider', 'schemaFormDecoratorsProvider', 'sfPathProvider', function (schemaFormProvider, schemaFormDecoratorsProvider, sfPathProvider) { diff --git a/angular-schema-form-dynamic-select.min.js b/angular-schema-form-dynamic-select.min.js index 6b5e66e..11a3073 100644 --- a/angular-schema-form-dynamic-select.min.js +++ b/angular-schema-form-dynamic-select.min.js @@ -1 +1 @@ -!function(e,t){"function"==typeof define&&define.amd?define(["angularSchemaFormDynamicSelect"],t):"object"==typeof exports?module.exports=t(require("angularSchemaFormDynamicSelect")):e.angularSchemaFormDynamicSelect=t(e.angularSchemaFormDynamicSelect)}(this,function(e){return angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/strap/strapmultiselect.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
'),e.put("directives/decorators/bootstrap/strap/strapselect.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
'),e.put("directives/decorators/bootstrap/strap/uiselect.html",'
{{select_model.selected.name}}
{{select_model.selected.name}}  {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}
{{select_model.selected.name}}  {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}
'),e.put("directives/decorators/bootstrap/strap/uiselectmultiple.html",'
{{$item.name}}
')}]),angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/strap/strapmultiselect.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
'),e.put("directives/decorators/bootstrap/strap/strapselect.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
')}]),angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/uiselect/uiselect.html",'
{{select_model.selected.name}}
{{select_model.selected.name}}  {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}
{{select_model.selected.name}}  {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}
'),e.put("directives/decorators/bootstrap/uiselect/uiselectmultiple.html",'
{{$item.name}}
')}]),angular.module("schemaForm").config(["schemaFormProvider","schemaFormDecoratorsProvider","sfPathProvider",function(e,t,l){var o=function(t,o,s){if("string"===o.type&&"enum"in o){var a=e.stdFormObj(t,o,s);return a.key=s.path,a.type="strapselect",s.lookup[l.stringify(s.path)]=a,a}};e.defaults.string.unshift(o),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,l){e.$watch(function(){return t.attr("multiple-on")},function(e){if("true"==e){var l=angular.element(t).scope().$$childTail;l.$isMultiple=!0,l.options.multiple=!0,l.$select.$element.addClass("select-multiple")}else angular.element(t).scope().$$childTail.$isMultiple=!1})}}}).filter("whereMulti",function(){return function(e,t,l){var o=[];return angular.isArray(l)&&void 0!==e?l.forEach(function(l){for(var s=0;s-1?l.splice(l.indexOf(e.value),1):l==e.value&&(console.log("Setting model of type "+t.localModelType+"to null."),l=null))}),"[object Array]"!=t.localModelType||l||(console.log("Resetting model of type "+t.localModelType+" to []."),t.$eval(o+"=[]")),console.log("----- Exiting filter for "+t.form.title+"-----"),s}}]),e}); \ No newline at end of file +!function(e,t){"function"==typeof define&&define.amd?define(["angularSchemaFormDynamicSelect"],t):"object"==typeof exports?module.exports=t(require("angularSchemaFormDynamicSelect")):e.angularSchemaFormDynamicSelect=t(e.angularSchemaFormDynamicSelect)}(this,function(e){return angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/strap/strapmultiselect.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
'),e.put("directives/decorators/bootstrap/strap/strapselect.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
'),e.put("directives/decorators/bootstrap/strap/uiselect.html",'
{{select_model.selected.name}}
{{select_model.selected.name}}  {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}
{{select_model.selected.name}}  {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}
'),e.put("directives/decorators/bootstrap/strap/uiselectmultiple.html",'
{{$item.name}}
')}]),angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/strap/strapmultiselect.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
'),e.put("directives/decorators/bootstrap/strap/strapselect.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
')}]),angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/uiselect/uiselect.html",'
{{select_model.selected.name}}
{{select_model.selected.name}}  {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}
{{select_model.selected.name}}  {{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}
'),e.put("directives/decorators/bootstrap/uiselect/uiselectmultiple.html",'
{{$item.name}}
')}]),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 i=e.stdFormObj(t,l,s);return i.key=s.path,i.type="strapselect",s.lookup[o.stringify(s.path)]=i,i}};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-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}}]),e}); \ No newline at end of file diff --git a/app.js b/app.js index fd506ee..675377d 100644 --- a/app.js +++ b/app.js @@ -161,7 +161,6 @@ testApp.controller("appController", ["$scope", "$http", function ($scope, $http) } } } - }, required: ["select", "multiselect"] }; @@ -314,6 +313,37 @@ testApp.controller("appController", ["$scope", "$http", function ($scope, $http) } ] }, + { + "type": "help", + "helpvalue" : + "

Support for fieldAddonLeft and fieldAddonRight

" + + "

Standard angular-schema-form selects don't support the fieldAddonLeft and fieldAddonRight options " + + "because Bootstrap doesn't support the input-group-addon class with selects. With this library, selects " + + "are composed from a button, which enables the use of these options.

" + }, + { + "key": "select", + "title": "Single select strap-select, demonstrating support for fieldAddonLeft and fieldAddonRight.", + "description": null, + "fieldAddonLeft": "Left", + "fieldAddonRight": "Right" + }, + { + "key": "multiselect", + "title": "Multi select strap-select, demonstrating support for fieldAddonLeft and fieldAddonRight.", + "type": "strapselect", + "placeholder": "My items feel unselected. Or you selected text3 in the selector above me.", + "description": null, + "options": { + "multiple": "true", + }, + "titleMap": [ + {"value": "value1", "name": "text1"}, + {"value": "value2", "name": "text2"} + ], + "fieldAddonLeft": "Left", + "fieldAddonRight": "Right" + }, { type: "submit", style: "btn-info", diff --git a/src/strapmultiselect.html b/src/strapmultiselect.html index 95cdf29..8ddf988 100644 --- a/src/strapmultiselect.html +++ b/src/strapmultiselect.html @@ -3,14 +3,29 @@
- + +
+ + + + + + + +
+ {{ (hasError() && errorMessage(schemaError())) || form.description}}
diff --git a/src/strapselect.html b/src/strapselect.html index d9a3427..575afb7 100644 --- a/src/strapselect.html +++ b/src/strapselect.html @@ -3,22 +3,36 @@
- - + +
+ + + + + + + + +
+ {{ (hasError() && errorMessage(schemaError())) || form.description}}
- - + \ No newline at end of file