@dynamicforms/vue-forms 0.5.1 → 0.6.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.
- package/dist/dynamicforms-vue-forms.js +753 -606
- package/dist/dynamicforms-vue-forms.js.map +1 -1
- package/dist/dynamicforms-vue-forms.umd.cjs +2 -2
- package/dist/dynamicforms-vue-forms.umd.cjs.map +1 -1
- package/dist/index.d.cts +663 -0
- package/dist/index.d.ts +163 -93
- package/package.json +24 -8
- package/readme.md +145 -43
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var q = (
|
|
6
|
-
for (var t in
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
var
|
|
1
|
+
var bt = Object.defineProperty, vt = Object.defineProperties;
|
|
2
|
+
var yt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var U = Object.getOwnPropertySymbols;
|
|
4
|
+
var et = Object.prototype.hasOwnProperty, it = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var q = (n, i, t) => i in n ? bt(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t, v = (n, i) => {
|
|
6
|
+
for (var t in i || (i = {}))
|
|
7
|
+
et.call(i, t) && q(n, t, i[t]);
|
|
8
|
+
if (U)
|
|
9
|
+
for (var t of U(i))
|
|
10
|
+
it.call(i, t) && q(n, t, i[t]);
|
|
11
|
+
return n;
|
|
12
|
+
}, w = (n, i) => vt(n, yt(i));
|
|
13
|
+
var F = (n, i) => {
|
|
14
14
|
var t = {};
|
|
15
|
-
for (var e in
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
for (var e of
|
|
19
|
-
|
|
15
|
+
for (var e in n)
|
|
16
|
+
et.call(n, e) && i.indexOf(e) < 0 && (t[e] = n[e]);
|
|
17
|
+
if (n != null && U)
|
|
18
|
+
for (var e of U(n))
|
|
19
|
+
i.indexOf(e) < 0 && it.call(n, e) && (t[e] = n[e]);
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
|
-
var
|
|
23
|
-
import { isEqual as
|
|
24
|
-
import { unref as
|
|
25
|
-
var
|
|
26
|
-
const
|
|
27
|
-
((
|
|
28
|
-
function s
|
|
29
|
-
return
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function t(
|
|
33
|
-
const r = typeof
|
|
34
|
-
return Object.values(
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function e(
|
|
38
|
-
const r = typeof
|
|
39
|
-
return Object.values(
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
})(
|
|
43
|
-
Object.freeze(
|
|
44
|
-
const
|
|
45
|
-
class
|
|
46
|
-
constructor(
|
|
47
|
-
|
|
48
|
-
this.executorFn =
|
|
22
|
+
var o = (n, i, t) => q(n, typeof i != "symbol" ? i + "" : i, t);
|
|
23
|
+
import { isEqual as D, isBoolean as Vt, isString as A, isEmpty as Q, truncate as Ct, isArray as rt, isObject as at } from "lodash-es";
|
|
24
|
+
import { unref as h, computed as xt, isRef as _t, reactive as Et, defineComponent as It, resolveComponent as st, openBlock as At, createBlock as St, h as j } from "vue";
|
|
25
|
+
var T = /* @__PURE__ */ ((n) => (n[n.SUPPRESS = 1] = "SUPPRESS", n[n.HIDDEN = 5] = "HIDDEN", n[n.INVISIBLE = 8] = "INVISIBLE", n[n.FULL = 10] = "FULL", n))(T || {});
|
|
26
|
+
const nt = 10;
|
|
27
|
+
((n) => {
|
|
28
|
+
function i(s) {
|
|
29
|
+
return s.toUpperCase() === "SUPPRESS" ? 1 : s.toUpperCase() === "HIDDEN" ? 5 : s.toUpperCase() === "INVISIBLE" ? 8 : nt;
|
|
30
|
+
}
|
|
31
|
+
n.fromString = i;
|
|
32
|
+
function t(s) {
|
|
33
|
+
const r = typeof s == "number" ? s : n.fromString(s);
|
|
34
|
+
return Object.values(n).includes(r) ? r : nt;
|
|
35
|
+
}
|
|
36
|
+
n.fromAny = t;
|
|
37
|
+
function e(s) {
|
|
38
|
+
const r = typeof s == "number" ? s : n.fromString(s);
|
|
39
|
+
return Object.values(n).includes(r);
|
|
40
|
+
}
|
|
41
|
+
n.isDefined = e;
|
|
42
|
+
})(T || (T = {}));
|
|
43
|
+
Object.freeze(T);
|
|
44
|
+
const S = T;
|
|
45
|
+
class m {
|
|
46
|
+
constructor(i) {
|
|
47
|
+
o(this, "executorFn");
|
|
48
|
+
this.executorFn = i;
|
|
49
49
|
}
|
|
50
50
|
static get classIdentifier() {
|
|
51
51
|
throw new Error("classIdentifier must be declared");
|
|
@@ -53,48 +53,60 @@ class b {
|
|
|
53
53
|
get classIdentifier() {
|
|
54
54
|
return this.constructor.classIdentifier;
|
|
55
55
|
}
|
|
56
|
-
execute(
|
|
57
|
-
return this.executorFn(
|
|
56
|
+
execute(i, t, ...e) {
|
|
57
|
+
return this.executorFn(i, t, ...e);
|
|
58
58
|
}
|
|
59
59
|
get eager() {
|
|
60
60
|
return !1;
|
|
61
61
|
}
|
|
62
62
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
63
|
-
boundToField(
|
|
63
|
+
boundToField(i) {
|
|
64
64
|
}
|
|
65
65
|
unregister() {
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
class
|
|
68
|
+
class W extends Error {
|
|
69
69
|
}
|
|
70
|
-
const
|
|
71
|
-
class
|
|
72
|
-
constructor(
|
|
73
|
-
super(
|
|
70
|
+
const lt = /* @__PURE__ */ Symbol("ValueChangedAction");
|
|
71
|
+
class y extends m {
|
|
72
|
+
constructor(i) {
|
|
73
|
+
super(i);
|
|
74
74
|
}
|
|
75
75
|
static get classIdentifier() {
|
|
76
|
-
return
|
|
76
|
+
return lt;
|
|
77
77
|
}
|
|
78
|
-
execute(
|
|
79
|
-
return super.execute(
|
|
78
|
+
execute(i, t, e, s) {
|
|
79
|
+
return super.execute(i, t, e, s);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
const ot = { useMarkdownInValidators: !0 };
|
|
83
|
+
function Pt() {
|
|
84
|
+
return ot;
|
|
85
|
+
}
|
|
86
|
+
function wt(n) {
|
|
87
|
+
Object.assign(ot, n);
|
|
88
|
+
}
|
|
89
|
+
const he = {
|
|
90
|
+
install(n, i) {
|
|
91
|
+
i && wt(i);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
class O extends String {
|
|
95
|
+
constructor(t, e, s) {
|
|
84
96
|
super(t);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
this.plugins =
|
|
97
|
+
o(this, "plugins");
|
|
98
|
+
o(this, "options");
|
|
99
|
+
this.plugins = s, this.options = e;
|
|
88
100
|
}
|
|
89
101
|
}
|
|
90
|
-
function
|
|
91
|
-
const
|
|
92
|
-
return typeof
|
|
102
|
+
function X(n) {
|
|
103
|
+
const i = h(n);
|
|
104
|
+
return typeof i == "object" && "componentName" in i;
|
|
93
105
|
}
|
|
94
|
-
function
|
|
95
|
-
return typeof
|
|
106
|
+
function k(n) {
|
|
107
|
+
return typeof h(n) == "function";
|
|
96
108
|
}
|
|
97
|
-
class
|
|
109
|
+
class G {
|
|
98
110
|
get componentName() {
|
|
99
111
|
return "Comment";
|
|
100
112
|
}
|
|
@@ -108,11 +120,11 @@ class X {
|
|
|
108
120
|
return "";
|
|
109
121
|
}
|
|
110
122
|
}
|
|
111
|
-
class
|
|
123
|
+
class Ft extends G {
|
|
112
124
|
constructor(t, e = "") {
|
|
113
125
|
super();
|
|
114
|
-
|
|
115
|
-
|
|
126
|
+
o(this, "text");
|
|
127
|
+
o(this, "classes");
|
|
116
128
|
this.text = t, this.classes = e;
|
|
117
129
|
}
|
|
118
130
|
get componentName() {
|
|
@@ -125,24 +137,24 @@ class Ct extends X {
|
|
|
125
137
|
return this.classes;
|
|
126
138
|
}
|
|
127
139
|
}
|
|
128
|
-
class
|
|
140
|
+
class g extends G {
|
|
129
141
|
constructor(t, e = "") {
|
|
130
142
|
super();
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
this.classes = e, this.text = t, this.textType =
|
|
143
|
+
o(this, "classes");
|
|
144
|
+
o(this, "text");
|
|
145
|
+
o(this, "textType");
|
|
146
|
+
this.classes = e, this.text = t, this.textType = xt(() => this.getTextType);
|
|
135
147
|
}
|
|
136
148
|
get resolvedText() {
|
|
137
|
-
const t =
|
|
138
|
-
return
|
|
149
|
+
const t = h(this.text);
|
|
150
|
+
return k(t) ? t() : t;
|
|
139
151
|
}
|
|
140
152
|
get getTextType() {
|
|
141
153
|
const t = this.resolvedText;
|
|
142
|
-
return t ? t instanceof
|
|
154
|
+
return t ? t instanceof O ? "md" : X(t) ? "component" : "string" : "string";
|
|
143
155
|
}
|
|
144
156
|
get componentName() {
|
|
145
|
-
switch (
|
|
157
|
+
switch (h(this.textType)) {
|
|
146
158
|
case "string":
|
|
147
159
|
return "template";
|
|
148
160
|
case "md":
|
|
@@ -154,7 +166,7 @@ class p extends X {
|
|
|
154
166
|
}
|
|
155
167
|
}
|
|
156
168
|
get componentBindings() {
|
|
157
|
-
switch (
|
|
169
|
+
switch (h(this.textType)) {
|
|
158
170
|
case "string":
|
|
159
171
|
return {};
|
|
160
172
|
case "md": {
|
|
@@ -168,7 +180,7 @@ class p extends X {
|
|
|
168
180
|
}
|
|
169
181
|
}
|
|
170
182
|
get componentBody() {
|
|
171
|
-
switch (
|
|
183
|
+
switch (h(this.textType)) {
|
|
172
184
|
case "string":
|
|
173
185
|
return this.resolvedText;
|
|
174
186
|
case "component":
|
|
@@ -181,128 +193,163 @@ class p extends X {
|
|
|
181
193
|
return this.classes;
|
|
182
194
|
}
|
|
183
195
|
}
|
|
184
|
-
class
|
|
196
|
+
class jt extends g {
|
|
197
|
+
}
|
|
198
|
+
function b(n) {
|
|
199
|
+
return Pt().useMarkdownInValidators ? new O(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, `
|
|
200
|
+
`);
|
|
185
201
|
}
|
|
186
|
-
const
|
|
187
|
-
class f extends
|
|
202
|
+
const Nt = /* @__PURE__ */ Symbol("Validator"), Tt = () => b("Validation could not be completed");
|
|
203
|
+
class f extends y {
|
|
188
204
|
/**
|
|
189
205
|
* Creates a new validator
|
|
190
206
|
* @param validationFn Function that validates the field value and returns errors or null
|
|
191
207
|
*/
|
|
192
208
|
constructor(t) {
|
|
193
|
-
super((
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
209
|
+
super((s, r, a, l) => {
|
|
210
|
+
var B;
|
|
211
|
+
const u = ((B = this.runs.get(s)) != null ? B : 0) + 1;
|
|
212
|
+
this.runs.set(s, u);
|
|
213
|
+
const d = s.validationEpoch, x = () => this.runs.get(s) === u && s.validationEpoch === d, _ = t(a, l, s) || [], P = (p) => {
|
|
214
|
+
var K;
|
|
215
|
+
const E = (K = p == null ? void 0 : p.map((I) => this.claim(I))) != null ? K : [];
|
|
216
|
+
for (let I = s.errors.length - 1; I >= 0; I--) {
|
|
217
|
+
const Z = s.errors[I];
|
|
218
|
+
if (Z.source === this.source) {
|
|
219
|
+
const tt = E.findIndex((mt) => D(mt, Z));
|
|
220
|
+
tt >= 0 ? E.splice(tt, 1) : s.errors.splice(I, 1);
|
|
204
221
|
}
|
|
205
222
|
}
|
|
206
|
-
|
|
223
|
+
E.length > 0 && s.errors.push(...E), s.validate();
|
|
207
224
|
};
|
|
208
|
-
return
|
|
209
|
-
|
|
210
|
-
|
|
225
|
+
return _ instanceof Promise ? (s.beginValidating(), _.then(
|
|
226
|
+
(p) => {
|
|
227
|
+
x() && P(p);
|
|
228
|
+
},
|
|
229
|
+
(p) => {
|
|
230
|
+
x() && (P([new g(Tt())]), console.error("Validation failed", p));
|
|
231
|
+
}
|
|
232
|
+
).finally(() => s.endValidating()).catch((p) => console.error("Validation failed", p))) : P(_), r(s, a, l);
|
|
211
233
|
});
|
|
212
|
-
|
|
234
|
+
o(this, "source");
|
|
235
|
+
/**
|
|
236
|
+
* Sequence number of the newest run of this validator, per field. Every execution takes the next number, and a
|
|
237
|
+
* result is applied only while its number is still the newest one, so a slow run cannot overwrite the verdict of
|
|
238
|
+
* a faster one that started after it. The key is the field because one validator instance may be registered on
|
|
239
|
+
* several fields, each with a sequence of its own.
|
|
240
|
+
*/
|
|
241
|
+
o(this, "runs", /* @__PURE__ */ new WeakMap());
|
|
213
242
|
this.source = Symbol(this.constructor.name);
|
|
214
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* Returns the error instance this validator owns and may later withdraw: the argument itself when it carries no
|
|
246
|
+
* ownership stamp or already carries this validator's, a copy of it when it belongs to another validator. The
|
|
247
|
+
* stamp is not configurable, so an instance one validator owns can never be reassigned to another; the copy is
|
|
248
|
+
* what makes an error instance shareable between validators, and it keeps the prototype and every own property,
|
|
249
|
+
* including the non-enumerable ones, so it renders exactly like the instance it was made from.
|
|
250
|
+
*/
|
|
251
|
+
claim(t) {
|
|
252
|
+
const e = t.source;
|
|
253
|
+
if (e === this.source) return t;
|
|
254
|
+
const s = { value: this.source, enumerable: !1, configurable: !1 };
|
|
255
|
+
if (e === void 0)
|
|
256
|
+
return Object.defineProperty(t, "source", s), t;
|
|
257
|
+
const r = Object.getOwnPropertyDescriptors(t);
|
|
258
|
+
return Object.create(Object.getPrototypeOf(t), w(v({}, r), { source: s }));
|
|
259
|
+
}
|
|
215
260
|
static get classIdentifier() {
|
|
216
|
-
return
|
|
261
|
+
return Nt;
|
|
217
262
|
}
|
|
218
263
|
get eager() {
|
|
219
264
|
return !0;
|
|
220
265
|
}
|
|
221
266
|
replacePlaceholdersFunction(t, e) {
|
|
222
267
|
return () => {
|
|
223
|
-
let
|
|
224
|
-
for (;
|
|
225
|
-
|
|
226
|
-
return
|
|
268
|
+
let s = h(t);
|
|
269
|
+
for (; k(s); )
|
|
270
|
+
s = h(this.replacePlaceholders(s(), e));
|
|
271
|
+
return s;
|
|
227
272
|
};
|
|
228
273
|
}
|
|
229
274
|
replacePlaceholders(t, e) {
|
|
230
|
-
if (
|
|
231
|
-
if (
|
|
232
|
-
|
|
275
|
+
if (k(t)) return this.replacePlaceholdersFunction(t, e);
|
|
276
|
+
if (X(t)) return t;
|
|
277
|
+
if (_t(t))
|
|
278
|
+
return this.replacePlaceholdersFunction(() => h(t), e);
|
|
279
|
+
let s = h(t);
|
|
233
280
|
return Object.keys(e).forEach((r) => {
|
|
234
|
-
|
|
235
|
-
}), t instanceof
|
|
281
|
+
s = s.replaceAll(`{${r}}`, e[r]);
|
|
282
|
+
}), t instanceof O ? new O(s.toString(), t.options, t.plugins) : s;
|
|
236
283
|
}
|
|
237
284
|
}
|
|
238
|
-
class
|
|
285
|
+
class L extends Map {
|
|
239
286
|
constructor() {
|
|
240
287
|
super(...arguments);
|
|
241
|
-
|
|
242
|
-
|
|
288
|
+
o(this, "eagerActions", /* @__PURE__ */ new Set());
|
|
289
|
+
o(this, "registeredActions", []);
|
|
243
290
|
}
|
|
244
291
|
register(t) {
|
|
245
|
-
if (!(t instanceof
|
|
292
|
+
if (!(t instanceof m)) throw new Error("Invalid action type");
|
|
246
293
|
this.registeredActions.push(t);
|
|
247
|
-
const e = t.classIdentifier,
|
|
248
|
-
function r(a, ...
|
|
249
|
-
return t.execute(a,
|
|
294
|
+
const e = t.classIdentifier, s = this.get(e) || (() => null);
|
|
295
|
+
function r(a, ...l) {
|
|
296
|
+
return t.execute(a, s, ...l);
|
|
250
297
|
}
|
|
251
298
|
this.set(e, r), t.eager && this.eagerActions.add(t.classIdentifier);
|
|
252
299
|
}
|
|
253
|
-
trigger(t, e, ...
|
|
300
|
+
trigger(t, e, ...s) {
|
|
254
301
|
const r = t.classIdentifier;
|
|
255
|
-
r ===
|
|
302
|
+
r === lt && this.triggerEager(e, ...s);
|
|
256
303
|
const a = this.get(r);
|
|
257
304
|
try {
|
|
258
|
-
if (a) return a(e, ...
|
|
259
|
-
} catch (
|
|
260
|
-
if (!(
|
|
305
|
+
if (a) return a(e, ...s);
|
|
306
|
+
} catch (l) {
|
|
307
|
+
if (!(l instanceof W)) throw l;
|
|
261
308
|
}
|
|
262
309
|
return null;
|
|
263
310
|
}
|
|
264
311
|
triggerEager(t, ...e) {
|
|
265
|
-
for (const
|
|
266
|
-
const r = this.get(
|
|
312
|
+
for (const s of this.eagerActions) {
|
|
313
|
+
const r = this.get(s);
|
|
267
314
|
try {
|
|
268
315
|
r && r(t, ...e);
|
|
269
316
|
} catch (a) {
|
|
270
|
-
if (!(a instanceof
|
|
317
|
+
if (!(a instanceof W)) throw a;
|
|
271
318
|
}
|
|
272
319
|
}
|
|
273
320
|
}
|
|
274
321
|
clone() {
|
|
275
|
-
const t = new
|
|
322
|
+
const t = new L();
|
|
276
323
|
return this.registeredActions.forEach((e) => t.register(e)), t;
|
|
277
324
|
}
|
|
278
325
|
cloneWithoutValidators() {
|
|
279
|
-
const t = new
|
|
326
|
+
const t = new L();
|
|
280
327
|
return this.registeredActions.forEach((e) => {
|
|
281
328
|
e instanceof f ? e.unregister() : t.register(e);
|
|
282
329
|
}), t;
|
|
283
330
|
}
|
|
284
331
|
}
|
|
285
|
-
const
|
|
286
|
-
class
|
|
332
|
+
const Ot = /* @__PURE__ */ Symbol("ConditionalStatementAction");
|
|
333
|
+
class M extends y {
|
|
287
334
|
constructor(t, e) {
|
|
288
|
-
const
|
|
289
|
-
const
|
|
290
|
-
if (
|
|
291
|
-
for (const
|
|
292
|
-
e(
|
|
293
|
-
this.lastResult =
|
|
335
|
+
const s = (r, a, l, u) => {
|
|
336
|
+
const d = t.evaluate();
|
|
337
|
+
if (d !== this.lastResult) {
|
|
338
|
+
for (const x of this.boundFields)
|
|
339
|
+
e(x, d, this.lastResult);
|
|
340
|
+
this.lastResult = d;
|
|
294
341
|
}
|
|
295
|
-
return a(r,
|
|
342
|
+
return a(r, l, u);
|
|
296
343
|
};
|
|
297
|
-
super(
|
|
298
|
-
|
|
344
|
+
super(s);
|
|
345
|
+
o(this, "lastResult");
|
|
299
346
|
// boundField tracks the fields this action is bound to. so that it may perform the executorFn on them and not on the
|
|
300
347
|
// ValueChangedAction fields that will call the actionExecutor
|
|
301
|
-
|
|
302
|
-
t.collectFields().forEach((r) => r.registerAction(new
|
|
348
|
+
o(this, "boundFields", /* @__PURE__ */ new Set());
|
|
349
|
+
t.collectFields().forEach((r) => r.registerAction(new y(s)));
|
|
303
350
|
}
|
|
304
351
|
static get classIdentifier() {
|
|
305
|
-
return
|
|
352
|
+
return Ot;
|
|
306
353
|
}
|
|
307
354
|
get eager() {
|
|
308
355
|
return !0;
|
|
@@ -311,30 +358,30 @@ class B extends v {
|
|
|
311
358
|
this.boundFields.add(t);
|
|
312
359
|
}
|
|
313
360
|
}
|
|
314
|
-
class
|
|
315
|
-
constructor(
|
|
316
|
-
super(
|
|
317
|
-
t.visibility = e ?
|
|
361
|
+
class Lt extends M {
|
|
362
|
+
constructor(i) {
|
|
363
|
+
super(i, (t, e) => {
|
|
364
|
+
t.visibility = e ? S.FULL : S.SUPPRESS;
|
|
318
365
|
});
|
|
319
366
|
}
|
|
320
367
|
}
|
|
321
|
-
class
|
|
322
|
-
constructor(
|
|
323
|
-
super(
|
|
368
|
+
class Rt extends M {
|
|
369
|
+
constructor(i) {
|
|
370
|
+
super(i, (t, e) => {
|
|
324
371
|
t.enabled = e;
|
|
325
372
|
});
|
|
326
373
|
}
|
|
327
374
|
}
|
|
328
|
-
class
|
|
329
|
-
constructor(
|
|
330
|
-
super(
|
|
331
|
-
|
|
375
|
+
class Bt extends M {
|
|
376
|
+
constructor(i, t) {
|
|
377
|
+
super(i, (e, s) => {
|
|
378
|
+
s && (e.value = t);
|
|
332
379
|
});
|
|
333
380
|
}
|
|
334
381
|
}
|
|
335
|
-
var
|
|
336
|
-
((
|
|
337
|
-
function
|
|
382
|
+
var R = /* @__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))(R || {});
|
|
383
|
+
((n) => {
|
|
384
|
+
function i(r) {
|
|
338
385
|
const a = r.toLowerCase();
|
|
339
386
|
if (a === "not") return 0;
|
|
340
387
|
if (a === "or") return 1;
|
|
@@ -354,119 +401,160 @@ var L = /* @__PURE__ */ ((i) => (i[i.NOT = 0] = "NOT", i[i.OR = 1] = "OR", i[i.A
|
|
|
354
401
|
if (["not_includes", "not-includes", "not includes"].includes(a)) return -10;
|
|
355
402
|
throw new Error(`Unrecognised operator ${a}`);
|
|
356
403
|
}
|
|
357
|
-
|
|
404
|
+
n.fromString = i;
|
|
358
405
|
function t(r) {
|
|
359
|
-
const a = typeof r == "number" ? r :
|
|
360
|
-
if (Object.values(
|
|
406
|
+
const a = typeof r == "number" ? r : n.fromString(r);
|
|
407
|
+
if (Object.values(n).includes(a)) return a;
|
|
361
408
|
throw new Error(`Unrecognised operator ${r}`);
|
|
362
409
|
}
|
|
363
|
-
|
|
410
|
+
n.fromAny = t;
|
|
364
411
|
function e(r) {
|
|
365
|
-
const a = typeof r == "number" ? r :
|
|
366
|
-
return Object.values(
|
|
412
|
+
const a = typeof r == "number" ? r : n.fromString(r);
|
|
413
|
+
return Object.values(n).includes(a);
|
|
367
414
|
}
|
|
368
|
-
|
|
369
|
-
function
|
|
415
|
+
n.isDefined = e;
|
|
416
|
+
function s(r) {
|
|
370
417
|
return r >= 0;
|
|
371
418
|
}
|
|
372
|
-
|
|
373
|
-
})(
|
|
374
|
-
Object.freeze(
|
|
375
|
-
const
|
|
376
|
-
class
|
|
377
|
-
constructor(
|
|
378
|
-
super(
|
|
419
|
+
n.isLogicOperator = s;
|
|
420
|
+
})(R || (R = {}));
|
|
421
|
+
Object.freeze(R);
|
|
422
|
+
const c = R, Ut = /* @__PURE__ */ Symbol("EnabledChangingAction");
|
|
423
|
+
class ut extends m {
|
|
424
|
+
constructor(i) {
|
|
425
|
+
super(i);
|
|
379
426
|
}
|
|
380
427
|
static get classIdentifier() {
|
|
381
|
-
return
|
|
428
|
+
return Ut;
|
|
382
429
|
}
|
|
383
|
-
execute(
|
|
384
|
-
return super.execute(
|
|
430
|
+
execute(i, t, e, s) {
|
|
431
|
+
return super.execute(i, t, e, s);
|
|
385
432
|
}
|
|
386
433
|
}
|
|
387
|
-
const
|
|
388
|
-
class
|
|
389
|
-
constructor(
|
|
390
|
-
super(
|
|
434
|
+
const kt = /* @__PURE__ */ Symbol("EnabledChangedAction");
|
|
435
|
+
class ct extends m {
|
|
436
|
+
constructor(i) {
|
|
437
|
+
super(i);
|
|
391
438
|
}
|
|
392
439
|
static get classIdentifier() {
|
|
393
|
-
return
|
|
440
|
+
return kt;
|
|
394
441
|
}
|
|
395
|
-
execute(
|
|
396
|
-
return super.execute(
|
|
442
|
+
execute(i, t, e, s) {
|
|
443
|
+
return super.execute(i, t, e, s);
|
|
397
444
|
}
|
|
398
445
|
}
|
|
399
|
-
const
|
|
400
|
-
class
|
|
401
|
-
constructor(
|
|
402
|
-
super(
|
|
446
|
+
const Dt = /* @__PURE__ */ Symbol("ValidChangedAction");
|
|
447
|
+
class ht extends m {
|
|
448
|
+
constructor(i) {
|
|
449
|
+
super(i);
|
|
403
450
|
}
|
|
404
451
|
static get classIdentifier() {
|
|
405
|
-
return
|
|
452
|
+
return Dt;
|
|
406
453
|
}
|
|
407
|
-
execute(
|
|
408
|
-
return super.execute(
|
|
454
|
+
execute(i, t, e, s) {
|
|
455
|
+
return super.execute(i, t, e, s);
|
|
409
456
|
}
|
|
410
457
|
}
|
|
411
|
-
const
|
|
412
|
-
class
|
|
413
|
-
constructor(
|
|
414
|
-
super(
|
|
458
|
+
const Mt = /* @__PURE__ */ Symbol("VisibilityChangingAction");
|
|
459
|
+
class dt extends m {
|
|
460
|
+
constructor(i) {
|
|
461
|
+
super(i);
|
|
415
462
|
}
|
|
416
463
|
static get classIdentifier() {
|
|
417
|
-
return
|
|
464
|
+
return Mt;
|
|
418
465
|
}
|
|
419
|
-
execute(
|
|
420
|
-
return super.execute(
|
|
466
|
+
execute(i, t, e, s) {
|
|
467
|
+
return super.execute(i, t, e, s);
|
|
421
468
|
}
|
|
422
469
|
}
|
|
423
|
-
const
|
|
424
|
-
class
|
|
425
|
-
constructor(
|
|
426
|
-
super(
|
|
470
|
+
const $t = /* @__PURE__ */ Symbol("VisibilityChangedAction");
|
|
471
|
+
class gt extends m {
|
|
472
|
+
constructor(i) {
|
|
473
|
+
super(i);
|
|
427
474
|
}
|
|
428
475
|
static get classIdentifier() {
|
|
429
|
-
return
|
|
476
|
+
return $t;
|
|
430
477
|
}
|
|
431
|
-
execute(
|
|
432
|
-
return super.execute(
|
|
478
|
+
execute(i, t, e, s) {
|
|
479
|
+
return super.execute(i, t, e, s);
|
|
433
480
|
}
|
|
434
481
|
}
|
|
435
|
-
class
|
|
482
|
+
class V {
|
|
483
|
+
/**
|
|
484
|
+
* A field is a Vue reactive proxy from construction onwards: the base constructor returns the proxy, and a
|
|
485
|
+
* derived class's `this` is whatever super() returned, so every subclass constructor, field initializer and
|
|
486
|
+
* method sees the proxy. Consequence: plain `field.property = value` is tracked, with no wrapper in between.
|
|
487
|
+
*/
|
|
436
488
|
constructor() {
|
|
437
|
-
l(this, "reactiveValue", G(() => this.value));
|
|
438
489
|
// contains original field value as was provided at creation
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
l(this, "_valid", !0);
|
|
490
|
+
o(this, "validatingCount", 0);
|
|
491
|
+
o(this, "_valid", !0);
|
|
442
492
|
// is current value valid as per FE and BE validators?
|
|
443
|
-
|
|
493
|
+
o(this, "errors", []);
|
|
444
494
|
// when member of a Group, fieldName specifies the name of this field
|
|
445
|
-
|
|
495
|
+
o(this, "actions", new L());
|
|
446
496
|
// default property handlers
|
|
447
|
-
|
|
448
|
-
|
|
497
|
+
o(this, "_visibility", S.FULL);
|
|
498
|
+
o(this, "_enabled", !0);
|
|
499
|
+
/**
|
|
500
|
+
* While true, validate() on this field does nothing at all: it neither recomputes _valid nor emits
|
|
501
|
+
* ValidChangedAction, and nothing climbs to the parent. A container that walks its members one by one - assigning
|
|
502
|
+
* them a value, or revalidating them - sets it for the duration of the walk, so a member's upward climb cannot
|
|
503
|
+
* announce the verdict of a half-applied value or of a half-revalidated set, and clears it in a finally block
|
|
504
|
+
* followed by its own validate(). That call recomputes over the finished state and emits the net transition, so
|
|
505
|
+
* the deferral cannot swallow a real change.
|
|
506
|
+
*/
|
|
507
|
+
o(this, "suppressValidation", !1);
|
|
508
|
+
/**
|
|
509
|
+
* While true, a validity change is still recomputed and still announced on this field, but it is not passed up to
|
|
510
|
+
* the parent: the climb is only remembered and carried out by flushParentValidityClimb(). A setter that notifies
|
|
511
|
+
* the parent of the new value itself holds it over the notifying region, so the parent forms its verdict once,
|
|
512
|
+
* over the finished value, instead of once over the value being replaced and once over the value replacing it.
|
|
513
|
+
*/
|
|
514
|
+
o(this, "suppressParentValidityClimb", !1);
|
|
515
|
+
o(this, "parentValidityClimbPending", !1);
|
|
516
|
+
o(this, "_validationEpoch", 0);
|
|
517
|
+
return Et(this);
|
|
518
|
+
}
|
|
519
|
+
/** true while at least one asynchronous validator is still running for this field */
|
|
520
|
+
get validating() {
|
|
521
|
+
return this.validatingCount > 0;
|
|
522
|
+
}
|
|
523
|
+
/** announces the start of one asynchronous validation run; validators pair it with endValidating */
|
|
524
|
+
beginValidating() {
|
|
525
|
+
this.validatingCount++;
|
|
526
|
+
}
|
|
527
|
+
/** announces the end of one asynchronous validation run */
|
|
528
|
+
endValidating() {
|
|
529
|
+
this.validatingCount = Math.max(0, this.validatingCount - 1);
|
|
449
530
|
}
|
|
450
531
|
get visibility() {
|
|
451
532
|
return this._visibility;
|
|
452
533
|
}
|
|
453
|
-
set visibility(
|
|
454
|
-
const t = this._visibility, e = this.actions.trigger(
|
|
455
|
-
if (!
|
|
456
|
-
this._visibility =
|
|
534
|
+
set visibility(i) {
|
|
535
|
+
const t = this._visibility, e = this.actions.trigger(dt, this, i, t);
|
|
536
|
+
if (!S.isDefined(e != null ? e : i)) throw new Error("visibility must be a DisplayMode constant");
|
|
537
|
+
this._visibility = S.fromAny(e != null ? e : i), this.actions.trigger(gt, this, this._visibility, t);
|
|
457
538
|
}
|
|
458
539
|
get enabled() {
|
|
459
540
|
return this._enabled;
|
|
460
541
|
}
|
|
461
|
-
set enabled(
|
|
462
|
-
const t = this._enabled, e = this.actions.trigger(
|
|
463
|
-
if (!
|
|
464
|
-
this._enabled = e != null ? e :
|
|
542
|
+
set enabled(i) {
|
|
543
|
+
const t = this._enabled, e = this.actions.trigger(ut, this, i, t);
|
|
544
|
+
if (!Vt(e != null ? e : i)) throw new Error("Enabled value must be boolean");
|
|
545
|
+
this._enabled = e != null ? e : i, this.actions.trigger(ct, this, this._enabled, t);
|
|
465
546
|
}
|
|
466
|
-
|
|
467
|
-
|
|
547
|
+
/** Carries out the climb that a validity change made while suppressParentValidityClimb was held, if there was one. */
|
|
548
|
+
flushParentValidityClimb() {
|
|
549
|
+
var i;
|
|
550
|
+
this.parentValidityClimbPending && (this.parentValidityClimbPending = !1, (i = this.parent) == null || i.validate());
|
|
551
|
+
}
|
|
552
|
+
validate(i = !1) {
|
|
553
|
+
var e;
|
|
554
|
+
if (this.suppressValidation) return;
|
|
555
|
+
i && this.actions.triggerEager(this, this.value, this.value);
|
|
468
556
|
const t = this._valid;
|
|
469
|
-
this._valid = this.valid, this._valid !== t && this.actions.trigger(
|
|
557
|
+
this._valid = this.valid, this._valid !== t && (this.actions.trigger(ht, this, this.valid, t), this.suppressParentValidityClimb ? this.parentValidityClimbPending = !0 : (e = this.parent) == null || e.validate());
|
|
470
558
|
}
|
|
471
559
|
get valid() {
|
|
472
560
|
return this.errors.length === 0;
|
|
@@ -475,73 +563,94 @@ class y {
|
|
|
475
563
|
return this.value;
|
|
476
564
|
}
|
|
477
565
|
get isChanged() {
|
|
478
|
-
return !
|
|
566
|
+
return !D(this.value, this.originalValue);
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Registers the actions a constructor received in its parameters: registration without the eager trigger,
|
|
570
|
+
* because a constructor ends with a single this.actions.triggerEager(...) over the finished value, and an
|
|
571
|
+
* eager action registered here would otherwise also run once per registration, over a half-built field.
|
|
572
|
+
*/
|
|
573
|
+
registerInitialActions(i) {
|
|
574
|
+
i.forEach((t) => {
|
|
575
|
+
this.actions.register(t), t.boundToField(this);
|
|
576
|
+
});
|
|
479
577
|
}
|
|
480
|
-
registerAction(
|
|
481
|
-
|
|
482
|
-
return this.actions.register(t), t.boundToField(this), t.eager && this.actions.trigger(Object.getPrototypeOf(s).constructor, this, this.value, this.originalValue), this;
|
|
578
|
+
registerAction(i) {
|
|
579
|
+
return this.actions.register(i), i.boundToField(this), i.eager && this.actions.trigger(Object.getPrototypeOf(i).constructor, this, this.value, this.originalValue), this;
|
|
483
580
|
}
|
|
484
|
-
triggerAction(
|
|
485
|
-
return this.actions.trigger(
|
|
581
|
+
triggerAction(i, ...t) {
|
|
582
|
+
return this.actions.trigger(i, this, ...t);
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Generation counter of the validators attached to this field. A Validator reads it when a run starts and drops
|
|
586
|
+
* a result whose epoch no longer matches, so a validation still in flight when clearValidators() is called
|
|
587
|
+
* cannot push an error onto a field that no longer has the validator that produced it.
|
|
588
|
+
*/
|
|
589
|
+
get validationEpoch() {
|
|
590
|
+
return this._validationEpoch;
|
|
486
591
|
}
|
|
487
592
|
clearValidators() {
|
|
488
|
-
this.actions = this.actions.cloneWithoutValidators(), this.errors = [], this.
|
|
593
|
+
this._validationEpoch++, this.actions = this.actions.cloneWithoutValidators(), this.errors = [], this.validate();
|
|
489
594
|
}
|
|
490
595
|
}
|
|
491
|
-
function
|
|
492
|
-
return
|
|
596
|
+
function qt(n, i) {
|
|
597
|
+
return n ? !i : i;
|
|
493
598
|
}
|
|
494
|
-
class
|
|
495
|
-
constructor(
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
this.operand1 =
|
|
599
|
+
class N {
|
|
600
|
+
constructor(i, t, e) {
|
|
601
|
+
o(this, "operand1");
|
|
602
|
+
o(this, "operator");
|
|
603
|
+
o(this, "operand2");
|
|
604
|
+
this.operand1 = i, this.operator = t, this.operand2 = e;
|
|
500
605
|
}
|
|
501
606
|
get operand1Value() {
|
|
502
|
-
return this.operand1 instanceof
|
|
607
|
+
return this.operand1 instanceof N ? this.operand1.evaluate() : this.operand1 instanceof V ? h(this.operand1.value) : this.operand1;
|
|
503
608
|
}
|
|
504
609
|
get operand2Value() {
|
|
505
|
-
return this.operand2 instanceof
|
|
610
|
+
return this.operand2 instanceof N ? this.operand2.evaluate() : this.operand2 instanceof V ? h(this.operand2.value) : this.operand2;
|
|
506
611
|
}
|
|
507
612
|
evaluate() {
|
|
508
|
-
var e,
|
|
509
|
-
const
|
|
613
|
+
var e, s;
|
|
614
|
+
const i = this.operand1Value, t = this.operand2Value;
|
|
510
615
|
switch (this.operator) {
|
|
511
616
|
// logical operators
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
case
|
|
517
|
-
return
|
|
518
|
-
case
|
|
519
|
-
return
|
|
520
|
-
case
|
|
521
|
-
return
|
|
522
|
-
case
|
|
523
|
-
return !
|
|
617
|
+
// `&&` and `||` evaluate to one of their operands, and the operands are of any type. Without the
|
|
618
|
+
// coercion evaluate() would hand out the operand itself, so `0` or `''` would reach callers that the
|
|
619
|
+
// signature promises a boolean, and consumers comparing results with !== would see a change where the
|
|
620
|
+
// logical value stayed the same.
|
|
621
|
+
case c.AND:
|
|
622
|
+
return !!(i && t);
|
|
623
|
+
case c.OR:
|
|
624
|
+
return !!(i || t);
|
|
625
|
+
case c.NAND:
|
|
626
|
+
return !(i && t);
|
|
627
|
+
case c.NOR:
|
|
628
|
+
return !(i || t);
|
|
629
|
+
case c.XOR:
|
|
630
|
+
return qt(!!i, !!t);
|
|
631
|
+
case c.NOT:
|
|
632
|
+
return !i;
|
|
524
633
|
// comparison operators
|
|
525
|
-
case
|
|
526
|
-
return
|
|
527
|
-
case
|
|
528
|
-
return
|
|
529
|
-
case
|
|
530
|
-
return
|
|
531
|
-
case
|
|
532
|
-
return
|
|
533
|
-
case
|
|
534
|
-
return
|
|
535
|
-
case
|
|
536
|
-
return
|
|
537
|
-
case
|
|
538
|
-
return (
|
|
539
|
-
case
|
|
540
|
-
return !((
|
|
541
|
-
case
|
|
542
|
-
return
|
|
543
|
-
case
|
|
544
|
-
return !(
|
|
634
|
+
case c.EQUALS:
|
|
635
|
+
return i == t;
|
|
636
|
+
case c.NOT_EQUALS:
|
|
637
|
+
return i != t;
|
|
638
|
+
case c.LT:
|
|
639
|
+
return i < t;
|
|
640
|
+
case c.LE:
|
|
641
|
+
return i <= t;
|
|
642
|
+
case c.GE:
|
|
643
|
+
return i >= t;
|
|
644
|
+
case c.GT:
|
|
645
|
+
return i > t;
|
|
646
|
+
case c.IN:
|
|
647
|
+
return !!((e = t == null ? void 0 : t.includes) != null && e.call(t, i));
|
|
648
|
+
case c.NOT_IN:
|
|
649
|
+
return !((s = t == null ? void 0 : t.includes) != null && s.call(t, i));
|
|
650
|
+
case c.INCLUDES:
|
|
651
|
+
return A(i) && A(t) && i.indexOf(t) >= 0;
|
|
652
|
+
case c.NOT_INCLUDES:
|
|
653
|
+
return !(A(i) && A(t) && i.indexOf(t) >= 0);
|
|
545
654
|
default:
|
|
546
655
|
throw new Error(`Operator not implemented ${this.operator}`);
|
|
547
656
|
}
|
|
@@ -551,82 +660,86 @@ class F {
|
|
|
551
660
|
* @returns A set of all fields used in this statement
|
|
552
661
|
*/
|
|
553
662
|
collectFields() {
|
|
554
|
-
const
|
|
663
|
+
const i = /* @__PURE__ */ new Set();
|
|
555
664
|
function t(e) {
|
|
556
|
-
e instanceof
|
|
665
|
+
e instanceof V ? i.add(e) : e instanceof N && e.collectFields().forEach((r) => i.add(r));
|
|
557
666
|
}
|
|
558
|
-
return t(this.operand1), t(this.operand2),
|
|
667
|
+
return t(this.operand1), t(this.operand2), i;
|
|
559
668
|
}
|
|
560
669
|
}
|
|
561
|
-
const
|
|
562
|
-
class
|
|
563
|
-
constructor(
|
|
564
|
-
super(
|
|
670
|
+
const Ht = /* @__PURE__ */ Symbol("ExecuteAction");
|
|
671
|
+
class ft extends m {
|
|
672
|
+
constructor(i) {
|
|
673
|
+
super(i);
|
|
565
674
|
}
|
|
566
675
|
static get classIdentifier() {
|
|
567
|
-
return
|
|
676
|
+
return Ht;
|
|
568
677
|
}
|
|
569
|
-
execute(
|
|
570
|
-
return super.execute(
|
|
678
|
+
execute(i, t, e) {
|
|
679
|
+
return super.execute(i, t, e);
|
|
571
680
|
}
|
|
572
681
|
}
|
|
573
|
-
const
|
|
574
|
-
class z extends
|
|
575
|
-
constructor(
|
|
576
|
-
super(
|
|
682
|
+
const Qt = /* @__PURE__ */ Symbol("ListItemAddedAction");
|
|
683
|
+
class z extends m {
|
|
684
|
+
constructor(i) {
|
|
685
|
+
super(i);
|
|
577
686
|
}
|
|
578
687
|
static get classIdentifier() {
|
|
579
|
-
return
|
|
688
|
+
return Qt;
|
|
580
689
|
}
|
|
581
|
-
execute(
|
|
582
|
-
return super.execute(
|
|
690
|
+
execute(i, t, e, s) {
|
|
691
|
+
return super.execute(i, t, e, s);
|
|
583
692
|
}
|
|
584
693
|
}
|
|
585
|
-
const
|
|
586
|
-
class
|
|
587
|
-
constructor(
|
|
588
|
-
super(
|
|
694
|
+
const Wt = /* @__PURE__ */ Symbol("ListItemRemovedAction");
|
|
695
|
+
class pt extends m {
|
|
696
|
+
constructor(i) {
|
|
697
|
+
super(i);
|
|
589
698
|
}
|
|
590
699
|
static get classIdentifier() {
|
|
591
|
-
return
|
|
700
|
+
return Wt;
|
|
592
701
|
}
|
|
593
|
-
execute(
|
|
594
|
-
return super.execute(
|
|
702
|
+
execute(i, t, e, s) {
|
|
703
|
+
return super.execute(i, t, e, s);
|
|
595
704
|
}
|
|
596
705
|
}
|
|
597
|
-
|
|
598
|
-
class D extends y {
|
|
706
|
+
class $ extends V {
|
|
599
707
|
constructor(t) {
|
|
600
708
|
super();
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
const e = this.constructor.name;
|
|
605
|
-
throw new TypeError(`Don't use constructor to instantiate ${e}. Use ${e}.create<T>`);
|
|
606
|
-
}
|
|
709
|
+
o(this, "_value");
|
|
710
|
+
o(this, "_touched", !1);
|
|
711
|
+
this.init(t);
|
|
607
712
|
}
|
|
713
|
+
/**
|
|
714
|
+
* Applies the constructor parameters. It is a hook so that a subclass needing different parameter handling
|
|
715
|
+
* overrides one method instead of redeclaring the constructor - Action does exactly that.
|
|
716
|
+
*
|
|
717
|
+
* It is called from this constructor, so it runs before a subclass's own class field initializers, which
|
|
718
|
+
* only run once super() returns. An override must therefore work off its parameters alone: members the
|
|
719
|
+
* subclass initializes read as undefined inside it, and anything it writes to such a member is overwritten
|
|
720
|
+
* the moment the initializer runs.
|
|
721
|
+
*/
|
|
608
722
|
init(t) {
|
|
609
723
|
if (t) {
|
|
610
|
-
const e = t, { value:
|
|
611
|
-
[...r || [], ...a || []]
|
|
724
|
+
const e = t, { value: s, validators: r, actions: a } = e, l = F(e, ["value", "validators", "actions"]);
|
|
725
|
+
this.registerInitialActions([...r || [], ...a || []]), Object.assign(this, l), this._value = s !== void 0 ? s : this.originalValue, this.originalValue === void 0 && (this.originalValue = this._value);
|
|
612
726
|
}
|
|
613
727
|
this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
614
728
|
}
|
|
615
|
-
/**
|
|
616
|
-
* Creates a new reactive Field instance.
|
|
617
|
-
* @param params Initial field parameters
|
|
618
|
-
* @returns Reactive Field instance
|
|
619
|
-
*/
|
|
620
|
-
static create(t) {
|
|
621
|
-
const e = yt(new this(st));
|
|
622
|
-
return e.init(t), e;
|
|
623
|
-
}
|
|
624
729
|
get value() {
|
|
625
730
|
return this._value;
|
|
626
731
|
}
|
|
627
732
|
set value(t) {
|
|
628
733
|
const e = this._value;
|
|
629
|
-
!this.enabled || e === t
|
|
734
|
+
if (!this.enabled || e === t) return;
|
|
735
|
+
this._value = t;
|
|
736
|
+
const s = this.suppressParentValidityClimb;
|
|
737
|
+
this.suppressParentValidityClimb = !0;
|
|
738
|
+
try {
|
|
739
|
+
this.actions.trigger(y, this, this._value, e), this.parent && this.parent.notifyValueChanged();
|
|
740
|
+
} finally {
|
|
741
|
+
this.suppressParentValidityClimb = s, this.validate(), this.flushParentValidityClimb();
|
|
742
|
+
}
|
|
630
743
|
}
|
|
631
744
|
get touched() {
|
|
632
745
|
return this._touched;
|
|
@@ -635,64 +748,59 @@ class D extends y {
|
|
|
635
748
|
this._touched = t;
|
|
636
749
|
}
|
|
637
750
|
clone(t) {
|
|
638
|
-
var
|
|
639
|
-
const e = this.constructor
|
|
640
|
-
value
|
|
751
|
+
var r, a;
|
|
752
|
+
const e = this.constructor, s = new e(w(v({
|
|
753
|
+
// an override value is one the caller supplied, and undefined is not one; an explicit null is, and clears
|
|
754
|
+
value: (t == null ? void 0 : t.value) !== void 0 ? t.value : this.value
|
|
641
755
|
}, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
|
|
642
756
|
enabled: (r = t == null ? void 0 : t.enabled) != null ? r : this.enabled,
|
|
643
757
|
visibility: (a = t == null ? void 0 : t.visibility) != null ? a : this.visibility
|
|
644
758
|
}));
|
|
645
|
-
return
|
|
759
|
+
return s.actions = this.actions.clone(), s.actions.triggerEager(s, s.value, s.originalValue), s;
|
|
646
760
|
}
|
|
647
761
|
}
|
|
648
|
-
const
|
|
649
|
-
new
|
|
762
|
+
const zt = new $({ value: "EmptyField" }).registerAction(
|
|
763
|
+
new y(() => {
|
|
650
764
|
console.warn("Working with EmptyField! This should not happen");
|
|
651
765
|
})
|
|
652
766
|
);
|
|
653
|
-
function
|
|
654
|
-
return (
|
|
767
|
+
function H(n, i) {
|
|
768
|
+
return (n == null ? void 0 : n.label) == null && (n == null ? void 0 : n.icon) == null ? i : n;
|
|
655
769
|
}
|
|
656
|
-
class
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
[...r || [], ...a || []].forEach((h) => this.registerAction(h)), Object.assign(this, o);
|
|
664
|
-
const c = M(e, this._value), u = Object.freeze({ label: n == null ? void 0 : n.label, icon: n == null ? void 0 : n.icon });
|
|
665
|
-
this._value = M(c, u), this.originalValue = M(u, c);
|
|
770
|
+
class Xt extends $ {
|
|
771
|
+
init(i) {
|
|
772
|
+
if (this._value = { label: void 0, icon: void 0 }, i) {
|
|
773
|
+
const t = i, { value: e, originalValue: s, validators: r, actions: a } = t, l = F(t, ["value", "originalValue", "validators", "actions"]);
|
|
774
|
+
this.registerInitialActions([...r || [], ...a || []]), Object.assign(this, l);
|
|
775
|
+
const u = H(e, this._value), d = Object.freeze({ label: s == null ? void 0 : s.label, icon: s == null ? void 0 : s.icon });
|
|
776
|
+
this._value = H(u, v({}, d)), this.originalValue = H(d, u);
|
|
666
777
|
}
|
|
667
778
|
this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
668
779
|
}
|
|
669
|
-
static create(s) {
|
|
670
|
-
return super.create(s);
|
|
671
|
-
}
|
|
672
780
|
get icon() {
|
|
673
781
|
return this.value.icon;
|
|
674
782
|
}
|
|
675
|
-
set icon(
|
|
676
|
-
this.value.icon =
|
|
783
|
+
set icon(i) {
|
|
784
|
+
this.value.icon = i;
|
|
677
785
|
}
|
|
678
786
|
get label() {
|
|
679
787
|
return this.value.label;
|
|
680
788
|
}
|
|
681
|
-
set label(
|
|
682
|
-
this.value.label =
|
|
789
|
+
set label(i) {
|
|
790
|
+
this.value.label = i;
|
|
683
791
|
}
|
|
684
|
-
execute(
|
|
685
|
-
this.actions.trigger(
|
|
792
|
+
execute(i) {
|
|
793
|
+
this.actions.trigger(ft, this, i);
|
|
686
794
|
}
|
|
687
795
|
}
|
|
688
|
-
const
|
|
796
|
+
const Gt = /* @__PURE__ */ It({
|
|
689
797
|
__name: "messages-widget",
|
|
690
798
|
props: {
|
|
691
799
|
message: {},
|
|
692
800
|
classes: {}
|
|
693
801
|
},
|
|
694
|
-
setup(
|
|
695
|
-
const
|
|
802
|
+
setup(n) {
|
|
803
|
+
const i = n, t = st("vue-markdown"), e = /* @__PURE__ */ new Set([
|
|
696
804
|
"div",
|
|
697
805
|
"span",
|
|
698
806
|
"p",
|
|
@@ -748,37 +856,37 @@ const $t = /* @__PURE__ */ xt({
|
|
|
748
856
|
"dl",
|
|
749
857
|
"dt",
|
|
750
858
|
"dd"
|
|
751
|
-
]),
|
|
752
|
-
if (typeof
|
|
859
|
+
]), s = () => {
|
|
860
|
+
if (typeof i.message == "string") return j("span", { class: i.classes }, i.message);
|
|
753
861
|
const r = [];
|
|
754
|
-
return
|
|
862
|
+
return i.message.forEach((a) => {
|
|
755
863
|
switch (a.componentName) {
|
|
756
864
|
case "template":
|
|
757
|
-
r.push(
|
|
865
|
+
r.push(j("div", { class: [i.classes, a.extraClasses] }, a.componentBody));
|
|
758
866
|
break;
|
|
759
867
|
case "vue-markdown":
|
|
760
868
|
if (typeof t == "string")
|
|
761
869
|
console.warn(
|
|
762
870
|
"You are using markdown for messages-widget, but you haven't registered a vue-markdown component"
|
|
763
|
-
), r.push(
|
|
871
|
+
), r.push(j("div", { class: [i.classes, a.extraClasses] }, a.componentBindings.source));
|
|
764
872
|
else {
|
|
765
|
-
const
|
|
873
|
+
const l = a.componentBindings;
|
|
766
874
|
r.push(
|
|
767
|
-
|
|
768
|
-
class: [
|
|
769
|
-
source:
|
|
770
|
-
options:
|
|
771
|
-
plugins:
|
|
875
|
+
j(t, {
|
|
876
|
+
class: [i.classes, a.extraClasses, "df-messages-widget-markdown"],
|
|
877
|
+
source: l.source,
|
|
878
|
+
options: l.options,
|
|
879
|
+
plugins: l.plugins
|
|
772
880
|
})
|
|
773
881
|
);
|
|
774
882
|
}
|
|
775
883
|
break;
|
|
776
884
|
default:
|
|
777
885
|
r.push(
|
|
778
|
-
|
|
779
|
-
e.has(a.componentName.toLowerCase()) ? a.componentName :
|
|
780
|
-
|
|
781
|
-
class: [
|
|
886
|
+
j(
|
|
887
|
+
e.has(a.componentName.toLowerCase()) ? a.componentName : st(a.componentName),
|
|
888
|
+
v(v({
|
|
889
|
+
class: [i.classes, a.extraClasses]
|
|
782
890
|
}, a.componentBindings), a.componentBody ? { innerHTML: a.componentBody } : {})
|
|
783
891
|
)
|
|
784
892
|
);
|
|
@@ -786,45 +894,38 @@ const $t = /* @__PURE__ */ xt({
|
|
|
786
894
|
}
|
|
787
895
|
}), r;
|
|
788
896
|
};
|
|
789
|
-
return (r, a) => (
|
|
897
|
+
return (r, a) => (At(), St(s));
|
|
790
898
|
}
|
|
791
899
|
});
|
|
792
|
-
class
|
|
900
|
+
class C extends V {
|
|
793
901
|
constructor(t, e) {
|
|
794
902
|
super();
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
if (
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
[...a || [], ...o || []].forEach((u) => this.registerAction(u)), Object.assign(this, c), this.value = r != null ? r : this.originalValue;
|
|
903
|
+
o(this, "_fields");
|
|
904
|
+
o(this, "_value", null);
|
|
905
|
+
o(this, "suppressNotifyValueChanged", !1);
|
|
906
|
+
if (!C.isValidFields(t)) throw new Error("Invalid fields object provided");
|
|
907
|
+
if (this._fields = /* @__PURE__ */ Object.create(null), Object.entries(t).forEach(([r, a]) => this.addField(r, a)), e) {
|
|
908
|
+
const s = e, { value: r, validators: a, actions: l } = s, u = F(s, ["value", "validators", "actions"]);
|
|
909
|
+
this.registerInitialActions([...a || [], ...l || []]), Object.assign(this, u), r !== void 0 ? this.assignMembers(r) : this.originalValue !== void 0 && this.assignMembers(this.originalValue);
|
|
803
910
|
}
|
|
804
|
-
this.originalValue === void 0 && (this.originalValue = this.value), this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
911
|
+
this.originalValue === void 0 && (this.originalValue = this.value), this._value = this.value, this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
805
912
|
}
|
|
806
913
|
addField(t, e) {
|
|
807
|
-
if (this.
|
|
914
|
+
if (Object.hasOwn(this._fields, t))
|
|
808
915
|
throw new Error(`Field ${t} is already in this form`);
|
|
809
|
-
Object.defineProperty(e, "parent", { get: () => this, configurable: !1, enumerable: !1 }), Object.defineProperty(e, "fieldName", { get: () => t, configurable: !1, enumerable: !1 }), Object.defineProperty(this._fields, t, {
|
|
810
|
-
get() {
|
|
811
|
-
return e;
|
|
812
|
-
},
|
|
813
|
-
configurable: !1,
|
|
814
|
-
enumerable: !0
|
|
815
|
-
});
|
|
916
|
+
Object.defineProperty(e, "parent", { get: () => this, configurable: !1, enumerable: !1 }), Object.defineProperty(e, "fieldName", { get: () => t, configurable: !1, enumerable: !1 }), Object.defineProperty(this._fields, t, { get: () => e, configurable: !1, enumerable: !0 });
|
|
816
917
|
}
|
|
817
918
|
static isValidFields(t) {
|
|
818
|
-
function e(
|
|
819
|
-
return
|
|
919
|
+
function e(s) {
|
|
920
|
+
return s instanceof V;
|
|
820
921
|
}
|
|
821
|
-
return typeof t == "object" && t !== null && Object.entries(t).every(([,
|
|
922
|
+
return typeof t == "object" && t !== null && Object.entries(t).every(([, s]) => e(s));
|
|
822
923
|
}
|
|
823
924
|
static createFromFormData(t) {
|
|
824
|
-
if (t instanceof
|
|
925
|
+
if (t instanceof V)
|
|
825
926
|
throw new Error("data is already a Form structure, should be a simple object");
|
|
826
|
-
return new
|
|
827
|
-
t == null ? {} : Object.fromEntries(Object.entries(t).map(([e,
|
|
927
|
+
return new C(
|
|
928
|
+
t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, s]) => [e, new $({ value: s })]))
|
|
828
929
|
);
|
|
829
930
|
}
|
|
830
931
|
field(t) {
|
|
@@ -835,22 +936,32 @@ class E extends y {
|
|
|
835
936
|
return this._fields;
|
|
836
937
|
}
|
|
837
938
|
get value() {
|
|
838
|
-
const t =
|
|
839
|
-
return Object.entries(this._fields).forEach(([e,
|
|
840
|
-
const r =
|
|
841
|
-
(
|
|
842
|
-
}),
|
|
939
|
+
const t = /* @__PURE__ */ Object.create(null);
|
|
940
|
+
return Object.entries(this._fields).forEach(([e, s]) => {
|
|
941
|
+
const r = s.value;
|
|
942
|
+
(s.enabled || s instanceof C && !Q(r)) && (t[e] = r);
|
|
943
|
+
}), Q(t) ? null : v({}, t);
|
|
843
944
|
}
|
|
844
|
-
|
|
845
|
-
|
|
945
|
+
/**
|
|
946
|
+
* Writes the members that the given value carries, without letting any single member announce the state in
|
|
947
|
+
* between: the group's own value notification and its own validation are both held back for the duration, so
|
|
948
|
+
* neither a ValueChangedAction nor a ValidChangedAction reports a verdict over a half-applied value. The
|
|
949
|
+
* caller decides what to announce once the whole value is in place. Both flags are restored to what they were,
|
|
950
|
+
* so a caller that is itself holding the group back stays in charge.
|
|
951
|
+
*/
|
|
952
|
+
assignMembers(t) {
|
|
953
|
+
const e = this.suppressNotifyValueChanged, s = this.suppressValidation;
|
|
954
|
+
this.suppressNotifyValueChanged = !0, this.suppressValidation = !0;
|
|
846
955
|
try {
|
|
847
|
-
Object.entries(this._fields).forEach(([
|
|
848
|
-
(t == null ||
|
|
956
|
+
Object.entries(this._fields).forEach(([r, a]) => {
|
|
957
|
+
(t == null || Object.hasOwn(t, r)) && (a.value = t == null ? null : t[r]);
|
|
849
958
|
});
|
|
850
959
|
} finally {
|
|
851
|
-
this.suppressNotifyValueChanged =
|
|
960
|
+
this.suppressNotifyValueChanged = e, this.suppressValidation = s;
|
|
852
961
|
}
|
|
853
|
-
|
|
962
|
+
}
|
|
963
|
+
set value(t) {
|
|
964
|
+
this.assignMembers(t), this.notifyValueChanged(), this.validate();
|
|
854
965
|
}
|
|
855
966
|
get touched() {
|
|
856
967
|
return Object.values(this._fields).some((t) => t.touched);
|
|
@@ -861,67 +972,100 @@ class E extends y {
|
|
|
861
972
|
});
|
|
862
973
|
}
|
|
863
974
|
get fullValue() {
|
|
864
|
-
const t =
|
|
865
|
-
return Object.entries(this._fields).forEach(([e,
|
|
866
|
-
t[e] =
|
|
867
|
-
}), t;
|
|
975
|
+
const t = /* @__PURE__ */ Object.create(null);
|
|
976
|
+
return Object.entries(this._fields).forEach(([e, s]) => {
|
|
977
|
+
t[e] = s.fullValue;
|
|
978
|
+
}), v({}, t);
|
|
868
979
|
}
|
|
869
980
|
notifyValueChanged() {
|
|
870
981
|
if (this.suppressNotifyValueChanged) return;
|
|
871
982
|
const t = this.value;
|
|
872
|
-
if (!
|
|
983
|
+
if (!D(t, this._value)) {
|
|
873
984
|
const e = this._value;
|
|
874
|
-
this._value = t
|
|
985
|
+
this._value = t;
|
|
986
|
+
const s = this.suppressParentValidityClimb;
|
|
987
|
+
this.suppressParentValidityClimb = !0;
|
|
988
|
+
try {
|
|
989
|
+
this.actions.trigger(y, this, t, e), this.parent && this.parent.notifyValueChanged();
|
|
990
|
+
} finally {
|
|
991
|
+
this.suppressParentValidityClimb = s, this.validate(), this.flushParentValidityClimb();
|
|
992
|
+
}
|
|
875
993
|
}
|
|
876
994
|
}
|
|
877
995
|
get valid() {
|
|
878
996
|
return super.valid && Object.values(this._fields).every((t) => t.valid);
|
|
879
997
|
}
|
|
880
998
|
validate(t = !1) {
|
|
881
|
-
|
|
999
|
+
if (t) {
|
|
1000
|
+
const e = this.suppressValidation;
|
|
1001
|
+
this.suppressValidation = !0;
|
|
1002
|
+
try {
|
|
1003
|
+
Object.values(this._fields).forEach((s) => s.validate(!0));
|
|
1004
|
+
} finally {
|
|
1005
|
+
this.suppressValidation = e;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
super.validate(t);
|
|
882
1009
|
}
|
|
883
1010
|
clone(t) {
|
|
884
|
-
var r, a
|
|
885
|
-
const e =
|
|
886
|
-
Object.entries(this._fields).forEach(([
|
|
887
|
-
e[
|
|
1011
|
+
var r, a;
|
|
1012
|
+
const e = /* @__PURE__ */ Object.create(null);
|
|
1013
|
+
Object.entries(this._fields).forEach(([l, u]) => {
|
|
1014
|
+
e[l] = u.clone();
|
|
888
1015
|
});
|
|
889
|
-
const
|
|
890
|
-
value
|
|
1016
|
+
const s = new C(e, w(v({
|
|
1017
|
+
// an override value is one the caller supplied, and undefined is not one; an explicit null is, and clears
|
|
1018
|
+
value: (t == null ? void 0 : t.value) !== void 0 ? t.value : this.value
|
|
891
1019
|
}, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
|
|
892
|
-
enabled: (
|
|
893
|
-
visibility: (
|
|
1020
|
+
enabled: (r = t == null ? void 0 : t.enabled) != null ? r : this.enabled,
|
|
1021
|
+
visibility: (a = t == null ? void 0 : t.visibility) != null ? a : this.visibility
|
|
894
1022
|
}));
|
|
895
|
-
return
|
|
1023
|
+
return s.actions = this.actions.clone(), s.actions.triggerEager(s, s.value, s.originalValue), s;
|
|
896
1024
|
}
|
|
897
1025
|
}
|
|
898
|
-
class Y extends
|
|
1026
|
+
class Y extends V {
|
|
899
1027
|
constructor(t, e) {
|
|
900
1028
|
super();
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
1029
|
+
o(this, "_value", null);
|
|
1030
|
+
o(this, "_itemTemplate");
|
|
1031
|
+
o(this, "_previousValue");
|
|
904
1032
|
if (this._itemTemplate = t, e) {
|
|
905
|
-
const
|
|
906
|
-
[...a || [], ...
|
|
1033
|
+
const s = e, { value: r, validators: a, actions: l } = s, u = F(s, ["value", "validators", "actions"]);
|
|
1034
|
+
this.registerInitialActions([...a || [], ...l || []]), Object.assign(this, u), r != null && this.setValueInternal(r);
|
|
907
1035
|
}
|
|
908
1036
|
this.originalValue === void 0 && (this.originalValue = this.value), this._previousValue = this.value, this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
909
1037
|
}
|
|
910
1038
|
processSetValueItem(t) {
|
|
911
1039
|
let e;
|
|
912
|
-
return t instanceof
|
|
1040
|
+
return t instanceof C ? e = t : this._itemTemplate ? e = this._itemTemplate.clone({ value: t }) : e = C.createFromFormData(t), Object.defineProperty(e, "parent", { get: () => this, configurable: !1, enumerable: !1 }), e;
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Builds the item that fills a gap left by an insert beyond the end of the list: a copy of the item template with
|
|
1044
|
+
* the template's own values, or an empty group when the list has no template.
|
|
1045
|
+
*/
|
|
1046
|
+
createPaddingItem() {
|
|
1047
|
+
return this.processSetValueItem(this._itemTemplate ? this._itemTemplate.clone() : null);
|
|
913
1048
|
}
|
|
914
1049
|
setValueInternal(t) {
|
|
915
|
-
Array.isArray(t) && (this._value = t.map((e) => this.processSetValueItem(e)));
|
|
1050
|
+
t == null ? this._value = null : Array.isArray(t) && (this._value = t.map((e) => this.processSetValueItem(e)));
|
|
916
1051
|
}
|
|
917
1052
|
get value() {
|
|
918
1053
|
var e;
|
|
919
|
-
const t = (e = this._value) == null ? void 0 : e.map((
|
|
920
|
-
return
|
|
1054
|
+
const t = (e = this._value) == null ? void 0 : e.map((s) => s.value);
|
|
1055
|
+
return Q(t) ? null : t;
|
|
921
1056
|
}
|
|
922
1057
|
set value(t) {
|
|
923
|
-
const e = this.
|
|
924
|
-
this.setValueInternal(t)
|
|
1058
|
+
const e = this._previousValue;
|
|
1059
|
+
this.setValueInternal(t);
|
|
1060
|
+
const s = this.value;
|
|
1061
|
+
this._previousValue = s;
|
|
1062
|
+
const r = this.suppressParentValidityClimb;
|
|
1063
|
+
this.suppressParentValidityClimb = !0;
|
|
1064
|
+
try {
|
|
1065
|
+
this.actions.trigger(y, this, s, e), this.parent && this.parent.notifyValueChanged();
|
|
1066
|
+
} finally {
|
|
1067
|
+
this.suppressParentValidityClimb = r, this.validate(), this.flushParentValidityClimb();
|
|
1068
|
+
}
|
|
925
1069
|
}
|
|
926
1070
|
get touched() {
|
|
927
1071
|
var t;
|
|
@@ -929,283 +1073,286 @@ class Y extends y {
|
|
|
929
1073
|
}
|
|
930
1074
|
set touched(t) {
|
|
931
1075
|
var e;
|
|
932
|
-
(e = this._value) == null || e.forEach((
|
|
933
|
-
|
|
1076
|
+
(e = this._value) == null || e.forEach((s) => {
|
|
1077
|
+
s.touched = t;
|
|
934
1078
|
});
|
|
935
1079
|
}
|
|
936
1080
|
clone(t) {
|
|
937
|
-
var
|
|
938
|
-
const e = new Y((
|
|
939
|
-
value
|
|
1081
|
+
var s, r, a, l;
|
|
1082
|
+
const e = new Y((s = this._itemTemplate) == null ? void 0 : s.clone(), w(v({
|
|
1083
|
+
// an override value is one the caller supplied, and undefined is not one; an explicit null is, and clears
|
|
1084
|
+
value: [...(r = (t == null ? void 0 : t.value) !== void 0 ? t.value : this.value) != null ? r : []]
|
|
940
1085
|
}, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
|
|
941
1086
|
enabled: (a = t == null ? void 0 : t.enabled) != null ? a : this.enabled,
|
|
942
|
-
visibility: (
|
|
1087
|
+
visibility: (l = t == null ? void 0 : t.visibility) != null ? l : this.visibility
|
|
943
1088
|
}));
|
|
944
1089
|
return e.actions = this.actions.clone(), e.actions.triggerEager(e, e.value, e.originalValue), e;
|
|
945
1090
|
}
|
|
946
1091
|
notifyValueChanged() {
|
|
947
1092
|
const t = this.value;
|
|
948
|
-
if (!
|
|
1093
|
+
if (!D(t, this._previousValue)) {
|
|
949
1094
|
const e = this._previousValue;
|
|
950
|
-
this._previousValue = t
|
|
1095
|
+
this._previousValue = t;
|
|
1096
|
+
const s = this.suppressParentValidityClimb;
|
|
1097
|
+
this.suppressParentValidityClimb = !0;
|
|
1098
|
+
try {
|
|
1099
|
+
this.actions.trigger(y, this, t, e), this.parent && this.parent.notifyValueChanged();
|
|
1100
|
+
} finally {
|
|
1101
|
+
this.suppressParentValidityClimb = s, this.validate(), this.flushParentValidityClimb();
|
|
1102
|
+
}
|
|
951
1103
|
}
|
|
952
1104
|
}
|
|
953
1105
|
get valid() {
|
|
954
1106
|
var t, e;
|
|
955
|
-
return super.valid && ((e = (t = this._value) == null ? void 0 : t.every((
|
|
1107
|
+
return super.valid && ((e = (t = this._value) == null ? void 0 : t.every((s) => s.valid)) != null ? e : !0);
|
|
956
1108
|
}
|
|
957
1109
|
validate(t = !1) {
|
|
958
1110
|
var e;
|
|
959
|
-
|
|
1111
|
+
if (t) {
|
|
1112
|
+
const s = this.suppressValidation;
|
|
1113
|
+
this.suppressValidation = !0;
|
|
1114
|
+
try {
|
|
1115
|
+
(e = this._value) == null || e.forEach((r) => r.validate(!0));
|
|
1116
|
+
} finally {
|
|
1117
|
+
this.suppressValidation = s;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
super.validate(t);
|
|
960
1121
|
}
|
|
961
1122
|
get(t) {
|
|
962
1123
|
return this._value != null ? this._value[t] : void 0;
|
|
963
1124
|
}
|
|
964
1125
|
push(t) {
|
|
965
|
-
var e,
|
|
966
|
-
return this.insert(t, (
|
|
1126
|
+
var e, s;
|
|
1127
|
+
return this.insert(t, (s = (e = this._value) == null ? void 0 : e.length) != null ? s : 0) + 1;
|
|
967
1128
|
}
|
|
968
1129
|
pop() {
|
|
969
1130
|
var t, e;
|
|
970
1131
|
return this.remove(((e = (t = this._value) == null ? void 0 : t.length) != null ? e : 0) - 1);
|
|
971
1132
|
}
|
|
972
1133
|
remove(t) {
|
|
973
|
-
var
|
|
1134
|
+
var s;
|
|
974
1135
|
if (this._value == null || t < 0 || this._value.length <= t) return;
|
|
975
|
-
let e = (
|
|
976
|
-
return e && (e = e.clone(), this.actions.trigger(
|
|
1136
|
+
let e = (s = this._value.splice(t, 1)) == null ? void 0 : s[0];
|
|
1137
|
+
return e && (e = e.clone(), this.actions.trigger(pt, this, e, t), this.notifyValueChanged()), e;
|
|
977
1138
|
}
|
|
978
1139
|
insert(t, e) {
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
1140
|
+
this._value == null && (this._value = []);
|
|
1141
|
+
const s = e < 0 ? Math.max(this._value.length + e, 0) : e;
|
|
1142
|
+
for (; this._value.length < s; ) {
|
|
1143
|
+
const a = this.createPaddingItem(), l = this._value.push(a) - 1;
|
|
1144
|
+
this.actions.trigger(z, this, a, l);
|
|
982
1145
|
}
|
|
983
|
-
const
|
|
984
|
-
return this._value.splice(
|
|
1146
|
+
const r = this.processSetValueItem(t);
|
|
1147
|
+
return this._value.splice(s, 0, r), this.actions.trigger(z, this, r, s), this.notifyValueChanged(), s;
|
|
985
1148
|
}
|
|
986
1149
|
clear() {
|
|
987
1150
|
this._value = null, this.notifyValueChanged();
|
|
988
1151
|
}
|
|
989
1152
|
}
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
}
|
|
997
|
-
const re = {
|
|
998
|
-
install(i, s) {
|
|
999
|
-
s && Mt(s);
|
|
1000
|
-
}
|
|
1001
|
-
};
|
|
1002
|
-
function m(i) {
|
|
1003
|
-
return qt().useMarkdownInValidators ? new N(i) : i.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, `
|
|
1004
|
-
`);
|
|
1005
|
-
}
|
|
1006
|
-
class Ht extends f {
|
|
1007
|
-
constructor(t, e, n) {
|
|
1008
|
-
let r = !1, a, o;
|
|
1009
|
-
super((u, h, A) => (a = u, o = h, r || (r = !0, this.otherField.registerAction(
|
|
1010
|
-
new v((x, j, P, $) => {
|
|
1011
|
-
j(x, P, $), this.unregistered || this.execute(A, () => null, a, o);
|
|
1153
|
+
class Yt extends f {
|
|
1154
|
+
constructor(t, e, s) {
|
|
1155
|
+
let r = !1, a, l;
|
|
1156
|
+
super((d, x, _) => (a = d, l = x, r || (r = !0, this.otherField.registerAction(
|
|
1157
|
+
new y((P, B, p, E) => {
|
|
1158
|
+
B(P, p, E), this.unregistered || this.execute(_, () => null, a, l);
|
|
1012
1159
|
})
|
|
1013
|
-
)), this.isValidComparison(
|
|
1014
|
-
new
|
|
1015
|
-
this.replacePlaceholders(
|
|
1160
|
+
)), this.isValidComparison(h(d), h(this.otherField.value)) ? null : [
|
|
1161
|
+
new g(
|
|
1162
|
+
this.replacePlaceholders(s, { newValue: d, oldValue: x, field: _, otherField: this.otherField })
|
|
1016
1163
|
)
|
|
1017
1164
|
]));
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1165
|
+
o(this, "otherField");
|
|
1166
|
+
o(this, "isValidComparison");
|
|
1167
|
+
o(this, "unregistered", !1);
|
|
1021
1168
|
this.otherField = t, this.isValidComparison = e;
|
|
1022
1169
|
}
|
|
1023
1170
|
unregister() {
|
|
1024
1171
|
this.unregistered = !0;
|
|
1025
1172
|
}
|
|
1026
1173
|
}
|
|
1027
|
-
class
|
|
1028
|
-
constructor(
|
|
1029
|
-
const e = t ||
|
|
1030
|
-
let
|
|
1031
|
-
|
|
1174
|
+
class Jt extends f {
|
|
1175
|
+
constructor(i, t) {
|
|
1176
|
+
const e = t || b("Must be one of [**{allowedAsText}**]");
|
|
1177
|
+
let s = i.join(", ");
|
|
1178
|
+
s.length > 60 && (s = Ct(s, {
|
|
1032
1179
|
length: 40,
|
|
1033
1180
|
separator: ", ",
|
|
1034
|
-
omission: `... (${
|
|
1181
|
+
omission: `... (${i.length} items total)`
|
|
1035
1182
|
}));
|
|
1036
|
-
const r = (a,
|
|
1037
|
-
new
|
|
1038
|
-
this.replacePlaceholders(e, { newValue: a, oldValue:
|
|
1183
|
+
const r = (a, l, u) => i.includes(h(a)) ? null : [
|
|
1184
|
+
new g(
|
|
1185
|
+
this.replacePlaceholders(e, { newValue: a, oldValue: l, field: u, allowedValues: i, allowedAsText: s })
|
|
1039
1186
|
)
|
|
1040
1187
|
];
|
|
1041
1188
|
super(r);
|
|
1042
1189
|
}
|
|
1043
1190
|
}
|
|
1044
|
-
function
|
|
1045
|
-
return
|
|
1191
|
+
function Kt(n) {
|
|
1192
|
+
return n == null ? 0 : rt(n) || A(n) ? n.length : at(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
|
|
1046
1193
|
}
|
|
1047
|
-
class
|
|
1048
|
-
constructor(
|
|
1049
|
-
const t =
|
|
1194
|
+
class Zt extends f {
|
|
1195
|
+
constructor(i) {
|
|
1196
|
+
const t = i || b("Please enter a value"), e = (s, r, a) => Kt(h(s)) === 0 ? [new g(this.replacePlaceholders(t, { newValue: s, oldValue: r, field: a }))] : null;
|
|
1050
1197
|
super(e);
|
|
1051
1198
|
}
|
|
1052
1199
|
}
|
|
1053
|
-
class
|
|
1054
|
-
constructor(
|
|
1055
|
-
const e = t ||
|
|
1056
|
-
new
|
|
1200
|
+
class te extends f {
|
|
1201
|
+
constructor(i, t) {
|
|
1202
|
+
const e = t || b("Value must be larger or equal to **{minValue}**"), s = (r, a, l) => r < i || r === void 0 ? [
|
|
1203
|
+
new g(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, minValue: i }))
|
|
1057
1204
|
] : null;
|
|
1058
|
-
super(
|
|
1205
|
+
super(s);
|
|
1059
1206
|
}
|
|
1060
1207
|
}
|
|
1061
|
-
class
|
|
1062
|
-
constructor(
|
|
1063
|
-
const e = t ||
|
|
1064
|
-
new
|
|
1208
|
+
class ee extends f {
|
|
1209
|
+
constructor(i, t) {
|
|
1210
|
+
const e = t || b("Value must be less than or equal to **{maxValue}**"), s = (r, a, l) => r > i || r === void 0 ? [
|
|
1211
|
+
new g(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, maxValue: i }))
|
|
1065
1212
|
] : null;
|
|
1066
|
-
super(
|
|
1213
|
+
super(s);
|
|
1067
1214
|
}
|
|
1068
1215
|
}
|
|
1069
|
-
class
|
|
1070
|
-
constructor(
|
|
1071
|
-
const
|
|
1072
|
-
new
|
|
1073
|
-
this.replacePlaceholders(
|
|
1216
|
+
class ie extends f {
|
|
1217
|
+
constructor(i, t, e) {
|
|
1218
|
+
const s = e || b("Value must be between **{minValue}** and **{maxValue}**"), r = (a, l, u) => a < i || a > t || a === void 0 ? [
|
|
1219
|
+
new g(
|
|
1220
|
+
this.replacePlaceholders(s, { newValue: a, oldValue: l, field: u, minValue: i, maxValue: t })
|
|
1074
1221
|
)
|
|
1075
1222
|
] : null;
|
|
1076
1223
|
super(r);
|
|
1077
1224
|
}
|
|
1078
1225
|
}
|
|
1079
|
-
function J(
|
|
1080
|
-
return
|
|
1226
|
+
function J(n) {
|
|
1227
|
+
return n == null ? 0 : rt(n) || A(n) ? n.length : at(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
|
|
1081
1228
|
}
|
|
1082
|
-
class
|
|
1083
|
-
constructor(
|
|
1084
|
-
const e = t ||
|
|
1085
|
-
new
|
|
1229
|
+
class se extends f {
|
|
1230
|
+
constructor(i, t) {
|
|
1231
|
+
const e = t || b("Length must be larger or equal to **{minLength}**"), s = (r, a, l) => J(r) < i ? [
|
|
1232
|
+
new g(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, minLength: i }))
|
|
1086
1233
|
] : null;
|
|
1087
|
-
super(
|
|
1234
|
+
super(s);
|
|
1088
1235
|
}
|
|
1089
1236
|
}
|
|
1090
|
-
class
|
|
1091
|
-
constructor(
|
|
1092
|
-
const e = t ||
|
|
1093
|
-
new
|
|
1237
|
+
class ne extends f {
|
|
1238
|
+
constructor(i, t) {
|
|
1239
|
+
const e = t || b("Length must be less than or equal to **{maxLength}**"), s = (r, a, l) => J(r) > i ? [
|
|
1240
|
+
new g(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, maxLength: i }))
|
|
1094
1241
|
] : null;
|
|
1095
|
-
super(
|
|
1242
|
+
super(s);
|
|
1096
1243
|
}
|
|
1097
1244
|
}
|
|
1098
|
-
class
|
|
1099
|
-
constructor(
|
|
1100
|
-
const
|
|
1101
|
-
const
|
|
1102
|
-
return
|
|
1103
|
-
new
|
|
1104
|
-
this.replacePlaceholders(
|
|
1245
|
+
class re extends f {
|
|
1246
|
+
constructor(i, t, e) {
|
|
1247
|
+
const s = e || b("Length must be between **{minLength}** and **{maxLength}**"), r = (a, l, u) => {
|
|
1248
|
+
const d = J(a);
|
|
1249
|
+
return d < i || d > t ? [
|
|
1250
|
+
new g(
|
|
1251
|
+
this.replacePlaceholders(s, { newValue: a, oldValue: l, field: u, minLength: i, maxLength: t })
|
|
1105
1252
|
)
|
|
1106
1253
|
] : null;
|
|
1107
1254
|
};
|
|
1108
1255
|
super(r);
|
|
1109
1256
|
}
|
|
1110
1257
|
}
|
|
1111
|
-
class
|
|
1112
|
-
constructor(
|
|
1113
|
-
const e = t ||
|
|
1114
|
-
new
|
|
1258
|
+
class ae extends f {
|
|
1259
|
+
constructor(i, t) {
|
|
1260
|
+
const e = t || b('Value must match pattern "**{pattern}**"'), s = (r, a, l) => i.test(String(h(r))) ? null : [
|
|
1261
|
+
new g(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, pattern: i }))
|
|
1115
1262
|
];
|
|
1116
|
-
super(
|
|
1263
|
+
super(s);
|
|
1117
1264
|
}
|
|
1118
1265
|
}
|
|
1119
|
-
const
|
|
1266
|
+
const le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1120
1267
|
__proto__: null,
|
|
1121
|
-
CompareTo:
|
|
1122
|
-
InAllowedValues:
|
|
1123
|
-
LengthInRange:
|
|
1124
|
-
MaxLength:
|
|
1125
|
-
MaxValue:
|
|
1126
|
-
MinLength:
|
|
1127
|
-
MinValue:
|
|
1128
|
-
Pattern:
|
|
1129
|
-
Required:
|
|
1268
|
+
CompareTo: Yt,
|
|
1269
|
+
InAllowedValues: Jt,
|
|
1270
|
+
LengthInRange: re,
|
|
1271
|
+
MaxLength: ne,
|
|
1272
|
+
MaxValue: ee,
|
|
1273
|
+
MinLength: se,
|
|
1274
|
+
MinValue: te,
|
|
1275
|
+
Pattern: ae,
|
|
1276
|
+
Required: Zt,
|
|
1130
1277
|
Validator: f,
|
|
1131
|
-
ValueInRange:
|
|
1132
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1278
|
+
ValueInRange: ie
|
|
1279
|
+
}, Symbol.toStringTag, { value: "Module" })), de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1133
1280
|
__proto__: null,
|
|
1134
|
-
AbortEventHandlingException:
|
|
1135
|
-
Action:
|
|
1136
|
-
ActionsMap:
|
|
1137
|
-
ConditionalEnabledAction:
|
|
1138
|
-
ConditionalStatementAction:
|
|
1139
|
-
ConditionalValueAction:
|
|
1140
|
-
ConditionalVisibilityAction:
|
|
1141
|
-
DisplayMode:
|
|
1142
|
-
EmptyField:
|
|
1143
|
-
EnabledChangedAction:
|
|
1144
|
-
EnabledChangingAction:
|
|
1145
|
-
ExecuteAction:
|
|
1146
|
-
Field:
|
|
1147
|
-
FieldActionBase:
|
|
1148
|
-
FieldBase:
|
|
1149
|
-
Group:
|
|
1281
|
+
AbortEventHandlingException: W,
|
|
1282
|
+
Action: Xt,
|
|
1283
|
+
ActionsMap: L,
|
|
1284
|
+
ConditionalEnabledAction: Rt,
|
|
1285
|
+
ConditionalStatementAction: M,
|
|
1286
|
+
ConditionalValueAction: Bt,
|
|
1287
|
+
ConditionalVisibilityAction: Lt,
|
|
1288
|
+
DisplayMode: S,
|
|
1289
|
+
EmptyField: zt,
|
|
1290
|
+
EnabledChangedAction: ct,
|
|
1291
|
+
EnabledChangingAction: ut,
|
|
1292
|
+
ExecuteAction: ft,
|
|
1293
|
+
Field: $,
|
|
1294
|
+
FieldActionBase: m,
|
|
1295
|
+
FieldBase: V,
|
|
1296
|
+
Group: C,
|
|
1150
1297
|
List: Y,
|
|
1151
1298
|
ListItemAddedAction: z,
|
|
1152
|
-
ListItemRemovedAction:
|
|
1153
|
-
MdString:
|
|
1154
|
-
MessagesWidget:
|
|
1155
|
-
Operator:
|
|
1156
|
-
RenderableValue:
|
|
1157
|
-
Statement:
|
|
1158
|
-
ValidChangedAction:
|
|
1159
|
-
ValidationError:
|
|
1160
|
-
ValidationErrorRenderContent:
|
|
1161
|
-
ValidationErrorText:
|
|
1299
|
+
ListItemRemovedAction: pt,
|
|
1300
|
+
MdString: O,
|
|
1301
|
+
MessagesWidget: Gt,
|
|
1302
|
+
Operator: c,
|
|
1303
|
+
RenderableValue: jt,
|
|
1304
|
+
Statement: N,
|
|
1305
|
+
ValidChangedAction: ht,
|
|
1306
|
+
ValidationError: G,
|
|
1307
|
+
ValidationErrorRenderContent: g,
|
|
1308
|
+
ValidationErrorText: Ft,
|
|
1162
1309
|
Validator: f,
|
|
1163
|
-
Validators:
|
|
1164
|
-
ValueChangedAction:
|
|
1165
|
-
VisibilityChangedAction:
|
|
1166
|
-
VisibilityChangingAction:
|
|
1167
|
-
buildErrorMessage:
|
|
1168
|
-
isCallableFunction:
|
|
1169
|
-
isSimpleComponentDef:
|
|
1310
|
+
Validators: le,
|
|
1311
|
+
ValueChangedAction: y,
|
|
1312
|
+
VisibilityChangedAction: gt,
|
|
1313
|
+
VisibilityChangingAction: dt,
|
|
1314
|
+
buildErrorMessage: b,
|
|
1315
|
+
isCallableFunction: k,
|
|
1316
|
+
isSimpleComponentDef: X
|
|
1170
1317
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1171
1318
|
export {
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1319
|
+
W as AbortEventHandlingException,
|
|
1320
|
+
Xt as Action,
|
|
1321
|
+
L as ActionsMap,
|
|
1322
|
+
Rt as ConditionalEnabledAction,
|
|
1323
|
+
M as ConditionalStatementAction,
|
|
1324
|
+
Bt as ConditionalValueAction,
|
|
1325
|
+
Lt as ConditionalVisibilityAction,
|
|
1326
|
+
S as DisplayMode,
|
|
1327
|
+
zt as EmptyField,
|
|
1328
|
+
ct as EnabledChangedAction,
|
|
1329
|
+
ut as EnabledChangingAction,
|
|
1330
|
+
ft as ExecuteAction,
|
|
1331
|
+
$ as Field,
|
|
1332
|
+
m as FieldActionBase,
|
|
1333
|
+
V as FieldBase,
|
|
1334
|
+
C as Group,
|
|
1188
1335
|
Y as List,
|
|
1189
1336
|
z as ListItemAddedAction,
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1337
|
+
pt as ListItemRemovedAction,
|
|
1338
|
+
O as MdString,
|
|
1339
|
+
Gt as MessagesWidget,
|
|
1340
|
+
c as Operator,
|
|
1341
|
+
jt as RenderableValue,
|
|
1342
|
+
N as Statement,
|
|
1343
|
+
ht as ValidChangedAction,
|
|
1344
|
+
G as ValidationError,
|
|
1345
|
+
g as ValidationErrorRenderContent,
|
|
1346
|
+
Ft as ValidationErrorText,
|
|
1200
1347
|
f as Validator,
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1348
|
+
le as Validators,
|
|
1349
|
+
y as ValueChangedAction,
|
|
1350
|
+
gt as VisibilityChangedAction,
|
|
1351
|
+
dt as VisibilityChangingAction,
|
|
1352
|
+
b as buildErrorMessage,
|
|
1353
|
+
de as default,
|
|
1354
|
+
he as forms,
|
|
1355
|
+
k as isCallableFunction,
|
|
1356
|
+
X as isSimpleComponentDef
|
|
1210
1357
|
};
|
|
1211
1358
|
//# sourceMappingURL=dynamicforms-vue-forms.js.map
|