@visactor/vtable 1.20.1-alpha.1 → 1.20.2-alpha.0

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 (117) hide show
  1. package/cjs/ListTable.js +3 -2
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/PivotChart.d.ts +4 -0
  4. package/cjs/PivotChart.js +30 -18
  5. package/cjs/PivotChart.js.map +1 -1
  6. package/cjs/PivotTable.js +2 -1
  7. package/cjs/PivotTable.js.map +1 -1
  8. package/cjs/core/BaseTable.d.ts +4 -4
  9. package/cjs/core/BaseTable.js +16 -16
  10. package/cjs/core/BaseTable.js.map +1 -1
  11. package/cjs/core/record-helper.js +12 -4
  12. package/cjs/core/record-helper.js.map +1 -1
  13. package/cjs/data/DataSource.d.ts +1 -0
  14. package/cjs/data/DataSource.js +6 -9
  15. package/cjs/data/DataSource.js.map +1 -1
  16. package/cjs/event/event.js +17 -8
  17. package/cjs/event/event.js.map +1 -1
  18. package/cjs/event/listener/container-dom.js +20 -17
  19. package/cjs/event/listener/container-dom.js.map +1 -1
  20. package/cjs/event/self-event-listener/list-table/checkbox.js +4 -2
  21. package/cjs/event/self-event-listener/list-table/checkbox.js.map +1 -1
  22. package/cjs/index.d.ts +1 -1
  23. package/cjs/index.js +1 -1
  24. package/cjs/index.js.map +1 -1
  25. package/cjs/layout/chart-helper/get-axis-config.js +73 -28
  26. package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
  27. package/cjs/layout/chart-helper/get-chart-spec.js +19 -9
  28. package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
  29. package/cjs/layout/pivot-header-layout.d.ts +3 -3
  30. package/cjs/layout/pivot-header-layout.js +23 -12
  31. package/cjs/layout/pivot-header-layout.js.map +1 -1
  32. package/cjs/scenegraph/graphic/chart.d.ts +1 -0
  33. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  34. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +4 -1
  35. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  36. package/cjs/scenegraph/graphic/contributions/chart-render.js +4 -1
  37. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  38. package/cjs/scenegraph/graphic/contributions/vchart-graphic-picker.js +9 -0
  39. package/cjs/scenegraph/graphic/contributions/vchart-graphic-picker.js.map +1 -1
  40. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  41. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  42. package/cjs/scenegraph/layout/compute-col-width.js +3 -1
  43. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  44. package/cjs/scenegraph/layout/compute-row-height.js +13 -6
  45. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  46. package/cjs/scenegraph/scenegraph.js.map +1 -1
  47. package/cjs/state/select/update-position.d.ts +1 -1
  48. package/cjs/state/select/update-position.js +7 -7
  49. package/cjs/state/select/update-position.js.map +1 -1
  50. package/cjs/state/state.d.ts +2 -1
  51. package/cjs/state/state.js +5 -4
  52. package/cjs/state/state.js.map +1 -1
  53. package/cjs/ts-types/base-table.d.ts +1 -0
  54. package/cjs/ts-types/base-table.js.map +1 -1
  55. package/cjs/ts-types/table-engine.d.ts +1 -0
  56. package/cjs/ts-types/table-engine.js.map +1 -1
  57. package/cjs/vrender.js.map +1 -1
  58. package/dist/vtable.js +349 -114
  59. package/dist/vtable.min.js +2 -2
  60. package/es/ListTable.js +3 -2
  61. package/es/ListTable.js.map +1 -1
  62. package/es/PivotChart.d.ts +4 -0
  63. package/es/PivotChart.js +30 -18
  64. package/es/PivotChart.js.map +1 -1
  65. package/es/PivotTable.js +2 -1
  66. package/es/PivotTable.js.map +1 -1
  67. package/es/core/BaseTable.d.ts +4 -4
  68. package/es/core/BaseTable.js +16 -16
  69. package/es/core/BaseTable.js.map +1 -1
  70. package/es/core/record-helper.js +12 -4
  71. package/es/core/record-helper.js.map +1 -1
  72. package/es/data/DataSource.d.ts +1 -0
  73. package/es/data/DataSource.js +6 -9
  74. package/es/data/DataSource.js.map +1 -1
  75. package/es/event/event.js +17 -8
  76. package/es/event/event.js.map +1 -1
  77. package/es/event/listener/container-dom.js +20 -17
  78. package/es/event/listener/container-dom.js.map +1 -1
  79. package/es/event/self-event-listener/list-table/checkbox.js +4 -2
  80. package/es/event/self-event-listener/list-table/checkbox.js.map +1 -1
  81. package/es/index.d.ts +1 -1
  82. package/es/index.js +1 -1
  83. package/es/index.js.map +1 -1
  84. package/es/layout/chart-helper/get-axis-config.js +73 -28
  85. package/es/layout/chart-helper/get-axis-config.js.map +1 -1
  86. package/es/layout/chart-helper/get-chart-spec.js +19 -9
  87. package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
  88. package/es/layout/pivot-header-layout.d.ts +3 -3
  89. package/es/layout/pivot-header-layout.js +23 -12
  90. package/es/layout/pivot-header-layout.js.map +1 -1
  91. package/es/scenegraph/graphic/chart.d.ts +1 -0
  92. package/es/scenegraph/graphic/chart.js.map +1 -1
  93. package/es/scenegraph/graphic/contributions/chart-render-helper.js +4 -1
  94. package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  95. package/es/scenegraph/graphic/contributions/chart-render.js +4 -1
  96. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  97. package/es/scenegraph/graphic/contributions/vchart-graphic-picker.js +9 -0
  98. package/es/scenegraph/graphic/contributions/vchart-graphic-picker.js.map +1 -1
  99. package/es/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  100. package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  101. package/es/scenegraph/layout/compute-col-width.js +3 -1
  102. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  103. package/es/scenegraph/layout/compute-row-height.js +13 -6
  104. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  105. package/es/scenegraph/scenegraph.js.map +1 -1
  106. package/es/state/select/update-position.d.ts +1 -1
  107. package/es/state/select/update-position.js +7 -7
  108. package/es/state/select/update-position.js.map +1 -1
  109. package/es/state/state.d.ts +2 -1
  110. package/es/state/state.js +5 -4
  111. package/es/state/state.js.map +1 -1
  112. package/es/ts-types/base-table.d.ts +1 -0
  113. package/es/ts-types/base-table.js.map +1 -1
  114. package/es/ts-types/table-engine.d.ts +1 -0
  115. package/es/ts-types/table-engine.js.map +1 -1
  116. package/es/vrender.js.map +1 -1
  117. package/package.json +4 -4
