@owocow/saber-ui 0.0.2 → 0.0.3
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/README.md +206 -11
- package/dist/BadgeStatus.types.d.ts +1 -1
- package/dist/BadgeStatus.vue.d.ts +1 -1
- package/dist/SaberConfirmModal.vue_vue_type_script_setup_true_lang-Cqp9krYl.js +86 -0
- package/dist/SaberConfirmProvider.vue_vue_type_script_setup_true_lang-DUJ6ftNJ.js +30 -0
- package/dist/SaberDictCheckbox.vue_vue_type_script_setup_true_lang-DUbzy_C6.js +34 -0
- package/dist/SaberDictRadio.vue_vue_type_script_setup_true_lang-DR6-jSID.js +50 -0
- package/dist/SaberDictSelect.vue_vue_type_script_setup_true_lang-B8PTKNKX.js +35 -0
- package/dist/SaberDistrictSelect.vue_vue_type_script_setup_true_lang-BX8nLC35.js +257 -0
- package/dist/SaberInfo.vue_vue_type_script_setup_true_lang-B3W5VsGR.js +58 -0
- package/dist/SaberInfoProvider.vue_vue_type_script_setup_true_lang-3rF6bSCn.js +28 -0
- package/dist/SaberModal.vue_vue_type_script_setup_true_lang-DJno3jA3.js +71 -0
- package/dist/SaberModalWithMobile.vue_vue_type_script_setup_true_lang-aQlToncY.js +87 -0
- package/dist/SaberNoData.types.d.ts +11 -0
- package/dist/SaberNoData.vue.d.ts +24 -0
- package/dist/SaberPopSelect.vue_vue_type_script_setup_true_lang-BcS27NXI.js +125 -0
- package/dist/SaberStatus.vue_vue_type_script_setup_true_lang-D9aRVCow.js +38 -0
- package/dist/SaberSwitchBar.vue_vue_type_script_setup_true_lang-CDx3Dcas.js +47 -0
- package/dist/SaberUploadImage.vue_vue_type_script_setup_true_lang-CAwci2Vr.js +224 -0
- package/dist/colors.d.ts +1 -1
- package/dist/components/SaberConfirmModal.mjs +4 -0
- package/dist/components/SaberConfirmModal.vue.d.ts +28 -0
- package/dist/components/SaberConfirmProvider.mjs +4 -0
- package/dist/components/SaberConfirmProvider.vue.d.ts +2 -0
- package/dist/components/SaberInfo.mjs +4 -0
- package/dist/components/SaberInfo.types.d.ts +14 -0
- package/dist/components/SaberInfo.vue.d.ts +21 -0
- package/dist/components/SaberInfoProvider.mjs +4 -0
- package/dist/components/SaberInfoProvider.vue.d.ts +20 -0
- package/dist/components/SaberModalWithMobile.mjs +4 -0
- package/dist/components/SaberModalWithMobile.vue.d.ts +36 -0
- package/dist/components/SaberStatus.mjs +4 -0
- package/dist/components/SaberStatus.types.d.ts +1 -0
- package/dist/components/SaberStatus.vue.d.ts +8 -0
- package/dist/components/SaberSwitchBar.mjs +4 -0
- package/dist/components/SaberSwitchBar.types.d.ts +13 -0
- package/dist/components/SaberSwitchBar.vue.d.ts +18 -0
- package/dist/components/info-context.d.ts +3 -0
- package/dist/composables/index.d.ts +12 -0
- package/dist/composables/use-address-parse.d.ts +15 -0
- package/dist/composables/use-address-parse.mjs +20 -0
- package/dist/composables/use-boolean.d.ts +8 -0
- package/dist/composables/use-boolean.mjs +20 -0
- package/dist/composables/use-confirm.d.ts +34 -0
- package/dist/composables/use-confirm.mjs +28 -0
- package/dist/composables/use-delay-unmount.d.ts +7 -0
- package/dist/composables/use-delay-unmount.mjs +26 -0
- package/dist/composables/use-delete.d.ts +13 -0
- package/dist/composables/use-delete.mjs +19 -0
- package/dist/composables/use-loading.d.ts +6 -0
- package/dist/composables/use-loading.mjs +8 -0
- package/dist/composables/use-skeleton.d.ts +5 -0
- package/dist/composables/use-skeleton.mjs +23 -0
- package/dist/composables/use-table.d.ts +57 -0
- package/dist/composables/use-table.mjs +87 -0
- package/dist/composables.mjs +21 -0
- package/dist/district-service-cOu1tbQG.js +147 -0
- package/dist/district.d.ts +3 -0
- package/dist/district.mjs +8 -0
- package/dist/forms/components/SaberFilterBar.vue.d.ts +41 -0
- package/dist/forms/components/SaberFormModal.vue.d.ts +31 -0
- package/dist/forms/components/SaberModal.vue.d.ts +34 -0
- package/dist/forms/components/fields/SaberDictCheckbox.vue.d.ts +24 -0
- package/dist/forms/components/fields/SaberDictRadio.vue.d.ts +24 -0
- package/dist/forms/components/fields/SaberDictSelect.vue.d.ts +28 -0
- package/dist/forms/components/fields/SaberDistrictSelect.vue.d.ts +31 -0
- package/dist/forms/components/fields/SaberInput.vue.d.ts +16 -0
- package/dist/forms/components/fields/SaberInputNumber.vue.d.ts +11 -0
- package/dist/forms/components/fields/SaberPopSelect.vue.d.ts +25 -0
- package/dist/forms/components/fields/SaberRadioGroup.vue.d.ts +11 -0
- package/dist/forms/components/fields/SaberSelect.vue.d.ts +11 -0
- package/dist/forms/components/fields/SaberTextarea.vue.d.ts +11 -0
- package/dist/forms/components/fields/SaberUploadImage.vue.d.ts +113 -0
- package/dist/forms/dict-checkbox.mjs +4 -0
- package/dist/forms/dict-radio.mjs +4 -0
- package/dist/forms/dict-select.mjs +4 -0
- package/dist/forms/dict-source.d.ts +3 -0
- package/dist/forms/district-select.mjs +4 -0
- package/dist/forms/district-service.d.ts +46 -0
- package/dist/forms/filter-state.d.ts +4 -0
- package/dist/forms/index.d.ts +24 -0
- package/dist/forms/plugin.d.ts +20 -0
- package/dist/forms/pop-select.mjs +4 -0
- package/dist/forms/presets/basic.d.ts +5 -0
- package/dist/forms/registry.d.ts +15 -0
- package/dist/forms/types.d.ts +102 -0
- package/dist/forms/upload-image-source.d.ts +3 -0
- package/dist/forms/upload-image.mjs +4 -0
- package/dist/forms/use-dict-options.d.ts +8 -0
- package/dist/forms.mjs +45 -0
- package/dist/index.d.ts +62 -1
- package/dist/index.mjs +122 -33
- package/dist/info-context-MfOfJNDT.js +4 -0
- package/dist/plugin-Dr3z0YFg.js +396 -0
- package/dist/types/api.d.ts +30 -0
- package/dist/types/auth.d.ts +54 -0
- package/dist/types/common.d.ts +14 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.mjs +1 -0
- package/dist/upload-image-source-On8NHgmx.js +4 -0
- package/dist/use-dict-options-DjtbYYIa.js +38 -0
- package/dist/utils/addressParse.d.ts +37 -0
- package/dist/utils/addressParse.mjs +623 -0
- package/dist/utils/crypto.d.ts +11 -0
- package/dist/utils/crypto.mjs +36 -0
- package/dist/utils/filter.d.ts +20 -0
- package/dist/utils/filter.mjs +11 -0
- package/dist/utils/format.d.ts +9 -0
- package/dist/utils/format.mjs +7 -0
- package/dist/utils/http.d.ts +45 -0
- package/dist/utils/http.mjs +147 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.mjs +41 -0
- package/dist/utils/klona.d.ts +2 -0
- package/dist/utils/klona.mjs +4 -0
- package/dist/utils/nanoid.d.ts +2 -0
- package/dist/utils/nanoid.mjs +4 -0
- package/dist/utils/permission.d.ts +45 -0
- package/dist/utils/permission.mjs +38 -0
- package/dist/utils/rsa.d.ts +26 -0
- package/dist/utils/rsa.mjs +2073 -0
- package/dist/utils/storage.d.ts +29 -0
- package/dist/utils/storage.mjs +39 -0
- package/dist/utils/toast.d.ts +26 -0
- package/dist/utils/toast.mjs +17 -0
- package/dist/utils/tree.d.ts +20 -0
- package/dist/utils/tree.mjs +30 -0
- package/package.json +179 -9
- package/dist/index.cjs +0 -1
- package/dist/vite.cjs +0 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import i from "@nuxt/ui/components/Badge.vue";
|
|
2
|
+
import { defineComponent as b, computed as r, openBlock as m, createBlock as f, normalizeClass as g } from "vue";
|
|
3
|
+
const v = /* @__PURE__ */ b({
|
|
4
|
+
name: "SaberStatus",
|
|
5
|
+
__name: "SaberStatus",
|
|
6
|
+
props: {
|
|
7
|
+
value: {},
|
|
8
|
+
config: {}
|
|
9
|
+
},
|
|
10
|
+
setup(l) {
|
|
11
|
+
const o = l, s = {
|
|
12
|
+
success: "bg-emerald-500/15 text-emerald-600",
|
|
13
|
+
info: "bg-violet-500/15 text-violet-600",
|
|
14
|
+
warning: "bg-amber-500/15 text-amber-600",
|
|
15
|
+
error: "bg-rose-500/15 text-rose-600",
|
|
16
|
+
danger: "bg-rose-500/15 text-rose-600",
|
|
17
|
+
secondary: "bg-sky-500/15 text-sky-600"
|
|
18
|
+
}, a = r(() => {
|
|
19
|
+
const e = String(o.value);
|
|
20
|
+
for (const n of o.config) {
|
|
21
|
+
const [t, p, u] = n.split(":");
|
|
22
|
+
if (p === e) return { label: t, statusType: u ?? "info" };
|
|
23
|
+
}
|
|
24
|
+
return { label: e, statusType: "info" };
|
|
25
|
+
}), c = r(() => s[a.value.statusType] ?? s.info);
|
|
26
|
+
return (e, n) => {
|
|
27
|
+
const t = i;
|
|
28
|
+
return m(), f(t, {
|
|
29
|
+
class: g([c.value, "rounded-full border-0 pt-0.75 pb-0.75 px-2"]),
|
|
30
|
+
variant: "soft",
|
|
31
|
+
label: a.value.label
|
|
32
|
+
}, null, 8, ["class", "label"]);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
export {
|
|
37
|
+
v as _
|
|
38
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { defineComponent as b, useModel as p, computed as f, openBlock as n, createElementBlock as i, normalizeClass as l, createElementVNode as s, Fragment as h, renderList as x, toDisplayString as g, mergeModels as c } from "vue";
|
|
2
|
+
const w = ["onClick"], C = /* @__PURE__ */ b({
|
|
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, r = p(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-(--saber-bg) dark:text-default font-bold cursor-default",
|
|
20
|
+
tabInactive: "text-muted hover:text-primary cursor-pointer font-bold",
|
|
21
|
+
...d.ui
|
|
22
|
+
}));
|
|
23
|
+
function v(t) {
|
|
24
|
+
r.value !== t && (r.value = t, m("change", t));
|
|
25
|
+
}
|
|
26
|
+
return (t, k) => (n(), i("div", {
|
|
27
|
+
class: l(e.value.root)
|
|
28
|
+
}, [
|
|
29
|
+
s("div", {
|
|
30
|
+
class: l(e.value.scroller)
|
|
31
|
+
}, [
|
|
32
|
+
s("div", {
|
|
33
|
+
class: l(e.value.list)
|
|
34
|
+
}, [
|
|
35
|
+
(n(!0), i(h, null, x(o.tabs, (a) => (n(), i("span", {
|
|
36
|
+
key: String(a.value),
|
|
37
|
+
class: l([e.value.tab, r.value === a.value ? e.value.tabActive : e.value.tabInactive]),
|
|
38
|
+
onClick: (y) => v(a.value)
|
|
39
|
+
}, g(a.label), 11, w))), 128))
|
|
40
|
+
], 2)
|
|
41
|
+
], 2)
|
|
42
|
+
], 2));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
export {
|
|
46
|
+
C as _
|
|
47
|
+
};
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import q from "@nuxt/ui/components/FileUpload.vue";
|
|
2
|
+
import G from "@nuxt/ui/components/Button.vue";
|
|
3
|
+
import H from "@nuxt/ui/runtime/vue/components/Icon.vue";
|
|
4
|
+
import { defineComponent as J, useModel as Q, inject as X, computed as y, ref as C, watch as D, onBeforeUnmount as Y, openBlock as m, createElementBlock as p, Fragment as Z, renderList as ee, normalizeClass as te, createCommentVNode as h, toDisplayString as re, createVNode as oe, createElementVNode as ne, createBlock as $, mergeModels as A } from "vue";
|
|
5
|
+
import { nanoid as M } from "nanoid";
|
|
6
|
+
import { getToast as K } from "./utils/toast.mjs";
|
|
7
|
+
import { U as ae } from "./upload-image-source-On8NHgmx.js";
|
|
8
|
+
const le = { class: "saber-upload-image flex flex-wrap gap-2" }, ie = ["src", "alt"], se = {
|
|
9
|
+
key: 1,
|
|
10
|
+
class: "absolute inset-0 flex items-center justify-center bg-black/50 text-xs text-white"
|
|
11
|
+
}, ue = {
|
|
12
|
+
key: 2,
|
|
13
|
+
class: "bg-error/60 absolute inset-0 flex flex-col items-center justify-center gap-1 text-white"
|
|
14
|
+
}, be = /* @__PURE__ */ J({
|
|
15
|
+
name: "SaberUploadImage",
|
|
16
|
+
__name: "SaberUploadImage",
|
|
17
|
+
props: /* @__PURE__ */ A({
|
|
18
|
+
dataSource: { default: void 0 },
|
|
19
|
+
multiple: { type: Boolean, default: !1 },
|
|
20
|
+
max: { default: void 0 },
|
|
21
|
+
maxSize: { default: 5 },
|
|
22
|
+
accept: { default: "image/*" },
|
|
23
|
+
disabled: { type: Boolean, default: !1 },
|
|
24
|
+
size: { default: "size-24" }
|
|
25
|
+
}, {
|
|
26
|
+
modelValue: { default: null },
|
|
27
|
+
modelModifiers: {}
|
|
28
|
+
}),
|
|
29
|
+
emits: /* @__PURE__ */ A(["success", "error", "progress", "removeError"], ["update:modelValue"]),
|
|
30
|
+
setup(f, { expose: L, emit: N }) {
|
|
31
|
+
const s = f, I = Q(f, "modelValue"), g = N, F = X(ae, void 0), x = y(() => s.dataSource ?? F), S = y(() => s.max ?? (s.multiple ? 9 : 1)), l = C([]), U = y(() => l.value.filter((t) => t.status !== "error").length);
|
|
32
|
+
let z = !1;
|
|
33
|
+
function E() {
|
|
34
|
+
if (x.value) return x.value;
|
|
35
|
+
z || (z = !0, console.warn(
|
|
36
|
+
"[SaberUI] Upload image data source is not configured. Pass forms.uploadImageDataSource to app.use(SaberUI) or provide a dataSource prop."
|
|
37
|
+
));
|
|
38
|
+
}
|
|
39
|
+
function V(t) {
|
|
40
|
+
t.startsWith("blob:") && URL.revokeObjectURL(t);
|
|
41
|
+
}
|
|
42
|
+
function B(t) {
|
|
43
|
+
var e;
|
|
44
|
+
(e = t.controller) == null || e.abort(), V(t.url);
|
|
45
|
+
}
|
|
46
|
+
function k() {
|
|
47
|
+
l.value.forEach(B);
|
|
48
|
+
}
|
|
49
|
+
function R(t) {
|
|
50
|
+
return t == null ? [] : Array.isArray(t) ? t : [t];
|
|
51
|
+
}
|
|
52
|
+
function P(t, e) {
|
|
53
|
+
var r;
|
|
54
|
+
return {
|
|
55
|
+
uid: M(),
|
|
56
|
+
key: e.getKey(t),
|
|
57
|
+
name: ((r = e.getName) == null ? void 0 : r.call(e, t)) ?? "",
|
|
58
|
+
status: "success",
|
|
59
|
+
percent: 100,
|
|
60
|
+
url: e.getUrl(t),
|
|
61
|
+
value: t,
|
|
62
|
+
origin: "initial",
|
|
63
|
+
removing: !1
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
let w = !1;
|
|
67
|
+
D(
|
|
68
|
+
[I, x],
|
|
69
|
+
([t, e]) => {
|
|
70
|
+
if (w || !e) return;
|
|
71
|
+
const r = R(t), u = l.value.filter((i) => i.status === "success"), c = r.map((i) => e.getKey(i));
|
|
72
|
+
if (u.length === r.length && u.every((i, a) => i.key === c[a])) return;
|
|
73
|
+
const n = l.value.filter((i) => i.status !== "success");
|
|
74
|
+
l.value = [...r.map((i) => P(i, e)), ...n];
|
|
75
|
+
},
|
|
76
|
+
{ immediate: !0, deep: !0 }
|
|
77
|
+
);
|
|
78
|
+
function _() {
|
|
79
|
+
const t = l.value.filter((r) => r.status === "success" && r.value !== void 0).map((r) => r.value), e = s.multiple ? t : t[0] ?? null;
|
|
80
|
+
return w = !0, I.value = e, Promise.resolve().then(() => {
|
|
81
|
+
w = !1;
|
|
82
|
+
}), e;
|
|
83
|
+
}
|
|
84
|
+
const v = C(null);
|
|
85
|
+
async function O(t) {
|
|
86
|
+
var o;
|
|
87
|
+
if (!t.length) return;
|
|
88
|
+
const e = E();
|
|
89
|
+
if (!e) {
|
|
90
|
+
K().add({ title: "上传服务未配置", color: "error" });
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const r = K(), u = s.multiple ? S.value - U.value : 1;
|
|
94
|
+
if (s.multiple && u <= 0) {
|
|
95
|
+
r.add({ title: `最多只能上传 ${S.value} 张图片`, color: "warning" });
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const c = [];
|
|
99
|
+
for (const n of t) {
|
|
100
|
+
if (!n.type.startsWith("image/")) {
|
|
101
|
+
r.add({ title: `${n.name} 不是图片格式`, color: "warning" });
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (n.size > s.maxSize * 1024 * 1024) {
|
|
105
|
+
r.add({ title: `${n.name} 超过 ${s.maxSize}MB`, color: "warning" });
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (c.push(n), c.length >= u) break;
|
|
109
|
+
}
|
|
110
|
+
if (c.length) {
|
|
111
|
+
s.multiple || (k(), l.value = []);
|
|
112
|
+
for (const n of c) {
|
|
113
|
+
const i = new AbortController(), a = {
|
|
114
|
+
uid: M(),
|
|
115
|
+
name: n.name,
|
|
116
|
+
status: "uploading",
|
|
117
|
+
percent: 0,
|
|
118
|
+
url: URL.createObjectURL(n),
|
|
119
|
+
origin: "uploaded",
|
|
120
|
+
removing: !1,
|
|
121
|
+
controller: i
|
|
122
|
+
};
|
|
123
|
+
l.value.push(a);
|
|
124
|
+
try {
|
|
125
|
+
const d = await e.upload(n, {
|
|
126
|
+
signal: i.signal,
|
|
127
|
+
onProgress(j) {
|
|
128
|
+
a.percent = j, g("progress", j, n);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
if (i.signal.aborted) continue;
|
|
132
|
+
V(a.url), a.key = e.getKey(d), a.name = ((o = e.getName) == null ? void 0 : o.call(e, d)) ?? n.name, a.url = e.getUrl(d), a.value = d, a.status = "success", a.percent = 100, a.controller = void 0;
|
|
133
|
+
const b = _();
|
|
134
|
+
g("success", b);
|
|
135
|
+
} catch (d) {
|
|
136
|
+
if (i.signal.aborted) continue;
|
|
137
|
+
const b = d instanceof Error ? d : new Error(String(d));
|
|
138
|
+
a.status = "error", a.error = b.message, a.controller = void 0, g("error", b, n);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
D(v, (t) => {
|
|
144
|
+
if (t == null) return;
|
|
145
|
+
const e = Array.isArray(t) ? t : [t];
|
|
146
|
+
e.length && (v.value = s.multiple ? [] : null, O([...e]));
|
|
147
|
+
});
|
|
148
|
+
async function T(t) {
|
|
149
|
+
var c;
|
|
150
|
+
const e = l.value.findIndex((o) => o.uid === t);
|
|
151
|
+
if (e < 0) return;
|
|
152
|
+
const r = l.value[e];
|
|
153
|
+
if (r.removing) return;
|
|
154
|
+
(c = r.controller) == null || c.abort();
|
|
155
|
+
const u = E();
|
|
156
|
+
if (r.status === "success" && r.value !== void 0 && (u != null && u.remove)) {
|
|
157
|
+
r.removing = !0;
|
|
158
|
+
try {
|
|
159
|
+
await u.remove(r.value, { origin: r.origin });
|
|
160
|
+
} catch (o) {
|
|
161
|
+
const n = o instanceof Error ? o : new Error(String(o));
|
|
162
|
+
g("removeError", n, r.value);
|
|
163
|
+
} finally {
|
|
164
|
+
r.removing = !1;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
B(r), l.value.splice(e, 1), _();
|
|
168
|
+
}
|
|
169
|
+
const W = y(() => s.disabled ? !1 : s.multiple ? U.value < S.value : U.value === 0);
|
|
170
|
+
return Y(k), L({
|
|
171
|
+
items: l,
|
|
172
|
+
/** 只清理本地状态和 model,不调用远程 remove。 */
|
|
173
|
+
clear() {
|
|
174
|
+
k(), l.value = [], _();
|
|
175
|
+
}
|
|
176
|
+
}), (t, e) => {
|
|
177
|
+
const r = H, u = G, c = q;
|
|
178
|
+
return m(), p("div", le, [
|
|
179
|
+
(m(!0), p(Z, null, ee(l.value, (o) => (m(), p("div", {
|
|
180
|
+
key: o.uid,
|
|
181
|
+
class: te(["group bg-elevated border-default relative overflow-hidden rounded-md border", f.size])
|
|
182
|
+
}, [
|
|
183
|
+
o.url ? (m(), p("img", {
|
|
184
|
+
key: 0,
|
|
185
|
+
src: o.url,
|
|
186
|
+
alt: o.name,
|
|
187
|
+
class: "h-full w-full object-cover"
|
|
188
|
+
}, null, 8, ie)) : h("", !0),
|
|
189
|
+
o.status === "uploading" ? (m(), p("div", se, re(o.percent) + "% ", 1)) : o.status === "error" ? (m(), p("div", ue, [
|
|
190
|
+
oe(r, {
|
|
191
|
+
name: "i-mdi-alert-circle",
|
|
192
|
+
class: "size-5"
|
|
193
|
+
}),
|
|
194
|
+
e[1] || (e[1] = ne("span", { class: "text-[10px]" }, "上传失败", -1))
|
|
195
|
+
])) : h("", !0),
|
|
196
|
+
!f.disabled && o.status !== "uploading" ? (m(), $(u, {
|
|
197
|
+
key: 3,
|
|
198
|
+
type: "button",
|
|
199
|
+
icon: "i-lucide:x",
|
|
200
|
+
"aria-label": `移除 ${o.name || "图片"}`,
|
|
201
|
+
loading: o.removing,
|
|
202
|
+
class: "absolute top-1 right-1 flex size-5 items-center justify-center rounded-full bg-black/60 text-white opacity-0 transition group-hover:opacity-100",
|
|
203
|
+
ui: { leadingIcon: "size-3.5" },
|
|
204
|
+
onClick: (n) => T(o.uid)
|
|
205
|
+
}, null, 8, ["aria-label", "loading", "onClick"])) : h("", !0)
|
|
206
|
+
], 2))), 128)),
|
|
207
|
+
W.value ? (m(), $(c, {
|
|
208
|
+
key: 0,
|
|
209
|
+
modelValue: v.value,
|
|
210
|
+
"onUpdate:modelValue": e[0] || (e[0] = (o) => v.value = o),
|
|
211
|
+
multiple: f.multiple,
|
|
212
|
+
accept: f.accept,
|
|
213
|
+
disabled: f.disabled,
|
|
214
|
+
preview: !1,
|
|
215
|
+
ui: { base: "border-accented cursor-pointer", root: "size-23.5" },
|
|
216
|
+
icon: "i-solar:upload-minimalistic-outline"
|
|
217
|
+
}, null, 8, ["modelValue", "multiple", "accept", "disabled"])) : h("", !0)
|
|
218
|
+
]);
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
export {
|
|
223
|
+
be as _
|
|
224
|
+
};
|
package/dist/colors.d.ts
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @see https://tailwindcss.com/docs/colors
|
|
8
8
|
*/
|
|
9
|
-
export declare function colorHex(color: string, shade:
|
|
9
|
+
export declare function colorHex(color: string, shade: 500 | 600): string;
|
|
10
10
|
export declare function hexToRgba(hex: string, opacity: number): string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
name?: string;
|
|
3
|
+
icon?: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
confirmLoading?: boolean;
|
|
7
|
+
type?: 'default' | 'delete';
|
|
8
|
+
confirmText?: string;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_PublicProps = {
|
|
11
|
+
'open'?: boolean;
|
|
12
|
+
} & __VLS_Props;
|
|
13
|
+
declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
14
|
+
confirm: () => any;
|
|
15
|
+
cancel: () => any;
|
|
16
|
+
"update:open": (value: boolean) => any;
|
|
17
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
18
|
+
onConfirm?: (() => any) | undefined;
|
|
19
|
+
onCancel?: (() => any) | undefined;
|
|
20
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
21
|
+
}>, {
|
|
22
|
+
type: "default" | "delete";
|
|
23
|
+
icon: string;
|
|
24
|
+
title: string;
|
|
25
|
+
description: string;
|
|
26
|
+
confirmLoading: boolean;
|
|
27
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type SaberInfoMode = 'light' | 'muted' | 'default';
|
|
2
|
+
export type SaberInfoVariant = 'horizontal' | 'vertical';
|
|
3
|
+
export interface SaberInfoContext {
|
|
4
|
+
leading?: string;
|
|
5
|
+
truncate?: boolean;
|
|
6
|
+
lineheight?: string;
|
|
7
|
+
mode?: SaberInfoMode;
|
|
8
|
+
variant?: SaberInfoVariant;
|
|
9
|
+
gap?: string | number;
|
|
10
|
+
}
|
|
11
|
+
export interface SaberInfoProps extends SaberInfoContext {
|
|
12
|
+
label?: string;
|
|
13
|
+
tips?: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SaberInfoProps } from './SaberInfo.types';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: {
|
|
5
|
+
default?(_: {}): any;
|
|
6
|
+
};
|
|
7
|
+
refs: {};
|
|
8
|
+
rootEl: HTMLDListElement;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
11
|
+
declare const __VLS_component: import('vue').DefineComponent<SaberInfoProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<SaberInfoProps> & Readonly<{}>, {
|
|
12
|
+
label: string;
|
|
13
|
+
tips: string;
|
|
14
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDListElement>;
|
|
15
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
16
|
+
export default _default;
|
|
17
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
18
|
+
new (): {
|
|
19
|
+
$slots: S;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SaberInfoContext } from './SaberInfo.types';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: {
|
|
5
|
+
default?(_: {}): any;
|
|
6
|
+
};
|
|
7
|
+
refs: {};
|
|
8
|
+
rootEl: any;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
11
|
+
declare const __VLS_component: import('vue').DefineComponent<SaberInfoContext, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<SaberInfoContext> & Readonly<{}>, {
|
|
12
|
+
truncate: boolean;
|
|
13
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
15
|
+
export default _default;
|
|
16
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
17
|
+
new (): {
|
|
18
|
+
$slots: S;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
title?: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
width?: string;
|
|
5
|
+
showClose?: boolean;
|
|
6
|
+
mobileBreakpoint?: number;
|
|
7
|
+
};
|
|
8
|
+
type __VLS_PublicProps = {
|
|
9
|
+
'open'?: boolean;
|
|
10
|
+
} & __VLS_Props;
|
|
11
|
+
declare function __VLS_template(): {
|
|
12
|
+
attrs: Partial<{}>;
|
|
13
|
+
slots: {
|
|
14
|
+
default?(_: {}): any;
|
|
15
|
+
default?(_: {}): any;
|
|
16
|
+
};
|
|
17
|
+
refs: {};
|
|
18
|
+
rootEl: any;
|
|
19
|
+
};
|
|
20
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
21
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
22
|
+
"update:open": (value: boolean) => any;
|
|
23
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
24
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
25
|
+
}>, {
|
|
26
|
+
width: string;
|
|
27
|
+
showClose: boolean;
|
|
28
|
+
mobileBreakpoint: number;
|
|
29
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
30
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
31
|
+
export default _default;
|
|
32
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
33
|
+
new (): {
|
|
34
|
+
$slots: S;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SaberStatusType = 'success' | 'error' | 'danger' | 'info' | 'warning' | 'secondary';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** 当前值,与 config 中的 value 段匹配。 */
|
|
3
|
+
value: string | number;
|
|
4
|
+
/** label:value[:statusType] 格式,如 上架:0:success。 */
|
|
5
|
+
config: string[];
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type SaberSwitchBarValue = string | number | null;
|
|
2
|
+
export interface SaberSwitchBarItem {
|
|
3
|
+
label: string;
|
|
4
|
+
value: SaberSwitchBarValue;
|
|
5
|
+
}
|
|
6
|
+
export interface SaberSwitchBarUI {
|
|
7
|
+
root: string;
|
|
8
|
+
scroller: string;
|
|
9
|
+
list: string;
|
|
10
|
+
tab: string;
|
|
11
|
+
tabActive: string;
|
|
12
|
+
tabInactive: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SaberSwitchBarItem, SaberSwitchBarUI, SaberSwitchBarValue } from './SaberSwitchBar.types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
tabs: SaberSwitchBarItem[];
|
|
4
|
+
ui?: Partial<SaberSwitchBarUI>;
|
|
5
|
+
};
|
|
6
|
+
type __VLS_PublicProps = {
|
|
7
|
+
modelValue: SaberSwitchBarValue;
|
|
8
|
+
} & __VLS_Props;
|
|
9
|
+
declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
10
|
+
change: (value: SaberSwitchBarValue) => any;
|
|
11
|
+
"update:modelValue": (value: SaberSwitchBarValue) => any;
|
|
12
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
13
|
+
onChange?: ((value: SaberSwitchBarValue) => any) | undefined;
|
|
14
|
+
"onUpdate:modelValue"?: ((value: SaberSwitchBarValue) => any) | undefined;
|
|
15
|
+
}>, {
|
|
16
|
+
ui: Partial<SaberSwitchBarUI>;
|
|
17
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { useBoolean } from './use-boolean';
|
|
2
|
+
export { useLoading } from './use-loading';
|
|
3
|
+
export { settleConfirm, useConfirm, useConfirmState } from './use-confirm';
|
|
4
|
+
export type { ConfirmOptions, ConfirmState } from './use-confirm';
|
|
5
|
+
export { useDelete } from './use-delete';
|
|
6
|
+
export type { UseDeleteOptions } from './use-delete';
|
|
7
|
+
export { useSkeleton } from './use-skeleton';
|
|
8
|
+
export { useDelayUnmount } from './use-delay-unmount';
|
|
9
|
+
export { useAddressParse } from './use-address-parse';
|
|
10
|
+
export type { UseAddressParseResult } from './use-address-parse';
|
|
11
|
+
export { normalizeTableResponse, useTable } from './use-table';
|
|
12
|
+
export type { ApiFn, ApiParams, MaybePromise, NormalizedTableResponse, PaginationConfig, TableConfig, TableDataWithIndex, TablePagination, } from './use-table';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Ref, ShallowRef } from 'vue';
|
|
2
|
+
import { DistrictNode } from '../forms/types';
|
|
3
|
+
import { AddressParseResult } from '../utils/addressParse';
|
|
4
|
+
export interface UseAddressParseResult {
|
|
5
|
+
readonly districts: Readonly<ShallowRef<readonly DistrictNode[]>>;
|
|
6
|
+
readonly loading: Readonly<Ref<boolean>>;
|
|
7
|
+
readonly error: Readonly<ShallowRef<unknown>>;
|
|
8
|
+
loadDistricts(force?: boolean): Promise<readonly DistrictNode[]>;
|
|
9
|
+
parseAddress(address: string, parseAll?: boolean): Promise<AddressParseResult[]>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 使用 SaberUI 安装时配置的共享行政区划数据解析地址。
|
|
13
|
+
* 首次解析会等待地区数据加载,后续解析复用数据索引。
|
|
14
|
+
*/
|
|
15
|
+
export declare function useAddressParse(): UseAddressParseResult;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { u as c } from "../district-service-cOu1tbQG.js";
|
|
2
|
+
import { createAddressParser as d } from "../utils/addressParse.mjs";
|
|
3
|
+
function u() {
|
|
4
|
+
const r = c();
|
|
5
|
+
let s, t;
|
|
6
|
+
async function i(a, o = !1) {
|
|
7
|
+
const e = await r.load();
|
|
8
|
+
return (!s || t !== e) && (s = d(e), t = e), s.parse(a, o);
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
districts: r.districts,
|
|
12
|
+
loading: r.loading,
|
|
13
|
+
error: r.error,
|
|
14
|
+
loadDistricts: r.load,
|
|
15
|
+
parseAddress: i
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
u as useAddressParse
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ref as r } from "vue";
|
|
2
|
+
function a(t = !1) {
|
|
3
|
+
const o = r(t);
|
|
4
|
+
function e(l) {
|
|
5
|
+
o.value = l;
|
|
6
|
+
}
|
|
7
|
+
function n() {
|
|
8
|
+
e(!0);
|
|
9
|
+
}
|
|
10
|
+
function u() {
|
|
11
|
+
e(!1);
|
|
12
|
+
}
|
|
13
|
+
function f() {
|
|
14
|
+
e(!o.value);
|
|
15
|
+
}
|
|
16
|
+
return { bool: o, setBool: e, setTrue: n, setFalse: u, toggle: f };
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
a as useBoolean
|
|
20
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface ConfirmOptions {
|
|
2
|
+
title?: string;
|
|
3
|
+
message?: string;
|
|
4
|
+
icon?: string;
|
|
5
|
+
type?: 'default' | 'delete';
|
|
6
|
+
confirmText?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ConfirmState {
|
|
9
|
+
open: boolean;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
title: string;
|
|
12
|
+
message: string;
|
|
13
|
+
icon: string;
|
|
14
|
+
type: 'default' | 'delete';
|
|
15
|
+
confirmText: string | undefined;
|
|
16
|
+
resolve: ((confirmed: boolean) => void) | null;
|
|
17
|
+
}
|
|
18
|
+
export declare function useConfirmState(): {
|
|
19
|
+
open: boolean;
|
|
20
|
+
loading: boolean;
|
|
21
|
+
title: string;
|
|
22
|
+
message: string;
|
|
23
|
+
icon: string;
|
|
24
|
+
type: "default" | "delete";
|
|
25
|
+
confirmText: string | undefined;
|
|
26
|
+
resolve: ((confirmed: boolean) => void) | null;
|
|
27
|
+
};
|
|
28
|
+
/** 完成当前确认请求,并清理旧的 Promise resolver。 */
|
|
29
|
+
export declare function settleConfirm(confirmed: boolean): void;
|
|
30
|
+
/**
|
|
31
|
+
* 打开由 SaberConfirmProvider 承载的全局确认弹窗。
|
|
32
|
+
* 页面根节点需要渲染一次 SaberConfirmProvider。
|
|
33
|
+
*/
|
|
34
|
+
export declare function useConfirm(): (options?: ConfirmOptions) => Promise<boolean>;
|