geekplus-digital-ui 0.1.21 → 0.1.23

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 (62) hide show
  1. package/_virtual/_plugin-vue_export-helper.js +5 -8
  2. package/_virtual/_rolldown/runtime.js +9 -0
  3. package/components/copy/index.js +3 -6
  4. package/components/copy/src/copy.js +68 -0
  5. package/components/fold-text/index.js +3 -6
  6. package/components/fold-text/src/fold-text.js +63 -0
  7. package/components/fold-text/src/fold-text.vue_vue_type_style_index_0_scoped_53a3b28a_lang.css +1 -0
  8. package/components/icon/index.js +3 -6
  9. package/components/icon/src/icon.js +10 -0
  10. package/components/icon/src/icon.vue_vue_type_style_index_0_scoped_29c845ca_lang.css +1 -0
  11. package/components/icon-tip/index.js +3 -6
  12. package/components/icon-tip/src/icon-tip.js +50 -0
  13. package/components/icon-tip/src/icon-tip.vue_vue_type_style_index_0_scoped_fe982c8e_lang.css +1 -0
  14. package/components/icons/angle-down-light.js +14 -0
  15. package/components/icons/angle-up-light.js +14 -0
  16. package/components/icons/circle-exclamation-solid.js +14 -0
  17. package/components/icons/circle-play-light.js +14 -0
  18. package/components/icons/circle-xmark-light.js +14 -0
  19. package/components/icons/copy-light.js +14 -0
  20. package/components/icons/download-light.js +14 -0
  21. package/components/icons/eye-light.js +14 -0
  22. package/components/icons/file-light.js +14 -0
  23. package/components/icons/plus-light.js +14 -0
  24. package/components/icons/trash-light.js +14 -0
  25. package/components/index.js +14 -12
  26. package/components/upload/index.js +3 -6
  27. package/components/upload/src/upload.js +402 -0
  28. package/components/upload/src/upload.vue_vue_type_style_index_0_scoped_610b67ef_lang.css +1 -0
  29. package/components/upload/src/upload.vue_vue_type_style_index_1_lang.css +1 -0
  30. package/config/index.js +30 -40
  31. package/hooks/index.js +2 -6
  32. package/hooks/use-activated/index.js +9 -11
  33. package/hooks/use-locale/index.js +6 -8
  34. package/index.js +12 -24
  35. package/install.js +9 -11
  36. package/locale/i18n.js +20 -29
  37. package/locale/index.js +3 -11
  38. package/locale/lang/en.js +27 -31
  39. package/locale/lang/zh-cn.js +0 -32
  40. package/package.json +2 -2
  41. package/components/copy/src/copy.vue.js +0 -90
  42. package/components/fold-text/src/fold-text.css +0 -1
  43. package/components/fold-text/src/fold-text.vue.js +0 -86
  44. package/components/icon/src/icon.css +0 -1
  45. package/components/icon/src/icon.vue.js +0 -16
  46. package/components/icon-tip/src/icon-tip.css +0 -1
  47. package/components/icon-tip/src/icon-tip.vue.js +0 -67
  48. package/components/icons/angle-down-light.vue.js +0 -18
  49. package/components/icons/angle-up-light.vue.js +0 -18
  50. package/components/icons/circle-exclamation-solid.vue.js +0 -18
  51. package/components/icons/circle-play-light.vue.js +0 -18
  52. package/components/icons/circle-xmark-light.vue.js +0 -18
  53. package/components/icons/copy-light.vue.js +0 -18
  54. package/components/icons/download-light.vue.js +0 -18
  55. package/components/icons/eye-light.vue.js +0 -18
  56. package/components/icons/file-light.vue.js +0 -18
  57. package/components/icons/plus-light.vue.js +0 -18
  58. package/components/icons/trash-light.vue.js +0 -18
  59. package/components/upload/src/upload.css +0 -1
  60. package/components/upload/src/upload.vue.js +0 -483
  61. package/components/upload/src/upload2.css +0 -1
  62. /package/components/copy/src/{copy.css → copy.vue_vue_type_style_index_0_scoped_b4c0bee4_lang.css} +0 -0
