@visactor/vtable 1.20.0 → 1.20.1-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.
- package/cjs/PivotChart.d.ts +4 -0
- package/cjs/PivotChart.js +30 -18
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/core/BaseTable.js +1 -1
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/dataset/dataset-pivot-table.js +1 -2
- package/cjs/edit/editors.js +2 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/chart-helper/get-axis-config.js +73 -28
- package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
- package/cjs/layout/chart-helper/get-chart-spec.js +19 -9
- package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/cjs/layout/pivot-header-layout.d.ts +1 -1
- package/cjs/layout/pivot-header-layout.js +18 -8
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/plugins/custom-cell-style.js +1 -1
- package/cjs/scenegraph/scenegraph.js +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +226 -52
- package/dist/vtable.min.js +2 -2
- package/es/PivotChart.d.ts +4 -0
- package/es/PivotChart.js +30 -18
- package/es/PivotChart.js.map +1 -1
- package/es/core/BaseTable.js +1 -1
- package/es/core/BaseTable.js.map +1 -1
- package/es/dataset/dataset-pivot-table.js +1 -2
- package/es/edit/editors.js +2 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/chart-helper/get-axis-config.js +73 -28
- package/es/layout/chart-helper/get-axis-config.js.map +1 -1
- package/es/layout/chart-helper/get-chart-spec.js +19 -9
- package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/es/layout/pivot-header-layout.d.ts +1 -1
- package/es/layout/pivot-header-layout.js +18 -8
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/plugins/custom-cell-style.js +1 -1
- package/es/scenegraph/scenegraph.js +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +5 -5
package/cjs/PivotChart.d.ts
CHANGED
|
@@ -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),
|
|
24
|
-
vutils_1.cloneDeep)(options.columns), this.internalProps.rows = (0,
|
|
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) || "
|
|
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 === (
|
|
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
|
-
|
|
418
|
-
|
|
419
|
-
|
|
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 === (
|
|
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 === (
|
|
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();
|