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:
parent
a6dcc0c71b
commit
98bad0c8ea
@ -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),
|
||||||
|
@ -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) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user