geekplus-digital-ui 0.1.1 → 0.1.3
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 +1 -1
- package/esm/_virtual/_plugin-vue_export-helper.js +9 -0
- package/esm/components/copy/index.js +5 -0
- package/esm/components/copy/src/copy-icon.vue.js +18 -0
- package/esm/components/copy/src/copy.vue.js +81 -0
- package/esm/components/index.js +4 -0
- package/esm/hooks/use-locale/index.js +9 -0
- package/esm/index.js +17 -148
- package/esm/install.js +11 -0
- package/esm/locale/i18n.js +29 -0
- package/esm/locale/lang/en.js +11 -0
- package/esm/locale/lang/zh-cn.js +11 -0
- package/package.json +1 -1
- /package/assets/{geekplus-digital-ui-B7_9JShm.css → components/copy/src/copy-B7_9JShm.css} +0 -0
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# Geekplus Digital UI
|
|
1
|
+
# Geekplus Digital UI
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { openBlock as l, createElementBlock as o, createElementVNode as e } from "vue";
|
|
2
|
+
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
+
const r = {}, n = {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
viewBox: "0 0 448 512"
|
|
6
|
+
};
|
|
7
|
+
function s(f, c) {
|
|
8
|
+
return l(), o("svg", n, [...c[0] || (c[0] = [
|
|
9
|
+
e("path", {
|
|
10
|
+
fill: "currentColor",
|
|
11
|
+
d: "M160 64c0-17.7 14.3-32 32-32l132.1 0c8.5 0 16.6 3.4 22.6 9.4l59.9 59.9c6 6 9.4 14.1 9.4 22.6L416 320c0 17.7-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32l0-256zM192 0c-35.3 0-64 28.7-64 64l0 256c0 35.3 28.7 64 64 64l192 0c35.3 0 64-28.7 64-64l0-196.1c0-17-6.7-33.3-18.7-45.3L369.4 18.7C357.4 6.7 341.1 0 324.1 0L192 0zM64 128c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l192 0c35.3 0 64-28.7 64-64l0-16-32 0 0 16c0 17.7-14.3 32-32 32L64 480c-17.7 0-32-14.3-32-32l0-256c0-17.7 14.3-32 32-32l16 0 0-32-16 0z"
|
|
12
|
+
}, null, -1)
|
|
13
|
+
])]);
|
|
14
|
+
}
|
|
15
|
+
const _ = /* @__PURE__ */ t(r, [["render", s]]);
|
|
16
|
+
export {
|
|
17
|
+
_ as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ref as p, toRef as d, computed as f, onMounted as x, onBeforeUnmount as L, openBlock as s, createBlock as v, unref as y, withModifiers as S, normalizeStyle as M, withCtx as g, createElementBlock as N, normalizeClass as B, createVNode as b, renderSlot as w, createCommentVNode as I } from "vue";
|
|
2
|
+
import { useClipboard as R } from "@vueuse/core";
|
|
3
|
+
import { ElLink as $, ElIcon as z, ElMessage as V } from "element-plus";
|
|
4
|
+
import { useLocale as j } from "../../../hooks/use-locale/index.js";
|
|
5
|
+
import D from "./copy-icon.vue.js";
|
|
6
|
+
import '../../../../assets/components/copy/src/copy-B7_9JShm.css';/* empty css */
|
|
7
|
+
import H from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
8
|
+
const O = /* @__PURE__ */ Object.assign({
|
|
9
|
+
name: "DCopy"
|
|
10
|
+
}, {
|
|
11
|
+
__name: "copy",
|
|
12
|
+
props: {
|
|
13
|
+
text: String,
|
|
14
|
+
type: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: "primary"
|
|
17
|
+
},
|
|
18
|
+
icon: String,
|
|
19
|
+
triggerElement: String
|
|
20
|
+
// 触发元素显示的dom,不设置就一直显示
|
|
21
|
+
},
|
|
22
|
+
setup(a, { expose: E }) {
|
|
23
|
+
const o = a, r = p(null), l = p(!1), h = d(o, "text"), u = d(o, "icon"), { copy: k } = R({
|
|
24
|
+
source: h
|
|
25
|
+
}), { t: C } = j(), e = f(() => {
|
|
26
|
+
const n = r.value?.$el ?? r.value;
|
|
27
|
+
if (!o.triggerElement || !n)
|
|
28
|
+
return null;
|
|
29
|
+
let t = n.parentNode;
|
|
30
|
+
for (; t; ) {
|
|
31
|
+
if (t.matches(o.triggerElement))
|
|
32
|
+
return t;
|
|
33
|
+
t = t.parentNode;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}), _ = f(() => ({
|
|
37
|
+
display: o.triggerElement && !l.value ? "none" : ""
|
|
38
|
+
})), c = () => {
|
|
39
|
+
k().then(() => {
|
|
40
|
+
V.success(C("d.copy.success"));
|
|
41
|
+
});
|
|
42
|
+
}, i = () => {
|
|
43
|
+
l.value = !0;
|
|
44
|
+
}, m = () => {
|
|
45
|
+
l.value = !1;
|
|
46
|
+
};
|
|
47
|
+
return x(() => {
|
|
48
|
+
e.value && (e.value.addEventListener("mouseenter", i), e.value.addEventListener("mouseleave", m));
|
|
49
|
+
}), L(() => {
|
|
50
|
+
e.value && (e.value.removeEventListener("mouseenter", i), e.value.removeEventListener("mouseleave", m));
|
|
51
|
+
}), E({
|
|
52
|
+
rootRef: r,
|
|
53
|
+
handleCopy: c
|
|
54
|
+
}), (n, t) => (s(), v(y($), {
|
|
55
|
+
ref_key: "rootRef",
|
|
56
|
+
ref: r,
|
|
57
|
+
class: "d-copy",
|
|
58
|
+
type: a.type,
|
|
59
|
+
underline: "never",
|
|
60
|
+
style: M(_.value),
|
|
61
|
+
onClick: S(c, ["stop"])
|
|
62
|
+
}, {
|
|
63
|
+
default: g(() => [
|
|
64
|
+
u.value ? (s(), N("i", {
|
|
65
|
+
key: 0,
|
|
66
|
+
class: B(u.value)
|
|
67
|
+
}, null, 2)) : (s(), v(y(z), { key: 1 }, {
|
|
68
|
+
default: g(() => [
|
|
69
|
+
b(D)
|
|
70
|
+
]),
|
|
71
|
+
_: 1
|
|
72
|
+
})),
|
|
73
|
+
n.$slots.default ? w(n.$slots, "default", { key: 2 }, void 0, !0) : I("", !0)
|
|
74
|
+
]),
|
|
75
|
+
_: 3
|
|
76
|
+
}, 8, ["type", "style"]));
|
|
77
|
+
}
|
|
78
|
+
}), P = /* @__PURE__ */ H(O, [["__scopeId", "data-v-cad5f2ba"]]);
|
|
79
|
+
export {
|
|
80
|
+
P as default
|
|
81
|
+
};
|
package/esm/index.js
CHANGED
|
@@ -1,150 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
copy: {
|
|
9
|
-
success: "Copy successful"
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}, ie = {
|
|
13
|
-
name: "zh-cn",
|
|
14
|
-
d: {
|
|
15
|
-
copy: {
|
|
16
|
-
success: "复制成功"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}, m = "en", q = {
|
|
20
|
-
[h.name]: h
|
|
21
|
-
};
|
|
22
|
-
let f;
|
|
23
|
-
const i = (e) => e ? typeof e == "string" ? e : typeof e == "object" && e.name ? e.name : m : m, a = (e) => (f || (f = N({
|
|
24
|
-
legacy: !1,
|
|
25
|
-
locale: i(e),
|
|
26
|
-
fallbackLocale: m,
|
|
27
|
-
messages: { ...q }
|
|
28
|
-
})), f), k = (e) => {
|
|
29
|
-
if (!e || typeof e != "object")
|
|
30
|
-
return;
|
|
31
|
-
const t = i(e);
|
|
32
|
-
a(e).global.setLocaleMessage(t, e);
|
|
33
|
-
}, G = (e) => {
|
|
34
|
-
const t = a(e);
|
|
35
|
-
return k(e), t.global.locale.value = i(e), t;
|
|
36
|
-
}, J = (e) => {
|
|
37
|
-
const t = a(e);
|
|
38
|
-
k(e), t.global.locale.value = i(e);
|
|
39
|
-
}, K = () => a().global.locale.value, Q = (...e) => a().global.t(...e), W = () => ({
|
|
40
|
-
t: Q,
|
|
41
|
-
getLocale: K,
|
|
42
|
-
setLocale: J
|
|
43
|
-
}), x = (e, t) => {
|
|
44
|
-
const n = e.__vccOpts || e;
|
|
45
|
-
for (const [s, o] of t)
|
|
46
|
-
n[s] = o;
|
|
47
|
-
return n;
|
|
48
|
-
}, X = {}, Y = {
|
|
49
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
50
|
-
viewBox: "0 0 448 512"
|
|
51
|
-
};
|
|
52
|
-
function Z(e, t) {
|
|
53
|
-
return u(), M("svg", Y, [...t[0] || (t[0] = [
|
|
54
|
-
j("path", {
|
|
55
|
-
fill: "currentColor",
|
|
56
|
-
d: "M160 64c0-17.7 14.3-32 32-32l132.1 0c8.5 0 16.6 3.4 22.6 9.4l59.9 59.9c6 6 9.4 14.1 9.4 22.6L416 320c0 17.7-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32l0-256zM192 0c-35.3 0-64 28.7-64 64l0 256c0 35.3 28.7 64 64 64l192 0c35.3 0 64-28.7 64-64l0-196.1c0-17-6.7-33.3-18.7-45.3L369.4 18.7C357.4 6.7 341.1 0 324.1 0L192 0zM64 128c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l192 0c35.3 0 64-28.7 64-64l0-16-32 0 0 16c0 17.7-14.3 32-32 32L64 480c-17.7 0-32-14.3-32-32l0-256c0-17.7 14.3-32 32-32l16 0 0-32-16 0z"
|
|
57
|
-
}, null, -1)
|
|
58
|
-
])]);
|
|
59
|
-
}
|
|
60
|
-
const ee = /* @__PURE__ */ x(X, [["render", Z]]), te = /* @__PURE__ */ Object.assign({
|
|
61
|
-
name: "DCopy"
|
|
62
|
-
}, {
|
|
63
|
-
__name: "copy",
|
|
64
|
-
props: {
|
|
65
|
-
text: String,
|
|
66
|
-
type: {
|
|
67
|
-
type: String,
|
|
68
|
-
default: "primary"
|
|
69
|
-
},
|
|
70
|
-
icon: String,
|
|
71
|
-
triggerElement: String
|
|
72
|
-
// 触发元素显示的dom,不设置就一直显示
|
|
73
|
-
},
|
|
74
|
-
setup(e, { expose: t }) {
|
|
75
|
-
const n = e, s = g(null), o = g(!1), z = _(n, "text"), d = _(n, "icon"), { copy: w } = U({
|
|
76
|
-
source: z
|
|
77
|
-
}), { t: I } = W(), c = L(() => {
|
|
78
|
-
const l = s.value?.$el ?? s.value;
|
|
79
|
-
if (!n.triggerElement || !l)
|
|
80
|
-
return null;
|
|
81
|
-
let r = l.parentNode;
|
|
82
|
-
for (; r; ) {
|
|
83
|
-
if (r.matches(n.triggerElement))
|
|
84
|
-
return r;
|
|
85
|
-
r = r.parentNode;
|
|
86
|
-
}
|
|
87
|
-
return null;
|
|
88
|
-
}), S = L(() => ({
|
|
89
|
-
display: n.triggerElement && !o.value ? "none" : ""
|
|
90
|
-
})), p = () => {
|
|
91
|
-
w().then(() => {
|
|
92
|
-
P.success(I("d.copy.success"));
|
|
93
|
-
});
|
|
94
|
-
}, v = () => {
|
|
95
|
-
o.value = !0;
|
|
96
|
-
}, y = () => {
|
|
97
|
-
o.value = !1;
|
|
98
|
-
};
|
|
99
|
-
return O(() => {
|
|
100
|
-
c.value && (c.value.addEventListener("mouseenter", v), c.value.addEventListener("mouseleave", y));
|
|
101
|
-
}), B(() => {
|
|
102
|
-
c.value && (c.value.removeEventListener("mouseenter", v), c.value.removeEventListener("mouseleave", y));
|
|
103
|
-
}), t({
|
|
104
|
-
rootRef: s,
|
|
105
|
-
handleCopy: p
|
|
106
|
-
}), (l, r) => (u(), E(b(F), {
|
|
107
|
-
ref_key: "rootRef",
|
|
108
|
-
ref: s,
|
|
109
|
-
class: "d-copy",
|
|
110
|
-
type: e.type,
|
|
111
|
-
underline: "never",
|
|
112
|
-
style: D(S.value),
|
|
113
|
-
onClick: $(p, ["stop"])
|
|
114
|
-
}, {
|
|
115
|
-
default: C(() => [
|
|
116
|
-
d.value ? (u(), M("i", {
|
|
117
|
-
key: 0,
|
|
118
|
-
class: R(d.value)
|
|
119
|
-
}, null, 2)) : (u(), E(b(H), { key: 1 }, {
|
|
120
|
-
default: C(() => [
|
|
121
|
-
V(ee)
|
|
122
|
-
]),
|
|
123
|
-
_: 1
|
|
124
|
-
})),
|
|
125
|
-
l.$slots.default ? A(l.$slots, "default", { key: 2 }, void 0, !0) : T("", !0)
|
|
126
|
-
]),
|
|
127
|
-
_: 3
|
|
128
|
-
}, 8, ["type", "style"]));
|
|
129
|
-
}
|
|
130
|
-
}), ne = /* @__PURE__ */ x(te, [["__scopeId", "data-v-cad5f2ba"]]), oe = ne, se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
131
|
-
__proto__: null,
|
|
132
|
-
DCopy: oe
|
|
133
|
-
}, Symbol.toStringTag, { value: "Module" })), ce = (e, t = {}) => {
|
|
134
|
-
const { locale: n } = t, s = G(n);
|
|
135
|
-
e.use(s), Object.values(se).forEach((o) => {
|
|
136
|
-
o?.name && e.component(o.name, o);
|
|
137
|
-
});
|
|
138
|
-
}, fe = { install: ce };
|
|
1
|
+
import { install as o } from "./install.js";
|
|
2
|
+
import { DCopy as f } from "./components/copy/index.js";
|
|
3
|
+
import { useLocale as p } from "./hooks/use-locale/index.js";
|
|
4
|
+
import { default as n } from "./locale/lang/en.js";
|
|
5
|
+
import { default as x } from "./locale/lang/zh-cn.js";
|
|
6
|
+
import { getLocale as c, initI18n as d, setLocale as u, t as L } from "./locale/i18n.js";
|
|
7
|
+
const t = { install: o };
|
|
139
8
|
export {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
9
|
+
f as DCopy,
|
|
10
|
+
t as default,
|
|
11
|
+
n as en,
|
|
12
|
+
c as getLocale,
|
|
13
|
+
d as initI18n,
|
|
14
|
+
o as install,
|
|
15
|
+
u as setLocale,
|
|
16
|
+
L as t,
|
|
17
|
+
p as useLocale,
|
|
18
|
+
x as zhCn
|
|
150
19
|
};
|
package/esm/install.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { initI18n as s } from "./locale/i18n.js";
|
|
2
|
+
import * as a from "./components/index.js";
|
|
3
|
+
const c = (n, o = {}) => {
|
|
4
|
+
const { locale: t } = o, e = s(t);
|
|
5
|
+
n.use(e), Object.values(a).forEach((i) => {
|
|
6
|
+
i?.name && n.component(i.name, i);
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
c as install
|
|
11
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createI18n as i } from "vue-i18n";
|
|
2
|
+
import r from "./lang/en.js";
|
|
3
|
+
const o = "en", f = {
|
|
4
|
+
[r.name]: r
|
|
5
|
+
};
|
|
6
|
+
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
|
+
legacy: !1,
|
|
9
|
+
locale: s(n),
|
|
10
|
+
fallbackLocale: o,
|
|
11
|
+
messages: { ...f }
|
|
12
|
+
})), a), c = (n) => {
|
|
13
|
+
if (!n || typeof n != "object")
|
|
14
|
+
return;
|
|
15
|
+
const e = s(n);
|
|
16
|
+
t(n).global.setLocaleMessage(e, n);
|
|
17
|
+
}, b = (n) => {
|
|
18
|
+
const e = t(n);
|
|
19
|
+
return c(n), e.global.locale.value = s(n), e;
|
|
20
|
+
}, L = (n) => {
|
|
21
|
+
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);
|
|
24
|
+
export {
|
|
25
|
+
l as getLocale,
|
|
26
|
+
b as initI18n,
|
|
27
|
+
L as setLocale,
|
|
28
|
+
p as t
|
|
29
|
+
};
|
package/package.json
CHANGED
|
File without changes
|