@dynamicforms/vue-forms 0.2.3 → 0.2.5

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