dlt-for-react 2.1.5 → 2.1.7

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/README.md CHANGED
@@ -8,18 +8,20 @@ npm publish
8
8
 
9
9
  ## 前端 dlt-for-react 依赖包版本更新记录
10
10
 
11
- ##### 当前最新版本:2.1.5
12
-
13
11
  ##### 安装依赖
14
12
 
15
13
  > npm install dlt-for-react --save
16
14
 
17
15
  ##### 版本修改记录
18
16
 
19
- #### V2.1.5—2024 年 6 月 4
17
+ #### V2.1.7—2024 年 6 月 12
18
+ 1. 解决升级echarts5.0版本 部分api不兼容的问题
19
+
20
+ #### V2.1.6—2024 年 6 月 4 日
20
21
 
21
- 1. 更新echart版本
22
+ 1. 更新echart5.0版本
22
23
  2. 去除echarts/map/js/china
24
+ 3. 优化handleMenus方法
23
25
 
24
26
  #### V2.1.0—2024 年 6 月 3 日
25
27
 
@@ -416,8 +416,8 @@ var deepCheckField = exports.deepCheckField = function deepCheckField(treeList,
416
416
  return temp;
417
417
  };
418
418
 
419
- var handleMenus = exports.handleMenus = function handleMenus(allMenu) {
420
- var auths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
419
+ // 获取有权限的菜单
420
+ var handleMenus = exports.handleMenus = function handleMenus(allMenu, auths) {
421
421
  var routes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
422
422
 
423
423
  //过滤掉没有权限的菜单
@@ -442,7 +442,7 @@ var findAuth = exports.findAuth = function findAuth(routes, menu) {
442
442
  return r.path == menu.url;
443
443
  });
444
444
  if (item && item.authority) {
445
- authority = item.authority;
445
+ authority = item.authority || item.auth;
446
446
  }
447
447
  return authority;
448
448
  };
@@ -467,25 +467,33 @@ var filterChildrenMenus = exports.filterChildrenMenus = function filterChildrenM
467
467
  var filterAuthMenus = exports.filterAuthMenus = function filterAuthMenus(menus, auths, routes) {
468
468
  var filterMenus = [];
469
469
  menus.map(function (item) {
470
- var authority = item.authority;
470
+ var authority = item.authority || item.auth;
471
+ if (item.url || item.path) {
472
+ item.url = item.url || item.path;
473
+ delete item.path;
474
+ }
475
+ if (item.children || item.routes) {
476
+ item.children = item.children || item.routes;
477
+ delete item.routes;
478
+ }
471
479
  if (item.url && routes && routes.length > 0) {
472
480
  authority = findAuth(routes, item);
473
481
  }
474
- if (item.children) {
475
- //存在子菜单,只需要处理子菜单即可
476
- item.children = filterAuthMenus(item.children, auths, routes);
477
- filterMenus.push(item);
478
- } else if (authority) {
482
+ if (authority) {
479
483
  //存在权限判断,此时需要判断用户是否有该权限
480
- if (IsType('Array', authority)) {
481
- if (auths.includes(auths)) {
484
+ if (IsType('Object', auths)) {
485
+ if (auths[authority] !== undefined) {
482
486
  filterMenus.push(item);
483
487
  }
484
- } else if (IsType('Object', auths)) {
485
- if (auths[item.auth] !== undefined) {
488
+ } else {
489
+ if (auths.includes(authority)) {
486
490
  filterMenus.push(item);
487
491
  }
488
492
  }
493
+ } else if (item.children) {
494
+ //存在子菜单,只需要处理子菜单即可
495
+ item.children = filterAuthMenus(item.children, auths, routes);
496
+ filterMenus.push(item);
489
497
  } else {
490
498
  filterMenus.push(item);
491
499
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dlt-for-react",
3
- "version": "2.1.5",
3
+ "version": "2.1.7",
4
4
  "description": "dlt for react",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {