@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.
Files changed (29) hide show
  1. package/dist/{SaberAppLayout.vue_vue_type_script_setup_true_lang-R7F5K7kj.js → SaberAppLayout.vue_vue_type_script_setup_true_lang-DaxscIFe.js} +2 -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
  3. package/dist/SaberDistrictSelect.vue_vue_type_script_setup_true_lang-jkl2AOay.js +272 -0
  4. package/dist/SaberPopSelect.vue_vue_type_script_setup_true_lang-eH8jkkzK.js +162 -0
  5. package/dist/SaberSwitchBar.vue_vue_type_script_setup_true_lang-CIbFBx5r.js +47 -0
  6. package/dist/components/SaberAppLayout.mjs +1 -1
  7. package/dist/components/SaberPagination.vue.d.ts +49 -0
  8. package/dist/components/SaberSwitchBar.mjs +1 -1
  9. package/dist/control-size.d.ts +33 -0
  10. package/dist/forms/components/SaberFilterBar.vue.d.ts +3 -0
  11. package/dist/forms/components/SaberFormModal.vue.d.ts +2 -0
  12. package/dist/forms/components/fields/SaberDistrictSelect.vue.d.ts +5 -0
  13. package/dist/forms/components/fields/SaberInput.vue.d.ts +5 -0
  14. package/dist/forms/components/fields/SaberInputNumber.vue.d.ts +10 -2
  15. package/dist/forms/components/fields/SaberPopSelect.vue.d.ts +4 -1
  16. package/dist/forms/components/fields/SaberSelect.vue.d.ts +10 -2
  17. package/dist/forms/dict-select.mjs +1 -1
  18. package/dist/forms/district-select.mjs +1 -1
  19. package/dist/forms/index.d.ts +1 -0
  20. package/dist/forms/pop-select.mjs +1 -1
  21. package/dist/forms.mjs +4 -4
  22. package/dist/index.d.ts +4 -1
  23. package/dist/index.mjs +176 -98
  24. package/dist/plugin-DvH6j00c.js +442 -0
  25. package/package.json +1 -1
  26. package/dist/SaberDistrictSelect.vue_vue_type_script_setup_true_lang-BX8nLC35.js +0 -257
  27. package/dist/SaberPopSelect.vue_vue_type_script_setup_true_lang-BcS27NXI.js +0 -125
  28. package/dist/SaberSwitchBar.vue_vue_type_script_setup_true_lang-CDx3Dcas.js +0 -47
  29. package/dist/plugin-Dr3z0YFg.js +0 -396
