timepicker-ui 2.6.0 → 3.0.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/LICENSE +1 -1
- package/README.md +503 -543
- package/dist/css/index.css +1 -0
- package/dist/css/main.css +1 -0
- package/dist/css/themes/theme-ai.css +1 -0
- package/dist/css/themes/theme-crane.css +1 -0
- package/dist/css/themes/theme-cyberpunk.css +1 -0
- package/dist/css/themes/theme-dark.css +1 -0
- package/dist/css/themes/theme-glassmorphic.css +1 -0
- package/dist/css/themes/theme-m3.css +1 -0
- package/dist/css/themes/theme-pastel.css +1 -0
- package/dist/index.cjs +75 -0
- package/dist/index.d.cts +740 -0
- package/dist/index.d.ts +740 -0
- package/dist/index.js +75 -0
- package/dist/index.umd.js +1 -0
- package/package.json +26 -5
- package/CHANGELOG.md +0 -246
- package/dist/timepicker-ui.esm.js +0 -1
- package/dist/timepicker-ui.js +0 -1
- package/dist/timepicker-ui.umd.js +0 -1
- package/dist/types/index.d.ts +0 -314
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,740 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Callback function type for timepicker events
|
|
3
|
+
*/
|
|
4
|
+
type TimepickerEventCallback = (eventData: {
|
|
5
|
+
hour?: string | null;
|
|
6
|
+
minutes?: string | null;
|
|
7
|
+
type?: string | null;
|
|
8
|
+
degreesHours?: number | null;
|
|
9
|
+
degreesMinutes?: number | null;
|
|
10
|
+
hourNotAccepted?: string | null;
|
|
11
|
+
minutesNotAccepted?: string | null;
|
|
12
|
+
eventType?: any;
|
|
13
|
+
error?: string;
|
|
14
|
+
currentHour?: string | number;
|
|
15
|
+
currentMin?: string | number;
|
|
16
|
+
currentType?: string;
|
|
17
|
+
currentLength?: string | number;
|
|
18
|
+
}) => void;
|
|
19
|
+
|
|
20
|
+
type OptionTypes = {
|
|
21
|
+
/**
|
|
22
|
+
* @description Set custom text to AM label
|
|
23
|
+
* @default "AM"
|
|
24
|
+
*/
|
|
25
|
+
amLabel?: string;
|
|
26
|
+
/**
|
|
27
|
+
* @description Turn on/off animations on picker on start/close
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
animation?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* @description Set default selector to append timepicker inside it. Timepicker default append to `body`
|
|
33
|
+
* @default ""
|
|
34
|
+
*/
|
|
35
|
+
appendModalSelector?: string;
|
|
36
|
+
/**
|
|
37
|
+
* @description Turn on/off backdrop
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
backdrop?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* @description Set custom text to cancel button
|
|
43
|
+
* @default "CANCEL"
|
|
44
|
+
*/
|
|
45
|
+
cancelLabel?: string;
|
|
46
|
+
/**
|
|
47
|
+
* @description Edit hour/minutes on the web mode.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
editable?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* @description Turn on/off scroll if timepicker is open
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
enableScrollbar?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* @description Turn on/off icon to switch desktop/mobile
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
enableSwitchIcon?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* @description Set custom text to time label on mobile version
|
|
63
|
+
* @default "Enter Time"
|
|
64
|
+
*/
|
|
65
|
+
mobileTimeLabel?: string;
|
|
66
|
+
/**
|
|
67
|
+
* @description Turn on/off focus to input after close modal
|
|
68
|
+
* @default false
|
|
69
|
+
*/
|
|
70
|
+
focusInputAfterCloseModal?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* @description Set custom text to hour label on mobile version
|
|
73
|
+
* @default "Hour"
|
|
74
|
+
*/
|
|
75
|
+
hourMobileLabel?: string;
|
|
76
|
+
/**
|
|
77
|
+
* @description Set default template to switch desktop.This options is using by default material design icon
|
|
78
|
+
* @default "<i class='material-icons timepicker-ui-keyboard-icon'> keyboard </i>"
|
|
79
|
+
*/
|
|
80
|
+
iconTemplate?: string;
|
|
81
|
+
/**
|
|
82
|
+
* @description Set default template to switch mobile. This options is using by default material design icon
|
|
83
|
+
* @default "<i class='material-icons timepicker-ui-keyboard-icon'> schedule </i>"
|
|
84
|
+
*/
|
|
85
|
+
iconTemplateMobile?: string;
|
|
86
|
+
/**
|
|
87
|
+
* @description Set increment hour by `1`, `2`, `3` hour
|
|
88
|
+
* @default 1
|
|
89
|
+
*/
|
|
90
|
+
incrementHours?: number;
|
|
91
|
+
/**
|
|
92
|
+
* @description Set increment minutes by `1`, `5`, `10`, `15` minutes
|
|
93
|
+
* @default 1
|
|
94
|
+
*/
|
|
95
|
+
incrementMinutes?: number;
|
|
96
|
+
/**
|
|
97
|
+
* @description set custom text to minute label on mobile version
|
|
98
|
+
* @default "Minute"
|
|
99
|
+
*/
|
|
100
|
+
minuteMobileLabel?: string;
|
|
101
|
+
/**
|
|
102
|
+
* @description Turn on/off mobile version
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
mobile?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* @description Set custom text to ok label
|
|
108
|
+
* @default "OK"
|
|
109
|
+
*/
|
|
110
|
+
okLabel?: string;
|
|
111
|
+
/**
|
|
112
|
+
* @description Set custom text to pm label
|
|
113
|
+
* @default "PM"
|
|
114
|
+
*/
|
|
115
|
+
pmLabel?: string;
|
|
116
|
+
/**
|
|
117
|
+
* @description Set custom text to time label on desktop version
|
|
118
|
+
* @default "Select Time"
|
|
119
|
+
*/
|
|
120
|
+
timeLabel?: string;
|
|
121
|
+
/**
|
|
122
|
+
* @description Turn on/off switch to minutes by select hour
|
|
123
|
+
* @default true
|
|
124
|
+
*/
|
|
125
|
+
switchToMinutesAfterSelectHour?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* @description Set theme to timepicker. Available options: `basic`, `crane-straight`, `crane-radius`, `m3`.
|
|
128
|
+
|
|
129
|
+
* The offical version of Material Design 3 is still not avaialbe for the WEB version.Theme `m3` has been added
|
|
130
|
+
* based on the design what you can find [here](https://m3.material.io/components/time-pickers/overview).
|
|
131
|
+
* If new version M3 will be released this design will get improve.
|
|
132
|
+
* @default "basic"
|
|
133
|
+
*/
|
|
134
|
+
theme?:
|
|
135
|
+
| 'basic'
|
|
136
|
+
| 'crane-straight'
|
|
137
|
+
| 'crane-radius'
|
|
138
|
+
| 'm3'
|
|
139
|
+
| 'dark'
|
|
140
|
+
| 'glassmorphic'
|
|
141
|
+
| 'pastel'
|
|
142
|
+
| 'ai'
|
|
143
|
+
| 'cyberpunk';
|
|
144
|
+
/**
|
|
145
|
+
* @description Set type of clock, it contains 2 versions: `12h` and `24h`.
|
|
146
|
+
* @default false
|
|
147
|
+
*/
|
|
148
|
+
clockType?: '12h' | '24h';
|
|
149
|
+
/**
|
|
150
|
+
* @description - The `hours` and `minutes` are arrays which accept strings and numbers to block select hours/minutes.
|
|
151
|
+
* - The `interval` key allow only string with interval values i.e., if you have 24h clockType the string can be 03:00 - 15:00, 01:20 - 05:15, 02:03 - 06:55 etc.. On the other hand if you have 12h clockType the string can be i.e 01:30 PM - 6:30 PM, 02:00 AM - 10:00 AM, 02:30 AM - 10:30 PM. It is important to remember that first hour in the interval option should be less that the second value if you want to block values from AM to PM and if you are using interval with 24h clockType.
|
|
152
|
+
* - If the interval key is set, the hours/minutes keys are `ignored`.
|
|
153
|
+
* @example
|
|
154
|
+
disabledTime: {
|
|
155
|
+
minutes: [1,2,4,5,55,23,"22","38"],
|
|
156
|
+
hours: [1,"3","5", 8],
|
|
157
|
+
interval: "10:00 AM - 12:00 PM",
|
|
158
|
+
}
|
|
159
|
+
* @default undefined
|
|
160
|
+
*/
|
|
161
|
+
disabledTime?: {
|
|
162
|
+
minutes?: Array<string | number>;
|
|
163
|
+
hours?: Array<string | number>;
|
|
164
|
+
interval?: string;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* @description Set current time to the input and timepicker.\
|
|
168
|
+
* If this options is set to `true` it's gonna update picker with toLocaleTimeString() and input with value based on your location.
|
|
169
|
+
* This option also allows to put object with properties.
|
|
170
|
+
* @example
|
|
171
|
+
currentTime: {
|
|
172
|
+
time: new Date(),
|
|
173
|
+
updateInput: true,
|
|
174
|
+
locales: "en-US",
|
|
175
|
+
preventClockType: false
|
|
176
|
+
};
|
|
177
|
+
* @example currentTime: true
|
|
178
|
+
* @default undefined
|
|
179
|
+
*/
|
|
180
|
+
currentTime?:
|
|
181
|
+
| {
|
|
182
|
+
/**
|
|
183
|
+
* The `time` key allows to put any valid date to update picker.
|
|
184
|
+
* @requires
|
|
185
|
+
* If the `updateInput` is set to `false/undefined` and the default value from the input not exist, the `time` key value will be displayed in the picker.
|
|
186
|
+
*
|
|
187
|
+
* If the `updateInput` is set to `false/undefined` but the default value from the input exist, the `time` key will be ignored.
|
|
188
|
+
*/
|
|
189
|
+
time?: Date;
|
|
190
|
+
/**
|
|
191
|
+
* The `updateInput` key is set to `true` it's going update input value with set time key.
|
|
192
|
+
*/
|
|
193
|
+
updateInput?: boolean;
|
|
194
|
+
/**
|
|
195
|
+
* The `locales` key can change language from `toLocaleTimeString()`.
|
|
196
|
+
*/
|
|
197
|
+
locales?: string | string[];
|
|
198
|
+
/**
|
|
199
|
+
* The `preventClockType` key if is set to `true` it's `force` the clockType option to set value "12h" or "24h" based on your location
|
|
200
|
+
* with current time and `locales` key value is ignored.
|
|
201
|
+
*/
|
|
202
|
+
preventClockType?: boolean;
|
|
203
|
+
}
|
|
204
|
+
| boolean;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* @description Set focus trap to the modal element to all elements with tabindex in the picker
|
|
208
|
+
* @default true
|
|
209
|
+
*/
|
|
210
|
+
focusTrap?: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* @description Set delay to clickable elements like button "OK", "CANCEL" etc. The value has to be set in milliseconds.
|
|
213
|
+
* @default 300
|
|
214
|
+
*/
|
|
215
|
+
delayHandler?: number;
|
|
216
|
+
/**
|
|
217
|
+
* @description Custom ID for the timepicker instance. Useful for identifying specific instances when using multiple timepickers.
|
|
218
|
+
* If not provided, a random UUID will be generated.
|
|
219
|
+
* @example id: "my-timepicker-1"
|
|
220
|
+
* @default undefined
|
|
221
|
+
*/
|
|
222
|
+
id?: string;
|
|
223
|
+
/**
|
|
224
|
+
* @description Enable inline mode for always-visible timepicker
|
|
225
|
+
* If enabled is true, containerId must be provided and the timepicker will be rendered inside the specified container instead of as a modal.
|
|
226
|
+
* The timepicker will not open on input click and will be always visible.
|
|
227
|
+
* @example
|
|
228
|
+
* inline: {
|
|
229
|
+
* enabled: true,
|
|
230
|
+
* containerId: "timepicker-container",
|
|
231
|
+
* showButtons: false,
|
|
232
|
+
* autoUpdate: true
|
|
233
|
+
* }
|
|
234
|
+
* @default undefined
|
|
235
|
+
*/
|
|
236
|
+
inline?: {
|
|
237
|
+
/**
|
|
238
|
+
* @description Enable or disable inline mode
|
|
239
|
+
*/
|
|
240
|
+
enabled: boolean;
|
|
241
|
+
/**
|
|
242
|
+
* @description ID of the container element where the timepicker should be rendered (required when enabled is true)
|
|
243
|
+
*/
|
|
244
|
+
containerId: string;
|
|
245
|
+
/**
|
|
246
|
+
* @description Show or hide OK/CANCEL buttons in inline mode
|
|
247
|
+
* @default false
|
|
248
|
+
*/
|
|
249
|
+
showButtons?: boolean;
|
|
250
|
+
/**
|
|
251
|
+
* @description Automatically update input value when time changes (real-time updates)
|
|
252
|
+
* @default true
|
|
253
|
+
*/
|
|
254
|
+
autoUpdate?: boolean;
|
|
255
|
+
};
|
|
256
|
+
/**
|
|
257
|
+
* @description Add additional custom CSS class to the timepicker wrapper element. The default 'timepicker-ui' class is always added.
|
|
258
|
+
* This allows multiple timepickers on the same page to have additional custom classes for styling or targeting.
|
|
259
|
+
* @example cssClass: "my-custom-timepicker"
|
|
260
|
+
* @default undefined
|
|
261
|
+
*/
|
|
262
|
+
cssClass?: string;
|
|
263
|
+
/**
|
|
264
|
+
* @description Callback triggered when the timepicker opens
|
|
265
|
+
* @example onOpen: (data) => console.log('Picker opened!', data)
|
|
266
|
+
*/
|
|
267
|
+
onOpen?: TimepickerEventCallback;
|
|
268
|
+
/**
|
|
269
|
+
* @description Callback triggered when user cancels the timepicker
|
|
270
|
+
* @example onCancel: (data) => console.log('Cancelled', data)
|
|
271
|
+
*/
|
|
272
|
+
onCancel?: TimepickerEventCallback;
|
|
273
|
+
/**
|
|
274
|
+
* @description Callback triggered when user confirms the time selection (clicks OK)
|
|
275
|
+
* @example onConfirm: (data) => console.log('Time confirmed', data)
|
|
276
|
+
*/
|
|
277
|
+
onConfirm?: TimepickerEventCallback;
|
|
278
|
+
/**
|
|
279
|
+
* @description Callback triggered during interaction with the clock (real-time updates)
|
|
280
|
+
* @example onUpdate: (data) => console.log('Time updated', data)
|
|
281
|
+
*/
|
|
282
|
+
onUpdate?: TimepickerEventCallback;
|
|
283
|
+
/**
|
|
284
|
+
* @description Callback triggered when hour selection mode is activated
|
|
285
|
+
* @example onSelectHour: (data) => console.log('Hour mode selected', data)
|
|
286
|
+
*/
|
|
287
|
+
onSelectHour?: TimepickerEventCallback;
|
|
288
|
+
/**
|
|
289
|
+
* @description Callback triggered when minute selection mode is activated
|
|
290
|
+
* @example onSelectMinute: (data) => console.log('Minute mode selected', data)
|
|
291
|
+
*/
|
|
292
|
+
onSelectMinute?: TimepickerEventCallback;
|
|
293
|
+
/**
|
|
294
|
+
* @description Callback triggered when AM is selected
|
|
295
|
+
* @example onSelectAM: (data) => console.log('AM selected', data)
|
|
296
|
+
*/
|
|
297
|
+
onSelectAM?: TimepickerEventCallback;
|
|
298
|
+
/**
|
|
299
|
+
* @description Callback triggered when PM is selected
|
|
300
|
+
* @example onSelectPM: (data) => console.log('PM selected', data)
|
|
301
|
+
*/
|
|
302
|
+
onSelectPM?: TimepickerEventCallback;
|
|
303
|
+
/**
|
|
304
|
+
* @description Callback triggered when invalid time format is detected in input
|
|
305
|
+
* @example onError: (data) => console.log('Invalid format:', data.error)
|
|
306
|
+
*/
|
|
307
|
+
onError?: TimepickerEventCallback;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
interface ITimepickerUI {
|
|
311
|
+
_degreesHours: number | null;
|
|
312
|
+
_degreesMinutes: number | null;
|
|
313
|
+
_eventsBundle: () => void;
|
|
314
|
+
_options: OptionTypes;
|
|
315
|
+
_eventsClickMobile: (event: Event) => Promise<void>;
|
|
316
|
+
_eventsClickMobileHandler: EventListenerOrEventListenerObject;
|
|
317
|
+
_mutliEventsMove: (event: Event) => void;
|
|
318
|
+
_mutliEventsMoveHandler: EventListenerOrEventListenerObject;
|
|
319
|
+
_clickTouchEvents: string[];
|
|
320
|
+
_element: HTMLElement;
|
|
321
|
+
_instanceId: string;
|
|
322
|
+
_isMobileView: boolean | null;
|
|
323
|
+
_isTouchMouseMove: boolean | null;
|
|
324
|
+
_disabledTime: any;
|
|
325
|
+
_cloned: Node | null;
|
|
326
|
+
_inputEvents: string[];
|
|
327
|
+
_isModalRemove?: boolean;
|
|
328
|
+
_isInitialized: boolean;
|
|
329
|
+
_customId?: string;
|
|
330
|
+
|
|
331
|
+
readonly modalTemplate: string;
|
|
332
|
+
readonly modalElement: HTMLDivElement;
|
|
333
|
+
readonly clockFace: HTMLDivElement;
|
|
334
|
+
readonly input: HTMLInputElement;
|
|
335
|
+
readonly clockHand: HTMLDivElement;
|
|
336
|
+
readonly circle: HTMLDivElement;
|
|
337
|
+
readonly tipsWrapper: HTMLDivElement;
|
|
338
|
+
readonly tipsWrapperFor24h: HTMLDivElement;
|
|
339
|
+
readonly minutes: HTMLInputElement;
|
|
340
|
+
readonly hour: HTMLInputElement;
|
|
341
|
+
readonly AM: HTMLDivElement;
|
|
342
|
+
readonly PM: HTMLDivElement;
|
|
343
|
+
readonly minutesTips: HTMLDivElement;
|
|
344
|
+
readonly hourTips: HTMLDivElement;
|
|
345
|
+
readonly allValueTips: readonly HTMLDivElement[];
|
|
346
|
+
readonly openElementData: string[] | null;
|
|
347
|
+
readonly openElement: any;
|
|
348
|
+
readonly cancelButton: HTMLButtonElement;
|
|
349
|
+
readonly okButton: HTMLButtonElement;
|
|
350
|
+
readonly activeTypeMode: HTMLButtonElement;
|
|
351
|
+
readonly keyboardClockIcon: HTMLButtonElement;
|
|
352
|
+
readonly footer: HTMLDivElement;
|
|
353
|
+
readonly wrapper: HTMLDivElement;
|
|
354
|
+
|
|
355
|
+
create(): void;
|
|
356
|
+
open(callback?: () => void): void;
|
|
357
|
+
close(): (...args: (boolean | (() => void))[]) => void;
|
|
358
|
+
destroy(options?: { keepInputValue?: boolean; callback?: () => void } | (() => void)): void;
|
|
359
|
+
update(value: { options: OptionTypes; create?: boolean }, callback?: () => void): void;
|
|
360
|
+
getElement(): HTMLElement;
|
|
361
|
+
getValue(): {
|
|
362
|
+
hour: string;
|
|
363
|
+
minutes: string;
|
|
364
|
+
type?: string;
|
|
365
|
+
time: string;
|
|
366
|
+
degreesHours: number | null;
|
|
367
|
+
degreesMinutes: number | null;
|
|
368
|
+
};
|
|
369
|
+
setValue(time: string, updateInput?: boolean): void;
|
|
370
|
+
|
|
371
|
+
eventManager?: any;
|
|
372
|
+
modalManager?: any;
|
|
373
|
+
animationManager?: any;
|
|
374
|
+
clockManager?: any;
|
|
375
|
+
validationManager?: any;
|
|
376
|
+
themeManager?: any;
|
|
377
|
+
configManager?: any;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
declare class EventManager {
|
|
381
|
+
private timepicker;
|
|
382
|
+
constructor(timepicker: ITimepickerUI);
|
|
383
|
+
/** @internal */
|
|
384
|
+
handleOpenOnClick: () => void;
|
|
385
|
+
/** @internal */
|
|
386
|
+
handleOpenOnEnterFocus: () => void;
|
|
387
|
+
/** @internal */
|
|
388
|
+
handleCancelButton: () => void;
|
|
389
|
+
/** @internal */
|
|
390
|
+
handleOkButton: () => void;
|
|
391
|
+
/** @internal */
|
|
392
|
+
handleBackdropClick: () => void;
|
|
393
|
+
/** @internal */
|
|
394
|
+
getDestructuringObj(isAmPm?: boolean): {
|
|
395
|
+
minutesToUpdate: {
|
|
396
|
+
actualHour: string;
|
|
397
|
+
pmHours: any;
|
|
398
|
+
amHours: any;
|
|
399
|
+
activeMode: string | null;
|
|
400
|
+
startMinutes: any;
|
|
401
|
+
endMinutes: any;
|
|
402
|
+
removedAmHour: any;
|
|
403
|
+
removedPmHour: any;
|
|
404
|
+
removedEndHour?: undefined;
|
|
405
|
+
removedStartedHour?: undefined;
|
|
406
|
+
};
|
|
407
|
+
} | {
|
|
408
|
+
minutesToUpdate: {
|
|
409
|
+
endMinutes: any;
|
|
410
|
+
removedEndHour: any;
|
|
411
|
+
removedStartedHour: any;
|
|
412
|
+
actualHour: string;
|
|
413
|
+
startMinutes: any;
|
|
414
|
+
pmHours?: undefined;
|
|
415
|
+
amHours?: undefined;
|
|
416
|
+
activeMode?: undefined;
|
|
417
|
+
removedAmHour?: undefined;
|
|
418
|
+
removedPmHour?: undefined;
|
|
419
|
+
};
|
|
420
|
+
};
|
|
421
|
+
/** @internal */
|
|
422
|
+
handleAmClick: () => void;
|
|
423
|
+
/** @internal */
|
|
424
|
+
handlePmClick: () => void;
|
|
425
|
+
/** @internal */
|
|
426
|
+
handleClasses24h: (ev: any, element?: HTMLInputElement) => void;
|
|
427
|
+
/** @internal */
|
|
428
|
+
handleHourEvents: () => void;
|
|
429
|
+
/** @internal */
|
|
430
|
+
handleMinutesEvents: () => void;
|
|
431
|
+
/** @internal */
|
|
432
|
+
handleEventToMoveHand: (event: TouchEvent) => void;
|
|
433
|
+
/** @internal */
|
|
434
|
+
handleMoveHand: () => void;
|
|
435
|
+
/** @internal */
|
|
436
|
+
handleClickOnHourMobile: () => void;
|
|
437
|
+
/** @internal */
|
|
438
|
+
handlerClickHourMinutes: (event: Event) => Promise<void>;
|
|
439
|
+
/** @internal */
|
|
440
|
+
handleIconChangeView: () => Promise<void>;
|
|
441
|
+
/** @internal */
|
|
442
|
+
handleKeyPress: (e: KeyboardEvent) => void;
|
|
443
|
+
/** @internal */
|
|
444
|
+
handleEscClick: () => void;
|
|
445
|
+
/** @internal */
|
|
446
|
+
focusTrapHandler: () => void;
|
|
447
|
+
/**
|
|
448
|
+
* @description Handle real-time input updates for inline mode
|
|
449
|
+
*/
|
|
450
|
+
/** @internal */
|
|
451
|
+
handleInlineAutoUpdate: () => void;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
declare class ModalManager {
|
|
455
|
+
private timepicker;
|
|
456
|
+
constructor(timepicker: ITimepickerUI);
|
|
457
|
+
/** @internal */
|
|
458
|
+
setModalTemplate: () => void;
|
|
459
|
+
/** @internal */
|
|
460
|
+
setScrollbarOrNot: () => void;
|
|
461
|
+
/** @internal */
|
|
462
|
+
removeBackdrop: () => void;
|
|
463
|
+
/** @internal */
|
|
464
|
+
setNormalizeClass: () => void;
|
|
465
|
+
/** @internal */
|
|
466
|
+
setShowClassToBackdrop: () => void;
|
|
467
|
+
/** @internal */
|
|
468
|
+
setFlexEndToFooterIfNoKeyboardIcon: () => void;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
declare class AnimationManager {
|
|
472
|
+
private timepicker;
|
|
473
|
+
constructor(timepicker: ITimepickerUI);
|
|
474
|
+
/** @internal */
|
|
475
|
+
setAnimationToOpen(): void;
|
|
476
|
+
/** @internal */
|
|
477
|
+
removeAnimationToClose(): void;
|
|
478
|
+
/** @internal */
|
|
479
|
+
handleAnimationClock(): void;
|
|
480
|
+
/** @internal */
|
|
481
|
+
handleAnimationSwitchTipsMode(): void;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
declare class ClockManager {
|
|
485
|
+
private timepicker;
|
|
486
|
+
constructor(timepicker: ITimepickerUI);
|
|
487
|
+
/** @internal */
|
|
488
|
+
removeCircleClockClasses24h(): void;
|
|
489
|
+
/** @internal */
|
|
490
|
+
setCircleClockClasses24h(): void;
|
|
491
|
+
/** @internal */
|
|
492
|
+
setOnStartCSSClassesIfClockType24h(): void;
|
|
493
|
+
/** @internal */
|
|
494
|
+
setBgColorToCirleWithHourTips: () => void;
|
|
495
|
+
/** @internal */
|
|
496
|
+
setBgColorToCircleWithMinutesTips: () => void;
|
|
497
|
+
/** @internal */
|
|
498
|
+
removeBgColorToCirleWithMinutesTips: () => void;
|
|
499
|
+
/** @internal */
|
|
500
|
+
setClassActiveToHourOnOpen: () => void;
|
|
501
|
+
/** @internal */
|
|
502
|
+
setMinutesToClock: (value: string | null) => void;
|
|
503
|
+
/** @internal */
|
|
504
|
+
setHoursToClock: (value: string | null) => void;
|
|
505
|
+
/** @internal */
|
|
506
|
+
setTransformToCircleWithSwitchesHour: (val: string | null) => void;
|
|
507
|
+
/** @internal */
|
|
508
|
+
setTransformToCircleWithSwitchesMinutes: (val: string | null) => void;
|
|
509
|
+
/** @internal */
|
|
510
|
+
toggleClassActiveToValueTips: (value: string | number | null) => void;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
declare class ValidationManager {
|
|
514
|
+
private timepicker;
|
|
515
|
+
constructor(timepicker: ITimepickerUI);
|
|
516
|
+
/** @internal */
|
|
517
|
+
setErrorHandler(): void;
|
|
518
|
+
/** @internal */
|
|
519
|
+
removeErrorHandler(): void;
|
|
520
|
+
/** @internal */
|
|
521
|
+
checkDisabledValuesOnStart(): void;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
declare class ThemeManager {
|
|
525
|
+
private timepicker;
|
|
526
|
+
constructor(timepicker: ITimepickerUI);
|
|
527
|
+
/** @internal */
|
|
528
|
+
setTheme: () => void;
|
|
529
|
+
/** @internal */
|
|
530
|
+
setInputClassToInputElement: () => void;
|
|
531
|
+
/** @internal */
|
|
532
|
+
setDataOpenToInputIfDosentExistInWrapper: () => void;
|
|
533
|
+
/** @internal */
|
|
534
|
+
setClassTopOpenElement: () => void;
|
|
535
|
+
/** @internal */
|
|
536
|
+
setTimepickerClassToElement: () => void;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
type InputValueResult = {
|
|
540
|
+
hour: string;
|
|
541
|
+
minutes: string;
|
|
542
|
+
type?: string;
|
|
543
|
+
error?: string;
|
|
544
|
+
currentHour?: string | number;
|
|
545
|
+
currentMin?: string | number;
|
|
546
|
+
currentType?: string;
|
|
547
|
+
currentLength?: number;
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
declare class ConfigManager {
|
|
551
|
+
private timepicker;
|
|
552
|
+
constructor(timepicker: ITimepickerUI);
|
|
553
|
+
/** @internal */
|
|
554
|
+
preventClockTypeByCurrentTime: () => void;
|
|
555
|
+
/** @internal */
|
|
556
|
+
updateInputValueWithCurrentTimeOnStart: () => void;
|
|
557
|
+
/** @internal */
|
|
558
|
+
checkMobileOption(): void;
|
|
559
|
+
/** @internal */
|
|
560
|
+
getDisableTime(): void;
|
|
561
|
+
/** @internal */
|
|
562
|
+
getInputValueOnOpenAndSet: () => void;
|
|
563
|
+
/** @internal */
|
|
564
|
+
handlerViewChange: () => () => void;
|
|
565
|
+
/** @internal */
|
|
566
|
+
getInputValue: (el: HTMLInputElement, clockType?: string, currentTime?: OptionTypes["currentTime"], updateOptions?: boolean) => InputValueResult;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
type TypeFunction = () => void;
|
|
570
|
+
declare class TimepickerUI implements ITimepickerUI {
|
|
571
|
+
_degreesHours: number | null;
|
|
572
|
+
_degreesMinutes: number | null;
|
|
573
|
+
_options: OptionTypes;
|
|
574
|
+
_eventsClickMobile: (event: Event) => Promise<void>;
|
|
575
|
+
_eventsClickMobileHandler: EventListenerOrEventListenerObject;
|
|
576
|
+
_mutliEventsMove: (event: Event) => void;
|
|
577
|
+
_mutliEventsMoveHandler: EventListenerOrEventListenerObject;
|
|
578
|
+
_clickTouchEvents: string[];
|
|
579
|
+
_element: HTMLElement;
|
|
580
|
+
_instanceId: string;
|
|
581
|
+
_isMobileView: boolean | null;
|
|
582
|
+
_isTouchMouseMove: boolean | null;
|
|
583
|
+
_disabledTime: any;
|
|
584
|
+
_cloned: Node | null;
|
|
585
|
+
_inputEvents: string[];
|
|
586
|
+
_isModalRemove?: boolean;
|
|
587
|
+
_isInitialized: boolean;
|
|
588
|
+
_customId?: string;
|
|
589
|
+
_eventHandlersRegistered: boolean;
|
|
590
|
+
_isDestroyed: boolean;
|
|
591
|
+
eventManager: EventManager;
|
|
592
|
+
modalManager: ModalManager;
|
|
593
|
+
animationManager: AnimationManager;
|
|
594
|
+
clockManager: ClockManager;
|
|
595
|
+
validationManager: ValidationManager;
|
|
596
|
+
themeManager: ThemeManager;
|
|
597
|
+
configManager: ConfigManager;
|
|
598
|
+
constructor(selectorOrElement: string | HTMLElement, options?: OptionTypes);
|
|
599
|
+
/**
|
|
600
|
+
* @description Static method to get a timepicker instance by its ID
|
|
601
|
+
* @param id - The ID of the timepicker instance
|
|
602
|
+
* @returns TimepickerUI instance or undefined if not found
|
|
603
|
+
*/
|
|
604
|
+
static getById(id: string): TimepickerUI | undefined;
|
|
605
|
+
/**
|
|
606
|
+
* @description Static method to get all active timepicker instances
|
|
607
|
+
* @returns Array of all active TimepickerUI instances
|
|
608
|
+
*/
|
|
609
|
+
static getAllInstances(): TimepickerUI[];
|
|
610
|
+
/**
|
|
611
|
+
* @description Static method to check if an element is available in the DOM
|
|
612
|
+
* @param selectorOrElement - String selector or HTMLElement to check
|
|
613
|
+
* @returns boolean indicating if the element exists
|
|
614
|
+
*/
|
|
615
|
+
static isAvailable(selectorOrElement: string | HTMLElement): boolean;
|
|
616
|
+
/**
|
|
617
|
+
* @description Static method to destroy all timepicker instances
|
|
618
|
+
*/
|
|
619
|
+
static destroyAll(): void;
|
|
620
|
+
/** @internal */
|
|
621
|
+
get modalTemplate(): string;
|
|
622
|
+
/** @internal */
|
|
623
|
+
get modalElement(): HTMLDivElement;
|
|
624
|
+
/** @internal */
|
|
625
|
+
get clockFace(): HTMLDivElement;
|
|
626
|
+
/** @internal */
|
|
627
|
+
get input(): HTMLInputElement;
|
|
628
|
+
/** @internal */
|
|
629
|
+
get clockHand(): HTMLDivElement;
|
|
630
|
+
/** @internal */
|
|
631
|
+
get circle(): HTMLDivElement;
|
|
632
|
+
/** @internal */
|
|
633
|
+
get tipsWrapper(): HTMLDivElement;
|
|
634
|
+
/** @internal */
|
|
635
|
+
get tipsWrapperFor24h(): HTMLDivElement;
|
|
636
|
+
/** @internal */
|
|
637
|
+
get minutes(): HTMLInputElement;
|
|
638
|
+
/** @internal */
|
|
639
|
+
get hour(): HTMLInputElement;
|
|
640
|
+
/** @internal */
|
|
641
|
+
get AM(): HTMLDivElement;
|
|
642
|
+
/** @internal */
|
|
643
|
+
get PM(): HTMLDivElement;
|
|
644
|
+
/** @internal */
|
|
645
|
+
get minutesTips(): HTMLDivElement;
|
|
646
|
+
/** @internal */
|
|
647
|
+
get hourTips(): HTMLDivElement;
|
|
648
|
+
/** @internal */
|
|
649
|
+
get allValueTips(): HTMLDivElement[];
|
|
650
|
+
/** @internal */
|
|
651
|
+
get openElementData(): string[] | null;
|
|
652
|
+
/** @internal */
|
|
653
|
+
get openElement(): NodeListOf<Element> | HTMLInputElement[];
|
|
654
|
+
/** @internal */
|
|
655
|
+
get cancelButton(): HTMLButtonElement;
|
|
656
|
+
/** @internal */
|
|
657
|
+
get okButton(): HTMLButtonElement;
|
|
658
|
+
/** @internal */
|
|
659
|
+
get activeTypeMode(): HTMLButtonElement;
|
|
660
|
+
/** @internal */
|
|
661
|
+
get keyboardClockIcon(): HTMLButtonElement;
|
|
662
|
+
/** @internal */
|
|
663
|
+
get footer(): HTMLDivElement;
|
|
664
|
+
/** @internal */
|
|
665
|
+
get wrapper(): HTMLDivElement;
|
|
666
|
+
/**
|
|
667
|
+
* @description Returns the root wrapper element (`.timepicker-ui`) for this instance.
|
|
668
|
+
* This is the element that dispatches custom events like `timepicker:confirm`.
|
|
669
|
+
* @returns {HTMLElement}
|
|
670
|
+
*/
|
|
671
|
+
getElement(): HTMLElement;
|
|
672
|
+
/**
|
|
673
|
+
* @description The create method that init timepicker
|
|
674
|
+
*/
|
|
675
|
+
create: () => void;
|
|
676
|
+
/**
|
|
677
|
+
* @description The open method opens immediately timepicker after init
|
|
678
|
+
* @param callback - The callback function triggered when timepicker is open by this method
|
|
679
|
+
*/
|
|
680
|
+
open: (callback?: () => void) => void;
|
|
681
|
+
/**
|
|
682
|
+
* @description Closure method closes the timepicker with double parentheses
|
|
683
|
+
* @param args - The first parentheses doesn't have any paremeters. The second parentheses accepts parameters and these parameters are optional in this method and order is any. You can set callback function first or boolean,
|
|
684
|
+
* or just boolean or just callback. If the boolean is set to true the input will be updating with the current value on picker.
|
|
685
|
+
* The callback function start immediately after close, if is invoke. The max parameters length is set to 2
|
|
686
|
+
*/
|
|
687
|
+
close: () => (...args: (boolean | TypeFunction)[]) => void;
|
|
688
|
+
/**
|
|
689
|
+
* @description
|
|
690
|
+
* Destroys the current TimepickerUI instance by:
|
|
691
|
+
* - removing all event listeners
|
|
692
|
+
* - cleaning up DOM elements related to the modal
|
|
693
|
+
* - removing all dynamically added classes and data attributes
|
|
694
|
+
* - clearing handler references for better garbage collection
|
|
695
|
+
* - resetting internal state
|
|
696
|
+
*
|
|
697
|
+
* The original element remains in place (no DOM cloning).
|
|
698
|
+
* Fully compatible with React, Vue, Angular and vanilla JS.
|
|
699
|
+
*
|
|
700
|
+
* @param options - Optional configuration object with:
|
|
701
|
+
* - keepInputValue: boolean - if true, preserves input value after destruction (default: false)
|
|
702
|
+
* - callback: function - callback executed after cleanup completes
|
|
703
|
+
*/
|
|
704
|
+
destroy: (options?: {
|
|
705
|
+
keepInputValue?: boolean;
|
|
706
|
+
callback?: TypeFunction;
|
|
707
|
+
} | TypeFunction) => void;
|
|
708
|
+
/**
|
|
709
|
+
* @description The update method which update timepicker with new options and can create a new instance.
|
|
710
|
+
* @param value - The first parameter is a object with key options which is timepicker options and it will be updated to current
|
|
711
|
+
* instance and is `required`. The `create` key is a boolean which if is set to true it starting the create() method after invoke update
|
|
712
|
+
* function and is optional. The `create` option is useful if you are using destroy and update methods together.
|
|
713
|
+
* @param callback - The `callback` function is started after update method. This parameter is optional.
|
|
714
|
+
*/
|
|
715
|
+
update: (value: {
|
|
716
|
+
options: OptionTypes;
|
|
717
|
+
create?: boolean;
|
|
718
|
+
}, callback?: TypeFunction) => void;
|
|
719
|
+
/**
|
|
720
|
+
* @description Get the current time value from the timepicker
|
|
721
|
+
* @returns Object with hour, minutes, type (AM/PM), and formatted time string
|
|
722
|
+
*/
|
|
723
|
+
getValue: () => {
|
|
724
|
+
hour: string;
|
|
725
|
+
minutes: string;
|
|
726
|
+
type?: string;
|
|
727
|
+
time: string;
|
|
728
|
+
degreesHours: number | null;
|
|
729
|
+
degreesMinutes: number | null;
|
|
730
|
+
};
|
|
731
|
+
/**
|
|
732
|
+
* @description Set the time value in the timepicker
|
|
733
|
+
* @param time - Time string in format "HH:MM" for 24h or "HH:MM AM/PM" for 12h
|
|
734
|
+
* @param updateInput - Whether to update the input element (default: true)
|
|
735
|
+
*/
|
|
736
|
+
setValue: (time: string, updateInput?: boolean) => void;
|
|
737
|
+
_eventsBundle: () => void;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
export { type OptionTypes, TimepickerUI };
|