@dynamicforms/vue-forms 3.0.0-alpha.1 → 3.0.0-alpha.3
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/chunks/{plugin-uXEQYne6.js → plugin-Ds_2fb9G.js} +2 -2
- package/dist/chunks/{plugin-uXEQYne6.js.map → plugin-Ds_2fb9G.js.map} +1 -1
- package/dist/chunks/{registry-_vVZW3p9.js → registry-2GP2P-ie.js} +41 -41
- package/dist/chunks/registry-2GP2P-ie.js.map +1 -0
- package/dist/dynamicforms-vue-forms.js +578 -474
- package/dist/dynamicforms-vue-forms.js.map +1 -1
- package/dist/index.d.ts +87 -44
- package/package.json +4 -3
- package/readme.md +12 -9
- package/dist/chunks/registry-_vVZW3p9.js.map +0 -1
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { c as e, f as t, h as n, i as r, l as i, m as a, p as o, s, u as c } from "./chunks/registry-
|
|
2
|
-
import { computed as l, reactive as
|
|
3
|
-
import { isArray as
|
|
1
|
+
import { c as e, f as t, h as n, i as r, l as i, m as a, p as o, s, u as c } from "./chunks/registry-2GP2P-ie.js";
|
|
2
|
+
import { computed as l, reactive as u, ref as d, shallowRef as f, toRaw as p, unref as m, watch as ee } from "vue";
|
|
3
|
+
import { isArray as te, isEmpty as ne, isEqual as h, isEqualWith as re, isObject as ie, isPlainObject as ae, isString as g, truncate as oe } from "lodash-es";
|
|
4
4
|
//#region \0rolldown/runtime.js
|
|
5
|
-
var
|
|
5
|
+
var se = Object.defineProperty, ce = (e, t) => {
|
|
6
6
|
let n = {};
|
|
7
|
-
for (var r in e)
|
|
7
|
+
for (var r in e) se(n, r, {
|
|
8
8
|
get: e[r],
|
|
9
9
|
enumerable: !0
|
|
10
10
|
});
|
|
11
|
-
return t ||
|
|
12
|
-
},
|
|
11
|
+
return t || se(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
12
|
+
}, _ = Object.freeze([
|
|
13
13
|
"editable",
|
|
14
14
|
"readonly",
|
|
15
15
|
"disabled",
|
|
16
16
|
"disabled-null"
|
|
17
|
-
]),
|
|
18
|
-
function
|
|
19
|
-
return
|
|
17
|
+
]), le = "editable";
|
|
18
|
+
function ue(e) {
|
|
19
|
+
return _.includes(e);
|
|
20
20
|
}
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/visibility.ts
|
|
23
|
-
var
|
|
23
|
+
var de = Object.freeze([
|
|
24
24
|
"full",
|
|
25
25
|
"invisible",
|
|
26
26
|
"hidden",
|
|
27
27
|
"suppress"
|
|
28
28
|
]), fe = "full";
|
|
29
29
|
function pe(e) {
|
|
30
|
-
return
|
|
30
|
+
return de.includes(e);
|
|
31
31
|
}
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/plugins/devtools/api.ts
|
|
34
34
|
var me = !0, he = !0, ge, _e = !1;
|
|
35
35
|
function ve(t) {
|
|
36
|
-
_e ? import("./chunks/plugin-
|
|
36
|
+
_e ? import("./chunks/plugin-Ds_2fb9G.js").then((e) => e.installFor(t)) : (_e = !0, import("./chunks/plugin-Ds_2fb9G.js").then((t) => {
|
|
37
37
|
t.install(), e().forEach(({ element: e }) => t.installFor(e));
|
|
38
38
|
}));
|
|
39
39
|
}
|
|
@@ -52,7 +52,7 @@ var ye = {
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
function be() {
|
|
55
|
-
process.env.NODE_ENV !== "production" && me && !ge && (ge = Pe(ye));
|
|
55
|
+
process.env.NODE_ENV !== "production" && me && !ge && typeof window < "u" && (ge = Pe(ye));
|
|
56
56
|
}
|
|
57
57
|
function xe(e, t) {
|
|
58
58
|
process.env.NODE_ENV !== "production" && r(e, t);
|
|
@@ -79,10 +79,17 @@ function Ne() {
|
|
|
79
79
|
Te = v.filter((e) => e.onSetValue), Ee = v.filter((e) => e.onSetOriginalValue), De = v.filter((e) => e.onElementCreated), Oe = v.filter((e) => e.onElementAdopted), ke = v.filter((e) => e.onCommit);
|
|
80
80
|
}
|
|
81
81
|
function Pe(e) {
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
v.push(e), Ne();
|
|
83
|
+
let t = () => {
|
|
84
|
+
let t = v.lastIndexOf(e);
|
|
84
85
|
t < 0 || (v.splice(t, 1), Ne());
|
|
85
86
|
};
|
|
87
|
+
try {
|
|
88
|
+
e.setup?.(Me);
|
|
89
|
+
} catch (e) {
|
|
90
|
+
throw t(), e;
|
|
91
|
+
}
|
|
92
|
+
return t;
|
|
86
93
|
}
|
|
87
94
|
function Fe(e, t) {
|
|
88
95
|
let n = t;
|
|
@@ -188,8 +195,17 @@ var Je = class {
|
|
|
188
195
|
}
|
|
189
196
|
commit() {
|
|
190
197
|
for (; !(!this.announceFlags() && !this.announceValues() && !this.settleValidity()););
|
|
191
|
-
|
|
192
|
-
|
|
198
|
+
}
|
|
199
|
+
settle() {
|
|
200
|
+
let e = !1, t, n = (n) => {
|
|
201
|
+
try {
|
|
202
|
+
n();
|
|
203
|
+
} catch (n) {
|
|
204
|
+
e || (t = n), e = !0;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
for (let e = 0; e < this.settled.length; e++) n(this.settled[e]);
|
|
208
|
+
if (this.settled.length = 0, n(Ve), e) throw t;
|
|
193
209
|
}
|
|
194
210
|
buckets(e) {
|
|
195
211
|
let t = [];
|
|
@@ -260,23 +276,24 @@ function C(e) {
|
|
|
260
276
|
}
|
|
261
277
|
let t = new Je(), n = new Ze();
|
|
262
278
|
x = t, Ye = n;
|
|
279
|
+
let r;
|
|
263
280
|
try {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
return t.commit(), r;
|
|
281
|
+
if (r = e(n), Qe(r), n.rollbackRequested) throw new Xe();
|
|
282
|
+
t.commit();
|
|
267
283
|
} catch (e) {
|
|
268
284
|
if (t.rollback(), e instanceof Xe) return;
|
|
269
285
|
throw e;
|
|
270
286
|
} finally {
|
|
271
287
|
x = void 0, Ye = void 0, n.close();
|
|
272
288
|
}
|
|
289
|
+
return t.settle(), r;
|
|
273
290
|
}
|
|
274
291
|
function w(e) {
|
|
275
292
|
return x ? e(x) : C(() => e(x));
|
|
276
293
|
}
|
|
277
294
|
//#endregion
|
|
278
295
|
//#region src/actions/field-action-base.ts
|
|
279
|
-
var $e = Symbol("FieldActionBase.outermost"), T = class {
|
|
296
|
+
var $e = Symbol("FieldActionBase.outermost"), et = Symbol("FieldActionBase.releaseIfAbandoned"), T = class {
|
|
280
297
|
static get classIdentifier() {
|
|
281
298
|
throw Error("classIdentifier must be declared");
|
|
282
299
|
}
|
|
@@ -305,8 +322,8 @@ var $e = Symbol("FieldActionBase.outermost"), T = class {
|
|
|
305
322
|
boundToBinding(e) {}
|
|
306
323
|
unregisterFrom(e) {}
|
|
307
324
|
resetBinding(e) {}
|
|
308
|
-
}, E = class extends Error {}, D = Symbol("FieldBase.noErrorsBaseline"),
|
|
309
|
-
function
|
|
325
|
+
}, E = class extends Error {}, D = Symbol("FieldBase.noErrorsBaseline"), tt = Symbol("FieldBase.changedSinceErrors"), nt = Object.freeze({});
|
|
326
|
+
function rt() {
|
|
310
327
|
return {
|
|
311
328
|
originalValue: void 0,
|
|
312
329
|
announcedValue: void 0,
|
|
@@ -316,80 +333,79 @@ function nt() {
|
|
|
316
333
|
validatedValue: void 0,
|
|
317
334
|
errors: [],
|
|
318
335
|
visibility: fe,
|
|
319
|
-
access:
|
|
336
|
+
access: le,
|
|
320
337
|
valueVersion: 0,
|
|
321
338
|
validatingCount: 0,
|
|
322
339
|
validatingChildren: 0,
|
|
323
340
|
parent: void 0,
|
|
324
341
|
fieldName: void 0,
|
|
325
|
-
validationEpoch: 0,
|
|
326
342
|
declaration: void 0,
|
|
327
|
-
extra:
|
|
343
|
+
extra: nt,
|
|
328
344
|
valid: !0,
|
|
329
345
|
invalidChildren: 0,
|
|
330
346
|
errorsBaseline: D
|
|
331
347
|
};
|
|
332
348
|
}
|
|
333
|
-
function
|
|
349
|
+
function it() {
|
|
334
350
|
return {
|
|
335
|
-
...
|
|
351
|
+
...rt(),
|
|
336
352
|
value: void 0,
|
|
337
353
|
touched: !1
|
|
338
354
|
};
|
|
339
355
|
}
|
|
340
|
-
function
|
|
356
|
+
function at() {
|
|
341
357
|
return {
|
|
342
|
-
...
|
|
358
|
+
...rt(),
|
|
343
359
|
announcedValue: null,
|
|
344
360
|
cachedValue: null,
|
|
345
361
|
cachedValueVersion: -1
|
|
346
362
|
};
|
|
347
363
|
}
|
|
348
|
-
function
|
|
364
|
+
function ot() {
|
|
349
365
|
return {
|
|
350
|
-
...
|
|
366
|
+
...at(),
|
|
351
367
|
fieldNames: []
|
|
352
368
|
};
|
|
353
369
|
}
|
|
354
|
-
function
|
|
370
|
+
function st() {
|
|
355
371
|
return {
|
|
356
|
-
...
|
|
372
|
+
...at(),
|
|
357
373
|
rows: null,
|
|
358
374
|
rowsVersion: 0,
|
|
359
375
|
cachedItems: null,
|
|
360
376
|
cachedItemsVersion: -1
|
|
361
377
|
};
|
|
362
378
|
}
|
|
363
|
-
var
|
|
379
|
+
var ct = Symbol("Action.executeHandlers"), lt = Symbol("List.reorderRows"), ut = Symbol("FieldBase.beginValidating"), O = Symbol("FieldBase.errorPoliciesChanged"), dt = Symbol("FieldBase.removeErrorsOnSubmit"), k = Object.freeze([
|
|
364
380
|
"change",
|
|
365
381
|
"edit",
|
|
366
382
|
"submit",
|
|
367
383
|
"never"
|
|
368
|
-
]),
|
|
384
|
+
]), ft = Symbol("ErrorPolicy"), pt = Object.freeze({
|
|
369
385
|
validEffect: !0,
|
|
370
386
|
removeOn: "never"
|
|
371
|
-
}),
|
|
387
|
+
}), A = Object.freeze({ server: Object.freeze({
|
|
372
388
|
validEffect: !0,
|
|
373
389
|
removeOn: "edit"
|
|
374
|
-
}) }),
|
|
375
|
-
function
|
|
376
|
-
return
|
|
390
|
+
}) }), j = f(0), mt = 0;
|
|
391
|
+
function ht() {
|
|
392
|
+
return mt > 0;
|
|
377
393
|
}
|
|
378
|
-
function
|
|
379
|
-
|
|
394
|
+
function gt() {
|
|
395
|
+
j.value;
|
|
380
396
|
}
|
|
381
|
-
var
|
|
382
|
-
function
|
|
383
|
-
if (typeof e != "object" || !e) throw TypeError(`${
|
|
397
|
+
var M = (e) => typeof e == "string" ? `'${e}'` : String(e);
|
|
398
|
+
function _t(e) {
|
|
399
|
+
if (typeof e != "object" || !e) throw TypeError(`${M(e)} is not an object of rules keyed by origin`);
|
|
384
400
|
Object.entries(e).forEach(([e, t]) => {
|
|
385
401
|
if (e === "validator") throw TypeError("'validator' has no rule: a validator replaces its own errors and they always count");
|
|
386
|
-
if (typeof t != "object" || !t) throw TypeError(`The rule for ${
|
|
387
|
-
if (typeof t.validEffect != "boolean") throw TypeError(`validEffect for ${
|
|
388
|
-
if (!
|
|
389
|
-
if (t.validEffect && t.removeOn === "submit") throw TypeError(`The rule for ${
|
|
402
|
+
if (typeof t != "object" || !t) throw TypeError(`The rule for ${M(e)} is not an object of validEffect and removeOn`);
|
|
403
|
+
if (typeof t.validEffect != "boolean") throw TypeError(`validEffect for ${M(e)} is ${M(t.validEffect)}, not a boolean`);
|
|
404
|
+
if (!k.includes(t.removeOn)) throw TypeError(`removeOn for ${M(e)} is ${M(t.removeOn)}, not one of ` + k.map(M).join(", "));
|
|
405
|
+
if (t.validEffect && t.removeOn === "submit") throw TypeError(`The rule for ${M(e)} combines validEffect: true with removeOn: 'submit': an error that makes the target invalid refuses the submit that would remove it`);
|
|
390
406
|
});
|
|
391
407
|
}
|
|
392
|
-
function
|
|
408
|
+
function vt(e) {
|
|
393
409
|
let t = Object.create(null);
|
|
394
410
|
return Object.entries(e).forEach(([e, n]) => {
|
|
395
411
|
t[e] = Object.freeze({
|
|
@@ -398,62 +414,68 @@ function xt(e) {
|
|
|
398
414
|
});
|
|
399
415
|
}), Object.freeze(t);
|
|
400
416
|
}
|
|
401
|
-
function
|
|
402
|
-
|
|
403
|
-
let t =
|
|
404
|
-
return
|
|
405
|
-
...
|
|
406
|
-
...
|
|
407
|
-
}),
|
|
408
|
-
|
|
417
|
+
function yt(e) {
|
|
418
|
+
_t(e);
|
|
419
|
+
let t = A;
|
|
420
|
+
return A = Object.freeze({
|
|
421
|
+
...A,
|
|
422
|
+
...vt(e)
|
|
423
|
+
}), j.value++, () => {
|
|
424
|
+
A = t, j.value++;
|
|
409
425
|
};
|
|
410
426
|
}
|
|
411
|
-
function
|
|
412
|
-
return
|
|
427
|
+
function bt(e) {
|
|
428
|
+
return A[e] ?? pt;
|
|
413
429
|
}
|
|
414
|
-
var
|
|
430
|
+
var N = class extends T {
|
|
415
431
|
policies;
|
|
416
432
|
constructor(e) {
|
|
417
|
-
|
|
433
|
+
_t(e), super((e, t, ...n) => t(e, ...n)), this.policies = vt(e);
|
|
418
434
|
}
|
|
419
435
|
static get classIdentifier() {
|
|
420
|
-
return
|
|
436
|
+
return ft;
|
|
421
437
|
}
|
|
422
438
|
boundToBinding(e) {
|
|
423
|
-
|
|
439
|
+
mt++, this.rulesChanged(e);
|
|
424
440
|
}
|
|
425
441
|
unregisterFrom(e) {
|
|
426
|
-
|
|
442
|
+
mt--, this.rulesChanged(e);
|
|
427
443
|
}
|
|
428
444
|
rulesChanged(e) {
|
|
429
|
-
|
|
445
|
+
j.value++, w(() => e[O]());
|
|
430
446
|
}
|
|
431
447
|
};
|
|
432
|
-
function
|
|
448
|
+
function xt(e, t) {
|
|
433
449
|
return e.policies[t];
|
|
434
450
|
}
|
|
435
|
-
function
|
|
436
|
-
if (!(e instanceof
|
|
451
|
+
function St(e, t) {
|
|
452
|
+
if (!(e instanceof N)) return;
|
|
437
453
|
let n = Object.keys(e.policies);
|
|
438
454
|
t.forEach((t) => {
|
|
439
|
-
if (t === e || !(t instanceof
|
|
440
|
-
let r = n.find((e) =>
|
|
441
|
-
if (r !== void 0) throw TypeError(`An ErrorPolicy for ${
|
|
455
|
+
if (t === e || !(t instanceof N)) return;
|
|
456
|
+
let r = n.find((e) => xt(t, e) !== void 0);
|
|
457
|
+
if (r !== void 0) throw TypeError(`An ErrorPolicy for ${M(r)} is already registered on this element`);
|
|
442
458
|
});
|
|
443
459
|
}
|
|
444
460
|
//#endregion
|
|
445
461
|
//#region src/actions/value-changed-action.ts
|
|
446
|
-
var
|
|
462
|
+
var Ct = Symbol("ValueChangedAction"), P = class extends T {
|
|
447
463
|
constructor(e) {
|
|
448
464
|
super(e);
|
|
449
465
|
}
|
|
450
466
|
static get classIdentifier() {
|
|
451
|
-
return
|
|
467
|
+
return Ct;
|
|
452
468
|
}
|
|
453
469
|
execute(e, t, n, r) {
|
|
454
470
|
return super.execute(e, t, n, r);
|
|
455
471
|
}
|
|
456
|
-
},
|
|
472
|
+
}, wt = "vue-forms";
|
|
473
|
+
function F(e) {
|
|
474
|
+
return `${wt}.${e}`;
|
|
475
|
+
}
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/validators/validation-error.ts
|
|
478
|
+
var Tt = class {
|
|
457
479
|
code;
|
|
458
480
|
params;
|
|
459
481
|
detail;
|
|
@@ -465,21 +487,21 @@ var Et = Symbol("ValueChangedAction"), j = class extends T {
|
|
|
465
487
|
return this.statedOrigin === void 0 ? typeof this.source == "symbol" ? "validator" : "application" : this.statedOrigin;
|
|
466
488
|
}
|
|
467
489
|
sameAs(e) {
|
|
468
|
-
return Object.getPrototypeOf(this) === Object.getPrototypeOf(e) && this.code === e.code && this.detail === e.detail && this.statedOrigin === e.statedOrigin &&
|
|
490
|
+
return Object.getPrototypeOf(this) === Object.getPrototypeOf(e) && this.code === e.code && this.detail === e.detail && this.statedOrigin === e.statedOrigin && h(this.params, e.params);
|
|
469
491
|
}
|
|
470
|
-
},
|
|
471
|
-
function
|
|
492
|
+
}, Et = Symbol("Validator");
|
|
493
|
+
function Dt(e, t) {
|
|
472
494
|
return e.replace(/\{(\w+)\}/g, (e, n) => Object.hasOwn(t, n) ? String(t[n]) : e);
|
|
473
495
|
}
|
|
474
|
-
var
|
|
496
|
+
var I = class extends P {
|
|
475
497
|
source;
|
|
476
498
|
constructor(e) {
|
|
477
499
|
super((t, n, r, i) => {
|
|
478
|
-
let a = this.bindingState(t), o = a.abandon, s = ++a.run, c =
|
|
479
|
-
u() || (
|
|
500
|
+
let a = this.bindingState(t), o = a.abandon, s = ++a.run, c = S(), l = !1, u = () => !l && a.run === s && !c?.rolledBack, d = new AbortController(), f = () => {
|
|
501
|
+
u() || (l = !0, a.abandon === f && (a.abandon = void 0), d.abort());
|
|
480
502
|
};
|
|
481
503
|
o?.();
|
|
482
|
-
let
|
|
504
|
+
let p = t[He]() ? [] : e(r, i, t, d.signal) || [], m = (e) => C(() => {
|
|
483
505
|
let n = e?.map((e) => this.claim(e)) ?? [];
|
|
484
506
|
for (let e = t.errors.length - 1; e >= 0; e--) {
|
|
485
507
|
let r = t.errors[e];
|
|
@@ -490,17 +512,17 @@ var M = class extends j {
|
|
|
490
512
|
}
|
|
491
513
|
n.length > 0 && t.errors.push(...n), t.validate();
|
|
492
514
|
});
|
|
493
|
-
if (
|
|
494
|
-
a.abandon =
|
|
495
|
-
let e = t[
|
|
496
|
-
|
|
497
|
-
u() &&
|
|
515
|
+
if (p instanceof Promise) {
|
|
516
|
+
a.abandon = f, c?.whenRolledBack(f);
|
|
517
|
+
let e = t[ut]();
|
|
518
|
+
p.then((e) => {
|
|
519
|
+
u() && m(e);
|
|
498
520
|
}, (e) => {
|
|
499
|
-
u() && (
|
|
521
|
+
u() && (m([new Tt(F("validation_failed"), {}, "Validation could not be completed")]), console.error("Validation failed", e));
|
|
500
522
|
}).finally(() => {
|
|
501
|
-
a.abandon ===
|
|
523
|
+
a.abandon === f && (a.abandon = void 0), e();
|
|
502
524
|
}).catch((e) => console.error("Validation failed", e));
|
|
503
|
-
} else p
|
|
525
|
+
} else m(p);
|
|
504
526
|
return n(t, r, i);
|
|
505
527
|
}), this.source = Symbol(this.constructor.name);
|
|
506
528
|
}
|
|
@@ -520,20 +542,24 @@ var M = class extends j {
|
|
|
520
542
|
});
|
|
521
543
|
}
|
|
522
544
|
static get classIdentifier() {
|
|
523
|
-
return
|
|
545
|
+
return Et;
|
|
524
546
|
}
|
|
525
547
|
get eager() {
|
|
526
548
|
return !0;
|
|
527
549
|
}
|
|
528
550
|
unregisterFrom(e) {
|
|
529
551
|
w((t) => {
|
|
530
|
-
|
|
552
|
+
let n = this.bindingState(e), r = n.run;
|
|
553
|
+
t.whenCommitted(() => {
|
|
554
|
+
n.run === r && this.abandonRun(e);
|
|
555
|
+
});
|
|
531
556
|
for (let t = e.errors.length - 1; t >= 0; t--) e.errors[t].source === this.source && e.errors.splice(t, 1);
|
|
532
557
|
e.validate();
|
|
533
558
|
});
|
|
534
559
|
}
|
|
535
560
|
abandonRun(e) {
|
|
536
|
-
this.bindingState(e)
|
|
561
|
+
let t = this.bindingState(e);
|
|
562
|
+
t.run++, t.abandon?.();
|
|
537
563
|
}
|
|
538
564
|
bindingState(e) {
|
|
539
565
|
return this.state(e, () => this.newBindingState());
|
|
@@ -542,21 +568,34 @@ var M = class extends j {
|
|
|
542
568
|
return { run: 0 };
|
|
543
569
|
}
|
|
544
570
|
errorFor(e, t, n, r) {
|
|
545
|
-
return new
|
|
571
|
+
return new Tt(e?.code ?? t, r, Dt(e?.detail ?? n, r));
|
|
546
572
|
}
|
|
547
|
-
},
|
|
573
|
+
}, Ot = class e {
|
|
548
574
|
actions = [];
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
575
|
+
get registrations() {
|
|
576
|
+
return this.actions;
|
|
577
|
+
}
|
|
578
|
+
restore(e) {
|
|
579
|
+
this.actions = e;
|
|
580
|
+
}
|
|
581
|
+
register(t, n) {
|
|
582
|
+
if (!(t instanceof T)) throw Error("Invalid action type");
|
|
583
|
+
t.classIdentifier, St(t, this.actions);
|
|
584
|
+
let r = n ? this.actions.indexOf(n) : -1;
|
|
585
|
+
if (n && (n.classIdentifier !== t.classIdentifier || r < 0)) throw Error("Action to register before is not registered under the same identifier");
|
|
586
|
+
if (r >= 0) {
|
|
587
|
+
this.actions = e.inserted(this.actions, r, t);
|
|
556
588
|
return;
|
|
557
589
|
}
|
|
558
|
-
let
|
|
559
|
-
|
|
590
|
+
let i = t[$e] ? -1 : this.actions.findIndex((e) => e[$e] && e.classIdentifier === t.classIdentifier);
|
|
591
|
+
this.actions = e.inserted(this.actions, i < 0 ? this.actions.length : i, t);
|
|
592
|
+
}
|
|
593
|
+
static inserted(e, t, n) {
|
|
594
|
+
return [
|
|
595
|
+
...e.slice(0, t),
|
|
596
|
+
n,
|
|
597
|
+
...e.slice(t)
|
|
598
|
+
];
|
|
560
599
|
}
|
|
561
600
|
unregister(e) {
|
|
562
601
|
return this.actions.includes(e) ? (this.actions = this.actions.filter((t) => t !== e), !0) : !1;
|
|
@@ -571,11 +610,11 @@ var M = class extends j {
|
|
|
571
610
|
return this.run(e.classIdentifier, !1, t, n);
|
|
572
611
|
}
|
|
573
612
|
triggerEager(e, ...t) {
|
|
574
|
-
let n = this.runEager((e) => !(e instanceof
|
|
575
|
-
this.runEager((e) => e instanceof
|
|
613
|
+
let n = this.runEager((e) => !(e instanceof I), e, t) ? [e.contribution, ...t.slice(1)] : t;
|
|
614
|
+
this.runEager((e) => e instanceof I, e, n);
|
|
576
615
|
}
|
|
577
616
|
triggerEagerRules(e, ...t) {
|
|
578
|
-
this.runEager((e) => !(e instanceof
|
|
617
|
+
this.runEager((e) => !(e instanceof I), e, t);
|
|
579
618
|
}
|
|
580
619
|
runEager(t, n, r) {
|
|
581
620
|
let i = !1, a = this.actions;
|
|
@@ -602,7 +641,7 @@ var M = class extends j {
|
|
|
602
641
|
return this.actions.filter((t) => t.classIdentifier === e);
|
|
603
642
|
}
|
|
604
643
|
get validators() {
|
|
605
|
-
return this.actions.filter((e) => e instanceof
|
|
644
|
+
return this.actions.filter((e) => e instanceof I);
|
|
606
645
|
}
|
|
607
646
|
bindTo(e) {
|
|
608
647
|
this.actions.forEach((t) => t.boundToBinding(e));
|
|
@@ -641,40 +680,40 @@ var M = class extends j {
|
|
|
641
680
|
};
|
|
642
681
|
//#endregion
|
|
643
682
|
//#region src/resolve.ts
|
|
644
|
-
function
|
|
683
|
+
function L(e) {
|
|
645
684
|
let t = e;
|
|
646
685
|
for (; t.fieldName !== void 0 && t.parent;) t = t.parent;
|
|
647
686
|
return t;
|
|
648
687
|
}
|
|
649
|
-
function
|
|
688
|
+
function kt(e, t) {
|
|
650
689
|
let n = e;
|
|
651
|
-
for (let e of
|
|
690
|
+
for (let e of At(t)) if (n = n.field?.(e) ?? void 0, !n) return;
|
|
652
691
|
return n?.declaration === t ? n : void 0;
|
|
653
692
|
}
|
|
654
|
-
function
|
|
693
|
+
function At(e) {
|
|
655
694
|
let t = [], n = e;
|
|
656
695
|
for (; n.fieldName !== void 0 && n.parent;) t.unshift(n.fieldName), n = n.parent;
|
|
657
696
|
return t;
|
|
658
697
|
}
|
|
659
|
-
function
|
|
660
|
-
let n =
|
|
698
|
+
function jt(e, t) {
|
|
699
|
+
let n = kt(t, e);
|
|
661
700
|
if (n) return n;
|
|
662
701
|
let r = t.parent;
|
|
663
702
|
for (; r;) {
|
|
664
|
-
let t =
|
|
703
|
+
let t = kt(L(r), e);
|
|
665
704
|
if (t) return t;
|
|
666
705
|
r = r.parent;
|
|
667
706
|
}
|
|
668
|
-
return
|
|
707
|
+
return L(e) === L(t.declaration) ? void 0 : e;
|
|
669
708
|
}
|
|
670
|
-
function
|
|
671
|
-
let n =
|
|
709
|
+
function Mt(e, t) {
|
|
710
|
+
let n = jt(e, t);
|
|
672
711
|
if (!n) return [];
|
|
673
712
|
if (n !== e) return [n];
|
|
674
713
|
let r = t.bindingsOf(e);
|
|
675
714
|
return r.length > 0 ? r : [e];
|
|
676
715
|
}
|
|
677
|
-
function
|
|
716
|
+
function Nt(e, t) {
|
|
678
717
|
let n = t.parent;
|
|
679
718
|
for (; n;) {
|
|
680
719
|
let t = n.field?.(e);
|
|
@@ -683,41 +722,68 @@ function Ft(e, t) {
|
|
|
683
722
|
}
|
|
684
723
|
}
|
|
685
724
|
//#endregion
|
|
686
|
-
//#region src/
|
|
687
|
-
var
|
|
725
|
+
//#region src/weak-elements.ts
|
|
726
|
+
var Pt = class {
|
|
727
|
+
refs = /* @__PURE__ */ new Set();
|
|
728
|
+
byElement = /* @__PURE__ */ new WeakMap();
|
|
729
|
+
add(e) {
|
|
730
|
+
if (this.byElement.has(e)) return;
|
|
731
|
+
let t = new WeakRef(e);
|
|
732
|
+
this.byElement.set(e, t), this.refs.add(t);
|
|
733
|
+
}
|
|
734
|
+
has(e) {
|
|
735
|
+
return this.byElement.has(e);
|
|
736
|
+
}
|
|
737
|
+
delete(e) {
|
|
738
|
+
let t = this.byElement.get(e);
|
|
739
|
+
return t ? (this.byElement.delete(e), this.refs.delete(t), !0) : !1;
|
|
740
|
+
}
|
|
741
|
+
get alive() {
|
|
742
|
+
let e = [];
|
|
743
|
+
return this.refs.forEach((t) => {
|
|
744
|
+
let n = t.deref();
|
|
745
|
+
n ? e.push(n) : this.refs.delete(t);
|
|
746
|
+
}), e;
|
|
747
|
+
}
|
|
748
|
+
}, Ft = Symbol("ConditionalStatementAction"), R = class extends P {
|
|
688
749
|
statement;
|
|
689
750
|
conditionalExecutor;
|
|
690
|
-
declarations =
|
|
751
|
+
declarations = new Pt();
|
|
691
752
|
registrations = /* @__PURE__ */ new WeakSet();
|
|
692
753
|
constructor(e, t) {
|
|
693
|
-
super((e, t, n, r) => (this.applyIn(
|
|
754
|
+
super((e, t, n, r) => (this.applyIn(L(e)) || e.markRecordIncomplete(), t(e, n, r))), this.statement = e, this.conditionalExecutor = t, this.relay = new P((e, t, ...n) => (this.applyFrom(e), t(e, ...n))), this.relay[$e] = !0, this.relay[et] = () => {
|
|
755
|
+
this.bound && this.declarations.alive.length === 0 && this.stopListening();
|
|
756
|
+
}, this.listen();
|
|
694
757
|
}
|
|
695
758
|
relay;
|
|
696
|
-
registered = 0;
|
|
697
759
|
listening = !1;
|
|
760
|
+
bound = !1;
|
|
698
761
|
listen() {
|
|
699
762
|
this.listening || (this.listening = !0, this.statement.collectFields().forEach((e) => e.registerAction(this.relay)));
|
|
700
763
|
}
|
|
764
|
+
stopListening() {
|
|
765
|
+
this.listening && (S()?.whenRolledBack(() => {
|
|
766
|
+
this.listening = !0;
|
|
767
|
+
}), this.listening = !1, this.statement.collectFields().forEach((e) => e.unregisterAction(this.relay)));
|
|
768
|
+
}
|
|
701
769
|
static get classIdentifier() {
|
|
702
|
-
return
|
|
770
|
+
return Ft;
|
|
703
771
|
}
|
|
704
772
|
get eager() {
|
|
705
773
|
return !0;
|
|
706
774
|
}
|
|
707
775
|
boundToBinding(e) {
|
|
708
|
-
this.declarations.add(e.declaration), this.registrations.
|
|
776
|
+
this.declarations.add(e.declaration), this.registrations.add(e), this.bound = !0, this.listen();
|
|
709
777
|
}
|
|
710
778
|
resetBinding(e) {
|
|
711
779
|
this.forgetState(e);
|
|
712
780
|
}
|
|
713
781
|
unregisterFrom(e) {
|
|
714
|
-
this.registrations.delete(e) && this.
|
|
715
|
-
this.listening = !0;
|
|
716
|
-
}), this.listening = !1, this.statement.collectFields().forEach((e) => e.unregisterAction(this.relay)));
|
|
782
|
+
this.registrations.delete(e), e === e.declaration && this.declarations.delete(e), this.declarations.alive.length === 0 && this.stopListening();
|
|
717
783
|
}
|
|
718
784
|
targetsIn(e) {
|
|
719
785
|
let t = [];
|
|
720
|
-
return this.declarations.forEach((n) =>
|
|
786
|
+
return this.declarations.alive.forEach((n) => Mt(n, e).forEach((e) => {
|
|
721
787
|
this.registrations.has(e) && t.push(e);
|
|
722
788
|
})), t;
|
|
723
789
|
}
|
|
@@ -734,29 +800,29 @@ var It = Symbol("ConditionalStatementAction"), P = class extends j {
|
|
|
734
800
|
}
|
|
735
801
|
applyFrom(e) {
|
|
736
802
|
let t = /* @__PURE__ */ new Set();
|
|
737
|
-
this.targetsIn(
|
|
803
|
+
this.targetsIn(L(e)).forEach((e) => t.add(L(e))), t.forEach((e) => this.applyIn(e));
|
|
738
804
|
}
|
|
739
|
-
},
|
|
805
|
+
}, It = class extends R {
|
|
740
806
|
constructor(e, t = "full", n = "suppress") {
|
|
741
807
|
super(e, (e, r) => {
|
|
742
808
|
e.visibility = r ? t : n;
|
|
743
809
|
});
|
|
744
810
|
}
|
|
745
|
-
},
|
|
811
|
+
}, Lt = class extends R {
|
|
746
812
|
constructor(e, t = "editable", n = "disabled") {
|
|
747
813
|
super(e, (e, r) => {
|
|
748
814
|
e.access = r ? t : n;
|
|
749
815
|
});
|
|
750
816
|
}
|
|
751
|
-
},
|
|
817
|
+
}, Rt = class extends R {
|
|
752
818
|
constructor(e, t) {
|
|
753
819
|
super(e, (e, n) => {
|
|
754
820
|
n && (e.value = t);
|
|
755
821
|
});
|
|
756
822
|
}
|
|
757
|
-
},
|
|
823
|
+
}, z = /* @__PURE__ */ function(e) {
|
|
758
824
|
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;
|
|
759
|
-
}(
|
|
825
|
+
}(z || {});
|
|
760
826
|
(function(e) {
|
|
761
827
|
function t(e) {
|
|
762
828
|
let t = e.toLowerCase();
|
|
@@ -792,15 +858,15 @@ var It = Symbol("ConditionalStatementAction"), P = class extends j {
|
|
|
792
858
|
}
|
|
793
859
|
e.fromString = t;
|
|
794
860
|
function n(e) {
|
|
795
|
-
let t = typeof e == "number" ? e :
|
|
796
|
-
if (Object.values(
|
|
861
|
+
let t = typeof e == "number" ? e : z.fromString(e);
|
|
862
|
+
if (Object.values(z).includes(t)) return t;
|
|
797
863
|
throw Error(`Unrecognised operator ${e}`);
|
|
798
864
|
}
|
|
799
865
|
e.fromAny = n;
|
|
800
866
|
function r(e) {
|
|
801
|
-
if (typeof e == "number") return Object.values(
|
|
867
|
+
if (typeof e == "number") return Object.values(z).includes(e);
|
|
802
868
|
try {
|
|
803
|
-
return Object.values(
|
|
869
|
+
return Object.values(z).includes(z.fromString(e));
|
|
804
870
|
} catch {
|
|
805
871
|
return !1;
|
|
806
872
|
}
|
|
@@ -810,89 +876,97 @@ var It = Symbol("ConditionalStatementAction"), P = class extends j {
|
|
|
810
876
|
return e >= 0;
|
|
811
877
|
}
|
|
812
878
|
e.isLogicOperator = i;
|
|
813
|
-
})(
|
|
814
|
-
var
|
|
879
|
+
})(z ||= {}), Object.freeze(z);
|
|
880
|
+
var B = z, zt = Symbol("AccessChangingAction"), Bt = class extends T {
|
|
815
881
|
constructor(e) {
|
|
816
882
|
super(e);
|
|
817
883
|
}
|
|
818
884
|
static get classIdentifier() {
|
|
819
|
-
return
|
|
885
|
+
return zt;
|
|
820
886
|
}
|
|
821
887
|
execute(e, t, n, r) {
|
|
822
888
|
return super.execute(e, t, n, r);
|
|
823
889
|
}
|
|
824
|
-
},
|
|
890
|
+
}, Vt = Symbol("AccessChangedAction"), Ht = class extends T {
|
|
825
891
|
constructor(e) {
|
|
826
892
|
super(e);
|
|
827
893
|
}
|
|
828
894
|
static get classIdentifier() {
|
|
829
|
-
return
|
|
895
|
+
return Vt;
|
|
830
896
|
}
|
|
831
897
|
execute(e, t, n, r) {
|
|
832
898
|
return super.execute(e, t, n, r);
|
|
833
899
|
}
|
|
834
|
-
},
|
|
900
|
+
}, Ut = Symbol("ContributionChangedAction"), Wt = class extends T {
|
|
835
901
|
constructor(e) {
|
|
836
902
|
super(e);
|
|
837
903
|
}
|
|
838
904
|
static get classIdentifier() {
|
|
839
|
-
return
|
|
905
|
+
return Ut;
|
|
840
906
|
}
|
|
841
907
|
execute(e, t, n, r) {
|
|
842
908
|
return super.execute(e, t, n, r);
|
|
843
909
|
}
|
|
844
|
-
},
|
|
910
|
+
}, Gt = Symbol("EnabledChangingAction"), Kt = class extends T {
|
|
845
911
|
constructor(e) {
|
|
846
912
|
super(e);
|
|
847
913
|
}
|
|
848
914
|
static get classIdentifier() {
|
|
849
|
-
return
|
|
915
|
+
return Gt;
|
|
850
916
|
}
|
|
851
917
|
execute(e, t, n, r) {
|
|
852
918
|
return super.execute(e, t, n, r);
|
|
853
919
|
}
|
|
854
|
-
},
|
|
920
|
+
}, qt = Symbol("EnabledChangedAction"), Jt = class extends T {
|
|
855
921
|
constructor(e) {
|
|
856
922
|
super(e);
|
|
857
923
|
}
|
|
858
924
|
static get classIdentifier() {
|
|
859
|
-
return
|
|
925
|
+
return qt;
|
|
860
926
|
}
|
|
861
927
|
execute(e, t, n, r) {
|
|
862
928
|
return super.execute(e, t, n, r);
|
|
863
929
|
}
|
|
864
|
-
},
|
|
930
|
+
}, Yt = Symbol("ValidChangedAction"), Xt = class extends T {
|
|
865
931
|
constructor(e) {
|
|
866
932
|
super(e);
|
|
867
933
|
}
|
|
868
934
|
static get classIdentifier() {
|
|
869
|
-
return
|
|
935
|
+
return Yt;
|
|
870
936
|
}
|
|
871
937
|
execute(e, t, n, r) {
|
|
872
938
|
return super.execute(e, t, n, r);
|
|
873
939
|
}
|
|
874
|
-
},
|
|
940
|
+
}, Zt = Symbol("VisibilityChangingAction"), Qt = class extends T {
|
|
875
941
|
constructor(e) {
|
|
876
942
|
super(e);
|
|
877
943
|
}
|
|
878
944
|
static get classIdentifier() {
|
|
879
|
-
return
|
|
945
|
+
return Zt;
|
|
880
946
|
}
|
|
881
947
|
execute(e, t, n, r) {
|
|
882
948
|
return super.execute(e, t, n, r);
|
|
883
949
|
}
|
|
884
|
-
},
|
|
950
|
+
}, $t = Symbol("VisibilityChangedAction"), en = class extends T {
|
|
885
951
|
constructor(e) {
|
|
886
952
|
super(e);
|
|
887
953
|
}
|
|
888
954
|
static get classIdentifier() {
|
|
889
|
-
return
|
|
955
|
+
return $t;
|
|
890
956
|
}
|
|
891
957
|
execute(e, t, n, r) {
|
|
892
958
|
return super.execute(e, t, n, r);
|
|
893
959
|
}
|
|
894
|
-
},
|
|
895
|
-
function an(e
|
|
960
|
+
}, tn = /* @__PURE__ */ new WeakMap(), nn = 6e4, rn = /* @__PURE__ */ new WeakMap();
|
|
961
|
+
function an(e) {
|
|
962
|
+
let t = [];
|
|
963
|
+
return e.refs.forEach((n) => {
|
|
964
|
+
let r = n.deref();
|
|
965
|
+
r ? t.push(r) : e.refs.delete(n);
|
|
966
|
+
}), e.sweptAt = Date.now(), t;
|
|
967
|
+
}
|
|
968
|
+
var on = /* @__PURE__ */ new Set(["validators", "actions"]);
|
|
969
|
+
function sn(e, t) {
|
|
896
970
|
for (let n = Object.getPrototypeOf(e); n && n !== Object.prototype;) {
|
|
897
971
|
let e = Object.getOwnPropertyDescriptor(n, t);
|
|
898
972
|
if (e) return e.get !== void 0 || e.set !== void 0;
|
|
@@ -900,11 +974,11 @@ function an(e, t) {
|
|
|
900
974
|
}
|
|
901
975
|
return !1;
|
|
902
976
|
}
|
|
903
|
-
var
|
|
904
|
-
function
|
|
905
|
-
if (Object.hasOwn(e, "enabled")) throw TypeError(`enabled is read from access and cannot be assigned; state access instead: ${
|
|
977
|
+
var cn = (e) => typeof e == "string" ? `'${e}'` : String(e), ln = (e) => e.map(cn).join(", "), V = (e) => e.origin !== "validator", un = (e) => e === "disabled" ? "omit" : e === "disabled-null" ? "null" : "value";
|
|
978
|
+
function dn(e) {
|
|
979
|
+
if (Object.hasOwn(e, "enabled")) throw TypeError(`enabled is read from access and cannot be assigned; state access instead: ${ln(_)}`);
|
|
906
980
|
}
|
|
907
|
-
var
|
|
981
|
+
var fn = 0, H = null, U = class {
|
|
908
982
|
get __v_skip() {
|
|
909
983
|
return !0;
|
|
910
984
|
}
|
|
@@ -917,7 +991,7 @@ var ln = 0, z = null, B = class {
|
|
|
917
991
|
#e;
|
|
918
992
|
#t;
|
|
919
993
|
constructor(e) {
|
|
920
|
-
this.#t = e, this.#e =
|
|
994
|
+
this.#t = e, this.#e = u(e), ze(this);
|
|
921
995
|
}
|
|
922
996
|
get state() {
|
|
923
997
|
return this.#e;
|
|
@@ -930,7 +1004,7 @@ var ln = 0, z = null, B = class {
|
|
|
930
1004
|
t.touch(this);
|
|
931
1005
|
let n = t.willAnnounceValue(this), { announcedValue: r, announcedContribution: i, validatedValue: a } = this.#t;
|
|
932
1006
|
this.asReset(() => {
|
|
933
|
-
this.resetTo(this.declaration, e),
|
|
1007
|
+
this.resetTo(this.declaration, e), H?.push(this);
|
|
934
1008
|
}), n ? Object.assign(this.#t, {
|
|
935
1009
|
announcedValue: r,
|
|
936
1010
|
announcedContribution: i,
|
|
@@ -956,15 +1030,15 @@ var ln = 0, z = null, B = class {
|
|
|
956
1030
|
extendedOf(e) {
|
|
957
1031
|
let t = Object.create(null);
|
|
958
1032
|
return Object.entries(e).forEach(([e, n]) => {
|
|
959
|
-
|
|
1033
|
+
on.has(e) || sn(this, e) || (t[e] = n);
|
|
960
1034
|
}), t;
|
|
961
1035
|
}
|
|
962
1036
|
assignParams(e) {
|
|
963
|
-
|
|
1037
|
+
dn(e);
|
|
964
1038
|
let t = this.extendedOf(e);
|
|
965
1039
|
Object.entries(e).forEach(([e, n]) => {
|
|
966
|
-
Object.hasOwn(t, e) ||
|
|
967
|
-
}),
|
|
1040
|
+
Object.hasOwn(t, e) || on.has(e) || (this[e] = n);
|
|
1041
|
+
}), ne(t) || this.setExtendedValues(t);
|
|
968
1042
|
}
|
|
969
1043
|
touchState() {
|
|
970
1044
|
S()?.touch(this);
|
|
@@ -982,7 +1056,7 @@ var ln = 0, z = null, B = class {
|
|
|
982
1056
|
get validating() {
|
|
983
1057
|
return this.#e.validatingCount > 0 || this.#e.validatingChildren > 0;
|
|
984
1058
|
}
|
|
985
|
-
[
|
|
1059
|
+
[ut]() {
|
|
986
1060
|
let e = !this.validating;
|
|
987
1061
|
this.#e.validatingCount++, e && this.container?.childValidatingChanged(!0);
|
|
988
1062
|
let t = !1;
|
|
@@ -999,7 +1073,7 @@ var ln = 0, z = null, B = class {
|
|
|
999
1073
|
}
|
|
1000
1074
|
settled() {
|
|
1001
1075
|
return this.pending ? new Promise((e) => {
|
|
1002
|
-
let t =
|
|
1076
|
+
let t = ee(() => this.pending, (n) => {
|
|
1003
1077
|
n || (t(), e());
|
|
1004
1078
|
}, { flush: "sync" });
|
|
1005
1079
|
}) : Promise.resolve();
|
|
@@ -1012,19 +1086,19 @@ var ln = 0, z = null, B = class {
|
|
|
1012
1086
|
}
|
|
1013
1087
|
noteErrorsBaseline() {
|
|
1014
1088
|
let e = this.#t;
|
|
1015
|
-
e.errorsBaseline !== D || !e.errors.some(
|
|
1089
|
+
e.errorsBaseline !== D || !e.errors.some(V) || (e.errorsBaseline = p(this.value));
|
|
1016
1090
|
}
|
|
1017
1091
|
ruleOf(e) {
|
|
1018
1092
|
for (let t of this.selfAndAbove()) {
|
|
1019
1093
|
let n = t.boundActions;
|
|
1020
|
-
if (!n?.willTrigger(
|
|
1021
|
-
let r = n.ofClass(
|
|
1094
|
+
if (!n?.willTrigger(N.classIdentifier)) continue;
|
|
1095
|
+
let r = n.ofClass(N.classIdentifier);
|
|
1022
1096
|
for (let t = r.length - 1; t >= 0; t--) {
|
|
1023
|
-
let n =
|
|
1097
|
+
let n = xt(r[t], e);
|
|
1024
1098
|
if (n) return n;
|
|
1025
1099
|
}
|
|
1026
1100
|
}
|
|
1027
|
-
return
|
|
1101
|
+
return bt(e);
|
|
1028
1102
|
}
|
|
1029
1103
|
selfAndAbove() {
|
|
1030
1104
|
let e = [this];
|
|
@@ -1032,38 +1106,38 @@ var ln = 0, z = null, B = class {
|
|
|
1032
1106
|
return e;
|
|
1033
1107
|
}
|
|
1034
1108
|
ownErrorsValid(e) {
|
|
1035
|
-
return e.length === 0 || !e.some((e) => !
|
|
1109
|
+
return e.length === 0 || !e.some((e) => !V(e) || (gt(), this.ruleOf(e.origin).validEffect));
|
|
1036
1110
|
}
|
|
1037
1111
|
removeErrors(e) {
|
|
1038
1112
|
let t = this.#e.errors, n = !1;
|
|
1039
|
-
for (let r = t.length - 1; r >= 0; r--)
|
|
1040
|
-
return this.#t.errors.some(
|
|
1113
|
+
for (let r = t.length - 1; r >= 0; r--) V(t[r]) && e(this.ruleOf(t[r].origin)) && (t.splice(r, 1), n = !0);
|
|
1114
|
+
return this.#t.errors.some(V) || (this.#t.errorsBaseline = D), n;
|
|
1041
1115
|
}
|
|
1042
1116
|
editConcluded() {
|
|
1043
|
-
let e = this.selfAndAbove().filter((e) => e.#t.errors.some((t) =>
|
|
1117
|
+
let e = this.selfAndAbove().filter((e) => e.#t.errors.some((t) => V(t) && e.ruleOf(t.origin).removeOn === "edit"));
|
|
1044
1118
|
e.length !== 0 && w((t) => {
|
|
1045
1119
|
for (let n of e) {
|
|
1046
1120
|
let e = n.#t, r = e.errorsBaseline;
|
|
1047
1121
|
if (t.touch(n), r === D) {
|
|
1048
|
-
e.errorsBaseline =
|
|
1122
|
+
e.errorsBaseline = p(n.value);
|
|
1049
1123
|
continue;
|
|
1050
1124
|
}
|
|
1051
|
-
r !==
|
|
1125
|
+
r !== tt && h(n.value, r) || (n.removeErrors((e) => e.removeOn === "edit"), t.markValidityDirty(n));
|
|
1052
1126
|
}
|
|
1053
1127
|
});
|
|
1054
1128
|
}
|
|
1055
|
-
[
|
|
1129
|
+
[dt]() {
|
|
1056
1130
|
w((e) => {
|
|
1057
1131
|
let t = (n) => {
|
|
1058
|
-
n.#t.errors.some(
|
|
1132
|
+
n.#t.errors.some(V) && (e.touch(n), n.removeErrors((e) => e.removeOn === "submit") && e.markValidityDirty(n)), n.members.forEach(t);
|
|
1059
1133
|
};
|
|
1060
1134
|
t(this);
|
|
1061
1135
|
});
|
|
1062
1136
|
}
|
|
1063
|
-
[
|
|
1137
|
+
[O]() {
|
|
1064
1138
|
w((e) => {
|
|
1065
1139
|
let t = (n) => {
|
|
1066
|
-
n.#t.errors.some(
|
|
1140
|
+
n.#t.errors.some(V) && e.markValidityDirty(n), n.members.forEach(t);
|
|
1067
1141
|
};
|
|
1068
1142
|
t(this);
|
|
1069
1143
|
});
|
|
@@ -1090,12 +1164,12 @@ var ln = 0, z = null, B = class {
|
|
|
1090
1164
|
return r(this), n;
|
|
1091
1165
|
}
|
|
1092
1166
|
markRecordIncomplete() {
|
|
1093
|
-
this._recordPending || (this._recordPending = !0,
|
|
1167
|
+
this._recordPending || (this._recordPending = !0, fn++);
|
|
1094
1168
|
}
|
|
1095
1169
|
completeRecords(e = this) {
|
|
1096
|
-
|
|
1170
|
+
fn !== 0 && w(() => {
|
|
1097
1171
|
let t = (e) => {
|
|
1098
|
-
e._recordPending && (e._recordPending = !1,
|
|
1172
|
+
e._recordPending && (e._recordPending = !1, fn--, e.rerunEagerActions()), e.members.forEach(t);
|
|
1099
1173
|
};
|
|
1100
1174
|
t(e);
|
|
1101
1175
|
});
|
|
@@ -1109,20 +1183,20 @@ var ln = 0, z = null, B = class {
|
|
|
1109
1183
|
return this._actions;
|
|
1110
1184
|
}
|
|
1111
1185
|
noteBinding(e) {
|
|
1112
|
-
let t =
|
|
1113
|
-
t
|
|
1186
|
+
let t = tn.get(this);
|
|
1187
|
+
t ? Date.now() - t.sweptAt >= nn && an(t) : (t = {
|
|
1188
|
+
refs: /* @__PURE__ */ new Set(),
|
|
1189
|
+
sweptAt: Date.now()
|
|
1190
|
+
}, tn.set(this, t)), t.refs.add(new WeakRef(e));
|
|
1114
1191
|
}
|
|
1115
1192
|
get boundElements() {
|
|
1116
|
-
let e = this.declaration, t =
|
|
1117
|
-
return t
|
|
1118
|
-
let r = e.deref();
|
|
1119
|
-
r ? n.push(r) : t.delete(e);
|
|
1120
|
-
}), n;
|
|
1193
|
+
let e = this.declaration, t = tn.get(e);
|
|
1194
|
+
return t ? [e, ...an(t)] : [e];
|
|
1121
1195
|
}
|
|
1122
1196
|
get actions() {
|
|
1123
1197
|
let e = this.declaration;
|
|
1124
1198
|
if (!e._actions) {
|
|
1125
|
-
let t = new
|
|
1199
|
+
let t = new Ot();
|
|
1126
1200
|
e.boundElements.forEach((e) => {
|
|
1127
1201
|
e._actions = t;
|
|
1128
1202
|
});
|
|
@@ -1146,7 +1220,7 @@ var ln = 0, z = null, B = class {
|
|
|
1146
1220
|
}
|
|
1147
1221
|
errorsAfterChange(e) {
|
|
1148
1222
|
let t = this.#t;
|
|
1149
|
-
t.errors.some(
|
|
1223
|
+
t.errors.some(V) && (e.touch(this), this.removeErrors((e) => e.removeOn === "change"), t.errorsBaseline === D && t.errors.some(V) && (t.errorsBaseline = tt));
|
|
1150
1224
|
}
|
|
1151
1225
|
constructed(e) {}
|
|
1152
1226
|
refreshPreviousValue() {
|
|
@@ -1158,9 +1232,11 @@ var ln = 0, z = null, B = class {
|
|
|
1158
1232
|
takeChild(e, t) {
|
|
1159
1233
|
w((n) => {
|
|
1160
1234
|
if (e.parent) throw TypeError("This element already belongs to a container - pass a bind() of it");
|
|
1235
|
+
if (e === this) throw TypeError("A container cannot hold itself or a container above it");
|
|
1236
|
+
for (let t = this.parent; t; t = t.parent) if (t === e) throw TypeError("A container cannot hold itself or a container above it");
|
|
1161
1237
|
n.touch(e), e.#e.fieldName = t;
|
|
1162
1238
|
let r = this.effectiveAccess === "editable" ? void 0 : e.effectiveAccessFromHere();
|
|
1163
|
-
e.#e.parent = this, r && e.revalidateWhereChanged(r),
|
|
1239
|
+
e.#e.parent = this, r && e.revalidateWhereChanged(r), ht() && e[O](), this.adoptChild(e), Be(n, e);
|
|
1164
1240
|
});
|
|
1165
1241
|
}
|
|
1166
1242
|
adoptChild(e) {
|
|
@@ -1176,7 +1252,7 @@ var ln = 0, z = null, B = class {
|
|
|
1176
1252
|
let n = this.effectiveAccess === "editable" ? void 0 : e.effectiveAccessFromHere();
|
|
1177
1253
|
e.validating && this.childValidatingChanged(!1), t.whenRolledBack(() => {
|
|
1178
1254
|
e.validating && this.childValidatingChanged(!0);
|
|
1179
|
-
}), e.#e.parent = void 0, e.#e.fieldName = void 0, n && e.revalidateWhereChanged(n),
|
|
1255
|
+
}), e.#e.parent = void 0, e.#e.fieldName = void 0, n && e.revalidateWhereChanged(n), ht() && e[O](), t.markValidityDirty(this);
|
|
1180
1256
|
});
|
|
1181
1257
|
}
|
|
1182
1258
|
resetTo(e, t) {
|
|
@@ -1188,19 +1264,19 @@ var ln = 0, z = null, B = class {
|
|
|
1188
1264
|
});
|
|
1189
1265
|
}
|
|
1190
1266
|
resetChild(e, t, n) {
|
|
1191
|
-
e !== t && (e.access = t.access, e.visibility = t.visibility, e.boundActions?.resetBinding(e)), e.resetTo(t, n),
|
|
1267
|
+
e !== t && (e.access = t.access, e.visibility = t.visibility, e.boundActions?.resetBinding(e)), e.resetTo(t, n), H?.push(e);
|
|
1192
1268
|
}
|
|
1193
1269
|
asReset(e) {
|
|
1194
|
-
if (
|
|
1270
|
+
if (H) {
|
|
1195
1271
|
e();
|
|
1196
1272
|
return;
|
|
1197
1273
|
}
|
|
1198
1274
|
let t = [];
|
|
1199
|
-
|
|
1275
|
+
H = t;
|
|
1200
1276
|
try {
|
|
1201
1277
|
e();
|
|
1202
1278
|
} finally {
|
|
1203
|
-
|
|
1279
|
+
H = null;
|
|
1204
1280
|
}
|
|
1205
1281
|
t.forEach((e) => e.boundActions?.triggerEagerRules(e, e.contribution, e.contribution)), t.forEach((e) => e.recordBaseline());
|
|
1206
1282
|
}
|
|
@@ -1219,10 +1295,10 @@ var ln = 0, z = null, B = class {
|
|
|
1219
1295
|
set visibility(e) {
|
|
1220
1296
|
let t = this.#e.visibility;
|
|
1221
1297
|
e !== t && w((n) => {
|
|
1222
|
-
let r = this.boundActions?.trigger(
|
|
1298
|
+
let r = this.boundActions?.trigger(Qt, this, e, t);
|
|
1223
1299
|
if (r instanceof E) return;
|
|
1224
1300
|
let i = r ?? e;
|
|
1225
|
-
if (!pe(i)) throw Error(`${
|
|
1301
|
+
if (!pe(i)) throw Error(`${cn(i)} is not a visibility: ${ln(de)}`);
|
|
1226
1302
|
i !== t && (n.touch(this), this.#t.announcedVisibility === void 0 && (this.#t.announcedVisibility = t), this.#e.visibility = i, n.markFlagsDirty(this));
|
|
1227
1303
|
});
|
|
1228
1304
|
}
|
|
@@ -1232,21 +1308,21 @@ var ln = 0, z = null, B = class {
|
|
|
1232
1308
|
set access(e) {
|
|
1233
1309
|
let t = this.#e.access;
|
|
1234
1310
|
e !== t && w((n) => {
|
|
1235
|
-
let r = this.boundActions?.trigger(
|
|
1311
|
+
let r = this.boundActions?.trigger(Bt, this, e, t);
|
|
1236
1312
|
if (r instanceof E) return;
|
|
1237
1313
|
let i = r ?? e;
|
|
1238
|
-
if (!
|
|
1314
|
+
if (!ue(i)) throw Error(`${cn(i)} is not an access: ${ln(_)}`);
|
|
1239
1315
|
if (i === t) return;
|
|
1240
1316
|
let a = this.enabled, o = i === "editable";
|
|
1241
1317
|
if (o !== a) {
|
|
1242
|
-
let e = this.boundActions?.trigger(
|
|
1318
|
+
let e = this.boundActions?.trigger(Kt, this, o, a);
|
|
1243
1319
|
if (e instanceof E) return;
|
|
1244
|
-
if (e != null && typeof e != "boolean") throw Error(`${
|
|
1320
|
+
if (e != null && typeof e != "boolean") throw Error(`${cn(e)} is not what an EnabledChangingAction answers with: a boolean`);
|
|
1245
1321
|
if (e === a) return;
|
|
1246
1322
|
}
|
|
1247
1323
|
n.touch(this);
|
|
1248
1324
|
let s = this.contribution, c = this.countsInContainer, l = this.effectiveAccessBelow();
|
|
1249
|
-
this.#e.access = i, this.revalidateWhereChanged(l), !this.composesValue &&
|
|
1325
|
+
this.#e.access = i, this.revalidateWhereChanged(l), !this.composesValue && un(t) !== un(i) && this.boundActions?.triggerEager(this, this.contribution, s), this.contributionChanged(n, c), this.#t.announcedAccess === void 0 && (this.#t.announcedAccess = t), n.markFlagsDirty(this);
|
|
1250
1326
|
});
|
|
1251
1327
|
}
|
|
1252
1328
|
get effectiveAccess() {
|
|
@@ -1278,7 +1354,7 @@ var ln = 0, z = null, B = class {
|
|
|
1278
1354
|
}
|
|
1279
1355
|
revalidateWhereChanged(e) {
|
|
1280
1356
|
e.forEach((e, t) => {
|
|
1281
|
-
|
|
1357
|
+
un(t.effectiveAccess) !== un(e) && t.rerunEagerActions();
|
|
1282
1358
|
});
|
|
1283
1359
|
}
|
|
1284
1360
|
serializesAs(e) {
|
|
@@ -1320,23 +1396,23 @@ var ln = 0, z = null, B = class {
|
|
|
1320
1396
|
}
|
|
1321
1397
|
[We](e, t, n, r) {
|
|
1322
1398
|
if (r?.forEach((e) => this.boundActions?.trigger(e.actionClass, this, e.item, e.index)), !t) return;
|
|
1323
|
-
let i = this.boundActions, a = this.composesValue, o = (e, t) => a ?
|
|
1399
|
+
let i = this.boundActions, a = this.composesValue, o = (e, t) => a ? h(e, t) : e === t;
|
|
1324
1400
|
if (a && i?.hasEager) {
|
|
1325
1401
|
let t = this.contribution, r = this.#t.validatedValue;
|
|
1326
|
-
(n || !
|
|
1402
|
+
(n || !h(t, r)) && (e.touch(this), this.#t.validatedValue = t, i.triggerEager(this, t, r));
|
|
1327
1403
|
}
|
|
1328
|
-
if (!a || i?.willTrigger(
|
|
1404
|
+
if (!a || i?.willTrigger(Ct)) {
|
|
1329
1405
|
let t = this.holding, r = this.#t.announcedValue;
|
|
1330
|
-
(n || !o(t, r)) && (e.touch(this), this.#t.announcedValue = t, i?.trigger(
|
|
1406
|
+
(n || !o(t, r)) && (e.touch(this), this.#t.announcedValue = t, i?.trigger(P, this, t, r));
|
|
1331
1407
|
}
|
|
1332
|
-
if (i?.willTrigger(
|
|
1408
|
+
if (i?.willTrigger(Ut)) {
|
|
1333
1409
|
let t = this.contribution, n = this.#t.announcedContribution;
|
|
1334
|
-
o(t, n) || (e.touch(this), this.#t.announcedContribution = t, i.trigger(
|
|
1410
|
+
o(t, n) || (e.touch(this), this.#t.announcedContribution = t, i.trigger(Wt, this, t, n));
|
|
1335
1411
|
}
|
|
1336
1412
|
}
|
|
1337
1413
|
recordAnnounced() {
|
|
1338
1414
|
let e = this.boundActions;
|
|
1339
|
-
(!this.composesValue || e?.willTrigger(
|
|
1415
|
+
(!this.composesValue || e?.willTrigger(Ct)) && (this.#t.announcedValue = this.holding), e?.willTrigger(Ut) && (this.#t.announcedContribution = this.contribution), this.composesValue && e?.hasEager && (this.#t.validatedValue = this.contribution), this.#t.errorsBaseline = D;
|
|
1340
1416
|
}
|
|
1341
1417
|
[Ke]() {
|
|
1342
1418
|
let e = this.#t, t = e.announcedAccess;
|
|
@@ -1344,20 +1420,20 @@ var ln = 0, z = null, B = class {
|
|
|
1344
1420
|
e.announcedAccess = void 0;
|
|
1345
1421
|
let n = e.access;
|
|
1346
1422
|
if (n !== t) {
|
|
1347
|
-
this.boundActions?.trigger(
|
|
1423
|
+
this.boundActions?.trigger(Ht, this, n, t);
|
|
1348
1424
|
let e = n === "editable", r = t === "editable";
|
|
1349
|
-
e !== r && this.boundActions?.trigger(
|
|
1425
|
+
e !== r && this.boundActions?.trigger(Jt, this, e, r);
|
|
1350
1426
|
}
|
|
1351
1427
|
}
|
|
1352
1428
|
let n = e.announcedVisibility;
|
|
1353
|
-
n !== void 0 && (e.announcedVisibility = void 0, e.visibility !== n && this.boundActions?.trigger(
|
|
1429
|
+
n !== void 0 && (e.announcedVisibility = void 0, e.visibility !== n && this.boundActions?.trigger(en, this, e.visibility, n));
|
|
1354
1430
|
}
|
|
1355
1431
|
[Ge](e) {
|
|
1356
1432
|
let t = this.#t.valid, n = this.countedValid;
|
|
1357
1433
|
if (n === t) return;
|
|
1358
1434
|
e.touch(this), this.#t.valid = n;
|
|
1359
1435
|
let r = this.container;
|
|
1360
|
-
r && this.countsInContainer && (e.touch(r), r.childValidityChanged(n), e.markValidityDirty(r)), this.boundActions?.trigger(
|
|
1436
|
+
r && this.countsInContainer && (e.touch(r), r.childValidityChanged(n), e.markValidityDirty(r)), this.boundActions?.trigger(Xt, this, n, t);
|
|
1361
1437
|
}
|
|
1362
1438
|
validate(e = !1) {
|
|
1363
1439
|
w((t) => {
|
|
@@ -1371,15 +1447,15 @@ var ln = 0, z = null, B = class {
|
|
|
1371
1447
|
return this.value;
|
|
1372
1448
|
}
|
|
1373
1449
|
get isChanged() {
|
|
1374
|
-
return !
|
|
1450
|
+
return !h(this.value, this.originalValue);
|
|
1375
1451
|
}
|
|
1376
1452
|
boundFrom(e, t, n, r) {
|
|
1377
|
-
r &&
|
|
1453
|
+
r && dn(r), this.#t.declaration = e.declaration;
|
|
1378
1454
|
let i = {
|
|
1379
1455
|
...e.extra,
|
|
1380
1456
|
...r && this.extendedOf(r)
|
|
1381
1457
|
};
|
|
1382
|
-
|
|
1458
|
+
ne(i) || this.setExtendedValues(i);
|
|
1383
1459
|
let a = this.declaration;
|
|
1384
1460
|
a.noteBinding(this);
|
|
1385
1461
|
let o = a._actions;
|
|
@@ -1392,52 +1468,55 @@ var ln = 0, z = null, B = class {
|
|
|
1392
1468
|
}
|
|
1393
1469
|
registerAction(e) {
|
|
1394
1470
|
return w((t) => {
|
|
1395
|
-
t.willAnnounceValue(this) || this.refreshPreviousValue(), this.
|
|
1471
|
+
t.willAnnounceValue(this) || this.refreshPreviousValue(), this.register(t, e);
|
|
1396
1472
|
}), this;
|
|
1397
1473
|
}
|
|
1398
1474
|
registerActionBefore(e, t) {
|
|
1399
1475
|
return w((n) => {
|
|
1400
|
-
n.willAnnounceValue(this) || this.refreshPreviousValue(), this.
|
|
1476
|
+
n.willAnnounceValue(this) || this.refreshPreviousValue(), this.register(n, e, t);
|
|
1401
1477
|
}), this;
|
|
1402
1478
|
}
|
|
1403
1479
|
unregisterAction(e) {
|
|
1404
1480
|
let t = !1;
|
|
1405
1481
|
return w((n) => {
|
|
1406
1482
|
let r = this.boundActions;
|
|
1407
|
-
if (!r
|
|
1408
|
-
|
|
1409
|
-
|
|
1483
|
+
if (!r) return;
|
|
1484
|
+
let i = r.registrations;
|
|
1485
|
+
if (t = r.unregister(e), !t) return;
|
|
1486
|
+
let a = this.boundElements;
|
|
1410
1487
|
n.whenRolledBack(() => {
|
|
1411
|
-
r.
|
|
1412
|
-
}),
|
|
1488
|
+
r.restore(i), a.forEach((t) => e.boundToBinding(t));
|
|
1489
|
+
}), a.forEach((t) => e.unregisterFrom(t));
|
|
1413
1490
|
}), t;
|
|
1414
1491
|
}
|
|
1415
|
-
|
|
1416
|
-
let
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1492
|
+
register(e, t, n) {
|
|
1493
|
+
let r = this.actions;
|
|
1494
|
+
this.releaseAbandoned(r);
|
|
1495
|
+
let i = r.registrations, a = this.boundElements;
|
|
1496
|
+
e.whenRolledBack(() => {
|
|
1497
|
+
let e = r.registrations.includes(t) && !i.includes(t);
|
|
1498
|
+
r.restore(i), e && a.forEach((e) => t.unregisterFrom(e));
|
|
1499
|
+
}), r.register(t, n), a.forEach((e) => {
|
|
1500
|
+
t.boundToBinding(e), t.eager && (e.#t.validatedValue = e.contribution, r.triggerEagerFor(t.classIdentifier, e, e.contribution, e.originalValue));
|
|
1421
1501
|
});
|
|
1422
1502
|
}
|
|
1503
|
+
releaseAbandoned(e) {
|
|
1504
|
+
let t = Date.now(), n = rn.get(e);
|
|
1505
|
+
n !== void 0 && t - n < nn || (rn.set(e, t), n !== void 0 && e.registrations.forEach((e) => e[et]?.()));
|
|
1506
|
+
}
|
|
1423
1507
|
triggerAction(e, ...t) {
|
|
1424
1508
|
let n = this.boundActions;
|
|
1425
1509
|
return n ? n.trigger(e, this, ...t) : null;
|
|
1426
1510
|
}
|
|
1427
|
-
get [ut]() {
|
|
1428
|
-
return this.#e.validationEpoch;
|
|
1429
|
-
}
|
|
1430
1511
|
clearValidators() {
|
|
1431
1512
|
w((e) => {
|
|
1432
|
-
e.touch(this)
|
|
1513
|
+
e.touch(this);
|
|
1433
1514
|
let t = this.boundActions;
|
|
1434
1515
|
if (t) {
|
|
1435
|
-
let n = this.boundElements;
|
|
1436
|
-
t.
|
|
1437
|
-
t.
|
|
1438
|
-
|
|
1439
|
-
}), n.forEach((e) => r.unregisterFrom(e));
|
|
1440
|
-
});
|
|
1516
|
+
let n = t.registrations, r = t.validators, i = this.boundElements;
|
|
1517
|
+
r.forEach((e) => t.unregister(e)), e.whenRolledBack(() => {
|
|
1518
|
+
t.restore(n), r.forEach((e) => i.forEach((t) => e.boundToBinding(t)));
|
|
1519
|
+
}), r.forEach((e) => i.forEach((t) => e.unregisterFrom(t)));
|
|
1441
1520
|
}
|
|
1442
1521
|
this.errors = [], this.validate();
|
|
1443
1522
|
});
|
|
@@ -1445,10 +1524,10 @@ var ln = 0, z = null, B = class {
|
|
|
1445
1524
|
};
|
|
1446
1525
|
//#endregion
|
|
1447
1526
|
//#region src/actions/conditional/statement.ts
|
|
1448
|
-
function
|
|
1527
|
+
function pn(e, t) {
|
|
1449
1528
|
return e ? !t : t;
|
|
1450
1529
|
}
|
|
1451
|
-
var
|
|
1530
|
+
var mn = class e {
|
|
1452
1531
|
operand1;
|
|
1453
1532
|
operator;
|
|
1454
1533
|
operand2;
|
|
@@ -1457,13 +1536,13 @@ var dn = class e {
|
|
|
1457
1536
|
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').`);
|
|
1458
1537
|
}
|
|
1459
1538
|
constructor(t, n, r) {
|
|
1460
|
-
e.validateOperand(t, 1), n !==
|
|
1539
|
+
e.validateOperand(t, 1), n !== B.NOT && e.validateOperand(r, 2), this.operand1 = t, this.operator = n, this.operand2 = r;
|
|
1461
1540
|
}
|
|
1462
1541
|
static valueOf(t, n) {
|
|
1463
1542
|
if (t instanceof e) return t.evaluate(n);
|
|
1464
|
-
if (t instanceof
|
|
1465
|
-
let e = n ?
|
|
1466
|
-
return e ?
|
|
1543
|
+
if (t instanceof U) {
|
|
1544
|
+
let e = n ? jt(t, n) : t;
|
|
1545
|
+
return e ? m(e.value) : void 0;
|
|
1467
1546
|
}
|
|
1468
1547
|
return t;
|
|
1469
1548
|
}
|
|
@@ -1476,38 +1555,38 @@ var dn = class e {
|
|
|
1476
1555
|
evaluate(t) {
|
|
1477
1556
|
let n = e.valueOf(this.operand1, t), r = e.valueOf(this.operand2, t);
|
|
1478
1557
|
switch (this.operator) {
|
|
1479
|
-
case
|
|
1480
|
-
case
|
|
1481
|
-
case
|
|
1482
|
-
case
|
|
1483
|
-
case
|
|
1484
|
-
case
|
|
1485
|
-
case
|
|
1486
|
-
case
|
|
1487
|
-
case
|
|
1488
|
-
case
|
|
1489
|
-
case
|
|
1490
|
-
case
|
|
1491
|
-
case
|
|
1492
|
-
case
|
|
1493
|
-
case
|
|
1494
|
-
case
|
|
1558
|
+
case B.AND: return !!(n && r);
|
|
1559
|
+
case B.OR: return !!(n || r);
|
|
1560
|
+
case B.NAND: return !(n && r);
|
|
1561
|
+
case B.NOR: return !(n || r);
|
|
1562
|
+
case B.XOR: return pn(!!n, !!r);
|
|
1563
|
+
case B.NOT: return !n;
|
|
1564
|
+
case B.EQUALS: return n == r;
|
|
1565
|
+
case B.NOT_EQUALS: return n != r;
|
|
1566
|
+
case B.LT: return n < r;
|
|
1567
|
+
case B.LE: return n <= r;
|
|
1568
|
+
case B.GE: return n >= r;
|
|
1569
|
+
case B.GT: return n > r;
|
|
1570
|
+
case B.IN: return !!r?.includes?.(n);
|
|
1571
|
+
case B.NOT_IN: return !r?.includes?.(n);
|
|
1572
|
+
case B.INCLUDES: return g(n) && g(r) && n.indexOf(r) >= 0;
|
|
1573
|
+
case B.NOT_INCLUDES: return !(g(n) && g(r) && n.indexOf(r) >= 0);
|
|
1495
1574
|
default: throw Error(`Operator not implemented ${this.operator}`);
|
|
1496
1575
|
}
|
|
1497
1576
|
}
|
|
1498
1577
|
collectFields() {
|
|
1499
1578
|
let t = /* @__PURE__ */ new Set();
|
|
1500
1579
|
function n(n) {
|
|
1501
|
-
n instanceof
|
|
1580
|
+
n instanceof U ? t.add(n) : n instanceof e && n.collectFields().forEach((e) => t.add(e));
|
|
1502
1581
|
}
|
|
1503
1582
|
return n(this.operand1), n(this.operand2), t;
|
|
1504
1583
|
}
|
|
1505
|
-
},
|
|
1584
|
+
}, hn = Symbol("ExecuteAction"), W = class extends T {
|
|
1506
1585
|
constructor(e) {
|
|
1507
1586
|
super(e);
|
|
1508
1587
|
}
|
|
1509
1588
|
static get classIdentifier() {
|
|
1510
|
-
return
|
|
1589
|
+
return hn;
|
|
1511
1590
|
}
|
|
1512
1591
|
execute(e, t, n) {
|
|
1513
1592
|
return super.execute(e, t, n);
|
|
@@ -1515,40 +1594,40 @@ var dn = class e {
|
|
|
1515
1594
|
canExecute(e) {
|
|
1516
1595
|
return !0;
|
|
1517
1596
|
}
|
|
1518
|
-
},
|
|
1597
|
+
}, gn = class extends W {
|
|
1519
1598
|
targetFor(e) {
|
|
1520
1599
|
let t = this.target;
|
|
1521
1600
|
return typeof t == "function" ? t(e) ?? void 0 : t;
|
|
1522
1601
|
}
|
|
1523
1602
|
};
|
|
1524
|
-
function
|
|
1603
|
+
function _n(e) {
|
|
1525
1604
|
return e.validating ? new Promise((t) => {
|
|
1526
|
-
let n =
|
|
1605
|
+
let n = ee(() => e.validating, (e) => {
|
|
1527
1606
|
e || (n(), t());
|
|
1528
1607
|
}, { flush: "sync" });
|
|
1529
1608
|
}) : Promise.resolve();
|
|
1530
1609
|
}
|
|
1531
|
-
var
|
|
1610
|
+
var vn = class extends E {}, yn = class extends vn {
|
|
1532
1611
|
constructor(e) {
|
|
1533
1612
|
super("the submit handler failed", { cause: e });
|
|
1534
1613
|
}
|
|
1535
|
-
},
|
|
1614
|
+
}, bn = class extends vn {
|
|
1536
1615
|
reason;
|
|
1537
1616
|
constructor(e) {
|
|
1538
1617
|
super(e === "invalid" ? "the submitted element is invalid" : "a submit of this action is already running"), this.reason = e;
|
|
1539
1618
|
}
|
|
1540
|
-
},
|
|
1619
|
+
}, xn = class extends gn {
|
|
1541
1620
|
target;
|
|
1542
1621
|
constructor(e, t, n = {}) {
|
|
1543
1622
|
super(async (e, r, i) => {
|
|
1544
1623
|
let a = this.state(e, () => ({ running: !1 }));
|
|
1545
|
-
if (a.running) throw new
|
|
1624
|
+
if (a.running) throw new bn("running");
|
|
1546
1625
|
a.running = !0;
|
|
1547
1626
|
try {
|
|
1548
1627
|
let a = this.targetFor(e);
|
|
1549
1628
|
if (!a) throw Error("SubmitAction: the target callback returned no element");
|
|
1550
|
-
if (await
|
|
1551
|
-
a[
|
|
1629
|
+
if (await _n(a), !a.valid) throw new bn("invalid");
|
|
1630
|
+
a[dt]();
|
|
1552
1631
|
let o = a.value, s, c = n.lock !== !1 && a.access === "editable";
|
|
1553
1632
|
c && (a.access = "readonly");
|
|
1554
1633
|
let l = c && a.access === "readonly";
|
|
@@ -1556,7 +1635,7 @@ var U = class extends E {}, mn = class extends U {
|
|
|
1556
1635
|
try {
|
|
1557
1636
|
s = await t(o, a);
|
|
1558
1637
|
} catch (e) {
|
|
1559
|
-
throw new
|
|
1638
|
+
throw new yn(e);
|
|
1560
1639
|
}
|
|
1561
1640
|
s !== void 0 && n.rebind !== !1 && a.rebind(s);
|
|
1562
1641
|
} finally {
|
|
@@ -1576,7 +1655,7 @@ var U = class extends E {}, mn = class extends U {
|
|
|
1576
1655
|
let t = this.targetFor(e);
|
|
1577
1656
|
return t !== void 0 && t.valid && !t.pending;
|
|
1578
1657
|
}
|
|
1579
|
-
},
|
|
1658
|
+
}, Sn = class extends gn {
|
|
1580
1659
|
target;
|
|
1581
1660
|
constructor(e) {
|
|
1582
1661
|
super((e, t, n) => {
|
|
@@ -1588,27 +1667,27 @@ var U = class extends E {}, mn = class extends U {
|
|
|
1588
1667
|
canExecute(e) {
|
|
1589
1668
|
return this.targetFor(e) !== void 0;
|
|
1590
1669
|
}
|
|
1591
|
-
},
|
|
1670
|
+
}, Cn = Symbol("ListItemAddedAction"), G = class extends T {
|
|
1592
1671
|
constructor(e) {
|
|
1593
1672
|
super(e);
|
|
1594
1673
|
}
|
|
1595
1674
|
static get classIdentifier() {
|
|
1596
|
-
return
|
|
1675
|
+
return Cn;
|
|
1597
1676
|
}
|
|
1598
1677
|
execute(e, t, n, r) {
|
|
1599
1678
|
return super.execute(e, t, n, r);
|
|
1600
1679
|
}
|
|
1601
|
-
},
|
|
1680
|
+
}, wn = Symbol("ListItemRemovedAction"), K = class extends T {
|
|
1602
1681
|
constructor(e) {
|
|
1603
1682
|
super(e);
|
|
1604
1683
|
}
|
|
1605
1684
|
static get classIdentifier() {
|
|
1606
|
-
return
|
|
1685
|
+
return wn;
|
|
1607
1686
|
}
|
|
1608
1687
|
execute(e, t, n, r) {
|
|
1609
1688
|
return super.execute(e, t, n, r);
|
|
1610
1689
|
}
|
|
1611
|
-
}, q = class extends
|
|
1690
|
+
}, q = class extends U {
|
|
1612
1691
|
get [Symbol.toStringTag]() {
|
|
1613
1692
|
return "Field";
|
|
1614
1693
|
}
|
|
@@ -1625,7 +1704,7 @@ var U = class extends E {}, mn = class extends U {
|
|
|
1625
1704
|
this.state.value = Fe(this, e);
|
|
1626
1705
|
}
|
|
1627
1706
|
constructor(e) {
|
|
1628
|
-
super(
|
|
1707
|
+
super(it()), this.init(e);
|
|
1629
1708
|
}
|
|
1630
1709
|
init(e) {
|
|
1631
1710
|
w(() => {
|
|
@@ -1649,7 +1728,7 @@ var U = class extends E {}, mn = class extends U {
|
|
|
1649
1728
|
w((r) => {
|
|
1650
1729
|
r.touch(this);
|
|
1651
1730
|
let i = this.raw;
|
|
1652
|
-
|
|
1731
|
+
p(i.announcedValue) === p(i.value) && (i.announcedValue = n()), e(), r.whenRolledBack(t), this.bumpValueVersion(), this.serializesAs("value") === "value" && this.boundActions?.triggerEager(this, this._value, i.announcedValue), this.propagateValueChanged(!0);
|
|
1653
1732
|
});
|
|
1654
1733
|
}
|
|
1655
1734
|
get touched() {
|
|
@@ -1667,11 +1746,11 @@ var U = class extends E {}, mn = class extends U {
|
|
|
1667
1746
|
}));
|
|
1668
1747
|
return r.boundFrom(this, r.contribution, r.originalValue, t), r;
|
|
1669
1748
|
}
|
|
1670
|
-
},
|
|
1671
|
-
function
|
|
1749
|
+
}, Tn = /* @__PURE__ */ new WeakMap();
|
|
1750
|
+
function En(e) {
|
|
1672
1751
|
if (e != null) return Object.values(e).some((e) => e != null) ? e : void 0;
|
|
1673
1752
|
}
|
|
1674
|
-
var
|
|
1753
|
+
var Dn = class extends q {
|
|
1675
1754
|
get [Symbol.toStringTag]() {
|
|
1676
1755
|
return "Action";
|
|
1677
1756
|
}
|
|
@@ -1683,7 +1762,7 @@ var xn = class extends q {
|
|
|
1683
1762
|
}, e) {
|
|
1684
1763
|
let { value: t, originalValue: n, validators: r, actions: i, ...a } = e;
|
|
1685
1764
|
this.registerInitialActions([...r || [], ...i || []]), this.assignParams(a);
|
|
1686
|
-
let o =
|
|
1765
|
+
let o = En(t), s = En(n);
|
|
1687
1766
|
o ? this._value = o : s && (this._value = { ...s }), s && (this.originalValue = Object.freeze({ ...s }));
|
|
1688
1767
|
}
|
|
1689
1768
|
this.constructed(e), this.originalValue === void 0 && (this.originalValue = this._value), this.recordAnnounced(), this.boundActions?.triggerEager(this, this.contribution, this.originalValue), this.validate();
|
|
@@ -1718,14 +1797,14 @@ var xn = class extends q {
|
|
|
1718
1797
|
return !0;
|
|
1719
1798
|
}
|
|
1720
1799
|
get executable() {
|
|
1721
|
-
return !this.effectiveEnabled || this.visibility !== "full" || this.busy ? !1 : this[
|
|
1800
|
+
return !this.effectiveEnabled || this.visibility !== "full" || this.busy ? !1 : this[ct]().every((e) => e.canExecute(this));
|
|
1722
1801
|
}
|
|
1723
|
-
[
|
|
1724
|
-
return this.boundActions?.ofClass(
|
|
1802
|
+
[ct]() {
|
|
1803
|
+
return this.boundActions?.ofClass(W.classIdentifier) ?? [];
|
|
1725
1804
|
}
|
|
1726
1805
|
get busyRuns() {
|
|
1727
|
-
let e =
|
|
1728
|
-
return e || (e =
|
|
1806
|
+
let e = Tn.get(this);
|
|
1807
|
+
return e || (e = d(0), Tn.set(this, e)), e;
|
|
1729
1808
|
}
|
|
1730
1809
|
get busy() {
|
|
1731
1810
|
return this.busyRuns.value > 0;
|
|
@@ -1734,12 +1813,12 @@ var xn = class extends q {
|
|
|
1734
1813
|
let t = this.busyRuns;
|
|
1735
1814
|
t.value++;
|
|
1736
1815
|
try {
|
|
1737
|
-
return await this.triggerAction(
|
|
1816
|
+
return await this.triggerAction(W, e);
|
|
1738
1817
|
} finally {
|
|
1739
1818
|
t.value--;
|
|
1740
1819
|
}
|
|
1741
1820
|
}
|
|
1742
|
-
},
|
|
1821
|
+
}, On = /* @__PURE__ */ new WeakMap(), kn = /* @__PURE__ */ new WeakMap(), J = class e extends U {
|
|
1743
1822
|
get [Symbol.toStringTag]() {
|
|
1744
1823
|
return "Container";
|
|
1745
1824
|
}
|
|
@@ -1778,8 +1857,8 @@ var xn = class extends q {
|
|
|
1778
1857
|
return t.length > 0 && t.every((e) => this.childSerializesAs(e, "fullValue") === "omit") ? "omit" : super.serializesAs(e);
|
|
1779
1858
|
}
|
|
1780
1859
|
command(e) {
|
|
1781
|
-
let t = e === "confirm" ?
|
|
1782
|
-
r.filter(({ action: e }) => e[
|
|
1860
|
+
let t = e === "confirm" ? xn : Sn, n = e === "confirm" ? "defaultConfirm" : "defaultReject", r = this.actionsBelow().filter((e) => e.action.visibility === "full"), i = [
|
|
1861
|
+
r.filter(({ action: e }) => e[ct]().some((n) => n instanceof t && n.targetFor(e) === this)),
|
|
1783
1862
|
r.filter(({ action: e, depth: t }) => t === 0 && e[n]),
|
|
1784
1863
|
r.filter(({ action: e, depth: t }) => t > 0 && e[n])
|
|
1785
1864
|
];
|
|
@@ -1794,7 +1873,7 @@ var xn = class extends q {
|
|
|
1794
1873
|
}
|
|
1795
1874
|
}
|
|
1796
1875
|
actionsBelow(t = 0) {
|
|
1797
|
-
return this.children.flatMap((n) => n instanceof
|
|
1876
|
+
return this.children.flatMap((n) => n instanceof Dn ? [{
|
|
1798
1877
|
action: n,
|
|
1799
1878
|
depth: t
|
|
1800
1879
|
}] : n instanceof e ? n.actionsBelow(t + 1) : []);
|
|
@@ -1809,12 +1888,12 @@ var xn = class extends q {
|
|
|
1809
1888
|
return this.fullValue;
|
|
1810
1889
|
}
|
|
1811
1890
|
get validRead() {
|
|
1812
|
-
let e =
|
|
1813
|
-
return e || (e = l(() => this.ownErrorsValid(this.state.errors) && this.children.every((e) => e.valid || this.childSerializesAs(e, "value") === "omit")),
|
|
1891
|
+
let e = On.get(this);
|
|
1892
|
+
return e || (e = l(() => this.ownErrorsValid(this.state.errors) && this.children.every((e) => e.valid || this.childSerializesAs(e, "value") === "omit")), On.set(this, e)), e.value;
|
|
1814
1893
|
}
|
|
1815
1894
|
get busyRead() {
|
|
1816
|
-
let e =
|
|
1817
|
-
return e || (e = l(() => this.children.some((e) => e.busy)),
|
|
1895
|
+
let e = kn.get(this);
|
|
1896
|
+
return e || (e = l(() => this.children.some((e) => e.busy)), kn.set(this, e)), e.value;
|
|
1818
1897
|
}
|
|
1819
1898
|
childValidatingChanged(e) {
|
|
1820
1899
|
let t = this.validating;
|
|
@@ -1823,7 +1902,11 @@ var xn = class extends q {
|
|
|
1823
1902
|
childValidityChanged(e) {
|
|
1824
1903
|
this.raw.invalidChildren += e ? -1 : 1;
|
|
1825
1904
|
}
|
|
1826
|
-
},
|
|
1905
|
+
}, An = Object.freeze([]);
|
|
1906
|
+
function jn(e, t) {
|
|
1907
|
+
if (!Number.isInteger(e)) throw RangeError(`List.${t}(): the index must be an integer, got ${e}`);
|
|
1908
|
+
}
|
|
1909
|
+
var Mn = class e extends J {
|
|
1827
1910
|
get [Symbol.toStringTag]() {
|
|
1828
1911
|
return "List";
|
|
1829
1912
|
}
|
|
@@ -1835,7 +1918,7 @@ var xn = class extends q {
|
|
|
1835
1918
|
}
|
|
1836
1919
|
_itemTemplate;
|
|
1837
1920
|
constructor(t, n) {
|
|
1838
|
-
super(
|
|
1921
|
+
super(st()), this._itemTemplate = t, t && Re(t), w(() => {
|
|
1839
1922
|
if (n) {
|
|
1840
1923
|
let { value: e, validators: t, actions: r, ...i } = n;
|
|
1841
1924
|
this.registerInitialActions([...t || [], ...r || []]), this.assignParams(i), e === void 0 ? this.originalValue !== void 0 && this.setValueInternal(this.originalValue) : this.setValueInternal(e);
|
|
@@ -1852,13 +1935,13 @@ var xn = class extends q {
|
|
|
1852
1935
|
}
|
|
1853
1936
|
processSetValueItem(t) {
|
|
1854
1937
|
let n;
|
|
1855
|
-
return n = t instanceof
|
|
1938
|
+
return n = t instanceof U ? t : this._itemTemplate ? this._itemTemplate.bind(t) : e.elementFor(t), this.takeChild(n), this.completeRecords(n), n;
|
|
1856
1939
|
}
|
|
1857
1940
|
static elementFor(t) {
|
|
1858
|
-
return
|
|
1941
|
+
return ae(t) ? Y.createFromFormData(t) : Array.isArray(t) ? new e(void 0, { value: t }) : new q({ value: t });
|
|
1859
1942
|
}
|
|
1860
1943
|
createPaddingItem(t) {
|
|
1861
|
-
return this._itemTemplate ? this.processSetValueItem(this._itemTemplate.bind()) : t instanceof Y ||
|
|
1944
|
+
return this._itemTemplate ? this.processSetValueItem(this._itemTemplate.bind()) : t instanceof Y || ae(t) ? this.processSetValueItem({}) : t instanceof e || Array.isArray(t) ? this.processSetValueItem([]) : this.processSetValueItem(void 0);
|
|
1862
1945
|
}
|
|
1863
1946
|
rowsChanged() {
|
|
1864
1947
|
this.state.rowsVersion++;
|
|
@@ -1894,7 +1977,7 @@ var xn = class extends q {
|
|
|
1894
1977
|
let n = Array(t.length);
|
|
1895
1978
|
for (let r = 0; r < t.length; r++) {
|
|
1896
1979
|
let i = t[r], s = e[r], c = this._itemTemplate;
|
|
1897
|
-
s && c && !(i instanceof
|
|
1980
|
+
s && c && !(i instanceof U) && s.declaration === c.declaration ? (this.resetChild(s, c, i), n[r] = s) : (s && (this.releaseChild(s), a(s, r)), n[r] = this.processSetValueItem(i), o(n[r], r));
|
|
1898
1981
|
}
|
|
1899
1982
|
for (let n = t.length; n < e.length; n++) this.releaseChild(e[n]);
|
|
1900
1983
|
this.raw.rows = n;
|
|
@@ -1914,7 +1997,7 @@ var xn = class extends q {
|
|
|
1914
1997
|
case "null": t.push(null);
|
|
1915
1998
|
}
|
|
1916
1999
|
});
|
|
1917
|
-
let n = t.length ? Object.freeze(t) :
|
|
2000
|
+
let n = t.length ? Object.freeze(t) : An;
|
|
1918
2001
|
return this.raw.cachedValue = n, this.raw.cachedValueVersion = e, n;
|
|
1919
2002
|
}
|
|
1920
2003
|
set value(e) {
|
|
@@ -1969,6 +2052,7 @@ var xn = class extends q {
|
|
|
1969
2052
|
return this.remove((this.raw.rows?.length ?? 0) - 1);
|
|
1970
2053
|
}
|
|
1971
2054
|
remove(e) {
|
|
2055
|
+
jn(e, "remove");
|
|
1972
2056
|
let t;
|
|
1973
2057
|
return w((n) => {
|
|
1974
2058
|
let r = this.raw.rows;
|
|
@@ -1983,6 +2067,7 @@ var xn = class extends q {
|
|
|
1983
2067
|
}), t;
|
|
1984
2068
|
}
|
|
1985
2069
|
insert(e, t) {
|
|
2070
|
+
jn(t, "insert");
|
|
1986
2071
|
let n = 0;
|
|
1987
2072
|
return w((r) => {
|
|
1988
2073
|
r.touch(this);
|
|
@@ -2006,7 +2091,7 @@ var xn = class extends q {
|
|
|
2006
2091
|
releaseRows() {
|
|
2007
2092
|
this.raw.rows?.forEach((e) => this.releaseChild(e));
|
|
2008
2093
|
}
|
|
2009
|
-
[
|
|
2094
|
+
[lt](e) {
|
|
2010
2095
|
w((t) => {
|
|
2011
2096
|
t.touch(this), this.raw.rows = [...e], this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(!0);
|
|
2012
2097
|
});
|
|
@@ -2026,13 +2111,16 @@ var xn = class extends q {
|
|
|
2026
2111
|
rebind(e) {
|
|
2027
2112
|
return super.rebind(e);
|
|
2028
2113
|
}
|
|
2029
|
-
};
|
|
2114
|
+
}, Nn = /* @__PURE__ */ new WeakSet();
|
|
2115
|
+
function Pn(e) {
|
|
2116
|
+
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`);
|
|
2117
|
+
}
|
|
2030
2118
|
//#endregion
|
|
2031
2119
|
//#region src/group.ts
|
|
2032
|
-
function
|
|
2033
|
-
return
|
|
2120
|
+
function Fn(e) {
|
|
2121
|
+
return ae(e) ? Y.createFromFormData(e) : Array.isArray(e) ? new Mn(void 0, { value: e }) : new q({ value: e });
|
|
2034
2122
|
}
|
|
2035
|
-
var
|
|
2123
|
+
var In = /* @__PURE__ */ new WeakSet(), Ln = Object.freeze({}), Rn = /* @__PURE__ */ new WeakMap(), zn = (e) => ({
|
|
2036
2124
|
get(t, n, r) {
|
|
2037
2125
|
return e(), Reflect.get(t, n, r);
|
|
2038
2126
|
},
|
|
@@ -2066,17 +2154,17 @@ var Dn = /* @__PURE__ */ new WeakSet(), On = Object.freeze({}), kn = /* @__PURE_
|
|
|
2066
2154
|
}
|
|
2067
2155
|
_fields;
|
|
2068
2156
|
constructor(t, n) {
|
|
2069
|
-
if (super(
|
|
2157
|
+
if (super(ot()), !e.isValidFields(t)) throw Error("Invalid fields object provided");
|
|
2070
2158
|
this._fields = Object.create(null), w(() => {
|
|
2071
2159
|
let r = !1, i = !1;
|
|
2072
|
-
|
|
2160
|
+
In.add(this);
|
|
2073
2161
|
try {
|
|
2074
2162
|
if (Object.entries(t).forEach(([e, t]) => this.addField(e, t)), n) {
|
|
2075
2163
|
let { value: e, validators: t, actions: a, ...o } = n;
|
|
2076
2164
|
this.registerInitialActions([...t || [], ...a || []]), this.assignParams(o), e === void 0 ? this.originalValue !== void 0 && this.assignMembers(this.originalValue) : this.assignMembers(e), r = e !== void 0 || this.originalValue !== void 0, i = n.originalValue !== void 0 && e !== void 0;
|
|
2077
2165
|
}
|
|
2078
2166
|
} finally {
|
|
2079
|
-
|
|
2167
|
+
In.delete(this);
|
|
2080
2168
|
}
|
|
2081
2169
|
this.completeRecords(), this.constructed(n);
|
|
2082
2170
|
let a = this.value;
|
|
@@ -2100,7 +2188,7 @@ var Dn = /* @__PURE__ */ new WeakSet(), On = Object.freeze({}), kn = /* @__PURE_
|
|
|
2100
2188
|
addField(t, n) {
|
|
2101
2189
|
return w((r) => {
|
|
2102
2190
|
if (Object.hasOwn(this._fields, t)) throw Error(`Field ${t} is already in this form`);
|
|
2103
|
-
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),
|
|
2191
|
+
Nn.has(this) && Pn(t), 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), In.has(this) || this.completeRecords(n), this.bumpValueVersion(), this.notifyValueChanged();
|
|
2104
2192
|
}), this;
|
|
2105
2193
|
}
|
|
2106
2194
|
removeField(t) {
|
|
@@ -2108,7 +2196,9 @@ var Dn = /* @__PURE__ */ new WeakSet(), On = Object.freeze({}), kn = /* @__PURE_
|
|
|
2108
2196
|
return w((r) => {
|
|
2109
2197
|
if (!Object.hasOwn(this._fields, t)) return;
|
|
2110
2198
|
let i = this._fields[t];
|
|
2111
|
-
r.touch(this), this.releaseChild(i)
|
|
2199
|
+
r.touch(this), this.releaseChild(i);
|
|
2200
|
+
let a = Object.entries(this._fields);
|
|
2201
|
+
e.dropEntry(this._fields, t), r.whenRolledBack(() => e.restoreEntries(this._fields, a)), this.state.fieldNames.splice(this.state.fieldNames.indexOf(t), 1), this.bumpValueVersion(), this.notifyValueChanged(), n = i;
|
|
2112
2202
|
}), n;
|
|
2113
2203
|
}
|
|
2114
2204
|
static setEntry(e, t, n) {
|
|
@@ -2117,22 +2207,25 @@ var Dn = /* @__PURE__ */ new WeakSet(), On = Object.freeze({}), kn = /* @__PURE_
|
|
|
2117
2207
|
static dropEntry(e, t) {
|
|
2118
2208
|
delete e[t];
|
|
2119
2209
|
}
|
|
2210
|
+
static restoreEntries(t, n) {
|
|
2211
|
+
Object.keys(t).forEach((n) => e.dropEntry(t, n)), n.forEach(([n, r]) => e.setEntry(t, n, r));
|
|
2212
|
+
}
|
|
2120
2213
|
static isValidFields(e) {
|
|
2121
2214
|
function t(e) {
|
|
2122
|
-
return e instanceof
|
|
2215
|
+
return e instanceof U;
|
|
2123
2216
|
}
|
|
2124
2217
|
return typeof e == "object" && !!e && Object.entries(e).every(([, e]) => t(e));
|
|
2125
2218
|
}
|
|
2126
2219
|
static createFromFormData(t) {
|
|
2127
|
-
if (t instanceof
|
|
2128
|
-
return new e(t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, t]) => [e,
|
|
2220
|
+
if (t instanceof U) throw Error("data is already a Form structure, should be a simple object");
|
|
2221
|
+
return new e(t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, t]) => [e, Fn(t)])));
|
|
2129
2222
|
}
|
|
2130
2223
|
field(e) {
|
|
2131
2224
|
return this._fields[e] ?? null;
|
|
2132
2225
|
}
|
|
2133
2226
|
get fields() {
|
|
2134
|
-
let e =
|
|
2135
|
-
return e || (e = new Proxy(this._fields,
|
|
2227
|
+
let e = Rn.get(this);
|
|
2228
|
+
return e || (e = new Proxy(this._fields, zn(() => this.state.fieldNames.length)), Rn.set(this, e)), e;
|
|
2136
2229
|
}
|
|
2137
2230
|
get members() {
|
|
2138
2231
|
return this.raw.fieldNames.map((e) => this._fields[e]);
|
|
@@ -2152,7 +2245,7 @@ var Dn = /* @__PURE__ */ new WeakSet(), On = Object.freeze({}), kn = /* @__PURE_
|
|
|
2152
2245
|
case "null": t[e] = null;
|
|
2153
2246
|
}
|
|
2154
2247
|
});
|
|
2155
|
-
let n =
|
|
2248
|
+
let n = ne(t) ? Ln : Object.freeze({ ...t });
|
|
2156
2249
|
return this.raw.cachedValue = n, this.raw.cachedValueVersion = e, n;
|
|
2157
2250
|
}
|
|
2158
2251
|
assignMembers(e) {
|
|
@@ -2215,47 +2308,56 @@ var Dn = /* @__PURE__ */ new WeakSet(), On = Object.freeze({}), kn = /* @__PURE_
|
|
|
2215
2308
|
};
|
|
2216
2309
|
//#endregion
|
|
2217
2310
|
//#region src/is-equal.ts
|
|
2218
|
-
function
|
|
2219
|
-
let n = e instanceof
|
|
2220
|
-
return n === e && r === t ? void 0 :
|
|
2311
|
+
function Bn(e, t) {
|
|
2312
|
+
let n = e instanceof U ? e.value : e, r = t instanceof U ? t.value : t;
|
|
2313
|
+
return n === e && r === t ? void 0 : h(n, r);
|
|
2221
2314
|
}
|
|
2222
|
-
function
|
|
2223
|
-
return e instanceof
|
|
2315
|
+
function Vn(e, t) {
|
|
2316
|
+
return e instanceof U && t instanceof U ? h(e.value, t.value) : re(e, t, Bn);
|
|
2224
2317
|
}
|
|
2225
2318
|
//#endregion
|
|
2226
2319
|
//#region src/validators/validator-compare-to.ts
|
|
2227
|
-
var
|
|
2320
|
+
var Hn = class extends I {
|
|
2228
2321
|
isValidComparison;
|
|
2229
2322
|
otherField;
|
|
2230
2323
|
registrations = /* @__PURE__ */ new WeakSet();
|
|
2231
|
-
listening =
|
|
2232
|
-
declarations =
|
|
2324
|
+
listening = new Pt();
|
|
2325
|
+
declarations = new Pt();
|
|
2326
|
+
relay;
|
|
2233
2327
|
constructor(e, t, n) {
|
|
2234
2328
|
super((e, t, r) => {
|
|
2235
2329
|
this.comparisonState(r).oldValue = t;
|
|
2236
2330
|
let i = this.resolve(r);
|
|
2237
2331
|
if (!i) return r.markRecordIncomplete(), null;
|
|
2238
2332
|
this.listenOn(i);
|
|
2239
|
-
let a =
|
|
2240
|
-
return this.isValidComparison(
|
|
2333
|
+
let a = m(i.value);
|
|
2334
|
+
return this.isValidComparison(m(e), a) ? null : [this.errorFor(n, F("compare_to"), "Value does not match the comparison with {otherValue}", {
|
|
2241
2335
|
newValue: e,
|
|
2242
2336
|
oldValue: t,
|
|
2243
2337
|
otherValue: a
|
|
2244
2338
|
})];
|
|
2245
|
-
}), this.isValidComparison = t, this.otherField = e
|
|
2339
|
+
}), this.isValidComparison = t, this.otherField = e, this.relay = new P((e, t, n, r) => {
|
|
2340
|
+
t(e, n, r);
|
|
2341
|
+
let i = L(e);
|
|
2342
|
+
this.declarations.alive.forEach((e) => Mt(e, i).forEach((e) => {
|
|
2343
|
+
this.registrations.has(e) && this.execute(e, () => null, e.contribution, this.comparisonState(e).oldValue);
|
|
2344
|
+
}));
|
|
2345
|
+
}), this.relay[et] = () => {
|
|
2346
|
+
this.declarations.alive.length === 0 && this.stopListening();
|
|
2347
|
+
};
|
|
2246
2348
|
}
|
|
2247
2349
|
resolve(e) {
|
|
2248
2350
|
let t = this.otherField;
|
|
2249
|
-
return typeof t == "function" ? t(e) ?? void 0 : typeof t == "string" ?
|
|
2351
|
+
return typeof t == "function" ? t(e) ?? void 0 : typeof t == "string" ? Nt(t, e) : jt(t, L(e));
|
|
2250
2352
|
}
|
|
2251
2353
|
listenOn(e) {
|
|
2252
|
-
this.listening.has(e
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
}))
|
|
2354
|
+
this.listening.has(e.declaration) || (this.listening.add(e.declaration), e.registerAction(this.relay));
|
|
2355
|
+
}
|
|
2356
|
+
stopListening() {
|
|
2357
|
+
let e = this.listening.alive;
|
|
2358
|
+
e.length !== 0 && (S()?.whenRolledBack(() => e.forEach((e) => this.listening.add(e))), e.forEach((e) => {
|
|
2359
|
+
this.listening.delete(e), e.unregisterAction(this.relay);
|
|
2360
|
+
}));
|
|
2259
2361
|
}
|
|
2260
2362
|
boundToBinding(e) {
|
|
2261
2363
|
this.declarations.add(e.declaration), this.registrations.add(e);
|
|
@@ -2270,25 +2372,25 @@ var Nn = class extends M {
|
|
|
2270
2372
|
};
|
|
2271
2373
|
}
|
|
2272
2374
|
unregisterFrom(e) {
|
|
2273
|
-
super.unregisterFrom(e), this.registrations.delete(e);
|
|
2375
|
+
super.unregisterFrom(e), this.registrations.delete(e), e === e.declaration && this.declarations.delete(e), this.declarations.alive.length === 0 && this.stopListening();
|
|
2274
2376
|
}
|
|
2275
2377
|
};
|
|
2276
2378
|
//#endregion
|
|
2277
2379
|
//#region src/validators/value-checks.ts
|
|
2278
2380
|
function X(e) {
|
|
2279
2381
|
if (e == null) return 0;
|
|
2280
|
-
if (
|
|
2382
|
+
if (te(e) || g(e)) return e.length;
|
|
2281
2383
|
if (e instanceof Map || e instanceof Set) return e.size;
|
|
2282
|
-
if (
|
|
2384
|
+
if (ie(e)) {
|
|
2283
2385
|
let t = Object.getPrototypeOf(e);
|
|
2284
2386
|
if (t === Object.prototype || t === null) return Object.keys(e).length;
|
|
2285
2387
|
}
|
|
2286
2388
|
return String(e).length;
|
|
2287
2389
|
}
|
|
2288
2390
|
function Z(e) {
|
|
2289
|
-
return X(e) === 0 && (e == null ||
|
|
2391
|
+
return X(e) === 0 && (e == null || g(e) || te(e) || ie(e));
|
|
2290
2392
|
}
|
|
2291
|
-
function
|
|
2393
|
+
function Un(e, t) {
|
|
2292
2394
|
if (e instanceof Date && t instanceof Date) {
|
|
2293
2395
|
let n = e.getTime() - t.getTime();
|
|
2294
2396
|
return Number.isNaN(n) ? void 0 : n;
|
|
@@ -2298,23 +2400,23 @@ function Pn(e, t) {
|
|
|
2298
2400
|
}
|
|
2299
2401
|
//#endregion
|
|
2300
2402
|
//#region src/validators/validator-in-allowed-values.ts
|
|
2301
|
-
var
|
|
2403
|
+
var Wn = class extends I {
|
|
2302
2404
|
constructor(e, t) {
|
|
2303
2405
|
let n = () => {
|
|
2304
|
-
let t =
|
|
2406
|
+
let t = m(e);
|
|
2305
2407
|
return typeof t == "function" ? t() : t;
|
|
2306
2408
|
}, r = (e) => {
|
|
2307
2409
|
let t = e.join(", ");
|
|
2308
|
-
return t.length <= 60 ? t :
|
|
2410
|
+
return t.length <= 60 ? t : oe(t, {
|
|
2309
2411
|
length: 40,
|
|
2310
2412
|
separator: ", ",
|
|
2311
2413
|
omission: `... (${e.length} items total)`
|
|
2312
2414
|
});
|
|
2313
2415
|
};
|
|
2314
2416
|
super((e, i) => {
|
|
2315
|
-
if (Z(
|
|
2417
|
+
if (Z(m(e))) return null;
|
|
2316
2418
|
let a = n();
|
|
2317
|
-
return a.includes(
|
|
2419
|
+
return a.includes(m(e)) ? null : [this.errorFor(t, F("in_allowed_values"), "Must be one of [{allowedAsText}]", {
|
|
2318
2420
|
newValue: e,
|
|
2319
2421
|
oldValue: i,
|
|
2320
2422
|
allowedValues: a,
|
|
@@ -2322,47 +2424,47 @@ var Fn = class extends M {
|
|
|
2322
2424
|
})];
|
|
2323
2425
|
});
|
|
2324
2426
|
}
|
|
2325
|
-
},
|
|
2427
|
+
}, Gn = class extends I {
|
|
2326
2428
|
constructor(e) {
|
|
2327
2429
|
let t = e?.trim ?? !0;
|
|
2328
2430
|
super((n, r) => {
|
|
2329
|
-
let i =
|
|
2330
|
-
return X(t &&
|
|
2431
|
+
let i = m(n);
|
|
2432
|
+
return X(t && g(i) ? i.trim() : i) === 0 ? [this.errorFor(e, F("required"), "Please enter a value", {
|
|
2331
2433
|
newValue: n,
|
|
2332
2434
|
oldValue: r
|
|
2333
2435
|
})] : null;
|
|
2334
2436
|
});
|
|
2335
2437
|
}
|
|
2336
|
-
},
|
|
2438
|
+
}, Kn = class extends I {
|
|
2337
2439
|
constructor(e, t) {
|
|
2338
2440
|
super((n, r) => {
|
|
2339
2441
|
if (Z(n)) return null;
|
|
2340
|
-
let i =
|
|
2341
|
-
return i === void 0 || i < 0 ? [this.errorFor(t, "min_value", "Value must be larger or equal to {minValue}", {
|
|
2442
|
+
let i = Un(n, e);
|
|
2443
|
+
return i === void 0 || i < 0 ? [this.errorFor(t, F("min_value"), "Value must be larger or equal to {minValue}", {
|
|
2342
2444
|
newValue: n,
|
|
2343
2445
|
oldValue: r,
|
|
2344
2446
|
minValue: e
|
|
2345
2447
|
})] : null;
|
|
2346
2448
|
});
|
|
2347
2449
|
}
|
|
2348
|
-
},
|
|
2450
|
+
}, qn = class extends I {
|
|
2349
2451
|
constructor(e, t) {
|
|
2350
2452
|
super((n, r) => {
|
|
2351
2453
|
if (Z(n)) return null;
|
|
2352
|
-
let i =
|
|
2353
|
-
return i === void 0 || i > 0 ? [this.errorFor(t, "max_value", "Value must be less than or equal to {maxValue}", {
|
|
2454
|
+
let i = Un(n, e);
|
|
2455
|
+
return i === void 0 || i > 0 ? [this.errorFor(t, F("max_value"), "Value must be less than or equal to {maxValue}", {
|
|
2354
2456
|
newValue: n,
|
|
2355
2457
|
oldValue: r,
|
|
2356
2458
|
maxValue: e
|
|
2357
2459
|
})] : null;
|
|
2358
2460
|
});
|
|
2359
2461
|
}
|
|
2360
|
-
},
|
|
2462
|
+
}, Jn = class extends I {
|
|
2361
2463
|
constructor(e, t, n) {
|
|
2362
2464
|
super((r, i) => {
|
|
2363
2465
|
if (Z(r)) return null;
|
|
2364
|
-
let a =
|
|
2365
|
-
return a === void 0 || o === void 0 || a < 0 || o > 0 ? [this.errorFor(n, "value_in_range", "Value must be between {minValue} and {maxValue}", {
|
|
2466
|
+
let a = Un(r, e), o = Un(r, t);
|
|
2467
|
+
return a === void 0 || o === void 0 || a < 0 || o > 0 ? [this.errorFor(n, F("value_in_range"), "Value must be between {minValue} and {maxValue}", {
|
|
2366
2468
|
newValue: r,
|
|
2367
2469
|
oldValue: i,
|
|
2368
2470
|
minValue: e,
|
|
@@ -2370,28 +2472,28 @@ var Fn = class extends M {
|
|
|
2370
2472
|
})] : null;
|
|
2371
2473
|
});
|
|
2372
2474
|
}
|
|
2373
|
-
},
|
|
2475
|
+
}, Yn = class extends I {
|
|
2374
2476
|
constructor(e, t) {
|
|
2375
|
-
super((n, r) => Z(n) ? null : X(n) < e ? [this.errorFor(t, "min_length", "Length must be larger or equal to {minLength}", {
|
|
2477
|
+
super((n, r) => Z(n) ? null : X(n) < e ? [this.errorFor(t, F("min_length"), "Length must be larger or equal to {minLength}", {
|
|
2376
2478
|
newValue: n,
|
|
2377
2479
|
oldValue: r,
|
|
2378
2480
|
minLength: e
|
|
2379
2481
|
})] : null);
|
|
2380
2482
|
}
|
|
2381
|
-
},
|
|
2483
|
+
}, Xn = class extends I {
|
|
2382
2484
|
constructor(e, t) {
|
|
2383
|
-
super((n, r) => Z(n) ? null : X(n) > e ? [this.errorFor(t, "max_length", "Length must be less than or equal to {maxLength}", {
|
|
2485
|
+
super((n, r) => Z(n) ? null : X(n) > e ? [this.errorFor(t, F("max_length"), "Length must be less than or equal to {maxLength}", {
|
|
2384
2486
|
newValue: n,
|
|
2385
2487
|
oldValue: r,
|
|
2386
2488
|
maxLength: e
|
|
2387
2489
|
})] : null);
|
|
2388
2490
|
}
|
|
2389
|
-
},
|
|
2491
|
+
}, Zn = class extends I {
|
|
2390
2492
|
constructor(e, t, n) {
|
|
2391
2493
|
super((r, i) => {
|
|
2392
2494
|
if (Z(r)) return null;
|
|
2393
2495
|
let a = X(r);
|
|
2394
|
-
return a < e || a > t ? [this.errorFor(n, "length_in_range", "Length must be between {minLength} and {maxLength}", {
|
|
2496
|
+
return a < e || a > t ? [this.errorFor(n, F("length_in_range"), "Length must be between {minLength} and {maxLength}", {
|
|
2395
2497
|
newValue: r,
|
|
2396
2498
|
oldValue: i,
|
|
2397
2499
|
minLength: e,
|
|
@@ -2399,32 +2501,32 @@ var Fn = class extends M {
|
|
|
2399
2501
|
})] : null;
|
|
2400
2502
|
});
|
|
2401
2503
|
}
|
|
2402
|
-
},
|
|
2504
|
+
}, Qn = class extends I {
|
|
2403
2505
|
constructor(e, t) {
|
|
2404
2506
|
let n = /[gy]/.test(e.flags) ? new RegExp(e.source, e.flags.replace(/[gy]/g, "")) : e;
|
|
2405
2507
|
super((r, i) => {
|
|
2406
|
-
let a =
|
|
2407
|
-
return Z(a) || n.test(String(a)) ? null : [this.errorFor(t, "pattern", "Value must match pattern \"{pattern}\"", {
|
|
2508
|
+
let a = m(r);
|
|
2509
|
+
return Z(a) || n.test(String(a)) ? null : [this.errorFor(t, F("pattern"), "Value must match pattern \"{pattern}\"", {
|
|
2408
2510
|
newValue: r,
|
|
2409
2511
|
oldValue: i,
|
|
2410
2512
|
pattern: e
|
|
2411
2513
|
})];
|
|
2412
2514
|
});
|
|
2413
2515
|
}
|
|
2414
|
-
},
|
|
2415
|
-
CompareTo: () =>
|
|
2416
|
-
InAllowedValues: () =>
|
|
2417
|
-
LengthInRange: () =>
|
|
2418
|
-
MaxLength: () =>
|
|
2419
|
-
MaxValue: () =>
|
|
2420
|
-
MinLength: () =>
|
|
2421
|
-
MinValue: () =>
|
|
2422
|
-
Pattern: () =>
|
|
2423
|
-
Required: () =>
|
|
2424
|
-
Validator: () =>
|
|
2425
|
-
ValueInRange: () =>
|
|
2516
|
+
}, $n = /* @__PURE__ */ ce({
|
|
2517
|
+
CompareTo: () => Hn,
|
|
2518
|
+
InAllowedValues: () => Wn,
|
|
2519
|
+
LengthInRange: () => Zn,
|
|
2520
|
+
MaxLength: () => Xn,
|
|
2521
|
+
MaxValue: () => qn,
|
|
2522
|
+
MinLength: () => Yn,
|
|
2523
|
+
MinValue: () => Kn,
|
|
2524
|
+
Pattern: () => Qn,
|
|
2525
|
+
Required: () => Gn,
|
|
2526
|
+
Validator: () => I,
|
|
2527
|
+
ValueInRange: () => Jn,
|
|
2426
2528
|
isEmptyValue: () => Z
|
|
2427
|
-
}),
|
|
2529
|
+
}), er = /* @__PURE__ */ new WeakMap(), tr = /* @__PURE__ */ new WeakMap(), nr = /* @__PURE__ */ new Set([
|
|
2428
2530
|
"push",
|
|
2429
2531
|
"pop",
|
|
2430
2532
|
"shift",
|
|
@@ -2435,19 +2537,23 @@ var Fn = class extends M {
|
|
|
2435
2537
|
"fill",
|
|
2436
2538
|
"copyWithin"
|
|
2437
2539
|
]);
|
|
2438
|
-
function
|
|
2540
|
+
function rr(e) {
|
|
2439
2541
|
return typeof e == "string" && /^(0|[1-9]\d*)$/.test(e);
|
|
2440
2542
|
}
|
|
2543
|
+
function ir(e) {
|
|
2544
|
+
let t = Math.trunc(Number(e));
|
|
2545
|
+
return Number.isNaN(t) ? 0 : t;
|
|
2546
|
+
}
|
|
2441
2547
|
function Q(e) {
|
|
2442
|
-
return typeof e == "object" && !!e &&
|
|
2548
|
+
return typeof e == "object" && !!e && tr.get(e) || e;
|
|
2443
2549
|
}
|
|
2444
2550
|
function $(e) {
|
|
2445
|
-
return e instanceof J ?
|
|
2551
|
+
return e instanceof J ? ur(e) : e.value;
|
|
2446
2552
|
}
|
|
2447
|
-
function
|
|
2448
|
-
e.value = Q(t) instanceof
|
|
2553
|
+
function ar(e, t) {
|
|
2554
|
+
e.value = Q(t) instanceof U ? Q(t).value : t;
|
|
2449
2555
|
}
|
|
2450
|
-
function
|
|
2556
|
+
function or(e) {
|
|
2451
2557
|
return e === "__v_skip" ? {
|
|
2452
2558
|
answered: !0,
|
|
2453
2559
|
value: !0
|
|
@@ -2456,11 +2562,11 @@ function Xn(e) {
|
|
|
2456
2562
|
value: void 0
|
|
2457
2563
|
} : { answered: !1 };
|
|
2458
2564
|
}
|
|
2459
|
-
function
|
|
2565
|
+
function sr(e) {
|
|
2460
2566
|
let t = (t) => typeof t == "string" && t !== "$" ? e.field(t) ?? void 0 : void 0, n = () => Object.keys(e.fields);
|
|
2461
2567
|
return {
|
|
2462
2568
|
get(n, r) {
|
|
2463
|
-
let i =
|
|
2569
|
+
let i = or(r);
|
|
2464
2570
|
if (i.answered) return i.value;
|
|
2465
2571
|
if (r === "$") return e;
|
|
2466
2572
|
if (r === Symbol.toStringTag) return "View";
|
|
@@ -2471,7 +2577,7 @@ function Zn(e) {
|
|
|
2471
2577
|
if (n === "$") throw TypeError("$ is the element a view stands for, and cannot be replaced");
|
|
2472
2578
|
let i = t(n);
|
|
2473
2579
|
if (!i) throw TypeError(`${String(n)} is not a member of this group - use $.addField() to add one`);
|
|
2474
|
-
return
|
|
2580
|
+
return ar(i, r), !0;
|
|
2475
2581
|
},
|
|
2476
2582
|
has(e, t) {
|
|
2477
2583
|
return t === "$" || typeof t == "string" && n().includes(t);
|
|
@@ -2495,9 +2601,9 @@ function Zn(e) {
|
|
|
2495
2601
|
}
|
|
2496
2602
|
};
|
|
2497
2603
|
}
|
|
2498
|
-
function
|
|
2604
|
+
function cr(e) {
|
|
2499
2605
|
let t = () => e.items, n = (t) => Math.min(t, e.length), r = (e, t) => e < 0 ? Math.max(t + e, 0) : Math.min(e, t), i = (t) => C(() => {
|
|
2500
|
-
e[
|
|
2606
|
+
e[lt](t);
|
|
2501
2607
|
}), a = {
|
|
2502
2608
|
push: (...n) => (C(() => n.forEach((t) => e.push(Q(t)))), t().length),
|
|
2503
2609
|
pop: () => {
|
|
@@ -2516,16 +2622,16 @@ function Qn(e) {
|
|
|
2516
2622
|
let t = n(0);
|
|
2517
2623
|
r.forEach((n, r) => e.insert(Q(n), t + r));
|
|
2518
2624
|
}), t().length),
|
|
2519
|
-
splice: (i
|
|
2520
|
-
let s = [];
|
|
2625
|
+
splice: (...i) => {
|
|
2626
|
+
let [a, o, ...s] = i, c = [];
|
|
2521
2627
|
return C(() => {
|
|
2522
|
-
let
|
|
2523
|
-
|
|
2524
|
-
|
|
2628
|
+
let l = t(), u = r(ir(a), l.length), d = 0;
|
|
2629
|
+
i.length === 1 ? d = l.length - u : i.length > 1 && (d = Math.max(0, Math.min(ir(o), l.length - u))), l.slice(u, u + d).forEach((t) => {
|
|
2630
|
+
c.push($(t)), e.remove(e.items.indexOf(t));
|
|
2525
2631
|
});
|
|
2526
|
-
let
|
|
2527
|
-
|
|
2528
|
-
}),
|
|
2632
|
+
let f = n(u);
|
|
2633
|
+
s.forEach((t, n) => e.insert(Q(t), f + n));
|
|
2634
|
+
}), c;
|
|
2529
2635
|
},
|
|
2530
2636
|
sort: (e) => {
|
|
2531
2637
|
let n = t().map((e) => ({
|
|
@@ -2548,31 +2654,33 @@ function Qn(e) {
|
|
|
2548
2654
|
}, o;
|
|
2549
2655
|
return o = new Proxy([], {
|
|
2550
2656
|
get(n, r, i) {
|
|
2551
|
-
let o =
|
|
2657
|
+
let o = or(r);
|
|
2552
2658
|
if (o.answered) return o.value;
|
|
2553
2659
|
if (r === "$") return e;
|
|
2554
2660
|
if (r === "length") return t().length;
|
|
2555
|
-
if (
|
|
2661
|
+
if (rr(r)) {
|
|
2556
2662
|
let e = t()[Number(r)];
|
|
2557
2663
|
return e ? $(e) : void 0;
|
|
2558
2664
|
}
|
|
2559
|
-
return typeof r == "string" &&
|
|
2665
|
+
return typeof r == "string" && nr.has(r) ? a[r] : Reflect.get(n, r, i);
|
|
2560
2666
|
},
|
|
2561
2667
|
set(r, i, a) {
|
|
2562
2668
|
if (i === "$") throw TypeError("$ is the element a view stands for, and cannot be replaced");
|
|
2563
2669
|
if (i === "length") {
|
|
2564
|
-
let n = Number(a)
|
|
2670
|
+
let n = Number(a);
|
|
2671
|
+
if (!Number.isInteger(n) || n < 0 || n > 2 ** 32 - 1) throw RangeError("Invalid array length");
|
|
2672
|
+
let r = t();
|
|
2565
2673
|
if (n > r.length) throw TypeError("a list view grows by push(), not by its length");
|
|
2566
2674
|
return C(() => r.slice(n).forEach((t) => e.remove(e.items.indexOf(t)))), !0;
|
|
2567
2675
|
}
|
|
2568
|
-
if (
|
|
2676
|
+
if (rr(i)) {
|
|
2569
2677
|
let r = Number(i), o = t();
|
|
2570
|
-
return r < o.length ?
|
|
2678
|
+
return r < o.length ? ar(o[r], a) : e.insert(Q(a), n(o.length) + (r - o.length)), !0;
|
|
2571
2679
|
}
|
|
2572
2680
|
throw TypeError(`${String(i)} cannot be set on a list view`);
|
|
2573
2681
|
},
|
|
2574
2682
|
has(e, n) {
|
|
2575
|
-
return n === "$" || n === "length" ? !0 :
|
|
2683
|
+
return n === "$" || n === "length" ? !0 : rr(n) ? Number(n) < t().length : Reflect.has(e, n);
|
|
2576
2684
|
},
|
|
2577
2685
|
ownKeys() {
|
|
2578
2686
|
return [...t().map((e, t) => String(t)), "length"];
|
|
@@ -2584,7 +2692,7 @@ function Qn(e) {
|
|
|
2584
2692
|
enumerable: !1,
|
|
2585
2693
|
configurable: !1
|
|
2586
2694
|
};
|
|
2587
|
-
if (!(!
|
|
2695
|
+
if (!(!rr(n) || Number(n) >= t().length)) return {
|
|
2588
2696
|
value: $(t()[Number(n)]),
|
|
2589
2697
|
writable: !0,
|
|
2590
2698
|
enumerable: !0,
|
|
@@ -2599,10 +2707,10 @@ function Qn(e) {
|
|
|
2599
2707
|
}
|
|
2600
2708
|
}), o;
|
|
2601
2709
|
}
|
|
2602
|
-
function
|
|
2710
|
+
function lr(e) {
|
|
2603
2711
|
return {
|
|
2604
2712
|
get(t, n) {
|
|
2605
|
-
let r =
|
|
2713
|
+
let r = or(n);
|
|
2606
2714
|
if (r.answered) return r.value;
|
|
2607
2715
|
if (n === "$") return e;
|
|
2608
2716
|
},
|
|
@@ -2617,74 +2725,70 @@ function $n(e) {
|
|
|
2617
2725
|
}
|
|
2618
2726
|
};
|
|
2619
2727
|
}
|
|
2620
|
-
function
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
});
|
|
2624
|
-
}
|
|
2625
|
-
function tr(e) {
|
|
2626
|
-
if (Kn.has(e)) return e;
|
|
2627
|
-
let t = Gn.get(e);
|
|
2728
|
+
function ur(e) {
|
|
2729
|
+
if (tr.has(e)) return e;
|
|
2730
|
+
let t = er.get(e);
|
|
2628
2731
|
if (t) return t;
|
|
2629
2732
|
let n;
|
|
2630
|
-
return e instanceof Y ? (
|
|
2733
|
+
return e instanceof Y ? (Object.keys(e.fields).forEach(Pn), Nn.add(e), n = new Proxy({}, sr(e))) : n = e instanceof Mn ? cr(e) : new Proxy({}, lr(e)), er.set(e, n), tr.set(n, e), n;
|
|
2631
2734
|
}
|
|
2632
2735
|
//#endregion
|
|
2633
2736
|
//#region src/index.ts
|
|
2634
|
-
var
|
|
2737
|
+
var dr = /* @__PURE__ */ ce({
|
|
2635
2738
|
AbortEventHandlingException: () => E,
|
|
2636
|
-
AccessChangedAction: () =>
|
|
2637
|
-
AccessChangingAction: () =>
|
|
2638
|
-
Action: () =>
|
|
2639
|
-
ActionsMap: () =>
|
|
2640
|
-
CommandException: () =>
|
|
2641
|
-
ConditionalAccessAction: () =>
|
|
2642
|
-
ConditionalStatementAction: () =>
|
|
2643
|
-
ConditionalValueAction: () =>
|
|
2644
|
-
ConditionalVisibilityAction: () =>
|
|
2739
|
+
AccessChangedAction: () => Ht,
|
|
2740
|
+
AccessChangingAction: () => Bt,
|
|
2741
|
+
Action: () => Dn,
|
|
2742
|
+
ActionsMap: () => Ot,
|
|
2743
|
+
CommandException: () => vn,
|
|
2744
|
+
ConditionalAccessAction: () => Lt,
|
|
2745
|
+
ConditionalStatementAction: () => R,
|
|
2746
|
+
ConditionalValueAction: () => Rt,
|
|
2747
|
+
ConditionalVisibilityAction: () => It,
|
|
2645
2748
|
Container: () => J,
|
|
2646
|
-
ContributionChangedAction: () =>
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2749
|
+
ContributionChangedAction: () => Wt,
|
|
2750
|
+
ERROR_NAMESPACE: () => wt,
|
|
2751
|
+
EnabledChangedAction: () => Jt,
|
|
2752
|
+
EnabledChangingAction: () => Kt,
|
|
2753
|
+
ErrorPolicy: () => N,
|
|
2754
|
+
ExecuteAction: () => W,
|
|
2651
2755
|
Field: () => q,
|
|
2652
2756
|
FieldActionBase: () => T,
|
|
2653
|
-
FieldBase: () =>
|
|
2757
|
+
FieldBase: () => U,
|
|
2654
2758
|
Group: () => Y,
|
|
2655
|
-
List: () =>
|
|
2759
|
+
List: () => Mn,
|
|
2656
2760
|
ListItemAddedAction: () => G,
|
|
2657
2761
|
ListItemRemovedAction: () => K,
|
|
2658
|
-
Operator: () =>
|
|
2659
|
-
RejectAction: () =>
|
|
2660
|
-
Statement: () =>
|
|
2661
|
-
SubmitAction: () =>
|
|
2662
|
-
SubmitFailedException: () =>
|
|
2663
|
-
SubmitRefusedException: () =>
|
|
2664
|
-
TargetedExecuteAction: () =>
|
|
2665
|
-
ValidChangedAction: () =>
|
|
2666
|
-
ValidationError: () =>
|
|
2667
|
-
Validators: () =>
|
|
2668
|
-
ValueChangedAction: () =>
|
|
2669
|
-
VisibilityChangedAction: () =>
|
|
2670
|
-
VisibilityChangingAction: () =>
|
|
2671
|
-
accessValues: () =>
|
|
2762
|
+
Operator: () => B,
|
|
2763
|
+
RejectAction: () => Sn,
|
|
2764
|
+
Statement: () => mn,
|
|
2765
|
+
SubmitAction: () => xn,
|
|
2766
|
+
SubmitFailedException: () => yn,
|
|
2767
|
+
SubmitRefusedException: () => bn,
|
|
2768
|
+
TargetedExecuteAction: () => gn,
|
|
2769
|
+
ValidChangedAction: () => Xt,
|
|
2770
|
+
ValidationError: () => Tt,
|
|
2771
|
+
Validators: () => $n,
|
|
2772
|
+
ValueChangedAction: () => P,
|
|
2773
|
+
VisibilityChangedAction: () => en,
|
|
2774
|
+
VisibilityChangingAction: () => Qt,
|
|
2775
|
+
accessValues: () => _,
|
|
2672
2776
|
configureDevtools: () => Ce,
|
|
2673
|
-
defaultAccess: () =>
|
|
2777
|
+
defaultAccess: () => le,
|
|
2674
2778
|
defaultVisibility: () => fe,
|
|
2675
2779
|
describeState: () => xe,
|
|
2676
|
-
errorRemovals: () =>
|
|
2780
|
+
errorRemovals: () => k,
|
|
2677
2781
|
hideState: () => Se,
|
|
2678
2782
|
installPlugin: () => Pe,
|
|
2679
|
-
isAccess: () =>
|
|
2680
|
-
isEqual: () =>
|
|
2783
|
+
isAccess: () => ue,
|
|
2784
|
+
isEqual: () => Vn,
|
|
2681
2785
|
isVisibility: () => pe,
|
|
2682
|
-
setDefaultErrorPolicies: () =>
|
|
2786
|
+
setDefaultErrorPolicies: () => yt,
|
|
2683
2787
|
transaction: () => C,
|
|
2684
|
-
view: () =>
|
|
2685
|
-
visibilityValues: () =>
|
|
2788
|
+
view: () => ur,
|
|
2789
|
+
visibilityValues: () => de
|
|
2686
2790
|
});
|
|
2687
2791
|
//#endregion
|
|
2688
|
-
export { E as AbortEventHandlingException,
|
|
2792
|
+
export { E as AbortEventHandlingException, Ht as AccessChangedAction, Bt as AccessChangingAction, Dn as Action, Ot as ActionsMap, vn as CommandException, Lt as ConditionalAccessAction, R as ConditionalStatementAction, Rt as ConditionalValueAction, It as ConditionalVisibilityAction, J as Container, Wt as ContributionChangedAction, wt as ERROR_NAMESPACE, Jt as EnabledChangedAction, Kt as EnabledChangingAction, N as ErrorPolicy, W as ExecuteAction, q as Field, T as FieldActionBase, U as FieldBase, Y as Group, Mn as List, G as ListItemAddedAction, K as ListItemRemovedAction, B as Operator, Sn as RejectAction, mn as Statement, xn as SubmitAction, yn as SubmitFailedException, bn as SubmitRefusedException, gn as TargetedExecuteAction, Xt as ValidChangedAction, Tt as ValidationError, $n as Validators, P as ValueChangedAction, en as VisibilityChangedAction, Qt as VisibilityChangingAction, _ as accessValues, Ce as configureDevtools, dr as default, le as defaultAccess, fe as defaultVisibility, xe as describeState, k as errorRemovals, Se as hideState, Pe as installPlugin, ue as isAccess, Vn as isEqual, pe as isVisibility, yt as setDefaultErrorPolicies, C as transaction, ur as view, de as visibilityValues };
|
|
2689
2793
|
|
|
2690
2794
|
//# sourceMappingURL=dynamicforms-vue-forms.js.map
|