@fluid-topics/ft-tree-list 1.3.45 → 1.3.46
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/build/ft-tree-list.light.js +445 -428
- package/build/ft-tree-list.min.js +243 -226
- package/build/ftds-tree-list.js +52 -52
- package/build/ftds-tree-list.styles.js +8 -9
- package/package.json +9 -9
package/build/ftds-tree-list.js
CHANGED
|
@@ -11,7 +11,7 @@ import { when } from "lit/directives/when.js";
|
|
|
11
11
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
12
12
|
import { classMap } from "lit/directives/class-map.js";
|
|
13
13
|
import { DesignSystemFamily, FtLitElement, hasChanged, jsonProperty, numberProperty } from "@fluid-topics/ft-wc-utils";
|
|
14
|
-
import {
|
|
14
|
+
import { FtdsTypography, FtdsTypographyVariants } from "@fluid-topics/ft-typography";
|
|
15
15
|
import { FtIcon, FtIcons } from "@fluid-topics/ft-icon";
|
|
16
16
|
import { FtdsButton } from "@fluid-topics/ft-button";
|
|
17
17
|
import { styles } from "./ftds-tree-list.styles";
|
|
@@ -55,8 +55,8 @@ class FtdsTreeList extends FtLitElement {
|
|
|
55
55
|
return (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(`[data-value="${item.value}"]`);
|
|
56
56
|
}
|
|
57
57
|
isNodeExpanded(node) {
|
|
58
|
-
return (!this.userClosedNodes.has(node.value)
|
|
59
|
-
(node.expanded || this.userOpenedNodes.has(node.value)));
|
|
58
|
+
return (!this.userClosedNodes.has(node.value)
|
|
59
|
+
&& (node.expanded || this.userOpenedNodes.has(node.value)));
|
|
60
60
|
}
|
|
61
61
|
setFocusToTreeItem(item) {
|
|
62
62
|
var _a, _b;
|
|
@@ -66,7 +66,7 @@ class FtdsTreeList extends FtLitElement {
|
|
|
66
66
|
itemEl === null || itemEl === void 0 ? void 0 : itemEl.setAttribute("tabindex", "0");
|
|
67
67
|
}
|
|
68
68
|
async selectNodeByBreadcrumb(breadcrumb) {
|
|
69
|
-
let currentNode = this.data.rootNodes.find(root => root.value === breadcrumb[0]);
|
|
69
|
+
let currentNode = this.data.rootNodes.find((root) => root.value === breadcrumb[0]);
|
|
70
70
|
for (let i = 0; i < breadcrumb.length - 1; i++) {
|
|
71
71
|
currentNode = this.displayChild(currentNode, breadcrumb[i + 1]);
|
|
72
72
|
}
|
|
@@ -86,9 +86,9 @@ class FtdsTreeList extends FtLitElement {
|
|
|
86
86
|
tooltipposition="bottom"
|
|
87
87
|
part="expand-button"
|
|
88
88
|
family="${DesignSystemFamily.neutral}"
|
|
89
|
-
icon
|
|
89
|
+
icon="${FtIcons.ICON_COLLAPSE}"
|
|
90
90
|
label="${this.collapseAllLabel}"
|
|
91
|
-
@click
|
|
91
|
+
@click=${() => this.collapseAll()}
|
|
92
92
|
>
|
|
93
93
|
${this.collapseAllLabel}
|
|
94
94
|
</ftds-button>
|
|
@@ -117,7 +117,7 @@ class FtdsTreeList extends FtLitElement {
|
|
|
117
117
|
50, 45, 30, 35, 25,
|
|
118
118
|
44, 35, 27, 42, 25,
|
|
119
119
|
47, 30, 29, 45, 49,
|
|
120
|
-
].map(width => html `
|
|
120
|
+
].map((width) => html `
|
|
121
121
|
<li>
|
|
122
122
|
<div class="ft-tree-list--item">
|
|
123
123
|
<ft-skeleton style="--ft-skeleton--width: ${width}%"></ft-skeleton>
|
|
@@ -129,23 +129,23 @@ class FtdsTreeList extends FtLitElement {
|
|
|
129
129
|
renderLeftHeader() {
|
|
130
130
|
if (this.loading) {
|
|
131
131
|
return html `
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
132
|
+
<div class="header-left">
|
|
133
|
+
<ftds-typography class="header-label" variant="${FtdsTypographyVariants.body1semibold}">
|
|
134
|
+
${this.label}
|
|
135
|
+
</ftds-typography>
|
|
136
|
+
<ft-skeleton class="node-count-loader"></ft-skeleton>
|
|
137
|
+
</div>
|
|
138
|
+
`;
|
|
139
139
|
}
|
|
140
140
|
else {
|
|
141
141
|
return html `
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
142
|
+
<ftds-typography class="header-label" variant="${FtdsTypographyVariants.body1semibold}">
|
|
143
|
+
${this.label}
|
|
144
|
+
<ftds-typography variant="${FtdsTypographyVariants.body2medium}" class="node-children-count">
|
|
145
|
+
(${this.getEntriesCount()})
|
|
146
|
+
</ftds-typography>
|
|
147
|
+
</ftds-typography>
|
|
148
|
+
`;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
renderNode(node) {
|
|
@@ -160,7 +160,7 @@ class FtdsTreeList extends FtLitElement {
|
|
|
160
160
|
expanded: isNodeExpanded,
|
|
161
161
|
collapsed: isNodeExpanded,
|
|
162
162
|
"with-expandable": this.hasExpandableChildren(node),
|
|
163
|
-
"with-children": this.hasChildren(node)
|
|
163
|
+
"with-children": this.hasChildren(node),
|
|
164
164
|
};
|
|
165
165
|
return html `
|
|
166
166
|
<li role="none">
|
|
@@ -171,26 +171,26 @@ class FtdsTreeList extends FtLitElement {
|
|
|
171
171
|
aria-expanded="${ifDefined(isNodeExpanded)}"
|
|
172
172
|
class="ft-tree-list--item ${classMap(childrenClasses)}"
|
|
173
173
|
tabindex="-1"
|
|
174
|
-
@keydown
|
|
174
|
+
@keydown=${(e) => this.onKeydown(e, node, false)}
|
|
175
175
|
>
|
|
176
176
|
${when(this.hasChildren(node), () => html `
|
|
177
177
|
<ft-icon
|
|
178
178
|
part="node-expand"
|
|
179
|
-
value
|
|
180
|
-
@click
|
|
179
|
+
value="${isNodeExpanded ? FtIcons.THIN_ARROW : FtIcons.THIN_ARROW_RIGHT}"
|
|
180
|
+
@click=${() => this.expandNode(!isNodeExpanded, node.value)}
|
|
181
181
|
></ft-icon>
|
|
182
182
|
`)}
|
|
183
183
|
<div class="node-label-container" @click=${(e) => this.handleNodeSelectEvent(e, node)}>
|
|
184
|
-
<
|
|
184
|
+
<ftds-typography
|
|
185
185
|
part="node-label"
|
|
186
|
-
variant="${
|
|
186
|
+
variant="${FtdsTypographyVariants.body2medium}"
|
|
187
187
|
>
|
|
188
188
|
${node.label}
|
|
189
|
-
</
|
|
189
|
+
</ftds-typography>
|
|
190
190
|
${when(this.hasChildren(node), () => html `
|
|
191
|
-
<
|
|
191
|
+
<ftds-typography variant="${FtdsTypographyVariants.body2medium}" class="node-children-count">
|
|
192
192
|
(${this.getChildrenCount(node)})
|
|
193
|
-
</
|
|
193
|
+
</ftds-typography>
|
|
194
194
|
`)}
|
|
195
195
|
</div>
|
|
196
196
|
</a>
|
|
@@ -218,15 +218,15 @@ class FtdsTreeList extends FtLitElement {
|
|
|
218
218
|
tabindex="-1"
|
|
219
219
|
aria-expanded="false"
|
|
220
220
|
class="ft-tree-list--item ${classMap(childrenClasses)}"
|
|
221
|
-
@click
|
|
222
|
-
@keydown
|
|
223
|
-
<ft-icon value
|
|
224
|
-
<
|
|
221
|
+
@click=${() => this.loadMore(node)}
|
|
222
|
+
@keydown=${(e) => this.onKeydown(e, createLoadMoreNode(node), true, node)}>
|
|
223
|
+
<ft-icon value="${FtIcons.ARROW_DOWN}"></ft-icon>
|
|
224
|
+
<ftds-typography
|
|
225
225
|
part="node-label"
|
|
226
|
-
variant="${
|
|
226
|
+
variant="${FtdsTypographyVariants.body2medium}"
|
|
227
227
|
>
|
|
228
228
|
${this.loadMoreLabel}
|
|
229
|
-
</
|
|
229
|
+
</ftds-typography>
|
|
230
230
|
</a>
|
|
231
231
|
</li>
|
|
232
232
|
`;
|
|
@@ -247,9 +247,9 @@ class FtdsTreeList extends FtLitElement {
|
|
|
247
247
|
}
|
|
248
248
|
if (typeof this.emptyState.title === "string") {
|
|
249
249
|
return html `
|
|
250
|
-
<
|
|
250
|
+
<ftds-typography class="empty-state--title" variant="${FtdsTypographyVariants.body1medium}">
|
|
251
251
|
${this.emptyState.title}
|
|
252
|
-
</
|
|
252
|
+
</ftds-typography>`;
|
|
253
253
|
}
|
|
254
254
|
else {
|
|
255
255
|
return this.emptyState.title;
|
|
@@ -264,10 +264,10 @@ class FtdsTreeList extends FtLitElement {
|
|
|
264
264
|
this.emptyState.description = [this.emptyState.description];
|
|
265
265
|
}
|
|
266
266
|
if (this.emptyState.description instanceof Array) {
|
|
267
|
-
const labels = this.emptyState.description.map(label => html `
|
|
268
|
-
<
|
|
267
|
+
const labels = this.emptyState.description.map((label) => html `
|
|
268
|
+
<ftds-typography variant="${FtdsTypographyVariants.body1medium}">
|
|
269
269
|
${label}
|
|
270
|
-
</
|
|
270
|
+
</ftds-typography>`);
|
|
271
271
|
return html `
|
|
272
272
|
<div class="empty-state--description">${labels}</div>`;
|
|
273
273
|
}
|
|
@@ -293,12 +293,12 @@ class FtdsTreeList extends FtLitElement {
|
|
|
293
293
|
let needToStopPropagation = false;
|
|
294
294
|
const tree = this.data.rootNodes;
|
|
295
295
|
const visibleItems = this.getAdjacentVisibleTreeItems(tree, currentNode);
|
|
296
|
-
|
|
296
|
+
const currentNodeIndex = visibleItems.findIndex((node) => node.value === currentNode.value);
|
|
297
297
|
if (event.shiftKey && (event.key === " " || event.key === "Space")) {
|
|
298
298
|
event.stopPropagation();
|
|
299
299
|
}
|
|
300
300
|
else {
|
|
301
|
-
|
|
301
|
+
const nodeExpanded = this.isNodeExpanded(currentNode);
|
|
302
302
|
switch (event.key) {
|
|
303
303
|
case "Enter":
|
|
304
304
|
case " ":
|
|
@@ -335,9 +335,9 @@ class FtdsTreeList extends FtLitElement {
|
|
|
335
335
|
this.expandNode(!nodeExpanded, currentNode.value);
|
|
336
336
|
}
|
|
337
337
|
else {
|
|
338
|
-
|
|
338
|
+
const breadcrumb = getPathToNode(tree, currentNode.value);
|
|
339
339
|
if (breadcrumb && breadcrumb.length > 1) {
|
|
340
|
-
|
|
340
|
+
const parent = breadcrumb[breadcrumb.length - 2];
|
|
341
341
|
this.setFocusToTreeItem(parent);
|
|
342
342
|
}
|
|
343
343
|
}
|
|
@@ -352,9 +352,9 @@ class FtdsTreeList extends FtLitElement {
|
|
|
352
352
|
needToStopPropagation = true;
|
|
353
353
|
break;
|
|
354
354
|
case "*":
|
|
355
|
-
|
|
355
|
+
const breadcrumb = getPathToNode(tree, currentNode.value);
|
|
356
356
|
if (breadcrumb && breadcrumb.length > 1) {
|
|
357
|
-
|
|
357
|
+
const siblings = breadcrumb[breadcrumb.length - 2].children;
|
|
358
358
|
for (const node of siblings) {
|
|
359
359
|
this.expandNode(true, node.value);
|
|
360
360
|
}
|
|
@@ -415,11 +415,11 @@ class FtdsTreeList extends FtLitElement {
|
|
|
415
415
|
return false;
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
|
-
|
|
418
|
+
const pathToNode = getPathToNode(tree, treeitem.value);
|
|
419
419
|
if (pathToNode && pathToNode.length > 1) {
|
|
420
420
|
const parentNode = pathToNode[(pathToNode === null || pathToNode === void 0 ? void 0 : pathToNode.length) - 2];
|
|
421
421
|
const parentItem = this.getItemSelector(parentNode);
|
|
422
|
-
const childIndex = parentNode.children.findIndex((child => child.value === treeitem.value)
|
|
422
|
+
const childIndex = parentNode.children.findIndex((child) => child.value === treeitem.value);
|
|
423
423
|
if (!parentItem || parentItem.getAttribute("aria-expanded") === "false" || childIndex >= ((_b = parentNode.loadedCount) !== null && _b !== void 0 ? _b : Infinity)) {
|
|
424
424
|
return false;
|
|
425
425
|
}
|
|
@@ -457,7 +457,7 @@ class FtdsTreeList extends FtLitElement {
|
|
|
457
457
|
if (node.children.length !== 0) {
|
|
458
458
|
return [
|
|
459
459
|
...(node.expanded ? [] : [node.value]),
|
|
460
|
-
...node.children.flatMap((c) => this.getAllClosedNodes(c))
|
|
460
|
+
...node.children.flatMap((c) => this.getAllClosedNodes(c)),
|
|
461
461
|
];
|
|
462
462
|
}
|
|
463
463
|
else {
|
|
@@ -495,7 +495,7 @@ class FtdsTreeList extends FtLitElement {
|
|
|
495
495
|
displayChild(currentNode, childValue) {
|
|
496
496
|
var _a;
|
|
497
497
|
this.expandNode(true, currentNode.value);
|
|
498
|
-
const childIndex = currentNode.children.findIndex((child => child.value === childValue)
|
|
498
|
+
const childIndex = currentNode.children.findIndex((child) => child.value === childValue);
|
|
499
499
|
currentNode.loadedCount = Math.max((_a = currentNode.loadedCount) !== null && _a !== void 0 ? _a : this.pageSize, childIndex + 1);
|
|
500
500
|
return currentNode.children[childIndex];
|
|
501
501
|
}
|
|
@@ -516,7 +516,7 @@ class FtdsTreeList extends FtLitElement {
|
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
FtdsTreeList.elementDefinitions = {
|
|
519
|
-
"
|
|
519
|
+
"ftds-typography": FtdsTypography,
|
|
520
520
|
"ftds-button": FtdsButton,
|
|
521
521
|
"ft-icon": FtIcon,
|
|
522
522
|
"ft-skeleton": FtSkeleton,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from "lit";
|
|
2
2
|
import { foundation, setVariable } from "@fluid-topics/ft-wc-utils";
|
|
3
|
-
import {
|
|
3
|
+
import { FtdsTypographyBody2SemiboldCssVariables } from "@fluid-topics/ft-typography";
|
|
4
4
|
import { treeList } from "@fluid-topics/design-system-variables";
|
|
5
5
|
import { FtIconCssVariables } from "@fluid-topics/ft-icon";
|
|
6
6
|
export { treeList as FtdsTreeListCssVariables } from "@fluid-topics/design-system-variables";
|
|
@@ -126,7 +126,7 @@ export const styles = css `
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/* Selected Node */
|
|
129
|
-
li > a[role="treeitem"][aria-selected=true]
|
|
129
|
+
li > a[role="treeitem"][aria-selected=true] ftds-typography[part="node-label"] {
|
|
130
130
|
color: ${treeList.nodeSelectedLabelColor};
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -140,7 +140,7 @@ export const styles = css `
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
/* Descendent of selected Node */
|
|
143
|
-
li > a[role="treeitem"][aria-selected=true] + ul a
|
|
143
|
+
li > a[role="treeitem"][aria-selected=true] + ul a ftds-typography[part="node-label"] {
|
|
144
144
|
color: ${treeList.nodeDescendantOfSelectedLabelColor};
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -165,7 +165,7 @@ export const styles = css `
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
[part="load-more"] [part="node-label"],
|
|
168
|
-
li > a[role="treeitem"][aria-selected=true] + ul a[part="load-more"]
|
|
168
|
+
li > a[role="treeitem"][aria-selected=true] + ul a[part="load-more"] ftds-typography[part="node-label"] {
|
|
169
169
|
color: ${treeList.loadMoreLabelColor};
|
|
170
170
|
margin-left: ${treeList.loadMoreLabelMarginLeft};
|
|
171
171
|
}
|
|
@@ -205,20 +205,19 @@ export const styles = css `
|
|
|
205
205
|
align-items: baseline;
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
|
|
208
|
+
ftds-typography[part="node-label"] {
|
|
209
209
|
height: 100%;
|
|
210
210
|
white-space: nowrap;
|
|
211
211
|
color: ${treeList.nodeUnselectedLabelColor};
|
|
212
212
|
margin-right: ${treeList.nodeParentLabelMarginRight};
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
li a[role="treeitem"].with-children > .node-label-container >
|
|
215
|
+
li a[role="treeitem"].with-children > .node-label-container > ftds-typography[part="node-label"] {
|
|
216
216
|
margin-left: ${treeList.nodeParentLabelMarginLeft};
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
li > a[aria-selected=true] >
|
|
220
|
-
${setVariable(
|
|
221
|
-
${setVariable(FtTypographyCssVariables.fontWeight, "bold")};
|
|
219
|
+
li > a[aria-selected=true] > ftds-typography[part="node-label"] {
|
|
220
|
+
${setVariable(FtdsTypographyBody2SemiboldCssVariables.fontWeight, "bold")};
|
|
222
221
|
}
|
|
223
222
|
|
|
224
223
|
.node-children-count {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-tree-list",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.46",
|
|
4
4
|
"description": "A tree list component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@fluid-topics/design-system-variables": "2.53.1",
|
|
23
|
-
"@fluid-topics/ft-assets": "1.3.
|
|
24
|
-
"@fluid-topics/ft-button": "1.3.
|
|
25
|
-
"@fluid-topics/ft-icon": "1.3.
|
|
26
|
-
"@fluid-topics/ft-skeleton": "1.3.
|
|
27
|
-
"@fluid-topics/ft-typography": "1.3.
|
|
28
|
-
"@fluid-topics/ft-wc-utils": "1.3.
|
|
23
|
+
"@fluid-topics/ft-assets": "1.3.46",
|
|
24
|
+
"@fluid-topics/ft-button": "1.3.46",
|
|
25
|
+
"@fluid-topics/ft-icon": "1.3.46",
|
|
26
|
+
"@fluid-topics/ft-skeleton": "1.3.46",
|
|
27
|
+
"@fluid-topics/ft-typography": "1.3.46",
|
|
28
|
+
"@fluid-topics/ft-wc-utils": "1.3.46",
|
|
29
29
|
"lit": "3.1.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@fluid-topics/ft-wc-test-utils": "1.3.
|
|
32
|
+
"@fluid-topics/ft-wc-test-utils": "1.3.46"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "d6cf25d6ed0dead8c7aff4f94a493c35d12f1392"
|
|
35
35
|
}
|