| const selectedPluginsNum = selectedPlugins.length | const selectedPluginsNum = selectedPlugins.length | ||||
| const installMultiRef = useRef<ExposeRefs>(null) | const installMultiRef = useRef<ExposeRefs>(null) | ||||
| const { refreshPluginList } = useRefreshPluginList() | const { refreshPluginList } = useRefreshPluginList() | ||||
| const [isSelectAll, setIsSelectAll] = useState(false) | |||||
| const handleClickSelectAll = useCallback(() => { | |||||
| if (isSelectAll) | |||||
| installMultiRef.current?.deSelectAllPlugins() | |||||
| else | |||||
| installMultiRef.current?.selectAllPlugins() | |||||
| }, [isSelectAll]) | |||||
| const [canInstall, setCanInstall] = React.useState(false) | const [canInstall, setCanInstall] = React.useState(false) | ||||
| const [installedInfo, setInstalledInfo] = useState<Record<string, VersionInfo> | undefined>(undefined) | const [installedInfo, setInstalledInfo] = useState<Record<string, VersionInfo> | undefined>(undefined) | ||||
| const handleLoadedAllPlugin = useCallback((installedInfo: Record<string, VersionInfo> | undefined) => { | const handleLoadedAllPlugin = useCallback((installedInfo: Record<string, VersionInfo> | undefined) => { | ||||
| handleClickSelectAll() | |||||
| setInstalledInfo(installedInfo) | setInstalledInfo(installedInfo) | ||||
| setCanInstall(true) | setCanInstall(true) | ||||
| }, []) | }, []) | ||||
| installedInfo: installedInfo!, | installedInfo: installedInfo!, | ||||
| }) | }) | ||||
| } | } | ||||
| const [isSelectAll, setIsSelectAll] = useState(false) | |||||
| const [isIndeterminate, setIsIndeterminate] = useState(false) | const [isIndeterminate, setIsIndeterminate] = useState(false) | ||||
| const handleClickSelectAll = useCallback(() => { | |||||
| if (isSelectAll) | |||||
| installMultiRef.current?.deSelectAllPlugins() | |||||
| else | |||||
| installMultiRef.current?.selectAllPlugins() | |||||
| }, [isSelectAll]) | |||||
| const handleSelectAll = useCallback((plugins: Plugin[], selectedIndexes: number[]) => { | const handleSelectAll = useCallback((plugins: Plugin[], selectedIndexes: number[]) => { | ||||
| setSelectedPlugins(plugins) | setSelectedPlugins(plugins) | ||||
| setSelectedIndexes(selectedIndexes) | setSelectedIndexes(selectedIndexes) |