| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  | import { memo, useMemo, useState } from 'react' | 
					
						
							|  |  |  | import { useTranslation } from 'react-i18next' | 
					
						
							|  |  |  | import { FixedSizeList as List, areEqual } from 'react-window' | 
					
						
							|  |  |  | import type { ListChildComponentProps } from 'react-window' | 
					
						
							| 
									
										
										
										
											2025-03-19 11:19:57 +08:00
										 |  |  | import { RiArrowDownSLine, RiArrowRightSLine } from '@remixicon/react' | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  | import Checkbox from '../../checkbox' | 
					
						
							|  |  |  | import NotionIcon from '../../notion-icon' | 
					
						
							| 
									
										
										
										
											2024-07-09 15:05:40 +08:00
										 |  |  | import cn from '@/utils/classnames' | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  | import type { DataSourceNotionPage, DataSourceNotionPageMap } from '@/models/common' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type PageSelectorProps = { | 
					
						
							|  |  |  |   value: Set<string> | 
					
						
							| 
									
										
										
										
											2024-06-20 15:48:38 +08:00
										 |  |  |   disabledValue: Set<string> | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |   searchValue: string | 
					
						
							|  |  |  |   pagesMap: DataSourceNotionPageMap | 
					
						
							|  |  |  |   list: DataSourceNotionPage[] | 
					
						
							|  |  |  |   onSelect: (selectedPagesId: Set<string>) => void | 
					
						
							|  |  |  |   canPreview?: boolean | 
					
						
							|  |  |  |   previewPageId?: string | 
					
						
							|  |  |  |   onPreview?: (selectedPageId: string) => void | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | type NotionPageTreeItem = { | 
					
						
							|  |  |  |   children: Set<string> | 
					
						
							|  |  |  |   descendants: Set<string> | 
					
						
							| 
									
										
										
										
											2024-09-08 12:14:11 +07:00
										 |  |  |   depth: number | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |   ancestors: string[] | 
					
						
							|  |  |  | } & DataSourceNotionPage | 
					
						
							|  |  |  | type NotionPageTreeMap = Record<string, NotionPageTreeItem> | 
					
						
							|  |  |  | type NotionPageItem = { | 
					
						
							|  |  |  |   expand: boolean | 
					
						
							| 
									
										
										
										
											2024-09-08 12:14:11 +07:00
										 |  |  |   depth: number | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  | } & DataSourceNotionPage | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const recursivePushInParentDescendants = ( | 
					
						
							|  |  |  |   pagesMap: DataSourceNotionPageMap, | 
					
						
							|  |  |  |   listTreeMap: NotionPageTreeMap, | 
					
						
							|  |  |  |   current: NotionPageTreeItem, | 
					
						
							|  |  |  |   leafItem: NotionPageTreeItem, | 
					
						
							|  |  |  | ) => { | 
					
						
							|  |  |  |   const parentId = current.parent_id | 
					
						
							|  |  |  |   const pageId = current.page_id | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (!parentId || !pageId) | 
					
						
							|  |  |  |     return | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (parentId !== 'root' && pagesMap[parentId]) { | 
					
						
							|  |  |  |     if (!listTreeMap[parentId]) { | 
					
						
							|  |  |  |       const children = new Set([pageId]) | 
					
						
							|  |  |  |       const descendants = new Set([pageId, leafItem.page_id]) | 
					
						
							|  |  |  |       listTreeMap[parentId] = { | 
					
						
							|  |  |  |         ...pagesMap[parentId], | 
					
						
							|  |  |  |         children, | 
					
						
							|  |  |  |         descendants, | 
					
						
							| 
									
										
										
										
											2024-09-08 12:14:11 +07:00
										 |  |  |         depth: 0, | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |         ancestors: [], | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							|  |  |  |       listTreeMap[parentId].children.add(pageId) | 
					
						
							|  |  |  |       listTreeMap[parentId].descendants.add(pageId) | 
					
						
							|  |  |  |       listTreeMap[parentId].descendants.add(leafItem.page_id) | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-09-08 12:14:11 +07:00
										 |  |  |     leafItem.depth++ | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |     leafItem.ancestors.unshift(listTreeMap[parentId].page_name) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (listTreeMap[parentId].parent_id !== 'root') | 
					
						
							|  |  |  |       recursivePushInParentDescendants(pagesMap, listTreeMap, listTreeMap[parentId], leafItem) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-27 17:06:16 +08:00
										 |  |  | const ItemComponent = ({ index, style, data }: ListChildComponentProps<{ | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |   dataList: NotionPageItem[] | 
					
						
							|  |  |  |   handleToggle: (index: number) => void | 
					
						
							|  |  |  |   checkedIds: Set<string> | 
					
						
							| 
									
										
										
										
											2024-06-20 15:48:38 +08:00
										 |  |  |   disabledCheckedIds: Set<string> | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |   handleCheck: (index: number) => void | 
					
						
							|  |  |  |   canPreview?: boolean | 
					
						
							|  |  |  |   handlePreview: (index: number) => void | 
					
						
							|  |  |  |   listMapWithChildrenAndDescendants: NotionPageTreeMap | 
					
						
							|  |  |  |   searchValue: string | 
					
						
							|  |  |  |   previewPageId: string | 
					
						
							|  |  |  |   pagesMap: DataSourceNotionPageMap | 
					
						
							|  |  |  | }>) => { | 
					
						
							|  |  |  |   const { t } = useTranslation() | 
					
						
							| 
									
										
										
										
											2024-06-20 15:48:38 +08:00
										 |  |  |   const { dataList, handleToggle, checkedIds, disabledCheckedIds, handleCheck, canPreview, handlePreview, listMapWithChildrenAndDescendants, searchValue, previewPageId, pagesMap } = data | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |   const current = dataList[index] | 
					
						
							|  |  |  |   const currentWithChildrenAndDescendants = listMapWithChildrenAndDescendants[current.page_id] | 
					
						
							|  |  |  |   const hasChild = currentWithChildrenAndDescendants.descendants.size > 0 | 
					
						
							|  |  |  |   const ancestors = currentWithChildrenAndDescendants.ancestors | 
					
						
							|  |  |  |   const breadCrumbs = ancestors.length ? [...ancestors, current.page_name] : [current.page_name] | 
					
						
							| 
									
										
										
										
											2024-06-20 15:48:38 +08:00
										 |  |  |   const disabled = disabledCheckedIds.has(current.page_id) | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   const renderArrow = () => { | 
					
						
							|  |  |  |     if (hasChild) { | 
					
						
							|  |  |  |       return ( | 
					
						
							|  |  |  |         <div | 
					
						
							| 
									
										
										
										
											2025-03-21 17:41:03 +08:00
										 |  |  |           className='mr-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-md hover:bg-components-button-ghost-bg-hover' | 
					
						
							| 
									
										
										
										
											2024-09-08 12:14:11 +07:00
										 |  |  |           style={{ marginLeft: current.depth * 8 }} | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |           onClick={() => handleToggle(index)} | 
					
						
							| 
									
										
										
										
											2025-03-19 11:19:57 +08:00
										 |  |  |         > | 
					
						
							|  |  |  |           { | 
					
						
							|  |  |  |             current.expand | 
					
						
							| 
									
										
										
										
											2025-03-21 17:41:03 +08:00
										 |  |  |               ? <RiArrowDownSLine className='h-4 w-4 text-text-tertiary' /> | 
					
						
							|  |  |  |               : <RiArrowRightSLine className='h-4 w-4 text-text-tertiary' /> | 
					
						
							| 
									
										
										
										
											2025-03-19 11:19:57 +08:00
										 |  |  |           } | 
					
						
							|  |  |  |         </div> | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |       ) | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (current.parent_id === 'root' || !pagesMap[current.parent_id]) { | 
					
						
							|  |  |  |       return ( | 
					
						
							|  |  |  |         <div></div> | 
					
						
							|  |  |  |       ) | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return ( | 
					
						
							| 
									
										
										
										
											2025-03-21 17:41:03 +08:00
										 |  |  |       <div className='mr-1 h-5 w-5 shrink-0' style={{ marginLeft: current.depth * 8 }} /> | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |     ) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return ( | 
					
						
							|  |  |  |     <div | 
					
						
							| 
									
										
										
										
											2025-03-21 17:41:03 +08:00
										 |  |  |       className={cn('group flex cursor-pointer items-center rounded-md pl-2 pr-[2px] hover:bg-state-base-hover', | 
					
						
							| 
									
										
										
										
											2025-03-19 11:19:57 +08:00
										 |  |  |         previewPageId === current.page_id && 'bg-state-base-hover')} | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |       style={{ ...style, top: style.top as number + 8, left: 8, right: 8, width: 'calc(100% - 16px)' }} | 
					
						
							|  |  |  |     > | 
					
						
							|  |  |  |       <Checkbox | 
					
						
							| 
									
										
										
										
											2025-03-21 17:41:03 +08:00
										 |  |  |         className='mr-2 shrink-0' | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |         checked={checkedIds.has(current.page_id)} | 
					
						
							| 
									
										
										
										
											2024-06-20 15:48:38 +08:00
										 |  |  |         disabled={disabled} | 
					
						
							|  |  |  |         onCheck={() => { | 
					
						
							|  |  |  |           if (disabled) | 
					
						
							|  |  |  |             return | 
					
						
							|  |  |  |           handleCheck(index) | 
					
						
							|  |  |  |         }} | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |       /> | 
					
						
							|  |  |  |       {!searchValue && renderArrow()} | 
					
						
							|  |  |  |       <NotionIcon | 
					
						
							| 
									
										
										
										
											2025-03-21 17:41:03 +08:00
										 |  |  |         className='mr-1 shrink-0' | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |         type='page' | 
					
						
							|  |  |  |         src={current.page_icon} | 
					
						
							|  |  |  |       /> | 
					
						
							|  |  |  |       <div | 
					
						
							| 
									
										
										
										
											2025-03-21 17:41:03 +08:00
										 |  |  |         className='grow truncate text-[13px] font-medium leading-4 text-text-secondary' | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |         title={current.page_name} | 
					
						
							|  |  |  |       > | 
					
						
							|  |  |  |         {current.page_name} | 
					
						
							|  |  |  |       </div> | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         canPreview && ( | 
					
						
							|  |  |  |           <div | 
					
						
							| 
									
										
										
										
											2025-03-21 17:41:03 +08:00
										 |  |  |             className='ml-1 hidden h-6 shrink-0 cursor-pointer items-center rounded-md border-[0.5px] border-components-button-secondary-border bg-components-button-secondary-bg px-2 text-xs | 
					
						
							|  |  |  |             font-medium leading-4 text-components-button-secondary-text shadow-xs shadow-shadow-shadow-3 backdrop-blur-[10px] | 
					
						
							|  |  |  |             hover:border-components-button-secondary-border-hover hover:bg-components-button-secondary-bg-hover group-hover:flex' | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |             onClick={() => handlePreview(index)}> | 
					
						
							|  |  |  |             {t('common.dataSource.notion.selector.preview')} | 
					
						
							|  |  |  |           </div> | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         searchValue && ( | 
					
						
							|  |  |  |           <div | 
					
						
							| 
									
										
										
										
											2025-03-21 17:41:03 +08:00
										 |  |  |             className='ml-1 max-w-[120px] shrink-0 truncate text-xs text-text-quaternary' | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |             title={breadCrumbs.join(' / ')} | 
					
						
							|  |  |  |           > | 
					
						
							|  |  |  |             {breadCrumbs.join(' / ')} | 
					
						
							|  |  |  |           </div> | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     </div> | 
					
						
							|  |  |  |   ) | 
					
						
							| 
									
										
										
										
											2023-08-27 17:06:16 +08:00
										 |  |  | } | 
					
						
							|  |  |  | const Item = memo(ItemComponent, areEqual) | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | const PageSelector = ({ | 
					
						
							|  |  |  |   value, | 
					
						
							| 
									
										
										
										
											2024-06-20 15:48:38 +08:00
										 |  |  |   disabledValue, | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |   searchValue, | 
					
						
							|  |  |  |   pagesMap, | 
					
						
							|  |  |  |   list, | 
					
						
							|  |  |  |   onSelect, | 
					
						
							|  |  |  |   canPreview = true, | 
					
						
							|  |  |  |   previewPageId, | 
					
						
							|  |  |  |   onPreview, | 
					
						
							|  |  |  | }: PageSelectorProps) => { | 
					
						
							|  |  |  |   const { t } = useTranslation() | 
					
						
							|  |  |  |   const [prevDataList, setPrevDataList] = useState(list) | 
					
						
							|  |  |  |   const [dataList, setDataList] = useState<NotionPageItem[]>([]) | 
					
						
							|  |  |  |   const [localPreviewPageId, setLocalPreviewPageId] = useState('') | 
					
						
							|  |  |  |   if (prevDataList !== list) { | 
					
						
							|  |  |  |     setPrevDataList(list) | 
					
						
							|  |  |  |     setDataList(list.filter(item => item.parent_id === 'root' || !pagesMap[item.parent_id]).map((item) => { | 
					
						
							|  |  |  |       return { | 
					
						
							|  |  |  |         ...item, | 
					
						
							|  |  |  |         expand: false, | 
					
						
							| 
									
										
										
										
											2024-09-08 12:14:11 +07:00
										 |  |  |         depth: 0, | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |       } | 
					
						
							|  |  |  |     })) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   const searchDataList = list.filter((item) => { | 
					
						
							|  |  |  |     return item.page_name.includes(searchValue) | 
					
						
							|  |  |  |   }).map((item) => { | 
					
						
							|  |  |  |     return { | 
					
						
							|  |  |  |       ...item, | 
					
						
							|  |  |  |       expand: false, | 
					
						
							| 
									
										
										
										
											2024-09-08 12:14:11 +07:00
										 |  |  |       depth: 0, | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |   }) | 
					
						
							|  |  |  |   const currentDataList = searchValue ? searchDataList : dataList | 
					
						
							|  |  |  |   const currentPreviewPageId = previewPageId === undefined ? localPreviewPageId : previewPageId | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   const listMapWithChildrenAndDescendants = useMemo(() => { | 
					
						
							|  |  |  |     return list.reduce((prev: NotionPageTreeMap, next: DataSourceNotionPage) => { | 
					
						
							|  |  |  |       const pageId = next.page_id | 
					
						
							|  |  |  |       if (!prev[pageId]) | 
					
						
							| 
									
										
										
										
											2024-09-08 12:14:11 +07:00
										 |  |  |         prev[pageId] = { ...next, children: new Set(), descendants: new Set(), depth: 0, ancestors: [] } | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |       recursivePushInParentDescendants(pagesMap, prev, prev[pageId], prev[pageId]) | 
					
						
							|  |  |  |       return prev | 
					
						
							|  |  |  |     }, {}) | 
					
						
							|  |  |  |   }, [list, pagesMap]) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   const handleToggle = (index: number) => { | 
					
						
							|  |  |  |     const current = dataList[index] | 
					
						
							|  |  |  |     const pageId = current.page_id | 
					
						
							|  |  |  |     const currentWithChildrenAndDescendants = listMapWithChildrenAndDescendants[pageId] | 
					
						
							|  |  |  |     const descendantsIds = Array.from(currentWithChildrenAndDescendants.descendants) | 
					
						
							|  |  |  |     const childrenIds = Array.from(currentWithChildrenAndDescendants.children) | 
					
						
							|  |  |  |     let newDataList = [] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (current.expand) { | 
					
						
							|  |  |  |       current.expand = false | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       newDataList = [...dataList.filter(item => !descendantsIds.includes(item.page_id))] | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							|  |  |  |       current.expand = true | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       newDataList = [ | 
					
						
							|  |  |  |         ...dataList.slice(0, index + 1), | 
					
						
							|  |  |  |         ...childrenIds.map(item => ({ | 
					
						
							|  |  |  |           ...pagesMap[item], | 
					
						
							|  |  |  |           expand: false, | 
					
						
							| 
									
										
										
										
											2024-09-08 12:14:11 +07:00
										 |  |  |           depth: listMapWithChildrenAndDescendants[item].depth, | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |         })), | 
					
						
							|  |  |  |         ...dataList.slice(index + 1)] | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     setDataList(newDataList) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-28 10:53:45 +08:00
										 |  |  |   const copyValue = new Set([...value]) | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |   const handleCheck = (index: number) => { | 
					
						
							|  |  |  |     const current = currentDataList[index] | 
					
						
							|  |  |  |     const pageId = current.page_id | 
					
						
							|  |  |  |     const currentWithChildrenAndDescendants = listMapWithChildrenAndDescendants[pageId] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-28 10:53:45 +08:00
										 |  |  |     if (copyValue.has(pageId)) { | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |       if (!searchValue) { | 
					
						
							|  |  |  |         for (const item of currentWithChildrenAndDescendants.descendants) | 
					
						
							| 
									
										
										
										
											2023-08-28 10:53:45 +08:00
										 |  |  |           copyValue.delete(item) | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-28 10:53:45 +08:00
										 |  |  |       copyValue.delete(pageId) | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							|  |  |  |       if (!searchValue) { | 
					
						
							|  |  |  |         for (const item of currentWithChildrenAndDescendants.descendants) | 
					
						
							| 
									
										
										
										
											2023-08-28 10:53:45 +08:00
										 |  |  |           copyValue.add(item) | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-28 10:53:45 +08:00
										 |  |  |       copyValue.add(pageId) | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-28 10:53:45 +08:00
										 |  |  |     onSelect(new Set([...copyValue])) | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   const handlePreview = (index: number) => { | 
					
						
							|  |  |  |     const current = currentDataList[index] | 
					
						
							|  |  |  |     const pageId = current.page_id | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     setLocalPreviewPageId(pageId) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (onPreview) | 
					
						
							|  |  |  |       onPreview(pageId) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (!currentDataList.length) { | 
					
						
							|  |  |  |     return ( | 
					
						
							| 
									
										
										
										
											2025-03-21 17:41:03 +08:00
										 |  |  |       <div className='flex h-[296px] items-center justify-center text-[13px] text-text-tertiary'> | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |         {t('common.dataSource.notion.selector.noSearchResult')} | 
					
						
							|  |  |  |       </div> | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return ( | 
					
						
							|  |  |  |     <List | 
					
						
							|  |  |  |       className='py-2' | 
					
						
							|  |  |  |       height={296} | 
					
						
							|  |  |  |       itemCount={currentDataList.length} | 
					
						
							|  |  |  |       itemSize={28} | 
					
						
							|  |  |  |       width='100%' | 
					
						
							|  |  |  |       itemKey={(index, data) => data.dataList[index].page_id} | 
					
						
							|  |  |  |       itemData={{ | 
					
						
							|  |  |  |         dataList: currentDataList, | 
					
						
							|  |  |  |         handleToggle, | 
					
						
							|  |  |  |         checkedIds: value, | 
					
						
							| 
									
										
										
										
											2024-06-20 15:48:38 +08:00
										 |  |  |         disabledCheckedIds: disabledValue, | 
					
						
							| 
									
										
										
										
											2023-06-16 21:47:51 +08:00
										 |  |  |         handleCheck, | 
					
						
							|  |  |  |         canPreview, | 
					
						
							|  |  |  |         handlePreview, | 
					
						
							|  |  |  |         listMapWithChildrenAndDescendants, | 
					
						
							|  |  |  |         searchValue, | 
					
						
							|  |  |  |         previewPageId: currentPreviewPageId, | 
					
						
							|  |  |  |         pagesMap, | 
					
						
							|  |  |  |       }} | 
					
						
							|  |  |  |     > | 
					
						
							|  |  |  |       {Item} | 
					
						
							|  |  |  |     </List> | 
					
						
							|  |  |  |   ) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default PageSelector |