@ni/nimble-components 18.4.0 → 18.5.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/dist/all-components-bundle.js +138 -10
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +882 -823
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/banner/index.js +5 -1
- package/dist/esm/banner/index.js.map +1 -1
- package/dist/esm/banner/types.d.ts +8 -0
- package/dist/esm/table/components/cell/index.d.ts +6 -0
- package/dist/esm/table/components/cell/index.js +19 -1
- package/dist/esm/table/components/cell/index.js.map +1 -1
- package/dist/esm/table/components/cell/styles.js +7 -0
- package/dist/esm/table/components/cell/styles.js.map +1 -1
- package/dist/esm/table/components/cell/template.js +19 -1
- package/dist/esm/table/components/cell/template.js.map +1 -1
- package/dist/esm/table/components/row/index.d.ts +6 -0
- package/dist/esm/table/components/row/index.js +24 -0
- package/dist/esm/table/components/row/index.js.map +1 -1
- package/dist/esm/table/components/row/styles.js +13 -0
- package/dist/esm/table/components/row/styles.js.map +1 -1
- package/dist/esm/table/components/row/template.js +12 -1
- package/dist/esm/table/components/row/template.js.map +1 -1
- package/dist/esm/table/index.d.ts +11 -1
- package/dist/esm/table/index.js +24 -0
- package/dist/esm/table/index.js.map +1 -1
- package/dist/esm/table/models/virtualizer.js +4 -6
- package/dist/esm/table/models/virtualizer.js.map +1 -1
- package/dist/esm/table/styles.js +2 -3
- package/dist/esm/table/styles.js.map +1 -1
- package/dist/esm/table/template.js +11 -1
- package/dist/esm/table/template.js.map +1 -1
- package/dist/esm/table/types.d.ts +6 -0
- package/dist/esm/table-column/base/index.d.ts +3 -1
- package/dist/esm/table-column/base/index.js +6 -0
- package/dist/esm/table-column/base/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -19174,7 +19174,11 @@
|
|
|
19174
19174
|
* @internal
|
|
19175
19175
|
*/
|
|
19176
19176
|
openChanged() {
|
|
19177
|
-
|
|
19177
|
+
const eventDetail = {
|
|
19178
|
+
newState: this.open,
|
|
19179
|
+
oldState: !this.open
|
|
19180
|
+
};
|
|
19181
|
+
this.$emit('toggle', eventDetail);
|
|
19178
19182
|
}
|
|
19179
19183
|
/**
|
|
19180
19184
|
* @internal
|
|
@@ -26875,6 +26879,12 @@
|
|
|
26875
26879
|
__decorate$1([
|
|
26876
26880
|
attr({ attribute: 'column-id' })
|
|
26877
26881
|
], TableColumn.prototype, "columnId", void 0);
|
|
26882
|
+
__decorate$1([
|
|
26883
|
+
attr({ attribute: 'action-menu-slot' })
|
|
26884
|
+
], TableColumn.prototype, "actionMenuSlot", void 0);
|
|
26885
|
+
__decorate$1([
|
|
26886
|
+
attr({ attribute: 'action-menu-label' })
|
|
26887
|
+
], TableColumn.prototype, "actionMenuLabel", void 0);
|
|
26878
26888
|
|
|
26879
26889
|
/**
|
|
26880
26890
|
* Helper class for the nimble-table to validate that the table's configuration
|
|
@@ -26981,9 +26991,7 @@
|
|
|
26981
26991
|
|
|
26982
26992
|
.table-row-container {
|
|
26983
26993
|
width: 100%;
|
|
26984
|
-
position:
|
|
26985
|
-
overflow: hidden;
|
|
26986
|
-
top: 0px;
|
|
26994
|
+
position: relative;
|
|
26987
26995
|
}
|
|
26988
26996
|
|
|
26989
26997
|
.header-container {
|
|
@@ -27005,6 +27013,7 @@
|
|
|
27005
27013
|
.row {
|
|
27006
27014
|
background: ${applicationBackgroundColor};
|
|
27007
27015
|
position: relative;
|
|
27016
|
+
box-sizing: border-box;
|
|
27008
27017
|
}
|
|
27009
27018
|
|
|
27010
27019
|
.row::before {
|
|
@@ -27080,6 +27089,19 @@
|
|
|
27080
27089
|
grid-auto-flow: column;
|
|
27081
27090
|
grid-auto-columns: 1fr;
|
|
27082
27091
|
}
|
|
27092
|
+
|
|
27093
|
+
nimble-table-cell {
|
|
27094
|
+
--ni-private-table-cell-action-menu-display: none;
|
|
27095
|
+
}
|
|
27096
|
+
|
|
27097
|
+
nimble-table-cell[menu-open] {
|
|
27098
|
+
--ni-private-table-cell-action-menu-display: block;
|
|
27099
|
+
}
|
|
27100
|
+
|
|
27101
|
+
:host(.hover) nimble-table-cell,
|
|
27102
|
+
:host(:hover) nimble-table-cell {
|
|
27103
|
+
--ni-private-table-cell-action-menu-display: block;
|
|
27104
|
+
}
|
|
27083
27105
|
`;
|
|
27084
27106
|
|
|
27085
27107
|
const styles$a = css `
|
|
@@ -27089,6 +27111,9 @@
|
|
|
27089
27111
|
padding: 0px calc(${standardPadding} / 2);
|
|
27090
27112
|
align-self: center;
|
|
27091
27113
|
height: 100%;
|
|
27114
|
+
grid-template-columns: 1fr auto;
|
|
27115
|
+
/* A default value that will be overridden by the row */
|
|
27116
|
+
--ni-private-table-cell-action-menu-display: block;
|
|
27092
27117
|
}
|
|
27093
27118
|
|
|
27094
27119
|
.cell-content-container {
|
|
@@ -27096,12 +27121,30 @@
|
|
|
27096
27121
|
display: flex;
|
|
27097
27122
|
align-items: center;
|
|
27098
27123
|
}
|
|
27124
|
+
|
|
27125
|
+
.action-menu {
|
|
27126
|
+
display: var(--ni-private-table-cell-action-menu-display);
|
|
27127
|
+
}
|
|
27099
27128
|
`;
|
|
27100
27129
|
|
|
27101
27130
|
// prettier-ignore
|
|
27102
27131
|
const template$6 = html `
|
|
27103
27132
|
<template role="cell">
|
|
27104
27133
|
<div ${ref('cellContentContainer')} class="cell-content-container"></div>
|
|
27134
|
+
|
|
27135
|
+
${when(x => x.hasActionMenu, html `
|
|
27136
|
+
<${DesignSystem.tagFor(MenuButton)}
|
|
27137
|
+
content-hidden
|
|
27138
|
+
appearance="${ButtonAppearance.ghost}"
|
|
27139
|
+
@beforetoggle="${(x, c) => x.onActionMenuBeforeToggle(c.event)}"
|
|
27140
|
+
@toggle="${(x, c) => x.onActionMenuToggle(c.event)}"
|
|
27141
|
+
class="action-menu"
|
|
27142
|
+
>
|
|
27143
|
+
<${DesignSystem.tagFor(IconThreeDotsLine)} slot="start"></${DesignSystem.tagFor(IconThreeDotsLine)}>
|
|
27144
|
+
${x => x.actionMenuLabel}
|
|
27145
|
+
<slot name="cellActionMenu" slot="menu"></slot>
|
|
27146
|
+
</${DesignSystem.tagFor(MenuButton)}>
|
|
27147
|
+
`)}
|
|
27105
27148
|
</template>
|
|
27106
27149
|
`;
|
|
27107
27150
|
|
|
@@ -27112,6 +27155,8 @@
|
|
|
27112
27155
|
class TableCell extends FoundationElement {
|
|
27113
27156
|
constructor() {
|
|
27114
27157
|
super(...arguments);
|
|
27158
|
+
this.hasActionMenu = false;
|
|
27159
|
+
this.menuOpen = false;
|
|
27115
27160
|
this.customCellView = undefined;
|
|
27116
27161
|
}
|
|
27117
27162
|
connectedCallback() {
|
|
@@ -27125,6 +27170,13 @@
|
|
|
27125
27170
|
this.customCellView = undefined;
|
|
27126
27171
|
}
|
|
27127
27172
|
}
|
|
27173
|
+
onActionMenuBeforeToggle(event) {
|
|
27174
|
+
this.$emit('cell-action-menu-beforetoggle', event.detail);
|
|
27175
|
+
}
|
|
27176
|
+
onActionMenuToggle(event) {
|
|
27177
|
+
this.menuOpen = event.detail.newState;
|
|
27178
|
+
this.$emit('cell-action-menu-toggle', event.detail);
|
|
27179
|
+
}
|
|
27128
27180
|
cellStateChanged() {
|
|
27129
27181
|
this.customCellView?.bind(this.cellState, defaultExecutionContext);
|
|
27130
27182
|
}
|
|
@@ -27151,6 +27203,15 @@
|
|
|
27151
27203
|
__decorate$1([
|
|
27152
27204
|
observable
|
|
27153
27205
|
], TableCell.prototype, "cellStyles", void 0);
|
|
27206
|
+
__decorate$1([
|
|
27207
|
+
attr({ attribute: 'has-action-menu', mode: 'boolean' })
|
|
27208
|
+
], TableCell.prototype, "hasActionMenu", void 0);
|
|
27209
|
+
__decorate$1([
|
|
27210
|
+
attr({ attribute: 'menu-open', mode: 'boolean' })
|
|
27211
|
+
], TableCell.prototype, "menuOpen", void 0);
|
|
27212
|
+
__decorate$1([
|
|
27213
|
+
attr({ attribute: 'action-menu-label' })
|
|
27214
|
+
], TableCell.prototype, "actionMenuLabel", void 0);
|
|
27154
27215
|
const nimbleTableCell = TableCell.compose({
|
|
27155
27216
|
baseName: 'table-cell',
|
|
27156
27217
|
template: template$6,
|
|
@@ -27167,7 +27228,18 @@
|
|
|
27167
27228
|
:cellTemplate="${x => x.column.cellTemplate}"
|
|
27168
27229
|
:cellStyles="${x => x.column.cellStyles}"
|
|
27169
27230
|
:cellState="${x => x.cellState}"
|
|
27231
|
+
?has-action-menu="${x => !!x.column.actionMenuSlot}"
|
|
27232
|
+
action-menu-label="${x => x.column.actionMenuLabel}"
|
|
27233
|
+
@cell-action-menu-beforetoggle="${(x, c) => c.parent.onCellActionMenuBeforeToggle(c.event, x.column)}"
|
|
27234
|
+
@cell-action-menu-toggle="${(x, c) => c.parent.onCellActionMenuToggle(c.event, x.column)}"
|
|
27170
27235
|
>
|
|
27236
|
+
|
|
27237
|
+
${when((x, c) => (c.parent.currentActionMenuColumn === x.column) && x.column.actionMenuSlot, html `
|
|
27238
|
+
<slot
|
|
27239
|
+
name="${x => `row-action-menu-${x.column.actionMenuSlot}`}"
|
|
27240
|
+
slot="cellActionMenu"
|
|
27241
|
+
></slot>
|
|
27242
|
+
`)}
|
|
27171
27243
|
</${DesignSystem.tagFor(TableCell)}>
|
|
27172
27244
|
`)}
|
|
27173
27245
|
</template>
|
|
@@ -27181,6 +27253,7 @@
|
|
|
27181
27253
|
constructor() {
|
|
27182
27254
|
super(...arguments);
|
|
27183
27255
|
this.columns = [];
|
|
27256
|
+
this.menuOpen = false;
|
|
27184
27257
|
}
|
|
27185
27258
|
get columnStates() {
|
|
27186
27259
|
return this.columns.map(column => {
|
|
@@ -27204,6 +27277,23 @@
|
|
|
27204
27277
|
return { column, cellState };
|
|
27205
27278
|
});
|
|
27206
27279
|
}
|
|
27280
|
+
onCellActionMenuBeforeToggle(event, column) {
|
|
27281
|
+
this.currentActionMenuColumn = column;
|
|
27282
|
+
this.emitToggleEvent('row-action-menu-beforetoggle', event.detail, column);
|
|
27283
|
+
}
|
|
27284
|
+
onCellActionMenuToggle(event, column) {
|
|
27285
|
+
this.menuOpen = event.detail.newState;
|
|
27286
|
+
this.emitToggleEvent('row-action-menu-toggle', event.detail, column);
|
|
27287
|
+
}
|
|
27288
|
+
emitToggleEvent(eventType, menuButtonEventDetail, column) {
|
|
27289
|
+
const detail = {
|
|
27290
|
+
newState: menuButtonEventDetail.newState,
|
|
27291
|
+
oldState: menuButtonEventDetail.oldState,
|
|
27292
|
+
recordIds: [this.recordId],
|
|
27293
|
+
columnId: column.columnId
|
|
27294
|
+
};
|
|
27295
|
+
this.$emit(eventType, detail);
|
|
27296
|
+
}
|
|
27207
27297
|
hasValidFieldNames(keys) {
|
|
27208
27298
|
return keys.every(key => key !== undefined);
|
|
27209
27299
|
}
|
|
@@ -27217,6 +27307,12 @@
|
|
|
27217
27307
|
__decorate$1([
|
|
27218
27308
|
observable
|
|
27219
27309
|
], TableRow.prototype, "columns", void 0);
|
|
27310
|
+
__decorate$1([
|
|
27311
|
+
observable
|
|
27312
|
+
], TableRow.prototype, "currentActionMenuColumn", void 0);
|
|
27313
|
+
__decorate$1([
|
|
27314
|
+
attr({ attribute: 'menu-open', mode: 'boolean' })
|
|
27315
|
+
], TableRow.prototype, "menuOpen", void 0);
|
|
27220
27316
|
__decorate$1([
|
|
27221
27317
|
volatile
|
|
27222
27318
|
], TableRow.prototype, "columnStates", null);
|
|
@@ -27243,7 +27339,7 @@
|
|
|
27243
27339
|
</div>
|
|
27244
27340
|
<div class="table-viewport" ${ref('viewport')}>
|
|
27245
27341
|
<div class="table-scroll" style="height: ${x => x.virtualizer.allRowsHeight}px;"></div>
|
|
27246
|
-
<div class="table-row-container" role="rowgroup" style="
|
|
27342
|
+
<div class="table-row-container" role="rowgroup" style="top: ${x => `${x.virtualizer.rowContainerYOffset}px;`}">
|
|
27247
27343
|
${when(x => x.columns.length > 0 && x.canRenderRows, html `
|
|
27248
27344
|
${repeat(x => x.virtualizer.visibleItems, html `
|
|
27249
27345
|
<${DesignSystem.tagFor(TableRow)}
|
|
@@ -27251,8 +27347,18 @@
|
|
|
27251
27347
|
record-id="${(x, c) => c.parent.tableData[x.index]?.id}"
|
|
27252
27348
|
:dataRecord="${(x, c) => c.parent.tableData[x.index]?.record}"
|
|
27253
27349
|
:columns="${(_, c) => c.parent.columns}"
|
|
27350
|
+
@row-action-menu-beforetoggle="${(_, c) => c.parent.onRowActionMenuBeforeToggle(c.event)}"
|
|
27351
|
+
@row-action-menu-toggle="${(_, c) => c.parent.onRowActionMenuToggle(c.event)}"
|
|
27254
27352
|
style="height: ${x => x.size}px;"
|
|
27255
27353
|
>
|
|
27354
|
+
${when((x, c) => c.parent.openActionMenuRecordId === c.parent.tableData[x.index]?.id, html `
|
|
27355
|
+
${repeat((_, c) => c.parent.actionMenuSlots, html `
|
|
27356
|
+
<slot
|
|
27357
|
+
name="${x => x}"
|
|
27358
|
+
slot="${x => `row-action-menu-${x}`}">
|
|
27359
|
+
</slot>
|
|
27360
|
+
`)}
|
|
27361
|
+
`)}
|
|
27256
27362
|
</${DesignSystem.tagFor(TableRow)}>
|
|
27257
27363
|
`)}
|
|
27258
27364
|
`)}
|
|
@@ -27933,7 +28039,8 @@
|
|
|
27933
28039
|
this.handleVirtualizerChange();
|
|
27934
28040
|
}
|
|
27935
28041
|
createVirtualizerOptions() {
|
|
27936
|
-
const rowHeight = parseFloat(controlHeight.getValueFor(this.table))
|
|
28042
|
+
const rowHeight = parseFloat(controlHeight.getValueFor(this.table))
|
|
28043
|
+
+ 2 * parseFloat(borderWidth.getValueFor(this.table));
|
|
27937
28044
|
return {
|
|
27938
28045
|
count: this.table.tableData.length,
|
|
27939
28046
|
getScrollElement: () => {
|
|
@@ -27960,10 +28067,7 @@
|
|
|
27960
28067
|
let rowContainerYOffset = 0;
|
|
27961
28068
|
if (this.visibleItems.length > 0) {
|
|
27962
28069
|
const firstItem = this.visibleItems[0];
|
|
27963
|
-
|
|
27964
|
-
if (lastItem.end < this.allRowsHeight) {
|
|
27965
|
-
rowContainerYOffset = firstItem.start - virtualizer.scrollOffset;
|
|
27966
|
-
}
|
|
28070
|
+
rowContainerYOffset = firstItem.start;
|
|
27967
28071
|
}
|
|
27968
28072
|
this.rowContainerYOffset = rowContainerYOffset;
|
|
27969
28073
|
}
|
|
@@ -27999,6 +28103,10 @@
|
|
|
27999
28103
|
* @internal
|
|
28000
28104
|
*/
|
|
28001
28105
|
this.childItems = [];
|
|
28106
|
+
/**
|
|
28107
|
+
* @internal
|
|
28108
|
+
*/
|
|
28109
|
+
this.actionMenuSlots = [];
|
|
28002
28110
|
/**
|
|
28003
28111
|
* @internal
|
|
28004
28112
|
*/
|
|
@@ -28064,6 +28172,13 @@
|
|
|
28064
28172
|
}
|
|
28065
28173
|
}
|
|
28066
28174
|
}
|
|
28175
|
+
onRowActionMenuBeforeToggle(event) {
|
|
28176
|
+
this.openActionMenuRecordId = event.detail.recordIds[0];
|
|
28177
|
+
this.$emit('action-menu-beforetoggle', event.detail);
|
|
28178
|
+
}
|
|
28179
|
+
onRowActionMenuToggle(event) {
|
|
28180
|
+
this.$emit('action-menu-toggle', event.detail);
|
|
28181
|
+
}
|
|
28067
28182
|
childItemsChanged() {
|
|
28068
28183
|
void this.updateColumnsFromChildItems();
|
|
28069
28184
|
}
|
|
@@ -28077,6 +28192,13 @@
|
|
|
28077
28192
|
return;
|
|
28078
28193
|
}
|
|
28079
28194
|
this.validateAndObserveColumns();
|
|
28195
|
+
const slots = new Set();
|
|
28196
|
+
for (const column of this.columns) {
|
|
28197
|
+
if (column.actionMenuSlot) {
|
|
28198
|
+
slots.add(column.actionMenuSlot);
|
|
28199
|
+
}
|
|
28200
|
+
}
|
|
28201
|
+
this.actionMenuSlots = Array.from(slots);
|
|
28080
28202
|
}
|
|
28081
28203
|
removeColumnObservers() {
|
|
28082
28204
|
this.columnNotifiers.forEach(notifier => {
|
|
@@ -28165,6 +28287,12 @@
|
|
|
28165
28287
|
__decorate$1([
|
|
28166
28288
|
observable
|
|
28167
28289
|
], Table.prototype, "childItems", void 0);
|
|
28290
|
+
__decorate$1([
|
|
28291
|
+
observable
|
|
28292
|
+
], Table.prototype, "actionMenuSlots", void 0);
|
|
28293
|
+
__decorate$1([
|
|
28294
|
+
observable
|
|
28295
|
+
], Table.prototype, "openActionMenuRecordId", void 0);
|
|
28168
28296
|
__decorate$1([
|
|
28169
28297
|
observable
|
|
28170
28298
|
], Table.prototype, "canRenderRows", void 0);
|