@dynamicforms/vue-forms 0.4.4 → 0.4.6

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.
@@ -19,8 +19,8 @@ var S = (n, s) => {
19
19
  s.indexOf(e) < 0 && K.call(n, e) && (t[e] = n[e]);
20
20
  return t;
21
21
  };
22
- var o = (n, s, t) => $(n, typeof s != "symbol" ? s + "" : s, t);
23
- import { isEqual as U, isBoolean as bt, isString as C, isEmpty as M, truncate as mt, isArray as st, isObject as nt } from "lodash-es";
22
+ var l = (n, s, t) => $(n, typeof s != "symbol" ? s + "" : s, t);
23
+ import { isEqual as U, isBoolean as bt, isString as _, isEmpty as M, truncate as mt, isArray as st, isObject as nt } from "lodash-es";
24
24
  import { unref as g, computed as z, reactive as vt, defineComponent as yt, resolveComponent as Z, createBlock as xt, openBlock as Et, h as w } from "vue";
25
25
  var N = /* @__PURE__ */ ((n) => (n[n.SUPPRESS = 1] = "SUPPRESS", n[n.HIDDEN = 5] = "HIDDEN", n[n.INVISIBLE = 8] = "INVISIBLE", n[n.FULL = 10] = "FULL", n))(N || {});
26
26
  const tt = 10;
@@ -41,10 +41,10 @@ const tt = 10;
41
41
  n.isDefined = e;
42
42
  })(N || (N = {}));
43
43
  Object.freeze(N);
