UNPKG

tdesign-vue

Version:
212 lines (204 loc) 8.88 kB
/** * tdesign v1.11.2 * (c) 2025 tdesign * @license MIT */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var helper = require('../_chunks/dep-ece3c062.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-ecccff93.js'); var isString = require('../_chunks/dep-738b4f21.js'); var get = require('../_chunks/dep-f84d1ea5.js'); require('@babel/runtime/helpers/typeof'); require('../_chunks/dep-a4cecac4.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-62de1188.js'); require('../_chunks/dep-867c284e.js'); require('../_chunks/dep-fcf0662d.js'); require('../_chunks/dep-aa0a4aac.js'); require('../_chunks/dep-a4308f57.js'); require('../_chunks/dep-e4278c54.js'); require('../utils/dom.js'); require('vue'); require('raf'); require('../utils/easing.js'); require('../_chunks/dep-bebcd284.js'); require('../_chunks/dep-9f4caea4.js'); require('../_chunks/dep-dbd838d6.js'); require('../_chunks/dep-b3120c1b.js'); require('../_chunks/dep-b1a02818.js'); require('../_chunks/dep-3d8ab37d.js'); require('../_chunks/dep-5db8defc.js'); require('../_chunks/dep-a0ae49c9.js'); require('../_chunks/dep-d23147db.js'); require('../_chunks/dep-a4747856.js'); require('../_chunks/dep-ab142eaf.js'); require('../_chunks/dep-502c56be.js'); require('../_chunks/dep-201f7798.js'); require('../_chunks/dep-d3015b4c.js'); require('../_chunks/dep-6e4c473c.js'); require('../_chunks/dep-a9e7deb2.js'); require('../_chunks/dep-6ad3de7c.js'); require('../_chunks/dep-eeb2e214.js'); require('../_chunks/dep-de60f5aa.js'); require('../_chunks/dep-b5c96567.js'); require('../_chunks/dep-71fa6788.js'); require('../_chunks/dep-362bc4d7.js'); require('../_chunks/dep-73fb598e.js'); require('../_chunks/dep-75cd6d52.js'); require('../_chunks/dep-234b7c02.js'); require('../_chunks/dep-2e32c1f2.js'); require('../_chunks/dep-f3761329.js'); require('../_chunks/dep-848a5a32.js'); require('../hooks/render-tnode.js'); require('../_chunks/dep-7c854ec6.js'); require('../_chunks/dep-eceed11d.js'); require('../_chunks/dep-f8a85d6a.js'); require('../_chunks/dep-5b117689.js'); require('../_chunks/dep-6478392e.js'); require('../_chunks/dep-47bca35e.js'); require('../_chunks/dep-a6490a32.js'); require('../_chunks/dep-3eec664c.js'); require('../_chunks/dep-8b1e056e.js'); require('../config-provider/useConfig.js'); require('../_chunks/dep-07fb8c0e.js'); require('../_common/js/global-config/default-config.js'); require('../_common/js/global-config/locale/zh_CN.js'); require('../_chunks/dep-a4a18104.js'); require('../_chunks/dep-27dd8cc6.js'); require('dayjs'); require('../_chunks/dep-87c765cc.js'); require('../_chunks/dep-932dd69e.js'); require('../_chunks/dep-68ba2357.js'); require('../_chunks/dep-173eb46c.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