UNPKG

@visactor/vtable

Version:

canvas table width high performance

28 lines (17 loc) 1.92 kB
import { isValid } from "@visactor/vutils"; import { ImageStyle } from "./style/ImageStyle"; import { TextStyle } from "./style/MultilineTextStyle"; import { NumberStyle } from "./style/NumberStyle"; import { Style } from "./style/Style"; import { CheckboxStyle } from "./style/CheckboxStyle"; import { RadioStyle } from "./style/RadioStyle"; import { SwitchStyle } from "./style/SwitchStyle"; import { ButtonStyle } from "./style/ButtonStyle"; const {EVENT_TYPE: EVENT_TYPE} = Style; export { EVENT_TYPE, Style, NumberStyle, ImageStyle, TextStyle }; export function of(columnStyle, bodyStyle, styleArg, StyleClassDef = Style, globalAutoWrapText, theme) { var _a, _b, _c, _d; return columnStyle || bodyStyle ? columnStyle instanceof Style ? columnStyle : "function" == typeof columnStyle ? of(columnStyle(styleArg), bodyStyle, styleArg, StyleClassDef, globalAutoWrapText, theme) : (columnStyle || (columnStyle = {}), globalAutoWrapText && !isValid(columnStyle.autoWrapText) && (columnStyle.autoWrapText = !0), StyleClassDef === CheckboxStyle ? new CheckboxStyle(null != columnStyle ? columnStyle : {}, null != bodyStyle ? bodyStyle : {}, null !== (_a = theme.checkboxStyle) && void 0 !== _a ? _a : {}) : StyleClassDef === RadioStyle ? new RadioStyle(null != columnStyle ? columnStyle : {}, null != bodyStyle ? bodyStyle : {}, null !== (_b = theme.radioStyle) && void 0 !== _b ? _b : {}) : StyleClassDef === SwitchStyle ? new SwitchStyle(null != columnStyle ? columnStyle : {}, null != bodyStyle ? bodyStyle : {}, null !== (_c = theme.switchStyle) && void 0 !== _c ? _c : {}) : StyleClassDef === ButtonStyle ? new ButtonStyle(null != columnStyle ? columnStyle : {}, null != bodyStyle ? bodyStyle : {}, null !== (_d = theme.buttonStyle) && void 0 !== _d ? _d : {}) : new StyleClassDef(null != columnStyle ? columnStyle : {}, null != bodyStyle ? bodyStyle : {})) : StyleClassDef.DEFAULT; }