@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.
- package/cjs/ListTable.js +3 -2
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.d.ts +4 -0
- package/cjs/PivotChart.js +30 -18
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.js +2 -1
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +4 -4
- package/cjs/core/BaseTable.js +16 -16
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/record-helper.js +12 -4
- package/cjs/core/record-helper.js.map +1 -1
- package/cjs/data/DataSource.d.ts +1 -0
- package/cjs/data/DataSource.js +6 -9
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/event/event.js +17 -8
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.js +20 -17
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/self-event-listener/list-table/checkbox.js +4 -2
- package/cjs/event/self-event-listener/list-table/checkbox.js.map +1 -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 +3 -3
- package/cjs/layout/pivot-header-layout.js +23 -12
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/scenegraph/graphic/chart.d.ts +1 -0
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +4 -1
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render.js +4 -1
- package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/vchart-graphic-picker.js +9 -0
- package/cjs/scenegraph/graphic/contributions/vchart-graphic-picker.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +3 -1
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +13 -6
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/state/select/update-position.d.ts +1 -1
- package/cjs/state/select/update-position.js +7 -7
- package/cjs/state/select/update-position.js.map +1 -1
- package/cjs/state/state.d.ts +2 -1
- package/cjs/state/state.js +5 -4
- package/cjs/state/state.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +1 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +1 -0
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +349 -114
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.js +3 -2
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.d.ts +4 -0
- package/es/PivotChart.js +30 -18
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.js +2 -1
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.d.ts +4 -4
- package/es/core/BaseTable.js +16 -16
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/record-helper.js +12 -4
- package/es/core/record-helper.js.map +1 -1
- package/es/data/DataSource.d.ts +1 -0
- package/es/data/DataSource.js +6 -9
- package/es/data/DataSource.js.map +1 -1
- package/es/event/event.js +17 -8
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.js +20 -17
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/self-event-listener/list-table/checkbox.js +4 -2
- package/es/event/self-event-listener/list-table/checkbox.js.map +1 -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 +3 -3
- package/es/layout/pivot-header-layout.js +23 -12
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/scenegraph/graphic/chart.d.ts +1 -0
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render-helper.js +4 -1
- package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render.js +4 -1
- package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/es/scenegraph/graphic/contributions/vchart-graphic-picker.js +9 -0
- package/es/scenegraph/graphic/contributions/vchart-graphic-picker.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +3 -1
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +13 -6
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/state/select/update-position.d.ts +1 -1
- package/es/state/select/update-position.js +7 -7
- package/es/state/select/update-position.js.map +1 -1
- package/es/state/state.d.ts +2 -1
- package/es/state/state.js +5 -4
- package/es/state/state.js.map +1 -1
- package/es/ts-types/base-table.d.ts +1 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +1 -0
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +4 -4
package/es/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/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),
|
|
54
|
-
this.internalProps.
|
|
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) || "
|
|
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 === (
|
|
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
|
-
|
|
438
|
-
|
|
439
|
-
|
|
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 === (
|
|
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 === (
|
|
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
|
}
|