mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-27 03:01:14 +08:00
79876b9733
* refactor(date-picker): attribute 'type' add ts declare * refactor(date-picker): add isValidDatePicktype utils * style: date-picker code fix * Update date-picker.ts Co-authored-by: jeremywu <15975785+JeremyWuuuuu@users.noreply.github.com>
28 lines
592 B
TypeScript
28 lines
592 B
TypeScript
import { isNumber } from './util'
|
|
|
|
export const isValidWidthUnit = (val: string | number): boolean =>{
|
|
if(isNumber(val)){
|
|
return true
|
|
} else {
|
|
return ['px', 'rem', 'em', 'vw', '%', 'vmin', 'vmax'].some(unit =>
|
|
(val as string).endsWith(unit),
|
|
)
|
|
}
|
|
}
|
|
|
|
export const isValidComponentSize = (val: string) =>
|
|
['', 'large', 'medium', 'small', 'mini'].includes(val)
|
|
|
|
export const isValidDatePickType = (val: string) =>
|
|
[
|
|
'year',
|
|
'month',
|
|
'date',
|
|
'dates',
|
|
'week',
|
|
'datetime',
|
|
'datetimerange',
|
|
'daterange',
|
|
'monthrange',
|
|
].includes(val)
|