@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/es/PivotChart.js CHANGED
@@ -50,9 +50,9 @@ export class PivotChart extends BaseTable {
50
50
  super(container, options), this.layoutNodeId = {
51
51
  seqId: 0
52
52
  }, this._selectedDataItemsInChart = [], this._selectedDimensionInChart = [], this._chartEventMap = {},
53
- (options = this.options).layout && Object.assign(options, options.layout), this.internalProps.columns = cloneDeep(options.columns),
54
- this.internalProps.rows = cloneDeep(options.rows), this.internalProps.indicators = cloneDeepSpec(options.indicators),
55
- this.internalProps.columnTree = !options.indicatorsAsCol || (null === (_a = options.columns) || void 0 === _a ? void 0 : _a.length) || options.columnTree ? cloneDeep(options.columnTree) : [],
53
+ this._throttleTimer = null, this._latestFilterRules = null, (options = this.options).layout && Object.assign(options, options.layout),
54
+ this.internalProps.columns = cloneDeep(options.columns), this.internalProps.rows = cloneDeep(options.rows),
55
+ this.internalProps.indicators = cloneDeepSpec(options.indicators), this.internalProps.columnTree = !options.indicatorsAsCol || (null === (_a = options.columns) || void 0 === _a ? void 0 : _a.length) || options.columnTree ? cloneDeep(options.columnTree) : [],
56
56
  this.internalProps.rowTree = options.indicatorsAsCol || (null === (_b = options.rows) || void 0 === _b ? void 0 : _b.length) || options.rowTree ? cloneDeep(options.rowTree) : [],
57
57
  this.internalProps.records = options.records, this.setCustomStateNameToSpec(), this.internalProps.columnResizeType = null !== (_e = null !== (_d = null === (_c = options.resize) || void 0 === _c ? void 0 : _c.columnResizeType) && void 0 !== _d ? _d : options.columnResizeType) && void 0 !== _e ? _e : "column",
58
58
  this.internalProps.rowResizeType = null !== (_h = null !== (_g = null === (_f = options.resize) || void 0 === _f ? void 0 : _f.rowResizeType) && void 0 !== _g ? _g : options.rowResizeType) && void 0 !== _h ? _h : "row",
@@ -393,19 +393,19 @@ export class PivotChart extends BaseTable {
393
393
  };
394
394
  }
395
395
  _generateCollectValuesConfig(columnKeys, rowKeys) {
396
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
396
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
397
397
  columnKeys = columnKeys.filter((key => key !== IndicatorDimensionKeyPlaceholder)),
398
398
  rowKeys = rowKeys.filter((key => key !== IndicatorDimensionKeyPlaceholder));
399
399
  const indicators = this.internalProps.indicators, collectValuesBy = {};
400
400
  for (let i = 0, len = null == indicators ? void 0 : indicators.length; i < len; i++) if ("string" != typeof indicators[i] && indicators[i].chartSpec) {
401
- 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;
401
+ 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;
402
402
  const indicatorDefine = indicators[i], indicatorSpec = indicatorDefine.chartSpec;
403
403
  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),
404
- collectValuesBy[indicatorDefine.indicatorKey] = {
404
+ "heatmap" !== (null == indicatorSpec ? void 0 : indicatorSpec.type) && (collectValuesBy[indicatorDefine.indicatorKey] = {
405
405
  by: rowKeys,
406
406
  range: !0,
407
- sumBy: (null == indicatorSpec ? void 0 : indicatorSpec.stack) && columnKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.xField)
408
- }, indicatorSpec.series) indicatorSpec.series.forEach((chartSeries => {
407
+ 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)
408
+ }), indicatorSpec.series) indicatorSpec.series.forEach((chartSeries => {
409
409
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
410
410
  const xField = "string" == typeof chartSeries.xField ? chartSeries.xField : chartSeries.xField[0];
411
411
  collectValuesBy[xField] = {
@@ -424,29 +424,30 @@ export class PivotChart extends BaseTable {
424
424
  extendRange: parseMarkLineGetExtendRange(indicatorSpec.markLine)
425
425
  };
426
426
  })); else {
427
- const xField = "string" == typeof indicatorSpec.xField ? indicatorSpec.xField : indicatorSpec.xField[0];
427
+ const xField = "histogram" === indicatorSpec.type ? indicatorSpec.x2Field : "string" == typeof indicatorSpec.xField ? indicatorSpec.xField : indicatorSpec.xField[0];
428
428
  collectValuesBy[xField] = {
429
429
  by: columnKeys,
430
430
  type: "horizontal" !== indicatorSpec.direction ? "xField" : void 0,
431
431
  range: hasLinearAxis(indicatorSpec, this._axes, "horizontal" === indicatorSpec.direction, !0),
432
- 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
432
+ 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
433
433
  }, !1 !== (null == indicatorSpec ? void 0 : indicatorSpec.stack) && ("bar" === (null == indicatorSpec ? void 0 : indicatorSpec.type) || "area" === (null == indicatorSpec ? void 0 : indicatorSpec.type)) && (indicatorSpec.stack = !0);
434
434
  const yField = indicatorSpec.yField;
435
435
  collectValuesBy[yField] = {
436
436
  by: rowKeys,
437
- range: "horizontal" !== indicatorSpec.direction,
438
- sumBy: indicatorSpec.stack && columnKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.xField),
439
- 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,
437
+ type: "horizontal" !== indicatorSpec.direction ? "yField" : void 0,
438
+ range: hasLinearAxis(indicatorSpec, this._axes, "horizontal" === indicatorSpec.direction, !1),
439
+ 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),
440
+ 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,
440
441
  extendRange: parseMarkLineGetExtendRange(indicatorSpec.markLine)
441
442
  };
