@@ -376,40 +376,51 @@ export class Timepicker extends Component<TimepickerOptions> {
376
376
this . amOrPm = 'PM' ;
377
377
}
378
378
379
- private _createButton ( text : string , visibility : string ) : HTMLButtonElement {
379
+ /* private _createButton(text: string, visibility: string): HTMLButtonElement {
380
380
const button = document.createElement('button');
381
- button . classList . add ( 'btn' , 'btn-flat' , ' waves-effect', 'text' ) ;
381
+ button.classList.add('btn', 'waves-effect', 'text');
382
382
button.style.visibility = visibility;
383
383
button.type = 'button';
384
384
button.tabIndex = -1;
385
385
button.innerText = text;
386
386
return button;
387
- }
387
+ }*/
388
388
389
389
_pickerSetup ( ) {
390
- const clearButton = this . _createButton (
390
+ // clearButton.classList.add('timepicker-clear');
391
+ // clearButton.addEventListener('click', this.clear);
392
+ // this.footer.appendChild(clearButton);
393
+ Utils . createButton (
394
+ this . footer ,
391
395
this . options . i18n . clear ,
392
- this . options . showClearBtn ? '' : 'hidden'
396
+ [ 'timepicker-clear' ] ,
397
+ this . options . showClearBtn ,
398
+ this . clear
393
399
) ;
394
- clearButton . classList . add ( 'timepicker-clear' ) ;
395
- clearButton . addEventListener ( 'click' , this . clear ) ;
396
- this . footer . appendChild ( clearButton ) ;
397
400
398
401
if ( ! this . options . autoSubmit ) {
399
- const confirmationBtnsContainer = document . createElement ( 'div' ) ;
400
- confirmationBtnsContainer . classList . add ( 'confirmation-btns' ) ;
401
- this . footer . append ( confirmationBtnsContainer ) ;
402
-
403
- const cancelButton = this . _createButton ( this . options . i18n . cancel , '' ) ;
404
- cancelButton . classList . add ( 'timepicker-close' ) ;
405
- cancelButton . addEventListener ( 'click' , this . close ) ;
406
- confirmationBtnsContainer . appendChild ( cancelButton ) ;
407
-
408
- const doneButton = this . _createButton ( this . options . i18n . done , '' ) ;
409
- doneButton . classList . add ( 'timepicker-close' ) ;
410
- doneButton . addEventListener ( 'click' , this . done ) ;
411
- confirmationBtnsContainer . appendChild ( doneButton ) ;
402
+ /*const confirmationBtnsContainer = document.createElement('div');
403
+ confirmationBtnsContainer.classList.add('confirmation-btns');
404
+ this.footer.append(confirmationBtnsContainer);
405
+
406
+ const cancelButton = this._createButton(this.options.i18n.cancel, '');
407
+ cancelButton.classList.add('timepicker-close');
408
+ cancelButton.addEventListener('click', this.close);
409
+ confirmationBtnsContainer.appendChild(cancelButton);
410
+
411
+ const doneButton = this._createButton(this.options.i18n.done, '');
412
+ doneButton.classList.add('timepicker-close');
413
+ //doneButton.addEventListener('click', this._finishSelection);
414
+ confirmationBtnsContainer.appendChild(doneButton);*/
415
+ Utils . createConfirmationContainer (
416
+ this . footer ,
417
+ this . options . i18n . done ,
418
+ this . options . i18n . cancel ,
419
+ this . confirm ,
420
+ this . cancel
421
+ ) ;
412
422
}
423
+
413
424
this . _updateTimeFromInput ( ) ;
414
425
this . showView ( 'hours' ) ;
415
426
}
@@ -791,16 +802,12 @@ export class Timepicker extends Component<TimepickerOptions> {
791
802
792
803
confirm = ( ) => {
793
804
this . done ( ) ;
794
- if ( typeof this . options . onDone === 'function' ) {
795
- setTimeout ( ( ) => {
796
- this . options . onDone . call ( this ) ;
797
- } , this . options . duration / 2 ) ;
798
- }
805
+ if ( typeof this . options . onDone === 'function' ) this . options . onDone . call ( this ) ;
799
806
}
800
807
801
808
cancel = ( ) => {
802
809
this . clear ( ) ;
803
- if ( typeof this . options . onDone === 'function' ) this . options . onCancel . call ( this ) ;
810
+ if ( typeof this . options . onCancel === 'function' ) this . options . onCancel . call ( this ) ;
804
811
}
805
812
806
813
clear = ( ) => {
0 commit comments