@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,9 +1,12 @@
|
|
|
1
1
|
/* eslint-disable react/jsx-no-bind */
|
|
2
|
-
import { Host, h, } from "@stencil/core";
|
|
2
|
+
import { Host, h, forceUpdate, } from "@stencil/core";
|
|
3
3
|
import { v4 as uuidv4 } from "uuid";
|
|
4
|
-
import { startsWithIgnoreCase } from "../../utils/string.utils";
|
|
5
4
|
import { TimeType } from "../../utils/constants";
|
|
5
|
+
import { parseValueByFormat, reconstructTimeByFormat, isValidFormatValue, FORMAT_CONFIGS, getVisibleTimeTypes, } from "./utils/format-utils";
|
|
6
6
|
/**
|
|
7
|
+
* A format-aware time input component that displays only relevant input fields based on the specified format.
|
|
8
|
+
* The component ensures consistency between the format property and both input validation and value emission.
|
|
9
|
+
*
|
|
7
10
|
* @slot label - Content to be placed as the label, will override the label prop.
|
|
8
11
|
* @slot before-input - Content to be placed before the input text, outside the input container.
|
|
9
12
|
* @slot after-input - Content to be placed after the input text, outside the input container.
|
|
@@ -66,6 +69,10 @@ export class NvFieldtime {
|
|
|
66
69
|
* - hh: 12-hour format (01-12)
|
|
67
70
|
* - hh:mm: 12-hour format with minutes (01:00-12:59)
|
|
68
71
|
* - hh:mm:ss: 12-hour format with minutes and seconds (01:00:00-12:59:59)
|
|
72
|
+
*
|
|
73
|
+
* The component automatically shows only the relevant input fields based on the selected format.
|
|
74
|
+
* When the format changes dynamically, the component re-parses the current value and updates
|
|
75
|
+
* the visible fields accordingly.
|
|
69
76
|
*/
|
|
70
77
|
this.format = 'HH:mm:ss';
|
|
71
78
|
/**
|
|
@@ -94,7 +101,7 @@ export class NvFieldtime {
|
|
|
94
101
|
this.open = event.detail;
|
|
95
102
|
}
|
|
96
103
|
handleKeyDown(event) {
|
|
97
|
-
var _a, _b
|
|
104
|
+
var _a, _b;
|
|
98
105
|
if (!this.open) {
|
|
99
106
|
if (event.key === 'ArrowDown') {
|
|
100
107
|
this.open = true;
|
|
@@ -129,20 +136,22 @@ export class NvFieldtime {
|
|
|
129
136
|
else if (event.key === 'Enter' && currentIndex >= 0) {
|
|
130
137
|
event.preventDefault();
|
|
131
138
|
items[currentIndex].click();
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
(
|
|
139
|
-
(
|
|
139
|
+
// Navigate to the next visible field
|
|
140
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
141
|
+
const currentTypeIndex = visibleTypes.indexOf(this.typeFocused);
|
|
142
|
+
const nextTypeIndex = currentTypeIndex + 1;
|
|
143
|
+
if (nextTypeIndex < visibleTypes.length) {
|
|
144
|
+
const nextType = visibleTypes[nextTypeIndex];
|
|
145
|
+
(_a = this.inputElements[nextType]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
146
|
+
(_b = this.inputElements[nextType]) === null || _b === void 0 ? void 0 : _b.select();
|
|
140
147
|
}
|
|
141
148
|
}
|
|
142
149
|
else if (event.key === 'Escape') {
|
|
143
150
|
event.preventDefault();
|
|
144
|
-
|
|
145
|
-
|
|
151
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
152
|
+
const firstVisibleType = visibleTypes[0];
|
|
153
|
+
if (firstVisibleType && this.inputElements[firstVisibleType]) {
|
|
154
|
+
this.inputElements[firstVisibleType].blur();
|
|
146
155
|
}
|
|
147
156
|
}
|
|
148
157
|
}
|
|
@@ -150,6 +159,18 @@ export class NvFieldtime {
|
|
|
150
159
|
/****************************************************************************/
|
|
151
160
|
//#region WATCHERS
|
|
152
161
|
handleValueChange(newValue) {
|
|
162
|
+
// Parse the new value and ensure it's in the correct format
|
|
163
|
+
if (newValue) {
|
|
164
|
+
const components = parseValueByFormat(newValue, this.format);
|
|
165
|
+
const formattedValue = reconstructTimeByFormat(components, this.format);
|
|
166
|
+
// Only emit if the formatted value is different from what we received
|
|
167
|
+
// This prevents infinite loops while ensuring format consistency
|
|
168
|
+
if (formattedValue !== newValue) {
|
|
169
|
+
this.value = formattedValue;
|
|
170
|
+
return; // The watcher will be called again with the formatted value
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
// Emit the value in the correct format
|
|
153
174
|
this.valueChanged.emit(newValue);
|
|
154
175
|
}
|
|
155
176
|
handleOpenChange(newOpen) {
|
|
@@ -164,12 +185,36 @@ export class NvFieldtime {
|
|
|
164
185
|
this.updateColumnHighlight(secondsSelector, this.seconds);
|
|
165
186
|
}
|
|
166
187
|
}
|
|
188
|
+
handleFormatChange(newFormat, oldFormat) {
|
|
189
|
+
if (newFormat === oldFormat) {
|
|
190
|
+
return; // No change, nothing to do
|
|
191
|
+
}
|
|
192
|
+
// Re-parse the current value with the new format
|
|
193
|
+
const currentValue = this.value || this.reconstructTime();
|
|
194
|
+
// Parse the current value using the old format to get the time components
|
|
195
|
+
const components = parseValueByFormat(currentValue, oldFormat || 'HH:mm:ss');
|
|
196
|
+
// Update the component state with the parsed components
|
|
197
|
+
this.hours = components.hours;
|
|
198
|
+
this.minutes = components.minutes;
|
|
199
|
+
this.seconds = components.seconds;
|
|
200
|
+
// Reconstruct the time value in the new format
|
|
201
|
+
const newValue = reconstructTimeByFormat(components, newFormat);
|
|
202
|
+
// Update the value, which will trigger the value watcher and emit the event
|
|
203
|
+
this.value = newValue;
|
|
204
|
+
// Force a re-render to update the visible input fields
|
|
205
|
+
forceUpdate(this.el);
|
|
206
|
+
}
|
|
167
207
|
//#endregion WATCHERS
|
|
168
208
|
/****************************************************************************/
|
|
169
209
|
//#region METHODS
|
|
170
210
|
handleInputChange(e, type) {
|
|
171
211
|
const inputElement = e.target;
|
|
172
212
|
const inputValue = inputElement.value.replace(/[^0-9]/g, ''); // Only keep numeric input
|
|
213
|
+
// Check if this field is visible for the current format
|
|
214
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
215
|
+
if (!visibleTypes.includes(type)) {
|
|
216
|
+
return; // Don't process input for non-visible fields
|
|
217
|
+
}
|
|
173
218
|
// Update the time value based on the type
|
|
174
219
|
switch (type) {
|
|
175
220
|
case TimeType.Hours:
|
|
@@ -182,489 +227,230 @@ export class NvFieldtime {
|
|
|
182
227
|
this.handleSecondsChange(inputValue, type);
|
|
183
228
|
break;
|
|
184
229
|
}
|
|
185
|
-
// Reconstruct time from inputs
|
|
186
|
-
const
|
|
187
|
-
|
|
230
|
+
// Reconstruct time from inputs in the correct format
|
|
231
|
+
const reconstructedValue = this.reconstructTime();
|
|
232
|
+
// Update the value, which will trigger the watcher and emit the event
|
|
233
|
+
this.value = reconstructedValue;
|
|
188
234
|
}
|
|
189
235
|
handleHoursChange(inputValue, type) {
|
|
190
|
-
var _a, _b
|
|
236
|
+
var _a, _b;
|
|
191
237
|
const isHHFormat = this.format.startsWith('HH');
|
|
192
238
|
const maxHours = isHHFormat ? 24 : 12;
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
239
|
+
// Handle empty input
|
|
240
|
+
if (inputValue.length === 0) {
|
|
241
|
+
this.hours = '00';
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
197
244
|
if (inputValue.length === 1) {
|
|
198
245
|
this.inputZeroAdded[type] = true;
|
|
199
246
|
const newInputValue = inputValue.padStart(2, '0');
|
|
200
|
-
|
|
201
|
-
if (minHour && parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
202
|
-
this.hours = minHour;
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
this.hours = '00';
|
|
206
|
-
reputedToZero = true;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
if (minHour && parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
211
|
-
this.hours = minHour;
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
this.hours = newInputValue;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
247
|
+
this.hours = newInputValue;
|
|
217
248
|
}
|
|
218
249
|
else if (this.inputZeroAdded[type]) {
|
|
219
250
|
this.inputZeroAdded[type] = false;
|
|
220
251
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
221
252
|
const parsedNewInputValue = parseInt(newInputValue, 10) || 0;
|
|
253
|
+
// Only apply format validation (not min/max constraints)
|
|
222
254
|
if (parsedNewInputValue >= maxHours) {
|
|
223
|
-
|
|
224
|
-
this.hours = minHour;
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
this.hours = '00';
|
|
228
|
-
reputedToZero = true;
|
|
229
|
-
}
|
|
255
|
+
this.hours = '00';
|
|
230
256
|
}
|
|
231
257
|
else {
|
|
232
|
-
|
|
233
|
-
if (minHour && parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
234
|
-
this.hours = minHour;
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
this.hours = '00';
|
|
238
|
-
reputedToZero = true;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
if (minHour && parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
243
|
-
this.hours = minHour;
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
this.hours = newInputValue;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
258
|
+
this.hours = newInputValue;
|
|
249
259
|
}
|
|
250
260
|
}
|
|
251
261
|
else if (inputValue.length > 2) {
|
|
252
262
|
if (inputValue.startsWith('00')) {
|
|
253
263
|
this.inputZeroAdded[type] = true;
|
|
254
264
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
255
|
-
|
|
256
|
-
if (minHour && parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
257
|
-
this.hours = minHour;
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
this.hours = '00';
|
|
261
|
-
reputedToZero = true;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
else {
|
|
265
|
-
if (minHour && parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
266
|
-
this.hours = minHour;
|
|
267
|
-
}
|
|
268
|
-
else {
|
|
269
|
-
this.hours = newInputValue;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
265
|
+
this.hours = newInputValue;
|
|
272
266
|
}
|
|
273
267
|
else {
|
|
274
268
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
275
269
|
const parsedNewInputValue = parseInt(newInputValue, 10) || 0;
|
|
270
|
+
// Only apply format validation (not min/max constraints)
|
|
276
271
|
if (parsedNewInputValue >= maxHours) {
|
|
277
|
-
|
|
278
|
-
this.hours = minHour;
|
|
279
|
-
reputedToZero = true;
|
|
280
|
-
}
|
|
281
|
-
else {
|
|
282
|
-
this.hours = '00';
|
|
283
|
-
reputedToZero = true;
|
|
284
|
-
}
|
|
272
|
+
this.hours = '00';
|
|
285
273
|
}
|
|
286
274
|
else {
|
|
287
|
-
|
|
288
|
-
if (minHour &&
|
|
289
|
-
parseInt(newInputValue, 10) < parseInt(minHour, 10)) {
|
|
290
|
-
this.hours = minHour;
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
this.hours = '00';
|
|
294
|
-
reputedToZero = true;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
else {
|
|
298
|
-
if (minHour && parsedNewInputValue < parseInt(minHour, 10)) {
|
|
299
|
-
this.hours = minHour;
|
|
300
|
-
}
|
|
301
|
-
else {
|
|
302
|
-
this.hours = parsedNewInputValue.toString();
|
|
303
|
-
}
|
|
304
|
-
}
|
|
275
|
+
this.hours = parsedNewInputValue.toString();
|
|
305
276
|
}
|
|
306
277
|
}
|
|
307
278
|
}
|
|
308
279
|
else {
|
|
309
|
-
const
|
|
310
|
-
|
|
280
|
+
const parsedNewInputValue = parseInt(inputValue, 10) || 0;
|
|
281
|
+
// Only apply format validation (not min/max constraints)
|
|
311
282
|
if (parsedNewInputValue >= maxHours) {
|
|
312
|
-
|
|
313
|
-
this.hours = minHour;
|
|
314
|
-
}
|
|
315
|
-
else {
|
|
316
|
-
this.hours = '00';
|
|
317
|
-
reputedToZero = true;
|
|
318
|
-
}
|
|
283
|
+
this.hours = '00';
|
|
319
284
|
}
|
|
320
285
|
else {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
reputedToZero = true;
|
|
324
|
-
}
|
|
325
|
-
else {
|
|
326
|
-
if (minHour && parsedNewInputValue < parseInt(minHour, 10)) {
|
|
327
|
-
this.hours = minHour;
|
|
328
|
-
}
|
|
329
|
-
else {
|
|
330
|
-
this.hours = parsedNewInputValue.toString();
|
|
331
|
-
}
|
|
332
|
-
}
|
|
286
|
+
// For direct input, remove unnecessary leading zeros (e.g., '01' becomes '1')
|
|
287
|
+
this.hours = parsedNewInputValue.toString();
|
|
333
288
|
}
|
|
334
289
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
290
|
+
// Auto-navigation to next field when input is complete
|
|
291
|
+
if (this.hours.length >= 1 && !this.inputZeroAdded[type]) {
|
|
292
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
293
|
+
const currentTypeIndex = visibleTypes.indexOf(TimeType.Hours);
|
|
294
|
+
const nextTypeIndex = currentTypeIndex + 1;
|
|
295
|
+
if (nextTypeIndex < visibleTypes.length) {
|
|
296
|
+
const nextType = visibleTypes[nextTypeIndex];
|
|
297
|
+
(_a = this.inputElements[nextType]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
298
|
+
(_b = this.inputElements[nextType]) === null || _b === void 0 ? void 0 : _b.select();
|
|
299
|
+
}
|
|
344
300
|
}
|
|
345
301
|
}
|
|
346
302
|
handleMinutesChange(inputValue, type) {
|
|
347
|
-
var _a, _b
|
|
303
|
+
var _a, _b;
|
|
348
304
|
const maxMinutes = 60;
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
305
|
+
// Handle empty input
|
|
306
|
+
if (inputValue.length === 0) {
|
|
307
|
+
this.minutes = '00';
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
352
310
|
if (inputValue.length === 1) {
|
|
353
311
|
this.inputZeroAdded[type] = true;
|
|
354
312
|
const newInputValue = inputValue.padStart(2, '0');
|
|
355
|
-
|
|
356
|
-
if (minMinute && parseInt(newInputValue, 10) < minMinute) {
|
|
357
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
358
|
-
}
|
|
359
|
-
else {
|
|
360
|
-
this.minutes = '00';
|
|
361
|
-
reputedToZero = true;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
else {
|
|
365
|
-
if (minMinute && parseInt(newInputValue, 10) < minMinute) {
|
|
366
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
367
|
-
}
|
|
368
|
-
else {
|
|
369
|
-
this.minutes = newInputValue;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
313
|
+
this.minutes = newInputValue;
|
|
372
314
|
}
|
|
373
315
|
else if (this.inputZeroAdded[type]) {
|
|
374
316
|
this.inputZeroAdded[type] = false;
|
|
375
317
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
376
318
|
const parsedNewInputValue = parseInt(newInputValue, 10) || 0;
|
|
319
|
+
// Only apply format validation (not min/max constraints)
|
|
377
320
|
if (parsedNewInputValue >= maxMinutes) {
|
|
378
|
-
|
|
379
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
380
|
-
}
|
|
381
|
-
else {
|
|
382
|
-
this.minutes = '00';
|
|
383
|
-
reputedToZero = true;
|
|
384
|
-
}
|
|
321
|
+
this.minutes = '00';
|
|
385
322
|
}
|
|
386
323
|
else {
|
|
387
|
-
|
|
388
|
-
if (minMinute && parseInt(newInputValue, 10) < minMinute) {
|
|
389
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
390
|
-
}
|
|
391
|
-
else {
|
|
392
|
-
this.minutes = '00';
|
|
393
|
-
reputedToZero = true;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
else {
|
|
397
|
-
if (minMinute && parsedNewInputValue < minMinute) {
|
|
398
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
399
|
-
}
|
|
400
|
-
else {
|
|
401
|
-
this.minutes = newInputValue;
|
|
402
|
-
}
|
|
403
|
-
}
|
|
324
|
+
this.minutes = newInputValue;
|
|
404
325
|
}
|
|
405
326
|
}
|
|
406
327
|
else if (inputValue.length > 2) {
|
|
407
328
|
if (inputValue.startsWith('00')) {
|
|
408
329
|
this.inputZeroAdded[type] = true;
|
|
409
330
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
410
|
-
|
|
411
|
-
if (minMinute && parseInt(newInputValue, 10) < minMinute) {
|
|
412
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
413
|
-
}
|
|
414
|
-
else {
|
|
415
|
-
this.minutes = '00';
|
|
416
|
-
reputedToZero = true;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
else {
|
|
420
|
-
if (minMinute && parseInt(newInputValue, 10) < minMinute) {
|
|
421
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
422
|
-
}
|
|
423
|
-
else {
|
|
424
|
-
this.minutes = newInputValue;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
331
|
+
this.minutes = newInputValue;
|
|
427
332
|
}
|
|
428
333
|
else {
|
|
429
334
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
430
335
|
const parsedNewInputValue = parseInt(newInputValue, 10) || 0;
|
|
336
|
+
// Only apply format validation (not min/max constraints)
|
|
431
337
|
if (parsedNewInputValue >= maxMinutes) {
|
|
432
|
-
|
|
433
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
434
|
-
}
|
|
435
|
-
else {
|
|
436
|
-
this.minutes = '00';
|
|
437
|
-
reputedToZero = true;
|
|
438
|
-
}
|
|
338
|
+
this.minutes = '00';
|
|
439
339
|
}
|
|
440
340
|
else {
|
|
441
|
-
|
|
442
|
-
if (minMinute && parseInt(newInputValue, 10) < minMinute) {
|
|
443
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
444
|
-
}
|
|
445
|
-
else {
|
|
446
|
-
this.minutes = '00';
|
|
447
|
-
reputedToZero = true;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
else {
|
|
451
|
-
if (minMinute && parsedNewInputValue < minMinute) {
|
|
452
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
453
|
-
}
|
|
454
|
-
else {
|
|
455
|
-
this.minutes = parsedNewInputValue.toString();
|
|
456
|
-
}
|
|
457
|
-
}
|
|
341
|
+
this.minutes = parsedNewInputValue.toString();
|
|
458
342
|
}
|
|
459
343
|
}
|
|
460
344
|
}
|
|
461
345
|
else {
|
|
462
|
-
const
|
|
463
|
-
|
|
346
|
+
const parsedNewInputValue = parseInt(inputValue, 10) || 0;
|
|
347
|
+
// Only apply format validation (not min/max constraints)
|
|
464
348
|
if (parsedNewInputValue >= maxMinutes) {
|
|
465
|
-
|
|
466
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
467
|
-
}
|
|
468
|
-
else {
|
|
469
|
-
this.minutes = '00';
|
|
470
|
-
reputedToZero = true;
|
|
471
|
-
}
|
|
349
|
+
this.minutes = '00';
|
|
472
350
|
}
|
|
473
351
|
else {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
477
|
-
}
|
|
478
|
-
else {
|
|
479
|
-
this.minutes = '00';
|
|
480
|
-
reputedToZero = true;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
else {
|
|
484
|
-
if (minMinute && parsedNewInputValue < minMinute) {
|
|
485
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
486
|
-
}
|
|
487
|
-
else {
|
|
488
|
-
this.minutes = parsedNewInputValue.toString();
|
|
489
|
-
}
|
|
490
|
-
}
|
|
352
|
+
// For direct input, remove unnecessary leading zeros (e.g., '01' becomes '1')
|
|
353
|
+
this.minutes = parsedNewInputValue.toString();
|
|
491
354
|
}
|
|
492
355
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
356
|
+
// Auto-navigation to next field when input is complete
|
|
357
|
+
if (this.minutes.length >= 1 && !this.inputZeroAdded[type]) {
|
|
358
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
359
|
+
const currentTypeIndex = visibleTypes.indexOf(TimeType.Minutes);
|
|
360
|
+
const nextTypeIndex = currentTypeIndex + 1;
|
|
361
|
+
if (nextTypeIndex < visibleTypes.length) {
|
|
362
|
+
const nextType = visibleTypes[nextTypeIndex];
|
|
363
|
+
(_a = this.inputElements[nextType]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
364
|
+
(_b = this.inputElements[nextType]) === null || _b === void 0 ? void 0 : _b.select();
|
|
365
|
+
}
|
|
502
366
|
}
|
|
503
367
|
}
|
|
504
368
|
handleSecondsChange(inputValue, type) {
|
|
505
|
-
var _a, _b, _c, _d;
|
|
506
369
|
const maxSeconds = 60;
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
370
|
+
// Handle empty input
|
|
371
|
+
if (inputValue.length === 0) {
|
|
372
|
+
this.seconds = '00';
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
510
375
|
if (inputValue.length === 1) {
|
|
511
376
|
this.inputZeroAdded[type] = true;
|
|
512
377
|
const newInputValue = inputValue.padStart(2, '0');
|
|
513
|
-
|
|
514
|
-
if (minSecond && parseInt(newInputValue, 10) < minSecond) {
|
|
515
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
516
|
-
}
|
|
517
|
-
else {
|
|
518
|
-
this.seconds = '00';
|
|
519
|
-
reputedToZero = true;
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
else {
|
|
523
|
-
if (minSecond && parseInt(newInputValue, 10) < minSecond) {
|
|
524
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
525
|
-
}
|
|
526
|
-
else {
|
|
527
|
-
this.seconds = newInputValue;
|
|
528
|
-
}
|
|
529
|
-
}
|
|
378
|
+
this.seconds = newInputValue;
|
|
530
379
|
}
|
|
531
380
|
else if (this.inputZeroAdded[type]) {
|
|
532
381
|
this.inputZeroAdded[type] = false;
|
|
533
382
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
534
383
|
const parsedNewInputValue = parseInt(newInputValue, 10) || 0;
|
|
384
|
+
// Only apply format validation (not min/max constraints)
|
|
535
385
|
if (parsedNewInputValue >= maxSeconds) {
|
|
536
|
-
|
|
537
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
538
|
-
}
|
|
539
|
-
else {
|
|
540
|
-
this.seconds = '00';
|
|
541
|
-
reputedToZero = true;
|
|
542
|
-
}
|
|
386
|
+
this.seconds = '00';
|
|
543
387
|
}
|
|
544
388
|
else {
|
|
545
|
-
|
|
546
|
-
if (minSecond && parseInt(newInputValue, 10) < minSecond) {
|
|
547
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
548
|
-
}
|
|
549
|
-
else {
|
|
550
|
-
this.seconds = '00';
|
|
551
|
-
reputedToZero = true;
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
else {
|
|
555
|
-
if (minSecond && parsedNewInputValue < minSecond) {
|
|
556
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
557
|
-
}
|
|
558
|
-
else {
|
|
559
|
-
this.seconds = newInputValue;
|
|
560
|
-
}
|
|
561
|
-
}
|
|
389
|
+
this.seconds = newInputValue;
|
|
562
390
|
}
|
|
563
391
|
}
|
|
564
392
|
else if (inputValue.length > 2) {
|
|
565
393
|
const newInputValue = inputValue.slice(1, 3).padStart(2, '0');
|
|
566
394
|
const parsedNewInputValue = parseInt(newInputValue, 10) || 0;
|
|
395
|
+
// Only apply format validation (not min/max constraints)
|
|
567
396
|
if (parsedNewInputValue >= maxSeconds) {
|
|
568
|
-
|
|
569
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
570
|
-
}
|
|
571
|
-
else {
|
|
572
|
-
this.seconds = '00';
|
|
573
|
-
reputedToZero = true;
|
|
574
|
-
}
|
|
397
|
+
this.seconds = '00';
|
|
575
398
|
}
|
|
576
399
|
else {
|
|
577
|
-
|
|
578
|
-
if (minSecond && parseInt(newInputValue, 10) < minSecond) {
|
|
579
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
580
|
-
}
|
|
581
|
-
else {
|
|
582
|
-
this.seconds = '00';
|
|
583
|
-
reputedToZero = true;
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
else {
|
|
587
|
-
if (minSecond && parsedNewInputValue < minSecond) {
|
|
588
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
589
|
-
}
|
|
590
|
-
else {
|
|
591
|
-
this.seconds = parsedNewInputValue.toString();
|
|
592
|
-
}
|
|
593
|
-
}
|
|
400
|
+
this.seconds = parsedNewInputValue.toString();
|
|
594
401
|
}
|
|
595
402
|
}
|
|
596
403
|
else {
|
|
597
|
-
const
|
|
598
|
-
|
|
404
|
+
const parsedNewInputValue = parseInt(inputValue, 10) || 0;
|
|
405
|
+
// Only apply format validation (not min/max constraints)
|
|
599
406
|
if (parsedNewInputValue >= maxSeconds) {
|
|
600
|
-
|
|
601
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
602
|
-
}
|
|
603
|
-
else {
|
|
604
|
-
this.seconds = '00';
|
|
605
|
-
reputedToZero = true;
|
|
606
|
-
}
|
|
407
|
+
this.seconds = '00';
|
|
607
408
|
}
|
|
608
409
|
else {
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
612
|
-
}
|
|
613
|
-
else {
|
|
614
|
-
this.seconds = '00';
|
|
615
|
-
reputedToZero = true;
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
else {
|
|
619
|
-
if (minSecond && parsedNewInputValue < minSecond) {
|
|
620
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
621
|
-
}
|
|
622
|
-
else {
|
|
623
|
-
this.seconds = parsedNewInputValue.toString();
|
|
624
|
-
}
|
|
625
|
-
}
|
|
410
|
+
// For direct input, remove unnecessary leading zeros (e.g., '01' becomes '1')
|
|
411
|
+
this.seconds = parsedNewInputValue.toString();
|
|
626
412
|
}
|
|
627
413
|
}
|
|
628
|
-
|
|
629
|
-
(_c = this.inputElements[TimeType.Seconds]) === null || _c === void 0 ? void 0 : _c.focus();
|
|
630
|
-
(_d = this.inputElements[TimeType.Seconds]) === null || _d === void 0 ? void 0 : _d.select();
|
|
631
|
-
}
|
|
414
|
+
// No auto-navigation for seconds field as it's typically the last field
|
|
632
415
|
}
|
|
633
|
-
// Parse a
|
|
416
|
+
// Parse a time string according to the current format
|
|
634
417
|
parseTime(timeString) {
|
|
635
418
|
if (!timeString) {
|
|
636
419
|
return;
|
|
637
420
|
}
|
|
638
|
-
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
const minSecond = this.parseSecond(this.min) || second;
|
|
645
|
-
this.hours = minHour.padStart(2, '0');
|
|
646
|
-
this.minutes = minMinute.toString().padStart(2, '0');
|
|
647
|
-
this.seconds = minSecond.toString().padStart(2, '0');
|
|
421
|
+
// Use format-aware parsing without constraint application
|
|
422
|
+
const components = parseValueByFormat(timeString, this.format);
|
|
423
|
+
// Set the parsed values without applying min/max constraints
|
|
424
|
+
this.hours = components.hours;
|
|
425
|
+
this.minutes = components.minutes;
|
|
426
|
+
this.seconds = components.seconds;
|
|
648
427
|
}
|
|
649
428
|
reconstructTime() {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
429
|
+
const components = {
|
|
430
|
+
hours: this.hours,
|
|
431
|
+
minutes: this.minutes,
|
|
432
|
+
seconds: this.seconds,
|
|
433
|
+
};
|
|
434
|
+
// Ensure the reconstructed time is in the correct format
|
|
435
|
+
const reconstructedTime = reconstructTimeByFormat(components, this.format);
|
|
436
|
+
// Validate that the reconstructed time matches the expected format
|
|
437
|
+
if (!isValidFormatValue(reconstructedTime, this.format)) {
|
|
438
|
+
// If invalid, return the default value for this format
|
|
439
|
+
const config = FORMAT_CONFIGS[this.format];
|
|
440
|
+
return config ? config.defaultValue : reconstructedTime;
|
|
661
441
|
}
|
|
442
|
+
return reconstructedTime;
|
|
662
443
|
}
|
|
663
444
|
handleFocus(type) {
|
|
664
445
|
var _a, _b, _c, _d;
|
|
665
446
|
if (this.readonly || this.disabled) {
|
|
666
447
|
return;
|
|
667
448
|
}
|
|
449
|
+
// Check if this field is visible for the current format
|
|
450
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
451
|
+
if (!visibleTypes.includes(type)) {
|
|
452
|
+
return; // Don't handle focus for non-visible fields
|
|
453
|
+
}
|
|
668
454
|
if (!this.open) {
|
|
669
455
|
this.open = true; // Force the popover to open
|
|
670
456
|
}
|
|
@@ -677,33 +463,23 @@ export class NvFieldtime {
|
|
|
677
463
|
this.typeFocused = type;
|
|
678
464
|
}
|
|
679
465
|
HandleDropdownIconClick() {
|
|
680
|
-
var _a, _b
|
|
466
|
+
var _a, _b;
|
|
681
467
|
if (this.disabled || this.readonly) {
|
|
682
468
|
return; // Do not toggle if disabled or read-only
|
|
683
469
|
}
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
else if (this.open && this.inputElements[TimeType.Minutes]) {
|
|
688
|
-
this.open = false; // Close the popover if it is open
|
|
689
|
-
}
|
|
690
|
-
else if (this.open && this.inputElements[TimeType.Seconds]) {
|
|
470
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
471
|
+
const firstVisibleType = visibleTypes[0];
|
|
472
|
+
if (this.open) {
|
|
691
473
|
this.open = false; // Close the popover if it is open
|
|
692
474
|
}
|
|
693
|
-
else if (!this.open &&
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
(_c = this.inputElements[TimeType.Minutes]) === null || _c === void 0 ? void 0 : _c.focus(); // Focus will open the popover
|
|
699
|
-
(_d = this.inputElements[TimeType.Minutes]) === null || _d === void 0 ? void 0 : _d.select();
|
|
700
|
-
}
|
|
701
|
-
else if (!this.open && this.inputElements[TimeType.Seconds]) {
|
|
702
|
-
(_e = this.inputElements[TimeType.Seconds]) === null || _e === void 0 ? void 0 : _e.focus(); // Focus will open the popover
|
|
703
|
-
(_f = this.inputElements[TimeType.Seconds]) === null || _f === void 0 ? void 0 : _f.select();
|
|
475
|
+
else if (!this.open &&
|
|
476
|
+
firstVisibleType &&
|
|
477
|
+
this.inputElements[firstVisibleType]) {
|
|
478
|
+
(_a = this.inputElements[firstVisibleType]) === null || _a === void 0 ? void 0 : _a.focus(); // Focus will open the popover
|
|
479
|
+
(_b = this.inputElements[firstVisibleType]) === null || _b === void 0 ? void 0 : _b.select();
|
|
704
480
|
}
|
|
705
481
|
else {
|
|
706
|
-
console.warn('nv-fieldtime -> No input elements found to focus
|
|
482
|
+
console.warn('nv-fieldtime -> No visible input elements found to focus');
|
|
707
483
|
}
|
|
708
484
|
}
|
|
709
485
|
updateHighlightedItem(items, index) {
|
|
@@ -722,6 +498,8 @@ export class NvFieldtime {
|
|
|
722
498
|
}
|
|
723
499
|
handleTimeOptionClick(event, type) {
|
|
724
500
|
const option = parseInt(event.target.textContent || '0', 10);
|
|
501
|
+
// Update the time component directly without constraint validation
|
|
502
|
+
// Dropdown options are already filtered by constraints during generation
|
|
725
503
|
if (type === TimeType.Hours) {
|
|
726
504
|
this.hours = option.toString().padStart(2, '0');
|
|
727
505
|
}
|
|
@@ -731,8 +509,9 @@ export class NvFieldtime {
|
|
|
731
509
|
else if (type === TimeType.Seconds) {
|
|
732
510
|
this.seconds = option.toString().padStart(2, '0');
|
|
733
511
|
}
|
|
734
|
-
|
|
735
|
-
|
|
512
|
+
// Reconstruct time in the correct format and update value
|
|
513
|
+
const reconstructedTime = this.reconstructTime();
|
|
514
|
+
this.value = reconstructedTime;
|
|
736
515
|
}
|
|
737
516
|
handleInputBlur() {
|
|
738
517
|
// Use a delay to check if the focus is still within the popover
|
|
@@ -791,17 +570,29 @@ export class NvFieldtime {
|
|
|
791
570
|
}
|
|
792
571
|
generateHourOptions(stepInSeconds) {
|
|
793
572
|
const hourStep = Math.max(1, Math.floor(stepInSeconds / 3600)); // Prevent step < 1
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
const
|
|
797
|
-
const
|
|
798
|
-
const
|
|
573
|
+
const is12HourFormat = this.format.startsWith('hh');
|
|
574
|
+
// Set proper hour ranges based on format
|
|
575
|
+
const defaultMaxHour = is12HourFormat ? 12 : 23;
|
|
576
|
+
const defaultMinHour = is12HourFormat ? 1 : 0;
|
|
577
|
+
const maxHour = this.parseHour(this.max, this.format);
|
|
578
|
+
const minHour = this.parseHour(this.min, this.format);
|
|
579
|
+
const maxHourValue = maxHour ? parseInt(maxHour, 10) : defaultMaxHour;
|
|
580
|
+
const minHourValue = minHour ? parseInt(minHour, 10) : defaultMinHour;
|
|
799
581
|
const values = [];
|
|
800
|
-
for (let i = minHourValue; i
|
|
801
|
-
|
|
582
|
+
for (let i = minHourValue; i <= maxHourValue; i += hourStep) {
|
|
583
|
+
const hourStr = i.toString().padStart(2, '0');
|
|
584
|
+
values.push(hourStr);
|
|
802
585
|
}
|
|
803
586
|
return values;
|
|
804
587
|
}
|
|
588
|
+
/**
|
|
589
|
+
* Parse hour value from min/max constraint strings for dropdown generation only.
|
|
590
|
+
* This method is used exclusively for filtering dropdown options and should not
|
|
591
|
+
* affect input values or validation.
|
|
592
|
+
* @param {string} value - The time string to parse (e.g., "14:30" or "02:30")
|
|
593
|
+
* @param {string} format - The time format string (e.g., "HH:mm" or "hh:mm")
|
|
594
|
+
* @returns {string} The parsed hour string or null if invalid
|
|
595
|
+
*/
|
|
805
596
|
parseHour(value, format) {
|
|
806
597
|
if (!value)
|
|
807
598
|
return null;
|
|
@@ -819,13 +610,21 @@ export class NvFieldtime {
|
|
|
819
610
|
const minMinute = (_a = this.parseMinute(this.min)) !== null && _a !== void 0 ? _a : 0;
|
|
820
611
|
const maxMinute = (_b = this.parseMinute(this.max)) !== null && _b !== void 0 ? _b : 59;
|
|
821
612
|
if (minMinute === 0 && maxMinute === 0)
|
|
822
|
-
return ['00']; // Handle edge case for zero
|
|
613
|
+
return ['00']; // Handle edge case for zero minutes
|
|
823
614
|
const values = [];
|
|
824
615
|
for (let i = minMinute; i <= maxMinute; i += minuteStep) {
|
|
825
|
-
|
|
616
|
+
const minuteStr = i.toString().padStart(2, '0');
|
|
617
|
+
values.push(minuteStr);
|
|
826
618
|
}
|
|
827
619
|
return values;
|
|
828
620
|
}
|
|
621
|
+
/**
|
|
622
|
+
* Parse minute value from min/max constraint strings for dropdown generation only.
|
|
623
|
+
* This method is used exclusively for filtering dropdown options and should not
|
|
624
|
+
* affect input values or validation.
|
|
625
|
+
* @param {string} value - The time string to parse (e.g., "14:30" or "02:30")
|
|
626
|
+
* @returns {number} The parsed minute number or null if invalid
|
|
627
|
+
*/
|
|
829
628
|
parseMinute(value) {
|
|
830
629
|
if (!value)
|
|
831
630
|
return null;
|
|
@@ -844,10 +643,18 @@ export class NvFieldtime {
|
|
|
844
643
|
return ['00']; // Handle edge case for zero seconds
|
|
845
644
|
const values = [];
|
|
846
645
|
for (let i = minSecond; i <= maxSecond; i += secondStep) {
|
|
847
|
-
|
|
646
|
+
const secondStr = i.toString().padStart(2, '0');
|
|
647
|
+
values.push(secondStr);
|
|
848
648
|
}
|
|
849
649
|
return values;
|
|
850
650
|
}
|
|
651
|
+
/**
|
|
652
|
+
* Parse second value from min/max constraint strings for dropdown generation only.
|
|
653
|
+
* This method is used exclusively for filtering dropdown options and should not
|
|
654
|
+
* affect input values or validation.
|
|
655
|
+
* @param {string} value - The time string to parse (e.g., "14:30:45" or "02:30:45")
|
|
656
|
+
* @returns {number} The parsed second number or null if invalid
|
|
657
|
+
*/
|
|
851
658
|
parseSecond(value) {
|
|
852
659
|
if (!value)
|
|
853
660
|
return null;
|
|
@@ -864,10 +671,6 @@ export class NvFieldtime {
|
|
|
864
671
|
const repetitions = Math.ceil(300 / totalOptions);
|
|
865
672
|
return Array(repetitions).fill(options).flat();
|
|
866
673
|
}
|
|
867
|
-
getCurrentTime() {
|
|
868
|
-
const currentTime = new Date();
|
|
869
|
-
return currentTime.toLocaleTimeString(); // Returns the time in the locale's format
|
|
870
|
-
}
|
|
871
674
|
updateColumnHighlight(selector, value) {
|
|
872
675
|
const items = Array.from(this.el.querySelectorAll(selector));
|
|
873
676
|
const index = items.findIndex(x => x.textContent === value);
|
|
@@ -885,8 +688,13 @@ export class NvFieldtime {
|
|
|
885
688
|
}
|
|
886
689
|
if (!this.open) {
|
|
887
690
|
if (this.inputElements) {
|
|
888
|
-
|
|
889
|
-
|
|
691
|
+
// Focus on the first visible field based on format
|
|
692
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
693
|
+
const firstVisibleType = visibleTypes[0];
|
|
694
|
+
if (firstVisibleType && this.inputElements[firstVisibleType]) {
|
|
695
|
+
(_a = this.inputElements[firstVisibleType]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
696
|
+
(_b = this.inputElements[firstVisibleType]) === null || _b === void 0 ? void 0 : _b.select();
|
|
697
|
+
}
|
|
890
698
|
}
|
|
891
699
|
event.preventDefault();
|
|
892
700
|
}
|
|
@@ -896,17 +704,23 @@ export class NvFieldtime {
|
|
|
896
704
|
//#region LIFECYCLE
|
|
897
705
|
componentWillLoad() {
|
|
898
706
|
document.addEventListener('click', this.handleClickOutside.bind(this));
|
|
899
|
-
//
|
|
707
|
+
// Initialize component state based on format and value
|
|
900
708
|
if (this.value) {
|
|
709
|
+
// Parse the provided value using format-aware parsing without constraint application
|
|
901
710
|
this.parseTime(this.value);
|
|
902
711
|
}
|
|
903
712
|
else {
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
const
|
|
907
|
-
|
|
908
|
-
this.
|
|
909
|
-
this.
|
|
713
|
+
// Initialize with format-appropriate default values without any constraint application
|
|
714
|
+
// Use format-specific defaults: '01' for 12-hour formats, '00' for 24-hour formats
|
|
715
|
+
const defaultComponents = parseValueByFormat('', this.format);
|
|
716
|
+
// Set default values directly without any min/max constraint validation
|
|
717
|
+
this.hours = defaultComponents.hours;
|
|
718
|
+
this.minutes = defaultComponents.minutes;
|
|
719
|
+
this.seconds = defaultComponents.seconds;
|
|
720
|
+
// Set the initial value in the correct format without constraint validation
|
|
721
|
+
// This ensures the component has a proper initial state for the value watcher
|
|
722
|
+
const initialValue = reconstructTimeByFormat(defaultComponents, this.format);
|
|
723
|
+
this.value = initialValue;
|
|
910
724
|
}
|
|
911
725
|
}
|
|
912
726
|
connectedCallback() {
|
|
@@ -916,63 +730,94 @@ export class NvFieldtime {
|
|
|
916
730
|
document.removeEventListener('click', this.handleClickOutside.bind(this));
|
|
917
731
|
}
|
|
918
732
|
componentDidLoad() {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
733
|
+
// Initialize dropdown highlighting based on current component state
|
|
734
|
+
// This ensures proper visual feedback without applying any constraints
|
|
735
|
+
// Update highlighted items for hours based on current state
|
|
736
|
+
const hourSelector = `.time-column.time-column-hours div`;
|
|
737
|
+
this.updateColumnHighlight(hourSelector, this.hours);
|
|
738
|
+
// Update highlighted items for minutes based on current state
|
|
739
|
+
const minuteSelector = `.time-column.time-column-minutes div`;
|
|
740
|
+
this.updateColumnHighlight(minuteSelector, this.minutes);
|
|
741
|
+
// Update highlighted items for seconds based on current state
|
|
742
|
+
const secondSelector = `.time-column.time-column-seconds div`;
|
|
743
|
+
this.updateColumnHighlight(secondSelector, this.seconds);
|
|
744
|
+
}
|
|
745
|
+
//#endregion LIFECYCLE
|
|
746
|
+
/****************************************************************************/
|
|
747
|
+
//#region RENDER
|
|
748
|
+
/**
|
|
749
|
+
* Renders input fields based on the current format
|
|
750
|
+
* Only shows fields that are relevant to the selected format
|
|
751
|
+
* @returns {HTMLElement[]} Array of HTML elements for time input fields
|
|
752
|
+
*/
|
|
753
|
+
renderTimeInputFields() {
|
|
754
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
755
|
+
const elements = [];
|
|
756
|
+
visibleTypes.forEach((type, index) => {
|
|
757
|
+
// Add separator colon before minutes and seconds (but not before the first field)
|
|
758
|
+
if (index > 0) {
|
|
759
|
+
elements.push(h("span", null, ":"));
|
|
931
760
|
}
|
|
932
|
-
//
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
761
|
+
// Add the input field for this time type
|
|
762
|
+
elements.push(this.renderTimeInputField(type));
|
|
763
|
+
});
|
|
764
|
+
return elements;
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* Renders a single time input field for the specified type
|
|
768
|
+
* @param {TimeType} type - The time type to render input for
|
|
769
|
+
* @returns {HTMLInputElement} HTML input element for the specified time type
|
|
770
|
+
*/
|
|
771
|
+
renderTimeInputField(type) {
|
|
772
|
+
const getValue = () => {
|
|
773
|
+
switch (type) {
|
|
774
|
+
case TimeType.Hours:
|
|
775
|
+
return this.hours;
|
|
776
|
+
case TimeType.Minutes:
|
|
777
|
+
return this.minutes;
|
|
778
|
+
case TimeType.Seconds:
|
|
779
|
+
return this.seconds;
|
|
780
|
+
default:
|
|
781
|
+
return '00';
|
|
942
782
|
}
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
783
|
+
};
|
|
784
|
+
const getPlaceholder = () => {
|
|
785
|
+
switch (type) {
|
|
786
|
+
case TimeType.Hours:
|
|
787
|
+
return this.format.includes('hh') ? 'hh' : 'HH';
|
|
788
|
+
case TimeType.Minutes:
|
|
789
|
+
return 'mm';
|
|
790
|
+
case TimeType.Seconds:
|
|
791
|
+
return 'ss';
|
|
792
|
+
default:
|
|
793
|
+
return '';
|
|
954
794
|
}
|
|
955
|
-
|
|
956
|
-
|
|
795
|
+
};
|
|
796
|
+
const getId = () => {
|
|
797
|
+
switch (type) {
|
|
798
|
+
case TimeType.Hours:
|
|
799
|
+
return this.inputId;
|
|
800
|
+
case TimeType.Minutes:
|
|
801
|
+
return `${this.inputId}-minutes`;
|
|
802
|
+
case TimeType.Seconds:
|
|
803
|
+
return `${this.inputId}-seconds`;
|
|
804
|
+
default:
|
|
805
|
+
return this.inputId;
|
|
957
806
|
}
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
}
|
|
807
|
+
};
|
|
808
|
+
// Remove min/max constraints from input elements to allow native stepper behavior
|
|
809
|
+
// Constraints are only applied to dropdown options, not input steppers
|
|
810
|
+
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() }));
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* Renders dropdown columns based on the current format
|
|
814
|
+
* Only shows columns that are relevant to the selected format
|
|
815
|
+
* @returns {HTMLElement[]} Array of HTML elements for time dropdown columns
|
|
816
|
+
*/
|
|
817
|
+
renderTimeDropdownColumns() {
|
|
818
|
+
const visibleTypes = getVisibleTimeTypes(this.format);
|
|
819
|
+
return visibleTypes.map(type => this.RenderTimeOptionsColumn(type));
|
|
972
820
|
}
|
|
973
|
-
//#endregion LIFECYCLE
|
|
974
|
-
/****************************************************************************/
|
|
975
|
-
//#region RENDER
|
|
976
821
|
RenderTimeOptionsColumn(type) {
|
|
977
822
|
return (h("div", { class: `time-column time-column-${type}`, onScroll: e => this.handleScroll(e, type) }, this.generateInfiniteTimeOptions(type).map((option, index) => (h("div", { class: {
|
|
978
823
|
'time-option': true,
|
|
@@ -982,26 +827,9 @@ export class NvFieldtime {
|
|
|
982
827
|
}, key: `${option}-${index}`, onClick: e => this.handleTimeOptionClick(e, type) }, option)))));
|
|
983
828
|
}
|
|
984
829
|
render() {
|
|
985
|
-
return (h(Host, { key: '
|
|
986
|
-
h("
|
|
987
|
-
|
|
988
|
-
: TimeType.Hours, id: this.inputId, readonly: this.readonly, disabled: this.disabled, required: this.required, onKeyDown: e => this.handleKeyDown(e), onBlur: () => this.handleInputBlur() }),
|
|
989
|
-
], this.format.includes('mm') && [
|
|
990
|
-
h("span", { key: '74f9604ffd54e0c0bbd88996e32fdcb08f2c3645' }, ":"),
|
|
991
|
-
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
|
|
992
|
-
? `${TimeType.Minutes}-${this.name}`
|
|
993
|
-
: TimeType.Minutes, id: `${this.inputId}-minutes`, readonly: this.readonly, disabled: this.disabled, required: this.required, onKeyDown: e => this.handleKeyDown(e), onBlur: () => this.handleInputBlur() }),
|
|
994
|
-
], this.format.includes('ss') && [
|
|
995
|
-
h("span", { key: '878bc9ce7557e9cf9471803a86956a9184d0ccb5' }, ":"),
|
|
996
|
-
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
|
|
997
|
-
? `${TimeType.Seconds}-${this.name}`
|
|
998
|
-
: TimeType.Seconds, id: `${this.inputId}-seconds`, readonly: this.readonly, disabled: this.disabled, required: this.required, onKeyDown: e => this.handleKeyDown(e), onBlur: () => this.handleInputBlur() }),
|
|
999
|
-
], 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') &&
|
|
1000
|
-
this.RenderTimeOptionsColumn(TimeType.Hours), this.format.includes('mm') &&
|
|
1001
|
-
this.RenderTimeOptionsColumn(TimeType.Minutes), this.format.includes('ss') &&
|
|
1002
|
-
this.RenderTimeOptionsColumn(TimeType.Seconds)))), (this.description ||
|
|
1003
|
-
this.el.querySelector('[slot="description"]')) && (h("div", { key: '1076ded73b32ff9afbd0f02184febcc82f8d839e', class: "description" }, h("slot", { key: '479d09b299d0e380533a6cd689ce7f03aa92ea8e', name: "description" }, this.description))), (this.errorDescription ||
|
|
1004
|
-
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)))));
|
|
830
|
+
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 ||
|
|
831
|
+
this.el.querySelector('[slot="description"]')) && (h("div", { key: '735447b328a8264739d3185ce6c65d48a01ec801', class: "description" }, h("slot", { key: '86387e48804b2ac1842c64b4cf4f5ca9f34a6719', name: "description" }, this.description))), (this.errorDescription ||
|
|
832
|
+
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)))));
|
|
1005
833
|
}
|
|
1006
834
|
static get is() { return "nv-fieldtime"; }
|
|
1007
835
|
static get formAssociated() { return true; }
|
|
@@ -1231,7 +1059,7 @@ export class NvFieldtime {
|
|
|
1231
1059
|
"optional": false,
|
|
1232
1060
|
"docs": {
|
|
1233
1061
|
"tags": [],
|
|
1234
|
-
"text": "Specifies the time format to be used.\nAvailable formats:\n- HH: 24-hour format (00-23)\n- HH:mm: 24-hour format with minutes (00:00-23:59)\n- HH:mm:ss: 24-hour format with minutes and seconds (00:00:00-23:59:59)\n- hh: 12-hour format (01-12)\n- hh:mm: 12-hour format with minutes (01:00-12:59)\n- hh:mm:ss: 12-hour format with minutes and seconds (01:00:00-12:59:59)"
|
|
1062
|
+
"text": "Specifies the time format to be used.\nAvailable formats:\n- HH: 24-hour format (00-23)\n- HH:mm: 24-hour format with minutes (00:00-23:59)\n- HH:mm:ss: 24-hour format with minutes and seconds (00:00:00-23:59:59)\n- hh: 12-hour format (01-12)\n- hh:mm: 12-hour format with minutes (01:00-12:59)\n- hh:mm:ss: 12-hour format with minutes and seconds (01:00:00-12:59:59)\n\nThe component automatically shows only the relevant input fields based on the selected format.\nWhen the format changes dynamically, the component re-parses the current value and updates\nthe visible fields accordingly."
|
|
1235
1063
|
},
|
|
1236
1064
|
"getter": false,
|
|
1237
1065
|
"setter": false,
|
|
@@ -1373,8 +1201,11 @@ export class NvFieldtime {
|
|
|
1373
1201
|
"cancelable": true,
|
|
1374
1202
|
"composed": true,
|
|
1375
1203
|
"docs": {
|
|
1376
|
-
"tags": [
|
|
1377
|
-
|
|
1204
|
+
"tags": [{
|
|
1205
|
+
"name": "bind",
|
|
1206
|
+
"text": "value"
|
|
1207
|
+
}],
|
|
1208
|
+
"text": "Emit an event when the time value changes.\nThe event detail contains the new time value in the format specified by the format property."
|
|
1378
1209
|
},
|
|
1379
1210
|
"complexType": {
|
|
1380
1211
|
"original": "string",
|
|
@@ -1391,6 +1222,9 @@ export class NvFieldtime {
|
|
|
1391
1222
|
}, {
|
|
1392
1223
|
"propName": "open",
|
|
1393
1224
|
"methodName": "handleOpenChange"
|
|
1225
|
+
}, {
|
|
1226
|
+
"propName": "format",
|
|
1227
|
+
"methodName": "handleFormatChange"
|
|
1394
1228
|
}];
|
|
1395
1229
|
}
|
|
1396
1230
|
static get listeners() {
|