2021-04-09 13:45:21 +08:00
|
|
|
import { isNumber } from './util'
|
2021-01-27 23:18:22 +08:00
|
|
|
|
|
|
|
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),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-30 23:26:33 +08:00
|
|
|
export const isValidComponentSize = (val: string) =>
|
2020-11-02 11:05:08 +08:00
|
|
|
['', 'large', 'medium', 'small', 'mini'].includes(val)
|
2021-05-21 15:30:12 +08:00
|
|
|
|
|
|
|
export const isValidDatePickType = (val: string) =>
|
|
|
|
[
|
|
|
|
'year',
|
|
|
|
'month',
|
|
|
|
'date',
|
|
|
|
'dates',
|
|
|
|
'week',
|
|
|
|
'datetime',
|
|
|
|
'datetimerange',
|
|
|
|
'daterange',
|
|
|
|
'monthrange',
|
|
|
|
].includes(val)
|