@touchvue/plugin 1.0.0-beta.4 → 1.0.0-beta.6

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.mjs CHANGED
@@ -15236,75 +15236,88 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
15236
15236
  }
15237
15237
  }
15238
15238
  function syncThWidth() {
15239
- if (props.columns.length > 0) {
15239
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
15240
+ if (props.columns.length > 0 && bodyHead.value && bodyHead.value.row) {
15240
15241
  const trs = bodyHead.value.row.children;
15241
- if (Number(props.fixTop) > 0 && topHead.value) {
15242
+ if (Number(props.fixTop) > 0 && topHead.value && topHead.value.row) {
15242
15243
  const topTrs = topHead.value.row.children;
15243
15244
  for (let i = 0; i < topTrs.length; i++) {
15244
- const ths = trs[i].children;
15245
- const topThs = topTrs[i].children;
15246
- for (let j = 0; j < ths.length; j++) {
15247
- const th = ths[j];
15248
- const topTh = topThs[j];
15249
- topTh.style.width = th.getBoundingClientRect().width + "px";
15245
+ const ths = (_a2 = trs[i]) == null ? void 0 : _a2.children;
15246
+ const topThs = (_b = topTrs[i]) == null ? void 0 : _b.children;
15247
+ if (ths && topThs) {
15248
+ for (let j = 0; j < ths.length; j++) {
15249
+ const th = ths[j];
15250
+ const topTh = topThs[j];
15251
+ if (th && topTh) {
15252
+ topTh.style.width = th.getBoundingClientRect().width + "px";
15253
+ }
15254
+ }
15250
15255
  }
15251
15256
  }
15252
15257
  }
15253
- if (Number(props.fixLeft) > 0 && leftHead.value) {
15258
+ if (Number(props.fixLeft) > 0 && leftHead.value && leftHead.value.row) {
15254
15259
  const leftTrs = leftHead.value.row.children;
15255
15260
  for (let i = 0; i < leftTrs.length; i++) {
15256
- const ths = trs[i].children;
15257
- const leftThs = leftTrs[i].children;
15258
- if (leftThs.length > 0) {
15261
+ const ths = (_c = trs[i]) == null ? void 0 : _c.children;
15262
+ const leftThs = (_d = leftTrs[i]) == null ? void 0 : _d.children;
15263
+ if (ths && leftThs && leftThs.length > 0) {
15259
15264
  for (let j = 0; j < leftThs.length; j++) {
15260
15265
  const th = ths[j];
15261
15266
  const leftTh = leftThs[j];
15262
- leftTh.style.width = th.getBoundingClientRect().width + "px";
15263
- leftTh.style.height = th.getBoundingClientRect().height + "px";
15267
+ if (th && leftTh) {
15268
+ leftTh.style.width = th.getBoundingClientRect().width + "px";
15269
+ leftTh.style.height = th.getBoundingClientRect().height + "px";
15270
+ }
15264
15271
  }
15265
15272
  }
15266
15273
  }
15267
- if (Number(props.fixTop) > 0 && leftTopHead.value) {
15268
- const leftTopTrs = leftTopHead.value.$refs.row.children;
15274
+ if (Number(props.fixTop) > 0 && leftTopHead.value && leftTopHead.value.row) {
15275
+ const leftTopTrs = leftTopHead.value.row.children;
15269
15276
  for (let i = 0; i < leftTopTrs.length; i++) {
15270
- const ths = trs[i].children;
15271
- const leftTopThs = leftTopTrs[i].children;
15272
- if (leftTopThs.length > 0) {
15273
- for (let i2 = 0; i2 < leftTopThs.length; i2++) {
15274
- const th = ths[i2];
15275
- const leftTopTh = leftTopThs[i2];
15276
- leftTopTh.style.width = th.getBoundingClientRect().width + "px";
15277
- leftTopTh.style.height = th.getBoundingClientRect().height + "px";
15277
+ const ths = (_e = trs[i]) == null ? void 0 : _e.children;
15278
+ const leftTopThs = (_f = leftTopTrs[i]) == null ? void 0 : _f.children;
15279
+ if (ths && leftTopThs && leftTopThs.length > 0) {
15280
+ for (let j = 0; j < leftTopThs.length; j++) {
15281
+ const th = ths[j];
15282
+ const leftTopTh = leftTopThs[j];
15283
+ if (th && leftTopTh) {
15284
+ leftTopTh.style.width = th.getBoundingClientRect().width + "px";
15285
+ leftTopTh.style.height = th.getBoundingClientRect().height + "px";
15286
+ }
15278
15287
  }
15279
15288
  }
15280
15289
  }
15281
15290
  }
15282
15291
  }
15283
- if (Number(props.fixRight) > 0 && rightHead.value) {
15292
+ if (Number(props.fixRight) > 0 && rightHead.value && rightHead.value.row) {
15284
15293
  const rightTrs = rightHead.value.row.children;
15285
15294
  for (let i = 0; i < rightTrs.length; i++) {
15286
- const ths = trs[i].children;
15287
- const rightThs = rightTrs[i].children;
15288
- if (rightThs.length > 0) {
15295
+ const ths = (_g = trs[i]) == null ? void 0 : _g.children;
15296
+ const rightThs = (_h = rightTrs[i]) == null ? void 0 : _h.children;
15297
+ if (ths && rightThs && rightThs.length > 0) {
15289
15298
  for (let j = ths.length - rightThs.length; j < ths.length; j++) {
15290
15299
  const th = ths[j];
15291
15300
  const rightTh = rightThs[j - ths.length + rightThs.length];
15292
- rightTh.style.width = th.getBoundingClientRect().width + "px";
15293
- rightTh.style.height = th.getBoundingClientRect().height + "px";
15301
+ if (th && rightTh) {
15302
+ rightTh.style.width = th.getBoundingClientRect().width + "px";
15303
+ rightTh.style.height = th.getBoundingClientRect().height + "px";
15304
+ }
15294
15305
  }
15295
15306
  }
15296
15307
  }
15297
- if (Number(props.fixTop) > 0 && rightTopHead.value) {
15308
+ if (Number(props.fixTop) > 0 && rightTopHead.value && rightTopHead.value.row) {
15298
15309
  const rightTopTrs = rightTopHead.value.row.children;
15299
15310
  for (let i = 0; i < rightTopTrs.length; i++) {
15300
- const ths = trs[i].children;
15301
- const rightTopThs = rightTopTrs[i].children;
15302
- if (rightTopThs.length > 0) {
15303
- for (let i2 = ths.length - rightTopThs.length; i2 < ths.length; i2++) {
15304
- const th = ths[i2];
15305
- const rightTopTh = rightTopThs[i2 - ths.length + rightTopThs.length];
15306
- rightTopTh.style.width = th.getBoundingClientRect().width + "px";
15307
- rightTopTh.style.height = th.getBoundingClientRect().height + "px";
15311
+ const ths = (_i = trs[i]) == null ? void 0 : _i.children;
15312
+ const rightTopThs = (_j = rightTopTrs[i]) == null ? void 0 : _j.children;
15313
+ if (ths && rightTopThs && rightTopThs.length > 0) {
15314
+ for (let j = ths.length - rightTopThs.length; j < ths.length; j++) {
15315
+ const th = ths[j];
15316
+ const rightTopTh = rightTopThs[j - ths.length + rightTopThs.length];
15317
+ if (th && rightTopTh) {
15318
+ rightTopTh.style.width = th.getBoundingClientRect().width + "px";
15319
+ rightTopTh.style.height = th.getBoundingClientRect().height + "px";
15320
+ }
15308
15321
  }
15309
15322
  }
15310
15323
  }
@@ -19496,7 +19509,7 @@ const _sfc_main$q = defineComponent({
19496
19509
  // 类型:normal 或 loading
19497
19510
  type: {
19498
19511
  type: String,
19499
- default: "",
19512
+ default: "normal",
19500
19513
  validator: (val) => ["normal", "loading", "circle"].includes(val)
19501
19514
  },
19502
19515
  // 进度条百分比,0~100的数字
@@ -19678,12 +19691,8 @@ const _sfc_main$q = defineComponent({
19678
19691
  const el = document.querySelector(".to-progress");
19679
19692
  if (el) {
19680
19693
  if (props.type === "circle") {
19681
- const circleBgTick = parseFloat(
19682
- getComputedStyle(elRef.value).getPropertyValue("--thick")
19683
- );
19684
- const circleBarTick = parseFloat(
19685
- getComputedStyle(elRef.value).getPropertyValue("--bar-thick")
19686
- );
19694
+ const circleBgTick = parseFloat(getComputedStyle(elRef.value).getPropertyValue("--thick"));
19695
+ const circleBarTick = parseFloat(getComputedStyle(elRef.value).getPropertyValue("--bar-thick"));
19687
19696
  const width = parseFloat(getComputedStyle(elRef.value).getPropertyValue("--width"));
19688
19697
  thick.value = circleBgTick / width * 100;
19689
19698
  barThick.value = circleBarTick / width * 100;
@@ -25341,7 +25350,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
25341
25350
  endAngle: { type: [String, Number], default: -270 },
25342
25351
  value: { type: [String, Number], default: "" },
25343
25352
  label: { type: [String, Number], default: "" },
25344
- gap: { type: [String, Number], default: 0 }
25353
+ gap: { type: [String, Number], default: 0 },
25354
+ emphasisScale: { type: Boolean, default: false },
25355
+ emphasisScaleSize: { type: [String, Number], default: 5 },
25356
+ backgroundSizePercentage: { type: [Number, String], default: 100 },
25357
+ // 默认为 100%
25358
+ backgroundPosition: { type: String, default: "center" }
25345
25359
  },
25346
25360
  emits: {
25347
25361
  "item-click": (_) => true
@@ -25417,15 +25431,37 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
25417
25431
  });
25418
25432
  const isRing = computed(() => Number(props.barSize) < Number(props.size) / 2);
25419
25433
  const chartRadius = computed(() => {
25420
- const outerRatio = 1 - Number(props.borderWidth) / Number(props.size);
25434
+ let outerRatio = 1 - Number(props.borderWidth) / Number(props.size);
25435
+ if (props.emphasisScale) {
25436
+ const scaleAdjustment = props.emphasisScaleSize / (Number(props.size) * 4);
25437
+ outerRatio = Math.max(0, outerRatio - scaleAdjustment);
25438
+ }
25421
25439
  const outer = String(Number(outerRatio.toFixed(2)) * 100 + "%");
25422
25440
  if (isRing.value) {
25423
- const innerRatio = 1 - (2 * Number(props.borderWidth) + 2 * Number(props.barSize)) / Number(props.size);
25441
+ let innerRatio = 1 - (2 * Number(props.borderWidth) + 2 * Number(props.barSize)) / Number(props.size);
25442
+ if (props.emphasisScale) {
25443
+ const scaleAdjustment = props.emphasisScaleSize / (Number(props.size) * 4);
25444
+ innerRatio = Math.max(0, innerRatio + scaleAdjustment);
25445
+ }
25424
25446
  const inner = String(Number(innerRatio.toFixed(2)) * 100 + "%");
25425
25447
  return [inner, outer];
25426
25448
  }
25427
25449
  return ["0%", outer];
25428
25450
  });
25451
+ const backgroundStyle = computed(() => {
25452
+ const percentage = Number(props.backgroundSizePercentage);
25453
+ return {
25454
+ backgroundSize: `${percentage}% ${percentage}%`,
25455
+ backgroundPosition: props.backgroundPosition,
25456
+ backgroundRepeat: "no-repeat",
25457
+ // 使用 transform 来居中背景,当背景不是 100% 时保持居中
25458
+ transform: percentage !== 100 ? "translate(-50%, -50%)" : "none",
25459
+ left: percentage !== 100 ? "50%" : "0",
25460
+ top: percentage !== 100 ? "50%" : "0",
25461
+ width: percentage !== 100 ? `${percentage}%` : "100%",
25462
+ height: percentage !== 100 ? `${percentage}%` : "100%"
25463
+ };
25464
+ });
25429
25465
  const processedColors = computed(() => {
25430
25466
  const color = props.color;
25431
25467
  if (isArray(color)) {
@@ -25536,7 +25572,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
25536
25572
  length: 15,
25537
25573
  length2: 15
25538
25574
  },
25539
- emphasis: { scale: false }
25575
+ emphasis: { scale: props.emphasisScale, scaleSize: props.emphasisScaleSize }
25540
25576
  }
25541
25577
  ]
25542
25578
  };
@@ -25623,13 +25659,20 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
25623
25659
  class: "to-echarts-pie-pic-content",
25624
25660
  style: normalizeStyle(setContentStyle.value)
25625
25661
  }, null, 4),
25626
- unref(slots).title ? (openBlock(), createElementBlock("div", {
25662
+ unref(slots).background ? (openBlock(), createElementBlock("div", {
25627
25663
  key: 0,
25664
+ class: "to-echarts-pie-background",
25665
+ style: normalizeStyle(backgroundStyle.value)
25666
+ }, [
25667
+ renderSlot(_ctx.$slots, "background")
25668
+ ], 4)) : createCommentVNode("", true),
25669
+ unref(slots).title ? (openBlock(), createElementBlock("div", {
25670
+ key: 1,
25628
25671
  class: "to-echarts-pie-pic-text"
25629
25672
  }, [
25630
25673
  renderSlot(_ctx.$slots, "title")
25631
25674
  ])) : __props.label || __props.value ? withDirectives((openBlock(), createElementBlock("div", {
25632
- key: 1,
25675
+ key: 2,
25633
25676
  class: "to-echarts-pie-pic-text"
25634
25677
  }, [
25635
25678
  __props.value ? (openBlock(), createElementBlock("div", {
@@ -25689,6 +25732,10 @@ const echartsBarProps = {
25689
25732
  type: Boolean,
25690
25733
  default: false
25691
25734
  },
25735
+ d3dShape: {
25736
+ type: String,
25737
+ default: "cube"
25738
+ },
25692
25739
  isHorizontal: {
25693
25740
  type: Boolean,
25694
25741
  default: false
@@ -25761,6 +25808,38 @@ const echartsBarProps = {
25761
25808
  tipFontSize: {
25762
25809
  type: [String, Number],
25763
25810
  default: 1
25811
+ },
25812
+ smooth: {
25813
+ type: [Boolean, Number],
25814
+ default: false
25815
+ },
25816
+ interval: {
25817
+ type: Number,
25818
+ default: 0
25819
+ },
25820
+ tooltipType: {
25821
+ type: String,
25822
+ default: "shadow"
25823
+ },
25824
+ tooltipTextColor: {
25825
+ type: String,
25826
+ default: "#666"
25827
+ },
25828
+ tooltipBgColor: {
25829
+ type: String,
25830
+ default: "#fff"
25831
+ },
25832
+ tooltipBorderColor: {
25833
+ type: String,
25834
+ default: "#333"
25835
+ },
25836
+ showDefaultToolTip: {
25837
+ type: Boolean,
25838
+ default: false
25839
+ },
25840
+ mode: {
25841
+ type: String,
25842
+ default: "default"
25764
25843
  }
25765
25844
  };
25766
25845
  const echartsBarEmits = {
@@ -25824,7 +25903,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
25824
25903
  type: "category",
25825
25904
  data: isMultiSeries.value ? props.xAxisData : props.data.map((item) => item.name),
25826
25905
  axisLabel: {
25827
- interval: 0,
25906
+ interval: props.interval,
25828
25907
  rotate: props.rotate,
25829
25908
  fontSize: Number(props.fontSize) * currentEm.value,
25830
25909
  color: props.isHorizontal ? props.yAxisStyle.textColor : props.xAxisStyle.textColor
@@ -25973,9 +26052,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
25973
26052
  barGap: "-100%",
25974
26053
  z: 1,
25975
26054
  silent: true,
25976
- animation: false
26055
+ animation: false,
26056
+ smooth: item.smooth || props.smooth
25977
26057
  });
25978
26058
  }
26059
+ let { lineStyle, areaStyle } = getCssConfig(item, i);
25979
26060
  series.push({
25980
26061
  name: item.name,
25981
26062
  type: item.type ? item.type : props.chartsType,
@@ -25983,19 +26064,16 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
25983
26064
  barWidth: Number(props.barSize) * currentEm.value,
25984
26065
  itemStyle: {
25985
26066
  borderRadius: Number(props.borderRadius) * currentEm.value,
25986
- color: isArray(props.color) ? new echartsLib.graphic.LinearGradient(...props.isHorizontal ? [0, 0, 1, 0] : [0, 0, 0, 1], [
25987
- {
25988
- offset: 0,
25989
- color: props.color[i].start
25990
- },
25991
- {
25992
- offset: 1,
25993
- color: props.color[i].end
25994
- }
25995
- ]) : props.color
26067
+ color: lineStyle[2]
25996
26068
  },
26069
+ lineStyle: {
26070
+ type: lineStyle[1],
26071
+ width: lineStyle[0]
26072
+ },
26073
+ areaStyle: areaStyle ? areaStyle : null,
25997
26074
  label: getSeriesLabelConfig(),
25998
- z: 2
26075
+ z: 2,
26076
+ smooth: item.smooth || props.smooth
25999
26077
  });
26000
26078
  });
26001
26079
  } else {
@@ -26034,7 +26112,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
26034
26112
  barGap: "-100%",
26035
26113
  z: 1,
26036
26114
  silent: true,
26037
- animation: false
26115
+ animation: false,
26116
+ smooth: props.smooth
26038
26117
  });
26039
26118
  }
26040
26119
  series.push({
@@ -26043,7 +26122,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
26043
26122
  barWidth: Number(props.barSize) * currentEm.value,
26044
26123
  itemStyle: getItemStyle(),
26045
26124
  label: getSeriesLabelConfig(),
26046
- z: 2
26125
+ z: 2,
26126
+ smooth: props.smooth
26047
26127
  });
26048
26128
  }
26049
26129
  return series;
@@ -26051,25 +26131,152 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
26051
26131
  return get3dSeriesConfig();
26052
26132
  }
26053
26133
  });
26134
+ const getCssConfig = (item, i) => {
26135
+ let box = document.createElement("div");
26136
+ box.className = `to-echarts-bar-item mode-${item.mode}`;
26137
+ box.style.display = "none";
26138
+ chartContainer.value.appendChild(box);
26139
+ let lineStr = getComputedStyle(box).getPropertyValue("--line").trim();
26140
+ let lineStyle = null;
26141
+ if (lineStr) {
26142
+ let lineArr = lineStr.split(" ", 2);
26143
+ let length = lineStr.split(" ").length;
26144
+ if (length > 3) {
26145
+ const thirdPart = lineStr.substring(lineArr.join(" ").length + 1);
26146
+ const result = [...lineArr, thirdPart];
26147
+ lineStyle = [unitToNumber(result[0]), result[1], parseColorStops(result[2])];
26148
+ } else {
26149
+ const result = lineStr.split(" ");
26150
+ lineStyle = [unitToNumber(result[0]), result[1], result[2]];
26151
+ }
26152
+ } else {
26153
+ lineStyle = [2, "solid", props.color[i]];
26154
+ }
26155
+ let areaStr = getComputedStyle(box).getPropertyValue("--area").trim();
26156
+ let areaStyle = null;
26157
+ if (areaStr) {
26158
+ if (areaStr.includes("linear-gradient")) {
26159
+ areaStyle = {
26160
+ color: parseColorStops(areaStr)
26161
+ };
26162
+ } else {
26163
+ areaStyle = {
26164
+ color: areaStr
26165
+ };
26166
+ }
26167
+ }
26168
+ return {
26169
+ lineStyle,
26170
+ areaStyle
26171
+ };
26172
+ };
26173
+ const parseColorStops = (str) => {
26174
+ const reg = /\((.*?)\)/;
26175
+ const match = str.match(reg);
26176
+ let obj = {};
26177
+ if (match) {
26178
+ let arr = match[1].split(",");
26179
+ let fx = arr[0];
26180
+ let color = arr.splice(1);
26181
+ let colorStops = color.map((item) => {
26182
+ let k = item.trim().split(" ");
26183
+ return {
26184
+ offset: percentToDecimal(k[1]),
26185
+ color: k[0]
26186
+ };
26187
+ });
26188
+ if (fx.includes("right")) {
26189
+ obj = {
26190
+ type: "linear",
26191
+ x: 0,
26192
+ y: 0,
26193
+ x2: 1,
26194
+ y2: 0,
26195
+ colorStops
26196
+ };
26197
+ } else {
26198
+ obj = {
26199
+ type: "linear",
26200
+ x: 0,
26201
+ y: 0,
26202
+ x2: 0,
26203
+ y2: 1,
26204
+ colorStops
26205
+ };
26206
+ }
26207
+ }
26208
+ return obj;
26209
+ };
26210
+ function percentToDecimal(percent, clamp = true) {
26211
+ if (percent === null || percent === void 0 || percent === "") {
26212
+ return 0;
26213
+ }
26214
+ let str = String(percent).trim().replace(/%/g, "");
26215
+ let num = parseFloat(str);
26216
+ if (isNaN(num) || !isFinite(num)) {
26217
+ return 0;
26218
+ }
26219
+ let decimal = num / 100;
26220
+ if (clamp) {
26221
+ decimal = Math.max(0, Math.min(1, decimal));
26222
+ }
26223
+ return decimal;
26224
+ }
26225
+ function unitToNumber(size, clampPositive = true) {
26226
+ if (size === null || size === void 0 || size === "") {
26227
+ return 0;
26228
+ }
26229
+ if (typeof size === "number" && isFinite(size)) {
26230
+ const num2 = clampPositive ? Math.max(0, size) : size;
26231
+ return num2;
26232
+ }
26233
+ const str = String(size).trim();
26234
+ const numMatch = str.match(/^-?\d+(\.\d+)?/);
26235
+ let num = numMatch ? parseFloat(numMatch[0]) : 0;
26236
+ if (isNaN(num) || !isFinite(num)) {
26237
+ return 0;
26238
+ }
26239
+ if (clampPositive) {
26240
+ num = Math.max(0, num);
26241
+ }
26242
+ return num;
26243
+ }
26054
26244
  const tooltipConfig = computed(() => {
26055
26245
  if (!props.showTooltip) {
26056
26246
  return { show: false };
26057
26247
  }
26248
+ if (props.showDefaultToolTip) {
26249
+ return {
26250
+ show: true,
26251
+ trigger: "axis",
26252
+ axisPointer: {
26253
+ type: props.tooltipType
26254
+ },
26255
+ appendTo: typeof document !== "undefined" ? document.body : void 0,
26256
+ className: "to-echarts-tooltip",
26257
+ borderColor: props.tooltipBorderColor,
26258
+ backgroundColor: props.tooltipBgColor,
26259
+ textStyle: {
26260
+ fontSize: Number(props.fontSize) * currentEm.value,
26261
+ color: props.tooltipTextColor
26262
+ }
26263
+ };
26264
+ }
26058
26265
  return {
26059
26266
  show: true,
26060
26267
  trigger: "axis",
26061
26268
  axisPointer: {
26062
- type: "shadow"
26269
+ type: props.tooltipType
26063
26270
  },
26271
+ borderColor: props.tooltipBorderColor,
26064
26272
  appendTo: typeof document !== "undefined" ? document.body : void 0,
26065
26273
  className: "to-echarts-tooltip",
26066
26274
  confine: false,
26067
- extraCssText: slots.tip ? "padding: 0; background: transparent; border: none; box-shadow: none; font-size:" + Number(props.tipFontSize) * getEmPx() + "px" : "background: #fff; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); padding: 10px; border-radius: 4px; font-size:" + Number(props.tipFontSize) * getEmPx() + "px",
26275
+ extraCssText: slots.tip ? "padding: 0; background: transparent; border: none; box-shadow: none; font-size:" + Number(props.tipFontSize) * getEmPx() + "px" : `background: ${props.tooltipBgColor}; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); padding: 10px; border-radius: 4px; font-size:` + Number(props.tipFontSize) * getEmPx() + "px",
26068
26276
  textStyle: {
26069
26277
  fontSize: Number(props.fontSize) * currentEm.value,
26070
- color: "#666"
26278
+ color: props.tooltipTextColor
26071
26279
  },
26072
- backgroundColor: "#fff",
26073
26280
  formatter: (params) => {
26074
26281
  const param = isArray(params) ? params.find((p) => p.value !== void 0) : params;
26075
26282
  if (!param)
@@ -26409,12 +26616,107 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
26409
26616
  });
26410
26617
  return series;
26411
26618
  };
26619
+ const getVerticalCylinder3dSeries = () => {
26620
+ if (!echartsLib)
26621
+ return [];
26622
+ const values = props.data.map((item) => item.value);
26623
+ const barWidth = Number(props.barSize) * currentEm.value * 1.25;
26624
+ const rx = barWidth / 2;
26625
+ const ry = Math.max(2, barWidth * 0.28);
26626
+ return [
26627
+ {
26628
+ type: "custom",
26629
+ renderItem: (params, api) => {
26630
+ const value = api.value(1);
26631
+ const coord = api.coord([api.value(0), value]);
26632
+ const x = coord[0];
26633
+ const yTop = coord[1];
26634
+ const yBottom = api.coord([api.value(0), 0])[1];
26635
+ const height = Math.abs(yBottom - yTop);
26636
+ const color = getItemStyle().color;
26637
+ const colorStops = typeof color === "object" && color.colorStops ? color.colorStops : [
26638
+ { offset: 0, color: "#4facfe" },
26639
+ { offset: 1, color: "#00f2fe" }
26640
+ ];
26641
+ const topMainColor = colorStops[0].color;
26642
+ const bottomMainColor = colorStops[colorStops.length - 1].color;
26643
+ const children = [];
26644
+ children.push({
26645
+ type: "rect",
26646
+ shape: { x: x - rx, y: yTop, width: rx * 2, height },
26647
+ style: { fill: new echartsLib.graphic.LinearGradient(0, 0, 0, 1, colorStops), opacity: 0.9 },
26648
+ z: 2
26649
+ });
26650
+ children.push({
26651
+ type: "rect",
26652
+ shape: { x: x - rx * 0.72, y: yTop, width: rx * 0.38, height },
26653
+ style: {
26654
+ fill: new echartsLib.graphic.LinearGradient(0, 0, 1, 0, [
26655
+ { offset: 0, color: "rgba(140,200,255,0.32)" },
26656
+ { offset: 1, color: "rgba(140,200,255,0.04)" }
26657
+ ])
26658
+ },
26659
+ z: 3
26660
+ });
26661
+ children.push({
26662
+ type: "ellipse",
26663
+ shape: { cx: x, cy: yTop, rx, ry },
26664
+ style: {
26665
+ fill: new echartsLib.graphic.RadialGradient(0.5, 0.42, 0.82, [
26666
+ { offset: 0, color: adjustSingleColor(topMainColor, 0.35) },
26667
+ { offset: 0.32, color: adjustSingleColor(topMainColor, 0.08) },
26668
+ { offset: 0.72, color: topMainColor },
26669
+ { offset: 1, color: adjustSingleColor(bottomMainColor, -0.22) }
26670
+ ]),
26671
+ lineWidth: 1,
26672
+ stroke: "rgba(170,200,255,0.55)"
26673
+ },
26674
+ z: 5
26675
+ });
26676
+ children.push({
26677
+ type: "ellipse",
26678
+ shape: { cx: x, cy: yBottom - ry * 0.15, rx: rx * 1.02, ry: ry * 1.05 },
26679
+ style: {
26680
+ fill: adjustSingleColor(bottomMainColor, 0.05),
26681
+ opacity: 0.9,
26682
+ lineWidth: 1,
26683
+ stroke: adjustSingleColor(bottomMainColor, 0.15)
26684
+ },
26685
+ z: 6
26686
+ });
26687
+ if (props.showValue) {
26688
+ children.push({
26689
+ type: "text",
26690
+ style: {
26691
+ text: String(value),
26692
+ textAlign: "center",
26693
+ textVerticalAlign: "bottom",
26694
+ fontSize: Number(props.fontSize) * currentEm.value,
26695
+ fill: "#fff",
26696
+ fontWeight: "bold",
26697
+ x,
26698
+ y: yTop - ry - 8,
26699
+ textShadowBlur: 4,
26700
+ textShadowColor: "rgba(0,0,0,0.5)"
26701
+ },
26702
+ z: 6
26703
+ });
26704
+ }
26705
+ return { type: "group", children };
26706
+ },
26707
+ data: values.map((val, index) => [index, val]),
26708
+ z: 1
26709
+ }
26710
+ ];
26711
+ };
26412
26712
  const get3dSeriesConfig = () => {
26413
26713
  if (props.isHorizontal) {
26414
26714
  return getHorizontal3dSeries();
26415
- } else {
26416
- return getVertical3dSeries();
26417
26715
  }
26716
+ if (props.d3dShape === "cylinder") {
26717
+ return getVerticalCylinder3dSeries();
26718
+ }
26719
+ return getVertical3dSeries();
26418
26720
  };
26419
26721
  const initChart = (retry = 0) => {
26420
26722
  window.setTimeout(async () => {
@@ -26533,18 +26835,25 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
26533
26835
  resizeObserver = null;
26534
26836
  }
26535
26837
  });
26838
+ const setClass = computed(() => {
26839
+ let arr = [];
26840
+ if (props.mode) {
26841
+ arr.push(`mode-${props.mode}`);
26842
+ }
26843
+ return arr;
26844
+ });
26536
26845
  return (_ctx, _cache) => {
26537
26846
  return openBlock(), createElementBlock("div", {
26538
26847
  ref_key: "chartContainer",
26539
26848
  ref: chartContainer,
26540
- class: "to-echarts-bar",
26849
+ class: normalizeClass(["to-echarts-bar", setClass.value]),
26541
26850
  style: normalizeStyle(setBarStyle.value)
26542
- }, null, 4);
26851
+ }, null, 6);
26543
26852
  };
26544
26853
  }
26545
26854
  });
26546
- const echartsBar_vue_vue_type_style_index_0_scoped_18b48726_lang = "";
26547
- const EchartsBar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-18b48726"]]);
26855
+ const echartsBar_vue_vue_type_style_index_0_scoped_c70ba125_lang = "";
26856
+ const EchartsBar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-c70ba125"]]);
26548
26857
  const ToEchartsBar = withInstall(EchartsBar);
26549
26858
  const DEFAULT_VIEW_CONTROL = {
26550
26859
  zoomSensitivity: 0,
@@ -26553,6 +26862,26 @@ const DEFAULT_VIEW_CONTROL = {
26553
26862
  distance: 100
26554
26863
  };
26555
26864
  const echartsMapProps = {
26865
+ nameMap: {
26866
+ type: Object,
26867
+ default: () => ({})
26868
+ },
26869
+ rotate: {
26870
+ type: [String, Number],
26871
+ default: 0
26872
+ },
26873
+ scaleX: {
26874
+ type: [String, Number],
26875
+ default: 1
26876
+ },
26877
+ scaleY: {
26878
+ type: [String, Number],
26879
+ default: 1
26880
+ },
26881
+ aspectRatio: {
26882
+ type: [String, Number],
26883
+ default: ""
26884
+ },
26556
26885
  shadow: {
26557
26886
  type: String,
26558
26887
  default: ""
@@ -28899,6 +29228,7 @@ const cityData = [
28899
29228
  city: "90"
28900
29229
  }
28901
29230
  ];
29231
+ const OUTLINE_BASE_URL = "https://geo.datav.aliyun.com/areas_v3/bound/";
28902
29232
  const _sfc_main = /* @__PURE__ */ defineComponent({
28903
29233
  ...{
28904
29234
  name: "ToEchartsMap"
@@ -29001,6 +29331,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
29001
29331
  if (props.width) {
29002
29332
  style.width = formatSize(props.width);
29003
29333
  }
29334
+ let finalScaleX = Number(props.scaleX) || 1;
29335
+ let finalScaleY = Number(props.scaleY) || 1;
29336
+ if (props.aspectRatio) {
29337
+ const targetRatio = Number(props.aspectRatio);
29338
+ if (targetRatio > 0) {
29339
+ const currentRatio = finalScaleX / finalScaleY;
29340
+ if (currentRatio < targetRatio) {
29341
+ finalScaleX = finalScaleY * targetRatio;
29342
+ } else {
29343
+ finalScaleY = finalScaleX / targetRatio;
29344
+ }
29345
+ }
29346
+ }
29347
+ const rotate = Number(props.rotate) || 0;
29348
+ style.transform = `rotate(${rotate}deg) scaleX(${finalScaleX}) scaleY(${finalScaleY})`;
29349
+ style.transformOrigin = "center center";
29004
29350
  return style;
29005
29351
  });
29006
29352
  const loadEcharts = async () => {
@@ -29154,7 +29500,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
29154
29500
  value: item.properties,
29155
29501
  name: item.properties.name
29156
29502
  }))) != null ? _b : [];
29157
- await setMapOptions(geoName, mapData);
29503
+ await setMapOptions(geoName, code, mapData);
29158
29504
  } catch (error) {
29159
29505
  console.error("[ToEchartsMap] 获取地图数据失败", error);
29160
29506
  }
@@ -29183,12 +29529,54 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
29183
29529
  const max2 = values.length ? Math.max(...values) : 0;
29184
29530
  return { min, max: max2 };
29185
29531
  };
29186
- const setMapOptions = async (geoName, mapData) => {
29532
+ const outlineCache = /* @__PURE__ */ new Map();
29533
+ const loadOutlineGeoJson = async (code) => {
29534
+ if (!props.showOutline)
29535
+ return null;
29536
+ if (typeof fetch === "undefined")
29537
+ return null;
29538
+ if (!code)
29539
+ return null;
29540
+ if (outlineCache.has(code))
29541
+ return outlineCache.get(code);
29542
+ try {
29543
+ const res = await fetch(`${OUTLINE_BASE_URL}${code}.json`);
29544
+ if (!res.ok)
29545
+ throw new Error(`Request failed: ${res.status}`);
29546
+ const json = await res.json();
29547
+ outlineCache.set(code, json);
29548
+ return json;
29549
+ } catch (e) {
29550
+ console.warn("[ToEchartsMap] 获取外轮廓数据失败", code, e);
29551
+ outlineCache.set(code, null);
29552
+ return null;
29553
+ }
29554
+ };
29555
+ const setMapOptions = async (geoName, code, mapData) => {
29187
29556
  if (!chart.value)
29188
29557
  return;
29189
29558
  await ensureEchartsGl();
29559
+ let outlineMapName = null;
29560
+ if (props.showOutline && echartsLib) {
29561
+ const outlineJson = await loadOutlineGeoJson(code);
29562
+ if (outlineJson) {
29563
+ outlineMapName = `${geoName}__outline`;
29564
+ try {
29565
+ echartsLib.registerMap(outlineMapName, outlineJson);
29566
+ } catch (e) {
29567
+ console.warn("[ToEchartsMap] 外轮廓 registerMap 失败", e);
29568
+ }
29569
+ }
29570
+ }
29190
29571
  isMapData.value = mapData.length > 0;
29191
- const option = getOption(geoName, mapData);
29572
+ const option = getOption(geoName, code, mapData);
29573
+ if (props.showOutline && !outlineMapName && Array.isArray(option.geo)) {
29574
+ for (const g of option.geo) {
29575
+ if (g && typeof g.map === "string" && g.map === `${geoName}__outline`) {
29576
+ g.map = geoName;
29577
+ }
29578
+ }
29579
+ }
29192
29580
  chart.value.setOption(option, true);
29193
29581
  if (props.autoplay && props.data.length) {
29194
29582
  mapActive(props.data);
@@ -29222,7 +29610,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
29222
29610
  show: true,
29223
29611
  color: props.fontColor,
29224
29612
  fontSize: Number(props.fontSize) * currentEm.value,
29225
- formatter: (e) => ` ${e.name} `
29613
+ formatter: (e) => {
29614
+ var _a3, _b;
29615
+ return ` ${(_b = (_a3 = props.nameMap) == null ? void 0 : _a3[e.name]) != null ? _b : e.name} `;
29616
+ }
29226
29617
  },
29227
29618
  itemStyle: {
29228
29619
  color: props.color || "#65bbff",
@@ -29261,7 +29652,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
29261
29652
  show: true,
29262
29653
  color: props.fontColor,
29263
29654
  fontSize: Number(props.fontSize) * currentEm.value,
29264
- formatter: (e) => ` ${e.name} `
29655
+ formatter: (e) => {
29656
+ var _a3, _b;
29657
+ return ` ${(_b = (_a3 = props.nameMap) == null ? void 0 : _a3[e.name]) != null ? _b : e.name} `;
29658
+ }
29265
29659
  },
29266
29660
  itemStyle: {
29267
29661
  shadowBlur: itemShadowParts[0] ? Number(itemShadowParts[0]) * currentEm.value : 0,
@@ -29296,35 +29690,76 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
29296
29690
  }
29297
29691
  };
29298
29692
  };
29299
- const getOption = (geoName, mapData) => {
29693
+ const getOption = (geoName, code, mapData) => {
29694
+ var _a2;
29300
29695
  const baseSeries = getBaseSeries(geoName, mapData);
29301
29696
  const shadowParts = parseShadow(props.shadow);
29302
29697
  const { min, max: max2 } = getMinMax(mapData);
29303
- return {
29304
- tooltip: {
29305
- trigger: "item",
29306
- formatter: (params) => {
29307
- if (!params.value)
29308
- return "";
29309
- return renderTooltip(params);
29310
- }
29311
- },
29312
- geo: {
29698
+ const geoLayers = [];
29699
+ if (props.shadow) {
29700
+ const shadowOffset = shadowParts[0] ? Number(shadowParts[0]) * currentEm.value : currentEm.value;
29701
+ const shadowColor = (_a2 = shadowParts[1]) != null ? _a2 : "rgba(0,0,0,0.3)";
29702
+ const shadow2Color = shadowParts[2];
29703
+ if (shadow2Color) {
29704
+ geoLayers.push({
29705
+ z: 1,
29706
+ show: true,
29707
+ map: geoName,
29708
+ roam: false,
29709
+ top: shadowOffset * 2,
29710
+ bottom: -shadowOffset,
29711
+ silent: true,
29712
+ itemStyle: {
29713
+ areaColor: shadow2Color,
29714
+ borderColor: "transparent"
29715
+ }
29716
+ });
29717
+ }
29718
+ geoLayers.push({
29719
+ z: 2,
29313
29720
  show: true,
29314
29721
  map: geoName,
29315
29722
  roam: false,
29723
+ top: shadowOffset,
29724
+ bottom: 0,
29725
+ silent: true,
29726
+ itemStyle: {
29727
+ areaColor: shadowColor,
29728
+ borderColor: "transparent"
29729
+ }
29730
+ });
29731
+ }
29732
+ if (props.showOutline) {
29733
+ const shadowOffset = shadowParts[0] ? Number(shadowParts[0]) * currentEm.value : currentEm.value;
29734
+ const outlineMapName = `${geoName}__outline`;
29735
+ geoLayers.push({
29736
+ z: 4,
29737
+ // 高于 map series (z:3)
29738
+ map: outlineMapName,
29739
+ roam: false,
29316
29740
  top: 0,
29317
- bottom: props.shadow ? shadowParts[0] ? Number(shadowParts[0]) * currentEm.value : currentEm.value : 0,
29741
+ bottom: props.shadow ? shadowOffset : 0,
29742
+ silent: true,
29318
29743
  itemStyle: {
29319
29744
  areaColor: "transparent",
29320
- borderColor: props.showOutline ? props.outlineColor : "transparent",
29321
- borderWidth: props.showOutline ? Number(props.outlineWidth) : 0,
29322
- // 避免粗描边在尖锐拐角处产生 miter 尖刺
29745
+ borderColor: props.outlineColor,
29746
+ borderWidth: Number(props.outlineWidth),
29323
29747
  borderJoin: "round",
29324
29748
  borderMiterLimit: 2
29325
- },
29326
- silent: true
29749
+ }
29750
+ });
29751
+ }
29752
+ baseSeries.z = 3;
29753
+ return {
29754
+ tooltip: {
29755
+ trigger: "item",
29756
+ formatter: (params) => {
29757
+ if (!params.value)
29758
+ return "";
29759
+ return renderTooltip(params);
29760
+ }
29327
29761
  },
29762
+ geo: geoLayers,
29328
29763
  visualMap: showVisualMap() ? {
29329
29764
  seriesIndex: [0],
29330
29765
  min,