Options 控件支持其他组件设置成 reload 目标,进行刷新

This commit is contained in:
liaoxuezhi 2019-08-27 12:11:18 +08:00
parent e32b78a0fb
commit f5cb8b3185
14 changed files with 68 additions and 0 deletions

View File

@ -42,6 +42,11 @@ export default class ButtonGroupControl extends React.Component<ButtonGroupProps
onToggle(option)
}
reload() {
const reload = this.props.reloadOptions;
reload && reload();
}
render(props = this.props) {
const {
render,

View File

@ -155,6 +155,11 @@ export default class ChainedSelectControl extends React.Component<ChainedSelectP
onChange(joinValues ? arr.join(delimiter || ',') : extractValue ? arr.map(item => item.value || item) : arr);
}
reload() {
const reload = this.props.reloadOptions;
reload && reload();
}
render() {
const {
options,

View File

@ -31,6 +31,11 @@ export default class CheckboxesControl extends React.Component<CheckboxesProps,
defaultCheckAll && onToggleAll();
}
reload() {
const reload = this.props.reloadOptions;
reload && reload();
}
renderGroup(option:Option, index:number) {
const {
classnames: cx

View File

@ -51,6 +51,11 @@ export default class ListControl extends React.Component<ListProps, any> {
onToggle(option);
}
reload() {
const reload = this.props.reloadOptions;
reload && reload();
}
render() {
const {
render,

View File

@ -182,6 +182,11 @@ export default class NestedSelectControl extends React.Component<NestedSelectPro
});
}
reload() {
const reload = this.props.reloadOptions;
reload && reload();
}
renderOptions(newOptions: Array<any>, isChildren: boolean, uncheckable: boolean): any {
const {
multiple,

View File

@ -39,6 +39,7 @@ export interface OptionsControlProps extends FormControlProps, OptionProps {
selectedOptions: Array<Option>;
setOptions: (value:Array<any>) => void;
setLoading: (value:boolean) => void;
reloadOptions: () => void;
}
export function registerOptionsControl(config: OptionsConfig) {
@ -380,6 +381,7 @@ export function registerOptionsControl(config: OptionsConfig) {
setLoading={this.setLoading}
setOptions={this.setOptions}
syncOptions={this.syncOptions}
reloadOptions={this.reload}
/>
)
}

View File

@ -98,6 +98,11 @@ export default class PickerControl extends React.PureComponent<PickerProps, any>
}
}
reload() {
const reload = this.props.reloadOptions;
reload && reload();
}
@autobind
open() {
this.setState({

View File

@ -44,6 +44,12 @@ export default class RadiosControl extends React.Component<RadiosProps, any> {
onChange && onChange(option);
}
reload() {
const reload = this.props.reloadOptions;
reload && reload();
}
render() {
const {
className,

View File

@ -167,6 +167,11 @@ export default class SelectControl extends React.Component<SelectProps, any> {
setOptions(mergedOptions);
}
reload() {
const reload = this.props.reloadOptions;
reload && reload();
}
render() {
const {
autoComplete,

View File

@ -220,6 +220,11 @@ export default class TagControl extends React.PureComponent<TagProps, TagState>
return (findDOMNode(this) as HTMLElement).parentNode;
}
reload() {
const reload = this.props.reloadOptions;
reload && reload();
}
render() {
const {
className,

View File

@ -345,6 +345,11 @@ export default class TextControl extends React.PureComponent<TextProps, TextStat
}
}
reload() {
const reload = this.props.reloadOptions;
reload && reload();
}
renderSugestMode() {
const {
className,

View File

@ -154,6 +154,11 @@ export class TransferSelect extends React.Component<TransferSelectProps, Transfe
});
}
reload() {
const reload = this.props.reloadOptions;
reload && reload();
}
renderTable() {
const {
filteredOptions

View File

@ -27,6 +27,11 @@ export default class TreeControl extends React.Component<TreeProps, any> {
showIcon: true,
}
reload() {
const reload = this.props.reloadOptions;
reload && reload();
}
render() {
const {
className,

View File

@ -305,6 +305,11 @@ export default class TreeSelectControl extends React.Component<TreeSelectProps,
return combinedOptions;
}
reload() {
const reload = this.props.reloadOptions;
reload && reload();
}
renderValues() {
const {
classPrefix: ns,