mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:39:05 +08:00
chore: checkboxes 显示 loading 当选项在加载过程中 (#9416)
This commit is contained in:
parent
e868976c33
commit
062872698f
@ -9,7 +9,7 @@ import {
|
||||
flattenTreeWithLeafNodes
|
||||
} from 'amis-core';
|
||||
import type {ActionObject, Api, OptionsControlProps, Option} from 'amis-core';
|
||||
import {Checkbox, Icon} from 'amis-ui';
|
||||
import {Checkbox, Icon, Spinner} from 'amis-ui';
|
||||
import {FormOptionsSchema} from '../../Schema';
|
||||
import {supportStatic} from './StaticHoc';
|
||||
|
||||
@ -349,7 +349,9 @@ export default class CheckboxesControl extends React.Component<
|
||||
addApi,
|
||||
createBtnLabel,
|
||||
translate: __,
|
||||
optionType
|
||||
optionType,
|
||||
loading,
|
||||
loadingConfig
|
||||
} = this.props;
|
||||
|
||||
let body: Array<React.ReactNode> = [];
|
||||
@ -385,10 +387,20 @@ export default class CheckboxesControl extends React.Component<
|
||||
<div className={cx(`CheckboxesControl`, className)} ref="checkboxRef">
|
||||
{body && body.length ? (
|
||||
body
|
||||
) : (
|
||||
) : loading ? null : (
|
||||
<span className={`Form-placeholder`}>{__(placeholder)}</span>
|
||||
)}
|
||||
|
||||
{loading ? (
|
||||
<Spinner
|
||||
show
|
||||
icon="reload"
|
||||
size="sm"
|
||||
spinnerClassName={cx('Checkboxes-spinner')}
|
||||
loadingConfig={loadingConfig}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{(creatable || addApi) && !disabled ? (
|
||||
<a className={cx('Checkboxes-addBtn')} onClick={this.handleAddClick}>
|
||||
<Icon icon="plus" className="icon" />
|
||||
|
Loading…
Reference in New Issue
Block a user