@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.
Files changed (130) hide show
  1. package/README.md +206 -11
  2. package/dist/BadgeStatus.types.d.ts +1 -1
  3. package/dist/BadgeStatus.vue.d.ts +1 -1
  4. package/dist/SaberConfirmModal.vue_vue_type_script_setup_true_lang-Cqp9krYl.js +86 -0
  5. package/dist/SaberConfirmProvider.vue_vue_type_script_setup_true_lang-DUJ6ftNJ.js +30 -0
  6. package/dist/SaberDictCheckbox.vue_vue_type_script_setup_true_lang-DUbzy_C6.js +34 -0
  7. package/dist/SaberDictRadio.vue_vue_type_script_setup_true_lang-DR6-jSID.js +50 -0
  8. package/dist/SaberDictSelect.vue_vue_type_script_setup_true_lang-B8PTKNKX.js +35 -0
  9. package/dist/SaberDistrictSelect.vue_vue_type_script_setup_true_lang-BX8nLC35.js +257 -0
  10. package/dist/SaberInfo.vue_vue_type_script_setup_true_lang-B3W5VsGR.js +58 -0
  11. package/dist/SaberInfoProvider.vue_vue_type_script_setup_true_lang-3rF6bSCn.js +28 -0
  12. package/dist/SaberModal.vue_vue_type_script_setup_true_lang-DJno3jA3.js +71 -0
  13. package/dist/SaberModalWithMobile.vue_vue_type_script_setup_true_lang-aQlToncY.js +87 -0
  14. package/dist/SaberNoData.types.d.ts +11 -0
  15. package/dist/SaberNoData.vue.d.ts +24 -0
  16. package/dist/SaberPopSelect.vue_vue_type_script_setup_true_lang-BcS27NXI.js +125 -0
  17. package/dist/SaberStatus.vue_vue_type_script_setup_true_lang-D9aRVCow.js +38 -0
  18. package/dist/SaberSwitchBar.vue_vue_type_script_setup_true_lang-CDx3Dcas.js +47 -0
  19. package/dist/SaberUploadImage.vue_vue_type_script_setup_true_lang-CAwci2Vr.js +224 -0
  20. package/dist/colors.d.ts +1 -1
  21. package/dist/components/SaberConfirmModal.mjs +4 -0
  22. package/dist/components/SaberConfirmModal.vue.d.ts +28 -0
  23. package/dist/components/SaberConfirmProvider.mjs +4 -0
  24. package/dist/components/SaberConfirmProvider.vue.d.ts +2 -0
  25. package/dist/components/SaberInfo.mjs +4 -0
  26. package/dist/components/SaberInfo.types.d.ts +14 -0
  27. package/dist/components/SaberInfo.vue.d.ts +21 -0
  28. package/dist/components/SaberInfoProvider.mjs +4 -0
  29. package/dist/components/SaberInfoProvider.vue.d.ts +20 -0
  30. package/dist/components/SaberModalWithMobile.mjs +4 -0
  31. package/dist/components/SaberModalWithMobile.vue.d.ts +36 -0
  32. package/dist/components/SaberStatus.mjs +4 -0
  33. package/dist/components/SaberStatus.types.d.ts +1 -0
  34. package/dist/components/SaberStatus.vue.d.ts +8 -0
  35. package/dist/components/SaberSwitchBar.mjs +4 -0
  36. package/dist/components/SaberSwitchBar.types.d.ts +13 -0
  37. package/dist/components/SaberSwitchBar.vue.d.ts +18 -0
  38. package/dist/components/info-context.d.ts +3 -0
  39. package/dist/composables/index.d.ts +12 -0
  40. package/dist/composables/use-address-parse.d.ts +15 -0
  41. package/dist/composables/use-address-parse.mjs +20 -0
  42. package/dist/composables/use-boolean.d.ts +8 -0
  43. package/dist/composables/use-boolean.mjs +20 -0
  44. package/dist/composables/use-confirm.d.ts +34 -0
  45. package/dist/composables/use-confirm.mjs +28 -0
  46. package/dist/composables/use-delay-unmount.d.ts +7 -0
  47. package/dist/composables/use-delay-unmount.mjs +26 -0
  48. package/dist/composables/use-delete.d.ts +13 -0
  49. package/dist/composables/use-delete.mjs +19 -0
  50. package/dist/composables/use-loading.d.ts +6 -0
  51. package/dist/composables/use-loading.mjs +8 -0
  52. package/dist/composables/use-skeleton.d.ts +5 -0
  53. package/dist/composables/use-skeleton.mjs +23 -0
  54. package/dist/composables/use-table.d.ts +57 -0
  55. package/dist/composables/use-table.mjs +87 -0
  56. package/dist/composables.mjs +21 -0
  57. package/dist/district-service-cOu1tbQG.js +147 -0
  58. package/dist/district.d.ts +3 -0
  59. package/dist/district.mjs +8 -0
  60. package/dist/forms/components/SaberFilterBar.vue.d.ts +41 -0
  61. package/dist/forms/components/SaberFormModal.vue.d.ts +31 -0
  62. package/dist/forms/components/SaberModal.vue.d.ts +34 -0
  63. package/dist/forms/components/fields/SaberDictCheckbox.vue.d.ts +24 -0
  64. package/dist/forms/components/fields/SaberDictRadio.vue.d.ts +24 -0
  65. package/dist/forms/components/fields/SaberDictSelect.vue.d.ts +28 -0
  66. package/dist/forms/components/fields/SaberDistrictSelect.vue.d.ts +31 -0
  67. package/dist/forms/components/fields/SaberInput.vue.d.ts +16 -0
  68. package/dist/forms/components/fields/SaberInputNumber.vue.d.ts +11 -0
  69. package/dist/forms/components/fields/SaberPopSelect.vue.d.ts +25 -0
  70. package/dist/forms/components/fields/SaberRadioGroup.vue.d.ts +11 -0
  71. package/dist/forms/components/fields/SaberSelect.vue.d.ts +11 -0
  72. package/dist/forms/components/fields/SaberTextarea.vue.d.ts +11 -0
  73. package/dist/forms/components/fields/SaberUploadImage.vue.d.ts +113 -0
  74. package/dist/forms/dict-checkbox.mjs +4 -0
  75. package/dist/forms/dict-radio.mjs +4 -0
  76. package/dist/forms/dict-select.mjs +4 -0
  77. package/dist/forms/dict-source.d.ts +3 -0
  78. package/dist/forms/district-select.mjs +4 -0
  79. package/dist/forms/district-service.d.ts +46 -0
  80. package/dist/forms/filter-state.d.ts +4 -0
  81. package/dist/forms/index.d.ts +24 -0
  82. package/dist/forms/plugin.d.ts +20 -0
  83. package/dist/forms/pop-select.mjs +4 -0
  84. package/dist/forms/presets/basic.d.ts +5 -0
  85. package/dist/forms/registry.d.ts +15 -0
  86. package/dist/forms/types.d.ts +102 -0
  87. package/dist/forms/upload-image-source.d.ts +3 -0
  88. package/dist/forms/upload-image.mjs +4 -0
  89. package/dist/forms/use-dict-options.d.ts +8 -0
  90. package/dist/forms.mjs +45 -0
  91. package/dist/index.d.ts +62 -1
  92. package/dist/index.mjs +122 -33
  93. package/dist/info-context-MfOfJNDT.js +4 -0
  94. package/dist/plugin-Dr3z0YFg.js +396 -0
  95. package/dist/types/api.d.ts +30 -0
  96. package/dist/types/auth.d.ts +54 -0
  97. package/dist/types/common.d.ts +14 -0
  98. package/dist/types/index.d.ts +3 -0
  99. package/dist/types/index.mjs +1 -0
  100. package/dist/upload-image-source-On8NHgmx.js +4 -0
  101. package/dist/use-dict-options-DjtbYYIa.js +38 -0
  102. package/dist/utils/addressParse.d.ts +37 -0
  103. package/dist/utils/addressParse.mjs +623 -0
  104. package/dist/utils/crypto.d.ts +11 -0
  105. package/dist/utils/crypto.mjs +36 -0
  106. package/dist/utils/filter.d.ts +20 -0
  107. package/dist/utils/filter.mjs +11 -0
  108. package/dist/utils/format.d.ts +9 -0
  109. package/dist/utils/format.mjs +7 -0
  110. package/dist/utils/http.d.ts +45 -0
  111. package/dist/utils/http.mjs +147 -0
  112. package/dist/utils/index.d.ts +12 -0
  113. package/dist/utils/index.mjs +41 -0
  114. package/dist/utils/klona.d.ts +2 -0
  115. package/dist/utils/klona.mjs +4 -0
  116. package/dist/utils/nanoid.d.ts +2 -0
  117. package/dist/utils/nanoid.mjs +4 -0
  118. package/dist/utils/permission.d.ts +45 -0
  119. package/dist/utils/permission.mjs +38 -0
  120. package/dist/utils/rsa.d.ts +26 -0
  121. package/dist/utils/rsa.mjs +2073 -0
  122. package/dist/utils/storage.d.ts +29 -0
  123. package/dist/utils/storage.mjs +39 -0
  124. package/dist/utils/toast.d.ts +26 -0
  125. package/dist/utils/toast.mjs +17 -0
  126. package/dist/utils/tree.d.ts +20 -0
  127. package/dist/utils/tree.mjs +30 -0
  128. package/package.json +179 -9
  129. package/dist/index.cjs +0 -1
  130. package/dist/vite.cjs +0 -1
