@dynamicforms/vue-forms 0.2.5 → 0.3.0

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,66 +1,50 @@
1
- var bt = Object.defineProperty, pt = Object.defineProperties;
2
- var yt = Object.getOwnPropertyDescriptors;
3
- var R = Object.getOwnPropertySymbols, mt = Object.getPrototypeOf, it = Object.prototype.hasOwnProperty, st = Object.prototype.propertyIsEnumerable, vt = Reflect.get;
4
- var W = (s, i, t) => i in s ? bt(s, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[i] = t, A = (s, i) => {
1
+ var gt = Object.defineProperty, dt = Object.defineProperties;
2
+ var ft = Object.getOwnPropertyDescriptors;
3
+ var R = Object.getOwnPropertySymbols;
4
+ var J = Object.prototype.hasOwnProperty, K = Object.prototype.propertyIsEnumerable;
5
+ var k = (n, i, t) => i in n ? gt(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t, _ = (n, i) => {
5
6
  for (var t in i || (i = {}))
6
- it.call(i, t) && W(s, t, i[t]);
7
+ J.call(i, t) && k(n, t, i[t]);
7
8
  if (R)
8
9
  for (var t of R(i))
9
- st.call(i, t) && W(s, t, i[t]);
10
- return s;
11
- }, F = (s, i) => pt(s, yt(i));
12
- var N = (s, i) => {
10
+ K.call(i, t) && k(n, t, i[t]);
11
+ return n;
12
+ }, S = (n, i) => dt(n, ft(i));
13
+ var F = (n, i) => {
13
14
  var t = {};
14
- for (var e in s)
15
- it.call(s, e) && i.indexOf(e) < 0 && (t[e] = s[e]);
16
- if (s != null && R)
17
- for (var e of R(s))
18
- i.indexOf(e) < 0 && st.call(s, e) && (t[e] = s[e]);
15
+ for (var e in n)
16
+ J.call(n, e) && i.indexOf(e) < 0 && (t[e] = n[e]);
17
+ if (n != null && R)
18
+ for (var e of R(n))
19
+ i.indexOf(e) < 0 && K.call(n, e) && (t[e] = n[e]);
19
20
  return t;
20
21
  };
21
- var h = (s, i, t) => W(s, typeof i != "symbol" ? i + "" : i, t);
22
- var v = (s, i, t) => vt(mt(s), t, i);
23
- var u = (s, i, t) => new Promise((e, n) => {
24
- var r = (c) => {
25
- try {
26
- l(t.next(c));
27
- } catch (o) {
28
- n(o);
29
- }
30
- }, a = (c) => {
31
- try {
32
- l(t.throw(c));
33
- } catch (o) {
34
- n(o);
35
- }
36
- }, l = (c) => c.done ? e(c.value) : Promise.resolve(c.value).then(r, a);
37
- l((t = t.apply(s, i)).next());
38
- });
39
- import { isEqual as B, isBoolean as nt, isString as C, isEmpty as J, truncate as xt, isArray as lt, isObject as ct } from "lodash-es";
40
- import { unref as d, computed as ot, reactive as D } from "vue";
41
- var T = /* @__PURE__ */ ((s) => (s[s.SUPPRESS = 1] = "SUPPRESS", s[s.HIDDEN = 5] = "HIDDEN", s[s.INVISIBLE = 8] = "INVISIBLE", s[s.FULL = 10] = "FULL", s))(T || {});
42
- const rt = 10;
43
- ((s) => {
44
- function i(n) {
45
- return n.toUpperCase() === "SUPPRESS" ? 1 : n.toUpperCase() === "HIDDEN" ? 5 : n.toUpperCase() === "INVISIBLE" ? 8 : rt;
46
- }
47
- s.fromString = i;
48
- function t(n) {
49
- const r = typeof n == "number" ? n : s.fromString(n);
50
- return Object.values(s).includes(r) ? r : rt;
51
- }
52
- s.fromAny = t;
53
- function e(n) {
54
- const r = typeof n == "number" ? n : s.fromString(n);
55
- return Object.values(s).includes(r);
56
- }
57
- s.isDefined = e;
58
- })(T || (T = {}));
59
- Object.freeze(T);
60
- const I = T;
22
+ var o = (n, i, t) => k(n, typeof i != "symbol" ? i + "" : i, t);
23
+ import { isEqual as D, isBoolean as bt, isString as I, isEmpty as M, truncate as pt, isArray as Z, isObject as tt } from "lodash-es";
24
+ import { unref as d, computed as et, reactive as it } from "vue";
25
+ var L = /* @__PURE__ */ ((n) => (n[n.SUPPRESS = 1] = "SUPPRESS", n[n.HIDDEN = 5] = "HIDDEN", n[n.INVISIBLE = 8] = "INVISIBLE", n[n.FULL = 10] = "FULL", n))(L || {});
26
+ const Y = 10;
27
+ ((n) => {
28
+ function i(s) {
29
+ return s.toUpperCase() === "SUPPRESS" ? 1 : s.toUpperCase() === "HIDDEN" ? 5 : s.toUpperCase() === "INVISIBLE" ? 8 : Y;
30
+ }
31
+ n.fromString = i;
32
+ function t(s) {
33
+ const r = typeof s == "number" ? s : n.fromString(s);
34
+ return Object.values(n).includes(r) ? r : Y;
35
+ }
36
+ n.fromAny = t;
37
+ function e(s) {
38
+ const r = typeof s == "number" ? s : n.fromString(s);
39
+ return Object.values(n).includes(r);
40
+ }
41
+ n.isDefined = e;
42
+ })(L || (L = {}));
43
+ Object.freeze(L);
44
+ const C = L;
61
45
  class p {
62
46
  constructor(i) {
63
- h(this, "executorFn");
47
+ o(this, "executorFn");
64
48
  this.executorFn = i;
65
49
  }
66
50
  static get classIdentifier() {
@@ -70,9 +54,7 @@ class p {
70
54
  return this.constructor.classIdentifier;
71
55
  }
72
56
  execute(i, t, ...e) {
73
- return u(this, null, function* () {
74
- return this.executorFn(i, t, ...e);
75
- });
57
+ return this.executorFn(i, t, ...e);
76
58
  }
77
59
  // eslint-disable-next-line class-methods-use-this
78
60
  get eager() {
@@ -85,31 +67,29 @@ class p {
85
67
  unregister() {
86
68
  }
87
69
  }
88
- class K extends Error {
70
+ class Q extends Error {
89
71
  }
90
- const ut = Symbol("ValueChangedAction");
91
- class g extends p {
72
+ const nt = Symbol("ValueChangedAction");
73
+ class b extends p {
92
74
  // eslint-disable-next-line @typescript-eslint/no-useless-constructor
93
75
  constructor(i) {
94
76
  super(i);
95
77
  }
96
78
  // eslint-disable-next-line class-methods-use-this
97
79
  static get classIdentifier() {
98
- return ut;
80
+ return nt;
99
81
  }
100
- execute(i, t, e, n) {
101
- return u(this, null, function* () {
102
- return v(g.prototype, this, "execute").call(this, i, t, e, n);
103
- });
82
+ execute(i, t, e, s) {
83
+ return super.execute(i, t, e, s);
104
84
  }
105
85
  }
106
- class L extends String {
86
+ class j extends String {
107
87
  }
108
- function Y(s) {
109
- const i = d(s);
88
+ function H(n) {
89
+ const i = d(n);
110
90
  return typeof i == "object" && "componentName" in i;
111
91
  }
112
- class Z {
92
+ class X {
113
93
  get componentName() {
114
94
  return "Comment";
115
95
  }
@@ -123,10 +103,10 @@ class Z {
123
103
  }
124
104
  // eslint-disable-line class-methods-use-this
125
105
  }
126
- class Et extends Z {
106
+ class vt extends X {
127
107
  constructor(t) {
128
108
  super();
129
- h(this, "text");
109
+ o(this, "text");
130
110
  this.text = t;
131
111
  }
132
112
  get componentName() {
@@ -137,16 +117,16 @@ class Et extends Z {
137
117
  return this.text;
138
118
  }
139
119
  }
140
- class y extends Z {
120
+ class v extends X {
141
121
  constructor(t) {
142
122
  super();
143
- h(this, "text");
144
- h(this, "textType");
145
- this.text = t, this.textType = ot(() => this.getTextType);
123
+ o(this, "text");
124
+ o(this, "textType");
125
+ this.text = t, this.textType = et(() => this.getTextType);
146
126
  }
147
127
  get getTextType() {
148
128
  const t = d(this.text);
149
- return t ? t instanceof L ? "md" : Y(t) ? "component" : "string" : "string";
129
+ return t ? t instanceof j ? "md" : H(t) ? "component" : "string" : "string";
150
130
  }
151
131
  get componentName() {
152
132
  switch (d(this.textType)) {
@@ -181,33 +161,38 @@ class y extends Z {
181
161
  }
182
162
  }
183
163
  }
184
- const It = Symbol("Validator");
185
- class b extends g {
164
+ const mt = Symbol("Validator");
165
+ class f extends b {
186
166
  /**
187
167
  * Creates a new validator
188
168
  * @param validationFn Function that validates the field value and returns errors or null
189
169
  */
190
170
  constructor(t) {
191
- super((n, r, a, l) => u(this, null, function* () {
192
- const c = t(a, l, n) || [];
193
- c.forEach(
194
- (o) => Object.defineProperty(o, "source", { value: this.source, enumerable: !1, configurable: !1 })
195
- );
196
- for (let o = n.errors.length - 1; o >= 0; o--) {
197
- const m = n.errors[o];
198
- if (m.source === this.source) {
199
- const S = c.findIndex((G) => B(G, m));
200
- S >= 0 ? c.splice(S, 1) : n.errors.splice(o, 1);
171
+ super((s, r, a, l) => {
172
+ const c = t(a, l, s) || [], u = (h) => {
173
+ var A;
174
+ h == null || h.forEach(
175
+ (x) => Object.defineProperty(x, "source", { value: this.source, enumerable: !1, configurable: !1 })
176
+ );
177
+ for (let x = s.errors.length - 1; x >= 0; x--) {
178
+ const O = s.errors[x];
179
+ if (O.source === this.source) {
180
+ const w = (A = h == null ? void 0 : h.findIndex((B) => D(B, O))) != null ? A : -1;
181
+ w >= 0 ? h == null || h.splice(w, 1) : s.errors.splice(x, 1);
182
+ }
201
183
  }
202
- }
203
- return c.length > 0 && n.errors.push(...c), n.validate(), r(n, a, l);
204
- }));
205
- h(this, "source");
184
+ h && h.length > 0 && s.errors.push(...h), s.validate();
185
+ };
186
+ return c instanceof Promise ? (s.validating = ++s.validatingCount > 0, c.then((h) => u(h)).finally(() => {
187
+ s.validatingCount = Math.max(0, s.validatingCount - 1), s.validating = s.validatingCount > 0;
188
+ })) : u(c), r(s, a, l);
189
+ });
190
+ o(this, "source");
206
191
  this.source = Symbol(this.constructor.name);
207
192
  }
208
193
  // eslint-disable-next-line class-methods-use-this
209
194
  static get classIdentifier() {
210
- return It;
195
+ return mt;
211
196
  }
212
197
  // eslint-disable-next-line class-methods-use-this
213
198
  get eager() {
@@ -215,82 +200,82 @@ class b extends g {
215
200
  }
216
201
  // eslint-disable-next-line class-methods-use-this
217
202
  replacePlaceholders(t, e) {
218
- if (Y(t)) return t;
219
- let n = t;
203
+ if (H(t)) return t;
204
+ let s = t;
220
205
  return Object.keys(e).forEach((r) => {
221
- n = n.replaceAll(`{${r}}`, e[r]);
222
- }), t instanceof L ? new L(n) : n;
206
+ s = s.replaceAll(`{${r}}`, e[r]);
207
+ }), t instanceof j ? new j(s) : s;
223
208
  }
224
209
  }
225
- class k extends Map {
210
+ class T extends Map {
226
211
  constructor() {
227
212
  super(...arguments);
228
- h(this, "eagerActions", /* @__PURE__ */ new Set());
229
- h(this, "registeredActions", []);
213
+ o(this, "eagerActions", /* @__PURE__ */ new Set());
214
+ o(this, "registeredActions", []);
230
215
  }
231
216
  register(t) {
232
217
  if (!(t instanceof p)) throw new Error("Invalid action type");
233
218
  this.registeredActions.push(t);
234
- const e = t.classIdentifier, n = this.get(e) || (() => null);
219
+ const e = t.classIdentifier, s = this.get(e) || (() => null);
235
220
  function r(a, ...l) {
236
- return t.execute(a, n, ...l);
221
+ return t.execute(a, s, ...l);
237
222
  }
238
223
  this.set(e, r), t.eager && this.eagerActions.add(t.classIdentifier);
239
224
  }
240
- trigger(t, e, ...n) {
241
- return u(this, null, function* () {
242
- const r = t.classIdentifier;
243
- r === ut && (yield this.triggerEager(e, ...n));
244
- const a = this.get(r);
245
- try {
246
- if (a) return yield a(e, ...n);
247
- } catch (l) {
248
- if (!(l instanceof K)) throw l;
249
- }
250
- return null;
251
- });
225
+ trigger(t, e, ...s) {
226
+ const r = t.classIdentifier;
227
+ r === nt && this.triggerEager(e, ...s);
228
+ const a = this.get(r);
229
+ try {
230
+ if (a) return a(e, ...s);
231
+ } catch (l) {
232
+ if (!(l instanceof Q)) throw l;
233
+ }
234
+ return null;
252
235
  }
253
236
  triggerEager(t, ...e) {
254
- return u(this, null, function* () {
255
- for (const n of this.eagerActions) {
256
- const r = this.get(n);
257
- try {
258
- r && (yield r(t, ...e));
259
- } catch (a) {
260
- if (!(a instanceof K)) throw a;
261
- }
237
+ for (const s of this.eagerActions) {
238
+ const r = this.get(s);
239
+ try {
240
+ r && r(t, ...e);
241
+ } catch (a) {
242
+ if (!(a instanceof Q)) throw a;
262
243
  }
263
- });
244
+ }
245
+ }
246
+ clone() {
247
+ const t = new T();
248
+ return this.registeredActions.forEach((e) => t.register(e)), t;
264
249
  }
265
250
  cloneWithoutValidators() {
266
- const t = new k();
251
+ const t = new T();
267
252
  return this.registeredActions.forEach((e) => {
268
- e instanceof b ? e.unregister() : t.register(e);
253
+ e instanceof f ? e.unregister() : t.register(e);
269
254
  }), t;
270
255
  }
271
256
  }
272
- const _t = Symbol("ConditionalStatementAction");
273
- class q extends g {
257
+ const yt = Symbol("ConditionalStatementAction");
258
+ class $ extends b {
274
259
  constructor(t, e) {
275
- const n = (r, a, l, c) => u(this, null, function* () {
276
- const o = t.evaluate();
277
- if (o !== this.lastResult) {
278
- for (const m of this.boundFields)
279
- yield e(m, o, this.lastResult);
280
- this.lastResult = o;
260
+ const s = (r, a, l, c) => {
261
+ const u = t.evaluate();
262
+ if (u !== this.lastResult) {
263
+ for (const h of this.boundFields)
264
+ e(h, u, this.lastResult);
265
+ this.lastResult = u;
281
266
  }
282
267
  return a(r, l, c);
283
- });
284
- super(n);
285
- h(this, "lastResult");
268
+ };
269
+ super(s);
270
+ o(this, "lastResult");
286
271
  // boundField tracks the fields this action is bound to. so that it may perform the executorFn on them and not on the
287
272
  // ValueChangedAction fields that will call the actionExecutor
288
- h(this, "boundFields", /* @__PURE__ */ new Set());
289
- t.collectFields().forEach((r) => r.registerAction(new g(n)));
273
+ o(this, "boundFields", /* @__PURE__ */ new Set());
274
+ t.collectFields().forEach((r) => r.registerAction(new b(s)));
290
275
  }
291
276
  // eslint-disable-next-line class-methods-use-this
292
277
  static get classIdentifier() {
293
- return _t;
278
+ return yt;
294
279
  }
295
280
  // eslint-disable-next-line class-methods-use-this
296
281
  get eager() {
@@ -300,29 +285,29 @@ class q extends g {
300
285
  this.boundFields.add(t);
301
286
  }
302
287
  }
303
- class St extends q {
288
+ class xt extends $ {
304
289
  constructor(i) {
305
- super(i, (t, e) => u(this, null, function* () {
306
- yield t.setVisibility(e ? I.FULL : I.SUPPRESS);
307
- }));
290
+ super(i, (t, e) => {
291
+ t.visibility = e ? C.FULL : C.SUPPRESS;
292
+ });
308
293
  }
309
294
  }
310
- class Ct extends q {
295
+ class Et extends $ {
311
296
  constructor(i) {
312
- super(i, (t, e) => u(this, null, function* () {
313
- yield t.setEnabled(e);
314
- }));
297
+ super(i, (t, e) => {
298
+ t.enabled = e;
299
+ });
315
300
  }
316
301
  }
317
- class Vt extends q {
302
+ class At extends $ {
318
303
  constructor(i, t) {
319
- super(i, (e, n) => u(this, null, function* () {
320
- n && (yield e.setValue(t));
321
- }));
304
+ super(i, (e, s) => {
305
+ s && (e.value = t);
306
+ });
322
307
  }
323
308
  }
324
- var w = /* @__PURE__ */ ((s) => (s[s.NOT = 0] = "NOT", s[s.OR = 1] = "OR", s[s.AND = 2] = "AND", s[s.XOR = 3] = "XOR", s[s.NAND = 4] = "NAND", s[s.NOR = 5] = "NOR", s[s.EQUALS = -1] = "EQUALS", s[s.NOT_EQUALS = -2] = "NOT_EQUALS", s[s.GT = -3] = "GT", s[s.LT = -4] = "LT", s[s.GE = -5] = "GE", s[s.LE = -6] = "LE", s[s.IN = -7] = "IN", s[s.NOT_IN = -8] = "NOT_IN", s[s.INCLUDES = -9] = "INCLUDES", s[s.NOT_INCLUDES = -10] = "NOT_INCLUDES", s))(w || {});
325
- ((s) => {
309
+ var P = /* @__PURE__ */ ((n) => (n[n.NOT = 0] = "NOT", n[n.OR = 1] = "OR", n[n.AND = 2] = "AND", n[n.XOR = 3] = "XOR", n[n.NAND = 4] = "NAND", n[n.NOR = 5] = "NOR", n[n.EQUALS = -1] = "EQUALS", n[n.NOT_EQUALS = -2] = "NOT_EQUALS", n[n.GT = -3] = "GT", n[n.LT = -4] = "LT", n[n.GE = -5] = "GE", n[n.LE = -6] = "LE", n[n.IN = -7] = "IN", n[n.NOT_IN = -8] = "NOT_IN", n[n.INCLUDES = -9] = "INCLUDES", n[n.NOT_INCLUDES = -10] = "NOT_INCLUDES", n))(P || {});
310
+ ((n) => {
326
311
  function i(r) {
327
312
  const a = r.toLowerCase();
328
313
  if (a === "not") return 0;
@@ -343,156 +328,137 @@ var w = /* @__PURE__ */ ((s) => (s[s.NOT = 0] = "NOT", s[s.OR = 1] = "OR", s[s.A
343
328
  if (["not_includes", "not-includes", "not includes"].includes(a)) return -10;
344
329
  throw new Error(`Unrecognised operator ${a}`);
345
330
  }
346
- s.fromString = i;
331
+ n.fromString = i;
347
332
  function t(r) {
348
- const a = typeof r == "number" ? r : s.fromString(r);
349
- if (Object.values(s).includes(a)) return a;
333
+ const a = typeof r == "number" ? r : n.fromString(r);
334
+ if (Object.values(n).includes(a)) return a;
350
335
  throw new Error(`Unrecognised operator ${r}`);
351
336
  }
352
- s.fromAny = t;
337
+ n.fromAny = t;
353
338
  function e(r) {
354
- const a = typeof r == "number" ? r : s.fromString(r);
355
- return Object.values(s).includes(a);
339
+ const a = typeof r == "number" ? r : n.fromString(r);
340
+ return Object.values(n).includes(a);
356
341
  }
357
- s.isDefined = e;
358
- function n(r) {
342
+ n.isDefined = e;
343
+ function s(r) {
359
344
  return r >= 0;
360
345
  }
361
- s.isLogicOperator = n;
362
- })(w || (w = {}));
363
- Object.freeze(w);
364
- const f = w, At = Symbol("EnabledChangingAction");
365
- class M extends p {
346
+ n.isLogicOperator = s;
347
+ })(P || (P = {}));
348
+ Object.freeze(P);
349
+ const g = P, It = Symbol("EnabledChangingAction");
350
+ class st extends p {
366
351
  // eslint-disable-next-line @typescript-eslint/no-useless-constructor
367
352
  constructor(i) {
368
353
  super(i);
369
354
  }
370
355
  // eslint-disable-next-line class-methods-use-this
371
356
  static get classIdentifier() {
372
- return At;
357
+ return It;
373
358
  }
374
- execute(i, t, e, n) {
375
- return u(this, null, function* () {
376
- return v(M.prototype, this, "execute").call(this, i, t, e, n);
377
- });
359
+ execute(i, t, e, s) {
360
+ return super.execute(i, t, e, s);
378
361
  }
379
362
  }
380
- const Ft = Symbol("EnabledChangedAction");
381
- class P extends p {
363
+ const Ct = Symbol("EnabledChangedAction");
364
+ class rt extends p {
382
365
  // eslint-disable-next-line @typescript-eslint/no-useless-constructor
383
366
  constructor(i) {
384
367
  super(i);
385
368
  }
386
369
  // eslint-disable-next-line class-methods-use-this
387
370
  static get classIdentifier() {
388
- return Ft;
371
+ return Ct;
389
372
  }
390
- execute(i, t, e, n) {
391
- return u(this, null, function* () {
392
- return v(P.prototype, this, "execute").call(this, i, t, e, n);
393
- });
373
+ execute(i, t, e, s) {
374
+ return super.execute(i, t, e, s);
394
375
  }
395
376
  }
396
- const Nt = Symbol("ValidChangedAction");
397
- class Q extends p {
377
+ const Vt = Symbol("ValidChangedAction");
378
+ class at extends p {
398
379
  // eslint-disable-next-line @typescript-eslint/no-useless-constructor
399
380
  constructor(i) {
400
381
  super(i);
401
382
  }
402
383
  // eslint-disable-next-line class-methods-use-this
403
384
  static get classIdentifier() {
404
- return Nt;
385
+ return Vt;
405
386
  }
406
- execute(i, t, e, n) {
407
- return u(this, null, function* () {
408
- return v(Q.prototype, this, "execute").call(this, i, t, e, n);
409
- });
387
+ execute(i, t, e, s) {
388
+ return super.execute(i, t, e, s);
410
389
  }
411
390
  }
412
- const jt = Symbol("VisibilityChangingAction");
413
- class z extends p {
391
+ const _t = Symbol("VisibilityChangingAction");
392
+ class lt extends p {
414
393
  // eslint-disable-next-line @typescript-eslint/no-useless-constructor
415
394
  constructor(i) {
416
395
  super(i);
417
396
  }
418
397
  // eslint-disable-next-line class-methods-use-this
419
398
  static get classIdentifier() {
420
- return jt;
399
+ return _t;
421
400
  }
422
- execute(i, t, e, n) {
423
- return u(this, null, function* () {
424
- return v(z.prototype, this, "execute").call(this, i, t, e, n);
425
- });
401
+ execute(i, t, e, s) {
402
+ return super.execute(i, t, e, s);
426
403
  }
427
404
  }
428
- const Tt = Symbol("VisibilityChangedAction");
429
- class O extends p {
405
+ const St = Symbol("VisibilityChangedAction");
406
+ class ot extends p {
430
407
  // eslint-disable-next-line @typescript-eslint/no-useless-constructor
431
408
  constructor(i) {
432
409
  super(i);
433
410
  }
434
411
  // eslint-disable-next-line class-methods-use-this
435
412
  static get classIdentifier() {
436
- return Tt;
413
+ return St;
437
414
  }
438
- execute(i, t, e, n) {
439
- return u(this, null, function* () {
440
- return v(O.prototype, this, "execute").call(this, i, t, e, n);
441
- });
415
+ execute(i, t, e, s) {
416
+ return super.execute(i, t, e, s);
442
417
  }
443
418
  }
444
- class x {
419
+ class m {
445
420
  constructor() {
446
- h(this, "reactiveValue", ot(() => this.value));
421
+ o(this, "reactiveValue", et(() => this.value));
447
422
  // contains original field value as was provided at creation
448
- h(this, "valid", !0);
423
+ o(this, "validatingCount", 0);
424
+ o(this, "validating", !1);
425
+ o(this, "_valid", !0);
449
426
  // is current value valid as per FE and BE validators?
450
- h(this, "errors", []);
427
+ o(this, "errors", []);
451
428
  // when member of a Group, fieldName specifies the name of this field
452
- h(this, "actions", new k());
429
+ o(this, "actions", new T());
453
430
  // default property handlers
454
- h(this, "_visibility", I.FULL);
455
- h(this, "_enabled", !0);
431
+ o(this, "_visibility", C.FULL);
432
+ o(this, "_enabled", !0);
456
433
  }
457
434
  get visibility() {
458
435
  return this._visibility;
459
436
  }
460
437
  set visibility(i) {
461
- const t = this._visibility;
462
- if (!I.isDefined(i)) throw new Error("visibility must be a DisplayMode constant");
463
- this._visibility = I.fromAny(i), this.actions.trigger(O, this, this._visibility, t);
464
- }
465
- setVisibility(i) {
466
- return u(this, null, function* () {
467
- const t = this._visibility, e = yield this.actions.trigger(z, this, i, t);
468
- if (!I.isDefined(e != null ? e : i)) throw new Error("visibility must be a DisplayMode constant");
469
- this._visibility = I.fromAny(e != null ? e : i), yield this.actions.trigger(O, this, this._visibility, t);
470
- });
438
+ const t = this._visibility, e = this.actions.trigger(lt, this, i, t);
439
+ if (!C.isDefined(e != null ? e : i)) throw new Error("visibility must be a DisplayMode constant");
440
+ this._visibility = C.fromAny(e != null ? e : i), this.actions.trigger(ot, this, this._visibility, t);
471
441
  }
472
442
  get enabled() {
473
443
  return this._enabled;
474
444
  }
475
445
  set enabled(i) {
476
- const t = this._enabled;
477
- if (!nt(i)) throw new Error("Enabled value must be boolean");
478
- this._enabled = i, this.actions.trigger(P, this, this._enabled, t);
479
- }
480
- setEnabled(i) {
481
- return u(this, null, function* () {
482
- const t = this._enabled, e = yield this.actions.trigger(M, this, i, t);
483
- if (!nt(e != null ? e : i)) throw new Error("Enabled value must be boolean");
484
- this._enabled = e != null ? e : i, yield this.actions.trigger(P, this, this._enabled, t);
485
- });
446
+ const t = this._enabled, e = this.actions.trigger(st, this, i, t);
447
+ if (!bt(e != null ? e : i)) throw new Error("Enabled value must be boolean");
448
+ this._enabled = e != null ? e : i, this.actions.trigger(rt, this, this._enabled, t);
486
449
  }
487
450
  validate() {
488
- const i = this.valid;
489
- this.valid = this.errors.length === 0, this.valid !== i && this.actions.trigger(Q, this, this.valid, i);
451
+ const i = this._valid;
452
+ this._valid = this.valid, this._valid !== i && this.actions.trigger(at, this, this.valid, i);
453
+ }
454
+ get valid() {
455
+ return this.errors.length === 0;
490
456
  }
491
457
  get fullValue() {
492
458
  return this.value;
493
459
  }
494
460
  get isChanged() {
495
- return !B(this.value, this.originalValue);
461
+ return !D(this.value, this.originalValue);
496
462
  }
497
463
  registerAction(i) {
498
464
  const t = i;
@@ -502,61 +468,61 @@ class x {
502
468
  return this.actions.trigger(i, this, ...t);
503
469
  }
504
470
  clearValidators() {
505
- this.actions = this.actions.cloneWithoutValidators(), this.errors = [], this.valid = !0;
471
+ this.actions = this.actions.cloneWithoutValidators(), this.errors = [], this._valid = !0;
506
472
  }
507
473
  }
508
- function Lt(s, i) {
509
- return s ? !i : i;
474
+ function Ft(n, i) {
475
+ return n ? !i : i;
510
476
  }
511
- class j {
477
+ class N {
512
478
  constructor(i, t, e) {
513
- h(this, "operand1");
514
- h(this, "operator");
515
- h(this, "operand2");
479
+ o(this, "operand1");
480
+ o(this, "operator");
481
+ o(this, "operand2");
516
482
  this.operand1 = i, this.operator = t, this.operand2 = e;
517
483
  }
518
484
  get operand1Value() {
519
- return this.operand1 instanceof j ? this.operand1.evaluate() : this.operand1 instanceof x ? d(this.operand1.value) : this.operand1;
485
+ return this.operand1 instanceof N ? this.operand1.evaluate() : this.operand1 instanceof m ? d(this.operand1.value) : this.operand1;
520
486
  }
521
487
  get operand2Value() {
522
- return this.operand2 instanceof j ? this.operand2.evaluate() : this.operand2 instanceof x ? d(this.operand2.value) : this.operand2;
488
+ return this.operand2 instanceof N ? this.operand2.evaluate() : this.operand2 instanceof m ? d(this.operand2.value) : this.operand2;
523
489
  }
524
490
  evaluate() {
525
- var e, n, r, a;
491
+ var e, s, r, a;
526
492
  const i = this.operand1Value, t = this.operand2Value;
527
493
  switch (this.operator) {
528
- case f.AND:
494
+ case g.AND:
529
495
  return i && t;
530
- case f.OR:
496
+ case g.OR:
531
497
  return i || t;
532
- case f.NAND:
498
+ case g.NAND:
533
499
  return !(i && t);
534
- case f.NOR:
500
+ case g.NOR:
535
501
  return !(i || t);
536
- case f.XOR:
537
- return Lt(i, t);
538
- case f.NOT:
502
+ case g.XOR:
503
+ return Ft(i, t);
504
+ case g.NOT:
539
505
  return !i;
540
- case f.EQUALS:
506
+ case g.EQUALS:
541
507
  return i == t;
542
- case f.NOT_EQUALS:
508
+ case g.NOT_EQUALS:
543
509
  return i != t;
544
- case f.LT:
510
+ case g.LT:
545
511
  return i < t;
546
- case f.LE:
512
+ case g.LE:
547
513
  return i <= t;
548
- case f.GE:
514
+ case g.GE:
549
515
  return i >= t;
550
- case f.GT:
516
+ case g.GT:
551
517
  return i > t;
552
- case f.IN:
553
- return (n = (e = t == null ? void 0 : t.includes) == null ? void 0 : e.call(t, i)) != null ? n : !1;
554
- case f.NOT_IN:
518
+ case g.IN:
519
+ return (s = (e = t == null ? void 0 : t.includes) == null ? void 0 : e.call(t, i)) != null ? s : !1;
520
+ case g.NOT_IN:
555
521
  return !((a = (r = t == null ? void 0 : t.includes) == null ? void 0 : r.call(t, i)) == null || a);
556
- case f.INCLUDES:
557
- return C(i) && C(t) && i.indexOf(t) >= 0;
558
- case f.NOT_INCLUDES:
559
- return !(C(i) && C(t) && i.indexOf(t) >= 0);
522
+ case g.INCLUDES:
523
+ return I(i) && I(t) && i.indexOf(t) >= 0;
524
+ case g.NOT_INCLUDES:
525
+ return !(I(i) && I(t) && i.indexOf(t) >= 0);
560
526
  default:
561
527
  throw new Error(`Operator not implemented ${this.operator}`);
562
528
  }
@@ -568,77 +534,73 @@ class j {
568
534
  collectFields() {
569
535
  const i = /* @__PURE__ */ new Set();
570
536
  function t(e) {
571
- e instanceof x ? i.add(e) : e instanceof j && e.collectFields().forEach((r) => i.add(r));
537
+ e instanceof m ? i.add(e) : e instanceof N && e.collectFields().forEach((r) => i.add(r));
572
538
  }
573
539
  return t(this.operand1), t(this.operand2), i;
574
540
  }
575
541
  }
576
- const wt = Symbol("ExecuteAction");
577
- class H extends p {
542
+ const Nt = Symbol("ExecuteAction");
543
+ class ct extends p {
578
544
  // eslint-disable-next-line @typescript-eslint/no-useless-constructor
579
545
  constructor(i) {
580
546
  super(i);
581
547
  }
582
548
  // eslint-disable-next-line class-methods-use-this
583
549
  static get classIdentifier() {
584
- return wt;
550
+ return Nt;
585
551
  }
586
552
  execute(i, t, e) {
587
- return u(this, null, function* () {
588
- return v(H.prototype, this, "execute").call(this, i, t, e);
589
- });
553
+ return super.execute(i, t, e);
590
554
  }
591
555
  }
592
- const Pt = Symbol("ListItemAddedAction");
593
- class U extends p {
556
+ const Lt = Symbol("ListItemAddedAction");
557
+ class z extends p {
594
558
  // eslint-disable-next-line @typescript-eslint/no-useless-constructor
595
559
  constructor(i) {
596
560
  super(i);
597
561
  }
598
562
  // eslint-disable-next-line class-methods-use-this
599
563
  static get classIdentifier() {
600
- return Pt;
564
+ return Lt;
601
565
  }
602
- execute(i, t, e, n) {
603
- return u(this, null, function* () {
604
- return v(U.prototype, this, "execute").call(this, i, t, e, n);
605
- });
566
+ execute(i, t, e, s) {
567
+ return super.execute(i, t, e, s);
606
568
  }
607
569
  }
608
- const Ot = Symbol("ListItemRemovedAction");
609
- class X extends p {
570
+ const jt = Symbol("ListItemRemovedAction");
571
+ class ut extends p {
610
572
  // eslint-disable-next-line @typescript-eslint/no-useless-constructor
611
573
  constructor(i) {
612
574
  super(i);
613
575
  }
614
576
  // eslint-disable-next-line class-methods-use-this
615
577
  static get classIdentifier() {
616
- return Ot;
578
+ return jt;
617
579
  }
618
- execute(i, t, e, n) {
619
- return u(this, null, function* () {
620
- return v(X.prototype, this, "execute").call(this, i, t, e, n);
621
- });
580
+ execute(i, t, e, s) {
581
+ return super.execute(i, t, e, s);
622
582
  }
623
583
  }
624
- function at(s, i) {
625
- return (s == null ? void 0 : s.label) == null && (s == null ? void 0 : s.icon) == null ? i : s;
584
+ function q(n, i) {
585
+ return (n == null ? void 0 : n.label) == null && (n == null ? void 0 : n.icon) == null ? i : n;
626
586
  }
627
- class $ extends x {
628
- constructor(t) {
587
+ class U extends m {
588
+ constructor() {
629
589
  super();
630
- h(this, "_value");
590
+ o(this, "_value", { label: void 0, icon: void 0 });
591
+ }
592
+ init(t) {
631
593
  if (t) {
632
- const e = t, { value: n, originalValue: r, validators: a, actions: l } = e, c = N(e, ["value", "originalValue", "validators", "actions"]);
633
- [...a || [], ...l || []].forEach((S) => this.registerAction(S)), Object.assign(this, c);
634
- const o = { label: n == null ? void 0 : n.label, icon: n == null ? void 0 : n.icon }, m = Object.freeze({ label: r == null ? void 0 : r.label, icon: r == null ? void 0 : r.icon });
635
- this._value = D(at(o, m)), this.originalValue = at(m, o);
636
- } else
637
- this._value = D({ label: void 0, icon: void 0 });
638
- this.actions.triggerEager(this, this.value, this.originalValue);
594
+ const e = t, { value: s, originalValue: r, validators: a, actions: l } = e, c = F(e, ["value", "originalValue", "validators", "actions"]);
595
+ [...a || [], ...l || []].forEach((A) => this.registerAction(A)), Object.assign(this, c);
596
+ const u = q(s, this._value), h = Object.freeze({ label: r == null ? void 0 : r.label, icon: r == null ? void 0 : r.icon });
597
+ this._value = q(u, h), this.originalValue = q(h, u);
598
+ }
599
+ this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
639
600
  }
640
601
  static create(t) {
641
- return D(new $(t));
602
+ const e = it(new U());
603
+ return e.init(t), e;
642
604
  }
643
605
  get value() {
644
606
  return this._value;
@@ -646,50 +608,45 @@ class $ extends x {
646
608
  set value(t) {
647
609
  if (!this.enabled) return;
648
610
  const e = this._value;
649
- this._value.icon = t == null ? void 0 : t.icon, this._value.label = t == null ? void 0 : t.label, this.actions.trigger(g, this, t, e), this.parent && this.parent.notifyValueChanged(), this.validate();
650
- }
651
- setValue(t) {
652
- return u(this, null, function* () {
653
- if (!this.enabled) return;
654
- const e = this._value;
655
- this._value.icon = t == null ? void 0 : t.icon, this._value.label = t == null ? void 0 : t.label, yield this.actions.trigger(g, this, t, e), this.parent && (yield this.parent.notifyValueChanged()), this.validate();
656
- });
611
+ this._value.icon = t == null ? void 0 : t.icon, this._value.label = t == null ? void 0 : t.label, this.actions.trigger(b, this, t, e), this.parent && this.parent.notifyValueChanged(), this.validate();
657
612
  }
658
613
  get icon() {
659
614
  return this.value.icon;
660
615
  }
661
616
  set icon(t) {
662
- this.value = { label: this.label, icon: t };
617
+ this.value.icon = t;
663
618
  }
664
619
  get label() {
665
620
  return this.value.label;
666
621
  }
667
622
  set label(t) {
668
- this.value = { label: t, icon: this.value.icon };
623
+ this.value.label = t;
669
624
  }
670
625
  clone(t) {
671
- var e, n, r, a;
672
- return $.create(F(A({
673
- value: (e = t == null ? void 0 : t.value) != null ? e : this.value
626
+ var s, r, a;
627
+ const e = U.create(S(_({
628
+ value: (s = t == null ? void 0 : t.value) != null ? s : this.value
674
629
  }, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
675
- errors: [...(n = t == null ? void 0 : t.errors) != null ? n : this.errors],
676
630
  enabled: (r = t == null ? void 0 : t.enabled) != null ? r : this.enabled,
677
631
  visibility: (a = t == null ? void 0 : t.visibility) != null ? a : this.visibility
678
632
  }));
633
+ return e.actions = this.actions.clone(), e.actions.triggerEager(e, e.value, e.originalValue), e;
679
634
  }
680
635
  execute(t) {
681
- this.actions.trigger(H, this, t);
636
+ this.actions.trigger(ct, this, t);
682
637
  }
683
638
  }
684
- class V extends x {
685
- constructor(t) {
639
+ class V extends m {
640
+ constructor() {
686
641
  super();
687
- h(this, "_value");
642
+ o(this, "_value");
643
+ }
644
+ init(t) {
688
645
  if (t) {
689
- const e = t, { value: n, validators: r, actions: a } = e, l = N(e, ["value", "validators", "actions"]);
690
- [...r || [], ...a || []].forEach((c) => this.registerAction(c)), Object.assign(this, l), this._value = n != null ? n : this.originalValue, this.originalValue === void 0 && (this.originalValue = this._value);
646
+ const e = t, { value: s, validators: r, actions: a } = e, l = F(e, ["value", "validators", "actions"]);
647
+ [...r || [], ...a || []].forEach((c) => this.registerAction(c)), Object.assign(this, l), this._value = s != null ? s : this.originalValue, this.originalValue === void 0 && (this.originalValue = this._value);
691
648
  }
692
- this.actions.triggerEager(this, this.value, this.originalValue);
649
+ this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
693
650
  }
694
651
  /**
695
652
  * Creates a new reactive Field instance.
@@ -697,49 +654,44 @@ class V extends x {
697
654
  * @returns Reactive Field instance
698
655
  */
699
656
  static create(t) {
700
- return D(new V(t));
657
+ const e = it(new V());
658
+ return e.init(t), e;
701
659
  }
702
660
  get value() {
703
- return this._value;
661
+ return d(this._value);
704
662
  }
705
663
  set value(t) {
706
664
  const e = this._value;
707
- !this.enabled || e === t || (this._value = t, this.actions.trigger(g, this, t, e), this.parent && this.parent.notifyValueChanged(), this.validate());
708
- }
709
- setValue(t) {
710
- return u(this, null, function* () {
711
- const e = this._value;
712
- !this.enabled || e === t || (this._value = t, yield this.actions.trigger(g, this, t, e), this.parent && (yield this.parent.notifyValueChanged()), this.validate());
713
- });
665
+ !this.enabled || e === t || (this._value = t, this.actions.trigger(b, this, t, e), this.parent && this.parent.notifyValueChanged(), this.validate());
714
666
  }
715
667
  clone(t) {
716
- var e, n, r, a;
717
- return V.create(F(A({
718
- value: (e = t == null ? void 0 : t.value) != null ? e : this.value
668
+ var s, r, a;
669
+ const e = V.create(S(_({
670
+ value: (s = t == null ? void 0 : t.value) != null ? s : this.value
719
671
  }, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
720
- errors: [...(n = t == null ? void 0 : t.errors) != null ? n : this.errors],
721
672
  enabled: (r = t == null ? void 0 : t.enabled) != null ? r : this.enabled,
722
673
  visibility: (a = t == null ? void 0 : t.visibility) != null ? a : this.visibility
723
674
  }));
675
+ return e.actions = this.actions.clone(), e.actions.triggerEager(e, e.value, e.originalValue), e;
724
676
  }
725
677
  }
726
- const Ut = V.create({ value: "EmptyField" }).registerAction(new g(
727
- () => u(void 0, null, function* () {
678
+ const Tt = V.create({ value: "EmptyField" }).registerAction(new b(
679
+ () => {
728
680
  console.warn("Working with EmptyField! This should not happen");
729
- })
681
+ }
730
682
  ));
731
- class _ extends x {
683
+ class E extends m {
732
684
  constructor(t, e) {
733
685
  super();
734
- h(this, "_fields");
735
- h(this, "_value", null);
736
- h(this, "suppressNotifyValueChanged", !1);
737
- if (!_.isValidFields(t)) throw new Error("Invalid fields object provided");
686
+ o(this, "_fields");
687
+ o(this, "_value", null);
688
+ o(this, "suppressNotifyValueChanged", !1);
689
+ if (!E.isValidFields(t)) throw new Error("Invalid fields object provided");
738
690
  if (this._fields = {}, Object.entries(t).forEach(([r, a]) => this.addField(r, a)), e) {
739
- const n = e, { value: r, validators: a, actions: l } = n, c = N(n, ["value", "validators", "actions"]);
740
- [...a || [], ...l || []].forEach((o) => this.registerAction(o)), Object.assign(this, c), this.value = r != null ? r : this.originalValue;
691
+ const s = e, { value: r, validators: a, actions: l } = s, c = F(s, ["value", "validators", "actions"]);
692
+ [...a || [], ...l || []].forEach((u) => this.registerAction(u)), Object.assign(this, c), this.value = r != null ? r : this.originalValue;
741
693
  }
742
- this.originalValue === void 0 && (this.originalValue = this.value), this.actions.triggerEager(this, this.value, this.originalValue);
694
+ this.originalValue === void 0 && (this.originalValue = this.value), this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
743
695
  }
744
696
  addField(t, e) {
745
697
  if (this.fields[t] !== void 0)
@@ -753,17 +705,17 @@ class _ extends x {
753
705
  );
754
706
  }
755
707
  static isValidFields(t) {
756
- function e(n) {
757
- return n instanceof x;
708
+ function e(s) {
709
+ return s instanceof m;
758
710
  }
759
- return typeof t == "object" && t !== null && Object.entries(t).every(([, n]) => e(n));
711
+ return typeof t == "object" && t !== null && Object.entries(t).every(([, s]) => e(s));
760
712
  }
761
713
  static createFromFormData(t) {
762
- if (t instanceof x)
714
+ if (t instanceof m)
763
715
  throw new Error("data is already a Form structure, should be a simple object");
764
- return new _(
716
+ return new E(
765
717
  t == null ? {} : Object.fromEntries(
766
- Object.entries(t).map(([e, n]) => [e, V.create({ value: n })])
718
+ Object.entries(t).map(([e, s]) => [e, V.create({ value: s })])
767
719
  )
768
720
  );
769
721
  }
@@ -776,361 +728,343 @@ class _ extends x {
776
728
  }
777
729
  get value() {
778
730
  const t = {};
779
- return Object.entries(this._fields).forEach(([e, n]) => {
780
- const r = n.value;
781
- (n.enabled || n instanceof _ && !J(r)) && (t[e] = r);
782
- }), J(t) ? null : t;
731
+ return Object.entries(this._fields).forEach(([e, s]) => {
732
+ const r = s.value;
733
+ (s.enabled || s instanceof E && !M(r)) && (t[e] = r);
734
+ }), M(t) ? null : t;
783
735
  }
784
736
  set value(t) {
785
737
  this.suppressNotifyValueChanged = !0;
786
738
  try {
787
- Object.entries(this._fields).forEach(([e, n]) => {
788
- (t == null || e in t) && (n.value = t == null ? null : t[e]);
739
+ Object.entries(this._fields).forEach(([e, s]) => {
740
+ (t == null || e in t) && (s.value = t == null ? null : t[e]);
789
741
  });
790
742
  } finally {
791
743
  this.suppressNotifyValueChanged = !1;
792
744
  }
793
- this.notifyValueChanged();
794
- }
795
- setValue(t) {
796
- return u(this, null, function* () {
797
- this.suppressNotifyValueChanged = !0;
798
- function e(n, r) {
799
- return u(this, null, function* () {
800
- (t == null || n in t) && (yield r.setValue(t == null ? null : t[n]));
801
- });
802
- }
803
- try {
804
- for (const [n, r] of Object.entries(this._fields))
805
- yield e(n, r);
806
- } finally {
807
- this.suppressNotifyValueChanged = !1;
808
- }
809
- yield this.notifyValueChanged();
810
- });
745
+ this.notifyValueChanged(), this.validate();
811
746
  }
812
747
  get fullValue() {
813
748
  const t = {};
814
- return Object.entries(this._fields).forEach(([e, n]) => {
815
- t[e] = n.fullValue;
749
+ return Object.entries(this._fields).forEach(([e, s]) => {
750
+ t[e] = s.fullValue;
816
751
  }), t;
817
752
  }
818
753
  notifyValueChanged() {
819
- return u(this, null, function* () {
820
- if (this.suppressNotifyValueChanged) return;
821
- const t = this.value;
822
- if (!B(t, this._value)) {
823
- const e = this._value;
824
- this._value = t, yield this.actions.trigger(g, this, t, e), this.parent && (yield this.parent.notifyValueChanged());
825
- }
826
- });
754
+ if (this.suppressNotifyValueChanged) return;
755
+ const t = this.value;
756
+ if (!D(t, this._value)) {
757
+ const e = this._value;
758
+ this._value = t, this.actions.trigger(b, this, t, e), this.parent && this.parent.notifyValueChanged(), this.validate();
759
+ }
760
+ }
761
+ get valid() {
762
+ return super.valid && Object.values(this._fields).every((t) => t.valid);
827
763
  }
828
764
  clone(t) {
829
- var n, r, a, l;
765
+ var r, a, l;
830
766
  const e = {};
831
- return Object.entries(this._fields).forEach(([c, o]) => {
832
- e[c] = o.clone();
833
- }), new _(e, F(A({
834
- value: (n = t == null ? void 0 : t.value) != null ? n : this.value
767
+ Object.entries(this._fields).forEach(([c, u]) => {
768
+ e[c] = u.clone();
769
+ });
770
+ const s = new E(e, S(_({
771
+ value: (r = t == null ? void 0 : t.value) != null ? r : this.value
835
772
  }, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
836
- errors: [...(r = t == null ? void 0 : t.errors) != null ? r : []],
837
773
  enabled: (a = t == null ? void 0 : t.enabled) != null ? a : this.enabled,
838
774
  visibility: (l = t == null ? void 0 : t.visibility) != null ? l : this.visibility
839
775
  }));
776
+ return s.actions = this.actions.clone(), s.actions.triggerEager(s, s.value, s.originalValue), s;
840
777
  }
841
778
  }
842
- class tt extends x {
779
+ class G extends m {
843
780
  constructor(t, e) {
844
781
  super();
845
- h(this, "_value", null);
846
- h(this, "_itemTemplate");
847
- h(this, "_previousValue");
782
+ o(this, "_value", null);
783
+ o(this, "_itemTemplate");
784
+ o(this, "_previousValue");
848
785
  if (this._itemTemplate = t, e) {
849
- const n = e, { value: r, validators: a, actions: l } = n, c = N(n, ["value", "validators", "actions"]);
850
- [...a || [], ...l || []].forEach((o) => this.registerAction(o)), Object.assign(this, c), r && this.setValueInternal(r);
786
+ const s = e, { value: r, validators: a, actions: l } = s, c = F(s, ["value", "validators", "actions"]);
787
+ [...a || [], ...l || []].forEach((u) => this.registerAction(u)), Object.assign(this, c), r && this.setValueInternal(r);
851
788
  }
852
- this.originalValue === void 0 && (this.originalValue = this.value), this._previousValue = this.value, this.actions.triggerEager(this, this.value, this.originalValue);
789
+ this.originalValue === void 0 && (this.originalValue = this.value), this._previousValue = this.value, this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
853
790
  }
854
791
  processSetValueItem(t) {
855
792
  let e;
856
- return t instanceof _ ? e = t : this._itemTemplate ? e = this._itemTemplate.clone({ value: t }) : e = _.createFromFormData(t), Object.defineProperty(e, "parent", { get: () => this, configurable: !1, enumerable: !1 }), e;
793
+ return t instanceof E ? e = t : this._itemTemplate ? e = this._itemTemplate.clone({ value: t }) : e = E.createFromFormData(t), Object.defineProperty(e, "parent", { get: () => this, configurable: !1, enumerable: !1 }), e;
857
794
  }
858
795
  setValueInternal(t) {
859
796
  Array.isArray(t) && (this._value = t.map((e) => this.processSetValueItem(e)));
860
797
  }
861
798
  get value() {
862
799
  var e;
863
- const t = (e = this._value) == null ? void 0 : e.map((n) => n.value);
864
- return J(t) ? null : t;
800
+ const t = (e = this._value) == null ? void 0 : e.map((s) => s.value);
801
+ return M(t) ? null : t;
865
802
  }
866
803
  set value(t) {
867
804
  const e = this.value;
868
- this.setValueInternal(t), this.actions.trigger(g, this, this.value, e), this.parent && this.parent.notifyValueChanged();
869
- }
870
- setValue(t) {
871
- return u(this, null, function* () {
872
- const e = this.value;
873
- this.setValueInternal(t), yield this.actions.trigger(g, this, this.value, e), this.parent && (yield this.parent.notifyValueChanged());
874
- });
805
+ this.setValueInternal(t), this.actions.trigger(b, this, this.value, e), this.parent && this.parent.notifyValueChanged(), this.validate();
875
806
  }
876
807
  clone(t) {
877
- var e, n, r, a, l;
878
- return new tt((e = this._itemTemplate) == null ? void 0 : e.clone(), F(A({
879
- value: [...(n = t == null ? void 0 : t.value) != null ? n : this.value]
808
+ var s, r, a, l;
809
+ const e = new G((s = this._itemTemplate) == null ? void 0 : s.clone(), S(_({
810
+ value: [...(r = t == null ? void 0 : t.value) != null ? r : this.value]
880
811
  }, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
881
- errors: [...(r = t == null ? void 0 : t.errors) != null ? r : []],
882
812
  enabled: (a = t == null ? void 0 : t.enabled) != null ? a : this.enabled,
883
813
  visibility: (l = t == null ? void 0 : t.visibility) != null ? l : this.visibility
884
814
  }));
815
+ return e.actions = this.actions.clone(), e.actions.triggerEager(e, e.value, e.originalValue), e;
885
816
  }
886
817
  notifyValueChanged() {
887
818
  const t = this.value;
888
- if (!B(t, this._previousValue)) {
819
+ if (!D(t, this._previousValue)) {
889
820
  const e = this._previousValue;
890
- this._previousValue = t, this.actions.trigger(g, this, t, e), this.parent && this.parent.notifyValueChanged();
821
+ this._previousValue = t, this.actions.trigger(b, this, t, e), this.parent && this.parent.notifyValueChanged(), this.validate();
891
822
  }
892
823
  }
824
+ get valid() {
825
+ var t, e;
826
+ return super.valid && ((e = (t = this._value) == null ? void 0 : t.every((s) => s.valid)) != null ? e : !0);
827
+ }
893
828
  get(t) {
894
829
  return this._value != null ? this._value[t] : void 0;
895
830
  }
896
831
  push(t) {
897
- var e, n;
898
- return this.insert(t, (n = (e = this._value) == null ? void 0 : e.length) != null ? n : 0) + 1;
832
+ var e, s;
833
+ return this.insert(t, (s = (e = this._value) == null ? void 0 : e.length) != null ? s : 0) + 1;
899
834
  }
900
835
  pop() {
901
836
  var t, e;
902
837
  return this.remove(((e = (t = this._value) == null ? void 0 : t.length) != null ? e : 0) - 1);
903
838
  }
904
839
  remove(t) {
905
- var n;
840
+ var s;
906
841
  if (this._value == null || t < 0 || this._value.length <= t) return;
907
- let e = (n = this._value.splice(t, 1)) == null ? void 0 : n[0];
908
- return e && (e = e.clone(), this.actions.trigger(X, this, e, t), this.notifyValueChanged()), e;
842
+ let e = (s = this._value.splice(t, 1)) == null ? void 0 : s[0];
843
+ return e && (e = e.clone(), this.actions.trigger(ut, this, e, t), this.notifyValueChanged()), e;
909
844
  }
910
845
  insert(t, e) {
911
846
  for (this._value == null && (this._value = []); this._value.length < e; ) {
912
847
  const r = this.processSetValueItem(null), a = this._value.push(r);
913
- this.actions.trigger(U, this, r, a);
848
+ this.actions.trigger(z, this, r, a);
914
849
  }
915
- const n = this.processSetValueItem(t);
916
- return this._value.splice(e, 0, n), this.actions.trigger(U, this, n, e), this.notifyValueChanged(), e;
850
+ const s = this.processSetValueItem(t);
851
+ return this._value.splice(e, 0, s), this.actions.trigger(z, this, s, e), this.notifyValueChanged(), e;
917
852
  }
918
853
  clear() {
919
854
  this._value = null, this.notifyValueChanged();
920
855
  }
921
856
  }
922
857
  const ht = { useMarkdownInValidators: !0 };
923
- function Rt() {
858
+ function Pt() {
924
859
  return ht;
925
860
  }
926
- function Dt(s) {
927
- Object.assign(ht, s);
861
+ function Ot(n) {
862
+ Object.assign(ht, n);
928
863
  }
929
- const te = {
930
- install(s, i) {
931
- i && Dt(i);
864
+ const Jt = {
865
+ install(n, i) {
866
+ i && Ot(i);
932
867
  }
933
868
  };
934
- function E(s) {
935
- return Rt().useMarkdownInValidators ? new L(s) : s.replace(/[*_~`]/g, "").replace(/\[.*?\]\((.*?)\)/g, "$1").replace(/!\[.*?\]\((.*?)\)/g, "").replace(/#+\s?/g, "").replace(/>\s?/g, "").replace(/(\*|-|\d+\.)\s+/g, "").replace(/`{3}[\s\S]*?`{3}/g, "").replace(/`([^`]+)`/g, "$1").replace(/\n{2,}/g, `
869
+ function y(n) {
870
+ return Pt().useMarkdownInValidators ? new j(n) : n.replace(/[*_~`]/g, "").replace(/\[.*?\]\((.*?)\)/g, "$1").replace(/!\[.*?\]\((.*?)\)/g, "").replace(/#+\s?/g, "").replace(/>\s?/g, "").replace(/(\*|-|\d+\.)\s+/g, "").replace(/`{3}[\s\S]*?`{3}/g, "").replace(/`([^`]+)`/g, "$1").replace(/\n{2,}/g, `
936
871
  `);
937
872
  }
938
- class $t extends b {
939
- constructor(t, e, n) {
873
+ class wt extends f {
874
+ constructor(t, e, s) {
940
875
  let r = !1, a, l;
941
- super((o, m, S) => (a = o, l = m, r || (r = !0, this.otherField.registerAction(new g((G, ft, gt, dt) => u(this, null, function* () {
942
- yield ft(G, gt, dt), this.unregistered || (yield this.execute(S, () => u(this, null, function* () {
943
- return null;
944
- }), a, l));
945
- })))), this.isValidComparison(d(o), d(this.otherField.value)) ? null : [
946
- new y(
947
- this.replacePlaceholders(n, { newValue: o, oldValue: m, field: S, otherField: this.otherField })
876
+ super((u, h, A) => (a = u, l = h, r || (r = !0, this.otherField.registerAction(new b((x, O, w, B) => {
877
+ O(x, w, B), this.unregistered || this.execute(A, () => null, a, l);
878
+ }))), this.isValidComparison(d(u), d(this.otherField.value)) ? null : [
879
+ new v(
880
+ this.replacePlaceholders(s, { newValue: u, oldValue: h, field: A, otherField: this.otherField })
948
881
  )
949
882
  ]));
950
- h(this, "unregistered", !1);
883
+ o(this, "unregistered", !1);
951
884
  this.otherField = t, this.isValidComparison = e;
952
885
  }
953
886
  unregister() {
954
887
  this.unregistered = !0;
955
888
  }
956
889
  }
957
- class Bt extends b {
890
+ class Rt extends f {
958
891
  constructor(i, t) {
959
- const e = t || E("Must be one of [**{allowedAsText}**]");
960
- let n = i.join(", ");
961
- n.length > 60 && (n = xt(n, {
892
+ const e = t || y("Must be one of [**{allowedAsText}**]");
893
+ let s = i.join(", ");
894
+ s.length > 60 && (s = pt(s, {
962
895
  length: 40,
963
896
  separator: ", ",
964
897
  omission: `... (${i.length} items total)`
965
898
  }));
966
899
  const r = (a, l, c) => i.includes(d(a)) ? null : [
967
- new y(
968
- this.replacePlaceholders(e, { newValue: a, oldValue: l, field: c, allowedValues: i, allowedAsText: n })
900
+ new v(
901
+ this.replacePlaceholders(e, { newValue: a, oldValue: l, field: c, allowedValues: i, allowedAsText: s })
969
902
  )
970
903
  ];
971
904
  super(r);
972
905
  }
973
906
  }
974
- function kt(s) {
975
- return s == null ? 0 : lt(s) || C(s) ? s.length : ct(s) && Object.getPrototypeOf(s) === Object.prototype ? Object.keys(s).length : String(s).length;
907
+ function Ut(n) {
908
+ return n == null ? 0 : Z(n) || I(n) ? n.length : tt(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
976
909
  }
977
- class qt extends b {
910
+ class Dt extends f {
978
911
  constructor(i) {
979
- const t = i || E("Please enter a value"), e = (n, r, a) => kt(d(n)) === 0 ? [new y(
980
- this.replacePlaceholders(t, { newValue: n, oldValue: r, field: a })
912
+ const t = i || y("Please enter a value"), e = (s, r, a) => Ut(d(s)) === 0 ? [new v(
913
+ this.replacePlaceholders(t, { newValue: s, oldValue: r, field: a })
981
914
  )] : null;
982
915
  super(e);
983
916
  }
984
917
  }
985
- class Mt extends b {
918
+ class $t extends f {
986
919
  constructor(i, t) {
987
- const e = t || E("Value must be larger or equal to **{minValue}**"), n = (r, a, l) => r < i || r === void 0 ? [
988
- new y(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, minValue: i }))
920
+ const e = t || y("Value must be larger or equal to **{minValue}**"), s = (r, a, l) => r < i || r === void 0 ? [
921
+ new v(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, minValue: i }))
989
922
  ] : null;
990
- super(n);
923
+ super(s);
991
924
  }
992
925
  }
993
- class Qt extends b {
926
+ class Bt extends f {
994
927
  constructor(i, t) {
995
- const e = t || E("Value must be less than or equal to **{maxValue}**"), n = (r, a, l) => r > i || r === void 0 ? [
996
- new y(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, maxValue: i }))
928
+ const e = t || y("Value must be less than or equal to **{maxValue}**"), s = (r, a, l) => r > i || r === void 0 ? [
929
+ new v(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, maxValue: i }))
997
930
  ] : null;
998
- super(n);
931
+ super(s);
999
932
  }
1000
933
  }
1001
- class zt extends b {
934
+ class kt extends f {
1002
935
  constructor(i, t, e) {
1003
- const n = e || E("Value must be between **{minValue}** and **{maxValue}**"), r = (a, l, c) => a < i || a > t || a === void 0 ? [
1004
- new y(
1005
- this.replacePlaceholders(n, { newValue: a, oldValue: l, field: c, minValue: i, maxValue: t })
936
+ const s = e || y("Value must be between **{minValue}** and **{maxValue}**"), r = (a, l, c) => a < i || a > t || a === void 0 ? [
937
+ new v(
938
+ this.replacePlaceholders(s, { newValue: a, oldValue: l, field: c, minValue: i, maxValue: t })
1006
939
  )
1007
940
  ] : null;
1008
941
  super(r);
1009
942
  }
1010
943
  }
1011
- function et(s) {
1012
- return s == null ? 0 : lt(s) || C(s) ? s.length : ct(s) && Object.getPrototypeOf(s) === Object.prototype ? Object.keys(s).length : String(s).length;
944
+ function W(n) {
945
+ return n == null ? 0 : Z(n) || I(n) ? n.length : tt(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
1013
946
  }
1014
- class Ht extends b {
947
+ class qt extends f {
1015
948
  constructor(i, t) {
1016
- const e = t || E("Length must be larger or equal to **{minLength}**"), n = (r, a, l) => et(r) < i ? [
1017
- new y(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, minLength: i }))
949
+ const e = t || y("Length must be larger or equal to **{minLength}**"), s = (r, a, l) => W(r) < i ? [
950
+ new v(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, minLength: i }))
1018
951
  ] : null;
1019
- super(n);
952
+ super(s);
1020
953
  }
1021
954
  }
1022
- class Xt extends b {
955
+ class Mt extends f {
1023
956
  constructor(i, t) {
1024
- const e = t || E("Length must be less than or equal to **{maxLength}**"), n = (r, a, l) => et(r) > i ? [
1025
- new y(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, maxLength: i }))
957
+ const e = t || y("Length must be less than or equal to **{maxLength}**"), s = (r, a, l) => W(r) > i ? [
958
+ new v(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, maxLength: i }))
1026
959
  ] : null;
1027
- super(n);
960
+ super(s);
1028
961
  }
1029
962
  }
1030
- class Gt extends b {
963
+ class Qt extends f {
1031
964
  constructor(i, t, e) {
1032
- const n = e || E("Length must be between **{minLength}** and **{maxLength}**"), r = (a, l, c) => {
1033
- const o = et(a);
1034
- return o < i || o > t ? [
1035
- new y(
1036
- this.replacePlaceholders(n, { newValue: a, oldValue: l, field: c, minLength: i, maxLength: t })
965
+ const s = e || y("Length must be between **{minLength}** and **{maxLength}**"), r = (a, l, c) => {
966
+ const u = W(a);
967
+ return u < i || u > t ? [
968
+ new v(
969
+ this.replacePlaceholders(s, { newValue: a, oldValue: l, field: c, minLength: i, maxLength: t })
1037
970
  )
1038
971
  ] : null;
1039
972
  };
1040
973
  super(r);
1041
974
  }
1042
975
  }
1043
- class Wt extends b {
976
+ class zt extends f {
1044
977
  constructor(i, t) {
1045
- const e = t || E('Value must match pattern "**{pattern}**"'), n = (r, a, l) => i.test(String(d(r))) ? null : [
1046
- new y(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, pattern: i }))
978
+ const e = t || y('Value must match pattern "**{pattern}**"'), s = (r, a, l) => i.test(String(d(r))) ? null : [
979
+ new v(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, pattern: i }))
1047
980
  ];
1048
- super(n);
981
+ super(s);
1049
982
  }
1050
983
  }
1051
- const Jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
984
+ const Ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1052
985
  __proto__: null,
1053
- CompareTo: $t,
1054
- InAllowedValues: Bt,
1055
- LengthInRange: Gt,
1056
- MaxLength: Xt,
1057
- MaxValue: Qt,
1058
- MinLength: Ht,
1059
- MinValue: Mt,
1060
- Pattern: Wt,
1061
- Required: qt,
1062
- ValueInRange: zt
1063
- }, Symbol.toStringTag, { value: "Module" })), ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
986
+ CompareTo: wt,
987
+ InAllowedValues: Rt,
988
+ LengthInRange: Qt,
989
+ MaxLength: Mt,
990
+ MaxValue: Bt,
991
+ MinLength: qt,
992
+ MinValue: $t,
993
+ Pattern: zt,
994
+ Required: Dt,
995
+ Validator: f,
996
+ ValueInRange: kt
997
+ }, Symbol.toStringTag, { value: "Module" })), Kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1064
998
  __proto__: null,
1065
- AbortEventHandlingException: K,
1066
- Action: $,
1067
- ActionsMap: k,
1068
- ConditionalEnabledAction: Ct,
1069
- ConditionalStatementAction: q,
1070
- ConditionalValueAction: Vt,
1071
- ConditionalVisibilityAction: St,
1072
- DisplayMode: I,
1073
- EmptyField: Ut,
1074
- EnabledChangedAction: P,
1075
- EnabledChangingAction: M,
1076
- ExecuteAction: H,
999
+ AbortEventHandlingException: Q,
1000
+ Action: U,
1001
+ ActionsMap: T,
1002
+ ConditionalEnabledAction: Et,
1003
+ ConditionalStatementAction: $,
1004
+ ConditionalValueAction: At,
1005
+ ConditionalVisibilityAction: xt,
1006
+ DisplayMode: C,
1007
+ EmptyField: Tt,
1008
+ EnabledChangedAction: rt,
1009
+ EnabledChangingAction: st,
1010
+ ExecuteAction: ct,
1077
1011
  Field: V,
1078
1012
  FieldActionBase: p,
1079
- FieldBase: x,
1080
- Group: _,
1081
- List: tt,
1082
- ListItemAddedAction: U,
1083
- ListItemRemovedAction: X,
1084
- MdString: L,
1085
- Operator: f,
1086
- Statement: j,
1087
- ValidChangedAction: Q,
1088
- ValidationError: Z,
1089
- ValidationErrorRenderContent: y,
1090
- ValidationErrorText: Et,
1091
- Validator: b,
1092
- Validators: Jt,
1093
- ValueChangedAction: g,
1094
- VisibilityChangedAction: O,
1095
- VisibilityChangingAction: z,
1096
- buildErrorMessage: E,
1097
- isCustomModalContentComponentDef: Y
1013
+ FieldBase: m,
1014
+ Group: E,
1015
+ List: G,
1016
+ ListItemAddedAction: z,
1017
+ ListItemRemovedAction: ut,
1018
+ MdString: j,
1019
+ Operator: g,
1020
+ Statement: N,
1021
+ ValidChangedAction: at,
1022
+ ValidationError: X,
1023
+ ValidationErrorRenderContent: v,
1024
+ ValidationErrorText: vt,
1025
+ Validator: f,
1026
+ Validators: Ht,
1027
+ ValueChangedAction: b,
1028
+ VisibilityChangedAction: ot,
1029
+ VisibilityChangingAction: lt,
1030
+ buildErrorMessage: y,
1031
+ isCustomModalContentComponentDef: H
1098
1032
  }, Symbol.toStringTag, { value: "Module" }));
1099
1033
  export {
1100
- K as AbortEventHandlingException,
1101
- $ as Action,
1102
- k as ActionsMap,
1103
- Ct as ConditionalEnabledAction,
1104
- q as ConditionalStatementAction,
1105
- Vt as ConditionalValueAction,
1106
- St as ConditionalVisibilityAction,
1107
- I as DisplayMode,
1108
- Ut as EmptyField,
1109
- P as EnabledChangedAction,
1110
- M as EnabledChangingAction,
1111
- H as ExecuteAction,
1034
+ Q as AbortEventHandlingException,
1035
+ U as Action,
1036
+ T as ActionsMap,
1037
+ Et as ConditionalEnabledAction,
1038
+ $ as ConditionalStatementAction,
1039
+ At as ConditionalValueAction,
1040
+ xt as ConditionalVisibilityAction,
1041
+ C as DisplayMode,
1042
+ Tt as EmptyField,
1043
+ rt as EnabledChangedAction,
1044
+ st as EnabledChangingAction,
1045
+ ct as ExecuteAction,
1112
1046
  V as Field,
1113
1047
  p as FieldActionBase,
1114
- x as FieldBase,
1115
- _ as Group,
1116
- tt as List,
1117
- U as ListItemAddedAction,
1118
- X as ListItemRemovedAction,
1119
- L as MdString,
1120
- f as Operator,
1121
- j as Statement,
1122
- Q as ValidChangedAction,
1123
- Z as ValidationError,
1124
- y as ValidationErrorRenderContent,
1125
- Et as ValidationErrorText,
1126
- b as Validator,
1127
- Jt as Validators,
1128
- g as ValueChangedAction,
1129
- O as VisibilityChangedAction,
1130
- z as VisibilityChangingAction,
1131
- E as buildErrorMessage,
1132
- ee as default,
1133
- te as forms,
1134
- Y as isCustomModalContentComponentDef
1048
+ m as FieldBase,
1049
+ E as Group,
1050
+ G as List,
1051
+ z as ListItemAddedAction,
1052
+ ut as ListItemRemovedAction,
1053
+ j as MdString,
1054
+ g as Operator,
1055
+ N as Statement,
1056
+ at as ValidChangedAction,
1057
+ X as ValidationError,
1058
+ v as ValidationErrorRenderContent,
1059
+ vt as ValidationErrorText,
1060
+ f as Validator,
1061
+ Ht as Validators,
1062
+ b as ValueChangedAction,
1063
+ ot as VisibilityChangedAction,
1064
+ lt as VisibilityChangingAction,
1065
+ y as buildErrorMessage,
1066
+ Kt as default,
1067
+ Jt as forms,
1068
+ H as isCustomModalContentComponentDef
1135
1069
  };
1136
1070
  //# sourceMappingURL=dynamicforms-vue-forms.js.map