@ni/nimble-components 19.2.0 → 19.2.1
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 +117 -65
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +607 -607
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/table/index.d.ts +1 -1
- package/dist/esm/table/index.js +18 -18
- package/dist/esm/table/index.js.map +1 -1
- package/dist/esm/table/models/{update-tracker.d.ts → table-update-tracker.d.ts} +5 -4
- package/dist/esm/table/models/{update-tracker.js → table-update-tracker.js} +45 -48
- package/dist/esm/table/models/table-update-tracker.js.map +1 -0
- package/dist/esm/table-column/base/models/column-validator.d.ts +3 -7
- package/dist/esm/table-column/base/models/column-validator.js +12 -15
- package/dist/esm/table-column/base/models/column-validator.js.map +1 -1
- package/dist/esm/utilities/models/tracker.d.ts +21 -0
- package/dist/esm/utilities/models/tracker.js +50 -0
- package/dist/esm/utilities/models/tracker.js.map +1 -0
- package/dist/esm/utilities/models/update-tracker.d.ts +7 -0
- package/dist/esm/utilities/models/update-tracker.js +7 -0
- package/dist/esm/utilities/models/update-tracker.js.map +1 -0
- package/dist/esm/utilities/models/validator.d.ts +9 -0
- package/dist/esm/utilities/models/validator.js +13 -0
- package/dist/esm/utilities/models/validator.js.map +1 -0
- package/package.json +1 -1
- package/dist/esm/table/models/update-tracker.js.map +0 -1
|
@@ -16232,7 +16232,7 @@
|
|
|
16232
16232
|
|
|
16233
16233
|
/**
|
|
16234
16234
|
* Do not edit directly
|
|
16235
|
-
* Generated on
|
|
16235
|
+
* Generated on Mon, 12 Jun 2023 13:02:11 GMT
|
|
16236
16236
|
*/
|
|
16237
16237
|
const Information100DarkUi = "#a46eff";
|
|
16238
16238
|
const Information100LightUi = "#804ad9";
|
|
@@ -30060,6 +30060,62 @@
|
|
|
30060
30060
|
return 1;
|
|
30061
30061
|
}
|
|
30062
30062
|
|
|
30063
|
+
/**
|
|
30064
|
+
* Generic Tracker which sets or resets provided flags
|
|
30065
|
+
*/
|
|
30066
|
+
class Tracker {
|
|
30067
|
+
constructor(trackedItemsList) {
|
|
30068
|
+
this.trackedItems = {};
|
|
30069
|
+
this.trackedItems = trackedItemsList.reduce((r, key) => {
|
|
30070
|
+
return {
|
|
30071
|
+
...r,
|
|
30072
|
+
[key]: false
|
|
30073
|
+
};
|
|
30074
|
+
}, this.trackedItems);
|
|
30075
|
+
}
|
|
30076
|
+
getTrackedItems() {
|
|
30077
|
+
return { ...this.trackedItems };
|
|
30078
|
+
}
|
|
30079
|
+
isTracked(key) {
|
|
30080
|
+
return this.trackedItems[key];
|
|
30081
|
+
}
|
|
30082
|
+
track(key) {
|
|
30083
|
+
this.trackedItems[key] = true;
|
|
30084
|
+
}
|
|
30085
|
+
untrack(key) {
|
|
30086
|
+
this.trackedItems[key] = false;
|
|
30087
|
+
}
|
|
30088
|
+
trackAll() {
|
|
30089
|
+
this.setAllKeys(true);
|
|
30090
|
+
}
|
|
30091
|
+
untrackAll() {
|
|
30092
|
+
this.setAllKeys(false);
|
|
30093
|
+
}
|
|
30094
|
+
allTracked() {
|
|
30095
|
+
return Object.values(this.trackedItems).every(x => x);
|
|
30096
|
+
}
|
|
30097
|
+
anyTracked() {
|
|
30098
|
+
return Object.values(this.trackedItems).some(x => x);
|
|
30099
|
+
}
|
|
30100
|
+
noneTracked() {
|
|
30101
|
+
return Object.values(this.trackedItems).every(x => !x);
|
|
30102
|
+
}
|
|
30103
|
+
setAllKeys(value) {
|
|
30104
|
+
this.trackedItems = Object.keys(this.trackedItems).reduce((r, key) => {
|
|
30105
|
+
return {
|
|
30106
|
+
...r,
|
|
30107
|
+
[key]: value
|
|
30108
|
+
};
|
|
30109
|
+
}, this.trackedItems);
|
|
30110
|
+
}
|
|
30111
|
+
}
|
|
30112
|
+
|
|
30113
|
+
/**
|
|
30114
|
+
* Generic Update Tracker Utility which extends Tracker Utility with update logic
|
|
30115
|
+
*/
|
|
30116
|
+
class UpdateTracker extends Tracker {
|
|
30117
|
+
}
|
|
30118
|
+
|
|
30063
30119
|
const isColumnProperty = (changedProperty, ...args) => {
|
|
30064
30120
|
for (const arg of args) {
|
|
30065
30121
|
if (changedProperty === arg) {
|
|
@@ -30076,61 +30132,62 @@
|
|
|
30076
30132
|
}
|
|
30077
30133
|
return false;
|
|
30078
30134
|
};
|
|
30135
|
+
const trackedItems = [
|
|
30136
|
+
'rowIds',
|
|
30137
|
+
'groupRows',
|
|
30138
|
+
'columnIds',
|
|
30139
|
+
'columnSort',
|
|
30140
|
+
'columnWidths',
|
|
30141
|
+
'columnDefinition',
|
|
30142
|
+
'actionMenuSlots',
|
|
30143
|
+
'selectionMode'
|
|
30144
|
+
];
|
|
30079
30145
|
/**
|
|
30080
30146
|
* Helper class to track what updates are needed to the table based on configuration
|
|
30081
30147
|
* changes.
|
|
30082
30148
|
*/
|
|
30083
|
-
class UpdateTracker {
|
|
30149
|
+
class TableUpdateTracker extends UpdateTracker {
|
|
30084
30150
|
constructor(table) {
|
|
30085
|
-
|
|
30086
|
-
rowIds: false,
|
|
30087
|
-
groupRows: false,
|
|
30088
|
-
columnIds: false,
|
|
30089
|
-
columnSort: false,
|
|
30090
|
-
columnWidths: false,
|
|
30091
|
-
columnDefinition: false,
|
|
30092
|
-
actionMenuSlots: false,
|
|
30093
|
-
selectionMode: false
|
|
30094
|
-
};
|
|
30095
|
-
this.updateQueued = false;
|
|
30151
|
+
super(trackedItems);
|
|
30096
30152
|
this.table = table;
|
|
30153
|
+
this.updateQueued = false;
|
|
30097
30154
|
}
|
|
30098
30155
|
get updateRowIds() {
|
|
30099
|
-
return this.
|
|
30156
|
+
return this.isTracked('rowIds');
|
|
30100
30157
|
}
|
|
30101
30158
|
get updateGroupRows() {
|
|
30102
|
-
return this.
|
|
30159
|
+
return this.isTracked('groupRows');
|
|
30103
30160
|
}
|
|
30104
30161
|
get updateColumnIds() {
|
|
30105
|
-
return this.
|
|
30162
|
+
return this.isTracked('columnIds');
|
|
30106
30163
|
}
|
|
30107
30164
|
get updateColumnSort() {
|
|
30108
|
-
return this.
|
|
30165
|
+
return this.isTracked('columnSort');
|
|
30109
30166
|
}
|
|
30110
30167
|
get updateColumnWidths() {
|
|
30111
|
-
return this.
|
|
30168
|
+
return this.isTracked('columnWidths');
|
|
30112
30169
|
}
|
|
30113
30170
|
get updateColumnDefinition() {
|
|
30114
|
-
return this.
|
|
30171
|
+
return this.isTracked('columnDefinition');
|
|
30115
30172
|
}
|
|
30116
30173
|
get updateActionMenuSlots() {
|
|
30117
|
-
return this.
|
|
30174
|
+
return this.isTracked('actionMenuSlots');
|
|
30118
30175
|
}
|
|
30119
30176
|
get updateSelectionMode() {
|
|
30120
|
-
return this.
|
|
30177
|
+
return this.isTracked('selectionMode');
|
|
30121
30178
|
}
|
|
30122
30179
|
get requiresTanStackUpdate() {
|
|
30123
|
-
return (this.
|
|
30124
|
-
|| this.
|
|
30125
|
-
|| this.
|
|
30126
|
-
|| this.
|
|
30127
|
-
|| this.
|
|
30180
|
+
return (this.isTracked('rowIds')
|
|
30181
|
+
|| this.isTracked('columnSort')
|
|
30182
|
+
|| this.isTracked('columnDefinition')
|
|
30183
|
+
|| this.isTracked('groupRows')
|
|
30184
|
+
|| this.isTracked('selectionMode'));
|
|
30128
30185
|
}
|
|
30129
30186
|
get requiresTanStackDataReset() {
|
|
30130
|
-
return
|
|
30187
|
+
return this.isTracked('rowIds') || this.isTracked('columnDefinition');
|
|
30131
30188
|
}
|
|
30132
30189
|
trackAllStateChanged() {
|
|
30133
|
-
this.
|
|
30190
|
+
this.trackAll();
|
|
30134
30191
|
this.queueUpdate();
|
|
30135
30192
|
}
|
|
30136
30193
|
get hasPendingUpdates() {
|
|
@@ -30138,49 +30195,44 @@
|
|
|
30138
30195
|
}
|
|
30139
30196
|
trackColumnPropertyChanged(changedColumnProperty) {
|
|
30140
30197
|
if (isColumnProperty(changedColumnProperty, 'columnId')) {
|
|
30141
|
-
this.
|
|
30198
|
+
this.track('columnIds');
|
|
30142
30199
|
}
|
|
30143
30200
|
else if (isColumnInternalsProperty(changedColumnProperty, 'operandDataRecordFieldName', 'sortOperation')) {
|
|
30144
|
-
this.
|
|
30201
|
+
this.track('columnDefinition');
|
|
30145
30202
|
}
|
|
30146
30203
|
else if (isColumnProperty(changedColumnProperty, 'sortingDisabled')
|
|
30147
30204
|
|| isColumnInternalsProperty(changedColumnProperty, 'currentSortDirection', 'currentSortIndex')) {
|
|
30148
|
-
this.
|
|
30205
|
+
this.track('columnSort');
|
|
30149
30206
|
}
|
|
30150
30207
|
else if (isColumnProperty(changedColumnProperty, 'columnHidden')
|
|
30151
30208
|
|| isColumnInternalsProperty(changedColumnProperty, 'currentFractionalWidth', 'currentPixelWidth', 'minPixelWidth')) {
|
|
30152
|
-
this.
|
|
30209
|
+
this.track('columnWidths');
|
|
30153
30210
|
}
|
|
30154
30211
|
else if (isColumnProperty(changedColumnProperty, 'actionMenuSlot')) {
|
|
30155
|
-
this.
|
|
30212
|
+
this.track('actionMenuSlots');
|
|
30156
30213
|
}
|
|
30157
30214
|
else if (isColumnInternalsProperty(changedColumnProperty, 'groupIndex', 'groupingDisabled')) {
|
|
30158
|
-
this.
|
|
30215
|
+
this.track('groupRows');
|
|
30159
30216
|
}
|
|
30160
30217
|
this.queueUpdate();
|
|
30161
30218
|
}
|
|
30162
30219
|
trackColumnInstancesChanged() {
|
|
30163
|
-
this.
|
|
30164
|
-
this.
|
|
30165
|
-
this.
|
|
30166
|
-
this.
|
|
30167
|
-
this.
|
|
30168
|
-
this.
|
|
30220
|
+
this.track('columnIds');
|
|
30221
|
+
this.track('columnDefinition');
|
|
30222
|
+
this.track('columnSort');
|
|
30223
|
+
this.track('columnWidths');
|
|
30224
|
+
this.track('actionMenuSlots');
|
|
30225
|
+
this.track('groupRows');
|
|
30169
30226
|
this.queueUpdate();
|
|
30170
30227
|
}
|
|
30171
30228
|
trackIdFieldNameChanged() {
|
|
30172
|
-
this.
|
|
30229
|
+
this.track('rowIds');
|
|
30173
30230
|
this.queueUpdate();
|
|
30174
30231
|
}
|
|
30175
30232
|
trackSelectionModeChanged() {
|
|
30176
|
-
this.
|
|
30233
|
+
this.track('selectionMode');
|
|
30177
30234
|
this.queueUpdate();
|
|
30178
30235
|
}
|
|
30179
|
-
setAllKeys(value) {
|
|
30180
|
-
Object.keys(this.requiredUpdates).forEach(key => {
|
|
30181
|
-
this.requiredUpdates[key] = value;
|
|
30182
|
-
});
|
|
30183
|
-
}
|
|
30184
30236
|
queueUpdate() {
|
|
30185
30237
|
if (!this.table.$fastController.isConnected) {
|
|
30186
30238
|
return;
|
|
@@ -30189,7 +30241,7 @@
|
|
|
30189
30241
|
this.updateQueued = true;
|
|
30190
30242
|
DOM.queueUpdate(() => {
|
|
30191
30243
|
this.table.update();
|
|
30192
|
-
this.
|
|
30244
|
+
this.untrackAll();
|
|
30193
30245
|
this.updateQueued = false;
|
|
30194
30246
|
});
|
|
30195
30247
|
}
|
|
@@ -30523,7 +30575,7 @@
|
|
|
30523
30575
|
*/
|
|
30524
30576
|
this.documentShiftKeyDown = false;
|
|
30525
30577
|
this.tableValidator = new TableValidator();
|
|
30526
|
-
this.
|
|
30578
|
+
this.tableUpdateTracker = new TableUpdateTracker(this);
|
|
30527
30579
|
this.columnNotifiers = [];
|
|
30528
30580
|
this.isInitialized = false;
|
|
30529
30581
|
this.collapsedRows = new Set();
|
|
@@ -30688,7 +30740,7 @@
|
|
|
30688
30740
|
this.tableValidator.validateColumnConfigurations(this.columns);
|
|
30689
30741
|
}
|
|
30690
30742
|
else {
|
|
30691
|
-
this.
|
|
30743
|
+
this.tableUpdateTracker.trackColumnPropertyChanged(args);
|
|
30692
30744
|
}
|
|
30693
30745
|
}
|
|
30694
30746
|
}
|
|
@@ -30788,16 +30840,16 @@
|
|
|
30788
30840
|
*/
|
|
30789
30841
|
update() {
|
|
30790
30842
|
this.validate();
|
|
30791
|
-
if (this.
|
|
30843
|
+
if (this.tableUpdateTracker.requiresTanStackUpdate) {
|
|
30792
30844
|
this.updateTanStack();
|
|
30793
30845
|
}
|
|
30794
|
-
if (this.
|
|
30846
|
+
if (this.tableUpdateTracker.updateActionMenuSlots) {
|
|
30795
30847
|
this.updateActionMenuSlots();
|
|
30796
30848
|
}
|
|
30797
|
-
if (this.
|
|
30849
|
+
if (this.tableUpdateTracker.updateColumnWidths) {
|
|
30798
30850
|
this.updateRowGridColumns();
|
|
30799
30851
|
}
|
|
30800
|
-
if (this.
|
|
30852
|
+
if (this.tableUpdateTracker.updateGroupRows) {
|
|
30801
30853
|
this.showCollapseAll = this.getColumnsParticipatingInGrouping().length > 0;
|
|
30802
30854
|
}
|
|
30803
30855
|
}
|
|
@@ -30815,20 +30867,20 @@
|
|
|
30815
30867
|
if (!this.$fastController.isConnected) {
|
|
30816
30868
|
return;
|
|
30817
30869
|
}
|
|
30818
|
-
this.
|
|
30870
|
+
this.tableUpdateTracker.trackSelectionModeChanged();
|
|
30819
30871
|
}
|
|
30820
30872
|
idFieldNameChanged(_prev, _next) {
|
|
30821
30873
|
if (!this.$fastController.isConnected) {
|
|
30822
30874
|
return;
|
|
30823
30875
|
}
|
|
30824
|
-
this.
|
|
30876
|
+
this.tableUpdateTracker.trackIdFieldNameChanged();
|
|
30825
30877
|
}
|
|
30826
30878
|
columnsChanged(_prev, _next) {
|
|
30827
30879
|
if (!this.$fastController.isConnected) {
|
|
30828
30880
|
return;
|
|
30829
30881
|
}
|
|
30830
30882
|
this.observeColumns();
|
|
30831
|
-
this.
|
|
30883
|
+
this.tableUpdateTracker.trackColumnInstancesChanged();
|
|
30832
30884
|
}
|
|
30833
30885
|
async handleActionMenuBeforeToggleEvent(rowIndex, event) {
|
|
30834
30886
|
const selectionChanged = this.selectionManager.handleActionMenuOpening(this.tableData[rowIndex]);
|
|
@@ -30869,13 +30921,13 @@
|
|
|
30869
30921
|
this.isInitialized = true;
|
|
30870
30922
|
// Initialize the controller to ensure that FAST functionality such as Observables work as expected.
|
|
30871
30923
|
this.$fastController.onConnectedCallback();
|
|
30872
|
-
this.
|
|
30924
|
+
this.tableUpdateTracker.trackAllStateChanged();
|
|
30873
30925
|
this.observeColumns();
|
|
30874
30926
|
}
|
|
30875
30927
|
async processPendingUpdates() {
|
|
30876
30928
|
this.initialize();
|
|
30877
30929
|
await DOM.nextUpdate();
|
|
30878
|
-
if (this.
|
|
30930
|
+
if (this.tableUpdateTracker.hasPendingUpdates) {
|
|
30879
30931
|
throw new Error('Expected pending updates to be resolved');
|
|
30880
30932
|
}
|
|
30881
30933
|
}
|
|
@@ -30913,28 +30965,28 @@
|
|
|
30913
30965
|
updateTanStack() {
|
|
30914
30966
|
const updatedOptions = {};
|
|
30915
30967
|
updatedOptions.state = {};
|
|
30916
|
-
if (this.
|
|
30968
|
+
if (this.tableUpdateTracker.updateColumnSort) {
|
|
30917
30969
|
updatedOptions.state.sorting = this.calculateTanStackSortState();
|
|
30918
30970
|
}
|
|
30919
|
-
if (this.
|
|
30971
|
+
if (this.tableUpdateTracker.updateColumnDefinition) {
|
|
30920
30972
|
updatedOptions.columns = this.calculateTanStackColumns();
|
|
30921
30973
|
}
|
|
30922
|
-
if (this.
|
|
30974
|
+
if (this.tableUpdateTracker.updateRowIds) {
|
|
30923
30975
|
updatedOptions.getRowId = this.calculateTanStackRowIdFunction();
|
|
30924
30976
|
updatedOptions.state.rowSelection = {};
|
|
30925
30977
|
this.selectionManager.handleSelectionReset();
|
|
30926
30978
|
}
|
|
30927
|
-
if (this.
|
|
30979
|
+
if (this.tableUpdateTracker.updateSelectionMode) {
|
|
30928
30980
|
updatedOptions.enableMultiRowSelection = this.selectionMode === TableRowSelectionMode.multiple;
|
|
30929
30981
|
updatedOptions.enableSubRowSelection = this.selectionMode === TableRowSelectionMode.multiple;
|
|
30930
30982
|
updatedOptions.state.rowSelection = {};
|
|
30931
30983
|
this.selectionManager.handleSelectionModeChanged(this.selectionMode);
|
|
30932
30984
|
}
|
|
30933
|
-
if (this.
|
|
30985
|
+
if (this.tableUpdateTracker.requiresTanStackDataReset) {
|
|
30934
30986
|
// Perform a shallow copy of the data to trigger tanstack to regenerate the row models and columns.
|
|
30935
30987
|
updatedOptions.data = [...this.table.options.data];
|
|
30936
30988
|
}
|
|
30937
|
-
if (this.
|
|
30989
|
+
if (this.tableUpdateTracker.updateGroupRows) {
|
|
30938
30990
|
updatedOptions.state.grouping = this.calculateTanStackGroupingState();
|
|
30939
30991
|
updatedOptions.state.expanded = true;
|
|
30940
30992
|
this.collapsedRows.clear();
|