@gx-design-vue/pro-layout 0.1.0-alpha.2 → 0.1.0-alpha.21

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.
Files changed (272) hide show
  1. package/dist/ProLayout.d.ts +4 -536
  2. package/dist/ProLayout.js +489 -358
  3. package/dist/components/AppPage/context.d.ts +4 -3
  4. package/dist/components/AppPage/context.js +3 -5
  5. package/dist/components/AppPage/index.d.ts +29 -52
  6. package/dist/components/AppPage/index.js +71 -54
  7. package/dist/components/AppPage/style.d.ts +8 -7
  8. package/dist/components/AppPage/style.js +16 -17
  9. package/dist/components/Breadcrumb/index.d.ts +19 -0
  10. package/dist/components/Breadcrumb/index.js +129 -0
  11. package/dist/components/Breadcrumb/interface.d.ts +33 -0
  12. package/dist/components/Breadcrumb/interface.js +1 -0
  13. package/dist/components/CollapseButton/Arrow.d.ts +4 -0
  14. package/dist/components/{SiderMenu → CollapseButton}/Arrow.js +2 -4
  15. package/dist/components/CollapseButton/index.d.ts +7 -0
  16. package/dist/components/CollapseButton/index.js +45 -0
  17. package/dist/components/CollapseButton/interface.d.ts +19 -0
  18. package/dist/components/CollapseButton/interface.js +1 -0
  19. package/dist/components/Footer/index.d.ts +10 -0
  20. package/dist/components/Footer/index.js +69 -0
  21. package/dist/components/Footer/interface.d.ts +22 -0
  22. package/dist/components/Footer/interface.js +1 -0
  23. package/dist/components/FooterToolbar/index.d.ts +5 -72
  24. package/dist/components/FooterToolbar/index.js +77 -90
  25. package/dist/components/FooterToolbar/style.d.ts +10 -0
  26. package/dist/components/FooterToolbar/style.js +34 -0
  27. package/dist/components/Header/index.d.ts +7 -0
  28. package/dist/components/Header/index.js +140 -0
  29. package/dist/components/Header/interface.d.ts +41 -0
  30. package/dist/components/Header/interface.js +1 -0
  31. package/dist/components/Logo/index.d.ts +9 -0
  32. package/dist/components/Logo/index.js +63 -0
  33. package/dist/components/Logo/interface.d.ts +13 -0
  34. package/dist/components/Logo/interface.js +1 -0
  35. package/dist/components/Menu/iconRender.d.ts +10 -0
  36. package/dist/components/Menu/iconRender.js +23 -0
  37. package/dist/components/Menu/index.d.ts +13 -0
  38. package/dist/components/Menu/index.js +778 -0
  39. package/dist/components/Menu/interface.d.ts +50 -0
  40. package/dist/components/Menu/interface.js +9 -0
  41. package/dist/components/Menu/overflow.d.ts +39 -0
  42. package/dist/components/Menu/overflow.js +81 -0
  43. package/dist/components/Menu/style/base.d.ts +12 -0
  44. package/dist/components/Menu/style/base.js +36 -0
  45. package/dist/components/Menu/style/horizontal.d.ts +19 -0
  46. package/dist/components/Menu/style/horizontal.js +303 -0
  47. package/dist/components/Menu/style/index.d.ts +356 -0
  48. package/dist/components/Menu/style/index.js +147 -0
  49. package/dist/components/Menu/style/inline.d.ts +13 -0
  50. package/dist/components/Menu/style/inline.js +292 -0
  51. package/dist/components/PageContainer/PageHeader.d.ts +30 -36
  52. package/dist/components/PageContainer/PageHeader.js +80 -46
  53. package/dist/components/PageContainer/index.d.ts +8 -194
  54. package/dist/components/PageContainer/index.js +297 -209
  55. package/dist/components/PageContainer/style.d.ts +5 -0
  56. package/dist/components/PageContainer/style.js +142 -0
  57. package/dist/components/PageTransition/animate.d.ts +41 -0
  58. package/dist/components/PageTransition/animate.js +106 -0
  59. package/dist/components/PageTransition/index.d.ts +57 -0
  60. package/dist/components/PageTransition/index.js +66 -0
  61. package/dist/components/{PageTranstion → PageTransition}/keyFrame/back.d.ts +4 -4
  62. package/dist/components/{PageTranstion → PageTransition}/keyFrame/back.js +2 -4
  63. package/dist/components/{PageTranstion → PageTransition}/keyFrame/bounce.d.ts +4 -4
  64. package/dist/components/{PageTranstion → PageTransition}/keyFrame/bounce.js +2 -4
  65. package/dist/components/{PageTranstion → PageTransition}/keyFrame/fade.d.ts +4 -4
  66. package/dist/components/{PageTranstion → PageTransition}/keyFrame/fade.js +2 -4
  67. package/dist/components/{PageTranstion → PageTransition}/keyFrame/flip.d.ts +4 -4
  68. package/dist/components/{PageTranstion → PageTransition}/keyFrame/flip.js +2 -4
  69. package/dist/components/{PageTranstion → PageTransition}/keyFrame/lightSpeed.d.ts +4 -4
  70. package/dist/components/{PageTranstion → PageTransition}/keyFrame/lightSpeed.js +2 -4
  71. package/dist/components/PageTransition/keyFrame/roll.d.ts +10 -0
  72. package/dist/components/{PageTranstion → PageTransition}/keyFrame/roll.js +2 -4
  73. package/dist/components/{PageTranstion → PageTransition}/keyFrame/rotate.d.ts +4 -4
  74. package/dist/components/{PageTranstion → PageTransition}/keyFrame/rotate.js +2 -4
  75. package/dist/components/{PageTranstion → PageTransition}/keyFrame/slide.d.ts +4 -4
  76. package/dist/components/{PageTranstion → PageTransition}/keyFrame/slide.js +2 -4
  77. package/dist/components/{PageTranstion → PageTransition}/keyFrame/zoom.d.ts +4 -4
  78. package/dist/components/{PageTranstion → PageTransition}/keyFrame/zoom.js +2 -4
  79. package/dist/components/PageTransition/style.d.ts +11 -0
  80. package/dist/components/{PageTranstion → PageTransition}/style.js +9 -13
  81. package/dist/components/Sider/index.d.ts +7 -0
  82. package/dist/components/Sider/index.js +206 -0
  83. package/dist/components/Sider/interface.d.ts +39 -0
  84. package/dist/components/Sider/interface.js +1 -0
  85. package/dist/components/Tabs/InnerTabs.d.ts +7 -0
  86. package/dist/components/Tabs/InnerTabs.js +117 -0
  87. package/dist/components/Tabs/contextMenu.d.ts +41 -0
  88. package/dist/components/Tabs/contextMenu.js +89 -0
  89. package/dist/components/Tabs/hooks/flipAnimate.d.ts +24 -0
  90. package/dist/components/Tabs/hooks/flipAnimate.js +40 -0
  91. package/dist/components/Tabs/hooks/useAutoScroll.d.ts +27 -0
  92. package/dist/components/Tabs/hooks/useAutoScroll.js +122 -0
  93. package/dist/components/Tabs/hooks/useTabDrag.d.ts +31 -0
  94. package/dist/components/Tabs/hooks/useTabDrag.js +252 -0
  95. package/dist/components/Tabs/index.d.ts +13 -0
  96. package/dist/components/Tabs/index.js +181 -0
  97. package/dist/components/Tabs/interface.d.ts +74 -0
  98. package/dist/components/Tabs/interface.js +1 -0
  99. package/dist/components/Tabs/style/index.d.ts +35 -0
  100. package/dist/components/Tabs/style/index.js +161 -0
  101. package/dist/components/WrapContent/index.d.ts +9 -0
  102. package/dist/components/WrapContent/index.js +26 -0
  103. package/dist/components/WrapContent/interface.d.ts +15 -0
  104. package/dist/components/WrapContent/interface.js +1 -0
  105. package/dist/context/index.d.ts +53 -0
  106. package/dist/context/index.js +5 -0
  107. package/dist/defaultConfig.d.ts +10 -0
  108. package/dist/defaultConfig.js +38 -0
  109. package/dist/hooks/useLayoutBase.d.ts +78 -0
  110. package/dist/hooks/useLayoutBase.js +86 -0
  111. package/dist/hooks/useMenu.d.ts +77 -0
  112. package/dist/hooks/useMenu.js +166 -0
  113. package/dist/hooks/useTabs.d.ts +54 -0
  114. package/dist/hooks/useTabs.js +388 -0
  115. package/dist/index.d.ts +22 -27
  116. package/dist/index.js +15 -24
  117. package/dist/interface.d.ts +516 -0
  118. package/dist/interface.js +34 -0
  119. package/dist/pro-layout.esm.js +5848 -5075
  120. package/dist/pro-layout.js +16 -37
  121. package/dist/style/breadcrumb.d.ts +8 -0
  122. package/dist/style/breadcrumb.js +77 -0
  123. package/dist/style/collapseButton.d.ts +8 -0
  124. package/dist/style/collapseButton.js +57 -0
  125. package/dist/style/content.d.ts +8 -0
  126. package/dist/style/content.js +29 -0
  127. package/dist/style/footer.d.ts +8 -0
  128. package/dist/style/footer.js +33 -0
  129. package/dist/style/header.d.ts +8 -0
  130. package/dist/style/header.js +76 -0
  131. package/dist/style/index.d.ts +3 -22
  132. package/dist/style/index.js +51 -55
  133. package/dist/style/logo.d.ts +8 -0
  134. package/dist/style/logo.js +76 -0
  135. package/dist/style/menu.d.ts +15 -0
  136. package/dist/style/menu.js +49 -0
  137. package/dist/style/rightContent.d.ts +12 -0
  138. package/dist/style/rightContent.js +74 -0
  139. package/dist/style/search.d.ts +12 -0
  140. package/dist/style/search.js +94 -0
  141. package/dist/style/sider.d.ts +8 -0
  142. package/dist/style/sider.js +92 -0
  143. package/dist/style/tabs.d.ts +14 -0
  144. package/dist/style/tabs.js +97 -0
  145. package/dist/theme/augment.d.ts +20 -0
  146. package/dist/theme/augment.js +1 -0
  147. package/dist/theme/interface/components.d.ts +20 -0
  148. package/dist/theme/interface/components.js +1 -0
  149. package/dist/utils/config.d.ts +12 -0
  150. package/dist/utils/config.js +18 -0
  151. package/dist/utils/menu.d.ts +111 -20
  152. package/dist/utils/menu.js +263 -118
  153. package/dist/utils/style.d.ts +4 -0
  154. package/dist/utils/style.js +21 -0
  155. package/dist/utils/themeComponents.d.ts +28 -0
  156. package/dist/utils/themeComponents.js +89 -0
  157. package/package.json +24 -15
  158. package/dist/Context/expose.d.ts +0 -6
  159. package/dist/Context/expose.js +0 -7
  160. package/dist/Context/index.d.ts +0 -43
  161. package/dist/Context/index.js +0 -18
  162. package/dist/WrapContent.d.ts +0 -100
  163. package/dist/WrapContent.js +0 -45
  164. package/dist/components/BaseMenu/index.d.ts +0 -255
  165. package/dist/components/BaseMenu/index.js +0 -381
  166. package/dist/components/BaseMenu/props.d.ts +0 -105
  167. package/dist/components/BaseMenu/props.js +0 -94
  168. package/dist/components/BaseMenu/style.d.ts +0 -6
  169. package/dist/components/BaseMenu/style.js +0 -155
  170. package/dist/components/BreadCrumb/Breadcrumb.d.ts +0 -33
  171. package/dist/components/BreadCrumb/Breadcrumb.js +0 -75
  172. package/dist/components/BreadCrumb/index.d.ts +0 -7
  173. package/dist/components/BreadCrumb/index.js +0 -44
  174. package/dist/components/BreadCrumb/style.d.ts +0 -8
  175. package/dist/components/BreadCrumb/style.js +0 -87
  176. package/dist/components/CollapsedIcon/index.d.ts +0 -33
  177. package/dist/components/CollapsedIcon/index.js +0 -51
  178. package/dist/components/CollapsedIcon/style.d.ts +0 -9
  179. package/dist/components/CollapsedIcon/style.js +0 -34
  180. package/dist/components/FooterToolbar/props.d.ts +0 -47
  181. package/dist/components/FooterToolbar/props.js +0 -33
  182. package/dist/components/FooterToolbar/style/index.d.ts +0 -14
  183. package/dist/components/FooterToolbar/style/index.js +0 -48
  184. package/dist/components/FooterToolbar/style/stylish.d.ts +0 -18
  185. package/dist/components/FooterToolbar/style/stylish.js +0 -16
  186. package/dist/components/GlobalFooter/index.d.ts +0 -73
  187. package/dist/components/GlobalFooter/index.js +0 -77
  188. package/dist/components/GlobalFooter/style.d.ts +0 -6
  189. package/dist/components/GlobalFooter/style.js +0 -29
  190. package/dist/components/GlobalHeader/DefaultHeader.d.ts +0 -164
  191. package/dist/components/GlobalHeader/DefaultHeader.js +0 -149
  192. package/dist/components/GlobalHeader/index.d.ts +0 -164
  193. package/dist/components/GlobalHeader/index.js +0 -78
  194. package/dist/components/GlobalHeader/props.d.ts +0 -70
  195. package/dist/components/GlobalHeader/props.js +0 -56
  196. package/dist/components/GlobalHeader/style/defaultHeader.d.ts +0 -6
  197. package/dist/components/GlobalHeader/style/defaultHeader.js +0 -108
  198. package/dist/components/GlobalHeader/style/header.d.ts +0 -6
  199. package/dist/components/GlobalHeader/style/header.js +0 -41
  200. package/dist/components/LogoContent/index.d.ts +0 -80
  201. package/dist/components/LogoContent/index.js +0 -90
  202. package/dist/components/LogoContent/props.d.ts +0 -57
  203. package/dist/components/LogoContent/props.js +0 -37
  204. package/dist/components/LogoContent/style.d.ts +0 -6
  205. package/dist/components/LogoContent/style.js +0 -63
  206. package/dist/components/PageContainer/props.d.ts +0 -138
  207. package/dist/components/PageContainer/props.js +0 -103
  208. package/dist/components/PageContainer/style/index.d.ts +0 -14
  209. package/dist/components/PageContainer/style/index.js +0 -52
  210. package/dist/components/PageContainer/style/pageHeader.d.ts +0 -6
  211. package/dist/components/PageContainer/style/pageHeader.js +0 -44
  212. package/dist/components/PageTranstion/index.d.ts +0 -40
  213. package/dist/components/PageTranstion/index.js +0 -71
  214. package/dist/components/PageTranstion/keyFrame/roll.d.ts +0 -10
  215. package/dist/components/PageTranstion/style.d.ts +0 -10
  216. package/dist/components/SiderMenu/Arrow.d.ts +0 -6
  217. package/dist/components/SiderMenu/SiderMenu.d.ts +0 -180
  218. package/dist/components/SiderMenu/SiderMenu.js +0 -265
  219. package/dist/components/SiderMenu/index.d.ts +0 -193
  220. package/dist/components/SiderMenu/index.js +0 -51
  221. package/dist/components/SiderMenu/props.d.ts +0 -77
  222. package/dist/components/SiderMenu/props.js +0 -67
  223. package/dist/components/SiderMenu/style/index.d.ts +0 -12
  224. package/dist/components/SiderMenu/style/index.js +0 -162
  225. package/dist/components/SiderMenu/typings.d.ts +0 -38
  226. package/dist/components/SiderMenu/typings.js +0 -1
  227. package/dist/components/TabsRoute/index.d.ts +0 -95
  228. package/dist/components/TabsRoute/index.js +0 -405
  229. package/dist/components/TabsRoute/props.d.ts +0 -78
  230. package/dist/components/TabsRoute/props.js +0 -47
  231. package/dist/components/TabsRoute/style.d.ts +0 -15
  232. package/dist/components/TabsRoute/style.js +0 -133
  233. package/dist/components/TabsRoute/utils/config.d.ts +0 -18
  234. package/dist/components/TabsRoute/utils/config.js +0 -64
  235. package/dist/config/animate.d.ts +0 -11
  236. package/dist/config/animate.js +0 -76
  237. package/dist/config/index.d.ts +0 -34
  238. package/dist/config/index.js +0 -30
  239. package/dist/hooks/collapsed/index.d.ts +0 -15
  240. package/dist/hooks/collapsed/index.js +0 -50
  241. package/dist/hooks/layout/useLayoutExpose.d.ts +0 -15
  242. package/dist/hooks/layout/useLayoutExpose.js +0 -22
  243. package/dist/hooks/layout/usePageContent.d.ts +0 -6
  244. package/dist/hooks/layout/usePageContent.js +0 -28
  245. package/dist/hooks/menu/context.d.ts +0 -21
  246. package/dist/hooks/menu/context.js +0 -7
  247. package/dist/hooks/menu/index.d.ts +0 -29
  248. package/dist/hooks/menu/index.js +0 -118
  249. package/dist/hooks/theme/index.d.ts +0 -11
  250. package/dist/hooks/theme/index.js +0 -13
  251. package/dist/props/collapsedProps.d.ts +0 -39
  252. package/dist/props/collapsedProps.js +0 -45
  253. package/dist/props/defaultSettings.d.ts +0 -62
  254. package/dist/props/defaultSettings.js +0 -56
  255. package/dist/props/index.d.ts +0 -226
  256. package/dist/props/index.js +0 -109
  257. package/dist/props/themeProps.d.ts +0 -14
  258. package/dist/props/themeProps.js +0 -10
  259. package/dist/types/Breadcrumb.d.ts +0 -22
  260. package/dist/types/Breadcrumb.js +0 -1
  261. package/dist/types/MenuTypings.d.ts +0 -46
  262. package/dist/types/MenuTypings.js +0 -1
  263. package/dist/types/RouteTypings.d.ts +0 -96
  264. package/dist/types/RouteTypings.js +0 -1
  265. package/dist/types/SlotsTypings.d.ts +0 -124
  266. package/dist/types/SlotsTypings.js +0 -32
  267. package/dist/types/typings.d.ts +0 -73
  268. package/dist/types/typings.js +0 -3
  269. package/dist/utils/index.d.ts +0 -7
  270. package/dist/utils/index.js +0 -17
  271. package/dist/utils/style/index.d.ts +0 -44
  272. package/dist/utils/style/index.js +0 -103
