diff --git a/comps/ui/alert-dialog.tsx b/comps/ui/alert-dialog.tsx new file mode 100755 index 0000000..eb2c28f --- /dev/null +++ b/comps/ui/alert-dialog.tsx @@ -0,0 +1,139 @@ +import * as React from "react" +import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog" + +import { cn } from "@/utils" +import { buttonVariants } from "@/comps//ui/button" + +const AlertDialog = AlertDialogPrimitive.Root + +const AlertDialogTrigger = AlertDialogPrimitive.Trigger + +const AlertDialogPortal = AlertDialogPrimitive.Portal + +const AlertDialogOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName + +const AlertDialogContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + + + + +)) +AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName + +const AlertDialogHeader = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +AlertDialogHeader.displayName = "AlertDialogHeader" + +const AlertDialogFooter = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +AlertDialogFooter.displayName = "AlertDialogFooter" + +const AlertDialogTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName + +const AlertDialogDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogDescription.displayName = + AlertDialogPrimitive.Description.displayName + +const AlertDialogAction = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName + +const AlertDialogCancel = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName + +export { + AlertDialog, + AlertDialogPortal, + AlertDialogOverlay, + AlertDialogTrigger, + AlertDialogContent, + AlertDialogHeader, + AlertDialogFooter, + AlertDialogTitle, + AlertDialogDescription, + AlertDialogAction, + AlertDialogCancel, +} diff --git a/preset/menu/Layout.tsx b/preset/menu/Layout.tsx index 0a3d0ef..b4cdb60 100755 --- a/preset/menu/Layout.tsx +++ b/preset/menu/Layout.tsx @@ -117,6 +117,8 @@ export const Layout: FC = (props) => { w.prasi_menu.nav(_href); } else if (w.prasi_menu.pm?.on_load) { let done = { exec: () => {} }; + local.loading = true; + local.render(); w.prasi_menu.pm?.on_load((exec: any) => { done.exec = exec; }); @@ -143,6 +145,8 @@ export const Layout: FC = (props) => { if (!w.user) { local.loading = true; loadSession(props.login_url || "/auth/login"); + + local.loading = false; } } @@ -157,8 +161,6 @@ export const Layout: FC = (props) => {
); - } else { - local.loading = false; } return ( @@ -173,6 +175,7 @@ export const Layout: FC = (props) => { }); }} > + {JSON.stringify(local.loading)} {props.default_layout} ); diff --git a/preset/menu/Menu.tsx b/preset/menu/Menu.tsx index 754bcce..915de18 100755 --- a/preset/menu/Menu.tsx +++ b/preset/menu/Menu.tsx @@ -78,8 +78,8 @@ export const SideBar: FC<{ const PassProp = pm.PassProp; w.prasi_menu = { ...w.prasi_menu, - pm - } + pm, + }; const data: IMenu[] = (typeof _data[0] === "string" ? [_data] : _data) as any; useEffect(() => { data.map((item) => { @@ -159,7 +159,7 @@ export const SideBar: FC<{ local.open.delete(hashMenu(e)); }); } - } + } local.loading = true; if (typeof menu.value === "string") {