zzz-pc-view 0.0.166 → 0.0.168

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.166",
3
+ "version": "0.0.168",
4
4
  "main": "src/index.umd.js",
5
5
  "module": "src/index.es.js",
6
6
  "types": "src/index.d.ts",
@@ -457,7 +457,7 @@ export declare abstract class CurdHandler<T extends object = object, P extends P
457
457
  prop: keyof T;
458
458
  order: 1 | -1;
459
459
  } | undefined>;
460
- setSortInfo(prop: keyof T, order: 1 | -1): void;
460
+ setSortInfo(prop?: keyof T, order?: 1 | -1): void;
461
461
  /**
462
462
  * 创建一个浅引用,用于存储列表数据。
463
463
  * 这个引用将用于在组件中存储和更新列表数据。
package/src/index.es.js CHANGED
@@ -4213,8 +4213,9 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
4213
4213
  const props = __props;
4214
4214
  const emit = __emit;
4215
4215
  const elRef = shallowRef();
4216
- let chartInstance;
4216
+ const chartInstanceRef = shallowRef();
4217
4217
  const setChartOption = () => {
4218
+ const chartInstance = chartInstanceRef.value;
4218
4219
  chartInstance.resize();
4219
4220
  const { chartOption } = props.renderParam;
4220
4221
  if (chartOption) {
@@ -4222,21 +4223,23 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
4222
4223
  }
4223
4224
  };
4224
4225
  const init = () => {
4225
- chartInstance = ECharts.init(elRef.value, props.theme);
4226
+ const chartInstance = chartInstanceRef.value = ECharts.init(elRef.value, props.theme);
4226
4227
  emit("ready", chartInstance);
4227
4228
  setChartOption();
4228
4229
  };
4229
4230
  const destroy = () => {
4231
+ const chartInstance = chartInstanceRef.value;
4230
4232
  if (!chartInstance) {
4231
4233
  return;
4232
4234
  }
4233
4235
  emit("destroy", chartInstance);
4234
4236
  chartInstance.clear();
4235
4237
  chartInstance.dispose();
4236
- chartInstance = void 0;
4238
+ chartInstanceRef.value = void 0;
4237
4239
  };
4238
4240
  const resize = () => {
4239
- chartInstance == null ? void 0 : chartInstance.resize();
4241
+ var _a2;
4242
+ (_a2 = chartInstanceRef.value) == null ? void 0 : _a2.resize();
4240
4243
  };
4241
4244
  let windowResizeTimer;
4242
4245
  const clearWindowResizeTimer = () => {
@@ -4244,6 +4247,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
4244
4247
  };
4245
4248
  const onWindowResize = () => {
4246
4249
  clearWindowResizeTimer();
4250
+ const chartInstance = chartInstanceRef.value;
4247
4251
  if (chartInstance) {
4248
4252
  windowResizeTimer = window.setTimeout(() => {
4249
4253
  resize();
@@ -4253,13 +4257,20 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
4253
4257
  watch(
4254
4258
  () => props.theme,
4255
4259
  () => {
4260
+ const chartInstance = chartInstanceRef.value;
4261
+ if (!chartInstance) {
4262
+ return;
4263
+ }
4264
+ const chartOption = chartInstance.getOption();
4256
4265
  destroy();
4257
4266
  init();
4267
+ chartInstanceRef.value.setOption(chartOption, true);
4258
4268
  }
4259
4269
  );
4260
4270
  watch(
4261
4271
  () => props.renderParam.chartOption,
4262
4272
  () => {
4273
+ const chartInstance = chartInstanceRef.value;
4263
4274
  if (!chartInstance) {
4264
4275
  return;
4265
4276
  }
@@ -4294,7 +4305,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
4294
4305
  * @returns {EChartsType | undefined} 当前 ECharts 图表实例,如果未初始化则返回 undefined。
4295
4306
  */
4296
4307
  get chartInstance() {
4297
- return chartInstance;
4308
+ return chartInstanceRef.value;
4298
4309
  },
4299
4310
  // 暴露 resize 方法,供父组件调用,用于调整 ECharts 图表实例的大小
4300
4311
  resize
@@ -5991,7 +6002,7 @@ class CurdHandler extends FilterHandler {
5991
6002
  this.searchQueryRef.value = searchQuery;
5992
6003
  }
5993
6004
  setSortInfo(prop, order) {
5994
- this.sortInfoRef.value = { prop, order };
6005
+ this.sortInfoRef.value = prop === void 0 || order === void 0 ? void 0 : { prop, order };
5995
6006
  }
5996
6007
  /**
5997
6008
  * 获取当前显示的列表数据。