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.

89 lines (88 loc) • 3.44 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var utils_exports = {}; __export(utils_exports, { eqEmptyValue: () => eqEmptyValue, formatText: () => formatText, getDefaultConfig: () => getDefaultConfig, getFuncText: () => getFuncText, getLastZIndex: () => getLastZIndex, hasChildrenList: () => hasChildrenList, hasEnableConf: () => hasEnableConf, isEmptyValue: () => isEmptyValue, isEnableConf: () => isEnableConf, nextZIndex: () => nextZIndex, parseFile: () => parseFile }); module.exports = __toCommonJS(utils_exports); var import_xe_utils = __toESM(require("xe-utils")); var import_core = require("@vxe-ui/core"); var import_dom_zindex = __toESM(require("dom-zindex")); const { getConfig } = import_core.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 = import_xe_utils.default.lastIndexOf(name, "."); const type = name.substring(tIndex + 1, name.length).toLowerCase(); const filename = name.substring(0, tIndex); return { filename, type }; } function nextZIndex() { return import_dom_zindex.default.getNext(); } function getLastZIndex() { return import_dom_zindex.default.getCurrent(); } function hasChildrenList(item) { return item && item.children && item.children.length > 0; } function getFuncText(content, args) { if (import_xe_utils.default.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 === "" || import_xe_utils.default.eqNull(cellValue); } function getDefaultConfig(val1, def1) { return import_xe_utils.default.eqNull(val1) ? def1 : val1; }