@bit-sun/business-component 4.2.5-per-alpha.1 → 4.2.5-per-alpha.2
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 +98 -264
- package/dist/index.js +98 -264
- package/package.json +1 -1
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +94 -25
- package/src/components/Business/BsLayouts/index.tsx +11 -261
- package/src/components/Business/BsSulaQueryTable/index.tsx +5 -2
package/dist/index.esm.js
CHANGED
|
@@ -20310,7 +20310,7 @@ var BsSulaQueryTable = (function (props) {
|
|
|
20310
20310
|
* ]
|
|
20311
20311
|
* @returns []
|
|
20312
20312
|
*/
|
|
20313
|
-
var getTableSummaryInfo = function
|
|
20313
|
+
var getTableSummaryInfo = useCallback(function () {
|
|
20314
20314
|
var summaryList = props.summaryList,
|
|
20315
20315
|
rowSelection = props.rowSelection,
|
|
20316
20316
|
expandable = props.expandable;
|
|
@@ -20353,7 +20353,7 @@ var BsSulaQueryTable = (function (props) {
|
|
|
20353
20353
|
} else {
|
|
20354
20354
|
return undefined;
|
|
20355
20355
|
}
|
|
20356
|
-
};
|
|
20356
|
+
}, [props.summaryList, props.rowSelection, props.expandable, showColumn]);
|
|
20357
20357
|
var columnsDom = /*#__PURE__*/React$1.createElement("span", {
|
|
20358
20358
|
className: "ant-dropdown-link"
|
|
20359
20359
|
}, /*#__PURE__*/React$1.createElement("div", {
|
|
@@ -20383,7 +20383,7 @@ var BsSulaQueryTable = (function (props) {
|
|
|
20383
20383
|
columnsDom: columnsDom,
|
|
20384
20384
|
queryFieldsDom: queryFieldsDom
|
|
20385
20385
|
});
|
|
20386
|
-
}, [checkedList, showColumn, props.statusMapping, showSearchFields, expandedRowKeys]);
|
|
20386
|
+
}, [checkedList, showColumn, props.statusMapping, showSearchFields, expandedRowKeys, getTableSummaryInfo, props.summaryList, props.summary]);
|
|
20387
20387
|
return /*#__PURE__*/React$1.createElement("div", {
|
|
20388
20388
|
data: "bssulaquerydatadiv",
|
|
20389
20389
|
id: "bs-sula-query-table"
|
|
@@ -22359,6 +22359,11 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22359
22359
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
22360
22360
|
showScroll = _useState16[0],
|
|
22361
22361
|
setShowScroll = _useState16[1];
|
|
22362
|
+
// 添加refs来跟踪组件状态和清理资源
|
|
22363
|
+
var isUnmountedRef = useRef(false);
|
|
22364
|
+
var timeoutRef = useRef(null);
|
|
22365
|
+
var resizeHandlerRef = useRef(null);
|
|
22366
|
+
var debounceTimerRef = useRef(null);
|
|
22362
22367
|
useEffect(function () {
|
|
22363
22368
|
var _originRoutes$find;
|
|
22364
22369
|
getMenuContentHeight();
|
|
@@ -22382,24 +22387,58 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22382
22387
|
sethomepageData(homepageDataList);
|
|
22383
22388
|
setroutesData(routesDataList);
|
|
22384
22389
|
setAuthorityMenu(authorityMenuList);
|
|
22385
|
-
|
|
22386
|
-
|
|
22390
|
+
// 创建resize处理函数并保存引用
|
|
22391
|
+
var handleResize = function handleResize() {
|
|
22392
|
+
if (!isUnmountedRef.current) {
|
|
22393
|
+
getMenuContentHeight();
|
|
22394
|
+
}
|
|
22395
|
+
};
|
|
22396
|
+
resizeHandlerRef.current = handleResize;
|
|
22397
|
+
window.addEventListener('resize', handleResize);
|
|
22398
|
+
// 清理函数
|
|
22399
|
+
return function () {
|
|
22400
|
+
isUnmountedRef.current = true;
|
|
22401
|
+
if (resizeHandlerRef.current) {
|
|
22402
|
+
window.removeEventListener('resize', resizeHandlerRef.current);
|
|
22403
|
+
resizeHandlerRef.current = null;
|
|
22404
|
+
}
|
|
22405
|
+
if (timeoutRef.current) {
|
|
22406
|
+
clearTimeout(timeoutRef.current);
|
|
22407
|
+
timeoutRef.current = null;
|
|
22408
|
+
}
|
|
22409
|
+
if (debounceTimerRef.current) {
|
|
22410
|
+
clearTimeout(debounceTimerRef.current);
|
|
22411
|
+
debounceTimerRef.current = null;
|
|
22412
|
+
}
|
|
22387
22413
|
};
|
|
22388
22414
|
}, []);
|
|
22389
22415
|
useLayoutEffect(function () {
|
|
22390
|
-
setTimeout(function () {
|
|
22391
|
-
|
|
22392
|
-
|
|
22393
|
-
|
|
22416
|
+
timeoutRef.current = setTimeout(function () {
|
|
22417
|
+
if (!isUnmountedRef.current) {
|
|
22418
|
+
var drawContentElement = document.getElementById("drawContent");
|
|
22419
|
+
if (drawContentElement) {
|
|
22420
|
+
var drawContentHeight = drawContentElement.scrollHeight;
|
|
22421
|
+
if (drawContentHeight > rightMenuHeight) {
|
|
22422
|
+
setMoreBtnShow(true);
|
|
22423
|
+
}
|
|
22424
|
+
}
|
|
22394
22425
|
}
|
|
22395
22426
|
}, 0);
|
|
22427
|
+
return function () {
|
|
22428
|
+
if (timeoutRef.current) {
|
|
22429
|
+
clearTimeout(timeoutRef.current);
|
|
22430
|
+
timeoutRef.current = null;
|
|
22431
|
+
}
|
|
22432
|
+
};
|
|
22433
|
+
}, [rightMenuHeight]);
|
|
22434
|
+
var getMenuContentHeight = useCallback(function () {
|
|
22435
|
+
if (!isUnmountedRef.current) {
|
|
22436
|
+
var clientHeight = document.body.clientHeight;
|
|
22437
|
+
setHeight(clientHeight - 190);
|
|
22438
|
+
setDrawHeight(clientHeight - 70);
|
|
22439
|
+
}
|
|
22396
22440
|
}, []);
|
|
22397
|
-
var
|
|
22398
|
-
var clientHeight = document.body.clientHeight;
|
|
22399
|
-
setHeight(clientHeight - 190);
|
|
22400
|
-
setDrawHeight(clientHeight - 70);
|
|
22401
|
-
};
|
|
22402
|
-
var _renderChildItem = function renderChildItem(child) {
|
|
22441
|
+
var renderChildItem = useCallback(function (child) {
|
|
22403
22442
|
if (!child.hideInMenu && child.children) {
|
|
22404
22443
|
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(List.Item, {
|
|
22405
22444
|
style: {
|
|
@@ -22409,7 +22448,7 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22409
22448
|
}, formatMessage({
|
|
22410
22449
|
id: "".concat(child.locale)
|
|
22411
22450
|
})), child.children.map(function (menuItem) {
|
|
22412
|
-
return
|
|
22451
|
+
return renderChildItem(menuItem);
|
|
22413
22452
|
}));
|
|
22414
22453
|
} else if (!child.hideInMenu && child.path) {
|
|
22415
22454
|
return /*#__PURE__*/React$1.createElement(List.Item, {
|
|
@@ -22437,8 +22476,9 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22437
22476
|
src: right
|
|
22438
22477
|
})));
|
|
22439
22478
|
}
|
|
22440
|
-
};
|
|
22441
|
-
var onMenuClick = function
|
|
22479
|
+
}, [onMenuClick]);
|
|
22480
|
+
var onMenuClick = useCallback(function (e, item) {
|
|
22481
|
+
if (isUnmountedRef.current) return;
|
|
22442
22482
|
e.stopPropagation();
|
|
22443
22483
|
e.preventDefault();
|
|
22444
22484
|
var searchHistory = JSON.parse(localStorage.getItem("".concat(itemPath, "_search_history")) || '[]');
|
|
@@ -22463,7 +22503,23 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22463
22503
|
pathname: item.path
|
|
22464
22504
|
});
|
|
22465
22505
|
onClose();
|
|
22466
|
-
};
|
|
22506
|
+
}, [itemPath, onClose]);
|
|
22507
|
+
// 创建debounce搜索函数
|
|
22508
|
+
var debouncedSearch = useCallback(function (value) {
|
|
22509
|
+
if (debounceTimerRef.current) {
|
|
22510
|
+
clearTimeout(debounceTimerRef.current);
|
|
22511
|
+
}
|
|
22512
|
+
debounceTimerRef.current = setTimeout(function () {
|
|
22513
|
+
if (!isUnmountedRef.current) {
|
|
22514
|
+
searchMenuData(authorityMenu, value, setSearchMenuData);
|
|
22515
|
+
}
|
|
22516
|
+
}, 600);
|
|
22517
|
+
}, [authorityMenu]);
|
|
22518
|
+
var handleSearchChange = useCallback(function (e) {
|
|
22519
|
+
if (!isUnmountedRef.current) {
|
|
22520
|
+
debouncedSearch(e.target.value);
|
|
22521
|
+
}
|
|
22522
|
+
}, [debouncedSearch]);
|
|
22467
22523
|
var searchHistoryList = JSON.parse(localStorage.getItem("".concat(itemPath, "_search_history")) || '[]');
|
|
22468
22524
|
return /*#__PURE__*/React$1.createElement("div", {
|
|
22469
22525
|
style: {
|
|
@@ -22482,6 +22538,7 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22482
22538
|
color: currentOneLevel === item.path ? '#005cff' : '#000000'
|
|
22483
22539
|
},
|
|
22484
22540
|
onClick: function onClick(e) {
|
|
22541
|
+
if (isUnmountedRef.current) return;
|
|
22485
22542
|
e.stopPropagation();
|
|
22486
22543
|
e.preventDefault();
|
|
22487
22544
|
if (item.component) {
|
|
@@ -22503,7 +22560,9 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22503
22560
|
}
|
|
22504
22561
|
}, /*#__PURE__*/React$1.createElement("img", {
|
|
22505
22562
|
onClick: function onClick() {
|
|
22506
|
-
|
|
22563
|
+
if (!isUnmountedRef.current) {
|
|
22564
|
+
onClose();
|
|
22565
|
+
}
|
|
22507
22566
|
},
|
|
22508
22567
|
style: {
|
|
22509
22568
|
position: 'absolute',
|
|
@@ -22528,9 +22587,7 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22528
22587
|
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD",
|
|
22529
22588
|
allowClear: true,
|
|
22530
22589
|
prefix: /*#__PURE__*/React$1.createElement(SearchOutlined, null),
|
|
22531
|
-
onChange:
|
|
22532
|
-
searchMenuData(authorityMenu, e.target.value, setSearchMenuData);
|
|
22533
|
-
}, 600)
|
|
22590
|
+
onChange: handleSearchChange
|
|
22534
22591
|
}), /*#__PURE__*/React$1.createElement("div", {
|
|
22535
22592
|
style: {
|
|
22536
22593
|
marginTop: '10px'
|
|
@@ -22556,7 +22613,9 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22556
22613
|
}, SearhData.map(function (item) {
|
|
22557
22614
|
return /*#__PURE__*/React$1.createElement("div", {
|
|
22558
22615
|
onClick: function onClick(e) {
|
|
22559
|
-
|
|
22616
|
+
if (!isUnmountedRef.current) {
|
|
22617
|
+
onMenuClick(e, item);
|
|
22618
|
+
}
|
|
22560
22619
|
},
|
|
22561
22620
|
key: item.path
|
|
22562
22621
|
}, item.name);
|
|
@@ -22613,7 +22672,7 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22613
22672
|
bordered: true,
|
|
22614
22673
|
dataSource: item.children,
|
|
22615
22674
|
renderItem: function renderItem(child) {
|
|
22616
|
-
return
|
|
22675
|
+
return renderChildItem(child);
|
|
22617
22676
|
}
|
|
22618
22677
|
});
|
|
22619
22678
|
})), /*#__PURE__*/React$1.createElement("div", {
|
|
@@ -22628,8 +22687,10 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22628
22687
|
}
|
|
22629
22688
|
}, /*#__PURE__*/React$1.createElement("span", {
|
|
22630
22689
|
onClick: function onClick() {
|
|
22631
|
-
|
|
22632
|
-
|
|
22690
|
+
if (!isUnmountedRef.current) {
|
|
22691
|
+
setShowScroll(true);
|
|
22692
|
+
setMoreBtnShow(false);
|
|
22693
|
+
}
|
|
22633
22694
|
},
|
|
22634
22695
|
style: {
|
|
22635
22696
|
color: '#8c8c8c'
|
|
@@ -23050,131 +23111,8 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23050
23111
|
_this.onEdit = function (targetKey, action) {
|
|
23051
23112
|
_this.tabActions[action](targetKey);
|
|
23052
23113
|
};
|
|
23053
|
-
// DOM节点计数辅助函数
|
|
23054
|
-
_this.countTabPaneDOMNodes = function () {
|
|
23055
|
-
var tabPanes = document.querySelectorAll('.ant-tabs-tabpane');
|
|
23056
|
-
var globalTabsTabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane');
|
|
23057
|
-
var activeTabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane-active');
|
|
23058
|
-
var hiddenTabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane:not(.ant-tabs-tabpane-active)');
|
|
23059
|
-
console.log("[DOM\u8BA1\u6570] \u5168\u5C40TabPane\u8282\u70B9\u6570: ".concat(tabPanes.length, ", globalTabs\u5185TabPane\u8282\u70B9\u6570: ").concat(globalTabsTabPanes.length));
|
|
23060
|
-
console.log("[DOM\u8BA1\u6570] \u6D3B\u8DC3TabPane\u8282\u70B9\u6570: ".concat(activeTabPanes.length, ", \u975E\u6D3B\u8DC3TabPane\u8282\u70B9\u6570: ").concat(hiddenTabPanes.length));
|
|
23061
|
-
// 详细列出每个TabPane的key和状态
|
|
23062
|
-
globalTabsTabPanes.forEach(function (pane, index) {
|
|
23063
|
-
var isActive = pane.classList.contains('ant-tabs-tabpane-active');
|
|
23064
|
-
var key = pane.getAttribute('data-node-key') || pane.id || "\u672A\u77E5-".concat(index);
|
|
23065
|
-
console.log("[DOM\u8BE6\u60C5] TabPane ".concat(index + 1, ": key=").concat(key, ", \u6D3B\u8DC3=").concat(isActive));
|
|
23066
|
-
});
|
|
23067
|
-
return {
|
|
23068
|
-
total: tabPanes.length,
|
|
23069
|
-
globalTabs: globalTabsTabPanes.length,
|
|
23070
|
-
active: activeTabPanes.length,
|
|
23071
|
-
hidden: hiddenTabPanes.length
|
|
23072
|
-
};
|
|
23073
|
-
};
|
|
23074
|
-
// 测试方法:验证页签删除后DOM状态
|
|
23075
|
-
_this.testTabDeletion = function () {
|
|
23076
|
-
console.log('=== 页签删除测试开始 ===');
|
|
23077
|
-
console.log('当前页签状态:', _this.state.listenRouterState.map(function (item) {
|
|
23078
|
-
return item.key;
|
|
23079
|
-
}));
|
|
23080
|
-
console.log('当前活跃页签:', _this.state.activeKey);
|
|
23081
|
-
_this.countTabPaneDOMNodes();
|
|
23082
|
-
// 提供删除建议
|
|
23083
|
-
var listenRouterState = _this.state.listenRouterState;
|
|
23084
|
-
if (listenRouterState.length > 1) {
|
|
23085
|
-
var _listenRouterState$fi;
|
|
23086
|
-
var testKey = (_listenRouterState$fi = listenRouterState.find(function (item) {
|
|
23087
|
-
return item.key !== '/';
|
|
23088
|
-
})) === null || _listenRouterState$fi === void 0 ? void 0 : _listenRouterState$fi.key;
|
|
23089
|
-
if (testKey) {
|
|
23090
|
-
console.log("\u5EFA\u8BAE\u6D4B\u8BD5\uFF1A\u5220\u9664\u9875\u7B7E ".concat(testKey));
|
|
23091
|
-
console.log("\u6267\u884C\u547D\u4EE4\uFF1Awindow.testDeleteTab('".concat(testKey, "')"));
|
|
23092
|
-
}
|
|
23093
|
-
}
|
|
23094
|
-
console.log('=== 页签删除测试结束 ===');
|
|
23095
|
-
};
|
|
23096
|
-
// 强制清理DOM节点的方法
|
|
23097
|
-
_this.forceCleanupDOM = function () {
|
|
23098
|
-
console.log('[强制清理] 开始强制清理DOM节点...');
|
|
23099
|
-
var beforeCount = _this.countTabPaneDOMNodes();
|
|
23100
|
-
console.log("[\u5F3A\u5236\u6E05\u7406] \u6E05\u7406\u524DDOM\u8282\u70B9\u6570: ".concat(beforeCount.total));
|
|
23101
|
-
// 强制垃圾回收
|
|
23102
|
-
if (window.gc) {
|
|
23103
|
-
window.gc();
|
|
23104
|
-
console.log('[强制清理] 已触发垃圾回收');
|
|
23105
|
-
}
|
|
23106
|
-
// 清理所有可能的引用
|
|
23107
|
-
var tabsContainer = document.getElementById('globalTabs');
|
|
23108
|
-
if (tabsContainer) {
|
|
23109
|
-
var tabPanes = tabsContainer.querySelectorAll('.ant-tabs-tabpane');
|
|
23110
|
-
tabPanes.forEach(function (pane, index) {
|
|
23111
|
-
if (pane.style.display === 'none' || pane.getAttribute('aria-hidden') === 'true') {
|
|
23112
|
-
var _pane$parentNode;
|
|
23113
|
-
console.log("[\u5F3A\u5236\u6E05\u7406] \u53D1\u73B0\u9690\u85CF\u7684TabPane\u8282\u70B9 ".concat(index, ", \u5C1D\u8BD5\u6E05\u7406..."));
|
|
23114
|
-
// 清理事件监听器
|
|
23115
|
-
var clone = pane.cloneNode(true);
|
|
23116
|
-
(_pane$parentNode = pane.parentNode) === null || _pane$parentNode === void 0 ? void 0 : _pane$parentNode.replaceChild(clone, pane);
|
|
23117
|
-
}
|
|
23118
|
-
});
|
|
23119
|
-
}
|
|
23120
|
-
setTimeout(function () {
|
|
23121
|
-
var afterCount = _this.countTabPaneDOMNodes();
|
|
23122
|
-
console.log("[\u5F3A\u5236\u6E05\u7406] \u6E05\u7406\u540EDOM\u8282\u70B9\u6570: ".concat(afterCount.total));
|
|
23123
|
-
console.log("[\u5F3A\u5236\u6E05\u7406] DOM\u8282\u70B9\u51CF\u5C11: ".concat(beforeCount.total - afterCount.total));
|
|
23124
|
-
}, 200);
|
|
23125
|
-
};
|
|
23126
|
-
// 分析内存泄漏的方法
|
|
23127
|
-
_this.analyzeMemoryLeaks = function () {
|
|
23128
|
-
console.log('[内存分析] 开始分析可能的内存泄漏...');
|
|
23129
|
-
// 检查全局事件监听器
|
|
23130
|
-
var listeners = window.getEventListeners ? window.getEventListeners(document) : {};
|
|
23131
|
-
console.log('[内存分析] 全局事件监听器:', listeners);
|
|
23132
|
-
// 检查定时器
|
|
23133
|
-
console.log('[内存分析] 当前活跃定时器数量:', Object.keys(window).filter(function (key) {
|
|
23134
|
-
return key.includes('timeout') || key.includes('interval');
|
|
23135
|
-
}).length);
|
|
23136
|
-
// 检查TabPane节点详情
|
|
23137
|
-
var tabsContainer = document.getElementById('globalTabs');
|
|
23138
|
-
if (tabsContainer) {
|
|
23139
|
-
var tabPanes = tabsContainer.querySelectorAll('.ant-tabs-tabpane');
|
|
23140
|
-
console.log("[\u5185\u5B58\u5206\u6790] \u53D1\u73B0 ".concat(tabPanes.length, " \u4E2ATabPane\u8282\u70B9:"));
|
|
23141
|
-
tabPanes.forEach(function (pane, index) {
|
|
23142
|
-
var key = pane.getAttribute('data-node-key') || pane.id;
|
|
23143
|
-
var isVisible = pane.style.display !== 'none' && pane.getAttribute('aria-hidden') !== 'true';
|
|
23144
|
-
var hasContent = pane.children.length > 0;
|
|
23145
|
-
console.log(" TabPane ".concat(index, ": key=").concat(key, ", visible=").concat(isVisible, ", hasContent=").concat(hasContent, ", children=").concat(pane.children.length));
|
|
23146
|
-
});
|
|
23147
|
-
}
|
|
23148
|
-
// 检查React组件实例
|
|
23149
|
-
var reactInstances = document.querySelectorAll('[data-reactroot], [data-react-checksum]');
|
|
23150
|
-
console.log("[\u5185\u5B58\u5206\u6790] React\u5B9E\u4F8B\u6570\u91CF: ".concat(reactInstances.length));
|
|
23151
|
-
};
|
|
23152
|
-
// 强制清除所有TabPane节点
|
|
23153
|
-
_this.forceClearTabPanes = function () {
|
|
23154
|
-
console.log('[强制清除] 开始强制清除所有TabPane节点...');
|
|
23155
|
-
var beforeCount = _this.countTabPaneDOMNodes();
|
|
23156
|
-
var tabsContainer = document.getElementById('globalTabs');
|
|
23157
|
-
if (tabsContainer) {
|
|
23158
|
-
var tabPanes = tabsContainer.querySelectorAll('.ant-tabs-tabpane');
|
|
23159
|
-
console.log("[\u5F3A\u5236\u6E05\u9664] \u53D1\u73B0 ".concat(tabPanes.length, " \u4E2ATabPane\u8282\u70B9\uFF0C\u51C6\u5907\u6E05\u9664..."));
|
|
23160
|
-
tabPanes.forEach(function (pane, index) {
|
|
23161
|
-
var key = pane.getAttribute('data-node-key') || pane.id;
|
|
23162
|
-
var isActive = !pane.getAttribute('aria-hidden') && pane.style.display !== 'none';
|
|
23163
|
-
if (!isActive) {
|
|
23164
|
-
console.log("[\u5F3A\u5236\u6E05\u9664] \u79FB\u9664\u975E\u6D3B\u8DC3TabPane ".concat(index, " (key: ").concat(key, ")"));
|
|
23165
|
-
pane.remove();
|
|
23166
|
-
}
|
|
23167
|
-
});
|
|
23168
|
-
}
|
|
23169
|
-
setTimeout(function () {
|
|
23170
|
-
var afterCount = _this.countTabPaneDOMNodes();
|
|
23171
|
-
console.log("[\u5F3A\u5236\u6E05\u9664] \u6E05\u9664\u524D: ".concat(beforeCount.total, ", \u6E05\u9664\u540E: ").concat(afterCount.total, ", \u51CF\u5C11: ").concat(beforeCount.total - afterCount.total));
|
|
23172
|
-
}, 100);
|
|
23173
|
-
};
|
|
23174
23114
|
_this.tabActions = {
|
|
23175
23115
|
remove: function remove(targetKey) {
|
|
23176
|
-
console.log("[\u9875\u7B7E\u5220\u9664] \u5F00\u59CB\u5220\u9664\u9875\u7B7E: ".concat(targetKey));
|
|
23177
|
-
_this.countTabPaneDOMNodes();
|
|
23178
23116
|
var _this$state = _this.state,
|
|
23179
23117
|
listenRouterState = _this$state.listenRouterState,
|
|
23180
23118
|
activeKey = _this$state.activeKey,
|
|
@@ -23218,11 +23156,6 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23218
23156
|
pathname: newKey
|
|
23219
23157
|
});
|
|
23220
23158
|
_this.checkisNavSlide();
|
|
23221
|
-
// 延迟检查DOM节点变化,确保React完成渲染
|
|
23222
|
-
setTimeout(function () {
|
|
23223
|
-
console.log("[\u9875\u7B7E\u5220\u9664] \u5220\u9664\u9875\u7B7E ".concat(targetKey, " \u540E\u7684DOM\u72B6\u6001:"));
|
|
23224
|
-
_this.countTabPaneDOMNodes();
|
|
23225
|
-
}, 100);
|
|
23226
23159
|
});
|
|
23227
23160
|
}
|
|
23228
23161
|
};
|
|
@@ -23497,8 +23430,8 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23497
23430
|
return _createClass(BasicLayout, [{
|
|
23498
23431
|
key: "componentDidMount",
|
|
23499
23432
|
value: function componentDidMount() {
|
|
23500
|
-
var
|
|
23501
|
-
|
|
23433
|
+
var _window$$wujie,
|
|
23434
|
+
_this2 = this,
|
|
23502
23435
|
_localStorage$getItem,
|
|
23503
23436
|
_localStorage$getItem2;
|
|
23504
23437
|
var _this$props = this.props,
|
|
@@ -23506,17 +23439,6 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23506
23439
|
location = _this$props.location,
|
|
23507
23440
|
itemPath = _this$props.itemPath,
|
|
23508
23441
|
pathToRegexp = _this$props.pathToRegexp;
|
|
23509
|
-
// 将测试方法暴露到全局,方便调试
|
|
23510
|
-
window.testTabDeletion = this.testTabDeletion;
|
|
23511
|
-
window.countTabPaneDOMNodes = this.countTabPaneDOMNodes;
|
|
23512
|
-
window.testDeleteTab = function (key) {
|
|
23513
|
-
console.log("[\u6D4B\u8BD5] \u624B\u52A8\u5220\u9664\u9875\u7B7E: ".concat(key));
|
|
23514
|
-
_this2.tabActions.remove(key);
|
|
23515
|
-
};
|
|
23516
|
-
window.forceCleanupDOM = this.forceCleanupDOM;
|
|
23517
|
-
window.analyzeMemoryLeaks = this.analyzeMemoryLeaks;
|
|
23518
|
-
window.forceClearTabPanes = this.forceClearTabPanes;
|
|
23519
|
-
console.log('[调试工具] 已暴露全局方法: window.testTabDeletion(), window.countTabPaneDOMNodes(), window.testDeleteTab(key), window.forceCleanupDOM(), window.analyzeMemoryLeaks(), window.forceClearTabPanes()');
|
|
23520
23442
|
var istParent = 0;
|
|
23521
23443
|
var self = this;
|
|
23522
23444
|
// window.top != window &&
|
|
@@ -24178,104 +24100,28 @@ var WrapperComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
24178
24100
|
var _this4;
|
|
24179
24101
|
_classCallCheck(this, WrapperComponent);
|
|
24180
24102
|
_this4 = _callSuper(this, WrapperComponent, [props]);
|
|
24181
|
-
|
|
24182
|
-
if (_this4.domObserver || _this4.isUnmounted) return;
|
|
24183
|
-
var globalTabsContainer = document.getElementById('globalTabs');
|
|
24184
|
-
if (!globalTabsContainer) return;
|
|
24185
|
-
_this4.domObserver = new MutationObserver(function (mutations) {
|
|
24186
|
-
if (_this4.isUnmounted) return;
|
|
24187
|
-
mutations.forEach(function (mutation) {
|
|
24188
|
-
if (mutation.type === 'childList') {
|
|
24189
|
-
// 检查是否有TabPane节点被添加或删除
|
|
24190
|
-
var addedTabPanes = Array.from(mutation.addedNodes).filter(function (node) {
|
|
24191
|
-
return node.nodeType === Node.ELEMENT_NODE && node.classList && node.classList.contains('ant-tabs-tabpane');
|
|
24192
|
-
});
|
|
24193
|
-
var removedTabPanes = Array.from(mutation.removedNodes).filter(function (node) {
|
|
24194
|
-
return node.nodeType === Node.ELEMENT_NODE && node.classList && node.classList.contains('ant-tabs-tabpane');
|
|
24195
|
-
});
|
|
24196
|
-
if (addedTabPanes.length > 0) {
|
|
24197
|
-
console.log("[DOM\u76D1\u63A7] \u68C0\u6D4B\u5230 ".concat(addedTabPanes.length, " \u4E2ATabPane\u8282\u70B9\u88AB\u6DFB\u52A0"));
|
|
24198
|
-
addedTabPanes.forEach(function (node) {
|
|
24199
|
-
var key = node.getAttribute('data-node-key') || '未知';
|
|
24200
|
-
console.log("[DOM\u76D1\u63A7] \u6DFB\u52A0\u7684TabPane: ".concat(key));
|
|
24201
|
-
});
|
|
24202
|
-
}
|
|
24203
|
-
if (removedTabPanes.length > 0) {
|
|
24204
|
-
console.log("[DOM\u76D1\u63A7] \u68C0\u6D4B\u5230 ".concat(removedTabPanes.length, " \u4E2ATabPane\u8282\u70B9\u88AB\u5220\u9664"));
|
|
24205
|
-
removedTabPanes.forEach(function (node) {
|
|
24206
|
-
var key = node.getAttribute('data-node-key') || '未知';
|
|
24207
|
-
console.log("[DOM\u76D1\u63A7] \u5220\u9664\u7684TabPane: ".concat(key));
|
|
24208
|
-
// 检查是否是当前组件对应的TabPane
|
|
24209
|
-
if (key === _this4.props.item.key) {
|
|
24210
|
-
console.log("[DOM\u76D1\u63A7] \u5F53\u524D\u7EC4\u4EF6 ".concat(_this4.props.item.key, " \u5BF9\u5E94\u7684TabPane\u5DF2\u4ECEDOM\u4E2D\u5220\u9664"));
|
|
24211
|
-
}
|
|
24212
|
-
});
|
|
24213
|
-
}
|
|
24214
|
-
// 统计当前DOM中的TabPane数量
|
|
24215
|
-
var currentTabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane');
|
|
24216
|
-
console.log("[DOM\u76D1\u63A7] \u5F53\u524DDOM\u4E2DTabPane\u8282\u70B9\u603B\u6570: ".concat(currentTabPanes.length));
|
|
24217
|
-
}
|
|
24218
|
-
});
|
|
24219
|
-
});
|
|
24220
|
-
// 开始观察
|
|
24221
|
-
_this4.domObserver.observe(globalTabsContainer, {
|
|
24222
|
-
childList: true,
|
|
24223
|
-
subtree: true
|
|
24224
|
-
});
|
|
24225
|
-
console.log("[DOM\u76D1\u63A7] \u5DF2\u4E3A\u9875\u7B7E ".concat(_this4.props.item.key, " \u8BBE\u7F6EDOM\u53D8\u5316\u76D1\u63A7"));
|
|
24226
|
-
};
|
|
24103
|
+
// 初始化组件状态
|
|
24227
24104
|
// 通用事件处理器,用于清理
|
|
24228
24105
|
_this4.handleEvent = function (event) {
|
|
24229
24106
|
// 空的事件处理器,仅用于清理时移除监听器
|
|
24230
24107
|
};
|
|
24231
|
-
console.log("WrapperComponent \u6784\u9020\u51FD\u6570: \u9875\u7B7E ".concat(props.item.key, " \u521B\u5EFA"));
|
|
24232
|
-
// 初始化MutationObserver
|
|
24233
|
-
_this4.domObserver = null;
|
|
24234
24108
|
_this4.isUnmounted = false;
|
|
24235
|
-
// 统计当前DOM节点数
|
|
24236
|
-
setTimeout(function () {
|
|
24237
|
-
var tabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane');
|
|
24238
|
-
console.log("[\u7EC4\u4EF6\u521B\u5EFA] \u9875\u7B7E ".concat(props.item.key, " \u521B\u5EFA\u540E\uFF0CDOM\u4E2DTabPane\u8282\u70B9\u6570: ").concat(tabPanes.length));
|
|
24239
|
-
}, 0);
|
|
24240
24109
|
return _this4;
|
|
24241
24110
|
}
|
|
24242
24111
|
_inherits(WrapperComponent, _React$Component);
|
|
24243
24112
|
return _createClass(WrapperComponent, [{
|
|
24244
24113
|
key: "componentDidMount",
|
|
24245
24114
|
value: function componentDidMount() {
|
|
24246
|
-
|
|
24247
|
-
var tabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane');
|
|
24248
|
-
console.log("[\u7EC4\u4EF6\u6302\u8F7D] \u9875\u7B7E ".concat(this.props.item.key, " \u6302\u8F7D\u540E\uFF0CDOM\u4E2DTabPane\u8282\u70B9\u6570: ").concat(tabPanes.length));
|
|
24249
|
-
// 设置MutationObserver监控DOM变化
|
|
24250
|
-
this.setupDOMObserver();
|
|
24115
|
+
// 组件挂载完成
|
|
24251
24116
|
}
|
|
24252
24117
|
}, {
|
|
24253
24118
|
key: "componentWillUnmount",
|
|
24254
24119
|
value: function componentWillUnmount() {
|
|
24255
24120
|
var _this5 = this;
|
|
24256
|
-
console.log("WrapperComponent \u5378\u8F7D: \u9875\u7B7E ".concat(this.props.item.key, " \u7EC4\u4EF6\u6B63\u5728\u9500\u6BC1"));
|
|
24257
24121
|
// 设置卸载标志
|
|
24258
24122
|
this.isUnmounted = true;
|
|
24259
|
-
|
|
24260
|
-
console.log("[\u7EC4\u4EF6\u5378\u8F7D] \u9875\u7B7E ".concat(this.props.item.key, " \u5378\u8F7D\u524D\uFF0CDOM\u4E2DTabPane\u8282\u70B9\u6570: ").concat(tabPanes.length));
|
|
24261
|
-
// 清理MutationObserver
|
|
24262
|
-
if (this.domObserver) {
|
|
24263
|
-
this.domObserver.disconnect();
|
|
24264
|
-
this.domObserver = null;
|
|
24265
|
-
console.log("[\u6E05\u7406] \u5DF2\u65AD\u5F00\u9875\u7B7E ".concat(this.props.item.key, " \u7684DOM\u76D1\u63A7"));
|
|
24266
|
-
}
|
|
24267
|
-
// 强制清理所有可能的引用和事件监听器
|
|
24123
|
+
// 清理可能的DOM事件监听器
|
|
24268
24124
|
try {
|
|
24269
|
-
// 清理组件内部的所有引用
|
|
24270
|
-
if (this.props && _typeof(this.props) === 'object') {
|
|
24271
|
-
Object.keys(this.props).forEach(function (key) {
|
|
24272
|
-
if (_this5.props[key] && _typeof(_this5.props[key]) === 'object') {
|
|
24273
|
-
// 不直接删除props,但清理可能的循环引用
|
|
24274
|
-
console.log("[\u6E05\u7406] \u68C0\u67E5prop: ".concat(key));
|
|
24275
|
-
}
|
|
24276
|
-
});
|
|
24277
|
-
}
|
|
24278
|
-
// 清理可能的DOM事件监听器
|
|
24279
24125
|
var currentElement = document.querySelector("#globalTabs .ant-tabs-tabpane[data-node-key=\"".concat(this.props.item.key, "\"]"));
|
|
24280
24126
|
if (currentElement) {
|
|
24281
24127
|
// 移除所有可能的事件监听器
|
|
@@ -24284,26 +24130,14 @@ var WrapperComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
24284
24130
|
currentElement.removeEventListener(eventType, _this5.handleEvent, true);
|
|
24285
24131
|
currentElement.removeEventListener(eventType, _this5.handleEvent, false);
|
|
24286
24132
|
});
|
|
24287
|
-
console.log("[\u6E05\u7406] \u5DF2\u6E05\u7406\u9875\u7B7E ".concat(this.props.item.key, " \u7684DOM\u4E8B\u4EF6\u76D1\u542C\u5668"));
|
|
24288
24133
|
}
|
|
24289
24134
|
// 强制垃圾回收提示
|
|
24290
24135
|
if (window.gc && typeof window.gc === 'function') {
|
|
24291
24136
|
window.gc();
|
|
24292
|
-
console.log("[\u6E05\u7406] \u5DF2\u89E6\u53D1\u5783\u573E\u56DE\u6536");
|
|
24293
24137
|
}
|
|
24294
24138
|
} catch (error) {
|
|
24295
|
-
|
|
24139
|
+
// 清理过程中的错误处理
|
|
24296
24140
|
}
|
|
24297
|
-
// 延迟检查卸载后的DOM状态
|
|
24298
|
-
setTimeout(function () {
|
|
24299
|
-
var tabPanesAfter = document.querySelectorAll('#globalTabs .ant-tabs-tabpane');
|
|
24300
|
-
console.log("[\u7EC4\u4EF6\u5378\u8F7D] \u9875\u7B7E ".concat(_this5.props.item.key, " \u5378\u8F7D\u540E\uFF0CDOM\u4E2DTabPane\u8282\u70B9\u6570: ").concat(tabPanesAfter.length));
|
|
24301
|
-
// 强制检查内存使用情况
|
|
24302
|
-
if (window.performance && window.performance.memory) {
|
|
24303
|
-
var memory = window.performance.memory;
|
|
24304
|
-
console.log("[\u5185\u5B58\u76D1\u63A7] \u5378\u8F7D\u540E\u5185\u5B58\u4F7F\u7528: ".concat((memory.usedJSHeapSize / 1024 / 1024).toFixed(2), "MB / ").concat((memory.totalJSHeapSize / 1024 / 1024).toFixed(2), "MB"));
|
|
24305
|
-
}
|
|
24306
|
-
}, 100);
|
|
24307
24141
|
}
|
|
24308
24142
|
}, {
|
|
24309
24143
|
key: "shouldComponentUpdate",
|
|
@@ -27989,7 +27823,7 @@ pp$5.currentThisScope = function() {
|
|
|
27989
27823
|
}
|
|
27990
27824
|
};
|
|
27991
27825
|
|
|
27992
|
-
var Node
|
|
27826
|
+
var Node = function Node(parser, pos, loc) {
|
|
27993
27827
|
this.type = "";
|
|
27994
27828
|
this.start = pos;
|
|
27995
27829
|
this.end = 0;
|
|
@@ -28006,11 +27840,11 @@ var Node$1 = function Node(parser, pos, loc) {
|
|
|
28006
27840
|
var pp$6 = Parser.prototype;
|
|
28007
27841
|
|
|
28008
27842
|
pp$6.startNode = function() {
|
|
28009
|
-
return new Node
|
|
27843
|
+
return new Node(this, this.start, this.startLoc)
|
|
28010
27844
|
};
|
|
28011
27845
|
|
|
28012
27846
|
pp$6.startNodeAt = function(pos, loc) {
|
|
28013
|
-
return new Node
|
|
27847
|
+
return new Node(this, pos, loc)
|
|
28014
27848
|
};
|
|
28015
27849
|
|
|
28016
27850
|
// Finish an AST node, adding `type` and `end` properties.
|
|
@@ -30078,7 +29912,7 @@ Parser.acorn = {
|
|
|
30078
29912
|
Position: Position,
|
|
30079
29913
|
SourceLocation: SourceLocation,
|
|
30080
29914
|
getLineInfo: getLineInfo,
|
|
30081
|
-
Node: Node
|
|
29915
|
+
Node: Node,
|
|
30082
29916
|
TokenType: TokenType,
|
|
30083
29917
|
tokTypes: types,
|
|
30084
29918
|
keywordTypes: keywords$1,
|