@dynamicforms/vue-forms 0.4.3 → 0.4.4
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.
|
@@ -41,7 +41,7 @@ const tt = 10;
|
|
|
41
41
|
n.isDefined = e;
|
|
42
42
|
})(N || (N = {}));
|
|
43
43
|
Object.freeze(N);
|
|
44
|
-
const
|
|
44
|
+
const _ = N;
|
|
45
45
|
class b {
|
|
46
46
|
constructor(s) {
|
|
47
47
|
o(this, "executorFn");
|
|
@@ -166,9 +166,9 @@ class p extends W {
|
|
|
166
166
|
return this.classes;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
class
|
|
169
|
+
class _t extends p {
|
|
170
170
|
}
|
|
171
|
-
const
|
|
171
|
+
const Vt = Symbol("Validator");
|
|
172
172
|
class f extends m {
|
|
173
173
|
/**
|
|
174
174
|
* Creates a new validator
|
|
@@ -177,14 +177,14 @@ class f extends m {
|
|
|
177
177
|
constructor(t) {
|
|
178
178
|
super((i, r, a, l) => {
|
|
179
179
|
const c = t(a, l, i) || [], u = (h) => {
|
|
180
|
-
var
|
|
180
|
+
var V;
|
|
181
181
|
h == null || h.forEach(
|
|
182
182
|
(x) => Object.defineProperty(x, "source", { value: this.source, enumerable: !1, configurable: !1 })
|
|
183
183
|
);
|
|
184
184
|
for (let x = i.errors.length - 1; x >= 0; x--) {
|
|
185
185
|
const P = i.errors[x];
|
|
186
186
|
if (P.source === this.source) {
|
|
187
|
-
const O = (
|
|
187
|
+
const O = (V = h == null ? void 0 : h.findIndex((B) => U(B, P))) != null ? V : -1;
|
|
188
188
|
O >= 0 ? h == null || h.splice(O, 1) : i.errors.splice(x, 1);
|
|
189
189
|
}
|
|
190
190
|
}
|
|
@@ -199,7 +199,7 @@ class f extends m {
|
|
|
199
199
|
}
|
|
200
200
|
// eslint-disable-next-line class-methods-use-this
|
|
201
201
|
static get classIdentifier() {
|
|
202
|
-
return
|
|
202
|
+
return Vt;
|
|
203
203
|
}
|
|
204
204
|
// eslint-disable-next-line class-methods-use-this
|
|
205
205
|
get eager() {
|
|
@@ -295,7 +295,7 @@ class k extends m {
|
|
|
295
295
|
class It extends k {
|
|
296
296
|
constructor(s) {
|
|
297
297
|
super(s, (t, e) => {
|
|
298
|
-
t.visibility = e ?
|
|
298
|
+
t.visibility = e ? _.FULL : _.SUPPRESS;
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
301
|
}
|
|
@@ -435,7 +435,7 @@ class y {
|
|
|
435
435
|
// when member of a Group, fieldName specifies the name of this field
|
|
436
436
|
o(this, "actions", new T());
|
|
437
437
|
// default property handlers
|
|
438
|
-
o(this, "_visibility",
|
|
438
|
+
o(this, "_visibility", _.FULL);
|
|
439
439
|
o(this, "_enabled", !0);
|
|
440
440
|
}
|
|
441
441
|
get visibility() {
|
|
@@ -443,8 +443,8 @@ class y {
|
|
|
443
443
|
}
|
|
444
444
|
set visibility(s) {
|
|
445
445
|
const t = this._visibility, e = this.actions.trigger(ot, this, s, t);
|
|
446
|
-
if (!
|
|
447
|
-
this._visibility =
|
|
446
|
+
if (!_.isDefined(e != null ? e : s)) throw new Error("visibility must be a DisplayMode constant");
|
|
447
|
+
this._visibility = _.fromAny(e != null ? e : s), this.actions.trigger(ct, this, this._visibility, t);
|
|
448
448
|
}
|
|
449
449
|
get enabled() {
|
|
450
450
|
return this._enabled;
|
|
@@ -454,9 +454,10 @@ class y {
|
|
|
454
454
|
if (!bt(e != null ? e : s)) throw new Error("Enabled value must be boolean");
|
|
455
455
|
this._enabled = e != null ? e : s, this.actions.trigger(at, this, this._enabled, t);
|
|
456
456
|
}
|
|
457
|
-
validate() {
|
|
458
|
-
|
|
459
|
-
|
|
457
|
+
validate(s = !1) {
|
|
458
|
+
s && this.actions.triggerEager(this, this.value, this.value);
|
|
459
|
+
const t = this._valid;
|
|
460
|
+
this._valid = this.valid, this._valid !== t && this.actions.trigger(lt, this, this.valid, t);
|
|
460
461
|
}
|
|
461
462
|
get valid() {
|
|
462
463
|
return this.errors.length === 0;
|
|
@@ -853,6 +854,9 @@ class E extends y {
|
|
|
853
854
|
get valid() {
|
|
854
855
|
return super.valid && Object.values(this._fields).every((t) => t.valid);
|
|
855
856
|
}
|
|
857
|
+
validate(t = !1) {
|
|
858
|
+
t && Object.values(this._fields).forEach((e) => e.validate(!0)), super.validate(t);
|
|
859
|
+
}
|
|
856
860
|
clone(t) {
|
|
857
861
|
var r, a, l;
|
|
858
862
|
const e = {};
|
|
@@ -917,6 +921,10 @@ class X extends y {
|
|
|
917
921
|
var t, e;
|
|
918
922
|
return super.valid && ((e = (t = this._value) == null ? void 0 : t.every((i) => i.valid)) != null ? e : !0);
|
|
919
923
|
}
|
|
924
|
+
validate(t = !1) {
|
|
925
|
+
var e;
|
|
926
|
+
t && ((e = this._value) == null || e.forEach((i) => i.validate(!0))), super.validate(t);
|
|
927
|
+
}
|
|
920
928
|
get(t) {
|
|
921
929
|
return this._value != null ? this._value[t] : void 0;
|
|
922
930
|
}
|
|
@@ -965,11 +973,11 @@ function v(n) {
|
|
|
965
973
|
class Mt extends f {
|
|
966
974
|
constructor(t, e, i) {
|
|
967
975
|
let r = !1, a, l;
|
|
968
|
-
super((u, h,
|
|
969
|
-
P(x, O, B), this.unregistered || this.execute(
|
|
976
|
+
super((u, h, V) => (a = u, l = h, r || (r = !0, this.otherField.registerAction(new m((x, P, O, B) => {
|
|
977
|
+
P(x, O, B), this.unregistered || this.execute(V, () => null, a, l);
|
|
970
978
|
}))), this.isValidComparison(g(u), g(this.otherField.value)) ? null : [
|
|
971
979
|
new p(
|
|
972
|
-
this.replacePlaceholders(i, { newValue: u, oldValue: h, field:
|
|
980
|
+
this.replacePlaceholders(i, { newValue: u, oldValue: h, field: V, otherField: this.otherField })
|
|
973
981
|
)
|
|
974
982
|
]));
|
|
975
983
|
o(this, "unregistered", !1);
|
|
@@ -1095,7 +1103,7 @@ const te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1095
1103
|
ConditionalStatementAction: k,
|
|
1096
1104
|
ConditionalValueAction: wt,
|
|
1097
1105
|
ConditionalVisibilityAction: It,
|
|
1098
|
-
DisplayMode:
|
|
1106
|
+
DisplayMode: _,
|
|
1099
1107
|
EmptyField: kt,
|
|
1100
1108
|
EnabledChangedAction: at,
|
|
1101
1109
|
EnabledChangingAction: rt,
|
|
@@ -1110,7 +1118,7 @@ const te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1110
1118
|
MdString: L,
|
|
1111
1119
|
MessagesWidget: Bt,
|
|
1112
1120
|
Operator: d,
|
|
1113
|
-
RenderableValue:
|
|
1121
|
+
RenderableValue: _t,
|
|
1114
1122
|
Statement: F,
|
|
1115
1123
|
ValidChangedAction: lt,
|
|
1116
1124
|
ValidationError: W,
|
|
@@ -1132,7 +1140,7 @@ export {
|
|
|
1132
1140
|
k as ConditionalStatementAction,
|
|
1133
1141
|
wt as ConditionalValueAction,
|
|
1134
1142
|
It as ConditionalVisibilityAction,
|
|
1135
|
-
|
|
1143
|
+
_ as DisplayMode,
|
|
1136
1144
|
kt as EmptyField,
|
|
1137
1145
|
at as EnabledChangedAction,
|
|
1138
1146
|
rt as EnabledChangingAction,
|
|
@@ -1147,7 +1155,7 @@ export {
|
|
|
1147
1155
|
L as MdString,
|
|
1148
1156
|
Bt as MessagesWidget,
|
|
1149
1157
|
d as Operator,
|
|
1150
|
-
|
|
1158
|
+
_t as RenderableValue,
|
|
1151
1159
|
F as Statement,
|
|
1152
1160
|
lt as ValidChangedAction,
|
|
1153
1161
|
W as ValidationError,
|