feat: update page size to 200 and limit fields (#1282)

* feat: update page size to 200 and limit fields

* fix: override

* fix: avoid fieldNames not exist

* feat: filter falsely fields
This commit is contained in:
Dunqing 2022-12-23 18:57:50 +08:00 committed by GitHub
parent a6dcc0c71b
commit 98bad0c8ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -17,15 +17,16 @@ export type RemoteSelectProps<P = any> = SelectProps<P, any> & {
const InternalRemoteSelect = connect( const InternalRemoteSelect = connect(
(props: RemoteSelectProps) => { (props: RemoteSelectProps) => {
const { fieldNames, service = {}, wait = 300, ...others } = props; const { fieldNames = {}, service = {}, wait = 300, ...others } = props;
const { data, run } = useRequest( const { data, run } = useRequest(
{ {
action: 'list', action: 'list',
...service, ...service,
params: { params: {
pageSize: 30, pageSize: 200,
...service?.params, ...service?.params,
fields: [fieldNames.label, fieldNames.value, ...(service?.params?.fields || [])],
// search needs // search needs
filter: { filter: {
$and: [service?.params?.filter].filter(Boolean), $and: [service?.params?.filter].filter(Boolean),

View File

@ -71,8 +71,8 @@ mergeStrategies.set('orMerge', (x, y) => {
mergeStrategies.set('deepMerge', (x, y) => { mergeStrategies.set('deepMerge', (x, y) => {
return isPlainObject(x) && isPlainObject(y) return isPlainObject(x) && isPlainObject(y)
? deepmerge(x, y, { ? deepmerge(x, y, {
arrayMerge: (x, y) => y, arrayMerge: (x, y) => y,
}) })
: y; : y;
}); });
@ -90,7 +90,7 @@ mergeStrategies.set('union', (x, y) => {
return lodash.uniq((x || []).concat(y || [])).filter(Boolean); return lodash.uniq((x || []).concat(y || [])).filter(Boolean);
}); });
mergeStrategies.set('intersect', (x, y) => { mergeStrategies.set('intersect', (x, y) => (() => {
if (typeof x === 'string') { if (typeof x === 'string') {
x = x.split(','); x = x.split(',');
} }
@ -104,7 +104,7 @@ mergeStrategies.set('intersect', (x, y) => {
return x || []; return x || [];
} }
return x.filter((v) => y.includes(v)); return x.filter((v) => y.includes(v));
}); })().filter(Boolean));
export function assign(target: any, source: any, strategies: MergeStrategies = {}) { export function assign(target: any, source: any, strategies: MergeStrategies = {}) {
getKeys(source).forEach((sourceKey) => { getKeys(source).forEach((sourceKey) => {