@dynamicforms/vue-forms 0.1.4 → 0.2.0

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