1- // @ts -nocheck
21/* eslint-disable */
32import Picker from 'pickadate/lib/picker' ;
43
@@ -22,6 +21,11 @@ export default class TimePicker {
2221 interval : 15 ,
2322 disable : [ ] ,
2423 enable : 1 ,
24+ select : undefined ,
25+ highlight : undefined ,
26+ min : undefined ,
27+ max : undefined ,
28+ view : undefined ,
2529 } ;
2630
2731 key = {
@@ -39,6 +43,8 @@ export default class TimePicker {
3943 } ,
4044 } ;
4145
46+ $node : any ;
47+
4248 constructor ( picker , public settings ) {
4349 const clock = this ;
4450 const elementValue = picker . $node [ 0 ] . value ;
@@ -131,15 +137,15 @@ export default class TimePicker {
131137 } ,
132138 } ;
133139
134- create ( type , value , options ) {
140+ create ( type , value ? , options ? ) {
135141 const clock = this ;
136142 value = value === undefined ? type : value ;
137143 if ( _ . isDate ( value ) ) {
138144 value = [ value . getHours ( ) , value . getMinutes ( ) ] ;
139145 }
140- if ( $ . isPlainObject ( value ) && _ . isInteger ( value . pick ) ) {
146+ if ( value && typeof value === 'object' && _ . isInteger ( value . pick ) ) {
141147 value = value . pick ;
142- } else if ( $ . isArray ( value ) ) {
148+ } else if ( Array . isArray ( value ) ) {
143149 value = + value [ 0 ] * MINUTES_IN_HOUR + ( + value [ 1 ] ) ;
144150 }
145151 if ( type == 'max' && value < clock . item . min . pick ) {
@@ -157,25 +163,20 @@ export default class TimePicker {
157163 } ;
158164 }
159165
160- normalize ( type , value /* , options */ ) {
166+ normalize ( type , value , _options ) {
161167 const { interval } = this . item ;
162168 const minTime = this . item . min && this . item . min . pick || 0 ;
163169 value -= type == 'min' ? 0 : ( value - minTime ) % interval ;
164170 return value ;
165171 }
166172
167173 measure ( type , value , options ) {
168- const clock = this ;
169- if ( ! value ) {
170- value = type == 'min' ? [ 0 , 0 ] : [ HOURS_IN_DAY - 1 , MINUTES_IN_HOUR - 1 ] ;
171- }
172-
174+ value ||= type == 'min' ? [ 0 , 0 ] : [ HOURS_IN_DAY - 1 , MINUTES_IN_HOUR - 1 ] ;
173175 if ( typeof value === 'string' ) {
174- value = clock . parse ( type , value ) ;
175- } else if ( $ . isPlainObject ( value ) && _ . isInteger ( value . pick ) ) {
176- value = clock . normalize ( type , value . pick , options ) ;
176+ value = this . parse ( type , value ) ;
177+ } else if ( value && typeof value === 'object' && _ . isInteger ( value . pick ) ) {
178+ value = this . normalize ( type , value . pick , options ) ;
177179 }
178-
179180 return value ;
180181 }
181182
@@ -185,7 +186,7 @@ export default class TimePicker {
185186 return this . create ( timeObject . pick > maxLimit ? maxLimit : timeObject . pick < minLimit ? minLimit : timeObject ) ;
186187 } ; // TimePicker.prototype.scope
187188
188- parse ( type , value , options ) {
189+ parse ( type , value , options ? ) {
189190 let hour ; let minutes ; let item ; let parseValue ;
190191 const clock = this ;
191192 const parsingObject = { } ;
0 commit comments