@ithinkdt/ui 4.0.0-38 → 4.0.0-400

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 (60) hide show
  1. package/auto-imports.js +1 -1
  2. package/dist/components-B_qzc9ro.js +1736 -0
  3. package/dist/components.js +5 -0
  4. package/dist/directives-qqYcWl1I.js +194 -0
  5. package/dist/directives.js +3 -0
  6. package/dist/index.js +1212 -0
  7. package/dist/page.js +519 -0
  8. package/dist/use-i18n-Dx7V4KrY.js +6 -0
  9. package/dist/use-style-DcT-1dj4.js +29 -0
  10. package/dist/use-style.js +2 -0
  11. package/{src → esm}/components.d.ts +56 -15
  12. package/esm/components.js +1 -0
  13. package/esm/directives.js +1 -0
  14. package/esm/index.js +1 -0
  15. package/{src → esm}/page.d.ts +2 -2
  16. package/esm/page.js +1 -0
  17. package/esm/use-style.js +1 -0
  18. package/package.json +29 -26
  19. package/unocss-preset.d.ts +5 -0
  20. package/unocss-preset.js +163 -0
  21. package/src/components/Checkboxes.jsx +0 -130
  22. package/src/components/DataActions.jsx +0 -105
  23. package/src/components/DataCustom.jsx +0 -187
  24. package/src/components/DataFilter.jsx +0 -119
  25. package/src/components/DataForm.jsx +0 -264
  26. package/src/components/DataLocaleInput.jsx +0 -121
  27. package/src/components/DataPagination.jsx +0 -62
  28. package/src/components/DataSelection.jsx +0 -57
  29. package/src/components/DataTable.jsx +0 -302
  30. package/src/components/Radios.jsx +0 -134
  31. package/src/components/UserDept.jsx +0 -643
  32. package/src/components/assets.jsx +0 -274
  33. package/src/components/index.js +0 -11
  34. package/src/design/Account.jsx +0 -154
  35. package/src/design/Appearance.jsx +0 -89
  36. package/src/design/Breadcrumb.jsx +0 -67
  37. package/src/design/Fullscreen.jsx +0 -65
  38. package/src/design/Language.jsx +0 -45
  39. package/src/design/Layout.jsx +0 -241
  40. package/src/design/Logo.jsx +0 -92
  41. package/src/design/Menu.jsx +0 -133
  42. package/src/design/MultiTabs.jsx +0 -501
  43. package/src/design/Notification.jsx +0 -311
  44. package/src/design/Tenant.jsx +0 -88
  45. package/src/design/common.jsx +0 -21
  46. package/src/design/index.js +0 -11
  47. package/src/directives/index.js +0 -2
  48. package/src/directives/spin.js +0 -181
  49. package/src/directives/tooltip.jsx +0 -121
  50. package/src/index.js +0 -18
  51. package/src/page.jsx +0 -740
  52. package/src/use-i18n.js +0 -8
  53. package/src/use-style.js +0 -58
  54. package/src/utils.js +0 -20
  55. package/unocss.d.ts +0 -5
  56. package/unocss.js +0 -94
  57. /package/{src → esm}/design.d.ts +0 -0
  58. /package/{src → esm}/directives.d.ts +0 -0
  59. /package/{src → esm}/index.d.ts +0 -0
  60. /package/{src → esm}/use-style.d.ts +0 -0
