@owocow/saber-ui 0.1.13 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/SaberAppLayout.vue_vue_type_script_setup_true_lang-Hr4TdNqR.js +487 -0
  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
  3. package/dist/SaberDistrictSelect.vue_vue_type_script_setup_true_lang-jkl2AOay.js +272 -0
  4. package/dist/{SaberInfo.vue_vue_type_script_setup_true_lang-B3W5VsGR.js → SaberInfo.vue_vue_type_script_setup_true_lang-B_1ugpqI.js} +1 -1
  5. package/dist/SaberPopSelect.vue_vue_type_script_setup_true_lang-eH8jkkzK.js +162 -0
  6. package/dist/SaberSwitchBar.vue_vue_type_script_setup_true_lang-CIbFBx5r.js +47 -0
  7. package/dist/components/SaberAppLayout.mjs +1 -1
  8. package/dist/components/SaberInfo.mjs +1 -1
  9. package/dist/components/SaberPagination.vue.d.ts +48 -0
  10. package/dist/components/SaberSwitchBar.mjs +1 -1
  11. package/dist/components/layout/SaberAppLayout.types.d.ts +8 -0
  12. package/dist/components/layout/SaberAppLayout.vue.d.ts +5 -0
  13. package/dist/composables/index.d.ts +1 -1
  14. package/dist/composables/use-page-header.d.ts +3 -1
  15. package/dist/composables/use-page-header.mjs +27 -15
  16. package/dist/composables/use-table.d.ts +1 -0
  17. package/dist/composables/use-table.mjs +45 -42
  18. package/dist/composables.mjs +22 -20
  19. package/dist/control-size.d.ts +33 -0
  20. package/dist/forms/components/SaberFilterBar.vue.d.ts +3 -0
  21. package/dist/forms/components/SaberFormModal.vue.d.ts +2 -0
  22. package/dist/forms/components/fields/SaberDistrictSelect.vue.d.ts +5 -0
  23. package/dist/forms/components/fields/SaberInput.vue.d.ts +5 -0
  24. package/dist/forms/components/fields/SaberInputNumber.vue.d.ts +10 -2
  25. package/dist/forms/components/fields/SaberPopSelect.vue.d.ts +4 -1
  26. package/dist/forms/components/fields/SaberSelect.vue.d.ts +10 -2
  27. package/dist/forms/dict-select.mjs +1 -1
  28. package/dist/forms/district-select.mjs +1 -1
  29. package/dist/forms/index.d.ts +1 -0
  30. package/dist/forms/pop-select.mjs +1 -1
  31. package/dist/forms.mjs +4 -4
  32. package/dist/index.d.ts +4 -1
  33. package/dist/index.mjs +175 -98
  34. package/dist/plugin-Cg7MKH3t.js +438 -0
  35. package/package.json +1 -1
  36. package/dist/SaberAppLayout.vue_vue_type_script_setup_true_lang-R7F5K7kj.js +0 -418
  37. package/dist/SaberDistrictSelect.vue_vue_type_script_setup_true_lang-BX8nLC35.js +0 -257
  38. package/dist/SaberPopSelect.vue_vue_type_script_setup_true_lang-BcS27NXI.js +0 -125
  39. package/dist/SaberSwitchBar.vue_vue_type_script_setup_true_lang-CDx3Dcas.js +0 -47
  40. package/dist/plugin-Dr3z0YFg.js +0 -396