@@ -0,0 +1,442 @@
1
+ import B from "@nuxt/ui/components/Button.vue";
2
+ import { inject as de, h as pe, defineComponent as F, useModel as $, computed as h, openBlock as b, createElementBlock as D, renderSlot as A, Fragment as T, renderList as K, createBlock as y, resolveDynamicComponent as W, unref as x, mergeProps as V, toHandlers as G, createVNode as k, normalizeClass as J, mergeModels as v, ref as O, watch as j, useTemplateRef as fe, withCtx as z, createTextVNode as R, toDisplayString as N, useAttrs as be, createSlots as ve, 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 $e(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 ke(e, o, t) {
31
+ return t != null ? o.some((n) => !$e(e[n.key], t[n.key])) : o.some((n) => M(e[n.key]));
32
+ }
33
+ const ae = Symbol("SaberFormRegistry");
34
+ function xe(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" }, Ce = /* @__PURE__ */ F({
66
+ name: "SaberFilterBar",
67
+ __name: "SaberFilterBar",
68
+ props: /* @__PURE__ */ v({
69
+ fields: {},
70
+ initialParams: { default: null },
71
+ size: { default: "lg" }
72
+ }, {
73
+ modelValue: { default: () => ({}) },
74
+ modelModifiers: {}
75
+ }),
76
+ emits: /* @__PURE__ */ v(["search", "reset", "refresh"], ["update:modelValue"]),
77
+ setup(e, { expose: o, emit: t }) {
78
+ const n = e, r = t, i = $(e, "modelValue"), d = re(), l = h(() => w[n.size]), s = h(() => ke(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 b(), D("div", Ue, [
94
+ A(c.$slots, "leading"),
95
+ (b(!0), D(T, null, K(e.fields, (a) => (b(), y(W(x(se)(x(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
+ k(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__ */ v({
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__ */ v(["success", "error"], ["update:open"]),
137
+ setup(e, { emit: o }) {
138
+ const t = e, n = o, r = $(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 b(), 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
+ k(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
+ k(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
+ k(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
+ (b(!0), D(T, null, K(e.fields, (m) => (b(), 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
+ (b(), y(W(x(se)(x(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__ */ v({
257
+ clearable: { type: Boolean, default: !0 },
258
+ size: { default: "lg" },
259
+ ui: {}
260
+ }, {
261
+ modelValue: { default: "" },
262
+ modelModifiers: {}
263
+ }),
264
+ emits: /* @__PURE__ */ v(["change"], ["update:modelValue"]),
265
+ setup(e, { emit: o }) {
266
+ const t = e, n = $(e, "modelValue"), r = o, i = be(), d = h(() => w[t.size]), l = h(() => {
267
+ var p;
268
+ return {
269
+ ...t.ui,
270
+ base: [d.value.height, (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 b(), y(g, V({
279
+ modelValue: n.value,
280
+ "onUpdate:modelValue": f[1] || (f[1] = (S) => n.value = S)
281
+ }, x(i), {
282
+ size: d.value.nuxtSize,
283
+ ui: l.value,
284
+ class: "saberInput",
285
+ onChange: f[2] || (f[2] = (S) => r("change", n.value))
286
+ }), ve({ _: 2 }, [
287
+ s.value ? {
288
+ name: "trailing",
289
+ fn: z(() => [
290
+ k(c, {
291
+ tabindex: "-1",
292
+ color: "neutral",
293
+ variant: "ghost",
294
+ icon: "i-solar:close-circle-outline",
295
+ ui: { base: "p-1 min-w-0 -mr-1", leadingIcon: "size-4" },
296
+ onMousedown: f[0] || (f[0] = L(() => {
297
+ }, ["stop", "prevent"])),
298
+ onClick: L(_, ["stop", "prevent"])
299
+ })
300
+ ]),
301
+ key: "0"
302
+ } : void 0
303
+ ]), 1040, ["modelValue", "size", "ui"]);
304
+ };
305
+ }
306
+ }), le = /* @__PURE__ */ F({
307
+ inheritAttrs: !1,
308
+ __name: "SaberInputNumber",
309
+ props: /* @__PURE__ */ v({
310
+ size: { default: "lg" },
311
+ ui: {}
312
+ }, {
313
+ modelValue: { default: void 0 },
314
+ modelModifiers: {}
315
+ }),
316
+ emits: /* @__PURE__ */ v(["change"], ["update:modelValue"]),
317
+ setup(e, { emit: o }) {
318
+ const t = e, n = $(e, "modelValue"), r = o, i = h(() => w[t.size]), d = h(() => {
319
+ var s;
320
+ return {
321
+ ...t.ui,
322
+ base: [i.value.height, "rounded-sm", (s = t.ui) == null ? void 0 : s.base].filter(Boolean).join(" ")
323
+ };
324
+ });
325
+ function l(s) {
326
+ n.value = s, r("change", s);
327
+ }
328
+ return (s, _) => {
329
+ const p = Z;
330
+ return b(), y(p, V({ "model-value": n.value }, s.$attrs, {
331
+ size: i.value.nuxtSize,
332
+ ui: d.value,
333
+ "onUpdate:modelValue": l
334
+ }), null, 16, ["model-value", "size", "ui"]);
335
+ };
336
+ }
337
+ }), ue = /* @__PURE__ */ F({
338
+ inheritAttrs: !1,
339
+ __name: "SaberSelect",
340
+ props: /* @__PURE__ */ v({
341
+ size: { default: "lg" },
342
+ ui: {}
343
+ }, {
344
+ modelValue: { default: void 0 },
345
+ modelModifiers: {}
346
+ }),
347
+ emits: /* @__PURE__ */ v(["change"], ["update:modelValue"]),
348
+ setup(e, { emit: o }) {
349
+ const t = e, n = $(e, "modelValue"), r = o, i = h(() => w[t.size]), d = h(() => {
350
+ var s;
351
+ return {
352
+ ...t.ui,
353
+ base: [i.value.height, (s = t.ui) == null ? void 0 : s.base].filter(Boolean).join(" ")
354
+ };
355
+ });
356
+ function l(s) {
357
+ n.value = s, r("change", s);
358
+ }
359
+ return (s, _) => {
360
+ const p = Q;
361
+ return b(), y(p, V({ "model-value": n.value }, s.$attrs, {
362
+ size: i.value.nuxtSize,
363
+ ui: d.value,
364
+ class: "saberButton",
365
+ "onUpdate:modelValue": l
366
+ }), null, 16, ["model-value", "size", "ui"]);
367
+ };
368
+ }
369
+ }), ce = /* @__PURE__ */ F({
370
+ inheritAttrs: !1,
371
+ __name: "SaberTextarea",
372
+ props: {
373
+ modelValue: { default: "" },
374
+ modelModifiers: {}
375
+ },
376
+ emits: /* @__PURE__ */ v(["change"], ["update:modelValue"]),
377
+ setup(e, { emit: o }) {
378
+ const t = $(e, "modelValue"), n = o;
379
+ function r(i) {
380
+ t.value = i, n("change", i);
381
+ }
382
+ return (i, d) => {
383
+ const l = X;
384
+ return b(), y(l, V({ "model-value": t.value }, i.$attrs, {
385
+ class: "saberInput",
386
+ "onUpdate:modelValue": r
387
+ }), null, 16, ["model-value"]);
388
+ };
389
+ }
390
+ }), Me = {
391
+ "saber-input": ie,
392
+ "saber-input-number": le,
393
+ "saber-dict-checkbox": Y,
394
+ "saber-dict-radio": te,
395
+ "saber-dict-select": oe,
396
+ "saber-district-select": ne,
397
+ "saber-pop-select": P,
398
+ "saber-select": ue,
399
+ "saber-textarea": ce,
400
+ "saber-radio-group": ee,
401
+ "ui-input": H,
402
+ "ui-input-number": Z,
403
+ "ui-select": Q,
404
+ "ui-textarea": X,
405
+ "ui-radio-group": Fe
406
+ }, Be = {
407
+ SaberInput: ie,
408
+ SaberInputNumber: le,
409
+ SaberDictCheckbox: Y,
410
+ SaberDictRadio: te,
411
+ SaberDictSelect: oe,
412
+ SaberDistrictSelect: ne,
413
+ SaberPopSelect: P,
414
+ SaberSelect: ue,
415
+ SaberTextarea: ce,
416
+ SaberRadioGroup: ee
417
+ };
418
+ function Xe(e, o = {}) {
419
+ const t = xe({
420
+ ...Me,
421
+ ...o.components
422
+ });
423
+ 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;
424
+ }
425
+ export {
426
+ ae as F,
427
+ Ce as _,
428
+ De as a,
429
+ ie as b,
430
+ le as c,
431
+ ue as d,
432
+ ce as e,
433
+ Me as f,
434
+ Be as g,
435
+ xe as h,
436
+ ke as i,
437
+ M as j,
438
+ Xe as k,
439
+ $e as l,
440
+ se as r,
441
+ re as u
442
+ };
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.14",
4
4
  "description": "Saber application foundation for Vue 3 projects built on Nuxt UI",
5
5
  "type": "module",
6
6
  "sideEffects": false,