@bit-sun/business-component 2.4.31-alpha.1 → 2.4.31-alpha.3

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
@@ -17136,9 +17136,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
17136
17136
  };
17137
17137
  authMenuPathList = ((_getAuthMenuPathAndDo = getAuthMenuPathAndDocsId(props.pathToRegexp)) === null || _getAuthMenuPathAndDo === void 0 ? void 0 : _getAuthMenuPathAndDo.menuKeys) || [];
17138
17138
  docsId = ((_getAuthMenuPathAndDo2 = getAuthMenuPathAndDocsId(props.pathToRegexp)) === null || _getAuthMenuPathAndDo2 === void 0 ? void 0 : _getAuthMenuPathAndDo2.docsId) || [];
17139
- console.log('aaaaaaaa', authMenuPathList, docsId);
17140
17139
  routerArray = _this.updateTree(props.route.routes, authMenuPathList);
17141
- console.log('bbbbbbbb', routerArray);
17142
17140
  var homeRouter = routerArray.filter(function (itemroute) {
17143
17141
  return itemroute.key === '/';
17144
17142
  })[0];
@@ -17238,13 +17236,28 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
17238
17236
  hideMenuArray = _this2$state.hideMenuArray;
17239
17237
  var newListenRouterState = _toConsumableArray(listenRouterState);
17240
17238
  var newListenRouterKey = _toConsumableArray(listenRouterKey);
17239
+ /**
17240
+ * 根据给定的路由数组和当前路由信息,筛选出与当前路由匹配的路由项。
17241
+ *
17242
+ * @param routerArray 路由数组,包含多个路由项,每个路由项有一个键(key)。
17243
+ * @param route 当前的路由信息,包含路径(pathname)等信息。
17244
+ * @param docsId 通用单据ID的数组,用于进一步筛选路由。
17245
+ * @returns 返回与当前路由匹配的第一个路由项,如果没有匹配项则返回undefined。
17246
+ */
17241
17247
  var replaceRouter = routerArray.filter(function (itemRoute) {
17242
- var _route$pathname;
17243
- if ((_route$pathname = route.pathname) === null || _route$pathname === void 0 ? void 0 : _route$pathname.includes('all-general-documents')) {
17248
+ var _route$pathname, _route$pathname2;
17249
+ // 单独处理通用单据预览
17250
+ 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'))) {
17251
+ return pathToRegexp(itemRoute.key || '').test(route.pathname);
17252
+ }
17253
+ // 当路由路径包含'all-general-documents'时,按通用单据处理
17254
+ if ((_route$pathname2 = route.pathname) === null || _route$pathname2 === void 0 ? void 0 : _route$pathname2.includes('all-general-documents')) {
17255
+ // 检查路由路径是否匹配路由项的键,并且路径中包含至少一个通用单据ID
17244
17256
  return pathToRegexp(itemRoute.key || '').test(route.pathname) && docsId.some(function (item) {
17245
17257
  return route.pathname.includes(item);
17246
17258
  });
17247
17259
  }
17260
+ // 对于不包含'all-general-documents'的路径,只检查路由路径是否匹配路由项的键
17248
17261
  return pathToRegexp(itemRoute.key || '').test(route.pathname);
17249
17262
  })[0];
17250
17263
  var currentKey = '';
package/dist/index.js CHANGED
@@ -17156,9 +17156,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
17156
17156
  };
17157
17157
  authMenuPathList = ((_getAuthMenuPathAndDo = getAuthMenuPathAndDocsId(props.pathToRegexp)) === null || _getAuthMenuPathAndDo === void 0 ? void 0 : _getAuthMenuPathAndDo.menuKeys) || [];
17158
17158
  docsId = ((_getAuthMenuPathAndDo2 = getAuthMenuPathAndDocsId(props.pathToRegexp)) === null || _getAuthMenuPathAndDo2 === void 0 ? void 0 : _getAuthMenuPathAndDo2.docsId) || [];
17159
- console.log('aaaaaaaa', authMenuPathList, docsId);
17160
17159
  routerArray = _this.updateTree(props.route.routes, authMenuPathList);
17161
- console.log('bbbbbbbb', routerArray);
17162
17160
  var homeRouter = routerArray.filter(function (itemroute) {
17163
17161
  return itemroute.key === '/';
17164
17162
  })[0];
