@ithinkdt/ui 4.0.14 → 4.0.16
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.
- package/README.md +525 -0
- package/{dist/DataTable-C5hx-Wo8.js → esm/DataTable-DXZ3G4ZO.js} +1 -0
- package/esm/components.js +1629 -1
- package/esm/composables.js +27 -1
- package/esm/design.d.ts +3 -0
- package/esm/directives.js +2 -1
- package/esm/index.js +1251 -1
- package/esm/page.js +652 -1
- package/esm/use-style.js +31 -1
- package/package.json +11 -12
- package/dist/components.js +0 -1626
- package/dist/composables.js +0 -27
- package/dist/directives.js +0 -2
- package/dist/index.js +0 -1225
- package/dist/page.js +0 -652
- package/dist/use-style.js +0 -31
- /package/{dist → esm}/assets-bJgPKDh1.js +0 -0
- /package/{dist → esm}/directives-g3YmS-dM.js +0 -0
- /package/{dist → esm}/use-i18n-D1TTDOML.js +0 -0
package/dist/page.js
DELETED
|
@@ -1,652 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./use-i18n-D1TTDOML.js";
|
|
2
|
-
import { DataForm as t, DtDeptRender as n, DtUserDept as r, DtUserRender as i, NCheckboxes as a, NRadios as o } from "./components.js";
|
|
3
|
-
import { computed as s, createVNode as c, defineAsyncComponent as l, defineComponent as u, h as d, isVNode as f, mergeProps as p, nextTick as m, ref as h, renderSlot as g, shallowRef as _, toValue as v, unref as y } from "vue";
|
|
4
|
-
import { until as b, useClipboard as x } from "@vueuse/core";
|
|
5
|
-
import { NButton as S, NCheckbox as C, NColorPicker as w, NDrawer as T, NDrawerContent as E, NFlex as D, NIcon as O, NInput as k, NInputNumber as A, NModal as j, NScrollbar as M, NSelect as N, NText as P, NUpload as F, useMessage as I } from "ithinkdt-ui";
|
|
6
|
-
import { nanoid as L } from "nanoid";
|
|
7
|
-
import { format as R } from "date-fns";
|
|
8
|
-
import { useFormItem as z } from "ithinkdt-ui/es/_mixins";
|
|
9
|
-
import { useModal as B } from "@ithinkdt/page";
|
|
10
|
-
import { isNullish as V } from "@ithinkdt/common";
|
|
11
|
-
import { useDict as H, useDictMap as U } from "@ithinkdt/common/dict";
|
|
12
|
-
//#region src/page-util.js
|
|
13
|
-
var W = (e) => Object.fromEntries(Object.entries(e || {}).map(([e, t]) => [e, y(t)]));
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/page-description.jsx
|
|
16
|
-
function G(e) {
|
|
17
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
|
|
18
|
-
}
|
|
19
|
-
function K({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewFileUrl: a }) {
|
|
20
|
-
let o = (e) => (t, n, { params: r = {} }) => {
|
|
21
|
-
if (t != null) return R(t, r.formatter ?? e);
|
|
22
|
-
}, s = (e = {}) => c("svg", p({
|
|
23
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
24
|
-
width: "1em",
|
|
25
|
-
height: "1em",
|
|
26
|
-
viewBox: "0 0 32 32"
|
|
27
|
-
}, e), [c("circle", {
|
|
28
|
-
cx: "16",
|
|
29
|
-
cy: "16",
|
|
30
|
-
r: "8",
|
|
31
|
-
fill: "currentColor"
|
|
32
|
-
}, null)]), l = (e = {}) => c("svg", p({
|
|
33
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
34
|
-
width: "1em",
|
|
35
|
-
height: "1em",
|
|
36
|
-
viewBox: "0 0 24 24"
|
|
37
|
-
}, e), [c("path", {
|
|
38
|
-
fill: "currentColor",
|
|
39
|
-
d: "M12 9a3 3 0 0 1 3 3a3 3 0 0 1-3 3a3 3 0 0 1-3-3a3 3 0 0 1 3-3m0-4.5c5 0 9.27 3.11 11 7.5c-1.73 4.39-6 7.5-11 7.5S2.73 16.39 1 12c1.73-4.39 6-7.5 11-7.5M3.18 12a9.821 9.821 0 0 0 17.64 0a9.821 9.821 0 0 0-17.64 0"
|
|
40
|
-
}, null)]), u = (e) => c("svg", p({
|
|
41
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
42
|
-
width: "1em",
|
|
43
|
-
height: "1em",
|
|
44
|
-
viewBox: "0 0 24 24"
|
|
45
|
-
}, e), [c("path", {
|
|
46
|
-
fill: "currentColor",
|
|
47
|
-
d: "M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12z"
|
|
48
|
-
}, null)]), d = (e) => c("svg", p({
|
|
49
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
50
|
-
width: "1em",
|
|
51
|
-
height: "1em",
|
|
52
|
-
viewBox: "0 0 24 24"
|
|
53
|
-
}, e), [c("path", {
|
|
54
|
-
fill: "currentColor",
|
|
55
|
-
d: "M20 12a8 8 0 0 1-8 8a8 8 0 0 1-8-8a8 8 0 0 1 8-8c.76 0 1.5.11 2.2.31l1.57-1.57A9.8 9.8 0 0 0 12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10M7.91 10.08L6.5 11.5L11 16L21 6l-1.41-1.42L11 13.17z"
|
|
56
|
-
}, null)]);
|
|
57
|
-
return {
|
|
58
|
-
longtext: () => {
|
|
59
|
-
let e = h(), t = h(), n = h(), { open: r } = B({
|
|
60
|
-
type: "drawer",
|
|
61
|
-
resizable: !0,
|
|
62
|
-
content: () => c("div", null, [c("span", null, [e.value])]),
|
|
63
|
-
width: t,
|
|
64
|
-
footer: () => n.value?.() ?? null,
|
|
65
|
-
maskClosable: !0
|
|
66
|
-
}), { copy: i, copied: a } = x({ legacy: !0 }), o = (t, n, o) => {
|
|
67
|
-
if (!n) return r(t);
|
|
68
|
-
let s = () => {
|
|
69
|
-
o ? o(e.value) : i(e.value);
|
|
70
|
-
};
|
|
71
|
-
return r(() => c("div", { style: "display: flex; align-items: center; justify-content: space-between; margin-right: 4px;" }, [v(t), a.value ? c(S, {
|
|
72
|
-
quaternary: !0,
|
|
73
|
-
size: "tiny",
|
|
74
|
-
type: "success"
|
|
75
|
-
}, { icon: () => c(O, { size: 18 }, { default: () => [c(d, null, null)] }) }) : c(S, {
|
|
76
|
-
quaternary: !0,
|
|
77
|
-
size: "tiny",
|
|
78
|
-
onClick: s
|
|
79
|
-
}, { icon: () => c(O, { size: 16 }, { default: () => [c(u, null, null)] }) })]));
|
|
80
|
-
};
|
|
81
|
-
return {
|
|
82
|
-
renderer: (r, i, { params: a = {} }, { label: s }) => c("div", { style: "white-space: nowrap; overflow: hidden; display: flex; gap: 8px; align-items: center; justify-content: space-between" }, [c("div", { style: "flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" }, [r]), c(S, {
|
|
83
|
-
type: "info",
|
|
84
|
-
text: !0,
|
|
85
|
-
style: "position: sticky; right: 0; z-index: 2",
|
|
86
|
-
onClick: a.showText ? () => a.showText(r) : () => {
|
|
87
|
-
e.value = a.formatText ? a.formatText(r) : r, t.value = a.drawerWidth ?? 600, n.value = () => a.drawerFooter?.(r, i), o(a.title || s, a.copyable !== !1, a.onCopy);
|
|
88
|
-
}
|
|
89
|
-
}, { default: () => [c(O, { size: 18 }, { default: () => [c(l, null, null)] })] })]),
|
|
90
|
-
default: { table: { ellipsis: !1 } }
|
|
91
|
-
};
|
|
92
|
-
},
|
|
93
|
-
date: () => ({
|
|
94
|
-
renderer: o("yyyy-MM-dd"),
|
|
95
|
-
default: { table: {
|
|
96
|
-
width: 140,
|
|
97
|
-
align: "center",
|
|
98
|
-
sortable: !0
|
|
99
|
-
} }
|
|
100
|
-
}),
|
|
101
|
-
datetime: () => ({
|
|
102
|
-
renderer: o("yyyy-MM-dd HH:mm:ss"),
|
|
103
|
-
default: { table: {
|
|
104
|
-
width: 174,
|
|
105
|
-
align: "center",
|
|
106
|
-
sortable: !0
|
|
107
|
-
} }
|
|
108
|
-
}),
|
|
109
|
-
dict: () => {
|
|
110
|
-
let e, t, n;
|
|
111
|
-
return (r, i, { params: a = {} }) => {
|
|
112
|
-
if (r == null) return;
|
|
113
|
-
let { dictType: o, options: l, multiple: u, statusMap: d } = W(a);
|
|
114
|
-
if (l ? t !== l && (t = l, n = new Map(l.map((e) => [e[a.valueField || "value"], e]))) : e !== o && (e = o, !n && e && (n = U(e))), !u) {
|
|
115
|
-
if (r = r.toString(), d && r in d) {
|
|
116
|
-
let e = d[r] ?? "default";
|
|
117
|
-
return [
|
|
118
|
-
"primary",
|
|
119
|
-
"success",
|
|
120
|
-
"warning",
|
|
121
|
-
"danger"
|
|
122
|
-
].includes(e) && (e = `var(--color-${e})`), c("span", { style: "position: relative; padding-left: 1.25em" }, [c(s, { style: `color: ${e}; position: absolute;left: 0; top: 1.5px` }, null), c("span", null, [n.get(r)?.[a.labelField || "label"] ?? r ?? ""])]);
|
|
123
|
-
}
|
|
124
|
-
return n.get(r)?.[a.labelField || "label"] ?? r ?? "";
|
|
125
|
-
}
|
|
126
|
-
return r?.map((e) => n.get(e?.toString())?.[a.labelField || "label"] ?? e?.toString() ?? "").join(", ") ?? "";
|
|
127
|
-
};
|
|
128
|
-
},
|
|
129
|
-
number: () => ({
|
|
130
|
-
renderer: (e, t, { params: n = {} }) => {
|
|
131
|
-
if (e != null) {
|
|
132
|
-
switch (n.percent && (e = Number(e) * 100), "number") {
|
|
133
|
-
case typeof n.fixed:
|
|
134
|
-
e = e.toFixed(n.fixed);
|
|
135
|
-
break;
|
|
136
|
-
case typeof n.round:
|
|
137
|
-
e = e.toFixed(n.round).replace(/0+$/, "");
|
|
138
|
-
break;
|
|
139
|
-
case typeof n.precision:
|
|
140
|
-
e = e.toPrecision(n.precision);
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
return n?.separator ? Number(e).toLocaleString() : e;
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
default: { table: {
|
|
147
|
-
width: 100,
|
|
148
|
-
align: "right",
|
|
149
|
-
sortable: !0
|
|
150
|
-
} }
|
|
151
|
-
}),
|
|
152
|
-
email: () => (e) => c("a", { href: `mailto:${e}` }, [e]),
|
|
153
|
-
url: () => (e) => c("a", { href: e }, [e]),
|
|
154
|
-
color: () => (e) => c(w, {
|
|
155
|
-
value: e,
|
|
156
|
-
disabled: !0,
|
|
157
|
-
size: "small"
|
|
158
|
-
}, null),
|
|
159
|
-
image: () => (e, t, { params: n = {} }) => {
|
|
160
|
-
let r;
|
|
161
|
-
if (e) return c(D, {
|
|
162
|
-
gap: "8",
|
|
163
|
-
wrap: !0
|
|
164
|
-
}, G(r = (Array.isArray(e) ? e : n?.multiple ? e.split(",") : [e]).map((e) => a(e)).map((e) => c("img", {
|
|
165
|
-
key: e,
|
|
166
|
-
src: e,
|
|
167
|
-
style: "max-height: 32px; max-width: 100px; object-fit: contain"
|
|
168
|
-
}, null))) ? r : { default: () => [r] });
|
|
169
|
-
},
|
|
170
|
-
file: () => {
|
|
171
|
-
let e = L();
|
|
172
|
-
return (t, n, { params: i = {} }) => {
|
|
173
|
-
let a;
|
|
174
|
-
if (t) return n.__file_urls ??= {}, n.__file_urls[e] || r(Array.isArray(t) ? t : i?.multiple ? t.split(",") : [t]).then((t) => {
|
|
175
|
-
n.__file_urls[e] = t;
|
|
176
|
-
}), c(D, {
|
|
177
|
-
gap: "8",
|
|
178
|
-
wrap: !0
|
|
179
|
-
}, G(a = (n.__file_urls[e] || []).map((e) => c("a", {
|
|
180
|
-
key: e.id,
|
|
181
|
-
href: e.url,
|
|
182
|
-
target: "_blank",
|
|
183
|
-
rel: "noreferrer",
|
|
184
|
-
style: "max-width: 100px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; display: inline-block"
|
|
185
|
-
}, [e.name]))) ? a : { default: () => [a] });
|
|
186
|
-
};
|
|
187
|
-
},
|
|
188
|
-
dept: () => (t, r, { params: i = {} }) => {
|
|
189
|
-
if (t) return c(n, {
|
|
190
|
-
value: t,
|
|
191
|
-
multiple: i?.multiple,
|
|
192
|
-
getDeptsByCode: e
|
|
193
|
-
}, null);
|
|
194
|
-
},
|
|
195
|
-
user: () => {
|
|
196
|
-
let e = { style: "padding-block: 0" };
|
|
197
|
-
return {
|
|
198
|
-
renderer: (e, n, { params: r = {} }) => {
|
|
199
|
-
if (e) return c(i, {
|
|
200
|
-
value: e,
|
|
201
|
-
multiple: r?.multiple,
|
|
202
|
-
getUsersByUsername: t
|
|
203
|
-
}, null);
|
|
204
|
-
},
|
|
205
|
-
default: { table: {
|
|
206
|
-
width: 150,
|
|
207
|
-
ellipsis: !1,
|
|
208
|
-
align: "center",
|
|
209
|
-
cellProps: () => e
|
|
210
|
-
} }
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
//#endregion
|
|
216
|
-
//#region src/page-form.jsx
|
|
217
|
-
function q(e) {
|
|
218
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
|
|
219
|
-
}
|
|
220
|
-
var J = /* @__PURE__ */ l(() => import("ithinkdt-ui/es/date-picker/index.mjs").then((e) => e.NDatePicker)), Y = /* @__PURE__ */ u({
|
|
221
|
-
name: "SimpleUpload",
|
|
222
|
-
props: {
|
|
223
|
-
type: {
|
|
224
|
-
type: String,
|
|
225
|
-
default: "file"
|
|
226
|
-
},
|
|
227
|
-
size: {
|
|
228
|
-
type: String,
|
|
229
|
-
default: "medium"
|
|
230
|
-
},
|
|
231
|
-
multiple: {
|
|
232
|
-
type: Boolean,
|
|
233
|
-
default: !1
|
|
234
|
-
},
|
|
235
|
-
max: {
|
|
236
|
-
type: Number,
|
|
237
|
-
default: void 0
|
|
238
|
-
},
|
|
239
|
-
accept: {
|
|
240
|
-
type: String,
|
|
241
|
-
default: void 0
|
|
242
|
-
},
|
|
243
|
-
maxSize: {
|
|
244
|
-
type: Number,
|
|
245
|
-
default: void 0
|
|
246
|
-
},
|
|
247
|
-
disabled: {
|
|
248
|
-
type: Boolean,
|
|
249
|
-
default: void 0
|
|
250
|
-
},
|
|
251
|
-
fileList: {
|
|
252
|
-
type: Array,
|
|
253
|
-
default: () => []
|
|
254
|
-
},
|
|
255
|
-
onUpdateFileList: { type: [Array, Function] },
|
|
256
|
-
uploadFile: { type: Function }
|
|
257
|
-
},
|
|
258
|
-
setup(t, { slots: n, expose: r }) {
|
|
259
|
-
let { t: i } = e();
|
|
260
|
-
Y.t = i;
|
|
261
|
-
let a = z(t), o = I(), l = s(() => t.customRequest || (({ file: e, onProgress: n, onFinish: r, onError: i }) => {
|
|
262
|
-
t.uploadFile(e.file, (e) => n({ percent: e })).then((t) => {
|
|
263
|
-
e.file.fileId = t, r();
|
|
264
|
-
}).catch((e) => {
|
|
265
|
-
o.error(e.message), i(e);
|
|
266
|
-
});
|
|
267
|
-
})), u = h();
|
|
268
|
-
r({ submit() {
|
|
269
|
-
return b(u).toBeTruthy().then((e) => e.submit());
|
|
270
|
-
} });
|
|
271
|
-
let d = (e) => {
|
|
272
|
-
if (e) for (let n of e) n.size > t.maxSize * 1024 && (n.status = "error");
|
|
273
|
-
t.onUpdateFileList?.(e), m(() => a.nTriggerFormChange());
|
|
274
|
-
};
|
|
275
|
-
return () => {
|
|
276
|
-
let { type: e, onUpdateFileList: r, ...o } = t;
|
|
277
|
-
return c(F, p(o, {
|
|
278
|
-
ref: u,
|
|
279
|
-
customRequest: l.value,
|
|
280
|
-
listType: e === "image" ? "image-card" : "text",
|
|
281
|
-
accept: o.accept ?? e === "image" ? "image/*" : void 0,
|
|
282
|
-
"onUpdate:fileList": d
|
|
283
|
-
}), {
|
|
284
|
-
default: e === "image" ? void 0 : () => {
|
|
285
|
-
let e;
|
|
286
|
-
return c(S, {
|
|
287
|
-
disabled: a.mergedDisabledRef.value,
|
|
288
|
-
size: a.mergedSizeRef.value
|
|
289
|
-
}, q(e = i("common.page.form.selectFileText")) ? e : { default: () => [e] });
|
|
290
|
-
},
|
|
291
|
-
...n
|
|
292
|
-
});
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
function X({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersByDept: s, getUsersByUsername: l, uploadFile: u, getFileInfos: f }) {
|
|
297
|
-
let m = (e) => e, v = (e) => V(e) ? e : String(e), x = (e) => V(e) ? e : Number(e);
|
|
298
|
-
return {
|
|
299
|
-
input: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => a ? c(P, {
|
|
300
|
-
depth: 2,
|
|
301
|
-
style: "line-height: 1.25"
|
|
302
|
-
}, { default: () => [n ?? ""] }) : (t = W(t), d(k, p({ clearable: !0 }, t, o, {
|
|
303
|
-
value: n,
|
|
304
|
-
"onUpdate:value": r
|
|
305
|
-
}), e)),
|
|
306
|
-
number: () => {
|
|
307
|
-
let e, t;
|
|
308
|
-
return ({ slots: n, props: r }, { modelValue: i, "onUpdate:modelValue": a, required: o, readonly: s, ...l }) => {
|
|
309
|
-
if (s) return c(P, {
|
|
310
|
-
depth: 2,
|
|
311
|
-
style: "line-height: 1.25"
|
|
312
|
-
}, { default: () => [i ?? ""] });
|
|
313
|
-
let { valueType: u = "number", ...f } = W(r), m = u === "string" ? x(i) : i;
|
|
314
|
-
return e = a, u === "string" && !t && (t = (t, ...n) => {
|
|
315
|
-
e(v(t), ...n);
|
|
316
|
-
}), d(A, p({ clearable: !0 }, f, l, {
|
|
317
|
-
value: m,
|
|
318
|
-
"onUpdate:value": u === "string" ? t : e
|
|
319
|
-
}), n);
|
|
320
|
-
};
|
|
321
|
-
},
|
|
322
|
-
select: () => {
|
|
323
|
-
let e, t, n, r, i, a;
|
|
324
|
-
return ({ slots: o, props: s }, { modelValue: l, "onUpdate:modelValue": u, required: f, readonly: g, ..._ }) => {
|
|
325
|
-
let { dictType: b, options: S, valueType: C = "string", ...w } = W(s), T = C === "number" ? v : m, E, D, O;
|
|
326
|
-
S ? typeof S == "function" ? (E = !0, n ??= h(!1), D = (e) => {
|
|
327
|
-
n.value = !0, Promise.resolve(S(e.trim())).then((e) => {
|
|
328
|
-
t = e;
|
|
329
|
-
}).finally(() => {
|
|
330
|
-
n.value = !1;
|
|
331
|
-
});
|
|
332
|
-
}, O = () => {
|
|
333
|
-
D("");
|
|
334
|
-
}, O()) : (n = void 0, t = S) : (n = void 0, e !== b && (e = b, !t && e && (t = H(e))));
|
|
335
|
-
let k = w.multiple ? l?.map(T) : T(l);
|
|
336
|
-
if (g) if (w.multiple) {
|
|
337
|
-
let e;
|
|
338
|
-
return c(P, {
|
|
339
|
-
depth: 2,
|
|
340
|
-
style: "line-height: 1.25"
|
|
341
|
-
}, q(e = (k?.map((e) => y(t)?.find((t) => t[w.valueField || "value"] === e)) ?? []).map((e, t, n) => {
|
|
342
|
-
let r = e ? w.renderLabel ? w.renderLabel(e) ?? "" : e[w.labelField || "label"] ?? "" : k[t] ?? "";
|
|
343
|
-
return c("span", { key: e ? e[w.valueField || "value"] : k[t] ?? "" }, [r, t < n.length - 1 ? ", " : ""]);
|
|
344
|
-
})) ? e : { default: () => [e] });
|
|
345
|
-
} else {
|
|
346
|
-
let e = y(t)?.find((e) => e[w.valueField || "value"] === k);
|
|
347
|
-
return c(P, {
|
|
348
|
-
depth: 2,
|
|
349
|
-
style: "line-height: 1.25"
|
|
350
|
-
}, { default: () => [e ? w.renderLabel ? w.renderLabel(e) ?? "" : e[w.labelField || "label"] ?? "" : k ?? ""] });
|
|
351
|
-
}
|
|
352
|
-
return r = w.multiple, i = u, C === "number" && !a && (a = (e, ...t) => {
|
|
353
|
-
i(r ? e?.map(x) : x(e), ...t);
|
|
354
|
-
}), d(N, p({
|
|
355
|
-
clearable: !0,
|
|
356
|
-
filterable: y(t)?.length > 9,
|
|
357
|
-
loading: n?.value || t?.loading,
|
|
358
|
-
remote: E,
|
|
359
|
-
onSearch: D,
|
|
360
|
-
onClear: O
|
|
361
|
-
}, w, _, {
|
|
362
|
-
options: y(t),
|
|
363
|
-
value: k,
|
|
364
|
-
"onUpdate:value": C === "number" ? a : i
|
|
365
|
-
}), o);
|
|
366
|
-
};
|
|
367
|
-
},
|
|
368
|
-
checkbox: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => {
|
|
369
|
-
if (t = W(t), a) {
|
|
370
|
-
let r = n === (t.checkedValue ?? !0) ? g(e, "checked", void 0, () => [c(C, { checked: !0 }, null)]) : g(e, "unchecked", void 0, () => [c(C, { disabled: !0 }, null)]);
|
|
371
|
-
return c(P, {
|
|
372
|
-
depth: 2,
|
|
373
|
-
style: "line-height: 1.25"
|
|
374
|
-
}, q(r) ? r : { default: () => [r] });
|
|
375
|
-
}
|
|
376
|
-
return d(C, p(t, o, {
|
|
377
|
-
checked: n,
|
|
378
|
-
"onUpdate:checked": r
|
|
379
|
-
}), e);
|
|
380
|
-
},
|
|
381
|
-
checkboxes: () => {
|
|
382
|
-
let e, t, n, r;
|
|
383
|
-
return ({ props: i }, { modelValue: o, "onUpdate:modelValue": s, required: l, readonly: u, ...f }) => {
|
|
384
|
-
let { dictType: h, options: g, valueType: _ = "string", ...y } = W(i), b = _ === "number" ? v : m;
|
|
385
|
-
g ? t = g : e !== h && (e = h, !t && e && (t = H(e)));
|
|
386
|
-
let S = o?.map(b) ?? [];
|
|
387
|
-
if (u) {
|
|
388
|
-
let e;
|
|
389
|
-
return c(P, {
|
|
390
|
-
depth: 2,
|
|
391
|
-
style: "line-height: 2.4"
|
|
392
|
-
}, q(e = (S?.map((e) => t?.find((t) => t[y.valueField || "value"] === e)) ?? []).map((e, t, n) => {
|
|
393
|
-
let r = e ? e[y.labelField ?? "label"] ?? "" : S[t] ?? "";
|
|
394
|
-
return c("span", { key: e ? e[y.valueField ?? "value"] : S[t] ?? "" }, [r, t < n.length - 1 ? ", " : ""]);
|
|
395
|
-
})) ? e : { default: () => [e] });
|
|
396
|
-
}
|
|
397
|
-
return n = s, _ === "number" && !r && (r = (e, ...t) => {
|
|
398
|
-
n(e?.map(x), ...t);
|
|
399
|
-
}), d(a, p(y, f, {
|
|
400
|
-
options: t,
|
|
401
|
-
modelValue: S,
|
|
402
|
-
"onUpdate:modelValue": _ === "number" ? r : n
|
|
403
|
-
}));
|
|
404
|
-
};
|
|
405
|
-
},
|
|
406
|
-
radios: () => {
|
|
407
|
-
let e, t, n, r;
|
|
408
|
-
return ({ props: i }, { modelValue: a, "onUpdate:modelValue": s, required: l, readonly: u, ...f }) => {
|
|
409
|
-
let { dictType: h, options: g, valueType: _ = "string", ...y } = W(i), b = _ === "number" ? v : m;
|
|
410
|
-
g ? t = g : e !== h && (e = h, !t && e && (t = H(e)));
|
|
411
|
-
let S = b(a);
|
|
412
|
-
if (u) {
|
|
413
|
-
let e = t?.find((e) => e[y.valueField ?? "value"] === S);
|
|
414
|
-
return c(P, {
|
|
415
|
-
depth: 2,
|
|
416
|
-
style: "line-height: 1.25"
|
|
417
|
-
}, { default: () => [e ? e[y.labelField ?? "label"] ?? "" : S ?? ""] });
|
|
418
|
-
}
|
|
419
|
-
return n = s, _ === "number" && !r && (r = (e, ...t) => {
|
|
420
|
-
n(x(e), ...t);
|
|
421
|
-
}), d(o, p(y, f, {
|
|
422
|
-
options: t,
|
|
423
|
-
modelValue: S,
|
|
424
|
-
"onUpdate:modelValue": _ === "number" ? r : n
|
|
425
|
-
}));
|
|
426
|
-
};
|
|
427
|
-
},
|
|
428
|
-
datepicker: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => {
|
|
429
|
-
let { type: s = "date", format: l = s.startsWith("datetime") ? "yyyy-MM-dd HH:mm:ss" : "yyyy-MM-dd", ...u } = W(t);
|
|
430
|
-
return a ? s.endsWith("range") ? c(P, {
|
|
431
|
-
depth: 2,
|
|
432
|
-
style: "line-height: 1.25"
|
|
433
|
-
}, { default: () => [n ? `${n[0] ? R(n[0], l) : ""} ~ ${n[1] ? R(n[1], l) : ""}` : ""] }) : c(P, {
|
|
434
|
-
depth: 2,
|
|
435
|
-
style: "line-height: 1.25"
|
|
436
|
-
}, { default: () => [n ? R(n, l) : ""] }) : d(J, p({
|
|
437
|
-
actions: null,
|
|
438
|
-
updateValueOnClose: !0,
|
|
439
|
-
closeOnSelect: !0,
|
|
440
|
-
clearable: !0
|
|
441
|
-
}, u, o, {
|
|
442
|
-
type: s,
|
|
443
|
-
format: l,
|
|
444
|
-
value: n,
|
|
445
|
-
"onUpdate:value": r
|
|
446
|
-
}), e);
|
|
447
|
-
},
|
|
448
|
-
file: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => {
|
|
449
|
-
if (t = W(t), a) {
|
|
450
|
-
let e;
|
|
451
|
-
return console.warn("[file] 原则上此组建不应该显示在详情中"), n?.length ? c(D, {
|
|
452
|
-
gap: "8",
|
|
453
|
-
vertical: !0
|
|
454
|
-
}, q(e = n.map((e) => c("a", {
|
|
455
|
-
key: e.id,
|
|
456
|
-
href: e.url,
|
|
457
|
-
target: "_blank",
|
|
458
|
-
rel: "noreferrer",
|
|
459
|
-
style: "max-width: 100px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; display: inline-block"
|
|
460
|
-
}, [e.name]))) ? e : { default: () => [e] }) : void 0;
|
|
461
|
-
}
|
|
462
|
-
return d(Y, p(t, o, {
|
|
463
|
-
defaultUpload: !1,
|
|
464
|
-
uploadFile: u,
|
|
465
|
-
fileList: n,
|
|
466
|
-
onUpdateFileList: r
|
|
467
|
-
}), e);
|
|
468
|
-
},
|
|
469
|
-
upload: () => {
|
|
470
|
-
let e = null, t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = _([]), i = 0, a = (e) => {
|
|
471
|
-
let t = ++i;
|
|
472
|
-
r.value = e.map((e) => n.get(e)).filter(Boolean);
|
|
473
|
-
let a = e.filter((e) => !n.has(e));
|
|
474
|
-
Promise.resolve(a.length > 0 ? f(a) : []).then((a) => {
|
|
475
|
-
if (t === i) {
|
|
476
|
-
r.value = e.map((e) => n.get(e) || a.find((t) => t.id === e)), n.clear();
|
|
477
|
-
for (let e of r.value) n.set(e.id, e);
|
|
478
|
-
}
|
|
479
|
-
});
|
|
480
|
-
}, o, s;
|
|
481
|
-
return {
|
|
482
|
-
renderer: ({ slots: i, props: l }, { modelValue: f, "onUpdate:modelValue": m, required: h, readonly: g, ...v }) => {
|
|
483
|
-
let y = W(l);
|
|
484
|
-
if (s = y.maxSize, o = y.ref ??= _(), e !== f && (e = f, a(f?.split(",") ?? [])), g) {
|
|
485
|
-
let e;
|
|
486
|
-
return r.value.length === 0 ? void 0 : c(D, {
|
|
487
|
-
gap: "8",
|
|
488
|
-
vertical: !0,
|
|
489
|
-
style: "padding: 6px 0"
|
|
490
|
-
}, q(e = r.value.map((e) => c("a", {
|
|
491
|
-
key: e.id,
|
|
492
|
-
href: e.url,
|
|
493
|
-
target: "_blank",
|
|
494
|
-
rel: "noreferrer",
|
|
495
|
-
title: e.name,
|
|
496
|
-
download: e.name,
|
|
497
|
-
style: "max-width: 100%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; display: inline-block"
|
|
498
|
-
}, [e.name]))) ? e : { default: () => [e] });
|
|
499
|
-
}
|
|
500
|
-
return d(Y, p(y, v, {
|
|
501
|
-
uploadFile: u,
|
|
502
|
-
fileList: r.value,
|
|
503
|
-
onUpdateFileList: (e = []) => {
|
|
504
|
-
n.clear();
|
|
505
|
-
for (let r of e) r.file?.fileId && t.set(r.id, r.file.fileId), r.file?.fileId ? n.set(r.file.fileId, r) : n.set(r.id, r);
|
|
506
|
-
r.value = e, m(r.value.map((e) => t.get(e.id) || e.id).join(",") || null);
|
|
507
|
-
}
|
|
508
|
-
}), i);
|
|
509
|
-
},
|
|
510
|
-
beforeSubmit: async () => {
|
|
511
|
-
if (await o?.value?.submit(), await b(r).toMatch((e) => e.every((e) => !["pending", "uploading"].includes(e.status))), r.value.some((e) => e.size > s * 1024)) return Y.t("common.page.form.validate.fileSizeExceeded", { maxSize: s });
|
|
512
|
-
if (r.value.some((e) => e.status === "error")) return Y.t("common.page.form.validate.fileErrorMessage");
|
|
513
|
-
}
|
|
514
|
-
};
|
|
515
|
-
},
|
|
516
|
-
user: () => {
|
|
517
|
-
let a, o, u;
|
|
518
|
-
return ({ slots: f, props: m }, { modelValue: h, "onUpdate:modelValue": g, required: v, readonly: y, ...b }) => {
|
|
519
|
-
let x = W(m);
|
|
520
|
-
return a || (a = _([]), o = _([]), u = _([]), l().then((e) => {
|
|
521
|
-
a.value = e;
|
|
522
|
-
}), e().then((e) => {
|
|
523
|
-
o.value = e;
|
|
524
|
-
}), n().then((e) => {
|
|
525
|
-
u.value = e;
|
|
526
|
-
})), y ? c(i, {
|
|
527
|
-
value: h,
|
|
528
|
-
multiple: x.multiple,
|
|
529
|
-
getUsersByUsername: l,
|
|
530
|
-
renderInfo: x.renderInfo
|
|
531
|
-
}, null) : d(r, p({
|
|
532
|
-
type: "user",
|
|
533
|
-
users: a.value,
|
|
534
|
-
depts: u.value,
|
|
535
|
-
groups: o.value,
|
|
536
|
-
getUsersByDept: s,
|
|
537
|
-
getUsersByGroup: t
|
|
538
|
-
}, x, b, {
|
|
539
|
-
renderUserInfo: x.renderInfo,
|
|
540
|
-
modelValue: h,
|
|
541
|
-
"onUpdate:modelValue": g
|
|
542
|
-
}), f);
|
|
543
|
-
};
|
|
544
|
-
}
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
//#endregion
|
|
548
|
-
//#region src/page.jsx
|
|
549
|
-
function Z(e) {
|
|
550
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
|
|
551
|
-
}
|
|
552
|
-
function Q() {
|
|
553
|
-
return () => ({ items: e, model: n, handleSubmit: r, reset: i, validation: a, readonly: o, inModal: s, showFeedback: l, cols: u, showColon: d, labelWidth: f, labelAlign: p, labelPlacement: m, showRequireMark: h, requireMarkPlacement: g }) => c(t, {
|
|
554
|
-
readonly: o,
|
|
555
|
-
model: n,
|
|
556
|
-
items: e,
|
|
557
|
-
validation: a,
|
|
558
|
-
showColon: y(d) ?? !0,
|
|
559
|
-
labelWidth: y(f),
|
|
560
|
-
labelAlign: y(p),
|
|
561
|
-
labelPlacement: y(m),
|
|
562
|
-
showRequireMark: y(h),
|
|
563
|
-
requireMarkPlacement: y(g),
|
|
564
|
-
showFeedback: y(l) ?? !0,
|
|
565
|
-
showAction: !1,
|
|
566
|
-
grid: { cols: y(u) },
|
|
567
|
-
onSubmit: r,
|
|
568
|
-
onReset: i,
|
|
569
|
-
style: s ? "padding-right: 2rem; padding-top: 1rem" : void 0
|
|
570
|
-
}, null);
|
|
571
|
-
}
|
|
572
|
-
function $() {
|
|
573
|
-
let e = (e) => typeof e == "number" ? `${e}px` : e, t = {
|
|
574
|
-
maxHeight: "calc(100vh - 130px)",
|
|
575
|
-
display: "flex",
|
|
576
|
-
flexDirection: "column"
|
|
577
|
-
}, n = { content: !0 };
|
|
578
|
-
return () => ({ type: r = "dialog", visible: i, title: a, content: o, footer: s, placement: l, resizable: u, draggable: d, closeOnEsc: f, closable: m, showMask: h, maskClosable: g, width: _, height: v, style: y, onClose: b, onCancel: x, onConfirm: C, onAfterClose: w, onAfterOpen: O, confirmText: k, confirmDisabled: A, confirmLoading: N, cancelText: P, cancelDisabled: F, cancelLoading: I, nativeScrollbar: L, ...R }) => {
|
|
579
|
-
let z = s ? () => s : s === null ? null : () => c(D, {
|
|
580
|
-
justify: "end",
|
|
581
|
-
gap: "16"
|
|
582
|
-
}, { default: () => [P === null ? void 0 : c(S, {
|
|
583
|
-
onClick: x,
|
|
584
|
-
disabled: F,
|
|
585
|
-
loading: I,
|
|
586
|
-
style: "min-width: 60px"
|
|
587
|
-
}, Z(P) ? P : { default: () => [P] }), k === null ? void 0 : c(S, {
|
|
588
|
-
type: "primary",
|
|
589
|
-
onClick: C,
|
|
590
|
-
disabled: A,
|
|
591
|
-
loading: N,
|
|
592
|
-
style: "min-width: 60px"
|
|
593
|
-
}, Z(k) ? k : { default: () => [k] })] });
|
|
594
|
-
if (r === "dialog") {
|
|
595
|
-
let { style: r } = p({ style: {
|
|
596
|
-
width: e(_ ?? 520),
|
|
597
|
-
height: e(v)
|
|
598
|
-
} }, { style: y });
|
|
599
|
-
return c(j, p({
|
|
600
|
-
show: i,
|
|
601
|
-
preset: "card",
|
|
602
|
-
title: () => a,
|
|
603
|
-
maskClosable: g ?? !1,
|
|
604
|
-
closeOnEsc: f,
|
|
605
|
-
closable: m,
|
|
606
|
-
onClose: b,
|
|
607
|
-
segmented: n,
|
|
608
|
-
size: "small",
|
|
609
|
-
onAfterEnter: O,
|
|
610
|
-
onAfterLeave: w,
|
|
611
|
-
onUpdateShow: b,
|
|
612
|
-
draggable: d ?? !0,
|
|
613
|
-
style: r,
|
|
614
|
-
contentStyle: t
|
|
615
|
-
}, R), {
|
|
616
|
-
default: () => c(M, {
|
|
617
|
-
abstract: !0,
|
|
618
|
-
style: "display: flex; flex-direction: column"
|
|
619
|
-
}, Z(o) ? o : { default: () => [o] }),
|
|
620
|
-
action: z
|
|
621
|
-
});
|
|
622
|
-
}
|
|
623
|
-
let { bodyContentClass: B, bodyContentStyle: V, ...H } = R;
|
|
624
|
-
return c(T, p({
|
|
625
|
-
show: i,
|
|
626
|
-
trapFocus: !1,
|
|
627
|
-
closeOnEsc: f,
|
|
628
|
-
showMask: h,
|
|
629
|
-
maskClosable: g,
|
|
630
|
-
resizable: u,
|
|
631
|
-
placement: l,
|
|
632
|
-
width: u ? void 0 : _ ?? 440,
|
|
633
|
-
defaultWidth: u ? _ ?? 440 : void 0,
|
|
634
|
-
height: v,
|
|
635
|
-
onUpdateShow: b,
|
|
636
|
-
onAfterEnter: O,
|
|
637
|
-
onAfterLeave: w,
|
|
638
|
-
style: y
|
|
639
|
-
}, H), { default: () => [c(E, {
|
|
640
|
-
closable: m,
|
|
641
|
-
nativeScrollbar: L ?? !1,
|
|
642
|
-
bodyContentClass: B,
|
|
643
|
-
bodyContentStyle: V
|
|
644
|
-
}, {
|
|
645
|
-
default: () => o,
|
|
646
|
-
header: () => a,
|
|
647
|
-
footer: z
|
|
648
|
-
})] });
|
|
649
|
-
};
|
|
650
|
-
}
|
|
651
|
-
//#endregion
|
|
652
|
-
export { K as createDescriptionHelper, Q as createFormHelper, X as createFormItemHelper, $ as createModalHelper };
|
package/dist/use-style.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { useMergedClsPrefix as e } from "ithinkdt-ui/es/_mixins/use-config";
|
|
2
|
-
import t from "ithinkdt-ui/es/_mixins/use-style";
|
|
3
|
-
import { c as n, cB as r, cE as i, cM as a } from "ithinkdt-ui/es/_utils/cssr/index";
|
|
4
|
-
//#region src/use-style.js
|
|
5
|
-
function o(n, r, i, a) {
|
|
6
|
-
return i ??= e(), t(n, r, i, a), i;
|
|
7
|
-
}
|
|
8
|
-
var s = { width: "100%" }, c = { height: "100%" }, l = {
|
|
9
|
-
...s,
|
|
10
|
-
...c
|
|
11
|
-
}, u = { display: "flex" }, d = {
|
|
12
|
-
...u,
|
|
13
|
-
flexDirection: "column"
|
|
14
|
-
}, f = {
|
|
15
|
-
...u,
|
|
16
|
-
alignItems: "center"
|
|
17
|
-
}, p = {
|
|
18
|
-
...u,
|
|
19
|
-
justifyContent: "center"
|
|
20
|
-
}, m = {
|
|
21
|
-
...u,
|
|
22
|
-
justifyContent: "space-between"
|
|
23
|
-
}, h = {
|
|
24
|
-
...f,
|
|
25
|
-
...p
|
|
26
|
-
}, g = (e) => ({
|
|
27
|
-
...u,
|
|
28
|
-
gap: e
|
|
29
|
-
});
|
|
30
|
-
//#endregion
|
|
31
|
-
export { n as c, r as cB, i as cE, a as cM, o as default, u as flex, f as flexAlignCenter, h as flexCenter, d as flexDirCol, g as flexGap, p as flexJustifyCenter, m as flexJustifySB, c as fullHeight, l as fullWH, s as fullWidth, e as useClsPrefix };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|