@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.js CHANGED
@@ -20333,7 +20333,7 @@ var BsSulaQueryTable = (function (props) {
20333
20333
  * ]
20334
20334
  * @returns []
20335
20335
  */
20336
- var getTableSummaryInfo = function getTableSummaryInfo() {
20336
+ var getTableSummaryInfo = React$1.useCallback(function () {
20337
20337
  var summaryList = props.summaryList,
20338
20338
  rowSelection = props.rowSelection,
20339
20339
  expandable = props.expandable;
@@ -20376,7 +20376,7 @@ var BsSulaQueryTable = (function (props) {
20376
20376
  } else {
20377
20377
  return undefined;
20378
20378
  }
20379
- };
20379
+ }, [props.summaryList, props.rowSelection, props.expandable, showColumn]);
20380
20380
  var columnsDom = /*#__PURE__*/React__default['default'].createElement("span", {
20381
20381
  className: "ant-dropdown-link"
20382
20382
  }, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -20406,7 +20406,7 @@ var BsSulaQueryTable = (function (props) {
20406
20406
  columnsDom: columnsDom,
20407
20407
  queryFieldsDom: queryFieldsDom
20408
20408
  });
20409
- }, [checkedList, showColumn, props.statusMapping, showSearchFields, expandedRowKeys]);
20409
+ }, [checkedList, showColumn, props.statusMapping, showSearchFields, expandedRowKeys, getTableSummaryInfo, props.summaryList, props.summary]);
20410
20410
  return /*#__PURE__*/React__default['default'].createElement("div", {
20411
20411
  data: "bssulaquerydatadiv",
20412
20412
  id: "bs-sula-query-table"
@@ -22382,6 +22382,11 @@ var DrawContent$1 = function DrawContent(_ref) {
22382
22382
  _useState16 = _slicedToArray(_useState15, 2),
22383
22383
  showScroll = _useState16[0],
22384
22384
  setShowScroll = _useState16[1];
22385
+ // 添加refs来跟踪组件状态和清理资源
22386
+ var isUnmountedRef = React$1.useRef(false);
22387
+ var timeoutRef = React$1.useRef(null);
22388
+ var resizeHandlerRef = React$1.useRef(null);
22389
+ var debounceTimerRef = React$1.useRef(null);
22385
22390
  React$1.useEffect(function () {
22386
22391
  var _originRoutes$find;
22387
22392
  getMenuContentHeight();
@@ -22405,24 +22410,58 @@ var DrawContent$1 = function DrawContent(_ref) {
22405
22410
  sethomepageData(homepageDataList);
22406
22411
  setroutesData(routesDataList);
22407
22412
  setAuthorityMenu(authorityMenuList);
22408
- window.onresize = function () {
22409
- getMenuContentHeight();
22413
+ // 创建resize处理函数并保存引用
22414
+ var handleResize = function handleResize() {
22415
+ if (!isUnmountedRef.current) {
22416
+ getMenuContentHeight();
22417
+ }
22418
+ };
22419
+ resizeHandlerRef.current = handleResize;
22420
+ window.addEventListener('resize', handleResize);
22421
+ // 清理函数
22422
+ return function () {
22423
+ isUnmountedRef.current = true;
22424
+ if (resizeHandlerRef.current) {
22425
+ window.removeEventListener('resize', resizeHandlerRef.current);
22426
+ resizeHandlerRef.current = null;
22427
+ }
22428
+ if (timeoutRef.current) {
22429
+ clearTimeout(timeoutRef.current);
22430
+ timeoutRef.current = null;
22431
+ }
22432
+ if (debounceTimerRef.current) {
22433
+ clearTimeout(debounceTimerRef.current);
22434
+ debounceTimerRef.current = null;
22435
+ }
22410
22436
  };
22411
22437
  }, []);
22412
22438
  React$1.useLayoutEffect(function () {
22413
- setTimeout(function () {
22414
- var drawContentHeight = document.getElementById("drawContent").scrollHeight;
22415
- if (drawContentHeight > rightMenuHeight) {
22416
- setMoreBtnShow(true);
22439
+ timeoutRef.current = setTimeout(function () {
22440
+ if (!isUnmountedRef.current) {
22441
+ var drawContentElement = document.getElementById("drawContent");
22442
+ if (drawContentElement) {
22443
+ var drawContentHeight = drawContentElement.scrollHeight;
22444
+ if (drawContentHeight > rightMenuHeight) {
22445
+ setMoreBtnShow(true);
22446
+ }
22447
+ }
22417
22448
  }
22418
22449
  }, 0);
22450
+ return function () {
22451
+ if (timeoutRef.current) {
22452
+ clearTimeout(timeoutRef.current);
22453
+ timeoutRef.current = null;
22454
+ }
22455
+ };
22456
+ }, [rightMenuHeight]);
22457
+ var getMenuContentHeight = React$1.useCallback(function () {
22458
+ if (!isUnmountedRef.current) {
22459
+ var clientHeight = document.body.clientHeight;
22460
+ setHeight(clientHeight - 190);
22461
+ setDrawHeight(clientHeight - 70);
22462
+ }
22419
22463
  }, []);
22420
- var getMenuContentHeight = function getMenuContentHeight() {
22421
- var clientHeight = document.body.clientHeight;
22422
- setHeight(clientHeight - 190);
22423
- setDrawHeight(clientHeight - 70);
22424
- };
22425
- var _renderChildItem = function renderChildItem(child) {
22464
+ var renderChildItem = React$1.useCallback(function (child) {
22426
22465
  if (!child.hideInMenu && child.children) {
22427
22466
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(antd.List.Item, {
22428
22467
  style: {
@@ -22432,7 +22471,7 @@ var DrawContent$1 = function DrawContent(_ref) {
22432
22471
  }, umi.formatMessage({
22433
22472
  id: "".concat(child.locale)
22434
22473
  })), child.children.map(function (menuItem) {
22435
- return _renderChildItem(menuItem);
22474
+ return renderChildItem(menuItem);
22436
22475
  }));
22437
22476
  } else if (!child.hideInMenu && child.path) {
22438
22477
  return /*#__PURE__*/React__default['default'].createElement(antd.List.Item, {
@@ -22460,8 +22499,9 @@ var DrawContent$1 = function DrawContent(_ref) {
22460
22499
  src: right
22461
22500
  })));
22462
22501
  }
22463
- };
22464
- var onMenuClick = function onMenuClick(e, item) {
22502
+ }, [onMenuClick]);
22503
+ var onMenuClick = React$1.useCallback(function (e, item) {
22504
+ if (isUnmountedRef.current) return;
22465
22505
  e.stopPropagation();
22466
22506
  e.preventDefault();
22467
22507
  var searchHistory = JSON.parse(localStorage.getItem("".concat(itemPath, "_search_history")) || '[]');
@@ -22486,7 +22526,23 @@ var DrawContent$1 = function DrawContent(_ref) {
22486
22526
  pathname: item.path
22487
22527
  });
22488
22528
  onClose();
22489
- };
22529
+ }, [itemPath, onClose]);
22530
+ // 创建debounce搜索函数
22531
+ var debouncedSearch = React$1.useCallback(function (value) {
22532
+ if (debounceTimerRef.current) {
22533
+ clearTimeout(debounceTimerRef.current);
22534
+ }
22535
+ debounceTimerRef.current = setTimeout(function () {
22536
+ if (!isUnmountedRef.current) {
22537
+ searchMenuData(authorityMenu, value, setSearchMenuData);
22538
+ }
22539
+ }, 600);
22540
+ }, [authorityMenu]);
22541
+ var handleSearchChange = React$1.useCallback(function (e) {
22542
+ if (!isUnmountedRef.current) {
22543
+ debouncedSearch(e.target.value);
22544
+ }
22545
+ }, [debouncedSearch]);
22490
22546
  var searchHistoryList = JSON.parse(localStorage.getItem("".concat(itemPath, "_search_history")) || '[]');
22491
22547
  return /*#__PURE__*/React__default['default'].createElement("div", {
22492
22548
  style: {
@@ -22505,6 +22561,7 @@ var DrawContent$1 = function DrawContent(_ref) {
22505
22561
  color: currentOneLevel === item.path ? '#005cff' : '#000000'
22506
22562
  },
22507
22563
  onClick: function onClick(e) {
22564
+ if (isUnmountedRef.current) return;
22508
22565
  e.stopPropagation();
22509
22566
  e.preventDefault();
22510
22567
  if (item.component) {
@@ -22526,7 +22583,9 @@ var DrawContent$1 = function DrawContent(_ref) {
22526
22583
  }
22527
22584
  }, /*#__PURE__*/React__default['default'].createElement("img", {
22528
22585
  onClick: function onClick() {
22529
- onClose();
22586
+ if (!isUnmountedRef.current) {
22587
+ onClose();
22588
+ }
22530
22589
  },
22531
22590
  style: {
22532
22591
  position: 'absolute',
@@ -22551,9 +22610,7 @@ var DrawContent$1 = function DrawContent(_ref) {
22551
22610
  placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD",
22552
22611
  allowClear: true,
22553
22612
  prefix: /*#__PURE__*/React__default['default'].createElement(icons.SearchOutlined, null),
22554
- onChange: _.debounce(function (e) {
22555
- searchMenuData(authorityMenu, e.target.value, setSearchMenuData);
22556
- }, 600)
22613
+ onChange: handleSearchChange
22557
22614
  }), /*#__PURE__*/React__default['default'].createElement("div", {
22558
22615
  style: {
22559
22616
  marginTop: '10px'
@@ -22579,7 +22636,9 @@ var DrawContent$1 = function DrawContent(_ref) {
22579
22636
  }, SearhData.map(function (item) {
22580
22637
  return /*#__PURE__*/React__default['default'].createElement("div", {
22581
22638
  onClick: function onClick(e) {
22582
- onMenuClick(e, item);
22639
+ if (!isUnmountedRef.current) {
22640
+ onMenuClick(e, item);
22641
+ }
22583
22642
  },
22584
22643
  key: item.path
22585
22644
  }, item.name);
@@ -22636,7 +22695,7 @@ var DrawContent$1 = function DrawContent(_ref) {
22636
22695
  bordered: true,
22637
22696
  dataSource: item.children,
22638
22697
  renderItem: function renderItem(child) {
22639
- return _renderChildItem(child);
22698
+ return renderChildItem(child);
22640
22699
  }
22641
22700
  });
22642
22701
  })), /*#__PURE__*/React__default['default'].createElement("div", {
@@ -22651,8 +22710,10 @@ var DrawContent$1 = function DrawContent(_ref) {
22651
22710
  }
22652
22711
  }, /*#__PURE__*/React__default['default'].createElement("span", {
22653
22712
  onClick: function onClick() {
22654
- setShowScroll(true);
22655
- setMoreBtnShow(false);
22713
+ if (!isUnmountedRef.current) {
22714
+ setShowScroll(true);
22715
+ setMoreBtnShow(false);
22716
+ }
22656
22717
  },
22657
22718
  style: {
22658
22719
  color: '#8c8c8c'
@@ -23073,131 +23134,8 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23073
23134
  _this.onEdit = function (targetKey, action) {
23074
23135
  _this.tabActions[action](targetKey);
23075
23136
  };
23076
- // DOM节点计数辅助函数
23077
- _this.countTabPaneDOMNodes = function () {
23078
- var tabPanes = document.querySelectorAll('.ant-tabs-tabpane');
23079
- var globalTabsTabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane');
23080
- var activeTabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane-active');
23081
- var hiddenTabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane:not(.ant-tabs-tabpane-active)');
23082
- console.log("[DOM\u8BA1\u6570] \u5168\u5C40TabPane\u8282\u70B9\u6570: ".concat(tabPanes.length, ", globalTabs\u5185TabPane\u8282\u70B9\u6570: ").concat(globalTabsTabPanes.length));
23083
- console.log("[DOM\u8BA1\u6570] \u6D3B\u8DC3TabPane\u8282\u70B9\u6570: ".concat(activeTabPanes.length, ", \u975E\u6D3B\u8DC3TabPane\u8282\u70B9\u6570: ").concat(hiddenTabPanes.length));
23084
- // 详细列出每个TabPane的key和状态
23085
- globalTabsTabPanes.forEach(function (pane, index) {
23086
- var isActive = pane.classList.contains('ant-tabs-tabpane-active');
23087
- var key = pane.getAttribute('data-node-key') || pane.id || "\u672A\u77E5-".concat(index);
23088
- console.log("[DOM\u8BE6\u60C5] TabPane ".concat(index + 1, ": key=").concat(key, ", \u6D3B\u8DC3=").concat(isActive));
23089
- });
23090
- return {
23091
- total: tabPanes.length,
23092
- globalTabs: globalTabsTabPanes.length,
23093
- active: activeTabPanes.length,
23094
- hidden: hiddenTabPanes.length
23095
- };
23096
- };
23097
- // 测试方法:验证页签删除后DOM状态
23098
- _this.testTabDeletion = function () {
23099
- console.log('=== 页签删除测试开始 ===');
23100
- console.log('当前页签状态:', _this.state.listenRouterState.map(function (item) {
23101
- return item.key;
23102
- }));
23103
- console.log('当前活跃页签:', _this.state.activeKey);
23104
- _this.countTabPaneDOMNodes();
23105
- // 提供删除建议
23106
- var listenRouterState = _this.state.listenRouterState;
23107
- if (listenRouterState.length > 1) {
23108
- var _listenRouterState$fi;
23109
- var testKey = (_listenRouterState$fi = listenRouterState.find(function (item) {
23110
- return item.key !== '/';
23111
- })) === null || _listenRouterState$fi === void 0 ? void 0 : _listenRouterState$fi.key;
23112
- if (testKey) {
23113
- console.log("\u5EFA\u8BAE\u6D4B\u8BD5\uFF1A\u5220\u9664\u9875\u7B7E ".concat(testKey));
23114
- console.log("\u6267\u884C\u547D\u4EE4\uFF1Awindow.testDeleteTab('".concat(testKey, "')"));
23115
- }
23116
- }
23117
- console.log('=== 页签删除测试结束 ===');
23118
- };
23119
- // 强制清理DOM节点的方法
23120
- _this.forceCleanupDOM = function () {
23121
- console.log('[强制清理] 开始强制清理DOM节点...');
23122
- var beforeCount = _this.countTabPaneDOMNodes();
23123
- console.log("[\u5F3A\u5236\u6E05\u7406] \u6E05\u7406\u524DDOM\u8282\u70B9\u6570: ".concat(beforeCount.total));
23124
- // 强制垃圾回收
23125
- if (window.gc) {
23126
- window.gc();
23127
- console.log('[强制清理] 已触发垃圾回收');
23128
- }
23129
- // 清理所有可能的引用
23130
- var tabsContainer = document.getElementById('globalTabs');
23131
- if (tabsContainer) {
23132
- var tabPanes = tabsContainer.querySelectorAll('.ant-tabs-tabpane');
23133
- tabPanes.forEach(function (pane, index) {
23134
- if (pane.style.display === 'none' || pane.getAttribute('aria-hidden') === 'true') {
23135
- var _pane$parentNode;
23136
- console.log("[\u5F3A\u5236\u6E05\u7406] \u53D1\u73B0\u9690\u85CF\u7684TabPane\u8282\u70B9 ".concat(index, ", \u5C1D\u8BD5\u6E05\u7406..."));
23137
- // 清理事件监听器
23138
- var clone = pane.cloneNode(true);
23139
- (_pane$parentNode = pane.parentNode) === null || _pane$parentNode === void 0 ? void 0 : _pane$parentNode.replaceChild(clone, pane);
23140
- }
23141
- });
23142
- }
23143
- setTimeout(function () {
23144
- var afterCount = _this.countTabPaneDOMNodes();
23145
- console.log("[\u5F3A\u5236\u6E05\u7406] \u6E05\u7406\u540EDOM\u8282\u70B9\u6570: ".concat(afterCount.total));
23146
- console.log("[\u5F3A\u5236\u6E05\u7406] DOM\u8282\u70B9\u51CF\u5C11: ".concat(beforeCount.total - afterCount.total));
23147
- }, 200);
23148
- };
23149
- // 分析内存泄漏的方法
23150
- _this.analyzeMemoryLeaks = function () {
23151
- console.log('[内存分析] 开始分析可能的内存泄漏...');
23152
- // 检查全局事件监听器
23153
- var listeners = window.getEventListeners ? window.getEventListeners(document) : {};
23154
- console.log('[内存分析] 全局事件监听器:', listeners);
23155
- // 检查定时器
23156
- console.log('[内存分析] 当前活跃定时器数量:', Object.keys(window).filter(function (key) {
23157
- return key.includes('timeout') || key.includes('interval');
23158
- }).length);
23159
- // 检查TabPane节点详情
23160
- var tabsContainer = document.getElementById('globalTabs');
23161
- if (tabsContainer) {
23162
- var tabPanes = tabsContainer.querySelectorAll('.ant-tabs-tabpane');
23163
- console.log("[\u5185\u5B58\u5206\u6790] \u53D1\u73B0 ".concat(tabPanes.length, " \u4E2ATabPane\u8282\u70B9:"));
23164
- tabPanes.forEach(function (pane, index) {
23165
- var key = pane.getAttribute('data-node-key') || pane.id;
23166
- var isVisible = pane.style.display !== 'none' && pane.getAttribute('aria-hidden') !== 'true';
23167
- var hasContent = pane.children.length > 0;
23168
- console.log(" TabPane ".concat(index, ": key=").concat(key, ", visible=").concat(isVisible, ", hasContent=").concat(hasContent, ", children=").concat(pane.children.length));
23169
- });
23170
- }
23171
- // 检查React组件实例
23172
- var reactInstances = document.querySelectorAll('[data-reactroot], [data-react-checksum]');
23173
- console.log("[\u5185\u5B58\u5206\u6790] React\u5B9E\u4F8B\u6570\u91CF: ".concat(reactInstances.length));
23174
- };
23175
- // 强制清除所有TabPane节点
23176
- _this.forceClearTabPanes = function () {
23177
- console.log('[强制清除] 开始强制清除所有TabPane节点...');
23178
- var beforeCount = _this.countTabPaneDOMNodes();
23179
- var tabsContainer = document.getElementById('globalTabs');
23180
- if (tabsContainer) {
23181
- var tabPanes = tabsContainer.querySelectorAll('.ant-tabs-tabpane');
23182
- console.log("[\u5F3A\u5236\u6E05\u9664] \u53D1\u73B0 ".concat(tabPanes.length, " \u4E2ATabPane\u8282\u70B9\uFF0C\u51C6\u5907\u6E05\u9664..."));
23183
- tabPanes.forEach(function (pane, index) {
23184
- var key = pane.getAttribute('data-node-key') || pane.id;
23185
- var isActive = !pane.getAttribute('aria-hidden') && pane.style.display !== 'none';
23186
- if (!isActive) {
23187
- console.log("[\u5F3A\u5236\u6E05\u9664] \u79FB\u9664\u975E\u6D3B\u8DC3TabPane ".concat(index, " (key: ").concat(key, ")"));
23188
- pane.remove();
23189
- }
23190
- });
23191
- }
23192
- setTimeout(function () {
23193
- var afterCount = _this.countTabPaneDOMNodes();
23194
- 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));
23195
- }, 100);
23196
- };
23197
23137
  _this.tabActions = {
23198
23138
  remove: function remove(targetKey) {
23199
- console.log("[\u9875\u7B7E\u5220\u9664] \u5F00\u59CB\u5220\u9664\u9875\u7B7E: ".concat(targetKey));
23200
- _this.countTabPaneDOMNodes();
23201
23139
  var _this$state = _this.state,
23202
23140
  listenRouterState = _this$state.listenRouterState,
23203
23141
  activeKey = _this$state.activeKey,
@@ -23241,11 +23179,6 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23241
23179
  pathname: newKey
23242
23180
  });
23243
23181
  _this.checkisNavSlide();
23244
- // 延迟检查DOM节点变化,确保React完成渲染
23245
- setTimeout(function () {
23246
- console.log("[\u9875\u7B7E\u5220\u9664] \u5220\u9664\u9875\u7B7E ".concat(targetKey, " \u540E\u7684DOM\u72B6\u6001:"));
23247
- _this.countTabPaneDOMNodes();
23248
- }, 100);
23249
23182
  });
23250
23183
  }
23251
23184
  };
@@ -23520,8 +23453,8 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23520
23453
  return _createClass(BasicLayout, [{
23521
23454
  key: "componentDidMount",
23522
23455
  value: function componentDidMount() {
23523
- var _this2 = this,
23524
- _window$$wujie,
23456
+ var _window$$wujie,
23457
+ _this2 = this,
23525
23458
  _localStorage$getItem,
23526
23459
  _localStorage$getItem2;
23527
23460
  var _this$props = this.props,
@@ -23529,17 +23462,6 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23529
23462
  location = _this$props.location,
23530
23463
  itemPath = _this$props.itemPath,
23531
23464
  pathToRegexp = _this$props.pathToRegexp;
23532
- // 将测试方法暴露到全局,方便调试
23533
- window.testTabDeletion = this.testTabDeletion;
23534
- window.countTabPaneDOMNodes = this.countTabPaneDOMNodes;
23535
- window.testDeleteTab = function (key) {
23536
- console.log("[\u6D4B\u8BD5] \u624B\u52A8\u5220\u9664\u9875\u7B7E: ".concat(key));
23537
- _this2.tabActions.remove(key);
23538
- };
23539
- window.forceCleanupDOM = this.forceCleanupDOM;
23540
- window.analyzeMemoryLeaks = this.analyzeMemoryLeaks;
23541
- window.forceClearTabPanes = this.forceClearTabPanes;
23542
- console.log('[调试工具] 已暴露全局方法: window.testTabDeletion(), window.countTabPaneDOMNodes(), window.testDeleteTab(key), window.forceCleanupDOM(), window.analyzeMemoryLeaks(), window.forceClearTabPanes()');
23543
23465
  var istParent = 0;
23544
23466
  var self = this;
23545
23467
  // window.top != window &&
@@ -24201,104 +24123,28 @@ var WrapperComponent = /*#__PURE__*/function (_React$Component) {
24201
24123
  var _this4;
24202
24124
  _classCallCheck(this, WrapperComponent);
24203
24125
  _this4 = _callSuper(this, WrapperComponent, [props]);
24204
- _this4.setupDOMObserver = function () {
24205
- if (_this4.domObserver || _this4.isUnmounted) return;
24206
- var globalTabsContainer = document.getElementById('globalTabs');
24207
- if (!globalTabsContainer) return;
24208
- _this4.domObserver = new MutationObserver(function (mutations) {
24209
- if (_this4.isUnmounted) return;
24210
- mutations.forEach(function (mutation) {
24211
- if (mutation.type === 'childList') {
24212
- // 检查是否有TabPane节点被添加或删除
24213
- var addedTabPanes = Array.from(mutation.addedNodes).filter(function (node) {
24214
- return node.nodeType === Node.ELEMENT_NODE && node.classList && node.classList.contains('ant-tabs-tabpane');
24215
- });
24216
- var removedTabPanes = Array.from(mutation.removedNodes).filter(function (node) {
24217
- return node.nodeType === Node.ELEMENT_NODE && node.classList && node.classList.contains('ant-tabs-tabpane');
24218
- });
24219
- if (addedTabPanes.length > 0) {
24220
- console.log("[DOM\u76D1\u63A7] \u68C0\u6D4B\u5230 ".concat(addedTabPanes.length, " \u4E2ATabPane\u8282\u70B9\u88AB\u6DFB\u52A0"));
24221
- addedTabPanes.forEach(function (node) {
24222
- var key = node.getAttribute('data-node-key') || '未知';
24223
- console.log("[DOM\u76D1\u63A7] \u6DFB\u52A0\u7684TabPane: ".concat(key));
24224
- });
24225
- }
24226
- if (removedTabPanes.length > 0) {
24227
- console.log("[DOM\u76D1\u63A7] \u68C0\u6D4B\u5230 ".concat(removedTabPanes.length, " \u4E2ATabPane\u8282\u70B9\u88AB\u5220\u9664"));
24228
- removedTabPanes.forEach(function (node) {
24229
- var key = node.getAttribute('data-node-key') || '未知';
24230
- console.log("[DOM\u76D1\u63A7] \u5220\u9664\u7684TabPane: ".concat(key));
24231
- // 检查是否是当前组件对应的TabPane
24232
- if (key === _this4.props.item.key) {
24233
- console.log("[DOM\u76D1\u63A7] \u5F53\u524D\u7EC4\u4EF6 ".concat(_this4.props.item.key, " \u5BF9\u5E94\u7684TabPane\u5DF2\u4ECEDOM\u4E2D\u5220\u9664"));
24234
- }
24235
- });
24236
- }
24237
- // 统计当前DOM中的TabPane数量
24238
- var currentTabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane');
24239
- console.log("[DOM\u76D1\u63A7] \u5F53\u524DDOM\u4E2DTabPane\u8282\u70B9\u603B\u6570: ".concat(currentTabPanes.length));
24240
- }
24241
- });
24242
- });
24243
- // 开始观察
24244
- _this4.domObserver.observe(globalTabsContainer, {
24245
- childList: true,
24246
- subtree: true
24247
- });
24248
- console.log("[DOM\u76D1\u63A7] \u5DF2\u4E3A\u9875\u7B7E ".concat(_this4.props.item.key, " \u8BBE\u7F6EDOM\u53D8\u5316\u76D1\u63A7"));
24249
- };
24126
+ // 初始化组件状态
24250
24127
  // 通用事件处理器,用于清理
24251
24128
  _this4.handleEvent = function (event) {
24252
24129
  // 空的事件处理器,仅用于清理时移除监听器
24253
24130
  };
24254
- console.log("WrapperComponent \u6784\u9020\u51FD\u6570: \u9875\u7B7E ".concat(props.item.key, " \u521B\u5EFA"));
24255
- // 初始化MutationObserver
24256
- _this4.domObserver = null;
24257
24131
  _this4.isUnmounted = false;
24258
- // 统计当前DOM节点数
24259
- setTimeout(function () {
24260
- var tabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane');
24261
- console.log("[\u7EC4\u4EF6\u521B\u5EFA] \u9875\u7B7E ".concat(props.item.key, " \u521B\u5EFA\u540E\uFF0CDOM\u4E2DTabPane\u8282\u70B9\u6570: ").concat(tabPanes.length));
24262
- }, 0);
24263
24132
  return _this4;
24264
24133
  }
24265
24134
  _inherits(WrapperComponent, _React$Component);
24266
24135
  return _createClass(WrapperComponent, [{
24267
24136
  key: "componentDidMount",
24268
24137
  value: function componentDidMount() {
24269
- console.log("WrapperComponent \u6302\u8F7D: \u9875\u7B7E ".concat(this.props.item.key, " \u5DF2\u6302\u8F7D\u5230DOM"));
24270
- var tabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane');
24271
- console.log("[\u7EC4\u4EF6\u6302\u8F7D] \u9875\u7B7E ".concat(this.props.item.key, " \u6302\u8F7D\u540E\uFF0CDOM\u4E2DTabPane\u8282\u70B9\u6570: ").concat(tabPanes.length));
24272
- // 设置MutationObserver监控DOM变化
24273
- this.setupDOMObserver();
24138
+ // 组件挂载完成
24274
24139
  }
24275
24140
  }, {
24276
24141
  key: "componentWillUnmount",
24277
24142
  value: function componentWillUnmount() {
24278
24143
  var _this5 = this;
24279
- console.log("WrapperComponent \u5378\u8F7D: \u9875\u7B7E ".concat(this.props.item.key, " \u7EC4\u4EF6\u6B63\u5728\u9500\u6BC1"));
24280
24144
  // 设置卸载标志
24281
24145
  this.isUnmounted = true;
24282
- var tabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane');
24283
- console.log("[\u7EC4\u4EF6\u5378\u8F7D] \u9875\u7B7E ".concat(this.props.item.key, " \u5378\u8F7D\u524D\uFF0CDOM\u4E2DTabPane\u8282\u70B9\u6570: ").concat(tabPanes.length));
24284
- // 清理MutationObserver
24285
- if (this.domObserver) {
24286
- this.domObserver.disconnect();
24287
- this.domObserver = null;
24288
- console.log("[\u6E05\u7406] \u5DF2\u65AD\u5F00\u9875\u7B7E ".concat(this.props.item.key, " \u7684DOM\u76D1\u63A7"));
24289
- }
24290
- // 强制清理所有可能的引用和事件监听器
24146
+ // 清理可能的DOM事件监听器
24291
24147
  try {
24292
- // 清理组件内部的所有引用
24293
- if (this.props && _typeof(this.props) === 'object') {
24294
- Object.keys(this.props).forEach(function (key) {
24295
- if (_this5.props[key] && _typeof(_this5.props[key]) === 'object') {
24296
- // 不直接删除props,但清理可能的循环引用
24297
- console.log("[\u6E05\u7406] \u68C0\u67E5prop: ".concat(key));
24298
- }
24299
- });
24300
- }
24301
- // 清理可能的DOM事件监听器
24302
24148
  var currentElement = document.querySelector("#globalTabs .ant-tabs-tabpane[data-node-key=\"".concat(this.props.item.key, "\"]"));
24303
24149
  if (currentElement) {
24304
24150
  // 移除所有可能的事件监听器
@@ -24307,26 +24153,14 @@ var WrapperComponent = /*#__PURE__*/function (_React$Component) {
24307
24153
  currentElement.removeEventListener(eventType, _this5.handleEvent, true);
24308
24154
  currentElement.removeEventListener(eventType, _this5.handleEvent, false);
24309
24155
  });
24310
- console.log("[\u6E05\u7406] \u5DF2\u6E05\u7406\u9875\u7B7E ".concat(this.props.item.key, " \u7684DOM\u4E8B\u4EF6\u76D1\u542C\u5668"));
24311
24156
  }
24312
24157
  // 强制垃圾回收提示
24313
24158
  if (window.gc && typeof window.gc === 'function') {
24314
24159
  window.gc();
24315
- console.log("[\u6E05\u7406] \u5DF2\u89E6\u53D1\u5783\u573E\u56DE\u6536");
24316
24160
  }
24317
24161
  } catch (error) {
24318
- console.error("[\u6E05\u7406\u9519\u8BEF] \u9875\u7B7E ".concat(this.props.item.key, " \u6E05\u7406\u8FC7\u7A0B\u4E2D\u51FA\u9519:"), error);
24162
+ // 清理过程中的错误处理
24319
24163
  }
24320
- // 延迟检查卸载后的DOM状态
24321
- setTimeout(function () {
24322
- var tabPanesAfter = document.querySelectorAll('#globalTabs .ant-tabs-tabpane');
24323
- console.log("[\u7EC4\u4EF6\u5378\u8F7D] \u9875\u7B7E ".concat(_this5.props.item.key, " \u5378\u8F7D\u540E\uFF0CDOM\u4E2DTabPane\u8282\u70B9\u6570: ").concat(tabPanesAfter.length));
24324
- // 强制检查内存使用情况
24325
- if (window.performance && window.performance.memory) {
24326
- var memory = window.performance.memory;
24327
- 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"));
24328
- }
24329
- }, 100);
24330
24164
  }
24331
24165
  }, {
24332
24166
  key: "shouldComponentUpdate",
@@ -28012,7 +27846,7 @@ pp$5.currentThisScope = function() {
28012
27846
  }
28013
27847
  };
28014
27848
 
28015
- var Node$1 = function Node(parser, pos, loc) {
27849
+ var Node = function Node(parser, pos, loc) {
28016
27850
  this.type = "";
28017
27851
  this.start = pos;
28018
27852
  this.end = 0;
@@ -28029,11 +27863,11 @@ var Node$1 = function Node(parser, pos, loc) {
28029
27863
  var pp$6 = Parser.prototype;
28030
27864
 
28031
27865
  pp$6.startNode = function() {
28032
- return new Node$1(this, this.start, this.startLoc)
27866
+ return new Node(this, this.start, this.startLoc)
28033
27867
  };
28034
27868
 
28035
27869
  pp$6.startNodeAt = function(pos, loc) {
28036
- return new Node$1(this, pos, loc)
27870
+ return new Node(this, pos, loc)
28037
27871
  };
28038
27872
 
28039
27873
  // Finish an AST node, adding `type` and `end` properties.
@@ -30101,7 +29935,7 @@ Parser.acorn = {
30101
29935
  Position: Position,
30102
29936
  SourceLocation: SourceLocation,
30103
29937
  getLineInfo: getLineInfo,
30104
- Node: Node$1,
29938
+ Node: Node,
30105
29939
  TokenType: TokenType,
30106
29940
  tokTypes: types,
30107
29941
  keywordTypes: keywords$1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "4.2.5-per-alpha.1",
3
+ "version": "4.2.5-per-alpha.2",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",