@xfe-repo/web-components 1.2.3 → 1.2.6
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 +13 -21
- package/dist/index.mjs +14 -22
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -472,14 +472,7 @@ var TabItem = (0, import_react2.memo)(function(props) {
|
|
|
472
472
|
var collectionSelect = (0, import_react2.useMemo)(function() {
|
|
473
473
|
var _data_searchCollection;
|
|
474
474
|
if (!(data === null || data === void 0 ? void 0 : (_data_searchCollection = data.searchCollection) === null || _data_searchCollection === void 0 ? void 0 : _data_searchCollection.length)) return null;
|
|
475
|
-
if (!isActivated)
|
|
476
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Badge, {
|
|
477
|
-
className: MultiWindow_module_default.collection,
|
|
478
|
-
count: data.searchCollection.length,
|
|
479
|
-
color: "var(--ant-color-primary)",
|
|
480
|
-
size: "small"
|
|
481
|
-
}, data.key);
|
|
482
|
-
}
|
|
475
|
+
if (!isActivated) return null;
|
|
483
476
|
var options = data.searchCollection.map(function(item) {
|
|
484
477
|
return {
|
|
485
478
|
label: item,
|
|
@@ -492,6 +485,7 @@ var TabItem = (0, import_react2.memo)(function(props) {
|
|
|
492
485
|
options: options,
|
|
493
486
|
value: currentKey,
|
|
494
487
|
onChange: handleCollectionChange,
|
|
488
|
+
popupMatchSelectWidth: false,
|
|
495
489
|
size: "small",
|
|
496
490
|
showSearch: true,
|
|
497
491
|
placeholder: "请选择"
|
|
@@ -642,46 +636,44 @@ var MultiWindow = (0, import_react5.memo)(function(props) {
|
|
|
642
636
|
var currentIsFromInternalRouter = isFromInternalNavigate.current;
|
|
643
637
|
isFromInternalNavigate.current = false;
|
|
644
638
|
if (currentStateRef.current.fullPath === fullPath) return;
|
|
645
|
-
var _fullPath_split = _sliced_to_array(fullPath.split("?"), 2),
|
|
646
|
-
if (!
|
|
639
|
+
var _fullPath_split = _sliced_to_array(fullPath.split("?"), 2), newPathKey = _fullPath_split[0], tmp = _fullPath_split[1], newPathSearch = tmp === void 0 ? "" : tmp;
|
|
640
|
+
if (!newPathKey || newPathKey === "/") return;
|
|
647
641
|
var _currentStateRef_current = currentStateRef.current, pathKey2 = _currentStateRef_current.pathKey, prev = _currentStateRef_current.pagePaths;
|
|
648
642
|
var newPagePaths = _to_consumable_array(prev);
|
|
649
643
|
var newPagePath = {
|
|
650
644
|
label: "加载中",
|
|
651
|
-
key:
|
|
645
|
+
key: newPathKey,
|
|
652
646
|
fullPath: fullPath
|
|
653
647
|
};
|
|
654
648
|
var pagePathIndex = prev.findIndex(function(item) {
|
|
655
|
-
return item.key ===
|
|
649
|
+
return item.key === newPathKey;
|
|
656
650
|
});
|
|
657
651
|
if (pagePathIndex !== -1) {
|
|
658
|
-
var _contentRef_current;
|
|
659
652
|
var prevPagePath = prev[pagePathIndex];
|
|
660
653
|
Object.assign(newPagePath, prevPagePath || {});
|
|
661
654
|
newPagePath.fullPath = fullPath;
|
|
662
655
|
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
656
|
}
|
|
665
657
|
var targetPagePathIndex = pagePathIndex === -1 ? newPagePaths.length : pagePathIndex;
|
|
666
|
-
if (!currentIsFromInternalRouter) {
|
|
667
|
-
var currentPathIndex =
|
|
658
|
+
if (!currentIsFromInternalRouter && pathKey2 !== newPathKey) {
|
|
659
|
+
var currentPathIndex = newPagePaths.findIndex(function(item) {
|
|
668
660
|
return item.key === pathKey2;
|
|
669
661
|
});
|
|
670
662
|
if (currentPathIndex !== -1) targetPagePathIndex = currentPathIndex + 1;
|
|
671
663
|
}
|
|
672
664
|
newPagePaths.splice(targetPagePathIndex, 0, newPagePath);
|
|
673
|
-
currentStateRef.current.pathKey =
|
|
665
|
+
currentStateRef.current.pathKey = newPathKey;
|
|
674
666
|
currentStateRef.current.fullPath = fullPath;
|
|
675
667
|
currentStateRef.current.collectionKey = "";
|
|
676
|
-
var enableCollection = checkCanEnableCollection(
|
|
668
|
+
var enableCollection = checkCanEnableCollection(newPathKey, collectionBlackList);
|
|
677
669
|
if (!enableCollection) {
|
|
678
670
|
newPagePath.searchCollection = [];
|
|
679
671
|
return handleUpdatePagePaths(newPagePaths);
|
|
680
672
|
}
|
|
681
673
|
var collection = newPagePath.searchCollection || [];
|
|
682
|
-
var queryJson = import_tools.queryString.parse(
|
|
674
|
+
var queryJson = import_tools.queryString.parse(newPathSearch);
|
|
683
675
|
if (queryJson.ts) delete queryJson.ts;
|
|
684
|
-
var collectionKey2 = createSearchCollectionKey(
|
|
676
|
+
var collectionKey2 = createSearchCollectionKey(newPathSearch);
|
|
685
677
|
if (!collectionKey2) return handleUpdatePagePaths(newPagePaths);
|
|
686
678
|
var queryIndex = collection.findIndex(function(item) {
|
|
687
679
|
return item === collectionKey2;
|
|
@@ -690,7 +682,7 @@ var MultiWindow = (0, import_react5.memo)(function(props) {
|
|
|
690
682
|
collection.unshift(collectionKey2);
|
|
691
683
|
if (collection.length > 10) collection.pop();
|
|
692
684
|
newPagePath.searchCollection = collection;
|
|
693
|
-
currentStateRef.current.collectionKey = "".concat(
|
|
685
|
+
currentStateRef.current.collectionKey = "".concat(newPathKey, "?").concat(collectionKey2);
|
|
694
686
|
handleUpdatePagePaths(newPagePaths);
|
|
695
687
|
}, []);
|
|
696
688
|
(0, import_react5.useEffect)(function() {
|
package/dist/index.mjs
CHANGED
|
@@ -276,7 +276,7 @@ import { Button as Button2, ConfigProvider, Popconfirm, Tooltip as Tooltip2 } fr
|
|
|
276
276
|
import { CloseOutlined, QuestionCircleOutlined, RedoOutlined } from "@ant-design/icons";
|
|
277
277
|
// src/MultiWindow/MultiWindowTabs.tsx
|
|
278
278
|
import React2, { memo, useCallback, useMemo } from "react";
|
|
279
|
-
import { Tabs, Select
|
|
279
|
+
import { Tabs, Select } from "antd";
|
|
280
280
|
import { closestCenter, DndContext, PointerSensor, useSensor } from "@dnd-kit/core";
|
|
281
281
|
import { arrayMove, horizontalListSortingStrategy, SortableContext, useSortable } from "@dnd-kit/sortable";
|
|
282
282
|
import { restrictToHorizontalAxis } from "@dnd-kit/modifiers";
|
|
@@ -397,14 +397,7 @@ var TabItem = memo(function(props) {
|
|
|
397
397
|
var collectionSelect = useMemo(function() {
|
|
398
398
|
var _data_searchCollection;
|
|
399
399
|
if (!(data === null || data === void 0 ? void 0 : (_data_searchCollection = data.searchCollection) === null || _data_searchCollection === void 0 ? void 0 : _data_searchCollection.length)) return null;
|
|
400
|
-
if (!isActivated)
|
|
401
|
-
return /* @__PURE__ */ jsx2(Badge, {
|
|
402
|
-
className: MultiWindow_module_default.collection,
|
|
403
|
-
count: data.searchCollection.length,
|
|
404
|
-
color: "var(--ant-color-primary)",
|
|
405
|
-
size: "small"
|
|
406
|
-
}, data.key);
|
|
407
|
-
}
|
|
400
|
+
if (!isActivated) return null;
|
|
408
401
|
var options = data.searchCollection.map(function(item) {
|
|
409
402
|
return {
|
|
410
403
|
label: item,
|
|
@@ -417,6 +410,7 @@ var TabItem = memo(function(props) {
|
|
|
417
410
|
options: options,
|
|
418
411
|
value: currentKey,
|
|
419
412
|
onChange: handleCollectionChange,
|
|
413
|
+
popupMatchSelectWidth: false,
|
|
420
414
|
size: "small",
|
|
421
415
|
showSearch: true,
|
|
422
416
|
placeholder: "请选择"
|
|
@@ -567,46 +561,44 @@ var MultiWindow = memo3(function(props) {
|
|
|
567
561
|
var currentIsFromInternalRouter = isFromInternalNavigate.current;
|
|
568
562
|
isFromInternalNavigate.current = false;
|
|
569
563
|
if (currentStateRef.current.fullPath === fullPath) return;
|
|
570
|
-
var _fullPath_split = _sliced_to_array(fullPath.split("?"), 2),
|
|
571
|
-
if (!
|
|
564
|
+
var _fullPath_split = _sliced_to_array(fullPath.split("?"), 2), newPathKey = _fullPath_split[0], tmp = _fullPath_split[1], newPathSearch = tmp === void 0 ? "" : tmp;
|
|
565
|
+
if (!newPathKey || newPathKey === "/") return;
|
|
572
566
|
var _currentStateRef_current = currentStateRef.current, pathKey2 = _currentStateRef_current.pathKey, prev = _currentStateRef_current.pagePaths;
|
|
573
567
|
var newPagePaths = _to_consumable_array(prev);
|
|
574
568
|
var newPagePath = {
|
|
575
569
|
label: "加载中",
|
|
576
|
-
key:
|
|
570
|
+
key: newPathKey,
|
|
577
571
|
fullPath: fullPath
|
|
578
572
|
};
|
|
579
573
|
var pagePathIndex = prev.findIndex(function(item) {
|
|
580
|
-
return item.key ===
|
|
574
|
+
return item.key === newPathKey;
|
|
581
575
|
});
|
|
582
576
|
if (pagePathIndex !== -1) {
|
|
583
|
-
var _contentRef_current;
|
|
584
577
|
var prevPagePath = prev[pagePathIndex];
|
|
585
578
|
Object.assign(newPagePath, prevPagePath || {});
|
|
586
579
|
newPagePath.fullPath = fullPath;
|
|
587
580
|
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
581
|
}
|
|
590
582
|
var targetPagePathIndex = pagePathIndex === -1 ? newPagePaths.length : pagePathIndex;
|
|
591
|
-
if (!currentIsFromInternalRouter) {
|
|
592
|
-
var currentPathIndex =
|
|
583
|
+
if (!currentIsFromInternalRouter && pathKey2 !== newPathKey) {
|
|
584
|
+
var currentPathIndex = newPagePaths.findIndex(function(item) {
|
|
593
585
|
return item.key === pathKey2;
|
|
594
586
|
});
|
|
595
587
|
if (currentPathIndex !== -1) targetPagePathIndex = currentPathIndex + 1;
|
|
596
588
|
}
|
|
597
589
|
newPagePaths.splice(targetPagePathIndex, 0, newPagePath);
|
|
598
|
-
currentStateRef.current.pathKey =
|
|
590
|
+
currentStateRef.current.pathKey = newPathKey;
|
|
599
591
|
currentStateRef.current.fullPath = fullPath;
|
|
600
592
|
currentStateRef.current.collectionKey = "";
|
|
601
|
-
var enableCollection = checkCanEnableCollection(
|
|
593
|
+
var enableCollection = checkCanEnableCollection(newPathKey, collectionBlackList);
|
|
602
594
|
if (!enableCollection) {
|
|
603
595
|
newPagePath.searchCollection = [];
|
|
604
596
|
return handleUpdatePagePaths(newPagePaths);
|
|
605
597
|
}
|
|
606
598
|
var collection = newPagePath.searchCollection || [];
|
|
607
|
-
var queryJson = queryString.parse(
|
|
599
|
+
var queryJson = queryString.parse(newPathSearch);
|
|
608
600
|
if (queryJson.ts) delete queryJson.ts;
|
|
609
|
-
var collectionKey2 = createSearchCollectionKey(
|
|
601
|
+
var collectionKey2 = createSearchCollectionKey(newPathSearch);
|
|
610
602
|
if (!collectionKey2) return handleUpdatePagePaths(newPagePaths);
|
|
611
603
|
var queryIndex = collection.findIndex(function(item) {
|
|
612
604
|
return item === collectionKey2;
|
|
@@ -615,7 +607,7 @@ var MultiWindow = memo3(function(props) {
|
|
|
615
607
|
collection.unshift(collectionKey2);
|
|
616
608
|
if (collection.length > 10) collection.pop();
|
|
617
609
|
newPagePath.searchCollection = collection;
|
|
618
|
-
currentStateRef.current.collectionKey = "".concat(
|
|
610
|
+
currentStateRef.current.collectionKey = "".concat(newPathKey, "?").concat(collectionKey2);
|
|
619
611
|
handleUpdatePagePaths(newPagePaths);
|
|
620
612
|
}, []);
|
|
621
613
|
useEffect(function() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xfe-repo/web-components",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"module": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"sideEffects": [
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"antd": "^5.24.5",
|
|
44
44
|
"react": "18.2.0",
|
|
45
45
|
"react-dom": "18.2.0",
|
|
46
|
-
"@xfe-repo/web-
|
|
47
|
-
"@xfe-repo/web-
|
|
46
|
+
"@xfe-repo/web-utils": "1.3.7",
|
|
47
|
+
"@xfe-repo/web-micro": "1.2.5"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"registry": "https://registry.npmjs.org/"
|