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