@@ -74,6 +74,10 @@ export declare class PivotChart extends BaseTable implements PivotChartAPI {
74
74
  private _generateAggregationRules;
75
75
  private setCustomStateNameToSpec;
76
76
  updateFilterRules(filterRules: FilterRules): void;
77
+ private _throttleTimer;
78
+ private _latestFilterRules;
79
+ private _throttledUpdateFilterRules;
80
+ private _executeFilterUpdate;
77
81
  clearChartCacheImage(col?: number, row?: number): void;
78
82
  getLegendSelected(): any[];
79
83
  setLegendSelected(selectedData: (string | number)[]): void;
package/cjs/PivotChart.js CHANGED
@@ -20,9 +20,9 @@ class PivotChart extends BaseTable_1.BaseTable {
20
20
  super(container, options), this.layoutNodeId = {
21
21
  seqId: 0
22
22
  }, this._selectedDataItemsInChart = [], this._selectedDimensionInChart = [], this._chartEventMap = {},
23
- (options = this.options).layout && Object.assign(options, options.layout), this.internalProps.columns = (0,
24
- vutils_1.cloneDeep)(options.columns), this.internalProps.rows = (0, vutils_1.cloneDeep)(options.rows),
25
- this.internalProps.indicators = (0, vutils_extension_1.cloneDeepSpec)(options.indicators),
23
+ this._throttleTimer = null, this._latestFilterRules = null, (options = this.options).layout && Object.assign(options, options.layout),
24
+ this.internalProps.columns = (0, vutils_1.cloneDeep)(options.columns), this.internalProps.rows = (0,
25
+ vutils_1.cloneDeep)(options.rows), this.internalProps.indicators = (0, vutils_extension_1.cloneDeepSpec)(options.indicators),
26
26
  this.internalProps.columnTree = !options.indicatorsAsCol || (null === (_a = options.columns) || void 0 === _a ? void 0 : _a.length) || options.columnTree ? (0,
27
27
  vutils_1.cloneDeep)(options.columnTree) : [], this.internalProps.rowTree = options.indicatorsAsCol || (null === (_b = options.rows) || void 0 === _b ? void 0 : _b.length) || options.rowTree ? (0,
28
28
  vutils_1.cloneDeep)(options.rowTree) : [], this.internalProps.records = options.records,
@@ -373,19 +373,19 @@ class PivotChart extends BaseTable_1.BaseTable {
373
373
  };
374
374
  }
375
375
  _generateCollectValuesConfig(columnKeys, rowKeys) {
376
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
376
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
377
377
  columnKeys = columnKeys.filter((key => key !== global_1.IndicatorDimensionKeyPlaceholder)),
378
378
  rowKeys = rowKeys.filter((key => key !== global_1.IndicatorDimensionKeyPlaceholder));
379
379
  const indicators = this.internalProps.indicators, collectValuesBy = {};
380
380
  for (let i = 0, len = null == indicators ? void 0 : indicators.length; i < len; i++) if ("string" != typeof indicators[i] && indicators[i].chartSpec) {
381
- if ("pie" === (null === (_a = indicators[i].chartSpec) || void 0 === _a ? void 0 : _a.type) || "rose" === (null === (_b = indicators[i].chartSpec) || void 0 === _b ? void 0 : _b.type) || "radar" === (null === (_c = indicators[i].chartSpec) || void 0 === _c ? void 0 : _c.type) || "gauge" === (null === (_d = indicators[i].chartSpec) || void 0 === _d ? void 0 : _d.type) || "wordCloud" === (null === (_e = indicators[i].chartSpec) || void 0 === _e ? void 0 : _e.type)) continue;
381
+ if ("pie" === (null === (_a = indicators[i].chartSpec) || void 0 === _a ? void 0 : _a.type) || "rose" === (null === (_b = indicators[i].chartSpec) || void 0 === _b ? void 0 : _b.type) || "funnel" === (null === (_c = indicators[i].chartSpec) || void 0 === _c ? void 0 : _c.type) || "radar" === (null === (_d = indicators[i].chartSpec) || void 0 === _d ? void 0 : _d.type) || "gauge" === (null === (_e = indicators[i].chartSpec) || void 0 === _e ? void 0 : _e.type) || "wordCloud" === (null === (_f = indicators[i].chartSpec) || void 0 === _f ? void 0 : _f.type) || "sunburst" === (null === (_g = indicators[i].chartSpec) || void 0 === _g ? void 0 : _g.type) || "treemap" === (null === (_h = indicators[i].chartSpec) || void 0 === _h ? void 0 : _h.type) || "sankey" === (null === (_j = indicators[i].chartSpec) || void 0 === _j ? void 0 : _j.type) || "circlePacking" === (null === (_k = indicators[i].chartSpec) || void 0 === _k ? void 0 : _k.type)) continue;
382
382
  const indicatorDefine = indicators[i], indicatorSpec = indicatorDefine.chartSpec;
383
383
  if (!1 === this.options.indicatorsAsCol) if (!1 !== (null == indicatorSpec ? void 0 : indicatorSpec.stack) && ("bar" === (null == indicatorSpec ? void 0 : indicatorSpec.type) || "area" === (null == indicatorSpec ? void 0 : indicatorSpec.type)) && (indicatorSpec.stack = !0),
384
- collectValuesBy[indicatorDefine.indicatorKey] = {
384
+ "heatmap" !== (null == indicatorSpec ? void 0 : indicatorSpec.type) && (collectValuesBy[indicatorDefine.indicatorKey] = {
385
385
  by: rowKeys,
386
386
  range: !0,
387
- sumBy: (null == indicatorSpec ? void 0 : indicatorSpec.stack) && columnKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.xField)
388
- }, indicatorSpec.series) indicatorSpec.series.forEach((chartSeries => {
387
+ sumBy: "histogram" === indicatorSpec.type ? columnKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.xField, null == indicatorSpec ? void 0 : indicatorSpec.x2Field) : (null == indicatorSpec ? void 0 : indicatorSpec.stack) && columnKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.xField)
388
+ }), indicatorSpec.series) indicatorSpec.series.forEach((chartSeries => {
389
389
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
390
390
  const xField = "string" == typeof chartSeries.xField ? chartSeries.xField : chartSeries.xField[0];
391
391
  collectValuesBy[xField] = {
@@ -404,29 +404,30 @@ class PivotChart extends BaseTable_1.BaseTable {
404
404
  extendRange: (0, tableHelper_1.parseMarkLineGetExtendRange)(indicatorSpec.markLine)
405
405
  };
406
406
  })); else {
407
- const xField = "string" == typeof indicatorSpec.xField ? indicatorSpec.xField : indicatorSpec.xField[0];
407
+ const xField = "histogram" === indicatorSpec.type ? indicatorSpec.x2Field : "string" == typeof indicatorSpec.xField ? indicatorSpec.xField : indicatorSpec.xField[0];
408
408
  collectValuesBy[xField] = {
409
409
  by: columnKeys,
410
410
  type: "horizontal" !== indicatorSpec.direction ? "xField" : void 0,
411
411
  range: (0, get_axis_config_1.hasLinearAxis)(indicatorSpec, this._axes, "horizontal" === indicatorSpec.direction, !0),
412
- sortBy: "horizontal" !== indicatorSpec.direction ? null === (_h = null === (_g = null === (_f = null == indicatorSpec ? void 0 : indicatorSpec.data) || void 0 === _f ? void 0 : _f.fields) || void 0 === _g ? void 0 : _g[xField]) || void 0 === _h ? void 0 : _h.domain : void 0
412
+ sortBy: "horizontal" !== indicatorSpec.direction ? null === (_o = null === (_m = null === (_l = null == indicatorSpec ? void 0 : indicatorSpec.data) || void 0 === _l ? void 0 : _l.fields) || void 0 === _m ? void 0 : _m[xField]) || void 0 === _o ? void 0 : _o.domain : void 0
413
413
  }, !1 !== (null == indicatorSpec ? void 0 : indicatorSpec.stack) && ("bar" === (null == indicatorSpec ? void 0 : indicatorSpec.type) || "area" === (null == indicatorSpec ? void 0 : indicatorSpec.type)) && (indicatorSpec.stack = !0);
414
414
  const yField = indicatorSpec.yField;
415
415
  collectValuesBy[yField] = {
416
416
  by: rowKeys,
417
- range: "horizontal" !== indicatorSpec.direction,
418
- sumBy: indicatorSpec.stack && columnKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.xField),
419
- sortBy: "horizontal" === indicatorSpec.direction ? null === (_l = null === (_k = null === (_j = null == indicatorSpec ? void 0 : indicatorSpec.data) || void 0 === _j ? void 0 : _j.fields) || void 0 === _k ? void 0 : _k[yField]) || void 0 === _l ? void 0 : _l.domain : void 0,
417
+ type: "horizontal" !== indicatorSpec.direction ? "yField" : void 0,
418
+ range: (0, get_axis_config_1.hasLinearAxis)(indicatorSpec, this._axes, "horizontal" === indicatorSpec.direction, !1),
419
+ sumBy: "histogram" === indicatorSpec.type ? columnKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.xField, null == indicatorSpec ? void 0 : indicatorSpec.x2Field) : indicatorSpec.stack && columnKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.xField),
420
+ sortBy: "horizontal" === indicatorSpec.direction ? null === (_r = null === (_q = null === (_p = null == indicatorSpec ? void 0 : indicatorSpec.data) || void 0 === _p ? void 0 : _p.fields) || void 0 === _q ? void 0 : _q[yField]) || void 0 === _r ? void 0 : _r.domain : void 0,
420
421
  extendRange: (0, tableHelper_1.parseMarkLineGetExtendRange)(indicatorSpec.markLine)
421
422
  };
422
423
  } else {
423
424
  const indicatorDefine = indicators[i];
424
425
  if (!1 !== (null == indicatorSpec ? void 0 : indicatorSpec.stack) && ("bar" === (null == indicatorSpec ? void 0 : indicatorSpec.type) || "area" === (null == indicatorSpec ? void 0 : indicatorSpec.type)) && (indicatorSpec.stack = !0),
425
- collectValuesBy[indicatorDefine.indicatorKey] = {
426
+ "heatmap" !== (null == indicatorSpec ? void 0 : indicatorSpec.type) && (collectValuesBy[indicatorDefine.indicatorKey] = {
426
427
  by: columnKeys,
427
428
  range: !0,
428
429
  sumBy: (null == indicatorSpec ? void 0 : indicatorSpec.stack) && rowKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.yField)
429
- }, indicatorSpec.series) indicatorSpec.series.forEach((chartSeries => {
430
+ }), indicatorSpec.series) indicatorSpec.series.forEach((chartSeries => {
430
431
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
431
432
  const yField = "string" == typeof chartSeries.yField ? chartSeries.yField : chartSeries.yField[0];
432
433
  collectValuesBy[yField] = {
@@ -450,14 +451,15 @@ class PivotChart extends BaseTable_1.BaseTable {
450
451
  by: rowKeys,
451
452
  type: "horizontal" === indicatorSpec.direction ? "yField" : void 0,
452
453
  range: (0, get_axis_config_1.hasLinearAxis)(indicatorSpec, this._axes, "horizontal" === indicatorSpec.direction, !1),
453
- sortBy: "horizontal" === indicatorSpec.direction ? null === (_p = null === (_o = null === (_m = null == indicatorSpec ? void 0 : indicatorSpec.data) || void 0 === _m ? void 0 : _m.fields) || void 0 === _o ? void 0 : _o[yField]) || void 0 === _p ? void 0 : _p.domain : void 0
454
+ sortBy: "horizontal" === indicatorSpec.direction ? null === (_u = null === (_t = null === (_s = null == indicatorSpec ? void 0 : indicatorSpec.data) || void 0 === _s ? void 0 : _s.fields) || void 0 === _t ? void 0 : _t[yField]) || void 0 === _u ? void 0 : _u.domain : void 0
454
455
  }, !1 !== (null == indicatorSpec ? void 0 : indicatorSpec.stack) && ("bar" === (null == indicatorSpec ? void 0 : indicatorSpec.type) || "area" === (null == indicatorSpec ? void 0 : indicatorSpec.type)) && (indicatorSpec.stack = !0);
455
- const xField = indicatorSpec.xField;
456
+ const xField = "histogram" === indicatorSpec.type ? indicatorSpec.x2Field : indicatorSpec.xField;
456
457
  collectValuesBy[xField] = {
457
458
  by: columnKeys,
459
+ type: "horizontal" === indicatorSpec.direction ? "xField" : void 0,
458
460
  range: (0, get_axis_config_1.hasLinearAxis)(indicatorSpec, this._axes, "horizontal" === indicatorSpec.direction, !0),
459
461
  sumBy: indicatorSpec.stack && rowKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.yField),
460
- sortBy: "horizontal" !== indicatorSpec.direction ? null === (_s = null === (_r = null === (_q = null == indicatorSpec ? void 0 : indicatorSpec.data) || void 0 === _q ? void 0 : _q.fields) || void 0 === _r ? void 0 : _r[xField]) || void 0 === _s ? void 0 : _s.domain : void 0,
462
+ sortBy: "horizontal" !== indicatorSpec.direction ? null === (_x = null === (_w = null === (_v = null == indicatorSpec ? void 0 : indicatorSpec.data) || void 0 === _v ? void 0 : _v.fields) || void 0 === _w ? void 0 : _w[xField]) || void 0 === _x ? void 0 : _x.domain : void 0,
461
463
  extendRange: (0, tableHelper_1.parseMarkLineGetExtendRange)(indicatorSpec.markLine)
462
464
  };
463
465
  }
@@ -520,6 +522,16 @@ class PivotChart extends BaseTable_1.BaseTable {
520
522
  }));
521
523
  }
522
524
  updateFilterRules(filterRules) {
525
+ this._throttledUpdateFilterRules(filterRules);
526
+ }
527
+ _throttledUpdateFilterRules(filterRules) {
528
+ this._latestFilterRules = filterRules, null === this._throttleTimer && (this._executeFilterUpdate(filterRules),
529
+ this._throttleTimer = window.setTimeout((() => {
530
+ this._latestFilterRules !== filterRules && this._executeFilterUpdate(this._latestFilterRules),
531
+ this._throttleTimer = null;
532
+ }), 200));
533
+ }
534
+ _executeFilterUpdate(filterRules) {
523
535
  this.internalProps.dataConfig.filterRules = filterRules, this.dataset.updateFilterRules(filterRules),
524
536
  (0, update_chart_1.clearChartCacheImage)(this.scenegraph), (0, update_chart_1.updateChartData)(this.scenegraph),
525
537
  this.render();