UNPKG

@wocwin/t-ui-plus

Version:

Page level components developed based on Element Plus.

1,016 lines (1,013 loc) 40.4 kB
import { createElementVNode, defineComponent, reactive, computed, ref, useSlots, watch, onMounted, onBeforeUnmount, onUpdated, resolveComponent, resolveDirective, withDirectives, openBlock, createElementBlock, createCommentVNode, createVNode, createBlock, normalizeStyle, renderSlot, Fragment, toDisplayString, mergeProps, unref, withCtx, normalizeProps, createSlots, renderList, guardReactiveProps, withModifiers, normalizeClass, createTextVNode } from 'vue'; import { Rank, Edit } from '@element-plus/icons-vue'; import { ElMessage } from 'element-plus'; import Sortable from 'sortablejs'; import './TTableColumn.vue.mjs'; import './singleEditCell.vue.mjs'; import './singleEdit.vue.mjs'; import './ColumnSet.vue.mjs'; import './renderCol.vue.mjs'; import './operator.vue.mjs'; import './renderHeader.vue.mjs'; import './firstColumn.vue.mjs'; import './densitySet.vue.mjs'; import { useVirtualized } from './useVirtualized.mjs'; import { useExpose } from './useExpose.mjs'; import { tableProps } from './tableProps.mjs'; import '../../../hooks/index.mjs'; import { useLocale } from '../../../hooks/useLocale.mjs'; import _sfc_main$1 from './ColumnSet.vue2.mjs'; import _sfc_main$2 from './densitySet.vue2.mjs'; import _sfc_main$3 from './firstColumn.vue2.mjs'; import _sfc_main$4 from './renderCol.vue2.mjs'; import _sfc_main$5 from './singleEditCell.vue2.mjs'; import _sfc_main$6 from './singleEdit.vue2.mjs'; import _sfc_main$7 from './renderHeader.vue2.mjs'; import _sfc_main$8 from './TTableColumn.vue2.mjs'; import _sfc_main$9 from './operator.vue2.mjs'; const _hoisted_1 = ["element-loading-text"]; const _hoisted_2 = { key: 0, class: "header_title" }; const _hoisted_3 = { key: 0 }; const _hoisted_4 = { key: 1 }; const _hoisted_5 = { class: "toolbar_top" }; const _hoisted_6 = { key: 0, class: "title-tip" }; const _hoisted_7 = { key: 1, style: { "display": "inline" } }; const _hoisted_8 = /* @__PURE__ */ createElementVNode( "span", { style: { "color": "#f56c6c", "font-size": "16px", "margin-right": "3px" } }, "*", -1 /* HOISTED */ ); const _hoisted_9 = { key: 5 }; const _hoisted_10 = { key: 0 }; var _sfc_main = /* @__PURE__ */ defineComponent({ ...{ name: "TTable" }, __name: "index", props: tableProps, emits: [ "save", "page-change", "handleEvent", "radioChange", "rowSort", "validateError" ], setup(__props, { expose: __expose, emit: __emit }) { const { scrollContainerEl, updateRenderedItemCache, updateOffset, getDom, saveDATA, getItemHeightFromCache } = useVirtualized(); const { TTable, clearSelection, getSelectionRows, toggleRowSelection, toggleAllSelection, toggleRowExpansion, setCurrentRow, clearSort, clearFilter, doLayout, sort, scrollTo, setScrollTop, setScrollLeft } = useExpose(); const props = __props; const { t } = useLocale(); let state = reactive({ size: props.defaultSize, tableData: props.table.data, columnSet: [], copyTableData: [] // 键盘事件 }); const emptyDataRequired = computed(() => { if (props.isEmptyDataRequired) { return state.tableData.length > 0; } else { return true; } }); const radioVal = ref(""); const forbidden = ref(true); const TTableBox = ref(null); const columnSetRef = ref(null); const formRef = ref({}); const handleRef = (el, scope, item) => { if (el) { formRef.value[`formRef-${scope.$index}-${item.prop || scope.column.property}`] = el; } }; const editTableRef = ref({}); const handleEditTableRef = (el, scope, item) => { if (el) { editTableRef.value[`singleEditRef-${scope.$index}-${item.prop || scope.column.property}`] = el; } }; const emits = __emit; const slots = useSlots(); watch( () => props.table.data, (val) => { if (props.useVirtual) { saveDATA.value = val; updateRenderData(0); } else { state.tableData = val; } }, { deep: true } ); watch( () => props.isRowSort, (val) => { if (val) { initSort(); } } ); onMounted(() => { var _a; if (props.defaultRadioCol) { defaultRadioSelect(props.defaultRadioCol); } initSort(); if (props.useVirtual) { saveDATA.value = props.table.data; getDom(); (_a = scrollContainerEl.value) == null ? void 0 : _a.addEventListener("scroll", handleScroll); } }); const updateRenderData = (scrollTop) => { let startIndex = 0; let offsetHeight = 0; for (let i = 0; i < saveDATA.value.length; i++) { offsetHeight += getItemHeightFromCache(i); if (offsetHeight >= scrollTop) { startIndex = i; break; } } state.tableData = saveDATA.value.slice(startIndex, startIndex + props.virtualShowSize); updateRenderedItemCache(startIndex); updateOffset(offsetHeight - getItemHeightFromCache(startIndex)); }; const handleScroll = (e) => { updateRenderData(e.target.scrollTop); }; onBeforeUnmount(() => { var _a; if (props.useVirtual) { (_a = scrollContainerEl.value) == null ? void 0 : _a.removeEventListener("scroll", handleScroll); } }); onUpdated(() => { TTable.value.doLayout(); }); const defaultRadioSelect = (index) => { radioVal.value = index; emits("radioChange", state.tableData[index - 1], radioVal.value); }; const initSort = () => { var _a; if (!props.isRowSort) return; const el = (_a = TTableBox.value) == null ? void 0 : _a.querySelector(".el-table__body-wrapper tbody"); const handle = props.isRowSortIcon ? ".row_drag" : ".el-table__row"; Sortable.create(el, { animation: 150, // 动画 handle, // 指定拖拽目标,点击此目标才可拖拽元素(此例中设置操作按钮拖拽) // filter: '.disabled', // 指定不可拖动的类名(el-table中可通过row-class-name设置行的class) // dragClass: 'dragClass', // 设置拖拽样式类名 // ghostClass: 'ghostClass', // 设置拖拽停靠样式类名 // chosenClass: 'chosenClass', // 设置选中样式类名 onEnd: (evt) => { const curRow = state.tableData.splice(evt.oldIndex, 1)[0]; state.tableData.splice(evt.newIndex, 0, curRow); emits("rowSort", state.tableData, evt.oldIndex, evt.newIndex); } }); }; const constantEscape = (value, list, key, label) => { const res = list.find((item) => { return item[key] === value; }); return res && res[label]; }; const radioStyleClass = computed(() => { if (Array.isArray(props.table.firstColumn)) { return props.table.firstColumn.some((item) => item.type === "radio"); } else { return props.table.firstColumn && props.table.firstColumn.type === "radio"; } }); const isEditRules = computed(() => { return props.table.rules && Object.keys(props.table.rules).length > 0 || props.columns.some((item) => { var _a; return (_a = item == null ? void 0 : item.configEdit) == null ? void 0 : _a.rules; }); }); const renderColumns = computed(() => { if (state.columnSet.length === 0) { return props.columns; } const columnByProp = props.columns.reduce((acc, cur) => { acc[cur.prop] = cur; return acc; }, {}); return state.columnSet.filter((cur) => !cur.hidden).map((cur) => columnByProp[cur.prop]); }); const isTableHeader = computed(() => { return renderColumns.value.some((item) => item.children); }); const isTableBorder = computed(() => { return props.columns.some((item) => item.children); }); const handleKeyup = (event, index, key) => { if (!props.isKeyup) return; const copyTableData = JSON.parse(JSON.stringify(state.tableData)); const doms = document.getElementsByClassName(key); const focusNextElement = (nextIndex) => { var _a, _b; const nextDom = ((_a = doms[nextIndex]) == null ? void 0 : _a.getElementsByTagName("input")[0]) || ((_b = doms[nextIndex]) == null ? void 0 : _b.getElementsByTagName("textarea")[0]); if (nextDom) nextDom.focus(); }; switch (event.keyCode) { case 38: if (!index) index = copyTableData.length; focusNextElement(index - 1); break; case 40: if (index === copyTableData.length - 1) index = -1; focusNextElement(index + 1); break; case 13: let keyName = props.columns.map((val) => val.prop); let num = keyName.indexOf(key); if (num === -1) { num = 0; } else if (num === keyName.length - 1) { if (index === state.copyTableData.length - 1) { index = 0; } else { ++index; } } else { ++num; } let doms2 = document.getElementsByClassName(keyName[num]); if (doms2.length) { let dom = doms2[index].getElementsByTagName("input")[0] || doms2[index].getElementsByTagName("textarea")[0]; dom.focus(); } break; } }; const isForbidden = () => { forbidden.value = false; setTimeout(() => { forbidden.value = true; }, 0); }; const radioClick = (row, index) => { forbidden.value = !forbidden.value; const isCurrentlySelected = radioVal.value === index; if (isCurrentlySelected) { radioVal.value = null; } else { radioVal.value = index; } isForbidden(); emits("radioChange", radioVal.value ? row : null, radioVal.value); }; const radioHandleChange = (row, index) => { if (row == null ? void 0 : row.isRadioDisabled) return; if (props.rowClickRadio) { return; } if (radioVal.value === index) { emits("radioChange", row, index); return; } radioClick(row, index); }; const rowClick = (row) => { if (row.isRadioDisabled) return; if (props.rowClickRadio) { radioClick(row, state.tableData.indexOf(row) + 1); } else { return false; } if (props.rowClickCheckbox) { TTable.value.toggleRowSelection(row); } else { return false; } }; const clearRadioHandle = () => { radioVal.value = null; TTable.value.setCurrentRow(-1); }; const handleClickDensity = (size) => { state.size = size; }; const copyToClipboard = async (text) => { if (typeof text !== "string" || text.trim() === "") { throw new Error(t("plus.copy.invalidCopyContent")); } try { await navigator.clipboard.writeText(text); } catch (error) { throw new Error(t("plus.copy.copyFail")); } }; const showMessage = (type, message) => { if (type === "success") { ElMessage.success(message); } else { ElMessage.error(message); } }; const cellDblclick = async (row, column) => { if (!props.isCopy) { return false; } const value = row[column.property]; try { await copyToClipboard(String(value)); showMessage("success", t("plus.copy.copySuccess")); } catch (error) { showMessage("error", error.message || t("plus.copy.copyFail")); } }; const isShow = (name) => { return Object.keys(slots).includes(name); }; const save = () => { return new Promise((resolve) => { var _a; if (!isEditRules.value) { emits("save", state.tableData); resolve(state.tableData); return; } let successLength = 0; let rulesList = []; let rulesError = []; let propError = []; let propLabelError = []; const refList = Object.keys(formRef.value).filter((item) => item.includes("formRef")); const arr = renderColumns.value.filter((val) => { var _a2; if ((_a2 = val.configEdit) == null ? void 0 : _a2.rules) { return val; } }).map((item) => item.prop); const arr1 = (_a = props.table.rules && Object.keys(props.table.rules)) != null ? _a : []; const newArr = [...arr, ...arr1]; newArr.map((val) => { refList.map((item) => { if (typeof item === "string" && item.includes(val)) { rulesList.push(item); } }); }); rulesList.map((val) => { formRef.value[val].validate((valid) => { if (valid) { successLength = successLength + 1; } else { rulesError.push(val); } }); }); setTimeout(() => { if (successLength == rulesList.length) { if (isEditRules.value) { emits("save", state.tableData); resolve(state.tableData); } } else { rulesError.map((item) => { newArr.map((val) => { if (typeof item === "string" && item.includes(val)) { propError.push(val); } }); }); Array.from(new Set(propError)).map((item) => { renderColumns.value.map((val) => { if (item === val.prop) { propLabelError.push(val.label); } }); }); emits("validateError", propLabelError); } }, 300); }); }; const handleEvent = ({ type, val }, index) => { emits("handleEvent", type, val, index); }; const handlesCurrentChange = (val) => { emits("page-change", val); }; const saveMethod = (callback) => { var _a; if (!isEditRules.value) { callback && callback(state.tableData); return; } let successLength = 0; let rulesList = []; let rulesError = []; let propError = []; let propLabelError = []; const refList = Object.keys(formRef.value).filter((item) => item.includes("formRef")); const arr = renderColumns.value.filter((val) => { var _a2; if ((_a2 = val.configEdit) == null ? void 0 : _a2.rules) { return val; } }).map((item) => item.prop); const arr1 = (_a = props.table.rules && Object.keys(props.table.rules)) != null ? _a : []; const newArr = [...arr, ...arr1]; newArr.map((val) => { refList.map((item) => { if (item.includes(val)) { rulesList.push(item); } }); }); rulesList.map((val) => { formRef.value[val].validate((valid) => { if (valid) { successLength = successLength + 1; } else { rulesError.push(val); } }); }); setTimeout(() => { if (successLength == rulesList.length) { if (isEditRules.value) { callback && callback(state.tableData); } } else { rulesError.map((item) => { newArr.map((val) => { if (item.includes(val)) { propError.push(val); } }); }); Array.from(new Set(propError)).map((item) => { renderColumns.value.map((val) => { if (item === val.prop) { propLabelError.push(val.label); } }); }); emits("validateError", propLabelError); } }, 300); }; const clearValidate = () => { const refList = Object.keys(formRef.value).filter((item) => item.includes("formRef")); refList.length > 0 && refList.map((val) => { formRef.value[val].clearValidate(); }); }; const resetFields = () => { const refList = Object.keys(formRef.value).filter((item) => item.includes("formRef")); refList.length > 0 && refList.map((val) => { formRef.value[val].resetFields(); }); const refEditList = Object.keys(editTableRef.value).filter((item) => item.includes("singleEditRef")); refEditList.length > 0 && refEditList.map((val) => { editTableRef.value[val].resetTselectTableFields(); }); }; const resetTselectTable = () => { const refEditList = Object.keys(editTableRef.value).filter((item) => item.includes("singleEditRef")); refEditList.length > 0 && refEditList.map((val) => { editTableRef.value[val].resetTselectTableFields(); }); }; const reSetColumnSet = () => { var _a; return (_a = columnSetRef.value) == null ? void 0 : _a.reSetColumnSet(); }; __expose({ defaultRadioSelect, clearSelection, getSelectionRows, toggleRowSelection, toggleAllSelection, toggleRowExpansion, setCurrentRow, clearSort, clearFilter, doLayout, sort, scrollTo, setScrollTop, setScrollLeft, state, radioVal, clearValidate, resetFields, save, saveMethod, reSetColumnSet, clearRadioHandle, resetTselectTable }); return (_ctx, _cache) => { const _component_el_icon = resolveComponent("el-icon"); const _component_el_table_column = resolveComponent("el-table-column"); const _component_el_form = resolveComponent("el-form"); const _component_el_table = resolveComponent("el-table"); const _component_el_pagination = resolveComponent("el-pagination"); const _component_el_button = resolveComponent("el-button"); const _directive_loading = resolveDirective("loading"); return withDirectives((openBlock(), createElementBlock("div", { class: "t-table", ref_key: "TTableBox", ref: TTableBox, "element-loading-text": _ctx.loadingTxt }, [ createElementVNode( "div", { class: "header_wrap", style: normalizeStyle({ paddingBottom: _ctx.tableTitle || _ctx.title || isShow("title") || isShow("toolbar") || _ctx.isSlotToolbar || _ctx.columnSetting || _ctx.densitySeting ? "10px" : 0 }) }, [ _ctx.tableTitle || _ctx.title || _ctx.$slots.title || _ctx.isSlotTitle ? (openBlock(), createElementBlock("div", _hoisted_2, [ _ctx.$slots.title || _ctx.isSlotTitle ? renderSlot(_ctx.$slots, "title", { key: 0 }) : (openBlock(), createElementBlock( Fragment, { key: 1 }, [ _ctx.tableTitle ? (openBlock(), createElementBlock( "span", _hoisted_3, toDisplayString(_ctx.tableTitle), 1 /* TEXT */ )) : (openBlock(), createElementBlock( "span", _hoisted_4, toDisplayString(_ctx.title), 1 /* TEXT */ )) ], 64 /* STABLE_FRAGMENT */ )) ])) : createCommentVNode("v-if", true), createElementVNode("div", _hoisted_5, [ renderSlot(_ctx.$slots, "toolbar"), createElementVNode( "div", { class: "header_right_wrap", style: normalizeStyle({ marginLeft: isShow("toolbar") || _ctx.isSlotToolbar ? "10px" : 0 }) }, [ renderSlot(_ctx.$slots, "btn"), _ctx.columnSetting && !isTableHeader.value ? (openBlock(), createBlock(_sfc_main$1, mergeProps({ key: 0 }, _ctx.$attrs, { title: _ctx.title || _ctx.tableTitle, columns: renderColumns.value, ref_key: "columnSetRef", ref: columnSetRef, onColumnSetting: _cache[0] || (_cache[0] = (v) => unref(state).columnSet = v) }), null, 16, ["title", "columns"])) : createCommentVNode("v-if", true), createElementVNode( "div", { style: normalizeStyle({ marginLeft: _ctx.columnSetting ? "10px" : 0 }) }, [ _ctx.densitySeting ? (openBlock(), createBlock(_sfc_main$2, mergeProps({ key: 0 }, _ctx.$attrs, { "default-size": unref(state).size, onClickDensity: handleClickDensity }), null, 16, ["default-size"])) : createCommentVNode("v-if", true) ], 4 /* STYLE */ ) ], 4 /* STYLE */ ) ]) ], 4 /* STYLE */ ), isShow("titleTip") ? (openBlock(), createElementBlock("div", _hoisted_6, [ renderSlot(_ctx.$slots, "titleTip") ])) : createCommentVNode("v-if", true), createVNode(_component_el_table, mergeProps({ ref_key: "TTable", ref: TTable, data: unref(state).tableData, class: { cursor: _ctx.isCopy, row_sort: _ctx.isRowSort, row_sort_none: _ctx.isRowSortIcon, tree_style: _ctx.isTree, highlightCurrentRow: _ctx.highlightCurrentRow, radioStyle: radioStyleClass.value || props.rowClickCheckbox, multile_head_column: isTableHeader.value, t_table_use_virtual: _ctx.useVirtual }, "highlight-current-row": _ctx.highlightCurrentRow, border: _ctx.border || _ctx.table.border || isTableBorder.value || _ctx.useVirtual, size: unref(state).size }, _ctx.$attrs, { onCellDblclick: cellDblclick, onRowClick: rowClick }), { append: withCtx(() => [ renderSlot(_ctx.$slots, "append") ]), empty: withCtx(() => [ renderSlot(_ctx.$slots, "empty") ]), default: withCtx(() => [ _ctx.isRowSortIcon ? (openBlock(), createBlock( _component_el_table_column, normalizeProps(mergeProps({ key: 0 }, { width: _ctx.rowSortIconBind.width || 55, "min-width": _ctx.rowSortIconBind["min-width"] || _ctx.rowSortIconBind.minWidth, label: _ctx.rowSortIconBind.label || unref(t)("plus.table.dragTxt"), fixed: _ctx.rowSortIconBind.fixed, align: _ctx.rowSortIconBind.align || _ctx.align, ..._ctx.rowSortIconBind })), { default: withCtx(() => [ createVNode(_component_el_icon, { class: "row_drag", color: _ctx.rowSortIconBind.color, size: _ctx.rowSortIconBind.size }, { default: withCtx(() => [ createVNode(unref(Rank)) ]), _: 1 /* STABLE */ }, 8, ["color", "size"]) ]), _: 1 /* STABLE */ }, 16 /* FULL_PROPS */ )) : createCommentVNode("v-if", true), createVNode(_sfc_main$3, { table: _ctx.table, radioVal: radioVal.value, "onUpdate:radioVal": _cache[1] || (_cache[1] = ($event) => radioVal.value = $event), align: _ctx.align, isPaginationCumulative: _ctx.isPaginationCumulative, isShowPagination: _ctx.isShowPagination, onRadioChange: radioHandleChange }, createSlots({ _: 2 /* DYNAMIC */ }, [ renderList(unref(slots), (_index, name) => { return { name, fn: withCtx((data) => [ renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(data))) ]) }; }) ]), 1032, ["table", "radioVal", "align", "isPaginationCumulative", "isShowPagination"]), (openBlock(true), createElementBlock( Fragment, null, renderList(renderColumns.value, (item, index) => { return openBlock(), createElementBlock( Fragment, null, [ !item.children ? (openBlock(), createElementBlock( Fragment, { key: 0 }, [ (typeof item.isShowCol == "function" ? item.isShowCol(item) : !item.isShowCol) ? (openBlock(), createBlock(_component_el_table_column, mergeProps( { key: index + "i", type: item.type, label: item.label, prop: item.prop, "min-width": item["min-width"] || item.minWidth, width: item.width, sortable: item.sortable || item.sort || _ctx.sortable, align: item.align || _ctx.align, fixed: item.fixed, formatter: item.formatter }, typeof item.bind == "function" ? item.bind(item) : { "show-overflow-tooltip": true, ...item.bind } ), createSlots({ default: withCtx((scope) => [ createCommentVNode(" render\u6E32\u67D3 "), item.render ? (openBlock(), createBlock(_sfc_main$4, { key: 0, column: item, row: scope.row, render: item.render, index: scope.$index }, null, 8, ["column", "row", "render", "index"])) : createCommentVNode("v-if", true), createCommentVNode(" \u81EA\u5B9A\u4E49\u63D2\u69FD "), item.slotName ? renderSlot(_ctx.$slots, item.slotName, { key: 1, scope }) : createCommentVNode("v-if", true), createCommentVNode(" \u5355\u4E2A\u5355\u5143\u683C\u7F16\u8F91 "), (typeof item.canEdit == "function" ? item.canEdit(scope) : item.canEdit) ? (openBlock(), createBlock(_component_el_form, { key: 2, model: unref(state).tableData[scope.$index], rules: isEditRules.value ? _ctx.table.rules : {}, class: normalizeClass(["t_edit_cell_form", { t_edit_cell_form_rules: isEditRules.value }]), ref_for: true, ref: (el) => handleRef(el, scope, item), onSubmit: _cache[2] || (_cache[2] = withModifiers(() => { }, ["prevent"])) }, { default: withCtx(() => [ createVNode(_sfc_main$5, mergeProps({ configEdit: item.configEdit, modelValue: scope.row[item.prop], "onUpdate:modelValue": ($event) => scope.row[item.prop] = $event, prop: item.prop, scope, indexColumns: index, ref_for: true, ref: (el) => handleEditTableRef(el, scope, item), onHandleEvent: ($event) => handleEvent($event, scope.$index), onKeyupHandle: handleKeyup }, _ctx.$attrs), createSlots({ _: 2 /* DYNAMIC */ }, [ renderList(unref(slots), (_index, name) => { return { name, fn: withCtx((data) => [ renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(data))) ]) }; }) ]), 1040, ["configEdit", "modelValue", "onUpdate:modelValue", "prop", "scope", "indexColumns", "onHandleEvent"]) ]), _: 2 /* DYNAMIC */ }, 1032, ["model", "rules", "class"])) : createCommentVNode("v-if", true), createCommentVNode(" \u5355\u51FB\u5355\u5143\u683C\u7F16\u8F91 "), item.isClickEdit ? (openBlock(), createBlock(_sfc_main$6, mergeProps({ key: 3, isClickEdit: item.isClickEdit, configEdit: item.configEdit, modelValue: scope.row[scope.column.property], "onUpdate:modelValue": ($event) => scope.row[scope.column.property] = $event }, _ctx.$attrs, { ref_for: true, ref: "editClickCell" }), createSlots({ _: 2 /* DYNAMIC */ }, [ renderList(unref(slots), (_index, name) => { return { name, fn: withCtx((data) => [ renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(data))) ]) }; }) ]), 1040, ["isClickEdit", "configEdit", "modelValue", "onUpdate:modelValue"])) : createCommentVNode("v-if", true), createCommentVNode(" \u5B57\u5178\u8FC7\u6EE4 "), item.filters && item.filters.list ? (openBlock(), createElementBlock( Fragment, { key: 4 }, [ createTextVNode( toDisplayString(constantEscape( scope.row[item.prop], _ctx.table.listTypeInfo[item.filters.list], item.filters.key || "value", item.filters.label || "label" )), 1 /* TEXT */ ) ], 64 /* STABLE_FRAGMENT */ )) : createCommentVNode("v-if", true), !item.render && !item.slotName && !item.canEdit && !item.filters && !item.isClickEdit && !item.formatter ? (openBlock(), createElementBlock("div", _hoisted_9, [ createElementVNode( "span", null, toDisplayString(scope.row[item.prop]), 1 /* TEXT */ ) ])) : createCommentVNode("v-if", true) ]), _: 2 /* DYNAMIC */ }, [ item.headerRequired || item.renderHeader || item.isClickEdit ? { name: "header", fn: withCtx(() => [ item.renderHeader ? (openBlock(), createBlock(_sfc_main$7, { key: 0, column: item, render: item.renderHeader }, null, 8, ["column", "render"])) : createCommentVNode("v-if", true), item.headerRequired && emptyDataRequired.value ? (openBlock(), createElementBlock("div", _hoisted_7, [ _hoisted_8, createElementVNode( "span", null, toDisplayString(item.label), 1 /* TEXT */ ) ])) : createCommentVNode("v-if", true), item.isClickEdit ? (openBlock(), createElementBlock( "div", { key: 2, class: "click_edit", style: normalizeStyle({ justifyContent: item.editIconAlign || _ctx.align || "center" }) }, [ createElementVNode( "span", null, toDisplayString(item.label), 1 /* TEXT */ ), !item.isShowEditIcon ? (openBlock(), createBlock( _component_el_icon, normalizeProps(mergeProps({ key: 0 }, { size: 14, ...item.editIconBind })), { default: withCtx(() => [ createVNode(unref(Edit)) ]), _: 2 /* DYNAMIC */ }, 1040 /* FULL_PROPS, DYNAMIC_SLOTS */ )) : createCommentVNode("v-if", true) ], 4 /* STYLE */ )) : createCommentVNode("v-if", true) ]), key: "0" } : void 0 ]), 1040, ["type", "label", "prop", "min-width", "width", "sortable", "align", "fixed", "formatter"])) : createCommentVNode("v-if", true) ], 64 /* STABLE_FRAGMENT */ )) : (openBlock(), createElementBlock( Fragment, { key: 1 }, [ createCommentVNode(" \u8868\u5934\u5408\u5E76\u5355\u5143\u683C "), (openBlock(), createBlock(_sfc_main$8, mergeProps({ key: index + "m", item, align: _ctx.align }, _ctx.$attrs, { sortable: _ctx.sortable }), createSlots({ _: 2 /* DYNAMIC */ }, [ renderList(unref(slots), (_index, name) => { return { name, fn: withCtx((data) => [ renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(data))) ]) }; }) ]), 1040, ["item", "align", "sortable"])) ], 2112 /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */ )) ], 64 /* STABLE_FRAGMENT */ ); }), 256 /* UNKEYED_FRAGMENT */ )), renderSlot(_ctx.$slots, "default"), createVNode(_sfc_main$9, { table: _ctx.table, btnPermissions: _ctx.btnPermissions, tableData: unref(state).tableData, align: _ctx.align }, null, 8, ["table", "btnPermissions", "tableData", "align"]) ]), _: 3 /* FORWARDED */ }, 16, ["data", "class", "highlight-current-row", "border", "size"]), createCommentVNode(" \u5206\u9875\u5668 "), unref(state).tableData && unref(state).tableData.length && _ctx.isShowPagination ? (openBlock(), createBlock(_component_el_pagination, mergeProps({ key: 1, "current-page": _ctx.table.currentPage, "onUpdate:currentPage": _cache[3] || (_cache[3] = ($event) => _ctx.table.currentPage = $event), onCurrentChange: handlesCurrentChange, "page-sizes": _ctx.table.pageSizes || [10, 20, 50, 100], "page-size": _ctx.table.pageSize, "onUpdate:pageSize": _cache[4] || (_cache[4] = ($event) => _ctx.table.pageSize = $event), layout: _ctx.table.layout || "total,sizes, prev, pager, next, jumper", "prev-text": _ctx.table.prevText, "next-text": _ctx.table.nextText, total: _ctx.table.total || 0, size: _ctx.table.size || "small" }, _ctx.$attrs, { background: "" }), { default: withCtx(() => [ renderSlot(_ctx.$slots, "pagination") ]), _: 3 /* FORWARDED */ }, 16, ["current-page", "page-sizes", "page-size", "layout", "prev-text", "next-text", "total", "size"])) : createCommentVNode("v-if", true), _ctx.isShowFooterBtn && unref(state).tableData && unref(state).tableData.length > 0 ? (openBlock(), createElementBlock( "footer", { key: 2, class: "handle_wrap", style: normalizeStyle({ textAlign: _ctx.footerBtnAlign }) }, [ renderSlot(_ctx.$slots, "footer"), !unref(slots).footer ? (openBlock(), createElementBlock("div", _hoisted_10, [ createVNode(_component_el_button, { type: "primary", onClick: save }, { default: withCtx(() => [ createTextVNode( toDisplayString(_ctx.saveBtnTxt), 1 /* TEXT */ ) ]), _: 1 /* STABLE */ }) ])) : createCommentVNode("v-if", true) ], 4 /* STYLE */ )) : createCommentVNode("v-if", true) ], 8, _hoisted_1)), [ [_directive_loading, _ctx.tableLoading] ]); }; } }); export { _sfc_main as default };