layui/package/component/es/table/index.js
2023-02-17 11:34:58 +08:00

1485 lines
84 KiB
JavaScript

import { w as withInstall } from "../badge/index2.js";
import { defineComponent, useSlots, ref, computed, resolveComponent, openBlock, createElementBlock, Fragment, createElementVNode, normalizeStyle, normalizeClass, withModifiers, renderList, createCommentVNode, unref, createBlock, createVNode, mergeProps, isRef, createTextVNode, toDisplayString, withCtx, renderSlot, withKeys, createSlots, watch, nextTick, onMounted, onBeforeUnmount } from "vue";
import { _ as _sfc_main$2E, a as _sfc_main$4 } from "../checkbox/index2.js";
import { _ as _sfc_main$7 } from "../dropdown/index2.js";
import { _ as _sfc_main$8 } from "../empty/index2.js";
import { _ as _sfc_main$5 } from "../tooltip/index2.js";
import { _ as _sfc_main$3 } from "../radio/index2.js";
import { _ as _export_sfc } from "../dropdownMenu/index2.js";
import { _ as _sfc_main$6 } from "../page/index2.js";
import "../_chunks/@vueuse/index.js";
import "../datePicker/index2.js";
import "../_chunks/dayjs/index.js";
import "../_chunks/@umijs/index.js";
import "../input/index2.js";
import "../_chunks/vue-i18n/index.js";
import "../_chunks/@intlify/index.js";
import "../_chunks/@vue/index.js";
var index = /* @__PURE__ */ (() => '.layui-checkbox[size=lg]{height:18px;line-height:18px}.layui-checkbox[size=lg] .layui-form-checkbox[lay-skin=primary] .layui-icon{width:18px;height:18px;font-size:16px}.layui-checkbox[size=lg] .layui-form-checkbox[lay-skin=primary] .layui-checkbox-label{height:18px;line-height:18px;font-size:16px}.layui-checkbox[size=md]{height:16px;line-height:16px}.layui-checkbox[size=md] .layui-form-checkbox[lay-skin=primary] .layui-icon{width:16px;height:16px;font-size:14px}.layui-checkbox[size=md] .layui-form-checkbox[lay-skin=primary] .layui-checkbox-label{height:16px;line-height:16px;font-size:14px}.layui-checkbox[size=sm]{height:14px;line-height:14px}.layui-checkbox[size=sm] .layui-form-checkbox[lay-skin=primary] .layui-icon{width:14px;height:14px;font-size:12px}.layui-checkbox[size=sm] .layui-form-checkbox[lay-skin=primary] .layui-checkbox-label{height:14px;line-height:14px;font-size:12px}.layui-checkbox[size=xs]{height:12px;line-height:12px}.layui-checkbox[size=xs] .layui-form-checkbox[lay-skin=primary] .layui-icon{width:12px;height:12px;font-size:10px}.layui-checkbox[size=xs] .layui-form-checkbox[lay-skin=primary] .layui-checkbox-label{height:12px;line-height:12px;font-size:10px}.layui-checkbox input[type=checkbox]{display:none}.layui-form-checkbox{position:relative;height:30px;line-height:30px;margin-right:10px;padding-right:30px;cursor:pointer;font-size:0;-webkit-transition:.1s linear;transition:.1s linear;box-sizing:border-box}.layui-form-checkbox span{padding:0 10px;height:100%;font-size:14px;border-radius:2px 0 0 2px;background-color:var(--global-neutral-color-6);color:#fff;overflow:hidden}.layui-form-checkbox:hover span{background-color:var(--global-neutral-color-8)}.layui-form-checkbox i{top:0;right:0;width:29px;height:28px;position:absolute;border-top:1px solid var(--global-neutral-color-6);border-bottom:1px solid var(--global-neutral-color-6);border-right:1px solid var(--global-neutral-color-6);border-radius:0 2px 2px 0;color:#fff;font-size:20px;text-align:center}.layui-form-checkbox:hover i{border-color:var(--global-neutral-color-8);color:var(--global-neutral-color-8)}.layui-form-checkbox[lay-skin=primary]{height:auto!important;line-height:normal!important;min-width:18px;min-height:18px;border:none!important;margin-right:0;padding-left:28px;padding-right:0;background:0 0}.layui-form-checkbox[lay-skin=primary] span{padding-left:0;padding-right:15px;line-height:18px;background:0 0;color:#666}.layui-form-checkbox[lay-skin=primary] i{right:auto;left:0;width:16px;height:16px;line-height:16px;border:1px solid var(--global-neutral-color-6);font-size:12px;border-radius:2px;background-color:#fff;-webkit-transition:.1s linear;transition:.1s linear}.layui-form-checkbox[lay-skin=primary]:hover i{border-color:var(--global-checked-color);color:#fff}.layui-form-checked,.layui-form-checked:hover{border-color:var(--global-checked-color)}.layui-form-checked i,.layui-form-checked:hover i{color:var(--global-checked-color)}.layui-form-checked span,.layui-form-checked:hover span{background-color:var(--global-checked-color)}.layui-form-checked[lay-skin=primary] i{border-color:var(--global-checked-color);background-color:var(--global-checked-color);color:#fff}.layui-form-checked[lay-skin=primary] span{background:0 0!important}.layui-checkbox-disabled[lay-skin=primary] span{background:0 0!important;color:var(--global-neutral-color-8)!important}.layui-checkbox-disabled[lay-skin=primary]:hover i{border-color:var(--global-neutral-color-6)}.layui-checkbox-disabled,.layui-checkbox-disabled i{border-color:var(--global-neutral-color-3)!important}.layui-checkbox-disabled span{background-color:var(--global-neutral-color-3)!important}.layui-checkbox-disabled em{color:var(--global-neutral-color-6)!important}.layui-checkbox-disabled:hover i{color:#fff!important}.layui-checkbox-disabled .layui-icon-ok,.layui-checkbox-disabled .layui-icon-subtraction{background-color:var(--global-neutral-color-3)!important;border-color:var(--global-neutral-color-3)!important}.layui-radio[size=lg] .layui-form-radio>i{font-size:24px}.layui-radio[size=md] .layui-form-radio>i{font-size:22px}.layui-radio[size=sm] .layui-form-radio>i{font-size:20px}.layui-radio[size=xs] .layui-form-radio>i{font-size:18px}.layui-radio input[type=radio]{display:none}.layui-form-radio,.layui-form-radio *{display:inline-block;vertical-align:middle}.layui-form-radio{line-height:28px;margin:6px 10px 0 0;padding-right:10px;cursor:pointer;font-size:0}.layui-form-radio *{font-size:14px}.layui-form-radio>i{margin-right:8px;font-size:22px;color:var(--global-neutral-color-8)}.layui-form-radio:hover *,.layui-form-radioed,.layui-form-radioed>i{color:var(--global-checked-color)}.layui-radio-disabled>i{color:var(--global-neutral-color-3)!important}.layui-radio-disabled *{color:var(--global-neutral-color-8)!important}.layui-dropdown{position:relative;display:inline-block}.layui-dropdown-content{position:absolute;z-index:99999;background-color:#fff;box-sizing:border-box;border:1px solid #e4e7ed;border-radius:2px;box-shadow:0 2px 12px #0000001a}.layui-dropdown-content>.layui-dropdown-menu{border-radius:var(--global-border-radius);margin:5px 0}.layui-dropdown-content .layui-menu{position:relative;background-color:#fff}.layui-dropdown-content .layui-menu li,.layui-dropdown-content .layui-menu-body-title a{padding:5px 15px}.layui-dropdown-content .layui-menu li{position:relative;display:flex;margin:1px 0;line-height:26px;color:#000c;font-size:14px;white-space:nowrap;cursor:pointer}.layui-dropdown-content .layui-menu li:hover{background-color:var(--global-neutral-color-2)}.layui-dropdown-content .layui-menu-body-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.layui-dropdown-menu-prefix{margin-right:8px}.layui-dropdown-menu-suffix{margin-left:15px}.layui-dropdown-content .layui-menu li.layui-disabled:hover{background-color:inherit}.layui-laypage{display:inline-block;vertical-align:middle;margin:10px 0;font-size:0}.layui-laypage>a:first-child,.layui-laypage>a:first-child em{border-radius:2px 0 0 2px}.layui-laypage>a:last-child,.layui-laypage>a:last-child em{border-radius:0 2px 2px 0}.layui-laypage>:first-child{margin-left:0!important}.layui-laypage>:last-child{margin-right:0!important}.layui-laypage a,.layui-laypage button,.layui-laypage input,.layui-laypage select,.layui-laypage span{border:1px solid var(--global-neutral-color-3)}.layui-laypage a,.layui-laypage span{display:inline-block;vertical-align:middle;padding:0 15px;height:28px;line-height:28px;margin:0 -1px 5px 0;background-color:#fff;color:#333;font-size:12px}.layui-laypage a:hover{color:var(--global-primary-color)}.layui-laypage-a-red:hover{color:#ff5722!important}.layui-laypage-a-orange:hover{color:#ffb800!important}.layui-laypage-a-green:hover{color:#009688!important}.layui-laypage-a-cyan:hover{color:#2f4056!important}.layui-laypage-a-blue:hover{color:#01aaed!important}.layui-laypage-a-black:hover{color:#000!important}.layui-laypage-a-gray:hover{color:#c2c2c2!important}.layui-laypage em{font-style:normal}.layui-laypage .layui-laypage-spr{color:#999;font-weight:700}.layui-laypage a{text-decoration:none}.layui-laypage .layui-laypage-curr{position:relative}.layui-laypage .layui-laypage-curr em{position:relative;color:#fff}.layui-laypage .layui-laypage-curr .layui-laypage-em{position:absolute;left:-1px;top:-1px;padding:1px;width:100%;height:100%;background-color:var(--global-primary-color)}.layui-laypage-em{border-radius:2px}.layui-laypage-next em,.layui-laypage-prev em{font-family:Sim sun;font-size:16px}.layui-laypage .layui-laypage-count,.layui-laypage .layui-laypage-limits,.layui-laypage .layui-laypage-refresh,.layui-laypage .layui-laypage-skip{margin-left:10px;margin-right:10px;padding:0;border:none}.layui-laypage .layui-laypage-limits,.layui-laypage .layui-laypage-refresh{vertical-align:top}.layui-laypage .layui-laypage-refresh i{font-size:18px;cursor:pointer}.layui-laypage select{height:22px;padding:3px;margin-top:4px;border-radius:2px;cursor:pointer}.layui-laypage .layui-laypage-skip{height:30px;line-height:30px;color:#999}.layui-laypage button,.layui-laypage input{height:30px;line-height:30px;border-radius:2px;vertical-align:top;background-color:#fff;box-sizing:border-box}.layui-laypage input{display:inline-block;width:40px;margin:0 10px;padding:0 3px;text-align:center}.layui-laypage input::-webkit-outer-spin-button,.layui-laypage input::-webkit-inner-spin-button{-webkit-appearance:none}.layui-laypage input:focus,.layui-laypage select:focus{border-color:var(--global-primary-color)!important}.layui-laypage button{margin-left:10px;padding:0 10px;cursor:pointer}.layui-empty{margin:0 8px;font-size:14px;line-height:22px;text-align:center}.layui-empty-image{margin-bottom:8px}.layui-empty-image img{height:100px;margin:auto}.layui-empty-description{margin:0}.layui-empty-extra{margin-top:30px}.layui-table-col-special{width:34px}.layui-table{width:100%;background-color:#fff;color:#666;table-layout:fixed}.layui-table-body .layui-empty{left:0px;position:sticky;margin:0;padding:20px}.layui-table th{text-align:left;font-weight:400}.layui-table-box-header{min-height:50px;line-height:30px;background-color:#fafafa;padding:10px 15px;border-bottom:1px solid #eee}.layui-table-footer{min-height:50px;line-height:30px;background-color:#fafafa;padding:10px 15px}.layui-table-mend,.layui-table-tool,.layui-table-patch,.layui-table-click,.layui-table-hover,.layui-table-header,.layui-table-total td,.layui-table thead tr,.layui-table tbody tr:hover td,.layui-table.layui-table-even tr:nth-child(even) td{background-color:var(--global-neutral-color-1)!important}.layui-table td,.layui-table th,.layui-table-col-set,.layui-table-fixed-r,.layui-table-grid-down,.layui-table-header,.layui-table-page,.layui-table-tips-main,.layui-table-tool,.layui-table-total,.layui-table-view,.layui-table[lay-skin=line],.layui-table[lay-skin=row]{border-width:1px;border-style:solid;border-color:#eee}.layui-table td,.layui-table th{position:relative;padding:9px 8px;min-height:20px;height:40px;line-height:20px;font-size:14px}.layui-table[lay-skin=line] td,.layui-table[lay-skin=line] th{border-width:0 0 1px}.layui-table[lay-skin=row] td,.layui-table[lay-skin=row] th{border-width:0 1px 0 0}.layui-table[lay-skin=nob] td,.layui-table[lay-skin=nob] th{border:none}.layui-table img{max-width:100px}.layui-table[lay-size=lg] td,.layui-table[lay-size=lg] th{padding:15px 30px}.layui-table[lay-size=sm] td,.layui-table[lay-size=sm] th{font-size:12px;padding:5px 10px}.layui-table[lay-size=sm] td,.layui-table[lay-size=sm] th,.layui-table[lay-size=sm] .layui-table-cell{height:30px;line-height:20px}.layui-table[lay-size=lg] td,.layui-table[lay-size=lg] th,.layui-table[lay-size=lg] .layui-table-cell{height:50px;line-height:25px}.layui-table-box{position:relative;overflow:hidden}.layui-table-view .layui-table{position:relative;margin:0;border-collapse:separate}.layui-table-view .layui-table[lay-skin=line]{border-width:0 1px 0 0}.layui-table-view .layui-table[lay-skin=row]{border:none}.layui-table-view .layui-table td,.layui-table-view .layui-table th{border-top:none;border-left:none}.layui-table-view .layui-table td.layui-table-col-special,.layui-table-view .layui-table th.layui-table-col-special{padding:5px}.layui-table-view .layui-table th.layui-unselect .layui-table-cell span{cursor:pointer}.layui-table-view .layui-table td{cursor:default}.layui-table-view .layui-table td[data-edit=text]{cursor:text}.layui-table-view .layui-form-checkbox[lay-skin=primary] i{width:18px;height:18px}.layui-table-view .layui-form-radio{line-height:0;padding:0}.layui-table-view .layui-form-radio>i{margin:0;font-size:20px}.layui-table-init{position:absolute;left:0;top:0;width:100%;height:100%;text-align:center;z-index:110}.layui-table-init .layui-icon{position:absolute;left:50%;top:50%;margin:-15px 0 0 -15px;font-size:30px;color:#c2c2c2}.layui-table-header{border-width:0 0 1px;overflow:hidden}.layui-table-header-wrapper{width:100%;overflow:hidden}.layui-table-header .layui-table{margin-bottom:-1px}.layui-table-tool .layui-table-tool-temp{flex:auto}.layui-table-tool .layui-inline[lay-event]{position:relative;width:26px;height:26px;line-height:26px;border-radius:2px;margin-right:10px;text-align:center;color:#333;border:1px solid #ccc;cursor:pointer}.layui-table-tool .layui-inline[lay-event] .layui-icon{font-size:15px}.layui-table-tool .layui-inline[lay-event]:hover{border:1px solid #999}.layui-table-tool .layui-table-tool-self .layui-inline[lay-event]{margin:0 0 0 10px}.layui-table-tool-panel{position:absolute;top:29px;left:-1px;padding:5px 0;min-width:150px;min-height:40px;border:1px solid #d2d2d2;text-align:left;overflow-y:auto;background-color:#fff;box-shadow:0 2px 4px #0000001f}.layui-table-cell,.layui-table-tool-panel li{overflow:hidden;text-overflow:ellipsis}.layui-table-call-ellipsis{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}.layui-table-tool-panel li{padding:0 10px;line-height:30px;-webkit-transition:.5s all;transition:.5s all}.layui-table-tool-panel li .layui-form-checkbox[lay-skin=primary]{width:100%;padding-left:28px}.layui-table-tool-panel li:hover{background-color:#f6f6f6}.layui-table-tool-panel li .layui-form-checkbox[lay-skin=primary] i{position:absolute;left:0;top:0}.layui-table-tool-panel li .layui-form-checkbox[lay-skin=primary] span{padding:0}.layui-table-tool .layui-table-tool-self .layui-table-tool-panel{left:auto;right:-1px}.layui-table-tool-self{display:flex;align-items:center}.layui-table-col-set{position:absolute;right:0;top:0;width:20px;height:100%;border-width:0 0 0 1px;background-color:#fff}.layui-table-sort{width:10px;height:20px;margin-left:5px;margin-right:5px;cursor:pointer!important}.layui-table-sort .layui-edge{position:absolute;left:5px;border-width:5px}.layui-table-sort .layui-table-sort-asc{top:3px;border-top:none;border-bottom-style:solid;border-bottom-color:#b2b2b2}.layui-table-sort .layui-table-sort-asc:hover{border-bottom-color:#666}.layui-table-sort .layui-table-sort-desc{bottom:5px;border-bottom:none;border-top-style:solid;border-top-color:#b2b2b2}.layui-table-sort .layui-table-sort-desc:hover{border-top-color:#666}.layui-table-sort[lay-sort=asc] .layui-table-sort-asc{border-bottom-color:#000}.layui-table-sort[lay-sort=desc] .layui-table-sort-desc{border-top-color:#000}.layui-table-cell{height:28px;line-height:28px;position:relative;box-sizing:border-box}.layui-table-cell .layui-form-checkbox[lay-skin=primary]{top:-1px;padding:0}.layui-table-cell .layui-table-link{color:#01aaed}.laytable-cell-checkbox,.laytable-cell-numbers,.laytable-cell-radio,.laytable-cell-space{padding:0;text-align:center;-webkit-box-pack:center}.layui-table-cell-expand-icon{border:1px solid #eee;margin-right:8px;border-radius:2px}.layui-table-cell-expand-icon-spaced{width:26px;visibility:hidden;display:inline-block}.layui-table-body{position:relative;overflow:auto;margin-bottom:-1px;transition:all .1s ease-in-out}.layui-table-body .layui-none{line-height:26px;padding:30px 15px;text-align:center;color:#999}.layui-table-fixed{position:absolute;left:0;top:0;z-index:101}.layui-table-fixed .layui-table-body{overflow:hidden}.layui-table-header .layui-table-cell{background-color:#fafafa}.layui-table-fixed-left{left:0;z-index:2;background:white;position:sticky!important}.layui-table-fixed-right{right:0;z-index:2;background:white;position:sticky!important;border-left:1px solid #eee!important;border-right:none!important}.layui-table-tool-checkbox{padding:10px}.layui-table-tool-checkbox>*{display:block;margin-bottom:12px}.layui-table-tool-checkbox>*:last-child{margin-bottom:0}.layui-table-has-fixed-left .layui-table-fixed-left-last{overflow:initial!important;border-right:none!important}.layui-table-has-fixed-right .layui-table-fixed-right-first{overflow:initial!important;border-left:1px solid transparent!important}.layui-table-fixed-left-last:after{position:absolute;top:0;right:0;bottom:-1px;width:30px;transform:translate(100%);transition:box-shadow .3s;content:"";pointer-events:none;box-shadow:inset 10px 0 8px -8px #00000026}.layui-table-fixed-right-first:after{position:absolute;top:0;bottom:-1px;left:0;width:30px;transform:translate(-100%);transition:box-shadow .3s;content:"";pointer-events:none;box-shadow:inset -10px 0 8px -8px #00000026}.layui-table-tool{position:relative;display:flex;z-index:890;width:100%;min-height:50px;line-height:30px;padding:10px 15px;border-width:0 0 1px}.layui-table-tool .layui-btn-container{margin-bottom:-10px}.layui-table-page,.layui-table-total{border-width:1px 0 0;margin-bottom:-1px;overflow:hidden}.layui-table-page{position:relative;width:100%;padding:7px 7px 0;height:41px;font-size:12px;white-space:nowrap}.layui-table-page .layui-laypage select{margin-top:0}.layui-table-page>div{height:26px}.layui-table-page .layui-laypage{margin:0}.layui-table-page .layui-laypage a,.layui-table-page .layui-laypage span{height:26px;line-height:26px;margin-bottom:10px;border:none;background:0 0}.layui-table-page .layui-laypage a,.layui-table-page .layui-laypage span.layui-laypage-curr{padding:0 12px}.layui-table-page .layui-laypage span{margin-left:0;padding:0}.layui-table-page .layui-laypage .layui-laypage-prev{margin-left:-7px!important}.layui-table-page .layui-laypage .layui-laypage-curr .layui-laypage-em{left:0;top:0;padding:0}.layui-table-page .layui-laypage button,.layui-table-page .layui-laypage input{height:26px;line-height:26px}.layui-table-page .layui-laypage input{width:40px}.layui-table-page .layui-laypage button{padding:0 10px}.layui-table-pagebar{float:right;line-height:26px}.layui-table-view select[lay-ignore]{display:inline-block}.layui-table-view .layui-form-radio,.layui-table-view .layui-form-checkbox,.layui-table-view .layui-form-switch{top:0;margin:0;box-sizing:content-box}.layui-table-view .layui-table-cell-number,.layui-table-view .layui-table-cell-radio,.layui-table-view .layui-table-cell-checkbox{width:30px;text-align:center}.layui-table-cell-expand{word-break:break-all}.layui-table-loading{height:80px;text-align:center;line-height:70px}.layui-table-loading .layui-icon{font-size:26px}\n')();
var TableRow_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => ".layui-table-cell[data-v-4baf8383] .layui-input input{padding-left:0}\n")();
const _hoisted_1$1 = ["colspan", "rowspan"];
const _hoisted_2$1 = {
key: 1,
class: "layui-table-cell-expand-icon-spaced"
};
const _hoisted_3$1 = ["colspan", "rowspan"];
const _hoisted_4$1 = {
key: 1,
class: "layui-table-cell-expand-icon-spaced"
};
const _hoisted_5$1 = ["colspan", "rowspan"];
const _hoisted_6$1 = {
key: 1,
class: "layui-table-cell-expand-icon-spaced"
};
const _hoisted_7$1 = ["colspan", "rowspan"];
const _hoisted_8$1 = {
key: 1,
class: "layui-table-cell-expand-icon-spaced"
};
const _hoisted_9$1 = ["colspan", "rowspan", "onClick"];
const _hoisted_10$1 = {
key: 1,
class: "layui-table-cell-expand-icon-spaced"
};
const _hoisted_11$1 = { key: 0 };
const _hoisted_12$1 = { key: 1 };
const _hoisted_13$1 = {
key: 0,
class: "layui-table-cell-expand"
};
const _hoisted_14$1 = ["colspan"];
const __default__$2 = {
name: "TableRow"
};
const _sfc_main$2 = defineComponent({
...__default__$2,
props: {
index: null,
indentSize: null,
currentIndentSize: null,
expandSpace: { type: Boolean },
expandIndex: null,
selectedKeys: null,
selectedKey: null,
tableColumnKeys: null,
childrenColumnName: { default: "children" },
columns: null,
checkbox: { type: Boolean, default: false },
cellClassName: { type: [String, Function], default: "" },
cellStyle: { type: [String, Function], default: "" },
rowClassName: null,
rowStyle: null,
id: null,
data: null,
spanMethod: null,
defaultExpandAll: { type: Boolean },
expandKeys: null,
getCheckboxProps: null,
getRadioProps: null
},
emits: [
"row",
"row-double",
"row-contextmenu",
"update:expandKeys",
"update:selectedKeys",
"update:selectedKey"
],
setup(__props, { emit }) {
const props = __props;
const slot = useSlots();
const tableExpandAll = ref(props.defaultExpandAll);
const editIndex = ref({});
const tableExpandKeys = computed({
get() {
return [...props.expandKeys];
},
set(val) {
emit("update:expandKeys", val);
}
});
const tableSelectedKeys = computed({
get() {
return [...props.selectedKeys];
},
set(val) {
emit("update:selectedKeys", val);
}
});
const tableSelectedKey = computed({
get() {
return props.selectedKey;
},
set(val) {
emit("update:selectedKey", val);
}
});
const isExpand = computed({
get() {
return tableExpandAll.value ? true : tableExpandKeys.value.includes(props.data[props.id]);
},
set(val) {
let newTableExpandKeys = [...tableExpandKeys.value];
if (!val) {
newTableExpandKeys.splice(newTableExpandKeys.indexOf(props.data[props.id]), 1);
} else {
newTableExpandKeys.push(props.data[props.id]);
}
tableExpandAll.value = false;
tableExpandKeys.value = newTableExpandKeys;
}
});
const slotsData = ref([]);
props.columns.map((value) => {
if (value.customSlot) {
slotsData.value.push(value.customSlot);
}
});
const rowClick = function(data, evt) {
emit("row", data, evt);
};
const rowDoubleClick = function(data, evt) {
emit("row-double", data, evt);
};
const rowContextmenu = function(data, evt) {
emit("row-contextmenu", data, evt);
};
const expandIconType = computed(() => {
return isExpand.value ? "layui-icon-subtraction" : "layui-icon-addition";
});
const handleExpand = () => {
isExpand.value = !isExpand.value;
};
const renderCellStyle = (row, column, rowIndex, columnIndex) => {
if (typeof props.cellStyle === "string") {
return props.cellStyle;
}
return props.cellStyle(row, column, rowIndex, columnIndex);
};
const renderCellClassName = (row, column, rowIndex, columnIndex) => {
if (typeof props.cellClassName === "string") {
return props.cellClassName;
}
return props.cellClassName(row, column, rowIndex, columnIndex);
};
const renderRowStyle = (data, index2) => {
if (typeof props.rowStyle === "string") {
return props.rowStyle;
}
return props.rowStyle(data, index2);
};
const renderRowClassName = (data, index2) => {
if (typeof props.rowClassName === "string") {
return props.rowClassName;
}
return props.rowClassName(data, index2);
};
const childrenIndentSize = computed(() => props.currentIndentSize + props.indentSize);
const renderFixedStyle = (column, columnIndex) => {
var _a, _b, _c, _d;
if (column.fixed) {
if (column.fixed == "left") {
var left = 0;
for (var i = 0; i < columnIndex; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "left" && props.tableColumnKeys.includes(props.columns[i].key)) {
left = left + Number((_b = (_a = props.columns[i]) == null ? void 0 : _a.width) == null ? void 0 : _b.replace("px", ""));
}
}
return { left: `${left}px` };
} else {
var right = 0;
for (var i = columnIndex + 1; i < props.columns.length; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "right" && props.tableColumnKeys.includes(props.columns[i].key)) {
right = right + Number((_d = (_c = props.columns[i]) == null ? void 0 : _c.width) == null ? void 0 : _d.replace("px", ""));
}
}
return { right: `${right}px` };
}
} else {
var isLast = true;
for (var i = columnIndex + 1; i < props.columns.length; i++) {
if (props.columns[i].fixed == void 0 && props.tableColumnKeys.includes(props.columns[i].key)) {
isLast = false;
}
}
return isLast ? { "border-right": "none" } : {};
}
};
const renderFixedClassName = (column, columnIndex) => {
if (column.fixed) {
if (column.fixed == "left") {
var left = true;
for (var i = columnIndex + 1; i < props.columns.length; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "left" && props.tableColumnKeys.includes(props.columns[i].key)) {
left = false;
}
}
return left ? `layui-table-fixed-left-last` : "";
} else {
var right = true;
for (var i = 0; i < columnIndex; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "right" && props.tableColumnKeys.includes(props.columns[i].key)) {
right = false;
}
}
return right ? `layui-table-fixed-right-first` : "";
}
}
};
const spanMethodAttr = (row, column, rowIndex, columnIndex) => {
const attrs = props.spanMethod(row, column, rowIndex, columnIndex);
if (attrs instanceof Array) {
return { rowspan: attrs[0], colspan: attrs[1] };
} else if (attrs instanceof Object) {
return attrs;
} else {
return { rowspan: 1, colspan: 1 };
}
};
const isAutoShow = (row, column, rowIndex, columnIndex) => {
const attrs = spanMethodAttr(row, column, rowIndex, columnIndex);
if (attrs.colspan == 0 && attrs.rowspan == 0) {
return false;
} else {
return true;
}
};
const checkboxProps = props.getCheckboxProps(props.data, props.index);
const radioProps = props.getRadioProps(props.data, props.index);
return (_ctx, _cache) => {
const _component_lay_input = resolveComponent("lay-input");
const _component_table_row = resolveComponent("table-row", true);
return openBlock(), createElementBlock(Fragment, null, [
createElementVNode("tr", {
style: normalizeStyle([renderRowStyle(__props.data, __props.index)]),
class: normalizeClass([renderRowClassName(__props.data, __props.index)]),
onClick: _cache[2] || (_cache[2] = withModifiers(($event) => rowClick(__props.data, $event), ["stop"])),
onDblclick: _cache[3] || (_cache[3] = withModifiers(($event) => rowDoubleClick(__props.data, $event), ["stop"])),
onContextmenu: _cache[4] || (_cache[4] = withModifiers(($event) => rowContextmenu(__props.data, $event), ["stop"]))
}, [
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column, columnIndex) => {
return openBlock(), createElementBlock(Fragment, { key: columnIndex }, [
__props.tableColumnKeys.includes(column.key) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
column.type ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
column.type == "radio" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
isAutoShow(__props.data, column, __props.index, columnIndex) ? (openBlock(), createElementBlock("td", {
key: 0,
class: normalizeClass(["layui-table-cell layui-table-cell-radio", [
renderFixedClassName(column, columnIndex),
renderCellClassName(__props.data, column, __props.index, columnIndex),
column.fixed ? `layui-table-fixed-${column.fixed}` : ""
]]),
colspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).colspan,
rowspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).rowspan,
style: normalizeStyle([
{
textAlign: column.align,
whiteSpace: column.ellipsisTooltip ? "nowrap" : "normal"
},
renderFixedStyle(column, columnIndex),
renderCellStyle(__props.data, column, __props.index, columnIndex)
])
}, [
__props.expandSpace && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", {
key: 0,
style: normalizeStyle({ "margin-right": __props.currentIndentSize + "px" })
}, null, 4)) : createCommentVNode("", true),
__props.expandSpace && !__props.data[__props.childrenColumnName] && !unref(slot).expand && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", _hoisted_2$1)) : createCommentVNode("", true),
(unref(slot).expand || __props.data[__props.childrenColumnName]) && columnIndex === __props.expandIndex ? (openBlock(), createBlock(unref(_sfc_main$2E), {
key: 2,
class: "layui-table-cell-expand-icon",
type: unref(expandIconType),
onClick: handleExpand
}, null, 8, ["type"])) : createCommentVNode("", true),
createVNode(_sfc_main$3, mergeProps({
modelValue: unref(tableSelectedKey),
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(tableSelectedKey) ? tableSelectedKey.value = $event : null)
}, unref(radioProps), {
value: __props.data[__props.id]
}), null, 16, ["modelValue", "value"])
], 14, _hoisted_1$1)) : createCommentVNode("", true)
], 64)) : createCommentVNode("", true),
column.type == "checkbox" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
isAutoShow(__props.data, column, __props.index, columnIndex) ? (openBlock(), createElementBlock("td", {
key: 0,
class: normalizeClass(["layui-table-cell layui-table-cell-checkbox", [
renderFixedClassName(column, columnIndex),
renderCellClassName(__props.data, column, __props.index, columnIndex),
column.fixed ? `layui-table-fixed-${column.fixed}` : ""
]]),
colspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).colspan,
rowspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).rowspan,
style: normalizeStyle([
{
textAlign: column.align,
whiteSpace: column.ellipsisTooltip ? "nowrap" : "normal"
},
renderFixedStyle(column, columnIndex),
renderCellStyle(__props.data, column, __props.index, columnIndex)
])
}, [
__props.expandSpace && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", {
key: 0,
style: normalizeStyle({ "margin-right": __props.currentIndentSize + "px" })
}, null, 4)) : createCommentVNode("", true),
__props.expandSpace && !__props.data[__props.childrenColumnName] && !unref(slot).expand && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", _hoisted_4$1)) : createCommentVNode("", true),
(unref(slot).expand || __props.data[__props.childrenColumnName]) && columnIndex === __props.expandIndex ? (openBlock(), createBlock(unref(_sfc_main$2E), {
key: 2,
class: "layui-table-cell-expand-icon",
type: unref(expandIconType),
onClick: handleExpand
}, null, 8, ["type"])) : createCommentVNode("", true),
createVNode(_sfc_main$4, mergeProps({
modelValue: unref(tableSelectedKeys),
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(tableSelectedKeys) ? tableSelectedKeys.value = $event : null)
}, unref(checkboxProps), {
value: __props.data[__props.id],
skin: "primary"
}), null, 16, ["modelValue", "value"])
], 14, _hoisted_3$1)) : createCommentVNode("", true)
], 64)) : createCommentVNode("", true),
column.type == "number" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
isAutoShow(__props.data, column, __props.index, columnIndex) ? (openBlock(), createElementBlock("td", {
key: 0,
class: normalizeClass(["layui-table-cell layui-table-cell-number", [
renderFixedClassName(column, columnIndex),
renderCellClassName(__props.data, column, __props.index, columnIndex),
column.fixed ? `layui-table-fixed-${column.fixed}` : ""
]]),
colspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).colspan,
rowspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).rowspan,
style: normalizeStyle([
{
textAlign: column.align,
whiteSpace: column.ellipsisTooltip ? "nowrap" : "normal"
},
renderFixedStyle(column, columnIndex),
renderCellStyle(__props.data, column, __props.index, columnIndex)
])
}, [
__props.expandSpace && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", {
key: 0,
style: normalizeStyle({ "margin-right": __props.currentIndentSize + "px" })
}, null, 4)) : createCommentVNode("", true),
__props.expandSpace && !__props.data[__props.childrenColumnName] && !unref(slot).expand && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", _hoisted_6$1)) : createCommentVNode("", true),
(unref(slot).expand || __props.data[__props.childrenColumnName]) && columnIndex === __props.expandIndex ? (openBlock(), createBlock(unref(_sfc_main$2E), {
key: 2,
class: "layui-table-cell-expand-icon",
type: unref(expandIconType),
onClick: handleExpand
}, null, 8, ["type"])) : createCommentVNode("", true),
createTextVNode(" " + toDisplayString(__props.index + 1), 1)
], 14, _hoisted_5$1)) : createCommentVNode("", true)
], 64)) : createCommentVNode("", true)
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
column.customSlot ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
isAutoShow(__props.data, column, __props.index, columnIndex) ? (openBlock(), createElementBlock("td", {
key: 0,
class: normalizeClass(["layui-table-cell", [
renderFixedClassName(column, columnIndex),
renderCellClassName(__props.data, column, __props.index, columnIndex),
column.fixed ? `layui-table-fixed-${column.fixed}` : ""
]]),
colspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).colspan,
rowspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).rowspan,
style: normalizeStyle([
{
textAlign: column.align,
whiteSpace: column.ellipsisTooltip ? "nowrap" : "normal"
},
renderFixedStyle(column, columnIndex),
renderCellStyle(__props.data, column, __props.index, columnIndex)
])
}, [
createElementVNode("div", {
style: normalizeStyle([{ "display": "flex" }, [
{ textAlign: column.align, justifyContent: column.align }
]])
}, [
__props.expandSpace && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", {
key: 0,
style: normalizeStyle({ "margin-right": __props.currentIndentSize + "px" })
}, null, 4)) : createCommentVNode("", true),
__props.expandSpace && !__props.data[__props.childrenColumnName] && !unref(slot).expand && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", _hoisted_8$1)) : createCommentVNode("", true),
(unref(slot).expand || __props.data[__props.childrenColumnName]) && columnIndex === __props.expandIndex ? (openBlock(), createBlock(unref(_sfc_main$2E), {
key: 2,
class: "layui-table-cell-expand-icon",
type: unref(expandIconType),
onClick: handleExpand
}, null, 8, ["type"])) : createCommentVNode("", true),
column.ellipsisTooltip ? (openBlock(), createBlock(_sfc_main$5, {
key: 3,
isAutoShow: true
}, {
content: withCtx(() => [
renderSlot(_ctx.$slots, column.customSlot, {
data: __props.data,
column
}, void 0, true)
]),
default: withCtx(() => [
renderSlot(_ctx.$slots, column.customSlot, {
data: __props.data,
column
}, void 0, true)
]),
_: 2
}, 1024)) : renderSlot(_ctx.$slots, column.customSlot, {
key: 4,
data: __props.data,
column
}, void 0, true)
], 4)
], 14, _hoisted_7$1)) : createCommentVNode("", true)
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
isAutoShow(__props.data, column, __props.index, columnIndex) ? (openBlock(), createElementBlock("td", {
key: 0,
class: normalizeClass(["layui-table-cell", [
renderFixedClassName(column, columnIndex),
renderCellClassName(__props.data, column, __props.index, columnIndex),
column.fixed ? `layui-table-fixed-${column.fixed}` : ""
]]),
colspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).colspan,
rowspan: spanMethodAttr(__props.data, column, __props.index, columnIndex).rowspan,
style: normalizeStyle([
{
textAlign: column.align,
whiteSpace: column.ellipsisTooltip ? "nowrap" : "normal"
},
renderFixedStyle(column, columnIndex),
renderCellStyle(__props.data, column, __props.index, columnIndex)
]),
onClick: ($event) => editIndex.value[columnIndex] = true
}, [
createElementVNode("div", {
style: normalizeStyle([{ "display": "flex" }, [
{ textAlign: column.align, justifyContent: column.align }
]])
}, [
__props.expandSpace && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", {
key: 0,
style: normalizeStyle({ "margin-right": __props.currentIndentSize + "px" })
}, null, 4)) : createCommentVNode("", true),
__props.expandSpace && !__props.data[__props.childrenColumnName] && !unref(slot).expand && columnIndex === __props.expandIndex ? (openBlock(), createElementBlock("span", _hoisted_10$1)) : createCommentVNode("", true),
(unref(slot).expand || __props.data[__props.childrenColumnName]) && columnIndex === __props.expandIndex ? (openBlock(), createBlock(unref(_sfc_main$2E), {
key: 2,
class: "layui-table-cell-expand-icon",
type: unref(expandIconType),
onClick: handleExpand
}, null, 8, ["type"])) : createCommentVNode("", true),
column.ellipsisTooltip ? (openBlock(), createBlock(_sfc_main$5, {
key: 3,
content: __props.data[column.key],
isAutoShow: true
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(__props.data[column.key]), 1)
]),
_: 2
}, 1032, ["content"])) : (openBlock(), createElementBlock(Fragment, { key: 4 }, [
column.edit ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
!editIndex.value[columnIndex] ? (openBlock(), createElementBlock("span", _hoisted_11$1, toDisplayString(__props.data[column.key]), 1)) : (openBlock(), createBlock(_component_lay_input, {
key: 1,
autofocus: true,
modelValue: __props.data[column.key],
"onUpdate:modelValue": ($event) => __props.data[column.key] = $event,
onKeyup: withKeys(($event) => editIndex.value[columnIndex] = false, ["enter"]),
onBlur: ($event) => editIndex.value[columnIndex] = false
}, null, 8, ["modelValue", "onUpdate:modelValue", "onKeyup", "onBlur"]))
], 64)) : (openBlock(), createElementBlock("span", _hoisted_12$1, toDisplayString(__props.data[column.key]), 1))
], 64))
], 4)
], 14, _hoisted_9$1)) : createCommentVNode("", true)
], 64))
], 64))
], 64)) : createCommentVNode("", true)
], 64);
}), 128))
], 38),
unref(slot).expand && unref(isExpand) ? (openBlock(), createElementBlock("tr", _hoisted_13$1, [
createElementVNode("td", {
class: "layui-table-cell",
colspan: __props.columns.length
}, [
renderSlot(_ctx.$slots, "expand", { data: __props.data }, void 0, true)
], 8, _hoisted_14$1)
])) : createCommentVNode("", true),
__props.data[__props.childrenColumnName] && unref(isExpand) ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(__props.data[__props.childrenColumnName], (children, childrenIndex) => {
return openBlock(), createBlock(_component_table_row, {
key: childrenIndex,
id: __props.id,
data: children,
index: childrenIndex,
columns: __props.columns,
"indent-size": __props.indentSize,
"current-indent-size": unref(childrenIndentSize),
checkbox: __props.checkbox,
tableColumnKeys: __props.tableColumnKeys,
expandSpace: __props.expandSpace,
expandIndex: __props.expandIndex,
cellStyle: __props.cellStyle,
cellClassName: __props.cellClassName,
rowStyle: __props.rowStyle,
rowClassName: __props.rowClassName,
spanMethod: __props.spanMethod,
defaultExpandAll: __props.defaultExpandAll,
getCheckboxProps: __props.getCheckboxProps,
getRadioProps: __props.getRadioProps,
onRow: rowClick,
onRowDouble: rowDoubleClick,
onRowContextmenu: rowContextmenu,
expandKeys: unref(tableExpandKeys),
"onUpdate:expandKeys": _cache[5] || (_cache[5] = ($event) => isRef(tableExpandKeys) ? tableExpandKeys.value = $event : null),
selectedKeys: unref(tableSelectedKeys),
"onUpdate:selectedKeys": _cache[6] || (_cache[6] = ($event) => isRef(tableSelectedKeys) ? tableSelectedKeys.value = $event : null),
selectedKey: unref(tableSelectedKey),
"onUpdate:selectedKey": _cache[7] || (_cache[7] = ($event) => isRef(tableSelectedKey) ? tableSelectedKey.value = $event : null)
}, createSlots({ _: 2 }, [
renderList(slotsData.value, (name) => {
return {
name,
fn: withCtx((slotProp) => [
renderSlot(_ctx.$slots, name, {
data: slotProp.data,
column: slotProp.column
}, void 0, true)
])
};
}),
unref(slot).expand ? {
name: "expand",
fn: withCtx((slotProp) => [
renderSlot(_ctx.$slots, "expand", {
data: slotProp.data,
column: slotProp.column
}, void 0, true)
]),
key: "0"
} : void 0
]), 1032, ["id", "data", "index", "columns", "indent-size", "current-indent-size", "checkbox", "tableColumnKeys", "expandSpace", "expandIndex", "cellStyle", "cellClassName", "rowStyle", "rowClassName", "spanMethod", "defaultExpandAll", "getCheckboxProps", "getRadioProps", "expandKeys", "selectedKeys", "selectedKey"]);
}), 128)) : createCommentVNode("", true)
], 64);
};
}
});
var TableRow = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-4baf8383"]]);
const __default__$1 = {
name: "TablePage"
};
const _sfc_main$1 = defineComponent({
...__default__$1,
props: {
showPage: { type: Boolean, default: true },
showSkip: { type: Boolean, default: true },
showLimit: { type: Boolean, default: true },
showCount: { type: Boolean },
showRefresh: { type: Boolean },
current: null,
limits: null,
pages: null,
total: null,
limit: null,
theme: null,
count: null
},
emits: ["update:current", "update:limit", "change"],
setup(__props, { emit }) {
const props = __props;
const current = computed({
get() {
return props.current;
},
set(val) {
emit("update:current", val);
}
});
const limit = computed({
get() {
return props.limit;
},
set(val) {
emit("update:limit", val);
}
});
const change = (pageData) => {
emit("change", pageData);
};
return (_ctx, _cache) => {
return openBlock(), createBlock(_sfc_main$6, {
total: __props.total,
"show-page": __props.showPage,
"show-skip": __props.showSkip,
"show-limit": __props.showLimit,
"show-count": __props.showCount,
"show-refresh": __props.showRefresh,
limits: __props.limits,
theme: __props.theme,
pages: __props.pages,
count: __props.count,
modelValue: unref(current),
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(current) ? current.value = $event : null),
limit: unref(limit),
"onUpdate:limit": _cache[1] || (_cache[1] = ($event) => isRef(limit) ? limit.value = $event : null),
onChange: change
}, {
prev: withCtx(() => [
createVNode(unref(_sfc_main$2E), { type: "layui-icon-left" })
]),
next: withCtx(() => [
createVNode(unref(_sfc_main$2E), { type: "layui-icon-right" })
]),
_: 1
}, 8, ["total", "show-page", "show-skip", "show-limit", "show-count", "show-refresh", "limits", "theme", "pages", "count", "modelValue", "limit"]);
};
}
});
const _hoisted_1 = /* @__PURE__ */ createElementVNode("table", {
class: "layui-hide",
"lay-filter": "test"
}, null, -1);
const _hoisted_2 = {
key: 0,
class: "layui-table-tool"
};
const _hoisted_3 = { class: "layui-table-tool-temp" };
const _hoisted_4 = {
key: 0,
class: "layui-table-tool-self"
};
const _hoisted_5 = /* @__PURE__ */ createElementVNode("div", {
class: "layui-inline",
title: "\u7B5B\u9009",
"lay-event": ""
}, [
/* @__PURE__ */ createElementVNode("i", { class: "layui-icon layui-icon-slider" })
], -1);
const _hoisted_6 = { class: "layui-table-tool-checkbox" };
const _hoisted_7 = /* @__PURE__ */ createElementVNode("i", { class: "layui-icon layui-icon-export" }, null, -1);
const _hoisted_8 = [
_hoisted_7
];
const _hoisted_9 = /* @__PURE__ */ createElementVNode("i", { class: "layui-icon layui-icon-print" }, null, -1);
const _hoisted_10 = [
_hoisted_9
];
const _hoisted_11 = {
key: 1,
class: "layui-table-box-header"
};
const _hoisted_12 = { class: "layui-table-box" };
const _hoisted_13 = ["lay-size", "lay-skin"];
const _hoisted_14 = ["width"];
const _hoisted_15 = ["colspan", "rowspan"];
const _hoisted_16 = {
key: 0,
class: "layui-table-sort layui-inline",
"lay-sort": ""
};
const _hoisted_17 = ["onClick"];
const _hoisted_18 = ["onClick"];
const _hoisted_19 = ["lay-size", "lay-skin"];
const _hoisted_20 = ["width"];
const _hoisted_21 = {
key: 0,
class: "layui-table-total"
};
const _hoisted_22 = ["innerHTML"];
const _hoisted_23 = {
key: 2,
class: "layui-table-loading"
};
const _hoisted_24 = /* @__PURE__ */ createElementVNode("i", { class: "layui-icon-loading layui-icon layui-anim layui-anim-rotate layui-anim-loop" }, null, -1);
const _hoisted_25 = [
_hoisted_24
];
const _hoisted_26 = {
key: 0,
class: "layui-table-footer"
};
const _hoisted_27 = {
key: 2,
class: "layui-table-page"
};
const __default__ = {
name: "LayTable"
};
const _sfc_main = defineComponent({
...__default__,
props: {
id: { default: "id" },
skin: null,
size: { default: "md" },
page: null,
columns: null,
dataSource: { default: () => [] },
defaultToolbar: { type: [Boolean, Array], default: false },
selectedKey: { default: "" },
selectedKeys: { default: () => [] },
indentSize: { default: 30 },
childrenColumnName: { default: "children" },
height: null,
maxHeight: { default: "auto" },
even: { type: Boolean, default: false },
expandIndex: { default: 0 },
rowClassName: { type: [String, Function], default: "" },
cellClassName: { type: [String, Function], default: "" },
rowStyle: { type: [String, Function], default: "" },
cellStyle: { type: [String, Function], default: "" },
spanMethod: { type: Function, default: () => {
} },
defaultExpandAll: { type: Boolean, default: false },
expandKeys: { default: () => [] },
loading: { type: Boolean, default: false },
getCheckboxProps: { type: Function, default: () => {
} },
getRadioProps: { type: Function, default: () => {
} }
},
emits: [
"change",
"update:expandKeys",
"update:selectedKeys",
"update:selectedKey",
"row-contextmenu",
"row-double",
"row"
],
setup(__props, { emit }) {
const props = __props;
const slot = useSlots();
slot.default && slot.default();
const tableRef = ref();
const allChecked = ref(false);
const hasChecked = ref(false);
const tableDataSource = ref([...props.dataSource]);
const tableColumns = computed(() => {
return [...props.columns];
});
const tableHeadColumns = ref([]);
const tableBodyColumns = ref([]);
const getLevel = (arr) => {
let maxLevel = 0;
(function callBack(arr2, level) {
++level;
maxLevel = Math.max(level, maxLevel);
for (let i = 0; i < arr2.length; i++) {
let item = arr2[i];
if (item.children && item.children.length > 0) {
callBack(item.children, level);
} else {
delete item.children;
}
}
})(arr, 0);
return maxLevel;
};
function getLeafCountTree(json) {
if (!json.children || json.children.length == 0) {
json.colspan = 1;
return 1;
} else {
var leafCount = 0;
for (var i = 0; i < json.children.length; i++) {
leafCount = leafCount + getLeafCountTree(json.children[i]);
}
json.colspan = leafCount;
return leafCount;
}
}
const findFindNode = (columns) => {
columns.forEach((column) => {
if (column.children) {
findFindNode(column.children);
} else {
tableBodyColumns.value.push(column);
}
});
};
findFindNode(tableColumns.value);
const tableColumnKeys = ref([]);
const findFindNodes = (columns) => {
columns.forEach((column) => {
if (column.children) {
tableColumnKeys.value.push(column.key);
findFindNodes(column.children);
} else {
if (!column.hide) {
tableColumnKeys.value.push(column.key);
}
}
});
};
findFindNodes(tableColumns.value);
const findFinalNode = (level, columns) => {
columns.forEach((column) => {
if (column.children) {
const colSpan = getLeafCountTree(column);
column.colspan = colSpan;
if (!tableHeadColumns.value[level]) {
tableHeadColumns.value[level] = [];
}
if (column.fixed && !column.width) {
column.type ? column.width = "50px" : column.width = "100px";
}
tableHeadColumns.value[level].push(column);
findFinalNode(level + 1, column.children);
} else {
const rowSpan = getLevel(columns);
column.rowspan = rowSpan;
if (!tableHeadColumns.value[level]) {
tableHeadColumns.value[level] = [];
}
if (column.fixed && !column.width) {
column.type ? column.width = "50px" : column.width = "100px";
}
tableHeadColumns.value[level].push(column);
}
});
};
findFinalNode(0, tableColumns.value);
const tableSelectedKeys = ref([...props.selectedKeys]);
const tableExpandKeys = ref([...props.expandKeys]);
watch(() => props.selectedKeys, () => {
tableSelectedKeys.value = props.selectedKeys;
}, { deep: true });
watch(() => props.expandKeys, () => {
tableExpandKeys.value = props.expandKeys;
}, { deep: true });
const tableSelectedKey = computed({
get() {
return props.selectedKey;
},
set(val) {
emit("update:selectedKey", val);
}
});
watch(() => props.dataSource, () => {
tableDataSource.value = [...props.dataSource];
}, { deep: true });
const changeAll = (isChecked) => {
if (isChecked) {
const datasources = props.dataSource.filter((item, index2) => {
var _a;
return !((_a = props.getCheckboxProps(item, index2)) == null ? void 0 : _a.disabled);
});
const ids = datasources.map((item) => {
return item[props.id];
});
tableSelectedKeys.value = [...ids];
} else {
tableSelectedKeys.value = [];
}
};
watch(tableSelectedKeys, () => {
if (tableSelectedKeys.value.length === props.dataSource.length) {
allChecked.value = true;
} else {
allChecked.value = false;
}
if (tableSelectedKeys.value.length > 0) {
hasChecked.value = true;
} else {
hasChecked.value = false;
}
emit("update:selectedKeys", tableSelectedKeys.value);
}, { deep: true, immediate: true });
watch(tableExpandKeys, () => {
emit("update:expandKeys", tableExpandKeys.value);
}, { deep: true, immediate: true });
const change = function(page) {
emit("change", page);
};
const rowClick = function(data, evt) {
emit("row", data, evt);
};
const rowDoubleClick = function(data, evt) {
emit("row-double", data, evt);
};
const rowContextmenu = (data, evt) => {
emit("row-contextmenu", data, evt);
};
const print = () => {
let subOutputRankPrint = tableRef.value;
let newContent = subOutputRankPrint.innerHTML;
let oldContent = document.body.innerHTML;
document.body.innerHTML = newContent;
window.print();
window.location.reload();
document.body.innerHTML = oldContent;
};
const exportData = () => {
var tableStr = ``;
for (let tableHeadColumn of tableHeadColumns.value) {
tableStr += "<tr>";
for (let column of tableHeadColumn) {
tableStr += `<td colspan=${column.colspan} rowspan=${column.rowspan}>${column.title}</td>`;
}
tableStr += "</tr>";
}
tableDataSource.value.forEach((item, rowIndex) => {
tableStr += "<tr>";
tableBodyColumns.value.forEach((tableColumn, columnIndex) => {
Object.keys(item).forEach((name) => {
if (tableColumn.key === name) {
const rowColSpan = props.spanMethod(item, tableColumn, rowIndex, columnIndex);
const rowspan = rowColSpan ? rowColSpan[0] : 1;
const colspan = rowColSpan ? rowColSpan[1] : 1;
if (rowspan != 0 && colspan != 0) {
tableStr += `<td colspan=${colspan} rowspan=${rowspan}>${item[name]}</td>`;
}
}
});
});
tableStr += "</tr>";
});
var worksheet = "Sheet1";
var uri = "data:application/vnd.ms-excel;base64,";
var exportTemplate = `<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet>
<x:Name>${worksheet}</x:Name>
<x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet>
</x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->
</head>
<body>
<table syle="table-layout: fixed;word-wrap: break-word; word-break: break-all;">${tableStr}</table>
</body>
</html>`;
window.location.href = uri + base64(exportTemplate);
return;
};
function base64(s2) {
return window.btoa(unescape(encodeURIComponent(s2)));
}
const sortTable = (e, key, sort) => {
let currentSort = e.target.parentNode.getAttribute("lay-sort");
if (sort === "desc") {
if (currentSort === sort) {
e.target.parentNode.setAttribute("lay-sort", "");
tableDataSource.value = [...props.dataSource];
} else {
e.target.parentNode.setAttribute("lay-sort", "desc");
tableDataSource.value.sort((x, y) => {
if (x[key] < y[key])
return 1;
else if (x[key] > y[key])
return -1;
else
return 0;
});
}
} else {
if (currentSort === sort) {
e.target.parentNode.setAttribute("lay-sort", "");
tableDataSource.value = [...props.dataSource];
} else {
e.target.parentNode.setAttribute("lay-sort", "asc");
tableDataSource.value.sort((x, y) => {
if (x[key] < y[key])
return -1;
else if (x[key] > y[key])
return 1;
else
return 0;
});
}
}
};
let tableBody = ref(null);
let tableHeader = ref(null);
let tableHeaderTable = ref(null);
const tableBodyEmptyWidth = ref();
let scrollWidthCell = ref(0);
const getScrollWidth = () => {
var _a, _b, _c;
const clientWidth = ((_a = tableBody.value) == null ? void 0 : _a.clientWidth) || 0;
const offsetWidth = ((_b = tableBody.value) == null ? void 0 : _b.offsetWidth) || 0;
if (clientWidth < offsetWidth) {
scrollWidthCell.value = offsetWidth - clientWidth;
} else {
scrollWidthCell.value = 0;
}
tableBodyEmptyWidth.value = ((_c = tableHeaderTable.value) == null ? void 0 : _c.offsetWidth) + "px";
};
const hasl = ref(false);
const hasr = ref(false);
const classes = computed(() => {
return [
hasl.value ? "layui-table-has-fixed-left" : "",
hasr.value ? "layui-table-has-fixed-right" : ""
];
});
watch(() => [props.height, props.maxHeight, props.dataSource], () => {
nextTick(() => {
getScrollWidth();
getFixedColumn();
});
}, {
deep: true
});
onMounted(() => {
var _a, _b;
getScrollWidth();
getFixedColumn();
(_a = tableBody.value) == null ? void 0 : _a.addEventListener("scroll", () => {
getFixedColumn();
});
(_b = tableBody.value) == null ? void 0 : _b.addEventListener("transitionend", () => {
getScrollWidth();
});
window.onresize = () => {
getScrollWidth();
getFixedColumn();
};
});
const getFixedColumn = () => {
var _a, _b, _c, _d, _e, _f, _g;
tableHeader.value.scrollLeft = ((_a = tableBody.value) == null ? void 0 : _a.scrollLeft) || 0;
if (((_b = tableBody.value) == null ? void 0 : _b.scrollWidth) > ((_c = tableBody.value) == null ? void 0 : _c.clientWidth)) {
if (((_d = tableBody.value) == null ? void 0 : _d.scrollLeft) == 0) {
hasl.value = false;
hasr.value = true;
} else {
const t = ((_e = tableBody.value) == null ? void 0 : _e.scrollLeft) + ((_f = tableBody.value) == null ? void 0 : _f.offsetWidth) + 2;
const s2 = (_g = tableBody.value) == null ? void 0 : _g.scrollWidth;
if (t > s2) {
hasl.value = true;
hasr.value = false;
} else {
hasl.value = true;
hasr.value = true;
}
}
} else {
hasl.value = false;
hasr.value = false;
}
};
const slotsData = ref([]);
props.columns.map((value) => {
if (value.customSlot) {
slotsData.value.push(value.customSlot);
}
});
const currentIndentSize = ref(0);
const childrenExpandSpace = computed(() => {
return props.dataSource.find((value) => {
if (value[props.childrenColumnName]) {
return true;
}
}) != void 0;
});
const renderFixedStyle = (column, columnIndex) => {
var _a, _b, _c, _d;
if (column.fixed) {
if (column.fixed == "left") {
var left = 0;
for (var i = 0; i < columnIndex; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "left" && tableColumnKeys.value.includes(props.columns[i].key)) {
left = left + Number((_b = (_a = props.columns[i]) == null ? void 0 : _a.width) == null ? void 0 : _b.replace("px", ""));
}
}
return { left: `${left}px` };
} else {
var right = 0;
for (var i = columnIndex + 1; i < props.columns.length; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "right" && tableColumnKeys.value.includes(props.columns[i].key)) {
right = right + Number((_d = (_c = props.columns[i]) == null ? void 0 : _c.width) == null ? void 0 : _d.replace("px", ""));
}
}
return { right: `${right}px` };
}
} else {
var isLast = true;
for (var i = columnIndex + 1; i < props.columns.length; i++) {
if (props.columns[i].fixed == void 0 && tableColumnKeys.value.includes(props.columns[i].key)) {
isLast = false;
}
}
return isLast ? { "border-right": "none" } : {};
}
};
const renderHeadFixedStyle = (column, columnIndex, tableHeadColumn) => {
var _a, _b, _c, _d;
if (column.fixed) {
if (column.fixed == "left") {
var left = 0;
for (var i = 0; i < columnIndex; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "left" && tableColumnKeys.value.includes(props.columns[i].key)) {
left = left + Number((_b = (_a = props.columns[i]) == null ? void 0 : _a.width) == null ? void 0 : _b.replace("px", ""));
}
}
return { left: `${left}px` };
} else {
var right = 0;
for (var i = columnIndex + 1; i < props.columns.length; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "right" && tableColumnKeys.value.includes(props.columns[i].key)) {
right = right + Number((_d = (_c = props.columns[i]) == null ? void 0 : _c.width) == null ? void 0 : _d.replace("px", ""));
}
}
return { right: `${right}px` };
}
} else {
var isLast = true;
for (var i = columnIndex + 1; i < tableHeadColumn.length; i++) {
if (tableHeadColumn[i].fixed == void 0 && tableColumnKeys.value.includes(tableHeadColumn[i].key)) {
isLast = false;
}
}
return isLast ? { "border-right": "none" } : {};
}
};
const renderFixedClassName = (column, columnIndex) => {
if (column.fixed) {
if (column.fixed == "left") {
var left = true;
for (var i = columnIndex + 1; i < props.columns.length; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "left" && tableColumnKeys.value.includes(props.columns[i].key)) {
left = false;
}
}
return left ? `layui-table-fixed-left-last` : "";
} else {
var right = true;
for (var i = 0; i < columnIndex; i++) {
if (props.columns[i].fixed && props.columns[i].fixed == "right" && tableColumnKeys.value.includes(props.columns[i].key)) {
right = false;
}
}
return right ? `layui-table-fixed-right-first` : "";
}
}
};
const hasTotalRow = computed(() => {
let b = false;
props.columns.forEach((item) => {
if (item.totalRow) {
b = true;
}
});
return b;
});
const renderTotalRowCell = (column) => {
if (column.totalRow) {
if (column.totalRow != true) {
return column.totalRow;
} else {
if (column.totalRowMethod) {
return column.totalRowMethod(column, tableDataSource.value);
} else {
return totalRowMethod(column, tableDataSource.value);
}
}
}
};
const totalRowMethod = (column, dataSource) => {
let total = 0;
dataSource.forEach((item) => {
total = total + Number(item[column.key]);
});
return total;
};
const showToolbar = (toolbarName) => {
if (props.defaultToolbar instanceof Array) {
return props.defaultToolbar.includes(toolbarName);
}
return props.defaultToolbar;
};
const toolbarStyle = (toolbarName) => {
if (props.defaultToolbar instanceof Array) {
return { order: props.defaultToolbar.indexOf(toolbarName) };
}
};
onBeforeUnmount(() => {
window.onresize = null;
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
ref_key: "tableRef",
ref: tableRef
}, [
_hoisted_1,
createElementVNode("div", {
class: normalizeClass(["layui-form layui-border-box layui-table-view", unref(classes)])
}, [
__props.defaultToolbar || unref(slot).toolbar ? (openBlock(), createElementBlock("div", _hoisted_2, [
createElementVNode("div", _hoisted_3, [
renderSlot(_ctx.$slots, "toolbar")
]),
__props.defaultToolbar ? (openBlock(), createElementBlock("div", _hoisted_4, [
showToolbar("filter") ? (openBlock(), createBlock(_sfc_main$7, {
key: 0,
updateAtScroll: "",
style: normalizeStyle(toolbarStyle("filter"))
}, {
content: withCtx(() => [
createElementVNode("div", _hoisted_6, [
(openBlock(true), createElementBlock(Fragment, null, renderList(tableHeadColumns.value[0], (column) => {
return openBlock(), createBlock(_sfc_main$4, {
modelValue: tableColumnKeys.value,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => tableColumnKeys.value = $event),
skin: "primary",
disabled: column.children,
key: column.key,
value: column.key
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(column.title), 1)
]),
_: 2
}, 1032, ["modelValue", "disabled", "value"]);
}), 128))
])
]),
default: withCtx(() => [
_hoisted_5
]),
_: 1
}, 8, ["style"])) : createCommentVNode("", true),
showToolbar("export") ? (openBlock(), createElementBlock("div", {
key: 1,
class: "layui-inline",
title: "\u5BFC\u51FA",
"lay-event": "",
style: normalizeStyle(toolbarStyle("export")),
onClick: _cache[1] || (_cache[1] = ($event) => exportData())
}, _hoisted_8, 4)) : createCommentVNode("", true),
showToolbar("print") ? (openBlock(), createElementBlock("div", {
key: 2,
style: normalizeStyle(toolbarStyle("print")),
class: "layui-inline",
title: "\u6253\u5370",
"lay-event": "",
onClick: _cache[2] || (_cache[2] = ($event) => print())
}, _hoisted_10, 4)) : createCommentVNode("", true)
])) : createCommentVNode("", true)
])) : createCommentVNode("", true),
unref(slot).header ? (openBlock(), createElementBlock("div", _hoisted_11, [
renderSlot(_ctx.$slots, "header")
])) : createCommentVNode("", true),
createElementVNode("div", _hoisted_12, [
createElementVNode("div", {
class: "layui-table-header",
style: normalizeStyle([{ "padding-right": `${unref(scrollWidthCell)}px` }])
}, [
createElementVNode("div", {
class: "layui-table-header-wrapper",
ref_key: "tableHeader",
ref: tableHeader
}, [
createElementVNode("table", {
class: "layui-table",
"lay-size": __props.size,
"lay-skin": __props.skin,
ref_key: "tableHeaderTable",
ref: tableHeaderTable
}, [
createElementVNode("colgroup", null, [
(openBlock(true), createElementBlock(Fragment, null, renderList(tableBodyColumns.value, (column) => {
return openBlock(), createElementBlock(Fragment, { key: column }, [
tableColumnKeys.value.includes(column.key) ? (openBlock(), createElementBlock("col", {
key: 0,
width: column.width,
style: normalizeStyle({
minWidth: column.minWidth ? column.minWidth : "50px"
})
}, null, 12, _hoisted_14)) : createCommentVNode("", true)
], 64);
}), 128))
]),
createElementVNode("thead", null, [
(openBlock(true), createElementBlock(Fragment, null, renderList(tableHeadColumns.value, (tableHeadColumn, tableHeadColumnIndex) => {
return openBlock(), createElementBlock("tr", { key: tableHeadColumnIndex }, [
(openBlock(true), createElementBlock(Fragment, null, renderList(tableHeadColumn, (column, columnIndex) => {
return openBlock(), createElementBlock(Fragment, { key: column }, [
tableColumnKeys.value.includes(column.key) ? (openBlock(), createElementBlock("th", {
key: 0,
colspan: column.colspan,
rowspan: column.rowspan,
class: normalizeClass(["layui-table-cell", [
renderFixedClassName(column, columnIndex),
column.fixed ? `layui-table-fixed-${column.fixed}` : "",
column.type == "checkbox" ? "layui-table-cell-checkbox" : "",
column.type == "radio" ? "layui-table-cell-radio" : "",
column.type == "number" ? "layui-table-cell-number" : ""
]]),
style: normalizeStyle([
{
textAlign: column.align
},
renderHeadFixedStyle(column, columnIndex, tableHeadColumn)
])
}, [
column.type == "checkbox" ? (openBlock(), createBlock(_sfc_main$4, {
key: 0,
modelValue: hasChecked.value,
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => hasChecked.value = $event),
"is-indeterminate": !allChecked.value,
skin: "primary",
value: "all",
onChange: changeAll
}, null, 8, ["modelValue", "is-indeterminate"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
createElementVNode("span", null, [
column.titleSlot ? renderSlot(_ctx.$slots, column.titleSlot, { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
createTextVNode(toDisplayString(column.title), 1)
], 64))
]),
column.sort ? (openBlock(), createElementBlock("span", _hoisted_16, [
createElementVNode("i", {
onClick: withModifiers(($event) => sortTable($event, column.key, "asc"), ["stop"]),
class: "layui-edge layui-table-sort-asc",
title: "\u5347\u5E8F"
}, null, 8, _hoisted_17),
createElementVNode("i", {
onClick: withModifiers(($event) => sortTable($event, column.key, "desc"), ["stop"]),
class: "layui-edge layui-table-sort-desc",
title: "\u964D\u5E8F"
}, null, 8, _hoisted_18)
])) : createCommentVNode("", true)
], 64))
], 14, _hoisted_15)) : createCommentVNode("", true)
], 64);
}), 128))
]);
}), 128))
])
], 8, _hoisted_13)
], 512)
], 4),
createElementVNode("div", {
class: "layui-table-body layui-table-main",
style: normalizeStyle({ height: __props.height, maxHeight: __props.maxHeight }),
ref_key: "tableBody",
ref: tableBody
}, [
tableDataSource.value.length > 0 && __props.loading == false ? (openBlock(), createElementBlock("table", {
key: 0,
class: normalizeClass(["layui-table", { "layui-table-even": props.even }]),
"lay-size": __props.size,
"lay-skin": __props.skin
}, [
createElementVNode("colgroup", null, [
(openBlock(true), createElementBlock(Fragment, null, renderList(tableBodyColumns.value, (column, columnIndex) => {
return openBlock(), createElementBlock(Fragment, { key: columnIndex }, [
tableColumnKeys.value.includes(column.key) ? (openBlock(), createElementBlock("col", {
key: 0,
width: column.width,
style: normalizeStyle({
minWidth: column.minWidth ? column.minWidth : "50px"
})
}, null, 12, _hoisted_20)) : createCommentVNode("", true)
], 64);
}), 128))
]),
createElementVNode("tbody", null, [
(openBlock(true), createElementBlock(Fragment, null, renderList(tableDataSource.value, (children, index2) => {
return openBlock(), createBlock(TableRow, {
key: index2,
id: __props.id,
index: index2,
data: children,
columns: tableBodyColumns.value,
"indent-size": __props.indentSize,
currentIndentSize: currentIndentSize.value,
tableColumnKeys: tableColumnKeys.value,
expandSpace: unref(childrenExpandSpace),
expandIndex: __props.expandIndex,
cellStyle: __props.cellStyle,
cellClassName: __props.cellClassName,
rowStyle: __props.rowStyle,
rowClassName: __props.rowClassName,
spanMethod: __props.spanMethod,
defaultExpandAll: __props.defaultExpandAll,
getCheckboxProps: __props.getCheckboxProps,
getRadioProps: __props.getRadioProps,
expandKeys: tableExpandKeys.value,
"onUpdate:expandKeys": _cache[4] || (_cache[4] = ($event) => tableExpandKeys.value = $event),
selectedKeys: tableSelectedKeys.value,
"onUpdate:selectedKeys": _cache[5] || (_cache[5] = ($event) => tableSelectedKeys.value = $event),
selectedKey: unref(tableSelectedKey),
"onUpdate:selectedKey": _cache[6] || (_cache[6] = ($event) => isRef(tableSelectedKey) ? tableSelectedKey.value = $event : null),
onRow: rowClick,
onRowDouble: rowDoubleClick,
onRowContextmenu: rowContextmenu
}, createSlots({ _: 2 }, [
renderList(slotsData.value, (name) => {
return {
name,
fn: withCtx(({ data }) => [
renderSlot(_ctx.$slots, name, { data })
])
};
}),
unref(slot).expand ? {
name: "expand",
fn: withCtx(({ data }) => [
renderSlot(_ctx.$slots, "expand", { data })
]),
key: "0"
} : void 0
]), 1032, ["id", "index", "data", "columns", "indent-size", "currentIndentSize", "tableColumnKeys", "expandSpace", "expandIndex", "cellStyle", "cellClassName", "rowStyle", "rowClassName", "spanMethod", "defaultExpandAll", "getCheckboxProps", "getRadioProps", "expandKeys", "selectedKeys", "selectedKey"]);
}), 128)),
unref(hasTotalRow) ? (openBlock(), createElementBlock("tr", _hoisted_21, [
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column, columnIndex) => {
return openBlock(), createElementBlock(Fragment, { key: columnIndex }, [
tableColumnKeys.value.includes(column.key) ? (openBlock(), createElementBlock("td", {
key: 0,
style: normalizeStyle([
{
textAlign: column.align,
whiteSpace: column.ellipsisTooltip ? "nowrap" : "normal"
},
renderFixedStyle(column, columnIndex)
]),
class: normalizeClass([
"layui-table-cell",
renderFixedClassName(column, columnIndex),
column.fixed ? `layui-table-fixed-${column.fixed}` : ""
]),
innerHTML: renderTotalRowCell(column)
}, null, 14, _hoisted_22)) : createCommentVNode("", true)
], 64);
}), 128))
])) : createCommentVNode("", true)
])
], 10, _hoisted_19)) : createCommentVNode("", true),
tableDataSource.value.length == 0 && __props.loading == false ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
createVNode(_sfc_main$8),
createElementVNode("div", {
style: normalizeStyle({ width: tableBodyEmptyWidth.value })
}, null, 4)
], 64)) : createCommentVNode("", true),
__props.loading == true ? (openBlock(), createElementBlock("div", _hoisted_23, _hoisted_25)) : createCommentVNode("", true)
], 4),
unref(slot).footer ? (openBlock(), createElementBlock("div", _hoisted_26, [
renderSlot(_ctx.$slots, "footer")
])) : createCommentVNode("", true)
]),
__props.page && __props.page.total > 0 ? (openBlock(), createElementBlock("div", _hoisted_27, [
createVNode(_sfc_main$1, {
total: __props.page.total,
pages: __props.page.pages,
theme: __props.page.theme,
limits: __props.page.limits,
showSkip: __props.page.showSkip,
"show-page": __props.page.showPage,
showRefresh: __props.page.showRefresh,
showLimit: __props.page.showLimit,
showCount: __props.page.showCount,
count: __props.page.count,
current: __props.page.current,
"onUpdate:current": _cache[7] || (_cache[7] = ($event) => __props.page.current = $event),
limit: __props.page.limit,
"onUpdate:limit": _cache[8] || (_cache[8] = ($event) => __props.page.limit = $event),
onChange: change
}, null, 8, ["total", "pages", "theme", "limits", "showSkip", "show-page", "showRefresh", "showLimit", "showCount", "count", "current", "limit"])
])) : createCommentVNode("", true)
], 2)
], 512);
};
}
});
const component = withInstall(_sfc_main);
export { component as default };