@ngxs/form-plugin
Advanced tools
Comparing version 2.1.0-dev.7ce8703 to 2.1.0-dev.81940e8
@@ -7,40 +7,2 @@ (function (global, factory) { | ||
var NgxsFormPlugin = /** @class */ (function () { | ||
function NgxsFormPlugin() { | ||
} | ||
NgxsFormPlugin.prototype.handle = function (state, event, next) { | ||
var type = store.getActionTypeFromInstance(event); | ||
var nextState = state; | ||
if (type === 'UpdateFormValue' || type === 'UpdateForm') { | ||
nextState = store.setValue(nextState, event.payload.path + ".model", Object.assign({}, event.payload.value)); | ||
} | ||
if (type === 'UpdateFormStatus' || type === 'UpdateForm') { | ||
nextState = store.setValue(nextState, event.payload.path + ".status", event.payload.status); | ||
} | ||
if (type === 'UpdateFormErrors' || type === 'UpdateForm') { | ||
nextState = store.setValue(nextState, event.payload.path + ".errors", Object.assign({}, event.payload.errors)); | ||
} | ||
if (type === 'UpdateFormDirty' || type === 'UpdateForm') { | ||
nextState = store.setValue(nextState, event.payload.path + ".dirty", event.payload.dirty); | ||
} | ||
if (type === 'SetFormDirty') { | ||
nextState = store.setValue(nextState, event.payload + ".dirty", true); | ||
} | ||
if (type === 'SetFormPrestine') { | ||
nextState = store.setValue(nextState, event.payload + ".dirty", false); | ||
} | ||
if (type === 'SetFormDisabled') { | ||
nextState = store.setValue(nextState, event.payload + ".disabled", true); | ||
} | ||
if (type === 'SetFormEnabled') { | ||
nextState = store.setValue(nextState, event.payload + ".disabled", false); | ||
} | ||
return next(nextState, event); | ||
}; | ||
return NgxsFormPlugin; | ||
}()); | ||
NgxsFormPlugin.decorators = [ | ||
{ type: core.Injectable }, | ||
]; | ||
NgxsFormPlugin.ctorParameters = function () { return []; }; | ||
var UpdateFormStatus = /** @class */ (function () { | ||
@@ -52,3 +14,3 @@ function UpdateFormStatus(payload) { | ||
}()); | ||
UpdateFormStatus.type = '[Forms] Update Status'; | ||
UpdateFormStatus.type = '[Forms] Update Form Status'; | ||
var UpdateFormValue = /** @class */ (function () { | ||
@@ -88,3 +50,3 @@ function UpdateFormValue(payload) { | ||
}()); | ||
SetFormPristine.type = '[Forms] Set Form Prestine'; | ||
SetFormPristine.type = '[Forms] Set Form Pristine'; | ||
var UpdateFormErrors = /** @class */ (function () { | ||
@@ -111,2 +73,40 @@ function UpdateFormErrors(payload) { | ||
SetFormEnabled.type = '[Forms] Set Form Enabled'; | ||
var NgxsFormPlugin = /** @class */ (function () { | ||
function NgxsFormPlugin() { | ||
} | ||
NgxsFormPlugin.prototype.handle = function (state, event, next) { | ||
var type = store.getActionTypeFromInstance(event); | ||
var nextState = state; | ||
if (type === UpdateFormValue.type || type === UpdateForm.type) { | ||
nextState = store.setValue(nextState, event.payload.path + ".model", Object.assign({}, event.payload.value)); | ||
} | ||
if (type === UpdateFormStatus.type || type === UpdateForm.type) { | ||
nextState = store.setValue(nextState, event.payload.path + ".status", event.payload.status); | ||
} | ||
if (type === UpdateFormErrors.type || type === UpdateForm.type) { | ||
nextState = store.setValue(nextState, event.payload.path + ".errors", Object.assign({}, event.payload.errors)); | ||
} | ||
if (type === UpdateFormDirty.type || type === UpdateForm.type) { | ||
nextState = store.setValue(nextState, event.payload.path + ".dirty", event.payload.dirty); | ||
} | ||
if (type === SetFormDirty.type) { | ||
nextState = store.setValue(nextState, event.payload + ".dirty", true); | ||
} | ||
if (type === SetFormPristine.type) { | ||
nextState = store.setValue(nextState, event.payload + ".dirty", false); | ||
} | ||
if (type === SetFormDisabled.type) { | ||
nextState = store.setValue(nextState, event.payload + ".disabled", true); | ||
} | ||
if (type === SetFormEnabled.type) { | ||
nextState = store.setValue(nextState, event.payload + ".disabled", false); | ||
} | ||
return next(nextState, event); | ||
}; | ||
return NgxsFormPlugin; | ||
}()); | ||
NgxsFormPlugin.decorators = [ | ||
{ type: core.Injectable }, | ||
]; | ||
NgxsFormPlugin.ctorParameters = function () { return []; }; | ||
var FormDirective = /** @class */ (function () { | ||
@@ -113,0 +113,0 @@ function FormDirective(_store, _formGroupDirective, _cd) { |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@ngxs/store"),require("@angular/forms"),require("rxjs/Subject"),require("rxjs/operators/takeUntil"),require("rxjs/operators/debounceTime")):"function"==typeof define&&define.amd?define("@ngxs/form-plugin",["exports","@angular/core","@ngxs/store","@angular/forms","rxjs/Subject","rxjs/operators/takeUntil","rxjs/operators/debounceTime"],t):t((e.ngxs=e.ngxs||{},e.ngxs["form-plugin"]={}),e.ng.core,e["ngxs-store"],e.ng.forms,e.Rx,e.Rx.Observable.prototype,e.Rx.Observable.prototype)}(this,function(e,t,s,r,o,a,i){"use strict";var n=function(){function e(){}return e.prototype.handle=function(e,t,r){var o=s.getActionTypeFromInstance(t),a=e;return"UpdateFormValue"!==o&&"UpdateForm"!==o||(a=s.setValue(a,t.payload.path+".model",Object.assign({},t.payload.value))),"UpdateFormStatus"!==o&&"UpdateForm"!==o||(a=s.setValue(a,t.payload.path+".status",t.payload.status)),"UpdateFormErrors"!==o&&"UpdateForm"!==o||(a=s.setValue(a,t.payload.path+".errors",Object.assign({},t.payload.errors))),"UpdateFormDirty"!==o&&"UpdateForm"!==o||(a=s.setValue(a,t.payload.path+".dirty",t.payload.dirty)),"SetFormDirty"===o&&(a=s.setValue(a,t.payload+".dirty",!0)),"SetFormPrestine"===o&&(a=s.setValue(a,t.payload+".dirty",!1)),"SetFormDisabled"===o&&(a=s.setValue(a,t.payload+".disabled",!0)),"SetFormEnabled"===o&&(a=s.setValue(a,t.payload+".disabled",!1)),r(a,t)},e}();n.decorators=[{type:t.Injectable}],n.ctorParameters=function(){return[]};var p=function(e){this.payload=e};p.type="[Forms] Update Status";var u=function(e){this.payload=e};u.type="[Forms] Update Form Value";var d=function(e){this.payload=e};d.type="[Forms] Update Form";var c=function(e){this.payload=e};c.type="[Forms] Update Form Dirty";var l=function(e){this.payload=e};l.type="[Forms] Set Form Dirty";var m=function(e){this.payload=e};m.type="[Forms] Set Form Prestine";var y=function(e){this.payload=e};y.type="[Forms] Update Form Errors";var f=function(e){this.payload=e};f.type="[Forms] Set Form Disabled";var h=function(e){this.payload=e};h.type="[Forms] Set Form Enabled";var F=function(){function e(e,t,r){this._store=e,this._formGroupDirective=t,this._cd=r,this.debounce=100,this._destroy$=new o.Subject}return e.prototype.ngOnInit=function(){var t=this;this._store.select(function(e){return s.getValue(e,t.path+".model")}).pipe(a.takeUntil(this._destroy$)).subscribe(function(e){e&&(t._formGroupDirective.form.patchValue(e),t._cd.markForCheck())}),this._store.select(function(e){return s.getValue(e,t.path+".dirty")}).pipe(a.takeUntil(this._destroy$)).subscribe(function(e){t._formGroupDirective.form.dirty!==e&&(!0===e?(t._formGroupDirective.form.markAsDirty(),t._cd.markForCheck()):!1===e&&(t._formGroupDirective.form.markAsPristine(),t._cd.markForCheck()))}),this._store.select(function(e){return s.getValue(e,t.path+".disabled")}).pipe(a.takeUntil(this._destroy$)).subscribe(function(e){t._formGroupDirective.form.disabled!==e&&(!0===e?(t._formGroupDirective.form.disable(),t._cd.markForCheck()):!1===e&&(t._formGroupDirective.form.enable(),t._cd.markForCheck()))}),this._formGroupDirective.valueChanges.pipe(i.debounceTime(this.debounce),a.takeUntil(this._destroy$)).subscribe(function(e){t._store.dispatch([new u({path:t.path,value:e}),new c({path:t.path,dirty:t._formGroupDirective.dirty}),new y({path:t.path,errors:t._formGroupDirective.errors})])}),this._formGroupDirective.statusChanges.pipe(i.debounceTime(this.debounce),a.takeUntil(this._destroy$)).subscribe(function(e){t._store.dispatch(new p({status:e,path:t.path}))})},e.prototype.ngOnDestroy=function(){this._destroy$.next(),this._destroy$.complete(),this.clearDestroy&&this._store.dispatch(new d({path:this.path,value:null,dirty:null,status:null,errors:null}))},e}();F.decorators=[{type:t.Directive,args:[{selector:"[ngxsForm]"}]}],F.ctorParameters=function(){return[{type:s.Store},{type:r.FormGroupDirective},{type:t.ChangeDetectorRef}]},F.propDecorators={path:[{type:t.Input,args:["ngxsForm"]}],debounce:[{type:t.Input,args:["ngxsFormDebounce"]}],clearDestroy:[{type:t.Input,args:["ngxsFormClearOnDestroy"]}]};var b=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[{provide:s.NGXS_PLUGINS,useClass:n,multi:!0}]}},e}();b.decorators=[{type:t.NgModule,args:[{imports:[r.ReactiveFormsModule],declarations:[F],exports:[F]}]}],b.ctorParameters=function(){return[]},e.NgxsFormPluginModule=b,e.NgxsFormPlugin=n,e.UpdateFormStatus=p,e.UpdateFormValue=u,e.UpdateForm=d,e.UpdateFormDirty=c,e.SetFormDirty=l,e.SetFormPristine=m,e.UpdateFormErrors=y,e.SetFormDisabled=f,e.SetFormEnabled=h,e.ɵa=F,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@ngxs/store"),require("@angular/forms"),require("rxjs/Subject"),require("rxjs/operators/takeUntil"),require("rxjs/operators/debounceTime")):"function"==typeof define&&define.amd?define("@ngxs/form-plugin",["exports","@angular/core","@ngxs/store","@angular/forms","rxjs/Subject","rxjs/operators/takeUntil","rxjs/operators/debounceTime"],t):t((e.ngxs=e.ngxs||{},e.ngxs["form-plugin"]={}),e.ng.core,e["ngxs-store"],e.ng.forms,e.Rx,e.Rx.Observable.prototype,e.Rx.Observable.prototype)}(this,function(e,t,s,r,o,a,i){"use strict";var n=function(e){this.payload=e};n.type="[Forms] Update Form Status";var p=function(e){this.payload=e};p.type="[Forms] Update Form Value";var u=function(e){this.payload=e};u.type="[Forms] Update Form";var c=function(e){this.payload=e};c.type="[Forms] Update Form Dirty";var d=function(e){this.payload=e};d.type="[Forms] Set Form Dirty";var l=function(e){this.payload=e};l.type="[Forms] Set Form Pristine";var y=function(e){this.payload=e};y.type="[Forms] Update Form Errors";var m=function(e){this.payload=e};m.type="[Forms] Set Form Disabled";var f=function(e){this.payload=e};f.type="[Forms] Set Form Enabled";var h=function(){function e(){}return e.prototype.handle=function(e,t,r){var o=s.getActionTypeFromInstance(t),a=e;return o!==p.type&&o!==u.type||(a=s.setValue(a,t.payload.path+".model",Object.assign({},t.payload.value))),o!==n.type&&o!==u.type||(a=s.setValue(a,t.payload.path+".status",t.payload.status)),o!==y.type&&o!==u.type||(a=s.setValue(a,t.payload.path+".errors",Object.assign({},t.payload.errors))),o!==c.type&&o!==u.type||(a=s.setValue(a,t.payload.path+".dirty",t.payload.dirty)),o===d.type&&(a=s.setValue(a,t.payload+".dirty",!0)),o===l.type&&(a=s.setValue(a,t.payload+".dirty",!1)),o===m.type&&(a=s.setValue(a,t.payload+".disabled",!0)),o===f.type&&(a=s.setValue(a,t.payload+".disabled",!1)),r(a,t)},e}();h.decorators=[{type:t.Injectable}],h.ctorParameters=function(){return[]};var b=function(){function e(e,t,r){this._store=e,this._formGroupDirective=t,this._cd=r,this.debounce=100,this._destroy$=new o.Subject}return e.prototype.ngOnInit=function(){var t=this;this._store.select(function(e){return s.getValue(e,t.path+".model")}).pipe(a.takeUntil(this._destroy$)).subscribe(function(e){e&&(t._formGroupDirective.form.patchValue(e),t._cd.markForCheck())}),this._store.select(function(e){return s.getValue(e,t.path+".dirty")}).pipe(a.takeUntil(this._destroy$)).subscribe(function(e){t._formGroupDirective.form.dirty!==e&&(!0===e?(t._formGroupDirective.form.markAsDirty(),t._cd.markForCheck()):!1===e&&(t._formGroupDirective.form.markAsPristine(),t._cd.markForCheck()))}),this._store.select(function(e){return s.getValue(e,t.path+".disabled")}).pipe(a.takeUntil(this._destroy$)).subscribe(function(e){t._formGroupDirective.form.disabled!==e&&(!0===e?(t._formGroupDirective.form.disable(),t._cd.markForCheck()):!1===e&&(t._formGroupDirective.form.enable(),t._cd.markForCheck()))}),this._formGroupDirective.valueChanges.pipe(i.debounceTime(this.debounce),a.takeUntil(this._destroy$)).subscribe(function(e){t._store.dispatch([new p({path:t.path,value:e}),new c({path:t.path,dirty:t._formGroupDirective.dirty}),new y({path:t.path,errors:t._formGroupDirective.errors})])}),this._formGroupDirective.statusChanges.pipe(i.debounceTime(this.debounce),a.takeUntil(this._destroy$)).subscribe(function(e){t._store.dispatch(new n({status:e,path:t.path}))})},e.prototype.ngOnDestroy=function(){this._destroy$.next(),this._destroy$.complete(),this.clearDestroy&&this._store.dispatch(new u({path:this.path,value:null,dirty:null,status:null,errors:null}))},e}();b.decorators=[{type:t.Directive,args:[{selector:"[ngxsForm]"}]}],b.ctorParameters=function(){return[{type:s.Store},{type:r.FormGroupDirective},{type:t.ChangeDetectorRef}]},b.propDecorators={path:[{type:t.Input,args:["ngxsForm"]}],debounce:[{type:t.Input,args:["ngxsFormDebounce"]}],clearDestroy:[{type:t.Input,args:["ngxsFormClearOnDestroy"]}]};var g=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[{provide:s.NGXS_PLUGINS,useClass:h,multi:!0}]}},e}();g.decorators=[{type:t.NgModule,args:[{imports:[r.ReactiveFormsModule],declarations:[b],exports:[b]}]}],g.ctorParameters=function(){return[]},e.NgxsFormPluginModule=g,e.NgxsFormPlugin=h,e.UpdateFormStatus=n,e.UpdateFormValue=p,e.UpdateForm=u,e.UpdateFormDirty=c,e.SetFormDirty=d,e.SetFormPristine=l,e.UpdateFormErrors=y,e.SetFormDisabled=m,e.SetFormEnabled=f,e.ɵa=b,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ngxs-form-plugin.umd.min.js.map |
@@ -12,50 +12,2 @@ import { Injectable, Directive, Input, ChangeDetectorRef, NgModule } from '@angular/core'; | ||
*/ | ||
class NgxsFormPlugin { | ||
constructor() { } | ||
/** | ||
* @param {?} state | ||
* @param {?} event | ||
* @param {?} next | ||
* @return {?} | ||
*/ | ||
handle(state, event, next) { | ||
const /** @type {?} */ type = getActionTypeFromInstance(event); | ||
let /** @type {?} */ nextState = state; | ||
if (type === 'UpdateFormValue' || type === 'UpdateForm') { | ||
nextState = setValue(nextState, `${event.payload.path}.model`, Object.assign({}, event.payload.value)); | ||
} | ||
if (type === 'UpdateFormStatus' || type === 'UpdateForm') { | ||
nextState = setValue(nextState, `${event.payload.path}.status`, event.payload.status); | ||
} | ||
if (type === 'UpdateFormErrors' || type === 'UpdateForm') { | ||
nextState = setValue(nextState, `${event.payload.path}.errors`, Object.assign({}, event.payload.errors)); | ||
} | ||
if (type === 'UpdateFormDirty' || type === 'UpdateForm') { | ||
nextState = setValue(nextState, `${event.payload.path}.dirty`, event.payload.dirty); | ||
} | ||
if (type === 'SetFormDirty') { | ||
nextState = setValue(nextState, `${event.payload}.dirty`, true); | ||
} | ||
if (type === 'SetFormPrestine') { | ||
nextState = setValue(nextState, `${event.payload}.dirty`, false); | ||
} | ||
if (type === 'SetFormDisabled') { | ||
nextState = setValue(nextState, `${event.payload}.disabled`, true); | ||
} | ||
if (type === 'SetFormEnabled') { | ||
nextState = setValue(nextState, `${event.payload}.disabled`, false); | ||
} | ||
return next(nextState, event); | ||
} | ||
} | ||
NgxsFormPlugin.decorators = [ | ||
{ type: Injectable }, | ||
]; | ||
/** @nocollapse */ | ||
NgxsFormPlugin.ctorParameters = () => []; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
class UpdateFormStatus { | ||
@@ -69,3 +21,3 @@ /** | ||
} | ||
UpdateFormStatus.type = '[Forms] Update Status'; | ||
UpdateFormStatus.type = '[Forms] Update Form Status'; | ||
class UpdateFormValue { | ||
@@ -115,3 +67,3 @@ /** | ||
} | ||
SetFormPristine.type = '[Forms] Set Form Prestine'; | ||
SetFormPristine.type = '[Forms] Set Form Pristine'; | ||
class UpdateFormErrors { | ||
@@ -149,2 +101,50 @@ /** | ||
*/ | ||
class NgxsFormPlugin { | ||
constructor() { } | ||
/** | ||
* @param {?} state | ||
* @param {?} event | ||
* @param {?} next | ||
* @return {?} | ||
*/ | ||
handle(state, event, next) { | ||
const /** @type {?} */ type = getActionTypeFromInstance(event); | ||
let /** @type {?} */ nextState = state; | ||
if (type === UpdateFormValue.type || type === UpdateForm.type) { | ||
nextState = setValue(nextState, `${event.payload.path}.model`, Object.assign({}, event.payload.value)); | ||
} | ||
if (type === UpdateFormStatus.type || type === UpdateForm.type) { | ||
nextState = setValue(nextState, `${event.payload.path}.status`, event.payload.status); | ||
} | ||
if (type === UpdateFormErrors.type || type === UpdateForm.type) { | ||
nextState = setValue(nextState, `${event.payload.path}.errors`, Object.assign({}, event.payload.errors)); | ||
} | ||
if (type === UpdateFormDirty.type || type === UpdateForm.type) { | ||
nextState = setValue(nextState, `${event.payload.path}.dirty`, event.payload.dirty); | ||
} | ||
if (type === SetFormDirty.type) { | ||
nextState = setValue(nextState, `${event.payload}.dirty`, true); | ||
} | ||
if (type === SetFormPristine.type) { | ||
nextState = setValue(nextState, `${event.payload}.dirty`, false); | ||
} | ||
if (type === SetFormDisabled.type) { | ||
nextState = setValue(nextState, `${event.payload}.disabled`, true); | ||
} | ||
if (type === SetFormEnabled.type) { | ||
nextState = setValue(nextState, `${event.payload}.disabled`, false); | ||
} | ||
return next(nextState, event); | ||
} | ||
} | ||
NgxsFormPlugin.decorators = [ | ||
{ type: Injectable }, | ||
]; | ||
/** @nocollapse */ | ||
NgxsFormPlugin.ctorParameters = () => []; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
class FormDirective { | ||
@@ -151,0 +151,0 @@ /** |
@@ -8,40 +8,2 @@ import { Injectable, Directive, Input, ChangeDetectorRef, NgModule } from '@angular/core'; | ||
var NgxsFormPlugin = /** @class */ (function () { | ||
function NgxsFormPlugin() { | ||
} | ||
NgxsFormPlugin.prototype.handle = function (state, event, next) { | ||
var type = getActionTypeFromInstance(event); | ||
var nextState = state; | ||
if (type === 'UpdateFormValue' || type === 'UpdateForm') { | ||
nextState = setValue(nextState, event.payload.path + ".model", Object.assign({}, event.payload.value)); | ||
} | ||
if (type === 'UpdateFormStatus' || type === 'UpdateForm') { | ||
nextState = setValue(nextState, event.payload.path + ".status", event.payload.status); | ||
} | ||
if (type === 'UpdateFormErrors' || type === 'UpdateForm') { | ||
nextState = setValue(nextState, event.payload.path + ".errors", Object.assign({}, event.payload.errors)); | ||
} | ||
if (type === 'UpdateFormDirty' || type === 'UpdateForm') { | ||
nextState = setValue(nextState, event.payload.path + ".dirty", event.payload.dirty); | ||
} | ||
if (type === 'SetFormDirty') { | ||
nextState = setValue(nextState, event.payload + ".dirty", true); | ||
} | ||
if (type === 'SetFormPrestine') { | ||
nextState = setValue(nextState, event.payload + ".dirty", false); | ||
} | ||
if (type === 'SetFormDisabled') { | ||
nextState = setValue(nextState, event.payload + ".disabled", true); | ||
} | ||
if (type === 'SetFormEnabled') { | ||
nextState = setValue(nextState, event.payload + ".disabled", false); | ||
} | ||
return next(nextState, event); | ||
}; | ||
return NgxsFormPlugin; | ||
}()); | ||
NgxsFormPlugin.decorators = [ | ||
{ type: Injectable }, | ||
]; | ||
NgxsFormPlugin.ctorParameters = function () { return []; }; | ||
var UpdateFormStatus = /** @class */ (function () { | ||
@@ -53,3 +15,3 @@ function UpdateFormStatus(payload) { | ||
}()); | ||
UpdateFormStatus.type = '[Forms] Update Status'; | ||
UpdateFormStatus.type = '[Forms] Update Form Status'; | ||
var UpdateFormValue = /** @class */ (function () { | ||
@@ -89,3 +51,3 @@ function UpdateFormValue(payload) { | ||
}()); | ||
SetFormPristine.type = '[Forms] Set Form Prestine'; | ||
SetFormPristine.type = '[Forms] Set Form Pristine'; | ||
var UpdateFormErrors = /** @class */ (function () { | ||
@@ -112,2 +74,40 @@ function UpdateFormErrors(payload) { | ||
SetFormEnabled.type = '[Forms] Set Form Enabled'; | ||
var NgxsFormPlugin = /** @class */ (function () { | ||
function NgxsFormPlugin() { | ||
} | ||
NgxsFormPlugin.prototype.handle = function (state, event, next) { | ||
var type = getActionTypeFromInstance(event); | ||
var nextState = state; | ||
if (type === UpdateFormValue.type || type === UpdateForm.type) { | ||
nextState = setValue(nextState, event.payload.path + ".model", Object.assign({}, event.payload.value)); | ||
} | ||
if (type === UpdateFormStatus.type || type === UpdateForm.type) { | ||
nextState = setValue(nextState, event.payload.path + ".status", event.payload.status); | ||
} | ||
if (type === UpdateFormErrors.type || type === UpdateForm.type) { | ||
nextState = setValue(nextState, event.payload.path + ".errors", Object.assign({}, event.payload.errors)); | ||
} | ||
if (type === UpdateFormDirty.type || type === UpdateForm.type) { | ||
nextState = setValue(nextState, event.payload.path + ".dirty", event.payload.dirty); | ||
} | ||
if (type === SetFormDirty.type) { | ||
nextState = setValue(nextState, event.payload + ".dirty", true); | ||
} | ||
if (type === SetFormPristine.type) { | ||
nextState = setValue(nextState, event.payload + ".dirty", false); | ||
} | ||
if (type === SetFormDisabled.type) { | ||
nextState = setValue(nextState, event.payload + ".disabled", true); | ||
} | ||
if (type === SetFormEnabled.type) { | ||
nextState = setValue(nextState, event.payload + ".disabled", false); | ||
} | ||
return next(nextState, event); | ||
}; | ||
return NgxsFormPlugin; | ||
}()); | ||
NgxsFormPlugin.decorators = [ | ||
{ type: Injectable }, | ||
]; | ||
NgxsFormPlugin.ctorParameters = function () { return []; }; | ||
var FormDirective = /** @class */ (function () { | ||
@@ -114,0 +114,0 @@ function FormDirective(_store, _formGroupDirective, _cd) { |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":4,"metadata":{"NgxsFormPluginModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":6,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/forms","name":"ReactiveFormsModule","line":7,"character":12}],"declarations":[{"__symbolic":"reference","name":"ɵa"}],"exports":[{"__symbolic":"reference","name":"ɵa"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"NgxsFormPluginModule"},"providers":[{"provide":{"__symbolic":"reference","module":"@ngxs/store","name":"NGXS_PLUGINS","line":17,"character":19},"useClass":{"__symbolic":"reference","name":"NgxsFormPlugin"},"multi":true}]}}}},"NgxsFormPlugin":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":3,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"handle":[{"__symbolic":"method"}]}},"UpdateFormStatus":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":2,"character":30,"module":"./src/actions"}]}]},"statics":{"type":"[Forms] Update Status"}},"UpdateFormValue":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":7,"character":30,"module":"./src/actions"}]}]},"statics":{"type":"[Forms] Update Form Value"}},"UpdateForm":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":13,"character":20,"module":"./src/actions"}]}]},"statics":{"type":"[Forms] Update Form"}},"UpdateFormDirty":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":25,"character":30,"module":"./src/actions"}]}]},"statics":{"type":"[Forms] Update Form Dirty"}},"SetFormDirty":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"}]}]},"statics":{"type":"[Forms] Set Form Dirty"}},"SetFormPristine":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"}]}]},"statics":{"type":"[Forms] Set Form Prestine"}},"UpdateFormErrors":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":40,"character":30,"module":"./src/actions"}]}]},"statics":{"type":"[Forms] Update Form Errors"}},"SetFormDisabled":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"}]}]},"statics":{"type":"[Forms] Set Form Disabled"}},"SetFormEnabled":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"}]}]},"statics":{"type":"[Forms] Set Form Enabled"}},"ɵa":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":8,"character":1},"arguments":[{"selector":"[ngxsForm]"}]}],"members":{"path":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":10,"character":3},"arguments":["ngxsForm"]}]}],"debounce":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":11,"character":3},"arguments":["ngxsFormDebounce"]}]}],"clearDestroy":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":12,"character":3},"arguments":["ngxsFormClearOnDestroy"]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@ngxs/store","name":"Store","line":16,"character":30},{"__symbolic":"reference","module":"@angular/forms","name":"FormGroupDirective","line":16,"character":66},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":16,"character":99}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}}},"origins":{"NgxsFormPluginModule":"./src/form.module","NgxsFormPlugin":"./src/form.plugin","UpdateFormStatus":"./src/actions","UpdateFormValue":"./src/actions","UpdateForm":"./src/actions","UpdateFormDirty":"./src/actions","SetFormDirty":"./src/actions","SetFormPristine":"./src/actions","UpdateFormErrors":"./src/actions","SetFormDisabled":"./src/actions","SetFormEnabled":"./src/actions","ɵa":"./src/directive"},"importAs":"@ngxs/form-plugin"} | ||
{"__symbolic":"module","version":4,"metadata":{"NgxsFormPluginModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":6,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/forms","name":"ReactiveFormsModule","line":7,"character":12}],"declarations":[{"__symbolic":"reference","name":"ɵa"}],"exports":[{"__symbolic":"reference","name":"ɵa"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"NgxsFormPluginModule"},"providers":[{"provide":{"__symbolic":"reference","module":"@ngxs/store","name":"NGXS_PLUGINS","line":17,"character":19},"useClass":{"__symbolic":"reference","name":"NgxsFormPlugin"},"multi":true}]}}}},"NgxsFormPlugin":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":6,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"handle":[{"__symbolic":"method"}]}},"UpdateFormStatus":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":2,"character":30,"module":"./src/actions"}]}]},"statics":{"type":"[Forms] Update Form Status"}},"UpdateFormValue":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":7,"character":30,"module":"./src/actions"}]}]},"statics":{"type":"[Forms] Update Form Value"}},"UpdateForm":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":13,"character":20,"module":"./src/actions"}]}]},"statics":{"type":"[Forms] Update Form"}},"UpdateFormDirty":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":25,"character":30,"module":"./src/actions"}]}]},"statics":{"type":"[Forms] Update Form Dirty"}},"SetFormDirty":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"}]}]},"statics":{"type":"[Forms] Set Form Dirty"}},"SetFormPristine":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"}]}]},"statics":{"type":"[Forms] Set Form Pristine"}},"UpdateFormErrors":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":40,"character":30,"module":"./src/actions"}]}]},"statics":{"type":"[Forms] Update Form Errors"}},"SetFormDisabled":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"}]}]},"statics":{"type":"[Forms] Set Form Disabled"}},"SetFormEnabled":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"}]}]},"statics":{"type":"[Forms] Set Form Enabled"}},"ɵa":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":8,"character":1},"arguments":[{"selector":"[ngxsForm]"}]}],"members":{"path":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":10,"character":3},"arguments":["ngxsForm"]}]}],"debounce":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":11,"character":3},"arguments":["ngxsFormDebounce"]}]}],"clearDestroy":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":12,"character":3},"arguments":["ngxsFormClearOnDestroy"]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@ngxs/store","name":"Store","line":16,"character":30},{"__symbolic":"reference","module":"@angular/forms","name":"FormGroupDirective","line":16,"character":66},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":16,"character":99}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}}},"origins":{"NgxsFormPluginModule":"./src/form.module","NgxsFormPlugin":"./src/form.plugin","UpdateFormStatus":"./src/actions","UpdateFormValue":"./src/actions","UpdateForm":"./src/actions","UpdateFormDirty":"./src/actions","SetFormDirty":"./src/actions","SetFormPristine":"./src/actions","UpdateFormErrors":"./src/actions","SetFormDisabled":"./src/actions","SetFormEnabled":"./src/actions","ɵa":"./src/directive"},"importAs":"@ngxs/form-plugin"} |
{ | ||
"name": "@ngxs/form-plugin", | ||
"description": "form plugin for @ngxs/store", | ||
"version": "2.1.0-dev.7ce8703", | ||
"version": "2.1.0-dev.81940e8", | ||
"peerDependencies": { | ||
@@ -6,0 +6,0 @@ "@angular/core": "^5.0.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
97553
927