@visactor/vtable 1.22.11-alpha.8 → 1.22.11
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 +0 -3
- package/cjs/PivotChart.js +5 -12
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable-all.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +3 -0
- package/cjs/core/BaseTable.js +22 -6
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/dataset/dataset.js +92 -84
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/edit/edit-manager.js +10 -9
- package/cjs/edit/edit-manager.js.map +1 -1
- package/cjs/event/listener/container-dom.js +1 -1
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/scroll-bar.js +2 -8
- package/cjs/event/listener/scroll-bar.js.map +1 -1
- package/cjs/event/listener/table-group.js +8 -14
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/event/media-click.js +1 -1
- package/cjs/event/scroll.js +1 -1
- package/cjs/event/sparkline-event.js +1 -1
- package/cjs/event/util.js +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/index.js +1 -2
- package/cjs/layout/pivot-header-layout.d.ts +0 -6
- package/cjs/layout/pivot-header-layout.js +21 -40
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/plugins/custom-cell-style.d.ts +5 -0
- package/cjs/plugins/custom-cell-style.js +66 -18
- package/cjs/plugins/custom-cell-style.js.map +1 -1
- package/cjs/plugins/interface.js +1 -1
- package/cjs/plugins/invert-highlight.js +2 -1
- package/cjs/plugins/list-tree-stick-cell.js +1 -1
- package/cjs/plugins/plugin-manager.js +1 -1
- package/cjs/scenegraph/graphic/active-cell-chart-list.d.ts +2 -15
- package/cjs/scenegraph/graphic/active-cell-chart-list.js +75 -198
- package/cjs/scenegraph/graphic/active-cell-chart-list.js.map +1 -1
- package/cjs/scenegraph/graphic/chart.d.ts +1 -10
- package/cjs/scenegraph/graphic/chart.js +27 -61
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render.js +4 -3
- package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
- package/cjs/scenegraph/layout/update-row.js +16 -1
- package/cjs/scenegraph/layout/update-row.js.map +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.d.ts +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.js +1 -2
- package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +2 -2
- package/cjs/scenegraph/scenegraph.js +11 -44
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/select/update-select-border.js.map +1 -1
- package/cjs/state/select/update-position.js +3 -3
- package/cjs/state/select/update-position.js.map +1 -1
- package/cjs/tools/util.d.ts +0 -5
- package/cjs/tools/util.js +4 -22
- package/cjs/tools/util.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +3 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/new-data-set.d.ts +1 -0
- package/cjs/ts-types/new-data-set.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +0 -7
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +380 -596
- package/dist/vtable.min.js +2 -2
- package/es/PivotChart.d.ts +0 -3
- package/es/PivotChart.js +4 -13
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable-all.js.map +1 -1
- package/es/core/BaseTable.d.ts +3 -0
- package/es/core/BaseTable.js +22 -6
- package/es/core/BaseTable.js.map +1 -1
- package/es/dataset/dataset.js +92 -84
- package/es/dataset/dataset.js.map +1 -1
- package/es/edit/edit-manager.js +10 -9
- package/es/edit/edit-manager.js.map +1 -1
- package/es/event/listener/container-dom.js +1 -1
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/scroll-bar.js +2 -8
- package/es/event/listener/scroll-bar.js.map +1 -1
- package/es/event/listener/table-group.js +8 -13
- package/es/event/listener/table-group.js.map +1 -1
- package/es/event/media-click.js +1 -1
- package/es/event/scroll.js +1 -1
- package/es/event/sparkline-event.js +1 -1
- package/es/event/util.js +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/index.js +1 -2
- package/es/layout/pivot-header-layout.d.ts +0 -6
- package/es/layout/pivot-header-layout.js +21 -40
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/plugins/custom-cell-style.d.ts +5 -0
- package/es/plugins/custom-cell-style.js +64 -18
- package/es/plugins/custom-cell-style.js.map +1 -1
- package/es/plugins/interface.js +1 -1
- package/es/plugins/invert-highlight.js +2 -1
- package/es/plugins/list-tree-stick-cell.js +1 -1
- package/es/plugins/plugin-manager.js +1 -1
- package/es/scenegraph/graphic/active-cell-chart-list.d.ts +2 -15
- package/es/scenegraph/graphic/active-cell-chart-list.js +68 -186
- package/es/scenegraph/graphic/active-cell-chart-list.js.map +1 -1
- package/es/scenegraph/graphic/chart.d.ts +1 -10
- package/es/scenegraph/graphic/chart.js +25 -58
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render.js +4 -3
- package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
- package/es/scenegraph/layout/update-row.js +16 -1
- package/es/scenegraph/layout/update-row.js.map +1 -1
- package/es/scenegraph/refresh-node/update-chart.d.ts +1 -1
- package/es/scenegraph/refresh-node/update-chart.js +1 -2
- package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +2 -2
- package/es/scenegraph/scenegraph.js +10 -43
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/select/update-select-border.js.map +1 -1
- package/es/state/select/update-position.js +4 -2
- package/es/state/select/update-position.js.map +1 -1
- package/es/tools/util.d.ts +0 -5
- package/es/tools/util.js +0 -18
- package/es/tools/util.js.map +1 -1
- package/es/ts-types/base-table.d.ts +3 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/new-data-set.d.ts +1 -0
- package/es/ts-types/new-data-set.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +0 -7
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +5 -5
|
@@ -9,7 +9,12 @@ export declare class CustomCellStylePlugin {
|
|
|
9
9
|
table: BaseTableAPI;
|
|
10
10
|
customCellStyle: CustomCellStyle[];
|
|
11
11
|
customCellStyleArrangement: CustomCellStyleArrangement[];
|
|
12
|
+
private _customCellStyleArrangementIndex;
|
|
13
|
+
private _customCellStyleArrangementTombstoneCount;
|
|
12
14
|
constructor(table: BaseTableAPI, customCellStyle: CustomCellStyle[], customCellStyleArrangement: CustomCellStyleArrangement[]);
|
|
15
|
+
private _getCustomCellStyleArrangementKey;
|
|
16
|
+
private _rebuildCustomCellStyleArrangementIndex;
|
|
17
|
+
private _compactCustomCellStyleArrangementIfNeeded;
|
|
13
18
|
getCustomCellStyle(col: number, row: number): any;
|
|
14
19
|
getCustomCellStyleIds(col: number, row: number): string[];
|
|
15
20
|
getCustomCellStyleOption(customStyleId: string): CustomCellStyle;
|
|
@@ -8,13 +8,41 @@ const vutils_1 = require("@visactor/vutils"), ts_types_1 = require("../ts-types"
|
|
|
8
8
|
|
|
9
9
|
class CustomCellStylePlugin {
|
|
10
10
|
constructor(table, customCellStyle, customCellStyleArrangement) {
|
|
11
|
-
this.table = table, this.customCellStyle = customCellStyle, this.customCellStyleArrangement = customCellStyleArrangement
|
|
11
|
+
this.table = table, this.customCellStyle = customCellStyle, this.customCellStyleArrangement = customCellStyleArrangement,
|
|
12
|
+
this._customCellStyleArrangementIndex = new Map, this._customCellStyleArrangementTombstoneCount = 0,
|
|
13
|
+
this._rebuildCustomCellStyleArrangementIndex();
|
|
14
|
+
}
|
|
15
|
+
_getCustomCellStyleArrangementKey(cellPos) {
|
|
16
|
+
if (cellPos.range) {
|
|
17
|
+
const {start: start, end: end} = cellPos.range;
|
|
18
|
+
return `range:${start.col},${start.row},${end.col},${end.row}`;
|
|
19
|
+
}
|
|
20
|
+
if (void 0 !== cellPos.col && void 0 !== cellPos.row) return `cell:${cellPos.col},${cellPos.row}`;
|
|
21
|
+
}
|
|
22
|
+
_rebuildCustomCellStyleArrangementIndex() {
|
|
23
|
+
this._customCellStyleArrangementIndex.clear(), this._customCellStyleArrangementTombstoneCount = 0;
|
|
24
|
+
for (let i = 0; i < this.customCellStyleArrangement.length; i++) {
|
|
25
|
+
if (!(0, vutils_1.isValid)(this.customCellStyleArrangement[i].customStyleId)) {
|
|
26
|
+
this._customCellStyleArrangementTombstoneCount++;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const key = this._getCustomCellStyleArrangementKey(this.customCellStyleArrangement[i].cellPosition);
|
|
30
|
+
key && this._customCellStyleArrangementIndex.set(key, i);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
_compactCustomCellStyleArrangementIfNeeded() {
|
|
34
|
+
const length = this.customCellStyleArrangement.length;
|
|
35
|
+
if (this._customCellStyleArrangementTombstoneCount < 2048) return;
|
|
36
|
+
if (4 * this._customCellStyleArrangementTombstoneCount < length) return;
|
|
37
|
+
const compacted = this.customCellStyleArrangement.filter((style => (0, vutils_1.isValid)(style.customStyleId)));
|
|
38
|
+
compacted.length !== this.customCellStyleArrangement.length ? (this.customCellStyleArrangement.length = 0,
|
|
39
|
+
this.customCellStyleArrangement.push(...compacted), this._rebuildCustomCellStyleArrangementIndex()) : this._customCellStyleArrangementTombstoneCount = 0;
|
|
12
40
|
}
|
|
13
41
|
getCustomCellStyle(col, row) {
|
|
14
42
|
const customStyleIds = this.getCustomCellStyleIds(col, row);
|
|
15
43
|
if (customStyleIds.length) {
|
|
16
44
|
const styles = [];
|
|
17
|
-
|
|
45
|
+
if (customStyleIds.forEach((customStyleId => {
|
|
18
46
|
const styleOption = this.getCustomCellStyleOption(customStyleId);
|
|
19
47
|
if ((0, vutils_1.isFunction)(null == styleOption ? void 0 : styleOption.style)) {
|
|
20
48
|
const style = styleOption.style({
|
|
@@ -27,13 +55,14 @@ class CustomCellStylePlugin {
|
|
|
27
55
|
});
|
|
28
56
|
styles.push(style);
|
|
29
57
|
} else (null == styleOption ? void 0 : styleOption.style) && styles.push(styleOption.style);
|
|
30
|
-
})),
|
|
58
|
+
})), !styles.length) return;
|
|
59
|
+
return (0, vutils_1.merge)({}, ...styles);
|
|
31
60
|
}
|
|
32
61
|
}
|
|
33
62
|
getCustomCellStyleIds(col, row) {
|
|
34
63
|
const customStyleIds = [], range = this.table.getCellRange(col, row);
|
|
35
64
|
for (let c = range.start.col; c <= range.end.col; c++) for (let r = range.start.row; r <= range.end.row; r++) this.customCellStyleArrangement.forEach((style => {
|
|
36
|
-
style.cellPosition.range ? style.cellPosition.range.start.col <= c && style.cellPosition.range.end.col >= c && style.cellPosition.range.start.row <= r && style.cellPosition.range.end.row >= r && customStyleIds.push(style.customStyleId) : style.cellPosition.col === c && style.cellPosition.row === r && customStyleIds.push(style.customStyleId);
|
|
65
|
+
(0, vutils_1.isValid)(style.customStyleId) && (style.cellPosition.range ? style.cellPosition.range.start.col <= c && style.cellPosition.range.end.col >= c && style.cellPosition.range.start.row <= r && style.cellPosition.range.end.row >= r && customStyleIds.push(style.customStyleId) : style.cellPosition.col === c && style.cellPosition.row === r && customStyleIds.push(style.customStyleId));
|
|
37
66
|
}));
|
|
38
67
|
return customStyleIds;
|
|
39
68
|
}
|
|
@@ -54,21 +83,39 @@ class CustomCellStylePlugin {
|
|
|
54
83
|
})), this.table.scenegraph.updateNextFrame();
|
|
55
84
|
}
|
|
56
85
|
arrangeCustomCellStyle(cellPos, customStyleId, forceFastUpdate) {
|
|
57
|
-
var _a;
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
if (-1
|
|
61
|
-
cellPosition:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
86
|
+
var _a, _b;
|
|
87
|
+
const inputKey = this._getCustomCellStyleArrangementKey(cellPos);
|
|
88
|
+
let index = inputKey && null !== (_a = this._customCellStyleArrangementIndex.get(inputKey)) && void 0 !== _a ? _a : -1;
|
|
89
|
+
if (inputKey && -1 !== index) {
|
|
90
|
+
const item = this.customCellStyleArrangement[index], itemKey = item ? this._getCustomCellStyleArrangementKey(item.cellPosition) : void 0;
|
|
91
|
+
item && (0, vutils_1.isValid)(item.customStyleId) && itemKey === inputKey || (index = this.customCellStyleArrangement.findIndex((style => !!(0,
|
|
92
|
+
vutils_1.isValid)(style.customStyleId) && this._getCustomCellStyleArrangementKey(style.cellPosition) === inputKey)),
|
|
93
|
+
-1 !== index ? this._customCellStyleArrangementIndex.set(inputKey, index) : this._customCellStyleArrangementIndex.delete(inputKey));
|
|
94
|
+
}
|
|
95
|
+
if (-1 !== index || inputKey || (index = this.customCellStyleArrangement.findIndex((style => !!(0,
|
|
96
|
+
vutils_1.isValid)(style.customStyleId) && (style.cellPosition.range && cellPos.range ? style.cellPosition.range.start.col === cellPos.range.start.col && style.cellPosition.range.start.row === cellPos.range.start.row && style.cellPosition.range.end.col === cellPos.range.end.col && style.cellPosition.range.end.row === cellPos.range.end.row : style.cellPosition.col === cellPos.col && style.cellPosition.row === cellPos.row)))),
|
|
97
|
+
-1 === index && !customStyleId) return;
|
|
98
|
+
if (-1 === index && customStyleId) {
|
|
99
|
+
this.customCellStyleArrangement.push({
|
|
100
|
+
cellPosition: {
|
|
101
|
+
col: cellPos.col,
|
|
102
|
+
row: cellPos.row,
|
|
103
|
+
range: cellPos.range
|
|
104
|
+
},
|
|
105
|
+
customStyleId: customStyleId
|
|
106
|
+
});
|
|
107
|
+
const pushedIndex = this.customCellStyleArrangement.length - 1, pushedKey = this._getCustomCellStyleArrangementKey(this.customCellStyleArrangement[pushedIndex].cellPosition);
|
|
108
|
+
pushedKey && this._customCellStyleArrangementIndex.set(pushedKey, pushedIndex);
|
|
109
|
+
} else {
|
|
68
110
|
if (this.customCellStyleArrangement[index].customStyleId === customStyleId) return;
|
|
69
|
-
customStyleId
|
|
111
|
+
if (customStyleId) this.customCellStyleArrangement[index].customStyleId = customStyleId; else {
|
|
112
|
+
const existedKey = this._getCustomCellStyleArrangementKey(this.customCellStyleArrangement[index].cellPosition);
|
|
113
|
+
(0, vutils_1.isValid)(this.customCellStyleArrangement[index].customStyleId) && this._customCellStyleArrangementTombstoneCount++,
|
|
114
|
+
this.customCellStyleArrangement[index].customStyleId = null, existedKey && this._customCellStyleArrangementIndex.delete(existedKey),
|
|
115
|
+
this._compactCustomCellStyleArrangementIfNeeded();
|
|
116
|
+
}
|
|
70
117
|
}
|
|
71
|
-
const style = null === (
|
|
118
|
+
const style = customStyleId ? null === (_b = this.getCustomCellStyleOption(customStyleId)) || void 0 === _b ? void 0 : _b.style : void 0;
|
|
72
119
|
if (style) {
|
|
73
120
|
forceFastUpdate = !0;
|
|
74
121
|
for (const key in style) if (-1 === ts_types_1.cellStyleKeys.indexOf(key)) {
|
|
@@ -83,7 +130,8 @@ class CustomCellStylePlugin {
|
|
|
83
130
|
this.table.scenegraph.updateNextFrame();
|
|
84
131
|
}
|
|
85
132
|
updateCustomCell(customCellStyle, customCellStyleArrangement) {
|
|
86
|
-
this.customCellStyle.length = 0, this.customCellStyleArrangement.length = 0,
|
|
133
|
+
this.customCellStyle.length = 0, this.customCellStyleArrangement.length = 0, this._customCellStyleArrangementIndex.clear(),
|
|
134
|
+
this._customCellStyleArrangementTombstoneCount = 0, customCellStyle.forEach((cellStyle => {
|
|
87
135
|
this.registerCustomCellStyle(cellStyle.id, cellStyle.style);
|
|
88
136
|
})), customCellStyleArrangement.forEach((cellStyle => {
|
|
89
137
|
this.arrangeCustomCellStyle(cellStyle.cellPosition, cellStyle.customStyleId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugins/custom-cell-style.ts"],"names":[],"mappings":";;;AAAA,6CAA8D;AAE9D,0CAMqB;AAErB,6CAA0C;AAU1C,MAAa,qBAAqB;IAKhC,YACE,KAAmB,EACnB,eAAkC,EAClC,0BAAwD;QAExD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,0BAA0B,GAAG,0BAA0B,CAAC;IAC/D,CAAC;IAED,kBAAkB,CAAC,GAAW,EAAE,GAAW;QACzC,MAAM,cAAc,GAAG,IAAI,CAAC,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC5D,IAAI,cAAc,CAAC,MAAM,EAAE;YACzB,MAAM,MAAM,GAAwB,EAAE,CAAC;YAEvC,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;gBACrC,MAAM,WAAW,GAAG,IAAI,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC;gBACjE,IAAI,IAAA,mBAAU,EAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,CAAC,EAAE;oBAClC,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC;wBAC9B,GAAG;wBACH,GAAG;wBACH,KAAK,EAAE,IAAI,CAAC,KAAK;wBACjB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC;wBACxC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC;wBAClD,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC;qBACzD,CAAC,CAAC;oBACH,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;iBACpB;qBAAM,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,iCAExC","file":"custom-cell-style.js","sourcesContent":["import { isFunction, isValid, merge } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../ts-types/base-table';\nimport {\n cellStyleKeys,\n type CellRange,\n type ColumnStyleOption,\n type CustomCellStyle,\n type CustomCellStyleArrangement\n} from '../ts-types';\nimport type { Style } from '../body-helper/style';\nimport { Factory } from '../core/factory';\nimport type { StylePropertyFunctionArg } from '../ts-types/style-define';\nexport interface ICustomCellStylePlugin {\n new (\n table: BaseTableAPI,\n customCellStyle: CustomCellStyle[],\n customCellStyleArrangement: CustomCellStyleArrangement[]\n ): CustomCellStylePlugin;\n}\n\nexport class CustomCellStylePlugin {\n table: BaseTableAPI;\n customCellStyle: CustomCellStyle[];\n customCellStyleArrangement: CustomCellStyleArrangement[];\n\n constructor(\n table: BaseTableAPI,\n customCellStyle: CustomCellStyle[],\n customCellStyleArrangement: CustomCellStyleArrangement[]\n ) {\n this.table = table;\n this.customCellStyle = customCellStyle;\n this.customCellStyleArrangement = customCellStyleArrangement;\n }\n\n getCustomCellStyle(col: number, row: number) {\n const customStyleIds = this.getCustomCellStyleIds(col, row);\n if (customStyleIds.length) {\n const styles: ColumnStyleOption[] = [];\n\n customStyleIds.forEach(customStyleId => {\n const styleOption = this.getCustomCellStyleOption(customStyleId);\n if (isFunction(styleOption?.style)) {\n const style = styleOption.style({\n col,\n row,\n table: this.table,\n value: this.table.getCellValue(col, row),\n dataValue: this.table.getCellOriginValue(col, row),\n cellHeaderPaths: this.table.getCellHeaderPaths(col, row)\n });\n styles.push(style);\n } else if (styleOption?.style) {\n styles.push(styleOption.style);\n }\n });\n\n return merge({}, ...styles);\n // const styleOption = this.getCustomCellStyleOption(customStyleId);\n // return styleOption?.style;\n }\n return undefined;\n }\n\n getCustomCellStyleIds(col: number, row: number) {\n // let customStyleId;\n const customStyleIds: string[] = [];\n\n const range = this.table.getCellRange(col, row);\n for (let c = range.start.col; c <= range.end.col; c++) {\n for (let r = range.start.row; r <= range.end.row; r++) {\n // eslint-disable-next-line no-loop-func\n this.customCellStyleArrangement.forEach(style => {\n if (style.cellPosition.range) {\n if (\n style.cellPosition.range.start.col <= c &&\n style.cellPosition.range.end.col >= c &&\n style.cellPosition.range.start.row <= r &&\n style.cellPosition.range.end.row >= r\n ) {\n // customStyleId = style.customStyleId;\n customStyleIds.push(style.customStyleId);\n }\n } else if (style.cellPosition.col === c && style.cellPosition.row === r) {\n // customStyleId = style.customStyleId;\n customStyleIds.push(style.customStyleId);\n }\n });\n }\n }\n\n return customStyleIds;\n }\n\n getCustomCellStyleOption(customStyleId: string) {\n return this.customCellStyle.find(style => style.id === customStyleId);\n }\n\n registerCustomCellStyle(\n customStyleId: string,\n customStyle: ColumnStyleOption | ((styleArg: StylePropertyFunctionArg) => ColumnStyleOption) | undefined | null\n ) {\n const index = this.customCellStyle.findIndex(style => style.id === customStyleId);\n if (index === -1) {\n this.customCellStyle.push({\n id: customStyleId,\n style: customStyle\n });\n } else {\n this.customCellStyle[index] = {\n id: customStyleId,\n style: customStyle\n };\n }\n\n this.customCellStyleArrangement.forEach(cellStyle => {\n const cellPos = cellStyle.cellPosition;\n if (cellStyle.customStyleId === customStyleId) {\n if (cellPos.range) {\n for (\n let col = Math.max(0, cellPos.range.start.col);\n col <= Math.min(this.table.colCount - 1, cellPos.range.end.col);\n col++\n ) {\n for (\n let row = Math.max(0, cellPos.range.start.row);\n row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row);\n row++\n ) {\n this.table.scenegraph.updateCellContent(col, row);\n }\n }\n } else {\n this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row);\n }\n }\n });\n this.table.scenegraph.updateNextFrame();\n }\n\n arrangeCustomCellStyle(\n cellPos: {\n col?: number;\n row?: number;\n range?: CellRange;\n },\n customStyleId: string | undefined | null,\n forceFastUpdate?: boolean\n ) {\n const index = this.customCellStyleArrangement.findIndex(style => {\n if (style.cellPosition.range && cellPos.range) {\n return (\n style.cellPosition.range.start.col === cellPos.range.start.col &&\n style.cellPosition.range.start.row === cellPos.range.start.row &&\n style.cellPosition.range.end.col === cellPos.range.end.col &&\n style.cellPosition.range.end.row === cellPos.range.end.row\n );\n }\n return style.cellPosition.col === cellPos.col && style.cellPosition.row === cellPos.row;\n });\n\n if (index === -1 && !customStyleId) {\n // do nothing\n return;\n } else if (index === -1 && customStyleId) {\n // add new style\n this.customCellStyleArrangement.push({\n cellPosition: {\n col: cellPos.col,\n row: cellPos.row,\n range: cellPos.range\n },\n customStyleId: customStyleId\n });\n } else if (this.customCellStyleArrangement[index].customStyleId === customStyleId) {\n // same style\n return;\n } else if (customStyleId) {\n // update style\n this.customCellStyleArrangement[index].customStyleId = customStyleId;\n } else {\n // delete useless style\n this.customCellStyleArrangement.splice(index, 1);\n }\n\n const style = this.getCustomCellStyleOption(customStyleId)?.style;\n // let forceFastUpdate;\n if (style) {\n forceFastUpdate = true;\n for (const key in style) {\n if (cellStyleKeys.indexOf(key) === -1) {\n forceFastUpdate = false;\n break;\n }\n }\n }\n\n // update cell group\n if (cellPos.range) {\n for (\n let col = Math.max(0, cellPos.range.start.col);\n col <= Math.min(this.table.colCount - 1, cellPos.range.end.col);\n col++\n ) {\n for (\n let row = Math.max(0, cellPos.range.start.row);\n row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row);\n row++\n ) {\n const range = this.table.getCellRange(col, row);\n for (let c = range.start.col; c <= range.end.col; c++) {\n for (let r = range.start.row; r <= range.end.row; r++) {\n this.table.scenegraph.updateCellContent(c, r, forceFastUpdate);\n }\n }\n // this.table.scenegraph.updateCellContent(col, row);\n }\n }\n } else {\n this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row, forceFastUpdate);\n }\n\n this.table.scenegraph.updateNextFrame();\n }\n\n updateCustomCell(customCellStyle: CustomCellStyle[], customCellStyleArrangement: CustomCellStyleArrangement[]) {\n this.customCellStyle.length = 0;\n this.customCellStyleArrangement.length = 0;\n customCellStyle.forEach((cellStyle: CustomCellStyle) => {\n this.registerCustomCellStyle(cellStyle.id, cellStyle.style);\n });\n customCellStyleArrangement.forEach((cellStyle: CustomCellStyleArrangement) => {\n this.arrangeCustomCellStyle(cellStyle.cellPosition, cellStyle.customStyleId);\n });\n }\n\n hasCustomCellStyle(customStyleId: string) {\n return this.customCellStyle.some(style => style.id === customStyleId);\n }\n}\n\nexport function mergeStyle(cacheStyle: Style, customCellStyle: ColumnStyleOption): Style {\n cacheStyle = cacheStyle.clone();\n\n for (const key in customCellStyle) {\n const value = (customCellStyle as any)[key];\n if (isValid(value)) {\n (cacheStyle as any)[`_${key}`] = value;\n }\n }\n\n return cacheStyle;\n}\n\nexport const registerCustomCellStylePlugin = () => {\n Factory.registerComponent('customCellStylePlugin', CustomCellStylePlugin);\n};\n\n// export type ICustomCellStylePlugin = typeof CustomCellStylePlugin;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/plugins/custom-cell-style.ts"],"names":[],"mappings":";;;AAAA,6CAA8D;AAE9D,0CAMqB;AAErB,6CAA0C;AAU1C,MAAa,qBAAqB;IAOhC,YACE,KAAmB,EACnB,eAAkC,EAClC,0BAAwD;QAExD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,0BAA0B,GAAG,0BAA0B,CAAC;QAC7D,IAAI,CAAC,gCAAgC,GAAG,IAAI,GAAG,EAAE,CAAC;QAClD,IAAI,CAAC,yCAAyC,GAAG,CAAC,CAAC;QACnD,IAAI,CAAC,uCAAuC,EAAE,CAAC;IACjD,CAAC;IAEO,iCAAiC,CAAC,OAA0D;QAClG,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC;YACrC,OAAO,SAAS,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC;SAChE;QACD,IAAI,OAA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0BAA0B,CAAC,OAAO,CAAC,CAAC,SAAqC,EAAE,EAAE;YAC3E,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,YAAY,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;IACL,CAAC;IAED,kBAAkB,CAAC,aAAqB;QACtC,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,aAAa,CAAC,CAAC;IACxE,CAAC;CACF;AA3TD,sDA2TC;AAED,SAAgB,UAAU,CAAC,UAAiB,EAAE,eAAkC;IAC9E,UAAU,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC;IAEhC,KAAK,MAAM,GAAG,IAAI,eAAe,EAAE;QACjC,MAAM,KAAK,GAAI,eAAuB,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,IAAA,gBAAO,EAAC,KAAK,CAAC,EAAE;YACjB,UAAkB,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;SACxC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAXD,gCAWC;AAEM,MAAM,6BAA6B,GAAG,GAAG,EAAE;IAChD,iBAAO,CAAC,iBAAiB,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;AAC5E,CAAC,CAAC;AAFW,QAAA,6BAA6B,iCAExC","file":"custom-cell-style.js","sourcesContent":["import { isFunction, isValid, merge } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../ts-types/base-table';\nimport {\n cellStyleKeys,\n type CellRange,\n type ColumnStyleOption,\n type CustomCellStyle,\n type CustomCellStyleArrangement\n} from '../ts-types';\nimport type { Style } from '../body-helper/style';\nimport { Factory } from '../core/factory';\nimport type { StylePropertyFunctionArg } from '../ts-types/style-define';\nexport interface ICustomCellStylePlugin {\n new (\n table: BaseTableAPI,\n customCellStyle: CustomCellStyle[],\n customCellStyleArrangement: CustomCellStyleArrangement[]\n ): CustomCellStylePlugin;\n}\n\nexport class CustomCellStylePlugin {\n table: BaseTableAPI;\n customCellStyle: CustomCellStyle[];\n customCellStyleArrangement: CustomCellStyleArrangement[];\n private _customCellStyleArrangementIndex: Map<string, number>;\n private _customCellStyleArrangementTombstoneCount: number;\n\n constructor(\n table: BaseTableAPI,\n customCellStyle: CustomCellStyle[],\n customCellStyleArrangement: CustomCellStyleArrangement[]\n ) {\n this.table = table;\n this.customCellStyle = customCellStyle;\n this.customCellStyleArrangement = customCellStyleArrangement;\n this._customCellStyleArrangementIndex = new Map();\n this._customCellStyleArrangementTombstoneCount = 0;\n this._rebuildCustomCellStyleArrangementIndex();\n }\n\n private _getCustomCellStyleArrangementKey(cellPos: { col?: number; row?: number; range?: CellRange }) {\n if (cellPos.range) {\n const { start, end } = cellPos.range;\n return `range:${start.col},${start.row},${end.col},${end.row}`;\n }\n if (cellPos.col === undefined || cellPos.row === undefined) {\n return undefined;\n }\n return `cell:${cellPos.col},${cellPos.row}`;\n }\n\n private _rebuildCustomCellStyleArrangementIndex() {\n this._customCellStyleArrangementIndex.clear();\n this._customCellStyleArrangementTombstoneCount = 0;\n for (let i = 0; i < this.customCellStyleArrangement.length; i++) {\n if (!isValid((this.customCellStyleArrangement[i] as any).customStyleId)) {\n this._customCellStyleArrangementTombstoneCount++;\n continue;\n }\n const key = this._getCustomCellStyleArrangementKey(this.customCellStyleArrangement[i].cellPosition);\n if (key) {\n this._customCellStyleArrangementIndex.set(key, i);\n }\n }\n }\n\n private _compactCustomCellStyleArrangementIfNeeded() {\n const length = this.customCellStyleArrangement.length;\n if (this._customCellStyleArrangementTombstoneCount < 2048) {\n return;\n }\n if (this._customCellStyleArrangementTombstoneCount * 4 < length) {\n return;\n }\n const compacted = this.customCellStyleArrangement.filter(style => isValid((style as any).customStyleId));\n if (compacted.length === this.customCellStyleArrangement.length) {\n this._customCellStyleArrangementTombstoneCount = 0;\n return;\n }\n this.customCellStyleArrangement.length = 0;\n this.customCellStyleArrangement.push(...compacted);\n this._rebuildCustomCellStyleArrangementIndex();\n }\n\n getCustomCellStyle(col: number, row: number) {\n const customStyleIds = this.getCustomCellStyleIds(col, row);\n if (customStyleIds.length) {\n const styles: ColumnStyleOption[] = [];\n\n customStyleIds.forEach(customStyleId => {\n const styleOption = this.getCustomCellStyleOption(customStyleId);\n if (isFunction(styleOption?.style)) {\n const style = styleOption.style({\n col,\n row,\n table: this.table,\n value: this.table.getCellValue(col, row),\n dataValue: this.table.getCellOriginValue(col, row),\n cellHeaderPaths: this.table.getCellHeaderPaths(col, row)\n });\n styles.push(style);\n } else if (styleOption?.style) {\n styles.push(styleOption.style);\n }\n });\n\n if (!styles.length) {\n return undefined;\n }\n return merge({}, ...styles);\n // const styleOption = this.getCustomCellStyleOption(customStyleId);\n // return styleOption?.style;\n }\n return undefined;\n }\n\n getCustomCellStyleIds(col: number, row: number) {\n // let customStyleId;\n const customStyleIds: string[] = [];\n\n const range = this.table.getCellRange(col, row);\n for (let c = range.start.col; c <= range.end.col; c++) {\n for (let r = range.start.row; r <= range.end.row; r++) {\n // eslint-disable-next-line no-loop-func\n this.customCellStyleArrangement.forEach(style => {\n if (!isValid(style.customStyleId)) {\n return;\n }\n if (style.cellPosition.range) {\n if (\n style.cellPosition.range.start.col <= c &&\n style.cellPosition.range.end.col >= c &&\n style.cellPosition.range.start.row <= r &&\n style.cellPosition.range.end.row >= r\n ) {\n // customStyleId = style.customStyleId;\n customStyleIds.push(style.customStyleId as string);\n }\n } else if (style.cellPosition.col === c && style.cellPosition.row === r) {\n // customStyleId = style.customStyleId;\n customStyleIds.push(style.customStyleId as string);\n }\n });\n }\n }\n\n return customStyleIds;\n }\n\n getCustomCellStyleOption(customStyleId: string) {\n return this.customCellStyle.find(style => style.id === customStyleId);\n }\n\n registerCustomCellStyle(\n customStyleId: string,\n customStyle: ColumnStyleOption | ((styleArg: StylePropertyFunctionArg) => ColumnStyleOption) | undefined | null\n ) {\n const index = this.customCellStyle.findIndex(style => style.id === customStyleId);\n if (index === -1) {\n this.customCellStyle.push({\n id: customStyleId,\n style: customStyle\n });\n } else {\n this.customCellStyle[index] = {\n id: customStyleId,\n style: customStyle\n };\n }\n\n this.customCellStyleArrangement.forEach(cellStyle => {\n const cellPos = cellStyle.cellPosition;\n if (cellStyle.customStyleId === customStyleId) {\n if (cellPos.range) {\n for (\n let col = Math.max(0, cellPos.range.start.col);\n col <= Math.min(this.table.colCount - 1, cellPos.range.end.col);\n col++\n ) {\n for (\n let row = Math.max(0, cellPos.range.start.row);\n row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row);\n row++\n ) {\n this.table.scenegraph.updateCellContent(col, row);\n }\n }\n } else {\n this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row);\n }\n }\n });\n this.table.scenegraph.updateNextFrame();\n }\n\n arrangeCustomCellStyle(\n cellPos: {\n col?: number;\n row?: number;\n range?: CellRange;\n },\n customStyleId: string | undefined | null,\n forceFastUpdate?: boolean\n ) {\n const inputKey = this._getCustomCellStyleArrangementKey(cellPos);\n let index = inputKey ? this._customCellStyleArrangementIndex.get(inputKey) ?? -1 : -1;\n if (inputKey && index !== -1) {\n const item = this.customCellStyleArrangement[index];\n const itemKey = item ? this._getCustomCellStyleArrangementKey(item.cellPosition) : undefined;\n if (!item || !isValid((item as any).customStyleId) || itemKey !== inputKey) {\n index = this.customCellStyleArrangement.findIndex(style => {\n if (!isValid((style as any).customStyleId)) {\n return false;\n }\n return this._getCustomCellStyleArrangementKey(style.cellPosition) === inputKey;\n });\n if (index !== -1) {\n this._customCellStyleArrangementIndex.set(inputKey, index);\n } else {\n this._customCellStyleArrangementIndex.delete(inputKey);\n }\n }\n }\n if (index === -1 && !inputKey) {\n index = this.customCellStyleArrangement.findIndex(style => {\n if (!isValid((style as any).customStyleId)) {\n return false;\n }\n if (style.cellPosition.range && cellPos.range) {\n return (\n style.cellPosition.range.start.col === cellPos.range.start.col &&\n style.cellPosition.range.start.row === cellPos.range.start.row &&\n style.cellPosition.range.end.col === cellPos.range.end.col &&\n style.cellPosition.range.end.row === cellPos.range.end.row\n );\n }\n return style.cellPosition.col === cellPos.col && style.cellPosition.row === cellPos.row;\n });\n }\n\n if (index === -1 && !customStyleId) {\n // do nothing\n return;\n } else if (index === -1 && customStyleId) {\n // add new style\n this.customCellStyleArrangement.push({\n cellPosition: {\n col: cellPos.col,\n row: cellPos.row,\n range: cellPos.range\n },\n customStyleId: customStyleId\n });\n const pushedIndex = this.customCellStyleArrangement.length - 1;\n const pushedKey = this._getCustomCellStyleArrangementKey(\n this.customCellStyleArrangement[pushedIndex].cellPosition\n );\n if (pushedKey) {\n this._customCellStyleArrangementIndex.set(pushedKey, pushedIndex);\n }\n } else if (this.customCellStyleArrangement[index].customStyleId === customStyleId) {\n // same style\n return;\n } else if (customStyleId) {\n // update style\n this.customCellStyleArrangement[index].customStyleId = customStyleId;\n } else {\n // delete useless style\n const existedKey = this._getCustomCellStyleArrangementKey(this.customCellStyleArrangement[index].cellPosition);\n if (isValid((this.customCellStyleArrangement[index] as any).customStyleId)) {\n this._customCellStyleArrangementTombstoneCount++;\n }\n (this.customCellStyleArrangement[index] as any).customStyleId = null;\n if (existedKey) {\n this._customCellStyleArrangementIndex.delete(existedKey);\n }\n this._compactCustomCellStyleArrangementIfNeeded();\n }\n\n const style = customStyleId ? this.getCustomCellStyleOption(customStyleId)?.style : undefined;\n // let forceFastUpdate;\n if (style) {\n forceFastUpdate = true;\n for (const key in style) {\n if (cellStyleKeys.indexOf(key) === -1) {\n forceFastUpdate = false;\n break;\n }\n }\n }\n\n // update cell group\n if (cellPos.range) {\n for (\n let col = Math.max(0, cellPos.range.start.col);\n col <= Math.min(this.table.colCount - 1, cellPos.range.end.col);\n col++\n ) {\n for (\n let row = Math.max(0, cellPos.range.start.row);\n row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row);\n row++\n ) {\n const range = this.table.getCellRange(col, row);\n for (let c = range.start.col; c <= range.end.col; c++) {\n for (let r = range.start.row; r <= range.end.row; r++) {\n this.table.scenegraph.updateCellContent(c, r, forceFastUpdate);\n }\n }\n // this.table.scenegraph.updateCellContent(col, row);\n }\n }\n } else {\n this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row, forceFastUpdate);\n }\n\n this.table.scenegraph.updateNextFrame();\n }\n\n updateCustomCell(customCellStyle: CustomCellStyle[], customCellStyleArrangement: CustomCellStyleArrangement[]) {\n this.customCellStyle.length = 0;\n this.customCellStyleArrangement.length = 0;\n this._customCellStyleArrangementIndex.clear();\n this._customCellStyleArrangementTombstoneCount = 0;\n customCellStyle.forEach((cellStyle: CustomCellStyle) => {\n this.registerCustomCellStyle(cellStyle.id, cellStyle.style);\n });\n customCellStyleArrangement.forEach((cellStyle: CustomCellStyleArrangement) => {\n this.arrangeCustomCellStyle(cellStyle.cellPosition, cellStyle.customStyleId);\n });\n }\n\n hasCustomCellStyle(customStyleId: string) {\n return this.customCellStyle.some(style => style.id === customStyleId);\n }\n}\n\nexport function mergeStyle(cacheStyle: Style, customCellStyle: ColumnStyleOption): Style {\n cacheStyle = cacheStyle.clone();\n\n for (const key in customCellStyle) {\n const value = (customCellStyle as any)[key];\n if (isValid(value)) {\n (cacheStyle as any)[`_${key}`] = value;\n }\n }\n\n return cacheStyle;\n}\n\nexport const registerCustomCellStylePlugin = () => {\n Factory.registerComponent('customCellStylePlugin', CustomCellStylePlugin);\n};\n\n// export type ICustomCellStylePlugin = typeof CustomCellStylePlugin;\n"]}
|
package/cjs/plugins/interface.js
CHANGED
|
@@ -19,4 +19,5 @@ function onBeforeAttributeUpdateForInvertHighlight(val, attribute) {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
exports.onBeforeAttributeUpdateForInvertHighlight = onBeforeAttributeUpdateForInvertHighlight;
|
|
22
|
+
exports.onBeforeAttributeUpdateForInvertHighlight = onBeforeAttributeUpdateForInvertHighlight;
|
|
23
|
+
//# sourceMappingURL=invert-highlight.js.map
|
|
@@ -1,26 +1,13 @@
|
|
|
1
1
|
import type { BaseTableAPI } from '../../ts-types/base-table';
|
|
2
|
-
export declare function setBrushingChartInstance(chartInstance: any, col: number, row: number): void;
|
|
3
|
-
export declare function clearBrushingChartInstance(): void;
|
|
4
|
-
export declare function getBrushingChartInstance(): any;
|
|
5
|
-
export declare function getBrushingChartInstanceCellPos(): {
|
|
6
|
-
col: number;
|
|
7
|
-
row: number;
|
|
8
|
-
};
|
|
9
2
|
export declare const chartInstanceListColumnByColumnDirection: Record<number, Record<number, any>>;
|
|
10
3
|
export declare const chartInstanceListRowByRowDirection: Record<number, Record<number, any>>;
|
|
11
4
|
export declare function generateChartInstanceListByColumnDirection(col: number, dimensionValueOrXValue: string, positionValueOrYValue: string | number, canvasXY: {
|
|
12
5
|
x: number;
|
|
13
6
|
y: number;
|
|
14
7
|
}, table: BaseTableAPI, hideTooltip?: boolean, isScatter?: boolean): void;
|
|
8
|
+
export declare function clearChartInstanceListByColumnDirection(col: number, excludedRow: number, table: BaseTableAPI): void;
|
|
15
9
|
export declare function generateChartInstanceListByRowDirection(row: number, dimensionValueOrXValue: string, positionValueOrYValue: string | number, canvasXY: {
|
|
16
10
|
x: number;
|
|
17
11
|
y: number;
|
|
18
12
|
}, table: BaseTableAPI, hideTooltip?: boolean, isScatter?: boolean): void;
|
|
19
|
-
export declare function
|
|
20
|
-
export declare function clearChartInstanceListByColumnDirection(col: number, excludedRow: number, table: BaseTableAPI, forceRelease?: boolean): void;
|
|
21
|
-
export declare function clearChartInstanceListByRowDirection(row: number, excludedCol: number, table: BaseTableAPI, forceRelease?: boolean): void;
|
|
22
|
-
export declare function clearDelayRunDimensionHoverTimers(): void;
|
|
23
|
-
export declare function clearAllChartInstanceList(table: BaseTableAPI, forceRelease?: boolean): void;
|
|
24
|
-
export declare function isDisabledShowTooltipToAllChartInstances(): boolean;
|
|
25
|
-
export declare function disableTooltipToAllChartInstances(): void;
|
|
26
|
-
export declare function enableTooltipToAllChartInstances(): void;
|
|
13
|
+
export declare function clearChartInstanceListByRowDirection(row: number, excludedCol: number, table: BaseTableAPI): void;
|