@@ -0,0 +1,402 @@
1
+ import { useLocale as e } from "../../../hooks/use-locale/index.js";
2
+ import { useActivated as t } from "../../../hooks/use-activated/index.js";
3
+ import "../../../hooks/index.js";
4
+ import n from "../../../_virtual/_plugin-vue_export-helper.js";
5
+ import r from "../../icons/angle-up-light.js";
6
+ import i from "../../icons/angle-down-light.js";
7
+ import a from "../../icons/circle-play-light.js";
8
+ import ee from "../../icons/circle-xmark-light.js";
9
+ import te from "../../icons/download-light.js";
10
+ import ne from "../../icons/eye-light.js";
11
+ import re from "../../icons/file-light.js";
12
+ import ie from "../../icons/plus-light.js";
13
+ import ae from "../../icons/trash-light.js";
14
+ import './upload.vue_vue_type_style_index_1_lang.css';import './upload.vue_vue_type_style_index_0_scoped_610b67ef_lang.css';/* empty css */
15
+ /* empty css */
16
+ import o from "../../icon/index.js";
17
+ import "../../index.js";
18
+ import { isFunction as oe } from "lodash-es";
19
+ import { Fragment as s, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, mergeModels as h, normalizeClass as se, normalizeStyle as g, onBeforeUnmount as ce, onMounted as le, openBlock as _, reactive as ue, ref as v, renderList as y, toDisplayString as b, unref as x, useModel as S, watch as de, withCtx as C, withModifiers as w } from "vue";
20
+ import { ElButton as T, ElDialog as fe, ElImage as pe, ElImageViewer as me, ElLink as E, ElMessage as D, ElMessageBox as he, ElProgress as ge, ElUpload as _e, useFormItem as ve } from "element-plus";
21
+ import { saveAs as ye } from "file-saver";
22
+ var be = { class: "d-upload__preview" }, xe = ["src"], Se = {
23
+ key: 2,
24
+ class: "header"
25
+ }, Ce = ["onClick"], we = { class: "card-cover" }, Te = ["innerHTML"], Ee = { class: "file-row" }, De = {
26
+ key: 6,
27
+ class: "expand-toggle"
28
+ }, O = n(Object.assign({ name: "DUpload" }, {
29
+ __name: "upload",
30
+ props: h({
31
+ domain: {
32
+ type: String,
33
+ required: !0
34
+ },
35
+ axios: {
36
+ type: Function,
37
+ required: !0
38
+ },
39
+ url: {
40
+ type: String,
41
+ required: !0
42
+ },
43
+ format: {
44
+ type: Array,
45
+ default: () => []
46
+ },
47
+ maxSize: {
48
+ type: Number,
49
+ default: 500
50
+ },
51
+ maxNumber: {
52
+ type: Number,
53
+ default: 99
54
+ },
55
+ maxShow: {
56
+ type: Number,
57
+ default: 3
58
+ },
59
+ disabled: {
60
+ type: Boolean,
61
+ default: !1
62
+ },
63
+ showType: {
64
+ type: String,
65
+ default: "card"
66
+ },
67
+ docType: { type: String },
68
+ size: {
69
+ type: String,
70
+ default: "80px"
71
+ },
72
+ scrollHeight: { type: String },
73
+ showTip: {
74
+ type: Boolean,
75
+ default: !0
76
+ },
77
+ pasteable: {
78
+ type: Boolean,
79
+ default: !1
80
+ },
81
+ showDownloadAll: {
82
+ type: Boolean,
83
+ default: !1
84
+ },
85
+ downloadAllMethod: { type: Function }
86
+ }, {
87
+ modelValue: {
88
+ type: Array,
89
+ default: () => []
90
+ },
91
+ modelModifiers: {},
92
+ uploadingCount: {
93
+ type: Number,
94
+ default: 0
95
+ },
96
+ uploadingCountModifiers: {}
97
+ }),
98
+ emits: h(["change", "success"], ["update:modelValue", "update:uploadingCount"]),
99
+ setup(n, { emit: h }) {
100
+ let O = n, k = h, A = S(n, "modelValue"), Oe = S(n, "uploadingCount"), j = [
101
+ "jpg",
102
+ "jpeg",
103
+ "png",
104
+ "gif"
105
+ ], ke = ["mp4"], M = v([]), N = v(!1), P = v(!1), F = v(0), I = v([]), L = v(""), R = v(!1), z = v(null), B = v(null), { t: V } = e(), Ae = t(), { formItem: je } = ve(), H = c(() => R.value ? M.value : M.value.slice(0, O.maxShow)), U = c(() => M.value.length > 0), W = c(() => !O.disabled && !Ne.value), G = c(() => O.showType === "list"), Me = c(() => W.value && G.value || O.showDownloadAll && U.value), Ne = c(() => M.value.length >= O.maxNumber), Pe = c(() => G.value ? "is-list" : "is-card"), Fe = c(() => O.format.length ? O.format.map((e) => e.toUpperCase()) : []), Ie = c(() => ({
106
+ width: O.size,
107
+ height: O.size
108
+ })), Le = c(() => O.format.map((e) => `.${e}`).join(",")), Re = c(() => ({
109
+ maxHeight: O.scrollHeight,
110
+ overflow: O.scrollHeight ? "auto" : void 0
111
+ })), ze = c(() => {
112
+ let e = O.format.length && O.format.every((e) => j.includes(e)), t = [];
113
+ return O.maxSize && !e && t.push(V("d.upload.lessThan", { size: O.maxSize })), O.format.length && t.push(V("d.upload.format", { format: O.format.join("/") })), O.pasteable && t.push(V("d.upload.pasteable")), t.join(V("d.upload.comma"));
114
+ }), Be = (e) => {
115
+ M.value.some((e) => e.status === "uploading") || (M.value = e?.map((e) => ({
116
+ id: e.id,
117
+ name: e.name || e.docName,
118
+ docName: e.name || e.docName,
119
+ url: e.url || e.docUrl,
120
+ docUrl: e.url || e.docUrl,
121
+ type: O.docType || e.type || e.docType,
122
+ docType: O.docType || e.type || e.docType,
123
+ status: "success"
124
+ })) || [], Z());
125
+ }, K = (e) => {
126
+ if (e) {
127
+ let t = e.split(".");
128
+ return t[t.length - 1].toLowerCase();
129
+ }
130
+ return "";
131
+ }, q = (e) => j.includes(K(e.name)), J = (e) => ke.includes(K(e.name)), Y = (e) => e?.status === "success", X = (e) => !O.disabled && Y(e), Ve = () => {
132
+ z.value?.$el.querySelector("input")?.click();
133
+ }, He = (e) => {
134
+ if (F.value = 0, I.value = [], L.value = "", q(e)) {
135
+ let t = M.value.filter((e) => q(e));
136
+ F.value = t.findIndex((t) => t.url === e.url), I.value = t.map((e) => e.url), N.value = !0;
137
+ }
138
+ J(e) && (L.value = e.url, P.value = !0);
139
+ }, Ue = () => {
140
+ B.value?.pause(), P.value = !1;
141
+ }, We = (e) => {
142
+ let t = () => {
143
+ let t = M.value.indexOf(e);
144
+ t !== -1 && (M.value.splice(t, 1), Z(), Ye(e));
145
+ }, n = async () => {
146
+ if (!Y(e)) {
147
+ t();
148
+ return;
149
+ }
150
+ t();
151
+ };
152
+ he.confirm(V("d.upload.deleteConfirm"), V("d.upload.tip"), { type: "warning" }).then(async () => {
153
+ await n();
154
+ }).catch(() => {});
155
+ }, Ge = (e, t) => {
156
+ D.success(V("d.upload.fileSuccess", { file: e.name })), k("success", e, t, M.value);
157
+ }, Ke = (e, t) => {
158
+ let n = K(e.name);
159
+ if (n) {
160
+ let r = n.toUpperCase();
161
+ if (Fe.value.length && !Fe.value.includes(r)) return t || D.error(V("d.upload.fileFormat", {
162
+ file: e.name,
163
+ format: O.format.join("/")
164
+ })), !1;
165
+ }
166
+ return !0;
167
+ }, qe = (e) => e.size > O.maxSize * 1024 * 1024 ? (D.error(V("d.upload.fileLessThan", {
168
+ file: e.name,
169
+ size: O.maxSize
170
+ })), !1) : !0, Je = (e, t) => {
171
+ if (!t) return;
172
+ let { loaded: n = 0, total: r = 0 } = e || {};
173
+ r > 0 && (t.percentage = Math.floor(n / r * 100));
174
+ }, Ye = (e) => {
175
+ A.value = M.value, k("change", e, M.value), je?.validate("change");
176
+ }, Z = () => {
177
+ Oe.value = M.value.filter((e) => e.status === "uploading").length;
178
+ }, Xe = (e, t) => (Ke(e, t) && qe(e) && Ze(e), !1), Ze = async (e) => {
179
+ if (Ne.value) return !1;
180
+ R.value || Q();
181
+ let t = new FormData();
182
+ t.append("file", e);
183
+ let n = ue({
184
+ status: "uploading",
185
+ percentage: 0,
186
+ name: e.name
187
+ });
188
+ M.value.push(n), Z();
189
+ let r = () => M.value.indexOf(n);
190
+ try {
191
+ let { data: e } = await O.axios({
192
+ url: O.url,
193
+ method: "post",
194
+ data: t,
195
+ onUploadProgress: (e) => Je(e, n)
196
+ }), i = e?.data || e;
197
+ if (i && r() !== -1) {
198
+ let { id: e, name: t, url: r, type: a } = i;
199
+ Object.assign(n, {
200
+ id: e,
201
+ name: t,
202
+ docName: t,
203
+ url: O.domain + r,
204
+ docUrl: O.domain + r,
205
+ type: O.docType || a,
206
+ docType: O.docType || a,
207
+ status: "success"
208
+ }), Ge(i, n);
209
+ } else r() !== -1 && M.value.splice(r(), 1);
210
+ } catch {
211
+ r() !== -1 && M.value.splice(r(), 1);
212
+ } finally {
213
+ Z(), Ye(n);
214
+ }
215
+ }, Qe = (e) => {
216
+ e?.url && ye(e.url, e.name);
217
+ }, Q = () => {
218
+ R.value = !R.value;
219
+ }, $e = (e) => {
220
+ if (!O.pasteable || O.disabled || !Ae.value) return;
221
+ let t = e.clipboardData?.items || [];
222
+ for (let e = 0; e < t.length; e++) {
223
+ let n = t[e].getAsFile();
224
+ n && Xe(n, !0);
225
+ }
226
+ }, $ = (e) => {
227
+ !U.value || !e?.url || (q(e) || J(e) ? He(e) : Qe(e));
228
+ }, et = () => {
229
+ oe(O.downloadAllMethod) ? O.downloadAllMethod(M.value) : M.value.forEach((e) => {
230
+ Qe(e);
231
+ });
232
+ };
233
+ return de(A, (e) => {
234
+ Be(e);
235
+ }, { immediate: !0 }), le(() => {
236
+ document.addEventListener("paste", $e);
237
+ }), ce(() => {
238
+ document.removeEventListener("paste", $e);
239
+ }), (e, t) => (_(), d("div", { class: se(["d-upload", Pe.value]) }, [
240
+ m(x(_e), {
241
+ ref_key: "uploadRef",
242
+ ref: z,
243
+ style: { display: "none" },
244
+ "show-file-list": !1,
245
+ "file-list": M.value,
246
+ accept: Le.value,
247
+ "before-upload": Xe,
248
+ "with-credentials": "",
249
+ multiple: "",
250
+ action: "/"
251
+ }, null, 8, ["file-list", "accept"]),
252
+ N.value ? (_(), l(x(me), {
253
+ key: 0,
254
+ "url-list": I.value,
255
+ "initial-index": F.value,
256
+ "hide-on-click-modal": "",
257
+ teleported: "",
258
+ onClose: t[0] ||= (e) => N.value = !1
259
+ }, null, 8, ["url-list", "initial-index"])) : u("", !0),
260
+ P.value ? (_(), l(x(fe), {
261
+ key: 1,
262
+ modelValue: P.value,
263
+ "onUpdate:modelValue": t[1] ||= (e) => P.value = e,
264
+ title: x(V)("d.upload.preview"),
265
+ width: "1200px",
266
+ "align-center": "",
267
+ "before-close": Ue,
268
+ "append-to-body": ""
269
+ }, {
270
+ footer: C(() => [m(x(T), { onClick: Ue }, {
271
+ default: C(() => [p(b(x(V)("d.upload.close")), 1)]),
272
+ _: 1
273
+ })]),
274
+ default: C(() => [f("div", be, [L.value ? (_(), d("video", {
275
+ key: 0,
276
+ ref_key: "videoRef",
277
+ ref: B,
278
+ src: L.value,
279
+ controls: "",
280
+ class: "preview-video"
281
+ }, null, 8, xe)) : u("", !0)])]),
282
+ _: 1
283
+ }, 8, ["modelValue", "title"])) : u("", !0),
284
+ Me.value ? (_(), d("div", Se, [W.value && G.value ? (_(), l(x(T), {
285
+ key: 0,
286
+ onClick: Ve
287
+ }, {
288
+ default: C(() => [p(b(x(V)("d.upload.upload")), 1)]),
289
+ _: 1
290
+ })) : u("", !0), n.showDownloadAll && U.value ? (_(), l(x(T), {
291
+ key: 1,
292
+ type: "primary",
293
+ link: "",
294
+ onClick: et
295
+ }, {
296
+ default: C(() => [p(b(x(V)("d.upload.downloadAll")), 1)]),
297
+ _: 1
298
+ })) : u("", !0)])) : u("", !0),
299
+ G.value ? u("", !0) : (_(), d("div", {
300
+ key: 3,
301
+ class: "card",
302
+ style: g(Re.value)
303
+ }, [(_(!0), d(s, null, y(H.value, (e, t) => (_(), d("div", {
304
+ key: e.id || `${e.name}-${t}`,
305
+ class: "card-item",
306
+ style: g(Ie.value),
307
+ onClick: (t) => $(e)
308
+ }, [Y(e) ? (_(), d(s, { key: 0 }, [q(e) ? (_(), l(x(pe), {
309
+ key: 0,
310
+ src: e.url,
311
+ fit: "cover"
312
+ }, null, 8, ["src"])) : J(e) ? (_(), l(x(o), { key: 1 }, {
313
+ default: C(() => [m(a)]),
314
+ _: 1
315
+ })) : (_(), l(x(o), { key: 2 }, {
316
+ default: C(() => [m(re)]),
317
+ _: 1
318
+ })), f("div", we, [q(e) || J(e) ? (_(), l(x(o), { key: 0 }, {
319
+ default: C(() => [m(ne)]),
320
+ _: 1
321
+ })) : (_(), l(x(o), { key: 1 }, {
322
+ default: C(() => [m(te)]),
323
+ _: 1
324
+ })), X(e) ? (_(), l(x(o), {
325
+ key: 2,
326
+ onClick: w((t) => We(e), ["stop"])
327
+ }, {
328
+ default: C(() => [m(ae)]),
329
+ _: 1
330
+ }, 8, ["onClick"])) : u("", !0)])], 64)) : (_(), l(x(ge), {
331
+ key: 1,
332
+ style: { width: "80%" },
333
+ percentage: e.percentage,
334
+ "stroke-width": 5,
335
+ "show-text": !1
336
+ }, null, 8, ["percentage"]))], 12, Ce))), 128)), W.value ? (_(), d("div", {
337
+ key: 0,
338
+ class: "card-item",
339
+ style: g(Ie.value),
340
+ onClick: Ve
341
+ }, [m(x(o), null, {
342
+ default: C(() => [m(ie)]),
343
+ _: 1
344
+ })], 4)) : u("", !0)], 4)),
345
+ W.value && n.showTip ? (_(), d("p", {
346
+ key: 4,
347
+ class: "tip",
348
+ innerHTML: ze.value
349
+ }, null, 8, Te)) : u("", !0),
350
+ G.value ? (_(), d("div", {
351
+ key: 5,
352
+ style: g(Re.value),
353
+ class: "list"
354
+ }, [(_(!0), d(s, null, y(H.value, (e, t) => (_(), d("div", {
355
+ key: e.id || `${e.name}-${t}`,
356
+ class: "list-item"
357
+ }, [f("div", Ee, [m(x(E), {
358
+ type: "primary",
359
+ underline: "never",
360
+ onClick: (t) => $(e)
361
+ }, {
362
+ default: C(() => [p(b(e.name), 1)]),
363
+ _: 2
364
+ }, 1032, ["onClick"]), X(e) ? (_(), l(x(o), {
365
+ key: 0,
366
+ class: "remove-icon",
367
+ onClick: w((t) => We(e), ["stop"])
368
+ }, {
369
+ default: C(() => [m(ee)]),
370
+ _: 1
371
+ }, 8, ["onClick"])) : u("", !0)]), Y(e) ? u("", !0) : (_(), l(x(ge), {
372
+ key: 0,
373
+ percentage: e.percentage,
374
+ "stroke-width": 8
375
+ }, null, 8, ["percentage"]))]))), 128))], 4)) : u("", !0),
376
+ M.value.length > n.maxShow ? (_(), d("div", De, [R.value ? (_(), l(x(E), {
377
+ key: 0,
378
+ type: "primary",
379
+ underline: "never",
380
+ onClick: Q
381
+ }, {
382
+ default: C(() => [f("span", null, b(x(V)("d.upload.collapse")), 1), m(x(o), null, {
383
+ default: C(() => [m(r)]),
384
+ _: 1
385
+ })]),
386
+ _: 1
387
+ })) : (_(), l(x(E), {
388
+ key: 1,
389
+ type: "primary",
390
+ underline: "never",
391
+ onClick: Q
392
+ }, {
393
+ default: C(() => [f("span", null, b(x(V)("d.upload.expand")), 1), m(x(o), null, {
394
+ default: C(() => [m(i)]),
395
+ _: 1
396
+ })]),
397
+ _: 1
398
+ }))])) : u("", !0)
399
+ ], 2));
400
+ }
401
+ }), [["__scopeId", "data-v-610b67ef"]]);
402
+ export { O as default };
@@ -0,0 +1 @@
1
+ .d-upload[data-v-610b67ef]{line-height:normal}.d-upload .header[data-v-610b67ef]{align-items:center;gap:8px;width:100%;display:flex}.d-upload .header .el-button[data-v-610b67ef]{margin:0}.d-upload.is-list[data-v-610b67ef],.d-upload.is-list .list[data-v-610b67ef]{flex-direction:column;gap:8px;display:flex}.d-upload.is-list .list .list-item .file-row[data-v-610b67ef]{align-items:center;gap:4px;display:flex;position:relative}.d-upload.is-list .list .list-item .file-row[data-v-610b67ef] .el-link{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.d-upload.is-list .list .list-item .file-row[data-v-610b67ef] .el-link .el-link__inner{display:inline}.d-upload.is-list .list .list-item .file-row .remove-icon[data-v-610b67ef]{cursor:pointer;color:var(--el-text-color-secondary);display:none}.d-upload.is-list .list .list-item .file-row:hover .remove-icon[data-v-610b67ef]{display:block}.d-upload.is-card[data-v-610b67ef],.d-upload.is-card .card[data-v-610b67ef]{flex-wrap:wrap;gap:8px;display:flex}.d-upload.is-card .card .card-item[data-v-610b67ef]{box-sizing:border-box;border:1px solid var(--el-border-color);cursor:pointer;border-radius:4px;justify-content:center;align-items:center;font-size:16px;display:flex;position:relative;overflow:hidden}.d-upload.is-card .card .card-item .card-cover[data-v-610b67ef]{background:var(--el-overlay-color);opacity:0;justify-content:center;align-items:center;gap:12px;width:100%;height:100%;display:flex;position:absolute;top:0;left:0}.d-upload.is-card .card .card-item .card-cover .d-icon[data-v-610b67ef]{color:var(--el-color-white)}.d-upload.is-card .card .card-item .card-cover[data-v-610b67ef]:hover{opacity:1}.d-upload.is-card .card .el-image[data-v-610b67ef]{width:100%;height:100%}.d-upload .expand-toggle[data-v-610b67ef]{width:100%;display:flex}.d-upload .expand-toggle[data-v-610b67ef] .el-link__inner{gap:4px}.d-upload .tip[data-v-610b67ef]{width:100%;color:var(--el-text-color-regular);margin:0;font-size:12px}
@@ -0,0 +1 @@
1
+ .d-upload__preview{justify-content:center;height:calc(80vh - 120px);display:flex}.d-upload__preview .preview-video{max-width:100%;height:100%}
package/config/index.js CHANGED
@@ -1,42 +1,32 @@
1
- import { isPlainObject as i } from "lodash-es";
2
- let o = {};
3
- const c = {
4
- components: {}
5
- }, l = (r) => {
6
- if (!r)
7
- return null;
8
- if (r in o)
9
- return o[r];
10
- const e = `D${r.charAt(0).toUpperCase()}${r.slice(1)}`;
11
- return e in o ? o[e] : null;
12
- }, p = (r = {}) => {
13
- i(r) && Object.entries(r).forEach(([e, n]) => {
14
- if (!i(n))
15
- return;
16
- const s = l(e);
17
- !s || !i(s.props) || Object.entries(n).forEach(([f, u]) => {
18
- if (!f || !(f in s.props))
19
- return;
20
- const t = s.props[f];
21
- if (i(t)) {
22
- t.default = u, t.required === !0 && (t.required = !1);
23
- return;
24
- }
25
- s.props[f] = {
26
- ...t === void 0 ? {} : { type: t },
27
- default: u
28
- };
29
- });
30
- });
31
- }, b = (r, e = {}) => {
32
- if (!i(e))
33
- return r;
34
- const { components: n } = e;
35
- return i(n) && (Object.assign(r.components, n), p(n)), r;
36
- }, g = (r) => b(c, r), j = (r) => {
37
- o = r || {};
1
+ import { isPlainObject as e } from "lodash-es";
2
+ var t = {}, n = { components: {} }, r = (e) => {
3
+ if (!e) return null;
4
+ if (e in t) return t[e];
5
+ let n = `D${e.charAt(0).toUpperCase()}${e.slice(1)}`;
6
+ return n in t ? t[n] : null;
7
+ }, i = (t = {}) => {
8
+ e(t) && Object.entries(t).forEach(([t, n]) => {
9
+ if (!e(n)) return;
10
+ let i = r(t);
11
+ !i || !e(i.props) || Object.entries(n).forEach(([t, n]) => {
12
+ if (!t || !(t in i.props)) return;
13
+ let r = i.props[t];
14
+ if (e(r)) {
15
+ r.default = n, r.required === !0 && (r.required = !1);
16
+ return;
17
+ }
18
+ i.props[t] = {
19
+ ...r === void 0 ? {} : { type: r },
20
+ default: n
21
+ };
22
+ });
23
+ });
24
+ }, a = (t, n = {}) => {
25
+ if (!e(n)) return t;
26
+ let { components: r } = n;
27
+ return e(r) && (Object.assign(t.components, r), i(r)), t;
38
28
  };
39
- export {
40
- j as setComponentRegistry,
41
- g as setGlobalConfig
29
+ const o = (e) => a(n, e), s = (e) => {
30
+ t = e || {};
42
31
  };
32
+ export { s as setComponentRegistry, o as setGlobalConfig };
package/hooks/index.js CHANGED
@@ -1,6 +1,2 @@
1
- import { useLocale as r } from "./use-locale/index.js";
2
- import { useActivated as a } from "./use-activated/index.js";
3
- export {
4
- a as useActivated,
5
- r as useLocale
6
- };
1
+ import "./use-locale/index.js";
2
+ import "./use-activated/index.js";
@@ -1,12 +1,10 @@
1
- import { ref as e, onActivated as a, onDeactivated as r } from "vue";
2
- const c = () => {
3
- const t = e(!0);
4
- return a(() => {
5
- t.value = !0;
6
- }), r(() => {
7
- t.value = !1;
8
- }), t;
9
- };
10
- export {
11
- c as useActivated
1
+ import { onActivated as e, onDeactivated as t, ref as n } from "vue";
2
+ const r = () => {
3
+ let r = n(!0);
4
+ return e(() => {
5
+ r.value = !0;
6
+ }), t(() => {
7
+ r.value = !1;
8
+ }), r;
12
9
  };
10
+ export { r as useActivated };
@@ -1,10 +1,8 @@
1
+ import { getLocale as e, setLocale as t, t as n } from "../../locale/i18n.js";
1
2
  import "../../locale/index.js";
2
- import { setLocale as o, getLocale as e, t } from "../../locale/i18n.js";
3
- const a = () => ({
4
- t,
5
- getLocale: e,
6
- setLocale: o
3
+ const r = () => ({
4
+ t: n,
5
+ getLocale: e,
6
+ setLocale: t
7
7
  });
8
- export {
9
- a as useLocale
10
- };
8
+ export { r as useLocale };
package/index.js CHANGED
@@ -1,25 +1,13 @@
1
- import { install as o } from "./install.js";
2
- import "./components/index.js";
1
+ import { useLocale as e } from "./hooks/use-locale/index.js";
2
+ import { useActivated as t } from "./hooks/use-activated/index.js";
3
3
  import "./hooks/index.js";
4
- import { setComponentRegistry as x, setGlobalConfig as i } from "./config/index.js";
5
- import { DCopy as n } from "./components/copy/index.js";
6
- import { DFoldText as a } from "./components/fold-text/index.js";
7
- import { DIcon as d } from "./components/icon/index.js";
8
- import { DIconTip as u } from "./components/icon-tip/index.js";
9
- import { DUpload as g } from "./components/upload/index.js";
10
- import { useActivated as I } from "./hooks/use-activated/index.js";
11
- import { useLocale as b } from "./hooks/use-locale/index.js";
12
- const p = { install: o };
13
- export {
14
- n as DCopy,
15
- a as DFoldText,
16
- d as DIcon,
17
- u as DIconTip,
18
- g as DUpload,
19
- p as default,
20
- o as install,
21
- x as setComponentRegistry,
22
- i as setGlobalConfig,
23
- I as useActivated,
24
- b as useLocale
25
- };
4
+ import n from "./components/copy/index.js";
5
+ import r from "./components/fold-text/index.js";
6
+ import i from "./components/icon-tip/index.js";
7
+ import a from "./components/upload/index.js";
8
+ import o from "./components/icon/index.js";
9
+ import "./components/index.js";
10
+ import { setComponentRegistry as s, setGlobalConfig as c } from "./config/index.js";
11
+ import { install as l } from "./install.js";
12
+ var u = { install: l };
13
+ export { n as DCopy, r as DFoldText, o as DIcon, i as DIconTip, a as DUpload, u as default, l as install, s as setComponentRegistry, c as setGlobalConfig, t as useActivated, e as useLocale };
package/install.js CHANGED
@@ -1,13 +1,11 @@
1
+ import { initI18n as e } from "./locale/i18n.js";
1
2
  import "./locale/index.js";
2
- import * as i from "./components/index.js";
3
- import { setComponentRegistry as m, setGlobalConfig as a } from "./config/index.js";
4
- import { initI18n as f } from "./locale/i18n.js";
5
- const p = (t, n = {}) => {
6
- const { locale: e, config: r } = n, s = f(e);
7
- t.use(s), m(i), a(r), Object.values(i).forEach((o) => {
8
- o?.name && t.component(o.name, o);
9
- });
10
- };
11
- export {
12
- p as install
3
+ import { components_exports as t } from "./components/index.js";
4
+ import { setComponentRegistry as n, setGlobalConfig as r } from "./config/index.js";
5
+ var i = (i, a = {}) => {
6
+ let { locale: o, config: s } = a;
7
+ e(o), n(t), r(s), Object.values(t).forEach((e) => {
8
+ e?.name && i.component(e.name, e);
9
+ });
13
10
  };
11
+ export { i as install };
package/locale/i18n.js CHANGED
@@ -1,30 +1,21 @@
1
- import { isPlainObject as c } from "lodash-es";
2
- import { createI18n as u } from "vue-i18n";
3
- import o from "./lang/en.js";
4
- const r = "en", f = {
5
- [o.name]: o
6
- };
7
- let a;
8
- const s = (n) => n ? typeof n == "string" ? n : c(n) && n.name ? n.name : r : r, t = (n) => (a || (a = u({
9
- legacy: !1,
10
- locale: s(n),
11
- fallbackLocale: r,
12
- messages: { ...f }
13
- })), a), i = (n) => {
14
- if (!c(n))
15
- return;
16
- const e = s(n);
17
- t(n).global.setLocaleMessage(e, n);
18
- }, b = (n) => {
19
- const e = t(n);
20
- return i(n), e.global.locale.value = s(n), e;
21
- }, p = (n) => {
22
- const e = t(n);
23
- i(n), e.global.locale.value = s(n);
24
- }, I = () => t().global.locale.value, v = (...n) => t().global.t(...n);
25
- export {
26
- I as getLocale,
27
- b as initI18n,
28
- p as setLocale,
29
- v as t
1
+ import e from "./lang/en.js";
2
+ import { isPlainObject as t } from "lodash-es";
3
+ import { createI18n as n } from "vue-i18n";
4
+ var r = "en", i = { [e.name]: e }, a, o = (e) => e ? typeof e == "string" ? e : t(e) && e.name ? e.name : r : r, s = (e) => (a ||= n({
5
+ legacy: !1,
6
+ locale: o(e),
7
+ fallbackLocale: r,
8
+ messages: { ...i }
9
+ }), a), c = (e) => {
10
+ if (!t(e)) return;
11
+ let n = o(e);
12
+ s(e).global.setLocaleMessage(n, e);
30
13
  };
14
+ const l = (e) => {
15
+ let t = s(e);
16
+ return c(e), t.global.locale.value = o(e), t;
17
+ }, u = (e) => {
18
+ let t = s(e);
19
+ c(e), t.global.locale.value = o(e);
20
+ }, d = () => s().global.locale.value, f = (...e) => s().global.t(...e);
21
+ export { d as getLocale, l as initI18n, u as setLocale, f as t };
package/locale/index.js CHANGED
@@ -1,11 +1,3 @@
1
- import { default as o } from "./lang/en.js";
2
- import { default as r } from "./lang/zh-cn.js";
3
- import { getLocale as l, initI18n as n, setLocale as m, t as p } from "./i18n.js";
4
- export {
5
- o as en,
6
- l as getLocale,
7
- n as initI18n,
8
- m as setLocale,
9
- p as t,
10
- r as zhCn
11
- };
1
+ import "./lang/en.js";
2
+ import "./lang/zh-cn.js";
3
+ import "./i18n.js";