@chaoswise/ui 2.7.9 → 2.7.11
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/lib/Antd3/es/date-picker/locale/ja_JP.js +1 -1
- package/lib/Antd3/es/locale/ja_JP.js +1 -1
- package/lib/Antd4/date-picker/locale/ja_JP.js +1 -1
- package/lib/Antd4/locale/ja_JP.js +1 -1
- package/lib/BasicLayout/index.js +3 -3
- package/lib/CWCascader/rc-cascader/OptionList/Column.js +18 -17
- package/lib/CWMessage/MessageContent/TabList/index.js +10 -10
- package/lib/CWMessage/MessageContent/index.js +28 -26
- package/lib/CWMessage/index.js +37 -34
- package/lib/CWRangePicker/index.js +11 -11
- package/lib/CWSelect/index.js +3 -3
- package/lib/CWTable/CWTable.js +26 -23
- package/lib/Card/index.less +10 -0
- package/lib/ConfigProvider/ConfigProvider.js +1 -0
- package/lib/DateRangePicker/RangeDateTimePicker.js +3 -3
- package/lib/DropdownDatePicker/index.js +3 -3
- package/lib/Empty/locale/ja_JP.js +1 -1
- package/lib/ErrorBoundary/index.less +15 -0
- package/lib/Header/TopNavigationMenu/index.js +173 -17
- package/lib/Header/TopNavigationMenu/index.less +91 -3
- package/lib/Header/index.less +3 -0
- package/lib/Joyride/index.js +3 -3
- package/lib/ModuleFederation/react-dynamic-remote-component/RemoteComponent.js +39 -38
- package/lib/ModuleFederation/react-dynamic-remote-component/load-module.js +23 -22
- package/lib/PolymerizationSearch/index.js +7 -7
- package/lib/QuickTransfer/index.js +13 -13
- package/lib/SearchBar/index.js +7 -7
- package/lib/SingleSpa/index.js +24 -22
- package/lib/TimeRangeSlider/TimeRangeSliderCmp/hooks/useMouse.js +3 -3
- package/lib/TimeRangeSlider/index.js +6 -6
- package/lib/TimeZoneSelect/index.js +22 -21
- package/package.json +1 -1
|
@@ -3,57 +3,213 @@ import _Icon from "@chaoswise/ui/lib/Icon";
|
|
|
3
3
|
import _Menu from "@chaoswise/ui/lib/Menu";
|
|
4
4
|
import "@chaoswise/ui/lib/TooltipText/index.less";
|
|
5
5
|
import _TooltipText from "@chaoswise/ui/lib/TooltipText";
|
|
6
|
-
|
|
6
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
7
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
9
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
10
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
11
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
12
|
+
import React, { useMemo, useRef, useEffect, useState, useCallback } from "react";
|
|
7
13
|
import classnames from "classnames";
|
|
8
14
|
import "./index.less";
|
|
9
|
-
// 产品直接在头部容器中展示
|
|
10
15
|
var TopNavigationMenu = function TopNavigationMenu(props) {
|
|
11
16
|
var topNavigation = props.topNavigation,
|
|
12
17
|
onClickTopNavigationSelf = props.onClickTopNavigationSelf,
|
|
13
18
|
topNavigationOption = props.topNavigationOption;
|
|
14
|
-
var _topNavigationOption$ = topNavigationOption.
|
|
15
|
-
|
|
16
|
-
_topNavigationOption$2 = topNavigationOption.activeKey,
|
|
17
|
-
activeKey = _topNavigationOption$2 === void 0 ? "" : _topNavigationOption$2,
|
|
19
|
+
var _topNavigationOption$ = topNavigationOption.activeKey,
|
|
20
|
+
activeKey = _topNavigationOption$ === void 0 ? "" : _topNavigationOption$,
|
|
18
21
|
moreOverlayClassName = topNavigationOption.moreOverlayClassName,
|
|
19
22
|
topNavigationWrapperClassName = topNavigationOption.topNavigationWrapperClassName;
|
|
20
23
|
var _activeKey = useMemo(function () {
|
|
21
24
|
return activeKey;
|
|
22
25
|
}, [activeKey]);
|
|
26
|
+
var wrapperRef = useRef(null);
|
|
27
|
+
var itemsRef = useRef([]);
|
|
28
|
+
var moreRef = useRef(null);
|
|
29
|
+
var _useState = useState(function () {
|
|
30
|
+
return (topNavigation === null || topNavigation === void 0 ? void 0 : topNavigation.length) || 0;
|
|
31
|
+
}),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
visibleCount = _useState2[0],
|
|
34
|
+
setVisibleCount = _useState2[1];
|
|
35
|
+
var resizeTimeoutRef = useRef(null);
|
|
36
|
+
var debouncedFnRef = useRef(null);
|
|
37
|
+
var itemWidthsRef = useRef(null);
|
|
38
|
+
var moreWidthRef = useRef(44);
|
|
39
|
+
var isMeasuredRef = useRef(false);
|
|
40
|
+
var measureItems = useCallback(function () {
|
|
41
|
+
if (!topNavigation || !topNavigation.length || !wrapperRef.current) return false;
|
|
42
|
+
var widths = [];
|
|
43
|
+
for (var i = 0; i < topNavigation.length; i++) {
|
|
44
|
+
var _itemsRef$current$i;
|
|
45
|
+
var rect = (_itemsRef$current$i = itemsRef.current[i]) === null || _itemsRef$current$i === void 0 ? void 0 : _itemsRef$current$i.getBoundingClientRect();
|
|
46
|
+
if (rect && rect.width > 0) {
|
|
47
|
+
widths.push(rect.width);
|
|
48
|
+
} else {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (widths.length === topNavigation.length) {
|
|
53
|
+
var _moreRef$current;
|
|
54
|
+
itemWidthsRef.current = widths;
|
|
55
|
+
var moreRect = (_moreRef$current = moreRef.current) === null || _moreRef$current === void 0 ? void 0 : _moreRef$current.getBoundingClientRect();
|
|
56
|
+
if (moreRect && moreRect.width > 0) {
|
|
57
|
+
moreWidthRef.current = moreRect.width;
|
|
58
|
+
}
|
|
59
|
+
isMeasuredRef.current = true;
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}, [topNavigation]);
|
|
64
|
+
var updateVisibleCount = useCallback(function () {
|
|
65
|
+
if (!topNavigation || !topNavigation.length || !wrapperRef.current) {
|
|
66
|
+
setVisibleCount((topNavigation === null || topNavigation === void 0 ? void 0 : topNavigation.length) || 0);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
var wrapper = wrapperRef.current;
|
|
70
|
+
var containerWidth = wrapper.getBoundingClientRect().width;
|
|
71
|
+
if (containerWidth <= 0) return;
|
|
72
|
+
if (!isMeasuredRef.current) {
|
|
73
|
+
var measured = measureItems();
|
|
74
|
+
if (!measured) return;
|
|
75
|
+
}
|
|
76
|
+
var moreTotalWidth = moreWidthRef.current + 16;
|
|
77
|
+
var safetyBuffer = 12;
|
|
78
|
+
var itemGap = 8;
|
|
79
|
+
var widths = itemWidthsRef.current;
|
|
80
|
+
if (!widths || widths.length !== topNavigation.length) return;
|
|
81
|
+
var cumulativeWidth = 0;
|
|
82
|
+
for (var i = 0; i < topNavigation.length; i++) {
|
|
83
|
+
cumulativeWidth += widths[i];
|
|
84
|
+
if (i < topNavigation.length - 1) {
|
|
85
|
+
cumulativeWidth += itemGap;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
var allItemsWidth = cumulativeWidth;
|
|
89
|
+
if (allItemsWidth + safetyBuffer <= containerWidth) {
|
|
90
|
+
setVisibleCount(topNavigation.length);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (allItemsWidth + moreTotalWidth + safetyBuffer <= containerWidth) {
|
|
94
|
+
setVisibleCount(topNavigation.length);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
for (var count = topNavigation.length - 1; count >= 0; count--) {
|
|
98
|
+
var itemsWidth = 0;
|
|
99
|
+
for (var _i = 0; _i < count; _i++) {
|
|
100
|
+
itemsWidth += widths[_i];
|
|
101
|
+
if (_i < count - 1) {
|
|
102
|
+
itemsWidth += itemGap;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
var totalWidth = itemsWidth + (count > 0 ? moreTotalWidth : 0) + safetyBuffer;
|
|
106
|
+
if (totalWidth <= containerWidth) {
|
|
107
|
+
setVisibleCount(count);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
setVisibleCount(0);
|
|
112
|
+
}, [topNavigation, measureItems]);
|
|
113
|
+
useEffect(function () {
|
|
114
|
+
if (!debouncedFnRef.current) {
|
|
115
|
+
debouncedFnRef.current = function () {
|
|
116
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
117
|
+
args[_key] = arguments[_key];
|
|
118
|
+
}
|
|
119
|
+
clearTimeout(resizeTimeoutRef.current);
|
|
120
|
+
resizeTimeoutRef.current = setTimeout(function () {
|
|
121
|
+
updateVisibleCount.apply(void 0, args);
|
|
122
|
+
}, 100);
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}, [updateVisibleCount]);
|
|
126
|
+
var attemptUpdateVisibleCount = useCallback(function () {
|
|
127
|
+
measureItems();
|
|
128
|
+
var attempts = 0;
|
|
129
|
+
var maxAttempts = 3;
|
|
130
|
+
var _tryUpdate = function tryUpdate() {
|
|
131
|
+
if (isMeasuredRef.current) {
|
|
132
|
+
var _debouncedFnRef$curre;
|
|
133
|
+
(_debouncedFnRef$curre = debouncedFnRef.current) === null || _debouncedFnRef$curre === void 0 || _debouncedFnRef$curre.call(debouncedFnRef);
|
|
134
|
+
} else if (attempts < maxAttempts) {
|
|
135
|
+
attempts++;
|
|
136
|
+
requestAnimationFrame(_tryUpdate);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
requestAnimationFrame(_tryUpdate);
|
|
140
|
+
}, [measureItems]);
|
|
141
|
+
useEffect(function () {
|
|
142
|
+
var timer = setTimeout(attemptUpdateVisibleCount, 100);
|
|
143
|
+
var resizeObserver;
|
|
144
|
+
if (typeof ResizeObserver !== "undefined" && wrapperRef.current) {
|
|
145
|
+
resizeObserver = new ResizeObserver(function () {
|
|
146
|
+
requestAnimationFrame(function () {
|
|
147
|
+
var _debouncedFnRef$curre2;
|
|
148
|
+
(_debouncedFnRef$curre2 = debouncedFnRef.current) === null || _debouncedFnRef$curre2 === void 0 || _debouncedFnRef$curre2.call(debouncedFnRef);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
resizeObserver.observe(wrapperRef.current);
|
|
152
|
+
}
|
|
153
|
+
var handleResize = function handleResize() {
|
|
154
|
+
var _debouncedFnRef$curre3;
|
|
155
|
+
(_debouncedFnRef$curre3 = debouncedFnRef.current) === null || _debouncedFnRef$curre3 === void 0 || _debouncedFnRef$curre3.call(debouncedFnRef);
|
|
156
|
+
};
|
|
157
|
+
window.addEventListener("resize", handleResize);
|
|
158
|
+
return function () {
|
|
159
|
+
clearTimeout(timer);
|
|
160
|
+
clearTimeout(resizeTimeoutRef.current);
|
|
161
|
+
if (resizeObserver) {
|
|
162
|
+
resizeObserver.disconnect();
|
|
163
|
+
}
|
|
164
|
+
window.removeEventListener("resize", handleResize);
|
|
165
|
+
};
|
|
166
|
+
}, [topNavigation, attemptUpdateVisibleCount]);
|
|
23
167
|
if (!topNavigation || !topNavigation.length) {
|
|
24
168
|
return null;
|
|
25
169
|
}
|
|
170
|
+
var hiddenItems = topNavigation.slice(visibleCount);
|
|
171
|
+
var hasHidden = hiddenItems.length > 0;
|
|
26
172
|
var menu = /*#__PURE__*/React.createElement(_Menu, {
|
|
27
173
|
selectable: true,
|
|
28
174
|
selectedKeys: [_activeKey]
|
|
29
|
-
},
|
|
175
|
+
}, hiddenItems.map(function (item) {
|
|
30
176
|
return /*#__PURE__*/React.createElement(_Menu.Item, {
|
|
177
|
+
key: item.value,
|
|
31
178
|
onClick: function onClick(_ref) {
|
|
32
179
|
var domEvent = _ref.domEvent;
|
|
33
|
-
onClickTopNavigationSelf(domEvent, item);
|
|
34
|
-
}
|
|
35
|
-
key: item.value
|
|
180
|
+
return onClickTopNavigationSelf(domEvent, item);
|
|
181
|
+
}
|
|
36
182
|
}, /*#__PURE__*/React.createElement(_TooltipText, null, item.name));
|
|
37
183
|
}));
|
|
184
|
+
var shouldShowAll = !isMeasuredRef.current;
|
|
38
185
|
return /*#__PURE__*/React.createElement("div", {
|
|
186
|
+
ref: wrapperRef,
|
|
39
187
|
className: classnames("cw-header-top-navigation-menu-wrapper", topNavigationWrapperClassName)
|
|
40
|
-
}, topNavigation.slice(0,
|
|
188
|
+
}, (shouldShowAll ? topNavigation : topNavigation.slice(0, visibleCount)).map(function (item, index) {
|
|
41
189
|
return /*#__PURE__*/React.createElement("div", {
|
|
42
190
|
key: item.value,
|
|
191
|
+
ref: function ref(el) {
|
|
192
|
+
itemsRef.current[index] = el;
|
|
193
|
+
},
|
|
43
194
|
onClick: function onClick(e) {
|
|
44
195
|
return onClickTopNavigationSelf(e, item);
|
|
45
196
|
},
|
|
46
197
|
className: classnames("cw-header-top-navigation-menu-item", {
|
|
47
198
|
"cw-header-top-navigation-menu-item-seleted": _activeKey === item.value
|
|
48
|
-
})
|
|
199
|
+
}),
|
|
200
|
+
style: shouldShowAll && index >= visibleCount ? {
|
|
201
|
+
visibility: 'hidden',
|
|
202
|
+
pointerEvents: 'none'
|
|
203
|
+
} : undefined
|
|
49
204
|
}, item.name);
|
|
50
|
-
}),
|
|
205
|
+
}), hasHidden && /*#__PURE__*/React.createElement("div", {
|
|
206
|
+
ref: moreRef,
|
|
207
|
+
className: "cw-header-top-navigation-menu-more-wrapper"
|
|
208
|
+
}, /*#__PURE__*/React.createElement(_Dropdown, {
|
|
51
209
|
overlay: menu,
|
|
52
210
|
overlayClassName: classnames(moreOverlayClassName)
|
|
53
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
54
|
-
className: "cw-header-top-navigation-menu-more-wrapper"
|
|
55
|
-
}, /*#__PURE__*/React.createElement(_Icon, {
|
|
211
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Icon, {
|
|
56
212
|
type: "ellipsis"
|
|
57
|
-
}))));
|
|
213
|
+
})))));
|
|
58
214
|
};
|
|
59
215
|
export default TopNavigationMenu;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
.cw-header-top-navigation-menu-wrapper {
|
|
2
|
+
flex: 1;
|
|
2
3
|
margin-left: 16px;
|
|
4
|
+
margin-right: 16px; // 与右侧区域保持对称间距
|
|
3
5
|
display: flex;
|
|
4
|
-
justify-content:
|
|
6
|
+
justify-content: flex-start;
|
|
5
7
|
align-items: center;
|
|
6
8
|
height: 20px;
|
|
7
9
|
font-size: 12px;
|
|
10
|
+
min-width: 0;
|
|
11
|
+
flex-wrap: nowrap;
|
|
12
|
+
position: relative;
|
|
13
|
+
|
|
14
|
+
// 确保容器有最小宽度,避免极端情况下的布局问题
|
|
15
|
+
min-width: 120px;
|
|
8
16
|
|
|
9
17
|
.cw-header-top-navigation-menu-item {
|
|
10
18
|
display: flex;
|
|
@@ -13,11 +21,19 @@
|
|
|
13
21
|
height: 20px;
|
|
14
22
|
line-height: 20px;
|
|
15
23
|
padding: 0 12px;
|
|
24
|
+
flex-shrink: 0;
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
transition: all 0.2s ease-in-out;
|
|
27
|
+
|
|
16
28
|
&:hover{
|
|
17
29
|
cursor: pointer;
|
|
30
|
+
transform: translateY(-1px);
|
|
18
31
|
}
|
|
32
|
+
|
|
19
33
|
&:not(.cw-header-top-navigation-menu-item-seleted):hover {
|
|
20
34
|
color: @primary-5;
|
|
35
|
+
background-color: fade(@primary-color, 10%);
|
|
36
|
+
border-radius: 10px;
|
|
21
37
|
}
|
|
22
38
|
|
|
23
39
|
&:not(:first-child) {
|
|
@@ -26,16 +42,88 @@
|
|
|
26
42
|
|
|
27
43
|
&.cw-header-top-navigation-menu-item-seleted {
|
|
28
44
|
background-color: @primary-color;
|
|
45
|
+
color: #fff;
|
|
29
46
|
font-weight: 500;
|
|
30
47
|
border-radius: 10px;
|
|
48
|
+
box-shadow: 0 2px 4px fade(@primary-color, 20%);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&.cw-header-top-navigation-menu-item-hidden {
|
|
52
|
+
visibility: hidden;
|
|
53
|
+
pointer-events: none;
|
|
31
54
|
}
|
|
32
55
|
}
|
|
33
56
|
|
|
34
57
|
.cw-header-top-navigation-menu-more-wrapper {
|
|
35
|
-
margin-left:
|
|
58
|
+
margin-left: 16px; // 减少间距,更美观
|
|
59
|
+
flex-shrink: 0;
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
width: 32px;
|
|
64
|
+
height: 32px;
|
|
65
|
+
border-radius: 6px;
|
|
66
|
+
transition: all 0.2s ease-in-out;
|
|
67
|
+
|
|
36
68
|
&:hover{
|
|
37
69
|
cursor: pointer;
|
|
38
70
|
color: @primary-5;
|
|
71
|
+
background-color: fade(@primary-color, 10%);
|
|
72
|
+
transform: translateY(-1px);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&.cw-header-top-navigation-menu-more-hidden {
|
|
76
|
+
display: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// 展开图标样式优化
|
|
80
|
+
.ant-dropdown-trigger {
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
width: 100%;
|
|
85
|
+
height: 100%;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// 响应式间距调整
|
|
90
|
+
@media (max-width: 768px) {
|
|
91
|
+
margin-left: 8px;
|
|
92
|
+
margin-right: 8px;
|
|
93
|
+
|
|
94
|
+
.cw-header-top-navigation-menu-item {
|
|
95
|
+
padding: 0 8px;
|
|
96
|
+
font-size: 11px;
|
|
97
|
+
|
|
98
|
+
&:not(:first-child) {
|
|
99
|
+
margin-left: 6px;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.cw-header-top-navigation-menu-more-wrapper {
|
|
104
|
+
margin-left: 12px;
|
|
105
|
+
width: 28px;
|
|
106
|
+
height: 28px;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@media (max-width: 480px) {
|
|
111
|
+
margin-left: 4px;
|
|
112
|
+
margin-right: 4px;
|
|
113
|
+
|
|
114
|
+
.cw-header-top-navigation-menu-item {
|
|
115
|
+
padding: 0 6px;
|
|
116
|
+
font-size: 10px;
|
|
117
|
+
|
|
118
|
+
&:not(:first-child) {
|
|
119
|
+
margin-left: 4px;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.cw-header-top-navigation-menu-more-wrapper {
|
|
124
|
+
margin-left: 8px;
|
|
125
|
+
width: 24px;
|
|
126
|
+
height: 24px;
|
|
39
127
|
}
|
|
40
128
|
}
|
|
41
|
-
}
|
|
129
|
+
}
|
package/lib/Header/index.less
CHANGED
package/lib/Joyride/index.js
CHANGED
|
@@ -79,9 +79,9 @@ function CWJoyride(_ref) {
|
|
|
79
79
|
run = _useState8[0],
|
|
80
80
|
setRun = _useState8[1];
|
|
81
81
|
var _useState9 = useState(false),
|
|
82
|
-
|
|
83
|
-
isClose =
|
|
84
|
-
setIsClose =
|
|
82
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
83
|
+
isClose = _useState10[0],
|
|
84
|
+
setIsClose = _useState10[1]; // 是否点击了关闭 关闭后停止指引但是不算完成
|
|
85
85
|
|
|
86
86
|
var _useLocale = _useLocale2(langConfig),
|
|
87
87
|
localeObj = _useLocale.langObj;
|
|
@@ -15,8 +15,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
15
15
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
16
16
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
17
17
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
18
|
-
function
|
|
19
|
-
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
18
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
20
19
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
21
20
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
22
21
|
import React, { useEffect, useState, useMemo, useCallback } from 'react';
|
|
@@ -36,30 +35,31 @@ export var getModule = function getModule(remoteModule) {
|
|
|
36
35
|
} else {
|
|
37
36
|
window.remoteModuleDictionary[id] = new Promise(function (resolve, reject) {
|
|
38
37
|
var asyncFunc = /*#__PURE__*/function () {
|
|
39
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
40
|
-
var _module
|
|
41
|
-
return
|
|
42
|
-
while (1) switch (_context.
|
|
38
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
39
|
+
var _module;
|
|
40
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
41
|
+
while (1) switch (_context.prev = _context.next) {
|
|
43
42
|
case 0:
|
|
44
|
-
_context.
|
|
45
|
-
_context.
|
|
43
|
+
_context.prev = 0;
|
|
44
|
+
_context.next = 3;
|
|
46
45
|
return attachScript(remoteModule);
|
|
47
|
-
case
|
|
48
|
-
_context.
|
|
46
|
+
case 3:
|
|
47
|
+
_context.next = 5;
|
|
49
48
|
return loadModule(remoteModule.url, remoteModule.scope, remoteModule.module)();
|
|
50
|
-
case
|
|
51
|
-
_module = _context.
|
|
49
|
+
case 5:
|
|
50
|
+
_module = _context.sent;
|
|
52
51
|
resolve(_module);
|
|
53
|
-
_context.
|
|
52
|
+
_context.next = 12;
|
|
54
53
|
break;
|
|
55
|
-
case
|
|
56
|
-
_context.
|
|
57
|
-
|
|
58
|
-
reject(
|
|
59
|
-
case
|
|
60
|
-
|
|
54
|
+
case 9:
|
|
55
|
+
_context.prev = 9;
|
|
56
|
+
_context.t0 = _context["catch"](0);
|
|
57
|
+
reject(_context.t0);
|
|
58
|
+
case 12:
|
|
59
|
+
case "end":
|
|
60
|
+
return _context.stop();
|
|
61
61
|
}
|
|
62
|
-
}, _callee, null, [[0,
|
|
62
|
+
}, _callee, null, [[0, 9]]);
|
|
63
63
|
}));
|
|
64
64
|
return function asyncFunc() {
|
|
65
65
|
return _ref.apply(this, arguments);
|
|
@@ -134,38 +134,39 @@ export var RemoteComponent = function RemoteComponent(props) {
|
|
|
134
134
|
// 通过mount函数注入组件所需属性
|
|
135
135
|
|
|
136
136
|
var getMountedProps = useCallback(/*#__PURE__*/function () {
|
|
137
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/
|
|
138
|
-
var _props
|
|
139
|
-
return
|
|
140
|
-
while (1) switch (_context2.
|
|
137
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(Component) {
|
|
138
|
+
var _props;
|
|
139
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
140
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
141
141
|
case 0:
|
|
142
|
-
_context2.
|
|
142
|
+
_context2.prev = 0;
|
|
143
143
|
if (!(Component.preMount && typeof Component.preMount === 'function')) {
|
|
144
|
-
_context2.
|
|
144
|
+
_context2.next = 6;
|
|
145
145
|
break;
|
|
146
146
|
}
|
|
147
|
-
_context2.
|
|
147
|
+
_context2.next = 4;
|
|
148
148
|
return Component.preMount(_objectSpread(_objectSpread({}, props), {}, {
|
|
149
149
|
loadScript: loadScript
|
|
150
150
|
}));
|
|
151
|
-
case
|
|
152
|
-
_props = _context2.
|
|
151
|
+
case 4:
|
|
152
|
+
_props = _context2.sent;
|
|
153
153
|
if (props) {
|
|
154
154
|
setChildProps(_props);
|
|
155
155
|
}
|
|
156
|
-
case
|
|
156
|
+
case 6:
|
|
157
157
|
setLoading(false);
|
|
158
|
-
_context2.
|
|
158
|
+
_context2.next = 13;
|
|
159
159
|
break;
|
|
160
|
-
case
|
|
161
|
-
_context2.
|
|
162
|
-
|
|
163
|
-
console.error(
|
|
160
|
+
case 9:
|
|
161
|
+
_context2.prev = 9;
|
|
162
|
+
_context2.t0 = _context2["catch"](0);
|
|
163
|
+
console.error(_context2.t0);
|
|
164
164
|
setHasError(true);
|
|
165
|
-
case
|
|
166
|
-
|
|
165
|
+
case 13:
|
|
166
|
+
case "end":
|
|
167
|
+
return _context2.stop();
|
|
167
168
|
}
|
|
168
|
-
}, _callee2, null, [[0,
|
|
169
|
+
}, _callee2, null, [[0, 9]]);
|
|
169
170
|
}));
|
|
170
171
|
return function (_x) {
|
|
171
172
|
return _ref2.apply(this, arguments);
|