@bit-sun/business-component 2.3.4 → 2.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  import './index.less';
2
- export declare type SiderTheme = 'light' | 'dark';
2
+ export type SiderTheme = 'light' | 'dark';
3
3
  declare const DrawContent: ({ onClose, itemPath }: any) => JSX.Element;
4
4
  export default DrawContent;
@@ -1,4 +1,4 @@
1
1
  import './index.less';
2
- export declare type SiderTheme = 'light' | 'dark';
2
+ export type SiderTheme = 'light' | 'dark';
3
3
  declare const AllFunc: any;
4
4
  export default AllFunc;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import './home.less';
3
- export declare type SiderTheme = 'light' | 'dark';
4
- export declare type GlobalHeaderRightProps = {
3
+ export type SiderTheme = 'light' | 'dark';
4
+ export type GlobalHeaderRightProps = {
5
5
  menu?: boolean;
6
6
  };
7
7
  declare const GlobalHeaderRight: React.FC<GlobalHeaderRightProps>;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
- export declare type SiderTheme = 'light' | 'dark';
4
- export declare type GlobalHeaderRightProps = {
3
+ export type SiderTheme = 'light' | 'dark';
4
+ export type GlobalHeaderRightProps = {
5
5
  menu?: boolean;
6
6
  };
7
7
  declare const AllFunc: React.FC<GlobalHeaderRightProps>;
@@ -2,14 +2,14 @@ import type { MenuDataItem, BasicLayoutProps as ProLayoutProps, Settings } from
2
2
  import React from 'react';
3
3
  import './index.less';
4
4
  export declare const RouterContext: React.Context<{}>;
5
- export declare type BasicLayoutProps = {
5
+ export type BasicLayoutProps = {
6
6
  breadcrumbNameMap: Record<string, MenuDataItem>;
7
7
  route: ProLayoutProps['route'] & {
8
8
  authority: string[];
9
9
  };
10
10
  settings: Settings;
11
11
  } & ProLayoutProps;
12
- export declare type BasicLayoutContext = {
12
+ export type BasicLayoutContext = {
13
13
  [K in 'location']: BasicLayoutProps[K];
14
14
  } & {
15
15
  breadcrumbNameMap: Record<string, MenuDataItem>;
@@ -46,13 +46,13 @@ export declare const handleTextLineFeed: (text: string | undefined, width?: numb
46
46
  export declare const handleTextOverflow: (text: string | undefined, width?: number) => JSX.Element;
47
47
  export declare const handleTooltip: (text: any, timeTrue?: boolean) => JSX.Element;
48
48
  export declare const handleTooltipHours: (text: any, timeTrue?: boolean) => JSX.Element;
49
- declare type tableColumnsImageType = {
49
+ type tableColumnsImageType = {
50
50
  width?: number | string;
51
51
  height?: number | string;
52
52
  [key: string]: any;
53
53
  };
54
54
  export declare const tableColumnsImage: (url?: string, paramsObj?: tableColumnsImageType) => JSX.Element;
55
- declare type UserColumnsType = {
55
+ type UserColumnsType = {
56
56
  name: string;
57
57
  department?: string;
58
58
  position?: string;
@@ -1,5 +1,5 @@
1
1
  import type { CascaderProps as ACascaderProps } from 'antd/lib/cascader';
2
- export declare type CascaderSourceItem = {
2
+ export type CascaderSourceItem = {
3
3
  text: any;
4
4
  value: any;
5
5
  };
package/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import axios from 'axios';
2
2
  import { message as message$1, Popover, Card, Avatar, Tooltip, Image, Menu, Space, Dropdown, Button, Checkbox, Input, Modal, Select, Form, Divider, Spin, Table, TreeSelect, Tag, InputNumber, Typography, Alert, Anchor, Breadcrumb, Drawer as Drawer$1, List, Tree, Row, Col, Tabs, Affix, Cascader, DatePicker, TimePicker, Switch } from 'antd';
3
3
  import _, { omit, debounce, cloneDeep as cloneDeep$1, throttle, isEmpty } from 'lodash';
4
4
  import { history, formatMessage, useLocation, Link, useModel, useIntl } from 'umi';
5
- import isEqual from 'lodash/isEqual';
5
+ import isEqual$1 from 'lodash/isEqual';
6
6
  import React, { useState, useEffect, forwardRef, useImperativeHandle, useRef, useMemo, Component, useLayoutEffect, createRef } from 'react';
7
7
  import moment$1 from 'moment';
8
8
  import { UnorderedListOutlined, ProfileTwoTone, ExclamationCircleOutlined, DownOutlined, CopyOutlined, SearchOutlined, CaretLeftOutlined, CloseCircleOutlined, ArrowLeftOutlined, FolderOutlined, EllipsisOutlined, CaretDownOutlined, HomeOutlined, DoubleLeftOutlined, DoubleRightOutlined, MenuUnfoldOutlined, DashOutlined, SettingOutlined, BulbOutlined, PlayCircleOutlined, SaveOutlined, FullscreenExitOutlined, EditOutlined, MinusCircleOutlined, PlusCircleOutlined } from '@ant-design/icons';
@@ -136,6 +136,33 @@ axios.interceptors.request.use(function (config) {
136
136
  return config;
137
137
  });
138
138
 
139
+ function _iterableToArrayLimit(arr, i) {
140
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
141
+ if (null != _i) {
142
+ var _s,
143
+ _e,
144
+ _x,
145
+ _r,
146
+ _arr = [],
147
+ _n = !0,
148
+ _d = !1;
149
+ try {
150
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
151
+ if (Object(_i) !== _i) return;
152
+ _n = !1;
153
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
154
+ } catch (err) {
155
+ _d = !0, _e = err;
156
+ } finally {
157
+ try {
158
+ if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
159
+ } finally {
160
+ if (_d) throw _e;
161
+ }
162
+ }
163
+ return _arr;
164
+ }
165
+ }
139
166
  function ownKeys(object, enumerableOnly) {
140
167
  var keys = Object.keys(object);
141
168
  if (Object.getOwnPropertySymbols) {
@@ -292,14 +319,9 @@ function _regeneratorRuntime() {
292
319
  };
293
320
  }
294
321
  function maybeInvokeDelegate(delegate, context) {
295
- var method = delegate.iterator[context.method];
296
- if (undefined === method) {
297
- if (context.delegate = null, "throw" === context.method) {
298
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
299
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
300
- }
301
- return ContinueSentinel;
302
- }
322
+ var methodName = context.method,
323
+ method = delegate.iterator[methodName];
324
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
303
325
  var record = tryCatch(method, delegate.iterator, context.arg);
304
326
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
305
327
  var info = record.arg;
@@ -513,7 +535,7 @@ function _defineProperties(target, props) {
513
535
  descriptor.enumerable = descriptor.enumerable || false;
514
536
  descriptor.configurable = true;
515
537
  if ("value" in descriptor) descriptor.writable = true;
516
- Object.defineProperty(target, descriptor.key, descriptor);
538
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
517
539
  }
518
540
  }
519
541
  function _createClass(Constructor, protoProps, staticProps) {
@@ -525,6 +547,7 @@ function _createClass(Constructor, protoProps, staticProps) {
525
547
  return Constructor;
526
548
  }
527
549
  function _defineProperty(obj, key, value) {
550
+ key = _toPropertyKey(key);
528
551
  if (key in obj) {
529
552
  Object.defineProperty(obj, key, {
530
553
  value: value,
@@ -667,30 +690,6 @@ function _arrayWithHoles(arr) {
667
690
  function _iterableToArray(iter) {
668
691
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
669
692
  }
670
- function _iterableToArrayLimit(arr, i) {
671
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
672
- if (_i == null) return;
673
- var _arr = [];
674
- var _n = true;
675
- var _d = false;
676
- var _s, _e;
677
- try {
678
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
679
- _arr.push(_s.value);
680
- if (i && _arr.length === i) break;
681
- }
682
- } catch (err) {
683
- _d = true;
684
- _e = err;
685
- } finally {
686
- try {
687
- if (!_n && _i["return"] != null) _i["return"]();
688
- } finally {
689
- if (_d) throw _e;
690
- }
691
- }
692
- return _arr;
693
- }
694
693
  function _unsupportedIterableToArray(o, minLen) {
695
694
  if (!o) return;
696
695
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -710,6 +709,20 @@ function _nonIterableSpread() {
710
709
  function _nonIterableRest() {
711
710
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
712
711
  }
712
+ function _toPrimitive(input, hint) {
713
+ if (typeof input !== "object" || input === null) return input;
714
+ var prim = input[Symbol.toPrimitive];
715
+ if (prim !== undefined) {
716
+ var res = prim.call(input, hint || "default");
717
+ if (typeof res !== "object") return res;
718
+ throw new TypeError("@@toPrimitive must return a primitive value.");
719
+ }
720
+ return (hint === "string" ? String : Number)(input);
721
+ }
722
+ function _toPropertyKey(arg) {
723
+ var key = _toPrimitive(arg, "string");
724
+ return typeof key === "symbol" ? key : String(key);
725
+ }
713
726
 
714
727
  var checkQuantityAccuracy = function checkQuantityAccuracy(value, accuracy, errorInfo) {
715
728
  var errorMessage = _objectSpread2({
@@ -749,41 +762,52 @@ var precisionQuantity = function precisionQuantity(num, accuracy) {
749
762
  return '';
750
763
  };
751
764
 
752
- var simpleIsEqual = function simpleIsEqual(a, b) {
753
- return a === b;
754
- };
755
-
756
- function index$1 (resultFn, isEqual) {
757
- if (isEqual === void 0) {
758
- isEqual = simpleIsEqual;
759
- }
760
-
761
- var lastThis;
762
- var lastArgs = [];
763
- var lastResult;
764
- var calledOnce = false;
765
-
766
- var isNewArgEqualToLast = function isNewArgEqualToLast(newArg, index) {
767
- return isEqual(newArg, lastArgs[index], index);
768
- };
769
-
770
- var result = function result() {
771
- for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) {
772
- newArgs[_key] = arguments[_key];
765
+ var safeIsNaN = Number.isNaN ||
766
+ function ponyfill(value) {
767
+ return typeof value === 'number' && value !== value;
768
+ };
769
+ function isEqual(first, second) {
770
+ if (first === second) {
771
+ return true;
773
772
  }
774
-
775
- if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) {
776
- return lastResult;
773
+ if (safeIsNaN(first) && safeIsNaN(second)) {
774
+ return true;
777
775
  }
776
+ return false;
777
+ }
778
+ function areInputsEqual(newInputs, lastInputs) {
779
+ if (newInputs.length !== lastInputs.length) {
780
+ return false;
781
+ }
782
+ for (var i = 0; i < newInputs.length; i++) {
783
+ if (!isEqual(newInputs[i], lastInputs[i])) {
784
+ return false;
785
+ }
786
+ }
787
+ return true;
788
+ }
778
789
 
779
- lastResult = resultFn.apply(this, newArgs);
780
- calledOnce = true;
781
- lastThis = this;
782
- lastArgs = newArgs;
783
- return lastResult;
784
- };
785
-
786
- return result;
790
+ function memoizeOne(resultFn, isEqual) {
791
+ if (isEqual === void 0) { isEqual = areInputsEqual; }
792
+ var lastThis;
793
+ var lastArgs = [];
794
+ var lastResult;
795
+ var calledOnce = false;
796
+ function memoized() {
797
+ var newArgs = [];
798
+ for (var _i = 0; _i < arguments.length; _i++) {
799
+ newArgs[_i] = arguments[_i];
800
+ }
801
+ if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {
802
+ return lastResult;
803
+ }
804
+ lastResult = resultFn.apply(this, newArgs);
805
+ calledOnce = true;
806
+ lastThis = this;
807
+ lastArgs = newArgs;
808
+ return lastResult;
809
+ }
810
+ return memoized;
787
811
  }
788
812
 
789
813
  function styleInject(css, ref) {
@@ -1094,7 +1118,7 @@ var formatter = function formatter(data, parentAuthority, parentName) {
1094
1118
  return item;
1095
1119
  });
1096
1120
  };
1097
- var memoizeOneFormatter = index$1(formatter, isEqual);
1121
+ var memoizeOneFormatter = memoizeOne(formatter, isEqual$1);
1098
1122
  var go2BackAndClose = function go2BackAndClose() {
1099
1123
  localStorage.setItem(ENUM.BROWSER_CACHE.CHILD_APP_BACK, 1);
1100
1124
  history.goBack();
@@ -9581,7 +9605,7 @@ var CommodityEntry = function CommodityEntry(props) {
9581
9605
  * @LastEditTime: 2022-01-14 17:17:26
9582
9606
  * @LastEditors: rodchen
9583
9607
  */
9584
- var index$2 = (function (storageKeyString) {
9608
+ var index$1 = (function (storageKeyString) {
9585
9609
  var seconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
9586
9610
  var tipsCallFunction = arguments.length > 2 ? arguments[2] : undefined;
9587
9611
  if (typeof seconds !== 'number') throw new Error('seconds should be number');
@@ -9946,7 +9970,7 @@ var BusinessTreeSearchSelect$1 = /*#__PURE__*/React.memo(BusinessTreeSearchSelec
9946
9970
  var css_248z$8 = ".form-status-label {\n height: 48px;\n margin-right: 12px;\n display: inline-block;\n position: relative;\n background-color: #B0B4B7;\n align-items: center;\n}\n.choosed-status-label.form-status-label {\n background-color: #005CFF;\n}\n.form-status-label:last-child {\n margin-right: 0px;\n}\n.form-status-label:first-child::after {\n position: absolute;\n display: block;\n content: '';\n right: -48px;\n top: 0;\n width: 48px;\n height: 48px;\n border: 24px solid;\n border-color: transparent transparent transparent transparent;\n border-left: 12px solid #B0B4B7;\n}\n.choosed-status-label.form-status-label::after {\n border-left: 12px solid #005CFF;\n}\n.choosed-status-label.form-status-label:not(:first-child):not(:last-child)::after {\n border-left: 12px solid #005CFF;\n}\n.form-status-label:last-child::after {\n position: absolute;\n display: block;\n content: '';\n left: 0;\n top: 0;\n width: 48px;\n height: 48px;\n border: 24px solid;\n border-color: transparent transparent transparent transparent;\n border-left: 12px solid #ffffff;\n}\n.form-status-label:not(:first-child):not(:last-child)::before {\n position: absolute;\n display: block;\n content: '';\n left: 0;\n top: 0;\n width: 48px;\n height: 48px;\n border: 24px solid;\n border-color: transparent transparent transparent transparent;\n border-left: 12px solid #ffffff;\n}\n.form-status-label:not(:first-child):not(:last-child)::after {\n position: absolute;\n display: block;\n content: '';\n right: -48px;\n top: 0;\n width: 48px;\n height: 48px;\n border: 24px solid;\n border-color: transparent transparent transparent transparent;\n border-left: 12px solid #B0B4B7;\n}\n.status-label-index {\n display: inline-block;\n width: 24px;\n height: 24px;\n border: 1px solid #FFFFFF;\n color: #FFFFFF;\n border-radius: 50%;\n font-family: Montserrat;\n font-size: 14px;\n line-height: 24px;\n text-align: center;\n margin: 0 6px 0 20px;\n}\n.status-label-key {\n width: 50px;\n height: 100%;\n display: inline-flex;\n float: left;\n align-items: center;\n justify-content: center;\n}\n.status-label-operate {\n float: left;\n width: calc(100% - 50px);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n height: 100%;\n margin: 4px 0;\n}\n.status-label-operate > div {\n font-size: 12px;\n height: 20px;\n line-height: 20px;\n color: #FFFFFF;\n font-family: PingFangSC;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.status-label-operate > div:first-child {\n font-size: 14px;\n font-weight: 600;\n}\n.only-one-child.form-status-label::after,\n.only-one-child.form-status-label::before {\n border-left: 0px;\n}\n";
9947
9971
  styleInject(css_248z$8);
9948
9972
 
9949
- var index$3 = (function (props) {
9973
+ var index$2 = (function (props) {
9950
9974
  var _props$formStatusMapp = props.formStatusMapping,
9951
9975
  formStatusMapping = _props$formStatusMapp === void 0 ? [] : _props$formStatusMapp;
9952
9976
  return /*#__PURE__*/React.createElement("div", {
@@ -11370,7 +11394,7 @@ var iconMap = {
11370
11394
  src: moreIcon
11371
11395
  })
11372
11396
  };
11373
- var index$4 = (function (props) {
11397
+ var index$3 = (function (props) {
11374
11398
  var _useLocation = useLocation(),
11375
11399
  pathname = _useLocation.pathname;
11376
11400
  var _useState = useState(pathname + 'id'),
@@ -11587,7 +11611,7 @@ var css_248z$d = ".home_page_head {\n height: 54px;\n display: flex;\n justif
11587
11611
  styleInject(css_248z$d);
11588
11612
 
11589
11613
  var _excluded$c = ["children"];
11590
- var index$5 = (function (props) {
11614
+ var index$4 = (function (props) {
11591
11615
  var _useLocation = useLocation(),
11592
11616
  pathname = _useLocation.pathname;
11593
11617
  var _useState = useState(pathname + 'id'),
@@ -16683,7 +16707,7 @@ var WrapperComponent = /*#__PURE__*/function (_React$Component) {
16683
16707
  }]);
16684
16708
  return WrapperComponent;
16685
16709
  }(React.Component);
16686
- var index$6 = (function (props) {
16710
+ var index$5 = (function (props) {
16687
16711
  var _useModel = useModel('@@initialState'),
16688
16712
  _useModel$initialStat = _useModel.initialState,
16689
16713
  initialState = _useModel$initialStat === void 0 ? {} : _useModel$initialStat;
@@ -16924,7 +16948,7 @@ var FixedScrollBar = function FixedScrollBar(_ref, ref) {
16924
16948
  };
16925
16949
  var FixedScrollBar$1 = /*#__PURE__*/React.forwardRef(FixedScrollBar);
16926
16950
 
16927
- var index$7 = /*#__PURE__*/forwardRef(function (props, ref) {
16951
+ var index$6 = /*#__PURE__*/forwardRef(function (props, ref) {
16928
16952
  var _useState = useState(false),
16929
16953
  _useState2 = _slicedToArray(_useState, 2),
16930
16954
  show = _useState2[0],
@@ -16935,7 +16959,6 @@ var index$7 = /*#__PURE__*/forwardRef(function (props, ref) {
16935
16959
  colLastData: [],
16936
16960
  rowHeader: [],
16937
16961
  rowLastData: [],
16938
- colHeaderWidth: 400,
16939
16962
  colHeaderToTop: 0
16940
16963
  }),
16941
16964
  _useState4 = _slicedToArray(_useState3, 2),
@@ -16954,34 +16977,46 @@ var index$7 = /*#__PURE__*/forwardRef(function (props, ref) {
16954
16977
  viewCount = _useState10[0],
16955
16978
  setViewCount = _useState10[1]; //虚拟表格每次渲染数量
16956
16979
  var itemWidth = 100; // 表格每一项宽度
16980
+ var _useState11 = useState((props === null || props === void 0 ? void 0 : props.colHeaderWidth) || 400),
16981
+ _useState12 = _slicedToArray(_useState11, 2),
16982
+ realColHeaderWidth = _useState12[0],
16983
+ setLeftWidth = _useState12[1];
16957
16984
  var viewPort = useRef(null);
16958
16985
  var topScrollBar = useRef(null);
16986
+ var leftTableRef = useRef(null);
16959
16987
  //起始渲染item
16960
- var _useState11 = useState(0),
16961
- _useState12 = _slicedToArray(_useState11, 2),
16962
- startIndex = _useState12[0],
16963
- setStartIndex = _useState12[1];
16988
+ var _useState13 = useState(0),
16989
+ _useState14 = _slicedToArray(_useState13, 2),
16990
+ startIndex = _useState14[0],
16991
+ setStartIndex = _useState14[1];
16964
16992
  //结束渲染item
16965
16993
  var endIndex = useMemo(function () {
16966
16994
  return startIndex + viewCount;
16967
16995
  }, [startIndex, viewCount]);
16968
16996
  //表格偏移量
16969
- var _useState13 = useState(0),
16970
- _useState14 = _slicedToArray(_useState13, 2),
16971
- offsetWidth = _useState14[0],
16972
- setOffset = _useState14[1];
16997
+ var _useState15 = useState(0),
16998
+ _useState16 = _slicedToArray(_useState15, 2),
16999
+ offsetWidth = _useState16[0],
17000
+ setOffset = _useState16[1];
16973
17001
  useEffect(function () {
16974
- var viewPortWidth = viewPort.current.clientWidth;
16975
- var defaultTableWidth = viewPortWidth - (props.colHeaderWidth || 400);
16976
- var viewCount = Math.floor(defaultTableWidth / itemWidth) + 2 <= 10 ? 10 : Math.floor(defaultTableWidth / itemWidth) + 2;
16977
- setViewCount(viewCount);
17002
+ setTimeout(function () {
17003
+ var realLeftTableWidth = leftTableRef.current.clientWidth;
17004
+ var viewPortWidth = viewPort.current.clientWidth;
17005
+ var defaultTableWidth = viewPortWidth - realLeftTableWidth;
17006
+ var viewCount = Math.floor(defaultTableWidth / itemWidth) + 2 <= 10 ? 10 : Math.floor(defaultTableWidth / itemWidth) + 2;
17007
+ setViewCount(viewCount);
17008
+ setLeftWidth(realLeftTableWidth);
17009
+ });
16978
17010
  }, []);
16979
- var onScroll = function onScroll() {
17011
+ var onScroll = function onScroll(e) {
16980
17012
  if (topScrollBar.current) {
16981
17013
  topScrollBar.current.scrollTo(viewPort.current.scrollLeft, 0);
16982
17014
  }
16983
17015
  var scrollWidth = viewPort.current.scrollLeft;
16984
17016
  var startIndex = Math.floor(scrollWidth / itemWidth);
17017
+ if (startIndex + viewCount >= colTableData.length) {
17018
+ startIndex = colTableData.length - viewCount <= 0 ? 0 : colTableData.length - viewCount;
17019
+ }
16985
17020
  var offsetWidth = startIndex * itemWidth;
16986
17021
  setStartIndex(startIndex);
16987
17022
  setOffset(offsetWidth);
@@ -16999,9 +17034,7 @@ var index$7 = /*#__PURE__*/forwardRef(function (props, ref) {
16999
17034
  // 设置表头相关信息
17000
17035
  useEffect(function () {
17001
17036
  var colData = props.colData,
17002
- rowData = props.rowData,
17003
- _props$colHeaderWidth = props.colHeaderWidth,
17004
- colHeaderWidth = _props$colHeaderWidth === void 0 ? 400 : _props$colHeaderWidth;
17037
+ rowData = props.rowData;
17005
17038
  var tableType;
17006
17039
  if (colData && colData.length && rowData && rowData.length) {
17007
17040
  tableType = 'multi-header-table';
@@ -17014,7 +17047,6 @@ var index$7 = /*#__PURE__*/forwardRef(function (props, ref) {
17014
17047
  rowHeader: [],
17015
17048
  rowLastData: []
17016
17049
  }, colHeaderData), rowHeaderData), {}, {
17017
- colHeaderWidth: colHeaderWidth,
17018
17050
  colHeaderToTop: ((rowHeader === null || rowHeader === void 0 ? void 0 : rowHeader.length) || 0) * 40,
17019
17051
  tableType: tableType
17020
17052
  }));
@@ -17027,7 +17059,6 @@ var index$7 = /*#__PURE__*/forwardRef(function (props, ref) {
17027
17059
  rowHeader: [],
17028
17060
  rowLastData: []
17029
17061
  }, _colHeaderData), {}, {
17030
- colHeaderWidth: colHeaderWidth || 400,
17031
17062
  colHeaderToTop: 0,
17032
17063
  tableType: tableType
17033
17064
  }));
@@ -17069,7 +17100,7 @@ var index$7 = /*#__PURE__*/forwardRef(function (props, ref) {
17069
17100
  tableProps = props.tableProps;
17070
17101
  var tableWidth = width ? "".concat(width, "px") : '100%';
17071
17102
  var tableHeight = "".concat(height || 400, "px");
17072
- var rightAreaWidth = 'calc(100% - ' + "".concat(config.colHeaderWidth, "px") + ')';
17103
+ var rightAreaWidth = 'calc(100% - ' + "".concat(realColHeaderWidth, "px") + ')';
17073
17104
  return /*#__PURE__*/React.createElement("div", {
17074
17105
  style: {
17075
17106
  width: tableWidth,
@@ -17085,7 +17116,7 @@ var index$7 = /*#__PURE__*/forwardRef(function (props, ref) {
17085
17116
  ref: topScrollBar
17086
17117
  }), /*#__PURE__*/React.createElement("div", {
17087
17118
  style: {
17088
- width: "".concat(config.colHeaderWidth + 1 + placeholderWidth, "px"),
17119
+ width: "".concat(realColHeaderWidth + placeholderWidth, "px"),
17089
17120
  position: 'absolute',
17090
17121
  top: 0,
17091
17122
  left: 0,
@@ -17093,7 +17124,7 @@ var index$7 = /*#__PURE__*/forwardRef(function (props, ref) {
17093
17124
  }
17094
17125
  }), /*#__PURE__*/React.createElement("table", {
17095
17126
  style: {
17096
- width: "".concat(config.colHeaderWidth + 1, "px"),
17127
+ width: "".concat(realColHeaderWidth, "px"),
17097
17128
  height: "".concat(config.colHeaderToTop, "px"),
17098
17129
  display: config.tableType === 'col-header-table' ? 'none' : ''
17099
17130
  },
@@ -17102,11 +17133,12 @@ var index$7 = /*#__PURE__*/forwardRef(function (props, ref) {
17102
17133
  style: {
17103
17134
  tableLayout: 'auto',
17104
17135
  minWidth: '100px',
17105
- width: "".concat(config.colHeaderWidth + 1, "px"),
17136
+ width: "".concat(realColHeaderWidth, "px"),
17106
17137
  top: "".concat(config.colHeaderToTop, "px"),
17107
17138
  left: '0px',
17108
17139
  position: 'sticky'
17109
17140
  },
17141
+ ref: leftTableRef,
17110
17142
  className: 'south__west'.concat(" ", 'editTable__block', " ", 'table_border_style')
17111
17143
  }, /*#__PURE__*/React.createElement("tbody", null, config.colHeader.map(function (item, index) {
17112
17144
  return /*#__PURE__*/React.createElement("tr", null, item.map(function (innerItem) {
@@ -17132,7 +17164,7 @@ var index$7 = /*#__PURE__*/forwardRef(function (props, ref) {
17132
17164
  style: {
17133
17165
  width: '100%',
17134
17166
  top: 0,
17135
- left: "".concat(config.colHeaderWidth, "px"),
17167
+ left: "".concat(realColHeaderWidth, "px"),
17136
17168
  position: 'absolute',
17137
17169
  display: config.tableType === 'col-header-table' ? 'none' : ''
17138
17170
  }
@@ -17158,7 +17190,7 @@ var index$7 = /*#__PURE__*/forwardRef(function (props, ref) {
17158
17190
  }))), /*#__PURE__*/React.createElement("div", {
17159
17191
  style: {
17160
17192
  position: 'absolute',
17161
- left: "".concat(config.colHeaderWidth, "px"),
17193
+ left: "".concat(realColHeaderWidth, "px"),
17162
17194
  top: "".concat(config.colHeaderToTop, "px"),
17163
17195
  minWidth: rightAreaWidth,
17164
17196
  zIndex: 0
@@ -30332,4 +30364,4 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
30332
30364
  return RuleObjectComponent;
30333
30365
  }(Component);
30334
30366
 
30335
- export { AddSelect, AddSkcSelect, AddSkuSelect, AddSpuSelect, BillEntry, BsCascader, index$6 as BsLayout, BsSulaQueryTable, BusinessSearchSelect$1 as BusinessSearchSelect, BusinessTreeSearchSelect$1 as BusinessTreeSearchSelect, index$2 as CheckOneUser, ColumnSettingTable, CommodityEntry, DataImport, DataValidation, index$4 as DetailPageWrapper, EllipsisTooltip, ExportIcon, GuideWrapper, index$5 as HomePageWrapper, JsonQueryTable, index$7 as MoreTreeTable, QueryMutipleInput, RuleObjectComponent as RuleComponent, SearchSelect, index$3 as StateFlow, ColumnSettingSulaTable as SulaColumnSettingTable, TableColumnSetting, TreeSearchSelect };
30367
+ export { AddSelect, AddSkcSelect, AddSkuSelect, AddSpuSelect, BillEntry, BsCascader, index$5 as BsLayout, BsSulaQueryTable, BusinessSearchSelect$1 as BusinessSearchSelect, BusinessTreeSearchSelect$1 as BusinessTreeSearchSelect, index$1 as CheckOneUser, ColumnSettingTable, CommodityEntry, DataImport, DataValidation, index$3 as DetailPageWrapper, EllipsisTooltip, ExportIcon, GuideWrapper, index$4 as HomePageWrapper, JsonQueryTable, index$6 as MoreTreeTable, QueryMutipleInput, RuleObjectComponent as RuleComponent, SearchSelect, index$2 as StateFlow, ColumnSettingSulaTable as SulaColumnSettingTable, TableColumnSetting, TreeSearchSelect };
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ var axios = require('axios');
6
6
  var antd = require('antd');
7
7
  var _ = require('lodash');
8
8
  var umi = require('umi');
9
- var isEqual = require('lodash/isEqual');
9
+ var isEqual$1 = require('lodash/isEqual');
10
10
  var React = require('react');
11
11
  var moment$1 = require('moment');
12
12
  var icons = require('@ant-design/icons');
@@ -33,7 +33,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
33
33
 
34
34
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
35
35
  var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
36
- var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
36
+ var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual$1);
37
37
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
38
38
  var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment$1);
39
39
  var ProLayout__default = /*#__PURE__*/_interopDefaultLegacy(ProLayout);
@@ -155,6 +155,33 @@ axios__default['default'].interceptors.request.use(function (config) {
155
155
  return config;
156
156
  });
157
157
 
158
+ function _iterableToArrayLimit(arr, i) {
159
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
160
+ if (null != _i) {
161
+ var _s,
162
+ _e,
163
+ _x,
164
+ _r,
165
+ _arr = [],
166
+ _n = !0,
167
+ _d = !1;
168
+ try {
169
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
170
+ if (Object(_i) !== _i) return;
171
+ _n = !1;
172
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
173
+ } catch (err) {
174
+ _d = !0, _e = err;
175
+ } finally {
176
+ try {
177
+ if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
178
+ } finally {
179
+ if (_d) throw _e;
180
+ }
181
+ }
182
+ return _arr;
183
+ }
184
+ }
158
185
  function ownKeys(object, enumerableOnly) {
159
186
  var keys = Object.keys(object);
160
187
  if (Object.getOwnPropertySymbols) {
@@ -311,14 +338,9 @@ function _regeneratorRuntime() {
311
338
  };
312
339
  }
313
340
  function maybeInvokeDelegate(delegate, context) {
314
- var method = delegate.iterator[context.method];
315
- if (undefined === method) {
316
- if (context.delegate = null, "throw" === context.method) {
317
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
318
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
319
- }
320
- return ContinueSentinel;
321
- }
341
+ var methodName = context.method,
342
+ method = delegate.iterator[methodName];
343
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
322
344
  var record = tryCatch(method, delegate.iterator, context.arg);
323
345
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
324
346
  var info = record.arg;
@@ -532,7 +554,7 @@ function _defineProperties(target, props) {
532
554
  descriptor.enumerable = descriptor.enumerable || false;
533
555
  descriptor.configurable = true;
534
556
  if ("value" in descriptor) descriptor.writable = true;
535
- Object.defineProperty(target, descriptor.key, descriptor);
557
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
536
558
  }
537
559
  }
538
560
  function _createClass(Constructor, protoProps, staticProps) {
@@ -544,6 +566,7 @@ function _createClass(Constructor, protoProps, staticProps) {
544
566
  return Constructor;
545
567
  }
546
568
  function _defineProperty(obj, key, value) {
569
+ key = _toPropertyKey(key);
547
570
  if (key in obj) {
548
571
  Object.defineProperty(obj, key, {
549
572
  value: value,
@@ -686,30 +709,6 @@ function _arrayWithHoles(arr) {
686
709
  function _iterableToArray(iter) {
687
710
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
688
711
  }
689
- function _iterableToArrayLimit(arr, i) {
690
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
691
- if (_i == null) return;
692
- var _arr = [];
693
- var _n = true;
694
- var _d = false;
695
- var _s, _e;
696
- try {
697
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
698
- _arr.push(_s.value);
699
- if (i && _arr.length === i) break;
700
- }
701
- } catch (err) {
702
- _d = true;
703
- _e = err;
704
- } finally {
705
- try {
706
- if (!_n && _i["return"] != null) _i["return"]();
707
- } finally {
708
- if (_d) throw _e;
709
- }
710
- }
711
- return _arr;
712
- }
713
712
  function _unsupportedIterableToArray(o, minLen) {
714
713
  if (!o) return;
715
714
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -729,6 +728,20 @@ function _nonIterableSpread() {
729
728
  function _nonIterableRest() {
730
729
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
731
730
  }
731
+ function _toPrimitive(input, hint) {
732
+ if (typeof input !== "object" || input === null) return input;
733
+ var prim = input[Symbol.toPrimitive];
734
+ if (prim !== undefined) {
735
+ var res = prim.call(input, hint || "default");
736
+ if (typeof res !== "object") return res;
737
+ throw new TypeError("@@toPrimitive must return a primitive value.");
738
+ }
739
+ return (hint === "string" ? String : Number)(input);
740
+ }
741
+ function _toPropertyKey(arg) {
742
+ var key = _toPrimitive(arg, "string");
743
+ return typeof key === "symbol" ? key : String(key);
744
+ }
732
745
 
733
746
  var checkQuantityAccuracy = function checkQuantityAccuracy(value, accuracy, errorInfo) {
734
747
  var errorMessage = _objectSpread2({
@@ -768,41 +781,52 @@ var precisionQuantity = function precisionQuantity(num, accuracy) {
768
781
  return '';
769
782
  };
770
783
 
771
- var simpleIsEqual = function simpleIsEqual(a, b) {
772
- return a === b;
773
- };
774
-
775
- function index$1 (resultFn, isEqual) {
776
- if (isEqual === void 0) {
777
- isEqual = simpleIsEqual;
778
- }
779
-
780
- var lastThis;
781
- var lastArgs = [];
782
- var lastResult;
783
- var calledOnce = false;
784
-
785
- var isNewArgEqualToLast = function isNewArgEqualToLast(newArg, index) {
786
- return isEqual(newArg, lastArgs[index], index);
787
- };
788
-
789
- var result = function result() {
790
- for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) {
791
- newArgs[_key] = arguments[_key];
784
+ var safeIsNaN = Number.isNaN ||
785
+ function ponyfill(value) {
786
+ return typeof value === 'number' && value !== value;
787
+ };
788
+ function isEqual(first, second) {
789
+ if (first === second) {
790
+ return true;
792
791
  }
793
-
794
- if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) {
795
- return lastResult;
792
+ if (safeIsNaN(first) && safeIsNaN(second)) {
793
+ return true;
796
794
  }
795
+ return false;
796
+ }
797
+ function areInputsEqual(newInputs, lastInputs) {
798
+ if (newInputs.length !== lastInputs.length) {
799
+ return false;
800
+ }
801
+ for (var i = 0; i < newInputs.length; i++) {
802
+ if (!isEqual(newInputs[i], lastInputs[i])) {
803
+ return false;
804
+ }
805
+ }
806
+ return true;
807
+ }
797
808
 
798
- lastResult = resultFn.apply(this, newArgs);
799
- calledOnce = true;
800
- lastThis = this;
801
- lastArgs = newArgs;
802
- return lastResult;
803
- };
804
-
805
- return result;
809
+ function memoizeOne(resultFn, isEqual) {
810
+ if (isEqual === void 0) { isEqual = areInputsEqual; }
811
+ var lastThis;
812
+ var lastArgs = [];
813
+ var lastResult;
814
+ var calledOnce = false;
815
+ function memoized() {
816
+ var newArgs = [];
817
+ for (var _i = 0; _i < arguments.length; _i++) {
818
+ newArgs[_i] = arguments[_i];
819
+ }
820
+ if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {
821
+ return lastResult;
822
+ }
823
+ lastResult = resultFn.apply(this, newArgs);
824
+ calledOnce = true;
825
+ lastThis = this;
826
+ lastArgs = newArgs;
827
+ return lastResult;
828
+ }
829
+ return memoized;
806
830
  }
807
831
 
808
832
  function styleInject(css, ref) {
@@ -1113,7 +1137,7 @@ var formatter = function formatter(data, parentAuthority, parentName) {
1113
1137
  return item;
1114
1138
  });
1115
1139
  };
1116
- var memoizeOneFormatter = index$1(formatter, isEqual__default['default']);
1140
+ var memoizeOneFormatter = memoizeOne(formatter, isEqual__default['default']);
1117
1141
  var go2BackAndClose = function go2BackAndClose() {
1118
1142
  localStorage.setItem(ENUM.BROWSER_CACHE.CHILD_APP_BACK, 1);
1119
1143
  umi.history.goBack();
@@ -9600,7 +9624,7 @@ var CommodityEntry = function CommodityEntry(props) {
9600
9624
  * @LastEditTime: 2022-01-14 17:17:26
9601
9625
  * @LastEditors: rodchen
9602
9626
  */
9603
- var index$2 = (function (storageKeyString) {
9627
+ var index$1 = (function (storageKeyString) {
9604
9628
  var seconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
9605
9629
  var tipsCallFunction = arguments.length > 2 ? arguments[2] : undefined;
9606
9630
  if (typeof seconds !== 'number') throw new Error('seconds should be number');
@@ -9965,7 +9989,7 @@ var BusinessTreeSearchSelect$1 = /*#__PURE__*/React__default['default'].memo(Bus
9965
9989
  var css_248z$8 = ".form-status-label {\n height: 48px;\n margin-right: 12px;\n display: inline-block;\n position: relative;\n background-color: #B0B4B7;\n align-items: center;\n}\n.choosed-status-label.form-status-label {\n background-color: #005CFF;\n}\n.form-status-label:last-child {\n margin-right: 0px;\n}\n.form-status-label:first-child::after {\n position: absolute;\n display: block;\n content: '';\n right: -48px;\n top: 0;\n width: 48px;\n height: 48px;\n border: 24px solid;\n border-color: transparent transparent transparent transparent;\n border-left: 12px solid #B0B4B7;\n}\n.choosed-status-label.form-status-label::after {\n border-left: 12px solid #005CFF;\n}\n.choosed-status-label.form-status-label:not(:first-child):not(:last-child)::after {\n border-left: 12px solid #005CFF;\n}\n.form-status-label:last-child::after {\n position: absolute;\n display: block;\n content: '';\n left: 0;\n top: 0;\n width: 48px;\n height: 48px;\n border: 24px solid;\n border-color: transparent transparent transparent transparent;\n border-left: 12px solid #ffffff;\n}\n.form-status-label:not(:first-child):not(:last-child)::before {\n position: absolute;\n display: block;\n content: '';\n left: 0;\n top: 0;\n width: 48px;\n height: 48px;\n border: 24px solid;\n border-color: transparent transparent transparent transparent;\n border-left: 12px solid #ffffff;\n}\n.form-status-label:not(:first-child):not(:last-child)::after {\n position: absolute;\n display: block;\n content: '';\n right: -48px;\n top: 0;\n width: 48px;\n height: 48px;\n border: 24px solid;\n border-color: transparent transparent transparent transparent;\n border-left: 12px solid #B0B4B7;\n}\n.status-label-index {\n display: inline-block;\n width: 24px;\n height: 24px;\n border: 1px solid #FFFFFF;\n color: #FFFFFF;\n border-radius: 50%;\n font-family: Montserrat;\n font-size: 14px;\n line-height: 24px;\n text-align: center;\n margin: 0 6px 0 20px;\n}\n.status-label-key {\n width: 50px;\n height: 100%;\n display: inline-flex;\n float: left;\n align-items: center;\n justify-content: center;\n}\n.status-label-operate {\n float: left;\n width: calc(100% - 50px);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n height: 100%;\n margin: 4px 0;\n}\n.status-label-operate > div {\n font-size: 12px;\n height: 20px;\n line-height: 20px;\n color: #FFFFFF;\n font-family: PingFangSC;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.status-label-operate > div:first-child {\n font-size: 14px;\n font-weight: 600;\n}\n.only-one-child.form-status-label::after,\n.only-one-child.form-status-label::before {\n border-left: 0px;\n}\n";
9966
9990
  styleInject(css_248z$8);
9967
9991
 
9968
- var index$3 = (function (props) {
9992
+ var index$2 = (function (props) {
9969
9993
  var _props$formStatusMapp = props.formStatusMapping,
9970
9994
  formStatusMapping = _props$formStatusMapp === void 0 ? [] : _props$formStatusMapp;
9971
9995
  return /*#__PURE__*/React__default['default'].createElement("div", {
@@ -11389,7 +11413,7 @@ var iconMap = {
11389
11413
  src: moreIcon
11390
11414
  })
11391
11415
  };
11392
- var index$4 = (function (props) {
11416
+ var index$3 = (function (props) {
11393
11417
  var _useLocation = umi.useLocation(),
11394
11418
  pathname = _useLocation.pathname;
11395
11419
  var _useState = React.useState(pathname + 'id'),
@@ -11606,7 +11630,7 @@ var css_248z$d = ".home_page_head {\n height: 54px;\n display: flex;\n justif
11606
11630
  styleInject(css_248z$d);
11607
11631
 
11608
11632
  var _excluded$c = ["children"];
11609
- var index$5 = (function (props) {
11633
+ var index$4 = (function (props) {
11610
11634
  var _useLocation = umi.useLocation(),
11611
11635
  pathname = _useLocation.pathname;
11612
11636
  var _useState = React.useState(pathname + 'id'),
@@ -16702,7 +16726,7 @@ var WrapperComponent = /*#__PURE__*/function (_React$Component) {
16702
16726
  }]);
16703
16727
  return WrapperComponent;
16704
16728
  }(React__default['default'].Component);
16705
- var index$6 = (function (props) {
16729
+ var index$5 = (function (props) {
16706
16730
  var _useModel = umi.useModel('@@initialState'),
16707
16731
  _useModel$initialStat = _useModel.initialState,
16708
16732
  initialState = _useModel$initialStat === void 0 ? {} : _useModel$initialStat;
@@ -16943,7 +16967,7 @@ var FixedScrollBar = function FixedScrollBar(_ref, ref) {
16943
16967
  };
16944
16968
  var FixedScrollBar$1 = /*#__PURE__*/React__default['default'].forwardRef(FixedScrollBar);
16945
16969
 
16946
- var index$7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
16970
+ var index$6 = /*#__PURE__*/React.forwardRef(function (props, ref) {
16947
16971
  var _useState = React.useState(false),
16948
16972
  _useState2 = _slicedToArray(_useState, 2),
16949
16973
  show = _useState2[0],
@@ -16954,7 +16978,6 @@ var index$7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
16954
16978
  colLastData: [],
16955
16979
  rowHeader: [],
16956
16980
  rowLastData: [],
16957
- colHeaderWidth: 400,
16958
16981
  colHeaderToTop: 0
16959
16982
  }),
16960
16983
  _useState4 = _slicedToArray(_useState3, 2),
@@ -16973,34 +16996,46 @@ var index$7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
16973
16996
  viewCount = _useState10[0],
16974
16997
  setViewCount = _useState10[1]; //虚拟表格每次渲染数量
16975
16998
  var itemWidth = 100; // 表格每一项宽度
16999
+ var _useState11 = React.useState((props === null || props === void 0 ? void 0 : props.colHeaderWidth) || 400),
17000
+ _useState12 = _slicedToArray(_useState11, 2),
17001
+ realColHeaderWidth = _useState12[0],
17002
+ setLeftWidth = _useState12[1];
16976
17003
  var viewPort = React.useRef(null);
16977
17004
  var topScrollBar = React.useRef(null);
17005
+ var leftTableRef = React.useRef(null);
16978
17006
  //起始渲染item
16979
- var _useState11 = React.useState(0),
16980
- _useState12 = _slicedToArray(_useState11, 2),
16981
- startIndex = _useState12[0],
16982
- setStartIndex = _useState12[1];
17007
+ var _useState13 = React.useState(0),
17008
+ _useState14 = _slicedToArray(_useState13, 2),
17009
+ startIndex = _useState14[0],
17010
+ setStartIndex = _useState14[1];
16983
17011
  //结束渲染item
16984
17012
  var endIndex = React.useMemo(function () {
16985
17013
  return startIndex + viewCount;
16986
17014
  }, [startIndex, viewCount]);
16987
17015
  //表格偏移量
16988
- var _useState13 = React.useState(0),
16989
- _useState14 = _slicedToArray(_useState13, 2),
16990
- offsetWidth = _useState14[0],
16991
- setOffset = _useState14[1];
17016
+ var _useState15 = React.useState(0),
17017
+ _useState16 = _slicedToArray(_useState15, 2),
17018
+ offsetWidth = _useState16[0],
17019
+ setOffset = _useState16[1];
16992
17020
  React.useEffect(function () {
16993
- var viewPortWidth = viewPort.current.clientWidth;
16994
- var defaultTableWidth = viewPortWidth - (props.colHeaderWidth || 400);
16995
- var viewCount = Math.floor(defaultTableWidth / itemWidth) + 2 <= 10 ? 10 : Math.floor(defaultTableWidth / itemWidth) + 2;
16996
- setViewCount(viewCount);
17021
+ setTimeout(function () {
17022
+ var realLeftTableWidth = leftTableRef.current.clientWidth;
17023
+ var viewPortWidth = viewPort.current.clientWidth;
17024
+ var defaultTableWidth = viewPortWidth - realLeftTableWidth;
17025
+ var viewCount = Math.floor(defaultTableWidth / itemWidth) + 2 <= 10 ? 10 : Math.floor(defaultTableWidth / itemWidth) + 2;
17026
+ setViewCount(viewCount);
17027
+ setLeftWidth(realLeftTableWidth);
17028
+ });
16997
17029
  }, []);
16998
- var onScroll = function onScroll() {
17030
+ var onScroll = function onScroll(e) {
16999
17031
  if (topScrollBar.current) {
17000
17032
  topScrollBar.current.scrollTo(viewPort.current.scrollLeft, 0);
17001
17033
  }
17002
17034
  var scrollWidth = viewPort.current.scrollLeft;
17003
17035
  var startIndex = Math.floor(scrollWidth / itemWidth);
17036
+ if (startIndex + viewCount >= colTableData.length) {
17037
+ startIndex = colTableData.length - viewCount <= 0 ? 0 : colTableData.length - viewCount;
17038
+ }
17004
17039
  var offsetWidth = startIndex * itemWidth;
17005
17040
  setStartIndex(startIndex);
17006
17041
  setOffset(offsetWidth);
@@ -17018,9 +17053,7 @@ var index$7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
17018
17053
  // 设置表头相关信息
17019
17054
  React.useEffect(function () {
17020
17055
  var colData = props.colData,
17021
- rowData = props.rowData,
17022
- _props$colHeaderWidth = props.colHeaderWidth,
17023
- colHeaderWidth = _props$colHeaderWidth === void 0 ? 400 : _props$colHeaderWidth;
17056
+ rowData = props.rowData;
17024
17057
  var tableType;
17025
17058
  if (colData && colData.length && rowData && rowData.length) {
17026
17059
  tableType = 'multi-header-table';
@@ -17033,7 +17066,6 @@ var index$7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
17033
17066
  rowHeader: [],
17034
17067
  rowLastData: []
17035
17068
  }, colHeaderData), rowHeaderData), {}, {
17036
- colHeaderWidth: colHeaderWidth,
17037
17069
  colHeaderToTop: ((rowHeader === null || rowHeader === void 0 ? void 0 : rowHeader.length) || 0) * 40,
17038
17070
  tableType: tableType
17039
17071
  }));
@@ -17046,7 +17078,6 @@ var index$7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
17046
17078
  rowHeader: [],
17047
17079
  rowLastData: []
17048
17080
  }, _colHeaderData), {}, {
17049
- colHeaderWidth: colHeaderWidth || 400,
17050
17081
  colHeaderToTop: 0,
17051
17082
  tableType: tableType
17052
17083
  }));
@@ -17088,7 +17119,7 @@ var index$7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
17088
17119
  tableProps = props.tableProps;
17089
17120
  var tableWidth = width ? "".concat(width, "px") : '100%';
17090
17121
  var tableHeight = "".concat(height || 400, "px");
17091
- var rightAreaWidth = 'calc(100% - ' + "".concat(config.colHeaderWidth, "px") + ')';
17122
+ var rightAreaWidth = 'calc(100% - ' + "".concat(realColHeaderWidth, "px") + ')';
17092
17123
  return /*#__PURE__*/React__default['default'].createElement("div", {
17093
17124
  style: {
17094
17125
  width: tableWidth,
@@ -17104,7 +17135,7 @@ var index$7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
17104
17135
  ref: topScrollBar
17105
17136
  }), /*#__PURE__*/React__default['default'].createElement("div", {
17106
17137
  style: {
17107
- width: "".concat(config.colHeaderWidth + 1 + placeholderWidth, "px"),
17138
+ width: "".concat(realColHeaderWidth + placeholderWidth, "px"),
17108
17139
  position: 'absolute',
17109
17140
  top: 0,
17110
17141
  left: 0,
@@ -17112,7 +17143,7 @@ var index$7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
17112
17143
  }
17113
17144
  }), /*#__PURE__*/React__default['default'].createElement("table", {
17114
17145
  style: {
17115
- width: "".concat(config.colHeaderWidth + 1, "px"),
17146
+ width: "".concat(realColHeaderWidth, "px"),
17116
17147
  height: "".concat(config.colHeaderToTop, "px"),
17117
17148
  display: config.tableType === 'col-header-table' ? 'none' : ''
17118
17149
  },
@@ -17121,11 +17152,12 @@ var index$7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
17121
17152
  style: {
17122
17153
  tableLayout: 'auto',
17123
17154
  minWidth: '100px',
17124
- width: "".concat(config.colHeaderWidth + 1, "px"),
17155
+ width: "".concat(realColHeaderWidth, "px"),
17125
17156
  top: "".concat(config.colHeaderToTop, "px"),
17126
17157
  left: '0px',
17127
17158
  position: 'sticky'
17128
17159
  },
17160
+ ref: leftTableRef,
17129
17161
  className: 'south__west'.concat(" ", 'editTable__block', " ", 'table_border_style')
17130
17162
  }, /*#__PURE__*/React__default['default'].createElement("tbody", null, config.colHeader.map(function (item, index) {
17131
17163
  return /*#__PURE__*/React__default['default'].createElement("tr", null, item.map(function (innerItem) {
@@ -17151,7 +17183,7 @@ var index$7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
17151
17183
  style: {
17152
17184
  width: '100%',
17153
17185
  top: 0,
17154
- left: "".concat(config.colHeaderWidth, "px"),
17186
+ left: "".concat(realColHeaderWidth, "px"),
17155
17187
  position: 'absolute',
17156
17188
  display: config.tableType === 'col-header-table' ? 'none' : ''
17157
17189
  }
@@ -17177,7 +17209,7 @@ var index$7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
17177
17209
  }))), /*#__PURE__*/React__default['default'].createElement("div", {
17178
17210
  style: {
17179
17211
  position: 'absolute',
17180
- left: "".concat(config.colHeaderWidth, "px"),
17212
+ left: "".concat(realColHeaderWidth, "px"),
17181
17213
  top: "".concat(config.colHeaderToTop, "px"),
17182
17214
  minWidth: rightAreaWidth,
17183
17215
  zIndex: 0
@@ -30357,26 +30389,26 @@ exports.AddSkuSelect = AddSkuSelect;
30357
30389
  exports.AddSpuSelect = AddSpuSelect;
30358
30390
  exports.BillEntry = BillEntry;
30359
30391
  exports.BsCascader = BsCascader;
30360
- exports.BsLayout = index$6;
30392
+ exports.BsLayout = index$5;
30361
30393
  exports.BsSulaQueryTable = BsSulaQueryTable;
30362
30394
  exports.BusinessSearchSelect = BusinessSearchSelect$1;
30363
30395
  exports.BusinessTreeSearchSelect = BusinessTreeSearchSelect$1;
30364
- exports.CheckOneUser = index$2;
30396
+ exports.CheckOneUser = index$1;
30365
30397
  exports.ColumnSettingTable = ColumnSettingTable;
30366
30398
  exports.CommodityEntry = CommodityEntry;
30367
30399
  exports.DataImport = DataImport;
30368
30400
  exports.DataValidation = DataValidation;
30369
- exports.DetailPageWrapper = index$4;
30401
+ exports.DetailPageWrapper = index$3;
30370
30402
  exports.EllipsisTooltip = EllipsisTooltip;
30371
30403
  exports.ExportIcon = ExportIcon;
30372
30404
  exports.GuideWrapper = GuideWrapper;
30373
- exports.HomePageWrapper = index$5;
30405
+ exports.HomePageWrapper = index$4;
30374
30406
  exports.JsonQueryTable = JsonQueryTable;
30375
- exports.MoreTreeTable = index$7;
30407
+ exports.MoreTreeTable = index$6;
30376
30408
  exports.QueryMutipleInput = QueryMutipleInput;
30377
30409
  exports.RuleComponent = RuleObjectComponent;
30378
30410
  exports.SearchSelect = SearchSelect;
30379
- exports.StateFlow = index$3;
30411
+ exports.StateFlow = index$2;
30380
30412
  exports.SulaColumnSettingTable = ColumnSettingSulaTable;
30381
30413
  exports.TableColumnSetting = TableColumnSetting;
30382
30414
  exports.TreeSearchSelect = TreeSearchSelect;
@@ -1,9 +1,9 @@
1
- declare type mediaListType = {
1
+ type mediaListType = {
2
2
  type: number;
3
3
  url: string;
4
4
  [key: string]: any;
5
5
  };
6
- declare type recordType = {
6
+ type recordType = {
7
7
  mediaList?: mediaListType;
8
8
  [key: string]: any;
9
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "2.3.4",
3
+ "version": "2.3.6",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -22,7 +22,7 @@ export default () => {
22
22
  const colTableRef = useRef(null);
23
23
 
24
24
  let colTableData = [];
25
- for (let i = 1; i < 10001; i++) {
25
+ for (let i = 1; i < 1001; i++) {
26
26
  colTableData.push({
27
27
  '1111-1-2': '1',
28
28
  '1111-1-3': '2',
@@ -35,7 +35,7 @@ export default () => {
35
35
  'fixed2': `标题1-${i}`,
36
36
  })
37
37
  }
38
- for (let j = 1; j < 10001; j++) {
38
+ for (let j = 1; j < 1001; j++) {
39
39
  colTableData.push({
40
40
  '1111-1-2': '1',
41
41
  '1111-1-3': '2',
@@ -13,16 +13,17 @@ export default forwardRef((props, ref) => {
13
13
  colLastData: [],
14
14
  rowHeader: [],
15
15
  rowLastData: [],
16
- colHeaderWidth: 400,
17
16
  colHeaderToTop: 0,
18
17
  });
19
18
  const [colTableData, setColTableData] = useState([]); //纵向表头数据
20
19
  const [multiTableData, setMmultiTableData] = useState({}); //多表头数据
21
20
  const [viewCount, setViewCount] = useState(10); //虚拟表格每次渲染数量
22
21
  const itemWidth = 100; // 表格每一项宽度
22
+ const [realColHeaderWidth, setLeftWidth] = useState(props?.colHeaderWidth || 400);
23
23
 
24
24
  const viewPort = useRef(null);
25
- const topScrollBar = useRef(null)
25
+ const topScrollBar = useRef(null);
26
+ const leftTableRef = useRef(null);
26
27
 
27
28
  //起始渲染item
28
29
  const [startIndex, setStartIndex] = useState(0);
@@ -36,18 +37,25 @@ export default forwardRef((props, ref) => {
36
37
  const [offsetWidth, setOffset] = useState(0);
37
38
 
38
39
  useEffect(() => { //根据容器宽度计算每次渲染个数
39
- let viewPortWidth = viewPort.current.clientWidth;
40
- let defaultTableWidth = viewPortWidth - (props.colHeaderWidth || 400);
41
- let viewCount = Math.floor(defaultTableWidth/itemWidth) + 2 <= 10 ? 10 : Math.floor(defaultTableWidth/itemWidth) + 2;
42
- setViewCount(viewCount)
40
+ setTimeout(() => {
41
+ let realLeftTableWidth = leftTableRef.current.clientWidth;
42
+ let viewPortWidth = viewPort.current.clientWidth;
43
+ let defaultTableWidth = viewPortWidth - realLeftTableWidth;
44
+ let viewCount = Math.floor(defaultTableWidth/itemWidth) + 2 <= 10 ? 10 : Math.floor(defaultTableWidth/itemWidth) + 2;
45
+ setViewCount(viewCount)
46
+ setLeftWidth(realLeftTableWidth);
47
+ })
43
48
  }, [])
44
49
 
45
- const onScroll = () => {
50
+ const onScroll = (e) => {
46
51
  if(topScrollBar.current){
47
52
  topScrollBar.current.scrollTo(viewPort.current.scrollLeft, 0)
48
53
  }
49
54
  const scrollWidth = viewPort.current.scrollLeft;
50
- const startIndex = Math.floor(scrollWidth/itemWidth);
55
+ let startIndex = Math.floor(scrollWidth/itemWidth);
56
+ if ( startIndex + viewCount >= colTableData.length) {
57
+ startIndex = colTableData.length - viewCount <= 0 ? 0 : colTableData.length - viewCount;
58
+ }
51
59
  const offsetWidth = startIndex * itemWidth;
52
60
  setStartIndex(startIndex);
53
61
  setOffset(offsetWidth);
@@ -66,7 +74,7 @@ export default forwardRef((props, ref) => {
66
74
 
67
75
  // 设置表头相关信息
68
76
  useEffect(() => {
69
- const { colData, rowData, colHeaderWidth=400 } = props;
77
+ const { colData, rowData } = props;
70
78
  let tableType;
71
79
  if (colData && colData.length && rowData && rowData.length) {
72
80
  tableType = 'multi-header-table';
@@ -80,7 +88,6 @@ export default forwardRef((props, ref) => {
80
88
  rowLastData: [],
81
89
  ...colHeaderData,
82
90
  ...rowHeaderData,
83
- colHeaderWidth: colHeaderWidth,
84
91
  colHeaderToTop: (rowHeader?.length || 0)*40,
85
92
  tableType: tableType
86
93
  })
@@ -93,7 +100,6 @@ export default forwardRef((props, ref) => {
93
100
  rowHeader: [],
94
101
  rowLastData: [],
95
102
  ...colHeaderData,
96
- colHeaderWidth: colHeaderWidth || 400,
97
103
  colHeaderToTop: 0,
98
104
  tableType: tableType
99
105
  })
@@ -143,7 +149,7 @@ export default forwardRef((props, ref) => {
143
149
  const {width, height, tableProps } = props;
144
150
  let tableWidth = width ? `${width}px` : '100%';
145
151
  let tableHeight = `${height || 400}px`;
146
- const rightAreaWidth = 'calc(100% - ' + `${config.colHeaderWidth}px` + ')';
152
+ const rightAreaWidth = 'calc(100% - ' + `${realColHeaderWidth}px` + ')';
147
153
  return (
148
154
  <div
149
155
  style={{width: tableWidth, height: tableHeight}}
@@ -158,7 +164,7 @@ export default forwardRef((props, ref) => {
158
164
  ref={topScrollBar}
159
165
  />
160
166
  <div style={{
161
- width: `${config.colHeaderWidth + 1 + placeholderWidth}px`,
167
+ width: `${realColHeaderWidth + placeholderWidth}px`,
162
168
  position: 'absolute',
163
169
  top: 0,
164
170
  left: 0,
@@ -168,7 +174,7 @@ export default forwardRef((props, ref) => {
168
174
  {/* -------------------------------------左上角区域--------------------------------------- */}
169
175
  <table
170
176
  style={{
171
- width: `${config.colHeaderWidth+1}px`,
177
+ width: `${realColHeaderWidth}px`,
172
178
  height: `${config.colHeaderToTop}px`,
173
179
  display: config.tableType === 'col-header-table' ? 'none' : '',
174
180
  }}
@@ -181,11 +187,12 @@ export default forwardRef((props, ref) => {
181
187
  style={{
182
188
  tableLayout:'auto',
183
189
  minWidth: '100px',
184
- width: `${config.colHeaderWidth+1}px`,
190
+ width: `${realColHeaderWidth}px`,
185
191
  top: `${config.colHeaderToTop}px`,
186
192
  left: '0px',
187
193
  position: 'sticky',
188
194
  }}
195
+ ref={leftTableRef}
189
196
  className={`${'south__west'} ${'editTable__block'} ${'table_border_style'}`}
190
197
  >
191
198
  <tbody>
@@ -225,7 +232,7 @@ export default forwardRef((props, ref) => {
225
232
  style={{
226
233
  width: '100%',
227
234
  top: 0,
228
- left: `${config.colHeaderWidth}px`,
235
+ left: `${realColHeaderWidth}px`,
229
236
  position: 'absolute',
230
237
  display: config.tableType === 'col-header-table' ? 'none' : ''
231
238
  }}
@@ -271,7 +278,7 @@ export default forwardRef((props, ref) => {
271
278
  <div
272
279
  style={{
273
280
  position: 'absolute',
274
- left: `${config.colHeaderWidth}px`,
281
+ left: `${realColHeaderWidth}px`,
275
282
  top: `${config.colHeaderToTop}px`,
276
283
  minWidth: rightAreaWidth,
277
284
  zIndex: 0,