@bi8/am-dyn-form
Version:
ng update @angular/cli yarn add @angular/cli
2 lines • 36.6 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/router"),require("@angular/platform-browser/animations"),require("@angular/forms"),require("@angular/material"),require("rxjs/operators"),require("rxjs/internal/util/pipe"),require("@ng-select/ng-select"),require("rxjs"),require("@bi8/am-io"),require("@angular/cdk/coercion"),require("@angular/flex-layout"),require("lodash"),require("moment"),require("rxjs/internal/observable/of")):"function"==typeof define&&define.amd?define("@bi8/am-dyn-form",["exports","@angular/core","@angular/common","@angular/router","@angular/platform-browser/animations","@angular/forms","@angular/material","rxjs/operators","rxjs/internal/util/pipe","@ng-select/ng-select","rxjs","@bi8/am-io","@angular/cdk/coercion","@angular/flex-layout","lodash","moment","rxjs/internal/observable/of"],t):t(((e=e||self).bi8=e.bi8||{},e.bi8["am-dyn-form"]={}),e.ng.core,e.ng.common,e.ng.router,e.ng.platformBrowser.animations,e.ng.forms,e.ng.material,e.rxjs.operators,e.rxjs["internal/util/pipe"],e.ngSelect,e.rxjs,e.amIo,e.ng.cdk.coercion,e.ng["flex-layout"],e._,e.moment_,e.rxjs["internal/observable/of"])}(this,function(e,t,n,r,o,i,a,s,l,u,c,p,f,d,m,h,g){"use strict";var y=function(e,t){return(y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function v(e,t){function n(){this.constructor=e}y(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function b(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function x(e,t){return function(n,r){t(n,r,e)}}function C(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function M(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function w(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function E(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(w(arguments[t]));return e}var V=function(){function e(){}return e=b([t.Injectable(),C("design:paramtypes",[])],e)}(),F=function(e){function t(t,n){void 0===t&&(t={});var r=e.call(this,n)||this;return r.config={},t&&(r.key=t.key||"",r.dir=t.dir||""),r}return v(t,e),t.prototype.addSlaveObserver=function(e,t,n){var r=this.get(e),o=this.get(t);n?(void 0===n.reset&&(n.reset=!0),void 0===n.disable&&(n.disable=!0),void 0===n.apply&&(n.apply=n.disable)):n={disable:!0,reset:!0,apply:!0};var i=[];return n.reset&&i.push(s.tap(function(){return o.reset()})),n.disable&&(i.push(s.tap(function(){return o.disable()})),n.apply&&o.disable({onlySelf:!0})),i.push(s.filter(function(e){return!!e&&(!(e instanceof Array)||e.length>0)})),n.disable&&i.push(s.tap(function(){return o.enable()})),n.ops&&i.push.apply(i,E(n.ops)),r.valueChanges.pipe(l.pipeFromArray(E(i)))},t}(i.FormGroup),O=function(e){function t(t,n){void 0===t&&(t={});var r=e.call(this,n)||this;return r.config={},t&&(r.key=t.key||"",r.dir=t.dir||""),r}return v(t,e),t.prototype.add=function(e){},t}(i.FormArray),k=function(e){function t(t,n,r){var o,a;void 0===t&&(t={});var s=e.call(this,null!=t.defaultValue?t.defaultValue:null,n,r)||this;if(s.config={},s.key=t.key||"",t&&(s.config.required=null!=t.required&&t.required,s.config.hint=t.hint,s.config.placeholder=t.placeholder,s.config.dir=t.dir||"ltr",s.config.messages=t.messages||[],s.config.useDefaultErrorMessages=t.useDefaultErrorMessages||!1,s.config.loadFn=t.loadFn||null,s.config.disable=t.disable||!1,s.config.appearance=t.appearance||"standard",s.config.compact=void 0===t.compact||t.compact,s.config.loadFn&&s.loadValue(t.defaultValue,s.config.loadFn,{onlySelf:!0}),s.config.disable&&s.disable({onlySelf:!0}),n))if(n instanceof Array)try{for(var l=M(n),u=l.next();!u.done;u=l.next()){if(u.value==i.Validators.required){s.config.required=!0;break}}}catch(e){o={error:e}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(o)throw o.error}}else n==i.Validators.required&&(s.config.required=!0);return s}return v(t,e),t.prototype.removeRequired=function(){this.config.required=!1,this.removeValidator(i.Validators.required),this.updateValueAndValidity()},t.prototype.addRequired=function(){this.config.required=!0,this.setValidator(i.Validators.required),this.updateValueAndValidity()},t.prototype.isRequired=function(){return this.isValidator(i.Validators.required)},t.prototype.isValidator=function(e){return!!this.validator&&(this.validator instanceof Array?null!=this.validator.find(function(t){return t==e}):this.validator=e)},t.prototype.setValidator=function(e){if(!this.isValidator(e))return this.validator instanceof Array?this.validator.push(e):this.validator=e},t.prototype.removeValidator=function(e){this.isValidator(e)&&(this.validator instanceof Array?this.setValidators(this.validator.filter(function(t){return t!=e})):this.setValidators([]))},t.prototype.setLogicalError=function(e){this.logicalErrorMessage=e,this.markAsTouched();var t=this.errors;t||(t={}),t.logical=!0,this.setErrors(t)},t.prototype.clearLogicalError=function(){this.logicalErrorMessage=null,this.errors&&(this.errors.logical=!1,this.setErrors(this.errors))},t.prototype.activateValidators=function(){},t.prototype.setValue=function(t,n){var r=this;n&&n.loadFn?n.loadFn(t).subscribe(function(t){e.prototype.setValue.call(r,t,n)}):null==t?e.prototype.setValue.call(this,"",n):e.prototype.setValue.call(this,t,n)},t.prototype.loadValue=function(t,n,r){var o=this;n(t).subscribe(function(t){e.prototype.setValue.call(o,t,r)})},t}(i.FormControl),T=function(e){function t(t,n,r){void 0===t&&(t={});var o=e.call(this,t,n,r)||this;o.type="autoselect",o.hasValue=!1,o.loading=!1,o.multiple=!1,o.searchable=!0,o.clearToggle=!1,o.showNone=t.showNone||!1,o.noneLabel=t.noneLabel,o.multiple=t.multiple||!1,o.debounce=t.debounce||500,o.searchable=t.searchable||!1;s.debounceTime(200),s.tap(function(){return o.loading=!0}),s.tap(function(){return o.loading=!1});return t.bindLabel?o.bindLabel=t.bindLabel:o.bindLabel="name",t.bindValue&&(o.bindValue=t.bindValue),o.labelTemplate=t.labelTemplate,o.optionTemplate=t.optionTemplate,t.channel&&(o.channel=t.channel,o.channel.asEventObservable().subscribe(function(e){switch(e.observeType){case p.EventType.on_next:o.loading=!0;break;default:o.loading=!1}}),o.searchable?(o.typeahead$=new c.Subject,o.typeahead$.pipe(s.debounceTime(o.debounce),s.distinctUntilChanged()).subscribe(o.channel)):o.typeahead$=null,o.items$=o.channel.asObservable()),o.valueChanges.subscribe(function(e){o.checkHasValue(e),o.hasValue=!!e}),o.channel.next(),o}return v(t,e),t.prototype.checkHasValue=function(e){var t=this;setTimeout(function(){t.element&&(e&&0!==e.length?t.element.classList.add("ng-has-value"):t.element.classList.remove("ng-has-value"))})},t.prototype.reload=function(e){this.channel.next(e)},t.prototype.getCustomPlaceholder=function(){return this.isRequired()?this.config.placeholder+" *":this.config.placeholder},t}(k),N=function(){function e(e,t){this.controlContainer=e,this.elRef=t,this.paths=[],this.messages=new Map}return e.prototype.ngAfterContentInit=function(){},e.prototype.ngAfterViewInit=function(){var e=this.elRef.nativeElement.querySelector(".ng-select-container");e&&this.dfc instanceof T&&(this.dfc.element=e),this.ngSelect&&this.dfc instanceof T&&(this.dfc.ngSelectComponent=this.ngSelect)},e.prototype.ngOnInit=function(){var e,t;this.dfc=this.controlContainer.control.get(this.name),this.placeholder=this.dfc.config.placeholder,this.hint=this.dfc.config.hint;try{for(var n=M(this.dfc.config.messages),r=n.next();!r.done;r=n.next()){var o=r.value;this.messages.set(o.key,o.value)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.path=this.resolvePath()},e.prototype.resolvePath=function(){var e=this,t=[this.dfc.key];this.resolveParentPath(this.dfc.parent,t);var n="";return t.reverse().forEach(function(t,r){t&&(n&&(n+="."),n+=t,e.paths.push(n))}),n},e.prototype.resolveParentPath=function(e,t){e instanceof F?t.push(e.key):e instanceof O&&t.push(e.key),e.parent&&this.resolveParentPath(e.parent,t)},e.prototype.resolveValidationMessage=function(e){var t="";if(this.messages.has(e))t=this.messages.get(e);else if(this.dfc.config.useDefaultErrorMessages)switch(e){case"required":t="Value required";break;case"pattern":t="Invalid format";break;case"email":t="Invalid email"}return t},e.ctorParameters=function(){return[{type:i.ControlContainer,decorators:[{type:t.Optional},{type:t.Host},{type:t.SkipSelf}]},{type:t.ElementRef}]},b([t.Input(),C("design:type",Object)],e.prototype,"name",void 0),b([t.ViewChild("ngselect",{static:!1}),C("design:type",u.NgSelectComponent)],e.prototype,"ngSelect",void 0),e=b([t.Component({selector:"dyn-field",template:'<ng-container [ngSwitch]="dfc.type">\r\n <div fxLayout="row" class="am-field-row">\r\n \x3c!--=====[ AUTO SELECT FIELD ]=====--\x3e\r\n <ng-container *ngSwitchCase="\'autoselect\'">\r\n <div class="am-field-container" fxLayout="row" fxFlex>\r\n <ng-select #ngselect [items]="dfc.items$ | async"\r\n [formControl]="dfc"\r\n [placeholder]="dfc.getCustomPlaceholder()"\r\n [bindLabel]="dfc.bindLabel"\r\n [typeahead]="dfc.typeahead$"\r\n [loading]="dfc.loading"\r\n [bindValue]="dfc.bindValue"\r\n [multiple]="dfc.multiple"\r\n [searchable]="dfc.searchable"\r\n fxFlex="1 1 auto"\r\n [ngClass]="{\'am-has-value\': dfc.hasValue, \'am-no-value\' : !dfc.hasValue}"\r\n style="width: 100px;">\r\n <ng-template ng-label-tmp let-item="item" *ngIf="dfc.labelTemplate" let-clear="clear">\r\n <ng-container [ngTemplateOutlet]="dfc.labelTemplate" [ngTemplateOutletContext]="{item: item, clear: clear}"></ng-container>\r\n </ng-template>\r\n\r\n <ng-template ng-option-tmp let-item="item" let-index="index" let-search="searchTerm" *ngIf="dfc.optionTemplate">\r\n <ng-container [ngTemplateOutlet]="dfc.optionTemplate" [ngTemplateOutletContext]="{item: item, index: index, search: search}"></ng-container>\r\n </ng-template>\r\n </ng-select>\r\n <span class="am-select-error" *ngIf="dfc.hasError(\'required\') && dfc.touched">{{resolveValidationMessage(\'required\')}}</span>\r\n <span class="am-select-error" *ngIf="dfc.hasError(\'pattern\') && dfc.touched">{{resolveValidationMessage(\'pattern\')}}</span>\r\n <span class="am-select-error" *ngIf="dfc.hasError(\'email\') && dfc.touched">{{resolveValidationMessage(\'email\')}}</span>\r\n <span class="am-select-error" *ngIf="dfc.hasError(\'match\') && dfc.touched">{{resolveValidationMessage(\'match\')}}</span>\r\n <span class="am-select-error" *ngIf="dfc.hasError(\'time\') && dfc.touched">{{resolveValidationMessage(\'time\')}}</span>\r\n <span class="am-select-error" *ngIf="dfc.hasError(\'logical\') && dfc.touched">{{dfc.logicalErrorMessage}}</span>\r\n </div>\r\n </ng-container>\r\n\r\n \x3c!--=====[ TEXT FIELD ]=====--\x3e\r\n <mat-form-field *ngSwitchCase="\'text\'" [hintLabel]="hint" fxFlex>\r\n <input matInput\r\n hideRequiredMarker="false"\r\n [name]="dfc.key"\r\n [formControl]="dfc"\r\n [type]="dfc.config.format"\r\n [placeholder]="placeholder"\r\n [maxlength]="dfc.config.maxlimit"\r\n [required]="dfc.config.required"\r\n [dir]="dfc.config.dir">\r\n\r\n <mat-hint *ngIf="dfc.config.counter && dfc.config.maxlimit" align="end" class="no-text-wrap">{{dfc.value ? dfc.value.length : 0}} / {{dfc.config.maxlimit}}</mat-hint>\r\n\r\n <mat-error *ngIf="dfc.hasError(\'required\')">{{resolveValidationMessage(\'required\')}}</mat-error>\r\n <mat-error *ngIf="dfc.hasError(\'pattern\')">{{resolveValidationMessage(\'pattern\')}}</mat-error>\r\n <mat-error *ngIf="dfc.hasError(\'email\')">{{resolveValidationMessage(\'email\')}}</mat-error>\r\n <mat-error *ngIf="dfc.hasError(\'match\')">{{resolveValidationMessage(\'match\')}}</mat-error>\r\n <mat-error *ngIf="dfc.hasError(\'time\')">{{resolveValidationMessage(\'time\')}}</mat-error>\r\n <mat-error *ngIf="dfc.hasError(\'logical\')">{{dfc.logicalErrorMessage}}</mat-error>\r\n </mat-form-field>\r\n\r\n \x3c!--=====[ TEXTAREA FIELD ]=====--\x3e\r\n <mat-form-field *ngSwitchCase="\'textarea\'" [hintLabel]="hint" fxFlex>\r\n <textarea matInput\r\n hideRequiredMarker="false"\r\n matTextareaAutosize\r\n [matAutosizeMinRows]="dfc.config.minRows"\r\n [matAutosizeMaxRows]="dfc.config.maxRows"\r\n [name]="dfc.key"\r\n [formControl]="dfc"\r\n [placeholder]="placeholder"\r\n [maxlength]="dfc.config.maxlimit"\r\n [required]="dfc.config.required"\r\n [dir]="dfc.config.dir"></textarea>\r\n\r\n <mat-hint *ngIf="dfc.config.counter && dfc.config.maxlimit" align="end" class="no-text-wrap">{{dfc.value ? dfc.value.length : 0}} / {{dfc.config.maxlimit}}</mat-hint>\r\n <mat-error *ngIf="dfc.hasError(\'required\')">{{resolveValidationMessage(\'required\')}}</mat-error>\r\n <mat-error *ngIf="dfc.hasError(\'pattern\')">{{resolveValidationMessage(\'pattern\')}}</mat-error>\r\n <mat-error *ngIf="dfc.hasError(\'email\')">{{resolveValidationMessage(\'email\')}}</mat-error>\r\n <mat-error *ngIf="dfc.hasError(\'match\')">{{resolveValidationMessage(\'match\')}}</mat-error>\r\n <mat-error *ngIf="dfc.hasError(\'logical\')">{{dfc.logicalErrorMessage}}</mat-error>\r\n </mat-form-field>\r\n\r\n \x3c!--=====[ AUTOCOMPLETE ]=====--\x3e\r\n <ng-container *ngSwitchCase="\'auto-complete\'">\r\n <mat-form-field fxFlex>\r\n <input matInput\r\n [name]="dfc.key"\r\n [placeholder]="placeholder"\r\n [matAutocomplete]="auto"\r\n [formControl]="dfc"\r\n [required]="dfc.config.required"\r\n [dir]="dfc.config.dir">\r\n\r\n <mat-error *ngIf="dfc.hasError(\'required\')">{{resolveValidationMessage(\'required\')}}</mat-error>\r\n <mat-error *ngIf="dfc.hasError(\'match\')">{{resolveValidationMessage(\'match\')}}</mat-error>\r\n <mat-error *ngIf="dfc.hasError(\'logical\')">{{dfc.logicalErrorMessage}}</mat-error>\r\n\r\n <mat-autocomplete #auto="matAutocomplete" [displayWith]="dfc.displayFn.bind(dfc)">\r\n <mat-option *ngFor="let opt of dfc.selectOptions$ | async" [value]="opt">\r\n {{dfc.displayFn(opt)}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n \x3c!--=====[ DATE ]=====--\x3e\r\n <ng-container *ngSwitchCase="\'date\'">\r\n <mat-form-field fxFlex>\r\n <input matInput\r\n hideRequiredMarker="false"\r\n [name]="dfc.key"\r\n [formControl]="dfc"\r\n type="text"\r\n [min]="dfc.minDate"\r\n [max]="dfc.maxDate"\r\n [required]="dfc.config.required"\r\n [matDatepicker]="picker"\r\n [placeholder]="placeholder"\r\n style="pointer-events:none;" />\r\n\r\n <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>\r\n <mat-datepicker #picker></mat-datepicker>\r\n\r\n <mat-error *ngIf="dfc.hasError(\'required\')">{{resolveValidationMessage(\'required\')}}</mat-error>\r\n <mat-error *ngIf="dfc.hasError(\'pattern\')">{{resolveValidationMessage(\'pattern\')}}</mat-error>\r\n <mat-error *ngIf="dfc.hasError(\'match\')">{{resolveValidationMessage(\'match\')}}</mat-error>\r\n <mat-error *ngIf="dfc.hasError(\'logical\')">{{dfc.logicalErrorMessage}}</mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n \x3c!--=====[ DATE ]=====--\x3e\r\n <ng-container *ngSwitchCase="\'time\'">\r\n <am-timepicker [formControl]="dfc"></am-timepicker>\r\n </ng-container>\r\n\r\n \x3c!--=====[ SELECT FIELD ]=====--\x3e\r\n <ng-container *ngSwitchCase="\'select\'" >\r\n <mat-form-field fxFlex>\r\n <mat-select [formControl]="dfc"\r\n [placeholder]="placeholder"\r\n [required]="dfc.config.required"\r\n required="true"\r\n [multiple]="dfc.multiple">\r\n <mat-option *ngIf="dfc.showNone" (click)="dfc.reset()">{{dfc.noneLabel}}</mat-option>\r\n <mat-option *ngFor="let opt of dfc.selectOptions$ | async" [value]="opt.code">{{opt.value}}</mat-option>\r\n </mat-select>\r\n <mat-error *ngIf="dfc.hasError(\'required\') && dfc.touched">This option is required</mat-error>\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n \x3c!--=====[ CHECK BOX ]=====--\x3e\r\n <ng-container *ngSwitchCase="\'checkbox\'">\r\n <mat-checkbox [formControl]="dfc" fxFlex>\r\n {{placeholder}}\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n \x3c!--=====[ LABEL ]=====--\x3e\r\n <ng-container *ngSwitchCase="\'label\'">\r\n <div fxFlex>{{placeholder}}</div>\r\n </ng-container>\r\n </div>\r\n</ng-container>\r\n',styles:[""]}),x(0,t.Optional()),x(0,t.Host()),x(0,t.SkipSelf()),C("design:paramtypes",[i.ControlContainer,t.ElementRef])],e)}(),S=function(){function e(){}return e.prototype.ngOnInit=function(){},b([t.Input(),C("design:type",String)],e.prototype,"header",void 0),e=b([t.Component({selector:"dyn-toolbar-panel",template:'<mat-card class="container">\r\n <mat-toolbar *ngIf="header" color="primary"> {{header}}</mat-toolbar>\r\n <div class="body">\r\n <ng-content></ng-content>\r\n </div>\r\n</mat-card>\r\n',styles:[""]}),C("design:paramtypes",[])],e)}(),I=function(){function e(){}return e.prototype.ngOnInit=function(){},b([t.Input(),C("design:type",String)],e.prototype,"header",void 0),e=b([t.Component({selector:"dyn-field-set",template:'<fieldset>\r\n <legend *ngIf="header">{{header}}</legend>\r\n <ng-content></ng-content>\r\n</fieldset>\r\n',styles:[""]}),C("design:paramtypes",[])],e)}(),q=function(){function e(e){this._elementRef=e,this._cvaOnChange=function(){},this._validatorOnChange=function(){},this._onTouched=function(){},this.timeForm=new i.FormGroup({hours:new i.FormControl,minutes:new i.FormControl,amPm:new i.FormControl})}var n;return n=e,Object.defineProperty(e.prototype,"minHours",{set:function(e){this._minHours=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxHours",{set:function(e){this._maxHours=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"disabled",{get:function(){return!!this._disabled},set:function(e){var t=f.coerceBooleanProperty(e);this._disabled!==t&&(this._disabled=t)},enumerable:!0,configurable:!0}),e.prototype.ngAfterContentInit=function(){},e.prototype.ngOnDestroy=function(){},e.prototype.writeValue=function(e){this._data=e,console.log("writeValue: ",e)},e.prototype.registerOnChange=function(e){this._cvaOnChange=e,console.log("registerOnChange:",e)},e.prototype.registerOnTouched=function(e){this._onTouched=e,console.log("registerOnTouch: ",e)},e.prototype.setDisabledState=function(e){this.disabled=e,console.log("setDisabled: ",e)},e.ctorParameters=function(){return[{type:t.ElementRef}]},b([t.Input(),C("design:type",Number),C("design:paramtypes",[Number])],e.prototype,"minHours",null),b([t.Input(),C("design:type",Number),C("design:paramtypes",[Number])],e.prototype,"maxHours",null),b([t.Input(),C("design:type",Object),C("design:paramtypes",[Object])],e.prototype,"disabled",null),e=n=b([t.Component({selector:"am-timepicker",template:'<form [formGroup]="timeForm" novalidate style="display: flex; flex-direction: row;">\r\n <mat-form-field style="width: 40px; padding-right: 5px;">\r\n <mat-select formControlName="hours">\r\n <mat-option value="1"> 1</mat-option>\r\n <mat-option value="2">2</mat-option>\r\n <mat-option value="3">3</mat-option>\r\n <mat-option value="4">4</mat-option>\r\n <mat-option value="5">5</mat-option>\r\n <mat-option value="6">6</mat-option>\r\n <mat-option value="7">7</mat-option>\r\n <mat-option value="8">8</mat-option>\r\n <mat-option value="9">9</mat-option>\r\n <mat-option value="10">10</mat-option>\r\n <mat-option value="11">11</mat-option>\r\n <mat-option value="12">12</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n <mat-form-field style="width: 40px; padding-right: 5px;">\r\n <mat-select formControlName="minutes">\r\n <mat-option value="1">00</mat-option>\r\n <mat-option value="1">05</mat-option>\r\n <mat-option value="2">10</mat-option>\r\n <mat-option value="3">15</mat-option>\r\n <mat-option value="4">20</mat-option>\r\n <mat-option value="5">25</mat-option>\r\n <mat-option value="6">30</mat-option>\r\n <mat-option value="7">35</mat-option>\r\n <mat-option value="8">40</mat-option>\r\n <mat-option value="9">45</mat-option>\r\n <mat-option value="10">50</mat-option>\r\n <mat-option value="11">55</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n <mat-form-field style="width: 50px;">\r\n <mat-select formControlName="amPm">\r\n <mat-option value="am">AM</mat-option>\r\n <mat-option value="pm">PM</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n</form>\r\n',providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:t.forwardRef(function(){return n}),multi:!0}]}),C("design:paramtypes",[t.ElementRef])],e)}(),P=function(){function e(){}return e=b([t.NgModule({imports:[n.CommonModule,r.RouterModule,o.BrowserAnimationsModule,i.FormsModule,i.ReactiveFormsModule,d.FlexLayoutModule,a.MatAutocompleteModule,a.MatCardModule,a.MatButtonModule,a.MatCheckboxModule,a.MatDatepickerModule,a.MatNativeDateModule,a.MatTooltipModule,a.MatInputModule,a.MatSelectModule,a.MatOptionModule,a.MatDialogModule,a.MatToolbarModule,a.MatIconModule,a.MatSidenavModule,a.MatMenuModule,a.MatTableModule,a.MatListModule,u.NgSelectModule],exports:[N,I,S,q],declarations:[N,I,S,q],providers:[V]})],e)}(),j=function(e){function t(t,n,r){void 0===t&&(t={});var o=e.call(this,t,n,r)||this;return o.type="text",o.config.format=t.format||"text",o.config.counter=null==t.counter||t.counter,o.config.maxlimit=t.maxlimit,o}return v(t,e),t}(k),A=function(e){function t(t,n,r){void 0===t&&(t={});var o=e.call(this,t,n,r)||this;return o.type="textarea",o.config.minRows=t.minRows||null,o.config.maxRows=t.maxRows||null,o.config.maxlimit=t.maxlimit,o}return v(t,e),t}(k),D=function(e){function t(t,n,r){void 0===t&&(t={});var o=e.call(this,t,n,r)||this;return o.type="auto-complete",o.selectOptions$=new c.Subject,o.total=0,o.items=[],o.loader=t.loader,setTimeout(function(){o.loadValues(null)},0),o.valueChanges.subscribe(function(e){o.loadValues(e)}),o}return v(t,e),t.prototype.loadValues=function(e){var t=this;this.loader.prepare({value:e}).subscribe(function(e){t.total=e.total,t.items=e.items,t.selectOptions$.next(t.items)})},t.prototype.displayFn=function(e){return m.get(e,this.loader.valueProperty)},t}(k),R=function(){function e(e,t,n){this.items=e,this.filterFn=t,this.size=m.isNil(n.size)?15:n.size,this.page=m.isNil(n.page)?0:n.page,this.codeProperty=m.isNil(n.codeProperty)?"code":n.codeProperty,this.valueProperty=m.isNil(n.valueProperty)?"value":n.valueProperty}return e.prototype.prepare=function(e){var t=this;return c.of(this.items).pipe(s.map(function(n){var r=[],o=m.isObject(e);return n.forEach(function(n,i){m.get(n,t.valueProperty);(o||t.filterFn(n,e.value))&&r.push(n)}),t.processResponse({total:r.length,items:r.length>0?m.chunk(r,t.size)[t.page]:r})}))},e.prototype.processResponse=function(e){return e},e}(),L=function(){function e(e,t){this.loadFn=e,t&&(this.size=m.isNil(t.size)?t.size:15,this.page=m.isNil(t.page)?t.page:0)}return e.prototype.prepare=function(e){var t=this,n={size:this.size,page:this.page,value:e};return this.loadFn(n).pipe(s.map(function(e){return t.processResponse(e)}))},e.prototype.processResponse=function(e){return{total:e.total,items:e.results}},e}(),B=function(){function e(e,t){this.loadFn=e,t&&(this.size=m.isNil(t.size)?t.size:50,this.page=m.isNil(t.page)?t.page:0,this.inclusive=!m.isNil(t.inclusive)||t.inclusive,this.keywordProperty=t.keywordProperty,this.codeProperty=m.isNil(t.codeProperty)?"code":t.codeProperty,this.valueProperty=m.isNil(t.valueProperty)?"value":t.valueProperty)}return e.prototype.resolveContext=function(e){var t={size:this.size,page:this.page,inclusive:this.inclusive,criteria:[]};return this.keywordProperty&&!m.isObject(e)&&(t[this.keywordProperty]=e),t},e.prototype.prepare=function(e){var t=this,n=this.resolveContext(e);return this.loadFn(n).pipe(s.map(function(e){return t.processResponse(e)}))},e.prototype.processResponse=function(e){return{total:e.total,items:e.results}},e}(),_=function(e){function t(t,n,r){void 0===t&&(t={});var o=e.call(this,t,n,r)||this;return o.type="checkbox",o.config.leadingLabel=t.leadingLabel,o}return v(t,e),t}(k),z=function(e){function t(t,n,r){void 0===t&&(t={});var o=e.call(this,t,n,r)||this;return o.type="date",o.minDate=t.minDate||null,o.maxDate=t.maxDate||null,o}return v(t,e),t}(k),H=function(e){function t(t,n,r){void 0===t&&(t={});var o=e.call(this,t,n,r)||this;return o.type="select",o.selectOptions$=t.selectOptions||[],o.showNone=t.showNone||!1,o.noneLabel=t.noneLabel,o.multiple=t.multiple||!1,o}return v(t,e),t.prototype.setValue=function(t,n){null==t?e.prototype.setValue.call(this,"",n):e.prototype.setValue.call(this,t,n)},t}(k),$=h;var G=function(){function e(){}return e.parseTime=function(e){var t,n,r,o;if(!e)return null;var i=["HH:mm","H:mm"];try{for(var a=M(i),s=a.next();!s.done;s=a.next()){var l=s.value;if((p=$(e,l,!0)).isValid())return{hours:p.hours(),minutes:p.minutes(),is24Hour:!0}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}i=["hh:mm a","hh:mma","h:mm a","h:mma","h:m a","h:ma"];try{for(var u=M(i),c=u.next();!c.done;c=u.next()){var p;l=c.value;if((p=$(e,l,!0)).isValid())return{hours:p.hours(),minutes:p.minutes(),is24Hour:!1}}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}return null},e.formatTime=function(e){return e?e.format("hh:mm a"):e?$(e).format("hh:mm a"):void 0},e.applyTime=function(e,t){if(e)(n=e).hours(t.hours),n.minutes(t.minutes);else if(e){var n;(n=$(e)).hours(t.hours),n.minutes(t.minutes)}},e}();var U,W=function(e){function t(t,n,r){void 0===t&&(t={});var o=e.call(this,t,n,r)||this;return o.type="hidden",o}return v(t,e),t}(k);(U=e.NotificationType||(e.NotificationType={})).init="init",U.busy="busy",U.idle="idle",U.paramFunc="paramFunc",U.inputNext="inputNext",U.inputComplete="inputComplete",U.inputError="inputError",U.outputFuncError="outputFuncError",U.outputNext="outputNext",U.outputError="outputError",U.outputComplete="outputComplete",U.close="close",U.enable="enable",U.disable="disable";var X=function(){function t(t,n){var r=this;this.fn=t,this.closed=!1,this.enabled=!0,n?(this.input=n.input||new c.Subject,this.output=n.output||new c.ReplaySubject(1),this.enabled=n.enabled||!0,this.name=n.name||"channel",this.debug=n.debug||!1,this.paramFn=n.paramFn,this.notificationFn=n.notificationFn):(this.input=new c.Subject,this.output=new c.ReplaySubject(1),this.enabled=!0,this.name="channel",this.debug=!1),this.notifications=new c.BehaviorSubject({type:e.NotificationType.init}),this.notificationFn&&this.observeNotifications().subscribe(this.notificationFn),this.input.pipe(s.takeWhile(function(e){return!r.closed}),s.filter(function(e){return r.enabled}),s.map(function(t){if(r.emitNotification({type:e.NotificationType.busy}),r.paramFn){var n=r.paramFn(t);return r.emitNotification({type:e.NotificationType.paramFunc,data:{before:t,after:n}}),n}return t}),s.tap(function(t){r.inputBusy=!0,r.emitNotification({type:e.NotificationType.inputNext,data:t})})).subscribe({next:function(t){try{r.outputBusy=!0,r.fn(t).pipe(s.tap(function(t){r.emitNotification({type:e.NotificationType.outputNext,data:t})})).subscribe({next:function(e){return r.output.next(e)},error:function(t){r.emitNotification({type:e.NotificationType.outputError,error:t}),r.output.error(t)},complete:function(){r.outputBusy=!1,r.emitNotification({type:e.NotificationType.outputComplete}),r.emitNotification({type:e.NotificationType.idle})}})}catch(t){r.emitNotification({type:e.NotificationType.outputFuncError,error:t}),r.outputBusy=!1}},error:function(t){r.emitNotification({type:e.NotificationType.outputFuncError,error:t})},complete:function(){r.inputBusy=!1}})}return t.prototype.isBusy=function(){return this.inputBusy||this.outputBusy},t.prototype.isInputBusy=function(){return this.inputBusy},t.prototype.isOutputBusy=function(){return this.outputBusy},t.prototype.next=function(e){return this.input.next(e),this},t.prototype.emit=function(e){this.output.next(e)},t.prototype.observe=function(e){for(var t=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return setInterval(function(){t.next(e)}),this.output.pipe(l.pipeFromArray(E(n)))},t.prototype.link=function(e){for(var t=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];e.pipe(l.pipeFromArray(E(n))).subscribe(function(e){return t.next(e)})},t.prototype.pipe=function(e){for(var t=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];e.pipe(l.pipeFromArray(E(n))).subscribe(function(e){return t.emit(e)})},t.prototype.asObservable=function(){return this.output.asObservable()},t.prototype.observeNotifications=function(){return this.notifications.asObservable()},t.prototype.emitNotification=function(t){if(t.name=this.name,this.debug)switch(t.type){case e.NotificationType.inputError:case e.NotificationType.outputError:case e.NotificationType.outputFuncError:console.error("["+t.name+":"+t.type+"] ",t.error||"");break;default:console.debug("["+t.name+":"+t.type+"] ",t.data||"")}this.notifications.next(t)},t.prototype.enable=function(){return this.enabled=!1,this},t.prototype.disable=function(){return this.enabled=!0,this},t.prototype.close=function(){this.closed=!0,this.input.unsubscribe(),this.output.unsubscribe()},t}(),K=function(){function e(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.channels=new Map,t.forEach(function(t){e.channels.set(t.key,t.channel)})}return e.prototype.set=function(e,t){return this.channels.set(e,t),t},e.prototype.get=function(e){return this.channels.get(e)},e.prototype.isBusy=function(e){var t=this.channels.get(e);return!!t&&t.isBusy()},e.prototype.isInputBusy=function(e){var t=this.channels.get(e);return!!t&&t.isInputBusy()},e.prototype.isOutputBusy=function(e){var t=this.channels.get(e);return!!t&&t.isOutputBusy()},e.prototype.next=function(e,t){var n=this.channels.get(e);return n?n.next(t):null},e.prototype.emit=function(e,t){var n=this.channels.get(e);return!!n&&n.emit(t)},e.prototype.observe=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.channels.get(e);return o?o.observe.apply(o,E([t],n)):null},e.prototype.link=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.channels.get(e);o&&o.link.apply(o,E([t],n))},e.prototype.pipe=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.channels.get(e);o&&o.pipe.apply(o,E([t],n))},e.prototype.asObservable=function(e){var t=this.channels.get(e);return t?t.asObservable():null},e.prototype.observeNotifications=function(e){var t=this.channels.get(e);return t?t.observeNotifications():null},e.prototype.enable=function(e){var t=this.channels.get(e);return t?t.enable():null},e.prototype.disable=function(e){var t=this.channels.get(e);return t?t.disable():null},e.prototype.close=function(e){var t=this.channels.get(e);return t?t.close():null},e}(),J=function(){function e(e,t,n,r,o){void 0===o&&(o=!0),this.ds=e,this.key=t,this.obs=n,this.ops=r,this.enabled=o,this.connect()}return e.prototype.isConnected=function(){return!!this.sub},e.prototype.connect=function(){var e=this;this.isConnected()||(this.sub=this.obs.pipe(l.pipeFromArray(E(this.ops))).subscribe(function(t){console.log("----\x3e pipe ("+e.key+")",t),e.ds.next(e.key,t)}))},e.prototype.disconnect=function(){this.isConnected()&&this.sub.unsubscribe()},e.prototype.setOperators=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.disconnect(),this.ops=e,this.connect()},e.prototype.enable=function(){this.enabled=!0},e.prototype.disable=function(){this.enabled=!1},e}(),Q=function(){function e(e){this.connected=!1,this.fnMap=new Map,this.subjectMap=new Map,this.input$=new c.Subject,this.inputSub=null,this.events$=new c.Subject,this.pipes=[],e?(e.autoconnect&&this.connect(),e.key&&e.obs&&this.addObservable(e.key,e.obs)):this.connect()}return e.prototype.isConnected=function(){return!!this.inputSub},e.prototype.connect=function(){var e=this;this.isConnected()||(this.inputSub=this.input$.pipe(s.filter(function(t){return!!e.fnMap.has(t.id)||(console.error("[obs] observable with id '"+t.id+"' not found"),!1)}),s.map(function(t){return{event:t,fn:e.fnMap.get(t.id)(t.value),sub:e.subjectMap.get(t.id)}})).subscribe(function(t){return e.relay(t.event,t.fn,t.sub)}),this.connected=!0)},e.prototype.relay=function(e,t,n){var r=this;t.pipe(s.takeWhile(function(){return r.connected}),s.tap(function(t){return r.emit({input:e,output:t})})).subscribe()},e.prototype.emit=function(e){this.events$.next(e)},e.prototype.asObservable=function(){return this.events$.asObservable()},e.prototype.disconnect=function(){if(this.isConnected()){this.inputSub.unsubscribe();var e=g.of([1,2,3]).subscribe();e.add(e);var t=new c.Subject;e.add(t.asObservable().subscribe())}},e.prototype.next=function(e,t,n){if(this.connected){var r={id:e,options:n,value:t};this.input$.next(r)}},e.prototype.addPipe=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=new J(this,t,e,n);return this.pipes.push(o),o},e.prototype.clearPipes=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];e.forEach(function(t,n){t.disconnect(),e=e.splice(n,1)})},e.prototype.clearAllPipes=function(){this.clearPipes.apply(this,E(this.pipes))},e.prototype.getPipes=function(){return this.pipes},e.prototype.addObservable=function(e,t,n){n||(n={behave:!0}),this.fnMap.set(e,t instanceof c.Observable?function(){return t}:t),this.subjectMap.set(e,n.behave?new c.BehaviorSubject([]):new c.Subject)},e.prototype.observe=function(e,t,n){var r=this.subjectMap.get(e);try{return r.asObservable()}finally{t&&this.next(e,t)}},e.prototype.destroy=function(){},e}();e.AmDynFormModule=P,e.ArrayAutoCompleteLoader=R,e.BusinessLogicValidator=function(){return function(e){return e.parent,null}},e.Channel=X,e.ChannelSwitch=K,e.DSPipe=J,e.DynAutoCompleteControl=D,e.DynAutoSelectControl=T,e.DynCheckboxControl=_,e.DynDateControl=z,e.DynFieldComponent=N,e.DynFieldSetComponent=I,e.DynFormArray=O,e.DynFormControl=k,e.DynFormGroup=F,e.DynFormService=V,e.DynHiddenControl=W,e.DynMatchValidator=function(e){var t,n;return function(r){if(!r.parent)return null;if(!t){if(t=r,!(n=r.parent.get(e)))throw new Error("matchOtherValidator(): other control is not found in parent group");n.valueChanges.subscribe(function(){t.updateValueAndValidity()})}return n&&n.value!==t.value?{match:!0}:null}},e.DynSelectControl=H,e.DynTextControl=j,e.DynTextareaControl=A,e.DynToolbarPanelComponent=S,e.KeywordAutoCompleteCriteriaLoader=B,e.ObservableAutoCompleteLoader=L,e.ObservableDS=Q,e.TimeUtils=G,e.TimeValidator=function(){return function(e){var t=e.value;return t?null!=G.parseTime(t)?null:{time:!0}:null}},e.ɵa=q,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=bi8-am-dyn-form.umd.min.js.map