@ni/nimble-components 18.12.2 → 18.12.4
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/dist/all-components-bundle.js +170 -172
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +1507 -1492
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/table/components/group-row/styles.js +29 -7
- package/dist/esm/table/components/group-row/styles.js.map +1 -1
- package/dist/esm/table/components/row/styles.js +45 -4
- package/dist/esm/table/components/row/styles.js.map +1 -1
- package/dist/esm/table/styles.js +7 -47
- package/dist/esm/table/styles.js.map +1 -1
- package/dist/esm/theme-provider/design-tokens.js +1 -1
- package/dist/esm/tree-item/index.d.ts +2 -9
- package/dist/esm/tree-item/index.js +10 -46
- package/dist/esm/tree-item/index.js.map +1 -1
- package/dist/esm/tree-view/index.d.ts +5 -0
- package/dist/esm/tree-view/index.js +26 -2
- package/dist/esm/tree-view/index.js.map +1 -1
- package/dist/esm/tree-view/template.d.ts +2 -0
- package/dist/esm/tree-view/template.js +17 -0
- package/dist/esm/tree-view/template.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { css } from '@microsoft/fast-element';
|
|
2
2
|
import { display } from '@microsoft/fast-foundation';
|
|
3
|
-
import {
|
|
3
|
+
import { White } from '@ni/nimble-tokens/dist/styledictionary/js/tokens';
|
|
4
|
+
import { applicationBackgroundColor, borderWidth, controlHeight, controlSlimHeight, fillHoverColor, mediumDelay, smallPadding, standardPadding } from '../../../theme-provider/design-tokens';
|
|
5
|
+
import { Theme } from '../../../theme-provider/types';
|
|
6
|
+
import { hexToRgbaCssColor } from '../../../utilities/style/colors';
|
|
7
|
+
import { themeBehavior } from '../../../utilities/style/theme';
|
|
4
8
|
export const styles = css `
|
|
5
9
|
${display('flex')}
|
|
6
10
|
|
|
7
11
|
:host {
|
|
8
12
|
align-items: center;
|
|
9
13
|
height: calc(${controlHeight} + 2 * ${borderWidth});
|
|
10
|
-
border-top: calc(2 * ${borderWidth}) solid ${
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
:host(:hover) {
|
|
14
|
-
background: ${fillHoverColor};
|
|
14
|
+
border-top: calc(2 * ${borderWidth}) solid ${applicationBackgroundColor};
|
|
15
|
+
box-sizing: border-box;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
:host([expanded]) .animating,
|
|
@@ -19,6 +20,19 @@ export const styles = css `
|
|
|
19
20
|
transition: ${mediumDelay} ease-in-out;
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
:host::before {
|
|
24
|
+
content: '';
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: ${controlHeight};
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
bottom: 0px;
|
|
29
|
+
position: absolute;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:host(:hover)::before {
|
|
33
|
+
background-color: ${fillHoverColor};
|
|
34
|
+
}
|
|
35
|
+
|
|
22
36
|
.expand-collapse-button {
|
|
23
37
|
margin-left: calc(
|
|
24
38
|
${smallPadding} * 2 + ${standardPadding} * 2 *
|
|
@@ -72,5 +86,13 @@ export const styles = css `
|
|
|
72
86
|
.selection-checkbox::part(label) {
|
|
73
87
|
padding-left: 0px;
|
|
74
88
|
}
|
|
75
|
-
|
|
89
|
+
`.withBehaviors(themeBehavior(Theme.color, css `
|
|
90
|
+
:host(:hover)::before {
|
|
91
|
+
background-color: ${hexToRgbaCssColor(White, 0.05)};
|
|
92
|
+
}
|
|
93
|
+
`), themeBehavior(Theme.dark, css `
|
|
94
|
+
:host(:hover)::before {
|
|
95
|
+
background-color: ${hexToRgbaCssColor(White, 0.1)};
|
|
96
|
+
}
|
|
97
|
+
`));
|
|
76
98
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../src/table/components/group-row/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACH,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,YAAY,EACZ,eAAe,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../src/table/components/group-row/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,kDAAkD,CAAC;AACzE,OAAO,EACH,0BAA0B,EAC1B,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,YAAY,EACZ,eAAe,EAClB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;;;;uBAIE,aAAa,UAAU,WAAW;+BAC1B,WAAW,WAAW,0BAA0B;;;;;;sBAMzD,WAAW;;;;;;kBAMf,aAAa;;;;;;;4BAOH,cAAc;;;;;cAK5B,YAAY,UAAU,eAAe;;;iBAGlC,iBAAiB;kBAChB,iBAAiB;;;;;;;;;;;;;;;;;6BAiBN,eAAe;;;;;;;;;;;;;;;;;;;;;;;;uBAwBrB,eAAe;;;;;;CAMrC,CAAC,aAAa,CACX,aAAa,CACT,KAAK,CAAC,KAAK,EACX,GAAG,CAAA;;oCAEyB,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC;;SAEzD,CACJ,EACD,aAAa,CACT,KAAK,CAAC,IAAI,EACV,GAAG,CAAA;;oCAEyB,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC;;SAExD,CACJ,CACJ,CAAC"}
|
|
@@ -1,14 +1,43 @@
|
|
|
1
1
|
import { css } from '@microsoft/fast-element';
|
|
2
2
|
import { display } from '@microsoft/fast-foundation';
|
|
3
|
-
import {
|
|
3
|
+
import { White } from '@ni/nimble-tokens/dist/styledictionary/js/tokens';
|
|
4
|
+
import { applicationBackgroundColor, borderWidth, controlHeight, fillHoverColor, fillHoverSelectedColor, fillSelectedColor, standardPadding } from '../../../theme-provider/design-tokens';
|
|
5
|
+
import { Theme } from '../../../theme-provider/types';
|
|
6
|
+
import { hexToRgbaCssColor } from '../../../utilities/style/colors';
|
|
7
|
+
import { themeBehavior } from '../../../utilities/style/theme';
|
|
4
8
|
export const styles = css `
|
|
5
9
|
${display('flex')}
|
|
6
10
|
|
|
7
11
|
:host {
|
|
8
|
-
height: calc(${controlHeight} + 2 * ${borderWidth});
|
|
9
|
-
border-top: calc(2 * ${borderWidth}) solid ${tableRowBorderColor};
|
|
10
12
|
width: fit-content;
|
|
11
13
|
min-width: 100%;
|
|
14
|
+
background-color: ${applicationBackgroundColor};
|
|
15
|
+
height: calc(${controlHeight} + 2 * ${borderWidth});
|
|
16
|
+
border-top: calc(2 * ${borderWidth}) solid transparent;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
background-clip: padding-box;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:host::before {
|
|
22
|
+
content: '';
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: ${controlHeight};
|
|
25
|
+
pointer-events: none;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
bottom: 0px;
|
|
28
|
+
position: absolute;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:host([selectable]:not([selected]):hover)::before {
|
|
32
|
+
background-color: ${fillHoverColor};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host([selected])::before {
|
|
36
|
+
background-color: ${fillSelectedColor};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:host([selected]:hover)::before {
|
|
40
|
+
background-color: ${fillHoverSelectedColor};
|
|
12
41
|
}
|
|
13
42
|
|
|
14
43
|
.checkbox-container {
|
|
@@ -46,5 +75,17 @@ export const styles = css `
|
|
|
46
75
|
:host([selected]) nimble-table-cell {
|
|
47
76
|
--ni-private-table-cell-action-menu-display: block;
|
|
48
77
|
}
|
|
49
|
-
|
|
78
|
+
`.withBehaviors(themeBehavior(Theme.color, css `
|
|
79
|
+
:host([selectable]:not([selected]):hover)::before {
|
|
80
|
+
background-color: ${hexToRgbaCssColor(White, 0.05)};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:host([selected])::before {
|
|
84
|
+
background-color: ${hexToRgbaCssColor(White, 0.25)};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
:host([selected]:hover)::before {
|
|
88
|
+
background-color: ${hexToRgbaCssColor(White, 0.2)};
|
|
89
|
+
}
|
|
90
|
+
`));
|
|
50
91
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../src/table/components/row/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACH,WAAW,EACX,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../src/table/components/row/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,kDAAkD,CAAC;AACzE,OAAO,EACH,0BAA0B,EAC1B,WAAW,EACX,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EAClB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;;;;;4BAKO,0BAA0B;uBAC/B,aAAa,UAAU,WAAW;+BAC1B,WAAW;;;;;;;;kBAQxB,aAAa;;;;;;;;4BAQH,cAAc;;;;4BAId,iBAAiB;;;;4BAIjB,sBAAsB;;;;;;;;uBAQ3B,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BrC,CAAC,aAAa,CACX,aAAa,CACT,KAAK,CAAC,KAAK,EACX,GAAG,CAAA;;oCAEyB,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC;;;;oCAI9B,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC;;;;oCAI9B,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC;;SAExD,CACJ,CACJ,CAAC"}
|
package/dist/esm/table/styles.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css } from '@microsoft/fast-element';
|
|
2
2
|
import { display } from '@microsoft/fast-foundation';
|
|
3
3
|
import { White } from '@ni/nimble-tokens/dist/styledictionary/js/tokens';
|
|
4
|
-
import { applicationBackgroundColor, bodyFont, bodyFontColor,
|
|
4
|
+
import { applicationBackgroundColor, bodyFont, bodyFontColor, standardPadding, tableRowBorderColor } from '../theme-provider/design-tokens';
|
|
5
5
|
import { Theme } from '../theme-provider/types';
|
|
6
6
|
import { hexToRgbaCssColor } from '../utilities/style/colors';
|
|
7
7
|
import { themeBehavior } from '../utilities/style/theme';
|
|
@@ -40,6 +40,7 @@ export const styles = css `
|
|
|
40
40
|
width: 100%;
|
|
41
41
|
position: relative;
|
|
42
42
|
top: var(--ni-private-table-row-container-top);
|
|
43
|
+
background-color: ${tableRowBorderColor};
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
.header-container {
|
|
@@ -82,61 +83,20 @@ export const styles = css `
|
|
|
82
83
|
padding-left: 0px;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
.row {
|
|
86
|
-
background: ${applicationBackgroundColor};
|
|
86
|
+
.group-row {
|
|
87
87
|
position: relative;
|
|
88
|
-
box-sizing: border-box;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.row::before {
|
|
92
|
-
content: '';
|
|
93
|
-
width: 100%;
|
|
94
|
-
height: 100%;
|
|
95
|
-
position: absolute;
|
|
96
|
-
pointer-events: none;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
:host([selection-mode='single']) .row:hover::before,
|
|
100
|
-
:host([selection-mode='multiple']) .row:hover::before {
|
|
101
|
-
background: ${fillHoverColor};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
:host([selection-mode='single']) .row[selected]::before,
|
|
105
|
-
:host([selection-mode='multiple']) .row[selected]::before {
|
|
106
|
-
background: ${fillSelectedColor};
|
|
107
88
|
}
|
|
108
89
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
background: ${fillHoverSelectedColor};
|
|
90
|
+
.row {
|
|
91
|
+
position: relative;
|
|
112
92
|
}
|
|
113
93
|
`.withBehaviors(themeBehavior(Theme.color, css `
|
|
114
|
-
.
|
|
94
|
+
.table-row-container::before {
|
|
115
95
|
content: '';
|
|
116
96
|
width: 100%;
|
|
117
97
|
height: 100%;
|
|
98
|
+
background-color: ${hexToRgbaCssColor(White, 0.1)};
|
|
118
99
|
position: absolute;
|
|
119
|
-
background: ${fillHoverColor};
|
|
120
|
-
pointer-events: none;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.row::before {
|
|
124
|
-
background: ${fillHoverColor};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
:host([selection-mode='single']) .row:hover::before,
|
|
128
|
-
:host([selection-mode='multiple']) .row:hover::before {
|
|
129
|
-
background: ${hexToRgbaCssColor(White, 0.15)};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
:host([selection-mode='single']) .row[selected]::before,
|
|
133
|
-
:host([selection-mode='multiple']) .row[selected]::before {
|
|
134
|
-
background: ${hexToRgbaCssColor(White, 0.25)};
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
:host([selection-mode='single']) .row[selected]:hover::before,
|
|
138
|
-
:host([selection-mode='multiple']) .row[selected]:hover::before {
|
|
139
|
-
background: ${hexToRgbaCssColor(White, 0.2)};
|
|
140
100
|
}
|
|
141
101
|
`));
|
|
142
102
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/table/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,kDAAkD,CAAC;AACzE,OAAO,EACH,0BAA0B,EAC1B,QAAQ,EACR,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/table/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,kDAAkD,CAAC;AACzE,OAAO,EACH,0BAA0B,EAC1B,QAAQ,EACR,aAAa,EACb,eAAe,EACf,mBAAmB,EACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;;;;;;;;;;;gBAWL,QAAQ;iBACP,aAAa;;;;;;;;;;;;;;;;;;;;;;4BAsBF,mBAAmB;;;;;;;;;;sBAUzB,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;uBA0BzB,eAAe;;;;;;;;;;;;;;CAcrC,CAAC,aAAa,CACX,aAAa,CACT,KAAK,CAAC,KAAK,EACX,GAAG,CAAA;;;;;oCAKyB,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC;;;SAGxD,CACJ,CACJ,CAAC"}
|
|
@@ -48,7 +48,7 @@ export const iconColor = DesignToken.create(styleNameFromTokenName(tokenNames.ic
|
|
|
48
48
|
export const modalBackdropColor = DesignToken.create(styleNameFromTokenName(tokenNames.modalBackdropColor)).withDefault((element) => getModalBackdropForTheme(element));
|
|
49
49
|
export const popupBorderColor = DesignToken.create(styleNameFromTokenName(tokenNames.popupBorderColor)).withDefault((element) => hexToRgbaCssColor(getColorForTheme(element, Black91, Black15, White), 0.3));
|
|
50
50
|
export const tooltipBackgroundColor = DesignToken.create(styleNameFromTokenName(tokenNames.tooltipBackgroundColor)).withDefault((element) => getColorForTheme(element, Black15, Black85, ForestGreen));
|
|
51
|
-
export const tableRowBorderColor = DesignToken.create(styleNameFromTokenName(tokenNames.tableRowBorderColor)).withDefault((element) => getColorForTheme(element, Black15,
|
|
51
|
+
export const tableRowBorderColor = DesignToken.create(styleNameFromTokenName(tokenNames.tableRowBorderColor)).withDefault((element) => getColorForTheme(element, Black15, Black80, ForestGreen));
|
|
52
52
|
// Component Sizing Tokens
|
|
53
53
|
export const controlHeight = DesignToken.create(styleNameFromTokenName(tokenNames.controlHeight)).withDefault('32px');
|
|
54
54
|
export const controlSlimHeight = DesignToken.create(styleNameFromTokenName(tokenNames.controlSlimHeight)).withDefault('24px');
|
|
@@ -15,16 +15,9 @@ declare global {
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
export declare class TreeItem extends FoundationTreeItem {
|
|
18
|
-
private treeView;
|
|
19
|
-
connectedCallback(): void;
|
|
20
|
-
disconnectedCallback(): void;
|
|
21
|
-
private readonly handleSelectedChange;
|
|
22
|
-
private clearTreeGroupSelection;
|
|
23
|
-
private setGroupSelectionOnRootParentTreeItem;
|
|
24
18
|
/**
|
|
25
|
-
*
|
|
26
|
-
* @returns the root tree view
|
|
19
|
+
* @internal
|
|
27
20
|
*/
|
|
28
|
-
|
|
21
|
+
groupSelected: boolean;
|
|
29
22
|
}
|
|
30
23
|
export declare const treeItemTag: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr } from '@microsoft/fast-element';
|
|
3
|
+
import { TreeItem as FoundationTreeItem, DesignSystem, treeItemTemplate as template } from '@microsoft/fast-foundation';
|
|
2
4
|
import { arrowExpanderUp16X16 } from '@ni/nimble-tokens/dist/icons/js';
|
|
3
|
-
import { groupSelectedAttribute } from '../tree-view/types';
|
|
4
5
|
import { styles } from './styles';
|
|
5
6
|
/**
|
|
6
7
|
* A function that returns a nimble-tree-item registration for configuring the component with a DesignSystem.
|
|
@@ -15,52 +16,15 @@ import { styles } from './styles';
|
|
|
15
16
|
export class TreeItem extends FoundationTreeItem {
|
|
16
17
|
constructor() {
|
|
17
18
|
super(...arguments);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.
|
|
22
|
-
// only process selection
|
|
23
|
-
if (event.target === this && this.selected) {
|
|
24
|
-
this.setGroupSelectionOnRootParentTreeItem(this);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
connectedCallback() {
|
|
29
|
-
super.connectedCallback();
|
|
30
|
-
this.addEventListener('selected-change', this.handleSelectedChange);
|
|
31
|
-
this.treeView = this.getParentTreeView();
|
|
32
|
-
if (this.treeView && this.selected) {
|
|
33
|
-
this.setGroupSelectionOnRootParentTreeItem(this);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
disconnectedCallback() {
|
|
37
|
-
super.disconnectedCallback();
|
|
38
|
-
this.removeEventListener('selected-change', this.handleSelectedChange);
|
|
39
|
-
this.treeView = null;
|
|
40
|
-
}
|
|
41
|
-
clearTreeGroupSelection() {
|
|
42
|
-
const currentGroupSelection = this.treeView?.querySelectorAll(`[${groupSelectedAttribute}]`);
|
|
43
|
-
currentGroupSelection?.forEach(treeItem => treeItem.removeAttribute(groupSelectedAttribute));
|
|
44
|
-
}
|
|
45
|
-
setGroupSelectionOnRootParentTreeItem(treeItem) {
|
|
46
|
-
this.clearTreeGroupSelection();
|
|
47
|
-
let currentItem = treeItem;
|
|
48
|
-
while (currentItem?.parentElement !== this.treeView) {
|
|
49
|
-
currentItem = currentItem?.parentElement;
|
|
50
|
-
}
|
|
51
|
-
if (currentItem) {
|
|
52
|
-
currentItem.setAttribute(groupSelectedAttribute, 'true');
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* This was copied directly from the FAST TreeItem implementation
|
|
57
|
-
* @returns the root tree view
|
|
58
|
-
*/
|
|
59
|
-
getParentTreeView() {
|
|
60
|
-
const parentNode = this.parentElement.closest("[role='tree']");
|
|
61
|
-
return parentNode;
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
this.groupSelected = false;
|
|
62
23
|
}
|
|
63
24
|
}
|
|
25
|
+
__decorate([
|
|
26
|
+
attr({ attribute: 'group-selected', mode: 'boolean' })
|
|
27
|
+
], TreeItem.prototype, "groupSelected", void 0);
|
|
64
28
|
const nimbleTreeItem = TreeItem.compose({
|
|
65
29
|
baseName: 'tree-item',
|
|
66
30
|
baseClass: FoundationTreeItem,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tree-item/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tree-item/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EACH,QAAQ,IAAI,kBAAkB,EAE9B,YAAY,EACZ,gBAAgB,IAAI,QAAQ,EAC/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAQlC;;;;;;;;;GASG;AACH,MAAM,OAAO,QAAS,SAAQ,kBAAkB;IAAhD;;QACI;;WAEG;QAEI,kBAAa,GAAG,KAAK,CAAC;IACjC,CAAC;CAAA;AADG;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;+CAC1B;AAGjC,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,CAAkB;IACrD,QAAQ,EAAE,WAAW;IACrB,SAAS,EAAE,kBAAkB;IAC7B,QAAQ;IACR,MAAM;IACN,mBAAmB,EAAE,oBAAoB,CAAC,IAAI;CACjD,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -17,8 +17,13 @@ declare global {
|
|
|
17
17
|
*/
|
|
18
18
|
export declare class TreeView extends FoundationTreeView {
|
|
19
19
|
selectionMode: TreeViewSelectionMode;
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
selectedItems: Element[];
|
|
20
24
|
handleClick(e: Event): boolean;
|
|
21
25
|
private canSelect;
|
|
22
26
|
private itemHasChildren;
|
|
27
|
+
private selectedItemsChanged;
|
|
23
28
|
}
|
|
24
29
|
export declare const treeViewTag: string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { attr } from '@microsoft/fast-element';
|
|
3
|
-
import {
|
|
2
|
+
import { attr, observable } from '@microsoft/fast-element';
|
|
3
|
+
import { TreeView as FoundationTreeView, DesignSystem, isTreeItemElement } from '@microsoft/fast-foundation';
|
|
4
|
+
import { TreeItem } from '../tree-item';
|
|
4
5
|
import { styles } from './styles';
|
|
6
|
+
import { template } from './template';
|
|
5
7
|
import { TreeViewSelectionMode } from './types';
|
|
6
8
|
/**
|
|
7
9
|
* A function that returns a nimble-tree-view registration for configuring the component with a DesignSystem.
|
|
@@ -17,6 +19,10 @@ export class TreeView extends FoundationTreeView {
|
|
|
17
19
|
constructor() {
|
|
18
20
|
super(...arguments);
|
|
19
21
|
this.selectionMode = TreeViewSelectionMode.all;
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
this.selectedItems = [];
|
|
20
26
|
}
|
|
21
27
|
handleClick(e) {
|
|
22
28
|
if (e.defaultPrevented) {
|
|
@@ -55,10 +61,28 @@ export class TreeView extends FoundationTreeView {
|
|
|
55
61
|
const treeItemChild = item.querySelector('[role="treeitem"]');
|
|
56
62
|
return treeItemChild !== null;
|
|
57
63
|
}
|
|
64
|
+
selectedItemsChanged() {
|
|
65
|
+
for (const item of Array.from(this.children)) {
|
|
66
|
+
if (item instanceof TreeItem) {
|
|
67
|
+
item.groupSelected = false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
for (let item of this.selectedItems) {
|
|
71
|
+
while (item.parentElement !== null && item.parentElement !== this) {
|
|
72
|
+
item = item.parentElement;
|
|
73
|
+
}
|
|
74
|
+
if (item instanceof TreeItem) {
|
|
75
|
+
item.groupSelected = true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
58
79
|
}
|
|
59
80
|
__decorate([
|
|
60
81
|
attr({ attribute: 'selection-mode' })
|
|
61
82
|
], TreeView.prototype, "selectionMode", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
observable
|
|
85
|
+
], TreeView.prototype, "selectedItems", void 0);
|
|
62
86
|
const nimbleTreeView = TreeView.compose({
|
|
63
87
|
baseName: 'tree-view',
|
|
64
88
|
baseClass: FoundationTreeView,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tree-view/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tree-view/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { children, html, ref, slotted } from '@microsoft/fast-element';
|
|
2
|
+
// prettier-ignore
|
|
3
|
+
export const template = html `
|
|
4
|
+
<template
|
|
5
|
+
role="tree"
|
|
6
|
+
${ref('treeView')}
|
|
7
|
+
${children({ property: 'selectedItems', subtree: true, selector: '[role="treeitem"][selected]', attributeFilter: ['role', 'selected'] })}
|
|
8
|
+
@keydown="${(x, c) => x.handleKeyDown(c.event)}"
|
|
9
|
+
@focusin="${(x, c) => x.handleFocus(c.event)}"
|
|
10
|
+
@focusout="${(x, c) => x.handleBlur(c.event)}"
|
|
11
|
+
@click="${(x, c) => x.handleClick(c.event)}"
|
|
12
|
+
@selected-change="${(x, c) => x.handleSelectedChange(c.event)}"
|
|
13
|
+
>
|
|
14
|
+
<slot ${slotted('slottedTreeItems')}></slot>
|
|
15
|
+
</template>
|
|
16
|
+
`;
|
|
17
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/tree-view/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGvE,kBAAkB;AAClB,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAU;;;UAG5B,GAAG,CAAC,UAAU,CAAC;UACf,QAAQ,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,6BAA6B,EAAE,eAAe,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC;oBAC5H,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAsB,CAAC;oBACnD,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAmB,CAAC;qBAC7C,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAmB,CAAC;kBAChD,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAmB,CAAC;4BACpC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC;;gBAErD,OAAO,CAAC,kBAAkB,CAAC;;CAE1C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ni/nimble-components",
|
|
3
|
-
"version": "18.12.
|
|
3
|
+
"version": "18.12.4",
|
|
4
4
|
"description": "Styled web components for the NI Nimble Design System",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run generate-icons && npm run build-components && npm run bundle-components && npm run generate-scss && npm run build-storybook",
|