@tipolox/litgrid-web 1.1.0 → 1.2.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/README.md +2 -0
- package/dist/components/DataGrid.d.ts +21 -1
- package/dist/components/DataGrid.d.ts.map +1 -1
- package/dist/components/DataGrid.js +163 -35
- package/dist/components/DataGrid.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/types.d.ts +22 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/DataGrid.ts +166 -37
- package/src/index.ts +4 -0
- package/src/types.ts +30 -0
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@ LitGrid's `yc-grid` Web Component: a virtualized data grid for browser applicati
|
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
+
See [selection coordination](../../docs/selection-coordination.md) for typed notifications, stable row keys, restoration, and account/site scope resets.
|
|
8
|
+
|
|
7
9
|
```bash
|
|
8
10
|
npm install @tipolox/litgrid-web
|
|
9
11
|
```
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
-
import { type GridConfig, type GridFilter, type GridSelection, type SelectionIntent } from '@tipolox/litgrid-core';
|
|
2
|
+
import { type GridConfig, type GridFilter, type GridSelection, type GridRowKey, type SelectionChangeDetail, type GridExternalState, type SortDirection, type SelectionIntent } from '@tipolox/litgrid-core';
|
|
3
3
|
import type { GridColumn, GridTheme } from '../types.js';
|
|
4
4
|
import { type GridColumnState } from '../columnState/columnState.js';
|
|
5
5
|
export declare class DataGrid extends LitElement {
|
|
@@ -32,6 +32,7 @@ export declare class DataGrid extends LitElement {
|
|
|
32
32
|
private previousBodyCursor;
|
|
33
33
|
private previousBodyUserSelect;
|
|
34
34
|
private activeHeaderMenu;
|
|
35
|
+
private headerMenuCapabilities;
|
|
35
36
|
private columnChooserOpen;
|
|
36
37
|
private columnChooserPosition;
|
|
37
38
|
private quickSearchVisible;
|
|
@@ -58,6 +59,7 @@ export declare class DataGrid extends LitElement {
|
|
|
58
59
|
private shouldRestoreHeaderMenuFocus;
|
|
59
60
|
private screenReaderMessage;
|
|
60
61
|
private lastScreenReaderAnnouncement;
|
|
62
|
+
private paginationFocusTarget;
|
|
61
63
|
private maxScrollableHeight;
|
|
62
64
|
private lastTotalSize;
|
|
63
65
|
private lastDisplayTotal;
|
|
@@ -91,6 +93,7 @@ export declare class DataGrid extends LitElement {
|
|
|
91
93
|
constructor();
|
|
92
94
|
static styles: import("lit").CSSResult[];
|
|
93
95
|
firstUpdated(): void;
|
|
96
|
+
willUpdate(): void;
|
|
94
97
|
updated(): void;
|
|
95
98
|
disconnectedCallback(): void;
|
|
96
99
|
private updateVirtualizer;
|
|
@@ -136,6 +139,8 @@ export declare class DataGrid extends LitElement {
|
|
|
136
139
|
private dispatchColumnStateChange;
|
|
137
140
|
resetColumnVisibility(): void;
|
|
138
141
|
private toggleHeaderMenu;
|
|
142
|
+
private getColumnCapabilities;
|
|
143
|
+
private reconcileHeaderMenuCapabilities;
|
|
139
144
|
private closeHeaderMenu;
|
|
140
145
|
private toggleColumnChooser;
|
|
141
146
|
private closeColumnChooser;
|
|
@@ -174,14 +179,29 @@ export declare class DataGrid extends LitElement {
|
|
|
174
179
|
setFilter(filter: GridFilter): void;
|
|
175
180
|
clearFilter(columnKey?: string): void;
|
|
176
181
|
getFilters(): GridFilter[];
|
|
182
|
+
sortBy(columnKey: string, direction: SortDirection): void;
|
|
183
|
+
clearSort(): void;
|
|
184
|
+
getQuery(): Readonly<{
|
|
185
|
+
requestId: number;
|
|
186
|
+
query: import("@tipolox/litgrid-core").GridQuery;
|
|
187
|
+
}>;
|
|
188
|
+
refreshQuery(): void;
|
|
189
|
+
get externalState(): GridExternalState | null;
|
|
190
|
+
set externalState(value: GridExternalState | null);
|
|
191
|
+
setExternalState(value: GridExternalState): boolean;
|
|
192
|
+
private getPageLabel;
|
|
177
193
|
setPage(pageIndex: number): void;
|
|
178
194
|
setPageSize(pageSize: number): void;
|
|
179
195
|
getPagination(): import("@tipolox/litgrid-core").GridPaginationState;
|
|
196
|
+
private rememberPaginationFocus;
|
|
180
197
|
getTotalRowCount(): number;
|
|
181
198
|
selectRow(rowIndex: number, intent?: SelectionIntent): void;
|
|
199
|
+
private announceAllRowsSelected;
|
|
182
200
|
selectAllRows(): void;
|
|
183
201
|
clearSelection(): void;
|
|
184
202
|
getSelection(): GridSelection;
|
|
203
|
+
getSelectionSnapshot(): SelectionChangeDetail;
|
|
204
|
+
selectRowByKey(key: GridRowKey, intent?: SelectionIntent): boolean;
|
|
185
205
|
isRowSelected(rowIndex: number): boolean;
|
|
186
206
|
isCellSelected(rowIndex: number, columnKey: string): boolean;
|
|
187
207
|
private getSelectedCellsClipboardText;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGrid.d.ts","sourceRoot":"","sources":["../../src/components/DataGrid.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAA2C,MAAM,KAAK,CAAA;AAEzE,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAA;AAO9B,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAQxD,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,+BAA+B,CAAA;AA6CtC,qBAAa,QAAS,SAAQ,UAAU;IACtC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAI;IAEjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyC;IAChE,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,mBAAmB,CAIzB;IACF,OAAO,CAAC,sBAAsB,CAI5B;IACF,OAAO,CAAC,iBAAiB,CAIvB;IACF,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,QAAQ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,CA6CnB;IAED,MAAM;CAqbP"}
|
|
@@ -74,6 +74,7 @@ export class DataGrid extends LitElement {
|
|
|
74
74
|
this.previousBodyCursor = '';
|
|
75
75
|
this.previousBodyUserSelect = '';
|
|
76
76
|
this.activeHeaderMenu = null;
|
|
77
|
+
this.headerMenuCapabilities = { sortable: true, filterable: true };
|
|
77
78
|
this.columnChooserOpen = false;
|
|
78
79
|
this.columnChooserPosition = null;
|
|
79
80
|
this.quickSearchVisible = false;
|
|
@@ -100,6 +101,7 @@ export class DataGrid extends LitElement {
|
|
|
100
101
|
this.shouldRestoreHeaderMenuFocus = false;
|
|
101
102
|
this.screenReaderMessage = '';
|
|
102
103
|
this.lastScreenReaderAnnouncement = '';
|
|
104
|
+
this.paginationFocusTarget = null;
|
|
103
105
|
// Use a larger cap (2^26) to avoid hitting browser element-height limits.
|
|
104
106
|
this.maxScrollableHeight = 67108864;
|
|
105
107
|
this.lastTotalSize = 0;
|
|
@@ -222,6 +224,21 @@ export class DataGrid extends LitElement {
|
|
|
222
224
|
this.ariaLabel = 'Data grid';
|
|
223
225
|
this.ariaDescription = '';
|
|
224
226
|
this.screenReaderAnnouncements = true;
|
|
227
|
+
this.engine.onSelectionChange(detail => {
|
|
228
|
+
this.requestUpdate();
|
|
229
|
+
this.dispatchEvent(new CustomEvent('selection-change', {
|
|
230
|
+
detail, bubbles: true, composed: true
|
|
231
|
+
}));
|
|
232
|
+
});
|
|
233
|
+
this.engine.onQueryChange(detail => {
|
|
234
|
+
this.quickSearchDraft = detail.query.search;
|
|
235
|
+
this.clearBestFitWidths();
|
|
236
|
+
this.resetVerticalScroll();
|
|
237
|
+
this.requestUpdate();
|
|
238
|
+
this.dispatchEvent(new CustomEvent('query-change', {
|
|
239
|
+
detail, bubbles: true, composed: true
|
|
240
|
+
}));
|
|
241
|
+
});
|
|
225
242
|
}
|
|
226
243
|
static { this.styles = [lightThemeStyles, darkThemeStyles, css `
|
|
227
244
|
:host {
|
|
@@ -749,7 +766,16 @@ export class DataGrid extends LitElement {
|
|
|
749
766
|
firstUpdated() {
|
|
750
767
|
this.updateScrollbarWidth();
|
|
751
768
|
}
|
|
769
|
+
willUpdate() {
|
|
770
|
+
// Reconcile after schema and persisted visibility settle, before triggers disappear.
|
|
771
|
+
this.reconcileHeaderMenuCapabilities();
|
|
772
|
+
}
|
|
752
773
|
updated() {
|
|
774
|
+
const paginationTarget = this.paginationFocusTarget;
|
|
775
|
+
this.paginationFocusTarget = null;
|
|
776
|
+
if (paginationTarget?.isConnected && paginationTarget.disabled) {
|
|
777
|
+
this.renderRoot.querySelector('.pagination button:not([disabled]), .pagination select')?.focus();
|
|
778
|
+
}
|
|
753
779
|
this.updateScrollbarWidth();
|
|
754
780
|
if (this.shouldFocusViewport) {
|
|
755
781
|
this.shouldFocusViewport = false;
|
|
@@ -1142,6 +1168,7 @@ export class DataGrid extends LitElement {
|
|
|
1142
1168
|
});
|
|
1143
1169
|
}
|
|
1144
1170
|
const isOpening = this.activeHeaderMenu !== columnKey;
|
|
1171
|
+
this.headerMenuCapabilities = this.getColumnCapabilities(columnKey);
|
|
1145
1172
|
this.activeHeaderMenu = isOpening ? columnKey : null;
|
|
1146
1173
|
this.headerMenuTrigger = isOpening && event.currentTarget instanceof HTMLButtonElement
|
|
1147
1174
|
? event.currentTarget
|
|
@@ -1149,6 +1176,19 @@ export class DataGrid extends LitElement {
|
|
|
1149
1176
|
this.shouldFocusHeaderMenu = isOpening;
|
|
1150
1177
|
this.requestUpdate();
|
|
1151
1178
|
}
|
|
1179
|
+
getColumnCapabilities(columnKey) {
|
|
1180
|
+
const column = this.getResolvedColumns().find(column => column.key === columnKey);
|
|
1181
|
+
return { sortable: !!column && column.sortable !== false, filterable: !!column && column.filterable !== false };
|
|
1182
|
+
}
|
|
1183
|
+
reconcileHeaderMenuCapabilities() {
|
|
1184
|
+
if (this.activeHeaderMenu === null)
|
|
1185
|
+
return;
|
|
1186
|
+
const next = this.getColumnCapabilities(this.activeHeaderMenu);
|
|
1187
|
+
if (!this.isColumnVisible(this.activeHeaderMenu)
|
|
1188
|
+
|| next.sortable !== this.headerMenuCapabilities.sortable || next.filterable !== this.headerMenuCapabilities.filterable) {
|
|
1189
|
+
this.closeHeaderMenu(true);
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1152
1192
|
closeHeaderMenu(restoreFocus = false) {
|
|
1153
1193
|
if (this.activeHeaderMenu === null && !this.columnChooserOpen)
|
|
1154
1194
|
return;
|
|
@@ -1280,6 +1320,10 @@ export class DataGrid extends LitElement {
|
|
|
1280
1320
|
}
|
|
1281
1321
|
announceRowSelection(rowIndex, intent = 'replace') {
|
|
1282
1322
|
const anchor = this.engine.getSelection().anchorRowIndex ?? rowIndex;
|
|
1323
|
+
if (intent === 'range' && this.engine.getConfig().selection.rowKey !== undefined) {
|
|
1324
|
+
this.announceScreenReader(`${this.getDisplayedSelectedRowCount()} displayed rows selected.`);
|
|
1325
|
+
return;
|
|
1326
|
+
}
|
|
1283
1327
|
this.announceScreenReader(intent === 'range' && anchor !== rowIndex
|
|
1284
1328
|
? `Rows ${Math.min(anchor, rowIndex) + 1} through ${Math.max(anchor, rowIndex) + 1} selected.`
|
|
1285
1329
|
: `Row ${rowIndex + 1} ${this.engine.isRowSelected(rowIndex) ? 'selected' : 'deselected'}.`);
|
|
@@ -1288,24 +1332,34 @@ export class DataGrid extends LitElement {
|
|
|
1288
1332
|
this.announceScreenReader(`${this.getColumnLabel(columnKey)}, row ${rowIndex + 1} ${this.engine.isCellSelected(rowIndex, columnKey) ? 'selected' : 'deselected'}.`);
|
|
1289
1333
|
}
|
|
1290
1334
|
announceVisibleRowCount(context) {
|
|
1335
|
+
if (this.engine.getConfig().queryMode === 'external') {
|
|
1336
|
+
this.announceScreenReader(`${context}. Server query requested.`);
|
|
1337
|
+
return;
|
|
1338
|
+
}
|
|
1291
1339
|
const rowCount = this.engine.getRowCount();
|
|
1292
1340
|
this.announceScreenReader(rowCount === 0 ? `${context}. No matching rows.` : `${context}. ${rowCount} ${rowCount === 1 ? 'row' : 'rows'} shown.`);
|
|
1293
1341
|
}
|
|
1294
1342
|
handleSortAscending(columnKey) {
|
|
1343
|
+
if (!this.getColumnCapabilities(columnKey).sortable)
|
|
1344
|
+
return;
|
|
1295
1345
|
this.engine.sortBy(columnKey, 'asc');
|
|
1296
|
-
this.announceScreenReader(`${this.getColumnLabel(columnKey)} sorted ascending.`);
|
|
1346
|
+
this.announceScreenReader(`${this.getColumnLabel(columnKey)} ${this.engine.getConfig().queryMode === 'external' ? 'ascending sort requested' : 'sorted ascending'}.`);
|
|
1297
1347
|
this.requestUpdate();
|
|
1298
1348
|
this.closeHeaderMenu(true);
|
|
1299
1349
|
}
|
|
1300
1350
|
handleSortDescending(columnKey) {
|
|
1351
|
+
if (!this.getColumnCapabilities(columnKey).sortable)
|
|
1352
|
+
return;
|
|
1301
1353
|
this.engine.sortBy(columnKey, 'desc');
|
|
1302
|
-
this.announceScreenReader(`${this.getColumnLabel(columnKey)} sorted descending.`);
|
|
1354
|
+
this.announceScreenReader(`${this.getColumnLabel(columnKey)} ${this.engine.getConfig().queryMode === 'external' ? 'descending sort requested' : 'sorted descending'}.`);
|
|
1303
1355
|
this.requestUpdate();
|
|
1304
1356
|
this.closeHeaderMenu(true);
|
|
1305
1357
|
}
|
|
1306
|
-
handleClearSort() {
|
|
1358
|
+
handleClearSort(columnKey) {
|
|
1359
|
+
if (!this.getColumnCapabilities(columnKey).sortable)
|
|
1360
|
+
return;
|
|
1307
1361
|
this.engine.clearSort();
|
|
1308
|
-
this.announceScreenReader('Sorting cleared.');
|
|
1362
|
+
this.announceScreenReader(this.engine.getConfig().queryMode === 'external' ? 'Clear sorting requested.' : 'Sorting cleared.');
|
|
1309
1363
|
this.requestUpdate();
|
|
1310
1364
|
this.closeHeaderMenu(true);
|
|
1311
1365
|
}
|
|
@@ -1478,7 +1532,8 @@ export class DataGrid extends LitElement {
|
|
|
1478
1532
|
this.clearQuickSearchDebounce();
|
|
1479
1533
|
const threshold = Math.max(0, Math.floor(this.quickSearchDebounceThreshold));
|
|
1480
1534
|
const debounceMs = Math.max(0, Math.floor(this.quickSearchDebounceMs));
|
|
1481
|
-
|
|
1535
|
+
const external = this.engine.getConfig().queryMode === 'external';
|
|
1536
|
+
if (debounceMs === 0 || (!external && this.sourceRowCount < threshold)) {
|
|
1482
1537
|
this.applyQuickSearch(query);
|
|
1483
1538
|
return;
|
|
1484
1539
|
}
|
|
@@ -1510,23 +1565,65 @@ export class DataGrid extends LitElement {
|
|
|
1510
1565
|
getFilters() {
|
|
1511
1566
|
return this.engine.getFilters();
|
|
1512
1567
|
}
|
|
1568
|
+
sortBy(columnKey, direction) {
|
|
1569
|
+
this.engine.sortBy(columnKey, direction);
|
|
1570
|
+
this.resetVerticalScroll();
|
|
1571
|
+
this.requestUpdate();
|
|
1572
|
+
}
|
|
1573
|
+
clearSort() {
|
|
1574
|
+
this.engine.clearSort();
|
|
1575
|
+
this.resetVerticalScroll();
|
|
1576
|
+
this.requestUpdate();
|
|
1577
|
+
}
|
|
1578
|
+
getQuery() { return this.engine.getQuery(); }
|
|
1579
|
+
refreshQuery() { this.engine.refreshQuery(); }
|
|
1580
|
+
get externalState() { return this.engine.getExternalState(); }
|
|
1581
|
+
set externalState(value) {
|
|
1582
|
+
if (value)
|
|
1583
|
+
this.setExternalState(value);
|
|
1584
|
+
}
|
|
1585
|
+
setExternalState(value) {
|
|
1586
|
+
if (!this.engine.setExternalState(value))
|
|
1587
|
+
return false;
|
|
1588
|
+
this.clearQuickSearchDebounce();
|
|
1589
|
+
this.quickSearchDraft = this.engine.getQuickSearch();
|
|
1590
|
+
this.filterDrafts = new Map(this.engine.getFilters().map(filter => [filter.columnKey, filter]));
|
|
1591
|
+
this.sourceRowCount = this.engine.getRowCount();
|
|
1592
|
+
this.clearBestFitWidths();
|
|
1593
|
+
this.requestUpdate();
|
|
1594
|
+
return true;
|
|
1595
|
+
}
|
|
1596
|
+
getPageLabel() {
|
|
1597
|
+
const pagination = this.engine.getPagination();
|
|
1598
|
+
if (this.engine.getConfig().queryMode === 'external' && pagination.totalKnown && pagination.pageIndex > 0 && pagination.pageIndex >= pagination.pageCount)
|
|
1599
|
+
return `Page ${pagination.pageIndex + 1} (out of range)`;
|
|
1600
|
+
return pagination.totalKnown === false ? `Page ${pagination.pageIndex + 1}`
|
|
1601
|
+
: `Page ${pagination.pageCount === 0 ? 0 : pagination.pageIndex + 1} of ${pagination.pageCount}`;
|
|
1602
|
+
}
|
|
1513
1603
|
setPage(pageIndex) {
|
|
1604
|
+
this.rememberPaginationFocus();
|
|
1514
1605
|
this.engine.setPage(pageIndex);
|
|
1515
1606
|
this.resetVerticalScroll();
|
|
1516
1607
|
const pagination = this.engine.getPagination();
|
|
1517
|
-
this.announceScreenReader(
|
|
1608
|
+
this.announceScreenReader(`${this.getPageLabel()}.`);
|
|
1518
1609
|
this.requestUpdate();
|
|
1519
1610
|
}
|
|
1520
1611
|
setPageSize(pageSize) {
|
|
1612
|
+
this.rememberPaginationFocus();
|
|
1521
1613
|
this.engine.setPageSize(pageSize);
|
|
1522
1614
|
this.resetVerticalScroll();
|
|
1523
1615
|
const pagination = this.engine.getPagination();
|
|
1524
|
-
this.announceScreenReader(`${pagination.pageSize} rows per page.
|
|
1616
|
+
this.announceScreenReader(`${pagination.pageSize} rows per page. ${this.getPageLabel()}.`);
|
|
1525
1617
|
this.requestUpdate();
|
|
1526
1618
|
}
|
|
1527
1619
|
getPagination() {
|
|
1528
1620
|
return this.engine.getPagination();
|
|
1529
1621
|
}
|
|
1622
|
+
rememberPaginationFocus() {
|
|
1623
|
+
const active = this.shadowRoot?.activeElement;
|
|
1624
|
+
if (active instanceof HTMLButtonElement && active.closest('.pagination'))
|
|
1625
|
+
this.paginationFocusTarget = active;
|
|
1626
|
+
}
|
|
1530
1627
|
getTotalRowCount() {
|
|
1531
1628
|
return this.engine.getTotalRowCount();
|
|
1532
1629
|
}
|
|
@@ -1545,13 +1642,18 @@ export class DataGrid extends LitElement {
|
|
|
1545
1642
|
this.announceRowSelection(rowIndex, effectiveIntent);
|
|
1546
1643
|
this.requestUpdate();
|
|
1547
1644
|
}
|
|
1645
|
+
announceAllRowsSelected() {
|
|
1646
|
+
const count = this.engine.getSelectableRowCount();
|
|
1647
|
+
const qualifier = count === this.engine.getRowCount() ? '' : 'selectable ';
|
|
1648
|
+
this.announceScreenReader(`All ${count} ${qualifier}displayed rows selected.`);
|
|
1649
|
+
}
|
|
1548
1650
|
selectAllRows() {
|
|
1549
|
-
if (this.engine.getConfig().selection.mode !== 'multi-row' || this.engine.
|
|
1651
|
+
if (this.engine.getConfig().selection.mode !== 'multi-row' || this.engine.getSelectableRowCount() === 0)
|
|
1550
1652
|
return;
|
|
1551
|
-
const unchanged = this.engine.getSelection().rowIndexes.size === this.engine.
|
|
1653
|
+
const unchanged = this.engine.getSelection().rowIndexes.size === this.engine.getSelectableRowCount();
|
|
1552
1654
|
this.engine.selectAllRows();
|
|
1553
1655
|
if (!unchanged)
|
|
1554
|
-
this.
|
|
1656
|
+
this.announceAllRowsSelected();
|
|
1555
1657
|
this.requestUpdate();
|
|
1556
1658
|
}
|
|
1557
1659
|
clearSelection() {
|
|
@@ -1565,6 +1667,21 @@ export class DataGrid extends LitElement {
|
|
|
1565
1667
|
getSelection() {
|
|
1566
1668
|
return this.engine.getSelection();
|
|
1567
1669
|
}
|
|
1670
|
+
getSelectionSnapshot() {
|
|
1671
|
+
return this.engine.getSelectionSnapshot();
|
|
1672
|
+
}
|
|
1673
|
+
selectRowByKey(key, intent) {
|
|
1674
|
+
const previous = this.engine.getSelectionSnapshot();
|
|
1675
|
+
const selected = this.engine.selectRowByKey(key, intent);
|
|
1676
|
+
const next = this.engine.getSelectionSnapshot();
|
|
1677
|
+
if (selected && next !== previous) {
|
|
1678
|
+
const index = next.rows.find(row => row.key === key)?.rowIndex
|
|
1679
|
+
?? previous.rows.find(row => row.key === key)?.rowIndex;
|
|
1680
|
+
if (index !== undefined)
|
|
1681
|
+
this.announceRowSelection(index, intent);
|
|
1682
|
+
}
|
|
1683
|
+
return selected;
|
|
1684
|
+
}
|
|
1568
1685
|
isRowSelected(rowIndex) {
|
|
1569
1686
|
return this.engine.isRowSelected(rowIndex);
|
|
1570
1687
|
}
|
|
@@ -1616,6 +1733,8 @@ export class DataGrid extends LitElement {
|
|
|
1616
1733
|
}
|
|
1617
1734
|
}
|
|
1618
1735
|
applyHeaderFilter(columnKey) {
|
|
1736
|
+
if (!this.getColumnCapabilities(columnKey).filterable)
|
|
1737
|
+
return;
|
|
1619
1738
|
const filter = this.getFilterDraft(columnKey);
|
|
1620
1739
|
this.setFilter({
|
|
1621
1740
|
...filter,
|
|
@@ -1624,6 +1743,8 @@ export class DataGrid extends LitElement {
|
|
|
1624
1743
|
this.closeHeaderMenu(true);
|
|
1625
1744
|
}
|
|
1626
1745
|
clearHeaderFilter(columnKey) {
|
|
1746
|
+
if (!this.getColumnCapabilities(columnKey).filterable)
|
|
1747
|
+
return;
|
|
1627
1748
|
this.clearFilter(columnKey);
|
|
1628
1749
|
this.closeHeaderMenu(true);
|
|
1629
1750
|
}
|
|
@@ -2253,6 +2374,8 @@ export class DataGrid extends LitElement {
|
|
|
2253
2374
|
`;
|
|
2254
2375
|
}
|
|
2255
2376
|
set data(value) {
|
|
2377
|
+
if (this.engine.getConfig().queryMode === 'external')
|
|
2378
|
+
return;
|
|
2256
2379
|
this.clearQuickSearchDebounce();
|
|
2257
2380
|
this.sourceRowCount = Array.isArray(value) ? value.length : 0;
|
|
2258
2381
|
this.engine.setData(value ?? []);
|
|
@@ -2265,22 +2388,15 @@ export class DataGrid extends LitElement {
|
|
|
2265
2388
|
this.selectRow(rowIndex, 'toggle');
|
|
2266
2389
|
}
|
|
2267
2390
|
getDisplayedSelectedRowCount() {
|
|
2268
|
-
|
|
2269
|
-
let selectedCount = 0;
|
|
2270
|
-
for (let rowIndex = 0; rowIndex < rowCount; rowIndex += 1) {
|
|
2271
|
-
if (this.engine.isRowSelected(rowIndex)) {
|
|
2272
|
-
selectedCount += 1;
|
|
2273
|
-
}
|
|
2274
|
-
}
|
|
2275
|
-
return selectedCount;
|
|
2391
|
+
return this.engine.getSelectionSnapshot().rowIndexes.length;
|
|
2276
2392
|
}
|
|
2277
2393
|
areAllDisplayedRowsSelected() {
|
|
2278
|
-
const rowCount = this.engine.
|
|
2394
|
+
const rowCount = this.engine.getSelectableRowCount();
|
|
2279
2395
|
return rowCount > 0 && this.getDisplayedSelectedRowCount() === rowCount;
|
|
2280
2396
|
}
|
|
2281
2397
|
hasPartiallySelectedDisplayedRows() {
|
|
2282
2398
|
const selectedCount = this.getDisplayedSelectedRowCount();
|
|
2283
|
-
return selectedCount > 0 && selectedCount < this.engine.
|
|
2399
|
+
return selectedCount > 0 && selectedCount < this.engine.getSelectableRowCount();
|
|
2284
2400
|
}
|
|
2285
2401
|
handleSelectAllRows() {
|
|
2286
2402
|
if (this.areAllDisplayedRowsSelected()) {
|
|
@@ -2289,7 +2405,7 @@ export class DataGrid extends LitElement {
|
|
|
2289
2405
|
}
|
|
2290
2406
|
else {
|
|
2291
2407
|
this.engine.selectAllRows();
|
|
2292
|
-
this.
|
|
2408
|
+
this.announceAllRowsSelected();
|
|
2293
2409
|
}
|
|
2294
2410
|
this.requestUpdate();
|
|
2295
2411
|
}
|
|
@@ -2415,6 +2531,12 @@ export class DataGrid extends LitElement {
|
|
|
2415
2531
|
render() {
|
|
2416
2532
|
const count = this.engine.getRowCount();
|
|
2417
2533
|
const pagination = this.engine.getPagination();
|
|
2534
|
+
const external = this.engine.getConfig().queryMode === 'external';
|
|
2535
|
+
const externalState = external ? this.engine.getExternalState() : null;
|
|
2536
|
+
const outOfRange = external && pagination.totalKnown && pagination.pageIndex > 0 && pagination.pageIndex >= pagination.pageCount;
|
|
2537
|
+
const externalStatus = externalState?.loading ? 'Loading results.' : externalState?.error
|
|
2538
|
+
? externalState.error : outOfRange ? 'Requested page is out of range. Choose a previous page.'
|
|
2539
|
+
: count === 0 ? (pagination.totalRows === 0 ? 'No results.' : 'No rows on this page.') : '';
|
|
2418
2540
|
const pageSizeOptions = [25, 50, 100].includes(pagination.pageSize)
|
|
2419
2541
|
? [25, 50, 100]
|
|
2420
2542
|
: [pagination.pageSize, 25, 50, 100].sort((left, right) => left - right);
|
|
@@ -2530,14 +2652,16 @@ export class DataGrid extends LitElement {
|
|
|
2530
2652
|
return html `
|
|
2531
2653
|
<div
|
|
2532
2654
|
class="shell"
|
|
2655
|
+
aria-busy=${external ? String(!!externalState?.loading) : nothing}
|
|
2533
2656
|
style=${`--virtual-grid-template: ${gridTemplate}; --total-column-width: ${totalColumnWidth}px; --total-row-width: ${totalRowWidth}px; --row-header-width: ${rowHeaderWidth}px; --header-grid-template: ${headerGridTemplate}; --scrollbar-width: ${this.scrollbarWidth}px;`}
|
|
2534
2657
|
@keydown=${this.handleShellKeyDown}
|
|
2535
2658
|
>
|
|
2536
2659
|
<p id=${`${this.gridId}-description`} class="screen-reader-only">${this.getScreenReaderDescription()}</p>
|
|
2660
|
+
${external && externalStatus ? html `<div class="external-status" role=${externalState?.error ? 'alert' : 'status'}>${externalStatus}</div>` : nothing}
|
|
2537
2661
|
${this.screenReaderAnnouncements
|
|
2538
2662
|
? html `<div class="screen-reader-only" role="status" aria-live="polite" aria-atomic="true">${this.screenReaderMessage}</div>`
|
|
2539
2663
|
: ''}
|
|
2540
|
-
${this.quickSearchVisible
|
|
2664
|
+
${this.quickSearchVisible || external
|
|
2541
2665
|
? html `
|
|
2542
2666
|
<div class="quick-search" role="search">
|
|
2543
2667
|
<input
|
|
@@ -2583,7 +2707,7 @@ export class DataGrid extends LitElement {
|
|
|
2583
2707
|
aria-label="Select all displayed rows"
|
|
2584
2708
|
.checked=${this.areAllDisplayedRowsSelected()}
|
|
2585
2709
|
.indeterminate=${this.hasPartiallySelectedDisplayedRows()}
|
|
2586
|
-
?disabled=${this.engine.
|
|
2710
|
+
?disabled=${this.engine.getSelectableRowCount() === 0}
|
|
2587
2711
|
@change=${() => this.handleSelectAllRows()}
|
|
2588
2712
|
/>`
|
|
2589
2713
|
: html `<span>#</span>`}
|
|
@@ -2647,19 +2771,23 @@ export class DataGrid extends LitElement {
|
|
|
2647
2771
|
${this.quickSearchVisible ? 'Hide Quick Search' : 'Show Quick Search'}
|
|
2648
2772
|
</button>
|
|
2649
2773
|
<hr class="header-menu-divider" />
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2774
|
+
${column.sortable === false ? '' : html `
|
|
2775
|
+
<button type="button" @click=${() => this.handleSortAscending(column.key)}>
|
|
2776
|
+
Sort Asc
|
|
2777
|
+
</button>
|
|
2778
|
+
<button type="button" @click=${() => this.handleSortDescending(column.key)}>
|
|
2779
|
+
Sort Desc
|
|
2780
|
+
</button>
|
|
2781
|
+
<button type="button" @click=${() => this.handleClearSort(column.key)}>
|
|
2782
|
+
Clear Sort
|
|
2783
|
+
</button>
|
|
2784
|
+
`}
|
|
2659
2785
|
<button type="button" @click=${(event) => this.toggleColumnChooser(event)}>
|
|
2660
2786
|
Columns
|
|
2661
2787
|
</button>
|
|
2662
2788
|
${(() => {
|
|
2789
|
+
if (column.filterable === false)
|
|
2790
|
+
return '';
|
|
2663
2791
|
const draft = this.getFilterDraft(column.key);
|
|
2664
2792
|
const valueFree = this.isValueFreeFilter(draft.operator);
|
|
2665
2793
|
return html `
|
|
@@ -2774,7 +2902,7 @@ export class DataGrid extends LitElement {
|
|
|
2774
2902
|
? html `
|
|
2775
2903
|
<div class="pagination" role="navigation" aria-label="Pagination">
|
|
2776
2904
|
<div class="pagination-summary">
|
|
2777
|
-
<span>${pagination.totalRows} rows</span>
|
|
2905
|
+
<span>${pagination.totalKnown === false ? 'Total unknown' : `${pagination.totalRows} rows`}</span>
|
|
2778
2906
|
<label>
|
|
2779
2907
|
Rows per page
|
|
2780
2908
|
<select
|
|
@@ -2790,7 +2918,7 @@ export class DataGrid extends LitElement {
|
|
|
2790
2918
|
</label>
|
|
2791
2919
|
</div>
|
|
2792
2920
|
<div class="pagination-navigation">
|
|
2793
|
-
<span
|
|
2921
|
+
<span>${this.getPageLabel()}</span>
|
|
2794
2922
|
<button
|
|
2795
2923
|
type="button"
|
|
2796
2924
|
?disabled=${pagination.pageIndex === 0}
|
|
@@ -2798,7 +2926,7 @@ export class DataGrid extends LitElement {
|
|
|
2798
2926
|
>Previous</button>
|
|
2799
2927
|
<button
|
|
2800
2928
|
type="button"
|
|
2801
|
-
?disabled=${pagination.pageCount === 0 || pagination.pageIndex >= pagination.pageCount - 1}
|
|
2929
|
+
?disabled=${pagination.totalKnown === false ? !pagination.hasMore : pagination.pageCount === 0 || pagination.pageIndex >= pagination.pageCount - 1}
|
|
2802
2930
|
@click=${() => this.setPage(pagination.pageIndex + 1)}
|
|
2803
2931
|
>Next</button>
|
|
2804
2932
|
</div>
|