@visactor/vtable 1.5.2-alpha.0 → 1.5.2
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.js +8 -8
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/components/react/react-custom-layout.d.ts +8 -8
- package/cjs/components/react/react-custom-layout.js +123 -12
- package/cjs/components/react/react-custom-layout.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +2 -0
- package/cjs/core/BaseTable.js +7 -1
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/utils/get-cell-position.js.map +1 -1
- package/cjs/data/DataSource.js +4 -2
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/dataset/dataset.js +3 -3
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/edit/edit-manager.js +2 -1
- package/cjs/event/event.d.ts +3 -0
- package/cjs/event/event.js +9 -4
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.js +2 -2
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/touch.js +12 -14
- package/cjs/event/listener/touch.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.d.ts +1 -0
- package/cjs/layout/chart-helper/get-axis-config.js +27 -8
- package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
- package/cjs/layout/chart-helper/get-chart-spec.js +6 -6
- package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/cjs/layout/pivot-header-layout.d.ts +15 -3
- package/cjs/layout/pivot-header-layout.js +66 -28
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/tree-helper.js +2 -2
- package/cjs/layout/tree-helper.js.map +1 -1
- package/cjs/scenegraph/component/custom.js +3 -1
- package/cjs/scenegraph/component/custom.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +6 -3
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +17 -11
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +13 -10
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-height.js +1 -0
- package/cjs/scenegraph/layout/update-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-width.js +1 -0
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/scenegraph.js +12 -2
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/utils/break-string.js +2 -1
- package/cjs/scenegraph/utils/break-string.js.map +1 -1
- package/cjs/tools/join.d.ts +1 -0
- package/cjs/tools/join.js +12 -0
- package/cjs/tools/join.js.map +1 -0
- package/cjs/ts-types/base-table.d.ts +4 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +457 -112
- package/dist/vtable.min.js +2 -2
- package/es/PivotChart.js +9 -7
- package/es/PivotChart.js.map +1 -1
- package/es/components/react/react-custom-layout.d.ts +8 -8
- package/es/components/react/react-custom-layout.js +123 -12
- package/es/components/react/react-custom-layout.js.map +1 -1
- package/es/core/BaseTable.d.ts +2 -0
- package/es/core/BaseTable.js +7 -1
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/utils/get-cell-position.js.map +1 -1
- package/es/data/DataSource.js +4 -2
- package/es/data/DataSource.js.map +1 -1
- package/es/dataset/dataset.js +4 -2
- package/es/dataset/dataset.js.map +1 -1
- package/es/edit/edit-manager.js +2 -1
- package/es/event/event.d.ts +3 -0
- package/es/event/event.js +9 -4
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.js +2 -2
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/touch.js +12 -14
- package/es/event/listener/touch.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.d.ts +1 -0
- package/es/layout/chart-helper/get-axis-config.js +25 -6
- package/es/layout/chart-helper/get-axis-config.js.map +1 -1
- package/es/layout/chart-helper/get-chart-spec.js +6 -6
- package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/es/layout/pivot-header-layout.d.ts +15 -3
- package/es/layout/pivot-header-layout.js +64 -28
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/tree-helper.js +2 -2
- package/es/layout/tree-helper.js.map +1 -1
- package/es/scenegraph/component/custom.js +3 -1
- package/es/scenegraph/component/custom.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +6 -3
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +17 -11
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +13 -10
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/layout/update-height.js +1 -0
- package/es/scenegraph/layout/update-height.js.map +1 -1
- package/es/scenegraph/layout/update-width.js +1 -0
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/scenegraph.js +9 -2
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/utils/break-string.js +2 -1
- package/es/scenegraph/utils/break-string.js.map +1 -1
- package/es/tools/join.d.ts +1 -0
- package/es/tools/join.js +6 -0
- package/es/tools/join.js.map +1 -0
- package/es/ts-types/base-table.d.ts +4 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +3 -3
|
@@ -7,15 +7,15 @@ export declare function emptyCustomLayout(args: CustomRenderFunctionArg): {
|
|
|
7
7
|
};
|
|
8
8
|
export declare class ReactCustomLayout {
|
|
9
9
|
table: BaseTableAPI;
|
|
10
|
-
customLayoutFuncCache: Map<
|
|
11
|
-
reactRemoveGraphicCache: Map<
|
|
12
|
-
headerCustomLayoutFuncCache: Map<
|
|
13
|
-
headerReactRemoveGraphicCache: Map<
|
|
10
|
+
customLayoutFuncCache: Map<string, ICustomLayoutFuc>;
|
|
11
|
+
reactRemoveGraphicCache: Map<string, (col: number, row: number) => void>;
|
|
12
|
+
headerCustomLayoutFuncCache: Map<string, ICustomLayoutFuc>;
|
|
13
|
+
headerReactRemoveGraphicCache: Map<string, (col: number, row: number) => void>;
|
|
14
14
|
constructor(table: BaseTableAPI);
|
|
15
|
-
hasReactCreateGraphic(
|
|
16
|
-
setReactCreateGraphic(
|
|
17
|
-
setReactRemoveGraphic(
|
|
18
|
-
updateCustomCell(
|
|
15
|
+
hasReactCreateGraphic(componentId: string, isHeaderCustomLayout?: boolean): boolean;
|
|
16
|
+
setReactCreateGraphic(componentId: string, createGraphic: ICustomLayoutFuc, isHeaderCustomLayout?: boolean): void;
|
|
17
|
+
setReactRemoveGraphic(componentId: string, removeGraphic: (col: number, row: number) => void, isHeaderCustomLayout?: boolean): void;
|
|
18
|
+
updateCustomCell(componentId: string, isHeaderCustomLayout?: boolean): void;
|
|
19
19
|
getCustomLayoutFunc(col: number, row: number): ICustomLayoutFuc | typeof emptyCustomLayout;
|
|
20
20
|
removeCustomCell(col: number, row: number): void;
|
|
21
21
|
}
|
|
@@ -12,27 +12,138 @@ export class ReactCustomLayout {
|
|
|
12
12
|
this.table = table, this.customLayoutFuncCache = new Map, this.reactRemoveGraphicCache = new Map,
|
|
13
13
|
this.headerCustomLayoutFuncCache = new Map, this.headerReactRemoveGraphicCache = new Map;
|
|
14
14
|
}
|
|
15
|
-
hasReactCreateGraphic(
|
|
16
|
-
return isHeaderCustomLayout ? this.headerCustomLayoutFuncCache.has(
|
|
15
|
+
hasReactCreateGraphic(componentId, isHeaderCustomLayout) {
|
|
16
|
+
return isHeaderCustomLayout ? this.headerCustomLayoutFuncCache.has(componentId) : this.customLayoutFuncCache.has(componentId);
|
|
17
17
|
}
|
|
18
|
-
setReactCreateGraphic(
|
|
19
|
-
isHeaderCustomLayout ? this.headerCustomLayoutFuncCache.set(
|
|
18
|
+
setReactCreateGraphic(componentId, createGraphic, isHeaderCustomLayout) {
|
|
19
|
+
isHeaderCustomLayout ? this.headerCustomLayoutFuncCache.set(componentId, createGraphic) : this.customLayoutFuncCache.set(componentId, createGraphic);
|
|
20
20
|
}
|
|
21
|
-
setReactRemoveGraphic(
|
|
22
|
-
isHeaderCustomLayout ? this.headerReactRemoveGraphicCache.set(
|
|
21
|
+
setReactRemoveGraphic(componentId, removeGraphic, isHeaderCustomLayout) {
|
|
22
|
+
isHeaderCustomLayout ? this.headerReactRemoveGraphicCache.set(componentId, removeGraphic) : this.reactRemoveGraphicCache.set(componentId, removeGraphic);
|
|
23
23
|
}
|
|
24
|
-
updateCustomCell(
|
|
25
|
-
const table = this.table
|
|
26
|
-
if (
|
|
24
|
+
updateCustomCell(componentId, isHeaderCustomLayout) {
|
|
25
|
+
const table = this.table;
|
|
26
|
+
if (table.isPivotTable()) {
|
|
27
|
+
const ranges = getUpdateCustomCellRangeInPivotTable(componentId, table, isHeaderCustomLayout);
|
|
28
|
+
for (let i = 0; i < ranges.length; i++) {
|
|
29
|
+
const range = ranges[i];
|
|
30
|
+
for (let col = range.start.col; col <= range.end.col; col++) for (let row = range.start.row; row <= range.end.row; row++) table.scenegraph.updateCellContent(col, row);
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
const range = getUpdateCustomCellRangeInListTable(componentId, table, isHeaderCustomLayout);
|
|
34
|
+
for (let col = range.start.col; col <= range.end.col; col++) for (let row = range.start.row; row <= range.end.row; row++) table.scenegraph.updateCellContent(col, row);
|
|
35
|
+
}
|
|
27
36
|
table.scenegraph.renderSceneGraph();
|
|
28
37
|
}
|
|
29
38
|
getCustomLayoutFunc(col, row) {
|
|
30
|
-
|
|
31
|
-
|
|
39
|
+
var _a;
|
|
40
|
+
if (this.table.isHeader(col, row)) {
|
|
41
|
+
const {componentId: componentId} = this.table.getHeaderDefine(col, row);
|
|
42
|
+
return null !== (_a = this.headerCustomLayoutFuncCache.get(componentId)) && void 0 !== _a ? _a : emptyCustomLayout;
|
|
43
|
+
}
|
|
44
|
+
const {componentId: componentId} = this.table.getBodyColumnDefine(col, row);
|
|
45
|
+
return this.customLayoutFuncCache.get(componentId) || emptyCustomLayout;
|
|
32
46
|
}
|
|
33
47
|
removeCustomCell(col, row) {
|
|
34
|
-
|
|
48
|
+
let removeFun;
|
|
49
|
+
if (this.table.isHeader(col, row)) {
|
|
50
|
+
const define = this.table.getHeaderDefine(col, row), {componentId: componentId} = define;
|
|
51
|
+
removeFun = this.headerReactRemoveGraphicCache.get(componentId);
|
|
52
|
+
} else {
|
|
53
|
+
const define = this.table.getBodyColumnDefine(col, row), {componentId: componentId} = define;
|
|
54
|
+
removeFun = this.reactRemoveGraphicCache.get(componentId);
|
|
55
|
+
}
|
|
35
56
|
removeFun && removeFun(col, row);
|
|
36
57
|
}
|
|
37
58
|
}
|
|
59
|
+
|
|
60
|
+
function getUpdateCustomCellRangeInListTable(componentId, table, isHeaderCustomLayout) {
|
|
61
|
+
const rowSeriesNumber = table.internalProps.rowSeriesNumber ? 1 : 0;
|
|
62
|
+
if (isHeaderCustomLayout) {
|
|
63
|
+
const layoutMap = table.internalProps.layoutMap, {headerObjects: headerObjects} = table.internalProps.layoutMap;
|
|
64
|
+
let headerId;
|
|
65
|
+
for (let i = 0; i < headerObjects.length; i++) {
|
|
66
|
+
const headerObject = headerObjects[i];
|
|
67
|
+
if (headerObject.define.componentId === componentId) {
|
|
68
|
+
headerId = headerObject.id;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const startCell = layoutMap.getHeaderCellAdressById(headerId);
|
|
73
|
+
return layoutMap.getCellRange(startCell.col, startCell.row);
|
|
74
|
+
}
|
|
75
|
+
const {columnObjects: columnObjects} = table.internalProps.layoutMap;
|
|
76
|
+
for (let i = 0; i < columnObjects.length; i++) {
|
|
77
|
+
if (columnObjects[i].define.componentId === componentId) return {
|
|
78
|
+
start: {
|
|
79
|
+
col: rowSeriesNumber + i,
|
|
80
|
+
row: table.columnHeaderLevelCount
|
|
81
|
+
},
|
|
82
|
+
end: {
|
|
83
|
+
col: rowSeriesNumber + i,
|
|
84
|
+
row: table.rowCount - 1
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
start: {
|
|
90
|
+
col: 0,
|
|
91
|
+
row: 0
|
|
92
|
+
},
|
|
93
|
+
end: {
|
|
94
|
+
col: table.colCount - 1,
|
|
95
|
+
row: table.rowCount - 1
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function getUpdateCustomCellRangeInPivotTable(componentId, table, isHeaderCustomLayout) {
|
|
101
|
+
const rowSeriesNumber = table.internalProps.rowSeriesNumber ? 1 : 0, ranges = [], layoutMap = table.internalProps.layoutMap;
|
|
102
|
+
if (isHeaderCustomLayout) {
|
|
103
|
+
const {headerObjects: headerObjects} = layoutMap, headerIds = [];
|
|
104
|
+
for (let i = 0; i < headerObjects.length; i++) {
|
|
105
|
+
const headerObject = headerObjects[i];
|
|
106
|
+
headerObject && (headerObject.define.componentId === componentId && headerIds.push(headerObject.id));
|
|
107
|
+
}
|
|
108
|
+
for (let i = 0; i < headerIds.length; i++) {
|
|
109
|
+
const headerId = headerIds[i], startCell = layoutMap.getHeaderCellAdressById(headerId), range = layoutMap.getCellRange(startCell.col, startCell.row);
|
|
110
|
+
ranges.push(range);
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
let columnIndex;
|
|
114
|
+
const {columnObjects: columnObjects, indicatorsAsCol: indicatorsAsCol} = layoutMap;
|
|
115
|
+
for (let i = 0; i < columnObjects.length; i++) {
|
|
116
|
+
if (columnObjects[i].define.componentId === componentId) {
|
|
117
|
+
columnIndex = i;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (indicatorsAsCol) for (let column = layoutMap.rowHeaderLevelCount + columnIndex; column < layoutMap.colCount; column += columnObjects.length) {
|
|
122
|
+
const range = {
|
|
123
|
+
start: {
|
|
124
|
+
col: column + rowSeriesNumber,
|
|
125
|
+
row: layoutMap.columnHeaderLevelCount
|
|
126
|
+
},
|
|
127
|
+
end: {
|
|
128
|
+
col: column + rowSeriesNumber,
|
|
129
|
+
row: layoutMap.rowCount - 1
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
ranges.push(range);
|
|
133
|
+
} else for (let row = layoutMap.columnHeaderLevelCount + columnIndex; row < layoutMap.rowCount; row += columnObjects.length) {
|
|
134
|
+
const range = {
|
|
135
|
+
start: {
|
|
136
|
+
col: layoutMap.rowHeaderLevelCount + rowSeriesNumber,
|
|
137
|
+
row: row
|
|
138
|
+
},
|
|
139
|
+
end: {
|
|
140
|
+
col: layoutMap.colCount - 1,
|
|
141
|
+
row: row
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
ranges.push(range);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return ranges;
|
|
148
|
+
}
|
|
38
149
|
//# sourceMappingURL=react-custom-layout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/react/react-custom-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAIxC,MAAM,UAAU,iBAAiB,CAAC,IAA6B;IAC7D,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5B,OAAO;QACL,aAAa,EAAE,KAAK;QACpB,aAAa,EAAE,IAAI;KACpB,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,iBAAiB;IAO5B,YAAY,KAAmB;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,qBAAqB,GAAG,IAAI,GAAG,EAAE,CAAC;QAEvC,IAAI,CAAC,uBAAuB,GAAG,IAAI,GAAG,EAA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":["import { Group } from './../../vrender';\nimport type { CustomRenderFunctionArg, ICustomLayoutFuc } from '../../ts-types';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\n\nexport function emptyCustomLayout(args: CustomRenderFunctionArg) {\n const group = new Group({});\n return {\n rootContainer: group,\n renderDefault: true\n };\n}\n\nexport class ReactCustomLayout {\n table: BaseTableAPI;\n customLayoutFuncCache: Map<number, ICustomLayoutFuc>;\n reactRemoveGraphicCache: Map<number, (col: number, row: number) => void>;\n headerCustomLayoutFuncCache: Map<number, ICustomLayoutFuc>;\n headerReactRemoveGraphicCache: Map<number, (col: number, row: number) => void>;\n // reactContainerCache: Map<number, Map<string, any>>;\n constructor(table: BaseTableAPI) {\n this.table = table;\n this.customLayoutFuncCache = new Map();\n // this.reactContainerCache = new Map();\n this.reactRemoveGraphicCache = new Map();\n this.headerCustomLayoutFuncCache = new Map();\n // this.headerCeactContainerCache = new Map();\n this.headerReactRemoveGraphicCache = new Map();\n }\n\n hasReactCreateGraphic(componentIndex: number, isHeaderCustomLayout?: boolean) {\n if (isHeaderCustomLayout) {\n return this.headerCustomLayoutFuncCache.has(componentIndex);\n }\n return this.customLayoutFuncCache.has(componentIndex);\n }\n\n setReactCreateGraphic(\n componentIndex: number,\n createGraphic: ICustomLayoutFuc,\n // containerCache: Map<string, any>,\n isHeaderCustomLayout?: boolean\n ) {\n if (isHeaderCustomLayout) {\n this.headerCustomLayoutFuncCache.set(componentIndex, createGraphic);\n } else {\n this.customLayoutFuncCache.set(componentIndex, createGraphic);\n }\n // this.reactContainerCache.set(componentIndex, containerCache);\n }\n\n setReactRemoveGraphic(\n componentIndex: number,\n removeGraphic: (col: number, row: number) => void,\n isHeaderCustomLayout?: boolean\n ) {\n if (isHeaderCustomLayout) {\n this.headerReactRemoveGraphicCache.set(componentIndex, removeGraphic);\n } else {\n this.reactRemoveGraphicCache.set(componentIndex, removeGraphic);\n }\n }\n\n updateCustomCell(componentIndex: number, isHeaderCustomLayout?: boolean) {\n const table = this.table;\n const col = componentIndex;\n // to do: deal with transpose table\n if (isHeaderCustomLayout) {\n for (let row = 0; row < table.columnHeaderLevelCount; row++) {\n table.scenegraph.updateCellContent(col, row);\n }\n } else {\n for (let row = table.columnHeaderLevelCount; row < table.rowCount; row++) {\n table.scenegraph.updateCellContent(col, row);\n }\n }\n // table.scenegraph.updateNextFrame();\n table.scenegraph.renderSceneGraph(); // use sync render for faster update\n }\n\n getCustomLayoutFunc(col: number, row: number) {\n const { startInTotal } = this.table.getBodyColumnDefine(col, row) as any;\n const isHeader = this.table.isHeader(col, row);\n return (\n (isHeader ? this.headerCustomLayoutFuncCache.get(startInTotal) : this.customLayoutFuncCache.get(startInTotal)) ||\n emptyCustomLayout\n );\n }\n\n removeCustomCell(col: number, row: number) {\n const { startInTotal } = this.table.getBodyColumnDefine(col, row) as any;\n const isHeader = this.table.isHeader(col, row);\n const removeFun = isHeader\n ? this.headerReactRemoveGraphicCache.get(startInTotal)\n : this.reactRemoveGraphicCache.get(startInTotal);\n if (removeFun) {\n removeFun(col, row);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/react/react-custom-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAMxC,MAAM,UAAU,iBAAiB,CAAC,IAA6B;IAC7D,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5B,OAAO;QACL,aAAa,EAAE,KAAK;QACpB,aAAa,EAAE,IAAI;KACpB,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,iBAAiB;IAO5B,YAAY,KAAmB;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,qBAAqB,GAAG,IAAI,GAAG,EAAE,CAAC;QAEvC,IAAI,CAAC,uBAAuB,GAAG,IAAI,GAAG,EAAE,CAAC;QACzC,IAAI,CAAC,2BAA2B,GAAG,IAAI,GAAG,EAAE,CAAC;QAE7C,IAAI,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AAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC7C,MAAM,YAAY,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;YACtC,IAAK,YAAY,CAAC,MAAc,CAAC,WAAW,KAAK,WAAW,EAAE;gBAC5D,WAAW,GAAG,CAAC,CAAC;gBAChB,MAAM;aACP;SACF;QAED,IAAI,eAAe,EAAE;YACnB,KACE,IAAI,MAAM,GAAG,SAAS,CAAC,mBAAmB,GAAG,WAAW,EACxD,MAAM,GAAG,SAAS,CAAC,QAAQ,EAC3B,MAAM,IAAI,aAAa,CAAC,MAAM,EAC9B;gBACA,MAAM,KAAK,GAAG;oBACZ,KAAK,EAAE;wBACL,GAAG,EAAE,MAAM,GAAG,eAAe;wBAC7B,GAAG,EAAE,SAAS,CAAC,sBAAsB;qBACtC;oBACD,GAAG,EAAE;wBACH,GAAG,EAAE,MAAM,GAAG,eAAe;wBAC7B,GAAG,EAAE,SAAS,CAAC,QAAQ,GAAG,CAAC;qBAC5B;iBACF,CAAC;gBACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACpB;SACF;aAAM;YACL,KACE,IAAI,GAAG,GAAG,SAAS,CAAC,sBAAsB,GAAG,WAAW,EACxD,GAAG,GAAG,SAAS,CAAC,QAAQ,EACxB,GAAG,IAAI,aAAa,CAAC,MAAM,EAC3B;gBACA,MAAM,KAAK,GAAG;oBACZ,KAAK,EAAE;wBACL,GAAG,EAAE,SAAS,CAAC,mBAAmB,GAAG,eAAe;wBACpD,GAAG,EAAE,GAAG;qBACT;oBACD,GAAG,EAAE;wBACH,GAAG,EAAE,SAAS,CAAC,QAAQ,GAAG,CAAC;wBAC3B,GAAG,EAAE,GAAG;qBACT;iBACF,CAAC;gBACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACpB;SACF;KACF;IAED,OAAO,MAAM,CAAC;AAQhB,CAAC","file":"react-custom-layout.js","sourcesContent":["import { Group } from './../../vrender';\nimport type { CustomRenderFunctionArg, ICustomLayoutFuc } from '../../ts-types';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout';\nimport type { SimpleHeaderLayoutMap } from '../../layout';\n\nexport function emptyCustomLayout(args: CustomRenderFunctionArg) {\n const group = new Group({});\n return {\n rootContainer: group,\n renderDefault: true\n };\n}\n\nexport class ReactCustomLayout {\n table: BaseTableAPI;\n customLayoutFuncCache: Map<string, ICustomLayoutFuc>;\n reactRemoveGraphicCache: Map<string, (col: number, row: number) => void>;\n headerCustomLayoutFuncCache: Map<string, ICustomLayoutFuc>;\n headerReactRemoveGraphicCache: Map<string, (col: number, row: number) => void>;\n // reactContainerCache: Map<number, Map<string, any>>;\n constructor(table: BaseTableAPI) {\n this.table = table;\n this.customLayoutFuncCache = new Map();\n // this.reactContainerCache = new Map();\n this.reactRemoveGraphicCache = new Map();\n this.headerCustomLayoutFuncCache = new Map();\n // this.headerCeactContainerCache = new Map();\n this.headerReactRemoveGraphicCache = new Map();\n }\n\n hasReactCreateGraphic(componentId: string, isHeaderCustomLayout?: boolean) {\n if (isHeaderCustomLayout) {\n return this.headerCustomLayoutFuncCache.has(componentId);\n }\n return this.customLayoutFuncCache.has(componentId);\n }\n\n setReactCreateGraphic(\n componentId: string,\n createGraphic: ICustomLayoutFuc,\n // containerCache: Map<string, any>,\n isHeaderCustomLayout?: boolean\n ) {\n if (isHeaderCustomLayout) {\n this.headerCustomLayoutFuncCache.set(componentId, createGraphic);\n } else {\n this.customLayoutFuncCache.set(componentId, createGraphic);\n }\n // this.reactContainerCache.set(componentId, containerCache);\n }\n\n setReactRemoveGraphic(\n componentId: string,\n removeGraphic: (col: number, row: number) => void,\n isHeaderCustomLayout?: boolean\n ) {\n if (isHeaderCustomLayout) {\n this.headerReactRemoveGraphicCache.set(componentId, removeGraphic);\n } else {\n this.reactRemoveGraphicCache.set(componentId, removeGraphic);\n }\n }\n\n updateCustomCell(componentId: string, isHeaderCustomLayout?: boolean) {\n const table = this.table;\n // const col = componentId;\n // // to do: deal with transpose table\n // if (isHeaderCustomLayout) {\n // for (let row = 0; row < table.columnHeaderLevelCount; row++) {\n // table.scenegraph.updateCellContent(col, row);\n // }\n // } else {\n // for (let row = table.columnHeaderLevelCount; row < table.rowCount; row++) {\n // table.scenegraph.updateCellContent(col, row);\n // }\n // }\n\n if (table.isPivotTable()) {\n const ranges = getUpdateCustomCellRangeInPivotTable(componentId, table, isHeaderCustomLayout);\n for (let i = 0; i < ranges.length; i++) {\n const range = ranges[i];\n for (let col = range.start.col; col <= range.end.col; col++) {\n for (let row = range.start.row; row <= range.end.row; row++) {\n table.scenegraph.updateCellContent(col, row);\n }\n }\n }\n } else {\n const range = getUpdateCustomCellRangeInListTable(componentId, table, isHeaderCustomLayout);\n for (let col = range.start.col; col <= range.end.col; col++) {\n for (let row = range.start.row; row <= range.end.row; row++) {\n table.scenegraph.updateCellContent(col, row);\n }\n }\n }\n // table.scenegraph.updateNextFrame();\n table.scenegraph.renderSceneGraph(); // use sync render for faster update\n }\n\n getCustomLayoutFunc(col: number, row: number) {\n const isHeader = this.table.isHeader(col, row);\n if (isHeader) {\n const { componentId } = this.table.getHeaderDefine(col, row) as any;\n return this.headerCustomLayoutFuncCache.get(componentId) ?? emptyCustomLayout;\n }\n const { componentId } = this.table.getBodyColumnDefine(col, row) as any;\n return this.customLayoutFuncCache.get(componentId) || emptyCustomLayout;\n }\n\n removeCustomCell(col: number, row: number) {\n // const { startInTotal } = this.table.getBodyColumnDefine(col, row) as any;\n const isHeader = this.table.isHeader(col, row);\n let removeFun;\n if (isHeader) {\n const define = this.table.getHeaderDefine(col, row);\n const { componentId } = define as any;\n removeFun = this.headerReactRemoveGraphicCache.get(componentId);\n } else {\n const define = this.table.getBodyColumnDefine(col, row);\n const { componentId } = define as any;\n removeFun = this.reactRemoveGraphicCache.get(componentId);\n }\n if (removeFun) {\n removeFun(col, row);\n }\n }\n}\n\nfunction getUpdateCustomCellRangeInListTable(componentId: string, table: BaseTableAPI, isHeaderCustomLayout?: boolean) {\n const rowSeriesNumber = table.internalProps.rowSeriesNumber ? 1 : 0;\n if (isHeaderCustomLayout) {\n const layoutMap = table.internalProps.layoutMap as SimpleHeaderLayoutMap;\n const { headerObjects } = table.internalProps.layoutMap;\n let headerId: number;\n for (let i = 0; i < headerObjects.length; i++) {\n const headerObject = headerObjects[i];\n if ((headerObject.define as any).componentId === componentId) {\n headerId = headerObject.id as number;\n break;\n }\n }\n\n const startCell = layoutMap.getHeaderCellAdressById(headerId);\n const range = layoutMap.getCellRange(startCell.col, startCell.row);\n return range;\n\n // let startCol = -1;\n // let endCol = -1;\n // let startRow = -1;\n // let endRow = -1;\n // for (let i = 0; i < _headerCellIds.length; i++) {\n // const row = _headerCellIds[i];\n // let rowHasObject = false;\n // for (let j = 0; j < row.length; j++) {\n // if (row[j] === headerId) {\n // rowHasObject = true;\n // if (transpose) {\n // // return { col: i, row: j };\n // startCol === -1 && (startCol = i);\n // startRow === -1 && (startRow = j);\n // } else {\n // // return { col: j + this.leftRowSeriesNumberColumnCount, row: i };\n // startCol === -1 && (startCol = j);\n // startRow === -1 && (startRow = i);\n // }\n // } else {\n // if (transpose) {\n // // endCol === -1 && startCol !== -1 && (endCol = i);\n // endRow === -1 && startRow !== -1 && (endRow = j - 1);\n // } else {\n // endCol === -1 && startCol !== -1 && (endCol = j - 1);\n // // endRow === -1 && startRow !== -1 && (endRow = i);\n // }\n // }\n\n // if (startCol !== -1 && endCol !== -1 && startRow !== -1 && endRow !== -1) {\n // break;\n // }\n // }\n\n // if (!rowHasObject) {\n // if (transpose) {\n // endCol === -1 && startCol !== -1 && (endCol = i - 1);\n // } else {\n // endRow === -1 && startRow !== -1 && (endRow = i - 1);\n // }\n // }\n\n // if (startCol !== -1 && endCol !== -1 && startRow !== -1 && endRow !== -1) {\n // break;\n // }\n // }\n\n // return {\n // startCol: startCol + rowSeriesNumber,\n // endCol: endCol + rowSeriesNumber,\n // startRow,\n // endRow\n // };\n }\n const { columnObjects } = table.internalProps.layoutMap;\n for (let i = 0; i < columnObjects.length; i++) {\n const columnObject = columnObjects[i];\n if ((columnObject.define as any).componentId === componentId) {\n return {\n start: {\n col: rowSeriesNumber + i,\n row: table.columnHeaderLevelCount\n },\n end: {\n col: rowSeriesNumber + i,\n row: table.rowCount - 1\n }\n };\n }\n }\n\n return {\n start: {\n col: 0,\n row: 0\n },\n end: {\n col: table.colCount - 1,\n row: table.rowCount - 1\n }\n };\n}\n\nfunction getUpdateCustomCellRangeInPivotTable(\n componentId: string,\n table: BaseTableAPI,\n isHeaderCustomLayout?: boolean\n) {\n const rowSeriesNumber = table.internalProps.rowSeriesNumber ? 1 : 0;\n const ranges = [];\n const layoutMap = table.internalProps.layoutMap as PivotHeaderLayoutMap;\n if (isHeaderCustomLayout) {\n const { headerObjects } = layoutMap;\n const headerIds: number[] = [];\n for (let i = 0; i < headerObjects.length; i++) {\n const headerObject = headerObjects[i];\n if (!headerObject) {\n continue;\n }\n if ((headerObject.define as any).componentId === componentId) {\n headerIds.push(headerObject.id as number);\n }\n }\n\n for (let i = 0; i < headerIds.length; i++) {\n const headerId = headerIds[i];\n const startCell = layoutMap.getHeaderCellAdressById(headerId);\n const range = layoutMap.getCellRange(startCell.col, startCell.row);\n ranges.push(range);\n }\n } else {\n let columnIndex: number;\n const { columnObjects, indicatorsAsCol } = layoutMap;\n for (let i = 0; i < columnObjects.length; i++) {\n const columnObject = columnObjects[i];\n if ((columnObject.define as any).componentId === componentId) {\n columnIndex = i;\n break;\n }\n }\n\n if (indicatorsAsCol) {\n for (\n let column = layoutMap.rowHeaderLevelCount + columnIndex;\n column < layoutMap.colCount;\n column += columnObjects.length\n ) {\n const range = {\n start: {\n col: column + rowSeriesNumber,\n row: layoutMap.columnHeaderLevelCount\n },\n end: {\n col: column + rowSeriesNumber,\n row: layoutMap.rowCount - 1\n }\n };\n ranges.push(range);\n }\n } else {\n for (\n let row = layoutMap.columnHeaderLevelCount + columnIndex;\n row < layoutMap.rowCount;\n row += columnObjects.length\n ) {\n const range = {\n start: {\n col: layoutMap.rowHeaderLevelCount + rowSeriesNumber,\n row: row\n },\n end: {\n col: layoutMap.colCount - 1,\n row: row\n }\n };\n ranges.push(range);\n }\n }\n }\n\n return ranges;\n\n // return {\n // startCol: 0,\n // endCol: table.colCount - 1,\n // startRow: 0,\n // endRow: table.rowCount - 1\n // };\n}\n"]}
|
package/es/core/BaseTable.d.ts
CHANGED
|
@@ -402,4 +402,6 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
402
402
|
get headerDomContainer(): HTMLElement;
|
|
403
403
|
showMoverLine(col: number, row: number): void;
|
|
404
404
|
hideMoverLine(col: number, row: number): void;
|
|
405
|
+
disableScroll(): void;
|
|
406
|
+
enableScroll(): void;
|
|
405
407
|
}
|
package/es/core/BaseTable.js
CHANGED
|
@@ -82,7 +82,7 @@ export class BaseTable extends EventTarget {
|
|
|
82
82
|
}
|
|
83
83
|
constructor(container, options = {}) {
|
|
84
84
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
85
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.5.2
|
|
85
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.5.2", this.id = `VTable${Date.now()}`,
|
|
86
86
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
|
|
87
87
|
!container && "node" !== options.mode) throw new Error("vtable's container is undefined");
|
|
88
88
|
const {frozenColCount: frozenColCount = 0, frozenRowCount: frozenRowCount, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth, widthMode: widthMode = "standard", heightMode: heightMode = "standard", autoFillWidth: autoFillWidth = !1, autoFillHeight: autoFillHeight = !1, widthAdaptiveMode: widthAdaptiveMode = "only-body", heightAdaptiveMode: heightAdaptiveMode = "only-body", keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", dragHeaderMode: dragHeaderMode, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, customRender: customRender, pixelRatio: pixelRatio = defaultPixelRatio, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, mode: mode, modeParams: modeParams, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth, limitMinHeight: limitMinHeight, clearDOM: clearDOM = !0} = options;
|
|
@@ -1778,5 +1778,11 @@ export class BaseTable extends EventTarget {
|
|
|
1778
1778
|
hideMoverLine(col, row) {
|
|
1779
1779
|
this.scenegraph.component.hideMoveCol(), this.scenegraph.renderSceneGraph();
|
|
1780
1780
|
}
|
|
1781
|
+
disableScroll() {
|
|
1782
|
+
this.eventManager.disableScroll();
|
|
1783
|
+
}
|
|
1784
|
+
enableScroll() {
|
|
1785
|
+
this.eventManager.enableScroll();
|
|
1786
|
+
}
|
|
1781
1787
|
}
|
|
1782
1788
|
//# sourceMappingURL=BaseTable.js.map
|