@@ -17258,13 +17256,28 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
17258
17256
  hideMenuArray = _this2$state.hideMenuArray;
17259
17257
  var newListenRouterState = _toConsumableArray(listenRouterState);
17260
17258
  var newListenRouterKey = _toConsumableArray(listenRouterKey);
17259
+ /**
17260
+ * 根据给定的路由数组和当前路由信息,筛选出与当前路由匹配的路由项。
17261
+ *
17262
+ * @param routerArray 路由数组,包含多个路由项,每个路由项有一个键(key)。
17263
+ * @param route 当前的路由信息,包含路径(pathname)等信息。
17264
+ * @param docsId 通用单据ID的数组,用于进一步筛选路由。
17265
+ * @returns 返回与当前路由匹配的第一个路由项,如果没有匹配项则返回undefined。
17266
+ */
17261
17267
  var replaceRouter = routerArray.filter(function (itemRoute) {
17262
- var _route$pathname;
17263
- if ((_route$pathname = route.pathname) === null || _route$pathname === void 0 ? void 0 : _route$pathname.includes('all-general-documents')) {
17268
+ var _route$pathname, _route$pathname2;
17269
+ // 单独处理通用单据预览
17270
+ 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'))) {
17271
+ return pathToRegexp(itemRoute.key || '').test(route.pathname);
17272
+ }
17273
+ // 当路由路径包含'all-general-documents'时,按通用单据处理
17274
+ if ((_route$pathname2 = route.pathname) === null || _route$pathname2 === void 0 ? void 0 : _route$pathname2.includes('all-general-documents')) {
17275
+ // 检查路由路径是否匹配路由项的键,并且路径中包含至少一个通用单据ID
17264
17276
  return pathToRegexp(itemRoute.key || '').test(route.pathname) && docsId.some(function (item) {
17265
17277
  return route.pathname.includes(item);
17266
17278
  });
17267
17279
  }
17280
+ // 对于不包含'all-general-documents'的路径,只检查路由路径是否匹配路由项的键
17268
17281
  return pathToRegexp(itemRoute.key || '').test(route.pathname);
17269
17282
  })[0];
17270
17283
  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.1",
3
+ "version": "2.4.31-alpha.3",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -330,9 +330,7 @@ class BasicLayout extends React.PureComponent {
330
330
  super(props);
331
331
  authMenuPathList = getAuthMenuPathAndDocsId(props.pathToRegexp)?.menuKeys || [];
332
332
  docsId = getAuthMenuPathAndDocsId(props.pathToRegexp)?.docsId || [];
333
- console.log('aaaaaaaa', authMenuPathList, docsId)
334
333
  routerArray = this.updateTree(props.route.routes, authMenuPathList);
335
- console.log('bbbbbbbb',routerArray)
336
334
  const homeRouter = routerArray.filter(
337
335
  (itemroute) => itemroute.key === '/',
338
336
  )[0];
@@ -436,10 +434,25 @@ class BasicLayout extends React.PureComponent {
436
434
  let newListenRouterState = [...listenRouterState];
437
435
  let newListenRouterKey = [...listenRouterKey];
438
436
 
437
+ /**
438
+ * 根据给定的路由数组和当前路由信息,筛选出与当前路由匹配的路由项。
439
+ *
440
+ * @param routerArray 路由数组,包含多个路由项,每个路由项有一个键(key)。
441
+ * @param route 当前的路由信息,包含路径(pathname)等信息。
442
+ * @param docsId 通用单据ID的数组,用于进一步筛选路由。
443
+ * @returns 返回与当前路由匹配的第一个路由项,如果没有匹配项则返回undefined。
444
+ */
439
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'时,按通用单据处理
440
451
  if (route.pathname?.includes('all-general-documents')) {
452
+ // 检查路由路径是否匹配路由项的键,并且路径中包含至少一个通用单据ID
441
453
  return pathToRegexp(itemRoute.key || '').test(route.pathname) && docsId.some(item => route.pathname.includes(item));
442
454
  }
455
+ // 对于不包含'all-general-documents'的路径,只检查路由路径是否匹配路由项的键
443
456
  return pathToRegexp(itemRoute.key || '').test(route.pathname);
444
457
  })[0];
445
458