@owocow/saber-ui 0.1.12 → 0.1.14

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.
Files changed (37) hide show
  1. package/dist/SaberAppLayout.vue_vue_type_script_setup_true_lang-DaxscIFe.js +418 -0
  2. package/dist/{SaberAppSidebar.vue_vue_type_script_setup_true_lang-HXyIXiau.js → SaberAppSidebar.vue_vue_type_script_setup_true_lang-Cwuj9VNi.js} +104 -95
  3. package/dist/{SaberDictSelect.vue_vue_type_script_setup_true_lang-B8PTKNKX.js → SaberDictSelect.vue_vue_type_script_setup_true_lang-BKdOdlFX.js} +1 -1
  4. package/dist/SaberDistrictSelect.vue_vue_type_script_setup_true_lang-jkl2AOay.js +272 -0
  5. package/dist/SaberPopSelect.vue_vue_type_script_setup_true_lang-eH8jkkzK.js +162 -0
  6. package/dist/SaberSwitchBar.vue_vue_type_script_setup_true_lang-CIbFBx5r.js +47 -0
  7. package/dist/components/SaberAppLayout.mjs +4 -0
  8. package/dist/components/SaberAppSidebar.mjs +1 -1
  9. package/dist/components/SaberPagination.vue.d.ts +49 -0
  10. package/dist/components/SaberSwitchBar.mjs +1 -1
  11. package/dist/components/layout/SaberAppLayout.types.d.ts +51 -0
  12. package/dist/components/layout/SaberAppLayout.vue.d.ts +78 -0
  13. package/dist/components/navigation/SaberAppSidebar.types.d.ts +1 -0
  14. package/dist/components/navigation/SaberAppSidebar.vue.d.ts +1 -0
  15. package/dist/composables/use-page-header.mjs +10 -8
  16. package/dist/control-size.d.ts +33 -0
  17. package/dist/forms/components/SaberFilterBar.vue.d.ts +3 -0
  18. package/dist/forms/components/SaberFormModal.vue.d.ts +2 -0
  19. package/dist/forms/components/fields/SaberDistrictSelect.vue.d.ts +5 -0
  20. package/dist/forms/components/fields/SaberInput.vue.d.ts +5 -0
  21. package/dist/forms/components/fields/SaberInputNumber.vue.d.ts +10 -2
  22. package/dist/forms/components/fields/SaberPopSelect.vue.d.ts +5 -2
  23. package/dist/forms/components/fields/SaberSelect.vue.d.ts +10 -2
  24. package/dist/forms/components/fields/SaberUploadImage.vue.d.ts +2 -2
  25. package/dist/forms/dict-select.mjs +1 -1
  26. package/dist/forms/district-select.mjs +1 -1
  27. package/dist/forms/index.d.ts +1 -0
  28. package/dist/forms/pop-select.mjs +1 -1
  29. package/dist/forms.mjs +4 -4
  30. package/dist/index.d.ts +7 -1
  31. package/dist/index.mjs +176 -96
  32. package/dist/plugin-DvH6j00c.js +442 -0
  33. package/package.json +6 -1
  34. package/dist/SaberDistrictSelect.vue_vue_type_script_setup_true_lang-BX8nLC35.js +0 -257
  35. package/dist/SaberPopSelect.vue_vue_type_script_setup_true_lang-BcS27NXI.js +0 -125
  36. package/dist/SaberSwitchBar.vue_vue_type_script_setup_true_lang-CDx3Dcas.js +0 -47
  37. package/dist/plugin-Dr3z0YFg.js +0 -396
@@ -1,12 +1,12 @@
1
- import le from "@nuxt/ui/components/Button.vue";
1
+ import oe from "@nuxt/ui/components/Button.vue";
2
2
  import ne from "@nuxt/ui/runtime/vue/components/Icon.vue";
