mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:39:05 +08:00
fix: options value 为 undefined 不进行 normalize (#5263)
Co-authored-by: tooeast <liuzedong02@baidu.com>
This commit is contained in:
parent
39a7397dfc
commit
8bd11effcd
@ -570,6 +570,10 @@ export function registerOptionsControl(config: OptionsConfig) {
|
||||
whetherValueNormal() {
|
||||
const {value, joinValues, extractValue, multiple} = this.props;
|
||||
|
||||
if (value === undefined) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (joinValues !== false || (!multiple && extractValue === true)) {
|
||||
return typeof value === 'string' || typeof value === 'number';
|
||||
}
|
||||
@ -610,7 +614,8 @@ export function registerOptionsControl(config: OptionsConfig) {
|
||||
}
|
||||
|
||||
if (joinValues !== false) {
|
||||
if (typeof value === 'string' || typeof value === 'number') return;
|
||||
if (!value || typeof value === 'string' || typeof value === 'number')
|
||||
return;
|
||||
|
||||
const selectedOptions = formItem.getSelectedOptions(value);
|
||||
|
||||
|
@ -562,6 +562,7 @@ test('Renderer:checkboxes with defaultCheckAll & inline', async () => {
|
||||
const Ins = container.querySelectorAll('.cxd-CheckboxesControl');
|
||||
expect(Ins[0]!).toHaveClass('is-inline');
|
||||
expect(Ins[1]!).not.toHaveClass('is-inline');
|
||||
await wait(200);
|
||||
|
||||
fireEvent.click(getByText('Submit'));
|
||||
await waitFor(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user