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) · 2.58 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 {{form.htmlClass}}" ng-class="{\'has-error\': hasError()}"><label class="control-label {{form.labelHtmlClass}}" ng-show="showTitle()">{{form.title}}</label><div ng-class="{\'input-group\': (form.fieldAddonLeft || form.fieldAddonRight)}"><span ng-if="form.fieldAddonLeft" class="input-group-addon" ng-bind-html="form.fieldAddonLeft"></span> <input ng-show="form.key" type="text" class="form-control {{form.fieldHtmlClass}}" schema-validate="form" ng-model="$$value$$" ng-disabled="form.readonly" pick-a-date="form.pickadate" min-date="form.minDate" max-date="form.maxDate" select-years="form.selectYears" select-months="form.selectMonths" name="{{form.key.slice(-1)[0]}}" format="form.format"> <span ng-if="form.fieldAddonRight" class="input-group-addon" ng-bind-html="form.fieldAddonRight"></span></div><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:"=",pickADate:"=",minDate:"=",maxDate:"=",format:"=",selectYears:"=?",selectMonths:"=?"},link:function(t,a,r,o){if(a.pickadate){var i={onClose:function(){a.blur()},formatSubmit:null,selectYears:t.selectYears||!1,selectMonths:t.selectMonths||!1};t.pickADate&&angular.extend(i,t.pickADate),a.pickadate(i);var n="yyyy-mm-dd",s=$.fn.pickadate.defaults.format,l=a.pickadate("picker");if(o.$formatters.push(function(e){return angular.isUndefined(e)||null===e?e:(l.set("view",e,{format:t.format||n}),l.set("highlight",e,{format:t.format||n}),l.get("highlight",s))}),o.$parsers.push(function(){return l.get("select",t.format||n)}),angular.isDefined(r.minDate))var d=t.$watch("minDate",function(t){t&&(l.set("min",e(t)),d())},!0);if(angular.isDefined(r.maxDate))var m=t.$watch("maxDate",function(t){t&&(l.set("max",e(t)),m())},!0)}}}}),angular.module("schemaForm").config(["schemaFormProvider","schemaFormDecoratorsProvider","sfPathProvider",function(e,t,a){var r=function(t,r,o){if("string"===r.type&&("date"===r.format||"date-time"===r.format)){var i=e.stdFormObj(t,r,o);return i.key=o.path,i.type="datepicker",o.lookup[a.stringify(o.path)]=i,i}};e.defaults.string.unshift(r),t.addMapping("bootstrapDecorator","datepicker","directives/decorators/bootstrap/datepicker/datepicker.html"),t.createDirective("datepicker","directives/decorators/bootstrap/datepicker/datepicker.html")}]);