@indielayer/ui 1.8.0 → 1.8.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.
@@ -1,13 +1,13 @@
1
- import { ref as a, watch as h, inject as G, computed as j, onMounted as A, onUnmounted as O } from "vue";
2
- import { injectFormGroupKey as K, injectFormKey as M } from "./keys.js";
3
- const y = (r, { focus: I, emit: n, withListeners: b = !0 }) => {
4
- const s = a(!0), o = a(r.error), v = a(r.hideFooter), V = r.name ? r.name : (Math.random() + 1).toString(36).substring(7), i = a(V);
5
- h(() => r.error, (e) => {
1
+ import { ref as a, watch as y, inject as h, computed as j, onMounted as k, onUnmounted as A } from "vue";
2
+ import { injectFormGroupKey as R, injectFormKey as O } from "./keys.js";
3
+ const G = (r, { focus: I, emit: n, withListeners: b = !0 }) => {
4
+ const s = a(!0), o = a(r.error), F = a(r.hideFooter), V = r.name ? r.name : (Math.random() + 1).toString(36).substring(7), i = a(V);
5
+ y(() => r.error, (e) => {
6
6
  o.value = e;
7
- }), h(() => r.name, (e) => {
7
+ }), y(() => r.name, (e) => {
8
8
  e && (i.value = e);
9
9
  });
10
- const t = G(K, {
10
+ const t = h(R, {
11
11
  registerInputGroup: () => {
12
12
  },
13
13
  unregisterInputGroup: () => {
@@ -17,8 +17,8 @@ const y = (r, { focus: I, emit: n, withListeners: b = !0 }) => {
17
17
  isInsideFormGroup: !1,
18
18
  value: void 0
19
19
  });
20
- t.isInsideFormGroup && (v.value = !0);
21
- const c = G(M, {
20
+ t.isInsideFormGroup && (F.value = !0);
21
+ const m = h(O, {
22
22
  registerInput: () => {
23
23
  },
24
24
  unregisterInput: () => {
@@ -26,21 +26,21 @@ const y = (r, { focus: I, emit: n, withListeners: b = !0 }) => {
26
26
  isInsideForm: !1
27
27
  }), S = () => {
28
28
  o.value = "", s.value = !0, n("update:modelValue", "");
29
- }, F = (e) => {
29
+ }, v = (e) => {
30
30
  o.value = e;
31
- }, m = (e) => {
31
+ }, c = (e) => {
32
32
  e = e || r.modelValue, s.value = !1;
33
- for (let p = 0; p < r.rules.length; p++) {
34
- const u = r.rules[p];
33
+ for (let g = 0; g < r.rules.length; g++) {
34
+ const u = r.rules[g];
35
35
  let l = !0;
36
36
  if (typeof u == "function")
37
37
  l = u(e);
38
38
  else if (Array.isArray(u) && u.length === 2) {
39
- const { 0: d, 1: g } = u;
40
- l = d(e, g);
39
+ const { 0: d, 1: p } = u;
40
+ l = d(e, p);
41
41
  } else {
42
- const d = u.fn, { options: g } = u;
43
- l = d(e, g);
42
+ const d = u.fn, { options: p } = u;
43
+ l = d(e, p);
44
44
  }
45
45
  if (l !== !0)
46
46
  return o.value = l, !1;
@@ -54,7 +54,7 @@ const y = (r, { focus: I, emit: n, withListeners: b = !0 }) => {
54
54
  f.value = !1, n("blur", e);
55
55
  },
56
56
  input: (e) => {
57
- r.validateOnInput && !s.value && m(e.target.value), n("update:modelValue", e.target.value), n("input", e);
57
+ r.validateOnInput && !s.value && c(e.target.value), n("update:modelValue", e.target.value), n("input", e);
58
58
  },
59
59
  change: (e) => n("change", e)
60
60
  })) : {
@@ -67,26 +67,26 @@ const y = (r, { focus: I, emit: n, withListeners: b = !0 }) => {
67
67
  change: () => {
68
68
  }
69
69
  };
70
- return A(() => {
71
- t.isInsideFormGroup ? t.registerInputGroup(i.value, I) : c.registerInput(i.value, I, m, F);
72
- }), O(() => {
73
- t.isInsideFormGroup ? t.unregisterInputGroup(i.value) : c.unregisterInput(i.value);
70
+ return k(() => {
71
+ t.isInsideFormGroup ? t.registerInputGroup(i.value, I) : r.skipFormRegistry || m.registerInput(i.value, I, c, v);
72
+ }), A(() => {
73
+ t.isInsideFormGroup ? t.unregisterInputGroup(i.value) : r.skipFormRegistry || m.unregisterInput(i.value);
74
74
  }), {
75
75
  isFirstValidation: s,
76
76
  errorInternal: o,
77
- hideFooterInternal: v,
77
+ hideFooterInternal: F,
78
78
  isFocused: f,
79
- isInsideForm: c.isInsideForm,
79
+ isInsideForm: r.skipFormRegistry ? !1 : m.isInsideForm,
80
80
  isInsideFormGroup: t.isInsideFormGroup,
81
81
  inputListeners: B,
82
82
  formGroup: t,
83
83
  reset: S,
84
- validate: m,
85
- setError: F
84
+ validate: c,
85
+ setError: v
86
86
  };
87
87
  };
88
- y.emits = (r = !0) => r ? ["update:modelValue", "blur", "focus", "input", "change"] : ["update:modelValue"];
89
- y.props = () => ({
88
+ G.emits = (r = !0) => r ? ["update:modelValue", "blur", "focus", "input", "change"] : ["update:modelValue"];
89
+ G.props = () => ({
90
90
  modelValue: {
91
91
  type: [String, Number, Boolean, Object, Array],
92
92
  default: void 0
@@ -107,8 +107,9 @@ y.props = () => ({
107
107
  type: Array,
108
108
  default: () => []
109
109
  },
110
- tooltip: String
110
+ tooltip: String,
111
+ skipFormRegistry: Boolean
111
112
  });
112
113
  export {
113
- y as useInputtable
114
+ G as useInputtable
114
115
  };