@bit-sun/business-component 3.1.15-alpha.0 → 3.1.15-alpha.1

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 CHANGED
@@ -6,7 +6,7 @@ import _, { isNil, escapeRegExp, omit, debounce as debounce$1, cloneDeep as clon
6
6
  import memoizeOne from 'memoize-one';
7
7
  import { formatMessage, history as history$1, useLocation, Link, useModel, setLocale, useIntl, request as request$3 } from 'umi';
8
8
  import isEqual from 'lodash/isEqual';
9
- import React$1, { useState, useEffect, forwardRef, useImperativeHandle, useRef, useMemo, Component, useCallback as useCallback$1, useLayoutEffect, createRef } from 'react';
9
+ import React$1, { useState, useEffect, forwardRef, useImperativeHandle, useRef, useMemo, Component, useCallback, useLayoutEffect, createRef } from 'react';
10
10
  import moment$1 from 'moment';
11
11
  import { EyeOutlined, DeleteOutlined, EditOutlined, CopyOutlined, CloseSquareOutlined, WarningOutlined, SendOutlined, ProfileTwoTone, ExclamationCircleOutlined, DownOutlined, UnorderedListOutlined, SearchOutlined, CaretLeftOutlined, CloseCircleOutlined, ArrowLeftOutlined, FolderOutlined, EllipsisOutlined, CaretDownOutlined, HomeOutlined, DoubleLeftOutlined, DoubleRightOutlined, MenuUnfoldOutlined, DashOutlined, SettingOutlined, BulbOutlined, PlayCircleOutlined, SaveOutlined, FullscreenExitOutlined, MinusCircleOutlined, PlusCircleOutlined } from '@ant-design/icons';
12
12
  import { request as request$2, Table as Table$1, QueryTable, Form as Form$1 } from 'bssula';
@@ -14588,13 +14588,13 @@ var HeaderWrapper = /*#__PURE__*/React$1.memo(function (_ref) {
14588
14588
  var breadcrumbNameMap = useMemo(function () {
14589
14589
  return getMainCrumbNameMap(memoizeOneFormatter(menuRoutes, ''));
14590
14590
  }, [menuRoutes]); // 只有menuRoutes变化时才重新创建
14591
- var matchParamsPath = useCallback$1(function (pathname, breadcrumbNameMap) {
14591
+ var matchParamsPath = useCallback(function (pathname, breadcrumbNameMap) {
14592
14592
  var pathKey = Object.keys(breadcrumbNameMap).find(function (key) {
14593
14593
  return pathToRegexp ? pathToRegexp(key).test(pathname) : false;
14594
14594
  });
14595
14595
  return pathKey ? breadcrumbNameMap[pathKey] : undefined;
14596
14596
  }, [pathToRegexp]);
14597
- var getPageTitle = useCallback$1(function (pathname) {
14597
+ var getPageTitle = useCallback(function (pathname) {
14598
14598
  var currRouterData = matchParamsPath("".concat(basePath).concat(pathname), breadcrumbNameMap);
14599
14599
  if (!currRouterData) {
14600
14600
  return '';
@@ -19383,14 +19383,14 @@ var CustomerMenu = /*#__PURE__*/forwardRef(function (_ref, ref) {
19383
19383
  _useState4 = _slicedToArray(_useState3, 2),
19384
19384
  settingModal = _useState4[0],
19385
19385
  settingModalFn = _useState4[1];
19386
- var handleMenuClick = useCallback$1(function (item) {
19386
+ var handleMenuClick = useCallback(function (item) {
19387
19387
  if (item.children || !item.component) return;
19388
19388
  setIsDrawer(false);
19389
19389
  history$1.push({
19390
19390
  pathname: item.path
19391
19391
  });
19392
19392
  }, []);
19393
- var getMenuDom = useCallback$1(function (menuData) {
19393
+ var getMenuDom = useCallback(function (menuData) {
19394
19394
  return menuData.map(function (item, index) {
19395
19395
  return /*#__PURE__*/React$1.createElement("div", {
19396
19396
  key: "".concat(item.path || item.name, "-").concat(index),
@@ -19596,7 +19596,7 @@ var DrawContent$1 = function DrawContent(_ref) {
19596
19596
  }
19597
19597
  };
19598
19598
  }, [rightMenuHeight]);
19599
- var getMenuContentHeight = useCallback$1(function () {
19599
+ var getMenuContentHeight = useCallback(function () {
19600
19600
  if (!isUnmountedRef.current) {
19601
19601
  var clientHeight = document.body.clientHeight;
19602
19602
  setHeight(clientHeight - 190);
@@ -19604,7 +19604,7 @@ var DrawContent$1 = function DrawContent(_ref) {
19604
19604
  }
19605
19605
  }, []);
19606
19606
  // 优化递归渲染函数,使用React.memo减少重复渲染
19607
- var renderChildItem = useCallback$1(function (child) {
19607
+ var renderChildItem = useCallback(function (child) {
19608
19608
  if (!child.hideInMenu && child.children) {
19609
19609
  return /*#__PURE__*/React$1.createElement(React$1.Fragment, {
19610
19610
  key: child.path || child.locale
@@ -19654,7 +19654,7 @@ var DrawContent$1 = function DrawContent(_ref) {
19654
19654
  }
19655
19655
  return null;
19656
19656
  }, [onMenuClick]);
19657
- var onMenuClick = useCallback$1(function (e, item) {
19657
+ var onMenuClick = useCallback(function (e, item) {
19658
19658
  if (isUnmountedRef.current) return;
19659
19659
  e.stopPropagation();
19660
19660
  e.preventDefault();
@@ -19682,7 +19682,7 @@ var DrawContent$1 = function DrawContent(_ref) {
19682
19682
  onClose();
19683
19683
  }, [itemPath, onClose]);
19684
19684
  // 创建debounce搜索函数
19685
- var debouncedSearch = useCallback$1(function (value) {
19685
+ var debouncedSearch = useCallback(function (value) {
19686
19686
  if (debounceTimerRef.current) {
19687
19687
  clearTimeout(debounceTimerRef.current);
19688
19688
  }
@@ -19692,13 +19692,13 @@ var DrawContent$1 = function DrawContent(_ref) {
19692
19692
  }
19693
19693
  }, 600);
19694
19694
  }, [authorityMenu]);
19695
- var handleSearchChange = useCallback$1(function (e) {
19695
+ var handleSearchChange = useCallback(function (e) {
19696
19696
  if (!isUnmountedRef.current) {
19697
19697
  debouncedSearch(e.target.value);
19698
19698
  }
19699
19699
  }, [debouncedSearch]);
19700
19700
  // 优化菜单项点击处理器
19701
- var handleMenuItemClick = useCallback$1(function (item) {
19701
+ var handleMenuItemClick = useCallback(function (item) {
19702
19702
  if (isUnmountedRef.current) return;
19703
19703
  if (item.component) {
19704
19704
  history$1.push({
@@ -19712,13 +19712,13 @@ var DrawContent$1 = function DrawContent(_ref) {
19712
19712
  }
19713
19713
  }, [onClose]);
19714
19714
  // 优化关闭按钮点击处理器
19715
- var handleCloseClick = useCallback$1(function () {
19715
+ var handleCloseClick = useCallback(function () {
19716
19716
  if (!isUnmountedRef.current) {
19717
19717
  onClose();
19718
19718
  }
19719
19719
  }, [onClose]);
19720
19720
  // 优化搜索结果点击处理器
19721
- var handleSearchResultClick = useCallback$1(function (item) {
19721
+ var handleSearchResultClick = useCallback(function (item) {
19722
19722
  if (!isUnmountedRef.current) {
19723
19723
  onMenuClick({
19724
19724
  stopPropagation: function stopPropagation() {},
@@ -19727,7 +19727,7 @@ var DrawContent$1 = function DrawContent(_ref) {
19727
19727
  }
19728
19728
  }, [onMenuClick]);
19729
19729
  // 优化更多按钮点击处理器
19730
- var handleMoreButtonClick = useCallback$1(function () {
19730
+ var handleMoreButtonClick = useCallback(function () {
19731
19731
  if (!isUnmountedRef.current) {
19732
19732
  setShowScroll(true);
19733
19733
  setMoreBtnShow(false);
package/dist/index.js CHANGED
@@ -16320,7 +16320,7 @@ var ResizeableTitle$2 = function ResizeableTitle(props) {
16320
16320
  var uuidref = React$1.useRef(uuid());
16321
16321
  var prevWidthRef = React$1.useRef(width);
16322
16322
  // 使用useCallback优化事件处理函数,避免重复创建
16323
- var handleMouseMove = useCallback(function (e) {
16323
+ var handleMouseMove = React$1.useCallback(function (e) {
16324
16324
  e.stopPropagation();
16325
16325
  e.preventDefault();
16326
16326
  // 更新标记位置
@@ -16334,12 +16334,12 @@ var ResizeableTitle$2 = function ResizeableTitle(props) {
16334
16334
  dom.style.top = "".concat(e.clientY - 20, "px");
16335
16335
  }
16336
16336
  }, []);
16337
- var handleMouseUp = useCallback(function (e) {
16337
+ var handleMouseUp = React$1.useCallback(function (e) {
16338
16338
  document.removeEventListener('mousemove', handleMouseMove);
16339
16339
  document.removeEventListener('mouseup', handleMouseUp);
16340
16340
  setIsResizing(false);
16341
16341
  }, [handleMouseMove]);
16342
- var handleMouseDown = useCallback(function (e) {
16342
+ var handleMouseDown = React$1.useCallback(function (e) {
16343
16343
  currentStart.current = e.clientX;
16344
16344
  markerPosition.current = {
16345
16345
  left: e.clientX,
@@ -16500,7 +16500,7 @@ var BsSulaQueryTable = (function (props) {
16500
16500
  }, [height]);
16501
16501
  var bsTableCodeExport = "".concat(bsTableCode, "___Export"); //设置导出列字段的唯一标识
16502
16502
  // 获取table高度
16503
- var getTableHeight = useCallback(function () {
16503
+ var getTableHeight = React$1.useCallback(function () {
16504
16504
  // 清理之前的定时器
16505
16505
  if (tableHeightTimer.current) {
16506
16506
  clearTimeout(tableHeightTimer.current);
@@ -16619,7 +16619,7 @@ var BsSulaQueryTable = (function (props) {
16619
16619
  setShowSearchFields(_toConsumableArray(showSearchFields));
16620
16620
  };
16621
16621
  // 创建稳定的resize事件处理函数引用
16622
- var handleWindowResize = useCallback(function () {
16622
+ var handleWindowResize = React$1.useCallback(function () {
16623
16623
  watchWinResize();
16624
16624
  }, [watchWinResize]);
16625
16625
  //组件初始挂载
@@ -16970,7 +16970,7 @@ var BsSulaQueryTable = (function (props) {
16970
16970
  React$1.useEffect(function () {
16971
16971
  setInitialTableInfo();
16972
16972
  }, [props === null || props === void 0 ? void 0 : props.refreshColumns]);
16973
- var watchWinResize = useCallback(function () {
16973
+ var watchWinResize = React$1.useCallback(function () {
16974
16974
  // 清理之前的定时器
16975
16975
  if (debounceTimer.current) {
16976
16976
  clearTimeout(debounceTimer.current);
@@ -17013,7 +17013,7 @@ var BsSulaQueryTable = (function (props) {
17013
17013
  });
17014
17014
  };
17015
17015
  // 处理 table 基本参数 - 使用useCallback避免闭包引用
17016
- var setTableProps = useCallback(function () {
17016
+ var setTableProps = React$1.useCallback(function () {
17017
17017
  var _tableProps$initialPa, _value$tableProps, _value$tableProps$ini, _tableProps$initialPa2;
17018
17018
  var defaultPageSize = 20;
17019
17019
  var baseTableProps = {
@@ -17057,7 +17057,7 @@ var BsSulaQueryTable = (function (props) {
17057
17057
  showQuickJumper: true,
17058
17058
  hideOnSinglePage: value.hideOnSinglePage || false
17059
17059
  }, (_value$tableProps = value.tableProps) === null || _value$tableProps === void 0 ? void 0 : (_value$tableProps$ini = _value$tableProps.initialPaging) === null || _value$tableProps$ini === void 0 ? void 0 : _value$tableProps$ini.pagination);
17060
- var handleRowClick = useCallback(function (record) {
17060
+ var handleRowClick = React$1.useCallback(function (record) {
17061
17061
  var _rowsRef$current, _rowsRef$current2;
17062
17062
  var rowKey = value.rowKey;
17063
17063
  var newSelectedRowKeys = _toConsumableArray((rowsRef === null || rowsRef === void 0 ? void 0 : (_rowsRef$current = rowsRef.current) === null || _rowsRef$current === void 0 ? void 0 : _rowsRef$current.selectedRowKeys) || []);
@@ -17083,7 +17083,7 @@ var BsSulaQueryTable = (function (props) {
17083
17083
  rowSelection.onChange(newSelectedRowKeys, newSelectedRows);
17084
17084
  }
17085
17085
  }, [value.rowKey, value.rowSelection]);
17086
- var handleRowDoubleClick = useCallback(function (record) {
17086
+ var handleRowDoubleClick = React$1.useCallback(function (record) {
17087
17087
  if (props.viewPagePath) {
17088
17088
  var path = eval("`".concat(props.viewPagePath.replace(/'/g, '`').replace(/#{(.*?)}/g, function (match, p) {
17089
17089
  return "${".concat(p, "}");
@@ -17383,7 +17383,7 @@ var BsSulaQueryTable = (function (props) {
17383
17383
  * ]
17384
17384
  * @returns []
17385
17385
  */
17386
- var getTableSummaryInfo = useCallback(function () {
17386
+ var getTableSummaryInfo = React$1.useCallback(function () {
17387
17387
  // 检查组件是否已卸载,避免创建新的JSX元素
17388
17388
  if (isUnmountedRef.current) {
17389
17389
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "3.1.15-alpha.0",
3
+ "version": "3.1.15-alpha.1",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -1,5 +1,5 @@
1
1
  // @ts-nocheck
2
- import React, { useState, useEffect, useRef, useMemo } from 'react';
2
+ import React, { useState, useEffect, useRef, useMemo, useCallback } from 'react';
3
3
  import { useLocation } from 'umi';
4
4
  import { QueryTable } from 'bssula';
5
5
  import {