UNPKG

xdesign-vue-next

Version:

XDesign Component for vue-next

195 lines (191 loc) 8.4 kB
/** * xdesign v1.0.6 * (c) 2023 xdesign * @license MIT */ import { _ as _defineProperty } from '../_chunks/dep-f9e836af.mjs'; import { defineComponent, toRefs, h, createVNode, mergeProps } from 'vue'; import { i as isString_1 } from '../_chunks/dep-11fa9c2c.mjs'; import { i as isFunction_1 } from '../_chunks/dep-1cc1c24f.mjs'; import { g as get_1 } from '../_chunks/dep-7fa157cd.mjs'; import { formatRowAttributes, formatRowClassNames } from './utils.mjs'; import { getColumnFixedStyles } from './hooks/useFixed.mjs'; import { useTNodeJSX } from '../hooks/tnode.mjs'; import useRowspanAndColspan, { getCellKey } from './hooks/useRowspanAndColspan.mjs'; import useClassName from './hooks/useClassName.mjs'; import '../_chunks/dep-82805301.mjs'; import '../_chunks/dep-10a947a6.mjs'; import '../_chunks/dep-b75d8d74.mjs'; import '../_chunks/dep-a95026f2.mjs'; import '../_chunks/dep-068e912d.mjs'; import '../_chunks/dep-addc2a84.mjs'; import '../_chunks/dep-6ad18815.mjs'; import '../_chunks/dep-fa6608fd.mjs'; import '../_chunks/dep-7dcfa37a.mjs'; import '../_chunks/dep-6aa0223b.mjs'; import '../_chunks/dep-db381ece.mjs'; import '../_chunks/dep-5755c21c.mjs'; import '../_chunks/dep-7f239c43.mjs'; import '../_chunks/dep-4903a8a8.mjs'; import '../_chunks/dep-32d4c595.mjs'; import '../_chunks/dep-89b966f4.mjs'; import '../_chunks/dep-0c786bea.mjs'; import '../_chunks/dep-e727a519.mjs'; import '../_chunks/dep-03412fab.mjs'; import '../_chunks/dep-26bf361a.mjs'; import '../_chunks/dep-0e832fc7.mjs'; import '../_chunks/dep-e1ab85c5.mjs'; import '../_chunks/dep-3ec3335a.mjs'; import '../_chunks/dep-d32fbbb3.mjs'; import '../_chunks/dep-29f616db.mjs'; import '../_chunks/dep-4265f69a.mjs'; import '../_chunks/dep-5f0e0453.mjs'; import '../_chunks/dep-983ce253.mjs'; import '../_chunks/dep-205ff58d.mjs'; import '../_chunks/dep-dafada74.mjs'; import '../_chunks/dep-8d1c9a23.mjs'; import '../_chunks/dep-395d33c9.mjs'; import '../_chunks/dep-e901316d.mjs'; import '../_common/js/log/index.mjs'; import '../_common/js/log/log.mjs'; import '../_common/js/utils/getScrollbarWidth.mjs'; import '../_common/js/utils/helper.mjs'; import '../_chunks/dep-5bec687c.mjs'; import '../_chunks/dep-53e379cd.mjs'; import '../_chunks/dep-5a2ce53e.mjs'; import '../_chunks/dep-1bae6a97.mjs'; import '../_chunks/dep-23f91684.mjs'; import '../utils/dom.mjs'; import '../utils/easing.mjs'; import '../_chunks/dep-a628549d.mjs'; import '../_chunks/dep-f4eba04c.mjs'; import '../_chunks/dep-735bcd0d.mjs'; import '../_chunks/dep-765678ef.mjs'; import '../_chunks/dep-8db27830.mjs'; import '../_chunks/dep-ae4bffa5.mjs'; import '../utils/render-tnode.mjs'; import '../_chunks/dep-9d7ebc32.mjs'; import '../_chunks/dep-69963a8c.mjs'; import '../_chunks/dep-6e7b37b8.mjs'; import '../hooks/useConfig.mjs'; import '../config-provider/useConfig.mjs'; import '../_chunks/dep-91ac8f71.mjs'; import '../_chunks/dep-c4737535.mjs'; import '../_chunks/dep-81c83986.mjs'; import '../_chunks/dep-6f04869e.mjs'; import '../_chunks/dep-71f84cf2.mjs'; import '../_chunks/dep-b09f48fa.mjs'; import '../_chunks/dep-ed4e7c50.mjs'; import '../_chunks/dep-a666b9ad.mjs'; import '../_common/js/global-config/default-config.mjs'; import '../_common/js/global-config/locale/en_US.mjs'; import '../config-provider/type.mjs'; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } var TFoot = defineComponent({ name: "XFoot", 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 = useTNodeJSX(); var classnames = useClassName(); var _toRefs = toRefs(props), footData = _toRefs.footData, columns = _toRefs.columns, rowKey = _toRefs.rowKey, rowspanAndColspanInFooter = _toRefs.rowspanAndColspanInFooter; var _useRowspanAndColspan = useRowspanAndColspan(footData, columns, rowKey, rowspanAndColspanInFooter), skipSpansMap = _useRowspanAndColspan.skipSpansMap; var renderTFootCell = function renderTFootCell(p) { var col = p.col, row = p.row; if (isFunction_1(col.foot)) { return col.foot(h, p); } if (isString_1(col.foot) && context.slots[col.foot]) { return context.slots[col.foot](p) || col.foot; } return col.foot || get_1(row, col.colKey); }; return _objectSpread(_objectSpread({ skipSpansMap: skipSpansMap }, classnames), {}, { renderTFootCell: renderTFootCell, renderTNode: renderTNode }); }, render: function render() { var _this$footData, _this = this; if (!this.columns) return null; var theadClasses = [this.tableFooterClasses.footer, _defineProperty({}, 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 = formatRowAttributes(_this.rowAttributes, { row: row, rowIndex: rowIndex, type: "foot" }); var customClasses = formatRowClassNames(_this.rowClassName, { row: row, rowIndex: rowIndex, type: "foot" }, _this.rowKey || "id"); return createVNode("tr", mergeProps(trAttributes, { "key": rowIndex, "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 = 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 = 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 createVNode("td", mergeProps(_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 createVNode("tfoot", { "ref": "tFooterRef", "class": theadClasses }, [footerSummary && createVNode("tr", { "class": this.tableFullRowClasses.base }, [createVNode("td", { "colspan": this.columns.length }, [createVNode("div", { "class": this.tableFullRowClasses.innerFullElement }, [footerSummary])])]), footerDomList]); } }); export { TFoot as default }; //# sourceMappingURL=tfoot.mjs.map