@aheart-ui/ai 1.1.0 → 1.2.0

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,10 +1,20 @@
1
- import { defineComponent as x, ref as k, computed as f, openBlock as a, createElementBlock as y, normalizeClass as g, createElementVNode as B, createTextVNode as C, toDisplayString as m, createCommentVNode as v, createBlock as t, unref as u } from "vue";
2
- import { Textarea as S, TreeSelect as T, Upload as h, RadioGroup as D, CheckboxGroup as E, Select as N, Switch as P, InputNumber as q, DatePicker as I, DateRangePicker as R, TimePicker as w, TimeRangePicker as A, Input as G } from "aheart-ui";
1
+ import { defineComponent as x, ref as k, computed as y, openBlock as a, createElementBlock as n, normalizeClass as g, createElementVNode as B, createTextVNode as C, toDisplayString as m, createCommentVNode as v, createBlock as t, unref as o } from "vue";
2
+ import { CheckboxGroup as S } from "aheart-ui/checkbox";
3
+ import { DatePicker as T, DateRangePicker as h } from "aheart-ui/date-picker";
4
+ import { Input as D } from "aheart-ui/input";
5
+ import { InputNumber as E } from "aheart-ui/input-number";
6
+ import { RadioGroup as N } from "aheart-ui/radio";
7
+ import { Select as P } from "aheart-ui/select";
8
+ import { Switch as q } from "aheart-ui/switch";
9
+ import { Textarea as I } from "aheart-ui/textarea";
10
+ import { TimePicker as R, TimeRangePicker as w } from "aheart-ui/time-picker";
11
+ import { TreeSelect as A } from "aheart-ui/tree-select";
12
+ import { Upload as G } from "aheart-ui/upload";
3
13
  const j = ["data-field-key", "aria-invalid", "aria-describedby"], z = ["id", "for"], L = {
4
14
  key: 0,
5
15
  class: "aheart-ai-form__required",
6
16
  "aria-hidden": "true"
7
- }, F = ["id"], H = ["id"], M = /* @__PURE__ */ x({
17
+ }, F = ["id"], H = ["id"], le = /* @__PURE__ */ x({
8
18
  __name: "form-field",
9
19
  props: {
10
20
  field: {},
@@ -14,33 +24,33 @@ const j = ["data-field-key", "aria-invalid", "aria-describedby"], z = ["id", "fo
14
24
  },
15
25
  emits: ["update"],
16
26
  setup(e, { expose: c, emit: V }) {
17
- const b = e, i = V, s = k(), n = k(), U = f(
18
- () => (b.field.options ?? []).map((r) => ({
19
- key: r.value,
20
- title: r.label,
21
- disabled: r.disabled
27
+ const r = e, i = V, s = k(), f = k(), U = y(
28
+ () => (r.field.options ?? []).map((b) => ({
29
+ key: b.value,
30
+ title: b.label,
31
+ disabled: b.disabled
22
32
  }))
23
- ), o = f(
24
- () => [b.field.description && `${b.field.key}-description`, b.error && `${b.field.key}-error`].filter(Boolean).join(" ") || void 0
25
- ), $ = f(
26
- () => b.field.type === "date-range" || b.field.type === "time-range" ? `${b.field.key}-start` : b.field.key
33
+ ), u = y(
34
+ () => [r.field.description && `${r.field.key}-description`, r.error && `${r.field.key}-error`].filter(Boolean).join(" ") || void 0
35
+ ), $ = y(
36
+ () => r.field.type === "date-range" || r.field.type === "time-range" ? `${r.field.key}-start` : r.field.key
27
37
  );
28
38
  return c({
29
39
  focus: () => {
30
- var r, l;
31
- if (n.value) {
32
- n.value.focus("start");
40
+ var b, l;
41
+ if (f.value) {
42
+ f.value.focus("start");
33
43
  return;
34
44
  }
35
- (l = (r = s.value) == null ? void 0 : r.querySelector('input, button, [role="combobox"], [tabindex="0"]')) == null || l.focus({ preventScroll: !0 });
45
+ (l = (b = s.value) == null ? void 0 : b.querySelector('input, button, [role="combobox"], [tabindex="0"]')) == null || l.focus({ preventScroll: !0 });
36
46
  }
37
- }), (r, l) => (a(), y("div", {
47
+ }), (b, l) => (a(), n("div", {
38
48
  ref_key: "fieldElement",
39
49
  ref: s,
40
50
  class: g(["aheart-ai-form__field", { "is-error": !!e.error, "is-disabled": e.disabled }]),
41
51
  "data-field-key": e.field.key,
42
52
  "aria-invalid": e.error ? "true" : void 0,
43
- "aria-describedby": o.value,
53
+ "aria-describedby": u.value,
44
54
  tabindex: "-1"
45
55
  }, [
46
56
  B("label", {
@@ -48,23 +58,23 @@ const j = ["data-field-key", "aria-invalid", "aria-describedby"], z = ["id", "fo
48
58
  for: $.value
49
59
  }, [
50
60
  C(m(e.field.label) + " ", 1),
51
- e.field.required ? (a(), y("span", L, "*")) : v("", !0)
61
+ e.field.required ? (a(), n("span", L, "*")) : v("", !0)
52
62
  ], 8, z),
53
- e.field.description ? (a(), y("p", {
63
+ e.field.description ? (a(), n("p", {
54
64
  key: 0,
55
65
  id: `${e.field.key}-description`,
56
66
  class: "aheart-ai-form__field-description"
57
67
  }, m(e.field.description), 9, F)) : v("", !0),
58
- e.field.type === "textarea" ? (a(), t(u(S), {
68
+ e.field.type === "textarea" ? (a(), t(o(I), {
59
69
  key: 1,
60
70
  id: e.field.key,
61
71
  "aria-labelledby": `${e.field.key}-label`,
62
- "aria-describedby": o.value,
72
+ "aria-describedby": u.value,
63
73
  "model-value": e.value,
64
74
  placeholder: e.field.placeholder,
65
75
  disabled: e.disabled,
66
76
  "onUpdate:modelValue": l[0] || (l[0] = (d) => i("update", d))
67
- }, null, 8, ["id", "aria-labelledby", "aria-describedby", "model-value", "placeholder", "disabled"])) : e.field.type === "tree-select" ? (a(), t(u(T), {
77
+ }, null, 8, ["id", "aria-labelledby", "aria-describedby", "model-value", "placeholder", "disabled"])) : e.field.type === "tree-select" ? (a(), t(o(A), {
68
78
  key: 2,
69
79
  id: e.field.key,
70
80
  "labelled-by": `${e.field.key}-label`,
@@ -73,24 +83,24 @@ const j = ["data-field-key", "aria-invalid", "aria-describedby"], z = ["id", "fo
73
83
  multiple: Array.isArray(e.value),
74
84
  disabled: e.disabled,
75
85
  "onUpdate:modelValue": l[1] || (l[1] = (d) => i("update", d))
76
- }, null, 8, ["id", "labelled-by", "model-value", "tree-data", "multiple", "disabled"])) : e.field.type === "upload" ? (a(), t(u(h), {
86
+ }, null, 8, ["id", "labelled-by", "model-value", "tree-data", "multiple", "disabled"])) : e.field.type === "upload" ? (a(), t(o(G), {
77
87
  key: 3,
78
88
  "file-list": e.value,
79
89
  disabled: e.disabled,
80
90
  "onUpdate:fileList": l[2] || (l[2] = (d) => i("update", d))
81
- }, null, 8, ["file-list", "disabled"])) : e.field.type === "radio" ? (a(), t(u(D), {
91
+ }, null, 8, ["file-list", "disabled"])) : e.field.type === "radio" ? (a(), t(o(N), {
82
92
  key: 4,
83
93
  "model-value": e.value,
84
94
  options: e.field.options,
85
95
  disabled: e.disabled,
86
96
  "onUpdate:modelValue": l[3] || (l[3] = (d) => i("update", d))
87
- }, null, 8, ["model-value", "options", "disabled"])) : e.field.type === "checkbox" ? (a(), t(u(E), {
97
+ }, null, 8, ["model-value", "options", "disabled"])) : e.field.type === "checkbox" ? (a(), t(o(S), {
88
98
  key: 5,
89
99
  "model-value": e.value,
90
100
  options: e.field.options,
91
101
  disabled: e.disabled,
92
102
  "onUpdate:modelValue": l[4] || (l[4] = (d) => i("update", d))
93
- }, null, 8, ["model-value", "options", "disabled"])) : e.field.type === "select" ? (a(), t(u(N), {
103
+ }, null, 8, ["model-value", "options", "disabled"])) : e.field.type === "select" ? (a(), t(o(P), {
94
104
  key: 6,
95
105
  id: e.field.key,
96
106
  "labelled-by": `${e.field.key}-label`,
@@ -98,71 +108,71 @@ const j = ["data-field-key", "aria-invalid", "aria-describedby"], z = ["id", "fo
98
108
  disabled: e.disabled,
99
109
  options: e.field.options,
100
110
  "onUpdate:modelValue": l[5] || (l[5] = (d) => i("update", d))
101
- }, null, 8, ["id", "labelled-by", "model-value", "disabled", "options"])) : e.field.type === "switch" ? (a(), t(u(P), {
111
+ }, null, 8, ["id", "labelled-by", "model-value", "disabled", "options"])) : e.field.type === "switch" ? (a(), t(o(q), {
102
112
  key: 7,
103
113
  id: e.field.key,
104
114
  "model-value": !!e.value,
105
115
  disabled: e.disabled,
106
116
  "onUpdate:modelValue": l[6] || (l[6] = (d) => i("update", d))
107
- }, null, 8, ["id", "model-value", "disabled"])) : e.field.type === "number" ? (a(), t(u(q), {
117
+ }, null, 8, ["id", "model-value", "disabled"])) : e.field.type === "number" ? (a(), t(o(E), {
108
118
  key: 8,
109
119
  id: e.field.key,
110
120
  "model-value": e.value,
111
121
  placeholder: e.field.placeholder,
112
122
  disabled: e.disabled,
113
123
  "onUpdate:modelValue": l[7] || (l[7] = (d) => i("update", d))
114
- }, null, 8, ["id", "model-value", "placeholder", "disabled"])) : e.field.type === "date" ? (a(), t(u(I), {
124
+ }, null, 8, ["id", "model-value", "placeholder", "disabled"])) : e.field.type === "date" ? (a(), t(o(T), {
115
125
  key: 9,
116
126
  id: e.field.key,
117
127
  "labelled-by": `${e.field.key}-label`,
118
- "described-by": o.value,
128
+ "described-by": u.value,
119
129
  status: e.error ? "error" : void 0,
120
130
  "model-value": e.value,
121
131
  placeholder: e.field.placeholder,
122
132
  disabled: e.disabled,
123
133
  "onUpdate:modelValue": l[8] || (l[8] = (d) => i("update", d))
124
- }, null, 8, ["id", "labelled-by", "described-by", "status", "model-value", "placeholder", "disabled"])) : e.field.type === "date-range" ? (a(), t(u(R), {
134
+ }, null, 8, ["id", "labelled-by", "described-by", "status", "model-value", "placeholder", "disabled"])) : e.field.type === "date-range" ? (a(), t(o(h), {
125
135
  key: 10,
126
136
  ref_key: "rangeControl",
127
- ref: n,
137
+ ref: f,
128
138
  id: e.field.key,
129
139
  "labelled-by": `${e.field.key}-label`,
130
- "described-by": o.value,
140
+ "described-by": u.value,
131
141
  status: e.error ? "error" : void 0,
132
142
  "model-value": e.value,
133
143
  disabled: e.disabled,
134
144
  "onUpdate:modelValue": l[9] || (l[9] = (d) => i("update", d))
135
- }, null, 8, ["id", "labelled-by", "described-by", "status", "model-value", "disabled"])) : e.field.type === "time" ? (a(), t(u(w), {
145
+ }, null, 8, ["id", "labelled-by", "described-by", "status", "model-value", "disabled"])) : e.field.type === "time" ? (a(), t(o(R), {
136
146
  key: 11,
137
147
  id: e.field.key,
138
148
  "labelled-by": `${e.field.key}-label`,
139
- "described-by": o.value,
149
+ "described-by": u.value,
140
150
  status: e.error ? "error" : void 0,
141
151
  "model-value": e.value,
142
152
  placeholder: e.field.placeholder,
143
153
  disabled: e.disabled,
144
154
  "onUpdate:modelValue": l[10] || (l[10] = (d) => i("update", d))
145
- }, null, 8, ["id", "labelled-by", "described-by", "status", "model-value", "placeholder", "disabled"])) : e.field.type === "time-range" ? (a(), t(u(A), {
155
+ }, null, 8, ["id", "labelled-by", "described-by", "status", "model-value", "placeholder", "disabled"])) : e.field.type === "time-range" ? (a(), t(o(w), {
146
156
  key: 12,
147
157
  ref_key: "rangeControl",
148
- ref: n,
158
+ ref: f,
149
159
  id: e.field.key,
150
160
  "labelled-by": `${e.field.key}-label`,
151
- "described-by": o.value,
161
+ "described-by": u.value,
152
162
  status: e.error ? "error" : void 0,
153
163
  "model-value": e.value,
154
164
  disabled: e.disabled,
155
165
  "onUpdate:modelValue": l[11] || (l[11] = (d) => i("update", d))
156
- }, null, 8, ["id", "labelled-by", "described-by", "status", "model-value", "disabled"])) : (a(), t(u(G), {
166
+ }, null, 8, ["id", "labelled-by", "described-by", "status", "model-value", "disabled"])) : (a(), t(o(D), {
157
167
  key: 13,
158
168
  id: e.field.key,
159
169
  "model-value": e.value,
160
170
  placeholder: e.field.placeholder,
161
171
  disabled: e.disabled,
162
- "aria-describedby": o.value,
172
+ "aria-describedby": u.value,
163
173
  "onUpdate:modelValue": l[12] || (l[12] = (d) => i("update", d))
164
174
  }, null, 8, ["id", "model-value", "placeholder", "disabled", "aria-describedby"])),
165
- e.error ? (a(), y("p", {
175
+ e.error ? (a(), n("p", {
166
176
  key: 14,
167
177
  id: `${e.field.key}-error`,
168
178
  class: "aheart-ai-form__field-error",
@@ -172,5 +182,5 @@ const j = ["data-field-key", "aria-invalid", "aria-describedby"], z = ["id", "fo
172
182
  }
173
183
  });
174
184
  export {
175
- M as default
185
+ le as default
176
186
  };
package/es/form.vue.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { defineComponent as Ae, computed as R, reactive as D, ref as q, onMounted as Fe, watch as k, toRaw as J, onBeforeUnmount as Ve, openBlock as c, createBlock as Q, unref as X, withCtx as W, createElementBlock as d, toDisplayString as v, createCommentVNode as V, createElementVNode as j, Fragment as K, renderList as I, resolveDynamicComponent as je, createVNode as ne, createTextVNode as we, nextTick as le } from "vue";
2
- import { Form as Ee, FormItem as $e, Button as Se } from "aheart-ui";
2
+ import { Button as Ee } from "aheart-ui/button";
3
+ import { Form as $e, FormItem as Se } from "aheart-ui/form";
3
4
  import Re from "./form-field.vue.js";
4
5
  import { validateAIFormSchema as qe } from "./form-schema.js";
5
6
  const Ce = {
@@ -18,7 +19,7 @@ const Ce = {
18
19
  key: 1,
19
20
  class: "aheart-ai-form__error",
20
21
  role: "alert"
21
- }, Qe = /* @__PURE__ */ Ae({
22
+ }, Xe = /* @__PURE__ */ Ae({
22
23
  name: "AAIForm",
23
24
  __name: "form",
24
25
  props: {
@@ -279,7 +280,7 @@ const Ce = {
279
280
  }), (r = (t = _.value) == null ? void 0 : t.setFieldsErrors) == null || r.call(t, e);
280
281
  } }), Ve(() => {
281
282
  for (const e of m.values()) e.abort();
282
- }), (e, t) => i.value.valid && i.value.schema ? (c(), Q(X(Ee), {
283
+ }), (e, t) => i.value.valid && i.value.schema ? (c(), Q(X($e), {
283
284
  key: 0,
284
285
  ref_key: "formElement",
285
286
  ref: _,
@@ -323,7 +324,7 @@ const Ce = {
323
324
  j("span", null, v(r.group.title), 1),
324
325
  r.group.description ? (c(), d("small", Ue, v(r.group.description), 1)) : V("", !0)
325
326
  ])) : V("", !0),
326
- (c(!0), d(K, null, I(r.fields, (s) => (c(), Q(X($e), {
327
+ (c(!0), d(K, null, I(r.fields, (s) => (c(), Q(X(Se), {
327
328
  key: pe(s),
328
329
  name: s.key,
329
330
  rules: ve(s),
@@ -349,7 +350,7 @@ const Ce = {
349
350
  }), 128)),
350
351
  p.submitError ? (c(), d("p", Be, v(p.submitError), 1)) : V("", !0),
351
352
  j("footer", De, [
352
- ne(X(Se), {
353
+ ne(X(Ee), {
353
354
  "html-type": "submit",
354
355
  type: "primary",
355
356
  loading: p.submitting,
@@ -372,5 +373,5 @@ const Ce = {
372
373
  }
373
374
  });
374
375
  export {
375
- Qe as default
376
+ Xe as default
376
377
  };