You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
2.9 KiB

{"ast":null,"code":"import { isVNode, h } from 'vue';\nimport '../../../utils/index.mjs';\nimport { isArray, isFunction } from '@vue/shared';\nimport { addUnit } from '../../../utils/dom/style.mjs';\nconst sumReducer = (sum2, num) => sum2 + num;\nconst sum = listLike => {\n return isArray(listLike) ? listLike.reduce(sumReducer, 0) : listLike;\n};\nconst tryCall = (fLike, params, defaultRet = {}) => {\n return isFunction(fLike) ? fLike(params) : fLike != null ? fLike : defaultRet;\n};\nconst enforceUnit = style => {\n ;\n [\"width\", \"maxWidth\", \"minWidth\", \"height\"].forEach(key => {\n style[key] = addUnit(style[key]);\n });\n return style;\n};\nconst componentToSlot = ComponentLike => isVNode(ComponentLike) ? props => h(ComponentLike, props) : ComponentLike;\nexport { componentToSlot, enforceUnit, sum, tryCall };","map":{"version":3,"names":["sumReducer","sum2","num","sum","listLike","isArray","reduce","tryCall","fLike","params","defaultRet","isFunction","enforceUnit","style","forEach","key","addUnit","componentToSlot","ComponentLike","isVNode","props","h"],"sources":["../../../../../../packages/components/table-v2/src/utils.ts"],"sourcesContent":["import { h, isVNode } from 'vue'\nimport { addUnit, isArray, isFunction } from '@element-plus/utils'\n\nimport type { CSSProperties, Component, Slot } from 'vue'\n\nconst sumReducer = (sum: number, num: number) => sum + num\n\nexport const sum = (listLike: number | number[]) => {\n return isArray(listLike) ? listLike.reduce(sumReducer, 0) : listLike\n}\n\nexport const tryCall = <T>(\n fLike: T,\n params: T extends (...args: infer K) => unknown ? K : any,\n defaultRet = {}\n) => {\n return isFunction(fLike) ? fLike(params) : fLike ?? defaultRet\n}\n\nexport const enforceUnit = (style: CSSProperties) => {\n ;(['width', 'maxWidth', 'minWidth', 'height'] as const).forEach((key) => {\n style[key] = addUnit(style[key])\n })\n\n return style\n}\n\nexport const componentToSlot = <T>(\n ComponentLike: JSX.Element | ((props: T) => Component<T>) | undefined\n) =>\n isVNode(ComponentLike)\n ? (props: T) => h(ComponentLike, props)\n : (ComponentLike as Slot)\n"],"mappings":";;;;AAEA,MAAMA,UAAU,GAAGA,CAACC,IAAI,EAAEC,GAAG,KAAKD,IAAI,GAAGC,GAAG;AAChC,MAACC,GAAG,GAAIC,QAAQ,IAAK;EAC/B,OAAOC,OAAO,CAACD,QAAQ,CAAC,GAAGA,QAAQ,CAACE,MAAM,CAACN,UAAU,EAAE,CAAC,CAAC,GAAGI,QAAQ;AACtE;AACY,MAACG,OAAO,GAAGA,CAACC,KAAK,EAAEC,MAAM,EAAEC,UAAU,GAAG,EAAE,KAAK;EACzD,OAAOC,UAAU,CAACH,KAAK,CAAC,GAAGA,KAAK,CAACC,MAAM,CAAC,GAAGD,KAAK,IAAI,IAAI,GAAGA,KAAK,GAAGE,UAAU;AAC/E;AACY,MAACE,WAAW,GAAIC,KAAK,IAAK;EACpC;EACA,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAACC,OAAO,CAAEC,GAAG,IAAK;IAC3DF,KAAK,CAACE,GAAG,CAAC,GAAGC,OAAO,CAACH,KAAK,CAACE,GAAG,CAAC,CAAC;EACpC,CAAG,CAAC;EACF,OAAOF,KAAK;AACd;AACY,MAACI,eAAe,GAAIC,aAAa,IAAKC,OAAO,CAACD,aAAa,CAAC,GAAIE,KAAK,IAAKC,CAAC,CAACH,aAAa,EAAEE,KAAK,CAAC,GAAGF,aAAA","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}