mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 05:29:26 +08:00
fix: url query parameter operator issue (#6770)
* fix: url query parameter operator issue * fix: test
This commit is contained in:
parent
cf57be8fb4
commit
9ae303844d
@ -44,7 +44,7 @@ const findOption = (str, options) => {
|
|||||||
|
|
||||||
// 进入下一层 children 查找
|
// 进入下一层 children 查找
|
||||||
if (Array.isArray(option.children) || option.isLeaf === false) {
|
if (Array.isArray(option.children) || option.isLeaf === false) {
|
||||||
currentOptions = option.children || option.field.children;
|
currentOptions = option.children || option?.field?.children || [];
|
||||||
} else {
|
} else {
|
||||||
return option; // 没有 children 直接返回
|
return option; // 没有 children 直接返回
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ test('getURLSearchParamsChildren should return an array of options with expected
|
|||||||
|
|
||||||
const result = getURLSearchParamsChildren(queryParams);
|
const result = getURLSearchParamsChildren(queryParams);
|
||||||
|
|
||||||
expect(result).toEqual([
|
expect(result).toMatchObject([
|
||||||
{
|
{
|
||||||
label: 'param1',
|
label: 'param1',
|
||||||
value: 'param1',
|
value: 'param1',
|
||||||
|
@ -16,6 +16,7 @@ import { useLocationSearch } from '../../../application/CustomRouterContextProvi
|
|||||||
import { useFlag } from '../../../flag-provider/hooks/useFlag';
|
import { useFlag } from '../../../flag-provider/hooks/useFlag';
|
||||||
import { Option } from '../type';
|
import { Option } from '../type';
|
||||||
import { getLabelWithTooltip } from './useBaseVariable';
|
import { getLabelWithTooltip } from './useBaseVariable';
|
||||||
|
import { string } from '../../../collection-manager/interfaces/properties/operators';
|
||||||
|
|
||||||
export const getURLSearchParams = (search: string) => {
|
export const getURLSearchParams = (search: string) => {
|
||||||
if (search.startsWith('?')) {
|
if (search.startsWith('?')) {
|
||||||
@ -32,6 +33,7 @@ export const getURLSearchParamsChildren = (queryParams: Record<string, any>): Op
|
|||||||
value: key,
|
value: key,
|
||||||
key,
|
key,
|
||||||
isLeaf: true,
|
isLeaf: true,
|
||||||
|
operators: string,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user