UNPKG

ng2-easyform

Version:

angular2 angular4 ng2

3 lines (2 loc) 39.3 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/forms"),require("@angular/material"),require("moment"),require("@angular/common"),require("rxjs"),require("@angular/common/http"),require("ng2-bootstrap3-grid")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/forms","@angular/material","moment","@angular/common","rxjs","@angular/common/http","ng2-bootstrap3-grid"],e):e(t.ng2Easyform={},t.ng.core,t.ng.forms,t.ng.material,t.moment,t.ng.common,t.Rx,t.ng.common.http,null)}(this,function(t,e,o,n,r,i,a,s,l){"use strict";var p=r.default,c=function(){function t(t,e,o){this.advanced=!1,this.name=t,this.advanced=o,this.operate=e}return t.nomal=new t("nomal","nomal",!1),t.eq=new t("eq","=",!0),t.cn=new t("cn","LIKE",!0),t}(),f=function(){return function(t){this.value=t.value,this.id=t.id,this.selector=t.selector||this.controlType,this.key=t.key||"",this.label=t.label||"",this.span=null==t.span?6:t.span,this.required=!!t.required,this.order=null==t.order?1:t.order,this.controlType=t.controlType||"",this.validator=t.validator,this.asyncValidator=t.asyncValidator,this.labelOffset=null==t.labelOffset?75:t.labelOffset,this.labelSpan=null==t.labelSpan?3:t.labelSpan,this.isObject=null!=t.isObject&&t.isObject,this.disabled=null!=t.disabled&&t.disabled,this.hidden=null!=t.hidden&&t.hidden,this.statusChange=t.statusChange,this.valueChange=t.valueChange,this.op=t.op||c.nomal,this.params=t.params}}(),u=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])};return function(e,o){function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),d=function(t){function e(e){var o=t.call(this,e)||this;return o.controlType="group",o.groupName=e.groupName,o.fields=e.fields||[],o}return u(e,t),e}(f),h=function(){return function(t){this.arrayName=t.arrayName,this.groups=t.groups||[]}}(),y=function(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},m=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},g=function(){function t(t){this.fb=t}return t.prototype.toFormGroup=function(t){var e=this,n={};return t.forEach(function(t){if(t instanceof h){var r=new Array;for(var i in t.groups){var a=[i];r.push(e.toFormGroup(a))}n[t.arrayName]=e.fb.array(r)}else if(t instanceof d)n[t.key]=e.toFormGroup(t.fields);else if(t instanceof f){var s=[],l=[];t.required&&s.push(o.Validators.required),t.validator&&s.push(t.validator),t.asyncValidator&&l.push(t.asyncValidator),s.length>0&&l.length>0?n[t.key]=new o.FormControl({value:t.value,disabled:t.disabled}||"",s,l):s.length>0?n[t.key]=new o.FormControl({value:t.value,disabled:t.disabled}||"",s):l.length>0?n[t.key]=new o.FormControl({value:t.value,disabled:t.disabled}||"",null,l):n[t.key]=new o.FormControl({value:t.value,disabled:t.disabled}||"")}}),new o.FormGroup(n)},t=y([e.Injectable(),m("design:paramtypes",[o.FormBuilder])],t)}(),b=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])};return function(e,o){function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),v=function(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},O=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return b(o,t),o=v([e.Directive({selector:"999"})],o)}(o.FormGroupDirective),C=function(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},j=function(t,e){return function(o,n){e(o,n,t)}},I=function(){function t(t,e){this.ngControl=t,this.controlContainer=e}return Object.defineProperty(t.prototype,"disableControl",{set:function(t){var e=this;setTimeout(function(){var o=t?"disable":"enable";e.ngControl&&e.ngControl.control[o](),e.controlContainer&&e.controlContainer.control[o]()})},enumerable:!0,configurable:!0}),C([e.Input(),_("design:type",Boolean),_("design:paramtypes",[Boolean])],t.prototype,"disableControl",null),t=C([e.Directive({selector:"[disableControl]"}),j(0,e.Optional()),j(0,e.Host()),j(1,e.Optional()),j(1,e.Host()),_("design:paramtypes",[o.NgControl,o.ControlContainer])],t)}(),R=function(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},w=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},F=function(t,e){return function(o,n){e(o,n,t)}},k=function(){function t(t,e){this.ngControl=t,this.controlContainer=e}return Object.defineProperty(t.prototype,"requiredControl",{set:function(t){var e=this;setTimeout(function(){var o=t?"disable":"enable";e.ngControl&&e.ngControl.control[o](),e.controlContainer&&e.controlContainer.control[o]()})},enumerable:!0,configurable:!0}),R([e.Input(),w("design:type",Boolean),w("design:paramtypes",[Boolean])],t.prototype,"requiredControl",null),t=R([e.Directive({selector:"[requiredControl]"}),F(0,e.Optional()),F(0,e.Host()),F(1,e.Optional()),F(1,e.Host()),w("design:paramtypes",[o.NgControl,o.ControlContainer])],t)}(),D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])};var P=p||r;var x=function(t){function o(e){var o=t.call(this)||this;return o.setLocale(e||P.locale()),o}return function(t,e){function o(){this.constructor=t}D(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}(o,t),o.prototype.setLocale=function(e){var o=this;t.prototype.setLocale.call(this,e);var n=P.localeData(e);this._localeData={firstDayOfWeek:n.firstDayOfWeek(),longMonths:n.months(),shortMonths:n.monthsShort(),dates:function(t,e){for(var o=Array(t),n=0;n<t;n++)o[n]=e(n);return o}(31,function(t){return o.createDate(2017,0,t+1).format("D")}),longDaysOfWeek:n.weekdays(),shortDaysOfWeek:n.weekdaysShort(),narrowDaysOfWeek:n.weekdaysMin()}},o.prototype.getYear=function(t){return this.clone(t).year()},o.prototype.getMonth=function(t){return this.clone(t).month()},o.prototype.getDate=function(t){return this.clone(t).date()},o.prototype.getDayOfWeek=function(t){return this.clone(t).day()},o.prototype.getMonthNames=function(t){return"long"==t?this._localeData.longMonths:this._localeData.shortMonths},o.prototype.getDateNames=function(){return this._localeData.dates},o.prototype.getDayOfWeekNames=function(t){return"long"==t?this._localeData.longDaysOfWeek:"short"==t?this._localeData.shortDaysOfWeek:this._localeData.narrowDaysOfWeek},o.prototype.getYearName=function(t){return this.clone(t).format("YYYY")},o.prototype.getFirstDayOfWeek=function(){return this._localeData.firstDayOfWeek},o.prototype.getNumDaysInMonth=function(t){return this.clone(t).daysInMonth()},o.prototype.clone=function(t){return t.clone().locale(this.locale)},o.prototype.createDate=function(t,e,o){if(e<0||e>11)throw Error('Invalid month index "'+e+'". Month index has to be between 0 and 11.');if(o<1)throw Error('Invalid date "'+o+'". Date has to be greater than 0.');var n=P({year:t,month:e,date:o}).locale(this.locale);if(!n.isValid())throw Error('Invalid date "'+o+'" for month with index "'+e+'".');return n},o.prototype.today=function(){return P().locale(this.locale)},o.prototype.parse=function(t,e){return t&&"string"==typeof t?P(t,e,this.locale):t?P(t).locale(this.locale):null},o.prototype.format=function(t,e){if(t=this.clone(t),!this.isValid(t))throw Error("MomentDateAdapter: Cannot format invalid date.");return t.format(e)},o.prototype.addCalendarYears=function(t,e){return this.clone(t).add({years:e})},o.prototype.addCalendarMonths=function(t,e){return this.clone(t).add({months:e})},o.prototype.addCalendarDays=function(t,e){return this.clone(t).add({days:e})},o.prototype.toIso8601=function(t){return this.clone(t).format()},o.prototype.deserialize=function(e){var o;if(e instanceof Date&&(o=P(e)),"string"==typeof e){if(!e)return null;o=P(e,P.ISO_8601).locale(this.locale)}return o&&this.isValid(o)?o:t.prototype.deserialize.call(this,e)},o.prototype.isDateInstance=function(t){return P.isMoment(t)},o.prototype.isValid=function(t){return this.clone(t).isValid()},o.prototype.invalid=function(){return P.invalid()},o.decorators=[{type:e.Injectable}],o.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[n.MAT_DATE_LOCALE]}]}]},o}(n.DateAdapter),M={parse:{dateInput:"l"},display:{dateInput:"l",monthYearLabel:"MMM YYYY",dateA11yLabel:"LL",monthYearA11yLabel:"MMMM YYYY"}},N=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])};return function(e,o){function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),E=function(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},A=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return N(o,t),o.prototype.parse=function(e,o){return t.prototype.parse.call(this,e,o)},o.prototype.deserialize=function(e){return e&&"string"==typeof e&&(13==e.length||10==e.length)&&parseInt(e)?r.unix(parseInt(e)):e&&"number"==typeof e?e/1e9>1e3?r.unix(e/1e3):r.unix(e):t.prototype.deserialize.call(this,e)},o=E([e.Injectable()],o)}(x),S=new Array,V=new Map,G=new Map;function T(t){if(!t.name){t.component.name.length;t.name=t.component.name}return S.push(t),V.set(t.selector,t.component),G.set(t.selector,t),function(t){t.constructor}}var q=function(){function t(t){this.http=t}return t.prototype.handleError=function(t){return console.error("An error occurred",t),Promise.reject(t.message||t)},t}(),B=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])};return function(e,o){function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),L=function(t){function e(e){var o=t.call(this,e)||this;return o.minLength=e.minLength,o.maxLength=e.maxLength,o.pattern=e.pattern,o}return B(e,t),e}(f),Y=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])};return function(e,o){function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),W=function(t){function e(e){var o=t.call(this,e)||this;return o.options=[],o.options=e.options||[],o.optionsUrl=e.optionsUrl||void 0,o.optionsOb=e.optionsOb||void 0,o.dictName=e.dictName||void 0,o.optionId=e.optionId||"key",o.optionName=e.optionName||"value",o.multiple=e.multiple||!1,o}return Y(e,t),e}(f),U=function(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},z=function(){function t(){}return o=t,t.forRoot=function(){return{ngModule:o,providers:[g,{provide:n.DateAdapter,useClass:A},{provide:n.MAT_DATE_FORMATS,useValue:M}]}},t=o=U([e.NgModule({imports:[i.CommonModule],exports:[I,k],declarations:[O,I,k],providers:[g],entryComponents:[]})],t);var o}(),H=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])};return function(e,o){function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),K=function(t){function e(e){var o=t.call(this,e)||this;return o.selector="ef-md-datepicker",o}return H(e,t),e}(f),J=function(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},X=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$=function(){function t(){this.span=12,this.touchUi=!1}return n=t,t.prototype.ngOnInit=function(){this.formControl=this.form.get(this.field.key),this.span=void 0==this.field.span?4:this.field.span,this.label=this.field.label,this.eNfxFlex="calc("+this.span/12*100+"% - 15px)",this.eNfxFlexXs="100%",this.formControl.valueChanges.subscribe(function(t){})},t.prototype.patchValueToView=function(){},t.prototype.onResize=function(t){this.touchUi=t<720},J([e.Input(),X("design:type",Object)],t.prototype,"field",void 0),J([e.Input(),X("design:type",o.FormGroup)],t.prototype,"form",void 0),J([e.HostListener("window:resize",["$event.target.innerWidth"]),X("design:type",Function),X("design:paramtypes",[Object]),X("design:returntype",void 0)],t.prototype,"onResize",null),t=n=J([T({selector:"ef-md-datepicker",component:n,field:K,name:"日期选择"}),e.Component({selector:"ef-md-datepicker",template:'\n <mat-form-field [bsCol.sm]="span" [bsCol.xs]="12">\n <input matInput [matDatepicker]="myDatepicker" [placeholder]="label" [formControl]="formControl" [disableControl]="field.disabled">\n <mat-datepicker-toggle matSuffix [for]="myDatepicker"></mat-datepicker-toggle>\n <mat-datepicker [touchUi]="touchUi" #myDatepicker></mat-datepicker> \n <mat-error *ngIf="formControl.hasError(\'matDatepickerParse\');else elseBlock">\n <strong>时间格式不正确</strong>\n </mat-error> \n <ng-template #elseBlock>\n <mat-error *ngIf="formControl.hasError(\'required\')">\n <strong>必填项</strong>\n </mat-error> \n </ng-template>\n </mat-form-field>\n\n '}),X("design:paramtypes",[])],t);var n}(),Q=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])};return function(e,o){function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),Z=function(t){function e(e){var o=t.call(this,e)||this;return o.selector="ef-md-input",o.type=e.type||"text",o}return Q(e,t),e}(L),tt=function(){function t(){}return t.doFormFieldInputStatusChanges=function(e,o,n,r){null!=n?(t.doErrors(n,r),e.statusChange instanceof Function&&e.statusChange(o)):r.length=0},t.doErrors=function(t,e){for(var o in e.length=0,t)"required"!=o&&e.push(o);return e},t}(),et=function(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},ot=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nt=function(){function t(){this.span=12,this.errors={},this.errorsKeys=[]}return n=t,t.prototype.ngOnInit=function(){var t=this;this.fieldControl=this.form.get(this.field.key),this.span=void 0==this.field.span?4:this.field.span,this.label=this.field.label,this.fieldControl.statusChanges.subscribe(function(e){t.errors=t.fieldControl.errors,tt.doFormFieldInputStatusChanges(t.field,e,t.errors,t.errorsKeys)}),this.fieldControl.valueChanges.subscribe(function(e){t.field.valueChange instanceof Function&&t.field.valueChange(e)})},t.prototype.ngAfterViewInit=function(){},t.prototype.ngOnChanges=function(t){for(var e in this.fieldControl,t){var o=t[e];JSON.stringify(o.currentValue),JSON.stringify(o.previousValue)}},et([e.Input(),ot("design:type",Z)],t.prototype,"field",void 0),et([e.Input(),ot("design:type",o.FormGroup)],t.prototype,"form",void 0),t=n=et([T({selector:"ef-md-input",component:n,field:Z,name:"文本框"}),e.Component({selector:"ef-md-input",template:'\n <mat-form-field\n [bsCol.sm]="span"\n [bsCol.xs]="12"\n [hideRequiredMarker]="false"\n [hidden]="this.field.hidden">\n <input matInput \n [type]="field.type || field.params.inputType " \n [placeholder]="label" \n [formControl]="fieldControl"\n [disableControl]="field.disabled"\n >\n <mat-error *ngIf="fieldControl.hasError(\'required\')">\n <strong>必填项</strong>\n </mat-error> \n <mat-error *ngFor="let key of this.errorsKeys">\n <strong>{{this.errors[key]}}</strong>\n </mat-error> \n </mat-form-field> \n \n '}),ot("design:paramtypes",[])],t);var n}(),rt=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])};return function(e,o){function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),it=function(t){function e(e){var o=t.call(this,e)||this;return o.selector="ef-md-textarea",o.type="textarea",o}return rt(e,t),e}(L),at=function(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},st=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lt=function(){function t(){this.span=12,this.errors={},this.errorsKeys=[]}return n=t,t.prototype.ngOnInit=function(){var t=this;this.fieldControl=this.form.get(this.field.key),this.span=void 0==this.field.span?4:this.field.span,this.lable=this.field.label,this.fieldControl.statusChanges.subscribe(function(e){t.errors=t.fieldControl.errors,tt.doFormFieldInputStatusChanges(t.field,e,t.errors,t.errorsKeys)})},at([e.Input(),st("design:type",Object)],t.prototype,"field",void 0),at([e.Input(),st("design:type",o.FormGroup)],t.prototype,"form",void 0),t=n=at([T({selector:"ef-md-textarea",component:n,field:it,name:"文本域"}),e.Component({selector:"ef-md-textarea",template:'\n <mat-form-field [bsCol.sm]="span" [bsCol.xs]="12" [hidden]="this.field.hidden">\n <textarea matInput [type]="field.type || field.params.inputType" [placeholder]="lable" [formControl]="fieldControl"\n [disableControl]="field.disabled">\n </textarea>\n <mat-error *ngIf="fieldControl.hasError(\'required\')">\n <strong>必填项</strong>\n </mat-error> \n <mat-error *ngFor="let key of this.errorsKeys">\n <strong>{{this.errors[key]}}</strong>\n </mat-error> \n </mat-form-field> \n \n '}),st("design:paramtypes",[])],t);var n}(),pt=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])};return function(e,o){function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),ct=function(t){function e(e){var o=t.call(this,e)||this;return o.selector="ef-md-checkbox",o}return pt(e,t),e}(f),ft=function(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},ut=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dt=function(){function t(){this.span=12,this.checked=!1,this.indeterminate=!1,this.labelPosition="after"}return n=t,t.prototype.ngOnInit=function(){this.formControl=this.form.get(this.field.key),this.span=void 0==this.field.span?4:this.field.span,this.label=this.field.label,this.eNfxFlex="calc("+this.span/12*100+"% - 15px)",this.eNfxFlexXs="100%"},ft([e.Input(),ut("design:type",Object)],t.prototype,"field",void 0),ft([e.Input(),ut("design:type",o.FormGroup)],t.prototype,"form",void 0),t=n=ft([T({selector:"ef-md-checkbox",component:n,field:ct,name:"CheckBox"}),e.Component({selector:"ef-md-checkbox",template:'\n <mat-checkbox\n class="example-margin"\n [checked]="checked"\n [indeterminate]="indeterminate"\n [labelPosition]="labelPosition"\n [formControl]="formControl"\n [disableControl]="field.disabled"\n [hidden]="this.field.hidden"\n [bsCol.sm]="span" [bsCol.xs]="12"\n style="padding-top: 20px;padding-bottom: 15px; min-height: 65.5px;">\n {{label}}\n </mat-checkbox> \n '}),ut("design:paramtypes",[])],t);var n}(),ht=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])};return function(e,o){function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),yt=function(t){function e(e){var o=t.call(this,e)||this;return o.noneOption=!0,o.selector="ef-md-radios",o.noneOption=void 0==e.noneOption||e.noneOption,o}return ht(e,t),e}(W),mt=function(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},gt=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bt=function(){function t(t){this.efDictdataService=t,this.isEasyForm=!0,this.key="dropdowninput",this.label="",this.span=4,this.offset=0,this.hidden=!1,this.disabled=!1,this.options=[],this.optionId="key",this.optionName="value",this.multiple=!1,this.noneOption=!0}return n=t,t.prototype.ngOnInit=function(){var t=this;this.isEasyForm?(this.label=this.field.label,this.key=this.field.key,this.field._view=this,this.controll=this.field._control=this.form.get(this.field.key),this.controll.statusChanges.subscribe(function(e){t.field.statusChange instanceof Function&&t.field.statusChange(e)}),this.controll.valueChanges.subscribe(function(e){t.field.valueChange instanceof Function&&t.field.valueChange(e)}),this.span=void 0==this.field.span?4:this.field.span,this.noneOption=this.field.noneOption,this.dictName=this.field.dictName,this.optionId=this.field.optionId,this.optionName=this.field.optionName,void 0==this.field.options||0==this.field.options.length?this.field.optionsOb?this.field.optionsOb.subscribe(function(e){return t.options=e}):this.dictName&&(this.efDictdataService.getDictDataObserable(this.dictName).subscribe(function(e){return t.options=e}),this.optionId="dictdataName",this.optionName="dictdataValue"):this.field.options instanceof Array?this.options=this.field.options:(this.optionId="key",this.optionName="value",setTimeout(function(){t.options=t.transform(t.field.options)}))):0==this.options.length&&this.optionsOb&&this.optionsOb.subscribe(function(e){return t.options=e})},t.prototype.transform=function(t){var e=[];for(var o in t)e.push({key:o,value:t[o]});return e},mt([e.Input(),gt("design:type",Boolean)],t.prototype,"isEasyForm",void 0),mt([e.Input(),gt("design:type",String)],t.prototype,"key",void 0),mt([e.Input(),gt("design:type",String)],t.prototype,"label",void 0),mt([e.Input(),gt("design:type",Number)],t.prototype,"span",void 0),mt([e.Input(),gt("design:type",Number)],t.prototype,"offset",void 0),mt([e.Input(),gt("design:type",Boolean)],t.prototype,"hidden",void 0),mt([e.Input(),gt("design:type",Boolean)],t.prototype,"disabled",void 0),mt([e.Input(),gt("design:type",a.Observable)],t.prototype,"optionsOb",void 0),mt([e.Input(),gt("design:type",Array)],t.prototype,"options",void 0),mt([e.Input(),gt("design:type",String)],t.prototype,"optionId",void 0),mt([e.Input(),gt("design:type",String)],t.prototype,"optionName",void 0),mt([e.Input(),gt("design:type",Boolean)],t.prototype,"multiple",void 0),mt([e.Input(),gt("design:type",Boolean)],t.prototype,"noneOption",void 0),mt([e.Input(),gt("design:type",yt)],t.prototype,"field",void 0),mt([e.Input(),gt("design:type",o.FormGroup)],t.prototype,"form",void 0),mt([e.Input(),gt("design:type",Object)],t.prototype,"model",void 0),t=n=mt([T({selector:"ef-md-radios",component:n,field:yt,name:"RadiosGroup"}),e.Component({selector:"ef-md-radios",template:'\n <mat-radio-group [bsCol.sm]="span" [bsCol.xs]="12" [formControl]="controll" [disableControl]="field.disabled">\n <mat-radio-button *ngFor="let option of options" [value]="option[optionId]">\n {{ option[optionName] }}\n </mat-radio-button>\n </mat-radio-group> \n '}),gt("design:paramtypes",[q])],t);var n}(),vt=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])};return function(e,o){function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),Ot=function(t){function e(e){var o=t.call(this,e)||this;return o.noneOption=!0,o.selector="ef-md-select",o.noneOption=void 0==e.noneOption||e.noneOption,o}return vt(e,t),e}(W),Ct=function(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},_t=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jt=function(){function t(t,e){this.http=t,this.efDictdataService=e,this.isEasyForm=!0,this.key="dropdowninput",this.label="",this.span=4,this.offset=0,this.hidden=!1,this.disabled=!1,this.options=[],this.optionId="key",this.optionName="value",this.multiple=!1,this.noneOption=!0,this.classExpression={}}return n=t,t.prototype.ngOnInit=function(){var t=this;if(this.isEasyForm?(this.label=this.field.label,this.key=this.field.key,this.field._view=this,this.controll=this.field._control=this.form.get(this.field.key),this.span=void 0==this.field.span?4:this.field.span,this.eNfxFlex="calc("+this.span/12*100+"% - 15px)",this.eNfxFlexXs="100%",this.multiple=n.isMutipleField(this.field),this.noneOption=this.field.noneOption,this.dictName=this.field.dictName,this.patchValueToView(),this.controll.valueChanges.forEach(function(e){t.patchValueToView()}),this.optionId=this.field.optionId,this.optionName=this.field.optionName,void 0==this.field.options||0==this.field.options.length?this.field.optionsOb?this.field.optionsOb.subscribe(function(e){return t.options=e}):this.dictName&&(this.getDictDataObserable(this.dictName).subscribe(function(e){return t.options=e}),this.optionId="dictdataName",this.optionName="dictdataValue"):this.options=this.field.options):0==this.options.length&&this.optionsOb&&this.optionsOb.subscribe(function(e){return t.options=e}),this.classExpression={"form-group":!0},this.isEasyForm)this.classExpression["col-sm-"+this.span]=!0,this.classExpression["col-md-offset-"+this.offset]=0!=this.offset;else{var e=this.field.span||4;this.classExpression["col-sm-"+e]=!0}},t.prototype.patchValueToView=function(){if(this.controll.value&&this.multiple&&"string"==typeof this.controll.value){var t=this.controll.value;this.model=t.split(",")}else this.controll.value&&!this.multiple?this.model=this.controll.value:this.model={}},t.prototype.OnChange=function(t){var e,o;e=this.multiple?t.value.join(","):t.value,this.form.patchValue(((o={})[this.key]=e,o))},t.prototype.ngclasses=function(){var t={"form-group":!0};this.isEasyForm?(t["col-sm-"+this.span]=!0,t["col-md-offset-"+this.offset]=0!=this.offset):t["col-sm-"+(this.field.span||4)]=!0;return t},t.prototype.getDictDataObserable=function(t){return this.efDictdataService.getDictDataObserable(t)},t.prototype.getDataSourceObserable=function(t){var e=new URLSearchParams,o={headers:new s.HttpHeaders({"Content-Type":"application/json;charset=UTF-8"}),search:e};return this.http.get(t,o)},t.prototype.ngOnChanges=function(t){},t.prototype.getOptionObj=function(t){var e=this;return this.field.options&&this.field.options.length>0?this.field.options.forEach(function(o){if(o[e.field.optionId]==t)return o}):this.options&&this.options.length>0&&this.options.forEach(function(o){if(o[e.optionId]==t)return o}),null},t.handleValue=function(t,e,o){switch(t){case"in":return"string"==typeof e&&n.isMutipleField(o)?e.split(","):null==e?[]:e;case"out":return Array.isArray(e)?e.join(","):e}},t.isMutipleField=function(t){return void 0!=t.multiple?t.multiple:t.params.primaryField.multiple||"Select2Component"===t.params.primaryField.webDisplayTypeId},Ct([e.Input(),_t("design:type",Boolean)],t.prototype,"isEasyForm",void 0),Ct([e.Input(),_t("design:type",String)],t.prototype,"key",void 0),Ct([e.Input(),_t("design:type",String)],t.prototype,"label",void 0),Ct([e.Input(),_t("design:type",Number)],t.prototype,"span",void 0),Ct([e.Input(),_t("design:type",Number)],t.prototype,"offset",void 0),Ct([e.Input(),_t("design:type",Boolean)],t.prototype,"hidden",void 0),Ct([e.Input(),_t("design:type",Boolean)],t.prototype,"disabled",void 0),Ct([e.Input(),_t("design:type",a.Observable)],t.prototype,"optionsOb",void 0),Ct([e.Input(),_t("design:type",Array)],t.prototype,"options",void 0),Ct([e.Input(),_t("design:type",String)],t.prototype,"optionId",void 0),Ct([e.Input(),_t("design:type",String)],t.prototype,"optionName",void 0),Ct([e.Input(),_t("design:type",Boolean)],t.prototype,"multiple",void 0),Ct([e.Input(),_t("design:type",Boolean)],t.prototype,"noneOption",void 0),Ct([e.Input(),_t("design:type",Ot)],t.prototype,"field",void 0),Ct([e.Input(),_t("design:type",o.FormGroup)],t.prototype,"form",void 0),Ct([e.Input(),_t("design:type",Object)],t.prototype,"model",void 0),t=n=Ct([T({selector:"ef-md-select",component:n,field:Ot,name:"选择框"}),e.Component({selector:"ef-md-select",template:'\n <mat-form-field [bsCol.sm]="span" [bsCol.xs]="12" style="min-height: 51px;padding-top: 0px;">\n <mat-select\n [placeholder]="label" \n [formControl]="controll"\n floatPlaceholder="never"\n [multiple]="multiple" \n [disableControl]="field.disabled"\n (change)=OnChange($event)> \n <mat-option *ngIf="noneOption">无</mat-option>\n <mat-option *ngFor="let option of options" [value]="option[optionId]">{{ option[optionName] }}</mat-option>\n </mat-select> \n <mat-error *ngIf="controll.hasError(\'required\')">\n <strong>必填项</strong>\n </mat-error> \n </mat-form-field> \n '}),_t("design:paramtypes",[s.HttpClient,q])],t);var n}(),It=function(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},Rt=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wt=function(){function t(t){this.fcs=t}return n=t,t.prototype.ngOnInit=function(){},t.prototype.onSubmit=function(){},It([e.Input(),Rt("design:type",d)],t.prototype,"field",void 0),It([e.Input(),Rt("design:type",o.FormGroup)],t.prototype,"form",void 0),t=n=It([T({selector:"ef-md-field-group",component:n,name:"字段Group"}),e.Component({selector:"ef-md-field-group",template:'\n <ng-container [formGroup]="form">\n <ng-container [formGroupName]="field.groupName" [disableControl]="field.disabled">\n \t<ef-md-fields [form]="form.controls[field.groupName]" [fields]="field.fields"></ef-md-fields>\n </ng-container>\n </ng-container>\n '}),Rt("design:paramtypes",[g])],t);var n}(),Ft=function(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},kt=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dt=function(){function t(t,e){this.vcRef=t,this.componentFactoryResolver=e,this._tipmsg="必填项"}return t.prototype.ngOnInit=function(){},t.prototype.ngAfterViewInit=function(){},t.prototype.ngAfterViewChecked=function(){},t.prototype.ngOnChanges=function(t){var e=this;t.fields&&t.fields.currentValue&&setTimeout(function(){e.wrapperRef.clear(),e.fields.forEach(function(t){var o,n,r=V.get(t.selector);r||(r=V.get("m-custom"));try{o=e.componentFactoryResolver.resolveComponentFactory(r)}catch(t){console.error(t),console.warn("create component error:"+r),r=V.get("m-custom"),o=e.componentFactoryResolver.resolveComponentFactory(r)}(n=e.wrapperRef.createComponent(o)).instance.isEasyForm=!0,n.instance.form=e.form,n.instance.field=t})})},Ft([e.Input(),kt("design:type",Array)],t.prototype,"fields",void 0),Ft([e.Input(),kt("design:type",o.FormGroup)],t.prototype,"form",void 0),Ft([e.ViewChild("wrapper",{read:e.ViewContainerRef}),kt("design:type",e.ViewContainerRef)],t.prototype,"wrapperRef",void 0),t=Ft([e.Component({selector:"ef-md-fields",template:"\n <div>\n <ng-template #wrapper>\n </ng-template> \n </div>\n "}),kt("design:paramtypes",[e.ViewContainerRef,e.ComponentFactoryResolver])],t)}(),Pt=function(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},xt=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mt=function(){function t(t,e){this.fcs=t,this.elementRef=e,this.fields=[],this.payLoad="",this._submited=!1}return t.prototype.ngOnInit=function(){this.form=this.fcs.toFormGroup(this.fields)},t.prototype.ngAfterViewInit=function(){var t=this;this.model&&setTimeout(function(){t.form.patchValue(t.model)},0)},t.prototype.markCheck=function(){this.ngForm.checked=!0},t.prototype.markUnCheck=function(){this.ngForm.checked=!1},t.prototype.doSubmit=function(){this.elementRef.nativeElement.children[0].submit(function(t){t.preventDefault(),console.log("print something here!")})},t.prototype.onSubmit=function(){this.payLoad=JSON.stringify(this.form.value)},t.prototype.ngOnChanges=function(t){t.fields&&t.fields.currentValue&&(this.form=this.fcs.toFormGroup(t.fields.currentValue))},t.prototype.getField=function(t){var e=null;return this.fields.forEach(function(o){o.key==t&&(e=o)}),e},Pt([e.Input(),xt("design:type",Array)],t.prototype,"fields",void 0),Pt([e.Input(),xt("design:type",Object)],t.prototype,"model",void 0),Pt([e.ViewChild(o.FormGroupDirective),xt("design:type",O)],t.prototype,"ngForm",void 0),t=Pt([e.Component({selector:"ef-md-form",template:'\n <form (ngSubmit)="onSubmit()" [formGroup]="form" class="ef-md-form" role="form" bsRow>\n <ef-md-fields [fields]="fields" [form]="form"></ef-md-fields>\n </form> \n ',providers:[g],styles:[".ef-md-form{font-size:16px}\n "]}),xt("design:paramtypes",[g,e.ElementRef])],t)}(),Nt=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])};return function(e,o){function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),Et=function(t){function e(e){var o=t.call(this,e)||this;return o.selector="ef-md-field-group",o}return Nt(e,t),e}(d),At=function(t,e,o,n){var r,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,o,a):r(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},St=function(){function t(){}return t.prototype.isErrorState=function(t,e){if(t&&e){var o=e.checked;return!(!t.invalid||!(t.dirty||t.touched||o))}},t}(),Vt=function(){function t(){}return t=At([e.NgModule({imports:[i.CommonModule,o.FormsModule,o.ReactiveFormsModule,n.MatDatepickerModule,n.MatInputModule,n.MatSelectModule,n.MatCheckboxModule,n.MatRadioModule,l.Bootstrap3GridModule,z],exports:[$,nt,lt,dt,bt,jt,wt,Dt,Mt],declarations:[$,nt,lt,dt,bt,jt,wt,Dt,Mt],providers:[{provide:n.ErrorStateMatcher,useClass:St}],entryComponents:[$,nt,lt,dt,bt,jt,wt,Dt]})],t)}();t.ɵl=f,t.ɵn=W,t.ɵj=T,t.ɵg=f,t.ɵr=d,t.ɵf=T,t.ɵb=I,t.ɵc=k,t.ɵd=A,t.ɵp=wt,t.ɵa=St,t.ɵq=Dt,t.ɵk=dt,t.ɵe=$,t.ɵh=nt,t.ɵi=lt,t.ɵm=bt,t.ɵo=jt,t.EasyFormMdModule=Vt,t.MdDatepickerField=K,t.MdTextinputField=Z,t.MdTextareaField=it,t.MdCheckboxField=ct,t.MdRadioGroupField=yt,t.MdSelectField=Ot,t.MdFieldGroup=Et,t.MdFormComponent=Mt,t.EasyFormCoreModule=z,t.FieldControlService=g,t.uilist=S,t.uimap=V,t.uimap1=G,t.UIComponent=T,t.FormstatusWrap=O,t.EfDictdataService=q,t.FieldBase=f,t.FieldArray=h,t.FieldGroup=d,t.InputField=L,t.OptionsField=W,t.QueryOperate=c,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=ng2-easyform.umd.min.js.map