Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ngxs/form-plugin

Package Overview
Dependencies
Maintainers
2
Versions
1187
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ngxs/form-plugin - npm Package Compare versions

Comparing version 2.1.0-dev.35f3e14 to 2.1.0-dev.36f3c1c

85

bundles/ngxs-form-plugin.umd.js

@@ -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,2 +14,3 @@ function UpdateFormStatus(payload) {

}());
UpdateFormStatus.type = '[Forms] Update Form Status';
var UpdateFormValue = /** @class */ (function () {

@@ -59,2 +22,3 @@ function UpdateFormValue(payload) {

}());
UpdateFormValue.type = '[Forms] Update Form Value';
var UpdateForm = /** @class */ (function () {

@@ -66,2 +30,3 @@ function UpdateForm(payload) {

}());
UpdateForm.type = '[Forms] Update Form';
var UpdateFormDirty = /** @class */ (function () {

@@ -73,2 +38,3 @@ function UpdateFormDirty(payload) {

}());
UpdateFormDirty.type = '[Forms] Update Form Dirty';
var SetFormDirty = /** @class */ (function () {

@@ -80,2 +46,3 @@ function SetFormDirty(payload) {

}());
SetFormDirty.type = '[Forms] Set Form Dirty';
var SetFormPristine = /** @class */ (function () {

@@ -87,2 +54,3 @@ function SetFormPristine(payload) {

}());
SetFormPristine.type = '[Forms] Set Form Pristine';
var UpdateFormErrors = /** @class */ (function () {

@@ -94,2 +62,3 @@ function UpdateFormErrors(payload) {

}());
UpdateFormErrors.type = '[Forms] Update Form Errors';
var SetFormDisabled = /** @class */ (function () {

@@ -101,2 +70,3 @@ function SetFormDisabled(payload) {

}());
SetFormDisabled.type = '[Forms] Set Form Disabled';
var SetFormEnabled = /** @class */ (function () {

@@ -108,2 +78,41 @@ function SetFormEnabled(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 () {

@@ -110,0 +119,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 u=function(e){this.payload=e},p=function(e){this.payload=e},c=function(e){this.payload=e},d=function(e){this.payload=e},l=function(e){this.payload=e},m=function(e){this.payload=e},f=function(e){this.payload=e},y=function(e){this.payload=e},h=function(e){this.payload=e},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 d({path:t.path,dirty:t._formGroupDirective.dirty}),new f({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 u({status:e,path:t.path}))})},e.prototype.ngOnDestroy=function(){this._destroy$.next(),this._destroy$.complete(),this.clearDestroy&&this._store.dispatch(new c({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:n,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=n,e.UpdateFormStatus=u,e.UpdateFormValue=p,e.UpdateForm=c,e.UpdateFormDirty=d,e.SetFormDirty=l,e.SetFormPristine=m,e.UpdateFormErrors=f,e.SetFormDisabled=y,e.SetFormEnabled=h,e.ɵa=b,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,2 +21,3 @@ /**

}
UpdateFormStatus.type = '[Forms] Update Form Status';
class UpdateFormValue {

@@ -78,2 +31,3 @@ /**

}
UpdateFormValue.type = '[Forms] Update Form Value';
class UpdateForm {

@@ -87,2 +41,3 @@ /**

}
UpdateForm.type = '[Forms] Update Form';
class UpdateFormDirty {

@@ -96,2 +51,3 @@ /**

}
UpdateFormDirty.type = '[Forms] Update Form Dirty';
class SetFormDirty {

@@ -105,2 +61,3 @@ /**

}
SetFormDirty.type = '[Forms] Set Form Dirty';
class SetFormPristine {

@@ -114,2 +71,3 @@ /**

}
SetFormPristine.type = '[Forms] Set Form Pristine';
class UpdateFormErrors {

@@ -123,2 +81,3 @@ /**

}
UpdateFormErrors.type = '[Forms] Update Form Errors';
class SetFormDisabled {

@@ -132,2 +91,3 @@ /**

}
SetFormDisabled.type = '[Forms] Set Form Disabled';
class SetFormEnabled {

@@ -141,2 +101,3 @@ /**

}
SetFormEnabled.type = '[Forms] Set Form Enabled';

@@ -147,2 +108,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 {

@@ -149,0 +158,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,2 +15,3 @@ function UpdateFormStatus(payload) {

}());
UpdateFormStatus.type = '[Forms] Update Form Status';
var UpdateFormValue = /** @class */ (function () {

@@ -60,2 +23,3 @@ function UpdateFormValue(payload) {

}());
UpdateFormValue.type = '[Forms] Update Form Value';
var UpdateForm = /** @class */ (function () {

@@ -67,2 +31,3 @@ function UpdateForm(payload) {

}());
UpdateForm.type = '[Forms] Update Form';
var UpdateFormDirty = /** @class */ (function () {

@@ -74,2 +39,3 @@ function UpdateFormDirty(payload) {

}());
UpdateFormDirty.type = '[Forms] Update Form Dirty';
var SetFormDirty = /** @class */ (function () {

@@ -81,2 +47,3 @@ function SetFormDirty(payload) {

}());
SetFormDirty.type = '[Forms] Set Form Dirty';
var SetFormPristine = /** @class */ (function () {

@@ -88,2 +55,3 @@ function SetFormPristine(payload) {

}());
SetFormPristine.type = '[Forms] Set Form Pristine';
var UpdateFormErrors = /** @class */ (function () {

@@ -95,2 +63,3 @@ function UpdateFormErrors(payload) {

}());
UpdateFormErrors.type = '[Forms] Update Form Errors';
var SetFormDisabled = /** @class */ (function () {

@@ -102,2 +71,3 @@ function SetFormDisabled(payload) {

}());
SetFormDisabled.type = '[Forms] Set Form Disabled';
var SetFormEnabled = /** @class */ (function () {

@@ -109,2 +79,41 @@ function SetFormEnabled(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 () {

@@ -111,0 +120,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":1,"character":30,"module":"./src/actions"}]}]}},"UpdateFormValue":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":5,"character":30,"module":"./src/actions"}]}]}},"UpdateForm":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":10,"character":20,"module":"./src/actions"}]}]}},"UpdateFormDirty":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":21,"character":30,"module":"./src/actions"}]}]}},"SetFormDirty":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"}]}]}},"SetFormPristine":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"}]}]}},"UpdateFormErrors":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":33,"character":30,"module":"./src/actions"}]}]}},"SetFormDisabled":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"}]}]}},"SetFormEnabled":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"}]}]}},"ɵ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.35f3e14",
"version": "2.1.0-dev.36f3c1c",
"peerDependencies": {
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@ngxs/store": "2.1.0-beta.7"
"@ngxs/store": "2.1.0-beta.9"
},

@@ -10,0 +10,0 @@ "main": "bundles/ngxs-form-plugin.umd.js",

@@ -6,2 +6,3 @@ export declare class UpdateFormStatus {

};
static readonly type: string;
constructor(payload: {

@@ -17,2 +18,3 @@ status: string | null;

};
static readonly type: string;
constructor(payload: {

@@ -33,2 +35,3 @@ value: any;

};
static readonly type: string;
constructor(payload: {

@@ -49,2 +52,3 @@ value: any;

};
static readonly type: string;
constructor(payload: {

@@ -57,2 +61,3 @@ dirty: boolean | null;

payload: string;
static readonly type: string;
constructor(payload: string);

@@ -62,2 +67,3 @@ }

payload: string;
static readonly type: string;
constructor(payload: string);

@@ -72,2 +78,3 @@ }

};
static readonly type: string;
constructor(payload: {

@@ -82,2 +89,3 @@ errors: {

payload: string;
static readonly type: string;
constructor(payload: string);

@@ -87,3 +95,4 @@ }

payload: string;
static readonly type: string;
constructor(payload: string);
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc