@xfe-repo/web-components 1.2.3 → 1.2.5

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.js CHANGED
@@ -642,46 +642,44 @@ var MultiWindow = (0, import_react5.memo)(function(props) {
642
642
  var currentIsFromInternalRouter = isFromInternalNavigate.current;
643
643
  isFromInternalNavigate.current = false;
644
644
  if (currentStateRef.current.fullPath === fullPath) return;
645
- var _fullPath_split = _sliced_to_array(fullPath.split("?"), 2), path = _fullPath_split[0], tmp = _fullPath_split[1], search = tmp === void 0 ? "" : tmp;
646
- if (!path || path === "/") return;
645
+ var _fullPath_split = _sliced_to_array(fullPath.split("?"), 2), newPathKey = _fullPath_split[0], tmp = _fullPath_split[1], newPathSearch = tmp === void 0 ? "" : tmp;
646
+ if (!newPathKey || newPathKey === "/") return;
647
647
  var _currentStateRef_current = currentStateRef.current, pathKey2 = _currentStateRef_current.pathKey, prev = _currentStateRef_current.pagePaths;
648
648
  var newPagePaths = _to_consumable_array(prev);
649
649
  var newPagePath = {
650
650
  label: "加载中",
651
- key: path,
651
+ key: newPathKey,
652
652
  fullPath: fullPath
653
653
  };
654
654
  var pagePathIndex = prev.findIndex(function(item) {
655
- return item.key === path;
655
+ return item.key === newPathKey;
656
656
  });
657
657
  if (pagePathIndex !== -1) {
658
- var _contentRef_current;
659
658
  var prevPagePath = prev[pagePathIndex];
660
659
  Object.assign(newPagePath, prevPagePath || {});
661
660
  newPagePath.fullPath = fullPath;
662
661
  newPagePaths.splice(pagePathIndex, 1);
663
- if ((prevPagePath === null || prevPagePath === void 0 ? void 0 : prevPagePath.fullPath) !== fullPath) contentRef === null || contentRef === void 0 ? void 0 : (_contentRef_current = contentRef.current) === null || _contentRef_current === void 0 ? void 0 : _contentRef_current.refresh(path);
664
662
  }
665
663
  var targetPagePathIndex = pagePathIndex === -1 ? newPagePaths.length : pagePathIndex;
666
- if (!currentIsFromInternalRouter) {
667
- var currentPathIndex = prev.findIndex(function(item) {
664
+ if (!currentIsFromInternalRouter && pathKey2 !== newPathKey) {
665
+ var currentPathIndex = newPagePaths.findIndex(function(item) {
668
666
  return item.key === pathKey2;
669
667
  });
670
668
  if (currentPathIndex !== -1) targetPagePathIndex = currentPathIndex + 1;
671
669
  }
672
670
  newPagePaths.splice(targetPagePathIndex, 0, newPagePath);
673
- currentStateRef.current.pathKey = path;
671
+ currentStateRef.current.pathKey = newPathKey;
674
672
  currentStateRef.current.fullPath = fullPath;
675
673
  currentStateRef.current.collectionKey = "";
676
- var enableCollection = checkCanEnableCollection(path, collectionBlackList);
674
+ var enableCollection = checkCanEnableCollection(newPathKey, collectionBlackList);
677
675
  if (!enableCollection) {
678
676
  newPagePath.searchCollection = [];
679
677
  return handleUpdatePagePaths(newPagePaths);
680
678
  }
681
679
  var collection = newPagePath.searchCollection || [];
682
- var queryJson = import_tools.queryString.parse(search);
680
+ var queryJson = import_tools.queryString.parse(newPathSearch);
683
681
  if (queryJson.ts) delete queryJson.ts;
684
- var collectionKey2 = createSearchCollectionKey(search);
682
+ var collectionKey2 = createSearchCollectionKey(newPathSearch);
685
683
  if (!collectionKey2) return handleUpdatePagePaths(newPagePaths);
686
684
  var queryIndex = collection.findIndex(function(item) {
687
685
  return item === collectionKey2;
@@ -690,7 +688,7 @@ var MultiWindow = (0, import_react5.memo)(function(props) {
690
688
  collection.unshift(collectionKey2);
691
689
  if (collection.length > 10) collection.pop();
692
690
  newPagePath.searchCollection = collection;
693
- currentStateRef.current.collectionKey = "".concat(path, "?").concat(collectionKey2);
691
+ currentStateRef.current.collectionKey = "".concat(newPathKey, "?").concat(collectionKey2);
694
692
  handleUpdatePagePaths(newPagePaths);
695
693
  }, []);
696
694
  (0, import_react5.useEffect)(function() {
package/dist/index.mjs CHANGED
@@ -567,46 +567,44 @@ var MultiWindow = memo3(function(props) {
567
567
  var currentIsFromInternalRouter = isFromInternalNavigate.current;
568
568
  isFromInternalNavigate.current = false;
569
569
  if (currentStateRef.current.fullPath === fullPath) return;
570
- var _fullPath_split = _sliced_to_array(fullPath.split("?"), 2), path = _fullPath_split[0], tmp = _fullPath_split[1], search = tmp === void 0 ? "" : tmp;
571
- if (!path || path === "/") return;
570
+ var _fullPath_split = _sliced_to_array(fullPath.split("?"), 2), newPathKey = _fullPath_split[0], tmp = _fullPath_split[1], newPathSearch = tmp === void 0 ? "" : tmp;
571
+ if (!newPathKey || newPathKey === "/") return;
572
572
  var _currentStateRef_current = currentStateRef.current, pathKey2 = _currentStateRef_current.pathKey, prev = _currentStateRef_current.pagePaths;
573
573
  var newPagePaths = _to_consumable_array(prev);
574
574
  var newPagePath = {
575
575
  label: "加载中",
576
- key: path,
576
+ key: newPathKey,
577
577
  fullPath: fullPath
578
578
  };
579
579
  var pagePathIndex = prev.findIndex(function(item) {
580
- return item.key === path;
580
+ return item.key === newPathKey;
581
581
  });
582
582
  if (pagePathIndex !== -1) {
583
- var _contentRef_current;
584
583
  var prevPagePath = prev[pagePathIndex];
585
584
  Object.assign(newPagePath, prevPagePath || {});
586
585
  newPagePath.fullPath = fullPath;
587
586
  newPagePaths.splice(pagePathIndex, 1);
588
- if ((prevPagePath === null || prevPagePath === void 0 ? void 0 : prevPagePath.fullPath) !== fullPath) contentRef === null || contentRef === void 0 ? void 0 : (_contentRef_current = contentRef.current) === null || _contentRef_current === void 0 ? void 0 : _contentRef_current.refresh(path);
589
587
  }
590
588
  var targetPagePathIndex = pagePathIndex === -1 ? newPagePaths.length : pagePathIndex;
591
- if (!currentIsFromInternalRouter) {
592
- var currentPathIndex = prev.findIndex(function(item) {
589
+ if (!currentIsFromInternalRouter && pathKey2 !== newPathKey) {
590
+ var currentPathIndex = newPagePaths.findIndex(function(item) {
593
591
  return item.key === pathKey2;
594
592
  });
595
593
  if (currentPathIndex !== -1) targetPagePathIndex = currentPathIndex + 1;
596
594
  }
597
595
  newPagePaths.splice(targetPagePathIndex, 0, newPagePath);
598
- currentStateRef.current.pathKey = path;
596
+ currentStateRef.current.pathKey = newPathKey;
599
597
  currentStateRef.current.fullPath = fullPath;
600
598
  currentStateRef.current.collectionKey = "";
601
- var enableCollection = checkCanEnableCollection(path, collectionBlackList);
599
+ var enableCollection = checkCanEnableCollection(newPathKey, collectionBlackList);
602
600
  if (!enableCollection) {
603
601
  newPagePath.searchCollection = [];
604
602
  return handleUpdatePagePaths(newPagePaths);
605
603
  }
606
604
  var collection = newPagePath.searchCollection || [];
607
- var queryJson = queryString.parse(search);
605
+ var queryJson = queryString.parse(newPathSearch);
608
606
  if (queryJson.ts) delete queryJson.ts;
609
- var collectionKey2 = createSearchCollectionKey(search);
607
+ var collectionKey2 = createSearchCollectionKey(newPathSearch);
610
608
  if (!collectionKey2) return handleUpdatePagePaths(newPagePaths);
611
609
  var queryIndex = collection.findIndex(function(item) {
612
610
  return item === collectionKey2;
@@ -615,7 +613,7 @@ var MultiWindow = memo3(function(props) {
615
613
  collection.unshift(collectionKey2);
616
614
  if (collection.length > 10) collection.pop();
617
615
  newPagePath.searchCollection = collection;
618
- currentStateRef.current.collectionKey = "".concat(path, "?").concat(collectionKey2);
616
+ currentStateRef.current.collectionKey = "".concat(newPathKey, "?").concat(collectionKey2);
619
617
  handleUpdatePagePaths(newPagePaths);
620
618
  }, []);
621
619
  useEffect(function() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xfe-repo/web-components",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "module": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": [