@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
@@ -1,396 +0,0 @@
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
- };