@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.
@@ -1,611 +1,273 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@ngxs/store'), require('@angular/forms'), require('rxjs'), require('rxjs/operators')) :
3
3
  typeof define === 'function' && define.amd ? define('@ngxs/form-plugin', ['exports', '@angular/core', '@ngxs/store', '@angular/forms', 'rxjs', 'rxjs/operators'], factory) :
4
- (global = global || self, factory((global.ngxs = global.ngxs || {}, global.ngxs['form-plugin'] = {}), global.ng.core, global['ngxs-store'], global.ng.forms, global.rxjs, global.rxjs.operators));
5
- }(this, function (exports, core, store, forms, rxjs, operators) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ngxs = global.ngxs || {}, global.ngxs["form-plugin"] = {}), global.ng.core, global["ngxs-store"], global.ng.forms, global.rxjs, global.rxjs.operators));
5
+ })(this, (function (exports, i0, i1, i2, rxjs, operators) { 'use strict';
6
6
 
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
20
- ***************************************************************************** */
21
- /* global Reflect, Promise */
22
-
23
- var extendStatics = function(d, b) {
24
- extendStatics = Object.setPrototypeOf ||
25
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
27
- return extendStatics(d, b);
28
- };
29
-
30
- function __extends(d, b) {
31
- extendStatics(d, b);
32
- function __() { this.constructor = d; }
33
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
- }
35
-
36
- var __assign = function() {
37
- __assign = Object.assign || function __assign(t) {
38
- for (var s, i = 1, n = arguments.length; i < n; i++) {
39
- s = arguments[i];
40
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
41
- }
42
- return t;
43
- };
44
- return __assign.apply(this, arguments);
45
- };
46
-
47
- function __rest(s, e) {
48
- var t = {};
49
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
50
- t[p] = s[p];
51
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
52
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
53
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
54
- t[p[i]] = s[p[i]];
55
- }
56
- return t;
57
- }
58
-
59
- function __decorate(decorators, target, key, desc) {
60
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
61
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
62
- 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;
63
- return c > 3 && r && Object.defineProperty(target, key, r), r;
64
- }
65
-
66
- function __param(paramIndex, decorator) {
67
- return function (target, key) { decorator(target, key, paramIndex); }
68
- }
69
-
70
- function __metadata(metadataKey, metadataValue) {
71
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
72
- }
73
-
74
- function __awaiter(thisArg, _arguments, P, generator) {
75
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
76
- return new (P || (P = Promise))(function (resolve, reject) {
77
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
78
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
79
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
80
- step((generator = generator.apply(thisArg, _arguments || [])).next());
81
- });
82
- }
83
-
84
- function __generator(thisArg, body) {
85
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
86
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
87
- function verb(n) { return function (v) { return step([n, v]); }; }
88
- function step(op) {
89
- if (f) throw new TypeError("Generator is already executing.");
90
- while (_) try {
91
- 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;
92
- if (y = 0, t) op = [op[0] & 2, t.value];
93
- switch (op[0]) {
94
- case 0: case 1: t = op; break;
95
- case 4: _.label++; return { value: op[1], done: false };
96
- case 5: _.label++; y = op[1]; op = [0]; continue;
97
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
98
- default:
99
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
100
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
101
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
102
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
103
- if (t[2]) _.ops.pop();
104
- _.trys.pop(); continue;
105
- }
106
- op = body.call(thisArg, _);
107
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
108
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
109
- }
110
- }
111
-
112
- function __createBinding(o, m, k, k2) {
113
- if (k2 === undefined) k2 = k;
114
- o[k2] = m[k];
115
- }
116
-
117
- function __exportStar(m, exports) {
118
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
119
- }
120
-
121
- function __values(o) {
122
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
123
- if (m) return m.call(o);
124
- if (o && typeof o.length === "number") return {
125
- next: function () {
126
- if (o && i >= o.length) o = void 0;
127
- return { value: o && o[i++], done: !o };
128
- }
129
- };
130
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
131
- }
132
-
133
- function __read(o, n) {
134
- var m = typeof Symbol === "function" && o[Symbol.iterator];
135
- if (!m) return o;
136
- var i = m.call(o), r, ar = [], e;
137
- try {
138
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
139
- }
140
- catch (error) { e = { error: error }; }
141
- finally {
142
- try {
143
- if (r && !r.done && (m = i["return"])) m.call(i);
144
- }
145
- finally { if (e) throw e.error; }
146
- }
147
- return ar;
148
- }
149
-
150
- function __spread() {
151
- for (var ar = [], i = 0; i < arguments.length; i++)
152
- ar = ar.concat(__read(arguments[i]));
153
- return ar;
154
- }
155
-
156
- function __spreadArrays() {
157
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
158
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
159
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
160
- r[k] = a[j];
161
- return r;
162
- };
163
-
164
- function __await(v) {
165
- return this instanceof __await ? (this.v = v, this) : new __await(v);
166
- }
167
-
168
- function __asyncGenerator(thisArg, _arguments, generator) {
169
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
170
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
171
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
172
- 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); }); }; }
173
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
174
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
175
- function fulfill(value) { resume("next", value); }
176
- function reject(value) { resume("throw", value); }
177
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
178
- }
179
-
180
- function __asyncDelegator(o) {
181
- var i, p;
182
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
183
- 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; }
184
- }
185
-
186
- function __asyncValues(o) {
187
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
188
- var m = o[Symbol.asyncIterator], i;
189
- 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);
190
- 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); }); }; }
191
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
192
- }
193
-
194
- function __makeTemplateObject(cooked, raw) {
195
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
196
- return cooked;
197
- };
198
-
199
- function __importStar(mod) {
200
- if (mod && mod.__esModule) return mod;
201
- var result = {};
202
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
203
- result.default = mod;
204
- return result;
205
- }
206
-
207
- function __importDefault(mod) {
208
- return (mod && mod.__esModule) ? mod : { default: mod };
209
- }
210
-
211
- function __classPrivateFieldGet(receiver, privateMap) {
212
- if (!privateMap.has(receiver)) {
213
- throw new TypeError("attempted to get private field on non-instance");
214
- }
215
- return privateMap.get(receiver);
216
- }
217
-
218
- function __classPrivateFieldSet(receiver, privateMap, value) {
219
- if (!privateMap.has(receiver)) {
220
- throw new TypeError("attempted to set private field on non-instance");
221
- }
222
- privateMap.set(receiver, value);
223
- return value;
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n["default"] = e;
22
+ return Object.freeze(n);
224
23
  }
