@dynamicforms/vue-forms 0.4.2 → 0.4.3

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,8 +1,8 @@
1
- var dt = Object.defineProperty, ft = Object.defineProperties;
1
+ var gt = Object.defineProperty, ft = Object.defineProperties;
2
2
  var pt = Object.getOwnPropertyDescriptors;
3
3
  var R = Object.getOwnPropertySymbols;
4
4
  var J = Object.prototype.hasOwnProperty, K = Object.prototype.propertyIsEnumerable;
5
- var $ = (n, s, t) => s in n ? dt(n, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[s] = t, A = (n, s) => {
5
+ var $ = (n, s, t) => s in n ? gt(n, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[s] = t, A = (n, s) => {
6
6
  for (var t in s || (s = {}))
7
7
  J.call(s, t) && $(n, t, s[t]);
8
8
  if (R)
@@ -21,7 +21,7 @@ var S = (n, s) => {
21
21
  };
22
22
  var o = (n, s, t) => $(n, typeof s != "symbol" ? s + "" : s, t);
23
23
  import { isEqual as U, isBoolean as bt, isString as C, isEmpty as M, truncate as mt, isArray as st, isObject as nt } from "lodash-es";
24
- import { unref as d, computed as z, reactive as vt, defineComponent as yt, resolveComponent as Z, createBlock as xt, openBlock as Et, h as w } from "vue";
24
+ import { unref as g, computed as z, reactive as vt, defineComponent as yt, resolveComponent as Z, createBlock as xt, openBlock as Et, h as w } from "vue";
25
25
  var N = /* @__PURE__ */ ((n) => (n[n.SUPPRESS = 1] = "SUPPRESS", n[n.HIDDEN = 5] = "HIDDEN", n[n.INVISIBLE = 8] = "INVISIBLE", n[n.FULL = 10] = "FULL", n))(N || {});
26
26
  const tt = 10;
27
27
  ((n) => {
@@ -86,7 +86,7 @@ class m extends b {
86
86
  class L extends String {
87
87
  }
88
88
  function G(n) {
89
- const s = d(n);
89
+ const s = g(n);
90
90
  return typeof s == "object" && "componentName" in s;
91
91
  }
92
92
  class W {
@@ -125,39 +125,39 @@ class p extends W {
125
125
  this.classes = e, this.text = t, this.textType = z(() => this.getTextType);
126
126
  }
127
127
  get getTextType() {
128
- const t = d(this.text);
128
+ const t = g(this.text);
129
129
  return t ? t instanceof L ? "md" : G(t) ? "component" : "string" : "string";
130
130
  }
131
131
  get componentName() {
132
- switch (d(this.textType)) {
132
+ switch (g(this.textType)) {
133
133
  case "string":
134
134
  return "template";
135
135
  case "md":
136
136
  return "vue-markdown";
137
137
  case "component":
138
- return d(this.text).componentName;
138
+ return g(this.text).componentName;
139
139
  default:
140
140
  return "template";
141
141
  }
142
142
  }
143
143
  get componentBindings() {
144
- switch (d(this.textType)) {
144
+ switch (g(this.textType)) {
145
145
  case "string":
146
146
  return {};
147
147
  case "md":
148
148
  return { source: this.text.toString() };
149
149
  case "component":
150
- return d(this.text).componentProps || {};
150
+ return g(this.text).componentProps || {};
151
151
  default:
152
152
  return {};
153
153
  }
154
154
  }
155
155
  get componentBody() {
156
- switch (d(this.textType)) {
156
+ switch (g(this.textType)) {
157
157
  case "string":
158
- return d(this.text);
158
+ return g(this.text);
159
159
  case "component":
160
- return d(this.text).componentVHtml || "";
160
+ return g(this.text).componentVHtml || "";
161
161
  default:
162
162
  return "";
163
163
  }
@@ -353,7 +353,7 @@ var j = /* @__PURE__ */ ((n) => (n[n.NOT = 0] = "NOT", n[n.OR = 1] = "OR", n[n.A
353
353
  n.isLogicOperator = i;
354
354
  })(j || (j = {}));
355
355
  Object.freeze(j);
356
- const g = j, Ft = Symbol("EnabledChangingAction");
356
+ const d = j, Ft = Symbol("EnabledChangingAction");
357
357
  class rt extends b {
358
358
  // eslint-disable-next-line @typescript-eslint/no-useless-constructor
359
359
  constructor(s) {
@@ -489,46 +489,46 @@ class F {
489
489
  this.operand1 = s, this.operator = t, this.operand2 = e;
490
490
  }
491
491
  get operand1Value() {
492
- return this.operand1 instanceof F ? this.operand1.evaluate() : this.operand1 instanceof y ? d(this.operand1.value) : this.operand1;
492
+ return this.operand1 instanceof F ? this.operand1.evaluate() : this.operand1 instanceof y ? g(this.operand1.value) : this.operand1;
493
493
  }
494
494
  get operand2Value() {
495
- return this.operand2 instanceof F ? this.operand2.evaluate() : this.operand2 instanceof y ? d(this.operand2.value) : this.operand2;
495
+ return this.operand2 instanceof F ? this.operand2.evaluate() : this.operand2 instanceof y ? g(this.operand2.value) : this.operand2;
496
496
  }
497
497
  evaluate() {
498
498
  var e, i, r, a;
499
499
  const s = this.operand1Value, t = this.operand2Value;
500
500
  switch (this.operator) {
501
- case g.AND:
501
+ case d.AND:
502
502
  return s && t;
503
- case g.OR:
503
+ case d.OR:
504
504
  return s || t;
505
- case g.NAND:
505
+ case d.NAND:
506
506
  return !(s && t);
507
- case g.NOR:
507
+ case d.NOR:
508
508
  return !(s || t);
509
- case g.XOR:
509
+ case d.XOR:
510
510
  return Pt(s, t);
511
- case g.NOT:
511
+ case d.NOT:
512
512
  return !s;
513
- case g.EQUALS:
513
+ case d.EQUALS:
514
514
  return s == t;
515
- case g.NOT_EQUALS:
515
+ case d.NOT_EQUALS:
516
516
  return s != t;
517
- case g.LT:
517
+ case d.LT:
518
518
  return s < t;
519
- case g.LE:
519
+ case d.LE:
520
520
  return s <= t;
521
- case g.GE:
521
+ case d.GE:
522
522
  return s >= t;
523
- case g.GT:
523
+ case d.GT:
524
524
  return s > t;
525
- case g.IN:
525
+ case d.IN:
526
526
  return (i = (e = t == null ? void 0 : t.includes) == null ? void 0 : e.call(t, s)) != null ? i : !1;
527
- case g.NOT_IN:
527
+ case d.NOT_IN:
528
528
  return !((a = (r = t == null ? void 0 : t.includes) == null ? void 0 : r.call(t, s)) == null || a);
529
- case g.INCLUDES:
529
+ case d.INCLUDES:
530
530
  return C(s) && C(t) && s.indexOf(t) >= 0;
531
- case g.NOT_INCLUDES:
531
+ case d.NOT_INCLUDES:
532
532
  return !(C(s) && C(t) && s.indexOf(t) >= 0);
533
533
  default:
534
534
  throw new Error(`Operator not implemented ${this.operator}`);
@@ -679,37 +679,96 @@ const Bt = /* @__PURE__ */ yt({
679
679
  classes: { default: "text-error" }
680
680
  },
681
681
  setup(n) {
682
- const s = n, t = Z("vue-markdown"), e = () => {
682
+ const s = n, t = Z("vue-markdown"), e = /* @__PURE__ */ new Set([
683
+ "div",
684
+ "span",
685
+ "p",
686
+ "h1",
687
+ "h2",
688
+ "h3",
689
+ "h4",
690
+ "h5",
691
+ "h6",
692
+ "section",
693
+ "article",
694
+ "aside",
695
+ "nav",
696
+ "header",
697
+ "footer",
698
+ "main",
699
+ "figure",
700
+ "figcaption",
701
+ "blockquote",
702
+ "pre",
703
+ "code",
704
+ "em",
705
+ "strong",
706
+ "small",
707
+ "mark",
708
+ "del",
709
+ "ins",
710
+ "sub",
711
+ "sup",
712
+ "i",
713
+ "b",
714
+ "u",
715
+ "s",
716
+ "a",
717
+ "img",
718
+ "button",
719
+ "input",
720
+ "textarea",
721
+ "select",
722
+ "option",
723
+ "label",
724
+ "form",
725
+ "table",
726
+ "tr",
727
+ "td",
728
+ "th",
729
+ "thead",
730
+ "tbody",
731
+ "tfoot",
732
+ "ul",
733
+ "ol",
734
+ "li",
735
+ "dl",
736
+ "dt",
737
+ "dd"
738
+ ]), i = () => {
683
739
  if (typeof s.message == "string") return w("span", { class: s.classes }, s.message);
684
- const i = [];
685
- return s.message.forEach((r) => {
686
- switch (r.componentName) {
740
+ const r = [];
741
+ return s.message.forEach((a) => {
742
+ switch (a.componentName) {
687
743
  case "template":
688
- i.push(w("div", { class: [s.classes, r.extraClasses] }, r.componentBody));
744
+ r.push(w("div", { class: [s.classes, a.extraClasses] }, a.componentBody));
689
745
  break;
690
746
  case "vue-markdown":
691
747
  typeof t == "string" ? (console.warn(
692
748
  "You are using markdown for messages-widget, but you haven't registered a vue-markdown component"
693
- ), i.push(w("div", { class: [s.classes, r.extraClasses] }, r.componentBindings.source))) : i.push(w(
749
+ ), r.push(w("div", { class: [s.classes, a.extraClasses] }, a.componentBindings.source))) : r.push(w(
694
750
  t,
695
751
  {
696
- class: [s.classes, r.extraClasses, "df-messages-widget-markdown"],
697
- source: r.componentBindings.source
752
+ class: [s.classes, a.extraClasses, "df-messages-widget-markdown"],
753
+ source: a.componentBindings.source
698
754
  }
699
755
  ));
700
756
  break;
701
757
  default:
702
- i.push(
758
+ r.push(
703
759
  w(
704
- Z(r.componentName),
705
- I(A({ class: [s.classes, r.extraClasses] }, r.componentBindings), { innerHTML: r.componentBody })
760
+ e.has(a.componentName.toLowerCase()) ? (
761
+ // only resolve if it's not a common html element
762
+ a.componentName
763
+ ) : Z(a.componentName),
764
+ I(A({ class: [s.classes, a.extraClasses] }, a.componentBindings), { innerHTML: a.componentBody })
706
765
  )
707
766
  );
708
767
  break;
709
768
  }
710
- }), i;
769
+ }), r;
711
770
  };
712
- return (i, r) => (Et(), xt(e));
771
+ return (r, a) => (Et(), xt(i));
713
772
  }
714
773
  });
715
774
  class E extends y {
@@ -887,12 +946,12 @@ class X extends y {
887
946
  this._value = null, this.notifyValueChanged();
888
947
  }
889
948
  }
890
- const gt = { useMarkdownInValidators: !0 };
949
+ const dt = { useMarkdownInValidators: !0 };
891
950
  function $t() {
892
- return gt;
951
+ return dt;
893
952
  }
894
953
  function qt(n) {
895
- Object.assign(gt, n);
954
+ Object.assign(dt, n);
896
955
  }
897
956
  const ie = {
898
957
  install(n, s) {
@@ -908,7 +967,7 @@ class Mt extends f {
908
967
  let r = !1, a, l;
909
968
  super((u, h, _) => (a = u, l = h, r || (r = !0, this.otherField.registerAction(new m((x, P, O, B) => {
910
969
  P(x, O, B), this.unregistered || this.execute(_, () => null, a, l);
911
- }))), this.isValidComparison(d(u), d(this.otherField.value)) ? null : [
970
+ }))), this.isValidComparison(g(u), g(this.otherField.value)) ? null : [
912
971
  new p(
913
972
  this.replacePlaceholders(i, { newValue: u, oldValue: h, field: _, otherField: this.otherField })
914
973
  )
@@ -929,7 +988,7 @@ class Ht extends f {
929
988
  separator: ", ",
930
989
  omission: `... (${s.length} items total)`
931
990
  }));
932
- const r = (a, l, c) => s.includes(d(a)) ? null : [
991
+ const r = (a, l, c) => s.includes(g(a)) ? null : [
933
992
  new p(
934
993
  this.replacePlaceholders(e, { newValue: a, oldValue: l, field: c, allowedValues: s, allowedAsText: i })
935
994
  )
@@ -942,7 +1001,7 @@ function Qt(n) {
942
1001
  }
943
1002
  class zt extends f {
944
1003
  constructor(s) {
945
- const t = s || v("Please enter a value"), e = (i, r, a) => Qt(d(i)) === 0 ? [new p(
1004
+ const t = s || v("Please enter a value"), e = (i, r, a) => Qt(g(i)) === 0 ? [new p(
946
1005
  this.replacePlaceholders(t, { newValue: i, oldValue: r, field: a })
947
1006
  )] : null;
948
1007
  super(e);
@@ -1008,7 +1067,7 @@ class Kt extends f {
1008
1067
  }
1009
1068
  class Zt extends f {
1010
1069
  constructor(s, t) {
1011
- const e = t || v('Value must match pattern "**{pattern}**"'), i = (r, a, l) => s.test(String(d(r))) ? null : [
1070
+ const e = t || v('Value must match pattern "**{pattern}**"'), i = (r, a, l) => s.test(String(g(r))) ? null : [
1012
1071
  new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, pattern: s }))
1013
1072
  ];
1014
1073
  super(i);
@@ -1050,7 +1109,7 @@ const te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1050
1109
  ListItemRemovedAction: ht,
1051
1110
  MdString: L,
1052
1111
  MessagesWidget: Bt,
1053
- Operator: g,
1112
+ Operator: d,
1054
1113
  RenderableValue: Vt,
1055
1114
  Statement: F,
1056
1115
  ValidChangedAction: lt,
@@ -1087,7 +1146,7 @@ export {
1087
1146
  ht as ListItemRemovedAction,
1088
1147
  L as MdString,
1089
1148
  Bt as MessagesWidget,
1090
- g as Operator,
1149
+ d as Operator,
1091
1150
  Vt as RenderableValue,
1092
1151
  F as Statement,
1093
1152
  lt as ValidChangedAction,