UNPKG

comic-plus

Version:

<p align="center"> <img width="200px" src="./logo.png"/> </p>

45 lines (44 loc) 1.32 kB
import { defineComponent, getCurrentInstance, inject, computed, reactive, onUnmounted, h } from "vue"; import { tableColumnProps } from "./column.props.mjs"; import { TABLE_PROVIDE } from "../type.mjs"; import "../../../../utils/config.mjs"; import { isBoolean } from "../../../../utils/typescript.mjs"; import "@vueuse/core"; const TableColumn = defineComponent({ name: "CuTableColumn", props: tableColumnProps, setup(props, { slots }) { const instance = getCurrentInstance(); const { addColumn, removeColumn } = inject(TABLE_PROVIDE); const colName = "cu-table-column__key_" + instance.uid; const getFixedString = computed(() => { if (props.fixed) { if (isBoolean(props.fixed)) { return props.fixed ? "left" : null; } return props.fixed; } return null; }); const columnInstance = reactive({ uid: instance.uid, props, type: props == null ? void 0 : props.type, fixed: getFixedString.value, showExpand: false, default: slots.default, header: slots.header, style: {} }); addColumn(columnInstance); onUnmounted(() => { removeColumn(instance.uid); }); return () => { return h("div", { "col-name": colName }); }; } }); export { TableColumn as default };