225
24
 
226
- /**
227
- * @fileoverview added by tsickle
228
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
229
- */
25
+ var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
27
+ var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
28
+
230
29
  var UpdateFormStatus = /** @class */ (function () {
231
30
  function UpdateFormStatus(payload) {
232
31
  this.payload = payload;
233
32
  }
234
33
  Object.defineProperty(UpdateFormStatus, "type", {
235
- get: /**
236
- * @return {?}
237
- */
238
- function () {
34
+ get: function () {
239
35
  // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
240
36
  return '[Forms] Update Form Status';
241
37
  },
242
- enumerable: true,
38
+ enumerable: false,
243
39
  configurable: true
244
40
  });
245
41
  return UpdateFormStatus;
246
42
  }());
247
- if (false) {
248
- /** @type {?} */
249
- UpdateFormStatus.prototype.payload;
250
- }
251
43
  var UpdateFormValue = /** @class */ (function () {
252
44
  function UpdateFormValue(payload) {
253
45
  this.payload = payload;
254
46
  }
255
47
  Object.defineProperty(UpdateFormValue, "type", {
256
- get: /**
257
- * @return {?}
258
- */
259
- function () {
48
+ get: function () {
260
49
  // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
261
50
  return '[Forms] Update Form Value';
262
51
  },
263
- enumerable: true,
52
+ enumerable: false,
264
53
  configurable: true
265
54
  });
266
55
  return UpdateFormValue;
267
56
  }());
268
- if (false) {
269
- /** @type {?} */
270
- UpdateFormValue.prototype.payload;
271
- }
272
57
  var UpdateForm = /** @class */ (function () {
273
58
  function UpdateForm(payload) {
274
59
  this.payload = payload;
275
60
  }
276
61
  Object.defineProperty(UpdateForm, "type", {
277
- get: /**
278
- * @return {?}
279
- */
280
- function () {
62
+ get: function () {
281
63
  // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
282
64
  return '[Forms] Update Form';
283
65
  },
284
- enumerable: true,
66
+ enumerable: false,
285
67
  configurable: true
286
68
  });
287
69
  return UpdateForm;
288
70
  }());
289
- if (false) {
290
- /** @type {?} */
291
- UpdateForm.prototype.payload;
292
- }
293
71
  var UpdateFormDirty = /** @class */ (function () {
294
72
  function UpdateFormDirty(payload) {
295
73
  this.payload = payload;
296
74
  }
297
75
  Object.defineProperty(UpdateFormDirty, "type", {
298
- get: /**
299
- * @return {?}
300
- */
301
- function () {
76
+ get: function () {
302
77
  // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
303
78
  return '[Forms] Update Form Dirty';
304
79
  },
305
- enumerable: true,
80
+ enumerable: false,
306
81
  configurable: true
307
82
  });
308
83
  return UpdateFormDirty;
309
84
  }());
310
- if (false) {
311
- /** @type {?} */
312
- UpdateFormDirty.prototype.payload;
313
- }
314
85
  var SetFormDirty = /** @class */ (function () {
315
86
  function SetFormDirty(payload) {
316
87
  this.payload = payload;
317
88
  }
318
89
  Object.defineProperty(SetFormDirty, "type", {
319
- get: /**
320
- * @return {?}
321
- */
322
- function () {
90
+ get: function () {
323
91
  // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
324
92
  return '[Forms] Set Form Dirty';
325
93
  },
326
- enumerable: true,
94
+ enumerable: false,
327
95
  configurable: true
328
96
  });
329
97
  return SetFormDirty;
330
98
  }());
331
- if (false) {
332
- /** @type {?} */
333
- SetFormDirty.prototype.payload;
334
- }
335
99
  var SetFormPristine = /** @class */ (function () {
336
100
  function SetFormPristine(payload) {
337
101
  this.payload = payload;
338
102
  }
339
103
  Object.defineProperty(SetFormPristine, "type", {
340
- get: /**
341
- * @return {?}
342
- */
343
- function () {
104
+ get: function () {
344
105
  // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
345
106
  return '[Forms] Set Form Pristine';
346
107
  },
347
- enumerable: true,
108
+ enumerable: false,
348
109
  configurable: true
349
110
  });
350
111
  return SetFormPristine;
351
112
  }());
352
- if (false) {
353
- /** @type {?} */
354
- SetFormPristine.prototype.payload;
355
- }
356
113
  var UpdateFormErrors = /** @class */ (function () {
357
114
  function UpdateFormErrors(payload) {
358
115
  this.payload = payload;
359
116
  }
360
117
  Object.defineProperty(UpdateFormErrors, "type", {
361
- get: /**
362
- * @return {?}
363
- */
364
- function () {
118
+ get: function () {
365
119
  // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
366
120
  return '[Forms] Update Form Errors';
367
121
  },
368
- enumerable: true,
122
+ enumerable: false,
369
123
  configurable: true
370
124
  });
371
125
  return UpdateFormErrors;
372
126
  }());
373
- if (false) {
374
- /** @type {?} */
375
- UpdateFormErrors.prototype.payload;
376
- }
377
127
  var SetFormDisabled = /** @class */ (function () {
378
128
  function SetFormDisabled(payload) {
379
129
  this.payload = payload;
380
130
  }
381
131
  Object.defineProperty(SetFormDisabled, "type", {
382
- get: /**
383
- * @return {?}
384
- */
385
- function () {
132
+ get: function () {
386
133
  // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
387
134
  return '[Forms] Set Form Disabled';
388
135
  },
389
- enumerable: true,
136
+ enumerable: false,
390
137
  configurable: true
391
138
  });
392
139
  return SetFormDisabled;
393
140
  }());
394
- if (false) {
395
- /** @type {?} */
396
- SetFormDisabled.prototype.payload;
397
- }
398
141
  var SetFormEnabled = /** @class */ (function () {
399
142
  function SetFormEnabled(payload) {
400
143
  this.payload = payload;
401
144
  }
402
145
  Object.defineProperty(SetFormEnabled, "type", {
403
- get: /**
404
- * @return {?}
405
- */
406
- function () {
146
+ get: function () {
407
147
  // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
408
148
  return '[Forms] Set Form Enabled';
409
149
  },
410
- enumerable: true,
150
+ enumerable: false,
411
151
  configurable: true
412
152
  });
413
153
  return SetFormEnabled;
414
154
  }());
415
- if (false) {
416
- /** @type {?} */
417
- SetFormEnabled.prototype.payload;
418
- }
419
155
  var ResetForm = /** @class */ (function () {
420
156
  function ResetForm(payload) {
421
157
  this.payload = payload;
422
158
  }
423
159
  Object.defineProperty(ResetForm, "type", {
424
- get: /**
425
- * @return {?}
426
- */
427
- function () {
160
+ get: function () {
428
161
  // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
429
162
  return '[Forms] Reset Form';
430
163
  },
431
- enumerable: true,
164
+ enumerable: false,
432
165
  configurable: true
433
166
  });
434
167
  return ResetForm;
435
168
  }());
436
- if (false) {
437
- /** @type {?} */
438
- ResetForm.prototype.payload;
439
- }
440
169
 
441
- /**
442
- * @fileoverview added by tsickle
443
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
444
- */
445
170
  var NgxsFormPlugin = /** @class */ (function () {
446
171
  function NgxsFormPlugin() {
447
172
  }
448
- /**
449
- * @param {?} state
450
- * @param {?} event
451
- * @param {?} next
452
- * @return {?}
453
- */
454
- NgxsFormPlugin.prototype.handle = /**
455
- * @param {?} state
456
- * @param {?} event
457
- * @param {?} next
458
- * @return {?}
459
- */
460
- function (state, event, next) {
461
- /** @type {?} */
462
- var type = store.getActionTypeFromInstance(event);
463
- /** @type {?} */
173
+ NgxsFormPlugin.prototype.handle = function (state, event, next) {
174
+ var type = i1.getActionTypeFromInstance(event);
464
175
  var nextState = state;
465
176
  if (type === UpdateFormValue.type || type === UpdateForm.type || type === ResetForm.type) {
466
177
  var value = event.payload.value;
467
- /** @type {?} */
468
178
  var payloadValue = Array.isArray(value)
469
179
  ? value.slice()
470
180
  : isObjectLike(value)
471
- ? __assign({}, value) : value;
472
- /** @type {?} */
181
+ ? Object.assign({}, value) : value;
473
182
  var path = this.joinPathWithPropertyPath(event);
474
- nextState = store.setValue(nextState, path, payloadValue);
183
+ nextState = i1.setValue(nextState, path, payloadValue);
475
184
  }
476
185
  if (type === ResetForm.type) {
477
- /** @type {?} */
478
- var model = store.getValue(nextState, event.payload.path + ".model");
479
- nextState = store.setValue(nextState, "" + event.payload.path, { model: model });
186
+ var model = i1.getValue(nextState, event.payload.path + ".model");
187
+ nextState = i1.setValue(nextState, "" + event.payload.path, { model: model });
480
188
  }
481
189
  if (type === UpdateFormStatus.type || type === UpdateForm.type) {
482
- nextState = store.setValue(nextState, event.payload.path + ".status", event.payload.status);
190
+ nextState = i1.setValue(nextState, event.payload.path + ".status", event.payload.status);
483
191
  }
484
192
  if (type === UpdateFormErrors.type || type === UpdateForm.type) {
485
- nextState = store.setValue(nextState, event.payload.path + ".errors", __assign({}, event.payload.errors));
193
+ nextState = i1.setValue(nextState, event.payload.path + ".errors", Object.assign({}, event.payload.errors));
486
194
  }
487
195
  if (type === UpdateFormDirty.type || type === UpdateForm.type) {
488
- nextState = store.setValue(nextState, event.payload.path + ".dirty", event.payload.dirty);
196
+ nextState = i1.setValue(nextState, event.payload.path + ".dirty", event.payload.dirty);
489
197
  }
490
198
  if (type === SetFormDirty.type) {
491
- nextState = store.setValue(nextState, event.payload + ".dirty", true);
199
+ nextState = i1.setValue(nextState, event.payload + ".dirty", true);
492
200
  }
493
201
  if (type === SetFormPristine.type) {
494
- nextState = store.setValue(nextState, event.payload + ".dirty", false);
202
+ nextState = i1.setValue(nextState, event.payload + ".dirty", false);
495
203
  }
496
204
  if (type === SetFormDisabled.type) {
497
- nextState = store.setValue(nextState, event.payload + ".disabled", true);
205
+ nextState = i1.setValue(nextState, event.payload + ".disabled", true);
498
206
  }
499
207
  if (type === SetFormEnabled.type) {
500
- nextState = store.setValue(nextState, event.payload + ".disabled", false);
208
+ nextState = i1.setValue(nextState, event.payload + ".disabled", false);
501
209
  }
502
210
  return next(nextState, event);
503
211
  };
504
- /**
505
- * @private
506
- * @param {?} __0
507
- * @return {?}
508
- */
509
- NgxsFormPlugin.prototype.joinPathWithPropertyPath = /**
510
- * @private
511
- * @param {?} __0
512
- * @return {?}
513
- */
514
- function (_a) {
212
+ NgxsFormPlugin.prototype.joinPathWithPropertyPath = function (_a) {
515
213
  var payload = _a.payload;
516
- /** @type {?} */
517
214
  var path = payload.path + ".model";
518
215
  if (payload.propertyPath) {
519
216
  path += "." + payload.propertyPath;
520
217
  }
521
218
  return path;
522
219
  };
523
- NgxsFormPlugin.decorators = [
524
- { type: core.Injectable }
525
- ];
526
220
  return NgxsFormPlugin;
527
221
  }());
528
- /**
529
- * @param {?} target
530
- * @return {?}
531
- */
222
+ /** @nocollapse */ NgxsFormPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NgxsFormPlugin, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
223
+ /** @nocollapse */ NgxsFormPlugin.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NgxsFormPlugin });
224
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NgxsFormPlugin, decorators: [{
225
+ type: i0.Injectable
226
+ }] });
532
227
  function isObjectLike(target) {
533
228
  return target !== null && typeof target === 'object';
534
229
  }
535
230
 
536
- /**
537
- * @fileoverview added by tsickle
538
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
539
- */
540
231
  var FormDirective = /** @class */ (function () {
541
232
  function FormDirective(_actions$, _store, _formGroupDirective, _cd) {
542
233
  this._actions$ = _actions$;
543
234
  this._store = _store;
544
235
  this._formGroupDirective = _formGroupDirective;
545
236
  this._cd = _cd;
546
- this.path = (/** @type {?} */ (null));
237
+ this.path = null;
547
238
  this.debounce = 100;
548
239
  this._clearDestroy = false;
549
240
  this._destroy$ = new rxjs.Subject();
550
241
  this._updating = false;
551
242
  }
552
243
  Object.defineProperty(FormDirective.prototype, "clearDestroy", {
553
- get: /**
554
- * @return {?}
555
- */
556
- function () {
244
+ get: function () {
557
245
  return this._clearDestroy;
558
246
  },
559
- set: /**
560
- * @param {?} val
561
- * @return {?}
562
- */
563
- function (val) {
247
+ set: function (val) {
564
248
  this._clearDestroy = val != null && "" + val !== 'false';
565
249
  },
566
- enumerable: true,
250
+ enumerable: false,
567
251
  configurable: true
568
252
  });
569
- /**
570
- * @return {?}
571
- */
572
- FormDirective.prototype.ngOnInit = /**
573
- * @return {?}
574
- */
575
- function () {
253
+ FormDirective.prototype.ngOnInit = function () {
576
254
  var _this = this;
577
255
  this._actions$
578
- .pipe(store.ofActionDispatched(ResetForm), operators.filter((/**
579
- * @param {?} action
580
- * @return {?}
581
- */
582
- function (action) { return action.payload.path === _this.path; })), operators.takeUntil(this._destroy$))
583
- .subscribe((/**
584
- * @param {?} __0
585
- * @return {?}
586
- */
587
- function (_a) {
256
+ .pipe(i1.ofActionDispatched(ResetForm), operators.filter(function (action) { return action.payload.path === _this.path; }), operators.takeUntil(this._destroy$))
257
+ .subscribe(function (_a) {
588
258
  var value = _a.payload.value;
589
259
  _this.form.reset(value);
590
260
  _this.updateFormStateWithRawValue(true);
591
261
  _this._cd.markForCheck();
592
- }));
593
- this.getStateStream(this.path + ".model").subscribe((/**
594
- * @param {?} model
595
- * @return {?}
596
- */
597
- function (model) {
262
+ });
263
+ this.getStateStream(this.path + ".model").subscribe(function (model) {
598
264
  if (_this._updating || !model) {
599
265
  return;
600
266
  }
601
267
  _this.form.patchValue(model);
602
268
  _this._cd.markForCheck();
603
- }));
604
- this.getStateStream(this.path + ".dirty").subscribe((/**
605
- * @param {?} dirty
606
- * @return {?}
607
- */
608
- function (dirty) {
269
+ });
270
+ this.getStateStream(this.path + ".dirty").subscribe(function (dirty) {
609
271
  if (_this.form.dirty === dirty || typeof dirty !== 'boolean') {
610
272
  return;
611
273
  }
@@ -616,18 +278,11 @@
616
278
  _this.form.markAsPristine();
617
279
  }
618
280
  _this._cd.markForCheck();
619
- }));
281
+ });
620
282
  // On first state change, sync form model, status and dirty with state
621
283
  this._store
622
- .selectOnce((/**
623
- * @param {?} state
624
- * @return {?}
625
- */
626
- function (state) { return store.getValue(state, _this.path); }))
627
- .subscribe((/**
628
- * @return {?}
629
- */
630
- function () {
284
+ .selectOnce(function (state) { return i1.getValue(state, _this.path); })
285
+ .subscribe(function () {
631
286
  _this._store.dispatch([
632
287
  new UpdateFormValue({
633
288
  path: _this.path,
@@ -642,12 +297,8 @@
642
297
  dirty: _this.form.dirty
643
298
  })
644
299
  ]);
645
- }));
646
- this.getStateStream(this.path + ".disabled").subscribe((/**
647
- * @param {?} disabled
648
- * @return {?}
649
- */
650
- function (disabled) {
300
+ });
301
+ this.getStateStream(this.path + ".disabled").subscribe(function (disabled) {
651
302
  if (_this.form.disabled === disabled || typeof disabled !== 'boolean') {
652
303
  return;
653
304
  }
@@ -658,48 +309,26 @@
658
309
  _this.form.enable();
659
310
  }
660
311
  _this._cd.markForCheck();
661
- }));
662
- (/** @type {?} */ (this._formGroupDirective
663
- .valueChanges)).pipe(operators.distinctUntilChanged((/**
664
- * @param {?} a
665
- * @param {?} b
666
- * @return {?}
667
- */
668
- function (a, b) { return JSON.stringify(a) === JSON.stringify(b); })), this.debounceChange())
669
- .subscribe((/**
670
- * @return {?}
671
- */
672
- function () {
312
+ });
313
+ this._formGroupDirective
314
+ .valueChanges.pipe(operators.distinctUntilChanged(function (a, b) { return JSON.stringify(a) === JSON.stringify(b); }), this.debounceChange())
315
+ .subscribe(function () {
673
316
  _this.updateFormStateWithRawValue();
674
- }));
675
- (/** @type {?} */ (this._formGroupDirective
676
- .statusChanges)).pipe(operators.distinctUntilChanged(), this.debounceChange())
677
- .subscribe((/**
678
- * @param {?} status
679
- * @return {?}
680
- */
681
- function (status) {
317
+ });
318
+ this._formGroupDirective
319
+ .statusChanges.pipe(operators.distinctUntilChanged(), this.debounceChange())
320
+ .subscribe(function (status) {
682
321
  _this._store.dispatch(new UpdateFormStatus({
683
322
  status: status,
684
323
  path: _this.path
685
324
  }));
686
- }));
325
+ });
687
326
  };
688
- /**
689
- * @param {?=} withFormStatus
690
- * @return {?}
691
- */
692
- FormDirective.prototype.updateFormStateWithRawValue = /**
693
- * @param {?=} withFormStatus
694
- * @return {?}
695
- */
696
- function (withFormStatus) {
327
+ FormDirective.prototype.updateFormStateWithRawValue = function (withFormStatus) {
697
328
  var _this = this;
698
329
  if (this._updating)
699
330
  return;
700
- /** @type {?} */
701
331
  var value = this._formGroupDirective.control.getRawValue();
702
- /** @type {?} */
703
332
  var actions = [
704
333
  new UpdateFormValue({
705
334
  path: this.path,
@@ -722,23 +351,11 @@
722
351
  }
723
352
  this._updating = true;
724
353
  this._store.dispatch(actions).subscribe({
725
- error: (/**
726
- * @return {?}
727
- */
728
- function () { return (_this._updating = false); }),
729
- complete: (/**
730
- * @return {?}
731
- */
732
- function () { return (_this._updating = false); })
354
+ error: function () { return (_this._updating = false); },
355
+ complete: function () { return (_this._updating = false); }
733
356
  });
734
357
  };
735
- /**
736
- * @return {?}
737
- */
738
- FormDirective.prototype.ngOnDestroy = /**
739
- * @return {?}
740
- */
741
- function () {
358
+ FormDirective.prototype.ngOnDestroy = function () {
742
359
  this._destroy$.next();
743
360
  this._destroy$.complete();
744
361
  if (this.clearDestroy) {
@@ -751,150 +368,77 @@
751
368
  }));
752
369
  }
753
370
  };
754
- /**
755
- * @private
756
- * @return {?}
757
- */
758
- FormDirective.prototype.debounceChange = /**
759
- * @private
760
- * @return {?}
761
- */
762
- function () {
371
+ FormDirective.prototype.debounceChange = function () {
763
372
  var _this = this;
764
- /** @type {?} */
765
373
  var skipDebounceTime = this._formGroupDirective.control.updateOn !== 'change' || this.debounce < 0;
766
374
  return skipDebounceTime
767
- ? (/**
768
- * @param {?} change
769
- * @return {?}
770
- */
771
- function (change) { return change.pipe(operators.takeUntil(_this._destroy$)); })
772
- : (/**
773
- * @param {?} change
774
- * @return {?}
775
- */
776
- function (change) {
777
- return change.pipe(operators.debounceTime(_this.debounce), operators.takeUntil(_this._destroy$));
778
- });
375
+ ? function (change) { return change.pipe(operators.takeUntil(_this._destroy$)); }
376
+ : function (change) { return change.pipe(operators.debounceTime(_this.debounce), operators.takeUntil(_this._destroy$)); };
779
377
  };
780
378
  Object.defineProperty(FormDirective.prototype, "form", {
781
- get: /**
782
- * @private
783
- * @return {?}
784
- */
785
- function () {
379
+ get: function () {
786
380
  return this._formGroupDirective.form;
787
381
  },
788
- enumerable: true,
382
+ enumerable: false,
789
383
  configurable: true
790
384
  });
791
- /**
792
- * @private
793
- * @param {?} path
794
- * @return {?}
795
- */
796
- FormDirective.prototype.getStateStream = /**
797
- * @private
798
- * @param {?} path
799
- * @return {?}
800
- */
801
- function (path) {
802
- return this._store.select((/**
803
- * @param {?} state
804
- * @return {?}
805
- */
806
- function (state) { return store.getValue(state, path); })).pipe(operators.takeUntil(this._destroy$));
807
- };
808
- FormDirective.decorators = [
809
- { type: core.Directive, args: [{ selector: '[ngxsForm]' },] }
810
- ];
811
- /** @nocollapse */
812
- FormDirective.ctorParameters = function () { return [
813
- { type: store.Actions },
814
- { type: store.Store },
815
- { type: forms.FormGroupDirective },
816
- { type: core.ChangeDetectorRef }
817
- ]; };
818
- FormDirective.propDecorators = {
819
- path: [{ type: core.Input, args: ['ngxsForm',] }],
820
- debounce: [{ type: core.Input, args: ['ngxsFormDebounce',] }],
821
- clearDestroy: [{ type: core.Input, args: ['ngxsFormClearOnDestroy',] }]
385
+ FormDirective.prototype.getStateStream = function (path) {
386
+ return this._store.select(function (state) { return i1.getValue(state, path); }).pipe(operators.takeUntil(this._destroy$));
822
387
  };
823
388
  return FormDirective;
824
389
  }());
825
- if (false) {
826
- /** @type {?} */
827
- FormDirective.prototype.path;
828
- /** @type {?} */
829
- FormDirective.prototype.debounce;
830
- /** @type {?} */
831
- FormDirective.prototype._clearDestroy;
832
- /**
833
- * @type {?}
834
- * @private
835
- */
836
- FormDirective.prototype._destroy$;
837
- /**
838
- * @type {?}
839
- * @private
840
- */
841
- FormDirective.prototype._updating;
842
- /**
843
- * @type {?}
844
- * @private
845
- */
846
- FormDirective.prototype._actions$;
847
- /**
848
- * @type {?}
849
- * @private
850
- */
851
- FormDirective.prototype._store;
852
- /**
853
- * @type {?}
854
- * @private
855
- */
856
- FormDirective.prototype._formGroupDirective;
857
- /**
858
- * @type {?}
859
- * @private
860
- */
861
- FormDirective.prototype._cd;
862
- }
390
+ /** @nocollapse */ FormDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FormDirective, deps: [{ token: i1__namespace.Actions }, { token: i1__namespace.Store }, { token: i2__namespace.FormGroupDirective }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
391
+ /** @nocollapse */ FormDirective.ɵdir = i0__namespace.ɵɵ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__namespace });
392
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FormDirective, decorators: [{
393
+ type: i0.Directive,
394
+ args: [{ selector: '[ngxsForm]' }]
395
+ }], ctorParameters: function () { return [{ type: i1__namespace.Actions }, { type: i1__namespace.Store }, { type: i2__namespace.FormGroupDirective }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { path: [{
396
+ type: i0.Input,
397
+ args: ['ngxsForm']
398
+ }], debounce: [{
399
+ type: i0.Input,
400
+ args: ['ngxsFormDebounce']
401
+ }], clearDestroy: [{
402
+ type: i0.Input,
403
+ args: ['ngxsFormClearOnDestroy']
404
+ }] } });
863
405
 
864
- /**
865
- * @fileoverview added by tsickle
866
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
867
- */
868
406
  var NgxsFormPluginModule = /** @class */ (function () {
869
407
  function NgxsFormPluginModule() {
870
408
  }
871
- /**
872
- * @return {?}
873
- */
874
- NgxsFormPluginModule.forRoot = /**
875
- * @return {?}
876
- */
877
- function () {
409
+ NgxsFormPluginModule.forRoot = function () {
878
410
  return {
879
411
  ngModule: NgxsFormPluginModule,
880
412
  providers: [
881
413
  {
882
- provide: store.NGXS_PLUGINS,
414
+ provide: i1.NGXS_PLUGINS,
883
415
  useClass: NgxsFormPlugin,
884
416
  multi: true
885
417
  }
886
418
  ]
887
419
  };
888
420
  };
889
- NgxsFormPluginModule.decorators = [
890
- { type: core.NgModule, args: [{
891
- imports: [forms.ReactiveFormsModule],
892
- declarations: [FormDirective],
893
- exports: [FormDirective]
894
- },] }
895
- ];
896
421
  return NgxsFormPluginModule;
897
422
  }());
423
+ /** @nocollapse */ NgxsFormPluginModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NgxsFormPluginModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
424
+ /** @nocollapse */ NgxsFormPluginModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NgxsFormPluginModule, declarations: [FormDirective], imports: [i2.ReactiveFormsModule], exports: [FormDirective] });
425
+ /** @nocollapse */ NgxsFormPluginModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NgxsFormPluginModule, imports: [[i2.ReactiveFormsModule]] });
426
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NgxsFormPluginModule, decorators: [{
427
+ type: i0.NgModule,
428
+ args: [{
429
+ imports: [i2.ReactiveFormsModule],
430
+ declarations: [FormDirective],
431
+ exports: [FormDirective]
432
+ }]
433
+ }] });
434
+
435
+ /**
436
+ * The public api for consumers of @ngxs/form-plugin
437
+ */
438
+
439
+ /**
440
+ * Generated bundle index. Do not edit.
441
+ */
898
442
 
899
443
  exports.NgxsFormPlugin = NgxsFormPlugin;
900
444
  exports.NgxsFormPluginModule = NgxsFormPluginModule;
@@ -908,7 +452,7 @@
908
452
  exports.UpdateFormErrors = UpdateFormErrors;
909
453
  exports.UpdateFormStatus = UpdateFormStatus;
910
454
  exports.UpdateFormValue = UpdateFormValue;
911
- exports.ɵa = FormDirective;
455
+ exports["ɵFormDirective"] = FormDirective;
912
456
 
913
457
  Object.defineProperty(exports, '__esModule', { value: true });
914
458