|
|
|
|
@ -22,11 +22,13 @@ import {
|
|
|
|
|
PortalToFollowElemTrigger,
|
|
|
|
|
} from '@/app/components/base/portal-to-follow-elem'
|
|
|
|
|
import Input from '@/app/components/base/input'
|
|
|
|
|
import SearchBox from '@/app/components/plugins/marketplace/search-box'
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
Plus02,
|
|
|
|
|
} from '@/app/components/base/icons/src/vender/line/general'
|
|
|
|
|
|
|
|
|
|
interface NodeSelectorProps {
|
|
|
|
|
type NodeSelectorProps = {
|
|
|
|
|
open?: boolean
|
|
|
|
|
onOpenChange?: (open: boolean) => void
|
|
|
|
|
onSelect: OnSelectBlock
|
|
|
|
|
@ -60,6 +62,7 @@ const NodeSelector: FC<NodeSelectorProps> = ({
|
|
|
|
|
}) => {
|
|
|
|
|
const { t } = useTranslation()
|
|
|
|
|
const [searchText, setSearchText] = useState('')
|
|
|
|
|
const [tags, setTags] = useState<string[]>([])
|
|
|
|
|
const [localOpen, setLocalOpen] = useState(false)
|
|
|
|
|
const open = openFromProps === undefined ? localOpen : openFromProps
|
|
|
|
|
const handleOpenChange = useCallback((newOpen: boolean) => {
|
|
|
|
|
@ -127,15 +130,28 @@ const NodeSelector: FC<NodeSelectorProps> = ({
|
|
|
|
|
<PortalToFollowElemContent className='z-[1000]'>
|
|
|
|
|
<div className={`rounded-lg border-[0.5px] border-gray-200 bg-white shadow-lg ${popupClassName}`}>
|
|
|
|
|
<div className='px-2 pt-2' onClick={e => e.stopPropagation()}>
|
|
|
|
|
<Input
|
|
|
|
|
showLeftIcon
|
|
|
|
|
showClearIcon
|
|
|
|
|
autoFocus
|
|
|
|
|
value={searchText}
|
|
|
|
|
placeholder={searchPlaceholder}
|
|
|
|
|
onChange={e => setSearchText(e.target.value)}
|
|
|
|
|
onClear={() => setSearchText('')}
|
|
|
|
|
/>
|
|
|
|
|
{activeTab === TabsEnum.Blocks && (
|
|
|
|
|
<Input
|
|
|
|
|
showLeftIcon
|
|
|
|
|
showClearIcon
|
|
|
|
|
autoFocus
|
|
|
|
|
value={searchText}
|
|
|
|
|
placeholder={searchPlaceholder}
|
|
|
|
|
onChange={e => setSearchText(e.target.value)}
|
|
|
|
|
onClear={() => setSearchText('')}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
{activeTab === TabsEnum.Tools && (
|
|
|
|
|
<SearchBox
|
|
|
|
|
search={searchText}
|
|
|
|
|
onSearchChange={setSearchText}
|
|
|
|
|
tags={tags}
|
|
|
|
|
onTagsChange={setTags}
|
|
|
|
|
size='small'
|
|
|
|
|
placeholder={t('plugin.searchTools')!}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<Tabs
|
|
|
|
|
activeTab={activeTab}
|
|
|
|
|
|