@dynamicforms/vue-forms 0.1.5 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dynamicforms-vue-forms.js +768 -291
- package/dist/dynamicforms-vue-forms.js.map +1 -1
- package/dist/dynamicforms-vue-forms.umd.cjs +2 -1
- package/dist/dynamicforms-vue-forms.umd.cjs.map +1 -1
- package/dist/index.d.ts +270 -25
- package/package.json +1 -1
- package/readme.md +151 -15
|
@@ -1,292 +1,343 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
1
|
+
var ft = Object.defineProperty, gt = Object.defineProperties;
|
|
2
|
+
var dt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var R = Object.getOwnPropertySymbols, bt = Object.getPrototypeOf, tt = Object.prototype.hasOwnProperty, et = Object.prototype.propertyIsEnumerable, pt = Reflect.get;
|
|
4
|
+
var H = (n, i, t) => i in n ? ft(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t, V = (n, i) => {
|
|
5
5
|
for (var t in i || (i = {}))
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
for (var t of
|
|
9
|
-
|
|
6
|
+
tt.call(i, t) && H(n, t, i[t]);
|
|
7
|
+
if (R)
|
|
8
|
+
for (var t of R(i))
|
|
9
|
+
et.call(i, t) && H(n, t, i[t]);
|
|
10
10
|
return n;
|
|
11
|
-
},
|
|
12
|
-
var
|
|
11
|
+
}, A = (n, i) => gt(n, dt(i));
|
|
12
|
+
var N = (n, i) => {
|
|
13
13
|
var t = {};
|
|
14
14
|
for (var e in n)
|
|
15
|
-
|
|
16
|
-
if (n != null &&
|
|
17
|
-
for (var e of
|
|
18
|
-
i.indexOf(e) < 0 &&
|
|
15
|
+
tt.call(n, e) && i.indexOf(e) < 0 && (t[e] = n[e]);
|
|
16
|
+
if (n != null && R)
|
|
17
|
+
for (var e of R(n))
|
|
18
|
+
i.indexOf(e) < 0 && et.call(n, e) && (t[e] = n[e]);
|
|
19
19
|
return t;
|
|
20
20
|
};
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
21
|
+
var h = (n, i, t) => H(n, typeof i != "symbol" ? i + "" : i, t);
|
|
22
|
+
var b = (n, i, t) => pt(bt(n), t, i);
|
|
23
|
+
var u = (n, i, t) => new Promise((e, s) => {
|
|
24
|
+
var r = (c) => {
|
|
25
25
|
try {
|
|
26
|
-
|
|
27
|
-
} catch (
|
|
28
|
-
s(
|
|
26
|
+
l(t.next(c));
|
|
27
|
+
} catch (o) {
|
|
28
|
+
s(o);
|
|
29
29
|
}
|
|
30
|
-
}, a = (
|
|
30
|
+
}, a = (c) => {
|
|
31
31
|
try {
|
|
32
|
-
|
|
33
|
-
} catch (
|
|
34
|
-
s(
|
|
32
|
+
l(t.throw(c));
|
|
33
|
+
} catch (o) {
|
|
34
|
+
s(o);
|
|
35
35
|
}
|
|
36
|
-
},
|
|
37
|
-
|
|
36
|
+
}, l = (c) => c.done ? e(c.value) : Promise.resolve(c.value).then(r, a);
|
|
37
|
+
l((t = t.apply(n, i)).next());
|
|
38
38
|
});
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
var
|
|
42
|
-
const
|
|
39
|
+
import { isBoolean as it, isEqual as B, isString as _, isEmpty as X, truncate as yt, isArray as rt, isObject as at } from "lodash-es";
|
|
40
|
+
import { computed as lt, unref as S, reactive as U, ref as mt, isRef as vt } from "vue";
|
|
41
|
+
var L = /* @__PURE__ */ ((n) => (n[n.SUPPRESS = 1] = "SUPPRESS", n[n.HIDDEN = 5] = "HIDDEN", n[n.INVISIBLE = 8] = "INVISIBLE", n[n.FULL = 10] = "FULL", n))(L || {});
|
|
42
|
+
const nt = 10;
|
|
43
43
|
((n) => {
|
|
44
44
|
function i(s) {
|
|
45
|
-
return s.toUpperCase() === "SUPPRESS" ? 1 : s.toUpperCase() === "HIDDEN" ? 5 : s.toUpperCase() === "INVISIBLE" ? 8 :
|
|
45
|
+
return s.toUpperCase() === "SUPPRESS" ? 1 : s.toUpperCase() === "HIDDEN" ? 5 : s.toUpperCase() === "INVISIBLE" ? 8 : nt;
|
|
46
46
|
}
|
|
47
47
|
n.fromString = i;
|
|
48
48
|
function t(s) {
|
|
49
|
-
const
|
|
50
|
-
return Object.values(n).includes(
|
|
49
|
+
const r = typeof s == "number" ? s : n.fromString(s);
|
|
50
|
+
return Object.values(n).includes(r) ? r : nt;
|
|
51
51
|
}
|
|
52
52
|
n.fromAny = t;
|
|
53
53
|
function e(s) {
|
|
54
|
-
const
|
|
55
|
-
return Object.values(n).includes(
|
|
54
|
+
const r = typeof s == "number" ? s : n.fromString(s);
|
|
55
|
+
return Object.values(n).includes(r);
|
|
56
56
|
}
|
|
57
57
|
n.isDefined = e;
|
|
58
|
-
})(
|
|
59
|
-
Object.freeze(
|
|
60
|
-
const
|
|
61
|
-
class
|
|
62
|
-
get componentName() {
|
|
63
|
-
return "Comment";
|
|
64
|
-
}
|
|
65
|
-
// eslint-disable-line class-methods-use-this
|
|
66
|
-
get componentBindings() {
|
|
67
|
-
return {};
|
|
68
|
-
}
|
|
69
|
-
// eslint-disable-line class-methods-use-this
|
|
70
|
-
}
|
|
71
|
-
class G extends q {
|
|
72
|
-
constructor(t) {
|
|
73
|
-
super();
|
|
74
|
-
u(this, "text");
|
|
75
|
-
this.text = t;
|
|
76
|
-
}
|
|
77
|
-
get componentName() {
|
|
78
|
-
return "v-sheet";
|
|
79
|
-
}
|
|
80
|
-
// eslint-disable-line class-methods-use-this
|
|
81
|
-
get componentBindings() {
|
|
82
|
-
return { class: "text-body-1" };
|
|
83
|
-
}
|
|
84
|
-
// eslint-disable-line class-methods-use-this
|
|
85
|
-
}
|
|
86
|
-
class o {
|
|
58
|
+
})(L || (L = {}));
|
|
59
|
+
Object.freeze(L);
|
|
60
|
+
const x = L;
|
|
61
|
+
class d {
|
|
87
62
|
constructor(i) {
|
|
88
|
-
|
|
63
|
+
h(this, "executorFn");
|
|
89
64
|
this.executorFn = i;
|
|
90
65
|
}
|
|
66
|
+
static get classIdentifier() {
|
|
67
|
+
throw new Error("classIdentifier must be declared");
|
|
68
|
+
}
|
|
69
|
+
get classIdentifier() {
|
|
70
|
+
return this.constructor.classIdentifier;
|
|
71
|
+
}
|
|
91
72
|
execute(i, t, ...e) {
|
|
92
|
-
return
|
|
73
|
+
return u(this, null, function* () {
|
|
93
74
|
return this.executorFn(i, t, ...e);
|
|
94
75
|
});
|
|
95
76
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
class $ extends Map {
|
|
100
|
-
register(i) {
|
|
101
|
-
if (!(i instanceof o))
|
|
102
|
-
throw new Error("Invalid action type");
|
|
103
|
-
const t = i.classIdentifier, e = this.get(t) || (() => null);
|
|
104
|
-
function s(l, ...a) {
|
|
105
|
-
return i.execute(l, e, ...a);
|
|
106
|
-
}
|
|
107
|
-
this.set(t, s);
|
|
77
|
+
// eslint-disable-next-line class-methods-use-this
|
|
78
|
+
get eager() {
|
|
79
|
+
return !1;
|
|
108
80
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}).classIdentifier, l = this.get(s);
|
|
112
|
-
try {
|
|
113
|
-
if (l) return l(t, ...e);
|
|
114
|
-
} catch (a) {
|
|
115
|
-
if (!(a instanceof W)) throw a;
|
|
116
|
-
}
|
|
117
|
-
return null;
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
|
|
82
|
+
boundToField(i) {
|
|
118
83
|
}
|
|
119
84
|
}
|
|
120
|
-
|
|
121
|
-
|
|
85
|
+
class G extends Error {
|
|
86
|
+
}
|
|
87
|
+
const ct = Symbol("ValueChangedAction");
|
|
88
|
+
class g extends d {
|
|
122
89
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
123
90
|
constructor(i) {
|
|
124
91
|
super(i);
|
|
125
92
|
}
|
|
126
93
|
// eslint-disable-next-line class-methods-use-this
|
|
127
|
-
get classIdentifier() {
|
|
128
|
-
return
|
|
94
|
+
static get classIdentifier() {
|
|
95
|
+
return ct;
|
|
129
96
|
}
|
|
130
97
|
execute(i, t, e, s) {
|
|
131
|
-
return
|
|
132
|
-
return
|
|
98
|
+
return u(this, null, function* () {
|
|
99
|
+
return b(g.prototype, this, "execute").call(this, i, t, e, s);
|
|
133
100
|
});
|
|
134
101
|
}
|
|
135
102
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
super(i);
|
|
103
|
+
class ut extends Map {
|
|
104
|
+
constructor() {
|
|
105
|
+
super(...arguments);
|
|
106
|
+
h(this, "eagerActions", /* @__PURE__ */ new Set());
|
|
141
107
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
108
|
+
register(t) {
|
|
109
|
+
if (!(t instanceof d))
|
|
110
|
+
throw new Error("Invalid action type");
|
|
111
|
+
const e = t.classIdentifier, s = this.get(e) || (() => null);
|
|
112
|
+
function r(a, ...l) {
|
|
113
|
+
return t.execute(a, s, ...l);
|
|
114
|
+
}
|
|
115
|
+
this.set(e, r), t.eager && this.eagerActions.add(t.classIdentifier);
|
|
116
|
+
}
|
|
117
|
+
trigger(t, e, ...s) {
|
|
118
|
+
return u(this, null, function* () {
|
|
119
|
+
const r = t.classIdentifier;
|
|
120
|
+
r === ct && (yield this.triggerEager(e, ...s));
|
|
121
|
+
const a = this.get(r);
|
|
122
|
+
try {
|
|
123
|
+
if (a) return yield a(e, ...s);
|
|
124
|
+
} catch (l) {
|
|
125
|
+
if (!(l instanceof G)) throw l;
|
|
126
|
+
}
|
|
127
|
+
return null;
|
|
128
|
+
});
|
|
145
129
|
}
|
|
146
|
-
|
|
147
|
-
return
|
|
148
|
-
|
|
130
|
+
triggerEager(t, ...e) {
|
|
131
|
+
return u(this, null, function* () {
|
|
132
|
+
for (const s of this.eagerActions) {
|
|
133
|
+
const r = this.get(s);
|
|
134
|
+
try {
|
|
135
|
+
r && (yield r(t, ...e));
|
|
136
|
+
} catch (a) {
|
|
137
|
+
if (!(a instanceof G)) throw a;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
149
140
|
});
|
|
150
141
|
}
|
|
151
142
|
}
|
|
152
|
-
const
|
|
153
|
-
class
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
143
|
+
const xt = Symbol("ConditionalStatementAction");
|
|
144
|
+
class $ extends g {
|
|
145
|
+
constructor(t, e) {
|
|
146
|
+
const s = (r, a, l, c) => u(this, null, function* () {
|
|
147
|
+
const o = t.evaluate();
|
|
148
|
+
if (o !== this.lastResult) {
|
|
149
|
+
for (const I of this.boundFields)
|
|
150
|
+
yield e(I, o, this.lastResult);
|
|
151
|
+
this.lastResult = o;
|
|
152
|
+
}
|
|
153
|
+
return a(r, l, c);
|
|
154
|
+
});
|
|
155
|
+
super(s);
|
|
156
|
+
h(this, "lastResult");
|
|
157
|
+
// boundField tracks the fields this action is bound to. so that it may perform the executorFn on them and not on the
|
|
158
|
+
// ValueChangedAction fields that will call the actionExecutor
|
|
159
|
+
h(this, "boundFields", /* @__PURE__ */ new Set());
|
|
160
|
+
t.collectFields().forEach((r) => r.registerAction(new g(s)));
|
|
157
161
|
}
|
|
158
162
|
// eslint-disable-next-line class-methods-use-this
|
|
159
|
-
get classIdentifier() {
|
|
160
|
-
return
|
|
163
|
+
static get classIdentifier() {
|
|
164
|
+
return xt;
|
|
161
165
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
+
// eslint-disable-next-line class-methods-use-this
|
|
167
|
+
get eager() {
|
|
168
|
+
return !0;
|
|
169
|
+
}
|
|
170
|
+
boundToField(t) {
|
|
171
|
+
this.boundFields.add(t);
|
|
166
172
|
}
|
|
167
173
|
}
|
|
168
|
-
|
|
169
|
-
class P extends o {
|
|
170
|
-
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
174
|
+
class Et extends $ {
|
|
171
175
|
constructor(i) {
|
|
172
|
-
super(i)
|
|
176
|
+
super(i, (t, e) => u(this, null, function* () {
|
|
177
|
+
yield t.setVisibility(e ? x.FULL : x.SUPPRESS);
|
|
178
|
+
}));
|
|
173
179
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
180
|
+
}
|
|
181
|
+
class It extends $ {
|
|
182
|
+
constructor(i) {
|
|
183
|
+
super(i, (t, e) => u(this, null, function* () {
|
|
184
|
+
yield t.setEnabled(e);
|
|
185
|
+
}));
|
|
177
186
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
187
|
+
}
|
|
188
|
+
class _t extends $ {
|
|
189
|
+
constructor(i, t) {
|
|
190
|
+
super(i, (e, s) => u(this, null, function* () {
|
|
191
|
+
s && (yield e.setValue(t));
|
|
192
|
+
}));
|
|
182
193
|
}
|
|
183
194
|
}
|
|
184
|
-
|
|
185
|
-
|
|
195
|
+
var T = /* @__PURE__ */ ((n) => (n[n.NOT = 0] = "NOT", n[n.OR = 1] = "OR", n[n.AND = 2] = "AND", n[n.XOR = 3] = "XOR", n[n.NAND = 4] = "NAND", n[n.NOR = 5] = "NOR", n[n.EQUALS = -1] = "EQUALS", n[n.NOT_EQUALS = -2] = "NOT_EQUALS", n[n.GT = -3] = "GT", n[n.LT = -4] = "LT", n[n.GE = -5] = "GE", n[n.LE = -6] = "LE", n[n.IN = -7] = "IN", n[n.NOT_IN = -8] = "NOT_IN", n[n.INCLUDES = -9] = "INCLUDES", n[n.NOT_INCLUDES = -10] = "NOT_INCLUDES", n))(T || {});
|
|
196
|
+
((n) => {
|
|
197
|
+
function i(r) {
|
|
198
|
+
const a = r.toLowerCase();
|
|
199
|
+
if (a === "not") return 0;
|
|
200
|
+
if (a === "or") return 1;
|
|
201
|
+
if (a === "and") return 2;
|
|
202
|
+
if (a === "xor") return 3;
|
|
203
|
+
if (a === "nand") return 4;
|
|
204
|
+
if (a === "nor") return 5;
|
|
205
|
+
if (a === "equals") return -1;
|
|
206
|
+
if (["not_equals", "not-equals", "not equals"].includes(a)) return -2;
|
|
207
|
+
if (a === "gt") return -3;
|
|
208
|
+
if (a === "lt") return -4;
|
|
209
|
+
if (a === "ge") return -5;
|
|
210
|
+
if (a === "le") return -6;
|
|
211
|
+
if (a === "in") return -7;
|
|
212
|
+
if (["not_in", "not-in", "not in"].includes(a)) return -8;
|
|
213
|
+
if (a === "includes") return -9;
|
|
214
|
+
if (["not_includes", "not-includes", "not includes"].includes(a)) return -10;
|
|
215
|
+
throw new Error(`Unrecognised operator ${a}`);
|
|
216
|
+
}
|
|
217
|
+
n.fromString = i;
|
|
218
|
+
function t(r) {
|
|
219
|
+
const a = typeof r == "number" ? r : n.fromString(r);
|
|
220
|
+
if (Object.values(n).includes(a)) return a;
|
|
221
|
+
throw new Error(`Unrecognised operator ${r}`);
|
|
222
|
+
}
|
|
223
|
+
n.fromAny = t;
|
|
224
|
+
function e(r) {
|
|
225
|
+
const a = typeof r == "number" ? r : n.fromString(r);
|
|
226
|
+
return Object.values(n).includes(a);
|
|
227
|
+
}
|
|
228
|
+
n.isDefined = e;
|
|
229
|
+
function s(r) {
|
|
230
|
+
return r >= 0;
|
|
231
|
+
}
|
|
232
|
+
n.isLogicOperator = s;
|
|
233
|
+
})(T || (T = {}));
|
|
234
|
+
Object.freeze(T);
|
|
235
|
+
const f = T, St = Symbol("EnabledChangingAction");
|
|
236
|
+
class k extends d {
|
|
186
237
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
187
238
|
constructor(i) {
|
|
188
239
|
super(i);
|
|
189
240
|
}
|
|
190
241
|
// eslint-disable-next-line class-methods-use-this
|
|
191
|
-
get classIdentifier() {
|
|
192
|
-
return
|
|
242
|
+
static get classIdentifier() {
|
|
243
|
+
return St;
|
|
193
244
|
}
|
|
194
245
|
execute(i, t, e, s) {
|
|
195
|
-
return
|
|
196
|
-
return
|
|
246
|
+
return u(this, null, function* () {
|
|
247
|
+
return b(k.prototype, this, "execute").call(this, i, t, e, s);
|
|
197
248
|
});
|
|
198
249
|
}
|
|
199
250
|
}
|
|
200
|
-
const
|
|
201
|
-
class
|
|
251
|
+
const Ct = Symbol("EnabledChangedAction");
|
|
252
|
+
class F extends d {
|
|
202
253
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
203
254
|
constructor(i) {
|
|
204
255
|
super(i);
|
|
205
256
|
}
|
|
206
257
|
// eslint-disable-next-line class-methods-use-this
|
|
207
|
-
get classIdentifier() {
|
|
208
|
-
return
|
|
258
|
+
static get classIdentifier() {
|
|
259
|
+
return Ct;
|
|
209
260
|
}
|
|
210
261
|
execute(i, t, e, s) {
|
|
211
|
-
return
|
|
212
|
-
return
|
|
262
|
+
return u(this, null, function* () {
|
|
263
|
+
return b(F.prototype, this, "execute").call(this, i, t, e, s);
|
|
213
264
|
});
|
|
214
265
|
}
|
|
215
266
|
}
|
|
216
|
-
const
|
|
217
|
-
class
|
|
267
|
+
const Vt = Symbol("ValidChangedAction");
|
|
268
|
+
class q extends d {
|
|
218
269
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
219
270
|
constructor(i) {
|
|
220
271
|
super(i);
|
|
221
272
|
}
|
|
222
273
|
// eslint-disable-next-line class-methods-use-this
|
|
223
|
-
get classIdentifier() {
|
|
224
|
-
return
|
|
274
|
+
static get classIdentifier() {
|
|
275
|
+
return Vt;
|
|
225
276
|
}
|
|
226
277
|
execute(i, t, e, s) {
|
|
227
|
-
return
|
|
228
|
-
return
|
|
278
|
+
return u(this, null, function* () {
|
|
279
|
+
return b(q.prototype, this, "execute").call(this, i, t, e, s);
|
|
229
280
|
});
|
|
230
281
|
}
|
|
231
282
|
}
|
|
232
|
-
const
|
|
233
|
-
class
|
|
283
|
+
const At = Symbol("VisibilityChangingAction");
|
|
284
|
+
class M extends d {
|
|
234
285
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
235
286
|
constructor(i) {
|
|
236
287
|
super(i);
|
|
237
288
|
}
|
|
238
289
|
// eslint-disable-next-line class-methods-use-this
|
|
239
|
-
get classIdentifier() {
|
|
240
|
-
return
|
|
290
|
+
static get classIdentifier() {
|
|
291
|
+
return At;
|
|
241
292
|
}
|
|
242
293
|
execute(i, t, e, s) {
|
|
243
|
-
return
|
|
244
|
-
return
|
|
294
|
+
return u(this, null, function* () {
|
|
295
|
+
return b(M.prototype, this, "execute").call(this, i, t, e, s);
|
|
245
296
|
});
|
|
246
297
|
}
|
|
247
298
|
}
|
|
248
|
-
const
|
|
249
|
-
class
|
|
299
|
+
const Nt = Symbol("VisibilityChangedAction");
|
|
300
|
+
class w extends d {
|
|
250
301
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
251
302
|
constructor(i) {
|
|
252
303
|
super(i);
|
|
253
304
|
}
|
|
254
305
|
// eslint-disable-next-line class-methods-use-this
|
|
255
|
-
get classIdentifier() {
|
|
256
|
-
return
|
|
306
|
+
static get classIdentifier() {
|
|
307
|
+
return Nt;
|
|
257
308
|
}
|
|
258
309
|
execute(i, t, e, s) {
|
|
259
|
-
return
|
|
260
|
-
return
|
|
310
|
+
return u(this, null, function* () {
|
|
311
|
+
return b(w.prototype, this, "execute").call(this, i, t, e, s);
|
|
261
312
|
});
|
|
262
313
|
}
|
|
263
314
|
}
|
|
264
315
|
class p {
|
|
265
316
|
constructor() {
|
|
266
|
-
|
|
317
|
+
h(this, "reactiveValue", lt(() => this.value));
|
|
267
318
|
// contains original field value as was provided at creation
|
|
268
|
-
|
|
319
|
+
h(this, "valid", !0);
|
|
269
320
|
// is current value valid as per FE and BE validators?
|
|
270
|
-
|
|
321
|
+
h(this, "errors", []);
|
|
271
322
|
// when member of a Group, fieldName specifies the name of this field
|
|
272
|
-
|
|
323
|
+
h(this, "actions", new ut());
|
|
273
324
|
// default property handlers
|
|
274
|
-
|
|
275
|
-
|
|
325
|
+
h(this, "_visibility", x.FULL);
|
|
326
|
+
h(this, "_enabled", !0);
|
|
276
327
|
}
|
|
277
328
|
get visibility() {
|
|
278
329
|
return this._visibility;
|
|
279
330
|
}
|
|
280
331
|
set visibility(i) {
|
|
281
332
|
const t = this._visibility;
|
|
282
|
-
if (!
|
|
283
|
-
this._visibility =
|
|
333
|
+
if (!x.isDefined(i)) throw new Error("visibility must be a DisplayMode constant");
|
|
334
|
+
this._visibility = x.fromAny(i), this.actions.trigger(w, this, this._visibility, t);
|
|
284
335
|
}
|
|
285
336
|
setVisibility(i) {
|
|
286
|
-
return
|
|
287
|
-
const t = this._visibility, e = yield this.actions.trigger(
|
|
288
|
-
if (!
|
|
289
|
-
this._visibility =
|
|
337
|
+
return u(this, null, function* () {
|
|
338
|
+
const t = this._visibility, e = yield this.actions.trigger(M, this, i, t);
|
|
339
|
+
if (!x.isDefined(e != null ? e : i)) throw new Error("visibility must be a DisplayMode constant");
|
|
340
|
+
this._visibility = x.fromAny(e != null ? e : i), yield this.actions.trigger(w, this, this._visibility, t);
|
|
290
341
|
});
|
|
291
342
|
}
|
|
292
343
|
get enabled() {
|
|
@@ -294,50 +345,168 @@ class p {
|
|
|
294
345
|
}
|
|
295
346
|
set enabled(i) {
|
|
296
347
|
const t = this._enabled;
|
|
297
|
-
if (!
|
|
298
|
-
this._enabled = i, this.actions.trigger(
|
|
348
|
+
if (!it(i)) throw new Error("Enabled value must be boolean");
|
|
349
|
+
this._enabled = i, this.actions.trigger(F, this, this._enabled, t);
|
|
299
350
|
}
|
|
300
351
|
setEnabled(i) {
|
|
301
|
-
return
|
|
302
|
-
const t = this._enabled, e = yield this.actions.trigger(
|
|
303
|
-
if (!
|
|
304
|
-
this._enabled = e != null ? e : i, this.actions.trigger(
|
|
352
|
+
return u(this, null, function* () {
|
|
353
|
+
const t = this._enabled, e = yield this.actions.trigger(k, this, i, t);
|
|
354
|
+
if (!it(e != null ? e : i)) throw new Error("Enabled value must be boolean");
|
|
355
|
+
this._enabled = e != null ? e : i, yield this.actions.trigger(F, this, this._enabled, t);
|
|
305
356
|
});
|
|
306
357
|
}
|
|
307
358
|
validate() {
|
|
308
359
|
const i = this.valid;
|
|
309
|
-
this.valid = this.errors.length === 0, this.valid !== i && this.actions.trigger(
|
|
360
|
+
this.valid = this.errors.length === 0, this.valid !== i && this.actions.trigger(q, this, this.valid, i);
|
|
310
361
|
}
|
|
311
362
|
get fullValue() {
|
|
312
363
|
return this.value;
|
|
313
364
|
}
|
|
314
365
|
get isChanged() {
|
|
315
|
-
return !
|
|
366
|
+
return !B(this.value, this.originalValue);
|
|
316
367
|
}
|
|
317
368
|
registerAction(i) {
|
|
318
|
-
|
|
369
|
+
const t = i;
|
|
370
|
+
return this.actions.register(t), t.boundToField(this), t.eager && this.actions.trigger(Object.getPrototypeOf(i).constructor, this, this.value, this.originalValue), this;
|
|
319
371
|
}
|
|
320
372
|
triggerAction(i, ...t) {
|
|
321
373
|
return this.actions.trigger(i, this, ...t);
|
|
322
374
|
}
|
|
323
375
|
}
|
|
324
|
-
function
|
|
376
|
+
function jt(n, i) {
|
|
377
|
+
return n ? !i : i;
|
|
378
|
+
}
|
|
379
|
+
class j {
|
|
380
|
+
constructor(i, t, e) {
|
|
381
|
+
h(this, "operand1");
|
|
382
|
+
h(this, "operator");
|
|
383
|
+
h(this, "operand2");
|
|
384
|
+
this.operand1 = i, this.operator = t, this.operand2 = e;
|
|
385
|
+
}
|
|
386
|
+
get operand1Value() {
|
|
387
|
+
return this.operand1 instanceof j ? this.operand1.evaluate() : this.operand1 instanceof p ? S(this.operand1.value) : this.operand1;
|
|
388
|
+
}
|
|
389
|
+
get operand2Value() {
|
|
390
|
+
return this.operand2 instanceof j ? this.operand2.evaluate() : this.operand2 instanceof p ? S(this.operand2.value) : this.operand2;
|
|
391
|
+
}
|
|
392
|
+
evaluate() {
|
|
393
|
+
var e, s, r, a;
|
|
394
|
+
const i = this.operand1Value, t = this.operand2Value;
|
|
395
|
+
switch (this.operator) {
|
|
396
|
+
case f.AND:
|
|
397
|
+
return i && t;
|
|
398
|
+
case f.OR:
|
|
399
|
+
return i || t;
|
|
400
|
+
case f.NAND:
|
|
401
|
+
return !(i && t);
|
|
402
|
+
case f.NOR:
|
|
403
|
+
return !(i || t);
|
|
404
|
+
case f.XOR:
|
|
405
|
+
return jt(i, t);
|
|
406
|
+
case f.NOT:
|
|
407
|
+
return !i;
|
|
408
|
+
case f.EQUALS:
|
|
409
|
+
return i == t;
|
|
410
|
+
case f.NOT_EQUALS:
|
|
411
|
+
return i != t;
|
|
412
|
+
case f.LT:
|
|
413
|
+
return i < t;
|
|
414
|
+
case f.LE:
|
|
415
|
+
return i <= t;
|
|
416
|
+
case f.GE:
|
|
417
|
+
return i >= t;
|
|
418
|
+
case f.GT:
|
|
419
|
+
return i > t;
|
|
420
|
+
case f.IN:
|
|
421
|
+
return (s = (e = t == null ? void 0 : t.includes) == null ? void 0 : e.call(t, i)) != null ? s : !1;
|
|
422
|
+
case f.NOT_IN:
|
|
423
|
+
return !((a = (r = t == null ? void 0 : t.includes) == null ? void 0 : r.call(t, i)) == null || a);
|
|
424
|
+
case f.INCLUDES:
|
|
425
|
+
return _(i) && _(t) && i.indexOf(t) >= 0;
|
|
426
|
+
case f.NOT_INCLUDES:
|
|
427
|
+
return !(_(i) && _(t) && i.indexOf(t) >= 0);
|
|
428
|
+
default:
|
|
429
|
+
throw new Error(`Operator not implemented ${this.operator}`);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Recursively collects all fields used in this statement and its nested statements
|
|
434
|
+
* @returns A set of all fields used in this statement
|
|
435
|
+
*/
|
|
436
|
+
collectFields() {
|
|
437
|
+
const i = /* @__PURE__ */ new Set();
|
|
438
|
+
function t(e) {
|
|
439
|
+
e instanceof p ? i.add(e) : e instanceof j && e.collectFields().forEach((r) => i.add(r));
|
|
440
|
+
}
|
|
441
|
+
return t(this.operand1), t(this.operand2), i;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
const Lt = Symbol("ExecuteAction");
|
|
445
|
+
class Q extends d {
|
|
446
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
447
|
+
constructor(i) {
|
|
448
|
+
super(i);
|
|
449
|
+
}
|
|
450
|
+
// eslint-disable-next-line class-methods-use-this
|
|
451
|
+
static get classIdentifier() {
|
|
452
|
+
return Lt;
|
|
453
|
+
}
|
|
454
|
+
execute(i, t, e) {
|
|
455
|
+
return u(this, null, function* () {
|
|
456
|
+
return b(Q.prototype, this, "execute").call(this, i, t, e);
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
const Tt = Symbol("ListItemAddedAction");
|
|
461
|
+
class O extends d {
|
|
462
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
463
|
+
constructor(i) {
|
|
464
|
+
super(i);
|
|
465
|
+
}
|
|
466
|
+
// eslint-disable-next-line class-methods-use-this
|
|
467
|
+
static get classIdentifier() {
|
|
468
|
+
return Tt;
|
|
469
|
+
}
|
|
470
|
+
execute(i, t, e, s) {
|
|
471
|
+
return u(this, null, function* () {
|
|
472
|
+
return b(O.prototype, this, "execute").call(this, i, t, e, s);
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
const Ft = Symbol("ListItemRemovedAction");
|
|
477
|
+
class z extends d {
|
|
478
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
479
|
+
constructor(i) {
|
|
480
|
+
super(i);
|
|
481
|
+
}
|
|
482
|
+
// eslint-disable-next-line class-methods-use-this
|
|
483
|
+
static get classIdentifier() {
|
|
484
|
+
return Ft;
|
|
485
|
+
}
|
|
486
|
+
execute(i, t, e, s) {
|
|
487
|
+
return u(this, null, function* () {
|
|
488
|
+
return b(z.prototype, this, "execute").call(this, i, t, e, s);
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
function st(n, i) {
|
|
325
493
|
return (n == null ? void 0 : n.label) == null && (n == null ? void 0 : n.icon) == null ? i : n;
|
|
326
494
|
}
|
|
327
|
-
class
|
|
495
|
+
class D extends p {
|
|
328
496
|
constructor(t) {
|
|
329
497
|
super();
|
|
330
|
-
|
|
498
|
+
h(this, "_value");
|
|
331
499
|
if (t) {
|
|
332
|
-
const e = t, { value: s, originalValue: l } = e,
|
|
333
|
-
Object.assign(this,
|
|
334
|
-
const
|
|
335
|
-
this._value =
|
|
500
|
+
const e = t, { value: s, originalValue: r, validators: a, actions: l } = e, c = N(e, ["value", "originalValue", "validators", "actions"]);
|
|
501
|
+
[...a || [], ...l || []].forEach((P) => this.registerAction(P)), Object.assign(this, c);
|
|
502
|
+
const o = { label: s == null ? void 0 : s.label, icon: s == null ? void 0 : s.icon }, I = Object.freeze({ label: r == null ? void 0 : r.label, icon: r == null ? void 0 : r.icon });
|
|
503
|
+
this._value = U(st(o, I)), this.originalValue = st(I, o);
|
|
336
504
|
} else
|
|
337
|
-
this._value =
|
|
505
|
+
this._value = U({ label: void 0, icon: void 0 });
|
|
506
|
+
this.actions.triggerEager(this, this.value, this.originalValue);
|
|
338
507
|
}
|
|
339
508
|
static create(t) {
|
|
340
|
-
return
|
|
509
|
+
return U(new D(t));
|
|
341
510
|
}
|
|
342
511
|
get value() {
|
|
343
512
|
return this._value;
|
|
@@ -347,6 +516,13 @@ class A extends p {
|
|
|
347
516
|
const e = this._value;
|
|
348
517
|
this._value.icon = t == null ? void 0 : t.icon, this._value.label = t == null ? void 0 : t.label, this.actions.trigger(g, this, t, e), this.parent && this.parent.notifyValueChanged(), this.validate();
|
|
349
518
|
}
|
|
519
|
+
setValue(t) {
|
|
520
|
+
return u(this, null, function* () {
|
|
521
|
+
if (!this.enabled) return;
|
|
522
|
+
const e = this._value;
|
|
523
|
+
this._value.icon = t == null ? void 0 : t.icon, this._value.label = t == null ? void 0 : t.label, yield this.actions.trigger(g, this, t, e), this.parent && (yield this.parent.notifyValueChanged()), this.validate();
|
|
524
|
+
});
|
|
525
|
+
}
|
|
350
526
|
get icon() {
|
|
351
527
|
return this.value.icon;
|
|
352
528
|
}
|
|
@@ -360,75 +536,86 @@ class A extends p {
|
|
|
360
536
|
this.value = { label: t, icon: this.value.icon };
|
|
361
537
|
}
|
|
362
538
|
clone(t) {
|
|
363
|
-
var e, s,
|
|
364
|
-
return
|
|
539
|
+
var e, s, r, a;
|
|
540
|
+
return D.create(A(V({
|
|
365
541
|
value: (e = t == null ? void 0 : t.value) != null ? e : this.value
|
|
366
542
|
}, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
|
|
367
543
|
errors: [...(s = t == null ? void 0 : t.errors) != null ? s : this.errors],
|
|
368
|
-
enabled: (
|
|
544
|
+
enabled: (r = t == null ? void 0 : t.enabled) != null ? r : this.enabled,
|
|
369
545
|
visibility: (a = t == null ? void 0 : t.visibility) != null ? a : this.visibility
|
|
370
546
|
}));
|
|
371
547
|
}
|
|
372
548
|
execute(t) {
|
|
373
|
-
this.actions.trigger(
|
|
549
|
+
this.actions.trigger(Q, this, t);
|
|
374
550
|
}
|
|
375
551
|
}
|
|
376
|
-
class
|
|
552
|
+
class C extends p {
|
|
377
553
|
constructor(t) {
|
|
378
554
|
super();
|
|
379
|
-
|
|
555
|
+
h(this, "_value");
|
|
380
556
|
if (t) {
|
|
381
|
-
const e = t, { value: s } = e, l =
|
|
382
|
-
Object.assign(this, l), this._value = s != null ? s : this.originalValue, this.originalValue === void 0 && (this.originalValue = this._value);
|
|
557
|
+
const e = t, { value: s, validators: r, actions: a } = e, l = N(e, ["value", "validators", "actions"]);
|
|
558
|
+
[...r || [], ...a || []].forEach((c) => this.registerAction(c)), Object.assign(this, l), this._value = s != null ? s : this.originalValue, this.originalValue === void 0 && (this.originalValue = this._value);
|
|
383
559
|
}
|
|
560
|
+
this.actions.triggerEager(this, this.value, this.originalValue);
|
|
384
561
|
}
|
|
562
|
+
/**
|
|
563
|
+
* Creates a new reactive Field instance.
|
|
564
|
+
* @param params Initial field parameters
|
|
565
|
+
* @returns Reactive Field instance
|
|
566
|
+
*/
|
|
385
567
|
static create(t) {
|
|
386
|
-
return
|
|
568
|
+
return U(new C(t));
|
|
387
569
|
}
|
|
388
570
|
get value() {
|
|
389
571
|
return this._value;
|
|
390
572
|
}
|
|
391
573
|
set value(t) {
|
|
392
|
-
if (!this.enabled) return;
|
|
393
574
|
const e = this._value;
|
|
394
|
-
this._value = t, this.actions.trigger(g, this, t, e), this.parent && this.parent.notifyValueChanged(), this.validate();
|
|
575
|
+
!this.enabled || e === t || (this._value = t, this.actions.trigger(g, this, t, e), this.parent && this.parent.notifyValueChanged(), this.validate());
|
|
576
|
+
}
|
|
577
|
+
setValue(t) {
|
|
578
|
+
return u(this, null, function* () {
|
|
579
|
+
const e = this._value;
|
|
580
|
+
!this.enabled || e === t || (this._value = t, yield this.actions.trigger(g, this, t, e), this.parent && (yield this.parent.notifyValueChanged()), this.validate());
|
|
581
|
+
});
|
|
395
582
|
}
|
|
396
583
|
clone(t) {
|
|
397
|
-
var e, s,
|
|
398
|
-
return
|
|
584
|
+
var e, s, r, a;
|
|
585
|
+
return C.create(A(V({
|
|
399
586
|
value: (e = t == null ? void 0 : t.value) != null ? e : this.value
|
|
400
587
|
}, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
|
|
401
588
|
errors: [...(s = t == null ? void 0 : t.errors) != null ? s : this.errors],
|
|
402
|
-
enabled: (
|
|
589
|
+
enabled: (r = t == null ? void 0 : t.enabled) != null ? r : this.enabled,
|
|
403
590
|
visibility: (a = t == null ? void 0 : t.visibility) != null ? a : this.visibility
|
|
404
591
|
}));
|
|
405
592
|
}
|
|
406
593
|
}
|
|
407
|
-
const
|
|
408
|
-
() =>
|
|
594
|
+
const wt = C.create({ value: "EmptyField" }).registerAction(new g(
|
|
595
|
+
() => u(void 0, null, function* () {
|
|
409
596
|
console.warn("Working with EmptyField! This should not happen");
|
|
410
597
|
})
|
|
411
598
|
));
|
|
412
|
-
class
|
|
599
|
+
class E extends p {
|
|
413
600
|
constructor(t, e) {
|
|
414
601
|
super();
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
if (!
|
|
419
|
-
if (this._fields = {}, Object.entries(t).forEach(([
|
|
420
|
-
Object.defineProperty(a, "parent", { get: () => this, configurable: !1, enumerable: !1 }), Object.defineProperty(a, "fieldName", { get: () =>
|
|
602
|
+
h(this, "_fields");
|
|
603
|
+
h(this, "_value", null);
|
|
604
|
+
h(this, "suppressNotifyValueChanged", !1);
|
|
605
|
+
if (!E.isValidFields(t)) throw new Error("Invalid fields object provided");
|
|
606
|
+
if (this._fields = {}, Object.entries(t).forEach(([r, a]) => {
|
|
607
|
+
Object.defineProperty(a, "parent", { get: () => this, configurable: !1, enumerable: !1 }), Object.defineProperty(a, "fieldName", { get: () => r, configurable: !1, enumerable: !1 }), Object.defineProperty(
|
|
421
608
|
this._fields,
|
|
422
|
-
|
|
609
|
+
r,
|
|
423
610
|
{ get() {
|
|
424
611
|
return a;
|
|
425
612
|
}, configurable: !1, enumerable: !0 }
|
|
426
613
|
);
|
|
427
614
|
}), e) {
|
|
428
|
-
const s = e, { value: l } = s,
|
|
429
|
-
Object.assign(this,
|
|
615
|
+
const s = e, { value: r, validators: a, actions: l } = s, c = N(s, ["value", "validators", "actions"]);
|
|
616
|
+
[...a || [], ...l || []].forEach((o) => this.registerAction(o)), Object.assign(this, c), this.value = r != null ? r : this.originalValue;
|
|
430
617
|
}
|
|
431
|
-
this.originalValue === void 0 && (this.originalValue = this.value);
|
|
618
|
+
this.originalValue === void 0 && (this.originalValue = this.value), this.actions.triggerEager(this, this.value, this.originalValue);
|
|
432
619
|
}
|
|
433
620
|
static isValidFields(t) {
|
|
434
621
|
function e(s) {
|
|
@@ -439,9 +626,9 @@ class b extends p {
|
|
|
439
626
|
static createFromFormData(t) {
|
|
440
627
|
if (t instanceof p)
|
|
441
628
|
throw new Error("data is already a Form structure, should be a simple object");
|
|
442
|
-
return new
|
|
629
|
+
return new E(
|
|
443
630
|
t == null ? {} : Object.fromEntries(
|
|
444
|
-
Object.entries(t).map(([e, s]) => [e,
|
|
631
|
+
Object.entries(t).map(([e, s]) => [e, C.create({ value: s })])
|
|
445
632
|
)
|
|
446
633
|
);
|
|
447
634
|
}
|
|
@@ -455,9 +642,9 @@ class b extends p {
|
|
|
455
642
|
get value() {
|
|
456
643
|
const t = {};
|
|
457
644
|
return Object.entries(this._fields).forEach(([e, s]) => {
|
|
458
|
-
const
|
|
459
|
-
(s.enabled || s instanceof
|
|
460
|
-
}),
|
|
645
|
+
const r = s.value;
|
|
646
|
+
(s.enabled || s instanceof E && !X(r)) && (t[e] = r);
|
|
647
|
+
}), X(t) ? null : t;
|
|
461
648
|
}
|
|
462
649
|
set value(t) {
|
|
463
650
|
this.suppressNotifyValueChanged = !0;
|
|
@@ -470,6 +657,23 @@ class b extends p {
|
|
|
470
657
|
}
|
|
471
658
|
this.notifyValueChanged();
|
|
472
659
|
}
|
|
660
|
+
setValue(t) {
|
|
661
|
+
return u(this, null, function* () {
|
|
662
|
+
this.suppressNotifyValueChanged = !0;
|
|
663
|
+
function e(s, r) {
|
|
664
|
+
return u(this, null, function* () {
|
|
665
|
+
(t == null || s in t) && (yield r.setValue(t == null ? null : t[s]));
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
try {
|
|
669
|
+
for (const [s, r] of Object.entries(this._fields))
|
|
670
|
+
yield e(s, r);
|
|
671
|
+
} finally {
|
|
672
|
+
this.suppressNotifyValueChanged = !1;
|
|
673
|
+
}
|
|
674
|
+
yield this.notifyValueChanged();
|
|
675
|
+
});
|
|
676
|
+
}
|
|
473
677
|
get fullValue() {
|
|
474
678
|
const t = {};
|
|
475
679
|
return Object.entries(this._fields).forEach(([e, s]) => {
|
|
@@ -477,68 +681,76 @@ class b extends p {
|
|
|
477
681
|
}), t;
|
|
478
682
|
}
|
|
479
683
|
notifyValueChanged() {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
684
|
+
return u(this, null, function* () {
|
|
685
|
+
if (this.suppressNotifyValueChanged) return;
|
|
686
|
+
const t = this.value;
|
|
687
|
+
if (!B(t, this._value)) {
|
|
688
|
+
const e = this._value;
|
|
689
|
+
this._value = t, yield this.actions.trigger(g, this, t, e), this.parent && (yield this.parent.notifyValueChanged());
|
|
690
|
+
}
|
|
691
|
+
});
|
|
486
692
|
}
|
|
487
693
|
clone(t) {
|
|
488
|
-
var s,
|
|
694
|
+
var s, r, a, l;
|
|
489
695
|
const e = {};
|
|
490
|
-
return Object.entries(this._fields).forEach(([
|
|
491
|
-
e[
|
|
492
|
-
}), new
|
|
696
|
+
return Object.entries(this._fields).forEach(([c, o]) => {
|
|
697
|
+
e[c] = o.clone();
|
|
698
|
+
}), new E(e, A(V({
|
|
493
699
|
value: (s = t == null ? void 0 : t.value) != null ? s : this.value
|
|
494
700
|
}, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
|
|
495
|
-
errors: [...(
|
|
701
|
+
errors: [...(r = t == null ? void 0 : t.errors) != null ? r : []],
|
|
496
702
|
enabled: (a = t == null ? void 0 : t.enabled) != null ? a : this.enabled,
|
|
497
|
-
visibility: (
|
|
703
|
+
visibility: (l = t == null ? void 0 : t.visibility) != null ? l : this.visibility
|
|
498
704
|
}));
|
|
499
705
|
}
|
|
500
706
|
}
|
|
501
|
-
class
|
|
707
|
+
class W extends p {
|
|
502
708
|
constructor(t, e) {
|
|
503
709
|
super();
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
710
|
+
h(this, "_value", null);
|
|
711
|
+
h(this, "_itemTemplate");
|
|
712
|
+
h(this, "_previousValue");
|
|
507
713
|
if (this._itemTemplate = t, e) {
|
|
508
|
-
const s = e, { value: l } = s,
|
|
509
|
-
Object.assign(this,
|
|
714
|
+
const s = e, { value: r, validators: a, actions: l } = s, c = N(s, ["value", "validators", "actions"]);
|
|
715
|
+
[...a || [], ...l || []].forEach((o) => this.registerAction(o)), Object.assign(this, c), r && this.setValueInternal(r);
|
|
510
716
|
}
|
|
511
|
-
this.originalValue === void 0 && (this.originalValue = this.value), this._previousValue = this.value;
|
|
717
|
+
this.originalValue === void 0 && (this.originalValue = this.value), this._previousValue = this.value, this.actions.triggerEager(this, this.value, this.originalValue);
|
|
512
718
|
}
|
|
513
719
|
processSetValueItem(t) {
|
|
514
720
|
let e;
|
|
515
|
-
return t instanceof
|
|
721
|
+
return t instanceof E ? e = t : this._itemTemplate ? e = this._itemTemplate.clone({ value: t }) : e = E.createFromFormData(t), Object.defineProperty(e, "parent", { get: () => this, configurable: !1, enumerable: !1 }), e;
|
|
516
722
|
}
|
|
517
|
-
|
|
723
|
+
setValueInternal(t) {
|
|
518
724
|
Array.isArray(t) && (this._value = t.map((e) => this.processSetValueItem(e)));
|
|
519
725
|
}
|
|
520
726
|
get value() {
|
|
521
727
|
var e;
|
|
522
728
|
const t = (e = this._value) == null ? void 0 : e.map((s) => s.value);
|
|
523
|
-
return
|
|
729
|
+
return X(t) ? null : t;
|
|
524
730
|
}
|
|
525
731
|
set value(t) {
|
|
526
732
|
const e = this.value;
|
|
527
|
-
this.
|
|
733
|
+
this.setValueInternal(t), this.actions.trigger(g, this, this.value, e), this.parent && this.parent.notifyValueChanged();
|
|
734
|
+
}
|
|
735
|
+
setValue(t) {
|
|
736
|
+
return u(this, null, function* () {
|
|
737
|
+
const e = this.value;
|
|
738
|
+
this.setValueInternal(t), yield this.actions.trigger(g, this, this.value, e), this.parent && (yield this.parent.notifyValueChanged());
|
|
739
|
+
});
|
|
528
740
|
}
|
|
529
741
|
clone(t) {
|
|
530
|
-
var e, s,
|
|
531
|
-
return new
|
|
742
|
+
var e, s, r, a, l;
|
|
743
|
+
return new W((e = this._itemTemplate) == null ? void 0 : e.clone(), A(V({
|
|
532
744
|
value: [...(s = t == null ? void 0 : t.value) != null ? s : this.value]
|
|
533
745
|
}, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
|
|
534
|
-
errors: [...(
|
|
746
|
+
errors: [...(r = t == null ? void 0 : t.errors) != null ? r : []],
|
|
535
747
|
enabled: (a = t == null ? void 0 : t.enabled) != null ? a : this.enabled,
|
|
536
|
-
visibility: (
|
|
748
|
+
visibility: (l = t == null ? void 0 : t.visibility) != null ? l : this.visibility
|
|
537
749
|
}));
|
|
538
750
|
}
|
|
539
751
|
notifyValueChanged() {
|
|
540
752
|
const t = this.value;
|
|
541
|
-
if (!
|
|
753
|
+
if (!B(t, this._previousValue)) {
|
|
542
754
|
const e = this._previousValue;
|
|
543
755
|
this._previousValue = t, this.actions.trigger(g, this, t, e), this.parent && this.parent.notifyValueChanged();
|
|
544
756
|
}
|
|
@@ -558,66 +770,331 @@ class B extends p {
|
|
|
558
770
|
var s;
|
|
559
771
|
if (this._value == null || t < 0 || this._value.length <= t) return;
|
|
560
772
|
let e = (s = this._value.splice(t, 1)) == null ? void 0 : s[0];
|
|
561
|
-
return e && (e = e.clone(), this.actions.trigger(
|
|
773
|
+
return e && (e = e.clone(), this.actions.trigger(z, this, e, t), this.notifyValueChanged()), e;
|
|
562
774
|
}
|
|
563
775
|
insert(t, e) {
|
|
564
776
|
for (this._value == null && (this._value = []); this._value.length < e; ) {
|
|
565
|
-
const
|
|
566
|
-
this.actions.trigger(
|
|
777
|
+
const r = this.processSetValueItem(null), a = this._value.push(r);
|
|
778
|
+
this.actions.trigger(O, this, r, a);
|
|
567
779
|
}
|
|
568
780
|
const s = this.processSetValueItem(t);
|
|
569
|
-
return this._value.splice(e, 0, s), this.actions.trigger(
|
|
781
|
+
return this._value.splice(e, 0, s), this.actions.trigger(O, this, s, e), this.notifyValueChanged(), e;
|
|
570
782
|
}
|
|
571
783
|
clear() {
|
|
572
784
|
this._value = null, this.notifyValueChanged();
|
|
573
785
|
}
|
|
574
786
|
}
|
|
575
|
-
const
|
|
787
|
+
const ot = { useMarkdownInValidators: !0 };
|
|
788
|
+
function Ot() {
|
|
789
|
+
return ot;
|
|
790
|
+
}
|
|
791
|
+
function Pt(n) {
|
|
792
|
+
Object.assign(ot, n);
|
|
793
|
+
}
|
|
794
|
+
const Yt = {
|
|
795
|
+
install(n, i) {
|
|
796
|
+
i && Pt(i);
|
|
797
|
+
}
|
|
798
|
+
};
|
|
799
|
+
class J extends String {
|
|
800
|
+
}
|
|
801
|
+
function K(n) {
|
|
802
|
+
const i = S(n);
|
|
803
|
+
return typeof i == "object" && "componentName" in i;
|
|
804
|
+
}
|
|
805
|
+
class Y {
|
|
806
|
+
get componentName() {
|
|
807
|
+
return "Comment";
|
|
808
|
+
}
|
|
809
|
+
// eslint-disable-line class-methods-use-this
|
|
810
|
+
get componentBindings() {
|
|
811
|
+
return {};
|
|
812
|
+
}
|
|
813
|
+
// eslint-disable-line class-methods-use-this
|
|
814
|
+
get componentBody() {
|
|
815
|
+
return "";
|
|
816
|
+
}
|
|
817
|
+
// eslint-disable-line class-methods-use-this
|
|
818
|
+
}
|
|
819
|
+
class Rt extends Y {
|
|
820
|
+
constructor(t) {
|
|
821
|
+
super();
|
|
822
|
+
h(this, "text");
|
|
823
|
+
this.text = t;
|
|
824
|
+
}
|
|
825
|
+
get componentName() {
|
|
826
|
+
return "template";
|
|
827
|
+
}
|
|
828
|
+
// eslint-disable-line class-methods-use-this
|
|
829
|
+
get componentBody() {
|
|
830
|
+
return this.text;
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
class y extends Y {
|
|
834
|
+
constructor(t) {
|
|
835
|
+
super();
|
|
836
|
+
h(this, "text");
|
|
837
|
+
h(this, "textType");
|
|
838
|
+
this.text = vt(t) ? t : mt(t), this.textType = lt(() => this.getTextType);
|
|
839
|
+
}
|
|
840
|
+
get getTextType() {
|
|
841
|
+
const t = this.text.value;
|
|
842
|
+
return t ? t instanceof J ? "md" : K(t) ? "component" : "string" : "string";
|
|
843
|
+
}
|
|
844
|
+
get componentName() {
|
|
845
|
+
switch (this.textType.value) {
|
|
846
|
+
case "string":
|
|
847
|
+
return "template";
|
|
848
|
+
case "md":
|
|
849
|
+
return "vue-markdown";
|
|
850
|
+
case "component":
|
|
851
|
+
return this.text.value.componentName;
|
|
852
|
+
default:
|
|
853
|
+
return "template";
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
get componentBindings() {
|
|
857
|
+
switch (this.textType.value) {
|
|
858
|
+
case "string":
|
|
859
|
+
return {};
|
|
860
|
+
case "md":
|
|
861
|
+
return { source: this.text };
|
|
862
|
+
case "component":
|
|
863
|
+
return this.text.value.componentProps;
|
|
864
|
+
default:
|
|
865
|
+
return {};
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
get componentBody() {
|
|
869
|
+
switch (this.textType.value) {
|
|
870
|
+
case "string":
|
|
871
|
+
return this.text.value;
|
|
872
|
+
default:
|
|
873
|
+
return "";
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
function m(n) {
|
|
878
|
+
return Ot().useMarkdownInValidators ? new J(n) : n.replace(/[*_~`]/g, "").replace(/\[.*?\]\((.*?)\)/g, "$1").replace(/!\[.*?\]\((.*?)\)/g, "").replace(/#+\s?/g, "").replace(/>\s?/g, "").replace(/(\*|-|\d+\.)\s+/g, "").replace(/`{3}[\s\S]*?`{3}/g, "").replace(/`([^`]+)`/g, "$1").replace(/\n{2,}/g, `
|
|
879
|
+
`);
|
|
880
|
+
}
|
|
881
|
+
const Ut = Symbol("Validator");
|
|
882
|
+
class v extends g {
|
|
883
|
+
/**
|
|
884
|
+
* Creates a new validator
|
|
885
|
+
* @param validationFn Function that validates the field value and returns errors or null
|
|
886
|
+
*/
|
|
887
|
+
constructor(t) {
|
|
888
|
+
super((s, r, a, l) => u(this, null, function* () {
|
|
889
|
+
const c = t(a, l, s) || [];
|
|
890
|
+
c.forEach(
|
|
891
|
+
(o) => Object.defineProperty(o, "source", { value: this.source, enumerable: !1, configurable: !1 })
|
|
892
|
+
);
|
|
893
|
+
for (let o = s.errors.length - 1; o >= 0; o--) {
|
|
894
|
+
const I = s.errors[o];
|
|
895
|
+
if (I.source === this.source) {
|
|
896
|
+
const P = c.findIndex((ht) => B(ht, I));
|
|
897
|
+
P >= 0 ? c.splice(P, 1) : s.errors.splice(o, 1);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
return c.length > 0 && s.errors.push(...c), s.validate(), r(s, a, l);
|
|
901
|
+
}));
|
|
902
|
+
h(this, "source");
|
|
903
|
+
this.source = Symbol(this.constructor.name);
|
|
904
|
+
}
|
|
905
|
+
// eslint-disable-next-line class-methods-use-this
|
|
906
|
+
static get classIdentifier() {
|
|
907
|
+
return Ut;
|
|
908
|
+
}
|
|
909
|
+
// eslint-disable-next-line class-methods-use-this
|
|
910
|
+
get eager() {
|
|
911
|
+
return !0;
|
|
912
|
+
}
|
|
913
|
+
// eslint-disable-next-line class-methods-use-this
|
|
914
|
+
replacePlaceholders(t, e) {
|
|
915
|
+
if (K(t)) return t;
|
|
916
|
+
let s = t;
|
|
917
|
+
return Object.keys(e).forEach((r) => {
|
|
918
|
+
s = s.replaceAll(`{${r}}`, e[r]);
|
|
919
|
+
}), s;
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
class Dt extends v {
|
|
923
|
+
constructor(i, t) {
|
|
924
|
+
const e = t || m("Must be one of [**{allowedAsText}**]");
|
|
925
|
+
let s = i.join(", ");
|
|
926
|
+
s.length > 60 && (s = yt(s, {
|
|
927
|
+
length: 40,
|
|
928
|
+
separator: ", ",
|
|
929
|
+
omission: `... (${i.length} items total)`
|
|
930
|
+
}));
|
|
931
|
+
const r = (a, l, c) => i.includes(S(a)) ? null : [
|
|
932
|
+
new y(
|
|
933
|
+
this.replacePlaceholders(e, { newValue: a, oldValue: l, field: c, allowedValues: i, allowedAsText: s })
|
|
934
|
+
)
|
|
935
|
+
];
|
|
936
|
+
super(r);
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
function Bt(n) {
|
|
940
|
+
return n == null ? 0 : rt(n) || _(n) ? n.length : at(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
|
|
941
|
+
}
|
|
942
|
+
class $t extends v {
|
|
943
|
+
constructor(i) {
|
|
944
|
+
const t = i || m("Please enter a value"), e = (s, r, a) => Bt(S(s)) === 0 ? [new y(
|
|
945
|
+
this.replacePlaceholders(t, { newValue: s, oldValue: r, field: a })
|
|
946
|
+
)] : null;
|
|
947
|
+
super(e);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
class kt extends v {
|
|
951
|
+
constructor(i, t) {
|
|
952
|
+
const e = t || m("Value must be larger or equal to **{minValue}**"), s = (r, a, l) => r < i ? [
|
|
953
|
+
new y(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, minValue: i }))
|
|
954
|
+
] : null;
|
|
955
|
+
super(s);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
class qt extends v {
|
|
959
|
+
constructor(i, t) {
|
|
960
|
+
const e = t || m("Value must be less than or equal to **{maxValue}**"), s = (r, a, l) => r > i ? [
|
|
961
|
+
new y(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, maxValue: i }))
|
|
962
|
+
] : null;
|
|
963
|
+
super(s);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
class Mt extends v {
|
|
967
|
+
constructor(i, t, e) {
|
|
968
|
+
const s = e || m("Value must be between **{minValue}** and **{maxValue}**"), r = (a, l, c) => a < i || a > t ? [
|
|
969
|
+
new y(
|
|
970
|
+
this.replacePlaceholders(s, { newValue: a, oldValue: l, field: c, minValue: i, maxValue: t })
|
|
971
|
+
)
|
|
972
|
+
] : null;
|
|
973
|
+
super(r);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
function Z(n) {
|
|
977
|
+
return n == null ? 0 : rt(n) || _(n) ? n.length : at(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
|
|
978
|
+
}
|
|
979
|
+
class Qt extends v {
|
|
980
|
+
constructor(i, t) {
|
|
981
|
+
const e = t || m("Length must be larger or equal to **{minLength}**"), s = (r, a, l) => Z(r) < i ? [
|
|
982
|
+
new y(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, minLength: i }))
|
|
983
|
+
] : null;
|
|
984
|
+
super(s);
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
class zt extends v {
|
|
988
|
+
constructor(i, t) {
|
|
989
|
+
const e = t || m("Length must be less than or equal to **{maxLength}**"), s = (r, a, l) => Z(r) > i ? [
|
|
990
|
+
new y(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, maxLength: i }))
|
|
991
|
+
] : null;
|
|
992
|
+
super(s);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
class Ht extends v {
|
|
996
|
+
constructor(i, t, e) {
|
|
997
|
+
const s = e || m("Length must be between **{minLength}** and **{maxLength}**"), r = (a, l, c) => {
|
|
998
|
+
const o = Z(a);
|
|
999
|
+
return o < i || o > t ? [
|
|
1000
|
+
new y(
|
|
1001
|
+
this.replacePlaceholders(s, { newValue: a, oldValue: l, field: c, minLength: i, maxLength: t })
|
|
1002
|
+
)
|
|
1003
|
+
] : null;
|
|
1004
|
+
};
|
|
1005
|
+
super(r);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
class Xt extends v {
|
|
1009
|
+
constructor(i, t) {
|
|
1010
|
+
const e = t || m('Value must match pattern "**{pattern}**"'), s = (r, a, l) => i.test(String(S(r))) ? null : [
|
|
1011
|
+
new y(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, pattern: i }))
|
|
1012
|
+
];
|
|
1013
|
+
super(s);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
const Gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1017
|
+
__proto__: null,
|
|
1018
|
+
InAllowedValues: Dt,
|
|
1019
|
+
LengthInRange: Ht,
|
|
1020
|
+
MaxLength: zt,
|
|
1021
|
+
MaxValue: qt,
|
|
1022
|
+
MinLength: Qt,
|
|
1023
|
+
MinValue: kt,
|
|
1024
|
+
Pattern: Xt,
|
|
1025
|
+
Required: $t,
|
|
1026
|
+
ValueInRange: Mt
|
|
1027
|
+
}, Symbol.toStringTag, { value: "Module" })), Zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
576
1028
|
__proto__: null,
|
|
577
|
-
AbortEventHandlingException:
|
|
578
|
-
Action:
|
|
579
|
-
ActionsMap:
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
1029
|
+
AbortEventHandlingException: G,
|
|
1030
|
+
Action: D,
|
|
1031
|
+
ActionsMap: ut,
|
|
1032
|
+
ConditionalEnabledAction: It,
|
|
1033
|
+
ConditionalStatementAction: $,
|
|
1034
|
+
ConditionalValueAction: _t,
|
|
1035
|
+
ConditionalVisibilityAction: Et,
|
|
1036
|
+
DisplayMode: x,
|
|
1037
|
+
EmptyField: wt,
|
|
1038
|
+
EnabledChangedAction: F,
|
|
1039
|
+
EnabledChangingAction: k,
|
|
1040
|
+
ExecuteAction: Q,
|
|
1041
|
+
Field: C,
|
|
1042
|
+
FieldActionBase: d,
|
|
587
1043
|
FieldBase: p,
|
|
588
|
-
Group:
|
|
589
|
-
List:
|
|
590
|
-
ListItemAddedAction:
|
|
591
|
-
ListItemRemovedAction:
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
1044
|
+
Group: E,
|
|
1045
|
+
List: W,
|
|
1046
|
+
ListItemAddedAction: O,
|
|
1047
|
+
ListItemRemovedAction: z,
|
|
1048
|
+
MdString: J,
|
|
1049
|
+
Operator: f,
|
|
1050
|
+
Statement: j,
|
|
1051
|
+
ValidChangedAction: q,
|
|
1052
|
+
ValidationError: Y,
|
|
1053
|
+
ValidationErrorRenderContent: y,
|
|
1054
|
+
ValidationErrorText: Rt,
|
|
1055
|
+
Validator: v,
|
|
1056
|
+
Validators: Gt,
|
|
595
1057
|
ValueChangedAction: g,
|
|
596
|
-
VisibilityChangedAction:
|
|
597
|
-
VisibilityChangingAction:
|
|
1058
|
+
VisibilityChangedAction: w,
|
|
1059
|
+
VisibilityChangingAction: M,
|
|
1060
|
+
buildErrorMessage: m,
|
|
1061
|
+
isCustomModalContentComponentDef: K
|
|
598
1062
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
599
1063
|
export {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
1064
|
+
G as AbortEventHandlingException,
|
|
1065
|
+
D as Action,
|
|
1066
|
+
ut as ActionsMap,
|
|
1067
|
+
It as ConditionalEnabledAction,
|
|
1068
|
+
$ as ConditionalStatementAction,
|
|
1069
|
+
_t as ConditionalValueAction,
|
|
1070
|
+
Et as ConditionalVisibilityAction,
|
|
1071
|
+
x as DisplayMode,
|
|
1072
|
+
wt as EmptyField,
|
|
1073
|
+
F as EnabledChangedAction,
|
|
1074
|
+
k as EnabledChangingAction,
|
|
1075
|
+
Q as ExecuteAction,
|
|
1076
|
+
C as Field,
|
|
1077
|
+
d as FieldActionBase,
|
|
610
1078
|
p as FieldBase,
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
1079
|
+
E as Group,
|
|
1080
|
+
W as List,
|
|
1081
|
+
O as ListItemAddedAction,
|
|
1082
|
+
z as ListItemRemovedAction,
|
|
1083
|
+
J as MdString,
|
|
1084
|
+
f as Operator,
|
|
1085
|
+
j as Statement,
|
|
1086
|
+
q as ValidChangedAction,
|
|
1087
|
+
Y as ValidationError,
|
|
1088
|
+
y as ValidationErrorRenderContent,
|
|
1089
|
+
Rt as ValidationErrorText,
|
|
1090
|
+
v as Validator,
|
|
1091
|
+
Gt as Validators,
|
|
618
1092
|
g as ValueChangedAction,
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
1093
|
+
w as VisibilityChangedAction,
|
|
1094
|
+
M as VisibilityChangingAction,
|
|
1095
|
+
m as buildErrorMessage,
|
|
1096
|
+
Zt as default,
|
|
1097
|
+
Yt as forms,
|
|
1098
|
+
K as isCustomModalContentComponentDef
|
|
622
1099
|
};
|
|
623
1100
|
//# sourceMappingURL=dynamicforms-vue-forms.js.map
|