44
- const _ = N;
44
+ const C = N;
45
45
  class b {
46
46
  constructor(s) {
47
- o(this, "executorFn");
47
+ l(this, "executorFn");
48
48
  this.executorFn = s;
49
49
  }
50
50
  static get classIdentifier() {
@@ -56,14 +56,12 @@ class b {
56
56
  execute(s, t, ...e) {
57
57
  return this.executorFn(s, t, ...e);
58
58
  }
59
- // eslint-disable-next-line class-methods-use-this
60
59
  get eager() {
61
60
  return !1;
62
61
  }
63
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
62
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
64
63
  boundToField(s) {
65
64
  }
66
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
67
65
  unregister() {
68
66
  }
69
67
  }
@@ -71,11 +69,9 @@ class H extends Error {
71
69
  }
72
70
  const it = Symbol("ValueChangedAction");
73
71
  class m extends b {
74
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
75
72
  constructor(s) {
76
73
  super(s);
77
74
  }
78
- // eslint-disable-next-line class-methods-use-this
79
75
  static get classIdentifier() {
80
76
  return it;
81
77
  }
@@ -84,6 +80,12 @@ class m extends b {
84
80
  }
85
81
  }
86
82
  class L extends String {
83
+ constructor(t, e, i) {
84
+ super(t);
85
+ l(this, "plugins");
86
+ l(this, "options");
87
+ this.plugins = i, this.options = e;
88
+ }
87
89
  }
88
90
  function G(n) {
89
91
  const s = g(n);
@@ -103,7 +105,7 @@ class W {
103
105
  return "";
104
106
  }
105
107
  }
106
- class Ct extends W {
108
+ class _t extends W {
107
109
  constructor(s, t = "") {
108
110
  super(), this.text = s, this.classes = t;
109
111
  }
@@ -120,8 +122,8 @@ class Ct extends W {
120
122
  class p extends W {
121
123
  constructor(t, e = "") {
122
124
  super();
123
- o(this, "text");
124
- o(this, "textType");
125
+ l(this, "text");
126
+ l(this, "textType");
125
127
  this.classes = e, this.text = t, this.textType = z(() => this.getTextType);
126
128
  }
127
129
  get getTextType() {
@@ -144,8 +146,10 @@ class p extends W {
144
146
  switch (g(this.textType)) {
145
147
  case "string":
146
148
  return {};
147
- case "md":
148
- return { source: this.text.toString() };
149
+ case "md": {
150
+ const t = this.text;
151
+ return { source: t.toString(), options: t.options, plugins: t.plugins };
152
+ }
149
153
  case "component":
150
154
  return g(this.text).componentProps || {};
151
155
  default:
@@ -166,7 +170,7 @@ class p extends W {
166
170
  return this.classes;
167
171
  }
168
172
  }
169
- class _t extends p {
173
+ class Ct extends p {
170
174
  }
171
175
  const Vt = Symbol("Validator");
172
176
  class f extends m {
@@ -175,57 +179,54 @@ class f extends m {
175
179
  * @param validationFn Function that validates the field value and returns errors or null
176
180
  */
177
181
  constructor(t) {
178
- super((i, r, a, l) => {
179
- const c = t(a, l, i) || [], u = (h) => {
182
+ super((i, r, a, o) => {
183
+ const c = t(a, o, i) || [], u = (h) => {
180
184
  var V;
181
185
  h == null || h.forEach(
182
186
  (x) => Object.defineProperty(x, "source", { value: this.source, enumerable: !1, configurable: !1 })
183
187
  );
184
188
  for (let x = i.errors.length - 1; x >= 0; x--) {
185
- const P = i.errors[x];
186
- if (P.source === this.source) {
187
- const O = (V = h == null ? void 0 : h.findIndex((B) => U(B, P))) != null ? V : -1;
188
- O >= 0 ? h == null || h.splice(O, 1) : i.errors.splice(x, 1);
189
+ const O = i.errors[x];
190
+ if (O.source === this.source) {
191
+ const P = (V = h == null ? void 0 : h.findIndex((D) => U(D, O))) != null ? V : -1;
192
+ P >= 0 ? h == null || h.splice(P, 1) : i.errors.splice(x, 1);
189
193
  }
190
194
  }
191
195
  h && h.length > 0 && i.errors.push(...h), i.validate();
192
196
  };
193
197
  return c instanceof Promise ? (i.validating = ++i.validatingCount > 0, c.then((h) => u(h)).finally(() => {
194
198
  i.validatingCount = Math.max(0, i.validatingCount - 1), i.validating = i.validatingCount > 0;
195
- })) : u(c), r(i, a, l);
199
+ })) : u(c), r(i, a, o);
196
200
  });
197
- o(this, "source");
201
+ l(this, "source");
198
202
  this.source = Symbol(this.constructor.name);
199
203
  }
200
- // eslint-disable-next-line class-methods-use-this
201
204
  static get classIdentifier() {
202
205
  return Vt;
203
206
  }
204
- // eslint-disable-next-line class-methods-use-this
205
207
  get eager() {
206
208
  return !0;
207
209
  }
208
- // eslint-disable-next-line class-methods-use-this
209
210
  replacePlaceholders(t, e) {
210
211
  if (G(t)) return t;
211
212
  let i = t;
212
213
  return Object.keys(e).forEach((r) => {
213
214
  i = i.replaceAll(`{${r}}`, e[r]);
214
- }), t instanceof L ? new L(i) : i;
215
+ }), t instanceof L ? new L(i.toString(), t.options, t.plugins) : i;
215
216
  }
216
217
  }
217
- class T extends Map {
218
+ class j extends Map {
218
219
  constructor() {
219
220
  super(...arguments);
220
- o(this, "eagerActions", /* @__PURE__ */ new Set());
221
- o(this, "registeredActions", []);
221
+ l(this, "eagerActions", /* @__PURE__ */ new Set());
222
+ l(this, "registeredActions", []);
222
223
  }
223
224
  register(t) {
224
225
  if (!(t instanceof b)) throw new Error("Invalid action type");
225
226
  this.registeredActions.push(t);
226
227
  const e = t.classIdentifier, i = this.get(e) || (() => null);
227
- function r(a, ...l) {
228
- return t.execute(a, i, ...l);
228
+ function r(a, ...o) {
229
+ return t.execute(a, i, ...o);
229
230
  }
230
231
  this.set(e, r), t.eager && this.eagerActions.add(t.classIdentifier);
231
232
  }
@@ -235,8 +236,8 @@ class T extends Map {
235
236
  const a = this.get(r);
236
237
  try {
237
238
  if (a) return a(e, ...i);
238
- } catch (l) {
239
- if (!(l instanceof H)) throw l;
239
+ } catch (o) {
240
+ if (!(o instanceof H)) throw o;
240
241
  }
241
242
  return null;
242
243
  }
@@ -251,11 +252,11 @@ class T extends Map {
251
252
  }
252
253
  }
253
254
  clone() {
254
- const t = new T();
255
+ const t = new j();
255
256
  return this.registeredActions.forEach((e) => t.register(e)), t;
256
257
  }
257
258
  cloneWithoutValidators() {
258
- const t = new T();
259
+ const t = new j();
259
260
  return this.registeredActions.forEach((e) => {
260
261
  e instanceof f ? e.unregister() : t.register(e);
261
262
  }), t;
@@ -264,27 +265,25 @@ class T extends Map {
264
265
  const At = Symbol("ConditionalStatementAction");
265
266
  class k extends m {
266
267
  constructor(t, e) {
267
- const i = (r, a, l, c) => {
268
+ const i = (r, a, o, c) => {
268
269
  const u = t.evaluate();
269
270
  if (u !== this.lastResult) {
270
271
  for (const h of this.boundFields)
271
272
  e(h, u, this.lastResult);
272
273
  this.lastResult = u;
273
274
  }
274
- return a(r, l, c);
275
+ return a(r, o, c);
275
276
  };
276
277
  super(i);
277
- o(this, "lastResult");
278
+ l(this, "lastResult");
278
279
  // boundField tracks the fields this action is bound to. so that it may perform the executorFn on them and not on the
279
280
  // ValueChangedAction fields that will call the actionExecutor
280
- o(this, "boundFields", /* @__PURE__ */ new Set());
281
+ l(this, "boundFields", /* @__PURE__ */ new Set());
281
282
  t.collectFields().forEach((r) => r.registerAction(new m(i)));
282
283
  }
283
- // eslint-disable-next-line class-methods-use-this
284
284
  static get classIdentifier() {
285
285
  return At;
286
286
  }
287
- // eslint-disable-next-line class-methods-use-this
288
287
  get eager() {
289
288
  return !0;
290
289
  }
@@ -295,7 +294,7 @@ class k extends m {
295
294
  class It extends k {
296
295
  constructor(s) {
297
296
  super(s, (t, e) => {
298
- t.visibility = e ? _.FULL : _.SUPPRESS;
297
+ t.visibility = e ? C.FULL : C.SUPPRESS;
299
298
  });
300
299
  }
301
300
  }
@@ -313,7 +312,7 @@ class wt extends k {
313
312
  });
314
313
  }
315
314
  }
316
- var j = /* @__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))(j || {});
315
+ 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 || {});
317
316
  ((n) => {
318
317
  function s(r) {
319
318
  const a = r.toLowerCase();
@@ -351,15 +350,13 @@ var j = /* @__PURE__ */ ((n) => (n[n.NOT = 0] = "NOT", n[n.OR = 1] = "OR", n[n.A
351
350
  return r >= 0;
352
351
  }
353
352
  n.isLogicOperator = i;
354
- })(j || (j = {}));
355
- Object.freeze(j);
356
- const d = j, Ft = Symbol("EnabledChangingAction");
353
+ })(T || (T = {}));
354
+ Object.freeze(T);
355
+ const d = T, Ft = Symbol("EnabledChangingAction");
357
356
  class rt extends b {
358
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
359
357
  constructor(s) {
360
358
  super(s);
361
359
  }
362
- // eslint-disable-next-line class-methods-use-this
363
360
  static get classIdentifier() {
364
361
  return Ft;
365
362
  }
@@ -369,11 +366,9 @@ class rt extends b {
369
366
  }
370
367
  const Nt = Symbol("EnabledChangedAction");
371
368
  class at extends b {
372
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
373
369
  constructor(s) {
374
370
  super(s);
375
371
  }
376
- // eslint-disable-next-line class-methods-use-this
377
372
  static get classIdentifier() {
378
373
  return Nt;
379
374
  }
@@ -382,12 +377,10 @@ class at extends b {
382
377
  }
383
378
  }
384
379
  const Lt = Symbol("ValidChangedAction");
385
- class lt extends b {
386
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
380
+ class ot extends b {
387
381
  constructor(s) {
388
382
  super(s);
389
383
  }
390
- // eslint-disable-next-line class-methods-use-this
391
384
  static get classIdentifier() {
392
385
  return Lt;
393
386
  }
@@ -395,29 +388,25 @@ class lt extends b {
395
388
  return super.execute(s, t, e, i);
396
389
  }
397
390
  }
398
- const Tt = Symbol("VisibilityChangingAction");
399
- class ot extends b {
400
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
391
+ const jt = Symbol("VisibilityChangingAction");
392
+ class lt extends b {
401
393
  constructor(s) {
402
394
  super(s);
403
395
  }
404
- // eslint-disable-next-line class-methods-use-this
405
396
  static get classIdentifier() {
406
- return Tt;
397
+ return jt;
407
398
  }
408
399
  execute(s, t, e, i) {
409
400
  return super.execute(s, t, e, i);
410
401
  }
411
402
  }
412
- const jt = Symbol("VisibilityChangedAction");
403
+ const Tt = Symbol("VisibilityChangedAction");
413
404
  class ct extends b {
414
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
415
405
  constructor(s) {
416
406
  super(s);
417
407
  }
418
- // eslint-disable-next-line class-methods-use-this
419
408
  static get classIdentifier() {
420
- return jt;
409
+ return Tt;
421
410
  }
422
411
  execute(s, t, e, i) {
423
412
  return super.execute(s, t, e, i);
@@ -425,26 +414,26 @@ class ct extends b {
425
414
  }
426
415
  class y {
427
416
  constructor() {
428
- o(this, "reactiveValue", z(() => this.value));
417
+ l(this, "reactiveValue", z(() => this.value));
429
418
  // contains original field value as was provided at creation
430
- o(this, "validatingCount", 0);
431
- o(this, "validating", !1);
432
- o(this, "_valid", !0);
419
+ l(this, "validatingCount", 0);
420
+ l(this, "validating", !1);
421
+ l(this, "_valid", !0);
433
422
  // is current value valid as per FE and BE validators?
434
- o(this, "errors", []);
423
+ l(this, "errors", []);
435
424
  // when member of a Group, fieldName specifies the name of this field
436
- o(this, "actions", new T());
425
+ l(this, "actions", new j());
437
426
  // default property handlers
438
- o(this, "_visibility", _.FULL);
439
- o(this, "_enabled", !0);
427
+ l(this, "_visibility", C.FULL);
428
+ l(this, "_enabled", !0);
440
429
  }
441
430
  get visibility() {
442
431
  return this._visibility;
443
432
  }
444
433
  set visibility(s) {
445
- const t = this._visibility, e = this.actions.trigger(ot, this, s, t);
446
- if (!_.isDefined(e != null ? e : s)) throw new Error("visibility must be a DisplayMode constant");
447
- this._visibility = _.fromAny(e != null ? e : s), this.actions.trigger(ct, this, this._visibility, t);
434
+ const t = this._visibility, e = this.actions.trigger(lt, this, s, t);
435
+ if (!C.isDefined(e != null ? e : s)) throw new Error("visibility must be a DisplayMode constant");
436
+ this._visibility = C.fromAny(e != null ? e : s), this.actions.trigger(ct, this, this._visibility, t);
448
437
  }
449
438
  get enabled() {
450
439
  return this._enabled;
@@ -457,7 +446,7 @@ class y {
457
446
  validate(s = !1) {
458
447
  s && this.actions.triggerEager(this, this.value, this.value);
459
448
  const t = this._valid;
460
- this._valid = this.valid, this._valid !== t && this.actions.trigger(lt, this, this.valid, t);
449
+ this._valid = this.valid, this._valid !== t && this.actions.trigger(ot, this, this.valid, t);
461
450
  }
462
451
  get valid() {
463
452
  return this.errors.length === 0;
@@ -479,14 +468,14 @@ class y {
479
468
  this.actions = this.actions.cloneWithoutValidators(), this.errors = [], this._valid = !0;
480
469
  }
481
470
  }
482
- function Pt(n, s) {
471
+ function Ot(n, s) {
483
472
  return n ? !s : s;
484
473
  }
485
474
  class F {
486
475
  constructor(s, t, e) {
487
- o(this, "operand1");
488
- o(this, "operator");
489
- o(this, "operand2");
476
+ l(this, "operand1");
477
+ l(this, "operator");
478
+ l(this, "operand2");
490
479
  this.operand1 = s, this.operator = t, this.operand2 = e;
491
480
  }
492
481
  get operand1Value() {
@@ -499,6 +488,7 @@ class F {
499
488
  var e, i, r, a;
500
489
  const s = this.operand1Value, t = this.operand2Value;
501
490
  switch (this.operator) {
491
+ // logical operators
502
492
  case d.AND:
503
493
  return s && t;
504
494
  case d.OR:
@@ -508,9 +498,10 @@ class F {
508
498
  case d.NOR:
509
499
  return !(s || t);
510
500
  case d.XOR:
511
- return Pt(s, t);
501
+ return Ot(s, t);
512
502
  case d.NOT:
513
503
  return !s;
504
+ // comparison operators
514
505
  case d.EQUALS:
515
506
  return s == t;
516
507
  case d.NOT_EQUALS:
@@ -528,9 +519,9 @@ class F {
528
519
  case d.NOT_IN:
529
520
  return !((a = (r = t == null ? void 0 : t.includes) == null ? void 0 : r.call(t, s)) == null || a);
530
521
  case d.INCLUDES:
531
- return C(s) && C(t) && s.indexOf(t) >= 0;
522
+ return _(s) && _(t) && s.indexOf(t) >= 0;
532
523
  case d.NOT_INCLUDES:
533
- return !(C(s) && C(t) && s.indexOf(t) >= 0);
524
+ return !(_(s) && _(t) && s.indexOf(t) >= 0);
534
525
  default:
535
526
  throw new Error(`Operator not implemented ${this.operator}`);
536
527
  }
@@ -547,15 +538,13 @@ class F {
547
538
  return t(this.operand1), t(this.operand2), s;
548
539
  }
549
540
  }
550
- const Ot = Symbol("ExecuteAction");
541
+ const Pt = Symbol("ExecuteAction");
551
542
  class ut extends b {
552
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
553
543
  constructor(s) {
554
544
  super(s);
555
545
  }
556
- // eslint-disable-next-line class-methods-use-this
557
546
  static get classIdentifier() {
558
- return Ot;
547
+ return Pt;
559
548
  }
560
549
  execute(s, t, e) {
561
550
  return super.execute(s, t, e);
@@ -563,11 +552,9 @@ class ut extends b {
563
552
  }
564
553
  const Rt = Symbol("ListItemAddedAction");
565
554
  class Q extends b {
566
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
567
555
  constructor(s) {
568
556
  super(s);
569
557
  }
570
- // eslint-disable-next-line class-methods-use-this
571
558
  static get classIdentifier() {
572
559
  return Rt;
573
560
  }
@@ -577,11 +564,9 @@ class Q extends b {
577
564
  }
578
565
  const Ut = Symbol("ListItemRemovedAction");
579
566
  class ht extends b {
580
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
581
567
  constructor(s) {
582
568
  super(s);
583
569
  }
584
- // eslint-disable-next-line class-methods-use-this
585
570
  static get classIdentifier() {
586
571
  return Ut;
587
572
  }
@@ -590,10 +575,11 @@ class ht extends b {
590
575
  }
591
576
  }
592
577
  const et = Symbol("FieldConstructorGuard");
593
- class D extends y {
578
+ class B extends y {
594
579
  constructor(t) {
595
580
  super();
596
- o(this, "_value");
581
+ l(this, "_value");
582
+ l(this, "_touched", !1);
597
583
  if (t !== et) {
598
584
  const e = this.constructor.name;
599
585
  throw new TypeError(`Don't use constructor to instantiate ${e}. Use ${e}.create<T>`);
@@ -601,8 +587,8 @@ class D extends y {
601
587
  }
602
588
  init(t) {
603
589
  if (t) {
604
- const e = t, { value: i, validators: r, actions: a } = e, l = S(e, ["value", "validators", "actions"]);
605
- [...r || [], ...a || []].forEach((c) => this.registerAction(c)), Object.assign(this, l), this._value = i != null ? i : this.originalValue, this.originalValue === void 0 && (this.originalValue = this._value);
590
+ const e = t, { value: i, validators: r, actions: a } = e, o = S(e, ["value", "validators", "actions"]);
591
+ [...r || [], ...a || []].forEach((c) => this.registerAction(c)), Object.assign(this, o), this._value = i != null ? i : this.originalValue, this.originalValue === void 0 && (this.originalValue = this._value);
606
592
  }
607
593
  this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
608
594
  }
@@ -622,6 +608,12 @@ class D extends y {
622
608
  const e = this._value;
623
609
  !this.enabled || e === t || (this._value = t, this.actions.trigger(m, this, this._value, e), this.parent && this.parent.notifyValueChanged(), this.validate());
624
610
  }
611
+ get touched() {
612
+ return this._touched;
613
+ }
614
+ set touched(t) {
615
+ this._touched = t;
616
+ }
625
617
  clone(t) {
626
618
  var i, r, a;
627
619
  const e = this.constructor.create(I(A({
@@ -633,22 +625,22 @@ class D extends y {
633
625
  return e.actions = this.actions.clone(), e.actions.triggerEager(e, e.value, e.originalValue), e;
634
626
  }
635
627
  }
636
- const kt = D.create({ value: "EmptyField" }).registerAction(new m(
637
- () => {
628
+ const kt = B.create({ value: "EmptyField" }).registerAction(
629
+ new m(() => {
638
630
  console.warn("Working with EmptyField! This should not happen");
639
- }
640
- ));
631
+ })
632
+ );
641
633
  function q(n, s) {
642
634
  return (n == null ? void 0 : n.label) == null && (n == null ? void 0 : n.icon) == null ? s : n;
643
635
  }
644
- class Dt extends D {
636
+ class Bt extends B {
645
637
  constructor(s) {
646
638
  super(s), this._value = { label: void 0, icon: void 0 };
647
639
  }
648
640
  init(s) {
649
641
  if (s) {
650
- const t = s, { value: e, originalValue: i, validators: r, actions: a } = t, l = S(t, ["value", "originalValue", "validators", "actions"]);
651
- [...r || [], ...a || []].forEach((h) => this.registerAction(h)), Object.assign(this, l);
642
+ const t = s, { value: e, originalValue: i, validators: r, actions: a } = t, o = S(t, ["value", "originalValue", "validators", "actions"]);
643
+ [...r || [], ...a || []].forEach((h) => this.registerAction(h)), Object.assign(this, o);
652
644
  const c = q(e, this._value), u = Object.freeze({ label: i == null ? void 0 : i.label, icon: i == null ? void 0 : i.icon });
653
645
  this._value = q(c, u), this.originalValue = q(u, c);
654
646
  }
@@ -673,7 +665,7 @@ class Dt extends D {
673
665
  this.actions.trigger(ut, this, s);
674
666
  }
675
667
  }
676
- const Bt = /* @__PURE__ */ yt({
668
+ const Dt = /* @__PURE__ */ yt({
677
669
  __name: "messages-widget",
678
670
  props: {
679
671
  message: {},
@@ -745,23 +737,26 @@ const Bt = /* @__PURE__ */ yt({
745
737
  r.push(w("div", { class: [s.classes, a.extraClasses] }, a.componentBody));
746
738
  break;
747
739
  case "vue-markdown":
748
- typeof t == "string" ? (console.warn(
749
- "You are using markdown for messages-widget, but you haven't registered a vue-markdown component"
750
- ), r.push(w("div", { class: [s.classes, a.extraClasses] }, a.componentBindings.source))) : r.push(w(
751
- t,
752
- {
753
- class: [s.classes, a.extraClasses, "df-messages-widget-markdown"],
754
- source: a.componentBindings.source
755
- }
756
- ));
740
+ if (typeof t == "string")
741
+ console.warn(
742
+ "You are using markdown for messages-widget, but you haven't registered a vue-markdown component"
743
+ ), r.push(w("div", { class: [s.classes, a.extraClasses] }, a.componentBindings.source));
744
+ else {
745
+ const o = a.componentBindings;
746
+ r.push(
747
+ w(t, {
748
+ class: [s.classes, a.extraClasses, "df-messages-widget-markdown"],
749
+ source: o.source,
750
+ options: o.options,
751
+ plugins: o.plugins
752
+ })
753
+ );
754
+ }
757
755
  break;
758
756
  default:
759
757
  r.push(
760
758
  w(
761
- e.has(a.componentName.toLowerCase()) ? (
762
- // only resolve if it's not a common html element
763
- a.componentName
764
- ) : Z(a.componentName),
759
+ e.has(a.componentName.toLowerCase()) ? a.componentName : Z(a.componentName),
765
760
  I(A({ class: [s.classes, a.extraClasses] }, a.componentBindings), { innerHTML: a.componentBody })
766
761
  )
767
762
  );
@@ -775,27 +770,27 @@ const Bt = /* @__PURE__ */ yt({
775
770
  class E extends y {
776
771
  constructor(t, e) {
777
772
  super();
778
- o(this, "_fields");
779
- o(this, "_value", null);
780
- o(this, "reactiveValue", z(() => this.value));
781
- o(this, "suppressNotifyValueChanged", !1);
773
+ l(this, "_fields");
774
+ l(this, "_value", null);
775
+ l(this, "reactiveValue", z(() => this.value));
776
+ l(this, "suppressNotifyValueChanged", !1);
782
777
  if (!E.isValidFields(t)) throw new Error("Invalid fields object provided");
783
778
  if (this._fields = {}, Object.entries(t).forEach(([r, a]) => this.addField(r, a)), e) {
784
- const i = e, { value: r, validators: a, actions: l } = i, c = S(i, ["value", "validators", "actions"]);
785
- [...a || [], ...l || []].forEach((u) => this.registerAction(u)), Object.assign(this, c), this.value = r != null ? r : this.originalValue;
779
+ const i = e, { value: r, validators: a, actions: o } = i, c = S(i, ["value", "validators", "actions"]);
780
+ [...a || [], ...o || []].forEach((u) => this.registerAction(u)), Object.assign(this, c), this.value = r != null ? r : this.originalValue;
786
781
  }
787
782
  this.originalValue === void 0 && (this.originalValue = this.value), this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
788
783
  }
789
784
  addField(t, e) {
790
785
  if (this.fields[t] !== void 0)
791
786
  throw new Error(`Field ${t} is already in this form`);
792
- Object.defineProperty(e, "parent", { get: () => this, configurable: !1, enumerable: !1 }), Object.defineProperty(e, "fieldName", { get: () => t, configurable: !1, enumerable: !1 }), Object.defineProperty(
793
- this._fields,
794
- t,
795
- { get() {
787
+ Object.defineProperty(e, "parent", { get: () => this, configurable: !1, enumerable: !1 }), Object.defineProperty(e, "fieldName", { get: () => t, configurable: !1, enumerable: !1 }), Object.defineProperty(this._fields, t, {
788
+ get() {
796
789
  return e;
797
- }, configurable: !1, enumerable: !0 }
798
- );
790
+ },
791
+ configurable: !1,
792
+ enumerable: !0
793
+ });
799
794
  }
800
795
  static isValidFields(t) {
801
796
  function e(i) {
@@ -807,9 +802,7 @@ class E extends y {
807
802
  if (t instanceof y)
808
803
  throw new Error("data is already a Form structure, should be a simple object");
809
804
  return new E(
810
- t == null ? {} : Object.fromEntries(
811
- Object.entries(t).map(([e, i]) => [e, D.create({ value: i })])
812
- )
805
+ t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, i]) => [e, B.create({ value: i })]))
813
806
  );
814
807
  }
815
808
  field(t) {
@@ -837,6 +830,14 @@ class E extends y {
837
830
  }
838
831
  this.notifyValueChanged(), this.validate();
839
832
  }
833
+ get touched() {
834
+ return Object.values(this._fields).some((t) => t.touched);
835
+ }
836
+ set touched(t) {
837
+ Object.values(this._fields).forEach((e) => {
838
+ e.touched = t;
839
+ });
840
+ }
840
841
  get fullValue() {
841
842
  const t = {};
842
843
  return Object.entries(this._fields).forEach(([e, i]) => {
@@ -858,7 +859,7 @@ class E extends y {
858
859
  t && Object.values(this._fields).forEach((e) => e.validate(!0)), super.validate(t);
859
860
  }
860
861
  clone(t) {
861
- var r, a, l;
862
+ var r, a, o;
862
863
  const e = {};
863
864
  Object.entries(this._fields).forEach(([c, u]) => {
864
865
  e[c] = u.clone();
@@ -867,7 +868,7 @@ class E extends y {
867
868
  value: (r = t == null ? void 0 : t.value) != null ? r : this.value
868
869
  }, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
869
870
  enabled: (a = t == null ? void 0 : t.enabled) != null ? a : this.enabled,
870
- visibility: (l = t == null ? void 0 : t.visibility) != null ? l : this.visibility
871
+ visibility: (o = t == null ? void 0 : t.visibility) != null ? o : this.visibility
871
872
  }));
872
873
  return i.actions = this.actions.clone(), i.actions.triggerEager(i, i.value, i.originalValue), i;
873
874
  }
@@ -875,12 +876,12 @@ class E extends y {
875
876
  class X extends y {
876
877
  constructor(t, e) {
877
878
  super();
878
- o(this, "_value", null);
879
- o(this, "_itemTemplate");
880
- o(this, "_previousValue");
879
+ l(this, "_value", null);
880
+ l(this, "_itemTemplate");
881
+ l(this, "_previousValue");
881
882
  if (this._itemTemplate = t, e) {
882
- const i = e, { value: r, validators: a, actions: l } = i, c = S(i, ["value", "validators", "actions"]);
883
- [...a || [], ...l || []].forEach((u) => this.registerAction(u)), Object.assign(this, c), r && this.setValueInternal(r);
883
+ const i = e, { value: r, validators: a, actions: o } = i, c = S(i, ["value", "validators", "actions"]);
884
+ [...a || [], ...o || []].forEach((u) => this.registerAction(u)), Object.assign(this, c), r && this.setValueInternal(r);
884
885
  }
885
886
  this.originalValue === void 0 && (this.originalValue = this.value), this._previousValue = this.value, this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
886
887
  }
@@ -900,13 +901,23 @@ class X extends y {
900
901
  const e = this.value;
901
902
  this.setValueInternal(t), this.actions.trigger(m, this, this.value, e), this.parent && this.parent.notifyValueChanged(), this.validate();
902
903
  }
904
+ get touched() {
905
+ var t;
906
+ return ((t = this._value) == null ? void 0 : t.some((e) => e.touched)) || !1;
907
+ }
908
+ set touched(t) {
909
+ var e;
910
+ (e = this._value) == null || e.forEach((i) => {
911
+ i.touched = t;
912
+ });
913
+ }
903
914
  clone(t) {
904
- var i, r, a, l;
915
+ var i, r, a, o;
905
916
  const e = new X((i = this._itemTemplate) == null ? void 0 : i.clone(), I(A({
906
917
  value: [...(r = t == null ? void 0 : t.value) != null ? r : this.value]
907
918
  }, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
908
919
  enabled: (a = t == null ? void 0 : t.enabled) != null ? a : this.enabled,
909
- visibility: (l = t == null ? void 0 : t.visibility) != null ? l : this.visibility
920
+ visibility: (o = t == null ? void 0 : t.visibility) != null ? o : this.visibility
910
921
  }));
911
922
  return e.actions = this.actions.clone(), e.actions.triggerEager(e, e.value, e.originalValue), e;
912
923
  }
@@ -972,15 +983,17 @@ function v(n) {
972
983
  }
973
984
  class Mt extends f {
974
985
  constructor(t, e, i) {
975
- let r = !1, a, l;
976
- super((u, h, V) => (a = u, l = h, r || (r = !0, this.otherField.registerAction(new m((x, P, O, B) => {
977
- P(x, O, B), this.unregistered || this.execute(V, () => null, a, l);
978
- }))), this.isValidComparison(g(u), g(this.otherField.value)) ? null : [
986
+ let r = !1, a, o;
987
+ super((u, h, V) => (a = u, o = h, r || (r = !0, this.otherField.registerAction(
988
+ new m((x, O, P, D) => {
989
+ O(x, P, D), this.unregistered || this.execute(V, () => null, a, o);
990
+ })
991
+ )), this.isValidComparison(g(u), g(this.otherField.value)) ? null : [
979
992
  new p(
980
993
  this.replacePlaceholders(i, { newValue: u, oldValue: h, field: V, otherField: this.otherField })
981
994
  )
982
995
  ]));
983
- o(this, "unregistered", !1);
996
+ l(this, "unregistered", !1);
984
997
  this.otherField = t, this.isValidComparison = e;
985
998
  }
986
999
  unregister() {
@@ -996,77 +1009,75 @@ class Ht extends f {
996
1009
  separator: ", ",
997
1010
  omission: `... (${s.length} items total)`
998
1011
  }));
999
- const r = (a, l, c) => s.includes(g(a)) ? null : [
1012
+ const r = (a, o, c) => s.includes(g(a)) ? null : [
1000
1013
  new p(
1001
- this.replacePlaceholders(e, { newValue: a, oldValue: l, field: c, allowedValues: s, allowedAsText: i })
1014
+ this.replacePlaceholders(e, { newValue: a, oldValue: o, field: c, allowedValues: s, allowedAsText: i })
1002
1015
  )
1003
1016
  ];
1004
1017
  super(r);
1005
1018
  }
1006
1019
  }
1007
1020
  function Qt(n) {
1008
- return n == null ? 0 : st(n) || C(n) ? n.length : nt(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
1021
+ return n == null ? 0 : st(n) || _(n) ? n.length : nt(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
1009
1022
  }
1010
1023
  class zt extends f {
1011
1024
  constructor(s) {
1012
- const t = s || v("Please enter a value"), e = (i, r, a) => Qt(g(i)) === 0 ? [new p(
1013
- this.replacePlaceholders(t, { newValue: i, oldValue: r, field: a })
1014
- )] : null;
1025
+ const t = s || v("Please enter a value"), e = (i, r, a) => Qt(g(i)) === 0 ? [new p(this.replacePlaceholders(t, { newValue: i, oldValue: r, field: a }))] : null;
1015
1026
  super(e);
1016
1027
  }
1017
1028
  }
1018
1029
  class Gt extends f {
1019
1030
  constructor(s, t) {
1020
- const e = t || v("Value must be larger or equal to **{minValue}**"), i = (r, a, l) => r < s || r === void 0 ? [
1021
- new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, minValue: s }))
1031
+ const e = t || v("Value must be larger or equal to **{minValue}**"), i = (r, a, o) => r < s || r === void 0 ? [
1032
+ new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: o, minValue: s }))
1022
1033
  ] : null;
1023
1034
  super(i);
1024
1035
  }
1025
1036
  }
1026
1037
  class Wt extends f {
1027
1038
  constructor(s, t) {
1028
- const e = t || v("Value must be less than or equal to **{maxValue}**"), i = (r, a, l) => r > s || r === void 0 ? [
1029
- new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, maxValue: s }))
1039
+ const e = t || v("Value must be less than or equal to **{maxValue}**"), i = (r, a, o) => r > s || r === void 0 ? [
1040
+ new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: o, maxValue: s }))
1030
1041
  ] : null;
1031
1042
  super(i);
1032
1043
  }
1033
1044
  }
1034
1045
  class Xt extends f {
1035
1046
  constructor(s, t, e) {
1036
- const i = e || v("Value must be between **{minValue}** and **{maxValue}**"), r = (a, l, c) => a < s || a > t || a === void 0 ? [
1047
+ const i = e || v("Value must be between **{minValue}** and **{maxValue}**"), r = (a, o, c) => a < s || a > t || a === void 0 ? [
1037
1048
  new p(
1038
- this.replacePlaceholders(i, { newValue: a, oldValue: l, field: c, minValue: s, maxValue: t })
1049
+ this.replacePlaceholders(i, { newValue: a, oldValue: o, field: c, minValue: s, maxValue: t })
1039
1050
  )
1040
1051
  ] : null;
1041
1052
  super(r);
1042
1053
  }
1043
1054
  }
1044
1055
  function Y(n) {
1045
- return n == null ? 0 : st(n) || C(n) ? n.length : nt(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
1056
+ return n == null ? 0 : st(n) || _(n) ? n.length : nt(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
1046
1057
  }
1047
1058
  class Yt extends f {
1048
1059
  constructor(s, t) {
1049
- const e = t || v("Length must be larger or equal to **{minLength}**"), i = (r, a, l) => Y(r) < s ? [
1050
- new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, minLength: s }))
1060
+ const e = t || v("Length must be larger or equal to **{minLength}**"), i = (r, a, o) => Y(r) < s ? [
1061
+ new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: o, minLength: s }))
1051
1062
  ] : null;
1052
1063
  super(i);
1053
1064
  }
1054
1065
  }
1055
1066
  class Jt extends f {
1056
1067
  constructor(s, t) {
1057
- const e = t || v("Length must be less than or equal to **{maxLength}**"), i = (r, a, l) => Y(r) > s ? [
1058
- new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, maxLength: s }))
1068
+ const e = t || v("Length must be less than or equal to **{maxLength}**"), i = (r, a, o) => Y(r) > s ? [
1069
+ new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: o, maxLength: s }))
1059
1070
  ] : null;
1060
1071
  super(i);
1061
1072
  }
1062
1073
  }
1063
1074
  class Kt extends f {
1064
1075
  constructor(s, t, e) {
1065
- const i = e || v("Length must be between **{minLength}** and **{maxLength}**"), r = (a, l, c) => {
1076
+ const i = e || v("Length must be between **{minLength}** and **{maxLength}**"), r = (a, o, c) => {
1066
1077
  const u = Y(a);
1067
1078
  return u < s || u > t ? [
1068
1079
  new p(
1069
- this.replacePlaceholders(i, { newValue: a, oldValue: l, field: c, minLength: s, maxLength: t })
1080
+ this.replacePlaceholders(i, { newValue: a, oldValue: o, field: c, minLength: s, maxLength: t })
1070
1081
  )
1071
1082
  ] : null;
1072
1083
  };
@@ -1075,8 +1086,8 @@ class Kt extends f {
1075
1086
  }
1076
1087
  class Zt extends f {
1077
1088
  constructor(s, t) {
1078
- const e = t || v('Value must match pattern "**{pattern}**"'), i = (r, a, l) => s.test(String(g(r))) ? null : [
1079
- new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, pattern: s }))
1089
+ const e = t || v('Value must match pattern "**{pattern}**"'), i = (r, a, o) => s.test(String(g(r))) ? null : [
1090
+ new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: o, pattern: s }))
1080
1091
  ];
1081
1092
  super(i);
1082
1093
  }
@@ -1097,18 +1108,18 @@ const te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1097
1108
  }, Symbol.toStringTag, { value: "Module" })), re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1098
1109
  __proto__: null,
1099
1110
  AbortEventHandlingException: H,
1100
- Action: Dt,
1101
- ActionsMap: T,
1111
+ Action: Bt,
1112
+ ActionsMap: j,
1102
1113
  ConditionalEnabledAction: St,
1103
1114
  ConditionalStatementAction: k,
1104
1115
  ConditionalValueAction: wt,
1105
1116
  ConditionalVisibilityAction: It,
1106
- DisplayMode: _,
1117
+ DisplayMode: C,
1107
1118
  EmptyField: kt,
1108
1119
  EnabledChangedAction: at,
1109
1120
  EnabledChangingAction: rt,
1110
1121
  ExecuteAction: ut,
1111
- Field: D,
1122
+ Field: B,
1112
1123
  FieldActionBase: b,
1113
1124
  FieldBase: y,
1114
1125
  Group: E,
@@ -1116,36 +1127,36 @@ const te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1116
1127
  ListItemAddedAction: Q,
1117
1128
  ListItemRemovedAction: ht,
1118
1129
  MdString: L,
1119
- MessagesWidget: Bt,
1130
+ MessagesWidget: Dt,
1120
1131
  Operator: d,
1121
- RenderableValue: _t,
1132
+ RenderableValue: Ct,
1122
1133
  Statement: F,
1123
- ValidChangedAction: lt,
1134
+ ValidChangedAction: ot,
1124
1135
  ValidationError: W,
1125
1136
  ValidationErrorRenderContent: p,
1126
- ValidationErrorText: Ct,
1137
+ ValidationErrorText: _t,
1127
1138
  Validator: f,
1128
1139
  Validators: te,
1129
1140
  ValueChangedAction: m,
1130
1141
  VisibilityChangedAction: ct,
1131
- VisibilityChangingAction: ot,
1142
+ VisibilityChangingAction: lt,
1132
1143
  buildErrorMessage: v,
1133
1144
  isSimpleComponentDef: G
1134
1145
  }, Symbol.toStringTag, { value: "Module" }));
1135
1146
  export {
1136
1147
  H as AbortEventHandlingException,
1137
- Dt as Action,
1138
- T as ActionsMap,
1148
+ Bt as Action,
1149
+ j as ActionsMap,
1139
1150
  St as ConditionalEnabledAction,
1140
1151
  k as ConditionalStatementAction,
1141
1152
  wt as ConditionalValueAction,
1142
1153
  It as ConditionalVisibilityAction,
1143
- _ as DisplayMode,
1154
+ C as DisplayMode,
1144
1155
  kt as EmptyField,
1145
1156
  at as EnabledChangedAction,
1146
1157
  rt as EnabledChangingAction,
1147
1158
  ut as ExecuteAction,
1148
- D as Field,
1159
+ B as Field,
1149
1160
  b as FieldActionBase,
1150
1161
  y as FieldBase,
1151
1162
  E as Group,
@@ -1153,19 +1164,19 @@ export {
1153
1164
  Q as ListItemAddedAction,
1154
1165
  ht as ListItemRemovedAction,
1155
1166
  L as MdString,
1156
- Bt as MessagesWidget,
1167
+ Dt as MessagesWidget,
1157
1168
  d as Operator,
1158
- _t as RenderableValue,
1169
+ Ct as RenderableValue,
1159
1170
  F as Statement,
1160
- lt as ValidChangedAction,
1171
+ ot as ValidChangedAction,
1161
1172
  W as ValidationError,
1162
1173
  p as ValidationErrorRenderContent,
1163
- Ct as ValidationErrorText,
1174
+ _t as ValidationErrorText,
1164
1175
  f as Validator,
1165
1176
  te as Validators,
1166
1177
  m as ValueChangedAction,
1167
1178
  ct as VisibilityChangedAction,
1168
- ot as VisibilityChangingAction,
1179
+ lt as VisibilityChangingAction,
1169
1180
  v as buildErrorMessage,
1170
1181
  re as default,
1171
1182
  ie as forms,