@refinitiv-ui/elements 7.10.10 → 7.11.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/CHANGELOG.md +6 -0
- package/lib/combo-box/custom-elements.json +1 -1
- package/lib/combo-box/custom-elements.md +1 -1
- package/lib/combo-box/helpers/filter.d.ts +2 -2
- package/lib/combo-box/helpers/filter.js +12 -3
- package/lib/combo-box/helpers/types.d.ts +3 -2
- package/lib/combo-box/index.js +4 -3
- package/lib/overlay/managers/viewport-manager.js +11 -11
- package/lib/tree/custom-elements.json +5 -0
- package/lib/tree/custom-elements.md +10 -9
- package/lib/tree/elements/tree-item.d.ts +1 -1
- package/lib/tree/elements/tree.d.ts +5 -4
- package/lib/tree/elements/tree.js +45 -41
- package/lib/tree/helpers/filter.d.ts +1 -1
- package/lib/tree/helpers/filter.js +3 -3
- package/lib/tree/helpers/renderer.js +5 -11
- package/lib/tree/helpers/types.d.ts +2 -1
- package/lib/tree/index.d.ts +1 -0
- package/lib/tree/managers/tree-manager.d.ts +65 -42
- package/lib/tree/managers/tree-manager.js +123 -72
- package/lib/tree/managers/tree-node.d.ts +141 -0
- package/lib/tree/managers/tree-node.js +215 -0
- package/lib/tree-select/custom-elements.json +12 -0
- package/lib/tree-select/custom-elements.md +18 -11
- package/lib/tree-select/index.d.ts +12 -7
- package/lib/tree-select/index.js +42 -33
- package/lib/version.js +1 -1
- package/package.json +9 -9
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CollectionComposer } from '@refinitiv-ui/utils/collection.js';
|
|
2
2
|
import type { TreeDataItem } from '../helpers/types';
|
|
3
|
+
import { TreeNode } from './tree-node.js';
|
|
3
4
|
export declare enum CheckedState {
|
|
4
5
|
CHECKED = 1,
|
|
5
6
|
UNCHECKED = 0,
|
|
@@ -16,10 +17,11 @@ export declare enum TreeManagerMode {
|
|
|
16
17
|
INDEPENDENT = 0
|
|
17
18
|
}
|
|
18
19
|
export declare class TreeManager<T extends TreeDataItem> {
|
|
20
|
+
private _composer;
|
|
19
21
|
/**
|
|
20
|
-
*
|
|
22
|
+
* Collection composer used for managing the data
|
|
21
23
|
*/
|
|
22
|
-
|
|
24
|
+
get composer(): CollectionComposer<T>;
|
|
23
25
|
/**
|
|
24
26
|
* Mode (algorithm) the tree manage is using
|
|
25
27
|
*/
|
|
@@ -28,11 +30,27 @@ export declare class TreeManager<T extends TreeDataItem> {
|
|
|
28
30
|
* Last selected item timestamp
|
|
29
31
|
*/
|
|
30
32
|
private lastSelectedAt?;
|
|
33
|
+
/** Cache map of TreeNode improving performance */
|
|
34
|
+
private treeNodeCache;
|
|
31
35
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
36
|
+
* Most of the time, there is no need to create a new instance of Tree Manager manually.
|
|
37
|
+
* Use the existing instance in components instead.
|
|
38
|
+
* @param input Items or CollectionComposer to be managed.
|
|
39
|
+
* @param mode A mode describing how items are managed either relationally or independently.
|
|
34
40
|
*/
|
|
35
|
-
constructor(
|
|
41
|
+
constructor(input: T[] | CollectionComposer<T>, mode?: TreeManagerMode);
|
|
42
|
+
/**
|
|
43
|
+
* Returns all items as an array of `TreeNode`.
|
|
44
|
+
* @returns Array of `TreeNode` representing all items
|
|
45
|
+
*/
|
|
46
|
+
getTreeNodes(): TreeNode<T>[];
|
|
47
|
+
/**
|
|
48
|
+
* Returns a `TreeNode` of the original data item.
|
|
49
|
+
* If the item doesn't exist, returns `null`.
|
|
50
|
+
* @param item Original data item
|
|
51
|
+
* @returns `TreeNode` of the original data item or `null`
|
|
52
|
+
*/
|
|
53
|
+
getTreeNode(item: T): TreeNode<T> | null;
|
|
36
54
|
/**
|
|
37
55
|
* Is the manager maintaining parent/child relationships
|
|
38
56
|
*/
|
|
@@ -42,11 +60,11 @@ export declare class TreeManager<T extends TreeDataItem> {
|
|
|
42
60
|
*/
|
|
43
61
|
private get items();
|
|
44
62
|
/**
|
|
45
|
-
*
|
|
63
|
+
* Returns all items with children
|
|
46
64
|
*/
|
|
47
65
|
private get parentItems();
|
|
48
66
|
/**
|
|
49
|
-
* Returns all
|
|
67
|
+
* Returns all selected items.
|
|
50
68
|
* When managing relationships, this excludes groups/parents from the result.
|
|
51
69
|
*/
|
|
52
70
|
get checkedItems(): readonly T[];
|
|
@@ -55,8 +73,8 @@ export declare class TreeManager<T extends TreeDataItem> {
|
|
|
55
73
|
*/
|
|
56
74
|
protected get orderBySelectedAt(): (itemA: T, itemB: T) => number;
|
|
57
75
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
76
|
+
* Returns items which their selected state can be changed.
|
|
77
|
+
* Hidden, disabled or readonly items are not included.
|
|
60
78
|
*/
|
|
61
79
|
get editableItems(): readonly T[];
|
|
62
80
|
/**
|
|
@@ -67,8 +85,8 @@ export declare class TreeManager<T extends TreeDataItem> {
|
|
|
67
85
|
*/
|
|
68
86
|
private getEditableItems;
|
|
69
87
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
88
|
+
* Returns currently displayed items.
|
|
89
|
+
* Hidden and children of unexpanded items are not included.
|
|
72
90
|
*/
|
|
73
91
|
get visibleItems(): readonly T[];
|
|
74
92
|
/**
|
|
@@ -127,133 +145,138 @@ export declare class TreeManager<T extends TreeDataItem> {
|
|
|
127
145
|
*/
|
|
128
146
|
private forceUpdateOnPath;
|
|
129
147
|
/**
|
|
148
|
+
* TODO: find a way to keep `noRelation` of Tree & Tree Select component in-sync
|
|
130
149
|
* Sets the mode (algorithm) the manager should use
|
|
150
|
+
* @hidden Mode updating doesn't sync back up Tree component.
|
|
131
151
|
* @param mode Tree manager mode
|
|
132
152
|
* @returns {void}
|
|
133
153
|
*/
|
|
134
154
|
setMode(mode: TreeManagerMode): void;
|
|
135
155
|
/**
|
|
136
|
-
*
|
|
156
|
+
* Requests the item to be rerendered manually.
|
|
157
|
+
* Typically, this is not required. The render is triggered automatically when item's properties are updated.
|
|
137
158
|
* @param item Original data item
|
|
138
159
|
* @returns {void}
|
|
139
160
|
*/
|
|
140
161
|
updateItem(item: T): void;
|
|
141
162
|
/**
|
|
142
|
-
*
|
|
143
|
-
* @
|
|
163
|
+
* Shows the item.
|
|
164
|
+
* @hidden `hidden` usage in filterItems of Tree & Tree Select component conflicts with this API
|
|
165
|
+
* @param item Original data item
|
|
144
166
|
* @returns `True` if the item is newly included
|
|
145
167
|
*/
|
|
146
168
|
includeItem(item: T): boolean;
|
|
147
169
|
/**
|
|
148
|
-
*
|
|
149
|
-
* @
|
|
170
|
+
* Hides the item.
|
|
171
|
+
* @hidden `hidden` usage in filterItems of Tree & Tree Select component conflicts with this API
|
|
172
|
+
* @param item Original data item
|
|
150
173
|
* @returns `True` if the item is newly excluded
|
|
151
174
|
*/
|
|
152
175
|
excludeItem(item: T): boolean;
|
|
153
176
|
/**
|
|
154
|
-
*
|
|
177
|
+
* Returns whether the selected state of item can be changed or not.
|
|
155
178
|
* @param item Original data item
|
|
156
179
|
* @returns `True` if the item is not disabled or readonly
|
|
157
180
|
*/
|
|
158
181
|
isItemCheckable(item: T): boolean;
|
|
159
182
|
/**
|
|
160
|
-
*
|
|
183
|
+
* Returns the current expanded state of the item.
|
|
161
184
|
* @param item Original data item
|
|
162
|
-
* @returns `True` if the item is expanded
|
|
185
|
+
* @returns `True` if the item is currently expanded so its children are visible.
|
|
163
186
|
*/
|
|
164
187
|
isItemExpanded(item: T): boolean;
|
|
165
188
|
/**
|
|
166
|
-
*
|
|
189
|
+
* Returns whether the item contains any children or not.
|
|
167
190
|
* @param item Original data item
|
|
168
191
|
* @returns `True` if the item has children
|
|
169
192
|
*/
|
|
170
193
|
isItemParent(item: T): boolean;
|
|
171
194
|
/**
|
|
172
|
-
*
|
|
195
|
+
* Returns whether the item has a parent or not.
|
|
173
196
|
* @param item Original data item
|
|
174
197
|
* @returns `True` if the item has a parent
|
|
175
198
|
*/
|
|
176
199
|
isItemChild(item: T): boolean;
|
|
177
200
|
/**
|
|
178
|
-
*
|
|
201
|
+
* Return checked state of the item.
|
|
179
202
|
* @param item Original data item
|
|
180
|
-
* @returns
|
|
203
|
+
* @returns item checked state: CHECKED (1), UNCHECKED (0), INDETERMINATE (-1)
|
|
181
204
|
*/
|
|
182
205
|
getItemCheckedState(item: T): CheckedState;
|
|
183
206
|
/**
|
|
184
|
-
*
|
|
207
|
+
* Returns all ancestors of the item.
|
|
185
208
|
* @param item Original data item
|
|
186
|
-
* @returns
|
|
209
|
+
* @returns An array of ancestors
|
|
187
210
|
*/
|
|
188
211
|
getItemAncestors(item: T): readonly T[];
|
|
189
212
|
/**
|
|
190
|
-
*
|
|
213
|
+
* Returns all descendants of the item.
|
|
191
214
|
* @param item Original data item
|
|
192
|
-
* @param depth Depth to
|
|
193
|
-
* @returns
|
|
215
|
+
* @param depth Depth of descendants to get. If it's `undefined`, get all descendants.
|
|
216
|
+
* @returns An array of descendants
|
|
194
217
|
*/
|
|
195
218
|
getItemDescendants(item: T, depth?: number): readonly T[];
|
|
196
219
|
/**
|
|
197
|
-
*
|
|
220
|
+
* Returns the parent of the item, if it has one.
|
|
198
221
|
* @param item Original data item
|
|
199
222
|
* @returns Item parent or `null`
|
|
200
223
|
*/
|
|
201
224
|
getItemParent(item: T): T | null;
|
|
202
225
|
/**
|
|
203
|
-
*
|
|
226
|
+
* Returns the children of the item as an array.
|
|
204
227
|
* @param item Original data item
|
|
205
|
-
* @returns
|
|
228
|
+
* @returns An array of children
|
|
206
229
|
*/
|
|
207
230
|
getItemChildren(item: T): readonly T[];
|
|
208
231
|
/**
|
|
209
|
-
*
|
|
232
|
+
* Expands the item to show its children.
|
|
210
233
|
* @param item Original data item
|
|
211
234
|
* @returns {void}
|
|
212
235
|
*/
|
|
213
236
|
expandItem(item: T): void;
|
|
214
237
|
/**
|
|
215
|
-
*
|
|
238
|
+
* Collapses the item to hide its children.
|
|
216
239
|
* @param item Original data item
|
|
217
240
|
* @returns {void}
|
|
218
241
|
*/
|
|
219
242
|
collapseItem(item: T): void;
|
|
220
243
|
/**
|
|
221
|
-
* Expands all items
|
|
244
|
+
* Expands all items.
|
|
222
245
|
* @returns {void}
|
|
223
246
|
*/
|
|
224
247
|
expandAllItems(): void;
|
|
225
248
|
/**
|
|
226
|
-
* Collapses all items
|
|
249
|
+
* Collapses all items.
|
|
227
250
|
* @returns {void}
|
|
228
251
|
*/
|
|
229
252
|
collapseAllItems(): void;
|
|
230
253
|
/**
|
|
231
|
-
*
|
|
254
|
+
* Selects the item.
|
|
232
255
|
* @param item Original data item
|
|
233
256
|
* @returns `True` if the item is modified
|
|
234
257
|
*/
|
|
235
258
|
checkItem(item: T): boolean;
|
|
236
259
|
private _checkItem;
|
|
237
260
|
/**
|
|
238
|
-
*
|
|
261
|
+
* Deselects the item.
|
|
239
262
|
* @param item Original data item
|
|
240
263
|
* @returns `True` if the item is modified
|
|
241
264
|
*/
|
|
242
265
|
uncheckItem(item: T): boolean;
|
|
243
266
|
private _uncheckItem;
|
|
244
267
|
/**
|
|
245
|
-
*
|
|
268
|
+
* Toggle the selected state of the item.
|
|
246
269
|
* @param item Original data item
|
|
247
|
-
* @returns `
|
|
270
|
+
* @returns `true` if the item is modified successfully.
|
|
248
271
|
*/
|
|
249
272
|
toggleItem(item: T): boolean;
|
|
250
273
|
/**
|
|
251
|
-
*
|
|
274
|
+
* Selects all items.
|
|
252
275
|
* @returns {void}
|
|
253
276
|
*/
|
|
254
277
|
checkAllItems(): void;
|
|
255
278
|
/**
|
|
256
|
-
*
|
|
279
|
+
* Deselects all items.
|
|
257
280
|
* @returns {void}
|
|
258
281
|
*/
|
|
259
282
|
uncheckAllItems(): void;
|