@ngxs/form-plugin 3.7.6-dev.master-1bdb8c0 → 3.7.6-dev.master-dcdd391
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/bundles/ngxs-form-plugin.umd.js +134 -590
- package/bundles/ngxs-form-plugin.umd.js.map +1 -1
- package/esm2015/index.js +2 -6
- package/esm2015/ngxs-form-plugin.js +2 -7
- package/esm2015/src/actions.js +1 -105
- package/esm2015/src/directive.js +45 -180
- package/esm2015/src/form.module.js +13 -15
- package/esm2015/src/form.plugin.js +7 -29
- package/esm2015/src/public_api.js +3 -6
- package/fesm2015/ngxs-form-plugin.js +67 -339
- package/fesm2015/ngxs-form-plugin.js.map +1 -1
- package/ngxs-form-plugin.d.ts +1 -1
- package/package.json +3 -6
- package/src/actions.d.ts +10 -10
- package/src/directive.d.ts +6 -2
- package/src/form.module.d.ts +6 -0
- package/src/form.plugin.d.ts +3 -0
- package/src/public_api.d.ts +1 -0
- package/bundles/ngxs-form-plugin.umd.min.js +0 -16
- package/bundles/ngxs-form-plugin.umd.min.js.map +0 -1
- package/esm5/index.js +0 -9
- package/esm5/ngxs-form-plugin.js +0 -10
- package/esm5/src/actions.js +0 -225
- package/esm5/src/directive.js +0 -335
- package/esm5/src/form.module.js +0 -41
- package/esm5/src/form.plugin.js +0 -100
- package/esm5/src/public_api.js +0 -8
- package/fesm5/ngxs-form-plugin.js +0 -697
- package/fesm5/ngxs-form-plugin.js.map +0 -1
- package/ngxs-form-plugin.metadata.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngxs-form-plugin.js","sources":["ng://@ngxs/form-plugin/src/actions.ts","ng://@ngxs/form-plugin/src/form.plugin.ts","ng://@ngxs/form-plugin/src/directive.ts","ng://@ngxs/form-plugin/src/form.module.ts"],"sourcesContent":["export class UpdateFormStatus {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Update Form Status';\n }\n constructor(\n public payload: {\n status: string | null;\n path: string;\n }\n ) {}\n}\n\nexport class UpdateFormValue {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Update Form Value';\n }\n constructor(public payload: { value: any; path: string; propertyPath?: string }) {}\n}\n\nexport class UpdateForm {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Update Form';\n }\n constructor(\n public payload: {\n value: any;\n errors: { [k: string]: string } | null;\n dirty: boolean | null;\n status: string | null;\n path: string;\n }\n ) {}\n}\n\nexport class UpdateFormDirty {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Update Form Dirty';\n }\n constructor(public payload: { dirty: boolean | null; path: string }) {}\n}\n\nexport class SetFormDirty {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Set Form Dirty';\n }\n constructor(public payload: string) {}\n}\n\nexport class SetFormPristine {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Set Form Pristine';\n }\n constructor(public payload: string) {}\n}\n\nexport class UpdateFormErrors {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Update Form Errors';\n }\n constructor(public payload: { errors: { [k: string]: string } | null; path: string }) {}\n}\n\nexport class SetFormDisabled {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Set Form Disabled';\n }\n constructor(public payload: string) {}\n}\n\nexport class SetFormEnabled {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Set Form Enabled';\n }\n constructor(public payload: string) {}\n}\n\nexport class ResetForm {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Reset Form';\n }\n constructor(public payload: { path: string; value?: any }) {}\n}\n","import { Injectable } from '@angular/core';\nimport {\n getActionTypeFromInstance,\n getValue,\n NgxsNextPluginFn,\n NgxsPlugin,\n setValue\n} from '@ngxs/store';\nimport {\n ResetForm,\n SetFormDirty,\n SetFormDisabled,\n SetFormEnabled,\n SetFormPristine,\n UpdateForm,\n UpdateFormDirty,\n UpdateFormErrors,\n UpdateFormStatus,\n UpdateFormValue\n} from './actions';\n\n@Injectable()\nexport class NgxsFormPlugin implements NgxsPlugin {\n handle(state: any, event: any, next: NgxsNextPluginFn) {\n const type = getActionTypeFromInstance(event);\n\n let nextState = state;\n\n if (type === UpdateFormValue.type || type === UpdateForm.type || type === ResetForm.type) {\n const { value } = event.payload;\n const payloadValue = Array.isArray(value)\n ? value.slice()\n : isObjectLike(value)\n ? { ...value }\n : value;\n const path = this.joinPathWithPropertyPath(event);\n nextState = setValue(nextState, path, payloadValue);\n }\n\n if (type === ResetForm.type) {\n const model = getValue(nextState, `${event.payload.path}.model`);\n nextState = setValue(nextState, `${event.payload.path}`, { model: model });\n }\n\n if (type === UpdateFormStatus.type || type === UpdateForm.type) {\n nextState = setValue(nextState, `${event.payload.path}.status`, event.payload.status);\n }\n\n if (type === UpdateFormErrors.type || type === UpdateForm.type) {\n nextState = setValue(nextState, `${event.payload.path}.errors`, {\n ...event.payload.errors\n });\n }\n\n if (type === UpdateFormDirty.type || type === UpdateForm.type) {\n nextState = setValue(nextState, `${event.payload.path}.dirty`, event.payload.dirty);\n }\n\n if (type === SetFormDirty.type) {\n nextState = setValue(nextState, `${event.payload}.dirty`, true);\n }\n\n if (type === SetFormPristine.type) {\n nextState = setValue(nextState, `${event.payload}.dirty`, false);\n }\n\n if (type === SetFormDisabled.type) {\n nextState = setValue(nextState, `${event.payload}.disabled`, true);\n }\n\n if (type === SetFormEnabled.type) {\n nextState = setValue(nextState, `${event.payload}.disabled`, false);\n }\n\n return next(nextState, event);\n }\n\n private joinPathWithPropertyPath({ payload }: UpdateFormValue): string {\n let path = `${payload.path}.model`;\n\n if (payload.propertyPath) {\n path += `.${payload.propertyPath}`;\n }\n\n return path;\n }\n}\n\nfunction isObjectLike(target: unknown): target is object {\n return target !== null && typeof target === 'object';\n}\n","import { ChangeDetectorRef, Directive, Input, OnDestroy, OnInit } from '@angular/core';\nimport { FormGroup, FormGroupDirective } from '@angular/forms';\nimport { Actions, getValue, ofActionDispatched, Store } from '@ngxs/store';\nimport { Observable, Subject } from 'rxjs';\nimport { debounceTime, distinctUntilChanged, filter, takeUntil } from 'rxjs/operators';\nimport {\n ResetForm,\n UpdateForm,\n UpdateFormDirty,\n UpdateFormErrors,\n UpdateFormStatus,\n UpdateFormValue\n} from './actions';\n\n@Directive({ selector: '[ngxsForm]' })\nexport class FormDirective implements OnInit, OnDestroy {\n @Input('ngxsForm')\n path: string = null!;\n\n @Input('ngxsFormDebounce')\n debounce = 100;\n\n @Input('ngxsFormClearOnDestroy')\n set clearDestroy(val: boolean) {\n this._clearDestroy = val != null && `${val}` !== 'false';\n }\n\n get clearDestroy(): boolean {\n return this._clearDestroy;\n }\n\n _clearDestroy = false;\n\n private readonly _destroy$ = new Subject<void>();\n private _updating = false;\n\n constructor(\n private _actions$: Actions,\n private _store: Store,\n private _formGroupDirective: FormGroupDirective,\n private _cd: ChangeDetectorRef\n ) {}\n\n ngOnInit() {\n this._actions$\n .pipe(\n ofActionDispatched(ResetForm),\n filter((action: ResetForm) => action.payload.path === this.path),\n takeUntil(this._destroy$)\n )\n .subscribe(({ payload: { value } }: ResetForm) => {\n this.form.reset(value);\n this.updateFormStateWithRawValue(true);\n this._cd.markForCheck();\n });\n\n this.getStateStream(`${this.path}.model`).subscribe(model => {\n if (this._updating || !model) {\n return;\n }\n\n this.form.patchValue(model);\n this._cd.markForCheck();\n });\n\n this.getStateStream(`${this.path}.dirty`).subscribe(dirty => {\n if (this.form.dirty === dirty || typeof dirty !== 'boolean') {\n return;\n }\n\n if (dirty) {\n this.form.markAsDirty();\n } else {\n this.form.markAsPristine();\n }\n\n this._cd.markForCheck();\n });\n\n // On first state change, sync form model, status and dirty with state\n this._store\n .selectOnce(state => getValue(state, this.path))\n .subscribe(() => {\n this._store.dispatch([\n new UpdateFormValue({\n path: this.path,\n value: this.form.getRawValue()\n }),\n new UpdateFormStatus({\n path: this.path,\n status: this.form.status\n }),\n new UpdateFormDirty({\n path: this.path,\n dirty: this.form.dirty\n })\n ]);\n });\n\n this.getStateStream(`${this.path}.disabled`).subscribe(disabled => {\n if (this.form.disabled === disabled || typeof disabled !== 'boolean') {\n return;\n }\n\n if (disabled) {\n this.form.disable();\n } else {\n this.form.enable();\n }\n\n this._cd.markForCheck();\n });\n\n this._formGroupDirective\n .valueChanges!.pipe(\n distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)),\n this.debounceChange()\n )\n .subscribe(() => {\n this.updateFormStateWithRawValue();\n });\n\n this._formGroupDirective\n .statusChanges!.pipe(distinctUntilChanged(), this.debounceChange())\n .subscribe((status: string) => {\n this._store.dispatch(\n new UpdateFormStatus({\n status,\n path: this.path\n })\n );\n });\n }\n\n updateFormStateWithRawValue(withFormStatus?: boolean) {\n if (this._updating) return;\n\n const value = this._formGroupDirective.control.getRawValue();\n\n const actions: any[] = [\n new UpdateFormValue({\n path: this.path,\n value\n }),\n new UpdateFormDirty({\n path: this.path,\n dirty: this._formGroupDirective.dirty\n }),\n new UpdateFormErrors({\n path: this.path,\n errors: this._formGroupDirective.errors\n })\n ];\n\n if (withFormStatus) {\n actions.push(\n new UpdateFormStatus({\n path: this.path,\n status: this._formGroupDirective.status\n })\n );\n }\n\n this._updating = true;\n this._store.dispatch(actions).subscribe({\n error: () => (this._updating = false),\n complete: () => (this._updating = false)\n });\n }\n ngOnDestroy() {\n this._destroy$.next();\n this._destroy$.complete();\n\n if (this.clearDestroy) {\n this._store.dispatch(\n new UpdateForm({\n path: this.path,\n value: null,\n dirty: null,\n status: null,\n errors: null\n })\n );\n }\n }\n\n private debounceChange() {\n const skipDebounceTime =\n this._formGroupDirective.control.updateOn !== 'change' || this.debounce < 0;\n\n return skipDebounceTime\n ? (change: Observable<any>) => change.pipe(takeUntil(this._destroy$))\n : (change: Observable<any>) =>\n change.pipe(debounceTime(this.debounce), takeUntil(this._destroy$));\n }\n\n private get form(): FormGroup {\n return this._formGroupDirective.form;\n }\n\n private getStateStream(path: string) {\n return this._store.select(state => getValue(state, path)).pipe(takeUntil(this._destroy$));\n }\n}\n","import { NgModule, ModuleWithProviders } from '@angular/core';\nimport { NGXS_PLUGINS } from '@ngxs/store';\nimport { NgxsFormPlugin } from './form.plugin';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { FormDirective } from './directive';\n\n@NgModule({\n imports: [ReactiveFormsModule],\n declarations: [FormDirective],\n exports: [FormDirective]\n})\nexport class NgxsFormPluginModule {\n static forRoot(): ModuleWithProviders<NgxsFormPluginModule> {\n return {\n ngModule: NgxsFormPluginModule,\n providers: [\n {\n provide: NGXS_PLUGINS,\n useClass: NgxsFormPlugin,\n multi: true\n }\n ]\n };\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAAA,MAAa,gBAAgB;;;;IAK3B,YACS,OAGN;QAHM,YAAO,GAAP,OAAO,CAGb;KACC;;;;IATJ,WAAW,IAAI;;QAEb,OAAO,4BAA4B,CAAC;KACrC;CAOF;;;IALG,mCAGC;;AAIL,MAAa,eAAe;;;;IAK1B,YAAmB,OAA4D;QAA5D,YAAO,GAAP,OAAO,CAAqD;KAAI;;;;IAJnF,WAAW,IAAI;;QAEb,OAAO,2BAA2B,CAAC;KACpC;CAEF;;;IADa,kCAAmE;;AAGjF,MAAa,UAAU;;;;IAKrB,YACS,OAMN;QANM,YAAO,GAAP,OAAO,CAMb;KACC;;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CAAC,mBAAmB,CAAC;gBAC9B,YAAY,EAAE,CAAC,aAAa,CAAC;gBAC7B,OAAO,EAAE,CAAC,aAAa,CAAC;aACzB;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ngxs-form-plugin.js","sources":["../../../packages/form-plugin/src/actions.ts","../../../packages/form-plugin/src/form.plugin.ts","../../../packages/form-plugin/src/directive.ts","../../../packages/form-plugin/src/form.module.ts","../../../packages/form-plugin/index.ts","../../../packages/form-plugin/ngxs-form-plugin.ts"],"sourcesContent":["export class UpdateFormStatus {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Update Form Status';\n }\n constructor(\n public payload: {\n status: string | null;\n path: string;\n }\n ) {}\n}\n\nexport class UpdateFormValue {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Update Form Value';\n }\n constructor(public payload: { value: any; path: string; propertyPath?: string }) {}\n}\n\nexport class UpdateForm {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Update Form';\n }\n constructor(\n public payload: {\n value: any;\n errors: { [k: string]: string } | null;\n dirty: boolean | null;\n status: string | null;\n path: string;\n }\n ) {}\n}\n\nexport class UpdateFormDirty {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Update Form Dirty';\n }\n constructor(public payload: { dirty: boolean | null; path: string }) {}\n}\n\nexport class SetFormDirty {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Set Form Dirty';\n }\n constructor(public payload: string) {}\n}\n\nexport class SetFormPristine {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Set Form Pristine';\n }\n constructor(public payload: string) {}\n}\n\nexport class UpdateFormErrors {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Update Form Errors';\n }\n constructor(public payload: { errors: { [k: string]: string } | null; path: string }) {}\n}\n\nexport class SetFormDisabled {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Set Form Disabled';\n }\n constructor(public payload: string) {}\n}\n\nexport class SetFormEnabled {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Set Form Enabled';\n }\n constructor(public payload: string) {}\n}\n\nexport class ResetForm {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Reset Form';\n }\n constructor(public payload: { path: string; value?: any }) {}\n}\n","import { Injectable } from '@angular/core';\nimport {\n getActionTypeFromInstance,\n getValue,\n NgxsNextPluginFn,\n NgxsPlugin,\n setValue\n} from '@ngxs/store';\nimport {\n ResetForm,\n SetFormDirty,\n SetFormDisabled,\n SetFormEnabled,\n SetFormPristine,\n UpdateForm,\n UpdateFormDirty,\n UpdateFormErrors,\n UpdateFormStatus,\n UpdateFormValue\n} from './actions';\n\n@Injectable()\nexport class NgxsFormPlugin implements NgxsPlugin {\n handle(state: any, event: any, next: NgxsNextPluginFn) {\n const type = getActionTypeFromInstance(event);\n\n let nextState = state;\n\n if (type === UpdateFormValue.type || type === UpdateForm.type || type === ResetForm.type) {\n const { value } = event.payload;\n const payloadValue = Array.isArray(value)\n ? value.slice()\n : isObjectLike(value)\n ? { ...value }\n : value;\n const path = this.joinPathWithPropertyPath(event);\n nextState = setValue(nextState, path, payloadValue);\n }\n\n if (type === ResetForm.type) {\n const model = getValue(nextState, `${event.payload.path}.model`);\n nextState = setValue(nextState, `${event.payload.path}`, { model: model });\n }\n\n if (type === UpdateFormStatus.type || type === UpdateForm.type) {\n nextState = setValue(nextState, `${event.payload.path}.status`, event.payload.status);\n }\n\n if (type === UpdateFormErrors.type || type === UpdateForm.type) {\n nextState = setValue(nextState, `${event.payload.path}.errors`, {\n ...event.payload.errors\n });\n }\n\n if (type === UpdateFormDirty.type || type === UpdateForm.type) {\n nextState = setValue(nextState, `${event.payload.path}.dirty`, event.payload.dirty);\n }\n\n if (type === SetFormDirty.type) {\n nextState = setValue(nextState, `${event.payload}.dirty`, true);\n }\n\n if (type === SetFormPristine.type) {\n nextState = setValue(nextState, `${event.payload}.dirty`, false);\n }\n\n if (type === SetFormDisabled.type) {\n nextState = setValue(nextState, `${event.payload}.disabled`, true);\n }\n\n if (type === SetFormEnabled.type) {\n nextState = setValue(nextState, `${event.payload}.disabled`, false);\n }\n\n return next(nextState, event);\n }\n\n private joinPathWithPropertyPath({ payload }: UpdateFormValue): string {\n let path = `${payload.path}.model`;\n\n if (payload.propertyPath) {\n path += `.${payload.propertyPath}`;\n }\n\n return path;\n }\n}\n\nfunction isObjectLike(target: unknown): target is object {\n return target !== null && typeof target === 'object';\n}\n","import { ChangeDetectorRef, Directive, Input, OnDestroy, OnInit } from '@angular/core';\nimport { FormGroup, FormGroupDirective } from '@angular/forms';\nimport { Actions, getValue, ofActionDispatched, Store } from '@ngxs/store';\nimport { Observable, Subject } from 'rxjs';\nimport { debounceTime, distinctUntilChanged, filter, takeUntil } from 'rxjs/operators';\nimport {\n ResetForm,\n UpdateForm,\n UpdateFormDirty,\n UpdateFormErrors,\n UpdateFormStatus,\n UpdateFormValue\n} from './actions';\n\n@Directive({ selector: '[ngxsForm]' })\nexport class FormDirective implements OnInit, OnDestroy {\n @Input('ngxsForm')\n path: string = null!;\n\n @Input('ngxsFormDebounce')\n debounce = 100;\n\n @Input('ngxsFormClearOnDestroy')\n set clearDestroy(val: boolean) {\n this._clearDestroy = val != null && `${val}` !== 'false';\n }\n\n get clearDestroy(): boolean {\n return this._clearDestroy;\n }\n\n _clearDestroy = false;\n\n private readonly _destroy$ = new Subject<void>();\n private _updating = false;\n\n constructor(\n private _actions$: Actions,\n private _store: Store,\n private _formGroupDirective: FormGroupDirective,\n private _cd: ChangeDetectorRef\n ) {}\n\n ngOnInit() {\n this._actions$\n .pipe(\n ofActionDispatched(ResetForm),\n filter((action: ResetForm) => action.payload.path === this.path),\n takeUntil(this._destroy$)\n )\n .subscribe(({ payload: { value } }: ResetForm) => {\n this.form.reset(value);\n this.updateFormStateWithRawValue(true);\n this._cd.markForCheck();\n });\n\n this.getStateStream(`${this.path}.model`).subscribe(model => {\n if (this._updating || !model) {\n return;\n }\n\n this.form.patchValue(model);\n this._cd.markForCheck();\n });\n\n this.getStateStream(`${this.path}.dirty`).subscribe(dirty => {\n if (this.form.dirty === dirty || typeof dirty !== 'boolean') {\n return;\n }\n\n if (dirty) {\n this.form.markAsDirty();\n } else {\n this.form.markAsPristine();\n }\n\n this._cd.markForCheck();\n });\n\n // On first state change, sync form model, status and dirty with state\n this._store\n .selectOnce(state => getValue(state, this.path))\n .subscribe(() => {\n this._store.dispatch([\n new UpdateFormValue({\n path: this.path,\n value: this.form.getRawValue()\n }),\n new UpdateFormStatus({\n path: this.path,\n status: this.form.status\n }),\n new UpdateFormDirty({\n path: this.path,\n dirty: this.form.dirty\n })\n ]);\n });\n\n this.getStateStream(`${this.path}.disabled`).subscribe(disabled => {\n if (this.form.disabled === disabled || typeof disabled !== 'boolean') {\n return;\n }\n\n if (disabled) {\n this.form.disable();\n } else {\n this.form.enable();\n }\n\n this._cd.markForCheck();\n });\n\n this._formGroupDirective\n .valueChanges!.pipe(\n distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)),\n this.debounceChange()\n )\n .subscribe(() => {\n this.updateFormStateWithRawValue();\n });\n\n this._formGroupDirective\n .statusChanges!.pipe(distinctUntilChanged(), this.debounceChange())\n .subscribe((status: string) => {\n this._store.dispatch(\n new UpdateFormStatus({\n status,\n path: this.path\n })\n );\n });\n }\n\n updateFormStateWithRawValue(withFormStatus?: boolean) {\n if (this._updating) return;\n\n const value = this._formGroupDirective.control.getRawValue();\n\n const actions: any[] = [\n new UpdateFormValue({\n path: this.path,\n value\n }),\n new UpdateFormDirty({\n path: this.path,\n dirty: this._formGroupDirective.dirty\n }),\n new UpdateFormErrors({\n path: this.path,\n errors: this._formGroupDirective.errors\n })\n ];\n\n if (withFormStatus) {\n actions.push(\n new UpdateFormStatus({\n path: this.path,\n status: this._formGroupDirective.status\n })\n );\n }\n\n this._updating = true;\n this._store.dispatch(actions).subscribe({\n error: () => (this._updating = false),\n complete: () => (this._updating = false)\n });\n }\n ngOnDestroy() {\n this._destroy$.next();\n this._destroy$.complete();\n\n if (this.clearDestroy) {\n this._store.dispatch(\n new UpdateForm({\n path: this.path,\n value: null,\n dirty: null,\n status: null,\n errors: null\n })\n );\n }\n }\n\n private debounceChange() {\n const skipDebounceTime =\n this._formGroupDirective.control.updateOn !== 'change' || this.debounce < 0;\n\n return skipDebounceTime\n ? (change: Observable<any>) => change.pipe(takeUntil(this._destroy$))\n : (change: Observable<any>) =>\n change.pipe(debounceTime(this.debounce), takeUntil(this._destroy$));\n }\n\n private get form(): FormGroup {\n return this._formGroupDirective.form;\n }\n\n private getStateStream(path: string) {\n return this._store.select(state => getValue(state, path)).pipe(takeUntil(this._destroy$));\n }\n}\n","import { NgModule, ModuleWithProviders } from '@angular/core';\nimport { NGXS_PLUGINS } from '@ngxs/store';\nimport { NgxsFormPlugin } from './form.plugin';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { FormDirective } from './directive';\n\n@NgModule({\n imports: [ReactiveFormsModule],\n declarations: [FormDirective],\n exports: [FormDirective]\n})\nexport class NgxsFormPluginModule {\n static forRoot(): ModuleWithProviders<NgxsFormPluginModule> {\n return {\n ngModule: NgxsFormPluginModule,\n providers: [\n {\n provide: NGXS_PLUGINS,\n useClass: NgxsFormPlugin,\n multi: true\n }\n ]\n };\n }\n}\n","/**\n * The public api for consumers of @ngxs/form-plugin\n */\nexport * from './src/public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;MAAa,gBAAgB,CAAA;AAK3B,IAAA,WAAA,CACS,OAGN,EAAA;QAHM,IAAO,CAAA,OAAA,GAAP,OAAO,CAGb;KACC;AATJ,IAAA,WAAW,IAAI,GAAA;;AAEb,QAAA,OAAO,4BAA4B,CAAC;KACrC;AAOF,CAAA;MAEY,eAAe,CAAA;AAK1B,IAAA,WAAA,CAAmB,OAA4D,EAAA;QAA5D,IAAO,CAAA,OAAA,GAAP,OAAO,CAAqD;KAAI;AAJnF,IAAA,WAAW,IAAI,GAAA;;AAEb,QAAA,OAAO,2BAA2B,CAAC;KACpC;AAEF,CAAA;MAEY,UAAU,CAAA;AAKrB,IAAA,WAAA,CACS,OAMN,EAAA;QANM,IAAO,CAAA,OAAA,GAAP,OAAO,CAMb;KACC;AAZJ,IAAA,WAAW,IAAI,GAAA;;AAEb,QAAA,OAAO,qBAAqB,CAAC;KAC9B;AAUF,CAAA;MAEY,eAAe,CAAA;AAK1B,IAAA,WAAA,CAAmB,OAAgD,EAAA;QAAhD,IAAO,CAAA,OAAA,GAAP,OAAO,CAAyC;KAAI;AAJvE,IAAA,WAAW,IAAI,GAAA;;AAEb,QAAA,OAAO,2BAA2B,CAAC;KACpC;AAEF,CAAA;MAEY,YAAY,CAAA;AAKvB,IAAA,WAAA,CAAmB,OAAe,EAAA;QAAf,IAAO,CAAA,OAAA,GAAP,OAAO,CAAQ;KAAI;AAJtC,IAAA,WAAW,IAAI,GAAA;;AAEb,QAAA,OAAO,wBAAwB,CAAC;KACjC;AAEF,CAAA;MAEY,eAAe,CAAA;AAK1B,IAAA,WAAA,CAAmB,OAAe,EAAA;QAAf,IAAO,CAAA,OAAA,GAAP,OAAO,CAAQ;KAAI;AAJtC,IAAA,WAAW,IAAI,GAAA;;AAEb,QAAA,OAAO,2BAA2B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E;AACT,gBAAA;AACE,oBAAA,OAAO,EAAE,YAAY;AACrB,oBAAA,QAAQ,EAAE,cAAc;AACxB,oBAAA,KAAK,EAAE,IAAI;AACZ,iBAAA;AACF,aAAA;SACF,CAAC;KACH;;qIAZU,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAApB,mBAAA,oBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,EAHhB,YAAA,EAAA,CAAA,aAAa,CADlB,EAAA,OAAA,EAAA,CAAA,mBAAmB,aAEnB,aAAa,CAAA,EAAA,CAAA,CAAA;sIAEZ,oBAAoB,EAAA,OAAA,EAAA,CAJtB,CAAC,mBAAmB,CAAC,CAAA,EAAA,CAAA,CAAA;4FAInB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBALhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,mBAAmB,CAAC;oBAC9B,YAAY,EAAE,CAAC,aAAa,CAAC;oBAC7B,OAAO,EAAE,CAAC,aAAa,CAAC;AACzB,iBAAA,CAAA;;;ACVD;;AAEG;;ACFH;;AAEG;;;;"}
|
package/ngxs-form-plugin.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "../../node_modules/ng-packagr/package.schema.json",
|
|
3
3
|
"name": "@ngxs/form-plugin",
|
|
4
4
|
"description": "form plugin for @ngxs/store",
|
|
5
|
-
"version": "3.7.6-dev.master-
|
|
5
|
+
"version": "3.7.6-dev.master-dcdd391",
|
|
6
6
|
"sideEffects": true,
|
|
7
7
|
"peerDependencies": {
|
|
8
8
|
"@angular/core": ">=6.1.0 <16.0.0",
|
|
@@ -11,16 +11,13 @@
|
|
|
11
11
|
"rxjs": ">=6.5.5"
|
|
12
12
|
},
|
|
13
13
|
"main": "bundles/ngxs-form-plugin.umd.js",
|
|
14
|
-
"module": "
|
|
14
|
+
"module": "fesm2015/ngxs-form-plugin.js",
|
|
15
15
|
"es2015": "fesm2015/ngxs-form-plugin.js",
|
|
16
|
-
"esm5": "esm5/ngxs-form-plugin.js",
|
|
17
16
|
"esm2015": "esm2015/ngxs-form-plugin.js",
|
|
18
|
-
"fesm5": "fesm5/ngxs-form-plugin.js",
|
|
19
17
|
"fesm2015": "fesm2015/ngxs-form-plugin.js",
|
|
20
18
|
"typings": "ngxs-form-plugin.d.ts",
|
|
21
|
-
"metadata": "ngxs-form-plugin.metadata.json",
|
|
22
19
|
"dependencies": {
|
|
23
|
-
"tslib": "^
|
|
20
|
+
"tslib": "^2.2.0"
|
|
24
21
|
},
|
|
25
22
|
"repository": {
|
|
26
23
|
"type": "git",
|
package/src/actions.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare class UpdateFormStatus {
|
|
|
3
3
|
status: string | null;
|
|
4
4
|
path: string;
|
|
5
5
|
};
|
|
6
|
-
static
|
|
6
|
+
static get type(): string;
|
|
7
7
|
constructor(payload: {
|
|
8
8
|
status: string | null;
|
|
9
9
|
path: string;
|
|
@@ -15,7 +15,7 @@ export declare class UpdateFormValue {
|
|
|
15
15
|
path: string;
|
|
16
16
|
propertyPath?: string;
|
|
17
17
|
};
|
|
18
|
-
static
|
|
18
|
+
static get type(): string;
|
|
19
19
|
constructor(payload: {
|
|
20
20
|
value: any;
|
|
21
21
|
path: string;
|
|
@@ -32,7 +32,7 @@ export declare class UpdateForm {
|
|
|
32
32
|
status: string | null;
|
|
33
33
|
path: string;
|
|
34
34
|
};
|
|
35
|
-
static
|
|
35
|
+
static get type(): string;
|
|
36
36
|
constructor(payload: {
|
|
37
37
|
value: any;
|
|
38
38
|
errors: {
|
|
@@ -48,7 +48,7 @@ export declare class UpdateFormDirty {
|
|
|
48
48
|
dirty: boolean | null;
|
|
49
49
|
path: string;
|
|
50
50
|
};
|
|
51
|
-
static
|
|
51
|
+
static get type(): string;
|
|
52
52
|
constructor(payload: {
|
|
53
53
|
dirty: boolean | null;
|
|
54
54
|
path: string;
|
|
@@ -56,12 +56,12 @@ export declare class UpdateFormDirty {
|
|
|
56
56
|
}
|
|
57
57
|
export declare class SetFormDirty {
|
|
58
58
|
payload: string;
|
|
59
|
-
static
|
|
59
|
+
static get type(): string;
|
|
60
60
|
constructor(payload: string);
|
|
61
61
|
}
|
|
62
62
|
export declare class SetFormPristine {
|
|
63
63
|
payload: string;
|
|
64
|
-
static
|
|
64
|
+
static get type(): string;
|
|
65
65
|
constructor(payload: string);
|
|
66
66
|
}
|
|
67
67
|
export declare class UpdateFormErrors {
|
|
@@ -71,7 +71,7 @@ export declare class UpdateFormErrors {
|
|
|
71
71
|
} | null;
|
|
72
72
|
path: string;
|
|
73
73
|
};
|
|
74
|
-
static
|
|
74
|
+
static get type(): string;
|
|
75
75
|
constructor(payload: {
|
|
76
76
|
errors: {
|
|
77
77
|
[k: string]: string;
|
|
@@ -81,12 +81,12 @@ export declare class UpdateFormErrors {
|
|
|
81
81
|
}
|
|
82
82
|
export declare class SetFormDisabled {
|
|
83
83
|
payload: string;
|
|
84
|
-
static
|
|
84
|
+
static get type(): string;
|
|
85
85
|
constructor(payload: string);
|
|
86
86
|
}
|
|
87
87
|
export declare class SetFormEnabled {
|
|
88
88
|
payload: string;
|
|
89
|
-
static
|
|
89
|
+
static get type(): string;
|
|
90
90
|
constructor(payload: string);
|
|
91
91
|
}
|
|
92
92
|
export declare class ResetForm {
|
|
@@ -94,7 +94,7 @@ export declare class ResetForm {
|
|
|
94
94
|
path: string;
|
|
95
95
|
value?: any;
|
|
96
96
|
};
|
|
97
|
-
static
|
|
97
|
+
static get type(): string;
|
|
98
98
|
constructor(payload: {
|
|
99
99
|
path: string;
|
|
100
100
|
value?: any;
|
package/src/directive.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
|
|
2
2
|
import { FormGroupDirective } from '@angular/forms';
|
|
3
3
|
import { Actions, Store } from '@ngxs/store';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
4
5
|
export declare class FormDirective implements OnInit, OnDestroy {
|
|
5
6
|
private _actions$;
|
|
6
7
|
private _store;
|
|
@@ -8,7 +9,8 @@ export declare class FormDirective implements OnInit, OnDestroy {
|
|
|
8
9
|
private _cd;
|
|
9
10
|
path: string;
|
|
10
11
|
debounce: number;
|
|
11
|
-
clearDestroy: boolean;
|
|
12
|
+
set clearDestroy(val: boolean);
|
|
13
|
+
get clearDestroy(): boolean;
|
|
12
14
|
_clearDestroy: boolean;
|
|
13
15
|
private readonly _destroy$;
|
|
14
16
|
private _updating;
|
|
@@ -17,6 +19,8 @@ export declare class FormDirective implements OnInit, OnDestroy {
|
|
|
17
19
|
updateFormStateWithRawValue(withFormStatus?: boolean): void;
|
|
18
20
|
ngOnDestroy(): void;
|
|
19
21
|
private debounceChange;
|
|
20
|
-
private
|
|
22
|
+
private get form();
|
|
21
23
|
private getStateStream;
|
|
24
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FormDirective, never>;
|
|
25
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<FormDirective, "[ngxsForm]", never, { "path": "ngxsForm"; "debounce": "ngxsFormDebounce"; "clearDestroy": "ngxsFormClearOnDestroy"; }, {}, never>;
|
|
22
26
|
}
|
package/src/form.module.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { ModuleWithProviders } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import * as i1 from "./directive";
|
|
4
|
+
import * as i2 from "@angular/forms";
|
|
2
5
|
export declare class NgxsFormPluginModule {
|
|
3
6
|
static forRoot(): ModuleWithProviders<NgxsFormPluginModule>;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxsFormPluginModule, never>;
|
|
8
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxsFormPluginModule, [typeof i1.FormDirective], [typeof i2.ReactiveFormsModule], [typeof i1.FormDirective]>;
|
|
9
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<NgxsFormPluginModule>;
|
|
4
10
|
}
|
package/src/form.plugin.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { NgxsNextPluginFn, NgxsPlugin } from '@ngxs/store';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
2
3
|
export declare class NgxsFormPlugin implements NgxsPlugin {
|
|
3
4
|
handle(state: any, event: any, next: NgxsNextPluginFn): any;
|
|
4
5
|
private joinPathWithPropertyPath;
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxsFormPlugin, never>;
|
|
7
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NgxsFormPlugin>;
|
|
5
8
|
}
|
package/src/public_api.d.ts
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@ngxs/store"),require("@angular/forms"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@ngxs/form-plugin",["exports","@angular/core","@ngxs/store","@angular/forms","rxjs","rxjs/operators"],e):e(((t=t||self).ngxs=t.ngxs||{},t.ngxs["form-plugin"]={}),t.ng.core,t["ngxs-store"],t.ng.forms,t.rxjs,t.rxjs.operators)}(this,(function(t,e,r,o,n,a){"use strict";
|
|
2
|
-
/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted.
|
|
7
|
-
|
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */var i=function(){return(i=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};var u=function(){function t(t){this.payload=t}return Object.defineProperty(t,"type",{get:function(){return"[Forms] Update Form Status"},enumerable:!0,configurable:!0}),t}();var s=function(){function t(t){this.payload=t}return Object.defineProperty(t,"type",{get:function(){return"[Forms] Update Form Value"},enumerable:!0,configurable:!0}),t}();var p=function(){function t(t){this.payload=t}return Object.defineProperty(t,"type",{get:function(){return"[Forms] Update Form"},enumerable:!0,configurable:!0}),t}();var c=function(){function t(t){this.payload=t}return Object.defineProperty(t,"type",{get:function(){return"[Forms] Update Form Dirty"},enumerable:!0,configurable:!0}),t}();var l=function(){function t(t){this.payload=t}return Object.defineProperty(t,"type",{get:function(){return"[Forms] Set Form Dirty"},enumerable:!0,configurable:!0}),t}();var f=function(){function t(t){this.payload=t}return Object.defineProperty(t,"type",{get:function(){return"[Forms] Set Form Pristine"},enumerable:!0,configurable:!0}),t}();var d=function(){function t(t){this.payload=t}return Object.defineProperty(t,"type",{get:function(){return"[Forms] Update Form Errors"},enumerable:!0,configurable:!0}),t}();var y=function(){function t(t){this.payload=t}return Object.defineProperty(t,"type",{get:function(){return"[Forms] Set Form Disabled"},enumerable:!0,configurable:!0}),t}();var h=function(){function t(t){this.payload=t}return Object.defineProperty(t,"type",{get:function(){return"[Forms] Set Form Enabled"},enumerable:!0,configurable:!0}),t}();var m=function(){function t(t){this.payload=t}return Object.defineProperty(t,"type",{get:function(){return"[Forms] Reset Form"},enumerable:!0,configurable:!0}),t}();var g=function(){function t(){}return t.prototype.handle=function(t,e,o){var n,a=r.getActionTypeFromInstance(e),g=t;if(a===s.type||a===p.type||a===m.type){var b=e.payload.value,v=Array.isArray(b)?b.slice():null!==(n=b)&&"object"==typeof n?i({},b):b,F=this.joinPathWithPropertyPath(e);g=r.setValue(g,F,v)}if(a===m.type){var _=r.getValue(g,e.payload.path+".model");g=r.setValue(g,""+e.payload.path,{model:_})}return a!==u.type&&a!==p.type||(g=r.setValue(g,e.payload.path+".status",e.payload.status)),a!==d.type&&a!==p.type||(g=r.setValue(g,e.payload.path+".errors",i({},e.payload.errors))),a!==c.type&&a!==p.type||(g=r.setValue(g,e.payload.path+".dirty",e.payload.dirty)),a===l.type&&(g=r.setValue(g,e.payload+".dirty",!0)),a===f.type&&(g=r.setValue(g,e.payload+".dirty",!1)),a===y.type&&(g=r.setValue(g,e.payload+".disabled",!0)),a===h.type&&(g=r.setValue(g,e.payload+".disabled",!1)),o(g,e)},t.prototype.joinPathWithPropertyPath=function(t){var e=t.payload,r=e.path+".model";return e.propertyPath&&(r+="."+e.propertyPath),r},t.decorators=[{type:e.Injectable}],t}();var b=function(){function t(t,e,r,o){this._actions$=t,this._store=e,this._formGroupDirective=r,this._cd=o,this.path=null,this.debounce=100,this._clearDestroy=!1,this._destroy$=new n.Subject,this._updating=!1}return Object.defineProperty(t.prototype,"clearDestroy",{get:function(){return this._clearDestroy},set:function(t){this._clearDestroy=null!=t&&""+t!="false"},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;this._actions$.pipe(r.ofActionDispatched(m),a.filter((function(e){return e.payload.path===t.path})),a.takeUntil(this._destroy$)).subscribe((function(e){var r=e.payload.value;t.form.reset(r),t.updateFormStateWithRawValue(!0),t._cd.markForCheck()})),this.getStateStream(this.path+".model").subscribe((function(e){!t._updating&&e&&(t.form.patchValue(e),t._cd.markForCheck())})),this.getStateStream(this.path+".dirty").subscribe((function(e){t.form.dirty!==e&&"boolean"==typeof e&&(e?t.form.markAsDirty():t.form.markAsPristine(),t._cd.markForCheck())})),this._store.selectOnce((function(e){return r.getValue(e,t.path)})).subscribe((function(){t._store.dispatch([new s({path:t.path,value:t.form.getRawValue()}),new u({path:t.path,status:t.form.status}),new c({path:t.path,dirty:t.form.dirty})])})),this.getStateStream(this.path+".disabled").subscribe((function(e){t.form.disabled!==e&&"boolean"==typeof e&&(e?t.form.disable():t.form.enable(),t._cd.markForCheck())})),this._formGroupDirective.valueChanges.pipe(a.distinctUntilChanged((function(t,e){return JSON.stringify(t)===JSON.stringify(e)})),this.debounceChange()).subscribe((function(){t.updateFormStateWithRawValue()})),this._formGroupDirective.statusChanges.pipe(a.distinctUntilChanged(),this.debounceChange()).subscribe((function(e){t._store.dispatch(new u({status:e,path:t.path}))}))},t.prototype.updateFormStateWithRawValue=function(t){var e=this;if(!this._updating){var r=this._formGroupDirective.control.getRawValue(),o=[new s({path:this.path,value:r}),new c({path:this.path,dirty:this._formGroupDirective.dirty}),new d({path:this.path,errors:this._formGroupDirective.errors})];t&&o.push(new u({path:this.path,status:this._formGroupDirective.status})),this._updating=!0,this._store.dispatch(o).subscribe({error:function(){return e._updating=!1},complete:function(){return e._updating=!1}})}},t.prototype.ngOnDestroy=function(){this._destroy$.next(),this._destroy$.complete(),this.clearDestroy&&this._store.dispatch(new p({path:this.path,value:null,dirty:null,status:null,errors:null}))},t.prototype.debounceChange=function(){var t=this;return"change"!==this._formGroupDirective.control.updateOn||this.debounce<0?function(e){return e.pipe(a.takeUntil(t._destroy$))}:function(e){return e.pipe(a.debounceTime(t.debounce),a.takeUntil(t._destroy$))}},Object.defineProperty(t.prototype,"form",{get:function(){return this._formGroupDirective.form},enumerable:!0,configurable:!0}),t.prototype.getStateStream=function(t){return this._store.select((function(e){return r.getValue(e,t)})).pipe(a.takeUntil(this._destroy$))},t.decorators=[{type:e.Directive,args:[{selector:"[ngxsForm]"}]}],t.ctorParameters=function(){return[{type:r.Actions},{type:r.Store},{type:o.FormGroupDirective},{type:e.ChangeDetectorRef}]},t.propDecorators={path:[{type:e.Input,args:["ngxsForm"]}],debounce:[{type:e.Input,args:["ngxsFormDebounce"]}],clearDestroy:[{type:e.Input,args:["ngxsFormClearOnDestroy"]}]},t}();var v=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[{provide:r.NGXS_PLUGINS,useClass:g,multi:!0}]}},t.decorators=[{type:e.NgModule,args:[{imports:[o.ReactiveFormsModule],declarations:[b],exports:[b]}]}],t}();t.NgxsFormPlugin=g,t.NgxsFormPluginModule=v,t.ResetForm=m,t.SetFormDirty=l,t.SetFormDisabled=y,t.SetFormEnabled=h,t.SetFormPristine=f,t.UpdateForm=p,t.UpdateFormDirty=c,t.UpdateFormErrors=d,t.UpdateFormStatus=u,t.UpdateFormValue=s,t.ɵa=b,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
16
|
-
//# sourceMappingURL=ngxs-form-plugin.umd.min.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/tslib/tslib.es6.js","ng://@ngxs/form-plugin/src/actions.ts","ng://@ngxs/form-plugin/src/form.plugin.ts","ng://@ngxs/form-plugin/src/directive.ts","ng://@ngxs/form-plugin/src/form.module.ts"],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","UpdateFormStatus","payload","defineProperty","UpdateFormValue","UpdateForm","UpdateFormDirty","SetFormDirty","SetFormPristine","UpdateFormErrors","SetFormDisabled","SetFormEnabled","ResetForm","NgxsFormPlugin","handle","state","event","next","target","type","getActionTypeFromInstance","nextState","value","payloadValue","Array","isArray","slice","path","joinPathWithPropertyPath","setValue","model","getValue","status","errors","dirty","_a","propertyPath","Injectable","FormDirective","_actions$","_store","_formGroupDirective","_cd","debounce","_clearDestroy","_destroy$","Subject","_updating","val","ngOnInit","_this","pipe","ofActionDispatched","filter","action","takeUntil","subscribe","form","reset","updateFormStateWithRawValue","markForCheck","getStateStream","patchValue","markAsDirty","markAsPristine","selectOnce","dispatch","getRawValue","disabled","disable","enable","distinctUntilChanged","a","b","JSON","stringify","debounceChange","withFormStatus","control","actions","push","error","complete","ngOnDestroy","clearDestroy","updateOn","change","debounceTime","select","Directive","args","selector","Actions","Store","FormGroupDirective","ChangeDetectorRef","Input","NgxsFormPluginModule","forRoot","ngModule","providers","provide","NGXS_PLUGINS","useClass","multi","NgModule","imports","ReactiveFormsModule","declarations","exports"],"mappings":";;;;;;;;;;;;;;oFA6BO,IAAIA,EAAW,WAQlB,OAPAA,EAAWC,OAAOC,QAAU,SAAkBC,GAC1C,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAII,KADTL,EAAIG,UAAUF,GACOJ,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,IAE9E,OAAON,IAEKU,MAAMC,KAAMP,YCrChC,IAAAQ,EAAA,WAKE,SAAAA,EACSC,GAAAF,KAAAE,QAAAA,EAKX,OAVEf,OAAAgB,eAAWF,EAAA,OAAI,KAAf,WAEE,MAAO,8DAQXA,EAXA,GAaA,IAAAG,EAAA,WAKE,SAAAA,EAAmBF,GAAAF,KAAAE,QAAAA,EACrB,OALEf,OAAAgB,eAAWC,EAAA,OAAI,KAAf,WAEE,MAAO,6DAGXA,EANA,GAQA,IAAAC,EAAA,WAKE,SAAAA,EACSH,GAAAF,KAAAE,QAAAA,EAQX,OAbEf,OAAAgB,eAAWE,EAAA,OAAI,KAAf,WAEE,MAAO,uDAWXA,EAdA,GAgBA,IAAAC,EAAA,WAKE,SAAAA,EAAmBJ,GAAAF,KAAAE,QAAAA,EACrB,OALEf,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,CAACC,EAAAA,qBACVC,aAAc,CAACtE,GACfuE,QAAS,CAACvE,OAeZ2D,EAxBA","sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","export class UpdateFormStatus {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Update Form Status';\n }\n constructor(\n public payload: {\n status: string | null;\n path: string;\n }\n ) {}\n}\n\nexport class UpdateFormValue {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Update Form Value';\n }\n constructor(public payload: { value: any; path: string; propertyPath?: string }) {}\n}\n\nexport class UpdateForm {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Update Form';\n }\n constructor(\n public payload: {\n value: any;\n errors: { [k: string]: string } | null;\n dirty: boolean | null;\n status: string | null;\n path: string;\n }\n ) {}\n}\n\nexport class UpdateFormDirty {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Update Form Dirty';\n }\n constructor(public payload: { dirty: boolean | null; path: string }) {}\n}\n\nexport class SetFormDirty {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Set Form Dirty';\n }\n constructor(public payload: string) {}\n}\n\nexport class SetFormPristine {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Set Form Pristine';\n }\n constructor(public payload: string) {}\n}\n\nexport class UpdateFormErrors {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Update Form Errors';\n }\n constructor(public payload: { errors: { [k: string]: string } | null; path: string }) {}\n}\n\nexport class SetFormDisabled {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Set Form Disabled';\n }\n constructor(public payload: string) {}\n}\n\nexport class SetFormEnabled {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Set Form Enabled';\n }\n constructor(public payload: string) {}\n}\n\nexport class ResetForm {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[Forms] Reset Form';\n }\n constructor(public payload: { path: string; value?: any }) {}\n}\n","import { Injectable } from '@angular/core';\nimport {\n getActionTypeFromInstance,\n getValue,\n NgxsNextPluginFn,\n NgxsPlugin,\n setValue\n} from '@ngxs/store';\nimport {\n ResetForm,\n SetFormDirty,\n SetFormDisabled,\n SetFormEnabled,\n SetFormPristine,\n UpdateForm,\n UpdateFormDirty,\n UpdateFormErrors,\n UpdateFormStatus,\n UpdateFormValue\n} from './actions';\n\n@Injectable()\nexport class NgxsFormPlugin implements NgxsPlugin {\n handle(state: any, event: any, next: NgxsNextPluginFn) {\n const type = getActionTypeFromInstance(event);\n\n let nextState = state;\n\n if (type === UpdateFormValue.type || type === UpdateForm.type || type === ResetForm.type) {\n const { value } = event.payload;\n const payloadValue = Array.isArray(value)\n ? value.slice()\n : isObjectLike(value)\n ? { ...value }\n : value;\n const path = this.joinPathWithPropertyPath(event);\n nextState = setValue(nextState, path, payloadValue);\n }\n\n if (type === ResetForm.type) {\n const model = getValue(nextState, `${event.payload.path}.model`);\n nextState = setValue(nextState, `${event.payload.path}`, { model: model });\n }\n\n if (type === UpdateFormStatus.type || type === UpdateForm.type) {\n nextState = setValue(nextState, `${event.payload.path}.status`, event.payload.status);\n }\n\n if (type === UpdateFormErrors.type || type === UpdateForm.type) {\n nextState = setValue(nextState, `${event.payload.path}.errors`, {\n ...event.payload.errors\n });\n }\n\n if (type === UpdateFormDirty.type || type === UpdateForm.type) {\n nextState = setValue(nextState, `${event.payload.path}.dirty`, event.payload.dirty);\n }\n\n if (type === SetFormDirty.type) {\n nextState = setValue(nextState, `${event.payload}.dirty`, true);\n }\n\n if (type === SetFormPristine.type) {\n nextState = setValue(nextState, `${event.payload}.dirty`, false);\n }\n\n if (type === SetFormDisabled.type) {\n nextState = setValue(nextState, `${event.payload}.disabled`, true);\n }\n\n if (type === SetFormEnabled.type) {\n nextState = setValue(nextState, `${event.payload}.disabled`, false);\n }\n\n return next(nextState, event);\n }\n\n private joinPathWithPropertyPath({ payload }: UpdateFormValue): string {\n let path = `${payload.path}.model`;\n\n if (payload.propertyPath) {\n path += `.${payload.propertyPath}`;\n }\n\n return path;\n }\n}\n\nfunction isObjectLike(target: unknown): target is object {\n return target !== null && typeof target === 'object';\n}\n","import { ChangeDetectorRef, Directive, Input, OnDestroy, OnInit } from '@angular/core';\nimport { FormGroup, FormGroupDirective } from '@angular/forms';\nimport { Actions, getValue, ofActionDispatched, Store } from '@ngxs/store';\nimport { Observable, Subject } from 'rxjs';\nimport { debounceTime, distinctUntilChanged, filter, takeUntil } from 'rxjs/operators';\nimport {\n ResetForm,\n UpdateForm,\n UpdateFormDirty,\n UpdateFormErrors,\n UpdateFormStatus,\n UpdateFormValue\n} from './actions';\n\n@Directive({ selector: '[ngxsForm]' })\nexport class FormDirective implements OnInit, OnDestroy {\n @Input('ngxsForm')\n path: string = null!;\n\n @Input('ngxsFormDebounce')\n debounce = 100;\n\n @Input('ngxsFormClearOnDestroy')\n set clearDestroy(val: boolean) {\n this._clearDestroy = val != null && `${val}` !== 'false';\n }\n\n get clearDestroy(): boolean {\n return this._clearDestroy;\n }\n\n _clearDestroy = false;\n\n private readonly _destroy$ = new Subject<void>();\n private _updating = false;\n\n constructor(\n private _actions$: Actions,\n private _store: Store,\n private _formGroupDirective: FormGroupDirective,\n private _cd: ChangeDetectorRef\n ) {}\n\n ngOnInit() {\n this._actions$\n .pipe(\n ofActionDispatched(ResetForm),\n filter((action: ResetForm) => action.payload.path === this.path),\n takeUntil(this._destroy$)\n )\n .subscribe(({ payload: { value } }: ResetForm) => {\n this.form.reset(value);\n this.updateFormStateWithRawValue(true);\n this._cd.markForCheck();\n });\n\n this.getStateStream(`${this.path}.model`).subscribe(model => {\n if (this._updating || !model) {\n return;\n }\n\n this.form.patchValue(model);\n this._cd.markForCheck();\n });\n\n this.getStateStream(`${this.path}.dirty`).subscribe(dirty => {\n if (this.form.dirty === dirty || typeof dirty !== 'boolean') {\n return;\n }\n\n if (dirty) {\n this.form.markAsDirty();\n } else {\n this.form.markAsPristine();\n }\n\n this._cd.markForCheck();\n });\n\n // On first state change, sync form model, status and dirty with state\n this._store\n .selectOnce(state => getValue(state, this.path))\n .subscribe(() => {\n this._store.dispatch([\n new UpdateFormValue({\n path: this.path,\n value: this.form.getRawValue()\n }),\n new UpdateFormStatus({\n path: this.path,\n status: this.form.status\n }),\n new UpdateFormDirty({\n path: this.path,\n dirty: this.form.dirty\n })\n ]);\n });\n\n this.getStateStream(`${this.path}.disabled`).subscribe(disabled => {\n if (this.form.disabled === disabled || typeof disabled !== 'boolean') {\n return;\n }\n\n if (disabled) {\n this.form.disable();\n } else {\n this.form.enable();\n }\n\n this._cd.markForCheck();\n });\n\n this._formGroupDirective\n .valueChanges!.pipe(\n distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)),\n this.debounceChange()\n )\n .subscribe(() => {\n this.updateFormStateWithRawValue();\n });\n\n this._formGroupDirective\n .statusChanges!.pipe(distinctUntilChanged(), this.debounceChange())\n .subscribe((status: string) => {\n this._store.dispatch(\n new UpdateFormStatus({\n status,\n path: this.path\n })\n );\n });\n }\n\n updateFormStateWithRawValue(withFormStatus?: boolean) {\n if (this._updating) return;\n\n const value = this._formGroupDirective.control.getRawValue();\n\n const actions: any[] = [\n new UpdateFormValue({\n path: this.path,\n value\n }),\n new UpdateFormDirty({\n path: this.path,\n dirty: this._formGroupDirective.dirty\n }),\n new UpdateFormErrors({\n path: this.path,\n errors: this._formGroupDirective.errors\n })\n ];\n\n if (withFormStatus) {\n actions.push(\n new UpdateFormStatus({\n path: this.path,\n status: this._formGroupDirective.status\n })\n );\n }\n\n this._updating = true;\n this._store.dispatch(actions).subscribe({\n error: () => (this._updating = false),\n complete: () => (this._updating = false)\n });\n }\n ngOnDestroy() {\n this._destroy$.next();\n this._destroy$.complete();\n\n if (this.clearDestroy) {\n this._store.dispatch(\n new UpdateForm({\n path: this.path,\n value: null,\n dirty: null,\n status: null,\n errors: null\n })\n );\n }\n }\n\n private debounceChange() {\n const skipDebounceTime =\n this._formGroupDirective.control.updateOn !== 'change' || this.debounce < 0;\n\n return skipDebounceTime\n ? (change: Observable<any>) => change.pipe(takeUntil(this._destroy$))\n : (change: Observable<any>) =>\n change.pipe(debounceTime(this.debounce), takeUntil(this._destroy$));\n }\n\n private get form(): FormGroup {\n return this._formGroupDirective.form;\n }\n\n private getStateStream(path: string) {\n return this._store.select(state => getValue(state, path)).pipe(takeUntil(this._destroy$));\n }\n}\n","import { NgModule, ModuleWithProviders } from '@angular/core';\nimport { NGXS_PLUGINS } from '@ngxs/store';\nimport { NgxsFormPlugin } from './form.plugin';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { FormDirective } from './directive';\n\n@NgModule({\n imports: [ReactiveFormsModule],\n declarations: [FormDirective],\n exports: [FormDirective]\n})\nexport class NgxsFormPluginModule {\n static forRoot(): ModuleWithProviders<NgxsFormPluginModule> {\n return {\n ngModule: NgxsFormPluginModule,\n providers: [\n {\n provide: NGXS_PLUGINS,\n useClass: NgxsFormPlugin,\n multi: true\n }\n ]\n };\n }\n}\n"]}
|
package/esm5/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview added by tsickle
|
|
3
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* The public api for consumers of @ngxs/form-plugin
|
|
7
|
-
*/
|
|
8
|
-
export { NgxsFormPluginModule, NgxsFormPlugin, UpdateFormStatus, UpdateFormValue, UpdateForm, UpdateFormDirty, SetFormDirty, SetFormPristine, UpdateFormErrors, SetFormDisabled, SetFormEnabled, ResetForm } from './src/public_api';
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290Ijoibmc6Ly9Abmd4cy9mb3JtLXBsdWdpbi8iLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFHQSxrTkFBYyxrQkFBa0IsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogVGhlIHB1YmxpYyBhcGkgZm9yIGNvbnN1bWVycyBvZiBAbmd4cy9mb3JtLXBsdWdpblxuICovXG5leHBvcnQgKiBmcm9tICcuL3NyYy9wdWJsaWNfYXBpJztcbiJdfQ==
|
package/esm5/ngxs-form-plugin.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview added by tsickle
|
|
3
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Generated bundle index. Do not edit.
|
|
7
|
-
*/
|
|
8
|
-
export { NgxsFormPluginModule, NgxsFormPlugin, UpdateFormStatus, UpdateFormValue, UpdateForm, UpdateFormDirty, SetFormDirty, SetFormPristine, UpdateFormErrors, SetFormDisabled, SetFormEnabled, ResetForm } from './index';
|
|
9
|
-
export { FormDirective as ɵa } from './src/directive';
|
|
10
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4cy1mb3JtLXBsdWdpbi5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BuZ3hzL2Zvcm0tcGx1Z2luLyIsInNvdXJjZXMiOlsibmd4cy1mb3JtLXBsdWdpbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBSUEsa05BQWMsU0FBUyxDQUFDO0FBRXhCLE9BQU8sRUFBQyxhQUFhLElBQUksRUFBRSxFQUFDLE1BQU0saUJBQWlCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuXG5leHBvcnQge0Zvcm1EaXJlY3RpdmUgYXMgybVhfSBmcm9tICcuL3NyYy9kaXJlY3RpdmUnOyJdfQ==
|