@@ -0,0 +1,438 @@
1
+ import B from "@nuxt/ui/components/Button.vue";
2
+ import { inject as de, h as pe, defineComponent as F, useModel as x, computed as h, openBlock as v, createElementBlock as D, renderSlot as A, Fragment as T, renderList as K, createBlock as y, resolveDynamicComponent as W, unref as k, mergeProps as V, toHandlers as G, createVNode as $, normalizeClass as J, mergeModels as b, ref as O, watch as j, useTemplateRef as fe, withCtx as z, createTextVNode as R, toDisplayString as N, useAttrs as ve, createSlots as be, withModifiers as L } from "vue";
3
+ import { S as w, _ as P } from "./SaberPopSelect.vue_vue_type_script_setup_true_lang-eH8jkkzK.js";
4
+ import _e from "@nuxt/ui/components/Form.vue";
5
+ import Se from "@nuxt/ui/components/FormField.vue";
6
+ import { _ as q } from "./SaberModal.vue_vue_type_script_setup_true_lang-DJno3jA3.js";
7
+ import { D as he } from "./use-dict-options-DjtbYYIa.js";
8
+ import { D as ge, a as ye, r as ze } from "./district-service-cOu1tbQG.js";
9
+ import { U as Ve } from "./upload-image-source-On8NHgmx.js";
10
+ import H from "@nuxt/ui/components/Input.vue";
11
+ import Z from "@nuxt/ui/components/InputNumber.vue";
12
+ import Fe from "@nuxt/ui/components/RadioGroup.vue";
13
+ import Q from "@nuxt/ui/components/Select.vue";
14
+ import X from "@nuxt/ui/components/Textarea.vue";
15
+ import { _ as Y } from "./SaberDictCheckbox.vue_vue_type_script_setup_true_lang-DUbzy_C6.js";
16
+ import { a as ee, _ as te } from "./SaberDictRadio.vue_vue_type_script_setup_true_lang-DR6-jSID.js";
17
+ import { _ as oe } from "./SaberDictSelect.vue_vue_type_script_setup_true_lang-BKdOdlFX.js";
18
+ import { _ as ne } from "./SaberDistrictSelect.vue_vue_type_script_setup_true_lang-jkl2AOay.js";
19
+ function M(e) {
20
+ return e == null ? !1 : typeof e == "string" ? e.trim() !== "" : Array.isArray(e) ? e.some(M) : typeof e == "object" ? Object.values(e).some(M) : !0;
21
+ }
22
+ function xe(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((n) => !xe(e[n.key], t[n.key])) : o.some((n) => M(e[n.key]));
32
+ }
33
+ const ae = Symbol("SaberFormRegistry");
34
+ function ke(e = {}) {
35
+ const o = new Map(Object.entries(e));
36
+ return {
37
+ register(t, n) {
38
+ o.set(t, n);
39
+ },
40
+ registerMany(t) {
41
+ Object.entries(t).forEach(([n, r]) => o.set(n, r));
42
+ },
43
+ resolve(t) {
44
+ return o.get(t);
45
+ },
46
+ has(t) {
47
+ return o.has(t);
48
+ }
49
+ };
50
+ }
51
+ function re() {
52
+ return de(ae, void 0);
53
+ }
54
+ const E = /* @__PURE__ */ new Set(), we = {
55
+ name: "SaberMissingFormComponent",
56
+ setup() {
57
+ return () => pe("div", { class: "text-muted text-sm" }, "组件未注册");
58
+ }
59
+ };
60
+ function se(e, o) {
61
+ if (typeof o != "string") return o;
62
+ const t = e == null ? void 0 : e.resolve(o);
63
+ return t || (E.has(o) || (E.add(o), console.warn(`[SaberUI] Form component "${o}" is not registered.`)), we);
64
+ }
65
+ const Ue = { class: "flex gap-2 flex-wrap" }, Ce = /* @__PURE__ */ F({
66
+ name: "SaberFilterBar",
67
+ __name: "SaberFilterBar",
68
+ props: /* @__PURE__ */ b({
69
+ fields: {},
70
+ initialParams: { default: null },
71
+ size: { default: "lg" }
72
+ }, {
73
+ modelValue: { default: () => ({}) },
74
+ modelModifiers: {}
75
+ }),
76
+ emits: /* @__PURE__ */ b(["search", "reset", "refresh"], ["update:modelValue"]),
77
+ setup(e, { expose: o, emit: t }) {
78
+ const n = e, r = t, i = x(e, "modelValue"), d = re(), l = h(() => w[n.size]), s = h(() => $e(i.value, n.fields, n.initialParams));
79
+ o({ hasActiveFilters: s });
80
+ function _(c = "change") {
81
+ return c === "manual" ? {} : c === "update:model-value" ? { "update:modelValue": () => r("search") } : { change: () => r("search") };
82
+ }
83
+ function p() {
84
+ s.value ? r("reset") : r("refresh");
85
+ }
86
+ function f(c) {
87
+ var S;
88
+ const g = (S = c.props) == null ? void 0 : S.size;
89
+ return typeof g == "string" ? g === "sl" && typeof c.which == "string" && c.which.startsWith("ui-") ? "sm" : g : typeof c.which == "string" && c.which.startsWith("ui-") ? l.value.nuxtSize : n.size;
90
+ }
91
+ return (c, g) => {
92
+ const S = B;
93
+ return v(), D("div", Ue, [
94
+ A(c.$slots, "leading"),
95
+ (v(!0), D(T, null, K(e.fields, (a) => (v(), y(W(k(se)(k(d), a.which)), V({
96
+ key: a.key,
97
+ modelValue: i.value[a.key],
98
+ "onUpdate:modelValue": (u) => i.value[a.key] = u
99
+ }, { ref_for: !0 }, a.props, {
100
+ size: f(a),
101
+ class: a.class
102
+ }, G(_(a.searchOn))), null, 16, ["modelValue", "onUpdate:modelValue", "size", "class"]))), 128)),
103
+ $(S, {
104
+ icon: s.value ? "i-mdi:close" : "i-solar:refresh-bold",
105
+ variant: "outline",
106
+ color: "neutral",
107
+ block: "",
108
+ size: l.value.nuxtSize,
109
+ class: J([l.value.square, "is-plain shrink-0 ml-auto"]),
110
+ onClick: p
111
+ }, null, 8, ["icon", "size", "class"]),
112
+ A(c.$slots, "trailing")
113
+ ]);
114
+ };
115
+ }
116
+ }), De = /* @__PURE__ */ F({
117
+ name: "SaberFormModal",
118
+ inheritAttrs: !1,
119
+ __name: "SaberFormModal",
120
+ props: /* @__PURE__ */ b({
121
+ fields: {},
122
+ model: { default: void 0 },
123
+ validate: { type: Function, default: void 0 },
124
+ submit: {},
125
+ title: { default: void 0 },
126
+ description: { default: void 0 },
127
+ width: { default: "w-140" },
128
+ cancelLabel: { default: "取消" },
129
+ submitLabel: { default: "保存" },
130
+ closeOnSuccess: { type: Boolean, default: !0 },
131
+ fieldSize: { default: "lg" }
132
+ }, {
133
+ open: { type: Boolean, default: !1 },
134
+ openModifiers: {}
135
+ }),
136
+ emits: /* @__PURE__ */ b(["success", "error"], ["update:open"]),
137
+ setup(e, { emit: o }) {
138
+ const t = e, n = o, r = x(e, "open"), i = re();
139
+ function d() {
140
+ return { ...t.model ?? {} };
141
+ }
142
+ const l = O(d());
143
+ j(r, (a) => {
144
+ a && (l.value = d());
145
+ }), j(
146
+ () => t.model,
147
+ () => {
148
+ r.value && (l.value = d());
149
+ },
150
+ { deep: !0 }
151
+ );
152
+ function s(a) {
153
+ var u;
154
+ return ((u = t.validate) == null ? void 0 : u.call(t, a)) ?? [];
155
+ }
156
+ const _ = O(!1), p = fe("form");
157
+ function f(a) {
158
+ var u;
159
+ (u = p.value) == null || u.clear(String(a.key));
160
+ }
161
+ function c(a) {
162
+ return {
163
+ onChange: () => f(a),
164
+ "onUpdate:modelValue": () => f(a)
165
+ };
166
+ }
167
+ function g(a) {
168
+ var U;
169
+ const u = (U = a.props) == null ? void 0 : U.size;
170
+ return typeof u == "string" ? u === "sl" && typeof a.which == "string" && a.which.startsWith("ui-") ? "sm" : u : typeof a.which == "string" && a.which.startsWith("ui-") ? w[t.fieldSize].nuxtSize : t.fieldSize;
171
+ }
172
+ async function S() {
173
+ _.value = !0;
174
+ try {
175
+ const a = await t.submit(l.value);
176
+ n("success", a), t.closeOnSuccess && (r.value = !1);
177
+ } catch (a) {
178
+ n("error", a);
179
+ } finally {
180
+ _.value = !1;
181
+ }
182
+ }
183
+ return (a, u) => {
184
+ const U = Se, me = _e, I = B;
185
+ return v(), y(q, {
186
+ open: r.value,
187
+ "onUpdate:open": u[2] || (u[2] = (m) => r.value = m),
188
+ title: e.title,
189
+ description: e.description,
190
+ width: e.width
191
+ }, {
192
+ footer: z(() => [
193
+ $(I, {
194
+ color: "neutral",
195
+ variant: "outline",
196
+ class: "h-10 px-12",
197
+ onClick: u[0] || (u[0] = (m) => r.value = !1)
198
+ }, {
199
+ default: z(() => [
200
+ R(N(e.cancelLabel), 1)
201
+ ]),
202
+ _: 1
203
+ }),
204
+ $(I, {
205
+ color: "primary",
206
+ class: "h-10 px-12",
207
+ loading: _.value,
208
+ onClick: u[1] || (u[1] = (m) => {
209
+ var C;
210
+ return (C = p.value) == null ? void 0 : C.submit();
211
+ })
212
+ }, {
213
+ default: z(() => [
214
+ R(N(e.submitLabel), 1)
215
+ ]),
216
+ _: 1
217
+ }, 8, ["loading"])
218
+ ]),
219
+ default: z(() => [
220
+ $(me, V({ ref: "form" }, a.$attrs, {
221
+ validate: s,
222
+ state: l.value,
223
+ "validate-on": ["blur"],
224
+ class: "saberInput flex flex-col gap-4",
225
+ onSubmit: S
226
+ }), {
227
+ default: z(() => [
228
+ (v(!0), D(T, null, K(e.fields, (m) => (v(), y(U, {
229
+ key: String(m.key),
230
+ name: String(m.key),
231
+ label: m.label,
232
+ class: J(m.class),
233
+ ui: { label: "text-muted mb-1" }
234
+ }, {
235
+ default: z(() => [
236
+ (v(), y(W(k(se)(k(i), m.which)), V({
237
+ modelValue: l.value[m.key],
238
+ "onUpdate:modelValue": (C) => l.value[m.key] = C
239
+ }, { ref_for: !0 }, m.props, {
240
+ size: g(m)
241
+ }, G(c(m))), null, 16, ["modelValue", "onUpdate:modelValue", "size"]))
242
+ ]),
243
+ _: 2
244
+ }, 1032, ["name", "label", "class"]))), 128))
245
+ ]),
246
+ _: 1
247
+ }, 16, ["state"])
248
+ ]),
249
+ _: 1
250
+ }, 8, ["open", "title", "description", "width"]);
251
+ };
252
+ }
253
+ }), ie = /* @__PURE__ */ F({
254
+ inheritAttrs: !1,
255
+ __name: "SaberInput",
256
+ props: /* @__PURE__ */ b({
257
+ clearable: { type: Boolean, default: !0 },
258
+ size: { default: "lg" },
259
+ ui: {}
260
+ }, {
261
+ modelValue: { default: "" },
262
+ modelModifiers: {}
263
+ }),
264
+ emits: /* @__PURE__ */ b(["change"], ["update:modelValue"]),
265
+ setup(e, { emit: o }) {
266
+ const t = e, n = x(e, "modelValue"), r = o, i = ve(), d = h(() => w[t.size]), l = h(() => {
267
+ var p;
268
+ return {
269
+ ...t.ui,
270
+ base: [d.value.height, "text-sm/5", (p = t.ui) == null ? void 0 : p.base].filter(Boolean).join(" ")
271
+ };
272
+ }), s = h(() => !t.clearable || i.disabled != null || i.readonly != null ? !1 : n.value !== void 0 && n.value !== null && String(n.value) !== "");
273
+ function _() {
274
+ n.value = "", r("change", n.value);
275
+ }
276
+ return (p, f) => {
277
+ const c = B, g = H;
278
+ return v(), y(g, V({
279
+ modelValue: n.value,
280
+ "onUpdate:modelValue": f[1] || (f[1] = (S) => n.value = S)
281
+ }, k(i), {
282
+ size: d.value.nuxtSize,
283
+ ui: l.value,
284
+ onChange: f[2] || (f[2] = (S) => r("change", n.value))
285
+ }), be({ _: 2 }, [
286
+ s.value ? {
287
+ name: "trailing",
288
+ fn: z(() => [
289
+ $(c, {
290
+ tabindex: "-1",
291
+ color: "neutral",
292
+ variant: "ghost",
293
+ icon: "i-solar:close-circle-outline",
294
+ ui: { base: "p-1 min-w-0 -mr-1", leadingIcon: "size-4" },
295
+ onMousedown: f[0] || (f[0] = L(() => {
296
+ }, ["stop", "prevent"])),
297
+ onClick: L(_, ["stop", "prevent"])
298
+ })
299
+ ]),
300
+ key: "0"
301
+ } : void 0
302
+ ]), 1040, ["modelValue", "size", "ui"]);
303
+ };
304
+ }
305
+ }), le = /* @__PURE__ */ F({
306
+ inheritAttrs: !1,
307
+ __name: "SaberInputNumber",
308
+ props: /* @__PURE__ */ b({
309
+ size: { default: "lg" },
310
+ ui: {}
311
+ }, {
312
+ modelValue: { default: void 0 },
313
+ modelModifiers: {}
314
+ }),
315
+ emits: /* @__PURE__ */ b(["change"], ["update:modelValue"]),
316
+ setup(e, { emit: o }) {
317
+ const t = e, n = x(e, "modelValue"), r = o, i = h(() => w[t.size]), d = h(() => {
318
+ var s;
319
+ return {
320
+ ...t.ui,
321
+ base: [i.value.height, "rounded-sm", (s = t.ui) == null ? void 0 : s.base].filter(Boolean).join(" ")
322
+ };
323
+ });
324
+ function l(s) {
325
+ n.value = s, r("change", s);
326
+ }
327
+ return (s, _) => {
328
+ const p = Z;
329
+ return v(), y(p, V({ "model-value": n.value }, s.$attrs, {
330
+ size: i.value.nuxtSize,
331
+ ui: d.value,
332
+ "onUpdate:modelValue": l
333
+ }), null, 16, ["model-value", "size", "ui"]);
334
+ };
335
+ }
336
+ }), ue = /* @__PURE__ */ F({
337
+ inheritAttrs: !1,
338
+ __name: "SaberSelect",
339
+ props: /* @__PURE__ */ b({
340
+ size: { default: "lg" },
341
+ ui: {}
342
+ }, {
343
+ modelValue: { default: void 0 },
344
+ modelModifiers: {}
345
+ }),
346
+ emits: /* @__PURE__ */ b(["change"], ["update:modelValue"]),
347
+ setup(e, { emit: o }) {
348
+ const t = e, n = x(e, "modelValue"), r = o, i = h(() => w[t.size]), d = h(() => {
349
+ var s;
350
+ return {
351
+ ...t.ui,
352
+ base: [i.value.height, (s = t.ui) == null ? void 0 : s.base].filter(Boolean).join(" ")
353
+ };
354
+ });
355
+ function l(s) {
356
+ n.value = s, r("change", s);
357
+ }
358
+ return (s, _) => {
359
+ const p = Q;
360
+ return v(), y(p, V({ "model-value": n.value }, s.$attrs, {
361
+ size: i.value.nuxtSize,
362
+ ui: d.value,
363
+ class: "saberButton",
364
+ "onUpdate:modelValue": l
365
+ }), null, 16, ["model-value", "size", "ui"]);
366
+ };
367
+ }
368
+ }), ce = /* @__PURE__ */ F({
369
+ inheritAttrs: !1,
370
+ __name: "SaberTextarea",
371
+ props: {
372
+ modelValue: { default: "" },
373
+ modelModifiers: {}
374
+ },
375
+ emits: /* @__PURE__ */ b(["change"], ["update:modelValue"]),
376
+ setup(e, { emit: o }) {
377
+ const t = x(e, "modelValue"), n = o;
378
+ function r(i) {
379
+ t.value = i, n("change", i);
380
+ }
381
+ return (i, d) => {
382
+ const l = X;
383
+ return v(), y(l, V({ "model-value": t.value }, i.$attrs, { "onUpdate:modelValue": r }), null, 16, ["model-value"]);
384
+ };
385
+ }
386
+ }), Me = {
387
+ "saber-input": ie,
388
+ "saber-input-number": le,
389
+ "saber-dict-checkbox": Y,
390
+ "saber-dict-radio": te,
391
+ "saber-dict-select": oe,
392
+ "saber-district-select": ne,
393
+ "saber-pop-select": P,
394
+ "saber-select": ue,
395
+ "saber-textarea": ce,
396
+ "saber-radio-group": ee,
397
+ "ui-input": H,
398
+ "ui-input-number": Z,
399
+ "ui-select": Q,
400
+ "ui-textarea": X,
401
+ "ui-radio-group": Fe
402
+ }, Be = {
403
+ SaberInput: ie,
404
+ SaberInputNumber: le,
405
+ SaberDictCheckbox: Y,
406
+ SaberDictRadio: te,
407
+ SaberDictSelect: oe,
408
+ SaberDistrictSelect: ne,
409
+ SaberPopSelect: P,
410
+ SaberSelect: ue,
411
+ SaberTextarea: ce,
412
+ SaberRadioGroup: ee
413
+ };
414
+ function Xe(e, o = {}) {
415
+ const t = ke({
416
+ ...Me,
417
+ ...o.components
418
+ });
419
+ return e.provide(ae, t), o.dictDataSource && e.provide(he, o.dictDataSource), o.uploadImageDataSource && e.provide(Ve, o.uploadImageDataSource), e.provide(ge, ye(ze(o.district))), e.component("SaberFilterBar", Ce), e.component("SaberFormModal", De), e.component("SaberModal", q), Object.entries(Be).forEach(([n, r]) => e.component(n, r)), t;
420
+ }
421
+ export {
422
+ ae as F,
423
+ Ce as _,
424
+ De as a,
425
+ ie as b,
426
+ le as c,
427
+ ue as d,
428
+ ce as e,
429
+ Me as f,
430
+ Be as g,
431
+ ke as h,
432
+ $e as i,
433
+ M as j,
434
+ Xe as k,
435
+ xe as l,
436
+ se as r,
437
+ re as u
438
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owocow/saber-ui",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Saber application foundation for Vue 3 projects built on Nuxt UI",
5
5
  "type": "module",
6
6
  "sideEffects": false,