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.4 kB
JavaScript
;
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 group_exports = {};
__export(group_exports, {
default: () => group_default
});
module.exports = __toCommonJS(group_exports);
var import_vue = require("vue");
var import_comp = require("../../ui/src/comp");
var import_column = require("./column");
var import_util = require("./util");
var import_cell = __toESM(require("./cell"));
var group_default = (
/* define-vxe-component start */
(0, import_comp.defineVxeComponent)({
name: "VxeColgroup",
props: import_column.columnProps,
setup(props, { slots }) {
const refElem = (0, import_vue.ref)();
const $xeTable = (0, import_vue.inject)("$xeTable", null);
const $xeParentColgroup = (0, import_vue.inject)("$xeColgroup", null);
if (!$xeTable) {
return () => (0, import_vue.createCommentVNode)();
}
const columnConfig = import_cell.default.createColumn($xeTable, props);
const columnSlots = {};
if (slots.header) {
columnSlots.header = slots.header;
}
if (slots.title) {
columnSlots.title = slots.title;
}
columnConfig.slots = columnSlots;
columnConfig.children = [];
(0, import_util.watchColumn)($xeTable, props, columnConfig);
(0, import_vue.onMounted)(() => {
const elem = refElem.value;
if (elem) {
(0, import_util.assembleColumn)($xeTable, elem, columnConfig, $xeParentColgroup);
}
});
(0, import_vue.onUnmounted)(() => {
(0, import_util.destroyColumn)($xeTable, columnConfig);
});
const renderVN = () => {
const defaultSlot = slots.default;
return (0, import_vue.h)(
"div",
{
ref: refElem
},
defaultSlot ? defaultSlot() : []
);
};
const $xeColgroup = { columnConfig };
(0, import_vue.provide)("$xeColgroup", $xeColgroup);
(0, import_vue.provide)("$xeGrid", null);
(0, import_vue.provide)("$xeGantt", null);
return renderVN;
}
})
);