@plasmicpkgs/plasmic-rich-components 1.0.160 → 1.0.161
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1037,14 +1037,36 @@ function RichLayout(_a) {
|
|
|
1037
1037
|
"logoElement"
|
|
1038
1038
|
]);
|
|
1039
1039
|
var _a2, _b2, _c, _d, _e;
|
|
1040
|
+
const $ctx = host.useDataEnv();
|
|
1041
|
+
const ref = React.useRef(null);
|
|
1040
1042
|
const isClient = useIsClient();
|
|
1041
1043
|
const [pathname, setPathname] = React.useState(void 0);
|
|
1044
|
+
const [openKeys, setOpenKeys] = React.useState([]);
|
|
1045
|
+
const [ready, setReady] = React.useState(false);
|
|
1042
1046
|
React.useEffect(() => {
|
|
1047
|
+
setTimeout(() => {
|
|
1048
|
+
setReady(true);
|
|
1049
|
+
}, 500);
|
|
1043
1050
|
if (typeof location !== "undefined") {
|
|
1044
1051
|
setPathname(location.pathname);
|
|
1045
1052
|
}
|
|
1046
1053
|
}, []);
|
|
1047
|
-
|
|
1054
|
+
React.useEffect(() => {
|
|
1055
|
+
if (!ready)
|
|
1056
|
+
return;
|
|
1057
|
+
if (!ref.current)
|
|
1058
|
+
return;
|
|
1059
|
+
const selectedSubmenus = Array.from(
|
|
1060
|
+
ref.current.querySelectorAll(
|
|
1061
|
+
"ul > li.ant-menu-submenu.ant-menu-submenu-selected > div"
|
|
1062
|
+
)
|
|
1063
|
+
).map((el) => {
|
|
1064
|
+
var _a3;
|
|
1065
|
+
return (_a3 = el.getAttribute("data-menu-id")) == null ? void 0 : _a3.split("/").pop();
|
|
1066
|
+
}).filter((i) => i).map((i) => `/${i}`) || [];
|
|
1067
|
+
setOpenKeys(selectedSubmenus);
|
|
1068
|
+
}, [ready]);
|
|
1069
|
+
const PlasmicLink = (_b2 = (_a2 = host.usePlasmicLink) == null ? void 0 : _a2()) != null ? _b2 : AnchorLink;
|
|
1048
1070
|
const { token } = antd.theme.useToken();
|
|
1049
1071
|
const origTextColor = token.colorTextBase;
|
|
1050
1072
|
function getNavBgColor() {
|
|
@@ -1089,7 +1111,7 @@ function RichLayout(_a) {
|
|
|
1089
1111
|
colorTextMenuActive: "rgba(255,255,255,0.95)",
|
|
1090
1112
|
colorTextSubMenuSelected: "#fff"
|
|
1091
1113
|
};
|
|
1092
|
-
return /* @__PURE__ */ React__default.default.createElement("div", { className, style: { display: "flex" } }, /* @__PURE__ */ React__default.default.createElement("style", null, baseStyles), /* @__PURE__ */ React__default.default.createElement(
|
|
1114
|
+
return /* @__PURE__ */ React__default.default.createElement("div", { ref, className, style: { display: "flex" } }, /* @__PURE__ */ React__default.default.createElement("style", null, baseStyles), /* @__PURE__ */ React__default.default.createElement(
|
|
1093
1115
|
proComponents.ProLayout,
|
|
1094
1116
|
__spreadProps$5(__spreadValues$8({}, layoutProps), {
|
|
1095
1117
|
pageTitleRender: () => "",
|
|
@@ -1131,7 +1153,7 @@ function RichLayout(_a) {
|
|
|
1131
1153
|
},
|
|
1132
1154
|
menu: {
|
|
1133
1155
|
// collapsedShowGroupTitle: true,
|
|
1134
|
-
defaultOpenAll:
|
|
1156
|
+
defaultOpenAll: false
|
|
1135
1157
|
// hideMenuWhenCollapsed: true,
|
|
1136
1158
|
},
|
|
1137
1159
|
avatarProps: showAvatarMenu ? {
|
|
@@ -1165,9 +1187,12 @@ function RichLayout(_a) {
|
|
|
1165
1187
|
return footerChildren;
|
|
1166
1188
|
},
|
|
1167
1189
|
onMenuHeaderClick: (e) => console.log(e),
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1190
|
+
openKeys,
|
|
1191
|
+
onOpenChange: (keys) => keys === false || !ready ? [] : setOpenKeys(keys),
|
|
1192
|
+
selectedKeys: [$ctx == null ? void 0 : $ctx.pagePath],
|
|
1193
|
+
menuItemRender: (item, dom) => /* @__PURE__ */ React__default.default.createElement(PlasmicLink, { href: item.path }, dom),
|
|
1194
|
+
headerTitleRender: (logoEl, title, _) => {
|
|
1195
|
+
return /* @__PURE__ */ React__default.default.createElement(PlasmicLink, { href: rootUrl }, logoEl, title);
|
|
1171
1196
|
}
|
|
1172
1197
|
}),
|
|
1173
1198
|
children
|