package/dist/index.mjs CHANGED
@@ -1,6 +1,23 @@
1
- import u from "@nuxt/ui/components/Badge.vue";
2
- import { defineComponent as f, computed as s, openBlock as g, createBlock as p, normalizeStyle as m } from "vue";
3
- const l = {
1
+ import h from "@nuxt/ui/vue-plugin";
2
+ import y from "@nuxt/ui/components/Badge.vue";
3
+ import { defineComponent as S, computed as f, openBlock as s, createBlock as $, normalizeStyle as v, withCtx as C, createTextVNode as k, toDisplayString as d, createElementBlock as i, normalizeClass as B, createElementVNode as l, createVNode as I, createCommentVNode as m, renderSlot as u } from "vue";
4
+ import D from "@nuxt/ui/runtime/vue/components/Icon.vue";
5
+ import { _ as N } from "./SaberConfirmModal.vue_vue_type_script_setup_true_lang-Cqp9krYl.js";
6
+ import { _ as M } from "./SaberConfirmProvider.vue_vue_type_script_setup_true_lang-DUJ6ftNJ.js";
7
+ import { _ as w } from "./SaberInfo.vue_vue_type_script_setup_true_lang-B3W5VsGR.js";
8
+ import { _ as P } from "./SaberInfoProvider.vue_vue_type_script_setup_true_lang-3rF6bSCn.js";
9
+ import { _ as z } from "./SaberModalWithMobile.vue_vue_type_script_setup_true_lang-aQlToncY.js";
10
+ import { _ as F } from "./SaberStatus.vue_vue_type_script_setup_true_lang-D9aRVCow.js";
11
+ import { _ as U } from "./SaberSwitchBar.vue_vue_type_script_setup_true_lang-CDx3Dcas.js";
12
+ import { k as V } from "./plugin-Dr3z0YFg.js";
13
+ import { _ as ie, a as le, b as me, c as de, d as be, e as fe } from "./plugin-Dr3z0YFg.js";
14
+ import { _ as _e } from "./SaberModal.vue_vue_type_script_setup_true_lang-DJno3jA3.js";
15
+ import { _ as pe } from "./SaberDictCheckbox.vue_vue_type_script_setup_true_lang-DUbzy_C6.js";
16
+ import { _ as xe, a as he } from "./SaberDictRadio.vue_vue_type_script_setup_true_lang-DR6-jSID.js";
17
+ import { _ as $e } from "./SaberDictSelect.vue_vue_type_script_setup_true_lang-B8PTKNKX.js";
18
+ import { _ as Ce } from "./SaberDistrictSelect.vue_vue_type_script_setup_true_lang-BX8nLC35.js";
19
+ import { _ as Be } from "./SaberPopSelect.vue_vue_type_script_setup_true_lang-BcS27NXI.js";
20
+ const b = {
4
21
  red: { 500: "#ef4444", 600: "#dc2626" },
5
22
  orange: { 500: "#f97316", 600: "#ea580c" },
6
23
  amber: { 500: "#f59e0b", 600: "#d97706" },
@@ -23,16 +40,16 @@ const l = {
23
40
  zinc: { 500: "#71717a", 600: "#52525b" },
24
41
  neutral: { 500: "#737373", 600: "#525252" },
25
42
  stone: { 500: "#78716c", 600: "#57534e" }
26
- }, y = l.gray;
27
- function b(e, t) {
28
- var o, c;
29
- return ((o = l[e]) == null ? void 0 : o[t]) ?? ((c = l[e]) == null ? void 0 : c[500]) ?? y[500];
43
+ }, W = b.gray;
44
+ function _(e, t) {
45
+ var o, a;
46
+ return ((o = b[e]) == null ? void 0 : o[t]) ?? ((a = b[e]) == null ? void 0 : a[500]) ?? W[500];
30
47
  }
31
- function v(e, t) {
32
- const o = parseInt(e.slice(1, 3), 16), c = parseInt(e.slice(3, 5), 16), a = parseInt(e.slice(5, 7), 16);
33
- return `rgba(${o}, ${c}, ${a}, ${t / 100})`;
48
+ function H(e, t) {
49
+ const o = parseInt(e.slice(1, 3), 16), a = parseInt(e.slice(3, 5), 16), r = parseInt(e.slice(5, 7), 16);
50
+ return `rgba(${o}, ${a}, ${r}, ${t / 100})`;
34
51
  }
35
- const x = /* @__PURE__ */ f({
52
+ const R = /* @__PURE__ */ S({
36
53
  __name: "BadgeStatus",
37
54
  props: {
38
55
  value: {},
@@ -41,34 +58,106 @@ const x = /* @__PURE__ */ f({
41
58
  textColorWeight: { default: 500 }
42
59
  },
43
60
  setup(e) {
44
- const t = e, o = s(() => {
45
- const a = String(t.value);
46
- for (const n of t.config) {
47
- const [r, d, i] = n.split(":");
48
- if (d === a)
49
- return { label: r, color: i || "gray" };
61
+ const t = e, o = f(() => {
62
+ const r = String(t.value);
63
+ for (const c of t.config) {
64
+ const n = c.split(":");
65
+ if (n.length < 2) continue;
66
+ const p = n[0], g = n[1], x = n[2] || "gray";
67
+ if (g === r)
68
+ return { label: p, color: x };
50
69
  }
51
- return { label: a, color: "gray" };
52
- }), c = s(() => {
53
- const { color: a } = o.value, n = b(a, 500), r = b(a, t.textColorWeight);
70
+ return { label: r, color: "gray" };
71
+ }), a = f(() => {
72
+ const { color: r } = o.value, c = _(r, 500), n = _(r, t.textColorWeight);
54
73
  return {
55
- backgroundColor: v(n, t.bgOpacity),
56
- color: r
74
+ backgroundColor: H(c, t.bgOpacity),
75
+ color: n
57
76
  };
58
77
  });
59
- return (a, n) => (g(), p(u, {
60
- style: m(c.value),
61
- variant: "soft",
62
- label: o.value.label,
63
- class: "rounded-full border-0 pt-0.75 pb-0.75 px-2"
64
- }, null, 8, ["style", "label"]));
78
+ return (r, c) => {
79
+ const n = y;
80
+ return s(), $(n, {
81
+ style: v(a.value),
82
+ class: "inline-flex items-center rounded-full border-0 pt-0.75 pb-0.75 px-2 text-xs font-medium"
83
+ }, {
84
+ default: C(() => [
85
+ k(d(o.value.label), 1)
86
+ ]),
87
+ _: 1
88
+ }, 8, ["style"]);
89
+ };
65
90
  }
66
- }), k = {
67
- install(e) {
68
- e.component("UBadge", u), e.component("BadgeStatus", x);
91
+ }), T = { class: "rounded-md border border-accented p-3" }, A = { class: "flex flex-col gap-1" }, E = { class: "text-base font-semibold mb-2 text-highlighted w-60" }, L = {
92
+ key: 0,
93
+ class: "text-sm text-muted w-60"
94
+ }, O = { key: 0 }, j = { key: 1 }, G = /* @__PURE__ */ S({
95
+ name: "SaberNoData",
96
+ __name: "SaberNoData",
97
+ props: {
98
+ border: { type: Boolean, default: !0 },
99
+ class: {},
100
+ icon: { default: "i-lucide-inbox" },
101
+ title: { default: "暂无数据" },
102
+ description: { default: "当前列表为空,还没有任何数据" }
103
+ },
104
+ setup(e) {
105
+ return (t, o) => {
106
+ const a = D;
107
+ return s(), i("div", {
108
+ class: B([
109
+ "flex flex-col items-center justify-center gap-6 rounded-md p-10 text-center bg-default",
110
+ e.border && "border border-accented",
111
+ t.$props.class
112
+ ])
113
+ }, [
114
+ l("div", T, [
115
+ I(a, {
116
+ name: e.icon,
117
+ class: "size-5"
118
+ }, null, 8, ["name"])
119
+ ]),
120
+ l("div", A, [
121
+ l("h4", E, d(e.title), 1),
122
+ e.description ? (s(), i("p", L, d(e.description), 1)) : m("", !0)
123
+ ]),
124
+ t.$slots.default ? (s(), i("div", O, [
125
+ u(t.$slots, "default")
126
+ ])) : m("", !0),
127
+ t.$slots.extra ? (s(), i("p", j, [
128
+ u(t.$slots, "extra")
129
+ ])) : m("", !0)
130
+ ], 2);
131
+ };
132
+ }
133
+ }), ne = {
134
+ install(e, t = {}) {
135
+ e.use(h), e.component("SaberBadgeStatus", R), e.component("SaberNoData", G), e.component("SaberConfirmModal", N), e.component("SaberConfirmProvider", M), e.component("SaberInfo", w), e.component("SaberInfoProvider", P), e.component("SaberModalWithMobile", z), e.component("SaberStatus", F), e.component("SaberSwitchBar", U), V(e, t.forms);
69
136
  }
70
137
  };
71
138
  export {
72
- x as BadgeStatus,
73
- k as default
139
+ R as SaberBadgeStatus,
140
+ N as SaberConfirmModal,
141
+ M as SaberConfirmProvider,
142
+ pe as SaberDictCheckbox,
143
+ xe as SaberDictRadio,
144
+ $e as SaberDictSelect,
145
+ Ce as SaberDistrictSelect,
146
+ ie as SaberFilterBar,
147
+ le as SaberFormModal,
148
+ w as SaberInfo,
149
+ P as SaberInfoProvider,
150
+ me as SaberInput,
151
+ de as SaberInputNumber,
152
+ _e as SaberModal,
153
+ z as SaberModalWithMobile,
154
+ G as SaberNoData,
155
+ Be as SaberPopSelect,
156
+ he as SaberRadioGroup,
157
+ be as SaberSelect,
158
+ F as SaberStatus,
159
+ U as SaberSwitchBar,
160
+ fe as SaberTextarea,
161
+ ne as default,
162
+ V as installSaberForms
74
163
  };
@@ -0,0 +1,4 @@
1
+ const o = Symbol("SaberInfoContext");
2
+ export {
3
+ o as S
4
+ };
@@ -0,0 +1,396 @@
1
+ import M from "@nuxt/ui/components/Button.vue";
2
+ import { inject as ie, h as ce, defineComponent as h, useModel as y, computed as L, openBlock as m, createElementBlock as x, renderSlot as C, Fragment as N, renderList as K, createBlock as _, resolveDynamicComponent as T, unref as $, mergeProps as g, toHandlers as E, createVNode as F, mergeModels as b, ref as I, watch as B, useTemplateRef as me, withCtx as v, normalizeClass as de, createTextVNode as A, toDisplayString as O, useAttrs as pe, createSlots as fe, withModifiers as R } from "vue";
3
+ import be from "@nuxt/ui/components/Form.vue";
4
+ import _e from "@nuxt/ui/components/FormField.vue";
5
+ import { _ as z } from "./SaberModal.vue_vue_type_script_setup_true_lang-DJno3jA3.js";
6
+ import { D as ve } from "./use-dict-options-DjtbYYIa.js";
7
+ import { D as ge, a as Se, r as he } from "./district-service-cOu1tbQG.js";
8
+ import { U as ye } from "./upload-image-source-On8NHgmx.js";
9
+ import G from "@nuxt/ui/components/Input.vue";
10
+ import J from "@nuxt/ui/components/InputNumber.vue";
11
+ import Ve from "@nuxt/ui/components/RadioGroup.vue";
12
+ import P from "@nuxt/ui/components/Select.vue";
13
+ import H from "@nuxt/ui/components/Textarea.vue";
14
+ import { _ as q } from "./SaberDictCheckbox.vue_vue_type_script_setup_true_lang-DUbzy_C6.js";
15
+ import { a as Q, _ as W } from "./SaberDictRadio.vue_vue_type_script_setup_true_lang-DR6-jSID.js";
16
+ import { _ as X } from "./SaberDictSelect.vue_vue_type_script_setup_true_lang-B8PTKNKX.js";
17
+ import { _ as Y } from "./SaberDistrictSelect.vue_vue_type_script_setup_true_lang-BX8nLC35.js";
18
+ import { _ as Z } from "./SaberPopSelect.vue_vue_type_script_setup_true_lang-BcS27NXI.js";
19
+ function D(e) {
20
+ return e == null ? !1 : typeof e == "string" ? e.trim() !== "" : Array.isArray(e) ? e.some(D) : typeof e == "object" ? Object.values(e).some(D) : !0;
21
+ }
22
+ function Fe(e, o) {
23
+ if (e === o) return !0;
24
+ try {
25
+ return JSON.stringify(e) === JSON.stringify(o);
26
+ } catch {
27
+ return !1;
28
+ }
29
+ }
30
+ function $e(e, o, t) {
31
+ return t != null ? o.some((a) => !Fe(e[a.key], t[a.key])) : o.some((a) => D(e[a.key]));
32
+ }
33
+ const ee = Symbol("SaberFormRegistry");
34
+ function ke(e = {}) {
35
+ const o = new Map(Object.entries(e));
36
+ return {
37
+ register(t, a) {
38
+ o.set(t, a);
39
+ },
40
+ registerMany(t) {
41
+ Object.entries(t).forEach(([a, n]) => o.set(a, n));
42
+ },
43
+ resolve(t) {
44
+ return o.get(t);
45
+ },
46
+ has(t) {
47
+ return o.has(t);
48
+ }
49
+ };
50
+ }
51
+ function te() {
52
+ return ie(ee, void 0);
53
+ }
54
+ const j = /* @__PURE__ */ new Set(), Ue = {
55
+ name: "SaberMissingFormComponent",
56
+ setup() {
57
+ return () => ce("div", { class: "text-muted text-sm" }, "组件未注册");
58
+ }
59
+ };
60
+ function oe(e, o) {
61
+ if (typeof o != "string") return o;
62
+ const t = e == null ? void 0 : e.resolve(o);
63
+ return t || (j.has(o) || (j.add(o), console.warn(`[SaberUI] Form component "${o}" is not registered.`)), Ue);
64
+ }
65
+ const xe = { class: "flex gap-2" }, De = /* @__PURE__ */ h({
66
+ name: "SaberFilterBar",
67
+ __name: "SaberFilterBar",
68
+ props: /* @__PURE__ */ b({
69
+ fields: {},
70
+ initialParams: { default: null }
71
+ }, {
72
+ modelValue: { default: () => ({}) },
73
+ modelModifiers: {}
74
+ }),
75
+ emits: /* @__PURE__ */ b(["search", "reset", "refresh"], ["update:modelValue"]),
76
+ setup(e, { expose: o, emit: t }) {
77
+ const a = e, n = t, r = y(e, "modelValue"), d = te(), l = L(() => $e(r.value, a.fields, a.initialParams));
78
+ o({ hasActiveFilters: l });
79
+ function k(p = "change") {
80
+ return p === "manual" ? {} : p === "update:model-value" ? { "update:modelValue": () => n("search") } : { change: () => n("search") };
81
+ }
82
+ function i() {
83
+ l.value ? n("reset") : n("refresh");
84
+ }
85
+ return (p, V) => {
86
+ const S = M;
87
+ return m(), x("div", xe, [
88
+ C(p.$slots, "leading"),
89
+ (m(!0), x(N, null, K(e.fields, (f) => (m(), _(T($(oe)($(d), f.which)), g({
90
+ key: f.key,
91
+ modelValue: r.value[f.key],
92
+ "onUpdate:modelValue": (s) => r.value[f.key] = s
93
+ }, { ref_for: !0 }, f.props, {
94
+ class: f.class
95
+ }, E(k(f.searchOn))), null, 16, ["modelValue", "onUpdate:modelValue", "class"]))), 128)),
96
+ F(S, {
97
+ icon: l.value ? "i-mdi:close" : "i-solar:refresh-bold",
98
+ variant: "outline",
99
+ color: "neutral",
100
+ block: "",
101
+ size: "lg",
102
+ class: "h-10 w-10 is-plain shrink-0 ml-auto",
103
+ onClick: i
104
+ }, null, 8, ["icon"]),
105
+ C(p.$slots, "trailing")
106
+ ]);
107
+ };
108
+ }
109
+ }), Me = /* @__PURE__ */ h({
110
+ name: "SaberFormModal",
111
+ inheritAttrs: !1,
112
+ __name: "SaberFormModal",
113
+ props: /* @__PURE__ */ b({
114
+ fields: {},
115
+ model: { default: void 0 },
116
+ validate: { type: Function, default: void 0 },
117
+ submit: {},
118
+ title: { default: void 0 },
119
+ description: { default: void 0 },
120
+ width: { default: "w-140" },
121
+ cancelLabel: { default: "取消" },
122
+ submitLabel: { default: "保存" },
123
+ closeOnSuccess: { type: Boolean, default: !0 }
124
+ }, {
125
+ open: { type: Boolean, default: !1 },
126
+ openModifiers: {}
127
+ }),
128
+ emits: /* @__PURE__ */ b(["success", "error"], ["update:open"]),
129
+ setup(e, { emit: o }) {
130
+ const t = e, a = o, n = y(e, "open"), r = te();
131
+ function d() {
132
+ return { ...t.model ?? {} };
133
+ }
134
+ const l = I(d());
135
+ B(n, (s) => {
136
+ s && (l.value = d());
137
+ }), B(
138
+ () => t.model,
139
+ () => {
140
+ n.value && (l.value = d());
141
+ },
142
+ { deep: !0 }
143
+ );
144
+ function k(s) {
145
+ var c;
146
+ return ((c = t.validate) == null ? void 0 : c.call(t, s)) ?? [];
147
+ }
148
+ const i = I(!1), p = me("form");
149
+ function V(s) {
150
+ var c;
151
+ (c = p.value) == null || c.clear(String(s.key));
152
+ }
153
+ function S(s) {
154
+ return {
155
+ onChange: () => V(s),
156
+ "onUpdate:modelValue": () => V(s)
157
+ };
158
+ }
159
+ async function f() {
160
+ i.value = !0;
161
+ try {
162
+ const s = await t.submit(l.value);
163
+ a("success", s), t.closeOnSuccess && (n.value = !1);
164
+ } catch (s) {
165
+ a("error", s);
166
+ } finally {
167
+ i.value = !1;
168
+ }
169
+ }
170
+ return (s, c) => {
171
+ const se = _e, ue = be, w = M;
172
+ return m(), _(z, {
173
+ open: n.value,
174
+ "onUpdate:open": c[2] || (c[2] = (u) => n.value = u),
175
+ title: e.title,
176
+ description: e.description,
177
+ width: e.width
178
+ }, {
179
+ footer: v(() => [
180
+ F(w, {
181
+ color: "neutral",
182
+ variant: "outline",
183
+ class: "h-10 px-12",
184
+ onClick: c[0] || (c[0] = (u) => n.value = !1)
185
+ }, {
186
+ default: v(() => [
187
+ A(O(e.cancelLabel), 1)
188
+ ]),
189
+ _: 1
190
+ }),
191
+ F(w, {
192
+ color: "primary",
193
+ class: "h-10 px-12",
194
+ loading: i.value,
195
+ onClick: c[1] || (c[1] = (u) => {
196
+ var U;
197
+ return (U = p.value) == null ? void 0 : U.submit();
198
+ })
199
+ }, {
200
+ default: v(() => [
201
+ A(O(e.submitLabel), 1)
202
+ ]),
203
+ _: 1
204
+ }, 8, ["loading"])
205
+ ]),
206
+ default: v(() => [
207
+ F(ue, g({ ref: "form" }, s.$attrs, {
208
+ validate: k,
209
+ state: l.value,
210
+ "validate-on": ["blur"],
211
+ class: "saberInput flex flex-col gap-4",
212
+ onSubmit: f
213
+ }), {
214
+ default: v(() => [
215
+ (m(!0), x(N, null, K(e.fields, (u) => (m(), _(se, {
216
+ key: String(u.key),
217
+ name: String(u.key),
218
+ label: u.label,
219
+ class: de(u.class),
220
+ ui: { label: "text-muted mb-1" }
221
+ }, {
222
+ default: v(() => [
223
+ (m(), _(T($(oe)($(r), u.which)), g({
224
+ modelValue: l.value[u.key],
225
+ "onUpdate:modelValue": (U) => l.value[u.key] = U
226
+ }, { ref_for: !0 }, u.props, E(S(u))), null, 16, ["modelValue", "onUpdate:modelValue"]))
227
+ ]),
228
+ _: 2
229
+ }, 1032, ["name", "label", "class"]))), 128))
230
+ ]),
231
+ _: 1
232
+ }, 16, ["state"])
233
+ ]),
234
+ _: 1
235
+ }, 8, ["open", "title", "description", "width"]);
236
+ };
237
+ }
238
+ }), ae = /* @__PURE__ */ h({
239
+ inheritAttrs: !1,
240
+ __name: "SaberInput",
241
+ props: /* @__PURE__ */ b({
242
+ clearable: { type: Boolean, default: !0 }
243
+ }, {
244
+ modelValue: { default: "" },
245
+ modelModifiers: {}
246
+ }),
247
+ emits: /* @__PURE__ */ b(["change"], ["update:modelValue"]),
248
+ setup(e, { emit: o }) {
249
+ const t = e, a = y(e, "modelValue"), n = o, r = pe(), d = L(() => !t.clearable || r.disabled != null || r.readonly != null ? !1 : a.value !== void 0 && a.value !== null && String(a.value) !== "");
250
+ function l() {
251
+ a.value = "", n("change", a.value);
252
+ }
253
+ return (k, i) => {
254
+ const p = M, V = G;
255
+ return m(), _(V, g({
256
+ modelValue: a.value,
257
+ "onUpdate:modelValue": i[1] || (i[1] = (S) => a.value = S)
258
+ }, $(r), {
259
+ class: "saberInput",
260
+ onChange: i[2] || (i[2] = (S) => n("change", a.value))
261
+ }), fe({ _: 2 }, [
262
+ d.value ? {
263
+ name: "trailing",
264
+ fn: v(() => [
265
+ F(p, {
266
+ tabindex: "-1",
267
+ color: "neutral",
268
+ variant: "ghost",
269
+ icon: "i-solar:close-circle-outline",
270
+ ui: { base: "p-1 min-w-0 -mr-1", leadingIcon: "size-4" },
271
+ onMousedown: i[0] || (i[0] = R(() => {
272
+ }, ["stop", "prevent"])),
273
+ onClick: R(l, ["stop", "prevent"])
274
+ })
275
+ ]),
276
+ key: "0"
277
+ } : void 0
278
+ ]), 1040, ["modelValue"]);
279
+ };
280
+ }
281
+ }), ne = /* @__PURE__ */ h({
282
+ inheritAttrs: !1,
283
+ __name: "SaberInputNumber",
284
+ props: {
285
+ modelValue: { default: void 0 },
286
+ modelModifiers: {}
287
+ },
288
+ emits: /* @__PURE__ */ b(["change"], ["update:modelValue"]),
289
+ setup(e, { emit: o }) {
290
+ const t = y(e, "modelValue"), a = o;
291
+ function n(r) {
292
+ t.value = r, a("change", r);
293
+ }
294
+ return (r, d) => {
295
+ const l = J;
296
+ return m(), _(l, g({ "model-value": t.value }, r.$attrs, {
297
+ ui: { base: "h-10 rounded-sm" },
298
+ "onUpdate:modelValue": n
299
+ }), null, 16, ["model-value"]);
300
+ };
301
+ }
302
+ }), re = /* @__PURE__ */ h({
303
+ inheritAttrs: !1,
304
+ __name: "SaberSelect",
305
+ props: {
306
+ modelValue: { default: void 0 },
307
+ modelModifiers: {}
308
+ },
309
+ emits: /* @__PURE__ */ b(["change"], ["update:modelValue"]),
310
+ setup(e, { emit: o }) {
311
+ const t = y(e, "modelValue"), a = o;
312
+ function n(r) {
313
+ t.value = r, a("change", r);
314
+ }
315
+ return (r, d) => {
316
+ const l = P;
317
+ return m(), _(l, g({ "model-value": t.value }, r.$attrs, {
318
+ class: "saberButton",
319
+ "onUpdate:modelValue": n
320
+ }), null, 16, ["model-value"]);
321
+ };
322
+ }
323
+ }), le = /* @__PURE__ */ h({
324
+ inheritAttrs: !1,
325
+ __name: "SaberTextarea",
326
+ props: {
327
+ modelValue: { default: "" },
328
+ modelModifiers: {}
329
+ },
330
+ emits: /* @__PURE__ */ b(["change"], ["update:modelValue"]),
331
+ setup(e, { emit: o }) {
332
+ const t = y(e, "modelValue"), a = o;
333
+ function n(r) {
334
+ t.value = r, a("change", r);
335
+ }
336
+ return (r, d) => {
337
+ const l = H;
338
+ return m(), _(l, g({ "model-value": t.value }, r.$attrs, {
339
+ class: "saberInput",
340
+ "onUpdate:modelValue": n
341
+ }), null, 16, ["model-value"]);
342
+ };
343
+ }
344
+ }), we = {
345
+ "saber-input": ae,
346
+ "saber-input-number": ne,
347
+ "saber-dict-checkbox": q,
348
+ "saber-dict-radio": W,
349
+ "saber-dict-select": X,
350
+ "saber-district-select": Y,
351
+ "saber-pop-select": Z,
352
+ "saber-select": re,
353
+ "saber-textarea": le,
354
+ "saber-radio-group": Q,
355
+ "ui-input": G,
356
+ "ui-input-number": J,
357
+ "ui-select": P,
358
+ "ui-textarea": H,
359
+ "ui-radio-group": Ve
360
+ }, Ce = {
361
+ SaberInput: ae,
362
+ SaberInputNumber: ne,
363
+ SaberDictCheckbox: q,
364
+ SaberDictRadio: W,
365
+ SaberDictSelect: X,
366
+ SaberDistrictSelect: Y,
367
+ SaberPopSelect: Z,
368
+ SaberSelect: re,
369
+ SaberTextarea: le,
370
+ SaberRadioGroup: Q
371
+ };
372
+ function We(e, o = {}) {
373
+ const t = ke({
374
+ ...we,
375
+ ...o.components
376
+ });
377
+ return e.provide(ee, t), o.dictDataSource && e.provide(ve, o.dictDataSource), o.uploadImageDataSource && e.provide(ye, o.uploadImageDataSource), e.provide(ge, Se(he(o.district))), e.component("SaberFilterBar", De), e.component("SaberFormModal", Me), e.component("SaberModal", z), Object.entries(Ce).forEach(([a, n]) => e.component(a, n)), t;
378
+ }
379
+ export {
380
+ ee as F,
381
+ De as _,
382
+ Me as a,
383
+ ae as b,
384
+ ne as c,
385
+ re as d,
386
+ le as e,
387
+ we as f,
388
+ Ce as g,
389
+ ke as h,
390
+ $e as i,
391
+ D as j,
392
+ We as k,
393
+ Fe as l,
394
+ oe as r,
395
+ te as u
396
+ };
@@ -0,0 +1,30 @@
1
+ /** 标准数据响应。 */
2
+ export interface ApiResponse<T = unknown> {
3
+ code: number;
4
+ msg: string;
5
+ data: T;
6
+ }
7
+ /** rows、total 位于响应顶层的列表响应。 */
8
+ export interface ListResponse<T = unknown> {
9
+ code: number;
10
+ msg: string;
11
+ rows: T[];
12
+ total: number;
13
+ }
14
+ /** 通用分页请求参数。 */
15
+ export interface PageParams {
16
+ pageNum?: number;
17
+ pageSize?: number;
18
+ }
19
+ /** rows、total 位于 ApiResponse.data 内的分页数据。 */
20
+ export interface PageData<T = unknown> {
21
+ rows: T[];
22
+ total: number;
23
+ }
24
+ export type SortOrder = 'asc' | 'desc';
25
+ /** 通用列表查询参数。 */
26
+ export interface CommonSearchParams extends PageParams {
27
+ orderByColumn?: string;
28
+ isAsc?: SortOrder;
29
+ params?: Record<string, unknown>;
30
+ }
@@ -0,0 +1,54 @@
1
+ /** 登录请求的公共字段。 */
2
+ export interface LoginForm {
3
+ clientId?: string;
4
+ grantType?: string;
5
+ tenantId?: string;
6
+ code?: string;
7
+ uuid?: string;
8
+ }
9
+ export interface PwdLoginForm extends LoginForm {
10
+ username?: string;
11
+ password?: string;
12
+ userType?: string;
13
+ }
14
+ export interface SocialLoginForm extends LoginForm {
15
+ socialCode?: string;
16
+ socialState?: string;
17
+ source?: string;
18
+ }
19
+ export interface RegisterForm extends LoginForm {
20
+ username?: string;
21
+ password?: string;
22
+ confirmPassword?: string;
23
+ userType?: string;
24
+ }
25
+ export interface LoginToken {
26
+ access_token?: string;
27
+ client_id?: string;
28
+ expire_in?: number;
29
+ openid?: string;
30
+ refresh_expire_in?: number;
31
+ refresh_token?: string;
32
+ scope?: string;
33
+ }
34
+ /** 登录租户选项;与后台管理的 SystemTenant 相互独立。 */
35
+ export interface LoginTenantItem {
36
+ companyName: string;
37
+ domain: string;
38
+ tenantId: string;
39
+ }
40
+ export interface LoginTenant {
41
+ tenantEnabled: boolean;
42
+ voList: LoginTenantItem[];
43
+ }
44
+ export interface CaptchaCode {
45
+ captchaEnabled: boolean;
46
+ uuid?: string;
47
+ img?: string;
48
+ }
49
+ /** 登录态信息;具体用户结构由应用通过泛型提供。 */
50
+ export interface AuthUserInfo<User = Record<string, unknown>> {
51
+ user?: User;
52
+ roles: string[];
53
+ permissions: string[];
54
+ }
@@ -0,0 +1,14 @@
1
+ /** 通用 ID 类型。 */
2
+ export type Id = string | number;
3
+ /** 通用选项结构。 */
4
+ export interface Option<Value = string, Label = string> {
5
+ value: Value;
6
+ label: Label;
7
+ }
8
+ /** 将对象字段转换为可选且可为 null。 */
9
+ export type PartialNullable<T> = {
10
+ [Key in keyof T]?: T[Key] | null;
11
+ };
12
+ export type YesNo = 'Y' | 'N';
13
+ export type EnableStatus = '0' | '1';
14
+ export type VisibleStatus = '0' | '1';
@@ -0,0 +1,3 @@
1
+ export type { EnableStatus, Id, Option, PartialNullable, VisibleStatus, YesNo, } from './common';
2
+ export type { ApiResponse, CommonSearchParams, ListResponse, PageData, PageParams, SortOrder, } from './api';
3
+ export type { AuthUserInfo, CaptchaCode, LoginForm, LoginTenant, LoginTenantItem, LoginToken, PwdLoginForm, RegisterForm, SocialLoginForm, } from './auth';
@@ -0,0 +1 @@
1
+