UNPKG

vxe-table

Version:

A PC-end table component based on Vxe UI, supporting copy-paste, data pivot table, and high-performance virtual list table solution.

59 lines (58 loc) • 1.59 kB
import XEUtils from "xe-utils"; import { VxeUI } from "@vxe-ui/core"; import DomZIndex from "dom-zindex"; const { getConfig } = VxeUI; function isEnableConf(conf) { return conf && conf.enabled !== false; } function hasEnableConf(conf, opts) { return opts && (conf ? opts.enabled !== false : opts.enabled); } function isEmptyValue(cellValue) { return cellValue === null || cellValue === void 0 || cellValue === ""; } function parseFile(file) { const name = file.name; const tIndex = XEUtils.lastIndexOf(name, "."); const type = name.substring(tIndex + 1, name.length).toLowerCase(); const filename = name.substring(0, tIndex); return { filename, type }; } function nextZIndex() { return DomZIndex.getNext(); } function getLastZIndex() { return DomZIndex.getCurrent(); } function hasChildrenList(item) { return item && item.children && item.children.length > 0; } function getFuncText(content, args) { if (XEUtils.eqNull(content)) { return ""; } const translate = getConfig().translate; return `${translate ? translate("" + content, args) : content}`; } function formatText(value, placeholder) { return "" + (isEmptyValue(value) ? placeholder ? getConfig().emptyCell : "" : value); } function eqEmptyValue(cellValue) { return cellValue === "" || XEUtils.eqNull(cellValue); } function getDefaultConfig(val1, def1) { return XEUtils.eqNull(val1) ? def1 : val1; } export { eqEmptyValue, formatText, getDefaultConfig, getFuncText, getLastZIndex, hasChildrenList, hasEnableConf, isEmptyValue, isEnableConf, nextZIndex, parseFile };