@ngxs/form-plugin 19.0.0 → 20.0.0-dev.master-0db0003

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.
@@ -1,67 +1,77 @@
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, Input, Directive, 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 { ReplaySubject } from 'rxjs';
7
- import { filter, takeUntil, distinctUntilChanged, debounceTime } from 'rxjs/operators';
7
+ import { distinctUntilChanged, debounceTime } from 'rxjs';
8
8
 
9
9
  class UpdateFormStatus {
10
- static { this.type = '[Forms] Update Form Status'; }
10
+ payload;
11
+ static type = '[Forms] Update Form Status';
11
12
  constructor(payload) {
12
13
  this.payload = payload;
13
14
  }
14
15
  }
15
16
  class UpdateFormValue {
16
- static { this.type = '[Forms] Update Form Value'; }
17
+ payload;
18
+ static type = '[Forms] Update Form Value';
17
19
  constructor(payload) {
18
20
  this.payload = payload;
19
21
  }
20
22
  }
21
23
  class UpdateForm {
22
- static { this.type = '[Forms] Update Form'; }
24
+ payload;
25
+ static type = '[Forms] Update Form';
23
26
  constructor(payload) {
24
27
  this.payload = payload;
25
28
  }
26
29
  }
27
30
  class UpdateFormDirty {
28
- static { this.type = '[Forms] Update Form Dirty'; }
31
+ payload;
32
+ static type = '[Forms] Update Form Dirty';
29
33
  constructor(payload) {
30
34
  this.payload = payload;
31
35
  }
32
36
  }
33
37
  class SetFormDirty {
34
- static { this.type = '[Forms] Set Form Dirty'; }
38
+ payload;
39
+ static type = '[Forms] Set Form Dirty';
35
40
  constructor(payload) {
36
41
  this.payload = payload;
37
42
  }
38
43
  }
39
44
  class SetFormPristine {
40
- static { this.type = '[Forms] Set Form Pristine'; }
45
+ payload;
46
+ static type = '[Forms] Set Form Pristine';
41
47
  constructor(payload) {
42
48
  this.payload = payload;
43
49
  }
44
50
  }
45
51
  class UpdateFormErrors {
46
- static { this.type = '[Forms] Update Form Errors'; }
52
+ payload;
53
+ static type = '[Forms] Update Form Errors';
47
54
  constructor(payload) {
48
55
  this.payload = payload;
49
56
  }
50
57
  }
51
58
  class SetFormDisabled {
52
- static { this.type = '[Forms] Set Form Disabled'; }
59
+ payload;
60
+ static type = '[Forms] Set Form Disabled';
53
61
  constructor(payload) {
54
62
  this.payload = payload;
55
63
  }
56
64
  }
57
65
  class SetFormEnabled {
58
- static { this.type = '[Forms] Set Form Enabled'; }
66
+ payload;
67
+ static type = '[Forms] Set Form Enabled';
59
68
  constructor(payload) {
60
69
  this.payload = payload;
61
70
  }
62
71
  }
63
72
  class ResetForm {
64
- static { this.type = '[Forms] Reset Form'; }
73
+ payload;
74
+ static type = '[Forms] Reset Form';
65
75
  constructor(payload) {
66
76
  this.payload = payload;
67
77
  }
@@ -117,10 +127,10 @@ class NgxsFormPlugin {
117
127
  }
118
128
  return path;
119
129
  }
120
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsFormPlugin, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
121
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsFormPlugin }); }
130
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsFormPlugin, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
131
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsFormPlugin });
122
132
  }
123
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsFormPlugin, decorators: [{
133
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsFormPlugin, decorators: [{
124
134
  type: Injectable
125
135
  }] });
126
136
  function isObjectLike(target) {
@@ -128,34 +138,47 @@ function isObjectLike(target) {
128
138
  }
129
139
 
130
140
  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
- }
141
+ path = null;
142
142
  set debounce(debounce) {
143
143
  this._debounce = Number(debounce);
144
144
  }
145
145
  get debounce() {
146
146
  return this._debounce;
147
147
  }
148
+ _debounce = 100;
148
149
  set clearDestroy(val) {
149
150
  this._clearDestroy = val != null && `${val}` !== 'false';
150
151
  }
151
152
  get clearDestroy() {
152
153
  return this._clearDestroy;
153
154
  }
