fix(client): change toArr to _.castArray in select component (#543)

This commit is contained in:
Junyi 2022-06-28 10:08:24 +08:00 committed by GitHub
parent 9e85116c98
commit 3e8a80a3ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
import { toArr } from '@formily/shared';
import { castArray } from 'lodash';
export const defaultFieldNames = {
label: 'label',
@ -8,7 +8,9 @@ export const defaultFieldNames = {
};
export const getCurrentOptions = (values, dataSource, fieldNames) => {
values = toArr(values).map((val) => (typeof val === 'object' ? val[fieldNames.value] : val));
values = castArray(values)
.filter(item => item != null)
.map((val) => (typeof val === 'object' ? val[fieldNames.value] : val));
const findOptions = (options: any[]) => {
let current = [];
for (const option of options) {