@bit-sun/business-component 2.4.31-alpha.2 → 2.4.31-alpha.4

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.esm.js CHANGED
@@ -16780,19 +16780,33 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16780
16780
  data.forEach(function (node) {
16781
16781
  if (node.routes && node.routes.length > 0) {
16782
16782
  getTreeList(node.routes);
16783
- } else {
16784
- if (node.path === '/' || getLimitedMenuPath(node) || getGenerateDocs(node)) {
16785
- treeList.push({
16786
- tab: node.locale,
16787
- key: node.path,
16788
- locale: node.locale,
16789
- closable: true,
16790
- content: node.component,
16791
- name: node.name,
16792
- hideInMenu: node.hideInMenu,
16793
- isOnlyOnePage: node.isOnlyOnePage
16794
- });
16795
- }
16783
+ return;
16784
+ }
16785
+ // todo:暂时处理非wujie环境不做404管控
16786
+ if (!window.__POWERED_BY_WUJIE__) {
16787
+ treeList.push({
16788
+ tab: node.locale,
16789
+ key: node.path,
16790
+ locale: node.locale,
16791
+ closable: true,
16792
+ content: node.component,
16793
+ name: node.name,
16794
+ hideInMenu: node.hideInMenu,
16795
+ isOnlyOnePage: node.isOnlyOnePage
16796
+ });
16797
+ return;
16798
+ }
16799
+ if (node.path === '/' || getLimitedMenuPath(node) || getGenerateDocs(node)) {
16800
+ treeList.push({
16801
+ tab: node.locale,
16802
+ key: node.path,
16803
+ locale: node.locale,
16804
+ closable: true,
16805
+ content: node.component,
16806
+ name: node.name,
16807
+ hideInMenu: node.hideInMenu,
16808
+ isOnlyOnePage: node.isOnlyOnePage
16809
+ });
16796
16810
  }
16797
16811
  });
16798
16812
  };
@@ -17236,13 +17250,28 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
17236
17250
  hideMenuArray = _this2$state.hideMenuArray;
17237
17251
  var newListenRouterState = _toConsumableArray(listenRouterState);
17238
17252
  var newListenRouterKey = _toConsumableArray(listenRouterKey);
