+
+
+ {isMobile && (
+
+ (
+ {menu}
+ {rightOptions && (
+ {rightOptions}
+
)}
+
)}
+ menu={{
+ selectedKeys: [name], items: [indexNav, ...Array.from(mapping.entries())
+ .filter(([name, {permission}]) => {
+ if (typeof permission === "string") {
+ return permissions.indexOf(permission) > -1;
+ }
+ if (typeof permission === "function") {
+ return permission(permissions);
+ }
+ if (Array.isArray(permission)) {
+ for (let item of permission) {
+ if (permissions.indexOf(item) > -1) {
+ return true;
+ }
+ }
+ return false;
+ }
+ return true;
+ })
+ .map(([name, {title, icon, path, permission}]) => {
+ const _path = typeof path === "function" ? path(permission, permissions) : path;
+ return {
+ label: icon ?
+ {icon}
+ {title}
+ : title,
+ key: name,
+ onClick: () => handleMobileMenuClick(_path),
+ };
+ })],
+ }}
+ >
+
+
+
+
+ )}
+ {!isMobile && (
+
+ )}
+ {!isMobile && (
+ {
+ setReady(true);
+ }}
+ />
+
-
+ return true;
+ })
+ .map(([name, {title, icon, path, permission}]) => {
+ const _path = typeof path === "function" ? path(permission, permissions) : path;
+ return {
+ label: icon ?
+ {icon}
+ {title}
+ : title, key: name, onClick: () => {
+ onChange && onChange(_path);
+ setTimeout(() => {
+ navigate(_path);
+ }, 0);
+ },
+ };
+ }),]}
+ />
+ )}
+ {isMobile && (
+ {defaultTitle || formatMessage({id: 'defaultTitle'})}
+ )}
+ {!isMobile &&
{rightOptions}}
+
+
+