@dynamicforms/vue-forms 0.4.0 → 0.4.1
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.
|
@@ -10,7 +10,7 @@ var B = (n, i, t) => i in n ? ht(n, i, { enumerable: !0, configurable: !0, writa
|
|
|
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 I = (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]);
|
|
@@ -99,12 +99,13 @@ class H {
|
|
|
99
99
|
get componentBody() {
|
|
100
100
|
return "";
|
|
101
101
|
}
|
|
102
|
+
get extraClasses() {
|
|
103
|
+
return "";
|
|
104
|
+
}
|
|
102
105
|
}
|
|
103
106
|
class vt extends H {
|
|
104
|
-
constructor(t) {
|
|
105
|
-
super();
|
|
106
|
-
o(this, "text");
|
|
107
|
-
this.text = t;
|
|
107
|
+
constructor(i, t = "") {
|
|
108
|
+
super(), this.text = i, this.classes = t;
|
|
108
109
|
}
|
|
109
110
|
get componentName() {
|
|
110
111
|
return "template";
|
|
@@ -112,13 +113,16 @@ class vt extends H {
|
|
|
112
113
|
get componentBody() {
|
|
113
114
|
return this.text;
|
|
114
115
|
}
|
|
116
|
+
get extraClasses() {
|
|
117
|
+
return this.classes;
|
|
118
|
+
}
|
|
115
119
|
}
|
|
116
120
|
class p extends H {
|
|
117
|
-
constructor(t) {
|
|
121
|
+
constructor(t, e = "") {
|
|
118
122
|
super();
|
|
119
123
|
o(this, "text");
|
|
120
124
|
o(this, "textType");
|
|
121
|
-
this.text = t, this.textType = z(() => this.getTextType);
|
|
125
|
+
this.classes = e, this.text = t, this.textType = z(() => this.getTextType);
|
|
122
126
|
}
|
|
123
127
|
get getTextType() {
|
|
124
128
|
const t = d(this.text);
|
|
@@ -158,6 +162,9 @@ class p extends H {
|
|
|
158
162
|
return "";
|
|
159
163
|
}
|
|
160
164
|
}
|
|
165
|
+
get extraClasses() {
|
|
166
|
+
return this.classes;
|
|
167
|
+
}
|
|
161
168
|
}
|
|
162
169
|
class mt extends p {
|
|
163
170
|
}
|
|
@@ -170,14 +177,14 @@ class f extends v {
|
|
|
170
177
|
constructor(t) {
|
|
171
178
|
super((s, r, a, l) => {
|
|
172
179
|
const c = t(a, l, s) || [], u = (h) => {
|
|
173
|
-
var
|
|
180
|
+
var C;
|
|
174
181
|
h == null || h.forEach(
|
|
175
182
|
(x) => Object.defineProperty(x, "source", { value: this.source, enumerable: !1, configurable: !1 })
|
|
176
183
|
);
|
|
177
184
|
for (let x = s.errors.length - 1; x >= 0; x--) {
|
|
178
185
|
const T = s.errors[x];
|
|
179
186
|
if (T.source === this.source) {
|
|
180
|
-
const j = (
|
|
187
|
+
const j = (C = h == null ? void 0 : h.findIndex(($) => R($, T))) != null ? C : -1;
|
|
181
188
|
j >= 0 ? h == null || h.splice(j, 1) : s.errors.splice(x, 1);
|
|
182
189
|
}
|
|
183
190
|
}
|
|
@@ -346,7 +353,7 @@ var L = /* @__PURE__ */ ((n) => (n[n.NOT = 0] = "NOT", n[n.OR = 1] = "OR", n[n.A
|
|
|
346
353
|
n.isLogicOperator = s;
|
|
347
354
|
})(L || (L = {}));
|
|
348
355
|
Object.freeze(L);
|
|
349
|
-
const g = L,
|
|
356
|
+
const g = L, Ct = Symbol("EnabledChangingAction");
|
|
350
357
|
class nt extends b {
|
|
351
358
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
352
359
|
constructor(i) {
|
|
@@ -354,13 +361,13 @@ class nt extends b {
|
|
|
354
361
|
}
|
|
355
362
|
// eslint-disable-next-line class-methods-use-this
|
|
356
363
|
static get classIdentifier() {
|
|
357
|
-
return
|
|
364
|
+
return Ct;
|
|
358
365
|
}
|
|
359
366
|
execute(i, t, e, s) {
|
|
360
367
|
return super.execute(i, t, e, s);
|
|
361
368
|
}
|
|
362
369
|
}
|
|
363
|
-
const
|
|
370
|
+
const It = Symbol("EnabledChangedAction");
|
|
364
371
|
class st extends b {
|
|
365
372
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
366
373
|
constructor(i) {
|
|
@@ -368,13 +375,13 @@ class st extends b {
|
|
|
368
375
|
}
|
|
369
376
|
// eslint-disable-next-line class-methods-use-this
|
|
370
377
|
static get classIdentifier() {
|
|
371
|
-
return
|
|
378
|
+
return It;
|
|
372
379
|
}
|
|
373
380
|
execute(i, t, e, s) {
|
|
374
381
|
return super.execute(i, t, e, s);
|
|
375
382
|
}
|
|
376
383
|
}
|
|
377
|
-
const
|
|
384
|
+
const _t = Symbol("ValidChangedAction");
|
|
378
385
|
class rt extends b {
|
|
379
386
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
380
387
|
constructor(i) {
|
|
@@ -382,7 +389,7 @@ class rt extends b {
|
|
|
382
389
|
}
|
|
383
390
|
// eslint-disable-next-line class-methods-use-this
|
|
384
391
|
static get classIdentifier() {
|
|
385
|
-
return
|
|
392
|
+
return _t;
|
|
386
393
|
}
|
|
387
394
|
execute(i, t, e, s) {
|
|
388
395
|
return super.execute(i, t, e, s);
|
|
@@ -474,7 +481,7 @@ class y {
|
|
|
474
481
|
function Nt(n, i) {
|
|
475
482
|
return n ? !i : i;
|
|
476
483
|
}
|
|
477
|
-
class
|
|
484
|
+
class _ {
|
|
478
485
|
constructor(i, t, e) {
|
|
479
486
|
o(this, "operand1");
|
|
480
487
|
o(this, "operator");
|
|
@@ -482,10 +489,10 @@ class C {
|
|
|
482
489
|
this.operand1 = i, this.operator = t, this.operand2 = e;
|
|
483
490
|
}
|
|
484
491
|
get operand1Value() {
|
|
485
|
-
return this.operand1 instanceof
|
|
492
|
+
return this.operand1 instanceof _ ? this.operand1.evaluate() : this.operand1 instanceof y ? d(this.operand1.value) : this.operand1;
|
|
486
493
|
}
|
|
487
494
|
get operand2Value() {
|
|
488
|
-
return this.operand2 instanceof
|
|
495
|
+
return this.operand2 instanceof _ ? this.operand2.evaluate() : this.operand2 instanceof y ? d(this.operand2.value) : this.operand2;
|
|
489
496
|
}
|
|
490
497
|
evaluate() {
|
|
491
498
|
var e, s, r, a;
|
|
@@ -534,7 +541,7 @@ class C {
|
|
|
534
541
|
collectFields() {
|
|
535
542
|
const i = /* @__PURE__ */ new Set();
|
|
536
543
|
function t(e) {
|
|
537
|
-
e instanceof y ? i.add(e) : e instanceof
|
|
544
|
+
e instanceof y ? i.add(e) : e instanceof _ && e.collectFields().forEach((r) => i.add(r));
|
|
538
545
|
}
|
|
539
546
|
return t(this.operand1), t(this.operand2), i;
|
|
540
547
|
}
|
|
@@ -593,7 +600,7 @@ class D extends y {
|
|
|
593
600
|
}
|
|
594
601
|
init(t) {
|
|
595
602
|
if (t) {
|
|
596
|
-
const e = t, { value: s, validators: r, actions: a } = e, l =
|
|
603
|
+
const e = t, { value: s, validators: r, actions: a } = e, l = I(e, ["value", "validators", "actions"]);
|
|
597
604
|
[...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
605
|
}
|
|
599
606
|
this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
@@ -639,7 +646,7 @@ class Pt extends D {
|
|
|
639
646
|
}
|
|
640
647
|
init(i) {
|
|
641
648
|
if (i) {
|
|
642
|
-
const t = i, { value: e, originalValue: s, validators: r, actions: a } = t, l =
|
|
649
|
+
const t = i, { value: e, originalValue: s, validators: r, actions: a } = t, l = I(t, ["value", "originalValue", "validators", "actions"]);
|
|
643
650
|
[...r || [], ...a || []].forEach((h) => this.registerAction(h)), Object.assign(this, l);
|
|
644
651
|
const c = k(e, this._value), u = Object.freeze({ label: s == null ? void 0 : s.label, icon: s == null ? void 0 : s.icon });
|
|
645
652
|
this._value = k(c, u), this.originalValue = k(u, c);
|
|
@@ -674,7 +681,7 @@ class E extends y {
|
|
|
674
681
|
o(this, "suppressNotifyValueChanged", !1);
|
|
675
682
|
if (!E.isValidFields(t)) throw new Error("Invalid fields object provided");
|
|
676
683
|
if (this._fields = {}, Object.entries(t).forEach(([r, a]) => this.addField(r, a)), e) {
|
|
677
|
-
const s = e, { value: r, validators: a, actions: l } = s, c =
|
|
684
|
+
const s = e, { value: r, validators: a, actions: l } = s, c = I(s, ["value", "validators", "actions"]);
|
|
678
685
|
[...a || [], ...l || []].forEach((u) => this.registerAction(u)), Object.assign(this, c), this.value = r != null ? r : this.originalValue;
|
|
679
686
|
}
|
|
680
687
|
this.originalValue === void 0 && (this.originalValue = this.value), this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
@@ -769,7 +776,7 @@ class X extends y {
|
|
|
769
776
|
o(this, "_itemTemplate");
|
|
770
777
|
o(this, "_previousValue");
|
|
771
778
|
if (this._itemTemplate = t, e) {
|
|
772
|
-
const s = e, { value: r, validators: a, actions: l } = s, c =
|
|
779
|
+
const s = e, { value: r, validators: a, actions: l } = s, c = I(s, ["value", "validators", "actions"]);
|
|
773
780
|
[...a || [], ...l || []].forEach((u) => this.registerAction(u)), Object.assign(this, c), r && this.setValueInternal(r);
|
|
774
781
|
}
|
|
775
782
|
this.originalValue === void 0 && (this.originalValue = this.value), this._previousValue = this.value, this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
@@ -859,11 +866,11 @@ function m(n) {
|
|
|
859
866
|
class Ut extends f {
|
|
860
867
|
constructor(t, e, s) {
|
|
861
868
|
let r = !1, a, l;
|
|
862
|
-
super((u, h,
|
|
863
|
-
T(x, j, $), this.unregistered || this.execute(
|
|
869
|
+
super((u, h, C) => (a = u, l = h, r || (r = !0, this.otherField.registerAction(new v((x, T, j, $) => {
|
|
870
|
+
T(x, j, $), this.unregistered || this.execute(C, () => null, a, l);
|
|
864
871
|
}))), this.isValidComparison(d(u), d(this.otherField.value)) ? null : [
|
|
865
872
|
new p(
|
|
866
|
-
this.replacePlaceholders(s, { newValue: u, oldValue: h, field:
|
|
873
|
+
this.replacePlaceholders(s, { newValue: u, oldValue: h, field: C, otherField: this.otherField })
|
|
867
874
|
)
|
|
868
875
|
]));
|
|
869
876
|
o(this, "unregistered", !1);
|
|
@@ -1004,7 +1011,7 @@ const Xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1004
1011
|
MdString: F,
|
|
1005
1012
|
Operator: g,
|
|
1006
1013
|
RenderableValue: mt,
|
|
1007
|
-
Statement:
|
|
1014
|
+
Statement: _,
|
|
1008
1015
|
ValidChangedAction: rt,
|
|
1009
1016
|
ValidationError: H,
|
|
1010
1017
|
ValidationErrorRenderContent: p,
|
|
@@ -1040,7 +1047,7 @@ export {
|
|
|
1040
1047
|
F as MdString,
|
|
1041
1048
|
g as Operator,
|
|
1042
1049
|
mt as RenderableValue,
|
|
1043
|
-
|
|
1050
|
+
_ as Statement,
|
|
1044
1051
|
rt as ValidChangedAction,
|
|
1045
1052
|
H as ValidationError,
|
|
1046
1053
|
p as ValidationErrorRenderContent,
|