@dynamicforms/vue-forms 0.1.1 → 0.1.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.
|
@@ -1,59 +1,104 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
1
|
+
var J = Object.defineProperty, K = Object.defineProperties;
|
|
2
|
+
var Q = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var S = Object.getOwnPropertySymbols, X = Object.getPrototypeOf, R = Object.prototype.hasOwnProperty, z = Object.prototype.propertyIsEnumerable, Y = Reflect.get;
|
|
4
|
+
var L = (n, i, t) => i in n ? J(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t, _ = (n, i) => {
|
|
5
5
|
for (var t in i || (i = {}))
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
for (var t of
|
|
9
|
-
|
|
6
|
+
R.call(i, t) && L(n, t, i[t]);
|
|
7
|
+
if (S)
|
|
8
|
+
for (var t of S(i))
|
|
9
|
+
z.call(i, t) && L(n, t, i[t]);
|
|
10
10
|
return n;
|
|
11
|
-
},
|
|
11
|
+
}, d = (n, i) => K(n, Q(i));
|
|
12
12
|
var v = (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
|
+
R.call(n, e) && i.indexOf(e) < 0 && (t[e] = n[e]);
|
|
16
|
+
if (n != null && S)
|
|
17
|
+
for (var e of S(n))
|
|
18
|
+
i.indexOf(e) < 0 && z.call(n, e) && (t[e] = n[e]);
|
|
19
19
|
return t;
|
|
20
20
|
};
|
|
21
|
-
var u = (n, i, t) =>
|
|
22
|
-
var
|
|
23
|
-
var
|
|
21
|
+
var u = (n, i, t) => L(n, typeof i != "symbol" ? i + "" : i, t);
|
|
22
|
+
var f = (n, i, t) => Y(X(n), t, i);
|
|
23
|
+
var r = (n, i, t) => new Promise((e, s) => {
|
|
24
24
|
var l = (h) => {
|
|
25
25
|
try {
|
|
26
|
-
|
|
27
|
-
} catch (
|
|
28
|
-
s(
|
|
26
|
+
c(t.next(h));
|
|
27
|
+
} catch (m) {
|
|
28
|
+
s(m);
|
|
29
29
|
}
|
|
30
30
|
}, a = (h) => {
|
|
31
31
|
try {
|
|
32
|
-
|
|
33
|
-
} catch (
|
|
34
|
-
s(
|
|
32
|
+
c(t.throw(h));
|
|
33
|
+
} catch (m) {
|
|
34
|
+
s(m);
|
|
35
35
|
}
|
|
36
|
-
},
|
|
37
|
-
|
|
36
|
+
}, c = (h) => h.done ? e(h.value) : Promise.resolve(h.value).then(l, a);
|
|
37
|
+
c((t = t.apply(n, i)).next());
|
|
38
38
|
});
|
|
39
|
-
import {
|
|
40
|
-
import { isBoolean as
|
|
41
|
-
|
|
39
|
+
import { computed as Z, reactive as j } from "vue";
|
|
40
|
+
import { isBoolean as D, isEqual as B, isEmpty as T } from "lodash-es";
|
|
41
|
+
var V = /* @__PURE__ */ ((n) => (n[n.SUPPRESS = 1] = "SUPPRESS", n[n.HIDDEN = 5] = "HIDDEN", n[n.INVISIBLE = 8] = "INVISIBLE", n[n.FULL = 10] = "FULL", n))(V || {});
|
|
42
|
+
const U = 10;
|
|
43
|
+
((n) => {
|
|
44
|
+
function i(s) {
|
|
45
|
+
return s.toUpperCase() === "SUPPRESS" ? 1 : s.toUpperCase() === "HIDDEN" ? 5 : s.toUpperCase() === "INVISIBLE" ? 8 : U;
|
|
46
|
+
}
|
|
47
|
+
n.fromString = i;
|
|
48
|
+
function t(s) {
|
|
49
|
+
const l = typeof s == "number" ? s : n.fromString(s);
|
|
50
|
+
return Object.values(n).includes(l) ? l : U;
|
|
51
|
+
}
|
|
52
|
+
n.fromAny = t;
|
|
53
|
+
function e(s) {
|
|
54
|
+
const l = typeof s == "number" ? s : n.fromString(s);
|
|
55
|
+
return Object.values(n).includes(l);
|
|
56
|
+
}
|
|
57
|
+
n.isDefined = e;
|
|
58
|
+
})(V || (V = {}));
|
|
59
|
+
Object.freeze(V);
|
|
60
|
+
const x = V;
|
|
61
|
+
class q {
|
|
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 {
|
|
42
87
|
constructor(i) {
|
|
43
88
|
u(this, "executorFn");
|
|
44
89
|
this.executorFn = i;
|
|
45
90
|
}
|
|
46
91
|
execute(i, t, ...e) {
|
|
47
|
-
return
|
|
92
|
+
return r(this, null, function* () {
|
|
48
93
|
return this.executorFn(i, t, ...e);
|
|
49
94
|
});
|
|
50
95
|
}
|
|
51
96
|
}
|
|
52
|
-
class
|
|
97
|
+
class W extends Error {
|
|
53
98
|
}
|
|
54
|
-
class
|
|
99
|
+
class $ extends Map {
|
|
55
100
|
register(i) {
|
|
56
|
-
if (!(i instanceof
|
|
101
|
+
if (!(i instanceof o))
|
|
57
102
|
throw new Error("Invalid action type");
|
|
58
103
|
const t = i.classIdentifier, e = this.get(t) || (() => null);
|
|
59
104
|
function s(l, ...a) {
|
|
@@ -67,185 +112,166 @@ class Y extends Map {
|
|
|
67
112
|
try {
|
|
68
113
|
if (l) return l(t, ...e);
|
|
69
114
|
} catch (a) {
|
|
70
|
-
if (!(a instanceof
|
|
115
|
+
if (!(a instanceof W)) throw a;
|
|
71
116
|
}
|
|
72
117
|
return null;
|
|
73
118
|
}
|
|
74
119
|
}
|
|
75
|
-
const
|
|
76
|
-
class
|
|
120
|
+
const M = Symbol("EnabledChangingAction");
|
|
121
|
+
class O extends o {
|
|
77
122
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
78
123
|
constructor(i) {
|
|
79
124
|
super(i);
|
|
80
125
|
}
|
|
81
126
|
// eslint-disable-next-line class-methods-use-this
|
|
82
127
|
get classIdentifier() {
|
|
83
|
-
return
|
|
128
|
+
return M;
|
|
84
129
|
}
|
|
85
130
|
execute(i, t, e, s) {
|
|
86
|
-
return
|
|
87
|
-
return
|
|
131
|
+
return r(this, null, function* () {
|
|
132
|
+
return f(O.prototype, this, "execute").call(this, i, t, e, s);
|
|
88
133
|
});
|
|
89
134
|
}
|
|
90
135
|
}
|
|
91
|
-
const
|
|
92
|
-
class I extends
|
|
136
|
+
const tt = Symbol("EnabledChangedAction");
|
|
137
|
+
class I extends o {
|
|
93
138
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
94
139
|
constructor(i) {
|
|
95
140
|
super(i);
|
|
96
141
|
}
|
|
97
142
|
// eslint-disable-next-line class-methods-use-this
|
|
98
143
|
get classIdentifier() {
|
|
99
|
-
return
|
|
144
|
+
return tt;
|
|
100
145
|
}
|
|
101
146
|
execute(i, t, e, s) {
|
|
102
|
-
return
|
|
103
|
-
return
|
|
147
|
+
return r(this, null, function* () {
|
|
148
|
+
return f(I.prototype, this, "execute").call(this, i, t, e, s);
|
|
104
149
|
});
|
|
105
150
|
}
|
|
106
151
|
}
|
|
107
|
-
const
|
|
108
|
-
class
|
|
152
|
+
const et = Symbol("ExecuteAction");
|
|
153
|
+
class F extends o {
|
|
109
154
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
110
155
|
constructor(i) {
|
|
111
156
|
super(i);
|
|
112
157
|
}
|
|
113
158
|
// eslint-disable-next-line class-methods-use-this
|
|
114
159
|
get classIdentifier() {
|
|
115
|
-
return
|
|
160
|
+
return et;
|
|
116
161
|
}
|
|
117
162
|
execute(i, t, e) {
|
|
118
|
-
return
|
|
119
|
-
return
|
|
163
|
+
return r(this, null, function* () {
|
|
164
|
+
return f(F.prototype, this, "execute").call(this, i, t, e);
|
|
120
165
|
});
|
|
121
166
|
}
|
|
122
167
|
}
|
|
123
|
-
const
|
|
124
|
-
class
|
|
168
|
+
const it = Symbol("VisibilityChangingAction");
|
|
169
|
+
class P extends o {
|
|
125
170
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
126
171
|
constructor(i) {
|
|
127
172
|
super(i);
|
|
128
173
|
}
|
|
129
174
|
// eslint-disable-next-line class-methods-use-this
|
|
130
175
|
get classIdentifier() {
|
|
131
|
-
return
|
|
176
|
+
return it;
|
|
132
177
|
}
|
|
133
178
|
execute(i, t, e, s) {
|
|
134
|
-
return
|
|
135
|
-
return
|
|
179
|
+
return r(this, null, function* () {
|
|
180
|
+
return f(P.prototype, this, "execute").call(this, i, t, e, s);
|
|
136
181
|
});
|
|
137
182
|
}
|
|
138
183
|
}
|
|
139
|
-
const
|
|
140
|
-
class E extends
|
|
184
|
+
const st = Symbol("VisibilityChangedAction");
|
|
185
|
+
class E extends o {
|
|
141
186
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
142
187
|
constructor(i) {
|
|
143
188
|
super(i);
|
|
144
189
|
}
|
|
145
190
|
// eslint-disable-next-line class-methods-use-this
|
|
146
191
|
get classIdentifier() {
|
|
147
|
-
return
|
|
192
|
+
return st;
|
|
148
193
|
}
|
|
149
194
|
execute(i, t, e, s) {
|
|
150
|
-
return
|
|
151
|
-
return
|
|
195
|
+
return r(this, null, function* () {
|
|
196
|
+
return f(E.prototype, this, "execute").call(this, i, t, e, s);
|
|
152
197
|
});
|
|
153
198
|
}
|
|
154
199
|
}
|
|
155
|
-
const
|
|
156
|
-
class N extends
|
|
200
|
+
const nt = Symbol("ValidChangedAction");
|
|
201
|
+
class N extends o {
|
|
157
202
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
158
203
|
constructor(i) {
|
|
159
204
|
super(i);
|
|
160
205
|
}
|
|
161
206
|
// eslint-disable-next-line class-methods-use-this
|
|
162
207
|
get classIdentifier() {
|
|
163
|
-
return
|
|
208
|
+
return nt;
|
|
164
209
|
}
|
|
165
210
|
execute(i, t, e, s) {
|
|
166
|
-
return
|
|
167
|
-
return
|
|
211
|
+
return r(this, null, function* () {
|
|
212
|
+
return f(N.prototype, this, "execute").call(this, i, t, e, s);
|
|
168
213
|
});
|
|
169
214
|
}
|
|
170
215
|
}
|
|
171
|
-
const
|
|
172
|
-
class g extends
|
|
216
|
+
const lt = Symbol("ValueChangedAction");
|
|
217
|
+
class g extends o {
|
|
173
218
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
174
219
|
constructor(i) {
|
|
175
220
|
super(i);
|
|
176
221
|
}
|
|
177
222
|
// eslint-disable-next-line class-methods-use-this
|
|
178
223
|
get classIdentifier() {
|
|
179
|
-
return
|
|
224
|
+
return lt;
|
|
180
225
|
}
|
|
181
226
|
execute(i, t, e, s) {
|
|
182
|
-
return
|
|
183
|
-
return
|
|
227
|
+
return r(this, null, function* () {
|
|
228
|
+
return f(g.prototype, this, "execute").call(this, i, t, e, s);
|
|
184
229
|
});
|
|
185
230
|
}
|
|
186
231
|
}
|
|
187
|
-
const
|
|
188
|
-
class C extends
|
|
232
|
+
const at = Symbol("ListItemAddedAction");
|
|
233
|
+
class C extends o {
|
|
189
234
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
190
235
|
constructor(i) {
|
|
191
236
|
super(i);
|
|
192
237
|
}
|
|
193
238
|
// eslint-disable-next-line class-methods-use-this
|
|
194
239
|
get classIdentifier() {
|
|
195
|
-
return
|
|
240
|
+
return at;
|
|
196
241
|
}
|
|
197
242
|
execute(i, t, e, s) {
|
|
198
|
-
return
|
|
199
|
-
return
|
|
243
|
+
return r(this, null, function* () {
|
|
244
|
+
return f(C.prototype, this, "execute").call(this, i, t, e, s);
|
|
200
245
|
});
|
|
201
246
|
}
|
|
202
247
|
}
|
|
203
|
-
const
|
|
204
|
-
class
|
|
248
|
+
const ut = Symbol("ListItemRemovedAction");
|
|
249
|
+
class w extends o {
|
|
205
250
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
206
251
|
constructor(i) {
|
|
207
252
|
super(i);
|
|
208
253
|
}
|
|
209
254
|
// eslint-disable-next-line class-methods-use-this
|
|
210
255
|
get classIdentifier() {
|
|
211
|
-
return
|
|
256
|
+
return ut;
|
|
212
257
|
}
|
|
213
258
|
execute(i, t, e, s) {
|
|
214
|
-
return
|
|
215
|
-
return
|
|
259
|
+
return r(this, null, function* () {
|
|
260
|
+
return f(w.prototype, this, "execute").call(this, i, t, e, s);
|
|
216
261
|
});
|
|
217
262
|
}
|
|
218
263
|
}
|
|
219
|
-
|
|
220
|
-
const R = 10;
|
|
221
|
-
((n) => {
|
|
222
|
-
function i(s) {
|
|
223
|
-
return s.toUpperCase() === "SUPPRESS" ? 1 : s.toUpperCase() === "HIDDEN" ? 5 : s.toUpperCase() === "INVISIBLE" ? 8 : R;
|
|
224
|
-
}
|
|
225
|
-
n.fromString = i;
|
|
226
|
-
function t(s) {
|
|
227
|
-
const l = typeof s == "number" ? s : n.fromString(s);
|
|
228
|
-
return Object.values(n).includes(l) ? l : R;
|
|
229
|
-
}
|
|
230
|
-
n.fromAny = t;
|
|
231
|
-
function e(s) {
|
|
232
|
-
const l = typeof s == "number" ? s : n.fromString(s);
|
|
233
|
-
return Object.values(n).includes(l);
|
|
234
|
-
}
|
|
235
|
-
n.isDefined = e;
|
|
236
|
-
})(d || (d = {}));
|
|
237
|
-
Object.freeze(d);
|
|
238
|
-
const V = d;
|
|
239
|
-
class y {
|
|
264
|
+
class p {
|
|
240
265
|
constructor() {
|
|
266
|
+
u(this, "reactiveValue", Z(() => this.value));
|
|
241
267
|
// contains original field value as was provided at creation
|
|
242
268
|
u(this, "valid", !0);
|
|
243
269
|
// is current value valid as per FE and BE validators?
|
|
244
270
|
u(this, "errors", []);
|
|
245
271
|
// when member of a Group, fieldName specifies the name of this field
|
|
246
|
-
u(this, "actions", new
|
|
272
|
+
u(this, "actions", new $());
|
|
247
273
|
// default property handlers
|
|
248
|
-
u(this, "_visibility",
|
|
274
|
+
u(this, "_visibility", x.FULL);
|
|
249
275
|
u(this, "_enabled", !0);
|
|
250
276
|
}
|
|
251
277
|
get visibility() {
|
|
@@ -253,14 +279,14 @@ class y {
|
|
|
253
279
|
}
|
|
254
280
|
set visibility(i) {
|
|
255
281
|
const t = this._visibility;
|
|
256
|
-
if (!
|
|
257
|
-
this._visibility =
|
|
282
|
+
if (!x.isDefined(i)) throw new Error("visibility must be a DisplayMode constant");
|
|
283
|
+
this._visibility = x.fromAny(i), this.actions.trigger(E, this, this._visibility, t);
|
|
258
284
|
}
|
|
259
285
|
setVisibility(i) {
|
|
260
|
-
return
|
|
261
|
-
const t = this._visibility, e = yield this.actions.trigger(
|
|
262
|
-
if (!
|
|
263
|
-
this._visibility =
|
|
286
|
+
return r(this, null, function* () {
|
|
287
|
+
const t = this._visibility, e = yield this.actions.trigger(P, this, i, t);
|
|
288
|
+
if (!x.isDefined(e != null ? e : i)) throw new Error("visibility must be a DisplayMode constant");
|
|
289
|
+
this._visibility = x.fromAny(e != null ? e : i), this.actions.trigger(E, this, this._visibility, t);
|
|
264
290
|
});
|
|
265
291
|
}
|
|
266
292
|
get enabled() {
|
|
@@ -268,13 +294,13 @@ class y {
|
|
|
268
294
|
}
|
|
269
295
|
set enabled(i) {
|
|
270
296
|
const t = this._enabled;
|
|
271
|
-
if (!
|
|
297
|
+
if (!D(i)) throw new Error("Enabled value must be boolean");
|
|
272
298
|
this._enabled = i, this.actions.trigger(I, this, this._enabled, t);
|
|
273
299
|
}
|
|
274
300
|
setEnabled(i) {
|
|
275
|
-
return
|
|
276
|
-
const t = this._enabled, e = yield this.actions.trigger(
|
|
277
|
-
if (!
|
|
301
|
+
return r(this, null, function* () {
|
|
302
|
+
const t = this._enabled, e = yield this.actions.trigger(O, this, i, t);
|
|
303
|
+
if (!D(e != null ? e : i)) throw new Error("Enabled value must be boolean");
|
|
278
304
|
this._enabled = e != null ? e : i, this.actions.trigger(I, this, this._enabled, t);
|
|
279
305
|
});
|
|
280
306
|
}
|
|
@@ -286,10 +312,7 @@ class y {
|
|
|
286
312
|
return this.value;
|
|
287
313
|
}
|
|
288
314
|
get isChanged() {
|
|
289
|
-
return !
|
|
290
|
-
}
|
|
291
|
-
get reactive() {
|
|
292
|
-
return A(this);
|
|
315
|
+
return !B(this.value, this.originalValue);
|
|
293
316
|
}
|
|
294
317
|
registerAction(i) {
|
|
295
318
|
return this.actions.register(i), this;
|
|
@@ -298,20 +321,23 @@ class y {
|
|
|
298
321
|
return this.actions.trigger(i, this, ...t);
|
|
299
322
|
}
|
|
300
323
|
}
|
|
301
|
-
function
|
|
324
|
+
function k(n, i) {
|
|
302
325
|
return (n == null ? void 0 : n.label) == null && (n == null ? void 0 : n.icon) == null ? i : n;
|
|
303
326
|
}
|
|
304
|
-
class
|
|
327
|
+
class A extends p {
|
|
305
328
|
constructor(t) {
|
|
306
329
|
super();
|
|
307
330
|
u(this, "_value");
|
|
308
331
|
if (t) {
|
|
309
332
|
const e = t, { value: s, originalValue: l } = e, a = v(e, ["value", "originalValue"]);
|
|
310
333
|
Object.assign(this, a);
|
|
311
|
-
const
|
|
312
|
-
this._value =
|
|
334
|
+
const c = { label: s == null ? void 0 : s.label, icon: s == null ? void 0 : s.icon }, h = Object.freeze({ label: l == null ? void 0 : l.label, icon: l == null ? void 0 : l.icon });
|
|
335
|
+
this._value = j(k(c, h)), this.originalValue = k(h, c);
|
|
313
336
|
} else
|
|
314
|
-
this._value =
|
|
337
|
+
this._value = j({ label: void 0, icon: void 0 });
|
|
338
|
+
}
|
|
339
|
+
static create(t) {
|
|
340
|
+
return j(new A(t));
|
|
315
341
|
}
|
|
316
342
|
get value() {
|
|
317
343
|
return this._value;
|
|
@@ -335,7 +361,7 @@ class k extends y {
|
|
|
335
361
|
}
|
|
336
362
|
clone(t) {
|
|
337
363
|
var e, s, l, a;
|
|
338
|
-
return new
|
|
364
|
+
return new A(d(_({
|
|
339
365
|
value: (e = t == null ? void 0 : t.value) != null ? e : this.value
|
|
340
366
|
}, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
|
|
341
367
|
errors: [...(s = t == null ? void 0 : t.errors) != null ? s : this.errors],
|
|
@@ -344,10 +370,10 @@ class k extends y {
|
|
|
344
370
|
}));
|
|
345
371
|
}
|
|
346
372
|
execute(t) {
|
|
347
|
-
this.actions.trigger(
|
|
373
|
+
this.actions.trigger(F, this, t);
|
|
348
374
|
}
|
|
349
375
|
}
|
|
350
|
-
class
|
|
376
|
+
class y extends p {
|
|
351
377
|
constructor(t) {
|
|
352
378
|
super();
|
|
353
379
|
u(this, "_value");
|
|
@@ -356,6 +382,9 @@ class S extends y {
|
|
|
356
382
|
Object.assign(this, l), this._value = s != null ? s : this.originalValue, this.originalValue === void 0 && (this.originalValue = this._value);
|
|
357
383
|
}
|
|
358
384
|
}
|
|
385
|
+
static create(t) {
|
|
386
|
+
return j(new y(t));
|
|
387
|
+
}
|
|
359
388
|
get value() {
|
|
360
389
|
return this._value;
|
|
361
390
|
}
|
|
@@ -366,7 +395,7 @@ class S extends y {
|
|
|
366
395
|
}
|
|
367
396
|
clone(t) {
|
|
368
397
|
var e, s, l, a;
|
|
369
|
-
return
|
|
398
|
+
return y.create(d(_({
|
|
370
399
|
value: (e = t == null ? void 0 : t.value) != null ? e : this.value
|
|
371
400
|
}, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
|
|
372
401
|
errors: [...(s = t == null ? void 0 : t.errors) != null ? s : this.errors],
|
|
@@ -375,50 +404,44 @@ class S extends y {
|
|
|
375
404
|
}));
|
|
376
405
|
}
|
|
377
406
|
}
|
|
378
|
-
const
|
|
379
|
-
() =>
|
|
407
|
+
const rt = y.create({ value: "EmptyField" }).registerAction(new g(
|
|
408
|
+
() => r(void 0, null, function* () {
|
|
380
409
|
console.warn("Working with EmptyField! This should not happen");
|
|
381
410
|
})
|
|
382
411
|
));
|
|
383
|
-
class b extends
|
|
412
|
+
class b extends p {
|
|
384
413
|
constructor(t, e) {
|
|
385
414
|
super();
|
|
386
415
|
u(this, "_fields");
|
|
387
416
|
u(this, "_value", null);
|
|
388
|
-
u(this, "reactiveValue");
|
|
389
417
|
u(this, "suppressNotifyValueChanged", !1);
|
|
390
418
|
if (!b.isValidFields(t)) throw new Error("Invalid fields object provided");
|
|
391
419
|
if (this._fields = {}, Object.entries(t).forEach(([l, a]) => {
|
|
392
|
-
Object.defineProperty(a, "parent", { get: () => this, configurable: !1, enumerable: !1 }), Object.defineProperty(a, "fieldName", { get: () => l, configurable: !1, enumerable: !1 })
|
|
393
|
-
const r = a.reactive;
|
|
394
|
-
Object.defineProperty(
|
|
420
|
+
Object.defineProperty(a, "parent", { get: () => this, configurable: !1, enumerable: !1 }), Object.defineProperty(a, "fieldName", { get: () => l, configurable: !1, enumerable: !1 }), Object.defineProperty(
|
|
395
421
|
this._fields,
|
|
396
422
|
l,
|
|
397
423
|
{ get() {
|
|
398
|
-
return
|
|
424
|
+
return a;
|
|
399
425
|
}, configurable: !1, enumerable: !0 }
|
|
400
426
|
);
|
|
401
427
|
}), e) {
|
|
402
428
|
const s = e, { value: l } = s, a = v(s, ["value"]);
|
|
403
429
|
Object.assign(this, a), this.value = l != null ? l : this.originalValue;
|
|
404
430
|
}
|
|
405
|
-
this.originalValue === void 0 && (this.originalValue = this.value)
|
|
406
|
-
}
|
|
407
|
-
get reactive() {
|
|
408
|
-
return this;
|
|
431
|
+
this.originalValue === void 0 && (this.originalValue = this.value);
|
|
409
432
|
}
|
|
410
433
|
static isValidFields(t) {
|
|
411
434
|
function e(s) {
|
|
412
|
-
return s instanceof
|
|
435
|
+
return s instanceof p;
|
|
413
436
|
}
|
|
414
437
|
return typeof t == "object" && t !== null && Object.entries(t).every(([, s]) => e(s));
|
|
415
438
|
}
|
|
416
439
|
static createFromFormData(t) {
|
|
417
|
-
if (t instanceof
|
|
440
|
+
if (t instanceof p)
|
|
418
441
|
throw new Error("data is already a Form structure, should be a simple object");
|
|
419
442
|
return new b(
|
|
420
443
|
t == null ? {} : Object.fromEntries(
|
|
421
|
-
Object.entries(t).map(([e, s]) => [e,
|
|
444
|
+
Object.entries(t).map(([e, s]) => [e, y.create({ value: s })])
|
|
422
445
|
)
|
|
423
446
|
);
|
|
424
447
|
}
|
|
@@ -433,8 +456,8 @@ class b extends y {
|
|
|
433
456
|
const t = {};
|
|
434
457
|
return Object.entries(this._fields).forEach(([e, s]) => {
|
|
435
458
|
const l = s.value;
|
|
436
|
-
(s.enabled || s instanceof b && !
|
|
437
|
-
}),
|
|
459
|
+
(s.enabled || s instanceof b && !T(l)) && (t[e] = l);
|
|
460
|
+
}), T(t) ? null : t;
|
|
438
461
|
}
|
|
439
462
|
set value(t) {
|
|
440
463
|
this.suppressNotifyValueChanged = !0;
|
|
@@ -456,26 +479,26 @@ class b extends y {
|
|
|
456
479
|
notifyValueChanged() {
|
|
457
480
|
if (this.suppressNotifyValueChanged) return;
|
|
458
481
|
const t = this.value;
|
|
459
|
-
if (!
|
|
482
|
+
if (!B(t, this._value)) {
|
|
460
483
|
const e = this._value;
|
|
461
484
|
this._value = t, this.actions.trigger(g, this, t, e), this.parent && this.parent.notifyValueChanged();
|
|
462
485
|
}
|
|
463
486
|
}
|
|
464
487
|
clone(t) {
|
|
465
|
-
var s, l, a,
|
|
488
|
+
var s, l, a, c;
|
|
466
489
|
const e = {};
|
|
467
|
-
return Object.entries(this._fields).forEach(([h,
|
|
468
|
-
e[h] =
|
|
469
|
-
}), new b(e, _(
|
|
490
|
+
return Object.entries(this._fields).forEach(([h, m]) => {
|
|
491
|
+
e[h] = m.clone();
|
|
492
|
+
}), new b(e, d(_({
|
|
470
493
|
value: (s = t == null ? void 0 : t.value) != null ? s : this.value
|
|
471
494
|
}, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
|
|
472
495
|
errors: [...(l = t == null ? void 0 : t.errors) != null ? l : []],
|
|
473
496
|
enabled: (a = t == null ? void 0 : t.enabled) != null ? a : this.enabled,
|
|
474
|
-
visibility: (
|
|
497
|
+
visibility: (c = t == null ? void 0 : t.visibility) != null ? c : this.visibility
|
|
475
498
|
}));
|
|
476
499
|
}
|
|
477
500
|
}
|
|
478
|
-
class
|
|
501
|
+
class H extends p {
|
|
479
502
|
constructor(t, e) {
|
|
480
503
|
super();
|
|
481
504
|
u(this, "_value", null);
|
|
@@ -487,9 +510,6 @@ class z extends y {
|
|
|
487
510
|
}
|
|
488
511
|
this.originalValue === void 0 && (this.originalValue = this.value), this._previousValue = this.value;
|
|
489
512
|
}
|
|
490
|
-
get reactive() {
|
|
491
|
-
return this;
|
|
492
|
-
}
|
|
493
513
|
processSetValueItem(t) {
|
|
494
514
|
let e;
|
|
495
515
|
return t instanceof b ? e = t : this._itemTemplate ? e = this._itemTemplate.clone({ value: t }) : e = b.createFromFormData(t), Object.defineProperty(e, "parent", { get: () => this, configurable: !1, enumerable: !1 }), e;
|
|
@@ -500,25 +520,25 @@ class z extends y {
|
|
|
500
520
|
get value() {
|
|
501
521
|
var e;
|
|
502
522
|
const t = (e = this._value) == null ? void 0 : e.map((s) => s.value);
|
|
503
|
-
return
|
|
523
|
+
return T(t) ? null : t;
|
|
504
524
|
}
|
|
505
525
|
set value(t) {
|
|
506
526
|
const e = this.value;
|
|
507
527
|
this.setValue(t), this.actions.trigger(g, this, this.value, e), this.parent && this.parent.notifyValueChanged();
|
|
508
528
|
}
|
|
509
529
|
clone(t) {
|
|
510
|
-
var e, s, l, a,
|
|
511
|
-
return new
|
|
530
|
+
var e, s, l, a, c;
|
|
531
|
+
return new H((e = this._itemTemplate) == null ? void 0 : e.clone(), d(_({
|
|
512
532
|
value: [...(s = t == null ? void 0 : t.value) != null ? s : this.value]
|
|
513
533
|
}, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
|
|
514
534
|
errors: [...(l = t == null ? void 0 : t.errors) != null ? l : []],
|
|
515
535
|
enabled: (a = t == null ? void 0 : t.enabled) != null ? a : this.enabled,
|
|
516
|
-
visibility: (
|
|
536
|
+
visibility: (c = t == null ? void 0 : t.visibility) != null ? c : this.visibility
|
|
517
537
|
}));
|
|
518
538
|
}
|
|
519
539
|
notifyValueChanged() {
|
|
520
540
|
const t = this.value;
|
|
521
|
-
if (!
|
|
541
|
+
if (!B(t, this._previousValue)) {
|
|
522
542
|
const e = this._previousValue;
|
|
523
543
|
this._previousValue = t, this.actions.trigger(g, this, t, e), this.parent && this.parent.notifyValueChanged();
|
|
524
544
|
}
|
|
@@ -538,7 +558,7 @@ class z extends y {
|
|
|
538
558
|
var s;
|
|
539
559
|
if (this._value == null || t < 0 || this._value.length <= t) return;
|
|
540
560
|
let e = (s = this._value.splice(t, 1)) == null ? void 0 : s[0];
|
|
541
|
-
return e && (e = e.clone(), this.actions.trigger(
|
|
561
|
+
return e && (e = e.clone(), this.actions.trigger(w, this, e, t), this.notifyValueChanged()), e;
|
|
542
562
|
}
|
|
543
563
|
insert(t, e) {
|
|
544
564
|
for (this._value == null && (this._value = []); this._value.length < e; ) {
|
|
@@ -552,23 +572,50 @@ class z extends y {
|
|
|
552
572
|
this._value = null, this.notifyValueChanged();
|
|
553
573
|
}
|
|
554
574
|
}
|
|
575
|
+
const ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
576
|
+
__proto__: null,
|
|
577
|
+
AbortEventHandlingException: W,
|
|
578
|
+
Action: A,
|
|
579
|
+
ActionsMap: $,
|
|
580
|
+
EmptyField: rt,
|
|
581
|
+
EnabledChangedAction: I,
|
|
582
|
+
EnabledChangingAction: O,
|
|
583
|
+
ExecuteAction: F,
|
|
584
|
+
Field: y,
|
|
585
|
+
FieldActionBase: o,
|
|
586
|
+
Group: b,
|
|
587
|
+
List: H,
|
|
588
|
+
ListItemAddedAction: C,
|
|
589
|
+
ListItemRemovedAction: w,
|
|
590
|
+
ValidChangedAction: N,
|
|
591
|
+
ValidationError: q,
|
|
592
|
+
ValidationErrorText: G,
|
|
593
|
+
ValueChangedAction: g,
|
|
594
|
+
VisibilityChangedAction: E,
|
|
595
|
+
VisibilityChangingAction: P,
|
|
596
|
+
defaultDisplayMode: U
|
|
597
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
555
598
|
export {
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
599
|
+
W as AbortEventHandlingException,
|
|
600
|
+
A as Action,
|
|
601
|
+
$ as ActionsMap,
|
|
602
|
+
rt as EmptyField,
|
|
560
603
|
I as EnabledChangedAction,
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
604
|
+
O as EnabledChangingAction,
|
|
605
|
+
F as ExecuteAction,
|
|
606
|
+
y as Field,
|
|
607
|
+
o as FieldActionBase,
|
|
565
608
|
b as Group,
|
|
566
|
-
|
|
609
|
+
H as List,
|
|
567
610
|
C as ListItemAddedAction,
|
|
568
|
-
|
|
611
|
+
w as ListItemRemovedAction,
|
|
569
612
|
N as ValidChangedAction,
|
|
613
|
+
q as ValidationError,
|
|
614
|
+
G as ValidationErrorText,
|
|
570
615
|
g as ValueChangedAction,
|
|
571
616
|
E as VisibilityChangedAction,
|
|
572
|
-
|
|
617
|
+
P as VisibilityChangingAction,
|
|
618
|
+
ft as default,
|
|
619
|
+
U as defaultDisplayMode
|
|
573
620
|
};
|
|
574
621
|
//# sourceMappingURL=dynamicforms-vue-forms.js.map
|