@nova-design-system/nova-webcomponents 3.0.0 → 3.2.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/{constants-bcd6b2e2.js → constants-8fb8ccc0.js} +14 -1
- package/dist/cjs/constants-8fb8ccc0.js.map +1 -0
- package/dist/cjs/{index-9bda5507.js → index-108ddff0.js} +22 -6
- package/dist/cjs/index-108ddff0.js.map +1 -0
- package/dist/cjs/index.cjs.js +5 -471
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/native.cjs.js +2 -2
- package/dist/cjs/nv-alert.cjs.entry.js +6 -6
- package/dist/cjs/nv-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-avatar.cjs.entry.js +2 -2
- package/dist/cjs/nv-badge_2.cjs.entry.js +18 -9
- package/dist/cjs/nv-badge_2.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/nv-breadcrumbs.cjs.entry.js +1 -1
- package/dist/cjs/nv-button.cjs.entry.js +2 -2
- package/dist/cjs/nv-calendar.cjs.entry.js +821 -843
- package/dist/cjs/nv-calendar.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-col.cjs.entry.js +1 -1
- package/dist/cjs/nv-datagrid.cjs.entry.js +423 -94
- package/dist/cjs/nv-datagrid.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-datagridcolumn.cjs.entry.js +2 -2
- package/dist/cjs/nv-datagridcolumn.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-dialog.cjs.entry.js +19 -13
- package/dist/cjs/nv-dialog.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-dialogfooter_2.cjs.entry.js +2 -2
- package/dist/cjs/nv-fieldcheckbox.cjs.entry.js +1 -1
- package/dist/cjs/nv-fielddate.cjs.entry.js +9 -18
- package/dist/cjs/nv-fielddate.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fielddaterange.cjs.entry.js +85 -32
- package/dist/cjs/nv-fielddaterange.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fielddropdown.cjs.entry.js +88 -57
- package/dist/cjs/nv-fielddropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fielddropdownitem.cjs.entry.js +2 -2
- package/dist/cjs/nv-fieldmultiselect.cjs.entry.js +122 -104
- package/dist/cjs/nv-fieldmultiselect.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldnumber.cjs.entry.js +9 -5
- package/dist/cjs/nv-fieldnumber.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldpassword.cjs.entry.js +9 -5
- package/dist/cjs/nv-fieldpassword.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldradio.cjs.entry.js +4 -4
- package/dist/cjs/nv-fieldselect.cjs.entry.js +11 -7
- package/dist/cjs/nv-fieldselect.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldslider.cjs.entry.js +663 -0
- package/dist/cjs/nv-fieldslider.cjs.entry.js.map +1 -0
- package/dist/cjs/nv-fieldtext.cjs.entry.js +9 -5
- package/dist/cjs/nv-fieldtext.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldtextarea.cjs.entry.js +9 -5
- package/dist/cjs/nv-fieldtextarea.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldtime.cjs.entry.js +16 -13
- package/dist/cjs/nv-fieldtime.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-icon.cjs.entry.js +4 -4
- package/dist/cjs/nv-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-iconbutton_2.cjs.entry.js +3 -3
- package/dist/cjs/nv-menu.cjs.entry.js +4 -2
- package/dist/cjs/nv-menu.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-menuitem.cjs.entry.js +2 -2
- package/dist/cjs/nv-popover.cjs.entry.js +2 -2
- package/dist/cjs/nv-row.cjs.entry.js +2 -2
- package/dist/cjs/nv-stack.cjs.entry.js +2 -2
- package/dist/cjs/nv-table.cjs.entry.js +3 -3
- package/dist/cjs/nv-table.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-tablecolumn.cjs.entry.js +1 -1
- package/dist/cjs/nv-toggle.cjs.entry.js +3 -3
- package/dist/cjs/nv-tooltip.cjs.entry.js +3 -3
- package/dist/cjs/nv-tooltip.cjs.entry.js.map +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/nv-alert/nv-alert.css +3 -0
- package/dist/collection/components/nv-alert/nv-alert.js +6 -11
- package/dist/collection/components/nv-alert/nv-alert.js.map +1 -1
- package/dist/collection/components/nv-badge/nv-badge.css +181 -1
- package/dist/collection/components/nv-badge/nv-badge.docs.js +20 -1
- package/dist/collection/components/nv-badge/nv-badge.docs.js.map +1 -1
- package/dist/collection/components/nv-badge/nv-badge.js +39 -15
- package/dist/collection/components/nv-badge/nv-badge.js.map +1 -1
- package/dist/collection/components/nv-breadcrumbs/nv-breadcrumbs.docs.js +0 -1
- package/dist/collection/components/nv-breadcrumbs/nv-breadcrumbs.docs.js.map +1 -1
- package/dist/collection/components/nv-calendar/nv-calendar.css +25 -2
- package/dist/collection/components/nv-calendar/nv-calendar.docs.js +33 -38
- package/dist/collection/components/nv-calendar/nv-calendar.docs.js.map +1 -1
- package/dist/collection/components/nv-calendar/nv-calendar.js +659 -897
- package/dist/collection/components/nv-calendar/nv-calendar.js.map +1 -1
- package/dist/collection/components/nv-calendar/nv-calendar.utils.js +202 -0
- package/dist/collection/components/nv-calendar/nv-calendar.utils.js.map +1 -0
- package/dist/collection/components/nv-calendar/test/nv-calendar.utils.test.js +667 -0
- package/dist/collection/components/nv-calendar/test/nv-calendar.utils.test.js.map +1 -0
- package/dist/collection/components/nv-datagrid/nv-datagrid.css +98 -0
- package/dist/collection/components/nv-datagrid/nv-datagrid.docs.js +232 -51
- package/dist/collection/components/nv-datagrid/nv-datagrid.docs.js.map +1 -1
- package/dist/collection/components/nv-datagrid/nv-datagrid.js +437 -160
- package/dist/collection/components/nv-datagrid/nv-datagrid.js.map +1 -1
- package/dist/collection/components/nv-datagridcolumn/nv-datagridcolumn.js +20 -1
- package/dist/collection/components/nv-datagridcolumn/nv-datagridcolumn.js.map +1 -1
- package/dist/collection/components/nv-dialog/nv-dialog.css +29 -5
- package/dist/collection/components/nv-dialog/nv-dialog.docs.js +0 -1
- package/dist/collection/components/nv-dialog/nv-dialog.docs.js.map +1 -1
- package/dist/collection/components/nv-dialog/nv-dialog.js +16 -10
- package/dist/collection/components/nv-dialog/nv-dialog.js.map +1 -1
- package/dist/collection/components/nv-fielddate/nv-fielddate.docs.js +16 -8
- package/dist/collection/components/nv-fielddate/nv-fielddate.docs.js.map +1 -1
- package/dist/collection/components/nv-fielddate/nv-fielddate.js +48 -39
- package/dist/collection/components/nv-fielddate/nv-fielddate.js.map +1 -1
- package/dist/collection/components/nv-fielddate/styles/nv-fielddate.css +14 -1
- package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.docs.js +12 -15
- package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.docs.js.map +1 -1
- package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.js +147 -68
- package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.js.map +1 -1
- package/dist/collection/components/nv-fielddaterange/styles/nv-fielddaterange.css +20 -12
- package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.docs.js +16 -0
- package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.docs.js.map +1 -1
- package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.js +197 -103
- package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.js.map +1 -1
- package/dist/collection/components/nv-fielddropdown/styles/nv-fielddropdown.css +36 -1
- package/dist/collection/components/nv-fielddropdownitem/nv-fielddropdownitem.js +1 -1
- package/dist/collection/components/nv-fielddropdownitemcheck/nv-fielddropdownitemcheck.js +1 -1
- package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.docs.js +8 -1
- package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.docs.js.map +1 -1
- package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.js +228 -190
- package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.js.map +1 -1
- package/dist/collection/components/nv-fieldmultiselect/{nv-fieldmultiselect.css → styles/nv-fieldmultiselect.css} +36 -1
- package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.css +12 -1
- package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.docs.js +8 -0
- package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.docs.js.map +1 -1
- package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.js +27 -3
- package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.js.map +1 -1
- package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.css +12 -1
- package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.docs.js +8 -0
- package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.docs.js.map +1 -1
- package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.js +27 -3
- package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.js.map +1 -1
- package/dist/collection/components/nv-fieldradio/nv-fieldradio.js +3 -3
- package/dist/collection/components/nv-fieldselect/nv-fieldselect.css +12 -1
- package/dist/collection/components/nv-fieldselect/nv-fieldselect.docs.js +8 -0
- package/dist/collection/components/nv-fieldselect/nv-fieldselect.docs.js.map +1 -1
- package/dist/collection/components/nv-fieldselect/nv-fieldselect.js +29 -5
- package/dist/collection/components/nv-fieldselect/nv-fieldselect.js.map +1 -1
- package/dist/collection/components/nv-fieldslider/nv-fieldslider.docs.js +264 -0
- package/dist/collection/components/nv-fieldslider/nv-fieldslider.docs.js.map +1 -0
- package/dist/collection/components/nv-fieldslider/nv-fieldslider.js +1035 -0
- package/dist/collection/components/nv-fieldslider/nv-fieldslider.js.map +1 -0
- package/dist/collection/components/nv-fieldslider/nv-fieldslider.utils.js +77 -0
- package/dist/collection/components/nv-fieldslider/nv-fieldslider.utils.js.map +1 -0
- package/dist/collection/components/nv-fieldslider/partials/field-input.js +33 -0
- package/dist/collection/components/nv-fieldslider/partials/field-input.js.map +1 -0
- package/dist/collection/components/nv-fieldslider/partials/range-thumb.js +34 -0
- package/dist/collection/components/nv-fieldslider/partials/range-thumb.js.map +1 -0
- package/dist/collection/components/nv-fieldslider/partials/single-thumb.js +18 -0
- package/dist/collection/components/nv-fieldslider/partials/single-thumb.js.map +1 -0
- package/dist/collection/components/nv-fieldslider/partials/tick-marks.js +18 -0
- package/dist/collection/components/nv-fieldslider/partials/tick-marks.js.map +1 -0
- package/dist/collection/components/nv-fieldslider/styles/nv-fieldslider.css +267 -0
- package/dist/collection/components/nv-fieldslider/test/nv-fieldslider.utils.test.js +159 -0
- package/dist/collection/components/nv-fieldslider/test/nv-fieldslider.utils.test.js.map +1 -0
- package/dist/collection/components/nv-fieldtext/nv-fieldtext.css +20 -1
- package/dist/collection/components/nv-fieldtext/nv-fieldtext.docs.js +17 -1
- package/dist/collection/components/nv-fieldtext/nv-fieldtext.docs.js.map +1 -1
- package/dist/collection/components/nv-fieldtext/nv-fieldtext.js +28 -3
- package/dist/collection/components/nv-fieldtext/nv-fieldtext.js.map +1 -1
- package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.css +30 -1
- package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.docs.js +8 -0
- package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.docs.js.map +1 -1
- package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.js +27 -3
- package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.js.map +1 -1
- package/dist/collection/components/nv-fieldtime/nv-fieldtime.js +13 -10
- package/dist/collection/components/nv-fieldtime/nv-fieldtime.js.map +1 -1
- package/dist/collection/components/nv-fieldtime/styles/nv-fieldtime.css +26 -3
- package/dist/collection/components/nv-icon/nv-icon.js +1 -1
- package/dist/collection/components/nv-icon/nv-icons.js +4 -470
- package/dist/collection/components/nv-icon/nv-icons.js.map +1 -1
- package/dist/collection/components/nv-iconbutton/nv-iconbutton.js +1 -1
- package/dist/collection/components/nv-loader/nv-loader.js +1 -1
- package/dist/collection/components/nv-menu/nv-menu.js +3 -1
- package/dist/collection/components/nv-menu/nv-menu.js.map +1 -1
- package/dist/collection/components/nv-menuitem/nv-menuitem.js +2 -2
- package/dist/collection/components/nv-popover/nv-popover.js +1 -1
- package/dist/collection/components/nv-row/nv-row.js +1 -1
- package/dist/collection/components/nv-stack/nv-stack.js +1 -1
- package/dist/collection/components/nv-table/nv-table.js +8 -11
- package/dist/collection/components/nv-table/nv-table.js.map +1 -1
- package/dist/collection/components/nv-toggle/nv-toggle.js +2 -2
- package/dist/collection/components/nv-tooltip/nv-tooltip.css +1 -0
- package/dist/collection/components/nv-tooltip/nv-tooltip.js +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/interfaces/Column.js.map +1 -1
- package/dist/collection/templates/navigation.docs.js +0 -1
- package/dist/collection/templates/navigation.docs.js.map +1 -1
- package/dist/collection/utils/constants.js +11 -0
- package/dist/collection/utils/constants.js.map +1 -1
- package/dist/components/index.js +6 -472
- package/dist/components/index.js.map +1 -1
- package/dist/components/nv-alert.js +7 -7
- package/dist/components/nv-alert.js.map +1 -1
- package/dist/components/nv-avatar.js +3 -3
- package/dist/components/nv-badge.js +1 -1
- package/dist/components/nv-breadcrumb.js +3 -3
- package/dist/components/nv-breadcrumbs.js +1 -1
- package/dist/components/nv-button.js +1 -1
- package/dist/components/nv-calendar.js +1 -1
- package/dist/components/nv-col.js +1 -1
- package/dist/components/nv-datagrid.js +447 -102
- package/dist/components/nv-datagrid.js.map +1 -1
- package/dist/components/nv-datagridcolumn.js +4 -3
- package/dist/components/nv-datagridcolumn.js.map +1 -1
- package/dist/components/nv-dialog.js +24 -18
- package/dist/components/nv-dialog.js.map +1 -1
- package/dist/components/nv-dialogfooter.js +1 -1
- package/dist/components/nv-dialogheader.js +1 -1
- package/dist/components/nv-fieldcheckbox.js +1 -1
- package/dist/components/nv-fielddate.js +19 -27
- package/dist/components/nv-fielddate.js.map +1 -1
- package/dist/components/nv-fielddaterange.js +99 -44
- package/dist/components/nv-fielddaterange.js.map +1 -1
- package/dist/components/nv-fielddropdown.js +103 -69
- package/dist/components/nv-fielddropdown.js.map +1 -1
- package/dist/components/nv-fielddropdownitem.js +1 -1
- package/dist/components/nv-fielddropdownitemcheck.js +1 -1
- package/dist/components/nv-fieldmultiselect.js +139 -120
- package/dist/components/nv-fieldmultiselect.js.map +1 -1
- package/dist/components/nv-fieldnumber.js +14 -9
- package/dist/components/nv-fieldnumber.js.map +1 -1
- package/dist/components/nv-fieldpassword.js +13 -8
- package/dist/components/nv-fieldpassword.js.map +1 -1
- package/dist/components/nv-fieldradio.js +4 -4
- package/dist/components/nv-fieldselect.js +15 -10
- package/dist/components/nv-fieldselect.js.map +1 -1
- package/dist/components/nv-fieldslider.d.ts +11 -0
- package/dist/components/nv-fieldslider.js +726 -0
- package/dist/components/nv-fieldslider.js.map +1 -0
- package/dist/components/nv-fieldtext.js +1 -158
- package/dist/components/nv-fieldtext.js.map +1 -1
- package/dist/components/nv-fieldtextarea.js +11 -6
- package/dist/components/nv-fieldtextarea.js.map +1 -1
- package/dist/components/nv-fieldtime.js +20 -17
- package/dist/components/nv-fieldtime.js.map +1 -1
- package/dist/components/nv-icon.js +1 -1
- package/dist/components/nv-iconbutton.js +1 -1
- package/dist/components/nv-loader.js +1 -1
- package/dist/components/nv-menu.js +7 -5
- package/dist/components/nv-menu.js.map +1 -1
- package/dist/components/nv-menuitem.js +1 -1
- package/dist/components/nv-popover.js +1 -1
- package/dist/components/nv-row.js +2 -2
- package/dist/components/nv-stack.js +2 -2
- package/dist/components/nv-table.js +3 -3
- package/dist/components/nv-table.js.map +1 -1
- package/dist/components/nv-tablecolumn.js +1 -1
- package/dist/components/nv-toggle.js +3 -3
- package/dist/components/nv-tooltip.js +1 -1
- package/dist/components/{p-dc3faba3.js → p-04cb3a6f.js} +5 -5
- package/dist/components/{p-dc3faba3.js.map → p-04cb3a6f.js.map} +1 -1
- package/dist/components/p-07a89754.js +187 -0
- package/dist/components/p-07a89754.js.map +1 -0
- package/dist/components/{p-b7b78e64.js → p-0ab80d95.js} +3 -3
- package/dist/components/{p-b7b78e64.js.map → p-0ab80d95.js.map} +1 -1
- package/dist/components/{p-8348db09.js → p-1f505531.js} +15 -2
- package/dist/components/p-1f505531.js.map +1 -0
- package/dist/components/{p-02752770.js → p-33e231f4.js} +2 -2
- package/dist/components/{p-02752770.js.map → p-33e231f4.js.map} +1 -1
- package/dist/components/p-4656efae.js +1111 -0
- package/dist/components/p-4656efae.js.map +1 -0
- package/dist/components/{p-2012b8ba.js → p-581e67cc.js} +4 -4
- package/dist/components/{p-2012b8ba.js.map → p-581e67cc.js.map} +1 -1
- package/dist/components/{p-1c45c0f2.js → p-679e0fa9.js} +16 -4
- package/dist/components/p-679e0fa9.js.map +1 -0
- package/dist/components/p-76a30bf1.js +88 -0
- package/dist/components/p-76a30bf1.js.map +1 -0
- package/dist/components/{p-150daf68.js → p-83c8873a.js} +3 -3
- package/dist/components/{p-150daf68.js.map → p-83c8873a.js.map} +1 -1
- package/dist/components/{p-c14f6b8e.js → p-c0a91091.js} +5 -5
- package/dist/components/p-c0a91091.js.map +1 -0
- package/dist/components/{p-6c364a23.js → p-cbdc2c8b.js} +6 -6
- package/dist/components/{p-6c364a23.js.map → p-cbdc2c8b.js.map} +1 -1
- package/dist/components/{p-2d9ba7d3.js → p-cbe9521f.js} +4 -4
- package/dist/components/{p-2d9ba7d3.js.map → p-cbe9521f.js.map} +1 -1
- package/dist/components/{p-a30b55fc.js → p-d19b41d2.js} +2 -2
- package/dist/components/{p-a30b55fc.js.map → p-d19b41d2.js.map} +1 -1
- package/dist/components/{p-4d3ec142.js → p-d63f1cbe.js} +4 -4
- package/dist/components/{p-4d3ec142.js.map → p-d63f1cbe.js.map} +1 -1
- package/dist/components/{p-e00cbb8a.js → p-dd2273a3.js} +2 -2
- package/dist/components/{p-e00cbb8a.js.map → p-dd2273a3.js.map} +1 -1
- package/dist/components/p-f0a5e7e4.js +167 -0
- package/dist/components/p-f0a5e7e4.js.map +1 -0
- package/dist/components/{p-f4d86795.js → p-f1859ddc.js} +4 -4
- package/dist/components/{p-f4d86795.js.map → p-f1859ddc.js.map} +1 -1
- package/dist/esm/{constants-98e2dcc2.js → constants-b97e736d.js} +15 -2
- package/dist/esm/constants-b97e736d.js.map +1 -0
- package/dist/esm/{index-1fb7a9a6.js → index-8f0e5f19.js} +22 -6
- package/dist/esm/index-8f0e5f19.js.map +1 -0
- package/dist/esm/index.js +5 -471
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/native.js +3 -3
- package/dist/esm/nv-alert.entry.js +6 -6
- package/dist/esm/nv-alert.entry.js.map +1 -1
- package/dist/esm/nv-avatar.entry.js +2 -2
- package/dist/esm/nv-badge_2.entry.js +18 -9
- package/dist/esm/nv-badge_2.entry.js.map +1 -1
- package/dist/esm/nv-breadcrumb.entry.js +1 -1
- package/dist/esm/nv-breadcrumbs.entry.js +1 -1
- package/dist/esm/nv-button.entry.js +2 -2
- package/dist/esm/nv-calendar.entry.js +821 -843
- package/dist/esm/nv-calendar.entry.js.map +1 -1
- package/dist/esm/nv-col.entry.js +1 -1
- package/dist/esm/nv-datagrid.entry.js +423 -94
- package/dist/esm/nv-datagrid.entry.js.map +1 -1
- package/dist/esm/nv-datagridcolumn.entry.js +2 -2
- package/dist/esm/nv-datagridcolumn.entry.js.map +1 -1
- package/dist/esm/nv-dialog.entry.js +19 -13
- package/dist/esm/nv-dialog.entry.js.map +1 -1
- package/dist/esm/nv-dialogfooter_2.entry.js +2 -2
- package/dist/esm/nv-fieldcheckbox.entry.js +1 -1
- package/dist/esm/nv-fielddate.entry.js +9 -18
- package/dist/esm/nv-fielddate.entry.js.map +1 -1
- package/dist/esm/nv-fielddaterange.entry.js +85 -32
- package/dist/esm/nv-fielddaterange.entry.js.map +1 -1
- package/dist/esm/nv-fielddropdown.entry.js +88 -57
- package/dist/esm/nv-fielddropdown.entry.js.map +1 -1
- package/dist/esm/nv-fielddropdownitem.entry.js +2 -2
- package/dist/esm/nv-fieldmultiselect.entry.js +122 -104
- package/dist/esm/nv-fieldmultiselect.entry.js.map +1 -1
- package/dist/esm/nv-fieldnumber.entry.js +9 -5
- package/dist/esm/nv-fieldnumber.entry.js.map +1 -1
- package/dist/esm/nv-fieldpassword.entry.js +9 -5
- package/dist/esm/nv-fieldpassword.entry.js.map +1 -1
- package/dist/esm/nv-fieldradio.entry.js +4 -4
- package/dist/esm/nv-fieldselect.entry.js +11 -7
- package/dist/esm/nv-fieldselect.entry.js.map +1 -1
- package/dist/esm/nv-fieldslider.entry.js +659 -0
- package/dist/esm/nv-fieldslider.entry.js.map +1 -0
- package/dist/esm/nv-fieldtext.entry.js +9 -5
- package/dist/esm/nv-fieldtext.entry.js.map +1 -1
- package/dist/esm/nv-fieldtextarea.entry.js +9 -5
- package/dist/esm/nv-fieldtextarea.entry.js.map +1 -1
- package/dist/esm/nv-fieldtime.entry.js +16 -13
- package/dist/esm/nv-fieldtime.entry.js.map +1 -1
- package/dist/esm/nv-icon.entry.js +4 -4
- package/dist/esm/nv-icon.entry.js.map +1 -1
- package/dist/esm/nv-iconbutton_2.entry.js +3 -3
- package/dist/esm/nv-menu.entry.js +4 -2
- package/dist/esm/nv-menu.entry.js.map +1 -1
- package/dist/esm/nv-menuitem.entry.js +2 -2
- package/dist/esm/nv-popover.entry.js +2 -2
- package/dist/esm/nv-row.entry.js +2 -2
- package/dist/esm/nv-stack.entry.js +2 -2
- package/dist/esm/nv-table.entry.js +3 -3
- package/dist/esm/nv-table.entry.js.map +1 -1
- package/dist/esm/nv-tablecolumn.entry.js +1 -1
- package/dist/esm/nv-toggle.entry.js +3 -3
- package/dist/esm/nv-tooltip.entry.js +3 -3
- package/dist/esm/nv-tooltip.entry.js.map +1 -1
- package/dist/native/index.esm.js +1 -1
- package/dist/native/index.esm.js.map +1 -1
- package/dist/native/native.css +1 -1
- package/dist/native/native.esm.js +1 -1
- package/dist/native/native.esm.js.map +1 -1
- package/dist/native/{p-6b348684.entry.js → p-0323daf6.entry.js} +2 -2
- package/dist/native/{p-d5cbf5c8.entry.js → p-05d95d4d.entry.js} +2 -2
- package/dist/native/{p-fb5bddba.entry.js → p-0ec1e2e3.entry.js} +2 -2
- package/dist/native/{p-c7b201cd.entry.js → p-16a4cdf3.entry.js} +2 -2
- package/dist/native/p-19fb0fd0.entry.js +2 -0
- package/dist/native/p-19fb0fd0.entry.js.map +1 -0
- package/dist/native/p-1e3d3374.entry.js +2 -0
- package/dist/native/{p-9135fdf5.entry.js.map → p-1e3d3374.entry.js.map} +1 -1
- package/dist/native/p-21e7132f.entry.js +2 -0
- package/dist/native/p-21e7132f.entry.js.map +1 -0
- package/dist/native/p-221b8f72.entry.js +2 -0
- package/dist/native/p-221b8f72.entry.js.map +1 -0
- package/dist/native/p-2805f9f2.entry.js +2 -0
- package/dist/native/p-2805f9f2.entry.js.map +1 -0
- package/dist/native/p-3f2b6a22.entry.js +2 -0
- package/dist/native/p-3f2b6a22.entry.js.map +1 -0
- package/dist/native/{p-0245863d.entry.js → p-407fc32d.entry.js} +2 -2
- package/dist/native/{p-63e6aed3.entry.js → p-4c0d81b0.entry.js} +2 -2
- package/dist/native/p-4c0d81b0.entry.js.map +1 -0
- package/dist/native/{p-39bb95ff.entry.js → p-519b4819.entry.js} +2 -2
- package/dist/native/{p-fa77a591.entry.js → p-5382eab2.entry.js} +2 -2
- package/dist/native/p-5ba3fc3c.entry.js +2 -0
- package/dist/native/p-5ba3fc3c.entry.js.map +1 -0
- package/dist/native/{p-bad11367.entry.js → p-60b204ac.entry.js} +2 -2
- package/dist/native/p-60b204ac.entry.js.map +1 -0
- package/dist/native/p-7092a675.entry.js +2 -0
- package/dist/native/p-711a7778.js +3 -0
- package/dist/native/p-711a7778.js.map +1 -0
- package/dist/native/p-759c9ce4.entry.js +2 -0
- package/dist/native/p-759c9ce4.entry.js.map +1 -0
- package/dist/native/{p-d7a76400.entry.js → p-7c676f2c.entry.js} +2 -2
- package/dist/native/p-7c6edd1c.entry.js +2 -0
- package/dist/native/p-7c6edd1c.entry.js.map +1 -0
- package/dist/native/p-987c79d8.entry.js +2 -0
- package/dist/native/p-987c79d8.entry.js.map +1 -0
- package/dist/native/{p-f85aca27.entry.js → p-9fba8663.entry.js} +2 -2
- package/dist/native/{p-b094296d.entry.js → p-a2c0f1a7.entry.js} +2 -2
- package/dist/native/p-aa86af25.entry.js +2 -0
- package/dist/native/p-aa86af25.entry.js.map +1 -0
- package/dist/native/p-adc96c3a.entry.js +2 -0
- package/dist/native/p-adc96c3a.entry.js.map +1 -0
- package/dist/native/p-b0fc08e7.entry.js +2 -0
- package/dist/native/p-b0fc08e7.entry.js.map +1 -0
- package/dist/native/{p-6ff228da.entry.js → p-c930adb7.entry.js} +2 -2
- package/dist/native/{p-701b5557.entry.js → p-cfe0a6c6.entry.js} +2 -2
- package/dist/native/p-d07ab618.entry.js +2 -0
- package/dist/native/p-dac0089b.entry.js +2 -0
- package/dist/native/p-dac0089b.entry.js.map +1 -0
- package/dist/native/p-de2c07a6.entry.js +13 -0
- package/dist/native/p-de2c07a6.entry.js.map +1 -0
- package/dist/native/p-ed488498.entry.js +7 -0
- package/dist/native/p-ed488498.entry.js.map +1 -0
- package/dist/native/p-ef76178b.entry.js +2 -0
- package/dist/native/p-ef76178b.entry.js.map +1 -0
- package/dist/native/{p-e5de64d5.entry.js → p-f0ddf60b.entry.js} +2 -2
- package/dist/native/p-f39803d9.entry.js +2 -0
- package/dist/native/p-f39803d9.entry.js.map +1 -0
- package/dist/native/{p-59768ee5.js → p-f85c08f1.js} +2 -2
- package/dist/native/p-f85c08f1.js.map +1 -0
- package/dist/native/p-fb897f7d.entry.js +2 -0
- package/dist/native/p-fb897f7d.entry.js.map +1 -0
- package/dist/native/{p-244f56ac.entry.js → p-fc3bea07.entry.js} +2 -2
- package/dist/types/components/nv-alert/nv-alert.d.ts +1 -1
- package/dist/types/components/nv-badge/nv-badge.d.ts +11 -3
- package/dist/types/components/nv-calendar/nv-calendar.d.ts +70 -112
- package/dist/types/components/nv-calendar/nv-calendar.utils.d.ts +60 -0
- package/dist/types/components/nv-calendar/test/nv-calendar.utils.test.d.ts +1 -0
- package/dist/types/components/nv-datagrid/nv-datagrid.d.ts +47 -26
- package/dist/types/components/nv-datagridcolumn/nv-datagridcolumn.d.ts +4 -0
- package/dist/types/components/nv-dialog/nv-dialog.d.ts +4 -0
- package/dist/types/components/nv-fielddate/nv-fielddate.d.ts +6 -7
- package/dist/types/components/nv-fielddaterange/nv-fielddaterange.d.ts +23 -12
- package/dist/types/components/nv-fielddropdown/nv-fielddropdown.d.ts +51 -26
- package/dist/types/components/nv-fieldmultiselect/nv-fieldmultiselect.d.ts +65 -55
- package/dist/types/components/nv-fieldnumber/nv-fieldnumber.d.ts +4 -0
- package/dist/types/components/nv-fieldpassword/nv-fieldpassword.d.ts +4 -0
- package/dist/types/components/nv-fieldselect/nv-fieldselect.d.ts +4 -0
- package/dist/types/components/nv-fieldslider/nv-fieldslider.d.ts +230 -0
- package/dist/types/components/nv-fieldslider/nv-fieldslider.docs.d.ts +4 -0
- package/dist/types/components/nv-fieldslider/nv-fieldslider.utils.d.ts +46 -0
- package/dist/types/components/nv-fieldslider/partials/field-input.d.ts +45 -0
- package/dist/types/components/nv-fieldslider/partials/range-thumb.d.ts +37 -0
- package/dist/types/components/nv-fieldslider/partials/single-thumb.d.ts +35 -0
- package/dist/types/components/nv-fieldslider/partials/tick-marks.d.ts +28 -0
- package/dist/types/components/nv-fieldslider/test/nv-fieldslider.utils.test.d.ts +1 -0
- package/dist/types/components/nv-fieldtext/nv-fieldtext.d.ts +5 -0
- package/dist/types/components/nv-fieldtextarea/nv-fieldtextarea.d.ts +4 -0
- package/dist/types/components/nv-icon/nv-icons.d.ts +1 -1
- package/dist/types/components/nv-table/nv-table.d.ts +13 -2
- package/dist/types/components.d.ts +656 -154
- package/dist/types/index.d.ts +0 -2
- package/dist/types/interfaces/Column.d.ts +5 -1
- package/dist/types/utils/constants.d.ts +9 -0
- package/dist/vscode-data.json +292 -1546
- package/hydrate/index.js +2715 -1533
- package/hydrate/index.mjs +2715 -1533
- package/package.json +6 -2
- package/dist/cjs/constants-bcd6b2e2.js.map +0 -1
- package/dist/cjs/index-9bda5507.js.map +0 -1
- package/dist/collection/interfaces/actionEvent.js +0 -2
- package/dist/collection/interfaces/actionEvent.js.map +0 -1
- package/dist/collection/interfaces/calendarShortcut.js +0 -2
- package/dist/collection/interfaces/calendarShortcut.js.map +0 -1
- package/dist/collection/interfaces/dateRange.js +0 -2
- package/dist/collection/interfaces/dateRange.js.map +0 -1
- package/dist/components/p-1c45c0f2.js.map +0 -1
- package/dist/components/p-373926aa.js +0 -177
- package/dist/components/p-373926aa.js.map +0 -1
- package/dist/components/p-591730e7.js +0 -88
- package/dist/components/p-591730e7.js.map +0 -1
- package/dist/components/p-8348db09.js.map +0 -1
- package/dist/components/p-c14f6b8e.js.map +0 -1
- package/dist/components/p-f331117c.js +0 -1133
- package/dist/components/p-f331117c.js.map +0 -1
- package/dist/esm/constants-98e2dcc2.js.map +0 -1
- package/dist/esm/index-1fb7a9a6.js.map +0 -1
- package/dist/native/p-0ee428d5.entry.js +0 -2
- package/dist/native/p-0ee428d5.entry.js.map +0 -1
- package/dist/native/p-2691e02d.entry.js +0 -2
- package/dist/native/p-37f0210e.entry.js +0 -2
- package/dist/native/p-37f0210e.entry.js.map +0 -1
- package/dist/native/p-4a440970.entry.js +0 -2
- package/dist/native/p-4a440970.entry.js.map +0 -1
- package/dist/native/p-4ae26462.entry.js +0 -7
- package/dist/native/p-4ae26462.entry.js.map +0 -1
- package/dist/native/p-4d9c4618.entry.js +0 -2
- package/dist/native/p-4d9c4618.entry.js.map +0 -1
- package/dist/native/p-4dc1d036.entry.js +0 -2
- package/dist/native/p-59768ee5.js.map +0 -1
- package/dist/native/p-59e0bd2b.entry.js +0 -2
- package/dist/native/p-59e0bd2b.entry.js.map +0 -1
- package/dist/native/p-5c00f092.entry.js +0 -2
- package/dist/native/p-5c00f092.entry.js.map +0 -1
- package/dist/native/p-63e6aed3.entry.js.map +0 -1
- package/dist/native/p-7f5eb2ac.entry.js +0 -2
- package/dist/native/p-7f5eb2ac.entry.js.map +0 -1
- package/dist/native/p-84a73e2a.entry.js +0 -2
- package/dist/native/p-84a73e2a.entry.js.map +0 -1
- package/dist/native/p-9135fdf5.entry.js +0 -2
- package/dist/native/p-93dc2f47.entry.js +0 -2
- package/dist/native/p-93dc2f47.entry.js.map +0 -1
- package/dist/native/p-9a267f16.entry.js +0 -13
- package/dist/native/p-9a267f16.entry.js.map +0 -1
- package/dist/native/p-9d6431c7.entry.js +0 -2
- package/dist/native/p-9d6431c7.entry.js.map +0 -1
- package/dist/native/p-ab002252.js +0 -3
- package/dist/native/p-ab002252.js.map +0 -1
- package/dist/native/p-b2ce83ad.entry.js +0 -2
- package/dist/native/p-b2ce83ad.entry.js.map +0 -1
- package/dist/native/p-bad11367.entry.js.map +0 -1
- package/dist/native/p-e1a4f776.entry.js +0 -2
- package/dist/native/p-e1a4f776.entry.js.map +0 -1
- package/dist/native/p-e49bbd02.entry.js +0 -2
- package/dist/native/p-e49bbd02.entry.js.map +0 -1
- package/dist/native/p-eee01062.entry.js +0 -2
- package/dist/native/p-eee01062.entry.js.map +0 -1
- package/dist/native/p-f6bdc270.entry.js +0 -2
- package/dist/native/p-f6bdc270.entry.js.map +0 -1
- package/dist/types/interfaces/actionEvent.d.ts +0 -13
- package/dist/types/interfaces/calendarShortcut.d.ts +0 -17
- package/dist/types/interfaces/dateRange.d.ts +0 -13
- /package/dist/native/{p-6b348684.entry.js.map → p-0323daf6.entry.js.map} +0 -0
- /package/dist/native/{p-d5cbf5c8.entry.js.map → p-05d95d4d.entry.js.map} +0 -0
- /package/dist/native/{p-fb5bddba.entry.js.map → p-0ec1e2e3.entry.js.map} +0 -0
- /package/dist/native/{p-c7b201cd.entry.js.map → p-16a4cdf3.entry.js.map} +0 -0
- /package/dist/native/{p-0245863d.entry.js.map → p-407fc32d.entry.js.map} +0 -0
- /package/dist/native/{p-39bb95ff.entry.js.map → p-519b4819.entry.js.map} +0 -0
- /package/dist/native/{p-fa77a591.entry.js.map → p-5382eab2.entry.js.map} +0 -0
- /package/dist/native/{p-2691e02d.entry.js.map → p-7092a675.entry.js.map} +0 -0
- /package/dist/native/{p-d7a76400.entry.js.map → p-7c676f2c.entry.js.map} +0 -0
- /package/dist/native/{p-f85aca27.entry.js.map → p-9fba8663.entry.js.map} +0 -0
- /package/dist/native/{p-b094296d.entry.js.map → p-a2c0f1a7.entry.js.map} +0 -0
- /package/dist/native/{p-6ff228da.entry.js.map → p-c930adb7.entry.js.map} +0 -0
- /package/dist/native/{p-701b5557.entry.js.map → p-cfe0a6c6.entry.js.map} +0 -0
- /package/dist/native/{p-4dc1d036.entry.js.map → p-d07ab618.entry.js.map} +0 -0
- /package/dist/native/{p-e5de64d5.entry.js.map → p-f0ddf60b.entry.js.map} +0 -0
- /package/dist/native/{p-244f56ac.entry.js.map → p-fc3bea07.entry.js.map} +0 -0
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import { h, Host, } from "@stencil/core";
|
|
3
|
-
import { createTable, getCoreRowModel, createColumnHelper, getFilteredRowModel, getPaginationRowModel, } from "@tanstack/table-core";
|
|
3
|
+
import { createTable, getCoreRowModel, createColumnHelper, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, } from "@tanstack/table-core";
|
|
4
4
|
import { deepCopyElement, excludedProps } from "../../utils/dom.utils";
|
|
5
5
|
import { debounce } from "../../utils/input.utils";
|
|
6
|
+
import { SortingPossibility, } from "../../utils/constants";
|
|
6
7
|
/**
|
|
7
8
|
* A flexible data grid component powered by `@tanstack/table-core`.
|
|
8
9
|
* @slot default - Use this slot to insert HTML into the data grid content.
|
|
9
10
|
* @slot before - Use this slot to insert HTML before the data grid.
|
|
10
11
|
* @slot after - Use this slot to insert HTML after the data grid.
|
|
11
|
-
*
|
|
12
|
-
* @deprecated [EXPERIMENTAL]
|
|
13
|
-
* @experimental - This component is still under development and is not ready for use.
|
|
14
12
|
*/
|
|
15
13
|
export class NvDatagrid {
|
|
16
14
|
constructor() {
|
|
@@ -25,6 +23,8 @@ export class NvDatagrid {
|
|
|
25
23
|
this.globalFilterSearchTerm = '';
|
|
26
24
|
this.columnData = [];
|
|
27
25
|
this.paginationState = null;
|
|
26
|
+
this.sorting = [];
|
|
27
|
+
this.rowSelectionState = {};
|
|
28
28
|
//#endregion STATES
|
|
29
29
|
/****************************************************************************/
|
|
30
30
|
//#region PROPERTIES
|
|
@@ -60,6 +60,12 @@ export class NvDatagrid {
|
|
|
60
60
|
* @default 'No data or columns available to display.'
|
|
61
61
|
*/
|
|
62
62
|
this.noColumnsNoDataMessage = 'No data or columns available to display.';
|
|
63
|
+
/**
|
|
64
|
+
* Whether to automatically generate columns if none are provided.
|
|
65
|
+
* If columns are explicitly set, this property is ignored.
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
this.autoGenerateColumns = false;
|
|
63
69
|
/**
|
|
64
70
|
* Whether to enable global filtering for the data grid.
|
|
65
71
|
* This allows users to search across all columns for a specific value.
|
|
@@ -69,11 +75,9 @@ export class NvDatagrid {
|
|
|
69
75
|
*/
|
|
70
76
|
this.enableGlobalFilter = false;
|
|
71
77
|
/**
|
|
72
|
-
*
|
|
73
|
-
* If columns are explicitly set, this property is ignored.
|
|
74
|
-
* @default false
|
|
78
|
+
* Position the global filter input field
|
|
75
79
|
*/
|
|
76
|
-
this.
|
|
80
|
+
this.globalFilterPosition = 'end';
|
|
77
81
|
/**
|
|
78
82
|
* Whether to enable pagination for the data grid.
|
|
79
83
|
* @default false
|
|
@@ -81,6 +85,7 @@ export class NvDatagrid {
|
|
|
81
85
|
this.enablePagination = false;
|
|
82
86
|
/**
|
|
83
87
|
* The number of rows to display per page.
|
|
88
|
+
* If the number is not present in the property pageSizes it takes the first of the list.
|
|
84
89
|
* @default 10
|
|
85
90
|
*/
|
|
86
91
|
this.pageSize = 10;
|
|
@@ -89,6 +94,15 @@ export class NvDatagrid {
|
|
|
89
94
|
* @default [10, 20, 30, 40, 50]
|
|
90
95
|
*/
|
|
91
96
|
this.pageSizes = [10, 20, 30, 40, 50];
|
|
97
|
+
/**
|
|
98
|
+
* Whether to enable sorting for the data grid.
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
101
|
+
this.enableSorting = false;
|
|
102
|
+
/**
|
|
103
|
+
* Whether to enable row selection for the data grid.
|
|
104
|
+
*/
|
|
105
|
+
this.enableRowSelection = false;
|
|
92
106
|
this.debouncedFilter = debounce((value) => {
|
|
93
107
|
var _a;
|
|
94
108
|
(_a = this.table) === null || _a === void 0 ? void 0 : _a.setGlobalFilter(value);
|
|
@@ -121,8 +135,32 @@ export class NvDatagrid {
|
|
|
121
135
|
};
|
|
122
136
|
this.handlePageSizeChange = (event) => {
|
|
123
137
|
const target = event.target;
|
|
138
|
+
let effectivePageSize = Number(target.value);
|
|
139
|
+
if (!this.pageSizes.includes(effectivePageSize) && this.pageSizes) {
|
|
140
|
+
effectivePageSize = this.pageSizes[0];
|
|
141
|
+
}
|
|
124
142
|
// Simply use `setPageSize` to update the page size directly
|
|
125
|
-
this.paginationState = Object.assign(Object.assign({}, this.paginationState), { pageSize:
|
|
143
|
+
this.paginationState = Object.assign(Object.assign({}, this.paginationState), { pageSize: effectivePageSize }); // This triggers the paginationState watcher
|
|
144
|
+
};
|
|
145
|
+
this.handleSortingClick = (event, header) => {
|
|
146
|
+
var _a;
|
|
147
|
+
if (!header.column.getCanSort()) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
(_a = header.column.getToggleSortingHandler()) === null || _a === void 0 ? void 0 : _a(event);
|
|
151
|
+
};
|
|
152
|
+
this.getSortTitle = (header) => {
|
|
153
|
+
if (!header.column.getCanSort())
|
|
154
|
+
return;
|
|
155
|
+
const nextOrder = header.column.getNextSortingOrder();
|
|
156
|
+
switch (nextOrder) {
|
|
157
|
+
case SortingPossibility.Asc:
|
|
158
|
+
return 'Sort ascending';
|
|
159
|
+
case SortingPossibility.Desc:
|
|
160
|
+
return 'Sort descending';
|
|
161
|
+
default:
|
|
162
|
+
return 'Clear sort';
|
|
163
|
+
}
|
|
126
164
|
};
|
|
127
165
|
}
|
|
128
166
|
//#endregion PROPERTIES
|
|
@@ -158,34 +196,37 @@ export class NvDatagrid {
|
|
|
158
196
|
header: col.header,
|
|
159
197
|
accessor: col.accessor,
|
|
160
198
|
repeatTemplate: col.hasAttribute('repeat-template'),
|
|
199
|
+
group: col.group,
|
|
161
200
|
};
|
|
162
201
|
this.columnData.push(colData);
|
|
163
202
|
});
|
|
203
|
+
console.info('cacheTemplates this.columnData:', this.columnData);
|
|
164
204
|
}
|
|
165
205
|
parseDataAndColumns() {
|
|
166
|
-
if (this.
|
|
167
|
-
this.parseJsonData(this.dataJson);
|
|
168
|
-
}
|
|
169
|
-
else if (this.data && this.data.length > 0) {
|
|
206
|
+
if (this.data && this.data.length > 0) {
|
|
170
207
|
this.parseDataArray(this.data, this.parsedData);
|
|
171
208
|
}
|
|
172
|
-
if (this.
|
|
173
|
-
this.parseJsonColumns(this.columnsJson, this.parsedColumns);
|
|
174
|
-
}
|
|
175
|
-
else if (this.columns && this.columns.length > 0) {
|
|
209
|
+
if (this.columns && this.columns.length > 0) {
|
|
176
210
|
this.parseColumnsArray(this.columns, this.parsedColumns);
|
|
177
211
|
}
|
|
178
212
|
else if (this.headerTemplateCache.size > 0) {
|
|
179
213
|
const headerKeys = Array.from(this.headerTemplateCache.keys());
|
|
180
|
-
const arrayColumnsConfig = headerKeys.map(key =>
|
|
214
|
+
const arrayColumnsConfig = headerKeys.map(key => {
|
|
215
|
+
var _a, _b;
|
|
216
|
+
return (Object.assign({}, { accessor: key, header: key ? key.charAt(0).toUpperCase() + key.slice(1) : '', group: (_b = (_a = this.columnData.find(x => x.accessor === key)) === null || _a === void 0 ? void 0 : _a.group) !== null && _b !== void 0 ? _b : 'ungrouped' }));
|
|
217
|
+
});
|
|
181
218
|
this.parseColumnsArray(arrayColumnsConfig, this.parsedColumns);
|
|
182
219
|
}
|
|
183
220
|
else if (this.parsedData.length > 0) {
|
|
184
221
|
const firstRow = this.parsedData[0];
|
|
185
|
-
const arrayColumnsConfig = Object.keys(firstRow).map(key =>
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
222
|
+
const arrayColumnsConfig = Object.keys(firstRow).map(key => {
|
|
223
|
+
var _a, _b;
|
|
224
|
+
return ({
|
|
225
|
+
accessor: key,
|
|
226
|
+
header: key.charAt(0).toUpperCase() + key.slice(1),
|
|
227
|
+
group: (_b = (_a = this.columnData.find(x => x.accessor === key)) === null || _a === void 0 ? void 0 : _a.group) !== null && _b !== void 0 ? _b : 'ungrouped',
|
|
228
|
+
});
|
|
229
|
+
});
|
|
189
230
|
if (this.autoGenerateColumns) {
|
|
190
231
|
this.parseColumnsArray(arrayColumnsConfig, this.parsedColumns);
|
|
191
232
|
}
|
|
@@ -228,6 +269,7 @@ export class NvDatagrid {
|
|
|
228
269
|
var _a, _b, _c, _d;
|
|
229
270
|
// Clear the previous table instance (if any)
|
|
230
271
|
this.table = null;
|
|
272
|
+
console.info('initializeTable this.columnData:', this.columnData);
|
|
231
273
|
// Set default options for the table
|
|
232
274
|
const tableOptions = {
|
|
233
275
|
columns: [],
|
|
@@ -288,10 +330,14 @@ export class NvDatagrid {
|
|
|
288
330
|
if (hasData) {
|
|
289
331
|
// No parsed columns and data is available
|
|
290
332
|
const firstRow = this.parsedData[0];
|
|
291
|
-
const arrayColumnsConfig = Object.keys(firstRow).map(key =>
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
333
|
+
const arrayColumnsConfig = Object.keys(firstRow).map(key => {
|
|
334
|
+
var _a, _b;
|
|
335
|
+
return ({
|
|
336
|
+
accessor: key,
|
|
337
|
+
header: key.charAt(0).toUpperCase() + key.slice(1),
|
|
338
|
+
group: (_b = (_a = this.columnData.find(x => x.accessor === key)) === null || _a === void 0 ? void 0 : _a.group) !== null && _b !== void 0 ? _b : 'ungrouped',
|
|
339
|
+
});
|
|
340
|
+
});
|
|
295
341
|
if (this.autoGenerateColumns) {
|
|
296
342
|
this.parseColumnsArray(arrayColumnsConfig, this.parsedColumns);
|
|
297
343
|
}
|
|
@@ -315,9 +361,14 @@ export class NvDatagrid {
|
|
|
315
361
|
}
|
|
316
362
|
if (this.enablePagination) {
|
|
317
363
|
tableOptions.getPaginationRowModel = getPaginationRowModel();
|
|
364
|
+
const pageIndex = (_b = (_a = this.paginationState) === null || _a === void 0 ? void 0 : _a.pageIndex) !== null && _b !== void 0 ? _b : 0;
|
|
365
|
+
let effectivePageSize = (_d = (_c = this.paginationState) === null || _c === void 0 ? void 0 : _c.pageSize) !== null && _d !== void 0 ? _d : 10;
|
|
366
|
+
if (!this.pageSizes.includes(effectivePageSize) && this.pageSizes) {
|
|
367
|
+
effectivePageSize = this.pageSizes[0];
|
|
368
|
+
}
|
|
318
369
|
const pagination = {
|
|
319
|
-
pageIndex:
|
|
320
|
-
pageSize:
|
|
370
|
+
pageIndex: pageIndex,
|
|
371
|
+
pageSize: effectivePageSize,
|
|
321
372
|
};
|
|
322
373
|
// Set the initial pagination value with safeguards
|
|
323
374
|
tableOptions.state.pagination = pagination;
|
|
@@ -328,6 +379,33 @@ export class NvDatagrid {
|
|
|
328
379
|
this.paginationState = newPagination;
|
|
329
380
|
};
|
|
330
381
|
}
|
|
382
|
+
if (this.enableSorting) {
|
|
383
|
+
tableOptions.getSortedRowModel = getSortedRowModel();
|
|
384
|
+
tableOptions.enableSorting = this.enableSorting;
|
|
385
|
+
tableOptions.state.sorting = this.sorting;
|
|
386
|
+
tableOptions.onSortingChange = updater => {
|
|
387
|
+
const newSorting = typeof updater === 'function' ? updater(this.sorting) : updater;
|
|
388
|
+
this.sorting = newSorting; // Will automatically trigger the searchTerm watcher and update the table
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
if (this.enableRowSelection) {
|
|
392
|
+
tableOptions.state.rowSelection = this.rowSelectionState;
|
|
393
|
+
tableOptions.onRowSelectionChange = updater => {
|
|
394
|
+
const newRowSelectionState = typeof updater === 'function'
|
|
395
|
+
? updater(this.rowSelectionState)
|
|
396
|
+
: updater;
|
|
397
|
+
this.rowSelectionState = newRowSelectionState;
|
|
398
|
+
// Emit the original rows instead of IDs
|
|
399
|
+
const selectedRows = Object.keys(newRowSelectionState)
|
|
400
|
+
.filter(rowId => newRowSelectionState[rowId])
|
|
401
|
+
.map(rowId => {
|
|
402
|
+
// Assuming rowId corresponds to the index in parsedData
|
|
403
|
+
const index = parseInt(rowId, 10); // Convert rowId to an integer index
|
|
404
|
+
return this.parsedData[index]; // Get the original row data
|
|
405
|
+
});
|
|
406
|
+
this.selectedRows.emit(selectedRows); // Emit the original rows
|
|
407
|
+
};
|
|
408
|
+
}
|
|
331
409
|
// Initialize the table
|
|
332
410
|
this.table = createTable(tableOptions);
|
|
333
411
|
}
|
|
@@ -362,60 +440,165 @@ export class NvDatagrid {
|
|
|
362
440
|
};
|
|
363
441
|
return checkValue(row.original);
|
|
364
442
|
}
|
|
443
|
+
createIconSpan(checked, indeterminate) {
|
|
444
|
+
const span = document.createElement('span');
|
|
445
|
+
span.className = 'icon';
|
|
446
|
+
if (checked && !indeterminate) {
|
|
447
|
+
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
448
|
+
svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
449
|
+
svg.setAttribute('width', '14');
|
|
450
|
+
svg.setAttribute('height', '14');
|
|
451
|
+
svg.setAttribute('viewBox', '0 0 14 14');
|
|
452
|
+
svg.setAttribute('fill', 'none');
|
|
453
|
+
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
454
|
+
path.setAttribute('d', 'M11.6667 3.5L5.25004 9.91667L2.33337 7');
|
|
455
|
+
path.setAttribute('stroke-linecap', 'round');
|
|
456
|
+
path.setAttribute('stroke-linejoin', 'round');
|
|
457
|
+
svg.appendChild(path);
|
|
458
|
+
span.appendChild(svg);
|
|
459
|
+
}
|
|
460
|
+
if (indeterminate) {
|
|
461
|
+
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
462
|
+
svg.classList.add('indeterminate-svg');
|
|
463
|
+
svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
464
|
+
svg.setAttribute('viewBox', '0 0 14 14');
|
|
465
|
+
svg.setAttribute('fill', 'none');
|
|
466
|
+
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
467
|
+
path.setAttribute('d', 'M2.9165 7H11.0832');
|
|
468
|
+
path.setAttribute('stroke-linecap', 'round');
|
|
469
|
+
path.setAttribute('stroke-linejoin', 'round');
|
|
470
|
+
svg.appendChild(path);
|
|
471
|
+
span.appendChild(svg);
|
|
472
|
+
}
|
|
473
|
+
return span;
|
|
474
|
+
}
|
|
475
|
+
createIndeterminateCheckbox(options = {}) {
|
|
476
|
+
const { indeterminate, checked = false, disabled = false, className = '', onChange, } = options;
|
|
477
|
+
const input = document.createElement('input');
|
|
478
|
+
input.type = 'checkbox';
|
|
479
|
+
input.checked = checked;
|
|
480
|
+
input.disabled = disabled;
|
|
481
|
+
input.className = `${className} cursor-pointer`.trim();
|
|
482
|
+
if (typeof indeterminate === 'boolean') {
|
|
483
|
+
input.indeterminate = !checked && indeterminate;
|
|
484
|
+
}
|
|
485
|
+
if (onChange) {
|
|
486
|
+
input.addEventListener('change', onChange);
|
|
487
|
+
}
|
|
488
|
+
const iconSpan = this.createIconSpan(checked, indeterminate);
|
|
489
|
+
const container = document.createElement('div');
|
|
490
|
+
container.className = 'checkbox-container';
|
|
491
|
+
container.appendChild(input);
|
|
492
|
+
container.appendChild(iconSpan);
|
|
493
|
+
return container;
|
|
494
|
+
}
|
|
365
495
|
// Helper function to generate column definitions
|
|
366
496
|
generateColumns(validColumns, tableOptions) {
|
|
497
|
+
console.info('generateColumns this.columnData:', this.columnData);
|
|
498
|
+
console.info('generateColumns validColumns:', validColumns);
|
|
499
|
+
let processedColumns = validColumns || [];
|
|
367
500
|
const columnHelper = createColumnHelper();
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
501
|
+
// If no columns provided or autoGenerateColumns is true, generate them from data
|
|
502
|
+
if ((!validColumns && tableOptions.data && tableOptions.data.length > 0) ||
|
|
503
|
+
(validColumns.length <= 0 &&
|
|
504
|
+
tableOptions.data &&
|
|
505
|
+
tableOptions.data.length > 0)) {
|
|
506
|
+
const sampleRow = tableOptions.data[0];
|
|
507
|
+
processedColumns = Object.keys(sampleRow).map(key => {
|
|
371
508
|
var _a, _b;
|
|
372
|
-
return
|
|
373
|
-
header:
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
const cellAccessors = column.accessor;
|
|
379
|
-
const row = info.row;
|
|
380
|
-
return ((_a = this.columnData.find(x => x.accessor === cellAccessors)) === null || _a === void 0 ? void 0 : _a.repeatTemplate) && Array.isArray(value)
|
|
381
|
-
? value.map((item) => {
|
|
382
|
-
var _a, _b;
|
|
383
|
-
return (_b = (_a = (this.renderTemplate(this.templateCache.get(cellAccessors), item, row) ||
|
|
384
|
-
item)) !== null && _a !== void 0 ? _a : value) !== null && _b !== void 0 ? _b : this.fallbackValue;
|
|
385
|
-
})
|
|
386
|
-
: (_c = (_b = (this.renderTemplate(this.templateCache.get(cellAccessors), value, row) ||
|
|
387
|
-
value)) !== null && _b !== void 0 ? _b : value) !== null && _c !== void 0 ? _c : this.fallbackValue;
|
|
388
|
-
},
|
|
389
|
-
enableGlobalFilter: this.enableGlobalFilter,
|
|
509
|
+
return ({
|
|
510
|
+
header: key.charAt(0).toUpperCase() + key.slice(1),
|
|
511
|
+
accessor: key,
|
|
512
|
+
group: (_b = (_a = this.columnData.find(x => x.accessor === key)) === null || _a === void 0 ? void 0 : _a.group) !== null && _b !== void 0 ? _b : 'ungrouped',
|
|
513
|
+
headerSlot: null,
|
|
514
|
+
cellSlot: null,
|
|
390
515
|
});
|
|
391
516
|
});
|
|
392
517
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
518
|
+
// Group columns by their group property
|
|
519
|
+
const groupedColumns = processedColumns.reduce((acc, column) => {
|
|
520
|
+
let group = column.group || 'ungrouped';
|
|
521
|
+
if (group == 'ungrouped') {
|
|
522
|
+
group = group + processedColumns.findIndex(x => x == column);
|
|
523
|
+
}
|
|
524
|
+
if (!acc[group]) {
|
|
525
|
+
acc[group] = [];
|
|
526
|
+
}
|
|
527
|
+
acc[group].push(column);
|
|
528
|
+
return acc;
|
|
529
|
+
}, {});
|
|
530
|
+
// Transform each column into a ColumnDef
|
|
531
|
+
const createColumnDef = (column) => {
|
|
532
|
+
var _a, _b, _c;
|
|
533
|
+
return columnHelper.accessor(column.accessor, {
|
|
534
|
+
header: (_c = (_b = this.renderTemplate(this.headerTemplateCache.get(column.accessor), (_a = column.header) !== null && _a !== void 0 ? _a : column.accessor, null)) !== null && _b !== void 0 ? _b : column.header) !== null && _c !== void 0 ? _c : column.accessor,
|
|
398
535
|
cell: (info) => {
|
|
399
536
|
var _a, _b, _c;
|
|
400
537
|
const value = info.getValue();
|
|
401
|
-
const cellAccessors = key;
|
|
402
538
|
const row = info.row;
|
|
403
|
-
return ((_a = this.columnData.find(x => x.accessor ===
|
|
539
|
+
return ((_a = this.columnData.find(x => x.accessor === column.accessor)) === null || _a === void 0 ? void 0 : _a.repeatTemplate) && Array.isArray(value)
|
|
404
540
|
? value.map((item) => {
|
|
405
|
-
var _a, _b;
|
|
406
|
-
return (_b = (_a =
|
|
407
|
-
item)) !== null && _a !== void 0 ? _a : value) !== null && _b !== void 0 ? _b : this.fallbackValue;
|
|
541
|
+
var _a, _b, _c;
|
|
542
|
+
return (_c = (_b = (_a = this.renderTemplate(this.templateCache.get(column.accessor), item, row)) !== null && _a !== void 0 ? _a : item) !== null && _b !== void 0 ? _b : value) !== null && _c !== void 0 ? _c : this.fallbackValue;
|
|
408
543
|
})
|
|
409
|
-
: (_c = (_b =
|
|
410
|
-
value)) !== null && _b !== void 0 ? _b : value) !== null && _c !== void 0 ? _c : this.fallbackValue;
|
|
544
|
+
: (_c = (_b = this.renderTemplate(this.templateCache.get(column.accessor), value, row)) !== null && _b !== void 0 ? _b : value) !== null && _c !== void 0 ? _c : this.fallbackValue;
|
|
411
545
|
},
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
546
|
+
sortUndefined: 'last',
|
|
547
|
+
sortDescFirst: false,
|
|
548
|
+
enableSorting: this.enableSorting, // Explicitly set enableSorting based on the sorting prop
|
|
549
|
+
enableGlobalFilter: this.enableGlobalFilter, // Explicity set enableGlobalFilter based on the globalFiltering prop
|
|
550
|
+
});
|
|
551
|
+
};
|
|
552
|
+
// Create the final column structure
|
|
553
|
+
let generatedColumns = Object.entries(groupedColumns)
|
|
554
|
+
.map(([groupName, groupColumns]) => {
|
|
555
|
+
if (groupName.includes('ungrouped')) {
|
|
556
|
+
return groupColumns.map(createColumnDef);
|
|
557
|
+
}
|
|
558
|
+
return {
|
|
559
|
+
id: groupName,
|
|
560
|
+
header: groupName,
|
|
561
|
+
columns: groupColumns.map(createColumnDef),
|
|
562
|
+
enableSorting: this.enableSorting, // Also apply to column groups
|
|
563
|
+
enableGlobalFilter: this.enableGlobalFilter, // Also apply to column groups
|
|
564
|
+
};
|
|
565
|
+
})
|
|
566
|
+
.flat();
|
|
567
|
+
if (this.enableRowSelection) {
|
|
568
|
+
const rowSelection = columnHelper.accessor('select', {
|
|
569
|
+
header: ({ table }) => {
|
|
570
|
+
return (h("div", { class: "flex px-1", ref: el => {
|
|
571
|
+
const checkbox = this.createIndeterminateCheckbox({
|
|
572
|
+
checked: table === null || table === void 0 ? void 0 : table.getIsAllRowsSelected(),
|
|
573
|
+
indeterminate: table === null || table === void 0 ? void 0 : table.getIsSomeRowsSelected(),
|
|
574
|
+
onChange: table === null || table === void 0 ? void 0 : table.getToggleAllRowsSelectedHandler(),
|
|
575
|
+
});
|
|
576
|
+
if (el) {
|
|
577
|
+
el.innerHTML = ''; // Remove existing content
|
|
578
|
+
el.appendChild(checkbox); // Append new checkbox
|
|
579
|
+
}
|
|
580
|
+
} }));
|
|
581
|
+
},
|
|
582
|
+
cell: ({ row }) => {
|
|
583
|
+
return (h("div", { class: "flex px-1", ref: el => {
|
|
584
|
+
const checkbox = this.createIndeterminateCheckbox({
|
|
585
|
+
checked: row === null || row === void 0 ? void 0 : row.getIsSelected(),
|
|
586
|
+
disabled: !(row === null || row === void 0 ? void 0 : row.getCanSelect()),
|
|
587
|
+
indeterminate: row === null || row === void 0 ? void 0 : row.getIsSomeSelected(),
|
|
588
|
+
onChange: row === null || row === void 0 ? void 0 : row.getToggleSelectedHandler(),
|
|
589
|
+
});
|
|
590
|
+
if (el) {
|
|
591
|
+
el.innerHTML = ''; // Remove existing content
|
|
592
|
+
el.appendChild(checkbox); // Append new checkbox
|
|
593
|
+
}
|
|
594
|
+
} }));
|
|
595
|
+
},
|
|
596
|
+
enableGlobalFilter: false,
|
|
597
|
+
enableSorting: false,
|
|
598
|
+
});
|
|
599
|
+
generatedColumns = [rowSelection, ...generatedColumns];
|
|
418
600
|
}
|
|
601
|
+
return generatedColumns;
|
|
419
602
|
}
|
|
420
603
|
getTableData() {
|
|
421
604
|
if (this.parsedData &&
|
|
@@ -663,35 +846,55 @@ export class NvDatagrid {
|
|
|
663
846
|
});
|
|
664
847
|
}
|
|
665
848
|
}
|
|
849
|
+
getArrowSorting(header) {
|
|
850
|
+
if (!header.column.getCanSort())
|
|
851
|
+
return null;
|
|
852
|
+
const sortState = header.column.getIsSorted();
|
|
853
|
+
if (sortState === SortingPossibility.Asc) {
|
|
854
|
+
return (h("div", { class: "inline-flex align-middle" }, h("nv-icon", { name: "arrow-up" })));
|
|
855
|
+
}
|
|
856
|
+
if (sortState === SortingPossibility.Desc) {
|
|
857
|
+
return (h("div", { class: "inline-flex align-middle" }, h("nv-icon", { name: "arrow-down" })));
|
|
858
|
+
}
|
|
859
|
+
return null;
|
|
860
|
+
}
|
|
861
|
+
getHeaderCell(header) {
|
|
862
|
+
const isSortable = header.column.getCanSort();
|
|
863
|
+
const sortTitle = this.getSortTitle(header);
|
|
864
|
+
const content = header.isPlaceholder
|
|
865
|
+
? null
|
|
866
|
+
: header.column.columnDef.header
|
|
867
|
+
? this.flexRender(header.column.columnDef.header, header.getContext())
|
|
868
|
+
: null; // Ensure content is not null
|
|
869
|
+
const sortIcon = this.getArrowSorting(header);
|
|
870
|
+
const handleClick = this.createSortingClickHandler(header);
|
|
871
|
+
if (this.enableRowSelection) {
|
|
872
|
+
return (h("th", { key: header.id, colSpan: header.colSpan }, content, " "));
|
|
873
|
+
}
|
|
874
|
+
const returnHtml = (h("th", { key: header.id, colSpan: header.colSpan }, h("button", { type: "button", class: isSortable
|
|
875
|
+
? 'w-full text-left cursor-pointer select-none bg-transparent border-none p-0 m-0 focus:outline-none'
|
|
876
|
+
: 'w-full text-left bg-transparent border-none p-0 m-0 cursor-default', onClick: handleClick, title: sortTitle }, h("span", { class: "inline-flex items-center gap-1" }, content, sortIcon))));
|
|
877
|
+
return returnHtml;
|
|
878
|
+
}
|
|
879
|
+
// 👇 Helper method to avoid arrow function in JSX
|
|
880
|
+
createSortingClickHandler(header) {
|
|
881
|
+
return (e) => {
|
|
882
|
+
this.handleSortingClick(e, header);
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
getPagination() {
|
|
886
|
+
var _a;
|
|
887
|
+
return (this.enablePagination && (h("div", { class: "flex items-center gap-2" }, h("button", { class: "border rounded p-1", disabled: !this.table.getCanPreviousPage(), onClick: this.table.firstPage }, "<<"), h("button", { class: "border rounded p-1", disabled: !this.table.getCanPreviousPage(), onClick: this.table.previousPage }, "<"), h("button", { class: "border rounded p-1", disabled: !this.table.getCanNextPage(), onClick: this.table.nextPage }, ">"), h("button", { class: "border rounded p-1", disabled: !this.table.getCanNextPage(), onClick: this.table.lastPage }, ">>"), h("span", { class: "flex items-center gap-1" }, h("div", null, "Page"), h("strong", null, this.table.getState().pagination.pageIndex + 1, " of", ' ', this.table.getPageCount().toLocaleString())), h("span", { class: "flex items-center gap-1" }, "| Go to page:", ' ', 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 && (h("select", { "aria-label": "Rows per page", onChange: this.handlePageSizeChange }, this.pageSizes.map(pageSize => (h("option", { value: String(pageSize), selected: this.table.getState().pagination.pageSize === pageSize }, "Show ", pageSize))))))));
|
|
888
|
+
}
|
|
666
889
|
//#endregion METHODS
|
|
667
890
|
/****************************************************************************/
|
|
668
891
|
//#region WATCHERS
|
|
669
892
|
parseColumns(newValue, oldValue = []) {
|
|
670
893
|
this.parseColumnsArray(newValue, oldValue);
|
|
671
894
|
}
|
|
672
|
-
parseJsonColumns(newValue, oldValue) {
|
|
673
|
-
try {
|
|
674
|
-
const newItems = newValue ? JSON.parse(newValue) : [];
|
|
675
|
-
this.parseColumnsArray(newItems, oldValue);
|
|
676
|
-
}
|
|
677
|
-
catch (e) {
|
|
678
|
-
console.error('Invalid JSON format for columnsJson:', e.message);
|
|
679
|
-
this.parsedColumns = [];
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
895
|
parseData(newValue, oldValue = []) {
|
|
683
896
|
this.parseDataArray(newValue, oldValue);
|
|
684
897
|
}
|
|
685
|
-
parseJsonData(newValue) {
|
|
686
|
-
try {
|
|
687
|
-
const newItems = newValue ? JSON.parse(newValue) : [];
|
|
688
|
-
this.parseDataArray(newItems, this.parsedData);
|
|
689
|
-
}
|
|
690
|
-
catch (e) {
|
|
691
|
-
console.error('Invalid JSON format for dataJson:', e.message);
|
|
692
|
-
this.parsedData = [];
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
898
|
handleParsedChange() {
|
|
696
899
|
this.initializeTable();
|
|
697
900
|
}
|
|
@@ -720,6 +923,39 @@ export class NvDatagrid {
|
|
|
720
923
|
this.table.options.state.pagination = newValue;
|
|
721
924
|
}
|
|
722
925
|
}
|
|
926
|
+
handleSorting(newValue) {
|
|
927
|
+
if (!this.table) {
|
|
928
|
+
console.warn('Table is not initialized yet.');
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
// Not working
|
|
932
|
+
/*// Set the sorting for the table
|
|
933
|
+
this.table.setSorting(newValue);*/
|
|
934
|
+
// Manually update the sorting state
|
|
935
|
+
this.table.options.state.sorting = newValue;
|
|
936
|
+
}
|
|
937
|
+
handlePageSize(newValue) {
|
|
938
|
+
let effectivePageSize = newValue;
|
|
939
|
+
if (!this.pageSizes.includes(effectivePageSize) && this.pageSizes) {
|
|
940
|
+
effectivePageSize = this.pageSizes[0];
|
|
941
|
+
}
|
|
942
|
+
// Simply use `setPageSize` to update the page size directly
|
|
943
|
+
this.paginationState = Object.assign(Object.assign({}, this.paginationState), { pageSize: effectivePageSize }); // This triggers the paginationState watcher
|
|
944
|
+
}
|
|
945
|
+
handleRowSelectionState(newValue, oldValue) {
|
|
946
|
+
if (!this.table) {
|
|
947
|
+
console.warn('Table is not initialized yet.');
|
|
948
|
+
return;
|
|
949
|
+
}
|
|
950
|
+
// Only update if there is a meaningful change
|
|
951
|
+
if (JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
|
|
952
|
+
// Not working
|
|
953
|
+
/*// Set the rowSelection for the table
|
|
954
|
+
this.table.setRowSelection(newValue);*/
|
|
955
|
+
// Manually update the row selection state
|
|
956
|
+
this.table.options.state.rowSelection = newValue;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
723
959
|
//#endregion WATCHERS
|
|
724
960
|
/****************************************************************************/
|
|
725
961
|
//#region LIFECYCLE
|
|
@@ -729,7 +965,10 @@ export class NvDatagrid {
|
|
|
729
965
|
this.initializeTable();
|
|
730
966
|
if (this.enablePagination) {
|
|
731
967
|
// Ensure a valid page size
|
|
732
|
-
|
|
968
|
+
let effectivePageSize = this.pageSize > 0 ? this.pageSize : 10;
|
|
969
|
+
if (!this.pageSizes.includes(effectivePageSize) && this.pageSizes) {
|
|
970
|
+
effectivePageSize = this.pageSizes[0];
|
|
971
|
+
}
|
|
733
972
|
this.paginationState = {
|
|
734
973
|
pageIndex: Math.max(0, this.minPageIndex - 1),
|
|
735
974
|
pageSize: effectivePageSize,
|
|
@@ -747,11 +986,9 @@ export class NvDatagrid {
|
|
|
747
986
|
const rows = !this.table || this.table === undefined || this.parsedData.length === 0
|
|
748
987
|
? []
|
|
749
988
|
: (_c = (_b = this.table) === null || _b === void 0 ? void 0 : _b.getRowModel()) === null || _c === void 0 ? void 0 : _c.rows;
|
|
750
|
-
return (h(Host, { key: '
|
|
989
|
+
return (h(Host, { key: '90be657fa9c7f8755391f8d91418399de742ae1f' }, h("div", { key: 'f28596438b7c9c22b34789236c5faa644938d1dc', class: "hidden" }, h("slot", { key: 'fdc1670cc6bafb5f1efa8c63d41acbfd15659de6' })), h("slot", { key: '65afa2282af4842bcb23f8baa592545fe3b74fa3', name: "before" }), this.enableGlobalFilter && this.table && (h("div", { key: '8628a23712471690b6a6239a289dd8263aed423c', class: `search-container justify-${this.globalFilterPosition}` }, h("nv-fieldtext", { key: '42c56dd6ba426e2045c02b3754fae3562632c49f', value: this.globalFilterSearchTerm, onInput: this.handleGlobalFilteringOnInput, placeholder: "Search all columns..." }))), this.parsedColumns.length === 0 && this.parsedData.length === 0 ? (h("div", { class: "no-data" }, this.noColumnsNoDataMessage)) : (h("div", null, h("table", null, this.parsedColumns.length > 0 && headerGroups.length > 0 && (h("thead", null, this.parsedColumns.length > 0 && headerGroups
|
|
751
990
|
? headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map(headerGroup => (h("tr", { key: headerGroup.id }, headerGroup.headers.map(header => {
|
|
752
|
-
return (
|
|
753
|
-
? null
|
|
754
|
-
: this.flexRender(header.column.columnDef.header, header.getContext())));
|
|
991
|
+
return this.getHeaderCell(header);
|
|
755
992
|
}))))
|
|
756
993
|
: null)), h("tbody", null, !rows || rows.length === 0 || this.parsedData.length === 0 ? (h("tr", null, h("td", { colSpan: this.parsedColumns.length || 12, class: "no-data" }, this.noDataMessage))) : (rows.map(row => {
|
|
757
994
|
const rowId = row.id;
|
|
@@ -759,7 +996,8 @@ export class NvDatagrid {
|
|
|
759
996
|
return (h("tr", { key: rowId }, visibleCells.map(cell => {
|
|
760
997
|
return (h("td", { key: cell.id, "data-row-id": rowId }, this.flexRender(cell.column.columnDef.cell, cell.getContext())));
|
|
761
998
|
})));
|
|
762
|
-
})))
|
|
999
|
+
}))), this.table && this.enableRowSelection ? (h("tfoot", null, h("tr", null, h("td", { colSpan: 20 }, this.enableRowSelection && this.table ? (h("div", null, this.rowSelectionState &&
|
|
1000
|
+
Object.keys(this.rowSelectionState).length > 0 ? (h("span", null, Object.keys(this.rowSelectionState).length, " of", ' ', ((_e = (_d = this.table.getPreFilteredRowModel()) === null || _d === void 0 ? void 0 : _d.rows) === null || _e === void 0 ? void 0 : _e.length) || 0, ' ', "Total Rows Selected")) : (h("span", null, "No rows selected")))) : null)))) : null), this.getPagination())), h("slot", { key: 'e1641d8fd103b0802e1df4f0848f0de921260065', name: "after" })));
|
|
763
1001
|
}
|
|
764
1002
|
static get is() { return "nv-datagrid"; }
|
|
765
1003
|
static get originalStyleUrls() {
|
|
@@ -828,50 +1066,6 @@ export class NvDatagrid {
|
|
|
828
1066
|
"setter": false,
|
|
829
1067
|
"defaultValue": "[]"
|
|
830
1068
|
},
|
|
831
|
-
"dataJson": {
|
|
832
|
-
"type": "string",
|
|
833
|
-
"mutable": false,
|
|
834
|
-
"complexType": {
|
|
835
|
-
"original": "string",
|
|
836
|
-
"resolved": "string",
|
|
837
|
-
"references": {}
|
|
838
|
-
},
|
|
839
|
-
"required": false,
|
|
840
|
-
"optional": true,
|
|
841
|
-
"docs": {
|
|
842
|
-
"tags": [{
|
|
843
|
-
"name": "example",
|
|
844
|
-
"text": "`[{ \"name\": \"Alice\", \"age\": 25 }, { \"name\": \"Bob\", \"age\": 30 }]`"
|
|
845
|
-
}],
|
|
846
|
-
"text": "The data to display in the data grid.\nIt can be passed directly as an array of objects or as a JSON string.\nIf both `data` and `dataJson` are provided, `data` takes precedence."
|
|
847
|
-
},
|
|
848
|
-
"getter": false,
|
|
849
|
-
"setter": false,
|
|
850
|
-
"attribute": "data-json",
|
|
851
|
-
"reflect": true
|
|
852
|
-
},
|
|
853
|
-
"columnsJson": {
|
|
854
|
-
"type": "string",
|
|
855
|
-
"mutable": false,
|
|
856
|
-
"complexType": {
|
|
857
|
-
"original": "string",
|
|
858
|
-
"resolved": "string",
|
|
859
|
-
"references": {}
|
|
860
|
-
},
|
|
861
|
-
"required": false,
|
|
862
|
-
"optional": true,
|
|
863
|
-
"docs": {
|
|
864
|
-
"tags": [{
|
|
865
|
-
"name": "example",
|
|
866
|
-
"text": "`[{\"header\":\"Name\",\"accessor\":\"name\"},{\"header\":\"Age\",\"accessor\":\"age\"},{\"header\":\"Email\",\"accessor\":\"email\"}]`"
|
|
867
|
-
}],
|
|
868
|
-
"text": "The columns to display in the data grid.\nIt can be passed directly as an array of objects or as a JSON string.\nIf both `columns` and `columnsJson` are provided, `columns` takes precedence."
|
|
869
|
-
},
|
|
870
|
-
"getter": false,
|
|
871
|
-
"setter": false,
|
|
872
|
-
"attribute": "columns-json",
|
|
873
|
-
"reflect": true
|
|
874
|
-
},
|
|
875
1069
|
"fallbackValue": {
|
|
876
1070
|
"type": "string",
|
|
877
1071
|
"mutable": false,
|
|
@@ -941,7 +1135,7 @@ export class NvDatagrid {
|
|
|
941
1135
|
"reflect": true,
|
|
942
1136
|
"defaultValue": "'No data or columns available to display.'"
|
|
943
1137
|
},
|
|
944
|
-
"
|
|
1138
|
+
"autoGenerateColumns": {
|
|
945
1139
|
"type": "boolean",
|
|
946
1140
|
"mutable": false,
|
|
947
1141
|
"complexType": {
|
|
@@ -956,15 +1150,15 @@ export class NvDatagrid {
|
|
|
956
1150
|
"name": "default",
|
|
957
1151
|
"text": "false"
|
|
958
1152
|
}],
|
|
959
|
-
"text": "Whether to
|
|
1153
|
+
"text": "Whether to automatically generate columns if none are provided.\nIf columns are explicitly set, this property is ignored."
|
|
960
1154
|
},
|
|
961
1155
|
"getter": false,
|
|
962
1156
|
"setter": false,
|
|
963
|
-
"attribute": "
|
|
1157
|
+
"attribute": "auto-generate-columns",
|
|
964
1158
|
"reflect": true,
|
|
965
1159
|
"defaultValue": "false"
|
|
966
1160
|
},
|
|
967
|
-
"
|
|
1161
|
+
"enableGlobalFilter": {
|
|
968
1162
|
"type": "boolean",
|
|
969
1163
|
"mutable": false,
|
|
970
1164
|
"complexType": {
|
|
@@ -979,14 +1173,40 @@ export class NvDatagrid {
|
|
|
979
1173
|
"name": "default",
|
|
980
1174
|
"text": "false"
|
|
981
1175
|
}],
|
|
982
|
-
"text": "Whether to
|
|
1176
|
+
"text": "Whether to enable global filtering for the data grid.\nThis allows users to search across all columns for a specific value.\nThe search is case-insensitive and supports partial matches.\nIt use string.includes() to match the search term."
|
|
983
1177
|
},
|
|
984
1178
|
"getter": false,
|
|
985
1179
|
"setter": false,
|
|
986
|
-
"attribute": "
|
|
1180
|
+
"attribute": "enable-global-filter",
|
|
987
1181
|
"reflect": true,
|
|
988
1182
|
"defaultValue": "false"
|
|
989
1183
|
},
|
|
1184
|
+
"globalFilterPosition": {
|
|
1185
|
+
"type": "string",
|
|
1186
|
+
"mutable": false,
|
|
1187
|
+
"complexType": {
|
|
1188
|
+
"original": "`${GlobalFilterPosition}`",
|
|
1189
|
+
"resolved": "\"center\" | \"end\" | \"start\"",
|
|
1190
|
+
"references": {
|
|
1191
|
+
"GlobalFilterPosition": {
|
|
1192
|
+
"location": "import",
|
|
1193
|
+
"path": "../../utils/constants",
|
|
1194
|
+
"id": "src/utils/constants.ts::GlobalFilterPosition"
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
},
|
|
1198
|
+
"required": false,
|
|
1199
|
+
"optional": false,
|
|
1200
|
+
"docs": {
|
|
1201
|
+
"tags": [],
|
|
1202
|
+
"text": "Position the global filter input field"
|
|
1203
|
+
},
|
|
1204
|
+
"getter": false,
|
|
1205
|
+
"setter": false,
|
|
1206
|
+
"attribute": "global-filter-position",
|
|
1207
|
+
"reflect": true,
|
|
1208
|
+
"defaultValue": "'end'"
|
|
1209
|
+
},
|
|
990
1210
|
"enablePagination": {
|
|
991
1211
|
"type": "boolean",
|
|
992
1212
|
"mutable": false,
|
|
@@ -1025,7 +1245,7 @@ export class NvDatagrid {
|
|
|
1025
1245
|
"name": "default",
|
|
1026
1246
|
"text": "10"
|
|
1027
1247
|
}],
|
|
1028
|
-
"text": "The number of rows to display per page."
|
|
1248
|
+
"text": "The number of rows to display per page.\nIf the number is not present in the property pageSizes it takes the first of the list."
|
|
1029
1249
|
},
|
|
1030
1250
|
"getter": false,
|
|
1031
1251
|
"setter": false,
|
|
@@ -1053,6 +1273,49 @@ export class NvDatagrid {
|
|
|
1053
1273
|
"getter": false,
|
|
1054
1274
|
"setter": false,
|
|
1055
1275
|
"defaultValue": "[10, 20, 30, 40, 50]"
|
|
1276
|
+
},
|
|
1277
|
+
"enableSorting": {
|
|
1278
|
+
"type": "boolean",
|
|
1279
|
+
"mutable": false,
|
|
1280
|
+
"complexType": {
|
|
1281
|
+
"original": "boolean",
|
|
1282
|
+
"resolved": "boolean",
|
|
1283
|
+
"references": {}
|
|
1284
|
+
},
|
|
1285
|
+
"required": false,
|
|
1286
|
+
"optional": false,
|
|
1287
|
+
"docs": {
|
|
1288
|
+
"tags": [{
|
|
1289
|
+
"name": "default",
|
|
1290
|
+
"text": "false"
|
|
1291
|
+
}],
|
|
1292
|
+
"text": "Whether to enable sorting for the data grid."
|
|
1293
|
+
},
|
|
1294
|
+
"getter": false,
|
|
1295
|
+
"setter": false,
|
|
1296
|
+
"attribute": "enable-sorting",
|
|
1297
|
+
"reflect": true,
|
|
1298
|
+
"defaultValue": "false"
|
|
1299
|
+
},
|
|
1300
|
+
"enableRowSelection": {
|
|
1301
|
+
"type": "boolean",
|
|
1302
|
+
"mutable": false,
|
|
1303
|
+
"complexType": {
|
|
1304
|
+
"original": "boolean",
|
|
1305
|
+
"resolved": "boolean",
|
|
1306
|
+
"references": {}
|
|
1307
|
+
},
|
|
1308
|
+
"required": false,
|
|
1309
|
+
"optional": false,
|
|
1310
|
+
"docs": {
|
|
1311
|
+
"tags": [],
|
|
1312
|
+
"text": "Whether to enable row selection for the data grid."
|
|
1313
|
+
},
|
|
1314
|
+
"getter": false,
|
|
1315
|
+
"setter": false,
|
|
1316
|
+
"attribute": "enable-row-selection",
|
|
1317
|
+
"reflect": true,
|
|
1318
|
+
"defaultValue": "false"
|
|
1056
1319
|
}
|
|
1057
1320
|
};
|
|
1058
1321
|
}
|
|
@@ -1063,7 +1326,9 @@ export class NvDatagrid {
|
|
|
1063
1326
|
"parsedData": {},
|
|
1064
1327
|
"globalFilterSearchTerm": {},
|
|
1065
1328
|
"columnData": {},
|
|
1066
|
-
"paginationState": {}
|
|
1329
|
+
"paginationState": {},
|
|
1330
|
+
"sorting": {},
|
|
1331
|
+
"rowSelectionState": {}
|
|
1067
1332
|
};
|
|
1068
1333
|
}
|
|
1069
1334
|
static get events() {
|
|
@@ -1078,15 +1343,24 @@ export class NvDatagrid {
|
|
|
1078
1343
|
"text": "Emitted when an action is triggered on a cell."
|
|
1079
1344
|
},
|
|
1080
1345
|
"complexType": {
|
|
1081
|
-
"original": "
|
|
1082
|
-
"resolved": "
|
|
1083
|
-
"references": {
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1346
|
+
"original": "{\n /**\n * Key action to be performed\n */\n keyAction: string;\n\n /**\n * Details of the action to be performed\n */\n details: any;\n }",
|
|
1347
|
+
"resolved": "{ keyAction: string; details: any; }",
|
|
1348
|
+
"references": {}
|
|
1349
|
+
}
|
|
1350
|
+
}, {
|
|
1351
|
+
"method": "selectedRows",
|
|
1352
|
+
"name": "selectedRows",
|
|
1353
|
+
"bubbles": true,
|
|
1354
|
+
"cancelable": true,
|
|
1355
|
+
"composed": true,
|
|
1356
|
+
"docs": {
|
|
1357
|
+
"tags": [],
|
|
1358
|
+
"text": "Emitted when the selection of the rows are changed."
|
|
1359
|
+
},
|
|
1360
|
+
"complexType": {
|
|
1361
|
+
"original": "any[]",
|
|
1362
|
+
"resolved": "any[]",
|
|
1363
|
+
"references": {}
|
|
1090
1364
|
}
|
|
1091
1365
|
}];
|
|
1092
1366
|
}
|
|
@@ -1095,15 +1369,9 @@ export class NvDatagrid {
|
|
|
1095
1369
|
return [{
|
|
1096
1370
|
"propName": "columns",
|
|
1097
1371
|
"methodName": "parseColumns"
|
|
1098
|
-
}, {
|
|
1099
|
-
"propName": "columnsJson",
|
|
1100
|
-
"methodName": "parseJsonColumns"
|
|
1101
1372
|
}, {
|
|
1102
1373
|
"propName": "data",
|
|
1103
1374
|
"methodName": "parseData"
|
|
1104
|
-
}, {
|
|
1105
|
-
"propName": "dataJson",
|
|
1106
|
-
"methodName": "parseJsonData"
|
|
1107
1375
|
}, {
|
|
1108
1376
|
"propName": "parsedColumns",
|
|
1109
1377
|
"methodName": "handleParsedChange"
|
|
@@ -1116,6 +1384,15 @@ export class NvDatagrid {
|
|
|
1116
1384
|
}, {
|
|
1117
1385
|
"propName": "paginationState",
|
|
1118
1386
|
"methodName": "handlePaginationState"
|
|
1387
|
+
}, {
|
|
1388
|
+
"propName": "sorting",
|
|
1389
|
+
"methodName": "handleSorting"
|
|
1390
|
+
}, {
|
|
1391
|
+
"propName": "pageSize",
|
|
1392
|
+
"methodName": "handlePageSize"
|
|
1393
|
+
}, {
|
|
1394
|
+
"propName": "rowSelectionState",
|
|
1395
|
+
"methodName": "handleRowSelectionState"
|
|
1119
1396
|
}];
|
|
1120
1397
|
}
|
|
1121
1398
|
}
|