@nova-design-system/nova-webcomponents 3.18.0-beta.0 → 3.19.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.cjs.js +33 -2
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/native.cjs.js +1 -1
- package/dist/cjs/nv-badge_2.cjs.entry.js +1 -1
- package/dist/cjs/nv-fielddate.cjs.entry.js +10 -6
- package/dist/cjs/nv-fielddate.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fielddaterange.cjs.entry.js +11 -7
- package/dist/cjs/nv-fielddaterange.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fielddropdown.cjs.entry.js +193 -209
- package/dist/cjs/nv-fielddropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fielddropdownitem.cjs.entry.js +7 -4
- package/dist/cjs/nv-fielddropdownitem.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldmultiselect.cjs.entry.js +4 -0
- package/dist/cjs/nv-fieldmultiselect.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldnumber.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldpassword.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldradio.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldselect.cjs.entry.js +5 -5
- package/dist/cjs/nv-fieldslider.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldtext.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldtextarea.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldtime.cjs.entry.js +557 -496
- package/dist/cjs/nv-fieldtime.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-icon.cjs.entry.js +2 -2
- package/dist/cjs/nv-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-iconbutton_2.cjs.entry.js +2 -2
- package/dist/cjs/nv-menu.cjs.entry.js +2 -2
- package/dist/cjs/nv-menu.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-menuitem.cjs.entry.js +1 -1
- package/dist/cjs/nv-notification.cjs.entry.js +1 -1
- package/dist/cjs/nv-notificationcontainer.cjs.entry.js +1 -1
- package/dist/cjs/nv-popover.cjs.entry.js +2 -2
- package/dist/cjs/nv-popover.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-row.cjs.entry.js +1 -1
- package/dist/cjs/nv-split.cjs.entry.js +1 -1
- package/dist/cjs/nv-stack.cjs.entry.js +1 -1
- package/dist/cjs/nv-table.cjs.entry.js +1 -1
- package/dist/cjs/nv-toggle.cjs.entry.js +2 -2
- package/dist/cjs/nv-togglebutton.cjs.entry.js +1 -1
- package/dist/cjs/nv-togglebuttongroup.cjs.entry.js +1 -1
- package/dist/cjs/nv-tooltip.cjs.entry.js +1 -1
- package/dist/collection/components/nv-fielddate/nv-fielddate.js +10 -6
- package/dist/collection/components/nv-fielddate/nv-fielddate.js.map +1 -1
- package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.js +10 -6
- package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.js.map +1 -1
- package/dist/collection/components/nv-fielddaterange/styles/nv-fielddaterange.css +2 -0
- package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.docs.js +31 -13
- package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.docs.js.map +1 -1
- package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.js +310 -245
- package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.js.map +1 -1
- package/dist/collection/components/nv-fielddropdownitem/nv-fielddropdownitem.js +29 -6
- package/dist/collection/components/nv-fielddropdownitem/nv-fielddropdownitem.js.map +1 -1
- package/dist/collection/components/nv-fielddropdownitemcheck/nv-fielddropdownitemcheck.js +1 -1
- package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.js +4 -0
- package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.js.map +1 -1
- package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.js +3 -3
- package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.js +3 -3
- package/dist/collection/components/nv-fieldradio/nv-fieldradio.js +3 -3
- package/dist/collection/components/nv-fieldselect/nv-fieldselect.js +5 -5
- package/dist/collection/components/nv-fieldslider/nv-fieldslider.js +3 -3
- package/dist/collection/components/nv-fieldtext/nv-fieldtext.js +3 -3
- package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.js +3 -3
- package/dist/collection/components/nv-fieldtime/nv-fieldtime.docs.js +6 -0
- package/dist/collection/components/nv-fieldtime/nv-fieldtime.docs.js.map +1 -1
- package/dist/collection/components/nv-fieldtime/nv-fieldtime.js +332 -497
- package/dist/collection/components/nv-fieldtime/nv-fieldtime.js.map +1 -1
- package/dist/collection/components/nv-fieldtime/styles/nv-fieldtime.css +1 -0
- package/dist/collection/components/nv-fieldtime/utils/format-utils.js +236 -0
- package/dist/collection/components/nv-fieldtime/utils/format-utils.js.map +1 -0
- package/dist/collection/components/nv-icon/nv-icon.js +1 -1
- package/dist/collection/components/nv-icon/nv-icons.js +13 -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 +3 -3
- 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-notification/nv-notification.js +1 -1
- package/dist/collection/components/nv-notificationcontainer/nv-notificationcontainer.js +1 -1
- package/dist/collection/components/nv-popover/nv-popover.js +2 -2
- package/dist/collection/components/nv-popover/nv-popover.js.map +1 -1
- package/dist/collection/components/nv-row/nv-row.js +1 -1
- package/dist/collection/components/nv-split/nv-split.js +1 -1
- package/dist/collection/components/nv-stack/nv-stack.js +1 -1
- package/dist/collection/components/nv-table/nv-table.js +1 -1
- package/dist/collection/components/nv-toggle/nv-toggle.js +2 -2
- package/dist/collection/components/nv-togglebutton/nv-togglebutton.js +1 -1
- package/dist/collection/components/nv-togglebuttongroup/nv-togglebuttongroup.js +1 -1
- package/dist/collection/components/nv-tooltip/nv-tooltip.js +1 -1
- package/dist/components/index.js +33 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/nv-accordion-item.js +1 -1
- package/dist/components/nv-accordion.js +4 -4
- package/dist/components/nv-alert.js +1 -1
- package/dist/components/nv-avatar.js +1 -1
- package/dist/components/nv-badge.js +1 -1
- package/dist/components/nv-breadcrumb.js +2 -2
- package/dist/components/nv-button.js +1 -1
- package/dist/components/nv-datagrid.js +2 -2
- package/dist/components/nv-dialog.js +4 -4
- package/dist/components/nv-dialogfooter.js +1 -1
- package/dist/components/nv-fielddate.js +14 -10
- package/dist/components/nv-fielddate.js.map +1 -1
- package/dist/components/nv-fielddaterange.js +15 -11
- package/dist/components/nv-fielddaterange.js.map +1 -1
- package/dist/components/nv-fielddropdown.js +207 -220
- 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 +10 -6
- package/dist/components/nv-fieldmultiselect.js.map +1 -1
- package/dist/components/nv-fieldnumber.js +1 -1
- package/dist/components/nv-fieldpassword.js +6 -6
- package/dist/components/nv-fieldradio.js +3 -3
- package/dist/components/nv-fieldselect.js +8 -8
- package/dist/components/nv-fieldslider.js +7 -7
- package/dist/components/nv-fieldtext.js +1 -1
- package/dist/components/nv-fieldtextarea.js +3 -3
- package/dist/components/nv-fieldtime.js +563 -501
- 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-menu.js.map +1 -1
- package/dist/components/nv-menuitem.js +1 -1
- package/dist/components/nv-notification.js +2 -2
- package/dist/components/nv-notificationcontainer.js +1 -1
- package/dist/components/nv-popover.js +1 -1
- package/dist/components/nv-row.js +1 -1
- package/dist/components/nv-split.js +1 -1
- package/dist/components/nv-stack.js +1 -1
- package/dist/components/nv-table.js +1 -1
- package/dist/components/nv-toggle.js +2 -2
- package/dist/components/nv-togglebutton.js +1 -1
- package/dist/components/nv-togglebuttongroup.js +1 -1
- package/dist/components/nv-tooltip.js +1 -1
- package/dist/components/{p-811c9225.js → p-18f50d91.js} +2 -2
- package/dist/components/{p-811c9225.js.map → p-18f50d91.js.map} +1 -1
- package/dist/components/{p-98429fd7.js → p-222136c2.js} +2 -2
- package/dist/components/{p-98429fd7.js.map → p-222136c2.js.map} +1 -1
- package/dist/components/{p-ec31af69.js → p-2ac6f42d.js} +3 -3
- package/dist/components/{p-ec31af69.js.map → p-2ac6f42d.js.map} +1 -1
- package/dist/components/{p-47a33f6b.js → p-334e19d3.js} +4 -4
- package/dist/components/{p-47a33f6b.js.map → p-334e19d3.js.map} +1 -1
- package/dist/components/{p-766a3f49.js → p-45a3cf85.js} +11 -7
- package/dist/components/p-45a3cf85.js.map +1 -0
- package/dist/components/{p-63595ea1.js → p-4799b6c3.js} +3 -3
- package/dist/components/p-4799b6c3.js.map +1 -0
- package/dist/components/{p-6e67bfc0.js → p-49205084.js} +5 -5
- package/dist/components/{p-6e67bfc0.js.map → p-49205084.js.map} +1 -1
- package/dist/components/{p-7684ad27.js → p-5a5db065.js} +4 -4
- package/dist/components/{p-7684ad27.js.map → p-5a5db065.js.map} +1 -1
- package/dist/components/{p-e43a36c4.js → p-60083982.js} +4 -4
- package/dist/components/{p-e43a36c4.js.map → p-60083982.js.map} +1 -1
- package/dist/components/{p-6f2b257e.js → p-81d915ef.js} +3 -3
- package/dist/components/{p-6f2b257e.js.map → p-81d915ef.js.map} +1 -1
- package/dist/components/p-946a047c.js +88 -0
- package/dist/components/p-946a047c.js.map +1 -0
- package/dist/components/{p-715e5235.js → p-a6c29711.js} +2 -2
- package/dist/components/{p-715e5235.js.map → p-a6c29711.js.map} +1 -1
- package/dist/components/{p-147cefeb.js → p-e0eb748c.js} +7 -7
- package/dist/components/{p-147cefeb.js.map → p-e0eb748c.js.map} +1 -1
- package/dist/components/{p-9e7468e3.js → p-e1b2eba2.js} +2 -2
- package/dist/components/{p-9e7468e3.js.map → p-e1b2eba2.js.map} +1 -1
- package/dist/esm/index.js +33 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/native.js +1 -1
- package/dist/esm/nv-badge_2.entry.js +1 -1
- package/dist/esm/nv-fielddate.entry.js +10 -6
- package/dist/esm/nv-fielddate.entry.js.map +1 -1
- package/dist/esm/nv-fielddaterange.entry.js +11 -7
- package/dist/esm/nv-fielddaterange.entry.js.map +1 -1
- package/dist/esm/nv-fielddropdown.entry.js +193 -209
- package/dist/esm/nv-fielddropdown.entry.js.map +1 -1
- package/dist/esm/nv-fielddropdownitem.entry.js +7 -4
- package/dist/esm/nv-fielddropdownitem.entry.js.map +1 -1
- package/dist/esm/nv-fieldmultiselect.entry.js +4 -0
- package/dist/esm/nv-fieldmultiselect.entry.js.map +1 -1
- package/dist/esm/nv-fieldnumber.entry.js +3 -3
- package/dist/esm/nv-fieldpassword.entry.js +3 -3
- package/dist/esm/nv-fieldradio.entry.js +3 -3
- package/dist/esm/nv-fieldselect.entry.js +5 -5
- package/dist/esm/nv-fieldslider.entry.js +3 -3
- package/dist/esm/nv-fieldtext.entry.js +3 -3
- package/dist/esm/nv-fieldtextarea.entry.js +3 -3
- package/dist/esm/nv-fieldtime.entry.js +558 -497
- package/dist/esm/nv-fieldtime.entry.js.map +1 -1
- package/dist/esm/nv-icon.entry.js +2 -2
- package/dist/esm/nv-icon.entry.js.map +1 -1
- package/dist/esm/nv-iconbutton_2.entry.js +2 -2
- package/dist/esm/nv-menu.entry.js +2 -2
- package/dist/esm/nv-menu.entry.js.map +1 -1
- package/dist/esm/nv-menuitem.entry.js +1 -1
- package/dist/esm/nv-notification.entry.js +1 -1
- package/dist/esm/nv-notificationcontainer.entry.js +1 -1
- package/dist/esm/nv-popover.entry.js +2 -2
- package/dist/esm/nv-popover.entry.js.map +1 -1
- package/dist/esm/nv-row.entry.js +1 -1
- package/dist/esm/nv-split.entry.js +1 -1
- package/dist/esm/nv-stack.entry.js +1 -1
- package/dist/esm/nv-table.entry.js +1 -1
- package/dist/esm/nv-toggle.entry.js +2 -2
- package/dist/esm/nv-togglebutton.entry.js +1 -1
- package/dist/esm/nv-togglebuttongroup.entry.js +1 -1
- package/dist/esm/nv-tooltip.entry.js +1 -1
- package/dist/native/index.esm.js +1 -1
- package/dist/native/index.esm.js.map +1 -1
- package/dist/native/native.esm.js +1 -1
- package/dist/native/native.esm.js.map +1 -1
- package/dist/native/{p-acada158.entry.js → p-0177409b.entry.js} +2 -2
- package/dist/native/{p-91fab6c2.entry.js → p-075d231e.entry.js} +2 -2
- package/dist/native/{p-d878e90a.entry.js → p-144d0f8a.entry.js} +2 -2
- package/dist/native/p-144d0f8a.entry.js.map +1 -0
- package/dist/native/{p-b4c15f25.entry.js → p-17666092.entry.js} +2 -2
- package/dist/native/{p-107e80c6.entry.js → p-218135b1.entry.js} +2 -2
- package/dist/native/p-218135b1.entry.js.map +1 -0
- package/dist/native/p-2a7f80f4.entry.js +2 -0
- package/dist/native/p-2a7f80f4.entry.js.map +1 -0
- package/dist/native/{p-14e622e1.entry.js → p-445221dc.entry.js} +2 -2
- package/dist/native/{p-52d2c0ae.entry.js → p-44a78545.entry.js} +2 -2
- package/dist/native/p-57420a2f.entry.js +2 -0
- package/dist/native/{p-2364aefa.entry.js → p-587d94f3.entry.js} +2 -2
- package/dist/native/{p-95184ea2.entry.js → p-6a418ec4.entry.js} +2 -2
- package/dist/native/{p-5039ceb8.entry.js → p-859bf9ad.entry.js} +2 -2
- package/dist/native/{p-5039ceb8.entry.js.map → p-859bf9ad.entry.js.map} +1 -1
- package/dist/native/{p-9d7e099f.entry.js → p-9950e075.entry.js} +2 -2
- package/dist/native/{p-2dfd786f.entry.js → p-9c432751.entry.js} +2 -2
- package/dist/native/p-a026654f.entry.js +2 -0
- package/dist/native/p-a026654f.entry.js.map +1 -0
- package/dist/native/{p-638967bf.entry.js → p-a2f58133.entry.js} +2 -2
- package/dist/native/{p-d94bf052.entry.js → p-b02c896a.entry.js} +2 -2
- package/dist/native/{p-9613087c.entry.js → p-b4382c94.entry.js} +2 -2
- package/dist/native/{p-835abdb9.entry.js → p-b626ef47.entry.js} +2 -2
- package/dist/native/{p-23ee0384.entry.js → p-c0de4bb0.entry.js} +2 -2
- package/dist/native/{p-278613a3.entry.js → p-c9fea0df.entry.js} +2 -2
- package/dist/native/{p-278613a3.entry.js.map → p-c9fea0df.entry.js.map} +1 -1
- package/dist/native/{p-ce97ce24.entry.js → p-d62869ff.entry.js} +2 -2
- package/dist/native/p-d63689da.entry.js +2 -0
- package/dist/native/p-d63689da.entry.js.map +1 -0
- package/dist/native/p-d8f3cf92.entry.js +2 -0
- package/dist/native/p-d8f3cf92.entry.js.map +1 -0
- package/dist/native/{p-cb0293ec.entry.js → p-dfb6b65e.entry.js} +2 -2
- package/dist/native/{p-230af58a.entry.js → p-e6f24210.entry.js} +2 -2
- package/dist/native/p-e6f24210.entry.js.map +1 -0
- package/dist/native/{p-647a0765.entry.js → p-eb74feb7.entry.js} +2 -2
- package/dist/native/{p-6d427897.entry.js → p-fa3e588e.entry.js} +2 -2
- package/dist/native/{p-112d096c.entry.js → p-fffbd3c1.entry.js} +2 -2
- package/dist/types/components/nv-fielddropdown/nv-fielddropdown.d.ts +54 -35
- package/dist/types/components/nv-fielddropdownitem/nv-fielddropdownitem.d.ts +7 -0
- package/dist/types/components/nv-fieldtime/nv-fieldtime.d.ts +50 -2
- package/dist/types/components/nv-fieldtime/utils/format-utils.d.ts +63 -0
- package/dist/types/components/nv-icon/nv-icons.d.ts +1 -1
- package/dist/types/components.d.ts +79 -16
- package/dist/vscode-data.json +52 -5
- package/hydrate/index.js +843 -791
- package/hydrate/index.mjs +843 -791
- package/package.json +1 -1
- package/dist/cjs/string.utils-9c581350.js +0 -25
- package/dist/cjs/string.utils-9c581350.js.map +0 -1
- package/dist/components/p-63595ea1.js.map +0 -1
- package/dist/components/p-766a3f49.js.map +0 -1
- package/dist/components/p-a5c8eee9.js +0 -22
- package/dist/components/p-a5c8eee9.js.map +0 -1
- package/dist/components/p-be6e2884.js +0 -88
- package/dist/components/p-be6e2884.js.map +0 -1
- package/dist/esm/string.utils-16aed4a7.js +0 -22
- package/dist/esm/string.utils-16aed4a7.js.map +0 -1
- package/dist/native/p-107e80c6.entry.js.map +0 -1
- package/dist/native/p-230af58a.entry.js.map +0 -1
- package/dist/native/p-74572fce.entry.js +0 -2
- package/dist/native/p-74572fce.entry.js.map +0 -1
- package/dist/native/p-a5c8eee9.js +0 -2
- package/dist/native/p-a5c8eee9.js.map +0 -1
- package/dist/native/p-bcf41cd0.entry.js +0 -2
- package/dist/native/p-d7f444fb.entry.js +0 -2
- package/dist/native/p-d7f444fb.entry.js.map +0 -1
- package/dist/native/p-d878e90a.entry.js.map +0 -1
- package/dist/native/p-ddc41f1f.entry.js +0 -2
- package/dist/native/p-ddc41f1f.entry.js.map +0 -1
- package/dist/native/p-f30e0be6.entry.js +0 -2
- package/dist/native/p-f30e0be6.entry.js.map +0 -1
- /package/dist/native/{p-acada158.entry.js.map → p-0177409b.entry.js.map} +0 -0
- /package/dist/native/{p-91fab6c2.entry.js.map → p-075d231e.entry.js.map} +0 -0
- /package/dist/native/{p-b4c15f25.entry.js.map → p-17666092.entry.js.map} +0 -0
- /package/dist/native/{p-14e622e1.entry.js.map → p-445221dc.entry.js.map} +0 -0
- /package/dist/native/{p-52d2c0ae.entry.js.map → p-44a78545.entry.js.map} +0 -0
- /package/dist/native/{p-bcf41cd0.entry.js.map → p-57420a2f.entry.js.map} +0 -0
- /package/dist/native/{p-2364aefa.entry.js.map → p-587d94f3.entry.js.map} +0 -0
- /package/dist/native/{p-95184ea2.entry.js.map → p-6a418ec4.entry.js.map} +0 -0
- /package/dist/native/{p-9d7e099f.entry.js.map → p-9950e075.entry.js.map} +0 -0
- /package/dist/native/{p-2dfd786f.entry.js.map → p-9c432751.entry.js.map} +0 -0
- /package/dist/native/{p-638967bf.entry.js.map → p-a2f58133.entry.js.map} +0 -0
- /package/dist/native/{p-d94bf052.entry.js.map → p-b02c896a.entry.js.map} +0 -0
- /package/dist/native/{p-9613087c.entry.js.map → p-b4382c94.entry.js.map} +0 -0
- /package/dist/native/{p-835abdb9.entry.js.map → p-b626ef47.entry.js.map} +0 -0
- /package/dist/native/{p-23ee0384.entry.js.map → p-c0de4bb0.entry.js.map} +0 -0
- /package/dist/native/{p-ce97ce24.entry.js.map → p-d62869ff.entry.js.map} +0 -0
- /package/dist/native/{p-cb0293ec.entry.js.map → p-dfb6b65e.entry.js.map} +0 -0
- /package/dist/native/{p-647a0765.entry.js.map → p-eb74feb7.entry.js.map} +0 -0
- /package/dist/native/{p-6d427897.entry.js.map → p-fa3e588e.entry.js.map} +0 -0
- /package/dist/native/{p-112d096c.entry.js.map → p-fffbd3c1.entry.js.map} +0 -0
|
@@ -1,9 +1,243 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-dc2723f3.js';
|
|
2
|
-
import { a as startsWithIgnoreCase } from './string.utils-16aed4a7.js';
|
|
1
|
+
import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host, g as getElement } from './index-dc2723f3.js';
|
|
3
2
|
import { g as TimeType } from './constants-69bafca2.js';
|
|
4
3
|
import { v as v4 } from './v4-a79185f4.js';
|
|
5
4
|
|
|
6
|
-
const nvFieldtimeCss = "nv-fieldslider .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .track-range{background:var(--components-slider-track-filled-focus)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .thumb{border-color:var(--components-slider-track-filled-focus)}nv-fieldslider[error] .slider-container .track-container .track .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:hover{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-handler-background-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:focus{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldtime{--nv-field-border-default:var(--components-form-field-border-default);--nv-field-border-hover:var(--components-form-field-border-hover);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--components-form-field-border-default);--nv-field-border-readonly:var(--components-form-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-brand);--nv-field-background:var(--components-form-field-background-default);display:flex;flex-direction:column;align-items:flex-start;gap:var(--form-gap-y);box-sizing:border-box;max-width:480px}nv-fieldtime[readonly]:not([readonly=false]){--nv-field-border-default:var(--components-form-field-border-readonly);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-background:var(--components-form-field-background-readonly)}nv-fieldtime[error]:not([error=false]){--nv-field-border-default:var(--components-form-field-border-error);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--nv-field-border-default);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-destructive-in-field)}nv-fieldtime[success]:not([success=false]){--nv-field-border-default:var(--components-form-field-border-success);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--nv-field-border-default);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-success)}nv-fieldtime[required]:not([required=false]) label::after{content:\"*\";color:var(--components-form-text-required);font-weight:var(--font-weight-high-emphasis)}nv-fieldtime label{display:flex;align-items:center;gap:var(--form-label-gap);align-self:stretch;color:var(--components-form-text-label-default);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-label-font-size);font-style:normal;font-weight:var(--font-weight-medium-emphasis);line-height:var(--form-label-line-height)}nv-fieldtime nv-popover{width:100%;display:block}nv-fieldtime nv-popover [data-scope=popover]{padding:var(--list-dropdown-padding);background-color:var(--components-list-dropdown-background);border:1px solid var(--components-list-dropdown-border);width:100%}nv-fieldtime .input-wrapper{display:flex;flex-wrap:wrap;gap:var(--form-gap-x);align-items:stretch;align-self:stretch;width:100%}nv-fieldtime .input-container{display:flex;flex-grow:1;justify-content:center;align-items:center;align-self:stretch;border-radius:var(--form-field-radius);border-width:1px;border-style:solid;border-color:var(--nv-field-border-default);opacity:var(--components-form-opacity-default, 1);background:var(--nv-field-background);transition:all 150ms ease-out;display:flex;justify-content:flex-start;align-items:center;position:relative;width:100%;min-height:40px;gap:0;padding-left:var(--form-field-padding-x)}nv-fieldtime .input-container:hover{border-color:var(--nv-field-border-hover)}nv-fieldtime .input-container:focus-within,nv-fieldtime .input-container:focus-within:hover,nv-fieldtime .input-container:focus,nv-fieldtime .input-container:focus:hover{border-color:var(--nv-field-border-focus);box-shadow:0px 0px 0px var(--focus-field-stroke) var(--nv-field-focus-box-shadow)}nv-fieldtime .input-container:has(input:read-only){opacity:0.5;background-color:var(--components-form-field-background-readonly);border-color:var(--nv-field-border-readonly)}nv-fieldtime .input-container:has(input:disabled){opacity:0.5;background-color:var(--components-form-field-background-disabled);border-color:var(--nv-field-border-disabled)}nv-fieldtime .input-container input.time-input{display:flex;align-items:center;flex:1 0 0;overflow:hidden;background-color:transparent;color:var(--components-form-field-content-text);padding:var(--form-field-padding-y) var(--form-field-padding-x);font-size:var(--form-field-font-size);font-style:normal;font-weight:var(--font-weight-medium-emphasis);line-height:var(--form-field-line-height);width:100%;width:100%;min-width:24px;flex:0 0 24px;text-align:center;padding:0;margin:0}nv-fieldtime .input-container input.time-input:focus{outline:none}nv-fieldtime .input-container input.time-input::placeholder{overflow:hidden;color:var(--components-form-field-content-placeholder);text-overflow:ellipsis;font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-field-font-size);font-style:normal;font-weight:var(--font-weight-low-emphasis);line-height:var(--form-field-line-height)}nv-fieldtime .input-container input.time-input[type=password]::-ms-clear,nv-fieldtime .input-container input.time-input[type=password]::-ms-reveal{display:none;width:0;height:0}nv-fieldtime .input-container input.time-input::-webkit-inner-spin-button,nv-fieldtime .input-container input.time-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}nv-fieldtime .input-container span{width:100%;text-align:center;min-width:24px;flex:0 0 24px;padding:0 4px;color:var(--components-form-field-content-text)}nv-fieldtime .input-container>nv-iconbutton{border:0px;border-radius:0px;margin-left:auto}nv-fieldtime .input-container>nv-iconbutton:focus-visible{border-radius:var(--button-md-border-radius);outline-offset:-3px}nv-fieldtime .input-container>nv-iconbutton:last-of-type{border-top-right-radius:var(--form-field-radius);border-bottom-right-radius:var(--form-field-radius)}nv-fieldtime .input-container nv-icon.validation{color:var(--nv-field-border-default);position:absolute;right:50px;top:50%;transform:translateY(-50%)}nv-fieldtime .input-container:focus,nv-fieldtime .input-container:focus-within{border-color:var(--color-focus-brand);box-shadow:0px 0px 0px var(--focus-field-stroke) var(--color-focus-brand)}nv-fieldtime .description{display:flex;align-items:center;align-self:stretch;gap:var(--spacing-1);color:var(--components-form-text-description-default);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-description-font-size);font-style:normal;line-height:var(--form-description-line-height)}nv-fieldtime .error-description{display:flex;align-items:center;align-self:stretch;gap:var(--spacing-1);color:var(--components-form-text-description-default);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-description-font-size);font-style:normal;line-height:var(--form-description-line-height);color:var(--components-form-text-description-error)}nv-fieldtime hr{border:none;border-top:1px solid var(--dropdown-divider-color, #ccc);margin:0.5rem 0}nv-fieldtime .time-dropdown{width:100%}nv-fieldtime .time-dropdown .time-columns{display:flex;justify-content:flex-start;align-items:center}nv-fieldtime .time-dropdown .time-columns .time-column{flex:1;text-align:center;max-height:200px;overflow-y:auto;scroll-behavior:smooth;scrollbar-gutter:stable both-edges;scrollbar-gutter:auto}nv-fieldtime .time-dropdown .time-columns .time-column::-webkit-scrollbar{width:6px;height:6px}nv-fieldtime .time-dropdown .time-columns .time-column::-webkit-scrollbar-track{background-color:var(--color-level-10-background);border-radius:9999px}nv-fieldtime .time-dropdown .time-columns .time-column::-webkit-scrollbar-thumb{background-color:var(--color-gray-200);border-radius:9999px}nv-fieldtime .time-dropdown .time-columns .time-column:last-child{border-right:none}nv-fieldtime .time-dropdown .time-columns .time-column .time-option{padding:var(--calendar-padding);text-align:center;cursor:pointer;transition:background-color 0.2s;border-radius:var(--list-dropdown-item-radius);color:var(--components-calendar-cell-text);font-size:var(--font-size-sm);display:flex;justify-content:center;align-items:center}nv-fieldtime .time-dropdown .time-columns .time-column .time-option:hover{background-color:var(--components-calendar-cell-background-hover);color:var(--components-calendar-cell-text-hover)}nv-fieldtime .time-dropdown .time-columns .time-column .time-option:focus,nv-fieldtime .time-dropdown .time-columns .time-column .time-option:focus-within{background-color:var(--components-calendar-cell-background-hover);color:var(--components-calendar-cell-text-hover)}nv-fieldtime .time-dropdown .time-columns .time-column .time-option.selected{background-color:var(--components-calendar-cell-background-selected);color:var(--components-calendar-cell-text-selected)}nv-fieldtime .time-dropdown .time-columns .time-column .time-option.highlighted{background-color:var(--components-calendar-cell-background-hover);color:var(--components-menu-contextual-item-content-hover)}";
|
|
5
|
+
/**
|
|
6
|
+
* Format configurations for all supported time formats
|
|
7
|
+
*/
|
|
8
|
+
const FORMAT_CONFIGS = {
|
|
9
|
+
'HH': {
|
|
10
|
+
pattern: /^([0-1]?[0-9]|2[0-3])$/,
|
|
11
|
+
parts: [TimeType.Hours],
|
|
12
|
+
defaultValue: '00',
|
|
13
|
+
maxLength: 2,
|
|
14
|
+
},
|
|
15
|
+
'HH:mm': {
|
|
16
|
+
pattern: /^([0-1]?[0-9]|2[0-3]):([0-5]?[0-9])$/,
|
|
17
|
+
parts: [TimeType.Hours, TimeType.Minutes],
|
|
18
|
+
defaultValue: '00:00',
|
|
19
|
+
maxLength: 5,
|
|
20
|
+
},
|
|
21
|
+
'HH:mm:ss': {
|
|
22
|
+
pattern: /^([0-1]?[0-9]|2[0-3]):([0-5]?[0-9]):([0-5]?[0-9])$/,
|
|
23
|
+
parts: [TimeType.Hours, TimeType.Minutes, TimeType.Seconds],
|
|
24
|
+
defaultValue: '00:00:00',
|
|
25
|
+
maxLength: 8,
|
|
26
|
+
},
|
|
27
|
+
'hh': {
|
|
28
|
+
pattern: /^(0?[1-9]|1[0-2])$/,
|
|
29
|
+
parts: [TimeType.Hours],
|
|
30
|
+
defaultValue: '01',
|
|
31
|
+
maxLength: 2,
|
|
32
|
+
},
|
|
33
|
+
'hh:mm': {
|
|
34
|
+
pattern: /^(0?[1-9]|1[0-2]):([0-5]?[0-9])$/,
|
|
35
|
+
parts: [TimeType.Hours, TimeType.Minutes],
|
|
36
|
+
defaultValue: '01:00',
|
|
37
|
+
maxLength: 5,
|
|
38
|
+
},
|
|
39
|
+
'hh:mm:ss': {
|
|
40
|
+
pattern: /^(0?[1-9]|1[0-2]):([0-5]?[0-9]):([0-5]?[0-9])$/,
|
|
41
|
+
parts: [TimeType.Hours, TimeType.Minutes, TimeType.Seconds],
|
|
42
|
+
defaultValue: '01:00:00',
|
|
43
|
+
maxLength: 8,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Returns the visible time types for a given format
|
|
48
|
+
* @param {string} format - The time format string
|
|
49
|
+
* @returns {TimeType[]} Array of TimeType values that should be visible
|
|
50
|
+
*/
|
|
51
|
+
function getVisibleTimeTypes(format) {
|
|
52
|
+
const config = FORMAT_CONFIGS[format];
|
|
53
|
+
if (!config) {
|
|
54
|
+
// Fallback for unknown formats
|
|
55
|
+
return [TimeType.Hours, TimeType.Minutes, TimeType.Seconds];
|
|
56
|
+
}
|
|
57
|
+
return config.parts;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Validates if a given value string matches the expected format pattern
|
|
61
|
+
* @param {string} value - The time value string to validate
|
|
62
|
+
* @param {string} format - The expected time format
|
|
63
|
+
* @returns {boolean} True if the value matches the format, false otherwise
|
|
64
|
+
*/
|
|
65
|
+
function isValidFormatValue(value, format) {
|
|
66
|
+
if (!value || !format) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
const config = FORMAT_CONFIGS[format];
|
|
70
|
+
if (!config) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
return config.pattern.test(value);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Parses a time value string according to the specified format
|
|
77
|
+
* Handles both full and partial time strings with backward compatibility
|
|
78
|
+
* @param {string} value - The time value string to parse
|
|
79
|
+
* @param {string} format - The target time format
|
|
80
|
+
* @returns {TimeComponents} TimeComponents object with parsed hours, minutes, and seconds
|
|
81
|
+
*/
|
|
82
|
+
function parseValueByFormat(value, format) {
|
|
83
|
+
const config = FORMAT_CONFIGS[format];
|
|
84
|
+
const defaultComponents = {
|
|
85
|
+
hours: format.startsWith('hh') ? '01' : '00',
|
|
86
|
+
minutes: '00',
|
|
87
|
+
seconds: '00',
|
|
88
|
+
};
|
|
89
|
+
if (!value || !config) {
|
|
90
|
+
return defaultComponents;
|
|
91
|
+
}
|
|
92
|
+
// Clean the input value - remove non-numeric characters except colons
|
|
93
|
+
const cleanValue = value.replace(/[^0-9:]/g, '');
|
|
94
|
+
// Try to match the exact format first
|
|
95
|
+
const exactMatch = cleanValue.match(config.pattern);
|
|
96
|
+
if (exactMatch) {
|
|
97
|
+
return extractComponentsFromMatch(exactMatch, format);
|
|
98
|
+
}
|
|
99
|
+
// Handle backward compatibility - parse full format values when format is shorter
|
|
100
|
+
const fullFormatPattern = /^([0-1]?[0-9]|2[0-3]):([0-5]?[0-9]):([0-5]?[0-9])$/;
|
|
101
|
+
const fullMatch = cleanValue.match(fullFormatPattern);
|
|
102
|
+
if (fullMatch) {
|
|
103
|
+
const fullComponents = extractComponentsFromMatch(fullMatch, 'HH:mm:ss');
|
|
104
|
+
return extractRelevantComponents(fullComponents, format);
|
|
105
|
+
}
|
|
106
|
+
// Handle partial format values - try to parse what we can
|
|
107
|
+
const parts = cleanValue.split(':');
|
|
108
|
+
const result = Object.assign({}, defaultComponents);
|
|
109
|
+
if (parts.length >= 1 && parts[0]) {
|
|
110
|
+
const hours = parseInt(parts[0], 10);
|
|
111
|
+
if (!isNaN(hours)) {
|
|
112
|
+
if (format.startsWith('hh')) {
|
|
113
|
+
// 12-hour format validation
|
|
114
|
+
if (hours >= 1 && hours <= 12) {
|
|
115
|
+
result.hours = hours.toString().padStart(2, '0');
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
// Invalid hour for 12-hour format, keep default
|
|
119
|
+
result.hours = defaultComponents.hours;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
// 24-hour format validation
|
|
124
|
+
if (hours >= 0 && hours <= 23) {
|
|
125
|
+
result.hours = hours.toString().padStart(2, '0');
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
// Invalid hour for 24-hour format, keep default
|
|
129
|
+
result.hours = defaultComponents.hours;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (parts.length >= 2 &&
|
|
135
|
+
parts[1] &&
|
|
136
|
+
config.parts.includes(TimeType.Minutes)) {
|
|
137
|
+
const minutes = parseInt(parts[1], 10);
|
|
138
|
+
if (!isNaN(minutes) && minutes >= 0 && minutes <= 59) {
|
|
139
|
+
result.minutes = minutes.toString().padStart(2, '0');
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (parts.length >= 3 &&
|
|
143
|
+
parts[2] &&
|
|
144
|
+
config.parts.includes(TimeType.Seconds)) {
|
|
145
|
+
const seconds = parseInt(parts[2], 10);
|
|
146
|
+
if (!isNaN(seconds) && seconds >= 0 && seconds <= 59) {
|
|
147
|
+
result.seconds = seconds.toString().padStart(2, '0');
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return result;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Extracts time components from a regex match result
|
|
154
|
+
* @param {RegExpMatchArray} match - The regex match result
|
|
155
|
+
* @param {string} format - The format that was matched
|
|
156
|
+
* @returns {TimeComponents} TimeComponents object
|
|
157
|
+
*/
|
|
158
|
+
function extractComponentsFromMatch(match, format) {
|
|
159
|
+
const result = {
|
|
160
|
+
hours: format.startsWith('hh') ? '01' : '00',
|
|
161
|
+
minutes: '00',
|
|
162
|
+
seconds: '00',
|
|
163
|
+
};
|
|
164
|
+
if (match[1]) {
|
|
165
|
+
result.hours = parseInt(match[1], 10).toString().padStart(2, '0');
|
|
166
|
+
}
|
|
167
|
+
if (match[2]) {
|
|
168
|
+
result.minutes = parseInt(match[2], 10).toString().padStart(2, '0');
|
|
169
|
+
}
|
|
170
|
+
if (match[3]) {
|
|
171
|
+
result.seconds = parseInt(match[3], 10).toString().padStart(2, '0');
|
|
172
|
+
}
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Extracts only the relevant components based on the target format
|
|
177
|
+
* @param {TimeComponents} components - Full time components
|
|
178
|
+
* @param {string} format - Target format to extract components for
|
|
179
|
+
* @returns {TimeComponents} TimeComponents with only relevant parts
|
|
180
|
+
*/
|
|
181
|
+
function extractRelevantComponents(components, format) {
|
|
182
|
+
const config = FORMAT_CONFIGS[format];
|
|
183
|
+
const result = {
|
|
184
|
+
hours: format.startsWith('hh') ? '01' : '00',
|
|
185
|
+
minutes: '00',
|
|
186
|
+
seconds: '00',
|
|
187
|
+
};
|
|
188
|
+
if (config.parts.includes(TimeType.Hours)) {
|
|
189
|
+
// Validate hours for the target format
|
|
190
|
+
const hours = parseInt(components.hours, 10);
|
|
191
|
+
if (format.startsWith('hh')) {
|
|
192
|
+
// 12-hour format validation
|
|
193
|
+
if (hours >= 1 && hours <= 12) {
|
|
194
|
+
result.hours = components.hours;
|
|
195
|
+
}
|
|
196
|
+
// If invalid, keep the default '01'
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
// 24-hour format validation
|
|
200
|
+
if (hours >= 0 && hours <= 23) {
|
|
201
|
+
result.hours = components.hours;
|
|
202
|
+
}
|
|
203
|
+
// If invalid, keep the default '00'
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (config.parts.includes(TimeType.Minutes)) {
|
|
207
|
+
result.minutes = components.minutes;
|
|
208
|
+
}
|
|
209
|
+
if (config.parts.includes(TimeType.Seconds)) {
|
|
210
|
+
result.seconds = components.seconds;
|
|
211
|
+
}
|
|
212
|
+
return result;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Reconstructs a time string from components according to the specified format
|
|
216
|
+
* @param {TimeComponents} components - Time components to reconstruct
|
|
217
|
+
* @param {string} format - Target format for reconstruction
|
|
218
|
+
* @returns {string} Formatted time string
|
|
219
|
+
*/
|
|
220
|
+
function reconstructTimeByFormat(components, format) {
|
|
221
|
+
const config = FORMAT_CONFIGS[format];
|
|
222
|
+
if (!config) {
|
|
223
|
+
return `${components.hours}:${components.minutes}:${components.seconds}`;
|
|
224
|
+
}
|
|
225
|
+
switch (format) {
|
|
226
|
+
case 'HH':
|
|
227
|
+
case 'hh':
|
|
228
|
+
return components.hours;
|
|
229
|
+
case 'HH:mm':
|
|
230
|
+
case 'hh:mm':
|
|
231
|
+
return `${components.hours}:${components.minutes}`;
|
|
232
|
+
case 'HH:mm:ss':
|
|
233
|
+
case 'hh:mm:ss':
|
|
234
|
+
return `${components.hours}:${components.minutes}:${components.seconds}`;
|
|
235
|
+
default:
|
|
236
|
+
return `${components.hours}:${components.minutes}:${components.seconds}`;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const nvFieldtimeCss = "nv-fieldslider .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .track-range{background:var(--components-slider-track-filled-focus)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .thumb{border-color:var(--components-slider-track-filled-focus)}nv-fieldslider[error] .slider-container .track-container .track .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:hover{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-handler-background-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:focus{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldtime{--nv-field-border-default:var(--components-form-field-border-default);--nv-field-border-hover:var(--components-form-field-border-hover);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--components-form-field-border-default);--nv-field-border-readonly:var(--components-form-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-brand);--nv-field-background:var(--components-form-field-background-default);display:flex;flex-direction:column;align-items:flex-start;gap:var(--form-gap-y);box-sizing:border-box;max-width:480px}nv-fieldtime[readonly]:not([readonly=false]){--nv-field-border-default:var(--components-form-field-border-readonly);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-background:var(--components-form-field-background-readonly)}nv-fieldtime[error]:not([error=false]){--nv-field-border-default:var(--components-form-field-border-error);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--nv-field-border-default);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-destructive-in-field)}nv-fieldtime[success]:not([success=false]){--nv-field-border-default:var(--components-form-field-border-success);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--nv-field-border-default);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-success)}nv-fieldtime[required]:not([required=false]) label::after{content:\"*\";color:var(--components-form-text-required);font-weight:var(--font-weight-high-emphasis)}nv-fieldtime label{display:flex;align-items:center;gap:var(--form-label-gap);align-self:stretch;color:var(--components-form-text-label-default);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-label-font-size);font-style:normal;font-weight:var(--font-weight-medium-emphasis);line-height:var(--form-label-line-height)}nv-fieldtime nv-popover{width:100%;display:block;z-index:9999}nv-fieldtime nv-popover [data-scope=popover]{padding:var(--list-dropdown-padding);background-color:var(--components-list-dropdown-background);border:1px solid var(--components-list-dropdown-border);width:100%}nv-fieldtime .input-wrapper{display:flex;flex-wrap:wrap;gap:var(--form-gap-x);align-items:stretch;align-self:stretch;width:100%}nv-fieldtime .input-container{display:flex;flex-grow:1;justify-content:center;align-items:center;align-self:stretch;border-radius:var(--form-field-radius);border-width:1px;border-style:solid;border-color:var(--nv-field-border-default);opacity:var(--components-form-opacity-default, 1);background:var(--nv-field-background);transition:all 150ms ease-out;display:flex;justify-content:flex-start;align-items:center;position:relative;width:100%;min-height:40px;gap:0;padding-left:var(--form-field-padding-x)}nv-fieldtime .input-container:hover{border-color:var(--nv-field-border-hover)}nv-fieldtime .input-container:focus-within,nv-fieldtime .input-container:focus-within:hover,nv-fieldtime .input-container:focus,nv-fieldtime .input-container:focus:hover{border-color:var(--nv-field-border-focus);box-shadow:0px 0px 0px var(--focus-field-stroke) var(--nv-field-focus-box-shadow)}nv-fieldtime .input-container:has(input:read-only){opacity:0.5;background-color:var(--components-form-field-background-readonly);border-color:var(--nv-field-border-readonly)}nv-fieldtime .input-container:has(input:disabled){opacity:0.5;background-color:var(--components-form-field-background-disabled);border-color:var(--nv-field-border-disabled)}nv-fieldtime .input-container input.time-input{display:flex;align-items:center;flex:1 0 0;overflow:hidden;background-color:transparent;color:var(--components-form-field-content-text);padding:var(--form-field-padding-y) var(--form-field-padding-x);font-size:var(--form-field-font-size);font-style:normal;font-weight:var(--font-weight-medium-emphasis);line-height:var(--form-field-line-height);width:100%;width:100%;min-width:24px;flex:0 0 24px;text-align:center;padding:0;margin:0}nv-fieldtime .input-container input.time-input:focus{outline:none}nv-fieldtime .input-container input.time-input::placeholder{overflow:hidden;color:var(--components-form-field-content-placeholder);text-overflow:ellipsis;font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-field-font-size);font-style:normal;font-weight:var(--font-weight-low-emphasis);line-height:var(--form-field-line-height)}nv-fieldtime .input-container input.time-input[type=password]::-ms-clear,nv-fieldtime .input-container input.time-input[type=password]::-ms-reveal{display:none;width:0;height:0}nv-fieldtime .input-container input.time-input::-webkit-inner-spin-button,nv-fieldtime .input-container input.time-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}nv-fieldtime .input-container span{width:100%;text-align:center;min-width:24px;flex:0 0 24px;padding:0 4px;color:var(--components-form-field-content-text)}nv-fieldtime .input-container>nv-iconbutton{border:0px;border-radius:0px;margin-left:auto}nv-fieldtime .input-container>nv-iconbutton:focus-visible{border-radius:var(--button-md-border-radius);outline-offset:-3px}nv-fieldtime .input-container>nv-iconbutton:last-of-type{border-top-right-radius:var(--form-field-radius);border-bottom-right-radius:var(--form-field-radius)}nv-fieldtime .input-container nv-icon.validation{color:var(--nv-field-border-default);position:absolute;right:50px;top:50%;transform:translateY(-50%)}nv-fieldtime .input-container:focus,nv-fieldtime .input-container:focus-within{border-color:var(--color-focus-brand);box-shadow:0px 0px 0px var(--focus-field-stroke) var(--color-focus-brand)}nv-fieldtime .description{display:flex;align-items:center;align-self:stretch;gap:var(--spacing-1);color:var(--components-form-text-description-default);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-description-font-size);font-style:normal;line-height:var(--form-description-line-height)}nv-fieldtime .error-description{display:flex;align-items:center;align-self:stretch;gap:var(--spacing-1);color:var(--components-form-text-description-default);font-family:var(--font-family-default), var(--font-family-fallback), sans-serif;font-size:var(--form-description-font-size);font-style:normal;line-height:var(--form-description-line-height);color:var(--components-form-text-description-error)}nv-fieldtime hr{border:none;border-top:1px solid var(--dropdown-divider-color, #ccc);margin:0.5rem 0}nv-fieldtime .time-dropdown{width:100%}nv-fieldtime .time-dropdown .time-columns{display:flex;justify-content:flex-start;align-items:center}nv-fieldtime .time-dropdown .time-columns .time-column{flex:1;text-align:center;max-height:200px;overflow-y:auto;scroll-behavior:smooth;scrollbar-gutter:stable both-edges;scrollbar-gutter:auto}nv-fieldtime .time-dropdown .time-columns .time-column::-webkit-scrollbar{width:6px;height:6px}nv-fieldtime .time-dropdown .time-columns .time-column::-webkit-scrollbar-track{background-color:var(--color-level-10-background);border-radius:9999px}nv-fieldtime .time-dropdown .time-columns .time-column::-webkit-scrollbar-thumb{background-color:var(--color-gray-200);border-radius:9999px}nv-fieldtime .time-dropdown .time-columns .time-column:last-child{border-right:none}nv-fieldtime .time-dropdown .time-columns .time-column .time-option{padding:var(--calendar-padding);text-align:center;cursor:pointer;transition:background-color 0.2s;border-radius:var(--list-dropdown-item-radius);color:var(--components-calendar-cell-text);font-size:var(--font-size-sm);display:flex;justify-content:center;align-items:center}nv-fieldtime .time-dropdown .time-columns .time-column .time-option:hover{background-color:var(--components-calendar-cell-background-hover);color:var(--components-calendar-cell-text-hover)}nv-fieldtime .time-dropdown .time-columns .time-column .time-option:focus,nv-fieldtime .time-dropdown .time-columns .time-column .time-option:focus-within{background-color:var(--components-calendar-cell-background-hover);color:var(--components-calendar-cell-text-hover)}nv-fieldtime .time-dropdown .time-columns .time-column .time-option.selected{background-color:var(--components-calendar-cell-background-selected);color:var(--components-calendar-cell-text-selected)}nv-fieldtime .time-dropdown .time-columns .time-column .time-option.highlighted{background-color:var(--components-calendar-cell-background-hover);color:var(--components-menu-contextual-item-content-hover)}";
|
|
7
241
|
const NvFieldtimeStyle0 = nvFieldtimeCss;
|
|
8
242
|
|
|
9
243
|
const NvFieldtime = class {
|
|
@@ -63,6 +297,10 @@ const NvFieldtime = class {
|
|
|
63
297
|
* - hh: 12-hour format (01-12)
|
|
64
298
|
* - hh:mm: 12-hour format with minutes (01:00-12:59)
|
|
65
299
|
* - hh:mm:ss: 12-hour format with minutes and seconds (01:00:00-12:59:59)
|
|
300
|
+
*
|
|
301
|
+
* The component automatically shows only the relevant input fields based on the selected format.
|
|
302
|
+
* When the format changes dynamically, the component re-parses the current value and updates
|
|
303
|
+
* the visible fields accordingly.
|
|
66
304
|
*/
|
|
67
305
|
this.format = 'HH:mm:ss';
|
|
68
306
|
/**
|
|
@@ -91,7 +329,7 @@ const NvFieldtime = class {
|
|
|
91
329
|
this.open = event.detail;
|
|
92
330
|
}
|
|
93
331
|
handleKeyDown(event) {
|
|
94
|
-
var _a, _b
|
|
332
|
+
var _a, _b;
|
|
95
333
|
if (!this.open) {
|
|
96
334
|
if (event.key === 'ArrowDown') {
|
|
97
335
|
this.open = true;
|
|
@@ -126,27 +364,42 @@ const NvFieldtime = class {
|
|
|
126
364
|
else if (event.key === 'Enter' && currentIndex >= 0) {
|
|
127
365
|
event.preventDefault();
|
|
128
366
|
items[currentIndex].click();
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
(
|
|
136
|
-
(
|
|
367
|
+
// Navigate to the next visible field
|
|
368
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
369
|
+
const currentTypeIndex = visibleTypes.indexOf(this.typeFocused);
|
|
370
|
+
const nextTypeIndex = currentTypeIndex + 1;
|
|
371
|
+
if (nextTypeIndex < visibleTypes.length) {
|
|
372
|
+
const nextType = visibleTypes[nextTypeIndex];
|
|
373
|
+
(_a = this.inputElements[nextType]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
374
|
+
(_b = this.inputElements[nextType]) === null || _b === void 0 ? void 0 : _b.select();
|
|
137
375
|
}
|
|
138
376
|
}
|
|
139
377
|
else if (event.key === 'Escape') {
|
|
140
378
|
event.preventDefault();
|
|
141
|
-
|
|
142
|
-
|
|
379
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
380
|
+
const firstVisibleType = visibleTypes[0];
|
|
381
|
+
if (firstVisibleType && this.inputElements[firstVisibleType]) {
|
|
382
|
+
this.inputElements[firstVisibleType].blur();
|
|
143
383
|
}
|
|
384
|
+
this.open = false;
|
|
144
385
|
}
|
|
145
386
|
}
|
|
146
387
|
//#endregion LISTENERS
|
|
147
388
|
/****************************************************************************/
|
|
148
389
|
//#region WATCHERS
|
|
149
390
|
handleValueChange(newValue) {
|
|
391
|
+
// Parse the new value and ensure it's in the correct format
|
|
392
|
+
if (newValue) {
|
|
393
|
+
const components = parseValueByFormat(newValue, this.format);
|
|
394
|
+
const formattedValue = reconstructTimeByFormat(components, this.format);
|
|
395
|
+
// Only emit if the formatted value is different from what we received
|
|
396
|
+
// This prevents infinite loops while ensuring format consistency
|
|
397
|
+
if (formattedValue !== newValue) {
|
|
398
|
+
this.value = formattedValue;
|
|
399
|
+
return; // The watcher will be called again with the formatted value
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
// Emit the value in the correct format
|
|
150
403
|
this.valueChanged.emit(newValue);
|
|
151
404
|
}
|
|
152
405
|
handleOpenChange(newOpen) {
|
|
@@ -161,12 +414,36 @@ const NvFieldtime = class {
|
|
|
161
414
|
this.updateColumnHighlight(secondsSelector, this.seconds);
|
|
162
415
|
}
|
|
163
416
|
}
|
|
417
|
+
handleFormatChange(newFormat, oldFormat) {
|
|
418
|
+
if (newFormat === oldFormat) {
|
|
419
|
+
return; // No change, nothing to do
|
|
420
|
+
}
|
|
421
|
+
// Re-parse the current value with the new format
|
|
422
|
+
const currentValue = this.value || this.reconstructTime();
|
|
423
|
+
// Parse the current value using the old format to get the time components
|
|
424
|
+
const components = parseValueByFormat(currentValue, oldFormat || 'HH:mm:ss');
|
|
425
|
+
// Update the component state with the parsed components
|
|
426
|
+
this.hours = components.hours;
|
|
427
|
+
this.minutes = components.minutes;
|
|
428
|
+
this.seconds = components.seconds;
|
|
429
|
+
// Reconstruct the time value in the new format
|
|
430
|
+
const newValue = reconstructTimeByFormat(components, newFormat);
|
|
431
|
+
// Update the value, which will trigger the value watcher and emit the event
|
|
432
|
+
this.value = newValue;
|
|
433
|
+
// Force a re-render to update the visible input fields
|
|
434
|
+
forceUpdate(this.el);
|
|
435
|
+
}
|
|
164
436
|
//#endregion WATCHERS
|
|
165
437
|
/****************************************************************************/
|
|
166
438
|
//#region METHODS
|
|
167
439
|
handleInputChange(e, type) {
|
|
168
440
|
const inputElement = e.target;
|
|
169
441
|
const inputValue = inputElement.value.replace(/[^0-9]/g, ''); // Only keep numeric input
|
|
442
|
+
// Check if this field is visible for the current format
|
|
443
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
444
|
+
if (!visibleTypes.includes(type)) {
|
|
445
|
+
return; // Don't process input for non-visible fields
|
|
446
|
+
}
|
|
170
447
|
// Update the time value based on the type
|
|
171
448
|
switch (type) {
|
|
172
449
|
case TimeType.Hours:
|
|
@@ -179,489 +456,230 @@ const NvFieldtime = class {
|
|
|
179
456
|
this.handleSecondsChange(inputValue, type);
|
|
180
457
|
break;
|
|
181
458
|
}
|
|
182
|
-
// Reconstruct time from inputs
|
|
183
|
-
const
|
|
184
|
-
|
|
459
|
+
// Reconstruct time from inputs in the correct format
|
|
460
|
+
const reconstructedValue = this.reconstructTime();
|
|
461
|
+
// Update the value, which will trigger the watcher and emit the event
|
|
462
|
+
this.value = reconstructedValue;
|
|
185
463
|
}
|
|
186
464
|
handleHoursChange(inputValue, type) {
|
|
187
|
-
var _a, _b
|
|
465
|
+
var _a, _b;
|
|
188
466
|
const isHHFormat = this.format.startsWith('HH');
|
|
189
467
|
const maxHours = isHHFormat ? 24 : 12;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
468
|
+
// Handle empty input
|
|
469
|
+
if (inputValue.length === 0) {
|
|
470
|
+
this.hours = '00';
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
194
473
|
if (inputValue.length === 1) {
|
|
195
474
|
this.inputZeroAdded[type] = true;
|
|
196
475
|
const newInputValue = inputValue.padStart(2, '0');
|
|
197
|
-
|
|
198
|
-
if (minHour && parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
199
|
-
this.hours = minHour;
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
this.hours = '00';
|
|
203
|
-
reputedToZero = true;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
if (minHour && parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
208
|
-
this.hours = minHour;
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
this.hours = newInputValue;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
476
|
+
this.hours = newInputValue;
|
|
214
477
|
}
|
|
215
478
|
else if (this.inputZeroAdded[type]) {
|
|
216
479
|
this.inputZeroAdded[type] = false;
|
|
217
480
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
218
481
|
const parsedNewInputValue = parseInt(newInputValue, 10) || 0;
|
|
482
|
+
// Only apply format validation (not min/max constraints)
|
|
219
483
|
if (parsedNewInputValue >= maxHours) {
|
|
220
|
-
|
|
221
|
-
this.hours = minHour;
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
this.hours = '00';
|
|
225
|
-
reputedToZero = true;
|
|
226
|
-
}
|
|
484
|
+
this.hours = '00';
|
|
227
485
|
}
|
|
228
486
|
else {
|
|
229
|
-
|
|
230
|
-
if (minHour && parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
231
|
-
this.hours = minHour;
|
|
232
|
-
}
|
|
233
|
-
else {
|
|
234
|
-
this.hours = '00';
|
|
235
|
-
reputedToZero = true;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
if (minHour && parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
240
|
-
this.hours = minHour;
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
this.hours = newInputValue;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
487
|
+
this.hours = newInputValue;
|
|
246
488
|
}
|
|
247
489
|
}
|
|
248
490
|
else if (inputValue.length > 2) {
|
|
249
491
|
if (inputValue.startsWith('00')) {
|
|
250
492
|
this.inputZeroAdded[type] = true;
|
|
251
493
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
252
|
-
|
|
253
|
-
if (minHour && parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
254
|
-
this.hours = minHour;
|
|
255
|
-
}
|
|
256
|
-
else {
|
|
257
|
-
this.hours = '00';
|
|
258
|
-
reputedToZero = true;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
else {
|
|
262
|
-
if (minHour && parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
263
|
-
this.hours = minHour;
|
|
264
|
-
}
|
|
265
|
-
else {
|
|
266
|
-
this.hours = newInputValue;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
494
|
+
this.hours = newInputValue;
|
|
269
495
|
}
|
|
270
496
|
else {
|
|
271
497
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
272
498
|
const parsedNewInputValue = parseInt(newInputValue, 10) || 0;
|
|
499
|
+
// Only apply format validation (not min/max constraints)
|
|
273
500
|
if (parsedNewInputValue >= maxHours) {
|
|
274
|
-
|
|
275
|
-
this.hours = minHour;
|
|
276
|
-
reputedToZero = true;
|
|
277
|
-
}
|
|
278
|
-
else {
|
|
279
|
-
this.hours = '00';
|
|
280
|
-
reputedToZero = true;
|
|
281
|
-
}
|
|
501
|
+
this.hours = '00';
|
|
282
502
|
}
|
|
283
503
|
else {
|
|
284
|
-
|
|
285
|
-
if (minHour &&
|
|
286
|
-
parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
287
|
-
this.hours = minHour;
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
this.hours = '00';
|
|
291
|
-
reputedToZero = true;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
else {
|
|
295
|
-
if (minHour && parsedNewInputValue < parseInt(minHour, 10)) {
|
|
296
|
-
this.hours = minHour;
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
this.hours = parsedNewInputValue.toString();
|
|
300
|
-
}
|
|
301
|
-
}
|
|
504
|
+
this.hours = parsedNewInputValue.toString();
|
|
302
505
|
}
|
|
303
506
|
}
|
|
304
507
|
}
|
|
305
508
|
else {
|
|
306
|
-
const
|
|
307
|
-
|
|
509
|
+
const parsedNewInputValue = parseInt(inputValue, 10) || 0;
|
|
510
|
+
// Only apply format validation (not min/max constraints)
|
|
308
511
|
if (parsedNewInputValue >= maxHours) {
|
|
309
|
-
|
|
310
|
-
this.hours = minHour;
|
|
311
|
-
}
|
|
312
|
-
else {
|
|
313
|
-
this.hours = '00';
|
|
314
|
-
reputedToZero = true;
|
|
315
|
-
}
|
|
512
|
+
this.hours = '00';
|
|
316
513
|
}
|
|
317
514
|
else {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
reputedToZero = true;
|
|
321
|
-
}
|
|
322
|
-
else {
|
|
323
|
-
if (minHour && parsedNewInputValue < parseInt(minHour, 10)) {
|
|
324
|
-
this.hours = minHour;
|
|
325
|
-
}
|
|
326
|
-
else {
|
|
327
|
-
this.hours = parsedNewInputValue.toString();
|
|
328
|
-
}
|
|
329
|
-
}
|
|
515
|
+
// For direct input, remove unnecessary leading zeros (e.g., '01' becomes '1')
|
|
516
|
+
this.hours = parsedNewInputValue.toString();
|
|
330
517
|
}
|
|
331
518
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
519
|
+
// Auto-navigation to next field when input is complete
|
|
520
|
+
if (this.hours.length >= 1 && !this.inputZeroAdded[type]) {
|
|
521
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
522
|
+
const currentTypeIndex = visibleTypes.indexOf(TimeType.Hours);
|
|
523
|
+
const nextTypeIndex = currentTypeIndex + 1;
|
|
524
|
+
if (nextTypeIndex < visibleTypes.length) {
|
|
525
|
+
const nextType = visibleTypes[nextTypeIndex];
|
|
526
|
+
(_a = this.inputElements[nextType]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
527
|
+
(_b = this.inputElements[nextType]) === null || _b === void 0 ? void 0 : _b.select();
|
|
528
|
+
}
|
|
341
529
|
}
|
|
342
530
|
}
|
|
343
531
|
handleMinutesChange(inputValue, type) {
|
|
344
|
-
var _a, _b
|
|
532
|
+
var _a, _b;
|
|
345
533
|
const maxMinutes = 60;
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
534
|
+
// Handle empty input
|
|
535
|
+
if (inputValue.length === 0) {
|
|
536
|
+
this.minutes = '00';
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
349
539
|
if (inputValue.length === 1) {
|
|
350
540
|
this.inputZeroAdded[type] = true;
|
|
351
541
|
const newInputValue = inputValue.padStart(2, '0');
|
|
352
|
-
|
|
353
|
-
if (minMinute && parseInt(newInputValue, 10) < minMinute) {
|
|
354
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
355
|
-
}
|
|
356
|
-
else {
|
|
357
|
-
this.minutes = '00';
|
|
358
|
-
reputedToZero = true;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
else {
|
|
362
|
-
if (minMinute && parseInt(newInputValue, 10) < minMinute) {
|
|
363
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
364
|
-
}
|
|
365
|
-
else {
|
|
366
|
-
this.minutes = newInputValue;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
542
|
+
this.minutes = newInputValue;
|
|
369
543
|
}
|
|
370
544
|
else if (this.inputZeroAdded[type]) {
|
|
371
545
|
this.inputZeroAdded[type] = false;
|
|
372
546
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
373
547
|
const parsedNewInputValue = parseInt(newInputValue, 10) || 0;
|
|
548
|
+
// Only apply format validation (not min/max constraints)
|
|
374
549
|
if (parsedNewInputValue >= maxMinutes) {
|
|
375
|
-
|
|
376
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
377
|
-
}
|
|
378
|
-
else {
|
|
379
|
-
this.minutes = '00';
|
|
380
|
-
reputedToZero = true;
|
|
381
|
-
}
|
|
550
|
+
this.minutes = '00';
|
|
382
551
|
}
|
|
383
552
|
else {
|
|
384
|
-
|
|
385
|
-
if (minMinute && parseInt(newInputValue, 10) < minMinute) {
|
|
386
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
387
|
-
}
|
|
388
|
-
else {
|
|
389
|
-
this.minutes = '00';
|
|
390
|
-
reputedToZero = true;
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
else {
|
|
394
|
-
if (minMinute && parsedNewInputValue < minMinute) {
|
|
395
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
396
|
-
}
|
|
397
|
-
else {
|
|
398
|
-
this.minutes = newInputValue;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
553
|
+
this.minutes = newInputValue;
|
|
401
554
|
}
|
|
402
555
|
}
|
|
403
556
|
else if (inputValue.length > 2) {
|
|
404
557
|
if (inputValue.startsWith('00')) {
|
|
405
558
|
this.inputZeroAdded[type] = true;
|
|
406
559
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
407
|
-
|
|
408
|
-
if (minMinute && parseInt(newInputValue, 10) < minMinute) {
|
|
409
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
410
|
-
}
|
|
411
|
-
else {
|
|
412
|
-
this.minutes = '00';
|
|
413
|
-
reputedToZero = true;
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
else {
|
|
417
|
-
if (minMinute && parseInt(newInputValue, 10) < minMinute) {
|
|
418
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
419
|
-
}
|
|
420
|
-
else {
|
|
421
|
-
this.minutes = newInputValue;
|
|
422
|
-
}
|
|
423
|
-
}
|
|
560
|
+
this.minutes = newInputValue;
|
|
424
561
|
}
|
|
425
562
|
else {
|
|
426
563
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
427
564
|
const parsedNewInputValue = parseInt(newInputValue, 10) || 0;
|
|
565
|
+
// Only apply format validation (not min/max constraints)
|
|
428
566
|
if (parsedNewInputValue >= maxMinutes) {
|
|
429
|
-
|
|
430
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
431
|
-
}
|
|
432
|
-
else {
|
|
433
|
-
this.minutes = '00';
|
|
434
|
-
reputedToZero = true;
|
|
435
|
-
}
|
|
567
|
+
this.minutes = '00';
|
|
436
568
|
}
|
|
437
569
|
else {
|
|
438
|
-
|
|
439
|
-
if (minMinute && parseInt(newInputValue, 10) < minMinute) {
|
|
440
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
441
|
-
}
|
|
442
|
-
else {
|
|
443
|
-
this.minutes = '00';
|
|
444
|
-
reputedToZero = true;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
else {
|
|
448
|
-
if (minMinute && parsedNewInputValue < minMinute) {
|
|
449
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
450
|
-
}
|
|
451
|
-
else {
|
|
452
|
-
this.minutes = parsedNewInputValue.toString();
|
|
453
|
-
}
|
|
454
|
-
}
|
|
570
|
+
this.minutes = parsedNewInputValue.toString();
|
|
455
571
|
}
|
|
456
572
|
}
|
|
457
573
|
}
|
|
458
574
|
else {
|
|
459
|
-
const
|
|
460
|
-
|
|
575
|
+
const parsedNewInputValue = parseInt(inputValue, 10) || 0;
|
|
576
|
+
// Only apply format validation (not min/max constraints)
|
|
461
577
|
if (parsedNewInputValue >= maxMinutes) {
|
|
462
|
-
|
|
463
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
464
|
-
}
|
|
465
|
-
else {
|
|
466
|
-
this.minutes = '00';
|
|
467
|
-
reputedToZero = true;
|
|
468
|
-
}
|
|
578
|
+
this.minutes = '00';
|
|
469
579
|
}
|
|
470
580
|
else {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
474
|
-
}
|
|
475
|
-
else {
|
|
476
|
-
this.minutes = '00';
|
|
477
|
-
reputedToZero = true;
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
else {
|
|
481
|
-
if (minMinute && parsedNewInputValue < minMinute) {
|
|
482
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
483
|
-
}
|
|
484
|
-
else {
|
|
485
|
-
this.minutes = parsedNewInputValue.toString();
|
|
486
|
-
}
|
|
487
|
-
}
|
|
581
|
+
// For direct input, remove unnecessary leading zeros (e.g., '01' becomes '1')
|
|
582
|
+
this.minutes = parsedNewInputValue.toString();
|
|
488
583
|
}
|
|
489
584
|
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
585
|
+
// Auto-navigation to next field when input is complete
|
|
586
|
+
if (this.minutes.length >= 1 && !this.inputZeroAdded[type]) {
|
|
587
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
588
|
+
const currentTypeIndex = visibleTypes.indexOf(TimeType.Minutes);
|
|
589
|
+
const nextTypeIndex = currentTypeIndex + 1;
|
|
590
|
+
if (nextTypeIndex < visibleTypes.length) {
|
|
591
|
+
const nextType = visibleTypes[nextTypeIndex];
|
|
592
|
+
(_a = this.inputElements[nextType]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
593
|
+
(_b = this.inputElements[nextType]) === null || _b === void 0 ? void 0 : _b.select();
|
|
594
|
+
}
|
|
499
595
|
}
|
|
500
596
|
}
|
|
501
597
|
handleSecondsChange(inputValue, type) {
|
|
502
|
-
var _a, _b, _c, _d;
|
|
503
598
|
const maxSeconds = 60;
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
599
|
+
// Handle empty input
|
|
600
|
+
if (inputValue.length === 0) {
|
|
601
|
+
this.seconds = '00';
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
507
604
|
if (inputValue.length === 1) {
|
|
508
605
|
this.inputZeroAdded[type] = true;
|
|
509
606
|
const newInputValue = inputValue.padStart(2, '0');
|
|
510
|
-
|
|
511
|
-
if (minSecond && parseInt(newInputValue, 10) < minSecond) {
|
|
512
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
513
|
-
}
|
|
514
|
-
else {
|
|
515
|
-
this.seconds = '00';
|
|
516
|
-
reputedToZero = true;
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
else {
|
|
520
|
-
if (minSecond && parseInt(newInputValue, 10) < minSecond) {
|
|
521
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
522
|
-
}
|
|
523
|
-
else {
|
|
524
|
-
this.seconds = newInputValue;
|
|
525
|
-
}
|
|
526
|
-
}
|
|
607
|
+
this.seconds = newInputValue;
|
|
527
608
|
}
|
|
528
609
|
else if (this.inputZeroAdded[type]) {
|
|
529
610
|
this.inputZeroAdded[type] = false;
|
|
530
611
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
531
612
|
const parsedNewInputValue = parseInt(newInputValue, 10) || 0;
|
|
613
|
+
// Only apply format validation (not min/max constraints)
|
|
532
614
|
if (parsedNewInputValue >= maxSeconds) {
|
|
533
|
-
|
|
534
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
535
|
-
}
|
|
536
|
-
else {
|
|
537
|
-
this.seconds = '00';
|
|
538
|
-
reputedToZero = true;
|
|
539
|
-
}
|
|
615
|
+
this.seconds = '00';
|
|
540
616
|
}
|
|
541
617
|
else {
|
|
542
|
-
|
|
543
|
-
if (minSecond && parseInt(newInputValue, 10) < minSecond) {
|
|
544
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
545
|
-
}
|
|
546
|
-
else {
|
|
547
|
-
this.seconds = '00';
|
|
548
|
-
reputedToZero = true;
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
else {
|
|
552
|
-
if (minSecond && parsedNewInputValue < minSecond) {
|
|
553
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
554
|
-
}
|
|
555
|
-
else {
|
|
556
|
-
this.seconds = newInputValue;
|
|
557
|
-
}
|
|
558
|
-
}
|
|
618
|
+
this.seconds = newInputValue;
|
|
559
619
|
}
|
|
560
620
|
}
|
|
561
621
|
else if (inputValue.length > 2) {
|
|
562
622
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
563
623
|
const parsedNewInputValue = parseInt(newInputValue, 10) || 0;
|
|
624
|
+
// Only apply format validation (not min/max constraints)
|
|
564
625
|
if (parsedNewInputValue >= maxSeconds) {
|
|
565
|
-
|
|
566
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
567
|
-
}
|
|
568
|
-
else {
|
|
569
|
-
this.seconds = '00';
|
|
570
|
-
reputedToZero = true;
|
|
571
|
-
}
|
|
626
|
+
this.seconds = '00';
|
|
572
627
|
}
|
|
573
628
|
else {
|
|
574
|
-
|
|
575
|
-
if (minSecond && parseInt(newInputValue, 10) < minSecond) {
|
|
576
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
577
|
-
}
|
|
578
|
-
else {
|
|
579
|
-
this.seconds = '00';
|
|
580
|
-
reputedToZero = true;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
else {
|
|
584
|
-
if (minSecond && parsedNewInputValue < minSecond) {
|
|
585
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
586
|
-
}
|
|
587
|
-
else {
|
|
588
|
-
this.seconds = parsedNewInputValue.toString();
|
|
589
|
-
}
|
|
590
|
-
}
|
|
629
|
+
this.seconds = parsedNewInputValue.toString();
|
|
591
630
|
}
|
|
592
631
|
}
|
|
593
632
|
else {
|
|
594
|
-
const
|
|
595
|
-
|
|
633
|
+
const parsedNewInputValue = parseInt(inputValue, 10) || 0;
|
|
634
|
+
// Only apply format validation (not min/max constraints)
|
|
596
635
|
if (parsedNewInputValue >= maxSeconds) {
|
|
597
|
-
|
|
598
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
599
|
-
}
|
|
600
|
-
else {
|
|
601
|
-
this.seconds = '00';
|
|
602
|
-
reputedToZero = true;
|
|
603
|
-
}
|
|
636
|
+
this.seconds = '00';
|
|
604
637
|
}
|
|
605
638
|
else {
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
609
|
-
}
|
|
610
|
-
else {
|
|
611
|
-
this.seconds = '00';
|
|
612
|
-
reputedToZero = true;
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
else {
|
|
616
|
-
if (minSecond && parsedNewInputValue < minSecond) {
|
|
617
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
618
|
-
}
|
|
619
|
-
else {
|
|
620
|
-
this.seconds = parsedNewInputValue.toString();
|
|
621
|
-
}
|
|
622
|
-
}
|
|
639
|
+
// For direct input, remove unnecessary leading zeros (e.g., '01' becomes '1')
|
|
640
|
+
this.seconds = parsedNewInputValue.toString();
|
|
623
641
|
}
|
|
624
642
|
}
|
|
625
|
-
|
|
626
|
-
(_c = this.inputElements[TimeType.Seconds]) === null || _c === void 0 ? void 0 : _c.focus();
|
|
627
|
-
(_d = this.inputElements[TimeType.Seconds]) === null || _d === void 0 ? void 0 : _d.select();
|
|
628
|
-
}
|
|
643
|
+
// No auto-navigation for seconds field as it's typically the last field
|
|
629
644
|
}
|
|
630
|
-
// Parse a
|
|
645
|
+
// Parse a time string according to the current format
|
|
631
646
|
parseTime(timeString) {
|
|
632
647
|
if (!timeString) {
|
|
633
648
|
return;
|
|
634
649
|
}
|
|
635
|
-
|
|
636
|
-
const
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
const minSecond = this.parseSecond(this.min) || second;
|
|
642
|
-
this.hours = minHour.padStart(2, '0');
|
|
643
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
644
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
650
|
+
// Use format-aware parsing without constraint application
|
|
651
|
+
const components = parseValueByFormat(timeString, this.format);
|
|
652
|
+
// Set the parsed values without applying min/max constraints
|
|
653
|
+
this.hours = components.hours;
|
|
654
|
+
this.minutes = components.minutes;
|
|
655
|
+
this.seconds = components.seconds;
|
|
645
656
|
}
|
|
646
657
|
reconstructTime() {
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
+
const components = {
|
|
659
|
+
hours: this.hours,
|
|
660
|
+
minutes: this.minutes,
|
|
661
|
+
seconds: this.seconds,
|
|
662
|
+
};
|
|
663
|
+
// Ensure the reconstructed time is in the correct format
|
|
664
|
+
const reconstructedTime = reconstructTimeByFormat(components, this.format);
|
|
665
|
+
// Validate that the reconstructed time matches the expected format
|
|
666
|
+
if (!isValidFormatValue(reconstructedTime, this.format)) {
|
|
667
|
+
// If invalid, return the default value for this format
|
|
668
|
+
const config = FORMAT_CONFIGS[this.format];
|
|
669
|
+
return config ? config.defaultValue : reconstructedTime;
|
|
658
670
|
}
|
|
671
|
+
return reconstructedTime;
|
|
659
672
|
}
|
|
660
673
|
handleFocus(type) {
|
|
661
674
|
var _a, _b, _c, _d;
|
|
662
675
|
if (this.readonly || this.disabled) {
|
|
663
676
|
return;
|
|
664
677
|
}
|
|
678
|
+
// Check if this field is visible for the current format
|
|
679
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
680
|
+
if (!visibleTypes.includes(type)) {
|
|
681
|
+
return; // Don't handle focus for non-visible fields
|
|
682
|
+
}
|
|
665
683
|
if (!this.open) {
|
|
666
684
|
this.open = true; // Force the popover to open
|
|
667
685
|
}
|
|
@@ -674,33 +692,23 @@ const NvFieldtime = class {
|
|
|
674
692
|
this.typeFocused = type;
|
|
675
693
|
}
|
|
676
694
|
HandleDropdownIconClick() {
|
|
677
|
-
var _a, _b
|
|
695
|
+
var _a, _b;
|
|
678
696
|
if (this.disabled || this.readonly) {
|
|
679
697
|
return; // Do not toggle if disabled or read-only
|
|
680
698
|
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
else if (this.open && this.inputElements[TimeType.Minutes]) {
|
|
685
|
-
this.open = false; // Close the popover if it is open
|
|
686
|
-
}
|
|
687
|
-
else if (this.open && this.inputElements[TimeType.Seconds]) {
|
|
699
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
700
|
+
const firstVisibleType = visibleTypes[0];
|
|
701
|
+
if (this.open) {
|
|
688
702
|
this.open = false; // Close the popover if it is open
|
|
689
703
|
}
|
|
690
|
-
else if (!this.open &&
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
(_c = this.inputElements[TimeType.Minutes]) === null || _c === void 0 ? void 0 : _c.focus(); // Focus will open the popover
|
|
696
|
-
(_d = this.inputElements[TimeType.Minutes]) === null || _d === void 0 ? void 0 : _d.select();
|
|
697
|
-
}
|
|
698
|
-
else if (!this.open && this.inputElements[TimeType.Seconds]) {
|
|
699
|
-
(_e = this.inputElements[TimeType.Seconds]) === null || _e === void 0 ? void 0 : _e.focus(); // Focus will open the popover
|
|
700
|
-
(_f = this.inputElements[TimeType.Seconds]) === null || _f === void 0 ? void 0 : _f.select();
|
|
704
|
+
else if (!this.open &&
|
|
705
|
+
firstVisibleType &&
|
|
706
|
+
this.inputElements[firstVisibleType]) {
|
|
707
|
+
(_a = this.inputElements[firstVisibleType]) === null || _a === void 0 ? void 0 : _a.focus(); // Focus will open the popover
|
|
708
|
+
(_b = this.inputElements[firstVisibleType]) === null || _b === void 0 ? void 0 : _b.select();
|
|
701
709
|
}
|
|
702
710
|
else {
|
|
703
|
-
console.warn('nv-fieldtime -> No input elements found to focus
|
|
711
|
+
console.warn('nv-fieldtime -> No visible input elements found to focus');
|
|
704
712
|
}
|
|
705
713
|
}
|
|
706
714
|
updateHighlightedItem(items, index) {
|
|
@@ -719,6 +727,8 @@ const NvFieldtime = class {
|
|
|
719
727
|
}
|
|
720
728
|
handleTimeOptionClick(event, type) {
|
|
721
729
|
const option = parseInt(event.target.textContent || '0', 10);
|
|
730
|
+
// Update the time component directly without constraint validation
|
|
731
|
+
// Dropdown options are already filtered by constraints during generation
|
|
722
732
|
if (type === TimeType.Hours) {
|
|
723
733
|
this.hours = option.toString().padStart(2, '0');
|
|
724
734
|
}
|
|
@@ -728,8 +738,9 @@ const NvFieldtime = class {
|
|
|
728
738
|
else if (type === TimeType.Seconds) {
|
|
729
739
|
this.seconds = option.toString().padStart(2, '0');
|
|
730
740
|
}
|
|
731
|
-
|
|
732
|
-
|
|
741
|
+
// Reconstruct time in the correct format and update value
|
|
742
|
+
const reconstructedTime = this.reconstructTime();
|
|
743
|
+
this.value = reconstructedTime;
|
|
733
744
|
}
|
|
734
745
|
handleInputBlur() {
|
|
735
746
|
// Use a delay to check if the focus is still within the popover
|
|
@@ -788,17 +799,29 @@ const NvFieldtime = class {
|
|
|
788
799
|
}
|
|
789
800
|
generateHourOptions(stepInSeconds) {
|
|
790
801
|
const hourStep = Math.max(1, Math.floor(stepInSeconds / 3600)); // Prevent step < 1
|
|
791
|
-
const
|
|
792
|
-
|
|
793
|
-
const
|
|
794
|
-
const
|
|
795
|
-
const
|
|
802
|
+
const is12HourFormat = this.format.startsWith('hh');
|
|
803
|
+
// Set proper hour ranges based on format
|
|
804
|
+
const defaultMaxHour = is12HourFormat ? 12 : 23;
|
|
805
|
+
const defaultMinHour = is12HourFormat ? 1 : 0;
|
|
806
|
+
const maxHour = this.parseHour(this.max, this.format);
|
|
807
|
+
const minHour = this.parseHour(this.min, this.format);
|
|
808
|
+
const maxHourValue = maxHour ? parseInt(maxHour, 10) : defaultMaxHour;
|
|
809
|
+
const minHourValue = minHour ? parseInt(minHour, 10) : defaultMinHour;
|
|
796
810
|
const values = [];
|
|
797
|
-
for (let i = minHourValue; i
|
|
798
|
-
|
|
811
|
+
for (let i = minHourValue; i <= maxHourValue; i += hourStep) {
|
|
812
|
+
const hourStr = i.toString().padStart(2, '0');
|
|
813
|
+
values.push(hourStr);
|
|
799
814
|
}
|
|
800
815
|
return values;
|
|
801
816
|
}
|
|
817
|
+
/**
|
|
818
|
+
* Parse hour value from min/max constraint strings for dropdown generation only.
|
|
819
|
+
* This method is used exclusively for filtering dropdown options and should not
|
|
820
|
+
* affect input values or validation.
|
|
821
|
+
* @param {string} value - The time string to parse (e.g., "14:30" or "02:30")
|
|
822
|
+
* @param {string} format - The time format string (e.g., "HH:mm" or "hh:mm")
|
|
823
|
+
* @returns {string} The parsed hour string or null if invalid
|
|
824
|
+
*/
|
|
802
825
|
parseHour(value, format) {
|
|
803
826
|
if (!value)
|
|
804
827
|
return null;
|
|
@@ -816,13 +839,21 @@ const NvFieldtime = class {
|
|
|
816
839
|
const minMinute = (_a = this.parseMinute(this.min)) !== null && _a !== void 0 ? _a : 0;
|
|
817
840
|
const maxMinute = (_b = this.parseMinute(this.max)) !== null && _b !== void 0 ? _b : 59;
|
|
818
841
|
if (minMinute === 0 && maxMinute === 0)
|
|
819
|
-
return ['00']; // Handle edge case for zero
|
|
842
|
+
return ['00']; // Handle edge case for zero minutes
|
|
820
843
|
const values = [];
|
|
821
844
|
for (let i = minMinute; i <= maxMinute; i += minuteStep) {
|
|
822
|
-
|
|
845
|
+
const minuteStr = i.toString().padStart(2, '0');
|
|
846
|
+
values.push(minuteStr);
|
|
823
847
|
}
|
|
824
848
|
return values;
|
|
825
849
|
}
|
|
850
|
+
/**
|
|
851
|
+
* Parse minute value from min/max constraint strings for dropdown generation only.
|
|
852
|
+
* This method is used exclusively for filtering dropdown options and should not
|
|
853
|
+
* affect input values or validation.
|
|
854
|
+
* @param {string} value - The time string to parse (e.g., "14:30" or "02:30")
|
|
855
|
+
* @returns {number} The parsed minute number or null if invalid
|
|
856
|
+
*/
|
|
826
857
|
parseMinute(value) {
|
|
827
858
|
if (!value)
|
|
828
859
|
return null;
|
|
@@ -841,10 +872,18 @@ const NvFieldtime = class {
|
|
|
841
872
|
return ['00']; // Handle edge case for zero seconds
|
|
842
873
|
const values = [];
|
|
843
874
|
for (let i = minSecond; i <= maxSecond; i += secondStep) {
|
|
844
|
-
|
|
875
|
+
const secondStr = i.toString().padStart(2, '0');
|
|
876
|
+
values.push(secondStr);
|
|
845
877
|
}
|
|
846
878
|
return values;
|
|
847
879
|
}
|
|
880
|
+
/**
|
|
881
|
+
* Parse second value from min/max constraint strings for dropdown generation only.
|
|
882
|
+
* This method is used exclusively for filtering dropdown options and should not
|
|
883
|
+
* affect input values or validation.
|
|
884
|
+
* @param {string} value - The time string to parse (e.g., "14:30:45" or "02:30:45")
|
|
885
|
+
* @returns {number} The parsed second number or null if invalid
|
|
886
|
+
*/
|
|
848
887
|
parseSecond(value) {
|
|
849
888
|
if (!value)
|
|
850
889
|
return null;
|
|
@@ -861,10 +900,6 @@ const NvFieldtime = class {
|
|
|
861
900
|
const repetitions = Math.ceil(300 / totalOptions);
|
|
862
901
|
return Array(repetitions).fill(options).flat();
|
|
863
902
|
}
|
|
864
|
-
getCurrentTime() {
|
|
865
|
-
const currentTime = new Date();
|
|
866
|
-
return currentTime.toLocaleTimeString(); // Returns the time in the locale's format
|
|
867
|
-
}
|
|
868
903
|
updateColumnHighlight(selector, value) {
|
|
869
904
|
const items = Array.from(this.el.querySelectorAll(selector));
|
|
870
905
|
const index = items.findIndex(x => x.textContent === value);
|
|
@@ -882,8 +917,13 @@ const NvFieldtime = class {
|
|
|
882
917
|
}
|
|
883
918
|
if (!this.open) {
|
|
884
919
|
if (this.inputElements) {
|
|
885
|
-
|
|
886
|
-
|
|
920
|
+
// Focus on the first visible field based on format
|
|
921
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
922
|
+
const firstVisibleType = visibleTypes[0];
|
|
923
|
+
if (firstVisibleType && this.inputElements[firstVisibleType]) {
|
|
924
|
+
(_a = this.inputElements[firstVisibleType]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
925
|
+
(_b = this.inputElements[firstVisibleType]) === null || _b === void 0 ? void 0 : _b.select();
|
|
926
|
+
}
|
|
887
927
|
}
|
|
888
928
|
event.preventDefault();
|
|
889
929
|
}
|
|
@@ -893,17 +933,23 @@ const NvFieldtime = class {
|
|
|
893
933
|
//#region LIFECYCLE
|
|
894
934
|
componentWillLoad() {
|
|
895
935
|
document.addEventListener('click', this.handleClickOutside.bind(this));
|
|
896
|
-
//
|
|
936
|
+
// Initialize component state based on format and value
|
|
897
937
|
if (this.value) {
|
|
938
|
+
// Parse the provided value using format-aware parsing without constraint application
|
|
898
939
|
this.parseTime(this.value);
|
|
899
940
|
}
|
|
900
941
|
else {
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
const
|
|
904
|
-
|
|
905
|
-
this.
|
|
906
|
-
this.
|
|
942
|
+
// Initialize with format-appropriate default values without any constraint application
|
|
943
|
+
// Use format-specific defaults: '01' for 12-hour formats, '00' for 24-hour formats
|
|
944
|
+
const defaultComponents = parseValueByFormat('', this.format);
|
|
945
|
+
// Set default values directly without any min/max constraint validation
|
|
946
|
+
this.hours = defaultComponents.hours;
|
|
947
|
+
this.minutes = defaultComponents.minutes;
|
|
948
|
+
this.seconds = defaultComponents.seconds;
|
|
949
|
+
// Set the initial value in the correct format without constraint validation
|
|
950
|
+
// This ensures the component has a proper initial state for the value watcher
|
|
951
|
+
const initialValue = reconstructTimeByFormat(defaultComponents, this.format);
|
|
952
|
+
this.value = initialValue;
|
|
907
953
|
}
|
|
908
954
|
}
|
|
909
955
|
connectedCallback() {
|
|
@@ -913,63 +959,94 @@ const NvFieldtime = class {
|
|
|
913
959
|
document.removeEventListener('click', this.handleClickOutside.bind(this));
|
|
914
960
|
}
|
|
915
961
|
componentDidLoad() {
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
second = secondAmPm;
|
|
928
|
-
}
|
|
929
|
-
// Parse hour as integer for calculations
|
|
930
|
-
let parsedHour = parseInt(hour, 10);
|
|
931
|
-
// Convert hour to 24-hour format based on AM/PM (if present)
|
|
932
|
-
if (amPm) {
|
|
933
|
-
if (amPm === 'PM' && parsedHour < 12) {
|
|
934
|
-
parsedHour += 12; // Convert PM to 24-hour
|
|
935
|
-
}
|
|
936
|
-
else if (amPm === 'AM' && parsedHour === 12) {
|
|
937
|
-
parsedHour = 0; // Midnight in 24-hour format
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
// Adjust for 12-hour format if necessary
|
|
941
|
-
if (this.format.startsWith('hh')) {
|
|
942
|
-
if (parsedHour === 0) {
|
|
943
|
-
hour = '12'; // Midnight in 12-hour format
|
|
944
|
-
}
|
|
945
|
-
else if (parsedHour > 12) {
|
|
946
|
-
hour = (parsedHour - 12).toString(); // Convert 24-hour to 12-hour
|
|
947
|
-
}
|
|
948
|
-
else {
|
|
949
|
-
hour = parsedHour.toString();
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
else {
|
|
953
|
-
hour = parsedHour.toString(); // Use 24-hour format directly
|
|
954
|
-
}
|
|
955
|
-
// Pad hour, minute, and second to ensure two digits
|
|
956
|
-
hour = hour.padStart(2, '0');
|
|
957
|
-
minute = minute.padStart(2, '0');
|
|
958
|
-
second = second.padStart(2, '0');
|
|
959
|
-
// Update highlighted items for hours
|
|
960
|
-
const hourSelector = `.time-column.time-column-hours div`;
|
|
961
|
-
this.updateColumnHighlight(hourSelector, hour);
|
|
962
|
-
// Update highlighted items for minutes
|
|
963
|
-
const minuteSelector = `.time-column.time-column-minutes div`;
|
|
964
|
-
this.updateColumnHighlight(minuteSelector, minute);
|
|
965
|
-
// Update highlighted items for seconds
|
|
966
|
-
const secondSelector = `.time-column.time-column-seconds div`;
|
|
967
|
-
this.updateColumnHighlight(secondSelector, second);
|
|
968
|
-
}
|
|
962
|
+
// Initialize dropdown highlighting based on current component state
|
|
963
|
+
// This ensures proper visual feedback without applying any constraints
|
|
964
|
+
// Update highlighted items for hours based on current state
|
|
965
|
+
const hourSelector = `.time-column.time-column-hours div`;
|
|
966
|
+
this.updateColumnHighlight(hourSelector, this.hours);
|
|
967
|
+
// Update highlighted items for minutes based on current state
|
|
968
|
+
const minuteSelector = `.time-column.time-column-minutes div`;
|
|
969
|
+
this.updateColumnHighlight(minuteSelector, this.minutes);
|
|
970
|
+
// Update highlighted items for seconds based on current state
|
|
971
|
+
const secondSelector = `.time-column.time-column-seconds div`;
|
|
972
|
+
this.updateColumnHighlight(secondSelector, this.seconds);
|
|
969
973
|
}
|
|
970
974
|
//#endregion LIFECYCLE
|
|
971
975
|
/****************************************************************************/
|
|
972
976
|
//#region RENDER
|
|
977
|
+
/**
|
|
978
|
+
* Renders input fields based on the current format
|
|
979
|
+
* Only shows fields that are relevant to the selected format
|
|
980
|
+
* @returns {HTMLElement[]} Array of HTML elements for time input fields
|
|
981
|
+
*/
|
|
982
|
+
renderTimeInputFields() {
|
|
983
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
984
|
+
const elements = [];
|
|
985
|
+
visibleTypes.forEach((type, index) => {
|
|
986
|
+
// Add separator colon before minutes and seconds (but not before the first field)
|
|
987
|
+
if (index > 0) {
|
|
988
|
+
elements.push(h("span", null, ":"));
|
|
989
|
+
}
|
|
990
|
+
// Add the input field for this time type
|
|
991
|
+
elements.push(this.renderTimeInputField(type));
|
|
992
|
+
});
|
|
993
|
+
return elements;
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* Renders a single time input field for the specified type
|
|
997
|
+
* @param {TimeType} type - The time type to render input for
|
|
998
|
+
* @returns {HTMLInputElement} HTML input element for the specified time type
|
|
999
|
+
*/
|
|
1000
|
+
renderTimeInputField(type) {
|
|
1001
|
+
const getValue = () => {
|
|
1002
|
+
switch (type) {
|
|
1003
|
+
case TimeType.Hours:
|
|
1004
|
+
return this.hours;
|
|
1005
|
+
case TimeType.Minutes:
|
|
1006
|
+
return this.minutes;
|
|
1007
|
+
case TimeType.Seconds:
|
|
1008
|
+
return this.seconds;
|
|
1009
|
+
default:
|
|
1010
|
+
return '00';
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
const getPlaceholder = () => {
|
|
1014
|
+
switch (type) {
|
|
1015
|
+
case TimeType.Hours:
|
|
1016
|
+
return this.format.includes('hh') ? 'hh' : 'HH';
|
|
1017
|
+
case TimeType.Minutes:
|
|
1018
|
+
return 'mm';
|
|
1019
|
+
case TimeType.Seconds:
|
|
1020
|
+
return 'ss';
|
|
1021
|
+
default:
|
|
1022
|
+
return '';
|
|
1023
|
+
}
|
|
1024
|
+
};
|
|
1025
|
+
const getId = () => {
|
|
1026
|
+
switch (type) {
|
|
1027
|
+
case TimeType.Hours:
|
|
1028
|
+
return this.inputId;
|
|
1029
|
+
case TimeType.Minutes:
|
|
1030
|
+
return `${this.inputId}-minutes`;
|
|
1031
|
+
case TimeType.Seconds:
|
|
1032
|
+
return `${this.inputId}-seconds`;
|
|
1033
|
+
default:
|
|
1034
|
+
return this.inputId;
|
|
1035
|
+
}
|
|
1036
|
+
};
|
|
1037
|
+
// Remove min/max constraints from input elements to allow native stepper behavior
|
|
1038
|
+
// Constraints are only applied to dropdown options, not input steppers
|
|
1039
|
+
return (h("input", { ref: el => (this.inputElements[type] = el), type: "number", autofocus: this.autofocus && type === getVisibleTimeTypes(this.format)[0], class: "time-input", pattern: "[0-9]*", maxlength: "3", value: getValue(), onInput: e => this.handleInputChange(e, type), placeholder: getPlaceholder(), inputMode: "numeric", onFocus: () => this.handleFocus(type), name: this.name ? `${type}-${this.name}` : type, id: getId(), readonly: this.readonly, disabled: this.disabled, required: this.required, onKeyDown: e => this.handleKeyDown(e), onBlur: () => this.handleInputBlur() }));
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* Renders dropdown columns based on the current format
|
|
1043
|
+
* Only shows columns that are relevant to the selected format
|
|
1044
|
+
* @returns {HTMLElement[]} Array of HTML elements for time dropdown columns
|
|
1045
|
+
*/
|
|
1046
|
+
renderTimeDropdownColumns() {
|
|
1047
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
1048
|
+
return visibleTypes.map(type => this.RenderTimeOptionsColumn(type));
|
|
1049
|
+
}
|
|
973
1050
|
RenderTimeOptionsColumn(type) {
|
|
974
1051
|
return (h("div", { class: `time-column time-column-${type}`, onScroll: e => this.handleScroll(e, type) }, this.generateInfiniteTimeOptions(type).map((option, index) => (h("div", { class: {
|
|
975
1052
|
'time-option': true,
|
|
@@ -979,32 +1056,16 @@ const NvFieldtime = class {
|
|
|
979
1056
|
}, key: `${option}-${index}`, onClick: e => this.handleTimeOptionClick(e, type) }, option)))));
|
|
980
1057
|
}
|
|
981
1058
|
render() {
|
|
982
|
-
return (h(Host, { key: '
|
|
983
|
-
h("
|
|
984
|
-
|
|
985
|
-
: TimeType.Hours, id: this.inputId, readonly: this.readonly, disabled: this.disabled, required: this.required, onKeyDown: e => this.handleKeyDown(e), onBlur: () => this.handleInputBlur() }),
|
|
986
|
-
], this.format.includes('mm') && [
|
|
987
|
-
h("span", { key: '74f9604ffd54e0c0bbd88996e32fdcb08f2c3645' }, ":"),
|
|
988
|
-
h("input", { key: '52f9b637bba804cac6fadff06e8b077bb2f5748a', ref: el => (this.inputElements[TimeType.Minutes] = el), type: "number", autofocus: this.autofocus, class: "time-input", pattern: "[0-9]*", maxlength: "3", value: this.minutes, onInput: e => this.handleInputChange(e, TimeType.Minutes), placeholder: "mm", inputMode: "numeric", onFocus: () => this.handleFocus(TimeType.Minutes), name: this.name
|
|
989
|
-
? `${TimeType.Minutes}-${this.name}`
|
|
990
|
-
: TimeType.Minutes, id: `${this.inputId}-minutes`, readonly: this.readonly, disabled: this.disabled, required: this.required, onKeyDown: e => this.handleKeyDown(e), onBlur: () => this.handleInputBlur() }),
|
|
991
|
-
], this.format.includes('ss') && [
|
|
992
|
-
h("span", { key: '878bc9ce7557e9cf9471803a86956a9184d0ccb5' }, ":"),
|
|
993
|
-
h("input", { key: 'b074d4d3ef80f66e7dbe051b6bc53f151661f409', ref: el => (this.inputElements[TimeType.Seconds] = el), type: "number", autofocus: this.autofocus, class: "time-input", pattern: "[0-9]*", maxlength: "3", value: this.seconds, onInput: e => this.handleInputChange(e, TimeType.Seconds), placeholder: "ss", inputMode: "numeric", onFocus: () => this.handleFocus(TimeType.Seconds), name: this.name
|
|
994
|
-
? `${TimeType.Seconds}-${this.name}`
|
|
995
|
-
: TimeType.Seconds, id: `${this.inputId}-seconds`, readonly: this.readonly, disabled: this.disabled, required: this.required, onKeyDown: e => this.handleKeyDown(e), onBlur: () => this.handleInputBlur() }),
|
|
996
|
-
], h("nv-iconbutton", { key: '3f5d78116ee60d1874a4629d9cf36a06d52b7df4', name: 'clock', size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide time picker' : 'Show time picker', onClick: () => this.HandleDropdownIconClick() }), this.error && (h("nv-icon", { key: '4b2356cf95131af213a4e98feede16fc8c4963db', name: "alert-circle", class: "validation", size: "sm" })), this.success && (h("nv-icon", { key: 'f9b0e61037049a36ac900d1af9ecc71b211ebd88', name: "circle-check", class: "validation", size: "sm" }))), h("slot", { key: '6177abde559c57f2b0586368ead1a61d7b543838', name: "after-input" })), h("div", { key: 'f6d5205a5011411550179f9337143163cb547fb1', class: "time-dropdown", slot: "content" }, h("div", { key: '9f0b3e1423bef197b269c5b11ce744cabc2bd6c4', class: "time-columns" }, startsWithIgnoreCase(this.format, 'HH') &&
|
|
997
|
-
this.RenderTimeOptionsColumn(TimeType.Hours), this.format.includes('mm') &&
|
|
998
|
-
this.RenderTimeOptionsColumn(TimeType.Minutes), this.format.includes('ss') &&
|
|
999
|
-
this.RenderTimeOptionsColumn(TimeType.Seconds)))), (this.description ||
|
|
1000
|
-
this.el.querySelector('[slot="description"]')) && (h("div", { key: '1076ded73b32ff9afbd0f02184febcc82f8d839e', class: "description" }, h("slot", { key: '479d09b299d0e380533a6cd689ce7f03aa92ea8e', name: "description" }, this.description))), (this.errorDescription ||
|
|
1001
|
-
this.el.querySelector('[slot="error-description"]')) && (h("div", { key: '5615246dbd797c300be357be37d3b9d0aee56e31', hidden: !this.error, class: "error-description" }, h("slot", { key: '6568ea3f9e0bdf85dd280c645956f8e0bb592e35', name: "error-description" }, this.errorDescription)))));
|
|
1059
|
+
return (h(Host, { key: 'f66fe2a29f23a0bc967821a0c9bca4347b622286', onclick: (e) => this.handleHostClick(e), "aria-expanded": this.open ? 'true' : 'false' }, (this.label || this.el.querySelector('[slot="label"]')) && (h("label", { key: 'f01ce1b034b1b547cbdde5814db9357ee1913e04', htmlFor: this.inputId }, h("slot", { key: 'd81dcb20883b93280db6e76e0299f679f1f9ed84', name: "label" }, this.label))), h("nv-popover", { key: '8c9e83002edcfba89ca4ca282fc82db714ed2f43', ref: el => (this.popoverElement = el), triggerMode: "controlled", placement: "bottom-start", open: this.open }, h("div", { key: '3a5b26e4be67f277ead2a9fe2f04e5d12a4bd596', class: "input-wrapper", slot: "trigger" }, h("slot", { key: '2ea5f8269c6f0892c53a002a298ca3ceed8f8a00', name: "before-input" }), h("div", { key: 'ab97bbbf183118d7b510f82c800b4a3fa1fefda3', class: "input-container" }, h("slot", { key: 'a80d2f68b24d4226c18bf0df18ebf13ac6e0873e', name: "leading-input" }), this.renderTimeInputFields(), h("nv-iconbutton", { key: '1f7aacf1ab073c0c6ef10b50e948a7ecbca4dd75', name: 'clock', size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide time picker' : 'Show time picker', onClick: () => this.HandleDropdownIconClick() }), this.error && (h("nv-icon", { key: '8f414a3b3daae6f0625b3c62b920621bf8698db3', name: "alert-circle", class: "validation", size: "sm" })), this.success && (h("nv-icon", { key: '13b5671664466b6bb50f2561b5cffb96517a1068', name: "circle-check", class: "validation", size: "sm" }))), h("slot", { key: 'b5d6085a9864ef84d4113062a0b1cb8a807ab241', name: "after-input" })), h("div", { key: '2950c5fac3a0f219e5db2e3a7e9f605d86e50aa2', class: "time-dropdown", slot: "content" }, h("div", { key: 'c5b7ff3818a05e1f6d7ca76657f57b85bb595345', class: "time-columns" }, this.renderTimeDropdownColumns()))), (this.description ||
|
|
1060
|
+
this.el.querySelector('[slot="description"]')) && (h("div", { key: 'c8cb90fad74721a9b5eb0ab50980f3fd7c587e62', class: "description" }, h("slot", { key: '641d1a6a9dbf580267664831d5b371a601afb039', name: "description" }, this.description))), (this.errorDescription ||
|
|
1061
|
+
this.el.querySelector('[slot="error-description"]')) && (h("div", { key: '5721b81d7a16b626bfa7c3af20897f33b7c37080', hidden: !this.error, class: "error-description" }, h("slot", { key: '84cef1043666ab6dd86f70d4ba0054d7f33ca589', name: "error-description" }, this.errorDescription)))));
|
|
1002
1062
|
}
|
|
1003
1063
|
static get formAssociated() { return true; }
|
|
1004
1064
|
get el() { return getElement(this); }
|
|
1005
1065
|
static get watchers() { return {
|
|
1006
1066
|
"value": ["handleValueChange"],
|
|
1007
|
-
"open": ["handleOpenChange"]
|
|
1067
|
+
"open": ["handleOpenChange"],
|
|
1068
|
+
"format": ["handleFormatChange"]
|
|
1008
1069
|
}; }
|
|
1009
1070
|
};
|
|
1010
1071
|
NvFieldtime.style = NvFieldtimeStyle0;
|