From d88964f62957f3df0e5ac5c4390dd74d5e943a7f Mon Sep 17 00:00:00 2001 From: balibabu Date: Fri, 21 Mar 2025 18:42:52 +0800 Subject: [PATCH] Feat: If the Transfer item is disabled, the item cannot be edited. #3221 (#6409) ### What problem does this PR solve? Feat: If the Transfer item is disabled, the item cannot be edited. #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- web/src/components/ui/transfer-list.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/web/src/components/ui/transfer-list.tsx b/web/src/components/ui/transfer-list.tsx index 5a6e6ce57..af8934263 100644 --- a/web/src/components/ui/transfer-list.tsx +++ b/web/src/components/ui/transfer-list.tsx @@ -8,12 +8,13 @@ import { SquareCheckIcon, SquareIcon, } from 'lucide-react'; -import React, { memo, useCallback, useEffect } from 'react'; +import React, { ReactNode, memo, useCallback, useEffect } from 'react'; export type TransferListItemType = { key: string; label: string; selected?: boolean; + disabled?: boolean; }; export enum TransferListMoveDirection { @@ -29,12 +30,15 @@ export type TransferListProps = { direction: TransferListMoveDirection, moveKeys: string[], ): void; +} & { + children?(item: TransferListItemType): ReactNode; }; export const TransferList = memo(function ({ items, onChange, targetKeys, + children, }: TransferListProps) { const [leftList, setLeftList] = React.useState([]); const [rightList, setRightList] = React.useState([]); @@ -166,23 +170,26 @@ export const TransferList = memo(function ({ ) .map((item) => (
  • + {children?.(item)}
  • ))}