-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
150 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/frontend/src/components/bs-comp/sheets/TaggingSheet.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { | ||
Sheet, | ||
SheetContent, | ||
SheetTitle, | ||
SheetTrigger, | ||
} from "../../bs-ui/sheet"; | ||
import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd'; | ||
|
||
export default function TaggingSheet({children}) { | ||
const buttons = [ | ||
{id:'01',name:'Button01'}, | ||
{id:'02',name:'Button02'}, | ||
{id:'03',name:'Button03'}, | ||
] | ||
|
||
return <Sheet> | ||
<SheetTrigger asChild>{children}</SheetTrigger> | ||
<SheetContent className="bg-gray-100 sm:min-w-[800px]"> | ||
<SheetTitle>给助手打标签</SheetTitle> | ||
<div className="w-full h-full grid grid-cols-[80%,20%]"> | ||
<div className="bg-slate-500"> | ||
|
||
</div> | ||
<div className="bg-slate-300"> | ||
<DragDropContext onDragEnd={() => console.log('-------------')}> | ||
<Droppable droppableId={'list'}> | ||
{(provided) => ( | ||
<div {...provided.droppableProps} ref={provided.innerRef}> | ||
{buttons.map((b,index) => ( | ||
<Draggable key={'drag' + b.id} draggableId={'drag' + b.id} index={index}> | ||
{(provided) => ( | ||
<div ref={provided.innerRef} {...provided.draggableProps} | ||
{...provided.dragHandleProps}> | ||
{b.name} | ||
</div> | ||
)} | ||
</Draggable> | ||
))} | ||
</div> | ||
)} | ||
</Droppable> | ||
</DragDropContext> | ||
</div> | ||
</div> | ||
</SheetContent> | ||
</Sheet> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React, { ChangeEvent } from "react" | ||
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/bs-ui/select"; | ||
import { SearchInput } from "../input"; | ||
|
||
interface SelectSearchProps { | ||
value: string, | ||
options: {label: string, value: string}[], | ||
selectPlaceholder?:string, | ||
inputPlaceholder?:string, | ||
onOpenChange?: (open:boolean) => void, | ||
onValueChange: (value: string) => void, | ||
onChange: (e:ChangeEvent<HTMLInputElement>) => void, | ||
selectClass?: string, | ||
contentClass?: string | ||
} | ||
|
||
const SelectSearch: React.FC<SelectSearchProps> = ({ | ||
value, | ||
options, | ||
selectPlaceholder = '', | ||
inputPlaceholder = '', | ||
onOpenChange, | ||
onValueChange, | ||
onChange, | ||
selectClass = '', | ||
contentClass = '' | ||
}) => { | ||
return <Select value={value} onOpenChange={(open) => onOpenChange?.(open)} onValueChange={(v) => onValueChange(v)}> | ||
<SelectTrigger className={selectClass}> | ||
<SelectValue placeholder={selectPlaceholder}/> | ||
</SelectTrigger> | ||
<SelectContent className={contentClass}> | ||
<SearchInput inputClassName="h-8 mb-2" placeholder={inputPlaceholder} | ||
onChange={(e) => onChange(e)} onKeyDown={e => e.stopPropagation()} iconClassName="w-4 h-4" /> | ||
<SelectGroup> | ||
{options.map(el => ( | ||
<SelectItem key={el.value} value={el.value}>{el.label}</SelectItem> | ||
))} | ||
</SelectGroup> | ||
</SelectContent> | ||
</Select> | ||
} | ||
|
||
export default React.memo(SelectSearch) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters