mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-01 04:01:59 +08:00
### What problem does this PR solve? Feat: Alter Item to TransferListItemType #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
6e13922bdc
commit
80389ae61e
@ -10,15 +10,19 @@ import {
|
|||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
type Item = {
|
export type TransferListItemType = {
|
||||||
key: string;
|
key: string;
|
||||||
label: string;
|
label: string;
|
||||||
selected?: boolean;
|
selected?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function TransferList({ items }: { items: Item[] }) {
|
export default function TransferList({
|
||||||
const [leftList, setLeftList] = React.useState<Item[]>(items);
|
items,
|
||||||
const [rightList, setRightList] = React.useState<Item[]>([]);
|
}: {
|
||||||
|
items: TransferListItemType[];
|
||||||
|
}) {
|
||||||
|
const [leftList, setLeftList] = React.useState<TransferListItemType[]>(items);
|
||||||
|
const [rightList, setRightList] = React.useState<TransferListItemType[]>([]);
|
||||||
const [leftSearch, setLeftSearch] = React.useState('');
|
const [leftSearch, setLeftSearch] = React.useState('');
|
||||||
const [rightSearch, setRightSearch] = React.useState('');
|
const [rightSearch, setRightSearch] = React.useState('');
|
||||||
|
|
||||||
@ -35,8 +39,8 @@ export default function TransferList({ items }: { items: Item[] }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const toggleSelection = (
|
const toggleSelection = (
|
||||||
list: Item[],
|
list: TransferListItemType[],
|
||||||
setList: React.Dispatch<React.SetStateAction<Item[]>>,
|
setList: React.Dispatch<React.SetStateAction<TransferListItemType[]>>,
|
||||||
key: string,
|
key: string,
|
||||||
) => {
|
) => {
|
||||||
const updatedList = list.map((item) => {
|
const updatedList = list.map((item) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user