@ngxs/form-plugin 19.0.0-dev.master-07b8769 → 19.0.0-dev.master-1037979
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/fesm2022/ngxs-form-plugin.mjs +38 -34
- package/fesm2022/ngxs-form-plugin.mjs.map +1 -1
- package/index.d.ts +4 -4
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, inject, ChangeDetectorRef, Directive, Input, NgModule } from '@angular/core';
|
|
2
|
+
import { Injectable, inject, ChangeDetectorRef, DestroyRef, Directive, Input, NgModule } from '@angular/core';
|
|
3
3
|
import { Actions, Store, ofActionDispatched, withNgxsPlugin } from '@ngxs/store';
|
|
4
4
|
import { getActionTypeFromInstance, setValue, getValue } from '@ngxs/store/plugins';
|
|
5
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
6
|
import { FormGroupDirective } from '@angular/forms';
|
|
6
|
-
import {
|
|
7
|
-
import { filter, takeUntil, distinctUntilChanged, debounceTime } from 'rxjs/operators';
|
|
7
|
+
import { distinctUntilChanged, debounceTime } from 'rxjs';
|
|
8
8
|
|
|
9
9
|
class UpdateFormStatus {
|
|
10
10
|
static { this.type = '[Forms] Update Form Status'; }
|
|
@@ -128,17 +128,6 @@ function isObjectLike(target) {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
class NgxsFormDirective {
|
|
131
|
-
constructor() {
|
|
132
|
-
this.path = null;
|
|
133
|
-
this._debounce = 100;
|
|
134
|
-
this._clearDestroy = false;
|
|
135
|
-
this._updating = false;
|
|
136
|
-
this._actions$ = inject(Actions);
|
|
137
|
-
this._store = inject(Store);
|
|
138
|
-
this._formGroupDirective = inject(FormGroupDirective);
|
|
139
|
-
this._cd = inject(ChangeDetectorRef);
|
|
140
|
-
this._destroy$ = new ReplaySubject(1);
|
|
141
|
-
}
|
|
142
131
|
set debounce(debounce) {
|
|
143
132
|
this._debounce = Number(debounce);
|
|
144
133
|
}
|
|
@@ -151,11 +140,35 @@ class NgxsFormDirective {
|
|
|
151
140
|
get clearDestroy() {
|
|
152
141
|
return this._clearDestroy;
|
|
153
142
|
}
|
|
143
|
+
constructor() {
|
|
144
|
+
this.path = null;
|
|
145
|
+
this._debounce = 100;
|
|
146
|
+
this._clearDestroy = false;
|
|
147
|
+
this._updating = false;
|
|
148
|
+
this._actions$ = inject(Actions);
|
|
149
|
+
this._store = inject(Store);
|
|
150
|
+
this._formGroupDirective = inject(FormGroupDirective);
|
|
151
|
+
this._cd = inject(ChangeDetectorRef);
|
|
152
|
+
this._destroyRef = inject(DestroyRef);
|
|
153
|
+
this._destroyRef.onDestroy(() => {
|
|
154
|
+
if (this.clearDestroy) {
|
|
155
|
+
this._store.dispatch(new UpdateForm({
|
|
156
|
+
path: this.path,
|
|
157
|
+
value: null,
|
|
158
|
+
dirty: null,
|
|
159
|
+
status: null,
|
|
160
|
+
errors: null
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
154
165
|
ngOnInit() {
|
|
155
|
-
this._actions
|
|
156
|
-
|
|
157
|
-
.
|
|
158
|
-
|
|
166
|
+
const resetForm$ = this._actions$.pipe(ofActionDispatched(ResetForm), takeUntilDestroyed(this._destroyRef));
|
|
167
|
+
resetForm$.subscribe((action) => {
|
|
168
|
+
if (action.payload.path !== this.path) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
this.form.reset(action.payload.value);
|
|
159
172
|
this.updateFormStateWithRawValue(true);
|
|
160
173
|
this._cd.markForCheck();
|
|
161
174
|
});
|
|
@@ -181,6 +194,7 @@ class NgxsFormDirective {
|
|
|
181
194
|
// On first state change, sync form model, status and dirty with state
|
|
182
195
|
this._store
|
|
183
196
|
.selectOnce(state => getValue(state, this.path))
|
|
197
|
+
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
184
198
|
.subscribe(() => {
|
|
185
199
|
this._store.dispatch([
|
|
186
200
|
new UpdateFormValue({
|
|
@@ -253,29 +267,19 @@ class NgxsFormDirective {
|
|
|
253
267
|
complete: () => (this._updating = false)
|
|
254
268
|
});
|
|
255
269
|
}
|
|
256
|
-
ngOnDestroy() {
|
|
257
|
-
this._destroy$.next();
|
|
258
|
-
if (this.clearDestroy) {
|
|
259
|
-
this._store.dispatch(new UpdateForm({
|
|
260
|
-
path: this.path,
|
|
261
|
-
value: null,
|
|
262
|
-
dirty: null,
|
|
263
|
-
status: null,
|
|
264
|
-
errors: null
|
|
265
|
-
}));
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
270
|
debounceChange() {
|
|
269
271
|
const skipDebounceTime = this._formGroupDirective.control.updateOn !== 'change' || this._debounce < 0;
|
|
270
272
|
return skipDebounceTime
|
|
271
|
-
? (change) => change.pipe(
|
|
272
|
-
: (change) => change.pipe(debounceTime(this._debounce),
|
|
273
|
+
? (change) => change.pipe(takeUntilDestroyed(this._destroyRef))
|
|
274
|
+
: (change) => change.pipe(debounceTime(this._debounce), takeUntilDestroyed(this._destroyRef));
|
|
273
275
|
}
|
|
274
276
|
get form() {
|
|
275
277
|
return this._formGroupDirective.form;
|
|
276
278
|
}
|
|
277
279
|
getStateStream(path) {
|
|
278
|
-
return this._store
|
|
280
|
+
return this._store
|
|
281
|
+
.select(state => getValue(state, path))
|
|
282
|
+
.pipe(takeUntilDestroyed(this._destroyRef));
|
|
279
283
|
}
|
|
280
284
|
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsFormDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
281
285
|
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0", type: NgxsFormDirective, isStandalone: true, selector: "[ngxsForm]", inputs: { path: ["ngxsForm", "path"], debounce: ["ngxsFormDebounce", "debounce"], clearDestroy: ["ngxsFormClearOnDestroy", "clearDestroy"] }, ngImport: i0 }); }
|
|
@@ -283,7 +287,7 @@ class NgxsFormDirective {
|
|
|
283
287
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsFormDirective, decorators: [{
|
|
284
288
|
type: Directive,
|
|
285
289
|
args: [{ selector: '[ngxsForm]', standalone: true }]
|
|
286
|
-
}], propDecorators: { path: [{
|
|
290
|
+
}], ctorParameters: () => [], propDecorators: { path: [{
|
|
287
291
|
type: Input,
|
|
288
292
|
args: ['ngxsForm']
|
|
289
293
|
}], debounce: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngxs-form-plugin.mjs","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 readonly type = '[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 readonly type = '[Forms] Update Form Value';\n\n constructor(public payload: { value: any; path: string; propertyPath?: string }) {}\n}\n\nexport class UpdateForm {\n static readonly type = '[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 readonly type = '[Forms] Update Form Dirty';\n\n constructor(public payload: { dirty: boolean | null; path: string }) {}\n}\n\nexport class SetFormDirty {\n static readonly type = '[Forms] Set Form Dirty';\n\n constructor(public payload: string) {}\n}\n\nexport class SetFormPristine {\n static readonly type = '[Forms] Set Form Pristine';\n\n constructor(public payload: string) {}\n}\n\nexport class UpdateFormErrors {\n static readonly type = '[Forms] Update Form Errors';\n\n constructor(public payload: { errors: { [k: string]: string } | null; path: string }) {}\n}\n\nexport class SetFormDisabled {\n static readonly type = '[Forms] Set Form Disabled';\n\n constructor(public payload: string) {}\n}\n\nexport class SetFormEnabled {\n static readonly type = '[Forms] Set Form Enabled';\n\n constructor(public payload: string) {}\n}\n\nexport class ResetForm {\n static readonly type = '[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/plugins';\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, inject, Input, OnDestroy, OnInit } from '@angular/core';\nimport { FormGroup, FormGroupDirective } from '@angular/forms';\nimport { Actions, ofActionDispatched, Store } from '@ngxs/store';\nimport { getValue } from '@ngxs/store/plugins';\nimport { Observable, ReplaySubject } 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]', standalone: true })\nexport class NgxsFormDirective implements OnInit, OnDestroy {\n @Input('ngxsForm')\n path: string = null!;\n\n @Input('ngxsFormDebounce')\n set debounce(debounce: string | number) {\n this._debounce = Number(debounce);\n }\n get debounce() {\n return this._debounce;\n }\n private _debounce = 100;\n\n @Input('ngxsFormClearOnDestroy')\n set clearDestroy(val: boolean) {\n this._clearDestroy = val != null && `${val}` !== 'false';\n }\n get clearDestroy(): boolean {\n return this._clearDestroy;\n }\n private _clearDestroy = false;\n\n private _updating = false;\n\n private _actions$ = inject(Actions);\n private _store = inject(Store);\n private _formGroupDirective = inject(FormGroupDirective);\n private _cd = inject(ChangeDetectorRef);\n\n private readonly _destroy$ = new ReplaySubject<void>(1);\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\n ngOnDestroy() {\n this._destroy$.next();\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, EnvironmentProviders } from '@angular/core';\nimport { withNgxsPlugin } from '@ngxs/store';\n\nimport { NgxsFormPlugin } from './form.plugin';\nimport { NgxsFormDirective } from './directive';\n\n@NgModule({\n imports: [NgxsFormDirective],\n exports: [NgxsFormDirective]\n})\nexport class NgxsFormPluginModule {\n static forRoot(): ModuleWithProviders<NgxsFormPluginModule> {\n return {\n ngModule: NgxsFormPluginModule,\n providers: [withNgxsPlugin(NgxsFormPlugin)]\n };\n }\n}\n\nexport function withNgxsFormPlugin(): EnvironmentProviders {\n return withNgxsPlugin(NgxsFormPlugin);\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;aACX,IAAI,CAAA,IAAA,GAAG,4BAA4B,CAAC;AAEpD,IAAA,WAAA,CACS,OAGN,EAAA;QAHM,IAAO,CAAA,OAAA,GAAP,OAAO;;;MAOL,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EhB,oBAAoB,EAAA,CAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAJhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,iBAAiB,CAAC;oBAC5B,OAAO,EAAE,CAAC,iBAAiB;AAC5B,iBAAA;;SAUe,kBAAkB,GAAA;AAChC,IAAA,OAAO,cAAc,CAAC,cAAc,CAAC;AACvC;;ACrBA;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngxs-form-plugin.mjs","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 readonly type = '[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 readonly type = '[Forms] Update Form Value';\n\n constructor(public payload: { value: any; path: string; propertyPath?: string }) {}\n}\n\nexport class UpdateForm {\n static readonly type = '[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 readonly type = '[Forms] Update Form Dirty';\n\n constructor(public payload: { dirty: boolean | null; path: string }) {}\n}\n\nexport class SetFormDirty {\n static readonly type = '[Forms] Set Form Dirty';\n\n constructor(public payload: string) {}\n}\n\nexport class SetFormPristine {\n static readonly type = '[Forms] Set Form Pristine';\n\n constructor(public payload: string) {}\n}\n\nexport class UpdateFormErrors {\n static readonly type = '[Forms] Update Form Errors';\n\n constructor(public payload: { errors: { [k: string]: string } | null; path: string }) {}\n}\n\nexport class SetFormDisabled {\n static readonly type = '[Forms] Set Form Disabled';\n\n constructor(public payload: string) {}\n}\n\nexport class SetFormEnabled {\n static readonly type = '[Forms] Set Form Enabled';\n\n constructor(public payload: string) {}\n}\n\nexport class ResetForm {\n static readonly type = '[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/plugins';\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 {\n ChangeDetectorRef,\n DestroyRef,\n Directive,\n inject,\n Input,\n OnInit\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormGroup, FormGroupDirective } from '@angular/forms';\nimport { Actions, ofActionDispatched, Store } from '@ngxs/store';\nimport { getValue } from '@ngxs/store/plugins';\nimport { Observable, debounceTime, distinctUntilChanged } from 'rxjs';\n\nimport {\n ResetForm,\n UpdateForm,\n UpdateFormDirty,\n UpdateFormErrors,\n UpdateFormStatus,\n UpdateFormValue\n} from './actions';\n\n@Directive({ selector: '[ngxsForm]', standalone: true })\nexport class NgxsFormDirective implements OnInit {\n @Input('ngxsForm')\n path: string = null!;\n\n @Input('ngxsFormDebounce')\n set debounce(debounce: string | number) {\n this._debounce = Number(debounce);\n }\n get debounce() {\n return this._debounce;\n }\n private _debounce = 100;\n\n @Input('ngxsFormClearOnDestroy')\n set clearDestroy(val: boolean) {\n this._clearDestroy = val != null && `${val}` !== 'false';\n }\n get clearDestroy(): boolean {\n return this._clearDestroy;\n }\n private _clearDestroy = false;\n\n private _updating = false;\n\n private _actions$ = inject(Actions);\n private _store = inject(Store);\n private _formGroupDirective = inject(FormGroupDirective);\n private _cd = inject(ChangeDetectorRef);\n\n private readonly _destroyRef = inject(DestroyRef);\n\n constructor() {\n this._destroyRef.onDestroy(() => {\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\n ngOnInit() {\n const resetForm$ = this._actions$.pipe(\n ofActionDispatched(ResetForm),\n takeUntilDestroyed(this._destroyRef)\n );\n\n resetForm$.subscribe((action: ResetForm) => {\n if (action.payload.path !== this.path) {\n return;\n }\n\n this.form.reset(action.payload.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 .pipe(takeUntilDestroyed(this._destroyRef))\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\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(takeUntilDestroyed(this._destroyRef))\n : (change: Observable<any>) =>\n change.pipe(debounceTime(this._debounce), takeUntilDestroyed(this._destroyRef));\n }\n\n private get form(): FormGroup {\n return this._formGroupDirective.form;\n }\n\n private getStateStream(path: string) {\n return this._store\n .select(state => getValue(state, path))\n .pipe(takeUntilDestroyed(this._destroyRef));\n }\n}\n","import { NgModule, ModuleWithProviders, EnvironmentProviders } from '@angular/core';\nimport { withNgxsPlugin } from '@ngxs/store';\n\nimport { NgxsFormPlugin } from './form.plugin';\nimport { NgxsFormDirective } from './directive';\n\n@NgModule({\n imports: [NgxsFormDirective],\n exports: [NgxsFormDirective]\n})\nexport class NgxsFormPluginModule {\n static forRoot(): ModuleWithProviders<NgxsFormPluginModule> {\n return {\n ngModule: NgxsFormPluginModule,\n providers: [withNgxsPlugin(NgxsFormPlugin)]\n };\n }\n}\n\nexport function withNgxsFormPlugin(): EnvironmentProviders {\n return withNgxsPlugin(NgxsFormPlugin);\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;aACX,IAAI,CAAA,IAAA,GAAG,4BAA4B,CAAC;AAEpD,IAAA,WAAA,CACS,OAGN,EAAA;QAHM,IAAO,CAAA,OAAA,GAAP,OAAO;;;MAOL,eAAe,CAA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AA,CACjB,iBAAiB,CAAA,EAAA,CAAA,CAAA;kIAEhB,oBAAoB,EAAA,CAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAJhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,iBAAiB,CAAC;oBAC5B,OAAO,EAAE,CAAC,iBAAiB;AAC5B,iBAAA;;SAUe,kBAAkB,GAAA;AAChC,IAAA,OAAO,cAAc,CAAC,cAAc,CAAC;AACvC;;ACrBA;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { OnInit,
|
|
2
|
+
import { OnInit, ModuleWithProviders, EnvironmentProviders } from '@angular/core';
|
|
3
3
|
import { NgxsPlugin, NgxsNextPluginFn } from '@ngxs/store/plugins';
|
|
4
4
|
|
|
5
|
-
declare class NgxsFormDirective implements OnInit
|
|
5
|
+
declare class NgxsFormDirective implements OnInit {
|
|
6
6
|
path: string;
|
|
7
7
|
set debounce(debounce: string | number);
|
|
8
8
|
get debounce(): string | number;
|
|
@@ -15,10 +15,10 @@ declare class NgxsFormDirective implements OnInit, OnDestroy {
|
|
|
15
15
|
private _store;
|
|
16
16
|
private _formGroupDirective;
|
|
17
17
|
private _cd;
|
|
18
|
-
private readonly
|
|
18
|
+
private readonly _destroyRef;
|
|
19
|
+
constructor();
|
|
19
20
|
ngOnInit(): void;
|
|
20
21
|
updateFormStateWithRawValue(withFormStatus?: boolean): void;
|
|
21
|
-
ngOnDestroy(): void;
|
|
22
22
|
private debounceChange;
|
|
23
23
|
private get form();
|
|
24
24
|
private getStateStream;
|
package/package.json
CHANGED