@dynamicforms/vue-forms 0.16.0 → 0.17.0
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 +140 -100
- package/dist/dynamicforms-vue-forms.js.map +1 -1
- package/dist/index.d.ts +85 -16
- 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,10 +1444,28 @@ 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
|
}
|
|
1451
|
+
/**
|
|
1452
|
+
* Whether this element and every container above it are enabled. A rendering layer binds one read instead of
|
|
1453
|
+
* walking the parent chain: a disabled `Group` states that its section cannot be edited, and the inputs
|
|
1454
|
+
* rendered from the members inside it read that here.
|
|
1455
|
+
*
|
|
1456
|
+
* It is a read and nothing else. `enabled` on each element stays exactly what was written to it, a write to a
|
|
1457
|
+
* member of a disabled container is accepted the way it always was, and what a container serializes is decided
|
|
1458
|
+
* by the members' own `enabled`. Where a whole subtree is to stop serializing, the members are disabled.
|
|
1459
|
+
*
|
|
1460
|
+
* `enabled` is the only member with a reading of this kind, and it is not a scheme the other members follow.
|
|
1461
|
+
* `visibility` has none because `SUPPRESS` states that an element is absent from the value as well, so folding
|
|
1462
|
+
* it down the tree would decide serialization rather than report it; `value` has none because a container
|
|
1463
|
+
* composes its own from its members rather than passing one down. A rendering layer that needs a third thing
|
|
1464
|
+
* folded down the tree has `provide`/`inject`, which is where the render tree's own context belongs.
|
|
1465
|
+
*/
|
|
1466
|
+
get effectiveEnabled() {
|
|
1467
|
+
return this.enabled && (this.parent?.effectiveEnabled ?? !0);
|
|
1468
|
+
}
|
|
1430
1469
|
/**
|
|
1431
1470
|
* True for an element whose value is composed of its members'. The commit builds such a value only where
|
|
1432
1471
|
* something receives it, compares it by content rather than by identity, and runs the element's own validators
|
|
@@ -1470,7 +1509,7 @@ class y {
|
|
|
1470
1509
|
if (s === e) return;
|
|
1471
1510
|
t.touch(this), this.#e.valid = s;
|
|
1472
1511
|
const i = this.container;
|
|
1473
|
-
i && (t.touch(i), i.childValidityChanged(s), t.markValidityDirty(i)), this.boundActions?.trigger(
|
|
1512
|
+
i && (t.touch(i), i.childValidityChanged(s), t.markValidityDirty(i)), this.boundActions?.trigger(Ft, this, s, e);
|
|
1474
1513
|
}
|
|
1475
1514
|
validate(t = !1) {
|
|
1476
1515
|
u((e) => {
|
|
@@ -1497,7 +1536,7 @@ class y {
|
|
|
1497
1536
|
boundFrom(t, e, s, i) {
|
|
1498
1537
|
this.#e.declaration = t.declaration;
|
|
1499
1538
|
const r = { ...t.extra, ...i && this.extendedOf(i) };
|
|
1500
|
-
|
|
1539
|
+
F(r) || this.setExtendedValues(r);
|
|
1501
1540
|
const a = this.declaration;
|
|
1502
1541
|
a.noteBinding(this);
|
|
1503
1542
|
const o = a._actions;
|
|
@@ -1622,7 +1661,7 @@ class w {
|
|
|
1622
1661
|
static valueOf(t, e) {
|
|
1623
1662
|
if (t instanceof w) return t.evaluate(e);
|
|
1624
1663
|
if (t instanceof y) {
|
|
1625
|
-
const s = e ?
|
|
1664
|
+
const s = e ? tt(t, e) : t;
|
|
1626
1665
|
return s ? h(s.value) : void 0;
|
|
1627
1666
|
}
|
|
1628
1667
|
return t;
|
|
@@ -1707,7 +1746,7 @@ class Nt extends m {
|
|
|
1707
1746
|
}
|
|
1708
1747
|
}
|
|
1709
1748
|
const ve = /* @__PURE__ */ Symbol("ListItemAddedAction");
|
|
1710
|
-
class
|
|
1749
|
+
class Y extends m {
|
|
1711
1750
|
constructor(t) {
|
|
1712
1751
|
super(t);
|
|
1713
1752
|
}
|
|
@@ -1767,7 +1806,7 @@ function Ee() {
|
|
|
1767
1806
|
function Ce() {
|
|
1768
1807
|
return { ...Lt(), rows: null, rowsVersion: 0, cachedItems: null, cachedItemsVersion: -1 };
|
|
1769
1808
|
}
|
|
1770
|
-
class
|
|
1809
|
+
class et extends y {
|
|
1771
1810
|
get [Symbol.toStringTag]() {
|
|
1772
1811
|
return "Field";
|
|
1773
1812
|
}
|
|
@@ -1800,9 +1839,9 @@ class st extends y {
|
|
|
1800
1839
|
u(() => {
|
|
1801
1840
|
if (t) {
|
|
1802
1841
|
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
|
|
1842
|
+
this.registerInitialActions([...s || [], ...i || []]), this.assignParams(r), this._value = e !== void 0 ? e : this.originalValue;
|
|
1804
1843
|
}
|
|
1805
|
-
this.raw.announcedValue = this._value, this.boundActions?.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
1844
|
+
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
1845
|
});
|
|
1807
1846
|
}
|
|
1808
1847
|
get value() {
|
|
@@ -1839,11 +1878,12 @@ class st extends y {
|
|
|
1839
1878
|
return i.boundFrom(this, i.value, i.originalValue, e), i;
|
|
1840
1879
|
}
|
|
1841
1880
|
}
|
|
1842
|
-
const
|
|
1843
|
-
function
|
|
1844
|
-
|
|
1881
|
+
const mt = /* @__PURE__ */ new WeakMap();
|
|
1882
|
+
function bt(n) {
|
|
1883
|
+
if (n != null)
|
|
1884
|
+
return Object.values(n).some((t) => t != null) ? n : void 0;
|
|
1845
1885
|
}
|
|
1846
|
-
class Se extends
|
|
1886
|
+
class Se extends et {
|
|
1847
1887
|
get [Symbol.toStringTag]() {
|
|
1848
1888
|
return "Action";
|
|
1849
1889
|
}
|
|
@@ -1852,10 +1892,10 @@ class Se extends st {
|
|
|
1852
1892
|
if (this._value = { label: void 0, icon: void 0 }, t) {
|
|
1853
1893
|
const { value: e, originalValue: s, validators: i, actions: r, ...a } = t;
|
|
1854
1894
|
this.registerInitialActions([...i || [], ...r || []]), this.assignParams(a);
|
|
1855
|
-
const o =
|
|
1856
|
-
this._value =
|
|
1895
|
+
const o = bt(e), l = bt(s);
|
|
1896
|
+
o ? this._value = o : l && (this._value = { ...l }), l && (this.originalValue = Object.freeze({ ...l }));
|
|
1857
1897
|
}
|
|
1858
|
-
this.raw.announcedValue = this._value, this.boundActions?.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
1898
|
+
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
1899
|
});
|
|
1860
1900
|
}
|
|
1861
1901
|
/**
|
|
@@ -1889,8 +1929,8 @@ class Se extends st {
|
|
|
1889
1929
|
}
|
|
1890
1930
|
/** the counter behind `busy`, allocated for this action the first time it is asked for */
|
|
1891
1931
|
get busyRuns() {
|
|
1892
|
-
let t =
|
|
1893
|
-
return t || (t = Wt(0),
|
|
1932
|
+
let t = mt.get(this);
|
|
1933
|
+
return t || (t = Wt(0), mt.set(this, t)), t;
|
|
1894
1934
|
}
|
|
1895
1935
|
/** true from the moment execute() is called until the handler it ran has settled, however it settles */
|
|
1896
1936
|
get busy() {
|
|
@@ -1923,7 +1963,7 @@ const xe = /* @__PURE__ */ qt({
|
|
|
1923
1963
|
classes: {}
|
|
1924
1964
|
},
|
|
1925
1965
|
setup(n) {
|
|
1926
|
-
const t = n, e =
|
|
1966
|
+
const t = n, e = lt("vue-markdown"), s = /* @__PURE__ */ new Set([
|
|
1927
1967
|
"div",
|
|
1928
1968
|
"span",
|
|
1929
1969
|
"p",
|
|
@@ -2007,7 +2047,7 @@ const xe = /* @__PURE__ */ qt({
|
|
|
2007
2047
|
default:
|
|
2008
2048
|
r.push(
|
|
2009
2049
|
k(
|
|
2010
|
-
s.has(a.componentName.toLowerCase()) ? a.componentName :
|
|
2050
|
+
s.has(a.componentName.toLowerCase()) ? a.componentName : lt(a.componentName),
|
|
2011
2051
|
{
|
|
2012
2052
|
class: [t.classes, a.extraClasses],
|
|
2013
2053
|
...a.componentBindings,
|
|
@@ -2062,7 +2102,7 @@ class d extends y {
|
|
|
2062
2102
|
const { value: i, validators: r, actions: a, ...o } = e;
|
|
2063
2103
|
this.registerInitialActions([...r || [], ...a || []]), this.assignParams(o), i !== void 0 ? this.assignMembers(i) : this.originalValue !== void 0 && this.assignMembers(this.originalValue);
|
|
2064
2104
|
}
|
|
2065
|
-
this.completeRecords();
|
|
2105
|
+
this.completeRecords(), this.constructed(e);
|
|
2066
2106
|
const s = this.value;
|
|
2067
2107
|
this.originalValue === void 0 && (this.originalValue = d.baseline(s)), this.raw.announcedValue = s, this.boundActions?.triggerEager(this, s, this.originalValue), this.validate();
|
|
2068
2108
|
});
|
|
@@ -2140,7 +2180,7 @@ class d extends y {
|
|
|
2140
2180
|
if (t instanceof y)
|
|
2141
2181
|
throw new Error("data is already a Form structure, should be a simple object");
|
|
2142
2182
|
return new d(
|
|
2143
|
-
t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, s]) => [e, new
|
|
2183
|
+
t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, s]) => [e, new et({ value: s })]))
|
|
2144
2184
|
);
|
|
2145
2185
|
}
|
|
2146
2186
|
field(t) {
|
|
@@ -2170,9 +2210,9 @@ class d extends y {
|
|
|
2170
2210
|
const e = /* @__PURE__ */ Object.create(null);
|
|
2171
2211
|
Object.entries(this._fields).forEach(([i, r]) => {
|
|
2172
2212
|
const a = r.value;
|
|
2173
|
-
(r.enabled || this.childComposesValue(r) && !
|
|
2213
|
+
(r.enabled || this.childComposesValue(r) && !F(a)) && (e[i] = a);
|
|
2174
2214
|
});
|
|
2175
|
-
const s =
|
|
2215
|
+
const s = F(e) ? null : Object.freeze({ ...e });
|
|
2176
2216
|
return this.raw.cachedValue = s, this.raw.cachedValueVersion = t, s;
|
|
2177
2217
|
}
|
|
2178
2218
|
/**
|
|
@@ -2294,7 +2334,7 @@ class d extends y {
|
|
|
2294
2334
|
return super.rebind(t);
|
|
2295
2335
|
}
|
|
2296
2336
|
}
|
|
2297
|
-
class
|
|
2337
|
+
class _ extends y {
|
|
2298
2338
|
get [Symbol.toStringTag]() {
|
|
2299
2339
|
return "List";
|
|
2300
2340
|
}
|
|
@@ -2311,7 +2351,7 @@ class F extends y {
|
|
|
2311
2351
|
const { value: s, validators: i, actions: r, ...a } = e;
|
|
2312
2352
|
this.registerInitialActions([...i || [], ...r || []]), this.assignParams(a), s !== void 0 ? this.setValueInternal(s) : this.originalValue !== void 0 && this.setValueInternal(this.originalValue);
|
|
2313
2353
|
}
|
|
2314
|
-
this.originalValue === void 0 && (this.originalValue =
|
|
2354
|
+
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
2355
|
});
|
|
2316
2356
|
}
|
|
2317
2357
|
/** 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 +2403,13 @@ class F extends y {
|
|
|
2363
2403
|
for (let a = t.length; a < i.length; a++) this.releaseChild(i[a]);
|
|
2364
2404
|
this.state.rows = r;
|
|
2365
2405
|
}
|
|
2366
|
-
|
|
2406
|
+
_.rowsDiffer(s, this.raw.rows) && this.rowsChanged(), this.bumpValueVersion();
|
|
2367
2407
|
});
|
|
2368
2408
|
}
|
|
2369
2409
|
get value() {
|
|
2370
2410
|
const t = this.valueVersion;
|
|
2371
2411
|
if (this.raw.cachedValueVersion === t) return this.raw.cachedValue;
|
|
2372
|
-
const e = this.state.rows?.map((i) => i.value), s =
|
|
2412
|
+
const e = this.state.rows?.map((i) => i.value), s = F(e) ? null : Object.freeze(e);
|
|
2373
2413
|
return this.raw.cachedValue = s, this.raw.cachedValueVersion = t, s;
|
|
2374
2414
|
}
|
|
2375
2415
|
set value(t) {
|
|
@@ -2385,7 +2425,7 @@ class F extends y {
|
|
|
2385
2425
|
u((s) => {
|
|
2386
2426
|
s.touch(this), this.errors.length && (this.errors = []), this.setValueInternal(e === void 0 ? t.value : e);
|
|
2387
2427
|
const i = this.value;
|
|
2388
|
-
this.raw.announcedValue = i, this.originalValue =
|
|
2428
|
+
this.raw.announcedValue = i, this.originalValue = _.baseline(i), super.validate(!0);
|
|
2389
2429
|
});
|
|
2390
2430
|
}
|
|
2391
2431
|
get touched() {
|
|
@@ -2501,10 +2541,10 @@ class F extends y {
|
|
|
2501
2541
|
return u((i) => {
|
|
2502
2542
|
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
2543
|
const a = this.createPaddingItem(), o = this.state.rows.push(a) - 1;
|
|
2504
|
-
this.bumpValueVersion(), i.recordStructural(this, { actionClass:
|
|
2544
|
+
this.bumpValueVersion(), i.recordStructural(this, { actionClass: Y, item: a, index: o });
|
|
2505
2545
|
}
|
|
2506
2546
|
const r = this.processSetValueItem(t);
|
|
2507
|
-
this.state.rows.splice(s, 0, r), i.recordStructural(this, { actionClass:
|
|
2547
|
+
this.state.rows.splice(s, 0, r), i.recordStructural(this, { actionClass: Y, item: r, index: s }), this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(!0);
|
|
2508
2548
|
}), s;
|
|
2509
2549
|
}
|
|
2510
2550
|
/** Drops every row this list holds out of its tally, so a row that changes its verdict later is not counted. */
|
|
@@ -2557,7 +2597,7 @@ class Ie extends f {
|
|
|
2557
2597
|
/** The field `field` is compared against, within the record `field` belongs to. */
|
|
2558
2598
|
resolve(t) {
|
|
2559
2599
|
const e = this.otherField;
|
|
2560
|
-
return typeof e == "function" ? e(t) ?? void 0 : typeof e == "string" ? ae(e, t) :
|
|
2600
|
+
return typeof e == "function" ? e(t) ?? void 0 : typeof e == "string" ? ae(e, t) : tt(e, V(t));
|
|
2561
2601
|
}
|
|
2562
2602
|
/**
|
|
2563
2603
|
* Makes a change of `other` re-run this comparison. The listener re-runs it over the fields of the record the
|
|
@@ -2650,7 +2690,7 @@ class Re extends f {
|
|
|
2650
2690
|
super(i);
|
|
2651
2691
|
}
|
|
2652
2692
|
}
|
|
2653
|
-
class
|
|
2693
|
+
class _e extends f {
|
|
2654
2694
|
constructor(t, e) {
|
|
2655
2695
|
const s = e || b("Value must be less than or equal to **{maxValue}**"), i = (r, a, o) => r > t || r === void 0 ? [
|
|
2656
2696
|
new g(
|
|
@@ -2662,7 +2702,7 @@ class Fe extends f {
|
|
|
2662
2702
|
super(i);
|
|
2663
2703
|
}
|
|
2664
2704
|
}
|
|
2665
|
-
class
|
|
2705
|
+
class Fe extends f {
|
|
2666
2706
|
constructor(t, e, s) {
|
|
2667
2707
|
const i = s || b("Value must be between **{minValue}** and **{maxValue}**"), r = (a, o, l) => a < t || a > e || a === void 0 ? [
|
|
2668
2708
|
new g(
|
|
@@ -2674,12 +2714,12 @@ class _e extends f {
|
|
|
2674
2714
|
super(r);
|
|
2675
2715
|
}
|
|
2676
2716
|
}
|
|
2677
|
-
function
|
|
2717
|
+
function st(n) {
|
|
2678
2718
|
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
2719
|
}
|
|
2680
2720
|
class Pe extends f {
|
|
2681
2721
|
constructor(t, e) {
|
|
2682
|
-
const s = e || b("Length must be larger or equal to **{minLength}**"), i = (r, a, o) =>
|
|
2722
|
+
const s = e || b("Length must be larger or equal to **{minLength}**"), i = (r, a, o) => st(r) < t ? [
|
|
2683
2723
|
new g(
|
|
2684
2724
|
this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, minLength: t }),
|
|
2685
2725
|
"",
|
|
@@ -2691,7 +2731,7 @@ class Pe extends f {
|
|
|
2691
2731
|
}
|
|
2692
2732
|
class je extends f {
|
|
2693
2733
|
constructor(t, e) {
|
|
2694
|
-
const s = e || b("Length must be less than or equal to **{maxLength}**"), i = (r, a, o) =>
|
|
2734
|
+
const s = e || b("Length must be less than or equal to **{maxLength}**"), i = (r, a, o) => st(r) > t ? [
|
|
2695
2735
|
new g(
|
|
2696
2736
|
this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, maxLength: t }),
|
|
2697
2737
|
"",
|
|
@@ -2704,7 +2744,7 @@ class je extends f {
|
|
|
2704
2744
|
class Ne extends f {
|
|
2705
2745
|
constructor(t, e, s) {
|
|
2706
2746
|
const i = s || b("Length must be between **{minLength}** and **{maxLength}**"), r = (a, o, l) => {
|
|
2707
|
-
const v =
|
|
2747
|
+
const v = st(a);
|
|
2708
2748
|
return v < t || v > e ? [
|
|
2709
2749
|
new g(
|
|
2710
2750
|
this.replacePlaceholders(i, { newValue: a, oldValue: o, field: l, minLength: t, maxLength: e }),
|
|
@@ -2734,13 +2774,13 @@ const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2734
2774
|
InAllowedValues: Te,
|
|
2735
2775
|
LengthInRange: Ne,
|
|
2736
2776
|
MaxLength: je,
|
|
2737
|
-
MaxValue:
|
|
2777
|
+
MaxValue: _e,
|
|
2738
2778
|
MinLength: Pe,
|
|
2739
2779
|
MinValue: Re,
|
|
2740
2780
|
Pattern: Be,
|
|
2741
2781
|
Required: ke,
|
|
2742
2782
|
Validator: f,
|
|
2743
|
-
ValueInRange:
|
|
2783
|
+
ValueInRange: Fe
|
|
2744
2784
|
}, Symbol.toStringTag, { value: "Module" })), $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2745
2785
|
__proto__: null,
|
|
2746
2786
|
AbortEventHandlingException: P,
|
|
@@ -2751,23 +2791,23 @@ const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2751
2791
|
ConditionalValueAction: ce,
|
|
2752
2792
|
ConditionalVisibilityAction: le,
|
|
2753
2793
|
DisplayMode: I,
|
|
2754
|
-
EnabledChangedAction:
|
|
2794
|
+
EnabledChangedAction: _t,
|
|
2755
2795
|
EnabledChangingAction: Rt,
|
|
2756
2796
|
ExecuteAction: Nt,
|
|
2757
|
-
Field:
|
|
2797
|
+
Field: et,
|
|
2758
2798
|
FieldActionBase: m,
|
|
2759
2799
|
FieldBase: y,
|
|
2760
2800
|
Group: d,
|
|
2761
|
-
List:
|
|
2762
|
-
ListItemAddedAction:
|
|
2801
|
+
List: _,
|
|
2802
|
+
ListItemAddedAction: Y,
|
|
2763
2803
|
ListItemRemovedAction: Bt,
|
|
2764
2804
|
MdString: j,
|
|
2765
2805
|
MessagesWidget: xe,
|
|
2766
2806
|
Operator: c,
|
|
2767
2807
|
RenderableValue: se,
|
|
2768
2808
|
Statement: w,
|
|
2769
|
-
ValidChangedAction:
|
|
2770
|
-
ValidationError:
|
|
2809
|
+
ValidChangedAction: Ft,
|
|
2810
|
+
ValidationError: G,
|
|
2771
2811
|
ValidationErrorRenderContent: g,
|
|
2772
2812
|
ValidationErrorText: ee,
|
|
2773
2813
|
Validators: De,
|
|
@@ -2777,8 +2817,8 @@ const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2777
2817
|
buildErrorMessage: b,
|
|
2778
2818
|
defaultDisplayMode: Kt,
|
|
2779
2819
|
isCallableFunction: L,
|
|
2780
|
-
isSimpleComponentDef:
|
|
2781
|
-
transaction:
|
|
2820
|
+
isSimpleComponentDef: Z,
|
|
2821
|
+
transaction: J
|
|
2782
2822
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2783
2823
|
export {
|
|
2784
2824
|
P as AbortEventHandlingException,
|
|
@@ -2789,23 +2829,23 @@ export {
|
|
|
2789
2829
|
ce as ConditionalValueAction,
|
|
2790
2830
|
le as ConditionalVisibilityAction,
|
|
2791
2831
|
I as DisplayMode,
|
|
2792
|
-
|
|
2832
|
+
_t as EnabledChangedAction,
|
|
2793
2833
|
Rt as EnabledChangingAction,
|
|
2794
2834
|
Nt as ExecuteAction,
|
|
2795
|
-
|
|
2835
|
+
et as Field,
|
|
2796
2836
|
m as FieldActionBase,
|
|
2797
2837
|
y as FieldBase,
|
|
2798
2838
|
d as Group,
|
|
2799
|
-
|
|
2800
|
-
|
|
2839
|
+
_ as List,
|
|
2840
|
+
Y as ListItemAddedAction,
|
|
2801
2841
|
Bt as ListItemRemovedAction,
|
|
2802
2842
|
j as MdString,
|
|
2803
2843
|
xe as MessagesWidget,
|
|
2804
2844
|
c as Operator,
|
|
2805
2845
|
se as RenderableValue,
|
|
2806
2846
|
w as Statement,
|
|
2807
|
-
|
|
2808
|
-
|
|
2847
|
+
Ft as ValidChangedAction,
|
|
2848
|
+
G as ValidationError,
|
|
2809
2849
|
g as ValidationErrorRenderContent,
|
|
2810
2850
|
ee as ValidationErrorText,
|
|
2811
2851
|
De as Validators,
|
|
@@ -2818,8 +2858,8 @@ export {
|
|
|
2818
2858
|
Ue as forms,
|
|
2819
2859
|
Gt as getConfig,
|
|
2820
2860
|
L as isCallableFunction,
|
|
2821
|
-
|
|
2861
|
+
Z as isSimpleComponentDef,
|
|
2822
2862
|
te as setConfig,
|
|
2823
|
-
|
|
2863
|
+
J as transaction
|
|
2824
2864
|
};
|
|
2825
2865
|
//# sourceMappingURL=dynamicforms-vue-forms.js.map
|