Skip to content

Commit edac698

Browse files
author
baojie223
authored
Merge pull request #2 from vueComponent/master
merge
2 parents c7fce7a + b55fa75 commit edac698

File tree

10 files changed

+46
-10
lines changed

10 files changed

+46
-10
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- name: checkout
10-
uses: actions/checkout@master
10+
uses: actions/checkout@v2
1111

1212
- name: cache package-lock.json
1313
uses: actions/cache@v1
@@ -40,7 +40,7 @@ jobs:
4040
runs-on: ubuntu-latest
4141
steps:
4242
- name: checkout
43-
uses: actions/checkout@master
43+
uses: actions/checkout@v2
4444

4545
- name: restore cache from package-lock.json
4646
uses: actions/cache@v1
@@ -74,7 +74,7 @@ jobs:
7474
runs-on: ubuntu-latest
7575
steps:
7676
- name: checkout
77-
uses: actions/checkout@master
77+
uses: actions/checkout@v2
7878

7979
- name: restore cache from package-lock.json
8080
uses: actions/cache@v1
@@ -96,12 +96,12 @@ jobs:
9696
runs-on: ubuntu-latest
9797
steps:
9898
- name: checkout
99-
uses: actions/checkout@master
99+
uses: actions/checkout@v2
100100
with:
101101
token: ${{ secrets.ACCESS_TOKEN }}
102102

103103
- name: Checkout submodules
104-
uses: actions/checkout@master
104+
uses: actions/checkout@v2
105105
with:
106106
repository: tangjinzhou/antdv-demo
107107
token: ${{ secrets.ACCESS_TOKEN }}
@@ -122,4 +122,3 @@ jobs:
122122
- name: test
123123
run: npm test
124124
needs: setup
125-

components/badge/Badge.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ export default {
8181
},
8282
getBadgeClassName(prefixCls) {
8383
const children = filterEmpty(this.$slots.default);
84+
const hasStatus = this.hasStatus();
8485
return classNames(prefixCls, {
85-
[`${prefixCls}-status`]: this.hasStatus(),
86+
[`${prefixCls}-status`]: hasStatus,
87+
[`${prefixCls}-dot-status`]: hasStatus && this.dot && !this.isZero(),
8688
[`${prefixCls}-not-a-wrapper`]: !children.length,
8789
});
8890
},

components/badge/style/index.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@
114114
}
115115
}
116116

117+
&-dot-status {
118+
line-height: 1;
119+
}
120+
117121
&-zoom-appear,
118122
&-zoom-enter {
119123
animation: antZoomBadgeIn 0.3s @ease-out-back;

components/config-provider/index.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const ConfigProvider = {
2626
autoInsertSpaceInButton: PropTypes.bool,
2727
locale: PropTypes.object,
2828
pageHeader: PropTypes.object,
29+
transformCellText: PropTypes.func,
2930
},
3031
provide() {
3132
const _self = this;
@@ -43,7 +44,14 @@ const ConfigProvider = {
4344
};
4445
},
4546
watch: {
46-
...getWatch(['prefixCls', 'csp', 'autoInsertSpaceInButton', 'locale', 'pageHeader']),
47+
...getWatch([
48+
'prefixCls',
49+
'csp',
50+
'autoInsertSpaceInButton',
51+
'locale',
52+
'pageHeader',
53+
'transformCellText',
54+
]),
4755
},
4856
methods: {
4957
renderEmptyComponent(h, name) {

components/table/Table.jsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,7 @@ export default {
11641164
dropdownPrefixCls,
11651165
contextLocale,
11661166
getPopupContainer: contextGetPopupContainer,
1167+
transformCellText,
11671168
}) {
11681169
const { showHeader, locale, getPopupContainer, ...restProps } = getOptionProps(this);
11691170
const data = this.getCurrentPageData();
@@ -1220,6 +1221,7 @@ export default {
12201221
expandIconColumnIndex,
12211222
expandIconAsCell,
12221223
emptyText: mergedLocale.emptyText,
1224+
transformCellText,
12231225
},
12241226
on: getListeners(this),
12251227
class: classString,
@@ -1230,10 +1232,18 @@ export default {
12301232
},
12311233

12321234
render() {
1233-
const { prefixCls: customizePrefixCls, dropdownPrefixCls: customizeDropdownPrefixCls } = this;
1235+
const {
1236+
prefixCls: customizePrefixCls,
1237+
dropdownPrefixCls: customizeDropdownPrefixCls,
1238+
transformCellText: customizeTransformCellText,
1239+
} = this;
12341240
const data = this.getCurrentPageData();
1235-
const { getPopupContainer: getContextPopupContainer } = this.configProvider;
1241+
const {
1242+
getPopupContainer: getContextPopupContainer,
1243+
transformCellText: tct,
1244+
} = this.configProvider;
12361245
const getPopupContainer = this.getPopupContainer || getContextPopupContainer;
1246+
const transformCellText = customizeTransformCellText || tct;
12371247
let loading = this.loading;
12381248
if (typeof loading === 'boolean') {
12391249
loading = {
@@ -1263,6 +1273,7 @@ export default {
12631273
dropdownPrefixCls,
12641274
contextLocale: locale,
12651275
getPopupContainer,
1276+
transformCellText,
12661277
})
12671278
}
12681279
/>

components/table/interface.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export const TableProps = {
135135
tableLayout: PropTypes.string,
136136
getPopupContainer: PropTypes.func,
137137
expandIcon: PropTypes.func,
138+
transformCellText: PropTypes.func,
138139
// className?: PropTypes.string,
139140
// style?: React.CSSProperties;
140141
// children?: React.ReactNode;

components/vc-table/src/Table.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export default {
6767
expandRowByClick: PropTypes.bool,
6868
expandIcon: PropTypes.func,
6969
tableLayout: PropTypes.string,
70+
transformCellText: PropTypes.func,
7071
},
7172
{
7273
data: [],

components/vc-table/src/TableCell.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ export default {
2121
expandIcon: PropTypes.any,
2222
component: PropTypes.any,
2323
},
24+
inject: {
25+
table: { default: () => ({}) },
26+
},
2427
methods: {
2528
handleClick(e) {
2629
const {
@@ -45,6 +48,7 @@ export default {
4548
component: BodyCell,
4649
} = this;
4750
const { dataIndex, customRender, className = '' } = column;
51+
const { transformCellText } = this.table;
4852
// We should return undefined if no dataIndex is specified, but in order to
4953
// be compatible with object-path's behavior, we return the record object instead.
5054
let text;
@@ -87,6 +91,10 @@ export default {
8791
text = null;
8892
}
8993

94+
if (transformCellText) {
95+
text = transformCellText({ text, column, record, index });
96+
}
97+
9098
const indentText = expandIcon ? (
9199
<span
92100
style={{ paddingLeft: `${indentSize * indent}px` }}

types/config-provider.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ export declare class ConfigProvider extends AntdComponent {
1313
renderEmpty: Function;
1414
csp?: CSPConfig;
1515
autoInsertSpaceInButton?: boolean;
16+
transformCellText?: Function;
1617
}

types/table/table.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,4 +300,5 @@ export declare class Table extends AntdComponent {
300300
style: object;
301301
nativeOn: object;
302302
};
303+
transformCellText: Function;
303304
}

0 commit comments

Comments
 (0)