sun-card-design 1.1.37 → 1.1.38

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 (152) hide show
  1. package/package.json +1 -1
  2. package/dist/mobile/sun-card-design-mobile.es61.js +0 -98
  3. package/dist/mobile/sun-card-design-mobile.es62.js +0 -98
  4. package/dist/public/sun-card-designer.css +0 -1
  5. package/dist/sun-card-designer.es.js +0 -25
  6. package/dist/sun-card-designer.es10.js +0 -167
  7. package/dist/sun-card-designer.es11.js +0 -197
  8. package/dist/sun-card-designer.es12.js +0 -203
  9. package/dist/sun-card-designer.es13.js +0 -130
  10. package/dist/sun-card-designer.es14.js +0 -120
  11. package/dist/sun-card-designer.es151.js +0 -4
  12. package/dist/sun-card-designer.es152.js +0 -4
  13. package/dist/sun-card-designer.es153.js +0 -4
  14. package/dist/sun-card-designer.es154.js +0 -4
  15. package/dist/sun-card-designer.es155.js +0 -82
  16. package/dist/sun-card-designer.es156.js +0 -91
  17. package/dist/sun-card-designer.es157.js +0 -92
  18. package/dist/sun-card-designer.es158.js +0 -191
  19. package/dist/sun-card-designer.es159.js +0 -86
  20. package/dist/sun-card-designer.es16.js +0 -10
  21. package/dist/sun-card-designer.es160.js +0 -238
  22. package/dist/sun-card-designer.es161.js +0 -113
  23. package/dist/sun-card-designer.es162.js +0 -49
  24. package/dist/sun-card-designer.es163.js +0 -43
  25. package/dist/sun-card-designer.es164.js +0 -39
  26. package/dist/sun-card-designer.es165.js +0 -46
  27. package/dist/sun-card-designer.es166.js +0 -58
  28. package/dist/sun-card-designer.es167.js +0 -56
  29. package/dist/sun-card-designer.es168.js +0 -58
  30. package/dist/sun-card-designer.es169.js +0 -73
  31. package/dist/sun-card-designer.es17.js +0 -333
  32. package/dist/sun-card-designer.es170.js +0 -59
  33. package/dist/sun-card-designer.es171.js +0 -69
  34. package/dist/sun-card-designer.es172.js +0 -182
  35. package/dist/sun-card-designer.es173.js +0 -176
  36. package/dist/sun-card-designer.es174.js +0 -184
  37. package/dist/sun-card-designer.es175.js +0 -409
  38. package/dist/sun-card-designer.es176.js +0 -365
  39. package/dist/sun-card-designer.es177.js +0 -70
  40. package/dist/sun-card-designer.es178.js +0 -68
  41. package/dist/sun-card-designer.es179.js +0 -184
  42. package/dist/sun-card-designer.es18.js +0 -68
  43. package/dist/sun-card-designer.es180.js +0 -193
  44. package/dist/sun-card-designer.es181.js +0 -193
  45. package/dist/sun-card-designer.es182.js +0 -193
  46. package/dist/sun-card-designer.es184.js +0 -228
  47. package/dist/sun-card-designer.es185.js +0 -71
  48. package/dist/sun-card-designer.es19.js +0 -611
  49. package/dist/sun-card-designer.es196.js +0 -4
  50. package/dist/sun-card-designer.es20.js +0 -225
  51. package/dist/sun-card-designer.es201.js +0 -125
  52. package/dist/sun-card-designer.es21.js +0 -69
  53. package/dist/sun-card-designer.es22.js +0 -719
  54. package/dist/sun-card-designer.es220.js +0 -63
  55. package/dist/sun-card-designer.es221.js +0 -80
  56. package/dist/sun-card-designer.es222.js +0 -82
  57. package/dist/sun-card-designer.es223.js +0 -94
  58. package/dist/sun-card-designer.es224.js +0 -87
  59. package/dist/sun-card-designer.es225.js +0 -226
  60. package/dist/sun-card-designer.es226.js +0 -105
  61. package/dist/sun-card-designer.es227.js +0 -45
  62. package/dist/sun-card-designer.es228.js +0 -31
  63. package/dist/sun-card-designer.es229.js +0 -29
  64. package/dist/sun-card-designer.es23.js +0 -211
  65. package/dist/sun-card-designer.es230.js +0 -32
  66. package/dist/sun-card-designer.es231.js +0 -46
  67. package/dist/sun-card-designer.es232.js +0 -42
  68. package/dist/sun-card-designer.es233.js +0 -44
  69. package/dist/sun-card-designer.es234.js +0 -61
  70. package/dist/sun-card-designer.es235.js +0 -46
  71. package/dist/sun-card-designer.es236.js +0 -54
  72. package/dist/sun-card-designer.es237.js +0 -130
  73. package/dist/sun-card-designer.es238.js +0 -127
  74. package/dist/sun-card-designer.es239.js +0 -132
  75. package/dist/sun-card-designer.es24.js +0 -265
  76. package/dist/sun-card-designer.es240.js +0 -375
  77. package/dist/sun-card-designer.es241.js +0 -348
  78. package/dist/sun-card-designer.es242.js +0 -69
  79. package/dist/sun-card-designer.es243.js +0 -65
  80. package/dist/sun-card-designer.es244.js +0 -87
  81. package/dist/sun-card-designer.es245.js +0 -98
  82. package/dist/sun-card-designer.es246.js +0 -98
  83. package/dist/sun-card-designer.es247.js +0 -98
  84. package/dist/sun-card-designer.es25.js +0 -857
  85. package/dist/sun-card-designer.es26.js +0 -768
  86. package/dist/sun-card-designer.es260.js +0 -125
  87. package/dist/sun-card-designer.es27.js +0 -264
  88. package/dist/sun-card-designer.es273.js +0 -192
  89. package/dist/sun-card-designer.es28.js +0 -809
  90. package/dist/sun-card-designer.es29.js +0 -220
  91. package/dist/sun-card-designer.es3.js +0 -506
  92. package/dist/sun-card-designer.es30.js +0 -809
  93. package/dist/sun-card-designer.es31.js +0 -220
  94. package/dist/sun-card-designer.es32.js +0 -820
  95. package/dist/sun-card-designer.es33.js +0 -225
  96. package/dist/sun-card-designer.es34.js +0 -69
  97. package/dist/sun-card-designer.es35.js +0 -375
  98. package/dist/sun-card-designer.es36.js +0 -186
  99. package/dist/sun-card-designer.es37.js +0 -119
  100. package/dist/sun-card-designer.es38.js +0 -354
  101. package/dist/sun-card-designer.es39.js +0 -127
  102. package/dist/sun-card-designer.es4.js +0 -365
  103. package/dist/sun-card-designer.es40.js +0 -100
  104. package/dist/sun-card-designer.es41.js +0 -214
  105. package/dist/sun-card-designer.es42.js +0 -119
  106. package/dist/sun-card-designer.es43.js +0 -250
  107. package/dist/sun-card-designer.es44.js +0 -118
  108. package/dist/sun-card-designer.es45.js +0 -64
  109. package/dist/sun-card-designer.es46.js +0 -223
  110. package/dist/sun-card-designer.es47.js +0 -196
  111. package/dist/sun-card-designer.es48.js +0 -77
  112. package/dist/sun-card-designer.es49.js +0 -85
  113. package/dist/sun-card-designer.es5.js +0 -317
  114. package/dist/sun-card-designer.es50.js +0 -85
  115. package/dist/sun-card-designer.es51.js +0 -64
  116. package/dist/sun-card-designer.es52.js +0 -283
  117. package/dist/sun-card-designer.es53.js +0 -64
  118. package/dist/sun-card-designer.es54.js +0 -142
  119. package/dist/sun-card-designer.es55.js +0 -52
  120. package/dist/sun-card-designer.es56.js +0 -85
  121. package/dist/sun-card-designer.es57.js +0 -258
  122. package/dist/sun-card-designer.es58.js +0 -226
  123. package/dist/sun-card-designer.es59.js +0 -169
  124. package/dist/sun-card-designer.es6.js +0 -190
  125. package/dist/sun-card-designer.es60.js +0 -280
  126. package/dist/sun-card-designer.es61.js +0 -168
  127. package/dist/sun-card-designer.es62.js +0 -219
  128. package/dist/sun-card-designer.es63.js +0 -168
  129. package/dist/sun-card-designer.es64.js +0 -275
  130. package/dist/sun-card-designer.es65.js +0 -760
  131. package/dist/sun-card-designer.es66.js +0 -272
  132. package/dist/sun-card-designer.es67.js +0 -559
  133. package/dist/sun-card-designer.es68.js +0 -124
  134. package/dist/sun-card-designer.es69.js +0 -528
  135. package/dist/sun-card-designer.es7.js +0 -65
  136. package/dist/sun-card-designer.es70.js +0 -185
  137. package/dist/sun-card-designer.es71.js +0 -107
  138. package/dist/sun-card-designer.es72.js +0 -153
  139. package/dist/sun-card-designer.es73.js +0 -315
  140. package/dist/sun-card-designer.es74.js +0 -114
  141. package/dist/sun-card-designer.es76.js +0 -4211
  142. package/dist/sun-card-designer.es79.js +0 -4
  143. package/dist/sun-card-designer.es8.js +0 -171
  144. package/dist/sun-card-designer.es80.js +0 -4
  145. package/dist/sun-card-designer.es81.js +0 -4
  146. package/dist/sun-card-designer.es84.js +0 -228
  147. package/dist/sun-card-designer.es87.js +0 -52
  148. package/dist/sun-card-designer.es88.js +0 -52
  149. package/dist/sun-card-designer.es9.js +0 -207
  150. package/dist/sun-card-designer.es91.js +0 -344
  151. package/dist/sun-card-designer.es92.js +0 -199
  152. package/dist/sun-card-designer.es95.js +0 -180