442
443
  } else {
443
444
  const indicatorDefine = indicators[i];
444
445
  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),
445
- collectValuesBy[indicatorDefine.indicatorKey] = {
446
+ "heatmap" !== (null == indicatorSpec ? void 0 : indicatorSpec.type) && (collectValuesBy[indicatorDefine.indicatorKey] = {
446
447
  by: columnKeys,
447
448
  range: !0,
448
449
  sumBy: (null == indicatorSpec ? void 0 : indicatorSpec.stack) && rowKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.yField)
449
- }, indicatorSpec.series) indicatorSpec.series.forEach((chartSeries => {
450
+ }), indicatorSpec.series) indicatorSpec.series.forEach((chartSeries => {
450
451
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
451
452
  const yField = "string" == typeof chartSeries.yField ? chartSeries.yField : chartSeries.yField[0];
452
453
  collectValuesBy[yField] = {
@@ -470,14 +471,15 @@ export class PivotChart extends BaseTable {
470
471
  by: rowKeys,
471
472
  type: "horizontal" === indicatorSpec.direction ? "yField" : void 0,
472
473
  range: hasLinearAxis(indicatorSpec, this._axes, "horizontal" === indicatorSpec.direction, !1),
473
- 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
474
+ 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
474
475
  }, !1 !== (null == indicatorSpec ? void 0 : indicatorSpec.stack) && ("bar" === (null == indicatorSpec ? void 0 : indicatorSpec.type) || "area" === (null == indicatorSpec ? void 0 : indicatorSpec.type)) && (indicatorSpec.stack = !0);
475
- const xField = indicatorSpec.xField;
476
+ const xField = "histogram" === indicatorSpec.type ? indicatorSpec.x2Field : indicatorSpec.xField;
476
477
  collectValuesBy[xField] = {
477
478
  by: columnKeys,
479
+ type: "horizontal" === indicatorSpec.direction ? "xField" : void 0,
478
480
  range: hasLinearAxis(indicatorSpec, this._axes, "horizontal" === indicatorSpec.direction, !0),
479
481
  sumBy: indicatorSpec.stack && rowKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.yField),
480
- 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,
482
+ 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,
481
483
  extendRange: parseMarkLineGetExtendRange(indicatorSpec.markLine)
482
484
  };
483
485
  }
@@ -540,6 +542,16 @@ export class PivotChart extends BaseTable {
540
542
  }));
541
543
  }
542
544
  updateFilterRules(filterRules) {
545
+ this._throttledUpdateFilterRules(filterRules);
546
+ }
547
+ _throttledUpdateFilterRules(filterRules) {
548
+ this._latestFilterRules = filterRules, null === this._throttleTimer && (this._executeFilterUpdate(filterRules),
549
+ this._throttleTimer = window.setTimeout((() => {
550
+ this._latestFilterRules !== filterRules && this._executeFilterUpdate(this._latestFilterRules),
551
+ this._throttleTimer = null;
552
+ }), 200));
553
+ }
554
+ _executeFilterUpdate(filterRules) {
543
555
  this.internalProps.dataConfig.filterRules = filterRules, this.dataset.updateFilterRules(filterRules),
544
556
  clearChartCacheImage(this.scenegraph), updateChartData(this.scenegraph), this.render();
545
557
  }