Skip to content

Commit

Permalink
feat(table): add footerSummary
Browse files Browse the repository at this point in the history
  • Loading branch information
chaishi committed Aug 10, 2022
1 parent 57bc4ac commit 77ce370
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/table/base-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ export default defineComponent({
rowAttributes={this.rowAttributes}
rowClassName={this.rowClassName}
thWidthList={this.thWidthList}
footerSummary={this.footerSummary}
rowspanAndColspanInFooter={this.rowspanAndColspanInFooter}
></TFoot>
</table>
Expand Down Expand Up @@ -468,6 +469,7 @@ export default defineComponent({
columns={columns}
rowAttributes={this.rowAttributes}
rowClassName={this.rowClassName}
footerSummary={this.footerSummary}
rowspanAndColspanInFooter={this.rowspanAndColspanInFooter}
></TFoot>
</table>
Expand Down
4 changes: 3 additions & 1 deletion src/table/tfoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface TFootProps {
rowClassName: TdBaseTableProps['rowClassName'];
// 表尾吸底内容宽度
thWidthList?: { [colKey: string]: number };
footerSummary?: TdBaseTableProps['footerSummary'];
rowspanAndColspanInFooter: TdBaseTableProps['rowspanAndColspanInFooter'];
}

Expand All @@ -42,6 +43,7 @@ export default defineComponent({
rowAttributes: [Array, Object, Function] as PropType<TFootProps['rowAttributes']>,
rowClassName: [Array, String, Object, Function] as PropType<TFootProps['rowClassName']>,
thWidthList: [Object] as PropType<TFootProps['thWidthList']>,
footerSummary: [String, Function] as PropType<TFootProps['footerSummary']>,
rowspanAndColspanInFooter: Function as PropType<TFootProps['rowspanAndColspanInFooter']>,
},

Expand Down Expand Up @@ -76,7 +78,7 @@ export default defineComponent({
render() {
if (!this.columns) return null;
const theadClasses = [this.tableFooterClasses.footer, { [this.tableFooterClasses.fixed]: this.isFixedHeader }];
const footerDomList = this.footData.map((row, rowIndex) => {
const footerDomList = this.footData?.map((row, rowIndex) => {
const trAttributes = formatRowAttributes(this.rowAttributes, { row, rowIndex, type: 'foot' });
// 自定义行类名
const customClasses = formatRowClassNames(
Expand Down

0 comments on commit 77ce370

Please sign in to comment.