@refinitiv-ui/elements 7.10.10-next.1 → 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 +12 -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/flag/index.js +1 -1
- package/lib/icon/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 +12 -12
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { CheckedState } from './tree-manager.js';
|
|
2
|
+
/**
|
|
3
|
+
* `TreeNode` is expected to be used with `TreeManager` in tandem with Tree & Tree Select components.
|
|
4
|
+
* Accordingly, only accessors for `TreeDataItem`'s properties are implemented.
|
|
5
|
+
*/
|
|
6
|
+
export class TreeNode {
|
|
7
|
+
/**
|
|
8
|
+
* Create a new Tree Node managing an item & its Tree Manager.
|
|
9
|
+
* @param item item to be managed
|
|
10
|
+
* @param manager `TreeManager` of the item to be managed
|
|
11
|
+
* @hidden this constructor should be used internally & only by `TreeManager`
|
|
12
|
+
*/
|
|
13
|
+
constructor(item, manager) {
|
|
14
|
+
this.item = item;
|
|
15
|
+
this.manager = manager;
|
|
16
|
+
}
|
|
17
|
+
/** Icon to show, when rendering the item. */
|
|
18
|
+
get icon() {
|
|
19
|
+
return this.getPropertyValue('icon');
|
|
20
|
+
}
|
|
21
|
+
set icon(icon) {
|
|
22
|
+
this.setProperty('icon', icon);
|
|
23
|
+
}
|
|
24
|
+
/** Label to show, when rendering the item. */
|
|
25
|
+
get label() {
|
|
26
|
+
return this.getPropertyValue('label');
|
|
27
|
+
}
|
|
28
|
+
set label(value) {
|
|
29
|
+
this.setProperty('label', value);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Value of the data item.
|
|
33
|
+
* This is usually the value which is returned,
|
|
34
|
+
* when the item is selected.
|
|
35
|
+
*/
|
|
36
|
+
get value() {
|
|
37
|
+
return this.getPropertyValue('value');
|
|
38
|
+
}
|
|
39
|
+
set value(value) {
|
|
40
|
+
this.setProperty('value', value);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Sets the item to be readonly.
|
|
44
|
+
* Read only items cannot be selected by a user.
|
|
45
|
+
*/
|
|
46
|
+
get readonly() {
|
|
47
|
+
return !!this.getPropertyValue('readonly');
|
|
48
|
+
}
|
|
49
|
+
set readonly(value) {
|
|
50
|
+
this.setProperty('readonly', value);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Sets the highlight state of the item.
|
|
54
|
+
* This is usually used for navigating over items,
|
|
55
|
+
* without affecting focus or multiple item selection.
|
|
56
|
+
*/
|
|
57
|
+
get highlighted() {
|
|
58
|
+
return !!this.getPropertyValue('highlighted');
|
|
59
|
+
}
|
|
60
|
+
set highlighted(value) {
|
|
61
|
+
this.setProperty('highlighted', value);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Sets the item to be disabled.
|
|
65
|
+
* This completely prevents the item from being interacted with.
|
|
66
|
+
*/
|
|
67
|
+
get disabled() {
|
|
68
|
+
return !!this.getPropertyValue('disabled');
|
|
69
|
+
}
|
|
70
|
+
set disabled(value) {
|
|
71
|
+
this.setProperty('disabled', value);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Whether to show or hide the item from the renderer.
|
|
75
|
+
* @readonly
|
|
76
|
+
*/
|
|
77
|
+
// no setter due to a conflict with `hidden` usage in filterItems of Tree component.
|
|
78
|
+
get hidden() {
|
|
79
|
+
return !!this.getPropertyValue('hidden');
|
|
80
|
+
}
|
|
81
|
+
/** Expanded state of child items. If `true`, child items will be visible. */
|
|
82
|
+
get expanded() {
|
|
83
|
+
return this.manager.isItemExpanded(this.item);
|
|
84
|
+
}
|
|
85
|
+
set expanded(value) {
|
|
86
|
+
if (value) {
|
|
87
|
+
this.manager.expandItem(this.item);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
this.manager.collapseItem(this.item);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Timestamp indicating the order of sequential selection.
|
|
95
|
+
* @readonly
|
|
96
|
+
*/
|
|
97
|
+
get selectedAt() {
|
|
98
|
+
return this.getPropertyValue('selectedAt');
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Selection state of the item.
|
|
102
|
+
* If its `TreeManager` is in relationship mode, value would be get/set hierarchically.
|
|
103
|
+
* For instance, items with children would be considered selected when all children are selected.
|
|
104
|
+
*
|
|
105
|
+
* For indeterminate state support, use `getCheckedState()` instead.
|
|
106
|
+
*/
|
|
107
|
+
get selected() {
|
|
108
|
+
const checkedState = this.manager.getItemCheckedState(this.item);
|
|
109
|
+
return checkedState === CheckedState.CHECKED;
|
|
110
|
+
}
|
|
111
|
+
set selected(value) {
|
|
112
|
+
if (value) {
|
|
113
|
+
this.manager.checkItem(this.item);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
this.manager.uncheckItem(this.item);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Return checked state of the item.
|
|
121
|
+
* Apart from checked & unchecked state of `selected` accessor,
|
|
122
|
+
* this method supports indeterminate state for items that some but not all of their children are selected.
|
|
123
|
+
* @returns item checked state: CHECKED (1), UNCHECKED (0), INDETERMINATE (-1)
|
|
124
|
+
*/
|
|
125
|
+
getCheckedState() {
|
|
126
|
+
return this.manager.getItemCheckedState(this.item);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Returns all ancestors of the item.
|
|
130
|
+
* @returns An array of ancestors as Tree Node
|
|
131
|
+
*/
|
|
132
|
+
getAncestors() {
|
|
133
|
+
const ancestors = this.manager.getItemAncestors(this.item);
|
|
134
|
+
return ancestors.map((ancestor) => this.manager.getTreeNode(ancestor));
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Returns the children of the item.
|
|
138
|
+
* @returns An array of children as Tree Node
|
|
139
|
+
*/
|
|
140
|
+
getChildren() {
|
|
141
|
+
const children = this.manager.getItemChildren(this.item);
|
|
142
|
+
return children.map((child) => this.manager.getTreeNode(child));
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Returns all descendants of the item.
|
|
146
|
+
* @param depth Depth of descendants to get. If it's `undefined`, get all descendants.
|
|
147
|
+
* @returns An array of descendants as Tree Node
|
|
148
|
+
*/
|
|
149
|
+
getDescendants(depth) {
|
|
150
|
+
const descendants = this.manager.getItemDescendants(this.item, depth);
|
|
151
|
+
return descendants.map((descendant) => this.manager.getTreeNode(descendant));
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Returns the parent of the item, if it has one.
|
|
155
|
+
* @returns Item parent as Tree Node or `null`
|
|
156
|
+
*/
|
|
157
|
+
getParent() {
|
|
158
|
+
const parent = this.manager.getItemParent(this.item);
|
|
159
|
+
return parent ? this.manager.getTreeNode(parent) : null;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Returns whether the selected state of the item can be changed or not.
|
|
163
|
+
* @returns `True` if the item is not disabled or readonly
|
|
164
|
+
*/
|
|
165
|
+
isSelectable() {
|
|
166
|
+
return this.manager.isItemCheckable(this.item);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Returns whether the item contains any children or not.
|
|
170
|
+
* @returns `True` if the item has children
|
|
171
|
+
*/
|
|
172
|
+
isParent() {
|
|
173
|
+
return this.manager.isItemParent(this.item);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Returns whether the item has a parent or not.
|
|
177
|
+
* @returns `True` if the item has a parent
|
|
178
|
+
*/
|
|
179
|
+
isChild() {
|
|
180
|
+
return this.manager.isItemChild(this.item);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Return the depth of the item starting from 0 for root items,
|
|
184
|
+
* 1 for children of root items, 2 for grandchildren of root items and so on.
|
|
185
|
+
* @returns depth of the item
|
|
186
|
+
*/
|
|
187
|
+
getDepth() {
|
|
188
|
+
return this.manager.composer.getItemDepth(this.item);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Requests the item to be rerendered manually.
|
|
192
|
+
* Typically, this is not required. The render is triggered automatically when item's properties are updated.
|
|
193
|
+
* @returns {void}
|
|
194
|
+
*/
|
|
195
|
+
rerender() {
|
|
196
|
+
this.manager.updateItem(this.item);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Retrieve a value of the specified property.
|
|
200
|
+
* @param prop property key
|
|
201
|
+
* @returns property value
|
|
202
|
+
*/
|
|
203
|
+
getPropertyValue(prop) {
|
|
204
|
+
return this.manager.composer.getItemPropertyValue(this.item, prop);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Set a value of the specified property.
|
|
208
|
+
* @param prop property key
|
|
209
|
+
* @param value property value
|
|
210
|
+
* @returns {void}
|
|
211
|
+
*/
|
|
212
|
+
setProperty(prop, value) {
|
|
213
|
+
return this.manager.composer.setItemPropertyValue(this.item, prop, value);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
@@ -43,6 +43,11 @@
|
|
|
43
43
|
"type": "number",
|
|
44
44
|
"default": "0"
|
|
45
45
|
},
|
|
46
|
+
{
|
|
47
|
+
"name": "treeManager (readonly)",
|
|
48
|
+
"description": "Tree manager used for item manipulation",
|
|
49
|
+
"type": "TreeManager<TreeSelectDataItem>"
|
|
50
|
+
},
|
|
46
51
|
{
|
|
47
52
|
"name": "noRelation",
|
|
48
53
|
"attribute": "no-relation",
|
|
@@ -117,6 +122,13 @@
|
|
|
117
122
|
"name": "opened-changed",
|
|
118
123
|
"description": "Fired when the user opens or closes control's popup. The event is not triggered if `opened` property is changed programmatically."
|
|
119
124
|
}
|
|
125
|
+
],
|
|
126
|
+
"methods": [
|
|
127
|
+
{
|
|
128
|
+
"name": "commit",
|
|
129
|
+
"description": "Commit the current selection applying it to `values` property.",
|
|
130
|
+
"params": []
|
|
131
|
+
}
|
|
120
132
|
]
|
|
121
133
|
}
|
|
122
134
|
]
|
|
@@ -4,17 +4,24 @@ Dropdown control that allows selection from the tree list
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
| Property
|
|
8
|
-
|
|
9
|
-
| `data`
|
|
10
|
-
| `filterCount`
|
|
11
|
-
| `max`
|
|
12
|
-
| `noRelation`
|
|
13
|
-
| `opened`
|
|
14
|
-
| `placeholder`
|
|
15
|
-
| `renderer`
|
|
16
|
-
| `showPills`
|
|
17
|
-
| `
|
|
7
|
+
| Property | Attribute | Type | Default | Description |
|
|
8
|
+
|--------------------------|---------------|-----------------------------------|--------------------------------------------------|--------------------------------------------------|
|
|
9
|
+
| `data` | | `TreeSelectData[]` | [] | Data object to be used for creating tree |
|
|
10
|
+
| `filterCount` | | `number` | 0 | Tracks the number of filter matches<br /><br />Only needed if internal filtering is unused |
|
|
11
|
+
| `max` | `max` | `string \| null` | "" | Set maximum number of selected items |
|
|
12
|
+
| `noRelation` | `no-relation` | `boolean` | false | Breaks the relationship when multiple<br />selection mode is enabled |
|
|
13
|
+
| `opened` | `opened` | `boolean` | false | Set dropdown to open |
|
|
14
|
+
| `placeholder` | `placeholder` | `string` | "" | Set placeholder text |
|
|
15
|
+
| `renderer` | | | "createTreeSelectRenderer<TreeSelectDataItem>(this)" | Renderer used to render tree item elements |
|
|
16
|
+
| `showPills` | `show-pills` | `boolean` | false | Should the control show pills |
|
|
17
|
+
| `treeManager (readonly)` | | `TreeManager<TreeSelectDataItem>` | | Tree manager used for item manipulation |
|
|
18
|
+
| `values` | | `string[]` | [] | Returns a values collection of the currently<br />selected item values |
|
|
19
|
+
|
|
20
|
+
## Methods
|
|
21
|
+
|
|
22
|
+
| Method | Type | Description |
|
|
23
|
+
|----------|------------|--------------------------------------------------|
|
|
24
|
+
| `commit` | `(): void` | Commit the current selection applying it to `values` property. |
|
|
18
25
|
|
|
19
26
|
## Events
|
|
20
27
|
|
|
@@ -76,10 +76,11 @@ export declare class TreeSelect extends ComboBox<TreeSelectDataItem> {
|
|
|
76
76
|
* Composer used for live changes
|
|
77
77
|
*/
|
|
78
78
|
protected composer: CollectionComposer<TreeSelectDataItem>;
|
|
79
|
+
protected _treeManager: TreeManager<TreeSelectDataItem>;
|
|
79
80
|
/**
|
|
80
|
-
*
|
|
81
|
+
* Tree manager used for item manipulation
|
|
81
82
|
*/
|
|
82
|
-
|
|
83
|
+
get treeManager(): TreeManager<TreeSelectDataItem>;
|
|
83
84
|
/**
|
|
84
85
|
* Modification updates are called a lot
|
|
85
86
|
*
|
|
@@ -112,7 +113,7 @@ export declare class TreeSelect extends ComboBox<TreeSelectDataItem> {
|
|
|
112
113
|
/**
|
|
113
114
|
* Renderer used to render tree item elements
|
|
114
115
|
*/
|
|
115
|
-
renderer: (item: import("../tree/index.js").TreeDataItem, composer: CollectionComposer<import("../tree/index.js").TreeDataItem>, element?: HTMLElement) => HTMLElement;
|
|
116
|
+
renderer: (item: import("../tree/index.js").TreeDataItem, composer: CollectionComposer<import("../tree/index.js").TreeDataItem>, element?: HTMLElement | undefined) => HTMLElement;
|
|
116
117
|
private _max;
|
|
117
118
|
/**
|
|
118
119
|
* Set maximum number of selected items
|
|
@@ -202,12 +203,16 @@ export declare class TreeSelect extends ComboBox<TreeSelectDataItem> {
|
|
|
202
203
|
*/
|
|
203
204
|
protected get isConfirmDisabled(): boolean;
|
|
204
205
|
/**
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
|
|
206
|
+
* Commit the current selection applying it to `values` property.
|
|
207
|
+
* @return {void}
|
|
208
|
+
*/
|
|
209
|
+
commit(): void;
|
|
210
|
+
/**
|
|
211
|
+
* Persist the current selection applying it to @link TreeSelect.values}.
|
|
212
|
+
* @param shouldNotify Whether to notify the change with `value-changed` event or not.
|
|
208
213
|
* @returns {void}
|
|
209
214
|
*/
|
|
210
|
-
|
|
215
|
+
private persistSelection;
|
|
211
216
|
/**
|
|
212
217
|
* Revert modified selection to old values. Run on Esc or Cancel
|
|
213
218
|
* @returns {void}
|
package/lib/tree-select/index.js
CHANGED
|
@@ -82,10 +82,7 @@ let TreeSelect = class TreeSelect extends ComboBox {
|
|
|
82
82
|
* Composer used for live changes
|
|
83
83
|
*/
|
|
84
84
|
this.composer = new CollectionComposer([]);
|
|
85
|
-
|
|
86
|
-
* Provide access to tree interface
|
|
87
|
-
*/
|
|
88
|
-
this.treeManager = new TreeManager(this.composer);
|
|
85
|
+
this._treeManager = new TreeManager(this.composer);
|
|
89
86
|
/**
|
|
90
87
|
* Modification updates are called a lot
|
|
91
88
|
*
|
|
@@ -158,6 +155,12 @@ let TreeSelect = class TreeSelect extends ComboBox {
|
|
|
158
155
|
}
|
|
159
156
|
`;
|
|
160
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Tree manager used for item manipulation
|
|
160
|
+
*/
|
|
161
|
+
get treeManager() {
|
|
162
|
+
return this._treeManager;
|
|
163
|
+
}
|
|
161
164
|
/**
|
|
162
165
|
* Returns a values collection of the currently
|
|
163
166
|
* selected item values
|
|
@@ -217,7 +220,7 @@ let TreeSelect = class TreeSelect extends ComboBox {
|
|
|
217
220
|
const oldValue = this.resolvedData;
|
|
218
221
|
if (value !== oldValue) {
|
|
219
222
|
super.resolvedData = value;
|
|
220
|
-
this.
|
|
223
|
+
this._treeManager = new TreeManager(this.composer, this.mode);
|
|
221
224
|
// keep the original values
|
|
222
225
|
// do not use values setter to avoid unnecessary calls
|
|
223
226
|
this._values = this.composerValues;
|
|
@@ -235,13 +238,13 @@ let TreeSelect = class TreeSelect extends ComboBox {
|
|
|
235
238
|
* @override
|
|
236
239
|
*/
|
|
237
240
|
get composerValues() {
|
|
238
|
-
return this.
|
|
241
|
+
return this._treeManager.checkedItems.map((item) => item.value ?? '').slice();
|
|
239
242
|
}
|
|
240
243
|
/**
|
|
241
244
|
* Provide list of currently selected items
|
|
242
245
|
*/
|
|
243
246
|
get selection() {
|
|
244
|
-
return this.
|
|
247
|
+
return this._treeManager.checkedItems.slice();
|
|
245
248
|
}
|
|
246
249
|
/**
|
|
247
250
|
* Get a list of selected item labels
|
|
@@ -307,7 +310,7 @@ let TreeSelect = class TreeSelect extends ComboBox {
|
|
|
307
310
|
* If mode is INDEPENDENT, grouping is not applied
|
|
308
311
|
*/
|
|
309
312
|
get checkedGroupedItems() {
|
|
310
|
-
const treeManager = this.
|
|
313
|
+
const treeManager = this._treeManager;
|
|
311
314
|
const checkedItems = treeManager.checkedItems;
|
|
312
315
|
if (this.mode === TreeManagerMode.INDEPENDENT) {
|
|
313
316
|
return checkedItems;
|
|
@@ -347,18 +350,24 @@ let TreeSelect = class TreeSelect extends ComboBox {
|
|
|
347
350
|
return Boolean(this.treeEl && this.max && this.treeEl.values.length > Number(this.max));
|
|
348
351
|
}
|
|
349
352
|
/**
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
|
|
353
|
+
* Commit the current selection applying it to `values` property.
|
|
354
|
+
* @return {void}
|
|
355
|
+
*/
|
|
356
|
+
commit() {
|
|
357
|
+
this.persistSelection();
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Persist the current selection applying it to @link TreeSelect.values}.
|
|
361
|
+
* @param shouldNotify Whether to notify the change with `value-changed` event or not.
|
|
353
362
|
* @returns {void}
|
|
354
363
|
*/
|
|
355
|
-
persistSelection() {
|
|
364
|
+
persistSelection(shouldNotify = false) {
|
|
356
365
|
const oldValues = this.values;
|
|
357
366
|
const newValues = this.composerValues;
|
|
358
367
|
if (oldValues.toString() !== newValues.toString()) {
|
|
359
368
|
// Set new values order by sequential selection
|
|
360
369
|
this.values = newValues;
|
|
361
|
-
this.notifyPropertyChange('value', this.value);
|
|
370
|
+
shouldNotify && this.notifyPropertyChange('value', this.value);
|
|
362
371
|
}
|
|
363
372
|
}
|
|
364
373
|
/**
|
|
@@ -402,7 +411,7 @@ let TreeSelect = class TreeSelect extends ComboBox {
|
|
|
402
411
|
const hasChildren = composer.getItemChildren(item).length;
|
|
403
412
|
if (hasChildren) {
|
|
404
413
|
this.memo.expandable += 1;
|
|
405
|
-
if (this.
|
|
414
|
+
if (this._treeManager.isItemExpanded(item) && this._treeManager.isItemCheckable(item)) {
|
|
406
415
|
this.memo.expanded += 1;
|
|
407
416
|
}
|
|
408
417
|
}
|
|
@@ -436,7 +445,7 @@ let TreeSelect = class TreeSelect extends ComboBox {
|
|
|
436
445
|
const event = new CustomEvent('confirm');
|
|
437
446
|
this.dispatchEvent(event);
|
|
438
447
|
if (!event.defaultPrevented) {
|
|
439
|
-
this.persistSelection();
|
|
448
|
+
this.persistSelection(true);
|
|
440
449
|
this.closeAndReset();
|
|
441
450
|
}
|
|
442
451
|
}
|
|
@@ -459,10 +468,10 @@ let TreeSelect = class TreeSelect extends ComboBox {
|
|
|
459
468
|
*/
|
|
460
469
|
expansionToggleClickHandler() {
|
|
461
470
|
if (this.hasExpansion) {
|
|
462
|
-
this.
|
|
471
|
+
this._treeManager.collapseAllItems();
|
|
463
472
|
}
|
|
464
473
|
else {
|
|
465
|
-
this.
|
|
474
|
+
this._treeManager.expandAllItems();
|
|
466
475
|
}
|
|
467
476
|
}
|
|
468
477
|
/**
|
|
@@ -472,10 +481,10 @@ let TreeSelect = class TreeSelect extends ComboBox {
|
|
|
472
481
|
*/
|
|
473
482
|
selectionToggleHandler(event) {
|
|
474
483
|
if (event.detail.value) {
|
|
475
|
-
this.
|
|
484
|
+
this._treeManager.checkAllItems();
|
|
476
485
|
}
|
|
477
486
|
else {
|
|
478
|
-
this.
|
|
487
|
+
this._treeManager.uncheckAllItems();
|
|
479
488
|
}
|
|
480
489
|
}
|
|
481
490
|
/**
|
|
@@ -499,7 +508,7 @@ let TreeSelect = class TreeSelect extends ComboBox {
|
|
|
499
508
|
* @returns {void}
|
|
500
509
|
*/
|
|
501
510
|
enterEditSelection() {
|
|
502
|
-
this.editSelectionItems = new Set(this.
|
|
511
|
+
this.editSelectionItems = new Set(this._treeManager.checkedItems);
|
|
503
512
|
this.filterItems();
|
|
504
513
|
}
|
|
505
514
|
/**
|
|
@@ -560,13 +569,13 @@ let TreeSelect = class TreeSelect extends ComboBox {
|
|
|
560
569
|
}
|
|
561
570
|
// item matches selection, can have conventional filter applied
|
|
562
571
|
if (result) {
|
|
563
|
-
result = filter(item);
|
|
572
|
+
result = filter(item, this._treeManager);
|
|
564
573
|
}
|
|
565
574
|
if (result) {
|
|
566
|
-
this.
|
|
575
|
+
this._treeManager.includeItem(item);
|
|
567
576
|
}
|
|
568
577
|
else {
|
|
569
|
-
this.
|
|
578
|
+
this._treeManager.excludeItem(item);
|
|
570
579
|
}
|
|
571
580
|
return result;
|
|
572
581
|
}).slice();
|
|
@@ -598,14 +607,14 @@ let TreeSelect = class TreeSelect extends ComboBox {
|
|
|
598
607
|
/**
|
|
599
608
|
* Collapse an item to prevent tree show too many nested expanded
|
|
600
609
|
*/
|
|
601
|
-
if (this.
|
|
602
|
-
this.
|
|
610
|
+
if (this._treeManager.isItemExpanded(item)) {
|
|
611
|
+
this._treeManager.collapseItem(item);
|
|
603
612
|
}
|
|
604
613
|
/**
|
|
605
614
|
* show all descendants of items to make them all are selectable
|
|
606
615
|
* and user can navigate into nested data
|
|
607
616
|
*/
|
|
608
|
-
const children = this.
|
|
617
|
+
const children = this._treeManager.getItemChildren(item);
|
|
609
618
|
if (children.length) {
|
|
610
619
|
this.addNestedItemsToRender(children, items);
|
|
611
620
|
}
|
|
@@ -623,8 +632,8 @@ let TreeSelect = class TreeSelect extends ComboBox {
|
|
|
623
632
|
// Skip hidden and exclude item
|
|
624
633
|
if (!item.hidden && !excludeItems.includes(item)) {
|
|
625
634
|
// Add item and nested children
|
|
626
|
-
this.
|
|
627
|
-
const children = this.
|
|
635
|
+
this._treeManager.includeItem(item);
|
|
636
|
+
const children = this._treeManager.getItemChildren(item);
|
|
628
637
|
if (children.length) {
|
|
629
638
|
this.addNestedItemsToRender(children, excludeItems);
|
|
630
639
|
}
|
|
@@ -643,9 +652,9 @@ let TreeSelect = class TreeSelect extends ComboBox {
|
|
|
643
652
|
// we iterate each item match so as to find ancestors
|
|
644
653
|
items.forEach((item) => {
|
|
645
654
|
// get the ancestors
|
|
646
|
-
const parent = this.
|
|
655
|
+
const parent = this._treeManager.getItemParent(item);
|
|
647
656
|
if (parent && !ancestors.has(parent)) {
|
|
648
|
-
this.
|
|
657
|
+
this._treeManager.getItemAncestors(item).forEach((ancestor) => {
|
|
649
658
|
ancestors.add(ancestor); // track ancestors
|
|
650
659
|
this.addExpandedAncestorToRender(ancestor);
|
|
651
660
|
});
|
|
@@ -659,8 +668,8 @@ let TreeSelect = class TreeSelect extends ComboBox {
|
|
|
659
668
|
* @returns {void}
|
|
660
669
|
*/
|
|
661
670
|
addExpandedAncestorToRender(ancestor) {
|
|
662
|
-
this.
|
|
663
|
-
this.
|
|
671
|
+
this._treeManager.includeItem(ancestor);
|
|
672
|
+
this._treeManager.expandItem(ancestor);
|
|
664
673
|
}
|
|
665
674
|
/**
|
|
666
675
|
* Reacts to pill removal by de-selecting the related item
|
|
@@ -672,7 +681,7 @@ let TreeSelect = class TreeSelect extends ComboBox {
|
|
|
672
681
|
const pill = event.target;
|
|
673
682
|
const item = this.queryItemsByPropertyValue('value', pill.value)[0];
|
|
674
683
|
if (item) {
|
|
675
|
-
this.
|
|
684
|
+
this._treeManager.uncheckItem(item);
|
|
676
685
|
// Focus must be shifted as otherwise focus is shifted to body once the item is removed and popup gets closed
|
|
677
686
|
this.shiftFocus();
|
|
678
687
|
}
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '7.
|
|
1
|
+
export const VERSION = '7.11.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refinitiv-ui/elements",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.11.0",
|
|
4
4
|
"description": "Element Framework Elements",
|
|
5
5
|
"author": "LSEG",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -353,25 +353,25 @@
|
|
|
353
353
|
"tslib": "^2.3.1"
|
|
354
354
|
},
|
|
355
355
|
"devDependencies": {
|
|
356
|
-
"@refinitiv-ui/core": "^7.4.
|
|
357
|
-
"@refinitiv-ui/demo-block": "^7.1.
|
|
358
|
-
"@refinitiv-ui/i18n": "^7.1.4
|
|
356
|
+
"@refinitiv-ui/core": "^7.4.3",
|
|
357
|
+
"@refinitiv-ui/demo-block": "^7.1.10",
|
|
358
|
+
"@refinitiv-ui/i18n": "^7.1.4",
|
|
359
359
|
"@refinitiv-ui/phrasebook": "^7.1.1",
|
|
360
|
-
"@refinitiv-ui/test-helpers": "^7.1.1
|
|
361
|
-
"@refinitiv-ui/translate": "^7.1.
|
|
362
|
-
"@refinitiv-ui/utils": "^7.
|
|
360
|
+
"@refinitiv-ui/test-helpers": "^7.1.1",
|
|
361
|
+
"@refinitiv-ui/translate": "^7.1.7",
|
|
362
|
+
"@refinitiv-ui/utils": "^7.3.0",
|
|
363
363
|
"@types/d3-interpolate": "^3.0.1"
|
|
364
364
|
},
|
|
365
365
|
"peerDependencies": {
|
|
366
366
|
"@refinitiv-ui/browser-sparkline": "^1.0.0 || ^2.0.0",
|
|
367
|
-
"@refinitiv-ui/core": "^7.4.
|
|
368
|
-
"@refinitiv-ui/i18n": "^7.1.4
|
|
367
|
+
"@refinitiv-ui/core": "^7.4.3",
|
|
368
|
+
"@refinitiv-ui/i18n": "^7.1.4",
|
|
369
369
|
"@refinitiv-ui/phrasebook": "^7.1.1",
|
|
370
|
-
"@refinitiv-ui/translate": "^7.1.
|
|
371
|
-
"@refinitiv-ui/utils": "^7.
|
|
370
|
+
"@refinitiv-ui/translate": "^7.1.7",
|
|
371
|
+
"@refinitiv-ui/utils": "^7.3.0"
|
|
372
372
|
},
|
|
373
373
|
"publishConfig": {
|
|
374
374
|
"access": "public"
|
|
375
375
|
},
|
|
376
|
-
"gitHead": "
|
|
376
|
+
"gitHead": "b689d22c6cc53274a12b42233d087f9d5ccdee2e"
|
|
377
377
|
}
|