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.

216 lines (215 loc) • 6.49 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 column_exports = {}; __export(column_exports, { columnProps: () => columnProps, default: () => column_default }); module.exports = __toCommonJS(column_exports); var import_vue = require("vue"); var import_comp = require("../../ui/src/comp"); var import_util = require("./util"); var import_cell = __toESM(require("./cell")); const columnProps = { // 列唯一主键 colId: [String, Number], // 渲染类型 index,radio,checkbox,expand,html type: String, // 列字段名 field: String, // 列标题 title: String, // 列宽度 width: [Number, String], // 列最小宽度,把剩余宽度按比例分配 minWidth: [Number, String], // 列最大宽度 maxWidth: [Number, String], // 是否允许拖动列宽调整大小 resizable: { type: Boolean, default: null }, // 将列固定在左侧或者右侧 fixed: String, // 列对其方式 align: String, // 表头对齐方式 headerAlign: String, // 表尾列的对齐方式 footerAlign: String, // 当内容过长时显示为省略号 showOverflow: { type: [Boolean, String], default: null }, // 当表头内容过长时显示为省略号 showHeaderOverflow: { type: [Boolean, String], default: null }, // 当表尾内容过长时显示为省略号 showFooterOverflow: { type: [Boolean, String], default: null }, // 给单元格附加 className className: [String, Function], // 给表头单元格附加 className headerClassName: [String, Function], // 给表尾单元格附加 className footerClassName: [String, Function], // 格式化显示内容 formatter: [Function, Array, String], // 格式化表头显示内容 headerFormatter: [Function, Array, String], // 格式化表尾显示内容 footerFormatter: [Function, Array, String], // 是否显示间距 padding: { type: Boolean, default: null }, // 垂直对齐方式 verticalAlign: { type: String, default: null }, // 是否允许排序 sortable: Boolean, // 自定义排序的属性 sortBy: [String, Function], // 排序的字段类型,比如字符串转数值等 sortType: String, // 配置筛选条件数组 filters: { type: Array, default: null }, // 筛选是否允许多选 filterMultiple: { type: Boolean, default: true }, // 自定义筛选方法 filterMethod: Function, // 筛选重置方法 filterResetMethod: Function, // 筛选复原方法 filterRecoverMethod: Function, // 筛选模板配置项 filterRender: Object, // 是否显示浮动筛选 floatingFilters: Object, // 列的校验规则 rules: Array, // 设置为分组节点 rowGroupNode: Boolean, // 设置为树节点 treeNode: Boolean, // 设置为拖拽排序 dragSort: Boolean, // 设置为行高拖拽 rowResize: Boolean, // 是否可视 visible: { type: Boolean, default: null }, // 表头单元格数据导出方法 headerExportMethod: Function, // 单元格数据导出方法 exportMethod: Function, // 表尾单元格数据导出方法 footerExportMethod: Function, // 已废弃,被 titlePrefix 替换 titleHelp: Object, // 标题前缀图标配置项 titlePrefix: Object, // 标题后缀图标配置项 titleSuffix: Object, // 单元格值类型 cellType: String, // 单元格渲染配置项 cellRender: Object, // 单元格编辑渲染配置项 editRender: Object, // 内容渲染配置项 contentRender: Object, // 聚合函数 aggFunc: [Boolean, String], // 将单元格复制到剪贴板 copyMethod: Function, // 将剪贴单元格的值清除 cutMethod: Function, // 从剪贴板赋值到单元格 pasteMethod: Function, // 额外的参数 params: Object }; var column_default = ( /* define-vxe-component start */ (0, import_comp.defineVxeComponent)({ name: "VxeColumn", props: columnProps, setup(props, { slots }) { const refElem = (0, import_vue.ref)(); const $xeTable = (0, import_vue.inject)("$xeTable", null); const $xeColgroup = (0, import_vue.inject)("$xeColgroup", null); if (!$xeTable) { return () => (0, import_vue.createCommentVNode)(); } const columnConfig = import_cell.default.createColumn($xeTable, props); columnConfig.slots = slots; const renderVN = () => { return (0, import_vue.h)("div", { ref: refElem }); }; const $xeColumn = { columnConfig, renderVN }; (0, import_util.watchColumn)($xeTable, props, columnConfig); (0, import_vue.onMounted)(() => { const elem = refElem.value; if (elem) { (0, import_util.assembleColumn)($xeTable, elem, columnConfig, $xeColgroup); } }); (0, import_vue.onUnmounted)(() => { (0, import_util.destroyColumn)($xeTable, columnConfig); }); (0, import_vue.provide)("$xeColumn", $xeColumn); (0, import_vue.provide)("$xeGrid", null); (0, import_vue.provide)("$xeGantt", null); return renderVN; } }) );