@bdsoft/element 1.1.13 → 1.1.14
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/index.html +13 -0
- package/index.js +6 -6
- package/package.json +19 -23
- package/src/App.vue +28 -0
- package/src/assets/css/element.scss +196 -0
- package/src/assets/css/layout.scss +215 -0
- package/src/assets/css/tailwind.scss +67 -0
- package/src/assets/images/banner.gif +0 -0
- package/src/assets/images/banner.png +0 -0
- package/src/assets/images/bg1.svg +22 -0
- package/src/assets/images/bg2.png +0 -0
- package/src/assets/images/ff.png +0 -0
- package/src/assets/images/home-file1.png +0 -0
- package/src/assets/images/ky.png +0 -0
- package/src/assets/images/menu/add.png +0 -0
- package/src/assets/images/menu/del.png +0 -0
- package/src/assets/images/menu/down.png +0 -0
- package/src/assets/images/menu/dr.png +0 -0
- package/src/assets/images/menu/edit.png +0 -0
- package/src/assets/images/menu/kx.png +0 -0
- package/src/assets/images/menu/mb.png +0 -0
- package/src/assets/images/menu/pz.png +0 -0
- package/src/assets/images/menu/save.png +0 -0
- package/src/assets/images/menu/sj.png +0 -0
- package/src/assets/images/menu/sjk.png +0 -0
- package/src/assets/images/menu/up.png +0 -0
- package/src/assets/images/po-i.png +0 -0
- package/src/assets/images/po1-i1.png +0 -0
- package/src/assets/images/po1-i2.png +0 -0
- package/src/assets/images/po1-i3.png +0 -0
- package/src/assets/images/po1-i4.png +0 -0
- package/src/assets/images/po1-i5.png +0 -0
- package/src/assets/images/po1-i6.png +0 -0
- package/src/assets/images/po1-i7.png +0 -0
- package/src/assets/images/po1-i8.png +0 -0
- package/src/assets/images/po2-i1.png +0 -0
- package/src/assets/images/po2-i2.png +0 -0
- package/src/assets/images/po3-i1.png +0 -0
- package/src/assets/images/po4-i1.png +0 -0
- package/src/assets/images/po5-i1.png +0 -0
- package/src/assets/images/po6-i1.png +0 -0
- package/src/assets/images/po6-i2.png +0 -0
- package/src/assets/images/po7-i1.png +0 -0
- package/src/assets/images/tj1.png +0 -0
- package/src/assets/images/tj2.png +0 -0
- package/src/assets/images/tj3.png +0 -0
- package/src/components/3dcloudwords/index.js +346 -0
- package/src/components/3dcloudwords/index.vue +99 -0
- package/src/components/3dcloudwords/readme.md +66 -0
- package/src/components/badge/index.js +167 -0
- package/src/components/badge/index.scss +166 -0
- package/src/components/badge/index.vue +98 -0
- package/src/components/badge/readme.md +18 -0
- package/src/components/basic/Finish.vue +107 -0
- package/src/components/basic/button.vue +19 -0
- package/src/components/basic/readme.md +7 -0
- package/src/components/button/index.vue +48 -0
- package/src/components/button/readme.md +62 -0
- package/src/components/carousel/index.vue +104 -0
- package/src/components/carousel/readme.md +12 -0
- package/src/components/chartconfig/index.vue +141 -0
- package/src/components/chartconfig/readme.md +25 -0
- package/src/components/contextMenu/hookContxtMenu.js +41 -0
- package/src/components/contextMenu/index.vue +245 -0
- package/src/components/contextMenu/readme.md +55 -0
- package/src/components/contextMenu/useElementBounding.js +40 -0
- package/src/components/countup/countUp.js +196 -0
- package/src/components/countup/index.vue +114 -0
- package/src/components/countup/readme.md +9 -0
- package/src/components/empty/assets/build.png +0 -0
- package/src/components/empty/assets/emptybg.gif +0 -0
- package/src/components/empty/assets/emptybg.png +0 -0
- package/src/components/empty/assets/emptybg2.jpg +0 -0
- package/src/components/empty/assets/emptybg3.jpg +0 -0
- package/src/components/empty/assets/wuxiao.png +0 -0
- package/src/components/empty/assets/wuxiao.webp +0 -0
- package/src/components/empty/building.vue +117 -0
- package/src/components/empty/empty.vue +120 -0
- package/src/components/empty/index.js +12 -0
- package/src/components/empty/invalid.vue +56 -0
- package/src/components/error/Error.vue +79 -0
- package/src/components/error/readme.md +20 -0
- package/src/components/form/Form.vue +84 -0
- package/src/components/form/FormItem.vue +143 -0
- package/src/components/form/data.js +52 -0
- package/src/components/form/readme.md +69 -0
- package/src/components/layout/banner.vue +412 -0
- package/src/components/layout/bar.vue +43 -0
- package/src/components/layout/layout1.vue +60 -0
- package/src/components/layout/layout2.vue +134 -0
- package/src/components/layout/layout3.vue +107 -0
- package/src/components/layout/layout4.vue +66 -0
- package/src/components/layout/nav.vue +333 -0
- package/src/components/layout/readme.md +61 -0
- package/src/components/loading/index.vue +122 -0
- package/src/components/loading/readme.md +6 -0
- package/src/components/notice/NoticeList.vue +198 -0
- package/src/components/notice/NoticeListPaging.vue +281 -0
- package/src/components/notice/NoticeView.vue +92 -0
- package/src/components/notice/readme.md +1 -0
- package/src/components/pagination/index.vue +100 -0
- package/src/components/pagination/readme.md +19 -0
- package/src/components/pagination/scroll-to.js +51 -0
- package/src/components/progress/bar.vue +72 -0
- package/src/components/progress/progress.vue +58 -0
- package/src/components/screenfull/index.js +3 -0
- package/src/components/screenfull/index.vue +65 -0
- package/src/components/screenfull/package.json +15 -0
- package/src/components/screenfull/readme.md +6 -0
- package/src/components/statisticalCount/index.vue +80 -0
- package/src/components/statisticalCount/readme.md +21 -0
- package/src/components/username/index.vue +79 -0
- package/src/components/username/readme.md +22 -0
- package/src/components/username//346/225/210/346/236/234/345/233/276.png +0 -0
- package/src/global/index.ts +6 -0
- package/src/global/register-properties.ts +10 -0
- package/src/index.js +88 -0
- package/src/utils/coms/load.jsx +10 -0
- package/src/utils/func.js +32 -0
- package/src/utils/hookDialog.js +38 -0
- package/src/utils/hookPage.js +49 -0
- package/src/utils/index.js +5 -0
- package/src/utils/lib/console.js +39 -0
- package/src/utils/lib/debounce.js +19 -0
- package/src/utils/lib/deepextend.js +51 -0
- package/src/utils/lib/deepset.js +14 -0
- package/src/utils/lib/extend.js +28 -0
- package/src/utils/lib/index.js +13 -0
- package/src/utils/lib/json.js +90 -0
- package/src/utils/lib/mergeprops.js +62 -0
- package/src/utils/lib/mitt.js +43 -0
- package/src/utils/lib/modify.js +8 -0
- package/src/utils/lib/slot.js +19 -0
- package/src/utils/lib/toarray.js +5 -0
- package/src/utils/lib/tocase.js +11 -0
- package/src/utils/lib/todate.js +10 -0
- package/src/utils/lib/toline.js +10 -0
- package/src/utils/lib/tostring.js +7 -0
- package/src/utils/lib/type.js +45 -0
- package/src/utils/lib/unique.js +6 -0
- package/src/utils/message.js +164 -0
- package/src/utils/type.js +45 -0
- package/src/xm_components/HeadSearch/hook/hookSearch.js +96 -0
- package/src/xm_components/HeadSearch/index.vue +206 -0
- package/src/xm_components/HeadSearch/readme.md +12 -0
- package/src/xm_components/HeadSearch//346/220/234/347/264/242/345/210/227/350/241/250.png +0 -0
- package/src/xm_components/Milestone/index.vue +213 -0
- package/src/xm_components/Milestone/readme.md +15 -0
- package/src/xm_components/MultiStatisticalCard/image.png +0 -0
- package/src/xm_components/MultiStatisticalCard/index.vue +114 -0
- package/src/xm_components/MultiStatisticalCard/readme.md +29 -0
- package/src/xm_components/StatisticalCard/image.png +0 -0
- package/src/xm_components/StatisticalCard/index.vue +196 -0
- package/src/xm_components/StatisticalCard/readme.md +41 -0
- package/src/xm_components/readme.md +1 -0
- package/vite.config.js +58 -0
- package/dist/BdElement.js +0 -23432
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
var S = Object.defineProperty;
|
|
2
|
+
var C = (f, t, i) => t in f ? S(f, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : f[t] = i;
|
|
3
|
+
var n = (f, t, i) => C(f, typeof t != "symbol" ? t + "" : t, i);
|
|
4
|
+
const w = [
|
|
5
|
+
"#23bcfe",
|
|
6
|
+
// Sky Blue
|
|
7
|
+
"#ff6f61",
|
|
8
|
+
// Coral
|
|
9
|
+
"#6a5acd",
|
|
10
|
+
// Slate Blue
|
|
11
|
+
"#3cb371",
|
|
12
|
+
// Medium Sea Green
|
|
13
|
+
"#ffcc00",
|
|
14
|
+
// Golden Yellow
|
|
15
|
+
"#ff1493",
|
|
16
|
+
// Deep Pink
|
|
17
|
+
"#20b2aa",
|
|
18
|
+
// Light Sea Green
|
|
19
|
+
"#ff4500",
|
|
20
|
+
// Orange Red
|
|
21
|
+
"#9370db",
|
|
22
|
+
// Medium Purple
|
|
23
|
+
"#f08080"
|
|
24
|
+
// Light Coral
|
|
25
|
+
], M = {
|
|
26
|
+
children: [],
|
|
27
|
+
width: 480,
|
|
28
|
+
height: 480,
|
|
29
|
+
radius: "70%",
|
|
30
|
+
radiusMin: 75,
|
|
31
|
+
isDrawSvgBg: !0,
|
|
32
|
+
svgBgColor: "#000",
|
|
33
|
+
opacityOver: 1,
|
|
34
|
+
opacityOut: 0.05,
|
|
35
|
+
opacitySpeed: 6,
|
|
36
|
+
fov: 800,
|
|
37
|
+
speed: 0.5,
|
|
38
|
+
fontFamily: "Arial, sans-serif",
|
|
39
|
+
fontSize: "12",
|
|
40
|
+
fontColor: "#fff",
|
|
41
|
+
fontWeight: "normal",
|
|
42
|
+
//bold
|
|
43
|
+
fontStyle: "normal",
|
|
44
|
+
//italic
|
|
45
|
+
fontStretch: "normal",
|
|
46
|
+
//wider, narrower, ultra-condensed, extra-condensed, condensed, semi-condensed, semi-expanded, expanded, extra-expanded, ultra-expanded
|
|
47
|
+
fontToUpperCase: !1,
|
|
48
|
+
tooltipFontFamily: "Arial, sans-serif",
|
|
49
|
+
tooltipFontSize: "15",
|
|
50
|
+
tooltipFontColor: "#fff",
|
|
51
|
+
tooltipFontWeight: "normal",
|
|
52
|
+
//bold
|
|
53
|
+
tooltipFontStyle: "normal",
|
|
54
|
+
//italic
|
|
55
|
+
tooltipFontStretch: "normal",
|
|
56
|
+
//wider, narrower, ultra-condensed, extra-condensed, condensed, semi-condensed, semi-expanded, expanded, extra-expanded, ultra-expanded
|
|
57
|
+
tooltipFontToUpperCase: !1,
|
|
58
|
+
tooltipTextAnchor: "left",
|
|
59
|
+
tooltipDiffX: 0,
|
|
60
|
+
tooltipDiffY: 10,
|
|
61
|
+
animatingSpeed: 0.1,
|
|
62
|
+
animatingRadiusLimit: 1.3
|
|
63
|
+
};
|
|
64
|
+
class p {
|
|
65
|
+
constructor(t, i) {
|
|
66
|
+
n(this, "containerEl");
|
|
67
|
+
n(this, "settings");
|
|
68
|
+
n(this, "childHolder", []);
|
|
69
|
+
n(this, "tooltipEl", null);
|
|
70
|
+
n(this, "radius", 0);
|
|
71
|
+
n(this, "diameter", 0);
|
|
72
|
+
n(this, "mouseReact", !0);
|
|
73
|
+
n(this, "mousePos", { x: 0, y: 0 });
|
|
74
|
+
n(this, "center2D", { x: 0, y: 0 });
|
|
75
|
+
n(this, "center3D", { x: 0, y: 0, z: 0 });
|
|
76
|
+
n(this, "speed", { x: 0, y: 0 });
|
|
77
|
+
n(this, "position", { sx: 0, cx: 0, sy: 0, cy: 0 });
|
|
78
|
+
n(this, "MATHPI180", Math.PI / 180);
|
|
79
|
+
n(this, "svgEl", null);
|
|
80
|
+
n(this, "svgNS", "http://www.w3.org/2000/svg");
|
|
81
|
+
n(this, "svgBg", null);
|
|
82
|
+
n(this, "animFrameId", null);
|
|
83
|
+
n(this, "radius_factor", 1);
|
|
84
|
+
n(this, "animOut_cb", null);
|
|
85
|
+
n(this, "animIn_cb", null);
|
|
86
|
+
n(this, "animating", !1);
|
|
87
|
+
n(this, "onScreenResizeHandler", () => {
|
|
88
|
+
this.setParams();
|
|
89
|
+
});
|
|
90
|
+
n(this, "onMouseMoveHandler", (t) => {
|
|
91
|
+
this.mousePos = this.getMousePos(this.svgEl, t);
|
|
92
|
+
});
|
|
93
|
+
n(this, "mouseOverHandler", (t) => {
|
|
94
|
+
this.mouseReact = !1;
|
|
95
|
+
const i = t.target, o = this.getChildByElement(i);
|
|
96
|
+
o && (this.highlightChild(o), this.showTooltip(o));
|
|
97
|
+
});
|
|
98
|
+
n(this, "mouseOutHandler", (t) => {
|
|
99
|
+
this.mouseReact = !0;
|
|
100
|
+
const i = t.target;
|
|
101
|
+
this.getChildByElement(i) && this.hideTooltip();
|
|
102
|
+
});
|
|
103
|
+
// start to render the tag cloud component
|
|
104
|
+
n(this, "build", () => {
|
|
105
|
+
this.settings.children.length && (this.setSvgElAndSvgBgEl(), this.addChildren(), this.setParams(), this.animationLoopStart(), window.addEventListener("resize", this.onScreenResizeHandler));
|
|
106
|
+
});
|
|
107
|
+
this.containerEl = t, this.settings = { ...M, ...i }, this.bindMethods();
|
|
108
|
+
}
|
|
109
|
+
bindMethods() {
|
|
110
|
+
this.animationLoopStart = this.animationLoopStart.bind(this), this._animIn = this._animIn.bind(this), this._animOut = this._animOut.bind(this);
|
|
111
|
+
}
|
|
112
|
+
setAttributes(t, i) {
|
|
113
|
+
for (const [o, a] of Object.entries(i))
|
|
114
|
+
t.setAttribute(o, a);
|
|
115
|
+
}
|
|
116
|
+
getFontColor(t = 0, i = [], o = "#fff") {
|
|
117
|
+
const a = i.length;
|
|
118
|
+
return a > 0 ? i[t % a] : o;
|
|
119
|
+
}
|
|
120
|
+
getMousePos(t, i) {
|
|
121
|
+
if (!t) return { x: 0, y: 0 };
|
|
122
|
+
const o = t.getBoundingClientRect();
|
|
123
|
+
return { x: i.clientX - o.left, y: i.clientY - o.top };
|
|
124
|
+
}
|
|
125
|
+
setChildPosition(t, i) {
|
|
126
|
+
if (!t.vectorPosition) return;
|
|
127
|
+
const { x: o, y: a, z: h } = t.vectorPosition, r = o - this.center3D.x, l = a - this.center3D.y, c = h - this.center3D.z, s = Math.sqrt(r * r + l * l + c * c);
|
|
128
|
+
Object.assign(t.vectorPosition, {
|
|
129
|
+
x: o / s * i,
|
|
130
|
+
y: a / s * i,
|
|
131
|
+
z: h / s * i
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
setChildPositions(t) {
|
|
135
|
+
this.childHolder.forEach((i) => this.setChildPosition(i, t));
|
|
136
|
+
}
|
|
137
|
+
setParams() {
|
|
138
|
+
var m, u;
|
|
139
|
+
const { innerWidth: t, innerHeight: i } = window, { documentElement: o, body: a } = document, {
|
|
140
|
+
width: h,
|
|
141
|
+
height: r,
|
|
142
|
+
radius: l = "65%",
|
|
143
|
+
speed: c = 0,
|
|
144
|
+
radiusMin: s = 1,
|
|
145
|
+
isDrawSvgBg: g
|
|
146
|
+
} = this.settings;
|
|
147
|
+
let e = t || o.clientWidth || a.clientWidth, d = i || o.clientHeight || a.clientHeight;
|
|
148
|
+
typeof h == "string" && h.includes("%") ? (e = Math.round(
|
|
149
|
+
this.containerEl.offsetWidth / 100 * parseInt(h)
|
|
150
|
+
), d = Math.round(e / 100 * parseInt(r))) : (e = h, d = r), e = Math.min(e, t || 0), d = Math.min(d, i || 0), this.center2D = { x: e / 2, y: d / 2 }, this.speed = { x: c / this.center2D.x, y: c / this.center2D.y }, this.diameter = Math.min(d, e) * (parseInt(`${l}`) / 100), this.diameter = Math.max(this.diameter, 1), this.radius = Math.max(this.diameter / 2, s), this.diameter = this.radius * 2, (m = this.svgEl) == null || m.setAttribute("width", `${e}`), (u = this.svgEl) == null || u.setAttribute("height", `${d}`), g && this.svgBg && (this.svgBg.setAttribute("width", `${e}`), this.svgBg.setAttribute("height", `${d}`)), this.setChildPositions(this.radius * this.radius_factor);
|
|
151
|
+
}
|
|
152
|
+
addChild(t, i, o, a, h) {
|
|
153
|
+
var g;
|
|
154
|
+
const { settings: r, svgNS: l } = this, c = this.getFontColor(t, w, r.fontColor), s = {
|
|
155
|
+
index: t,
|
|
156
|
+
mouseOver: !1,
|
|
157
|
+
fontColor: c,
|
|
158
|
+
vectorPosition: { x: o, y: a, z: h },
|
|
159
|
+
vector2D: { x: 0, y: 0 },
|
|
160
|
+
...i
|
|
161
|
+
};
|
|
162
|
+
if (i.label) {
|
|
163
|
+
const e = {
|
|
164
|
+
x: "0",
|
|
165
|
+
y: "0",
|
|
166
|
+
fill: s.fontColor,
|
|
167
|
+
"font-family": s.fontFamily || r.fontFamily,
|
|
168
|
+
"font-size": `${i.fontSize || r.fontSize}`,
|
|
169
|
+
"font-weight": s.fontWeight || r.fontWeight,
|
|
170
|
+
"font-style": s.fontStyle || r.fontStyle,
|
|
171
|
+
"font-stretch": s.fontStretch || r.fontStretch,
|
|
172
|
+
"text-anchor": "middle"
|
|
173
|
+
};
|
|
174
|
+
s.element = document.createElementNS(l, "text"), this.setAttributes(s.element, e), s.element.textContent = r.fontToUpperCase ? i.label.toUpperCase() : i.label;
|
|
175
|
+
} else if (i.image)
|
|
176
|
+
s.element = document.createElementNS(l, "image"), s.element.setAttributeNS(
|
|
177
|
+
"http://www.w3.org/1999/xlink",
|
|
178
|
+
"href",
|
|
179
|
+
i.image
|
|
180
|
+
), this.setAttributes(s.element, {
|
|
181
|
+
x: "0",
|
|
182
|
+
y: "0",
|
|
183
|
+
width: `${i.width || "0"}`,
|
|
184
|
+
height: `${i.height || "0"}`
|
|
185
|
+
}), s.diffX = i.width / 2, s.diffY = i.height / 2;
|
|
186
|
+
else
|
|
187
|
+
return;
|
|
188
|
+
s.link = document.createElementNS(l, "a"),
|
|
189
|
+
this.setAttributes(s.link, {
|
|
190
|
+
href: i.url || "#",
|
|
191
|
+
target: i.target || ""
|
|
192
|
+
}),
|
|
193
|
+
s.link.appendChild(s.element),
|
|
194
|
+
s.link.addEventListener(
|
|
195
|
+
"mouseover",
|
|
196
|
+
this.mouseOverHandler,
|
|
197
|
+
!0
|
|
198
|
+
), s.link.addEventListener(
|
|
199
|
+
"mouseout",
|
|
200
|
+
this.mouseOutHandler,
|
|
201
|
+
!0
|
|
202
|
+
), i.tooltip ? (s.tooltipLabel = r.tooltipFontToUpperCase ? i.tooltip.toUpperCase() : i.tooltip, s.tooltip = s.tooltipLabel) : s.tooltip = "", (g = this.svgEl) == null || g.appendChild(s.link), this.childHolder.push(s);
|
|
203
|
+
}
|
|
204
|
+
addTooltip() {
|
|
205
|
+
var c;
|
|
206
|
+
const {
|
|
207
|
+
tooltipFontColor: t,
|
|
208
|
+
tooltipFontFamily: i,
|
|
209
|
+
tooltipFontSize: o,
|
|
210
|
+
tooltipFontWeight: a,
|
|
211
|
+
tooltipFontStyle: h,
|
|
212
|
+
tooltipFontStretch: r,
|
|
213
|
+
tooltipTextAnchor: l
|
|
214
|
+
} = this.settings;
|
|
215
|
+
this.tooltipEl = document.createElementNS(this.svgNS, "text"), this.setAttributes(this.tooltipEl, {
|
|
216
|
+
x: "0",
|
|
217
|
+
y: "0",
|
|
218
|
+
fill: `${t}`,
|
|
219
|
+
"font-family": `${i}`,
|
|
220
|
+
"font-size": `${o}`,
|
|
221
|
+
"font-weight": `${a}`,
|
|
222
|
+
"font-style": `${h}`,
|
|
223
|
+
"font-stretch": `${r}`,
|
|
224
|
+
"text-anchor": `${l}`
|
|
225
|
+
}), (c = this.svgEl) == null || c.appendChild(this.tooltipEl);
|
|
226
|
+
}
|
|
227
|
+
showTooltip(t) {
|
|
228
|
+
if (t.tooltip && this.tooltipEl && t.vector2D) {
|
|
229
|
+
const { tooltipDiffX: i, tooltipDiffY: o, tooltipFontToUpperCase: a } = this.settings;
|
|
230
|
+
this.setAttributes(this.tooltipEl, {
|
|
231
|
+
x: `${t.vector2D.x - (i || 0)}`,
|
|
232
|
+
y: `${t.vector2D.y - (o || 0)}`,
|
|
233
|
+
opacity: "1.0"
|
|
234
|
+
}), this.tooltipEl.textContent = a ? (t.tooltipLabel || "").toUpperCase() : t.tooltipLabel || "";
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
hideTooltip() {
|
|
238
|
+
var t;
|
|
239
|
+
(t = this.tooltipEl) == null || t.setAttribute("opacity", "0.0");
|
|
240
|
+
}
|
|
241
|
+
addChildren() {
|
|
242
|
+
let t = !1;
|
|
243
|
+
this.settings.children.forEach((i, o) => {
|
|
244
|
+
const a = this.settings.children.length + 1, h = Math.acos(-1 + 2 * (o + 1) / a), r = Math.sqrt(a * Math.PI) * h, l = Math.cos(r) * Math.sin(h), c = Math.sin(r) * Math.sin(h), s = Math.cos(h);
|
|
245
|
+
this.addChild(o, i, l, c, s), i.tooltip && (t = !0);
|
|
246
|
+
}), t && this.addTooltip();
|
|
247
|
+
}
|
|
248
|
+
highlightChild(t) {
|
|
249
|
+
this.childHolder.forEach((i) => i.mouseOver = i.index === t.index);
|
|
250
|
+
}
|
|
251
|
+
getChildByElement(t) {
|
|
252
|
+
return this.childHolder.find(
|
|
253
|
+
(i) => {
|
|
254
|
+
var o;
|
|
255
|
+
return (o = i.element) == null ? void 0 : o.isEqualNode(t);
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
render() {
|
|
260
|
+
const {
|
|
261
|
+
speed: t = 0,
|
|
262
|
+
opacityOut: i = 0.1,
|
|
263
|
+
opacityOver: o = 1,
|
|
264
|
+
opacitySpeed: a = 5,
|
|
265
|
+
fov: h = 0,
|
|
266
|
+
animatingRadiusLimit: r = 1.3
|
|
267
|
+
} = this.settings, l = this.speed.x * this.mousePos.x - t, c = t - this.speed.y * this.mousePos.y, s = l * this.MATHPI180, g = c * this.MATHPI180;
|
|
268
|
+
this.position = {
|
|
269
|
+
sx: Math.sin(s),
|
|
270
|
+
cx: Math.cos(s),
|
|
271
|
+
sy: Math.sin(g),
|
|
272
|
+
cy: Math.cos(g)
|
|
273
|
+
}, this.childHolder.forEach((e) => {
|
|
274
|
+
if (!e.element || !e.vectorPosition || !e.vector2D) return;
|
|
275
|
+
if (this.mouseReact) {
|
|
276
|
+
const { x: v, y, z: x } = e.vectorPosition, E = y * this.position.sy + x * this.position.cy;
|
|
277
|
+
e.vectorPosition.x = v * this.position.cx + E * this.position.sx, e.vectorPosition.y = y * this.position.cy + x * -this.position.sy, e.vectorPosition.z = v * -this.position.sx + E * this.position.cx;
|
|
278
|
+
}
|
|
279
|
+
const d = h / (h + e.vectorPosition.z);
|
|
280
|
+
e.vector2D.x = e.vectorPosition.x * d + this.center2D.x, e.vector2D.y = e.vectorPosition.y * d + this.center2D.y, e.diffX && e.diffY && (e.vector2D.x -= e.diffX, e.vector2D.y -= e.diffY), e.element.setAttribute("x", `${e.vector2D.x}`), e.element.setAttribute("y", `${e.vector2D.y}`);
|
|
281
|
+
let m = this.mouseReact ? (this.radius - e.vectorPosition.z) / this.diameter : parseFloat(e.element.getAttribute("opacity") || "1");
|
|
282
|
+
m = this.mouseReact ? Math.max(m, i) : e.mouseOver ? m + (o - m) / a : m + (i - m) / a;
|
|
283
|
+
const u = 1 - (this.radius_factor - 1) / (r - 1);
|
|
284
|
+
e.element.setAttribute("opacity", `${m * u}`);
|
|
285
|
+
}), this.childHolder.sort((e, d) => d.vectorPosition.z - e.vectorPosition.z);
|
|
286
|
+
}
|
|
287
|
+
animationLoopStart() {
|
|
288
|
+
this.animFrameId = window.requestAnimationFrame(() => {
|
|
289
|
+
this.render(), this.animationLoopStart();
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
_animIn() {
|
|
293
|
+
(this.animating = this.radius_factor > 1) ? (this.setRadiusFactor(
|
|
294
|
+
this.radius_factor - (this.settings.animatingSpeed || 0.1)
|
|
295
|
+
), window.requestAnimationFrame(this._animIn)) : this.animIn_cb && (this.animIn_cb(), this.animIn_cb = null);
|
|
296
|
+
}
|
|
297
|
+
_animOut() {
|
|
298
|
+
(this.animating = this.radius_factor < (this.settings.animatingRadiusLimit || 1.3)) ? (this.setRadiusFactor(
|
|
299
|
+
this.radius_factor + (this.settings.animatingSpeed || 0.1)
|
|
300
|
+
), window.requestAnimationFrame(this._animOut)) : this.animOut_cb && (this.animOut_cb(), this.animOut_cb = null);
|
|
301
|
+
}
|
|
302
|
+
setRadiusFactor(t) {
|
|
303
|
+
this.radius_factor = Math.min(
|
|
304
|
+
Math.max(t, 1),
|
|
305
|
+
this.settings.animatingRadiusLimit || 1.3
|
|
306
|
+
), this.setParams();
|
|
307
|
+
}
|
|
308
|
+
resetRadiusFactor() {
|
|
309
|
+
this.setRadiusFactor(1);
|
|
310
|
+
}
|
|
311
|
+
animOut(t) {
|
|
312
|
+
this.animating || (this.radius_factor = 1, this.animOut_cb = t, this._animOut());
|
|
313
|
+
}
|
|
314
|
+
animIn(t) {
|
|
315
|
+
this.animating || (this.radius_factor = this.settings.animatingRadiusLimit || 1.3, this.animIn_cb = t, this._animIn());
|
|
316
|
+
}
|
|
317
|
+
setChildren(t) {
|
|
318
|
+
this.destroy(), this.settings.children = t, this.build();
|
|
319
|
+
}
|
|
320
|
+
setSvgElAndSvgBgEl() {
|
|
321
|
+
this.svgEl = document.createElementNS(this.svgNS, "svg"), this.svgEl.addEventListener("mousemove", this.onMouseMoveHandler), this.containerEl.appendChild(this.svgEl), this.settings.isDrawSvgBg && (this.svgBg = document.createElementNS(
|
|
322
|
+
this.svgNS,
|
|
323
|
+
"rect"
|
|
324
|
+
), this.setAttributes(this.svgBg, {
|
|
325
|
+
x: "0",
|
|
326
|
+
y: "0",
|
|
327
|
+
fill: `${this.settings.svgBgColor}`
|
|
328
|
+
}), this.svgEl.appendChild(this.svgBg));
|
|
329
|
+
}
|
|
330
|
+
// destroy the element when component is removed;
|
|
331
|
+
destroy() {
|
|
332
|
+
var t;
|
|
333
|
+
this.animFrameId && window.cancelAnimationFrame(this.animFrameId), window.removeEventListener("resize", this.onScreenResizeHandler), this.svgBg && ((t = this.svgEl) == null || t.removeChild(this.svgBg)), this.svgEl && (this.containerEl.removeChild(this.svgEl), this.svgEl.removeEventListener("mousemove", this.onMouseMoveHandler), this.svgEl = null);
|
|
334
|
+
}
|
|
335
|
+
static __VERSION() {
|
|
336
|
+
console.log(
|
|
337
|
+
"%c [ __VERSION ]-573",
|
|
338
|
+
"font-size:13px; background:pink; color:#bf2c9f;",
|
|
339
|
+
"v0.0.19_Bt: 10/16/2024, 9:49:51 AM"
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
window && (window.SVG3DTagCloud = p, window.SVG3dTagCloud = p, window.Svg3dTagCloud = p);
|
|
344
|
+
export {
|
|
345
|
+
p as default
|
|
346
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import wordclouds from './index.js'
|
|
3
|
+
import { ref, onMounted, computed, onUnmounted } from 'vue'
|
|
4
|
+
const emits = defineEmits(['svgClick'])
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
// 数据项
|
|
7
|
+
datas: {
|
|
8
|
+
type: Array,
|
|
9
|
+
default: () => []
|
|
10
|
+
},
|
|
11
|
+
// 配置项
|
|
12
|
+
settings: {
|
|
13
|
+
type: Object,
|
|
14
|
+
default: () => {}
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const cloudContainerRef = ref()
|
|
19
|
+
// 数据格式 需要包含 label、url、target、color 四个字段,label是必填项,其余字段可选
|
|
20
|
+
// const entries = [
|
|
21
|
+
// { label: 'Vue', url: 'https://vuejs.org', target: '_top', color: '#42b983' }
|
|
22
|
+
// ]
|
|
23
|
+
let settings = {
|
|
24
|
+
children: props.datas, // 选择文本或图像标签
|
|
25
|
+
width: 400, // 默认宽度
|
|
26
|
+
height: 400, // 默认高度
|
|
27
|
+
radius: '65%', // 标签云的半径百分比
|
|
28
|
+
radiusMin: 75, // 标签云的最小半径(像素)
|
|
29
|
+
isDrawSvgBg: true, // 是否绘制SVG背景
|
|
30
|
+
svgBgColor: '#fff', // 背景颜色
|
|
31
|
+
opacityOver: 1.0, // 悬停时的不透明度
|
|
32
|
+
opacityOut: 0.3, // 未悬停时的不透明度
|
|
33
|
+
opacitySpeed: 6, // 不透明度过渡速度
|
|
34
|
+
fov: 800, // 摄像机视场
|
|
35
|
+
speed: 0.2, // 旋转速度
|
|
36
|
+
fontFamily: 'Oswald, Arial, sans-serif', // 字体系列
|
|
37
|
+
fontSize: '14', // 字体大小
|
|
38
|
+
fontColor: '#fff', // 字体颜色
|
|
39
|
+
fontWeight: 'bold', // 字体粗细
|
|
40
|
+
fontStyle: 'normal', // 字体样式
|
|
41
|
+
fontStretch: 'narrower', // 字体拉伸
|
|
42
|
+
fontToUpperCase: true, // 将文本转换为大写
|
|
43
|
+
tooltipFontFamily: 'Oswald, Arial, sans-serif', // 工具提示的字体系列
|
|
44
|
+
tooltipFontSize: '12', // 工具提示的字体大小
|
|
45
|
+
tooltipFontColor: '#fff', // 工具提示的字体颜色
|
|
46
|
+
tooltipFontWeight: 'normal', // 工具提示的字体粗细
|
|
47
|
+
tooltipFontStyle: 'italic', // 工具提示的字体样式
|
|
48
|
+
tooltipFontStretch: 'normal', // 工具提示的字体拉伸
|
|
49
|
+
tooltipFontToUpperCase: false, // 工具提示文本是否转换为大写
|
|
50
|
+
tooltipTextAnchor: 'center', // 工具提示的文本锚点
|
|
51
|
+
tooltipDiffX: 10, // 工具提示的水平偏移量
|
|
52
|
+
tooltipDiffY: 10, // 工具提示的垂直偏移量
|
|
53
|
+
animatingSpeed: 0.01, // 动画速度
|
|
54
|
+
animatingRadiusLimit: 1.3 // 动画的最大半径
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const _settings = computed(() => {
|
|
58
|
+
let s = {
|
|
59
|
+
...settings,
|
|
60
|
+
...props.settings
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return s
|
|
64
|
+
})
|
|
65
|
+
//点击事件
|
|
66
|
+
const handleTextClick = (event) => {
|
|
67
|
+
|
|
68
|
+
// 检查点击的元素是否是 <text> 标签
|
|
69
|
+
if (event.target.tagName === 'text' || event.target.tagName === 'TEXT') {
|
|
70
|
+
// 获取 <text> 标签的文本内容
|
|
71
|
+
const textContent = event.target.textContent
|
|
72
|
+
if(textContent){
|
|
73
|
+
emits('svgClick',textContent)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
onMounted(() => {
|
|
78
|
+
new wordclouds(document.getElementById('bd_cloud_container'), _settings.value).build()
|
|
79
|
+
|
|
80
|
+
if (cloudContainerRef.value) {
|
|
81
|
+
|
|
82
|
+
cloudContainerRef.value.addEventListener('click', handleTextClick)
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
onUnmounted(() => {
|
|
86
|
+
|
|
87
|
+
if (cloudContainerRef.value) {
|
|
88
|
+
cloudContainerRef.value.removeEventListener('click', handleTextClick)
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<template>
|
|
94
|
+
<div>
|
|
95
|
+
<div id="bd_cloud_container" ref="cloudContainerRef"></div>
|
|
96
|
+
</div>
|
|
97
|
+
</template>
|
|
98
|
+
|
|
99
|
+
<style scoped></style>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
|
|
2
|
+
# 3D词云组件 使用说明
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
import {BdWordsCloud} from '@bdsoft/element'
|
|
7
|
+
|
|
8
|
+
// 词云点击事件
|
|
9
|
+
const handleSvgClick = (title)=>{
|
|
10
|
+
debugger
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
<BdWordsCloud @svgClick="handleSvgClick" :datas="wordscloudData" :settings="{ width: 300,height:300 }"></BdWordsCloud>
|
|
14
|
+
|
|
15
|
+
// 测试数据 --数据格式 需要包含 label、url、target、color 四个字段,label是必填项,其余字段可选
|
|
16
|
+
const entries = [
|
|
17
|
+
{ label: 'Vue', url: 'https://vuejs.org', target: '_top', color: '#42b983' },
|
|
18
|
+
{ label: 'Three.js', url: 'https://threejs.org', target: '_top', color: '#ff6347' },
|
|
19
|
+
{ label: '3D', url: '#', target: '_top', color: '#1e90ff' },
|
|
20
|
+
{ label: 'JavaScript', url: 'https://develoavaScript', target: '_top', color: '#f0db4f' },
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
## 配置说明
|
|
25
|
+
```
|
|
26
|
+
// 配置项说明(英文翻译为中文)
|
|
27
|
+
const settingsDescription = {
|
|
28
|
+
children: "代表要显示的标签的对象数组。",
|
|
29
|
+
width: "标签云的宽度,以像素为单位。默认值为400。",
|
|
30
|
+
height: "标签云的高度,以像素为单位。默认值为400。",
|
|
31
|
+
radius: "标签云的半径。可以是像素值或容器大小的百分比。默认值为'65%'。",
|
|
32
|
+
radiusMin: "标签云的最小半径,以像素为单位。默认值为75。",
|
|
33
|
+
isDrawSvgBg: "是否绘制SVG背景。默认值为false。",
|
|
34
|
+
svgBgColor: "SVG背景的颜色。默认值为'#fff'。",
|
|
35
|
+
opacityOver: "悬停时标签云的不透明度。默认值为1.0。",
|
|
36
|
+
opacityOut: "标签未悬停时的不透明度。默认值为0.3。",
|
|
37
|
+
opacitySpeed: "不透明度过渡的速度。默认值为6。",
|
|
38
|
+
fov: "摄像机的视场。默认值为800。",
|
|
39
|
+
speed: "标签云的旋转速度。默认值为0.1。",
|
|
40
|
+
fontFamily: "标签使用的字体系列。默认值为'Oswald, Arial, sans-serif'。",
|
|
41
|
+
fontSize: "标签的字体大小。默认值为'15'。",
|
|
42
|
+
fontColor: "标签的字体颜色。默认值为'#fff'。",
|
|
43
|
+
fontWeight: "标签的字体粗细。默认值为'normal'。",
|
|
44
|
+
fontStyle: "标签的字体样式。默认值为'normal'。",
|
|
45
|
+
fontStretch: "标签的字体拉伸。默认值为'narrower'。",
|
|
46
|
+
fontToUpperCase: "是否将标签文本转换为大写。默认值为true。",
|
|
47
|
+
tooltipFontFamily: "工具提示的字体系列。默认值为'Oswald, Arial, sans-serif'。",
|
|
48
|
+
tooltipFontSize: "工具提示的字体大小。默认值为'12'。",
|
|
49
|
+
tooltipFontColor: "工具提示的字体颜色。默认值为'#fff'。",
|
|
50
|
+
tooltipFontWeight: "工具提示的字体粗细。默认值为'normal'。",
|
|
51
|
+
tooltipFontStyle: "工具提示的字体样式。默认值为'italic'。",
|
|
52
|
+
tooltipFontStretch: "工具提示的字体拉伸。默认值为'normal'。",
|
|
53
|
+
tooltipFontToUpperCase: "是否将工具提示文本转换为大写。默认值为false。",
|
|
54
|
+
tooltipTextAnchor: "工具提示的文本锚点。默认值为'left'。",
|
|
55
|
+
tooltipDiffX: "工具提示的水平偏移量。默认值为10。",
|
|
56
|
+
tooltipDiffY: "工具提示的垂直偏移量。默认值为10。",
|
|
57
|
+
animatingSpeed: "动画速度。默认值为0.01。",
|
|
58
|
+
animatingRadiusLimit: "动画的最大半径。默认值为1.3。"
|
|
59
|
+
};
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
https://www.npmjs.com/package/svg-3d-tag-cloud?activeTab=readme
|