mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
App run node update (#2542)
* feat(workflow): allow apps to be invoked like plugins (#2521) * feat(workflow): allow apps to be invoked like plugins * fix type * Encapsulate SSE response methods (#2530) * perf: sse response fn * perf: sse response * fix: ts * perf: not ssl copy * perf: myselect auto scroll * perf: run app code * fix: app plugin (#2538) --------- Co-authored-by: heheer <heheer@sealos.io>
This commit is contained in:
@@ -50,6 +50,9 @@ const MySelect = <T = any,>(
|
||||
}>
|
||||
) => {
|
||||
const ButtonRef = useRef<HTMLButtonElement>(null);
|
||||
const MenuListRef = useRef<HTMLDivElement>(null);
|
||||
const SelectedItemRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const menuItemStyles: MenuItemProps = {
|
||||
borderRadius: 'sm',
|
||||
py: 2,
|
||||
@@ -71,6 +74,14 @@ const MySelect = <T = any,>(
|
||||
}
|
||||
}));
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpen && MenuListRef.current && SelectedItemRef.current) {
|
||||
const menu = MenuListRef.current;
|
||||
const selectedItem = SelectedItemRef.current;
|
||||
menu.scrollTop = selectedItem.offsetTop - menu.offsetTop - 100;
|
||||
}
|
||||
}, [isOpen]);
|
||||
|
||||
return (
|
||||
<Box
|
||||
css={css({
|
||||
@@ -113,6 +124,7 @@ const MySelect = <T = any,>(
|
||||
</MenuButton>
|
||||
|
||||
<MenuList
|
||||
ref={MenuListRef}
|
||||
className={props.className}
|
||||
minW={(() => {
|
||||
const w = ButtonRef.current?.clientWidth;
|
||||
@@ -140,6 +152,7 @@ const MySelect = <T = any,>(
|
||||
{...menuItemStyles}
|
||||
{...(value === item.value
|
||||
? {
|
||||
ref: SelectedItemRef,
|
||||
color: 'primary.600',
|
||||
bg: 'myGray.100'
|
||||
}
|
||||
|
Reference in New Issue
Block a user