@firestitch/form 9.6.4 → 9.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/components/form-dialog-actions/form-dialog-actions.component.d.ts +5 -3
- package/bundles/firestitch-form.umd.js +17 -9
- package/bundles/firestitch-form.umd.js.map +1 -1
- package/bundles/firestitch-form.umd.min.js +1 -1
- package/bundles/firestitch-form.umd.min.js.map +1 -1
- package/esm2015/app/components/form-dialog-actions/form-dialog-actions.component.js +18 -5
- package/esm2015/app/directives/form/form.directive.js +3 -2
- package/esm5/app/components/form-dialog-actions/form-dialog-actions.component.js +19 -10
- package/esm5/app/directives/form/form.directive.js +3 -2
- package/fesm2015/firestitch-form.js +16 -4
- package/fesm2015/firestitch-form.js.map +1 -1
- package/fesm5/firestitch-form.js +17 -9
- package/fesm5/firestitch-form.js.map +1 -1
- package/firestitch-form.metadata.json +1 -1
- package/package.json +1 -1
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
|
|
13
13
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
14
14
|
and limitations under the License.
|
|
15
|
-
***************************************************************************** */var h=function(t,e){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function y(t,e){function r(){this.constructor=t}h(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var v,b=function(){return(b=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function _(t,e,r,n){var i,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,r,s):i(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s}function S(t,e){return function(r,n){e(r,n,t)}}function F(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function C(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function O(e,r){return new d.Observable((function(n){if(!e.confirm||!e.ngForm.dirty)return n.next(t.ConfirmResult.Pristine),void n.complete();var i="You Have Unsaved Changes",o="What would you like to do with your changes?",s="Save & Continue",a="Discard Changes & Continue",l="Review Changes";"object"==typeof e.confirm&&(i=e.confirm.title||i,o=e.confirm.message||o,s=e.confirm.saveLabel||s,a=e.confirm.discardLabel||a,l=e.confirm.cancelLabel||l),r.confirm({title:i,template:o,dialogConfig:{width:"auto"},buttons:[{label:s,color:"primary",value:"save"},{label:a,value:"discard"},{label:l,cancel:!0}]}).subscribe((function(r){"discard"===r&&(n.next(t.ConfirmResult.Discard),n.complete(),e.reset()),"save"===r&&(e.submitted.pipe(f.first()).subscribe((function(){n.next(t.ConfirmResult.Save),n.complete()})),e.invalid.pipe(f.first()).subscribe((function(){n.next(t.ConfirmResult.Invalid),n.complete()})),e.ngForm.control.markAsPristine(),e.ngForm.ngSubmit.emit())}),(function(e){n.next(t.ConfirmResult.Review),n.complete()}))}))}(v=t.ConfirmResult||(t.ConfirmResult={})).Save="save",v.Discard="discard",v.Review="review",v.Invalid="invalid",v.Pristine="pristine";var M,D=function(){function t(){this.clicked$=new d.Subject,this.registered=!1,this.type="button"}return t.prototype.click=function(){this.clicked$.next()},t.prototype.ngOnDestroy=function(){this.clicked$.complete()},_([e.HostBinding("attr.type"),F("design:type",Object)],t.prototype,"type",void 0),_([e.HostListener("click",["$event.target"]),F("design:type",Function),F("design:paramtypes",[]),F("design:returntype",void 0)],t.prototype,"click",null),t=_([e.Directive({selector:"[fsFormDialogClose],[fs-form-dialog-close]"})],t)}(),j=function(){function t(t,e){this._matButton=t,this._elementRef=e,this.dirtySubmit=!0,this.transitionStyle=null,this.active=!1,this._destroy$=new d.Subject}return t.prototype.ngOnInit=function(){var t=this;d.fromEvent(this.element,"click").pipe(f.takeUntil(this._destroy$)).subscribe((function(){t.active=!0}))},t.prototype.setFormRef=function(t){var e=this;t&&(this.transitionStyle="none"),t&&this.dirtySubmit&&(t.dirtySubmitButton&&this.disable(),setTimeout((function(){e.transitionStyle=null}),500))},t.prototype.disable=function(){this._matButton&&(this._matButton.disabled=!0)},t.prototype.enable=function(){this._matButton&&(this._matButton.disabled=!1,this._matButton.disableRipple=!0)},t.prototype.process=function(){this.setClass("process"),this._matButton.disableRipple=!0},t.prototype.success=function(){this.setClass("success"),this._matButton.disableRipple=!1},t.prototype.error=function(){this.setClass("error"),this._matButton.disableRipple=!1},t.prototype.setClass=function(t){var e=this._getSvg(t);this._resetClass(),this._disableShadowAnimation(),this.element.classList.add("submit-"+t),this.element.append(e)},Object.defineProperty(t.prototype,"element",{get:function(){return this._elementRef.nativeElement},enumerable:!0,configurable:!0}),t.prototype.reset=function(){this.active=!1,this.enable(),this.element.querySelectorAll(".svg-icon").forEach((function(t){t.remove()})),this._matButton.disableRipple=!1,this._resetClass()},t.prototype.ngOnDestroy=function(){this._destroy$.next(),this._destroy$.complete()},t.prototype._disableShadowAnimation=function(){},t.prototype._resetClass=function(){this.element.classList.remove("submit-success","submit-error","submit-process","mat-elevation-z2")},t.prototype._getSvg=function(t){return"success"===t?(new DOMParser).parseFromString('<svg class="svg-icon svg-icon-success" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 38 38" style="enable-background:new 0 0 38 38;" xml:space="preserve" width="38px" height="38px">\n <g>\n <g class="check">\n <g>\n <path d="M29.6,11.9c-0.5-0.5-1.3-0.5-1.8,0L16.3,23.4l-6.1-6.1c-0.5-0.5-1.3-0.5-1.8,0s-0.5,1.3,0,1.8l7,7c0.3,0.3,0.6,0.4,0.9,0.4s0.7-0.1,0.9-0.4l12.4-12.4C30.1,13.2,30.1,12.4,29.6,11.9z"/>\n </g>\n </g>\n </g>\n </svg>',"text/xml").firstChild:"process"===t?(new DOMParser).parseFromString('<svg class="svg-icon svg-icon-process" width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2"><circle stroke-opacity=".5" cx="18" cy="18" r="18"/>\n <path d="M36 18c0-9.94-8.06-18-18-18"><animateTransform attributeName="transform" type="rotate" from="0 18 18" to="360 18 18" dur=".7s" repeatCount="indefinite"/></path>\n </g>\n </g>\n </svg>',"text/xml").firstChild:"error"===t?(new DOMParser).parseFromString('<svg class="svg-icon svg-icon-error" xmlns="http://www.w3.org/2000/svg" width="38px" height="38px" viewBox="0 0 16 16"><g><path d="M8 1c3.9 0 7 3.1 7 7s-3.1 7-7 7-7-3.1-7-7 3.1-7 7-7zM8 0c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8v0z" data-original="#444444" data-old_color="#444444"/><path d="M12.2 10.8l-2.8-2.8 2.8-2.8-1.4-1.4-2.8 2.8-2.8-2.8-1.4 1.4 2.8 2.8-2.8 2.8 1.4 1.4 2.8-2.8 2.8 2.8z"/></g> </svg>',"text/xml").firstChild:void 0},t.ctorParameters=function(){return[{type:i.MatButton,decorators:[{type:e.Optional},{type:e.Host}]},{type:e.ElementRef}]},_([e.Input(),F("design:type",Object)],t.prototype,"name",void 0),_([e.Input(),F("design:type",Object)],t.prototype,"dirtySubmit",void 0),_([e.HostBinding("style.transition"),F("design:type",Object)],t.prototype,"transitionStyle",void 0),t=_([e.Directive({selector:'form button[type="submit"],form button:not([type])'}),S(0,e.Optional()),S(0,e.Host()),F("design:paramtypes",[i.MatButton,e.ElementRef])],t)}(),I=function(){function t(){this._eventBus=new d.Subject}return t.prototype.broadcast=function(t,e){this._eventBus.next({key:t,data:e})},t.prototype.on=function(t){return this._eventBus.asObservable().pipe(f.filter((function(e){return e.key===t})),f.map((function(t){return t.data})))},t.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new t},token:t,providedIn:"root"}),t=_([e.Injectable({providedIn:"root"}),F("design:paramtypes",[])],t)}();function E(e){return e===t.ConfirmResult.Discard||e===t.ConfirmResult.Save||e===t.ConfirmResult.Pristine}(M=t.FormStatus||(t.FormStatus={})).Valid="valid",M.Invalid="invalid",M.Submitting="submitting",M.Submitted="submitted",M.Error="error",M.Success="success",M.Completing="completing";var w=function(){function r(r,n,i,o,s,a,l,u,p){this.ngForm=r,this._form=n,this._element=i,this._message=o,this._prompt=s,this._cdRef=a,this._ngZone=l,this._dialogRef=u,this._drawerRef=p,this.wrapperSelector=".fs-form-wrapper,.mat-form-field",this.messageSelector=".fs-form-message,.mat-form-field-subscript-wrapper",this.hintSelector=".fs-form-hint,.mat-form-field-hint-wrapper",this.labelSelector=".fs-form-label,.mat-form-field-label",this.autocomplete=!1,this.shortcuts=!0,this.confirm=!0,this.confirmDialog=!0,this.confirmDrawer=!0,this.confirmBrowser=!0,this.confirmTabs=!0,this.dirtySubmitButton=!0,this.successDelay=0,this.errorDelay=1e3,this.submitEvent=new e.EventEmitter,this.invalid=new e.EventEmitter,this.valid=new e.EventEmitter,this.submitted=new e.EventEmitter,this.fsformClass=!0,this._tabGroups=new e.QueryList,this._dialogBackdropEscape=!1,this._snapshot={},this._status$=new d.BehaviorSubject(t.FormStatus.Valid),this._destroy$=new d.Subject}return Object.defineProperty(r.prototype,"submitting",{get:function(){return this._status$.getValue()===t.FormStatus.Submitting},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"completing",{get:function(){return this._status$.getValue()===t.FormStatus.Completing},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"_submitEvent",{get:function(){return{ngForm:this.ngForm,submitter:this._submitter}},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"_formValidState$",{get:function(){this._form.broadcast("valid",this._submitEvent),this.submitEvent.emit(this._submitEvent),this.valid.emit(this._submitEvent);var t={ngForm:this.ngForm,submitter:this._submitter,response:null};if(!this.submit)return d.of(t);var e=this.submit(this._submitEvent);return d.isObservable(e)?e.pipe(f.map((function(e){return t.response=e,t}))):d.of(t)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"_formInvalidState$",{get:function(){this._form.broadcast("invalid",this._submitEvent),this.invalid&&this.invalid.emit(this._submitEvent);this._message.error("Changes not saved. Please review errors highlighted in red.",{mode:l.MessageMode.Toast});var t=this._element.nativeElement.querySelector(".ng-invalid");return t&&t.scrollIntoView({behavior:"smooth",block:"center"}),d.throwError("Form validation error")},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"_submitter",{get:function(){return this._activeSubmitButton?this._activeSubmitButton.name:null},enumerable:!0,configurable:!0}),r.prototype.ngOnInit=function(){this._registerConfirmDialogBackdropEscape(),this._listenHotKeys(),this._listenWindowClose(),this._listenSubmit(),this.autocomplete||this._registerAutocomplete()},r.prototype.ngOnChanges=function(t){t.confirm&&this._updateDirtySubmitButtons()},r.prototype.ngAfterContentInit=function(){this._registerConfirm(),this._registerConfirmDialogClose(),this._registerConfirmDrawerClose(),this._registerConfirmTabs(),this._registerDrawerClose(),this._registerDirtySubmitButton()},r.prototype.ngOnDestroy=function(){this._destroy$.next(),this._destroy$.complete()},r.prototype.createSnapshot=function(){this._snapshot=this.ngForm.value},r.prototype.reset=function(){var t=this;this.ngForm.resetForm(),Object.keys(this.ngForm.controls).forEach((function(e){t.ngForm.controls[e].reset(t._snapshot[e])}))},r.prototype.clear=function(){this.ngForm.resetForm()},r.prototype.dirty=function(){this.ngForm.form.markAsDirty(),this._updateDirtySubmitButtons()},r.prototype.triggerSubmit=function(){this.ngForm.ngSubmit.next()},r.prototype.triggerConfirm=function(){var t=this;return(this.submitting?this.submitted.asObservable():d.of({})).pipe(f.take(1),f.mergeMap((function(){return O(t,t._prompt)})))},r.prototype.enable=function(){this.ngForm.control.enable(),this._updateDirtySubmitButtons()},r.prototype.disable=function(){this.ngForm.control.disable(),this.submitButtons.forEach((function(t){t.disable()}))},r.prototype._listenSubmit=function(){var e=this;this.ngForm.ngSubmit.pipe(f.tap((function(t){null==t||t.preventDefault()})),f.filter((function(){return[t.FormStatus.Valid,t.FormStatus.Invalid].includes(e._status$.getValue())})),f.tap((function(){return e._markControlsAsTouchedAndUpdateValidity()})),f.tap((function(){return e._broadcastSubmittingEvents()})),f.switchMap((function(){return e._waitUntilStatusPending()})),f.tap((function(){return e._setupActiveSubmitButton()})),f.mergeMap((function(){return"INVALID"===e.ngForm.status?e._formInvalidState$:e._formValidState$})),f.catchError((function(t,r){return e._handleError(t),r})),f.tap((function(t){e._completeSubmit(!0,t)})),f.takeUntil(this._destroy$)).subscribe((function(){}))},r.prototype._listenWindowClose=function(){var t=this;d.fromEvent(window,"beforeunload").pipe(f.takeUntil(this._destroy$)).subscribe((function(e){t.confirm&&t.confirmBrowser&&t.ngForm.dirty&&(e.returnValue=!1)}))},r.prototype._listenHotKeys=function(){var t=this;this._ngZone.runOutsideAngular((function(){d.fromEvent(document,"keydown").pipe(f.takeUntil(t._destroy$)).subscribe((function(e){if(t._dialogBackdropEscape&&"Escape"===e.code){var r=document.getElementById(t._dialogRef.id),n=e.composedPath();n&&n.forEach((function(e){r===e&&t._ngZone.run((function(){t._formClose()}))}))}(e.ctrlKey||e.metaKey)&&"KeyS"===e.code&&(e.preventDefault(),t.shortcuts&&t._elementInForm(document.activeElement)&&t.ngForm.ngSubmit.next())}))}))},r.prototype._formClose=function(){var e=this;this.confirm&&this.confirmDialog?this.triggerConfirm().pipe(f.filter((function(t){return E(t)})),f.switchMap((function(r){return r===t.ConfirmResult.Pristine||r===t.ConfirmResult.Discard?d.of(null):e.submitted.asObservable()})),f.takeUntil(this._destroy$)).subscribe((function(t){e._dialogRef.close(null==t?void 0:t.response)})):this._dialogRef.close(null)},r.prototype._registerDialogClose=function(t){var e=this;t.registered||(t.registered=!0,t.clicked$.pipe(f.takeUntil(this._destroy$)).subscribe((function(){e._formClose()})))},r.prototype._getActiveButton=function(){var t=this.submitButtons.find((function(t){return t.active}));return t||this.submitButtons.first},r.prototype._elementInForm=function(t){return!!t.isSameNode(this._element.nativeElement)||!!t.parentElement&&this._elementInForm(t.parentElement)},r.prototype._completeSubmit=function(e,r){var n=this;e?(this.ngForm.control.markAsPristine(),this.createSnapshot(),this.submitted.emit(r)):this._resetButtons(),this._activeSubmitButton&&(e?this._activeSubmitButton.success():this._activeSubmitButton.error()),this._status$.next(t.FormStatus.Submitted),e?this._status$.next(t.FormStatus.Success):this._status$.next(t.FormStatus.Error),this._status$.next(t.FormStatus.Completing);var i=e?this.successDelay:this.errorDelay;d.of(!0).pipe(f.delay(i),f.first(),f.takeUntil(this._destroy$)).subscribe((function(){"VALID"===n.ngForm.form.status?n._status$.next(t.FormStatus.Valid):n._status$.next(t.FormStatus.Invalid),n._resetButtons(),n._updateDirtySubmitButtons()}))},r.prototype._resetButtons=function(){this.submitButtons.forEach((function(t){t.reset()}))},r.prototype._registerConfirm=function(){var t=this;this.ngForm.form.valueChanges.pipe(f.takeUntil(this._destroy$)).subscribe((function(e){if(t.confirm){var r=Object.keys(t._snapshot);Object.keys(e).forEach((function(n){-1===r.indexOf(n)&&(t._snapshot[n]=e[n])}))}}))},r.prototype._registerDrawerClose=function(){var e=this;this._drawerRef&&this._drawerRef.closeStart$.pipe(f.takeUntil(this._destroy$)).subscribe((function(r){e.submitting?e._status$.pipe(f.filter((function(e){return e===t.FormStatus.Success||e===t.FormStatus.Error})),f.takeUntil(e._destroy$)).subscribe((function(e){e===t.FormStatus.Success?(r.next(),r.complete()):r.error()})):(r.next(),r.complete())}))},r.prototype._registerConfirmDrawerClose=function(){var t=this;this._drawerRef&&this._drawerRef.closeStart$.pipe(f.switchMap((function(e){return d.iif((function(){return t.confirm&&t.confirmDrawer}),t.triggerConfirm().pipe(f.map((function(t){return E(t)})),f.tap((function(t){t?(e.next(),e.complete()):e.error()}))),d.defer((function(){e.next(),e.complete()})))})),f.takeUntil(this._destroy$)).subscribe()},r.prototype._registerConfirmTabs=function(){var t=this;this.tabGroup&&this.registerConfirmTabGroup(this.tabGroup),this.registerConfirmTabGroups(this._tabGroups.toArray()),this._tabGroups.changes.pipe(f.takeUntil(this._destroy$)).subscribe((function(){t.registerConfirmTabGroups(t._tabGroups.toArray())}))},r.prototype.registerConfirmTabGroups=function(t){var e=this;t.forEach((function(t){e.registerConfirmTabGroup(t)}))},r.prototype.registerConfirmTabGroup=function(t){var e=this,r=t;r._originalHandleClick||(r._originalHandleClick=t._handleClick,r._handlClick$=new d.Subject,r._handleClick=function(t,e,n){r._handlClick$.observers.length?r._handlClick$.next({tab:t,tabHeader:e,idx:n}):r._originalHandleClick(t,e,n)}),r._handlClick$.pipe(f.takeUntil(this._destroy$)).subscribe((function(t){e.submitting||(e.confirm&&e.confirmTabs?e.triggerConfirm().pipe(f.takeUntil(e._destroy$)).subscribe((function(e){E(e)&&(r.selectedIndex=t.idx)})):r._originalHandleClick(t.tab,t.tabHeader,t.idx))}))},r.prototype._registerConfirmDialogClose=function(){var t=this;this._dialogRef&&(this.formDialogClose.forEach((function(e){t._registerDialogClose(e)})),this.formDialogClose.changes.pipe(f.takeUntil(this._destroy$)).subscribe((function(e){e.forEach((function(e){t._registerDialogClose(e)}))})))},r.prototype._registerConfirmDialogBackdropEscape=function(){var t=this;this._dialogBackdropEscape=this._dialogRef&&!0!==this._dialogRef.disableClose,this._dialogRef&&!this._dialogRef.disableClose&&(this._dialogRef.disableClose=!0,this._dialogRef.backdropClick().pipe(f.takeUntil(this._destroy$)).subscribe((function(){t._formClose()})),this._destroy$.subscribe((function(){t._dialogRef.disableClose=!1})))},r.prototype._registerAutocomplete=function(){var t=this;this._registerControl=this.ngForm.form.registerControl.bind(this.ngForm.form),this.ngForm.form.registerControl=function(e,r){var n=t._element.nativeElement.querySelector("input[name='"+e+"']");return n&&(n.setAttribute("name",e+"_"+p.guid()),n.getAttribute("autocomplete")||n.setAttribute("autocomplete","none")),t._registerControl(e,r)}},r.prototype._registerDirtySubmitButton=function(){var t=this;this.ngForm&&(this.ngForm.form.valueChanges.pipe(f.takeUntil(this._destroy$)).subscribe((function(){t._updateDirtySubmitButtons()})),this.submitButtons.changes.pipe(f.takeUntil(this._destroy$)).subscribe((function(){t._updateDirtySubmitButtons()})))},r.prototype._updateDirtySubmitButtons=function(){var t=this;this.submitButtons&&(this.submitButtons.forEach((function(e){e.setFormRef(t),t.confirm&&t.dirtySubmitButton&&!t.ngForm.dirty&&e.dirtySubmit?e.disable():e.enable()})),this._cdRef.markForCheck())},r.prototype._broadcastSubmittingEvents=function(){this._status$.next(t.FormStatus.Submitting),this._form.broadcast("submit",this.ngForm)},r.prototype._markControlsAsTouchedAndUpdateValidity=function(){Object.values(this.ngForm.controls).forEach((function(t){t.markAsDirty(),t.markAsTouched(),t.updateValueAndValidity()}))},r.prototype._setupActiveSubmitButton=function(){this._activeSubmitButton=this._getActiveButton(),this._resetButtons(),this._activeSubmitButton&&this._activeSubmitButton.process()},r.prototype._waitUntilStatusPending=function(){return this.ngForm.statusChanges.pipe(f.startWith(this.ngForm.status),f.first((function(t){return"PENDING"!==t})))},r.prototype._handleError=function(t){if(console.log("%c Form Submit ","color: white; background-color: #D33F49","Error occured"),console.group("Error Details:"),console.log("Message: ",t),console.log("FormRef: ",this),this.ngForm.invalid){var e=function t(e,r){var i,o=null;return e.invalid&&e.errors&&((i={})[r]=b({},e.errors),o=i),e instanceof n.FormGroup&&Object.entries(e.controls).forEach((function(e){var r=C(e,2),n=r[0],i=t(r[1],n);i&&(o?Object.assign(o,i):o=b({},i))})),o}(this.ngForm.control,null);console.log("Validation Errors: ",e)}console.groupEnd(),this._completeSubmit(!1,null)},r.ctorParameters=function(){return[{type:n.NgForm,decorators:[{type:e.Inject,args:[n.NgForm]}]},{type:I},{type:e.ElementRef},{type:l.FsMessage},{type:u.FsPrompt},{type:e.ChangeDetectorRef},{type:e.NgZone},{type:o.MatDialogRef,decorators:[{type:e.Optional},{type:e.Inject,args:[o.MatDialogRef]}]},{type:c.DrawerRef,decorators:[{type:e.Optional},{type:e.Inject,args:[c.DrawerRef]}]}]},_([e.Input(),F("design:type",Object)],r.prototype,"wrapperSelector",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"messageSelector",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"hintSelector",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"labelSelector",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"autocomplete",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"shortcuts",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"confirm",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"confirmDialog",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"confirmDrawer",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"confirmBrowser",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"confirmTabs",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"dirtySubmitButton",void 0),_([e.Input(),F("design:type",Function)],r.prototype,"submit",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"successDelay",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"errorDelay",void 0),_([e.Input(),F("design:type",a.MatTabGroup)],r.prototype,"tabGroup",void 0),_([e.Output("fsForm"),F("design:type",e.EventEmitter)],r.prototype,"submitEvent",void 0),_([e.Output(),F("design:type",e.EventEmitter)],r.prototype,"invalid",void 0),_([e.Output(),F("design:type",e.EventEmitter)],r.prototype,"valid",void 0),_([e.Output(),F("design:type",e.EventEmitter)],r.prototype,"submitted",void 0),_([e.HostBinding("class.fs-form"),F("design:type",Object)],r.prototype,"fsformClass",void 0),_([e.ContentChildren(D,{descendants:!0}),F("design:type",e.QueryList)],r.prototype,"formDialogClose",void 0),_([e.ContentChildren(a.MatTabGroup,{descendants:!0}),F("design:type",e.QueryList)],r.prototype,"_tabGroups",void 0),_([e.ContentChildren(j,{descendants:!0}),F("design:type",e.QueryList)],r.prototype,"submitButtons",void 0),r=_([e.Directive({selector:"[fsForm]"}),S(0,e.Inject(n.NgForm)),S(7,e.Optional()),S(7,e.Inject(o.MatDialogRef)),S(8,e.Optional()),S(8,e.Inject(c.DrawerRef)),F("design:paramtypes",[n.NgForm,I,e.ElementRef,l.FsMessage,u.FsPrompt,e.ChangeDetectorRef,e.NgZone,o.MatDialogRef,c.DrawerRef])],r)}(),R={required:"This field is required",email:"This is not a valid email address",emails:"Input valid email addresses, comma separated",phone:"Invalid phone number",numeric:"Value should be numeric",integer:"Value should be an integer",min:"Value should not be less than $(1)",max:"Value should not be greater than $(1)",minlength:"Should not be shorter than $(1) characters",maxlength:"Should not be longer than $(1) characters",compare:"Inputs do not match",pattern:"Value should match pattern $(1)",dateRange:"Invalid date range",url:"This is not a valid url",urlProtocol:"Invalid URL. Proper http protocol is required. eg. https://google.com",greater:"Value must be greater than $(1)",lesser:"Value must be less than $(1)"},V=new e.InjectionToken("fs.form.validate-messages"),x={provide:V,useFactory:k};function k(){return b({},R)}var P=function(){function t(t,e,r,n,i,o){this.elementRef=t,this.renderer2=e,this.injector=r,this._validateMessages=n,this.ngControl=i,this.formDirective=o,this.appendMessageClass="fs-form-message",this.appendLabelClass="fs-form-label",this.appendErrorClass="fs-form-error",this.appendHintClass="fs-form-hint",this.errors=[],this._destroy$=new d.Subject,i?this._control=i.control:console.error("The element does not have a valid ngModel",this.elementRef.nativeElement)}return Object.defineProperty(t.prototype,"validateMessages",{set:function(t){this._validateMessages=b(b({},this._validateMessages),t)},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){this._setupValidators()},t.prototype.ngOnDestroy=function(){this._destroy$.next(),this._destroy$.complete()},t.prototype.ngAfterContentInit=function(){this._control&&(this._control.statusChangesSubscribe||(this._control.statusChanges.pipe(f.takeUntil(this._destroy$)).subscribe(this.render.bind(this)),this._control.statusChangesSubscribe=!0))},t.prototype.getMessageSelector=function(){return!1===this.messageSelector?"":this.messageSelector?this.messageSelector:this.formDirective&&this.formDirective.messageSelector?this.formDirective.messageSelector:void 0},t.prototype.getHintWrapperSelector=function(){return!1===this.hintSelector?"":this.hintSelector?this.hintSelector:this.formDirective&&this.formDirective.hintSelector?this.formDirective.hintSelector:void 0},t.prototype.getWrapperSelector=function(){return!1===this.wrapperSelector?"":this.wrapperSelector?this.wrapperSelector:this.formDirective&&this.formDirective.wrapperSelector?this.formDirective.wrapperSelector:void 0},t.prototype.getlabelSelector=function(){return!1===this.labelSelector?"":this.labelSelector?this.labelSelector:this.formDirective&&this.formDirective.labelSelector?this.formDirective.labelSelector:void 0},t.prototype.getWrapperElement=function(){var t=this.getWrapper(this.elementRef.nativeElement);return t||this.elementRef.nativeElement},t.prototype.render=function(){var t;if(this.ngControl){var e=this.renderer2,r=this.getWrapperElement(),n=this.ngControl.dirty?this.getError(this.ngControl):null;if(!this.getMessageSelector())return;var i=r.querySelector(this.getMessageSelector());if(!i)return console.warn("Failed to locate "+this.getMessageSelector(),this.elementRef.nativeElement);if(this.getlabelSelector()){var o=r.querySelector(this.getlabelSelector());o&&this.appendLabelClass&&this.renderer2.addClass(o,this.appendLabelClass)}if(this.appendMessageClass&&e.addClass(i,this.appendMessageClass),this.getHintWrapperSelector()){var s=i.querySelector(this.getHintWrapperSelector());s&&(e.setStyle(s,"display",n?"none":"block"),this.appendHintClass&&e.addClass(s,this.appendHintClass))}var a=r.querySelector(".fs-form-error-target");if(a&&a.remove(),r.classList.remove("ng-invalid"),!(this.ngControl.invalid&&(this.ngControl.dirty||(null===(t=this.formDirective.ngForm)||void 0===t?void 0:t.submitted)))||!n)return;r.classList.add("ng-invalid"),a=e.createElement("div"),e.addClass(a,"fs-form-error-target"),e.addClass(a,this.appendErrorClass),e.addClass(a,this.appendErrorClass+"-"+n.name);var l=e.createText(n.message);e.appendChild(a,l),i.appendChild(a)}},t.prototype.getWrapper=function(t,e){return void 0===e&&(e=0),!t||e>10?null:t.parentNode&&t.parentNode.querySelector(this.getWrapperSelector())?t:this.getWrapper(t.parentNode,++e)},t.prototype.parseErrorMessage=function(t,e){return m.values(e).forEach((function(e){t=t.replace(/\$\(\d\)/,e)})),t},t.prototype.getError=function(t){var e=m.keys(t.control.errors)[0];if(!e)return null;var r=t.control.errors[e];return this._validateMessages[e]&&(r=this.parseErrorMessage(this._validateMessages[e],r)),{name:e,message:r}},t.prototype._setupValidators=function(){var t=this._control;if(this.validate){var e=t.validator?[t.validator,this.validate.bind(this)]:this.validate.bind(this);t.setValidators(e)}if(this.validateAsync){var r=t.asyncValidator?[t.asyncValidator,this.validateAsync.bind(this)]:this.validateAsync.bind(this);t.setAsyncValidators(r)}t.updateValueAndValidity()},t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2},{type:e.Injector},{type:void 0,decorators:[{type:e.Self},{type:e.Inject,args:[V]}]},{type:n.NgControl,decorators:[{type:e.Optional}]},{type:w,decorators:[{type:e.Optional},{type:e.Inject,args:[w]}]}]},_([e.Input(),F("design:type",Object)],t.prototype,"wrapperSelector",void 0),_([e.Input(),F("design:type",Object)],t.prototype,"messageSelector",void 0),_([e.Input(),F("design:type",Object)],t.prototype,"hintSelector",void 0),_([e.Input(),F("design:type",Object)],t.prototype,"labelSelector",void 0),_([e.Input(),F("design:type",Object)],t.prototype,"appendMessageClass",void 0),_([e.Input(),F("design:type",Object)],t.prototype,"appendLabelClass",void 0),_([e.Input(),F("design:type",Object)],t.prototype,"appendErrorClass",void 0),_([e.Input(),F("design:type",Object)],t.prototype,"appendHintClass",void 0),_([e.Input(),F("design:type",Object),F("design:paramtypes",[Object])],t.prototype,"validateMessages",null),t=_([e.Directive({selector:"[fsFormControl]",providers:[x]}),S(3,e.Self()),S(3,e.Inject(V)),S(4,e.Optional()),S(5,e.Optional()),S(5,e.Inject(w)),F("design:paramtypes",[e.ElementRef,e.Renderer2,e.Injector,Object,n.NgControl,w])],t)}();function B(t){return"false"!==t&&(t||""===t)}var $=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.required=!1,e}return y(r,t),Object.defineProperty(r.prototype,"setFsFormRequired",{set:function(t){this.required=B(t)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"setRequired",{set:function(t){this.required=B(t)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.required=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return this.required?n.Validators.required(this._control):null},r.prototype.render=function(){var e=this.getWrapperElement();if(e&&this.getlabelSelector()){var r=e.querySelector(this.getlabelSelector());r&&(this.required?this.renderer2.addClass(r,"fs-form-label-required"):this.renderer2.removeClass(r,"fs-form-label-required"))}t.prototype.render.call(this)},_([e.Input("fsFormRequired"),F("design:type",Object),F("design:paramtypes",[Object])],r.prototype,"setFsFormRequired",null),_([e.Input("required"),F("design:type",Object),F("design:paramtypes",[Object])],r.prototype,"setRequired",null),_([e.Input("fsFormRequiredMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormRequired],[ngModel][required]",providers:[x]})],r)}(P),A=function(){function t(){}return t.email=function(t){return!t.value||p.email(t.value)?null:{email:!0}},t.emails=function(t){return(t.value||"").split(",").some((function(t){return!p.email(t)}))?{email:!0}:null},t.numeric=function(t){return p.isEmpty(t.value)||p.isNumeric(t.value)?null:{numeric:!0}},t.integer=function(t){return t.value&&""!==String(t.value)&&t.value%1!=0?{integer:!0}:null},t.phone=function(t){return!t.value||p.phone(t.value)?null:{phone:!0}},t.url=function(t,e){if(void 0===e&&(e=!1),!t.value)return null;if(!p.url(t.value))return{url:!0};if(e){var r=new RegExp(/^http(s)?:\/\//gm);if(!String(t.value).match(r))return{urlProtocol:!0}}return null},t.dateRange=function(t){if(!t.value)return null;if(m.isObject(t.value)){var e=t.value.start,r=t.value.end;if(!e&&!r||g.isValid(e)&&g.isValid(r))return null}return{dateRange:!0}},t.func=function(t,e,r){var n,i;try{n=e(t,r)}catch(t){t=t instanceof Error?t.message:t,i=d.throwError(t)}return i||(i=n instanceof Promise?d.from(n):d.isObservable(n)?n:d.of(null)),i.pipe(f.map((function(){return null})),f.catchError((function(t){return d.of({validationError:t})})),f.take(1))},t}(),q=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.min=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return A.numeric(this._control)||n.Validators.min(parseFloat(this.fsFormMin))(this._control)},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormMin",void 0),_([e.Input("fsFormMinMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormMin]",providers:[x]})],r)}(P),L=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.max=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return A.numeric(this._control)||n.Validators.max(this.fsFormMax)(this._control)},_([e.Input(),F("design:type",Number)],r.prototype,"fsFormMax",void 0),_([e.Input("fsFormMaxMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormMax]",providers:[x]})],r)}(P),N=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.minlength=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return n.Validators.minLength(this.fsFormMinLength)(this._control)},_([e.Input(),F("design:type",Number)],r.prototype,"fsFormMinLength",void 0),_([e.Input("fsFormMinLengthMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormMinLength]",providers:[x]})],r)}(P),U=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.maxlength=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return n.Validators.maxLength(this.fsFormMaxLength)(this._control)},_([e.Input(),F("design:type",Number)],r.prototype,"fsFormMaxLength",void 0),_([e.Input("fsFormMaxLengthMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormMaxLength]",providers:[x]})],r)}(P),T=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.email=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return B(this.fsFormEmail)?A.email(this._control):null},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormEmail",void 0),_([e.Input("fsFormEmailMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormEmail]",providers:[x]})],r)}(P),G=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.emails=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return B(this.fsFormEmails)?A.emails(this._control):null},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormEmails",void 0),_([e.Input("fsFormEmailsMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormEmails]",providers:[x]})],r)}(P),H=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.phone=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return B(this.fsFormPhone)?A.phone(this._control):null},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormPhone",void 0),_([e.Input("fsFormPhoneMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormPhone]",providers:[x]})],r)}(P),W=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.compare=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return this.fsFormCompare.value===this.elementRef.nativeElement.value?null:{compare:!0}},r.prototype.ngAfterViewInit=function(){var t=this;this.fsFormCompare.addEventListener("keyup",(function(){t._control.updateValueAndValidity()}),!1)},r.prototype.ngOnDestroy=function(){var t=this;this.fsFormCompare.removeEventListener("keyup",(function(){t._control.updateValueAndValidity()}),!1)},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormCompare",void 0),_([e.Input("fsFormCompareMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormCompare]",providers:[x]})],r)}(P),z=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.integer=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return B(this.fsFormInteger)?A.integer(this._control):null},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormInteger",void 0),_([e.Input("fsFormIntegerMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormInteger]",providers:[x]})],r)}(P),K=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.numeric=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return B(this.fsFormNumeric)?A.numeric(this._control):null},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormNumeric",void 0),_([e.Input("fsFormNumericMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormNumeric]",providers:[x]})],r)}(P),Z=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.pattern=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return n.Validators.pattern(this.fsFormPattern)(this._control)},_([e.Input(),F("design:type",RegExp)],r.prototype,"fsFormPattern",void 0),_([e.Input("fsFormPatternMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormPattern]",providers:[x]})],r)}(P),Q=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validateAsync=function(t){return A.func(this._control,this.fsFormFunction,this.fsFormFunctionData)},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormFunction",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"fsFormFunctionData",void 0),r=_([e.Directive({selector:"[fsFormFunction]",providers:[x]})],r)}(P),Y=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.greater=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){var e=parseFloat(this.fsFormGreater),r=parseFloat(this._control.value);return!isNaN(e)&&!isNaN(r)&&r<=e?{greater:{greater:e,actual:r}}:A.numeric(this._control)},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormGreater",void 0),_([e.Input("fsFormGreaterMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormGreater]",providers:[x]})],r)}(P),J=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.dateRange=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return B(this.fsFormDateRange)?A.dateRange(this._control):null},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormDateRange",void 0),_([e.Input("fsFormDateRangeMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormDateRange]",providers:[x]})],r)}(P),X=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.lesser=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){var e=parseFloat(this.fsFormLesser),r=parseFloat(this._control.value);return!isNaN(e)&&!isNaN(r)&&r>=e?{lesser:{lesser:e,actual:r}}:A.numeric(this._control)},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormLesser",void 0),_([e.Input("fsFormLesserMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormLesser]",providers:[x]})],r)}(P),tt=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.fsFormUrlProtocol=!1,e}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.url=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return B(this.fsFormUrl)?A.url(this._control,this.fsFormUrlProtocol):null},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormUrl",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"fsFormUrlProtocol",void 0),_([e.Input("fsFormUrlMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormUrl]",providers:[x]})],r)}(P),et=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validateAsync=function(t){return A.func(this._control,this.validateFn,this.validateFnData)},_([e.Input("validate"),F("design:type",Object)],r.prototype,"validateFn",void 0),_([e.Input("validateData"),F("design:type",Object)],r.prototype,"validateFnData",void 0),r=_([e.Directive({selector:"[validate]",providers:[x]})],r)}(P),rt=function(){function t(t,e){this._form=t,this._cdRef=e,this.create=!1}return t.prototype.ngOnInit=function(){var t=this;this._form.ngForm.statusChanges.subscribe((function(){t._cdRef.markForCheck()}))},Object.defineProperty(t.prototype,"dirty",{get:function(){return this._form.ngForm.dirty},enumerable:!0,configurable:!0}),t.ctorParameters=function(){return[{type:w,decorators:[{type:e.Optional}]},{type:e.ChangeDetectorRef}]},_([e.Input(),F("design:type",Object)],t.prototype,"create",void 0),t=_([e.Component({selector:"fs-form-dialog-actions",template:'<button \r\n mat-button \r\n color="primary" \r\n *ngIf="!dirty && !create"\r\n [matDialogClose]="null">\r\n Close\r\n</button>\r\n<button \r\n mat-button \r\n *ngIf="dirty || create"\r\n type="submit"\r\n color="primary" \r\n name="save">\r\n {{create ? \'Create\' : \'Save\'}}\r\n</button>\r\n<ng-content></ng-content>\r\n<button \r\n mat-button \r\n *ngIf="dirty || create"\r\n [matDialogClose]="null">\r\n Cancel\r\n</button>\r\n',changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[""]}),S(0,e.Optional()),F("design:paramtypes",[w,e.ChangeDetectorRef])],t)}(),nt=function(){function t(){}var a;return a=t,t.forRoot=function(){return{ngModule:a}},t=a=_([e.NgModule({imports:[r.CommonModule,n.FormsModule,i.MatButtonModule,o.MatDialogModule],declarations:[w,P,$,q,L,N,U,T,G,H,W,z,K,Z,Q,J,Y,X,tt,D,j,et,rt],exports:[w,P,$,q,L,N,U,T,G,H,W,z,K,Z,Q,J,Y,X,tt,D,j,et,rt],providers:[{provide:s.ErrorStateMatcher,useClass:s.ShowOnDirtyErrorStateMatcher}]})],t)}(),it=function(){function t(t){this._prompt=t}return t.prototype.canDeactivate=function(t){if(!("getForm"in t)){var e="Directive "+t.constructor.name+" does not property implement interface FormDeactivate";return console.error(e),d.of(!0)}var r=t.getForm();if(!(r instanceof w)){e="Directive "+t.constructor.name+".getForm() does not return a valid FsFormDirective";return console.error(e),d.of(!0)}return O(r,this._prompt).pipe(f.map((function(t){return E(t)})))},t.ctorParameters=function(){return[{type:u.FsPrompt}]},t.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new t(e.ɵɵinject(u.FsPrompt))},token:t,providedIn:"root"}),t=_([e.Injectable({providedIn:"root"}),F("design:paramtypes",[u.FsPrompt])],t)}();t.FormDeactivateGuard=it,t.FsForm=I,t.FsFormDialogActionsComponent=rt,t.FsFormDirective=w,t.FsFormModule=nt,t.FsValidators=A,t.ɵa=D,t.ɵb=j,t.ɵc=P,t.ɵd=V,t.ɵe=x,t.ɵf=k,t.ɵg=$,t.ɵh=q,t.ɵi=L,t.ɵj=N,t.ɵk=U,t.ɵl=T,t.ɵm=G,t.ɵn=H,t.ɵo=W,t.ɵp=z,t.ɵq=K,t.ɵr=Z,t.ɵs=Q,t.ɵt=J,t.ɵu=Y,t.ɵv=X,t.ɵw=tt,t.ɵx=et,t.ɵy=rt,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
15
|
+
***************************************************************************** */var h=function(t,e){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function y(t,e){function r(){this.constructor=t}h(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var v,b=function(){return(b=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function _(t,e,r,n){var i,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,r,s):i(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s}function S(t,e){return function(r,n){e(r,n,t)}}function F(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function C(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function O(e,r){return new d.Observable((function(n){if(!e.confirm||!e.ngForm.dirty)return n.next(t.ConfirmResult.Pristine),void n.complete();var i="You Have Unsaved Changes",o="What would you like to do with your changes?",s="Save & Continue",a="Discard Changes & Continue",l="Review Changes";"object"==typeof e.confirm&&(i=e.confirm.title||i,o=e.confirm.message||o,s=e.confirm.saveLabel||s,a=e.confirm.discardLabel||a,l=e.confirm.cancelLabel||l),r.confirm({title:i,template:o,dialogConfig:{width:"auto"},buttons:[{label:s,color:"primary",value:"save"},{label:a,value:"discard"},{label:l,cancel:!0}]}).subscribe((function(r){"discard"===r&&(n.next(t.ConfirmResult.Discard),n.complete(),e.reset()),"save"===r&&(e.submitted.pipe(f.first()).subscribe((function(){n.next(t.ConfirmResult.Save),n.complete()})),e.invalid.pipe(f.first()).subscribe((function(){n.next(t.ConfirmResult.Invalid),n.complete()})),e.ngForm.control.markAsPristine(),e.ngForm.ngSubmit.emit())}),(function(e){n.next(t.ConfirmResult.Review),n.complete()}))}))}(v=t.ConfirmResult||(t.ConfirmResult={})).Save="save",v.Discard="discard",v.Review="review",v.Invalid="invalid",v.Pristine="pristine";var M,D=function(){function t(){this.clicked$=new d.Subject,this.registered=!1,this.type="button"}return t.prototype.click=function(){this.clicked$.next()},t.prototype.ngOnDestroy=function(){this.clicked$.complete()},_([e.HostBinding("attr.type"),F("design:type",Object)],t.prototype,"type",void 0),_([e.HostListener("click",["$event.target"]),F("design:type",Function),F("design:paramtypes",[]),F("design:returntype",void 0)],t.prototype,"click",null),t=_([e.Directive({selector:"[fsFormDialogClose],[fs-form-dialog-close]"})],t)}(),j=function(){function t(t,e){this._matButton=t,this._elementRef=e,this.dirtySubmit=!0,this.transitionStyle=null,this.active=!1,this._destroy$=new d.Subject}return t.prototype.ngOnInit=function(){var t=this;d.fromEvent(this.element,"click").pipe(f.takeUntil(this._destroy$)).subscribe((function(){t.active=!0}))},t.prototype.setFormRef=function(t){var e=this;t&&(this.transitionStyle="none"),t&&this.dirtySubmit&&(t.dirtySubmitButton&&this.disable(),setTimeout((function(){e.transitionStyle=null}),500))},t.prototype.disable=function(){this._matButton&&(this._matButton.disabled=!0)},t.prototype.enable=function(){this._matButton&&(this._matButton.disabled=!1,this._matButton.disableRipple=!0)},t.prototype.process=function(){this.setClass("process"),this._matButton.disableRipple=!0},t.prototype.success=function(){this.setClass("success"),this._matButton.disableRipple=!1},t.prototype.error=function(){this.setClass("error"),this._matButton.disableRipple=!1},t.prototype.setClass=function(t){var e=this._getSvg(t);this._resetClass(),this._disableShadowAnimation(),this.element.classList.add("submit-"+t),this.element.append(e)},Object.defineProperty(t.prototype,"element",{get:function(){return this._elementRef.nativeElement},enumerable:!0,configurable:!0}),t.prototype.reset=function(){this.active=!1,this.enable(),this.element.querySelectorAll(".svg-icon").forEach((function(t){t.remove()})),this._matButton.disableRipple=!1,this._resetClass()},t.prototype.ngOnDestroy=function(){this._destroy$.next(),this._destroy$.complete()},t.prototype._disableShadowAnimation=function(){},t.prototype._resetClass=function(){this.element.classList.remove("submit-success","submit-error","submit-process","mat-elevation-z2")},t.prototype._getSvg=function(t){return"success"===t?(new DOMParser).parseFromString('<svg class="svg-icon svg-icon-success" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 38 38" style="enable-background:new 0 0 38 38;" xml:space="preserve" width="38px" height="38px">\n <g>\n <g class="check">\n <g>\n <path d="M29.6,11.9c-0.5-0.5-1.3-0.5-1.8,0L16.3,23.4l-6.1-6.1c-0.5-0.5-1.3-0.5-1.8,0s-0.5,1.3,0,1.8l7,7c0.3,0.3,0.6,0.4,0.9,0.4s0.7-0.1,0.9-0.4l12.4-12.4C30.1,13.2,30.1,12.4,29.6,11.9z"/>\n </g>\n </g>\n </g>\n </svg>',"text/xml").firstChild:"process"===t?(new DOMParser).parseFromString('<svg class="svg-icon svg-icon-process" width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2"><circle stroke-opacity=".5" cx="18" cy="18" r="18"/>\n <path d="M36 18c0-9.94-8.06-18-18-18"><animateTransform attributeName="transform" type="rotate" from="0 18 18" to="360 18 18" dur=".7s" repeatCount="indefinite"/></path>\n </g>\n </g>\n </svg>',"text/xml").firstChild:"error"===t?(new DOMParser).parseFromString('<svg class="svg-icon svg-icon-error" xmlns="http://www.w3.org/2000/svg" width="38px" height="38px" viewBox="0 0 16 16"><g><path d="M8 1c3.9 0 7 3.1 7 7s-3.1 7-7 7-7-3.1-7-7 3.1-7 7-7zM8 0c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8v0z" data-original="#444444" data-old_color="#444444"/><path d="M12.2 10.8l-2.8-2.8 2.8-2.8-1.4-1.4-2.8 2.8-2.8-2.8-1.4 1.4 2.8 2.8-2.8 2.8 1.4 1.4 2.8-2.8 2.8 2.8z"/></g> </svg>',"text/xml").firstChild:void 0},t.ctorParameters=function(){return[{type:i.MatButton,decorators:[{type:e.Optional},{type:e.Host}]},{type:e.ElementRef}]},_([e.Input(),F("design:type",Object)],t.prototype,"name",void 0),_([e.Input(),F("design:type",Object)],t.prototype,"dirtySubmit",void 0),_([e.HostBinding("style.transition"),F("design:type",Object)],t.prototype,"transitionStyle",void 0),t=_([e.Directive({selector:'form button[type="submit"],form button:not([type])'}),S(0,e.Optional()),S(0,e.Host()),F("design:paramtypes",[i.MatButton,e.ElementRef])],t)}(),I=function(){function t(){this._eventBus=new d.Subject}return t.prototype.broadcast=function(t,e){this._eventBus.next({key:t,data:e})},t.prototype.on=function(t){return this._eventBus.asObservable().pipe(f.filter((function(e){return e.key===t})),f.map((function(t){return t.data})))},t.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new t},token:t,providedIn:"root"}),t=_([e.Injectable({providedIn:"root"}),F("design:paramtypes",[])],t)}();function E(e){return e===t.ConfirmResult.Discard||e===t.ConfirmResult.Save||e===t.ConfirmResult.Pristine}(M=t.FormStatus||(t.FormStatus={})).Valid="valid",M.Invalid="invalid",M.Submitting="submitting",M.Submitted="submitted",M.Error="error",M.Success="success",M.Completing="completing";var w=function(){function r(r,n,i,o,s,a,l,u,p){this.ngForm=r,this._form=n,this._element=i,this._message=o,this._prompt=s,this._cdRef=a,this._ngZone=l,this._dialogRef=u,this._drawerRef=p,this.wrapperSelector=".fs-form-wrapper,.mat-form-field",this.messageSelector=".fs-form-message,.mat-form-field-subscript-wrapper",this.hintSelector=".fs-form-hint,.mat-form-field-hint-wrapper",this.labelSelector=".fs-form-label,.mat-form-field-label",this.autocomplete=!1,this.shortcuts=!0,this.confirm=!0,this.confirmDialog=!0,this.confirmDrawer=!0,this.confirmBrowser=!0,this.confirmTabs=!0,this.dirtySubmitButton=!0,this.successDelay=0,this.errorDelay=1e3,this.submitEvent=new e.EventEmitter,this.invalid=new e.EventEmitter,this.valid=new e.EventEmitter,this.submitted=new e.EventEmitter,this.fsformClass=!0,this._tabGroups=new e.QueryList,this._dialogBackdropEscape=!1,this._snapshot={},this._status$=new d.BehaviorSubject(t.FormStatus.Valid),this._destroy$=new d.Subject}return Object.defineProperty(r.prototype,"submitting",{get:function(){return this._status$.getValue()===t.FormStatus.Submitting},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"completing",{get:function(){return this._status$.getValue()===t.FormStatus.Completing},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"_submitEvent",{get:function(){return{ngForm:this.ngForm,submitter:this._submitter}},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"_formValidState$",{get:function(){this._form.broadcast("valid",this._submitEvent),this.submitEvent.emit(this._submitEvent),this.valid.emit(this._submitEvent);var t={ngForm:this.ngForm,submitter:this._submitter,response:null};if(!this.submit)return d.of(t);var e=this.submit(this._submitEvent);return d.isObservable(e)?e.pipe(f.map((function(e){return t.response=e,t}))):d.of(t)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"_formInvalidState$",{get:function(){this._form.broadcast("invalid",this._submitEvent),this.invalid&&this.invalid.emit(this._submitEvent);this._message.error("Changes not saved. Please review errors highlighted in red.",{mode:l.MessageMode.Toast});var t=this._element.nativeElement.querySelector(".ng-invalid");return t&&t.scrollIntoView({behavior:"smooth",block:"center"}),d.throwError("Form validation error")},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"_submitter",{get:function(){return this._activeSubmitButton?this._activeSubmitButton.name:null},enumerable:!0,configurable:!0}),r.prototype.ngOnInit=function(){this._registerConfirmDialogBackdropEscape(),this._listenHotKeys(),this._listenWindowClose(),this._listenSubmit(),this.autocomplete||this._registerAutocomplete()},r.prototype.ngOnChanges=function(t){t.confirm&&this._updateDirtySubmitButtons()},r.prototype.ngAfterContentInit=function(){this._registerConfirm(),this._registerConfirmDialogClose(),this._registerConfirmDrawerClose(),this._registerConfirmTabs(),this._registerDrawerClose(),this._registerDirtySubmitButton()},r.prototype.ngOnDestroy=function(){this._destroy$.next(),this._destroy$.complete()},r.prototype.createSnapshot=function(){this._snapshot=this.ngForm.value},r.prototype.reset=function(){var t=this;this.ngForm.resetForm(),Object.keys(this.ngForm.controls).forEach((function(e){t.ngForm.controls[e].reset(t._snapshot[e])}))},r.prototype.clear=function(){this.ngForm.resetForm()},r.prototype.dirty=function(){this.ngForm.form.markAsDirty(),this._updateDirtySubmitButtons()},r.prototype.triggerSubmit=function(){this.ngForm.ngSubmit.next()},r.prototype.triggerConfirm=function(){var t=this;return(this.submitting?this.submitted.asObservable():d.of({})).pipe(f.take(1),f.mergeMap((function(){return O(t,t._prompt)})))},r.prototype.enable=function(){this.ngForm.control.enable(),this._updateDirtySubmitButtons()},r.prototype.disable=function(){this.ngForm.control.disable(),this.submitButtons.forEach((function(t){t.disable()}))},r.prototype._listenSubmit=function(){var e=this;this.ngForm.ngSubmit.pipe(f.tap((function(t){null==t||t.preventDefault()})),f.filter((function(){return[t.FormStatus.Valid,t.FormStatus.Invalid].includes(e._status$.getValue())})),f.tap((function(){return e._markControlsAsTouchedAndUpdateValidity()})),f.tap((function(){return e._broadcastSubmittingEvents()})),f.switchMap((function(){return e._waitUntilStatusPending()})),f.tap((function(){return e._setupActiveSubmitButton()})),f.mergeMap((function(){return"INVALID"===e.ngForm.status?e._formInvalidState$:e._formValidState$})),f.catchError((function(t,r){return e._handleError(t),r})),f.tap((function(t){e._completeSubmit(!0,t)})),f.takeUntil(this._destroy$)).subscribe((function(){}))},r.prototype._listenWindowClose=function(){var t=this;d.fromEvent(window,"beforeunload").pipe(f.takeUntil(this._destroy$)).subscribe((function(e){t.confirm&&t.confirmBrowser&&t.ngForm.dirty&&(e.returnValue=!1)}))},r.prototype._listenHotKeys=function(){var t=this;this._ngZone.runOutsideAngular((function(){d.fromEvent(document,"keydown").pipe(f.takeUntil(t._destroy$)).subscribe((function(e){if(t._dialogBackdropEscape&&"Escape"===e.code){var r=document.getElementById(t._dialogRef.id),n=e.composedPath();n&&n.forEach((function(e){r===e&&t._ngZone.run((function(){t._formClose()}))}))}(e.ctrlKey||e.metaKey)&&"KeyS"===e.code&&(e.preventDefault(),t.shortcuts&&t._elementInForm(document.activeElement)&&t.ngForm.ngSubmit.next())}))}))},r.prototype._formClose=function(){var e=this;this.confirm&&this.confirmDialog?this.triggerConfirm().pipe(f.filter((function(t){return E(t)})),f.switchMap((function(r){return r===t.ConfirmResult.Pristine||r===t.ConfirmResult.Discard?d.of(null):e.submitted.asObservable()})),f.takeUntil(this._destroy$)).subscribe((function(t){e._dialogRef.close(null==t?void 0:t.response)})):this._dialogRef.close(null)},r.prototype._registerDialogClose=function(t){var e=this;t.registered||(t.registered=!0,t.clicked$.pipe(f.takeUntil(this._destroy$)).subscribe((function(){e._formClose()})))},r.prototype._getActiveButton=function(){var t=this.submitButtons.find((function(t){return t.active}));return t||this.submitButtons.first},r.prototype._elementInForm=function(t){return!!t.isSameNode(this._element.nativeElement)||!!t.parentElement&&this._elementInForm(t.parentElement)},r.prototype._completeSubmit=function(e,r){var n=this;e?(this.ngForm.control.markAsPristine(),this.createSnapshot(),this.submitted.emit(r)):this._resetButtons(),this._activeSubmitButton&&(e?this._activeSubmitButton.success():this._activeSubmitButton.error()),this._status$.next(t.FormStatus.Submitted),e?this._status$.next(t.FormStatus.Success):this._status$.next(t.FormStatus.Error),this._status$.next(t.FormStatus.Completing);var i=e?this.successDelay:this.errorDelay;d.of(!0).pipe(f.delay(i),f.first(),f.takeUntil(this._destroy$)).subscribe((function(){"VALID"===n.ngForm.form.status?n._status$.next(t.FormStatus.Valid):n._status$.next(t.FormStatus.Invalid),n._resetButtons(),n._updateDirtySubmitButtons()}))},r.prototype._resetButtons=function(){this.submitButtons.forEach((function(t){t.reset()}))},r.prototype._registerConfirm=function(){var t=this;this.ngForm.form.valueChanges.pipe(f.takeUntil(this._destroy$)).subscribe((function(e){if(t.confirm){var r=Object.keys(t._snapshot);Object.keys(e).forEach((function(n){-1===r.indexOf(n)&&(t._snapshot[n]=e[n])}))}}))},r.prototype._registerDrawerClose=function(){var e=this;this._drawerRef&&this._drawerRef.closeStart$.pipe(f.takeUntil(this._destroy$)).subscribe((function(r){e.submitting?e._status$.pipe(f.filter((function(e){return e===t.FormStatus.Success||e===t.FormStatus.Error})),f.takeUntil(e._destroy$)).subscribe((function(e){e===t.FormStatus.Success?(r.next(),r.complete()):r.error()})):(r.next(),r.complete())}))},r.prototype._registerConfirmDrawerClose=function(){var t=this;this._drawerRef&&this._drawerRef.closeStart$.pipe(f.switchMap((function(e){return d.iif((function(){return t.confirm&&t.confirmDrawer}),t.triggerConfirm().pipe(f.map((function(t){return E(t)})),f.tap((function(t){t?(e.next(),e.complete()):e.error()}))),d.defer((function(){e.next(),e.complete()})))})),f.takeUntil(this._destroy$)).subscribe()},r.prototype._registerConfirmTabs=function(){var t=this;this.tabGroup&&this.registerConfirmTabGroup(this.tabGroup),this.registerConfirmTabGroups(this._tabGroups.toArray()),this._tabGroups.changes.pipe(f.takeUntil(this._destroy$)).subscribe((function(){t.registerConfirmTabGroups(t._tabGroups.toArray())}))},r.prototype.registerConfirmTabGroups=function(t){var e=this;t.forEach((function(t){e.registerConfirmTabGroup(t)}))},r.prototype.registerConfirmTabGroup=function(t){var e=this,r=t;r._originalHandleClick||(r._originalHandleClick=t._handleClick,r._handlClick$=new d.Subject,r._handleClick=function(t,e,n){r._handlClick$.observers.length?r._handlClick$.next({tab:t,tabHeader:e,idx:n}):r._originalHandleClick(t,e,n)}),r._handlClick$.pipe(f.takeUntil(this._destroy$)).subscribe((function(t){e.submitting||(e.confirm&&e.confirmTabs?e.triggerConfirm().pipe(f.takeUntil(e._destroy$)).subscribe((function(e){E(e)&&(r.selectedIndex=t.idx)})):r._originalHandleClick(t.tab,t.tabHeader,t.idx))}))},r.prototype._registerConfirmDialogClose=function(){var t=this;this._dialogRef&&(this.formDialogClose.forEach((function(e){t._registerDialogClose(e)})),this.formDialogClose.changes.pipe(f.takeUntil(this._destroy$)).subscribe((function(e){e.forEach((function(e){t._registerDialogClose(e)}))})))},r.prototype._registerConfirmDialogBackdropEscape=function(){var t=this;this._dialogBackdropEscape=this._dialogRef&&!0!==this._dialogRef.disableClose,this._dialogRef&&!this._dialogRef.disableClose&&(this._dialogRef.disableClose=!0,this._dialogRef.backdropClick().pipe(f.takeUntil(this._destroy$)).subscribe((function(){t._formClose()})),this._destroy$.subscribe((function(){t._dialogRef.disableClose=!1})))},r.prototype._registerAutocomplete=function(){var t=this;this._registerControl=this.ngForm.form.registerControl.bind(this.ngForm.form),this.ngForm.form.registerControl=function(e,r){var n=t._element.nativeElement.querySelector("input[name='"+e+"']");return n&&(n.setAttribute("name",e+"_"+p.guid()),n.getAttribute("autocomplete")||n.setAttribute("autocomplete","none")),t._registerControl(e,r)}},r.prototype._registerDirtySubmitButton=function(){var t=this;this.ngForm&&(this.ngForm.form.valueChanges.pipe(f.takeUntil(this._destroy$)).subscribe((function(){t._updateDirtySubmitButtons()})),this.submitButtons.changes.pipe(f.takeUntil(this._destroy$)).subscribe((function(){t._updateDirtySubmitButtons()})))},r.prototype._updateDirtySubmitButtons=function(){var t=this;this.submitButtons&&(this.submitButtons.forEach((function(e){e.setFormRef(t),t.confirm&&t.dirtySubmitButton&&!t.ngForm.dirty&&e.dirtySubmit?e.disable():e.enable()})),this._cdRef.markForCheck())},r.prototype._broadcastSubmittingEvents=function(){this._status$.next(t.FormStatus.Submitting),this._form.broadcast("submit",this.ngForm)},r.prototype._markControlsAsTouchedAndUpdateValidity=function(){Object.values(this.ngForm.controls).forEach((function(t){t.markAsDirty(),t.markAsTouched(),t.updateValueAndValidity()}))},r.prototype._setupActiveSubmitButton=function(){this._activeSubmitButton=this._getActiveButton(),this._resetButtons(),this._activeSubmitButton&&this._activeSubmitButton.process()},r.prototype._waitUntilStatusPending=function(){return this.ngForm.statusChanges.pipe(f.startWith(this.ngForm.status),f.first((function(t){return"PENDING"!==t})))},r.prototype._handleError=function(t){if(console.log("%c Form Submit ","color: white; background-color: #D33F49","Error occured"),console.group("Error Details:"),console.log("Message: ",t),console.log("FormRef: ",this),this.ngForm.invalid){var e=function t(e,r){var i,o=null;return e.invalid&&e.errors&&((i={})[r]=b({},e.errors),o=i),e instanceof n.FormGroup&&Object.entries(e.controls).forEach((function(e){var r=C(e,2),n=r[0],i=t(r[1],n);i&&(o?Object.assign(o,i):o=b({},i))})),o}(this.ngForm.control,null);console.log("Validation Errors: ",e)}console.groupEnd(),this._completeSubmit(!1,null)},r.ctorParameters=function(){return[{type:n.NgForm,decorators:[{type:e.Inject,args:[n.NgForm]}]},{type:I},{type:e.ElementRef},{type:l.FsMessage},{type:u.FsPrompt},{type:e.ChangeDetectorRef},{type:e.NgZone},{type:o.MatDialogRef,decorators:[{type:e.Optional},{type:e.Inject,args:[o.MatDialogRef]}]},{type:c.DrawerRef,decorators:[{type:e.Optional},{type:e.Inject,args:[c.DrawerRef]}]}]},_([e.Input(),F("design:type",Object)],r.prototype,"wrapperSelector",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"messageSelector",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"hintSelector",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"labelSelector",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"autocomplete",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"shortcuts",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"confirm",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"confirmDialog",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"confirmDrawer",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"confirmBrowser",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"confirmTabs",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"dirtySubmitButton",void 0),_([e.Input(),F("design:type",Function)],r.prototype,"submit",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"successDelay",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"errorDelay",void 0),_([e.Input(),F("design:type",a.MatTabGroup)],r.prototype,"tabGroup",void 0),_([e.Output("fsForm"),F("design:type",e.EventEmitter)],r.prototype,"submitEvent",void 0),_([e.Output(),F("design:type",e.EventEmitter)],r.prototype,"invalid",void 0),_([e.Output(),F("design:type",e.EventEmitter)],r.prototype,"valid",void 0),_([e.Output(),F("design:type",e.EventEmitter)],r.prototype,"submitted",void 0),_([e.HostBinding("class.fs-form"),F("design:type",Object)],r.prototype,"fsformClass",void 0),_([e.ContentChildren(D,{descendants:!0}),F("design:type",e.QueryList)],r.prototype,"formDialogClose",void 0),_([e.ContentChildren(a.MatTabGroup,{descendants:!0}),F("design:type",e.QueryList)],r.prototype,"_tabGroups",void 0),_([e.ContentChildren(j,{descendants:!0}),F("design:type",e.QueryList)],r.prototype,"submitButtons",void 0),r=_([e.Directive({selector:"[fsForm]"}),S(0,e.Inject(n.NgForm)),S(7,e.Optional()),S(7,e.Inject(o.MatDialogRef)),S(8,e.Optional()),S(8,e.Inject(c.DrawerRef)),F("design:paramtypes",[n.NgForm,I,e.ElementRef,l.FsMessage,u.FsPrompt,e.ChangeDetectorRef,e.NgZone,o.MatDialogRef,c.DrawerRef])],r)}(),R={required:"This field is required",email:"This is not a valid email address",emails:"Input valid email addresses, comma separated",phone:"Invalid phone number",numeric:"Value should be numeric",integer:"Value should be an integer",min:"Value should not be less than $(1)",max:"Value should not be greater than $(1)",minlength:"Should not be shorter than $(1) characters",maxlength:"Should not be longer than $(1) characters",compare:"Inputs do not match",pattern:"Value should match pattern $(1)",dateRange:"Invalid date range",url:"This is not a valid url",urlProtocol:"Invalid URL. Proper http protocol is required. eg. https://google.com",greater:"Value must be greater than $(1)",lesser:"Value must be less than $(1)"},k=new e.InjectionToken("fs.form.validate-messages"),x={provide:k,useFactory:V};function V(){return b({},R)}var P=function(){function t(t,e,r,n,i,o){this.elementRef=t,this.renderer2=e,this.injector=r,this._validateMessages=n,this.ngControl=i,this.formDirective=o,this.appendMessageClass="fs-form-message",this.appendLabelClass="fs-form-label",this.appendErrorClass="fs-form-error",this.appendHintClass="fs-form-hint",this.errors=[],this._destroy$=new d.Subject,i?this._control=i.control:console.error("The element does not have a valid ngModel",this.elementRef.nativeElement)}return Object.defineProperty(t.prototype,"validateMessages",{set:function(t){this._validateMessages=b(b({},this._validateMessages),t)},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){this._setupValidators()},t.prototype.ngOnDestroy=function(){this._destroy$.next(),this._destroy$.complete()},t.prototype.ngAfterContentInit=function(){this._control&&(this._control.statusChangesSubscribe||(this._control.statusChanges.pipe(f.takeUntil(this._destroy$)).subscribe(this.render.bind(this)),this._control.statusChangesSubscribe=!0))},t.prototype.getMessageSelector=function(){return!1===this.messageSelector?"":this.messageSelector?this.messageSelector:this.formDirective&&this.formDirective.messageSelector?this.formDirective.messageSelector:void 0},t.prototype.getHintWrapperSelector=function(){return!1===this.hintSelector?"":this.hintSelector?this.hintSelector:this.formDirective&&this.formDirective.hintSelector?this.formDirective.hintSelector:void 0},t.prototype.getWrapperSelector=function(){return!1===this.wrapperSelector?"":this.wrapperSelector?this.wrapperSelector:this.formDirective&&this.formDirective.wrapperSelector?this.formDirective.wrapperSelector:void 0},t.prototype.getlabelSelector=function(){return!1===this.labelSelector?"":this.labelSelector?this.labelSelector:this.formDirective&&this.formDirective.labelSelector?this.formDirective.labelSelector:void 0},t.prototype.getWrapperElement=function(){var t=this.getWrapper(this.elementRef.nativeElement);return t||this.elementRef.nativeElement},t.prototype.render=function(){var t;if(this.ngControl){var e=this.renderer2,r=this.getWrapperElement(),n=this.ngControl.dirty?this.getError(this.ngControl):null;if(!this.getMessageSelector())return;var i=r.querySelector(this.getMessageSelector());if(!i)return console.warn("Failed to locate "+this.getMessageSelector(),this.elementRef.nativeElement);if(this.getlabelSelector()){var o=r.querySelector(this.getlabelSelector());o&&this.appendLabelClass&&this.renderer2.addClass(o,this.appendLabelClass)}if(this.appendMessageClass&&e.addClass(i,this.appendMessageClass),this.getHintWrapperSelector()){var s=i.querySelector(this.getHintWrapperSelector());s&&(e.setStyle(s,"display",n?"none":"block"),this.appendHintClass&&e.addClass(s,this.appendHintClass))}var a=r.querySelector(".fs-form-error-target");if(a&&a.remove(),r.classList.remove("ng-invalid"),!(this.ngControl.invalid&&(this.ngControl.dirty||(null===(t=this.formDirective.ngForm)||void 0===t?void 0:t.submitted)))||!n)return;r.classList.add("ng-invalid"),a=e.createElement("div"),e.addClass(a,"fs-form-error-target"),e.addClass(a,this.appendErrorClass),e.addClass(a,this.appendErrorClass+"-"+n.name);var l=e.createText(n.message);e.appendChild(a,l),i.appendChild(a)}},t.prototype.getWrapper=function(t,e){return void 0===e&&(e=0),!t||e>10?null:t.parentNode&&t.parentNode.querySelector(this.getWrapperSelector())?t:this.getWrapper(t.parentNode,++e)},t.prototype.parseErrorMessage=function(t,e){return m.values(e).forEach((function(e){t=t.replace(/\$\(\d\)/,e)})),t},t.prototype.getError=function(t){var e=m.keys(t.control.errors)[0];if(!e)return null;var r=t.control.errors[e];return this._validateMessages[e]&&(r=this.parseErrorMessage(this._validateMessages[e],r)),{name:e,message:r}},t.prototype._setupValidators=function(){var t=this._control;if(this.validate){var e=t.validator?[t.validator,this.validate.bind(this)]:this.validate.bind(this);t.setValidators(e)}if(this.validateAsync){var r=t.asyncValidator?[t.asyncValidator,this.validateAsync.bind(this)]:this.validateAsync.bind(this);t.setAsyncValidators(r)}t.updateValueAndValidity()},t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2},{type:e.Injector},{type:void 0,decorators:[{type:e.Self},{type:e.Inject,args:[k]}]},{type:n.NgControl,decorators:[{type:e.Optional}]},{type:w,decorators:[{type:e.Optional},{type:e.Inject,args:[w]}]}]},_([e.Input(),F("design:type",Object)],t.prototype,"wrapperSelector",void 0),_([e.Input(),F("design:type",Object)],t.prototype,"messageSelector",void 0),_([e.Input(),F("design:type",Object)],t.prototype,"hintSelector",void 0),_([e.Input(),F("design:type",Object)],t.prototype,"labelSelector",void 0),_([e.Input(),F("design:type",Object)],t.prototype,"appendMessageClass",void 0),_([e.Input(),F("design:type",Object)],t.prototype,"appendLabelClass",void 0),_([e.Input(),F("design:type",Object)],t.prototype,"appendErrorClass",void 0),_([e.Input(),F("design:type",Object)],t.prototype,"appendHintClass",void 0),_([e.Input(),F("design:type",Object),F("design:paramtypes",[Object])],t.prototype,"validateMessages",null),t=_([e.Directive({selector:"[fsFormControl]",providers:[x]}),S(3,e.Self()),S(3,e.Inject(k)),S(4,e.Optional()),S(5,e.Optional()),S(5,e.Inject(w)),F("design:paramtypes",[e.ElementRef,e.Renderer2,e.Injector,Object,n.NgControl,w])],t)}();function $(t){return"false"!==t&&(t||""===t)}var B=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.required=!1,e}return y(r,t),Object.defineProperty(r.prototype,"setFsFormRequired",{set:function(t){this.required=$(t)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"setRequired",{set:function(t){this.required=$(t)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.required=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return this.required?n.Validators.required(this._control):null},r.prototype.render=function(){var e=this.getWrapperElement();if(e&&this.getlabelSelector()){var r=e.querySelector(this.getlabelSelector());r&&(this.required?this.renderer2.addClass(r,"fs-form-label-required"):this.renderer2.removeClass(r,"fs-form-label-required"))}t.prototype.render.call(this)},_([e.Input("fsFormRequired"),F("design:type",Object),F("design:paramtypes",[Object])],r.prototype,"setFsFormRequired",null),_([e.Input("required"),F("design:type",Object),F("design:paramtypes",[Object])],r.prototype,"setRequired",null),_([e.Input("fsFormRequiredMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormRequired],[ngModel][required]",providers:[x]})],r)}(P),A=function(){function t(){}return t.email=function(t){return!t.value||p.email(t.value)?null:{email:!0}},t.emails=function(t){return(t.value||"").split(",").some((function(t){return!p.email(t)}))?{email:!0}:null},t.numeric=function(t){return p.isEmpty(t.value)||p.isNumeric(t.value)?null:{numeric:!0}},t.integer=function(t){return t.value&&""!==String(t.value)&&t.value%1!=0?{integer:!0}:null},t.phone=function(t){return!t.value||p.phone(t.value)?null:{phone:!0}},t.url=function(t,e){if(void 0===e&&(e=!1),!t.value)return null;if(!p.url(t.value))return{url:!0};if(e){var r=new RegExp(/^http(s)?:\/\//gm);if(!String(t.value).match(r))return{urlProtocol:!0}}return null},t.dateRange=function(t){if(!t.value)return null;if(m.isObject(t.value)){var e=t.value.start,r=t.value.end;if(!e&&!r||g.isValid(e)&&g.isValid(r))return null}return{dateRange:!0}},t.func=function(t,e,r){var n,i;try{n=e(t,r)}catch(t){t=t instanceof Error?t.message:t,i=d.throwError(t)}return i||(i=n instanceof Promise?d.from(n):d.isObservable(n)?n:d.of(null)),i.pipe(f.map((function(){return null})),f.catchError((function(t){return d.of({validationError:t})})),f.take(1))},t}(),q=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.min=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return A.numeric(this._control)||n.Validators.min(parseFloat(this.fsFormMin))(this._control)},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormMin",void 0),_([e.Input("fsFormMinMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormMin]",providers:[x]})],r)}(P),L=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.max=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return A.numeric(this._control)||n.Validators.max(this.fsFormMax)(this._control)},_([e.Input(),F("design:type",Number)],r.prototype,"fsFormMax",void 0),_([e.Input("fsFormMaxMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormMax]",providers:[x]})],r)}(P),U=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.minlength=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return n.Validators.minLength(this.fsFormMinLength)(this._control)},_([e.Input(),F("design:type",Number)],r.prototype,"fsFormMinLength",void 0),_([e.Input("fsFormMinLengthMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormMinLength]",providers:[x]})],r)}(P),N=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.maxlength=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return n.Validators.maxLength(this.fsFormMaxLength)(this._control)},_([e.Input(),F("design:type",Number)],r.prototype,"fsFormMaxLength",void 0),_([e.Input("fsFormMaxLengthMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormMaxLength]",providers:[x]})],r)}(P),T=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.email=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return $(this.fsFormEmail)?A.email(this._control):null},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormEmail",void 0),_([e.Input("fsFormEmailMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormEmail]",providers:[x]})],r)}(P),G=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.emails=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return $(this.fsFormEmails)?A.emails(this._control):null},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormEmails",void 0),_([e.Input("fsFormEmailsMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormEmails]",providers:[x]})],r)}(P),H=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.phone=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return $(this.fsFormPhone)?A.phone(this._control):null},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormPhone",void 0),_([e.Input("fsFormPhoneMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormPhone]",providers:[x]})],r)}(P),W=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.compare=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return this.fsFormCompare.value===this.elementRef.nativeElement.value?null:{compare:!0}},r.prototype.ngAfterViewInit=function(){var t=this;this.fsFormCompare.addEventListener("keyup",(function(){t._control.updateValueAndValidity()}),!1)},r.prototype.ngOnDestroy=function(){var t=this;this.fsFormCompare.removeEventListener("keyup",(function(){t._control.updateValueAndValidity()}),!1)},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormCompare",void 0),_([e.Input("fsFormCompareMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormCompare]",providers:[x]})],r)}(P),z=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.integer=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return $(this.fsFormInteger)?A.integer(this._control):null},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormInteger",void 0),_([e.Input("fsFormIntegerMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormInteger]",providers:[x]})],r)}(P),K=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.numeric=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return $(this.fsFormNumeric)?A.numeric(this._control):null},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormNumeric",void 0),_([e.Input("fsFormNumericMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormNumeric]",providers:[x]})],r)}(P),Z=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.pattern=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return n.Validators.pattern(this.fsFormPattern)(this._control)},_([e.Input(),F("design:type",RegExp)],r.prototype,"fsFormPattern",void 0),_([e.Input("fsFormPatternMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormPattern]",providers:[x]})],r)}(P),Q=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validateAsync=function(t){return A.func(this._control,this.fsFormFunction,this.fsFormFunctionData)},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormFunction",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"fsFormFunctionData",void 0),r=_([e.Directive({selector:"[fsFormFunction]",providers:[x]})],r)}(P),Y=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.greater=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){var e=parseFloat(this.fsFormGreater),r=parseFloat(this._control.value);return!isNaN(e)&&!isNaN(r)&&r<=e?{greater:{greater:e,actual:r}}:A.numeric(this._control)},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormGreater",void 0),_([e.Input("fsFormGreaterMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormGreater]",providers:[x]})],r)}(P),J=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.dateRange=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return $(this.fsFormDateRange)?A.dateRange(this._control):null},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormDateRange",void 0),_([e.Input("fsFormDateRangeMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormDateRange]",providers:[x]})],r)}(P),X=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.lesser=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){var e=parseFloat(this.fsFormLesser),r=parseFloat(this._control.value);return!isNaN(e)&&!isNaN(r)&&r>=e?{lesser:{lesser:e,actual:r}}:A.numeric(this._control)},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormLesser",void 0),_([e.Input("fsFormLesserMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormLesser]",providers:[x]})],r)}(P),tt=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.fsFormUrlProtocol=!1,e}return y(r,t),Object.defineProperty(r.prototype,"validationMessage",{set:function(t){this._validateMessages.url=t},enumerable:!0,configurable:!0}),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validate=function(t){return $(this.fsFormUrl)?A.url(this._control,this.fsFormUrlProtocol):null},_([e.Input(),F("design:type",Object)],r.prototype,"fsFormUrl",void 0),_([e.Input(),F("design:type",Object)],r.prototype,"fsFormUrlProtocol",void 0),_([e.Input("fsFormUrlMessage"),F("design:type",String),F("design:paramtypes",[String])],r.prototype,"validationMessage",null),r=_([e.Directive({selector:"[fsFormUrl]",providers:[x]})],r)}(P),et=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return y(r,t),r.prototype.ngOnChanges=function(){this._control.updateValueAndValidity()},r.prototype.validateAsync=function(t){return A.func(this._control,this.validateFn,this.validateFnData)},_([e.Input("validate"),F("design:type",Object)],r.prototype,"validateFn",void 0),_([e.Input("validateData"),F("design:type",Object)],r.prototype,"validateFnData",void 0),r=_([e.Directive({selector:"[validate]",providers:[x]})],r)}(P),rt=function(){function t(t,e){this._form=t,this._cdRef=e,this.create=!1,this.dirty=!1,this._destroy$=new d.Subject}return t.prototype.ngOnInit=function(){var t=this;this._form.ngForm.valueChanges.pipe(f.filter((function(){return!t.dirty})),f.takeUntil(this._destroy$)).subscribe((function(){t.dirty=t._form.ngForm.dirty,t._cdRef.markForCheck()})),this._form.submitted.pipe(f.takeUntil(this._destroy$)).subscribe((function(){t.dirty=!1,t._cdRef.markForCheck()}))},t.prototype.ngOnDestroy=function(){this._destroy$.next(),this._destroy$.complete()},t.ctorParameters=function(){return[{type:w,decorators:[{type:e.Optional}]},{type:e.ChangeDetectorRef}]},_([e.Input(),F("design:type",Object)],t.prototype,"create",void 0),t=_([e.Component({selector:"fs-form-dialog-actions",template:'<button \r\n mat-button \r\n color="primary" \r\n *ngIf="!dirty && !create"\r\n [matDialogClose]="null">\r\n Close\r\n</button>\r\n<button \r\n mat-button \r\n *ngIf="dirty || create"\r\n type="submit"\r\n color="primary" \r\n name="save">\r\n {{create ? \'Create\' : \'Save\'}}\r\n</button>\r\n<ng-content></ng-content>\r\n<button \r\n mat-button \r\n *ngIf="dirty || create"\r\n [matDialogClose]="null">\r\n Cancel\r\n</button>\r\n',changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[""]}),S(0,e.Optional()),F("design:paramtypes",[w,e.ChangeDetectorRef])],t)}(),nt=function(){function t(){}var a;return a=t,t.forRoot=function(){return{ngModule:a}},t=a=_([e.NgModule({imports:[r.CommonModule,n.FormsModule,i.MatButtonModule,o.MatDialogModule],declarations:[w,P,B,q,L,U,N,T,G,H,W,z,K,Z,Q,J,Y,X,tt,D,j,et,rt],exports:[w,P,B,q,L,U,N,T,G,H,W,z,K,Z,Q,J,Y,X,tt,D,j,et,rt],providers:[{provide:s.ErrorStateMatcher,useClass:s.ShowOnDirtyErrorStateMatcher}]})],t)}(),it=function(){function t(t){this._prompt=t}return t.prototype.canDeactivate=function(t){if(!("getForm"in t)){var e="Directive "+t.constructor.name+" does not property implement interface FormDeactivate";return console.error(e),d.of(!0)}var r=t.getForm();if(!(r instanceof w)){e="Directive "+t.constructor.name+".getForm() does not return a valid FsFormDirective";return console.error(e),d.of(!0)}return O(r,this._prompt).pipe(f.map((function(t){return E(t)})))},t.ctorParameters=function(){return[{type:u.FsPrompt}]},t.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new t(e.ɵɵinject(u.FsPrompt))},token:t,providedIn:"root"}),t=_([e.Injectable({providedIn:"root"}),F("design:paramtypes",[u.FsPrompt])],t)}();t.FormDeactivateGuard=it,t.FsForm=I,t.FsFormDialogActionsComponent=rt,t.FsFormDirective=w,t.FsFormModule=nt,t.FsValidators=A,t.ɵa=D,t.ɵb=j,t.ɵc=P,t.ɵd=k,t.ɵe=x,t.ɵf=V,t.ɵg=B,t.ɵh=q,t.ɵi=L,t.ɵj=U,t.ɵk=N,t.ɵl=T,t.ɵm=G,t.ɵn=H,t.ɵo=W,t.ɵp=z,t.ɵq=K,t.ɵr=Z,t.ɵs=Q,t.ɵt=J,t.ɵu=Y,t.ɵv=X,t.ɵw=tt,t.ɵx=et,t.ɵy=rt,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
16
16
|
//# sourceMappingURL=firestitch-form.umd.min.js.map
|