@nova-design-system/nova-webcomponents 3.1.0 → 3.3.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/{index-9bda5507.js → index-c56424e5.js} +34 -186
- package/dist/cjs/index-c56424e5.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/native.cjs.js +2 -23
- package/dist/cjs/native.cjs.js.map +1 -1
- package/dist/cjs/nv-alert.cjs.entry.js +1 -1
- package/dist/cjs/nv-avatar.cjs.entry.js +1 -1
- package/dist/cjs/nv-badge_2.cjs.entry.js +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 +1 -1
- package/dist/cjs/nv-calendar.cjs.entry.js +384 -172
- 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 +95 -103
- 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 +1 -1
- package/dist/cjs/nv-dialogfooter_2.cjs.entry.js +1 -1
- package/dist/cjs/nv-fieldcheckbox.cjs.entry.js +1 -1
- package/dist/cjs/nv-fielddate.cjs.entry.js +45 -11
- package/dist/cjs/nv-fielddate.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fielddaterange.cjs.entry.js +128 -42
- package/dist/cjs/nv-fielddaterange.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fielddropdown.cjs.entry.js +84 -60
- package/dist/cjs/nv-fielddropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fielddropdownitem.cjs.entry.js +1 -1
- package/dist/cjs/nv-fieldmultiselect.cjs.entry.js +116 -104
- package/dist/cjs/nv-fieldmultiselect.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldnumber.cjs.entry.js +2 -2
- package/dist/cjs/nv-fieldnumber.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldpassword.cjs.entry.js +2 -2
- package/dist/cjs/nv-fieldpassword.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldradio.cjs.entry.js +1 -1
- package/dist/cjs/nv-fieldselect.cjs.entry.js +2 -2
- package/dist/cjs/nv-fieldselect.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldslider.cjs.entry.js +668 -0
- package/dist/cjs/nv-fieldslider.cjs.entry.js.map +1 -0
- package/dist/cjs/nv-fieldtext.cjs.entry.js +5 -5
- package/dist/cjs/nv-fieldtext.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldtextarea.cjs.entry.js +5 -5
- package/dist/cjs/nv-fieldtextarea.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldtime.cjs.entry.js +11 -11
- package/dist/cjs/nv-fieldtime.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-icon.cjs.entry.js +3 -3
- 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 +2 -2
- 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-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-calendar/nv-calendar.css +6 -2
- package/dist/collection/components/nv-calendar/nv-calendar.js +247 -169
- package/dist/collection/components/nv-calendar/nv-calendar.js.map +1 -1
- package/dist/collection/components/nv-calendar/nv-calendar.utils.js +12 -3
- package/dist/collection/components/nv-calendar/nv-calendar.utils.js.map +1 -1
- package/dist/collection/components/nv-calendar/partials/calendar-actions.js +11 -0
- package/dist/collection/components/nv-calendar/partials/calendar-actions.js.map +1 -0
- package/dist/collection/components/nv-calendar/partials/calendar-grid.js +24 -0
- package/dist/collection/components/nv-calendar/partials/calendar-grid.js.map +1 -0
- package/dist/collection/components/nv-calendar/partials/calendar-header.js +38 -0
- package/dist/collection/components/nv-calendar/partials/calendar-header.js.map +1 -0
- package/dist/collection/components/nv-calendar/partials/calendar-shortcuts.js +22 -0
- package/dist/collection/components/nv-calendar/partials/calendar-shortcuts.js.map +1 -0
- package/dist/collection/components/nv-calendar/partials/day-cell.js +31 -0
- package/dist/collection/components/nv-calendar/partials/day-cell.js.map +1 -0
- package/dist/collection/components/nv-calendar/partials/index.js +7 -0
- package/dist/collection/components/nv-calendar/partials/index.js.map +1 -0
- package/dist/collection/components/nv-calendar/partials/week-numbers.js +36 -0
- package/dist/collection/components/nv-calendar/partials/week-numbers.js.map +1 -0
- package/dist/collection/components/nv-calendar/test/nv-calendar.utils.test.js +692 -651
- package/dist/collection/components/nv-calendar/test/nv-calendar.utils.test.js.map +1 -1
- package/dist/collection/components/nv-calendar/test/partials/calendar-actions.logic.test.js +169 -0
- package/dist/collection/components/nv-calendar/test/partials/calendar-actions.logic.test.js.map +1 -0
- package/dist/collection/components/nv-calendar/test/partials/calendar-grid.logic.test.js +262 -0
- package/dist/collection/components/nv-calendar/test/partials/calendar-grid.logic.test.js.map +1 -0
- package/dist/collection/components/nv-calendar/test/partials/calendar-header.logic.test.js +208 -0
- package/dist/collection/components/nv-calendar/test/partials/calendar-header.logic.test.js.map +1 -0
- package/dist/collection/components/nv-calendar/test/partials/calendar-shortcuts.logic.test.js +355 -0
- package/dist/collection/components/nv-calendar/test/partials/calendar-shortcuts.logic.test.js.map +1 -0
- package/dist/collection/components/nv-calendar/test/partials/day-cell.logic.test.js +250 -0
- package/dist/collection/components/nv-calendar/test/partials/day-cell.logic.test.js.map +1 -0
- package/dist/collection/components/nv-calendar/test/partials/week-numbers.logic.test.js +217 -0
- package/dist/collection/components/nv-calendar/test/partials/week-numbers.logic.test.js.map +1 -0
- package/dist/collection/components/nv-datagrid/nv-datagrid.docs.js +131 -48
- package/dist/collection/components/nv-datagrid/nv-datagrid.docs.js.map +1 -1
- package/dist/collection/components/nv-datagrid/nv-datagrid.js +94 -152
- 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-fielddate/nv-fielddate.js +56 -16
- package/dist/collection/components/nv-fielddate/nv-fielddate.js.map +1 -1
- package/dist/collection/components/nv-fielddate/styles/nv-fielddate.css +51 -1
- package/dist/collection/components/nv-fielddate/test/nv-fielddate.logic.test.js +196 -0
- package/dist/collection/components/nv-fielddate/test/nv-fielddate.logic.test.js.map +1 -0
- package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.js +165 -41
- package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.js.map +1 -1
- package/dist/collection/components/nv-fielddaterange/styles/nv-fielddaterange.css +51 -1
- package/dist/collection/components/nv-fielddaterange/test/nv-fielddaterange.logic.test.js +137 -0
- package/dist/collection/components/nv-fielddaterange/test/nv-fielddaterange.logic.test.js.map +1 -0
- package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.docs.js +8 -0
- package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.docs.js.map +1 -1
- package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.js +173 -106
- package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.js.map +1 -1
- package/dist/collection/components/nv-fielddropdown/styles/nv-fielddropdown.css +77 -1
- package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.js +202 -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} +61 -4
- package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.css +51 -1
- package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.css +51 -1
- package/dist/collection/components/nv-fieldselect/nv-fieldselect.css +51 -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 +1036 -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 +338 -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 +59 -1
- package/dist/collection/components/nv-fieldtext/nv-fieldtext.docs.js +9 -1
- package/dist/collection/components/nv-fieldtext/nv-fieldtext.docs.js.map +1 -1
- package/dist/collection/components/nv-fieldtext/nv-fieldtext.js +4 -3
- package/dist/collection/components/nv-fieldtext/nv-fieldtext.js.map +1 -1
- package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.css +45 -1
- package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.js +3 -3
- package/dist/collection/components/nv-fieldtime/nv-fieldtime.js +9 -9
- package/dist/collection/components/nv-fieldtime/styles/nv-fieldtime.css +51 -1
- package/dist/collection/components/nv-icon/nv-icon.js +1 -1
- package/dist/collection/components/nv-icon/nv-icons.js +1 -0
- 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 +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 +2 -2
- 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/interfaces/Column.js.map +1 -1
- package/dist/components/index.js +2 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/nv-alert.js +2 -2
- package/dist/components/nv-avatar.js +2 -2
- 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 +97 -109
- 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 +6 -6
- 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 +53 -25
- package/dist/components/nv-fielddate.js.map +1 -1
- package/dist/components/nv-fielddaterange.js +137 -57
- package/dist/components/nv-fielddaterange.js.map +1 -1
- package/dist/components/nv-fielddropdown.js +98 -72
- 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 +132 -120
- package/dist/components/nv-fieldmultiselect.js.map +1 -1
- package/dist/components/nv-fieldnumber.js +5 -5
- package/dist/components/nv-fieldnumber.js.map +1 -1
- package/dist/components/nv-fieldpassword.js +5 -5
- package/dist/components/nv-fieldpassword.js.map +1 -1
- package/dist/components/nv-fieldradio.js +1 -1
- package/dist/components/nv-fieldselect.js +5 -5
- package/dist/components/nv-fieldselect.js.map +1 -1
- package/dist/components/nv-fieldslider.d.ts +11 -0
- package/dist/components/nv-fieldslider.js +731 -0
- package/dist/components/nv-fieldslider.js.map +1 -0
- package/dist/components/nv-fieldtext.js +1 -1
- package/dist/components/nv-fieldtextarea.js +5 -5
- package/dist/components/nv-fieldtextarea.js.map +1 -1
- package/dist/components/nv-fieldtime.js +15 -15
- 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 +5 -5
- 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-tablecolumn.js +1 -1
- package/dist/components/nv-toggle.js +3 -3
- package/dist/components/nv-tooltip.js +1 -1
- package/dist/components/{p-eb632278.js → p-2ae214d2.js} +3 -3
- package/dist/components/{p-eb632278.js.map → p-2ae214d2.js.map} +1 -1
- package/dist/components/{p-f76bb0c3.js → p-3e32b5a1.js} +5 -5
- package/dist/components/p-3e32b5a1.js.map +1 -0
- package/dist/components/{p-854c32dc.js → p-5e90b9b8.js} +389 -199
- package/dist/components/p-5e90b9b8.js.map +1 -0
- package/dist/components/{p-a2527411.js → p-5ee4015d.js} +3 -3
- package/dist/components/{p-a2527411.js.map → p-5ee4015d.js.map} +1 -1
- package/dist/components/{p-02752770.js → p-6277f746.js} +2 -2
- package/dist/components/{p-02752770.js.map → p-6277f746.js.map} +1 -1
- package/dist/components/p-7935c1cb.js +167 -0
- package/dist/components/p-7935c1cb.js.map +1 -0
- package/dist/components/{p-b48d5a94.js → p-8d92f0e1.js} +4 -4
- package/dist/components/{p-b48d5a94.js.map → p-8d92f0e1.js.map} +1 -1
- package/dist/components/{p-41c56ddc.js → p-95a7581c.js} +5 -5
- package/dist/components/{p-41c56ddc.js.map → p-95a7581c.js.map} +1 -1
- package/dist/components/{p-e00cbb8a.js → p-9e6e26cb.js} +2 -2
- package/dist/components/{p-e00cbb8a.js.map → p-9e6e26cb.js.map} +1 -1
- package/dist/components/p-9fa0de38.js +88 -0
- package/dist/components/p-9fa0de38.js.map +1 -0
- package/dist/components/{p-1c45c0f2.js → p-aff3ed68.js} +24 -177
- package/dist/components/p-aff3ed68.js.map +1 -0
- package/dist/components/{p-608eb9da.js → p-b6d858b2.js} +2 -2
- package/dist/components/{p-608eb9da.js.map → p-b6d858b2.js.map} +1 -1
- package/dist/components/{p-f5cb0a63.js → p-bb6d1e4e.js} +3 -3
- package/dist/components/{p-f5cb0a63.js.map → p-bb6d1e4e.js.map} +1 -1
- package/dist/components/{p-35a70c5e.js → p-c07c32d2.js} +3 -3
- package/dist/components/{p-35a70c5e.js.map → p-c07c32d2.js.map} +1 -1
- package/dist/components/{p-10faa938.js → p-c9006520.js} +5 -5
- package/dist/components/{p-10faa938.js.map → p-c9006520.js.map} +1 -1
- package/dist/components/{p-0a0f6daf.js → p-e28c4707.js} +3 -3
- package/dist/components/{p-0a0f6daf.js.map → p-e28c4707.js.map} +1 -1
- package/dist/components/{p-10b37876.js → p-eabbc885.js} +3 -3
- package/dist/components/{p-10b37876.js.map → p-eabbc885.js.map} +1 -1
- package/dist/esm/{constants-b97e736d.js → constants-4faa1fae.js} +2 -2
- package/dist/esm/{constants-b97e736d.js.map → constants-4faa1fae.js.map} +1 -1
- package/dist/esm/{index-1fb7a9a6.js → index-a1936cd0.js} +35 -186
- package/dist/esm/index-a1936cd0.js.map +1 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/native.js +3 -24
- package/dist/esm/native.js.map +1 -1
- package/dist/esm/nv-alert.entry.js +2 -2
- package/dist/esm/nv-avatar.entry.js +2 -2
- package/dist/esm/nv-badge_2.entry.js +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 +385 -173
- 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 +96 -104
- 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 +2 -2
- 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 +45 -11
- package/dist/esm/nv-fielddate.entry.js.map +1 -1
- package/dist/esm/nv-fielddaterange.entry.js +128 -42
- package/dist/esm/nv-fielddaterange.entry.js.map +1 -1
- package/dist/esm/nv-fielddropdown.entry.js +84 -60
- package/dist/esm/nv-fielddropdown.entry.js.map +1 -1
- package/dist/esm/nv-fielddropdownitem.entry.js +1 -1
- package/dist/esm/nv-fieldmultiselect.entry.js +116 -104
- package/dist/esm/nv-fieldmultiselect.entry.js.map +1 -1
- package/dist/esm/nv-fieldnumber.entry.js +2 -2
- package/dist/esm/nv-fieldnumber.entry.js.map +1 -1
- package/dist/esm/nv-fieldpassword.entry.js +2 -2
- package/dist/esm/nv-fieldpassword.entry.js.map +1 -1
- package/dist/esm/nv-fieldradio.entry.js +1 -1
- package/dist/esm/nv-fieldselect.entry.js +2 -2
- package/dist/esm/nv-fieldselect.entry.js.map +1 -1
- package/dist/esm/nv-fieldslider.entry.js +664 -0
- package/dist/esm/nv-fieldslider.entry.js.map +1 -0
- package/dist/esm/nv-fieldtext.entry.js +5 -5
- package/dist/esm/nv-fieldtext.entry.js.map +1 -1
- package/dist/esm/nv-fieldtextarea.entry.js +5 -5
- package/dist/esm/nv-fieldtextarea.entry.js.map +1 -1
- package/dist/esm/nv-fieldtime.entry.js +12 -12
- 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 +2 -2
- 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-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-050d6c6c.entry.js +2 -0
- package/dist/native/{p-4d164ed6.entry.js.map → p-050d6c6c.entry.js.map} +1 -1
- package/dist/native/{p-615947e7.entry.js → p-08ca678c.entry.js} +2 -2
- package/dist/native/p-1a5d3b87.entry.js +2 -0
- package/dist/native/{p-efe6a46c.entry.js.map → p-1a5d3b87.entry.js.map} +1 -1
- package/dist/native/{p-7fd4d13d.entry.js → p-1c1ecd38.entry.js} +2 -2
- package/dist/native/{p-c7b201cd.entry.js → p-1d98477d.entry.js} +2 -2
- package/dist/native/{p-1da72182.entry.js → p-2006f5d4.entry.js} +2 -2
- package/dist/native/p-26cf4938.entry.js +2 -0
- package/dist/native/p-26cf4938.entry.js.map +1 -0
- package/dist/native/p-3817efb2.entry.js +2 -0
- package/dist/native/{p-fc97f071.entry.js.map → p-3817efb2.entry.js.map} +1 -1
- package/dist/native/p-45459dbb.entry.js +2 -0
- package/dist/native/{p-7042ba8a.entry.js.map → p-45459dbb.entry.js.map} +1 -1
- package/dist/native/p-45cbe6e4.entry.js +2 -0
- package/dist/native/{p-9135fdf5.entry.js.map → p-45cbe6e4.entry.js.map} +1 -1
- package/dist/native/p-46428304.entry.js +2 -0
- package/dist/native/p-46428304.entry.js.map +1 -0
- package/dist/native/p-4f9cdf0b.entry.js +2 -0
- package/dist/native/{p-3b7ef609.entry.js → p-58bb90ad.entry.js} +2 -2
- package/dist/native/p-59b07b36.entry.js +2 -0
- package/dist/native/p-59b07b36.entry.js.map +1 -0
- package/dist/native/{p-3cd77d82.entry.js → p-5b6c59e0.entry.js} +2 -2
- package/dist/native/p-6029e51b.entry.js +2 -0
- package/dist/native/{p-244f56ac.entry.js.map → p-6029e51b.entry.js.map} +1 -1
- package/dist/native/{p-08a75cfa.entry.js → p-60c64f2b.entry.js} +2 -2
- package/dist/native/p-64a76565.entry.js +2 -0
- package/dist/native/p-64a76565.entry.js.map +1 -0
- package/dist/native/{p-c67186f8.entry.js → p-83288db0.entry.js} +2 -2
- package/dist/native/p-838f7842.entry.js +2 -0
- package/dist/native/p-838f7842.entry.js.map +1 -0
- package/dist/native/{p-0245863d.entry.js → p-86ab23ea.entry.js} +2 -2
- package/dist/native/p-87784622.entry.js +2 -0
- package/dist/native/p-8fb4e5c0.entry.js +2 -0
- package/dist/native/{p-b94d9f0b.entry.js.map → p-8fb4e5c0.entry.js.map} +1 -1
- package/dist/native/{p-14c07207.entry.js → p-914da1e1.entry.js} +2 -2
- package/dist/native/p-abbe5d69.entry.js +2 -0
- package/dist/native/p-abbe5d69.entry.js.map +1 -0
- package/dist/native/p-abc251aa.entry.js +2 -0
- package/dist/native/p-abc251aa.entry.js.map +1 -0
- package/dist/native/{p-c0f79bac.entry.js → p-ad128108.entry.js} +2 -2
- package/dist/native/{p-e5de64d5.entry.js → p-b5b9190a.entry.js} +2 -2
- package/dist/native/{p-470588c2.entry.js → p-b8f2c1e7.entry.js} +3 -3
- package/dist/native/p-b8f2c1e7.entry.js.map +1 -0
- package/dist/native/{p-b8b6875d.entry.js → p-d040bd61.entry.js} +2 -2
- package/dist/native/p-d0a33e64.js +3 -0
- package/dist/native/p-d0a33e64.js.map +1 -0
- package/dist/native/{p-3953464e.entry.js → p-d21b2da2.entry.js} +3 -3
- package/dist/native/{p-90e6d9dd.entry.js → p-d53e8795.entry.js} +2 -2
- package/dist/native/p-dc7dd7f3.entry.js +2 -0
- package/dist/native/{p-ae7ab110.entry.js.map → p-dc7dd7f3.entry.js.map} +1 -1
- package/dist/native/p-e2c1992e.entry.js +2 -0
- package/dist/native/{p-656c56f0.entry.js.map → p-e2c1992e.entry.js.map} +1 -1
- package/dist/native/{p-f85c08f1.js → p-e2d0a77d.js} +2 -2
- package/dist/native/p-ed6019fe.entry.js +2 -0
- package/dist/native/p-ed6019fe.entry.js.map +1 -0
- package/dist/native/p-f94d7054.entry.js +2 -0
- package/dist/native/{p-49cac014.entry.js.map → p-f94d7054.entry.js.map} +1 -1
- package/dist/native/p-fdea17ce.entry.js +2 -0
- package/dist/native/p-fdea17ce.entry.js.map +1 -0
- package/dist/types/components/nv-calendar/nv-calendar.d.ts +26 -50
- package/dist/types/components/nv-calendar/partials/calendar-actions.d.ts +19 -0
- package/dist/types/components/nv-calendar/partials/calendar-grid.d.ts +46 -0
- package/dist/types/components/nv-calendar/partials/calendar-header.d.ts +38 -0
- package/dist/types/components/nv-calendar/partials/calendar-shortcuts.d.ts +35 -0
- package/dist/types/components/nv-calendar/partials/day-cell.d.ts +35 -0
- package/dist/types/components/nv-calendar/partials/index.d.ts +6 -0
- package/dist/types/components/nv-calendar/partials/week-numbers.d.ts +30 -0
- package/dist/types/components/nv-calendar/test/partials/calendar-actions.logic.test.d.ts +1 -0
- package/dist/types/components/nv-calendar/test/partials/calendar-grid.logic.test.d.ts +1 -0
- package/dist/types/components/nv-calendar/test/partials/calendar-header.logic.test.d.ts +1 -0
- package/dist/types/components/nv-calendar/test/partials/calendar-shortcuts.logic.test.d.ts +1 -0
- package/dist/types/components/nv-calendar/test/partials/day-cell.logic.test.d.ts +1 -0
- package/dist/types/components/nv-calendar/test/partials/week-numbers.logic.test.d.ts +1 -0
- package/dist/types/components/nv-datagrid/nv-datagrid.d.ts +0 -16
- package/dist/types/components/nv-datagridcolumn/nv-datagridcolumn.d.ts +4 -0
- package/dist/types/components/nv-fielddate/nv-fielddate.d.ts +21 -9
- package/dist/types/components/nv-fielddate/test/nv-fielddate.logic.test.d.ts +1 -0
- package/dist/types/components/nv-fielddaterange/nv-fielddaterange.d.ts +24 -3
- package/dist/types/components/nv-fielddaterange/test/nv-fielddaterange.logic.test.d.ts +1 -0
- package/dist/types/components/nv-fielddropdown/nv-fielddropdown.d.ts +47 -26
- package/dist/types/components/nv-fieldmultiselect/nv-fieldmultiselect.d.ts +61 -55
- package/dist/types/components/nv-fieldslider/nv-fieldslider.d.ts +229 -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 +1 -0
- package/dist/types/components/nv-icon/nv-icons.d.ts +1 -1
- package/dist/types/components.d.ts +402 -54
- package/dist/types/interfaces/Column.d.ts +5 -1
- package/dist/vscode-data.json +121 -9
- package/hydrate/index.js +1664 -584
- package/hydrate/index.mjs +1664 -584
- package/package.json +6 -2
- package/dist/cjs/index-9bda5507.js.map +0 -1
- package/dist/components/p-1c45c0f2.js.map +0 -1
- package/dist/components/p-76646ce9.js +0 -88
- package/dist/components/p-76646ce9.js.map +0 -1
- package/dist/components/p-854c32dc.js.map +0 -1
- package/dist/components/p-9decffb6.js +0 -167
- package/dist/components/p-9decffb6.js.map +0 -1
- package/dist/components/p-f76bb0c3.js.map +0 -1
- package/dist/esm/index-1fb7a9a6.js.map +0 -1
- package/dist/native/p-244f56ac.entry.js +0 -2
- package/dist/native/p-2523eead.entry.js +0 -2
- package/dist/native/p-2523eead.entry.js.map +0 -1
- package/dist/native/p-470588c2.entry.js.map +0 -1
- package/dist/native/p-49cac014.entry.js +0 -2
- package/dist/native/p-4d164ed6.entry.js +0 -2
- package/dist/native/p-4dc1d036.entry.js +0 -2
- package/dist/native/p-4e635fa7.entry.js +0 -2
- package/dist/native/p-4e635fa7.entry.js.map +0 -1
- package/dist/native/p-5d21532a.entry.js +0 -2
- package/dist/native/p-5d21532a.entry.js.map +0 -1
- package/dist/native/p-656c56f0.entry.js +0 -2
- package/dist/native/p-7042ba8a.entry.js +0 -2
- package/dist/native/p-7e154bfd.entry.js +0 -2
- package/dist/native/p-7e154bfd.entry.js.map +0 -1
- package/dist/native/p-7eba904e.entry.js +0 -2
- package/dist/native/p-7eba904e.entry.js.map +0 -1
- package/dist/native/p-9135fdf5.entry.js +0 -2
- package/dist/native/p-ab002252.js +0 -3
- package/dist/native/p-ab002252.js.map +0 -1
- package/dist/native/p-ae7ab110.entry.js +0 -2
- package/dist/native/p-b94d9f0b.entry.js +0 -2
- package/dist/native/p-c71c6f23.entry.js +0 -2
- package/dist/native/p-c71c6f23.entry.js.map +0 -1
- package/dist/native/p-d9a52884.entry.js +0 -2
- package/dist/native/p-d9a52884.entry.js.map +0 -1
- package/dist/native/p-efe6a46c.entry.js +0 -2
- package/dist/native/p-f2ef6771.entry.js +0 -2
- package/dist/native/p-f5f68992.entry.js +0 -2
- package/dist/native/p-f5f68992.entry.js.map +0 -1
- package/dist/native/p-fc97f071.entry.js +0 -2
- /package/dist/native/{p-615947e7.entry.js.map → p-08ca678c.entry.js.map} +0 -0
- /package/dist/native/{p-7fd4d13d.entry.js.map → p-1c1ecd38.entry.js.map} +0 -0
- /package/dist/native/{p-c7b201cd.entry.js.map → p-1d98477d.entry.js.map} +0 -0
- /package/dist/native/{p-1da72182.entry.js.map → p-2006f5d4.entry.js.map} +0 -0
- /package/dist/native/{p-f2ef6771.entry.js.map → p-4f9cdf0b.entry.js.map} +0 -0
- /package/dist/native/{p-3b7ef609.entry.js.map → p-58bb90ad.entry.js.map} +0 -0
- /package/dist/native/{p-3cd77d82.entry.js.map → p-5b6c59e0.entry.js.map} +0 -0
- /package/dist/native/{p-08a75cfa.entry.js.map → p-60c64f2b.entry.js.map} +0 -0
- /package/dist/native/{p-c67186f8.entry.js.map → p-83288db0.entry.js.map} +0 -0
- /package/dist/native/{p-0245863d.entry.js.map → p-86ab23ea.entry.js.map} +0 -0
- /package/dist/native/{p-4dc1d036.entry.js.map → p-87784622.entry.js.map} +0 -0
- /package/dist/native/{p-14c07207.entry.js.map → p-914da1e1.entry.js.map} +0 -0
- /package/dist/native/{p-c0f79bac.entry.js.map → p-ad128108.entry.js.map} +0 -0
- /package/dist/native/{p-e5de64d5.entry.js.map → p-b5b9190a.entry.js.map} +0 -0
- /package/dist/native/{p-b8b6875d.entry.js.map → p-d040bd61.entry.js.map} +0 -0
- /package/dist/native/{p-3953464e.entry.js.map → p-d21b2da2.entry.js.map} +0 -0
- /package/dist/native/{p-90e6d9dd.entry.js.map → p-d53e8795.entry.js.map} +0 -0
- /package/dist/native/{p-f85c08f1.js.map → p-e2d0a77d.js.map} +0 -0
|
@@ -46,7 +46,10 @@ export class NvFielddate {
|
|
|
46
46
|
this.autofocus = false;
|
|
47
47
|
/**
|
|
48
48
|
* The initial value of the input (date in string format).
|
|
49
|
+
* @bind value
|
|
49
50
|
*/
|
|
51
|
+
// eslint-disable-next-line @stencil-community/own-props-must-be-private
|
|
52
|
+
// eslint-disable-next-line @stencil-community/strict-mutable
|
|
50
53
|
this.value = '';
|
|
51
54
|
/**
|
|
52
55
|
* The current value of the input date in string format.
|
|
@@ -132,7 +135,7 @@ export class NvFielddate {
|
|
|
132
135
|
};
|
|
133
136
|
/**
|
|
134
137
|
* Handles the input event on the input element.
|
|
135
|
-
* Updates the singleValue and emits the
|
|
138
|
+
* Updates the singleValue and emits the valueChanged event.
|
|
136
139
|
* @param {Event} event - The input event.
|
|
137
140
|
*/
|
|
138
141
|
this.handleInput = (event) => {
|
|
@@ -141,8 +144,13 @@ export class NvFielddate {
|
|
|
141
144
|
return;
|
|
142
145
|
}
|
|
143
146
|
const input = event.target;
|
|
147
|
+
const previousValue = this.value;
|
|
144
148
|
this.singleValue = input.value;
|
|
145
|
-
this.
|
|
149
|
+
this.value = input.value;
|
|
150
|
+
// Only emit valueChanged if the value actually changed
|
|
151
|
+
if (previousValue !== input.value) {
|
|
152
|
+
this.valueChanged.emit(input.value);
|
|
153
|
+
}
|
|
146
154
|
};
|
|
147
155
|
/**
|
|
148
156
|
* Toggles the opening/closing of the popover.
|
|
@@ -164,6 +172,27 @@ export class NvFielddate {
|
|
|
164
172
|
return;
|
|
165
173
|
}
|
|
166
174
|
};
|
|
175
|
+
/**
|
|
176
|
+
* Prevents the valueChanged event from the calendar from propagating up.
|
|
177
|
+
* @param {CustomEvent} event - The valueChanged event from nv-calendar.
|
|
178
|
+
*/
|
|
179
|
+
this.handleCalendarValueChanged = (event) => {
|
|
180
|
+
event.stopPropagation();
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Sets the reference to the popover element.
|
|
184
|
+
* @param {HTMLNvPopoverElement} el - The popover element.
|
|
185
|
+
*/
|
|
186
|
+
this.setPopoverRef = (el) => {
|
|
187
|
+
this.popoverElement = el;
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Sets the reference to the input element.
|
|
191
|
+
* @param {HTMLInputElement} el - The input element.
|
|
192
|
+
*/
|
|
193
|
+
this.setInputRef = (el) => {
|
|
194
|
+
this.inputElement = el;
|
|
195
|
+
};
|
|
167
196
|
}
|
|
168
197
|
//#endregion PROPERTIES
|
|
169
198
|
/****************************************************************************/
|
|
@@ -220,8 +249,13 @@ export class NvFielddate {
|
|
|
220
249
|
*/
|
|
221
250
|
handleSingleDateChange(event) {
|
|
222
251
|
const value = event.detail;
|
|
252
|
+
const previousValue = this.value;
|
|
223
253
|
this.singleValue = value;
|
|
224
|
-
this.
|
|
254
|
+
this.value = value;
|
|
255
|
+
// Only emit valueChanged if the value actually changed
|
|
256
|
+
if (previousValue !== value) {
|
|
257
|
+
this.valueChanged.emit(value);
|
|
258
|
+
}
|
|
225
259
|
if (!this.showActions) {
|
|
226
260
|
this.open = false;
|
|
227
261
|
}
|
|
@@ -251,12 +285,12 @@ export class NvFielddate {
|
|
|
251
285
|
/****************************************************************************/
|
|
252
286
|
//#region RENDER
|
|
253
287
|
render() {
|
|
254
|
-
return (h(Host, { key: '
|
|
255
|
-
this.el.querySelector('[slot="label"]')) && (h("label", { key: '
|
|
288
|
+
return (h(Host, { key: '4af4649cc8fdc95f2f12d1c495549a006c82c742' }, ((this.label && this.label.length > 0) ||
|
|
289
|
+
this.el.querySelector('[slot="label"]')) && (h("label", { key: 'c4905c94c62c8eb01120b30e3b5c16c2dafec20d', htmlFor: this.inputId }, h("slot", { key: 'b8e952b9a6acb9f136d3461514b82a6767723c3c', name: "label" }, this.label))), h("nv-popover", { key: 'de6620c60eb3db3c6f0f435977f257636be81a80', ref: this.setPopoverRef, id: this.popoverId, triggerMode: "controlled", placement: "bottom-start", open: this.open }, h("div", { key: 'e2189ad3476f3d088c07153bc4c1e63357317ded', slot: "trigger", class: "input-wrapper" }, h("slot", { key: 'a35e545f1379c479734719d8460d5031631f5730', name: "before-input" }), h("div", { key: '01338c24dfff69e019ff6d2344f176effb2dac06', class: "input-container", onClick: this.handleInputContainerClick }, h("slot", { key: 'f6552d188174e77e8f75a9b0554e3ea78c57056d', name: "leading-input" }), h("input", { key: '1b9ad6226166b6bf08afda41f0f6b789fe12dd27', id: this.inputId, ref: this.setInputRef, placeholder: this.placeholder, name: this.name, disabled: this.disabled, readOnly: this.readonly, required: this.required, autofocus: this.autofocus, value: this.singleValue, onInput: this.handleInput, onFocus: this.handleFocus, "data-scope": "date" }), this.error && (h("nv-icon", { key: '0527f051261672a8df205d26dcb253c20b3dfd4b', name: "alert-circle", class: "validation", size: "md" })), this.success && (h("nv-icon", { key: 'ed83a0a0b7a88f392f16bf97f20885261f88665d', name: "circle-check", class: "validation", size: "md" })), h("nv-iconbutton", { key: '6abf3dff6a1bcc0759bea91ab3674d61f4c016c2', class: "toggle-calendar-icon", name: "calendar" //{this.open ? 'chevron-top' : 'chevron-down'}
|
|
256
290
|
,
|
|
257
|
-
size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide calendar' : 'Show calendar', "aria-pressed": this.open.toString(), onClick: this.toggleCalendar, tabIndex: this.disabled ? -1 : 0 })), h("slot", { key: '
|
|
258
|
-
this.el.querySelector('[slot="description"]')) && (h("div", { key: '
|
|
259
|
-
this.el.querySelector('[slot="error-description"]')) && (h("div", { key: '
|
|
291
|
+
size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide calendar' : 'Show calendar', "aria-pressed": this.open.toString(), onClick: this.toggleCalendar, tabIndex: this.disabled ? -1 : 0 })), h("slot", { key: '76d584ac756b228e356a17ad36e4558f9a497ea3', name: "after-input" })), h("div", { key: '4914e6fa5046fb287bedb841f2a0b71f1f86e5a3', slot: "content" }, h("nv-calendar", { key: 'fcfb949ee9c378aac2d7c792ed79fcb3cbf8e987', dateFormat: this.dateFormat, singleValue: this.singleValue, firstDayOfWeek: this.firstDayOfWeek, numberOfCalendars: this.numberOfCalendars, min: this.min, max: this.max, locale: this.locale, shortcutsPlacement: this.shortcutsPlacement, showActions: this.showActions, shortcuts: this.shortcuts, showWeekNumbers: this.showWeekNumbers, disabledDates: this.disabledDates, onValueChanged: this.handleCalendarValueChanged }))), ((this.description && this.description.length > 0) ||
|
|
292
|
+
this.el.querySelector('[slot="description"]')) && (h("div", { key: '52ffcb5f41161b9dc95c0fc18a252b6568817ffb', class: "description" }, h("slot", { key: '91c68f28fe31f5ecfa58d80e5decb018890f18fe', name: "description" }, this.description))), (this.errorDescription ||
|
|
293
|
+
this.el.querySelector('[slot="error-description"]')) && (h("div", { key: '0c0b8c65f261c2439446dd05014d172e6b829244', hidden: !this.error, class: "error-description" }, this.el.querySelector('[slot="error-description"]') ? (h("slot", { name: "error-description" })) : (this.errorDescription))), h("slot", { key: 'cf9410ad858faf59d7ada7ce70b18aa768e30a65' })));
|
|
260
294
|
}
|
|
261
295
|
static get is() { return "nv-fielddate"; }
|
|
262
296
|
static get originalStyleUrls() {
|
|
@@ -508,7 +542,7 @@ export class NvFielddate {
|
|
|
508
542
|
},
|
|
509
543
|
"value": {
|
|
510
544
|
"type": "string",
|
|
511
|
-
"mutable":
|
|
545
|
+
"mutable": true,
|
|
512
546
|
"complexType": {
|
|
513
547
|
"original": "string",
|
|
514
548
|
"resolved": "string",
|
|
@@ -517,7 +551,10 @@ export class NvFielddate {
|
|
|
517
551
|
"required": false,
|
|
518
552
|
"optional": false,
|
|
519
553
|
"docs": {
|
|
520
|
-
"tags": [
|
|
554
|
+
"tags": [{
|
|
555
|
+
"name": "bind",
|
|
556
|
+
"text": "value"
|
|
557
|
+
}],
|
|
521
558
|
"text": "The initial value of the input (date in string format)."
|
|
522
559
|
},
|
|
523
560
|
"getter": false,
|
|
@@ -806,18 +843,21 @@ export class NvFielddate {
|
|
|
806
843
|
}
|
|
807
844
|
static get events() {
|
|
808
845
|
return [{
|
|
809
|
-
"method": "
|
|
810
|
-
"name": "
|
|
846
|
+
"method": "valueChanged",
|
|
847
|
+
"name": "valueChanged",
|
|
811
848
|
"bubbles": true,
|
|
812
849
|
"cancelable": true,
|
|
813
850
|
"composed": true,
|
|
814
851
|
"docs": {
|
|
815
|
-
"tags": [
|
|
816
|
-
|
|
852
|
+
"tags": [{
|
|
853
|
+
"name": "bind",
|
|
854
|
+
"text": "value"
|
|
855
|
+
}],
|
|
856
|
+
"text": "Emitted when the value changes (unified value binding)."
|
|
817
857
|
},
|
|
818
858
|
"complexType": {
|
|
819
|
-
"original": "
|
|
820
|
-
"resolved": "
|
|
859
|
+
"original": "string",
|
|
860
|
+
"resolved": "string",
|
|
821
861
|
"references": {}
|
|
822
862
|
}
|
|
823
863
|
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nv-fielddate.js","sourceRoot":"","sources":["../../../src/components/nv-fielddate/nv-fielddate.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,CAAC,EACD,IAAI,EACJ,KAAK,EACL,OAAO,EACP,KAAK,EAEL,MAAM,EACN,IAAI,EACJ,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC;;;;;;;;GAQG;AAMH,MAAM,OAAO,WAAW;IALxB;QAUU,cAAS,GAAW,MAAM,EAAE,CAAC;QAErC,8EAA8E;QAC9E,oBA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import {\n Component,\n h,\n Prop,\n State,\n Element,\n Event,\n EventEmitter,\n Listen,\n Host,\n Watch,\n} from '@stencil/core';\nimport Inputmask from 'inputmask';\nimport { v4 as uuidv4 } from 'uuid';\n\n/**\n * @slot default - Child content of the component.\n * @slot leading-input - Content to be placed before the input text, within the input container.\n * @slot before-input - Content to be placed before the input text, outside the input container.\n * @slot after-input - Content to be placed after the input text, outside the input container.\n * @slot label - Content to be placed as the label, will override the label prop.\n * @slot description - Content to be placed as the description, will override the description prop.\n * @slot error-description - Content to be placed as the error description, will override the errorDescription prop.\n */\n@Component({\n tag: 'nv-fielddate',\n styleUrl: 'styles/nv-fielddate.scss',\n shadow: false,\n})\nexport class NvFielddate {\n @Element() el: HTMLNvFielddateElement;\n private inputElement!: HTMLInputElement;\n\n private popoverElement!: HTMLNvPopoverElement;\n private popoverId: string = uuidv4();\n\n /****************************************************************************/\n //#region PROPERTIES\n\n /**\n * Sets the ID for the input element and the for attribute of the associated\n * label. If no ID is provided, a random one will be automatically generated.\n */\n @Prop({ reflect: true })\n readonly inputId: string = uuidv4();\n\n /**\n * Text displayed as label. A slot label can override this prop.\n */\n @Prop({ reflect: true })\n readonly label: string;\n\n /**\n * Description displayed below the input. A slot description can override this prop.\n */\n @Prop({ reflect: true })\n readonly description: string;\n\n /**\n * Placeholder for the input field.\n */\n @Prop({ reflect: true })\n readonly placeholder: string;\n\n /**\n * Name attribute for the input.\n */\n @Prop({ reflect: true })\n readonly name: string;\n\n /**\n * Disables the input field.\n */\n @Prop({ reflect: true })\n readonly disabled: boolean = false;\n\n /**\n * Sets the input field as read-only.\n */\n @Prop({ reflect: true })\n readonly readonly: boolean = false;\n\n /**\n * Marks the input field as required.\n */\n @Prop({ reflect: true })\n readonly required: boolean = false;\n\n /**\n * Indicates an error state.\n */\n @Prop({ reflect: true })\n readonly error: boolean = false;\n\n /**\n * Error description. A slot error-description can override this prop.\n */\n @Prop({ reflect: true })\n readonly errorDescription?: string;\n\n /**\n * Indicates a success state.\n */\n @Prop({ reflect: true })\n readonly success: boolean = false;\n\n /**\n * Autofocus the input when the component is mounted.\n */\n @Prop({ reflect: true })\n // eslint-disable-next-line @stencil-community/reserved-member-names\n readonly autofocus: boolean = false;\n\n /**\n * The initial value of the input (date in string format).\n */\n @Prop({ reflect: true })\n readonly value: string = '';\n\n /**\n * The current value of the input date in string format.\n */\n @State()\n singleValue: string = '';\n\n /**\n * Controls the opening of the popover.\n */\n @State()\n open: boolean = false;\n\n /**\n * First day of the week 0 = Sunday, 1 = Monday, etc.\n * @default 1\n */\n @Prop({ reflect: true })\n readonly firstDayOfWeek: number = 1;\n\n /**\n * Number of calendars to display\n * @default 1\n */\n @Prop({ reflect: true })\n readonly numberOfCalendars: number = 1;\n\n /**\n * Minimum date for selection ISO string format, ex: 2025-01-01\n */\n @Prop({ reflect: true })\n readonly min?: string = '';\n\n /**\n * Maximum date for selection ISO string format, ex: 2025-12-31\n */\n @Prop({ reflect: true })\n readonly max?: string = '';\n\n /** Locale for date formatting\n * @default 'en-BE'\n */\n @Prop({ reflect: true })\n readonly locale: string = 'en-BE';\n\n /** Date format ex: YYYY-MM-DD, DD-MM-YYYY, etc.\n * @default 'YYYY-MM-DD'\n * @note If the date format is in UTC mode, the date will be displayed in UTC time.\n * @note If the date format is not in UTC mode, the date will be displayed in the local time.\n */\n @Prop({ reflect: true })\n readonly dateFormat: string = 'YYYY-MM-DD';\n\n /**\n * Footer placement\n * @default 'bottom'\n */\n @Prop({ reflect: true })\n readonly shortcutsPlacement: 'bottom' | 'left' | 'right' = 'bottom';\n\n /**\n * Show action buttons\n * @default false\n */\n @Prop({ reflect: true })\n readonly showActions: boolean = false;\n\n /**\n * Custom actions to display in the footer\n */\n @Prop({ reflect: true })\n readonly shortcuts: HTMLNvCalendarElement['shortcuts'];\n\n /**\n * Show week numbers\n * @default true\n */\n @Prop({ reflect: true })\n readonly showWeekNumbers: boolean;\n\n /**\n * Disabled dates ISO string array\n */\n @Prop({ reflect: true })\n readonly disabledDates: Array<string>;\n\n /**\n * Allows the field to stretch and fill the entire width of its container.\n */\n @Prop({ reflect: true })\n readonly fluid: boolean = false;\n\n //#endregion PROPERTIES\n /****************************************************************************/\n //#region METHODS\n\n /**\n * Converts the nv-calendar date format to the format expected by Inputmask.\n * @param {string} format - The date format.\n * @returns {string} Format adapted for Inputmask.\n */\n private convertToInputmaskFormat(format: string): string {\n switch (format) {\n case 'DD/MM/YYYY':\n return 'dd/mm/yyyy';\n case 'MM/DD/YYYY':\n return 'mm/dd/yyyy';\n case 'YYYY-MM-DD':\n return 'yyyy-mm-dd';\n case 'DD.MM.YYYY':\n return 'dd.mm.yyyy';\n case 'YYYYMMDD':\n return 'yyyymmdd';\n default:\n return format;\n }\n }\n\n /**\n * Closes the popover when a click is detected outside the component.\n * @param {MouseEvent} event - The click event.\n */\n private handleClickOutside = (event: MouseEvent) => {\n if (this.open && this.el && !this.el.contains(event.target as Node)) {\n this.open = false;\n }\n };\n\n /**\n * Focuses the input when the input container is clicked.\n * @param {MouseEvent} event - The click event.\n */\n private handleInputContainerClick = (event: MouseEvent) => {\n if (this.readonly || this.disabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n this.inputElement.focus();\n // Select the first characters based on the date format\n const format = this.dateFormat;\n if (format.startsWith('DD')) {\n this.inputElement.setSelectionRange(0, 2);\n } else if (format.startsWith('MM')) {\n this.inputElement.setSelectionRange(0, 2);\n } else if (format.startsWith('YYYY')) {\n this.inputElement.setSelectionRange(0, 4);\n }\n };\n\n /**\n * Handles the input event on the input element.\n * Updates the singleValue and emits the dateChange event.\n * @param {Event} event - The input event.\n */\n private handleInput = (event: Event) => {\n if (this.readonly || this.disabled) {\n event.preventDefault();\n return;\n }\n const input = event.target as HTMLInputElement;\n this.singleValue = input.value;\n this.dateChange.emit({ value: input.value });\n };\n\n /**\n * Toggles the opening/closing of the popover.\n */\n private toggleCalendar = () => {\n if (this.readonly || this.disabled) {\n return;\n }\n this.open = !this.open;\n };\n\n /**\n * Handles focus events on the input element.\n * @param {FocusEvent} event - The focus event.\n */\n private handleFocus = (event: FocusEvent) => {\n if (this.readonly || this.disabled) {\n event.preventDefault();\n (event.target as HTMLElement).blur();\n return;\n }\n };\n\n //#endregion METHODS\n /****************************************************************************/\n //#region LIFECYCLE\n\n connectedCallback() {\n document.addEventListener('click', this.handleClickOutside);\n }\n\n componentWillLoad() {\n if (this.value) {\n this.singleValue = this.value;\n }\n }\n\n componentDidLoad() {\n const inputs = this.el.querySelectorAll('.input-wrapper input');\n inputs.forEach((input: HTMLInputElement) => {\n Inputmask({\n alias: 'datetime',\n inputFormat: this.convertToInputmaskFormat(this.dateFormat),\n placeholder: '_'.repeat(this.dateFormat.length),\n }).mask(input);\n });\n }\n\n disconnectedCallback() {\n document.removeEventListener('click', this.handleClickOutside);\n }\n\n //#endregion LIFECYCLE\n /****************************************************************************/\n //#region EVENTS\n\n /**\n * Emits an event when the date changes.\n */\n @Event()\n dateChange: EventEmitter<{\n /**\n * The date value.\n */\n value: string;\n }>;\n\n /**\n * Handles the single date selection event from nv-calendar.\n * Updates the input value and closes the popover.\n * @param {CustomEvent} event - The event from nv-calendar.\n */\n @Listen('singleDateChange')\n handleSingleDateChange(event: CustomEvent) {\n const value: string = event.detail;\n this.singleValue = value;\n this.dateChange.emit({ value });\n if (!this.showActions) {\n this.open = false;\n }\n }\n\n @Listen('closePopover')\n handleClosePopover() {\n this.open = false;\n }\n\n @Listen('keydown', { passive: false })\n handleKeyDown(event: KeyboardEvent) {\n if (!this.open) {\n if (event.key === 'ArrowDown') {\n this.open = true;\n\n event.preventDefault();\n return;\n }\n return;\n }\n\n // Verify if the popover element is defined\n if (!this.popoverElement) {\n console.warn('nv-fielddate -> Popover element is not defined');\n return;\n }\n }\n\n @Watch('value')\n handleValueChange(newValue: string) {\n this.singleValue = newValue;\n }\n\n //#endregion EVENTS\n /****************************************************************************/\n //#region RENDER\n render() {\n return (\n <Host>\n {((this.label && this.label.length > 0) ||\n this.el.querySelector('[slot=\"label\"]')) && (\n <label htmlFor={this.inputId}>\n <slot name=\"label\">{this.label}</slot>\n </label>\n )}\n\n <nv-popover\n ref={el => (this.popoverElement = el as HTMLNvPopoverElement)}\n id={this.popoverId}\n triggerMode=\"controlled\"\n placement=\"bottom-start\"\n open={this.open}\n >\n <div slot=\"trigger\" class=\"input-wrapper\">\n <slot name=\"before-input\"></slot>\n\n <div\n class=\"input-container\"\n onClick={this.handleInputContainerClick}\n >\n <slot name=\"leading-input\"></slot>\n\n <input\n id={this.inputId}\n ref={e => (this.inputElement = e)}\n placeholder={this.placeholder}\n name={this.name}\n disabled={this.disabled}\n readOnly={this.readonly}\n required={this.required}\n autofocus={this.autofocus}\n value={this.singleValue}\n onInput={this.handleInput}\n onFocus={this.handleFocus}\n data-scope=\"date\"\n />\n\n {this.error && (\n <nv-icon name=\"alert-circle\" class=\"validation\" size=\"md\" />\n )}\n {this.success && (\n <nv-icon name=\"circle-check\" class=\"validation\" size=\"md\" />\n )}\n\n <nv-iconbutton\n class=\"toggle-calendar-icon\"\n name=\"calendar\" //{this.open ? 'chevron-top' : 'chevron-down'}\n size=\"md\"\n emphasis=\"lower\"\n aria-label={this.open ? 'Hide calendar' : 'Show calendar'}\n aria-pressed={this.open.toString()}\n onClick={this.toggleCalendar}\n tabIndex={this.disabled ? -1 : 0}\n />\n </div>\n\n <slot name=\"after-input\"></slot>\n </div>\n\n <div slot=\"content\">\n <nv-calendar\n dateFormat={this.dateFormat}\n singleValue={this.singleValue}\n firstDayOfWeek={this.firstDayOfWeek}\n numberOfCalendars={this.numberOfCalendars}\n min={this.min}\n max={this.max}\n locale={this.locale}\n shortcutsPlacement={this.shortcutsPlacement}\n showActions={this.showActions}\n shortcuts={this.shortcuts}\n showWeekNumbers={this.showWeekNumbers}\n disabledDates={this.disabledDates}\n ></nv-calendar>\n </div>\n </nv-popover>\n\n {((this.description && this.description.length > 0) ||\n this.el.querySelector('[slot=\"description\"]')) && (\n <div class=\"description\">\n <slot name=\"description\">{this.description}</slot>\n </div>\n )}\n\n {(this.errorDescription ||\n this.el.querySelector('[slot=\"error-description\"]')) && (\n <div hidden={!this.error} class=\"error-description\">\n {this.el.querySelector('[slot=\"error-description\"]') ? (\n <slot name=\"error-description\"></slot>\n ) : (\n this.errorDescription\n )}\n </div>\n )}\n\n <slot></slot>\n </Host>\n );\n }\n //#endregion RENDER\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nv-fielddate.js","sourceRoot":"","sources":["../../../src/components/nv-fielddate/nv-fielddate.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,CAAC,EACD,IAAI,EACJ,KAAK,EACL,OAAO,EACP,KAAK,EAEL,MAAM,EACN,IAAI,EACJ,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC;;;;;;;;GAQG;AAMH,MAAM,OAAO,WAAW;IALxB;QAUU,cAAS,GAAW,MAAM,EAAE,CAAC;QAErC,8EAA8E;QAC9E,oBAAoB;QAEpB;;;WAGG;QAEM,YAAO,GAAW,MAAM,EAAE,CAAC;QA0BpC;;WAEG;QAEM,aAAQ,GAAY,KAAK,CAAC;QAEnC;;WAEG;QAEM,aAAQ,GAAY,KAAK,CAAC;QAEnC;;WAEG;QAEM,aAAQ,GAAY,KAAK,CAAC;QAEnC;;WAEG;QAEM,UAAK,GAAY,KAAK,CAAC;QAQhC;;WAEG;QAEM,YAAO,GAAY,KAAK,CAAC;QAElC;;WAEG;QAGM,cAAS,GAAY,KAAK,CAAC;QAEpC;;;WAGG;QACH,wEAAwE;QACxE,6DAA6D;QAE7D,UAAK,GAAW,EAAE,CAAC;QAEnB;;WAEG;QAEH,gBAAW,GAAW,EAAE,CAAC;QAEzB;;WA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import {\n Component,\n h,\n Prop,\n State,\n Element,\n Event,\n EventEmitter,\n Listen,\n Host,\n Watch,\n} from '@stencil/core';\nimport Inputmask from 'inputmask';\nimport { v4 as uuidv4 } from 'uuid';\n\n/**\n * @slot default - Child content of the component.\n * @slot leading-input - Content to be placed before the input text, within the input container.\n * @slot before-input - Content to be placed before the input text, outside the input container.\n * @slot after-input - Content to be placed after the input text, outside the input container.\n * @slot label - Content to be placed as the label, will override the label prop.\n * @slot description - Content to be placed as the description, will override the description prop.\n * @slot error-description - Content to be placed as the error description, will override the errorDescription prop.\n */\n@Component({\n tag: 'nv-fielddate',\n styleUrl: 'styles/nv-fielddate.scss',\n shadow: false,\n})\nexport class NvFielddate {\n @Element() el: HTMLNvFielddateElement;\n private inputElement!: HTMLInputElement;\n\n private popoverElement!: HTMLNvPopoverElement;\n private popoverId: string = uuidv4();\n\n /****************************************************************************/\n //#region PROPERTIES\n\n /**\n * Sets the ID for the input element and the for attribute of the associated\n * label. If no ID is provided, a random one will be automatically generated.\n */\n @Prop({ reflect: true })\n readonly inputId: string = uuidv4();\n\n /**\n * Text displayed as label. A slot label can override this prop.\n */\n @Prop({ reflect: true })\n readonly label: string;\n\n /**\n * Description displayed below the input. A slot description can override this prop.\n */\n @Prop({ reflect: true })\n readonly description: string;\n\n /**\n * Placeholder for the input field.\n */\n @Prop({ reflect: true })\n readonly placeholder: string;\n\n /**\n * Name attribute for the input.\n */\n @Prop({ reflect: true })\n readonly name: string;\n\n /**\n * Disables the input field.\n */\n @Prop({ reflect: true })\n readonly disabled: boolean = false;\n\n /**\n * Sets the input field as read-only.\n */\n @Prop({ reflect: true })\n readonly readonly: boolean = false;\n\n /**\n * Marks the input field as required.\n */\n @Prop({ reflect: true })\n readonly required: boolean = false;\n\n /**\n * Indicates an error state.\n */\n @Prop({ reflect: true })\n readonly error: boolean = false;\n\n /**\n * Error description. A slot error-description can override this prop.\n */\n @Prop({ reflect: true })\n readonly errorDescription?: string;\n\n /**\n * Indicates a success state.\n */\n @Prop({ reflect: true })\n readonly success: boolean = false;\n\n /**\n * Autofocus the input when the component is mounted.\n */\n @Prop({ reflect: true })\n // eslint-disable-next-line @stencil-community/reserved-member-names\n readonly autofocus: boolean = false;\n\n /**\n * The initial value of the input (date in string format).\n * @bind value\n */\n // eslint-disable-next-line @stencil-community/own-props-must-be-private\n // eslint-disable-next-line @stencil-community/strict-mutable\n @Prop({ reflect: true, mutable: true })\n value: string = '';\n\n /**\n * The current value of the input date in string format.\n */\n @State()\n singleValue: string = '';\n\n /**\n * Controls the opening of the popover.\n */\n @State()\n open: boolean = false;\n\n /**\n * First day of the week 0 = Sunday, 1 = Monday, etc.\n * @default 1\n */\n @Prop({ reflect: true })\n readonly firstDayOfWeek: number = 1;\n\n /**\n * Number of calendars to display\n * @default 1\n */\n @Prop({ reflect: true })\n readonly numberOfCalendars: number = 1;\n\n /**\n * Minimum date for selection ISO string format, ex: 2025-01-01\n */\n @Prop({ reflect: true })\n readonly min?: string = '';\n\n /**\n * Maximum date for selection ISO string format, ex: 2025-12-31\n */\n @Prop({ reflect: true })\n readonly max?: string = '';\n\n /** Locale for date formatting\n * @default 'en-BE'\n */\n @Prop({ reflect: true })\n readonly locale: string = 'en-BE';\n\n /** Date format ex: YYYY-MM-DD, DD-MM-YYYY, etc.\n * @default 'YYYY-MM-DD'\n * @note If the date format is in UTC mode, the date will be displayed in UTC time.\n * @note If the date format is not in UTC mode, the date will be displayed in the local time.\n */\n @Prop({ reflect: true })\n readonly dateFormat: string = 'YYYY-MM-DD';\n\n /**\n * Footer placement\n * @default 'bottom'\n */\n @Prop({ reflect: true })\n readonly shortcutsPlacement: 'bottom' | 'left' | 'right' = 'bottom';\n\n /**\n * Show action buttons\n * @default false\n */\n @Prop({ reflect: true })\n readonly showActions: boolean = false;\n\n /**\n * Custom actions to display in the footer\n */\n @Prop({ reflect: true })\n readonly shortcuts: HTMLNvCalendarElement['shortcuts'];\n\n /**\n * Show week numbers\n * @default true\n */\n @Prop({ reflect: true })\n readonly showWeekNumbers: boolean;\n\n /**\n * Disabled dates ISO string array\n */\n @Prop({ reflect: true })\n readonly disabledDates: Array<string>;\n\n /**\n * Allows the field to stretch and fill the entire width of its container.\n */\n @Prop({ reflect: true })\n readonly fluid: boolean = false;\n\n //#endregion PROPERTIES\n /****************************************************************************/\n //#region METHODS\n\n /**\n * Converts the nv-calendar date format to the format expected by Inputmask.\n * @param {string} format - The date format.\n * @returns {string} Format adapted for Inputmask.\n */\n private convertToInputmaskFormat(format: string): string {\n switch (format) {\n case 'DD/MM/YYYY':\n return 'dd/mm/yyyy';\n case 'MM/DD/YYYY':\n return 'mm/dd/yyyy';\n case 'YYYY-MM-DD':\n return 'yyyy-mm-dd';\n case 'DD.MM.YYYY':\n return 'dd.mm.yyyy';\n case 'YYYYMMDD':\n return 'yyyymmdd';\n default:\n return format;\n }\n }\n\n /**\n * Closes the popover when a click is detected outside the component.\n * @param {MouseEvent} event - The click event.\n */\n private handleClickOutside = (event: MouseEvent) => {\n if (this.open && this.el && !this.el.contains(event.target as Node)) {\n this.open = false;\n }\n };\n\n /**\n * Focuses the input when the input container is clicked.\n * @param {MouseEvent} event - The click event.\n */\n private handleInputContainerClick = (event: MouseEvent) => {\n if (this.readonly || this.disabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n this.inputElement.focus();\n // Select the first characters based on the date format\n const format = this.dateFormat;\n if (format.startsWith('DD')) {\n this.inputElement.setSelectionRange(0, 2);\n } else if (format.startsWith('MM')) {\n this.inputElement.setSelectionRange(0, 2);\n } else if (format.startsWith('YYYY')) {\n this.inputElement.setSelectionRange(0, 4);\n }\n };\n\n /**\n * Handles the input event on the input element.\n * Updates the singleValue and emits the valueChanged event.\n * @param {Event} event - The input event.\n */\n private handleInput = (event: Event) => {\n if (this.readonly || this.disabled) {\n event.preventDefault();\n return;\n }\n const input = event.target as HTMLInputElement;\n const previousValue = this.value;\n this.singleValue = input.value;\n this.value = input.value;\n // Only emit valueChanged if the value actually changed\n if (previousValue !== input.value) {\n this.valueChanged.emit(input.value);\n }\n };\n\n /**\n * Toggles the opening/closing of the popover.\n */\n private toggleCalendar = () => {\n if (this.readonly || this.disabled) {\n return;\n }\n this.open = !this.open;\n };\n\n /**\n * Handles focus events on the input element.\n * @param {FocusEvent} event - The focus event.\n */\n private handleFocus = (event: FocusEvent) => {\n if (this.readonly || this.disabled) {\n event.preventDefault();\n (event.target as HTMLElement).blur();\n return;\n }\n };\n\n /**\n * Prevents the valueChanged event from the calendar from propagating up.\n * @param {CustomEvent} event - The valueChanged event from nv-calendar.\n */\n private handleCalendarValueChanged = (event: CustomEvent) => {\n event.stopPropagation();\n };\n\n /**\n * Sets the reference to the popover element.\n * @param {HTMLNvPopoverElement} el - The popover element.\n */\n private setPopoverRef = (el: HTMLNvPopoverElement) => {\n this.popoverElement = el;\n };\n\n /**\n * Sets the reference to the input element.\n * @param {HTMLInputElement} el - The input element.\n */\n private setInputRef = (el: HTMLInputElement) => {\n this.inputElement = el;\n };\n\n //#endregion METHODS\n /****************************************************************************/\n //#region LIFECYCLE\n\n connectedCallback() {\n document.addEventListener('click', this.handleClickOutside);\n }\n\n componentWillLoad() {\n if (this.value) {\n this.singleValue = this.value;\n }\n }\n\n componentDidLoad() {\n const inputs = this.el.querySelectorAll('.input-wrapper input');\n inputs.forEach((input: HTMLInputElement) => {\n Inputmask({\n alias: 'datetime',\n inputFormat: this.convertToInputmaskFormat(this.dateFormat),\n placeholder: '_'.repeat(this.dateFormat.length),\n }).mask(input);\n });\n }\n\n disconnectedCallback() {\n document.removeEventListener('click', this.handleClickOutside);\n }\n\n //#endregion LIFECYCLE\n /****************************************************************************/\n //#region EVENTS\n\n /**\n * Emitted when the value changes (unified value binding).\n * @bind value\n */\n @Event()\n valueChanged: EventEmitter<string>;\n\n /**\n * Handles the single date selection event from nv-calendar.\n * Updates the input value and closes the popover.\n * @param {CustomEvent} event - The event from nv-calendar.\n */\n @Listen('singleDateChange')\n handleSingleDateChange(event: CustomEvent) {\n const value: string = event.detail;\n const previousValue = this.value;\n this.singleValue = value;\n this.value = value;\n // Only emit valueChanged if the value actually changed\n if (previousValue !== value) {\n this.valueChanged.emit(value);\n }\n if (!this.showActions) {\n this.open = false;\n }\n }\n\n @Listen('closePopover')\n handleClosePopover() {\n this.open = false;\n }\n\n @Listen('keydown', { passive: false })\n handleKeyDown(event: KeyboardEvent) {\n if (!this.open) {\n if (event.key === 'ArrowDown') {\n this.open = true;\n\n event.preventDefault();\n return;\n }\n return;\n }\n\n // Verify if the popover element is defined\n if (!this.popoverElement) {\n console.warn('nv-fielddate -> Popover element is not defined');\n return;\n }\n }\n\n @Watch('value')\n handleValueChange(newValue: string) {\n this.singleValue = newValue;\n }\n\n //#endregion EVENTS\n /****************************************************************************/\n //#region RENDER\n render() {\n return (\n <Host>\n {((this.label && this.label.length > 0) ||\n this.el.querySelector('[slot=\"label\"]')) && (\n <label htmlFor={this.inputId}>\n <slot name=\"label\">{this.label}</slot>\n </label>\n )}\n\n <nv-popover\n ref={this.setPopoverRef}\n id={this.popoverId}\n triggerMode=\"controlled\"\n placement=\"bottom-start\"\n open={this.open}\n >\n <div slot=\"trigger\" class=\"input-wrapper\">\n <slot name=\"before-input\"></slot>\n\n <div\n class=\"input-container\"\n onClick={this.handleInputContainerClick}\n >\n <slot name=\"leading-input\"></slot>\n\n <input\n id={this.inputId}\n ref={this.setInputRef}\n placeholder={this.placeholder}\n name={this.name}\n disabled={this.disabled}\n readOnly={this.readonly}\n required={this.required}\n autofocus={this.autofocus}\n value={this.singleValue}\n onInput={this.handleInput}\n onFocus={this.handleFocus}\n data-scope=\"date\"\n />\n\n {this.error && (\n <nv-icon name=\"alert-circle\" class=\"validation\" size=\"md\" />\n )}\n {this.success && (\n <nv-icon name=\"circle-check\" class=\"validation\" size=\"md\" />\n )}\n\n <nv-iconbutton\n class=\"toggle-calendar-icon\"\n name=\"calendar\" //{this.open ? 'chevron-top' : 'chevron-down'}\n size=\"md\"\n emphasis=\"lower\"\n aria-label={this.open ? 'Hide calendar' : 'Show calendar'}\n aria-pressed={this.open.toString()}\n onClick={this.toggleCalendar}\n tabIndex={this.disabled ? -1 : 0}\n />\n </div>\n\n <slot name=\"after-input\"></slot>\n </div>\n\n <div slot=\"content\">\n <nv-calendar\n dateFormat={this.dateFormat}\n singleValue={this.singleValue}\n firstDayOfWeek={this.firstDayOfWeek}\n numberOfCalendars={this.numberOfCalendars}\n min={this.min}\n max={this.max}\n locale={this.locale}\n shortcutsPlacement={this.shortcutsPlacement}\n showActions={this.showActions}\n shortcuts={this.shortcuts}\n showWeekNumbers={this.showWeekNumbers}\n disabledDates={this.disabledDates}\n onValueChanged={this.handleCalendarValueChanged}\n ></nv-calendar>\n </div>\n </nv-popover>\n\n {((this.description && this.description.length > 0) ||\n this.el.querySelector('[slot=\"description\"]')) && (\n <div class=\"description\">\n <slot name=\"description\">{this.description}</slot>\n </div>\n )}\n\n {(this.errorDescription ||\n this.el.querySelector('[slot=\"error-description\"]')) && (\n <div hidden={!this.error} class=\"error-description\">\n {this.el.querySelector('[slot=\"error-description\"]') ? (\n <slot name=\"error-description\"></slot>\n ) : (\n this.errorDescription\n )}\n </div>\n )}\n\n <slot></slot>\n </Host>\n );\n }\n //#endregion RENDER\n}\n"]}
|
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
/* TODO: integrate this logic in the proper structure */
|
|
2
|
+
nv-fieldslider .slider-container .track-container:has(.thumb:hover) .track-range {
|
|
3
|
+
background: var(--components-slider-track-filled-hover);
|
|
4
|
+
}
|
|
5
|
+
nv-fieldslider .slider-container .track-container:has(.thumb:hover) .thumb {
|
|
6
|
+
border-color: var(--components-slider-track-filled-hover);
|
|
7
|
+
}
|
|
8
|
+
nv-fieldslider .slider-container .track-container:has(.thumb:focus) .track-range {
|
|
9
|
+
background: var(--components-slider-track-filled-focus);
|
|
10
|
+
}
|
|
11
|
+
nv-fieldslider .slider-container .track-container:has(.thumb:focus) .thumb {
|
|
12
|
+
border-color: var(--components-slider-track-filled-focus);
|
|
13
|
+
}
|
|
14
|
+
nv-fieldslider[error] .slider-container .track-container .track .track-range {
|
|
15
|
+
background: var(--components-slider-track-filled-error);
|
|
16
|
+
}
|
|
17
|
+
nv-fieldslider[error] .slider-container .track-container .track .thumb {
|
|
18
|
+
border-color: var(--components-slider-track-filled-error);
|
|
19
|
+
}
|
|
20
|
+
nv-fieldslider[error] .slider-container .track-container .track .thumb:hover {
|
|
21
|
+
border-color: var(--components-slider-track-filled-error);
|
|
22
|
+
outline: calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);
|
|
23
|
+
outline-offset: calc(var(--focus-outline-offset) * 1);
|
|
24
|
+
background-color: var(--components-slider-handler-background-error);
|
|
25
|
+
}
|
|
26
|
+
nv-fieldslider[error] .slider-container .track-container .track .thumb:focus {
|
|
27
|
+
border-color: var(--components-slider-track-filled-error);
|
|
28
|
+
outline: calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);
|
|
29
|
+
outline-offset: calc(var(--focus-outline-offset) * 1);
|
|
30
|
+
background-color: var(--components-slider-track-filled-error);
|
|
31
|
+
}
|
|
32
|
+
nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .track-range {
|
|
33
|
+
background: var(--components-slider-track-filled-error);
|
|
34
|
+
}
|
|
35
|
+
nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .thumb {
|
|
36
|
+
border-color: var(--components-slider-track-filled-error);
|
|
37
|
+
}
|
|
38
|
+
|
|
1
39
|
nv-fielddate {
|
|
2
40
|
--nv-field-border-default: var(--components-form-field-border-default);
|
|
3
41
|
--nv-field-border-hover: var(--components-form-field-border-hover);
|
|
@@ -30,7 +68,7 @@ nv-fielddate[error]:not([error=false]) {
|
|
|
30
68
|
--nv-field-border-focus: var(--nv-field-border-default);
|
|
31
69
|
--nv-field-border-disabled: var(--nv-field-border-default);
|
|
32
70
|
--nv-field-border-readonly: var(--nv-field-border-default);
|
|
33
|
-
--nv-field-focus-box-shadow: var(--color-focus-destructive);
|
|
71
|
+
--nv-field-focus-box-shadow: var(--color-focus-destructive-in-field);
|
|
34
72
|
}
|
|
35
73
|
nv-fielddate[success]:not([success=false]) {
|
|
36
74
|
--nv-field-border-default: var(--components-form-field-border-success);
|
|
@@ -128,6 +166,7 @@ nv-fielddate .input-wrapper .input-container input {
|
|
|
128
166
|
font-weight: 500;
|
|
129
167
|
line-height: var(--form-field-line-height);
|
|
130
168
|
width: 100%;
|
|
169
|
+
/* Hide Edge built-in password reveal and clear icons */
|
|
131
170
|
}
|
|
132
171
|
nv-fielddate .input-wrapper .input-container input:focus {
|
|
133
172
|
outline: none;
|
|
@@ -142,6 +181,11 @@ nv-fielddate .input-wrapper .input-container input::placeholder {
|
|
|
142
181
|
font-weight: 400;
|
|
143
182
|
line-height: var(--form-field-line-height);
|
|
144
183
|
}
|
|
184
|
+
nv-fielddate .input-wrapper .input-container input[type=password]::-ms-clear, nv-fielddate .input-wrapper .input-container input[type=password]::-ms-reveal {
|
|
185
|
+
display: none;
|
|
186
|
+
width: 0;
|
|
187
|
+
height: 0;
|
|
188
|
+
}
|
|
145
189
|
nv-fielddate .input-wrapper .input-container > nv-iconbutton {
|
|
146
190
|
border: 0px;
|
|
147
191
|
border-radius: 0px;
|
|
@@ -154,7 +198,10 @@ nv-fielddate .input-wrapper .input-container nv-icon.validation {
|
|
|
154
198
|
color: var(--nv-field-border-default);
|
|
155
199
|
}
|
|
156
200
|
nv-fielddate .description {
|
|
201
|
+
display: flex;
|
|
202
|
+
align-items: center;
|
|
157
203
|
align-self: stretch;
|
|
204
|
+
gap: var(--spacing-1);
|
|
158
205
|
color: var(--components-form-text-description-default);
|
|
159
206
|
font-family: "TT Norms Pro", sans-serif;
|
|
160
207
|
font-size: var(--form-description-font-size);
|
|
@@ -162,7 +209,10 @@ nv-fielddate .description {
|
|
|
162
209
|
line-height: var(--form-description-line-height);
|
|
163
210
|
}
|
|
164
211
|
nv-fielddate .error-description {
|
|
212
|
+
display: flex;
|
|
213
|
+
align-items: center;
|
|
165
214
|
align-self: stretch;
|
|
215
|
+
gap: var(--spacing-1);
|
|
166
216
|
color: var(--components-form-text-description-default);
|
|
167
217
|
font-family: "TT Norms Pro", sans-serif;
|
|
168
218
|
font-size: var(--form-description-font-size);
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
2
|
+
import { describe, it, expect } from "vitest";
|
|
3
|
+
/**
|
|
4
|
+
* Logic tests for nv-fielddate basic functionality
|
|
5
|
+
*
|
|
6
|
+
* These tests validate basic utility functions and logic
|
|
7
|
+
* without testing the full component implementation.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Utility function to convert date format to inputmask format
|
|
11
|
+
* @param {string} format - The date format
|
|
12
|
+
* @returns {string} Format adapted for Inputmask
|
|
13
|
+
*/
|
|
14
|
+
function convertToInputmaskFormat(format) {
|
|
15
|
+
switch (format) {
|
|
16
|
+
case 'DD/MM/YYYY':
|
|
17
|
+
return 'dd/mm/yyyy';
|
|
18
|
+
case 'MM/DD/YYYY':
|
|
19
|
+
return 'mm/dd/yyyy';
|
|
20
|
+
case 'YYYY-MM-DD':
|
|
21
|
+
return 'yyyy-mm-dd';
|
|
22
|
+
case 'DD.MM.YYYY':
|
|
23
|
+
return 'dd.mm.yyyy';
|
|
24
|
+
case 'YYYYMMDD':
|
|
25
|
+
return 'yyyymmdd';
|
|
26
|
+
default:
|
|
27
|
+
return format;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Utility function to validate date format
|
|
32
|
+
* @param {string} dateString - Date string to validate
|
|
33
|
+
* @param {string} format - Expected format
|
|
34
|
+
* @returns {boolean} Whether the date matches the format
|
|
35
|
+
*/
|
|
36
|
+
function isValidDateFormat(dateString, format) {
|
|
37
|
+
if (!dateString || !format)
|
|
38
|
+
return false;
|
|
39
|
+
const formatMap = {
|
|
40
|
+
'DD/MM/YYYY': /^\d{2}\/\d{2}\/\d{4}$/,
|
|
41
|
+
'MM/DD/YYYY': /^\d{2}\/\d{2}\/\d{4}$/,
|
|
42
|
+
'YYYY-MM-DD': /^\d{4}-\d{2}-\d{2}$/,
|
|
43
|
+
'DD.MM.YYYY': /^\d{2}\.\d{2}\.\d{4}$/,
|
|
44
|
+
'YYYYMMDD': /^\d{8}$/,
|
|
45
|
+
};
|
|
46
|
+
const regex = formatMap[format];
|
|
47
|
+
return regex ? regex.test(dateString) : false;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Utility function to check if a value has changed
|
|
51
|
+
* @param {string} oldValue - Previous value
|
|
52
|
+
* @param {string} newValue - New value
|
|
53
|
+
* @returns {boolean} Whether the value has changed
|
|
54
|
+
*/
|
|
55
|
+
function hasValueChanged(oldValue, newValue) {
|
|
56
|
+
return oldValue !== newValue;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Utility function to normalize empty values
|
|
60
|
+
* @param {string | null | undefined} value - Value to normalize
|
|
61
|
+
* @returns {string} Normalized value
|
|
62
|
+
*/
|
|
63
|
+
function normalizeValue(value) {
|
|
64
|
+
return value || '';
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Utility function to determine selection range based on date format
|
|
68
|
+
* @param {string} format - Date format
|
|
69
|
+
* @returns {object} Selection range with start and end
|
|
70
|
+
*/
|
|
71
|
+
function getSelectionRange(format) {
|
|
72
|
+
if (format.startsWith('DD') || format.startsWith('MM')) {
|
|
73
|
+
return { start: 0, end: 2 };
|
|
74
|
+
}
|
|
75
|
+
else if (format.startsWith('YYYY')) {
|
|
76
|
+
return { start: 0, end: 4 };
|
|
77
|
+
}
|
|
78
|
+
return { start: 0, end: 0 };
|
|
79
|
+
}
|
|
80
|
+
describe('nv-fielddate - Logic Tests', () => {
|
|
81
|
+
describe('Input Mask Format Conversion', () => {
|
|
82
|
+
it('should convert DD/MM/YYYY format correctly', () => {
|
|
83
|
+
expect(convertToInputmaskFormat('DD/MM/YYYY')).toBe('dd/mm/yyyy');
|
|
84
|
+
});
|
|
85
|
+
it('should convert MM/DD/YYYY format correctly', () => {
|
|
86
|
+
expect(convertToInputmaskFormat('MM/DD/YYYY')).toBe('mm/dd/yyyy');
|
|
87
|
+
});
|
|
88
|
+
it('should convert YYYY-MM-DD format correctly', () => {
|
|
89
|
+
expect(convertToInputmaskFormat('YYYY-MM-DD')).toBe('yyyy-mm-dd');
|
|
90
|
+
});
|
|
91
|
+
it('should convert DD.MM.YYYY format correctly', () => {
|
|
92
|
+
expect(convertToInputmaskFormat('DD.MM.YYYY')).toBe('dd.mm.yyyy');
|
|
93
|
+
});
|
|
94
|
+
it('should convert YYYYMMDD format correctly', () => {
|
|
95
|
+
expect(convertToInputmaskFormat('YYYYMMDD')).toBe('yyyymmdd');
|
|
96
|
+
});
|
|
97
|
+
it('should return original format for unknown formats', () => {
|
|
98
|
+
const unknownFormat = 'CUSTOM-FORMAT';
|
|
99
|
+
expect(convertToInputmaskFormat(unknownFormat)).toBe(unknownFormat);
|
|
100
|
+
});
|
|
101
|
+
it('should handle empty string', () => {
|
|
102
|
+
expect(convertToInputmaskFormat('')).toBe('');
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
describe('Date Format Validation', () => {
|
|
106
|
+
it('should validate DD/MM/YYYY format correctly', () => {
|
|
107
|
+
expect(isValidDateFormat('15/03/2024', 'DD/MM/YYYY')).toBe(true);
|
|
108
|
+
expect(isValidDateFormat('1/3/2024', 'DD/MM/YYYY')).toBe(false);
|
|
109
|
+
expect(isValidDateFormat('15-03-2024', 'DD/MM/YYYY')).toBe(false);
|
|
110
|
+
expect(isValidDateFormat('', 'DD/MM/YYYY')).toBe(false);
|
|
111
|
+
});
|
|
112
|
+
it('should validate MM/DD/YYYY format correctly', () => {
|
|
113
|
+
expect(isValidDateFormat('03/15/2024', 'MM/DD/YYYY')).toBe(true);
|
|
114
|
+
expect(isValidDateFormat('3/15/2024', 'MM/DD/YYYY')).toBe(false);
|
|
115
|
+
expect(isValidDateFormat('03-15-2024', 'MM/DD/YYYY')).toBe(false);
|
|
116
|
+
});
|
|
117
|
+
it('should validate YYYY-MM-DD format correctly', () => {
|
|
118
|
+
expect(isValidDateFormat('2024-03-15', 'YYYY-MM-DD')).toBe(true);
|
|
119
|
+
expect(isValidDateFormat('24-3-15', 'YYYY-MM-DD')).toBe(false);
|
|
120
|
+
expect(isValidDateFormat('2024/03/15', 'YYYY-MM-DD')).toBe(false);
|
|
121
|
+
});
|
|
122
|
+
it('should validate DD.MM.YYYY format correctly', () => {
|
|
123
|
+
expect(isValidDateFormat('15.03.2024', 'DD.MM.YYYY')).toBe(true);
|
|
124
|
+
expect(isValidDateFormat('15/03/2024', 'DD.MM.YYYY')).toBe(false);
|
|
125
|
+
});
|
|
126
|
+
it('should validate YYYYMMDD format correctly', () => {
|
|
127
|
+
expect(isValidDateFormat('20240315', 'YYYYMMDD')).toBe(true);
|
|
128
|
+
expect(isValidDateFormat('2024-03-15', 'YYYYMMDD')).toBe(false);
|
|
129
|
+
});
|
|
130
|
+
it('should handle invalid inputs gracefully', () => {
|
|
131
|
+
expect(isValidDateFormat('invalid', 'DD/MM/YYYY')).toBe(false);
|
|
132
|
+
expect(isValidDateFormat('15/03/2024', 'UNKNOWN_FORMAT')).toBe(false);
|
|
133
|
+
expect(isValidDateFormat('', '')).toBe(false);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
describe('Value Change Detection', () => {
|
|
137
|
+
it('should detect when value changes', () => {
|
|
138
|
+
expect(hasValueChanged('', '2024-03-15')).toBe(true);
|
|
139
|
+
expect(hasValueChanged('2024-03-15', '2024-03-16')).toBe(true);
|
|
140
|
+
expect(hasValueChanged('2024-03-15', '2024-03-15')).toBe(false);
|
|
141
|
+
});
|
|
142
|
+
it('should handle empty values correctly', () => {
|
|
143
|
+
expect(hasValueChanged('', '')).toBe(false);
|
|
144
|
+
expect(hasValueChanged('value', '')).toBe(true);
|
|
145
|
+
expect(hasValueChanged('', 'value')).toBe(true);
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
describe('Value Normalization', () => {
|
|
149
|
+
it('should normalize empty values correctly', () => {
|
|
150
|
+
expect(normalizeValue('')).toBe('');
|
|
151
|
+
expect(normalizeValue('2024-03-15')).toBe('2024-03-15');
|
|
152
|
+
expect(normalizeValue(null)).toBe('');
|
|
153
|
+
expect(normalizeValue(undefined)).toBe('');
|
|
154
|
+
});
|
|
155
|
+
it('should preserve valid values', () => {
|
|
156
|
+
const validValue = '15/03/2024';
|
|
157
|
+
expect(normalizeValue(validValue)).toBe(validValue);
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
describe('Selection Range Logic', () => {
|
|
161
|
+
it('should return correct range for DD format', () => {
|
|
162
|
+
expect(getSelectionRange('DD/MM/YYYY')).toEqual({ start: 0, end: 2 });
|
|
163
|
+
expect(getSelectionRange('DD.MM.YYYY')).toEqual({ start: 0, end: 2 });
|
|
164
|
+
});
|
|
165
|
+
it('should return correct range for MM format', () => {
|
|
166
|
+
expect(getSelectionRange('MM/DD/YYYY')).toEqual({ start: 0, end: 2 });
|
|
167
|
+
});
|
|
168
|
+
it('should return correct range for YYYY format', () => {
|
|
169
|
+
expect(getSelectionRange('YYYY-MM-DD')).toEqual({ start: 0, end: 4 });
|
|
170
|
+
expect(getSelectionRange('YYYYMMDD')).toEqual({ start: 0, end: 4 });
|
|
171
|
+
});
|
|
172
|
+
it('should handle unknown formats', () => {
|
|
173
|
+
expect(getSelectionRange('UNKNOWN')).toEqual({ start: 0, end: 0 });
|
|
174
|
+
expect(getSelectionRange('')).toEqual({ start: 0, end: 0 });
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
describe('Edge Cases', () => {
|
|
178
|
+
it('should handle leap year dates in validation', () => {
|
|
179
|
+
expect(isValidDateFormat('29/02/2024', 'DD/MM/YYYY')).toBe(true);
|
|
180
|
+
expect(isValidDateFormat('2024-02-29', 'YYYY-MM-DD')).toBe(true);
|
|
181
|
+
});
|
|
182
|
+
it('should handle year boundaries', () => {
|
|
183
|
+
expect(isValidDateFormat('31/12/2024', 'DD/MM/YYYY')).toBe(true);
|
|
184
|
+
expect(isValidDateFormat('01/01/2025', 'DD/MM/YYYY')).toBe(true);
|
|
185
|
+
});
|
|
186
|
+
it('should handle format conversion edge cases', () => {
|
|
187
|
+
expect(convertToInputmaskFormat(null)).toBe(null);
|
|
188
|
+
expect(convertToInputmaskFormat(undefined)).toBe(undefined);
|
|
189
|
+
});
|
|
190
|
+
it('should handle value change detection with special characters', () => {
|
|
191
|
+
expect(hasValueChanged('15/03/2024', '15/03/2024')).toBe(false);
|
|
192
|
+
expect(hasValueChanged('15/03/2024', '15-03-2024')).toBe(true);
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
//# sourceMappingURL=nv-fielddate.logic.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nv-fielddate.logic.test.js","sourceRoot":"","sources":["../../../../src/components/nv-fielddate/test/nv-fielddate.logic.test.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C;;;;;GAKG;AAEH;;;;GAIG;AACH,SAAS,wBAAwB,CAAC,MAAc;IAC9C,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,YAAY;YACf,OAAO,YAAY,CAAC;QACtB,KAAK,YAAY;YACf,OAAO,YAAY,CAAC;QACtB,KAAK,YAAY;YACf,OAAO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ests for nv-fielddate basic functionality\n *\n * These tests validate basic utility functions and logic\n * without testing the full component implementation.\n */\n\n/**\n * Utility function to convert date format to inputmask format\n * @param {string} format - The date format\n * @returns {string} Format adapted for Inputmask\n */\nfunction convertToInputmaskFormat(format: string): string {\n switch (format) {\n case 'DD/MM/YYYY':\n return 'dd/mm/yyyy';\n case 'MM/DD/YYYY':\n return 'mm/dd/yyyy';\n case 'YYYY-MM-DD':\n return 'yyyy-mm-dd';\n case 'DD.MM.YYYY':\n return 'dd.mm.yyyy';\n case 'YYYYMMDD':\n return 'yyyymmdd';\n default:\n return format;\n }\n}\n\n/**\n * Utility function to validate date format\n * @param {string} dateString - Date string to validate\n * @param {string} format - Expected format\n * @returns {boolean} Whether the date matches the format\n */\nfunction isValidDateFormat(dateString: string, format: string): boolean {\n if (!dateString || !format) return false;\n\n const formatMap = {\n 'DD/MM/YYYY': /^\\d{2}\\/\\d{2}\\/\\d{4}$/,\n 'MM/DD/YYYY': /^\\d{2}\\/\\d{2}\\/\\d{4}$/,\n 'YYYY-MM-DD': /^\\d{4}-\\d{2}-\\d{2}$/,\n 'DD.MM.YYYY': /^\\d{2}\\.\\d{2}\\.\\d{4}$/,\n 'YYYYMMDD': /^\\d{8}$/,\n };\n\n const regex = formatMap[format as keyof typeof formatMap];\n return regex ? regex.test(dateString) : false;\n}\n\n/**\n * Utility function to check if a value has changed\n * @param {string} oldValue - Previous value\n * @param {string} newValue - New value\n * @returns {boolean} Whether the value has changed\n */\nfunction hasValueChanged(oldValue: string, newValue: string): boolean {\n return oldValue !== newValue;\n}\n\n/**\n * Utility function to normalize empty values\n * @param {string | null | undefined} value - Value to normalize\n * @returns {string} Normalized value\n */\nfunction normalizeValue(value: string | null | undefined): string {\n return value || '';\n}\n\n/**\n * Utility function to determine selection range based on date format\n * @param {string} format - Date format\n * @returns {object} Selection range with start and end\n */\nfunction getSelectionRange(format: string): { start: number; end: number } {\n if (format.startsWith('DD') || format.startsWith('MM')) {\n return { start: 0, end: 2 };\n } else if (format.startsWith('YYYY')) {\n return { start: 0, end: 4 };\n }\n return { start: 0, end: 0 };\n}\n\ndescribe('nv-fielddate - Logic Tests', () => {\n describe('Input Mask Format Conversion', () => {\n it('should convert DD/MM/YYYY format correctly', () => {\n expect(convertToInputmaskFormat('DD/MM/YYYY')).toBe('dd/mm/yyyy');\n });\n\n it('should convert MM/DD/YYYY format correctly', () => {\n expect(convertToInputmaskFormat('MM/DD/YYYY')).toBe('mm/dd/yyyy');\n });\n\n it('should convert YYYY-MM-DD format correctly', () => {\n expect(convertToInputmaskFormat('YYYY-MM-DD')).toBe('yyyy-mm-dd');\n });\n\n it('should convert DD.MM.YYYY format correctly', () => {\n expect(convertToInputmaskFormat('DD.MM.YYYY')).toBe('dd.mm.yyyy');\n });\n\n it('should convert YYYYMMDD format correctly', () => {\n expect(convertToInputmaskFormat('YYYYMMDD')).toBe('yyyymmdd');\n });\n\n it('should return original format for unknown formats', () => {\n const unknownFormat = 'CUSTOM-FORMAT';\n expect(convertToInputmaskFormat(unknownFormat)).toBe(unknownFormat);\n });\n\n it('should handle empty string', () => {\n expect(convertToInputmaskFormat('')).toBe('');\n });\n });\n\n describe('Date Format Validation', () => {\n it('should validate DD/MM/YYYY format correctly', () => {\n expect(isValidDateFormat('15/03/2024', 'DD/MM/YYYY')).toBe(true);\n expect(isValidDateFormat('1/3/2024', 'DD/MM/YYYY')).toBe(false);\n expect(isValidDateFormat('15-03-2024', 'DD/MM/YYYY')).toBe(false);\n expect(isValidDateFormat('', 'DD/MM/YYYY')).toBe(false);\n });\n\n it('should validate MM/DD/YYYY format correctly', () => {\n expect(isValidDateFormat('03/15/2024', 'MM/DD/YYYY')).toBe(true);\n expect(isValidDateFormat('3/15/2024', 'MM/DD/YYYY')).toBe(false);\n expect(isValidDateFormat('03-15-2024', 'MM/DD/YYYY')).toBe(false);\n });\n\n it('should validate YYYY-MM-DD format correctly', () => {\n expect(isValidDateFormat('2024-03-15', 'YYYY-MM-DD')).toBe(true);\n expect(isValidDateFormat('24-3-15', 'YYYY-MM-DD')).toBe(false);\n expect(isValidDateFormat('2024/03/15', 'YYYY-MM-DD')).toBe(false);\n });\n\n it('should validate DD.MM.YYYY format correctly', () => {\n expect(isValidDateFormat('15.03.2024', 'DD.MM.YYYY')).toBe(true);\n expect(isValidDateFormat('15/03/2024', 'DD.MM.YYYY')).toBe(false);\n });\n\n it('should validate YYYYMMDD format correctly', () => {\n expect(isValidDateFormat('20240315', 'YYYYMMDD')).toBe(true);\n expect(isValidDateFormat('2024-03-15', 'YYYYMMDD')).toBe(false);\n });\n\n it('should handle invalid inputs gracefully', () => {\n expect(isValidDateFormat('invalid', 'DD/MM/YYYY')).toBe(false);\n expect(isValidDateFormat('15/03/2024', 'UNKNOWN_FORMAT')).toBe(false);\n expect(isValidDateFormat('', '')).toBe(false);\n });\n });\n\n describe('Value Change Detection', () => {\n it('should detect when value changes', () => {\n expect(hasValueChanged('', '2024-03-15')).toBe(true);\n expect(hasValueChanged('2024-03-15', '2024-03-16')).toBe(true);\n expect(hasValueChanged('2024-03-15', '2024-03-15')).toBe(false);\n });\n\n it('should handle empty values correctly', () => {\n expect(hasValueChanged('', '')).toBe(false);\n expect(hasValueChanged('value', '')).toBe(true);\n expect(hasValueChanged('', 'value')).toBe(true);\n });\n });\n\n describe('Value Normalization', () => {\n it('should normalize empty values correctly', () => {\n expect(normalizeValue('')).toBe('');\n expect(normalizeValue('2024-03-15')).toBe('2024-03-15');\n expect(normalizeValue(null)).toBe('');\n expect(normalizeValue(undefined)).toBe('');\n });\n\n it('should preserve valid values', () => {\n const validValue = '15/03/2024';\n expect(normalizeValue(validValue)).toBe(validValue);\n });\n });\n\n describe('Selection Range Logic', () => {\n it('should return correct range for DD format', () => {\n expect(getSelectionRange('DD/MM/YYYY')).toEqual({ start: 0, end: 2 });\n expect(getSelectionRange('DD.MM.YYYY')).toEqual({ start: 0, end: 2 });\n });\n\n it('should return correct range for MM format', () => {\n expect(getSelectionRange('MM/DD/YYYY')).toEqual({ start: 0, end: 2 });\n });\n\n it('should return correct range for YYYY format', () => {\n expect(getSelectionRange('YYYY-MM-DD')).toEqual({ start: 0, end: 4 });\n expect(getSelectionRange('YYYYMMDD')).toEqual({ start: 0, end: 4 });\n });\n\n it('should handle unknown formats', () => {\n expect(getSelectionRange('UNKNOWN')).toEqual({ start: 0, end: 0 });\n expect(getSelectionRange('')).toEqual({ start: 0, end: 0 });\n });\n });\n\n describe('Edge Cases', () => {\n it('should handle leap year dates in validation', () => {\n expect(isValidDateFormat('29/02/2024', 'DD/MM/YYYY')).toBe(true);\n expect(isValidDateFormat('2024-02-29', 'YYYY-MM-DD')).toBe(true);\n });\n\n it('should handle year boundaries', () => {\n expect(isValidDateFormat('31/12/2024', 'DD/MM/YYYY')).toBe(true);\n expect(isValidDateFormat('01/01/2025', 'DD/MM/YYYY')).toBe(true);\n });\n\n it('should handle format conversion edge cases', () => {\n expect(convertToInputmaskFormat(null as unknown as string)).toBe(null);\n expect(convertToInputmaskFormat(undefined as unknown as string)).toBe(\n undefined,\n );\n });\n\n it('should handle value change detection with special characters', () => {\n expect(hasValueChanged('15/03/2024', '15/03/2024')).toBe(false);\n expect(hasValueChanged('15/03/2024', '15-03-2024')).toBe(true);\n });\n });\n});\n"]}
|