mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 20:19:44 +08:00
Merge branch 'master' into feature-3.7.0
This commit is contained in:
commit
125d0df3e0
@ -7,6 +7,7 @@ node_js:
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.npm
|
||||
- node_modules
|
||||
|
||||
matrix:
|
||||
|
@ -43,7 +43,7 @@
|
||||
width: @size;
|
||||
height: @size;
|
||||
line-height: @size;
|
||||
border-radius: @size / 2;
|
||||
border-radius: 50%;
|
||||
|
||||
& > * {
|
||||
line-height: @size;
|
||||
|
@ -104,6 +104,7 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
|
||||
store: Store;
|
||||
columns: ColumnProps<T>[];
|
||||
components: TableComponents;
|
||||
row: React.ComponentType<any>;
|
||||
|
||||
constructor(props: TableProps<T>) {
|
||||
super(props);
|
||||
@ -922,13 +923,16 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
|
||||
createComponents(components: TableComponents = {}, prevComponents?: TableComponents) {
|
||||
const bodyRow = components && components.body && components.body.row;
|
||||
const preBodyRow = prevComponents && prevComponents.body && prevComponents.body.row;
|
||||
if (!this.components || bodyRow !== preBodyRow) {
|
||||
this.components = { ...components };
|
||||
this.components.body = {
|
||||
...components.body,
|
||||
row: createBodyRow(bodyRow),
|
||||
};
|
||||
if (!this.row || bodyRow !== preBodyRow) {
|
||||
this.row = createBodyRow(bodyRow);
|
||||
}
|
||||
this.components = {
|
||||
...components,
|
||||
body: {
|
||||
...components.body,
|
||||
row: this.row,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
renderTable = (contextLocale: TableLocale, loading: SpinProps) => {
|
||||
|
@ -77,4 +77,12 @@ describe('Table', () => {
|
||||
wrapper.update();
|
||||
expect(wrapper.find('.ant-spin')).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('renders custom components correctly when it changes', () => {
|
||||
const BodyWrapper1 = props => <tbody id="wrapper1" {...props} />;
|
||||
const BodyWrapper2 = props => <tbody id="wrapper2" {...props} />;
|
||||
const wrapper = mount(<Table components={{ body: { wrapper: BodyWrapper1 } }} />);
|
||||
wrapper.setProps({ components: { body: { wrapper: BodyWrapper2 } } });
|
||||
expect(wrapper.find('tbody').props().id).toBe('wrapper2');
|
||||
});
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
order: 4
|
||||
title:
|
||||
title:
|
||||
zh-CN: 自定义时间轴点
|
||||
en-US: Custom
|
||||
---
|
||||
@ -9,7 +9,7 @@ title:
|
||||
|
||||
可以设置为图标或其他自定义元素。
|
||||
|
||||
## en-US
|
||||
## en-US
|
||||
|
||||
Set a node as an icon or other custom element.
|
||||
|
||||
|
@ -65,13 +65,13 @@
|
||||
border-radius: 0;
|
||||
padding: 3px 1px;
|
||||
transform: translate(-50%, -50%);
|
||||
top: 5px;
|
||||
top: 5.5px;
|
||||
left: 5px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
&-content {
|
||||
padding: 0 0 0 18px;
|
||||
margin: 0 0 0 18px;
|
||||
position: relative;
|
||||
top: -(@font-size-base * @line-height-base - @font-size-base) + 1px;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user