zzz-pc-view 0.0.92 → 0.0.94

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zzz-pc-view",
3
- "version": "0.0.92",
3
+ "version": "0.0.94",
4
4
  "main": "src/index.umd.js",
5
5
  "module": "src/index.es.js",
6
6
  "types": "src/index.d.ts",
package/src/index.es.js CHANGED
@@ -1911,8 +1911,21 @@ const useHttpRequestInterval = (request, ms) => {
1911
1911
  abort
1912
1912
  };
1913
1913
  };
1914
+ const useDebounce = (callback, wait = 300) => {
1915
+ let timeout;
1916
+ return (...args) => {
1917
+ if (timeout !== void 0) {
1918
+ clearTimeout(timeout);
1919
+ }
1920
+ timeout = setTimeout(() => {
1921
+ timeout = void 0;
1922
+ callback(...args);
1923
+ }, wait);
1924
+ };
1925
+ };
1914
1926
  const index$d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1915
1927
  __proto__: null,
1928
+ useDebounce,
1916
1929
  useHttpRequestInterval,
1917
1930
  useInterval
1918
1931
  }, Symbol.toStringTag, { value: "Module" }));
@@ -2921,11 +2934,15 @@ const useChartStyleConfig = (param) => {
2921
2934
  // 坐标轴名称的字体大小,如果未提供则使用默认值 12
2922
2935
  axisNameFontSize: param.axisNameFontSize ?? 12,
2923
2936
  /**
2924
- * 计算并返回坐标轴名称间隙,通过平均坐标轴字体大小和坐标轴名称字体大小得到。
2937
+ * 计算并返回坐标轴名称间隙的计算值。
2938
+ * 该方法会比较坐标轴名称字体大小的一半向上取整的值,
2939
+ * 以及坐标轴字体大小的一半加 3 后向上取整的值,
2940
+ * 最终返回两者中的较大值作为坐标轴名称间隙。
2941
+ *
2925
2942
  * @returns {number} 坐标轴名称间隙的计算值
2926
2943
  */
2927
2944
  get axisNameGap() {
2928
- return Math.ceil(this.axisNameFontSize / 2);
2945
+ return Math.max(Math.ceil(this.axisNameFontSize / 2), Math.ceil(this.axisFontSize / 2 + 3));
2929
2946
  },
2930
2947
  // 坐标轴标签的边距,如果未提供则使用默认值 8
2931
2948
  axisLabelMargin: param.axisLabelMargin ?? 8,