155
+ _clearDestroy = false;
156
+ _updating = false;
157
+ _actions$ = inject(Actions);
158
+ _store = inject(Store);
159
+ _formGroupDirective = inject(FormGroupDirective);
160
+ _cd = inject(ChangeDetectorRef);
161
+ _destroyRef = inject(DestroyRef);
162
+ constructor() {
163
+ this._destroyRef.onDestroy(() => {
164
+ if (this.clearDestroy) {
165
+ this._store.dispatch(new UpdateForm({
166
+ path: this.path,
167
+ value: null,
168
+ dirty: null,
169
+ status: null,
170
+ errors: null
171
+ }));
172
+ }
173
+ });
174
+ }
154
175
  ngOnInit() {
155
- this._actions$
156
- .pipe(ofActionDispatched(ResetForm), filter((action) => action.payload.path === this.path), takeUntil(this._destroy$))
157
- .subscribe(({ payload: { value } }) => {
158
- this.form.reset(value);
176
+ const resetForm$ = this._actions$.pipe(ofActionDispatched(ResetForm), takeUntilDestroyed(this._destroyRef));
177
+ resetForm$.subscribe((action) => {
178
+ if (action.payload.path !== this.path) {
179
+ return;
180
+ }
181
+ this.form.reset(action.payload.value);
159
182
  this.updateFormStateWithRawValue(true);
160
183
  this._cd.markForCheck();
161
184
  });
@@ -181,6 +204,7 @@ class NgxsFormDirective {
181
204
  // On first state change, sync form model, status and dirty with state
182
205
  this._store
183
206
  .selectOnce(state => getValue(state, this.path))
207
+ .pipe(takeUntilDestroyed(this._destroyRef))
184
208
  .subscribe(() => {
185
209
  this._store.dispatch([
186
210
  new UpdateFormValue({
@@ -253,37 +277,27 @@ class NgxsFormDirective {
253
277
  complete: () => (this._updating = false)
254
278
  });
255
279
  }
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
280
  debounceChange() {
269
281
  const skipDebounceTime = this._formGroupDirective.control.updateOn !== 'change' || this._debounce < 0;
270
282
  return skipDebounceTime
271
- ? (change) => change.pipe(takeUntil(this._destroy$))
272
- : (change) => change.pipe(debounceTime(this._debounce), takeUntil(this._destroy$));
283
+ ? (change) => change.pipe(takeUntilDestroyed(this._destroyRef))
284
+ : (change) => change.pipe(debounceTime(this._debounce), takeUntilDestroyed(this._destroyRef));
273
285
  }
274
286
  get form() {
275
287
  return this._formGroupDirective.form;
276
288
  }
277
289
  getStateStream(path) {
278
- return this._store.select(state => getValue(state, path)).pipe(takeUntil(this._destroy$));
290
+ return this._store
291
+ .select(state => getValue(state, path))
292
+ .pipe(takeUntilDestroyed(this._destroyRef));
279
293
  }
280
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsFormDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
281
- /** @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 }); }
294
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsFormDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
295
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.3", type: NgxsFormDirective, isStandalone: true, selector: "[ngxsForm]", inputs: { path: ["ngxsForm", "path"], debounce: ["ngxsFormDebounce", "debounce"], clearDestroy: ["ngxsFormClearOnDestroy", "clearDestroy"] }, ngImport: i0 });
282
296
  }
283
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsFormDirective, decorators: [{
297
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsFormDirective, decorators: [{
284
298
  type: Directive,
285
299
  args: [{ selector: '[ngxsForm]', standalone: true }]
286
- }], propDecorators: { path: [{
300
+ }], ctorParameters: () => [], propDecorators: { path: [{
287
301
  type: Input,
288
302
  args: ['ngxsForm']
289
303
  }], debounce: [{
@@ -301,11 +315,11 @@ class NgxsFormPluginModule {
301
315
  providers: [withNgxsPlugin(NgxsFormPlugin)]
302
316
  };
303
317
  }
304
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsFormPluginModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
305
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0", ngImport: i0, type: NgxsFormPluginModule, imports: [NgxsFormDirective], exports: [NgxsFormDirective] }); }
306
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsFormPluginModule }); }
318
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsFormPluginModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
319
+ /** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.3", ngImport: i0, type: NgxsFormPluginModule, imports: [NgxsFormDirective], exports: [NgxsFormDirective] });
320
+ /** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsFormPluginModule });
307
321
  }
308
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgxsFormPluginModule, decorators: [{
322
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.3", ngImport: i0, type: NgxsFormPluginModule, decorators: [{
309
323
  type: NgModule,
310
324
  args: [{
311
325
  imports: [NgxsFormDirective],
@@ -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,eAAe,CAAA;aACV,IAAI,CAAA,IAAA,GAAG,2BAA2B,CAAC;AAEnD,IAAA,WAAA,CAAmB,OAA4D,EAAA;QAA5D,IAAO,CAAA,OAAA,GAAP,OAAO;;;MAGf,UAAU,CAAA;aACL,IAAI,CAAA,IAAA,GAAG,qBAAqB,CAAC;AAE7C,IAAA,WAAA,CACS,OAMN,EAAA;QANM,IAAO,CAAA,OAAA,GAAP,OAAO;;;MAUL,eAAe,CAAA;aACV,IAAI,CAAA,IAAA,GAAG,2BAA2B,CAAC;AAEnD,IAAA,WAAA,CAAmB,OAAgD,EAAA;QAAhD,IAAO,CAAA,OAAA,GAAP,OAAO;;;MAGf,YAAY,CAAA;aACP,IAAI,CAAA,IAAA,GAAG,wBAAwB,CAAC;AAEhD,IAAA,WAAA,CAAmB,OAAe,EAAA;QAAf,IAAO,CAAA,OAAA,GAAP,OAAO;;;MAGf,eAAe,CAAA;aACV,IAAI,CAAA,IAAA,GAAG,2BAA2B,CAAC;AAEnD,IAAA,WAAA,CAAmB,OAAe,EAAA;QAAf,IAAO,CAAA,OAAA,GAAP,OAAO;;;MAGf,gBAAgB,CAAA;aACX,IAAI,CAAA,IAAA,GAAG,4BAA4B,CAAC;AAEpD,IAAA,WAAA,CAAmB,OAAiE,EAAA;QAAjE,IAAO,CAAA,OAAA,GAAP,OAAO;;;MAGf,eAAe,CAAA;aACV,IAAI,CAAA,IAAA,GAAG,2BAA2B,CAAC;AAEnD,IAAA,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Z,OAAO;AACL,YAAA,QAAQ,EAAE,oBAAoB;AAC9B,YAAA,SAAS,EAAE,CAAC,cAAc,CAAC,cAAc,CAAC;SAC3C;;iIALQ,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;kIAApB,oBAAoB,EAAA,OAAA,EAAA,CAHrB,iBAAiB,CAAA,EAAA,OAAA,EAAA,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;;;;"}
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;AAIlB,IAAA,OAAA;AAHT,IAAA,OAAgB,IAAI,GAAG,4BAA4B;AAEnD,IAAA,WAAA,CACS,OAGN,EAAA;QAHM,IAAO,CAAA,OAAA,GAAP,OAAO;;;MAOL,eAAe,CAAA;AAGP,IAAA,OAAA;AAFnB,IAAA,OAAgB,IAAI,GAAG,2BAA2B;AAElD,IAAA,WAAA,CAAmB,OAA4D,EAAA;QAA5D,IAAO,CAAA,OAAA,GAAP,OAAO;;;MAGf,UAAU,CAAA;AAIZ,IAAA,OAAA;AAHT,IAAA,OAAgB,IAAI,GAAG,qBAAqB;AAE5C,IAAA,WAAA,CACS,OAMN,EAAA;QANM,IAAO,CAAA,OAAA,GAAP,OAAO;;;MAUL,eAAe,CAAA;AAGP,IAAA,OAAA;AAFnB,IAAA,OAAgB,IAAI,GAAG,2BAA2B;AAElD,IAAA,WAAA,CAAmB,OAAgD,EAAA;QAAhD,IAAO,CAAA,OAAA,GAAP,OAAO;;;MAGf,YAAY,CAAA;AAGJ,IAAA,OAAA;AAFnB,IAAA,OAAgB,IAAI,GAAG,wBAAwB;AAE/C,IAAA,WAAA,CAAmB,OAAe,EAAA;QAAf,IAAO,CAAA,OAAA,GAAP,OAAO;;;MAGf,eAAe,CAAA;AAGP,IAAA,OAAA;AAFnB,IAAA,OAAgB,IAAI,GAAG,2BAA2B;AAElD,IAAA,WAAA,CAAmB,OAAe,EAAA;QAAf,IAAO,CAAA,OAAA,GAAP,OAAO;;;MAGf,gBAAgB,CAAA;AAGR,IAAA,OAAA;AAFnB,IAAA,OAAgB,IAAI,GAAG,4BAA4B;AAEnD,IAAA,WAAA,CAAmB,OAAiE,EAAA;QAAjE,IAAO,CAAA,OAAA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;;MC3BpB,oBAAoB,CAAA;AAC/B,IAAA,OAAO,OAAO,GAAA;QACZ,OAAO;AACL,YAAA,QAAQ,EAAE,oBAAoB;AAC9B,YAAA,SAAS,EAAE,CAAC,cAAc,CAAC,cAAc,CAAC;SAC3C;;0HALQ,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;2HAApB,oBAAoB,EAAA,OAAA,EAAA,CAHrB,iBAAiB,CAAA,EAAA,OAAA,EAAA,CACjB,iBAAiB,CAAA,EAAA,CAAA;2HAEhB,oBAAoB,EAAA,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, OnDestroy, ModuleWithProviders, EnvironmentProviders } from '@angular/core';
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, OnDestroy {
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 _destroy$;
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
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@ngxs/form-plugin",
3
3
  "description": "form plugin for @ngxs/store",
4
- "version": "19.0.0",
4
+ "version": "20.0.0-dev.master-0db0003",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
- "@ngxs/store": "^19.0.0 || ^19.0.0-dev",
8
- "@angular/core": ">=19.0.0 <20.0.0",
9
- "@angular/forms": ">=19.0.0 <20.0.0",
10
- "rxjs": ">=6.5.5"
7
+ "@angular/core": ">=20.0.0 <21.0.0",
8
+ "@angular/forms": ">=20.0.0 <21.0.0",
9
+ "@ngxs/store": "^20.0.0 || ^20.0.0-dev",
10
+ "rxjs": ">=7.0.0"
11
11
  },
12
12
  "module": "fesm2022/ngxs-form-plugin.mjs",
13
13
  "typings": "index.d.ts",
@@ -67,4 +67,4 @@
67
67
  "type": "opencollective",
68
68
  "url": "https://opencollective.com/ngxs"
69
69
  }
70
- }
70
+ }