@dynamicforms/vue-forms 0.12.0 → 0.16.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 +1524 -1147
- package/dist/dynamicforms-vue-forms.js.map +1 -1
- package/dist/index.d.ts +392 -72
- package/package.json +16 -4
- package/readme.md +49 -25
|
@@ -1,97 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var K = (n, e, t) => e in n ? Gt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, p = (n, e) => {
|
|
9
|
-
for (var t in e || (e = {}))
|
|
10
|
-
ft.call(e, t) && K(n, t, e[t]);
|
|
11
|
-
if (W)
|
|
12
|
-
for (var t of W(e))
|
|
13
|
-
pt.call(e, t) && K(n, t, e[t]);
|
|
14
|
-
return n;
|
|
15
|
-
}, C = (n, e) => Yt(n, Jt(e));
|
|
16
|
-
var k = (n, e) => {
|
|
17
|
-
var t = {};
|
|
18
|
-
for (var s in n)
|
|
19
|
-
ft.call(n, s) && e.indexOf(s) < 0 && (t[s] = n[s]);
|
|
20
|
-
if (n != null && W)
|
|
21
|
-
for (var s of W(n))
|
|
22
|
-
e.indexOf(s) < 0 && pt.call(n, s) && (t[s] = n[s]);
|
|
23
|
-
return t;
|
|
24
|
-
};
|
|
25
|
-
var d = (n, e, t) => K(n, typeof e != "symbol" ? e + "" : e, t), bt = (n, e, t) => e.has(n) || mt("Cannot " + t);
|
|
26
|
-
var l = (n, e, t) => (bt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), Z = (n, e, t) => e.has(n) ? mt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), tt = (n, e, t, s) => (bt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t);
|
|
27
|
-
var vt = (n, e, t) => new Promise((s, i) => {
|
|
28
|
-
var r = (u) => {
|
|
29
|
-
try {
|
|
30
|
-
o(t.next(u));
|
|
31
|
-
} catch (c) {
|
|
32
|
-
i(c);
|
|
33
|
-
}
|
|
34
|
-
}, a = (u) => {
|
|
35
|
-
try {
|
|
36
|
-
o(t.throw(u));
|
|
37
|
-
} catch (c) {
|
|
38
|
-
i(c);
|
|
39
|
-
}
|
|
40
|
-
}, o = (u) => u.done ? s(u.value) : Promise.resolve(u.value).then(r, a);
|
|
41
|
-
o((t = t.apply(n, e)).next());
|
|
42
|
-
});
|
|
43
|
-
import { isEqual as nt, isEmpty as L, isBoolean as Kt, isString as j, truncate as Zt, isArray as At, isObject as _t } from "lodash-es";
|
|
44
|
-
import { unref as b, computed as Tt, isRef as te, reactive as ee, ref as se, defineComponent as ie, resolveComponent as Vt, openBlock as ne, createBlock as re, h as R } from "vue";
|
|
45
|
-
var P = /* @__PURE__ */ ((n) => (n[n.SUPPRESS = 1] = "SUPPRESS", n[n.HIDDEN = 5] = "HIDDEN", n[n.INVISIBLE = 8] = "INVISIBLE", n[n.FULL = 10] = "FULL", n))(P || {});
|
|
46
|
-
const wt = 10, yt = new Set(
|
|
47
|
-
Object.values(P).filter((n) => typeof n == "number")
|
|
1
|
+
import { computed as Y, unref as h, isRef as Vt, reactive as Ut, watch as $t, ref as Wt, defineComponent as qt, resolveComponent as ut, openBlock as zt, createBlock as Ht, h as k } from "vue";
|
|
2
|
+
import { isEqual as R, isEmpty as _, isBoolean as Qt, isString as C, truncate as Xt, isArray as yt, isObject as Et } from "lodash-es";
|
|
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, ct = new Set(
|
|
5
|
+
Object.values(x).filter((n) => typeof n == "number")
|
|
6
|
+
), Yt = new Set(
|
|
7
|
+
Object.values(x).filter((n) => typeof n == "string")
|
|
48
8
|
);
|
|
9
|
+
function z(n) {
|
|
10
|
+
const t = typeof n == "string" ? `'${n}'` : String(n);
|
|
11
|
+
return new Error(`${t} is not a DisplayMode constant`);
|
|
12
|
+
}
|
|
49
13
|
((n) => {
|
|
50
|
-
function e(i) {
|
|
51
|
-
return i.toUpperCase() === "SUPPRESS" ? 1 : i.toUpperCase() === "HIDDEN" ? 5 : i.toUpperCase() === "INVISIBLE" ? 8 : wt;
|
|
52
|
-
}
|
|
53
|
-
n.fromString = e;
|
|
54
14
|
function t(i) {
|
|
55
|
-
const r = typeof i == "
|
|
56
|
-
|
|
15
|
+
const r = typeof i == "string" ? i.toUpperCase() : "";
|
|
16
|
+
if (r === "SUPPRESS") return 1;
|
|
17
|
+
if (r === "HIDDEN") return 5;
|
|
18
|
+
if (r === "INVISIBLE") return 8;
|
|
19
|
+
if (r === "FULL") return 10;
|
|
20
|
+
throw z(i);
|
|
21
|
+
}
|
|
22
|
+
n.fromString = t;
|
|
23
|
+
function e(i) {
|
|
24
|
+
if (typeof i == "number") {
|
|
25
|
+
if (ct.has(i)) return i;
|
|
26
|
+
throw z(i);
|
|
27
|
+
}
|
|
28
|
+
if (typeof i != "string") throw z(i);
|
|
29
|
+
return n.fromString(i);
|
|
57
30
|
}
|
|
58
|
-
n.fromAny =
|
|
31
|
+
n.fromAny = e;
|
|
59
32
|
function s(i) {
|
|
60
|
-
|
|
61
|
-
return yt.has(r);
|
|
33
|
+
return typeof i == "number" ? ct.has(i) : typeof i == "string" ? Yt.has(i.toUpperCase()) : !1;
|
|
62
34
|
}
|
|
63
35
|
n.isDefined = s;
|
|
64
|
-
})(
|
|
65
|
-
Object.freeze(
|
|
66
|
-
const
|
|
67
|
-
class
|
|
68
|
-
constructor(e) {
|
|
69
|
-
d(this, "executorFn");
|
|
70
|
-
/**
|
|
71
|
-
* What this action remembers about one of the elements it serves. An action instance is shared - a `List` row
|
|
72
|
-
* carries the instances the item template carries - so anything an action holds about the element it last ran
|
|
73
|
-
* over belongs to that element rather than to the action: a verdict, a sequence number, a listener it installed.
|
|
74
|
-
* The keys are weak, so what an action remembers about a row is released with the row.
|
|
75
|
-
*/
|
|
76
|
-
d(this, "states", /* @__PURE__ */ new WeakMap());
|
|
77
|
-
this.executorFn = e;
|
|
78
|
-
}
|
|
36
|
+
})(x || (x = {}));
|
|
37
|
+
Object.freeze(x);
|
|
38
|
+
const I = x;
|
|
39
|
+
class m {
|
|
79
40
|
static get classIdentifier() {
|
|
80
41
|
throw new Error("classIdentifier must be declared");
|
|
81
42
|
}
|
|
82
43
|
get classIdentifier() {
|
|
83
44
|
return this.constructor.classIdentifier;
|
|
84
45
|
}
|
|
46
|
+
executorFn;
|
|
47
|
+
/**
|
|
48
|
+
* What this action remembers about one of the elements it serves. An action instance is shared - a `List` row
|
|
49
|
+
* carries the instances the item template carries - so anything an action holds about the element it last ran
|
|
50
|
+
* over belongs to that element rather than to the action: a verdict, a sequence number, a listener it installed.
|
|
51
|
+
* The keys are weak, so what an action remembers about a row is released with the row.
|
|
52
|
+
*/
|
|
53
|
+
states = /* @__PURE__ */ new WeakMap();
|
|
54
|
+
constructor(t) {
|
|
55
|
+
this.executorFn = t;
|
|
56
|
+
}
|
|
85
57
|
/**
|
|
86
58
|
* This action's state for `key`, created by `init` the first time it is asked for. The key is the element the
|
|
87
59
|
* action is running over, or the record that element belongs to where what is remembered is a fact about the
|
|
88
60
|
* whole record.
|
|
89
61
|
*/
|
|
90
|
-
state(
|
|
91
|
-
return this.states.has(
|
|
62
|
+
state(t, e) {
|
|
63
|
+
return this.states.has(t) || this.states.set(t, e()), this.states.get(t);
|
|
92
64
|
}
|
|
93
|
-
execute(
|
|
94
|
-
return this.executorFn(
|
|
65
|
+
execute(t, e, ...s) {
|
|
66
|
+
return this.executorFn(t, e, ...s);
|
|
95
67
|
}
|
|
96
68
|
get eager() {
|
|
97
69
|
return !1;
|
|
@@ -102,7 +74,7 @@ class y {
|
|
|
102
74
|
* copy as it does.
|
|
103
75
|
*/
|
|
104
76
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
105
|
-
boundToBinding(
|
|
77
|
+
boundToBinding(t) {
|
|
106
78
|
}
|
|
107
79
|
/**
|
|
108
80
|
* Announces that `binding` no longer holds this action, and takes back what running it left there. It names one
|
|
@@ -111,89 +83,95 @@ class y {
|
|
|
111
83
|
* registration and what this took back both back.
|
|
112
84
|
*/
|
|
113
85
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
114
|
-
unregisterFrom(
|
|
86
|
+
unregisterFrom(t) {
|
|
115
87
|
}
|
|
116
88
|
}
|
|
117
|
-
class
|
|
89
|
+
class P extends Error {
|
|
118
90
|
}
|
|
119
|
-
const
|
|
120
|
-
class
|
|
121
|
-
constructor(
|
|
122
|
-
super(
|
|
91
|
+
const Ct = /* @__PURE__ */ Symbol("ValueChangedAction");
|
|
92
|
+
class T extends m {
|
|
93
|
+
constructor(t) {
|
|
94
|
+
super(t);
|
|
123
95
|
}
|
|
124
96
|
static get classIdentifier() {
|
|
125
|
-
return
|
|
126
|
-
}
|
|
127
|
-
execute(e, t, s, i) {
|
|
128
|
-
return super.execute(e, t, s, i);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
const $ = /* @__PURE__ */ Symbol("Transaction.capture"), jt = /* @__PURE__ */ Symbol("Transaction.restore"), Pt = /* @__PURE__ */ Symbol("Transaction.announceValue"), Nt = /* @__PURE__ */ Symbol("Transaction.settleValidity");
|
|
132
|
-
function Et(n) {
|
|
133
|
-
let e = 0, t = n.parent;
|
|
134
|
-
for (; t; )
|
|
135
|
-
e++, t = t.parent;
|
|
136
|
-
return e;
|
|
137
|
-
}
|
|
138
|
-
class ae {
|
|
139
|
-
constructor() {
|
|
140
|
-
d(this, "participants", /* @__PURE__ */ new Map());
|
|
141
|
-
/** what a rollback has to put back beyond the state slots, newest last */
|
|
142
|
-
d(this, "undo", []);
|
|
143
|
-
/** true once the transaction has been unwound, which is what tells a run started inside it to say nothing */
|
|
144
|
-
d(this, "unwound", !1);
|
|
145
|
-
/** the depth the announcement in progress is working at, -1 while none is */
|
|
146
|
-
d(this, "passDepth", -1);
|
|
147
|
-
/** set while a pass is running and an element it has already passed the depth of gets enrolled */
|
|
148
|
-
d(this, "restartPass", !1);
|
|
97
|
+
return Ct;
|
|
149
98
|
}
|
|
99
|
+
execute(t, e, s, i) {
|
|
100
|
+
return super.execute(t, e, s, i);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const O = /* @__PURE__ */ Symbol("Transaction.capture"), St = /* @__PURE__ */ Symbol("Transaction.restore"), xt = /* @__PURE__ */ Symbol("Transaction.announceValue"), At = /* @__PURE__ */ Symbol("Transaction.settleValidity");
|
|
104
|
+
function ht(n) {
|
|
105
|
+
let t = 0, e = n.parent;
|
|
106
|
+
for (; e; )
|
|
107
|
+
t++, e = e.parent;
|
|
108
|
+
return t;
|
|
109
|
+
}
|
|
110
|
+
class Jt {
|
|
111
|
+
participants = /* @__PURE__ */ new Map();
|
|
112
|
+
/** what a rollback has to put back beyond the state slots, newest last */
|
|
113
|
+
undo = [];
|
|
114
|
+
/** what the commit has to do once the change stands, in the order it was handed in */
|
|
115
|
+
settled = [];
|
|
116
|
+
/** true once the transaction has been unwound, which is what tells a run started inside it to say nothing */
|
|
117
|
+
unwound = !1;
|
|
118
|
+
/** the depth the announcement in progress is working at, -1 while none is */
|
|
119
|
+
passDepth = -1;
|
|
120
|
+
/** set while a pass is running and an element it has already passed the depth of gets enrolled */
|
|
121
|
+
restartPass = !1;
|
|
150
122
|
/** true for a transaction that was rolled back rather than committed */
|
|
151
123
|
get rolledBack() {
|
|
152
124
|
return this.unwound;
|
|
153
125
|
}
|
|
154
|
-
participant(
|
|
155
|
-
let
|
|
156
|
-
return
|
|
126
|
+
participant(t) {
|
|
127
|
+
let e = this.participants.get(t);
|
|
128
|
+
return e || (e = { element: t, valueDirty: !1, forceValue: !1, validityDirty: !1 }, this.participants.set(t, e)), e;
|
|
157
129
|
}
|
|
158
130
|
/**
|
|
159
131
|
* Records the state of an element the first time the transaction modifies it. The whole of the mutable state
|
|
160
132
|
* goes into the snapshot rather than the part being written: a rollback that restored some of it would leave
|
|
161
133
|
* the element in a state the form never held.
|
|
162
134
|
*/
|
|
163
|
-
touch(
|
|
164
|
-
const
|
|
165
|
-
|
|
135
|
+
touch(t) {
|
|
136
|
+
const e = this.participant(t);
|
|
137
|
+
e.snapshot || (e.snapshot = t[O]());
|
|
166
138
|
}
|
|
167
139
|
/** Enrols an element as one whose value the commit has to announce. `force` skips the comparison. */
|
|
168
|
-
markValueChanged(
|
|
169
|
-
const s = this.participant(
|
|
170
|
-
s.valueDirty = !0,
|
|
140
|
+
markValueChanged(t, e) {
|
|
141
|
+
const s = this.participant(t);
|
|
142
|
+
s.valueDirty = !0, e && (s.forceValue = !0), this.noteDepth(t);
|
|
171
143
|
}
|
|
172
144
|
/** Enrols an element as one whose verdict the commit has to re-form. */
|
|
173
|
-
markValidityDirty(
|
|
174
|
-
this.participant(
|
|
145
|
+
markValidityDirty(t) {
|
|
146
|
+
this.participant(t).validityDirty = !0, this.noteDepth(t);
|
|
175
147
|
}
|
|
176
148
|
/**
|
|
177
149
|
* Queues an event that states an operation rather than a state. Added and removed items have no net over a
|
|
178
150
|
* transaction, so they are neither compared nor coalesced: the commit emits them in the order they happened.
|
|
179
151
|
*/
|
|
180
|
-
recordStructural(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
((i = s.structural) != null ? i : s.structural = []).push(t), this.noteDepth(e);
|
|
152
|
+
recordStructural(t, e) {
|
|
153
|
+
const s = this.participant(t);
|
|
154
|
+
(s.structural ??= []).push(e), this.noteDepth(t);
|
|
184
155
|
}
|
|
185
156
|
/** True where the commit still owes this element a value announcement. */
|
|
186
|
-
willAnnounceValue(
|
|
187
|
-
|
|
188
|
-
return (s = (t = this.participants.get(e)) == null ? void 0 : t.valueDirty) != null ? s : !1;
|
|
157
|
+
willAnnounceValue(t) {
|
|
158
|
+
return this.participants.get(t)?.valueDirty ?? !1;
|
|
189
159
|
}
|
|
190
160
|
/**
|
|
191
161
|
* Registers what a rollback has to put back beyond the element's state slots. The snapshot covers the slots,
|
|
192
162
|
* which is everything an ordinary write touches; an operation that replaces something else the element carries
|
|
193
163
|
* hands its own undo in here rather than making every snapshot carry the thing.
|
|
194
164
|
*/
|
|
195
|
-
whenRolledBack(
|
|
196
|
-
this.undo.push(
|
|
165
|
+
whenRolledBack(t) {
|
|
166
|
+
this.undo.push(t);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Registers work that runs once the transaction has committed, and not at all where it is rolled back. It is
|
|
170
|
+
* how an operation defers a step that cannot be taken back - cancelling work in flight, for one - until the
|
|
171
|
+
* change it belongs to actually stands.
|
|
172
|
+
*/
|
|
173
|
+
whenCommitted(t) {
|
|
174
|
+
this.settled.push(t);
|
|
197
175
|
}
|
|
198
176
|
/**
|
|
199
177
|
* Notes that an element at or below the depth the pass in progress is working at has been enrolled. The pass
|
|
@@ -202,8 +180,8 @@ class ae {
|
|
|
202
180
|
* whose composed value carries that write. The depth is only measured while a pass is running - outside one
|
|
203
181
|
* there is nothing the answer would change.
|
|
204
182
|
*/
|
|
205
|
-
noteDepth(
|
|
206
|
-
this.passDepth < 0 ||
|
|
183
|
+
noteDepth(t) {
|
|
184
|
+
this.passDepth < 0 || ht(t) >= this.passDepth && (this.restartPass = !0);
|
|
207
185
|
}
|
|
208
186
|
/**
|
|
209
187
|
* Puts every element the transaction modified back as it found it. Nothing is announced: from an observer's
|
|
@@ -211,11 +189,11 @@ class ae {
|
|
|
211
189
|
* that called a server during the transaction already did.
|
|
212
190
|
*/
|
|
213
191
|
rollback() {
|
|
214
|
-
this.unwound = !0, [...this.participants.values()].reverse().forEach((
|
|
215
|
-
|
|
192
|
+
this.unwound = !0, [...this.participants.values()].reverse().forEach((e) => {
|
|
193
|
+
e.snapshot && e.element[St](e.snapshot);
|
|
216
194
|
}), this.participants.clear();
|
|
217
|
-
for (let
|
|
218
|
-
this.undo.length = 0;
|
|
195
|
+
for (let e = this.undo.length - 1; e >= 0; e--) this.undo[e]();
|
|
196
|
+
this.undo.length = 0, this.settled.length = 0;
|
|
219
197
|
}
|
|
220
198
|
/**
|
|
221
199
|
* Announces what the transaction did. Values first and verdicts after, because a container's validators run
|
|
@@ -228,6 +206,8 @@ class ae {
|
|
|
228
206
|
commit() {
|
|
229
207
|
for (; !(!this.announceValues() && !this.settleValidity()); )
|
|
230
208
|
;
|
|
209
|
+
for (let t = 0; t < this.settled.length; t++) this.settled[t]();
|
|
210
|
+
this.settled.length = 0;
|
|
231
211
|
}
|
|
232
212
|
/**
|
|
233
213
|
* The dirty participants a pass has to visit, one bucket per nesting depth; ties keep the order they were
|
|
@@ -235,14 +215,13 @@ class ae {
|
|
|
235
215
|
* comparison sort: a whole-list assignment enrols one participant per field, and ordering those by comparison
|
|
236
216
|
* would cost more than the announcement it orders.
|
|
237
217
|
*/
|
|
238
|
-
buckets(
|
|
239
|
-
const
|
|
218
|
+
buckets(t) {
|
|
219
|
+
const e = [];
|
|
240
220
|
return this.participants.forEach((s) => {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}), t;
|
|
221
|
+
if (!t(s)) return;
|
|
222
|
+
const i = ht(s.element);
|
|
223
|
+
(e[i] ??= []).push(s);
|
|
224
|
+
}), e;
|
|
246
225
|
}
|
|
247
226
|
/**
|
|
248
227
|
* Runs one pass over the dirty participants, deepest bucket first; the caller repeats it until it answers
|
|
@@ -250,8 +229,8 @@ class ae {
|
|
|
250
229
|
* the depth being drained: that element is not in the bucket being walked, and going on would reach the
|
|
251
230
|
* containers above it first. The caller's next pass takes fresh buckets and finds it at its own depth.
|
|
252
231
|
*/
|
|
253
|
-
pass(
|
|
254
|
-
const s = this.buckets(
|
|
232
|
+
pass(t, e) {
|
|
233
|
+
const s = this.buckets(t);
|
|
255
234
|
if (!s.length) return !1;
|
|
256
235
|
for (let i = s.length - 1; i >= 0; i--) {
|
|
257
236
|
const r = s[i];
|
|
@@ -261,7 +240,7 @@ class ae {
|
|
|
261
240
|
for (let a = 0; a < r.length; a++) {
|
|
262
241
|
if (this.restartPass) return !0;
|
|
263
242
|
const o = r[a];
|
|
264
|
-
|
|
243
|
+
t(o) && e(o);
|
|
265
244
|
}
|
|
266
245
|
} finally {
|
|
267
246
|
this.passDepth = -1;
|
|
@@ -273,34 +252,32 @@ class ae {
|
|
|
273
252
|
}
|
|
274
253
|
announceValues() {
|
|
275
254
|
return this.pass(
|
|
276
|
-
(
|
|
277
|
-
(
|
|
278
|
-
const { structural:
|
|
279
|
-
|
|
255
|
+
(t) => t.valueDirty || t.structural !== void 0,
|
|
256
|
+
(t) => {
|
|
257
|
+
const { structural: e } = t, s = t.valueDirty, i = t.forceValue;
|
|
258
|
+
t.structural = void 0, t.valueDirty = !1, t.forceValue = !1, t.element[xt](this, s, i, e);
|
|
280
259
|
}
|
|
281
260
|
);
|
|
282
261
|
}
|
|
283
262
|
settleValidity() {
|
|
284
263
|
return this.pass(
|
|
285
|
-
(
|
|
286
|
-
(
|
|
287
|
-
|
|
264
|
+
(t) => t.validityDirty,
|
|
265
|
+
(t) => {
|
|
266
|
+
t.validityDirty = !1, t.element[At](this);
|
|
288
267
|
}
|
|
289
268
|
);
|
|
290
269
|
}
|
|
291
270
|
}
|
|
292
|
-
let
|
|
293
|
-
function
|
|
294
|
-
return
|
|
271
|
+
let S, H;
|
|
272
|
+
function It() {
|
|
273
|
+
return S;
|
|
295
274
|
}
|
|
296
|
-
class
|
|
275
|
+
class Tt {
|
|
297
276
|
}
|
|
298
|
-
class
|
|
299
|
-
|
|
300
|
-
d(this, "open", !0);
|
|
301
|
-
}
|
|
277
|
+
class Zt {
|
|
278
|
+
open = !0;
|
|
302
279
|
rollback() {
|
|
303
|
-
throw this.open ? new
|
|
280
|
+
throw this.open ? new Tt() : new TypeError(
|
|
304
281
|
"this transaction handle is spent: the transaction that handed it out has closed. A handle is only usable inside the call that received it."
|
|
305
282
|
);
|
|
306
283
|
}
|
|
@@ -308,60 +285,81 @@ class oe {
|
|
|
308
285
|
this.open = !1;
|
|
309
286
|
}
|
|
310
287
|
}
|
|
311
|
-
function
|
|
288
|
+
function dt(n) {
|
|
312
289
|
if (n != null && typeof n.then == "function")
|
|
313
290
|
throw new TypeError(
|
|
314
291
|
"a transaction may not be asynchronous: the callback returned a thenable. Do the awaiting outside and open a transaction for each synchronous part."
|
|
315
292
|
);
|
|
316
293
|
}
|
|
317
|
-
function
|
|
318
|
-
if (
|
|
319
|
-
const s = n(
|
|
320
|
-
return
|
|
294
|
+
function Z(n) {
|
|
295
|
+
if (S) {
|
|
296
|
+
const s = n(H);
|
|
297
|
+
return dt(s), s;
|
|
321
298
|
}
|
|
322
|
-
const
|
|
323
|
-
|
|
299
|
+
const t = new Jt(), e = new Zt();
|
|
300
|
+
S = t, H = e;
|
|
324
301
|
try {
|
|
325
|
-
const s = n(
|
|
326
|
-
return
|
|
302
|
+
const s = n(e);
|
|
303
|
+
return dt(s), t.commit(), s;
|
|
327
304
|
} catch (s) {
|
|
328
|
-
if (
|
|
305
|
+
if (t.rollback(), s instanceof Tt) return;
|
|
329
306
|
throw s;
|
|
330
307
|
} finally {
|
|
331
|
-
|
|
308
|
+
S = void 0, H = void 0, e.close();
|
|
332
309
|
}
|
|
333
310
|
}
|
|
334
|
-
function
|
|
335
|
-
return
|
|
311
|
+
function u(n) {
|
|
312
|
+
return S ? n(S) : Z(() => n(S));
|
|
336
313
|
}
|
|
337
|
-
const
|
|
338
|
-
function
|
|
339
|
-
return
|
|
314
|
+
const Ot = { useMarkdownInValidators: !0 };
|
|
315
|
+
function Gt() {
|
|
316
|
+
return Ot;
|
|
340
317
|
}
|
|
341
|
-
function
|
|
342
|
-
Object.assign(
|
|
318
|
+
function te(n) {
|
|
319
|
+
Object.assign(Ot, n);
|
|
343
320
|
}
|
|
344
|
-
const
|
|
345
|
-
install(n,
|
|
346
|
-
|
|
321
|
+
const Ue = {
|
|
322
|
+
install(n, t) {
|
|
323
|
+
t && te(t);
|
|
347
324
|
}
|
|
348
325
|
};
|
|
349
|
-
class
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
this.plugins = i, this.options = s;
|
|
326
|
+
class j extends String {
|
|
327
|
+
plugins;
|
|
328
|
+
options;
|
|
329
|
+
constructor(t, e, s) {
|
|
330
|
+
super(t), this.plugins = s, this.options = e;
|
|
355
331
|
}
|
|
356
332
|
}
|
|
357
|
-
function
|
|
358
|
-
const
|
|
359
|
-
return typeof
|
|
333
|
+
function G(n) {
|
|
334
|
+
const t = h(n);
|
|
335
|
+
return typeof t == "object" && t !== null && "componentName" in t;
|
|
360
336
|
}
|
|
361
|
-
function
|
|
362
|
-
return typeof
|
|
337
|
+
function L(n) {
|
|
338
|
+
return typeof h(n) == "function";
|
|
363
339
|
}
|
|
364
|
-
class
|
|
340
|
+
class tt {
|
|
341
|
+
/**
|
|
342
|
+
* Machine-readable identifier of what failed, in kebab-case. Every validator this library ships states one, so
|
|
343
|
+
* code that reacts to a particular failure does not have to match the message text, which is translated and
|
|
344
|
+
* configurable. It is optional: an error built by hand carries whatever its author gives it, or nothing.
|
|
345
|
+
*/
|
|
346
|
+
constructor(t) {
|
|
347
|
+
this.code = t;
|
|
348
|
+
}
|
|
349
|
+
code;
|
|
350
|
+
/**
|
|
351
|
+
* True where `other` is an error of this class that renders exactly as this one does and reports the same code.
|
|
352
|
+
* Two runs of one validator over an unchanged value produce two instances of one message, and this is what lets
|
|
353
|
+
* the validator hand the field back the instance it already holds rather than a fresh one: an equal error is not
|
|
354
|
+
* a new error, and nothing re-renders over a verdict that did not move.
|
|
355
|
+
*
|
|
356
|
+
* The comparison is over what renders - the component, its bindings, its body and the classes - because that is
|
|
357
|
+
* what a reader of `field.errors` sees. A structural comparison of the errors themselves answers nothing useful:
|
|
358
|
+
* `ValidationErrorRenderContent` holds a Vue `computed`, and two of those are never structurally equal.
|
|
359
|
+
*/
|
|
360
|
+
sameAs(t) {
|
|
361
|
+
return Object.getPrototypeOf(this) === Object.getPrototypeOf(t) && this.code === t.code && this.componentName === t.componentName && R(this.componentBody, t.componentBody) && R(this.componentBindings, t.componentBindings) && R(this.extraClasses, t.extraClasses);
|
|
362
|
+
}
|
|
365
363
|
get componentName() {
|
|
366
364
|
return "Comment";
|
|
367
365
|
}
|
|
@@ -375,13 +373,12 @@ class ot {
|
|
|
375
373
|
return "";
|
|
376
374
|
}
|
|
377
375
|
}
|
|
378
|
-
class
|
|
379
|
-
constructor(t,
|
|
380
|
-
super();
|
|
381
|
-
d(this, "text");
|
|
382
|
-
d(this, "classes");
|
|
383
|
-
this.text = t, this.classes = s;
|
|
376
|
+
class ee extends tt {
|
|
377
|
+
constructor(t, e = "", s) {
|
|
378
|
+
super(s), this.text = t, this.classes = e;
|
|
384
379
|
}
|
|
380
|
+
text;
|
|
381
|
+
classes;
|
|
385
382
|
get componentName() {
|
|
386
383
|
return "template";
|
|
387
384
|
}
|
|
@@ -392,24 +389,23 @@ class ce extends ot {
|
|
|
392
389
|
return this.classes;
|
|
393
390
|
}
|
|
394
391
|
}
|
|
395
|
-
class
|
|
396
|
-
constructor(t,
|
|
397
|
-
super();
|
|
398
|
-
d(this, "classes");
|
|
399
|
-
d(this, "text");
|
|
400
|
-
d(this, "textType");
|
|
401
|
-
this.classes = s, this.text = t, this.textType = Tt(() => this.getTextType);
|
|
392
|
+
class g extends tt {
|
|
393
|
+
constructor(t, e = "", s) {
|
|
394
|
+
super(s), this.classes = e, this.text = t, this.textType = Y(() => this.getTextType);
|
|
402
395
|
}
|
|
396
|
+
classes;
|
|
397
|
+
text;
|
|
398
|
+
textType;
|
|
403
399
|
get resolvedText() {
|
|
404
|
-
const t =
|
|
405
|
-
return
|
|
400
|
+
const t = h(this.text);
|
|
401
|
+
return L(t) ? t() : t;
|
|
406
402
|
}
|
|
407
403
|
get getTextType() {
|
|
408
404
|
const t = this.resolvedText;
|
|
409
|
-
return t ? t instanceof
|
|
405
|
+
return t ? t instanceof j ? "md" : G(t) ? "component" : "string" : "string";
|
|
410
406
|
}
|
|
411
407
|
get componentName() {
|
|
412
|
-
switch (
|
|
408
|
+
switch (h(this.textType)) {
|
|
413
409
|
case "string":
|
|
414
410
|
return "template";
|
|
415
411
|
case "md":
|
|
@@ -421,7 +417,7 @@ class V extends ot {
|
|
|
421
417
|
}
|
|
422
418
|
}
|
|
423
419
|
get componentBindings() {
|
|
424
|
-
switch (
|
|
420
|
+
switch (h(this.textType)) {
|
|
425
421
|
case "string":
|
|
426
422
|
return {};
|
|
427
423
|
case "md": {
|
|
@@ -435,7 +431,7 @@ class V extends ot {
|
|
|
435
431
|
}
|
|
436
432
|
}
|
|
437
433
|
get componentBody() {
|
|
438
|
-
switch (
|
|
434
|
+
switch (h(this.textType)) {
|
|
439
435
|
case "string":
|
|
440
436
|
return this.resolvedText;
|
|
441
437
|
case "component":
|
|
@@ -448,43 +444,50 @@ class V extends ot {
|
|
|
448
444
|
return this.classes;
|
|
449
445
|
}
|
|
450
446
|
}
|
|
451
|
-
class
|
|
447
|
+
class se extends g {
|
|
452
448
|
}
|
|
453
|
-
function
|
|
454
|
-
return
|
|
449
|
+
function b(n) {
|
|
450
|
+
return Gt().useMarkdownInValidators ? new j(n) : n.replace(/[*_~`]/g, "").replace(/!\[(.*?)\]\(.*?\)/g, "$1").replace(/\[(.*?)\]\((.*?)\)/g, "$1").replace(/#+\s?/g, "").replace(/>\s?/g, "").replace(/(\*|-|\d+\.)\s+/g, "").replace(/`{3}[\s\S]*?`{3}/g, "").replace(/`([^`]+)`/g, "$1").replace(/\n{2,}/g, `
|
|
455
451
|
`);
|
|
456
452
|
}
|
|
457
|
-
const
|
|
458
|
-
class
|
|
453
|
+
const ie = /* @__PURE__ */ Symbol("Validator"), ne = () => b("Validation could not be completed");
|
|
454
|
+
class f extends T {
|
|
455
|
+
source;
|
|
459
456
|
/**
|
|
460
457
|
* Creates a new validator
|
|
461
458
|
* @param validationFn Function that validates the field value and returns errors or null
|
|
462
459
|
*/
|
|
463
460
|
constructor(t) {
|
|
464
|
-
|
|
465
|
-
const
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
461
|
+
const e = (s, i, r, a) => {
|
|
462
|
+
const o = this.bindingState(s), l = o.abandon, v = ++o.run, p = s.validationEpoch, nt = It();
|
|
463
|
+
let rt = !1;
|
|
464
|
+
const $ = () => !rt && o.run === v && s.validationEpoch === p && !nt?.rolledBack, at = new AbortController(), B = () => {
|
|
465
|
+
$() || (rt = !0, o.abandon === B && (o.abandon = void 0), at.abort());
|
|
466
|
+
};
|
|
467
|
+
l?.();
|
|
468
|
+
const W = t(r, a, s, at.signal) || [], q = (E) => Z(() => {
|
|
469
|
+
const D = E?.map((A) => this.claim(A)) ?? [];
|
|
470
|
+
for (let A = s.errors.length - 1; A >= 0; A--) {
|
|
471
|
+
const ot = s.errors[A];
|
|
472
|
+
if (ot.source === this.source) {
|
|
473
|
+
const lt = D.findIndex((Mt) => Mt.sameAs(ot));
|
|
474
|
+
lt >= 0 ? D.splice(lt, 1) : s.errors.splice(A, 1);
|
|
473
475
|
}
|
|
474
476
|
}
|
|
475
|
-
|
|
477
|
+
D.length > 0 && s.errors.push(...D), s.validate();
|
|
476
478
|
});
|
|
477
|
-
return
|
|
478
|
-
(
|
|
479
|
-
|
|
479
|
+
return W instanceof Promise ? (o.abandon = B, nt?.whenRolledBack(B), s.beginValidating(), W.then(
|
|
480
|
+
(E) => {
|
|
481
|
+
$() && q(E);
|
|
480
482
|
},
|
|
481
|
-
(
|
|
482
|
-
|
|
483
|
+
(E) => {
|
|
484
|
+
$() && (q([new g(ne(), "", "validation-failed")]), console.error("Validation failed", E));
|
|
483
485
|
}
|
|
484
|
-
).finally(() =>
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
486
|
+
).finally(() => {
|
|
487
|
+
o.abandon === B && (o.abandon = void 0), s.endValidating();
|
|
488
|
+
}).catch((E) => console.error("Validation failed", E))) : q(W), i(s, r, a);
|
|
489
|
+
};
|
|
490
|
+
super(e), this.source = Symbol(this.constructor.name);
|
|
488
491
|
}
|
|
489
492
|
/**
|
|
490
493
|
* Returns the error instance this validator owns and may later withdraw: the argument itself when it carries no
|
|
@@ -494,16 +497,16 @@ class v extends O {
|
|
|
494
497
|
* including the non-enumerable ones, so it renders exactly like the instance it was made from.
|
|
495
498
|
*/
|
|
496
499
|
claim(t) {
|
|
497
|
-
const
|
|
498
|
-
if (
|
|
499
|
-
const
|
|
500
|
-
if (
|
|
501
|
-
return Object.defineProperty(t, "source",
|
|
502
|
-
const
|
|
503
|
-
return Object.create(Object.getPrototypeOf(t),
|
|
500
|
+
const e = t.source;
|
|
501
|
+
if (e === this.source) return t;
|
|
502
|
+
const s = { value: this.source, enumerable: !1, configurable: !1 };
|
|
503
|
+
if (e === void 0)
|
|
504
|
+
return Object.defineProperty(t, "source", s), t;
|
|
505
|
+
const i = Object.getOwnPropertyDescriptors(t);
|
|
506
|
+
return Object.create(Object.getPrototypeOf(t), { ...i, source: s });
|
|
504
507
|
}
|
|
505
508
|
static get classIdentifier() {
|
|
506
|
-
return
|
|
509
|
+
return ie;
|
|
507
510
|
}
|
|
508
511
|
get eager() {
|
|
509
512
|
return !0;
|
|
@@ -512,14 +515,28 @@ class v extends O {
|
|
|
512
515
|
* Takes this validator off `field`: the errors it put there are withdrawn and the verdict is re-formed over what
|
|
513
516
|
* the validators the field still holds have to say. Withdrawing them is what keeps a field from staying invalid
|
|
514
517
|
* on an error no validator is left to take back.
|
|
518
|
+
*
|
|
519
|
+
* A run in flight over the field is cancelled once the removal stands, and not before: a transaction that
|
|
520
|
+
* unwinds puts the validator and its epoch back, and the run it never cancelled goes on to reach the verdict the
|
|
521
|
+
* field is then owed. Cancelling it as the removal is made would leave the field reporting itself valid over a
|
|
522
|
+
* value nothing checked, on the strength of a transaction that never happened.
|
|
515
523
|
*/
|
|
516
524
|
unregisterFrom(t) {
|
|
517
|
-
|
|
525
|
+
u((e) => {
|
|
526
|
+
e.whenCommitted(() => this.abandonRun(t));
|
|
518
527
|
for (let s = t.errors.length - 1; s >= 0; s--)
|
|
519
528
|
t.errors[s].source === this.source && t.errors.splice(s, 1);
|
|
520
529
|
t.validate();
|
|
521
530
|
});
|
|
522
531
|
}
|
|
532
|
+
/**
|
|
533
|
+
* Cancels the asynchronous run in flight over `field`, where there is one. It is called once the field has
|
|
534
|
+
* stopped holding this validator: the field's validation epoch has moved on by then, so the run's verdict is
|
|
535
|
+
* already dropped and the signal it handed its check aborts with it.
|
|
536
|
+
*/
|
|
537
|
+
abandonRun(t) {
|
|
538
|
+
this.bindingState(t).abandon?.();
|
|
539
|
+
}
|
|
523
540
|
/**
|
|
524
541
|
* What this validator remembers about one of the fields it validates. One instance may be registered on several
|
|
525
542
|
* fields - every row of a list carries the instances the item template carries - so each field has a record of
|
|
@@ -536,186 +553,194 @@ class v extends O {
|
|
|
536
553
|
newBindingState() {
|
|
537
554
|
return { run: 0 };
|
|
538
555
|
}
|
|
539
|
-
replacePlaceholdersFunction(t,
|
|
556
|
+
replacePlaceholdersFunction(t, e) {
|
|
540
557
|
return () => {
|
|
541
|
-
let
|
|
542
|
-
for (;
|
|
543
|
-
|
|
544
|
-
return
|
|
558
|
+
let s = h(t);
|
|
559
|
+
for (; L(s); )
|
|
560
|
+
s = h(this.replacePlaceholders(s(), e));
|
|
561
|
+
return s;
|
|
545
562
|
};
|
|
546
563
|
}
|
|
547
|
-
replacePlaceholders(t,
|
|
548
|
-
if (
|
|
549
|
-
if (
|
|
550
|
-
if (
|
|
551
|
-
return this.replacePlaceholdersFunction(() =>
|
|
552
|
-
let
|
|
553
|
-
return Object.keys(
|
|
554
|
-
|
|
555
|
-
}), t instanceof
|
|
564
|
+
replacePlaceholders(t, e) {
|
|
565
|
+
if (L(t)) return this.replacePlaceholdersFunction(t, e);
|
|
566
|
+
if (G(t)) return t;
|
|
567
|
+
if (Vt(t))
|
|
568
|
+
return this.replacePlaceholdersFunction(() => h(t), e);
|
|
569
|
+
let s = h(t);
|
|
570
|
+
return Object.keys(e).forEach((i) => {
|
|
571
|
+
s = s.replaceAll(`{${i}}`, e[i]);
|
|
572
|
+
}), t instanceof j ? new j(s.toString(), t.options, t.plugins) : s;
|
|
556
573
|
}
|
|
557
574
|
}
|
|
558
|
-
class
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
d(this, "eagerChains", /* @__PURE__ */ new Map());
|
|
566
|
-
}
|
|
575
|
+
class M {
|
|
576
|
+
/**
|
|
577
|
+
* Every action registered here, in registration order. It is replaced rather than written when an action is
|
|
578
|
+
* dropped, so a run already walking it finishes on the array it started with and the removal takes effect from
|
|
579
|
+
* the next trigger.
|
|
580
|
+
*/
|
|
581
|
+
actions = [];
|
|
567
582
|
/**
|
|
568
583
|
* Registers `action`. It becomes the outermost handler of its identifier, or - where `before` is given and is
|
|
569
584
|
* registered here under the same identifier - takes that action's place in the order, so `before` wraps it and
|
|
570
585
|
* reaches it through `supr`. That is what lets an action be added to a chain someone else built and still sit
|
|
571
586
|
* inside a handler already there.
|
|
572
587
|
*/
|
|
573
|
-
register(
|
|
574
|
-
if (!(
|
|
575
|
-
const s = e.
|
|
576
|
-
if (
|
|
588
|
+
register(t, e) {
|
|
589
|
+
if (!(t instanceof m)) throw new Error("Invalid action type");
|
|
590
|
+
const s = e ? this.actions.indexOf(e) : -1;
|
|
591
|
+
if (e && (e.classIdentifier !== t.classIdentifier || s < 0))
|
|
577
592
|
throw new Error("Action to register before is not registered under the same identifier");
|
|
578
|
-
this.
|
|
593
|
+
s < 0 ? this.actions.push(t) : this.actions.splice(s, 0, t);
|
|
579
594
|
}
|
|
580
|
-
/**
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
* the next trigger.
|
|
584
|
-
*/
|
|
585
|
-
unregister(e) {
|
|
586
|
-
const t = this.registeredActions.indexOf(e);
|
|
587
|
-
if (t < 0) return !1;
|
|
588
|
-
this.registeredActions.splice(t, 1);
|
|
589
|
-
const s = e.classIdentifier;
|
|
590
|
-
return this.remove(this.chains, s, e), this.remove(this.eagerChains, s, e), !0;
|
|
595
|
+
/** Drops `action` and answers whether it was registered here. */
|
|
596
|
+
unregister(t) {
|
|
597
|
+
return this.actions.includes(t) ? (this.actions = this.actions.filter((e) => e !== t), !0) : !1;
|
|
591
598
|
}
|
|
592
599
|
/** True where something is registered under `identifier`. */
|
|
593
|
-
willTrigger(
|
|
594
|
-
return this.
|
|
600
|
+
willTrigger(t) {
|
|
601
|
+
return this.actions.some((e) => e.classIdentifier === t);
|
|
595
602
|
}
|
|
596
603
|
/** True where any eager action is registered, whatever identifier it stands under. */
|
|
597
604
|
get hasEager() {
|
|
598
|
-
return this.
|
|
605
|
+
return this.actions.some((t) => t.eager);
|
|
599
606
|
}
|
|
600
607
|
/** Runs the actions registered under `ActionClass` and answers with what the outermost of them returned. */
|
|
601
|
-
trigger(
|
|
602
|
-
return this.run(
|
|
608
|
+
trigger(t, e, ...s) {
|
|
609
|
+
return this.run(t.classIdentifier, !1, e, s);
|
|
603
610
|
}
|
|
604
|
-
/**
|
|
605
|
-
|
|
606
|
-
|
|
611
|
+
/**
|
|
612
|
+
* Runs the eager actions of every identifier, each group on its own. A group is entered at its outermost eager
|
|
613
|
+
* action, which is the last one registered under that identifier.
|
|
614
|
+
*/
|
|
615
|
+
triggerEager(t, ...e) {
|
|
616
|
+
const s = this.actions;
|
|
617
|
+
for (let i = s.length - 1; i >= 0; i--) {
|
|
618
|
+
const r = s[i];
|
|
619
|
+
if (r.eager && M.outermostEager(s, i))
|
|
620
|
+
try {
|
|
621
|
+
this.walk(s, i, r.classIdentifier, !0, t, e);
|
|
622
|
+
} catch (a) {
|
|
623
|
+
if (!(a instanceof P)) throw a;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
607
626
|
}
|
|
608
627
|
/** Runs the eager actions registered under `identifier` and nothing else. */
|
|
609
|
-
triggerEagerFor(
|
|
610
|
-
return this.run(
|
|
628
|
+
triggerEagerFor(t, e, ...s) {
|
|
629
|
+
return this.run(t, !0, e, s);
|
|
611
630
|
}
|
|
612
|
-
/** the validators registered
|
|
631
|
+
/** the validators registered here, in registration order */
|
|
613
632
|
get validators() {
|
|
614
|
-
return this.
|
|
615
|
-
}
|
|
616
|
-
clone() {
|
|
617
|
-
const e = new H();
|
|
618
|
-
return this.registeredActions.forEach((t) => e.register(t)), e;
|
|
633
|
+
return this.actions.filter((t) => t instanceof f);
|
|
619
634
|
}
|
|
620
635
|
/**
|
|
621
|
-
* Tells every action
|
|
622
|
-
* the element
|
|
623
|
-
*
|
|
636
|
+
* Tells every action here that it serves `owner`. A binding reads the map its declaration holds, so this is what
|
|
637
|
+
* announces the new element to the actions already in it - the way registering an action announces the elements
|
|
638
|
+
* it comes to serve.
|
|
624
639
|
*/
|
|
625
|
-
bindTo(
|
|
626
|
-
this.
|
|
640
|
+
bindTo(t) {
|
|
641
|
+
this.actions.forEach((e) => e.boundToBinding(t));
|
|
642
|
+
}
|
|
643
|
+
/** True where no eager action of `identifier` stands after `index`, which makes `index` the group's entry. */
|
|
644
|
+
static outermostEager(t, e) {
|
|
645
|
+
const s = t[e].classIdentifier;
|
|
646
|
+
for (let i = t.length - 1; i > e; i--)
|
|
647
|
+
if (t[i].eager && t[i].classIdentifier === s) return !1;
|
|
648
|
+
return !0;
|
|
627
649
|
}
|
|
628
650
|
/**
|
|
629
|
-
*
|
|
630
|
-
*
|
|
631
|
-
*
|
|
651
|
+
* Enters a group at its outermost action. An abort ends the run and is answered with rather than raised: the
|
|
652
|
+
* exception is what the caller receives, so a run a handler ended is told apart from one that reached no handler
|
|
653
|
+
* and from one whose handler answered null.
|
|
632
654
|
*/
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
const r = (a, ...o) => this.step(e, t - 1, a, o);
|
|
636
|
-
return e[t].execute(s, r, ...i);
|
|
637
|
-
}
|
|
638
|
-
/** Walks a chain, answering null where there is none. An abort ends the run and is not an error to the caller. */
|
|
639
|
-
run(e, t, s) {
|
|
640
|
-
if (!e) return null;
|
|
655
|
+
run(t, e, s, i) {
|
|
656
|
+
const r = this.actions;
|
|
641
657
|
try {
|
|
642
|
-
return this.
|
|
643
|
-
} catch (
|
|
644
|
-
if (
|
|
658
|
+
return this.walk(r, r.length - 1, t, e, s, i);
|
|
659
|
+
} catch (a) {
|
|
660
|
+
if (a instanceof P) return a;
|
|
661
|
+
throw a;
|
|
645
662
|
}
|
|
646
|
-
return null;
|
|
647
663
|
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
664
|
+
/**
|
|
665
|
+
* Walks from `index` backwards to the first action of `identifier`, handing it a `supr` that continues at the one
|
|
666
|
+
* before it. The actions registered under other identifiers are passed over, so the array needs no grouping of
|
|
667
|
+
* its own; the closures exist for the length of the run and only as deep as the run actually goes.
|
|
668
|
+
*/
|
|
669
|
+
walk(t, e, s, i, r, a) {
|
|
670
|
+
let o = e;
|
|
671
|
+
for (; o >= 0 && (t[o].classIdentifier !== s || i && !t[o].eager); ) o--;
|
|
672
|
+
if (o < 0) return null;
|
|
673
|
+
const l = (v, ...p) => this.walk(t, o - 1, s, i, v, p);
|
|
674
|
+
return t[o].execute(r, l, ...a);
|
|
658
675
|
}
|
|
659
676
|
}
|
|
660
|
-
function
|
|
677
|
+
function V(n) {
|
|
678
|
+
let t = n;
|
|
679
|
+
for (; t.fieldName !== void 0 && t.parent; ) t = t.parent;
|
|
680
|
+
return t;
|
|
681
|
+
}
|
|
682
|
+
function gt(n, t) {
|
|
661
683
|
let e = n;
|
|
662
|
-
for (
|
|
663
|
-
|
|
684
|
+
for (const s of re(t))
|
|
685
|
+
if (e = e.field?.(s) ?? void 0, !e) return;
|
|
686
|
+
return e?.declaration === t ? e : void 0;
|
|
664
687
|
}
|
|
665
|
-
function
|
|
666
|
-
const
|
|
667
|
-
let
|
|
668
|
-
for (;
|
|
669
|
-
|
|
670
|
-
return
|
|
671
|
-
}
|
|
672
|
-
function lt(n, e) {
|
|
673
|
-
var s, i;
|
|
674
|
-
let t = e;
|
|
675
|
-
for (const r of fe(n))
|
|
676
|
-
if (t = (i = (s = t.field) == null ? void 0 : s.call(t, r)) != null ? i : void 0, !t) break;
|
|
677
|
-
return (t == null ? void 0 : t.declaration) === n ? t : T(n) === T(e.declaration) ? void 0 : n;
|
|
678
|
-
}
|
|
679
|
-
function Lt(n, e) {
|
|
680
|
-
const t = lt(n, e);
|
|
681
|
-
if (!t) return [];
|
|
682
|
-
if (t !== n) return [t];
|
|
683
|
-
const s = e.bindingsOf(n);
|
|
684
|
-
return s.length > 0 ? s : [n];
|
|
688
|
+
function re(n) {
|
|
689
|
+
const t = [];
|
|
690
|
+
let e = n;
|
|
691
|
+
for (; e.fieldName !== void 0 && e.parent; )
|
|
692
|
+
t.unshift(e.fieldName), e = e.parent;
|
|
693
|
+
return t;
|
|
685
694
|
}
|
|
686
|
-
function
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
695
|
+
function et(n, t) {
|
|
696
|
+
const e = gt(t, n);
|
|
697
|
+
if (e) return e;
|
|
698
|
+
let s = t.parent;
|
|
699
|
+
for (; s; ) {
|
|
700
|
+
const i = gt(V(s), n);
|
|
691
701
|
if (i) return i;
|
|
692
|
-
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
702
|
+
s = s.parent;
|
|
703
|
+
}
|
|
704
|
+
return V(n) === V(t.declaration) ? void 0 : n;
|
|
705
|
+
}
|
|
706
|
+
function kt(n, t) {
|
|
707
|
+
const e = et(n, t);
|
|
708
|
+
if (!e) return [];
|
|
709
|
+
if (e !== n) return [e];
|
|
710
|
+
const s = t.bindingsOf(n);
|
|
711
|
+
return s.length > 0 ? s : [n];
|
|
712
|
+
}
|
|
713
|
+
function ae(n, t) {
|
|
714
|
+
let e = t.parent;
|
|
715
|
+
for (; e; ) {
|
|
716
|
+
const s = e.field?.(n);
|
|
717
|
+
if (s) return s;
|
|
718
|
+
e = e.parent;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
const oe = /* @__PURE__ */ Symbol("ConditionalStatementAction");
|
|
722
|
+
class U extends T {
|
|
723
|
+
statement;
|
|
724
|
+
conditionalExecutor;
|
|
725
|
+
/**
|
|
726
|
+
* What the elements this action was registered on were declared as. It holds declarations rather than the
|
|
727
|
+
* elements themselves, so one entry stands for every row of a list, and the element a result is applied to is
|
|
728
|
+
* the one that declaration names within the record the change happened in.
|
|
729
|
+
*/
|
|
730
|
+
declarations = /* @__PURE__ */ new Set();
|
|
731
|
+
/**
|
|
732
|
+
* The elements this action was registered on. Registration reaches one element at a time - the rows of a list
|
|
733
|
+
* take the action on one by one, as they are built from the item template that carries it - so this is what
|
|
734
|
+
* says which of the elements a declaration stands for the action actually drives.
|
|
735
|
+
*/
|
|
736
|
+
registrations = /* @__PURE__ */ new WeakSet();
|
|
737
|
+
constructor(t, e) {
|
|
738
|
+
super((i, r, a, o) => (this.applyIn(V(i)) || i.markRecordIncomplete(), r(i, a, o))), this.statement = t, this.conditionalExecutor = e;
|
|
739
|
+
const s = new T((i, r, ...a) => (this.applyFrom(i), r(i, ...a)));
|
|
740
|
+
t.collectFields().forEach((i) => i.registerAction(s));
|
|
716
741
|
}
|
|
717
742
|
static get classIdentifier() {
|
|
718
|
-
return
|
|
743
|
+
return oe;
|
|
719
744
|
}
|
|
720
745
|
get eager() {
|
|
721
746
|
return !0;
|
|
@@ -731,12 +756,12 @@ class Q extends O {
|
|
|
731
756
|
* those the ones that took the action on. A row of a list that never took it on is not one this action drives.
|
|
732
757
|
*/
|
|
733
758
|
targetsIn(t) {
|
|
734
|
-
const
|
|
759
|
+
const e = [];
|
|
735
760
|
return this.declarations.forEach(
|
|
736
|
-
(
|
|
737
|
-
this.registrations.has(
|
|
761
|
+
(s) => kt(s, t).forEach((i) => {
|
|
762
|
+
this.registrations.has(i) && e.push(i);
|
|
738
763
|
})
|
|
739
|
-
),
|
|
764
|
+
), e;
|
|
740
765
|
}
|
|
741
766
|
/**
|
|
742
767
|
* Re-evaluates the statement over one record and applies the result where it changed. The result is recorded
|
|
@@ -745,12 +770,12 @@ class Q extends O {
|
|
|
745
770
|
* this action to drive, which is how a caller learns that the record is not assembled yet.
|
|
746
771
|
*/
|
|
747
772
|
applyIn(t) {
|
|
748
|
-
const
|
|
749
|
-
if (
|
|
750
|
-
const
|
|
751
|
-
if (
|
|
752
|
-
const
|
|
753
|
-
return
|
|
773
|
+
const e = this.targetsIn(t);
|
|
774
|
+
if (e.length === 0) return !1;
|
|
775
|
+
const s = this.state(t, () => ({ lastResult: void 0 })), i = this.statement.evaluate(t);
|
|
776
|
+
if (i === s.lastResult) return !0;
|
|
777
|
+
const r = s.lastResult;
|
|
778
|
+
return s.lastResult = i, e.forEach((a) => this.conditionalExecutor(a, i, r)), !0;
|
|
754
779
|
}
|
|
755
780
|
/**
|
|
756
781
|
* Re-evaluates the records a change of `source` speaks for. A field of the record the targets live in speaks for
|
|
@@ -759,34 +784,34 @@ class Q extends O {
|
|
|
759
784
|
* where the change reaches none.
|
|
760
785
|
*/
|
|
761
786
|
applyFrom(t) {
|
|
762
|
-
const
|
|
763
|
-
this.targetsIn(
|
|
787
|
+
const e = /* @__PURE__ */ new Set();
|
|
788
|
+
this.targetsIn(V(t)).forEach((s) => e.add(V(s))), e.forEach((s) => this.applyIn(s));
|
|
764
789
|
}
|
|
765
790
|
}
|
|
766
|
-
class
|
|
767
|
-
constructor(
|
|
768
|
-
super(
|
|
769
|
-
|
|
791
|
+
class le extends U {
|
|
792
|
+
constructor(t) {
|
|
793
|
+
super(t, (e, s) => {
|
|
794
|
+
e.visibility = s ? I.FULL : I.SUPPRESS;
|
|
770
795
|
});
|
|
771
796
|
}
|
|
772
797
|
}
|
|
773
|
-
class
|
|
774
|
-
constructor(
|
|
775
|
-
super(
|
|
776
|
-
|
|
798
|
+
class ue extends U {
|
|
799
|
+
constructor(t) {
|
|
800
|
+
super(t, (e, s) => {
|
|
801
|
+
e.enabled = s;
|
|
777
802
|
});
|
|
778
803
|
}
|
|
779
804
|
}
|
|
780
|
-
class
|
|
781
|
-
constructor(
|
|
782
|
-
super(
|
|
783
|
-
i && (s.value =
|
|
805
|
+
class ce extends U {
|
|
806
|
+
constructor(t, e) {
|
|
807
|
+
super(t, (s, i) => {
|
|
808
|
+
i && (s.value = e);
|
|
784
809
|
});
|
|
785
810
|
}
|
|
786
811
|
}
|
|
787
|
-
var
|
|
812
|
+
var N = /* @__PURE__ */ ((n) => (n[n.NOT = 0] = "NOT", n[n.OR = 1] = "OR", n[n.AND = 2] = "AND", n[n.XOR = 3] = "XOR", n[n.NAND = 4] = "NAND", n[n.NOR = 5] = "NOR", n[n.EQUALS = -1] = "EQUALS", n[n.NOT_EQUALS = -2] = "NOT_EQUALS", n[n.GT = -3] = "GT", n[n.LT = -4] = "LT", n[n.GE = -5] = "GE", n[n.LE = -6] = "LE", n[n.IN = -7] = "IN", n[n.NOT_IN = -8] = "NOT_IN", n[n.INCLUDES = -9] = "INCLUDES", n[n.NOT_INCLUDES = -10] = "NOT_INCLUDES", n))(N || {});
|
|
788
813
|
((n) => {
|
|
789
|
-
function
|
|
814
|
+
function t(r) {
|
|
790
815
|
const a = r.toLowerCase();
|
|
791
816
|
if (a === "not") return 0;
|
|
792
817
|
if (a === "or") return 1;
|
|
@@ -806,13 +831,13 @@ var M = /* @__PURE__ */ ((n) => (n[n.NOT = 0] = "NOT", n[n.OR = 1] = "OR", n[n.A
|
|
|
806
831
|
if (["not_includes", "not-includes", "not includes"].includes(a)) return -10;
|
|
807
832
|
throw new Error(`Unrecognised operator ${a}`);
|
|
808
833
|
}
|
|
809
|
-
n.fromString =
|
|
810
|
-
function
|
|
834
|
+
n.fromString = t;
|
|
835
|
+
function e(r) {
|
|
811
836
|
const a = typeof r == "number" ? r : n.fromString(r);
|
|
812
837
|
if (Object.values(n).includes(a)) return a;
|
|
813
838
|
throw new Error(`Unrecognised operator ${r}`);
|
|
814
839
|
}
|
|
815
|
-
n.fromAny =
|
|
840
|
+
n.fromAny = e;
|
|
816
841
|
function s(r) {
|
|
817
842
|
const a = typeof r == "number" ? r : n.fromString(r);
|
|
818
843
|
return Object.values(n).includes(a);
|
|
@@ -822,85 +847,71 @@ var M = /* @__PURE__ */ ((n) => (n[n.NOT = 0] = "NOT", n[n.OR = 1] = "OR", n[n.A
|
|
|
822
847
|
return r >= 0;
|
|
823
848
|
}
|
|
824
849
|
n.isLogicOperator = i;
|
|
825
|
-
})(
|
|
826
|
-
Object.freeze(
|
|
827
|
-
const
|
|
828
|
-
class
|
|
829
|
-
constructor(
|
|
830
|
-
super(
|
|
850
|
+
})(N || (N = {}));
|
|
851
|
+
Object.freeze(N);
|
|
852
|
+
const c = N, he = /* @__PURE__ */ Symbol("EnabledChangingAction");
|
|
853
|
+
class Rt extends m {
|
|
854
|
+
constructor(t) {
|
|
855
|
+
super(t);
|
|
831
856
|
}
|
|
832
857
|
static get classIdentifier() {
|
|
833
|
-
return
|
|
858
|
+
return he;
|
|
834
859
|
}
|
|
835
|
-
execute(
|
|
836
|
-
return super.execute(
|
|
860
|
+
execute(t, e, s, i) {
|
|
861
|
+
return super.execute(t, e, s, i);
|
|
837
862
|
}
|
|
838
863
|
}
|
|
839
|
-
const
|
|
840
|
-
class
|
|
841
|
-
constructor(
|
|
842
|
-
super(
|
|
864
|
+
const de = /* @__PURE__ */ Symbol("EnabledChangedAction");
|
|
865
|
+
class Ft extends m {
|
|
866
|
+
constructor(t) {
|
|
867
|
+
super(t);
|
|
843
868
|
}
|
|
844
869
|
static get classIdentifier() {
|
|
845
|
-
return
|
|
870
|
+
return de;
|
|
846
871
|
}
|
|
847
|
-
execute(
|
|
848
|
-
return super.execute(
|
|
872
|
+
execute(t, e, s, i) {
|
|
873
|
+
return super.execute(t, e, s, i);
|
|
849
874
|
}
|
|
850
875
|
}
|
|
851
|
-
const
|
|
852
|
-
class
|
|
853
|
-
constructor(
|
|
854
|
-
super(
|
|
876
|
+
const ge = /* @__PURE__ */ Symbol("ValidChangedAction");
|
|
877
|
+
class _t extends m {
|
|
878
|
+
constructor(t) {
|
|
879
|
+
super(t);
|
|
855
880
|
}
|
|
856
881
|
static get classIdentifier() {
|
|
857
|
-
return
|
|
882
|
+
return ge;
|
|
858
883
|
}
|
|
859
|
-
execute(
|
|
860
|
-
return super.execute(
|
|
884
|
+
execute(t, e, s, i) {
|
|
885
|
+
return super.execute(t, e, s, i);
|
|
861
886
|
}
|
|
862
887
|
}
|
|
863
|
-
const
|
|
864
|
-
class
|
|
865
|
-
constructor(
|
|
866
|
-
super(
|
|
888
|
+
const fe = /* @__PURE__ */ Symbol("VisibilityChangingAction");
|
|
889
|
+
class Pt extends m {
|
|
890
|
+
constructor(t) {
|
|
891
|
+
super(t);
|
|
867
892
|
}
|
|
868
893
|
static get classIdentifier() {
|
|
869
|
-
return
|
|
894
|
+
return fe;
|
|
870
895
|
}
|
|
871
|
-
execute(
|
|
872
|
-
return super.execute(
|
|
896
|
+
execute(t, e, s, i) {
|
|
897
|
+
return super.execute(t, e, s, i);
|
|
873
898
|
}
|
|
874
899
|
}
|
|
875
|
-
const
|
|
876
|
-
class
|
|
877
|
-
constructor(
|
|
878
|
-
super(
|
|
900
|
+
const pe = /* @__PURE__ */ Symbol("VisibilityChangedAction");
|
|
901
|
+
class jt extends m {
|
|
902
|
+
constructor(t) {
|
|
903
|
+
super(t);
|
|
879
904
|
}
|
|
880
905
|
static get classIdentifier() {
|
|
881
|
-
return
|
|
882
|
-
}
|
|
883
|
-
execute(e, t, s, i) {
|
|
884
|
-
return super.execute(e, t, s, i);
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
const xt = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new Set(["validators", "actions"]);
|
|
888
|
-
let st = 0;
|
|
889
|
-
var h, f;
|
|
890
|
-
class A {
|
|
891
|
-
constructor(e) {
|
|
892
|
-
/**
|
|
893
|
-
* The element's mutable state, in an object beside the element. `#state` is the tracked view of it: a slot read
|
|
894
|
-
* through it inside an effect subscribes the effect to that slot, and a write to the slot re-runs the effect.
|
|
895
|
-
* `#raw` is the same object without the proxy, for the bookkeeping nothing renders from.
|
|
896
|
-
*
|
|
897
|
-
* They are private class fields, so no reflection over the element reaches the state or the parent link it
|
|
898
|
-
* carries, and a subclass reads its own slot type through the accessors below.
|
|
899
|
-
*/
|
|
900
|
-
Z(this, h);
|
|
901
|
-
Z(this, f);
|
|
902
|
-
tt(this, f, e), tt(this, h, ee(e));
|
|
906
|
+
return pe;
|
|
903
907
|
}
|
|
908
|
+
execute(t, e, s, i) {
|
|
909
|
+
return super.execute(t, e, s, i);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
const ft = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), mt = /* @__PURE__ */ new Set(["validators", "actions"]);
|
|
913
|
+
let X = 0;
|
|
914
|
+
class y {
|
|
904
915
|
/**
|
|
905
916
|
* Vue's getTargetType answers INVALID for an object that carries __v_skip, so reactive() hands an element back
|
|
906
917
|
* unwrapped and no element is ever behind a proxy of its own. isReactive() reads the second flag, and it stays
|
|
@@ -918,13 +929,41 @@ class A {
|
|
|
918
929
|
get __v_isReactive() {
|
|
919
930
|
return !0;
|
|
920
931
|
}
|
|
932
|
+
/**
|
|
933
|
+
* Names the element's class, which is what a structural comparison of two elements answers on. An element keeps
|
|
934
|
+
* its state in private class fields, so a walk over own keys reaches none of it; lodash reads this tag through
|
|
935
|
+
* Object.prototype.toString before it compares anything, and a tag it does not know ends the comparison there.
|
|
936
|
+
* Two elements are therefore equal only where they are the same element. What they hold is compared as
|
|
937
|
+
* isEqual(a.value, b.value).
|
|
938
|
+
*
|
|
939
|
+
* It is an accessor on the prototype, so an element carries nothing for it, and `Object.prototype.toString`
|
|
940
|
+
* answers `[object Field]` rather than `[object Object]`. Each class states its own name as a literal: a
|
|
941
|
+
* minifier renames the class itself, so reading the constructor's name would report whatever the build called
|
|
942
|
+
* it.
|
|
943
|
+
*/
|
|
944
|
+
get [Symbol.toStringTag]() {
|
|
945
|
+
return "FormElement";
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* The element's mutable state, in an object beside the element. `#state` is the tracked view of it: a slot read
|
|
949
|
+
* through it inside an effect subscribes the effect to that slot, and a write to the slot re-runs the effect.
|
|
950
|
+
* `#raw` is the same object without the proxy, for the bookkeeping nothing renders from.
|
|
951
|
+
*
|
|
952
|
+
* They are private class fields, so no reflection over the element reaches the state or the parent link it
|
|
953
|
+
* carries, and a subclass reads its own slot type through the accessors below.
|
|
954
|
+
*/
|
|
955
|
+
#t;
|
|
956
|
+
#e;
|
|
957
|
+
constructor(t) {
|
|
958
|
+
this.#e = t, this.#t = Ut(t);
|
|
959
|
+
}
|
|
921
960
|
/** the tracked view of this element's state; a subclass narrows the return type to its own slots */
|
|
922
961
|
get state() {
|
|
923
|
-
return
|
|
962
|
+
return this.#t;
|
|
924
963
|
}
|
|
925
964
|
/** the untracked view of this element's state; a subclass narrows the return type to its own slots */
|
|
926
965
|
get raw() {
|
|
927
|
-
return
|
|
966
|
+
return this.#e;
|
|
928
967
|
}
|
|
929
968
|
/**
|
|
930
969
|
* Exchanges the data this element holds for `data`, in place. The element is the same instance afterwards - its
|
|
@@ -942,19 +981,19 @@ class A {
|
|
|
942
981
|
* The data is measured against the element's `declaration`, so a key a record leaves out is taken from the
|
|
943
982
|
* declaration rather than left as the previous record had it.
|
|
944
983
|
*/
|
|
945
|
-
rebind(
|
|
946
|
-
return
|
|
947
|
-
|
|
948
|
-
const s =
|
|
949
|
-
this.resetTo(this.declaration,
|
|
984
|
+
rebind(t) {
|
|
985
|
+
return u((e) => {
|
|
986
|
+
e.touch(this);
|
|
987
|
+
const s = e.willAnnounceValue(this), i = this.#e.announcedValue;
|
|
988
|
+
this.resetTo(this.declaration, t), this.#e.announcedValue = s ? i : this.value;
|
|
950
989
|
}), this;
|
|
951
990
|
}
|
|
952
991
|
/** contains original field value as was provided at creation */
|
|
953
992
|
get originalValue() {
|
|
954
|
-
return
|
|
993
|
+
return this.#t.originalValue;
|
|
955
994
|
}
|
|
956
|
-
set originalValue(
|
|
957
|
-
this.touchState(),
|
|
995
|
+
set originalValue(t) {
|
|
996
|
+
this.touchState(), this.#t.originalValue = t;
|
|
958
997
|
}
|
|
959
998
|
/**
|
|
960
999
|
* The extended properties this element carries: what a consumer attached to it beyond the members the class
|
|
@@ -969,14 +1008,14 @@ class A {
|
|
|
969
1008
|
* and one written in place would leave a rollback with nothing to put back.
|
|
970
1009
|
*/
|
|
971
1010
|
get extra() {
|
|
972
|
-
return
|
|
1011
|
+
return this.#t.extra;
|
|
973
1012
|
}
|
|
974
1013
|
/**
|
|
975
1014
|
* Writes extended properties. The values given are merged over the ones the element carries, so a write of one
|
|
976
1015
|
* property leaves the others standing, and the merged set replaces the object the element held.
|
|
977
1016
|
*/
|
|
978
|
-
setExtendedValues(
|
|
979
|
-
this.touchState(),
|
|
1017
|
+
setExtendedValues(t) {
|
|
1018
|
+
this.touchState(), this.#t.extra = Object.freeze({ ...this.#e.extra, ...t });
|
|
980
1019
|
}
|
|
981
1020
|
/**
|
|
982
1021
|
* The extended properties a parameter object carries: every key the element does not answer for itself. A key
|
|
@@ -988,22 +1027,22 @@ class A {
|
|
|
988
1027
|
* defined on the instance after the base constructor returns, and the parameters are applied inside it. A
|
|
989
1028
|
* subclass that wants a parameter of its own name assigned to it declares that member as an accessor.
|
|
990
1029
|
*/
|
|
991
|
-
extendedOf(
|
|
992
|
-
const
|
|
993
|
-
return Object.entries(
|
|
994
|
-
|
|
995
|
-
}),
|
|
1030
|
+
extendedOf(t) {
|
|
1031
|
+
const e = /* @__PURE__ */ Object.create(null);
|
|
1032
|
+
return Object.entries(t).forEach(([s, i]) => {
|
|
1033
|
+
mt.has(s) || (!(s in this) || Object.hasOwn(Object.prototype, s)) && (e[s] = i);
|
|
1034
|
+
}), e;
|
|
996
1035
|
}
|
|
997
1036
|
/**
|
|
998
1037
|
* Applies a parameter object: the members the element answers for are assigned to the element and the rest
|
|
999
1038
|
* become its extended properties. Assigning a getter-only member throws a TypeError, which is what a caller
|
|
1000
1039
|
* naming `valid` or `parent` past the type system gets.
|
|
1001
1040
|
*/
|
|
1002
|
-
assignParams(
|
|
1003
|
-
const
|
|
1004
|
-
Object.entries(
|
|
1005
|
-
Object.hasOwn(
|
|
1006
|
-
}),
|
|
1041
|
+
assignParams(t) {
|
|
1042
|
+
const e = this.extendedOf(t);
|
|
1043
|
+
Object.entries(t).forEach(([s, i]) => {
|
|
1044
|
+
Object.hasOwn(e, s) || mt.has(s) || (this[s] = i);
|
|
1045
|
+
}), _(e) || this.setExtendedValues(e);
|
|
1007
1046
|
}
|
|
1008
1047
|
/**
|
|
1009
1048
|
* Takes this element into the record of the open transaction, where one is open. A write of a single slot that
|
|
@@ -1011,8 +1050,7 @@ class A {
|
|
|
1011
1050
|
* atomic, and inside a transaction it has to be part of what a rollback puts back.
|
|
1012
1051
|
*/
|
|
1013
1052
|
touchState() {
|
|
1014
|
-
|
|
1015
|
-
(e = kt()) == null || e.touch(this);
|
|
1053
|
+
It()?.touch(this);
|
|
1016
1054
|
}
|
|
1017
1055
|
/**
|
|
1018
1056
|
* Records the whole of this element's mutable state, so that a rolled-back transaction can put it back exactly
|
|
@@ -1022,31 +1060,92 @@ class A {
|
|
|
1022
1060
|
* What is not in the snapshot is the action map, which no write touches: an operation that replaces it hands
|
|
1023
1061
|
* the transaction its own undo instead, so this stays the one shape every element captures.
|
|
1024
1062
|
*/
|
|
1025
|
-
[
|
|
1026
|
-
return
|
|
1063
|
+
[O]() {
|
|
1064
|
+
return { ...this.#e, errors: [...this.#e.errors] };
|
|
1027
1065
|
}
|
|
1028
1066
|
/**
|
|
1029
1067
|
* Puts a captured state back. It writes through the tracked view, so an effect that ran on the state the
|
|
1030
1068
|
* transaction produced runs again on the state it is being returned to, and only for the slots that differ.
|
|
1031
1069
|
*
|
|
1032
|
-
*
|
|
1033
|
-
* un-start one. Put back, the
|
|
1070
|
+
* The two validation counters are the slots the element keeps: they count runs that are in flight, and a
|
|
1071
|
+
* rollback cannot un-start one. Put back, the counts would no longer match the endValidating calls still to come.
|
|
1034
1072
|
*/
|
|
1035
|
-
[
|
|
1036
|
-
const
|
|
1037
|
-
Object.assign(
|
|
1073
|
+
[St](t) {
|
|
1074
|
+
const e = this.#e.validatingCount, s = this.#e.validatingChildren;
|
|
1075
|
+
Object.assign(this.#t, t), this.#t.validatingCount = e, this.#t.validatingChildren = s;
|
|
1038
1076
|
}
|
|
1039
|
-
/**
|
|
1077
|
+
/**
|
|
1078
|
+
* True while an asynchronous validation is in flight on this element or on anything below it, so a form answers
|
|
1079
|
+
* for the whole tree it holds. The answer is a pair of counters rather than a walk: the element's own runs, and
|
|
1080
|
+
* how many of its children answer the same question with true. A child that starts running while it was idle,
|
|
1081
|
+
* or stops while it was the last one running, moves its container's tally, and a tally that changes the
|
|
1082
|
+
* container's own answer moves the one above it - the transition costs the nesting depth and the read costs
|
|
1083
|
+
* nothing.
|
|
1084
|
+
*/
|
|
1040
1085
|
get validating() {
|
|
1041
|
-
return
|
|
1086
|
+
return this.#t.validatingCount > 0 || this.#t.validatingChildren > 0;
|
|
1042
1087
|
}
|
|
1043
1088
|
/** announces the start of one asynchronous validation run; validators pair it with endValidating */
|
|
1044
1089
|
beginValidating() {
|
|
1045
|
-
|
|
1090
|
+
const t = !this.validating;
|
|
1091
|
+
this.#t.validatingCount++, t && this.container?.childValidatingChanged(!0);
|
|
1046
1092
|
}
|
|
1047
1093
|
/** announces the end of one asynchronous validation run */
|
|
1048
1094
|
endValidating() {
|
|
1049
|
-
|
|
1095
|
+
this.#e.validatingCount !== 0 && (this.#t.validatingCount--, this.validating || this.container?.childValidatingChanged(!1));
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Records that a child started or stopped answering `validating` with true, and carries the transition further
|
|
1099
|
+
* up where it changes this element's own answer.
|
|
1100
|
+
*/
|
|
1101
|
+
childValidatingChanged(t) {
|
|
1102
|
+
const e = this.validating;
|
|
1103
|
+
this.#t.validatingChildren += t ? 1 : -1, this.validating !== e && this.container?.childValidatingChanged(t);
|
|
1104
|
+
}
|
|
1105
|
+
/**
|
|
1106
|
+
* True while an `Action.execute()` at or below this element has yet to settle. An `Action` answers for its own
|
|
1107
|
+
* runs; a container answers for the actions below it; anything else answers false, because an element that is
|
|
1108
|
+
* not an action has nothing to execute.
|
|
1109
|
+
*
|
|
1110
|
+
* It states one thing and `validating` states the other, so a form that gates a submit button on the tree being
|
|
1111
|
+
* idle reads both.
|
|
1112
|
+
*/
|
|
1113
|
+
get busy() {
|
|
1114
|
+
return !1;
|
|
1115
|
+
}
|
|
1116
|
+
/**
|
|
1117
|
+
* The composed answer a container gives `busy`, memoised by Vue. An `Action` counts its executions in a counter
|
|
1118
|
+
* of its own, which no container is told about, so the answer is composed over the members instead of tallied;
|
|
1119
|
+
* the computed keeps the walk from repeating while nothing it read has moved, and a member that is itself a
|
|
1120
|
+
* container answers from its own computed.
|
|
1121
|
+
*/
|
|
1122
|
+
get busyRead() {
|
|
1123
|
+
let t = pt.get(this);
|
|
1124
|
+
return t || (t = Y(() => this.composeBusy()), pt.set(this, t)), t.value;
|
|
1125
|
+
}
|
|
1126
|
+
/** What busyRead computes. A container answers over its members; anything else executes nothing. */
|
|
1127
|
+
composeBusy() {
|
|
1128
|
+
return !1;
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Resolves once nothing at or below this element is running - no asynchronous validation, no `Action.execute()`
|
|
1132
|
+
* that has yet to settle. It is what a submit path awaits instead of polling `validating` and `busy`, and it
|
|
1133
|
+
* resolves at once where nothing is running to begin with.
|
|
1134
|
+
*
|
|
1135
|
+
* It answers for the moment it resolves and makes no promise about the one after: work started later leaves the
|
|
1136
|
+
* element running again, so a caller that has to act on a settled tree reads what it needs immediately after
|
|
1137
|
+
* awaiting rather than at its leisure.
|
|
1138
|
+
*/
|
|
1139
|
+
settled() {
|
|
1140
|
+
return !this.validating && !this.busy ? Promise.resolve() : new Promise((t) => {
|
|
1141
|
+
const e = $t(
|
|
1142
|
+
() => this.validating || this.busy,
|
|
1143
|
+
(s) => {
|
|
1144
|
+
s || (e(), t());
|
|
1145
|
+
},
|
|
1146
|
+
{ flush: "sync" }
|
|
1147
|
+
);
|
|
1148
|
+
});
|
|
1050
1149
|
}
|
|
1051
1150
|
/**
|
|
1052
1151
|
* List of errors. The array handed out is the one the element holds, and a validator writes into it in place,
|
|
@@ -1054,23 +1153,34 @@ class A {
|
|
|
1054
1153
|
* except the errors would leave a state the form never held.
|
|
1055
1154
|
*/
|
|
1056
1155
|
get errors() {
|
|
1057
|
-
return this.touchState(),
|
|
1156
|
+
return this.touchState(), this.#t.errors;
|
|
1058
1157
|
}
|
|
1059
|
-
set errors(
|
|
1060
|
-
this.touchState(),
|
|
1158
|
+
set errors(t) {
|
|
1159
|
+
this.touchState(), this.#t.errors = t;
|
|
1061
1160
|
}
|
|
1062
1161
|
/**
|
|
1063
1162
|
* The container that holds this element: the Group it is a member of, or the List whose row it is, and
|
|
1064
1163
|
* undefined while no container holds it. The container writes it; everyone else reads it. The read is tracked,
|
|
1065
1164
|
* so an effect rendering off the link - `v-if="field.parent"` - re-runs when a container takes the element or
|
|
1066
1165
|
* releases it.
|
|
1166
|
+
*
|
|
1167
|
+
* A `List` holds rows and a row is a `Group`, so only a container can be a `List`'s child: `Field` narrows the
|
|
1168
|
+
* type to `Group | undefined`, and the sibling lookup `field.parent?.fields.other` is typed on a field.
|
|
1067
1169
|
*/
|
|
1068
1170
|
get parent() {
|
|
1069
|
-
return
|
|
1171
|
+
return this.#t.parent;
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* The same link at the type the internals reach through. The protected members a container is told things
|
|
1175
|
+
* through - childValidatingChanged, childValidityChanged - are declared here, and a union of two subclasses is
|
|
1176
|
+
* not an instance of this class, which is what a protected access needs.
|
|
1177
|
+
*/
|
|
1178
|
+
get container() {
|
|
1179
|
+
return this.#t.parent;
|
|
1070
1180
|
}
|
|
1071
1181
|
/** when member of a Group, fieldName specifies the name of this field. Written by the group, read-only after */
|
|
1072
1182
|
get fieldName() {
|
|
1073
|
-
return
|
|
1183
|
+
return this.#t.fieldName;
|
|
1074
1184
|
}
|
|
1075
1185
|
/**
|
|
1076
1186
|
* The element this one was declared as: itself for an element built from parameters, and the element it was
|
|
@@ -1079,8 +1189,7 @@ class A {
|
|
|
1079
1189
|
* answer with the same element, and an action registered on the template can tell the two apart.
|
|
1080
1190
|
*/
|
|
1081
1191
|
get declaration() {
|
|
1082
|
-
|
|
1083
|
-
return (e = l(this, f).declaration) != null ? e : this;
|
|
1192
|
+
return this.#e.declaration ?? this;
|
|
1084
1193
|
}
|
|
1085
1194
|
/** The elements this one holds: a Group's members, a List's rows, none for a leaf. */
|
|
1086
1195
|
get members() {
|
|
@@ -1092,9 +1201,9 @@ class A {
|
|
|
1092
1201
|
* field that every row of a list reacts to - and it costs the subtree, so it is the path taken only when the
|
|
1093
1202
|
* cheaper one, resolving within a single record, does not apply.
|
|
1094
1203
|
*/
|
|
1095
|
-
bindingsOf(
|
|
1096
|
-
const
|
|
1097
|
-
r.declaration ===
|
|
1204
|
+
bindingsOf(t) {
|
|
1205
|
+
const e = t.declaration, s = [], i = (r) => {
|
|
1206
|
+
r.declaration === e && s.push(r), r.members.forEach(i);
|
|
1098
1207
|
};
|
|
1099
1208
|
return i(this), s;
|
|
1100
1209
|
}
|
|
@@ -1106,33 +1215,66 @@ class A {
|
|
|
1106
1215
|
* nothing says so again, so the next container above answers for it.
|
|
1107
1216
|
*/
|
|
1108
1217
|
markRecordIncomplete() {
|
|
1109
|
-
this._recordPending || (this._recordPending = !0,
|
|
1218
|
+
this._recordPending || (this._recordPending = !0, X++);
|
|
1110
1219
|
}
|
|
1111
1220
|
/**
|
|
1112
1221
|
* Runs the eager passes outstanding in `element`'s subtree, now that the record it belongs to is assembled. A
|
|
1113
1222
|
* container calls it where it has just made a record complete: a Group that has written its members, and a
|
|
1114
1223
|
* List that has taken a row, which is what gives the row's fields the form above it.
|
|
1115
1224
|
*/
|
|
1116
|
-
completeRecords(
|
|
1117
|
-
|
|
1118
|
-
const
|
|
1119
|
-
s._recordPending && (s._recordPending = !1,
|
|
1225
|
+
completeRecords(t = this) {
|
|
1226
|
+
X !== 0 && u(() => {
|
|
1227
|
+
const e = (s) => {
|
|
1228
|
+
s._recordPending && (s._recordPending = !1, X--, s.rerunEagerActions()), s.members.forEach(e);
|
|
1120
1229
|
};
|
|
1121
|
-
t
|
|
1230
|
+
e(t);
|
|
1122
1231
|
});
|
|
1123
1232
|
}
|
|
1124
1233
|
/** Runs this element's eager actions over the value it holds and re-forms the verdict they reach. */
|
|
1125
1234
|
rerunEagerActions() {
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
(t = this._actions) == null || t.triggerEager(this, this.value, this.value), e.markValidityDirty(this);
|
|
1235
|
+
u((t) => {
|
|
1236
|
+
this.boundActions?.triggerEager(this, this.value, this.value), t.markValidityDirty(this);
|
|
1129
1237
|
});
|
|
1130
1238
|
}
|
|
1131
|
-
|
|
1132
|
-
|
|
1239
|
+
/**
|
|
1240
|
+
* The actions this element answers to, absent where nothing is registered. A binding holds the very map its
|
|
1241
|
+
* declaration holds rather than a copy of it, so the slot is read directly: what a trigger costs is one property
|
|
1242
|
+
* read, and a rule registered on a `List`'s item template reaches every row through the map they share - the
|
|
1243
|
+
* rows built before the registration as much as the ones built after.
|
|
1244
|
+
*/
|
|
1245
|
+
get boundActions() {
|
|
1246
|
+
return this._actions;
|
|
1247
|
+
}
|
|
1248
|
+
/** Records that `binding` was made from this element, so a later registration can reach it. */
|
|
1249
|
+
noteBinding(t) {
|
|
1250
|
+
let e = Q.get(this);
|
|
1251
|
+
e || (e = /* @__PURE__ */ new Set(), Q.set(this, e)), e.add(new WeakRef(t));
|
|
1133
1252
|
}
|
|
1134
|
-
|
|
1135
|
-
|
|
1253
|
+
/**
|
|
1254
|
+
* The bindings made from this element that are still alive, and this element itself. The dead references are
|
|
1255
|
+
* dropped as they are found, which is what keeps the set from growing over the life of a long-lived declaration.
|
|
1256
|
+
*/
|
|
1257
|
+
get boundElements() {
|
|
1258
|
+
const t = this.declaration, e = Q.get(t), s = [t];
|
|
1259
|
+
return e && e.forEach((i) => {
|
|
1260
|
+
const r = i.deref();
|
|
1261
|
+
r ? s.push(r) : e.delete(i);
|
|
1262
|
+
}), s;
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* The map registrations go into: the declaration's, since that is where behaviour lives. The map is made on the
|
|
1266
|
+
* first registration and handed to every binding already made from the declaration, so all of them go on reading
|
|
1267
|
+
* one map through a slot of their own.
|
|
1268
|
+
*/
|
|
1269
|
+
get actions() {
|
|
1270
|
+
const t = this.declaration;
|
|
1271
|
+
if (!t._actions) {
|
|
1272
|
+
const e = new M();
|
|
1273
|
+
t.boundElements.forEach((s) => {
|
|
1274
|
+
s._actions = e;
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
return t._actions;
|
|
1136
1278
|
}
|
|
1137
1279
|
/**
|
|
1138
1280
|
* Counts the writes that have changed the value of this element or of anything below it. A container reads it
|
|
@@ -1140,7 +1282,7 @@ class A {
|
|
|
1140
1282
|
* cached value still re-runs when a descendant is written.
|
|
1141
1283
|
*/
|
|
1142
1284
|
get valueVersion() {
|
|
1143
|
-
return
|
|
1285
|
+
return this.#t.valueVersion;
|
|
1144
1286
|
}
|
|
1145
1287
|
/**
|
|
1146
1288
|
* Marks the value of this element and of every ancestor as superseded. It walks the parent chain, so it costs
|
|
@@ -1149,11 +1291,11 @@ class A {
|
|
|
1149
1291
|
* rollback puts the versions back and no reader is left holding a cache the tree no longer supports.
|
|
1150
1292
|
*/
|
|
1151
1293
|
bumpValueVersion() {
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
let
|
|
1155
|
-
for (;
|
|
1156
|
-
|
|
1294
|
+
u((t) => {
|
|
1295
|
+
t.touch(this), this.#t.valueVersion++;
|
|
1296
|
+
let e = this.parent;
|
|
1297
|
+
for (; e; )
|
|
1298
|
+
t.touch(e), e.#t.valueVersion++, e = e.parent;
|
|
1157
1299
|
});
|
|
1158
1300
|
}
|
|
1159
1301
|
/**
|
|
@@ -1164,10 +1306,9 @@ class A {
|
|
|
1164
1306
|
* `force` states that the caller already knows this element's value changed - one item more or fewer is a
|
|
1165
1307
|
* different list whatever the items compare as - so the commit announces it without composing a comparison.
|
|
1166
1308
|
*/
|
|
1167
|
-
propagateValueChanged(
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
t.markValueChanged(this, e), t.markValidityDirty(this), (s = this.parent) == null || s.notifyValueChanged();
|
|
1309
|
+
propagateValueChanged(t = !1) {
|
|
1310
|
+
u((e) => {
|
|
1311
|
+
e.markValueChanged(this, t), e.markValidityDirty(this), this.parent?.notifyValueChanged();
|
|
1171
1312
|
});
|
|
1172
1313
|
}
|
|
1173
1314
|
/**
|
|
@@ -1184,7 +1325,7 @@ class A {
|
|
|
1184
1325
|
* without a validate() call, which is the documented cost of pushing errors by hand.
|
|
1185
1326
|
*/
|
|
1186
1327
|
get countedValid() {
|
|
1187
|
-
return
|
|
1328
|
+
return this.#e.errors.length === 0 && this.#e.invalidChildren === 0;
|
|
1188
1329
|
}
|
|
1189
1330
|
/**
|
|
1190
1331
|
* Makes this element the container of `child`: it installs the back-reference, records the name a Group holds
|
|
@@ -1193,16 +1334,18 @@ class A {
|
|
|
1193
1334
|
* released that way can be handed on. The child's state is unreachable from outside FieldBase, so a container
|
|
1194
1335
|
* writes the two slots through here rather than on the child.
|
|
1195
1336
|
*/
|
|
1196
|
-
takeChild(
|
|
1197
|
-
|
|
1198
|
-
if (
|
|
1199
|
-
s.touch(
|
|
1337
|
+
takeChild(t, e) {
|
|
1338
|
+
u((s) => {
|
|
1339
|
+
if (t.parent) throw new TypeError("This element already belongs to a container - pass a bind() of it");
|
|
1340
|
+
s.touch(t), t.#t.fieldName = e, t.#t.parent = this, this.adoptChild(t);
|
|
1200
1341
|
});
|
|
1201
1342
|
}
|
|
1202
1343
|
/** Takes a child into this element's invalid tally; a container calls it once the child's parent link exists. */
|
|
1203
|
-
adoptChild(
|
|
1204
|
-
|
|
1205
|
-
|
|
1344
|
+
adoptChild(t) {
|
|
1345
|
+
u((e) => {
|
|
1346
|
+
e.touch(this), t.#e.valid || this.#e.invalidChildren++, t.validating && this.childValidatingChanged(!0), e.whenRolledBack(() => {
|
|
1347
|
+
t.validating && this.childValidatingChanged(!1);
|
|
1348
|
+
}), e.markValidityDirty(this);
|
|
1206
1349
|
});
|
|
1207
1350
|
}
|
|
1208
1351
|
/**
|
|
@@ -1210,9 +1353,11 @@ class A {
|
|
|
1210
1353
|
* to a container that no longer holds it: it would go on moving that container's tally, and the link is what
|
|
1211
1354
|
* stands in the way of the element being taken by another container.
|
|
1212
1355
|
*/
|
|
1213
|
-
releaseChild(
|
|
1214
|
-
|
|
1215
|
-
|
|
1356
|
+
releaseChild(t) {
|
|
1357
|
+
u((e) => {
|
|
1358
|
+
e.touch(this), e.touch(t), t.#e.valid || this.#e.invalidChildren--, t.validating && this.childValidatingChanged(!1), e.whenRolledBack(() => {
|
|
1359
|
+
t.validating && this.childValidatingChanged(!0);
|
|
1360
|
+
}), t.#t.parent = void 0, t.#t.fieldName = void 0, e.markValidityDirty(this);
|
|
1216
1361
|
});
|
|
1217
1362
|
}
|
|
1218
1363
|
/**
|
|
@@ -1222,24 +1367,24 @@ class A {
|
|
|
1222
1367
|
* an element at a position it already holds calls it, so the element is indistinguishable from one built for
|
|
1223
1368
|
* that position.
|
|
1224
1369
|
*/
|
|
1225
|
-
resetTo(
|
|
1226
|
-
|
|
1227
|
-
const s =
|
|
1370
|
+
resetTo(t, e) {
|
|
1371
|
+
u(() => {
|
|
1372
|
+
const s = e === void 0 ? t.value : e, i = this.errors.length > 0;
|
|
1228
1373
|
i && (this.errors = []), this.touched = !1;
|
|
1229
1374
|
const r = this.enabled && this.value !== s;
|
|
1230
1375
|
this.value = s, this.originalValue = this.value, this.validate(!r && i);
|
|
1231
1376
|
});
|
|
1232
1377
|
}
|
|
1233
1378
|
/** Resets a member. It is what lets a container reach the reset of a child whose class it does not know. */
|
|
1234
|
-
resetChild(
|
|
1235
|
-
|
|
1379
|
+
resetChild(t, e, s) {
|
|
1380
|
+
t.resetTo(e, s);
|
|
1236
1381
|
}
|
|
1237
1382
|
/**
|
|
1238
1383
|
* Records a child's new verdict in this element's tally. The child reports it as it settles, and the commit
|
|
1239
1384
|
* settles the deepest element first, so the tally a container reads when its own turn comes is finished.
|
|
1240
1385
|
*/
|
|
1241
|
-
childValidityChanged(
|
|
1242
|
-
|
|
1386
|
+
childValidityChanged(t) {
|
|
1387
|
+
this.#e.invalidChildren += t ? -1 : 1;
|
|
1243
1388
|
}
|
|
1244
1389
|
/**
|
|
1245
1390
|
* The composed verdict a container answers `valid` with, memoised by Vue. The walk over the members is what
|
|
@@ -1247,35 +1392,39 @@ class A {
|
|
|
1247
1392
|
* from repeating while nothing it read has moved.
|
|
1248
1393
|
*/
|
|
1249
1394
|
get validRead() {
|
|
1250
|
-
let
|
|
1251
|
-
return
|
|
1395
|
+
let t = ft.get(this);
|
|
1396
|
+
return t || (t = Y(() => this.composeValid()), ft.set(this, t)), t.value;
|
|
1252
1397
|
}
|
|
1253
1398
|
/** What validRead computes. A leaf answers over its own errors; a container adds its members. */
|
|
1254
1399
|
composeValid() {
|
|
1255
|
-
return
|
|
1400
|
+
return this.#t.errors.length === 0;
|
|
1256
1401
|
}
|
|
1257
1402
|
// default property handlers
|
|
1258
1403
|
get visibility() {
|
|
1259
|
-
return
|
|
1260
|
-
}
|
|
1261
|
-
set visibility(
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
const
|
|
1265
|
-
if (!
|
|
1266
|
-
|
|
1267
|
-
|
|
1404
|
+
return this.#t.visibility;
|
|
1405
|
+
}
|
|
1406
|
+
set visibility(t) {
|
|
1407
|
+
const e = this.#t.visibility;
|
|
1408
|
+
t !== e && u((s) => {
|
|
1409
|
+
const i = this.boundActions?.trigger(Pt, this, t, e);
|
|
1410
|
+
if (!(i instanceof P)) {
|
|
1411
|
+
if (!I.isDefined(i ?? t))
|
|
1412
|
+
throw new Error("visibility must be a DisplayMode constant");
|
|
1413
|
+
s.touch(this), this.#t.visibility = I.fromAny(i ?? t), this.boundActions?.trigger(jt, this, this.#t.visibility, e);
|
|
1414
|
+
}
|
|
1268
1415
|
});
|
|
1269
1416
|
}
|
|
1270
1417
|
get enabled() {
|
|
1271
|
-
return
|
|
1272
|
-
}
|
|
1273
|
-
set enabled(
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
const
|
|
1277
|
-
if (!
|
|
1278
|
-
|
|
1418
|
+
return this.#t.enabled;
|
|
1419
|
+
}
|
|
1420
|
+
set enabled(t) {
|
|
1421
|
+
const e = this.#t.enabled;
|
|
1422
|
+
t !== e && u((s) => {
|
|
1423
|
+
const i = this.boundActions?.trigger(Rt, this, t, e);
|
|
1424
|
+
if (!(i instanceof P)) {
|
|
1425
|
+
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(Ft, this, this.#t.enabled, e);
|
|
1427
|
+
}
|
|
1279
1428
|
});
|
|
1280
1429
|
}
|
|
1281
1430
|
/**
|
|
@@ -1288,21 +1437,26 @@ class A {
|
|
|
1288
1437
|
get composesValue() {
|
|
1289
1438
|
return !1;
|
|
1290
1439
|
}
|
|
1440
|
+
/**
|
|
1441
|
+
* Whether `child` composes its value from members of its own. It is what lets a container tell a nested
|
|
1442
|
+
* container from a leaf without knowing the classes below it, the way `resetChild` reaches a reset it does not
|
|
1443
|
+
* know the shape of.
|
|
1444
|
+
*/
|
|
1445
|
+
childComposesValue(t) {
|
|
1446
|
+
return t.composesValue;
|
|
1447
|
+
}
|
|
1291
1448
|
/**
|
|
1292
1449
|
* Announces what this element's value became over the transaction. The pair carried is (value now, value at the
|
|
1293
1450
|
* last announcement), so a value that went A -> B -> A within the transaction says nothing, and the events an
|
|
1294
1451
|
* operation states rather than an element's state - an item added, an item removed - are emitted first, in the
|
|
1295
1452
|
* order the operations happened.
|
|
1296
1453
|
*/
|
|
1297
|
-
[
|
|
1298
|
-
if (i
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
if (this.composesValue && !(r != null && r.willTrigger(Ft) || r != null && r.hasEager)) return;
|
|
1304
|
-
const a = this.value, o = l(this, f).announcedValue;
|
|
1305
|
-
!s && (this.composesValue ? nt(a, o) : a === o) || (e.touch(this), l(this, f).announcedValue = a, this.composesValue && (r == null || r.triggerEager(this, a, o)), r == null || r.trigger(O, this, a, o));
|
|
1454
|
+
[xt](t, e, s, i) {
|
|
1455
|
+
if (i?.forEach((l) => this.boundActions?.trigger(l.actionClass, this, l.item, l.index)), !e) return;
|
|
1456
|
+
const r = this.boundActions;
|
|
1457
|
+
if (this.composesValue && !(r?.willTrigger(Ct) || r?.hasEager)) return;
|
|
1458
|
+
const a = this.value, o = this.#e.announcedValue;
|
|
1459
|
+
!s && (this.composesValue ? R(a, o) : a === o) || (t.touch(this), this.#e.announcedValue = a, this.composesValue && r?.triggerEager(this, a, o), r?.trigger(T, this, a, o));
|
|
1306
1460
|
}
|
|
1307
1461
|
/**
|
|
1308
1462
|
* Forms the verdict this element ends the transaction with and announces a transition of it. The container is
|
|
@@ -1311,28 +1465,26 @@ class A {
|
|
|
1311
1465
|
* asynchronous validator, an error pushed in by hand - is what makes the container re-form its own. The
|
|
1312
1466
|
* transaction settles the deepest element first, so a container is reached only once its members have decided.
|
|
1313
1467
|
*/
|
|
1314
|
-
[
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
var s;
|
|
1325
|
-
e && ((s = this._actions) == null || s.triggerEager(this, this.value, this.value)), t.markValidityDirty(this);
|
|
1468
|
+
[At](t) {
|
|
1469
|
+
const e = this.#e.valid, s = this.countedValid;
|
|
1470
|
+
if (s === e) return;
|
|
1471
|
+
t.touch(this), this.#e.valid = s;
|
|
1472
|
+
const i = this.container;
|
|
1473
|
+
i && (t.touch(i), i.childValidityChanged(s), t.markValidityDirty(i)), this.boundActions?.trigger(_t, this, s, e);
|
|
1474
|
+
}
|
|
1475
|
+
validate(t = !1) {
|
|
1476
|
+
u((e) => {
|
|
1477
|
+
t && this.boundActions?.triggerEager(this, this.value, this.value), e.markValidityDirty(this);
|
|
1326
1478
|
});
|
|
1327
1479
|
}
|
|
1328
1480
|
get valid() {
|
|
1329
|
-
return
|
|
1481
|
+
return this.#t.errors.length === 0;
|
|
1330
1482
|
}
|
|
1331
1483
|
get fullValue() {
|
|
1332
1484
|
return this.value;
|
|
1333
1485
|
}
|
|
1334
1486
|
get isChanged() {
|
|
1335
|
-
return !
|
|
1487
|
+
return !R(this.value, this.originalValue);
|
|
1336
1488
|
}
|
|
1337
1489
|
/**
|
|
1338
1490
|
* Brings a fresh element into the state a binding of `source` is in: it records what it was declared as, takes
|
|
@@ -1342,26 +1494,28 @@ class A {
|
|
|
1342
1494
|
* actions are the very instances `source` holds - what a binding takes on is data, not behaviour - and each is
|
|
1343
1495
|
* told about this element as it is taken on, so an action serving several bindings knows all of them.
|
|
1344
1496
|
*/
|
|
1345
|
-
boundFrom(
|
|
1346
|
-
|
|
1347
|
-
const r =
|
|
1348
|
-
|
|
1349
|
-
const a =
|
|
1350
|
-
a
|
|
1497
|
+
boundFrom(t, e, s, i) {
|
|
1498
|
+
this.#e.declaration = t.declaration;
|
|
1499
|
+
const r = { ...t.extra, ...i && this.extendedOf(i) };
|
|
1500
|
+
_(r) || this.setExtendedValues(r);
|
|
1501
|
+
const a = this.declaration;
|
|
1502
|
+
a.noteBinding(this);
|
|
1503
|
+
const o = a._actions;
|
|
1504
|
+
o && (this._actions = o, o.bindTo(this), o.triggerEager(this, e, s));
|
|
1351
1505
|
}
|
|
1352
1506
|
/**
|
|
1353
1507
|
* Registers the actions a constructor received in its parameters: registration without the eager trigger,
|
|
1354
1508
|
* because a constructor ends with a single this.actions.triggerEager(...) over the finished value, and an
|
|
1355
1509
|
* eager action registered here would otherwise also run once per registration, over a half-built field.
|
|
1356
1510
|
*/
|
|
1357
|
-
registerInitialActions(
|
|
1358
|
-
|
|
1359
|
-
this.actions.register(
|
|
1511
|
+
registerInitialActions(t) {
|
|
1512
|
+
t.forEach((e) => {
|
|
1513
|
+
this.actions.register(e), e.boundToBinding(this);
|
|
1360
1514
|
});
|
|
1361
1515
|
}
|
|
1362
|
-
registerAction(
|
|
1363
|
-
return
|
|
1364
|
-
|
|
1516
|
+
registerAction(t) {
|
|
1517
|
+
return u((e) => {
|
|
1518
|
+
e.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(t), this.registered(e, t);
|
|
1365
1519
|
}), this;
|
|
1366
1520
|
}
|
|
1367
1521
|
/**
|
|
@@ -1370,9 +1524,9 @@ class A {
|
|
|
1370
1524
|
* handler already registered, which registration order alone cannot arrange. `before` has to be registered on
|
|
1371
1525
|
* this element under the same identifier.
|
|
1372
1526
|
*/
|
|
1373
|
-
registerActionBefore(
|
|
1374
|
-
return
|
|
1375
|
-
s.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(
|
|
1527
|
+
registerActionBefore(t, e) {
|
|
1528
|
+
return u((s) => {
|
|
1529
|
+
s.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(t, e), this.registered(s, t);
|
|
1376
1530
|
}), this;
|
|
1377
1531
|
}
|
|
1378
1532
|
/**
|
|
@@ -1381,27 +1535,33 @@ class A {
|
|
|
1381
1535
|
* withdraws the errors it put on this element as it goes, so the verdict the element reports is the one the
|
|
1382
1536
|
* validators it still holds reach.
|
|
1383
1537
|
*/
|
|
1384
|
-
unregisterAction(
|
|
1385
|
-
let
|
|
1386
|
-
return
|
|
1387
|
-
const i = this.
|
|
1388
|
-
i
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1538
|
+
unregisterAction(t) {
|
|
1539
|
+
let e = !1;
|
|
1540
|
+
return u((s) => {
|
|
1541
|
+
const i = this.boundActions;
|
|
1542
|
+
if (!i || (e = i.unregister(t), !e)) return;
|
|
1543
|
+
s.touch(this), t instanceof f && this.#t.validationEpoch++;
|
|
1544
|
+
const r = this.boundElements;
|
|
1545
|
+
s.whenRolledBack(() => {
|
|
1546
|
+
i.register(t), r.forEach((a) => t.boundToBinding(a));
|
|
1547
|
+
}), r.forEach((a) => t.unregisterFrom(a));
|
|
1548
|
+
}), e;
|
|
1392
1549
|
}
|
|
1393
1550
|
/**
|
|
1394
1551
|
* Records that `action` is now registered on this element, and that a rollback has to take that back. The
|
|
1395
1552
|
* registration is not one of the state slots the snapshot covers, so it hands its own undo in.
|
|
1396
1553
|
*/
|
|
1397
|
-
registered(
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
(
|
|
1554
|
+
registered(t, e) {
|
|
1555
|
+
const s = this.boundElements;
|
|
1556
|
+
s.forEach((i) => {
|
|
1557
|
+
e.boundToBinding(i), e.eager && this.actions.triggerEagerFor(e.classIdentifier, i, i.value, i.originalValue);
|
|
1558
|
+
}), t.whenRolledBack(() => {
|
|
1559
|
+
this.boundActions?.unregister(e) && s.forEach((i) => e.unregisterFrom(i));
|
|
1401
1560
|
});
|
|
1402
1561
|
}
|
|
1403
|
-
triggerAction(
|
|
1404
|
-
|
|
1562
|
+
triggerAction(t, ...e) {
|
|
1563
|
+
const s = this.boundActions;
|
|
1564
|
+
return s ? s.trigger(t, this, ...e) : null;
|
|
1405
1565
|
}
|
|
1406
1566
|
/**
|
|
1407
1567
|
* Generation counter of the validators attached to this field. A Validator reads it when a run starts and drops
|
|
@@ -1409,30 +1569,49 @@ class A {
|
|
|
1409
1569
|
* cannot push an error onto a field that no longer has the validator that produced it.
|
|
1410
1570
|
*/
|
|
1411
1571
|
get validationEpoch() {
|
|
1412
|
-
return
|
|
1572
|
+
return this.#t.validationEpoch;
|
|
1413
1573
|
}
|
|
1414
1574
|
clearValidators() {
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
const
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1575
|
+
u((t) => {
|
|
1576
|
+
t.touch(this), this.#t.validationEpoch++;
|
|
1577
|
+
const e = this.boundActions;
|
|
1578
|
+
if (e) {
|
|
1579
|
+
const s = this.boundElements;
|
|
1580
|
+
e.validators.forEach((i) => {
|
|
1581
|
+
e.unregister(i), t.whenRolledBack(() => {
|
|
1582
|
+
e.register(i), s.forEach((r) => i.boundToBinding(r));
|
|
1583
|
+
}), s.forEach((r) => i.unregisterFrom(r));
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1586
|
+
this.errors = [], this.validate();
|
|
1423
1587
|
});
|
|
1424
1588
|
}
|
|
1425
1589
|
}
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
return n ? !e : e;
|
|
1590
|
+
function me(n, t) {
|
|
1591
|
+
return n ? !t : t;
|
|
1429
1592
|
}
|
|
1430
|
-
class
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1593
|
+
class w {
|
|
1594
|
+
operand1;
|
|
1595
|
+
operator;
|
|
1596
|
+
operand2;
|
|
1597
|
+
/**
|
|
1598
|
+
* An operand is a nested `Statement`, a `FieldBase` whose value is compared, or a literal. `undefined` and a
|
|
1599
|
+
* function are neither: they are what a misspelled field name and a field accessor handed over uncalled answer
|
|
1600
|
+
* with, and a statement built from one compares nothing and never fires. The position names which of the two
|
|
1601
|
+
* operands is at fault, so the error points at the place the name was written.
|
|
1602
|
+
*/
|
|
1603
|
+
static validateOperand(t, e) {
|
|
1604
|
+
if (t === void 0)
|
|
1605
|
+
throw new TypeError(
|
|
1606
|
+
`Statement operand ${e} is undefined: an operand is a field, a nested statement or a literal, and a name resolving to nothing is none of them. Compare against null to test for an unset value.`
|
|
1607
|
+
);
|
|
1608
|
+
if (typeof t == "function")
|
|
1609
|
+
throw new TypeError(
|
|
1610
|
+
`Statement operand ${e} 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').`
|
|
1611
|
+
);
|
|
1612
|
+
}
|
|
1613
|
+
constructor(t, e, s) {
|
|
1614
|
+
w.validateOperand(t, 1), e !== c.NOT && w.validateOperand(s, 2), this.operand1 = t, this.operator = e, this.operand2 = s;
|
|
1436
1615
|
}
|
|
1437
1616
|
/**
|
|
1438
1617
|
* The value an operand contributes. A field operand names a field of the record the statement is evaluated in:
|
|
@@ -1440,66 +1619,65 @@ class I {
|
|
|
1440
1619
|
* record of the statement's own - a form field above the list - is read where it stands. A record that does not
|
|
1441
1620
|
* hold the field yet contributes undefined, which is what a half-built row answers with.
|
|
1442
1621
|
*/
|
|
1443
|
-
static valueOf(
|
|
1444
|
-
if (
|
|
1445
|
-
if (
|
|
1446
|
-
const s =
|
|
1447
|
-
return s ?
|
|
1622
|
+
static valueOf(t, e) {
|
|
1623
|
+
if (t instanceof w) return t.evaluate(e);
|
|
1624
|
+
if (t instanceof y) {
|
|
1625
|
+
const s = e ? et(t, e) : t;
|
|
1626
|
+
return s ? h(s.value) : void 0;
|
|
1448
1627
|
}
|
|
1449
|
-
return
|
|
1628
|
+
return t;
|
|
1450
1629
|
}
|
|
1451
1630
|
get operand1Value() {
|
|
1452
|
-
return
|
|
1631
|
+
return w.valueOf(this.operand1);
|
|
1453
1632
|
}
|
|
1454
1633
|
get operand2Value() {
|
|
1455
|
-
return
|
|
1634
|
+
return w.valueOf(this.operand2);
|
|
1456
1635
|
}
|
|
1457
1636
|
/**
|
|
1458
1637
|
* The result of the statement, over the record `scope` belongs to where one is given and over the fields the
|
|
1459
1638
|
* statement was built from where it is not.
|
|
1460
1639
|
*/
|
|
1461
|
-
evaluate(
|
|
1462
|
-
|
|
1463
|
-
const t = I.valueOf(this.operand1, e), s = I.valueOf(this.operand2, e);
|
|
1640
|
+
evaluate(t) {
|
|
1641
|
+
const e = w.valueOf(this.operand1, t), s = w.valueOf(this.operand2, t);
|
|
1464
1642
|
switch (this.operator) {
|
|
1465
1643
|
// logical operators
|
|
1466
1644
|
// `&&` and `||` evaluate to one of their operands, and the operands are of any type. Without the
|
|
1467
1645
|
// coercion evaluate() would hand out the operand itself, so `0` or `''` would reach callers that the
|
|
1468
1646
|
// signature promises a boolean, and consumers comparing results with !== would see a change where the
|
|
1469
1647
|
// logical value stayed the same.
|
|
1470
|
-
case
|
|
1471
|
-
return !!(
|
|
1472
|
-
case
|
|
1473
|
-
return !!(
|
|
1474
|
-
case
|
|
1475
|
-
return !(
|
|
1476
|
-
case
|
|
1477
|
-
return !(
|
|
1478
|
-
case
|
|
1479
|
-
return
|
|
1480
|
-
case
|
|
1481
|
-
return !
|
|
1648
|
+
case c.AND:
|
|
1649
|
+
return !!(e && s);
|
|
1650
|
+
case c.OR:
|
|
1651
|
+
return !!(e || s);
|
|
1652
|
+
case c.NAND:
|
|
1653
|
+
return !(e && s);
|
|
1654
|
+
case c.NOR:
|
|
1655
|
+
return !(e || s);
|
|
1656
|
+
case c.XOR:
|
|
1657
|
+
return me(!!e, !!s);
|
|
1658
|
+
case c.NOT:
|
|
1659
|
+
return !e;
|
|
1482
1660
|
// comparison operators
|
|
1483
|
-
case
|
|
1484
|
-
return
|
|
1485
|
-
case
|
|
1486
|
-
return
|
|
1487
|
-
case
|
|
1488
|
-
return
|
|
1489
|
-
case
|
|
1490
|
-
return
|
|
1491
|
-
case
|
|
1492
|
-
return
|
|
1493
|
-
case
|
|
1494
|
-
return
|
|
1495
|
-
case
|
|
1496
|
-
return !!
|
|
1497
|
-
case
|
|
1498
|
-
return !
|
|
1499
|
-
case
|
|
1500
|
-
return
|
|
1501
|
-
case
|
|
1502
|
-
return !(
|
|
1661
|
+
case c.EQUALS:
|
|
1662
|
+
return e == s;
|
|
1663
|
+
case c.NOT_EQUALS:
|
|
1664
|
+
return e != s;
|
|
1665
|
+
case c.LT:
|
|
1666
|
+
return e < s;
|
|
1667
|
+
case c.LE:
|
|
1668
|
+
return e <= s;
|
|
1669
|
+
case c.GE:
|
|
1670
|
+
return e >= s;
|
|
1671
|
+
case c.GT:
|
|
1672
|
+
return e > s;
|
|
1673
|
+
case c.IN:
|
|
1674
|
+
return !!s?.includes?.(e);
|
|
1675
|
+
case c.NOT_IN:
|
|
1676
|
+
return !s?.includes?.(e);
|
|
1677
|
+
case c.INCLUDES:
|
|
1678
|
+
return C(e) && C(s) && e.indexOf(s) >= 0;
|
|
1679
|
+
case c.NOT_INCLUDES:
|
|
1680
|
+
return !(C(e) && C(s) && e.indexOf(s) >= 0);
|
|
1503
1681
|
default:
|
|
1504
1682
|
throw new Error(`Operator not implemented ${this.operator}`);
|
|
1505
1683
|
}
|
|
@@ -1509,82 +1687,90 @@ class I {
|
|
|
1509
1687
|
* @returns A set of all fields used in this statement
|
|
1510
1688
|
*/
|
|
1511
1689
|
collectFields() {
|
|
1512
|
-
const
|
|
1513
|
-
function
|
|
1514
|
-
s instanceof
|
|
1690
|
+
const t = /* @__PURE__ */ new Set();
|
|
1691
|
+
function e(s) {
|
|
1692
|
+
s instanceof y ? t.add(s) : s instanceof w && s.collectFields().forEach((r) => t.add(r));
|
|
1515
1693
|
}
|
|
1516
|
-
return
|
|
1694
|
+
return e(this.operand1), e(this.operand2), t;
|
|
1517
1695
|
}
|
|
1518
1696
|
}
|
|
1519
|
-
const
|
|
1520
|
-
class
|
|
1521
|
-
constructor(
|
|
1522
|
-
super(
|
|
1697
|
+
const be = /* @__PURE__ */ Symbol("ExecuteAction");
|
|
1698
|
+
class Nt extends m {
|
|
1699
|
+
constructor(t) {
|
|
1700
|
+
super(t);
|
|
1523
1701
|
}
|
|
1524
1702
|
static get classIdentifier() {
|
|
1525
|
-
return
|
|
1703
|
+
return be;
|
|
1526
1704
|
}
|
|
1527
|
-
execute(
|
|
1528
|
-
return super.execute(
|
|
1705
|
+
execute(t, e, s) {
|
|
1706
|
+
return super.execute(t, e, s);
|
|
1529
1707
|
}
|
|
1530
1708
|
}
|
|
1531
|
-
const
|
|
1532
|
-
class
|
|
1533
|
-
constructor(
|
|
1534
|
-
super(
|
|
1709
|
+
const ve = /* @__PURE__ */ Symbol("ListItemAddedAction");
|
|
1710
|
+
class J extends m {
|
|
1711
|
+
constructor(t) {
|
|
1712
|
+
super(t);
|
|
1535
1713
|
}
|
|
1536
1714
|
static get classIdentifier() {
|
|
1537
|
-
return
|
|
1715
|
+
return ve;
|
|
1538
1716
|
}
|
|
1539
|
-
execute(
|
|
1540
|
-
return super.execute(
|
|
1717
|
+
execute(t, e, s, i) {
|
|
1718
|
+
return super.execute(t, e, s, i);
|
|
1541
1719
|
}
|
|
1542
1720
|
}
|
|
1543
|
-
const
|
|
1544
|
-
class
|
|
1545
|
-
constructor(
|
|
1546
|
-
super(
|
|
1721
|
+
const we = /* @__PURE__ */ Symbol("ListItemRemovedAction");
|
|
1722
|
+
class Bt extends m {
|
|
1723
|
+
constructor(t) {
|
|
1724
|
+
super(t);
|
|
1547
1725
|
}
|
|
1548
1726
|
static get classIdentifier() {
|
|
1549
|
-
return
|
|
1727
|
+
return we;
|
|
1550
1728
|
}
|
|
1551
|
-
execute(
|
|
1552
|
-
return super.execute(
|
|
1729
|
+
execute(t, e, s, i) {
|
|
1730
|
+
return super.execute(t, e, s, i);
|
|
1553
1731
|
}
|
|
1554
1732
|
}
|
|
1555
|
-
const
|
|
1556
|
-
function
|
|
1733
|
+
const Ve = Object.freeze({});
|
|
1734
|
+
function Dt() {
|
|
1557
1735
|
return {
|
|
1558
1736
|
originalValue: void 0,
|
|
1559
1737
|
announcedValue: void 0,
|
|
1560
1738
|
errors: [],
|
|
1561
|
-
visibility:
|
|
1739
|
+
visibility: I.FULL,
|
|
1562
1740
|
enabled: !0,
|
|
1563
1741
|
valueVersion: 0,
|
|
1564
1742
|
validatingCount: 0,
|
|
1743
|
+
validatingChildren: 0,
|
|
1565
1744
|
parent: void 0,
|
|
1566
1745
|
fieldName: void 0,
|
|
1567
1746
|
validationEpoch: 0,
|
|
1568
1747
|
declaration: void 0,
|
|
1569
|
-
extra:
|
|
1748
|
+
extra: Ve,
|
|
1570
1749
|
valid: !0,
|
|
1571
1750
|
invalidChildren: 0
|
|
1572
1751
|
};
|
|
1573
1752
|
}
|
|
1574
|
-
function
|
|
1575
|
-
return
|
|
1753
|
+
function ye() {
|
|
1754
|
+
return { ...Dt(), value: void 0, touched: !1 };
|
|
1576
1755
|
}
|
|
1577
|
-
function
|
|
1578
|
-
return
|
|
1756
|
+
function Lt() {
|
|
1757
|
+
return {
|
|
1758
|
+
...Dt(),
|
|
1579
1759
|
announcedValue: null,
|
|
1580
1760
|
cachedValue: null,
|
|
1581
1761
|
cachedValueVersion: -1
|
|
1582
|
-
}
|
|
1762
|
+
};
|
|
1763
|
+
}
|
|
1764
|
+
function Ee() {
|
|
1765
|
+
return { ...Lt(), fieldNames: [] };
|
|
1583
1766
|
}
|
|
1584
|
-
function
|
|
1585
|
-
return
|
|
1767
|
+
function Ce() {
|
|
1768
|
+
return { ...Lt(), rows: null, rowsVersion: 0, cachedItems: null, cachedItemsVersion: -1 };
|
|
1586
1769
|
}
|
|
1587
|
-
class
|
|
1770
|
+
class st extends y {
|
|
1771
|
+
get [Symbol.toStringTag]() {
|
|
1772
|
+
return "Field";
|
|
1773
|
+
}
|
|
1588
1774
|
get state() {
|
|
1589
1775
|
return super.state;
|
|
1590
1776
|
}
|
|
@@ -1595,11 +1781,11 @@ class X extends A {
|
|
|
1595
1781
|
get _value() {
|
|
1596
1782
|
return this.state.value;
|
|
1597
1783
|
}
|
|
1598
|
-
set _value(
|
|
1599
|
-
this.state.value =
|
|
1784
|
+
set _value(t) {
|
|
1785
|
+
this.state.value = t;
|
|
1600
1786
|
}
|
|
1601
|
-
constructor(
|
|
1602
|
-
super(
|
|
1787
|
+
constructor(t) {
|
|
1788
|
+
super(ye()), this.init(t);
|
|
1603
1789
|
}
|
|
1604
1790
|
/**
|
|
1605
1791
|
* Applies the constructor parameters. It is a hook so that a subclass needing different parameter handling
|
|
@@ -1610,63 +1796,66 @@ class X extends A {
|
|
|
1610
1796
|
* subclass initializes read as undefined inside it, and anything it writes to such a member is overwritten
|
|
1611
1797
|
* the moment the initializer runs.
|
|
1612
1798
|
*/
|
|
1613
|
-
init(
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
this.registerInitialActions([...r || [], ...a || []]), this.assignParams(o), this._value = i !== void 0 ? i : this.originalValue, this.originalValue === void 0 && (this.originalValue = this._value);
|
|
1799
|
+
init(t) {
|
|
1800
|
+
u(() => {
|
|
1801
|
+
if (t) {
|
|
1802
|
+
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, this.originalValue === void 0 && (this.originalValue = this._value);
|
|
1619
1804
|
}
|
|
1620
|
-
this.raw.announcedValue = this._value,
|
|
1805
|
+
this.raw.announcedValue = this._value, this.boundActions?.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
1621
1806
|
});
|
|
1622
1807
|
}
|
|
1623
1808
|
get value() {
|
|
1624
1809
|
return this._value;
|
|
1625
1810
|
}
|
|
1626
|
-
set value(
|
|
1627
|
-
const
|
|
1628
|
-
!this.enabled ||
|
|
1629
|
-
|
|
1630
|
-
s.touch(this), this._value = e, this.bumpValueVersion(), (i = this._actions) == null || i.triggerEager(this, e, t), this.propagateValueChanged();
|
|
1811
|
+
set value(t) {
|
|
1812
|
+
const e = this._value;
|
|
1813
|
+
!this.enabled || e === t || u((s) => {
|
|
1814
|
+
s.touch(this), this._value = t, this.bumpValueVersion(), this.boundActions?.triggerEager(this, t, e), this.propagateValueChanged();
|
|
1631
1815
|
});
|
|
1632
1816
|
}
|
|
1817
|
+
/**
|
|
1818
|
+
* The container that holds this field. A `List` holds rows and a row is a `Group`, so a field is never a `List`'s
|
|
1819
|
+
* child and the link is a `Group` wherever there is one: `field.parent?.fields.other` is the sibling lookup, and
|
|
1820
|
+
* it is typed here.
|
|
1821
|
+
*/
|
|
1822
|
+
get parent() {
|
|
1823
|
+
return super.parent;
|
|
1824
|
+
}
|
|
1633
1825
|
get touched() {
|
|
1634
1826
|
return this.state.touched;
|
|
1635
1827
|
}
|
|
1636
|
-
set touched(
|
|
1637
|
-
this.touchState(), this.state.touched =
|
|
1828
|
+
set touched(t) {
|
|
1829
|
+
this.touchState(), this.state.touched = t;
|
|
1638
1830
|
}
|
|
1639
|
-
bind(
|
|
1640
|
-
|
|
1641
|
-
const s = this.constructor, i = new s(C(p({
|
|
1831
|
+
bind(t, e) {
|
|
1832
|
+
const s = this.constructor, i = new s({
|
|
1642
1833
|
// data is what the caller supplied, and undefined is not supplied; an explicit null is, and clears
|
|
1643
|
-
value:
|
|
1644
|
-
|
|
1645
|
-
enabled:
|
|
1646
|
-
visibility:
|
|
1647
|
-
})
|
|
1648
|
-
return i.boundFrom(this, i.value, i.originalValue,
|
|
1649
|
-
}
|
|
1650
|
-
}
|
|
1651
|
-
const
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
}
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
const
|
|
1665
|
-
this.
|
|
1666
|
-
const c = it(i, this._value), x = Object.freeze({ label: r == null ? void 0 : r.label, icon: r == null ? void 0 : r.icon });
|
|
1667
|
-
this._value = it(c, p({}, x)), this.originalValue = it(x, c);
|
|
1834
|
+
value: t !== void 0 ? t : this.value,
|
|
1835
|
+
...e && "originalValue" in e ? { originalValue: e.originalValue } : {},
|
|
1836
|
+
enabled: e?.enabled ?? this.enabled,
|
|
1837
|
+
visibility: e?.visibility ?? this.visibility
|
|
1838
|
+
});
|
|
1839
|
+
return i.boundFrom(this, i.value, i.originalValue, e), i;
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
const bt = /* @__PURE__ */ new WeakMap();
|
|
1843
|
+
function K(n, t) {
|
|
1844
|
+
return n?.label == null && n?.icon == null ? t : n;
|
|
1845
|
+
}
|
|
1846
|
+
class Se extends st {
|
|
1847
|
+
get [Symbol.toStringTag]() {
|
|
1848
|
+
return "Action";
|
|
1849
|
+
}
|
|
1850
|
+
init(t) {
|
|
1851
|
+
u(() => {
|
|
1852
|
+
if (this._value = { label: void 0, icon: void 0 }, t) {
|
|
1853
|
+
const { value: e, originalValue: s, validators: i, actions: r, ...a } = t;
|
|
1854
|
+
this.registerInitialActions([...i || [], ...r || []]), this.assignParams(a);
|
|
1855
|
+
const o = K(e, this._value), l = Object.freeze({ label: s?.label, icon: s?.icon });
|
|
1856
|
+
this._value = K(o, { ...l }), this.originalValue = K(l, o);
|
|
1668
1857
|
}
|
|
1669
|
-
this.raw.announcedValue = this._value,
|
|
1858
|
+
this.raw.announcedValue = this._value, this.boundActions?.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
1670
1859
|
});
|
|
1671
1860
|
}
|
|
1672
1861
|
/**
|
|
@@ -1675,15 +1864,15 @@ class Pe extends X {
|
|
|
1675
1864
|
* JSON, but lodash isEqual compares own-key sets, so writing one would leave the action permanently changed
|
|
1676
1865
|
* against a baseline that never carried the key.
|
|
1677
1866
|
*/
|
|
1678
|
-
valueWith(
|
|
1679
|
-
const s =
|
|
1680
|
-
return
|
|
1867
|
+
valueWith(t, e) {
|
|
1868
|
+
const s = { ...this.value };
|
|
1869
|
+
return e === void 0 ? delete s[t] : s[t] = e, s;
|
|
1681
1870
|
}
|
|
1682
1871
|
get icon() {
|
|
1683
1872
|
return this.value.icon;
|
|
1684
1873
|
}
|
|
1685
|
-
set icon(
|
|
1686
|
-
this.value.icon !==
|
|
1874
|
+
set icon(t) {
|
|
1875
|
+
this.value.icon !== t && (this.value = this.valueWith("icon", t));
|
|
1687
1876
|
}
|
|
1688
1877
|
get label() {
|
|
1689
1878
|
return this.value.label;
|
|
@@ -1695,13 +1884,13 @@ class Pe extends X {
|
|
|
1695
1884
|
* identity and every copy is a new object, so without the comparison here a write of the value already held
|
|
1696
1885
|
* would announce a change and invalidate the value cache of every container above.
|
|
1697
1886
|
*/
|
|
1698
|
-
set label(
|
|
1699
|
-
this.value.label !==
|
|
1887
|
+
set label(t) {
|
|
1888
|
+
this.value.label !== t && (this.value = this.valueWith("label", t));
|
|
1700
1889
|
}
|
|
1701
1890
|
/** the counter behind `busy`, allocated for this action the first time it is asked for */
|
|
1702
1891
|
get busyRuns() {
|
|
1703
|
-
let
|
|
1704
|
-
return
|
|
1892
|
+
let t = bt.get(this);
|
|
1893
|
+
return t || (t = Wt(0), bt.set(this, t)), t;
|
|
1705
1894
|
}
|
|
1706
1895
|
/** true from the moment execute() is called until the handler it ran has settled, however it settles */
|
|
1707
1896
|
get busy() {
|
|
@@ -1717,26 +1906,24 @@ class Pe extends X {
|
|
|
1717
1906
|
* out of this call: a caller that does not await the answer and does not attach a catch handler leaves that
|
|
1718
1907
|
* rejection unhandled.
|
|
1719
1908
|
*/
|
|
1720
|
-
execute(
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
}
|
|
1729
|
-
});
|
|
1909
|
+
async execute(t) {
|
|
1910
|
+
const e = this.busyRuns;
|
|
1911
|
+
e.value++;
|
|
1912
|
+
try {
|
|
1913
|
+
return await this.triggerAction(Nt, t);
|
|
1914
|
+
} finally {
|
|
1915
|
+
e.value--;
|
|
1916
|
+
}
|
|
1730
1917
|
}
|
|
1731
1918
|
}
|
|
1732
|
-
const
|
|
1919
|
+
const xe = /* @__PURE__ */ qt({
|
|
1733
1920
|
__name: "messages-widget",
|
|
1734
1921
|
props: {
|
|
1735
1922
|
message: {},
|
|
1736
1923
|
classes: {}
|
|
1737
1924
|
},
|
|
1738
1925
|
setup(n) {
|
|
1739
|
-
const
|
|
1926
|
+
const t = n, e = ut("vue-markdown"), s = /* @__PURE__ */ new Set([
|
|
1740
1927
|
"div",
|
|
1741
1928
|
"span",
|
|
1742
1929
|
"p",
|
|
@@ -1793,23 +1980,23 @@ const Ne = /* @__PURE__ */ ie({
|
|
|
1793
1980
|
"dt",
|
|
1794
1981
|
"dd"
|
|
1795
1982
|
]), i = () => {
|
|
1796
|
-
if (typeof
|
|
1983
|
+
if (typeof t.message == "string") return k("span", { class: t.classes }, t.message);
|
|
1797
1984
|
const r = [];
|
|
1798
|
-
return
|
|
1985
|
+
return t.message.forEach((a) => {
|
|
1799
1986
|
switch (a.componentName) {
|
|
1800
1987
|
case "template":
|
|
1801
|
-
r.push(
|
|
1988
|
+
r.push(k("div", { class: [t.classes, a.extraClasses] }, a.componentBody));
|
|
1802
1989
|
break;
|
|
1803
1990
|
case "vue-markdown":
|
|
1804
|
-
if (typeof
|
|
1991
|
+
if (typeof e == "string")
|
|
1805
1992
|
console.warn(
|
|
1806
1993
|
"You are using markdown for messages-widget, but you haven't registered a vue-markdown component"
|
|
1807
|
-
), r.push(
|
|
1994
|
+
), r.push(k("div", { class: [t.classes, a.extraClasses] }, a.componentBindings.source));
|
|
1808
1995
|
else {
|
|
1809
1996
|
const o = a.componentBindings;
|
|
1810
1997
|
r.push(
|
|
1811
|
-
|
|
1812
|
-
class: [
|
|
1998
|
+
k(e, {
|
|
1999
|
+
class: [t.classes, a.extraClasses, "df-messages-widget-markdown"],
|
|
1813
2000
|
source: o.source,
|
|
1814
2001
|
options: o.options,
|
|
1815
2002
|
plugins: o.plugins
|
|
@@ -1819,35 +2006,47 @@ const Ne = /* @__PURE__ */ ie({
|
|
|
1819
2006
|
break;
|
|
1820
2007
|
default:
|
|
1821
2008
|
r.push(
|
|
1822
|
-
|
|
1823
|
-
s.has(a.componentName.toLowerCase()) ? a.componentName :
|
|
1824
|
-
|
|
1825
|
-
class: [
|
|
1826
|
-
|
|
2009
|
+
k(
|
|
2010
|
+
s.has(a.componentName.toLowerCase()) ? a.componentName : ut(a.componentName),
|
|
2011
|
+
{
|
|
2012
|
+
class: [t.classes, a.extraClasses],
|
|
2013
|
+
...a.componentBindings,
|
|
2014
|
+
...a.componentBody ? { innerHTML: a.componentBody } : {}
|
|
2015
|
+
}
|
|
1827
2016
|
)
|
|
1828
2017
|
);
|
|
1829
2018
|
break;
|
|
1830
2019
|
}
|
|
1831
2020
|
}), r;
|
|
1832
2021
|
};
|
|
1833
|
-
return (r, a) => (
|
|
2022
|
+
return (r, a) => (zt(), Ht(i));
|
|
2023
|
+
}
|
|
2024
|
+
}), vt = /* @__PURE__ */ new WeakMap(), Ae = (n) => ({
|
|
2025
|
+
get(t, e, s) {
|
|
2026
|
+
return n(), Reflect.get(t, e, s);
|
|
2027
|
+
},
|
|
2028
|
+
has(t, e) {
|
|
2029
|
+
return n(), Reflect.has(t, e);
|
|
2030
|
+
},
|
|
2031
|
+
ownKeys(t) {
|
|
2032
|
+
return n(), Reflect.ownKeys(t);
|
|
2033
|
+
},
|
|
2034
|
+
getOwnPropertyDescriptor(t, e) {
|
|
2035
|
+
return n(), Reflect.getOwnPropertyDescriptor(t, e);
|
|
2036
|
+
},
|
|
2037
|
+
set(t, e) {
|
|
2038
|
+
throw new TypeError(`fields.${String(e)} cannot be assigned: use addField() to give the group a member`);
|
|
2039
|
+
},
|
|
2040
|
+
defineProperty(t, e) {
|
|
2041
|
+
throw new TypeError(`fields.${String(e)} cannot be redefined: use addField() to give the group a member`);
|
|
2042
|
+
},
|
|
2043
|
+
deleteProperty(t, e) {
|
|
2044
|
+
throw new TypeError(`fields.${String(e)} cannot be deleted: use removeField() to take a member out`);
|
|
1834
2045
|
}
|
|
1835
2046
|
});
|
|
1836
|
-
class
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
d(this, "_fields");
|
|
1840
|
-
if (!w.isValidFields(t)) throw new Error("Invalid fields object provided");
|
|
1841
|
-
this._fields = /* @__PURE__ */ Object.create(null), g(() => {
|
|
1842
|
-
var a;
|
|
1843
|
-
if (Object.entries(t).forEach(([o, u]) => this.addField(o, u)), s) {
|
|
1844
|
-
const r = s, { value: o, validators: u, actions: c } = r, x = k(r, ["value", "validators", "actions"]);
|
|
1845
|
-
this.registerInitialActions([...u || [], ...c || []]), this.assignParams(x), o !== void 0 ? this.assignMembers(o) : this.originalValue !== void 0 && this.assignMembers(this.originalValue);
|
|
1846
|
-
}
|
|
1847
|
-
this.completeRecords();
|
|
1848
|
-
const i = this.value;
|
|
1849
|
-
this.originalValue === void 0 && (this.originalValue = w.baseline(i)), this.raw.announcedValue = i, (a = this._actions) == null || a.triggerEager(this, i, this.originalValue), this.validate();
|
|
1850
|
-
});
|
|
2047
|
+
class d extends y {
|
|
2048
|
+
get [Symbol.toStringTag]() {
|
|
2049
|
+
return "Group";
|
|
1851
2050
|
}
|
|
1852
2051
|
get state() {
|
|
1853
2052
|
return super.state;
|
|
@@ -1855,51 +2054,126 @@ class w extends A {
|
|
|
1855
2054
|
get raw() {
|
|
1856
2055
|
return super.raw;
|
|
1857
2056
|
}
|
|
2057
|
+
_fields;
|
|
2058
|
+
constructor(t, e) {
|
|
2059
|
+
if (super(Ee()), !d.isValidFields(t)) throw new Error("Invalid fields object provided");
|
|
2060
|
+
this._fields = /* @__PURE__ */ Object.create(null), u(() => {
|
|
2061
|
+
if (Object.entries(t).forEach(([i, r]) => this.addField(i, r)), e) {
|
|
2062
|
+
const { value: i, validators: r, actions: a, ...o } = e;
|
|
2063
|
+
this.registerInitialActions([...r || [], ...a || []]), this.assignParams(o), i !== void 0 ? this.assignMembers(i) : this.originalValue !== void 0 && this.assignMembers(this.originalValue);
|
|
2064
|
+
}
|
|
2065
|
+
this.completeRecords();
|
|
2066
|
+
const s = this.value;
|
|
2067
|
+
this.originalValue === void 0 && (this.originalValue = d.baseline(s)), this.raw.announcedValue = s, this.boundActions?.triggerEager(this, s, this.originalValue), this.validate();
|
|
2068
|
+
});
|
|
2069
|
+
}
|
|
2070
|
+
/**
|
|
2071
|
+
* The name array is copied as well: a rollback puts back the set of members the group held, not the array it
|
|
2072
|
+
* went on to hold.
|
|
2073
|
+
*/
|
|
2074
|
+
[O]() {
|
|
2075
|
+
const t = super[O]();
|
|
2076
|
+
return t.fieldNames = [...this.raw.fieldNames], t;
|
|
2077
|
+
}
|
|
1858
2078
|
/**
|
|
1859
2079
|
* The copy of a built value that serves as a baseline. The value getter hands out one object per version, and
|
|
1860
2080
|
* a baseline holding that same object would report every value as its own original.
|
|
1861
2081
|
*/
|
|
1862
2082
|
static baseline(t) {
|
|
1863
|
-
return t == null ? t :
|
|
2083
|
+
return t == null ? t : { ...t };
|
|
1864
2084
|
}
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
2085
|
+
/**
|
|
2086
|
+
* Takes `field` into this group under `fieldName`. The group ends up holding it exactly as it holds a field the
|
|
2087
|
+
* constructor was given: the field carries the back-reference and the name, its verdict counts towards the
|
|
2088
|
+
* group's, and a rule of the field's that names another member of the form reaches it here.
|
|
2089
|
+
*
|
|
2090
|
+
* The change is announced through the ordinary path, so a group whose value the new field adds to says so once
|
|
2091
|
+
* the transaction closes, and its verdict is re-formed over the members it now holds. The baseline behind
|
|
2092
|
+
* `isChanged` is not rewritten: a group that gains a field holds something its original value does not carry,
|
|
2093
|
+
* and reports itself changed until `originalValue` is written.
|
|
2094
|
+
*
|
|
2095
|
+
* @throws Error where this group already holds a field under `fieldName`.
|
|
2096
|
+
* @throws TypeError where `field` already belongs to a container - pass a `bind()` of it instead.
|
|
2097
|
+
*/
|
|
2098
|
+
addField(t, e) {
|
|
2099
|
+
return u((s) => {
|
|
2100
|
+
if (Object.hasOwn(this._fields, t))
|
|
2101
|
+
throw new Error(`Field ${t} is already in this form`);
|
|
2102
|
+
this.takeChild(e, t), s.touch(this), d.setEntry(this._fields, t, e), s.whenRolledBack(() => d.dropEntry(this._fields, t)), this.state.fieldNames.push(t), this.completeRecords(e), this.bumpValueVersion(), this.notifyValueChanged();
|
|
2103
|
+
}), this;
|
|
2104
|
+
}
|
|
2105
|
+
/**
|
|
2106
|
+
* Takes the field held under `fieldName` out of this group and hands it back, answering undefined where the
|
|
2107
|
+
* group holds no field of that name. The field is released whole: the back-reference and the name are gone, its
|
|
2108
|
+
* verdict and its runs in flight no longer count towards the group's, and it is free to be taken by another
|
|
2109
|
+
* container. What it holds - its value, its errors, the change history behind `isChanged` - is its own to report.
|
|
2110
|
+
*
|
|
2111
|
+
* The change is announced through the ordinary path, so the group's value and verdict settle over the members it
|
|
2112
|
+
* has left. The baseline behind `isChanged` is not rewritten, the same way it is not on `addField`.
|
|
2113
|
+
*/
|
|
2114
|
+
removeField(t) {
|
|
2115
|
+
let e;
|
|
2116
|
+
return u((s) => {
|
|
2117
|
+
if (!Object.hasOwn(this._fields, t)) return;
|
|
2118
|
+
const i = this._fields[t];
|
|
2119
|
+
s.touch(this), this.releaseChild(i), d.dropEntry(this._fields, t), s.whenRolledBack(() => d.setEntry(this._fields, t, i)), this.state.fieldNames.splice(this.state.fieldNames.indexOf(t), 1), this.bumpValueVersion(), this.notifyValueChanged(), e = i;
|
|
2120
|
+
}), e;
|
|
2121
|
+
}
|
|
2122
|
+
/**
|
|
2123
|
+
* Writes one entry of the member map. The map is typed by the fields interface, which names the members a group
|
|
2124
|
+
* of that type holds and no others, so both here and in dropEntry it is reached as the plain record it is.
|
|
2125
|
+
*/
|
|
2126
|
+
static setEntry(t, e, s) {
|
|
2127
|
+
t[e] = s;
|
|
2128
|
+
}
|
|
2129
|
+
/** Drops one entry out of the member map. */
|
|
2130
|
+
static dropEntry(t, e) {
|
|
2131
|
+
delete t[e];
|
|
1869
2132
|
}
|
|
1870
2133
|
static isValidFields(t) {
|
|
1871
|
-
function s
|
|
1872
|
-
return
|
|
2134
|
+
function e(s) {
|
|
2135
|
+
return s instanceof y;
|
|
1873
2136
|
}
|
|
1874
|
-
return typeof t == "object" && t !== null && Object.entries(t).every(([,
|
|
2137
|
+
return typeof t == "object" && t !== null && Object.entries(t).every(([, s]) => e(s));
|
|
1875
2138
|
}
|
|
1876
2139
|
static createFromFormData(t) {
|
|
1877
|
-
if (t instanceof
|
|
2140
|
+
if (t instanceof y)
|
|
1878
2141
|
throw new Error("data is already a Form structure, should be a simple object");
|
|
1879
|
-
return new
|
|
1880
|
-
t == null ? {} : Object.fromEntries(Object.entries(t).map(([
|
|
2142
|
+
return new d(
|
|
2143
|
+
t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, s]) => [e, new st({ value: s })]))
|
|
1881
2144
|
);
|
|
1882
2145
|
}
|
|
1883
2146
|
field(t) {
|
|
1884
|
-
|
|
1885
|
-
return (s = this._fields[t]) != null ? s : null;
|
|
2147
|
+
return this._fields[t] ?? null;
|
|
1886
2148
|
}
|
|
2149
|
+
/**
|
|
2150
|
+
* The typed map of this group's members. What it hands out is a view over the map the group holds: reading it
|
|
2151
|
+
* reaches the members themselves, and every write to it is refused - addField() and removeField() are what
|
|
2152
|
+
* change the set. The view is built the first time something asks for it.
|
|
2153
|
+
*
|
|
2154
|
+
* Reading through it is a tracked read of the set of members, so a template rendering off `group.fields`
|
|
2155
|
+
* re-renders when a field is added or removed; what a member itself holds is tracked by that member.
|
|
2156
|
+
*/
|
|
1887
2157
|
get fields() {
|
|
1888
|
-
|
|
2158
|
+
let t = vt.get(this);
|
|
2159
|
+
return t || (t = new Proxy(
|
|
2160
|
+
this._fields,
|
|
2161
|
+
Ae(() => this.state.fieldNames.length)
|
|
2162
|
+
), vt.set(this, t)), t;
|
|
1889
2163
|
}
|
|
1890
2164
|
get members() {
|
|
1891
|
-
return
|
|
2165
|
+
return this.raw.fieldNames.map((t) => this._fields[t]);
|
|
1892
2166
|
}
|
|
1893
2167
|
get value() {
|
|
1894
2168
|
const t = this.valueVersion;
|
|
1895
2169
|
if (this.raw.cachedValueVersion === t) return this.raw.cachedValue;
|
|
1896
|
-
const
|
|
1897
|
-
Object.entries(this._fields).forEach(([
|
|
1898
|
-
const
|
|
1899
|
-
(
|
|
2170
|
+
const e = /* @__PURE__ */ Object.create(null);
|
|
2171
|
+
Object.entries(this._fields).forEach(([i, r]) => {
|
|
2172
|
+
const a = r.value;
|
|
2173
|
+
(r.enabled || this.childComposesValue(r) && !_(a)) && (e[i] = a);
|
|
1900
2174
|
});
|
|
1901
|
-
const
|
|
1902
|
-
return this.raw.cachedValue =
|
|
2175
|
+
const s = _(e) ? null : Object.freeze({ ...e });
|
|
2176
|
+
return this.raw.cachedValue = s, this.raw.cachedValueVersion = t, s;
|
|
1903
2177
|
}
|
|
1904
2178
|
/**
|
|
1905
2179
|
* Writes the members that the given value carries. The members are written one by one and the group says
|
|
@@ -1907,15 +2181,15 @@ class w extends A {
|
|
|
1907
2181
|
* once, over the finished set, and announces each at most once.
|
|
1908
2182
|
*/
|
|
1909
2183
|
assignMembers(t) {
|
|
1910
|
-
|
|
1911
|
-
Object.entries(this._fields).forEach(([
|
|
1912
|
-
(t == null || Object.hasOwn(t,
|
|
2184
|
+
u(() => {
|
|
2185
|
+
Object.entries(this._fields).forEach(([e, s]) => {
|
|
2186
|
+
(t == null || Object.hasOwn(t, e)) && (s.value = t == null ? null : t[e]);
|
|
1913
2187
|
});
|
|
1914
2188
|
});
|
|
1915
2189
|
}
|
|
1916
2190
|
set value(t) {
|
|
1917
|
-
|
|
1918
|
-
this.assignMembers(t),
|
|
2191
|
+
u((e) => {
|
|
2192
|
+
this.assignMembers(t), e.markValidityDirty(this);
|
|
1919
2193
|
});
|
|
1920
2194
|
}
|
|
1921
2195
|
/**
|
|
@@ -1923,33 +2197,32 @@ class w extends A {
|
|
|
1923
2197
|
* value carries, while a member the value leaves out has to end up holding what the template gives it. `source`
|
|
1924
2198
|
* supplies that per member, so a group reset from the template it was bound from matches a fresh binding of it.
|
|
1925
2199
|
*/
|
|
1926
|
-
resetTo(t,
|
|
1927
|
-
const
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
s === null ? c = null : s !== void 0 && Object.hasOwn(s, o) && (c = s[o]), this.resetChild(u, (x = i.field(o)) != null ? x : u, c);
|
|
2200
|
+
resetTo(t, e) {
|
|
2201
|
+
const s = t;
|
|
2202
|
+
u((i) => {
|
|
2203
|
+
i.touch(this), this.errors.length && (this.errors = []), Object.entries(this._fields).forEach(([a, o]) => {
|
|
2204
|
+
let l;
|
|
2205
|
+
e === null ? l = null : e !== void 0 && Object.hasOwn(e, a) && (l = e[a]), this.resetChild(o, s.field(a) ?? o, l);
|
|
1933
2206
|
});
|
|
1934
|
-
const
|
|
1935
|
-
this.raw.announcedValue =
|
|
2207
|
+
const r = this.value;
|
|
2208
|
+
this.raw.announcedValue = r, this.originalValue = d.baseline(r), super.validate(!0);
|
|
1936
2209
|
});
|
|
1937
2210
|
}
|
|
1938
2211
|
get touched() {
|
|
1939
2212
|
return Object.values(this._fields).some((t) => t.touched);
|
|
1940
2213
|
}
|
|
1941
2214
|
set touched(t) {
|
|
1942
|
-
|
|
1943
|
-
Object.values(this._fields).forEach((
|
|
1944
|
-
|
|
2215
|
+
u(() => {
|
|
2216
|
+
Object.values(this._fields).forEach((e) => {
|
|
2217
|
+
e.touched = t;
|
|
1945
2218
|
});
|
|
1946
2219
|
});
|
|
1947
2220
|
}
|
|
1948
2221
|
get fullValue() {
|
|
1949
2222
|
const t = /* @__PURE__ */ Object.create(null);
|
|
1950
|
-
return Object.entries(this._fields).forEach(([
|
|
1951
|
-
t[
|
|
1952
|
-
}),
|
|
2223
|
+
return Object.entries(this._fields).forEach(([e, s]) => {
|
|
2224
|
+
t[e] = s.fullValue;
|
|
2225
|
+
}), { ...t };
|
|
1953
2226
|
}
|
|
1954
2227
|
/**
|
|
1955
2228
|
* Records that a member changed its value, so that the transaction in progress works out at commit what this
|
|
@@ -1973,27 +2246,45 @@ class w extends A {
|
|
|
1973
2246
|
return this.validRead;
|
|
1974
2247
|
}
|
|
1975
2248
|
composeValid() {
|
|
1976
|
-
return this.state.errors.length === 0 &&
|
|
2249
|
+
return this.state.errors.length === 0 && this.state.fieldNames.every((t) => this._fields[t].valid);
|
|
2250
|
+
}
|
|
2251
|
+
get busy() {
|
|
2252
|
+
return this.busyRead;
|
|
2253
|
+
}
|
|
2254
|
+
composeBusy() {
|
|
2255
|
+
return this.state.fieldNames.some((t) => this._fields[t].busy);
|
|
1977
2256
|
}
|
|
1978
2257
|
validate(t = !1) {
|
|
1979
|
-
|
|
1980
|
-
t && Object.values(this._fields).forEach((
|
|
2258
|
+
u(() => {
|
|
2259
|
+
t && Object.values(this._fields).forEach((e) => e.validate(!0)), super.validate(t);
|
|
1981
2260
|
});
|
|
1982
2261
|
}
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
2262
|
+
/**
|
|
2263
|
+
* States that `res` was built from the members handed to it. A subclass whose constructor takes something other
|
|
2264
|
+
* than `(fields, params)` - one that composes its own members and passes them to super - never sees them, and
|
|
2265
|
+
* would answer with a binding carrying the declaration's data instead of the record's. That is a difference no
|
|
2266
|
+
* reader would find, so it is refused here rather than returned.
|
|
2267
|
+
*/
|
|
2268
|
+
static assertTookFields(t, e, s) {
|
|
2269
|
+
const i = Object.entries(e), r = t.raw.fieldNames;
|
|
2270
|
+
if (!(i.length === r.length && i.every(([a, o]) => t._fields[a] === o)))
|
|
2271
|
+
throw new TypeError(
|
|
2272
|
+
`${s}.bind() built an element that did not take the members it was given, so the binding would carry the declaration's data. A subclass whose constructor does not take (fields, params) has to override bind() and construct itself.`
|
|
2273
|
+
);
|
|
2274
|
+
}
|
|
2275
|
+
bind(t, e) {
|
|
2276
|
+
const s = /* @__PURE__ */ Object.create(null);
|
|
2277
|
+
Object.entries(this._fields).forEach(([a, o]) => {
|
|
2278
|
+
s[a] = o.bind();
|
|
1988
2279
|
});
|
|
1989
|
-
const r = new
|
|
2280
|
+
const i = this.constructor, r = new i(s, {
|
|
1990
2281
|
// data is what the caller supplied, and undefined is not supplied; an explicit null is, and clears
|
|
1991
|
-
value: t !== void 0 ? t : this.value
|
|
1992
|
-
|
|
1993
|
-
enabled:
|
|
1994
|
-
visibility:
|
|
1995
|
-
})
|
|
1996
|
-
return r.boundFrom(this, r.raw.announcedValue, r.originalValue,
|
|
2282
|
+
value: t !== void 0 ? t : this.value,
|
|
2283
|
+
...e && "originalValue" in e ? { originalValue: e.originalValue } : {},
|
|
2284
|
+
enabled: e?.enabled ?? this.enabled,
|
|
2285
|
+
visibility: e?.visibility ?? this.visibility
|
|
2286
|
+
});
|
|
2287
|
+
return d.assertTookFields(r, s, this.constructor.name), r.boundFrom(this, r.raw.announcedValue, r.originalValue, e), r;
|
|
1997
2288
|
}
|
|
1998
2289
|
/**
|
|
1999
2290
|
* A record need not name every member: a key it leaves out is taken from the declaration, the same way a member
|
|
@@ -2003,18 +2294,9 @@ class w extends A {
|
|
|
2003
2294
|
return super.rebind(t);
|
|
2004
2295
|
}
|
|
2005
2296
|
}
|
|
2006
|
-
class
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
d(this, "_itemTemplate");
|
|
2010
|
-
this._itemTemplate = t, g(() => {
|
|
2011
|
-
var r;
|
|
2012
|
-
if (s) {
|
|
2013
|
-
const i = s, { value: a, validators: o, actions: u } = i, c = k(i, ["value", "validators", "actions"]);
|
|
2014
|
-
this.registerInitialActions([...o || [], ...u || []]), this.assignParams(c), a != null && this.setValueInternal(a);
|
|
2015
|
-
}
|
|
2016
|
-
this.originalValue === void 0 && (this.originalValue = D.baseline(this.value)), this.raw.announcedValue = this.value, (r = this._actions) == null || r.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
2017
|
-
});
|
|
2297
|
+
class F extends y {
|
|
2298
|
+
get [Symbol.toStringTag]() {
|
|
2299
|
+
return "List";
|
|
2018
2300
|
}
|
|
2019
2301
|
get state() {
|
|
2020
2302
|
return super.state;
|
|
@@ -2022,9 +2304,19 @@ class D extends A {
|
|
|
2022
2304
|
get raw() {
|
|
2023
2305
|
return super.raw;
|
|
2024
2306
|
}
|
|
2307
|
+
_itemTemplate;
|
|
2308
|
+
constructor(t, e) {
|
|
2309
|
+
super(Ce()), this._itemTemplate = t, u(() => {
|
|
2310
|
+
if (e) {
|
|
2311
|
+
const { value: s, validators: i, actions: r, ...a } = e;
|
|
2312
|
+
this.registerInitialActions([...i || [], ...r || []]), this.assignParams(a), s !== void 0 ? this.setValueInternal(s) : this.originalValue !== void 0 && this.setValueInternal(this.originalValue);
|
|
2313
|
+
}
|
|
2314
|
+
this.originalValue === void 0 && (this.originalValue = F.baseline(this.value)), this.raw.announcedValue = this.value, this.boundActions?.triggerEager(this, this.value, this.originalValue), this.validate();
|
|
2315
|
+
});
|
|
2316
|
+
}
|
|
2025
2317
|
/** The row array is copied as well: a rollback puts back the set the list held, not the array it went on to hold. */
|
|
2026
|
-
[
|
|
2027
|
-
const t = super[
|
|
2318
|
+
[O]() {
|
|
2319
|
+
const t = super[O]();
|
|
2028
2320
|
return t.rows = this.raw.rows ? [...this.raw.rows] : this.raw.rows, t;
|
|
2029
2321
|
}
|
|
2030
2322
|
/**
|
|
@@ -2035,8 +2327,8 @@ class D extends A {
|
|
|
2035
2327
|
return t == null ? t : [...t];
|
|
2036
2328
|
}
|
|
2037
2329
|
processSetValueItem(t) {
|
|
2038
|
-
let
|
|
2039
|
-
return t instanceof
|
|
2330
|
+
let e;
|
|
2331
|
+
return t instanceof d ? e = t : this._itemTemplate ? e = this._itemTemplate.bind(t) : e = d.createFromFormData(t), this.takeChild(e), this.completeRecords(e), e;
|
|
2040
2332
|
}
|
|
2041
2333
|
/**
|
|
2042
2334
|
* Builds the item that fills a gap left by an insert beyond the end of the list: the item template bound to its
|
|
@@ -2045,32 +2337,43 @@ class D extends A {
|
|
|
2045
2337
|
createPaddingItem() {
|
|
2046
2338
|
return this.processSetValueItem(this._itemTemplate ? this._itemTemplate.bind() : null);
|
|
2047
2339
|
}
|
|
2340
|
+
/** Records that the set of rows changed, so `items` rebuilds the frozen array it hands out at the next read. */
|
|
2341
|
+
rowsChanged() {
|
|
2342
|
+
this.state.rowsVersion++;
|
|
2343
|
+
}
|
|
2344
|
+
/** True where `next` is a different set of rows than `previous`: another count, or another row at a position. */
|
|
2345
|
+
static rowsDiffer(t, e) {
|
|
2346
|
+
const s = t ?? [], i = e ?? [];
|
|
2347
|
+
return s.length !== i.length || s.some((r, a) => r !== i[a]);
|
|
2348
|
+
}
|
|
2048
2349
|
setValueInternal(t) {
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2350
|
+
if (t != null && !Array.isArray(t))
|
|
2351
|
+
throw new TypeError("Invalid value provided: a list takes an array of rows, or null to empty it");
|
|
2352
|
+
u((e) => {
|
|
2353
|
+
e.touch(this);
|
|
2354
|
+
const s = this.raw.rows;
|
|
2355
|
+
if (t == null)
|
|
2052
2356
|
this.releaseRows(), this.state.rows = null;
|
|
2053
|
-
else
|
|
2054
|
-
const
|
|
2055
|
-
for (let
|
|
2056
|
-
const
|
|
2057
|
-
|
|
2357
|
+
else {
|
|
2358
|
+
const i = this.state.rows ?? [], r = new Array(t.length);
|
|
2359
|
+
for (let a = 0; a < t.length; a++) {
|
|
2360
|
+
const o = t[a], l = i[a];
|
|
2361
|
+
l && this._itemTemplate && !(o instanceof d) ? (this.resetChild(l, this._itemTemplate, o), r[a] = l) : (l && this.releaseChild(l), r[a] = this.processSetValueItem(o));
|
|
2058
2362
|
}
|
|
2059
|
-
for (let
|
|
2060
|
-
this.state.rows =
|
|
2363
|
+
for (let a = t.length; a < i.length; a++) this.releaseChild(i[a]);
|
|
2364
|
+
this.state.rows = r;
|
|
2061
2365
|
}
|
|
2062
|
-
this.bumpValueVersion();
|
|
2366
|
+
F.rowsDiffer(s, this.raw.rows) && this.rowsChanged(), this.bumpValueVersion();
|
|
2063
2367
|
});
|
|
2064
2368
|
}
|
|
2065
2369
|
get value() {
|
|
2066
|
-
var r;
|
|
2067
2370
|
const t = this.valueVersion;
|
|
2068
2371
|
if (this.raw.cachedValueVersion === t) return this.raw.cachedValue;
|
|
2069
|
-
const
|
|
2070
|
-
return this.raw.cachedValue =
|
|
2372
|
+
const e = this.state.rows?.map((i) => i.value), s = _(e) ? null : Object.freeze(e);
|
|
2373
|
+
return this.raw.cachedValue = s, this.raw.cachedValueVersion = t, s;
|
|
2071
2374
|
}
|
|
2072
2375
|
set value(t) {
|
|
2073
|
-
|
|
2376
|
+
u(() => {
|
|
2074
2377
|
this.setValueInternal(t), this.propagateValueChanged(!0);
|
|
2075
2378
|
});
|
|
2076
2379
|
}
|
|
@@ -2078,35 +2381,36 @@ class D extends A {
|
|
|
2078
2381
|
* The rows are taken from `source` where the caller supplied no value of its own, so a list nested in a row that
|
|
2079
2382
|
* a whole-list assignment reuses ends up holding what the template gives it rather than what it held before.
|
|
2080
2383
|
*/
|
|
2081
|
-
resetTo(t,
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
const
|
|
2085
|
-
this.raw.announcedValue =
|
|
2384
|
+
resetTo(t, e) {
|
|
2385
|
+
u((s) => {
|
|
2386
|
+
s.touch(this), this.errors.length && (this.errors = []), this.setValueInternal(e === void 0 ? t.value : e);
|
|
2387
|
+
const i = this.value;
|
|
2388
|
+
this.raw.announcedValue = i, this.originalValue = F.baseline(i), super.validate(!0);
|
|
2086
2389
|
});
|
|
2087
2390
|
}
|
|
2088
2391
|
get touched() {
|
|
2089
|
-
|
|
2090
|
-
return ((t = this.state.rows) == null ? void 0 : t.some((s) => s.touched)) || !1;
|
|
2392
|
+
return this.state.rows?.some((t) => t.touched) || !1;
|
|
2091
2393
|
}
|
|
2092
2394
|
set touched(t) {
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
i.touched = t;
|
|
2395
|
+
u(() => {
|
|
2396
|
+
this.state.rows?.forEach((e) => {
|
|
2397
|
+
e.touched = t;
|
|
2097
2398
|
});
|
|
2098
2399
|
});
|
|
2099
2400
|
}
|
|
2100
|
-
bind(t,
|
|
2101
|
-
|
|
2102
|
-
const i = new D((r = this._itemTemplate) == null ? void 0 : r.bind(), C(p({
|
|
2401
|
+
bind(t, e) {
|
|
2402
|
+
const s = this._itemTemplate?.bind(), i = this.constructor, r = new i(s, {
|
|
2103
2403
|
// data is what the caller supplied, and undefined is not supplied; an explicit null is, and clears
|
|
2104
|
-
value: [...(
|
|
2105
|
-
|
|
2106
|
-
enabled:
|
|
2107
|
-
visibility:
|
|
2108
|
-
})
|
|
2109
|
-
|
|
2404
|
+
value: [...(t !== void 0 ? t : this.value) ?? []],
|
|
2405
|
+
...e && "originalValue" in e ? { originalValue: e.originalValue } : {},
|
|
2406
|
+
enabled: e?.enabled ?? this.enabled,
|
|
2407
|
+
visibility: e?.visibility ?? this.visibility
|
|
2408
|
+
});
|
|
2409
|
+
if (r._itemTemplate !== s)
|
|
2410
|
+
throw new TypeError(
|
|
2411
|
+
`${this.constructor.name}.bind() built a list that did not take the item template it was given, so the binding would carry the declaration's rows. A subclass whose constructor does not take (itemTemplate, params) has to override bind() and construct itself.`
|
|
2412
|
+
);
|
|
2413
|
+
return r.boundFrom(this, r.value, r.originalValue, e), r;
|
|
2110
2414
|
}
|
|
2111
2415
|
/**
|
|
2112
2416
|
* Records that a row changed its value, so that the transaction in progress works out at commit what this
|
|
@@ -2130,103 +2434,130 @@ class D extends A {
|
|
|
2130
2434
|
return this.validRead;
|
|
2131
2435
|
}
|
|
2132
2436
|
composeValid() {
|
|
2133
|
-
|
|
2134
|
-
|
|
2437
|
+
return this.state.errors.length === 0 && (this.state.rows?.every((t) => t.valid) ?? !0);
|
|
2438
|
+
}
|
|
2439
|
+
get busy() {
|
|
2440
|
+
return this.busyRead;
|
|
2441
|
+
}
|
|
2442
|
+
composeBusy() {
|
|
2443
|
+
return this.state.rows?.some((t) => t.busy) ?? !1;
|
|
2135
2444
|
}
|
|
2136
2445
|
validate(t = !1) {
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
t && ((s = this.state.rows) == null || s.forEach((i) => i.validate(!0))), super.validate(t);
|
|
2446
|
+
u(() => {
|
|
2447
|
+
t && this.state.rows?.forEach((e) => e.validate(!0)), super.validate(t);
|
|
2140
2448
|
});
|
|
2141
2449
|
}
|
|
2142
2450
|
get members() {
|
|
2143
|
-
|
|
2144
|
-
|
|
2451
|
+
return this.raw.rows ?? [];
|
|
2452
|
+
}
|
|
2453
|
+
/**
|
|
2454
|
+
* How many rows this list holds. The read is tracked, so a template rendering off it re-renders as rows come and
|
|
2455
|
+
* go.
|
|
2456
|
+
*/
|
|
2457
|
+
/**
|
|
2458
|
+
* Every row of this list, each one built from all of its fields. Where `value` states what the list serializes -
|
|
2459
|
+
* rows composed of the fields that are enabled, and null where the list is empty - this states what the list
|
|
2460
|
+
* holds: the disabled fields are in it too, and an empty list reads back as an empty array rather than as null.
|
|
2461
|
+
*/
|
|
2462
|
+
get fullValue() {
|
|
2463
|
+
return (this.state.rows ?? []).map((t) => t.fullValue);
|
|
2464
|
+
}
|
|
2465
|
+
get length() {
|
|
2466
|
+
return this.state.rows?.length ?? 0;
|
|
2467
|
+
}
|
|
2468
|
+
/**
|
|
2469
|
+
* The rows this list holds, oldest position first. The array is a frozen copy: it states what the list held at
|
|
2470
|
+
* the read and nothing writes back through it - `push`, `insert`, `remove` and `clear` are what change the set -
|
|
2471
|
+
* so a caller may hold on to it. The rows in it are the live elements, so reading one reports what it holds now.
|
|
2472
|
+
*
|
|
2473
|
+
* The copy is built once per change of the set and handed to every reader until the next one: a write inside a
|
|
2474
|
+
* row changes what the list serializes without changing which rows it holds, and the array a reader took stays
|
|
2475
|
+
* the same one across such a write.
|
|
2476
|
+
*/
|
|
2477
|
+
get items() {
|
|
2478
|
+
const t = this.state.rowsVersion;
|
|
2479
|
+
return this.raw.cachedItemsVersion !== t && (this.raw.cachedItems = Object.freeze([...this.raw.rows ?? []]), this.raw.cachedItemsVersion = t), this.raw.cachedItems;
|
|
2145
2480
|
}
|
|
2146
2481
|
get(t) {
|
|
2147
2482
|
return this.state.rows != null ? this.state.rows[t] : void 0;
|
|
2148
2483
|
}
|
|
2149
2484
|
push(t) {
|
|
2150
|
-
|
|
2151
|
-
return this.insert(t, (i = (s = this.state.rows) == null ? void 0 : s.length) != null ? i : 0) + 1;
|
|
2485
|
+
return this.insert(t, this.state.rows?.length ?? 0) + 1;
|
|
2152
2486
|
}
|
|
2153
2487
|
pop() {
|
|
2154
|
-
|
|
2155
|
-
return this.remove(((s = (t = this.state.rows) == null ? void 0 : t.length) != null ? s : 0) - 1);
|
|
2488
|
+
return this.remove((this.state.rows?.length ?? 0) - 1);
|
|
2156
2489
|
}
|
|
2157
2490
|
remove(t) {
|
|
2158
|
-
let
|
|
2159
|
-
return
|
|
2160
|
-
var a;
|
|
2491
|
+
let e;
|
|
2492
|
+
return u((s) => {
|
|
2161
2493
|
if (this.state.rows == null || t < 0 || this.state.rows.length <= t) return;
|
|
2162
|
-
|
|
2163
|
-
const
|
|
2164
|
-
|
|
2165
|
-
}),
|
|
2166
|
-
}
|
|
2167
|
-
insert(t,
|
|
2168
|
-
let
|
|
2169
|
-
return
|
|
2170
|
-
for (
|
|
2171
|
-
const
|
|
2172
|
-
this.bumpValueVersion(),
|
|
2494
|
+
s.touch(this);
|
|
2495
|
+
const i = this.state.rows.splice(t, 1)?.[0];
|
|
2496
|
+
i && (this.releaseChild(i), this.rowsChanged(), this.bumpValueVersion(), e = i, s.recordStructural(this, { actionClass: Bt, item: e, index: t }), this.propagateValueChanged(!0));
|
|
2497
|
+
}), e;
|
|
2498
|
+
}
|
|
2499
|
+
insert(t, e) {
|
|
2500
|
+
let s = 0;
|
|
2501
|
+
return u((i) => {
|
|
2502
|
+
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
|
+
const a = this.createPaddingItem(), o = this.state.rows.push(a) - 1;
|
|
2504
|
+
this.bumpValueVersion(), i.recordStructural(this, { actionClass: J, item: a, index: o });
|
|
2173
2505
|
}
|
|
2174
|
-
const
|
|
2175
|
-
this.state.rows.splice(
|
|
2176
|
-
}),
|
|
2506
|
+
const r = this.processSetValueItem(t);
|
|
2507
|
+
this.state.rows.splice(s, 0, r), i.recordStructural(this, { actionClass: J, item: r, index: s }), this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(!0);
|
|
2508
|
+
}), s;
|
|
2177
2509
|
}
|
|
2178
2510
|
/** Drops every row this list holds out of its tally, so a row that changes its verdict later is not counted. */
|
|
2179
2511
|
releaseRows() {
|
|
2180
|
-
|
|
2181
|
-
(t = this.state.rows) == null || t.forEach((s) => this.releaseChild(s));
|
|
2512
|
+
this.state.rows?.forEach((t) => this.releaseChild(t));
|
|
2182
2513
|
}
|
|
2183
2514
|
clear() {
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
t.touch(this), this.releaseRows(), this.state.rows = null, this.bumpValueVersion(), this.propagateValueChanged(s);
|
|
2515
|
+
u((t) => {
|
|
2516
|
+
const e = (this.state.rows?.length ?? 0) > 0;
|
|
2517
|
+
t.touch(this), this.releaseRows(), this.state.rows = null, e && this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(e);
|
|
2188
2518
|
});
|
|
2189
2519
|
}
|
|
2190
2520
|
}
|
|
2191
|
-
class
|
|
2192
|
-
constructor(t,
|
|
2193
|
-
|
|
2194
|
-
this.comparisonState(
|
|
2195
|
-
const
|
|
2196
|
-
return
|
|
2197
|
-
new
|
|
2198
|
-
this.replacePlaceholders(
|
|
2521
|
+
class Ie extends f {
|
|
2522
|
+
constructor(t, e, s) {
|
|
2523
|
+
const i = (r, a, o) => {
|
|
2524
|
+
this.comparisonState(o).oldValue = a;
|
|
2525
|
+
const l = this.resolve(o);
|
|
2526
|
+
return l ? (this.listenOn(l), this.isValidComparison(h(r), h(l.value)) ? null : [
|
|
2527
|
+
new g(
|
|
2528
|
+
this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, otherField: l }),
|
|
2529
|
+
"",
|
|
2530
|
+
"compare-to"
|
|
2199
2531
|
)
|
|
2200
|
-
]) : (
|
|
2201
|
-
}
|
|
2202
|
-
|
|
2203
|
-
d(this, "otherField");
|
|
2204
|
-
/**
|
|
2205
|
-
* The fields this validator is registered on. Registration reaches one element at a time - the rows of a list
|
|
2206
|
-
* take the validator on one by one, as they are built from the item template that carries it - so this is what
|
|
2207
|
-
* says which of the fields a declaration stands for actually carry the rule, and a field that never took it on
|
|
2208
|
-
* is left alone by a change of the compared field.
|
|
2209
|
-
*/
|
|
2210
|
-
d(this, "registrations", /* @__PURE__ */ new WeakSet());
|
|
2211
|
-
/**
|
|
2212
|
-
* The fields this validator has installed its listener on. A binding of such a field carries the listener too -
|
|
2213
|
-
* a binding takes on the actions of the field it was bound from - so the field it was bound from is what is
|
|
2214
|
-
* asked about as well, and a list of a thousand rows installs one listener rather than a thousand.
|
|
2215
|
-
*/
|
|
2216
|
-
d(this, "listening", /* @__PURE__ */ new WeakSet());
|
|
2217
|
-
/**
|
|
2218
|
-
* What the fields this validator was registered on were declared as. One entry stands for every binding of such a
|
|
2219
|
-
* field, so a change of a compared field finds the fields of the record that change happened in without a list
|
|
2220
|
-
* of a thousand rows being held here.
|
|
2221
|
-
*/
|
|
2222
|
-
d(this, "declarations", /* @__PURE__ */ new Set());
|
|
2223
|
-
this.isValidComparison = s, this.otherField = t;
|
|
2532
|
+
]) : (o.markRecordIncomplete(), null);
|
|
2533
|
+
};
|
|
2534
|
+
super(i), this.isValidComparison = e, this.otherField = t;
|
|
2224
2535
|
}
|
|
2536
|
+
isValidComparison;
|
|
2537
|
+
otherField;
|
|
2538
|
+
/**
|
|
2539
|
+
* The fields this validator is registered on. Registration reaches one element at a time - the rows of a list
|
|
2540
|
+
* take the validator on one by one, as they are built from the item template that carries it - so this is what
|
|
2541
|
+
* says which of the fields a declaration stands for actually carry the rule, and a field that never took it on
|
|
2542
|
+
* is left alone by a change of the compared field.
|
|
2543
|
+
*/
|
|
2544
|
+
registrations = /* @__PURE__ */ new WeakSet();
|
|
2545
|
+
/**
|
|
2546
|
+
* The fields this validator has installed its listener on. A binding of such a field carries the listener too -
|
|
2547
|
+
* a binding takes on the actions of the field it was bound from - so the field it was bound from is what is
|
|
2548
|
+
* asked about as well, and a list of a thousand rows installs one listener rather than a thousand.
|
|
2549
|
+
*/
|
|
2550
|
+
listening = /* @__PURE__ */ new WeakSet();
|
|
2551
|
+
/**
|
|
2552
|
+
* What the fields this validator was registered on were declared as. One entry stands for every binding of such a
|
|
2553
|
+
* field, so a change of a compared field finds the fields of the record that change happened in without a list
|
|
2554
|
+
* of a thousand rows being held here.
|
|
2555
|
+
*/
|
|
2556
|
+
declarations = /* @__PURE__ */ new Set();
|
|
2225
2557
|
/** The field `field` is compared against, within the record `field` belongs to. */
|
|
2226
2558
|
resolve(t) {
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
return typeof s == "function" ? (i = s(t)) != null ? i : void 0 : typeof s == "string" ? pe(s, t) : lt(s, T(t));
|
|
2559
|
+
const e = this.otherField;
|
|
2560
|
+
return typeof e == "function" ? e(t) ?? void 0 : typeof e == "string" ? ae(e, t) : et(e, V(t));
|
|
2230
2561
|
}
|
|
2231
2562
|
/**
|
|
2232
2563
|
* Makes a change of `other` re-run this comparison. The listener re-runs it over the fields of the record the
|
|
@@ -2235,12 +2566,12 @@ class ke extends v {
|
|
|
2235
2566
|
*/
|
|
2236
2567
|
listenOn(t) {
|
|
2237
2568
|
this.listening.has(t) || this.listening.has(t.declaration) || (this.listening.add(t), t.registerAction(
|
|
2238
|
-
new
|
|
2239
|
-
|
|
2240
|
-
const
|
|
2569
|
+
new T((e, s, i, r) => {
|
|
2570
|
+
s(e, i, r);
|
|
2571
|
+
const a = V(e);
|
|
2241
2572
|
this.declarations.forEach(
|
|
2242
|
-
(
|
|
2243
|
-
this.registrations.has(
|
|
2573
|
+
(o) => kt(o, a).forEach((l) => {
|
|
2574
|
+
this.registrations.has(l) && this.execute(l, () => null, l.value, this.comparisonState(l).oldValue);
|
|
2244
2575
|
})
|
|
2245
2576
|
);
|
|
2246
2577
|
})
|
|
@@ -2253,196 +2584,242 @@ class ke extends v {
|
|
|
2253
2584
|
return this.bindingState(t);
|
|
2254
2585
|
}
|
|
2255
2586
|
newBindingState() {
|
|
2256
|
-
return
|
|
2587
|
+
return { ...super.newBindingState(), oldValue: void 0 };
|
|
2257
2588
|
}
|
|
2258
2589
|
unregisterFrom(t) {
|
|
2259
|
-
this.registrations.delete(t);
|
|
2590
|
+
super.unregisterFrom(t), this.registrations.delete(t);
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
class Te extends f {
|
|
2594
|
+
constructor(t, e) {
|
|
2595
|
+
const s = e || b("Must be one of [**{allowedAsText}**]"), i = () => {
|
|
2596
|
+
const o = h(t);
|
|
2597
|
+
return typeof o == "function" ? o() : o;
|
|
2598
|
+
}, r = (o) => {
|
|
2599
|
+
const l = o.join(", ");
|
|
2600
|
+
return l.length <= 60 ? l : Xt(l, { length: 40, separator: ", ", omission: `... (${o.length} items total)` });
|
|
2601
|
+
}, a = (o, l, v) => {
|
|
2602
|
+
const p = i();
|
|
2603
|
+
return p.includes(h(o)) ? null : [
|
|
2604
|
+
new g(
|
|
2605
|
+
this.replacePlaceholders(s, {
|
|
2606
|
+
newValue: o,
|
|
2607
|
+
oldValue: l,
|
|
2608
|
+
field: v,
|
|
2609
|
+
allowedValues: p,
|
|
2610
|
+
allowedAsText: r(p)
|
|
2611
|
+
}),
|
|
2612
|
+
"",
|
|
2613
|
+
"in-allowed-values"
|
|
2614
|
+
)
|
|
2615
|
+
];
|
|
2616
|
+
};
|
|
2617
|
+
super(a);
|
|
2260
2618
|
}
|
|
2261
2619
|
}
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
const s = t || E("Must be one of [**{allowedAsText}**]");
|
|
2265
|
-
let i = e.join(", ");
|
|
2266
|
-
i.length > 60 && (i = Zt(i, {
|
|
2267
|
-
length: 40,
|
|
2268
|
-
separator: ", ",
|
|
2269
|
-
omission: `... (${e.length} items total)`
|
|
2270
|
-
}));
|
|
2271
|
-
const r = (a, o, u) => e.includes(b(a)) ? null : [
|
|
2272
|
-
new V(
|
|
2273
|
-
this.replacePlaceholders(s, { newValue: a, oldValue: o, field: u, allowedValues: e, allowedAsText: i })
|
|
2274
|
-
)
|
|
2275
|
-
];
|
|
2276
|
-
super(r);
|
|
2277
|
-
}
|
|
2620
|
+
function Oe(n) {
|
|
2621
|
+
return n == null ? 0 : yt(n) || C(n) ? n.length : Et(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
|
|
2278
2622
|
}
|
|
2279
|
-
function
|
|
2280
|
-
return n ==
|
|
2623
|
+
function wt(n) {
|
|
2624
|
+
return typeof n == "object" && n !== null && !Vt(n) && !(n instanceof String) && !("componentName" in n);
|
|
2281
2625
|
}
|
|
2282
|
-
class
|
|
2283
|
-
constructor(e) {
|
|
2284
|
-
const
|
|
2285
|
-
|
|
2626
|
+
class ke extends f {
|
|
2627
|
+
constructor(t, e) {
|
|
2628
|
+
const s = wt(t) ? void 0 : t, i = (wt(t) ? t : e)?.trim ?? !0, r = s || b("Please enter a value"), a = (o, l, v) => {
|
|
2629
|
+
const p = h(o);
|
|
2630
|
+
return Oe(i && C(p) ? p.trim() : p) === 0 ? [
|
|
2631
|
+
new g(
|
|
2632
|
+
this.replacePlaceholders(r, { newValue: o, oldValue: l, field: v }),
|
|
2633
|
+
"",
|
|
2634
|
+
"required"
|
|
2635
|
+
)
|
|
2636
|
+
] : null;
|
|
2637
|
+
};
|
|
2638
|
+
super(a);
|
|
2286
2639
|
}
|
|
2287
2640
|
}
|
|
2288
|
-
class
|
|
2289
|
-
constructor(
|
|
2290
|
-
const s =
|
|
2291
|
-
new
|
|
2641
|
+
class Re extends f {
|
|
2642
|
+
constructor(t, e) {
|
|
2643
|
+
const s = e || b("Value must be larger or equal to **{minValue}**"), i = (r, a, o) => r < t || r === void 0 ? [
|
|
2644
|
+
new g(
|
|
2645
|
+
this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, minValue: t }),
|
|
2646
|
+
"",
|
|
2647
|
+
"min"
|
|
2648
|
+
)
|
|
2292
2649
|
] : null;
|
|
2293
2650
|
super(i);
|
|
2294
2651
|
}
|
|
2295
2652
|
}
|
|
2296
|
-
class
|
|
2297
|
-
constructor(
|
|
2298
|
-
const s =
|
|
2299
|
-
new
|
|
2653
|
+
class Fe extends f {
|
|
2654
|
+
constructor(t, e) {
|
|
2655
|
+
const s = e || b("Value must be less than or equal to **{maxValue}**"), i = (r, a, o) => r > t || r === void 0 ? [
|
|
2656
|
+
new g(
|
|
2657
|
+
this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, maxValue: t }),
|
|
2658
|
+
"",
|
|
2659
|
+
"max"
|
|
2660
|
+
)
|
|
2300
2661
|
] : null;
|
|
2301
2662
|
super(i);
|
|
2302
2663
|
}
|
|
2303
2664
|
}
|
|
2304
|
-
class
|
|
2305
|
-
constructor(
|
|
2306
|
-
const i = s ||
|
|
2307
|
-
new
|
|
2308
|
-
this.replacePlaceholders(i, { newValue: a, oldValue: o, field:
|
|
2665
|
+
class _e extends f {
|
|
2666
|
+
constructor(t, e, s) {
|
|
2667
|
+
const i = s || b("Value must be between **{minValue}** and **{maxValue}**"), r = (a, o, l) => a < t || a > e || a === void 0 ? [
|
|
2668
|
+
new g(
|
|
2669
|
+
this.replacePlaceholders(i, { newValue: a, oldValue: o, field: l, minValue: t, maxValue: e }),
|
|
2670
|
+
"",
|
|
2671
|
+
"range"
|
|
2309
2672
|
)
|
|
2310
2673
|
] : null;
|
|
2311
2674
|
super(r);
|
|
2312
2675
|
}
|
|
2313
2676
|
}
|
|
2314
|
-
function
|
|
2315
|
-
return n == null ? 0 :
|
|
2677
|
+
function it(n) {
|
|
2678
|
+
return n == null ? 0 : yt(n) || C(n) ? n.length : Et(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
|
|
2316
2679
|
}
|
|
2317
|
-
class
|
|
2318
|
-
constructor(
|
|
2319
|
-
const s =
|
|
2320
|
-
new
|
|
2680
|
+
class Pe extends f {
|
|
2681
|
+
constructor(t, e) {
|
|
2682
|
+
const s = e || b("Length must be larger or equal to **{minLength}**"), i = (r, a, o) => it(r) < t ? [
|
|
2683
|
+
new g(
|
|
2684
|
+
this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, minLength: t }),
|
|
2685
|
+
"",
|
|
2686
|
+
"min-length"
|
|
2687
|
+
)
|
|
2321
2688
|
] : null;
|
|
2322
2689
|
super(i);
|
|
2323
2690
|
}
|
|
2324
2691
|
}
|
|
2325
|
-
class
|
|
2326
|
-
constructor(
|
|
2327
|
-
const s =
|
|
2328
|
-
new
|
|
2692
|
+
class je extends f {
|
|
2693
|
+
constructor(t, e) {
|
|
2694
|
+
const s = e || b("Length must be less than or equal to **{maxLength}**"), i = (r, a, o) => it(r) > t ? [
|
|
2695
|
+
new g(
|
|
2696
|
+
this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, maxLength: t }),
|
|
2697
|
+
"",
|
|
2698
|
+
"max-length"
|
|
2699
|
+
)
|
|
2329
2700
|
] : null;
|
|
2330
2701
|
super(i);
|
|
2331
2702
|
}
|
|
2332
2703
|
}
|
|
2333
|
-
class
|
|
2334
|
-
constructor(
|
|
2335
|
-
const i = s ||
|
|
2336
|
-
const
|
|
2337
|
-
return
|
|
2338
|
-
new
|
|
2339
|
-
this.replacePlaceholders(i, { newValue: a, oldValue: o, field:
|
|
2704
|
+
class Ne extends f {
|
|
2705
|
+
constructor(t, e, s) {
|
|
2706
|
+
const i = s || b("Length must be between **{minLength}** and **{maxLength}**"), r = (a, o, l) => {
|
|
2707
|
+
const v = it(a);
|
|
2708
|
+
return v < t || v > e ? [
|
|
2709
|
+
new g(
|
|
2710
|
+
this.replacePlaceholders(i, { newValue: a, oldValue: o, field: l, minLength: t, maxLength: e }),
|
|
2711
|
+
"",
|
|
2712
|
+
"range-length"
|
|
2340
2713
|
)
|
|
2341
2714
|
] : null;
|
|
2342
2715
|
};
|
|
2343
2716
|
super(r);
|
|
2344
2717
|
}
|
|
2345
2718
|
}
|
|
2346
|
-
class
|
|
2347
|
-
constructor(
|
|
2348
|
-
const s =
|
|
2349
|
-
new
|
|
2719
|
+
class Be extends f {
|
|
2720
|
+
constructor(t, e) {
|
|
2721
|
+
const s = e || b('Value must match pattern "**{pattern}**"'), i = (r, a, o) => t.test(String(h(r))) ? null : [
|
|
2722
|
+
new g(
|
|
2723
|
+
this.replacePlaceholders(s, { newValue: r, oldValue: a, field: o, pattern: t }),
|
|
2724
|
+
"",
|
|
2725
|
+
"pattern"
|
|
2726
|
+
)
|
|
2350
2727
|
];
|
|
2351
2728
|
super(i);
|
|
2352
2729
|
}
|
|
2353
2730
|
}
|
|
2354
|
-
const
|
|
2731
|
+
const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2355
2732
|
__proto__: null,
|
|
2356
|
-
CompareTo:
|
|
2357
|
-
InAllowedValues:
|
|
2358
|
-
LengthInRange:
|
|
2359
|
-
MaxLength:
|
|
2360
|
-
MaxValue:
|
|
2361
|
-
MinLength:
|
|
2362
|
-
MinValue:
|
|
2363
|
-
Pattern:
|
|
2364
|
-
Required:
|
|
2365
|
-
Validator:
|
|
2366
|
-
ValueInRange:
|
|
2367
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2733
|
+
CompareTo: Ie,
|
|
2734
|
+
InAllowedValues: Te,
|
|
2735
|
+
LengthInRange: Ne,
|
|
2736
|
+
MaxLength: je,
|
|
2737
|
+
MaxValue: Fe,
|
|
2738
|
+
MinLength: Pe,
|
|
2739
|
+
MinValue: Re,
|
|
2740
|
+
Pattern: Be,
|
|
2741
|
+
Required: ke,
|
|
2742
|
+
Validator: f,
|
|
2743
|
+
ValueInRange: _e
|
|
2744
|
+
}, Symbol.toStringTag, { value: "Module" })), $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2368
2745
|
__proto__: null,
|
|
2369
|
-
AbortEventHandlingException:
|
|
2370
|
-
Action:
|
|
2371
|
-
ActionsMap:
|
|
2372
|
-
ConditionalEnabledAction:
|
|
2373
|
-
ConditionalStatementAction:
|
|
2374
|
-
ConditionalValueAction:
|
|
2375
|
-
ConditionalVisibilityAction:
|
|
2376
|
-
DisplayMode:
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
transaction: q
|
|
2746
|
+
AbortEventHandlingException: P,
|
|
2747
|
+
Action: Se,
|
|
2748
|
+
ActionsMap: M,
|
|
2749
|
+
ConditionalEnabledAction: ue,
|
|
2750
|
+
ConditionalStatementAction: U,
|
|
2751
|
+
ConditionalValueAction: ce,
|
|
2752
|
+
ConditionalVisibilityAction: le,
|
|
2753
|
+
DisplayMode: I,
|
|
2754
|
+
EnabledChangedAction: Ft,
|
|
2755
|
+
EnabledChangingAction: Rt,
|
|
2756
|
+
ExecuteAction: Nt,
|
|
2757
|
+
Field: st,
|
|
2758
|
+
FieldActionBase: m,
|
|
2759
|
+
FieldBase: y,
|
|
2760
|
+
Group: d,
|
|
2761
|
+
List: F,
|
|
2762
|
+
ListItemAddedAction: J,
|
|
2763
|
+
ListItemRemovedAction: Bt,
|
|
2764
|
+
MdString: j,
|
|
2765
|
+
MessagesWidget: xe,
|
|
2766
|
+
Operator: c,
|
|
2767
|
+
RenderableValue: se,
|
|
2768
|
+
Statement: w,
|
|
2769
|
+
ValidChangedAction: _t,
|
|
2770
|
+
ValidationError: tt,
|
|
2771
|
+
ValidationErrorRenderContent: g,
|
|
2772
|
+
ValidationErrorText: ee,
|
|
2773
|
+
Validators: De,
|
|
2774
|
+
ValueChangedAction: T,
|
|
2775
|
+
VisibilityChangedAction: jt,
|
|
2776
|
+
VisibilityChangingAction: Pt,
|
|
2777
|
+
buildErrorMessage: b,
|
|
2778
|
+
defaultDisplayMode: Kt,
|
|
2779
|
+
isCallableFunction: L,
|
|
2780
|
+
isSimpleComponentDef: G,
|
|
2781
|
+
transaction: Z
|
|
2406
2782
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2407
2783
|
export {
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
y as
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2784
|
+
P as AbortEventHandlingException,
|
|
2785
|
+
Se as Action,
|
|
2786
|
+
M as ActionsMap,
|
|
2787
|
+
ue as ConditionalEnabledAction,
|
|
2788
|
+
U as ConditionalStatementAction,
|
|
2789
|
+
ce as ConditionalValueAction,
|
|
2790
|
+
le as ConditionalVisibilityAction,
|
|
2791
|
+
I as DisplayMode,
|
|
2792
|
+
Ft as EnabledChangedAction,
|
|
2793
|
+
Rt as EnabledChangingAction,
|
|
2794
|
+
Nt as ExecuteAction,
|
|
2795
|
+
st as Field,
|
|
2796
|
+
m as FieldActionBase,
|
|
2797
|
+
y as FieldBase,
|
|
2798
|
+
d as Group,
|
|
2799
|
+
F as List,
|
|
2800
|
+
J as ListItemAddedAction,
|
|
2801
|
+
Bt as ListItemRemovedAction,
|
|
2802
|
+
j as MdString,
|
|
2803
|
+
xe as MessagesWidget,
|
|
2804
|
+
c as Operator,
|
|
2805
|
+
se as RenderableValue,
|
|
2806
|
+
w as Statement,
|
|
2807
|
+
_t as ValidChangedAction,
|
|
2808
|
+
tt as ValidationError,
|
|
2809
|
+
g as ValidationErrorRenderContent,
|
|
2810
|
+
ee as ValidationErrorText,
|
|
2811
|
+
De as Validators,
|
|
2812
|
+
T as ValueChangedAction,
|
|
2813
|
+
jt as VisibilityChangedAction,
|
|
2814
|
+
Pt as VisibilityChangingAction,
|
|
2815
|
+
b as buildErrorMessage,
|
|
2816
|
+
$e as default,
|
|
2817
|
+
Kt as defaultDisplayMode,
|
|
2818
|
+
Ue as forms,
|
|
2819
|
+
Gt as getConfig,
|
|
2820
|
+
L as isCallableFunction,
|
|
2821
|
+
G as isSimpleComponentDef,
|
|
2822
|
+
te as setConfig,
|
|
2823
|
+
Z as transaction
|
|
2447
2824
|
};
|
|
2448
2825
|
//# sourceMappingURL=dynamicforms-vue-forms.js.map
|