@@ -1,365 +0,0 @@
1
- import { ref, watch, computed, onMounted, onUnmounted, createElementBlock, openBlock, normalizeStyle, normalizeClass } from "vue";
2
- import * as THREE from "three";
3
- import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
4
- import { CSS2DRenderer, CSS2DObject } from "three/examples/jsm/renderers/CSS2DRenderer.js";
5
- import "three/examples/jsm/loaders/EXRLoader.js";
6
- import { useCardManageStore } from "./sun-card-designer.es13.js";
7
- /* empty css */
8
- import _export_sfc from "./sun-card-designer.es16.js";
9
- const _sfc_main = {
10
- __name: "pieChart3dComp",
11
- props: ["record"],
12
- setup(__props) {
13
- const props = __props;
14
- const currentUuid = ref(null);
15
- const cardManageStore = useCardManageStore();
16
- watch(
17
- () => cardManageStore.currentSelectUuid,
18
- (val) => {
19
- currentUuid.value = val;
20
- }
21
- );
22
- const containerRef = ref(null);
23
- let renderer = null;
24
- let labelRenderer = null;
25
- let scene = null;
26
- let camera = null;
27
- let animationId = null;
28
- let resizeObserver = null;
29
- let controls = null;
30
- let chartGroup = null;
31
- let envTexture = null;
32
- const chartStyle = computed(() => {
33
- const style = props.record?.options?.style || {};
34
- return {
35
- width: style.width || "100%",
36
- height: style.height || "260px"
37
- };
38
- });
39
- function getPieConfig() {
40
- const options = props.record?.options || {};
41
- const series = Array.isArray(options?.seriesConfig) && options.seriesConfig[0] ? options.seriesConfig[0] : {
42
- radius: "0%",
43
- data: [
44
- { value: 1048, name: "饼图" },
45
- { value: 735, name: "柱状图" },
46
- { value: 580, name: "折线图" },
47
- { value: 484, name: "路径图" },
48
- { value: 300, name: "关系图" }
49
- ],
50
- colors: ["#2b7fff", "#31D492", "#FFB93B", "#FB2C36", "#8E51FF"],
51
- colorsMap: {}
52
- };
53
- const radius = series.radius;
54
- const data = Array.isArray(series.data) ? series.data : [];
55
- const colors = Array.isArray(series.colors) ? series.colors : [];
56
- const colorsMap = series.colorsMap && typeof series.colorsMap === "object" ? series.colorsMap : {};
57
- return { data, radius, colors, colorsMap };
58
- }
59
- function parseRadius(radiusStr, base) {
60
- if (typeof radiusStr === "number") return radiusStr;
61
- if (typeof radiusStr === "string" && radiusStr.trim().endsWith("%")) {
62
- const pct = parseFloat(radiusStr) / 100;
63
- return base * pct;
64
- }
65
- const val = parseFloat(radiusStr);
66
- return Number.isFinite(val) ? val : base * 0.7;
67
- }
68
- function initScene() {
69
- if (!containerRef.value) return;
70
- const { clientWidth, clientHeight } = containerRef.value;
71
- scene = new THREE.Scene();
72
- scene.background = null;
73
- const aspect = Math.max(clientWidth, 1) / Math.max(clientHeight, 1);
74
- camera = new THREE.PerspectiveCamera(40, aspect, 0.1, 1e3);
75
- camera.position.set(0, 6, 14);
76
- camera.lookAt(0, 0, 0);
77
- renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
78
- renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
79
- renderer.setSize(clientWidth, clientHeight);
80
- renderer.toneMapping = THREE.LinearToneMapping;
81
- renderer.toneMappingExposure = 1.2;
82
- renderer.outputColorSpace = THREE.SRGBColorSpace;
83
- containerRef.value.appendChild(renderer.domElement);
84
- try {
85
- const jpgUrl = new URL("/assets/pic1.jpg", import.meta.url).href;
86
- const textureLoader = new THREE.TextureLoader();
87
- textureLoader.load(
88
- jpgUrl,
89
- (tex) => {
90
- tex.mapping = THREE.EquirectangularReflectionMapping;
91
- tex.colorSpace = THREE.SRGBColorSpace;
92
- tex.userData = { brightness: 1.6, contrast: 1.2 };
93
- envTexture = tex;
94
- if (scene) {
95
- scene.background = envTexture;
96
- scene.environment = envTexture;
97
- } else {
98
- envTexture.dispose();
99
- envTexture = null;
100
- }
101
- }
102
- );
103
- } catch (e) {
104
- }
105
- labelRenderer = new CSS2DRenderer();
106
- labelRenderer.setSize(clientWidth, clientHeight);
107
- labelRenderer.domElement.style.position = "absolute";
108
- labelRenderer.domElement.style.top = "0px";
109
- labelRenderer.domElement.style.pointerEvents = "none";
110
- containerRef.value.appendChild(labelRenderer.domElement);
111
- const ambient = new THREE.AmbientLight(16777215, 1);
112
- scene.add(ambient);
113
- const dirLight = new THREE.DirectionalLight(16777215, 1);
114
- dirLight.position.set(5, 10, 7);
115
- scene.add(dirLight);
116
- chartGroup = new THREE.Group();
117
- chartGroup.name = "pie3d-group";
118
- chartGroup.rotation.x = Math.PI / 4;
119
- scene.add(chartGroup);
120
- buildPie();
121
- controls = new OrbitControls(camera, renderer.domElement);
122
- controls.enableDamping = true;
123
- controls.enablePan = true;
124
- controls.enableRotate = true;
125
- controls.enableZoom = true;
126
- controls.screenSpacePanning = true;
127
- controls.panSpeed = 1;
128
- controls.rotateSpeed = 0.6;
129
- controls.zoomSpeed = 1;
130
- controls.autoRotate = false;
131
- controls.target.set(0, 0, 0);
132
- startAnimate();
133
- observeResize();
134
- }
135
- function clearGroup(group) {
136
- if (!group) return;
137
- for (let i = group.children.length - 1; i >= 0; i--) {
138
- const child = group.children[i];
139
- if (child.children && child.children.length) {
140
- clearGroup(child);
141
- }
142
- if (child.isCSS2DObject && child.element && child.element.parentNode) {
143
- child.element.parentNode.removeChild(child.element);
144
- }
145
- group.remove(child);
146
- if (child.geometry) child.geometry.dispose();
147
- if (child.material) {
148
- if (Array.isArray(child.material)) child.material.forEach((m) => m.dispose());
149
- else child.material.dispose();
150
- }
151
- }
152
- }
153
- function buildPie() {
154
- if (!chartGroup) return;
155
- clearGroup(chartGroup);
156
- const { data, radius, colors, colorsMap } = getPieConfig();
157
- if (!Array.isArray(data) || data.length === 0) return;
158
- const total = data.reduce((s, d) => s + (Number(d.value) || 0), 0);
159
- if (total <= 0) return;
160
- const baseR = 5;
161
- let innerR = 0;
162
- let outerR = baseR;
163
- if (Array.isArray(radius)) {
164
- innerR = parseRadius(radius[0] ?? "0%", baseR);
165
- outerR = parseRadius(radius[1] ?? "100%", baseR);
166
- } else {
167
- innerR = parseRadius(radius ?? "0%", baseR);
168
- outerR = parseRadius("100%", baseR);
169
- }
170
- const thickness = 1.4;
171
- let startAngle = 0;
172
- data.forEach((item, idx) => {
173
- const value = Number(item.value) || 0;
174
- let thetaLen = value / total * Math.PI * 2;
175
- if (idx === data.length - 1) {
176
- thetaLen = Math.max(0, Math.PI * 2 - startAngle);
177
- }
178
- const midAngle = startAngle + thetaLen / 2;
179
- const sectorGeom = createWedgeGeometry(innerR, outerR, startAngle, thetaLen, thickness, 72);
180
- const colorByName = item && typeof item.name === "string" ? colorsMap[item.name] : void 0;
181
- const color = typeof colorByName === "string" ? colorByName : typeof colors[idx] === "string" ? colors[idx] : "#2b7fff";
182
- const mat = new THREE.MeshStandardMaterial({ color: new THREE.Color(color), side: THREE.DoubleSide });
183
- const sectorMesh = new THREE.Mesh(sectorGeom, mat);
184
- chartGroup.add(sectorMesh);
185
- const labelDiv = document.createElement("div");
186
- labelDiv.className = "pie-label";
187
- labelDiv.style.color = "#ffffff";
188
- labelDiv.style.fontSize = "12px";
189
- labelDiv.style.fontFamily = "Arial, sans-serif";
190
- labelDiv.style.textAlign = "center";
191
- labelDiv.style.pointerEvents = "none";
192
- labelDiv.textContent = `${item.name ?? ""} ${value}`;
193
- const label = new CSS2DObject(labelDiv);
194
- const labelR = (innerR + outerR) / 2;
195
- label.position.set(Math.cos(midAngle) * labelR, thickness + 0.3, Math.sin(midAngle) * labelR);
196
- chartGroup.add(label);
197
- startAngle += thetaLen;
198
- });
199
- }
200
- function createWedgeGeometry(innerR, outerR, startAngle, thetaLen, thickness, radialSegments = 64) {
201
- const topY = thickness / 2;
202
- const botY = -thickness / 2;
203
- const segs = Math.max(3, Math.floor(radialSegments));
204
- const positions = [];
205
- const indices = [];
206
- const outerTop = [];
207
- const innerTop = [];
208
- const outerBot = [];
209
- const innerBot = [];
210
- for (let i = 0; i <= segs; i++) {
211
- const t = i / segs;
212
- const ang = startAngle + thetaLen * t;
213
- const cos = Math.cos(ang);
214
- const sin = Math.sin(ang);
215
- outerTop.push([cos * outerR, topY, sin * outerR]);
216
- outerBot.push([cos * outerR, botY, sin * outerR]);
217
- const ir = Math.max(0, innerR);
218
- const ix = ir > 0 ? cos * ir : 0;
219
- const iz = ir > 0 ? sin * ir : 0;
220
- innerTop.push([ix, topY, iz]);
221
- innerBot.push([ix, botY, iz]);
222
- }
223
- const pushV = (v) => {
224
- positions.push(v[0], v[1], v[2]);
225
- };
226
- const baseIndex = 0;
227
- outerTop.forEach(pushV);
228
- innerTop.forEach(pushV);
229
- outerBot.forEach(pushV);
230
- innerBot.forEach(pushV);
231
- const ot = (i) => baseIndex + i;
232
- const it = (i) => baseIndex + (segs + 1) + i;
233
- const ob = (i) => baseIndex + (segs + 1) * 2 + i;
234
- const ib = (i) => baseIndex + (segs + 1) * 3 + i;
235
- for (let i = 0; i < segs; i++) {
236
- indices.push(ot(i), it(i), it(i + 1));
237
- indices.push(ot(i), it(i + 1), ot(i + 1));
238
- }
239
- for (let i = 0; i < segs; i++) {
240
- indices.push(ob(i), ib(i + 1), ib(i));
241
- indices.push(ob(i), ob(i + 1), ib(i + 1));
242
- }
243
- for (let i = 0; i < segs; i++) {
244
- indices.push(ot(i), ob(i + 1), ob(i));
245
- indices.push(ot(i), ot(i + 1), ob(i + 1));
246
- }
247
- if (innerR > 0) {
248
- for (let i = 0; i < segs; i++) {
249
- indices.push(it(i), ib(i), ib(i + 1));
250
- indices.push(it(i), ib(i + 1), it(i + 1));
251
- }
252
- } else {
253
- indices.push(ot(0), ob(0), it(0));
254
- indices.push(it(0), ob(0), ib(0));
255
- indices.push(ot(segs), it(segs), ob(segs));
256
- indices.push(it(segs), ib(segs), ob(segs));
257
- }
258
- if (innerR > 0) {
259
- indices.push(ot(0), ob(0), it(0));
260
- indices.push(it(0), ob(0), ib(0));
261
- indices.push(ot(segs), it(segs), ob(segs));
262
- indices.push(it(segs), ib(segs), ob(segs));
263
- }
264
- const geom = new THREE.BufferGeometry();
265
- geom.setAttribute("position", new THREE.Float32BufferAttribute(positions, 3));
266
- geom.setIndex(indices);
267
- geom.computeVertexNormals();
268
- return geom;
269
- }
270
- function startAnimate() {
271
- stopAnimate();
272
- const animate = () => {
273
- animationId = requestAnimationFrame(animate);
274
- if (controls) controls.update();
275
- renderer && renderer.render(scene, camera);
276
- labelRenderer && labelRenderer.render(scene, camera);
277
- };
278
- animate();
279
- }
280
- function stopAnimate() {
281
- if (animationId) {
282
- cancelAnimationFrame(animationId);
283
- animationId = null;
284
- }
285
- }
286
- function observeResize() {
287
- if (!containerRef.value) return;
288
- if (resizeObserver) resizeObserver.disconnect();
289
- resizeObserver = new ResizeObserver((entries) => {
290
- for (const entry of entries) {
291
- const cr = entry.contentRect;
292
- onResize(Math.max(cr.width, 1), Math.max(cr.height, 1));
293
- }
294
- });
295
- resizeObserver.observe(containerRef.value);
296
- }
297
- function onResize(width, height) {
298
- if (!renderer || !camera) return;
299
- renderer.setSize(width, height);
300
- labelRenderer && labelRenderer.setSize(width, height);
301
- camera.aspect = width / height;
302
- camera.updateProjectionMatrix();
303
- }
304
- watch(
305
- () => [props.record?.options?.seriesConfig, props.record?.options?.style],
306
- () => {
307
- buildPie();
308
- },
309
- { deep: true }
310
- );
311
- onMounted(() => {
312
- initScene();
313
- });
314
- onUnmounted(() => {
315
- stopAnimate();
316
- if (resizeObserver) {
317
- resizeObserver.disconnect();
318
- resizeObserver = null;
319
- }
320
- if (chartGroup) {
321
- clearGroup(chartGroup);
322
- chartGroup = null;
323
- }
324
- if (renderer) {
325
- renderer.dispose();
326
- if (renderer.domElement && renderer.domElement.parentNode) {
327
- renderer.domElement.parentNode.removeChild(renderer.domElement);
328
- }
329
- renderer = null;
330
- }
331
- if (labelRenderer) {
332
- if (labelRenderer.domElement && labelRenderer.domElement.parentNode) {
333
- labelRenderer.domElement.parentNode.removeChild(labelRenderer.domElement);
334
- }
335
- labelRenderer = null;
336
- }
337
- if (envTexture) {
338
- envTexture.dispose();
339
- envTexture = null;
340
- }
341
- if (controls) {
342
- controls.dispose();
343
- controls = null;
344
- }
345
- camera = null;
346
- scene = null;
347
- });
348
- return (_ctx, _cache) => {
349
- return openBlock(), createElementBlock("div", {
350
- class: normalizeClass(["main-pieChart3d", { active: currentUuid.value === props.record.uuid }]),
351
- ref_key: "containerRef",
352
- ref: containerRef,
353
- style: normalizeStyle({
354
- width: chartStyle.value.width,
355
- height: chartStyle.value.height,
356
- padding: `${props.record.options?.style?.tbPadding || 0}px ${props.record.options?.style?.lrPadding || 0}px`
357
- })
358
- }, null, 6);
359
- };
360
- }
361
- };
362
- const PieChart3D = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-85fbe784"]]);
363
- export {
364
- PieChart3D as default
365
- };
@@ -1,70 +0,0 @@
1
- import { ref, watch, computed, resolveComponent, createElementBlock, openBlock, normalizeStyle, normalizeClass, createElementVNode, createVNode, withCtx, unref, createTextVNode } from "vue";
2
- import { useCardManageStore } from "./sun-card-designer.es13.js";
3
- import { panoramaSvg } from "./sun-card-designer.es6.js";
4
- /* empty css */
5
- import _export_sfc from "./sun-card-designer.es16.js";
6
- const _hoisted_1 = ["src"];
7
- const _hoisted_2 = ["innerHTML"];
8
- const _sfc_main = {
9
- __name: "panoramaComp",
10
- props: ["record"],
11
- setup(__props) {
12
- const props = __props;
13
- const cardManageStore = useCardManageStore();
14
- const currentUuid = ref(null);
15
- watch(
16
- () => cardManageStore.currentSelectUuid,
17
- (val) => {
18
- currentUuid.value = val;
19
- }
20
- );
21
- const styleSize = computed(() => {
22
- const s = props.record?.options?.style || {};
23
- return {
24
- width: s.width || "100%",
25
- height: s.height || "360px"
26
- };
27
- });
28
- const onView = () => {
29
- cardManageStore.setActivePanorama(props.record.options.src);
30
- };
31
- return (_ctx, _cache) => {
32
- const _component_a_tooltip = resolveComponent("a-tooltip");
33
- return openBlock(), createElementBlock("div", {
34
- class: normalizeClass(["main-panorama", { active: currentUuid.value === props.record.uuid }]),
35
- style: normalizeStyle({ padding: `${props.record.options?.style?.tbPadding || 0}px ${props.record.options?.style?.lrPadding || 0}px` })
36
- }, [
37
- createElementVNode("div", {
38
- class: "panorama-box",
39
- style: normalizeStyle({
40
- width: styleSize.value.width,
41
- height: styleSize.value.height,
42
- borderRadius: props.record.options.style.borderRadius + "px"
43
- })
44
- }, [
45
- createElementVNode("img", {
46
- src: props.record.options.briefSrc,
47
- style: { "width": "100%", "height": "100%" }
48
- }, null, 8, _hoisted_1),
49
- createVNode(_component_a_tooltip, null, {
50
- title: withCtx(() => [..._cache[0] || (_cache[0] = [
51
- createTextVNode("点击预览", -1)
52
- ])]),
53
- default: withCtx(() => [
54
- createElementVNode("div", {
55
- class: "panorama-box-icon",
56
- innerHTML: unref(panoramaSvg)(),
57
- onClick: onView
58
- }, null, 8, _hoisted_2)
59
- ]),
60
- _: 1
61
- })
62
- ], 4)
63
- ], 6);
64
- };
65
- }
66
- };
67
- const Panorama = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-44c4b6f6"]]);
68
- export {
69
- Panorama as default
70
- };
@@ -1,68 +0,0 @@
1
- import { ref, markRaw, defineComponent, h, computed, watch, createElementBlock, openBlock, createElementVNode, normalizeClass, normalizeStyle, createBlock, resolveDynamicComponent } from "vue";
2
- import { useCardManageStore } from "./sun-card-designer.es13.js";
3
- import * as Icons from "@ant-design/icons-vue";
4
- import { customIcon } from "./sun-card-designer.es76.js";
5
- /* empty css */
6
- import _export_sfc from "./sun-card-designer.es16.js";
7
- const _sfc_main = {
8
- __name: "sunIconComp",
9
- props: ["record"],
10
- setup(__props) {
11
- const props = __props;
12
- const cardManageStore = useCardManageStore();
13
- const currentUuid = ref(null);
14
- const customIconComponents = Object.entries(customIcon || {}).reduce((acc, [key, svg]) => {
15
- const normalized = svg.replace(/fill="#000000"/gi, 'fill="currentColor"');
16
- acc[key] = markRaw(
17
- defineComponent({
18
- name: `CustomIcon${key}`,
19
- setup() {
20
- return () => h("span", { innerHTML: normalized });
21
- }
22
- })
23
- );
24
- return acc;
25
- }, {});
26
- const iconMap = { ...Icons, ...customIconComponents };
27
- const iconComponent = computed(() => {
28
- const name = props?.record?.options?.style?.iconName || "CheckCircleOutlined";
29
- return iconMap[name] || Icons["CheckCircleOutlined"];
30
- });
31
- const iconStyle = computed(() => {
32
- const color = props?.record?.options?.style?.color || "#000000";
33
- const align = props?.record?.options?.style?.align || "left";
34
- const map = { left: "flex-start", center: "center", right: "flex-end" };
35
- return {
36
- color,
37
- display: "flex",
38
- justifyContent: map[align] || "flex-start",
39
- alignItems: "center",
40
- width: "100%",
41
- padding: `${props.record.options?.style?.tbPadding || 0}px ${props.record.options?.style?.lrPadding || 0}px`
42
- };
43
- });
44
- watch(
45
- () => cardManageStore.currentSelectUuid,
46
- (val) => {
47
- currentUuid.value = val;
48
- }
49
- );
50
- return (_ctx, _cache) => {
51
- return openBlock(), createElementBlock("div", null, [
52
- createElementVNode("div", {
53
- class: normalizeClass(["main-icon", { active: currentUuid.value === props.record.uuid }])
54
- }, [
55
- createElementVNode("span", {
56
- style: normalizeStyle(iconStyle.value)
57
- }, [
58
- (openBlock(), createBlock(resolveDynamicComponent(iconComponent.value), { style: { "height": "18px", "width": "18px" } }))
59
- ], 4)
60
- ], 2)
61
- ]);
62
- };
63
- }
64
- };
65
- const SunIcon = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-84bfc85d"]]);
66
- export {
67
- SunIcon as default
68
- };
@@ -1,184 +0,0 @@
1
- import { ref, watch, resolveComponent, createElementBlock, openBlock, normalizeStyle, normalizeClass, createVNode, withCtx, Fragment, renderList, createBlock, createElementVNode, withModifiers, unref } from "vue";
2
- import draggable from "vuedraggable";
3
- import FormItem from "./sun-card-designer.es84.js";
4
- import { useCardManageStore } from "./sun-card-designer.es13.js";
5
- /* empty css */
6
- import _export_sfc from "./sun-card-designer.es16.js";
7
- const _hoisted_1 = ["onClick"];
8
- const _hoisted_2 = ["onClick"];
9
- const _sfc_main = {
10
- __name: "singleColumn",
11
- props: ["record", "recordData", "columnsIndex"],
12
- setup(__props) {
13
- const props = __props;
14
- const cardManageStore = useCardManageStore();
15
- const onConfig = (uuid) => {
16
- cardManageStore.setCurrentSelectUuid(uuid);
17
- };
18
- const currentUuid = ref(null);
19
- watch(
20
- () => cardManageStore.currentSelectUuid,
21
- (val) => {
22
- currentUuid.value = val;
23
- }
24
- );
25
- const dragFromIndexGrid = ref(-1);
26
- const hoverToIndexGrid = ref(-1);
27
- const activeListRef = ref(null);
28
- const externalTargetList = ref(null);
29
- const externalTargetIndex = ref(-1);
30
- const isTargetExternal = ref(false);
31
- function onGridStart(evt, column) {
32
- dragFromIndexGrid.value = evt.oldIndex;
33
- hoverToIndexGrid.value = -1;
34
- activeListRef.value = column.list;
35
- isTargetExternal.value = false;
36
- externalTargetList.value = null;
37
- externalTargetIndex.value = -1;
38
- }
39
- function onGridMove(evt) {
40
- try {
41
- const { relatedContext, draggedContext, to, from } = evt;
42
- const sameContainer = relatedContext && draggedContext && relatedContext.component === draggedContext.component;
43
- if (sameContainer || to === from) {
44
- isTargetExternal.value = false;
45
- externalTargetList.value = null;
46
- externalTargetIndex.value = -1;
47
- if (relatedContext && typeof relatedContext.index === "number") {
48
- hoverToIndexGrid.value = relatedContext.index;
49
- }
50
- return false;
51
- }
52
- isTargetExternal.value = true;
53
- hoverToIndexGrid.value = -1;
54
- if (relatedContext) {
55
- const idx = typeof relatedContext.index === "number" ? relatedContext.index : Array.isArray(relatedContext.list) ? relatedContext.list.length : -1;
56
- externalTargetIndex.value = idx;
57
- externalTargetList.value = relatedContext.list || null;
58
- }
59
- return false;
60
- } catch (e) {
61
- return false;
62
- }
63
- }
64
- function onGridEnd(evt, column) {
65
- const from = dragFromIndexGrid.value;
66
- const list = activeListRef.value || column.list;
67
- if (!Array.isArray(list)) {
68
- resetGridState();
69
- return;
70
- }
71
- if (isTargetExternal.value && externalTargetList.value && Array.isArray(externalTargetList.value)) {
72
- if (from >= 0 && from < list.length) {
73
- const item = list.splice(from, 1)[0];
74
- const insertAt = Math.min(
75
- Math.max(externalTargetIndex.value, 0),
76
- externalTargetList.value.length
77
- );
78
- externalTargetList.value.splice(insertAt, 0, item);
79
- }
80
- resetGridState();
81
- return;
82
- }
83
- const rawTo = hoverToIndexGrid.value;
84
- resetGridState();
85
- if (from === -1 || rawTo === -1 || from === rawTo) return;
86
- if (from < 0 || from >= list.length) return;
87
- const moved = list.splice(from, 1)[0];
88
- let to = rawTo;
89
- if (from < rawTo) to = rawTo - 1;
90
- const safeTo = Math.min(Math.max(to, 0), list.length);
91
- list.splice(safeTo, 0, moved);
92
- }
93
- function resetGridState() {
94
- dragFromIndexGrid.value = -1;
95
- hoverToIndexGrid.value = -1;
96
- activeListRef.value = null;
97
- isTargetExternal.value = false;
98
- externalTargetList.value = null;
99
- externalTargetIndex.value = -1;
100
- }
101
- const getBackground = () => {
102
- if (isGradientColor(props.recordData.config.background)) {
103
- return "none";
104
- }
105
- return props.recordData.config.background;
106
- };
107
- function isGradientColor(color) {
108
- return /^(linear|radial)-gradient\(.*\)$/.test(color);
109
- }
110
- return (_ctx, _cache) => {
111
- const _component_a_col = resolveComponent("a-col");
112
- const _component_a_row = resolveComponent("a-row");
113
- return openBlock(), createElementBlock("div", {
114
- class: normalizeClass(["main-singleColumn", { active: currentUuid.value === props.record.uuid }]),
115
- style: normalizeStyle({ backgroundColor: getBackground() })
116
- }, [
117
- createVNode(_component_a_row, {
118
- gutter: [props.record.options.style.lrGutter, props.record.options.style.tbGutter]
119
- }, {
120
- default: withCtx(() => [
121
- (openBlock(true), createElementBlock(Fragment, null, renderList(props.record.columns, (item, index) => {
122
- return openBlock(), createBlock(_component_a_col, {
123
- key: index.toString(),
124
- flex: props.record.columns[index]?.flex,
125
- span: 24
126
- }, {
127
- default: withCtx(() => [
128
- createElementVNode("div", {
129
- class: normalizeClass(["box", { active: currentUuid.value === item.uuid }]),
130
- style: normalizeStyle({
131
- background: props.record.options.style?.background,
132
- borderColor: props.record.options.style?.borderColor,
133
- borderRadius: props.record.options.style?.borderRadius + "px",
134
- padding: props.record.options.style?.tbPadding + "px " + props.record.options.style?.lrPadding + "px",
135
- justifyContent: props.record.options.style?.alignItems || "start",
136
- minHeight: props.record.options.style?.minHeight + "px" || "48px",
137
- boxShadow: props.record.options.style?.boxShadow || null
138
- }),
139
- onClick: withModifiers(($event) => onConfig(item.uuid), ["stop"])
140
- }, [
141
- createVNode(unref(draggable), {
142
- list: item.list,
143
- group: "people",
144
- animation: 150,
145
- ghostClass: _ctx.moving,
146
- emptyInsertThreshold: 30,
147
- move: onGridMove,
148
- onStart: ($event) => onGridStart($event, item),
149
- onEnd: ($event) => onGridEnd($event, item),
150
- "item-key": "uuid"
151
- }, {
152
- item: withCtx(({ element, index: index2 }) => [
153
- createElementVNode("div", {
154
- onClick: withModifiers(($event) => onConfig(element.uuid), ["stop"]),
155
- class: normalizeClass({
156
- "swap-highlight": index2 === hoverToIndexGrid.value,
157
- "swap-highlight-bottom": hoverToIndexGrid.value === (activeListRef.value?.length || 0) && index2 === (activeListRef.value?.length || 1) - 1
158
- })
159
- }, [
160
- createVNode(FormItem, {
161
- record: element,
162
- recordData: props.recordData,
163
- columnsIndex: props.columnsIndex
164
- }, null, 8, ["record", "recordData", "columnsIndex"])
165
- ], 10, _hoisted_2)
166
- ]),
167
- _: 2
168
- }, 1032, ["list", "ghostClass", "onStart", "onEnd"])
169
- ], 14, _hoisted_1)
170
- ]),
171
- _: 2
172
- }, 1032, ["flex"]);
173
- }), 128))
174
- ]),
175
- _: 1
176
- }, 8, ["gutter"])
177
- ], 6);
178
- };
179
- }
180
- };
181
- const SingleColumn = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-bbe657ba"]]);
182
- export {
183
- SingleColumn as default
184
- };