package/dist/page.js ADDED
@@ -0,0 +1,519 @@
1
+ import { n as useI18n } from "./use-i18n-Dx7V4KrY.js";
2
+ import "./directives-qqYcWl1I.js";
3
+ import "./use-style-DcT-1dj4.js";
4
+ import { a as NRadios, n as DtUserDept, p as DataForm, r as DtUserRender, t as DtDeptRender, v as NCheckboxes } from "./components-B_qzc9ro.js";
5
+ import { computed, createVNode, defineComponent, h, isVNode, mergeProps, ref, shallowRef, unref } from "vue";
6
+ import { until } from "@vueuse/core";
7
+ import { NButton, NCheckbox, NColorPicker, NDatePicker, NDrawer, NDrawerContent, NFlex, NInput, NInputNumber, NModal, NScrollbar, NSelect, NText, NUpload, useMessage } from "ithinkdt-ui";
8
+ import { format } from "date-fns";
9
+ import { useFormItem } from "ithinkdt-ui/es/_mixins";
10
+ import { useDict, useDictMap } from "@ithinkdt/common/dict";
11
+ function _isSlot(n) {
12
+ return typeof n == "function" || Object.prototype.toString.call(n) === "[object Object]" && !isVNode(n);
13
+ }
14
+ var mapProps = (n) => Object.fromEntries(Object.entries(n || {}).map(([n, c]) => [n, unref(c)])), SimpleUpload = /* @__PURE__ */ defineComponent({
15
+ name: "SimpleUpload",
16
+ props: {
17
+ type: {
18
+ type: String,
19
+ default: "file"
20
+ },
21
+ size: {
22
+ type: String,
23
+ default: "medium"
24
+ },
25
+ multiple: {
26
+ type: Boolean,
27
+ default: !1
28
+ },
29
+ max: {
30
+ type: Number,
31
+ default: void 0
32
+ },
33
+ accept: {
34
+ type: String,
35
+ default: void 0
36
+ },
37
+ maxSize: {
38
+ type: Number,
39
+ default: void 0
40
+ },
41
+ disabled: {
42
+ type: Boolean,
43
+ default: void 0
44
+ },
45
+ fileList: {
46
+ type: Array,
47
+ default: () => []
48
+ },
49
+ onUpdateFileList: { type: [Array, Function] },
50
+ uploadFile: { type: Function }
51
+ },
52
+ setup(c, { slots: l, expose: u }) {
53
+ let { t: d } = useI18n();
54
+ SimpleUpload.t = d;
55
+ let f = useFormItem(c), p = useMessage(), g = computed(() => c.customRequest || (({ file: n, onProgress: l, onFinish: u, onError: d }) => {
56
+ c.uploadFile(n.file, (n) => l({ percent: n })).then((c) => {
57
+ n.file.fileId = c, u();
58
+ }).catch((n) => {
59
+ p.error(n.message), d(n);
60
+ });
61
+ })), _ = ref();
62
+ u({ submit() {
63
+ return until(_).toBeTruthy().then((n) => n.submit());
64
+ } });
65
+ let v = (n) => {
66
+ c.onUpdateFileList?.(n), nextTick(() => f.nTriggerFormChange());
67
+ };
68
+ return () => {
69
+ let { type: n, onUpdateFileList: u, ...p } = c;
70
+ return createVNode(NUpload, mergeProps(p, {
71
+ ref: _,
72
+ customRequest: g.value,
73
+ listType: n === "image" ? "image-card" : "text",
74
+ accept: p.accept ?? n === "image" ? "image/*" : void 0,
75
+ "onUpdate:fileList": v
76
+ }), {
77
+ default: n === "image" ? void 0 : () => {
78
+ let n;
79
+ return createVNode(NButton, {
80
+ disabled: f.mergedDisabledRef.value,
81
+ size: f.mergedSizeRef.value
82
+ }, _isSlot(n = d("common.page.form.selectFileText")) ? n : { default: () => [n] });
83
+ },
84
+ ...l
85
+ });
86
+ };
87
+ }
88
+ });
89
+ function createPageFormHelper({ getUserGroups: n, getUsersByGroup: u, getDeptsByCode: f, getUsersByDept: m, getUsersByUsername: g, uploadFile: v, getFileInfos: y }) {
90
+ return {
91
+ input: () => ({ slots: n, props: c }, { modelValue: l, "onUpdate:modelValue": u, required: d, readonly: f, ...p }) => f ? createVNode(NText, {
92
+ depth: 2,
93
+ style: "line-height: 1.25"
94
+ }, { default: () => [l ?? ""] }) : (c = mapProps(c), h(NInput, {
95
+ clearable: !0,
96
+ ...c,
97
+ ...p,
98
+ value: l,
99
+ "onUpdate:value": u
100
+ }, n)),
101
+ number: () => ({ slots: n, props: c }, { modelValue: l, "onUpdate:modelValue": u, required: d, readonly: f, ...p }) => f ? createVNode(NText, {
102
+ depth: 2,
103
+ style: "line-height: 1.25"
104
+ }, { default: () => [l ?? ""] }) : (c = mapProps(c), h(NInputNumber, {
105
+ clearable: !0,
106
+ ...c,
107
+ ...p,
108
+ value: l,
109
+ "onUpdate:value": u
110
+ }, n)),
111
+ select: () => {
112
+ let n, c;
113
+ return ({ slots: l, props: u }, { modelValue: d, "onUpdate:modelValue": f, required: p, readonly: m, ...g }) => {
114
+ let { dictType: v, options: y, ...b } = mapProps(u);
115
+ if (y ? c = y : n !== v && (n = v, !c && n && (c = useDict(n))), m) if (b.multiple) {
116
+ let n;
117
+ return createVNode(NText, {
118
+ depth: 2,
119
+ style: "line-height: 1.25"
120
+ }, _isSlot(n = (d?.map((n) => c?.find((c) => c[b.valueField || "value"] === n)) ?? []).map((n, c, l) => {
121
+ let u = n ? b.renderLabel ? b.renderLabel(n) ?? "" : n[b.labelField || "label"] ?? "" : d[c] ?? "";
122
+ return createVNode("span", { key: n ? n[b.valueField || "value"] : d[c] ?? "" }, [u, c < l.length - 1 ? ", " : ""]);
123
+ })) ? n : { default: () => [n] });
124
+ } else {
125
+ let n = c?.find((n) => n[b.valueField || "value"] === d);
126
+ return createVNode(NText, {
127
+ depth: 2,
128
+ style: "line-height: 1.25"
129
+ }, { default: () => [n ? b.renderLabel ? b.renderLabel(n) ?? "" : n[b.labelField || "label"] ?? "" : d ?? ""] });
130
+ }
131
+ return h(NSelect, {
132
+ clearable: !0,
133
+ loading: c?.loading,
134
+ ...b,
135
+ options: unref(c),
136
+ ...g,
137
+ value: d,
138
+ "onUpdate:value": f
139
+ }, l);
140
+ };
141
+ },
142
+ checkbox: () => ({ slots: n, props: c }, { modelValue: l, "onUpdate:modelValue": u, required: d, readonly: f, ...p }) => {
143
+ if (c = mapProps(c), f) {
144
+ let u;
145
+ return u = l === (c.checkedValue ?? !0) ? n?.checked ? n.checked() : createVNode(NCheckbox, { checked: !0 }, null) : n?.unchecked ? n.unchecked() : createVNode(NCheckbox, { disabled: !0 }, null), createVNode(NText, {
146
+ depth: 2,
147
+ style: "line-height: 1.25"
148
+ }, _isSlot(u) ? u : { default: () => [u] });
149
+ }
150
+ return h(NCheckbox, {
151
+ ...c,
152
+ ...p,
153
+ checked: l,
154
+ "onUpdate:checked": u
155
+ }, n);
156
+ },
157
+ checkboxes: () => {
158
+ let n, c;
159
+ return ({ props: l }, { modelValue: u, required: d, readonly: f, ...m }) => {
160
+ let { dictType: g, options: v, ...y } = mapProps(l);
161
+ if (v ? c = v : n !== g && (n = g, !c && n && (c = useDict(n))), f) {
162
+ let n;
163
+ return createVNode(NText, {
164
+ depth: 2,
165
+ style: "line-height: 2.4"
166
+ }, _isSlot(n = (u?.map((n) => c?.find((c) => c[y.valueField || "value"] === n)) ?? []).map((n, c, l) => {
167
+ let d = n ? n[y.labelField ?? "label"] ?? "" : u[c] ?? "";
168
+ return createVNode("span", { key: n ? n[y.valueField ?? "value"] : u[c] ?? "" }, [d, c < l.length - 1 ? ", " : ""]);
169
+ })) ? n : { default: () => [n] });
170
+ }
171
+ return h(NCheckboxes, {
172
+ ...y,
173
+ ...m,
174
+ options: c,
175
+ modelValue: u
176
+ });
177
+ };
178
+ },
179
+ radios: () => {
180
+ let n, l;
181
+ return ({ props: u }, { modelValue: d, required: f, readonly: p, ...m }) => {
182
+ let { dictType: g, options: v, ...y } = mapProps(u);
183
+ if (v ? l = v : n !== g && (n = g, !l && n && (l = useDict(n))), p) {
184
+ let n = l?.find((n) => n[y.valueField ?? "value"] === d);
185
+ return createVNode(NText, {
186
+ depth: 2,
187
+ style: "line-height: 1.25"
188
+ }, { default: () => [n ? n[y.labelField ?? "label"] ?? "" : d ?? ""] });
189
+ }
190
+ return h(NRadios, {
191
+ ...y,
192
+ ...m,
193
+ options: l,
194
+ modelValue: d
195
+ });
196
+ };
197
+ },
198
+ datepicker: () => ({ slots: n, props: c }, { modelValue: l, "onUpdate:modelValue": u, required: d, readonly: f, ...p }) => {
199
+ let { type: m = "date", format: g = m.startsWith("datetime") ? "yyyy-MM-dd HH:mm:ss" : "yyyy-MM-dd", ...v } = mapProps(c);
200
+ return f ? m.endsWith("range") ? createVNode(NText, {
201
+ depth: 2,
202
+ style: "line-height: 1.25"
203
+ }, { default: () => [l ? `${l[0] ? format(l[0], g) : ""} ~ ${l[1] ? format(l[1], g) : ""}` : ""] }) : createVNode(NText, {
204
+ depth: 2,
205
+ style: "line-height: 1.25"
206
+ }, { default: () => [l ? format(l, g) : ""] }) : h(NDatePicker, {
207
+ clearable: !0,
208
+ ...v,
209
+ ...p,
210
+ type: m,
211
+ format: g,
212
+ value: l,
213
+ "onUpdate:value": u
214
+ }, n);
215
+ },
216
+ file: () => ({ slots: n, props: c }, { modelValue: l, "onUpdate:modelValue": u, required: d, readonly: f, ...p }) => {
217
+ if (c = mapProps(c), f) {
218
+ let n;
219
+ return console.warn("[file] 原则上此组建不应该显示在详情中"), fileList.value.length === 0 ? void 0 : createVNode(NFlex, {
220
+ gap: "8",
221
+ vertical: !0
222
+ }, _isSlot(n = l.map((n) => createVNode("a", {
223
+ key: n.id,
224
+ href: n.url,
225
+ target: "_blank",
226
+ rel: "noreferrer",
227
+ style: "max-width: 100px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; display: inline-block"
228
+ }, [n.name]))) ? n : { default: () => [n] });
229
+ }
230
+ return h(SimpleUpload, {
231
+ ...c,
232
+ ...p,
233
+ defaultUpload: !1,
234
+ uploadFile: v,
235
+ fileList: l,
236
+ onUpdateFileList: u
237
+ }, n);
238
+ },
239
+ upload: () => {
240
+ let n = null, c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = shallowRef([]), d = 0, f = (n) => {
241
+ let c = ++d;
242
+ u.value = n.map((n) => l.get(n)).filter(Boolean);
243
+ let f = n.filter((n) => !l.has(n));
244
+ Promise.resolve(f.length > 0 ? y(f) : []).then((f) => {
245
+ if (c === d) {
246
+ u.value = n.map((n) => l.get(n) || f.find((c) => c.id === n)), l.clear();
247
+ for (let n of u.value) l.set(n.id, n);
248
+ }
249
+ });
250
+ }, p;
251
+ return {
252
+ renderer: ({ slots: d, props: m }, { modelValue: g, "onUpdate:modelValue": y, required: b, readonly: S, ...C }) => {
253
+ let w = mapProps(m);
254
+ if (p = w.ref ??= shallowRef(), n !== g && (n = g, f(g?.split(",") ?? [])), S) {
255
+ let n;
256
+ return u.value.length === 0 ? void 0 : createVNode(NFlex, {
257
+ gap: "8",
258
+ vertical: !0,
259
+ style: "padding: 6px 0"
260
+ }, _isSlot(n = u.value.map((n) => createVNode("a", {
261
+ key: n.id,
262
+ href: n.url,
263
+ target: "_blank",
264
+ rel: "noreferrer",
265
+ title: n.name,
266
+ download: n.name,
267
+ style: "max-width: 100%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; display: inline-block"
268
+ }, [n.name]))) ? n : { default: () => [n] });
269
+ }
270
+ return h(SimpleUpload, {
271
+ ...w,
272
+ ...C,
273
+ uploadFile: v,
274
+ fileList: u.value,
275
+ onUpdateFileList: (n = []) => {
276
+ l.clear();
277
+ for (let u of n) u.file?.fileId && c.set(u.id, u.file.fileId), u.file?.fileId ? l.set(u.file.fileId, u) : l.set(u.id, u);
278
+ u.value = n, y(u.value.map((n) => c.get(n.id) || n.id).join(",") || null);
279
+ }
280
+ }, d);
281
+ },
282
+ beforeSubmit: async () => {
283
+ if (await p?.value?.submit(), await until(u).toMatch((n) => n.every((n) => !["pending", "uploading"].includes(n.status))), u.value.some((n) => n.status === "error")) return SimpleUpload.t("common.page.form.validate.fileErrorMessage");
284
+ }
285
+ };
286
+ },
287
+ user: () => {
288
+ let c, p, v;
289
+ return ({ slots: y, props: b }, { modelValue: S, "onUpdate:modelValue": C, required: w, readonly: T, ...E }) => {
290
+ let D = mapProps(b);
291
+ return c || (c = shallowRef([]), p = shallowRef([]), v = shallowRef([]), g().then((n) => {
292
+ c.value = n;
293
+ }), n().then((n) => {
294
+ p.value = n;
295
+ }), f().then((n) => {
296
+ v.value = n;
297
+ })), T ? createVNode(DtUserRender, {
298
+ value: S,
299
+ multiple: D.multiple,
300
+ getUsersByUsername: g
301
+ }, null) : h(DtUserDept, {
302
+ type: "user",
303
+ users: c.value,
304
+ depts: v.value,
305
+ groups: p.value,
306
+ getUsersByDept: m,
307
+ getUsersByGroup: u,
308
+ ...D,
309
+ ...E,
310
+ modelValue: S,
311
+ "onUpdate:modelValue": C
312
+ }, y);
313
+ };
314
+ }
315
+ };
316
+ }
317
+ function createPageTableHelper({ getDeptsByCode: n, getUsersByUsername: c, getFileInfos: l, previewFileUrl: u }) {
318
+ let p = (n) => () => (c, l, u, d) => {
319
+ if (c != null) return format(c, d.formatter ?? n);
320
+ }, m = (n = {}) => createVNode("svg", mergeProps({
321
+ xmlns: "http://www.w3.org/2000/svg",
322
+ width: "1em",
323
+ height: "1em",
324
+ viewBox: "0 0 32 32"
325
+ }, n), [createVNode("circle", {
326
+ cx: "16",
327
+ cy: "16",
328
+ r: "8",
329
+ fill: "currentColor"
330
+ }, null)]);
331
+ return {
332
+ date: p("yyyy-MM-dd"),
333
+ datetime: p("yyyy-MM-dd HH:mm:ss"),
334
+ dict: () => {
335
+ let n, c, l;
336
+ return (u, d, f, p) => {
337
+ if (u == null) return;
338
+ let { dictType: g, options: _, multiple: v, statusMap: y } = mapProps(p);
339
+ if (_ ? c !== _ && (c = _, l = new Map(_.map((n) => [n[p.valueField || "value"], n]))) : n !== g && (n = g, !l && n && (l = useDictMap(n))), !v) {
340
+ if (u = u.toString(), y && u in y) {
341
+ let n = y[u] ?? "default";
342
+ return [
343
+ "primary",
344
+ "success",
345
+ "warning",
346
+ "danger"
347
+ ].includes(n) && (n = `var(--color-${n})`), createVNode("span", { style: "position: relative; padding-left: 1.25em" }, [createVNode(m, { style: `color: ${n}; position: absolute;left: 0; top: 1.5px` }, null), createVNode("span", null, [l.get(u?.toString())?.[p.labelField || "label"] ?? ""])]);
348
+ }
349
+ return l.get(u)?.[p.labelField || "label"] ?? "";
350
+ }
351
+ return u?.map((n) => l.get(n.toString())?.[p.labelField || "label"]) ?? "";
352
+ };
353
+ },
354
+ number: () => (n, c, l, u) => {
355
+ if (n != null) {
356
+ switch (u.percent && (n = Number(n) * 100), "number") {
357
+ case typeof u.fixed:
358
+ n = n.toFixed(u.fixed);
359
+ break;
360
+ case typeof u.round:
361
+ n = n.toFixed(u.round).replace(/0+$/, "");
362
+ break;
363
+ case typeof u.precision:
364
+ n = n.toPrecision(u.precision);
365
+ break;
366
+ }
367
+ return u?.separator ? Number(n).toLocaleString() : n;
368
+ }
369
+ },
370
+ email: () => (n) => createVNode("a", { href: `mailto:${n}` }, [n]),
371
+ url: () => (n) => createVNode("a", { href: n }, [n]),
372
+ color: () => (n) => createVNode(NColorPicker, {
373
+ value: n,
374
+ disabled: !0,
375
+ size: "small"
376
+ }, null),
377
+ image: () => (n, c, l, d) => {
378
+ let f;
379
+ return n ? createVNode(NFlex, {
380
+ gap: "8",
381
+ wrap: !0
382
+ }, _isSlot(f = (Array.isArray(n) ? n : d?.multiple ? n.split(",") : [n]).map((n) => u(n)).map((n) => createVNode("img", {
383
+ key: n,
384
+ src: n,
385
+ style: "max-height: 32px; max-width: 100px; object-fit: contain"
386
+ }, null))) ? f : { default: () => [f] }) : void 0;
387
+ },
388
+ file: () => {
389
+ let n = nanoid();
390
+ return (c, u, d, f) => {
391
+ let p;
392
+ return c ? (u.__file_urls ??= {}, u.__file_urls[n] || l(Array.isArray(c) ? c : f?.multiple ? c.split(",") : [c]).then((c) => {
393
+ u.__file_urls[n] = c;
394
+ }), createVNode(NFlex, {
395
+ gap: "8",
396
+ wrap: !0
397
+ }, _isSlot(p = (u.__file_urls[n] || []).map((n) => createVNode("a", {
398
+ key: n.id,
399
+ href: n.url,
400
+ target: "_blank",
401
+ rel: "noreferrer",
402
+ style: "max-width: 100px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; display: inline-block"
403
+ }, [n.name]))) ? p : { default: () => [p] })) : void 0;
404
+ };
405
+ },
406
+ dept: () => (c, l, u, d) => {
407
+ if (c) return createVNode(DtDeptRender, {
408
+ value: c,
409
+ multiple: d?.multiple,
410
+ getDeptsByCode: n
411
+ }, null);
412
+ },
413
+ user: () => (n, l, u, f) => {
414
+ if (n) return createVNode(DtUserRender, {
415
+ value: n,
416
+ multiple: f?.multiple,
417
+ getUsersByUsername: c
418
+ }, null);
419
+ }
420
+ };
421
+ }
422
+ function createFormHelper() {
423
+ return () => ({ items: n, model: c, handleSubmit: l, reset: d, validation: f, readonly: p, inModal: m, showFeedback: g, showColon: _, labelWidth: v, labelAlign: y, labelPlacement: b, showRequireMark: x, requireMarkPlacement: C }) => createVNode(DataForm, {
424
+ readonly: p,
425
+ model: c,
426
+ items: n,
427
+ validation: f,
428
+ showColon: unref(_) ?? !0,
429
+ labelWidth: unref(v),
430
+ labelAlign: unref(y),
431
+ labelPlacement: unref(b),
432
+ showRequireMark: unref(x),
433
+ requireMarkPlacement: unref(C),
434
+ showFeedback: unref(g) ?? !0,
435
+ showAction: !1,
436
+ onSubmit: l,
437
+ onRest: d,
438
+ style: m ? "padding-right: 2rem; padding-top: 1rem" : void 0
439
+ }, null);
440
+ }
441
+ function createModalHelper() {
442
+ let n = (n) => typeof n == "number" ? `${n}px` : n, c = {
443
+ maxHeight: "calc(100vh - 130px)",
444
+ display: "flex",
445
+ flexDirection: "column"
446
+ }, l = { content: !0 };
447
+ return () => ({ type: u = "dialog", visible: d, title: f, content: p, footer: m, placement: g, resizable: _, draggable: v, closeOnEsc: b, closable: x, showMask: S, maskClosable: C, width: T, height: E, style: D, onClose: O, onCancel: k, onConfirm: A, onAfterClose: j, onAfterOpen: M, confirmText: N, confirmDisabled: P, confirmLoading: F, cancelText: I, cancelDisabled: L, cancelLoading: R, nativeScrollbar: z, ...B }) => {
448
+ let V = m ? () => m : m === null ? null : () => createVNode(NFlex, {
449
+ justify: "end",
450
+ gap: "16"
451
+ }, { default: () => [I === null ? void 0 : createVNode(NButton, {
452
+ onClick: k,
453
+ disabled: L,
454
+ loading: R,
455
+ style: "min-width: 60px"
456
+ }, _isSlot(I) ? I : { default: () => [I] }), N === null ? void 0 : createVNode(NButton, {
457
+ type: "primary",
458
+ onClick: A,
459
+ disabled: P,
460
+ loading: F,
461
+ style: "min-width: 60px"
462
+ }, _isSlot(N) ? N : { default: () => [N] })] });
463
+ if (u === "dialog") {
464
+ let { style: u } = mergeProps({ style: {
465
+ width: n(T ?? 520),
466
+ height: n(E)
467
+ } }, { style: D });
468
+ return createVNode(NModal, mergeProps({
469
+ show: d,
470
+ preset: "card",
471
+ title: () => f,
472
+ maskClosable: C ?? !1,
473
+ closeOnEsc: b,
474
+ closable: x,
475
+ onClose: O,
476
+ segmented: l,
477
+ size: "small",
478
+ onAfterEnter: M,
479
+ onAfterLeave: j,
480
+ onUpdateShow: O,
481
+ draggable: v ?? !0,
482
+ style: u,
483
+ contentStyle: c
484
+ }, B), {
485
+ default: () => createVNode(NScrollbar, {
486
+ abstract: !0,
487
+ style: "display: flex; flex-direction: column"
488
+ }, _isSlot(p) ? p : { default: () => [p] }),
489
+ action: V
490
+ });
491
+ }
492
+ let { bodyContentClass: H, bodyContentStyle: U, ...W } = B;
493
+ return createVNode(NDrawer, mergeProps({
494
+ show: d,
495
+ trapFocus: !1,
496
+ closeOnEsc: b,
497
+ showMask: S,
498
+ maskClosable: C,
499
+ resizable: _,
500
+ placement: g,
501
+ width: T ?? 440,
502
+ height: E,
503
+ onUpdateShow: O,
504
+ onAfterEnter: M,
505
+ onAfterLeave: j,
506
+ style: D
507
+ }, W), { default: () => [createVNode(NDrawerContent, {
508
+ closable: x,
509
+ nativeScrollbar: z ?? !1,
510
+ bodyContentClass: H,
511
+ bodyContentStyle: U
512
+ }, {
513
+ default: () => p,
514
+ header: () => f,
515
+ footer: V
516
+ })] });
517
+ };
518
+ }
519
+ export { createFormHelper, createModalHelper, createPageFormHelper, createPageTableHelper };
@@ -0,0 +1,6 @@
1
+ import { inject } from "vue";
2
+ const UI_I18N_INJECTION = "__UI_I18N__";
3
+ function useI18n() {
4
+ return inject(UI_I18N_INJECTION).value();
5
+ }
6
+ export { useI18n as n, UI_I18N_INJECTION as t };
@@ -0,0 +1,29 @@
1
+ import { useMergedClsPrefix } from "ithinkdt-ui/es/_mixins/use-config";
2
+ import _useStyle from "ithinkdt-ui/es/_mixins/use-style";
3
+ import { c, cB, cE, cM } from "ithinkdt-ui/es/_utils/cssr/index";
4
+ function useStyle(m, h, g, _) {
5
+ return g ??= useMergedClsPrefix(), _useStyle(m, h, g, _), g;
6
+ }
7
+ const fullWidth = { width: "100%" }, fullHeight = { height: "100%" }, fullWH = {
8
+ ...fullWidth,
9
+ ...fullHeight
10
+ }, flex = { display: "flex" }, flexDirCol = {
11
+ ...flex,
12
+ flexDirection: "column"
13
+ }, flexAlignCenter = {
14
+ ...flex,
15
+ alignItems: "center"
16
+ }, flexJustifyCenter = {
17
+ ...flex,
18
+ justifyContent: "center"
19
+ }, flexJustifySB = {
20
+ ...flex,
21
+ justifyContent: "space-between"
22
+ }, flexCenter = {
23
+ ...flexAlignCenter,
24
+ ...flexJustifyCenter
25
+ }, flexGap = (e) => ({
26
+ ...flex,
27
+ gap: e
28
+ });
29
+ export { flex as a, flexDirCol as c, flexJustifySB as d, fullHeight as f, useStyle as g, useMergedClsPrefix as h, cM as i, flexGap as l, fullWidth as m, cB as n, flexAlignCenter as o, fullWH as p, cE as r, flexCenter as s, c as t, flexJustifyCenter as u };
@@ -0,0 +1,2 @@
1
+ import { a as flex, c as flexDirCol, d as flexJustifySB, f as fullHeight, g as useStyle, h as useMergedClsPrefix, i as cM, l as flexGap, m as fullWidth, n as cB, o as flexAlignCenter, p as fullWH, r as cE, s as flexCenter, t as c, u as flexJustifyCenter } from "./use-style-DcT-1dj4.js";
2
+ export { c, cB, cE, cM, useStyle as default, flex, flexAlignCenter, flexCenter, flexDirCol, flexGap, flexJustifyCenter, flexJustifySB, fullHeight, fullWH, fullWidth, useMergedClsPrefix as useClsPrefix };
@@ -1,5 +1,5 @@
1
1
  import {
2
- CheckboxGroupProps, DataTableInst as NDataTableInst, DataTableProps as NDataTableProps,
2
+ CheckboxGroupProps, DataTableInst as NDataTableInst, DataTableProps as NDataTableProps, FlexProps,
3
3
  FormItemGiProps as NFormItemGiProps, FormProps as NFormProps, GridItemProps as NGridItemProps, GridProps as NGridProps,
4
4
  PopoverProps,
5
5
  RadioGroupProps, TransferProps,
@@ -16,6 +16,12 @@ declare module '@ithinkdt/page' {
16
16
 
17
17
  interface FormRenderExtraOptions {
18
18
  showColon?: MaybeRef<boolean | undefined>
19
+ labelWidth?: MaybeRef<string | number | undefined>
20
+ labelAlign?: MaybeRef<'left' | 'right' | 'center' | undefined>
21
+ labelPlacement?: MaybeRef<'left' | 'top' | undefined>
22
+ showRequireMark?: MaybeRef<boolean | undefined>
23
+ requireMarkPlacement?: MaybeRef<'left' | 'right' | 'right-hanging' | undefined>
24
+ showFeedback?: MaybeRef<boolean | undefined>
19
25
  }
20
26
 
21
27
  type FormItemOptionKeys = 'size' | 'showLabel' | 'labelWidth' | 'labelStyle' | 'labelAlign' | 'labelPlacement' | 'labelProps'
@@ -48,16 +54,9 @@ declare module '@ithinkdt/page' {
48
54
 
49
55
  }
50
56
 
51
- export type DataFormProps<Data extends {}> = Omit<NFormProps, 'model' | 'rules' | 'onSubmit' | 'validateMessages'> & {
52
- items: FormItem<Data>[]
53
- model: Data
54
- readonly?: boolean | undefined
55
- grid?: boolean | NGridProps | undefined
56
- validation?: { [k in keyof Data]?: ValidationResults } | undefined
57
- showColon?: boolean | undefined
58
- loading?: boolean | undefined
59
- showAction?: boolean | NGridItemProps & AllowedComponentProps | undefined
60
- actionAlign?: 'start' | 'center' | 'end'
57
+ export type DataFormActionsProps = Pick<FlexProps, 'align' | 'justify' | 'vertical' | 'reverse'> & {
58
+ size?: 'small' | 'medium' | 'large' | undefined
59
+ gap?: number | string | undefined
61
60
  submitText?: VNodeChild | undefined
62
61
  resetText?: VNodeChild | undefined
63
62
  cancelText?: VNodeChild | undefined
@@ -65,21 +64,61 @@ export type DataFormProps<Data extends {}> = Omit<NFormProps, 'model' | 'rules'
65
64
  showResetBtn?: boolean | undefined
66
65
  showCancelBtn?: boolean | undefined
67
66
  submitDisabled?: boolean | undefined
67
+ submitLoading?: boolean | undefined
68
68
  succeeded?: boolean | undefined
69
69
  successText?: VNodeChild | undefined
70
-
71
- tooltipPlacement?: 'bottom' | 'icon' | undefined
72
- onSubmit?: MaybeArray<(model: Data) => void> | undefined
70
+ failureText?: VNodeChild | undefined
71
+ onSubmit?: MaybeArray<() => void> | undefined
73
72
  onRest?: MaybeArray<() => void> | undefined
73
+ onCancel?: MaybeArray<() => void> | undefined
74
+ nativeButtonType?: boolean | undefined
75
+ }
76
+
77
+ export type DataFormActionsEmits = {
78
+ (e: 'submit'): void
79
+ (e: 'reset'): void
80
+ (e: 'cancel'): void
81
+ }
82
+
83
+ export type DataFormActionsSlots = {
84
+ prefix?: () => VNodeChild
85
+ suffix?: () => VNodeChild
74
86
  }
75
87
 
88
+ export declare function DataFormActions(
89
+ props: DataFormActionsProps & PublicProps,
90
+ ctx?: Pick<GenericCtx<DataFormActionsProps, DataFormActionsEmits, DataFormActionsSlots>, 'attrs' | 'emit' | 'slots'>,
91
+ expose?: (exposed?: GenericExposed) => void,
92
+ setup?: GenericCtx<DataFormActionsProps, DataFormActionsEmits, DataFormActionsSlots>,
93
+ ): GenericReturn<DataFormActionsProps, DataFormActionsEmits, DataFormActionsSlots>
94
+
95
+ export type DataFormProps<Data extends {}> = Omit<NFormProps, 'model' | 'rules' | 'onSubmit' | 'validateMessages'>
96
+ & Omit<DataFormActionsProps, 'onSubmit' | 'size' | 'gap' | 'justify' | 'direction' | 'submitloading'> & {
97
+ items: FormItem<Data>[]
98
+ model: Data
99
+ readonly?: boolean | undefined
100
+ grid?: boolean | NGridProps | undefined
101
+ validation?: { [k in keyof Data]?: ValidationResults } | undefined
102
+ showColon?: boolean | undefined
103
+ tooltipPlacement?: 'bottom' | 'icon' | undefined
104
+ loading?: boolean | undefined
105
+ showAction?: boolean | NGridItemProps & AllowedComponentProps | undefined
106
+ actionJustify?: DataFormActionsProps['justify']
107
+ actionAlign?: DataFormActionsProps['align']
108
+ actionGap?: DataFormActionsProps['gap']
109
+ onSubmit?: MaybeArray<(model: Data) => void> | undefined
110
+ }
111
+
76
112
  export type DataFormEmits<Data extends {}> = {
77
113
  (e: 'submit', model: Data): void
78
114
  (e: 'reset'): void
115
+ (e: 'cancel'): void
79
116
  }
80
117
 
81
118
  export type DataFormSlots<_Data extends {}> = {
82
119
  action?: (params: { cols: number, spans: number, overflow: boolean }) => VNodeChild
120
+ actionPrefix?: () => VNodeChild
121
+ actionSuffix?: () => VNodeChild
83
122
  }
84
123
 
85
124
  export type DataFormInst = {
@@ -367,6 +406,7 @@ export interface UserGroupOption {
367
406
  name: string
368
407
  }
369
408
  export interface DeptOption {
409
+ id?: string | undefined
370
410
  code: string
371
411
  name: string
372
412
  children?: DeptOption[]
@@ -382,7 +422,8 @@ interface UserDeptProps<Multiple extends boolean> {
382
422
  'filterable'?: boolean | undefined
383
423
  'disabled'?: boolean | undefined
384
424
  'size'?: TransferProps['size'] | undefined
385
- 'users'?: { username: string, nickname: string }[] | undefined
425
+ 'valueField'?: 'id' | 'username' | 'code' | undefined
426
+ 'users'?: { id?: string | undefined, username: string, nickname: string }[] | undefined
386
427
  'groups'?: UserGroupOption[] | undefined
387
428
  'depts'?: DeptOption[] | undefined
388
429
  'getUsersByGroup'?: ((code: string) => Promise<{ username: string, nickname: string }[]>) | undefined
@@ -0,0 +1 @@
1
+ export * from '../dist/components.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/directives.js'
package/esm/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from '../dist/index.js'