UNPKG

tdesign-vue

Version:
214 lines (206 loc) 8.97 kB
/** * tdesign v1.15.0 * (c) 2026 tdesign * @license MIT */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var helper = require('../_chunks/dep-4009cfe4.js'); var _defineProperty = require('@babel/runtime/helpers/defineProperty'); var VueCompositionAPI = require('@vue/composition-api'); var table_utils = require('./utils.js'); var table_hooks_useFixed = require('./hooks/useFixed.js'); var hooks_tnode = require('../hooks/tnode.js'); var table_hooks_useRowspanAndColspan = require('./hooks/useRowspanAndColspan.js'); var table_hooks_useClassName = require('./hooks/useClassName.js'); var isFunction = require('../_chunks/dep-8d206316.js'); var isString = require('../_chunks/dep-a2217d56.js'); var get = require('../_chunks/dep-a7198720.js'); require('@babel/runtime/helpers/typeof'); require('../_chunks/dep-2bc87cc8.js'); require('@babel/runtime/helpers/slicedToArray'); require('../_common/js/log/log.js'); require('../_common/js/utils/getScrollbarWidth.js'); require('../_common/js/utils/helper.js'); require('@babel/runtime/helpers/toConsumableArray'); require('@babel/runtime/helpers/objectWithoutProperties'); require('../_chunks/dep-721fcdf6.js'); require('../_chunks/dep-591b87f1.js'); require('../_chunks/dep-10fcb46d.js'); require('../_chunks/dep-268c68b1.js'); require('../_chunks/dep-3b2292ce.js'); require('../_chunks/dep-ba7f5924.js'); require('../utils/dom.js'); require('vue'); require('raf'); require('../utils/easing.js'); require('../_chunks/dep-56f568d3.js'); require('../_chunks/dep-f5b14344.js'); require('../_chunks/dep-36c2788b.js'); require('../_chunks/dep-fa353fbb.js'); require('../_chunks/dep-efe55b82.js'); require('../_chunks/dep-733a2279.js'); require('../_chunks/dep-010db548.js'); require('../_chunks/dep-116aedc3.js'); require('../_chunks/dep-d7516e38.js'); require('../_chunks/dep-7c84d9a0.js'); require('../_chunks/dep-d844c9ed.js'); require('../_chunks/dep-f020448d.js'); require('../_chunks/dep-689d381f.js'); require('../_chunks/dep-803744d9.js'); require('../_chunks/dep-f77d6ad5.js'); require('../_chunks/dep-a96e5563.js'); require('../_chunks/dep-bb0ececf.js'); require('../_chunks/dep-4e96e31a.js'); require('../_chunks/dep-74be1050.js'); require('../_chunks/dep-da2ef9c3.js'); require('../_chunks/dep-d250e942.js'); require('../_chunks/dep-1e173c2b.js'); require('../_chunks/dep-518e9c7b.js'); require('../_chunks/dep-c05a9033.js'); require('../_chunks/dep-9dae8101.js'); require('../_chunks/dep-c9ce9427.js'); require('../_chunks/dep-ee4e645f.js'); require('../_chunks/dep-0ea9f257.js'); require('../hooks/render-tnode.js'); require('../_chunks/dep-9c5b91d3.js'); require('../_chunks/dep-9a74c2be.js'); require('../_chunks/dep-84027b7f.js'); require('../_chunks/dep-49400b00.js'); require('../_chunks/dep-f1081d8e.js'); require('../_chunks/dep-2c592e99.js'); require('../_chunks/dep-812bd25d.js'); require('../_chunks/dep-82ce56ef.js'); require('../_chunks/dep-6eba4d23.js'); require('../config-provider/useConfig.js'); require('../_chunks/dep-8eddb350.js'); require('../_common/js/global-config/default-config.js'); require('../_common/js/global-config/locale/zh_CN.js'); require('../_chunks/dep-0c37520c.js'); require('../_chunks/dep-c13dcbfd.js'); require('dayjs'); require('../_chunks/dep-6f4e680e.js'); require('../_chunks/dep-7da70ee1.js'); require('../_chunks/dep-124386d4.js'); require('../_chunks/dep-d66ab3a4.js'); require('../_chunks/dep-d4d8c513.js'); require('../_common/js/global-config/t.js'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } 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; } var TFoot = VueCompositionAPI.defineComponent({ name: "TFoot", props: { rowKey: String, isFixedHeader: Boolean, rowAndColFixedPosition: Map, footData: Array, columns: Array, rowAttributes: [Array, Object, Function], rowClassName: [Array, String, Object, Function], thWidthList: [Object], footerSummary: [String, Function], rowspanAndColspanInFooter: Function }, setup: function setup(props, context) { var renderTNode = hooks_tnode.useTNodeJSX(); var classnames = table_hooks_useClassName["default"](); var _toRefs = VueCompositionAPI.toRefs(props), footData = _toRefs.footData, columns = _toRefs.columns, rowKey = _toRefs.rowKey, rowspanAndColspanInFooter = _toRefs.rowspanAndColspanInFooter; var _useRowspanAndColspan = table_hooks_useRowspanAndColspan["default"](footData, columns, rowKey, rowspanAndColspanInFooter), skipSpansMap = _useRowspanAndColspan.skipSpansMap; var renderTFootCell = function renderTFootCell(p) { var col = p.col, row = p.row; if (isFunction.isFunction(col.foot)) { return col.foot(VueCompositionAPI.h, p); } if (isString.isString(col.foot) && context.slots[col.foot]) { return context.slots[col.foot](p); } return col.foot || get.get(row, col.colKey); }; return _objectSpread(_objectSpread({ skipSpansMap: skipSpansMap }, classnames), {}, { renderTFootCell: renderTFootCell, renderTNode: renderTNode }); }, render: function render() { var _this$footData, _this = this; var h = arguments[0]; if (!this.columns) return null; var theadClasses = [this.tableFooterClasses.footer, _defineProperty__default["default"]({}, this.tableFooterClasses.fixed, this.isFixedHeader)]; var footerDomList = (_this$footData = this.footData) === null || _this$footData === void 0 ? void 0 : _this$footData.map(function (row, rowIndex) { var trAttributes = table_utils.formatRowAttributes(_this.rowAttributes, { row: row, rowIndex: rowIndex, type: "foot" }); var customClasses = table_utils.formatRowClassNames(_this.rowClassName, { row: row, rowIndex: rowIndex, type: "foot" }, _this.rowKey || "id"); return h("tr", helper.helper([{ "key": rowIndex }, { "attrs": trAttributes }, { "class": customClasses }]), [_this.columns.map(function (col, colIndex) { var _this$thWidthList; var cellSpans = {}; var spanState = null; if (_this.skipSpansMap.size) { var _spanState, _spanState2; var cellKey = table_hooks_useRowspanAndColspan.getCellKey(row, _this.rowKey, col.colKey, colIndex); spanState = _this.skipSpansMap.get(cellKey) || {}; ((_spanState = spanState) === null || _spanState === void 0 ? void 0 : _spanState.rowspan) > 1 && (cellSpans.rowspan = spanState.rowspan); ((_spanState2 = spanState) === null || _spanState2 === void 0 ? void 0 : _spanState2.colspan) > 1 && (cellSpans.colspan = spanState.colspan); if (spanState.skipped) return null; } var tdStyles = table_hooks_useFixed.getColumnFixedStyles(col, colIndex, _this.rowAndColFixedPosition, _this.tableColFixedClasses); var style = _objectSpread({}, tdStyles.style); if ((_this$thWidthList = _this.thWidthList) !== null && _this$thWidthList !== void 0 && _this$thWidthList[col.colKey]) { style.width = "".concat(_this.thWidthList[col.colKey], "px"); } return h("td", helper.helper([{}, { "attrs": _objectSpread({ key: col.colKey }, cellSpans) }, { "class": tdStyles.classes, "style": style }]), [_this.renderTFootCell({ row: row, rowIndex: rowIndex, col: col, colIndex: colIndex })]); })]); }); var footerSummary = this.renderTNode("footerSummary"); if (!footerSummary && (!this.footData || !this.footData.length)) return null; return h("tfoot", { "ref": "tFooterRef", "class": theadClasses }, [footerSummary && h("tr", { "class": this.tableFullRowClasses.base }, [h("td", { "attrs": { "colspan": this.columns.length } }, [h("div", { "class": this.tableFullRowClasses.innerFullElement }, [footerSummary])])]), footerDomList]); } }); exports["default"] = TFoot; //# sourceMappingURL=tfoot.js.map