3
- import { defineComponent as ie, useModel as oe, ref as ce, computed as W, openBlock as c, createElementBlock as g, normalizeClass as s, unref as l, createElementVNode as h, renderSlot as M, createBlock as _, withCtx as C, normalizeProps as re, guardReactiveProps as ue, createCommentVNode as A, createVNode as G, Transition as de, toDisplayString as K, Fragment as H, renderList as N, mergeModels as X } from "vue";
4
- import { tv as me } from "tailwind-variants";
5
- import { _ as ve } from "./SaberNavigationSearch.vue_vue_type_script_setup_true_lang-Bj96kMla.js";
3
+ import { defineComponent as ie, useModel as ce, ref as re, computed as X, openBlock as c, createElementBlock as x, normalizeClass as s, unref as l, createElementVNode as h, renderSlot as T, createBlock as w, withCtx as $, normalizeProps as ue, guardReactiveProps as de, createCommentVNode as _, createVNode as G, Transition as me, toDisplayString as K, Fragment as H, renderList as N, mergeModels as Y } from "vue";
4
+ import { tv as ve } from "tailwind-variants";
5
+ import { _ as fe } from "./SaberNavigationSearch.vue_vue_type_script_setup_true_lang-Bj96kMla.js";
6
6
  const xe = /* @__PURE__ */ ie({
7
7
  name: "SaberAppSidebar",
8
8
  __name: "SaberAppSidebar",
9
- props: /* @__PURE__ */ X({
9
+ props: /* @__PURE__ */ Y({
10
10
  sections: {},
11
11
  searchGroups: { default: () => [] },
12
12
  activeKey: {},
@@ -16,9 +16,9 @@ const xe = /* @__PURE__ */ ie({
16
16
  activeSection: { default: void 0 },
17
17
  activeSectionModifiers: {}
18
18
  }),
19
- emits: /* @__PURE__ */ X(["select", "section-select"], ["update:activeSection"]),
20
- setup(V, { emit: Y }) {
21
- const e = V, $ = Y, F = oe(V, "activeSection"), T = ce(!1), w = W(() => e.sections.find((t) => t.key === F.value)), a = me({
19
+ emits: /* @__PURE__ */ Y(["select", "section-select"], ["update:activeSection"]),
20
+ setup(V, { emit: Z }) {
21
+ const e = V, A = Z, E = ce(V, "activeSection"), F = re(!1), B = X(() => e.sections.find((t) => t.key === E.value)), a = ve({
22
22
  slots: {
23
23
  root: "flex h-full min-h-0 flex-col overflow-hidden",
24
24
  header: "shrink-0",
@@ -26,6 +26,7 @@ const xe = /* @__PURE__ */ ie({
26
26
  viewport: "min-h-0 flex-1 overflow-y-auto",
27
27
  panel: "flex min-h-full flex-col gap-1.5",
28
28
  sectionList: "flex flex-col",
29
+ rootFooter: "shrink-0",
29
30
  group: "flex flex-col",
30
31
  groupLabel: "px-2 py-2 text-[11px] uppercase tracking-wider text-muted/70",
31
32
  childList: "flex flex-col",
@@ -35,62 +36,62 @@ const xe = /* @__PURE__ */ ie({
35
36
  sectionItemLeadingIcon: "size-4.5 shrink-0",
36
37
  sectionItemLabel: "min-w-0 flex-1 truncate text-left",
37
38
  sectionItemTrailingIcon: "size-4 shrink-0",
38
- childItem: "flex w-full items-center rounded-md px-2 py-1.5 font-normal text-sm mb-0.5 gap-2 text-left transition",
39
+ childItem: "flex w-full items-center rounded-md px-2 py-2 font-normal text-sm mb-0.5 gap-2 text-left transition",
39
40
  childItemLeadingIcon: "size-4 shrink-0",
40
41
  childItemLabel: "min-w-0 flex-1 truncate text-left",
41
- backButton: "flex w-full items-center rounded-md px-2 py-2 gap-2 text-left transition",
42
- backButtonIcon: "size-4.5 shrink-0",
43
- backButtonLabel: "truncate text-sm font-medium flex-1 text-center pr-10"
42
+ backButton: "flex w-full items-center rounded-md h-9 px-2 gap-2 text-left transition ",
43
+ backButtonIcon: "size-4 shrink-0",
44
+ backButtonLabel: "truncate text-sm font-normal flex-1 text-center"
44
45
  }
45
- })(), z = W(() => {
46
- var t, i, o, r, u, d, m, v, f, p, b, B;
46
+ })(), z = X(() => {
47
+ var t, o, i, r, u, d, m, v, f, p, b, S;
47
48
  return {
48
- enterActive: ((i = (t = e.ui) == null ? void 0 : t.transition) == null ? void 0 : i.enterActive) ?? "transition duration-200 ease-out",
49
- leaveActive: ((r = (o = e.ui) == null ? void 0 : o.transition) == null ? void 0 : r.leaveActive) ?? "transition duration-200 ease-out pointer-events-none",
50
- enterFrom: T.value ? ((d = (u = e.ui) == null ? void 0 : u.transition) == null ? void 0 : d.backwardEnterFrom) ?? "-translate-x-2 opacity-0 blur-[2px]" : ((v = (m = e.ui) == null ? void 0 : m.transition) == null ? void 0 : v.forwardEnterFrom) ?? "translate-x-2 opacity-0 blur-[2px]",
51
- leaveTo: T.value ? ((p = (f = e.ui) == null ? void 0 : f.transition) == null ? void 0 : p.backwardLeaveTo) ?? "translate-x-2 opacity-0 blur-[2px]" : ((B = (b = e.ui) == null ? void 0 : b.transition) == null ? void 0 : B.forwardLeaveTo) ?? "-translate-x-2 opacity-0 blur-[2px]"
49
+ enterActive: ((o = (t = e.ui) == null ? void 0 : t.transition) == null ? void 0 : o.enterActive) ?? "transition duration-100 ease-out",
50
+ leaveActive: ((r = (i = e.ui) == null ? void 0 : i.transition) == null ? void 0 : r.leaveActive) ?? "transition duration-100 ease-out pointer-events-none",
51
+ enterFrom: F.value ? ((d = (u = e.ui) == null ? void 0 : u.transition) == null ? void 0 : d.backwardEnterFrom) ?? "-translate-x-2 opacity-0 blur-[2px]" : ((v = (m = e.ui) == null ? void 0 : m.transition) == null ? void 0 : v.forwardEnterFrom) ?? "translate-x-2 opacity-0 blur-[2px]",
52
+ leaveTo: F.value ? ((p = (f = e.ui) == null ? void 0 : f.transition) == null ? void 0 : p.backwardLeaveTo) ?? "translate-x-2 opacity-0 blur-[2px]" : ((S = (b = e.ui) == null ? void 0 : b.transition) == null ? void 0 : S.forwardLeaveTo) ?? "-translate-x-2 opacity-0 blur-[2px]"
52
53
  };
53
54
  });
54
- function E(t) {
55
- return t.groups.flatMap((i) => i.items);
55
+ function M(t) {
56
+ return t.groups.flatMap((o) => o.items);
56
57
  }
57
58
  function P(t) {
58
- return E(t).some((i) => i.key === e.activeKey);
59
- }
60
- function Z(t) {
61
- var o, r, u, d, m, v, f, p;
62
- const i = P(t) ? ["font-medium", (r = (o = e.ui) == null ? void 0 : o.sectionItem) == null ? void 0 : r.active] : ["text-default", (d = (u = e.ui) == null ? void 0 : u.sectionItem) == null ? void 0 : d.inactive];
63
- return a.sectionItem({ class: [(v = (m = e.ui) == null ? void 0 : m.sectionItem) == null ? void 0 : v.base, i, (p = (f = e.ui) == null ? void 0 : f.sectionItem) == null ? void 0 : p.hover] });
59
+ return M(t).some((o) => o.key === e.activeKey);
64
60
  }
65
61
  function ee(t) {
66
- var o, r, u, d, m, v, f, p;
67
- const i = t.key === e.activeKey ? ["font-medium", (r = (o = e.ui) == null ? void 0 : o.childItem) == null ? void 0 : r.active] : ["text-default", (d = (u = e.ui) == null ? void 0 : u.childItem) == null ? void 0 : d.inactive];
68
- return a.childItem({ class: [(v = (m = e.ui) == null ? void 0 : m.childItem) == null ? void 0 : v.base, i, (p = (f = e.ui) == null ? void 0 : f.childItem) == null ? void 0 : p.hover] });
62
+ var i, r, u, d, m, v, f, p;
63
+ const o = P(t) ? ["font-medium", (r = (i = e.ui) == null ? void 0 : i.sectionItem) == null ? void 0 : r.active] : ["text-default", (d = (u = e.ui) == null ? void 0 : u.sectionItem) == null ? void 0 : d.inactive];
64
+ return a.sectionItem({ class: [(v = (m = e.ui) == null ? void 0 : m.sectionItem) == null ? void 0 : v.base, o, (p = (f = e.ui) == null ? void 0 : f.sectionItem) == null ? void 0 : p.hover] });
69
65
  }
70
66
  function te(t) {
71
- var o;
72
- const i = E(t);
73
- if (i.length === 1) {
74
- $("select", {
67
+ var i, r, u, d, m, v, f, p;
68
+ const o = t.key === e.activeKey ? ["font-medium", (r = (i = e.ui) == null ? void 0 : i.childItem) == null ? void 0 : r.active] : ["text-default", (d = (u = e.ui) == null ? void 0 : u.childItem) == null ? void 0 : d.inactive];
69
+ return a.childItem({ class: [(v = (m = e.ui) == null ? void 0 : m.childItem) == null ? void 0 : v.base, o, (p = (f = e.ui) == null ? void 0 : f.childItem) == null ? void 0 : p.hover] });
70
+ }
71
+ function ae(t) {
72
+ var i;
73
+ const o = M(t);
74
+ if (o.length === 1) {
75
+ A("select", {
75
76
  source: "direct",
76
- item: i[0],
77
+ item: o[0],
77
78
  sectionKey: t.key,
78
- groupKey: (o = t.groups[0]) == null ? void 0 : o.key
79
+ groupKey: (i = t.groups[0]) == null ? void 0 : i.key
79
80
  });
80
81
  return;
81
82
  }
82
- T.value = !1, F.value = t.key, $("section-select", t);
83
+ F.value = !1, E.value = t.key, A("section-select", t);
83
84
  }
84
- function ae() {
85
- T.value = !0, F.value = void 0;
85
+ function se() {
86
+ F.value = !0, E.value = void 0;
86
87
  }
87
- function se(t, i, o) {
88
- $("select", { source: "item", item: t, sectionKey: i, groupKey: o });
88
+ function le(t, o, i) {
89
+ A("select", { source: "item", item: t, sectionKey: o, groupKey: i });
89
90
  }
90
- return (t, i) => {
91
+ return (t, o) => {
91
92
  var u, d, m, v, f, p;
92
- const o = ne, r = le;
93
- return c(), g("aside", {
93
+ const i = ne, r = oe;
94
+ return c(), x("aside", {
94
95
  class: s(l(a).root({ class: (u = e.ui) == null ? void 0 : u.root }))
95
96
  }, [
96
97
  h("header", {
@@ -99,95 +100,96 @@ const xe = /* @__PURE__ */ ie({
99
100
  h("div", {
100
101
  class: s(l(a).logo({ class: (m = e.ui) == null ? void 0 : m.logo }))
101
102
  }, [
102
- M(t.$slots, "logo")
103
+ T(t.$slots, "logo")
103
104
  ], 2),
104
- e.searchGroups.length ? (c(), _(ve, {
105
+ e.searchGroups.length ? (c(), w(fe, {
105
106
  key: 0,
106
107
  groups: e.searchGroups,
107
108
  shortcut: e.shortcut,
108
109
  ui: (v = e.ui) == null ? void 0 : v.search,
109
- onSelect: i[0] || (i[0] = (b) => $("select", b))
110
+ onSelect: o[0] || (o[0] = (b) => A("select", b))
110
111
  }, {
111
- empty: C((b) => [
112
- M(t.$slots, "search-empty", re(ue(b)))
112
+ empty: $((b) => [
113
+ T(t.$slots, "search-empty", ue(de(b)))
113
114
  ]),
114
115
  _: 3
115
- }, 8, ["groups", "shortcut", "ui"])) : A("", !0)
116
+ }, 8, ["groups", "shortcut", "ui"])) : _("", !0)
116
117
  ], 2),
117
118
  h("nav", {
118
119
  class: s(l(a).viewport({ class: (f = e.ui) == null ? void 0 : f.viewport }))
119
120
  }, [
120
- G(de, {
121
+ G(me, {
121
122
  mode: "out-in",
122
123
  "enter-active-class": z.value.enterActive,
123
124
  "leave-active-class": z.value.leaveActive,
124
125
  "enter-from-class": z.value.enterFrom,
125
126
  "leave-to-class": z.value.leaveTo
126
127
  }, {
127
- default: C(() => {
128
- var b, B, U, D, R, j, q, J;
128
+ default: $(() => {
129
+ var b, S, U, D, R, j, q, J, O;
129
130
  return [
130
- w.value ? (c(), g("div", {
131
- key: w.value.key,
131
+ B.value ? (c(), x("div", {
132
+ key: B.value.key,
132
133
  class: s(l(a).panel({ class: (b = e.ui) == null ? void 0 : b.panel }))
133
134
  }, [
134
135
  h("div", {
135
- class: s(l(a).nestedHeader({ class: (B = e.ui) == null ? void 0 : B.nestedHeader }))
136
+ class: s(l(a).nestedHeader({ class: (S = e.ui) == null ? void 0 : S.nestedHeader }))
136
137
  }, [
137
138
  G(r, {
138
139
  "data-testid": "back-button",
139
140
  color: "neutral",
140
141
  variant: "ghost",
141
142
  class: s(l(a).backButton({ class: [(D = (U = e.ui) == null ? void 0 : U.backButton) == null ? void 0 : D.base, (j = (R = e.ui) == null ? void 0 : R.backButton) == null ? void 0 : j.hover] })),
142
- onClick: ae
143
+ onClick: se
143
144
  }, {
144
- default: C(() => {
145
- var n, x, y, I;
145
+ default: $(() => {
146
+ var n, y, I, g;
146
147
  return [
147
- G(o, {
148
+ G(i, {
148
149
  name: "solar:alt-arrow-left-linear",
149
- class: s(l(a).backButtonIcon({ class: (x = (n = e.ui) == null ? void 0 : n.backButton) == null ? void 0 : x.icon }))
150
+ class: s(l(a).backButtonIcon({ class: (y = (n = e.ui) == null ? void 0 : n.backButton) == null ? void 0 : y.icon }))
150
151
  }, null, 8, ["class"]),
151
152
  h("span", {
152
- class: s(l(a).backButtonLabel({ class: (I = (y = e.ui) == null ? void 0 : y.backButton) == null ? void 0 : I.label }))
153
- }, K(w.value.label), 3)
153
+ class: s(l(a).backButtonLabel({ class: (g = (I = e.ui) == null ? void 0 : I.backButton) == null ? void 0 : g.label }))
154
+ }, K(B.value.label), 3),
155
+ o[1] || (o[1] = h("span", { class: "size-4.5 shrink-0" }, null, -1))
154
156
  ];
155
157
  }),
156
158
  _: 1
157
159
  }, 8, ["class"])
158
160
  ], 2),
159
- (c(!0), g(H, null, N(w.value.groups, (n) => {
160
- var x, y, I;
161
- return c(), g("div", {
161
+ (c(!0), x(H, null, N(B.value.groups, (n) => {
162
+ var y, I, g;
163
+ return c(), x("div", {
162
164
  key: n.key,
163
- class: s(l(a).group({ class: (x = e.ui) == null ? void 0 : x.group }))
165
+ class: s(l(a).group({ class: (y = e.ui) == null ? void 0 : y.group }))
164
166
  }, [
165
- n.label ? (c(), g("p", {
167
+ n.label ? (c(), x("p", {
166
168
  key: 0,
167
- class: s(l(a).groupLabel({ class: (y = e.ui) == null ? void 0 : y.groupLabel }))
168
- }, K(n.label), 3)) : A("", !0),
169
+ class: s(l(a).groupLabel({ class: (I = e.ui) == null ? void 0 : I.groupLabel }))
170
+ }, K(n.label), 3)) : _("", !0),
169
171
  h("div", {
170
- class: s(l(a).childList({ class: (I = e.ui) == null ? void 0 : I.childList }))
172
+ class: s(l(a).childList({ class: (g = e.ui) == null ? void 0 : g.childList }))
171
173
  }, [
172
- (c(!0), g(H, null, N(n.items, (k) => (c(), _(r, {
174
+ (c(!0), x(H, null, N(n.items, (k) => (c(), w(r, {
173
175
  key: k.key,
174
176
  "data-testid": `item-${k.key}`,
175
177
  "data-active": k.key === e.activeKey,
176
178
  color: "neutral",
177
179
  variant: "ghost",
178
- class: s(ee(k)),
179
- onClick: (L) => se(k, w.value.key, n.key)
180
+ class: s(te(k)),
181
+ onClick: (L) => le(k, B.value.key, n.key)
180
182
  }, {
181
- default: C(() => {
182
- var L, S, O, Q;
183
+ default: $(() => {
184
+ var L, C, Q, W;
183
185
  return [
184
- k.icon ? (c(), _(o, {
186
+ k.icon ? (c(), w(i, {
185
187
  key: 0,
186
188
  name: k.icon,
187
- class: s(l(a).childItemLeadingIcon({ class: (S = (L = e.ui) == null ? void 0 : L.childItem) == null ? void 0 : S.leadingIcon }))
188
- }, null, 8, ["name", "class"])) : A("", !0),
189
+ class: s(l(a).childItemLeadingIcon({ class: (C = (L = e.ui) == null ? void 0 : L.childItem) == null ? void 0 : C.leadingIcon }))
190
+ }, null, 8, ["name", "class"])) : _("", !0),
189
191
  h("span", {
190
- class: s(l(a).childItemLabel({ class: (Q = (O = e.ui) == null ? void 0 : O.childItem) == null ? void 0 : Q.label }))
192
+ class: s(l(a).childItemLabel({ class: (W = (Q = e.ui) == null ? void 0 : Q.childItem) == null ? void 0 : W.label }))
191
193
  }, K(k.label), 3)
192
194
  ];
193
195
  }),
@@ -196,54 +198,61 @@ const xe = /* @__PURE__ */ ie({
196
198
  ], 2)
197
199
  ], 2);
198
200
  }), 128))
199
- ], 2)) : (c(), g("div", {
201
+ ], 2)) : (c(), x("div", {
200
202
  key: "root",
201
203
  class: s(l(a).panel({ class: (q = e.ui) == null ? void 0 : q.panel }))
202
204
  }, [
203
205
  h("div", {
204
206
  class: s(l(a).sectionList({ class: (J = e.ui) == null ? void 0 : J.sectionList }))
205
207
  }, [
206
- (c(!0), g(H, null, N(e.sections, (n) => (c(), _(r, {
208
+ (c(!0), x(H, null, N(e.sections, (n) => (c(), w(r, {
207
209
  key: n.key,
208
210
  "data-testid": `section-${n.key}`,
209
211
  "data-section": n.key,
210
212
  "data-active": P(n),
211
213
  color: "neutral",
212
214
  variant: "ghost",
213
- class: s(Z(n)),
214
- onClick: (x) => te(n)
215
+ class: s(ee(n)),
216
+ onClick: (y) => ae(n)
215
217
  }, {
216
- default: C(() => {
217
- var x, y, I, k, L, S;
218
+ default: $(() => {
219
+ var y, I, g, k, L, C;
218
220
  return [
219
- n.icon ? (c(), _(o, {
221
+ n.icon ? (c(), w(i, {
220
222
  key: 0,
221
223
  name: n.icon,
222
- class: s(l(a).sectionItemLeadingIcon({ class: (y = (x = e.ui) == null ? void 0 : x.sectionItem) == null ? void 0 : y.leadingIcon }))
223
- }, null, 8, ["name", "class"])) : A("", !0),
224
+ class: s(l(a).sectionItemLeadingIcon({ class: (I = (y = e.ui) == null ? void 0 : y.sectionItem) == null ? void 0 : I.leadingIcon }))
225
+ }, null, 8, ["name", "class"])) : _("", !0),
224
226
  h("span", {
225
- class: s(l(a).sectionItemLabel({ class: (k = (I = e.ui) == null ? void 0 : I.sectionItem) == null ? void 0 : k.label }))
227
+ class: s(l(a).sectionItemLabel({ class: (k = (g = e.ui) == null ? void 0 : g.sectionItem) == null ? void 0 : k.label }))
226
228
  }, K(n.label), 3),
227
- E(n).length > 1 ? (c(), _(o, {
229
+ M(n).length > 1 ? (c(), w(i, {
228
230
  key: 1,
229
231
  name: "solar:alt-arrow-right-linear",
230
- class: s(l(a).sectionItemTrailingIcon({ class: (S = (L = e.ui) == null ? void 0 : L.sectionItem) == null ? void 0 : S.trailingIcon }))
231
- }, null, 8, ["class"])) : A("", !0)
232
+ class: s(l(a).sectionItemTrailingIcon({ class: (C = (L = e.ui) == null ? void 0 : L.sectionItem) == null ? void 0 : C.trailingIcon }))
233
+ }, null, 8, ["class"])) : _("", !0)
232
234
  ];
233
235
  }),
234
236
  _: 2
235
237
  }, 1032, ["data-testid", "data-section", "data-active", "class", "onClick"]))), 128))
236
- ], 2)
238
+ ], 2),
239
+ t.$slots["root-footer"] ? (c(), x("div", {
240
+ key: 0,
241
+ "data-testid": "root-footer",
242
+ class: s(l(a).rootFooter({ class: (O = e.ui) == null ? void 0 : O.rootFooter }))
243
+ }, [
244
+ T(t.$slots, "root-footer")
245
+ ], 2)) : _("", !0)
237
246
  ], 2))
238
247
  ];
239
248
  }),
240
- _: 1
249
+ _: 3
241
250
  }, 8, ["enter-active-class", "leave-active-class", "enter-from-class", "leave-to-class"])
242
251
  ], 2),
243
252
  h("footer", {
244
253
  class: s(l(a).footer({ class: (p = e.ui) == null ? void 0 : p.footer }))
245
254
  }, [
246
- M(t.$slots, "footer")
255
+ T(t.$slots, "footer")
247
256
  ], 2)
248
257
  ], 2);
249
258
  };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as V, useModel as g, toRef as s, computed as h, openBlock as v, createBlock as S, mergeProps as y, unref as i, mergeModels as m } from "vue";
2
- import { _ as B } from "./SaberPopSelect.vue_vue_type_script_setup_true_lang-BcS27NXI.js";
2
+ import { _ as B } from "./SaberPopSelect.vue_vue_type_script_setup_true_lang-eH8jkkzK.js";
3
3
  import { u as D } from "./use-dict-options-DjtbYYIa.js";
4
4
  const C = /* @__PURE__ */ V({
5
5
  name: "SaberDictSelect",
@@ -0,0 +1,272 @@
1
+ import le from "@nuxt/ui/components/Popover.vue";
2
+ import ne from "@nuxt/ui/runtime/vue/components/Icon.vue";
3
+ import se from "@nuxt/ui/components/Input.vue";
4
+ import ae from "@nuxt/ui/components/Button.vue";
5
+ import { defineComponent as ie, useModel as ce, ref as x, inject as de, computed as a, onMounted as re, watch as K, nextTick as ue, openBlock as l, createBlock as k, withCtx as $, createVNode as U, createSlots as ve, createElementVNode as p, normalizeClass as b, toDisplayString as C, withModifiers as M, createElementBlock as i, Fragment as j, renderList as B, createCommentVNode as I, mergeModels as Q } from "vue";
6
+ import { D as me } from "./district-service-cOu1tbQG.js";
7
+ const fe = { class: "w-120 p-2 flex flex-col gap-2" }, pe = {
8
+ key: 0,
9
+ class: "max-h-64 overflow-y-auto flex flex-col gap-0.5"
10
+ }, he = ["onClick"], ye = { class: "flex-1 truncate" }, _e = {
11
+ key: 1,
12
+ class: "flex items-center justify-center h-10 text-sm text-muted"
13
+ }, ge = {
14
+ key: 1,
15
+ class: "flex divide-x divide-default border border-default rounded-sm overflow-hidden"
16
+ }, xe = { class: "flex-1 max-h-64 overflow-y-auto py-1 minimal-scrollbar" }, ke = ["onClick"], be = { class: "truncate" }, Ce = { class: "flex-1 max-h-64 overflow-y-auto py-1 minimal-scrollbar" }, we = ["onClick"], ze = { class: "truncate" }, Ve = {
17
+ key: 1,
18
+ class: "flex items-center justify-center h-full text-sm text-muted/50 py-4"
19
+ }, $e = { class: "flex-1 max-h-64 overflow-y-auto py-1 minimal-scrollbar" }, je = ["onClick"], Be = { class: "truncate" }, Ie = {
20
+ key: 1,
21
+ class: "flex items-center justify-center h-full text-sm text-muted/50 py-4"
22
+ }, Ee = /* @__PURE__ */ ie({
23
+ name: "SaberDistrictSelect",
24
+ __name: "SaberDistrictSelect",
25
+ props: /* @__PURE__ */ Q({
26
+ districts: {},
27
+ placeholder: { default: "请选择省 / 市 / 区" },
28
+ clearable: { type: Boolean, default: !0 },
29
+ disabled: { type: Boolean, default: !1 },
30
+ loading: { type: Boolean, default: void 0 },
31
+ size: { default: "lg" },
32
+ ui: {}
33
+ }, {
34
+ modelValue: { default: void 0 },
35
+ modelModifiers: {}
36
+ }),
37
+ emits: /* @__PURE__ */ Q(["change"], ["update:modelValue"]),
38
+ setup(y, { expose: T, emit: A }) {
39
+ const G = {
40
+ xs: "h-6",
41
+ sm: "h-8",
42
+ md: "h-9",
43
+ lg: "h-10"
44
+ }, m = y, L = A, s = ce(y, "modelValue"), w = x(!1), P = x(null), u = x(null), c = x(null), _ = x(""), n = de(me, void 0), S = a(() => m.districts === void 0), z = a(
45
+ () => m.districts ?? (n == null ? void 0 : n.districts.value) ?? []
46
+ ), V = a(
47
+ () => m.loading ?? (S.value ? (n == null ? void 0 : n.loading.value) ?? !1 : !1)
48
+ ), H = a(() => V.value ? "行政区加载中..." : m.placeholder);
49
+ async function E() {
50
+ if (!(!S.value || !n || n.districts.value.length))
51
+ try {
52
+ await n.load();
53
+ } catch (e) {
54
+ console.error("[SaberUI] Failed to load district data.", e);
55
+ }
56
+ }
57
+ re(() => void E()), K(() => m.districts, (e) => {
58
+ e === void 0 && E();
59
+ }), K(w, async (e) => {
60
+ var o, v, h;
61
+ if (!e) {
62
+ _.value = "";
63
+ return;
64
+ }
65
+ if (s.value) {
66
+ const f = z.value.find((g) => {
67
+ var t;
68
+ return g.adcode === ((t = s.value) == null ? void 0 : t.provinceCode);
69
+ }) ?? null;
70
+ u.value = f, c.value = ((o = f == null ? void 0 : f.districts) == null ? void 0 : o.find((g) => {
71
+ var t;
72
+ return g.adcode === ((t = s.value) == null ? void 0 : t.cityCode);
73
+ })) ?? null;
74
+ } else
75
+ u.value = null, c.value = null;
76
+ await ue(), (h = (v = P.value) == null ? void 0 : v.input) == null || h.focus();
77
+ });
78
+ const N = a(() => {
79
+ var e;
80
+ return ((e = u.value) == null ? void 0 : e.districts) ?? [];
81
+ }), R = a(() => {
82
+ var e;
83
+ return ((e = c.value) == null ? void 0 : e.districts) ?? [];
84
+ });
85
+ function J(e) {
86
+ u.value = e, c.value = null;
87
+ }
88
+ function W(e) {
89
+ c.value = e;
90
+ }
91
+ function X(e) {
92
+ !u.value || !c.value || O({
93
+ province: u.value.name,
94
+ provinceCode: u.value.adcode,
95
+ city: c.value.name,
96
+ cityCode: c.value.adcode,
97
+ district: e.name,
98
+ districtCode: e.adcode
99
+ });
100
+ }
101
+ const Y = a(() => {
102
+ const e = [];
103
+ for (const o of z.value)
104
+ for (const v of o.districts ?? [])
105
+ for (const h of v.districts ?? [])
106
+ e.push({
107
+ label: `${o.name} / ${v.name} / ${h.name}`,
108
+ province: o.name,
109
+ provinceCode: o.adcode,
110
+ city: v.name,
111
+ cityCode: v.adcode,
112
+ district: h.name,
113
+ districtCode: h.adcode
114
+ });
115
+ return e;
116
+ }), F = a(() => {
117
+ const e = _.value.trim();
118
+ return e ? Y.value.filter((o) => o.province.includes(e) || o.city.includes(e) || o.district.includes(e)).slice(0, 50) : [];
119
+ });
120
+ function O(e) {
121
+ s.value = e, L("change", e), w.value = !1;
122
+ }
123
+ function Z() {
124
+ s.value = void 0, u.value = null, c.value = null, L("change", void 0);
125
+ }
126
+ const ee = a(() => s.value ? `${s.value.province} / ${s.value.city} / ${s.value.district}` : H.value), q = a(() => s.value != null), te = a(() => _.value.trim().length > 0), oe = a(() => {
127
+ var e, o;
128
+ return {
129
+ ...m.ui,
130
+ base: [G[m.size], "rounded-sm justify-between", (e = m.ui) == null ? void 0 : e.base].filter(Boolean).join(" "),
131
+ trailingIcon: ["size-4", (o = m.ui) == null ? void 0 : o.trailingIcon].filter(Boolean).join(" ")
132
+ };
133
+ });
134
+ return T({
135
+ districts: z,
136
+ loading: V,
137
+ error: a(() => (n == null ? void 0 : n.error.value) ?? null),
138
+ reload: () => n == null ? void 0 : n.load(!0)
139
+ }), (e, o) => {
140
+ const v = ae, h = se, f = ne, g = le;
141
+ return l(), k(g, {
142
+ open: w.value,
143
+ "onUpdate:open": o[3] || (o[3] = (t) => w.value = t),
144
+ content: { align: "start", sideOffset: 4 }
145
+ }, {
146
+ content: $(() => [
147
+ p("div", fe, [
148
+ U(h, {
149
+ ref_key: "searchInputRef",
150
+ ref: P,
151
+ modelValue: _.value,
152
+ "onUpdate:modelValue": o[2] || (o[2] = (t) => _.value = t),
153
+ placeholder: "搜索省 / 市 / 区...",
154
+ ui: { base: "h-9", leadingIcon: "size-4" },
155
+ "leading-icon": "i-solar:minimalistic-magnifer-outline"
156
+ }, null, 8, ["modelValue"]),
157
+ te.value ? (l(), i("div", pe, [
158
+ F.value.length > 0 ? (l(!0), i(j, { key: 0 }, B(F.value, (t) => {
159
+ var d, r;
160
+ return l(), i("div", {
161
+ key: t.districtCode,
162
+ class: b(["flex items-center h-9 px-3 rounded-sm cursor-pointer select-none text-sm hover:bg-muted", ((d = s.value) == null ? void 0 : d.districtCode) === t.districtCode ? "bg-accented/70" : ""]),
163
+ onClick: (D) => O(t)
164
+ }, [
165
+ p("span", ye, C(t.label), 1),
166
+ ((r = s.value) == null ? void 0 : r.districtCode) === t.districtCode ? (l(), k(f, {
167
+ key: 0,
168
+ name: "i-lucide:check",
169
+ class: "size-4 shrink-0 ml-2 text-primary"
170
+ })) : I("", !0)
171
+ ], 10, he);
172
+ }), 128)) : (l(), i("div", _e, "无匹配结果"))
173
+ ])) : (l(), i("div", ge, [
174
+ p("div", xe, [
175
+ (l(!0), i(j, null, B(z.value, (t) => {
176
+ var d, r;
177
+ return l(), i("div", {
178
+ key: t.adcode,
179
+ class: b(["flex items-center justify-between h-9 px-3 cursor-pointer select-none text-sm", ((d = u.value) == null ? void 0 : d.adcode) === t.adcode ? "bg-accented/70" : "hover:bg-muted"]),
180
+ onClick: (D) => J(t)
181
+ }, [
182
+ p("span", be, C(t.name), 1),
183
+ ((r = u.value) == null ? void 0 : r.adcode) === t.adcode ? (l(), k(f, {
184
+ key: 0,
185
+ name: "i-lucide:chevron-right",
186
+ class: "size-4 shrink-0 ml-1 text-muted"
187
+ })) : I("", !0)
188
+ ], 10, ke);
189
+ }), 128))
190
+ ]),
191
+ p("div", Ce, [
192
+ N.value.length > 0 ? (l(!0), i(j, { key: 0 }, B(N.value, (t) => {
193
+ var d, r;
194
+ return l(), i("div", {
195
+ key: t.adcode,
196
+ class: b(["flex items-center justify-between h-9 px-3 cursor-pointer select-none text-sm", ((d = c.value) == null ? void 0 : d.adcode) === t.adcode ? "bg-accented/70" : "hover:bg-muted"]),
197
+ onClick: (D) => W(t)
198
+ }, [
199
+ p("span", ze, C(t.name), 1),
200
+ ((r = c.value) == null ? void 0 : r.adcode) === t.adcode ? (l(), k(f, {
201
+ key: 0,
202
+ name: "i-lucide:chevron-right",
203
+ class: "size-4 shrink-0 ml-1 text-muted"
204
+ })) : I("", !0)
205
+ ], 10, we);
206
+ }), 128)) : (l(), i("div", Ve, "请选择省份"))
207
+ ]),
208
+ p("div", $e, [
209
+ R.value.length > 0 ? (l(!0), i(j, { key: 0 }, B(R.value, (t) => {
210
+ var d, r;
211
+ return l(), i("div", {
212
+ key: t.adcode,
213
+ class: b(["flex items-center justify-between h-9 px-3 cursor-pointer select-none text-sm", ((d = s.value) == null ? void 0 : d.districtCode) === t.adcode ? "bg-accented/70" : "hover:bg-muted"]),
214
+ onClick: (D) => X(t)
215
+ }, [
216
+ p("span", Be, C(t.name), 1),
217
+ ((r = s.value) == null ? void 0 : r.districtCode) === t.adcode ? (l(), k(f, {
218
+ key: 0,
219
+ name: "i-lucide:check",
220
+ class: "size-3.5 shrink-0 ml-1 text-primary"
221
+ })) : I("", !0)
222
+ ], 10, je);
223
+ }), 128)) : (l(), i("div", Ie, "请选择城市"))
224
+ ])
225
+ ]))
226
+ ])
227
+ ]),
228
+ default: $(() => [
229
+ U(v, {
230
+ color: "neutral",
231
+ variant: "outline",
232
+ disabled: y.disabled || V.value,
233
+ loading: V.value,
234
+ size: y.size,
235
+ ui: oe.value,
236
+ "trailing-icon": "i-lucide:chevron-down",
237
+ class: "w-full saberButton"
238
+ }, ve({
239
+ default: $(() => [
240
+ p("span", {
241
+ class: b(["truncate", q.value ? "" : "text-muted/60 font-normal"])
242
+ }, C(ee.value), 3)
243
+ ]),
244
+ _: 2
245
+ }, [
246
+ q.value && y.clearable ? {
247
+ name: "trailing",
248
+ fn: $(() => [
249
+ U(v, {
250
+ color: "neutral",
251
+ variant: "ghost",
252
+ icon: "i-solar:close-circle-outline",
253
+ ui: { base: "p-1 min-w-0 -mr-1.5", leadingIcon: "size-4" },
254
+ onPointerdown: o[0] || (o[0] = M(() => {
255
+ }, ["stop", "prevent"])),
256
+ onMousedown: o[1] || (o[1] = M(() => {
257
+ }, ["stop", "prevent"])),
258
+ onClick: M(Z, ["stop", "prevent"])
259
+ })
260
+ ]),
261
+ key: "0"
262
+ } : void 0
263
+ ]), 1032, ["disabled", "loading", "size", "ui"])
264
+ ]),
265
+ _: 1
266
+ }, 8, ["open"]);
267
+ };
268
+ }
269
+ });
270
+ export {
271
+ Ee as _
272
+ };