mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-15 06:35:54 +08:00
Feat: filler list by user change input (#7389)
### What problem does this PR solve? filler list by user change input  ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
713c055e04
commit
e2b0bceb1b
@ -20,7 +20,7 @@ import {
|
|||||||
$isRangeSelection,
|
$isRangeSelection,
|
||||||
TextNode,
|
TextNode,
|
||||||
} from 'lexical';
|
} from 'lexical';
|
||||||
import {
|
import React, {
|
||||||
ReactElement,
|
ReactElement,
|
||||||
useCallback,
|
useCallback,
|
||||||
useContext,
|
useContext,
|
||||||
@ -114,11 +114,26 @@ export default function VariablePickerMenuPlugin({
|
|||||||
minLength: 0,
|
minLength: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
const setQueryString = useCallback(() => {}, []);
|
const [queryString, setQueryString] = React.useState<string| null>('');
|
||||||
|
|
||||||
const options = useBuildComponentIdSelectOptions(node?.id, node?.parentId);
|
const options = useBuildComponentIdSelectOptions(node?.id, node?.parentId);
|
||||||
|
|
||||||
const nextOptions: VariableOption[] = options.map(
|
const filteredOptions = React.useMemo(() => {
|
||||||
|
if (!queryString) return options;
|
||||||
|
const lowerQuery = queryString.toLowerCase();
|
||||||
|
return options
|
||||||
|
.map((x) => ({
|
||||||
|
...x,
|
||||||
|
options: x.options.filter(
|
||||||
|
(y) =>
|
||||||
|
y.label.toLowerCase().includes(lowerQuery) ||
|
||||||
|
y.value.toLowerCase().includes(lowerQuery),
|
||||||
|
),
|
||||||
|
}))
|
||||||
|
.filter((x) => x.options.length > 0);
|
||||||
|
}, [options, queryString]);
|
||||||
|
|
||||||
|
const nextOptions: VariableOption[] = filteredOptions.map(
|
||||||
(x) =>
|
(x) =>
|
||||||
new VariableOption(
|
new VariableOption(
|
||||||
x.label,
|
x.label,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user