@owocow/saber-ui 0.1.13 → 0.1.15
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.
- package/dist/SaberAppLayout.vue_vue_type_script_setup_true_lang-Hr4TdNqR.js +487 -0
- package/dist/{SaberDictSelect.vue_vue_type_script_setup_true_lang-B8PTKNKX.js → SaberDictSelect.vue_vue_type_script_setup_true_lang-BKdOdlFX.js} +1 -1
- package/dist/SaberDistrictSelect.vue_vue_type_script_setup_true_lang-jkl2AOay.js +272 -0
- package/dist/{SaberInfo.vue_vue_type_script_setup_true_lang-B3W5VsGR.js → SaberInfo.vue_vue_type_script_setup_true_lang-B_1ugpqI.js} +1 -1
- package/dist/SaberPopSelect.vue_vue_type_script_setup_true_lang-eH8jkkzK.js +162 -0
- package/dist/SaberSwitchBar.vue_vue_type_script_setup_true_lang-CIbFBx5r.js +47 -0
- package/dist/components/SaberAppLayout.mjs +1 -1
- package/dist/components/SaberInfo.mjs +1 -1
- package/dist/components/SaberPagination.vue.d.ts +48 -0
- package/dist/components/SaberSwitchBar.mjs +1 -1
- package/dist/components/layout/SaberAppLayout.types.d.ts +8 -0
- package/dist/components/layout/SaberAppLayout.vue.d.ts +5 -0
- package/dist/composables/index.d.ts +1 -1
- package/dist/composables/use-page-header.d.ts +3 -1
- package/dist/composables/use-page-header.mjs +27 -15
- package/dist/composables/use-table.d.ts +1 -0
- package/dist/composables/use-table.mjs +45 -42
- package/dist/composables.mjs +22 -20
- package/dist/control-size.d.ts +33 -0
- package/dist/forms/components/SaberFilterBar.vue.d.ts +3 -0
- package/dist/forms/components/SaberFormModal.vue.d.ts +2 -0
- package/dist/forms/components/fields/SaberDistrictSelect.vue.d.ts +5 -0
- package/dist/forms/components/fields/SaberInput.vue.d.ts +5 -0
- package/dist/forms/components/fields/SaberInputNumber.vue.d.ts +10 -2
- package/dist/forms/components/fields/SaberPopSelect.vue.d.ts +4 -1
- package/dist/forms/components/fields/SaberSelect.vue.d.ts +10 -2
- package/dist/forms/dict-select.mjs +1 -1
- package/dist/forms/district-select.mjs +1 -1
- package/dist/forms/index.d.ts +1 -0
- package/dist/forms/pop-select.mjs +1 -1
- package/dist/forms.mjs +4 -4
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +175 -98
- package/dist/plugin-Cg7MKH3t.js +438 -0
- package/package.json +1 -1
- package/dist/SaberAppLayout.vue_vue_type_script_setup_true_lang-R7F5K7kj.js +0 -418
- package/dist/SaberDistrictSelect.vue_vue_type_script_setup_true_lang-BX8nLC35.js +0 -257
- package/dist/SaberPopSelect.vue_vue_type_script_setup_true_lang-BcS27NXI.js +0 -125
- package/dist/SaberSwitchBar.vue_vue_type_script_setup_true_lang-CDx3Dcas.js +0 -47
- package/dist/plugin-Dr3z0YFg.js +0 -396
|
@@ -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
|
+
};
|
|
@@ -16,7 +16,7 @@ const q = /* @__PURE__ */ b({
|
|
|
16
16
|
gap: {}
|
|
17
17
|
},
|
|
18
18
|
setup(l) {
|
|
19
|
-
const a = l, e = k(E, void 0), s = t(() => a.leading ?? (e == null ? void 0 : e.value.leading)), d = t(() => a.truncate ?? (e == null ? void 0 : e.value.truncate) ?? !0), c = t(() => a.mode ?? (e == null ? void 0 : e.value.mode) ?? "default"), v = t(() => a.lineheight ?? (e == null ? void 0 : e.value.lineheight)), i = t(() => a.variant ?? (e == null ? void 0 : e.value.variant) ?? "horizontal"), n = t(() => a.gap ?? (e == null ? void 0 : e.value.gap)), f = t(() => c.value === "muted" ? "text-muted
|
|
19
|
+
const a = l, e = k(E, void 0), s = t(() => a.leading ?? (e == null ? void 0 : e.value.leading)), d = t(() => a.truncate ?? (e == null ? void 0 : e.value.truncate) ?? !0), c = t(() => a.mode ?? (e == null ? void 0 : e.value.mode) ?? "default"), v = t(() => a.lineheight ?? (e == null ? void 0 : e.value.lineheight)), i = t(() => a.variant ?? (e == null ? void 0 : e.value.variant) ?? "horizontal"), n = t(() => a.gap ?? (e == null ? void 0 : e.value.gap)), f = t(() => c.value === "muted" ? "text-muted" : c.value === "light" ? "text-dimmed" : ""), g = t(() => {
|
|
20
20
|
if (!(i.value !== "vertical" || n.value === void 0))
|
|
21
21
|
return { gap: typeof n.value == "number" ? `${n.value}px` : n.value };
|
|
22
22
|
});
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import M from "@nuxt/ui/components/Popover.vue";
|
|
2
|
+
import N from "@nuxt/ui/runtime/vue/components/Icon.vue";
|
|
3
|
+
import P from "@nuxt/ui/components/Button.vue";
|
|
4
|
+
import { defineComponent as U, useModel as E, ref as L, useAttrs as j, computed as i, openBlock as u, createBlock as x, withCtx as r, createVNode as y, mergeProps as $, unref as F, createSlots as R, createElementVNode as p, normalizeClass as z, toDisplayString as S, withModifiers as m, createElementBlock as v, Fragment as D, renderList as G, createCommentVNode as T, mergeModels as k } from "vue";
|
|
5
|
+
const Z = {
|
|
6
|
+
xs: {
|
|
7
|
+
height: "h-6",
|
|
8
|
+
square: "size-6",
|
|
9
|
+
paginationButtons: "[&_button]:h-6",
|
|
10
|
+
nuxtSize: "xs"
|
|
11
|
+
},
|
|
12
|
+
sm: {
|
|
13
|
+
height: "h-7",
|
|
14
|
+
square: "size-7",
|
|
15
|
+
paginationButtons: "[&_button]:h-7",
|
|
16
|
+
nuxtSize: "sm"
|
|
17
|
+
},
|
|
18
|
+
sl: {
|
|
19
|
+
height: "h-8",
|
|
20
|
+
square: "size-8",
|
|
21
|
+
paginationButtons: "[&_button]:h-8",
|
|
22
|
+
nuxtSize: "sm"
|
|
23
|
+
},
|
|
24
|
+
md: {
|
|
25
|
+
height: "h-9",
|
|
26
|
+
square: "size-9",
|
|
27
|
+
paginationButtons: "[&_button]:h-9",
|
|
28
|
+
nuxtSize: "md"
|
|
29
|
+
},
|
|
30
|
+
lg: {
|
|
31
|
+
height: "h-10",
|
|
32
|
+
square: "size-10",
|
|
33
|
+
paginationButtons: "[&_button]:h-10",
|
|
34
|
+
nuxtSize: "lg"
|
|
35
|
+
}
|
|
36
|
+
}, H = {
|
|
37
|
+
style: { width: "var(--reka-popper-anchor-width)" },
|
|
38
|
+
class: "p-2 max-h-60 overflow-y-auto flex flex-col gap-0.5"
|
|
39
|
+
}, J = ["onClick"], K = { class: "flex-1 truncate" }, Q = {
|
|
40
|
+
key: 1,
|
|
41
|
+
class: "flex items-center justify-center h-10 text-sm text-muted px-3"
|
|
42
|
+
}, ne = /* @__PURE__ */ U({
|
|
43
|
+
name: "SaberPopSelect",
|
|
44
|
+
inheritAttrs: !1,
|
|
45
|
+
__name: "SaberPopSelect",
|
|
46
|
+
props: /* @__PURE__ */ k({
|
|
47
|
+
items: { default: () => [] },
|
|
48
|
+
placeholder: { default: "请选择" },
|
|
49
|
+
multiple: { type: Boolean, default: !1 },
|
|
50
|
+
clearable: { type: Boolean, default: !0 },
|
|
51
|
+
disabled: { type: Boolean, default: !1 },
|
|
52
|
+
size: { default: "lg" }
|
|
53
|
+
}, {
|
|
54
|
+
modelValue: {},
|
|
55
|
+
modelModifiers: {}
|
|
56
|
+
}),
|
|
57
|
+
emits: /* @__PURE__ */ k(["change"], ["update:modelValue"]),
|
|
58
|
+
setup(s, { emit: B }) {
|
|
59
|
+
const l = s, c = B, n = E(s, "modelValue"), d = L(!1), h = j(), f = i(() => Z[l.size]), w = i(() => ({
|
|
60
|
+
base: `${f.value.height} rounded-sm justify-between`,
|
|
61
|
+
trailingIcon: "size-4"
|
|
62
|
+
}));
|
|
63
|
+
function g(t) {
|
|
64
|
+
return l.multiple ? Array.isArray(n.value) && n.value.includes(t.value) : n.value === t.value;
|
|
65
|
+
}
|
|
66
|
+
function A(t) {
|
|
67
|
+
if (!t.disabled) {
|
|
68
|
+
if (l.multiple) {
|
|
69
|
+
const e = Array.isArray(n.value) ? [...n.value] : [], a = e.indexOf(t.value);
|
|
70
|
+
a === -1 ? e.push(t.value) : e.splice(a, 1), n.value = e, c("change", e);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
n.value = t.value, d.value = !1, c("change", t.value);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function C() {
|
|
77
|
+
const t = l.multiple ? [] : void 0;
|
|
78
|
+
n.value = t, c("change", t);
|
|
79
|
+
}
|
|
80
|
+
const b = i(() => {
|
|
81
|
+
if (l.multiple) {
|
|
82
|
+
const e = Array.isArray(n.value) ? n.value : [];
|
|
83
|
+
return l.items.filter((a) => e.includes(a.value)).map((a) => a.label);
|
|
84
|
+
}
|
|
85
|
+
const t = l.items.find((e) => e.value === n.value);
|
|
86
|
+
return t ? [t.label] : [];
|
|
87
|
+
}), V = i(() => b.value.length > 0 ? b.value.join(", ") : l.placeholder), _ = i(() => l.multiple ? Array.isArray(n.value) && n.value.length > 0 : n.value != null && n.value !== ""), O = i(() => {
|
|
88
|
+
const { class: t, ...e } = h;
|
|
89
|
+
return e;
|
|
90
|
+
});
|
|
91
|
+
return (t, e) => {
|
|
92
|
+
const a = P, q = N, I = M;
|
|
93
|
+
return u(), x(I, {
|
|
94
|
+
open: d.value,
|
|
95
|
+
"onUpdate:open": e[2] || (e[2] = (o) => d.value = o),
|
|
96
|
+
content: { align: "start", sideOffset: 4 }
|
|
97
|
+
}, {
|
|
98
|
+
content: r(() => [
|
|
99
|
+
p("div", H, [
|
|
100
|
+
s.items.length > 0 ? (u(!0), v(D, { key: 0 }, G(s.items, (o) => (u(), v("div", {
|
|
101
|
+
key: String(o.value),
|
|
102
|
+
class: z(["flex items-center h-10 px-3 rounded-sm select-none text-sm", [
|
|
103
|
+
o.disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
104
|
+
g(o) ? "bg-accented/70" : o.disabled ? "" : "hover:bg-muted"
|
|
105
|
+
]]),
|
|
106
|
+
onClick: (W) => A(o)
|
|
107
|
+
}, [
|
|
108
|
+
p("span", K, S(o.label), 1),
|
|
109
|
+
g(o) ? (u(), x(q, {
|
|
110
|
+
key: 0,
|
|
111
|
+
name: "i-lucide:check",
|
|
112
|
+
class: "size-4 shrink-0 ml-2"
|
|
113
|
+
})) : T("", !0)
|
|
114
|
+
], 10, J))), 128)) : (u(), v("div", Q, "暂无数据"))
|
|
115
|
+
])
|
|
116
|
+
]),
|
|
117
|
+
default: r(() => [
|
|
118
|
+
y(a, $({
|
|
119
|
+
color: "neutral",
|
|
120
|
+
variant: "outline",
|
|
121
|
+
disabled: s.disabled,
|
|
122
|
+
size: f.value.nuxtSize,
|
|
123
|
+
ui: w.value,
|
|
124
|
+
"trailing-icon": "i-lucide:chevron-down"
|
|
125
|
+
}, O.value, {
|
|
126
|
+
class: F(h).class || "w-full"
|
|
127
|
+
}), R({
|
|
128
|
+
default: r(() => [
|
|
129
|
+
p("span", {
|
|
130
|
+
class: z(["truncate", _.value ? "" : "text-muted/60 font-normal"])
|
|
131
|
+
}, S(V.value), 3)
|
|
132
|
+
]),
|
|
133
|
+
_: 2
|
|
134
|
+
}, [
|
|
135
|
+
_.value && s.clearable ? {
|
|
136
|
+
name: "trailing",
|
|
137
|
+
fn: r(() => [
|
|
138
|
+
y(a, {
|
|
139
|
+
color: "neutral",
|
|
140
|
+
variant: "ghost",
|
|
141
|
+
icon: "i-solar:close-circle-outline",
|
|
142
|
+
ui: { base: "p-1 min-w-0 -mr-1.5", leadingIcon: "size-4" },
|
|
143
|
+
onPointerdown: e[0] || (e[0] = m(() => {
|
|
144
|
+
}, ["stop", "prevent"])),
|
|
145
|
+
onMousedown: e[1] || (e[1] = m(() => {
|
|
146
|
+
}, ["stop", "prevent"])),
|
|
147
|
+
onClick: m(C, ["stop", "prevent"])
|
|
148
|
+
})
|
|
149
|
+
]),
|
|
150
|
+
key: "0"
|
|
151
|
+
} : void 0
|
|
152
|
+
]), 1040, ["disabled", "size", "ui", "class"])
|
|
153
|
+
]),
|
|
154
|
+
_: 1
|
|
155
|
+
}, 8, ["open"]);
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
export {
|
|
160
|
+
Z as S,
|
|
161
|
+
ne as _
|
|
162
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { defineComponent as p, useModel as b, computed as f, openBlock as r, createElementBlock as i, normalizeClass as a, createElementVNode as s, Fragment as h, renderList as w, toDisplayString as x, mergeModels as c } from "vue";
|
|
2
|
+
const g = ["onClick"], C = /* @__PURE__ */ p({
|
|
3
|
+
name: "SaberSwitchBar",
|
|
4
|
+
__name: "SaberSwitchBar",
|
|
5
|
+
props: /* @__PURE__ */ c({
|
|
6
|
+
tabs: {},
|
|
7
|
+
ui: { default: () => ({}) }
|
|
8
|
+
}, {
|
|
9
|
+
modelValue: { required: !0 },
|
|
10
|
+
modelModifiers: {}
|
|
11
|
+
}),
|
|
12
|
+
emits: /* @__PURE__ */ c(["change"], ["update:modelValue"]),
|
|
13
|
+
setup(o, { emit: u }) {
|
|
14
|
+
const d = o, m = u, n = b(o, "modelValue"), e = f(() => ({
|
|
15
|
+
root: "rounded-full bg-accented/80 p-1.25",
|
|
16
|
+
scroller: "w-full overflow-x-auto touch-pan-x [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",
|
|
17
|
+
list: "inline-flex w-max min-w-max items-center gap-1",
|
|
18
|
+
tab: "shrink-0 whitespace-nowrap rounded-full px-4 py-2.5 text-sm leading-none transition-colors duration-100",
|
|
19
|
+
tabActive: "bg-primary text-white font-bold cursor-default",
|
|
20
|
+
tabInactive: "text-muted hover:text-default cursor-pointer font-bold",
|
|
21
|
+
...d.ui
|
|
22
|
+
}));
|
|
23
|
+
function v(t) {
|
|
24
|
+
n.value !== t && (n.value = t, m("change", t));
|
|
25
|
+
}
|
|
26
|
+
return (t, k) => (r(), i("div", {
|
|
27
|
+
class: a(e.value.root)
|
|
28
|
+
}, [
|
|
29
|
+
s("div", {
|
|
30
|
+
class: a(e.value.scroller)
|
|
31
|
+
}, [
|
|
32
|
+
s("div", {
|
|
33
|
+
class: a(e.value.list)
|
|
34
|
+
}, [
|
|
35
|
+
(r(!0), i(h, null, w(o.tabs, (l) => (r(), i("span", {
|
|
36
|
+
key: String(l.value),
|
|
37
|
+
class: a([e.value.tab, n.value === l.value ? e.value.tabActive : e.value.tabInactive]),
|
|
38
|
+
onClick: (S) => v(l.value)
|
|
39
|
+
}, x(l.label), 11, g))), 128))
|
|
40
|
+
], 2)
|
|
41
|
+
], 2)
|
|
42
|
+
], 2));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
export {
|
|
46
|
+
C as _
|
|
47
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
type SaberPaginationComponentUI = Record<string, string | undefined>;
|
|
2
|
+
interface SaberPaginationUI {
|
|
3
|
+
root?: string;
|
|
4
|
+
info?: string;
|
|
5
|
+
total?: string;
|
|
6
|
+
tips?: string;
|
|
7
|
+
controls?: string;
|
|
8
|
+
pageSize?: string;
|
|
9
|
+
pageSizeUi?: SaberPaginationComponentUI;
|
|
10
|
+
pagination?: string;
|
|
11
|
+
paginationUi?: SaberPaginationComponentUI;
|
|
12
|
+
}
|
|
13
|
+
type __VLS_Props = {
|
|
14
|
+
page?: number;
|
|
15
|
+
pageSize?: number;
|
|
16
|
+
total: number;
|
|
17
|
+
pageSizes?: number[];
|
|
18
|
+
size?: string;
|
|
19
|
+
ui?: SaberPaginationUI;
|
|
20
|
+
};
|
|
21
|
+
declare function __VLS_template(): {
|
|
22
|
+
attrs: Partial<{}>;
|
|
23
|
+
slots: {
|
|
24
|
+
tips?(_: {}): any;
|
|
25
|
+
};
|
|
26
|
+
refs: {};
|
|
27
|
+
rootEl: HTMLDivElement;
|
|
28
|
+
};
|
|
29
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
30
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
31
|
+
"update:page": (value: number) => any;
|
|
32
|
+
"update:pageSize": (value: number) => any;
|
|
33
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
34
|
+
"onUpdate:page"?: ((value: number) => any) | undefined;
|
|
35
|
+
"onUpdate:pageSize"?: ((value: number) => any) | undefined;
|
|
36
|
+
}>, {
|
|
37
|
+
page: number;
|
|
38
|
+
pageSize: number;
|
|
39
|
+
pageSizes: number[];
|
|
40
|
+
size: string;
|
|
41
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
42
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
43
|
+
export default _default;
|
|
44
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
45
|
+
new (): {
|
|
46
|
+
$slots: S;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -7,6 +7,7 @@ export interface SaberAppLayoutProps {
|
|
|
7
7
|
title?: string;
|
|
8
8
|
description?: string;
|
|
9
9
|
maxWidth?: SaberAppLayoutMaxWidth;
|
|
10
|
+
showHeader?: boolean;
|
|
10
11
|
navigationKey?: string | number;
|
|
11
12
|
sidebarWidth?: number | string;
|
|
12
13
|
phoneBreakpoint?: number;
|
|
@@ -32,9 +33,16 @@ export interface SaberAppLayoutUI {
|
|
|
32
33
|
desktopSidebar?: string;
|
|
33
34
|
main?: string;
|
|
34
35
|
header?: string;
|
|
36
|
+
headerInner?: string;
|
|
35
37
|
headerHeading?: string;
|
|
38
|
+
headerTitle?: string;
|
|
36
39
|
title?: string;
|
|
40
|
+
headerTitleSuffix?: string;
|
|
41
|
+
headerTitleSeparator?: string;
|
|
42
|
+
pageHeaderTitleSuffixTarget?: string;
|
|
43
|
+
headerDescription?: string;
|
|
37
44
|
description?: string;
|
|
45
|
+
pageHeaderDescriptionTarget?: string;
|
|
38
46
|
headerSuffix?: string;
|
|
39
47
|
pageHeaderSuffixTarget?: string;
|
|
40
48
|
content?: string;
|
|
@@ -35,6 +35,8 @@ declare function __VLS_template(): {
|
|
|
35
35
|
dock?: (props: SaberAppLayoutNavigationSlotContext) => unknown;
|
|
36
36
|
};
|
|
37
37
|
refs: {
|
|
38
|
+
titleSuffixTarget: HTMLDivElement;
|
|
39
|
+
descriptionTarget: HTMLDivElement;
|
|
38
40
|
suffixTarget: HTMLDivElement;
|
|
39
41
|
menuButton: unknown;
|
|
40
42
|
};
|
|
@@ -54,6 +56,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
|
|
|
54
56
|
description: string;
|
|
55
57
|
ui: import('./SaberAppLayout.types').SaberAppLayoutUI;
|
|
56
58
|
maxWidth: import('./SaberAppLayout.types').SaberAppLayoutMaxWidth;
|
|
59
|
+
showHeader: boolean;
|
|
57
60
|
navigationKey: string | number;
|
|
58
61
|
sidebarWidth: number | string;
|
|
59
62
|
phoneBreakpoint: number;
|
|
@@ -66,6 +69,8 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
|
|
|
66
69
|
menuOpenIcon: string;
|
|
67
70
|
menuCloseIcon: string;
|
|
68
71
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
72
|
+
titleSuffixTarget: HTMLDivElement;
|
|
73
|
+
descriptionTarget: HTMLDivElement;
|
|
69
74
|
suffixTarget: HTMLDivElement;
|
|
70
75
|
menuButton: unknown;
|
|
71
76
|
}, HTMLDivElement>;
|
|
@@ -8,7 +8,7 @@ export { useSkeleton } from './use-skeleton';
|
|
|
8
8
|
export { useDelayUnmount } from './use-delay-unmount';
|
|
9
9
|
export { useAddressParse } from './use-address-parse';
|
|
10
10
|
export type { UseAddressParseResult } from './use-address-parse';
|
|
11
|
-
export { providePageHeader, usePageHeader, usePageHeaderSuffix } from './use-page-header';
|
|
11
|
+
export { providePageHeader, usePageHeader, usePageHeaderDescription, usePageHeaderSuffix, usePageHeaderTitleSuffix, } from './use-page-header';
|
|
12
12
|
export type { PageHeaderOptions, PageHeaderState } from './use-page-header';
|
|
13
13
|
export { normalizeTableResponse, useTable } from './use-table';
|
|
14
14
|
export type { ApiFn, ApiParams, MaybePromise, NormalizedTableResponse, PaginationConfig, TableConfig, TableDataWithIndex, TablePagination, } from './use-table';
|
|
@@ -7,9 +7,11 @@ export interface PageHeaderOptions {
|
|
|
7
7
|
title?: MaybeRefOrGetter<string | undefined>;
|
|
8
8
|
description?: MaybeRefOrGetter<string | undefined>;
|
|
9
9
|
}
|
|
10
|
-
export declare function providePageHeader(suffixTarget: Ref<HTMLElement | null>): {
|
|
10
|
+
export declare function providePageHeader(suffixTarget: Ref<HTMLElement | null>, descriptionTarget?: Ref<HTMLElement | null>, titleSuffixTarget?: Ref<HTMLElement | null>): {
|
|
11
11
|
title?: string | undefined;
|
|
12
12
|
description?: string | undefined;
|
|
13
13
|
};
|
|
14
14
|
export declare function usePageHeader(options: PageHeaderOptions): void;
|
|
15
15
|
export declare function usePageHeaderSuffix(): Ref<HTMLElement | null, HTMLElement | null>;
|
|
16
|
+
export declare function usePageHeaderDescription(): Ref<HTMLElement | null, HTMLElement | null>;
|
|
17
|
+
export declare function usePageHeaderTitleSuffix(): Ref<HTMLElement | null, HTMLElement | null>;
|