zzz-pc-view 0.0.49 → 0.0.50

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zzz-pc-view",
3
- "version": "0.0.49",
3
+ "version": "0.0.50",
4
4
  "main": "src/index.umd.js",
5
5
  "module": "src/index.es.js",
6
6
  "types": "src/index.d.ts",
package/src/index.es.js CHANGED
@@ -2234,7 +2234,7 @@ const getNavsCategory = (navs, pageViewMap) => {
2234
2234
  navDirs,
2235
2235
  navMenus: sort(navMenus, "orderNo"),
2236
2236
  navLinks,
2237
- navButtons
2237
+ navButtons: sort(navButtons, "orderNo")
2238
2238
  };
2239
2239
  };
2240
2240
  const getNavMenuButtonMap = (navButtons) => navButtons.reduce(
@@ -2419,18 +2419,28 @@ const setNavTree = (navDirs, navMenus, navLinks) => {
2419
2419
  navTreeRef.value = sort(roots, "orderNo");
2420
2420
  navChildrenMapRef.value = childrenMap;
2421
2421
  };
2422
+ const menuButtonMapRef = shallowRef({});
2423
+ const setMenuButtonMap = (navButtons) => {
2424
+ menuButtonMapRef.value = toKeyValues(navButtons, "parentId");
2425
+ };
2422
2426
  const setNavs = (option) => {
2423
2427
  const pageViewMap = getComponentViewMap(option.pageViewMap);
2424
2428
  const navsCategory = getNavsCategory(option.navs, pageViewMap);
2425
- const { navMenus } = navsCategory;
2429
+ const { navMenus, navButtons } = navsCategory;
2426
2430
  setRoutes({
2427
2431
  RootPageView: option.RootPageView,
2432
+ // 根页面视图
2428
2433
  navMenus,
2434
+ // 导航菜单
2429
2435
  pageViewMap,
2430
- navButtons: navsCategory.navButtons,
2436
+ // 页面视图映射
2437
+ navButtons,
2438
+ // 导航按钮
2431
2439
  NotFoundPageView: option.NotFoundPageView
2440
+ // 404页面视图
2432
2441
  });
2433
2442
  setNavTree(navsCategory.navDirs, navsCategory.navMenus, navsCategory.navLinks);
2443
+ setMenuButtonMap(navButtons);
2434
2444
  };
2435
2445
  const clear = (option) => {
2436
2446
  navTreeRef.value = list$1;
@@ -2507,6 +2517,14 @@ const response = {
2507
2517
  get navTree() {
2508
2518
  return navTreeRef.value;
2509
2519
  },
2520
+ /**
2521
+ * 获取菜单按钮映射的 getter 方法。
2522
+ * 返回一个包含所有菜单按钮的映射对象,其中键为父级导航项的 ID,值为该父级导航项下的按钮数组。
2523
+ * @returns {Record<ZBaseNav['id'], ZNavButton[]>} - 菜单按钮映射对象
2524
+ */
2525
+ get menuButtonMap() {
2526
+ return menuButtonMapRef.value;
2527
+ },
2510
2528
  /**
2511
2529
  * 获取导航目录的子导航项映射的 getter 方法。
2512
2530
  * @type {Function}