@dynamicforms/vue-forms 0.6.0 → 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 +786 -635
- 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 +60 -0
- package/dist/index.d.ts +60 -0
- package/package.json +11 -4
- package/readme.md +14 -2
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var q = (
|
|
6
|
-
for (var
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
for (var
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
for (var
|
|
19
|
-
|
|
20
|
-
return
|
|
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
|
+
var t = {};
|
|
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
|
+
return t;
|
|
21
21
|
};
|
|
22
|
-
var o = (
|
|
23
|
-
import { isEqual as
|
|
24
|
-
import { unref as
|
|
25
|
-
var
|
|
26
|
-
const
|
|
27
|
-
((
|
|
28
|
-
function s
|
|
29
|
-
return
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
const r = typeof
|
|
34
|
-
return Object.values(
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function
|
|
38
|
-
const r = typeof
|
|
39
|
-
return Object.values(
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
})(
|
|
43
|
-
Object.freeze(
|
|
44
|
-
const
|
|
45
|
-
class
|
|
46
|
-
constructor(
|
|
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
47
|
o(this, "executorFn");
|
|
48
|
-
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
|
-
|
|
84
|
-
|
|
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) {
|
|
96
|
+
super(t);
|
|
85
97
|
o(this, "plugins");
|
|
86
98
|
o(this, "options");
|
|
87
|
-
this.plugins =
|
|
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,12 +120,12 @@ class X {
|
|
|
108
120
|
return "";
|
|
109
121
|
}
|
|
110
122
|
}
|
|
111
|
-
class
|
|
112
|
-
constructor(
|
|
123
|
+
class Ft extends G {
|
|
124
|
+
constructor(t, e = "") {
|
|
113
125
|
super();
|
|
114
126
|
o(this, "text");
|
|
115
127
|
o(this, "classes");
|
|
116
|
-
this.text =
|
|
128
|
+
this.text = t, this.classes = e;
|
|
117
129
|
}
|
|
118
130
|
get componentName() {
|
|
119
131
|
return "template";
|
|
@@ -125,24 +137,24 @@ class _e extends X {
|
|
|
125
137
|
return this.classes;
|
|
126
138
|
}
|
|
127
139
|
}
|
|
128
|
-
class
|
|
129
|
-
constructor(
|
|
140
|
+
class g extends G {
|
|
141
|
+
constructor(t, e = "") {
|
|
130
142
|
super();
|
|
131
143
|
o(this, "classes");
|
|
132
144
|
o(this, "text");
|
|
133
145
|
o(this, "textType");
|
|
134
|
-
this.classes =
|
|
146
|
+
this.classes = e, this.text = t, this.textType = xt(() => this.getTextType);
|
|
135
147
|
}
|
|
136
148
|
get resolvedText() {
|
|
137
|
-
const
|
|
138
|
-
return
|
|
149
|
+
const t = h(this.text);
|
|
150
|
+
return k(t) ? t() : t;
|
|
139
151
|
}
|
|
140
152
|
get getTextType() {
|
|
141
|
-
const
|
|
142
|
-
return
|
|
153
|
+
const t = this.resolvedText;
|
|
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,12 +166,12 @@ 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": {
|
|
161
|
-
const
|
|
162
|
-
return { source:
|
|
173
|
+
const t = this.resolvedText;
|
|
174
|
+
return { source: t.toString(), options: t.options, plugins: t.plugins };
|
|
163
175
|
}
|
|
164
176
|
case "component":
|
|
165
177
|
return this.resolvedText.componentProps || {};
|
|
@@ -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,158 +193,195 @@ 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
|
-
constructor(
|
|
193
|
-
super((
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
208
|
+
constructor(t) {
|
|
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
|
|
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);
|
|
209
233
|
});
|
|
210
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());
|
|
211
242
|
this.source = Symbol(this.constructor.name);
|
|
212
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
|
+
}
|
|
213
260
|
static get classIdentifier() {
|
|
214
|
-
return
|
|
261
|
+
return Nt;
|
|
215
262
|
}
|
|
216
263
|
get eager() {
|
|
217
264
|
return !0;
|
|
218
265
|
}
|
|
219
|
-
replacePlaceholdersFunction(
|
|
266
|
+
replacePlaceholdersFunction(t, e) {
|
|
220
267
|
return () => {
|
|
221
|
-
let
|
|
222
|
-
for (;
|
|
223
|
-
|
|
224
|
-
return
|
|
268
|
+
let s = h(t);
|
|
269
|
+
for (; k(s); )
|
|
270
|
+
s = h(this.replacePlaceholders(s(), e));
|
|
271
|
+
return s;
|
|
225
272
|
};
|
|
226
273
|
}
|
|
227
|
-
replacePlaceholders(
|
|
228
|
-
if (
|
|
229
|
-
if (
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
274
|
+
replacePlaceholders(t, e) {
|
|
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);
|
|
280
|
+
return Object.keys(e).forEach((r) => {
|
|
281
|
+
s = s.replaceAll(`{${r}}`, e[r]);
|
|
282
|
+
}), t instanceof O ? new O(s.toString(), t.options, t.plugins) : s;
|
|
234
283
|
}
|
|
235
284
|
}
|
|
236
|
-
class
|
|
285
|
+
class L extends Map {
|
|
237
286
|
constructor() {
|
|
238
287
|
super(...arguments);
|
|
239
288
|
o(this, "eagerActions", /* @__PURE__ */ new Set());
|
|
240
289
|
o(this, "registeredActions", []);
|
|
241
290
|
}
|
|
242
|
-
register(
|
|
243
|
-
if (!(
|
|
244
|
-
this.registeredActions.push(
|
|
245
|
-
const
|
|
291
|
+
register(t) {
|
|
292
|
+
if (!(t instanceof m)) throw new Error("Invalid action type");
|
|
293
|
+
this.registeredActions.push(t);
|
|
294
|
+
const e = t.classIdentifier, s = this.get(e) || (() => null);
|
|
246
295
|
function r(a, ...l) {
|
|
247
|
-
return
|
|
296
|
+
return t.execute(a, s, ...l);
|
|
248
297
|
}
|
|
249
|
-
this.set(
|
|
298
|
+
this.set(e, r), t.eager && this.eagerActions.add(t.classIdentifier);
|
|
250
299
|
}
|
|
251
|
-
trigger(
|
|
252
|
-
const r =
|
|
253
|
-
r ===
|
|
300
|
+
trigger(t, e, ...s) {
|
|
301
|
+
const r = t.classIdentifier;
|
|
302
|
+
r === lt && this.triggerEager(e, ...s);
|
|
254
303
|
const a = this.get(r);
|
|
255
304
|
try {
|
|
256
|
-
if (a) return a(
|
|
305
|
+
if (a) return a(e, ...s);
|
|
257
306
|
} catch (l) {
|
|
258
|
-
if (!(l instanceof
|
|
307
|
+
if (!(l instanceof W)) throw l;
|
|
259
308
|
}
|
|
260
309
|
return null;
|
|
261
310
|
}
|
|
262
|
-
triggerEager(
|
|
263
|
-
for (const
|
|
264
|
-
const r = this.get(
|
|
311
|
+
triggerEager(t, ...e) {
|
|
312
|
+
for (const s of this.eagerActions) {
|
|
313
|
+
const r = this.get(s);
|
|
265
314
|
try {
|
|
266
|
-
r && r(
|
|
315
|
+
r && r(t, ...e);
|
|
267
316
|
} catch (a) {
|
|
268
|
-
if (!(a instanceof
|
|
317
|
+
if (!(a instanceof W)) throw a;
|
|
269
318
|
}
|
|
270
319
|
}
|
|
271
320
|
}
|
|
272
321
|
clone() {
|
|
273
|
-
const
|
|
274
|
-
return this.registeredActions.forEach((
|
|
322
|
+
const t = new L();
|
|
323
|
+
return this.registeredActions.forEach((e) => t.register(e)), t;
|
|
275
324
|
}
|
|
276
325
|
cloneWithoutValidators() {
|
|
277
|
-
const
|
|
278
|
-
return this.registeredActions.forEach((
|
|
279
|
-
|
|
280
|
-
}),
|
|
326
|
+
const t = new L();
|
|
327
|
+
return this.registeredActions.forEach((e) => {
|
|
328
|
+
e instanceof f ? e.unregister() : t.register(e);
|
|
329
|
+
}), t;
|
|
281
330
|
}
|
|
282
331
|
}
|
|
283
|
-
const
|
|
284
|
-
class
|
|
285
|
-
constructor(
|
|
286
|
-
const
|
|
287
|
-
const
|
|
288
|
-
if (
|
|
289
|
-
for (const
|
|
290
|
-
|
|
291
|
-
this.lastResult =
|
|
332
|
+
const Ot = /* @__PURE__ */ Symbol("ConditionalStatementAction");
|
|
333
|
+
class M extends y {
|
|
334
|
+
constructor(t, e) {
|
|
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;
|
|
292
341
|
}
|
|
293
|
-
return a(r, l,
|
|
342
|
+
return a(r, l, u);
|
|
294
343
|
};
|
|
295
|
-
super(
|
|
344
|
+
super(s);
|
|
296
345
|
o(this, "lastResult");
|
|
297
346
|
// boundField tracks the fields this action is bound to. so that it may perform the executorFn on them and not on the
|
|
298
347
|
// ValueChangedAction fields that will call the actionExecutor
|
|
299
348
|
o(this, "boundFields", /* @__PURE__ */ new Set());
|
|
300
|
-
|
|
349
|
+
t.collectFields().forEach((r) => r.registerAction(new y(s)));
|
|
301
350
|
}
|
|
302
351
|
static get classIdentifier() {
|
|
303
|
-
return
|
|
352
|
+
return Ot;
|
|
304
353
|
}
|
|
305
354
|
get eager() {
|
|
306
355
|
return !0;
|
|
307
356
|
}
|
|
308
|
-
boundToField(
|
|
309
|
-
this.boundFields.add(
|
|
357
|
+
boundToField(t) {
|
|
358
|
+
this.boundFields.add(t);
|
|
310
359
|
}
|
|
311
360
|
}
|
|
312
|
-
class
|
|
313
|
-
constructor(
|
|
314
|
-
super(
|
|
315
|
-
|
|
361
|
+
class Lt extends M {
|
|
362
|
+
constructor(i) {
|
|
363
|
+
super(i, (t, e) => {
|
|
364
|
+
t.visibility = e ? S.FULL : S.SUPPRESS;
|
|
316
365
|
});
|
|
317
366
|
}
|
|
318
367
|
}
|
|
319
|
-
class
|
|
320
|
-
constructor(
|
|
321
|
-
super(
|
|
322
|
-
|
|
368
|
+
class Rt extends M {
|
|
369
|
+
constructor(i) {
|
|
370
|
+
super(i, (t, e) => {
|
|
371
|
+
t.enabled = e;
|
|
323
372
|
});
|
|
324
373
|
}
|
|
325
374
|
}
|
|
326
|
-
class
|
|
327
|
-
constructor(
|
|
328
|
-
super(
|
|
329
|
-
|
|
375
|
+
class Bt extends M {
|
|
376
|
+
constructor(i, t) {
|
|
377
|
+
super(i, (e, s) => {
|
|
378
|
+
s && (e.value = t);
|
|
330
379
|
});
|
|
331
380
|
}
|
|
332
381
|
}
|
|
333
|
-
var
|
|
334
|
-
((
|
|
335
|
-
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) {
|
|
336
385
|
const a = r.toLowerCase();
|
|
337
386
|
if (a === "not") return 0;
|
|
338
387
|
if (a === "or") return 1;
|
|
@@ -352,85 +401,85 @@ var T = /* @__PURE__ */ ((i) => (i[i.NOT = 0] = "NOT", i[i.OR = 1] = "OR", i[i.A
|
|
|
352
401
|
if (["not_includes", "not-includes", "not includes"].includes(a)) return -10;
|
|
353
402
|
throw new Error(`Unrecognised operator ${a}`);
|
|
354
403
|
}
|
|
355
|
-
|
|
356
|
-
function
|
|
357
|
-
const a = typeof r == "number" ? r :
|
|
358
|
-
if (Object.values(
|
|
404
|
+
n.fromString = i;
|
|
405
|
+
function t(r) {
|
|
406
|
+
const a = typeof r == "number" ? r : n.fromString(r);
|
|
407
|
+
if (Object.values(n).includes(a)) return a;
|
|
359
408
|
throw new Error(`Unrecognised operator ${r}`);
|
|
360
409
|
}
|
|
361
|
-
|
|
362
|
-
function
|
|
363
|
-
const a = typeof r == "number" ? r :
|
|
364
|
-
return Object.values(
|
|
410
|
+
n.fromAny = t;
|
|
411
|
+
function e(r) {
|
|
412
|
+
const a = typeof r == "number" ? r : n.fromString(r);
|
|
413
|
+
return Object.values(n).includes(a);
|
|
365
414
|
}
|
|
366
|
-
|
|
367
|
-
function
|
|
415
|
+
n.isDefined = e;
|
|
416
|
+
function s(r) {
|
|
368
417
|
return r >= 0;
|
|
369
418
|
}
|
|
370
|
-
|
|
371
|
-
})(
|
|
372
|
-
Object.freeze(
|
|
373
|
-
const
|
|
374
|
-
class
|
|
375
|
-
constructor(
|
|
376
|
-
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);
|
|
377
426
|
}
|
|
378
427
|
static get classIdentifier() {
|
|
379
|
-
return
|
|
428
|
+
return Ut;
|
|
380
429
|
}
|
|
381
|
-
execute(
|
|
382
|
-
return super.execute(
|
|
430
|
+
execute(i, t, e, s) {
|
|
431
|
+
return super.execute(i, t, e, s);
|
|
383
432
|
}
|
|
384
433
|
}
|
|
385
|
-
const
|
|
386
|
-
class
|
|
387
|
-
constructor(
|
|
388
|
-
super(
|
|
434
|
+
const kt = /* @__PURE__ */ Symbol("EnabledChangedAction");
|
|
435
|
+
class ct extends m {
|
|
436
|
+
constructor(i) {
|
|
437
|
+
super(i);
|
|
389
438
|
}
|
|
390
439
|
static get classIdentifier() {
|
|
391
|
-
return
|
|
440
|
+
return kt;
|
|
392
441
|
}
|
|
393
|
-
execute(
|
|
394
|
-
return super.execute(
|
|
442
|
+
execute(i, t, e, s) {
|
|
443
|
+
return super.execute(i, t, e, s);
|
|
395
444
|
}
|
|
396
445
|
}
|
|
397
|
-
const
|
|
398
|
-
class
|
|
399
|
-
constructor(
|
|
400
|
-
super(
|
|
446
|
+
const Dt = /* @__PURE__ */ Symbol("ValidChangedAction");
|
|
447
|
+
class ht extends m {
|
|
448
|
+
constructor(i) {
|
|
449
|
+
super(i);
|
|
401
450
|
}
|
|
402
451
|
static get classIdentifier() {
|
|
403
|
-
return
|
|
452
|
+
return Dt;
|
|
404
453
|
}
|
|
405
|
-
execute(
|
|
406
|
-
return super.execute(
|
|
454
|
+
execute(i, t, e, s) {
|
|
455
|
+
return super.execute(i, t, e, s);
|
|
407
456
|
}
|
|
408
457
|
}
|
|
409
|
-
const
|
|
410
|
-
class
|
|
411
|
-
constructor(
|
|
412
|
-
super(
|
|
458
|
+
const Mt = /* @__PURE__ */ Symbol("VisibilityChangingAction");
|
|
459
|
+
class dt extends m {
|
|
460
|
+
constructor(i) {
|
|
461
|
+
super(i);
|
|
413
462
|
}
|
|
414
463
|
static get classIdentifier() {
|
|
415
|
-
return
|
|
464
|
+
return Mt;
|
|
416
465
|
}
|
|
417
|
-
execute(
|
|
418
|
-
return super.execute(
|
|
466
|
+
execute(i, t, e, s) {
|
|
467
|
+
return super.execute(i, t, e, s);
|
|
419
468
|
}
|
|
420
469
|
}
|
|
421
|
-
const
|
|
422
|
-
class
|
|
423
|
-
constructor(
|
|
424
|
-
super(
|
|
470
|
+
const $t = /* @__PURE__ */ Symbol("VisibilityChangedAction");
|
|
471
|
+
class gt extends m {
|
|
472
|
+
constructor(i) {
|
|
473
|
+
super(i);
|
|
425
474
|
}
|
|
426
475
|
static get classIdentifier() {
|
|
427
|
-
return
|
|
476
|
+
return $t;
|
|
428
477
|
}
|
|
429
|
-
execute(
|
|
430
|
-
return super.execute(
|
|
478
|
+
execute(i, t, e, s) {
|
|
479
|
+
return super.execute(i, t, e, s);
|
|
431
480
|
}
|
|
432
481
|
}
|
|
433
|
-
class
|
|
482
|
+
class V {
|
|
434
483
|
/**
|
|
435
484
|
* A field is a Vue reactive proxy from construction onwards: the base constructor returns the proxy, and a
|
|
436
485
|
* derived class's `this` is whatever super() returned, so every subclass constructor, field initializer and
|
|
@@ -443,11 +492,29 @@ class x {
|
|
|
443
492
|
// is current value valid as per FE and BE validators?
|
|
444
493
|
o(this, "errors", []);
|
|
445
494
|
// when member of a Group, fieldName specifies the name of this field
|
|
446
|
-
o(this, "actions", new
|
|
495
|
+
o(this, "actions", new L());
|
|
447
496
|
// default property handlers
|
|
448
|
-
o(this, "_visibility",
|
|
497
|
+
o(this, "_visibility", S.FULL);
|
|
449
498
|
o(this, "_enabled", !0);
|
|
450
|
-
|
|
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);
|
|
451
518
|
}
|
|
452
519
|
/** true while at least one asynchronous validator is still running for this field */
|
|
453
520
|
get validating() {
|
|
@@ -464,23 +531,30 @@ class x {
|
|
|
464
531
|
get visibility() {
|
|
465
532
|
return this._visibility;
|
|
466
533
|
}
|
|
467
|
-
set visibility(
|
|
468
|
-
const
|
|
469
|
-
if (!
|
|
470
|
-
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);
|
|
471
538
|
}
|
|
472
539
|
get enabled() {
|
|
473
540
|
return this._enabled;
|
|
474
541
|
}
|
|
475
|
-
set enabled(
|
|
476
|
-
const
|
|
477
|
-
if (!
|
|
478
|
-
this._enabled =
|
|
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);
|
|
546
|
+
}
|
|
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());
|
|
479
551
|
}
|
|
480
|
-
validate(
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
552
|
+
validate(i = !1) {
|
|
553
|
+
var e;
|
|
554
|
+
if (this.suppressValidation) return;
|
|
555
|
+
i && this.actions.triggerEager(this, this.value, this.value);
|
|
556
|
+
const t = this._valid;
|
|
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());
|
|
484
558
|
}
|
|
485
559
|
get valid() {
|
|
486
560
|
return this.errors.length === 0;
|
|
@@ -489,72 +563,94 @@ class x {
|
|
|
489
563
|
return this.value;
|
|
490
564
|
}
|
|
491
565
|
get isChanged() {
|
|
492
|
-
return !
|
|
566
|
+
return !D(this.value, this.originalValue);
|
|
493
567
|
}
|
|
494
|
-
|
|
495
|
-
|
|
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
|
+
});
|
|
496
577
|
}
|
|
497
|
-
|
|
498
|
-
return this.actions.trigger(
|
|
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;
|
|
580
|
+
}
|
|
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;
|
|
499
591
|
}
|
|
500
592
|
clearValidators() {
|
|
501
|
-
this.actions = this.actions.cloneWithoutValidators(), this.errors = [], this.
|
|
593
|
+
this._validationEpoch++, this.actions = this.actions.cloneWithoutValidators(), this.errors = [], this.validate();
|
|
502
594
|
}
|
|
503
595
|
}
|
|
504
|
-
function
|
|
505
|
-
return
|
|
596
|
+
function qt(n, i) {
|
|
597
|
+
return n ? !i : i;
|
|
506
598
|
}
|
|
507
|
-
class
|
|
508
|
-
constructor(
|
|
599
|
+
class N {
|
|
600
|
+
constructor(i, t, e) {
|
|
509
601
|
o(this, "operand1");
|
|
510
602
|
o(this, "operator");
|
|
511
603
|
o(this, "operand2");
|
|
512
|
-
this.operand1 =
|
|
604
|
+
this.operand1 = i, this.operator = t, this.operand2 = e;
|
|
513
605
|
}
|
|
514
606
|
get operand1Value() {
|
|
515
|
-
return this.operand1 instanceof
|
|
607
|
+
return this.operand1 instanceof N ? this.operand1.evaluate() : this.operand1 instanceof V ? h(this.operand1.value) : this.operand1;
|
|
516
608
|
}
|
|
517
609
|
get operand2Value() {
|
|
518
|
-
return this.operand2 instanceof
|
|
610
|
+
return this.operand2 instanceof N ? this.operand2.evaluate() : this.operand2 instanceof V ? h(this.operand2.value) : this.operand2;
|
|
519
611
|
}
|
|
520
612
|
evaluate() {
|
|
521
|
-
var
|
|
522
|
-
const
|
|
613
|
+
var e, s;
|
|
614
|
+
const i = this.operand1Value, t = this.operand2Value;
|
|
523
615
|
switch (this.operator) {
|
|
524
616
|
// logical operators
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
case
|
|
530
|
-
return
|
|
531
|
-
case
|
|
532
|
-
return
|
|
533
|
-
case
|
|
534
|
-
return
|
|
535
|
-
case
|
|
536
|
-
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;
|
|
537
633
|
// comparison operators
|
|
538
|
-
case
|
|
539
|
-
return
|
|
540
|
-
case
|
|
541
|
-
return
|
|
542
|
-
case
|
|
543
|
-
return
|
|
544
|
-
case
|
|
545
|
-
return
|
|
546
|
-
case
|
|
547
|
-
return
|
|
548
|
-
case
|
|
549
|
-
return
|
|
550
|
-
case
|
|
551
|
-
return (
|
|
552
|
-
case
|
|
553
|
-
return !((
|
|
554
|
-
case
|
|
555
|
-
return
|
|
556
|
-
case
|
|
557
|
-
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);
|
|
558
654
|
default:
|
|
559
655
|
throw new Error(`Operator not implemented ${this.operator}`);
|
|
560
656
|
}
|
|
@@ -564,55 +660,55 @@ class w {
|
|
|
564
660
|
* @returns A set of all fields used in this statement
|
|
565
661
|
*/
|
|
566
662
|
collectFields() {
|
|
567
|
-
const
|
|
568
|
-
function e
|
|
569
|
-
|
|
663
|
+
const i = /* @__PURE__ */ new Set();
|
|
664
|
+
function t(e) {
|
|
665
|
+
e instanceof V ? i.add(e) : e instanceof N && e.collectFields().forEach((r) => i.add(r));
|
|
570
666
|
}
|
|
571
|
-
return
|
|
667
|
+
return t(this.operand1), t(this.operand2), i;
|
|
572
668
|
}
|
|
573
669
|
}
|
|
574
|
-
const
|
|
575
|
-
class
|
|
576
|
-
constructor(
|
|
577
|
-
super(
|
|
670
|
+
const Ht = /* @__PURE__ */ Symbol("ExecuteAction");
|
|
671
|
+
class ft extends m {
|
|
672
|
+
constructor(i) {
|
|
673
|
+
super(i);
|
|
578
674
|
}
|
|
579
675
|
static get classIdentifier() {
|
|
580
|
-
return
|
|
676
|
+
return Ht;
|
|
581
677
|
}
|
|
582
|
-
execute(
|
|
583
|
-
return super.execute(
|
|
678
|
+
execute(i, t, e) {
|
|
679
|
+
return super.execute(i, t, e);
|
|
584
680
|
}
|
|
585
681
|
}
|
|
586
|
-
const
|
|
587
|
-
class z extends
|
|
588
|
-
constructor(
|
|
589
|
-
super(
|
|
682
|
+
const Qt = /* @__PURE__ */ Symbol("ListItemAddedAction");
|
|
683
|
+
class z extends m {
|
|
684
|
+
constructor(i) {
|
|
685
|
+
super(i);
|
|
590
686
|
}
|
|
591
687
|
static get classIdentifier() {
|
|
592
|
-
return
|
|
688
|
+
return Qt;
|
|
593
689
|
}
|
|
594
|
-
execute(
|
|
595
|
-
return super.execute(
|
|
690
|
+
execute(i, t, e, s) {
|
|
691
|
+
return super.execute(i, t, e, s);
|
|
596
692
|
}
|
|
597
693
|
}
|
|
598
|
-
const
|
|
599
|
-
class
|
|
600
|
-
constructor(
|
|
601
|
-
super(
|
|
694
|
+
const Wt = /* @__PURE__ */ Symbol("ListItemRemovedAction");
|
|
695
|
+
class pt extends m {
|
|
696
|
+
constructor(i) {
|
|
697
|
+
super(i);
|
|
602
698
|
}
|
|
603
699
|
static get classIdentifier() {
|
|
604
|
-
return
|
|
700
|
+
return Wt;
|
|
605
701
|
}
|
|
606
|
-
execute(
|
|
607
|
-
return super.execute(
|
|
702
|
+
execute(i, t, e, s) {
|
|
703
|
+
return super.execute(i, t, e, s);
|
|
608
704
|
}
|
|
609
705
|
}
|
|
610
|
-
class
|
|
611
|
-
constructor(
|
|
706
|
+
class $ extends V {
|
|
707
|
+
constructor(t) {
|
|
612
708
|
super();
|
|
613
709
|
o(this, "_value");
|
|
614
710
|
o(this, "_touched", !1);
|
|
615
|
-
this.init(
|
|
711
|
+
this.init(t);
|
|
616
712
|
}
|
|
617
713
|
/**
|
|
618
714
|
* Applies the constructor parameters. It is a hook so that a subclass needing different parameter handling
|
|
@@ -623,79 +719,88 @@ class D extends x {
|
|
|
623
719
|
* subclass initializes read as undefined inside it, and anything it writes to such a member is overwritten
|
|
624
720
|
* the moment the initializer runs.
|
|
625
721
|
*/
|
|
626
|
-
init(
|
|
627
|
-
if (
|
|
628
|
-
const
|
|
629
|
-
[...r || [], ...a || []]
|
|
722
|
+
init(t) {
|
|
723
|
+
if (t) {
|
|
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);
|
|
630
726
|
}
|
|
631
727
|
this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
632
728
|
}
|
|
633
729
|
get value() {
|
|
634
730
|
return this._value;
|
|
635
731
|
}
|
|
636
|
-
set value(
|
|
637
|
-
const
|
|
638
|
-
!this.enabled ||
|
|
732
|
+
set value(t) {
|
|
733
|
+
const e = this._value;
|
|
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
|
+
}
|
|
639
743
|
}
|
|
640
744
|
get touched() {
|
|
641
745
|
return this._touched;
|
|
642
746
|
}
|
|
643
|
-
set touched(
|
|
644
|
-
this._touched =
|
|
645
|
-
}
|
|
646
|
-
clone(
|
|
647
|
-
var r, a
|
|
648
|
-
const
|
|
649
|
-
value
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
747
|
+
set touched(t) {
|
|
748
|
+
this._touched = t;
|
|
749
|
+
}
|
|
750
|
+
clone(t) {
|
|
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
|
|
755
|
+
}, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
|
|
756
|
+
enabled: (r = t == null ? void 0 : t.enabled) != null ? r : this.enabled,
|
|
757
|
+
visibility: (a = t == null ? void 0 : t.visibility) != null ? a : this.visibility
|
|
653
758
|
}));
|
|
654
|
-
return
|
|
759
|
+
return s.actions = this.actions.clone(), s.actions.triggerEager(s, s.value, s.originalValue), s;
|
|
655
760
|
}
|
|
656
761
|
}
|
|
657
|
-
const
|
|
658
|
-
new
|
|
762
|
+
const zt = new $({ value: "EmptyField" }).registerAction(
|
|
763
|
+
new y(() => {
|
|
659
764
|
console.warn("Working with EmptyField! This should not happen");
|
|
660
765
|
})
|
|
661
766
|
);
|
|
662
|
-
function
|
|
663
|
-
return (
|
|
767
|
+
function H(n, i) {
|
|
768
|
+
return (n == null ? void 0 : n.label) == null && (n == null ? void 0 : n.icon) == null ? i : n;
|
|
664
769
|
}
|
|
665
|
-
class
|
|
666
|
-
init(
|
|
667
|
-
if (this._value = { label: void 0, icon: void 0 },
|
|
668
|
-
const
|
|
669
|
-
[...r || [], ...a || []]
|
|
670
|
-
const
|
|
671
|
-
this._value =
|
|
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);
|
|
672
777
|
}
|
|
673
778
|
this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
674
779
|
}
|
|
675
780
|
get icon() {
|
|
676
781
|
return this.value.icon;
|
|
677
782
|
}
|
|
678
|
-
set icon(
|
|
679
|
-
this.value.icon =
|
|
783
|
+
set icon(i) {
|
|
784
|
+
this.value.icon = i;
|
|
680
785
|
}
|
|
681
786
|
get label() {
|
|
682
787
|
return this.value.label;
|
|
683
788
|
}
|
|
684
|
-
set label(
|
|
685
|
-
this.value.label =
|
|
789
|
+
set label(i) {
|
|
790
|
+
this.value.label = i;
|
|
686
791
|
}
|
|
687
|
-
execute(
|
|
688
|
-
this.actions.trigger(
|
|
792
|
+
execute(i) {
|
|
793
|
+
this.actions.trigger(ft, this, i);
|
|
689
794
|
}
|
|
690
795
|
}
|
|
691
|
-
const
|
|
796
|
+
const Gt = /* @__PURE__ */ It({
|
|
692
797
|
__name: "messages-widget",
|
|
693
798
|
props: {
|
|
694
799
|
message: {},
|
|
695
800
|
classes: {}
|
|
696
801
|
},
|
|
697
|
-
setup(
|
|
698
|
-
const
|
|
802
|
+
setup(n) {
|
|
803
|
+
const i = n, t = st("vue-markdown"), e = /* @__PURE__ */ new Set([
|
|
699
804
|
"div",
|
|
700
805
|
"span",
|
|
701
806
|
"p",
|
|
@@ -751,24 +856,24 @@ const De = /* @__PURE__ */ ye({
|
|
|
751
856
|
"dl",
|
|
752
857
|
"dt",
|
|
753
858
|
"dd"
|
|
754
|
-
]),
|
|
755
|
-
if (typeof
|
|
859
|
+
]), s = () => {
|
|
860
|
+
if (typeof i.message == "string") return j("span", { class: i.classes }, i.message);
|
|
756
861
|
const r = [];
|
|
757
|
-
return
|
|
862
|
+
return i.message.forEach((a) => {
|
|
758
863
|
switch (a.componentName) {
|
|
759
864
|
case "template":
|
|
760
|
-
r.push(
|
|
865
|
+
r.push(j("div", { class: [i.classes, a.extraClasses] }, a.componentBody));
|
|
761
866
|
break;
|
|
762
867
|
case "vue-markdown":
|
|
763
|
-
if (typeof
|
|
868
|
+
if (typeof t == "string")
|
|
764
869
|
console.warn(
|
|
765
870
|
"You are using markdown for messages-widget, but you haven't registered a vue-markdown component"
|
|
766
|
-
), r.push(
|
|
871
|
+
), r.push(j("div", { class: [i.classes, a.extraClasses] }, a.componentBindings.source));
|
|
767
872
|
else {
|
|
768
873
|
const l = a.componentBindings;
|
|
769
874
|
r.push(
|
|
770
|
-
|
|
771
|
-
class: [
|
|
875
|
+
j(t, {
|
|
876
|
+
class: [i.classes, a.extraClasses, "df-messages-widget-markdown"],
|
|
772
877
|
source: l.source,
|
|
773
878
|
options: l.options,
|
|
774
879
|
plugins: l.plugins
|
|
@@ -778,10 +883,10 @@ const De = /* @__PURE__ */ ye({
|
|
|
778
883
|
break;
|
|
779
884
|
default:
|
|
780
885
|
r.push(
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
class: [
|
|
886
|
+
j(
|
|
887
|
+
e.has(a.componentName.toLowerCase()) ? a.componentName : st(a.componentName),
|
|
888
|
+
v(v({
|
|
889
|
+
class: [i.classes, a.extraClasses]
|
|
785
890
|
}, a.componentBindings), a.componentBody ? { innerHTML: a.componentBody } : {})
|
|
786
891
|
)
|
|
787
892
|
);
|
|
@@ -789,419 +894,465 @@ const De = /* @__PURE__ */ ye({
|
|
|
789
894
|
}
|
|
790
895
|
}), r;
|
|
791
896
|
};
|
|
792
|
-
return (r, a) => (
|
|
897
|
+
return (r, a) => (At(), St(s));
|
|
793
898
|
}
|
|
794
899
|
});
|
|
795
|
-
class
|
|
796
|
-
constructor(
|
|
900
|
+
class C extends V {
|
|
901
|
+
constructor(t, e) {
|
|
797
902
|
super();
|
|
798
903
|
o(this, "_fields");
|
|
799
904
|
o(this, "_value", null);
|
|
800
905
|
o(this, "suppressNotifyValueChanged", !1);
|
|
801
|
-
if (!
|
|
802
|
-
if (this._fields = /* @__PURE__ */ Object.create(null), Object.entries(
|
|
803
|
-
const
|
|
804
|
-
[...a || [], ...l || []]
|
|
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);
|
|
805
910
|
}
|
|
806
|
-
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();
|
|
807
912
|
}
|
|
808
|
-
addField(
|
|
809
|
-
if (Object.hasOwn(this._fields,
|
|
810
|
-
throw new Error(`Field ${
|
|
811
|
-
Object.defineProperty(
|
|
913
|
+
addField(t, e) {
|
|
914
|
+
if (Object.hasOwn(this._fields, t))
|
|
915
|
+
throw new Error(`Field ${t} is already in this form`);
|
|
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 });
|
|
812
917
|
}
|
|
813
|
-
static isValidFields(
|
|
814
|
-
function
|
|
815
|
-
return
|
|
918
|
+
static isValidFields(t) {
|
|
919
|
+
function e(s) {
|
|
920
|
+
return s instanceof V;
|
|
816
921
|
}
|
|
817
|
-
return typeof
|
|
922
|
+
return typeof t == "object" && t !== null && Object.entries(t).every(([, s]) => e(s));
|
|
818
923
|
}
|
|
819
|
-
static createFromFormData(
|
|
820
|
-
if (
|
|
924
|
+
static createFromFormData(t) {
|
|
925
|
+
if (t instanceof V)
|
|
821
926
|
throw new Error("data is already a Form structure, should be a simple object");
|
|
822
|
-
return new
|
|
823
|
-
|
|
927
|
+
return new C(
|
|
928
|
+
t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, s]) => [e, new $({ value: s })]))
|
|
824
929
|
);
|
|
825
930
|
}
|
|
826
|
-
field(
|
|
827
|
-
var
|
|
828
|
-
return (
|
|
931
|
+
field(t) {
|
|
932
|
+
var e;
|
|
933
|
+
return (e = this._fields[t]) != null ? e : null;
|
|
829
934
|
}
|
|
830
935
|
get fields() {
|
|
831
936
|
return this._fields;
|
|
832
937
|
}
|
|
833
938
|
get value() {
|
|
834
|
-
const
|
|
835
|
-
return Object.entries(this._fields).forEach(([
|
|
836
|
-
const r =
|
|
837
|
-
(
|
|
838
|
-
}),
|
|
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);
|
|
839
944
|
}
|
|
840
|
-
|
|
841
|
-
|
|
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;
|
|
842
955
|
try {
|
|
843
|
-
Object.entries(this._fields).forEach(([
|
|
844
|
-
(
|
|
956
|
+
Object.entries(this._fields).forEach(([r, a]) => {
|
|
957
|
+
(t == null || Object.hasOwn(t, r)) && (a.value = t == null ? null : t[r]);
|
|
845
958
|
});
|
|
846
959
|
} finally {
|
|
847
|
-
this.suppressNotifyValueChanged =
|
|
960
|
+
this.suppressNotifyValueChanged = e, this.suppressValidation = s;
|
|
848
961
|
}
|
|
849
|
-
|
|
962
|
+
}
|
|
963
|
+
set value(t) {
|
|
964
|
+
this.assignMembers(t), this.notifyValueChanged(), this.validate();
|
|
850
965
|
}
|
|
851
966
|
get touched() {
|
|
852
|
-
return Object.values(this._fields).some((
|
|
967
|
+
return Object.values(this._fields).some((t) => t.touched);
|
|
853
968
|
}
|
|
854
|
-
set touched(
|
|
855
|
-
Object.values(this._fields).forEach((
|
|
856
|
-
|
|
969
|
+
set touched(t) {
|
|
970
|
+
Object.values(this._fields).forEach((e) => {
|
|
971
|
+
e.touched = t;
|
|
857
972
|
});
|
|
858
973
|
}
|
|
859
974
|
get fullValue() {
|
|
860
|
-
const
|
|
861
|
-
return Object.entries(this._fields).forEach(([
|
|
862
|
-
e
|
|
863
|
-
}),
|
|
975
|
+
const t = /* @__PURE__ */ Object.create(null);
|
|
976
|
+
return Object.entries(this._fields).forEach(([e, s]) => {
|
|
977
|
+
t[e] = s.fullValue;
|
|
978
|
+
}), v({}, t);
|
|
864
979
|
}
|
|
865
980
|
notifyValueChanged() {
|
|
866
981
|
if (this.suppressNotifyValueChanged) return;
|
|
867
|
-
const
|
|
868
|
-
if (!
|
|
869
|
-
const
|
|
870
|
-
this._value =
|
|
982
|
+
const t = this.value;
|
|
983
|
+
if (!D(t, this._value)) {
|
|
984
|
+
const e = this._value;
|
|
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
|
+
}
|
|
871
993
|
}
|
|
872
994
|
}
|
|
873
995
|
get valid() {
|
|
874
|
-
return super.valid && Object.values(this._fields).every((
|
|
996
|
+
return super.valid && Object.values(this._fields).every((t) => t.valid);
|
|
875
997
|
}
|
|
876
|
-
validate(
|
|
877
|
-
|
|
998
|
+
validate(t = !1) {
|
|
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);
|
|
878
1009
|
}
|
|
879
|
-
clone(
|
|
880
|
-
var r, a
|
|
881
|
-
const
|
|
882
|
-
Object.entries(this._fields).forEach(([
|
|
883
|
-
|
|
1010
|
+
clone(t) {
|
|
1011
|
+
var r, a;
|
|
1012
|
+
const e = /* @__PURE__ */ Object.create(null);
|
|
1013
|
+
Object.entries(this._fields).forEach(([l, u]) => {
|
|
1014
|
+
e[l] = u.clone();
|
|
884
1015
|
});
|
|
885
|
-
const
|
|
886
|
-
value
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
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
|
|
1019
|
+
}, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
|
|
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
|
|
890
1022
|
}));
|
|
891
|
-
return
|
|
1023
|
+
return s.actions = this.actions.clone(), s.actions.triggerEager(s, s.value, s.originalValue), s;
|
|
892
1024
|
}
|
|
893
1025
|
}
|
|
894
|
-
class
|
|
895
|
-
constructor(
|
|
1026
|
+
class Y extends V {
|
|
1027
|
+
constructor(t, e) {
|
|
896
1028
|
super();
|
|
897
1029
|
o(this, "_value", null);
|
|
898
1030
|
o(this, "_itemTemplate");
|
|
899
1031
|
o(this, "_previousValue");
|
|
900
|
-
if (this._itemTemplate =
|
|
901
|
-
const
|
|
902
|
-
[...a || [], ...l || []]
|
|
1032
|
+
if (this._itemTemplate = t, e) {
|
|
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);
|
|
903
1035
|
}
|
|
904
1036
|
this.originalValue === void 0 && (this.originalValue = this.value), this._previousValue = this.value, this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
905
1037
|
}
|
|
906
|
-
processSetValueItem(
|
|
907
|
-
let
|
|
908
|
-
return
|
|
909
|
-
}
|
|
910
|
-
setValueInternal(e) {
|
|
911
|
-
Array.isArray(e) && (this._value = e.map((t) => this.processSetValueItem(t)));
|
|
1038
|
+
processSetValueItem(t) {
|
|
1039
|
+
let e;
|
|
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;
|
|
912
1041
|
}
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
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);
|
|
917
1048
|
}
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
this.setValueInternal(e), this.actions.trigger(m, this, this.value, t), this.parent && this.parent.notifyValueChanged(), this.validate();
|
|
1049
|
+
setValueInternal(t) {
|
|
1050
|
+
t == null ? this._value = null : Array.isArray(t) && (this._value = t.map((e) => this.processSetValueItem(e)));
|
|
921
1051
|
}
|
|
922
|
-
get
|
|
1052
|
+
get value() {
|
|
923
1053
|
var e;
|
|
924
|
-
|
|
1054
|
+
const t = (e = this._value) == null ? void 0 : e.map((s) => s.value);
|
|
1055
|
+
return Q(t) ? null : t;
|
|
1056
|
+
}
|
|
1057
|
+
set value(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;
|
|
928
|
-
(t = this._value) == null
|
|
929
|
-
|
|
1072
|
+
return ((t = this._value) == null ? void 0 : t.some((e) => e.touched)) || !1;
|
|
1073
|
+
}
|
|
1074
|
+
set touched(t) {
|
|
1075
|
+
var e;
|
|
1076
|
+
(e = this._value) == null || e.forEach((s) => {
|
|
1077
|
+
s.touched = t;
|
|
930
1078
|
});
|
|
931
1079
|
}
|
|
932
|
-
clone(
|
|
933
|
-
var
|
|
934
|
-
const
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
1080
|
+
clone(t) {
|
|
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 : []]
|
|
1085
|
+
}, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
|
|
1086
|
+
enabled: (a = t == null ? void 0 : t.enabled) != null ? a : this.enabled,
|
|
1087
|
+
visibility: (l = t == null ? void 0 : t.visibility) != null ? l : this.visibility
|
|
939
1088
|
}));
|
|
940
|
-
return
|
|
1089
|
+
return e.actions = this.actions.clone(), e.actions.triggerEager(e, e.value, e.originalValue), e;
|
|
941
1090
|
}
|
|
942
1091
|
notifyValueChanged() {
|
|
943
|
-
const
|
|
944
|
-
if (!
|
|
945
|
-
const
|
|
946
|
-
this._previousValue =
|
|
1092
|
+
const t = this.value;
|
|
1093
|
+
if (!D(t, this._previousValue)) {
|
|
1094
|
+
const e = this._previousValue;
|
|
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
|
+
}
|
|
947
1103
|
}
|
|
948
1104
|
}
|
|
949
1105
|
get valid() {
|
|
950
|
-
var
|
|
951
|
-
return super.valid && ((
|
|
1106
|
+
var t, e;
|
|
1107
|
+
return super.valid && ((e = (t = this._value) == null ? void 0 : t.every((s) => s.valid)) != null ? e : !0);
|
|
952
1108
|
}
|
|
953
|
-
validate(
|
|
954
|
-
var
|
|
955
|
-
|
|
1109
|
+
validate(t = !1) {
|
|
1110
|
+
var e;
|
|
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);
|
|
956
1121
|
}
|
|
957
|
-
get(
|
|
958
|
-
return this._value != null ? this._value[
|
|
1122
|
+
get(t) {
|
|
1123
|
+
return this._value != null ? this._value[t] : void 0;
|
|
959
1124
|
}
|
|
960
|
-
push(
|
|
961
|
-
var
|
|
962
|
-
return this.insert(
|
|
1125
|
+
push(t) {
|
|
1126
|
+
var e, s;
|
|
1127
|
+
return this.insert(t, (s = (e = this._value) == null ? void 0 : e.length) != null ? s : 0) + 1;
|
|
963
1128
|
}
|
|
964
1129
|
pop() {
|
|
965
|
-
var
|
|
966
|
-
return this.remove(((
|
|
967
|
-
}
|
|
968
|
-
remove(
|
|
969
|
-
var
|
|
970
|
-
if (this._value == null ||
|
|
971
|
-
let
|
|
972
|
-
return
|
|
973
|
-
}
|
|
974
|
-
insert(
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1130
|
+
var t, e;
|
|
1131
|
+
return this.remove(((e = (t = this._value) == null ? void 0 : t.length) != null ? e : 0) - 1);
|
|
1132
|
+
}
|
|
1133
|
+
remove(t) {
|
|
1134
|
+
var s;
|
|
1135
|
+
if (this._value == null || t < 0 || this._value.length <= t) return;
|
|
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;
|
|
1138
|
+
}
|
|
1139
|
+
insert(t, e) {
|
|
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);
|
|
978
1145
|
}
|
|
979
|
-
const
|
|
980
|
-
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;
|
|
981
1148
|
}
|
|
982
1149
|
clear() {
|
|
983
1150
|
this._value = null, this.notifyValueChanged();
|
|
984
1151
|
}
|
|
985
1152
|
}
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
return he;
|
|
989
|
-
}
|
|
990
|
-
function qe(i) {
|
|
991
|
-
Object.assign(he, i);
|
|
992
|
-
}
|
|
993
|
-
const it = {
|
|
994
|
-
install(i, s) {
|
|
995
|
-
s && qe(s);
|
|
996
|
-
}
|
|
997
|
-
};
|
|
998
|
-
function v(i) {
|
|
999
|
-
return $e().useMarkdownInValidators ? new j(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, `
|
|
1000
|
-
`);
|
|
1001
|
-
}
|
|
1002
|
-
class Me extends f {
|
|
1003
|
-
constructor(e, t, n) {
|
|
1153
|
+
class Yt extends f {
|
|
1154
|
+
constructor(t, e, s) {
|
|
1004
1155
|
let r = !1, a, l;
|
|
1005
|
-
super((
|
|
1006
|
-
new
|
|
1007
|
-
|
|
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);
|
|
1008
1159
|
})
|
|
1009
|
-
)), this.isValidComparison(
|
|
1010
|
-
new
|
|
1011
|
-
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 })
|
|
1012
1163
|
)
|
|
1013
1164
|
]));
|
|
1014
1165
|
o(this, "otherField");
|
|
1015
1166
|
o(this, "isValidComparison");
|
|
1016
1167
|
o(this, "unregistered", !1);
|
|
1017
|
-
this.otherField =
|
|
1168
|
+
this.otherField = t, this.isValidComparison = e;
|
|
1018
1169
|
}
|
|
1019
1170
|
unregister() {
|
|
1020
1171
|
this.unregistered = !0;
|
|
1021
1172
|
}
|
|
1022
1173
|
}
|
|
1023
|
-
class
|
|
1024
|
-
constructor(
|
|
1025
|
-
const
|
|
1026
|
-
let
|
|
1027
|
-
|
|
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, {
|
|
1028
1179
|
length: 40,
|
|
1029
1180
|
separator: ", ",
|
|
1030
|
-
omission: `... (${
|
|
1181
|
+
omission: `... (${i.length} items total)`
|
|
1031
1182
|
}));
|
|
1032
|
-
const r = (a, l,
|
|
1033
|
-
new
|
|
1034
|
-
this.replacePlaceholders(
|
|
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 })
|
|
1035
1186
|
)
|
|
1036
1187
|
];
|
|
1037
1188
|
super(r);
|
|
1038
1189
|
}
|
|
1039
1190
|
}
|
|
1040
|
-
function
|
|
1041
|
-
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;
|
|
1042
1193
|
}
|
|
1043
|
-
class
|
|
1044
|
-
constructor(
|
|
1045
|
-
const
|
|
1046
|
-
super(
|
|
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;
|
|
1197
|
+
super(e);
|
|
1047
1198
|
}
|
|
1048
1199
|
}
|
|
1049
|
-
class
|
|
1050
|
-
constructor(
|
|
1051
|
-
const
|
|
1052
|
-
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 }))
|
|
1053
1204
|
] : null;
|
|
1054
|
-
super(
|
|
1205
|
+
super(s);
|
|
1055
1206
|
}
|
|
1056
1207
|
}
|
|
1057
|
-
class
|
|
1058
|
-
constructor(
|
|
1059
|
-
const
|
|
1060
|
-
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 }))
|
|
1061
1212
|
] : null;
|
|
1062
|
-
super(
|
|
1213
|
+
super(s);
|
|
1063
1214
|
}
|
|
1064
1215
|
}
|
|
1065
|
-
class
|
|
1066
|
-
constructor(
|
|
1067
|
-
const
|
|
1068
|
-
new
|
|
1069
|
-
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 })
|
|
1070
1221
|
)
|
|
1071
1222
|
] : null;
|
|
1072
1223
|
super(r);
|
|
1073
1224
|
}
|
|
1074
1225
|
}
|
|
1075
|
-
function
|
|
1076
|
-
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;
|
|
1077
1228
|
}
|
|
1078
|
-
class
|
|
1079
|
-
constructor(
|
|
1080
|
-
const
|
|
1081
|
-
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 }))
|
|
1082
1233
|
] : null;
|
|
1083
|
-
super(
|
|
1234
|
+
super(s);
|
|
1084
1235
|
}
|
|
1085
1236
|
}
|
|
1086
|
-
class
|
|
1087
|
-
constructor(
|
|
1088
|
-
const
|
|
1089
|
-
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 }))
|
|
1090
1241
|
] : null;
|
|
1091
|
-
super(
|
|
1242
|
+
super(s);
|
|
1092
1243
|
}
|
|
1093
1244
|
}
|
|
1094
|
-
class
|
|
1095
|
-
constructor(
|
|
1096
|
-
const
|
|
1097
|
-
const
|
|
1098
|
-
return
|
|
1099
|
-
new
|
|
1100
|
-
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 })
|
|
1101
1252
|
)
|
|
1102
1253
|
] : null;
|
|
1103
1254
|
};
|
|
1104
1255
|
super(r);
|
|
1105
1256
|
}
|
|
1106
1257
|
}
|
|
1107
|
-
class
|
|
1108
|
-
constructor(
|
|
1109
|
-
const
|
|
1110
|
-
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 }))
|
|
1111
1262
|
];
|
|
1112
|
-
super(
|
|
1263
|
+
super(s);
|
|
1113
1264
|
}
|
|
1114
1265
|
}
|
|
1115
|
-
const
|
|
1266
|
+
const le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1116
1267
|
__proto__: null,
|
|
1117
|
-
CompareTo:
|
|
1118
|
-
InAllowedValues:
|
|
1119
|
-
LengthInRange:
|
|
1120
|
-
MaxLength:
|
|
1121
|
-
MaxValue:
|
|
1122
|
-
MinLength:
|
|
1123
|
-
MinValue:
|
|
1124
|
-
Pattern:
|
|
1125
|
-
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,
|
|
1126
1277
|
Validator: f,
|
|
1127
|
-
ValueInRange:
|
|
1128
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1278
|
+
ValueInRange: ie
|
|
1279
|
+
}, Symbol.toStringTag, { value: "Module" })), de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1129
1280
|
__proto__: null,
|
|
1130
|
-
AbortEventHandlingException:
|
|
1131
|
-
Action:
|
|
1132
|
-
ActionsMap:
|
|
1133
|
-
ConditionalEnabledAction:
|
|
1134
|
-
ConditionalStatementAction:
|
|
1135
|
-
ConditionalValueAction:
|
|
1136
|
-
ConditionalVisibilityAction:
|
|
1137
|
-
DisplayMode:
|
|
1138
|
-
EmptyField:
|
|
1139
|
-
EnabledChangedAction:
|
|
1140
|
-
EnabledChangingAction:
|
|
1141
|
-
ExecuteAction:
|
|
1142
|
-
Field:
|
|
1143
|
-
FieldActionBase:
|
|
1144
|
-
FieldBase:
|
|
1145
|
-
Group:
|
|
1146
|
-
List:
|
|
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,
|
|
1297
|
+
List: Y,
|
|
1147
1298
|
ListItemAddedAction: z,
|
|
1148
|
-
ListItemRemovedAction:
|
|
1149
|
-
MdString:
|
|
1150
|
-
MessagesWidget:
|
|
1151
|
-
Operator:
|
|
1152
|
-
RenderableValue:
|
|
1153
|
-
Statement:
|
|
1154
|
-
ValidChangedAction:
|
|
1155
|
-
ValidationError:
|
|
1156
|
-
ValidationErrorRenderContent:
|
|
1157
|
-
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,
|
|
1158
1309
|
Validator: f,
|
|
1159
|
-
Validators:
|
|
1160
|
-
ValueChangedAction:
|
|
1161
|
-
VisibilityChangedAction:
|
|
1162
|
-
VisibilityChangingAction:
|
|
1163
|
-
buildErrorMessage:
|
|
1164
|
-
isCallableFunction:
|
|
1165
|
-
isSimpleComponentDef:
|
|
1310
|
+
Validators: le,
|
|
1311
|
+
ValueChangedAction: y,
|
|
1312
|
+
VisibilityChangedAction: gt,
|
|
1313
|
+
VisibilityChangingAction: dt,
|
|
1314
|
+
buildErrorMessage: b,
|
|
1315
|
+
isCallableFunction: k,
|
|
1316
|
+
isSimpleComponentDef: X
|
|
1166
1317
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1167
1318
|
export {
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
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,
|
|
1335
|
+
Y as List,
|
|
1185
1336
|
z as ListItemAddedAction,
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
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,
|
|
1196
1347
|
f as Validator,
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
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
|
|
1206
1357
|
};
|
|
1207
1358
|
//# sourceMappingURL=dynamicforms-vue-forms.js.map
|