@ni/nimble-components 18.4.0 → 18.4.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 +133 -9
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +881 -823
- package/dist/all-components-bundle.min.js.map +1 -1
- 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
|
@@ -26875,6 +26875,12 @@
|
|
|
26875
26875
|
__decorate$1([
|
|
26876
26876
|
attr({ attribute: 'column-id' })
|
|
26877
26877
|
], TableColumn.prototype, "columnId", void 0);
|
|
26878
|
+
__decorate$1([
|
|
26879
|
+
attr({ attribute: 'action-menu-slot' })
|
|
26880
|
+
], TableColumn.prototype, "actionMenuSlot", void 0);
|
|
26881
|
+
__decorate$1([
|
|
26882
|
+
attr({ attribute: 'action-menu-label' })
|
|
26883
|
+
], TableColumn.prototype, "actionMenuLabel", void 0);
|
|
26878
26884
|
|
|
26879
26885
|
/**
|
|
26880
26886
|
* Helper class for the nimble-table to validate that the table's configuration
|
|
@@ -26981,9 +26987,7 @@
|
|
|
26981
26987
|
|
|
26982
26988
|
.table-row-container {
|
|
26983
26989
|
width: 100%;
|
|
26984
|
-
position:
|
|
26985
|
-
overflow: hidden;
|
|
26986
|
-
top: 0px;
|
|
26990
|
+
position: relative;
|
|
26987
26991
|
}
|
|
26988
26992
|
|
|
26989
26993
|
.header-container {
|
|
@@ -27005,6 +27009,7 @@
|
|
|
27005
27009
|
.row {
|
|
27006
27010
|
background: ${applicationBackgroundColor};
|
|
27007
27011
|
position: relative;
|
|
27012
|
+
box-sizing: border-box;
|
|
27008
27013
|
}
|
|
27009
27014
|
|
|
27010
27015
|
.row::before {
|
|
@@ -27080,6 +27085,19 @@
|
|
|
27080
27085
|
grid-auto-flow: column;
|
|
27081
27086
|
grid-auto-columns: 1fr;
|
|
27082
27087
|
}
|
|
27088
|
+
|
|
27089
|
+
nimble-table-cell {
|
|
27090
|
+
--ni-private-table-cell-action-menu-display: none;
|
|
27091
|
+
}
|
|
27092
|
+
|
|
27093
|
+
nimble-table-cell[menu-open] {
|
|
27094
|
+
--ni-private-table-cell-action-menu-display: block;
|
|
27095
|
+
}
|
|
27096
|
+
|
|
27097
|
+
:host(.hover) nimble-table-cell,
|
|
27098
|
+
:host(:hover) nimble-table-cell {
|
|
27099
|
+
--ni-private-table-cell-action-menu-display: block;
|
|
27100
|
+
}
|
|
27083
27101
|
`;
|
|
27084
27102
|
|
|
27085
27103
|
const styles$a = css `
|
|
@@ -27089,6 +27107,9 @@
|
|
|
27089
27107
|
padding: 0px calc(${standardPadding} / 2);
|
|
27090
27108
|
align-self: center;
|
|
27091
27109
|
height: 100%;
|
|
27110
|
+
grid-template-columns: 1fr auto;
|
|
27111
|
+
/* A default value that will be overridden by the row */
|
|
27112
|
+
--ni-private-table-cell-action-menu-display: block;
|
|
27092
27113
|
}
|
|
27093
27114
|
|
|
27094
27115
|
.cell-content-container {
|
|
@@ -27096,12 +27117,30 @@
|
|
|
27096
27117
|
display: flex;
|
|
27097
27118
|
align-items: center;
|
|
27098
27119
|
}
|
|
27120
|
+
|
|
27121
|
+
.action-menu {
|
|
27122
|
+
display: var(--ni-private-table-cell-action-menu-display);
|
|
27123
|
+
}
|
|
27099
27124
|
`;
|
|
27100
27125
|
|
|
27101
27126
|
// prettier-ignore
|
|
27102
27127
|
const template$6 = html `
|
|
27103
27128
|
<template role="cell">
|
|
27104
27129
|
<div ${ref('cellContentContainer')} class="cell-content-container"></div>
|
|
27130
|
+
|
|
27131
|
+
${when(x => x.hasActionMenu, html `
|
|
27132
|
+
<${DesignSystem.tagFor(MenuButton)}
|
|
27133
|
+
content-hidden
|
|
27134
|
+
appearance="${ButtonAppearance.ghost}"
|
|
27135
|
+
@beforetoggle="${(x, c) => x.onActionMenuBeforeToggle(c.event)}"
|
|
27136
|
+
@toggle="${(x, c) => x.onActionMenuToggle(c.event)}"
|
|
27137
|
+
class="action-menu"
|
|
27138
|
+
>
|
|
27139
|
+
<${DesignSystem.tagFor(IconThreeDotsLine)} slot="start"></${DesignSystem.tagFor(IconThreeDotsLine)}>
|
|
27140
|
+
${x => x.actionMenuLabel}
|
|
27141
|
+
<slot name="cellActionMenu" slot="menu"></slot>
|
|
27142
|
+
</${DesignSystem.tagFor(MenuButton)}>
|
|
27143
|
+
`)}
|
|
27105
27144
|
</template>
|
|
27106
27145
|
`;
|
|
27107
27146
|
|
|
@@ -27112,6 +27151,8 @@
|
|
|
27112
27151
|
class TableCell extends FoundationElement {
|
|
27113
27152
|
constructor() {
|
|
27114
27153
|
super(...arguments);
|
|
27154
|
+
this.hasActionMenu = false;
|
|
27155
|
+
this.menuOpen = false;
|
|
27115
27156
|
this.customCellView = undefined;
|
|
27116
27157
|
}
|
|
27117
27158
|
connectedCallback() {
|
|
@@ -27125,6 +27166,13 @@
|
|
|
27125
27166
|
this.customCellView = undefined;
|
|
27126
27167
|
}
|
|
27127
27168
|
}
|
|
27169
|
+
onActionMenuBeforeToggle(event) {
|
|
27170
|
+
this.$emit('cell-action-menu-beforetoggle', event.detail);
|
|
27171
|
+
}
|
|
27172
|
+
onActionMenuToggle(event) {
|
|
27173
|
+
this.menuOpen = event.detail.newState;
|
|
27174
|
+
this.$emit('cell-action-menu-toggle', event.detail);
|
|
27175
|
+
}
|
|
27128
27176
|
cellStateChanged() {
|
|
27129
27177
|
this.customCellView?.bind(this.cellState, defaultExecutionContext);
|
|
27130
27178
|
}
|
|
@@ -27151,6 +27199,15 @@
|
|
|
27151
27199
|
__decorate$1([
|
|
27152
27200
|
observable
|
|
27153
27201
|
], TableCell.prototype, "cellStyles", void 0);
|
|
27202
|
+
__decorate$1([
|
|
27203
|
+
attr({ attribute: 'has-action-menu', mode: 'boolean' })
|
|
27204
|
+
], TableCell.prototype, "hasActionMenu", void 0);
|
|
27205
|
+
__decorate$1([
|
|
27206
|
+
attr({ attribute: 'menu-open', mode: 'boolean' })
|
|
27207
|
+
], TableCell.prototype, "menuOpen", void 0);
|
|
27208
|
+
__decorate$1([
|
|
27209
|
+
attr({ attribute: 'action-menu-label' })
|
|
27210
|
+
], TableCell.prototype, "actionMenuLabel", void 0);
|
|
27154
27211
|
const nimbleTableCell = TableCell.compose({
|
|
27155
27212
|
baseName: 'table-cell',
|
|
27156
27213
|
template: template$6,
|
|
@@ -27167,7 +27224,18 @@
|
|
|
27167
27224
|
:cellTemplate="${x => x.column.cellTemplate}"
|
|
27168
27225
|
:cellStyles="${x => x.column.cellStyles}"
|
|
27169
27226
|
:cellState="${x => x.cellState}"
|
|
27227
|
+
?has-action-menu="${x => !!x.column.actionMenuSlot}"
|
|
27228
|
+
action-menu-label="${x => x.column.actionMenuLabel}"
|
|
27229
|
+
@cell-action-menu-beforetoggle="${(x, c) => c.parent.onCellActionMenuBeforeToggle(c.event, x.column)}"
|
|
27230
|
+
@cell-action-menu-toggle="${(x, c) => c.parent.onCellActionMenuToggle(c.event, x.column)}"
|
|
27170
27231
|
>
|
|
27232
|
+
|
|
27233
|
+
${when((x, c) => (c.parent.currentActionMenuColumn === x.column) && x.column.actionMenuSlot, html `
|
|
27234
|
+
<slot
|
|
27235
|
+
name="${x => `row-action-menu-${x.column.actionMenuSlot}`}"
|
|
27236
|
+
slot="cellActionMenu"
|
|
27237
|
+
></slot>
|
|
27238
|
+
`)}
|
|
27171
27239
|
</${DesignSystem.tagFor(TableCell)}>
|
|
27172
27240
|
`)}
|
|
27173
27241
|
</template>
|
|
@@ -27181,6 +27249,7 @@
|
|
|
27181
27249
|
constructor() {
|
|
27182
27250
|
super(...arguments);
|
|
27183
27251
|
this.columns = [];
|
|
27252
|
+
this.menuOpen = false;
|
|
27184
27253
|
}
|
|
27185
27254
|
get columnStates() {
|
|
27186
27255
|
return this.columns.map(column => {
|
|
@@ -27204,6 +27273,23 @@
|
|
|
27204
27273
|
return { column, cellState };
|
|
27205
27274
|
});
|
|
27206
27275
|
}
|
|
27276
|
+
onCellActionMenuBeforeToggle(event, column) {
|
|
27277
|
+
this.currentActionMenuColumn = column;
|
|
27278
|
+
this.emitToggleEvent('row-action-menu-beforetoggle', event.detail, column);
|
|
27279
|
+
}
|
|
27280
|
+
onCellActionMenuToggle(event, column) {
|
|
27281
|
+
this.menuOpen = event.detail.newState;
|
|
27282
|
+
this.emitToggleEvent('row-action-menu-toggle', event.detail, column);
|
|
27283
|
+
}
|
|
27284
|
+
emitToggleEvent(eventType, menuButtonEventDetail, column) {
|
|
27285
|
+
const detail = {
|
|
27286
|
+
newState: menuButtonEventDetail.newState,
|
|
27287
|
+
oldState: menuButtonEventDetail.oldState,
|
|
27288
|
+
recordIds: [this.recordId],
|
|
27289
|
+
columnId: column.columnId
|
|
27290
|
+
};
|
|
27291
|
+
this.$emit(eventType, detail);
|
|
27292
|
+
}
|
|
27207
27293
|
hasValidFieldNames(keys) {
|
|
27208
27294
|
return keys.every(key => key !== undefined);
|
|
27209
27295
|
}
|
|
@@ -27217,6 +27303,12 @@
|
|
|
27217
27303
|
__decorate$1([
|
|
27218
27304
|
observable
|
|
27219
27305
|
], TableRow.prototype, "columns", void 0);
|
|
27306
|
+
__decorate$1([
|
|
27307
|
+
observable
|
|
27308
|
+
], TableRow.prototype, "currentActionMenuColumn", void 0);
|
|
27309
|
+
__decorate$1([
|
|
27310
|
+
attr({ attribute: 'menu-open', mode: 'boolean' })
|
|
27311
|
+
], TableRow.prototype, "menuOpen", void 0);
|
|
27220
27312
|
__decorate$1([
|
|
27221
27313
|
volatile
|
|
27222
27314
|
], TableRow.prototype, "columnStates", null);
|
|
@@ -27243,7 +27335,7 @@
|
|
|
27243
27335
|
</div>
|
|
27244
27336
|
<div class="table-viewport" ${ref('viewport')}>
|
|
27245
27337
|
<div class="table-scroll" style="height: ${x => x.virtualizer.allRowsHeight}px;"></div>
|
|
27246
|
-
<div class="table-row-container" role="rowgroup" style="
|
|
27338
|
+
<div class="table-row-container" role="rowgroup" style="top: ${x => `${x.virtualizer.rowContainerYOffset}px;`}">
|
|
27247
27339
|
${when(x => x.columns.length > 0 && x.canRenderRows, html `
|
|
27248
27340
|
${repeat(x => x.virtualizer.visibleItems, html `
|
|
27249
27341
|
<${DesignSystem.tagFor(TableRow)}
|
|
@@ -27251,8 +27343,18 @@
|
|
|
27251
27343
|
record-id="${(x, c) => c.parent.tableData[x.index]?.id}"
|
|
27252
27344
|
:dataRecord="${(x, c) => c.parent.tableData[x.index]?.record}"
|
|
27253
27345
|
:columns="${(_, c) => c.parent.columns}"
|
|
27346
|
+
@row-action-menu-beforetoggle="${(_, c) => c.parent.onRowActionMenuBeforeToggle(c.event)}"
|
|
27347
|
+
@row-action-menu-toggle="${(_, c) => c.parent.onRowActionMenuToggle(c.event)}"
|
|
27254
27348
|
style="height: ${x => x.size}px;"
|
|
27255
27349
|
>
|
|
27350
|
+
${when((x, c) => c.parent.openActionMenuRecordId === c.parent.tableData[x.index]?.id, html `
|
|
27351
|
+
${repeat((_, c) => c.parent.actionMenuSlots, html `
|
|
27352
|
+
<slot
|
|
27353
|
+
name="${x => x}"
|
|
27354
|
+
slot="${x => `row-action-menu-${x}`}">
|
|
27355
|
+
</slot>
|
|
27356
|
+
`)}
|
|
27357
|
+
`)}
|
|
27256
27358
|
</${DesignSystem.tagFor(TableRow)}>
|
|
27257
27359
|
`)}
|
|
27258
27360
|
`)}
|
|
@@ -27933,7 +28035,8 @@
|
|
|
27933
28035
|
this.handleVirtualizerChange();
|
|
27934
28036
|
}
|
|
27935
28037
|
createVirtualizerOptions() {
|
|
27936
|
-
const rowHeight = parseFloat(controlHeight.getValueFor(this.table))
|
|
28038
|
+
const rowHeight = parseFloat(controlHeight.getValueFor(this.table))
|
|
28039
|
+
+ 2 * parseFloat(borderWidth.getValueFor(this.table));
|
|
27937
28040
|
return {
|
|
27938
28041
|
count: this.table.tableData.length,
|
|
27939
28042
|
getScrollElement: () => {
|
|
@@ -27960,10 +28063,7 @@
|
|
|
27960
28063
|
let rowContainerYOffset = 0;
|
|
27961
28064
|
if (this.visibleItems.length > 0) {
|
|
27962
28065
|
const firstItem = this.visibleItems[0];
|
|
27963
|
-
|
|
27964
|
-
if (lastItem.end < this.allRowsHeight) {
|
|
27965
|
-
rowContainerYOffset = firstItem.start - virtualizer.scrollOffset;
|
|
27966
|
-
}
|
|
28066
|
+
rowContainerYOffset = firstItem.start;
|
|
27967
28067
|
}
|
|
27968
28068
|
this.rowContainerYOffset = rowContainerYOffset;
|
|
27969
28069
|
}
|
|
@@ -27999,6 +28099,10 @@
|
|
|
27999
28099
|
* @internal
|
|
28000
28100
|
*/
|
|
28001
28101
|
this.childItems = [];
|
|
28102
|
+
/**
|
|
28103
|
+
* @internal
|
|
28104
|
+
*/
|
|
28105
|
+
this.actionMenuSlots = [];
|
|
28002
28106
|
/**
|
|
28003
28107
|
* @internal
|
|
28004
28108
|
*/
|
|
@@ -28064,6 +28168,13 @@
|
|
|
28064
28168
|
}
|
|
28065
28169
|
}
|
|
28066
28170
|
}
|
|
28171
|
+
onRowActionMenuBeforeToggle(event) {
|
|
28172
|
+
this.openActionMenuRecordId = event.detail.recordIds[0];
|
|
28173
|
+
this.$emit('action-menu-beforetoggle', event.detail);
|
|
28174
|
+
}
|
|
28175
|
+
onRowActionMenuToggle(event) {
|
|
28176
|
+
this.$emit('action-menu-toggle', event.detail);
|
|
28177
|
+
}
|
|
28067
28178
|
childItemsChanged() {
|
|
28068
28179
|
void this.updateColumnsFromChildItems();
|
|
28069
28180
|
}
|
|
@@ -28077,6 +28188,13 @@
|
|
|
28077
28188
|
return;
|
|
28078
28189
|
}
|
|
28079
28190
|
this.validateAndObserveColumns();
|
|
28191
|
+
const slots = new Set();
|
|
28192
|
+
for (const column of this.columns) {
|
|
28193
|
+
if (column.actionMenuSlot) {
|
|
28194
|
+
slots.add(column.actionMenuSlot);
|
|
28195
|
+
}
|
|
28196
|
+
}
|
|
28197
|
+
this.actionMenuSlots = Array.from(slots);
|
|
28080
28198
|
}
|
|
28081
28199
|
removeColumnObservers() {
|
|
28082
28200
|
this.columnNotifiers.forEach(notifier => {
|
|
@@ -28165,6 +28283,12 @@
|
|
|
28165
28283
|
__decorate$1([
|
|
28166
28284
|
observable
|
|
28167
28285
|
], Table.prototype, "childItems", void 0);
|
|
28286
|
+
__decorate$1([
|
|
28287
|
+
observable
|
|
28288
|
+
], Table.prototype, "actionMenuSlots", void 0);
|
|
28289
|
+
__decorate$1([
|
|
28290
|
+
observable
|
|
28291
|
+
], Table.prototype, "openActionMenuRecordId", void 0);
|
|
28168
28292
|
__decorate$1([
|
|
28169
28293
|
observable
|
|
28170
28294
|
], Table.prototype, "canRenderRows", void 0);
|