@@ -1,134 +1,279 @@
1
- import { omit } from "es-toolkit";
2
-
1
+ import { markRaw } from "vue";
2
+ import { isUrl } from "@gx-design-vue/pro-utils";
3
3
  //#region src/utils/menu.ts
4
- function handleMenuData(routes, { breadcrumb, parentRoute, menuMap, flatMenus }) {
5
- return routes.map((route, key) => {
6
- route.meta = route.meta || {};
7
- route.meta.order = route.meta.order ?? key + 1;
8
- route.key = parentRoute?.key ? `${parentRoute?.key}-${key}` : `${key}`;
9
- route.redirect = route.redirect ? route.redirect : route.children?.length ? getLastPath(route.children || []) : void 0;
10
- if (parentRoute?.meta?.hidden) route.meta.hidden = true;
11
- if (parentRoute?.meta?.hideChildren) route.meta.hidden = true;
12
- if (parentRoute?.meta?.hideInMenu) route.meta.hideInMenu = true;
13
- if (parentRoute?.meta?.hideChildrenInMenu) route.meta.hideInMenu = true;
14
- route.path = route.path.replace("//", "/");
15
- if (flatMenus.every((el) => el.name !== route.name)) flatMenus.push(route);
16
- if (!menuMap.has(route.name)) menuMap.set(route.name, omit(route, ["children"]));
17
- if (route.children && route.children.length > 0) route.children = handleMenuData(route.children, {
18
- breadcrumb,
19
- flatMenus,
20
- parentRoute: route,
21
- menuMap
22
- });
23
- breadcrumb[`${route.path}`] = route;
24
- return omit(route, ["component"]);
25
- }).sort((a, b) => {
26
- return (a.meta?.order || 0) - (b.meta?.order || 0) > 0 ? 1 : -1;
27
- });
4
+ /**
5
+ * vue-router 的扁平路由表中提取菜单数据源:取根路由(`name==='root'` 或 `path==='/'`)的子级。
6
+ * 替代旧 `getMenuData` 内的 `childrenRoute` 提取逻辑。
7
+ */
8
+ function routesToMenus(routerRoutes) {
9
+ const rootRoute = routerRoutes.find((route) => (route.name === "root" || route.path === "/") && (route.children?.length ?? 0) > 0);
10
+ return rootRoute?.children ? [...rootRoute.children] : [];
11
+ }
12
+ /**
13
+ * 清洗菜单树(不可变)。替代旧 `clearMenuItem` + `handleMenuData` 的隐藏继承块。
14
+ * - 丢弃无 `name` 的项;
15
+ * - 丢弃重复 `name`(保留首个,重复项汇总 `console.warn` 一次);
16
+ * - `meta.hideChildrenInMenu` 的节点剥掉 `children`;
17
+ * - `hideInMenu` 继承:父 `hideInMenu` / `hideChildrenInMenu` → 子项 `meta.hideInMenu = true`。
18
+ */
19
+ function cleanMenus(menus) {
20
+ const seenNames = /* @__PURE__ */ new Set();
21
+ const duplicateNames = [];
22
+ function walk(nodes, parentHidden) {
23
+ const result = [];
24
+ for (const node of nodes) {
25
+ if (!node.name) continue;
26
+ if (seenNames.has(node.name)) {
27
+ duplicateNames.push(node.name);
28
+ continue;
29
+ }
30
+ seenNames.add(node.name);
31
+ const inheritedHidden = parentHidden || !!node.meta?.hideInMenu;
32
+ const stripChildren = !!node.meta?.hideChildrenInMenu;
33
+ const childrenHidden = inheritedHidden || stripChildren;
34
+ const cleaned = {
35
+ ...node,
36
+ meta: {
37
+ ...node.meta,
38
+ hideInMenu: inheritedHidden
39
+ },
40
+ children: stripChildren || !node.children?.length ? void 0 : walk(node.children, childrenHidden)
41
+ };
42
+ result.push(cleaned);
43
+ }
44
+ return result;
45
+ }
46
+ const result = walk(menus, false);
47
+ if (duplicateNames.length > 0) console.warn("[pro-layout] 菜单存在重复或缺失的 name,已忽略:", duplicateNames);
48
+ return result;
49
+ }
50
+ /**
51
+ * 按 `meta.order` 升序排序(不可变、稳定)。替代旧 `handleMenuData` 的 order 兜底 + `.sort`。
52
+ * 缺省 order 使用原始索引,保证未配置 order 时维持原顺序。
53
+ */
54
+ function sortMenusByOrder(menus) {
55
+ return menus.map((menu, index) => ({
56
+ menu,
57
+ order: menu.meta?.order ?? index,
58
+ index
59
+ })).sort((a, b) => a.order - b.order || a.index - b.index).map(({ menu }) => ({
60
+ ...menu,
61
+ children: menu.children?.length ? sortMenusByOrder(menu.children) : menu.children
62
+ }));
28
63
  }
29
- function handlePathKey(record) {
30
- const { menuSelectKey } = record?.meta || {};
31
- return menuSelectKey || record?.fullPath || record?.path;
64
+ function normalizeMenus(menus) {
65
+ return sortMenusByOrder(cleanMenus(menus));
32
66
  }
33
- function getMenuData(routes) {
34
- const childrenRoute = routes.find((route) => (route.name === "root" || route.path === "/") && route.children?.length);
35
- const breadcrumb = {};
67
+ /**
68
+ * 构建扁平列表 + name 查找表。替代旧 `getMenuData` `flatMenus`/`menuMap`
69
+ * (去掉 `key="0-1-2"`、`omit`、`path.replace` 等副作用)。
70
+ * 每个 route 用 `markRaw` 标记,避免进入 Vue 响应式系统。
71
+ */
72
+ function buildMenuLookup(menus) {
36
73
  const flatMenus = [];
37
- const menuMap = /* @__PURE__ */ new Map();
74
+ const lookup = /* @__PURE__ */ new Map();
75
+ function walk(nodes, parentNames, parentPath) {
76
+ for (let index = 0; index < nodes.length; index++) {
77
+ const node = nodes[index];
78
+ if (lookup.has(node.name)) continue;
79
+ const path = [...parentPath, index];
80
+ const rawRoute = markRaw(node);
81
+ flatMenus.push(rawRoute);
82
+ lookup.set(node.name, {
83
+ route: rawRoute,
84
+ parentNames,
85
+ path
86
+ });
87
+ if (node.children?.length) walk(node.children, [...parentNames, node.name], path);
88
+ }
89
+ }
90
+ walk(menus, [], []);
38
91
  return {
39
- menuMap,
40
- menuData: handleMenuData(childrenRoute?.children || [], {
41
- menuMap,
42
- flatMenus,
43
- breadcrumb
44
- }),
45
- breadcrumb,
46
- flatMenus
92
+ flatMenus,
93
+ lookup
47
94
  };
48
95
  }
49
- function clearMenuItem(menusData) {
50
- const seenNames = /* @__PURE__ */ new Map();
51
- const duplicateNamesArray = [];
52
- function recursiveClear(data) {
53
- return data.map((item) => {
54
- const path = item.path;
55
- const name = item.name;
56
- const repeatName = seenNames.has(name) && seenNames.get(name) !== path;
57
- if (item?.meta?.hidden || !name || repeatName) {
58
- if (!name || repeatName) {
59
- if (!duplicateNamesArray.some((r) => r.name === name && path === item.path)) duplicateNamesArray.push({ ...item });
60
- }
61
- return null;
62
- }
63
- seenNames.set(name, path);
64
- if (item && item?.children) if (item?.meta?.hideChildren) item.children = [];
65
- else return {
66
- ...item,
67
- children: recursiveClear(item.children)
68
- };
69
- return item;
70
- }).filter((r) => r);
71
- }
72
- const result = recursiveClear(menusData);
73
- duplicateNamesArray.length > 0 && console.warn(`The menu contains duplicate names or name undefined: `, duplicateNamesArray);
74
- return result;
96
+ function mergeRoutePatch(route, patch) {
97
+ const next = {
98
+ ...route,
99
+ ...patch
100
+ };
101
+ if ("meta" in patch) next.meta = patch.meta ? {
102
+ ...route.meta,
103
+ ...patch.meta
104
+ } : patch.meta;
105
+ return next;
75
106
  }
76
- function flatMap(menusData) {
77
- return menusData.map((item) => {
78
- if (item?.meta?.hidden) return null;
79
- item.redirect = item.redirect === void 0 ? getLastPath(item.children || []) || void 0 : item.redirect;
80
- if (item.children) delete item.children;
81
- return item;
82
- }).filter((item) => item);
83
- }
84
- function getMenuFirstChildren(menus, key) {
85
- const findMenuItem = menus.find((menuItem) => menuItem.name === key);
86
- return key === void 0 ? [] : findMenuItem?.children || [];
87
- }
88
- function getLastPath(data) {
89
- const newData = data?.filter((item) => !item?.meta?.hidden && !item.meta?.hideInMenu);
90
- const firstChild = newData[0];
91
- let newPath = "";
92
- const getRoutePath = function(newData) {
93
- let firstPath = "";
94
- if (newData?.children && newData?.children.length > 0) firstPath = getRoutePath(newData?.children?.[0]);
95
- else firstPath = newData?.redirect || newData?.path || "";
96
- return firstPath;
107
+ function mergeMetaPatch(meta, patch) {
108
+ return {
109
+ ...meta,
110
+ ...patch
97
111
  };
98
- if (newData.length > 0 && firstChild?.children && firstChild?.children?.length > 0) newPath = getRoutePath(firstChild?.children?.[0]);
99
- else {
100
- const menuItem = newData.length > 0 ? firstChild : void 0;
101
- newPath = menuItem?.redirect || menuItem?.path || "";
112
+ }
113
+ function updateMenuAtPath(menus, path, updater) {
114
+ if (path.length === 0) return menus;
115
+ const nextMenus = [...menus];
116
+ let sourceNodes = menus;
117
+ let targetNodes = nextMenus;
118
+ for (let depth = 0; depth < path.length; depth++) {
119
+ const index = path[depth];
120
+ const sourceNode = sourceNodes[index];
121
+ if (!sourceNode) return menus;
122
+ if (depth === path.length - 1) {
123
+ targetNodes[index] = typeof updater === "function" ? updater(sourceNode) : mergeRoutePatch(sourceNode, updater);
124
+ return nextMenus;
125
+ }
126
+ const nextChildren = sourceNode.children ? [...sourceNode.children] : [];
127
+ targetNodes[index] = {
128
+ ...sourceNode,
129
+ children: nextChildren
130
+ };
131
+ sourceNodes = sourceNode.children ?? [];
132
+ targetNodes = nextChildren;
102
133
  }
103
- return newPath;
134
+ return nextMenus;
104
135
  }
105
- function getParentKeys(key) {
106
- const parts = key.split("-");
107
- const result = [];
108
- for (let i = 0; i < parts.length; i++) result.push(parts.slice(0, i + 1).join("-"));
109
- return result;
136
+ function updateMenuMetaAtPath(menus, path, updater) {
137
+ return updateMenuAtPath(menus, path, (route) => {
138
+ const currentMeta = route.meta ?? {};
139
+ const nextMeta = typeof updater === "function" ? updater(currentMeta) : mergeMetaPatch(currentMeta, updater);
140
+ return {
141
+ ...route,
142
+ meta: nextMeta
143
+ };
144
+ });
110
145
  }
111
- function getMatchedList(menuProps, name) {
112
- const current = menuProps.menuMap.get(name);
113
- if (current) {
114
- if (current.meta?.hidden) return [];
115
- let key = current.key || "";
116
- if (current.meta?.menuSelectKey) key = menuProps.menuMap.get(current.meta.menuSelectKey)?.key || "";
117
- const matchedKeys = getParentKeys(key);
118
- return menuProps.flatMenus.filter((menuItem) => matchedKeys.includes(menuItem.key || "")).filter((menuItem) => !menuItem.meta?.hideInMenu);
146
+ function insertMenuAtPath(menus, parentPath, menu, index) {
147
+ if (!parentPath?.length) {
148
+ const nextMenus = [...menus];
149
+ nextMenus.splice(index ?? nextMenus.length, 0, menu);
150
+ return nextMenus;
119
151
  }
120
- return [];
121
- }
122
- function filterTree(tree, filterFn) {
123
- return tree.map((node) => {
124
- const filteredChildren = node.children ? filterTree(node.children, filterFn) : [];
125
- if (filterFn(node) || filteredChildren.length > 0) return {
126
- ...node,
127
- children: filteredChildren.length > 0 ? filteredChildren : void 0
152
+ return updateMenuAtPath(menus, parentPath, (route) => {
153
+ const children = [...route.children ?? []];
154
+ children.splice(index ?? children.length, 0, menu);
155
+ return {
156
+ ...route,
157
+ children
128
158
  };
129
- return null;
130
- }).filter((node) => node !== null);
159
+ });
160
+ }
161
+ function removeMenuAtPath(menus, path) {
162
+ if (path.length === 0) return menus;
163
+ if (path.length === 1) {
164
+ const nextMenus = [...menus];
165
+ nextMenus.splice(path[0], 1);
166
+ return nextMenus;
167
+ }
168
+ const parentPath = path.slice(0, -1);
169
+ const removeIndex = path[path.length - 1];
170
+ return updateMenuAtPath(menus, parentPath, (route) => {
171
+ const children = [...route.children ?? []];
172
+ children.splice(removeIndex, 1);
173
+ return {
174
+ ...route,
175
+ children: children.length > 0 ? children : void 0
176
+ };
177
+ });
178
+ }
179
+ function collectMenuNames(route) {
180
+ if (!route) return [];
181
+ const names = [route.name];
182
+ function walk(nodes) {
183
+ if (!nodes?.length) return;
184
+ for (const node of nodes) {
185
+ names.push(node.name);
186
+ walk(node.children);
187
+ }
188
+ }
189
+ walk(route.children);
190
+ return names;
191
+ }
192
+ /**
193
+ * 解析当前路由的匹配链(根→自身)。替代 `getMatchedList` + `getParentKeys` + `handlePathKey`,
194
+ * 用 `parentNames` 直接取链,无字符串切割。
195
+ * - `meta.menuSelectKey` 会把匹配目标重定向到指定菜单;
196
+ * - 过滤 `hideInMenu` 的祖先;
197
+ * - 未知 name 或目标自身 `hideInMenu` 返回 `[]`。
198
+ */
199
+ function resolveMatchedChain(lookup, name) {
200
+ if (!name) return [];
201
+ const current = lookup.get(name);
202
+ if (!current) return [];
203
+ const selectKey = current.route.meta?.menuSelectKey;
204
+ if (!selectKey && current.route.meta?.hideInMenu) return [];
205
+ const target = selectKey ? lookup.get(selectKey) : current;
206
+ if (!target) return [];
207
+ return [...target.parentNames, target.route.name].map((chainName) => lookup.get(chainName)?.route).filter((route) => !!route && !route.meta?.hideInMenu);
208
+ }
209
+ /**
210
+ * 取第一个可见叶子的跳转路径(不可变、仅依据 `hideInMenu`)。
211
+ * 用于父级菜单 / 面包屑的默认跳转目标。
212
+ */
213
+ function getLastPath(menus) {
214
+ const first = menus.filter((menu) => !menu.meta?.hideInMenu)[0];
215
+ if (!first) return "";
216
+ if (first.children?.length) return getLastPath(first.children);
217
+ return first.redirect || first.path || "";
218
+ }
219
+ /**
220
+ * 基于匹配链构建面包屑路由数组(仅保留有标题的项)。
221
+ * `menuSelectKey` 场景下把当前真实路由追加到链尾(对齐旧行为)。
222
+ */
223
+ function buildBreadcrumbRoutes(chain, options) {
224
+ const routes = chain.filter((route) => route.meta?.title);
225
+ const current = options?.current;
226
+ if (current?.meta?.menuSelectKey && current.meta?.title) routes.push(current);
227
+ return routes;
228
+ }
229
+ /** 将面包屑路由数组转为 antdv-next 面包屑项(纯数据,`onClick` 由组件接)。 */
230
+ function toBreadcrumbItems(routes) {
231
+ return routes.map((route) => ({
232
+ key: route.name,
233
+ title: route.meta?.title,
234
+ path: route.redirect || (route.children?.length ? getLastPath(route.children) : "") || route.path || ""
235
+ }));
236
+ }
237
+ /**
238
+ * 解析点击菜单后的跳转目标。替代旧 `BaseMenu` 的 `onClick` 取数逻辑。
239
+ * 外链(`linkStatus===1` 且 link 合法)走 `window.open`,否则内部 `router.push`。
240
+ */
241
+ function resolveRouteTarget(lookup, name) {
242
+ const route = lookup.get(name)?.route;
243
+ if (!route) return {
244
+ type: "internal",
245
+ path: ""
246
+ };
247
+ const link = route.meta?.link;
248
+ if (route.meta?.linkStatus === 1 && link && isUrl(link)) return {
249
+ type: "external",
250
+ link,
251
+ route
252
+ };
253
+ return {
254
+ type: "internal",
255
+ path: typeof route.redirect === "string" ? route.redirect : route.children?.length ? getLastPath(route.children) || route.path || "" : route.path || "",
256
+ route
257
+ };
258
+ }
259
+ /**
260
+ * 取顶层菜单中 `name` 命中项的子级(mix 布局的侧边分支)。
261
+ * 替代旧 `menuData.find(name===selectedKeys[0])?.children` 与 `getMenuFirstChildren`。
262
+ */
263
+ function selectMenuBranch(menus, name) {
264
+ if (!name) return [];
265
+ return menus.find((menu) => menu.name === name)?.children ?? [];
266
+ }
267
+ /** 按 `meta.fixed` 拆分菜单(fixed 项钉到侧边栏底部)。替代旧 ProMenu 的 `baseMenus`/`footerMenus`。 */
268
+ function partitionFixedMenus(menus) {
269
+ const baseMenus = [];
270
+ const fixedMenus = [];
271
+ for (const menu of menus) if (menu.meta?.fixed) fixedMenus.push(menu);
272
+ else baseMenus.push(menu);
273
+ return {
274
+ baseMenus,
275
+ fixedMenus
276
+ };
131
277
  }
132
-
133
278
  //#endregion
134
- export { clearMenuItem, filterTree, flatMap, getLastPath, getMatchedList, getMenuData, getMenuFirstChildren, getParentKeys, handlePathKey };
279
+ export { buildBreadcrumbRoutes, buildMenuLookup, cleanMenus, collectMenuNames, getLastPath, insertMenuAtPath, normalizeMenus, partitionFixedMenus, removeMenuAtPath, resolveMatchedChain, resolveRouteTarget, routesToMenus, selectMenuBranch, sortMenusByOrder, toBreadcrumbItems, updateMenuAtPath, updateMenuMetaAtPath };
@@ -0,0 +1,4 @@
1
+ //#region src/utils/style.d.ts
2
+ declare const layout = "::view-transition-old(root),\n::view-transition-new(root) {\n animation: none;\n display: block;\n mix-blend-mode: normal;\n}\n\n::view-transition-new(root) {\n will-change: clip-path;\n}\n\n::view-transition-old(root) {\n z-index: 1;\n}\n\n::view-transition-new(root) {\n z-index: 2147483646;\n}";
3
+ //#endregion
4
+ export { layout };
@@ -0,0 +1,21 @@
1
+ //#region src/utils/style.ts
2
+ const layout = `::view-transition-old(root),
3
+ ::view-transition-new(root) {
4
+ animation: none;
5
+ display: block;
6
+ mix-blend-mode: normal;
7
+ }
8
+
9
+ ::view-transition-new(root) {
10
+ will-change: clip-path;
11
+ }
12
+
13
+ ::view-transition-old(root) {
14
+ z-index: 1;
15
+ }
16
+
17
+ ::view-transition-new(root) {
18
+ z-index: 2147483646;
19
+ }`;
20
+ //#endregion
21
+ export { layout };
@@ -0,0 +1,28 @@
1
+ import { ComponentToken } from "../components/Menu/style/index.js";
2
+ import { BaseLayoutDesignToken } from "@gx-design-vue/pro-provider";
3
+ import { ThemeConfig } from "antdv-next";
4
+
5
+ //#region src/utils/themeComponents.d.ts
6
+ /** antdv-next ConfigProvider 的单组件 token 覆盖类型 */
7
+ type MenuThemeTokens = NonNullable<NonNullable<ThemeConfig['components']>['Menu']>;
8
+ /**
9
+ * 侧边栏菜单的 antdv-next `Menu` token —— 用布局设计 token 重上色 antdv 自己的菜单 CSS。
10
+ *
11
+ * 等价于旧菜单外层 `<ConfigProvider theme={{ components: { Menu } }}>`,
12
+ * 但把 ant-design-vue v4 的 legacy token 名(colorItemBg 等)映射到 antdv-next 新名。
13
+ */
14
+ declare function buildSiderMenuTokens(token: BaseLayoutDesignToken): MenuThemeTokens;
15
+ /**
16
+ * 侧边栏自写菜单的 token —— 外部仍只配置 `components.Menu`,这里转成内部 `ProMenu`。
17
+ */
18
+ declare function buildSiderProMenuTokens(token: BaseLayoutDesignToken, menuToken?: Partial<MenuThemeTokens>): Partial<ComponentToken>;
19
+ /**
20
+ * 顶部菜单的 antdv-next `Menu` token —— 水平态配色取布局 header token。
21
+ */
22
+ declare function buildHeaderMenuTokens(token: BaseLayoutDesignToken): MenuThemeTokens;
23
+ /**
24
+ * 顶部自写菜单的 token —— 外部仍只配置 `components.Menu`,这里转成内部 `ProMenu`。
25
+ */
26
+ declare function buildHeaderProMenuTokens(token: BaseLayoutDesignToken, menuToken?: Partial<MenuThemeTokens>): Partial<ComponentToken>;
27
+ //#endregion
28
+ export { buildHeaderMenuTokens, buildHeaderProMenuTokens, buildSiderMenuTokens, buildSiderProMenuTokens };
@@ -0,0 +1,89 @@
1
+ //#region src/utils/themeComponents.ts
2
+ const SIDER_IGNORED_MENU_TOKEN_KEYS = /* @__PURE__ */ new Set([
3
+ "colorItemTextHoverHorizontal",
4
+ "colorItemTextSelectedHorizontal",
5
+ "colorItemBgSelectedHorizontal",
6
+ "horizontalItemHoverColor",
7
+ "horizontalItemSelectedColor",
8
+ "horizontalItemHoverBg",
9
+ "horizontalItemSelectedBg",
10
+ "horizontalItemBorderRadius",
11
+ "horizontalLineHeight"
12
+ ]);
13
+ /** 丢弃空值,避免把空字符串/undefined 喂给 antd 导致无效颜色覆盖其默认值。 */
14
+ function compact(source) {
15
+ const result = {};
16
+ for (const [key, value] of Object.entries(source)) if (value !== void 0 && value !== null && value !== "") result[key] = value;
17
+ return result;
18
+ }
19
+ function pickSiderMenuTokens(menuToken) {
20
+ if (!menuToken) return {};
21
+ const result = {};
22
+ for (const [key, value] of Object.entries(menuToken)) if (!SIDER_IGNORED_MENU_TOKEN_KEYS.has(key)) result[key] = value;
23
+ return result;
24
+ }
25
+ /**
26
+ * 侧边栏菜单的 antdv-next `Menu` token —— 用布局设计 token 重上色 antdv 自己的菜单 CSS。
27
+ *
28
+ * 等价于旧菜单外层 `<ConfigProvider theme={{ components: { Menu } }}>`,
29
+ * 但把 ant-design-vue v4 的 legacy token 名(colorItemBg 等)映射到 antdv-next 新名。
30
+ */
31
+ function buildSiderMenuTokens(token) {
32
+ const { sider } = token;
33
+ return compact({
34
+ itemBg: sider.colorMenuBackground || "transparent",
35
+ subMenuItemBg: sider.colorMenuBackground || "transparent",
36
+ popupBg: sider.colorBgMenuItemCollapsedElevated,
37
+ itemColor: sider.colorTextMenu,
38
+ itemHoverColor: sider.colorTextMenuItemHover,
39
+ itemSelectedColor: sider.colorTextMenuSelected,
40
+ subMenuItemSelectedColor: sider.colorTextSubMenuSelected || sider.colorTextMenuSelected,
41
+ itemHoverBg: sider.colorBgMenuItemHover,
42
+ itemActiveBg: sider.colorBgMenuItemActive,
43
+ itemSelectedBg: sider.colorBgMenuItemSelected,
44
+ itemBorderRadius: sider.borderRadius,
45
+ itemMarginInline: sider.menuItemMarginInline,
46
+ itemHeight: sider.menuItemHeight,
47
+ iconSize: token.menuItemIconSize,
48
+ groupTitleColor: sider.colorTextMenuTitle
49
+ });
50
+ }
51
+ /**
52
+ * 侧边栏自写菜单的 token —— 外部仍只配置 `components.Menu`,这里转成内部 `ProMenu`。
53
+ */
54
+ function buildSiderProMenuTokens(token, menuToken) {
55
+ return compact({
56
+ ...pickSiderMenuTokens(menuToken),
57
+ ...buildSiderMenuTokens(token)
58
+ });
59
+ }
60
+ /**
61
+ * 顶部菜单的 antdv-next `Menu` token —— 水平态配色取布局 header token。
62
+ */
63
+ function buildHeaderMenuTokens(token) {
64
+ const { header } = token;
65
+ return compact({
66
+ itemBg: "transparent",
67
+ popupBg: header.colorBgMenuElevated,
68
+ itemColor: header.colorTextMenu,
69
+ subMenuItemSelectedColor: header.colorTextSubMenuSelected,
70
+ horizontalItemHoverColor: header.colorTextMenuActive,
71
+ horizontalItemSelectedColor: header.colorTextMenuSelected,
72
+ horizontalItemHoverBg: header.colorBgMenuItemHover,
73
+ horizontalItemSelectedBg: header.colorBgMenuItemSelected,
74
+ horizontalItemBorderRadius: header.itemBorderRadius,
75
+ itemBorderRadius: header.itemBorderRadius,
76
+ itemHeight: header.menuItemHeight
77
+ });
78
+ }
79
+ /**
80
+ * 顶部自写菜单的 token —— 外部仍只配置 `components.Menu`,这里转成内部 `ProMenu`。
81
+ */
82
+ function buildHeaderProMenuTokens(token, menuToken) {
83
+ return compact({
84
+ ...menuToken,
85
+ ...buildHeaderMenuTokens(token)
86
+ });
87
+ }
88
+ //#endregion
89
+ export { buildHeaderMenuTokens, buildHeaderProMenuTokens, buildSiderMenuTokens, buildSiderProMenuTokens };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gx-design-vue/pro-layout",
3
3
  "type": "module",
4
- "version": "0.1.0-alpha.2",
4
+ "version": "0.1.0-alpha.21",
5
5
  "description": "Gx Design Pro Layout",
6
6
  "author": {
7
7
  "name": "gx12358",
@@ -37,24 +37,33 @@
37
37
  "package.json"
38
38
  ],
39
39
  "peerDependencies": {
40
+ "@antdv-next/cssinjs": "^1.0.6",
41
+ "@gx-design-vue/context": "^0.0.5-alpha.8",
42
+ "@gx-design-vue/icon": "^0.0.1-alpha.13",
43
+ "@gx-design-vue/pro-hooks": "^0.2.0-alpha.8",
44
+ "@gx-design-vue/pro-provider": "^0.1.0-alpha.17",
45
+ "@gx-design-vue/pro-utils": "^0.2.0-alpha.10",
46
+ "@gx-design-vue/scrollbar": "^0.2.0-alpha.7",
47
+ "antdv-next": "^1.4.1",
40
48
  "vue": ">=3.2.0"
41
49
  },
42
50
  "dependencies": {
43
- "@ant-design/icons-vue": "^7.0.1",
44
51
  "@ctrl/tinycolor": "^3.5.0",
45
- "@vueuse/core": "^14.2.0",
46
- "ant-design-vue": "^4.2.6",
47
- "dayjs": "^1.11.19",
48
- "es-toolkit": "^1.43.0",
49
- "vue-router": "^4.6.4",
50
- "@gx-design-vue/context": "^0.0.5-alpha.2",
51
- "@gx-design-vue/pro-hooks": "^0.2.0-alpha.2",
52
- "@gx-design-vue/pro-app": "^0.1.0-alpha.1",
53
- "@gx-design-vue/icon": "^0.0.1-alpha.2",
54
- "@gx-design-vue/pro-provider": "^0.1.0-alpha.1",
55
- "@gx-design-vue/pro-utils": "^0.2.0-alpha.2",
56
- "@gx-design-vue/pro-watermark": "^0.2.0-alpha.1",
57
- "@gx-design-vue/scrollbar": "^0.2.0-alpha.1"
52
+ "@vueuse/core": "^14.3.0",
53
+ "dayjs": "^1.11.21",
54
+ "es-toolkit": "1.48.1",
55
+ "vue-router": "^5.1.0"
56
+ },
57
+ "devDependencies": {
58
+ "@antdv-next/cssinjs": "^1.0.6",
59
+ "antdv-next": "^1.4.1",
60
+ "vue": "^3.5.38",
61
+ "@gx-design-vue/context": "^0.0.5-alpha.8",
62
+ "@gx-design-vue/pro-hooks": "^0.2.0-alpha.8",
63
+ "@gx-design-vue/pro-provider": "^0.1.0-alpha.17",
64
+ "@gx-design-vue/icon": "^0.0.1-alpha.13",
65
+ "@gx-design-vue/pro-utils": "^0.2.0-alpha.10",
66
+ "@gx-design-vue/scrollbar": "^0.2.0-alpha.7"
58
67
  },
59
68
  "browserslist": [
60
69
  "> 1%",
@@ -1,6 +0,0 @@
1
- import { ProLayoutInjextExpose } from "../types/typings.js";
2
-
3
- //#region src/Context/expose.d.ts
4
- declare const provideProLayoutExposeContext: (value: ProLayoutInjextExpose) => void, useProLayoutExposeContext: (injectDefaultValue?: ProLayoutInjextExpose) => ProLayoutInjextExpose;
5
- //#endregion
6
- export { provideProLayoutExposeContext, useProLayoutExposeContext };
@@ -1,7 +0,0 @@
1
- import { useContext } from "@gx-design-vue/context";
2
-
3
- //#region src/Context/expose.ts
4
- const { provideContext: provideProLayoutExposeContext, useInjectContext: useProLayoutExposeContext } = useContext("pro-layout-expose");
5
-
6
- //#endregion
7
- export { provideProLayoutExposeContext, useProLayoutExposeContext };
@@ -1,43 +0,0 @@
1
- import { Meta } from "../types/RouteTypings.js";
2
- import { BreadcrumbProps } from "../types/Breadcrumb.js";
3
- import { MenuPropsContext, ProLayoutMenuFunProps } from "../types/MenuTypings.js";
4
- import { LayoutPageContainer, PageContainerPropsType } from "../components/PageContainer/props.js";
5
- import { ShortcutKeyProps } from "../props/index.js";
6
- import { BasicLayoutProps, CollapsedProps, LayoutClassNamesType, LayoutContext, LayoutStylesType } from "../types/typings.js";
7
- import { ComputedRef, Ref } from "vue";
8
- import { CustomRender, PrefixCls, WithFalse } from "@gx-design-vue/pro-utils";
9
-
10
- //#region src/Context/index.d.ts
11
- declare const defaultContextKey: (keyof ProLayoutContextProps)[];
12
- interface ProLayoutContextProps {
13
- getPrefixCls: (prefixCls: PrefixCls) => string;
14
- setHasFooterToolbar: (value: boolean) => void;
15
- zIndex: Ref<number>;
16
- styles: Ref<LayoutStylesType>;
17
- waterMarkProps: Ref<BasicLayoutProps['waterMarkProps']>;
18
- classNames: Ref<LayoutClassNamesType>;
19
- breadcrumb: ComputedRef<BreadcrumbProps>;
20
- collapsed: Ref<boolean>;
21
- hasFooterToolbar: Ref<boolean>;
22
- collapsedEffect: ComputedRef<boolean>;
23
- collapsedProps: ComputedRef<Partial<CollapsedProps>>;
24
- openKeys: Ref<ProLayoutMenuFunProps['openKeys']>;
25
- selectedKeys: Ref<ProLayoutMenuFunProps['openKeys']>;
26
- renderRouterView: Ref<boolean>;
27
- contentFullScreen: Ref<boolean>;
28
- disableMobile?: Ref<boolean>;
29
- fullScreenOnTabsHide: Ref<boolean>;
30
- shortcutKey: Ref<ShortcutKeyProps>;
31
- hasContentWide: ComputedRef<boolean>;
32
- breadcrumbRender: Ref<WithFalse<(props: BreadcrumbProps) => CustomRender> | undefined>;
33
- isMobile: ComputedRef<boolean>;
34
- settings: ComputedRef<BasicLayoutProps['settings']>;
35
- pageContainer: Ref<LayoutPageContainer>;
36
- pageHeaderRender: ComputedRef<PageContainerPropsType['pageHeaderRender']>;
37
- menu: ComputedRef<MenuPropsContext>;
38
- currentMeta: Ref<Meta | undefined>;
39
- layoutProps: ComputedRef<LayoutContext>;
40
- }
41
- declare const provideProLayoutContext: (value: ProLayoutContextProps) => void, useProLayoutContext: (injectDefaultValue?: ProLayoutContextProps) => ProLayoutContextProps;
42
- //#endregion
43
- export { ProLayoutContextProps, defaultContextKey, provideProLayoutContext, useProLayoutContext };