@dynamicforms/vue-forms 0.16.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dynamicforms-vue-forms.js +122 -100
- package/dist/dynamicforms-vue-forms.js.map +1 -1
- package/dist/index.d.ts +19 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import { isEqual as R, isEmpty as
|
|
1
|
+
import { computed as K, unref as h, isRef as Vt, reactive as Ut, watch as $t, ref as Wt, defineComponent as qt, resolveComponent as lt, openBlock as zt, createBlock as Ht, h as k } from "vue";
|
|
2
|
+
import { isEqual as R, isEmpty as F, isBoolean as Qt, isString as C, truncate as Xt, isArray as yt, isObject as Et } from "lodash-es";
|
|
3
3
|
var x = /* @__PURE__ */ ((n) => (n[n.SUPPRESS = 1] = "SUPPRESS", n[n.HIDDEN = 5] = "HIDDEN", n[n.INVISIBLE = 8] = "INVISIBLE", n[n.FULL = 10] = "FULL", n))(x || {});
|
|
4
|
-
const Kt = 10,
|
|
4
|
+
const Kt = 10, ut = new Set(
|
|
5
5
|
Object.values(x).filter((n) => typeof n == "number")
|
|
6
6
|
), Yt = new Set(
|
|
7
7
|
Object.values(x).filter((n) => typeof n == "string")
|
|
@@ -22,7 +22,7 @@ function z(n) {
|
|
|
22
22
|
n.fromString = t;
|
|
23
23
|
function e(i) {
|
|
24
24
|
if (typeof i == "number") {
|
|
25
|
-
if (
|
|
25
|
+
if (ut.has(i)) return i;
|
|
26
26
|
throw z(i);
|
|
27
27
|
}
|
|
28
28
|
if (typeof i != "string") throw z(i);
|
|
@@ -30,7 +30,7 @@ function z(n) {
|
|
|
30
30
|
}
|
|
31
31
|
n.fromAny = e;
|
|
32
32
|
function s(i) {
|
|
33
|
-
return typeof i == "number" ?
|
|
33
|
+
return typeof i == "number" ? ut.has(i) : typeof i == "string" ? Yt.has(i.toUpperCase()) : !1;
|
|
34
34
|
}
|
|
35
35
|
n.isDefined = s;
|
|
36
36
|
})(x || (x = {}));
|
|
@@ -101,7 +101,7 @@ class T extends m {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
const O = /* @__PURE__ */ Symbol("Transaction.capture"), St = /* @__PURE__ */ Symbol("Transaction.restore"), xt = /* @__PURE__ */ Symbol("Transaction.announceValue"), At = /* @__PURE__ */ Symbol("Transaction.settleValidity");
|
|
104
|
-
function
|
|
104
|
+
function ct(n) {
|
|
105
105
|
let t = 0, e = n.parent;
|
|
106
106
|
for (; e; )
|
|
107
107
|
t++, e = e.parent;
|
|
@@ -181,7 +181,7 @@ class Jt {
|
|
|
181
181
|
* there is nothing the answer would change.
|
|
182
182
|
*/
|
|
183
183
|
noteDepth(t) {
|
|
184
|
-
this.passDepth < 0 ||
|
|
184
|
+
this.passDepth < 0 || ct(t) >= this.passDepth && (this.restartPass = !0);
|
|
185
185
|
}
|
|
186
186
|
/**
|
|
187
187
|
* Puts every element the transaction modified back as it found it. Nothing is announced: from an observer's
|
|
@@ -219,7 +219,7 @@ class Jt {
|
|
|
219
219
|
const e = [];
|
|
220
220
|
return this.participants.forEach((s) => {
|
|
221
221
|
if (!t(s)) return;
|
|
222
|
-
const i =
|
|
222
|
+
const i = ct(s.element);
|
|
223
223
|
(e[i] ??= []).push(s);
|
|
224
224
|
}), e;
|
|
225
225
|
}
|
|
@@ -285,22 +285,22 @@ class Zt {
|
|
|
285
285
|
this.open = !1;
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
function
|
|
288
|
+
function ht(n) {
|
|
289
289
|
if (n != null && typeof n.then == "function")
|
|
290
290
|
throw new TypeError(
|
|
291
291
|
"a transaction may not be asynchronous: the callback returned a thenable. Do the awaiting outside and open a transaction for each synchronous part."
|
|
292
292
|
);
|
|
293
293
|
}
|
|
294
|
-
function
|
|
294
|
+
function J(n) {
|
|
295
295
|
if (S) {
|
|
296
296
|
const s = n(H);
|
|
297
|
-
return
|
|
297
|
+
return ht(s), s;
|
|
298
298
|
}
|
|
299
299
|
const t = new Jt(), e = new Zt();
|
|
300
300
|
S = t, H = e;
|
|
301
301
|
try {
|
|
302
302
|
const s = n(e);
|
|
303
|
-
return
|
|
303
|
+
return ht(s), t.commit(), s;
|
|
304
304
|
} catch (s) {
|
|
305
305
|
if (t.rollback(), s instanceof Tt) return;
|
|
306
306
|
throw s;
|
|
@@ -309,7 +309,7 @@ function Z(n) {
|
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
function u(n) {
|
|
312
|
-
return S ? n(S) :
|
|
312
|
+
return S ? n(S) : J(() => n(S));
|
|
313
313
|
}
|
|
314
314
|
const Ot = { useMarkdownInValidators: !0 };
|
|
315
315
|
function Gt() {
|
|
@@ -330,14 +330,14 @@ class j extends String {
|
|
|
330
330
|
super(t), this.plugins = s, this.options = e;
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function Z(n) {
|
|
334
334
|
const t = h(n);
|
|
335
335
|
return typeof t == "object" && t !== null && "componentName" in t;
|
|
336
336
|
}
|
|
337
337
|
function L(n) {
|
|
338
338
|
return typeof h(n) == "function";
|
|
339
339
|
}
|
|
340
|
-
class
|
|
340
|
+
class G {
|
|
341
341
|
/**
|
|
342
342
|
* Machine-readable identifier of what failed, in kebab-case. Every validator this library ships states one, so
|
|
343
343
|
* code that reacts to a particular failure does not have to match the message text, which is translated and
|
|
@@ -373,7 +373,7 @@ class tt {
|
|
|
373
373
|
return "";
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
-
class ee extends
|
|
376
|
+
class ee extends G {
|
|
377
377
|
constructor(t, e = "", s) {
|
|
378
378
|
super(s), this.text = t, this.classes = e;
|
|
379
379
|
}
|
|
@@ -389,9 +389,9 @@ class ee extends tt {
|
|
|
389
389
|
return this.classes;
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
|
-
class g extends
|
|
392
|
+
class g extends G {
|
|
393
393
|
constructor(t, e = "", s) {
|
|
394
|
-
super(s), this.classes = e, this.text = t, this.textType =
|
|
394
|
+
super(s), this.classes = e, this.text = t, this.textType = K(() => this.getTextType);
|
|
395
395
|
}
|
|
396
396
|
classes;
|
|
397
397
|
text;
|
|
@@ -402,7 +402,7 @@ class g extends tt {
|
|
|
402
402
|
}
|
|
403
403
|
get getTextType() {
|
|
404
404
|
const t = this.resolvedText;
|
|
405
|
-
return t ? t instanceof j ? "md" :
|
|
405
|
+
return t ? t instanceof j ? "md" : Z(t) ? "component" : "string" : "string";
|
|
406
406
|
}
|
|
407
407
|
get componentName() {
|
|
408
408
|
switch (h(this.textType)) {
|
|
@@ -459,24 +459,24 @@ class f extends T {
|
|
|
459
459
|
*/
|
|
460
460
|
constructor(t) {
|
|
461
461
|
const e = (s, i, r, a) => {
|
|
462
|
-
const o = this.bindingState(s), l = o.abandon, v = ++o.run, p = s.validationEpoch,
|
|
463
|
-
let
|
|
464
|
-
const $ = () => !
|
|
465
|
-
$() || (
|
|
462
|
+
const o = this.bindingState(s), l = o.abandon, v = ++o.run, p = s.validationEpoch, it = It();
|
|
463
|
+
let nt = !1;
|
|
464
|
+
const $ = () => !nt && o.run === v && s.validationEpoch === p && !it?.rolledBack, rt = new AbortController(), B = () => {
|
|
465
|
+
$() || (nt = !0, o.abandon === B && (o.abandon = void 0), rt.abort());
|
|
466
466
|
};
|
|
467
467
|
l?.();
|
|
468
|
-
const W = t(r, a, s,
|
|
468
|
+
const W = t(r, a, s, rt.signal) || [], q = (E) => J(() => {
|
|
469
469
|
const D = E?.map((A) => this.claim(A)) ?? [];
|
|
470
470
|
for (let A = s.errors.length - 1; A >= 0; A--) {
|
|
471
|
-
const
|
|
472
|
-
if (
|
|
473
|
-
const
|
|
474
|
-
|
|
471
|
+
const at = s.errors[A];
|
|
472
|
+
if (at.source === this.source) {
|
|
473
|
+
const ot = D.findIndex((Mt) => Mt.sameAs(at));
|
|
474
|
+
ot >= 0 ? D.splice(ot, 1) : s.errors.splice(A, 1);
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
477
|
D.length > 0 && s.errors.push(...D), s.validate();
|
|
478
478
|
});
|
|
479
|
-
return W instanceof Promise ? (o.abandon = B,
|
|
479
|
+
return W instanceof Promise ? (o.abandon = B, it?.whenRolledBack(B), s.beginValidating(), W.then(
|
|
480
480
|
(E) => {
|
|
481
481
|
$() && q(E);
|
|
482
482
|
},
|
|
@@ -563,7 +563,7 @@ class f extends T {
|
|
|
563
563
|
}
|
|
564
564
|
replacePlaceholders(t, e) {
|
|
565
565
|
if (L(t)) return this.replacePlaceholdersFunction(t, e);
|
|
566
|
-
if (
|
|
566
|
+
if (Z(t)) return t;
|
|
567
567
|
if (Vt(t))
|
|
568
568
|
return this.replacePlaceholdersFunction(() => h(t), e);
|
|
569
569
|
let s = h(t);
|
|
@@ -679,7 +679,7 @@ function V(n) {
|
|
|
679
679
|
for (; t.fieldName !== void 0 && t.parent; ) t = t.parent;
|
|
680
680
|
return t;
|
|
681
681
|
}
|
|
682
|
-
function
|
|
682
|
+
function dt(n, t) {
|
|
683
683
|
let e = n;
|
|
684
684
|
for (const s of re(t))
|
|
685
685
|
if (e = e.field?.(s) ?? void 0, !e) return;
|
|
@@ -692,19 +692,19 @@ function re(n) {
|
|
|
692
692
|
t.unshift(e.fieldName), e = e.parent;
|
|
693
693
|
return t;
|
|
694
694
|
}
|
|
695
|
-
function
|
|
696
|
-
const e =
|
|
695
|
+
function tt(n, t) {
|
|
696
|
+
const e = dt(t, n);
|
|
697
697
|
if (e) return e;
|
|
698
698
|
let s = t.parent;
|
|
699
699
|
for (; s; ) {
|
|
700
|
-
const i =
|
|
700
|
+
const i = dt(V(s), n);
|
|
701
701
|
if (i) return i;
|
|
702
702
|
s = s.parent;
|
|
703
703
|
}
|
|
704
704
|
return V(n) === V(t.declaration) ? void 0 : n;
|
|
705
705
|
}
|
|
706
706
|
function kt(n, t) {
|
|
707
|
-
const e =
|
|
707
|
+
const e = tt(n, t);
|
|
708
708
|
if (!e) return [];
|
|
709
709
|
if (e !== n) return [e];
|
|
710
710
|
const s = t.bindingsOf(n);
|
|
@@ -862,7 +862,7 @@ class Rt extends m {
|
|
|
862
862
|
}
|
|
863
863
|
}
|
|
864
864
|
const de = /* @__PURE__ */ Symbol("EnabledChangedAction");
|
|
865
|
-
class
|
|
865
|
+
class _t extends m {
|
|
866
866
|
constructor(t) {
|
|
867
867
|
super(t);
|
|
868
868
|
}
|
|
@@ -874,7 +874,7 @@ class Ft extends m {
|
|
|
874
874
|
}
|
|
875
875
|
}
|
|
876
876
|
const ge = /* @__PURE__ */ Symbol("ValidChangedAction");
|
|
877
|
-
class
|
|
877
|
+
class Ft extends m {
|
|
878
878
|
constructor(t) {
|
|
879
879
|
super(t);
|
|
880
880
|
}
|
|
@@ -909,7 +909,7 @@ class jt extends m {
|
|
|
909
909
|
return super.execute(t, e, s, i);
|
|
910
910
|
}
|
|
911
911
|
}
|
|
912
|
-
const
|
|
912
|
+
const gt = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new Set(["validators", "actions"]);
|
|
913
913
|
let X = 0;
|
|
914
914
|
class y {
|
|
915
915
|
/**
|
|
@@ -1030,7 +1030,7 @@ class y {
|
|
|
1030
1030
|
extendedOf(t) {
|
|
1031
1031
|
const e = /* @__PURE__ */ Object.create(null);
|
|
1032
1032
|
return Object.entries(t).forEach(([s, i]) => {
|
|
1033
|
-
|
|
1033
|
+
pt.has(s) || (!(s in this) || Object.hasOwn(Object.prototype, s)) && (e[s] = i);
|
|
1034
1034
|
}), e;
|
|
1035
1035
|
}
|
|
1036
1036
|
/**
|
|
@@ -1041,8 +1041,8 @@ class y {
|
|
|
1041
1041
|
assignParams(t) {
|
|
1042
1042
|
const e = this.extendedOf(t);
|
|
1043
1043
|
Object.entries(t).forEach(([s, i]) => {
|
|
1044
|
-
Object.hasOwn(e, s) ||
|
|
1045
|
-
}),
|
|
1044
|
+
Object.hasOwn(e, s) || pt.has(s) || (this[s] = i);
|
|
1045
|
+
}), F(e) || this.setExtendedValues(e);
|
|
1046
1046
|
}
|
|
1047
1047
|
/**
|
|
1048
1048
|
* Takes this element into the record of the open transaction, where one is open. A write of a single slot that
|
|
@@ -1120,8 +1120,8 @@ class y {
|
|
|
1120
1120
|
* container answers from its own computed.
|
|
1121
1121
|
*/
|
|
1122
1122
|
get busyRead() {
|
|
1123
|
-
let t =
|
|
1124
|
-
return t || (t =
|
|
1123
|
+
let t = ft.get(this);
|
|
1124
|
+
return t || (t = K(() => this.composeBusy()), ft.set(this, t)), t.value;
|
|
1125
1125
|
}
|
|
1126
1126
|
/** What busyRead computes. A container answers over its members; anything else executes nothing. */
|
|
1127
1127
|
composeBusy() {
|
|
@@ -1311,6 +1311,27 @@ class y {
|
|
|
1311
1311
|
e.markValueChanged(this, t), e.markValidityDirty(this), this.parent?.notifyValueChanged();
|
|
1312
1312
|
});
|
|
1313
1313
|
}
|
|
1314
|
+
/**
|
|
1315
|
+
* The last step of a construction: it runs inside the transaction the construction is, with the parameters
|
|
1316
|
+
* applied and the value in place, before the element records what it was built as.
|
|
1317
|
+
*
|
|
1318
|
+
* A subclass overrides it to complete what the element was built with. What it writes here is part of the
|
|
1319
|
+
* construction rather than a change of it: the element announces no ValueChangedAction, and what the hook
|
|
1320
|
+
* leaves is what its eager actions and its validators run over, once. An element whose parameters named no
|
|
1321
|
+
* `originalValue` is baselined on the value the hook left and so starts unchanged; one that named a baseline is
|
|
1322
|
+
* measured against it, as any element is. A `Field` writes
|
|
1323
|
+
* `_value`, which reaches the slot on an element built `enabled: false` as well - the value setter, which a
|
|
1324
|
+
* disabled field refuses, states a change, and this is not one.
|
|
1325
|
+
*
|
|
1326
|
+
* A container completes itself through its members, and a member carries a construction of its own: the write
|
|
1327
|
+
* reaches it as any later one would, so the member announces it and reports itself changed. A member that is to
|
|
1328
|
+
* start unchanged is baselined here as well - `this.fields.x.originalValue = this.fields.x.value`.
|
|
1329
|
+
*
|
|
1330
|
+
* `params` is the parameter object the constructor received, where it received one.
|
|
1331
|
+
*/
|
|
1332
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1333
|
+
constructed(t) {
|
|
1334
|
+
}
|
|
1314
1335
|
/**
|
|
1315
1336
|
* Re-reads the value that the next ValueChangedAction will report as the one it replaces. A leaf records what
|
|
1316
1337
|
* it announced at every announcement, so its copy is always current and there is nothing to re-read; a
|
|
@@ -1392,8 +1413,8 @@ class y {
|
|
|
1392
1413
|
* from repeating while nothing it read has moved.
|
|
1393
1414
|
*/
|
|
1394
1415
|
get validRead() {
|
|
1395
|
-
let t =
|
|
1396
|
-
return t || (t =
|
|
1416
|
+
let t = gt.get(this);
|
|
1417
|
+
return t || (t = K(() => this.composeValid()), gt.set(this, t)), t.value;
|
|
1397
1418
|
}
|
|
1398
1419
|
/** What validRead computes. A leaf answers over its own errors; a container adds its members. */
|
|
1399
1420
|
composeValid() {
|
|
@@ -1423,7 +1444,7 @@ class y {
|
|
|
1423
1444
|
const i = this.boundActions?.trigger(Rt, this, t, e);
|
|
1424
1445
|
if (!(i instanceof P)) {
|
|
1425
1446
|
if (!Qt(i ?? t)) throw new Error("Enabled value must be boolean");
|
|
1426
|
-
s.touch(this), this.#t.enabled = i ?? t, this.#t.enabled !== e && this.bumpValueVersion(), this.boundActions?.trigger(
|
|
1447
|
+
s.touch(this), this.#t.enabled = i ?? t, this.#t.enabled !== e && this.bumpValueVersion(), this.boundActions?.trigger(_t, this, this.#t.enabled, e);
|
|
1427
1448
|
}
|
|
1428
1449
|
});
|
|
1429
1450
|
}
|
|
@@ -1470,7 +1491,7 @@ class y {
|
|
|
1470
1491
|
if (s === e) return;
|
|
1471
1492
|
t.touch(this), this.#e.valid = s;
|
|
1472
1493
|
const i = this.container;
|
|
1473
|
-
i && (t.touch(i), i.childValidityChanged(s), t.markValidityDirty(i)), this.boundActions?.trigger(
|
|
1494
|
+
i && (t.touch(i), i.childValidityChanged(s), t.markValidityDirty(i)), this.boundActions?.trigger(Ft, this, s, e);
|
|
1474
1495
|
}
|
|
1475
1496
|
validate(t = !1) {
|
|
1476
1497
|
u((e) => {
|
|
@@ -1497,7 +1518,7 @@ class y {
|
|
|
1497
1518
|
boundFrom(t, e, s, i) {
|
|
1498
1519
|
this.#e.declaration = t.declaration;
|
|
1499
1520
|
const r = { ...t.extra, ...i && this.extendedOf(i) };
|
|
1500
|
-
|
|
1521
|
+
F(r) || this.setExtendedValues(r);
|
|
1501
1522
|
const a = this.declaration;
|
|
1502
1523
|
a.noteBinding(this);
|
|
1503
1524
|
const o = a._actions;
|
|
@@ -1622,7 +1643,7 @@ class w {
|
|
|
1622
1643
|
static valueOf(t, e) {
|
|
1623
1644
|
if (t instanceof w) return t.evaluate(e);
|
|
1624
1645
|
if (t instanceof y) {
|
|
1625
|
-
const s = e ?
|
|
1646
|
+
const s = e ? tt(t, e) : t;
|
|
1626
1647
|
return s ? h(s.value) : void 0;
|
|
1627
1648
|
}
|
|
1628
1649
|
return t;
|
|
@@ -1707,7 +1728,7 @@ class Nt extends m {
|
|
|
1707
1728
|
}
|
|
1708
1729
|
}
|
|
1709
1730
|
const ve = /* @__PURE__ */ Symbol("ListItemAddedAction");
|
|
1710
|
-
class
|
|
1731
|
+
class Y extends m {
|
|
1711
1732
|
constructor(t) {
|
|
1712
1733
|
super(t);
|
|
1713
1734
|
}
|
|
@@ -1767,7 +1788,7 @@ function Ee() {
|
|
|
1767
1788
|
function Ce() {
|
|
1768
1789
|
return { ...Lt(), rows: null, rowsVersion: 0, cachedItems: null, cachedItemsVersion: -1 };
|
|
1769
1790
|
}
|
|
1770
|
-
class
|
|
1791
|
+
class et extends y {
|
|
1771
1792
|
get [Symbol.toStringTag]() {
|
|
1772
1793
|
return "Field";
|
|
1773
1794
|
}
|
|
@@ -1800,9 +1821,9 @@ class st extends y {
|
|
|
1800
1821
|
u(() => {
|
|
1801
1822
|
if (t) {
|
|
1802
1823
|
const { value: e, validators: s, actions: i, ...r } = t;
|
|
1803
|
-
this.registerInitialActions([...s || [], ...i || []]), this.assignParams(r), this._value = e !== void 0 ? e : this.originalValue
|
|
1824
|
+
this.registerInitialActions([...s || [], ...i || []]), this.assignParams(r), this._value = e !== void 0 ? e : this.originalValue;
|
|
1804
1825
|
}
|
|
1805
|
-
this.raw.announcedValue = this._value, this.boundActions?.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
1826
|
+
this.constructed(t), this.originalValue === void 0 && (this.originalValue = this._value), this.raw.announcedValue = this._value, this.boundActions?.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
1806
1827
|
});
|
|
1807
1828
|
}
|
|
1808
1829
|
get value() {
|
|
@@ -1839,11 +1860,12 @@ class st extends y {
|
|
|
1839
1860
|
return i.boundFrom(this, i.value, i.originalValue, e), i;
|
|
1840
1861
|
}
|
|
1841
1862
|
}
|
|
1842
|
-
const
|
|
1843
|
-
function
|
|
1844
|
-
|
|
1863
|
+
const mt = /* @__PURE__ */ new WeakMap();
|
|
1864
|
+
function bt(n) {
|
|
1865
|
+
if (n != null)
|
|
1866
|
+
return Object.values(n).some((t) => t != null) ? n : void 0;
|
|
1845
1867
|
}
|
|
1846
|
-
class Se extends
|
|
1868
|
+
class Se extends et {
|
|
1847
1869
|
get [Symbol.toStringTag]() {
|
|
1848
1870
|
return "Action";
|
|
1849
1871
|
}
|
|
@@ -1852,10 +1874,10 @@ class Se extends st {
|
|
|
1852
1874
|
if (this._value = { label: void 0, icon: void 0 }, t) {
|
|
1853
1875
|
const { value: e, originalValue: s, validators: i, actions: r, ...a } = t;
|
|
1854
1876
|
this.registerInitialActions([...i || [], ...r || []]), this.assignParams(a);
|
|
1855
|
-
const o =
|
|
1856
|
-
this._value =
|
|
1877
|
+
const o = bt(e), l = bt(s);
|
|
1878
|
+
o ? this._value = o : l && (this._value = { ...l }), l && (this.originalValue = Object.freeze({ ...l }));
|
|
1857
1879
|
}
|
|
1858
|
-
this.raw.announcedValue = this._value, this.boundActions?.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
1880
|
+
this.constructed(t), this.originalValue === void 0 && (this.originalValue = this._value), this.raw.announcedValue = this._value, this.boundActions?.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
1859
1881
|
});
|
|
1860
1882
|
}
|
|
1861
1883
|
/**
|
|
@@ -1889,8 +1911,8 @@ class Se extends st {
|
|
|
1889
1911
|
}
|
|
1890
1912
|
/** the counter behind `busy`, allocated for this action the first time it is asked for */
|
|
1891
1913
|
get busyRuns() {
|
|
1892
|
-
let t =
|
|
1893
|
-
return t || (t = Wt(0),
|
|
1914
|
+
let t = mt.get(this);
|
|
1915
|
+
return t || (t = Wt(0), mt.set(this, t)), t;
|
|
1894
1916
|
}
|
|
1895
1917
|
/** true from the moment execute() is called until the handler it ran has settled, however it settles */
|
|
1896
1918
|
get busy() {
|
|
@@ -1923,7 +1945,7 @@ const xe = /* @__PURE__ */ qt({
|
|
|
1923
1945
|
classes: {}
|
|
1924
1946
|
},
|
|
1925
1947
|
setup(n) {
|
|
1926
|
-
const t = n, e =
|
|
1948
|
+
const t = n, e = lt("vue-markdown"), s = /* @__PURE__ */ new Set([
|
|
1927
1949
|
"div",
|
|
1928
1950
|
"span",
|
|
1929
1951
|
"p",
|
|
@@ -2007,7 +2029,7 @@ const xe = /* @__PURE__ */ qt({
|
|
|
2007
2029
|
default:
|
|
2008
2030
|
r.push(
|
|
2009
2031
|
k(
|
|
2010
|
-
s.has(a.componentName.toLowerCase()) ? a.componentName :
|
|
2032
|
+
s.has(a.componentName.toLowerCase()) ? a.componentName : lt(a.componentName),
|
|
2011
2033
|
{
|
|
2012
2034
|
class: [t.classes, a.extraClasses],
|
|
2013
2035
|
...a.componentBindings,
|
|
@@ -2062,7 +2084,7 @@ class d extends y {
|
|
|
2062
2084
|
const { value: i, validators: r, actions: a, ...o } = e;
|
|
2063
2085
|
this.registerInitialActions([...r || [], ...a || []]), this.assignParams(o), i !== void 0 ? this.assignMembers(i) : this.originalValue !== void 0 && this.assignMembers(this.originalValue);
|
|
2064
2086
|
}
|
|
2065
|
-
this.completeRecords();
|
|
2087
|
+
this.completeRecords(), this.constructed(e);
|
|
2066
2088
|
const s = this.value;
|
|
2067
2089
|
this.originalValue === void 0 && (this.originalValue = d.baseline(s)), this.raw.announcedValue = s, this.boundActions?.triggerEager(this, s, this.originalValue), this.validate();
|
|
2068
2090
|
});
|
|
@@ -2140,7 +2162,7 @@ class d extends y {
|
|
|
2140
2162
|
if (t instanceof y)
|
|
2141
2163
|
throw new Error("data is already a Form structure, should be a simple object");
|
|
2142
2164
|
return new d(
|
|
2143
|
-
t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, s]) => [e, new
|
|
2165
|
+
t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, s]) => [e, new et({ value: s })]))
|
|
2144
2166
|
);
|
|
2145
2167
|
}
|
|
2146
2168
|
field(t) {
|
|
@@ -2170,9 +2192,9 @@ class d extends y {
|
|
|
2170
2192
|
const e = /* @__PURE__ */ Object.create(null);
|
|
2171
2193
|
Object.entries(this._fields).forEach(([i, r]) => {
|
|
2172
2194
|
const a = r.value;
|
|
2173
|
-
(r.enabled || this.childComposesValue(r) && !
|
|
2195
|
+
(r.enabled || this.childComposesValue(r) && !F(a)) && (e[i] = a);
|
|
2174
2196
|
});
|
|
2175
|
-
const s =
|
|
2197
|
+
const s = F(e) ? null : Object.freeze({ ...e });
|
|
2176
2198
|
return this.raw.cachedValue = s, this.raw.cachedValueVersion = t, s;
|
|
2177
2199
|
}
|
|
2178
2200
|
/**
|
|
@@ -2294,7 +2316,7 @@ class d extends y {
|
|
|
2294
2316
|
return super.rebind(t);
|
|
2295
2317
|
}
|
|
2296
2318
|
}
|
|
2297
|
-
class
|
|
2319
|
+
class _ extends y {
|
|
2298
2320
|
get [Symbol.toStringTag]() {
|
|
2299
2321
|
return "List";
|
|
2300
2322
|
}
|
|
@@ -2311,7 +2333,7 @@ class F extends y {
|
|
|
2311
2333
|
const { value: s, validators: i, actions: r, ...a } = e;
|
|
2312
2334
|
this.registerInitialActions([...i || [], ...r || []]), this.assignParams(a), s !== void 0 ? this.setValueInternal(s) : this.originalValue !== void 0 && this.setValueInternal(this.originalValue);
|
|
2313
2335
|
}
|
|
2314
|
-
this.originalValue === void 0 && (this.originalValue =
|
|
2336
|
+
this.constructed(e), this.originalValue === void 0 && (this.originalValue = _.baseline(this.value)), this.raw.announcedValue = this.value, this.boundActions?.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
2315
2337
|
});
|
|
2316
2338
|
}
|
|
2317
2339
|
/** The row array is copied as well: a rollback puts back the set the list held, not the array it went on to hold. */
|
|
@@ -2363,13 +2385,13 @@ class F extends y {
|
|
|
2363
2385
|
for (let a = t.length; a < i.length; a++) this.releaseChild(i[a]);
|
|
2364
2386
|
this.state.rows = r;
|
|
2365
2387
|
}
|
|
2366
|
-
|
|
2388
|
+
_.rowsDiffer(s, this.raw.rows) && this.rowsChanged(), this.bumpValueVersion();
|
|
2367
2389
|
});
|
|
2368
2390
|
}
|
|
2369
2391
|
get value() {
|
|
2370
2392
|
const t = this.valueVersion;
|
|
2371
2393
|
if (this.raw.cachedValueVersion === t) return this.raw.cachedValue;
|
|
2372
|
-
const e = this.state.rows?.map((i) => i.value), s =
|
|
2394
|
+
const e = this.state.rows?.map((i) => i.value), s = F(e) ? null : Object.freeze(e);
|
|
2373
2395
|
return this.raw.cachedValue = s, this.raw.cachedValueVersion = t, s;
|
|
2374
2396
|
}
|
|
2375
2397
|
set value(t) {
|
|
@@ -2385,7 +2407,7 @@ class F extends y {
|
|
|
2385
2407
|
u((s) => {
|
|
2386
2408
|
s.touch(this), this.errors.length && (this.errors = []), this.setValueInternal(e === void 0 ? t.value : e);
|
|
2387
2409
|
const i = this.value;
|
|
2388
|
-
this.raw.announcedValue = i, this.originalValue =
|
|
2410
|
+
this.raw.announcedValue = i, this.originalValue = _.baseline(i), super.validate(!0);
|
|
2389
2411
|
});
|
|
2390
2412
|
}
|
|
2391
2413
|
get touched() {
|
|
@@ -2501,10 +2523,10 @@ class F extends y {
|
|
|
2501
2523
|
return u((i) => {
|
|
2502
2524
|
for (i.touch(this), this.state.rows == null && (this.state.rows = []), s = e < 0 ? Math.max(this.state.rows.length + e, 0) : e; this.state.rows.length < s; ) {
|
|
2503
2525
|
const a = this.createPaddingItem(), o = this.state.rows.push(a) - 1;
|
|
2504
|
-
this.bumpValueVersion(), i.recordStructural(this, { actionClass:
|
|
2526
|
+
this.bumpValueVersion(), i.recordStructural(this, { actionClass: Y, item: a, index: o });
|
|
2505
2527
|
}
|
|
2506
2528
|
const r = this.processSetValueItem(t);
|
|
2507
|
-
this.state.rows.splice(s, 0, r), i.recordStructural(this, { actionClass:
|
|
2529
|
+
this.state.rows.splice(s, 0, r), i.recordStructural(this, { actionClass: Y, item: r, index: s }), this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(!0);
|
|
2508
2530
|
}), s;
|
|
2509
2531
|
}
|
|
2510
2532
|
/** Drops every row this list holds out of its tally, so a row that changes its verdict later is not counted. */
|
|
@@ -2557,7 +2579,7 @@ class Ie extends f {
|
|
|
2557
2579
|
/** The field `field` is compared against, within the record `field` belongs to. */
|
|
2558
2580
|
resolve(t) {
|
|
2559
2581
|
const e = this.otherField;
|
|
2560
|
-
return typeof e == "function" ? e(t) ?? void 0 : typeof e == "string" ? ae(e, t) :
|
|
2582
|
+
return typeof e == "function" ? e(t) ?? void 0 : typeof e == "string" ? ae(e, t) : tt(e, V(t));
|
|
2561
2583
|
}
|
|
2562
2584
|
/**
|
|
2563
2585
|
* Makes a change of `other` re-run this comparison. The listener re-runs it over the fields of the record the
|
|
@@ -2650,7 +2672,7 @@ class Re extends f {
|
|
|
2650
2672
|
super(i);
|
|
2651
2673
|
}
|
|
2652
2674
|
}
|
|
2653
|
-
class
|
|
2675
|
+
class _e extends f {
|
|
2654
2676
|
constructor(t, e) {
|
|
2655
2677
|
const s = e || b("Value must be less than or equal to **{maxValue}**"), i = (r, a, o) => r > t || r === void 0 ? [
|
|
2656
2678
|
new g(
|
|
@@ -2662,7 +2684,7 @@ class Fe extends f {
|
|
|
2662
2684
|
super(i);
|
|
2663
2685
|
}
|
|
2664
2686
|
}
|
|
2665
|
-
class
|
|
2687
|
+
class Fe extends f {
|
|
2666
2688
|
constructor(t, e, s) {
|
|
2667
2689
|
const i = s || b("Value must be between **{minValue}** and **{maxValue}**"), r = (a, o, l) => a < t || a > e || a === void 0 ? [
|
|
2668
2690
|
new g(
|
|
@@ -2674,12 +2696,12 @@ class _e extends f {
|
|
|
2674
2696
|
super(r);
|
|
2675
2697
|
}
|
|
2676
2698
|
}
|
|
2677
|
-
function
|
|
2699
|
+
function st(n) {
|
|
2678
2700
|
return n == null ? 0 : yt(n) || C(n) ? n.length : Et(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
|
|
2679
2701
|
}
|
|
2680
2702
|
class Pe extends f {
|
|
2681
2703
|
constructor(t, e) {
|
|
2682
|
-
const s = e || b("Length must be larger or equal to **{minLength}**"), i = (r, a, o) =>
|
|
2704
|
+
const s = e || b("Length must be larger or equal to **{minLength}**"), i = (r, a, o) => st(r) < t ? [
|
|
2683
2705
|
new g(
|
|
2684
2706
|
this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, minLength: t }),
|
|
2685
2707
|
"",
|
|
@@ -2691,7 +2713,7 @@ class Pe extends f {
|
|
|
2691
2713
|
}
|
|
2692
2714
|
class je extends f {
|
|
2693
2715
|
constructor(t, e) {
|
|
2694
|
-
const s = e || b("Length must be less than or equal to **{maxLength}**"), i = (r, a, o) =>
|
|
2716
|
+
const s = e || b("Length must be less than or equal to **{maxLength}**"), i = (r, a, o) => st(r) > t ? [
|
|
2695
2717
|
new g(
|
|
2696
2718
|
this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, maxLength: t }),
|
|
2697
2719
|
"",
|
|
@@ -2704,7 +2726,7 @@ class je extends f {
|
|
|
2704
2726
|
class Ne extends f {
|
|
2705
2727
|
constructor(t, e, s) {
|
|
2706
2728
|
const i = s || b("Length must be between **{minLength}** and **{maxLength}**"), r = (a, o, l) => {
|
|
2707
|
-
const v =
|
|
2729
|
+
const v = st(a);
|
|
2708
2730
|
return v < t || v > e ? [
|
|
2709
2731
|
new g(
|
|
2710
2732
|
this.replacePlaceholders(i, { newValue: a, oldValue: o, field: l, minLength: t, maxLength: e }),
|
|
@@ -2734,13 +2756,13 @@ const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2734
2756
|
InAllowedValues: Te,
|
|
2735
2757
|
LengthInRange: Ne,
|
|
2736
2758
|
MaxLength: je,
|
|
2737
|
-
MaxValue:
|
|
2759
|
+
MaxValue: _e,
|
|
2738
2760
|
MinLength: Pe,
|
|
2739
2761
|
MinValue: Re,
|
|
2740
2762
|
Pattern: Be,
|
|
2741
2763
|
Required: ke,
|
|
2742
2764
|
Validator: f,
|
|
2743
|
-
ValueInRange:
|
|
2765
|
+
ValueInRange: Fe
|
|
2744
2766
|
}, Symbol.toStringTag, { value: "Module" })), $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2745
2767
|
__proto__: null,
|
|
2746
2768
|
AbortEventHandlingException: P,
|
|
@@ -2751,23 +2773,23 @@ const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2751
2773
|
ConditionalValueAction: ce,
|
|
2752
2774
|
ConditionalVisibilityAction: le,
|
|
2753
2775
|
DisplayMode: I,
|
|
2754
|
-
EnabledChangedAction:
|
|
2776
|
+
EnabledChangedAction: _t,
|
|
2755
2777
|
EnabledChangingAction: Rt,
|
|
2756
2778
|
ExecuteAction: Nt,
|
|
2757
|
-
Field:
|
|
2779
|
+
Field: et,
|
|
2758
2780
|
FieldActionBase: m,
|
|
2759
2781
|
FieldBase: y,
|
|
2760
2782
|
Group: d,
|
|
2761
|
-
List:
|
|
2762
|
-
ListItemAddedAction:
|
|
2783
|
+
List: _,
|
|
2784
|
+
ListItemAddedAction: Y,
|
|
2763
2785
|
ListItemRemovedAction: Bt,
|
|
2764
2786
|
MdString: j,
|
|
2765
2787
|
MessagesWidget: xe,
|
|
2766
2788
|
Operator: c,
|
|
2767
2789
|
RenderableValue: se,
|
|
2768
2790
|
Statement: w,
|
|
2769
|
-
ValidChangedAction:
|
|
2770
|
-
ValidationError:
|
|
2791
|
+
ValidChangedAction: Ft,
|
|
2792
|
+
ValidationError: G,
|
|
2771
2793
|
ValidationErrorRenderContent: g,
|
|
2772
2794
|
ValidationErrorText: ee,
|
|
2773
2795
|
Validators: De,
|
|
@@ -2777,8 +2799,8 @@ const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2777
2799
|
buildErrorMessage: b,
|
|
2778
2800
|
defaultDisplayMode: Kt,
|
|
2779
2801
|
isCallableFunction: L,
|
|
2780
|
-
isSimpleComponentDef:
|
|
2781
|
-
transaction:
|
|
2802
|
+
isSimpleComponentDef: Z,
|
|
2803
|
+
transaction: J
|
|
2782
2804
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2783
2805
|
export {
|
|
2784
2806
|
P as AbortEventHandlingException,
|
|
@@ -2789,23 +2811,23 @@ export {
|
|
|
2789
2811
|
ce as ConditionalValueAction,
|
|
2790
2812
|
le as ConditionalVisibilityAction,
|
|
2791
2813
|
I as DisplayMode,
|
|
2792
|
-
|
|
2814
|
+
_t as EnabledChangedAction,
|
|
2793
2815
|
Rt as EnabledChangingAction,
|
|
2794
2816
|
Nt as ExecuteAction,
|
|
2795
|
-
|
|
2817
|
+
et as Field,
|
|
2796
2818
|
m as FieldActionBase,
|
|
2797
2819
|
y as FieldBase,
|
|
2798
2820
|
d as Group,
|
|
2799
|
-
|
|
2800
|
-
|
|
2821
|
+
_ as List,
|
|
2822
|
+
Y as ListItemAddedAction,
|
|
2801
2823
|
Bt as ListItemRemovedAction,
|
|
2802
2824
|
j as MdString,
|
|
2803
2825
|
xe as MessagesWidget,
|
|
2804
2826
|
c as Operator,
|
|
2805
2827
|
se as RenderableValue,
|
|
2806
2828
|
w as Statement,
|
|
2807
|
-
|
|
2808
|
-
|
|
2829
|
+
Ft as ValidChangedAction,
|
|
2830
|
+
G as ValidationError,
|
|
2809
2831
|
g as ValidationErrorRenderContent,
|
|
2810
2832
|
ee as ValidationErrorText,
|
|
2811
2833
|
De as Validators,
|
|
@@ -2818,8 +2840,8 @@ export {
|
|
|
2818
2840
|
Ue as forms,
|
|
2819
2841
|
Gt as getConfig,
|
|
2820
2842
|
L as isCallableFunction,
|
|
2821
|
-
|
|
2843
|
+
Z as isSimpleComponentDef,
|
|
2822
2844
|
te as setConfig,
|
|
2823
|
-
|
|
2845
|
+
J as transaction
|
|
2824
2846
|
};
|
|
2825
2847
|
//# sourceMappingURL=dynamicforms-vue-forms.js.map
|