17253
+ /**
17254
+ * 根据给定的路由数组和当前路由信息,筛选出与当前路由匹配的路由项。
17255
+ *
17256
+ * @param routerArray 路由数组,包含多个路由项,每个路由项有一个键(key)。
17257
+ * @param route 当前的路由信息,包含路径(pathname)等信息。
17258
+ * @param docsId 通用单据ID的数组,用于进一步筛选路由。
17259
+ * @returns 返回与当前路由匹配的第一个路由项,如果没有匹配项则返回undefined。
17260
+ */
17239
17261
  var replaceRouter = routerArray.filter(function (itemRoute) {
17240
- var _route$pathname;
17241
- if ((_route$pathname = route.pathname) === null || _route$pathname === void 0 ? void 0 : _route$pathname.includes('all-general-documents')) {
17262
+ var _route$pathname, _route$pathname2;
17263
+ // 单独处理通用单据预览
17264
+ if (window.top !== window && !window.__POWERED_BY_WUJIE__ && ((_route$pathname = route.pathname) === null || _route$pathname === void 0 ? void 0 : _route$pathname.includes('all-general-documents'))) {
17265
+ return pathToRegexp(itemRoute.key || '').test(route.pathname);
17266
+ }
17267
+ // 当路由路径包含'all-general-documents'时,按通用单据处理
17268
+ if ((_route$pathname2 = route.pathname) === null || _route$pathname2 === void 0 ? void 0 : _route$pathname2.includes('all-general-documents')) {
17269
+ // 检查路由路径是否匹配路由项的键,并且路径中包含至少一个通用单据ID
17242
17270
  return pathToRegexp(itemRoute.key || '').test(route.pathname) && docsId.some(function (item) {
17243
17271
  return route.pathname.includes(item);
17244
17272
  });
17245
17273
  }
17274
+ // 对于不包含'all-general-documents'的路径,只检查路由路径是否匹配路由项的键
17246
17275
  return pathToRegexp(itemRoute.key || '').test(route.pathname);
17247
17276
  })[0];
17248
17277
  var currentKey = '';
package/dist/index.js CHANGED
@@ -16800,19 +16800,33 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16800
16800
  data.forEach(function (node) {
16801
16801
  if (node.routes && node.routes.length > 0) {
16802
16802
  getTreeList(node.routes);
16803
- } else {
16804
- if (node.path === '/' || getLimitedMenuPath(node) || getGenerateDocs(node)) {
16805
- treeList.push({
16806
- tab: node.locale,
16807
- key: node.path,
16808
- locale: node.locale,
16809
- closable: true,
16810
- content: node.component,
16811
- name: node.name,
16812
- hideInMenu: node.hideInMenu,
16813
- isOnlyOnePage: node.isOnlyOnePage
16814
- });
16815
- }
16803
+ return;
16804
+ }
16805
+ // todo:暂时处理非wujie环境不做404管控
16806
+ if (!window.__POWERED_BY_WUJIE__) {
16807
+ treeList.push({
16808
+ tab: node.locale,
16809
+ key: node.path,
16810
+ locale: node.locale,
16811
+ closable: true,
16812
+ content: node.component,
16813
+ name: node.name,
16814
+ hideInMenu: node.hideInMenu,
16815
+ isOnlyOnePage: node.isOnlyOnePage
16816
+ });
16817
+ return;
16818
+ }
16819
+ if (node.path === '/' || getLimitedMenuPath(node) || getGenerateDocs(node)) {
16820
+ treeList.push({
16821
+ tab: node.locale,
16822
+ key: node.path,
16823
+ locale: node.locale,
16824
+ closable: true,
16825
+ content: node.component,
16826
+ name: node.name,
16827
+ hideInMenu: node.hideInMenu,
16828
+ isOnlyOnePage: node.isOnlyOnePage
16829
+ });
16816
16830
  }
16817
16831
  });
16818
16832
  };
@@ -17256,13 +17270,28 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
17256
17270
  hideMenuArray = _this2$state.hideMenuArray;
17257
17271
  var newListenRouterState = _toConsumableArray(listenRouterState);
17258
17272
  var newListenRouterKey = _toConsumableArray(listenRouterKey);
