@ngxs/form-plugin 3.7.6-dev.master-fb318b1 → 3.7.6-dev.master-40a2210
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,233 +1,117 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Directive, Input, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1 from '@ngxs/store';
|
|
4
|
+
import { getActionTypeFromInstance, setValue, getValue, ofActionDispatched, NGXS_PLUGINS } from '@ngxs/store';
|
|
5
|
+
import * as i2 from '@angular/forms';
|
|
6
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
4
7
|
import { Subject } from 'rxjs';
|
|
5
8
|
import { filter, takeUntil, distinctUntilChanged, debounceTime } from 'rxjs/operators';
|
|
6
9
|
|
|
7
|
-
/**
|
|
8
|
-
* @fileoverview added by tsickle
|
|
9
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
10
|
-
*/
|
|
11
10
|
class UpdateFormStatus {
|
|
12
|
-
/**
|
|
13
|
-
* @param {?} payload
|
|
14
|
-
*/
|
|
15
11
|
constructor(payload) {
|
|
16
12
|
this.payload = payload;
|
|
17
13
|
}
|
|
18
|
-
/**
|
|
19
|
-
* @return {?}
|
|
20
|
-
*/
|
|
21
14
|
static get type() {
|
|
22
15
|
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
23
16
|
return '[Forms] Update Form Status';
|
|
24
17
|
}
|
|
25
18
|
}
|
|
26
|
-
if (false) {
|
|
27
|
-
/** @type {?} */
|
|
28
|
-
UpdateFormStatus.prototype.payload;
|
|
29
|
-
}
|
|
30
19
|
class UpdateFormValue {
|
|
31
|
-
/**
|
|
32
|
-
* @param {?} payload
|
|
33
|
-
*/
|
|
34
20
|
constructor(payload) {
|
|
35
21
|
this.payload = payload;
|
|
36
22
|
}
|
|
37
|
-
/**
|
|
38
|
-
* @return {?}
|
|
39
|
-
*/
|
|
40
23
|
static get type() {
|
|
41
24
|
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
42
25
|
return '[Forms] Update Form Value';
|
|
43
26
|
}
|
|
44
27
|
}
|
|
45
|
-
if (false) {
|
|
46
|
-
/** @type {?} */
|
|
47
|
-
UpdateFormValue.prototype.payload;
|
|
48
|
-
}
|
|
49
28
|
class UpdateForm {
|
|
50
|
-
/**
|
|
51
|
-
* @param {?} payload
|
|
52
|
-
*/
|
|
53
29
|
constructor(payload) {
|
|
54
30
|
this.payload = payload;
|
|
55
31
|
}
|
|
56
|
-
/**
|
|
57
|
-
* @return {?}
|
|
58
|
-
*/
|
|
59
32
|
static get type() {
|
|
60
33
|
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
61
34
|
return '[Forms] Update Form';
|
|
62
35
|
}
|
|
63
36
|
}
|
|
64
|
-
if (false) {
|
|
65
|
-
/** @type {?} */
|
|
66
|
-
UpdateForm.prototype.payload;
|
|
67
|
-
}
|
|
68
37
|
class UpdateFormDirty {
|
|
69
|
-
/**
|
|
70
|
-
* @param {?} payload
|
|
71
|
-
*/
|
|
72
38
|
constructor(payload) {
|
|
73
39
|
this.payload = payload;
|
|
74
40
|
}
|
|
75
|
-
/**
|
|
76
|
-
* @return {?}
|
|
77
|
-
*/
|
|
78
41
|
static get type() {
|
|
79
42
|
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
80
43
|
return '[Forms] Update Form Dirty';
|
|
81
44
|
}
|
|
82
45
|
}
|
|
83
|
-
if (false) {
|
|
84
|
-
/** @type {?} */
|
|
85
|
-
UpdateFormDirty.prototype.payload;
|
|
86
|
-
}
|
|
87
46
|
class SetFormDirty {
|
|
88
|
-
/**
|
|
89
|
-
* @param {?} payload
|
|
90
|
-
*/
|
|
91
47
|
constructor(payload) {
|
|
92
48
|
this.payload = payload;
|
|
93
49
|
}
|
|
94
|
-
/**
|
|
95
|
-
* @return {?}
|
|
96
|
-
*/
|
|
97
50
|
static get type() {
|
|
98
51
|
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
99
52
|
return '[Forms] Set Form Dirty';
|
|
100
53
|
}
|
|
101
54
|
}
|
|
102
|
-
if (false) {
|
|
103
|
-
/** @type {?} */
|
|
104
|
-
SetFormDirty.prototype.payload;
|
|
105
|
-
}
|
|
106
55
|
class SetFormPristine {
|
|
107
|
-
/**
|
|
108
|
-
* @param {?} payload
|
|
109
|
-
*/
|
|
110
56
|
constructor(payload) {
|
|
111
57
|
this.payload = payload;
|
|
112
58
|
}
|
|
113
|
-
/**
|
|
114
|
-
* @return {?}
|
|
115
|
-
*/
|
|
116
59
|
static get type() {
|
|
117
60
|
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
118
61
|
return '[Forms] Set Form Pristine';
|
|
119
62
|
}
|
|
120
63
|
}
|
|
121
|
-
if (false) {
|
|
122
|
-
/** @type {?} */
|
|
123
|
-
SetFormPristine.prototype.payload;
|
|
124
|
-
}
|
|
125
64
|
class UpdateFormErrors {
|
|
126
|
-
/**
|
|
127
|
-
* @param {?} payload
|
|
128
|
-
*/
|
|
129
65
|
constructor(payload) {
|
|
130
66
|
this.payload = payload;
|
|
131
67
|
}
|
|
132
|
-
/**
|
|
133
|
-
* @return {?}
|
|
134
|
-
*/
|
|
135
68
|
static get type() {
|
|
136
69
|
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
137
70
|
return '[Forms] Update Form Errors';
|
|
138
71
|
}
|
|
139
72
|
}
|
|
140
|
-
if (false) {
|
|
141
|
-
/** @type {?} */
|
|
142
|
-
UpdateFormErrors.prototype.payload;
|
|
143
|
-
}
|
|
144
73
|
class SetFormDisabled {
|
|
145
|
-
/**
|
|
146
|
-
* @param {?} payload
|
|
147
|
-
*/
|
|
148
74
|
constructor(payload) {
|
|
149
75
|
this.payload = payload;
|
|
150
76
|
}
|
|
151
|
-
/**
|
|
152
|
-
* @return {?}
|
|
153
|
-
*/
|
|
154
77
|
static get type() {
|
|
155
78
|
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
156
79
|
return '[Forms] Set Form Disabled';
|
|
157
80
|
}
|
|
158
81
|
}
|
|
159
|
-
if (false) {
|
|
160
|
-
/** @type {?} */
|
|
161
|
-
SetFormDisabled.prototype.payload;
|
|
162
|
-
}
|
|
163
82
|
class SetFormEnabled {
|
|
164
|
-
/**
|
|
165
|
-
* @param {?} payload
|
|
166
|
-
*/
|
|
167
83
|
constructor(payload) {
|
|
168
84
|
this.payload = payload;
|
|
169
85
|
}
|
|
170
|
-
/**
|
|
171
|
-
* @return {?}
|
|
172
|
-
*/
|
|
173
86
|
static get type() {
|
|
174
87
|
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
175
88
|
return '[Forms] Set Form Enabled';
|
|
176
89
|
}
|
|
177
90
|
}
|
|
178
|
-
if (false) {
|
|
179
|
-
/** @type {?} */
|
|
180
|
-
SetFormEnabled.prototype.payload;
|
|
181
|
-
}
|
|
182
91
|
class ResetForm {
|
|
183
|
-
/**
|
|
184
|
-
* @param {?} payload
|
|
185
|
-
*/
|
|
186
92
|
constructor(payload) {
|
|
187
93
|
this.payload = payload;
|
|
188
94
|
}
|
|
189
|
-
/**
|
|
190
|
-
* @return {?}
|
|
191
|
-
*/
|
|
192
95
|
static get type() {
|
|
193
96
|
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
194
97
|
return '[Forms] Reset Form';
|
|
195
98
|
}
|
|
196
99
|
}
|
|
197
|
-
if (false) {
|
|
198
|
-
/** @type {?} */
|
|
199
|
-
ResetForm.prototype.payload;
|
|
200
|
-
}
|
|
201
100
|
|
|
202
|
-
/**
|
|
203
|
-
* @fileoverview added by tsickle
|
|
204
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
205
|
-
*/
|
|
206
101
|
class NgxsFormPlugin {
|
|
207
|
-
/**
|
|
208
|
-
* @param {?} state
|
|
209
|
-
* @param {?} event
|
|
210
|
-
* @param {?} next
|
|
211
|
-
* @return {?}
|
|
212
|
-
*/
|
|
213
102
|
handle(state, event, next) {
|
|
214
|
-
/** @type {?} */
|
|
215
103
|
const type = getActionTypeFromInstance(event);
|
|
216
|
-
/** @type {?} */
|
|
217
104
|
let nextState = state;
|
|
218
105
|
if (type === UpdateFormValue.type || type === UpdateForm.type || type === ResetForm.type) {
|
|
219
106
|
const { value } = event.payload;
|
|
220
|
-
/** @type {?} */
|
|
221
107
|
const payloadValue = Array.isArray(value)
|
|
222
108
|
? value.slice()
|
|
223
109
|
: isObjectLike(value)
|
|
224
110
|
? Object.assign({}, value) : value;
|
|
225
|
-
/** @type {?} */
|
|
226
111
|
const path = this.joinPathWithPropertyPath(event);
|
|
227
112
|
nextState = setValue(nextState, path, payloadValue);
|
|
228
113
|
}
|
|
229
114
|
if (type === ResetForm.type) {
|
|
230
|
-
/** @type {?} */
|
|
231
115
|
const model = getValue(nextState, `${event.payload.path}.model`);
|
|
232
116
|
nextState = setValue(nextState, `${event.payload.path}`, { model: model });
|
|
233
117
|
}
|
|
@@ -254,13 +138,7 @@ class NgxsFormPlugin {
|
|
|
254
138
|
}
|
|
255
139
|
return next(nextState, event);
|
|
256
140
|
}
|
|
257
|
-
/**
|
|
258
|
-
* @private
|
|
259
|
-
* @param {?} __0
|
|
260
|
-
* @return {?}
|
|
261
|
-
*/
|
|
262
141
|
joinPathWithPropertyPath({ payload }) {
|
|
263
|
-
/** @type {?} */
|
|
264
142
|
let path = `${payload.path}.model`;
|
|
265
143
|
if (payload.propertyPath) {
|
|
266
144
|
path += `.${payload.propertyPath}`;
|
|
@@ -268,87 +146,49 @@ class NgxsFormPlugin {
|
|
|
268
146
|
return path;
|
|
269
147
|
}
|
|
270
148
|
}
|
|
271
|
-
NgxsFormPlugin
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
* @return {?}
|
|
277
|
-
*/
|
|
149
|
+
/** @nocollapse */ NgxsFormPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsFormPlugin, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
150
|
+
/** @nocollapse */ NgxsFormPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsFormPlugin });
|
|
151
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsFormPlugin, decorators: [{
|
|
152
|
+
type: Injectable
|
|
153
|
+
}] });
|
|
278
154
|
function isObjectLike(target) {
|
|
279
155
|
return target !== null && typeof target === 'object';
|
|
280
156
|
}
|
|
281
157
|
|
|
282
|
-
/**
|
|
283
|
-
* @fileoverview added by tsickle
|
|
284
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
285
|
-
*/
|
|
286
158
|
class FormDirective {
|
|
287
|
-
/**
|
|
288
|
-
* @param {?} _actions$
|
|
289
|
-
* @param {?} _store
|
|
290
|
-
* @param {?} _formGroupDirective
|
|
291
|
-
* @param {?} _cd
|
|
292
|
-
*/
|
|
293
159
|
constructor(_actions$, _store, _formGroupDirective, _cd) {
|
|
294
160
|
this._actions$ = _actions$;
|
|
295
161
|
this._store = _store;
|
|
296
162
|
this._formGroupDirective = _formGroupDirective;
|
|
297
163
|
this._cd = _cd;
|
|
298
|
-
this.path =
|
|
164
|
+
this.path = null;
|
|
299
165
|
this.debounce = 100;
|
|
300
166
|
this._clearDestroy = false;
|
|
301
167
|
this._destroy$ = new Subject();
|
|
302
168
|
this._updating = false;
|
|
303
169
|
}
|
|
304
|
-
/**
|
|
305
|
-
* @param {?} val
|
|
306
|
-
* @return {?}
|
|
307
|
-
*/
|
|
308
170
|
set clearDestroy(val) {
|
|
309
171
|
this._clearDestroy = val != null && `${val}` !== 'false';
|
|
310
172
|
}
|
|
311
|
-
/**
|
|
312
|
-
* @return {?}
|
|
313
|
-
*/
|
|
314
173
|
get clearDestroy() {
|
|
315
174
|
return this._clearDestroy;
|
|
316
175
|
}
|
|
317
|
-
/**
|
|
318
|
-
* @return {?}
|
|
319
|
-
*/
|
|
320
176
|
ngOnInit() {
|
|
321
177
|
this._actions$
|
|
322
|
-
.pipe(ofActionDispatched(ResetForm), filter((
|
|
323
|
-
|
|
324
|
-
* @return {?}
|
|
325
|
-
*/
|
|
326
|
-
(action) => action.payload.path === this.path)), takeUntil(this._destroy$))
|
|
327
|
-
.subscribe((/**
|
|
328
|
-
* @param {?} __0
|
|
329
|
-
* @return {?}
|
|
330
|
-
*/
|
|
331
|
-
({ payload: { value } }) => {
|
|
178
|
+
.pipe(ofActionDispatched(ResetForm), filter((action) => action.payload.path === this.path), takeUntil(this._destroy$))
|
|
179
|
+
.subscribe(({ payload: { value } }) => {
|
|
332
180
|
this.form.reset(value);
|
|
333
181
|
this.updateFormStateWithRawValue(true);
|
|
334
182
|
this._cd.markForCheck();
|
|
335
|
-
})
|
|
336
|
-
this.getStateStream(`${this.path}.model`).subscribe(
|
|
337
|
-
* @param {?} model
|
|
338
|
-
* @return {?}
|
|
339
|
-
*/
|
|
340
|
-
model => {
|
|
183
|
+
});
|
|
184
|
+
this.getStateStream(`${this.path}.model`).subscribe(model => {
|
|
341
185
|
if (this._updating || !model) {
|
|
342
186
|
return;
|
|
343
187
|
}
|
|
344
188
|
this.form.patchValue(model);
|
|
345
189
|
this._cd.markForCheck();
|
|
346
|
-
})
|
|
347
|
-
this.getStateStream(`${this.path}.dirty`).subscribe(
|
|
348
|
-
* @param {?} dirty
|
|
349
|
-
* @return {?}
|
|
350
|
-
*/
|
|
351
|
-
dirty => {
|
|
190
|
+
});
|
|
191
|
+
this.getStateStream(`${this.path}.dirty`).subscribe(dirty => {
|
|
352
192
|
if (this.form.dirty === dirty || typeof dirty !== 'boolean') {
|
|
353
193
|
return;
|
|
354
194
|
}
|
|
@@ -359,18 +199,11 @@ class FormDirective {
|
|
|
359
199
|
this.form.markAsPristine();
|
|
360
200
|
}
|
|
361
201
|
this._cd.markForCheck();
|
|
362
|
-
})
|
|
202
|
+
});
|
|
363
203
|
// On first state change, sync form model, status and dirty with state
|
|
364
204
|
this._store
|
|
365
|
-
.selectOnce((
|
|
366
|
-
|
|
367
|
-
* @return {?}
|
|
368
|
-
*/
|
|
369
|
-
state => getValue(state, this.path)))
|
|
370
|
-
.subscribe((/**
|
|
371
|
-
* @return {?}
|
|
372
|
-
*/
|
|
373
|
-
() => {
|
|
205
|
+
.selectOnce(state => getValue(state, this.path))
|
|
206
|
+
.subscribe(() => {
|
|
374
207
|
this._store.dispatch([
|
|
375
208
|
new UpdateFormValue({
|
|
376
209
|
path: this.path,
|
|
@@ -385,12 +218,8 @@ class FormDirective {
|
|
|
385
218
|
dirty: this.form.dirty
|
|
386
219
|
})
|
|
387
220
|
]);
|
|
388
|
-
})
|
|
389
|
-
this.getStateStream(`${this.path}.disabled`).subscribe(
|
|
390
|
-
* @param {?} disabled
|
|
391
|
-
* @return {?}
|
|
392
|
-
*/
|
|
393
|
-
disabled => {
|
|
221
|
+
});
|
|
222
|
+
this.getStateStream(`${this.path}.disabled`).subscribe(disabled => {
|
|
394
223
|
if (this.form.disabled === disabled || typeof disabled !== 'boolean') {
|
|
395
224
|
return;
|
|
396
225
|
}
|
|
@@ -401,43 +230,25 @@ class FormDirective {
|
|
|
401
230
|
this.form.enable();
|
|
402
231
|
}
|
|
403
232
|
this._cd.markForCheck();
|
|
404
|
-
})
|
|
405
|
-
|
|
406
|
-
.valueChanges
|
|
407
|
-
|
|
408
|
-
* @param {?} b
|
|
409
|
-
* @return {?}
|
|
410
|
-
*/
|
|
411
|
-
(a, b) => JSON.stringify(a) === JSON.stringify(b))), this.debounceChange())
|
|
412
|
-
.subscribe((/**
|
|
413
|
-
* @return {?}
|
|
414
|
-
*/
|
|
415
|
-
() => {
|
|
233
|
+
});
|
|
234
|
+
this._formGroupDirective
|
|
235
|
+
.valueChanges.pipe(distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)), this.debounceChange())
|
|
236
|
+
.subscribe(() => {
|
|
416
237
|
this.updateFormStateWithRawValue();
|
|
417
|
-
})
|
|
418
|
-
|
|
419
|
-
.statusChanges
|
|
420
|
-
.subscribe((
|
|
421
|
-
* @param {?} status
|
|
422
|
-
* @return {?}
|
|
423
|
-
*/
|
|
424
|
-
(status) => {
|
|
238
|
+
});
|
|
239
|
+
this._formGroupDirective
|
|
240
|
+
.statusChanges.pipe(distinctUntilChanged(), this.debounceChange())
|
|
241
|
+
.subscribe((status) => {
|
|
425
242
|
this._store.dispatch(new UpdateFormStatus({
|
|
426
243
|
status,
|
|
427
244
|
path: this.path
|
|
428
245
|
}));
|
|
429
|
-
})
|
|
246
|
+
});
|
|
430
247
|
}
|
|
431
|
-
/**
|
|
432
|
-
* @param {?=} withFormStatus
|
|
433
|
-
* @return {?}
|
|
434
|
-
*/
|
|
435
248
|
updateFormStateWithRawValue(withFormStatus) {
|
|
436
249
|
if (this._updating)
|
|
437
250
|
return;
|
|
438
|
-
/** @type {?} */
|
|
439
251
|
const value = this._formGroupDirective.control.getRawValue();
|
|
440
|
-
/** @type {?} */
|
|
441
252
|
const actions = [
|
|
442
253
|
new UpdateFormValue({
|
|
443
254
|
path: this.path,
|
|
@@ -460,19 +271,10 @@ class FormDirective {
|
|
|
460
271
|
}
|
|
461
272
|
this._updating = true;
|
|
462
273
|
this._store.dispatch(actions).subscribe({
|
|
463
|
-
error: (
|
|
464
|
-
|
|
465
|
-
*/
|
|
466
|
-
() => (this._updating = false)),
|
|
467
|
-
complete: (/**
|
|
468
|
-
* @return {?}
|
|
469
|
-
*/
|
|
470
|
-
() => (this._updating = false))
|
|
274
|
+
error: () => (this._updating = false),
|
|
275
|
+
complete: () => (this._updating = false)
|
|
471
276
|
});
|
|
472
277
|
}
|
|
473
|
-
/**
|
|
474
|
-
* @return {?}
|
|
475
|
-
*/
|
|
476
278
|
ngOnDestroy() {
|
|
477
279
|
this._destroy$.next();
|
|
478
280
|
this._destroy$.complete();
|
|
@@ -486,107 +288,36 @@ class FormDirective {
|
|
|
486
288
|
}));
|
|
487
289
|
}
|
|
488
290
|
}
|
|
489
|
-
/**
|
|
490
|
-
* @private
|
|
491
|
-
* @return {?}
|
|
492
|
-
*/
|
|
493
291
|
debounceChange() {
|
|
494
|
-
/** @type {?} */
|
|
495
292
|
const skipDebounceTime = this._formGroupDirective.control.updateOn !== 'change' || this.debounce < 0;
|
|
496
293
|
return skipDebounceTime
|
|
497
|
-
? (
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
*/
|
|
501
|
-
(change) => change.pipe(takeUntil(this._destroy$)))
|
|
502
|
-
: (/**
|
|
503
|
-
* @param {?} change
|
|
504
|
-
* @return {?}
|
|
505
|
-
*/
|
|
506
|
-
(change) => change.pipe(debounceTime(this.debounce), takeUntil(this._destroy$)));
|
|
507
|
-
}
|
|
508
|
-
/**
|
|
509
|
-
* @private
|
|
510
|
-
* @return {?}
|
|
511
|
-
*/
|
|
294
|
+
? (change) => change.pipe(takeUntil(this._destroy$))
|
|
295
|
+
: (change) => change.pipe(debounceTime(this.debounce), takeUntil(this._destroy$));
|
|
296
|
+
}
|
|
512
297
|
get form() {
|
|
513
298
|
return this._formGroupDirective.form;
|
|
514
299
|
}
|
|
515
|
-
/**
|
|
516
|
-
* @private
|
|
517
|
-
* @param {?} path
|
|
518
|
-
* @return {?}
|
|
519
|
-
*/
|
|
520
300
|
getStateStream(path) {
|
|
521
|
-
return this._store.select((
|
|
522
|
-
* @param {?} state
|
|
523
|
-
* @return {?}
|
|
524
|
-
*/
|
|
525
|
-
state => getValue(state, path))).pipe(takeUntil(this._destroy$));
|
|
301
|
+
return this._store.select(state => getValue(state, path)).pipe(takeUntil(this._destroy$));
|
|
526
302
|
}
|
|
527
303
|
}
|
|
528
|
-
FormDirective
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
};
|
|
543
|
-
if (false) {
|
|
544
|
-
/** @type {?} */
|
|
545
|
-
FormDirective.prototype.path;
|
|
546
|
-
/** @type {?} */
|
|
547
|
-
FormDirective.prototype.debounce;
|
|
548
|
-
/** @type {?} */
|
|
549
|
-
FormDirective.prototype._clearDestroy;
|
|
550
|
-
/**
|
|
551
|
-
* @type {?}
|
|
552
|
-
* @private
|
|
553
|
-
*/
|
|
554
|
-
FormDirective.prototype._destroy$;
|
|
555
|
-
/**
|
|
556
|
-
* @type {?}
|
|
557
|
-
* @private
|
|
558
|
-
*/
|
|
559
|
-
FormDirective.prototype._updating;
|
|
560
|
-
/**
|
|
561
|
-
* @type {?}
|
|
562
|
-
* @private
|
|
563
|
-
*/
|
|
564
|
-
FormDirective.prototype._actions$;
|
|
565
|
-
/**
|
|
566
|
-
* @type {?}
|
|
567
|
-
* @private
|
|
568
|
-
*/
|
|
569
|
-
FormDirective.prototype._store;
|
|
570
|
-
/**
|
|
571
|
-
* @type {?}
|
|
572
|
-
* @private
|
|
573
|
-
*/
|
|
574
|
-
FormDirective.prototype._formGroupDirective;
|
|
575
|
-
/**
|
|
576
|
-
* @type {?}
|
|
577
|
-
* @private
|
|
578
|
-
*/
|
|
579
|
-
FormDirective.prototype._cd;
|
|
580
|
-
}
|
|
304
|
+
/** @nocollapse */ FormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FormDirective, deps: [{ token: i1.Actions }, { token: i1.Store }, { token: i2.FormGroupDirective }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
305
|
+
/** @nocollapse */ FormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: FormDirective, selector: "[ngxsForm]", inputs: { path: ["ngxsForm", "path"], debounce: ["ngxsFormDebounce", "debounce"], clearDestroy: ["ngxsFormClearOnDestroy", "clearDestroy"] }, ngImport: i0 });
|
|
306
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FormDirective, decorators: [{
|
|
307
|
+
type: Directive,
|
|
308
|
+
args: [{ selector: '[ngxsForm]' }]
|
|
309
|
+
}], ctorParameters: function () { return [{ type: i1.Actions }, { type: i1.Store }, { type: i2.FormGroupDirective }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { path: [{
|
|
310
|
+
type: Input,
|
|
311
|
+
args: ['ngxsForm']
|
|
312
|
+
}], debounce: [{
|
|
313
|
+
type: Input,
|
|
314
|
+
args: ['ngxsFormDebounce']
|
|
315
|
+
}], clearDestroy: [{
|
|
316
|
+
type: Input,
|
|
317
|
+
args: ['ngxsFormClearOnDestroy']
|
|
318
|
+
}] } });
|
|
581
319
|
|
|
582
|
-
/**
|
|
583
|
-
* @fileoverview added by tsickle
|
|
584
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
585
|
-
*/
|
|
586
320
|
class NgxsFormPluginModule {
|
|
587
|
-
/**
|
|
588
|
-
* @return {?}
|
|
589
|
-
*/
|
|
590
321
|
static forRoot() {
|
|
591
322
|
return {
|
|
592
323
|
ngModule: NgxsFormPluginModule,
|
|
@@ -600,28 +331,25 @@ class NgxsFormPluginModule {
|
|
|
600
331
|
};
|
|
601
332
|
}
|
|
602
333
|
}
|
|
603
|
-
NgxsFormPluginModule
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
]
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
*/
|
|
334
|
+
/** @nocollapse */ NgxsFormPluginModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsFormPluginModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
335
|
+
/** @nocollapse */ NgxsFormPluginModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsFormPluginModule, declarations: [FormDirective], imports: [ReactiveFormsModule], exports: [FormDirective] });
|
|
336
|
+
/** @nocollapse */ NgxsFormPluginModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsFormPluginModule, imports: [[ReactiveFormsModule]] });
|
|
337
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsFormPluginModule, decorators: [{
|
|
338
|
+
type: NgModule,
|
|
339
|
+
args: [{
|
|
340
|
+
imports: [ReactiveFormsModule],
|
|
341
|
+
declarations: [FormDirective],
|
|
342
|
+
exports: [FormDirective]
|
|
343
|
+
}]
|
|
344
|
+
}] });
|
|
615
345
|
|
|
616
346
|
/**
|
|
617
|
-
*
|
|
618
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
347
|
+
* The public api for consumers of @ngxs/form-plugin
|
|
619
348
|
*/
|
|
620
349
|
|
|
621
350
|
/**
|
|
622
|
-
*
|
|
623
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
351
|
+
* Generated bundle index. Do not edit.
|
|
624
352
|
*/
|
|
625
353
|
|
|
626
|
-
export { NgxsFormPlugin, NgxsFormPluginModule, ResetForm, SetFormDirty, SetFormDisabled, SetFormEnabled, SetFormPristine, UpdateForm, UpdateFormDirty, UpdateFormErrors, UpdateFormStatus, UpdateFormValue, FormDirective as
|
|
354
|
+
export { NgxsFormPlugin, NgxsFormPluginModule, ResetForm, SetFormDirty, SetFormDisabled, SetFormEnabled, SetFormPristine, UpdateForm, UpdateFormDirty, UpdateFormErrors, UpdateFormStatus, UpdateFormValue, FormDirective as ɵFormDirective };
|
|
627
355
|
//# sourceMappingURL=ngxs-form-plugin.js.map
|