(prevProps: CRUDProps)
| 718 | } |
| 719 | |
| 720 | componentDidUpdate(prevProps: CRUDProps) { |
| 721 | const props = this.props; |
| 722 | const store = prevProps.store; |
| 723 | |
| 724 | if ( |
| 725 | anyChanged( |
| 726 | ['toolbar', 'headerToolbar', 'footerToolbar', 'bulkActions'], |
| 727 | prevProps, |
| 728 | props |
| 729 | ) |
| 730 | ) { |
| 731 | // 来点参数变化。 |
| 732 | this.renderHeaderToolbar = this.renderHeaderToolbar.bind(this); |
| 733 | this.renderFooterToolbar = this.renderFooterToolbar.bind(this); |
| 734 | } |
| 735 | |
| 736 | let val: any; |
| 737 | if ( |
| 738 | this.props.pickerMode && |
| 739 | !isEqual((val = getPropValue(this.props)), getPropValue(prevProps)) && |
| 740 | !isEqual(val, store.selectedItems.concat()) |
| 741 | ) { |
| 742 | /** |
| 743 | * 更新链:Table -> CRUD -> Picker -> Form |
| 744 | * 对于Picker模式来说,执行到这里的时候store.selectedItems已经更新过了,所以需要额外判断一下 |
| 745 | */ |
| 746 | this.syncSelectedFromPicker(val); |
| 747 | } |
| 748 | |
| 749 | if (!!this.props.filterTogglable !== !!prevProps.filterTogglable) { |
| 750 | store.setFilterTogglable( |
| 751 | !!props.filterTogglable, |
| 752 | props.filterDefaultVisible |
| 753 | ); |
| 754 | } |
| 755 | |
| 756 | let dataInvalid = false; |
| 757 | |
| 758 | if ( |
| 759 | prevProps.syncLocation && |
| 760 | prevProps.location && |
| 761 | prevProps.location.search !== props.location.search |
| 762 | ) { |
| 763 | // 同步地址栏,那么直接检测 query 是否变了,变了就重新拉数据 |
| 764 | store.updateQuery( |
| 765 | parseQuery(props.location, this.getParseQueryOptions(props)), |
| 766 | undefined, |
| 767 | props.pageField, |
| 768 | props.perPageField |
| 769 | ); |
| 770 | dataInvalid = !!( |
| 771 | props.api && isObjectShallowModified(store.query, this.lastQuery, false) |
| 772 | ); |
| 773 | } |
| 774 | |
| 775 | if (dataInvalid) { |
| 776 | // 要同步数据 |
| 777 | } else if ( |
nothing calls this directly
no test coverage detected