@nova-design-system/nova-react 3.22.0 → 3.24.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/_commonjsHelpers-B85MJLTf-CFO10eej.js +7 -0
- package/dist/cjs/{collapse.animation-6e0b08df-AHWzNGm_.js → collapse.animation-DZDm0vSK-C2TOIhIK.js} +3 -3
- package/dist/cjs/events.utils-B6GgGra--01N__3wY.js +23 -0
- package/dist/cjs/{fade.animation-9b939939-DV--bM4S.js → fade.animation-DcRL9lcm-DAZeHoKN.js} +75 -75
- package/dist/cjs/generated/components.server.js +292 -50
- package/dist/cjs/{grow.animation-24ad5cf8-LUp_ITEx.js → grow.animation-D7ep_aVl-BuXEDSK-.js} +5 -26
- package/dist/cjs/i18n.utils-IlwlcG9l-ku0bScip.js +2494 -0
- package/dist/cjs/{index-WPRkQD3O.js → index-kU2nW5aN.js} +12692 -7009
- package/dist/cjs/{nv-dialog.entry-CDSK9pUH.js → index.esm-D3eWMME9-CG1TVKfu.js} +1 -296
- package/dist/cjs/index.js +15 -1
- package/dist/cjs/inputmask-CSo292ul-DlvupPk6.js +3758 -0
- package/dist/cjs/{nv-accordion-item.entry-BuTvA6w9.js → nv-accordion-item.entry-Bu1tAcCq.js} +11 -10
- package/dist/cjs/{nv-accordion.entry-Dtsfw6He.js → nv-accordion.entry-jWjLdX8w.js} +9 -11
- package/dist/cjs/{nv-alert.entry-TIdfdU7Y.js → nv-alert.entry-E9ZJay_K.js} +22 -23
- package/dist/cjs/{nv-avatar.entry-CaxrhPuw.js → nv-avatar.entry-CUX7u0kR.js} +11 -11
- package/dist/cjs/{nv-badge_2.entry-CfYvTZxX.js → nv-badge_2.entry-bxpV5gxE.js} +24 -24
- package/dist/cjs/{nv-breadcrumb.entry-BCZ4MmfD.js → nv-breadcrumb.entry-Cbbb9Qeh.js} +5 -5
- package/dist/cjs/{nv-breadcrumbs.entry-DwzCE7F6.js → nv-breadcrumbs.entry-BTqnp9zO.js} +3 -3
- package/dist/cjs/{nv-button.entry-Cr_86bcZ.js → nv-button.entry-upWH19y6.js} +12 -14
- package/dist/cjs/{nv-buttongroup.entry-CWjRoHY1.js → nv-buttongroup.entry-CuZCRsnV.js} +3 -3
- package/dist/cjs/{nv-calendar.entry-CXfwNt6G.js → nv-calendar.entry-CT3mASW6.js} +113 -97
- package/dist/cjs/{nv-col.entry-CJLDS3LY.js → nv-col.entry--pCxkaTh.js} +5 -5
- package/dist/cjs/{nv-datagrid.entry-Cns8XSud.js → nv-datagrid.entry-CGCEhO8C.js} +80 -85
- package/dist/cjs/{nv-datagridcolumn.entry-CFFAipHF.js → nv-datagridcolumn.entry-Fsqc7CT_.js} +2 -1
- package/dist/cjs/nv-dialog.entry-B6OYcZxQ.js +300 -0
- package/dist/cjs/{nv-dialogfooter_2.entry-To_dGUn4.js → nv-dialogfooter_2.entry-C4fP_n2-.js} +10 -11
- package/dist/cjs/nv-drawer.entry-C5O4KvHU.js +445 -0
- package/dist/cjs/nv-drawerfooter_2.entry-C-reYJXG.js +146 -0
- package/dist/cjs/nv-fieldcheckbox.entry-bk7UNQny.js +177 -0
- package/dist/cjs/{nv-fielddate.entry-C3pXtMHL.js → nv-fielddate.entry-dqZDBVmm.js} +89 -46
- package/dist/cjs/{nv-fielddaterange.entry-CjVVPEK_.js → nv-fielddaterange.entry-wNRasXky.js} +151 -103
- package/dist/cjs/nv-fielddropdown.entry-BA15piWa.js +678 -0
- package/dist/cjs/{nv-fielddropdownitem.entry-Dah-PaE8.js → nv-fielddropdownitem.entry-DEWaf9dC.js} +7 -7
- package/dist/cjs/{nv-fieldmultiselect.entry-BMLjhqoJ.js → nv-fieldmultiselect.entry-BWY5xOAd.js} +343 -236
- package/dist/cjs/nv-fieldnumber.entry-DoYORd0d.js +187 -0
- package/dist/cjs/nv-fieldpassword.entry-CPaLj9aD.js +165 -0
- package/dist/cjs/{nv-fieldradio.entry-X_2VT1Dj.js → nv-fieldradio.entry-CvUmEaCa.js} +11 -11
- package/dist/cjs/{nv-fieldselect.entry-pSp-2rNn.js → nv-fieldselect.entry-uUIZ6hmN.js} +52 -13
- package/dist/cjs/{nv-fieldslider.entry-pZf7zzLU.js → nv-fieldslider.entry-DnvmxxYY.js} +16 -31
- package/dist/cjs/nv-fieldtext.entry-BYAJp3n_.js +163 -0
- package/dist/cjs/{nv-fieldtextarea.entry-t3Ixxi23.js → nv-fieldtextarea.entry-DU2bWYeg.js} +52 -14
- package/dist/cjs/{nv-fieldtime.entry-DY7D5_6K.js → nv-fieldtime.entry-DlMNDTht.js} +128 -84
- package/dist/cjs/{nv-icon.entry-6oYPSf4c.js → nv-icon.entry-CnUkRzaA.js} +12 -12
- package/dist/cjs/{nv-iconbutton_2.entry-ChULGovr.js → nv-iconbutton_2.entry-hqp4AcRq.js} +10 -12
- package/dist/cjs/{nv-menu.entry-sd0tatWq.js → nv-menu.entry-Dc_FvIx7.js} +18 -32
- package/dist/cjs/{nv-menuitem.entry-CCOqR7UF.js → nv-menuitem.entry-DzMhx6c_.js} +6 -5
- package/dist/cjs/nv-notification-bullet.entry-BwhHCMQF.js +76 -0
- package/dist/cjs/{nv-notification.entry-Cc3zE3yY.js → nv-notification.entry-C3m5p5BL.js} +42 -128
- package/dist/cjs/{nv-notificationcontainer.entry-DV4D6oOH.js → nv-notificationcontainer.entry-DTRNn7VE.js} +4 -4
- package/dist/cjs/{nv-popover.entry-DQSwI2jT.js → nv-popover.entry-B0c-2rO4.js} +51 -47
- package/dist/cjs/{nv-row.entry-UUuMSAY5.js → nv-row.entry-CdcjVGZv.js} +4 -4
- package/dist/cjs/nv-sidebar.entry-CiN813gQ.js +177 -0
- package/dist/cjs/nv-sidebarcontent.entry-D9hpAhK8.js +22 -0
- package/dist/cjs/nv-sidebardivider.entry-B4EMyca5.js +22 -0
- package/dist/cjs/nv-sidebarfooter.entry-CHi4qOFe.js +22 -0
- package/dist/cjs/nv-sidebargroup.entry-RVqrsyIU.js +23 -0
- package/dist/cjs/nv-sidebarheader.entry-_7ch0O3G.js +22 -0
- package/dist/cjs/nv-sidebarlogo.entry-Ch9F-JnT.js +32 -0
- package/dist/cjs/nv-sidebarnavitem.entry-DVrafSMr.js +296 -0
- package/dist/cjs/nv-sidebarnavsubitem.entry-C0XDAzma.js +35 -0
- package/dist/cjs/{nv-split.entry-CYP2bTTM.js → nv-split.entry-0HTslRAX.js} +47 -45
- package/dist/cjs/{nv-stack.entry-D35-75Vw.js → nv-stack.entry-CqO7uTQf.js} +5 -5
- package/dist/cjs/{nv-table.entry-DevWJBnL.js → nv-table.entry-DH85n8Mc.js} +9 -11
- package/dist/cjs/{nv-tableheader.entry-Hs7nUSOC.js → nv-tableheader.entry-CKfocdxD.js} +7 -7
- package/dist/cjs/{nv-toggle.entry-Eje9d--6.js → nv-toggle.entry-BHUl76Im.js} +9 -9
- package/dist/cjs/nv-togglebutton.entry-D_9COjY-.js +67 -0
- package/dist/cjs/{nv-togglebuttongroup.entry-CWN_Ucry.js → nv-togglebuttongroup.entry-C0NLbsq7.js} +10 -8
- package/dist/cjs/{nv-tooltip.entry-BGkKDEFg.js → nv-tooltip.entry-BfViGE_U.js} +5 -5
- package/dist/cjs/slide.animation-CmH5d1of-BZuw607U.js +90 -0
- package/dist/cjs/{style-value-types.es-f5d10b79-D0QCM8OB.js → style-value-types.es-xlgmw4x8-B1vLqX9m.js} +6 -3
- package/dist/cjs/{v4-a79185f4-2n0dOd_Y.js → v4-BdYh22OP-C1vaJ4yP.js} +1 -1
- package/dist/components/NvDatatable/NvDatatable.js +40 -24
- package/dist/generated/components.js +107 -0
- package/dist/generated/components.server.js +260 -50
- package/dist/providers/NotificationProvider.js +3 -4
- package/dist/types/components/NvDatatable/NvDatatable.d.ts +1 -1
- package/dist/types/components/NvDatatable/types.d.ts +8 -3
- package/dist/types/generated/components.d.ts +46 -0
- package/dist/types/generated/components.server.d.ts +46 -0
- package/package.json +2 -2
- package/dist/cjs/_commonjsHelpers-1789f0cf-BJu3ubxk.js +0 -10
- package/dist/cjs/inputmask-edcad3c1-B9Omti4z.js +0 -3749
- package/dist/cjs/nv-fieldcheckbox.entry-fdonR07Z.js +0 -138
- package/dist/cjs/nv-fielddropdown.entry-C9mXuNNj.js +0 -392
- package/dist/cjs/nv-fieldnumber.entry-DBdJviXu.js +0 -148
- package/dist/cjs/nv-fieldpassword.entry-Cim_usSM.js +0 -122
- package/dist/cjs/nv-fieldtext.entry-DlI_ExaV.js +0 -124
- package/dist/cjs/nv-togglebutton.entry-LGI7pIeK.js +0 -56
- /package/dist/cjs/{clsx-297c1ffe-BtxeOLZW.js → clsx-ChV9xqsO-BtxeOLZW.js} +0 -0
- /package/dist/cjs/{constants-69bafca2-DpB_ghPF.js → constants-BReL3Lsa-DpB_ghPF.js} +0 -0
- /package/dist/cjs/{timeline.animation-79215cd4-KteJaZPb.js → timeline.animation-CgHCo_Ho-KteJaZPb.js} +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var
|
|
3
|
+
var index = require('./index-kU2nW5aN.js');
|
|
4
|
+
var constantsBReL3Lsa = require('./constants-BReL3Lsa-DpB_ghPF.js');
|
|
5
|
+
require('@stencil/react-output-target/runtime');
|
|
5
6
|
require('react');
|
|
6
7
|
require('react-dom');
|
|
7
8
|
|
|
@@ -154,7 +155,7 @@ function getMemoOptions(tableOptions, debugLevel, key, onChange) {
|
|
|
154
155
|
var _tableOptions$debugAl;
|
|
155
156
|
return (_tableOptions$debugAl = tableOptions == null ? void 0 : tableOptions.debugAll) != null ? _tableOptions$debugAl : tableOptions[debugLevel];
|
|
156
157
|
},
|
|
157
|
-
key: "production" === 'development'
|
|
158
|
+
key: "production" === 'development',
|
|
158
159
|
onChange
|
|
159
160
|
};
|
|
160
161
|
}
|
|
@@ -3478,14 +3479,13 @@ function debounce(func, wait) {
|
|
|
3478
3479
|
}
|
|
3479
3480
|
|
|
3480
3481
|
const nvDatagridCss = "nv-datagrid{--nv-datagrid-border-default:var(\n --components-form-field-border-default\n );--nv-datagrid-border-hover:var(--components-form-field-border-hover);--nv-datagrid-border-focus:var(--components-form-field-border-default);--nv-datagrid-background-default:var(\n --components-form-field-background-default\n );--nv-datagrid-background-checked:var(\n --components-form-field-background-checked\n );--nv-datagrid-background-disabled:var(\n --components-form-field-background-disabled\n );--nv-datagrid-color-checked:var(\n --components-form-shape-foreground-default\n );--nv-datagrid-color-disabled:var(\n --components-form-shape-foreground-disabled\n );--nv-datagrid-outline-color:var(--color-focus-brand);display:block}nv-datagrid .hidden{display:none}nv-datagrid table{border-collapse:collapse;border-color:inherit;text-indent:0;width:100%}nv-datagrid th{text-align:left;border-bottom:1px solid var(--components-datagrid-header-border);min-height:var(--spacing-12);padding:var(--datagrid-cell-header-padding-y) var(--datagrid-cell-header-padding-x);font-size:var(--font-size-md);font-weight:var(--font-weight-high-emphasis);color:var(--components-datagrid-header-text)}nv-datagrid td{border-bottom:1px solid var(--components-datagrid-body-border);min-height:var(--spacing-12);max-height:var(--spacing-14);padding:var(--datagrid-cell-body-padding-y) var(--datagrid-cell-body-padding-x);font-size:var(--font-size-md);font-weight:var(--font-weight-low-emphasis);color:var(--components-datagrid-body-text);white-space:nowrap;text-overflow:ellipsis}nv-datagrid tbody>tr:hover{background:var(--color-interaction-container-neutral-background-hover)}nv-datagrid .cursor-pointer{cursor:pointer}nv-datagrid .select-none{-webkit-user-select:none;user-select:none}nv-datagrid .search-container{display:flex}nv-datagrid .checkbox-container{position:relative;color:var(--nv-datagrid-color-checked)}nv-datagrid .checkbox-container input[type=checkbox][readonly]{opacity:0.5}nv-datagrid .checkbox-container:has(input[type=checkbox]:disabled:not([readonly])){color:var(--nv-datagrid-color-disabled)}nv-datagrid .checkbox-container input[type=checkbox]{appearance:none;position:relative;display:flex;width:var(--form-checkbox-size);height:var(--form-checkbox-size);flex-direction:column;align-items:flex-start;border-radius:var(--form-checkbox-radius);border-width:var(--form-checkbox-border-width);border-style:solid;border-color:var(--nv-datagrid-border-default);background:var(--nv-datagrid-background-default)}nv-datagrid .checkbox-container input[type=checkbox]:hover{border-color:var(--nv-datagrid-border-hover)}nv-datagrid .checkbox-container input[type=checkbox]:focus{border-color:var(--nv-datagrid-border-focus)}nv-datagrid .checkbox-container input[type=checkbox]:focus,nv-datagrid .checkbox-container input[type=checkbox]:focus-within{outline:none}nv-datagrid .checkbox-container input[type=checkbox]:focus-visible,nv-datagrid .checkbox-container input[type=checkbox]:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 1) solid var(--nv-datagrid-outline-color);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-datagrid .checkbox-container input[type=checkbox]:checked,nv-datagrid .checkbox-container input[type=checkbox]:indeterminate{background:var(--nv-datagrid-background-checked);border-color:var(--nv-datagrid-background-checked)}nv-datagrid .checkbox-container input[type=checkbox]:disabled:not([readonly]){background:var(--nv-datagrid-background-disabled);border-color:var(--nv-datagrid-border-default)}nv-datagrid .checkbox-container input[type=checkbox][readonly]{opacity:0.5}nv-datagrid .checkbox-container .icon{pointer-events:none;position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center}nv-datagrid .checkbox-container .icon svg{width:var(--form-checkbox-icon-size);height:var(--form-checkbox-icon-size);fill:none;stroke:currentcolor;stroke-width:var(--form-checkbox-icon-stroke);flex-shrink:0}";
|
|
3481
|
-
const NvDatagridStyle0 = nvDatagridCss;
|
|
3482
3482
|
|
|
3483
3483
|
const NvDatagrid = class {
|
|
3484
3484
|
constructor(hostRef) {
|
|
3485
3485
|
index.registerInstance(this, hostRef);
|
|
3486
|
-
this.action = index.createEvent(this, "action");
|
|
3487
|
-
this.selectedRows = index.createEvent(this, "selectedRows");
|
|
3488
|
-
this.stateChanged = index.createEvent(this, "stateChanged");
|
|
3486
|
+
this.action = index.createEvent(this, "action", 3);
|
|
3487
|
+
this.selectedRows = index.createEvent(this, "selectedRows", 3);
|
|
3488
|
+
this.stateChanged = index.createEvent(this, "stateChanged", 3);
|
|
3489
3489
|
this.templateCache = new Map();
|
|
3490
3490
|
this.headerTemplateCache = new Map();
|
|
3491
3491
|
this.minPageIndex = 1;
|
|
@@ -3582,8 +3582,7 @@ const NvDatagrid = class {
|
|
|
3582
3582
|
*/
|
|
3583
3583
|
this.state = null;
|
|
3584
3584
|
this.debouncedFilter = debounce((value) => {
|
|
3585
|
-
|
|
3586
|
-
(_a = this.table) === null || _a === void 0 ? void 0 : _a.setGlobalFilter(value);
|
|
3585
|
+
this.table?.setGlobalFilter(value);
|
|
3587
3586
|
}, 300);
|
|
3588
3587
|
/**
|
|
3589
3588
|
* Handles global filtering on input event for the search input.
|
|
@@ -3609,7 +3608,7 @@ const NvDatagrid = class {
|
|
|
3609
3608
|
const target = event.target;
|
|
3610
3609
|
const page = target.value ? Number(target.value) - 1 : 0;
|
|
3611
3610
|
// Simply use `setPageIndex` to update the page index directly
|
|
3612
|
-
this.paginationState =
|
|
3611
|
+
this.paginationState = { ...this.paginationState, pageIndex: page }; // This triggers the paginationState watcher
|
|
3613
3612
|
};
|
|
3614
3613
|
this.handlePageSizeChange = (event) => {
|
|
3615
3614
|
const target = event.target;
|
|
@@ -3618,23 +3617,25 @@ const NvDatagrid = class {
|
|
|
3618
3617
|
effectivePageSize = this.pageSizes[0];
|
|
3619
3618
|
}
|
|
3620
3619
|
// Simply use `setPageSize` to update the page size directly
|
|
3621
|
-
this.paginationState =
|
|
3620
|
+
this.paginationState = {
|
|
3621
|
+
...this.paginationState,
|
|
3622
|
+
pageSize: effectivePageSize,
|
|
3623
|
+
}; // This triggers the paginationState watcher
|
|
3622
3624
|
};
|
|
3623
3625
|
this.handleSortingClick = (event, header) => {
|
|
3624
|
-
var _a;
|
|
3625
3626
|
if (!header.column.getCanSort()) {
|
|
3626
3627
|
return;
|
|
3627
3628
|
}
|
|
3628
|
-
|
|
3629
|
+
header.column.getToggleSortingHandler()?.(event);
|
|
3629
3630
|
};
|
|
3630
3631
|
this.getSortTitle = (header) => {
|
|
3631
3632
|
if (!header.column.getCanSort())
|
|
3632
3633
|
return;
|
|
3633
3634
|
const nextOrder = header.column.getNextSortingOrder();
|
|
3634
3635
|
switch (nextOrder) {
|
|
3635
|
-
case
|
|
3636
|
+
case constantsBReL3Lsa.SortingPossibility.Asc:
|
|
3636
3637
|
return 'Sort ascending';
|
|
3637
|
-
case
|
|
3638
|
+
case constantsBReL3Lsa.SortingPossibility.Desc:
|
|
3638
3639
|
return 'Sort descending';
|
|
3639
3640
|
default:
|
|
3640
3641
|
return 'Clear sort';
|
|
@@ -3689,22 +3690,21 @@ const NvDatagrid = class {
|
|
|
3689
3690
|
}
|
|
3690
3691
|
else if (this.headerTemplateCache.size > 0) {
|
|
3691
3692
|
const headerKeys = Array.from(this.headerTemplateCache.keys());
|
|
3692
|
-
const arrayColumnsConfig = headerKeys.map(key => {
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3693
|
+
const arrayColumnsConfig = headerKeys.map(key => ({
|
|
3694
|
+
...{}, // Ensure no prototype inheritance
|
|
3695
|
+
accessor: key,
|
|
3696
|
+
header: key ? key.charAt(0).toUpperCase() + key.slice(1) : '',
|
|
3697
|
+
group: this.columnData.find(x => x.accessor === key)?.group ?? 'ungrouped',
|
|
3698
|
+
}));
|
|
3696
3699
|
this.parseColumnsArray(arrayColumnsConfig, this.parsedColumns);
|
|
3697
3700
|
}
|
|
3698
3701
|
else if (this.parsedData.length > 0) {
|
|
3699
3702
|
const firstRow = this.parsedData[0];
|
|
3700
|
-
const arrayColumnsConfig = Object.keys(firstRow).map(key => {
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
group: (_b = (_a = this.columnData.find(x => x.accessor === key)) === null || _a === void 0 ? void 0 : _a.group) !== null && _b !== void 0 ? _b : 'ungrouped',
|
|
3706
|
-
});
|
|
3707
|
-
});
|
|
3703
|
+
const arrayColumnsConfig = Object.keys(firstRow).map(key => ({
|
|
3704
|
+
accessor: key,
|
|
3705
|
+
header: key.charAt(0).toUpperCase() + key.slice(1),
|
|
3706
|
+
group: this.columnData.find(x => x.accessor === key)?.group ?? 'ungrouped',
|
|
3707
|
+
}));
|
|
3708
3708
|
if (this.autoGenerateColumns) {
|
|
3709
3709
|
this.parseColumnsArray(arrayColumnsConfig, this.parsedColumns);
|
|
3710
3710
|
}
|
|
@@ -3744,7 +3744,6 @@ const NvDatagrid = class {
|
|
|
3744
3744
|
this.parsedColumns = safeNewValue;
|
|
3745
3745
|
}
|
|
3746
3746
|
initializeTable() {
|
|
3747
|
-
var _a, _b, _c, _d;
|
|
3748
3747
|
// Clear the previous table instance (if any)
|
|
3749
3748
|
this.table = null;
|
|
3750
3749
|
console.info('initializeTable this.columnData:', this.columnData);
|
|
@@ -3781,7 +3780,7 @@ const NvDatagrid = class {
|
|
|
3781
3780
|
};
|
|
3782
3781
|
if (this.parsedColumns.length > 0) {
|
|
3783
3782
|
// Validate and generate column definitions
|
|
3784
|
-
const validColumns = this.parsedColumns.filter(column => column
|
|
3783
|
+
const validColumns = this.parsedColumns.filter(column => column?.accessor);
|
|
3785
3784
|
// Update tableOptions based on parsed data and columns
|
|
3786
3785
|
const hasColumns = validColumns && Array.isArray(validColumns) && validColumns.length > 0;
|
|
3787
3786
|
const hasData = this.parsedData &&
|
|
@@ -3806,14 +3805,11 @@ const NvDatagrid = class {
|
|
|
3806
3805
|
if (hasData) {
|
|
3807
3806
|
// No parsed columns and data is available
|
|
3808
3807
|
const firstRow = this.parsedData[0];
|
|
3809
|
-
const arrayColumnsConfig = Object.keys(firstRow).map(key => {
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
group: (_b = (_a = this.columnData.find(x => x.accessor === key)) === null || _a === void 0 ? void 0 : _a.group) !== null && _b !== void 0 ? _b : 'ungrouped',
|
|
3815
|
-
});
|
|
3816
|
-
});
|
|
3808
|
+
const arrayColumnsConfig = Object.keys(firstRow).map(key => ({
|
|
3809
|
+
accessor: key,
|
|
3810
|
+
header: key.charAt(0).toUpperCase() + key.slice(1),
|
|
3811
|
+
group: this.columnData.find(x => x.accessor === key)?.group ?? 'ungrouped',
|
|
3812
|
+
}));
|
|
3817
3813
|
if (this.autoGenerateColumns) {
|
|
3818
3814
|
this.parseColumnsArray(arrayColumnsConfig, this.parsedColumns);
|
|
3819
3815
|
}
|
|
@@ -3837,8 +3833,8 @@ const NvDatagrid = class {
|
|
|
3837
3833
|
}
|
|
3838
3834
|
if (this.enablePagination) {
|
|
3839
3835
|
tableOptions.getPaginationRowModel = getPaginationRowModel();
|
|
3840
|
-
const pageIndex =
|
|
3841
|
-
let effectivePageSize =
|
|
3836
|
+
const pageIndex = this.paginationState?.pageIndex ?? 0;
|
|
3837
|
+
let effectivePageSize = this.paginationState?.pageSize ?? 10;
|
|
3842
3838
|
if (!this.pageSizes.includes(effectivePageSize) && this.pageSizes) {
|
|
3843
3839
|
effectivePageSize = this.pageSizes[0];
|
|
3844
3840
|
}
|
|
@@ -3980,16 +3976,13 @@ const NvDatagrid = class {
|
|
|
3980
3976
|
tableOptions.data &&
|
|
3981
3977
|
tableOptions.data.length > 0)) {
|
|
3982
3978
|
const sampleRow = tableOptions.data[0];
|
|
3983
|
-
processedColumns = Object.keys(sampleRow).map(key => {
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
cellSlot: null,
|
|
3991
|
-
});
|
|
3992
|
-
});
|
|
3979
|
+
processedColumns = Object.keys(sampleRow).map(key => ({
|
|
3980
|
+
header: key.charAt(0).toUpperCase() + key.slice(1),
|
|
3981
|
+
accessor: key,
|
|
3982
|
+
group: this.columnData.find(x => x.accessor === key)?.group ?? 'ungrouped',
|
|
3983
|
+
headerSlot: null,
|
|
3984
|
+
cellSlot: null,
|
|
3985
|
+
}));
|
|
3993
3986
|
}
|
|
3994
3987
|
// Group columns by their group property
|
|
3995
3988
|
const groupedColumns = processedColumns.reduce((acc, column) => {
|
|
@@ -4005,19 +3998,22 @@ const NvDatagrid = class {
|
|
|
4005
3998
|
}, {});
|
|
4006
3999
|
// Transform each column into a ColumnDef
|
|
4007
4000
|
const createColumnDef = (column) => {
|
|
4008
|
-
var _a, _b, _c;
|
|
4009
4001
|
return columnHelper.accessor(column.accessor, {
|
|
4010
|
-
header:
|
|
4002
|
+
header: this.renderTemplate(this.headerTemplateCache.get(column.accessor), column.header ?? column.accessor, null) ??
|
|
4003
|
+
column.header ??
|
|
4004
|
+
column.accessor,
|
|
4011
4005
|
cell: (info) => {
|
|
4012
|
-
var _a, _b, _c;
|
|
4013
4006
|
const value = info.getValue();
|
|
4014
4007
|
const row = info.row;
|
|
4015
|
-
return
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4008
|
+
return this.columnData.find(x => x.accessor === column.accessor)
|
|
4009
|
+
?.repeatTemplate && Array.isArray(value)
|
|
4010
|
+
? value.map((item) => this.renderTemplate(this.templateCache.get(column.accessor), item, row) ??
|
|
4011
|
+
item ??
|
|
4012
|
+
value ??
|
|
4013
|
+
this.fallbackValue)
|
|
4014
|
+
: this.renderTemplate(this.templateCache.get(column.accessor), value, row) ??
|
|
4015
|
+
value ??
|
|
4016
|
+
this.fallbackValue;
|
|
4021
4017
|
},
|
|
4022
4018
|
sortUndefined: 'last',
|
|
4023
4019
|
sortDescFirst: false,
|
|
@@ -4045,9 +4041,9 @@ const NvDatagrid = class {
|
|
|
4045
4041
|
header: ({ table }) => {
|
|
4046
4042
|
return (index.h("div", { class: "flex px-1", ref: el => {
|
|
4047
4043
|
const checkbox = this.createIndeterminateCheckbox({
|
|
4048
|
-
checked: table
|
|
4049
|
-
indeterminate: table
|
|
4050
|
-
onChange: table
|
|
4044
|
+
checked: table?.getIsAllRowsSelected(),
|
|
4045
|
+
indeterminate: table?.getIsSomeRowsSelected(),
|
|
4046
|
+
onChange: table?.getToggleAllRowsSelectedHandler(),
|
|
4051
4047
|
});
|
|
4052
4048
|
if (el) {
|
|
4053
4049
|
el.innerHTML = ''; // Remove existing content
|
|
@@ -4058,10 +4054,10 @@ const NvDatagrid = class {
|
|
|
4058
4054
|
cell: ({ row }) => {
|
|
4059
4055
|
return (index.h("div", { class: "flex px-1", ref: el => {
|
|
4060
4056
|
const checkbox = this.createIndeterminateCheckbox({
|
|
4061
|
-
checked: row
|
|
4062
|
-
disabled: !
|
|
4063
|
-
indeterminate: row
|
|
4064
|
-
onChange: row
|
|
4057
|
+
checked: row?.getIsSelected(),
|
|
4058
|
+
disabled: !row?.getCanSelect(),
|
|
4059
|
+
indeterminate: row?.getIsSomeSelected(),
|
|
4060
|
+
onChange: row?.getToggleSelectedHandler(),
|
|
4065
4061
|
});
|
|
4066
4062
|
if (el) {
|
|
4067
4063
|
el.innerHTML = ''; // Remove existing content
|
|
@@ -4114,14 +4110,12 @@ const NvDatagrid = class {
|
|
|
4114
4110
|
const keyAction = splitted[1];
|
|
4115
4111
|
const details = splitted.length > 2 ? splitted[2] : null;
|
|
4116
4112
|
el.addEventListener(eventType, () => {
|
|
4117
|
-
|
|
4118
|
-
const keys = (_a = details === null || details === void 0 ? void 0 : details.split(',')) !== null && _a !== void 0 ? _a : [];
|
|
4113
|
+
const keys = details?.split(',') ?? [];
|
|
4119
4114
|
// Convert keys into a single object instead of an array of objects
|
|
4120
4115
|
const keyValue = keys.reduce((acc, key) => {
|
|
4121
|
-
|
|
4122
|
-
if (row === null || row === void 0 ? void 0 : row.original) {
|
|
4116
|
+
if (row?.original) {
|
|
4123
4117
|
if (key in row.original) {
|
|
4124
|
-
acc[key] =
|
|
4118
|
+
acc[key] = row.original?.[key];
|
|
4125
4119
|
}
|
|
4126
4120
|
}
|
|
4127
4121
|
return acc;
|
|
@@ -4146,7 +4140,6 @@ const NvDatagrid = class {
|
|
|
4146
4140
|
} }));
|
|
4147
4141
|
}
|
|
4148
4142
|
replaceKeyWithValue(key, cellValue) {
|
|
4149
|
-
var _a;
|
|
4150
4143
|
// Handle undefined or null values by returning the fallback
|
|
4151
4144
|
if (cellValue === undefined || cellValue === null) {
|
|
4152
4145
|
return this.fallbackValue;
|
|
@@ -4197,7 +4190,7 @@ const NvDatagrid = class {
|
|
|
4197
4190
|
return this.fallbackValue;
|
|
4198
4191
|
}
|
|
4199
4192
|
// If cellValue is a primitive (string, number, boolean, etc.), return it as a string
|
|
4200
|
-
return
|
|
4193
|
+
return cellValue?.toString() ?? this.fallbackValue;
|
|
4201
4194
|
}
|
|
4202
4195
|
replacePlaceholdersTextContent(element, cellValue, row) {
|
|
4203
4196
|
if (!cellValue) {
|
|
@@ -4326,10 +4319,10 @@ const NvDatagrid = class {
|
|
|
4326
4319
|
if (!header.column.getCanSort())
|
|
4327
4320
|
return null;
|
|
4328
4321
|
const sortState = header.column.getIsSorted();
|
|
4329
|
-
if (sortState ===
|
|
4322
|
+
if (sortState === constantsBReL3Lsa.SortingPossibility.Asc) {
|
|
4330
4323
|
return (index.h("div", { class: "inline-flex align-middle" }, index.h("nv-icon", { name: "arrow-up" })));
|
|
4331
4324
|
}
|
|
4332
|
-
if (sortState ===
|
|
4325
|
+
if (sortState === constantsBReL3Lsa.SortingPossibility.Desc) {
|
|
4333
4326
|
return (index.h("div", { class: "inline-flex align-middle" }, index.h("nv-icon", { name: "arrow-down" })));
|
|
4334
4327
|
}
|
|
4335
4328
|
return null;
|
|
@@ -4359,8 +4352,7 @@ const NvDatagrid = class {
|
|
|
4359
4352
|
};
|
|
4360
4353
|
}
|
|
4361
4354
|
getPagination() {
|
|
4362
|
-
|
|
4363
|
-
return (this.enablePagination && (index.h("div", { class: "flex items-center gap-2" }, index.h("button", { class: "border rounded p-1", disabled: !this.table.getCanPreviousPage(), onClick: this.table.firstPage }, "<<"), index.h("button", { class: "border rounded p-1", disabled: !this.table.getCanPreviousPage(), onClick: this.table.previousPage }, "<"), index.h("button", { class: "border rounded p-1", disabled: !this.table.getCanNextPage(), onClick: this.table.nextPage }, ">"), index.h("button", { class: "border rounded p-1", disabled: !this.table.getCanNextPage(), onClick: this.table.lastPage }, ">>"), index.h("span", { class: "flex items-center gap-1" }, index.h("div", null, "Page"), index.h("strong", null, this.table.getState().pagination.pageIndex + 1, " of", ' ', this.table.getPageCount().toLocaleString())), index.h("span", { class: "flex items-center gap-1" }, "| Go to page:", ' ', index.h("input", { type: "number", min: this.minPageIndex, max: this.table.getPageCount(), value: this.table.getState().pagination.pageIndex + 1, class: "border p-1 rounded w-16", "aria-label": "Go to page", onInput: this.handlePageIndexChange })), ((_a = this.pageSizes) === null || _a === void 0 ? void 0 : _a.length) > 0 && (index.h("select", { "aria-label": "Rows per page", onChange: this.handlePageSizeChange }, this.pageSizes.map(pageSize => (index.h("option", { value: String(pageSize), selected: this.table.getState().pagination.pageSize === pageSize }, "Show ", pageSize))))))));
|
|
4355
|
+
return (this.enablePagination && (index.h("div", { class: "flex items-center gap-2" }, index.h("button", { class: "border rounded p-1", disabled: !this.table.getCanPreviousPage(), onClick: this.table.firstPage }, "<<"), index.h("button", { class: "border rounded p-1", disabled: !this.table.getCanPreviousPage(), onClick: this.table.previousPage }, "<"), index.h("button", { class: "border rounded p-1", disabled: !this.table.getCanNextPage(), onClick: this.table.nextPage }, ">"), index.h("button", { class: "border rounded p-1", disabled: !this.table.getCanNextPage(), onClick: this.table.lastPage }, ">>"), index.h("span", { class: "flex items-center gap-1" }, index.h("div", null, "Page"), index.h("strong", null, this.table.getState().pagination.pageIndex + 1, " of", ' ', this.table.getPageCount().toLocaleString())), index.h("span", { class: "flex items-center gap-1" }, "| Go to page:", ' ', index.h("input", { type: "number", min: this.minPageIndex, max: this.table.getPageCount(), value: this.table.getState().pagination.pageIndex + 1, class: "border p-1 rounded w-16", "aria-label": "Go to page", onInput: this.handlePageIndexChange })), this.pageSizes?.length > 0 && (index.h("select", { "aria-label": "Rows per page", onChange: this.handlePageSizeChange }, this.pageSizes.map(pageSize => (index.h("option", { value: String(pageSize), selected: this.table.getState().pagination.pageSize === pageSize }, "Show ", pageSize))))))));
|
|
4364
4356
|
}
|
|
4365
4357
|
//#endregion METHODS
|
|
4366
4358
|
/****************************************************************************/
|
|
@@ -4416,7 +4408,10 @@ const NvDatagrid = class {
|
|
|
4416
4408
|
effectivePageSize = this.pageSizes[0];
|
|
4417
4409
|
}
|
|
4418
4410
|
// Simply use `setPageSize` to update the page size directly
|
|
4419
|
-
this.paginationState =
|
|
4411
|
+
this.paginationState = {
|
|
4412
|
+
...this.paginationState,
|
|
4413
|
+
pageSize: effectivePageSize,
|
|
4414
|
+
}; // This triggers the paginationState watcher
|
|
4420
4415
|
}
|
|
4421
4416
|
handleRowSelectionState(newValue, oldValue) {
|
|
4422
4417
|
if (!this.table) {
|
|
@@ -4482,25 +4477,25 @@ const NvDatagrid = class {
|
|
|
4482
4477
|
/****************************************************************************/
|
|
4483
4478
|
//#region RENDER
|
|
4484
4479
|
render() {
|
|
4485
|
-
var _a, _b, _c, _d, _e;
|
|
4486
4480
|
const headerGroups = !this.table || this.table === undefined || this.parsedColumns.length === 0
|
|
4487
4481
|
? []
|
|
4488
|
-
:
|
|
4482
|
+
: this.table?.getHeaderGroups();
|
|
4489
4483
|
const rows = !this.table || this.table === undefined || this.parsedData.length === 0
|
|
4490
4484
|
? []
|
|
4491
|
-
:
|
|
4492
|
-
return (index.h(index.Host, { key: '
|
|
4493
|
-
? headerGroups
|
|
4485
|
+
: this.table?.getRowModel()?.rows;
|
|
4486
|
+
return (index.h(index.Host, { key: 'd1ca320f75940993840349a4f33afb0a8dc10788' }, index.h("div", { key: 'd07f038bfa0d4c0092f0ad9e6f13c95a47331f75', class: "hidden" }, index.h("slot", { key: 'be8e292240da78d055cce83fb5700111d371d0db' })), index.h("slot", { key: 'af921e34986bf67afa14190e2d01e866af7ab7ae', name: "before" }), this.enableGlobalFilter && this.table && (index.h("div", { key: 'f3ffe4bdfee63e86ad470923e4faf62be821b5fa', class: `search-container justify-${this.globalFilterPosition}` }, index.h("nv-fieldtext", { key: 'a5ab10f4e088b106368bd5d98d99e3cef2b59955', value: this.globalFilterSearchTerm, onInput: this.handleGlobalFilteringOnInput, placeholder: "Search all columns..." }))), this.parsedColumns.length === 0 && this.parsedData.length === 0 ? (index.h("div", { class: "no-data" }, this.noColumnsNoDataMessage)) : (index.h("div", null, index.h("table", null, this.parsedColumns.length > 0 && headerGroups.length > 0 && (index.h("thead", null, this.parsedColumns.length > 0 && headerGroups
|
|
4487
|
+
? headerGroups?.map(headerGroup => (index.h("tr", { key: headerGroup.id }, headerGroup.headers.map(header => {
|
|
4494
4488
|
return this.getHeaderCell(header);
|
|
4495
4489
|
}))))
|
|
4496
4490
|
: null)), index.h("tbody", null, !rows || rows.length === 0 || this.parsedData.length === 0 ? (index.h("tr", null, index.h("td", { colSpan: this.parsedColumns.length || 12, class: "no-data" }, this.noDataMessage))) : (rows.map(row => {
|
|
4497
4491
|
const rowId = row.id;
|
|
4498
|
-
const visibleCells = row
|
|
4492
|
+
const visibleCells = row?.getVisibleCells();
|
|
4499
4493
|
return (index.h("tr", { key: rowId }, visibleCells.map(cell => {
|
|
4500
4494
|
return (index.h("td", { key: cell.id, "data-row-id": rowId }, this.flexRender(cell.column.columnDef.cell, cell.getContext())));
|
|
4501
4495
|
})));
|
|
4502
4496
|
}))), this.table && this.enableRowSelection ? (index.h("tfoot", null, index.h("tr", null, index.h("td", { colSpan: 20 }, this.enableRowSelection && this.table ? (index.h("div", null, this.rowSelectionState &&
|
|
4503
|
-
Object.keys(this.rowSelectionState).length > 0 ? (index.h("span", null, Object.keys(this.rowSelectionState).length, " of", ' ',
|
|
4497
|
+
Object.keys(this.rowSelectionState).length > 0 ? (index.h("span", null, Object.keys(this.rowSelectionState).length, " of", ' ', this.table.getPreFilteredRowModel()?.rows
|
|
4498
|
+
?.length || 0, ' ', "Total Rows Selected")) : (index.h("span", null, "No rows selected")))) : null)))) : null), this.getPagination())), index.h("slot", { key: '8941adaa686dec6b3f09e0434bdf9df3d273e930', name: "after" })));
|
|
4504
4499
|
}
|
|
4505
4500
|
get el() { return index.getElement(this); }
|
|
4506
4501
|
static get watchers() { return {
|
|
@@ -4516,6 +4511,6 @@ const NvDatagrid = class {
|
|
|
4516
4511
|
"state": ["handleStateChange"]
|
|
4517
4512
|
}; }
|
|
4518
4513
|
};
|
|
4519
|
-
NvDatagrid.style =
|
|
4514
|
+
NvDatagrid.style = nvDatagridCss;
|
|
4520
4515
|
|
|
4521
4516
|
exports.nv_datagrid = NvDatagrid;
|