@nova-design-system/nova-react 3.23.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/events.utils-B6GgGra--01N__3wY.js +23 -0
- package/dist/cjs/generated/components.server.js +47 -0
- package/dist/cjs/{grow.animation-CvHGHBL4-DDIEYBK-.js → grow.animation-D7ep_aVl-BuXEDSK-.js} +0 -21
- package/dist/cjs/{i18n.utils-DOZbXX2L-BizoXo6c.js → i18n.utils-IlwlcG9l-ku0bScip.js} +14 -18
- package/dist/cjs/{index-CtjeeUI-.js → index-kU2nW5aN.js} +1589 -920
- package/dist/cjs/{nv-dialog.entry-O47Eol_7.js → index.esm-D3eWMME9-CG1TVKfu.js} +1 -296
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/{nv-accordion-item.entry-B_l0-ux0.js → nv-accordion-item.entry-Bu1tAcCq.js} +1 -1
- package/dist/cjs/{nv-accordion.entry-BX8_YuZF.js → nv-accordion.entry-jWjLdX8w.js} +3 -8
- package/dist/cjs/{nv-alert.entry-DCWYR0OK.js → nv-alert.entry-E9ZJay_K.js} +2 -3
- package/dist/cjs/{nv-avatar.entry-C_xZD3Lp.js → nv-avatar.entry-CUX7u0kR.js} +1 -1
- package/dist/cjs/{nv-badge_2.entry-JjqANStV.js → nv-badge_2.entry-bxpV5gxE.js} +2 -2
- package/dist/cjs/{nv-breadcrumb.entry-DQZDn6cm.js → nv-breadcrumb.entry-Cbbb9Qeh.js} +1 -1
- package/dist/cjs/{nv-breadcrumbs.entry-Bz0GjhY_.js → nv-breadcrumbs.entry-BTqnp9zO.js} +1 -1
- package/dist/cjs/{nv-button.entry-Br1DH9Vj.js → nv-button.entry-upWH19y6.js} +4 -6
- package/dist/cjs/{nv-buttongroup.entry-BZaTKN_n.js → nv-buttongroup.entry-CuZCRsnV.js} +1 -1
- package/dist/cjs/{nv-calendar.entry-D9ESuu7C.js → nv-calendar.entry-CT3mASW6.js} +15 -25
- package/dist/cjs/{nv-col.entry-CfgPMMxS.js → nv-col.entry--pCxkaTh.js} +1 -1
- package/dist/cjs/{nv-datagrid.entry-DcB5q2oC.js → nv-datagrid.entry-CGCEhO8C.js} +68 -73
- package/dist/cjs/{nv-datagridcolumn.entry-BhKOzXA6.js → nv-datagridcolumn.entry-Fsqc7CT_.js} +1 -1
- package/dist/cjs/nv-dialog.entry-B6OYcZxQ.js +300 -0
- package/dist/cjs/{nv-dialogfooter_2.entry-Dn16bI8a.js → nv-dialogfooter_2.entry-C4fP_n2-.js} +1 -1
- 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-Bx6ArV_b.js → nv-fieldcheckbox.entry-bk7UNQny.js} +7 -7
- package/dist/cjs/{nv-fielddate.entry-B4P0U8QG.js → nv-fielddate.entry-dqZDBVmm.js} +13 -16
- package/dist/cjs/{nv-fielddaterange.entry-BORwYJ-k.js → nv-fielddaterange.entry-wNRasXky.js} +13 -14
- package/dist/cjs/{nv-fielddropdown.entry-DzBAIynY.js → nv-fielddropdown.entry-BA15piWa.js} +40 -49
- package/dist/cjs/{nv-fielddropdownitem.entry-C_17isWd.js → nv-fielddropdownitem.entry-DEWaf9dC.js} +3 -4
- package/dist/cjs/{nv-fieldmultiselect.entry-DiqRreWh.js → nv-fieldmultiselect.entry-BWY5xOAd.js} +35 -43
- package/dist/cjs/{nv-fieldnumber.entry-C9O4UPp3.js → nv-fieldnumber.entry-DoYORd0d.js} +7 -7
- package/dist/cjs/{nv-fieldpassword.entry-BfVJNT0A.js → nv-fieldpassword.entry-CPaLj9aD.js} +7 -7
- package/dist/cjs/{nv-fieldradio.entry-CG22oETM.js → nv-fieldradio.entry-CvUmEaCa.js} +5 -5
- package/dist/cjs/{nv-fieldselect.entry-BPQEtrv2.js → nv-fieldselect.entry-uUIZ6hmN.js} +9 -9
- package/dist/cjs/{nv-fieldslider.entry-CozmnUfN.js → nv-fieldslider.entry-DnvmxxYY.js} +6 -6
- package/dist/cjs/{nv-fieldtext.entry-BD-z01ru.js → nv-fieldtext.entry-BYAJp3n_.js} +7 -7
- package/dist/cjs/{nv-fieldtextarea.entry-7UrKWDHg.js → nv-fieldtextarea.entry-DU2bWYeg.js} +7 -8
- package/dist/cjs/{nv-fieldtime.entry-DakOlLiO.js → nv-fieldtime.entry-DlMNDTht.js} +28 -36
- package/dist/cjs/{nv-icon.entry-Db00kB2u.js → nv-icon.entry-CnUkRzaA.js} +3 -3
- package/dist/cjs/{nv-iconbutton_2.entry-CaKCa8NT.js → nv-iconbutton_2.entry-hqp4AcRq.js} +6 -7
- package/dist/cjs/{nv-menu.entry-CK2HdmBt.js → nv-menu.entry-Dc_FvIx7.js} +4 -5
- package/dist/cjs/{nv-menuitem.entry-mKMqCAdz.js → nv-menuitem.entry-DzMhx6c_.js} +2 -2
- package/dist/cjs/{nv-notification-bullet.entry-DtbjtFxs.js → nv-notification-bullet.entry-BwhHCMQF.js} +2 -3
- package/dist/cjs/{nv-notification.entry-CLb0gNu3.js → nv-notification.entry-C3m5p5BL.js} +11 -97
- package/dist/cjs/{nv-notificationcontainer.entry-Cijivlm6.js → nv-notificationcontainer.entry-DTRNn7VE.js} +2 -2
- package/dist/cjs/{nv-popover.entry-mLdLSp6n.js → nv-popover.entry-B0c-2rO4.js} +15 -15
- package/dist/cjs/{nv-row.entry-C2C94fcv.js → nv-row.entry-CdcjVGZv.js} +2 -2
- package/dist/cjs/{nv-sidebar.entry-inDVNJ4s.js → nv-sidebar.entry-CiN813gQ.js} +4 -4
- package/dist/cjs/{nv-sidebarcontent.entry-DxoljE15.js → nv-sidebarcontent.entry-D9hpAhK8.js} +2 -2
- package/dist/cjs/{nv-sidebardivider.entry-D_yern0R.js → nv-sidebardivider.entry-B4EMyca5.js} +2 -2
- package/dist/cjs/{nv-sidebarfooter.entry-Rkkn9TB_.js → nv-sidebarfooter.entry-CHi4qOFe.js} +2 -2
- package/dist/cjs/{nv-sidebargroup.entry-C1p9qqxr.js → nv-sidebargroup.entry-RVqrsyIU.js} +2 -2
- package/dist/cjs/{nv-sidebarheader.entry-CYpD_4pI.js → nv-sidebarheader.entry-_7ch0O3G.js} +2 -2
- package/dist/cjs/{nv-sidebarlogo.entry-BgK03M1v.js → nv-sidebarlogo.entry-Ch9F-JnT.js} +2 -2
- package/dist/cjs/{nv-sidebarnavitem.entry-DglvcCOD.js → nv-sidebarnavitem.entry-DVrafSMr.js} +5 -6
- package/dist/cjs/{nv-sidebarnavsubitem.entry-Dt1jKmC-.js → nv-sidebarnavsubitem.entry-C0XDAzma.js} +2 -2
- package/dist/cjs/{nv-split.entry-mzg2F66T.js → nv-split.entry-0HTslRAX.js} +44 -42
- package/dist/cjs/{nv-stack.entry-nnvjTrBy.js → nv-stack.entry-CqO7uTQf.js} +2 -2
- package/dist/cjs/{nv-table.entry-DkbNgxtI.js → nv-table.entry-DH85n8Mc.js} +7 -9
- package/dist/cjs/{nv-tableheader.entry-CRVFTQA-.js → nv-tableheader.entry-CKfocdxD.js} +3 -3
- package/dist/cjs/{nv-toggle.entry-oC9TVkr1.js → nv-toggle.entry-BHUl76Im.js} +3 -3
- package/dist/cjs/nv-togglebutton.entry-D_9COjY-.js +67 -0
- package/dist/cjs/{nv-togglebuttongroup.entry-BYXX5ejg.js → nv-togglebuttongroup.entry-C0NLbsq7.js} +4 -5
- package/dist/cjs/{nv-tooltip.entry-OJGxfJEh.js → nv-tooltip.entry-BfViGE_U.js} +2 -2
- package/dist/cjs/slide.animation-CmH5d1of-BZuw607U.js +90 -0
- package/dist/components/NvDatatable/NvDatatable.js +40 -24
- package/dist/generated/components.js +27 -0
- package/dist/generated/components.server.js +44 -0
- 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 +14 -0
- package/dist/types/generated/components.server.d.ts +14 -0
- package/package.json +1 -1
- package/dist/cjs/nv-togglebutton.entry-BTWCzbS9.js +0 -67
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-kU2nW5aN.js');
|
|
4
4
|
var constantsBReL3Lsa = require('./constants-BReL3Lsa-DpB_ghPF.js');
|
|
5
5
|
require('@stencil/react-output-target/runtime');
|
|
6
6
|
require('react');
|
|
@@ -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,14 +3617,16 @@ 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())
|
|
@@ -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) {
|
|
@@ -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
|
-
:
|
|
4485
|
+
: this.table?.getRowModel()?.rows;
|
|
4492
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
|
|
4493
|
-
? 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 {
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-kU2nW5aN.js');
|
|
4
|
+
var index_esmD3eWMME9 = require('./index.esm-D3eWMME9-CG1TVKfu.js');
|
|
5
|
+
var events_utilsB6GgGra_ = require('./events.utils-B6GgGra--01N__3wY.js');
|
|
6
|
+
var fade_animationDcRL9lcm = require('./fade.animation-DcRL9lcm-DAZeHoKN.js');
|
|
7
|
+
var grow_animationD7ep_aVl = require('./grow.animation-D7ep_aVl-BuXEDSK-.js');
|
|
8
|
+
require('./style-value-types.es-xlgmw4x8-B1vLqX9m.js');
|
|
9
|
+
var timeline_animationCgHCo_Ho = require('./timeline.animation-CgHCo_Ho-KteJaZPb.js');
|
|
10
|
+
var clsxChV9xqsO = require('./clsx-ChV9xqsO-BtxeOLZW.js');
|
|
11
|
+
var constantsBReL3Lsa = require('./constants-BReL3Lsa-DpB_ghPF.js');
|
|
12
|
+
var v4BdYh22OP = require('./v4-BdYh22OP-C1vaJ4yP.js');
|
|
13
|
+
require('@stencil/react-output-target/runtime');
|
|
14
|
+
require('react');
|
|
15
|
+
require('react-dom');
|
|
16
|
+
|
|
17
|
+
const nvDialogCss = "nv-dialog dialog{width:100vw;height:100svh;margin:0;max-height:unset;max-width:unset;padding:0;background:color-mix(in srgb, var(--components-overlay-background) 70%, transparent);backdrop-filter:blur(4px)}nv-dialog dialog.full .content{min-width:90vw;width:90vw;max-width:90vw}nv-dialog .backdrop{display:flex;min-height:100%;padding:var(--spacing-3);box-shadow:0px var(--shadow-y-axis-2xl) var(--shadow-blur-2xl) var(--shadow-spread-2xl) var(--shadow-color-opacity-3) var(--shadow-color-opacity-3)}nv-dialog .backdrop .content{border-radius:var(--radius-rounded-2xl);background:var(--color-level-00-background);min-width:min(90vw, 400px);width:fit-content;max-width:clamp(90vw, min(90vw, 960px), 960px);margin:auto;display:flex;flex-direction:column;align-items:flex-start;height:fit-content;position:relative}nv-dialog .backdrop .content nv-button.close-button{position:absolute;top:var(--dialog-dismissible-position-top);right:var(--dialog-dismissible-position-right);display:flex;padding:var(--button-sm-icon-button-padding);justify-content:flex-end;align-items:flex-start;gap:10px}nv-dialog .backdrop .content .content-body::-webkit-scrollbar{width:6px;height:6px}nv-dialog .backdrop .content .content-body::-webkit-scrollbar-track{background-color:var(--color-level-10-background);border-radius:9999px}nv-dialog .backdrop .content .content-body::-webkit-scrollbar-thumb{background-color:var(--color-gray-200);border-radius:9999px}nv-dialog .backdrop .content .content-body{box-sizing:border-box;padding:var(--dialog-body-padding-y) var(--dialog-body-padding-x);scrollbar-gutter:stable both-edges;font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--font-size-md);font-style:normal;font-weight:var(--font-weight-low-emphasis);line-height:var(--line-height-base);color:var(--color-content-medium-text);width:100%}";
|
|
18
|
+
|
|
19
|
+
const NvDialog = class {
|
|
20
|
+
constructor(hostRef) {
|
|
21
|
+
index.registerInstance(this, hostRef);
|
|
22
|
+
this.openChanged = index.createEvent(this, "openChanged", 3);
|
|
23
|
+
this.eventsAttached = false;
|
|
24
|
+
this.triggerClickEvents = [
|
|
25
|
+
['click', this.show],
|
|
26
|
+
[
|
|
27
|
+
'keydown',
|
|
28
|
+
(e) => {
|
|
29
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
this.show();
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
];
|
|
36
|
+
/**
|
|
37
|
+
* Use this prop to toggle the visibility of the dialog. Set to true to show
|
|
38
|
+
* the dialog and false to hide it.
|
|
39
|
+
*/
|
|
40
|
+
this.open = false;
|
|
41
|
+
/**
|
|
42
|
+
* If true, the dialog cannot be closed by the user.
|
|
43
|
+
*/
|
|
44
|
+
this.undismissable = false;
|
|
45
|
+
/**
|
|
46
|
+
* If true, the dialog will be closed when the backdrop is clicked.
|
|
47
|
+
*/
|
|
48
|
+
this.clickOutside = false;
|
|
49
|
+
/**
|
|
50
|
+
* If true, the dialog visibility is managed manually through methods or the
|
|
51
|
+
* open prop.
|
|
52
|
+
*/
|
|
53
|
+
this.controlled = false;
|
|
54
|
+
/**
|
|
55
|
+
* If true, the dialog takes full width styling.
|
|
56
|
+
*/
|
|
57
|
+
this.full = false;
|
|
58
|
+
/**
|
|
59
|
+
* Controls whether the dialog should automatically focus the first focusable
|
|
60
|
+
* element when opened. When disabled, prevents unwanted tooltip triggers on
|
|
61
|
+
* dialog open.
|
|
62
|
+
*/
|
|
63
|
+
this.autofocus = false;
|
|
64
|
+
/**
|
|
65
|
+
* Checks for and sets up form ID if a form is present
|
|
66
|
+
*/
|
|
67
|
+
this.checkForForm = () => {
|
|
68
|
+
if (!this.form) {
|
|
69
|
+
const formElement = this.el.querySelector('form');
|
|
70
|
+
if (formElement) {
|
|
71
|
+
this.form = this.ensureFormId(formElement);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Handles the native dialog close event.
|
|
77
|
+
*/
|
|
78
|
+
this.handleDialogClose = () => {
|
|
79
|
+
if (this.open) {
|
|
80
|
+
this.close();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Handles the click event to close the dialog when clickOutside is true.
|
|
85
|
+
* @param {MouseEvent} event - The click event.
|
|
86
|
+
*/
|
|
87
|
+
this.handleDialogClick = (event) => {
|
|
88
|
+
if (!this.clickOutside || this.undismissable)
|
|
89
|
+
return;
|
|
90
|
+
if (this.checkForOpenPopovers())
|
|
91
|
+
return;
|
|
92
|
+
if (event.target === this.backdropElement) {
|
|
93
|
+
this.close();
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
event.stopPropagation();
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
this.checkForOpenPopovers = () => {
|
|
99
|
+
let hasOpenPopover = false;
|
|
100
|
+
this.el.querySelectorAll('nv-popover').forEach(popover => {
|
|
101
|
+
if (popover.hasAttribute('open')) {
|
|
102
|
+
hasOpenPopover = true;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return hasOpenPopover;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
//#endregion PROPERTIES
|
|
109
|
+
/****************************************************************************/
|
|
110
|
+
//#region METHODS
|
|
111
|
+
/**
|
|
112
|
+
* Call this method to show the dialog, making it visible on the screen.
|
|
113
|
+
*/
|
|
114
|
+
async show() {
|
|
115
|
+
this.open = true;
|
|
116
|
+
this.preventScroll();
|
|
117
|
+
/** It is recommended to use the .show() or .showModal() method to render
|
|
118
|
+
* dialogs, rather than the open attribute. If a <dialog> is opened using
|
|
119
|
+
* the open attribute, it is non-modal. */
|
|
120
|
+
const { setFadeOut } = fade_animationDcRL9lcm.useFade(this.dialogElement);
|
|
121
|
+
setFadeOut();
|
|
122
|
+
this.dialogElement.showModal();
|
|
123
|
+
const { setGrowIn, growIn } = grow_animationD7ep_aVl.useGrow(this.contentElement, {
|
|
124
|
+
duration: 100,
|
|
125
|
+
amount: 0.9,
|
|
126
|
+
});
|
|
127
|
+
const { fadeIn } = fade_animationDcRL9lcm.useFade(this.dialogElement, {
|
|
128
|
+
duration: 100,
|
|
129
|
+
});
|
|
130
|
+
setGrowIn();
|
|
131
|
+
await timeline_animationCgHCo_Ho.parallel(fadeIn, growIn).start();
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Call this method to hide the dialog, making it disappear from view.
|
|
135
|
+
*/
|
|
136
|
+
async close() {
|
|
137
|
+
this.open = false;
|
|
138
|
+
this.allowScroll();
|
|
139
|
+
const { growOut } = grow_animationD7ep_aVl.useGrow(this.contentElement, {
|
|
140
|
+
duration: 150,
|
|
141
|
+
amount: 0.85,
|
|
142
|
+
});
|
|
143
|
+
const { fadeOut } = fade_animationDcRL9lcm.useFade(this.dialogElement, {
|
|
144
|
+
duration: 150,
|
|
145
|
+
});
|
|
146
|
+
await timeline_animationCgHCo_Ho.parallel(growOut, fadeOut).start();
|
|
147
|
+
this.dialogElement.close();
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Sets the autofocus on the first focusable element in the dialog.
|
|
151
|
+
*/
|
|
152
|
+
setAutofocus() {
|
|
153
|
+
const focusableElements = index_esmD3eWMME9.tabbable(this.dialogElement, {
|
|
154
|
+
displayCheck: 'none',
|
|
155
|
+
});
|
|
156
|
+
if (focusableElements.length > 0) {
|
|
157
|
+
// Convert to array and find element with smallest top and left position
|
|
158
|
+
let topLeftElement = focusableElements[0];
|
|
159
|
+
let topLeftRect = topLeftElement.getBoundingClientRect();
|
|
160
|
+
focusableElements.forEach(element => {
|
|
161
|
+
const rect = element.getBoundingClientRect();
|
|
162
|
+
if (rect.top < topLeftRect.top || rect.left < topLeftRect.left) {
|
|
163
|
+
topLeftElement = element;
|
|
164
|
+
topLeftRect = rect;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
// Set autofocus attribute on the found element
|
|
168
|
+
topLeftElement.setAttribute('autofocus', 'true');
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Attaches event listeners to the dialog.
|
|
173
|
+
*/
|
|
174
|
+
attachEventListeners() {
|
|
175
|
+
if (this.triggerElement && !this.eventsAttached && !this.controlled) {
|
|
176
|
+
events_utilsB6GgGra_.addEventListeners(this.triggerClickEvents, this.triggerElement, this);
|
|
177
|
+
this.eventsAttached = true;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Prevents the body from scrolling when the dialog is open.
|
|
182
|
+
* Compensates for scrollbar width to prevent layout shift.
|
|
183
|
+
*/
|
|
184
|
+
preventScroll() {
|
|
185
|
+
// Calculate scrollbar width
|
|
186
|
+
const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
187
|
+
// Apply overflow hidden and padding compensation
|
|
188
|
+
document.documentElement.style.overflow = 'hidden';
|
|
189
|
+
document.documentElement.style.paddingRight = `${scrollBarWidth}px`;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Allows the body to scroll when the dialog is closed.
|
|
193
|
+
* Removes the applied overflow and padding styles.
|
|
194
|
+
*/
|
|
195
|
+
allowScroll() {
|
|
196
|
+
// Remove the applied styles
|
|
197
|
+
document.documentElement.style.removeProperty('overflow');
|
|
198
|
+
document.documentElement.style.removeProperty('padding-right');
|
|
199
|
+
}
|
|
200
|
+
ensureFormId(formElement) {
|
|
201
|
+
if (!formElement.id) {
|
|
202
|
+
formElement.id = `dialog-form-${v4BdYh22OP.v4()}`;
|
|
203
|
+
}
|
|
204
|
+
return formElement.id;
|
|
205
|
+
}
|
|
206
|
+
//#endregion EVENTS
|
|
207
|
+
/****************************************************************************/
|
|
208
|
+
//#region WATCHERS
|
|
209
|
+
async handleDialogOpenChange(isOpen) {
|
|
210
|
+
if (isOpen) {
|
|
211
|
+
this.show();
|
|
212
|
+
this.openChanged.emit(isOpen);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
this.close();
|
|
216
|
+
this.openChanged.emit(isOpen);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
//#endregion WATCHERS
|
|
220
|
+
/****************************************************************************/
|
|
221
|
+
//#region LISTENERS
|
|
222
|
+
/**
|
|
223
|
+
* Handles the keydown event to optionally prevent the native dialog from closing when the escape key is pressed.
|
|
224
|
+
* @param {KeyboardEvent} event - The keydown event.
|
|
225
|
+
*/
|
|
226
|
+
handleKeyDown(event) {
|
|
227
|
+
if (event.key !== 'Escape')
|
|
228
|
+
return;
|
|
229
|
+
if (!this.open)
|
|
230
|
+
return;
|
|
231
|
+
event.preventDefault();
|
|
232
|
+
event.stopPropagation();
|
|
233
|
+
const hasOpenPopover = this.checkForOpenPopovers();
|
|
234
|
+
if (!this.undismissable && !hasOpenPopover) {
|
|
235
|
+
event.preventDefault();
|
|
236
|
+
event.stopPropagation();
|
|
237
|
+
this.close();
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
//#endregion LISTENERS
|
|
241
|
+
/****************************************************************************/
|
|
242
|
+
//#region LIFECYCLE
|
|
243
|
+
/**
|
|
244
|
+
* Lifecycle method that runs before the component loads.
|
|
245
|
+
* Initializes the trigger, header, and footer elements by finding them in the component's children.
|
|
246
|
+
* Elements are found either by their slot attribute or by their tag name (for dialog header/footer)
|
|
247
|
+
*/
|
|
248
|
+
componentWillLoad() {
|
|
249
|
+
this.triggerElement = Array.from(this.el.children).find(child => {
|
|
250
|
+
return child.getAttribute('slot') === 'trigger';
|
|
251
|
+
});
|
|
252
|
+
this.headerElement = Array.from(this.el.children).find(child => {
|
|
253
|
+
return (child.getAttribute('slot') === 'header' ||
|
|
254
|
+
child.tagName.toLowerCase() === 'nv-dialogheader');
|
|
255
|
+
});
|
|
256
|
+
this.footerElement = Array.from(this.el.children).find(child => {
|
|
257
|
+
return (child.getAttribute('slot') === 'footer' ||
|
|
258
|
+
child.tagName.toLowerCase() === 'nv-dialogfooter');
|
|
259
|
+
});
|
|
260
|
+
// Initial form check
|
|
261
|
+
this.checkForForm();
|
|
262
|
+
}
|
|
263
|
+
componentWillUpdate() {
|
|
264
|
+
this.attachEventListeners();
|
|
265
|
+
}
|
|
266
|
+
componentDidLoad() {
|
|
267
|
+
if (this.open) {
|
|
268
|
+
this.show();
|
|
269
|
+
}
|
|
270
|
+
// Only set autofocus if the prop is true and no element already has autofocus
|
|
271
|
+
if (this.autofocus && !this.dialogElement.querySelector('[autofocus]')) {
|
|
272
|
+
this.setAutofocus();
|
|
273
|
+
}
|
|
274
|
+
this.attachEventListeners();
|
|
275
|
+
// Additional form check in case form was added after initial load
|
|
276
|
+
this.checkForForm();
|
|
277
|
+
// this.setupContentBodyListeners();
|
|
278
|
+
}
|
|
279
|
+
disconnectedCallback() {
|
|
280
|
+
if (this.triggerElement && !this.eventsAttached && !this.controlled) {
|
|
281
|
+
events_utilsB6GgGra_.removeEventListeners(this.triggerClickEvents, this.triggerElement, this);
|
|
282
|
+
this.eventsAttached = false;
|
|
283
|
+
}
|
|
284
|
+
this.allowScroll();
|
|
285
|
+
}
|
|
286
|
+
//#endregion LIFECYCLE
|
|
287
|
+
/****************************************************************************/
|
|
288
|
+
//#region RENDER
|
|
289
|
+
render() {
|
|
290
|
+
const hasForm = this.form || this.el.querySelector('form');
|
|
291
|
+
return (index.h(index.Host, { key: 'e1837ebe65fcf0e56880438b59a5e8c4b5873926' }, index.h("slot", { key: '543e69780f3dad15a91b4bcb1f4199153bbce1b3', name: "trigger" }), index.h("dialog", { key: 'ef1600f73c8d25744b3b69356e1c4a98e605be1e', ref: el => (this.dialogElement = el), onClose: this.handleDialogClose, onClick: this.handleDialogClick, role: "dialog", "aria-modal": "true", "aria-labelledby": "dialog-header", "aria-describedby": "dialog-content", class: clsxChV9xqsO.clsx({ full: this.full }) }, index.h("div", { key: '894e91291a5ee2a1c26a658e1ca7aaf237d71069', class: "backdrop", ref: el => (this.backdropElement = el) }, index.h("div", { key: '78700c26d1ec553d67a8e62f3f3628fab8deb49a', class: "content", ref: el => (this.contentElement = el) }, !this.undismissable && (index.h("nv-button", { key: 'd042c828bc6886091128425ea3e5c73035a0cea1', class: "close-button", emphasis: "lower", size: "sm", onClick: this.handleDialogClose, "aria-label": "Close dialog" }, index.h("nv-icon", { key: '035273dd23255883a7a5feb354d230242683e00e', name: "x", size: "sm" }))), this.headerElement ? (index.h("slot", { name: "header" })) : (index.h("nv-dialogheader", { id: "dialog-header" })), index.h("div", { key: 'd86417aae675f8611312495d31ca8d0b58c2caaf', class: "content-body", id: "dialog-content" }, index.h("slot", { key: 'cb48b94b846097d04ffd98c6689cd4116e8cd9f9' })), this.footerElement ? (index.h("slot", { name: "footer" })) : (index.h("nv-dialogfooter", { form: this.form, primaryButtonType: hasForm ? constantsBReL3Lsa.ButtonType.Submit : constantsBReL3Lsa.ButtonType.Button, onDialogCanceled: this.handleDialogClose, undismissable: this.undismissable })))))));
|
|
292
|
+
}
|
|
293
|
+
get el() { return index.getElement(this); }
|
|
294
|
+
static get watchers() { return {
|
|
295
|
+
"open": ["handleDialogOpenChange"]
|
|
296
|
+
}; }
|
|
297
|
+
};
|
|
298
|
+
NvDialog.style = nvDialogCss;
|
|
299
|
+
|
|
300
|
+
exports.nv_dialog = NvDialog;
|