@nova-design-system/nova-webcomponents 3.17.0 → 3.18.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 +21 -3
- 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-datagrid.cjs.entry.js +1 -1
- package/dist/cjs/nv-datagrid.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldtime.cjs.entry.js +556 -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 +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 +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-datagrid/nv-datagrid.css +4 -4
- 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 +331 -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 +1 -1
- package/dist/collection/components/nv-icon/nv-icons.js.map +1 -1
- package/dist/collection/components/nv-iconbutton/nv-iconbutton.js +1 -1
- package/dist/collection/components/nv-loader/nv-loader.js +1 -1
- package/dist/collection/components/nv-menu/nv-menu.js +1 -1
- package/dist/collection/components/nv-menuitem/nv-menuitem.js +2 -2
- package/dist/collection/components/nv-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 +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 +21 -3
- 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 +3 -3
- package/dist/components/nv-datagrid.js.map +1 -1
- package/dist/components/nv-dialog.js +4 -4
- package/dist/components/nv-dialogfooter.js +1 -1
- package/dist/components/nv-fielddate.js +4 -4
- package/dist/components/nv-fielddaterange.js +4 -4
- package/dist/components/nv-fielddropdown.js +5 -5
- package/dist/components/nv-fielddropdownitem.js +1 -1
- package/dist/components/nv-fieldmultiselect.js +5 -5
- package/dist/components/nv-fieldnumber.js +1 -1
- package/dist/components/nv-fieldpassword.js +3 -3
- package/dist/components/nv-fieldselect.js +3 -3
- package/dist/components/nv-fieldslider.js +4 -4
- package/dist/components/nv-fieldtext.js +1 -1
- package/dist/components/nv-fieldtime.js +562 -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 +4 -4
- 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-31478080.js → p-015330b8.js} +2 -2
- package/dist/components/{p-31478080.js.map → p-015330b8.js.map} +1 -1
- package/dist/components/{p-7b5102c8.js → p-1bd396b1.js} +4 -4
- package/dist/components/{p-7b5102c8.js.map → p-1bd396b1.js.map} +1 -1
- package/dist/components/{p-9e7468e3.js → p-2574f8c2.js} +2 -2
- package/dist/components/{p-9e7468e3.js.map → p-2574f8c2.js.map} +1 -1
- package/dist/components/{p-f2bac2aa.js → p-4cd6f629.js} +2 -2
- package/dist/components/{p-f2bac2aa.js.map → p-4cd6f629.js.map} +1 -1
- package/dist/components/{p-2cc83e0c.js → p-5e315239.js} +2 -2
- package/dist/components/{p-2cc83e0c.js.map → p-5e315239.js.map} +1 -1
- package/dist/components/{p-7112612c.js → p-6ca3d847.js} +4 -4
- package/dist/components/{p-7112612c.js.map → p-6ca3d847.js.map} +1 -1
- package/dist/components/{p-98429fd7.js → p-c981bb48.js} +2 -2
- package/dist/components/{p-98429fd7.js.map → p-c981bb48.js.map} +1 -1
- package/dist/components/{p-0fd23531.js → p-d1b02966.js} +4 -4
- package/dist/components/{p-0fd23531.js.map → p-d1b02966.js.map} +1 -1
- package/dist/components/{p-6f2b257e.js → p-ea45f1ab.js} +3 -3
- package/dist/components/{p-6f2b257e.js.map → p-ea45f1ab.js.map} +1 -1
- package/dist/components/{p-63595ea1.js → p-ebfecbaa.js} +2 -2
- package/dist/components/{p-63595ea1.js.map → p-ebfecbaa.js.map} +1 -1
- package/dist/components/{p-47d499b4.js → p-ed43bcec.js} +3 -3
- package/dist/components/{p-47d499b4.js.map → p-ed43bcec.js.map} +1 -1
- package/dist/components/{p-378e3127.js → p-fabbaf47.js} +4 -4
- package/dist/components/{p-378e3127.js.map → p-fabbaf47.js.map} +1 -1
- package/dist/components/{p-df5d76a5.js → p-fca4d85b.js} +3 -3
- package/dist/components/{p-df5d76a5.js.map → p-fca4d85b.js.map} +1 -1
- package/dist/esm/index.js +21 -3
- 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-datagrid.entry.js +1 -1
- package/dist/esm/nv-datagrid.entry.js.map +1 -1
- package/dist/esm/nv-fieldtime.entry.js +557 -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 +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 +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-f30e0be6.entry.js → p-00d1e5e1.entry.js} +2 -2
- package/dist/native/{p-4eaf417d.entry.js → p-122c78c3.entry.js} +2 -2
- package/dist/native/{p-4eaf417d.entry.js.map → p-122c78c3.entry.js.map} +1 -1
- package/dist/native/{p-91fab6c2.entry.js → p-14d2f70a.entry.js} +2 -2
- package/dist/native/{p-d94bf052.entry.js → p-3464b86a.entry.js} +2 -2
- package/dist/native/{p-638967bf.entry.js → p-417fba7d.entry.js} +2 -2
- package/dist/native/{p-52d2c0ae.entry.js → p-4e6fb719.entry.js} +2 -2
- package/dist/native/{p-cb0293ec.entry.js → p-539666dd.entry.js} +2 -2
- package/dist/native/{p-2364aefa.entry.js → p-5c678bc7.entry.js} +2 -2
- package/dist/native/{p-bcf41cd0.entry.js → p-5e70f9ce.entry.js} +2 -2
- package/dist/native/{p-278613a3.entry.js → p-5f98d4cd.entry.js} +2 -2
- package/dist/native/p-8c053954.entry.js +2 -0
- package/dist/native/p-8c053954.entry.js.map +1 -0
- package/dist/native/{p-2dfd786f.entry.js → p-ad029453.entry.js} +2 -2
- package/dist/native/{p-9d7e099f.entry.js → p-ae43eee2.entry.js} +2 -2
- package/dist/native/{p-26513cbd.entry.js → p-b72b5e88.entry.js} +2 -2
- package/dist/native/{p-26513cbd.entry.js.map → p-b72b5e88.entry.js.map} +1 -1
- package/dist/native/{p-ce97ce24.entry.js → p-ca39f78d.entry.js} +2 -2
- package/dist/native/{p-647a0765.entry.js → p-da2060a5.entry.js} +2 -2
- package/dist/native/{p-14e622e1.entry.js → p-e5b7ce4e.entry.js} +2 -2
- 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 +20 -3
- package/dist/vscode-data.json +3 -3
- package/hydrate/index.js +571 -523
- package/hydrate/index.mjs +571 -523
- 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-a5c8eee9.js +0 -22
- package/dist/components/p-a5c8eee9.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-a5c8eee9.js +0 -2
- package/dist/native/p-a5c8eee9.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.map → p-00d1e5e1.entry.js.map} +0 -0
- /package/dist/native/{p-91fab6c2.entry.js.map → p-14d2f70a.entry.js.map} +0 -0
- /package/dist/native/{p-d94bf052.entry.js.map → p-3464b86a.entry.js.map} +0 -0
- /package/dist/native/{p-638967bf.entry.js.map → p-417fba7d.entry.js.map} +0 -0
- /package/dist/native/{p-52d2c0ae.entry.js.map → p-4e6fb719.entry.js.map} +0 -0
- /package/dist/native/{p-cb0293ec.entry.js.map → p-539666dd.entry.js.map} +0 -0
- /package/dist/native/{p-2364aefa.entry.js.map → p-5c678bc7.entry.js.map} +0 -0
- /package/dist/native/{p-bcf41cd0.entry.js.map → p-5e70f9ce.entry.js.map} +0 -0
- /package/dist/native/{p-278613a3.entry.js.map → p-5f98d4cd.entry.js.map} +0 -0
- /package/dist/native/{p-2dfd786f.entry.js.map → p-ad029453.entry.js.map} +0 -0
- /package/dist/native/{p-9d7e099f.entry.js.map → p-ae43eee2.entry.js.map} +0 -0
- /package/dist/native/{p-ce97ce24.entry.js.map → p-ca39f78d.entry.js.map} +0 -0
- /package/dist/native/{p-647a0765.entry.js.map → p-da2060a5.entry.js.map} +0 -0
- /package/dist/native/{p-14e622e1.entry.js.map → p-e5b7ce4e.entry.js.map} +0 -0
|
@@ -1,13 +1,247 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, c as createEvent, h, d as Host } from './p-5829b9f7.js';
|
|
2
|
-
import { a as startsWithIgnoreCase } from './p-a5c8eee9.js';
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, f as forceUpdate, h, d as Host } from './p-5829b9f7.js';
|
|
3
2
|
import { g as TimeType } from './p-51602221.js';
|
|
4
|
-
import { d as defineCustomElement$5 } from './p-
|
|
5
|
-
import { d as defineCustomElement$4 } from './p-
|
|
6
|
-
import { d as defineCustomElement$3 } from './p-
|
|
7
|
-
import { d as defineCustomElement$2 } from './p-
|
|
3
|
+
import { d as defineCustomElement$5 } from './p-ed43bcec.js';
|
|
4
|
+
import { d as defineCustomElement$4 } from './p-6ca3d847.js';
|
|
5
|
+
import { d as defineCustomElement$3 } from './p-c981bb48.js';
|
|
6
|
+
import { d as defineCustomElement$2 } from './p-ebfecbaa.js';
|
|
8
7
|
import { v as v4 } from './p-f5ff676c.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: [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: [TimeType.Hours, 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: [TimeType.Hours, TimeType.Minutes, TimeType.Seconds],
|
|
28
|
+
defaultValue: '00:00:00',
|
|
29
|
+
maxLength: 8,
|
|
30
|
+
},
|
|
31
|
+
'hh': {
|
|
32
|
+
pattern: /^(0?[1-9]|1[0-2])$/,
|
|
33
|
+
parts: [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: [TimeType.Hours, 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: [TimeType.Hours, TimeType.Minutes, 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 [TimeType.Hours, TimeType.Minutes, 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(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(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(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(TimeType.Minutes)) {
|
|
211
|
+
result.minutes = components.minutes;
|
|
212
|
+
}
|
|
213
|
+
if (config.parts.includes(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$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends H {
|
|
@@ -68,6 +302,10 @@ const NvFieldtime$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends
|
|
|
68
302
|
* - hh: 12-hour format (01-12)
|
|
69
303
|
* - hh:mm: 12-hour format with minutes (01:00-12:59)
|
|
70
304
|
* - hh:mm:ss: 12-hour format with minutes and seconds (01:00:00-12:59:59)
|
|
305
|
+
*
|
|
306
|
+
* The component automatically shows only the relevant input fields based on the selected format.
|
|
307
|
+
* When the format changes dynamically, the component re-parses the current value and updates
|
|
308
|
+
* the visible fields accordingly.
|
|
71
309
|
*/
|
|
72
310
|
this.format = 'HH:mm:ss';
|
|
73
311
|
/**
|
|
@@ -96,7 +334,7 @@ const NvFieldtime$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends
|
|
|
96
334
|
this.open = event.detail;
|
|
97
335
|
}
|
|
98
336
|
handleKeyDown(event) {
|
|
99
|
-
var _a, _b
|
|
337
|
+
var _a, _b;
|
|
100
338
|
if (!this.open) {
|
|
101
339
|
if (event.key === 'ArrowDown') {
|
|
102
340
|
this.open = true;
|
|
@@ -131,20 +369,22 @@ const NvFieldtime$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends
|
|
|
131
369
|
else if (event.key === 'Enter' && currentIndex >= 0) {
|
|
132
370
|
event.preventDefault();
|
|
133
371
|
items[currentIndex].click();
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
(
|
|
141
|
-
(
|
|
372
|
+
// Navigate to the next visible field
|
|
373
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
374
|
+
const currentTypeIndex = visibleTypes.indexOf(this.typeFocused);
|
|
375
|
+
const nextTypeIndex = currentTypeIndex + 1;
|
|
376
|
+
if (nextTypeIndex < visibleTypes.length) {
|
|
377
|
+
const nextType = visibleTypes[nextTypeIndex];
|
|
378
|
+
(_a = this.inputElements[nextType]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
379
|
+
(_b = this.inputElements[nextType]) === null || _b === void 0 ? void 0 : _b.select();
|
|
142
380
|
}
|
|
143
381
|
}
|
|
144
382
|
else if (event.key === 'Escape') {
|
|
145
383
|
event.preventDefault();
|
|
146
|
-
|
|
147
|
-
|
|
384
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
385
|
+
const firstVisibleType = visibleTypes[0];
|
|
386
|
+
if (firstVisibleType && this.inputElements[firstVisibleType]) {
|
|
387
|
+
this.inputElements[firstVisibleType].blur();
|
|
148
388
|
}
|
|
149
389
|
}
|
|
150
390
|
}
|
|
@@ -152,6 +392,18 @@ const NvFieldtime$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends
|
|
|
152
392
|
/****************************************************************************/
|
|
153
393
|
//#region WATCHERS
|
|
154
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
|
|
155
407
|
this.valueChanged.emit(newValue);
|
|
156
408
|
}
|
|
157
409
|
handleOpenChange(newOpen) {
|
|
@@ -166,12 +418,36 @@ const NvFieldtime$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends
|
|
|
166
418
|
this.updateColumnHighlight(secondsSelector, this.seconds);
|
|
167
419
|
}
|
|
168
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
|
+
forceUpdate(this.el);
|
|
439
|
+
}
|
|
169
440
|
//#endregion WATCHERS
|
|
170
441
|
/****************************************************************************/
|
|
171
442
|
//#region METHODS
|
|
172
443
|
handleInputChange(e, type) {
|
|
173
444
|
const inputElement = e.target;
|
|
174
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
|
+
}
|
|
175
451
|
// Update the time value based on the type
|
|
176
452
|
switch (type) {
|
|
177
453
|
case TimeType.Hours:
|
|
@@ -184,489 +460,230 @@ const NvFieldtime$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends
|
|
|
184
460
|
this.handleSecondsChange(inputValue, type);
|
|
185
461
|
break;
|
|
186
462
|
}
|
|
187
|
-
// Reconstruct time from inputs
|
|
188
|
-
const
|
|
189
|
-
|
|
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;
|
|
190
467
|
}
|
|
191
468
|
handleHoursChange(inputValue, type) {
|
|
192
|
-
var _a, _b
|
|
469
|
+
var _a, _b;
|
|
193
470
|
const isHHFormat = this.format.startsWith('HH');
|
|
194
471
|
const maxHours = isHHFormat ? 24 : 12;
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
472
|
+
// Handle empty input
|
|
473
|
+
if (inputValue.length === 0) {
|
|
474
|
+
this.hours = '00';
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
199
477
|
if (inputValue.length === 1) {
|
|
200
478
|
this.inputZeroAdded[type] = true;
|
|
201
479
|
const newInputValue = inputValue.padStart(2, '0');
|
|
202
|
-
|
|
203
|
-
if (minHour && parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
204
|
-
this.hours = minHour;
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
this.hours = '00';
|
|
208
|
-
reputedToZero = true;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
if (minHour && parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
213
|
-
this.hours = minHour;
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
this.hours = newInputValue;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
480
|
+
this.hours = newInputValue;
|
|
219
481
|
}
|
|
220
482
|
else if (this.inputZeroAdded[type]) {
|
|
221
483
|
this.inputZeroAdded[type] = false;
|
|
222
484
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
223
485
|
const parsedNewInputValue = parseInt(newInputValue, 10) || 0;
|
|
486
|
+
// Only apply format validation (not min/max constraints)
|
|
224
487
|
if (parsedNewInputValue >= maxHours) {
|
|
225
|
-
|
|
226
|
-
this.hours = minHour;
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
this.hours = '00';
|
|
230
|
-
reputedToZero = true;
|
|
231
|
-
}
|
|
488
|
+
this.hours = '00';
|
|
232
489
|
}
|
|
233
490
|
else {
|
|
234
|
-
|
|
235
|
-
if (minHour && parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
236
|
-
this.hours = minHour;
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
this.hours = '00';
|
|
240
|
-
reputedToZero = true;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
else {
|
|
244
|
-
if (minHour && parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
245
|
-
this.hours = minHour;
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
248
|
-
this.hours = newInputValue;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
491
|
+
this.hours = newInputValue;
|
|
251
492
|
}
|
|
252
493
|
}
|
|
253
494
|
else if (inputValue.length > 2) {
|
|
254
495
|
if (inputValue.startsWith('00')) {
|
|
255
496
|
this.inputZeroAdded[type] = true;
|
|
256
497
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
257
|
-
|
|
258
|
-
if (minHour && parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
259
|
-
this.hours = minHour;
|
|
260
|
-
}
|
|
261
|
-
else {
|
|
262
|
-
this.hours = '00';
|
|
263
|
-
reputedToZero = true;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
else {
|
|
267
|
-
if (minHour && parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
268
|
-
this.hours = minHour;
|
|
269
|
-
}
|
|
270
|
-
else {
|
|
271
|
-
this.hours = newInputValue;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
498
|
+
this.hours = newInputValue;
|
|
274
499
|
}
|
|
275
500
|
else {
|
|
276
501
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
277
502
|
const parsedNewInputValue = parseInt(newInputValue, 10) || 0;
|
|
503
|
+
// Only apply format validation (not min/max constraints)
|
|
278
504
|
if (parsedNewInputValue >= maxHours) {
|
|
279
|
-
|
|
280
|
-
this.hours = minHour;
|
|
281
|
-
reputedToZero = true;
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
this.hours = '00';
|
|
285
|
-
reputedToZero = true;
|
|
286
|
-
}
|
|
505
|
+
this.hours = '00';
|
|
287
506
|
}
|
|
288
507
|
else {
|
|
289
|
-
|
|
290
|
-
if (minHour &&
|
|
291
|
-
parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
292
|
-
this.hours = minHour;
|
|
293
|
-
}
|
|
294
|
-
else {
|
|
295
|
-
this.hours = '00';
|
|
296
|
-
reputedToZero = true;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
300
|
-
if (minHour && parsedNewInputValue < parseInt(minHour, 10)) {
|
|
301
|
-
this.hours = minHour;
|
|
302
|
-
}
|
|
303
|
-
else {
|
|
304
|
-
this.hours = parsedNewInputValue.toString();
|
|
305
|
-
}
|
|
306
|
-
}
|
|
508
|
+
this.hours = parsedNewInputValue.toString();
|
|
307
509
|
}
|
|
308
510
|
}
|
|
309
511
|
}
|
|
310
512
|
else {
|
|
311
|
-
const
|
|
312
|
-
|
|
513
|
+
const parsedNewInputValue = parseInt(inputValue, 10) || 0;
|
|
514
|
+
// Only apply format validation (not min/max constraints)
|
|
313
515
|
if (parsedNewInputValue >= maxHours) {
|
|
314
|
-
|
|
315
|
-
this.hours = minHour;
|
|
316
|
-
}
|
|
317
|
-
else {
|
|
318
|
-
this.hours = '00';
|
|
319
|
-
reputedToZero = true;
|
|
320
|
-
}
|
|
516
|
+
this.hours = '00';
|
|
321
517
|
}
|
|
322
518
|
else {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
reputedToZero = true;
|
|
326
|
-
}
|
|
327
|
-
else {
|
|
328
|
-
if (minHour && parsedNewInputValue < parseInt(minHour, 10)) {
|
|
329
|
-
this.hours = minHour;
|
|
330
|
-
}
|
|
331
|
-
else {
|
|
332
|
-
this.hours = parsedNewInputValue.toString();
|
|
333
|
-
}
|
|
334
|
-
}
|
|
519
|
+
// For direct input, remove unnecessary leading zeros (e.g., '01' becomes '1')
|
|
520
|
+
this.hours = parsedNewInputValue.toString();
|
|
335
521
|
}
|
|
336
522
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
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(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
|
+
}
|
|
346
533
|
}
|
|
347
534
|
}
|
|
348
535
|
handleMinutesChange(inputValue, type) {
|
|
349
|
-
var _a, _b
|
|
536
|
+
var _a, _b;
|
|
350
537
|
const maxMinutes = 60;
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
538
|
+
// Handle empty input
|
|
539
|
+
if (inputValue.length === 0) {
|
|
540
|
+
this.minutes = '00';
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
354
543
|
if (inputValue.length === 1) {
|
|
355
544
|
this.inputZeroAdded[type] = true;
|
|
356
545
|
const newInputValue = inputValue.padStart(2, '0');
|
|
357
|
-
|
|
358
|
-
if (minMinute && parseInt(newInputValue, 10) < minMinute) {
|
|
359
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
360
|
-
}
|
|
361
|
-
else {
|
|
362
|
-
this.minutes = '00';
|
|
363
|
-
reputedToZero = true;
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
else {
|
|
367
|
-
if (minMinute && parseInt(newInputValue, 10) < minMinute) {
|
|
368
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
369
|
-
}
|
|
370
|
-
else {
|
|
371
|
-
this.minutes = newInputValue;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
546
|
+
this.minutes = newInputValue;
|
|
374
547
|
}
|
|
375
548
|
else if (this.inputZeroAdded[type]) {
|
|
376
549
|
this.inputZeroAdded[type] = false;
|
|
377
550
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
378
551
|
const parsedNewInputValue = parseInt(newInputValue, 10) || 0;
|
|
552
|
+
// Only apply format validation (not min/max constraints)
|
|
379
553
|
if (parsedNewInputValue >= maxMinutes) {
|
|
380
|
-
|
|
381
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
382
|
-
}
|
|
383
|
-
else {
|
|
384
|
-
this.minutes = '00';
|
|
385
|
-
reputedToZero = true;
|
|
386
|
-
}
|
|
554
|
+
this.minutes = '00';
|
|
387
555
|
}
|
|
388
556
|
else {
|
|
389
|
-
|
|
390
|
-
if (minMinute && parseInt(newInputValue, 10) < minMinute) {
|
|
391
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
392
|
-
}
|
|
393
|
-
else {
|
|
394
|
-
this.minutes = '00';
|
|
395
|
-
reputedToZero = true;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
else {
|
|
399
|
-
if (minMinute && parsedNewInputValue < minMinute) {
|
|
400
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
401
|
-
}
|
|
402
|
-
else {
|
|
403
|
-
this.minutes = newInputValue;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
557
|
+
this.minutes = newInputValue;
|
|
406
558
|
}
|
|
407
559
|
}
|
|
408
560
|
else if (inputValue.length > 2) {
|
|
409
561
|
if (inputValue.startsWith('00')) {
|
|
410
562
|
this.inputZeroAdded[type] = true;
|
|
411
563
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
412
|
-
|
|
413
|
-
if (minMinute && parseInt(newInputValue, 10) < minMinute) {
|
|
414
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
415
|
-
}
|
|
416
|
-
else {
|
|
417
|
-
this.minutes = '00';
|
|
418
|
-
reputedToZero = true;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
else {
|
|
422
|
-
if (minMinute && parseInt(newInputValue, 10) < minMinute) {
|
|
423
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
424
|
-
}
|
|
425
|
-
else {
|
|
426
|
-
this.minutes = newInputValue;
|
|
427
|
-
}
|
|
428
|
-
}
|
|
564
|
+
this.minutes = newInputValue;
|
|
429
565
|
}
|
|
430
566
|
else {
|
|
431
567
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
432
568
|
const parsedNewInputValue = parseInt(newInputValue, 10) || 0;
|
|
569
|
+
// Only apply format validation (not min/max constraints)
|
|
433
570
|
if (parsedNewInputValue >= maxMinutes) {
|
|
434
|
-
|
|
435
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
436
|
-
}
|
|
437
|
-
else {
|
|
438
|
-
this.minutes = '00';
|
|
439
|
-
reputedToZero = true;
|
|
440
|
-
}
|
|
571
|
+
this.minutes = '00';
|
|
441
572
|
}
|
|
442
573
|
else {
|
|
443
|
-
|
|
444
|
-
if (minMinute && parseInt(newInputValue, 10) < minMinute) {
|
|
445
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
446
|
-
}
|
|
447
|
-
else {
|
|
448
|
-
this.minutes = '00';
|
|
449
|
-
reputedToZero = true;
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
else {
|
|
453
|
-
if (minMinute && parsedNewInputValue < minMinute) {
|
|
454
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
455
|
-
}
|
|
456
|
-
else {
|
|
457
|
-
this.minutes = parsedNewInputValue.toString();
|
|
458
|
-
}
|
|
459
|
-
}
|
|
574
|
+
this.minutes = parsedNewInputValue.toString();
|
|
460
575
|
}
|
|
461
576
|
}
|
|
462
577
|
}
|
|
463
578
|
else {
|
|
464
|
-
const
|
|
465
|
-
|
|
579
|
+
const parsedNewInputValue = parseInt(inputValue, 10) || 0;
|
|
580
|
+
// Only apply format validation (not min/max constraints)
|
|
466
581
|
if (parsedNewInputValue >= maxMinutes) {
|
|
467
|
-
|
|
468
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
469
|
-
}
|
|
470
|
-
else {
|
|
471
|
-
this.minutes = '00';
|
|
472
|
-
reputedToZero = true;
|
|
473
|
-
}
|
|
582
|
+
this.minutes = '00';
|
|
474
583
|
}
|
|
475
584
|
else {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
479
|
-
}
|
|
480
|
-
else {
|
|
481
|
-
this.minutes = '00';
|
|
482
|
-
reputedToZero = true;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
else {
|
|
486
|
-
if (minMinute && parsedNewInputValue < minMinute) {
|
|
487
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
488
|
-
}
|
|
489
|
-
else {
|
|
490
|
-
this.minutes = parsedNewInputValue.toString();
|
|
491
|
-
}
|
|
492
|
-
}
|
|
585
|
+
// For direct input, remove unnecessary leading zeros (e.g., '01' becomes '1')
|
|
586
|
+
this.minutes = parsedNewInputValue.toString();
|
|
493
587
|
}
|
|
494
588
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
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(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
|
+
}
|
|
504
599
|
}
|
|
505
600
|
}
|
|
506
601
|
handleSecondsChange(inputValue, type) {
|
|
507
|
-
var _a, _b, _c, _d;
|
|
508
602
|
const maxSeconds = 60;
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
603
|
+
// Handle empty input
|
|
604
|
+
if (inputValue.length === 0) {
|
|
605
|
+
this.seconds = '00';
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
512
608
|
if (inputValue.length === 1) {
|
|
513
609
|
this.inputZeroAdded[type] = true;
|
|
514
610
|
const newInputValue = inputValue.padStart(2, '0');
|
|
515
|
-
|
|
516
|
-
if (minSecond && parseInt(newInputValue, 10) < minSecond) {
|
|
517
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
518
|
-
}
|
|
519
|
-
else {
|
|
520
|
-
this.seconds = '00';
|
|
521
|
-
reputedToZero = true;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
else {
|
|
525
|
-
if (minSecond && parseInt(newInputValue, 10) < minSecond) {
|
|
526
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
527
|
-
}
|
|
528
|
-
else {
|
|
529
|
-
this.seconds = newInputValue;
|
|
530
|
-
}
|
|
531
|
-
}
|
|
611
|
+
this.seconds = newInputValue;
|
|
532
612
|
}
|
|
533
613
|
else if (this.inputZeroAdded[type]) {
|
|
534
614
|
this.inputZeroAdded[type] = false;
|
|
535
615
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
536
616
|
const parsedNewInputValue = parseInt(newInputValue, 10) || 0;
|
|
617
|
+
// Only apply format validation (not min/max constraints)
|
|
537
618
|
if (parsedNewInputValue >= maxSeconds) {
|
|
538
|
-
|
|
539
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
540
|
-
}
|
|
541
|
-
else {
|
|
542
|
-
this.seconds = '00';
|
|
543
|
-
reputedToZero = true;
|
|
544
|
-
}
|
|
619
|
+
this.seconds = '00';
|
|
545
620
|
}
|
|
546
621
|
else {
|
|
547
|
-
|
|
548
|
-
if (minSecond && parseInt(newInputValue, 10) < minSecond) {
|
|
549
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
550
|
-
}
|
|
551
|
-
else {
|
|
552
|
-
this.seconds = '00';
|
|
553
|
-
reputedToZero = true;
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
else {
|
|
557
|
-
if (minSecond && parsedNewInputValue < minSecond) {
|
|
558
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
559
|
-
}
|
|
560
|
-
else {
|
|
561
|
-
this.seconds = newInputValue;
|
|
562
|
-
}
|
|
563
|
-
}
|
|
622
|
+
this.seconds = newInputValue;
|
|
564
623
|
}
|
|
565
624
|
}
|
|
566
625
|
else if (inputValue.length > 2) {
|
|
567
626
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
568
627
|
const parsedNewInputValue = parseInt(newInputValue, 10) || 0;
|
|
628
|
+
// Only apply format validation (not min/max constraints)
|
|
569
629
|
if (parsedNewInputValue >= maxSeconds) {
|
|
570
|
-
|
|
571
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
572
|
-
}
|
|
573
|
-
else {
|
|
574
|
-
this.seconds = '00';
|
|
575
|
-
reputedToZero = true;
|
|
576
|
-
}
|
|
630
|
+
this.seconds = '00';
|
|
577
631
|
}
|
|
578
632
|
else {
|
|
579
|
-
|
|
580
|
-
if (minSecond && parseInt(newInputValue, 10) < minSecond) {
|
|
581
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
582
|
-
}
|
|
583
|
-
else {
|
|
584
|
-
this.seconds = '00';
|
|
585
|
-
reputedToZero = true;
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
else {
|
|
589
|
-
if (minSecond && parsedNewInputValue < minSecond) {
|
|
590
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
591
|
-
}
|
|
592
|
-
else {
|
|
593
|
-
this.seconds = parsedNewInputValue.toString();
|
|
594
|
-
}
|
|
595
|
-
}
|
|
633
|
+
this.seconds = parsedNewInputValue.toString();
|
|
596
634
|
}
|
|
597
635
|
}
|
|
598
636
|
else {
|
|
599
|
-
const
|
|
600
|
-
|
|
637
|
+
const parsedNewInputValue = parseInt(inputValue, 10) || 0;
|
|
638
|
+
// Only apply format validation (not min/max constraints)
|
|
601
639
|
if (parsedNewInputValue >= maxSeconds) {
|
|
602
|
-
|
|
603
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
604
|
-
}
|
|
605
|
-
else {
|
|
606
|
-
this.seconds = '00';
|
|
607
|
-
reputedToZero = true;
|
|
608
|
-
}
|
|
640
|
+
this.seconds = '00';
|
|
609
641
|
}
|
|
610
642
|
else {
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
614
|
-
}
|
|
615
|
-
else {
|
|
616
|
-
this.seconds = '00';
|
|
617
|
-
reputedToZero = true;
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
else {
|
|
621
|
-
if (minSecond && parsedNewInputValue < minSecond) {
|
|
622
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
623
|
-
}
|
|
624
|
-
else {
|
|
625
|
-
this.seconds = parsedNewInputValue.toString();
|
|
626
|
-
}
|
|
627
|
-
}
|
|
643
|
+
// For direct input, remove unnecessary leading zeros (e.g., '01' becomes '1')
|
|
644
|
+
this.seconds = parsedNewInputValue.toString();
|
|
628
645
|
}
|
|
629
646
|
}
|
|
630
|
-
|
|
631
|
-
(_c = this.inputElements[TimeType.Seconds]) === null || _c === void 0 ? void 0 : _c.focus();
|
|
632
|
-
(_d = this.inputElements[TimeType.Seconds]) === null || _d === void 0 ? void 0 : _d.select();
|
|
633
|
-
}
|
|
647
|
+
// No auto-navigation for seconds field as it's typically the last field
|
|
634
648
|
}
|
|
635
|
-
// Parse a
|
|
649
|
+
// Parse a time string according to the current format
|
|
636
650
|
parseTime(timeString) {
|
|
637
651
|
if (!timeString) {
|
|
638
652
|
return;
|
|
639
653
|
}
|
|
640
|
-
|
|
641
|
-
const
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
const minSecond = this.parseSecond(this.min) || second;
|
|
647
|
-
this.hours = minHour.padStart(2, '0');
|
|
648
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
649
|
-
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;
|
|
650
660
|
}
|
|
651
661
|
reconstructTime() {
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
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;
|
|
663
674
|
}
|
|
675
|
+
return reconstructedTime;
|
|
664
676
|
}
|
|
665
677
|
handleFocus(type) {
|
|
666
678
|
var _a, _b, _c, _d;
|
|
667
679
|
if (this.readonly || this.disabled) {
|
|
668
680
|
return;
|
|
669
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
|
+
}
|
|
670
687
|
if (!this.open) {
|
|
671
688
|
this.open = true; // Force the popover to open
|
|
672
689
|
}
|
|
@@ -679,33 +696,23 @@ const NvFieldtime$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends
|
|
|
679
696
|
this.typeFocused = type;
|
|
680
697
|
}
|
|
681
698
|
HandleDropdownIconClick() {
|
|
682
|
-
var _a, _b
|
|
699
|
+
var _a, _b;
|
|
683
700
|
if (this.disabled || this.readonly) {
|
|
684
701
|
return; // Do not toggle if disabled or read-only
|
|
685
702
|
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
else if (this.open && this.inputElements[TimeType.Minutes]) {
|
|
690
|
-
this.open = false; // Close the popover if it is open
|
|
691
|
-
}
|
|
692
|
-
else if (this.open && this.inputElements[TimeType.Seconds]) {
|
|
703
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
704
|
+
const firstVisibleType = visibleTypes[0];
|
|
705
|
+
if (this.open) {
|
|
693
706
|
this.open = false; // Close the popover if it is open
|
|
694
707
|
}
|
|
695
|
-
else if (!this.open &&
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
(_c = this.inputElements[TimeType.Minutes]) === null || _c === void 0 ? void 0 : _c.focus(); // Focus will open the popover
|
|
701
|
-
(_d = this.inputElements[TimeType.Minutes]) === null || _d === void 0 ? void 0 : _d.select();
|
|
702
|
-
}
|
|
703
|
-
else if (!this.open && this.inputElements[TimeType.Seconds]) {
|
|
704
|
-
(_e = this.inputElements[TimeType.Seconds]) === null || _e === void 0 ? void 0 : _e.focus(); // Focus will open the popover
|
|
705
|
-
(_f = this.inputElements[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();
|
|
706
713
|
}
|
|
707
714
|
else {
|
|
708
|
-
console.warn('nv-fieldtime -> No input elements found to focus
|
|
715
|
+
console.warn('nv-fieldtime -> No visible input elements found to focus');
|
|
709
716
|
}
|
|
710
717
|
}
|
|
711
718
|
updateHighlightedItem(items, index) {
|
|
@@ -724,6 +731,8 @@ const NvFieldtime$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends
|
|
|
724
731
|
}
|
|
725
732
|
handleTimeOptionClick(event, type) {
|
|
726
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
|
|
727
736
|
if (type === TimeType.Hours) {
|
|
728
737
|
this.hours = option.toString().padStart(2, '0');
|
|
729
738
|
}
|
|
@@ -733,8 +742,9 @@ const NvFieldtime$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends
|
|
|
733
742
|
else if (type === TimeType.Seconds) {
|
|
734
743
|
this.seconds = option.toString().padStart(2, '0');
|
|
735
744
|
}
|
|
736
|
-
|
|
737
|
-
|
|
745
|
+
// Reconstruct time in the correct format and update value
|
|
746
|
+
const reconstructedTime = this.reconstructTime();
|
|
747
|
+
this.value = reconstructedTime;
|
|
738
748
|
}
|
|
739
749
|
handleInputBlur() {
|
|
740
750
|
// Use a delay to check if the focus is still within the popover
|
|
@@ -793,17 +803,29 @@ const NvFieldtime$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends
|
|
|
793
803
|
}
|
|
794
804
|
generateHourOptions(stepInSeconds) {
|
|
795
805
|
const hourStep = Math.max(1, Math.floor(stepInSeconds / 3600)); // Prevent step < 1
|
|
796
|
-
const
|
|
797
|
-
|
|
798
|
-
const
|
|
799
|
-
const
|
|
800
|
-
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;
|
|
801
814
|
const values = [];
|
|
802
|
-
for (let i = minHourValue; i
|
|
803
|
-
|
|
815
|
+
for (let i = minHourValue; i <= maxHourValue; i += hourStep) {
|
|
816
|
+
const hourStr = i.toString().padStart(2, '0');
|
|
817
|
+
values.push(hourStr);
|
|
804
818
|
}
|
|
805
819
|
return values;
|
|
806
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
|
+
*/
|
|
807
829
|
parseHour(value, format) {
|
|
808
830
|
if (!value)
|
|
809
831
|
return null;
|
|
@@ -821,13 +843,21 @@ const NvFieldtime$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends
|
|
|
821
843
|
const minMinute = (_a = this.parseMinute(this.min)) !== null && _a !== void 0 ? _a : 0;
|
|
822
844
|
const maxMinute = (_b = this.parseMinute(this.max)) !== null && _b !== void 0 ? _b : 59;
|
|
823
845
|
if (minMinute === 0 && maxMinute === 0)
|
|
824
|
-
return ['00']; // Handle edge case for zero
|
|
846
|
+
return ['00']; // Handle edge case for zero minutes
|
|
825
847
|
const values = [];
|
|
826
848
|
for (let i = minMinute; i <= maxMinute; i += minuteStep) {
|
|
827
|
-
|
|
849
|
+
const minuteStr = i.toString().padStart(2, '0');
|
|
850
|
+
values.push(minuteStr);
|
|
828
851
|
}
|
|
829
852
|
return values;
|
|
830
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
|
+
*/
|
|
831
861
|
parseMinute(value) {
|
|
832
862
|
if (!value)
|
|
833
863
|
return null;
|
|
@@ -846,10 +876,18 @@ const NvFieldtime$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends
|
|
|
846
876
|
return ['00']; // Handle edge case for zero seconds
|
|
847
877
|
const values = [];
|
|
848
878
|
for (let i = minSecond; i <= maxSecond; i += secondStep) {
|
|
849
|
-
|
|
879
|
+
const secondStr = i.toString().padStart(2, '0');
|
|
880
|
+
values.push(secondStr);
|
|
850
881
|
}
|
|
851
882
|
return values;
|
|
852
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
|
+
*/
|
|
853
891
|
parseSecond(value) {
|
|
854
892
|
if (!value)
|
|
855
893
|
return null;
|
|
@@ -866,10 +904,6 @@ const NvFieldtime$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends
|
|
|
866
904
|
const repetitions = Math.ceil(300 / totalOptions);
|
|
867
905
|
return Array(repetitions).fill(options).flat();
|
|
868
906
|
}
|
|
869
|
-
getCurrentTime() {
|
|
870
|
-
const currentTime = new Date();
|
|
871
|
-
return currentTime.toLocaleTimeString(); // Returns the time in the locale's format
|
|
872
|
-
}
|
|
873
907
|
updateColumnHighlight(selector, value) {
|
|
874
908
|
const items = Array.from(this.el.querySelectorAll(selector));
|
|
875
909
|
const index = items.findIndex(x => x.textContent === value);
|
|
@@ -887,8 +921,13 @@ const NvFieldtime$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends
|
|
|
887
921
|
}
|
|
888
922
|
if (!this.open) {
|
|
889
923
|
if (this.inputElements) {
|
|
890
|
-
|
|
891
|
-
|
|
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
|
+
}
|
|
892
931
|
}
|
|
893
932
|
event.preventDefault();
|
|
894
933
|
}
|
|
@@ -898,17 +937,23 @@ const NvFieldtime$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends
|
|
|
898
937
|
//#region LIFECYCLE
|
|
899
938
|
componentWillLoad() {
|
|
900
939
|
document.addEventListener('click', this.handleClickOutside.bind(this));
|
|
901
|
-
//
|
|
940
|
+
// Initialize component state based on format and value
|
|
902
941
|
if (this.value) {
|
|
942
|
+
// Parse the provided value using format-aware parsing without constraint application
|
|
903
943
|
this.parseTime(this.value);
|
|
904
944
|
}
|
|
905
945
|
else {
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
const
|
|
909
|
-
|
|
910
|
-
this.
|
|
911
|
-
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;
|
|
912
957
|
}
|
|
913
958
|
}
|
|
914
959
|
connectedCallback() {
|
|
@@ -918,63 +963,94 @@ const NvFieldtime$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends
|
|
|
918
963
|
document.removeEventListener('click', this.handleClickOutside.bind(this));
|
|
919
964
|
}
|
|
920
965
|
componentDidLoad() {
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
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);
|
|
977
|
+
}
|
|
978
|
+
//#endregion LIFECYCLE
|
|
979
|
+
/****************************************************************************/
|
|
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) => {
|
|
990
|
+
// Add separator colon before minutes and seconds (but not before the first field)
|
|
991
|
+
if (index > 0) {
|
|
992
|
+
elements.push(h("span", null, ":"));
|
|
933
993
|
}
|
|
934
|
-
//
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
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 TimeType.Hours:
|
|
1008
|
+
return this.hours;
|
|
1009
|
+
case TimeType.Minutes:
|
|
1010
|
+
return this.minutes;
|
|
1011
|
+
case TimeType.Seconds:
|
|
1012
|
+
return this.seconds;
|
|
1013
|
+
default:
|
|
1014
|
+
return '00';
|
|
944
1015
|
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
1016
|
+
};
|
|
1017
|
+
const getPlaceholder = () => {
|
|
1018
|
+
switch (type) {
|
|
1019
|
+
case TimeType.Hours:
|
|
1020
|
+
return this.format.includes('hh') ? 'hh' : 'HH';
|
|
1021
|
+
case TimeType.Minutes:
|
|
1022
|
+
return 'mm';
|
|
1023
|
+
case TimeType.Seconds:
|
|
1024
|
+
return 'ss';
|
|
1025
|
+
default:
|
|
1026
|
+
return '';
|
|
956
1027
|
}
|
|
957
|
-
|
|
958
|
-
|
|
1028
|
+
};
|
|
1029
|
+
const getId = () => {
|
|
1030
|
+
switch (type) {
|
|
1031
|
+
case TimeType.Hours:
|
|
1032
|
+
return this.inputId;
|
|
1033
|
+
case TimeType.Minutes:
|
|
1034
|
+
return `${this.inputId}-minutes`;
|
|
1035
|
+
case TimeType.Seconds:
|
|
1036
|
+
return `${this.inputId}-seconds`;
|
|
1037
|
+
default:
|
|
1038
|
+
return this.inputId;
|
|
959
1039
|
}
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
}
|
|
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 (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));
|
|
974
1053
|
}
|
|
975
|
-
//#endregion LIFECYCLE
|
|
976
|
-
/****************************************************************************/
|
|
977
|
-
//#region RENDER
|
|
978
1054
|
RenderTimeOptionsColumn(type) {
|
|
979
1055
|
return (h("div", { class: `time-column time-column-${type}`, onScroll: e => this.handleScroll(e, type) }, this.generateInfiniteTimeOptions(type).map((option, index) => (h("div", { class: {
|
|
980
1056
|
'time-option': true,
|
|
@@ -984,32 +1060,16 @@ const NvFieldtime$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends
|
|
|
984
1060
|
}, key: `${option}-${index}`, onClick: e => this.handleTimeOptionClick(e, type) }, option)))));
|
|
985
1061
|
}
|
|
986
1062
|
render() {
|
|
987
|
-
return (h(Host, { key: '
|
|
988
|
-
h("
|
|
989
|
-
|
|
990
|
-
: TimeType.Hours, id: this.inputId, readonly: this.readonly, disabled: this.disabled, required: this.required, onKeyDown: e => this.handleKeyDown(e), onBlur: () => this.handleInputBlur() }),
|
|
991
|
-
], this.format.includes('mm') && [
|
|
992
|
-
h("span", { key: '74f9604ffd54e0c0bbd88996e32fdcb08f2c3645' }, ":"),
|
|
993
|
-
h("input", { key: '52f9b637bba804cac6fadff06e8b077bb2f5748a', ref: el => (this.inputElements[TimeType.Minutes] = el), type: "number", autofocus: this.autofocus, class: "time-input", pattern: "[0-9]*", maxlength: "3", value: this.minutes, onInput: e => this.handleInputChange(e, TimeType.Minutes), placeholder: "mm", inputMode: "numeric", onFocus: () => this.handleFocus(TimeType.Minutes), name: this.name
|
|
994
|
-
? `${TimeType.Minutes}-${this.name}`
|
|
995
|
-
: TimeType.Minutes, id: `${this.inputId}-minutes`, readonly: this.readonly, disabled: this.disabled, required: this.required, onKeyDown: e => this.handleKeyDown(e), onBlur: () => this.handleInputBlur() }),
|
|
996
|
-
], this.format.includes('ss') && [
|
|
997
|
-
h("span", { key: '878bc9ce7557e9cf9471803a86956a9184d0ccb5' }, ":"),
|
|
998
|
-
h("input", { key: 'b074d4d3ef80f66e7dbe051b6bc53f151661f409', ref: el => (this.inputElements[TimeType.Seconds] = el), type: "number", autofocus: this.autofocus, class: "time-input", pattern: "[0-9]*", maxlength: "3", value: this.seconds, onInput: e => this.handleInputChange(e, TimeType.Seconds), placeholder: "ss", inputMode: "numeric", onFocus: () => this.handleFocus(TimeType.Seconds), name: this.name
|
|
999
|
-
? `${TimeType.Seconds}-${this.name}`
|
|
1000
|
-
: TimeType.Seconds, id: `${this.inputId}-seconds`, readonly: this.readonly, disabled: this.disabled, required: this.required, onKeyDown: e => this.handleKeyDown(e), onBlur: () => this.handleInputBlur() }),
|
|
1001
|
-
], h("nv-iconbutton", { key: '3f5d78116ee60d1874a4629d9cf36a06d52b7df4', name: 'clock', size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide time picker' : 'Show time picker', onClick: () => this.HandleDropdownIconClick() }), this.error && (h("nv-icon", { key: '4b2356cf95131af213a4e98feede16fc8c4963db', name: "alert-circle", class: "validation", size: "sm" })), this.success && (h("nv-icon", { key: 'f9b0e61037049a36ac900d1af9ecc71b211ebd88', name: "circle-check", class: "validation", size: "sm" }))), h("slot", { key: '6177abde559c57f2b0586368ead1a61d7b543838', name: "after-input" })), h("div", { key: 'f6d5205a5011411550179f9337143163cb547fb1', class: "time-dropdown", slot: "content" }, h("div", { key: '9f0b3e1423bef197b269c5b11ce744cabc2bd6c4', class: "time-columns" }, startsWithIgnoreCase(this.format, 'HH') &&
|
|
1002
|
-
this.RenderTimeOptionsColumn(TimeType.Hours), this.format.includes('mm') &&
|
|
1003
|
-
this.RenderTimeOptionsColumn(TimeType.Minutes), this.format.includes('ss') &&
|
|
1004
|
-
this.RenderTimeOptionsColumn(TimeType.Seconds)))), (this.description ||
|
|
1005
|
-
this.el.querySelector('[slot="description"]')) && (h("div", { key: '1076ded73b32ff9afbd0f02184febcc82f8d839e', class: "description" }, h("slot", { key: '479d09b299d0e380533a6cd689ce7f03aa92ea8e', name: "description" }, this.description))), (this.errorDescription ||
|
|
1006
|
-
this.el.querySelector('[slot="error-description"]')) && (h("div", { key: '5615246dbd797c300be357be37d3b9d0aee56e31', hidden: !this.error, class: "error-description" }, h("slot", { key: '6568ea3f9e0bdf85dd280c645956f8e0bb592e35', name: "error-description" }, this.errorDescription)))));
|
|
1063
|
+
return (h(Host, { key: '315b0a732c1ef8bee7aaa0141ce533ec265e35ab', onclick: (e) => this.handleHostClick(e), "aria-expanded": this.open ? 'true' : 'false' }, (this.label || this.el.querySelector('[slot="label"]')) && (h("label", { key: '100b75accd50c277e3ddd13c007e55dad8c6f8b7', htmlFor: this.inputId }, h("slot", { key: 'cec67688f98fc7976299a2f55ba8ba859e4ecacc', name: "label" }, this.label))), h("nv-popover", { key: 'feaaefb107251368db809babb02b8f8c7cb7baf0', ref: el => (this.popoverElement = el), triggerMode: "controlled", placement: "bottom-start", open: this.open }, h("div", { key: 'c539917597eebdd92bb2e832d1fd9d6afceb5c04', class: "input-wrapper", slot: "trigger" }, h("slot", { key: '5a869349e9fd7a422d596f5bd05402d5559a6f2b', name: "before-input" }), h("div", { key: '27dac6987b28d08bb54b9ffc70ddade28f527a9c', class: "input-container" }, h("slot", { key: '9df638bb3d58df138a360966925b04092f1d4b9a', name: "leading-input" }), this.renderTimeInputFields(), h("nv-iconbutton", { key: '8d6796d9fc57ef2a934bfe79621ff76def8e9507', name: 'clock', size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide time picker' : 'Show time picker', onClick: () => this.HandleDropdownIconClick() }), this.error && (h("nv-icon", { key: '15b593ce4e850d18a5f5f93120ae84e84054cffe', name: "alert-circle", class: "validation", size: "sm" })), this.success && (h("nv-icon", { key: '85e4a38c3ef64552fc7a47448471d4276ee5cc46', name: "circle-check", class: "validation", size: "sm" }))), h("slot", { key: '45cc1c26bc40425df62382a371ab658dd18aefa8', name: "after-input" })), h("div", { key: '23432dd354491420e42400d9eeb22bc23e36623e', class: "time-dropdown", slot: "content" }, h("div", { key: 'efb53556077c85ee94a8fe345a03d67a3e36cdc1', class: "time-columns" }, this.renderTimeDropdownColumns()))), (this.description ||
|
|
1064
|
+
this.el.querySelector('[slot="description"]')) && (h("div", { key: '735447b328a8264739d3185ce6c65d48a01ec801', class: "description" }, h("slot", { key: '86387e48804b2ac1842c64b4cf4f5ca9f34a6719', name: "description" }, this.description))), (this.errorDescription ||
|
|
1065
|
+
this.el.querySelector('[slot="error-description"]')) && (h("div", { key: 'b6cc406c6a872b5ebb83a35a84852e143781e12f', hidden: !this.error, class: "error-description" }, h("slot", { key: 'c9dc284e202b081a61346796d21e73c8647c7daa', name: "error-description" }, this.errorDescription)))));
|
|
1007
1066
|
}
|
|
1008
1067
|
static get formAssociated() { return true; }
|
|
1009
1068
|
get el() { return this; }
|
|
1010
1069
|
static get watchers() { return {
|
|
1011
1070
|
"value": ["handleValueChange"],
|
|
1012
|
-
"open": ["handleOpenChange"]
|
|
1071
|
+
"open": ["handleOpenChange"],
|
|
1072
|
+
"format": ["handleFormatChange"]
|
|
1013
1073
|
}; }
|
|
1014
1074
|
static get style() { return NvFieldtimeStyle0; }
|
|
1015
1075
|
}, [68, "nv-fieldtime", {
|
|
@@ -1035,7 +1095,8 @@ const NvFieldtime$1 = /*@__PURE__*/ proxyCustomElement(class NvFieldtime extends
|
|
|
1035
1095
|
"seconds": [32]
|
|
1036
1096
|
}, [[0, "openChanged", "handleOpenChanged"], [0, "keydown", "handleKeyDown"]], {
|
|
1037
1097
|
"value": ["handleValueChange"],
|
|
1038
|
-
"open": ["handleOpenChange"]
|
|
1098
|
+
"open": ["handleOpenChange"],
|
|
1099
|
+
"format": ["handleFormatChange"]
|
|
1039
1100
|
}]);
|
|
1040
1101
|
function defineCustomElement$1() {
|
|
1041
1102
|
if (typeof customElements === "undefined") {
|