geekplus-digital-ui 0.1.12 → 0.1.13

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