17273
+ /**
17274
+ * 根据给定的路由数组和当前路由信息,筛选出与当前路由匹配的路由项。
17275
+ *
17276
+ * @param routerArray 路由数组,包含多个路由项,每个路由项有一个键(key)。
17277
+ * @param route 当前的路由信息,包含路径(pathname)等信息。
17278
+ * @param docsId 通用单据ID的数组,用于进一步筛选路由。
17279
+ * @returns 返回与当前路由匹配的第一个路由项,如果没有匹配项则返回undefined。
17280
+ */
17259
17281
  var replaceRouter = routerArray.filter(function (itemRoute) {
17260
- var _route$pathname;
17261
- if ((_route$pathname = route.pathname) === null || _route$pathname === void 0 ? void 0 : _route$pathname.includes('all-general-documents')) {
17282
+ var _route$pathname, _route$pathname2;
17283
+ // 单独处理通用单据预览
17284
+ if (window.top !== window && !window.__POWERED_BY_WUJIE__ && ((_route$pathname = route.pathname) === null || _route$pathname === void 0 ? void 0 : _route$pathname.includes('all-general-documents'))) {
17285
+ return pathToRegexp(itemRoute.key || '').test(route.pathname);
17286
+ }
17287
+ // 当路由路径包含'all-general-documents'时,按通用单据处理
17288
+ if ((_route$pathname2 = route.pathname) === null || _route$pathname2 === void 0 ? void 0 : _route$pathname2.includes('all-general-documents')) {
17289
+ // 检查路由路径是否匹配路由项的键,并且路径中包含至少一个通用单据ID
17262
17290
  return pathToRegexp(itemRoute.key || '').test(route.pathname) && docsId.some(function (item) {
17263
17291
  return route.pathname.includes(item);
17264
17292
  });
17265
17293
  }
17294
+ // 对于不包含'all-general-documents'的路径,只检查路由路径是否匹配路由项的键
17266
17295
  return pathToRegexp(itemRoute.key || '').test(route.pathname);
17267
17296
  })[0];
17268
17297
  var currentKey = '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "2.4.31-alpha.2",
3
+ "version": "2.4.31-alpha.4",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -434,10 +434,25 @@ class BasicLayout extends React.PureComponent {
434
434
  let newListenRouterState = [...listenRouterState];
435
435
  let newListenRouterKey = [...listenRouterKey];
436
436
 
437
+ /**
438
+ * 根据给定的路由数组和当前路由信息,筛选出与当前路由匹配的路由项。
439
+ *
440
+ * @param routerArray 路由数组,包含多个路由项,每个路由项有一个键(key)。
441
+ * @param route 当前的路由信息,包含路径(pathname)等信息。
442
+ * @param docsId 通用单据ID的数组,用于进一步筛选路由。
443
+ * @returns 返回与当前路由匹配的第一个路由项,如果没有匹配项则返回undefined。
444
+ */
437
445
  let replaceRouter = routerArray.filter((itemRoute) => {
446
+ // 单独处理通用单据预览
447
+ if (window.top !== window && !window.__POWERED_BY_WUJIE__ && route.pathname?.includes('all-general-documents')) {
448
+ return pathToRegexp(itemRoute.key || '').test(route.pathname);
449
+ }
450
+ // 当路由路径包含'all-general-documents'时,按通用单据处理
438
451
  if (route.pathname?.includes('all-general-documents')) {
452
+ // 检查路由路径是否匹配路由项的键,并且路径中包含至少一个通用单据ID
439
453
  return pathToRegexp(itemRoute.key || '').test(route.pathname) && docsId.some(item => route.pathname.includes(item));
440
454
  }
455
+ // 对于不包含'all-general-documents'的路径,只检查路由路径是否匹配路由项的键
441
456
  return pathToRegexp(itemRoute.key || '').test(route.pathname);
442
457
  })[0];
443
458
 
@@ -606,19 +621,33 @@ class BasicLayout extends React.PureComponent {
606
621
  data.forEach((node) => {
607
622
  if (node.routes && node.routes.length > 0) {
608
623
  getTreeList(node.routes);
609
- } else {
610
- if (node.path === '/' || getLimitedMenuPath(node) || getGenerateDocs(node)) {
611
- treeList.push({
612
- tab: node.locale,
613
- key: node.path,
614
- locale: node.locale,
615
- closable: true,
616
- content: node.component,
617
- name: node.name,
618
- hideInMenu: node.hideInMenu,
619
- isOnlyOnePage: node.isOnlyOnePage,
620
- });
621
- }
624
+ return;
625
+ }
626
+ // todo:暂时处理非wujie环境不做404管控
627
+ if (!window.__POWERED_BY_WUJIE__) {
628
+ treeList.push({
629
+ tab: node.locale,
630
+ key: node.path,
631
+ locale: node.locale,
632
+ closable: true,
633
+ content: node.component,
634
+ name: node.name,
635
+ hideInMenu: node.hideInMenu,
636
+ isOnlyOnePage: node.isOnlyOnePage,
637
+ });
638
+ return;
639
+ }
640
+ if (node.path === '/' || getLimitedMenuPath(node) || getGenerateDocs(node)) {
641
+ treeList.push({
642
+ tab: node.locale,
643
+ key: node.path,
644
+ locale: node.locale,
645
+ closable: true,
646
+ content: node.component,
647
+ name: node.name,
648
+ hideInMenu: node.hideInMenu,
649
+ isOnlyOnePage: node.isOnlyOnePage,
650
+ });
622
651
  }
623
652
  });
624
653
  };