UNPKG

tdesign-vue-next

Version:
880 lines (872 loc) 41.6 kB
/** * tdesign v1.11.5 * (c) 2025 tdesign * @license MIT */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var _slicedToArray = require('@babel/runtime/helpers/slicedToArray'); var _defineProperty = require('@babel/runtime/helpers/defineProperty'); var Vue = require('vue'); var table_baseTableProps = require('./base-table-props.js'); var table_hooks_useTableHeader = require('./hooks/useTableHeader.js'); var table_hooks_useColumnResize = require('./hooks/useColumnResize.js'); var table_hooks_useFixed = require('./hooks/useFixed.js'); var table_hooks_usePagination = require('./hooks/usePagination.js'); var hooks_useVirtualScrollNew = require('../hooks/useVirtualScrollNew.js'); var table_hooks_useAffix = require('./hooks/useAffix.js'); var loading_index = require('../loading/index.js'); var table_tbody = require('./tbody.js'); var hooks_tnode = require('../_chunks/dep-a69ce597.js'); var table_hooks_useStyle = require('./hooks/useStyle.js'); var table_hooks_useClassName = require('./hooks/useClassName.js'); var configProvider_hooks_useConfig = require('../config-provider/hooks/useConfig.js'); var affix_index = require('../affix/index.js'); var table_tr = require('./tr.js'); var table_thead = require('./thead.js'); var table_tfoot = require('./tfoot.js'); var table_utils = require('./utils.js'); var helper = require('../_chunks/dep-25acc189.js'); var log = require('../_chunks/dep-cef23b69.js'); var table_hooks_useRowHighlight = require('./hooks/useRowHighlight.js'); var table_hooks_useHoverKeyboardEvent = require('./hooks/useHoverKeyboardEvent.js'); var hooks_useElementLazyRender = require('../hooks/useElementLazyRender.js'); var throttle = require('../_chunks/dep-be62446e.js'); var pick = require('../_chunks/dep-ba971aad.js'); var isFunction = require('../_chunks/dep-047617bf.js'); var get = require('../_chunks/dep-56c837c8.js'); require('@babel/runtime/helpers/typeof'); require('./hooks/useMultiHeader.js'); require('./ellipsis.js'); require('../utils/render-tnode.js'); require('../_chunks/dep-0a510359.js'); require('../_chunks/dep-b8b9c2a3.js'); require('../_chunks/dep-bbe343d7.js'); require('../_chunks/dep-5ad8a2ab.js'); require('../_chunks/dep-0c2ad01b.js'); require('../_chunks/dep-db023c41.js'); require('../_chunks/dep-e495f218.js'); require('../_chunks/dep-bafc1f63.js'); require('../_chunks/dep-c07d6878.js'); require('../_chunks/dep-a957c564.js'); require('../_chunks/dep-acb090bf.js'); require('../_chunks/dep-76218bd8.js'); require('../_chunks/dep-9a321a91.js'); require('../_chunks/dep-ecbaedee.js'); require('../_chunks/dep-8b98fa07.js'); require('../_chunks/dep-b0b4fff1.js'); require('../_chunks/dep-7a21da5b.js'); require('../_chunks/dep-ed572eb3.js'); require('../_chunks/dep-9de7d250.js'); require('../_chunks/dep-be3c3d53.js'); require('../utils/dom.js'); require('../_chunks/dep-30fb1b25.js'); require('../tooltip/index.js'); require('../tooltip/tooltip.js'); require('../tooltip/props.js'); require('../popup/props.js'); require('../popup/index.js'); require('../popup/popup.js'); require('@popperjs/core'); require('../hooks/useConfig.js'); require('../hooks/useKeepAnimation.js'); require('../_chunks/dep-b4c4a54b.js'); require('../_chunks/dep-f8ff548f.js'); require('dayjs'); require('../_chunks/dep-b6c192db.js'); require('../_chunks/dep-ba2090c8.js'); require('../_chunks/dep-b27d3215.js'); require('../_chunks/dep-50a41d31.js'); require('../_chunks/dep-49fa220e.js'); require('../_chunks/dep-02ebb419.js'); require('../_chunks/dep-feae46a3.js'); require('../_chunks/dep-abf21389.js'); require('../_chunks/dep-7f32423d.js'); require('../_chunks/dep-7c9e3d93.js'); require('../_chunks/dep-b1b8272b.js'); require('../hooks/useVModel.js'); require('../popup/container.js'); require('@babel/runtime/helpers/toConsumableArray'); require('../hooks/useResizeObserver.js'); require('../_chunks/dep-31140ae7.js'); require('../_chunks/dep-533159e9.js'); require('../utils/withInstall.js'); require('../_chunks/dep-61a7e281.js'); require('../_chunks/dep-6f8a66a3.js'); require('../tooltip/utils/index.js'); require('../_chunks/dep-d67d6b6f.js'); require('../_chunks/dep-55d8c3ed.js'); require('../_chunks/dep-beb9de0a.js'); require('../_chunks/dep-43bc982b.js'); require('../_chunks/dep-cea0dc9b.js'); require('../_chunks/dep-31c4c452.js'); require('../_chunks/dep-9780143c.js'); require('../_chunks/dep-62aae11c.js'); require('../_chunks/dep-732925e8.js'); require('../_chunks/dep-7c08b9a8.js'); require('../pagination/index.js'); require('../pagination/pagination.js'); require('@babel/runtime/helpers/objectWithoutProperties'); require('tdesign-icons-vue-next'); require('../hooks/useGlobalIcon.js'); require('../input-number/index.js'); require('../input-number/input-number.js'); require('../button/index.js'); require('../button/button.js'); require('../button/props.js'); require('../hooks/useRipple.js'); require('../hooks/useDisabled.js'); require('../_chunks/dep-82a90f9f.js'); require('../_chunks/dep-0d31a2f0.js'); require('../loading/plugin.js'); require('../loading/loading.js'); require('../loading/icon/gradient.js'); require('../hooks/useTeleport.js'); require('../loading/props.js'); require('../_chunks/dep-93cf0a54.js'); require('../_chunks/dep-8afe2bf0.js'); require('../_chunks/dep-d4796921.js'); require('../_chunks/dep-fd1ddb6b.js'); require('../_chunks/dep-d83ac33f.js'); require('../input/index.js'); require('../input/input.js'); require('../input/props.js'); require('../hooks/useReadonly.js'); require('../input/hooks/useInput.js'); require('../form/consts/index.js'); require('../input/hooks/useLengthLimit.js'); require('../input/hooks/useInputEventHandler.js'); require('../input/hooks/useInputWidth.js'); require('../input/input-group.js'); require('../input/input-group-props.js'); require('../input-number/props.js'); require('../input-number/hooks/useInputNumber.js'); require('../hooks/useCommonClassName.js'); require('../_chunks/dep-628f2a1a.js'); require('../_chunks/dep-de8595be.js'); require('../select/index.js'); require('../select/select.js'); require('@babel/runtime/helpers/asyncToGenerator'); require('@babel/runtime/regenerator'); require('../common-components/fake-arrow.js'); require('../select-input/index.js'); require('../select-input/select-input.js'); require('../select-input/props.js'); require('../select-input/hooks/useMultiple.js'); require('../tag-input/index.js'); require('../tag-input/tag-input.js'); require('../tag-input/props.js'); require('../tag-input/hooks/useDragSorter.js'); require('../tag-input/hooks/useHover.js'); require('../tag-input/hooks/useTagScroll.js'); require('../tag-input/hooks/useTagList.js'); require('../tag/index.js'); require('../tag/tag.js'); require('tinycolor2'); require('../tag/props.js'); require('../tag/check-tag.js'); require('../tag/check-tag-props.js'); require('../_chunks/dep-0dafeb05.js'); require('../tag/check-tag-group.js'); require('../tag/check-tag-group-props.js'); require('../hooks/useDefaultValue.js'); require('../select-input/hooks/useOverlayInnerStyle.js'); require('../select-input/hooks/useSingle.js'); require('../_chunks/dep-8ba18d4f.js'); require('../select/select-panel.js'); require('../select/option.js'); require('../select/option-props.js'); require('../checkbox/index.js'); require('../checkbox/checkbox.js'); require('../checkbox/props.js'); require('../checkbox/consts/index.js'); require('../checkbox/hooks/useCheckboxLazyLoad.js'); require('../_chunks/dep-9da21bcd.js'); require('../checkbox/hooks/useKeyboardEvent.js'); require('../checkbox/group.js'); require('../checkbox/checkbox-group-props.js'); require('../hooks/slot.js'); require('../_chunks/dep-0b6921ca.js'); require('../select/utils/index.js'); require('../select/consts/index.js'); require('../select/option-group.js'); require('../select/option-group-props.js'); require('../select/props.js'); require('../select/hooks/usePanelVirtualScroll.js'); require('../hooks/useVirtualScroll.js'); require('../select/hooks/useKeyboardControl.js'); require('../select/hooks/useSelectOptions.js'); require('../input-adornment/index.js'); require('../input-adornment/input-adornment.js'); require('../input-adornment/props.js'); require('../pagination/props.js'); require('../pagination/hooks/useMoreAction.js'); require('../pagination/hooks/usePaginationClasses.js'); require('../pagination/pagination-mini.js'); require('../pagination/pagination-mini-props.js'); require('./hooks/useRowspanAndColspan.js'); require('../affix/affix.js'); require('../affix/props.js'); require('./hooks/useLazyLoad.js'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray); var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty); function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _isSlot(s) { return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !Vue.isVNode(s); } var BASE_TABLE_EVENTS = ["page-change", "cell-click", "scroll", "scrollX", "scrollY"]; var BASE_TABLE_ALL_EVENTS = table_tr.ROW_LISTENERS.map(function (t) { return "row-".concat(t); }).concat(BASE_TABLE_EVENTS); var _BaseTable = Vue.defineComponent({ name: "TBaseTable", props: _objectSpread(_objectSpread({}, table_baseTableProps["default"]), {}, { renderExpandedRow: Function, onLeafColumnsChange: Function, thDraggable: Boolean }), emits: ["show-element-change"], setup: function setup(props2, context) { var _toRefs = Vue.toRefs(props2), lazyLoad = _toRefs.lazyLoad; var renderTNode = hooks_tnode.useTNodeJSX(); var tableRef = Vue.ref(); var tableElmRef = Vue.ref(); var tableBodyRef = Vue.ref(); var bottomContentRef = Vue.ref(); var tableFootHeight = Vue.ref(0); var _useClassName = table_hooks_useClassName["default"](), classPrefix = _useClassName.classPrefix, virtualScrollClasses = _useClassName.virtualScrollClasses, tableLayoutClasses = _useClassName.tableLayoutClasses, tableBaseClass = _useClassName.tableBaseClass, tableColFixedClasses = _useClassName.tableColFixedClasses; var _useStyle = table_hooks_useStyle["default"](props2), tableClasses = _useStyle.tableClasses, sizeClassNames = _useStyle.sizeClassNames, tableContentStyles = _useStyle.tableContentStyles, tableElementStyles = _useStyle.tableElementStyles; var _useConfig = configProvider_hooks_useConfig.useConfig("table", props2.locale), globalConfig = _useConfig.globalConfig; var _useTableHeader = table_hooks_useTableHeader["default"](props2), isMultipleHeader = _useTableHeader.isMultipleHeader, spansAndLeafNodes = _useTableHeader.spansAndLeafNodes, thList = _useTableHeader.thList; var finalColumns = Vue.computed(function () { var _spansAndLeafNodes$va; return ((_spansAndLeafNodes$va = spansAndLeafNodes.value) === null || _spansAndLeafNodes$va === void 0 ? void 0 : _spansAndLeafNodes$va.leafColumns) || props2.columns; }); var tableSize = Vue.computed(function () { var _props2$size; return (_props2$size = props2.size) !== null && _props2$size !== void 0 ? _props2$size : globalConfig.value.size; }); var _useElementLazyRender = hooks_useElementLazyRender.useElementLazyRender(tableRef, lazyLoad), showElement = _useElementLazyRender.showElement; var paginationAffixRef = Vue.ref(); var horizontalScrollAffixRef = Vue.ref(); var headerTopAffixRef = Vue.ref(); var footerBottomAffixRef = Vue.ref(); var _useFixed = table_hooks_useFixed["default"](props2, context, finalColumns, { paginationAffixRef: paginationAffixRef, horizontalScrollAffixRef: horizontalScrollAffixRef, headerTopAffixRef: headerTopAffixRef, footerBottomAffixRef: footerBottomAffixRef }), scrollbarWidth = _useFixed.scrollbarWidth, virtualScrollHeaderPos = _useFixed.virtualScrollHeaderPos, tableWidth = _useFixed.tableWidth, tableElmWidth = _useFixed.tableElmWidth, tableContentRef = _useFixed.tableContentRef, isFixedHeader = _useFixed.isFixedHeader, isWidthOverflow = _useFixed.isWidthOverflow, isFixedColumn = _useFixed.isFixedColumn, thWidthList = _useFixed.thWidthList, showColumnShadow = _useFixed.showColumnShadow, rowAndColFixedPosition = _useFixed.rowAndColFixedPosition, setData = _useFixed.setData, refreshTable = _useFixed.refreshTable, setTableElmWidth = _useFixed.setTableElmWidth, emitScrollEvent = _useFixed.emitScrollEvent, setUseFixedTableElmRef = _useFixed.setUseFixedTableElmRef, updateColumnFixedShadow = _useFixed.updateColumnFixedShadow, getThWidthList = _useFixed.getThWidthList, updateThWidthList = _useFixed.updateThWidthList, addTableResizeObserver = _useFixed.addTableResizeObserver, updateTableAfterColumnResize = _useFixed.updateTableAfterColumnResize; var _useAffix = table_hooks_useAffix["default"](props2), affixHeaderRef = _useAffix.affixHeaderRef, affixFooterRef = _useAffix.affixFooterRef, horizontalScrollbarRef = _useAffix.horizontalScrollbarRef, paginationRef = _useAffix.paginationRef, showAffixHeader = _useAffix.showAffixHeader, showAffixFooter = _useAffix.showAffixFooter, showAffixPagination = _useAffix.showAffixPagination, onHorizontalScroll = _useAffix.onHorizontalScroll, setTableContentRef = _useAffix.setTableContentRef, updateAffixHeaderOrFooter = _useAffix.updateAffixHeaderOrFooter; var _usePagination = table_hooks_usePagination["default"](props2, context), dataSource = _usePagination.dataSource, innerPagination = _usePagination.innerPagination, isPaginateData = _usePagination.isPaginateData, renderPagination = _usePagination.renderPagination; var columnResizeParams = table_hooks_useColumnResize["default"]({ isWidthOverflow: isWidthOverflow, tableContentRef: tableContentRef, showColumnShadow: showColumnShadow, getThWidthList: getThWidthList, updateThWidthList: updateThWidthList, setTableElmWidth: setTableElmWidth, updateTableAfterColumnResize: updateTableAfterColumnResize, onColumnResizeChange: props2.onColumnResizeChange }); var resizeLineRef = columnResizeParams.resizeLineRef, resizeLineStyle = columnResizeParams.resizeLineStyle, setEffectColMap = columnResizeParams.setEffectColMap; var dynamicBaseTableClasses = Vue.computed(function () { return [tableClasses.value, _defineProperty__default["default"](_defineProperty__default["default"](_defineProperty__default["default"](_defineProperty__default["default"](_defineProperty__default["default"](_defineProperty__default["default"](_defineProperty__default["default"](_defineProperty__default["default"]({}, tableBaseClass.headerFixed, isFixedHeader.value), tableBaseClass.columnFixed, isFixedColumn.value), tableBaseClass.widthOverflow, isWidthOverflow.value), tableBaseClass.multipleHeader, isMultipleHeader.value), tableColFixedClasses.leftShadow, showColumnShadow.left), tableColFixedClasses.rightShadow, showColumnShadow.right), tableBaseClass.columnResizableTable, props2.resizable), "".concat(classPrefix, "-table__row--active-").concat(props2.activeRowType), props2.activeRowType)]; }); var tableElmClasses = Vue.computed(function () { return [[tableLayoutClasses[props2.tableLayout]]]; }); var showRightDivider = Vue.computed(function () { return props2.bordered && isFixedHeader.value && (isMultipleHeader.value && isWidthOverflow.value || !isMultipleHeader.value); }); var dividerBottom = Vue.computed(function () { var _bottomContentRef$val, _paginationRef$value; if (!props2.bordered) return 0; var bottomRect = (_bottomContentRef$val = bottomContentRef.value) === null || _bottomContentRef$val === void 0 ? void 0 : _bottomContentRef$val.getBoundingClientRect(); var paginationRect = (_paginationRef$value = paginationRef.value) === null || _paginationRef$value === void 0 ? void 0 : _paginationRef$value.getBoundingClientRect(); return ((bottomRect === null || bottomRect === void 0 ? void 0 : bottomRect.height) || 0) + ((paginationRect === null || paginationRect === void 0 ? void 0 : paginationRect.height) || 0); }); var _useRowHighlight = table_hooks_useRowHighlight.useRowHighlight(props2, tableRef), tActiveRow = _useRowHighlight.tActiveRow, onHighlightRow = _useRowHighlight.onHighlightRow, addHighlightKeyboardListener = _useRowHighlight.addHighlightKeyboardListener, removeHighlightKeyboardListener = _useRowHighlight.removeHighlightKeyboardListener; var _useHoverKeyboardEven = table_hooks_useHoverKeyboardEvent.useHoverKeyboardEvent(props2, tableRef), hoverRow = _useHoverKeyboardEven.hoverRow, needKeyboardRowHover = _useHoverKeyboardEven.needKeyboardRowHover, clearHoverRow = _useHoverKeyboardEven.clearHoverRow, addRowHoverKeyboardListener = _useHoverKeyboardEven.addRowHoverKeyboardListener, removeRowHoverKeyboardListener = _useHoverKeyboardEven.removeRowHoverKeyboardListener, tableRefTabIndex = _useHoverKeyboardEven.tableRefTabIndex; Vue.watch(tableElmRef, function () { setUseFixedTableElmRef(tableElmRef.value); }); Vue.watch(function () { return [props2.data, dataSource]; }, function () { setData(isPaginateData.value ? dataSource.value : props2.data); }); Vue.watch(spansAndLeafNodes, function () { var _props2$onLeafColumns; (_props2$onLeafColumns = props2.onLeafColumnsChange) === null || _props2$onLeafColumns === void 0 || _props2$onLeafColumns.call(props2, spansAndLeafNodes.value.leafColumns); setEffectColMap(spansAndLeafNodes.value.leafColumns, null); }, { immediate: true }); var onFixedChange = function onFixedChange() { Vue.nextTick(function () { onHorizontalScroll(); updateAffixHeaderOrFooter(); }); }; var syncThWidthList = throttle.throttle(function () { updateThWidthList(getThWidthList("calculate")); }); var virtualScrollParams = Vue.computed(function () { return { data: props2.data, scroll: _objectSpread(_objectSpread({}, props2.scroll), {}, { fixedRows: props2.fixedRows }) }; }); var virtualConfig = hooks_useVirtualScrollNew["default"](tableContentRef, virtualScrollParams); var lastScrollY = -1; var onInnerVirtualScroll = function onInnerVirtualScroll(e) { var target = e.target || e.srcElement; var top = target.scrollTop; if (lastScrollY !== top) { virtualConfig.isVirtualScroll.value && virtualConfig.handleScroll(); } else { lastScrollY = -1; updateColumnFixedShadow(target); } lastScrollY = top; emitScrollEvent(e); if (props2.tableLayout === "auto") { syncThWidthList(); } }; var getTFootHeight = function getTFootHeight() { var _tableElmRef$value$qu; if (!tableElmRef.value) return; tableFootHeight.value = (_tableElmRef$value$qu = tableElmRef.value.querySelector("tfoot")) === null || _tableElmRef$value$qu === void 0 ? void 0 : _tableElmRef$value$qu.getBoundingClientRect().height; }; var scrollColumnIntoView = function scrollColumnIntoView(colKey) { if (!tableContentRef.value) return; var thDom = tableContentRef.value.querySelector("th[data-colkey=\"".concat(colKey, "\"]")); var fixedThDom = tableContentRef.value.querySelectorAll("th.t-table__cell--fixed-left"); var totalWidth = 0; for (var i = 0, len = fixedThDom.length; i < len; i++) { totalWidth += fixedThDom[i].getBoundingClientRect().width; } var domRect = thDom.getBoundingClientRect(); var contentRect = tableContentRef.value.getBoundingClientRect(); var distance = domRect.left - contentRect.left - totalWidth; tableContentRef.value.scrollTo({ left: distance, behavior: "smooth" }); }; Vue.watch(tableContentRef, function () { setTableContentRef(tableContentRef.value); if (props2.tableLayout === "auto") { syncThWidthList(); } }); Vue.watch(function () { return [tableElmRef.value, props2.footData, props2.footerSummary, props2.columns]; }, function () { var timer = setTimeout(function () { getTFootHeight(); clearTimeout(timer); }, 0); }); Vue.watch(tableRef, function (tableRef2) { addTableResizeObserver(tableRef2); }); Vue.onMounted(function () { getTFootHeight(); setTableContentRef(tableContentRef.value); addTableResizeObserver(tableRef.value); }); var onTableFocus = function onTableFocus() { props2.activeRowType && addHighlightKeyboardListener(); needKeyboardRowHover.value && addRowHoverKeyboardListener(); }; var onTableBlur = function onTableBlur() { props2.activeRowType && removeHighlightKeyboardListener(); needKeyboardRowHover.value && removeRowHoverKeyboardListener(); }; var onInnerRowClick = function onInnerRowClick(ctx) { var _props2$onRowClick; (_props2$onRowClick = props2.onRowClick) === null || _props2$onRowClick === void 0 || _props2$onRowClick.call(props2, ctx); props2.activeRowType && onHighlightRow(ctx); needKeyboardRowHover.value && clearHoverRow(); }; Vue.watch([showElement], function (_ref2) { var _ref3 = _slicedToArray__default["default"](_ref2, 1), showElement2 = _ref3[0]; context.emit("show-element-change", showElement2); }, { immediate: true }); var tableData = Vue.computed(function () { return isPaginateData.value ? dataSource.value : props2.data; }); var scrollToElement = function scrollToElement(params) { var index = params.index; if (!index && index !== 0) { var _tableData$value; if (!params.key) { log.log.error("Table", "scrollToElement: one of `index` or `key` must exist."); return; } index = (_tableData$value = tableData.value) === null || _tableData$value === void 0 ? void 0 : _tableData$value.findIndex(function (item) { return get.get(item, props2.rowKey) === params.key; }); if (index < 0) { log.log.error("Table", "".concat(params.key, " does not exist in data, check `rowKey` or `data` please.")); } } if (virtualConfig.isVirtualScroll.value) { virtualConfig.scrollToElement(_objectSpread(_objectSpread({}, params), {}, { index: index + 1 })); } else { var _tableBodyRef$value, _el$children; var el = (_tableBodyRef$value = tableBodyRef.value) === null || _tableBodyRef$value === void 0 ? void 0 : _tableBodyRef$value.$el; var row = el === null || el === void 0 || (_el$children = el.children) === null || _el$children === void 0 ? void 0 : _el$children[index]; if (row) { var _params$top, _params$behavior; var offsetTop = row.offsetTop; var scrollTop = tableContentRef.value.scrollTop; var scrollHeight = offsetTop - scrollTop - ((_params$top = params.top) !== null && _params$top !== void 0 ? _params$top : 0); tableContentRef.value.scrollBy({ top: scrollHeight, behavior: (_params$behavior = params.behavior) !== null && _params$behavior !== void 0 ? _params$behavior : "auto" }); } } }; return { thList: thList, classPrefix: classPrefix, innerPagination: innerPagination, globalConfig: globalConfig, tableFootHeight: tableFootHeight, virtualScrollHeaderPos: virtualScrollHeaderPos, tableSize: tableSize, tableWidth: tableWidth, tableElmWidth: tableElmWidth, tableRef: tableRef, tableElmRef: tableElmRef, sizeClassNames: sizeClassNames, tableBaseClass: tableBaseClass, spansAndLeafNodes: spansAndLeafNodes, dynamicBaseTableClasses: dynamicBaseTableClasses, tableContentStyles: tableContentStyles, tableElementStyles: tableElementStyles, dividerBottom: dividerBottom, virtualScrollClasses: virtualScrollClasses, tableLayoutClasses: tableLayoutClasses, tableElmClasses: tableElmClasses, tableContentRef: tableContentRef, isFixedHeader: isFixedHeader, isWidthOverflow: isWidthOverflow, isFixedColumn: isFixedColumn, rowAndColFixedPosition: rowAndColFixedPosition, showColumnShadow: showColumnShadow, thWidthList: thWidthList, isPaginateData: isPaginateData, dataSource: dataSource, affixHeaderRef: affixHeaderRef, affixFooterRef: affixFooterRef, bottomContentRef: bottomContentRef, paginationRef: paginationRef, showAffixHeader: showAffixHeader, showAffixFooter: showAffixFooter, scrollbarWidth: scrollbarWidth, isMultipleHeader: isMultipleHeader, showRightDivider: showRightDivider, resizeLineRef: resizeLineRef, resizeLineStyle: resizeLineStyle, columnResizeParams: columnResizeParams, horizontalScrollbarRef: horizontalScrollbarRef, tableBodyRef: tableBodyRef, virtualConfig: virtualConfig, showAffixPagination: showAffixPagination, tActiveRow: tActiveRow, hoverRow: hoverRow, showElement: showElement, scrollToElement: scrollToElement, renderPagination: renderPagination, renderTNode: renderTNode, onFixedChange: onFixedChange, onHorizontalScroll: onHorizontalScroll, updateAffixHeaderOrFooter: updateAffixHeaderOrFooter, onInnerVirtualScroll: onInnerVirtualScroll, refreshTable: refreshTable, scrollColumnIntoView: scrollColumnIntoView, onTableFocus: onTableFocus, onTableBlur: onTableBlur, onInnerRowClick: onInnerRowClick, paginationAffixRef: paginationAffixRef, horizontalScrollAffixRef: horizontalScrollAffixRef, headerTopAffixRef: headerTopAffixRef, footerBottomAffixRef: footerBottomAffixRef, tableRefTabIndex: tableRefTabIndex }; }, render: function render() { var _this$spansAndLeafNod, _this$allowResizeColu, _this = this, _this$affixHeaderRef, _this$footData, _this$tableFootHeight, _this$tableFootHeight2, _affixHeaderHeight$va, _this$tableContentRef; if (!this.showElement) { return Vue.createVNode("div", { "ref": "tableRef" }, null); } var rowAndColFixedPosition = this.rowAndColFixedPosition, tableLayout = this.tableLayout; var data = this.isPaginateData ? this.dataSource : this.data; var columns = ((_this$spansAndLeafNod = this.spansAndLeafNodes) === null || _this$spansAndLeafNod === void 0 ? void 0 : _this$spansAndLeafNod.leafColumns) || this.columns; var columnResizable = (_this$allowResizeColu = this.allowResizeColumnWidth) !== null && _this$allowResizeColu !== void 0 ? _this$allowResizeColu : this.resizable; if (columnResizable && tableLayout === "auto") { log.log.warn("Table", "table-layout can not be `auto`, cause you are using column resizable, set `table-layout: fixed` please."); } var defaultColWidth = tableLayout === "fixed" && this.isWidthOverflow ? "100px" : void 0; var renderColGroup = function renderColGroup() { var isAffixHeader = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; return Vue.createVNode("colgroup", null, [columns.map(function (col) { var style = { width: table_hooks_useStyle.formatCSSUnit((isAffixHeader || columnResizable ? _this.thWidthList[col.colKey] : void 0) || col.width) || defaultColWidth }; if (col.minWidth) { style.minWidth = table_hooks_useStyle.formatCSSUnit(col.minWidth); } if (!style.width && !col.minWidth && _this.tableLayout === "fixed") { style.minWidth = "80px"; } return Vue.createVNode("col", { "key": col.colKey, "style": style }, null); })]); }; var renderAffixedHeader = function renderAffixedHeader() { if (_this.showHeader === false) return null; return !!(_this.virtualConfig.isVirtualScroll.value || _this.headerAffixedTop) && (_this.headerAffixedTop ? Vue.createVNode(affix_index.Affix, Vue.mergeProps({ "offsetTop": 0 }, table_utils.getAffixProps(_this.headerAffixedTop), { "onFixedChange": _this.onFixedChange, "ref": "headerTopAffixRef" }), _isSlot(affixHeaderWithWrap) ? affixHeaderWithWrap : { "default": function _default() { return [affixHeaderWithWrap]; } }) : _this.isFixedHeader && affixHeaderWithWrap); }; var renderAffixedHorizontalScrollbar = function renderAffixedHorizontalScrollbar() { return Vue.createVNode(affix_index.Affix, Vue.mergeProps({ "offsetBottom": 0 }, table_utils.getAffixProps(_this.horizontalScrollAffixedBottom), { "style": { marginTop: "-".concat(_this.scrollbarWidth * 2, "px") }, "horizontalScrollAffixedBottom": true, "ref": "horizontalScrollAffixRef" }), { "default": function _default() { return [Vue.createVNode("div", { "ref": "horizontalScrollbarRef", "class": ["scrollbar", _this.tableBaseClass.obviousScrollbar], "style": { width: "".concat(_this.tableWidth, "px"), overflow: "auto", opacity: Number(_this.showAffixFooter) } }, [Vue.createVNode("div", { "style": { width: "".concat(_this.tableElmWidth, "px"), height: "5px" } }, null)])]; } }); }; var headProps = { isFixedHeader: this.isFixedHeader, rowAndColFixedPosition: this.rowAndColFixedPosition, isMultipleHeader: this.isMultipleHeader, bordered: this.bordered, maxHeight: this.maxHeight, height: this.height, spansAndLeafNodes: this.spansAndLeafNodes, thList: this.thList, thWidthList: this.thWidthList, resizable: this.resizable, columnResizeParams: this.columnResizeParams, classPrefix: this.classPrefix, ellipsisOverlayClassName: this.tableSize !== "medium" ? this.sizeClassNames[this.tableSize] : "", attach: this.attach, showColumnShadow: this.showColumnShadow, thDraggable: this.thDraggable }; var IEHeaderWrap = helper.getIEVersion() <= 11 ? 4 : 0; var barWidth = this.isWidthOverflow ? this.scrollbarWidth : 0; var affixHeaderHeight = Vue.ref((((_this$affixHeaderRef = this.affixHeaderRef) === null || _this$affixHeaderRef === void 0 ? void 0 : _this$affixHeaderRef.getBoundingClientRect().height) || 0) - IEHeaderWrap); var timer = setTimeout(function () { var _this$affixHeaderRef2; affixHeaderHeight.value = (((_this$affixHeaderRef2 = _this.affixHeaderRef) === null || _this$affixHeaderRef2 === void 0 ? void 0 : _this$affixHeaderRef2.getBoundingClientRect().height) || 0) - IEHeaderWrap; clearTimeout(timer); }, 0); var affixHeaderWrapHeight = Vue.computed(function () { return affixHeaderHeight.value - barWidth; }); var headerOpacity = table_baseTableProps["default"].headerAffixedTop ? Number(this.showAffixHeader) : 1; var affixHeaderWrapHeightStyle = Vue.computed(function () { return { width: "".concat(_this.tableWidth, "px"), height: "".concat(affixHeaderWrapHeight.value, "px"), opacity: headerOpacity }; }); var affixedLeftBorder = this.bordered ? 1 : 0; var affixedHeader = Boolean((this.headerAffixedTop || this.virtualConfig.isVirtualScroll.value) && this.tableWidth) && Vue.createVNode("div", { "ref": "affixHeaderRef", "style": { width: "".concat(this.tableWidth - affixedLeftBorder, "px"), opacity: Number(this.showAffixHeader) }, "class": ["scrollbar", _defineProperty__default["default"]({}, this.tableBaseClass.affixedHeaderElm, this.headerAffixedTop || this.virtualConfig.isVirtualScroll.value)] }, [Vue.createVNode("table", { "class": this.tableElmClasses, "style": _objectSpread(_objectSpread({}, this.tableElementStyles), {}, { width: "".concat(this.tableElmWidth, "px") }) }, [renderColGroup(true), Vue.createVNode(table_thead["default"], headProps, this.$slots)])]); var affixHeaderWithWrap = Vue.createVNode("div", { "class": this.tableBaseClass.affixedHeaderWrap, "style": affixHeaderWrapHeightStyle.value }, [affixedHeader]); var marginScrollbarWidth = this.isWidthOverflow ? this.scrollbarWidth : 0; if (this.bordered) { marginScrollbarWidth += 1; } var showFooter = Boolean(this.virtualConfig.isVirtualScroll.value || this.footerAffixedBottom); var hasFooter = ((_this$footData = this.footData) === null || _this$footData === void 0 ? void 0 : _this$footData.length) || this.footerSummary || this.$slots["footerSummary"]; var affixedFooter = Boolean(showFooter && hasFooter && this.tableWidth) && Vue.createVNode(affix_index.Affix, Vue.mergeProps({ "class": this.tableBaseClass.affixedFooterWrap, "onFixedChange": this.onFixedChange, "offsetBottom": marginScrollbarWidth || 0 }, table_utils.getAffixProps(this.footerAffixedBottom), { "style": { marginTop: "".concat(-1 * (((_this$tableFootHeight = this.tableFootHeight) !== null && _this$tableFootHeight !== void 0 ? _this$tableFootHeight : 0) + marginScrollbarWidth), "px") }, "ref": "footerBottomAffixRef" }), { "default": function _default() { return [Vue.createVNode("div", { "ref": "affixFooterRef", "style": { width: "".concat(_this.tableWidth - affixedLeftBorder, "px"), opacity: Number(_this.showAffixFooter) }, "class": ["scrollbar", _defineProperty__default["default"]({}, _this.tableBaseClass.affixedFooterElm, _this.footerAffixedBottom || _this.virtualConfig.isVirtualScroll.value)] }, [Vue.createVNode("table", { "class": _this.tableElmClasses, "style": _objectSpread(_objectSpread({}, _this.tableElementStyles), {}, { width: "".concat(_this.tableElmWidth, "px") }) }, [renderColGroup(true), Vue.createVNode(table_tfoot["default"], { "rowKey": _this.rowKey, "isFixedHeader": _this.isFixedHeader, "rowAndColFixedPosition": rowAndColFixedPosition, "footData": _this.footData, "columns": columns, "rowAttributes": _this.rowAttributes, "rowClassName": _this.rowClassName, "thWidthList": _this.thWidthList, "footerSummary": _this.footerSummary, "rowspanAndColspanInFooter": _this.rowspanAndColspanInFooter }, _this.$slots)])])]; } }); var translate = "translate(0, ".concat(this.virtualConfig.scrollHeight.value + ((_this$tableFootHeight2 = this.tableFootHeight) !== null && _this$tableFootHeight2 !== void 0 ? _this$tableFootHeight2 : 0) + ((_affixHeaderHeight$va = affixHeaderHeight.value) !== null && _affixHeaderHeight$va !== void 0 ? _affixHeaderHeight$va : 0), "px)"); var virtualStyle = { transform: translate, "-ms-transform": translate, "-moz-transform": translate, "-webkit-transform": translate }; var tableBodyProps = _objectSpread(_objectSpread({ classPrefix: this.classPrefix, ellipsisOverlayClassName: this.tableSize !== "medium" ? this.sizeClassNames[this.tableSize] : "", rowAndColFixedPosition: rowAndColFixedPosition, showColumnShadow: this.showColumnShadow, data: data, virtualConfig: this.virtualConfig, columns: this.spansAndLeafNodes.leafColumns, tableElm: this.tableRef, tableWidth: this.tableWidth, isWidthOverflow: this.isWidthOverflow, scroll: this.scroll, cellEmptyContent: this.cellEmptyContent, tableContentElm: this.tableContentRef, handleRowMounted: this.virtualConfig.handleRowMounted, renderExpandedRow: this.renderExpandedRow }, pick.pick(this.$props, table_tbody.extendTableProps)), {}, { pagination: this.innerPagination, attach: this.attach, hoverRow: this.hoverRow, activeRow: this.tActiveRow, onRowClick: this.onInnerRowClick }); var tableContent = Vue.createVNode("div", { "ref": "tableContentRef", "class": this.tableBaseClass.content, "style": this.tableContentStyles, "onScroll": this.onInnerVirtualScroll }, [this.virtualConfig.isVirtualScroll.value && Vue.createVNode("div", { "class": this.virtualScrollClasses.cursor, "style": virtualStyle }, null), Vue.createVNode("table", { "ref": "tableElmRef", "class": this.tableElmClasses, "style": _objectSpread(_objectSpread({}, this.tableElementStyles), {}, { width: this.resizable && this.isWidthOverflow && this.tableElmWidth ? "".concat(this.tableElmWidth, "px") : this.tableElementStyles.width }) }, [renderColGroup(false), this.showHeader && Vue.createVNode(table_thead["default"], _objectSpread(_objectSpread({}, headProps), {}, { thWidthList: columnResizable ? this.thWidthList : {} }), this.$slots), Vue.createVNode(table_tbody["default"], Vue.mergeProps({ "ref": "tableBodyRef" }, tableBodyProps), this.$slots), Vue.createVNode(table_tfoot["default"], { "rowKey": this.rowKey, "isFixedHeader": this.isFixedHeader, "rowAndColFixedPosition": rowAndColFixedPosition, "footData": this.footData, "columns": columns, "rowAttributes": this.rowAttributes, "rowClassName": this.rowClassName, "footerSummary": this.footerSummary, "rowspanAndColspanInFooter": this.rowspanAndColspanInFooter, "virtualScroll": this.virtualConfig.isVirtualScroll.value }, this.$slots)])]); var getCustomLoadingText = isFunction.isFunction(this.loading) ? this.loading : this.$slots.loading; var loadingContent = this.loading !== void 0 && Vue.createVNode(loading_index.Loading, Vue.mergeProps({ "loading": !!this.loading, "text": getCustomLoadingText, "attach": this.tableRef ? function () { return _this.tableRef; } : void 0, "showOverlay": true, "size": "small" }, this.loadingProps), null); var topContent = this.renderTNode("topContent"); var bottomContent = this.renderTNode("bottomContent"); var pagination = Vue.createVNode("div", { "ref": "paginationRef", "class": this.tableBaseClass.paginationWrap, "style": { opacity: Number(this.showAffixPagination) } }, [this.renderPagination()]); var bottom = !!bottomContent && Vue.createVNode("div", { "ref": "bottomContentRef", "class": this.tableBaseClass.bottomContent }, [bottomContent]); return Vue.createVNode("div", { "ref": "tableRef", "tabindex": this.tableRefTabIndex, "class": this.dynamicBaseTableClasses, "onFocus": this.onTableFocus, "onBlur": this.onTableBlur }, [!!topContent && Vue.createVNode("div", { "class": this.tableBaseClass.topContent }, [topContent]), renderAffixedHeader(), tableContent, affixedFooter, loadingContent, bottom, this.showRightDivider && Vue.createVNode("div", { "class": this.tableBaseClass.scrollbarDivider, "style": { right: "".concat(this.scrollbarWidth, "px"), bottom: this.dividerBottom ? "".concat(this.dividerBottom, "px") : void 0, height: "".concat((_this$tableContentRef = this.tableContentRef) === null || _this$tableContentRef === void 0 ? void 0 : _this$tableContentRef.getBoundingClientRect().height, "px") } }, null), this.horizontalScrollAffixedBottom && renderAffixedHorizontalScrollbar(), this.paginationAffixedBottom ? Vue.createVNode(affix_index.Affix, Vue.mergeProps({ "offsetBottom": 0 }, table_utils.getAffixProps(this.paginationAffixedBottom), { "ref": "paginationAffixRef" }), _isSlot(pagination) ? pagination : { "default": function _default() { return [pagination]; } }) : pagination, Vue.createVNode("div", { "ref": "resizeLineRef", "class": this.tableBaseClass.resizeLine, "style": this.resizeLineStyle }, null)]); } }); exports.BASE_TABLE_ALL_EVENTS = BASE_TABLE_ALL_EVENTS; exports.BASE_TABLE_EVENTS = BASE_TABLE_EVENTS; exports["default"] = _BaseTable; //# sourceMappingURL=base-table.js.map