@dynamicforms/vue-forms 0.3.4 → 0.4.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,37 +1,37 @@
|
|
|
1
1
|
var ht = Object.defineProperty, gt = Object.defineProperties;
|
|
2
2
|
var dt = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var w = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
4
|
+
var J = Object.prototype.hasOwnProperty, K = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var B = (n, i, t) => i in n ? ht(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t, P = (n, i) => {
|
|
6
6
|
for (var t in i || (i = {}))
|
|
7
|
-
|
|
7
|
+
J.call(i, t) && B(n, t, i[t]);
|
|
8
8
|
if (w)
|
|
9
9
|
for (var t of w(i))
|
|
10
|
-
|
|
10
|
+
K.call(i, t) && B(n, t, i[t]);
|
|
11
11
|
return n;
|
|
12
12
|
}, O = (n, i) => gt(n, dt(i));
|
|
13
|
-
var
|
|
13
|
+
var _ = (n, i) => {
|
|
14
14
|
var t = {};
|
|
15
15
|
for (var e in n)
|
|
16
|
-
|
|
16
|
+
J.call(n, e) && i.indexOf(e) < 0 && (t[e] = n[e]);
|
|
17
17
|
if (n != null && w)
|
|
18
18
|
for (var e of w(n))
|
|
19
|
-
i.indexOf(e) < 0 &&
|
|
19
|
+
i.indexOf(e) < 0 && K.call(n, e) && (t[e] = n[e]);
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
22
|
var o = (n, i, t) => B(n, typeof i != "symbol" ? i + "" : i, t);
|
|
23
|
-
import { isEqual as R, isBoolean as ft, isString as
|
|
24
|
-
import { unref as d, computed as
|
|
23
|
+
import { isEqual as R, isBoolean as ft, isString as V, isEmpty as q, truncate as pt, isArray as tt, isObject as et } from "lodash-es";
|
|
24
|
+
import { unref as d, computed as z, reactive as bt } from "vue";
|
|
25
25
|
var S = /* @__PURE__ */ ((n) => (n[n.SUPPRESS = 1] = "SUPPRESS", n[n.HIDDEN = 5] = "HIDDEN", n[n.INVISIBLE = 8] = "INVISIBLE", n[n.FULL = 10] = "FULL", n))(S || {});
|
|
26
|
-
const
|
|
26
|
+
const Y = 10;
|
|
27
27
|
((n) => {
|
|
28
28
|
function i(s) {
|
|
29
|
-
return s.toUpperCase() === "SUPPRESS" ? 1 : s.toUpperCase() === "HIDDEN" ? 5 : s.toUpperCase() === "INVISIBLE" ? 8 :
|
|
29
|
+
return s.toUpperCase() === "SUPPRESS" ? 1 : s.toUpperCase() === "HIDDEN" ? 5 : s.toUpperCase() === "INVISIBLE" ? 8 : Y;
|
|
30
30
|
}
|
|
31
31
|
n.fromString = i;
|
|
32
32
|
function t(s) {
|
|
33
33
|
const r = typeof s == "number" ? s : n.fromString(s);
|
|
34
|
-
return Object.values(n).includes(r) ? r :
|
|
34
|
+
return Object.values(n).includes(r) ? r : Y;
|
|
35
35
|
}
|
|
36
36
|
n.fromAny = t;
|
|
37
37
|
function e(s) {
|
|
@@ -41,8 +41,8 @@ const K = 10;
|
|
|
41
41
|
n.isDefined = e;
|
|
42
42
|
})(S || (S = {}));
|
|
43
43
|
Object.freeze(S);
|
|
44
|
-
const
|
|
45
|
-
class
|
|
44
|
+
const A = S;
|
|
45
|
+
class b {
|
|
46
46
|
constructor(i) {
|
|
47
47
|
o(this, "executorFn");
|
|
48
48
|
this.executorFn = i;
|
|
@@ -70,7 +70,7 @@ class p {
|
|
|
70
70
|
class M extends Error {
|
|
71
71
|
}
|
|
72
72
|
const it = Symbol("ValueChangedAction");
|
|
73
|
-
class v extends
|
|
73
|
+
class v extends b {
|
|
74
74
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
75
75
|
constructor(i) {
|
|
76
76
|
super(i);
|
|
@@ -85,25 +85,22 @@ class v extends p {
|
|
|
85
85
|
}
|
|
86
86
|
class F extends String {
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function G(n) {
|
|
89
89
|
const i = d(n);
|
|
90
90
|
return typeof i == "object" && "componentName" in i;
|
|
91
91
|
}
|
|
92
|
-
class
|
|
92
|
+
class H {
|
|
93
93
|
get componentName() {
|
|
94
94
|
return "Comment";
|
|
95
95
|
}
|
|
96
|
-
// eslint-disable-line class-methods-use-this
|
|
97
96
|
get componentBindings() {
|
|
98
97
|
return {};
|
|
99
98
|
}
|
|
100
|
-
// eslint-disable-line class-methods-use-this
|
|
101
99
|
get componentBody() {
|
|
102
100
|
return "";
|
|
103
101
|
}
|
|
104
|
-
// eslint-disable-line class-methods-use-this
|
|
105
102
|
}
|
|
106
|
-
class vt extends
|
|
103
|
+
class vt extends H {
|
|
107
104
|
constructor(t) {
|
|
108
105
|
super();
|
|
109
106
|
o(this, "text");
|
|
@@ -112,21 +109,20 @@ class vt extends G {
|
|
|
112
109
|
get componentName() {
|
|
113
110
|
return "template";
|
|
114
111
|
}
|
|
115
|
-
// eslint-disable-line class-methods-use-this
|
|
116
112
|
get componentBody() {
|
|
117
113
|
return this.text;
|
|
118
114
|
}
|
|
119
115
|
}
|
|
120
|
-
class
|
|
116
|
+
class p extends H {
|
|
121
117
|
constructor(t) {
|
|
122
118
|
super();
|
|
123
119
|
o(this, "text");
|
|
124
120
|
o(this, "textType");
|
|
125
|
-
this.text = t, this.textType =
|
|
121
|
+
this.text = t, this.textType = z(() => this.getTextType);
|
|
126
122
|
}
|
|
127
123
|
get getTextType() {
|
|
128
124
|
const t = d(this.text);
|
|
129
|
-
return t ? t instanceof F ? "md" :
|
|
125
|
+
return t ? t instanceof F ? "md" : G(t) ? "component" : "string" : "string";
|
|
130
126
|
}
|
|
131
127
|
get componentName() {
|
|
132
128
|
switch (d(this.textType)) {
|
|
@@ -147,7 +143,7 @@ class b extends G {
|
|
|
147
143
|
case "md":
|
|
148
144
|
return { source: this.text.toString() };
|
|
149
145
|
case "component":
|
|
150
|
-
return d(this.text).componentProps;
|
|
146
|
+
return d(this.text).componentProps || {};
|
|
151
147
|
default:
|
|
152
148
|
return {};
|
|
153
149
|
}
|
|
@@ -156,12 +152,16 @@ class b extends G {
|
|
|
156
152
|
switch (d(this.textType)) {
|
|
157
153
|
case "string":
|
|
158
154
|
return d(this.text);
|
|
155
|
+
case "component":
|
|
156
|
+
return d(this.text).componentVHtml || "";
|
|
159
157
|
default:
|
|
160
158
|
return "";
|
|
161
159
|
}
|
|
162
160
|
}
|
|
163
161
|
}
|
|
164
|
-
|
|
162
|
+
class mt extends p {
|
|
163
|
+
}
|
|
164
|
+
const yt = Symbol("Validator");
|
|
165
165
|
class f extends v {
|
|
166
166
|
/**
|
|
167
167
|
* Creates a new validator
|
|
@@ -170,14 +170,14 @@ class f extends v {
|
|
|
170
170
|
constructor(t) {
|
|
171
171
|
super((s, r, a, l) => {
|
|
172
172
|
const c = t(a, l, s) || [], u = (h) => {
|
|
173
|
-
var
|
|
173
|
+
var I;
|
|
174
174
|
h == null || h.forEach(
|
|
175
175
|
(x) => Object.defineProperty(x, "source", { value: this.source, enumerable: !1, configurable: !1 })
|
|
176
176
|
);
|
|
177
177
|
for (let x = s.errors.length - 1; x >= 0; x--) {
|
|
178
178
|
const T = s.errors[x];
|
|
179
179
|
if (T.source === this.source) {
|
|
180
|
-
const j = (
|
|
180
|
+
const j = (I = h == null ? void 0 : h.findIndex(($) => R($, T))) != null ? I : -1;
|
|
181
181
|
j >= 0 ? h == null || h.splice(j, 1) : s.errors.splice(x, 1);
|
|
182
182
|
}
|
|
183
183
|
}
|
|
@@ -192,7 +192,7 @@ class f extends v {
|
|
|
192
192
|
}
|
|
193
193
|
// eslint-disable-next-line class-methods-use-this
|
|
194
194
|
static get classIdentifier() {
|
|
195
|
-
return
|
|
195
|
+
return yt;
|
|
196
196
|
}
|
|
197
197
|
// eslint-disable-next-line class-methods-use-this
|
|
198
198
|
get eager() {
|
|
@@ -200,7 +200,7 @@ class f extends v {
|
|
|
200
200
|
}
|
|
201
201
|
// eslint-disable-next-line class-methods-use-this
|
|
202
202
|
replacePlaceholders(t, e) {
|
|
203
|
-
if (
|
|
203
|
+
if (G(t)) return t;
|
|
204
204
|
let s = t;
|
|
205
205
|
return Object.keys(e).forEach((r) => {
|
|
206
206
|
s = s.replaceAll(`{${r}}`, e[r]);
|
|
@@ -214,7 +214,7 @@ class N extends Map {
|
|
|
214
214
|
o(this, "registeredActions", []);
|
|
215
215
|
}
|
|
216
216
|
register(t) {
|
|
217
|
-
if (!(t instanceof
|
|
217
|
+
if (!(t instanceof b)) throw new Error("Invalid action type");
|
|
218
218
|
this.registeredActions.push(t);
|
|
219
219
|
const e = t.classIdentifier, s = this.get(e) || (() => null);
|
|
220
220
|
function r(a, ...l) {
|
|
@@ -254,7 +254,7 @@ class N extends Map {
|
|
|
254
254
|
}), t;
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
const
|
|
257
|
+
const xt = Symbol("ConditionalStatementAction");
|
|
258
258
|
class U extends v {
|
|
259
259
|
constructor(t, e) {
|
|
260
260
|
const s = (r, a, l, c) => {
|
|
@@ -275,7 +275,7 @@ class U extends v {
|
|
|
275
275
|
}
|
|
276
276
|
// eslint-disable-next-line class-methods-use-this
|
|
277
277
|
static get classIdentifier() {
|
|
278
|
-
return
|
|
278
|
+
return xt;
|
|
279
279
|
}
|
|
280
280
|
// eslint-disable-next-line class-methods-use-this
|
|
281
281
|
get eager() {
|
|
@@ -285,14 +285,14 @@ class U extends v {
|
|
|
285
285
|
this.boundFields.add(t);
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
class
|
|
288
|
+
class Et extends U {
|
|
289
289
|
constructor(i) {
|
|
290
290
|
super(i, (t, e) => {
|
|
291
|
-
t.visibility = e ?
|
|
291
|
+
t.visibility = e ? A.FULL : A.SUPPRESS;
|
|
292
292
|
});
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
-
class
|
|
295
|
+
class Vt extends U {
|
|
296
296
|
constructor(i) {
|
|
297
297
|
super(i, (t, e) => {
|
|
298
298
|
t.enabled = e;
|
|
@@ -346,71 +346,71 @@ var L = /* @__PURE__ */ ((n) => (n[n.NOT = 0] = "NOT", n[n.OR = 1] = "OR", n[n.A
|
|
|
346
346
|
n.isLogicOperator = s;
|
|
347
347
|
})(L || (L = {}));
|
|
348
348
|
Object.freeze(L);
|
|
349
|
-
const g = L,
|
|
350
|
-
class nt extends
|
|
349
|
+
const g = L, It = Symbol("EnabledChangingAction");
|
|
350
|
+
class nt extends b {
|
|
351
351
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
352
352
|
constructor(i) {
|
|
353
353
|
super(i);
|
|
354
354
|
}
|
|
355
355
|
// eslint-disable-next-line class-methods-use-this
|
|
356
356
|
static get classIdentifier() {
|
|
357
|
-
return
|
|
357
|
+
return It;
|
|
358
358
|
}
|
|
359
359
|
execute(i, t, e, s) {
|
|
360
360
|
return super.execute(i, t, e, s);
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
|
-
const
|
|
364
|
-
class st extends
|
|
363
|
+
const _t = Symbol("EnabledChangedAction");
|
|
364
|
+
class st extends b {
|
|
365
365
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
366
366
|
constructor(i) {
|
|
367
367
|
super(i);
|
|
368
368
|
}
|
|
369
369
|
// eslint-disable-next-line class-methods-use-this
|
|
370
370
|
static get classIdentifier() {
|
|
371
|
-
return
|
|
371
|
+
return _t;
|
|
372
372
|
}
|
|
373
373
|
execute(i, t, e, s) {
|
|
374
374
|
return super.execute(i, t, e, s);
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
-
const
|
|
378
|
-
class rt extends
|
|
377
|
+
const Ct = Symbol("ValidChangedAction");
|
|
378
|
+
class rt extends b {
|
|
379
379
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
380
380
|
constructor(i) {
|
|
381
381
|
super(i);
|
|
382
382
|
}
|
|
383
383
|
// eslint-disable-next-line class-methods-use-this
|
|
384
384
|
static get classIdentifier() {
|
|
385
|
-
return
|
|
385
|
+
return Ct;
|
|
386
386
|
}
|
|
387
387
|
execute(i, t, e, s) {
|
|
388
388
|
return super.execute(i, t, e, s);
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
const
|
|
392
|
-
class at extends
|
|
391
|
+
const St = Symbol("VisibilityChangingAction");
|
|
392
|
+
class at extends b {
|
|
393
393
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
394
394
|
constructor(i) {
|
|
395
395
|
super(i);
|
|
396
396
|
}
|
|
397
397
|
// eslint-disable-next-line class-methods-use-this
|
|
398
398
|
static get classIdentifier() {
|
|
399
|
-
return
|
|
399
|
+
return St;
|
|
400
400
|
}
|
|
401
401
|
execute(i, t, e, s) {
|
|
402
402
|
return super.execute(i, t, e, s);
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
const
|
|
406
|
-
class lt extends
|
|
405
|
+
const Ft = Symbol("VisibilityChangedAction");
|
|
406
|
+
class lt extends b {
|
|
407
407
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
408
408
|
constructor(i) {
|
|
409
409
|
super(i);
|
|
410
410
|
}
|
|
411
411
|
// eslint-disable-next-line class-methods-use-this
|
|
412
412
|
static get classIdentifier() {
|
|
413
|
-
return
|
|
413
|
+
return Ft;
|
|
414
414
|
}
|
|
415
415
|
execute(i, t, e, s) {
|
|
416
416
|
return super.execute(i, t, e, s);
|
|
@@ -418,7 +418,7 @@ class lt extends p {
|
|
|
418
418
|
}
|
|
419
419
|
class y {
|
|
420
420
|
constructor() {
|
|
421
|
-
o(this, "reactiveValue",
|
|
421
|
+
o(this, "reactiveValue", z(() => this.value));
|
|
422
422
|
// contains original field value as was provided at creation
|
|
423
423
|
o(this, "validatingCount", 0);
|
|
424
424
|
o(this, "validating", !1);
|
|
@@ -428,7 +428,7 @@ class y {
|
|
|
428
428
|
// when member of a Group, fieldName specifies the name of this field
|
|
429
429
|
o(this, "actions", new N());
|
|
430
430
|
// default property handlers
|
|
431
|
-
o(this, "_visibility",
|
|
431
|
+
o(this, "_visibility", A.FULL);
|
|
432
432
|
o(this, "_enabled", !0);
|
|
433
433
|
}
|
|
434
434
|
get visibility() {
|
|
@@ -436,8 +436,8 @@ class y {
|
|
|
436
436
|
}
|
|
437
437
|
set visibility(i) {
|
|
438
438
|
const t = this._visibility, e = this.actions.trigger(at, this, i, t);
|
|
439
|
-
if (!
|
|
440
|
-
this._visibility =
|
|
439
|
+
if (!A.isDefined(e != null ? e : i)) throw new Error("visibility must be a DisplayMode constant");
|
|
440
|
+
this._visibility = A.fromAny(e != null ? e : i), this.actions.trigger(lt, this, this._visibility, t);
|
|
441
441
|
}
|
|
442
442
|
get enabled() {
|
|
443
443
|
return this._enabled;
|
|
@@ -471,10 +471,10 @@ class y {
|
|
|
471
471
|
this.actions = this.actions.cloneWithoutValidators(), this.errors = [], this._valid = !0;
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
|
-
function
|
|
474
|
+
function Nt(n, i) {
|
|
475
475
|
return n ? !i : i;
|
|
476
476
|
}
|
|
477
|
-
class
|
|
477
|
+
class C {
|
|
478
478
|
constructor(i, t, e) {
|
|
479
479
|
o(this, "operand1");
|
|
480
480
|
o(this, "operator");
|
|
@@ -482,10 +482,10 @@ class _ {
|
|
|
482
482
|
this.operand1 = i, this.operator = t, this.operand2 = e;
|
|
483
483
|
}
|
|
484
484
|
get operand1Value() {
|
|
485
|
-
return this.operand1 instanceof
|
|
485
|
+
return this.operand1 instanceof C ? this.operand1.evaluate() : this.operand1 instanceof y ? d(this.operand1.value) : this.operand1;
|
|
486
486
|
}
|
|
487
487
|
get operand2Value() {
|
|
488
|
-
return this.operand2 instanceof
|
|
488
|
+
return this.operand2 instanceof C ? this.operand2.evaluate() : this.operand2 instanceof y ? d(this.operand2.value) : this.operand2;
|
|
489
489
|
}
|
|
490
490
|
evaluate() {
|
|
491
491
|
var e, s, r, a;
|
|
@@ -500,7 +500,7 @@ class _ {
|
|
|
500
500
|
case g.NOR:
|
|
501
501
|
return !(i || t);
|
|
502
502
|
case g.XOR:
|
|
503
|
-
return
|
|
503
|
+
return Nt(i, t);
|
|
504
504
|
case g.NOT:
|
|
505
505
|
return !i;
|
|
506
506
|
case g.EQUALS:
|
|
@@ -520,9 +520,9 @@ class _ {
|
|
|
520
520
|
case g.NOT_IN:
|
|
521
521
|
return !((a = (r = t == null ? void 0 : t.includes) == null ? void 0 : r.call(t, i)) == null || a);
|
|
522
522
|
case g.INCLUDES:
|
|
523
|
-
return
|
|
523
|
+
return V(i) && V(t) && i.indexOf(t) >= 0;
|
|
524
524
|
case g.NOT_INCLUDES:
|
|
525
|
-
return !(
|
|
525
|
+
return !(V(i) && V(t) && i.indexOf(t) >= 0);
|
|
526
526
|
default:
|
|
527
527
|
throw new Error(`Operator not implemented ${this.operator}`);
|
|
528
528
|
}
|
|
@@ -534,66 +534,66 @@ class _ {
|
|
|
534
534
|
collectFields() {
|
|
535
535
|
const i = /* @__PURE__ */ new Set();
|
|
536
536
|
function t(e) {
|
|
537
|
-
e instanceof y ? i.add(e) : e instanceof
|
|
537
|
+
e instanceof y ? i.add(e) : e instanceof C && e.collectFields().forEach((r) => i.add(r));
|
|
538
538
|
}
|
|
539
539
|
return t(this.operand1), t(this.operand2), i;
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
|
-
const
|
|
543
|
-
class ot extends
|
|
542
|
+
const Lt = Symbol("ExecuteAction");
|
|
543
|
+
class ot extends b {
|
|
544
544
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
545
545
|
constructor(i) {
|
|
546
546
|
super(i);
|
|
547
547
|
}
|
|
548
548
|
// eslint-disable-next-line class-methods-use-this
|
|
549
549
|
static get classIdentifier() {
|
|
550
|
-
return
|
|
550
|
+
return Lt;
|
|
551
551
|
}
|
|
552
552
|
execute(i, t, e) {
|
|
553
553
|
return super.execute(i, t, e);
|
|
554
554
|
}
|
|
555
555
|
}
|
|
556
|
-
const
|
|
557
|
-
class Q extends
|
|
556
|
+
const Tt = Symbol("ListItemAddedAction");
|
|
557
|
+
class Q extends b {
|
|
558
558
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
559
559
|
constructor(i) {
|
|
560
560
|
super(i);
|
|
561
561
|
}
|
|
562
562
|
// eslint-disable-next-line class-methods-use-this
|
|
563
563
|
static get classIdentifier() {
|
|
564
|
-
return
|
|
564
|
+
return Tt;
|
|
565
565
|
}
|
|
566
566
|
execute(i, t, e, s) {
|
|
567
567
|
return super.execute(i, t, e, s);
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
|
-
const
|
|
571
|
-
class ct extends
|
|
570
|
+
const jt = Symbol("ListItemRemovedAction");
|
|
571
|
+
class ct extends b {
|
|
572
572
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
573
573
|
constructor(i) {
|
|
574
574
|
super(i);
|
|
575
575
|
}
|
|
576
576
|
// eslint-disable-next-line class-methods-use-this
|
|
577
577
|
static get classIdentifier() {
|
|
578
|
-
return
|
|
578
|
+
return jt;
|
|
579
579
|
}
|
|
580
580
|
execute(i, t, e, s) {
|
|
581
581
|
return super.execute(i, t, e, s);
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
|
-
const
|
|
584
|
+
const Z = Symbol("FieldConstructorGuard");
|
|
585
585
|
class D extends y {
|
|
586
586
|
constructor(t) {
|
|
587
587
|
super();
|
|
588
588
|
o(this, "_value");
|
|
589
|
-
if (t !==
|
|
589
|
+
if (t !== Z) {
|
|
590
590
|
const e = this.constructor.name;
|
|
591
591
|
throw new TypeError(`Don't use constructor to instantiate ${e}. Use ${e}.create<T>`);
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
594
|
init(t) {
|
|
595
595
|
if (t) {
|
|
596
|
-
const e = t, { value: s, validators: r, actions: a } = e, l =
|
|
596
|
+
const e = t, { value: s, validators: r, actions: a } = e, l = _(e, ["value", "validators", "actions"]);
|
|
597
597
|
[...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);
|
|
598
598
|
}
|
|
599
599
|
this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
@@ -604,7 +604,7 @@ class D extends y {
|
|
|
604
604
|
* @returns Reactive Field instance
|
|
605
605
|
*/
|
|
606
606
|
static create(t) {
|
|
607
|
-
const e = bt(new this(
|
|
607
|
+
const e = bt(new this(Z));
|
|
608
608
|
return e.init(t), e;
|
|
609
609
|
}
|
|
610
610
|
get value() {
|
|
@@ -625,7 +625,7 @@ class D extends y {
|
|
|
625
625
|
return e.actions = this.actions.clone(), e.actions.triggerEager(e, e.value, e.originalValue), e;
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
|
-
const
|
|
628
|
+
const wt = D.create({ value: "EmptyField" }).registerAction(new v(
|
|
629
629
|
() => {
|
|
630
630
|
console.warn("Working with EmptyField! This should not happen");
|
|
631
631
|
}
|
|
@@ -633,13 +633,13 @@ const jt = D.create({ value: "EmptyField" }).registerAction(new v(
|
|
|
633
633
|
function k(n, i) {
|
|
634
634
|
return (n == null ? void 0 : n.label) == null && (n == null ? void 0 : n.icon) == null ? i : n;
|
|
635
635
|
}
|
|
636
|
-
class
|
|
636
|
+
class Pt extends D {
|
|
637
637
|
constructor(i) {
|
|
638
638
|
super(i), this._value = { label: void 0, icon: void 0 };
|
|
639
639
|
}
|
|
640
640
|
init(i) {
|
|
641
641
|
if (i) {
|
|
642
|
-
const t = i, { value: e, originalValue: s, validators: r, actions: a } = t, l =
|
|
642
|
+
const t = i, { value: e, originalValue: s, validators: r, actions: a } = t, l = _(t, ["value", "originalValue", "validators", "actions"]);
|
|
643
643
|
[...r || [], ...a || []].forEach((h) => this.registerAction(h)), Object.assign(this, l);
|
|
644
644
|
const c = k(e, this._value), u = Object.freeze({ label: s == null ? void 0 : s.label, icon: s == null ? void 0 : s.icon });
|
|
645
645
|
this._value = k(c, u), this.originalValue = k(u, c);
|
|
@@ -670,10 +670,11 @@ class E extends y {
|
|
|
670
670
|
super();
|
|
671
671
|
o(this, "_fields");
|
|
672
672
|
o(this, "_value", null);
|
|
673
|
+
o(this, "reactiveValue", z(() => this.value));
|
|
673
674
|
o(this, "suppressNotifyValueChanged", !1);
|
|
674
675
|
if (!E.isValidFields(t)) throw new Error("Invalid fields object provided");
|
|
675
676
|
if (this._fields = {}, Object.entries(t).forEach(([r, a]) => this.addField(r, a)), e) {
|
|
676
|
-
const s = e, { value: r, validators: a, actions: l } = s, c =
|
|
677
|
+
const s = e, { value: r, validators: a, actions: l } = s, c = _(s, ["value", "validators", "actions"]);
|
|
677
678
|
[...a || [], ...l || []].forEach((u) => this.registerAction(u)), Object.assign(this, c), this.value = r != null ? r : this.originalValue;
|
|
678
679
|
}
|
|
679
680
|
this.originalValue === void 0 && (this.originalValue = this.value), this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
@@ -761,14 +762,14 @@ class E extends y {
|
|
|
761
762
|
return s.actions = this.actions.clone(), s.actions.triggerEager(s, s.value, s.originalValue), s;
|
|
762
763
|
}
|
|
763
764
|
}
|
|
764
|
-
class
|
|
765
|
+
class X extends y {
|
|
765
766
|
constructor(t, e) {
|
|
766
767
|
super();
|
|
767
768
|
o(this, "_value", null);
|
|
768
769
|
o(this, "_itemTemplate");
|
|
769
770
|
o(this, "_previousValue");
|
|
770
771
|
if (this._itemTemplate = t, e) {
|
|
771
|
-
const s = e, { value: r, validators: a, actions: l } = s, c =
|
|
772
|
+
const s = e, { value: r, validators: a, actions: l } = s, c = _(s, ["value", "validators", "actions"]);
|
|
772
773
|
[...a || [], ...l || []].forEach((u) => this.registerAction(u)), Object.assign(this, c), r && this.setValueInternal(r);
|
|
773
774
|
}
|
|
774
775
|
this.originalValue === void 0 && (this.originalValue = this.value), this._previousValue = this.value, this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
@@ -791,7 +792,7 @@ class H extends y {
|
|
|
791
792
|
}
|
|
792
793
|
clone(t) {
|
|
793
794
|
var s, r, a, l;
|
|
794
|
-
const e = new
|
|
795
|
+
const e = new X((s = this._itemTemplate) == null ? void 0 : s.clone(), O(P({
|
|
795
796
|
value: [...(r = t == null ? void 0 : t.value) != null ? r : this.value]
|
|
796
797
|
}, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
|
|
797
798
|
enabled: (a = t == null ? void 0 : t.enabled) != null ? a : this.enabled,
|
|
@@ -840,29 +841,29 @@ class H extends y {
|
|
|
840
841
|
}
|
|
841
842
|
}
|
|
842
843
|
const ut = { useMarkdownInValidators: !0 };
|
|
843
|
-
function
|
|
844
|
+
function Ot() {
|
|
844
845
|
return ut;
|
|
845
846
|
}
|
|
846
|
-
function
|
|
847
|
+
function Rt(n) {
|
|
847
848
|
Object.assign(ut, n);
|
|
848
849
|
}
|
|
849
|
-
const
|
|
850
|
+
const Yt = {
|
|
850
851
|
install(n, i) {
|
|
851
|
-
i &&
|
|
852
|
+
i && Rt(i);
|
|
852
853
|
}
|
|
853
854
|
};
|
|
854
855
|
function m(n) {
|
|
855
|
-
return
|
|
856
|
+
return Ot().useMarkdownInValidators ? new F(n) : n.replace(/[*_~`]/g, "").replace(/!\[(.*?)\]\(.*?\)/g, "$1").replace(/\[(.*?)\]\((.*?)\)/g, "$1").replace(/#+\s?/g, "").replace(/>\s?/g, "").replace(/(\*|-|\d+\.)\s+/g, "").replace(/`{3}[\s\S]*?`{3}/g, "").replace(/`([^`]+)`/g, "$1").replace(/\n{2,}/g, `
|
|
856
857
|
`);
|
|
857
858
|
}
|
|
858
|
-
class
|
|
859
|
+
class Ut extends f {
|
|
859
860
|
constructor(t, e, s) {
|
|
860
861
|
let r = !1, a, l;
|
|
861
|
-
super((u, h,
|
|
862
|
-
T(x, j, $), this.unregistered || this.execute(
|
|
862
|
+
super((u, h, I) => (a = u, l = h, r || (r = !0, this.otherField.registerAction(new v((x, T, j, $) => {
|
|
863
|
+
T(x, j, $), this.unregistered || this.execute(I, () => null, a, l);
|
|
863
864
|
}))), this.isValidComparison(d(u), d(this.otherField.value)) ? null : [
|
|
864
|
-
new
|
|
865
|
-
this.replacePlaceholders(s, { newValue: u, oldValue: h, field:
|
|
865
|
+
new p(
|
|
866
|
+
this.replacePlaceholders(s, { newValue: u, oldValue: h, field: I, otherField: this.otherField })
|
|
866
867
|
)
|
|
867
868
|
]));
|
|
868
869
|
o(this, "unregistered", !1);
|
|
@@ -872,7 +873,7 @@ class Rt extends f {
|
|
|
872
873
|
this.unregistered = !0;
|
|
873
874
|
}
|
|
874
875
|
}
|
|
875
|
-
class
|
|
876
|
+
class Dt extends f {
|
|
876
877
|
constructor(i, t) {
|
|
877
878
|
const e = t || m("Must be one of [**{allowedAsText}**]");
|
|
878
879
|
let s = i.join(", ");
|
|
@@ -882,75 +883,75 @@ class Ut extends f {
|
|
|
882
883
|
omission: `... (${i.length} items total)`
|
|
883
884
|
}));
|
|
884
885
|
const r = (a, l, c) => i.includes(d(a)) ? null : [
|
|
885
|
-
new
|
|
886
|
+
new p(
|
|
886
887
|
this.replacePlaceholders(e, { newValue: a, oldValue: l, field: c, allowedValues: i, allowedAsText: s })
|
|
887
888
|
)
|
|
888
889
|
];
|
|
889
890
|
super(r);
|
|
890
891
|
}
|
|
891
892
|
}
|
|
892
|
-
function
|
|
893
|
-
return n == null ? 0 :
|
|
893
|
+
function $t(n) {
|
|
894
|
+
return n == null ? 0 : tt(n) || V(n) ? n.length : et(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
|
|
894
895
|
}
|
|
895
|
-
class
|
|
896
|
+
class Bt extends f {
|
|
896
897
|
constructor(i) {
|
|
897
|
-
const t = i || m("Please enter a value"), e = (s, r, a) =>
|
|
898
|
+
const t = i || m("Please enter a value"), e = (s, r, a) => $t(d(s)) === 0 ? [new p(
|
|
898
899
|
this.replacePlaceholders(t, { newValue: s, oldValue: r, field: a })
|
|
899
900
|
)] : null;
|
|
900
901
|
super(e);
|
|
901
902
|
}
|
|
902
903
|
}
|
|
903
|
-
class
|
|
904
|
+
class kt extends f {
|
|
904
905
|
constructor(i, t) {
|
|
905
906
|
const e = t || m("Value must be larger or equal to **{minValue}**"), s = (r, a, l) => r < i || r === void 0 ? [
|
|
906
|
-
new
|
|
907
|
+
new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, minValue: i }))
|
|
907
908
|
] : null;
|
|
908
909
|
super(s);
|
|
909
910
|
}
|
|
910
911
|
}
|
|
911
|
-
class
|
|
912
|
+
class qt extends f {
|
|
912
913
|
constructor(i, t) {
|
|
913
914
|
const e = t || m("Value must be less than or equal to **{maxValue}**"), s = (r, a, l) => r > i || r === void 0 ? [
|
|
914
|
-
new
|
|
915
|
+
new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, maxValue: i }))
|
|
915
916
|
] : null;
|
|
916
917
|
super(s);
|
|
917
918
|
}
|
|
918
919
|
}
|
|
919
|
-
class
|
|
920
|
+
class Mt extends f {
|
|
920
921
|
constructor(i, t, e) {
|
|
921
922
|
const s = e || m("Value must be between **{minValue}** and **{maxValue}**"), r = (a, l, c) => a < i || a > t || a === void 0 ? [
|
|
922
|
-
new
|
|
923
|
+
new p(
|
|
923
924
|
this.replacePlaceholders(s, { newValue: a, oldValue: l, field: c, minValue: i, maxValue: t })
|
|
924
925
|
)
|
|
925
926
|
] : null;
|
|
926
927
|
super(r);
|
|
927
928
|
}
|
|
928
929
|
}
|
|
929
|
-
function
|
|
930
|
-
return n == null ? 0 :
|
|
930
|
+
function W(n) {
|
|
931
|
+
return n == null ? 0 : tt(n) || V(n) ? n.length : et(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
|
|
931
932
|
}
|
|
932
|
-
class
|
|
933
|
+
class Qt extends f {
|
|
933
934
|
constructor(i, t) {
|
|
934
|
-
const e = t || m("Length must be larger or equal to **{minLength}**"), s = (r, a, l) =>
|
|
935
|
-
new
|
|
935
|
+
const e = t || m("Length must be larger or equal to **{minLength}**"), s = (r, a, l) => W(r) < i ? [
|
|
936
|
+
new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, minLength: i }))
|
|
936
937
|
] : null;
|
|
937
938
|
super(s);
|
|
938
939
|
}
|
|
939
940
|
}
|
|
940
|
-
class
|
|
941
|
+
class zt extends f {
|
|
941
942
|
constructor(i, t) {
|
|
942
|
-
const e = t || m("Length must be less than or equal to **{maxLength}**"), s = (r, a, l) =>
|
|
943
|
-
new
|
|
943
|
+
const e = t || m("Length must be less than or equal to **{maxLength}**"), s = (r, a, l) => W(r) > i ? [
|
|
944
|
+
new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, maxLength: i }))
|
|
944
945
|
] : null;
|
|
945
946
|
super(s);
|
|
946
947
|
}
|
|
947
948
|
}
|
|
948
|
-
class
|
|
949
|
+
class Gt extends f {
|
|
949
950
|
constructor(i, t, e) {
|
|
950
951
|
const s = e || m("Length must be between **{minLength}** and **{maxLength}**"), r = (a, l, c) => {
|
|
951
|
-
const u =
|
|
952
|
+
const u = W(a);
|
|
952
953
|
return u < i || u > t ? [
|
|
953
|
-
new
|
|
954
|
+
new p(
|
|
954
955
|
this.replacePlaceholders(s, { newValue: a, oldValue: l, field: c, minLength: i, maxLength: t })
|
|
955
956
|
)
|
|
956
957
|
] : null;
|
|
@@ -958,98 +959,100 @@ class zt extends f {
|
|
|
958
959
|
super(r);
|
|
959
960
|
}
|
|
960
961
|
}
|
|
961
|
-
class
|
|
962
|
+
class Ht extends f {
|
|
962
963
|
constructor(i, t) {
|
|
963
964
|
const e = t || m('Value must match pattern "**{pattern}**"'), s = (r, a, l) => i.test(String(d(r))) ? null : [
|
|
964
|
-
new
|
|
965
|
+
new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, pattern: i }))
|
|
965
966
|
];
|
|
966
967
|
super(s);
|
|
967
968
|
}
|
|
968
969
|
}
|
|
969
|
-
const
|
|
970
|
+
const Xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
970
971
|
__proto__: null,
|
|
971
|
-
CompareTo:
|
|
972
|
-
InAllowedValues:
|
|
973
|
-
LengthInRange:
|
|
974
|
-
MaxLength:
|
|
975
|
-
MaxValue:
|
|
976
|
-
MinLength:
|
|
977
|
-
MinValue:
|
|
978
|
-
Pattern:
|
|
979
|
-
Required:
|
|
972
|
+
CompareTo: Ut,
|
|
973
|
+
InAllowedValues: Dt,
|
|
974
|
+
LengthInRange: Gt,
|
|
975
|
+
MaxLength: zt,
|
|
976
|
+
MaxValue: qt,
|
|
977
|
+
MinLength: Qt,
|
|
978
|
+
MinValue: kt,
|
|
979
|
+
Pattern: Ht,
|
|
980
|
+
Required: Bt,
|
|
980
981
|
Validator: f,
|
|
981
|
-
ValueInRange:
|
|
982
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
982
|
+
ValueInRange: Mt
|
|
983
|
+
}, Symbol.toStringTag, { value: "Module" })), Zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
983
984
|
__proto__: null,
|
|
984
985
|
AbortEventHandlingException: M,
|
|
985
|
-
Action:
|
|
986
|
+
Action: Pt,
|
|
986
987
|
ActionsMap: N,
|
|
987
|
-
ConditionalEnabledAction:
|
|
988
|
+
ConditionalEnabledAction: Vt,
|
|
988
989
|
ConditionalStatementAction: U,
|
|
989
990
|
ConditionalValueAction: At,
|
|
990
|
-
ConditionalVisibilityAction:
|
|
991
|
-
DisplayMode:
|
|
992
|
-
EmptyField:
|
|
991
|
+
ConditionalVisibilityAction: Et,
|
|
992
|
+
DisplayMode: A,
|
|
993
|
+
EmptyField: wt,
|
|
993
994
|
EnabledChangedAction: st,
|
|
994
995
|
EnabledChangingAction: nt,
|
|
995
996
|
ExecuteAction: ot,
|
|
996
997
|
Field: D,
|
|
997
|
-
FieldActionBase:
|
|
998
|
+
FieldActionBase: b,
|
|
998
999
|
FieldBase: y,
|
|
999
1000
|
Group: E,
|
|
1000
|
-
List:
|
|
1001
|
+
List: X,
|
|
1001
1002
|
ListItemAddedAction: Q,
|
|
1002
1003
|
ListItemRemovedAction: ct,
|
|
1003
1004
|
MdString: F,
|
|
1004
1005
|
Operator: g,
|
|
1005
|
-
|
|
1006
|
+
RenderableValue: mt,
|
|
1007
|
+
Statement: C,
|
|
1006
1008
|
ValidChangedAction: rt,
|
|
1007
|
-
ValidationError:
|
|
1008
|
-
ValidationErrorRenderContent:
|
|
1009
|
+
ValidationError: H,
|
|
1010
|
+
ValidationErrorRenderContent: p,
|
|
1009
1011
|
ValidationErrorText: vt,
|
|
1010
1012
|
Validator: f,
|
|
1011
|
-
Validators:
|
|
1013
|
+
Validators: Xt,
|
|
1012
1014
|
ValueChangedAction: v,
|
|
1013
1015
|
VisibilityChangedAction: lt,
|
|
1014
1016
|
VisibilityChangingAction: at,
|
|
1015
1017
|
buildErrorMessage: m,
|
|
1016
|
-
|
|
1018
|
+
isSimpleComponentDef: G
|
|
1017
1019
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1018
1020
|
export {
|
|
1019
1021
|
M as AbortEventHandlingException,
|
|
1020
|
-
|
|
1022
|
+
Pt as Action,
|
|
1021
1023
|
N as ActionsMap,
|
|
1022
|
-
|
|
1024
|
+
Vt as ConditionalEnabledAction,
|
|
1023
1025
|
U as ConditionalStatementAction,
|
|
1024
1026
|
At as ConditionalValueAction,
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1027
|
+
Et as ConditionalVisibilityAction,
|
|
1028
|
+
A as DisplayMode,
|
|
1029
|
+
wt as EmptyField,
|
|
1028
1030
|
st as EnabledChangedAction,
|
|
1029
1031
|
nt as EnabledChangingAction,
|
|
1030
1032
|
ot as ExecuteAction,
|
|
1031
1033
|
D as Field,
|
|
1032
|
-
|
|
1034
|
+
b as FieldActionBase,
|
|
1033
1035
|
y as FieldBase,
|
|
1034
1036
|
E as Group,
|
|
1035
|
-
|
|
1037
|
+
X as List,
|
|
1036
1038
|
Q as ListItemAddedAction,
|
|
1037
1039
|
ct as ListItemRemovedAction,
|
|
1038
1040
|
F as MdString,
|
|
1039
1041
|
g as Operator,
|
|
1040
|
-
|
|
1042
|
+
mt as RenderableValue,
|
|
1043
|
+
C as Statement,
|
|
1041
1044
|
rt as ValidChangedAction,
|
|
1042
|
-
|
|
1043
|
-
|
|
1045
|
+
H as ValidationError,
|
|
1046
|
+
p as ValidationErrorRenderContent,
|
|
1044
1047
|
vt as ValidationErrorText,
|
|
1045
1048
|
f as Validator,
|
|
1046
|
-
|
|
1049
|
+
Xt as Validators,
|
|
1047
1050
|
v as ValueChangedAction,
|
|
1048
1051
|
lt as VisibilityChangedAction,
|
|
1049
1052
|
at as VisibilityChangingAction,
|
|
1050
1053
|
m as buildErrorMessage,
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
+
Zt as default,
|
|
1055
|
+
Yt as forms,
|
|
1056
|
+
G as isSimpleComponentDef
|
|
1054
1057
|
};
|
|
1055
1058
|
//# sourceMappingURL=dynamicforms-vue-forms.js.map
|