element-plus/packages/components/col/src/col.ts

57 lines
1.2 KiB
TypeScript

import { buildProps, definePropType, mutable } from '@element-plus/utils'
import type { ExtractPropTypes } from 'vue'
import type Col from './col.vue'
export type ColSizeObject = {
span?: number
offset?: number
pull?: number
push?: number
}
export type ColSize = number | ColSizeObject
export const colProps = buildProps({
tag: {
type: String,
default: 'div',
},
span: {
type: Number,
default: 24,
},
offset: {
type: Number,
default: 0,
},
pull: {
type: Number,
default: 0,
},
push: {
type: Number,
default: 0,
},
xs: {
type: definePropType<ColSize>([Number, Object]),
default: () => mutable({} as const),
},
sm: {
type: definePropType<ColSize>([Number, Object]),
default: () => mutable({} as const),
},
md: {
type: definePropType<ColSize>([Number, Object]),
default: () => mutable({} as const),
},
lg: {
type: definePropType<ColSize>([Number, Object]),
default: () => mutable({} as const),
},
xl: {
type: definePropType<ColSize>([Number, Object]),
default: () => mutable({} as const),
},
} as const)
export type ColProps = ExtractPropTypes<typeof colProps>
export type ColInstance = InstanceType<typeof Col>