import type { ExtractPropTypes, PropType, StyleValue } from 'vue' export const unknownProp = null as unknown as PropType export const numericProp = [Number, String] export const truthProp = { default: true as const, type: Boolean } export const nullableBooleanProp = { default: undefined, type: Boolean as PropType } export const makeRequiredProp = (type: T) => ({ required: true as const, type }) export const makeArrayProp = (defaultVal: T[] = []) => ({ default: () => defaultVal, type: Array as PropType }) export const makeObjectProp = (defaultVal: T) => ({ default: () => defaultVal, type: Object as PropType }) export const makeBooleanProp = (defaultVal: T) => ({ default: defaultVal, type: Boolean }) export const makeNumberProp = (defaultVal: T) => ({ default: defaultVal, type: Number }) export const makeNumericProp = (defaultVal: T) => ({ default: defaultVal, type: numericProp }) export const makeStringProp = (defaultVal: T) => ({ default: defaultVal, type: String as unknown as PropType }) export type ClassType = string | object | Array export const baseProps = { /** * 自定义根节点样式类 */ customClass: { default: '', type: [String, Object, Array] as PropType }, /** * 自定义根节点样式 */ customStyle: { default: '', type: [String, Object, Array] as PropType } } export type BaseProps = ExtractPropTypes