@dynamicforms/vue-forms 0.3.4 → 0.3.5
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,37 +1,37 @@
|
|
|
1
1
|
var ht = Object.defineProperty, gt = Object.defineProperties;
|
|
2
2
|
var dt = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var w = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
4
|
+
var J = Object.prototype.hasOwnProperty, K = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var B = (n, i, t) => i in n ? ht(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t, P = (n, i) => {
|
|
6
6
|
for (var t in i || (i = {}))
|
|
7
|
-
|
|
7
|
+
J.call(i, t) && B(n, t, i[t]);
|
|
8
8
|
if (w)
|
|
9
9
|
for (var t of w(i))
|
|
10
|
-
|
|
10
|
+
K.call(i, t) && B(n, t, i[t]);
|
|
11
11
|
return n;
|
|
12
12
|
}, O = (n, i) => gt(n, dt(i));
|
|
13
13
|
var I = (n, i) => {
|
|
14
14
|
var t = {};
|
|
15
15
|
for (var e in n)
|
|
16
|
-
|
|
16
|
+
J.call(n, e) && i.indexOf(e) < 0 && (t[e] = n[e]);
|
|
17
17
|
if (n != null && w)
|
|
18
18
|
for (var e of w(n))
|
|
19
|
-
i.indexOf(e) < 0 &&
|
|
19
|
+
i.indexOf(e) < 0 && K.call(n, e) && (t[e] = n[e]);
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
22
|
var o = (n, i, t) => B(n, typeof i != "symbol" ? i + "" : i, t);
|
|
23
|
-
import { isEqual as R, isBoolean as ft, isString as
|
|
24
|
-
import { unref as d, computed as
|
|
23
|
+
import { isEqual as R, isBoolean as ft, isString as V, isEmpty as q, truncate as pt, isArray as tt, isObject as et } from "lodash-es";
|
|
24
|
+
import { unref as d, computed as z, reactive as bt } from "vue";
|
|
25
25
|
var S = /* @__PURE__ */ ((n) => (n[n.SUPPRESS = 1] = "SUPPRESS", n[n.HIDDEN = 5] = "HIDDEN", n[n.INVISIBLE = 8] = "INVISIBLE", n[n.FULL = 10] = "FULL", n))(S || {});
|
|
26
|
-
const
|
|
26
|
+
const Y = 10;
|
|
27
27
|
((n) => {
|
|
28
28
|
function i(s) {
|
|
29
|
-
return s.toUpperCase() === "SUPPRESS" ? 1 : s.toUpperCase() === "HIDDEN" ? 5 : s.toUpperCase() === "INVISIBLE" ? 8 :
|
|
29
|
+
return s.toUpperCase() === "SUPPRESS" ? 1 : s.toUpperCase() === "HIDDEN" ? 5 : s.toUpperCase() === "INVISIBLE" ? 8 : Y;
|
|
30
30
|
}
|
|
31
31
|
n.fromString = i;
|
|
32
32
|
function t(s) {
|
|
33
33
|
const r = typeof s == "number" ? s : n.fromString(s);
|
|
34
|
-
return Object.values(n).includes(r) ? r :
|
|
34
|
+
return Object.values(n).includes(r) ? r : Y;
|
|
35
35
|
}
|
|
36
36
|
n.fromAny = t;
|
|
37
37
|
function e(s) {
|
|
@@ -41,7 +41,7 @@ const K = 10;
|
|
|
41
41
|
n.isDefined = e;
|
|
42
42
|
})(S || (S = {}));
|
|
43
43
|
Object.freeze(S);
|
|
44
|
-
const
|
|
44
|
+
const A = S;
|
|
45
45
|
class p {
|
|
46
46
|
constructor(i) {
|
|
47
47
|
o(this, "executorFn");
|
|
@@ -85,11 +85,11 @@ class v extends p {
|
|
|
85
85
|
}
|
|
86
86
|
class F extends String {
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function G(n) {
|
|
89
89
|
const i = d(n);
|
|
90
90
|
return typeof i == "object" && "componentName" in i;
|
|
91
91
|
}
|
|
92
|
-
class
|
|
92
|
+
class H {
|
|
93
93
|
get componentName() {
|
|
94
94
|
return "Comment";
|
|
95
95
|
}
|
|
@@ -103,7 +103,7 @@ class G {
|
|
|
103
103
|
}
|
|
104
104
|
// eslint-disable-line class-methods-use-this
|
|
105
105
|
}
|
|
106
|
-
class vt extends
|
|
106
|
+
class vt extends H {
|
|
107
107
|
constructor(t) {
|
|
108
108
|
super();
|
|
109
109
|
o(this, "text");
|
|
@@ -117,16 +117,16 @@ class vt extends G {
|
|
|
117
117
|
return this.text;
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
class b extends
|
|
120
|
+
class b extends H {
|
|
121
121
|
constructor(t) {
|
|
122
122
|
super();
|
|
123
123
|
o(this, "text");
|
|
124
124
|
o(this, "textType");
|
|
125
|
-
this.text = t, this.textType =
|
|
125
|
+
this.text = t, this.textType = z(() => this.getTextType);
|
|
126
126
|
}
|
|
127
127
|
get getTextType() {
|
|
128
128
|
const t = d(this.text);
|
|
129
|
-
return t ? t instanceof F ? "md" :
|
|
129
|
+
return t ? t instanceof F ? "md" : G(t) ? "component" : "string" : "string";
|
|
130
130
|
}
|
|
131
131
|
get componentName() {
|
|
132
132
|
switch (d(this.textType)) {
|
|
@@ -200,7 +200,7 @@ class f extends v {
|
|
|
200
200
|
}
|
|
201
201
|
// eslint-disable-next-line class-methods-use-this
|
|
202
202
|
replacePlaceholders(t, e) {
|
|
203
|
-
if (
|
|
203
|
+
if (G(t)) return t;
|
|
204
204
|
let s = t;
|
|
205
205
|
return Object.keys(e).forEach((r) => {
|
|
206
206
|
s = s.replaceAll(`{${r}}`, e[r]);
|
|
@@ -288,7 +288,7 @@ class U extends v {
|
|
|
288
288
|
class xt extends U {
|
|
289
289
|
constructor(i) {
|
|
290
290
|
super(i, (t, e) => {
|
|
291
|
-
t.visibility = e ?
|
|
291
|
+
t.visibility = e ? A.FULL : A.SUPPRESS;
|
|
292
292
|
});
|
|
293
293
|
}
|
|
294
294
|
}
|
|
@@ -299,7 +299,7 @@ class Et extends U {
|
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
|
-
class
|
|
302
|
+
class Vt extends U {
|
|
303
303
|
constructor(i, t) {
|
|
304
304
|
super(i, (e, s) => {
|
|
305
305
|
s && (e.value = t);
|
|
@@ -346,7 +346,7 @@ var L = /* @__PURE__ */ ((n) => (n[n.NOT = 0] = "NOT", n[n.OR = 1] = "OR", n[n.A
|
|
|
346
346
|
n.isLogicOperator = s;
|
|
347
347
|
})(L || (L = {}));
|
|
348
348
|
Object.freeze(L);
|
|
349
|
-
const g = L,
|
|
349
|
+
const g = L, At = Symbol("EnabledChangingAction");
|
|
350
350
|
class nt extends p {
|
|
351
351
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
352
352
|
constructor(i) {
|
|
@@ -354,7 +354,7 @@ class nt extends p {
|
|
|
354
354
|
}
|
|
355
355
|
// eslint-disable-next-line class-methods-use-this
|
|
356
356
|
static get classIdentifier() {
|
|
357
|
-
return
|
|
357
|
+
return At;
|
|
358
358
|
}
|
|
359
359
|
execute(i, t, e, s) {
|
|
360
360
|
return super.execute(i, t, e, s);
|
|
@@ -418,7 +418,7 @@ class lt extends p {
|
|
|
418
418
|
}
|
|
419
419
|
class y {
|
|
420
420
|
constructor() {
|
|
421
|
-
o(this, "reactiveValue",
|
|
421
|
+
o(this, "reactiveValue", z(() => this.value));
|
|
422
422
|
// contains original field value as was provided at creation
|
|
423
423
|
o(this, "validatingCount", 0);
|
|
424
424
|
o(this, "validating", !1);
|
|
@@ -428,7 +428,7 @@ class y {
|
|
|
428
428
|
// when member of a Group, fieldName specifies the name of this field
|
|
429
429
|
o(this, "actions", new N());
|
|
430
430
|
// default property handlers
|
|
431
|
-
o(this, "_visibility",
|
|
431
|
+
o(this, "_visibility", A.FULL);
|
|
432
432
|
o(this, "_enabled", !0);
|
|
433
433
|
}
|
|
434
434
|
get visibility() {
|
|
@@ -436,8 +436,8 @@ class y {
|
|
|
436
436
|
}
|
|
437
437
|
set visibility(i) {
|
|
438
438
|
const t = this._visibility, e = this.actions.trigger(at, this, i, t);
|
|
439
|
-
if (!
|
|
440
|
-
this._visibility =
|
|
439
|
+
if (!A.isDefined(e != null ? e : i)) throw new Error("visibility must be a DisplayMode constant");
|
|
440
|
+
this._visibility = A.fromAny(e != null ? e : i), this.actions.trigger(lt, this, this._visibility, t);
|
|
441
441
|
}
|
|
442
442
|
get enabled() {
|
|
443
443
|
return this._enabled;
|
|
@@ -520,9 +520,9 @@ class _ {
|
|
|
520
520
|
case g.NOT_IN:
|
|
521
521
|
return !((a = (r = t == null ? void 0 : t.includes) == null ? void 0 : r.call(t, i)) == null || a);
|
|
522
522
|
case g.INCLUDES:
|
|
523
|
-
return
|
|
523
|
+
return V(i) && V(t) && i.indexOf(t) >= 0;
|
|
524
524
|
case g.NOT_INCLUDES:
|
|
525
|
-
return !(
|
|
525
|
+
return !(V(i) && V(t) && i.indexOf(t) >= 0);
|
|
526
526
|
default:
|
|
527
527
|
throw new Error(`Operator not implemented ${this.operator}`);
|
|
528
528
|
}
|
|
@@ -581,12 +581,12 @@ class ct extends p {
|
|
|
581
581
|
return super.execute(i, t, e, s);
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
|
-
const
|
|
584
|
+
const Z = Symbol("FieldConstructorGuard");
|
|
585
585
|
class D extends y {
|
|
586
586
|
constructor(t) {
|
|
587
587
|
super();
|
|
588
588
|
o(this, "_value");
|
|
589
|
-
if (t !==
|
|
589
|
+
if (t !== Z) {
|
|
590
590
|
const e = this.constructor.name;
|
|
591
591
|
throw new TypeError(`Don't use constructor to instantiate ${e}. Use ${e}.create<T>`);
|
|
592
592
|
}
|
|
@@ -604,7 +604,7 @@ class D extends y {
|
|
|
604
604
|
* @returns Reactive Field instance
|
|
605
605
|
*/
|
|
606
606
|
static create(t) {
|
|
607
|
-
const e = bt(new this(
|
|
607
|
+
const e = bt(new this(Z));
|
|
608
608
|
return e.init(t), e;
|
|
609
609
|
}
|
|
610
610
|
get value() {
|
|
@@ -670,6 +670,7 @@ class E extends y {
|
|
|
670
670
|
super();
|
|
671
671
|
o(this, "_fields");
|
|
672
672
|
o(this, "_value", null);
|
|
673
|
+
o(this, "reactiveValue", z(() => this.value));
|
|
673
674
|
o(this, "suppressNotifyValueChanged", !1);
|
|
674
675
|
if (!E.isValidFields(t)) throw new Error("Invalid fields object provided");
|
|
675
676
|
if (this._fields = {}, Object.entries(t).forEach(([r, a]) => this.addField(r, a)), e) {
|
|
@@ -761,7 +762,7 @@ class E extends y {
|
|
|
761
762
|
return s.actions = this.actions.clone(), s.actions.triggerEager(s, s.value, s.originalValue), s;
|
|
762
763
|
}
|
|
763
764
|
}
|
|
764
|
-
class
|
|
765
|
+
class X extends y {
|
|
765
766
|
constructor(t, e) {
|
|
766
767
|
super();
|
|
767
768
|
o(this, "_value", null);
|
|
@@ -791,7 +792,7 @@ class H extends y {
|
|
|
791
792
|
}
|
|
792
793
|
clone(t) {
|
|
793
794
|
var s, r, a, l;
|
|
794
|
-
const e = new
|
|
795
|
+
const e = new X((s = this._itemTemplate) == null ? void 0 : s.clone(), O(P({
|
|
795
796
|
value: [...(r = t == null ? void 0 : t.value) != null ? r : this.value]
|
|
796
797
|
}, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
|
|
797
798
|
enabled: (a = t == null ? void 0 : t.enabled) != null ? a : this.enabled,
|
|
@@ -890,7 +891,7 @@ class Ut extends f {
|
|
|
890
891
|
}
|
|
891
892
|
}
|
|
892
893
|
function Dt(n) {
|
|
893
|
-
return n == null ? 0 :
|
|
894
|
+
return n == null ? 0 : tt(n) || V(n) ? n.length : et(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
|
|
894
895
|
}
|
|
895
896
|
class $t extends f {
|
|
896
897
|
constructor(i) {
|
|
@@ -926,12 +927,12 @@ class qt extends f {
|
|
|
926
927
|
super(r);
|
|
927
928
|
}
|
|
928
929
|
}
|
|
929
|
-
function
|
|
930
|
-
return n == null ? 0 :
|
|
930
|
+
function W(n) {
|
|
931
|
+
return n == null ? 0 : tt(n) || V(n) ? n.length : et(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
|
|
931
932
|
}
|
|
932
933
|
class Mt extends f {
|
|
933
934
|
constructor(i, t) {
|
|
934
|
-
const e = t || m("Length must be larger or equal to **{minLength}**"), s = (r, a, l) =>
|
|
935
|
+
const e = t || m("Length must be larger or equal to **{minLength}**"), s = (r, a, l) => W(r) < i ? [
|
|
935
936
|
new b(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, minLength: i }))
|
|
936
937
|
] : null;
|
|
937
938
|
super(s);
|
|
@@ -939,7 +940,7 @@ class Mt extends f {
|
|
|
939
940
|
}
|
|
940
941
|
class Qt extends f {
|
|
941
942
|
constructor(i, t) {
|
|
942
|
-
const e = t || m("Length must be less than or equal to **{maxLength}**"), s = (r, a, l) =>
|
|
943
|
+
const e = t || m("Length must be less than or equal to **{maxLength}**"), s = (r, a, l) => W(r) > i ? [
|
|
943
944
|
new b(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, maxLength: i }))
|
|
944
945
|
] : null;
|
|
945
946
|
super(s);
|
|
@@ -948,7 +949,7 @@ class Qt extends f {
|
|
|
948
949
|
class zt extends f {
|
|
949
950
|
constructor(i, t, e) {
|
|
950
951
|
const s = e || m("Length must be between **{minLength}** and **{maxLength}**"), r = (a, l, c) => {
|
|
951
|
-
const u =
|
|
952
|
+
const u = W(a);
|
|
952
953
|
return u < i || u > t ? [
|
|
953
954
|
new b(
|
|
954
955
|
this.replacePlaceholders(s, { newValue: a, oldValue: l, field: c, minLength: i, maxLength: t })
|
|
@@ -986,9 +987,9 @@ const Ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
986
987
|
ActionsMap: N,
|
|
987
988
|
ConditionalEnabledAction: Et,
|
|
988
989
|
ConditionalStatementAction: U,
|
|
989
|
-
ConditionalValueAction:
|
|
990
|
+
ConditionalValueAction: Vt,
|
|
990
991
|
ConditionalVisibilityAction: xt,
|
|
991
|
-
DisplayMode:
|
|
992
|
+
DisplayMode: A,
|
|
992
993
|
EmptyField: jt,
|
|
993
994
|
EnabledChangedAction: st,
|
|
994
995
|
EnabledChangingAction: nt,
|
|
@@ -997,14 +998,14 @@ const Ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
997
998
|
FieldActionBase: p,
|
|
998
999
|
FieldBase: y,
|
|
999
1000
|
Group: E,
|
|
1000
|
-
List:
|
|
1001
|
+
List: X,
|
|
1001
1002
|
ListItemAddedAction: Q,
|
|
1002
1003
|
ListItemRemovedAction: ct,
|
|
1003
1004
|
MdString: F,
|
|
1004
1005
|
Operator: g,
|
|
1005
1006
|
Statement: _,
|
|
1006
1007
|
ValidChangedAction: rt,
|
|
1007
|
-
ValidationError:
|
|
1008
|
+
ValidationError: H,
|
|
1008
1009
|
ValidationErrorRenderContent: b,
|
|
1009
1010
|
ValidationErrorText: vt,
|
|
1010
1011
|
Validator: f,
|
|
@@ -1013,7 +1014,7 @@ const Ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1013
1014
|
VisibilityChangedAction: lt,
|
|
1014
1015
|
VisibilityChangingAction: at,
|
|
1015
1016
|
buildErrorMessage: m,
|
|
1016
|
-
isCustomModalContentComponentDef:
|
|
1017
|
+
isCustomModalContentComponentDef: G
|
|
1017
1018
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1018
1019
|
export {
|
|
1019
1020
|
M as AbortEventHandlingException,
|
|
@@ -1021,9 +1022,9 @@ export {
|
|
|
1021
1022
|
N as ActionsMap,
|
|
1022
1023
|
Et as ConditionalEnabledAction,
|
|
1023
1024
|
U as ConditionalStatementAction,
|
|
1024
|
-
|
|
1025
|
+
Vt as ConditionalValueAction,
|
|
1025
1026
|
xt as ConditionalVisibilityAction,
|
|
1026
|
-
|
|
1027
|
+
A as DisplayMode,
|
|
1027
1028
|
jt as EmptyField,
|
|
1028
1029
|
st as EnabledChangedAction,
|
|
1029
1030
|
nt as EnabledChangingAction,
|
|
@@ -1032,14 +1033,14 @@ export {
|
|
|
1032
1033
|
p as FieldActionBase,
|
|
1033
1034
|
y as FieldBase,
|
|
1034
1035
|
E as Group,
|
|
1035
|
-
|
|
1036
|
+
X as List,
|
|
1036
1037
|
Q as ListItemAddedAction,
|
|
1037
1038
|
ct as ListItemRemovedAction,
|
|
1038
1039
|
F as MdString,
|
|
1039
1040
|
g as Operator,
|
|
1040
1041
|
_ as Statement,
|
|
1041
1042
|
rt as ValidChangedAction,
|
|
1042
|
-
|
|
1043
|
+
H as ValidationError,
|
|
1043
1044
|
b as ValidationErrorRenderContent,
|
|
1044
1045
|
vt as ValidationErrorText,
|
|
1045
1046
|
f as Validator,
|
|
@@ -1050,6 +1051,6 @@ export {
|
|
|
1050
1051
|
m as buildErrorMessage,
|
|
1051
1052
|
Yt as default,
|
|
1052
1053
|
Kt as forms,
|
|
1053
|
-
|
|
1054
|
+
G as isCustomModalContentComponentDef
|
|
1054
1055
|
};
|
|
1055
1056
|
//# sourceMappingURL=dynamicforms-vue-forms.js.map
|