@dynamicforms/vue-forms 2.0.3 → 3.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/plugin-Ds_2fb9G.js +271 -0
- package/dist/chunks/plugin-Ds_2fb9G.js.map +1 -0
- package/dist/chunks/registry-2GP2P-ie.js +105 -0
- package/dist/chunks/registry-2GP2P-ie.js.map +1 -0
- package/dist/dynamicforms-vue-forms.js +1475 -996
- package/dist/dynamicforms-vue-forms.js.map +1 -1
- package/dist/index.d.ts +1382 -916
- package/dist/plugins/tracking.d.ts +61 -0
- package/dist/plugins/tracking.js +279 -0
- package/dist/plugins/tracking.js.map +1 -0
- package/package.json +13 -9
- package/readme.md +138 -200
- package/dist/dynamicforms-vue-forms.css +0 -2
|
@@ -1,79 +1,142 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { computed as
|
|
3
|
-
import { isArray as
|
|
1
|
+
import { c as e, f as t, h as n, i as r, l as i, m as a, p as o, s, u as c } from "./chunks/registry-2GP2P-ie.js";
|
|
2
|
+
import { computed as l, reactive as u, ref as d, shallowRef as f, toRaw as p, unref as m, watch as ee } from "vue";
|
|
3
|
+
import { isArray as te, isEmpty as ne, isEqual as h, isEqualWith as re, isObject as ie, isPlainObject as ae, isString as g, truncate as oe } from "lodash-es";
|
|
4
4
|
//#region \0rolldown/runtime.js
|
|
5
|
-
var
|
|
5
|
+
var se = Object.defineProperty, ce = (e, t) => {
|
|
6
6
|
let n = {};
|
|
7
|
-
for (var r in e)
|
|
7
|
+
for (var r in e) se(n, r, {
|
|
8
8
|
get: e[r],
|
|
9
9
|
enumerable: !0
|
|
10
10
|
});
|
|
11
|
-
return t ||
|
|
12
|
-
},
|
|
11
|
+
return t || se(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
12
|
+
}, _ = Object.freeze([
|
|
13
13
|
"editable",
|
|
14
14
|
"readonly",
|
|
15
15
|
"disabled",
|
|
16
16
|
"disabled-null"
|
|
17
|
-
]),
|
|
18
|
-
function
|
|
19
|
-
return
|
|
17
|
+
]), le = "editable";
|
|
18
|
+
function ue(e) {
|
|
19
|
+
return _.includes(e);
|
|
20
20
|
}
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/visibility.ts
|
|
23
|
-
var
|
|
23
|
+
var de = Object.freeze([
|
|
24
24
|
"full",
|
|
25
25
|
"invisible",
|
|
26
26
|
"hidden",
|
|
27
27
|
"suppress"
|
|
28
|
-
]),
|
|
29
|
-
function
|
|
30
|
-
return
|
|
28
|
+
]), fe = "full";
|
|
29
|
+
function pe(e) {
|
|
30
|
+
return de.includes(e);
|
|
31
31
|
}
|
|
32
32
|
//#endregion
|
|
33
|
-
//#region src/
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
get eager() {
|
|
53
|
-
return !1;
|
|
33
|
+
//#region src/plugins/devtools/api.ts
|
|
34
|
+
var me = !0, he = !0, ge, _e = !1;
|
|
35
|
+
function ve(t) {
|
|
36
|
+
_e ? import("./chunks/plugin-Ds_2fb9G.js").then((e) => e.installFor(t)) : (_e = !0, import("./chunks/plugin-Ds_2fb9G.js").then((t) => {
|
|
37
|
+
t.install(), e().forEach(({ element: e }) => t.installFor(e));
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
var ye = {
|
|
41
|
+
setup(e) {
|
|
42
|
+
n(e);
|
|
43
|
+
},
|
|
44
|
+
onElementCreated(e, t) {
|
|
45
|
+
t || (c(e, he), ve(e));
|
|
46
|
+
},
|
|
47
|
+
onElementAdopted(e) {
|
|
48
|
+
s(e);
|
|
49
|
+
},
|
|
50
|
+
onCommit() {
|
|
51
|
+
i();
|
|
54
52
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
};
|
|
54
|
+
function be() {
|
|
55
|
+
process.env.NODE_ENV !== "production" && me && !ge && typeof window < "u" && (ge = Pe(ye));
|
|
56
|
+
}
|
|
57
|
+
function xe(e, t) {
|
|
58
|
+
process.env.NODE_ENV !== "production" && r(e, t);
|
|
59
|
+
}
|
|
60
|
+
function Se(e, t = !0) {
|
|
61
|
+
process.env.NODE_ENV !== "production" && o(e, t);
|
|
62
|
+
}
|
|
63
|
+
function Ce(e) {
|
|
64
|
+
process.env.NODE_ENV !== "production" && (e.location !== void 0 && (he = e.location), e.registration !== void 0 && a(e.registration), e.enabled !== void 0 && (me = e.enabled, me || (ge?.(), ge = void 0), t(me)));
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/plugins.ts
|
|
68
|
+
var we = Symbol("Field.changeInPlace"), v = [], Te = [], Ee = [], De = [], Oe = [], ke = [], Ae = /* @__PURE__ */ new WeakSet(), je = 0, Me = {
|
|
69
|
+
changeInPlace(e, t, n, r) {
|
|
70
|
+
let i = e[we];
|
|
71
|
+
if (typeof i != "function") throw TypeError("changeInPlace: the element is not a Field");
|
|
72
|
+
i.call(e, t, n, r);
|
|
73
|
+
},
|
|
74
|
+
isInternal(e) {
|
|
75
|
+
return e.declaration !== e || Ae.has(e);
|
|
60
76
|
}
|
|
61
|
-
|
|
62
|
-
|
|
77
|
+
};
|
|
78
|
+
function Ne() {
|
|
79
|
+
Te = v.filter((e) => e.onSetValue), Ee = v.filter((e) => e.onSetOriginalValue), De = v.filter((e) => e.onElementCreated), Oe = v.filter((e) => e.onElementAdopted), ke = v.filter((e) => e.onCommit);
|
|
80
|
+
}
|
|
81
|
+
function Pe(e) {
|
|
82
|
+
v.push(e), Ne();
|
|
83
|
+
let t = () => {
|
|
84
|
+
let t = v.lastIndexOf(e);
|
|
85
|
+
t < 0 || (v.splice(t, 1), Ne());
|
|
86
|
+
};
|
|
87
|
+
try {
|
|
88
|
+
e.setup?.(Me);
|
|
89
|
+
} catch (e) {
|
|
90
|
+
throw t(), e;
|
|
63
91
|
}
|
|
64
|
-
|
|
65
|
-
|
|
92
|
+
return t;
|
|
93
|
+
}
|
|
94
|
+
function Fe(e, t) {
|
|
95
|
+
let n = t;
|
|
96
|
+
for (let t of Te) n = t.onSetValue(n, e);
|
|
97
|
+
return n;
|
|
98
|
+
}
|
|
99
|
+
function Ie(e, t) {
|
|
100
|
+
let n = t;
|
|
101
|
+
for (let t of Ee) n = t.onSetOriginalValue(n, e);
|
|
102
|
+
return n;
|
|
103
|
+
}
|
|
104
|
+
function Le(e) {
|
|
105
|
+
je++;
|
|
106
|
+
try {
|
|
107
|
+
return e();
|
|
108
|
+
} finally {
|
|
109
|
+
je--;
|
|
66
110
|
}
|
|
67
|
-
}
|
|
68
|
-
function
|
|
111
|
+
}
|
|
112
|
+
function Re(e) {
|
|
113
|
+
Ae.add(e);
|
|
114
|
+
}
|
|
115
|
+
function ze(e) {
|
|
116
|
+
process.env.NODE_ENV !== "production" && be();
|
|
117
|
+
let t = je > 0;
|
|
118
|
+
for (let n of De) n.onElementCreated(e, t);
|
|
119
|
+
}
|
|
120
|
+
function Be(e, t) {
|
|
121
|
+
Oe.length !== 0 && e.whenCommitted(() => {
|
|
122
|
+
for (let e of Oe) e.onElementAdopted(t);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function Ve() {
|
|
126
|
+
for (let e of ke) e.onCommit();
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/transaction.ts
|
|
130
|
+
var y = Symbol("Transaction.capture"), He = Symbol("FieldBase.sentNowhere"), Ue = Symbol("Transaction.restore"), We = Symbol("Transaction.announceValue"), Ge = Symbol("Transaction.settleValidity"), Ke = Symbol("Transaction.announceFlags");
|
|
131
|
+
function b(e) {
|
|
69
132
|
return e;
|
|
70
133
|
}
|
|
71
|
-
function
|
|
134
|
+
function qe(e) {
|
|
72
135
|
let t = 0, n = e.parent;
|
|
73
136
|
for (; n;) t++, n = n.parent;
|
|
74
137
|
return t;
|
|
75
138
|
}
|
|
76
|
-
var
|
|
139
|
+
var Je = class {
|
|
77
140
|
participants = /* @__PURE__ */ new Map();
|
|
78
141
|
undo = [];
|
|
79
142
|
settled = [];
|
|
@@ -89,17 +152,21 @@ var pe = class {
|
|
|
89
152
|
element: e,
|
|
90
153
|
valueDirty: !1,
|
|
91
154
|
forceValue: !1,
|
|
92
|
-
validityDirty: !1
|
|
155
|
+
validityDirty: !1,
|
|
156
|
+
flagsDirty: !1
|
|
93
157
|
}, this.participants.set(e, t)), t;
|
|
94
158
|
}
|
|
95
159
|
touch(e) {
|
|
96
160
|
let t = this.participant(e);
|
|
97
|
-
t.snapshot ||=
|
|
161
|
+
t.snapshot ||= b(e)[y]();
|
|
98
162
|
}
|
|
99
163
|
markValueChanged(e, t) {
|
|
100
164
|
let n = this.participant(e);
|
|
101
165
|
n.valueDirty = !0, t && (n.forceValue = !0), this.noteDepth(e);
|
|
102
166
|
}
|
|
167
|
+
markFlagsDirty(e) {
|
|
168
|
+
this.participant(e).flagsDirty = !0, this.noteDepth(e);
|
|
169
|
+
}
|
|
103
170
|
markValidityDirty(e) {
|
|
104
171
|
this.participant(e).validityDirty = !0, this.noteDepth(e);
|
|
105
172
|
}
|
|
@@ -117,25 +184,34 @@ var pe = class {
|
|
|
117
184
|
this.settled.push(e);
|
|
118
185
|
}
|
|
119
186
|
noteDepth(e) {
|
|
120
|
-
this.passDepth < 0 ||
|
|
187
|
+
this.passDepth < 0 || qe(e) >= this.passDepth && (this.restartPass = !0);
|
|
121
188
|
}
|
|
122
189
|
rollback() {
|
|
123
190
|
this.unwound = !0, [...this.participants.values()].reverse().forEach((e) => {
|
|
124
|
-
e.snapshot &&
|
|
191
|
+
e.snapshot && b(e.element)[Ue](e.snapshot);
|
|
125
192
|
}), this.participants.clear();
|
|
126
193
|
for (let e = this.undo.length - 1; e >= 0; e--) this.undo[e]();
|
|
127
194
|
this.undo.length = 0, this.settled.length = 0;
|
|
128
195
|
}
|
|
129
196
|
commit() {
|
|
130
|
-
for (; !(!this.announceValues() && !this.settleValidity()););
|
|
131
|
-
|
|
132
|
-
|
|
197
|
+
for (; !(!this.announceFlags() && !this.announceValues() && !this.settleValidity()););
|
|
198
|
+
}
|
|
199
|
+
settle() {
|
|
200
|
+
let e = !1, t, n = (n) => {
|
|
201
|
+
try {
|
|
202
|
+
n();
|
|
203
|
+
} catch (n) {
|
|
204
|
+
e || (t = n), e = !0;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
for (let e = 0; e < this.settled.length; e++) n(this.settled[e]);
|
|
208
|
+
if (this.settled.length = 0, n(Ve), e) throw t;
|
|
133
209
|
}
|
|
134
210
|
buckets(e) {
|
|
135
211
|
let t = [];
|
|
136
212
|
return this.participants.forEach((n) => {
|
|
137
213
|
if (!e(n)) return;
|
|
138
|
-
let r =
|
|
214
|
+
let r = qe(n.element);
|
|
139
215
|
(t[r] ??= []).push(n);
|
|
140
216
|
}), t;
|
|
141
217
|
}
|
|
@@ -163,199 +239,263 @@ var pe = class {
|
|
|
163
239
|
announceValues() {
|
|
164
240
|
return this.pass((e) => e.valueDirty || e.structural !== void 0, (e) => {
|
|
165
241
|
let { structural: t } = e, n = e.valueDirty, r = e.forceValue;
|
|
166
|
-
e.structural = void 0, e.valueDirty = !1, e.forceValue = !1,
|
|
242
|
+
e.structural = void 0, e.valueDirty = !1, e.forceValue = !1, b(e.element)[We](this, n, r, t);
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
announceFlags() {
|
|
246
|
+
return this.pass((e) => e.flagsDirty, (e) => {
|
|
247
|
+
e.flagsDirty = !1, b(e.element)[Ke]();
|
|
167
248
|
});
|
|
168
249
|
}
|
|
169
250
|
settleValidity() {
|
|
170
251
|
return this.pass((e) => e.validityDirty, (e) => {
|
|
171
|
-
e.validityDirty = !1,
|
|
252
|
+
e.validityDirty = !1, b(e.element)[Ge](this);
|
|
172
253
|
});
|
|
173
254
|
}
|
|
174
|
-
},
|
|
175
|
-
function
|
|
176
|
-
return
|
|
255
|
+
}, x, Ye;
|
|
256
|
+
function S() {
|
|
257
|
+
return x;
|
|
177
258
|
}
|
|
178
|
-
var
|
|
259
|
+
var Xe = class {}, Ze = class {
|
|
179
260
|
open = !0;
|
|
261
|
+
rollbackRequested = !1;
|
|
180
262
|
rollback() {
|
|
181
|
-
throw this.open ? new
|
|
263
|
+
throw this.open ? (this.rollbackRequested = !0, new Xe()) : TypeError("this transaction handle is spent: the transaction that handed it out has closed. A handle is only usable inside the call that received it.");
|
|
182
264
|
}
|
|
183
265
|
close() {
|
|
184
266
|
this.open = !1;
|
|
185
267
|
}
|
|
186
268
|
};
|
|
187
|
-
function
|
|
269
|
+
function Qe(e) {
|
|
188
270
|
if (e != null && typeof e.then == "function") throw TypeError("a transaction may not be asynchronous: the callback returned a thenable. Do the awaiting outside and open a transaction for each synchronous part.");
|
|
189
271
|
}
|
|
190
|
-
function
|
|
191
|
-
if (
|
|
192
|
-
let t = e(
|
|
193
|
-
return
|
|
194
|
-
}
|
|
195
|
-
let t = new
|
|
196
|
-
|
|
272
|
+
function C(e) {
|
|
273
|
+
if (x) {
|
|
274
|
+
let t = e(Ye);
|
|
275
|
+
return Qe(t), t;
|
|
276
|
+
}
|
|
277
|
+
let t = new Je(), n = new Ze();
|
|
278
|
+
x = t, Ye = n;
|
|
279
|
+
let r;
|
|
197
280
|
try {
|
|
198
|
-
|
|
199
|
-
|
|
281
|
+
if (r = e(n), Qe(r), n.rollbackRequested) throw new Xe();
|
|
282
|
+
t.commit();
|
|
200
283
|
} catch (e) {
|
|
201
|
-
if (t.rollback(), e instanceof
|
|
284
|
+
if (t.rollback(), e instanceof Xe) return;
|
|
202
285
|
throw e;
|
|
203
286
|
} finally {
|
|
204
|
-
|
|
287
|
+
x = void 0, Ye = void 0, n.close();
|
|
205
288
|
}
|
|
289
|
+
return t.settle(), r;
|
|
206
290
|
}
|
|
207
|
-
function
|
|
208
|
-
return
|
|
291
|
+
function w(e) {
|
|
292
|
+
return x ? e(x) : C(() => e(x));
|
|
209
293
|
}
|
|
210
294
|
//#endregion
|
|
211
|
-
//#region src/
|
|
212
|
-
var
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
function xe(e) {
|
|
217
|
-
Object.assign(ye, e);
|
|
218
|
-
}
|
|
219
|
-
var Se = { install(e, t) {
|
|
220
|
-
t && xe(t);
|
|
221
|
-
} }, j = class extends String {
|
|
222
|
-
plugins;
|
|
223
|
-
options;
|
|
224
|
-
constructor(e, t, n) {
|
|
225
|
-
super(e), this.plugins = n, this.options = t;
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
function M(e) {
|
|
229
|
-
let t = f(e);
|
|
230
|
-
return typeof t == "object" && !!t && "componentName" in t;
|
|
231
|
-
}
|
|
232
|
-
function N(e) {
|
|
233
|
-
return typeof f(e) == "function";
|
|
234
|
-
}
|
|
235
|
-
var P = class {
|
|
236
|
-
code;
|
|
237
|
-
statedOrigin;
|
|
238
|
-
constructor(e, t) {
|
|
239
|
-
this.code = e, this.statedOrigin = t;
|
|
295
|
+
//#region src/actions/field-action-base.ts
|
|
296
|
+
var $e = Symbol("FieldActionBase.outermost"), et = Symbol("FieldActionBase.releaseIfAbandoned"), T = class {
|
|
297
|
+
static get classIdentifier() {
|
|
298
|
+
throw Error("classIdentifier must be declared");
|
|
240
299
|
}
|
|
241
|
-
get
|
|
242
|
-
return this.
|
|
300
|
+
get classIdentifier() {
|
|
301
|
+
return this.constructor.classIdentifier;
|
|
243
302
|
}
|
|
244
|
-
|
|
245
|
-
|
|
303
|
+
executorFn;
|
|
304
|
+
states = /* @__PURE__ */ new WeakMap();
|
|
305
|
+
constructor(e) {
|
|
306
|
+
this.executorFn = e;
|
|
246
307
|
}
|
|
247
|
-
|
|
248
|
-
return
|
|
308
|
+
state(e, t) {
|
|
309
|
+
return this.states.has(e) || this.states.set(e, t()), this.states.get(e);
|
|
249
310
|
}
|
|
250
|
-
|
|
251
|
-
return
|
|
311
|
+
forgetState(e) {
|
|
312
|
+
if (!this.states.has(e)) return;
|
|
313
|
+
let t = this.states.get(e);
|
|
314
|
+
this.states.delete(e), S()?.whenRolledBack(() => this.states.set(e, t));
|
|
252
315
|
}
|
|
253
|
-
|
|
254
|
-
return
|
|
316
|
+
execute(e, t, ...n) {
|
|
317
|
+
return this.executorFn(e, t, ...n);
|
|
255
318
|
}
|
|
256
|
-
get
|
|
257
|
-
return
|
|
319
|
+
get eager() {
|
|
320
|
+
return !1;
|
|
258
321
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
322
|
+
boundToBinding(e) {}
|
|
323
|
+
unregisterFrom(e) {}
|
|
324
|
+
resetBinding(e) {}
|
|
325
|
+
}, E = class extends Error {}, D = Symbol("FieldBase.noErrorsBaseline"), tt = Symbol("FieldBase.changedSinceErrors"), nt = Object.freeze({});
|
|
326
|
+
function rt() {
|
|
327
|
+
return {
|
|
328
|
+
originalValue: void 0,
|
|
329
|
+
announcedValue: void 0,
|
|
330
|
+
announcedContribution: void 0,
|
|
331
|
+
announcedAccess: void 0,
|
|
332
|
+
announcedVisibility: void 0,
|
|
333
|
+
validatedValue: void 0,
|
|
334
|
+
errors: [],
|
|
335
|
+
visibility: fe,
|
|
336
|
+
access: le,
|
|
337
|
+
valueVersion: 0,
|
|
338
|
+
validatingCount: 0,
|
|
339
|
+
validatingChildren: 0,
|
|
340
|
+
parent: void 0,
|
|
341
|
+
fieldName: void 0,
|
|
342
|
+
declaration: void 0,
|
|
343
|
+
extra: nt,
|
|
344
|
+
valid: !0,
|
|
345
|
+
invalidChildren: 0,
|
|
346
|
+
errorsBaseline: D
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
function it() {
|
|
350
|
+
return {
|
|
351
|
+
...rt(),
|
|
352
|
+
value: void 0,
|
|
353
|
+
touched: !1
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
function at() {
|
|
357
|
+
return {
|
|
358
|
+
...rt(),
|
|
359
|
+
announcedValue: null,
|
|
360
|
+
cachedValue: null,
|
|
361
|
+
cachedValueVersion: -1
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
function ot() {
|
|
365
|
+
return {
|
|
366
|
+
...at(),
|
|
367
|
+
fieldNames: []
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function st() {
|
|
371
|
+
return {
|
|
372
|
+
...at(),
|
|
373
|
+
rows: null,
|
|
374
|
+
rowsVersion: 0,
|
|
375
|
+
cachedItems: null,
|
|
376
|
+
cachedItemsVersion: -1
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
var ct = Symbol("Action.executeHandlers"), lt = Symbol("List.reorderRows"), ut = Symbol("FieldBase.beginValidating"), dt = Symbol("FieldBase.errorPoliciesChanged"), ft = Symbol("FieldBase.removeErrorsOnSubmit"), O = Object.freeze([
|
|
380
|
+
"change",
|
|
381
|
+
"edit",
|
|
382
|
+
"submit",
|
|
383
|
+
"never"
|
|
384
|
+
]), pt = Symbol("ErrorPolicy"), mt = Object.freeze({
|
|
385
|
+
validEffect: !0,
|
|
386
|
+
removeOn: "never"
|
|
387
|
+
}), k = Object.freeze({ server: Object.freeze({
|
|
388
|
+
validEffect: !0,
|
|
389
|
+
removeOn: "edit"
|
|
390
|
+
}) }), A = f(0), ht = 0;
|
|
391
|
+
function gt() {
|
|
392
|
+
return ht > 0;
|
|
393
|
+
}
|
|
394
|
+
function _t() {
|
|
395
|
+
A.value;
|
|
396
|
+
}
|
|
397
|
+
var j = (e) => typeof e == "string" ? `'${e}'` : String(e);
|
|
398
|
+
function vt(e) {
|
|
399
|
+
if (typeof e != "object" || !e) throw TypeError(`${j(e)} is not an object of rules keyed by origin`);
|
|
400
|
+
Object.entries(e).forEach(([e, t]) => {
|
|
401
|
+
if (e === "validator") throw TypeError("'validator' has no rule: a validator replaces its own errors and they always count");
|
|
402
|
+
if (typeof t != "object" || !t) throw TypeError(`The rule for ${j(e)} is not an object of validEffect and removeOn`);
|
|
403
|
+
if (typeof t.validEffect != "boolean") throw TypeError(`validEffect for ${j(e)} is ${j(t.validEffect)}, not a boolean`);
|
|
404
|
+
if (!O.includes(t.removeOn)) throw TypeError(`removeOn for ${j(e)} is ${j(t.removeOn)}, not one of ` + O.map(j).join(", "));
|
|
405
|
+
if (t.validEffect && t.removeOn === "submit") throw TypeError(`The rule for ${j(e)} combines validEffect: true with removeOn: 'submit': an error that makes the target invalid refuses the submit that would remove it`);
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
function yt(e) {
|
|
409
|
+
let t = Object.create(null);
|
|
410
|
+
return Object.entries(e).forEach(([e, n]) => {
|
|
411
|
+
t[e] = Object.freeze({
|
|
412
|
+
validEffect: n.validEffect,
|
|
413
|
+
removeOn: n.removeOn
|
|
414
|
+
});
|
|
415
|
+
}), Object.freeze(t);
|
|
416
|
+
}
|
|
417
|
+
function bt(e) {
|
|
418
|
+
vt(e);
|
|
419
|
+
let t = k;
|
|
420
|
+
return k = Object.freeze({
|
|
421
|
+
...k,
|
|
422
|
+
...yt(e)
|
|
423
|
+
}), A.value++, () => {
|
|
424
|
+
k = t, A.value++;
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
function xt(e) {
|
|
428
|
+
return k[e] ?? mt;
|
|
429
|
+
}
|
|
430
|
+
var M = class extends T {
|
|
431
|
+
policies;
|
|
432
|
+
constructor(e) {
|
|
433
|
+
vt(e), super((e, t, ...n) => t(e, ...n)), this.policies = yt(e);
|
|
264
434
|
}
|
|
265
|
-
get
|
|
266
|
-
return
|
|
435
|
+
static get classIdentifier() {
|
|
436
|
+
return pt;
|
|
267
437
|
}
|
|
268
|
-
|
|
269
|
-
|
|
438
|
+
boundToBinding(e) {
|
|
439
|
+
ht++, this.rulesChanged(e);
|
|
270
440
|
}
|
|
271
|
-
|
|
272
|
-
|
|
441
|
+
unregisterFrom(e) {
|
|
442
|
+
ht--, this.rulesChanged(e);
|
|
273
443
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
text;
|
|
277
|
-
textType;
|
|
278
|
-
constructor(e, t = "", r, i) {
|
|
279
|
-
super(r, i), this.classes = t, this.text = e, this.textType = n(() => this.getTextType);
|
|
444
|
+
rulesChanged(e) {
|
|
445
|
+
A.value++, w(() => e[dt]());
|
|
280
446
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
447
|
+
};
|
|
448
|
+
function St(e, t) {
|
|
449
|
+
return e.policies[t];
|
|
450
|
+
}
|
|
451
|
+
function Ct(e, t) {
|
|
452
|
+
if (!(e instanceof M)) return;
|
|
453
|
+
let n = Object.keys(e.policies);
|
|
454
|
+
t.forEach((t) => {
|
|
455
|
+
if (t === e || !(t instanceof M)) return;
|
|
456
|
+
let r = n.find((e) => St(t, e) !== void 0);
|
|
457
|
+
if (r !== void 0) throw TypeError(`An ErrorPolicy for ${j(r)} is already registered on this element`);
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
//#endregion
|
|
461
|
+
//#region src/actions/value-changed-action.ts
|
|
462
|
+
var wt = Symbol("ValueChangedAction"), N = class extends T {
|
|
463
|
+
constructor(e) {
|
|
464
|
+
super(e);
|
|
284
465
|
}
|
|
285
|
-
get
|
|
286
|
-
|
|
287
|
-
return e ? e instanceof j ? "md" : M(e) ? "component" : "string" : "string";
|
|
466
|
+
static get classIdentifier() {
|
|
467
|
+
return wt;
|
|
288
468
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
case "string": return "template";
|
|
292
|
-
case "md": return "vue-markdown";
|
|
293
|
-
case "component": return this.resolvedText.componentName;
|
|
294
|
-
default: return "template";
|
|
295
|
-
}
|
|
469
|
+
execute(e, t, n, r) {
|
|
470
|
+
return super.execute(e, t, n, r);
|
|
296
471
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
options: e.options,
|
|
305
|
-
plugins: e.plugins
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
case "component": return this.resolvedText.componentProps || {};
|
|
309
|
-
default: return {};
|
|
310
|
-
}
|
|
472
|
+
}, Tt = class {
|
|
473
|
+
code;
|
|
474
|
+
params;
|
|
475
|
+
detail;
|
|
476
|
+
statedOrigin;
|
|
477
|
+
constructor(e, t, n, r) {
|
|
478
|
+
this.code = e, this.params = t, this.detail = n, this.statedOrigin = r;
|
|
311
479
|
}
|
|
312
|
-
get
|
|
313
|
-
|
|
314
|
-
case "string": return this.resolvedText;
|
|
315
|
-
case "component": return this.resolvedText.componentVHtml || "";
|
|
316
|
-
default: return "";
|
|
317
|
-
}
|
|
480
|
+
get origin() {
|
|
481
|
+
return this.statedOrigin === void 0 ? typeof this.source == "symbol" ? "validator" : "application" : this.statedOrigin;
|
|
318
482
|
}
|
|
319
|
-
|
|
320
|
-
return this.
|
|
483
|
+
sameAs(e) {
|
|
484
|
+
return Object.getPrototypeOf(this) === Object.getPrototypeOf(e) && this.code === e.code && this.detail === e.detail && this.statedOrigin === e.statedOrigin && h(this.params, e.params);
|
|
321
485
|
}
|
|
322
|
-
},
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
function Te(e) {
|
|
326
|
-
return be().useMarkdownInValidators ? new j(e) : e.replace(/[*_~`]/g, "").replace(/!\[(.*?)\]\(.*?\)/g, "$1").replace(/\[(.*?)\]\((.*?)\)/g, "$1").replace(/#+\s?/g, "").replace(/>\s?/g, "").replace(/(\*|-|\d+\.)\s+/g, "").replace(/`{3}[\s\S]*?`{3}/g, "").replace(/`([^`]+)`/g, "$1").replace(/\n{2,}/g, "\n");
|
|
327
|
-
}
|
|
328
|
-
function I(e) {
|
|
329
|
-
return o(e) ? n(() => Te(e.value)) : Te(e);
|
|
330
|
-
}
|
|
331
|
-
//#endregion
|
|
332
|
-
//#region src/validators/translations.ts
|
|
333
|
-
var { strings: Ee, translateStrings: De } = e({
|
|
334
|
-
Required: "Please enter a value",
|
|
335
|
-
MinValue: "Value must be larger or equal to **{minValue}**",
|
|
336
|
-
MaxValue: "Value must be less than or equal to **{maxValue}**",
|
|
337
|
-
ValueInRange: "Value must be between **{minValue}** and **{maxValue}**",
|
|
338
|
-
MinLength: "Length must be larger or equal to **{minLength}**",
|
|
339
|
-
MaxLength: "Length must be less than or equal to **{maxLength}**",
|
|
340
|
-
LengthInRange: "Length must be between **{minLength}** and **{maxLength}**",
|
|
341
|
-
Pattern: "Value must match pattern \"**{pattern}**\"",
|
|
342
|
-
InAllowedValues: "Must be one of [**{allowedAsText}**]",
|
|
343
|
-
ValidationFailed: "Validation could not be completed"
|
|
344
|
-
});
|
|
345
|
-
function L(e) {
|
|
346
|
-
return I(d(Ee, e));
|
|
486
|
+
}, Et = Symbol("Validator");
|
|
487
|
+
function Dt(e, t) {
|
|
488
|
+
return e.replace(/\{(\w+)\}/g, (e, n) => Object.hasOwn(t, n) ? String(t[n]) : e);
|
|
347
489
|
}
|
|
348
|
-
|
|
349
|
-
//#region src/validators/validator.ts
|
|
350
|
-
var Oe = Symbol("Validator"), ke = () => L("ValidationFailed"), R = class extends T {
|
|
490
|
+
var P = class extends N {
|
|
351
491
|
source;
|
|
352
492
|
constructor(e) {
|
|
353
493
|
super((t, n, r, i) => {
|
|
354
|
-
let a = this.bindingState(t), o = a.abandon, s = ++a.run, c =
|
|
355
|
-
|
|
494
|
+
let a = this.bindingState(t), o = a.abandon, s = ++a.run, c = S(), l = !1, u = () => !l && a.run === s && !c?.rolledBack, d = new AbortController(), f = () => {
|
|
495
|
+
u() || (l = !0, a.abandon === f && (a.abandon = void 0), d.abort());
|
|
356
496
|
};
|
|
357
497
|
o?.();
|
|
358
|
-
let
|
|
498
|
+
let p = t[He]() ? [] : e(r, i, t, d.signal) || [], m = (e) => C(() => {
|
|
359
499
|
let n = e?.map((e) => this.claim(e)) ?? [];
|
|
360
500
|
for (let e = t.errors.length - 1; e >= 0; e--) {
|
|
361
501
|
let r = t.errors[e];
|
|
@@ -366,13 +506,18 @@ var Oe = Symbol("Validator"), ke = () => L("ValidationFailed"), R = class extend
|
|
|
366
506
|
}
|
|
367
507
|
n.length > 0 && t.errors.push(...n), t.validate();
|
|
368
508
|
});
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
509
|
+
if (p instanceof Promise) {
|
|
510
|
+
a.abandon = f, c?.whenRolledBack(f);
|
|
511
|
+
let e = t[ut]();
|
|
512
|
+
p.then((e) => {
|
|
513
|
+
u() && m(e);
|
|
514
|
+
}, (e) => {
|
|
515
|
+
u() && (m([new Tt("validation_failed", {}, "Validation could not be completed")]), console.error("Validation failed", e));
|
|
516
|
+
}).finally(() => {
|
|
517
|
+
a.abandon === f && (a.abandon = void 0), e();
|
|
518
|
+
}).catch((e) => console.error("Validation failed", e));
|
|
519
|
+
} else m(p);
|
|
520
|
+
return n(t, r, i);
|
|
376
521
|
}), this.source = Symbol(this.constructor.name);
|
|
377
522
|
}
|
|
378
523
|
claim(e) {
|
|
@@ -391,20 +536,24 @@ var Oe = Symbol("Validator"), ke = () => L("ValidationFailed"), R = class extend
|
|
|
391
536
|
});
|
|
392
537
|
}
|
|
393
538
|
static get classIdentifier() {
|
|
394
|
-
return
|
|
539
|
+
return Et;
|
|
395
540
|
}
|
|
396
541
|
get eager() {
|
|
397
542
|
return !0;
|
|
398
543
|
}
|
|
399
544
|
unregisterFrom(e) {
|
|
400
|
-
|
|
401
|
-
|
|
545
|
+
w((t) => {
|
|
546
|
+
let n = this.bindingState(e), r = n.run;
|
|
547
|
+
t.whenCommitted(() => {
|
|
548
|
+
n.run === r && this.abandonRun(e);
|
|
549
|
+
});
|
|
402
550
|
for (let t = e.errors.length - 1; t >= 0; t--) e.errors[t].source === this.source && e.errors.splice(t, 1);
|
|
403
551
|
e.validate();
|
|
404
552
|
});
|
|
405
553
|
}
|
|
406
554
|
abandonRun(e) {
|
|
407
|
-
this.bindingState(e)
|
|
555
|
+
let t = this.bindingState(e);
|
|
556
|
+
t.run++, t.abandon?.();
|
|
408
557
|
}
|
|
409
558
|
bindingState(e) {
|
|
410
559
|
return this.state(e, () => this.newBindingState());
|
|
@@ -412,27 +561,35 @@ var Oe = Symbol("Validator"), ke = () => L("ValidationFailed"), R = class extend
|
|
|
412
561
|
newBindingState() {
|
|
413
562
|
return { run: 0 };
|
|
414
563
|
}
|
|
415
|
-
|
|
416
|
-
return (
|
|
417
|
-
let n = f(e);
|
|
418
|
-
for (; N(n);) n = f(this.replacePlaceholders(n(), t));
|
|
419
|
-
return n;
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
replacePlaceholders(e, n) {
|
|
423
|
-
if (N(e)) return this.replacePlaceholdersFunction(e, n);
|
|
424
|
-
if (M(e)) return e;
|
|
425
|
-
if (o(e)) return this.replacePlaceholdersFunction(() => f(e), n);
|
|
426
|
-
let r = f(e), i = t(r.toString(), n);
|
|
427
|
-
return r instanceof j ? new j(i, r.options, r.plugins) : i;
|
|
564
|
+
errorFor(e, t, n, r) {
|
|
565
|
+
return new Tt(e?.code ?? t, r, Dt(e?.detail ?? n, r));
|
|
428
566
|
}
|
|
429
|
-
},
|
|
567
|
+
}, Ot = class e {
|
|
430
568
|
actions = [];
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
569
|
+
get registrations() {
|
|
570
|
+
return this.actions;
|
|
571
|
+
}
|
|
572
|
+
restore(e) {
|
|
573
|
+
this.actions = e;
|
|
574
|
+
}
|
|
575
|
+
register(t, n) {
|
|
576
|
+
if (!(t instanceof T)) throw Error("Invalid action type");
|
|
577
|
+
t.classIdentifier, Ct(t, this.actions);
|
|
578
|
+
let r = n ? this.actions.indexOf(n) : -1;
|
|
579
|
+
if (n && (n.classIdentifier !== t.classIdentifier || r < 0)) throw Error("Action to register before is not registered under the same identifier");
|
|
580
|
+
if (r >= 0) {
|
|
581
|
+
this.actions = e.inserted(this.actions, r, t);
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
let i = t[$e] ? -1 : this.actions.findIndex((e) => e[$e] && e.classIdentifier === t.classIdentifier);
|
|
585
|
+
this.actions = e.inserted(this.actions, i < 0 ? this.actions.length : i, t);
|
|
586
|
+
}
|
|
587
|
+
static inserted(e, t, n) {
|
|
588
|
+
return [
|
|
589
|
+
...e.slice(0, t),
|
|
590
|
+
n,
|
|
591
|
+
...e.slice(t)
|
|
592
|
+
];
|
|
436
593
|
}
|
|
437
594
|
unregister(e) {
|
|
438
595
|
return this.actions.includes(e) ? (this.actions = this.actions.filter((t) => t !== e), !0) : !1;
|
|
@@ -446,29 +603,46 @@ var Oe = Symbol("Validator"), ke = () => L("ValidationFailed"), R = class extend
|
|
|
446
603
|
trigger(e, t, ...n) {
|
|
447
604
|
return this.run(e.classIdentifier, !1, t, n);
|
|
448
605
|
}
|
|
449
|
-
triggerEager(
|
|
450
|
-
let
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
606
|
+
triggerEager(e, ...t) {
|
|
607
|
+
let n = this.runEager((e) => !(e instanceof P), e, t) ? [e.contribution, ...t.slice(1)] : t;
|
|
608
|
+
this.runEager((e) => e instanceof P, e, n);
|
|
609
|
+
}
|
|
610
|
+
triggerEagerRules(e, ...t) {
|
|
611
|
+
this.runEager((e) => !(e instanceof P), e, t);
|
|
612
|
+
}
|
|
613
|
+
runEager(t, n, r) {
|
|
614
|
+
let i = !1, a = this.actions;
|
|
615
|
+
for (let o = a.length - 1; o >= 0; o--) {
|
|
616
|
+
let s = a[o];
|
|
617
|
+
if (!(!s.eager || !t(s)) && e.outermostEager(a, o)) {
|
|
618
|
+
i = !0;
|
|
619
|
+
try {
|
|
620
|
+
let t = this.walk(a, o, s.classIdentifier, !0, n, r);
|
|
621
|
+
e.isPromise(t) && t.then(void 0, (e) => {
|
|
622
|
+
if (!(e instanceof E)) throw e;
|
|
623
|
+
});
|
|
624
|
+
} catch (e) {
|
|
625
|
+
if (!(e instanceof E)) throw e;
|
|
626
|
+
}
|
|
460
627
|
}
|
|
461
628
|
}
|
|
629
|
+
return i;
|
|
462
630
|
}
|
|
463
631
|
triggerEagerFor(e, t, ...n) {
|
|
464
632
|
return this.run(e, !0, t, n);
|
|
465
633
|
}
|
|
634
|
+
ofClass(e) {
|
|
635
|
+
return this.actions.filter((t) => t.classIdentifier === e);
|
|
636
|
+
}
|
|
466
637
|
get validators() {
|
|
467
|
-
return this.actions.filter((e) => e instanceof
|
|
638
|
+
return this.actions.filter((e) => e instanceof P);
|
|
468
639
|
}
|
|
469
640
|
bindTo(e) {
|
|
470
641
|
this.actions.forEach((t) => t.boundToBinding(e));
|
|
471
642
|
}
|
|
643
|
+
resetBinding(e) {
|
|
644
|
+
this.actions.forEach((t) => t.resetBinding(e));
|
|
645
|
+
}
|
|
472
646
|
static outermostEager(e, t) {
|
|
473
647
|
let n = e[t].classIdentifier;
|
|
474
648
|
for (let r = e.length - 1; r > t; r--) if (e[r].eager && e[r].classIdentifier === n) return !1;
|
|
@@ -479,7 +653,7 @@ var Oe = Symbol("Validator"), ke = () => L("ValidationFailed"), R = class extend
|
|
|
479
653
|
}
|
|
480
654
|
static answerAbort(t) {
|
|
481
655
|
return e.isPromise(t) ? t.then(void 0, (e) => {
|
|
482
|
-
if (e instanceof
|
|
656
|
+
if (e instanceof E) return e;
|
|
483
657
|
throw e;
|
|
484
658
|
}) : t;
|
|
485
659
|
}
|
|
@@ -488,7 +662,7 @@ var Oe = Symbol("Validator"), ke = () => L("ValidationFailed"), R = class extend
|
|
|
488
662
|
try {
|
|
489
663
|
return e.answerAbort(this.walk(a, a.length - 1, t, n, r, i));
|
|
490
664
|
} catch (e) {
|
|
491
|
-
if (e instanceof
|
|
665
|
+
if (e instanceof E) return e;
|
|
492
666
|
throw e;
|
|
493
667
|
}
|
|
494
668
|
}
|
|
@@ -499,41 +673,41 @@ var Oe = Symbol("Validator"), ke = () => L("ValidationFailed"), R = class extend
|
|
|
499
673
|
}
|
|
500
674
|
};
|
|
501
675
|
//#endregion
|
|
502
|
-
//#region src/
|
|
503
|
-
function
|
|
676
|
+
//#region src/resolve.ts
|
|
677
|
+
function F(e) {
|
|
504
678
|
let t = e;
|
|
505
679
|
for (; t.fieldName !== void 0 && t.parent;) t = t.parent;
|
|
506
680
|
return t;
|
|
507
681
|
}
|
|
508
|
-
function
|
|
682
|
+
function kt(e, t) {
|
|
509
683
|
let n = e;
|
|
510
|
-
for (let e of
|
|
684
|
+
for (let e of At(t)) if (n = n.field?.(e) ?? void 0, !n) return;
|
|
511
685
|
return n?.declaration === t ? n : void 0;
|
|
512
686
|
}
|
|
513
|
-
function
|
|
687
|
+
function At(e) {
|
|
514
688
|
let t = [], n = e;
|
|
515
689
|
for (; n.fieldName !== void 0 && n.parent;) t.unshift(n.fieldName), n = n.parent;
|
|
516
690
|
return t;
|
|
517
691
|
}
|
|
518
|
-
function
|
|
519
|
-
let n =
|
|
692
|
+
function jt(e, t) {
|
|
693
|
+
let n = kt(t, e);
|
|
520
694
|
if (n) return n;
|
|
521
695
|
let r = t.parent;
|
|
522
696
|
for (; r;) {
|
|
523
|
-
let t =
|
|
697
|
+
let t = kt(F(r), e);
|
|
524
698
|
if (t) return t;
|
|
525
699
|
r = r.parent;
|
|
526
700
|
}
|
|
527
|
-
return
|
|
701
|
+
return F(e) === F(t.declaration) ? void 0 : e;
|
|
528
702
|
}
|
|
529
|
-
function
|
|
530
|
-
let n =
|
|
703
|
+
function Mt(e, t) {
|
|
704
|
+
let n = jt(e, t);
|
|
531
705
|
if (!n) return [];
|
|
532
706
|
if (n !== e) return [n];
|
|
533
707
|
let r = t.bindingsOf(e);
|
|
534
708
|
return r.length > 0 ? r : [e];
|
|
535
709
|
}
|
|
536
|
-
function
|
|
710
|
+
function Nt(e, t) {
|
|
537
711
|
let n = t.parent;
|
|
538
712
|
for (; n;) {
|
|
539
713
|
let t = n.field?.(e);
|
|
@@ -542,68 +716,107 @@ function Fe(e, t) {
|
|
|
542
716
|
}
|
|
543
717
|
}
|
|
544
718
|
//#endregion
|
|
545
|
-
//#region src/
|
|
546
|
-
var
|
|
719
|
+
//#region src/weak-elements.ts
|
|
720
|
+
var Pt = class {
|
|
721
|
+
refs = /* @__PURE__ */ new Set();
|
|
722
|
+
byElement = /* @__PURE__ */ new WeakMap();
|
|
723
|
+
add(e) {
|
|
724
|
+
if (this.byElement.has(e)) return;
|
|
725
|
+
let t = new WeakRef(e);
|
|
726
|
+
this.byElement.set(e, t), this.refs.add(t);
|
|
727
|
+
}
|
|
728
|
+
has(e) {
|
|
729
|
+
return this.byElement.has(e);
|
|
730
|
+
}
|
|
731
|
+
delete(e) {
|
|
732
|
+
let t = this.byElement.get(e);
|
|
733
|
+
return t ? (this.byElement.delete(e), this.refs.delete(t), !0) : !1;
|
|
734
|
+
}
|
|
735
|
+
get alive() {
|
|
736
|
+
let e = [];
|
|
737
|
+
return this.refs.forEach((t) => {
|
|
738
|
+
let n = t.deref();
|
|
739
|
+
n ? e.push(n) : this.refs.delete(t);
|
|
740
|
+
}), e;
|
|
741
|
+
}
|
|
742
|
+
}, Ft = Symbol("ConditionalStatementAction"), I = class extends N {
|
|
547
743
|
statement;
|
|
548
744
|
conditionalExecutor;
|
|
549
|
-
declarations =
|
|
745
|
+
declarations = new Pt();
|
|
550
746
|
registrations = /* @__PURE__ */ new WeakSet();
|
|
551
747
|
constructor(e, t) {
|
|
552
|
-
super((e, t, n, r) => (this.applyIn(
|
|
553
|
-
|
|
554
|
-
|
|
748
|
+
super((e, t, n, r) => (this.applyIn(F(e)) || e.markRecordIncomplete(), t(e, n, r))), this.statement = e, this.conditionalExecutor = t, this.relay = new N((e, t, ...n) => (this.applyFrom(e), t(e, ...n))), this.relay[$e] = !0, this.relay[et] = () => {
|
|
749
|
+
this.bound && this.declarations.alive.length === 0 && this.stopListening();
|
|
750
|
+
}, this.listen();
|
|
751
|
+
}
|
|
752
|
+
relay;
|
|
753
|
+
listening = !1;
|
|
754
|
+
bound = !1;
|
|
755
|
+
listen() {
|
|
756
|
+
this.listening || (this.listening = !0, this.statement.collectFields().forEach((e) => e.registerAction(this.relay)));
|
|
757
|
+
}
|
|
758
|
+
stopListening() {
|
|
759
|
+
this.listening && (S()?.whenRolledBack(() => {
|
|
760
|
+
this.listening = !0;
|
|
761
|
+
}), this.listening = !1, this.statement.collectFields().forEach((e) => e.unregisterAction(this.relay)));
|
|
555
762
|
}
|
|
556
763
|
static get classIdentifier() {
|
|
557
|
-
return
|
|
764
|
+
return Ft;
|
|
558
765
|
}
|
|
559
766
|
get eager() {
|
|
560
767
|
return !0;
|
|
561
768
|
}
|
|
562
769
|
boundToBinding(e) {
|
|
563
|
-
this.declarations.add(e.declaration), this.registrations.add(e);
|
|
770
|
+
this.declarations.add(e.declaration), this.registrations.add(e), this.bound = !0, this.listen();
|
|
771
|
+
}
|
|
772
|
+
resetBinding(e) {
|
|
773
|
+
this.forgetState(e);
|
|
564
774
|
}
|
|
565
775
|
unregisterFrom(e) {
|
|
566
|
-
this.registrations.delete(e);
|
|
776
|
+
this.registrations.delete(e), e === e.declaration && this.declarations.delete(e), this.declarations.alive.length === 0 && this.stopListening();
|
|
567
777
|
}
|
|
568
778
|
targetsIn(e) {
|
|
569
779
|
let t = [];
|
|
570
|
-
return this.declarations.forEach((n) =>
|
|
780
|
+
return this.declarations.alive.forEach((n) => Mt(n, e).forEach((e) => {
|
|
571
781
|
this.registrations.has(e) && t.push(e);
|
|
572
782
|
})), t;
|
|
573
783
|
}
|
|
574
784
|
applyIn(e) {
|
|
575
785
|
let t = this.targetsIn(e);
|
|
576
786
|
if (t.length === 0) return !1;
|
|
577
|
-
let n = this.
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
787
|
+
let n = this.statement.evaluate(e);
|
|
788
|
+
return t.forEach((e) => {
|
|
789
|
+
let t = this.state(e, () => ({ lastResult: void 0 }));
|
|
790
|
+
if (n === t.lastResult) return;
|
|
791
|
+
let r = t.lastResult;
|
|
792
|
+
t.lastResult = n, this.conditionalExecutor(e, n, r);
|
|
793
|
+
}), !0;
|
|
581
794
|
}
|
|
582
795
|
applyFrom(e) {
|
|
583
796
|
let t = /* @__PURE__ */ new Set();
|
|
584
|
-
this.targetsIn(
|
|
797
|
+
this.targetsIn(F(e)).forEach((e) => t.add(F(e))), t.forEach((e) => this.applyIn(e));
|
|
585
798
|
}
|
|
586
|
-
},
|
|
799
|
+
}, It = class extends I {
|
|
587
800
|
constructor(e, t = "full", n = "suppress") {
|
|
588
801
|
super(e, (e, r) => {
|
|
589
802
|
e.visibility = r ? t : n;
|
|
590
803
|
});
|
|
591
804
|
}
|
|
592
|
-
},
|
|
805
|
+
}, Lt = class extends I {
|
|
593
806
|
constructor(e, t = "editable", n = "disabled") {
|
|
594
807
|
super(e, (e, r) => {
|
|
595
808
|
e.access = r ? t : n;
|
|
596
809
|
});
|
|
597
810
|
}
|
|
598
|
-
},
|
|
811
|
+
}, Rt = class extends I {
|
|
599
812
|
constructor(e, t) {
|
|
600
813
|
super(e, (e, n) => {
|
|
601
814
|
n && (e.value = t);
|
|
602
815
|
});
|
|
603
816
|
}
|
|
604
|
-
},
|
|
817
|
+
}, L = /* @__PURE__ */ function(e) {
|
|
605
818
|
return e[e.NOT = 0] = "NOT", e[e.OR = 1] = "OR", e[e.AND = 2] = "AND", e[e.XOR = 3] = "XOR", e[e.NAND = 4] = "NAND", e[e.NOR = 5] = "NOR", e[e.EQUALS = -1] = "EQUALS", e[e.NOT_EQUALS = -2] = "NOT_EQUALS", e[e.GT = -3] = "GT", e[e.LT = -4] = "LT", e[e.GE = -5] = "GE", e[e.LE = -6] = "LE", e[e.IN = -7] = "IN", e[e.NOT_IN = -8] = "NOT_IN", e[e.INCLUDES = -9] = "INCLUDES", e[e.NOT_INCLUDES = -10] = "NOT_INCLUDES", e;
|
|
606
|
-
}(
|
|
819
|
+
}(L || {});
|
|
607
820
|
(function(e) {
|
|
608
821
|
function t(e) {
|
|
609
822
|
let t = e.toLowerCase();
|
|
@@ -639,106 +852,127 @@ var Ie = Symbol("ConditionalStatementAction"), B = class extends T {
|
|
|
639
852
|
}
|
|
640
853
|
e.fromString = t;
|
|
641
854
|
function n(e) {
|
|
642
|
-
let t = typeof e == "number" ? e :
|
|
643
|
-
if (Object.values(
|
|
855
|
+
let t = typeof e == "number" ? e : L.fromString(e);
|
|
856
|
+
if (Object.values(L).includes(t)) return t;
|
|
644
857
|
throw Error(`Unrecognised operator ${e}`);
|
|
645
858
|
}
|
|
646
859
|
e.fromAny = n;
|
|
647
860
|
function r(e) {
|
|
648
|
-
|
|
649
|
-
|
|
861
|
+
if (typeof e == "number") return Object.values(L).includes(e);
|
|
862
|
+
try {
|
|
863
|
+
return Object.values(L).includes(L.fromString(e));
|
|
864
|
+
} catch {
|
|
865
|
+
return !1;
|
|
866
|
+
}
|
|
650
867
|
}
|
|
651
868
|
e.isDefined = r;
|
|
652
869
|
function i(e) {
|
|
653
870
|
return e >= 0;
|
|
654
871
|
}
|
|
655
872
|
e.isLogicOperator = i;
|
|
656
|
-
})(
|
|
657
|
-
var
|
|
873
|
+
})(L ||= {}), Object.freeze(L);
|
|
874
|
+
var R = L, zt = Symbol("AccessChangingAction"), Bt = class extends T {
|
|
658
875
|
constructor(e) {
|
|
659
876
|
super(e);
|
|
660
877
|
}
|
|
661
878
|
static get classIdentifier() {
|
|
662
|
-
return
|
|
879
|
+
return zt;
|
|
663
880
|
}
|
|
664
881
|
execute(e, t, n, r) {
|
|
665
882
|
return super.execute(e, t, n, r);
|
|
666
883
|
}
|
|
667
|
-
},
|
|
884
|
+
}, Vt = Symbol("AccessChangedAction"), Ht = class extends T {
|
|
668
885
|
constructor(e) {
|
|
669
886
|
super(e);
|
|
670
887
|
}
|
|
671
888
|
static get classIdentifier() {
|
|
672
|
-
return
|
|
889
|
+
return Vt;
|
|
673
890
|
}
|
|
674
891
|
execute(e, t, n, r) {
|
|
675
892
|
return super.execute(e, t, n, r);
|
|
676
893
|
}
|
|
677
|
-
},
|
|
894
|
+
}, Ut = Symbol("ContributionChangedAction"), Wt = class extends T {
|
|
678
895
|
constructor(e) {
|
|
679
896
|
super(e);
|
|
680
897
|
}
|
|
681
898
|
static get classIdentifier() {
|
|
682
|
-
return
|
|
899
|
+
return Ut;
|
|
683
900
|
}
|
|
684
901
|
execute(e, t, n, r) {
|
|
685
902
|
return super.execute(e, t, n, r);
|
|
686
903
|
}
|
|
687
|
-
},
|
|
904
|
+
}, Gt = Symbol("EnabledChangingAction"), Kt = class extends T {
|
|
688
905
|
constructor(e) {
|
|
689
906
|
super(e);
|
|
690
907
|
}
|
|
691
908
|
static get classIdentifier() {
|
|
692
|
-
return
|
|
909
|
+
return Gt;
|
|
693
910
|
}
|
|
694
911
|
execute(e, t, n, r) {
|
|
695
912
|
return super.execute(e, t, n, r);
|
|
696
913
|
}
|
|
697
|
-
},
|
|
914
|
+
}, qt = Symbol("EnabledChangedAction"), Jt = class extends T {
|
|
698
915
|
constructor(e) {
|
|
699
916
|
super(e);
|
|
700
917
|
}
|
|
701
918
|
static get classIdentifier() {
|
|
702
|
-
return
|
|
919
|
+
return qt;
|
|
703
920
|
}
|
|
704
921
|
execute(e, t, n, r) {
|
|
705
922
|
return super.execute(e, t, n, r);
|
|
706
923
|
}
|
|
707
|
-
},
|
|
924
|
+
}, Yt = Symbol("ValidChangedAction"), Xt = class extends T {
|
|
708
925
|
constructor(e) {
|
|
709
926
|
super(e);
|
|
710
927
|
}
|
|
711
928
|
static get classIdentifier() {
|
|
712
|
-
return
|
|
929
|
+
return Yt;
|
|
713
930
|
}
|
|
714
931
|
execute(e, t, n, r) {
|
|
715
932
|
return super.execute(e, t, n, r);
|
|
716
933
|
}
|
|
717
|
-
},
|
|
934
|
+
}, Zt = Symbol("VisibilityChangingAction"), Qt = class extends T {
|
|
718
935
|
constructor(e) {
|
|
719
936
|
super(e);
|
|
720
937
|
}
|
|
721
938
|
static get classIdentifier() {
|
|
722
|
-
return
|
|
939
|
+
return Zt;
|
|
723
940
|
}
|
|
724
941
|
execute(e, t, n, r) {
|
|
725
942
|
return super.execute(e, t, n, r);
|
|
726
943
|
}
|
|
727
|
-
}, $
|
|
944
|
+
}, $t = Symbol("VisibilityChangedAction"), en = class extends T {
|
|
728
945
|
constructor(e) {
|
|
729
946
|
super(e);
|
|
730
947
|
}
|
|
731
948
|
static get classIdentifier() {
|
|
732
|
-
return $
|
|
949
|
+
return $t;
|
|
733
950
|
}
|
|
734
951
|
execute(e, t, n, r) {
|
|
735
952
|
return super.execute(e, t, n, r);
|
|
736
953
|
}
|
|
737
|
-
},
|
|
738
|
-
function
|
|
739
|
-
|
|
954
|
+
}, tn = /* @__PURE__ */ new WeakMap(), nn = 6e4, rn = /* @__PURE__ */ new WeakMap();
|
|
955
|
+
function an(e) {
|
|
956
|
+
let t = [];
|
|
957
|
+
return e.refs.forEach((n) => {
|
|
958
|
+
let r = n.deref();
|
|
959
|
+
r ? t.push(r) : e.refs.delete(n);
|
|
960
|
+
}), e.sweptAt = Date.now(), t;
|
|
961
|
+
}
|
|
962
|
+
var on = /* @__PURE__ */ new Set(["validators", "actions"]);
|
|
963
|
+
function sn(e, t) {
|
|
964
|
+
for (let n = Object.getPrototypeOf(e); n && n !== Object.prototype;) {
|
|
965
|
+
let e = Object.getOwnPropertyDescriptor(n, t);
|
|
966
|
+
if (e) return e.get !== void 0 || e.set !== void 0;
|
|
967
|
+
n = Object.getPrototypeOf(n);
|
|
968
|
+
}
|
|
969
|
+
return !1;
|
|
740
970
|
}
|
|
741
|
-
var
|
|
971
|
+
var z = (e) => typeof e == "string" ? `'${e}'` : String(e), cn = (e) => e.map(z).join(", "), B = (e) => e.origin !== "validator", V = (e) => e === "disabled" ? "omit" : e === "disabled-null" ? "null" : "value";
|
|
972
|
+
function ln(e) {
|
|
973
|
+
if (Object.hasOwn(e, "enabled")) throw TypeError(`enabled is read from access and cannot be assigned; state access instead: ${cn(_)}`);
|
|
974
|
+
}
|
|
975
|
+
var un = 0, H = null, U = class {
|
|
742
976
|
get __v_skip() {
|
|
743
977
|
return !0;
|
|
744
978
|
}
|
|
@@ -751,7 +985,7 @@ var at = 0, G = class {
|
|
|
751
985
|
#e;
|
|
752
986
|
#t;
|
|
753
987
|
constructor(e) {
|
|
754
|
-
this.#t = e, this.#e =
|
|
988
|
+
this.#t = e, this.#e = u(e), ze(this);
|
|
755
989
|
}
|
|
756
990
|
get state() {
|
|
757
991
|
return this.#e;
|
|
@@ -760,10 +994,12 @@ var at = 0, G = class {
|
|
|
760
994
|
return this.#t;
|
|
761
995
|
}
|
|
762
996
|
rebind(e) {
|
|
763
|
-
return
|
|
997
|
+
return w((t) => {
|
|
764
998
|
t.touch(this);
|
|
765
999
|
let n = t.willAnnounceValue(this), { announcedValue: r, announcedContribution: i, validatedValue: a } = this.#t;
|
|
766
|
-
this.
|
|
1000
|
+
this.asReset(() => {
|
|
1001
|
+
this.resetTo(this.declaration, e), H?.push(this);
|
|
1002
|
+
}), n ? Object.assign(this.#t, {
|
|
767
1003
|
announcedValue: r,
|
|
768
1004
|
announcedContribution: i,
|
|
769
1005
|
validatedValue: a
|
|
@@ -774,7 +1010,7 @@ var at = 0, G = class {
|
|
|
774
1010
|
return this.#e.originalValue;
|
|
775
1011
|
}
|
|
776
1012
|
set originalValue(e) {
|
|
777
|
-
this.touchState(), this.#e.originalValue = e;
|
|
1013
|
+
this.touchState(), this.#e.originalValue = Ie(this, e);
|
|
778
1014
|
}
|
|
779
1015
|
get extra() {
|
|
780
1016
|
return this.#e.extra;
|
|
@@ -788,55 +1024,117 @@ var at = 0, G = class {
|
|
|
788
1024
|
extendedOf(e) {
|
|
789
1025
|
let t = Object.create(null);
|
|
790
1026
|
return Object.entries(e).forEach(([e, n]) => {
|
|
791
|
-
|
|
1027
|
+
on.has(e) || sn(this, e) || (t[e] = n);
|
|
792
1028
|
}), t;
|
|
793
1029
|
}
|
|
794
1030
|
assignParams(e) {
|
|
795
|
-
|
|
1031
|
+
ln(e);
|
|
796
1032
|
let t = this.extendedOf(e);
|
|
797
1033
|
Object.entries(e).forEach(([e, n]) => {
|
|
798
|
-
Object.hasOwn(t, e) ||
|
|
799
|
-
}),
|
|
1034
|
+
Object.hasOwn(t, e) || on.has(e) || (this[e] = n);
|
|
1035
|
+
}), ne(t) || this.setExtendedValues(t);
|
|
800
1036
|
}
|
|
801
1037
|
touchState() {
|
|
802
|
-
|
|
1038
|
+
S()?.touch(this);
|
|
803
1039
|
}
|
|
804
|
-
[
|
|
1040
|
+
[y]() {
|
|
805
1041
|
return {
|
|
806
1042
|
...this.#t,
|
|
807
1043
|
errors: [...this.#t.errors]
|
|
808
1044
|
};
|
|
809
1045
|
}
|
|
810
|
-
[
|
|
1046
|
+
[Ue](e) {
|
|
811
1047
|
let t = this.#t.validatingCount, n = this.#t.validatingChildren;
|
|
812
1048
|
Object.assign(this.#e, e), this.#e.validatingCount = t, this.#e.validatingChildren = n;
|
|
813
1049
|
}
|
|
814
1050
|
get validating() {
|
|
815
1051
|
return this.#e.validatingCount > 0 || this.#e.validatingChildren > 0;
|
|
816
1052
|
}
|
|
817
|
-
|
|
1053
|
+
[ut]() {
|
|
818
1054
|
let e = !this.validating;
|
|
819
1055
|
this.#e.validatingCount++, e && this.container?.childValidatingChanged(!0);
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
1056
|
+
let t = !1;
|
|
1057
|
+
return () => {
|
|
1058
|
+
t || (t = !0, this.#e.validatingCount--, this.validating || this.container?.childValidatingChanged(!1));
|
|
1059
|
+
};
|
|
823
1060
|
}
|
|
824
1061
|
childValidatingChanged(e) {}
|
|
825
1062
|
get busy() {
|
|
826
1063
|
return !1;
|
|
827
1064
|
}
|
|
1065
|
+
get pending() {
|
|
1066
|
+
return this.validating || this.busy;
|
|
1067
|
+
}
|
|
828
1068
|
settled() {
|
|
829
|
-
return
|
|
830
|
-
let t =
|
|
1069
|
+
return this.pending ? new Promise((e) => {
|
|
1070
|
+
let t = ee(() => this.pending, (n) => {
|
|
831
1071
|
n || (t(), e());
|
|
832
1072
|
}, { flush: "sync" });
|
|
833
|
-
});
|
|
1073
|
+
}) : Promise.resolve();
|
|
834
1074
|
}
|
|
835
1075
|
get errors() {
|
|
836
|
-
return this.touchState(), this.#e.errors;
|
|
1076
|
+
return this.touchState(), S() || this.noteErrorsBaseline(), this.#e.errors;
|
|
837
1077
|
}
|
|
838
1078
|
set errors(e) {
|
|
839
|
-
this.touchState(), this.#e.errors = e;
|
|
1079
|
+
this.touchState(), this.#e.errors = e, this.#t.errorsBaseline = D, this.noteErrorsBaseline();
|
|
1080
|
+
}
|
|
1081
|
+
noteErrorsBaseline() {
|
|
1082
|
+
let e = this.#t;
|
|
1083
|
+
e.errorsBaseline !== D || !e.errors.some(B) || (e.errorsBaseline = p(this.value));
|
|
1084
|
+
}
|
|
1085
|
+
ruleOf(e) {
|
|
1086
|
+
for (let t of this.selfAndAbove()) {
|
|
1087
|
+
let n = t.boundActions;
|
|
1088
|
+
if (!n?.willTrigger(M.classIdentifier)) continue;
|
|
1089
|
+
let r = n.ofClass(M.classIdentifier);
|
|
1090
|
+
for (let t = r.length - 1; t >= 0; t--) {
|
|
1091
|
+
let n = St(r[t], e);
|
|
1092
|
+
if (n) return n;
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
return xt(e);
|
|
1096
|
+
}
|
|
1097
|
+
selfAndAbove() {
|
|
1098
|
+
let e = [this];
|
|
1099
|
+
for (let t = this.parent; t; t = t.parent) e.push(t);
|
|
1100
|
+
return e;
|
|
1101
|
+
}
|
|
1102
|
+
ownErrorsValid(e) {
|
|
1103
|
+
return e.length === 0 || !e.some((e) => !B(e) || (_t(), this.ruleOf(e.origin).validEffect));
|
|
1104
|
+
}
|
|
1105
|
+
removeErrors(e) {
|
|
1106
|
+
let t = this.#e.errors, n = !1;
|
|
1107
|
+
for (let r = t.length - 1; r >= 0; r--) B(t[r]) && e(this.ruleOf(t[r].origin)) && (t.splice(r, 1), n = !0);
|
|
1108
|
+
return this.#t.errors.some(B) || (this.#t.errorsBaseline = D), n;
|
|
1109
|
+
}
|
|
1110
|
+
editConcluded() {
|
|
1111
|
+
let e = this.selfAndAbove().filter((e) => e.#t.errors.some((t) => B(t) && e.ruleOf(t.origin).removeOn === "edit"));
|
|
1112
|
+
e.length !== 0 && w((t) => {
|
|
1113
|
+
for (let n of e) {
|
|
1114
|
+
let e = n.#t, r = e.errorsBaseline;
|
|
1115
|
+
if (t.touch(n), r === D) {
|
|
1116
|
+
e.errorsBaseline = p(n.value);
|
|
1117
|
+
continue;
|
|
1118
|
+
}
|
|
1119
|
+
r !== tt && h(n.value, r) || (n.removeErrors((e) => e.removeOn === "edit"), t.markValidityDirty(n));
|
|
1120
|
+
}
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
[ft]() {
|
|
1124
|
+
w((e) => {
|
|
1125
|
+
let t = (n) => {
|
|
1126
|
+
n.#t.errors.some(B) && (e.touch(n), n.removeErrors((e) => e.removeOn === "submit") && e.markValidityDirty(n)), n.members.forEach(t);
|
|
1127
|
+
};
|
|
1128
|
+
t(this);
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
[dt]() {
|
|
1132
|
+
w((e) => {
|
|
1133
|
+
let t = (n) => {
|
|
1134
|
+
n.#t.errors.some(B) && e.markValidityDirty(n), n.members.forEach(t);
|
|
1135
|
+
};
|
|
1136
|
+
t(this);
|
|
1137
|
+
});
|
|
840
1138
|
}
|
|
841
1139
|
get parent() {
|
|
842
1140
|
return this.#e.parent;
|
|
@@ -860,18 +1158,18 @@ var at = 0, G = class {
|
|
|
860
1158
|
return r(this), n;
|
|
861
1159
|
}
|
|
862
1160
|
markRecordIncomplete() {
|
|
863
|
-
this._recordPending || (this._recordPending = !0,
|
|
1161
|
+
this._recordPending || (this._recordPending = !0, un++);
|
|
864
1162
|
}
|
|
865
1163
|
completeRecords(e = this) {
|
|
866
|
-
|
|
1164
|
+
un !== 0 && w(() => {
|
|
867
1165
|
let t = (e) => {
|
|
868
|
-
e._recordPending && (e._recordPending = !1,
|
|
1166
|
+
e._recordPending && (e._recordPending = !1, un--, e.rerunEagerActions()), e.members.forEach(t);
|
|
869
1167
|
};
|
|
870
1168
|
t(e);
|
|
871
1169
|
});
|
|
872
1170
|
}
|
|
873
1171
|
rerunEagerActions() {
|
|
874
|
-
|
|
1172
|
+
w((e) => {
|
|
875
1173
|
this.boundActions?.triggerEager(this, this.contribution, this.contribution), e.markValidityDirty(this);
|
|
876
1174
|
});
|
|
877
1175
|
}
|
|
@@ -879,20 +1177,20 @@ var at = 0, G = class {
|
|
|
879
1177
|
return this._actions;
|
|
880
1178
|
}
|
|
881
1179
|
noteBinding(e) {
|
|
882
|
-
let t =
|
|
883
|
-
t
|
|
1180
|
+
let t = tn.get(this);
|
|
1181
|
+
t ? Date.now() - t.sweptAt >= nn && an(t) : (t = {
|
|
1182
|
+
refs: /* @__PURE__ */ new Set(),
|
|
1183
|
+
sweptAt: Date.now()
|
|
1184
|
+
}, tn.set(this, t)), t.refs.add(new WeakRef(e));
|
|
884
1185
|
}
|
|
885
1186
|
get boundElements() {
|
|
886
|
-
let e = this.declaration, t =
|
|
887
|
-
return t
|
|
888
|
-
let r = e.deref();
|
|
889
|
-
r ? n.push(r) : t.delete(e);
|
|
890
|
-
}), n;
|
|
1187
|
+
let e = this.declaration, t = tn.get(e);
|
|
1188
|
+
return t ? [e, ...an(t)] : [e];
|
|
891
1189
|
}
|
|
892
1190
|
get actions() {
|
|
893
1191
|
let e = this.declaration;
|
|
894
1192
|
if (!e._actions) {
|
|
895
|
-
let t = new
|
|
1193
|
+
let t = new Ot();
|
|
896
1194
|
e.boundElements.forEach((e) => {
|
|
897
1195
|
e._actions = t;
|
|
898
1196
|
});
|
|
@@ -903,50 +1201,56 @@ var at = 0, G = class {
|
|
|
903
1201
|
return this.#e.valueVersion;
|
|
904
1202
|
}
|
|
905
1203
|
bumpValueVersion() {
|
|
906
|
-
|
|
1204
|
+
w((e) => {
|
|
907
1205
|
e.touch(this), this.#e.valueVersion++;
|
|
908
1206
|
let t = this.parent;
|
|
909
1207
|
for (; t;) e.touch(t), t.#e.valueVersion++, t = t.parent;
|
|
910
1208
|
});
|
|
911
1209
|
}
|
|
912
1210
|
propagateValueChanged(e = !1) {
|
|
913
|
-
|
|
914
|
-
t.markValueChanged(this, e), t.markValidityDirty(this), this.parent?.notifyValueChanged();
|
|
1211
|
+
w((t) => {
|
|
1212
|
+
t.markValueChanged(this, e), this.errorsAfterChange(t), t.markValidityDirty(this), this.parent?.notifyValueChanged();
|
|
915
1213
|
});
|
|
916
1214
|
}
|
|
1215
|
+
errorsAfterChange(e) {
|
|
1216
|
+
let t = this.#t;
|
|
1217
|
+
t.errors.some(B) && (e.touch(this), this.removeErrors((e) => e.removeOn === "change"), t.errorsBaseline === D && t.errors.some(B) && (t.errorsBaseline = tt));
|
|
1218
|
+
}
|
|
917
1219
|
constructed(e) {}
|
|
918
1220
|
refreshPreviousValue() {
|
|
919
1221
|
this.#t.announcedContribution = this.contribution;
|
|
920
1222
|
}
|
|
921
1223
|
get countedValid() {
|
|
922
|
-
return this.#t.errors
|
|
1224
|
+
return this.ownErrorsValid(this.#t.errors) && this.#t.invalidChildren === 0;
|
|
923
1225
|
}
|
|
924
1226
|
takeChild(e, t) {
|
|
925
|
-
|
|
1227
|
+
w((n) => {
|
|
926
1228
|
if (e.parent) throw TypeError("This element already belongs to a container - pass a bind() of it");
|
|
1229
|
+
if (e === this) throw TypeError("A container cannot hold itself or a container above it");
|
|
1230
|
+
for (let t = this.parent; t; t = t.parent) if (t === e) throw TypeError("A container cannot hold itself or a container above it");
|
|
927
1231
|
n.touch(e), e.#e.fieldName = t;
|
|
928
1232
|
let r = this.effectiveAccess === "editable" ? void 0 : e.effectiveAccessFromHere();
|
|
929
|
-
e.#e.parent = this, r && e.revalidateWhereChanged(r), this.adoptChild(e);
|
|
1233
|
+
e.#e.parent = this, r && e.revalidateWhereChanged(r), gt() && e[dt](), this.adoptChild(e), Be(n, e);
|
|
930
1234
|
});
|
|
931
1235
|
}
|
|
932
1236
|
adoptChild(e) {
|
|
933
|
-
|
|
1237
|
+
w((t) => {
|
|
934
1238
|
t.touch(this), !e.#t.valid && e.countsInContainer && this.#t.invalidChildren++, e.validating && this.childValidatingChanged(!0), t.whenRolledBack(() => {
|
|
935
1239
|
e.validating && this.childValidatingChanged(!1);
|
|
936
1240
|
}), t.markValidityDirty(this);
|
|
937
1241
|
});
|
|
938
1242
|
}
|
|
939
1243
|
releaseChild(e) {
|
|
940
|
-
|
|
1244
|
+
w((t) => {
|
|
941
1245
|
t.touch(this), t.touch(e), !e.#t.valid && e.countsInContainer && this.#t.invalidChildren--;
|
|
942
1246
|
let n = this.effectiveAccess === "editable" ? void 0 : e.effectiveAccessFromHere();
|
|
943
1247
|
e.validating && this.childValidatingChanged(!1), t.whenRolledBack(() => {
|
|
944
1248
|
e.validating && this.childValidatingChanged(!0);
|
|
945
|
-
}), e.#e.parent = void 0, e.#e.fieldName = void 0, n && e.revalidateWhereChanged(n), t.markValidityDirty(this);
|
|
1249
|
+
}), e.#e.parent = void 0, e.#e.fieldName = void 0, n && e.revalidateWhereChanged(n), gt() && e[dt](), t.markValidityDirty(this);
|
|
946
1250
|
});
|
|
947
1251
|
}
|
|
948
1252
|
resetTo(e, t) {
|
|
949
|
-
|
|
1253
|
+
w(() => {
|
|
950
1254
|
let n = t === void 0 ? e.value : t, r = this.errors.length > 0;
|
|
951
1255
|
r && (this.errors = []), this.touched = !1;
|
|
952
1256
|
let i = this.value !== n;
|
|
@@ -954,7 +1258,29 @@ var at = 0, G = class {
|
|
|
954
1258
|
});
|
|
955
1259
|
}
|
|
956
1260
|
resetChild(e, t, n) {
|
|
957
|
-
e.resetTo(t, n);
|
|
1261
|
+
e !== t && (e.access = t.access, e.visibility = t.visibility, e.boundActions?.resetBinding(e)), e.resetTo(t, n), H?.push(e);
|
|
1262
|
+
}
|
|
1263
|
+
asReset(e) {
|
|
1264
|
+
if (H) {
|
|
1265
|
+
e();
|
|
1266
|
+
return;
|
|
1267
|
+
}
|
|
1268
|
+
let t = [];
|
|
1269
|
+
H = t;
|
|
1270
|
+
try {
|
|
1271
|
+
e();
|
|
1272
|
+
} finally {
|
|
1273
|
+
H = null;
|
|
1274
|
+
}
|
|
1275
|
+
t.forEach((e) => e.boundActions?.triggerEagerRules(e, e.contribution, e.contribution)), t.forEach((e) => e.recordBaseline());
|
|
1276
|
+
}
|
|
1277
|
+
baselineMembers() {
|
|
1278
|
+
this.members.forEach((e) => {
|
|
1279
|
+
e.baselineMembers(), e.recordBaseline();
|
|
1280
|
+
});
|
|
1281
|
+
}
|
|
1282
|
+
recordBaseline() {
|
|
1283
|
+
this.originalValue = this.value;
|
|
958
1284
|
}
|
|
959
1285
|
childValidityChanged(e) {}
|
|
960
1286
|
get visibility() {
|
|
@@ -962,12 +1288,12 @@ var at = 0, G = class {
|
|
|
962
1288
|
}
|
|
963
1289
|
set visibility(e) {
|
|
964
1290
|
let t = this.#e.visibility;
|
|
965
|
-
e !== t &&
|
|
966
|
-
let r = this.boundActions?.trigger(
|
|
967
|
-
if (r instanceof
|
|
1291
|
+
e !== t && w((n) => {
|
|
1292
|
+
let r = this.boundActions?.trigger(Qt, this, e, t);
|
|
1293
|
+
if (r instanceof E) return;
|
|
968
1294
|
let i = r ?? e;
|
|
969
|
-
if (!
|
|
970
|
-
n.touch(this), this.#
|
|
1295
|
+
if (!pe(i)) throw Error(`${z(i)} is not a visibility: ${cn(de)}`);
|
|
1296
|
+
i !== t && (n.touch(this), this.#t.announcedVisibility === void 0 && (this.#t.announcedVisibility = t), this.#e.visibility = i, n.markFlagsDirty(this));
|
|
971
1297
|
});
|
|
972
1298
|
}
|
|
973
1299
|
get access() {
|
|
@@ -975,29 +1301,29 @@ var at = 0, G = class {
|
|
|
975
1301
|
}
|
|
976
1302
|
set access(e) {
|
|
977
1303
|
let t = this.#e.access;
|
|
978
|
-
e !== t &&
|
|
979
|
-
let r = this.boundActions?.trigger(
|
|
980
|
-
if (r instanceof
|
|
1304
|
+
e !== t && w((n) => {
|
|
1305
|
+
let r = this.boundActions?.trigger(Bt, this, e, t);
|
|
1306
|
+
if (r instanceof E) return;
|
|
981
1307
|
let i = r ?? e;
|
|
982
|
-
if (!
|
|
1308
|
+
if (!ue(i)) throw Error(`${z(i)} is not an access: ${cn(_)}`);
|
|
983
1309
|
if (i === t) return;
|
|
984
1310
|
let a = this.enabled, o = i === "editable";
|
|
985
1311
|
if (o !== a) {
|
|
986
|
-
let e = this.boundActions?.trigger(
|
|
987
|
-
if (e instanceof
|
|
988
|
-
if (e != null && typeof e != "boolean") throw Error(`${
|
|
1312
|
+
let e = this.boundActions?.trigger(Kt, this, o, a);
|
|
1313
|
+
if (e instanceof E) return;
|
|
1314
|
+
if (e != null && typeof e != "boolean") throw Error(`${z(e)} is not what an EnabledChangingAction answers with: a boolean`);
|
|
989
1315
|
if (e === a) return;
|
|
990
1316
|
}
|
|
991
1317
|
n.touch(this);
|
|
992
1318
|
let s = this.contribution, c = this.countsInContainer, l = this.effectiveAccessBelow();
|
|
993
|
-
this.#e.access = i, this.revalidateWhereChanged(l), this.composesValue
|
|
1319
|
+
this.#e.access = i, this.revalidateWhereChanged(l), !this.composesValue && V(t) !== V(i) && this.boundActions?.triggerEager(this, this.contribution, s), this.contributionChanged(n, c), this.#t.announcedAccess === void 0 && (this.#t.announcedAccess = t), n.markFlagsDirty(this);
|
|
994
1320
|
});
|
|
995
1321
|
}
|
|
996
1322
|
get effectiveAccess() {
|
|
997
1323
|
let e = this.access, t = this.parent?.effectiveAccess;
|
|
998
1324
|
return t === "disabled" || t === "disabled-null" ? "disabled" : t === "readonly" && e === "editable" ? "readonly" : e;
|
|
999
1325
|
}
|
|
1000
|
-
[
|
|
1326
|
+
[He]() {
|
|
1001
1327
|
if (this.#t.access === "disabled") return !0;
|
|
1002
1328
|
for (let e = this.#t.parent; e; e = e.#t.parent) if (e.#t.access === "disabled" || e.#t.access === "disabled-null") return !0;
|
|
1003
1329
|
return !1;
|
|
@@ -1022,7 +1348,7 @@ var at = 0, G = class {
|
|
|
1022
1348
|
}
|
|
1023
1349
|
revalidateWhereChanged(e) {
|
|
1024
1350
|
e.forEach((e, t) => {
|
|
1025
|
-
t.effectiveAccess !== e && t.rerunEagerActions();
|
|
1351
|
+
V(t.effectiveAccess) !== V(e) && t.rerunEagerActions();
|
|
1026
1352
|
});
|
|
1027
1353
|
}
|
|
1028
1354
|
serializesAs(e) {
|
|
@@ -1062,54 +1388,68 @@ var at = 0, G = class {
|
|
|
1062
1388
|
childComposesValue(e) {
|
|
1063
1389
|
return e.composesValue;
|
|
1064
1390
|
}
|
|
1065
|
-
[
|
|
1391
|
+
[We](e, t, n, r) {
|
|
1066
1392
|
if (r?.forEach((e) => this.boundActions?.trigger(e.actionClass, this, e.item, e.index)), !t) return;
|
|
1067
|
-
let i = this.boundActions, a = this.composesValue, o = (e, t) => a ?
|
|
1393
|
+
let i = this.boundActions, a = this.composesValue, o = (e, t) => a ? h(e, t) : e === t;
|
|
1068
1394
|
if (a && i?.hasEager) {
|
|
1069
1395
|
let t = this.contribution, r = this.#t.validatedValue;
|
|
1070
|
-
(n || !
|
|
1396
|
+
(n || !h(t, r)) && (e.touch(this), this.#t.validatedValue = t, i.triggerEager(this, t, r));
|
|
1071
1397
|
}
|
|
1072
|
-
if (!a || i?.willTrigger(
|
|
1398
|
+
if (!a || i?.willTrigger(wt)) {
|
|
1073
1399
|
let t = this.holding, r = this.#t.announcedValue;
|
|
1074
|
-
(n || !o(t, r)) && (e.touch(this), this.#t.announcedValue = t, i?.trigger(
|
|
1400
|
+
(n || !o(t, r)) && (e.touch(this), this.#t.announcedValue = t, i?.trigger(N, this, t, r));
|
|
1075
1401
|
}
|
|
1076
|
-
if (i?.willTrigger(
|
|
1402
|
+
if (i?.willTrigger(Ut)) {
|
|
1077
1403
|
let t = this.contribution, n = this.#t.announcedContribution;
|
|
1078
|
-
o(t, n) || (e.touch(this), this.#t.announcedContribution = t, i.trigger(
|
|
1404
|
+
o(t, n) || (e.touch(this), this.#t.announcedContribution = t, i.trigger(Wt, this, t, n));
|
|
1079
1405
|
}
|
|
1080
1406
|
}
|
|
1081
1407
|
recordAnnounced() {
|
|
1082
1408
|
let e = this.boundActions;
|
|
1083
|
-
(!this.composesValue || e?.willTrigger(
|
|
1409
|
+
(!this.composesValue || e?.willTrigger(wt)) && (this.#t.announcedValue = this.holding), e?.willTrigger(Ut) && (this.#t.announcedContribution = this.contribution), this.composesValue && e?.hasEager && (this.#t.validatedValue = this.contribution), this.#t.errorsBaseline = D;
|
|
1410
|
+
}
|
|
1411
|
+
[Ke]() {
|
|
1412
|
+
let e = this.#t, t = e.announcedAccess;
|
|
1413
|
+
if (t !== void 0) {
|
|
1414
|
+
e.announcedAccess = void 0;
|
|
1415
|
+
let n = e.access;
|
|
1416
|
+
if (n !== t) {
|
|
1417
|
+
this.boundActions?.trigger(Ht, this, n, t);
|
|
1418
|
+
let e = n === "editable", r = t === "editable";
|
|
1419
|
+
e !== r && this.boundActions?.trigger(Jt, this, e, r);
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
let n = e.announcedVisibility;
|
|
1423
|
+
n !== void 0 && (e.announcedVisibility = void 0, e.visibility !== n && this.boundActions?.trigger(en, this, e.visibility, n));
|
|
1084
1424
|
}
|
|
1085
|
-
[
|
|
1425
|
+
[Ge](e) {
|
|
1086
1426
|
let t = this.#t.valid, n = this.countedValid;
|
|
1087
1427
|
if (n === t) return;
|
|
1088
1428
|
e.touch(this), this.#t.valid = n;
|
|
1089
1429
|
let r = this.container;
|
|
1090
|
-
r && this.countsInContainer && (e.touch(r), r.childValidityChanged(n), e.markValidityDirty(r)), this.boundActions?.trigger(
|
|
1430
|
+
r && this.countsInContainer && (e.touch(r), r.childValidityChanged(n), e.markValidityDirty(r)), this.boundActions?.trigger(Xt, this, n, t);
|
|
1091
1431
|
}
|
|
1092
1432
|
validate(e = !1) {
|
|
1093
|
-
|
|
1433
|
+
w((t) => {
|
|
1094
1434
|
e && this.boundActions?.triggerEager(this, this.contribution, this.contribution), t.markValidityDirty(this);
|
|
1095
1435
|
});
|
|
1096
1436
|
}
|
|
1097
1437
|
get valid() {
|
|
1098
|
-
return this.#e.errors
|
|
1438
|
+
return this.ownErrorsValid(this.#e.errors);
|
|
1099
1439
|
}
|
|
1100
1440
|
get fullValue() {
|
|
1101
1441
|
return this.value;
|
|
1102
1442
|
}
|
|
1103
1443
|
get isChanged() {
|
|
1104
|
-
return !
|
|
1444
|
+
return !h(this.value, this.originalValue);
|
|
1105
1445
|
}
|
|
1106
1446
|
boundFrom(e, t, n, r) {
|
|
1107
|
-
r &&
|
|
1447
|
+
r && ln(r), this.#t.declaration = e.declaration;
|
|
1108
1448
|
let i = {
|
|
1109
1449
|
...e.extra,
|
|
1110
1450
|
...r && this.extendedOf(r)
|
|
1111
1451
|
};
|
|
1112
|
-
|
|
1452
|
+
ne(i) || this.setExtendedValues(i);
|
|
1113
1453
|
let a = this.declaration;
|
|
1114
1454
|
a.noteBinding(this);
|
|
1115
1455
|
let o = a._actions;
|
|
@@ -1121,53 +1461,56 @@ var at = 0, G = class {
|
|
|
1121
1461
|
});
|
|
1122
1462
|
}
|
|
1123
1463
|
registerAction(e) {
|
|
1124
|
-
return
|
|
1125
|
-
t.willAnnounceValue(this) || this.refreshPreviousValue(), this.
|
|
1464
|
+
return w((t) => {
|
|
1465
|
+
t.willAnnounceValue(this) || this.refreshPreviousValue(), this.register(t, e);
|
|
1126
1466
|
}), this;
|
|
1127
1467
|
}
|
|
1128
1468
|
registerActionBefore(e, t) {
|
|
1129
|
-
return
|
|
1130
|
-
n.willAnnounceValue(this) || this.refreshPreviousValue(), this.
|
|
1469
|
+
return w((n) => {
|
|
1470
|
+
n.willAnnounceValue(this) || this.refreshPreviousValue(), this.register(n, e, t);
|
|
1131
1471
|
}), this;
|
|
1132
1472
|
}
|
|
1133
1473
|
unregisterAction(e) {
|
|
1134
1474
|
let t = !1;
|
|
1135
|
-
return
|
|
1475
|
+
return w((n) => {
|
|
1136
1476
|
let r = this.boundActions;
|
|
1137
|
-
if (!r
|
|
1138
|
-
|
|
1139
|
-
|
|
1477
|
+
if (!r) return;
|
|
1478
|
+
let i = r.registrations;
|
|
1479
|
+
if (t = r.unregister(e), !t) return;
|
|
1480
|
+
let a = this.boundElements;
|
|
1140
1481
|
n.whenRolledBack(() => {
|
|
1141
|
-
r.
|
|
1142
|
-
}),
|
|
1482
|
+
r.restore(i), a.forEach((t) => e.boundToBinding(t));
|
|
1483
|
+
}), a.forEach((t) => e.unregisterFrom(t));
|
|
1143
1484
|
}), t;
|
|
1144
1485
|
}
|
|
1145
|
-
|
|
1146
|
-
let
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1486
|
+
register(e, t, n) {
|
|
1487
|
+
let r = this.actions;
|
|
1488
|
+
this.releaseAbandoned(r);
|
|
1489
|
+
let i = r.registrations, a = this.boundElements;
|
|
1490
|
+
e.whenRolledBack(() => {
|
|
1491
|
+
let e = r.registrations.includes(t) && !i.includes(t);
|
|
1492
|
+
r.restore(i), e && a.forEach((e) => t.unregisterFrom(e));
|
|
1493
|
+
}), r.register(t, n), a.forEach((e) => {
|
|
1494
|
+
t.boundToBinding(e), t.eager && (e.#t.validatedValue = e.contribution, r.triggerEagerFor(t.classIdentifier, e, e.contribution, e.originalValue));
|
|
1151
1495
|
});
|
|
1152
1496
|
}
|
|
1497
|
+
releaseAbandoned(e) {
|
|
1498
|
+
let t = Date.now(), n = rn.get(e);
|
|
1499
|
+
n !== void 0 && t - n < nn || (rn.set(e, t), n !== void 0 && e.registrations.forEach((e) => e[et]?.()));
|
|
1500
|
+
}
|
|
1153
1501
|
triggerAction(e, ...t) {
|
|
1154
1502
|
let n = this.boundActions;
|
|
1155
1503
|
return n ? n.trigger(e, this, ...t) : null;
|
|
1156
1504
|
}
|
|
1157
|
-
get validationEpoch() {
|
|
1158
|
-
return this.#e.validationEpoch;
|
|
1159
|
-
}
|
|
1160
1505
|
clearValidators() {
|
|
1161
|
-
|
|
1162
|
-
e.touch(this)
|
|
1506
|
+
w((e) => {
|
|
1507
|
+
e.touch(this);
|
|
1163
1508
|
let t = this.boundActions;
|
|
1164
1509
|
if (t) {
|
|
1165
|
-
let n = this.boundElements;
|
|
1166
|
-
t.
|
|
1167
|
-
t.
|
|
1168
|
-
|
|
1169
|
-
}), n.forEach((e) => r.unregisterFrom(e));
|
|
1170
|
-
});
|
|
1510
|
+
let n = t.registrations, r = t.validators, i = this.boundElements;
|
|
1511
|
+
r.forEach((e) => t.unregister(e)), e.whenRolledBack(() => {
|
|
1512
|
+
t.restore(n), r.forEach((e) => i.forEach((t) => e.boundToBinding(t)));
|
|
1513
|
+
}), r.forEach((e) => i.forEach((t) => e.unregisterFrom(t)));
|
|
1171
1514
|
}
|
|
1172
1515
|
this.errors = [], this.validate();
|
|
1173
1516
|
});
|
|
@@ -1175,10 +1518,10 @@ var at = 0, G = class {
|
|
|
1175
1518
|
};
|
|
1176
1519
|
//#endregion
|
|
1177
1520
|
//#region src/actions/conditional/statement.ts
|
|
1178
|
-
function
|
|
1521
|
+
function dn(e, t) {
|
|
1179
1522
|
return e ? !t : t;
|
|
1180
1523
|
}
|
|
1181
|
-
var
|
|
1524
|
+
var fn = class e {
|
|
1182
1525
|
operand1;
|
|
1183
1526
|
operator;
|
|
1184
1527
|
operand2;
|
|
@@ -1187,13 +1530,13 @@ var st = class e {
|
|
|
1187
1530
|
if (typeof e == "function") throw TypeError(`Statement operand ${t} is a function: an operand is a field, a nested statement or a literal, and a function is none of them. An accessor states the field it answers with: group.field('name').`);
|
|
1188
1531
|
}
|
|
1189
1532
|
constructor(t, n, r) {
|
|
1190
|
-
e.validateOperand(t, 1), n !==
|
|
1533
|
+
e.validateOperand(t, 1), n !== R.NOT && e.validateOperand(r, 2), this.operand1 = t, this.operator = n, this.operand2 = r;
|
|
1191
1534
|
}
|
|
1192
1535
|
static valueOf(t, n) {
|
|
1193
1536
|
if (t instanceof e) return t.evaluate(n);
|
|
1194
|
-
if (t instanceof
|
|
1195
|
-
let e = n ?
|
|
1196
|
-
return e ?
|
|
1537
|
+
if (t instanceof U) {
|
|
1538
|
+
let e = n ? jt(t, n) : t;
|
|
1539
|
+
return e ? m(e.value) : void 0;
|
|
1197
1540
|
}
|
|
1198
1541
|
return t;
|
|
1199
1542
|
}
|
|
@@ -1206,117 +1549,139 @@ var st = class e {
|
|
|
1206
1549
|
evaluate(t) {
|
|
1207
1550
|
let n = e.valueOf(this.operand1, t), r = e.valueOf(this.operand2, t);
|
|
1208
1551
|
switch (this.operator) {
|
|
1209
|
-
case
|
|
1210
|
-
case
|
|
1211
|
-
case
|
|
1212
|
-
case
|
|
1213
|
-
case
|
|
1214
|
-
case
|
|
1215
|
-
case
|
|
1216
|
-
case
|
|
1217
|
-
case
|
|
1218
|
-
case
|
|
1219
|
-
case
|
|
1220
|
-
case
|
|
1221
|
-
case
|
|
1222
|
-
case
|
|
1223
|
-
case
|
|
1224
|
-
case
|
|
1552
|
+
case R.AND: return !!(n && r);
|
|
1553
|
+
case R.OR: return !!(n || r);
|
|
1554
|
+
case R.NAND: return !(n && r);
|
|
1555
|
+
case R.NOR: return !(n || r);
|
|
1556
|
+
case R.XOR: return dn(!!n, !!r);
|
|
1557
|
+
case R.NOT: return !n;
|
|
1558
|
+
case R.EQUALS: return n == r;
|
|
1559
|
+
case R.NOT_EQUALS: return n != r;
|
|
1560
|
+
case R.LT: return n < r;
|
|
1561
|
+
case R.LE: return n <= r;
|
|
1562
|
+
case R.GE: return n >= r;
|
|
1563
|
+
case R.GT: return n > r;
|
|
1564
|
+
case R.IN: return !!r?.includes?.(n);
|
|
1565
|
+
case R.NOT_IN: return !r?.includes?.(n);
|
|
1566
|
+
case R.INCLUDES: return g(n) && g(r) && n.indexOf(r) >= 0;
|
|
1567
|
+
case R.NOT_INCLUDES: return !(g(n) && g(r) && n.indexOf(r) >= 0);
|
|
1225
1568
|
default: throw Error(`Operator not implemented ${this.operator}`);
|
|
1226
1569
|
}
|
|
1227
1570
|
}
|
|
1228
1571
|
collectFields() {
|
|
1229
1572
|
let t = /* @__PURE__ */ new Set();
|
|
1230
1573
|
function n(n) {
|
|
1231
|
-
n instanceof
|
|
1574
|
+
n instanceof U ? t.add(n) : n instanceof e && n.collectFields().forEach((e) => t.add(e));
|
|
1232
1575
|
}
|
|
1233
1576
|
return n(this.operand1), n(this.operand2), t;
|
|
1234
1577
|
}
|
|
1235
|
-
},
|
|
1578
|
+
}, pn = Symbol("ExecuteAction"), W = class extends T {
|
|
1236
1579
|
constructor(e) {
|
|
1237
1580
|
super(e);
|
|
1238
1581
|
}
|
|
1239
1582
|
static get classIdentifier() {
|
|
1240
|
-
return
|
|
1583
|
+
return pn;
|
|
1241
1584
|
}
|
|
1242
1585
|
execute(e, t, n) {
|
|
1243
1586
|
return super.execute(e, t, n);
|
|
1244
1587
|
}
|
|
1245
|
-
|
|
1588
|
+
canExecute(e) {
|
|
1589
|
+
return !0;
|
|
1590
|
+
}
|
|
1591
|
+
}, mn = class extends W {
|
|
1592
|
+
targetFor(e) {
|
|
1593
|
+
let t = this.target;
|
|
1594
|
+
return typeof t == "function" ? t(e) ?? void 0 : t;
|
|
1595
|
+
}
|
|
1596
|
+
};
|
|
1597
|
+
function hn(e) {
|
|
1598
|
+
return e.validating ? new Promise((t) => {
|
|
1599
|
+
let n = ee(() => e.validating, (e) => {
|
|
1600
|
+
e || (n(), t());
|
|
1601
|
+
}, { flush: "sync" });
|
|
1602
|
+
}) : Promise.resolve();
|
|
1603
|
+
}
|
|
1604
|
+
var gn = class extends E {}, _n = class extends gn {
|
|
1246
1605
|
constructor(e) {
|
|
1247
|
-
super(e);
|
|
1606
|
+
super("the submit handler failed", { cause: e });
|
|
1248
1607
|
}
|
|
1249
|
-
|
|
1250
|
-
|
|
1608
|
+
}, vn = class extends gn {
|
|
1609
|
+
reason;
|
|
1610
|
+
constructor(e) {
|
|
1611
|
+
super(e === "invalid" ? "the submitted element is invalid" : "a submit of this action is already running"), this.reason = e;
|
|
1612
|
+
}
|
|
1613
|
+
}, yn = class extends mn {
|
|
1614
|
+
target;
|
|
1615
|
+
constructor(e, t, n = {}) {
|
|
1616
|
+
super(async (e, r, i) => {
|
|
1617
|
+
let a = this.state(e, () => ({ running: !1 }));
|
|
1618
|
+
if (a.running) throw new vn("running");
|
|
1619
|
+
a.running = !0;
|
|
1620
|
+
try {
|
|
1621
|
+
let a = this.targetFor(e);
|
|
1622
|
+
if (!a) throw Error("SubmitAction: the target callback returned no element");
|
|
1623
|
+
if (await hn(a), !a.valid) throw new vn("invalid");
|
|
1624
|
+
a[ft]();
|
|
1625
|
+
let o = a.value, s, c = n.lock !== !1 && a.access === "editable";
|
|
1626
|
+
c && (a.access = "readonly");
|
|
1627
|
+
let l = c && a.access === "readonly";
|
|
1628
|
+
try {
|
|
1629
|
+
try {
|
|
1630
|
+
s = await t(o, a);
|
|
1631
|
+
} catch (e) {
|
|
1632
|
+
throw new _n(e);
|
|
1633
|
+
}
|
|
1634
|
+
s !== void 0 && n.rebind !== !1 && a.rebind(s);
|
|
1635
|
+
} finally {
|
|
1636
|
+
l && a.access === "readonly" && (a.access = "editable");
|
|
1637
|
+
}
|
|
1638
|
+
return await r(e, i), {
|
|
1639
|
+
action: e,
|
|
1640
|
+
sent: o,
|
|
1641
|
+
received: s
|
|
1642
|
+
};
|
|
1643
|
+
} finally {
|
|
1644
|
+
a.running = !1;
|
|
1645
|
+
}
|
|
1646
|
+
}), this.target = e;
|
|
1251
1647
|
}
|
|
1252
|
-
|
|
1253
|
-
|
|
1648
|
+
canExecute(e) {
|
|
1649
|
+
let t = this.targetFor(e);
|
|
1650
|
+
return t !== void 0 && t.valid && !t.pending;
|
|
1254
1651
|
}
|
|
1255
|
-
},
|
|
1652
|
+
}, bn = class extends mn {
|
|
1653
|
+
target;
|
|
1256
1654
|
constructor(e) {
|
|
1257
|
-
super(e)
|
|
1655
|
+
super((e, t, n) => {
|
|
1656
|
+
let r = this.targetFor(e);
|
|
1657
|
+
if (!r) throw Error("RejectAction: the target callback returned no element");
|
|
1658
|
+
return r.rebind(r.originalValue), t(e, n);
|
|
1659
|
+
}), this.target = e;
|
|
1258
1660
|
}
|
|
1259
|
-
|
|
1260
|
-
return
|
|
1661
|
+
canExecute(e) {
|
|
1662
|
+
return this.targetFor(e) !== void 0;
|
|
1663
|
+
}
|
|
1664
|
+
}, xn = Symbol("ListItemAddedAction"), G = class extends T {
|
|
1665
|
+
constructor(e) {
|
|
1666
|
+
super(e);
|
|
1667
|
+
}
|
|
1668
|
+
static get classIdentifier() {
|
|
1669
|
+
return xn;
|
|
1261
1670
|
}
|
|
1262
1671
|
execute(e, t, n, r) {
|
|
1263
1672
|
return super.execute(e, t, n, r);
|
|
1264
1673
|
}
|
|
1265
|
-
},
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
validatingCount: 0,
|
|
1277
|
-
validatingChildren: 0,
|
|
1278
|
-
parent: void 0,
|
|
1279
|
-
fieldName: void 0,
|
|
1280
|
-
validationEpoch: 0,
|
|
1281
|
-
declaration: void 0,
|
|
1282
|
-
extra: pt,
|
|
1283
|
-
valid: !0,
|
|
1284
|
-
invalidChildren: 0
|
|
1285
|
-
};
|
|
1286
|
-
}
|
|
1287
|
-
function ht() {
|
|
1288
|
-
return {
|
|
1289
|
-
...mt(),
|
|
1290
|
-
value: void 0,
|
|
1291
|
-
touched: !1
|
|
1292
|
-
};
|
|
1293
|
-
}
|
|
1294
|
-
function gt() {
|
|
1295
|
-
return {
|
|
1296
|
-
...mt(),
|
|
1297
|
-
announcedValue: null,
|
|
1298
|
-
cachedValue: null,
|
|
1299
|
-
cachedValueVersion: -1
|
|
1300
|
-
};
|
|
1301
|
-
}
|
|
1302
|
-
function _t() {
|
|
1303
|
-
return {
|
|
1304
|
-
...gt(),
|
|
1305
|
-
fieldNames: []
|
|
1306
|
-
};
|
|
1307
|
-
}
|
|
1308
|
-
function vt() {
|
|
1309
|
-
return {
|
|
1310
|
-
...gt(),
|
|
1311
|
-
rows: null,
|
|
1312
|
-
rowsVersion: 0,
|
|
1313
|
-
cachedItems: null,
|
|
1314
|
-
cachedItemsVersion: -1
|
|
1315
|
-
};
|
|
1316
|
-
}
|
|
1317
|
-
//#endregion
|
|
1318
|
-
//#region src/field.ts
|
|
1319
|
-
var q = class extends G {
|
|
1674
|
+
}, Sn = Symbol("ListItemRemovedAction"), K = class extends T {
|
|
1675
|
+
constructor(e) {
|
|
1676
|
+
super(e);
|
|
1677
|
+
}
|
|
1678
|
+
static get classIdentifier() {
|
|
1679
|
+
return Sn;
|
|
1680
|
+
}
|
|
1681
|
+
execute(e, t, n, r) {
|
|
1682
|
+
return super.execute(e, t, n, r);
|
|
1683
|
+
}
|
|
1684
|
+
}, q = class extends U {
|
|
1320
1685
|
get [Symbol.toStringTag]() {
|
|
1321
1686
|
return "Field";
|
|
1322
1687
|
}
|
|
@@ -1330,13 +1695,13 @@ var q = class extends G {
|
|
|
1330
1695
|
return this.state.value;
|
|
1331
1696
|
}
|
|
1332
1697
|
set _value(e) {
|
|
1333
|
-
this.state.value = e;
|
|
1698
|
+
this.state.value = Fe(this, e);
|
|
1334
1699
|
}
|
|
1335
1700
|
constructor(e) {
|
|
1336
|
-
super(
|
|
1701
|
+
super(it()), this.init(e);
|
|
1337
1702
|
}
|
|
1338
1703
|
init(e) {
|
|
1339
|
-
|
|
1704
|
+
w(() => {
|
|
1340
1705
|
if (e) {
|
|
1341
1706
|
let { value: t, validators: n, actions: r, ...i } = e;
|
|
1342
1707
|
this.registerInitialActions([...n || [], ...r || []]), this.assignParams(i), this._value = t === void 0 ? this.originalValue : t;
|
|
@@ -1345,46 +1710,53 @@ var q = class extends G {
|
|
|
1345
1710
|
});
|
|
1346
1711
|
}
|
|
1347
1712
|
get value() {
|
|
1348
|
-
return this._value;
|
|
1713
|
+
return this.valueVersion, this._value;
|
|
1349
1714
|
}
|
|
1350
1715
|
set value(e) {
|
|
1351
1716
|
let t = this._value;
|
|
1352
|
-
t
|
|
1353
|
-
n.touch(this), this._value = e, this.bumpValueVersion(), this.serializesAs("value") === "value" && this.boundActions?.triggerEager(this,
|
|
1717
|
+
t === e || Number.isNaN(t) && Number.isNaN(e) || w((n) => {
|
|
1718
|
+
n.touch(this), this._value = e, this.bumpValueVersion(), this.serializesAs("value") === "value" && this.boundActions?.triggerEager(this, this._value, t), this.propagateValueChanged();
|
|
1719
|
+
});
|
|
1720
|
+
}
|
|
1721
|
+
[we](e, t, n) {
|
|
1722
|
+
w((r) => {
|
|
1723
|
+
r.touch(this);
|
|
1724
|
+
let i = this.raw;
|
|
1725
|
+
p(i.announcedValue) === p(i.value) && (i.announcedValue = n()), e(), r.whenRolledBack(t), this.bumpValueVersion(), this.serializesAs("value") === "value" && this.boundActions?.triggerEager(this, this._value, i.announcedValue), this.propagateValueChanged(!0);
|
|
1354
1726
|
});
|
|
1355
1727
|
}
|
|
1356
1728
|
get touched() {
|
|
1357
1729
|
return this.state.touched;
|
|
1358
1730
|
}
|
|
1359
1731
|
set touched(e) {
|
|
1360
|
-
this.touchState(), this.state.touched = e;
|
|
1732
|
+
this.touchState(), this.state.touched = e, e && this.editConcluded();
|
|
1361
1733
|
}
|
|
1362
1734
|
bind(e, t) {
|
|
1363
|
-
let n = this.constructor, r = new n({
|
|
1735
|
+
let n = this.constructor, r = Le(() => new n({
|
|
1364
1736
|
value: e === void 0 ? this.value : e,
|
|
1365
1737
|
...t && "originalValue" in t ? { originalValue: t.originalValue } : {},
|
|
1366
1738
|
access: t?.access ?? this.access,
|
|
1367
1739
|
visibility: t?.visibility ?? this.visibility
|
|
1368
|
-
});
|
|
1740
|
+
}));
|
|
1369
1741
|
return r.boundFrom(this, r.contribution, r.originalValue, t), r;
|
|
1370
1742
|
}
|
|
1371
|
-
},
|
|
1372
|
-
function
|
|
1743
|
+
}, Cn = /* @__PURE__ */ new WeakMap();
|
|
1744
|
+
function wn(e) {
|
|
1373
1745
|
if (e != null) return Object.values(e).some((e) => e != null) ? e : void 0;
|
|
1374
1746
|
}
|
|
1375
|
-
var
|
|
1747
|
+
var Tn = class extends q {
|
|
1376
1748
|
get [Symbol.toStringTag]() {
|
|
1377
1749
|
return "Action";
|
|
1378
1750
|
}
|
|
1379
1751
|
init(e) {
|
|
1380
|
-
|
|
1752
|
+
w(() => {
|
|
1381
1753
|
if (this._value = {
|
|
1382
1754
|
label: void 0,
|
|
1383
1755
|
icon: void 0
|
|
1384
1756
|
}, e) {
|
|
1385
1757
|
let { value: t, originalValue: n, validators: r, actions: i, ...a } = e;
|
|
1386
1758
|
this.registerInitialActions([...r || [], ...i || []]), this.assignParams(a);
|
|
1387
|
-
let o =
|
|
1759
|
+
let o = wn(t), s = wn(n);
|
|
1388
1760
|
o ? this._value = o : s && (this._value = { ...s }), s && (this.originalValue = Object.freeze({ ...s }));
|
|
1389
1761
|
}
|
|
1390
1762
|
this.constructed(e), this.originalValue === void 0 && (this.originalValue = this._value), this.recordAnnounced(), this.boundActions?.triggerEager(this, this.contribution, this.originalValue), this.validate();
|
|
@@ -1406,9 +1778,27 @@ var xt = class extends q {
|
|
|
1406
1778
|
set label(e) {
|
|
1407
1779
|
this.value.label !== e && (this.value = this.valueWith("label", e));
|
|
1408
1780
|
}
|
|
1781
|
+
get defaultConfirm() {
|
|
1782
|
+
return this.value.defaultConfirm ?? !1;
|
|
1783
|
+
}
|
|
1784
|
+
get defaultReject() {
|
|
1785
|
+
return this.value.defaultReject ?? !1;
|
|
1786
|
+
}
|
|
1787
|
+
serializesAs() {
|
|
1788
|
+
return "omit";
|
|
1789
|
+
}
|
|
1790
|
+
[He]() {
|
|
1791
|
+
return !0;
|
|
1792
|
+
}
|
|
1793
|
+
get executable() {
|
|
1794
|
+
return !this.effectiveEnabled || this.visibility !== "full" || this.busy ? !1 : this[ct]().every((e) => e.canExecute(this));
|
|
1795
|
+
}
|
|
1796
|
+
[ct]() {
|
|
1797
|
+
return this.boundActions?.ofClass(W.classIdentifier) ?? [];
|
|
1798
|
+
}
|
|
1409
1799
|
get busyRuns() {
|
|
1410
|
-
let e =
|
|
1411
|
-
return e || (e =
|
|
1800
|
+
let e = Cn.get(this);
|
|
1801
|
+
return e || (e = d(0), Cn.set(this, e)), e;
|
|
1412
1802
|
}
|
|
1413
1803
|
get busy() {
|
|
1414
1804
|
return this.busyRuns.value > 0;
|
|
@@ -1417,53 +1807,12 @@ var xt = class extends q {
|
|
|
1417
1807
|
let t = this.busyRuns;
|
|
1418
1808
|
t.value++;
|
|
1419
1809
|
try {
|
|
1420
|
-
return await this.triggerAction(
|
|
1810
|
+
return await this.triggerAction(W, e);
|
|
1421
1811
|
} finally {
|
|
1422
1812
|
t.value--;
|
|
1423
1813
|
}
|
|
1424
1814
|
}
|
|
1425
|
-
},
|
|
1426
|
-
__name: "messages-widget",
|
|
1427
|
-
props: {
|
|
1428
|
-
message: {},
|
|
1429
|
-
classes: {}
|
|
1430
|
-
},
|
|
1431
|
-
setup(e) {
|
|
1432
|
-
let t = e, n = u("vue-markdown"), i = /* @__PURE__ */ new Set(/* @__PURE__ */ "div.span.p.h1.h2.h3.h4.h5.h6.section.article.aside.nav.header.footer.main.figure.figcaption.blockquote.pre.code.em.strong.small.mark.del.ins.sub.sup.i.b.u.s.a.img.button.input.textarea.select.option.label.form.table.tr.td.th.thead.tbody.tfoot.ul.ol.li.dl.dt.dd".split(".")), o = () => {
|
|
1433
|
-
if (typeof t.message == "string") return a("span", { class: t.classes }, t.message);
|
|
1434
|
-
let e = [];
|
|
1435
|
-
return t.message.forEach((r) => {
|
|
1436
|
-
switch (r.componentName) {
|
|
1437
|
-
case "template":
|
|
1438
|
-
e.push(a("div", { class: [t.classes, r.extraClasses] }, r.componentBody));
|
|
1439
|
-
break;
|
|
1440
|
-
case "vue-markdown":
|
|
1441
|
-
if (typeof n == "string") console.warn("You are using markdown for messages-widget, but you haven't registered a vue-markdown component"), e.push(a("div", { class: [t.classes, r.extraClasses] }, r.componentBindings.source));
|
|
1442
|
-
else {
|
|
1443
|
-
let i = r.componentBindings;
|
|
1444
|
-
e.push(a(n, {
|
|
1445
|
-
class: [
|
|
1446
|
-
t.classes,
|
|
1447
|
-
r.extraClasses,
|
|
1448
|
-
"df-messages-widget-markdown"
|
|
1449
|
-
],
|
|
1450
|
-
source: i.source,
|
|
1451
|
-
options: i.options,
|
|
1452
|
-
plugins: i.plugins
|
|
1453
|
-
}));
|
|
1454
|
-
}
|
|
1455
|
-
break;
|
|
1456
|
-
default: e.push(a(i.has(r.componentName.toLowerCase()) ? r.componentName : u(r.componentName), {
|
|
1457
|
-
class: [t.classes, r.extraClasses],
|
|
1458
|
-
...r.componentBindings,
|
|
1459
|
-
...r.componentBody ? { innerHTML: r.componentBody } : {}
|
|
1460
|
-
}));
|
|
1461
|
-
}
|
|
1462
|
-
}), e;
|
|
1463
|
-
};
|
|
1464
|
-
return (e, t) => (s(), r(o));
|
|
1465
|
-
}
|
|
1466
|
-
}), Ct = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakMap(), J = class extends G {
|
|
1815
|
+
}, En = /* @__PURE__ */ new WeakMap(), Dn = /* @__PURE__ */ new WeakMap(), J = class e extends U {
|
|
1467
1816
|
get [Symbol.toStringTag]() {
|
|
1468
1817
|
return "Container";
|
|
1469
1818
|
}
|
|
@@ -1471,7 +1820,7 @@ var xt = class extends q {
|
|
|
1471
1820
|
return this.children.some((e) => e.touched);
|
|
1472
1821
|
}
|
|
1473
1822
|
set touched(e) {
|
|
1474
|
-
|
|
1823
|
+
w(() => {
|
|
1475
1824
|
this.members.forEach((t) => {
|
|
1476
1825
|
t.touched = e;
|
|
1477
1826
|
});
|
|
@@ -1484,13 +1833,45 @@ var xt = class extends q {
|
|
|
1484
1833
|
return this.busyRead;
|
|
1485
1834
|
}
|
|
1486
1835
|
validate(e = !1) {
|
|
1487
|
-
|
|
1836
|
+
w(() => {
|
|
1488
1837
|
e && this.members.forEach((e) => e.validate(!0)), super.validate(e);
|
|
1489
1838
|
});
|
|
1490
1839
|
}
|
|
1491
1840
|
notifyValueChanged() {
|
|
1492
1841
|
this.propagateValueChanged();
|
|
1493
1842
|
}
|
|
1843
|
+
confirm(e) {
|
|
1844
|
+
return this.command("confirm")?.execute(e);
|
|
1845
|
+
}
|
|
1846
|
+
reject(e) {
|
|
1847
|
+
return this.command("reject")?.execute(e);
|
|
1848
|
+
}
|
|
1849
|
+
serializesAs(e) {
|
|
1850
|
+
let t = this.children;
|
|
1851
|
+
return t.length > 0 && t.every((e) => this.childSerializesAs(e, "fullValue") === "omit") ? "omit" : super.serializesAs(e);
|
|
1852
|
+
}
|
|
1853
|
+
command(e) {
|
|
1854
|
+
let t = e === "confirm" ? yn : bn, n = e === "confirm" ? "defaultConfirm" : "defaultReject", r = this.actionsBelow().filter((e) => e.action.visibility === "full"), i = [
|
|
1855
|
+
r.filter(({ action: e }) => e[ct]().some((n) => n instanceof t && n.targetFor(e) === this)),
|
|
1856
|
+
r.filter(({ action: e, depth: t }) => t === 0 && e[n]),
|
|
1857
|
+
r.filter(({ action: e, depth: t }) => t > 0 && e[n])
|
|
1858
|
+
];
|
|
1859
|
+
for (let t of i) {
|
|
1860
|
+
if (t.length === 0) continue;
|
|
1861
|
+
if (t.length > 1) {
|
|
1862
|
+
console.warn(`${e}(): ${t.length} actions qualify, so none is executed`);
|
|
1863
|
+
return;
|
|
1864
|
+
}
|
|
1865
|
+
let { action: n } = t[0];
|
|
1866
|
+
return n.executable ? n : void 0;
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
actionsBelow(t = 0) {
|
|
1870
|
+
return this.children.flatMap((n) => n instanceof Tn ? [{
|
|
1871
|
+
action: n,
|
|
1872
|
+
depth: t
|
|
1873
|
+
}] : n instanceof e ? n.actionsBelow(t + 1) : []);
|
|
1874
|
+
}
|
|
1494
1875
|
get composesValue() {
|
|
1495
1876
|
return !0;
|
|
1496
1877
|
}
|
|
@@ -1501,12 +1882,12 @@ var xt = class extends q {
|
|
|
1501
1882
|
return this.fullValue;
|
|
1502
1883
|
}
|
|
1503
1884
|
get validRead() {
|
|
1504
|
-
let e =
|
|
1505
|
-
return e || (e =
|
|
1885
|
+
let e = En.get(this);
|
|
1886
|
+
return e || (e = l(() => this.ownErrorsValid(this.state.errors) && this.children.every((e) => e.valid || this.childSerializesAs(e, "value") === "omit")), En.set(this, e)), e.value;
|
|
1506
1887
|
}
|
|
1507
1888
|
get busyRead() {
|
|
1508
|
-
let e =
|
|
1509
|
-
return e || (e =
|
|
1889
|
+
let e = Dn.get(this);
|
|
1890
|
+
return e || (e = l(() => this.children.some((e) => e.busy)), Dn.set(this, e)), e.value;
|
|
1510
1891
|
}
|
|
1511
1892
|
childValidatingChanged(e) {
|
|
1512
1893
|
let t = this.validating;
|
|
@@ -1515,7 +1896,225 @@ var xt = class extends q {
|
|
|
1515
1896
|
childValidityChanged(e) {
|
|
1516
1897
|
this.raw.invalidChildren += e ? -1 : 1;
|
|
1517
1898
|
}
|
|
1518
|
-
},
|
|
1899
|
+
}, On = Object.freeze([]);
|
|
1900
|
+
function kn(e, t) {
|
|
1901
|
+
if (!Number.isInteger(e)) throw RangeError(`List.${t}(): the index must be an integer, got ${e}`);
|
|
1902
|
+
}
|
|
1903
|
+
var An = class e extends J {
|
|
1904
|
+
get [Symbol.toStringTag]() {
|
|
1905
|
+
return "List";
|
|
1906
|
+
}
|
|
1907
|
+
get state() {
|
|
1908
|
+
return super.state;
|
|
1909
|
+
}
|
|
1910
|
+
get raw() {
|
|
1911
|
+
return super.raw;
|
|
1912
|
+
}
|
|
1913
|
+
_itemTemplate;
|
|
1914
|
+
constructor(t, n) {
|
|
1915
|
+
super(st()), this._itemTemplate = t, t && Re(t), w(() => {
|
|
1916
|
+
if (n) {
|
|
1917
|
+
let { value: e, validators: t, actions: r, ...i } = n;
|
|
1918
|
+
this.registerInitialActions([...t || [], ...r || []]), this.assignParams(i), e === void 0 ? this.originalValue !== void 0 && this.setValueInternal(this.originalValue) : this.setValueInternal(e);
|
|
1919
|
+
}
|
|
1920
|
+
this.constructed(n), this.originalValue === void 0 && (this.originalValue = e.baseline(this.value)), this.recordAnnounced(), this.boundActions?.triggerEager(this, this.contribution, this.originalValue), this.validate();
|
|
1921
|
+
});
|
|
1922
|
+
}
|
|
1923
|
+
[y]() {
|
|
1924
|
+
let e = super[y]();
|
|
1925
|
+
return e.rows = this.raw.rows ? [...this.raw.rows] : this.raw.rows, e;
|
|
1926
|
+
}
|
|
1927
|
+
static baseline(e) {
|
|
1928
|
+
return e == null ? e : [...e];
|
|
1929
|
+
}
|
|
1930
|
+
processSetValueItem(t) {
|
|
1931
|
+
let n;
|
|
1932
|
+
return n = t instanceof U ? t : this._itemTemplate ? this._itemTemplate.bind(t) : e.elementFor(t), this.takeChild(n), this.completeRecords(n), n;
|
|
1933
|
+
}
|
|
1934
|
+
static elementFor(t) {
|
|
1935
|
+
return ae(t) ? Y.createFromFormData(t) : Array.isArray(t) ? new e(void 0, { value: t }) : new q({ value: t });
|
|
1936
|
+
}
|
|
1937
|
+
createPaddingItem(t) {
|
|
1938
|
+
return this._itemTemplate ? this.processSetValueItem(this._itemTemplate.bind()) : t instanceof Y || ae(t) ? this.processSetValueItem({}) : t instanceof e || Array.isArray(t) ? this.processSetValueItem([]) : this.processSetValueItem(void 0);
|
|
1939
|
+
}
|
|
1940
|
+
rowsChanged() {
|
|
1941
|
+
this.state.rowsVersion++;
|
|
1942
|
+
}
|
|
1943
|
+
static rowsDiffer(e, t) {
|
|
1944
|
+
let n = e ?? [], r = t ?? [];
|
|
1945
|
+
return n.length !== r.length || n.some((e, t) => e !== r[t]);
|
|
1946
|
+
}
|
|
1947
|
+
setValueInternal(t, n = !1) {
|
|
1948
|
+
if (t != null && !Array.isArray(t)) throw TypeError("Invalid value provided: a list takes an array of rows, or null to empty it");
|
|
1949
|
+
w((r) => this.asReset(() => {
|
|
1950
|
+
r.touch(this);
|
|
1951
|
+
let i = this.raw.rows, a = (e, t) => {
|
|
1952
|
+
n && r.recordStructural(this, {
|
|
1953
|
+
actionClass: K,
|
|
1954
|
+
item: e,
|
|
1955
|
+
index: t
|
|
1956
|
+
});
|
|
1957
|
+
}, o = (e, t) => {
|
|
1958
|
+
n && r.recordStructural(this, {
|
|
1959
|
+
actionClass: G,
|
|
1960
|
+
item: e,
|
|
1961
|
+
index: t
|
|
1962
|
+
});
|
|
1963
|
+
};
|
|
1964
|
+
if (t == null) {
|
|
1965
|
+
let e = this.raw.rows ?? [];
|
|
1966
|
+
for (let t = e.length - 1; t >= 0; t--) a(e[t], t);
|
|
1967
|
+
this.releaseRows(), this.raw.rows = null;
|
|
1968
|
+
} else {
|
|
1969
|
+
let e = this.raw.rows ?? [];
|
|
1970
|
+
for (let n = e.length - 1; n >= t.length; n--) a(e[n], n);
|
|
1971
|
+
let n = Array(t.length);
|
|
1972
|
+
for (let r = 0; r < t.length; r++) {
|
|
1973
|
+
let i = t[r], s = e[r], c = this._itemTemplate;
|
|
1974
|
+
s && c && !(i instanceof U) && s.declaration === c.declaration ? (this.resetChild(s, c, i), n[r] = s) : (s && (this.releaseChild(s), a(s, r)), n[r] = this.processSetValueItem(i), o(n[r], r));
|
|
1975
|
+
}
|
|
1976
|
+
for (let n = t.length; n < e.length; n++) this.releaseChild(e[n]);
|
|
1977
|
+
this.raw.rows = n;
|
|
1978
|
+
}
|
|
1979
|
+
e.rowsDiffer(i, this.raw.rows) && this.rowsChanged(), this.bumpValueVersion();
|
|
1980
|
+
}));
|
|
1981
|
+
}
|
|
1982
|
+
get value() {
|
|
1983
|
+
let e = this.valueVersion;
|
|
1984
|
+
if (this.raw.cachedValueVersion === e) return this.raw.cachedValue;
|
|
1985
|
+
let t = [];
|
|
1986
|
+
(this.rows ?? []).forEach((e) => {
|
|
1987
|
+
switch (this.childSerializesAs(e, "value")) {
|
|
1988
|
+
case "value":
|
|
1989
|
+
t.push(e.value);
|
|
1990
|
+
break;
|
|
1991
|
+
case "null": t.push(null);
|
|
1992
|
+
}
|
|
1993
|
+
});
|
|
1994
|
+
let n = t.length ? Object.freeze(t) : On;
|
|
1995
|
+
return this.raw.cachedValue = n, this.raw.cachedValueVersion = e, n;
|
|
1996
|
+
}
|
|
1997
|
+
set value(e) {
|
|
1998
|
+
w(() => {
|
|
1999
|
+
this.setValueInternal(e, !0), this.propagateValueChanged(!0);
|
|
2000
|
+
});
|
|
2001
|
+
}
|
|
2002
|
+
resetTo(e, t) {
|
|
2003
|
+
w((n) => {
|
|
2004
|
+
n.touch(this), this.errors.length && (this.errors = []), this.setValueInternal(t === void 0 ? e.fullValue : t), this.recordBaseline(), super.validate(!0);
|
|
2005
|
+
});
|
|
2006
|
+
}
|
|
2007
|
+
recordBaseline() {
|
|
2008
|
+
this.recordAnnounced(), this.originalValue = e.baseline(this.value);
|
|
2009
|
+
}
|
|
2010
|
+
bind(e, t) {
|
|
2011
|
+
let n = this._itemTemplate?.bind(), r = this.constructor, i = Le(() => new r(n, {
|
|
2012
|
+
value: [...(e === void 0 ? this.fullValue : e) ?? []],
|
|
2013
|
+
...t && "originalValue" in t ? { originalValue: t.originalValue } : {},
|
|
2014
|
+
access: t?.access ?? this.access,
|
|
2015
|
+
visibility: t?.visibility ?? this.visibility
|
|
2016
|
+
}));
|
|
2017
|
+
if (i._itemTemplate !== n) throw TypeError(`${this.constructor.name}.bind() built a list that did not take the item template it was given, so the binding would carry the declaration's rows. A subclass whose constructor does not take (itemTemplate, params) has to override bind() and construct itself.`);
|
|
2018
|
+
return i.boundFrom(this, i.contribution, i.originalValue, t), i;
|
|
2019
|
+
}
|
|
2020
|
+
get rows() {
|
|
2021
|
+
return this.state.rowsVersion, this.raw.rows;
|
|
2022
|
+
}
|
|
2023
|
+
get members() {
|
|
2024
|
+
return this.raw.rows ?? [];
|
|
2025
|
+
}
|
|
2026
|
+
get children() {
|
|
2027
|
+
return this.rows ?? [];
|
|
2028
|
+
}
|
|
2029
|
+
get fullValue() {
|
|
2030
|
+
return (this.rows ?? []).filter((e) => this.childSerializesAs(e, "fullValue") !== "omit").map((e) => e.fullValue);
|
|
2031
|
+
}
|
|
2032
|
+
get length() {
|
|
2033
|
+
return this.rows?.length ?? 0;
|
|
2034
|
+
}
|
|
2035
|
+
get items() {
|
|
2036
|
+
let e = this.state.rowsVersion;
|
|
2037
|
+
return this.raw.cachedItemsVersion !== e && (this.raw.cachedItems = Object.freeze([...this.raw.rows ?? []]), this.raw.cachedItemsVersion = e), this.raw.cachedItems;
|
|
2038
|
+
}
|
|
2039
|
+
get(e) {
|
|
2040
|
+
return this.rows?.[e];
|
|
2041
|
+
}
|
|
2042
|
+
push(e) {
|
|
2043
|
+
return this.insert(e, this.raw.rows?.length ?? 0) + 1;
|
|
2044
|
+
}
|
|
2045
|
+
pop() {
|
|
2046
|
+
return this.remove((this.raw.rows?.length ?? 0) - 1);
|
|
2047
|
+
}
|
|
2048
|
+
remove(e) {
|
|
2049
|
+
kn(e, "remove");
|
|
2050
|
+
let t;
|
|
2051
|
+
return w((n) => {
|
|
2052
|
+
let r = this.raw.rows;
|
|
2053
|
+
if (r == null || e < 0 || r.length <= e) return;
|
|
2054
|
+
n.touch(this);
|
|
2055
|
+
let i = r.splice(e, 1)?.[0];
|
|
2056
|
+
i && (this.releaseChild(i), this.rowsChanged(), this.bumpValueVersion(), t = i, n.recordStructural(this, {
|
|
2057
|
+
actionClass: K,
|
|
2058
|
+
item: t,
|
|
2059
|
+
index: e
|
|
2060
|
+
}), this.propagateValueChanged(!0));
|
|
2061
|
+
}), t;
|
|
2062
|
+
}
|
|
2063
|
+
insert(e, t) {
|
|
2064
|
+
kn(t, "insert");
|
|
2065
|
+
let n = 0;
|
|
2066
|
+
return w((r) => {
|
|
2067
|
+
r.touch(this);
|
|
2068
|
+
let i = this.raw.rows ??= [];
|
|
2069
|
+
for (n = t < 0 ? Math.max(i.length + t, 0) : t; i.length < n;) {
|
|
2070
|
+
let t = this.createPaddingItem(e), n = i.push(t) - 1;
|
|
2071
|
+
this.bumpValueVersion(), r.recordStructural(this, {
|
|
2072
|
+
actionClass: G,
|
|
2073
|
+
item: t,
|
|
2074
|
+
index: n
|
|
2075
|
+
});
|
|
2076
|
+
}
|
|
2077
|
+
let a = this.processSetValueItem(e);
|
|
2078
|
+
i.splice(n, 0, a), r.recordStructural(this, {
|
|
2079
|
+
actionClass: G,
|
|
2080
|
+
item: a,
|
|
2081
|
+
index: n
|
|
2082
|
+
}), this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(!0);
|
|
2083
|
+
}), n;
|
|
2084
|
+
}
|
|
2085
|
+
releaseRows() {
|
|
2086
|
+
this.raw.rows?.forEach((e) => this.releaseChild(e));
|
|
2087
|
+
}
|
|
2088
|
+
[lt](e) {
|
|
2089
|
+
w((t) => {
|
|
2090
|
+
t.touch(this), this.raw.rows = [...e], this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(!0);
|
|
2091
|
+
});
|
|
2092
|
+
}
|
|
2093
|
+
clear() {
|
|
2094
|
+
w((e) => {
|
|
2095
|
+
let t = this.raw.rows ?? [], n = t.length > 0;
|
|
2096
|
+
e.touch(this);
|
|
2097
|
+
for (let n = t.length - 1; n >= 0; n--) e.recordStructural(this, {
|
|
2098
|
+
actionClass: K,
|
|
2099
|
+
item: t[n],
|
|
2100
|
+
index: n
|
|
2101
|
+
});
|
|
2102
|
+
this.releaseRows(), this.raw.rows = null, n && this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(n);
|
|
2103
|
+
});
|
|
2104
|
+
}
|
|
2105
|
+
rebind(e) {
|
|
2106
|
+
return super.rebind(e);
|
|
2107
|
+
}
|
|
2108
|
+
}, jn = /* @__PURE__ */ new WeakSet();
|
|
2109
|
+
function Mn(e) {
|
|
2110
|
+
if (e === "$" || e === "then" || e.startsWith("__v_")) throw TypeError(`A view cannot hold a member named ${e}: $ is the element the view stands for, and then and __v_* are read by the language and by Vue`);
|
|
2111
|
+
}
|
|
2112
|
+
//#endregion
|
|
2113
|
+
//#region src/group.ts
|
|
2114
|
+
function Nn(e) {
|
|
2115
|
+
return ae(e) ? Y.createFromFormData(e) : Array.isArray(e) ? new An(void 0, { value: e }) : new q({ value: e });
|
|
2116
|
+
}
|
|
2117
|
+
var Pn = /* @__PURE__ */ new WeakSet(), Fn = Object.freeze({}), In = /* @__PURE__ */ new WeakMap(), Ln = (e) => ({
|
|
1519
2118
|
get(t, n, r) {
|
|
1520
2119
|
return e(), Reflect.get(t, n, r);
|
|
1521
2120
|
},
|
|
@@ -1549,41 +2148,51 @@ var xt = class extends q {
|
|
|
1549
2148
|
}
|
|
1550
2149
|
_fields;
|
|
1551
2150
|
constructor(t, n) {
|
|
1552
|
-
if (super(
|
|
1553
|
-
this._fields = Object.create(null),
|
|
1554
|
-
|
|
2151
|
+
if (super(ot()), !e.isValidFields(t)) throw Error("Invalid fields object provided");
|
|
2152
|
+
this._fields = Object.create(null), w(() => {
|
|
2153
|
+
let r = !1, i = !1;
|
|
2154
|
+
Pn.add(this);
|
|
1555
2155
|
try {
|
|
1556
2156
|
if (Object.entries(t).forEach(([e, t]) => this.addField(e, t)), n) {
|
|
1557
|
-
let { value: e, validators: t, actions:
|
|
1558
|
-
this.registerInitialActions([...t || [], ...
|
|
2157
|
+
let { value: e, validators: t, actions: a, ...o } = n;
|
|
2158
|
+
this.registerInitialActions([...t || [], ...a || []]), this.assignParams(o), e === void 0 ? this.originalValue !== void 0 && this.assignMembers(this.originalValue) : this.assignMembers(e), r = e !== void 0 || this.originalValue !== void 0, i = n.originalValue !== void 0 && e !== void 0;
|
|
1559
2159
|
}
|
|
1560
2160
|
} finally {
|
|
1561
|
-
|
|
2161
|
+
Pn.delete(this);
|
|
1562
2162
|
}
|
|
1563
2163
|
this.completeRecords(), this.constructed(n);
|
|
1564
|
-
let
|
|
1565
|
-
this.originalValue === void 0 && (this.originalValue = e.baseline(
|
|
2164
|
+
let a = this.value;
|
|
2165
|
+
this.originalValue === void 0 && (this.originalValue = e.baseline(a)), this.recordAnnounced(), this.boundActions?.triggerEager(this, this.contribution, this.originalValue), r && (this.baselineMembers(), i && this.baselineMembersFrom(this.originalValue)), this.validate();
|
|
1566
2166
|
});
|
|
1567
2167
|
}
|
|
1568
|
-
|
|
1569
|
-
|
|
2168
|
+
baselineMembersFrom(t) {
|
|
2169
|
+
Object.entries(this._fields).forEach(([n, r]) => {
|
|
2170
|
+
if (this.childSerializesAs(r, "fullValue") === "omit" || t != null && !Object.hasOwn(t, n)) return;
|
|
2171
|
+
let i = t == null ? null : t[n];
|
|
2172
|
+
r instanceof e && r.baselineMembersFrom(i), r.originalValue = i;
|
|
2173
|
+
});
|
|
2174
|
+
}
|
|
2175
|
+
[y]() {
|
|
2176
|
+
let e = super[y]();
|
|
1570
2177
|
return e.fieldNames = [...this.raw.fieldNames], e;
|
|
1571
2178
|
}
|
|
1572
2179
|
static baseline(e) {
|
|
1573
2180
|
return e == null ? e : { ...e };
|
|
1574
2181
|
}
|
|
1575
2182
|
addField(t, n) {
|
|
1576
|
-
return
|
|
2183
|
+
return w((r) => {
|
|
1577
2184
|
if (Object.hasOwn(this._fields, t)) throw Error(`Field ${t} is already in this form`);
|
|
1578
|
-
this.takeChild(n, t), r.touch(this), e.setEntry(this._fields, t, n), r.whenRolledBack(() => e.dropEntry(this._fields, t)), this.state.fieldNames.push(t),
|
|
2185
|
+
jn.has(this) && Mn(t), this.takeChild(n, t), r.touch(this), e.setEntry(this._fields, t, n), r.whenRolledBack(() => e.dropEntry(this._fields, t)), this.state.fieldNames.push(t), Pn.has(this) || this.completeRecords(n), this.bumpValueVersion(), this.notifyValueChanged();
|
|
1579
2186
|
}), this;
|
|
1580
2187
|
}
|
|
1581
2188
|
removeField(t) {
|
|
1582
2189
|
let n;
|
|
1583
|
-
return
|
|
2190
|
+
return w((r) => {
|
|
1584
2191
|
if (!Object.hasOwn(this._fields, t)) return;
|
|
1585
2192
|
let i = this._fields[t];
|
|
1586
|
-
r.touch(this), this.releaseChild(i)
|
|
2193
|
+
r.touch(this), this.releaseChild(i);
|
|
2194
|
+
let a = Object.entries(this._fields);
|
|
2195
|
+
e.dropEntry(this._fields, t), r.whenRolledBack(() => e.restoreEntries(this._fields, a)), this.state.fieldNames.splice(this.state.fieldNames.indexOf(t), 1), this.bumpValueVersion(), this.notifyValueChanged(), n = i;
|
|
1587
2196
|
}), n;
|
|
1588
2197
|
}
|
|
1589
2198
|
static setEntry(e, t, n) {
|
|
@@ -1592,22 +2201,25 @@ var xt = class extends q {
|
|
|
1592
2201
|
static dropEntry(e, t) {
|
|
1593
2202
|
delete e[t];
|
|
1594
2203
|
}
|
|
2204
|
+
static restoreEntries(t, n) {
|
|
2205
|
+
Object.keys(t).forEach((n) => e.dropEntry(t, n)), n.forEach(([n, r]) => e.setEntry(t, n, r));
|
|
2206
|
+
}
|
|
1595
2207
|
static isValidFields(e) {
|
|
1596
2208
|
function t(e) {
|
|
1597
|
-
return e instanceof
|
|
2209
|
+
return e instanceof U;
|
|
1598
2210
|
}
|
|
1599
2211
|
return typeof e == "object" && !!e && Object.entries(e).every(([, e]) => t(e));
|
|
1600
2212
|
}
|
|
1601
2213
|
static createFromFormData(t) {
|
|
1602
|
-
if (t instanceof
|
|
1603
|
-
return new e(t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, t]) => [e,
|
|
2214
|
+
if (t instanceof U) throw Error("data is already a Form structure, should be a simple object");
|
|
2215
|
+
return new e(t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, t]) => [e, Nn(t)])));
|
|
1604
2216
|
}
|
|
1605
2217
|
field(e) {
|
|
1606
2218
|
return this._fields[e] ?? null;
|
|
1607
2219
|
}
|
|
1608
2220
|
get fields() {
|
|
1609
|
-
let e =
|
|
1610
|
-
return e || (e = new Proxy(this._fields,
|
|
2221
|
+
let e = In.get(this);
|
|
2222
|
+
return e || (e = new Proxy(this._fields, Ln(() => this.state.fieldNames.length)), In.set(this, e)), e;
|
|
1611
2223
|
}
|
|
1612
2224
|
get members() {
|
|
1613
2225
|
return this.raw.fieldNames.map((e) => this._fields[e]);
|
|
@@ -1627,34 +2239,37 @@ var xt = class extends q {
|
|
|
1627
2239
|
case "null": t[e] = null;
|
|
1628
2240
|
}
|
|
1629
2241
|
});
|
|
1630
|
-
let n =
|
|
2242
|
+
let n = ne(t) ? Fn : Object.freeze({ ...t });
|
|
1631
2243
|
return this.raw.cachedValue = n, this.raw.cachedValueVersion = e, n;
|
|
1632
2244
|
}
|
|
1633
2245
|
assignMembers(e) {
|
|
1634
|
-
|
|
2246
|
+
w(() => {
|
|
1635
2247
|
Object.entries(this._fields).forEach(([t, n]) => {
|
|
1636
|
-
(e == null || Object.hasOwn(e, t)) && (n.value = e == null ? null : e[t]);
|
|
2248
|
+
this.childSerializesAs(n, "fullValue") !== "omit" && (e == null || Object.hasOwn(e, t)) && (n.value = e == null ? null : e[t]);
|
|
1637
2249
|
});
|
|
1638
2250
|
});
|
|
1639
2251
|
}
|
|
1640
2252
|
set value(e) {
|
|
1641
|
-
|
|
2253
|
+
w((t) => {
|
|
1642
2254
|
this.assignMembers(e), t.markValidityDirty(this);
|
|
1643
2255
|
});
|
|
1644
2256
|
}
|
|
1645
|
-
resetTo(
|
|
1646
|
-
let
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
let i;
|
|
1650
|
-
|
|
1651
|
-
}), this.
|
|
2257
|
+
resetTo(e, t) {
|
|
2258
|
+
let n = e;
|
|
2259
|
+
w((e) => {
|
|
2260
|
+
e.touch(this), this.errors.length && (this.errors = []), Object.entries(this._fields).forEach(([e, r]) => {
|
|
2261
|
+
let i = n.field(e) ?? r, a;
|
|
2262
|
+
this.childSerializesAs(r, "fullValue") === "omit" ? a = void 0 : t === null ? a = null : t !== void 0 && (a = Object.hasOwn(t, e) ? t[e] : i.originalValue), this.resetChild(r, i, a);
|
|
2263
|
+
}), this.recordBaseline(), super.validate(!0);
|
|
1652
2264
|
});
|
|
1653
2265
|
}
|
|
2266
|
+
recordBaseline() {
|
|
2267
|
+
this.recordAnnounced(), this.originalValue = e.baseline(this.value);
|
|
2268
|
+
}
|
|
1654
2269
|
get fullValue() {
|
|
1655
2270
|
let e = Object.create(null);
|
|
1656
2271
|
return Object.entries(this._fields).forEach(([t, n]) => {
|
|
1657
|
-
e[t] = n.fullValue;
|
|
2272
|
+
this.childSerializesAs(n, "fullValue") !== "omit" && (e[t] = n.fullValue);
|
|
1658
2273
|
}), { ...e };
|
|
1659
2274
|
}
|
|
1660
2275
|
static assertTookFields(e, t, n) {
|
|
@@ -1666,13 +2281,20 @@ var xt = class extends q {
|
|
|
1666
2281
|
Object.entries(this._fields).forEach(([e, t]) => {
|
|
1667
2282
|
r[e] = t.bind();
|
|
1668
2283
|
});
|
|
1669
|
-
let i = this.constructor, a = new i(r, {
|
|
1670
|
-
value: t === void 0 ? this.fullValue : t,
|
|
2284
|
+
let i = this.constructor, a = Le(() => new i(r, {
|
|
2285
|
+
value: t === void 0 ? this.fullValue : this.withBaselines(t),
|
|
1671
2286
|
...n && "originalValue" in n ? { originalValue: n.originalValue } : {},
|
|
1672
2287
|
access: n?.access ?? this.access,
|
|
1673
2288
|
visibility: n?.visibility ?? this.visibility
|
|
1674
|
-
});
|
|
1675
|
-
return e.assertTookFields(a, r, this.constructor.name), a.boundFrom(this, a.contribution, a.originalValue, n), a;
|
|
2289
|
+
}));
|
|
2290
|
+
return e.assertTookFields(a, r, this.constructor.name), a.boundFrom(this, a.contribution, a.originalValue, n), a.baselineMembers(), n?.originalValue !== void 0 && a.baselineMembersFrom(a.originalValue), a;
|
|
2291
|
+
}
|
|
2292
|
+
withBaselines(e) {
|
|
2293
|
+
if (e === null) return e;
|
|
2294
|
+
let t = { ...e };
|
|
2295
|
+
return Object.entries(this._fields).forEach(([e, n]) => {
|
|
2296
|
+
!Object.hasOwn(t, e) && this.childSerializesAs(n, "fullValue") !== "omit" && (t[e] = n.originalValue);
|
|
2297
|
+
}), t;
|
|
1676
2298
|
}
|
|
1677
2299
|
rebind(e) {
|
|
1678
2300
|
return super.rebind(e);
|
|
@@ -1680,208 +2302,56 @@ var xt = class extends q {
|
|
|
1680
2302
|
};
|
|
1681
2303
|
//#endregion
|
|
1682
2304
|
//#region src/is-equal.ts
|
|
1683
|
-
function
|
|
1684
|
-
let n = e instanceof
|
|
1685
|
-
return n === e && r === t ? void 0 :
|
|
2305
|
+
function Rn(e, t) {
|
|
2306
|
+
let n = e instanceof U ? e.value : e, r = t instanceof U ? t.value : t;
|
|
2307
|
+
return n === e && r === t ? void 0 : h(n, r);
|
|
1686
2308
|
}
|
|
1687
|
-
function
|
|
1688
|
-
return e instanceof
|
|
2309
|
+
function zn(e, t) {
|
|
2310
|
+
return e instanceof U && t instanceof U ? h(e.value, t.value) : re(e, t, Rn);
|
|
1689
2311
|
}
|
|
1690
2312
|
//#endregion
|
|
1691
|
-
//#region src/
|
|
1692
|
-
var
|
|
1693
|
-
get [Symbol.toStringTag]() {
|
|
1694
|
-
return "List";
|
|
1695
|
-
}
|
|
1696
|
-
get state() {
|
|
1697
|
-
return super.state;
|
|
1698
|
-
}
|
|
1699
|
-
get raw() {
|
|
1700
|
-
return super.raw;
|
|
1701
|
-
}
|
|
1702
|
-
_itemTemplate;
|
|
1703
|
-
constructor(t, n) {
|
|
1704
|
-
super(vt()), this._itemTemplate = t, A(() => {
|
|
1705
|
-
if (n) {
|
|
1706
|
-
let { value: e, validators: t, actions: r, ...i } = n;
|
|
1707
|
-
this.registerInitialActions([...t || [], ...r || []]), this.assignParams(i), e === void 0 ? this.originalValue !== void 0 && this.setValueInternal(this.originalValue) : this.setValueInternal(e);
|
|
1708
|
-
}
|
|
1709
|
-
this.constructed(n), this.originalValue === void 0 && (this.originalValue = e.baseline(this.value)), this.recordAnnounced(), this.boundActions?.triggerEager(this, this.contribution, this.originalValue), this.validate();
|
|
1710
|
-
});
|
|
1711
|
-
}
|
|
1712
|
-
[E]() {
|
|
1713
|
-
let e = super[E]();
|
|
1714
|
-
return e.rows = this.raw.rows ? [...this.raw.rows] : this.raw.rows, e;
|
|
1715
|
-
}
|
|
1716
|
-
static baseline(e) {
|
|
1717
|
-
return e == null ? e : [...e];
|
|
1718
|
-
}
|
|
1719
|
-
processSetValueItem(t) {
|
|
1720
|
-
let n;
|
|
1721
|
-
return n = t instanceof G ? t : this._itemTemplate ? this._itemTemplate.bind(t) : e.elementFor(t), this.takeChild(n), this.completeRecords(n), n;
|
|
1722
|
-
}
|
|
1723
|
-
static elementFor(t) {
|
|
1724
|
-
return ne(t) ? Y.createFromFormData(t) : Array.isArray(t) ? new e(void 0, { value: t }) : new q({ value: t });
|
|
1725
|
-
}
|
|
1726
|
-
createPaddingItem(t) {
|
|
1727
|
-
return this._itemTemplate ? this.processSetValueItem(this._itemTemplate.bind()) : t instanceof Y || ne(t) ? this.processSetValueItem({}) : t instanceof e || Array.isArray(t) ? this.processSetValueItem([]) : this.processSetValueItem(void 0);
|
|
1728
|
-
}
|
|
1729
|
-
rowsChanged() {
|
|
1730
|
-
this.state.rowsVersion++;
|
|
1731
|
-
}
|
|
1732
|
-
static rowsDiffer(e, t) {
|
|
1733
|
-
let n = e ?? [], r = t ?? [];
|
|
1734
|
-
return n.length !== r.length || n.some((e, t) => e !== r[t]);
|
|
1735
|
-
}
|
|
1736
|
-
setValueInternal(t) {
|
|
1737
|
-
if (t != null && !Array.isArray(t)) throw TypeError("Invalid value provided: a list takes an array of rows, or null to empty it");
|
|
1738
|
-
A((n) => {
|
|
1739
|
-
n.touch(this);
|
|
1740
|
-
let r = this.raw.rows;
|
|
1741
|
-
if (t == null) this.releaseRows(), this.state.rows = null;
|
|
1742
|
-
else {
|
|
1743
|
-
let e = this.state.rows ?? [], n = Array(t.length);
|
|
1744
|
-
for (let r = 0; r < t.length; r++) {
|
|
1745
|
-
let i = t[r], a = e[r];
|
|
1746
|
-
a && this._itemTemplate && !(i instanceof G) ? (this.resetChild(a, this._itemTemplate, i), n[r] = a) : (a && this.releaseChild(a), n[r] = this.processSetValueItem(i));
|
|
1747
|
-
}
|
|
1748
|
-
for (let n = t.length; n < e.length; n++) this.releaseChild(e[n]);
|
|
1749
|
-
this.state.rows = n;
|
|
1750
|
-
}
|
|
1751
|
-
e.rowsDiffer(r, this.raw.rows) && this.rowsChanged(), this.bumpValueVersion();
|
|
1752
|
-
});
|
|
1753
|
-
}
|
|
1754
|
-
get value() {
|
|
1755
|
-
let e = this.valueVersion;
|
|
1756
|
-
if (this.raw.cachedValueVersion === e) return this.raw.cachedValue;
|
|
1757
|
-
let t = [];
|
|
1758
|
-
(this.state.rows ?? []).forEach((e) => {
|
|
1759
|
-
switch (this.childSerializesAs(e, "value")) {
|
|
1760
|
-
case "value":
|
|
1761
|
-
t.push(e.value);
|
|
1762
|
-
break;
|
|
1763
|
-
case "null": t.push(null);
|
|
1764
|
-
}
|
|
1765
|
-
});
|
|
1766
|
-
let n = t.length ? Object.freeze(t) : jt;
|
|
1767
|
-
return this.raw.cachedValue = n, this.raw.cachedValueVersion = e, n;
|
|
1768
|
-
}
|
|
1769
|
-
set value(e) {
|
|
1770
|
-
A(() => {
|
|
1771
|
-
this.setValueInternal(e), this.propagateValueChanged(!0);
|
|
1772
|
-
});
|
|
1773
|
-
}
|
|
1774
|
-
resetTo(t, n) {
|
|
1775
|
-
A((r) => {
|
|
1776
|
-
r.touch(this), this.errors.length && (this.errors = []), this.setValueInternal(n === void 0 ? t.fullValue : n), this.recordAnnounced(), this.originalValue = e.baseline(this.value), super.validate(!0);
|
|
1777
|
-
});
|
|
1778
|
-
}
|
|
1779
|
-
bind(e, t) {
|
|
1780
|
-
let n = this._itemTemplate?.bind(), r = this.constructor, i = new r(n, {
|
|
1781
|
-
value: [...(e === void 0 ? this.fullValue : e) ?? []],
|
|
1782
|
-
...t && "originalValue" in t ? { originalValue: t.originalValue } : {},
|
|
1783
|
-
access: t?.access ?? this.access,
|
|
1784
|
-
visibility: t?.visibility ?? this.visibility
|
|
1785
|
-
});
|
|
1786
|
-
if (i._itemTemplate !== n) throw TypeError(`${this.constructor.name}.bind() built a list that did not take the item template it was given, so the binding would carry the declaration's rows. A subclass whose constructor does not take (itemTemplate, params) has to override bind() and construct itself.`);
|
|
1787
|
-
return i.boundFrom(this, i.contribution, i.originalValue, t), i;
|
|
1788
|
-
}
|
|
1789
|
-
get members() {
|
|
1790
|
-
return this.raw.rows ?? [];
|
|
1791
|
-
}
|
|
1792
|
-
get children() {
|
|
1793
|
-
return this.state.rows ?? [];
|
|
1794
|
-
}
|
|
1795
|
-
get fullValue() {
|
|
1796
|
-
return (this.state.rows ?? []).map((e) => e.fullValue);
|
|
1797
|
-
}
|
|
1798
|
-
get length() {
|
|
1799
|
-
return this.state.rows?.length ?? 0;
|
|
1800
|
-
}
|
|
1801
|
-
get items() {
|
|
1802
|
-
let e = this.state.rowsVersion;
|
|
1803
|
-
return this.raw.cachedItemsVersion !== e && (this.raw.cachedItems = Object.freeze([...this.raw.rows ?? []]), this.raw.cachedItemsVersion = e), this.raw.cachedItems;
|
|
1804
|
-
}
|
|
1805
|
-
get(e) {
|
|
1806
|
-
return this.state.rows == null ? void 0 : this.state.rows[e];
|
|
1807
|
-
}
|
|
1808
|
-
push(e) {
|
|
1809
|
-
return this.insert(e, this.state.rows?.length ?? 0) + 1;
|
|
1810
|
-
}
|
|
1811
|
-
pop() {
|
|
1812
|
-
return this.remove((this.state.rows?.length ?? 0) - 1);
|
|
1813
|
-
}
|
|
1814
|
-
remove(e) {
|
|
1815
|
-
let t;
|
|
1816
|
-
return A((n) => {
|
|
1817
|
-
if (this.state.rows == null || e < 0 || this.state.rows.length <= e) return;
|
|
1818
|
-
n.touch(this);
|
|
1819
|
-
let r = this.state.rows.splice(e, 1)?.[0];
|
|
1820
|
-
r && (this.releaseChild(r), this.rowsChanged(), this.bumpValueVersion(), t = r, n.recordStructural(this, {
|
|
1821
|
-
actionClass: ft,
|
|
1822
|
-
item: t,
|
|
1823
|
-
index: e
|
|
1824
|
-
}), this.propagateValueChanged(!0));
|
|
1825
|
-
}), t;
|
|
1826
|
-
}
|
|
1827
|
-
insert(e, t) {
|
|
1828
|
-
let n = 0;
|
|
1829
|
-
return A((r) => {
|
|
1830
|
-
for (r.touch(this), this.state.rows ?? (this.state.rows = []), n = t < 0 ? Math.max(this.state.rows.length + t, 0) : t; this.state.rows.length < n;) {
|
|
1831
|
-
let t = this.createPaddingItem(e), n = this.state.rows.push(t) - 1;
|
|
1832
|
-
this.bumpValueVersion(), r.recordStructural(this, {
|
|
1833
|
-
actionClass: K,
|
|
1834
|
-
item: t,
|
|
1835
|
-
index: n
|
|
1836
|
-
});
|
|
1837
|
-
}
|
|
1838
|
-
let i = this.processSetValueItem(e);
|
|
1839
|
-
this.state.rows.splice(n, 0, i), r.recordStructural(this, {
|
|
1840
|
-
actionClass: K,
|
|
1841
|
-
item: i,
|
|
1842
|
-
index: n
|
|
1843
|
-
}), this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(!0);
|
|
1844
|
-
}), n;
|
|
1845
|
-
}
|
|
1846
|
-
releaseRows() {
|
|
1847
|
-
this.state.rows?.forEach((e) => this.releaseChild(e));
|
|
1848
|
-
}
|
|
1849
|
-
clear() {
|
|
1850
|
-
A((e) => {
|
|
1851
|
-
let t = (this.state.rows?.length ?? 0) > 0;
|
|
1852
|
-
e.touch(this), this.releaseRows(), this.state.rows = null, t && this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(t);
|
|
1853
|
-
});
|
|
1854
|
-
}
|
|
1855
|
-
}, Nt = class extends R {
|
|
2313
|
+
//#region src/validators/validator-compare-to.ts
|
|
2314
|
+
var Bn = class extends P {
|
|
1856
2315
|
isValidComparison;
|
|
1857
2316
|
otherField;
|
|
1858
2317
|
registrations = /* @__PURE__ */ new WeakSet();
|
|
1859
|
-
listening =
|
|
1860
|
-
declarations =
|
|
2318
|
+
listening = new Pt();
|
|
2319
|
+
declarations = new Pt();
|
|
2320
|
+
relay;
|
|
1861
2321
|
constructor(e, t, n) {
|
|
1862
2322
|
super((e, t, r) => {
|
|
1863
2323
|
this.comparisonState(r).oldValue = t;
|
|
1864
2324
|
let i = this.resolve(r);
|
|
1865
|
-
|
|
2325
|
+
if (!i) return r.markRecordIncomplete(), null;
|
|
2326
|
+
this.listenOn(i);
|
|
2327
|
+
let a = m(i.value);
|
|
2328
|
+
return this.isValidComparison(m(e), a) ? null : [this.errorFor(n, "compare_to", "Value does not match the comparison with {otherValue}", {
|
|
1866
2329
|
newValue: e,
|
|
1867
2330
|
oldValue: t,
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
2331
|
+
otherValue: a
|
|
2332
|
+
})];
|
|
2333
|
+
}), this.isValidComparison = t, this.otherField = e, this.relay = new N((e, t, n, r) => {
|
|
2334
|
+
t(e, n, r);
|
|
2335
|
+
let i = F(e);
|
|
2336
|
+
this.declarations.alive.forEach((e) => Mt(e, i).forEach((e) => {
|
|
2337
|
+
this.registrations.has(e) && this.execute(e, () => null, e.contribution, this.comparisonState(e).oldValue);
|
|
2338
|
+
}));
|
|
2339
|
+
}), this.relay[et] = () => {
|
|
2340
|
+
this.declarations.alive.length === 0 && this.stopListening();
|
|
2341
|
+
};
|
|
1872
2342
|
}
|
|
1873
2343
|
resolve(e) {
|
|
1874
2344
|
let t = this.otherField;
|
|
1875
|
-
return typeof t == "function" ? t(e) ?? void 0 : typeof t == "string" ?
|
|
2345
|
+
return typeof t == "function" ? t(e) ?? void 0 : typeof t == "string" ? Nt(t, e) : jt(t, F(e));
|
|
1876
2346
|
}
|
|
1877
2347
|
listenOn(e) {
|
|
1878
|
-
this.listening.has(e
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
}))
|
|
2348
|
+
this.listening.has(e.declaration) || (this.listening.add(e.declaration), e.registerAction(this.relay));
|
|
2349
|
+
}
|
|
2350
|
+
stopListening() {
|
|
2351
|
+
let e = this.listening.alive;
|
|
2352
|
+
e.length !== 0 && (S()?.whenRolledBack(() => e.forEach((e) => this.listening.add(e))), e.forEach((e) => {
|
|
2353
|
+
this.listening.delete(e), e.unregisterAction(this.relay);
|
|
2354
|
+
}));
|
|
1885
2355
|
}
|
|
1886
2356
|
boundToBinding(e) {
|
|
1887
2357
|
this.declarations.add(e.declaration), this.registrations.add(e);
|
|
@@ -1896,147 +2366,161 @@ var jt = Object.freeze([]), Mt = class e extends J {
|
|
|
1896
2366
|
};
|
|
1897
2367
|
}
|
|
1898
2368
|
unregisterFrom(e) {
|
|
1899
|
-
super.unregisterFrom(e), this.registrations.delete(e);
|
|
2369
|
+
super.unregisterFrom(e), this.registrations.delete(e), e === e.declaration && this.declarations.delete(e), this.declarations.alive.length === 0 && this.stopListening();
|
|
1900
2370
|
}
|
|
1901
|
-
}
|
|
2371
|
+
};
|
|
2372
|
+
//#endregion
|
|
2373
|
+
//#region src/validators/value-checks.ts
|
|
2374
|
+
function X(e) {
|
|
2375
|
+
if (e == null) return 0;
|
|
2376
|
+
if (te(e) || g(e)) return e.length;
|
|
2377
|
+
if (e instanceof Map || e instanceof Set) return e.size;
|
|
2378
|
+
if (ie(e)) {
|
|
2379
|
+
let t = Object.getPrototypeOf(e);
|
|
2380
|
+
if (t === Object.prototype || t === null) return Object.keys(e).length;
|
|
2381
|
+
}
|
|
2382
|
+
return String(e).length;
|
|
2383
|
+
}
|
|
2384
|
+
function Z(e) {
|
|
2385
|
+
return X(e) === 0 && (e == null || g(e) || te(e) || ie(e));
|
|
2386
|
+
}
|
|
2387
|
+
function Vn(e, t) {
|
|
2388
|
+
if (e instanceof Date && t instanceof Date) {
|
|
2389
|
+
let n = e.getTime() - t.getTime();
|
|
2390
|
+
return Number.isNaN(n) ? void 0 : n;
|
|
2391
|
+
}
|
|
2392
|
+
if (typeof e == "number" && typeof t == "number") return Number.isNaN(e) || Number.isNaN(t) ? void 0 : e - t;
|
|
2393
|
+
if (typeof e == "string" && typeof t == "string" || typeof e == "bigint" && typeof t == "bigint") return e < t ? -1 : +(e > t);
|
|
2394
|
+
}
|
|
2395
|
+
//#endregion
|
|
2396
|
+
//#region src/validators/validator-in-allowed-values.ts
|
|
2397
|
+
var Hn = class extends P {
|
|
1902
2398
|
constructor(e, t) {
|
|
1903
|
-
let n =
|
|
1904
|
-
let t =
|
|
2399
|
+
let n = () => {
|
|
2400
|
+
let t = m(e);
|
|
1905
2401
|
return typeof t == "function" ? t() : t;
|
|
1906
|
-
},
|
|
2402
|
+
}, r = (e) => {
|
|
1907
2403
|
let t = e.join(", ");
|
|
1908
|
-
return t.length <= 60 ? t :
|
|
2404
|
+
return t.length <= 60 ? t : oe(t, {
|
|
1909
2405
|
length: 40,
|
|
1910
2406
|
separator: ", ",
|
|
1911
2407
|
omission: `... (${e.length} items total)`
|
|
1912
2408
|
});
|
|
1913
2409
|
};
|
|
1914
|
-
super((e,
|
|
1915
|
-
|
|
1916
|
-
|
|
2410
|
+
super((e, i) => {
|
|
2411
|
+
if (Z(m(e))) return null;
|
|
2412
|
+
let a = n();
|
|
2413
|
+
return a.includes(m(e)) ? null : [this.errorFor(t, "in_allowed_values", "Must be one of [{allowedAsText}]", {
|
|
1917
2414
|
newValue: e,
|
|
1918
|
-
oldValue:
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
}), "", "in-allowed-values")];
|
|
2415
|
+
oldValue: i,
|
|
2416
|
+
allowedValues: a,
|
|
2417
|
+
allowedAsText: r(a)
|
|
2418
|
+
})];
|
|
1923
2419
|
});
|
|
1924
2420
|
}
|
|
1925
|
-
}
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
}
|
|
1934
|
-
var Lt = class extends R {
|
|
1935
|
-
constructor(e, t) {
|
|
1936
|
-
let n = It(e) ? void 0 : e, r = (It(e) ? e : t)?.trim ?? !0, i = n || L("Required");
|
|
1937
|
-
super((e, t, n) => {
|
|
1938
|
-
let a = f(e);
|
|
1939
|
-
return Ft(r && _(a) ? a.trim() : a) === 0 ? [new F(this.replacePlaceholders(i, {
|
|
1940
|
-
newValue: e,
|
|
1941
|
-
oldValue: t,
|
|
1942
|
-
field: n
|
|
1943
|
-
}), "", "required")] : null;
|
|
2421
|
+
}, Un = class extends P {
|
|
2422
|
+
constructor(e) {
|
|
2423
|
+
let t = e?.trim ?? !0;
|
|
2424
|
+
super((n, r) => {
|
|
2425
|
+
let i = m(n);
|
|
2426
|
+
return X(t && g(i) ? i.trim() : i) === 0 ? [this.errorFor(e, "required", "Please enter a value", {
|
|
2427
|
+
newValue: n,
|
|
2428
|
+
oldValue: r
|
|
2429
|
+
})] : null;
|
|
1944
2430
|
});
|
|
1945
2431
|
}
|
|
1946
|
-
},
|
|
2432
|
+
}, Wn = class extends P {
|
|
1947
2433
|
constructor(e, t) {
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
2434
|
+
super((n, r) => {
|
|
2435
|
+
if (Z(n)) return null;
|
|
2436
|
+
let i = Vn(n, e);
|
|
2437
|
+
return i === void 0 || i < 0 ? [this.errorFor(t, "min_value", "Value must be larger or equal to {minValue}", {
|
|
2438
|
+
newValue: n,
|
|
2439
|
+
oldValue: r,
|
|
2440
|
+
minValue: e
|
|
2441
|
+
})] : null;
|
|
2442
|
+
});
|
|
1955
2443
|
}
|
|
1956
|
-
},
|
|
2444
|
+
}, Gn = class extends P {
|
|
1957
2445
|
constructor(e, t) {
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
2446
|
+
super((n, r) => {
|
|
2447
|
+
if (Z(n)) return null;
|
|
2448
|
+
let i = Vn(n, e);
|
|
2449
|
+
return i === void 0 || i > 0 ? [this.errorFor(t, "max_value", "Value must be less than or equal to {maxValue}", {
|
|
2450
|
+
newValue: n,
|
|
2451
|
+
oldValue: r,
|
|
2452
|
+
maxValue: e
|
|
2453
|
+
})] : null;
|
|
2454
|
+
});
|
|
1965
2455
|
}
|
|
1966
|
-
},
|
|
2456
|
+
}, Kn = class extends P {
|
|
1967
2457
|
constructor(e, t, n) {
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
2458
|
+
super((r, i) => {
|
|
2459
|
+
if (Z(r)) return null;
|
|
2460
|
+
let a = Vn(r, e), o = Vn(r, t);
|
|
2461
|
+
return a === void 0 || o === void 0 || a < 0 || o > 0 ? [this.errorFor(n, "value_in_range", "Value must be between {minValue} and {maxValue}", {
|
|
2462
|
+
newValue: r,
|
|
2463
|
+
oldValue: i,
|
|
2464
|
+
minValue: e,
|
|
2465
|
+
maxValue: t
|
|
2466
|
+
})] : null;
|
|
2467
|
+
});
|
|
1976
2468
|
}
|
|
1977
|
-
}
|
|
1978
|
-
//#endregion
|
|
1979
|
-
//#region src/validators/validator-min-max-range-length.ts
|
|
1980
|
-
function Vt(e) {
|
|
1981
|
-
return e == null ? 0 : m(e) || _(e) ? e.length : te(e) && Object.getPrototypeOf(e) === Object.prototype ? Object.keys(e).length : String(e).length;
|
|
1982
|
-
}
|
|
1983
|
-
var Ht = class extends R {
|
|
2469
|
+
}, qn = class extends P {
|
|
1984
2470
|
constructor(e, t) {
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
newValue: t,
|
|
2471
|
+
super((n, r) => Z(n) ? null : X(n) < e ? [this.errorFor(t, "min_length", "Length must be larger or equal to {minLength}", {
|
|
2472
|
+
newValue: n,
|
|
1988
2473
|
oldValue: r,
|
|
1989
|
-
field: i,
|
|
1990
2474
|
minLength: e
|
|
1991
|
-
})
|
|
2475
|
+
})] : null);
|
|
1992
2476
|
}
|
|
1993
|
-
},
|
|
2477
|
+
}, Jn = class extends P {
|
|
1994
2478
|
constructor(e, t) {
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
newValue: t,
|
|
2479
|
+
super((n, r) => Z(n) ? null : X(n) > e ? [this.errorFor(t, "max_length", "Length must be less than or equal to {maxLength}", {
|
|
2480
|
+
newValue: n,
|
|
1998
2481
|
oldValue: r,
|
|
1999
|
-
field: i,
|
|
2000
2482
|
maxLength: e
|
|
2001
|
-
})
|
|
2483
|
+
})] : null);
|
|
2002
2484
|
}
|
|
2003
|
-
},
|
|
2485
|
+
}, Yn = class extends P {
|
|
2004
2486
|
constructor(e, t, n) {
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
let
|
|
2008
|
-
return
|
|
2009
|
-
newValue:
|
|
2487
|
+
super((r, i) => {
|
|
2488
|
+
if (Z(r)) return null;
|
|
2489
|
+
let a = X(r);
|
|
2490
|
+
return a < e || a > t ? [this.errorFor(n, "length_in_range", "Length must be between {minLength} and {maxLength}", {
|
|
2491
|
+
newValue: r,
|
|
2010
2492
|
oldValue: i,
|
|
2011
|
-
field: a,
|
|
2012
2493
|
minLength: e,
|
|
2013
2494
|
maxLength: t
|
|
2014
|
-
})
|
|
2495
|
+
})] : null;
|
|
2015
2496
|
});
|
|
2016
2497
|
}
|
|
2017
|
-
},
|
|
2498
|
+
}, Xn = class extends P {
|
|
2018
2499
|
constructor(e, t) {
|
|
2019
|
-
let n =
|
|
2020
|
-
super((
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
}
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2500
|
+
let n = /[gy]/.test(e.flags) ? new RegExp(e.source, e.flags.replace(/[gy]/g, "")) : e;
|
|
2501
|
+
super((r, i) => {
|
|
2502
|
+
let a = m(r);
|
|
2503
|
+
return Z(a) || n.test(String(a)) ? null : [this.errorFor(t, "pattern", "Value must match pattern \"{pattern}\"", {
|
|
2504
|
+
newValue: r,
|
|
2505
|
+
oldValue: i,
|
|
2506
|
+
pattern: e
|
|
2507
|
+
})];
|
|
2508
|
+
});
|
|
2509
|
+
}
|
|
2510
|
+
}, Zn = /* @__PURE__ */ ce({
|
|
2511
|
+
CompareTo: () => Bn,
|
|
2512
|
+
InAllowedValues: () => Hn,
|
|
2513
|
+
LengthInRange: () => Yn,
|
|
2514
|
+
MaxLength: () => Jn,
|
|
2515
|
+
MaxValue: () => Gn,
|
|
2516
|
+
MinLength: () => qn,
|
|
2517
|
+
MinValue: () => Wn,
|
|
2518
|
+
Pattern: () => Xn,
|
|
2519
|
+
Required: () => Un,
|
|
2520
|
+
Validator: () => P,
|
|
2521
|
+
ValueInRange: () => Kn,
|
|
2522
|
+
isEmptyValue: () => Z
|
|
2523
|
+
}), Qn = /* @__PURE__ */ new WeakMap(), $n = /* @__PURE__ */ new WeakMap(), er = /* @__PURE__ */ new Set([
|
|
2040
2524
|
"push",
|
|
2041
2525
|
"pop",
|
|
2042
2526
|
"shift",
|
|
@@ -2047,19 +2531,23 @@ var Ht = class extends R {
|
|
|
2047
2531
|
"fill",
|
|
2048
2532
|
"copyWithin"
|
|
2049
2533
|
]);
|
|
2050
|
-
function
|
|
2534
|
+
function tr(e) {
|
|
2051
2535
|
return typeof e == "string" && /^(0|[1-9]\d*)$/.test(e);
|
|
2052
2536
|
}
|
|
2053
|
-
function
|
|
2054
|
-
|
|
2537
|
+
function nr(e) {
|
|
2538
|
+
let t = Math.trunc(Number(e));
|
|
2539
|
+
return Number.isNaN(t) ? 0 : t;
|
|
2055
2540
|
}
|
|
2056
2541
|
function Q(e) {
|
|
2057
|
-
return e
|
|
2542
|
+
return typeof e == "object" && !!e && $n.get(e) || e;
|
|
2058
2543
|
}
|
|
2059
|
-
function
|
|
2060
|
-
e
|
|
2544
|
+
function $(e) {
|
|
2545
|
+
return e instanceof J ? cr(e) : e.value;
|
|
2546
|
+
}
|
|
2547
|
+
function rr(e, t) {
|
|
2548
|
+
e.value = Q(t) instanceof U ? Q(t).value : t;
|
|
2061
2549
|
}
|
|
2062
|
-
function
|
|
2550
|
+
function ir(e) {
|
|
2063
2551
|
return e === "__v_skip" ? {
|
|
2064
2552
|
answered: !0,
|
|
2065
2553
|
value: !0
|
|
@@ -2068,22 +2556,22 @@ function Zt(e) {
|
|
|
2068
2556
|
value: void 0
|
|
2069
2557
|
} : { answered: !1 };
|
|
2070
2558
|
}
|
|
2071
|
-
function
|
|
2559
|
+
function ar(e) {
|
|
2072
2560
|
let t = (t) => typeof t == "string" && t !== "$" ? e.field(t) ?? void 0 : void 0, n = () => Object.keys(e.fields);
|
|
2073
2561
|
return {
|
|
2074
2562
|
get(n, r) {
|
|
2075
|
-
let i =
|
|
2563
|
+
let i = ir(r);
|
|
2076
2564
|
if (i.answered) return i.value;
|
|
2077
2565
|
if (r === "$") return e;
|
|
2078
2566
|
if (r === Symbol.toStringTag) return "View";
|
|
2079
2567
|
let a = t(r);
|
|
2080
|
-
return a ?
|
|
2568
|
+
return a ? $(a) : void 0;
|
|
2081
2569
|
},
|
|
2082
2570
|
set(e, n, r) {
|
|
2083
2571
|
if (n === "$") throw TypeError("$ is the element a view stands for, and cannot be replaced");
|
|
2084
2572
|
let i = t(n);
|
|
2085
|
-
if (!i) throw TypeError(`${String(n)} is not a member of this group - use
|
|
2086
|
-
return
|
|
2573
|
+
if (!i) throw TypeError(`${String(n)} is not a member of this group - use $.addField() to add one`);
|
|
2574
|
+
return rr(i, r), !0;
|
|
2087
2575
|
},
|
|
2088
2576
|
has(e, t) {
|
|
2089
2577
|
return t === "$" || typeof t == "string" && n().includes(t);
|
|
@@ -2093,64 +2581,56 @@ function Qt(e) {
|
|
|
2093
2581
|
},
|
|
2094
2582
|
getOwnPropertyDescriptor(t, r) {
|
|
2095
2583
|
if (!(typeof r != "string" || !n().includes(r))) return {
|
|
2096
|
-
value:
|
|
2584
|
+
value: $(e.fields[r]),
|
|
2097
2585
|
writable: !0,
|
|
2098
2586
|
enumerable: !0,
|
|
2099
2587
|
configurable: !0
|
|
2100
2588
|
};
|
|
2101
2589
|
},
|
|
2102
2590
|
deleteProperty(e, t) {
|
|
2103
|
-
throw TypeError(`${String(t)} cannot be deleted from a view - use
|
|
2591
|
+
throw TypeError(`${String(t)} cannot be deleted from a view - use $.removeField() to take a member out`);
|
|
2104
2592
|
},
|
|
2105
2593
|
defineProperty(e, t) {
|
|
2106
2594
|
throw TypeError(`${String(t)} cannot be defined on a view`);
|
|
2107
2595
|
}
|
|
2108
2596
|
};
|
|
2109
2597
|
}
|
|
2110
|
-
function
|
|
2111
|
-
let t = () =>
|
|
2112
|
-
|
|
2113
|
-
return n < r.length ? e.items.indexOf(r[n]) : e.length;
|
|
2114
|
-
}, r = (e, t) => e < 0 ? Math.max(t + e, 0) : Math.min(e, t), i = (n) => k(() => {
|
|
2115
|
-
let r = t(), i = e.items.map((e) => {
|
|
2116
|
-
let t = r.indexOf(e);
|
|
2117
|
-
return t === -1 ? e : n[t];
|
|
2118
|
-
});
|
|
2119
|
-
for (; e.length;) e.pop();
|
|
2120
|
-
i.forEach((t) => e.push(t));
|
|
2598
|
+
function or(e) {
|
|
2599
|
+
let t = () => e.items, n = (t) => Math.min(t, e.length), r = (e, t) => e < 0 ? Math.max(t + e, 0) : Math.min(e, t), i = (t) => C(() => {
|
|
2600
|
+
e[lt](t);
|
|
2121
2601
|
}), a = {
|
|
2122
|
-
push: (...n) => (
|
|
2602
|
+
push: (...n) => (C(() => n.forEach((t) => e.push(Q(t)))), t().length),
|
|
2123
2603
|
pop: () => {
|
|
2124
2604
|
let n = t();
|
|
2125
2605
|
if (!n.length) return;
|
|
2126
|
-
let r =
|
|
2606
|
+
let r = $(n[n.length - 1]);
|
|
2127
2607
|
return e.remove(e.items.indexOf(n[n.length - 1])), r;
|
|
2128
2608
|
},
|
|
2129
2609
|
shift: () => {
|
|
2130
2610
|
let n = t();
|
|
2131
2611
|
if (!n.length) return;
|
|
2132
|
-
let r =
|
|
2612
|
+
let r = $(n[0]);
|
|
2133
2613
|
return e.remove(e.items.indexOf(n[0])), r;
|
|
2134
2614
|
},
|
|
2135
|
-
unshift: (...r) => (
|
|
2615
|
+
unshift: (...r) => (C(() => {
|
|
2136
2616
|
let t = n(0);
|
|
2137
|
-
r.forEach((n, r) => e.insert(
|
|
2617
|
+
r.forEach((n, r) => e.insert(Q(n), t + r));
|
|
2138
2618
|
}), t().length),
|
|
2139
|
-
splice: (i
|
|
2140
|
-
let s = [];
|
|
2141
|
-
return
|
|
2142
|
-
let
|
|
2143
|
-
|
|
2144
|
-
|
|
2619
|
+
splice: (...i) => {
|
|
2620
|
+
let [a, o, ...s] = i, c = [];
|
|
2621
|
+
return C(() => {
|
|
2622
|
+
let l = t(), u = r(nr(a), l.length), d = 0;
|
|
2623
|
+
i.length === 1 ? d = l.length - u : i.length > 1 && (d = Math.max(0, Math.min(nr(o), l.length - u))), l.slice(u, u + d).forEach((t) => {
|
|
2624
|
+
c.push($(t)), e.remove(e.items.indexOf(t));
|
|
2145
2625
|
});
|
|
2146
|
-
let
|
|
2147
|
-
|
|
2148
|
-
}),
|
|
2626
|
+
let f = n(u);
|
|
2627
|
+
s.forEach((t, n) => e.insert(Q(t), f + n));
|
|
2628
|
+
}), c;
|
|
2149
2629
|
},
|
|
2150
2630
|
sort: (e) => {
|
|
2151
2631
|
let n = t().map((e) => ({
|
|
2152
2632
|
row: e,
|
|
2153
|
-
slot:
|
|
2633
|
+
slot: $(e)
|
|
2154
2634
|
})).sort((t, n) => {
|
|
2155
2635
|
if (e) return e(t.slot, n.slot);
|
|
2156
2636
|
let r = String(t.slot), i = String(n.slot);
|
|
@@ -2160,39 +2640,41 @@ function $t(e) {
|
|
|
2160
2640
|
},
|
|
2161
2641
|
reverse: () => (i([...t()].reverse()), o),
|
|
2162
2642
|
fill: () => {
|
|
2163
|
-
throw TypeError("fill() is not available on a list view - assign
|
|
2643
|
+
throw TypeError("fill() is not available on a list view - assign $.value instead");
|
|
2164
2644
|
},
|
|
2165
2645
|
copyWithin: () => {
|
|
2166
|
-
throw TypeError("copyWithin() is not available on a list view - assign
|
|
2646
|
+
throw TypeError("copyWithin() is not available on a list view - assign $.value instead");
|
|
2167
2647
|
}
|
|
2168
2648
|
}, o;
|
|
2169
2649
|
return o = new Proxy([], {
|
|
2170
2650
|
get(n, r, i) {
|
|
2171
|
-
let o =
|
|
2651
|
+
let o = ir(r);
|
|
2172
2652
|
if (o.answered) return o.value;
|
|
2173
2653
|
if (r === "$") return e;
|
|
2174
2654
|
if (r === "length") return t().length;
|
|
2175
|
-
if (
|
|
2655
|
+
if (tr(r)) {
|
|
2176
2656
|
let e = t()[Number(r)];
|
|
2177
|
-
return e ?
|
|
2657
|
+
return e ? $(e) : void 0;
|
|
2178
2658
|
}
|
|
2179
|
-
return typeof r == "string" &&
|
|
2659
|
+
return typeof r == "string" && er.has(r) ? a[r] : Reflect.get(n, r, i);
|
|
2180
2660
|
},
|
|
2181
2661
|
set(r, i, a) {
|
|
2182
2662
|
if (i === "$") throw TypeError("$ is the element a view stands for, and cannot be replaced");
|
|
2183
2663
|
if (i === "length") {
|
|
2184
|
-
let n = Number(a)
|
|
2664
|
+
let n = Number(a);
|
|
2665
|
+
if (!Number.isInteger(n) || n < 0 || n > 2 ** 32 - 1) throw RangeError("Invalid array length");
|
|
2666
|
+
let r = t();
|
|
2185
2667
|
if (n > r.length) throw TypeError("a list view grows by push(), not by its length");
|
|
2186
|
-
return
|
|
2668
|
+
return C(() => r.slice(n).forEach((t) => e.remove(e.items.indexOf(t)))), !0;
|
|
2187
2669
|
}
|
|
2188
|
-
if (
|
|
2670
|
+
if (tr(i)) {
|
|
2189
2671
|
let r = Number(i), o = t();
|
|
2190
|
-
return r < o.length ?
|
|
2672
|
+
return r < o.length ? rr(o[r], a) : e.insert(Q(a), n(o.length) + (r - o.length)), !0;
|
|
2191
2673
|
}
|
|
2192
2674
|
throw TypeError(`${String(i)} cannot be set on a list view`);
|
|
2193
2675
|
},
|
|
2194
2676
|
has(e, n) {
|
|
2195
|
-
return n === "$" || n === "length" ? !0 :
|
|
2677
|
+
return n === "$" || n === "length" ? !0 : tr(n) ? Number(n) < t().length : Reflect.has(e, n);
|
|
2196
2678
|
},
|
|
2197
2679
|
ownKeys() {
|
|
2198
2680
|
return [...t().map((e, t) => String(t)), "length"];
|
|
@@ -2204,8 +2686,8 @@ function $t(e) {
|
|
|
2204
2686
|
enumerable: !1,
|
|
2205
2687
|
configurable: !1
|
|
2206
2688
|
};
|
|
2207
|
-
if (!(!
|
|
2208
|
-
value:
|
|
2689
|
+
if (!(!tr(n) || Number(n) >= t().length)) return {
|
|
2690
|
+
value: $(t()[Number(n)]),
|
|
2209
2691
|
writable: !0,
|
|
2210
2692
|
enumerable: !0,
|
|
2211
2693
|
configurable: !0
|
|
@@ -2219,10 +2701,10 @@ function $t(e) {
|
|
|
2219
2701
|
}
|
|
2220
2702
|
}), o;
|
|
2221
2703
|
}
|
|
2222
|
-
function
|
|
2704
|
+
function sr(e) {
|
|
2223
2705
|
return {
|
|
2224
2706
|
get(t, n) {
|
|
2225
|
-
let r =
|
|
2707
|
+
let r = ir(n);
|
|
2226
2708
|
if (r.answered) return r.value;
|
|
2227
2709
|
if (n === "$") return e;
|
|
2228
2710
|
},
|
|
@@ -2237,72 +2719,69 @@ function en(e) {
|
|
|
2237
2719
|
}
|
|
2238
2720
|
};
|
|
2239
2721
|
}
|
|
2240
|
-
function
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
});
|
|
2244
|
-
}
|
|
2245
|
-
function $(e) {
|
|
2246
|
-
if (Jt.has(e)) return e;
|
|
2247
|
-
let t = qt.get(e);
|
|
2722
|
+
function cr(e) {
|
|
2723
|
+
if ($n.has(e)) return e;
|
|
2724
|
+
let t = Qn.get(e);
|
|
2248
2725
|
if (t) return t;
|
|
2249
2726
|
let n;
|
|
2250
|
-
return e instanceof Y ? (
|
|
2727
|
+
return e instanceof Y ? (Object.keys(e.fields).forEach(Mn), jn.add(e), n = new Proxy({}, ar(e))) : n = e instanceof An ? or(e) : new Proxy({}, sr(e)), Qn.set(e, n), $n.set(n, e), n;
|
|
2251
2728
|
}
|
|
2252
2729
|
//#endregion
|
|
2253
2730
|
//#region src/index.ts
|
|
2254
|
-
var
|
|
2255
|
-
AbortEventHandlingException: () =>
|
|
2256
|
-
AccessChangedAction: () =>
|
|
2257
|
-
AccessChangingAction: () =>
|
|
2258
|
-
Action: () =>
|
|
2259
|
-
ActionsMap: () =>
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2731
|
+
var lr = /* @__PURE__ */ ce({
|
|
2732
|
+
AbortEventHandlingException: () => E,
|
|
2733
|
+
AccessChangedAction: () => Ht,
|
|
2734
|
+
AccessChangingAction: () => Bt,
|
|
2735
|
+
Action: () => Tn,
|
|
2736
|
+
ActionsMap: () => Ot,
|
|
2737
|
+
CommandException: () => gn,
|
|
2738
|
+
ConditionalAccessAction: () => Lt,
|
|
2739
|
+
ConditionalStatementAction: () => I,
|
|
2740
|
+
ConditionalValueAction: () => Rt,
|
|
2741
|
+
ConditionalVisibilityAction: () => It,
|
|
2264
2742
|
Container: () => J,
|
|
2265
|
-
ContributionChangedAction: () =>
|
|
2266
|
-
EnabledChangedAction: () =>
|
|
2267
|
-
EnabledChangingAction: () =>
|
|
2268
|
-
|
|
2743
|
+
ContributionChangedAction: () => Wt,
|
|
2744
|
+
EnabledChangedAction: () => Jt,
|
|
2745
|
+
EnabledChangingAction: () => Kt,
|
|
2746
|
+
ErrorPolicy: () => M,
|
|
2747
|
+
ExecuteAction: () => W,
|
|
2269
2748
|
Field: () => q,
|
|
2270
|
-
FieldActionBase: () =>
|
|
2271
|
-
FieldBase: () =>
|
|
2749
|
+
FieldActionBase: () => T,
|
|
2750
|
+
FieldBase: () => U,
|
|
2272
2751
|
Group: () => Y,
|
|
2273
|
-
List: () =>
|
|
2274
|
-
ListItemAddedAction: () =>
|
|
2275
|
-
ListItemRemovedAction: () =>
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
Validators: () =>
|
|
2286
|
-
ValueChangedAction: () =>
|
|
2287
|
-
VisibilityChangedAction: () =>
|
|
2288
|
-
VisibilityChangingAction: () =>
|
|
2289
|
-
accessValues: () =>
|
|
2290
|
-
|
|
2291
|
-
defaultAccess: () =>
|
|
2292
|
-
defaultVisibility: () =>
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
view: () =>
|
|
2303
|
-
visibilityValues: () =>
|
|
2752
|
+
List: () => An,
|
|
2753
|
+
ListItemAddedAction: () => G,
|
|
2754
|
+
ListItemRemovedAction: () => K,
|
|
2755
|
+
Operator: () => R,
|
|
2756
|
+
RejectAction: () => bn,
|
|
2757
|
+
Statement: () => fn,
|
|
2758
|
+
SubmitAction: () => yn,
|
|
2759
|
+
SubmitFailedException: () => _n,
|
|
2760
|
+
SubmitRefusedException: () => vn,
|
|
2761
|
+
TargetedExecuteAction: () => mn,
|
|
2762
|
+
ValidChangedAction: () => Xt,
|
|
2763
|
+
ValidationError: () => Tt,
|
|
2764
|
+
Validators: () => Zn,
|
|
2765
|
+
ValueChangedAction: () => N,
|
|
2766
|
+
VisibilityChangedAction: () => en,
|
|
2767
|
+
VisibilityChangingAction: () => Qt,
|
|
2768
|
+
accessValues: () => _,
|
|
2769
|
+
configureDevtools: () => Ce,
|
|
2770
|
+
defaultAccess: () => le,
|
|
2771
|
+
defaultVisibility: () => fe,
|
|
2772
|
+
describeState: () => xe,
|
|
2773
|
+
errorRemovals: () => O,
|
|
2774
|
+
hideState: () => Se,
|
|
2775
|
+
installPlugin: () => Pe,
|
|
2776
|
+
isAccess: () => ue,
|
|
2777
|
+
isEqual: () => zn,
|
|
2778
|
+
isVisibility: () => pe,
|
|
2779
|
+
setDefaultErrorPolicies: () => bt,
|
|
2780
|
+
transaction: () => C,
|
|
2781
|
+
view: () => cr,
|
|
2782
|
+
visibilityValues: () => de
|
|
2304
2783
|
});
|
|
2305
2784
|
//#endregion
|
|
2306
|
-
export {
|
|
2785
|
+
export { E as AbortEventHandlingException, Ht as AccessChangedAction, Bt as AccessChangingAction, Tn as Action, Ot as ActionsMap, gn as CommandException, Lt as ConditionalAccessAction, I as ConditionalStatementAction, Rt as ConditionalValueAction, It as ConditionalVisibilityAction, J as Container, Wt as ContributionChangedAction, Jt as EnabledChangedAction, Kt as EnabledChangingAction, M as ErrorPolicy, W as ExecuteAction, q as Field, T as FieldActionBase, U as FieldBase, Y as Group, An as List, G as ListItemAddedAction, K as ListItemRemovedAction, R as Operator, bn as RejectAction, fn as Statement, yn as SubmitAction, _n as SubmitFailedException, vn as SubmitRefusedException, mn as TargetedExecuteAction, Xt as ValidChangedAction, Tt as ValidationError, Zn as Validators, N as ValueChangedAction, en as VisibilityChangedAction, Qt as VisibilityChangingAction, _ as accessValues, Ce as configureDevtools, lr as default, le as defaultAccess, fe as defaultVisibility, xe as describeState, O as errorRemovals, Se as hideState, Pe as installPlugin, ue as isAccess, zn as isEqual, pe as isVisibility, bt as setDefaultErrorPolicies, C as transaction, cr as view, de as visibilityValues };
|
|
2307
2786
|
|
|
2308
2787
|
//# sourceMappingURL=dynamicforms-vue-forms.js.map
|