Options 控件支持其他组件设置成 reload 目标,进行刷新
This commit is contained in:
parent
e32b78a0fb
commit
f5cb8b3185
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -345,6 +345,11 @@ export default class TextControl extends React.PureComponent<TextProps, TextStat
|
|||
}
|
||||
}
|
||||
|
||||
reload() {
|
||||
const reload = this.props.reloadOptions;
|
||||
reload && reload();
|
||||
}
|
||||
|
||||
renderSugestMode() {
|
||||
const {
|
||||
className,
|
||||
|
|
|
@ -154,6 +154,11 @@ export class TransferSelect extends React.Component<TransferSelectProps, Transfe
|
|||
});
|
||||
}
|
||||
|
||||
reload() {
|
||||
const reload = this.props.reloadOptions;
|
||||
reload && reload();
|
||||
}
|
||||
|
||||
renderTable() {
|
||||
const {
|
||||
filteredOptions
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue