diff --git a/comps/custom/Popover.tsx b/comps/custom/Popover.tsx
index 83cd09f..6607642 100755
--- a/comps/custom/Popover.tsx
+++ b/comps/custom/Popover.tsx
@@ -192,13 +192,12 @@ export function Popover({
const popover = usePopover({ modal, ...restOptions });
let _content = content;
- console.log(!content)
if (!content) _content =
;
-console.log(typeof restOptions.open)
return (
{
diff --git a/comps/form/field/Field.tsx b/comps/form/field/Field.tsx
index 391dee4..861085a 100755
--- a/comps/form/field/Field.tsx
+++ b/comps/form/field/Field.tsx
@@ -25,6 +25,11 @@ export const Field: FC = (arg) => {
) {
validate(field, fm);
}
+
+ if (arg.on_change) {
+ arg.on_change({ value: fm.data[name], name, fm });
+ }
+
fm.events.on_change(name, fm.data[name]);
fm.render();
}
diff --git a/comps/form/typings.ts b/comps/form/typings.ts
index 34db193..e3344b0 100755
--- a/comps/form/typings.ts
+++ b/comps/form/typings.ts
@@ -62,7 +62,11 @@ export type FieldProp = {
required: ("y" | "n") | (() => "y" | "n");
field_ref?: (ref: any) => void;
required_msg: (name: string) => string | ReactElement;
- on_change: (arg: { value: any }) => void | Promise;
+ on_change: (arg: {
+ value: any;
+ name: string;
+ fm: any;
+ }) => void | Promise;
PassProp: any;
disabled: ("y" | "n") | (() => true | false);
child: any;
diff --git a/preset/menu/Layout.tsx b/preset/menu/Layout.tsx
index bffaa29..351eab2 100755
--- a/preset/menu/Layout.tsx
+++ b/preset/menu/Layout.tsx
@@ -44,7 +44,7 @@ type LYTChild = {
};
export const Layout: FC = (props) => {
- const local = useLocal({ loading: false });
+ const local = useLocal({ loading: false, current_menu: "" });
const render = local.render;
useLayoutEffect(() => {
if (!isEditor) {
@@ -174,6 +174,8 @@ export const Layout: FC = (props) => {
local.render();
});
}}
+ layout={local}
+ current_menu={local.current_menu}
>
{props.default_layout}
diff --git a/preset/menu/Menu.tsx b/preset/menu/Menu.tsx
index 915de18..2a7c87c 100755
--- a/preset/menu/Menu.tsx
+++ b/preset/menu/Menu.tsx
@@ -52,6 +52,12 @@ export const Menu: FC = (props) => {
pm={props}
depth={0}
mode={local.mode}
+ activate={(label) => {
+ if (typeof props.layout !== "undefined") {
+ props.layout.current_menu = label;
+ props.layout.render();
+ }
+ }}
/>
@@ -72,9 +78,10 @@ export const SideBar: FC<{
depth: number;
pm: MenuProp;
mode: "full" | "mini";
+ activate: (label: string) => void;
expanded?: boolean;
parent?: string;
-}> = ({ data: _data, local, depth, pm, mode, expanded, parent }) => {
+}> = ({ data: _data, local, depth, pm, mode, expanded, parent, activate }) => {
const PassProp = pm.PassProp;
w.prasi_menu = {
...w.prasi_menu,
@@ -93,6 +100,7 @@ export const SideBar: FC<{
let should_render = false;
if (local.active !== menu.hash && !local.loading) {
local.active = menu.hash;
+ activate(menu.label);
should_render = true;
}
if (!local.open.has(menu.hash)) {
@@ -159,11 +167,12 @@ export const SideBar: FC<{
local.open.delete(hashMenu(e));
});
}
- }
+ }
local.loading = true;
if (typeof menu.value === "string") {
local.active = menu.hash;
+
clearTimeout(local.nav_timeout);
local.nav_timeout = setTimeout(() => {
if (
@@ -182,6 +191,7 @@ export const SideBar: FC<{
!Array.isArray(menu.value) &&
typeof menu.value === "string"
) {
+ activate(menu.label);
if (pm.on_load) {
if (preloaded(menu.value)) {
pm.on_load((exec) => {
@@ -222,6 +232,7 @@ export const SideBar: FC<{
void };
on_load?: (on_done: (exec: () => void) => void) => void;
get_menu?: (mn: Array>) => Array>
};