@nova-design-system/nova-react 3.26.0 → 3.28.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/cjs/generated/components.server.js +43 -0
- package/dist/cjs/index-Kxp9mv-Q.js +10119 -0
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/nova-datetime-CyL2J6O4-0Y9g3rfI.js +10531 -0
- package/dist/cjs/{nv-accordion-item.entry-DtzjLTCo.js → nv-accordion-item.entry-fds_kk_3.js} +1 -1
- package/dist/cjs/{nv-accordion.entry-DRcTfezT.js → nv-accordion.entry-BLs4N5ZL.js} +1 -1
- package/dist/cjs/{nv-alert.entry-86bfoXVx.js → nv-alert.entry-Bx1BiC8F.js} +1 -1
- package/dist/cjs/{nv-avatar.entry-mp2LJ6RA.js → nv-avatar.entry-DS88LME3.js} +1 -1
- package/dist/cjs/{nv-badge_2.entry-BrDaHeqh.js → nv-badge_2.entry-vBPxmUmg.js} +2 -2
- package/dist/cjs/{nv-breadcrumb.entry-B2q7jJy2.js → nv-breadcrumb.entry-BOo3hA5y.js} +1 -1
- package/dist/cjs/{nv-breadcrumbs.entry-DKzST1uS.js → nv-breadcrumbs.entry-igHC_6Bd.js} +1 -1
- package/dist/cjs/{nv-button.entry-CVgcU-bi.js → nv-button.entry-BRQPmQbs.js} +1 -1
- package/dist/cjs/{nv-buttongroup.entry-CvuBGaGK.js → nv-buttongroup.entry-D3tG2EZ1.js} +1 -1
- package/dist/cjs/{nv-calendar.entry-BCcGhxzJ.js → nv-calendar.entry-BpNHMTKr.js} +1 -1
- package/dist/cjs/{nv-col.entry-CzTahRVr.js → nv-col.entry-lyIZqDsW.js} +1 -1
- package/dist/cjs/{nv-datagrid.entry-DWZxNqTE.js → nv-datagrid.entry-BeemONKu.js} +1 -1
- package/dist/cjs/{nv-datagridcolumn.entry-CzCzmdQl.js → nv-datagridcolumn.entry-B6kE4eVC.js} +1 -1
- package/dist/cjs/nv-datetest.entry-C1uuC-ZG.js +69 -0
- package/dist/cjs/nv-datetimetest.entry-Hthxbjj9.js +57 -0
- package/dist/cjs/{nv-dialog.entry-ByVD02QB.js → nv-dialog.entry-Cr9zwMPo.js} +16 -3
- package/dist/cjs/{nv-dialogfooter_2.entry-BmQcYJsD.js → nv-dialogfooter_2.entry-DaaKojyE.js} +3 -3
- package/dist/cjs/{nv-drawer.entry-C15JRJ3N.js → nv-drawer.entry-0UaYxCjh.js} +2 -2
- package/dist/cjs/{nv-drawerfooter_2.entry-DuDac_Os.js → nv-drawerfooter_2.entry-CqtuC7xP.js} +3 -3
- package/dist/cjs/{nv-fieldcheckbox.entry-CwDOQzSW.js → nv-fieldcheckbox.entry-DK3aO8C8.js} +5 -5
- package/dist/cjs/{nv-fielddate.entry-DKICGwc0.js → nv-fielddate.entry-BY-xF3KN.js} +7 -7
- package/dist/cjs/{nv-fielddaterange.entry-DGEK8F9p.js → nv-fielddaterange.entry-BT6qCQc3.js} +7 -7
- package/dist/cjs/{nv-fielddropdown.entry-BLS7lRzD.js → nv-fielddropdown.entry-CsVD067i.js} +5 -5
- package/dist/cjs/{nv-fielddropdownitem.entry-Bbfi3A8C.js → nv-fielddropdownitem.entry-Crtfwlx7.js} +2 -2
- package/dist/cjs/{nv-fieldmultiselect.entry-Cpy7HzlZ.js → nv-fieldmultiselect.entry-C2uoE60e.js} +1 -1
- package/dist/cjs/{nv-fieldnumber.entry-SbNb4hKr.js → nv-fieldnumber.entry-DzW5SiiZ.js} +5 -5
- package/dist/cjs/{nv-fieldpassword.entry-CPsgagjY.js → nv-fieldpassword.entry-D4r9Qxos.js} +5 -5
- package/dist/cjs/{nv-fieldradio.entry-DLP-rmKU.js → nv-fieldradio.entry-DX0Ghx--.js} +4 -4
- package/dist/cjs/{nv-fieldselect.entry-DOOO03kM.js → nv-fieldselect.entry-_CglE66i.js} +6 -6
- package/dist/cjs/{nv-fieldslider.entry-CpVbxkpo.js → nv-fieldslider.entry-6zt75uDU.js} +4 -4
- package/dist/cjs/{nv-fieldtext.entry-BpbG4WHv.js → nv-fieldtext.entry-B4X110wn.js} +5 -5
- package/dist/cjs/{nv-fieldtextarea.entry-BA_RApYN.js → nv-fieldtextarea.entry-CeAMhA8Y.js} +4 -4
- package/dist/cjs/{nv-fieldtime.entry-DaJfwQtC.js → nv-fieldtime.entry-BvzncwNd.js} +4 -4
- package/dist/cjs/nv-icon.entry-C2md2kmq.js +80 -0
- package/dist/cjs/{nv-iconbutton_2.entry-B4xB5WtE.js → nv-iconbutton_2.entry-D-zRpLjT.js} +3 -3
- package/dist/cjs/{nv-menu.entry-DHWhkWeB.js → nv-menu.entry-DN_DkosX.js} +2 -2
- package/dist/cjs/{nv-menuitem.entry-CQApuT2D.js → nv-menuitem.entry-Cj6w33rq.js} +2 -2
- package/dist/cjs/{nv-notification-bullet.entry-CnYVWE_Z.js → nv-notification-bullet.entry-DagStJ3K.js} +1 -1
- package/dist/cjs/{nv-notification.entry-DraOvzsu.js → nv-notification.entry-oV69FpxE.js} +2 -2
- package/dist/cjs/{nv-notificationcontainer.entry-BDo-rQLL.js → nv-notificationcontainer.entry-gQGHHeer.js} +2 -14
- package/dist/cjs/nv-pagination-nav.entry-BYvcVj1M.js +201 -0
- package/dist/cjs/{nv-paginationtable.entry-CS7BhAVe.js → nv-paginationtable.entry-CwCFQwbl.js} +2 -2
- package/dist/cjs/{nv-popover.entry-DSyKCLtF.js → nv-popover.entry-DySToeSB.js} +2 -2
- package/dist/cjs/{nv-row.entry-D21zN2Vr.js → nv-row.entry-46ghuEeG.js} +2 -2
- package/dist/cjs/{nv-sidebar.entry-DpKgnjsJ.js → nv-sidebar.entry-B6opNG2r.js} +2 -2
- package/dist/cjs/{nv-sidebarcontent.entry-BWFDcui8.js → nv-sidebarcontent.entry-Pb8c2QoA.js} +2 -2
- package/dist/cjs/{nv-sidebardivider.entry-BSzLq-h3.js → nv-sidebardivider.entry-LCCO53Z5.js} +2 -2
- package/dist/cjs/{nv-sidebarfooter.entry-C3DLHPSQ.js → nv-sidebarfooter.entry-DG5fkLHd.js} +2 -2
- package/dist/cjs/{nv-sidebargroup.entry-BMYLbCql.js → nv-sidebargroup.entry-DRqkSyQi.js} +2 -2
- package/dist/cjs/{nv-sidebarheader.entry-CkUGD-Tw.js → nv-sidebarheader.entry-D6WvH2wG.js} +2 -2
- package/dist/cjs/{nv-sidebarlogo.entry-BX1-1S1v.js → nv-sidebarlogo.entry-BorScwI-.js} +2 -2
- package/dist/cjs/{nv-sidebarnavitem.entry-CPwt0Njh.js → nv-sidebarnavitem.entry-BEW74Rw3.js} +12 -5
- package/dist/cjs/{nv-sidebarnavsubitem.entry-HZOTB6Tl.js → nv-sidebarnavsubitem.entry-EgaIlUfP.js} +2 -2
- package/dist/cjs/{nv-split.entry-DdtzktvN.js → nv-split.entry-CEC5Tuwz.js} +2 -2
- package/dist/cjs/{nv-stack.entry-BMLt30Nt.js → nv-stack.entry-BR8lYaoI.js} +2 -2
- package/dist/cjs/{nv-table.entry-RTiqKRKM.js → nv-table.entry-CISZFst5.js} +2 -2
- package/dist/cjs/{nv-tableheader.entry-Ci4qo8eY.js → nv-tableheader.entry-DbdpTJGC.js} +2 -2
- package/dist/cjs/nv-timetest.entry-Dg1JEgAv.js +75 -0
- package/dist/cjs/{nv-toggle.entry-s8B7-8P7.js → nv-toggle.entry-DDfRpC1R.js} +3 -3
- package/dist/cjs/{nv-togglebutton.entry-CyHgU4Wl.js → nv-togglebutton.entry-D7NkdIXP.js} +2 -2
- package/dist/cjs/{nv-togglebuttongroup.entry-Bn_9DsdP.js → nv-togglebuttongroup.entry-L8gitSUS.js} +2 -2
- package/dist/cjs/{nv-tooltip.entry-D6kxXLO-.js → nv-tooltip.entry-BElnrEqE.js} +9 -4
- package/dist/components/NvDatatable/NvDatatable.js +293 -63
- package/dist/components/NvDatatable/selectionState.js +45 -0
- package/dist/components/NvDatatable/selectionState.test.js +74 -0
- package/dist/generated/components.js +46 -0
- package/dist/generated/components.server.js +39 -0
- package/dist/types/components/NvDatatable/NvDatatable.d.ts +1 -1
- package/dist/types/components/NvDatatable/selectionState.d.ts +21 -0
- package/dist/types/components/NvDatatable/selectionState.test.d.ts +1 -0
- package/dist/types/components/NvDatatable/types.d.ts +17 -0
- package/dist/types/generated/components.d.ts +56 -1
- package/dist/types/generated/components.server.d.ts +56 -1
- package/package.json +6 -4
- package/dist/cjs/index-BeFrXZol.js +0 -9699
- package/dist/cjs/nv-icon.entry-DIi792yJ.js +0 -80
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Kxp9mv-Q.js');
|
|
4
4
|
var clsxChV9xqsO = require('./clsx-ChV9xqsO-BtxeOLZW.js');
|
|
5
5
|
require('@stencil/react-output-target/runtime');
|
|
6
6
|
require('react');
|
|
@@ -23,7 +23,7 @@ const NvStack = class {
|
|
|
23
23
|
/****************************************************************************/
|
|
24
24
|
//#region RENDER
|
|
25
25
|
render() {
|
|
26
|
-
return (index.h(index.Host, { key: '
|
|
26
|
+
return (index.h(index.Host, { key: '861c5eed0b6dc7cdd5bf3a2d07af92127e2025bf', class: clsxChV9xqsO.clsx(this.fill && 'nv-stack-fill', this.flex && 'nv-stack-flex', this.full && 'w-full', this.gutter && !this.vertical && `gap-x-${this.gutter}`, this.gutter && this.vertical && `gap-y-${this.gutter}`, this.vertical && 'nv-stack-vertical') }, index.h("slot", { key: '4cf3d3fb15fa6c4ed2d7d6bb70334965b0cca457' })));
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
NvStack.style = nvStackCss();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Kxp9mv-Q.js');
|
|
4
4
|
require('@stencil/react-output-target/runtime');
|
|
5
5
|
require('react');
|
|
6
6
|
require('react-dom');
|
|
@@ -236,7 +236,7 @@ const NvTable = class {
|
|
|
236
236
|
/****************************************************************************/
|
|
237
237
|
//#region RENDER
|
|
238
238
|
render() {
|
|
239
|
-
return (index.h(index.Host, { key: '
|
|
239
|
+
return (index.h(index.Host, { key: 'a6882cbcf9b0b12776f6d4be6d9cbfb42aff6833' }, index.h("slot", { key: 'd4d47a2eb77c50ff30109e217ceecd2677b9d28d' })));
|
|
240
240
|
}
|
|
241
241
|
get host() { return index.getElement(this); }
|
|
242
242
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Kxp9mv-Q.js');
|
|
4
4
|
require('@stencil/react-output-target/runtime');
|
|
5
5
|
require('react');
|
|
6
6
|
require('react-dom');
|
|
@@ -62,7 +62,7 @@ const NvTableheader = class {
|
|
|
62
62
|
/****************************************************************************/
|
|
63
63
|
//#region RENDER
|
|
64
64
|
render() {
|
|
65
|
-
return (index.h(index.Host, { key: '
|
|
65
|
+
return (index.h(index.Host, { key: '962f555a02b3035148c5915ae7493c68c0202cc7', role: "columnheader", "aria-sort": this.ariaSort, tabindex: this.sortable ? 0 : undefined, onKeyDown: this.handleKeyDown.bind(this), onClick: this.cycleSortDirection.bind(this) }, index.h("slot", { key: '0e69da3d4e2eb8ad01060f51d5043ffc14380415' }), this.sortable && (index.h("span", { key: 'a9b5ff97552d142cc3e1becc14a34ebab1f3092d', class: "sort-icon-wrap", "aria-hidden": "true" }, index.h("nv-iconbutton", { key: '76f832eba2b57f244dbce597668f493a918cf599', disableTabindex: true, name: "arrow-up", size: "xs", emphasis: this.sortDirection === 'none' ? 'lower' : 'low',
|
|
66
66
|
// prevent mousedown from selecting text
|
|
67
67
|
onMouseDown: (e) => e.preventDefault(), class: {
|
|
68
68
|
'is-none': this.sortDirection === 'none',
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-Kxp9mv-Q.js');
|
|
4
|
+
var novaDatetimeCyL2J6O4 = require('./nova-datetime-CyL2J6O4-0Y9g3rfI.js');
|
|
5
|
+
require('@stencil/react-output-target/runtime');
|
|
6
|
+
require('react');
|
|
7
|
+
require('react-dom');
|
|
8
|
+
|
|
9
|
+
const nvTimetestCss = () => `nv-timetest{display:flex}nv-timetest label{display:flex;flex-direction:column;margin-right:10px;font-weight:bold}nv-timetest input{font-weight:normal;padding:var(--spacing-2);border-radius:var(--spacing-1);border:1px solid #ccc}`;
|
|
10
|
+
|
|
11
|
+
const NvTimetest = class {
|
|
12
|
+
constructor(hostRef) {
|
|
13
|
+
index.registerInstance(this, hostRef);
|
|
14
|
+
this.valueChanged = index.createEvent(this, "valueChanged", 3);
|
|
15
|
+
this.lastChanged = index.createEvent(this, "lastChanged", 3);
|
|
16
|
+
this.historyChanged = index.createEvent(this, "historyChanged", 3);
|
|
17
|
+
this.valueDateChanged = index.createEvent(this, "valueDateChanged", 3);
|
|
18
|
+
//#endregion PROPERTIES
|
|
19
|
+
/****************************************************************************/
|
|
20
|
+
//#region METHODS
|
|
21
|
+
this.handleStartChange = (event) => {
|
|
22
|
+
const input = event.target;
|
|
23
|
+
const parsed = novaDatetimeCyL2J6O4.parseTimeOnly(input.value);
|
|
24
|
+
if (!parsed)
|
|
25
|
+
return;
|
|
26
|
+
const newStart = novaDatetimeCyL2J6O4.formatTimeOnly(parsed);
|
|
27
|
+
this.value = { start: newStart, end: this.value?.end };
|
|
28
|
+
this.lastChange = newStart;
|
|
29
|
+
this.history = [...(this.history ?? []), newStart];
|
|
30
|
+
this.valueChanged.emit(this.value);
|
|
31
|
+
this.lastChanged.emit({ time: this.lastChange });
|
|
32
|
+
this.historyChanged.emit({ times: this.history });
|
|
33
|
+
const todayDate = novaDatetimeCyL2J6O4.LocalDate.now().toString();
|
|
34
|
+
this.valueDateChanged.emit({
|
|
35
|
+
start: this.value?.start
|
|
36
|
+
? new Date(todayDate + 'T' + this.value.start)
|
|
37
|
+
: undefined,
|
|
38
|
+
end: this.value?.end
|
|
39
|
+
? new Date(todayDate + 'T' + this.value.end)
|
|
40
|
+
: undefined,
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
this.handleEndChange = (event) => {
|
|
44
|
+
const input = event.target;
|
|
45
|
+
const parsed = novaDatetimeCyL2J6O4.parseTimeOnly(input.value);
|
|
46
|
+
if (!parsed)
|
|
47
|
+
return;
|
|
48
|
+
const newEnd = novaDatetimeCyL2J6O4.formatTimeOnly(parsed);
|
|
49
|
+
this.value = { start: this.value?.start, end: newEnd };
|
|
50
|
+
this.lastChange = newEnd;
|
|
51
|
+
this.history = [...(this.history ?? []), newEnd];
|
|
52
|
+
this.valueChanged.emit(this.value);
|
|
53
|
+
this.lastChanged.emit({ time: this.lastChange });
|
|
54
|
+
this.historyChanged.emit({ times: this.history });
|
|
55
|
+
const todayDate = novaDatetimeCyL2J6O4.LocalDate.now().toString();
|
|
56
|
+
this.valueDateChanged.emit({
|
|
57
|
+
start: this.value?.start
|
|
58
|
+
? new Date(todayDate + 'T' + this.value.start)
|
|
59
|
+
: undefined,
|
|
60
|
+
end: this.value?.end
|
|
61
|
+
? new Date(todayDate + 'T' + this.value.end)
|
|
62
|
+
: undefined,
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
//#endregion EVENTS
|
|
67
|
+
/****************************************************************************/
|
|
68
|
+
//#region RENDER
|
|
69
|
+
render() {
|
|
70
|
+
return (index.h(index.Host, { key: '85d3773d49a180e5bc9b5bc0962cc3b709a474b0' }, index.h("label", { key: 'c0d5c262578e6aa1555ded8c542e2eef7e42d491' }, "Start:", index.h("input", { key: '31fe9447be14efd87aab1161dbc01593a30328dc', type: "time", step: "1", value: this.value?.start ?? '', onInput: this.handleStartChange })), index.h("label", { key: '0959b432f53169c425765b94c098ca5ecc8d6ede' }, "End:", index.h("input", { key: 'ccc50a80dfea2ab7eb627d11840dd5626ca25f88', type: "time", step: "1", value: this.value?.end ?? '', onInput: this.handleEndChange })), index.h("slot", { key: 'd4c6a017d41102a245e1f8472d676bc866382c00' })));
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
NvTimetest.style = nvTimetestCss();
|
|
74
|
+
|
|
75
|
+
exports.nv_timetest = NvTimetest;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Kxp9mv-Q.js');
|
|
4
4
|
var clsxChV9xqsO = require('./clsx-ChV9xqsO-BtxeOLZW.js');
|
|
5
5
|
var v4BdYh22OP = require('./v4-BdYh22OP-C1vaJ4yP.js');
|
|
6
6
|
require('@stencil/react-output-target/runtime');
|
|
@@ -66,8 +66,8 @@ const NvToggle = class {
|
|
|
66
66
|
/****************************************************************************/
|
|
67
67
|
//#region RENDER
|
|
68
68
|
render() {
|
|
69
|
-
return (index.h(index.Host, { key: '
|
|
70
|
-
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '
|
|
69
|
+
return (index.h(index.Host, { key: '39ad1374bbf8cd5393a99dc4c18fa28091dc5e90', class: clsxChV9xqsO.clsx(this.labelPlacement === 'before' && 'label-placement-before') }, index.h("div", { key: '3a8be2405404975398f1a0dae05c0855b913245f', class: "input-container" }, index.h("input", { key: 'b589b9faa5801f99e698d0e664e0a35779a1271f', type: "checkbox", id: this.inputId, name: this.name, autocomplete: "off", value: this.value, checked: Boolean(this.checked), disabled: this.disabled || this.readonly, readonly: this.readonly })), index.h("div", { key: 'a3308782b02b1c0eca3d6a1b87509674b9bc5c13', class: "text-container" }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: '854b2ffe7bf61423512154ffe8b3b0351a2950a4', htmlFor: this.inputId, class: clsxChV9xqsO.clsx(this.hideLabel && 'visually-hidden') }, index.h("slot", { key: '933bf88b7841f3b2ed24c3bb86fb24159eaac900', name: "label" }, this.label))), (this.description ||
|
|
70
|
+
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '5a04358d1be3b935239bb23e1466cc22ed2f3b48', class: "description" }, index.h("slot", { key: 'f5c1513eff6ee42bc171b0088baec634f8458197', name: "description" }, this.description))))));
|
|
71
71
|
}
|
|
72
72
|
static get formAssociated() { return true; }
|
|
73
73
|
get el() { return index.getElement(this); }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Kxp9mv-Q.js');
|
|
4
4
|
require('@stencil/react-output-target/runtime');
|
|
5
5
|
require('react');
|
|
6
6
|
require('react-dom');
|
|
@@ -57,7 +57,7 @@ const NvTogglebutton = class {
|
|
|
57
57
|
/****************************************************************************/
|
|
58
58
|
//#region RENDER
|
|
59
59
|
render() {
|
|
60
|
-
return (index.h(index.Host, { key: '
|
|
60
|
+
return (index.h(index.Host, { key: '8e700d38ba155b977d4efa0d9e01b41e73fc4413', role: "button", tabindex: "0", "aria-pressed": String(this.active), onClick: this.handleClick }, index.h("slot", { key: '92427015839f98b0d9238b8df6af8e08ee511153' })));
|
|
61
61
|
}
|
|
62
62
|
get el() { return index.getElement(this); }
|
|
63
63
|
};
|
package/dist/cjs/{nv-togglebuttongroup.entry-Bn_9DsdP.js → nv-togglebuttongroup.entry-L8gitSUS.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Kxp9mv-Q.js');
|
|
4
4
|
require('@stencil/react-output-target/runtime');
|
|
5
5
|
require('react');
|
|
6
6
|
require('react-dom');
|
|
@@ -156,7 +156,7 @@ const NvTogglebuttongroup = class {
|
|
|
156
156
|
/****************************************************************************/
|
|
157
157
|
//#region RENDER
|
|
158
158
|
render() {
|
|
159
|
-
return (index.h(index.Host, { key: '
|
|
159
|
+
return (index.h(index.Host, { key: '2026cb95db8b57f2a1cd4ea53608f336843b63fe' }, index.h("slot", { key: '5c06ab59d6c99e789c3a1c3a8a4842a0772ca3a2' })));
|
|
160
160
|
}
|
|
161
161
|
get el() { return index.getElement(this); }
|
|
162
162
|
static get watchers() { return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Kxp9mv-Q.js');
|
|
4
4
|
require('@stencil/react-output-target/runtime');
|
|
5
5
|
require('react');
|
|
6
6
|
require('react-dom');
|
|
@@ -39,15 +39,20 @@ const NvTooltip = class {
|
|
|
39
39
|
/****************************************************************************/
|
|
40
40
|
//#region LIFECYCLE
|
|
41
41
|
componentDidRender() {
|
|
42
|
-
if (
|
|
42
|
+
if (!this.popoverElement)
|
|
43
43
|
return;
|
|
44
|
-
|
|
44
|
+
const trigger = this.triggerElement ??
|
|
45
|
+
this.defaultSlot?.nextElementSibling ??
|
|
46
|
+
this.el.querySelector(':scope > :not(nv-popover):not(slot):not([slot])');
|
|
47
|
+
if (trigger && this.popoverElement.triggerElement !== trigger) {
|
|
48
|
+
this.popoverElement.triggerElement = trigger;
|
|
49
|
+
}
|
|
45
50
|
}
|
|
46
51
|
//#endregion LIFECYCLE
|
|
47
52
|
/****************************************************************************/
|
|
48
53
|
//#region RENDER
|
|
49
54
|
render() {
|
|
50
|
-
return (index.h(index.Host, { key: '
|
|
55
|
+
return (index.h(index.Host, { key: '8285fbb412cb45cc7baf2936f0405c0438395c8d' }, index.h("nv-popover", { key: '29d70e9baa826de35d2cdca88f48610d70ec55e4', ref: el => (this.popoverElement = el), triggerMode: "hover", hasArrow: true, placement: this.placement, strategy: this.strategy, groupName: 'tooltip', enterDelay: this.enterDelay, onOpenChanged: e => this.openChanged.emit(e.detail) }, index.h("p", { key: 'a9c907fa96f9c4108a8d84cec53981218c060811', slot: "content" }, this.message), index.h("slot", { key: 'af1b7ac8069071fe2d41e925f1c0090f8b6aaab5', name: "content" })), index.h("slot", { key: 'e5d3c6d16fb7e4a682b66e0016d9e4e30e5647e0', ref: el => (this.defaultSlot = el) })));
|
|
51
56
|
}
|
|
52
57
|
get el() { return index.getElement(this); }
|
|
53
58
|
};
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
import React, { useMemo, useState, useEffect, useRef, useCallback, } from 'react';
|
|
2
2
|
import { flexRender, getCoreRowModel, getPaginationRowModel, getSortedRowModel, getFilteredRowModel, useReactTable, } from '@tanstack/react-table';
|
|
3
|
-
import { NvTable, NvTableheader, NvPaginationtable, } from '../../generated/components';
|
|
3
|
+
import { NvTable, NvTableheader, NvPaginationtable, NvFieldcheckbox, } from '../../generated/components';
|
|
4
4
|
import { defineCustomElement as defineNvPaginationtable } from '@nova-design-system/nova-webcomponents/dist/components/nv-paginationtable.js';
|
|
5
5
|
if (typeof window !== 'undefined' &&
|
|
6
6
|
!customElements.get('nv-paginationtable')) {
|
|
7
7
|
defineNvPaginationtable();
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
import { applyRowSelection, applySelectAllSelection, shouldIgnoreSelectAllEvent, } from './selectionState';
|
|
10
|
+
function NvDatatable({ mode = 'client', columns, rows, pagination, sorting, filtering, selection, renderPagination, renderFiltering, stickyHeader, ...htmlProps }) {
|
|
11
|
+
const SELECTION_EVENT_SUPPRESSION_MS = 16;
|
|
12
|
+
const areSetsEqual = useCallback((a, b) => {
|
|
13
|
+
if (a.size !== b.size) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
for (const value of a) {
|
|
17
|
+
if (!b.has(value)) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
}, []);
|
|
10
23
|
const isInfiniteScroll = pagination?.infinite && mode === 'server';
|
|
11
24
|
const [paginationState, setPaginationState] = useState({
|
|
12
25
|
pageIndex: 0,
|
|
@@ -14,7 +27,14 @@ function NvDatatable({ mode = 'client', columns, rows, pagination, sorting, filt
|
|
|
14
27
|
});
|
|
15
28
|
const [sortingState, setSortingState] = useState(sorting?.sortState || []);
|
|
16
29
|
const [globalFilterState, setGlobalFilterState] = useState(filtering?.filterState);
|
|
30
|
+
const [selectedRowIdsState, setSelectedRowIdsState] = useState(() => new Set(selection?.selectedRowIds ?? []));
|
|
31
|
+
const selectedRowIdsRef = useRef(new Set(selection?.selectedRowIds ?? []));
|
|
32
|
+
const selectionMode = selection?.mode ?? 'none';
|
|
33
|
+
const selectionEnabled = selectionMode !== 'none';
|
|
34
|
+
const selectAllEnabled = selection?.enableSelectAll ?? true;
|
|
35
|
+
const getSelectionRowId = useCallback((row) => selection?.getRowId?.(row) ?? '', [selection]);
|
|
17
36
|
const lastRowRef = useRef(null);
|
|
37
|
+
const suppressRowSelectionEventsRef = useRef(false);
|
|
18
38
|
const debouncedSetFilter = useRef(null);
|
|
19
39
|
const setGlobalFilterDebounced = useCallback((value) => {
|
|
20
40
|
const debounceMs = filtering?.debounceMs ?? 300;
|
|
@@ -40,60 +60,89 @@ function NvDatatable({ mode = 'client', columns, rows, pagination, sorting, filt
|
|
|
40
60
|
setGlobalFilterState(filtering.filterState);
|
|
41
61
|
}
|
|
42
62
|
}, [filtering?.filterState]);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
value: rawValue,
|
|
54
|
-
row,
|
|
55
|
-
field: col.field,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
: undefined,
|
|
59
|
-
header: col.renderHeader
|
|
60
|
-
? () => col.renderHeader({
|
|
61
|
-
headerName,
|
|
62
|
-
field: col.field,
|
|
63
|
-
})
|
|
64
|
-
: headerName,
|
|
65
|
-
size: col.width,
|
|
66
|
-
enableResizing: col.resizable ?? true,
|
|
67
|
-
enableSorting: sorting ? col.sortable ?? true : false,
|
|
68
|
-
cell: (context) => {
|
|
69
|
-
const value = context.getValue();
|
|
70
|
-
const row = context.row.original;
|
|
71
|
-
const rowIndex = context.row.index;
|
|
72
|
-
if (col.renderCell) {
|
|
73
|
-
return col.renderCell({
|
|
74
|
-
value,
|
|
75
|
-
row,
|
|
76
|
-
field: col.field,
|
|
77
|
-
rowIndex,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
return value;
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
if (col.sortingFn !== undefined) {
|
|
84
|
-
columnDef.sortingFn = col.sortingFn;
|
|
85
|
-
}
|
|
86
|
-
if (col.sortDescFirst !== undefined) {
|
|
87
|
-
columnDef.sortDescFirst = col.sortDescFirst;
|
|
88
|
-
}
|
|
89
|
-
if (col.invertSorting !== undefined) {
|
|
90
|
-
columnDef.invertSorting = col.invertSorting;
|
|
63
|
+
if (selectionEnabled && !selection?.getRowId) {
|
|
64
|
+
throw new Error('NvDatatable selection requires selection.getRowId when selection.mode is not "none".');
|
|
65
|
+
}
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (selection?.selectedRowIds) {
|
|
68
|
+
const controlledIds = new Set(selection.selectedRowIds);
|
|
69
|
+
if (!areSetsEqual(selectedRowIdsState, controlledIds)) {
|
|
70
|
+
selectedRowIdsRef.current = controlledIds;
|
|
71
|
+
setSelectedRowIdsState(controlledIds);
|
|
72
|
+
}
|
|
91
73
|
}
|
|
92
|
-
|
|
93
|
-
|
|
74
|
+
}, [selection?.selectedRowIds, selectedRowIdsState, areSetsEqual]);
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
selectedRowIdsRef.current = selectedRowIdsState;
|
|
77
|
+
}, [selectedRowIdsState]);
|
|
78
|
+
const tableColumns = useMemo(() => {
|
|
79
|
+
const dataColumns = columns
|
|
80
|
+
.filter((col) => !col.hidden)
|
|
81
|
+
.map((col) => {
|
|
82
|
+
const headerName = col.headerName || String(col.field);
|
|
83
|
+
const columnDef = {
|
|
84
|
+
accessorKey: col.field,
|
|
85
|
+
accessorFn: col.valueFormatter
|
|
86
|
+
? (row) => {
|
|
87
|
+
const rawValue = row[col.field];
|
|
88
|
+
return col.valueFormatter({
|
|
89
|
+
value: rawValue,
|
|
90
|
+
row,
|
|
91
|
+
field: col.field,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
: undefined,
|
|
95
|
+
header: col.renderHeader
|
|
96
|
+
? () => col.renderHeader({
|
|
97
|
+
headerName,
|
|
98
|
+
field: col.field,
|
|
99
|
+
})
|
|
100
|
+
: headerName,
|
|
101
|
+
size: col.width,
|
|
102
|
+
enableResizing: col.resizable ?? true,
|
|
103
|
+
enableSorting: sorting ? col.sortable ?? true : false,
|
|
104
|
+
cell: (context) => {
|
|
105
|
+
const value = context.getValue();
|
|
106
|
+
const row = context.row.original;
|
|
107
|
+
const rowIndex = context.row.index;
|
|
108
|
+
if (col.renderCell) {
|
|
109
|
+
return col.renderCell({
|
|
110
|
+
value,
|
|
111
|
+
row,
|
|
112
|
+
field: col.field,
|
|
113
|
+
rowIndex,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return value;
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
if (col.sortingFn !== undefined) {
|
|
120
|
+
columnDef.sortingFn = col.sortingFn;
|
|
121
|
+
}
|
|
122
|
+
if (col.sortDescFirst !== undefined) {
|
|
123
|
+
columnDef.sortDescFirst = col.sortDescFirst;
|
|
124
|
+
}
|
|
125
|
+
if (col.invertSorting !== undefined) {
|
|
126
|
+
columnDef.invertSorting = col.invertSorting;
|
|
127
|
+
}
|
|
128
|
+
if (col.sortUndefined !== undefined) {
|
|
129
|
+
columnDef.sortUndefined = col.sortUndefined;
|
|
130
|
+
}
|
|
131
|
+
return columnDef;
|
|
132
|
+
});
|
|
133
|
+
if (!selectionEnabled) {
|
|
134
|
+
return dataColumns;
|
|
94
135
|
}
|
|
95
|
-
|
|
96
|
-
|
|
136
|
+
const selectionColumn = {
|
|
137
|
+
id: '__selection__',
|
|
138
|
+
header: '',
|
|
139
|
+
size: selection?.checkboxColumnWidth ?? 48,
|
|
140
|
+
enableResizing: false,
|
|
141
|
+
enableSorting: false,
|
|
142
|
+
cell: () => null,
|
|
143
|
+
};
|
|
144
|
+
return [selectionColumn, ...dataColumns];
|
|
145
|
+
}, [columns, sorting, selectionEnabled, selection?.checkboxColumnWidth]);
|
|
97
146
|
const tableConfig = useMemo(() => {
|
|
98
147
|
const baseConfig = {
|
|
99
148
|
data: rows,
|
|
@@ -187,6 +236,169 @@ function NvDatatable({ mode = 'client', columns, rows, pagination, sorting, filt
|
|
|
187
236
|
mode,
|
|
188
237
|
]);
|
|
189
238
|
const table = useReactTable(tableConfig);
|
|
239
|
+
const tableRows = table.getRowModel().rows;
|
|
240
|
+
const setSelectionState = useCallback((nextSelectedIds) => {
|
|
241
|
+
const current = new Set(selection?.selectedRowIds ?? selectedRowIdsRef.current);
|
|
242
|
+
const nextRaw = typeof nextSelectedIds === 'function'
|
|
243
|
+
? nextSelectedIds(new Set(current))
|
|
244
|
+
: nextSelectedIds;
|
|
245
|
+
const next = new Set(nextRaw);
|
|
246
|
+
if (areSetsEqual(current, next)) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
selectedRowIdsRef.current = next;
|
|
250
|
+
setSelectedRowIdsState(next);
|
|
251
|
+
selection?.onSelectionChange?.(new Set(next));
|
|
252
|
+
}, [selection, selection?.selectedRowIds, areSetsEqual]);
|
|
253
|
+
const resolveCheckedChange = useCallback((event) => {
|
|
254
|
+
if (event && typeof event === 'object') {
|
|
255
|
+
const eventLike = event;
|
|
256
|
+
const target = eventLike.target;
|
|
257
|
+
const currentTarget = eventLike.currentTarget;
|
|
258
|
+
if (typeof eventLike.detail === 'boolean') {
|
|
259
|
+
return eventLike.detail;
|
|
260
|
+
}
|
|
261
|
+
if (typeof target?.checked === 'boolean') {
|
|
262
|
+
return target.checked;
|
|
263
|
+
}
|
|
264
|
+
if (typeof currentTarget?.checked === 'boolean') {
|
|
265
|
+
return currentTarget.checked;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return undefined;
|
|
269
|
+
}, []);
|
|
270
|
+
const isRowSelected = useCallback((row) => {
|
|
271
|
+
if (!selectionEnabled) {
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
274
|
+
const rowId = getSelectionRowId(row);
|
|
275
|
+
return !!rowId && selectedRowIdsState.has(rowId);
|
|
276
|
+
}, [selectionEnabled, getSelectionRowId, selectedRowIdsState]);
|
|
277
|
+
const visibleRowIds = useMemo(() => tableRows
|
|
278
|
+
.map((row) => getSelectionRowId(row.original))
|
|
279
|
+
.filter((id) => !!id), [tableRows, getSelectionRowId]);
|
|
280
|
+
const visibleRowIdsSet = useMemo(() => new Set(visibleRowIds), [visibleRowIds]);
|
|
281
|
+
const setRowSelection = useCallback((row, isChecked) => {
|
|
282
|
+
if (!selectionEnabled) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
if (suppressRowSelectionEventsRef.current) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
const rowId = getSelectionRowId(row);
|
|
289
|
+
if (!rowId) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (!visibleRowIdsSet.has(rowId)) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
suppressRowSelectionEventsRef.current = true;
|
|
296
|
+
setSelectionState((current) => {
|
|
297
|
+
return applyRowSelection({
|
|
298
|
+
currentSelectedIds: current,
|
|
299
|
+
rowId,
|
|
300
|
+
isChecked,
|
|
301
|
+
selectionMode,
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
setTimeout(() => {
|
|
305
|
+
suppressRowSelectionEventsRef.current = false;
|
|
306
|
+
}, SELECTION_EVENT_SUPPRESSION_MS);
|
|
307
|
+
}, [
|
|
308
|
+
selectionEnabled,
|
|
309
|
+
getSelectionRowId,
|
|
310
|
+
visibleRowIdsSet,
|
|
311
|
+
selectionMode,
|
|
312
|
+
setSelectionState,
|
|
313
|
+
]);
|
|
314
|
+
const selectAllState = useMemo(() => {
|
|
315
|
+
if (!selectionEnabled ||
|
|
316
|
+
selectionMode !== 'multiple' ||
|
|
317
|
+
!selectAllEnabled ||
|
|
318
|
+
!visibleRowIds.length) {
|
|
319
|
+
return 'unchecked';
|
|
320
|
+
}
|
|
321
|
+
const selectedCount = visibleRowIds.filter((id) => selectedRowIdsState.has(id)).length;
|
|
322
|
+
if (selectedCount === 0) {
|
|
323
|
+
return 'unchecked';
|
|
324
|
+
}
|
|
325
|
+
if (selectedCount === visibleRowIds.length) {
|
|
326
|
+
return 'checked';
|
|
327
|
+
}
|
|
328
|
+
return 'indeterminate';
|
|
329
|
+
}, [
|
|
330
|
+
selectionEnabled,
|
|
331
|
+
selectionMode,
|
|
332
|
+
selectAllEnabled,
|
|
333
|
+
visibleRowIds,
|
|
334
|
+
selectedRowIdsState,
|
|
335
|
+
]);
|
|
336
|
+
const handleSelectAllChanged = useCallback((isChecked) => {
|
|
337
|
+
if (!selectionEnabled ||
|
|
338
|
+
selectionMode !== 'multiple' ||
|
|
339
|
+
!selectAllEnabled ||
|
|
340
|
+
!visibleRowIds.length) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
if (shouldIgnoreSelectAllEvent({ isChecked, selectAllState })) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
suppressRowSelectionEventsRef.current = true;
|
|
347
|
+
setSelectionState((current) => {
|
|
348
|
+
return applySelectAllSelection({
|
|
349
|
+
currentSelectedIds: current,
|
|
350
|
+
visibleRowIds,
|
|
351
|
+
isChecked,
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
setTimeout(() => {
|
|
355
|
+
suppressRowSelectionEventsRef.current = false;
|
|
356
|
+
}, SELECTION_EVENT_SUPPRESSION_MS);
|
|
357
|
+
}, [
|
|
358
|
+
selectionEnabled,
|
|
359
|
+
selectionMode,
|
|
360
|
+
selectAllEnabled,
|
|
361
|
+
visibleRowIds,
|
|
362
|
+
selectAllState,
|
|
363
|
+
setSelectionState,
|
|
364
|
+
]);
|
|
365
|
+
useEffect(() => {
|
|
366
|
+
if (!selectionEnabled || selection?.deselectOnFilter === false) {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
if (mode !== 'client' || !filtering) {
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
const filterVisibleRows = table
|
|
373
|
+
.getFilteredRowModel()
|
|
374
|
+
.rows.map((row) => row.original);
|
|
375
|
+
const visibleIds = new Set(filterVisibleRows
|
|
376
|
+
.map((row) => getSelectionRowId(row))
|
|
377
|
+
.filter((id) => !!id));
|
|
378
|
+
const currentSelection = selection?.selectedRowIds ?? selectedRowIdsState;
|
|
379
|
+
const next = new Set();
|
|
380
|
+
currentSelection.forEach((id) => {
|
|
381
|
+
if (visibleIds.has(id)) {
|
|
382
|
+
next.add(id);
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
if (!areSetsEqual(currentSelection, next)) {
|
|
386
|
+
setSelectedRowIdsState(next);
|
|
387
|
+
selection?.onSelectionChange?.(new Set(next));
|
|
388
|
+
}
|
|
389
|
+
}, [
|
|
390
|
+
areSetsEqual,
|
|
391
|
+
selectionEnabled,
|
|
392
|
+
selection?.deselectOnFilter,
|
|
393
|
+
selection?.onSelectionChange,
|
|
394
|
+
selection?.selectedRowIds,
|
|
395
|
+
mode,
|
|
396
|
+
filtering,
|
|
397
|
+
globalFilterState,
|
|
398
|
+
table,
|
|
399
|
+
selectedRowIdsState,
|
|
400
|
+
getSelectionRowId,
|
|
401
|
+
]);
|
|
190
402
|
useEffect(() => {
|
|
191
403
|
if (mode === 'server' &&
|
|
192
404
|
!pagination?.infinite &&
|
|
@@ -253,7 +465,6 @@ function NvDatatable({ mode = 'client', columns, rows, pagination, sorting, filt
|
|
|
253
465
|
mode,
|
|
254
466
|
isInfiniteScroll,
|
|
255
467
|
]);
|
|
256
|
-
const tableRows = table.getRowModel().rows;
|
|
257
468
|
const renderDefaultPagination = (api) => {
|
|
258
469
|
const labelProps = {};
|
|
259
470
|
if (pagination?.labels?.page)
|
|
@@ -289,20 +500,39 @@ function NvDatatable({ mode = 'client', columns, rows, pagination, sorting, filt
|
|
|
289
500
|
React.createElement(NvTable, { ...htmlProps },
|
|
290
501
|
React.createElement("table", null,
|
|
291
502
|
React.createElement("thead", { "data-sticky-top": stickyHeader ? 'true' : undefined }, table.getHeaderGroups().map((headerGroup) => (React.createElement("tr", { key: headerGroup.id }, headerGroup.headers.map((header) => {
|
|
503
|
+
const isSelectionHeader = header.id === '__selection__';
|
|
292
504
|
const canSort = header.column.getCanSort();
|
|
293
505
|
const sortDirection = header.column.getIsSorted();
|
|
294
|
-
return (React.createElement("th", { key: header.id, "data-testid":
|
|
506
|
+
return (React.createElement("th", { key: header.id, "data-testid": isSelectionHeader
|
|
507
|
+
? 'datatable-header-selection'
|
|
508
|
+
: `datatable-header-${header.id}`, style: {
|
|
295
509
|
width: header.column.columnDef.size + 'px',
|
|
296
|
-
}, "data-no-resize":
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
510
|
+
}, "data-no-resize": isSelectionHeader
|
|
511
|
+
? true
|
|
512
|
+
: header.column.columnDef.enableResizing
|
|
513
|
+
? null
|
|
514
|
+
: true }, isSelectionHeader ? (selectionMode === 'multiple' && selectAllEnabled ? (React.createElement("div", { className: "flex items-center justify-center" },
|
|
515
|
+
React.createElement(NvFieldcheckbox, { "data-testid": "datatable-select-all-checkbox", checked: selectAllState === 'checked', indeterminate: selectAllState === 'indeterminate', label: "Select all rows", hideLabel: true, onCheckedChanged: (event) => {
|
|
516
|
+
const checked = resolveCheckedChange(event);
|
|
517
|
+
if (typeof checked === 'boolean') {
|
|
518
|
+
handleSelectAllChanged(checked);
|
|
519
|
+
}
|
|
520
|
+
} }))) : null) : (React.createElement(NvTableheader, { sortable: canSort ? true : undefined, sortDirection: sortDirection || (canSort ? 'none' : undefined), onSortDirectionChanged: canSort
|
|
521
|
+
? header.column.getToggleSortingHandler()
|
|
522
|
+
: undefined }, header.isPlaceholder
|
|
523
|
+
? null
|
|
524
|
+
: flexRender(header.column.columnDef.header, header.getContext())))));
|
|
302
525
|
}))))),
|
|
303
526
|
React.createElement("tbody", null, tableRows.map((row, index) => {
|
|
304
527
|
const isLastRow = isInfiniteScroll && index === tableRows.length - 1;
|
|
305
|
-
return (React.createElement("tr", { key: row.id, "data-testid": `datatable-row-${index}`, ref: isLastRow ? lastRowRef : undefined }, row.getVisibleCells().map((cell) => (React.createElement("td", { key: cell.id, "data-testid":
|
|
528
|
+
return (React.createElement("tr", { key: row.id, "data-testid": `datatable-row-${index}`, ref: isLastRow ? lastRowRef : undefined }, row.getVisibleCells().map((cell) => (React.createElement("td", { key: cell.id, "data-testid": cell.column.id === '__selection__'
|
|
529
|
+
? 'datatable-cell-selection'
|
|
530
|
+
: `datatable-cell-${cell.column.id}` }, cell.column.id === '__selection__' ? (React.createElement(NvFieldcheckbox, { "data-testid": `datatable-row-${index}-checkbox`, checked: isRowSelected(row.original), label: `Select row ${index + 1}`, hideLabel: true, onCheckedChanged: (event) => {
|
|
531
|
+
const checked = resolveCheckedChange(event);
|
|
532
|
+
if (typeof checked === 'boolean') {
|
|
533
|
+
setRowSelection(row.original, checked);
|
|
534
|
+
}
|
|
535
|
+
} })) : (flexRender(cell.column.columnDef.cell, cell.getContext())))))));
|
|
306
536
|
})))),
|
|
307
537
|
paginationAPI &&
|
|
308
538
|
(renderPagination
|