@ni/nimble-components 18.10.2 → 18.10.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 +774 -168
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +3184 -3028
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/anchor-tab/index.d.ts +9 -0
- package/dist/esm/anchor-tab/index.js +12 -0
- package/dist/esm/anchor-tab/index.js.map +1 -1
- package/dist/esm/table/components/cell/index.d.ts +1 -0
- package/dist/esm/table/components/cell/index.js +4 -0
- package/dist/esm/table/components/cell/index.js.map +1 -1
- package/dist/esm/table/components/cell/styles.js +8 -0
- package/dist/esm/table/components/cell/styles.js.map +1 -1
- package/dist/esm/table/components/cell/template.js +1 -1
- package/dist/esm/table/components/cell/template.js.map +1 -1
- package/dist/esm/table/components/group-row/index.d.ts +29 -0
- package/dist/esm/table/components/group-row/index.js +61 -0
- package/dist/esm/table/components/group-row/index.js.map +1 -0
- package/dist/esm/table/components/group-row/styles.d.ts +1 -0
- package/dist/esm/table/components/group-row/styles.js +64 -0
- package/dist/esm/table/components/group-row/styles.js.map +1 -0
- package/dist/esm/table/components/group-row/template.d.ts +2 -0
- package/dist/esm/table/components/group-row/template.js +23 -0
- package/dist/esm/table/components/group-row/template.js.map +1 -0
- package/dist/esm/table/components/row/index.d.ts +2 -0
- package/dist/esm/table/components/row/index.js +13 -5
- package/dist/esm/table/components/row/index.js.map +1 -1
- package/dist/esm/table/components/row/template.js +1 -0
- package/dist/esm/table/components/row/template.js.map +1 -1
- package/dist/esm/table/index.d.ts +14 -0
- package/dist/esm/table/index.js +84 -4
- package/dist/esm/table/index.js.map +1 -1
- package/dist/esm/table/models/table-validator.d.ts +3 -0
- package/dist/esm/table/models/table-validator.js +12 -9
- package/dist/esm/table/models/table-validator.js.map +1 -1
- package/dist/esm/table/models/update-tracker.d.ts +1 -0
- package/dist/esm/table/models/update-tracker.js +10 -1
- package/dist/esm/table/models/update-tracker.js.map +1 -1
- package/dist/esm/table/models/virtualizer.d.ts +3 -1
- package/dist/esm/table/models/virtualizer.js +3 -2
- package/dist/esm/table/models/virtualizer.js.map +1 -1
- package/dist/esm/table/template.js +33 -17
- package/dist/esm/table/template.js.map +1 -1
- package/dist/esm/table/types.d.ts +1 -0
- package/dist/esm/table/types.js.map +1 -1
- package/dist/esm/table-column/base/group-header-view/index.d.ts +14 -0
- package/dist/esm/table-column/base/group-header-view/index.js +17 -0
- package/dist/esm/table-column/base/group-header-view/index.js.map +1 -0
- package/dist/esm/table-column/base/group-header-view/template.d.ts +3 -0
- package/dist/esm/table-column/base/group-header-view/template.js +10 -0
- package/dist/esm/table-column/base/group-header-view/template.js.map +1 -0
- package/dist/esm/table-column/base/index.d.ts +25 -0
- package/dist/esm/table-column/base/index.js +23 -0
- package/dist/esm/table-column/base/index.js.map +1 -1
- package/dist/esm/table-column/mixins/groupable-column.d.ts +12 -0
- package/dist/esm/table-column/mixins/groupable-column.js +35 -0
- package/dist/esm/table-column/mixins/groupable-column.js.map +1 -0
- package/dist/esm/table-column/text/group-header-view/index.d.ts +22 -0
- package/dist/esm/table-column/text/group-header-view/index.js +47 -0
- package/dist/esm/table-column/text/group-header-view/index.js.map +1 -0
- package/dist/esm/table-column/text/group-header-view/styles.d.ts +1 -0
- package/dist/esm/table-column/text/group-header-view/styles.js +16 -0
- package/dist/esm/table-column/text/group-header-view/styles.js.map +1 -0
- package/dist/esm/table-column/text/group-header-view/template.d.ts +2 -0
- package/dist/esm/table-column/text/group-header-view/template.js +15 -0
- package/dist/esm/table-column/text/group-header-view/template.js.map +1 -0
- package/dist/esm/table-column/text/index.d.ts +9 -1
- package/dist/esm/table-column/text/index.js +7 -1
- package/dist/esm/table-column/text/index.js.map +1 -1
- package/dist/esm/tree-item/styles.js +2 -2
- package/dist/esm/tree-item/styles.js.map +1 -1
- package/package.json +19 -9
|
@@ -17,5 +17,14 @@ export declare class AnchorTab extends AnchorBase {
|
|
|
17
17
|
* HTML Attribute: disabled
|
|
18
18
|
*/
|
|
19
19
|
disabled: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Indicates the current "selected" state of various widgets.
|
|
22
|
+
* {@link https://www.w3.org/TR/wai-aria-1.1/#aria-selected}
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
* @remarks
|
|
26
|
+
* HTML Attribute: aria-selected
|
|
27
|
+
*/
|
|
28
|
+
ariaSelected: string;
|
|
20
29
|
}
|
|
21
30
|
export declare const anchorTabTag: string;
|
|
@@ -17,11 +17,23 @@ export class AnchorTab extends AnchorBase {
|
|
|
17
17
|
* HTML Attribute: disabled
|
|
18
18
|
*/
|
|
19
19
|
this.disabled = false;
|
|
20
|
+
/**
|
|
21
|
+
* Indicates the current "selected" state of various widgets.
|
|
22
|
+
* {@link https://www.w3.org/TR/wai-aria-1.1/#aria-selected}
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
* @remarks
|
|
26
|
+
* HTML Attribute: aria-selected
|
|
27
|
+
*/
|
|
28
|
+
this.ariaSelected = 'false';
|
|
20
29
|
}
|
|
21
30
|
}
|
|
22
31
|
__decorate([
|
|
23
32
|
attr({ mode: 'boolean' })
|
|
24
33
|
], AnchorTab.prototype, "disabled", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
attr({ attribute: 'aria-selected' })
|
|
36
|
+
], AnchorTab.prototype, "ariaSelected", void 0);
|
|
25
37
|
// FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
|
|
26
38
|
const nimbleAnchorTab = AnchorTab.compose({
|
|
27
39
|
baseName: 'anchor-tab',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/anchor-tab/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EACH,YAAY,EAGf,MAAM,4BAA4B,CAAC;AACpC,O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TableCell<TCellRecord extends TableCellRecord = TableCellRe
|
|
|
18
18
|
menuOpen: boolean;
|
|
19
19
|
actionMenuLabel?: string;
|
|
20
20
|
cellViewTemplate?: ViewTemplate<TableCell>;
|
|
21
|
+
nestingLevel: number;
|
|
21
22
|
readonly actionMenuButton?: MenuButton;
|
|
22
23
|
onActionMenuBeforeToggle(event: CustomEvent<MenuButtonToggleEventDetail>): void;
|
|
23
24
|
onActionMenuToggle(event: CustomEvent<MenuButtonToggleEventDetail>): void;
|
|
@@ -12,6 +12,7 @@ export class TableCell extends FoundationElement {
|
|
|
12
12
|
super(...arguments);
|
|
13
13
|
this.hasActionMenu = false;
|
|
14
14
|
this.menuOpen = false;
|
|
15
|
+
this.nestingLevel = 0;
|
|
15
16
|
}
|
|
16
17
|
onActionMenuBeforeToggle(event) {
|
|
17
18
|
this.$emit('cell-action-menu-beforetoggle', event.detail);
|
|
@@ -36,6 +37,9 @@ __decorate([
|
|
|
36
37
|
__decorate([
|
|
37
38
|
observable
|
|
38
39
|
], TableCell.prototype, "cellViewTemplate", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
observable
|
|
42
|
+
], TableCell.prototype, "nestingLevel", void 0);
|
|
39
43
|
const nimbleTableCell = TableCell.compose({
|
|
40
44
|
baseName: 'table-cell',
|
|
41
45
|
template,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/table/components/cell/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAgB,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAO7E,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQtC;;;GAGG;AACH,MAAM,OAAO,SAEX,SAAQ,iBAAiB;IAF3B;;QAOW,kBAAa,GAAG,KAAK,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AY;IACtB,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC;AAC5E,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -5,7 +5,15 @@ export const styles = css `
|
|
|
5
5
|
${display('grid')}
|
|
6
6
|
|
|
7
7
|
:host {
|
|
8
|
+
--ni-private-table-cell-nesting-level: 0;
|
|
8
9
|
padding: 0px calc(${standardPadding} / 2);
|
|
10
|
+
padding-left: calc(
|
|
11
|
+
${standardPadding} / 2 +
|
|
12
|
+
(
|
|
13
|
+
var(--ni-private-table-cell-nesting-level) *
|
|
14
|
+
${standardPadding} * 2
|
|
15
|
+
)
|
|
16
|
+
);
|
|
9
17
|
align-self: center;
|
|
10
18
|
height: 100%;
|
|
11
19
|
grid-template-columns: 1fr auto;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../src/table/components/cell/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;;;
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../src/table/components/cell/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;;;;4BAIO,eAAe;;cAE7B,eAAe;;;0BAGH,eAAe;;;;;;;;;;;;;;;;;;;CAmBxC,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { menuButtonTag } from '../../../menu-button';
|
|
|
4
4
|
import { ButtonAppearance } from '../../../menu-button/types';
|
|
5
5
|
// prettier-ignore
|
|
6
6
|
export const template = html `
|
|
7
|
-
<template role="cell">
|
|
7
|
+
<template role="cell" style="--ni-private-table-cell-nesting-level: ${x => x.nestingLevel}">
|
|
8
8
|
${x => x.cellViewTemplate}
|
|
9
9
|
${when(x => x.hasActionMenu, html `
|
|
10
10
|
<${menuButtonTag} ${ref('actionMenuButton')}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../../src/table/components/cell/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAgB,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAExE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACH,gBAAgB,EAEnB,MAAM,4BAA4B,CAAC;AAEpC,kBAAkB;AAClB,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAW
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../../src/table/components/cell/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAgB,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAExE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACH,gBAAgB,EAEnB,MAAM,4BAA4B,CAAC;AAEpC,kBAAkB;AAClB,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAW;0EACmC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY;UACnF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB;UACvB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,EAAE,IAAI,CAAW;eACrC,aAAa,IAAI,GAAG,CAAC,kBAAkB,CAAC;;8BAEzB,gBAAgB,CAAC,KAAK;iCACnB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,KAAiD,CAAC;2BAC/F,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,KAAiD,CAAC;;;mBAG3F,oBAAoB,mBAAmB,oBAAoB;kBAC5D,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe;;gBAExB,aAAa;SACpB,CAAC;;CAET,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAClC,WAAmB,EACI,EAAE,CAAC,IAAI,CAAW,IAAI,WAAW;uBACrC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,UAAU;yBAC1B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,YAAY;;QAE/C,WAAW,GAAG,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
2
|
+
import type { TableColumn } from '../../../table-column/base';
|
|
3
|
+
declare global {
|
|
4
|
+
interface HTMLElementTagNameMap {
|
|
5
|
+
'nimble-table-group-row': TableGroupRow;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A styled cell that is used within the nimble-table-row.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare class TableGroupRow extends FoundationElement {
|
|
13
|
+
groupRowValue?: unknown;
|
|
14
|
+
nestingLevel: number;
|
|
15
|
+
leafItemCount?: number;
|
|
16
|
+
groupColumn?: TableColumn;
|
|
17
|
+
expanded: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
readonly expandIcon: HTMLElement;
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
animationClass: string;
|
|
26
|
+
onGroupExpandToggle(): void;
|
|
27
|
+
private readonly removeAnimatingClass;
|
|
28
|
+
}
|
|
29
|
+
export declare const tableGroupRowTag: string;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, observable } from '@microsoft/fast-element';
|
|
3
|
+
import { DesignSystem, FoundationElement } from '@microsoft/fast-foundation';
|
|
4
|
+
import { styles } from './styles';
|
|
5
|
+
import { template } from './template';
|
|
6
|
+
/**
|
|
7
|
+
* A styled cell that is used within the nimble-table-row.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export class TableGroupRow extends FoundationElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.nestingLevel = 0;
|
|
14
|
+
this.expanded = false;
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
this.animationClass = '';
|
|
19
|
+
this.removeAnimatingClass = () => {
|
|
20
|
+
this.animationClass = '';
|
|
21
|
+
this.expandIcon.removeEventListener('transitionend', this.removeAnimatingClass);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
onGroupExpandToggle() {
|
|
25
|
+
this.$emit('group-expand-toggle');
|
|
26
|
+
// To avoid a visual glitch with improper expand/collapse icons performing an
|
|
27
|
+
// animation, we apply a class to the appropriate group row such that we can have
|
|
28
|
+
// a more targeted CSS animation. We use the 'transitionend' event to remove the
|
|
29
|
+
// temporary class and register a function reference as the handler to avoid issues
|
|
30
|
+
// that may result from the 'transitionend' event not firing, as it will never result
|
|
31
|
+
// in multiple event listeners being registered.
|
|
32
|
+
this.animationClass = 'animating';
|
|
33
|
+
this.expandIcon.addEventListener('transitionend', this.removeAnimatingClass);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
__decorate([
|
|
37
|
+
observable
|
|
38
|
+
], TableGroupRow.prototype, "groupRowValue", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
observable
|
|
41
|
+
], TableGroupRow.prototype, "nestingLevel", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
observable
|
|
44
|
+
], TableGroupRow.prototype, "leafItemCount", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
observable
|
|
47
|
+
], TableGroupRow.prototype, "groupColumn", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
attr({ mode: 'boolean' })
|
|
50
|
+
], TableGroupRow.prototype, "expanded", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
observable
|
|
53
|
+
], TableGroupRow.prototype, "animationClass", void 0);
|
|
54
|
+
const nimbleTableGroupRow = TableGroupRow.compose({
|
|
55
|
+
baseName: 'table-group-row',
|
|
56
|
+
template,
|
|
57
|
+
styles
|
|
58
|
+
});
|
|
59
|
+
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTableGroupRow());
|
|
60
|
+
export const tableGroupRowTag = DesignSystem.tagFor(TableGroupRow);
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/table/components/group-row/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE7E,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQtC;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,iBA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import { css } from '@microsoft/fast-element';
|
|
2
|
+
import { display } from '@microsoft/fast-foundation';
|
|
3
|
+
import { borderWidth, controlHeight, controlSlimHeight, fillHoverColor, mediumDelay, smallPadding, standardPadding, tableRowBorderColor } from '../../../theme-provider/design-tokens';
|
|
4
|
+
export const styles = css `
|
|
5
|
+
${display('flex')}
|
|
6
|
+
|
|
7
|
+
:host {
|
|
8
|
+
align-items: center;
|
|
9
|
+
height: calc(${controlHeight} + 2 * ${borderWidth});
|
|
10
|
+
border-top: calc(2 * ${borderWidth}) solid ${tableRowBorderColor};
|
|
11
|
+
padding-left: calc(
|
|
12
|
+
${smallPadding} * 2 + ${standardPadding} * 2 *
|
|
13
|
+
var(--ni-private-table-group-row-indent-level)
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:host(:hover) {
|
|
18
|
+
background: ${fillHoverColor};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:host([expanded]) .animating,
|
|
22
|
+
:host .animating {
|
|
23
|
+
transition: ${mediumDelay} ease-in-out;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.expand-collapse-button {
|
|
27
|
+
width: ${controlSlimHeight};
|
|
28
|
+
height: ${controlSlimHeight};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:host([expanded]) .expander-icon {
|
|
32
|
+
transform: rotate(90deg);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.expander-icon {
|
|
36
|
+
transform: rotate(0deg);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.group-row-header-content {
|
|
40
|
+
display: flex;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.group-header-value {
|
|
45
|
+
padding-left: calc(${standardPadding} / 2);
|
|
46
|
+
user-select: none;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
display: flex;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.group-row-child-count {
|
|
52
|
+
padding-left: 2px;
|
|
53
|
+
pointer-events: none;
|
|
54
|
+
user-select: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@media (prefers-reduced-motion) {
|
|
58
|
+
:host .animating,
|
|
59
|
+
:host([expanded]) .animating {
|
|
60
|
+
transition-duration: 0s;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +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,EACf,mBAAmB,EACtB,MAAM,uCAAuC,CAAC;AAE/C,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;;;;uBAIE,aAAa,UAAU,WAAW;+BAC1B,WAAW,WAAW,mBAAmB;;cAE1D,YAAY,UAAU,eAAe;;;;;;sBAM7B,cAAc;;;;;sBAKd,WAAW;;;;iBAIhB,iBAAiB;kBAChB,iBAAiB;;;;;;;;;;;;;;;;;6BAiBN,eAAe;;;;;;;;;;;;;;;;;;CAkB3C,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/indent */
|
|
2
|
+
import { html, ref } from '@microsoft/fast-element';
|
|
3
|
+
import { buttonTag } from '../../../button';
|
|
4
|
+
import { ButtonAppearance } from '../../../button/types';
|
|
5
|
+
import { iconArrowExpanderRightTag } from '../../../icons/arrow-expander-right';
|
|
6
|
+
// prettier-ignore
|
|
7
|
+
export const template = html `
|
|
8
|
+
<template @click=${x => x.onGroupExpandToggle()} style="--ni-private-table-group-row-indent-level: ${x => x.nestingLevel};">
|
|
9
|
+
<${buttonTag}
|
|
10
|
+
appearance="${ButtonAppearance.ghost}"
|
|
11
|
+
content-hidden
|
|
12
|
+
class="expand-collapse-button"
|
|
13
|
+
tabindex="-1"
|
|
14
|
+
>
|
|
15
|
+
<${iconArrowExpanderRightTag} ${ref('expandIcon')} slot="start" class="expander-icon ${x => x.animationClass}"></${iconArrowExpanderRightTag}>
|
|
16
|
+
</${buttonTag}>
|
|
17
|
+
<div class="group-row-header-content">
|
|
18
|
+
${x => x.groupColumn?.internalGroupHeaderViewTemplate}
|
|
19
|
+
<div class="group-row-child-count">(${x => x.leafItemCount})</span>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
`;
|
|
23
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../../src/table/components/group-row/template.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAEhF,kBAAkB;AAClB,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAe;uBACpB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAmB,EAAE,sDAAsD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY;WACjH,SAAS;0BACM,gBAAgB,CAAC,KAAK;;;;;eAKjC,yBAAyB,IAAI,GAAG,CAAC,YAAY,CAAC,sCAAsC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,OAAO,yBAAyB;YAC5I,SAAS;;cAEP,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,+BAA+B;kDACf,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa;;;CAGrE,CAAC"}
|
|
@@ -11,6 +11,7 @@ declare global {
|
|
|
11
11
|
export interface ColumnState {
|
|
12
12
|
column: TableColumn;
|
|
13
13
|
cellState: TableCellState;
|
|
14
|
+
cellIndentLevel: number;
|
|
14
15
|
}
|
|
15
16
|
/** Represents a single row (element) in the Table's data */
|
|
16
17
|
export interface TableDataRecord extends TableRecord {
|
|
@@ -24,6 +25,7 @@ export declare class TableRow<TDataRecord extends TableDataRecord = TableDataRec
|
|
|
24
25
|
dataRecord?: TDataRecord;
|
|
25
26
|
columns: TableColumn[];
|
|
26
27
|
currentActionMenuColumn?: TableColumn;
|
|
28
|
+
nestingLevel: number;
|
|
27
29
|
menuOpen: boolean;
|
|
28
30
|
get columnStates(): ColumnState[];
|
|
29
31
|
onCellActionMenuBeforeToggle(event: CustomEvent<MenuButtonToggleEventDetail>, column: TableColumn): void;
|
|
@@ -12,17 +12,18 @@ export class TableRow extends FoundationElement {
|
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
14
14
|
this.columns = [];
|
|
15
|
+
this.nestingLevel = 0;
|
|
15
16
|
this.menuOpen = false;
|
|
16
17
|
}
|
|
17
18
|
get columnStates() {
|
|
18
|
-
return this.columns.map(column => {
|
|
19
|
+
return this.columns.map((column, i) => {
|
|
19
20
|
const fieldNames = column.dataRecordFieldNames;
|
|
20
21
|
let cellState;
|
|
21
22
|
if (this.hasValidFieldNames(fieldNames) && this.dataRecord) {
|
|
22
23
|
const cellDataValues = fieldNames.map(field => this.dataRecord[field]);
|
|
23
|
-
const cellRecord = Object.fromEntries(column.cellRecordFieldNames.map((k,
|
|
24
|
+
const cellRecord = Object.fromEntries(column.cellRecordFieldNames.map((k, j) => [
|
|
24
25
|
k,
|
|
25
|
-
cellDataValues[
|
|
26
|
+
cellDataValues[j]
|
|
26
27
|
]));
|
|
27
28
|
const columnConfig = column.columnConfig ?? {};
|
|
28
29
|
cellState = {
|
|
@@ -31,9 +32,13 @@ export class TableRow extends FoundationElement {
|
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
34
|
else {
|
|
34
|
-
cellState = {
|
|
35
|
+
cellState = {
|
|
36
|
+
cellRecord: {},
|
|
37
|
+
columnConfig: {}
|
|
38
|
+
};
|
|
35
39
|
}
|
|
36
|
-
|
|
40
|
+
const cellIndentLevel = i === 0 ? this.nestingLevel : 0;
|
|
41
|
+
return { column, cellState, cellIndentLevel };
|
|
37
42
|
});
|
|
38
43
|
}
|
|
39
44
|
onCellActionMenuBeforeToggle(event, column) {
|
|
@@ -77,6 +82,9 @@ __decorate([
|
|
|
77
82
|
__decorate([
|
|
78
83
|
observable
|
|
79
84
|
], TableRow.prototype, "currentActionMenuColumn", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
observable
|
|
87
|
+
], TableRow.prototype, "nestingLevel", void 0);
|
|
80
88
|
__decorate([
|
|
81
89
|
attr({ attribute: 'menu-open', mode: 'boolean' })
|
|
82
90
|
], TableRow.prototype, "menuOpen", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/table/components/row/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAStC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/table/components/row/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,E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AM,CAAC,CAAC;IAClC,CAAC;IAEO,kBAAkB,CACtB,IAA6C;QAE7C,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC;IAChD,CAAC;CACJ;AAlGG;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;0CACR;AAGzB;IADC,UAAU;4CACqB;AAGhC;IADC,UAAU;yCACwB;AAGnC;IADC,UAAU;yDACkC;AAG7C;IADC,UAAU;8CACa;AAGxB;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;0CAC1B;AAGxB;IADC,QAAQ;4CA6BR;AAsDL,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,CAAC;IACpC,QAAQ,EAAE,WAAW;IACrB,QAAQ;IACR,MAAM;CACT,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"}
|
|
@@ -13,6 +13,7 @@ export const template = html `
|
|
|
13
13
|
action-menu-label="${x => x.column.actionMenuLabel}"
|
|
14
14
|
@cell-action-menu-beforetoggle="${(x, c) => c.parent.onCellActionMenuBeforeToggle(c.event, x.column)}"
|
|
15
15
|
@cell-action-menu-toggle="${(x, c) => c.parent.onCellActionMenuToggle(c.event, x.column)}"
|
|
16
|
+
:nestingLevel="${x => x.cellIndentLevel};"
|
|
16
17
|
>
|
|
17
18
|
|
|
18
19
|
${when((x, c) => (c.parent.currentActionMenuColumn === x.column) && x.column.actionMenuSlot, html `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../../src/table/components/row/template.ts"],"names":[],"mappings":"AAAA,OAAO,EA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IAAI,CAAuB;cACnD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAuB;mBACxD,YAAY;;kCAEG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;yCACT,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,uBAAuB;wCACtC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc;yCAC7B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe;sDAChB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAAC,CAAC,KAAiD,EAAE,CAAC,CAAC,MAAM,CAAC;gDACpH,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,KAAiD,EAAE,CAAC,CAAC,MAAM,CAAC;qCACnH,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe;;;sBAGrC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAE,CAAC,CAAC,MAAmB,CAAC,uBAAuB,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,EAAE,IAAI,CAAuB;;oCAEtH,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,MAAM,CAAC,cAAe,EAAE;;;qBAGjE,CAAC;oBACF,YAAY;aACnB,CAAC;SACL,CAAC;;CAET,CAAC"}
|
|
@@ -11,6 +11,12 @@ declare global {
|
|
|
11
11
|
interface TableRowState<TData extends TableRecord = TableRecord> {
|
|
12
12
|
record: TData;
|
|
13
13
|
id: string;
|
|
14
|
+
isGrouped: boolean;
|
|
15
|
+
groupRowValue?: unknown;
|
|
16
|
+
isExpanded: boolean;
|
|
17
|
+
nestingLevel?: number;
|
|
18
|
+
leafItemCount?: number;
|
|
19
|
+
groupColumn?: TableColumn;
|
|
14
20
|
}
|
|
15
21
|
/**
|
|
16
22
|
* A nimble-styled table.
|
|
@@ -75,6 +81,7 @@ export declare class Table<TData extends TableRecord = TableRecord> extends Foun
|
|
|
75
81
|
private readonly tableValidator;
|
|
76
82
|
private readonly updateTracker;
|
|
77
83
|
private columnNotifiers;
|
|
84
|
+
private readonly collapsedRows;
|
|
78
85
|
constructor();
|
|
79
86
|
setData(newData: readonly TData[]): void;
|
|
80
87
|
connectedCallback(): void;
|
|
@@ -90,6 +97,7 @@ export declare class Table<TData extends TableRecord = TableRecord> extends Foun
|
|
|
90
97
|
handleChange(source: unknown, args: unknown): void;
|
|
91
98
|
onRowActionMenuBeforeToggle(event: CustomEvent<TableActionMenuToggleEventDetail>): void;
|
|
92
99
|
onRowActionMenuToggle(event: CustomEvent<TableActionMenuToggleEventDetail>): void;
|
|
100
|
+
handleGroupRowExpanded(rowIndex: number, event: Event): void;
|
|
93
101
|
/**
|
|
94
102
|
* @internal
|
|
95
103
|
*/
|
|
@@ -100,6 +108,7 @@ export declare class Table<TData extends TableRecord = TableRecord> extends Foun
|
|
|
100
108
|
private removeColumnObservers;
|
|
101
109
|
private observeColumns;
|
|
102
110
|
private getColumnsParticipatingInSorting;
|
|
111
|
+
private getColumnsParticipatingInGrouping;
|
|
103
112
|
private childItemsChanged;
|
|
104
113
|
private updateColumnsFromChildItems;
|
|
105
114
|
private updateTanStack;
|
|
@@ -109,8 +118,13 @@ export declare class Table<TData extends TableRecord = TableRecord> extends Foun
|
|
|
109
118
|
private validateWithData;
|
|
110
119
|
private setTableData;
|
|
111
120
|
private refreshRows;
|
|
121
|
+
private getGroupRowColumn;
|
|
112
122
|
private updateTableOptions;
|
|
123
|
+
private readonly getIsRowExpanded;
|
|
124
|
+
private readonly handleExpandedChange;
|
|
125
|
+
private toggleGroupExpanded;
|
|
113
126
|
private calculateTanStackSortState;
|
|
127
|
+
private calculateTanStackGroupingState;
|
|
114
128
|
private calculateTanStackRowIdFunction;
|
|
115
129
|
private calculateTanStackColumns;
|
|
116
130
|
}
|
package/dist/esm/table/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { attr, Observable, observable } from '@microsoft/fast-element';
|
|
3
3
|
import { DesignSystem, FoundationElement } from '@microsoft/fast-foundation';
|
|
4
|
-
import { createTable as tanStackCreateTable, getCoreRowModel as tanStackGetCoreRowModel, getSortedRowModel as tanStackGetSortedRowModel } from '@tanstack/table-core';
|
|
4
|
+
import { createTable as tanStackCreateTable, getCoreRowModel as tanStackGetCoreRowModel, getSortedRowModel as tanStackGetSortedRowModel, getGroupedRowModel as tanStackGetGroupedRowModel, getExpandedRowModel as tanStackGetExpandedRowModel } from '@tanstack/table-core';
|
|
5
5
|
import { TableColumn } from '../table-column/base';
|
|
6
6
|
import { TableValidator } from './models/table-validator';
|
|
7
7
|
import { styles } from './styles';
|
|
@@ -48,22 +48,54 @@ export class Table extends FoundationElement {
|
|
|
48
48
|
this.tableValidator = new TableValidator();
|
|
49
49
|
this.updateTracker = new UpdateTracker(this);
|
|
50
50
|
this.columnNotifiers = [];
|
|
51
|
+
this.collapsedRows = new Set();
|
|
51
52
|
this.onViewPortScroll = (event) => {
|
|
52
53
|
this.scrollX = event.target.scrollLeft;
|
|
53
54
|
};
|
|
55
|
+
this.getIsRowExpanded = (row) => {
|
|
56
|
+
if (!row.getIsGrouped()) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const expandedState = this.table.options.state.expanded;
|
|
60
|
+
if (expandedState === true) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
if (Object.keys(expandedState ?? {}).includes(row.id)) {
|
|
64
|
+
return expandedState[row.id];
|
|
65
|
+
}
|
|
66
|
+
return !this.collapsedRows.has(row.id);
|
|
67
|
+
};
|
|
68
|
+
this.handleExpandedChange = (updaterOrValue) => {
|
|
69
|
+
const expandedState = updaterOrValue instanceof Function
|
|
70
|
+
? updaterOrValue(this.table.getState().expanded)
|
|
71
|
+
: updaterOrValue;
|
|
72
|
+
this.updateTableOptions({
|
|
73
|
+
state: {
|
|
74
|
+
expanded: expandedState
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
};
|
|
54
78
|
this.options = {
|
|
55
79
|
data: [],
|
|
56
80
|
onStateChange: (_) => { },
|
|
81
|
+
onExpandedChange: this.handleExpandedChange,
|
|
57
82
|
getCoreRowModel: tanStackGetCoreRowModel(),
|
|
58
83
|
getSortedRowModel: tanStackGetSortedRowModel(),
|
|
84
|
+
getGroupedRowModel: tanStackGetGroupedRowModel(),
|
|
85
|
+
getExpandedRowModel: tanStackGetExpandedRowModel(),
|
|
86
|
+
getIsRowExpanded: this.getIsRowExpanded,
|
|
59
87
|
columns: [],
|
|
60
|
-
state: {
|
|
88
|
+
state: {
|
|
89
|
+
grouping: [],
|
|
90
|
+
expanded: true // Workaround until we can apply a fix to TanStack regarding leveraging our getIsRowExpanded implementation
|
|
91
|
+
},
|
|
61
92
|
enableSorting: true,
|
|
93
|
+
enableGrouping: true,
|
|
62
94
|
renderFallbackValue: null,
|
|
63
95
|
autoResetAll: false
|
|
64
96
|
};
|
|
65
97
|
this.table = tanStackCreateTable(this.options);
|
|
66
|
-
this.virtualizer = new Virtualizer(this);
|
|
98
|
+
this.virtualizer = new Virtualizer(this, this.table);
|
|
67
99
|
}
|
|
68
100
|
get validity() {
|
|
69
101
|
return this.tableValidator.getValidity();
|
|
@@ -111,6 +143,10 @@ export class Table extends FoundationElement {
|
|
|
111
143
|
this.openActionMenuRecordId = undefined;
|
|
112
144
|
}
|
|
113
145
|
}
|
|
146
|
+
handleGroupRowExpanded(rowIndex, event) {
|
|
147
|
+
this.toggleGroupExpanded(rowIndex);
|
|
148
|
+
event.stopPropagation();
|
|
149
|
+
}
|
|
114
150
|
/**
|
|
115
151
|
* @internal
|
|
116
152
|
*/
|
|
@@ -157,6 +193,10 @@ export class Table extends FoundationElement {
|
|
|
157
193
|
return this.columns.filter(x => x.sortDirection !== TableColumnSortDirection.none
|
|
158
194
|
&& typeof x.sortIndex === 'number');
|
|
159
195
|
}
|
|
196
|
+
getColumnsParticipatingInGrouping() {
|
|
197
|
+
return this.columns.filter(x => !x.internalGroupingDisabled
|
|
198
|
+
&& typeof x.internalGroupIndex === 'number');
|
|
199
|
+
}
|
|
160
200
|
childItemsChanged() {
|
|
161
201
|
void this.updateColumnsFromChildItems();
|
|
162
202
|
}
|
|
@@ -184,6 +224,11 @@ export class Table extends FoundationElement {
|
|
|
184
224
|
// Perform a shallow copy of the data to trigger tanstack to regenerate the row models and columns.
|
|
185
225
|
updatedOptions.data = [...this.table.options.data];
|
|
186
226
|
}
|
|
227
|
+
if (this.updateTracker.updateGroupRows) {
|
|
228
|
+
updatedOptions.state.grouping = this.calculateTanStackGroupingState();
|
|
229
|
+
updatedOptions.state.expanded = true;
|
|
230
|
+
this.collapsedRows.clear();
|
|
231
|
+
}
|
|
187
232
|
this.updateTableOptions(updatedOptions);
|
|
188
233
|
}
|
|
189
234
|
updateActionMenuSlots() {
|
|
@@ -201,6 +246,7 @@ export class Table extends FoundationElement {
|
|
|
201
246
|
validate() {
|
|
202
247
|
this.tableValidator.validateColumnIds(this.columns.map(x => x.columnId));
|
|
203
248
|
this.tableValidator.validateColumnSortIndices(this.getColumnsParticipatingInSorting().map(x => x.sortIndex));
|
|
249
|
+
this.tableValidator.validateColumnGroupIndices(this.getColumnsParticipatingInGrouping().map(x => x.internalGroupIndex));
|
|
204
250
|
this.validateWithData(this.table.options.data);
|
|
205
251
|
}
|
|
206
252
|
validateWithData(data) {
|
|
@@ -221,12 +267,30 @@ export class Table extends FoundationElement {
|
|
|
221
267
|
this.tableData = rows.map(row => {
|
|
222
268
|
const rowState = {
|
|
223
269
|
record: row.original,
|
|
224
|
-
id: row.id
|
|
270
|
+
id: row.id,
|
|
271
|
+
isGrouped: row.getIsGrouped(),
|
|
272
|
+
isExpanded: row.getIsExpanded(),
|
|
273
|
+
groupRowValue: row.getIsGrouped()
|
|
274
|
+
? row.getValue(row.groupingColumnId)
|
|
275
|
+
: undefined,
|
|
276
|
+
nestingLevel: row.depth,
|
|
277
|
+
leafItemCount: row
|
|
278
|
+
.getLeafRows()
|
|
279
|
+
.filter(leafRow => leafRow.getLeafRows().length === 0)
|
|
280
|
+
.length,
|
|
281
|
+
groupColumn: this.getGroupRowColumn(row)
|
|
225
282
|
};
|
|
226
283
|
return rowState;
|
|
227
284
|
});
|
|
228
285
|
this.virtualizer.dataChanged();
|
|
229
286
|
}
|
|
287
|
+
getGroupRowColumn(row) {
|
|
288
|
+
const groupedId = row.groupingColumnId;
|
|
289
|
+
if (groupedId !== undefined) {
|
|
290
|
+
return this.columns.find(c => c.internalUniqueId === groupedId);
|
|
291
|
+
}
|
|
292
|
+
return undefined;
|
|
293
|
+
}
|
|
230
294
|
updateTableOptions(updatedOptions) {
|
|
231
295
|
this.options = {
|
|
232
296
|
...this.options,
|
|
@@ -236,6 +300,18 @@ export class Table extends FoundationElement {
|
|
|
236
300
|
this.table.setOptions(this.options);
|
|
237
301
|
this.refreshRows();
|
|
238
302
|
}
|
|
303
|
+
toggleGroupExpanded(rowIndex) {
|
|
304
|
+
const row = this.table.getRowModel().rows[rowIndex];
|
|
305
|
+
const wasExpanded = row.getIsExpanded();
|
|
306
|
+
// must update the collapsedRows before toggling expanded state
|
|
307
|
+
if (wasExpanded) {
|
|
308
|
+
this.collapsedRows.add(row.id);
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
this.collapsedRows.delete(row.id);
|
|
312
|
+
}
|
|
313
|
+
row.toggleExpanded();
|
|
314
|
+
}
|
|
239
315
|
calculateTanStackSortState() {
|
|
240
316
|
const sortedColumns = this.getColumnsParticipatingInSorting().sort((x, y) => x.sortIndex - y.sortIndex);
|
|
241
317
|
this.firstSortedColumn = sortedColumns.length
|
|
@@ -248,6 +324,10 @@ export class Table extends FoundationElement {
|
|
|
248
324
|
};
|
|
249
325
|
});
|
|
250
326
|
}
|
|
327
|
+
calculateTanStackGroupingState() {
|
|
328
|
+
const groupedColumns = this.getColumnsParticipatingInGrouping().sort((x, y) => x.internalGroupIndex - y.internalGroupIndex);
|
|
329
|
+
return groupedColumns.map(column => column.internalUniqueId);
|
|
330
|
+
}
|
|
251
331
|
calculateTanStackRowIdFunction() {
|
|
252
332
|
return this.idFieldName === null || this.idFieldName === undefined
|
|
253
333
|
? undefined
|