@sisense/sdk-pivot-query-client 2.17.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/LICENSE.md +35 -0
- package/README.md +2 -0
- package/dist/__test-helpers__/testUtils.d.ts +30 -0
- package/dist/__test-helpers__/testUtils.js +89 -0
- package/dist/builders/index.d.ts +2 -0
- package/dist/builders/index.js +2 -0
- package/dist/builders/pivot-data-builder.d.ts +34 -0
- package/dist/builders/pivot-data-builder.js +182 -0
- package/dist/builders/socket-builder.d.ts +18 -0
- package/dist/builders/socket-builder.js +72 -0
- package/dist/cjs/__test-helpers__/testUtils.d.ts +30 -0
- package/dist/cjs/__test-helpers__/testUtils.js +104 -0
- package/dist/cjs/builders/index.d.ts +2 -0
- package/dist/cjs/builders/index.js +7 -0
- package/dist/cjs/builders/pivot-data-builder.d.ts +34 -0
- package/dist/cjs/builders/pivot-data-builder.js +186 -0
- package/dist/cjs/builders/socket-builder.d.ts +18 -0
- package/dist/cjs/builders/socket-builder.js +79 -0
- package/dist/cjs/data-handling/DataService.d.ts +672 -0
- package/dist/cjs/data-handling/DataService.js +1364 -0
- package/dist/cjs/data-handling/DivergenceComparator.d.ts +7 -0
- package/dist/cjs/data-handling/DivergenceComparator.js +20 -0
- package/dist/cjs/data-handling/constants.d.ts +44 -0
- package/dist/cjs/data-handling/constants.js +43 -0
- package/dist/cjs/data-handling/index.d.ts +3 -0
- package/dist/cjs/data-handling/index.js +23 -0
- package/dist/cjs/data-handling/types.d.ts +104 -0
- package/dist/cjs/data-handling/types.js +2 -0
- package/dist/cjs/data-handling/utils/createPivotTreeNode.d.ts +13 -0
- package/dist/cjs/data-handling/utils/createPivotTreeNode.js +21 -0
- package/dist/cjs/data-handling/utils/index.d.ts +4 -0
- package/dist/cjs/data-handling/utils/index.js +14 -0
- package/dist/cjs/data-handling/utils/jaqlProcessor.d.ts +122 -0
- package/dist/cjs/data-handling/utils/jaqlProcessor.js +661 -0
- package/dist/cjs/data-handling/utils/pivotTransforms.d.ts +74 -0
- package/dist/cjs/data-handling/utils/pivotTransforms.js +373 -0
- package/dist/cjs/data-handling/utils/plugins/PluginService.d.ts +135 -0
- package/dist/cjs/data-handling/utils/plugins/PluginService.js +383 -0
- package/dist/cjs/data-handling/utils/plugins/getters.d.ts +23 -0
- package/dist/cjs/data-handling/utils/plugins/getters.js +70 -0
- package/dist/cjs/data-handling/utils/plugins/types.d.ts +75 -0
- package/dist/cjs/data-handling/utils/plugins/types.js +2 -0
- package/dist/cjs/data-handling/utils/plugins/validator.d.ts +13 -0
- package/dist/cjs/data-handling/utils/plugins/validator.js +169 -0
- package/dist/cjs/data-load/AbstractDataLoadService.d.ts +256 -0
- package/dist/cjs/data-load/AbstractDataLoadService.js +473 -0
- package/dist/cjs/data-load/DataLoadService.d.ts +63 -0
- package/dist/cjs/data-load/DataLoadService.js +152 -0
- package/dist/cjs/data-load/SisenseDataLoadService.d.ts +44 -0
- package/dist/cjs/data-load/SisenseDataLoadService.js +87 -0
- package/dist/cjs/data-load/TestDataLoadService.d.ts +27 -0
- package/dist/cjs/data-load/TestDataLoadService.js +76 -0
- package/dist/cjs/data-load/constants.d.ts +13 -0
- package/dist/cjs/data-load/constants.js +28 -0
- package/dist/cjs/data-load/index.d.ts +6 -0
- package/dist/cjs/data-load/index.js +14 -0
- package/dist/cjs/data-load/sockets/SisenseSocket.d.ts +81 -0
- package/dist/cjs/data-load/sockets/SisenseSocket.js +162 -0
- package/dist/cjs/data-load/sockets/TestSocket.d.ts +61 -0
- package/dist/cjs/data-load/sockets/TestSocket.js +90 -0
- package/dist/cjs/data-load/sockets/helpers.d.ts +4 -0
- package/dist/cjs/data-load/sockets/helpers.js +27 -0
- package/dist/cjs/data-load/sockets/index.d.ts +2 -0
- package/dist/cjs/data-load/sockets/index.js +8 -0
- package/dist/cjs/data-load/types.d.ts +90 -0
- package/dist/cjs/data-load/types.js +2 -0
- package/dist/cjs/errors/LoadingCanceledError.d.ts +7 -0
- package/dist/cjs/errors/LoadingCanceledError.js +24 -0
- package/dist/cjs/errors/index.d.ts +1 -0
- package/dist/cjs/errors/index.js +6 -0
- package/dist/cjs/index.d.ts +17 -0
- package/dist/cjs/index.js +32 -0
- package/dist/cjs/package.json +12 -0
- package/dist/cjs/pivot-query-client.d.ts +13 -0
- package/dist/cjs/pivot-query-client.js +26 -0
- package/dist/cjs/tree-structure/AbstractTreeService.d.ts +308 -0
- package/dist/cjs/tree-structure/AbstractTreeService.js +716 -0
- package/dist/cjs/tree-structure/HeaderTreeService.d.ts +180 -0
- package/dist/cjs/tree-structure/HeaderTreeService.js +280 -0
- package/dist/cjs/tree-structure/TreeCellMap.d.ts +104 -0
- package/dist/cjs/tree-structure/TreeCellMap.js +145 -0
- package/dist/cjs/tree-structure/TreeService.d.ts +8 -0
- package/dist/cjs/tree-structure/TreeService.js +12 -0
- package/dist/cjs/tree-structure/constants.d.ts +6 -0
- package/dist/cjs/tree-structure/constants.js +10 -0
- package/dist/cjs/tree-structure/index.d.ts +5 -0
- package/dist/cjs/tree-structure/index.js +10 -0
- package/dist/cjs/tree-structure/types.d.ts +93 -0
- package/dist/cjs/tree-structure/types.js +2 -0
- package/dist/cjs/tree-structure/utils/index.d.ts +1 -0
- package/dist/cjs/tree-structure/utils/index.js +9 -0
- package/dist/cjs/tree-structure/utils/treeNode.d.ts +147 -0
- package/dist/cjs/tree-structure/utils/treeNode.js +534 -0
- package/dist/cjs/utils/array.d.ts +13 -0
- package/dist/cjs/utils/array.js +25 -0
- package/dist/cjs/utils/cloneObject.d.ts +30 -0
- package/dist/cjs/utils/cloneObject.js +225 -0
- package/dist/cjs/utils/index.d.ts +3 -0
- package/dist/cjs/utils/index.js +9 -0
- package/dist/cjs/utils/throttle.d.ts +12 -0
- package/dist/cjs/utils/throttle.js +39 -0
- package/dist/cjs/utils/types.d.ts +12 -0
- package/dist/cjs/utils/types.js +2 -0
- package/dist/data-handling/DataService.d.ts +672 -0
- package/dist/data-handling/DataService.js +1357 -0
- package/dist/data-handling/DivergenceComparator.d.ts +7 -0
- package/dist/data-handling/DivergenceComparator.js +16 -0
- package/dist/data-handling/constants.d.ts +44 -0
- package/dist/data-handling/constants.js +40 -0
- package/dist/data-handling/index.d.ts +3 -0
- package/dist/data-handling/index.js +4 -0
- package/dist/data-handling/types.d.ts +104 -0
- package/dist/data-handling/types.js +1 -0
- package/dist/data-handling/utils/createPivotTreeNode.d.ts +13 -0
- package/dist/data-handling/utils/createPivotTreeNode.js +17 -0
- package/dist/data-handling/utils/index.d.ts +4 -0
- package/dist/data-handling/utils/index.js +4 -0
- package/dist/data-handling/utils/jaqlProcessor.d.ts +122 -0
- package/dist/data-handling/utils/jaqlProcessor.js +621 -0
- package/dist/data-handling/utils/pivotTransforms.d.ts +74 -0
- package/dist/data-handling/utils/pivotTransforms.js +335 -0
- package/dist/data-handling/utils/plugins/PluginService.d.ts +135 -0
- package/dist/data-handling/utils/plugins/PluginService.js +379 -0
- package/dist/data-handling/utils/plugins/getters.d.ts +23 -0
- package/dist/data-handling/utils/plugins/getters.js +65 -0
- package/dist/data-handling/utils/plugins/types.d.ts +75 -0
- package/dist/data-handling/utils/plugins/types.js +1 -0
- package/dist/data-handling/utils/plugins/validator.d.ts +13 -0
- package/dist/data-handling/utils/plugins/validator.js +165 -0
- package/dist/data-load/AbstractDataLoadService.d.ts +256 -0
- package/dist/data-load/AbstractDataLoadService.js +466 -0
- package/dist/data-load/DataLoadService.d.ts +63 -0
- package/dist/data-load/DataLoadService.js +148 -0
- package/dist/data-load/SisenseDataLoadService.d.ts +44 -0
- package/dist/data-load/SisenseDataLoadService.js +83 -0
- package/dist/data-load/TestDataLoadService.d.ts +27 -0
- package/dist/data-load/TestDataLoadService.js +69 -0
- package/dist/data-load/constants.d.ts +13 -0
- package/dist/data-load/constants.js +25 -0
- package/dist/data-load/index.d.ts +6 -0
- package/dist/data-load/index.js +6 -0
- package/dist/data-load/sockets/SisenseSocket.d.ts +81 -0
- package/dist/data-load/sockets/SisenseSocket.js +155 -0
- package/dist/data-load/sockets/TestSocket.d.ts +61 -0
- package/dist/data-load/sockets/TestSocket.js +83 -0
- package/dist/data-load/sockets/helpers.d.ts +4 -0
- package/dist/data-load/sockets/helpers.js +23 -0
- package/dist/data-load/sockets/index.d.ts +2 -0
- package/dist/data-load/sockets/index.js +3 -0
- package/dist/data-load/types.d.ts +90 -0
- package/dist/data-load/types.js +1 -0
- package/dist/errors/LoadingCanceledError.d.ts +7 -0
- package/dist/errors/LoadingCanceledError.js +20 -0
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.js +2 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +9 -0
- package/dist/pivot-query-client.d.ts +13 -0
- package/dist/pivot-query-client.js +22 -0
- package/dist/tree-structure/AbstractTreeService.d.ts +308 -0
- package/dist/tree-structure/AbstractTreeService.js +712 -0
- package/dist/tree-structure/HeaderTreeService.d.ts +180 -0
- package/dist/tree-structure/HeaderTreeService.js +276 -0
- package/dist/tree-structure/TreeCellMap.d.ts +104 -0
- package/dist/tree-structure/TreeCellMap.js +141 -0
- package/dist/tree-structure/TreeService.d.ts +8 -0
- package/dist/tree-structure/TreeService.js +8 -0
- package/dist/tree-structure/constants.d.ts +6 -0
- package/dist/tree-structure/constants.js +7 -0
- package/dist/tree-structure/index.d.ts +5 -0
- package/dist/tree-structure/index.js +4 -0
- package/dist/tree-structure/types.d.ts +93 -0
- package/dist/tree-structure/types.js +1 -0
- package/dist/tree-structure/utils/index.d.ts +1 -0
- package/dist/tree-structure/utils/index.js +1 -0
- package/dist/tree-structure/utils/treeNode.d.ts +147 -0
- package/dist/tree-structure/utils/treeNode.js +515 -0
- package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -0
- package/dist/utils/array.d.ts +13 -0
- package/dist/utils/array.js +21 -0
- package/dist/utils/cloneObject.d.ts +30 -0
- package/dist/utils/cloneObject.js +221 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/throttle.d.ts +12 -0
- package/dist/utils/throttle.js +35 -0
- package/dist/utils/types.d.ts +12 -0
- package/dist/utils/types.js +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { CloneFn } from '../utils/types.js';
|
|
2
|
+
import { TreeNode, TreeNodeMetadata, TreeServiceI } from './types.js';
|
|
3
|
+
export declare class HeaderTreeService implements TreeServiceI {
|
|
4
|
+
hasGrandTotals: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* columns TreeService
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
* @private
|
|
10
|
+
*/
|
|
11
|
+
columnsTreeService?: TreeServiceI;
|
|
12
|
+
/**
|
|
13
|
+
* corner TreeService
|
|
14
|
+
*
|
|
15
|
+
*
|
|
16
|
+
* @private
|
|
17
|
+
*/
|
|
18
|
+
cornerTreeService?: TreeServiceI;
|
|
19
|
+
/**
|
|
20
|
+
* Final 2D array
|
|
21
|
+
*
|
|
22
|
+
*
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
grid?: Array<Array<any>>;
|
|
26
|
+
/**
|
|
27
|
+
* columns grid offset base on corner size
|
|
28
|
+
*
|
|
29
|
+
*
|
|
30
|
+
* @private
|
|
31
|
+
*/
|
|
32
|
+
cornerOffset: number;
|
|
33
|
+
constructor(cornerTreeService?: TreeServiceI, columnsTreeService?: TreeServiceI);
|
|
34
|
+
/**
|
|
35
|
+
* Returns grid (2d list) of tree structure
|
|
36
|
+
*
|
|
37
|
+
* @returns {Array<Array<TreeNode | string>>} - 2d list
|
|
38
|
+
*/
|
|
39
|
+
getGrid(): Array<Array<TreeNode | string>>;
|
|
40
|
+
/**
|
|
41
|
+
* Returns TreeNode item if exist for appropriate coordinates (rowIndex, columnIndex)
|
|
42
|
+
*
|
|
43
|
+
* @param {number} rowIndex - row index
|
|
44
|
+
* @param {number} columnIndex - column index
|
|
45
|
+
* @returns {TreeNode|undefined} - TreeNode item
|
|
46
|
+
*/
|
|
47
|
+
getTreeNode(rowIndex: number, columnIndex: number): TreeNode | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Defines if cell with (rowIndex, columnIndex) coordinate is children cell or main one
|
|
50
|
+
*
|
|
51
|
+
* @param {number} rowIndex - row index of the cell
|
|
52
|
+
* @param {number} columnIndex - column index of the cell
|
|
53
|
+
* @returns {boolean} - true - if children, false if main one
|
|
54
|
+
*/
|
|
55
|
+
isChildren(rowIndex: number, columnIndex: number): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Defines if cell with (rowIndex, columnIndex) coordinate has children column/row cells or not
|
|
58
|
+
*
|
|
59
|
+
* @param {number} rowIndex - row index of the cell
|
|
60
|
+
* @param {number} columnIndex - column index of the cell
|
|
61
|
+
* @returns {boolean} - true - has children column/row cells, false - does not have
|
|
62
|
+
*/
|
|
63
|
+
hasChildren(rowIndex: number, columnIndex: number): boolean;
|
|
64
|
+
getMainCellWidth(rowIndex: number, columnIndex: number, columnWidth: Function, borderWidth: number, options?: {
|
|
65
|
+
offsetTop?: number;
|
|
66
|
+
columnsOffset?: number;
|
|
67
|
+
}): number;
|
|
68
|
+
/**
|
|
69
|
+
* Updates merge object for the cell if it has children cells
|
|
70
|
+
*
|
|
71
|
+
* @param {number} rowIndex - cell row index
|
|
72
|
+
* @param {number} columnIndex - cell column index
|
|
73
|
+
* @returns {object} - new merge object
|
|
74
|
+
*/
|
|
75
|
+
getMainCellSpans(rowIndex: number, columnIndex: number): {
|
|
76
|
+
colSpan?: number;
|
|
77
|
+
rowSpan?: number;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Align start index in case of long merged cell
|
|
81
|
+
*
|
|
82
|
+
* @param {number} startIndex - initial start index
|
|
83
|
+
* @param {boolean} isVertical - defines if it is vertical grid or not
|
|
84
|
+
* @returns {number} - new start index
|
|
85
|
+
*/
|
|
86
|
+
alignStartIndex(startIndex: number, isVertical?: boolean): number;
|
|
87
|
+
/**
|
|
88
|
+
* Align stop index in case of long merged cell
|
|
89
|
+
*
|
|
90
|
+
* @param {number} stopIndex - initial stop index
|
|
91
|
+
* @param {boolean} isVertical - defines if it is vertical grid or not
|
|
92
|
+
* @returns {number} - new stop index
|
|
93
|
+
*/
|
|
94
|
+
alignStopIndex(stopIndex: number, isVertical?: boolean): number;
|
|
95
|
+
/**
|
|
96
|
+
* Returns number of last children for the tree
|
|
97
|
+
*
|
|
98
|
+
* @param {Array<TreeNode> | TreeNode} item - tree node or list of nodes
|
|
99
|
+
* @returns {number} - count of last children
|
|
100
|
+
*/
|
|
101
|
+
getTreeChildLength(item?: Array<TreeNode> | TreeNode): number;
|
|
102
|
+
/**
|
|
103
|
+
* Returns deep level of the tree
|
|
104
|
+
*
|
|
105
|
+
* @param {Array<TreeNode> | TreeNode} item - tree node or list of nodes
|
|
106
|
+
* @returns {number} - count of last children
|
|
107
|
+
*/
|
|
108
|
+
getTreeDeepsLength(item?: Array<TreeNode> | TreeNode): number;
|
|
109
|
+
/**
|
|
110
|
+
* Sets value node when it's single
|
|
111
|
+
*
|
|
112
|
+
* @param {TreeNode} valueNode - values measure node
|
|
113
|
+
* @returns {void}
|
|
114
|
+
*/
|
|
115
|
+
setValueNode(valueNode: TreeNode): void;
|
|
116
|
+
/**
|
|
117
|
+
* Returns cell meta information
|
|
118
|
+
*
|
|
119
|
+
* @param {number} rowIndex - cell row index
|
|
120
|
+
* @param {number} columnIndex - cell column index
|
|
121
|
+
* @param {{ to: number }} [options] - additional configuration options
|
|
122
|
+
* @returns {{levels: Array<string>, siblings: Array<string>}} - meta information
|
|
123
|
+
*/
|
|
124
|
+
getMetadata(rowIndex: number, columnIndex: number, options?: {
|
|
125
|
+
from: number;
|
|
126
|
+
to: number;
|
|
127
|
+
}): TreeNodeMetadata | undefined;
|
|
128
|
+
destroy(): void;
|
|
129
|
+
/**
|
|
130
|
+
* Returns array of last tree nodes
|
|
131
|
+
* Should not be called for header
|
|
132
|
+
*
|
|
133
|
+
* @returns {Array<TreeNode>} - list of tree nodes
|
|
134
|
+
* @deprecated
|
|
135
|
+
*/
|
|
136
|
+
getLastLevelNodes(): Array<TreeNode>;
|
|
137
|
+
/**
|
|
138
|
+
* Extract 2D array of data base on columnsTreeService
|
|
139
|
+
* Should not be called for header
|
|
140
|
+
*
|
|
141
|
+
* @param {TreeServiceI} columnsTreeService - tree service according to which align the data
|
|
142
|
+
* @returns {Array<Array<any>>} - 2D array of data
|
|
143
|
+
* @deprecated
|
|
144
|
+
*/
|
|
145
|
+
extractData(columnsTreeService?: TreeServiceI): Array<Array<any>>;
|
|
146
|
+
/**
|
|
147
|
+
* Adds additional tree node to current state
|
|
148
|
+
* Should not be called for header
|
|
149
|
+
*
|
|
150
|
+
* @param {TreeNode} tree - new treeNode
|
|
151
|
+
* @returns {void}
|
|
152
|
+
* @deprecated
|
|
153
|
+
*/
|
|
154
|
+
extend(tree?: TreeNode): void;
|
|
155
|
+
/**
|
|
156
|
+
* Returns part of current tree with possible cut nodes according to "from" - "to" position
|
|
157
|
+
* Should not be called for header
|
|
158
|
+
*
|
|
159
|
+
* @param {number} from - start rows index for partial grid
|
|
160
|
+
* @param {number} [to] - stop rows index for partial grid
|
|
161
|
+
* @param {object} [options] - additional options
|
|
162
|
+
* @param {Function} [options.cloneFn] - replace default clone function with specific one
|
|
163
|
+
* @returns {Array<TreeNode>} - partial tree
|
|
164
|
+
* @deprecated
|
|
165
|
+
*/
|
|
166
|
+
getPartialTree(from: number, to?: number, options?: {
|
|
167
|
+
cloneFn?: CloneFn;
|
|
168
|
+
}): Array<TreeNode>;
|
|
169
|
+
/**
|
|
170
|
+
* Returns part of current grid according to "from" - "to" position
|
|
171
|
+
* Should not be called for header
|
|
172
|
+
*
|
|
173
|
+
* @param {number} from - start rows index for partial grid
|
|
174
|
+
* @param {number} to - stop rows index for partial grid
|
|
175
|
+
* @returns {Array<Array<TreeNode | string>>} - partial grid
|
|
176
|
+
* @deprecated
|
|
177
|
+
*/
|
|
178
|
+
getPartialGrid(from: number, to: number): Array<Array<TreeNode | string>>;
|
|
179
|
+
}
|
|
180
|
+
export default HeaderTreeService;
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HeaderTreeService = void 0;
|
|
4
|
+
class HeaderTreeService {
|
|
5
|
+
constructor(cornerTreeService, columnsTreeService) {
|
|
6
|
+
this.hasGrandTotals = false;
|
|
7
|
+
/**
|
|
8
|
+
* columns grid offset base on corner size
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
13
|
+
this.cornerOffset = 0;
|
|
14
|
+
this.cornerTreeService = cornerTreeService;
|
|
15
|
+
this.columnsTreeService = columnsTreeService;
|
|
16
|
+
this.cornerOffset = this.cornerTreeService ? this.cornerTreeService.getTreeChildLength() : 0;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Returns grid (2d list) of tree structure
|
|
20
|
+
*
|
|
21
|
+
* @returns {Array<Array<TreeNode | string>>} - 2d list
|
|
22
|
+
*/
|
|
23
|
+
getGrid() {
|
|
24
|
+
if (this.grid) {
|
|
25
|
+
return this.grid;
|
|
26
|
+
}
|
|
27
|
+
const cornerGrid = this.cornerTreeService ? this.cornerTreeService.getGrid() : [];
|
|
28
|
+
const columnsGrid = this.columnsTreeService ? this.columnsTreeService.getGrid() : [];
|
|
29
|
+
this.grid = cornerGrid.map((cornerRow = [], index) => {
|
|
30
|
+
const columnsRow = columnsGrid[index] || [];
|
|
31
|
+
return cornerRow.concat(columnsRow);
|
|
32
|
+
});
|
|
33
|
+
return this.grid;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Returns TreeNode item if exist for appropriate coordinates (rowIndex, columnIndex)
|
|
37
|
+
*
|
|
38
|
+
* @param {number} rowIndex - row index
|
|
39
|
+
* @param {number} columnIndex - column index
|
|
40
|
+
* @returns {TreeNode|undefined} - TreeNode item
|
|
41
|
+
*/
|
|
42
|
+
getTreeNode(rowIndex, columnIndex) {
|
|
43
|
+
if (columnIndex >= this.cornerOffset && this.columnsTreeService) {
|
|
44
|
+
return this.columnsTreeService.getTreeNode(rowIndex, columnIndex - this.cornerOffset);
|
|
45
|
+
}
|
|
46
|
+
return this.cornerTreeService
|
|
47
|
+
? this.cornerTreeService.getTreeNode(rowIndex, columnIndex)
|
|
48
|
+
: undefined;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Defines if cell with (rowIndex, columnIndex) coordinate is children cell or main one
|
|
52
|
+
*
|
|
53
|
+
* @param {number} rowIndex - row index of the cell
|
|
54
|
+
* @param {number} columnIndex - column index of the cell
|
|
55
|
+
* @returns {boolean} - true - if children, false if main one
|
|
56
|
+
*/
|
|
57
|
+
isChildren(rowIndex, columnIndex) {
|
|
58
|
+
if (columnIndex >= this.cornerOffset && this.columnsTreeService) {
|
|
59
|
+
return this.columnsTreeService.isChildren(rowIndex, columnIndex - this.cornerOffset);
|
|
60
|
+
}
|
|
61
|
+
return this.cornerTreeService
|
|
62
|
+
? this.cornerTreeService.isChildren(rowIndex, columnIndex)
|
|
63
|
+
: false;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Defines if cell with (rowIndex, columnIndex) coordinate has children column/row cells or not
|
|
67
|
+
*
|
|
68
|
+
* @param {number} rowIndex - row index of the cell
|
|
69
|
+
* @param {number} columnIndex - column index of the cell
|
|
70
|
+
* @returns {boolean} - true - has children column/row cells, false - does not have
|
|
71
|
+
*/
|
|
72
|
+
hasChildren(rowIndex, columnIndex) {
|
|
73
|
+
if (columnIndex >= this.cornerOffset && this.columnsTreeService) {
|
|
74
|
+
return this.columnsTreeService.hasChildren(rowIndex, columnIndex - this.cornerOffset);
|
|
75
|
+
}
|
|
76
|
+
return this.cornerTreeService
|
|
77
|
+
? this.cornerTreeService.hasChildren(rowIndex, columnIndex)
|
|
78
|
+
: false;
|
|
79
|
+
}
|
|
80
|
+
getMainCellWidth(rowIndex, columnIndex, columnWidth, borderWidth, options = { offsetTop: -1, columnsOffset: 0 }) {
|
|
81
|
+
const columnsOffset = options.columnsOffset || this.cornerOffset;
|
|
82
|
+
if (columnIndex >= columnsOffset && this.columnsTreeService) {
|
|
83
|
+
return this.columnsTreeService.getMainCellWidth(rowIndex, columnIndex - columnsOffset, columnWidth, borderWidth, Object.assign(Object.assign({}, options), { columnsOffset }));
|
|
84
|
+
}
|
|
85
|
+
return this.cornerTreeService
|
|
86
|
+
? this.cornerTreeService.getMainCellWidth(rowIndex, columnIndex, columnWidth, borderWidth, options)
|
|
87
|
+
: Number.NaN;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Updates merge object for the cell if it has children cells
|
|
91
|
+
*
|
|
92
|
+
* @param {number} rowIndex - cell row index
|
|
93
|
+
* @param {number} columnIndex - cell column index
|
|
94
|
+
* @returns {object} - new merge object
|
|
95
|
+
*/
|
|
96
|
+
getMainCellSpans(rowIndex, columnIndex) {
|
|
97
|
+
if (columnIndex >= this.cornerOffset && this.columnsTreeService) {
|
|
98
|
+
return this.columnsTreeService.getMainCellSpans(rowIndex, columnIndex - this.cornerOffset);
|
|
99
|
+
}
|
|
100
|
+
return this.cornerTreeService
|
|
101
|
+
? this.cornerTreeService.getMainCellSpans(rowIndex, columnIndex)
|
|
102
|
+
: {};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Align start index in case of long merged cell
|
|
106
|
+
*
|
|
107
|
+
* @param {number} startIndex - initial start index
|
|
108
|
+
* @param {boolean} isVertical - defines if it is vertical grid or not
|
|
109
|
+
* @returns {number} - new start index
|
|
110
|
+
*/
|
|
111
|
+
alignStartIndex(startIndex, isVertical) {
|
|
112
|
+
if (startIndex >= this.cornerOffset && this.columnsTreeService) {
|
|
113
|
+
return (this.cornerOffset +
|
|
114
|
+
this.columnsTreeService.alignStartIndex(startIndex - this.cornerOffset, isVertical));
|
|
115
|
+
}
|
|
116
|
+
return this.cornerTreeService
|
|
117
|
+
? this.cornerTreeService.alignStartIndex(startIndex, isVertical)
|
|
118
|
+
: startIndex;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Align stop index in case of long merged cell
|
|
122
|
+
*
|
|
123
|
+
* @param {number} stopIndex - initial stop index
|
|
124
|
+
* @param {boolean} isVertical - defines if it is vertical grid or not
|
|
125
|
+
* @returns {number} - new stop index
|
|
126
|
+
*/
|
|
127
|
+
alignStopIndex(stopIndex, isVertical) {
|
|
128
|
+
if (stopIndex >= this.cornerOffset && this.columnsTreeService) {
|
|
129
|
+
return (this.cornerOffset +
|
|
130
|
+
this.columnsTreeService.alignStopIndex(stopIndex - this.cornerOffset, isVertical));
|
|
131
|
+
}
|
|
132
|
+
return this.cornerTreeService
|
|
133
|
+
? this.cornerTreeService.alignStopIndex(stopIndex, isVertical)
|
|
134
|
+
: stopIndex;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Returns number of last children for the tree
|
|
138
|
+
*
|
|
139
|
+
* @param {Array<TreeNode> | TreeNode} item - tree node or list of nodes
|
|
140
|
+
* @returns {number} - count of last children
|
|
141
|
+
*/
|
|
142
|
+
getTreeChildLength(item) {
|
|
143
|
+
if (item) {
|
|
144
|
+
if (this.columnsTreeService) {
|
|
145
|
+
return this.columnsTreeService.getTreeChildLength(item);
|
|
146
|
+
}
|
|
147
|
+
return this.cornerTreeService ? this.cornerTreeService.getTreeChildLength(item) : 0;
|
|
148
|
+
}
|
|
149
|
+
const cornerLength = this.cornerTreeService ? this.cornerTreeService.getTreeChildLength() : 0;
|
|
150
|
+
const columnsLength = this.columnsTreeService
|
|
151
|
+
? this.columnsTreeService.getTreeChildLength()
|
|
152
|
+
: 0;
|
|
153
|
+
return cornerLength + columnsLength;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Returns deep level of the tree
|
|
157
|
+
*
|
|
158
|
+
* @param {Array<TreeNode> | TreeNode} item - tree node or list of nodes
|
|
159
|
+
* @returns {number} - count of last children
|
|
160
|
+
*/
|
|
161
|
+
getTreeDeepsLength(item) {
|
|
162
|
+
if (this.columnsTreeService) {
|
|
163
|
+
return this.columnsTreeService.getTreeDeepsLength(item);
|
|
164
|
+
}
|
|
165
|
+
return this.cornerTreeService ? this.cornerTreeService.getTreeDeepsLength(item) : 0;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Sets value node when it's single
|
|
169
|
+
*
|
|
170
|
+
* @param {TreeNode} valueNode - values measure node
|
|
171
|
+
* @returns {void}
|
|
172
|
+
*/
|
|
173
|
+
setValueNode(valueNode) {
|
|
174
|
+
if (this.columnsTreeService) {
|
|
175
|
+
this.columnsTreeService.setValueNode(valueNode);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Returns cell meta information
|
|
180
|
+
*
|
|
181
|
+
* @param {number} rowIndex - cell row index
|
|
182
|
+
* @param {number} columnIndex - cell column index
|
|
183
|
+
* @param {{ to: number }} [options] - additional configuration options
|
|
184
|
+
* @returns {{levels: Array<string>, siblings: Array<string>}} - meta information
|
|
185
|
+
*/
|
|
186
|
+
getMetadata(rowIndex, columnIndex, options) {
|
|
187
|
+
if (columnIndex >= this.cornerOffset && this.columnsTreeService) {
|
|
188
|
+
return this.columnsTreeService.getMetadata(rowIndex, columnIndex - this.cornerOffset, options);
|
|
189
|
+
// eslint-disable-next-line max-lines
|
|
190
|
+
}
|
|
191
|
+
return this.cornerTreeService
|
|
192
|
+
? this.cornerTreeService.getMetadata(rowIndex, columnIndex, options)
|
|
193
|
+
: undefined;
|
|
194
|
+
}
|
|
195
|
+
destroy() {
|
|
196
|
+
if (this.cornerTreeService) {
|
|
197
|
+
this.cornerTreeService.destroy();
|
|
198
|
+
}
|
|
199
|
+
if (this.columnsTreeService) {
|
|
200
|
+
this.columnsTreeService.destroy();
|
|
201
|
+
}
|
|
202
|
+
this.cornerTreeService = undefined;
|
|
203
|
+
this.columnsTreeService = undefined;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Returns array of last tree nodes
|
|
207
|
+
* Should not be called for header
|
|
208
|
+
*
|
|
209
|
+
* @returns {Array<TreeNode>} - list of tree nodes
|
|
210
|
+
* @deprecated
|
|
211
|
+
*/
|
|
212
|
+
getLastLevelNodes() {
|
|
213
|
+
throw new Error(`"${this.constructor.name}.getLastLevelNodes" should not be called`);
|
|
214
|
+
// TODO review this
|
|
215
|
+
return this; // eslint-disable-line no-unreachable
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Extract 2D array of data base on columnsTreeService
|
|
219
|
+
* Should not be called for header
|
|
220
|
+
*
|
|
221
|
+
* @param {TreeServiceI} columnsTreeService - tree service according to which align the data
|
|
222
|
+
* @returns {Array<Array<any>>} - 2D array of data
|
|
223
|
+
* @deprecated
|
|
224
|
+
*/
|
|
225
|
+
extractData(columnsTreeService) {
|
|
226
|
+
throw new Error(`"${this.constructor.name}.extractData" should not be called`);
|
|
227
|
+
// TODO review this
|
|
228
|
+
return this || columnsTreeService; // eslint-disable-line no-unreachable
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Adds additional tree node to current state
|
|
232
|
+
* Should not be called for header
|
|
233
|
+
*
|
|
234
|
+
* @param {TreeNode} tree - new treeNode
|
|
235
|
+
* @returns {void}
|
|
236
|
+
* @deprecated
|
|
237
|
+
*/
|
|
238
|
+
extend(tree) {
|
|
239
|
+
throw new Error(`"${this.constructor.name}.extend" should not be called`);
|
|
240
|
+
// TODO review this
|
|
241
|
+
// return (this as unknown as void) || (tree as unknown as void); // eslint-disable-line no-unreachable
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Returns part of current tree with possible cut nodes according to "from" - "to" position
|
|
245
|
+
* Should not be called for header
|
|
246
|
+
*
|
|
247
|
+
* @param {number} from - start rows index for partial grid
|
|
248
|
+
* @param {number} [to] - stop rows index for partial grid
|
|
249
|
+
* @param {object} [options] - additional options
|
|
250
|
+
* @param {Function} [options.cloneFn] - replace default clone function with specific one
|
|
251
|
+
* @returns {Array<TreeNode>} - partial tree
|
|
252
|
+
* @deprecated
|
|
253
|
+
*/
|
|
254
|
+
getPartialTree(from, to, options) {
|
|
255
|
+
throw new Error(`"${this.constructor.name}.getPartialTree" should not be called`);
|
|
256
|
+
// TODO review this
|
|
257
|
+
return (this ||
|
|
258
|
+
from ||
|
|
259
|
+
to ||
|
|
260
|
+
options); // eslint-disable-line no-unreachable
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Returns part of current grid according to "from" - "to" position
|
|
264
|
+
* Should not be called for header
|
|
265
|
+
*
|
|
266
|
+
* @param {number} from - start rows index for partial grid
|
|
267
|
+
* @param {number} to - stop rows index for partial grid
|
|
268
|
+
* @returns {Array<Array<TreeNode | string>>} - partial grid
|
|
269
|
+
* @deprecated
|
|
270
|
+
*/
|
|
271
|
+
getPartialGrid(from, to) {
|
|
272
|
+
throw new Error(`"${this.constructor.name}.getPartialGrid" should not be called`);
|
|
273
|
+
// TODO review this
|
|
274
|
+
return (this ||
|
|
275
|
+
from ||
|
|
276
|
+
to); // eslint-disable-line no-unreachable
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
exports.HeaderTreeService = HeaderTreeService;
|
|
280
|
+
exports.default = HeaderTreeService;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { TreeCellMapI, TreeNode } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* TreeCellMap keep mapping between grid cells and tree nodes
|
|
4
|
+
*/
|
|
5
|
+
export declare class TreeCellMap implements TreeCellMapI {
|
|
6
|
+
rowIndex: number;
|
|
7
|
+
colIndex: number;
|
|
8
|
+
node?: TreeNode;
|
|
9
|
+
parent?: string;
|
|
10
|
+
/**
|
|
11
|
+
@private */
|
|
12
|
+
childColCells: Array<TreeCellMapI>;
|
|
13
|
+
/**
|
|
14
|
+
@private */
|
|
15
|
+
childRowCells: Array<TreeCellMapI>;
|
|
16
|
+
/**
|
|
17
|
+
@private */
|
|
18
|
+
indexInParent: number;
|
|
19
|
+
/**
|
|
20
|
+
@private */
|
|
21
|
+
siblingCount: number;
|
|
22
|
+
constructor(rowIndex: number, colIndex: number, node?: TreeNode, parent?: string);
|
|
23
|
+
/**
|
|
24
|
+
* Defines if grid cell is child or main one
|
|
25
|
+
*
|
|
26
|
+
* @returns {boolean} - true - is children, false - main one
|
|
27
|
+
*/
|
|
28
|
+
isChild(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Defines if node has child row or column nodes or not
|
|
31
|
+
*
|
|
32
|
+
* @returns {boolean} - true - has children, false - does not have
|
|
33
|
+
*/
|
|
34
|
+
hasChildren(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Defines if node has child column nodes or not
|
|
37
|
+
*
|
|
38
|
+
* @returns {boolean} - true - has column children, false - does not have
|
|
39
|
+
*/
|
|
40
|
+
hasColCell(): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Adds column children cell
|
|
43
|
+
*
|
|
44
|
+
* @param {TreeCellMapI} cell - column children
|
|
45
|
+
* @returns {void}
|
|
46
|
+
*/
|
|
47
|
+
addColCell(cell: TreeCellMapI): void;
|
|
48
|
+
/**
|
|
49
|
+
* Returns list of column children
|
|
50
|
+
*
|
|
51
|
+
* @returns {Array<TreeCellMapI>} - list of column children
|
|
52
|
+
*/
|
|
53
|
+
getColCell(): Array<TreeCellMapI>;
|
|
54
|
+
/**
|
|
55
|
+
* Defines if node has child row nodes or not
|
|
56
|
+
*
|
|
57
|
+
* @returns {boolean} - true - has row children, false - does not have
|
|
58
|
+
*/
|
|
59
|
+
hasRowCell(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Adds row children cell
|
|
62
|
+
*
|
|
63
|
+
* @param {TreeCellMapI} cell - row children
|
|
64
|
+
* @returns {void}
|
|
65
|
+
*/
|
|
66
|
+
addRowCell(cell: TreeCellMapI): void;
|
|
67
|
+
/**
|
|
68
|
+
* Returns list of row children
|
|
69
|
+
*
|
|
70
|
+
* @returns {Array<TreeCellMapI>} - list of row children
|
|
71
|
+
*/
|
|
72
|
+
getRowCell(): Array<TreeCellMapI>;
|
|
73
|
+
/**
|
|
74
|
+
* Returns row index of last merged cell
|
|
75
|
+
*
|
|
76
|
+
* @returns {number} - row index
|
|
77
|
+
*/
|
|
78
|
+
getStopRowIndex(): number;
|
|
79
|
+
/**
|
|
80
|
+
* Returns column index of last merged cell
|
|
81
|
+
*
|
|
82
|
+
* @returns {number} - column index
|
|
83
|
+
*/
|
|
84
|
+
getStopColIndex(): number;
|
|
85
|
+
/**
|
|
86
|
+
* Save index of node in parent child and total parent child count
|
|
87
|
+
*
|
|
88
|
+
* @param {number} indexInParent - index
|
|
89
|
+
* @param {number} siblingCount - child count
|
|
90
|
+
* @returns {void}
|
|
91
|
+
*/
|
|
92
|
+
setIndexInParent(indexInParent: number, siblingCount: number): void;
|
|
93
|
+
/**
|
|
94
|
+
* Returns node index in parent and total parent child count
|
|
95
|
+
*
|
|
96
|
+
* @returns {{ indexInParent: number, siblingCount: number }} - index & count
|
|
97
|
+
*/
|
|
98
|
+
getIndexInParent(): {
|
|
99
|
+
indexInParent: number;
|
|
100
|
+
siblingCount: number;
|
|
101
|
+
};
|
|
102
|
+
getParenPosition(): Array<number> | undefined;
|
|
103
|
+
}
|
|
104
|
+
export default TreeCellMap;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TreeCellMap = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* TreeCellMap keep mapping between grid cells and tree nodes
|
|
6
|
+
*/
|
|
7
|
+
class TreeCellMap {
|
|
8
|
+
constructor(rowIndex, colIndex, node, parent) {
|
|
9
|
+
/**
|
|
10
|
+
@private */
|
|
11
|
+
this.childColCells = [];
|
|
12
|
+
/**
|
|
13
|
+
@private */
|
|
14
|
+
this.childRowCells = [];
|
|
15
|
+
/**
|
|
16
|
+
@private */
|
|
17
|
+
this.indexInParent = -1;
|
|
18
|
+
/**
|
|
19
|
+
@private */
|
|
20
|
+
this.siblingCount = 0;
|
|
21
|
+
this.rowIndex = rowIndex;
|
|
22
|
+
this.colIndex = colIndex;
|
|
23
|
+
this.node = node;
|
|
24
|
+
this.parent = parent;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Defines if grid cell is child or main one
|
|
28
|
+
*
|
|
29
|
+
* @returns {boolean} - true - is children, false - main one
|
|
30
|
+
*/
|
|
31
|
+
isChild() {
|
|
32
|
+
return !this.node;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Defines if node has child row or column nodes or not
|
|
36
|
+
*
|
|
37
|
+
* @returns {boolean} - true - has children, false - does not have
|
|
38
|
+
*/
|
|
39
|
+
hasChildren() {
|
|
40
|
+
return !!(this.childColCells.length || this.childRowCells.length);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Defines if node has child column nodes or not
|
|
44
|
+
*
|
|
45
|
+
* @returns {boolean} - true - has column children, false - does not have
|
|
46
|
+
*/
|
|
47
|
+
hasColCell() {
|
|
48
|
+
return this.childColCells.length > 0;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Adds column children cell
|
|
52
|
+
*
|
|
53
|
+
* @param {TreeCellMapI} cell - column children
|
|
54
|
+
* @returns {void}
|
|
55
|
+
*/
|
|
56
|
+
addColCell(cell) {
|
|
57
|
+
this.childColCells.push(cell);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Returns list of column children
|
|
61
|
+
*
|
|
62
|
+
* @returns {Array<TreeCellMapI>} - list of column children
|
|
63
|
+
*/
|
|
64
|
+
getColCell() {
|
|
65
|
+
return this.childColCells || [];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Defines if node has child row nodes or not
|
|
69
|
+
*
|
|
70
|
+
* @returns {boolean} - true - has row children, false - does not have
|
|
71
|
+
*/
|
|
72
|
+
hasRowCell() {
|
|
73
|
+
return this.childRowCells.length > 0;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Adds row children cell
|
|
77
|
+
*
|
|
78
|
+
* @param {TreeCellMapI} cell - row children
|
|
79
|
+
* @returns {void}
|
|
80
|
+
*/
|
|
81
|
+
addRowCell(cell) {
|
|
82
|
+
this.childRowCells.push(cell);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Returns list of row children
|
|
86
|
+
*
|
|
87
|
+
* @returns {Array<TreeCellMapI>} - list of row children
|
|
88
|
+
*/
|
|
89
|
+
getRowCell() {
|
|
90
|
+
return this.childRowCells || [];
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Returns row index of last merged cell
|
|
94
|
+
*
|
|
95
|
+
* @returns {number} - row index
|
|
96
|
+
*/
|
|
97
|
+
getStopRowIndex() {
|
|
98
|
+
if (!this.hasRowCell()) {
|
|
99
|
+
return this.rowIndex;
|
|
100
|
+
}
|
|
101
|
+
return this.rowIndex + this.getRowCell().length;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Returns column index of last merged cell
|
|
105
|
+
*
|
|
106
|
+
* @returns {number} - column index
|
|
107
|
+
*/
|
|
108
|
+
getStopColIndex() {
|
|
109
|
+
if (!this.hasColCell()) {
|
|
110
|
+
return this.colIndex;
|
|
111
|
+
}
|
|
112
|
+
return this.colIndex + this.getColCell().length;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Save index of node in parent child and total parent child count
|
|
116
|
+
*
|
|
117
|
+
* @param {number} indexInParent - index
|
|
118
|
+
* @param {number} siblingCount - child count
|
|
119
|
+
* @returns {void}
|
|
120
|
+
*/
|
|
121
|
+
setIndexInParent(indexInParent, siblingCount) {
|
|
122
|
+
this.indexInParent = indexInParent;
|
|
123
|
+
this.siblingCount = siblingCount;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Returns node index in parent and total parent child count
|
|
127
|
+
*
|
|
128
|
+
* @returns {{ indexInParent: number, siblingCount: number }} - index & count
|
|
129
|
+
*/
|
|
130
|
+
getIndexInParent() {
|
|
131
|
+
return {
|
|
132
|
+
indexInParent: this.indexInParent,
|
|
133
|
+
siblingCount: this.siblingCount,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
getParenPosition() {
|
|
137
|
+
if (!this.parent) {
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
const res = (this.parent || '').match(/\d+/g) || [];
|
|
141
|
+
return [Number(res[0]), Number(res[1])];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.TreeCellMap = TreeCellMap;
|
|
145
|
+
exports.default = TreeCellMap;
|