@owocow/saber-ui 0.1.13 → 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.
- package/dist/{SaberAppLayout.vue_vue_type_script_setup_true_lang-R7F5K7kj.js → SaberAppLayout.vue_vue_type_script_setup_true_lang-DaxscIFe.js} +2 -2
- 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/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/SaberPagination.vue.d.ts +49 -0
- package/dist/components/SaberSwitchBar.mjs +1 -1
- 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 +176 -98
- package/dist/plugin-DvH6j00c.js +442 -0
- package/package.json +1 -1
- 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
|
@@ -121,7 +121,7 @@ const nt = /* @__PURE__ */ je({
|
|
|
121
121
|
main: "relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-y-auto rounded-lg border border-default bg-default",
|
|
122
122
|
header: "sticky top-0 z-10 mx-auto flex w-full shrink-0 items-center justify-between gap-4 overflow-hidden bg-default/70 backdrop-blur-md",
|
|
123
123
|
headerHeading: "min-w-0",
|
|
124
|
-
title: "truncate text-xl",
|
|
124
|
+
title: "truncate text-xl font-medium",
|
|
125
125
|
description: "mt-1 text-sm text-muted",
|
|
126
126
|
headerSuffix: "flex shrink-0 items-center gap-2",
|
|
127
127
|
pageHeaderSuffixTarget: "contents",
|
|
@@ -164,7 +164,7 @@ const nt = /* @__PURE__ */ je({
|
|
|
164
164
|
() => e.maxWidth === void 0 || typeof e.maxWidth == "number" && (!Number.isFinite(e.maxWidth) || e.maxWidth <= 0)
|
|
165
165
|
), J = u(
|
|
166
166
|
() => Q.value ? { maxWidth: Q.value } : void 0
|
|
167
|
-
), X = u(() => ce.value ? "min-[1921px]:max-w-[
|
|
167
|
+
), X = u(() => ce.value ? "min-[1921px]:max-w-[1684px]" : void 0), pe = u(() => typeof e.sidebarWidth == "number" ? Number.isFinite(e.sidebarWidth) && e.sidebarWidth > 0 ? `${e.sidebarWidth}px` : "240px" : e.sidebarWidth.trim() || "240px"), fe = u(() => ({ "--saber-app-layout-sidebar-width": pe.value })), me = { width: "var(--saber-app-layout-sidebar-width)" }, ve = { width: "var(--saber-app-layout-sidebar-width)" }, P = `saber-app-layout-navigation-${Ie().replaceAll(":", "")}`, Y = ae(null);
|
|
168
168
|
function F(a) {
|
|
169
169
|
return typeof a == "object" && a !== null && !Array.isArray(a);
|
|
170
170
|
}
|
|
@@ -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-
|
|
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
|
+
};
|
|
@@ -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,49 @@
|
|
|
1
|
+
import { SaberControlSize } from '../control-size';
|
|
2
|
+
type SaberPaginationComponentUI = Record<string, string | undefined>;
|
|
3
|
+
interface SaberPaginationUI {
|
|
4
|
+
root?: string;
|
|
5
|
+
info?: string;
|
|
6
|
+
total?: string;
|
|
7
|
+
tips?: string;
|
|
8
|
+
controls?: string;
|
|
9
|
+
pageSize?: string;
|
|
10
|
+
pageSizeUi?: SaberPaginationComponentUI;
|
|
11
|
+
pagination?: string;
|
|
12
|
+
paginationUi?: SaberPaginationComponentUI;
|
|
13
|
+
}
|
|
14
|
+
type __VLS_Props = {
|
|
15
|
+
page?: number;
|
|
16
|
+
pageSize?: number;
|
|
17
|
+
total: number;
|
|
18
|
+
pageSizes?: number[];
|
|
19
|
+
size?: SaberControlSize;
|
|
20
|
+
ui?: SaberPaginationUI;
|
|
21
|
+
};
|
|
22
|
+
declare function __VLS_template(): {
|
|
23
|
+
attrs: Partial<{}>;
|
|
24
|
+
slots: {
|
|
25
|
+
tips?(_: {}): any;
|
|
26
|
+
};
|
|
27
|
+
refs: {};
|
|
28
|
+
rootEl: HTMLDivElement;
|
|
29
|
+
};
|
|
30
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
31
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
32
|
+
"update:page": (value: number) => any;
|
|
33
|
+
"update:pageSize": (value: number) => any;
|
|
34
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
35
|
+
"onUpdate:page"?: ((value: number) => any) | undefined;
|
|
36
|
+
"onUpdate:pageSize"?: ((value: number) => any) | undefined;
|
|
37
|
+
}>, {
|
|
38
|
+
page: number;
|
|
39
|
+
pageSize: number;
|
|
40
|
+
pageSizes: number[];
|
|
41
|
+
size: SaberControlSize;
|
|
42
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
43
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
44
|
+
export default _default;
|
|
45
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
46
|
+
new (): {
|
|
47
|
+
$slots: S;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const SABER_CONTROL_SIZE_CONFIG: {
|
|
2
|
+
readonly xs: {
|
|
3
|
+
readonly height: "h-6";
|
|
4
|
+
readonly square: "size-6";
|
|
5
|
+
readonly paginationButtons: "[&_button]:h-6";
|
|
6
|
+
readonly nuxtSize: "xs";
|
|
7
|
+
};
|
|
8
|
+
readonly sm: {
|
|
9
|
+
readonly height: "h-7";
|
|
10
|
+
readonly square: "size-7";
|
|
11
|
+
readonly paginationButtons: "[&_button]:h-7";
|
|
12
|
+
readonly nuxtSize: "sm";
|
|
13
|
+
};
|
|
14
|
+
readonly sl: {
|
|
15
|
+
readonly height: "h-8";
|
|
16
|
+
readonly square: "size-8";
|
|
17
|
+
readonly paginationButtons: "[&_button]:h-8";
|
|
18
|
+
readonly nuxtSize: "sm";
|
|
19
|
+
};
|
|
20
|
+
readonly md: {
|
|
21
|
+
readonly height: "h-9";
|
|
22
|
+
readonly square: "size-9";
|
|
23
|
+
readonly paginationButtons: "[&_button]:h-9";
|
|
24
|
+
readonly nuxtSize: "md";
|
|
25
|
+
};
|
|
26
|
+
readonly lg: {
|
|
27
|
+
readonly height: "h-10";
|
|
28
|
+
readonly square: "size-10";
|
|
29
|
+
readonly paginationButtons: "[&_button]:h-10";
|
|
30
|
+
readonly nuxtSize: "lg";
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type SaberControlSize = keyof typeof SABER_CONTROL_SIZE_CONFIG;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { SaberControlSize } from '../../control-size';
|
|
1
2
|
import { FilterField } from '../types';
|
|
2
3
|
type __VLS_Props = {
|
|
3
4
|
fields: FilterField[];
|
|
4
5
|
/** 与该值相同的字段视为未筛选。 */
|
|
5
6
|
initialParams?: Record<string, unknown> | null;
|
|
7
|
+
size?: SaberControlSize;
|
|
6
8
|
};
|
|
7
9
|
type __VLS_PublicProps = {
|
|
8
10
|
modelValue?: Record<string, unknown>;
|
|
@@ -30,6 +32,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
|
|
|
30
32
|
onReset?: (() => any) | undefined;
|
|
31
33
|
onRefresh?: (() => any) | undefined;
|
|
32
34
|
}>, {
|
|
35
|
+
size: SaberControlSize;
|
|
33
36
|
initialParams: Record<string, unknown> | null;
|
|
34
37
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
35
38
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SaberControlSize } from '../../control-size';
|
|
1
2
|
import { FormField, FormSubmitHandler, FormValidator } from '../types';
|
|
2
3
|
declare const _default: <T extends Record<string, unknown>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
4
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
@@ -17,6 +18,7 @@ declare const _default: <T extends Record<string, unknown>>(__VLS_props: NonNull
|
|
|
17
18
|
cancelLabel?: string;
|
|
18
19
|
submitLabel?: string;
|
|
19
20
|
closeOnSuccess?: boolean;
|
|
21
|
+
fieldSize?: SaberControlSize;
|
|
20
22
|
}) & Partial<{}>> & import('vue').PublicProps;
|
|
21
23
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
22
24
|
attrs: any;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { DistrictNode, DistrictValue } from '../../types';
|
|
2
|
+
type SaberDistrictSelectSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
3
|
+
type SaberDistrictSelectUI = Record<string, string | undefined>;
|
|
2
4
|
type __VLS_Props = {
|
|
3
5
|
districts?: readonly DistrictNode[];
|
|
4
6
|
placeholder?: string;
|
|
5
7
|
clearable?: boolean;
|
|
6
8
|
disabled?: boolean;
|
|
7
9
|
loading?: boolean;
|
|
10
|
+
size?: SaberDistrictSelectSize;
|
|
11
|
+
ui?: SaberDistrictSelectUI;
|
|
8
12
|
};
|
|
9
13
|
type __VLS_PublicProps = {
|
|
10
14
|
modelValue?: DistrictValue | undefined;
|
|
@@ -23,6 +27,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
|
23
27
|
}>, {
|
|
24
28
|
loading: boolean;
|
|
25
29
|
placeholder: string;
|
|
30
|
+
size: SaberDistrictSelectSize;
|
|
26
31
|
disabled: boolean;
|
|
27
32
|
clearable: boolean;
|
|
28
33
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|