forked from Textalk/angular-schema-form-datepicker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap-datepicker.min.js
1 lines (1 loc) · 1.96 KB
/
bootstrap-datepicker.min.js
1
angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/datepicker/datepicker.html",'<div class="form-group" ng-class="{\'has-error\': hasError()}"><label class="control-label" ng-show="showTitle()">{{form.title}}</label><input ng-show="form.key" style="background-color: white" type="text" class="form-control" schema-validate="form" ng-model="$$value$$" pick-a-date="" min-date="form.minDate" max-date="form.maxDate" format="form.format"><span class="help-block">{{ (hasError() && errorMessage(schemaError())) || form.description}}</span></div>')}]),angular.module("schemaForm").directive("pickADate",function(){var e=function(e){return angular.isString(e)||angular.isNumber(e)?new Date(e):e};return{restrict:"A",require:"ngModel",scope:{ngModel:"=",minDate:"=",maxDate:"=",format:"="},link:function(t,r,a,o){if(r.pickadate){r.pickadate({onClose:function(){r.blur()},formatSubmit:null});var i="yyyy-mm-dd",n=$.fn.pickadate.defaults.format,s=r.pickadate("picker");if(o.$formatters.push(function(e){return angular.isUndefined(e)||null===e?e:(s.set("view",e,{format:t.format||i}),s.set("highlight",e,{format:t.format||i}),s.get("highlight",n))}),o.$parsers.push(function(){return s.get("select",t.format||i)}),angular.isDefined(a.minDate))var c=t.$watch("minDate",function(t){t&&(s.set("min",e(t)),c())},!0);if(angular.isDefined(a.maxDate))var m=t.$watch("maxDate",function(t){t&&(s.set("max",e(t)),m())},!0)}}}}),angular.module("schemaForm").config(["schemaFormProvider","schemaFormDecoratorsProvider","sfPathProvider",function(e,t,r){var a=function(t,a,o){if("string"===a.type&&("date"===a.format||"date-time"===a.format)){var i=e.stdFormObj(t,a,o);return i.key=o.path,i.type="datepicker",o.lookup[r.stringify(o.path)]=i,i}};e.defaults.string.unshift(a),t.addMapping("bootstrapDecorator","datepicker","directives/decorators/bootstrap/datepicker/datepicker.html"),t.createDirective("datepicker","directives/decorators/bootstrap/datepicker/datepicker.html")}]);