@dynamicforms/vue-forms 1.0.0 → 2.0.2
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 +860 -517
- package/dist/dynamicforms-vue-forms.js.map +1 -1
- package/dist/index.d.ts +458 -183
- package/package.json +1 -1
- package/readme.md +36 -31
|
@@ -1,46 +1,37 @@
|
|
|
1
1
|
import { createTranslatable as e, interpolate as t } from "@dynamicforms/translatable";
|
|
2
|
-
import { computed as n, createBlock as r, defineComponent as i, h as a, isRef as o, openBlock as s, reactive as
|
|
3
|
-
import { isArray as
|
|
2
|
+
import { computed as n, createBlock as r, defineComponent as i, h as a, isRef as o, openBlock as s, reactive as c, ref as l, resolveComponent as u, toRef as d, unref as f, watch as p } from "vue";
|
|
3
|
+
import { isArray as m, isEmpty as h, isEqual as g, isEqualWith as ee, isObject as te, isPlainObject as ne, isString as _, truncate as re } from "lodash-es";
|
|
4
4
|
//#region \0rolldown/runtime.js
|
|
5
|
-
var
|
|
5
|
+
var ie = Object.defineProperty, ae = (e, t) => {
|
|
6
6
|
let n = {};
|
|
7
|
-
for (var r in e)
|
|
7
|
+
for (var r in e) ie(n, r, {
|
|
8
8
|
get: e[r],
|
|
9
9
|
enumerable: !0
|
|
10
10
|
});
|
|
11
|
-
return t ||
|
|
12
|
-
}, v =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
return t || ie(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
12
|
+
}, v = Object.freeze([
|
|
13
|
+
"editable",
|
|
14
|
+
"readonly",
|
|
15
|
+
"disabled",
|
|
16
|
+
"disabled-null"
|
|
17
|
+
]), oe = "editable";
|
|
18
|
+
function se(e) {
|
|
19
|
+
return v.includes(e);
|
|
18
20
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
e
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
if (typeof e != "string") throw y(e);
|
|
35
|
-
return v.fromString(e);
|
|
36
|
-
}
|
|
37
|
-
e.fromAny = n;
|
|
38
|
-
function r(e) {
|
|
39
|
-
return typeof e == "number" ? oe.has(e) : typeof e == "string" && se.has(e.toUpperCase());
|
|
40
|
-
}
|
|
41
|
-
e.isDefined = r;
|
|
42
|
-
})(v ||= {}), Object.freeze(v);
|
|
43
|
-
var b = v, x = class {
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/visibility.ts
|
|
23
|
+
var y = Object.freeze([
|
|
24
|
+
"full",
|
|
25
|
+
"invisible",
|
|
26
|
+
"hidden",
|
|
27
|
+
"suppress"
|
|
28
|
+
]), b = "full";
|
|
29
|
+
function x(e) {
|
|
30
|
+
return y.includes(e);
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/actions/field-action-base.ts
|
|
34
|
+
var S = class {
|
|
44
35
|
static get classIdentifier() {
|
|
45
36
|
throw Error("classIdentifier must be declared");
|
|
46
37
|
}
|
|
@@ -63,18 +54,18 @@ var b = v, x = class {
|
|
|
63
54
|
}
|
|
64
55
|
boundToBinding(e) {}
|
|
65
56
|
unregisterFrom(e) {}
|
|
66
|
-
},
|
|
57
|
+
}, C = class extends Error {}, w = Symbol("ValueChangedAction"), T = class extends S {
|
|
67
58
|
constructor(e) {
|
|
68
59
|
super(e);
|
|
69
60
|
}
|
|
70
61
|
static get classIdentifier() {
|
|
71
|
-
return
|
|
62
|
+
return w;
|
|
72
63
|
}
|
|
73
64
|
execute(e, t, n, r) {
|
|
74
65
|
return super.execute(e, t, n, r);
|
|
75
66
|
}
|
|
76
|
-
},
|
|
77
|
-
function
|
|
67
|
+
}, E = Symbol("Transaction.capture"), ce = Symbol("FieldBase.sentNowhere"), le = Symbol("Transaction.restore"), ue = Symbol("Transaction.announceValue"), de = Symbol("Transaction.settleValidity");
|
|
68
|
+
function D(e) {
|
|
78
69
|
return e;
|
|
79
70
|
}
|
|
80
71
|
function fe(e) {
|
|
@@ -103,7 +94,7 @@ var pe = class {
|
|
|
103
94
|
}
|
|
104
95
|
touch(e) {
|
|
105
96
|
let t = this.participant(e);
|
|
106
|
-
t.snapshot ||=
|
|
97
|
+
t.snapshot ||= D(e)[E]();
|
|
107
98
|
}
|
|
108
99
|
markValueChanged(e, t) {
|
|
109
100
|
let n = this.participant(e);
|
|
@@ -130,7 +121,7 @@ var pe = class {
|
|
|
130
121
|
}
|
|
131
122
|
rollback() {
|
|
132
123
|
this.unwound = !0, [...this.participants.values()].reverse().forEach((e) => {
|
|
133
|
-
e.snapshot &&
|
|
124
|
+
e.snapshot && D(e.element)[le](e.snapshot);
|
|
134
125
|
}), this.participants.clear();
|
|
135
126
|
for (let e = this.undo.length - 1; e >= 0; e--) this.undo[e]();
|
|
136
127
|
this.undo.length = 0, this.settled.length = 0;
|
|
@@ -172,17 +163,17 @@ var pe = class {
|
|
|
172
163
|
announceValues() {
|
|
173
164
|
return this.pass((e) => e.valueDirty || e.structural !== void 0, (e) => {
|
|
174
165
|
let { structural: t } = e, n = e.valueDirty, r = e.forceValue;
|
|
175
|
-
e.structural = void 0, e.valueDirty = !1, e.forceValue = !1,
|
|
166
|
+
e.structural = void 0, e.valueDirty = !1, e.forceValue = !1, D(e.element)[ue](this, n, r, t);
|
|
176
167
|
});
|
|
177
168
|
}
|
|
178
169
|
settleValidity() {
|
|
179
170
|
return this.pass((e) => e.validityDirty, (e) => {
|
|
180
|
-
e.validityDirty = !1,
|
|
171
|
+
e.validityDirty = !1, D(e.element)[de](this);
|
|
181
172
|
});
|
|
182
173
|
}
|
|
183
|
-
},
|
|
174
|
+
}, O, me;
|
|
184
175
|
function he() {
|
|
185
|
-
return
|
|
176
|
+
return O;
|
|
186
177
|
}
|
|
187
178
|
var ge = class {}, _e = class {
|
|
188
179
|
open = !0;
|
|
@@ -196,13 +187,13 @@ var ge = class {}, _e = class {
|
|
|
196
187
|
function ve(e) {
|
|
197
188
|
if (e != null && typeof e.then == "function") throw TypeError("a transaction may not be asynchronous: the callback returned a thenable. Do the awaiting outside and open a transaction for each synchronous part.");
|
|
198
189
|
}
|
|
199
|
-
function
|
|
200
|
-
if (
|
|
190
|
+
function k(e) {
|
|
191
|
+
if (O) {
|
|
201
192
|
let t = e(me);
|
|
202
193
|
return ve(t), t;
|
|
203
194
|
}
|
|
204
195
|
let t = new pe(), n = new _e();
|
|
205
|
-
|
|
196
|
+
O = t, me = n;
|
|
206
197
|
try {
|
|
207
198
|
let r = e(n);
|
|
208
199
|
return ve(r), t.commit(), r;
|
|
@@ -210,11 +201,11 @@ function D(e) {
|
|
|
210
201
|
if (t.rollback(), e instanceof ge) return;
|
|
211
202
|
throw e;
|
|
212
203
|
} finally {
|
|
213
|
-
|
|
204
|
+
O = void 0, me = void 0, n.close();
|
|
214
205
|
}
|
|
215
206
|
}
|
|
216
|
-
function
|
|
217
|
-
return
|
|
207
|
+
function A(e) {
|
|
208
|
+
return O ? e(O) : k(() => e(O));
|
|
218
209
|
}
|
|
219
210
|
//#endregion
|
|
220
211
|
//#region src/config.ts
|
|
@@ -227,27 +218,31 @@ function xe(e) {
|
|
|
227
218
|
}
|
|
228
219
|
var Se = { install(e, t) {
|
|
229
220
|
t && xe(t);
|
|
230
|
-
} },
|
|
221
|
+
} }, j = class extends String {
|
|
231
222
|
plugins;
|
|
232
223
|
options;
|
|
233
224
|
constructor(e, t, n) {
|
|
234
225
|
super(e), this.plugins = n, this.options = t;
|
|
235
226
|
}
|
|
236
227
|
};
|
|
237
|
-
function
|
|
238
|
-
let t =
|
|
228
|
+
function M(e) {
|
|
229
|
+
let t = f(e);
|
|
239
230
|
return typeof t == "object" && !!t && "componentName" in t;
|
|
240
231
|
}
|
|
241
|
-
function
|
|
242
|
-
return typeof
|
|
232
|
+
function N(e) {
|
|
233
|
+
return typeof f(e) == "function";
|
|
243
234
|
}
|
|
244
|
-
var
|
|
235
|
+
var P = class {
|
|
245
236
|
code;
|
|
246
|
-
|
|
247
|
-
|
|
237
|
+
statedOrigin;
|
|
238
|
+
constructor(e, t) {
|
|
239
|
+
this.code = e, this.statedOrigin = t;
|
|
240
|
+
}
|
|
241
|
+
get origin() {
|
|
242
|
+
return this.statedOrigin === void 0 ? typeof this.source == "symbol" ? "validator" : "application" : this.statedOrigin;
|
|
248
243
|
}
|
|
249
244
|
sameAs(e) {
|
|
250
|
-
return Object.getPrototypeOf(this) === Object.getPrototypeOf(e) && this.code === e.code && this.componentName === e.componentName && g(this.componentBody, e.componentBody) && g(this.componentBindings, e.componentBindings) && g(this.extraClasses, e.extraClasses);
|
|
245
|
+
return Object.getPrototypeOf(this) === Object.getPrototypeOf(e) && this.code === e.code && this.statedOrigin === e.statedOrigin && this.componentName === e.componentName && g(this.componentBody, e.componentBody) && g(this.componentBindings, e.componentBindings) && g(this.extraClasses, e.extraClasses);
|
|
251
246
|
}
|
|
252
247
|
get componentName() {
|
|
253
248
|
return "Comment";
|
|
@@ -261,11 +256,11 @@ var M = class {
|
|
|
261
256
|
get extraClasses() {
|
|
262
257
|
return "";
|
|
263
258
|
}
|
|
264
|
-
}, Ce = class extends
|
|
259
|
+
}, Ce = class extends P {
|
|
265
260
|
text;
|
|
266
261
|
classes;
|
|
267
|
-
constructor(e, t = "", n) {
|
|
268
|
-
super(n), this.text = e, this.classes = t;
|
|
262
|
+
constructor(e, t = "", n, r) {
|
|
263
|
+
super(n, r), this.text = e, this.classes = t;
|
|
269
264
|
}
|
|
270
265
|
get componentName() {
|
|
271
266
|
return "template";
|
|
@@ -276,23 +271,23 @@ var M = class {
|
|
|
276
271
|
get extraClasses() {
|
|
277
272
|
return this.classes;
|
|
278
273
|
}
|
|
279
|
-
},
|
|
274
|
+
}, F = class extends P {
|
|
280
275
|
classes;
|
|
281
276
|
text;
|
|
282
277
|
textType;
|
|
283
|
-
constructor(e, t = "", r) {
|
|
284
|
-
super(r), this.classes = t, this.text = e, this.textType = n(() => this.getTextType);
|
|
278
|
+
constructor(e, t = "", r, i) {
|
|
279
|
+
super(r, i), this.classes = t, this.text = e, this.textType = n(() => this.getTextType);
|
|
285
280
|
}
|
|
286
281
|
get resolvedText() {
|
|
287
|
-
let e =
|
|
288
|
-
return
|
|
282
|
+
let e = f(this.text);
|
|
283
|
+
return N(e) ? e() : e;
|
|
289
284
|
}
|
|
290
285
|
get getTextType() {
|
|
291
286
|
let e = this.resolvedText;
|
|
292
|
-
return e ? e instanceof
|
|
287
|
+
return e ? e instanceof j ? "md" : M(e) ? "component" : "string" : "string";
|
|
293
288
|
}
|
|
294
289
|
get componentName() {
|
|
295
|
-
switch (
|
|
290
|
+
switch (f(this.textType)) {
|
|
296
291
|
case "string": return "template";
|
|
297
292
|
case "md": return "vue-markdown";
|
|
298
293
|
case "component": return this.resolvedText.componentName;
|
|
@@ -300,7 +295,7 @@ var M = class {
|
|
|
300
295
|
}
|
|
301
296
|
}
|
|
302
297
|
get componentBindings() {
|
|
303
|
-
switch (
|
|
298
|
+
switch (f(this.textType)) {
|
|
304
299
|
case "string": return {};
|
|
305
300
|
case "md": {
|
|
306
301
|
let e = this.resolvedText;
|
|
@@ -315,7 +310,7 @@ var M = class {
|
|
|
315
310
|
}
|
|
316
311
|
}
|
|
317
312
|
get componentBody() {
|
|
318
|
-
switch (
|
|
313
|
+
switch (f(this.textType)) {
|
|
319
314
|
case "string": return this.resolvedText;
|
|
320
315
|
case "component": return this.resolvedText.componentVHtml || "";
|
|
321
316
|
default: return "";
|
|
@@ -324,13 +319,13 @@ var M = class {
|
|
|
324
319
|
get extraClasses() {
|
|
325
320
|
return this.classes;
|
|
326
321
|
}
|
|
327
|
-
}, we = class extends
|
|
322
|
+
}, we = class extends F {};
|
|
328
323
|
//#endregion
|
|
329
324
|
//#region src/validators/error-message-builder.ts
|
|
330
325
|
function Te(e) {
|
|
331
|
-
return be().useMarkdownInValidators ? new
|
|
326
|
+
return be().useMarkdownInValidators ? new j(e) : e.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, "\n");
|
|
332
327
|
}
|
|
333
|
-
function
|
|
328
|
+
function I(e) {
|
|
334
329
|
return o(e) ? n(() => Te(e.value)) : Te(e);
|
|
335
330
|
}
|
|
336
331
|
//#endregion
|
|
@@ -347,20 +342,20 @@ var { strings: Ee, translateStrings: De } = e({
|
|
|
347
342
|
InAllowedValues: "Must be one of [**{allowedAsText}**]",
|
|
348
343
|
ValidationFailed: "Validation could not be completed"
|
|
349
344
|
});
|
|
350
|
-
function
|
|
351
|
-
return
|
|
345
|
+
function L(e) {
|
|
346
|
+
return I(d(Ee, e));
|
|
352
347
|
}
|
|
353
348
|
//#endregion
|
|
354
349
|
//#region src/validators/validator.ts
|
|
355
|
-
var Oe = Symbol("Validator"), ke = () =>
|
|
350
|
+
var Oe = Symbol("Validator"), ke = () => L("ValidationFailed"), R = class extends T {
|
|
356
351
|
source;
|
|
357
352
|
constructor(e) {
|
|
358
353
|
super((t, n, r, i) => {
|
|
359
|
-
let a = this.bindingState(t), o = a.abandon, s = ++a.run,
|
|
360
|
-
|
|
354
|
+
let a = this.bindingState(t), o = a.abandon, s = ++a.run, c = t.validationEpoch, l = he(), u = !1, d = () => !u && a.run === s && t.validationEpoch === c && !l?.rolledBack, f = new AbortController(), p = () => {
|
|
355
|
+
d() || (u = !0, a.abandon === p && (a.abandon = void 0), f.abort());
|
|
361
356
|
};
|
|
362
357
|
o?.();
|
|
363
|
-
let
|
|
358
|
+
let m = t[ce]() ? [] : e(r, i, t, f.signal) || [], h = (e) => k(() => {
|
|
364
359
|
let n = e?.map((e) => this.claim(e)) ?? [];
|
|
365
360
|
for (let e = t.errors.length - 1; e >= 0; e--) {
|
|
366
361
|
let r = t.errors[e];
|
|
@@ -371,13 +366,13 @@ var Oe = Symbol("Validator"), ke = () => F("ValidationFailed"), I = class extend
|
|
|
371
366
|
}
|
|
372
367
|
n.length > 0 && t.errors.push(...n), t.validate();
|
|
373
368
|
});
|
|
374
|
-
return
|
|
375
|
-
|
|
369
|
+
return m instanceof Promise ? (a.abandon = p, l?.whenRolledBack(p), t.beginValidating(), m.then((e) => {
|
|
370
|
+
d() && h(e);
|
|
376
371
|
}, (e) => {
|
|
377
|
-
|
|
372
|
+
d() && (h([new F(ke(), "", "validation-failed")]), console.error("Validation failed", e));
|
|
378
373
|
}).finally(() => {
|
|
379
|
-
a.abandon ===
|
|
380
|
-
}).catch((e) => console.error("Validation failed", e))) : m
|
|
374
|
+
a.abandon === p && (a.abandon = void 0), t.endValidating();
|
|
375
|
+
}).catch((e) => console.error("Validation failed", e))) : h(m), n(t, r, i);
|
|
381
376
|
}), this.source = Symbol(this.constructor.name);
|
|
382
377
|
}
|
|
383
378
|
claim(e) {
|
|
@@ -402,7 +397,7 @@ var Oe = Symbol("Validator"), ke = () => F("ValidationFailed"), I = class extend
|
|
|
402
397
|
return !0;
|
|
403
398
|
}
|
|
404
399
|
unregisterFrom(e) {
|
|
405
|
-
|
|
400
|
+
A((t) => {
|
|
406
401
|
t.whenCommitted(() => this.abandonRun(e));
|
|
407
402
|
for (let t = e.errors.length - 1; t >= 0; t--) e.errors[t].source === this.source && e.errors.splice(t, 1);
|
|
408
403
|
e.validate();
|
|
@@ -419,22 +414,22 @@ var Oe = Symbol("Validator"), ke = () => F("ValidationFailed"), I = class extend
|
|
|
419
414
|
}
|
|
420
415
|
replacePlaceholdersFunction(e, t) {
|
|
421
416
|
return () => {
|
|
422
|
-
let n =
|
|
423
|
-
for (;
|
|
417
|
+
let n = f(e);
|
|
418
|
+
for (; N(n);) n = f(this.replacePlaceholders(n(), t));
|
|
424
419
|
return n;
|
|
425
420
|
};
|
|
426
421
|
}
|
|
427
422
|
replacePlaceholders(e, n) {
|
|
428
|
-
if (
|
|
429
|
-
if (
|
|
430
|
-
if (o(e)) return this.replacePlaceholdersFunction(() =>
|
|
431
|
-
let r =
|
|
432
|
-
return r instanceof
|
|
423
|
+
if (N(e)) return this.replacePlaceholdersFunction(e, n);
|
|
424
|
+
if (M(e)) return e;
|
|
425
|
+
if (o(e)) return this.replacePlaceholdersFunction(() => f(e), n);
|
|
426
|
+
let r = f(e), i = t(r.toString(), n);
|
|
427
|
+
return r instanceof j ? new j(i, r.options, r.plugins) : i;
|
|
433
428
|
}
|
|
434
|
-
},
|
|
429
|
+
}, Ae = class e {
|
|
435
430
|
actions = [];
|
|
436
431
|
register(e, t) {
|
|
437
|
-
if (!(e instanceof
|
|
432
|
+
if (!(e instanceof S)) throw Error("Invalid action type");
|
|
438
433
|
let n = t ? this.actions.indexOf(t) : -1;
|
|
439
434
|
if (t && (t.classIdentifier !== e.classIdentifier || n < 0)) throw Error("Action to register before is not registered under the same identifier");
|
|
440
435
|
n < 0 ? this.actions.push(e) : this.actions.splice(n, 0, e);
|
|
@@ -458,10 +453,10 @@ var Oe = Symbol("Validator"), ke = () => F("ValidationFailed"), I = class extend
|
|
|
458
453
|
if (a.eager && e.outermostEager(r, i)) try {
|
|
459
454
|
let o = this.walk(r, i, a.classIdentifier, !0, t, n);
|
|
460
455
|
e.isPromise(o) && o.then(void 0, (e) => {
|
|
461
|
-
if (!(e instanceof
|
|
456
|
+
if (!(e instanceof C)) throw e;
|
|
462
457
|
});
|
|
463
458
|
} catch (e) {
|
|
464
|
-
if (!(e instanceof
|
|
459
|
+
if (!(e instanceof C)) throw e;
|
|
465
460
|
}
|
|
466
461
|
}
|
|
467
462
|
}
|
|
@@ -469,7 +464,7 @@ var Oe = Symbol("Validator"), ke = () => F("ValidationFailed"), I = class extend
|
|
|
469
464
|
return this.run(e, !0, t, n);
|
|
470
465
|
}
|
|
471
466
|
get validators() {
|
|
472
|
-
return this.actions.filter((e) => e instanceof
|
|
467
|
+
return this.actions.filter((e) => e instanceof R);
|
|
473
468
|
}
|
|
474
469
|
bindTo(e) {
|
|
475
470
|
this.actions.forEach((t) => t.boundToBinding(e));
|
|
@@ -484,7 +479,7 @@ var Oe = Symbol("Validator"), ke = () => F("ValidationFailed"), I = class extend
|
|
|
484
479
|
}
|
|
485
480
|
static answerAbort(t) {
|
|
486
481
|
return e.isPromise(t) ? t.then(void 0, (e) => {
|
|
487
|
-
if (e instanceof
|
|
482
|
+
if (e instanceof C) return e;
|
|
488
483
|
throw e;
|
|
489
484
|
}) : t;
|
|
490
485
|
}
|
|
@@ -493,7 +488,7 @@ var Oe = Symbol("Validator"), ke = () => F("ValidationFailed"), I = class extend
|
|
|
493
488
|
try {
|
|
494
489
|
return e.answerAbort(this.walk(a, a.length - 1, t, n, r, i));
|
|
495
490
|
} catch (e) {
|
|
496
|
-
if (e instanceof
|
|
491
|
+
if (e instanceof C) return e;
|
|
497
492
|
throw e;
|
|
498
493
|
}
|
|
499
494
|
}
|
|
@@ -505,40 +500,40 @@ var Oe = Symbol("Validator"), ke = () => F("ValidationFailed"), I = class extend
|
|
|
505
500
|
};
|
|
506
501
|
//#endregion
|
|
507
502
|
//#region src/binding/resolve.ts
|
|
508
|
-
function
|
|
503
|
+
function z(e) {
|
|
509
504
|
let t = e;
|
|
510
505
|
for (; t.fieldName !== void 0 && t.parent;) t = t.parent;
|
|
511
506
|
return t;
|
|
512
507
|
}
|
|
513
|
-
function
|
|
508
|
+
function je(e, t) {
|
|
514
509
|
let n = e;
|
|
515
|
-
for (let e of
|
|
510
|
+
for (let e of Me(t)) if (n = n.field?.(e) ?? void 0, !n) return;
|
|
516
511
|
return n?.declaration === t ? n : void 0;
|
|
517
512
|
}
|
|
518
|
-
function
|
|
513
|
+
function Me(e) {
|
|
519
514
|
let t = [], n = e;
|
|
520
515
|
for (; n.fieldName !== void 0 && n.parent;) t.unshift(n.fieldName), n = n.parent;
|
|
521
516
|
return t;
|
|
522
517
|
}
|
|
523
|
-
function
|
|
524
|
-
let n =
|
|
518
|
+
function Ne(e, t) {
|
|
519
|
+
let n = je(t, e);
|
|
525
520
|
if (n) return n;
|
|
526
521
|
let r = t.parent;
|
|
527
522
|
for (; r;) {
|
|
528
|
-
let t =
|
|
523
|
+
let t = je(z(r), e);
|
|
529
524
|
if (t) return t;
|
|
530
525
|
r = r.parent;
|
|
531
526
|
}
|
|
532
|
-
return
|
|
527
|
+
return z(e) === z(t.declaration) ? void 0 : e;
|
|
533
528
|
}
|
|
534
|
-
function
|
|
535
|
-
let n =
|
|
529
|
+
function Pe(e, t) {
|
|
530
|
+
let n = Ne(e, t);
|
|
536
531
|
if (!n) return [];
|
|
537
532
|
if (n !== e) return [n];
|
|
538
533
|
let r = t.bindingsOf(e);
|
|
539
534
|
return r.length > 0 ? r : [e];
|
|
540
535
|
}
|
|
541
|
-
function
|
|
536
|
+
function Fe(e, t) {
|
|
542
537
|
let n = t.parent;
|
|
543
538
|
for (; n;) {
|
|
544
539
|
let t = n.field?.(e);
|
|
@@ -548,18 +543,18 @@ function Pe(e, t) {
|
|
|
548
543
|
}
|
|
549
544
|
//#endregion
|
|
550
545
|
//#region src/actions/conditional/conditional-statement-action.ts
|
|
551
|
-
var
|
|
546
|
+
var Ie = Symbol("ConditionalStatementAction"), B = class extends T {
|
|
552
547
|
statement;
|
|
553
548
|
conditionalExecutor;
|
|
554
549
|
declarations = /* @__PURE__ */ new Set();
|
|
555
550
|
registrations = /* @__PURE__ */ new WeakSet();
|
|
556
551
|
constructor(e, t) {
|
|
557
|
-
super((e, t, n, r) => (this.applyIn(
|
|
558
|
-
let n = new
|
|
552
|
+
super((e, t, n, r) => (this.applyIn(z(e)) || e.markRecordIncomplete(), t(e, n, r))), this.statement = e, this.conditionalExecutor = t;
|
|
553
|
+
let n = new T((e, t, ...n) => (this.applyFrom(e), t(e, ...n)));
|
|
559
554
|
e.collectFields().forEach((e) => e.registerAction(n));
|
|
560
555
|
}
|
|
561
556
|
static get classIdentifier() {
|
|
562
|
-
return
|
|
557
|
+
return Ie;
|
|
563
558
|
}
|
|
564
559
|
get eager() {
|
|
565
560
|
return !0;
|
|
@@ -572,7 +567,7 @@ var Fe = Symbol("ConditionalStatementAction"), z = class extends C {
|
|
|
572
567
|
}
|
|
573
568
|
targetsIn(e) {
|
|
574
569
|
let t = [];
|
|
575
|
-
return this.declarations.forEach((n) =>
|
|
570
|
+
return this.declarations.forEach((n) => Pe(n, e).forEach((e) => {
|
|
576
571
|
this.registrations.has(e) && t.push(e);
|
|
577
572
|
})), t;
|
|
578
573
|
}
|
|
@@ -586,29 +581,29 @@ var Fe = Symbol("ConditionalStatementAction"), z = class extends C {
|
|
|
586
581
|
}
|
|
587
582
|
applyFrom(e) {
|
|
588
583
|
let t = /* @__PURE__ */ new Set();
|
|
589
|
-
this.targetsIn(
|
|
584
|
+
this.targetsIn(z(e)).forEach((e) => t.add(z(e))), t.forEach((e) => this.applyIn(e));
|
|
590
585
|
}
|
|
591
|
-
},
|
|
592
|
-
constructor(e) {
|
|
593
|
-
super(e, (e,
|
|
594
|
-
e.visibility =
|
|
586
|
+
}, Le = class extends B {
|
|
587
|
+
constructor(e, t = "full", n = "suppress") {
|
|
588
|
+
super(e, (e, r) => {
|
|
589
|
+
e.visibility = r ? t : n;
|
|
595
590
|
});
|
|
596
591
|
}
|
|
597
|
-
},
|
|
598
|
-
constructor(e) {
|
|
599
|
-
super(e, (e,
|
|
600
|
-
e.
|
|
592
|
+
}, Re = class extends B {
|
|
593
|
+
constructor(e, t = "editable", n = "disabled") {
|
|
594
|
+
super(e, (e, r) => {
|
|
595
|
+
e.access = r ? t : n;
|
|
601
596
|
});
|
|
602
597
|
}
|
|
603
|
-
},
|
|
598
|
+
}, ze = class extends B {
|
|
604
599
|
constructor(e, t) {
|
|
605
600
|
super(e, (e, n) => {
|
|
606
601
|
n && (e.value = t);
|
|
607
602
|
});
|
|
608
603
|
}
|
|
609
|
-
},
|
|
604
|
+
}, V = /* @__PURE__ */ function(e) {
|
|
610
605
|
return e[e.NOT = 0] = "NOT", e[e.OR = 1] = "OR", e[e.AND = 2] = "AND", e[e.XOR = 3] = "XOR", e[e.NAND = 4] = "NAND", e[e.NOR = 5] = "NOR", e[e.EQUALS = -1] = "EQUALS", e[e.NOT_EQUALS = -2] = "NOT_EQUALS", e[e.GT = -3] = "GT", e[e.LT = -4] = "LT", e[e.GE = -5] = "GE", e[e.LE = -6] = "LE", e[e.IN = -7] = "IN", e[e.NOT_IN = -8] = "NOT_IN", e[e.INCLUDES = -9] = "INCLUDES", e[e.NOT_INCLUDES = -10] = "NOT_INCLUDES", e;
|
|
611
|
-
}(
|
|
606
|
+
}(V || {});
|
|
612
607
|
(function(e) {
|
|
613
608
|
function t(e) {
|
|
614
609
|
let t = e.toLowerCase();
|
|
@@ -644,72 +639,106 @@ var Fe = Symbol("ConditionalStatementAction"), z = class extends C {
|
|
|
644
639
|
}
|
|
645
640
|
e.fromString = t;
|
|
646
641
|
function n(e) {
|
|
647
|
-
let t = typeof e == "number" ? e :
|
|
648
|
-
if (Object.values(
|
|
642
|
+
let t = typeof e == "number" ? e : V.fromString(e);
|
|
643
|
+
if (Object.values(V).includes(t)) return t;
|
|
649
644
|
throw Error(`Unrecognised operator ${e}`);
|
|
650
645
|
}
|
|
651
646
|
e.fromAny = n;
|
|
652
647
|
function r(e) {
|
|
653
|
-
let t = typeof e == "number" ? e :
|
|
654
|
-
return Object.values(
|
|
648
|
+
let t = typeof e == "number" ? e : V.fromString(e);
|
|
649
|
+
return Object.values(V).includes(t);
|
|
655
650
|
}
|
|
656
651
|
e.isDefined = r;
|
|
657
652
|
function i(e) {
|
|
658
653
|
return e >= 0;
|
|
659
654
|
}
|
|
660
655
|
e.isLogicOperator = i;
|
|
661
|
-
})(
|
|
662
|
-
var
|
|
656
|
+
})(V ||= {}), Object.freeze(V);
|
|
657
|
+
var H = V, Be = Symbol("AccessChangingAction"), Ve = class extends S {
|
|
663
658
|
constructor(e) {
|
|
664
659
|
super(e);
|
|
665
660
|
}
|
|
666
661
|
static get classIdentifier() {
|
|
667
|
-
return
|
|
662
|
+
return Be;
|
|
668
663
|
}
|
|
669
664
|
execute(e, t, n, r) {
|
|
670
665
|
return super.execute(e, t, n, r);
|
|
671
666
|
}
|
|
672
|
-
},
|
|
667
|
+
}, He = Symbol("AccessChangedAction"), Ue = class extends S {
|
|
673
668
|
constructor(e) {
|
|
674
669
|
super(e);
|
|
675
670
|
}
|
|
676
671
|
static get classIdentifier() {
|
|
677
|
-
return
|
|
672
|
+
return He;
|
|
678
673
|
}
|
|
679
674
|
execute(e, t, n, r) {
|
|
680
675
|
return super.execute(e, t, n, r);
|
|
681
676
|
}
|
|
682
|
-
},
|
|
677
|
+
}, We = Symbol("ContributionChangedAction"), U = class extends S {
|
|
683
678
|
constructor(e) {
|
|
684
679
|
super(e);
|
|
685
680
|
}
|
|
686
681
|
static get classIdentifier() {
|
|
687
|
-
return
|
|
682
|
+
return We;
|
|
688
683
|
}
|
|
689
684
|
execute(e, t, n, r) {
|
|
690
685
|
return super.execute(e, t, n, r);
|
|
691
686
|
}
|
|
692
|
-
},
|
|
687
|
+
}, Ge = Symbol("EnabledChangingAction"), Ke = class extends S {
|
|
693
688
|
constructor(e) {
|
|
694
689
|
super(e);
|
|
695
690
|
}
|
|
696
691
|
static get classIdentifier() {
|
|
697
|
-
return
|
|
692
|
+
return Ge;
|
|
693
|
+
}
|
|
694
|
+
execute(e, t, n, r) {
|
|
695
|
+
return super.execute(e, t, n, r);
|
|
696
|
+
}
|
|
697
|
+
}, qe = Symbol("EnabledChangedAction"), Je = class extends S {
|
|
698
|
+
constructor(e) {
|
|
699
|
+
super(e);
|
|
700
|
+
}
|
|
701
|
+
static get classIdentifier() {
|
|
702
|
+
return qe;
|
|
703
|
+
}
|
|
704
|
+
execute(e, t, n, r) {
|
|
705
|
+
return super.execute(e, t, n, r);
|
|
706
|
+
}
|
|
707
|
+
}, Ye = Symbol("ValidChangedAction"), Xe = class extends S {
|
|
708
|
+
constructor(e) {
|
|
709
|
+
super(e);
|
|
710
|
+
}
|
|
711
|
+
static get classIdentifier() {
|
|
712
|
+
return Ye;
|
|
698
713
|
}
|
|
699
714
|
execute(e, t, n, r) {
|
|
700
715
|
return super.execute(e, t, n, r);
|
|
701
716
|
}
|
|
702
|
-
},
|
|
717
|
+
}, Ze = Symbol("VisibilityChangingAction"), Qe = class extends S {
|
|
703
718
|
constructor(e) {
|
|
704
719
|
super(e);
|
|
705
720
|
}
|
|
706
721
|
static get classIdentifier() {
|
|
707
|
-
return
|
|
722
|
+
return Ze;
|
|
708
723
|
}
|
|
709
724
|
execute(e, t, n, r) {
|
|
710
725
|
return super.execute(e, t, n, r);
|
|
711
726
|
}
|
|
712
|
-
},
|
|
727
|
+
}, $e = Symbol("VisibilityChangedAction"), et = class extends S {
|
|
728
|
+
constructor(e) {
|
|
729
|
+
super(e);
|
|
730
|
+
}
|
|
731
|
+
static get classIdentifier() {
|
|
732
|
+
return $e;
|
|
733
|
+
}
|
|
734
|
+
execute(e, t, n, r) {
|
|
735
|
+
return super.execute(e, t, n, r);
|
|
736
|
+
}
|
|
737
|
+
}, tt = /* @__PURE__ */ new WeakMap(), nt = /* @__PURE__ */ new Set(["validators", "actions"]), W = (e) => typeof e == "string" ? `'${e}'` : String(e), rt = (e) => e.map(W).join(", ");
|
|
738
|
+
function it(e) {
|
|
739
|
+
if (Object.hasOwn(e, "enabled")) throw TypeError(`enabled is read from access and cannot be assigned; state access instead: ${rt(v)}`);
|
|
740
|
+
}
|
|
741
|
+
var at = 0, G = class {
|
|
713
742
|
get __v_skip() {
|
|
714
743
|
return !0;
|
|
715
744
|
}
|
|
@@ -722,7 +751,7 @@ var V = B, ze = Symbol("EnabledChangingAction"), H = class extends x {
|
|
|
722
751
|
#e;
|
|
723
752
|
#t;
|
|
724
753
|
constructor(e) {
|
|
725
|
-
this.#t = e, this.#e =
|
|
754
|
+
this.#t = e, this.#e = c(e);
|
|
726
755
|
}
|
|
727
756
|
get state() {
|
|
728
757
|
return this.#e;
|
|
@@ -731,10 +760,14 @@ var V = B, ze = Symbol("EnabledChangingAction"), H = class extends x {
|
|
|
731
760
|
return this.#t;
|
|
732
761
|
}
|
|
733
762
|
rebind(e) {
|
|
734
|
-
return
|
|
763
|
+
return A((t) => {
|
|
735
764
|
t.touch(this);
|
|
736
|
-
let n = t.willAnnounceValue(this), r = this.#t
|
|
737
|
-
this.resetTo(this.declaration, e),
|
|
765
|
+
let n = t.willAnnounceValue(this), { announcedValue: r, announcedContribution: i, validatedValue: a } = this.#t;
|
|
766
|
+
this.resetTo(this.declaration, e), n ? Object.assign(this.#t, {
|
|
767
|
+
announcedValue: r,
|
|
768
|
+
announcedContribution: i,
|
|
769
|
+
validatedValue: a
|
|
770
|
+
}) : this.recordAnnounced();
|
|
738
771
|
}), this;
|
|
739
772
|
}
|
|
740
773
|
get originalValue() {
|
|
@@ -755,19 +788,20 @@ var V = B, ze = Symbol("EnabledChangingAction"), H = class extends x {
|
|
|
755
788
|
extendedOf(e) {
|
|
756
789
|
let t = Object.create(null);
|
|
757
790
|
return Object.entries(e).forEach(([e, n]) => {
|
|
758
|
-
|
|
791
|
+
nt.has(e) || (!(e in this) || Object.hasOwn(Object.prototype, e)) && (t[e] = n);
|
|
759
792
|
}), t;
|
|
760
793
|
}
|
|
761
794
|
assignParams(e) {
|
|
795
|
+
it(e);
|
|
762
796
|
let t = this.extendedOf(e);
|
|
763
797
|
Object.entries(e).forEach(([e, n]) => {
|
|
764
|
-
Object.hasOwn(t, e) ||
|
|
798
|
+
Object.hasOwn(t, e) || nt.has(e) || (this[e] = n);
|
|
765
799
|
}), h(t) || this.setExtendedValues(t);
|
|
766
800
|
}
|
|
767
801
|
touchState() {
|
|
768
802
|
he()?.touch(this);
|
|
769
803
|
}
|
|
770
|
-
[
|
|
804
|
+
[E]() {
|
|
771
805
|
return {
|
|
772
806
|
...this.#t,
|
|
773
807
|
errors: [...this.#t.errors]
|
|
@@ -787,23 +821,13 @@ var V = B, ze = Symbol("EnabledChangingAction"), H = class extends x {
|
|
|
787
821
|
endValidating() {
|
|
788
822
|
this.#t.validatingCount !== 0 && (this.#e.validatingCount--, this.validating || this.container?.childValidatingChanged(!1));
|
|
789
823
|
}
|
|
790
|
-
childValidatingChanged(e) {
|
|
791
|
-
let t = this.validating;
|
|
792
|
-
this.#e.validatingChildren += e ? 1 : -1, this.validating !== t && this.container?.childValidatingChanged(e);
|
|
793
|
-
}
|
|
824
|
+
childValidatingChanged(e) {}
|
|
794
825
|
get busy() {
|
|
795
826
|
return !1;
|
|
796
827
|
}
|
|
797
|
-
get busyRead() {
|
|
798
|
-
let e = Ge.get(this);
|
|
799
|
-
return e || (e = n(() => this.composeBusy()), Ge.set(this, e)), e.value;
|
|
800
|
-
}
|
|
801
|
-
composeBusy() {
|
|
802
|
-
return !1;
|
|
803
|
-
}
|
|
804
828
|
settled() {
|
|
805
829
|
return !this.validating && !this.busy ? Promise.resolve() : new Promise((e) => {
|
|
806
|
-
let t =
|
|
830
|
+
let t = p(() => this.validating || this.busy, (n) => {
|
|
807
831
|
n || (t(), e());
|
|
808
832
|
}, { flush: "sync" });
|
|
809
833
|
});
|
|
@@ -836,30 +860,30 @@ var V = B, ze = Symbol("EnabledChangingAction"), H = class extends x {
|
|
|
836
860
|
return r(this), n;
|
|
837
861
|
}
|
|
838
862
|
markRecordIncomplete() {
|
|
839
|
-
this._recordPending || (this._recordPending = !0,
|
|
863
|
+
this._recordPending || (this._recordPending = !0, at++);
|
|
840
864
|
}
|
|
841
865
|
completeRecords(e = this) {
|
|
842
|
-
|
|
866
|
+
at !== 0 && A(() => {
|
|
843
867
|
let t = (e) => {
|
|
844
|
-
e._recordPending && (e._recordPending = !1,
|
|
868
|
+
e._recordPending && (e._recordPending = !1, at--, e.rerunEagerActions()), e.members.forEach(t);
|
|
845
869
|
};
|
|
846
870
|
t(e);
|
|
847
871
|
});
|
|
848
872
|
}
|
|
849
873
|
rerunEagerActions() {
|
|
850
|
-
|
|
851
|
-
this.boundActions?.triggerEager(this, this.
|
|
874
|
+
A((e) => {
|
|
875
|
+
this.boundActions?.triggerEager(this, this.contribution, this.contribution), e.markValidityDirty(this);
|
|
852
876
|
});
|
|
853
877
|
}
|
|
854
878
|
get boundActions() {
|
|
855
879
|
return this._actions;
|
|
856
880
|
}
|
|
857
881
|
noteBinding(e) {
|
|
858
|
-
let t =
|
|
859
|
-
t || (t = /* @__PURE__ */ new Set(),
|
|
882
|
+
let t = tt.get(this);
|
|
883
|
+
t || (t = /* @__PURE__ */ new Set(), tt.set(this, t)), t.add(new WeakRef(e));
|
|
860
884
|
}
|
|
861
885
|
get boundElements() {
|
|
862
|
-
let e = this.declaration, t =
|
|
886
|
+
let e = this.declaration, t = tt.get(e), n = [e];
|
|
863
887
|
return t && t.forEach((e) => {
|
|
864
888
|
let r = e.deref();
|
|
865
889
|
r ? n.push(r) : t.delete(e);
|
|
@@ -868,7 +892,7 @@ var V = B, ze = Symbol("EnabledChangingAction"), H = class extends x {
|
|
|
868
892
|
get actions() {
|
|
869
893
|
let e = this.declaration;
|
|
870
894
|
if (!e._actions) {
|
|
871
|
-
let t = new
|
|
895
|
+
let t = new Ae();
|
|
872
896
|
e.boundElements.forEach((e) => {
|
|
873
897
|
e._actions = t;
|
|
874
898
|
});
|
|
@@ -879,91 +903,158 @@ var V = B, ze = Symbol("EnabledChangingAction"), H = class extends x {
|
|
|
879
903
|
return this.#e.valueVersion;
|
|
880
904
|
}
|
|
881
905
|
bumpValueVersion() {
|
|
882
|
-
|
|
906
|
+
A((e) => {
|
|
883
907
|
e.touch(this), this.#e.valueVersion++;
|
|
884
908
|
let t = this.parent;
|
|
885
909
|
for (; t;) e.touch(t), t.#e.valueVersion++, t = t.parent;
|
|
886
910
|
});
|
|
887
911
|
}
|
|
888
912
|
propagateValueChanged(e = !1) {
|
|
889
|
-
|
|
913
|
+
A((t) => {
|
|
890
914
|
t.markValueChanged(this, e), t.markValidityDirty(this), this.parent?.notifyValueChanged();
|
|
891
915
|
});
|
|
892
916
|
}
|
|
893
917
|
constructed(e) {}
|
|
894
|
-
refreshPreviousValue() {
|
|
918
|
+
refreshPreviousValue() {
|
|
919
|
+
this.#t.announcedContribution = this.contribution;
|
|
920
|
+
}
|
|
895
921
|
get countedValid() {
|
|
896
922
|
return this.#t.errors.length === 0 && this.#t.invalidChildren === 0;
|
|
897
923
|
}
|
|
898
924
|
takeChild(e, t) {
|
|
899
|
-
|
|
925
|
+
A((n) => {
|
|
900
926
|
if (e.parent) throw TypeError("This element already belongs to a container - pass a bind() of it");
|
|
901
|
-
n.touch(e), e.#e.fieldName = t
|
|
927
|
+
n.touch(e), e.#e.fieldName = t;
|
|
928
|
+
let r = this.effectiveAccess === "editable" ? void 0 : e.effectiveAccessFromHere();
|
|
929
|
+
e.#e.parent = this, r && e.revalidateWhereChanged(r), this.adoptChild(e);
|
|
902
930
|
});
|
|
903
931
|
}
|
|
904
932
|
adoptChild(e) {
|
|
905
|
-
|
|
906
|
-
t.touch(this), e.#t.valid
|
|
933
|
+
A((t) => {
|
|
934
|
+
t.touch(this), !e.#t.valid && e.countsInContainer && this.#t.invalidChildren++, e.validating && this.childValidatingChanged(!0), t.whenRolledBack(() => {
|
|
907
935
|
e.validating && this.childValidatingChanged(!1);
|
|
908
936
|
}), t.markValidityDirty(this);
|
|
909
937
|
});
|
|
910
938
|
}
|
|
911
939
|
releaseChild(e) {
|
|
912
|
-
|
|
913
|
-
t.touch(this), t.touch(e), e.#t.valid
|
|
940
|
+
A((t) => {
|
|
941
|
+
t.touch(this), t.touch(e), !e.#t.valid && e.countsInContainer && this.#t.invalidChildren--;
|
|
942
|
+
let n = this.effectiveAccess === "editable" ? void 0 : e.effectiveAccessFromHere();
|
|
943
|
+
e.validating && this.childValidatingChanged(!1), t.whenRolledBack(() => {
|
|
914
944
|
e.validating && this.childValidatingChanged(!0);
|
|
915
|
-
}), e.#e.parent = void 0, e.#e.fieldName = void 0, t.markValidityDirty(this);
|
|
945
|
+
}), e.#e.parent = void 0, e.#e.fieldName = void 0, n && e.revalidateWhereChanged(n), t.markValidityDirty(this);
|
|
916
946
|
});
|
|
917
947
|
}
|
|
918
948
|
resetTo(e, t) {
|
|
919
|
-
|
|
949
|
+
A(() => {
|
|
920
950
|
let n = t === void 0 ? e.value : t, r = this.errors.length > 0;
|
|
921
951
|
r && (this.errors = []), this.touched = !1;
|
|
922
|
-
let i = this.
|
|
952
|
+
let i = this.value !== n;
|
|
923
953
|
this.value = n, this.originalValue = this.value, this.validate(!i && r);
|
|
924
954
|
});
|
|
925
955
|
}
|
|
926
956
|
resetChild(e, t, n) {
|
|
927
957
|
e.resetTo(t, n);
|
|
928
958
|
}
|
|
929
|
-
childValidityChanged(e) {
|
|
930
|
-
this.#t.invalidChildren += e ? -1 : 1;
|
|
931
|
-
}
|
|
932
|
-
get validRead() {
|
|
933
|
-
let e = We.get(this);
|
|
934
|
-
return e || (e = n(() => this.composeValid()), We.set(this, e)), e.value;
|
|
935
|
-
}
|
|
936
|
-
composeValid() {
|
|
937
|
-
return this.#e.errors.length === 0;
|
|
938
|
-
}
|
|
959
|
+
childValidityChanged(e) {}
|
|
939
960
|
get visibility() {
|
|
940
961
|
return this.#e.visibility;
|
|
941
962
|
}
|
|
942
963
|
set visibility(e) {
|
|
943
964
|
let t = this.#e.visibility;
|
|
944
|
-
e !== t &&
|
|
945
|
-
let r = this.boundActions?.trigger(
|
|
946
|
-
if (
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
965
|
+
e !== t && A((n) => {
|
|
966
|
+
let r = this.boundActions?.trigger(Qe, this, e, t);
|
|
967
|
+
if (r instanceof C) return;
|
|
968
|
+
let i = r ?? e;
|
|
969
|
+
if (!x(i)) throw Error(`${W(i)} is not a visibility: ${rt(y)}`);
|
|
970
|
+
n.touch(this), this.#e.visibility = i, this.boundActions?.trigger(et, this, i, t);
|
|
950
971
|
});
|
|
951
972
|
}
|
|
952
|
-
get
|
|
953
|
-
return this.#e.
|
|
954
|
-
}
|
|
955
|
-
set
|
|
956
|
-
let t = this.#e.
|
|
957
|
-
e !== t &&
|
|
958
|
-
let r = this.boundActions?.trigger(
|
|
959
|
-
if (
|
|
960
|
-
|
|
961
|
-
|
|
973
|
+
get access() {
|
|
974
|
+
return this.#e.access;
|
|
975
|
+
}
|
|
976
|
+
set access(e) {
|
|
977
|
+
let t = this.#e.access;
|
|
978
|
+
e !== t && A((n) => {
|
|
979
|
+
let r = this.boundActions?.trigger(Ve, this, e, t);
|
|
980
|
+
if (r instanceof C) return;
|
|
981
|
+
let i = r ?? e;
|
|
982
|
+
if (!se(i)) throw Error(`${W(i)} is not an access: ${rt(v)}`);
|
|
983
|
+
if (i === t) return;
|
|
984
|
+
let a = this.enabled, o = i === "editable";
|
|
985
|
+
if (o !== a) {
|
|
986
|
+
let e = this.boundActions?.trigger(Ke, this, o, a);
|
|
987
|
+
if (e instanceof C) return;
|
|
988
|
+
if (e != null && typeof e != "boolean") throw Error(`${W(e)} is not what an EnabledChangingAction answers with: a boolean`);
|
|
989
|
+
if (e === a) return;
|
|
962
990
|
}
|
|
991
|
+
n.touch(this);
|
|
992
|
+
let s = this.contribution, c = this.countsInContainer, l = this.effectiveAccessBelow();
|
|
993
|
+
this.#e.access = i, this.revalidateWhereChanged(l), this.composesValue || this.boundActions?.triggerEager(this, this.contribution, s), this.contributionChanged(n, c), this.boundActions?.trigger(Ue, this, i, t), this.enabled !== a && this.boundActions?.trigger(Je, this, this.enabled, a);
|
|
963
994
|
});
|
|
964
995
|
}
|
|
996
|
+
get effectiveAccess() {
|
|
997
|
+
let e = this.access, t = this.parent?.effectiveAccess;
|
|
998
|
+
return t === "disabled" || t === "disabled-null" ? "disabled" : t === "readonly" && e === "editable" ? "readonly" : e;
|
|
999
|
+
}
|
|
1000
|
+
[ce]() {
|
|
1001
|
+
if (this.#t.access === "disabled") return !0;
|
|
1002
|
+
for (let e = this.#t.parent; e; e = e.#t.parent) if (e.#t.access === "disabled" || e.#t.access === "disabled-null") return !0;
|
|
1003
|
+
return !1;
|
|
1004
|
+
}
|
|
1005
|
+
get enabled() {
|
|
1006
|
+
return this.access === "editable";
|
|
1007
|
+
}
|
|
965
1008
|
get effectiveEnabled() {
|
|
966
|
-
return this.
|
|
1009
|
+
return this.effectiveAccess === "editable";
|
|
1010
|
+
}
|
|
1011
|
+
effectiveAccessFromHere() {
|
|
1012
|
+
let e = this.effectiveAccessBelow();
|
|
1013
|
+
return e.set(this, this.effectiveAccess), e;
|
|
1014
|
+
}
|
|
1015
|
+
effectiveAccessBelow() {
|
|
1016
|
+
let e = /* @__PURE__ */ new Map(), t = (n) => {
|
|
1017
|
+
n.members.forEach((n) => {
|
|
1018
|
+
e.set(n, n.effectiveAccess), t(n);
|
|
1019
|
+
});
|
|
1020
|
+
};
|
|
1021
|
+
return t(this), e;
|
|
1022
|
+
}
|
|
1023
|
+
revalidateWhereChanged(e) {
|
|
1024
|
+
e.forEach((e, t) => {
|
|
1025
|
+
t.effectiveAccess !== e && t.rerunEagerActions();
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
serializesAs(e) {
|
|
1029
|
+
if (e === "fullValue") return "value";
|
|
1030
|
+
switch (this.access) {
|
|
1031
|
+
case "disabled": return "omit";
|
|
1032
|
+
case "disabled-null": return "null";
|
|
1033
|
+
default: return "value";
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
childSerializesAs(e, t) {
|
|
1037
|
+
return e.serializesAs(t);
|
|
1038
|
+
}
|
|
1039
|
+
get contribution() {
|
|
1040
|
+
switch (this.serializesAs("value")) {
|
|
1041
|
+
case "omit": return;
|
|
1042
|
+
case "null": return null;
|
|
1043
|
+
default: return this.value;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
get holding() {
|
|
1047
|
+
return this.value;
|
|
1048
|
+
}
|
|
1049
|
+
get countsInContainer() {
|
|
1050
|
+
return this.serializesAs("value") !== "omit";
|
|
1051
|
+
}
|
|
1052
|
+
contributionChanged(e, t) {
|
|
1053
|
+
e.markValueChanged(this, !1), e.markValidityDirty(this), this.bumpValueVersion();
|
|
1054
|
+
let n = this.container;
|
|
1055
|
+
if (!n) return;
|
|
1056
|
+
let r = this.countsInContainer;
|
|
1057
|
+
r !== t && !this.#t.valid && (e.touch(n), n.childValidityChanged(!r), e.markValidityDirty(n)), this.parent.notifyValueChanged();
|
|
967
1058
|
}
|
|
968
1059
|
get composesValue() {
|
|
969
1060
|
return !1;
|
|
@@ -973,21 +1064,34 @@ var V = B, ze = Symbol("EnabledChangingAction"), H = class extends x {
|
|
|
973
1064
|
}
|
|
974
1065
|
[ue](e, t, n, r) {
|
|
975
1066
|
if (r?.forEach((e) => this.boundActions?.trigger(e.actionClass, this, e.item, e.index)), !t) return;
|
|
976
|
-
let i = this.boundActions;
|
|
977
|
-
if (
|
|
978
|
-
|
|
979
|
-
|
|
1067
|
+
let i = this.boundActions, a = this.composesValue, o = (e, t) => a ? g(e, t) : e === t;
|
|
1068
|
+
if (a && i?.hasEager) {
|
|
1069
|
+
let t = this.contribution, r = this.#t.validatedValue;
|
|
1070
|
+
(n || !g(t, r)) && (e.touch(this), this.#t.validatedValue = t, i.triggerEager(this, t, r));
|
|
1071
|
+
}
|
|
1072
|
+
if (!a || i?.willTrigger(w)) {
|
|
1073
|
+
let t = this.holding, r = this.#t.announcedValue;
|
|
1074
|
+
(n || !o(t, r)) && (e.touch(this), this.#t.announcedValue = t, i?.trigger(T, this, t, r));
|
|
1075
|
+
}
|
|
1076
|
+
if (i?.willTrigger(We)) {
|
|
1077
|
+
let t = this.contribution, n = this.#t.announcedContribution;
|
|
1078
|
+
o(t, n) || (e.touch(this), this.#t.announcedContribution = t, i.trigger(U, this, t, n));
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
recordAnnounced() {
|
|
1082
|
+
let e = this.boundActions;
|
|
1083
|
+
(!this.composesValue || e?.willTrigger(w)) && (this.#t.announcedValue = this.holding), e?.willTrigger(We) && (this.#t.announcedContribution = this.contribution), this.composesValue && e?.hasEager && (this.#t.validatedValue = this.contribution);
|
|
980
1084
|
}
|
|
981
1085
|
[de](e) {
|
|
982
1086
|
let t = this.#t.valid, n = this.countedValid;
|
|
983
1087
|
if (n === t) return;
|
|
984
1088
|
e.touch(this), this.#t.valid = n;
|
|
985
1089
|
let r = this.container;
|
|
986
|
-
r && (e.touch(r), r.childValidityChanged(n), e.markValidityDirty(r)), this.boundActions?.trigger(
|
|
1090
|
+
r && this.countsInContainer && (e.touch(r), r.childValidityChanged(n), e.markValidityDirty(r)), this.boundActions?.trigger(Xe, this, n, t);
|
|
987
1091
|
}
|
|
988
1092
|
validate(e = !1) {
|
|
989
|
-
|
|
990
|
-
e && this.boundActions?.triggerEager(this, this.
|
|
1093
|
+
A((t) => {
|
|
1094
|
+
e && this.boundActions?.triggerEager(this, this.contribution, this.contribution), t.markValidityDirty(this);
|
|
991
1095
|
});
|
|
992
1096
|
}
|
|
993
1097
|
get valid() {
|
|
@@ -1000,7 +1104,7 @@ var V = B, ze = Symbol("EnabledChangingAction"), H = class extends x {
|
|
|
1000
1104
|
return !g(this.value, this.originalValue);
|
|
1001
1105
|
}
|
|
1002
1106
|
boundFrom(e, t, n, r) {
|
|
1003
|
-
this.#t.declaration = e.declaration;
|
|
1107
|
+
r && it(r), this.#t.declaration = e.declaration;
|
|
1004
1108
|
let i = {
|
|
1005
1109
|
...e.extra,
|
|
1006
1110
|
...r && this.extendedOf(r)
|
|
@@ -1009,7 +1113,7 @@ var V = B, ze = Symbol("EnabledChangingAction"), H = class extends x {
|
|
|
1009
1113
|
let a = this.declaration;
|
|
1010
1114
|
a.noteBinding(this);
|
|
1011
1115
|
let o = a._actions;
|
|
1012
|
-
o && (this._actions = o, o.bindTo(this), o.triggerEager(this, t, n));
|
|
1116
|
+
o && (this._actions = o, o.bindTo(this), this.recordAnnounced(), o.triggerEager(this, t, n));
|
|
1013
1117
|
}
|
|
1014
1118
|
registerInitialActions(e) {
|
|
1015
1119
|
e.forEach((e) => {
|
|
@@ -1017,21 +1121,21 @@ var V = B, ze = Symbol("EnabledChangingAction"), H = class extends x {
|
|
|
1017
1121
|
});
|
|
1018
1122
|
}
|
|
1019
1123
|
registerAction(e) {
|
|
1020
|
-
return
|
|
1124
|
+
return A((t) => {
|
|
1021
1125
|
t.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(e), this.registered(t, e);
|
|
1022
1126
|
}), this;
|
|
1023
1127
|
}
|
|
1024
1128
|
registerActionBefore(e, t) {
|
|
1025
|
-
return
|
|
1129
|
+
return A((n) => {
|
|
1026
1130
|
n.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(e, t), this.registered(n, e);
|
|
1027
1131
|
}), this;
|
|
1028
1132
|
}
|
|
1029
1133
|
unregisterAction(e) {
|
|
1030
1134
|
let t = !1;
|
|
1031
|
-
return
|
|
1135
|
+
return A((n) => {
|
|
1032
1136
|
let r = this.boundActions;
|
|
1033
1137
|
if (!r || (t = r.unregister(e), !t)) return;
|
|
1034
|
-
n.touch(this), e instanceof
|
|
1138
|
+
n.touch(this), e instanceof R && this.#e.validationEpoch++;
|
|
1035
1139
|
let i = this.boundElements;
|
|
1036
1140
|
n.whenRolledBack(() => {
|
|
1037
1141
|
r.register(e), i.forEach((t) => e.boundToBinding(t));
|
|
@@ -1041,7 +1145,7 @@ var V = B, ze = Symbol("EnabledChangingAction"), H = class extends x {
|
|
|
1041
1145
|
registered(e, t) {
|
|
1042
1146
|
let n = this.boundElements;
|
|
1043
1147
|
n.forEach((e) => {
|
|
1044
|
-
t.boundToBinding(e), t.eager && this.actions.triggerEagerFor(t.classIdentifier, e, e.
|
|
1148
|
+
t.boundToBinding(e), t.eager && (e.#t.validatedValue = e.contribution, this.actions.triggerEagerFor(t.classIdentifier, e, e.contribution, e.originalValue));
|
|
1045
1149
|
}), e.whenRolledBack(() => {
|
|
1046
1150
|
this.boundActions?.unregister(t) && n.forEach((e) => t.unregisterFrom(e));
|
|
1047
1151
|
});
|
|
@@ -1054,7 +1158,7 @@ var V = B, ze = Symbol("EnabledChangingAction"), H = class extends x {
|
|
|
1054
1158
|
return this.#e.validationEpoch;
|
|
1055
1159
|
}
|
|
1056
1160
|
clearValidators() {
|
|
1057
|
-
|
|
1161
|
+
A((e) => {
|
|
1058
1162
|
e.touch(this), this.#e.validationEpoch++;
|
|
1059
1163
|
let t = this.boundActions;
|
|
1060
1164
|
if (t) {
|
|
@@ -1071,10 +1175,10 @@ var V = B, ze = Symbol("EnabledChangingAction"), H = class extends x {
|
|
|
1071
1175
|
};
|
|
1072
1176
|
//#endregion
|
|
1073
1177
|
//#region src/actions/conditional/statement.ts
|
|
1074
|
-
function
|
|
1178
|
+
function ot(e, t) {
|
|
1075
1179
|
return e ? !t : t;
|
|
1076
1180
|
}
|
|
1077
|
-
var
|
|
1181
|
+
var st = class e {
|
|
1078
1182
|
operand1;
|
|
1079
1183
|
operator;
|
|
1080
1184
|
operand2;
|
|
@@ -1083,13 +1187,13 @@ var Je = class e {
|
|
|
1083
1187
|
if (typeof e == "function") throw TypeError(`Statement operand ${t} is a function: an operand is a field, a nested statement or a literal, and a function is none of them. An accessor states the field it answers with: group.field('name').`);
|
|
1084
1188
|
}
|
|
1085
1189
|
constructor(t, n, r) {
|
|
1086
|
-
e.validateOperand(t, 1), n !==
|
|
1190
|
+
e.validateOperand(t, 1), n !== H.NOT && e.validateOperand(r, 2), this.operand1 = t, this.operator = n, this.operand2 = r;
|
|
1087
1191
|
}
|
|
1088
1192
|
static valueOf(t, n) {
|
|
1089
1193
|
if (t instanceof e) return t.evaluate(n);
|
|
1090
|
-
if (t instanceof
|
|
1091
|
-
let e = n ?
|
|
1092
|
-
return e ?
|
|
1194
|
+
if (t instanceof G) {
|
|
1195
|
+
let e = n ? Ne(t, n) : t;
|
|
1196
|
+
return e ? f(e.value) : void 0;
|
|
1093
1197
|
}
|
|
1094
1198
|
return t;
|
|
1095
1199
|
}
|
|
@@ -1102,70 +1206,72 @@ var Je = class e {
|
|
|
1102
1206
|
evaluate(t) {
|
|
1103
1207
|
let n = e.valueOf(this.operand1, t), r = e.valueOf(this.operand2, t);
|
|
1104
1208
|
switch (this.operator) {
|
|
1105
|
-
case
|
|
1106
|
-
case
|
|
1107
|
-
case
|
|
1108
|
-
case
|
|
1109
|
-
case
|
|
1110
|
-
case
|
|
1111
|
-
case
|
|
1112
|
-
case
|
|
1113
|
-
case
|
|
1114
|
-
case
|
|
1115
|
-
case
|
|
1116
|
-
case
|
|
1117
|
-
case
|
|
1118
|
-
case
|
|
1119
|
-
case
|
|
1120
|
-
case
|
|
1209
|
+
case H.AND: return !!(n && r);
|
|
1210
|
+
case H.OR: return !!(n || r);
|
|
1211
|
+
case H.NAND: return !(n && r);
|
|
1212
|
+
case H.NOR: return !(n || r);
|
|
1213
|
+
case H.XOR: return ot(!!n, !!r);
|
|
1214
|
+
case H.NOT: return !n;
|
|
1215
|
+
case H.EQUALS: return n == r;
|
|
1216
|
+
case H.NOT_EQUALS: return n != r;
|
|
1217
|
+
case H.LT: return n < r;
|
|
1218
|
+
case H.LE: return n <= r;
|
|
1219
|
+
case H.GE: return n >= r;
|
|
1220
|
+
case H.GT: return n > r;
|
|
1221
|
+
case H.IN: return !!r?.includes?.(n);
|
|
1222
|
+
case H.NOT_IN: return !r?.includes?.(n);
|
|
1223
|
+
case H.INCLUDES: return _(n) && _(r) && n.indexOf(r) >= 0;
|
|
1224
|
+
case H.NOT_INCLUDES: return !(_(n) && _(r) && n.indexOf(r) >= 0);
|
|
1121
1225
|
default: throw Error(`Operator not implemented ${this.operator}`);
|
|
1122
1226
|
}
|
|
1123
1227
|
}
|
|
1124
1228
|
collectFields() {
|
|
1125
1229
|
let t = /* @__PURE__ */ new Set();
|
|
1126
1230
|
function n(n) {
|
|
1127
|
-
n instanceof
|
|
1231
|
+
n instanceof G ? t.add(n) : n instanceof e && n.collectFields().forEach((e) => t.add(e));
|
|
1128
1232
|
}
|
|
1129
1233
|
return n(this.operand1), n(this.operand2), t;
|
|
1130
1234
|
}
|
|
1131
|
-
},
|
|
1235
|
+
}, ct = Symbol("ExecuteAction"), lt = class extends S {
|
|
1132
1236
|
constructor(e) {
|
|
1133
1237
|
super(e);
|
|
1134
1238
|
}
|
|
1135
1239
|
static get classIdentifier() {
|
|
1136
|
-
return
|
|
1240
|
+
return ct;
|
|
1137
1241
|
}
|
|
1138
1242
|
execute(e, t, n) {
|
|
1139
1243
|
return super.execute(e, t, n);
|
|
1140
1244
|
}
|
|
1141
|
-
},
|
|
1245
|
+
}, ut = Symbol("ListItemAddedAction"), K = class extends S {
|
|
1142
1246
|
constructor(e) {
|
|
1143
1247
|
super(e);
|
|
1144
1248
|
}
|
|
1145
1249
|
static get classIdentifier() {
|
|
1146
|
-
return
|
|
1250
|
+
return ut;
|
|
1147
1251
|
}
|
|
1148
1252
|
execute(e, t, n, r) {
|
|
1149
1253
|
return super.execute(e, t, n, r);
|
|
1150
1254
|
}
|
|
1151
|
-
},
|
|
1255
|
+
}, dt = Symbol("ListItemRemovedAction"), ft = class extends S {
|
|
1152
1256
|
constructor(e) {
|
|
1153
1257
|
super(e);
|
|
1154
1258
|
}
|
|
1155
1259
|
static get classIdentifier() {
|
|
1156
|
-
return
|
|
1260
|
+
return dt;
|
|
1157
1261
|
}
|
|
1158
1262
|
execute(e, t, n, r) {
|
|
1159
1263
|
return super.execute(e, t, n, r);
|
|
1160
1264
|
}
|
|
1161
|
-
},
|
|
1162
|
-
function
|
|
1265
|
+
}, pt = Object.freeze({});
|
|
1266
|
+
function mt() {
|
|
1163
1267
|
return {
|
|
1164
1268
|
originalValue: void 0,
|
|
1165
1269
|
announcedValue: void 0,
|
|
1270
|
+
announcedContribution: void 0,
|
|
1271
|
+
validatedValue: void 0,
|
|
1166
1272
|
errors: [],
|
|
1167
|
-
visibility: b
|
|
1168
|
-
|
|
1273
|
+
visibility: b,
|
|
1274
|
+
access: oe,
|
|
1169
1275
|
valueVersion: 0,
|
|
1170
1276
|
validatingCount: 0,
|
|
1171
1277
|
validatingChildren: 0,
|
|
@@ -1173,35 +1279,35 @@ function et() {
|
|
|
1173
1279
|
fieldName: void 0,
|
|
1174
1280
|
validationEpoch: 0,
|
|
1175
1281
|
declaration: void 0,
|
|
1176
|
-
extra:
|
|
1282
|
+
extra: pt,
|
|
1177
1283
|
valid: !0,
|
|
1178
1284
|
invalidChildren: 0
|
|
1179
1285
|
};
|
|
1180
1286
|
}
|
|
1181
|
-
function
|
|
1287
|
+
function ht() {
|
|
1182
1288
|
return {
|
|
1183
|
-
...
|
|
1289
|
+
...mt(),
|
|
1184
1290
|
value: void 0,
|
|
1185
1291
|
touched: !1
|
|
1186
1292
|
};
|
|
1187
1293
|
}
|
|
1188
|
-
function
|
|
1294
|
+
function gt() {
|
|
1189
1295
|
return {
|
|
1190
|
-
...
|
|
1296
|
+
...mt(),
|
|
1191
1297
|
announcedValue: null,
|
|
1192
1298
|
cachedValue: null,
|
|
1193
1299
|
cachedValueVersion: -1
|
|
1194
1300
|
};
|
|
1195
1301
|
}
|
|
1196
|
-
function
|
|
1302
|
+
function _t() {
|
|
1197
1303
|
return {
|
|
1198
|
-
...
|
|
1304
|
+
...gt(),
|
|
1199
1305
|
fieldNames: []
|
|
1200
1306
|
};
|
|
1201
1307
|
}
|
|
1202
|
-
function
|
|
1308
|
+
function vt() {
|
|
1203
1309
|
return {
|
|
1204
|
-
...
|
|
1310
|
+
...gt(),
|
|
1205
1311
|
rows: null,
|
|
1206
1312
|
rowsVersion: 0,
|
|
1207
1313
|
cachedItems: null,
|
|
@@ -1210,7 +1316,7 @@ function it() {
|
|
|
1210
1316
|
}
|
|
1211
1317
|
//#endregion
|
|
1212
1318
|
//#region src/field.ts
|
|
1213
|
-
var
|
|
1319
|
+
var q = class extends G {
|
|
1214
1320
|
get [Symbol.toStringTag]() {
|
|
1215
1321
|
return "Field";
|
|
1216
1322
|
}
|
|
@@ -1227,15 +1333,15 @@ var Q = class extends Y {
|
|
|
1227
1333
|
this.state.value = e;
|
|
1228
1334
|
}
|
|
1229
1335
|
constructor(e) {
|
|
1230
|
-
super(
|
|
1336
|
+
super(ht()), this.init(e);
|
|
1231
1337
|
}
|
|
1232
1338
|
init(e) {
|
|
1233
|
-
|
|
1339
|
+
A(() => {
|
|
1234
1340
|
if (e) {
|
|
1235
1341
|
let { value: t, validators: n, actions: r, ...i } = e;
|
|
1236
1342
|
this.registerInitialActions([...n || [], ...r || []]), this.assignParams(i), this._value = t === void 0 ? this.originalValue : t;
|
|
1237
1343
|
}
|
|
1238
|
-
this.constructed(e), this.originalValue === void 0 && (this.originalValue = this._value), this.
|
|
1344
|
+
this.constructed(e), this.originalValue === void 0 && (this.originalValue = this._value), this.recordAnnounced(), this.boundActions?.triggerEager(this, this.contribution, this.originalValue), this.validate();
|
|
1239
1345
|
});
|
|
1240
1346
|
}
|
|
1241
1347
|
get value() {
|
|
@@ -1243,13 +1349,10 @@ var Q = class extends Y {
|
|
|
1243
1349
|
}
|
|
1244
1350
|
set value(e) {
|
|
1245
1351
|
let t = this._value;
|
|
1246
|
-
|
|
1247
|
-
n.touch(this), this._value = e, this.bumpValueVersion(), this.boundActions?.triggerEager(this, e, t), this.propagateValueChanged();
|
|
1352
|
+
t !== e && A((n) => {
|
|
1353
|
+
n.touch(this), this._value = e, this.bumpValueVersion(), this.serializesAs("value") === "value" && this.boundActions?.triggerEager(this, e, t), this.propagateValueChanged();
|
|
1248
1354
|
});
|
|
1249
1355
|
}
|
|
1250
|
-
get parent() {
|
|
1251
|
-
return super.parent;
|
|
1252
|
-
}
|
|
1253
1356
|
get touched() {
|
|
1254
1357
|
return this.state.touched;
|
|
1255
1358
|
}
|
|
@@ -1260,31 +1363,31 @@ var Q = class extends Y {
|
|
|
1260
1363
|
let n = this.constructor, r = new n({
|
|
1261
1364
|
value: e === void 0 ? this.value : e,
|
|
1262
1365
|
...t && "originalValue" in t ? { originalValue: t.originalValue } : {},
|
|
1263
|
-
|
|
1366
|
+
access: t?.access ?? this.access,
|
|
1264
1367
|
visibility: t?.visibility ?? this.visibility
|
|
1265
1368
|
});
|
|
1266
|
-
return r.boundFrom(this, r.
|
|
1369
|
+
return r.boundFrom(this, r.contribution, r.originalValue, t), r;
|
|
1267
1370
|
}
|
|
1268
|
-
},
|
|
1269
|
-
function
|
|
1371
|
+
}, yt = /* @__PURE__ */ new WeakMap();
|
|
1372
|
+
function bt(e) {
|
|
1270
1373
|
if (e != null) return Object.values(e).some((e) => e != null) ? e : void 0;
|
|
1271
1374
|
}
|
|
1272
|
-
var
|
|
1375
|
+
var xt = class extends q {
|
|
1273
1376
|
get [Symbol.toStringTag]() {
|
|
1274
1377
|
return "Action";
|
|
1275
1378
|
}
|
|
1276
1379
|
init(e) {
|
|
1277
|
-
|
|
1380
|
+
A(() => {
|
|
1278
1381
|
if (this._value = {
|
|
1279
1382
|
label: void 0,
|
|
1280
1383
|
icon: void 0
|
|
1281
1384
|
}, e) {
|
|
1282
1385
|
let { value: t, originalValue: n, validators: r, actions: i, ...a } = e;
|
|
1283
1386
|
this.registerInitialActions([...r || [], ...i || []]), this.assignParams(a);
|
|
1284
|
-
let o =
|
|
1387
|
+
let o = bt(t), s = bt(n);
|
|
1285
1388
|
o ? this._value = o : s && (this._value = { ...s }), s && (this.originalValue = Object.freeze({ ...s }));
|
|
1286
1389
|
}
|
|
1287
|
-
this.constructed(e), this.originalValue === void 0 && (this.originalValue = this._value), this.
|
|
1390
|
+
this.constructed(e), this.originalValue === void 0 && (this.originalValue = this._value), this.recordAnnounced(), this.boundActions?.triggerEager(this, this.contribution, this.originalValue), this.validate();
|
|
1288
1391
|
});
|
|
1289
1392
|
}
|
|
1290
1393
|
valueWith(e, t) {
|
|
@@ -1304,8 +1407,8 @@ var st = class extends Q {
|
|
|
1304
1407
|
this.value.label !== e && (this.value = this.valueWith("label", e));
|
|
1305
1408
|
}
|
|
1306
1409
|
get busyRuns() {
|
|
1307
|
-
let e =
|
|
1308
|
-
return e || (e =
|
|
1410
|
+
let e = yt.get(this);
|
|
1411
|
+
return e || (e = l(0), yt.set(this, e)), e;
|
|
1309
1412
|
}
|
|
1310
1413
|
get busy() {
|
|
1311
1414
|
return this.busyRuns.value > 0;
|
|
@@ -1314,19 +1417,19 @@ var st = class extends Q {
|
|
|
1314
1417
|
let t = this.busyRuns;
|
|
1315
1418
|
t.value++;
|
|
1316
1419
|
try {
|
|
1317
|
-
return await this.triggerAction(
|
|
1420
|
+
return await this.triggerAction(lt, e);
|
|
1318
1421
|
} finally {
|
|
1319
1422
|
t.value--;
|
|
1320
1423
|
}
|
|
1321
1424
|
}
|
|
1322
|
-
},
|
|
1425
|
+
}, St = /* @__PURE__ */ i({
|
|
1323
1426
|
__name: "messages-widget",
|
|
1324
1427
|
props: {
|
|
1325
1428
|
message: {},
|
|
1326
1429
|
classes: {}
|
|
1327
1430
|
},
|
|
1328
1431
|
setup(e) {
|
|
1329
|
-
let t = e, n =
|
|
1432
|
+
let t = e, n = u("vue-markdown"), i = /* @__PURE__ */ new Set(/* @__PURE__ */ "div.span.p.h1.h2.h3.h4.h5.h6.section.article.aside.nav.header.footer.main.figure.figcaption.blockquote.pre.code.em.strong.small.mark.del.ins.sub.sup.i.b.u.s.a.img.button.input.textarea.select.option.label.form.table.tr.td.th.thead.tbody.tfoot.ul.ol.li.dl.dt.dd".split(".")), o = () => {
|
|
1330
1433
|
if (typeof t.message == "string") return a("span", { class: t.classes }, t.message);
|
|
1331
1434
|
let e = [];
|
|
1332
1435
|
return t.message.forEach((r) => {
|
|
@@ -1350,7 +1453,7 @@ var st = class extends Q {
|
|
|
1350
1453
|
}));
|
|
1351
1454
|
}
|
|
1352
1455
|
break;
|
|
1353
|
-
default: e.push(a(i.has(r.componentName.toLowerCase()) ? r.componentName :
|
|
1456
|
+
default: e.push(a(i.has(r.componentName.toLowerCase()) ? r.componentName : u(r.componentName), {
|
|
1354
1457
|
class: [t.classes, r.extraClasses],
|
|
1355
1458
|
...r.componentBindings,
|
|
1356
1459
|
...r.componentBody ? { innerHTML: r.componentBody } : {}
|
|
@@ -1360,7 +1463,59 @@ var st = class extends Q {
|
|
|
1360
1463
|
};
|
|
1361
1464
|
return (e, t) => (s(), r(o));
|
|
1362
1465
|
}
|
|
1363
|
-
}),
|
|
1466
|
+
}), Ct = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakMap(), J = class extends G {
|
|
1467
|
+
get [Symbol.toStringTag]() {
|
|
1468
|
+
return "Container";
|
|
1469
|
+
}
|
|
1470
|
+
get touched() {
|
|
1471
|
+
return this.children.some((e) => e.touched);
|
|
1472
|
+
}
|
|
1473
|
+
set touched(e) {
|
|
1474
|
+
A(() => {
|
|
1475
|
+
this.members.forEach((t) => {
|
|
1476
|
+
t.touched = e;
|
|
1477
|
+
});
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1480
|
+
get valid() {
|
|
1481
|
+
return this.validRead;
|
|
1482
|
+
}
|
|
1483
|
+
get busy() {
|
|
1484
|
+
return this.busyRead;
|
|
1485
|
+
}
|
|
1486
|
+
validate(e = !1) {
|
|
1487
|
+
A(() => {
|
|
1488
|
+
e && this.members.forEach((e) => e.validate(!0)), super.validate(e);
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
notifyValueChanged() {
|
|
1492
|
+
this.propagateValueChanged();
|
|
1493
|
+
}
|
|
1494
|
+
get composesValue() {
|
|
1495
|
+
return !0;
|
|
1496
|
+
}
|
|
1497
|
+
refreshPreviousValue() {
|
|
1498
|
+
super.refreshPreviousValue(), this.raw.announcedValue = this.holding;
|
|
1499
|
+
}
|
|
1500
|
+
get holding() {
|
|
1501
|
+
return this.fullValue;
|
|
1502
|
+
}
|
|
1503
|
+
get validRead() {
|
|
1504
|
+
let e = Ct.get(this);
|
|
1505
|
+
return e || (e = n(() => this.state.errors.length === 0 && this.children.every((e) => e.valid || this.childSerializesAs(e, "value") === "omit")), Ct.set(this, e)), e.value;
|
|
1506
|
+
}
|
|
1507
|
+
get busyRead() {
|
|
1508
|
+
let e = wt.get(this);
|
|
1509
|
+
return e || (e = n(() => this.children.some((e) => e.busy)), wt.set(this, e)), e.value;
|
|
1510
|
+
}
|
|
1511
|
+
childValidatingChanged(e) {
|
|
1512
|
+
let t = this.validating;
|
|
1513
|
+
this.state.validatingChildren += e ? 1 : -1, this.validating !== t && this.parent?.childValidatingChanged(e);
|
|
1514
|
+
}
|
|
1515
|
+
childValidityChanged(e) {
|
|
1516
|
+
this.raw.invalidChildren += e ? -1 : 1;
|
|
1517
|
+
}
|
|
1518
|
+
}, Tt = /* @__PURE__ */ new WeakSet(), Et = Object.freeze({}), Dt = /* @__PURE__ */ new WeakMap(), Ot = (e) => ({
|
|
1364
1519
|
get(t, n, r) {
|
|
1365
1520
|
return e(), Reflect.get(t, n, r);
|
|
1366
1521
|
},
|
|
@@ -1382,7 +1537,7 @@ var st = class extends Q {
|
|
|
1382
1537
|
deleteProperty(e, t) {
|
|
1383
1538
|
throw TypeError(`fields.${String(t)} cannot be deleted: use removeField() to take a member out`);
|
|
1384
1539
|
}
|
|
1385
|
-
}),
|
|
1540
|
+
}), Y = class e extends J {
|
|
1386
1541
|
get [Symbol.toStringTag]() {
|
|
1387
1542
|
return "Group";
|
|
1388
1543
|
}
|
|
@@ -1394,33 +1549,38 @@ var st = class extends Q {
|
|
|
1394
1549
|
}
|
|
1395
1550
|
_fields;
|
|
1396
1551
|
constructor(t, n) {
|
|
1397
|
-
if (super(
|
|
1398
|
-
this._fields = Object.create(null),
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1552
|
+
if (super(_t()), !e.isValidFields(t)) throw Error("Invalid fields object provided");
|
|
1553
|
+
this._fields = Object.create(null), A(() => {
|
|
1554
|
+
Tt.add(this);
|
|
1555
|
+
try {
|
|
1556
|
+
if (Object.entries(t).forEach(([e, t]) => this.addField(e, t)), n) {
|
|
1557
|
+
let { value: e, validators: t, actions: r, ...i } = n;
|
|
1558
|
+
this.registerInitialActions([...t || [], ...r || []]), this.assignParams(i), e === void 0 ? this.originalValue !== void 0 && this.assignMembers(this.originalValue) : this.assignMembers(e);
|
|
1559
|
+
}
|
|
1560
|
+
} finally {
|
|
1561
|
+
Tt.delete(this);
|
|
1402
1562
|
}
|
|
1403
1563
|
this.completeRecords(), this.constructed(n);
|
|
1404
1564
|
let r = this.value;
|
|
1405
|
-
this.originalValue === void 0 && (this.originalValue = e.baseline(r)), this.
|
|
1565
|
+
this.originalValue === void 0 && (this.originalValue = e.baseline(r)), this.recordAnnounced(), this.boundActions?.triggerEager(this, this.contribution, this.originalValue), this.validate();
|
|
1406
1566
|
});
|
|
1407
1567
|
}
|
|
1408
|
-
[
|
|
1409
|
-
let e = super[
|
|
1568
|
+
[E]() {
|
|
1569
|
+
let e = super[E]();
|
|
1410
1570
|
return e.fieldNames = [...this.raw.fieldNames], e;
|
|
1411
1571
|
}
|
|
1412
1572
|
static baseline(e) {
|
|
1413
1573
|
return e == null ? e : { ...e };
|
|
1414
1574
|
}
|
|
1415
1575
|
addField(t, n) {
|
|
1416
|
-
return
|
|
1576
|
+
return A((r) => {
|
|
1417
1577
|
if (Object.hasOwn(this._fields, t)) throw Error(`Field ${t} is already in this form`);
|
|
1418
|
-
this.takeChild(n, t), r.touch(this), e.setEntry(this._fields, t, n), r.whenRolledBack(() => e.dropEntry(this._fields, t)), this.state.fieldNames.push(t), this.completeRecords(n), this.bumpValueVersion(), this.notifyValueChanged();
|
|
1578
|
+
this.takeChild(n, t), r.touch(this), e.setEntry(this._fields, t, n), r.whenRolledBack(() => e.dropEntry(this._fields, t)), this.state.fieldNames.push(t), Tt.has(this) || this.completeRecords(n), this.bumpValueVersion(), this.notifyValueChanged();
|
|
1419
1579
|
}), this;
|
|
1420
1580
|
}
|
|
1421
1581
|
removeField(t) {
|
|
1422
1582
|
let n;
|
|
1423
|
-
return
|
|
1583
|
+
return A((r) => {
|
|
1424
1584
|
if (!Object.hasOwn(this._fields, t)) return;
|
|
1425
1585
|
let i = this._fields[t];
|
|
1426
1586
|
r.touch(this), this.releaseChild(i), e.dropEntry(this._fields, t), r.whenRolledBack(() => e.setEntry(this._fields, t, i)), this.state.fieldNames.splice(this.state.fieldNames.indexOf(t), 1), this.bumpValueVersion(), this.notifyValueChanged(), n = i;
|
|
@@ -1434,66 +1594,61 @@ var st = class extends Q {
|
|
|
1434
1594
|
}
|
|
1435
1595
|
static isValidFields(e) {
|
|
1436
1596
|
function t(e) {
|
|
1437
|
-
return e instanceof
|
|
1597
|
+
return e instanceof G;
|
|
1438
1598
|
}
|
|
1439
1599
|
return typeof e == "object" && !!e && Object.entries(e).every(([, e]) => t(e));
|
|
1440
1600
|
}
|
|
1441
1601
|
static createFromFormData(t) {
|
|
1442
|
-
if (t instanceof
|
|
1443
|
-
return new e(t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, t]) => [e, new
|
|
1602
|
+
if (t instanceof G) throw Error("data is already a Form structure, should be a simple object");
|
|
1603
|
+
return new e(t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, t]) => [e, new q({ value: t })])));
|
|
1444
1604
|
}
|
|
1445
1605
|
field(e) {
|
|
1446
1606
|
return this._fields[e] ?? null;
|
|
1447
1607
|
}
|
|
1448
1608
|
get fields() {
|
|
1449
|
-
let e =
|
|
1450
|
-
return e || (e = new Proxy(this._fields,
|
|
1609
|
+
let e = Dt.get(this);
|
|
1610
|
+
return e || (e = new Proxy(this._fields, Ot(() => this.state.fieldNames.length)), Dt.set(this, e)), e;
|
|
1451
1611
|
}
|
|
1452
1612
|
get members() {
|
|
1453
1613
|
return this.raw.fieldNames.map((e) => this._fields[e]);
|
|
1454
1614
|
}
|
|
1615
|
+
get children() {
|
|
1616
|
+
return this.state.fieldNames.map((e) => this._fields[e]);
|
|
1617
|
+
}
|
|
1455
1618
|
get value() {
|
|
1456
1619
|
let e = this.valueVersion;
|
|
1457
1620
|
if (this.raw.cachedValueVersion === e) return this.raw.cachedValue;
|
|
1458
1621
|
let t = Object.create(null);
|
|
1459
1622
|
Object.entries(this._fields).forEach(([e, n]) => {
|
|
1460
|
-
|
|
1461
|
-
|
|
1623
|
+
switch (this.childSerializesAs(n, "value")) {
|
|
1624
|
+
case "value":
|
|
1625
|
+
t[e] = n.value;
|
|
1626
|
+
break;
|
|
1627
|
+
case "null": t[e] = null;
|
|
1628
|
+
}
|
|
1462
1629
|
});
|
|
1463
|
-
let n = h(t) ?
|
|
1630
|
+
let n = h(t) ? Et : Object.freeze({ ...t });
|
|
1464
1631
|
return this.raw.cachedValue = n, this.raw.cachedValueVersion = e, n;
|
|
1465
1632
|
}
|
|
1466
1633
|
assignMembers(e) {
|
|
1467
|
-
|
|
1634
|
+
A(() => {
|
|
1468
1635
|
Object.entries(this._fields).forEach(([t, n]) => {
|
|
1469
1636
|
(e == null || Object.hasOwn(e, t)) && (n.value = e == null ? null : e[t]);
|
|
1470
1637
|
});
|
|
1471
1638
|
});
|
|
1472
1639
|
}
|
|
1473
1640
|
set value(e) {
|
|
1474
|
-
|
|
1641
|
+
A((t) => {
|
|
1475
1642
|
this.assignMembers(e), t.markValidityDirty(this);
|
|
1476
1643
|
});
|
|
1477
1644
|
}
|
|
1478
1645
|
resetTo(t, n) {
|
|
1479
1646
|
let r = t;
|
|
1480
|
-
|
|
1647
|
+
A((t) => {
|
|
1481
1648
|
t.touch(this), this.errors.length && (this.errors = []), Object.entries(this._fields).forEach(([e, t]) => {
|
|
1482
1649
|
let i;
|
|
1483
1650
|
n === null ? i = null : n !== void 0 && Object.hasOwn(n, e) && (i = n[e]), this.resetChild(t, r.field(e) ?? t, i);
|
|
1484
|
-
});
|
|
1485
|
-
let i = this.value;
|
|
1486
|
-
this.raw.announcedValue = i, this.originalValue = e.baseline(i), super.validate(!0);
|
|
1487
|
-
});
|
|
1488
|
-
}
|
|
1489
|
-
get touched() {
|
|
1490
|
-
return Object.values(this._fields).some((e) => e.touched);
|
|
1491
|
-
}
|
|
1492
|
-
set touched(e) {
|
|
1493
|
-
O(() => {
|
|
1494
|
-
Object.values(this._fields).forEach((t) => {
|
|
1495
|
-
t.touched = e;
|
|
1496
|
-
});
|
|
1651
|
+
}), this.recordAnnounced(), this.originalValue = e.baseline(this.value), super.validate(!0);
|
|
1497
1652
|
});
|
|
1498
1653
|
}
|
|
1499
1654
|
get fullValue() {
|
|
@@ -1502,32 +1657,6 @@ var st = class extends Q {
|
|
|
1502
1657
|
e[t] = n.fullValue;
|
|
1503
1658
|
}), { ...e };
|
|
1504
1659
|
}
|
|
1505
|
-
notifyValueChanged() {
|
|
1506
|
-
this.propagateValueChanged();
|
|
1507
|
-
}
|
|
1508
|
-
get composesValue() {
|
|
1509
|
-
return !0;
|
|
1510
|
-
}
|
|
1511
|
-
refreshPreviousValue() {
|
|
1512
|
-
this.raw.announcedValue = this.value;
|
|
1513
|
-
}
|
|
1514
|
-
get valid() {
|
|
1515
|
-
return this.validRead;
|
|
1516
|
-
}
|
|
1517
|
-
composeValid() {
|
|
1518
|
-
return this.state.errors.length === 0 && this.state.fieldNames.every((e) => this._fields[e].valid);
|
|
1519
|
-
}
|
|
1520
|
-
get busy() {
|
|
1521
|
-
return this.busyRead;
|
|
1522
|
-
}
|
|
1523
|
-
composeBusy() {
|
|
1524
|
-
return this.state.fieldNames.some((e) => this._fields[e].busy);
|
|
1525
|
-
}
|
|
1526
|
-
validate(e = !1) {
|
|
1527
|
-
O(() => {
|
|
1528
|
-
e && Object.values(this._fields).forEach((e) => e.validate(!0)), super.validate(e);
|
|
1529
|
-
});
|
|
1530
|
-
}
|
|
1531
1660
|
static assertTookFields(e, t, n) {
|
|
1532
1661
|
let r = Object.entries(t), i = e.raw.fieldNames;
|
|
1533
1662
|
if (!(r.length === i.length && r.every(([t, n]) => e._fields[t] === n))) throw TypeError(`${n}.bind() built an element that did not take the members it was given, so the binding would carry the declaration's data. A subclass whose constructor does not take (fields, params) has to override bind() and construct itself.`);
|
|
@@ -1538,17 +1667,29 @@ var st = class extends Q {
|
|
|
1538
1667
|
r[e] = t.bind();
|
|
1539
1668
|
});
|
|
1540
1669
|
let i = this.constructor, a = new i(r, {
|
|
1541
|
-
value: t === void 0 ? this.
|
|
1670
|
+
value: t === void 0 ? this.fullValue : t,
|
|
1542
1671
|
...n && "originalValue" in n ? { originalValue: n.originalValue } : {},
|
|
1543
|
-
|
|
1672
|
+
access: n?.access ?? this.access,
|
|
1544
1673
|
visibility: n?.visibility ?? this.visibility
|
|
1545
1674
|
});
|
|
1546
|
-
return e.assertTookFields(a, r, this.constructor.name), a.boundFrom(this, a.
|
|
1675
|
+
return e.assertTookFields(a, r, this.constructor.name), a.boundFrom(this, a.contribution, a.originalValue, n), a;
|
|
1547
1676
|
}
|
|
1548
1677
|
rebind(e) {
|
|
1549
1678
|
return super.rebind(e);
|
|
1550
1679
|
}
|
|
1551
|
-
}
|
|
1680
|
+
};
|
|
1681
|
+
//#endregion
|
|
1682
|
+
//#region src/is-equal.ts
|
|
1683
|
+
function kt(e, t) {
|
|
1684
|
+
let n = e instanceof G ? e.value : e, r = t instanceof G ? t.value : t;
|
|
1685
|
+
return n === e && r === t ? void 0 : g(n, r);
|
|
1686
|
+
}
|
|
1687
|
+
function At(e, t) {
|
|
1688
|
+
return e instanceof G && t instanceof G ? g(e.value, t.value) : ee(e, t, kt);
|
|
1689
|
+
}
|
|
1690
|
+
//#endregion
|
|
1691
|
+
//#region src/list.ts
|
|
1692
|
+
var jt = Object.freeze([]), Mt = class e extends J {
|
|
1552
1693
|
get [Symbol.toStringTag]() {
|
|
1553
1694
|
return "List";
|
|
1554
1695
|
}
|
|
@@ -1560,27 +1701,30 @@ var st = class extends Q {
|
|
|
1560
1701
|
}
|
|
1561
1702
|
_itemTemplate;
|
|
1562
1703
|
constructor(t, n) {
|
|
1563
|
-
super(
|
|
1704
|
+
super(vt()), this._itemTemplate = t, A(() => {
|
|
1564
1705
|
if (n) {
|
|
1565
1706
|
let { value: e, validators: t, actions: r, ...i } = n;
|
|
1566
1707
|
this.registerInitialActions([...t || [], ...r || []]), this.assignParams(i), e === void 0 ? this.originalValue !== void 0 && this.setValueInternal(this.originalValue) : this.setValueInternal(e);
|
|
1567
1708
|
}
|
|
1568
|
-
this.constructed(n), this.originalValue === void 0 && (this.originalValue = e.baseline(this.value)), this.
|
|
1709
|
+
this.constructed(n), this.originalValue === void 0 && (this.originalValue = e.baseline(this.value)), this.recordAnnounced(), this.boundActions?.triggerEager(this, this.contribution, this.originalValue), this.validate();
|
|
1569
1710
|
});
|
|
1570
1711
|
}
|
|
1571
|
-
[
|
|
1572
|
-
let e = super[
|
|
1712
|
+
[E]() {
|
|
1713
|
+
let e = super[E]();
|
|
1573
1714
|
return e.rows = this.raw.rows ? [...this.raw.rows] : this.raw.rows, e;
|
|
1574
1715
|
}
|
|
1575
1716
|
static baseline(e) {
|
|
1576
1717
|
return e == null ? e : [...e];
|
|
1577
1718
|
}
|
|
1578
|
-
processSetValueItem(
|
|
1579
|
-
let
|
|
1580
|
-
return
|
|
1719
|
+
processSetValueItem(t) {
|
|
1720
|
+
let n;
|
|
1721
|
+
return n = t instanceof G ? t : this._itemTemplate ? this._itemTemplate.bind(t) : e.elementFor(t), this.takeChild(n), this.completeRecords(n), n;
|
|
1722
|
+
}
|
|
1723
|
+
static elementFor(t) {
|
|
1724
|
+
return ne(t) ? Y.createFromFormData(t) : Array.isArray(t) ? new e(void 0, { value: t }) : new q({ value: t });
|
|
1581
1725
|
}
|
|
1582
|
-
createPaddingItem() {
|
|
1583
|
-
return this.processSetValueItem(this._itemTemplate ? this.
|
|
1726
|
+
createPaddingItem(t) {
|
|
1727
|
+
return this._itemTemplate ? this.processSetValueItem(this._itemTemplate.bind()) : t instanceof Y || ne(t) ? this.processSetValueItem({}) : t instanceof e || Array.isArray(t) ? this.processSetValueItem([]) : this.processSetValueItem(void 0);
|
|
1584
1728
|
}
|
|
1585
1729
|
rowsChanged() {
|
|
1586
1730
|
this.state.rowsVersion++;
|
|
@@ -1591,7 +1735,7 @@ var st = class extends Q {
|
|
|
1591
1735
|
}
|
|
1592
1736
|
setValueInternal(t) {
|
|
1593
1737
|
if (t != null && !Array.isArray(t)) throw TypeError("Invalid value provided: a list takes an array of rows, or null to empty it");
|
|
1594
|
-
|
|
1738
|
+
A((n) => {
|
|
1595
1739
|
n.touch(this);
|
|
1596
1740
|
let r = this.raw.rows;
|
|
1597
1741
|
if (t == null) this.releaseRows(), this.state.rows = null;
|
|
@@ -1599,7 +1743,7 @@ var st = class extends Q {
|
|
|
1599
1743
|
let e = this.state.rows ?? [], n = Array(t.length);
|
|
1600
1744
|
for (let r = 0; r < t.length; r++) {
|
|
1601
1745
|
let i = t[r], a = e[r];
|
|
1602
|
-
a && this._itemTemplate && !(i instanceof
|
|
1746
|
+
a && this._itemTemplate && !(i instanceof G) ? (this.resetChild(a, this._itemTemplate, i), n[r] = a) : (a && this.releaseChild(a), n[r] = this.processSetValueItem(i));
|
|
1603
1747
|
}
|
|
1604
1748
|
for (let n = t.length; n < e.length; n++) this.releaseChild(e[n]);
|
|
1605
1749
|
this.state.rows = n;
|
|
@@ -1610,70 +1754,44 @@ var st = class extends Q {
|
|
|
1610
1754
|
get value() {
|
|
1611
1755
|
let e = this.valueVersion;
|
|
1612
1756
|
if (this.raw.cachedValueVersion === e) return this.raw.cachedValue;
|
|
1613
|
-
let t =
|
|
1757
|
+
let t = [];
|
|
1758
|
+
(this.state.rows ?? []).forEach((e) => {
|
|
1759
|
+
switch (this.childSerializesAs(e, "value")) {
|
|
1760
|
+
case "value":
|
|
1761
|
+
t.push(e.value);
|
|
1762
|
+
break;
|
|
1763
|
+
case "null": t.push(null);
|
|
1764
|
+
}
|
|
1765
|
+
});
|
|
1766
|
+
let n = t.length ? Object.freeze(t) : jt;
|
|
1614
1767
|
return this.raw.cachedValue = n, this.raw.cachedValueVersion = e, n;
|
|
1615
1768
|
}
|
|
1616
1769
|
set value(e) {
|
|
1617
|
-
|
|
1770
|
+
A(() => {
|
|
1618
1771
|
this.setValueInternal(e), this.propagateValueChanged(!0);
|
|
1619
1772
|
});
|
|
1620
1773
|
}
|
|
1621
1774
|
resetTo(t, n) {
|
|
1622
|
-
|
|
1623
|
-
r.touch(this), this.errors.length && (this.errors = []), this.setValueInternal(n === void 0 ? t.
|
|
1624
|
-
let i = this.value;
|
|
1625
|
-
this.raw.announcedValue = i, this.originalValue = e.baseline(i), super.validate(!0);
|
|
1626
|
-
});
|
|
1627
|
-
}
|
|
1628
|
-
get touched() {
|
|
1629
|
-
return this.state.rows?.some((e) => e.touched) || !1;
|
|
1630
|
-
}
|
|
1631
|
-
set touched(e) {
|
|
1632
|
-
O(() => {
|
|
1633
|
-
this.state.rows?.forEach((t) => {
|
|
1634
|
-
t.touched = e;
|
|
1635
|
-
});
|
|
1775
|
+
A((r) => {
|
|
1776
|
+
r.touch(this), this.errors.length && (this.errors = []), this.setValueInternal(n === void 0 ? t.fullValue : n), this.recordAnnounced(), this.originalValue = e.baseline(this.value), super.validate(!0);
|
|
1636
1777
|
});
|
|
1637
1778
|
}
|
|
1638
1779
|
bind(e, t) {
|
|
1639
1780
|
let n = this._itemTemplate?.bind(), r = this.constructor, i = new r(n, {
|
|
1640
|
-
value: [...(e === void 0 ? this.
|
|
1781
|
+
value: [...(e === void 0 ? this.fullValue : e) ?? []],
|
|
1641
1782
|
...t && "originalValue" in t ? { originalValue: t.originalValue } : {},
|
|
1642
|
-
|
|
1783
|
+
access: t?.access ?? this.access,
|
|
1643
1784
|
visibility: t?.visibility ?? this.visibility
|
|
1644
1785
|
});
|
|
1645
1786
|
if (i._itemTemplate !== n) throw TypeError(`${this.constructor.name}.bind() built a list that did not take the item template it was given, so the binding would carry the declaration's rows. A subclass whose constructor does not take (itemTemplate, params) has to override bind() and construct itself.`);
|
|
1646
|
-
return i.boundFrom(this, i.
|
|
1647
|
-
}
|
|
1648
|
-
notifyValueChanged() {
|
|
1649
|
-
this.propagateValueChanged();
|
|
1650
|
-
}
|
|
1651
|
-
get composesValue() {
|
|
1652
|
-
return !0;
|
|
1653
|
-
}
|
|
1654
|
-
refreshPreviousValue() {
|
|
1655
|
-
this.raw.announcedValue = this.value;
|
|
1656
|
-
}
|
|
1657
|
-
get valid() {
|
|
1658
|
-
return this.validRead;
|
|
1659
|
-
}
|
|
1660
|
-
composeValid() {
|
|
1661
|
-
return this.state.errors.length === 0 && (this.state.rows?.every((e) => e.valid) ?? !0);
|
|
1662
|
-
}
|
|
1663
|
-
get busy() {
|
|
1664
|
-
return this.busyRead;
|
|
1665
|
-
}
|
|
1666
|
-
composeBusy() {
|
|
1667
|
-
return this.state.rows?.some((e) => e.busy) ?? !1;
|
|
1668
|
-
}
|
|
1669
|
-
validate(e = !1) {
|
|
1670
|
-
O(() => {
|
|
1671
|
-
e && this.state.rows?.forEach((e) => e.validate(!0)), super.validate(e);
|
|
1672
|
-
});
|
|
1787
|
+
return i.boundFrom(this, i.contribution, i.originalValue, t), i;
|
|
1673
1788
|
}
|
|
1674
1789
|
get members() {
|
|
1675
1790
|
return this.raw.rows ?? [];
|
|
1676
1791
|
}
|
|
1792
|
+
get children() {
|
|
1793
|
+
return this.state.rows ?? [];
|
|
1794
|
+
}
|
|
1677
1795
|
get fullValue() {
|
|
1678
1796
|
return (this.state.rows ?? []).map((e) => e.fullValue);
|
|
1679
1797
|
}
|
|
@@ -1695,12 +1813,12 @@ var st = class extends Q {
|
|
|
1695
1813
|
}
|
|
1696
1814
|
remove(e) {
|
|
1697
1815
|
let t;
|
|
1698
|
-
return
|
|
1816
|
+
return A((n) => {
|
|
1699
1817
|
if (this.state.rows == null || e < 0 || this.state.rows.length <= e) return;
|
|
1700
1818
|
n.touch(this);
|
|
1701
1819
|
let r = this.state.rows.splice(e, 1)?.[0];
|
|
1702
1820
|
r && (this.releaseChild(r), this.rowsChanged(), this.bumpValueVersion(), t = r, n.recordStructural(this, {
|
|
1703
|
-
actionClass:
|
|
1821
|
+
actionClass: ft,
|
|
1704
1822
|
item: t,
|
|
1705
1823
|
index: e
|
|
1706
1824
|
}), this.propagateValueChanged(!0));
|
|
@@ -1708,18 +1826,18 @@ var st = class extends Q {
|
|
|
1708
1826
|
}
|
|
1709
1827
|
insert(e, t) {
|
|
1710
1828
|
let n = 0;
|
|
1711
|
-
return
|
|
1829
|
+
return A((r) => {
|
|
1712
1830
|
for (r.touch(this), this.state.rows ?? (this.state.rows = []), n = t < 0 ? Math.max(this.state.rows.length + t, 0) : t; this.state.rows.length < n;) {
|
|
1713
|
-
let
|
|
1831
|
+
let t = this.createPaddingItem(e), n = this.state.rows.push(t) - 1;
|
|
1714
1832
|
this.bumpValueVersion(), r.recordStructural(this, {
|
|
1715
|
-
actionClass:
|
|
1716
|
-
item:
|
|
1717
|
-
index:
|
|
1833
|
+
actionClass: K,
|
|
1834
|
+
item: t,
|
|
1835
|
+
index: n
|
|
1718
1836
|
});
|
|
1719
1837
|
}
|
|
1720
1838
|
let i = this.processSetValueItem(e);
|
|
1721
1839
|
this.state.rows.splice(n, 0, i), r.recordStructural(this, {
|
|
1722
|
-
actionClass:
|
|
1840
|
+
actionClass: K,
|
|
1723
1841
|
item: i,
|
|
1724
1842
|
index: n
|
|
1725
1843
|
}), this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(!0);
|
|
@@ -1729,12 +1847,12 @@ var st = class extends Q {
|
|
|
1729
1847
|
this.state.rows?.forEach((e) => this.releaseChild(e));
|
|
1730
1848
|
}
|
|
1731
1849
|
clear() {
|
|
1732
|
-
|
|
1850
|
+
A((e) => {
|
|
1733
1851
|
let t = (this.state.rows?.length ?? 0) > 0;
|
|
1734
1852
|
e.touch(this), this.releaseRows(), this.state.rows = null, t && this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(t);
|
|
1735
1853
|
});
|
|
1736
1854
|
}
|
|
1737
|
-
},
|
|
1855
|
+
}, Nt = class extends R {
|
|
1738
1856
|
isValidComparison;
|
|
1739
1857
|
otherField;
|
|
1740
1858
|
registrations = /* @__PURE__ */ new WeakSet();
|
|
@@ -1744,7 +1862,7 @@ var st = class extends Q {
|
|
|
1744
1862
|
super((e, t, r) => {
|
|
1745
1863
|
this.comparisonState(r).oldValue = t;
|
|
1746
1864
|
let i = this.resolve(r);
|
|
1747
|
-
return i ? (this.listenOn(i), this.isValidComparison(
|
|
1865
|
+
return i ? (this.listenOn(i), this.isValidComparison(f(e), f(i.value)) ? null : [new F(this.replacePlaceholders(n, {
|
|
1748
1866
|
newValue: e,
|
|
1749
1867
|
oldValue: t,
|
|
1750
1868
|
field: r,
|
|
@@ -1754,14 +1872,14 @@ var st = class extends Q {
|
|
|
1754
1872
|
}
|
|
1755
1873
|
resolve(e) {
|
|
1756
1874
|
let t = this.otherField;
|
|
1757
|
-
return typeof t == "function" ? t(e) ?? void 0 : typeof t == "string" ?
|
|
1875
|
+
return typeof t == "function" ? t(e) ?? void 0 : typeof t == "string" ? Fe(t, e) : Ne(t, z(e));
|
|
1758
1876
|
}
|
|
1759
1877
|
listenOn(e) {
|
|
1760
|
-
this.listening.has(e) || this.listening.has(e.declaration) || (this.listening.add(e), e.registerAction(new
|
|
1878
|
+
this.listening.has(e) || this.listening.has(e.declaration) || (this.listening.add(e), e.registerAction(new T((e, t, n, r) => {
|
|
1761
1879
|
t(e, n, r);
|
|
1762
|
-
let i =
|
|
1763
|
-
this.declarations.forEach((e) =>
|
|
1764
|
-
this.registrations.has(e) && this.execute(e, () => null, e.
|
|
1880
|
+
let i = z(e);
|
|
1881
|
+
this.declarations.forEach((e) => Pe(e, i).forEach((e) => {
|
|
1882
|
+
this.registrations.has(e) && this.execute(e, () => null, e.contribution, this.comparisonState(e).oldValue);
|
|
1765
1883
|
}));
|
|
1766
1884
|
})));
|
|
1767
1885
|
}
|
|
@@ -1780,14 +1898,14 @@ var st = class extends Q {
|
|
|
1780
1898
|
unregisterFrom(e) {
|
|
1781
1899
|
super.unregisterFrom(e), this.registrations.delete(e);
|
|
1782
1900
|
}
|
|
1783
|
-
},
|
|
1901
|
+
}, Pt = class extends R {
|
|
1784
1902
|
constructor(e, t) {
|
|
1785
|
-
let n = t ||
|
|
1786
|
-
let t =
|
|
1903
|
+
let n = t || L("InAllowedValues"), r = () => {
|
|
1904
|
+
let t = f(e);
|
|
1787
1905
|
return typeof t == "function" ? t() : t;
|
|
1788
1906
|
}, i = (e) => {
|
|
1789
1907
|
let t = e.join(", ");
|
|
1790
|
-
return t.length <= 60 ? t :
|
|
1908
|
+
return t.length <= 60 ? t : re(t, {
|
|
1791
1909
|
length: 40,
|
|
1792
1910
|
separator: ", ",
|
|
1793
1911
|
omission: `... (${e.length} items total)`
|
|
@@ -1795,7 +1913,7 @@ var st = class extends Q {
|
|
|
1795
1913
|
};
|
|
1796
1914
|
super((e, t, a) => {
|
|
1797
1915
|
let o = r();
|
|
1798
|
-
return o.includes(
|
|
1916
|
+
return o.includes(f(e)) ? null : [new F(this.replacePlaceholders(n, {
|
|
1799
1917
|
newValue: e,
|
|
1800
1918
|
oldValue: t,
|
|
1801
1919
|
field: a,
|
|
@@ -1807,48 +1925,48 @@ var st = class extends Q {
|
|
|
1807
1925
|
};
|
|
1808
1926
|
//#endregion
|
|
1809
1927
|
//#region src/validators/validator-required.ts
|
|
1810
|
-
function
|
|
1811
|
-
return e == null ? 0 :
|
|
1928
|
+
function Ft(e) {
|
|
1929
|
+
return e == null ? 0 : m(e) || _(e) ? e.length : te(e) && Object.getPrototypeOf(e) === Object.prototype ? Object.keys(e).length : String(e).length;
|
|
1812
1930
|
}
|
|
1813
|
-
function
|
|
1931
|
+
function It(e) {
|
|
1814
1932
|
return typeof e == "object" && !!e && !o(e) && !(e instanceof String) && !("componentName" in e);
|
|
1815
1933
|
}
|
|
1816
|
-
var
|
|
1934
|
+
var Lt = class extends R {
|
|
1817
1935
|
constructor(e, t) {
|
|
1818
|
-
let n =
|
|
1936
|
+
let n = It(e) ? void 0 : e, r = (It(e) ? e : t)?.trim ?? !0, i = n || L("Required");
|
|
1819
1937
|
super((e, t, n) => {
|
|
1820
|
-
let a =
|
|
1821
|
-
return
|
|
1938
|
+
let a = f(e);
|
|
1939
|
+
return Ft(r && _(a) ? a.trim() : a) === 0 ? [new F(this.replacePlaceholders(i, {
|
|
1822
1940
|
newValue: e,
|
|
1823
1941
|
oldValue: t,
|
|
1824
1942
|
field: n
|
|
1825
1943
|
}), "", "required")] : null;
|
|
1826
1944
|
});
|
|
1827
1945
|
}
|
|
1828
|
-
},
|
|
1946
|
+
}, Rt = class extends R {
|
|
1829
1947
|
constructor(e, t) {
|
|
1830
|
-
let n = t ||
|
|
1831
|
-
super((t, r, i) => t < e || t === void 0 ? [new
|
|
1948
|
+
let n = t || L("MinValue");
|
|
1949
|
+
super((t, r, i) => t < e || t === void 0 ? [new F(this.replacePlaceholders(n, {
|
|
1832
1950
|
newValue: t,
|
|
1833
1951
|
oldValue: r,
|
|
1834
1952
|
field: i,
|
|
1835
1953
|
minValue: e
|
|
1836
1954
|
}), "", "min")] : null);
|
|
1837
1955
|
}
|
|
1838
|
-
},
|
|
1956
|
+
}, zt = class extends R {
|
|
1839
1957
|
constructor(e, t) {
|
|
1840
|
-
let n = t ||
|
|
1841
|
-
super((t, r, i) => t > e || t === void 0 ? [new
|
|
1958
|
+
let n = t || L("MaxValue");
|
|
1959
|
+
super((t, r, i) => t > e || t === void 0 ? [new F(this.replacePlaceholders(n, {
|
|
1842
1960
|
newValue: t,
|
|
1843
1961
|
oldValue: r,
|
|
1844
1962
|
field: i,
|
|
1845
1963
|
maxValue: e
|
|
1846
1964
|
}), "", "max")] : null);
|
|
1847
1965
|
}
|
|
1848
|
-
},
|
|
1966
|
+
}, Bt = class extends R {
|
|
1849
1967
|
constructor(e, t, n) {
|
|
1850
|
-
let r = n ||
|
|
1851
|
-
super((n, i, a) => n < e || n > t || n === void 0 ? [new
|
|
1968
|
+
let r = n || L("ValueInRange");
|
|
1969
|
+
super((n, i, a) => n < e || n > t || n === void 0 ? [new F(this.replacePlaceholders(r, {
|
|
1852
1970
|
newValue: n,
|
|
1853
1971
|
oldValue: i,
|
|
1854
1972
|
field: a,
|
|
@@ -1859,35 +1977,35 @@ var gt = class extends I {
|
|
|
1859
1977
|
};
|
|
1860
1978
|
//#endregion
|
|
1861
1979
|
//#region src/validators/validator-min-max-range-length.ts
|
|
1862
|
-
function
|
|
1863
|
-
return e == null ? 0 :
|
|
1980
|
+
function Vt(e) {
|
|
1981
|
+
return e == null ? 0 : m(e) || _(e) ? e.length : te(e) && Object.getPrototypeOf(e) === Object.prototype ? Object.keys(e).length : String(e).length;
|
|
1864
1982
|
}
|
|
1865
|
-
var
|
|
1983
|
+
var Ht = class extends R {
|
|
1866
1984
|
constructor(e, t) {
|
|
1867
|
-
let n = t ||
|
|
1868
|
-
super((t, r, i) =>
|
|
1985
|
+
let n = t || L("MinLength");
|
|
1986
|
+
super((t, r, i) => Vt(t) < e ? [new F(this.replacePlaceholders(n, {
|
|
1869
1987
|
newValue: t,
|
|
1870
1988
|
oldValue: r,
|
|
1871
1989
|
field: i,
|
|
1872
1990
|
minLength: e
|
|
1873
1991
|
}), "", "min-length")] : null);
|
|
1874
1992
|
}
|
|
1875
|
-
},
|
|
1993
|
+
}, Ut = class extends R {
|
|
1876
1994
|
constructor(e, t) {
|
|
1877
|
-
let n = t ||
|
|
1878
|
-
super((t, r, i) =>
|
|
1995
|
+
let n = t || L("MaxLength");
|
|
1996
|
+
super((t, r, i) => Vt(t) > e ? [new F(this.replacePlaceholders(n, {
|
|
1879
1997
|
newValue: t,
|
|
1880
1998
|
oldValue: r,
|
|
1881
1999
|
field: i,
|
|
1882
2000
|
maxLength: e
|
|
1883
2001
|
}), "", "max-length")] : null);
|
|
1884
2002
|
}
|
|
1885
|
-
},
|
|
2003
|
+
}, Wt = class extends R {
|
|
1886
2004
|
constructor(e, t, n) {
|
|
1887
|
-
let r = n ||
|
|
2005
|
+
let r = n || L("LengthInRange");
|
|
1888
2006
|
super((n, i, a) => {
|
|
1889
|
-
let o =
|
|
1890
|
-
return o < e || o > t ? [new
|
|
2007
|
+
let o = Vt(n);
|
|
2008
|
+
return o < e || o > t ? [new F(this.replacePlaceholders(r, {
|
|
1891
2009
|
newValue: n,
|
|
1892
2010
|
oldValue: i,
|
|
1893
2011
|
field: a,
|
|
@@ -1896,70 +2014,295 @@ var xt = class extends I {
|
|
|
1896
2014
|
}), "", "range-length")] : null;
|
|
1897
2015
|
});
|
|
1898
2016
|
}
|
|
1899
|
-
},
|
|
2017
|
+
}, Gt = class extends R {
|
|
1900
2018
|
constructor(e, t) {
|
|
1901
|
-
let n = t ||
|
|
1902
|
-
super((t, r, i) => e.test(String(
|
|
2019
|
+
let n = t || L("Pattern");
|
|
2020
|
+
super((t, r, i) => e.test(String(f(t))) ? null : [new F(this.replacePlaceholders(n, {
|
|
1903
2021
|
newValue: t,
|
|
1904
2022
|
oldValue: r,
|
|
1905
2023
|
field: i,
|
|
1906
2024
|
pattern: e
|
|
1907
2025
|
}), "", "pattern")]);
|
|
1908
2026
|
}
|
|
1909
|
-
},
|
|
1910
|
-
CompareTo: () =>
|
|
1911
|
-
InAllowedValues: () =>
|
|
1912
|
-
LengthInRange: () =>
|
|
1913
|
-
MaxLength: () =>
|
|
1914
|
-
MaxValue: () =>
|
|
1915
|
-
MinLength: () =>
|
|
1916
|
-
MinValue: () =>
|
|
1917
|
-
Pattern: () =>
|
|
1918
|
-
Required: () =>
|
|
1919
|
-
Validator: () =>
|
|
1920
|
-
ValueInRange: () =>
|
|
1921
|
-
}),
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
2027
|
+
}, Kt = /* @__PURE__ */ ae({
|
|
2028
|
+
CompareTo: () => Nt,
|
|
2029
|
+
InAllowedValues: () => Pt,
|
|
2030
|
+
LengthInRange: () => Wt,
|
|
2031
|
+
MaxLength: () => Ut,
|
|
2032
|
+
MaxValue: () => zt,
|
|
2033
|
+
MinLength: () => Ht,
|
|
2034
|
+
MinValue: () => Rt,
|
|
2035
|
+
Pattern: () => Gt,
|
|
2036
|
+
Required: () => Lt,
|
|
2037
|
+
Validator: () => R,
|
|
2038
|
+
ValueInRange: () => Bt
|
|
2039
|
+
}), qt = /* @__PURE__ */ new WeakMap(), Jt = /* @__PURE__ */ new WeakMap(), Yt = /* @__PURE__ */ new Set([
|
|
2040
|
+
"push",
|
|
2041
|
+
"pop",
|
|
2042
|
+
"shift",
|
|
2043
|
+
"unshift",
|
|
2044
|
+
"splice",
|
|
2045
|
+
"sort",
|
|
2046
|
+
"reverse",
|
|
2047
|
+
"fill",
|
|
2048
|
+
"copyWithin"
|
|
2049
|
+
]);
|
|
2050
|
+
function X(e) {
|
|
2051
|
+
return typeof e == "string" && /^(0|[1-9]\d*)$/.test(e);
|
|
2052
|
+
}
|
|
2053
|
+
function Z(e) {
|
|
2054
|
+
return typeof e == "object" && !!e && Jt.get(e) || e;
|
|
2055
|
+
}
|
|
2056
|
+
function Q(e) {
|
|
2057
|
+
return e instanceof J ? $(e) : e.value;
|
|
2058
|
+
}
|
|
2059
|
+
function Xt(e, t) {
|
|
2060
|
+
e.value = Z(t) instanceof G ? Z(t).value : t;
|
|
2061
|
+
}
|
|
2062
|
+
function Zt(e) {
|
|
2063
|
+
return e === "__v_skip" ? {
|
|
2064
|
+
answered: !0,
|
|
2065
|
+
value: !0
|
|
2066
|
+
} : typeof e == "string" && e.startsWith("__v_") || e === "then" ? {
|
|
2067
|
+
answered: !0,
|
|
2068
|
+
value: void 0
|
|
2069
|
+
} : { answered: !1 };
|
|
2070
|
+
}
|
|
2071
|
+
function Qt(e) {
|
|
2072
|
+
let t = (t) => typeof t == "string" && t !== "$" ? e.field(t) ?? void 0 : void 0, n = () => Object.keys(e.fields);
|
|
2073
|
+
return {
|
|
2074
|
+
get(n, r) {
|
|
2075
|
+
let i = Zt(r);
|
|
2076
|
+
if (i.answered) return i.value;
|
|
2077
|
+
if (r === "$") return e;
|
|
2078
|
+
if (r === Symbol.toStringTag) return "View";
|
|
2079
|
+
let a = t(r);
|
|
2080
|
+
return a ? Q(a) : void 0;
|
|
2081
|
+
},
|
|
2082
|
+
set(e, n, r) {
|
|
2083
|
+
if (n === "$") throw TypeError("$ is the element a view stands for, and cannot be replaced");
|
|
2084
|
+
let i = t(n);
|
|
2085
|
+
if (!i) throw TypeError(`${String(n)} is not a member of this group - use $addField() to add one`);
|
|
2086
|
+
return Xt(i, r), !0;
|
|
2087
|
+
},
|
|
2088
|
+
has(e, t) {
|
|
2089
|
+
return t === "$" || typeof t == "string" && n().includes(t);
|
|
2090
|
+
},
|
|
2091
|
+
ownKeys() {
|
|
2092
|
+
return n();
|
|
2093
|
+
},
|
|
2094
|
+
getOwnPropertyDescriptor(t, r) {
|
|
2095
|
+
if (!(typeof r != "string" || !n().includes(r))) return {
|
|
2096
|
+
value: Q(e.fields[r]),
|
|
2097
|
+
writable: !0,
|
|
2098
|
+
enumerable: !0,
|
|
2099
|
+
configurable: !0
|
|
2100
|
+
};
|
|
2101
|
+
},
|
|
2102
|
+
deleteProperty(e, t) {
|
|
2103
|
+
throw TypeError(`${String(t)} cannot be deleted from a view - use $removeField() to take a member out`);
|
|
2104
|
+
},
|
|
2105
|
+
defineProperty(e, t) {
|
|
2106
|
+
throw TypeError(`${String(t)} cannot be defined on a view`);
|
|
2107
|
+
}
|
|
2108
|
+
};
|
|
2109
|
+
}
|
|
2110
|
+
function $t(e) {
|
|
2111
|
+
let t = () => [...e.items], n = (n) => {
|
|
2112
|
+
let r = t();
|
|
2113
|
+
return n < r.length ? e.items.indexOf(r[n]) : e.length;
|
|
2114
|
+
}, r = (e, t) => e < 0 ? Math.max(t + e, 0) : Math.min(e, t), i = (n) => k(() => {
|
|
2115
|
+
let r = t(), i = e.items.map((e) => {
|
|
2116
|
+
let t = r.indexOf(e);
|
|
2117
|
+
return t === -1 ? e : n[t];
|
|
2118
|
+
});
|
|
2119
|
+
for (; e.length;) e.pop();
|
|
2120
|
+
i.forEach((t) => e.push(t));
|
|
2121
|
+
}), a = {
|
|
2122
|
+
push: (...n) => (k(() => n.forEach((t) => e.push(Z(t)))), t().length),
|
|
2123
|
+
pop: () => {
|
|
2124
|
+
let n = t();
|
|
2125
|
+
if (!n.length) return;
|
|
2126
|
+
let r = Q(n[n.length - 1]);
|
|
2127
|
+
return e.remove(e.items.indexOf(n[n.length - 1])), r;
|
|
2128
|
+
},
|
|
2129
|
+
shift: () => {
|
|
2130
|
+
let n = t();
|
|
2131
|
+
if (!n.length) return;
|
|
2132
|
+
let r = Q(n[0]);
|
|
2133
|
+
return e.remove(e.items.indexOf(n[0])), r;
|
|
2134
|
+
},
|
|
2135
|
+
unshift: (...r) => (k(() => {
|
|
2136
|
+
let t = n(0);
|
|
2137
|
+
r.forEach((n, r) => e.insert(Z(n), t + r));
|
|
2138
|
+
}), t().length),
|
|
2139
|
+
splice: (i, a, ...o) => {
|
|
2140
|
+
let s = [];
|
|
2141
|
+
return k(() => {
|
|
2142
|
+
let c = t(), l = r(Math.trunc(i) || 0, c.length), u = a === void 0 ? c.length - l : Math.max(0, Math.min(a, c.length - l));
|
|
2143
|
+
c.slice(l, l + u).forEach((t) => {
|
|
2144
|
+
s.push(Q(t)), e.remove(e.items.indexOf(t));
|
|
2145
|
+
});
|
|
2146
|
+
let d = n(l);
|
|
2147
|
+
o.forEach((t, n) => e.insert(Z(t), d + n));
|
|
2148
|
+
}), s;
|
|
2149
|
+
},
|
|
2150
|
+
sort: (e) => {
|
|
2151
|
+
let n = t().map((e) => ({
|
|
2152
|
+
row: e,
|
|
2153
|
+
slot: Q(e)
|
|
2154
|
+
})).sort((t, n) => {
|
|
2155
|
+
if (e) return e(t.slot, n.slot);
|
|
2156
|
+
let r = String(t.slot), i = String(n.slot);
|
|
2157
|
+
return r < i ? -1 : +(r > i);
|
|
2158
|
+
}).map(({ row: e }) => e);
|
|
2159
|
+
return i(n), o;
|
|
2160
|
+
},
|
|
2161
|
+
reverse: () => (i([...t()].reverse()), o),
|
|
2162
|
+
fill: () => {
|
|
2163
|
+
throw TypeError("fill() is not available on a list view - assign $value instead");
|
|
2164
|
+
},
|
|
2165
|
+
copyWithin: () => {
|
|
2166
|
+
throw TypeError("copyWithin() is not available on a list view - assign $value instead");
|
|
2167
|
+
}
|
|
2168
|
+
}, o;
|
|
2169
|
+
return o = new Proxy([], {
|
|
2170
|
+
get(n, r, i) {
|
|
2171
|
+
let o = Zt(r);
|
|
2172
|
+
if (o.answered) return o.value;
|
|
2173
|
+
if (r === "$") return e;
|
|
2174
|
+
if (r === "length") return t().length;
|
|
2175
|
+
if (X(r)) {
|
|
2176
|
+
let e = t()[Number(r)];
|
|
2177
|
+
return e ? Q(e) : void 0;
|
|
2178
|
+
}
|
|
2179
|
+
return typeof r == "string" && Yt.has(r) ? a[r] : Reflect.get(n, r, i);
|
|
2180
|
+
},
|
|
2181
|
+
set(r, i, a) {
|
|
2182
|
+
if (i === "$") throw TypeError("$ is the element a view stands for, and cannot be replaced");
|
|
2183
|
+
if (i === "length") {
|
|
2184
|
+
let n = Number(a), r = t();
|
|
2185
|
+
if (n > r.length) throw TypeError("a list view grows by push(), not by its length");
|
|
2186
|
+
return k(() => r.slice(n).forEach((t) => e.remove(e.items.indexOf(t)))), !0;
|
|
2187
|
+
}
|
|
2188
|
+
if (X(i)) {
|
|
2189
|
+
let r = Number(i), o = t();
|
|
2190
|
+
return r < o.length ? Xt(o[r], a) : e.insert(Z(a), n(o.length) + (r - o.length)), !0;
|
|
2191
|
+
}
|
|
2192
|
+
throw TypeError(`${String(i)} cannot be set on a list view`);
|
|
2193
|
+
},
|
|
2194
|
+
has(e, n) {
|
|
2195
|
+
return n === "$" || n === "length" ? !0 : X(n) ? Number(n) < t().length : Reflect.has(e, n);
|
|
2196
|
+
},
|
|
2197
|
+
ownKeys() {
|
|
2198
|
+
return [...t().map((e, t) => String(t)), "length"];
|
|
2199
|
+
},
|
|
2200
|
+
getOwnPropertyDescriptor(e, n) {
|
|
2201
|
+
if (n === "length") return {
|
|
2202
|
+
value: t().length,
|
|
2203
|
+
writable: !0,
|
|
2204
|
+
enumerable: !1,
|
|
2205
|
+
configurable: !1
|
|
2206
|
+
};
|
|
2207
|
+
if (!(!X(n) || Number(n) >= t().length)) return {
|
|
2208
|
+
value: Q(t()[Number(n)]),
|
|
2209
|
+
writable: !0,
|
|
2210
|
+
enumerable: !0,
|
|
2211
|
+
configurable: !0
|
|
2212
|
+
};
|
|
2213
|
+
},
|
|
2214
|
+
deleteProperty() {
|
|
2215
|
+
throw TypeError("rows cannot be deleted from a list view - use splice() or pop()");
|
|
2216
|
+
},
|
|
2217
|
+
defineProperty(e, t) {
|
|
2218
|
+
throw TypeError(`${String(t)} cannot be defined on a list view`);
|
|
2219
|
+
}
|
|
2220
|
+
}), o;
|
|
2221
|
+
}
|
|
2222
|
+
function en(e) {
|
|
2223
|
+
return {
|
|
2224
|
+
get(t, n) {
|
|
2225
|
+
let r = Zt(n);
|
|
2226
|
+
if (r.answered) return r.value;
|
|
2227
|
+
if (n === "$") return e;
|
|
2228
|
+
},
|
|
2229
|
+
set(e, t) {
|
|
2230
|
+
throw TypeError(`${String(t)} cannot be set on the view of a field - its value is $.value`);
|
|
2231
|
+
},
|
|
2232
|
+
has(e, t) {
|
|
2233
|
+
return t === "$";
|
|
2234
|
+
},
|
|
2235
|
+
ownKeys() {
|
|
2236
|
+
return [];
|
|
2237
|
+
}
|
|
2238
|
+
};
|
|
2239
|
+
}
|
|
2240
|
+
function tn(e) {
|
|
2241
|
+
Object.keys(e.fields).forEach((e) => {
|
|
2242
|
+
if (e === "$" || e === "then" || e.startsWith("__v_")) throw TypeError(`A view cannot hold a member named ${e}: $ is the element the view stands for, and then and __v_* are read by the language and by Vue`);
|
|
2243
|
+
});
|
|
2244
|
+
}
|
|
2245
|
+
function $(e) {
|
|
2246
|
+
if (Jt.has(e)) return e;
|
|
2247
|
+
let t = qt.get(e);
|
|
2248
|
+
if (t) return t;
|
|
2249
|
+
let n;
|
|
2250
|
+
return e instanceof Y ? (tn(e), n = new Proxy({}, Qt(e))) : n = e instanceof Mt ? $t(e) : new Proxy({}, en(e)), qt.set(e, n), Jt.set(n, e), n;
|
|
2251
|
+
}
|
|
2252
|
+
//#endregion
|
|
2253
|
+
//#region src/index.ts
|
|
2254
|
+
var nn = /* @__PURE__ */ ae({
|
|
2255
|
+
AbortEventHandlingException: () => C,
|
|
2256
|
+
AccessChangedAction: () => Ue,
|
|
2257
|
+
AccessChangingAction: () => Ve,
|
|
2258
|
+
Action: () => xt,
|
|
2259
|
+
ActionsMap: () => Ae,
|
|
2260
|
+
ConditionalAccessAction: () => Re,
|
|
2261
|
+
ConditionalStatementAction: () => B,
|
|
2262
|
+
ConditionalValueAction: () => ze,
|
|
2263
|
+
ConditionalVisibilityAction: () => Le,
|
|
2264
|
+
Container: () => J,
|
|
2265
|
+
ContributionChangedAction: () => U,
|
|
2266
|
+
EnabledChangedAction: () => Je,
|
|
2267
|
+
EnabledChangingAction: () => Ke,
|
|
2268
|
+
ExecuteAction: () => lt,
|
|
2269
|
+
Field: () => q,
|
|
2270
|
+
FieldActionBase: () => S,
|
|
2271
|
+
FieldBase: () => G,
|
|
2272
|
+
Group: () => Y,
|
|
2273
|
+
List: () => Mt,
|
|
2274
|
+
ListItemAddedAction: () => K,
|
|
2275
|
+
ListItemRemovedAction: () => ft,
|
|
2276
|
+
MdString: () => j,
|
|
2277
|
+
MessagesWidget: () => St,
|
|
2278
|
+
Operator: () => H,
|
|
1943
2279
|
RenderableValue: () => we,
|
|
1944
|
-
Statement: () =>
|
|
1945
|
-
ValidChangedAction: () =>
|
|
1946
|
-
ValidationError: () =>
|
|
1947
|
-
ValidationErrorRenderContent: () =>
|
|
2280
|
+
Statement: () => st,
|
|
2281
|
+
ValidChangedAction: () => Xe,
|
|
2282
|
+
ValidationError: () => P,
|
|
2283
|
+
ValidationErrorRenderContent: () => F,
|
|
1948
2284
|
ValidationErrorText: () => Ce,
|
|
1949
|
-
Validators: () =>
|
|
1950
|
-
ValueChangedAction: () =>
|
|
1951
|
-
VisibilityChangedAction: () =>
|
|
1952
|
-
VisibilityChangingAction: () =>
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
2285
|
+
Validators: () => Kt,
|
|
2286
|
+
ValueChangedAction: () => T,
|
|
2287
|
+
VisibilityChangedAction: () => et,
|
|
2288
|
+
VisibilityChangingAction: () => Qe,
|
|
2289
|
+
accessValues: () => v,
|
|
2290
|
+
buildErrorMessage: () => I,
|
|
2291
|
+
defaultAccess: () => oe,
|
|
2292
|
+
defaultVisibility: () => b,
|
|
2293
|
+
isAccess: () => se,
|
|
2294
|
+
isCallableFunction: () => N,
|
|
2295
|
+
isEqual: () => At,
|
|
2296
|
+
isSimpleComponentDef: () => M,
|
|
2297
|
+
isVisibility: () => x,
|
|
1957
2298
|
strings: () => Ee,
|
|
1958
|
-
transaction: () =>
|
|
2299
|
+
transaction: () => k,
|
|
1959
2300
|
translateStrings: () => De,
|
|
1960
|
-
translatedMessage: () =>
|
|
2301
|
+
translatedMessage: () => L,
|
|
2302
|
+
view: () => $,
|
|
2303
|
+
visibilityValues: () => y
|
|
1961
2304
|
});
|
|
1962
2305
|
//#endregion
|
|
1963
|
-
export {
|
|
2306
|
+
export { C as AbortEventHandlingException, Ue as AccessChangedAction, Ve as AccessChangingAction, xt as Action, Ae as ActionsMap, Re as ConditionalAccessAction, B as ConditionalStatementAction, ze as ConditionalValueAction, Le as ConditionalVisibilityAction, J as Container, U as ContributionChangedAction, Je as EnabledChangedAction, Ke as EnabledChangingAction, lt as ExecuteAction, q as Field, S as FieldActionBase, G as FieldBase, Y as Group, Mt as List, K as ListItemAddedAction, ft as ListItemRemovedAction, j as MdString, St as MessagesWidget, H as Operator, we as RenderableValue, st as Statement, Xe as ValidChangedAction, P as ValidationError, F as ValidationErrorRenderContent, Ce as ValidationErrorText, Kt as Validators, T as ValueChangedAction, et as VisibilityChangedAction, Qe as VisibilityChangingAction, v as accessValues, I as buildErrorMessage, nn as default, oe as defaultAccess, b as defaultVisibility, Se as forms, be as getConfig, se as isAccess, N as isCallableFunction, At as isEqual, M as isSimpleComponentDef, x as isVisibility, xe as setConfig, Ee as strings, k as transaction, De as translateStrings, L as translatedMessage, $ as view, y as visibilityValues };
|
|
1964
2307
|
|
|
1965
2308
|
//# sourceMappingURL=dynamicforms-vue-forms.js.map
|