timepicker-ui 3.0.1 → 3.1.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/README.md +204 -449
- package/dist/css/index.css +1 -1
- package/dist/css/main.css +1 -1
- package/dist/css/themes/theme-ai.css +1 -1
- package/dist/css/themes/theme-crane.css +1 -1
- package/dist/css/themes/theme-custom.css +1 -0
- package/dist/css/themes/theme-cyberpunk.css +1 -1
- package/dist/css/themes/theme-dark.css +1 -1
- package/dist/css/themes/theme-glassmorphic.css +1 -1
- package/dist/css/themes/theme-m3.css +1 -1
- package/dist/css/themes/theme-pastel.css +1 -1
- package/dist/index.cjs +40 -38
- package/dist/index.d.cts +360 -299
- package/dist/index.d.ts +360 -299
- package/dist/index.js +40 -38
- package/dist/index.umd.js +1 -1
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @description Callback
|
|
2
|
+
* @description Callback data type for timepicker events
|
|
3
3
|
*/
|
|
4
|
-
type
|
|
4
|
+
type CallbackData = {
|
|
5
5
|
hour?: string | null;
|
|
6
6
|
minutes?: string | null;
|
|
7
7
|
type?: string | null;
|
|
@@ -15,7 +15,12 @@ type TimepickerEventCallback = (eventData: {
|
|
|
15
15
|
currentMin?: string | number;
|
|
16
16
|
currentType?: string;
|
|
17
17
|
currentLength?: string | number;
|
|
18
|
-
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @description Callback function type for timepicker events
|
|
22
|
+
*/
|
|
23
|
+
type TimepickerEventCallback = (eventData: CallbackData) => void;
|
|
19
24
|
|
|
20
25
|
type OptionTypes = {
|
|
21
26
|
/**
|
|
@@ -124,8 +129,9 @@ type OptionTypes = {
|
|
|
124
129
|
*/
|
|
125
130
|
switchToMinutesAfterSelectHour?: boolean;
|
|
126
131
|
/**
|
|
127
|
-
* @description Set theme to timepicker. Available options: `basic`, `crane-straight`, `crane-radius`, `m3`.
|
|
128
|
-
|
|
132
|
+
* @description Set theme to timepicker. Available options: `basic`, `crane-straight`, `crane-radius`, `m3`, `dark`, `glassmorphic`, `pastel`, `ai`, `cyberpunk`, `custom`.
|
|
133
|
+
*
|
|
134
|
+
* The `custom` theme allows you to create your own styling by overriding CSS variables.
|
|
129
135
|
* The offical version of Material Design 3 is still not avaialbe for the WEB version.Theme `m3` has been added
|
|
130
136
|
* based on the design what you can find [here](https://m3.material.io/components/time-pickers/overview).
|
|
131
137
|
* If new version M3 will be released this design will get improve.
|
|
@@ -140,7 +146,8 @@ type OptionTypes = {
|
|
|
140
146
|
| 'glassmorphic'
|
|
141
147
|
| 'pastel'
|
|
142
148
|
| 'ai'
|
|
143
|
-
| 'cyberpunk'
|
|
149
|
+
| 'cyberpunk'
|
|
150
|
+
| 'custom';
|
|
144
151
|
/**
|
|
145
152
|
* @description Set type of clock, it contains 2 versions: `12h` and `24h`.
|
|
146
153
|
* @default false
|
|
@@ -148,20 +155,20 @@ type OptionTypes = {
|
|
|
148
155
|
clockType?: '12h' | '24h';
|
|
149
156
|
/**
|
|
150
157
|
* @description - The `hours` and `minutes` are arrays which accept strings and numbers to block select hours/minutes.
|
|
151
|
-
* - The `interval` key
|
|
158
|
+
* - The `interval` key can accept string or string[] to block select time intervals.
|
|
152
159
|
* - If the interval key is set, the hours/minutes keys are `ignored`.
|
|
153
160
|
* @example
|
|
154
161
|
disabledTime: {
|
|
155
162
|
minutes: [1,2,4,5,55,23,"22","38"],
|
|
156
163
|
hours: [1,"3","5", 8],
|
|
157
|
-
interval: "10:00 AM - 12:00 PM",
|
|
164
|
+
interval: "10:00 AM - 12:00 PM" | ["10:00 AM - 12:00 PM", "5:00 PM - 8:00 PM"],
|
|
158
165
|
}
|
|
159
166
|
* @default undefined
|
|
160
167
|
*/
|
|
161
168
|
disabledTime?: {
|
|
162
169
|
minutes?: Array<string | number>;
|
|
163
170
|
hours?: Array<string | number>;
|
|
164
|
-
interval?: string;
|
|
171
|
+
interval?: string | string[];
|
|
165
172
|
};
|
|
166
173
|
/**
|
|
167
174
|
* @description Set current time to the input and timepicker.\
|
|
@@ -307,178 +314,69 @@ type OptionTypes = {
|
|
|
307
314
|
onError?: TimepickerEventCallback;
|
|
308
315
|
};
|
|
309
316
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
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
|
-
}
|
|
317
|
+
type InputValueResult = {
|
|
318
|
+
hour: string;
|
|
319
|
+
minutes: string;
|
|
320
|
+
type?: string;
|
|
321
|
+
error?: string;
|
|
322
|
+
currentHour?: string | number;
|
|
323
|
+
currentMin?: string | number;
|
|
324
|
+
currentType?: string;
|
|
325
|
+
currentLength?: number;
|
|
326
|
+
};
|
|
379
327
|
|
|
380
|
-
declare class
|
|
328
|
+
declare class ConfigManager {
|
|
381
329
|
private timepicker;
|
|
330
|
+
private timeouts;
|
|
331
|
+
private debouncedHandler?;
|
|
382
332
|
constructor(timepicker: ITimepickerUI);
|
|
333
|
+
private clearAllTimeouts;
|
|
334
|
+
private runWithTimeout;
|
|
335
|
+
private isCurrentTimeEnabled;
|
|
383
336
|
/** @internal */
|
|
384
|
-
|
|
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;
|
|
337
|
+
preventClockTypeByCurrentTime: () => void;
|
|
437
338
|
/** @internal */
|
|
438
|
-
|
|
339
|
+
updateInputValueWithCurrentTimeOnStart: () => void;
|
|
439
340
|
/** @internal */
|
|
440
|
-
|
|
341
|
+
checkMobileOption(): void;
|
|
441
342
|
/** @internal */
|
|
442
|
-
|
|
343
|
+
getDisableTime(): void;
|
|
443
344
|
/** @internal */
|
|
444
|
-
|
|
345
|
+
getInputValueOnOpenAndSet: () => void;
|
|
346
|
+
private handleModeSwitch;
|
|
445
347
|
/** @internal */
|
|
446
|
-
|
|
447
|
-
/**
|
|
448
|
-
* @description Handle real-time input updates for inline mode
|
|
449
|
-
*/
|
|
348
|
+
handlerViewChange: () => (...args: any[]) => void;
|
|
450
349
|
/** @internal */
|
|
451
|
-
|
|
350
|
+
getInputValue: (el: HTMLInputElement, clockType?: string, currentTime?: OptionTypes["currentTime"], updateOptions?: boolean) => InputValueResult;
|
|
351
|
+
destroy(): void;
|
|
452
352
|
}
|
|
453
353
|
|
|
454
|
-
declare class
|
|
354
|
+
declare class ThemeManager {
|
|
455
355
|
private timepicker;
|
|
456
356
|
constructor(timepicker: ITimepickerUI);
|
|
457
357
|
/** @internal */
|
|
458
|
-
|
|
459
|
-
/** @internal */
|
|
460
|
-
setScrollbarOrNot: () => void;
|
|
358
|
+
setTheme: () => void;
|
|
461
359
|
/** @internal */
|
|
462
|
-
|
|
360
|
+
setInputClassToInputElement: () => void;
|
|
463
361
|
/** @internal */
|
|
464
|
-
|
|
362
|
+
setDataOpenToInputIfDoesntExistInWrapper: () => void;
|
|
465
363
|
/** @internal */
|
|
466
|
-
|
|
364
|
+
setClassTopOpenElement: () => void;
|
|
467
365
|
/** @internal */
|
|
468
|
-
|
|
366
|
+
setTimepickerClassToElement: () => void;
|
|
367
|
+
destroy(): void;
|
|
469
368
|
}
|
|
470
369
|
|
|
471
|
-
declare class
|
|
370
|
+
declare class ValidationManager {
|
|
472
371
|
private timepicker;
|
|
473
372
|
constructor(timepicker: ITimepickerUI);
|
|
474
373
|
/** @internal */
|
|
475
|
-
|
|
374
|
+
setErrorHandler(): boolean | undefined;
|
|
476
375
|
/** @internal */
|
|
477
|
-
|
|
478
|
-
/** @internal */
|
|
479
|
-
handleAnimationClock(): void;
|
|
376
|
+
removeErrorHandler(): void;
|
|
480
377
|
/** @internal */
|
|
481
|
-
|
|
378
|
+
checkDisabledValuesOnStart(): void;
|
|
379
|
+
destroy(): void;
|
|
482
380
|
}
|
|
483
381
|
|
|
484
382
|
declare class ClockManager {
|
|
@@ -491,8 +389,6 @@ declare class ClockManager {
|
|
|
491
389
|
/** @internal */
|
|
492
390
|
setOnStartCSSClassesIfClockType24h(): void;
|
|
493
391
|
/** @internal */
|
|
494
|
-
setBgColorToCirleWithHourTips: () => void;
|
|
495
|
-
/** @internal */
|
|
496
392
|
setBgColorToCircleWithMinutesTips: () => void;
|
|
497
393
|
/** @internal */
|
|
498
394
|
removeBgColorToCirleWithMinutesTips: () => void;
|
|
@@ -510,64 +406,263 @@ declare class ClockManager {
|
|
|
510
406
|
toggleClassActiveToValueTips: (value: string | number | null) => void;
|
|
511
407
|
}
|
|
512
408
|
|
|
513
|
-
declare class
|
|
409
|
+
declare class AnimationManager {
|
|
514
410
|
private timepicker;
|
|
411
|
+
private timeouts;
|
|
515
412
|
constructor(timepicker: ITimepickerUI);
|
|
413
|
+
private runWithAnimation;
|
|
414
|
+
private clearAllTimeouts;
|
|
516
415
|
/** @internal */
|
|
517
|
-
|
|
416
|
+
setAnimationToOpen(): void;
|
|
518
417
|
/** @internal */
|
|
519
|
-
|
|
418
|
+
removeAnimationToClose(): void;
|
|
520
419
|
/** @internal */
|
|
521
|
-
|
|
420
|
+
handleAnimationClock(): void;
|
|
421
|
+
/** @internal */
|
|
422
|
+
handleAnimationSwitchTipsMode(): void;
|
|
423
|
+
/** @internal */
|
|
424
|
+
destroy(): void;
|
|
522
425
|
}
|
|
523
426
|
|
|
524
|
-
declare class
|
|
427
|
+
declare class ModalManager {
|
|
525
428
|
private timepicker;
|
|
429
|
+
private timeouts;
|
|
430
|
+
private originalOverflow?;
|
|
431
|
+
private originalPaddingRight?;
|
|
526
432
|
constructor(timepicker: ITimepickerUI);
|
|
433
|
+
private runWithTimeout;
|
|
434
|
+
private clearAllTimeouts;
|
|
435
|
+
private clearExistingModal;
|
|
527
436
|
/** @internal */
|
|
528
|
-
|
|
437
|
+
setModalTemplate: () => void;
|
|
529
438
|
/** @internal */
|
|
530
|
-
|
|
439
|
+
setScrollbarOrNot: () => void;
|
|
531
440
|
/** @internal */
|
|
532
|
-
|
|
441
|
+
removeBackdrop: () => void;
|
|
533
442
|
/** @internal */
|
|
534
|
-
|
|
443
|
+
setNormalizeClass: () => void;
|
|
535
444
|
/** @internal */
|
|
536
|
-
|
|
445
|
+
setShowClassToBackdrop: () => void;
|
|
446
|
+
/** @internal */
|
|
447
|
+
setFlexEndToFooterIfNoKeyboardIcon: () => void;
|
|
448
|
+
/** Cleanup to avoid leaks */
|
|
449
|
+
destroy(): void;
|
|
537
450
|
}
|
|
538
451
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
};
|
|
549
|
-
|
|
550
|
-
declare class ConfigManager {
|
|
551
|
-
private timepicker;
|
|
452
|
+
declare class EventManager {
|
|
453
|
+
private _cleanupHandlers;
|
|
454
|
+
private buttonHandlers;
|
|
455
|
+
private dragHandlers;
|
|
456
|
+
private typeModeHandlers;
|
|
457
|
+
private inputHandlers;
|
|
458
|
+
private clockHandPositionUpdater;
|
|
459
|
+
private miscHandlers;
|
|
460
|
+
private inlineHandlers;
|
|
552
461
|
constructor(timepicker: ITimepickerUI);
|
|
462
|
+
destroy(): void;
|
|
463
|
+
handleOpenOnClick: () => void;
|
|
464
|
+
handleOpenOnEnterFocus: () => void;
|
|
465
|
+
handleCancelButton: () => void;
|
|
466
|
+
handleOkButton: () => void;
|
|
467
|
+
handleBackdropClick: () => void;
|
|
468
|
+
handleAmClick: () => void;
|
|
469
|
+
handlePmClick: () => void;
|
|
470
|
+
handleHourEvents: () => void;
|
|
471
|
+
handleMinutesEvents: () => void;
|
|
472
|
+
handleEventToMoveHand: (event: TouchEvent) => void;
|
|
473
|
+
handleMoveHand: () => void;
|
|
474
|
+
handleClickOnHourMobile: () => void;
|
|
475
|
+
handlerClickHourMinutes: (event: Event) => Promise<void>;
|
|
476
|
+
handleIconChangeView: () => Promise<void>;
|
|
477
|
+
handleEscClick: () => void;
|
|
478
|
+
focusTrapHandler: () => void;
|
|
479
|
+
handleInlineAutoUpdate: () => void;
|
|
480
|
+
get _isDragging(): boolean;
|
|
481
|
+
get _animationFrameId(): number | null;
|
|
482
|
+
_onDragStart: (event: MouseEvent | TouchEvent) => void;
|
|
483
|
+
_onDragMove: (event: MouseEvent | TouchEvent) => void;
|
|
484
|
+
_onDragEnd: (event: MouseEvent | TouchEvent) => void;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
declare class ClockFaceManager {
|
|
488
|
+
private array?;
|
|
489
|
+
private classToAdd?;
|
|
490
|
+
private clockFace?;
|
|
491
|
+
private tipsWrapper?;
|
|
492
|
+
private theme?;
|
|
493
|
+
private clockType?;
|
|
494
|
+
private disabledTime?;
|
|
495
|
+
private hour?;
|
|
496
|
+
private activeTypeMode?;
|
|
497
|
+
constructor(obj?: {
|
|
498
|
+
array?: string[];
|
|
499
|
+
classToAdd?: string;
|
|
500
|
+
clockFace?: HTMLElement;
|
|
501
|
+
tipsWrapper?: HTMLElement;
|
|
502
|
+
theme?: string;
|
|
503
|
+
clockType?: string;
|
|
504
|
+
disabledTime?: any;
|
|
505
|
+
hour?: any;
|
|
506
|
+
activeTypeMode?: string;
|
|
507
|
+
});
|
|
508
|
+
/** @internal */
|
|
509
|
+
clean: () => void;
|
|
553
510
|
/** @internal */
|
|
554
|
-
|
|
555
|
-
/** @internal */
|
|
556
|
-
updateInputValueWithCurrentTimeOnStart: () => void;
|
|
557
|
-
/** @internal */
|
|
558
|
-
checkMobileOption(): void;
|
|
559
|
-
/** @internal */
|
|
560
|
-
getDisableTime(): void;
|
|
561
|
-
/** @internal */
|
|
562
|
-
getInputValueOnOpenAndSet: () => void;
|
|
511
|
+
create: () => void;
|
|
563
512
|
/** @internal */
|
|
564
|
-
|
|
513
|
+
updateDisable: (hour?: string, activeTypeMode?: string) => void;
|
|
565
514
|
/** @internal */
|
|
566
|
-
|
|
515
|
+
private _removeClasses;
|
|
516
|
+
/** Cleanup */
|
|
517
|
+
destroy(): void;
|
|
567
518
|
}
|
|
568
519
|
|
|
569
|
-
|
|
570
|
-
|
|
520
|
+
interface ClockFaceConfig {
|
|
521
|
+
array?: string[];
|
|
522
|
+
classToAdd?: string;
|
|
523
|
+
clockFace?: HTMLElement;
|
|
524
|
+
tipsWrapper?: HTMLElement;
|
|
525
|
+
theme?: string;
|
|
526
|
+
clockType?: string;
|
|
527
|
+
disabledTime?: {
|
|
528
|
+
isInterval?: boolean;
|
|
529
|
+
intervals?: string[];
|
|
530
|
+
clockType?: string;
|
|
531
|
+
} | string[] | null;
|
|
532
|
+
hour?: string;
|
|
533
|
+
activeTypeMode?: string;
|
|
534
|
+
}
|
|
535
|
+
declare class ClockFaceManagerPool {
|
|
536
|
+
private pool;
|
|
537
|
+
private maxSize;
|
|
538
|
+
acquire(config: ClockFaceConfig): ClockFaceManager;
|
|
539
|
+
release(instance: ClockFaceManager): void;
|
|
540
|
+
clear(): void;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
type EventHandler<T = CallbackData> = (data: T) => void;
|
|
544
|
+
interface TimepickerEventMap {
|
|
545
|
+
open: CallbackData;
|
|
546
|
+
cancel: CallbackData;
|
|
547
|
+
confirm: CallbackData;
|
|
548
|
+
show: CallbackData;
|
|
549
|
+
hide: CallbackData;
|
|
550
|
+
update: CallbackData;
|
|
551
|
+
'select:hour': CallbackData;
|
|
552
|
+
'select:minute': CallbackData;
|
|
553
|
+
'select:am': CallbackData;
|
|
554
|
+
'select:pm': CallbackData;
|
|
555
|
+
error: CallbackData;
|
|
556
|
+
}
|
|
557
|
+
declare class EventEmitter<EventMap extends Record<string, any> = TimepickerEventMap> {
|
|
558
|
+
private events;
|
|
559
|
+
on<K extends keyof EventMap>(event: K, handler: EventHandler<EventMap[K]>): void;
|
|
560
|
+
once<K extends keyof EventMap>(event: K, handler: EventHandler<EventMap[K]>): void;
|
|
561
|
+
off<K extends keyof EventMap>(event: K, handler?: EventHandler<EventMap[K]>): void;
|
|
562
|
+
emit<K extends keyof EventMap>(event: K, data?: EventMap[K]): void;
|
|
563
|
+
clear(): void;
|
|
564
|
+
hasListeners<K extends keyof EventMap>(event: K): boolean;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
interface ITimepickerUI {
|
|
568
|
+
_degreesHours: number | null;
|
|
569
|
+
_degreesMinutes: number | null;
|
|
570
|
+
_eventsBundle: () => void;
|
|
571
|
+
_options: OptionTypes;
|
|
572
|
+
_eventsClickMobile: (event: Event) => Promise<void>;
|
|
573
|
+
_eventsClickMobileHandler: EventListenerOrEventListenerObject;
|
|
574
|
+
_mutliEventsMove: (event: Event) => void;
|
|
575
|
+
_mutliEventsMoveHandler: EventListenerOrEventListenerObject;
|
|
576
|
+
_clickTouchEvents: string[];
|
|
577
|
+
_element: HTMLElement;
|
|
578
|
+
_instanceId: string;
|
|
579
|
+
_isMobileView: boolean | null;
|
|
580
|
+
_isTouchMouseMove: boolean | null;
|
|
581
|
+
_disabledTime: {
|
|
582
|
+
value?: {
|
|
583
|
+
isInterval?: boolean;
|
|
584
|
+
intervals?: string[];
|
|
585
|
+
clockType?: string;
|
|
586
|
+
hours?: string[];
|
|
587
|
+
minutes?: string[];
|
|
588
|
+
};
|
|
589
|
+
} | null;
|
|
590
|
+
_cloned: Node | null;
|
|
591
|
+
_inputEvents: string[];
|
|
592
|
+
_isModalRemove?: boolean;
|
|
593
|
+
_isInitialized: boolean;
|
|
594
|
+
_customId?: string;
|
|
595
|
+
|
|
596
|
+
clockFacePool: ClockFaceManagerPool;
|
|
597
|
+
|
|
598
|
+
readonly modalTemplate: string;
|
|
599
|
+
readonly modalElement: HTMLDivElement;
|
|
600
|
+
readonly clockFace: HTMLDivElement;
|
|
601
|
+
readonly input: HTMLInputElement;
|
|
602
|
+
readonly clockHand: HTMLDivElement;
|
|
603
|
+
readonly circle: HTMLDivElement;
|
|
604
|
+
readonly tipsWrapper: HTMLDivElement;
|
|
605
|
+
readonly tipsWrapperFor24h: HTMLDivElement;
|
|
606
|
+
readonly minutes: HTMLInputElement;
|
|
607
|
+
readonly hour: HTMLInputElement;
|
|
608
|
+
readonly AM: HTMLDivElement;
|
|
609
|
+
readonly PM: HTMLDivElement;
|
|
610
|
+
readonly minutesTips: HTMLDivElement;
|
|
611
|
+
readonly hourTips: HTMLDivElement;
|
|
612
|
+
readonly allValueTips: readonly HTMLDivElement[];
|
|
613
|
+
readonly openElementData: string[] | null;
|
|
614
|
+
readonly openElement: NodeListOf<Element> | readonly [HTMLInputElement];
|
|
615
|
+
readonly cancelButton: HTMLButtonElement;
|
|
616
|
+
readonly okButton: HTMLButtonElement;
|
|
617
|
+
readonly activeTypeMode: HTMLButtonElement;
|
|
618
|
+
readonly keyboardClockIcon: HTMLButtonElement;
|
|
619
|
+
readonly footer: HTMLDivElement;
|
|
620
|
+
readonly wrapper: HTMLDivElement;
|
|
621
|
+
|
|
622
|
+
create(): void;
|
|
623
|
+
open(callback?: () => void): void;
|
|
624
|
+
close(): (...args: (boolean | (() => void))[]) => void;
|
|
625
|
+
destroy(options?: { keepInputValue?: boolean; callback?: () => void } | (() => void)): void;
|
|
626
|
+
update(value: { options: OptionTypes; create?: boolean }, callback?: () => void): void;
|
|
627
|
+
getElement(): HTMLElement;
|
|
628
|
+
getValue(): {
|
|
629
|
+
hour: string;
|
|
630
|
+
minutes: string;
|
|
631
|
+
type?: string;
|
|
632
|
+
time: string;
|
|
633
|
+
degreesHours: number | null;
|
|
634
|
+
degreesMinutes: number | null;
|
|
635
|
+
};
|
|
636
|
+
setValue(time: string, updateInput?: boolean): void;
|
|
637
|
+
setTheme(themeConfig: {
|
|
638
|
+
primaryColor?: string;
|
|
639
|
+
backgroundColor?: string;
|
|
640
|
+
surfaceColor?: string;
|
|
641
|
+
surfaceHoverColor?: string;
|
|
642
|
+
textColor?: string;
|
|
643
|
+
secondaryTextColor?: string;
|
|
644
|
+
disabledTextColor?: string;
|
|
645
|
+
onPrimaryColor?: string;
|
|
646
|
+
borderColor?: string;
|
|
647
|
+
shadow?: string;
|
|
648
|
+
borderRadius?: string;
|
|
649
|
+
fontFamily?: string;
|
|
650
|
+
}): void;
|
|
651
|
+
|
|
652
|
+
on<K extends keyof TimepickerEventMap>(event: K, handler: (data: TimepickerEventMap[K]) => void): void;
|
|
653
|
+
once<K extends keyof TimepickerEventMap>(event: K, handler: (data: TimepickerEventMap[K]) => void): void;
|
|
654
|
+
off<K extends keyof TimepickerEventMap>(event: K, handler?: (data: TimepickerEventMap[K]) => void): void;
|
|
655
|
+
|
|
656
|
+
eventManager?: EventManager;
|
|
657
|
+
modalManager?: ModalManager;
|
|
658
|
+
animationManager?: AnimationManager;
|
|
659
|
+
clockManager?: ClockManager;
|
|
660
|
+
validationManager?: ValidationManager;
|
|
661
|
+
themeManager?: ThemeManager;
|
|
662
|
+
configManager?: ConfigManager;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
declare class TimepickerCore {
|
|
571
666
|
_degreesHours: number | null;
|
|
572
667
|
_degreesMinutes: number | null;
|
|
573
668
|
_options: OptionTypes;
|
|
@@ -580,7 +675,15 @@ declare class TimepickerUI implements ITimepickerUI {
|
|
|
580
675
|
_instanceId: string;
|
|
581
676
|
_isMobileView: boolean | null;
|
|
582
677
|
_isTouchMouseMove: boolean | null;
|
|
583
|
-
_disabledTime:
|
|
678
|
+
_disabledTime: {
|
|
679
|
+
value?: {
|
|
680
|
+
isInterval?: boolean;
|
|
681
|
+
intervals?: string[];
|
|
682
|
+
clockType?: string;
|
|
683
|
+
hours?: string[];
|
|
684
|
+
minutes?: string[];
|
|
685
|
+
};
|
|
686
|
+
} | null;
|
|
584
687
|
_cloned: Node | null;
|
|
585
688
|
_inputEvents: string[];
|
|
586
689
|
_isModalRemove?: boolean;
|
|
@@ -588,6 +691,21 @@ declare class TimepickerUI implements ITimepickerUI {
|
|
|
588
691
|
_customId?: string;
|
|
589
692
|
_eventHandlersRegistered: boolean;
|
|
590
693
|
_isDestroyed: boolean;
|
|
694
|
+
_pendingThemeConfig?: {
|
|
695
|
+
primaryColor?: string;
|
|
696
|
+
backgroundColor?: string;
|
|
697
|
+
surfaceColor?: string;
|
|
698
|
+
surfaceHoverColor?: string;
|
|
699
|
+
textColor?: string;
|
|
700
|
+
secondaryTextColor?: string;
|
|
701
|
+
disabledTextColor?: string;
|
|
702
|
+
onPrimaryColor?: string;
|
|
703
|
+
borderColor?: string;
|
|
704
|
+
shadow?: string;
|
|
705
|
+
borderRadius?: string;
|
|
706
|
+
fontFamily?: string;
|
|
707
|
+
};
|
|
708
|
+
clockFacePool: ClockFaceManagerPool;
|
|
591
709
|
eventManager: EventManager;
|
|
592
710
|
modalManager: ModalManager;
|
|
593
711
|
animationManager: AnimationManager;
|
|
@@ -595,131 +713,54 @@ declare class TimepickerUI implements ITimepickerUI {
|
|
|
595
713
|
validationManager: ValidationManager;
|
|
596
714
|
themeManager: ThemeManager;
|
|
597
715
|
configManager: ConfigManager;
|
|
716
|
+
private _eventEmitter;
|
|
598
717
|
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 */
|
|
718
|
+
get modalTemplate(): any;
|
|
623
719
|
get modalElement(): HTMLDivElement;
|
|
624
|
-
/** @internal */
|
|
625
720
|
get clockFace(): HTMLDivElement;
|
|
626
|
-
/** @internal */
|
|
627
721
|
get input(): HTMLInputElement;
|
|
628
|
-
/** @internal */
|
|
629
722
|
get clockHand(): HTMLDivElement;
|
|
630
|
-
/** @internal */
|
|
631
723
|
get circle(): HTMLDivElement;
|
|
632
|
-
/** @internal */
|
|
633
724
|
get tipsWrapper(): HTMLDivElement;
|
|
634
|
-
/** @internal */
|
|
635
725
|
get tipsWrapperFor24h(): HTMLDivElement;
|
|
636
|
-
/** @internal */
|
|
637
726
|
get minutes(): HTMLInputElement;
|
|
638
|
-
/** @internal */
|
|
639
727
|
get hour(): HTMLInputElement;
|
|
640
|
-
/** @internal */
|
|
641
728
|
get AM(): HTMLDivElement;
|
|
642
|
-
/** @internal */
|
|
643
729
|
get PM(): HTMLDivElement;
|
|
644
|
-
/** @internal */
|
|
645
730
|
get minutesTips(): HTMLDivElement;
|
|
646
|
-
/** @internal */
|
|
647
731
|
get hourTips(): HTMLDivElement;
|
|
648
|
-
/** @internal */
|
|
649
732
|
get allValueTips(): HTMLDivElement[];
|
|
650
|
-
/** @internal */
|
|
651
733
|
get openElementData(): string[] | null;
|
|
652
|
-
|
|
653
|
-
get openElement(): NodeListOf<Element> | HTMLInputElement[];
|
|
654
|
-
/** @internal */
|
|
734
|
+
get openElement(): NodeListOf<Element> | readonly [HTMLInputElement];
|
|
655
735
|
get cancelButton(): HTMLButtonElement;
|
|
656
|
-
/** @internal */
|
|
657
736
|
get okButton(): HTMLButtonElement;
|
|
658
|
-
/** @internal */
|
|
659
737
|
get activeTypeMode(): HTMLButtonElement;
|
|
660
|
-
/** @internal */
|
|
661
738
|
get keyboardClockIcon(): HTMLButtonElement;
|
|
662
|
-
/** @internal */
|
|
663
739
|
get footer(): HTMLDivElement;
|
|
664
|
-
/** @internal */
|
|
665
740
|
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
741
|
getElement(): HTMLElement;
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
742
|
+
on<K extends keyof TimepickerEventMap>(event: K, handler: (data: TimepickerEventMap[K]) => void): void;
|
|
743
|
+
once<K extends keyof TimepickerEventMap>(event: K, handler: (data: TimepickerEventMap[K]) => void): void;
|
|
744
|
+
off<K extends keyof TimepickerEventMap>(event: K, handler?: (data: TimepickerEventMap[K]) => void): void;
|
|
745
|
+
protected emit<K extends keyof TimepickerEventMap>(event: K, data?: TimepickerEventMap[K]): void;
|
|
746
|
+
protected _applyThemeToWrapper(wrapper: HTMLElement): void;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
type TypeFunction$1 = () => void;
|
|
750
|
+
declare class TimepickerLifecycle extends TimepickerCore {
|
|
675
751
|
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
752
|
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
|
-
*/
|
|
753
|
+
close: () => (...args: (boolean | TypeFunction$1)[]) => void;
|
|
704
754
|
destroy: (options?: {
|
|
705
755
|
keepInputValue?: boolean;
|
|
706
|
-
callback?: TypeFunction;
|
|
707
|
-
} | TypeFunction) => void;
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
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
|
-
*/
|
|
756
|
+
callback?: TypeFunction$1;
|
|
757
|
+
} | TypeFunction$1) => void;
|
|
758
|
+
protected onDestroy?: () => void;
|
|
759
|
+
_eventsBundle: () => void;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
type TypeFunction = () => void;
|
|
763
|
+
declare class TimepickerAPI extends TimepickerLifecycle {
|
|
723
764
|
getValue: () => {
|
|
724
765
|
hour: string;
|
|
725
766
|
minutes: string;
|
|
@@ -728,13 +769,33 @@ declare class TimepickerUI implements ITimepickerUI {
|
|
|
728
769
|
degreesHours: number | null;
|
|
729
770
|
degreesMinutes: number | null;
|
|
730
771
|
};
|
|
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
772
|
setValue: (time: string, updateInput?: boolean) => void;
|
|
737
|
-
|
|
773
|
+
update: (value: {
|
|
774
|
+
options: OptionTypes;
|
|
775
|
+
create?: boolean;
|
|
776
|
+
}, callback?: TypeFunction) => void;
|
|
777
|
+
setTheme(themeConfig: {
|
|
778
|
+
primaryColor?: string;
|
|
779
|
+
backgroundColor?: string;
|
|
780
|
+
surfaceColor?: string;
|
|
781
|
+
surfaceHoverColor?: string;
|
|
782
|
+
textColor?: string;
|
|
783
|
+
secondaryTextColor?: string;
|
|
784
|
+
disabledTextColor?: string;
|
|
785
|
+
onPrimaryColor?: string;
|
|
786
|
+
borderColor?: string;
|
|
787
|
+
shadow?: string;
|
|
788
|
+
borderRadius?: string;
|
|
789
|
+
fontFamily?: string;
|
|
790
|
+
}): void;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
declare class TimepickerUI extends TimepickerAPI implements ITimepickerUI {
|
|
794
|
+
constructor(selectorOrElement: string | HTMLElement, options?: OptionTypes);
|
|
795
|
+
static getById(id: string): TimepickerUI | undefined;
|
|
796
|
+
static getAllInstances(): TimepickerUI[];
|
|
797
|
+
static isAvailable(selectorOrElement: string | HTMLElement): boolean;
|
|
798
|
+
static destroyAll(): void;
|
|
738
799
|
}
|
|
739
800
|
|
|
740
|
-
export { type OptionTypes, TimepickerUI };
|
|
801
|
+
export { type CallbackData, EventEmitter, type OptionTypes, TimepickerUI, TimepickerUI as default };
|