@ni/nimble-components 18.13.2 → 18.13.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 +124 -10
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +1773 -1757
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/table/components/header/styles.js +1 -0
- package/dist/esm/table/components/header/styles.js.map +1 -1
- package/dist/esm/table/components/header/template.js +5 -1
- package/dist/esm/table/components/header/template.js.map +1 -1
- package/dist/esm/table/index.d.ts +10 -0
- package/dist/esm/table/index.js +72 -5
- package/dist/esm/table/index.js.map +1 -1
- package/dist/esm/table/models/update-tracker.js +2 -1
- package/dist/esm/table/models/update-tracker.js.map +1 -1
- package/dist/esm/table/styles.js +5 -0
- package/dist/esm/table/styles.js.map +1 -1
- package/dist/esm/table/template.js +4 -2
- package/dist/esm/table/template.js.map +1 -1
- package/dist/esm/table/testing/table.pageobject.d.ts +1 -0
- package/dist/esm/table/testing/table.pageobject.js +8 -0
- package/dist/esm/table/testing/table.pageobject.js.map +1 -1
- package/dist/esm/table-column/base/index.d.ts +4 -0
- package/dist/esm/table-column/base/index.js +29 -0
- package/dist/esm/table-column/base/index.js.map +1 -1
- package/dist/esm/table-column/base/models/column-internals.d.ts +11 -1
- package/dist/esm/table-column/base/models/column-internals.js +6 -0
- package/dist/esm/table-column/base/models/column-internals.js.map +1 -1
- package/package.json +1 -1
|
@@ -16366,7 +16366,7 @@
|
|
|
16366
16366
|
|
|
16367
16367
|
/**
|
|
16368
16368
|
* Do not edit directly
|
|
16369
|
-
* Generated on
|
|
16369
|
+
* Generated on Mon, 08 May 2023 13:48:08 GMT
|
|
16370
16370
|
*/
|
|
16371
16371
|
const Information100DarkUi = "#a46eff";
|
|
16372
16372
|
const Information100LightUi = "#804ad9";
|
|
@@ -16717,6 +16717,7 @@
|
|
|
16717
16717
|
const keyEnter = "Enter";
|
|
16718
16718
|
const keyEscape = "Escape";
|
|
16719
16719
|
const keyHome = "Home";
|
|
16720
|
+
const keyShift = "Shift";
|
|
16720
16721
|
const keySpace = " ";
|
|
16721
16722
|
|
|
16722
16723
|
/**
|
|
@@ -28062,6 +28063,12 @@
|
|
|
28062
28063
|
__decorate$1([
|
|
28063
28064
|
observable
|
|
28064
28065
|
], ColumnInternals.prototype, "currentPixelWidth", void 0);
|
|
28066
|
+
__decorate$1([
|
|
28067
|
+
observable
|
|
28068
|
+
], ColumnInternals.prototype, "currentSortIndex", void 0);
|
|
28069
|
+
__decorate$1([
|
|
28070
|
+
observable
|
|
28071
|
+
], ColumnInternals.prototype, "currentSortDirection", void 0);
|
|
28065
28072
|
|
|
28066
28073
|
/**
|
|
28067
28074
|
* The base class for table columns
|
|
@@ -28071,10 +28078,36 @@
|
|
|
28071
28078
|
super();
|
|
28072
28079
|
this.columnHidden = false;
|
|
28073
28080
|
this.sortDirection = TableColumnSortDirection.none;
|
|
28081
|
+
this.sortingDisabled = false;
|
|
28074
28082
|
if (!options) {
|
|
28075
28083
|
throw new Error('ColumnInternalsOptions must be provided to constructor');
|
|
28076
28084
|
}
|
|
28077
28085
|
this.columnInternals = new ColumnInternals(options);
|
|
28086
|
+
this.columnInternals.currentSortDirection = this.sortDirection;
|
|
28087
|
+
this.columnInternals.currentSortIndex = this.sortIndex;
|
|
28088
|
+
}
|
|
28089
|
+
sortDirectionChanged() {
|
|
28090
|
+
if (!this.sortingDisabled) {
|
|
28091
|
+
this.columnInternals.currentSortDirection = this.sortDirection;
|
|
28092
|
+
}
|
|
28093
|
+
}
|
|
28094
|
+
sortIndexChanged() {
|
|
28095
|
+
if (!this.sortingDisabled) {
|
|
28096
|
+
this.columnInternals.currentSortIndex = this.sortIndex;
|
|
28097
|
+
}
|
|
28098
|
+
}
|
|
28099
|
+
sortingDisabledChanged() {
|
|
28100
|
+
// Ignore the default value sortingDisabled initialization from undefined to false (which runs before columnInternals is initialized)
|
|
28101
|
+
if (this.columnInternals) {
|
|
28102
|
+
if (this.sortingDisabled) {
|
|
28103
|
+
this.columnInternals.currentSortDirection = TableColumnSortDirection.none;
|
|
28104
|
+
this.columnInternals.currentSortIndex = undefined;
|
|
28105
|
+
}
|
|
28106
|
+
else {
|
|
28107
|
+
this.columnInternals.currentSortDirection = this.sortDirection;
|
|
28108
|
+
this.columnInternals.currentSortIndex = this.sortIndex;
|
|
28109
|
+
}
|
|
28110
|
+
}
|
|
28078
28111
|
}
|
|
28079
28112
|
}
|
|
28080
28113
|
__decorate$1([
|
|
@@ -28095,6 +28128,9 @@
|
|
|
28095
28128
|
__decorate$1([
|
|
28096
28129
|
attr({ attribute: 'sort-direction' })
|
|
28097
28130
|
], TableColumn.prototype, "sortDirection", void 0);
|
|
28131
|
+
__decorate$1([
|
|
28132
|
+
attr({ attribute: 'sorting-disabled', mode: 'boolean' })
|
|
28133
|
+
], TableColumn.prototype, "sortingDisabled", void 0);
|
|
28098
28134
|
|
|
28099
28135
|
/**
|
|
28100
28136
|
* Helper class for the nimble-table to validate that the table's configuration
|
|
@@ -28214,6 +28250,10 @@
|
|
|
28214
28250
|
height: 480px;
|
|
28215
28251
|
}
|
|
28216
28252
|
|
|
28253
|
+
.disable-select {
|
|
28254
|
+
${userSelectNone}
|
|
28255
|
+
}
|
|
28256
|
+
|
|
28217
28257
|
.table-container {
|
|
28218
28258
|
overflow: hidden;
|
|
28219
28259
|
display: flex;
|
|
@@ -28325,6 +28365,7 @@
|
|
|
28325
28365
|
${iconColor.cssCustomProperty}: ${tableHeaderFontColor};
|
|
28326
28366
|
text-transform: uppercase;
|
|
28327
28367
|
gap: calc(${standardPadding} / 2);
|
|
28368
|
+
cursor: default;
|
|
28328
28369
|
}
|
|
28329
28370
|
|
|
28330
28371
|
.sort-indicator,
|
|
@@ -28335,7 +28376,11 @@
|
|
|
28335
28376
|
|
|
28336
28377
|
// prettier-ignore
|
|
28337
28378
|
const template$d = html `
|
|
28338
|
-
<template role="columnheader"
|
|
28379
|
+
<template role="columnheader"
|
|
28380
|
+
aria-sort="${x => x.ariaSort}"
|
|
28381
|
+
${'' /* Prevent header double clicks from selecting text */}
|
|
28382
|
+
@mousedown="${(_x, c) => !(c.event.detail > 1)}"
|
|
28383
|
+
>
|
|
28339
28384
|
<slot></slot>
|
|
28340
28385
|
|
|
28341
28386
|
${when(x => x.sortDirection === TableColumnSortDirection.ascending, html `
|
|
@@ -29016,7 +29061,8 @@
|
|
|
29016
29061
|
aria-multiselectable="${x => x.ariaMultiSelectable}"
|
|
29017
29062
|
${children$1({ property: 'childItems', filter: elements() })}
|
|
29018
29063
|
>
|
|
29019
|
-
<div class="table-container
|
|
29064
|
+
<div class="table-container ${x => (x.documentShiftKeyDown ? 'disable-select' : '')}"
|
|
29065
|
+
style="
|
|
29020
29066
|
--ni-private-table-scroll-x: -${x => x.scrollX}px;
|
|
29021
29067
|
--ni-private-table-header-scrollbar-spacer-width: ${x => x.virtualizer.headerContainerMarginRight}px;
|
|
29022
29068
|
--ni-private-table-scroll-height: ${x => x.virtualizer.allRowsHeight}px;
|
|
@@ -29050,8 +29096,9 @@
|
|
|
29050
29096
|
${when(x => !x.columnHidden, html `
|
|
29051
29097
|
<${tableHeaderTag}
|
|
29052
29098
|
class="header"
|
|
29053
|
-
sort-direction="${x => (typeof x.
|
|
29099
|
+
sort-direction="${x => (typeof x.columnInternals.currentSortIndex === 'number' ? x.columnInternals.currentSortDirection : TableColumnSortDirection.none)}"
|
|
29054
29100
|
?first-sorted-column="${(x, c) => x === c.parent.firstSortedColumn}"
|
|
29101
|
+
@click="${(x, c) => c.parent.toggleColumnSort(x, c.event.shiftKey)}"
|
|
29055
29102
|
:isGrouped=${x => (typeof x.columnInternals.groupIndex === 'number' && !x.columnInternals.groupingDisabled)}
|
|
29056
29103
|
>
|
|
29057
29104
|
<slot name="${x => x.slot}"></slot>
|
|
@@ -29971,7 +30018,8 @@
|
|
|
29971
30018
|
else if (isColumnInternalsProperty(changedColumnProperty, 'operandDataRecordFieldName', 'sortOperation')) {
|
|
29972
30019
|
this.requiredUpdates.columnDefinition = true;
|
|
29973
30020
|
}
|
|
29974
|
-
else if (isColumnProperty(changedColumnProperty, '
|
|
30021
|
+
else if (isColumnProperty(changedColumnProperty, 'sortingDisabled')
|
|
30022
|
+
|| isColumnInternalsProperty(changedColumnProperty, 'currentSortDirection', 'currentSortIndex')) {
|
|
29975
30023
|
this.requiredUpdates.columnSort = true;
|
|
29976
30024
|
}
|
|
29977
30025
|
else if (isColumnProperty(changedColumnProperty, 'columnHidden')
|
|
@@ -30086,6 +30134,10 @@
|
|
|
30086
30134
|
* @internal
|
|
30087
30135
|
*/
|
|
30088
30136
|
this.showCollapseAll = false;
|
|
30137
|
+
/**
|
|
30138
|
+
* @internal
|
|
30139
|
+
*/
|
|
30140
|
+
this.documentShiftKeyDown = false;
|
|
30089
30141
|
this.tableValidator = new TableValidator();
|
|
30090
30142
|
this.updateTracker = new UpdateTracker(this);
|
|
30091
30143
|
this.columnNotifiers = [];
|
|
@@ -30099,6 +30151,16 @@
|
|
|
30099
30151
|
this.onViewPortScroll = (event) => {
|
|
30100
30152
|
this.scrollX = event.target.scrollLeft;
|
|
30101
30153
|
};
|
|
30154
|
+
this.onKeyDown = (event) => {
|
|
30155
|
+
if (event.key === keyShift) {
|
|
30156
|
+
this.documentShiftKeyDown = true;
|
|
30157
|
+
}
|
|
30158
|
+
};
|
|
30159
|
+
this.onKeyUp = (event) => {
|
|
30160
|
+
if (event.key === keyShift) {
|
|
30161
|
+
this.documentShiftKeyDown = false;
|
|
30162
|
+
}
|
|
30163
|
+
};
|
|
30102
30164
|
this.getIsRowExpanded = (row) => {
|
|
30103
30165
|
if (!row.getIsGrouped()) {
|
|
30104
30166
|
return false;
|
|
@@ -30213,11 +30275,15 @@
|
|
|
30213
30275
|
this.viewport.addEventListener('scroll', this.onViewPortScroll, {
|
|
30214
30276
|
passive: true
|
|
30215
30277
|
});
|
|
30278
|
+
document.addEventListener('keydown', this.onKeyDown);
|
|
30279
|
+
document.addEventListener('keyup', this.onKeyUp);
|
|
30216
30280
|
}
|
|
30217
30281
|
disconnectedCallback() {
|
|
30218
30282
|
super.disconnectedCallback();
|
|
30219
30283
|
this.virtualizer.disconnectedCallback();
|
|
30220
30284
|
this.viewport.removeEventListener('scroll', this.onViewPortScroll);
|
|
30285
|
+
document.removeEventListener('keydown', this.onKeyDown);
|
|
30286
|
+
document.removeEventListener('keyup', this.onKeyUp);
|
|
30221
30287
|
}
|
|
30222
30288
|
checkValidity() {
|
|
30223
30289
|
return this.tableValidator.isValid();
|
|
@@ -30294,6 +30360,47 @@
|
|
|
30294
30360
|
this.toggleGroupExpanded(rowIndex);
|
|
30295
30361
|
event.stopPropagation();
|
|
30296
30362
|
}
|
|
30363
|
+
/**
|
|
30364
|
+
* @internal
|
|
30365
|
+
*/
|
|
30366
|
+
toggleColumnSort(column, allowMultiSort) {
|
|
30367
|
+
if (column.sortingDisabled) {
|
|
30368
|
+
return;
|
|
30369
|
+
}
|
|
30370
|
+
const allSortedColumns = this.getColumnsParticipatingInSorting().sort((x, y) => x.columnInternals.currentSortIndex
|
|
30371
|
+
- y.columnInternals.currentSortIndex);
|
|
30372
|
+
const columnIndex = allSortedColumns.indexOf(column);
|
|
30373
|
+
const columnAlreadySorted = columnIndex > -1;
|
|
30374
|
+
const oldSortDirection = column.columnInternals.currentSortDirection;
|
|
30375
|
+
let newSortDirection = TableColumnSortDirection.ascending;
|
|
30376
|
+
if (columnAlreadySorted) {
|
|
30377
|
+
if (oldSortDirection === TableColumnSortDirection.descending) {
|
|
30378
|
+
allSortedColumns.splice(columnIndex, 1);
|
|
30379
|
+
newSortDirection = TableColumnSortDirection.none;
|
|
30380
|
+
column.columnInternals.currentSortIndex = undefined;
|
|
30381
|
+
}
|
|
30382
|
+
else {
|
|
30383
|
+
newSortDirection = TableColumnSortDirection.descending;
|
|
30384
|
+
}
|
|
30385
|
+
}
|
|
30386
|
+
else {
|
|
30387
|
+
allSortedColumns.push(column);
|
|
30388
|
+
}
|
|
30389
|
+
column.columnInternals.currentSortDirection = newSortDirection;
|
|
30390
|
+
for (let i = 0; i < allSortedColumns.length; i++) {
|
|
30391
|
+
const currentColumn = allSortedColumns[i];
|
|
30392
|
+
if (allowMultiSort) {
|
|
30393
|
+
allSortedColumns[i].columnInternals.currentSortIndex = i;
|
|
30394
|
+
}
|
|
30395
|
+
else if (currentColumn === column) {
|
|
30396
|
+
currentColumn.columnInternals.currentSortIndex = 0;
|
|
30397
|
+
}
|
|
30398
|
+
else {
|
|
30399
|
+
currentColumn.columnInternals.currentSortIndex = undefined;
|
|
30400
|
+
currentColumn.columnInternals.currentSortDirection = TableColumnSortDirection.none;
|
|
30401
|
+
}
|
|
30402
|
+
}
|
|
30403
|
+
}
|
|
30297
30404
|
/**
|
|
30298
30405
|
* @internal
|
|
30299
30406
|
*/
|
|
@@ -30408,8 +30515,10 @@
|
|
|
30408
30515
|
}
|
|
30409
30516
|
}
|
|
30410
30517
|
getColumnsParticipatingInSorting() {
|
|
30411
|
-
return this.columns.filter(x => x.
|
|
30412
|
-
&&
|
|
30518
|
+
return this.columns.filter(x => !x.sortingDisabled
|
|
30519
|
+
&& x.columnInternals.currentSortDirection
|
|
30520
|
+
!== TableColumnSortDirection.none
|
|
30521
|
+
&& typeof x.columnInternals.currentSortIndex === 'number');
|
|
30413
30522
|
}
|
|
30414
30523
|
getColumnsParticipatingInGrouping() {
|
|
30415
30524
|
return this.columns.filter(x => !x.columnInternals.groupingDisabled
|
|
@@ -30469,7 +30578,7 @@
|
|
|
30469
30578
|
validate() {
|
|
30470
30579
|
this.tableValidator.validateSelectionMode(this.selectionMode, this.idFieldName);
|
|
30471
30580
|
this.tableValidator.validateColumnIds(this.columns.map(x => x.columnId));
|
|
30472
|
-
this.tableValidator.validateColumnSortIndices(this.getColumnsParticipatingInSorting().map(x => x.
|
|
30581
|
+
this.tableValidator.validateColumnSortIndices(this.getColumnsParticipatingInSorting().map(x => x.columnInternals.currentSortIndex));
|
|
30473
30582
|
this.tableValidator.validateColumnGroupIndices(this.getColumnsParticipatingInGrouping().map(x => x.columnInternals.groupIndex));
|
|
30474
30583
|
this.validateWithData(this.table.options.data);
|
|
30475
30584
|
}
|
|
@@ -30633,14 +30742,16 @@
|
|
|
30633
30742
|
row.toggleExpanded();
|
|
30634
30743
|
}
|
|
30635
30744
|
calculateTanStackSortState() {
|
|
30636
|
-
const sortedColumns = this.getColumnsParticipatingInSorting().sort((x, y) => x.
|
|
30745
|
+
const sortedColumns = this.getColumnsParticipatingInSorting().sort((x, y) => x.columnInternals.currentSortIndex
|
|
30746
|
+
- y.columnInternals.currentSortIndex);
|
|
30637
30747
|
this.firstSortedColumn = sortedColumns.length
|
|
30638
30748
|
? sortedColumns[0]
|
|
30639
30749
|
: undefined;
|
|
30640
30750
|
return sortedColumns.map(column => {
|
|
30641
30751
|
return {
|
|
30642
30752
|
id: column.columnInternals.uniqueId,
|
|
30643
|
-
desc: column.
|
|
30753
|
+
desc: column.columnInternals.currentSortDirection
|
|
30754
|
+
=== TableColumnSortDirection.descending
|
|
30644
30755
|
};
|
|
30645
30756
|
});
|
|
30646
30757
|
}
|
|
@@ -30729,6 +30840,9 @@
|
|
|
30729
30840
|
__decorate$1([
|
|
30730
30841
|
observable
|
|
30731
30842
|
], Table.prototype, "firstSortedColumn", void 0);
|
|
30843
|
+
__decorate$1([
|
|
30844
|
+
observable
|
|
30845
|
+
], Table.prototype, "documentShiftKeyDown", void 0);
|
|
30732
30846
|
const nimbleTable = Table.compose({
|
|
30733
30847
|
baseName: 'table',
|
|
30734
30848
|
template: template$9,
|