@bit-sun/business-component 2.2.43 → 2.2.45

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;
@@ -0,0 +1,8 @@
1
+ interface TableSticky {
2
+ getContainer?: () => Window | HTMLElement;
3
+ }
4
+ declare const useSticky: (sticky: boolean | TableSticky) => {
5
+ isSticky: boolean;
6
+ container: Window | HTMLElement | Document;
7
+ };
8
+ export default useSticky;
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import axios from 'axios';
2
2
  import { message, Menu, Space, Dropdown, Tooltip, Button, Checkbox, Input, Modal, Select, Form, Divider, Spin, Table, TreeSelect, Tag, Popover, Card, Avatar, Image, InputNumber, Typography, Alert, Anchor, Breadcrumb, Drawer as Drawer$1, List, Tree, Row, Col, Tabs, Affix } from 'antd';
3
- import _, { omit, debounce, cloneDeep as cloneDeep$1, isEmpty } from 'lodash';
3
+ import _, { omit, debounce, cloneDeep as cloneDeep$1, throttle, isEmpty } from 'lodash';
4
4
  import React, { useState, useEffect, forwardRef, useImperativeHandle, useRef, useMemo, Component, useLayoutEffect, createRef } from 'react';
5
5
  import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
6
6
  import { UnorderedListOutlined, ProfileTwoTone, ExclamationCircleOutlined, DownOutlined, CopyOutlined, SearchOutlined, CaretLeftOutlined, CloseCircleOutlined, ArrowLeftOutlined, FolderOutlined, EllipsisOutlined, CaretDownOutlined, HomeOutlined, DoubleLeftOutlined, DoubleRightOutlined, MenuUnfoldOutlined, DashOutlined, SettingOutlined, BulbOutlined, PlayCircleOutlined, SaveOutlined, FullscreenExitOutlined } from '@ant-design/icons';
@@ -10,7 +10,7 @@ import { Resizable } from 'react-resizable';
10
10
  import { SortableHandle, SortableElement, SortableContainer } from 'react-sortable-hoc';
11
11
  import { arrayMoveImmutable } from 'array-move';
12
12
  import { history, formatMessage, useLocation, Link, useModel, useIntl } from 'umi';
13
- import isEqual from 'lodash/isEqual';
13
+ import isEqual$1 from 'lodash/isEqual';
14
14
  import { Table as Table$1, request as request$1, QueryTable, Form as Form$1 } from 'bssula';
15
15
  import ProLayout from '@ant-design/pro-layout';
16
16
  import cloneDeep from 'lodash/cloneDeep';
@@ -135,6 +135,33 @@ axios.interceptors.request.use(function (config) {
135
135
  return config;
136
136
  });
137
137
 
138
+ function _iterableToArrayLimit(arr, i) {
139
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
140
+ if (null != _i) {
141
+ var _s,
142
+ _e,
143
+ _x,
144
+ _r,
145
+ _arr = [],
146
+ _n = !0,
147
+ _d = !1;
148
+ try {
149
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
150
+ if (Object(_i) !== _i) return;
151
+ _n = !1;
152
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
153
+ } catch (err) {
154
+ _d = !0, _e = err;
155
+ } finally {
156
+ try {
157
+ if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
158
+ } finally {
159
+ if (_d) throw _e;
160
+ }
161
+ }
162
+ return _arr;
163
+ }
164
+ }
138
165
  function ownKeys(object, enumerableOnly) {
139
166
  var keys = Object.keys(object);
140
167
  if (Object.getOwnPropertySymbols) {
@@ -291,14 +318,9 @@ function _regeneratorRuntime() {
291
318
  };
292
319
  }
293
320
  function maybeInvokeDelegate(delegate, context) {
294
- var method = delegate.iterator[context.method];
295
- if (undefined === method) {
296
- if (context.delegate = null, "throw" === context.method) {
297
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
298
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
299
- }
300
- return ContinueSentinel;
301
- }
321
+ var methodName = context.method,
322
+ method = delegate.iterator[methodName];
323
+ 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;
302
324
  var record = tryCatch(method, delegate.iterator, context.arg);
303
325
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
304
326
  var info = record.arg;
@@ -512,7 +534,7 @@ function _defineProperties(target, props) {
512
534
  descriptor.enumerable = descriptor.enumerable || false;
513
535
  descriptor.configurable = true;
514
536
  if ("value" in descriptor) descriptor.writable = true;
515
- Object.defineProperty(target, descriptor.key, descriptor);
537
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
516
538
  }
517
539
  }
518
540
  function _createClass(Constructor, protoProps, staticProps) {
@@ -524,6 +546,7 @@ function _createClass(Constructor, protoProps, staticProps) {
524
546
  return Constructor;
525
547
  }
526
548
  function _defineProperty(obj, key, value) {
549
+ key = _toPropertyKey(key);
527
550
  if (key in obj) {
528
551
  Object.defineProperty(obj, key, {
529
552
  value: value,
@@ -652,30 +675,6 @@ function _arrayWithHoles(arr) {
652
675
  function _iterableToArray(iter) {
653
676
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
654
677
  }
655
- function _iterableToArrayLimit(arr, i) {
656
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
657
- if (_i == null) return;
658
- var _arr = [];
659
- var _n = true;
660
- var _d = false;
661
- var _s, _e;
662
- try {
663
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
664
- _arr.push(_s.value);
665
- if (i && _arr.length === i) break;
666
- }
667
- } catch (err) {
668
- _d = true;
669
- _e = err;
670
- } finally {
671
- try {
672
- if (!_n && _i["return"] != null) _i["return"]();
673
- } finally {
674
- if (_d) throw _e;
675
- }
676
- }
677
- return _arr;
678
- }
679
678
  function _unsupportedIterableToArray(o, minLen) {
680
679
  if (!o) return;
681
680
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -695,6 +694,20 @@ function _nonIterableSpread() {
695
694
  function _nonIterableRest() {
696
695
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
697
696
  }
697
+ function _toPrimitive(input, hint) {
698
+ if (typeof input !== "object" || input === null) return input;
699
+ var prim = input[Symbol.toPrimitive];
700
+ if (prim !== undefined) {
701
+ var res = prim.call(input, hint || "default");
702
+ if (typeof res !== "object") return res;
703
+ throw new TypeError("@@toPrimitive must return a primitive value.");
704
+ }
705
+ return (hint === "string" ? String : Number)(input);
706
+ }
707
+ function _toPropertyKey(arg) {
708
+ var key = _toPrimitive(arg, "string");
709
+ return typeof key === "symbol" ? key : String(key);
710
+ }
698
711
 
699
712
  var checkQuantityAccuracy = function checkQuantityAccuracy(value, accuracy, errorInfo) {
700
713
  var errorMessage = _objectSpread2({
@@ -3662,41 +3675,52 @@ var setInitialShowColumn = function setInitialShowColumn(tableCode, columns, cal
3662
3675
  callback(showColumns);
3663
3676
  };
3664
3677
 
3665
- var simpleIsEqual = function simpleIsEqual(a, b) {
3666
- return a === b;
3667
- };
3668
-
3669
- function index (resultFn, isEqual) {
3670
- if (isEqual === void 0) {
3671
- isEqual = simpleIsEqual;
3672
- }
3673
-
3674
- var lastThis;
3675
- var lastArgs = [];
3676
- var lastResult;
3677
- var calledOnce = false;
3678
-
3679
- var isNewArgEqualToLast = function isNewArgEqualToLast(newArg, index) {
3680
- return isEqual(newArg, lastArgs[index], index);
3681
- };
3682
-
3683
- var result = function result() {
3684
- for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) {
3685
- newArgs[_key] = arguments[_key];
3678
+ var safeIsNaN = Number.isNaN ||
3679
+ function ponyfill(value) {
3680
+ return typeof value === 'number' && value !== value;
3681
+ };
3682
+ function isEqual(first, second) {
3683
+ if (first === second) {
3684
+ return true;
3686
3685
  }
3687
-
3688
- if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) {
3689
- return lastResult;
3686
+ if (safeIsNaN(first) && safeIsNaN(second)) {
3687
+ return true;
3690
3688
  }
3689
+ return false;
3690
+ }
3691
+ function areInputsEqual(newInputs, lastInputs) {
3692
+ if (newInputs.length !== lastInputs.length) {
3693
+ return false;
3694
+ }
3695
+ for (var i = 0; i < newInputs.length; i++) {
3696
+ if (!isEqual(newInputs[i], lastInputs[i])) {
3697
+ return false;
3698
+ }
3699
+ }
3700
+ return true;
3701
+ }
3691
3702
 
3692
- lastResult = resultFn.apply(this, newArgs);
3693
- calledOnce = true;
3694
- lastThis = this;
3695
- lastArgs = newArgs;
3696
- return lastResult;
3697
- };
3698
-
3699
- return result;
3703
+ function memoizeOne(resultFn, isEqual) {
3704
+ if (isEqual === void 0) { isEqual = areInputsEqual; }
3705
+ var lastThis;
3706
+ var lastArgs = [];
3707
+ var lastResult;
3708
+ var calledOnce = false;
3709
+ function memoized() {
3710
+ var newArgs = [];
3711
+ for (var _i = 0; _i < arguments.length; _i++) {
3712
+ newArgs[_i] = arguments[_i];
3713
+ }
3714
+ if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {
3715
+ return lastResult;
3716
+ }
3717
+ lastResult = resultFn.apply(this, newArgs);
3718
+ calledOnce = true;
3719
+ lastThis = this;
3720
+ lastArgs = newArgs;
3721
+ return lastResult;
3722
+ }
3723
+ return memoized;
3700
3724
  }
3701
3725
 
3702
3726
  //! moment.js
@@ -9656,7 +9680,7 @@ var formatter = function formatter(data, parentAuthority, parentName) {
9656
9680
  return item;
9657
9681
  });
9658
9682
  };
9659
- var memoizeOneFormatter = index(formatter, isEqual);
9683
+ var memoizeOneFormatter = memoizeOne(formatter, isEqual$1);
9660
9684
  var go2BackAndClose = function go2BackAndClose() {
9661
9685
  localStorage.setItem(ENUM.BROWSER_CACHE.CHILD_APP_BACK, 1);
9662
9686
  history.goBack();
@@ -15215,7 +15239,7 @@ var CommodityEntry = function CommodityEntry(props) {
15215
15239
  * @LastEditTime: 2022-01-14 17:17:26
15216
15240
  * @LastEditors: rodchen
15217
15241
  */
15218
- var index$1 = (function (storageKeyString) {
15242
+ var index = (function (storageKeyString) {
15219
15243
  var seconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
15220
15244
  var tipsCallFunction = arguments.length > 2 ? arguments[2] : undefined;
15221
15245
  if (typeof seconds !== 'number') throw new Error('seconds should be number');
@@ -15558,7 +15582,7 @@ var BusinessTreeSearchSelect = function BusinessTreeSearchSelect(props) {
15558
15582
  }, [props === null || props === void 0 ? void 0 : props.value]);
15559
15583
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(MemoTreeSearchSelect, _objectSpread2({}, currentProps)));
15560
15584
  };
15561
- var index$2 = /*#__PURE__*/React.memo(BusinessTreeSearchSelect, function (props, nextProps) {
15585
+ var index$1 = /*#__PURE__*/React.memo(BusinessTreeSearchSelect, function (props, nextProps) {
15562
15586
  if (props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
15563
15587
  return false;
15564
15588
  }
@@ -15571,7 +15595,7 @@ var index$2 = /*#__PURE__*/React.memo(BusinessTreeSearchSelect, function (props,
15571
15595
  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";
15572
15596
  styleInject(css_248z$8);
15573
15597
 
15574
- var index$3 = (function (props) {
15598
+ var index$2 = (function (props) {
15575
15599
  var _props$formStatusMapp = props.formStatusMapping,
15576
15600
  formStatusMapping = _props$formStatusMapp === void 0 ? [] : _props$formStatusMapp;
15577
15601
  return /*#__PURE__*/React.createElement("div", {
@@ -16995,7 +17019,7 @@ var iconMap = {
16995
17019
  src: moreIcon
16996
17020
  })
16997
17021
  };
16998
- var index$4 = (function (props) {
17022
+ var index$3 = (function (props) {
16999
17023
  var _useLocation = useLocation(),
17000
17024
  pathname = _useLocation.pathname;
17001
17025
  var _useState = useState(pathname + 'id'),
@@ -17212,7 +17236,7 @@ var css_248z$d = ".home_page_head {\n height: 54px;\n display: flex;\n justif
17212
17236
  styleInject(css_248z$d);
17213
17237
 
17214
17238
  var _excluded$c = ["children"];
17215
- var index$5 = (function (props) {
17239
+ var index$4 = (function (props) {
17216
17240
  var _useLocation = useLocation(),
17217
17241
  pathname = _useLocation.pathname;
17218
17242
  var _useState = useState(pathname + 'id'),
@@ -17325,6 +17349,7 @@ styleInject(css_248z$e);
17325
17349
  var _excluded$d = ["className", "style"];
17326
17350
  var DragHandle$2 = SortableHandle(function () {
17327
17351
  return /*#__PURE__*/React.createElement("img", {
17352
+ width: 25,
17328
17353
  src: drag
17329
17354
  });
17330
17355
  });
@@ -17540,11 +17565,17 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
17540
17565
  }))
17541
17566
  });
17542
17567
  }
17568
+ },
17569
+ style: {
17570
+ display: 'inline-block',
17571
+ width: '24px',
17572
+ textAlign: 'center'
17543
17573
  }
17544
17574
  }, /*#__PURE__*/React.createElement(Tooltip, {
17545
17575
  placement: "top",
17546
17576
  title: (record === null || record === void 0 ? void 0 : record.fixed) === 'left' ? '取消固定' : '固定列首'
17547
17577
  }, /*#__PURE__*/React.createElement("img", {
17578
+ width: 18,
17548
17579
  src: (record === null || record === void 0 ? void 0 : record.fixed) === 'left' ? fixedLeftActive : fixedLeft
17549
17580
  })));
17550
17581
  }
@@ -17610,11 +17641,17 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
17610
17641
  }))
17611
17642
  });
17612
17643
  }
17644
+ },
17645
+ style: {
17646
+ display: 'inline-block',
17647
+ width: '24px',
17648
+ textAlign: 'center'
17613
17649
  }
17614
17650
  }, /*#__PURE__*/React.createElement(Tooltip, {
17615
17651
  placement: "top",
17616
17652
  title: (record === null || record === void 0 ? void 0 : record.fixed) === 'right' ? '取消固定' : '固定列尾'
17617
17653
  }, /*#__PURE__*/React.createElement("img", {
17654
+ width: 18,
17618
17655
  src: (record === null || record === void 0 ? void 0 : record.fixed) === 'right' ? fixedRightActive : fixedRight
17619
17656
  })));
17620
17657
  }
@@ -17640,6 +17677,7 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
17640
17677
  });
17641
17678
  }
17642
17679
  }, /*#__PURE__*/React.createElement("img", {
17680
+ width: 24,
17643
17681
  src: close
17644
17682
  }));
17645
17683
  }
@@ -18049,6 +18087,7 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
18049
18087
  var _excluded$e = ["className", "style"];
18050
18088
  var DragHandle$3 = SortableHandle(function () {
18051
18089
  return /*#__PURE__*/React.createElement("img", {
18090
+ width: 25,
18052
18091
  src: drag
18053
18092
  });
18054
18093
  });
@@ -18217,6 +18256,7 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
18217
18256
  });
18218
18257
  }
18219
18258
  }, /*#__PURE__*/React.createElement("img", {
18259
+ width: 24,
18220
18260
  src: close
18221
18261
  }));
18222
18262
  }
@@ -22292,7 +22332,7 @@ var WrapperComponent = /*#__PURE__*/function (_React$Component) {
22292
22332
  }]);
22293
22333
  return WrapperComponent;
22294
22334
  }(React.Component);
22295
- var index$6 = (function (props) {
22335
+ var index$5 = (function (props) {
22296
22336
  var _useModel = useModel('@@initialState'),
22297
22337
  _useModel$initialStat = _useModel.initialState,
22298
22338
  initialState = _useModel$initialStat === void 0 ? {} : _useModel$initialStat;
@@ -22435,13 +22475,25 @@ var headersToRows = function headersToRows(originColumns) {
22435
22475
  var css_248z$n = ".editTableWrapper {\n width: 1000px;\n height: 500px;\n overflow: auto;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.editTableWrapper table {\n table-layout: fixed;\n}\n.editTableWrapper .editTable {\n position: relative;\n overflow: hidden;\n border-top: 0;\n background: #fff;\n}\n.editTableWrapper .north__west {\n position: sticky;\n background-color: #f7f8fb;\n left: 0px;\n top: 0px;\n font-size: 14px;\n color: #606266;\n z-index: 5;\n}\n.editTableWrapper .north__west th {\n background: #fff;\n font-size: 14px;\n color: #606266;\n z-index: 5;\n}\n.editTableWrapper .south__west {\n z-index: 4;\n position: absolute;\n left: 0px;\n top: 0;\n}\n.editTableWrapper .south__west th {\n background: #fff;\n font-size: 14px;\n color: #606266;\n z-index: 4;\n}\n.editTableWrapper .south__west td {\n font-size: 12px;\n background: #fff;\n color: #6a6a6a;\n}\n.editTableWrapper .south__west td svg {\n width: 20px;\n height: 20px;\n vertical-align: middle;\n}\n.editTableWrapper .editTable__block {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n position: absolute;\n border-collapse: collapse;\n padding: 0;\n}\n.editTableWrapper .editTable__block th,\n.editTableWrapper .editTable__block td {\n box-sizing: border-box;\n font-size: 11px;\n color: #6a6a6a;\n}\n.editTableWrapper .value_table table {\n table-layout: fixed;\n min-width: 100%;\n}\n.editTableWrapper .table_border_style {\n border-collapse: separate;\n border-spacing: 0;\n border-left: 1px solid #f0f0f0;\n border-top: 1px solid #f0f0f0;\n}\n.editTableWrapper .table_border_style td {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n box-sizing: border-box;\n border-right: 1px solid #f0f0f0;\n border-bottom: 1px solid #f0f0f0;\n padding: 0 10px;\n font-size: 14px;\n line-height: 28px;\n}\n";
22436
22476
  styleInject(css_248z$n);
22437
22477
 
22478
+ var useSticky = function useSticky(sticky) {
22479
+ var _ref = _typeof(sticky) === 'object' ? sticky : {},
22480
+ _ref$getContainer = _ref.getContainer,
22481
+ getContainer = _ref$getContainer === void 0 ? function () {
22482
+ return window.document;
22483
+ } : _ref$getContainer;
22484
+ var container = getContainer();
22485
+ return React.useMemo(function () {
22486
+ var isSticky = !!sticky;
22487
+ return {
22488
+ isSticky: isSticky,
22489
+ container: container
22490
+ };
22491
+ }, [sticky]);
22492
+ };
22493
+
22438
22494
  function getOffset(node) {
22439
22495
  var box = node.getBoundingClientRect();
22440
22496
  var docElem = document.documentElement;
22441
- console.log(box, 'box', {
22442
- left: box.left + (window.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || document.body.clientLeft || 0),
22443
- top: box.top + (window.pageYOffset || docElem.scrollTop) - (docElem.clientTop || document.body.clientTop || 0)
22444
- });
22445
22497
  // < ie8 不支持 win.pageXOffset, 则使用 docElem.scrollLeft
22446
22498
  return {
22447
22499
  left: box.left + (window.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || document.body.clientLeft || 0),
@@ -22449,11 +22501,14 @@ function getOffset(node) {
22449
22501
  };
22450
22502
  }
22451
22503
  var FixedScrollBar = function FixedScrollBar(_ref, ref) {
22452
- var _viewPort$current;
22504
+ var _viewPort$current, _viewPort$current2;
22453
22505
  var viewPort = _ref.viewPort,
22454
- width = _ref.width;
22506
+ stickyProps = _ref.stickyProps;
22507
+ var _useSticky = useSticky(stickyProps),
22508
+ isSticky = _useSticky.isSticky,
22509
+ container = _useSticky.container;
22455
22510
  var _useState = useState({
22456
- isHiddenScrollBar: false
22511
+ isHiddenScrollBar: !isSticky
22457
22512
  }),
22458
22513
  _useState2 = _slicedToArray(_useState, 2),
22459
22514
  scrollState = _useState2[0],
@@ -22482,9 +22537,10 @@ var FixedScrollBar = function FixedScrollBar(_ref, ref) {
22482
22537
  }
22483
22538
  };
22484
22539
  useEffect(function () {
22485
- document.addEventListener('scroll', onContainerScroll);
22540
+ var onscroll = throttle(onContainerScroll, 50);
22541
+ container.addEventListener('scroll', onscroll);
22486
22542
  return function () {
22487
- document.removeEventListener('scroll', onContainerScroll);
22543
+ container.removeEventListener('scroll', onscroll);
22488
22544
  };
22489
22545
  }, []);
22490
22546
  if (scrollState.isHiddenScrollBar) {
@@ -22492,10 +22548,10 @@ var FixedScrollBar = function FixedScrollBar(_ref, ref) {
22492
22548
  }
22493
22549
  return /*#__PURE__*/React.createElement("div", {
22494
22550
  ref: ref,
22495
- onScroll: function onScroll(e) {
22551
+ onScroll: throttle(function (e) {
22496
22552
  // @ts-ignore
22497
22553
  viewPort.current.scrollTo(e.target.scrollLeft, 0);
22498
- },
22554
+ }, 50),
22499
22555
  style: {
22500
22556
  position: 'fixed',
22501
22557
  zIndex: '9999',
@@ -22511,13 +22567,13 @@ var FixedScrollBar = function FixedScrollBar(_ref, ref) {
22511
22567
  style: {
22512
22568
  height: '1px',
22513
22569
  backgroundColor: '#fff',
22514
- width: width
22570
+ width: ((_viewPort$current2 = viewPort.current) === null || _viewPort$current2 === void 0 ? void 0 : _viewPort$current2.scrollWidth) || 0
22515
22571
  }
22516
22572
  }));
22517
22573
  };
22518
22574
  var FixedScrollBar$1 = /*#__PURE__*/React.forwardRef(FixedScrollBar);
22519
22575
 
22520
- var index$7 = /*#__PURE__*/forwardRef(function (props, ref) {
22576
+ var index$6 = /*#__PURE__*/forwardRef(function (props, ref) {
22521
22577
  var _useState = useState(false),
22522
22578
  _useState2 = _slicedToArray(_useState, 2),
22523
22579
  show = _useState2[0],
@@ -22672,9 +22728,9 @@ var index$7 = /*#__PURE__*/forwardRef(function (props, ref) {
22672
22728
  className: 'editTableWrapper',
22673
22729
  onScroll: onScroll,
22674
22730
  ref: viewPort
22675
- }, (tableProps === null || tableProps === void 0 ? void 0 : tableProps.sticky) && /*#__PURE__*/React.createElement(FixedScrollBar$1, {
22731
+ }, /*#__PURE__*/React.createElement(FixedScrollBar$1, {
22732
+ stickyProps: tableProps === null || tableProps === void 0 ? void 0 : tableProps.sticky,
22676
22733
  viewPort: viewPort,
22677
- width: "".concat(config.colHeaderWidth + 1 + placeholderWidth, "px"),
22678
22734
  ref: topScrollBar
22679
22735
  }), /*#__PURE__*/React.createElement("div", {
22680
22736
  style: {
@@ -31229,4 +31285,4 @@ var JsonQueryTable = /*#__PURE__*/React.memo(function (props) {
31229
31285
  }, "setting"));
31230
31286
  });
31231
31287
 
31232
- export { AddSelect, AddSkcSelect, AddSkuSelect, AddSpuSelect, BillEntry, index$6 as BsLayout, BsSulaQueryTable, BusinessSearchSelect$1 as BusinessSearchSelect, index$2 as BusinessTreeSearchSelect, index$1 as CheckOneUser, ColumnSettingTable, CommodityEntry, DataImport, DataValidation, index$4 as DetailPageWrapper, ExportIcon, GuideWrapper, index$5 as HomePageWrapper, JsonQueryTable, index$7 as MoreTreeTable, QueryMutipleInput, SearchSelect, index$3 as StateFlow, ColumnSettingSulaTable as SulaColumnSettingTable, TableColumnSetting, TreeSearchSelect };
31288
+ export { AddSelect, AddSkcSelect, AddSkuSelect, AddSpuSelect, BillEntry, index$5 as BsLayout, BsSulaQueryTable, BusinessSearchSelect$1 as BusinessSearchSelect, index$1 as BusinessTreeSearchSelect, index as CheckOneUser, ColumnSettingTable, CommodityEntry, DataImport, DataValidation, index$3 as DetailPageWrapper, ExportIcon, GuideWrapper, index$4 as HomePageWrapper, JsonQueryTable, index$6 as MoreTreeTable, QueryMutipleInput, SearchSelect, index$2 as StateFlow, ColumnSettingSulaTable as SulaColumnSettingTable, TableColumnSetting, TreeSearchSelect };
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var reactResizable = require('react-resizable');
14
14
  var reactSortableHoc = require('react-sortable-hoc');
15
15
  var arrayMove = require('array-move');
16
16
  var umi = require('umi');
17
- var isEqual = require('lodash/isEqual');
17
+ var isEqual$1 = require('lodash/isEqual');
18
18
  var bssula = require('bssula');
19
19
  var ProLayout = require('@ant-design/pro-layout');
20
20
  var cloneDeep = require('lodash/cloneDeep');
@@ -33,7 +33,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
33
33
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
34
34
  var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
35
35
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
36
- var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
36
+ var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual$1);
37
37
  var ProLayout__default = /*#__PURE__*/_interopDefaultLegacy(ProLayout);
38
38
  var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
39
39
  var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
@@ -153,6 +153,33 @@ axios__default['default'].interceptors.request.use(function (config) {
153
153
  return config;
154
154
  });
155
155
 
156
+ function _iterableToArrayLimit(arr, i) {
157
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
158
+ if (null != _i) {
159
+ var _s,
160
+ _e,
161
+ _x,
162
+ _r,
163
+ _arr = [],
164
+ _n = !0,
165
+ _d = !1;
166
+ try {
167
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
168
+ if (Object(_i) !== _i) return;
169
+ _n = !1;
170
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
171
+ } catch (err) {
172
+ _d = !0, _e = err;
173
+ } finally {
174
+ try {
175
+ if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
176
+ } finally {
177
+ if (_d) throw _e;
178
+ }
179
+ }
180
+ return _arr;
181
+ }
182
+ }
156
183
  function ownKeys(object, enumerableOnly) {
157
184
  var keys = Object.keys(object);
158
185
  if (Object.getOwnPropertySymbols) {
@@ -309,14 +336,9 @@ function _regeneratorRuntime() {
309
336
  };
310
337
  }
311
338
  function maybeInvokeDelegate(delegate, context) {
312
- var method = delegate.iterator[context.method];
313
- if (undefined === method) {
314
- if (context.delegate = null, "throw" === context.method) {
315
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
316
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
317
- }
318
- return ContinueSentinel;
319
- }
339
+ var methodName = context.method,
340
+ method = delegate.iterator[methodName];
341
+ 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;
320
342
  var record = tryCatch(method, delegate.iterator, context.arg);
321
343
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
322
344
  var info = record.arg;
@@ -530,7 +552,7 @@ function _defineProperties(target, props) {
530
552
  descriptor.enumerable = descriptor.enumerable || false;
531
553
  descriptor.configurable = true;
532
554
  if ("value" in descriptor) descriptor.writable = true;
533
- Object.defineProperty(target, descriptor.key, descriptor);
555
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
534
556
  }
535
557
  }
536
558
  function _createClass(Constructor, protoProps, staticProps) {
@@ -542,6 +564,7 @@ function _createClass(Constructor, protoProps, staticProps) {
542
564
  return Constructor;
543
565
  }
544
566
  function _defineProperty(obj, key, value) {
567
+ key = _toPropertyKey(key);
545
568
  if (key in obj) {
546
569
  Object.defineProperty(obj, key, {
547
570
  value: value,
@@ -670,30 +693,6 @@ function _arrayWithHoles(arr) {
670
693
  function _iterableToArray(iter) {
671
694
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
672
695
  }
673
- function _iterableToArrayLimit(arr, i) {
674
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
675
- if (_i == null) return;
676
- var _arr = [];
677
- var _n = true;
678
- var _d = false;
679
- var _s, _e;
680
- try {
681
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
682
- _arr.push(_s.value);
683
- if (i && _arr.length === i) break;
684
- }
685
- } catch (err) {
686
- _d = true;
687
- _e = err;
688
- } finally {
689
- try {
690
- if (!_n && _i["return"] != null) _i["return"]();
691
- } finally {
692
- if (_d) throw _e;
693
- }
694
- }
695
- return _arr;
696
- }
697
696
  function _unsupportedIterableToArray(o, minLen) {
698
697
  if (!o) return;
699
698
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -713,6 +712,20 @@ function _nonIterableSpread() {
713
712
  function _nonIterableRest() {
714
713
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
715
714
  }
715
+ function _toPrimitive(input, hint) {
716
+ if (typeof input !== "object" || input === null) return input;
717
+ var prim = input[Symbol.toPrimitive];
718
+ if (prim !== undefined) {
719
+ var res = prim.call(input, hint || "default");
720
+ if (typeof res !== "object") return res;
721
+ throw new TypeError("@@toPrimitive must return a primitive value.");
722
+ }
723
+ return (hint === "string" ? String : Number)(input);
724
+ }
725
+ function _toPropertyKey(arg) {
726
+ var key = _toPrimitive(arg, "string");
727
+ return typeof key === "symbol" ? key : String(key);
728
+ }
716
729
 
717
730
  var checkQuantityAccuracy = function checkQuantityAccuracy(value, accuracy, errorInfo) {
718
731
  var errorMessage = _objectSpread2({
@@ -3680,41 +3693,52 @@ var setInitialShowColumn = function setInitialShowColumn(tableCode, columns, cal
3680
3693
  callback(showColumns);
3681
3694
  };
3682
3695
 
3683
- var simpleIsEqual = function simpleIsEqual(a, b) {
3684
- return a === b;
3685
- };
3686
-
3687
- function index (resultFn, isEqual) {
3688
- if (isEqual === void 0) {
3689
- isEqual = simpleIsEqual;
3690
- }
3691
-
3692
- var lastThis;
3693
- var lastArgs = [];
3694
- var lastResult;
3695
- var calledOnce = false;
3696
-
3697
- var isNewArgEqualToLast = function isNewArgEqualToLast(newArg, index) {
3698
- return isEqual(newArg, lastArgs[index], index);
3699
- };
3700
-
3701
- var result = function result() {
3702
- for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) {
3703
- newArgs[_key] = arguments[_key];
3696
+ var safeIsNaN = Number.isNaN ||
3697
+ function ponyfill(value) {
3698
+ return typeof value === 'number' && value !== value;
3699
+ };
3700
+ function isEqual(first, second) {
3701
+ if (first === second) {
3702
+ return true;
3704
3703
  }
3705
-
3706
- if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) {
3707
- return lastResult;
3704
+ if (safeIsNaN(first) && safeIsNaN(second)) {
3705
+ return true;
3708
3706
  }
3707
+ return false;
3708
+ }
3709
+ function areInputsEqual(newInputs, lastInputs) {
3710
+ if (newInputs.length !== lastInputs.length) {
3711
+ return false;
3712
+ }
3713
+ for (var i = 0; i < newInputs.length; i++) {
3714
+ if (!isEqual(newInputs[i], lastInputs[i])) {
3715
+ return false;
3716
+ }
3717
+ }
3718
+ return true;
3719
+ }
3709
3720
 
3710
- lastResult = resultFn.apply(this, newArgs);
3711
- calledOnce = true;
3712
- lastThis = this;
3713
- lastArgs = newArgs;
3714
- return lastResult;
3715
- };
3716
-
3717
- return result;
3721
+ function memoizeOne(resultFn, isEqual) {
3722
+ if (isEqual === void 0) { isEqual = areInputsEqual; }
3723
+ var lastThis;
3724
+ var lastArgs = [];
3725
+ var lastResult;
3726
+ var calledOnce = false;
3727
+ function memoized() {
3728
+ var newArgs = [];
3729
+ for (var _i = 0; _i < arguments.length; _i++) {
3730
+ newArgs[_i] = arguments[_i];
3731
+ }
3732
+ if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {
3733
+ return lastResult;
3734
+ }
3735
+ lastResult = resultFn.apply(this, newArgs);
3736
+ calledOnce = true;
3737
+ lastThis = this;
3738
+ lastArgs = newArgs;
3739
+ return lastResult;
3740
+ }
3741
+ return memoized;
3718
3742
  }
3719
3743
 
3720
3744
  //! moment.js
@@ -9674,7 +9698,7 @@ var formatter = function formatter(data, parentAuthority, parentName) {
9674
9698
  return item;
9675
9699
  });
9676
9700
  };
9677
- var memoizeOneFormatter = index(formatter, isEqual__default['default']);
9701
+ var memoizeOneFormatter = memoizeOne(formatter, isEqual__default['default']);
9678
9702
  var go2BackAndClose = function go2BackAndClose() {
9679
9703
  localStorage.setItem(ENUM.BROWSER_CACHE.CHILD_APP_BACK, 1);
9680
9704
  umi.history.goBack();
@@ -15233,7 +15257,7 @@ var CommodityEntry = function CommodityEntry(props) {
15233
15257
  * @LastEditTime: 2022-01-14 17:17:26
15234
15258
  * @LastEditors: rodchen
15235
15259
  */
15236
- var index$1 = (function (storageKeyString) {
15260
+ var index = (function (storageKeyString) {
15237
15261
  var seconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
15238
15262
  var tipsCallFunction = arguments.length > 2 ? arguments[2] : undefined;
15239
15263
  if (typeof seconds !== 'number') throw new Error('seconds should be number');
@@ -15576,7 +15600,7 @@ var BusinessTreeSearchSelect = function BusinessTreeSearchSelect(props) {
15576
15600
  }, [props === null || props === void 0 ? void 0 : props.value]);
15577
15601
  return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(MemoTreeSearchSelect, _objectSpread2({}, currentProps)));
15578
15602
  };
15579
- var index$2 = /*#__PURE__*/React__default['default'].memo(BusinessTreeSearchSelect, function (props, nextProps) {
15603
+ var index$1 = /*#__PURE__*/React__default['default'].memo(BusinessTreeSearchSelect, function (props, nextProps) {
15580
15604
  if (props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
15581
15605
  return false;
15582
15606
  }
@@ -15589,7 +15613,7 @@ var index$2 = /*#__PURE__*/React__default['default'].memo(BusinessTreeSearchSele
15589
15613
  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";
15590
15614
  styleInject(css_248z$8);
15591
15615
 
15592
- var index$3 = (function (props) {
15616
+ var index$2 = (function (props) {
15593
15617
  var _props$formStatusMapp = props.formStatusMapping,
15594
15618
  formStatusMapping = _props$formStatusMapp === void 0 ? [] : _props$formStatusMapp;
15595
15619
  return /*#__PURE__*/React__default['default'].createElement("div", {
@@ -17013,7 +17037,7 @@ var iconMap = {
17013
17037
  src: moreIcon
17014
17038
  })
17015
17039
  };
17016
- var index$4 = (function (props) {
17040
+ var index$3 = (function (props) {
17017
17041
  var _useLocation = umi.useLocation(),
17018
17042
  pathname = _useLocation.pathname;
17019
17043
  var _useState = React.useState(pathname + 'id'),
@@ -17230,7 +17254,7 @@ var css_248z$d = ".home_page_head {\n height: 54px;\n display: flex;\n justif
17230
17254
  styleInject(css_248z$d);
17231
17255
 
17232
17256
  var _excluded$c = ["children"];
17233
- var index$5 = (function (props) {
17257
+ var index$4 = (function (props) {
17234
17258
  var _useLocation = umi.useLocation(),
17235
17259
  pathname = _useLocation.pathname;
17236
17260
  var _useState = React.useState(pathname + 'id'),
@@ -17343,6 +17367,7 @@ styleInject(css_248z$e);
17343
17367
  var _excluded$d = ["className", "style"];
17344
17368
  var DragHandle$2 = reactSortableHoc.SortableHandle(function () {
17345
17369
  return /*#__PURE__*/React__default['default'].createElement("img", {
17370
+ width: 25,
17346
17371
  src: drag
17347
17372
  });
17348
17373
  });
@@ -17558,11 +17583,17 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
17558
17583
  }))
17559
17584
  });
17560
17585
  }
17586
+ },
17587
+ style: {
17588
+ display: 'inline-block',
17589
+ width: '24px',
17590
+ textAlign: 'center'
17561
17591
  }
17562
17592
  }, /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
17563
17593
  placement: "top",
17564
17594
  title: (record === null || record === void 0 ? void 0 : record.fixed) === 'left' ? '取消固定' : '固定列首'
17565
17595
  }, /*#__PURE__*/React__default['default'].createElement("img", {
17596
+ width: 18,
17566
17597
  src: (record === null || record === void 0 ? void 0 : record.fixed) === 'left' ? fixedLeftActive : fixedLeft
17567
17598
  })));
17568
17599
  }
@@ -17628,11 +17659,17 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
17628
17659
  }))
17629
17660
  });
17630
17661
  }
17662
+ },
17663
+ style: {
17664
+ display: 'inline-block',
17665
+ width: '24px',
17666
+ textAlign: 'center'
17631
17667
  }
17632
17668
  }, /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
17633
17669
  placement: "top",
17634
17670
  title: (record === null || record === void 0 ? void 0 : record.fixed) === 'right' ? '取消固定' : '固定列尾'
17635
17671
  }, /*#__PURE__*/React__default['default'].createElement("img", {
17672
+ width: 18,
17636
17673
  src: (record === null || record === void 0 ? void 0 : record.fixed) === 'right' ? fixedRightActive : fixedRight
17637
17674
  })));
17638
17675
  }
@@ -17658,6 +17695,7 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
17658
17695
  });
17659
17696
  }
17660
17697
  }, /*#__PURE__*/React__default['default'].createElement("img", {
17698
+ width: 24,
17661
17699
  src: close
17662
17700
  }));
17663
17701
  }
@@ -18067,6 +18105,7 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
18067
18105
  var _excluded$e = ["className", "style"];
18068
18106
  var DragHandle$3 = reactSortableHoc.SortableHandle(function () {
18069
18107
  return /*#__PURE__*/React__default['default'].createElement("img", {
18108
+ width: 25,
18070
18109
  src: drag
18071
18110
  });
18072
18111
  });
@@ -18235,6 +18274,7 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
18235
18274
  });
18236
18275
  }
18237
18276
  }, /*#__PURE__*/React__default['default'].createElement("img", {
18277
+ width: 24,
18238
18278
  src: close
18239
18279
  }));
18240
18280
  }
@@ -22310,7 +22350,7 @@ var WrapperComponent = /*#__PURE__*/function (_React$Component) {
22310
22350
  }]);
22311
22351
  return WrapperComponent;
22312
22352
  }(React__default['default'].Component);
22313
- var index$6 = (function (props) {
22353
+ var index$5 = (function (props) {
22314
22354
  var _useModel = umi.useModel('@@initialState'),
22315
22355
  _useModel$initialStat = _useModel.initialState,
22316
22356
  initialState = _useModel$initialStat === void 0 ? {} : _useModel$initialStat;
@@ -22453,13 +22493,25 @@ var headersToRows = function headersToRows(originColumns) {
22453
22493
  var css_248z$n = ".editTableWrapper {\n width: 1000px;\n height: 500px;\n overflow: auto;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.editTableWrapper table {\n table-layout: fixed;\n}\n.editTableWrapper .editTable {\n position: relative;\n overflow: hidden;\n border-top: 0;\n background: #fff;\n}\n.editTableWrapper .north__west {\n position: sticky;\n background-color: #f7f8fb;\n left: 0px;\n top: 0px;\n font-size: 14px;\n color: #606266;\n z-index: 5;\n}\n.editTableWrapper .north__west th {\n background: #fff;\n font-size: 14px;\n color: #606266;\n z-index: 5;\n}\n.editTableWrapper .south__west {\n z-index: 4;\n position: absolute;\n left: 0px;\n top: 0;\n}\n.editTableWrapper .south__west th {\n background: #fff;\n font-size: 14px;\n color: #606266;\n z-index: 4;\n}\n.editTableWrapper .south__west td {\n font-size: 12px;\n background: #fff;\n color: #6a6a6a;\n}\n.editTableWrapper .south__west td svg {\n width: 20px;\n height: 20px;\n vertical-align: middle;\n}\n.editTableWrapper .editTable__block {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n position: absolute;\n border-collapse: collapse;\n padding: 0;\n}\n.editTableWrapper .editTable__block th,\n.editTableWrapper .editTable__block td {\n box-sizing: border-box;\n font-size: 11px;\n color: #6a6a6a;\n}\n.editTableWrapper .value_table table {\n table-layout: fixed;\n min-width: 100%;\n}\n.editTableWrapper .table_border_style {\n border-collapse: separate;\n border-spacing: 0;\n border-left: 1px solid #f0f0f0;\n border-top: 1px solid #f0f0f0;\n}\n.editTableWrapper .table_border_style td {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n box-sizing: border-box;\n border-right: 1px solid #f0f0f0;\n border-bottom: 1px solid #f0f0f0;\n padding: 0 10px;\n font-size: 14px;\n line-height: 28px;\n}\n";
22454
22494
  styleInject(css_248z$n);
22455
22495
 
22496
+ var useSticky = function useSticky(sticky) {
22497
+ var _ref = _typeof(sticky) === 'object' ? sticky : {},
22498
+ _ref$getContainer = _ref.getContainer,
22499
+ getContainer = _ref$getContainer === void 0 ? function () {
22500
+ return window.document;
22501
+ } : _ref$getContainer;
22502
+ var container = getContainer();
22503
+ return React__default['default'].useMemo(function () {
22504
+ var isSticky = !!sticky;
22505
+ return {
22506
+ isSticky: isSticky,
22507
+ container: container
22508
+ };
22509
+ }, [sticky]);
22510
+ };
22511
+
22456
22512
  function getOffset(node) {
22457
22513
  var box = node.getBoundingClientRect();
22458
22514
  var docElem = document.documentElement;
22459
- console.log(box, 'box', {
22460
- left: box.left + (window.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || document.body.clientLeft || 0),
22461
- top: box.top + (window.pageYOffset || docElem.scrollTop) - (docElem.clientTop || document.body.clientTop || 0)
22462
- });
22463
22515
  // < ie8 不支持 win.pageXOffset, 则使用 docElem.scrollLeft
22464
22516
  return {
22465
22517
  left: box.left + (window.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || document.body.clientLeft || 0),
@@ -22467,11 +22519,14 @@ function getOffset(node) {
22467
22519
  };
22468
22520
  }
22469
22521
  var FixedScrollBar = function FixedScrollBar(_ref, ref) {
22470
- var _viewPort$current;
22522
+ var _viewPort$current, _viewPort$current2;
22471
22523
  var viewPort = _ref.viewPort,
22472
- width = _ref.width;
22524
+ stickyProps = _ref.stickyProps;
22525
+ var _useSticky = useSticky(stickyProps),
22526
+ isSticky = _useSticky.isSticky,
22527
+ container = _useSticky.container;
22473
22528
  var _useState = React.useState({
22474
- isHiddenScrollBar: false
22529
+ isHiddenScrollBar: !isSticky
22475
22530
  }),
22476
22531
  _useState2 = _slicedToArray(_useState, 2),
22477
22532
  scrollState = _useState2[0],
@@ -22500,9 +22555,10 @@ var FixedScrollBar = function FixedScrollBar(_ref, ref) {
22500
22555
  }
22501
22556
  };
22502
22557
  React.useEffect(function () {
22503
- document.addEventListener('scroll', onContainerScroll);
22558
+ var onscroll = _.throttle(onContainerScroll, 50);
22559
+ container.addEventListener('scroll', onscroll);
22504
22560
  return function () {
22505
- document.removeEventListener('scroll', onContainerScroll);
22561
+ container.removeEventListener('scroll', onscroll);
22506
22562
  };
22507
22563
  }, []);
22508
22564
  if (scrollState.isHiddenScrollBar) {
@@ -22510,10 +22566,10 @@ var FixedScrollBar = function FixedScrollBar(_ref, ref) {
22510
22566
  }
22511
22567
  return /*#__PURE__*/React__default['default'].createElement("div", {
22512
22568
  ref: ref,
22513
- onScroll: function onScroll(e) {
22569
+ onScroll: _.throttle(function (e) {
22514
22570
  // @ts-ignore
22515
22571
  viewPort.current.scrollTo(e.target.scrollLeft, 0);
22516
- },
22572
+ }, 50),
22517
22573
  style: {
22518
22574
  position: 'fixed',
22519
22575
  zIndex: '9999',
@@ -22529,13 +22585,13 @@ var FixedScrollBar = function FixedScrollBar(_ref, ref) {
22529
22585
  style: {
22530
22586
  height: '1px',
22531
22587
  backgroundColor: '#fff',
22532
- width: width
22588
+ width: ((_viewPort$current2 = viewPort.current) === null || _viewPort$current2 === void 0 ? void 0 : _viewPort$current2.scrollWidth) || 0
22533
22589
  }
22534
22590
  }));
22535
22591
  };
22536
22592
  var FixedScrollBar$1 = /*#__PURE__*/React__default['default'].forwardRef(FixedScrollBar);
22537
22593
 
22538
- var index$7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
22594
+ var index$6 = /*#__PURE__*/React.forwardRef(function (props, ref) {
22539
22595
  var _useState = React.useState(false),
22540
22596
  _useState2 = _slicedToArray(_useState, 2),
22541
22597
  show = _useState2[0],
@@ -22690,9 +22746,9 @@ var index$7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
22690
22746
  className: 'editTableWrapper',
22691
22747
  onScroll: onScroll,
22692
22748
  ref: viewPort
22693
- }, (tableProps === null || tableProps === void 0 ? void 0 : tableProps.sticky) && /*#__PURE__*/React__default['default'].createElement(FixedScrollBar$1, {
22749
+ }, /*#__PURE__*/React__default['default'].createElement(FixedScrollBar$1, {
22750
+ stickyProps: tableProps === null || tableProps === void 0 ? void 0 : tableProps.sticky,
22694
22751
  viewPort: viewPort,
22695
- width: "".concat(config.colHeaderWidth + 1 + placeholderWidth, "px"),
22696
22752
  ref: topScrollBar
22697
22753
  }), /*#__PURE__*/React__default['default'].createElement("div", {
22698
22754
  style: {
@@ -31252,24 +31308,24 @@ exports.AddSkcSelect = AddSkcSelect;
31252
31308
  exports.AddSkuSelect = AddSkuSelect;
31253
31309
  exports.AddSpuSelect = AddSpuSelect;
31254
31310
  exports.BillEntry = BillEntry;
31255
- exports.BsLayout = index$6;
31311
+ exports.BsLayout = index$5;
31256
31312
  exports.BsSulaQueryTable = BsSulaQueryTable;
31257
31313
  exports.BusinessSearchSelect = BusinessSearchSelect$1;
31258
- exports.BusinessTreeSearchSelect = index$2;
31259
- exports.CheckOneUser = index$1;
31314
+ exports.BusinessTreeSearchSelect = index$1;
31315
+ exports.CheckOneUser = index;
31260
31316
  exports.ColumnSettingTable = ColumnSettingTable;
31261
31317
  exports.CommodityEntry = CommodityEntry;
31262
31318
  exports.DataImport = DataImport;
31263
31319
  exports.DataValidation = DataValidation;
31264
- exports.DetailPageWrapper = index$4;
31320
+ exports.DetailPageWrapper = index$3;
31265
31321
  exports.ExportIcon = ExportIcon;
31266
31322
  exports.GuideWrapper = GuideWrapper;
31267
- exports.HomePageWrapper = index$5;
31323
+ exports.HomePageWrapper = index$4;
31268
31324
  exports.JsonQueryTable = JsonQueryTable;
31269
- exports.MoreTreeTable = index$7;
31325
+ exports.MoreTreeTable = index$6;
31270
31326
  exports.QueryMutipleInput = QueryMutipleInput;
31271
31327
  exports.SearchSelect = SearchSelect;
31272
- exports.StateFlow = index$3;
31328
+ exports.StateFlow = index$2;
31273
31329
  exports.SulaColumnSettingTable = ColumnSettingSulaTable;
31274
31330
  exports.TableColumnSetting = TableColumnSetting;
31275
31331
  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.2.43",
3
+ "version": "2.2.45",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -22,7 +22,7 @@ import drag from '../../../assets/drag.svg';
22
22
  import './index.less';
23
23
  import ENUM from '@/utils/enumConfig';
24
24
 
25
- const DragHandle = SortableHandle(() => <img src={drag} />);
25
+ const DragHandle = SortableHandle(() => <img width={25} src={drag} />);
26
26
  const SortableItem = SortableElement((props) => <tr {...props} />);
27
27
  const SortableBody = SortableContainer((props) => <tbody {...props} />);
28
28
 
@@ -229,7 +229,7 @@ class SearchItemTable extends React.Component {
229
229
  });
230
230
  }}
231
231
  >
232
- <img src={close} />
232
+ <img width={24} src={close} />
233
233
  </span>
234
234
  );
235
235
  },
@@ -27,7 +27,7 @@ import fixedRightActive from '../../../assets/fixed-right-active.svg';
27
27
  import './index.less';
28
28
  import ENUM from '@/utils/enumConfig';
29
29
 
30
- const DragHandle = SortableHandle(() => <img src={drag} />);
30
+ const DragHandle = SortableHandle(() => <img width={25} src={drag} />);
31
31
 
32
32
  const SortableItem = SortableElement((props) => <tr {...props} />);
33
33
  const SortableBody = SortableContainer((props) => <tbody {...props} />);
@@ -292,12 +292,14 @@ class SortableTable extends React.Component {
292
292
  });
293
293
  }
294
294
  }}
295
+ style={{ display: 'inline-block', width: '24px', textAlign: 'center' }}
295
296
  >
296
297
  <Tooltip
297
298
  placement="top"
298
299
  title={record?.fixed === 'left' ? '取消固定' : '固定列首'}
299
300
  >
300
301
  <img
302
+ width={18}
301
303
  src={record?.fixed === 'left' ? fixedLeftActive : fixedLeft}
302
304
  />
303
305
  </Tooltip>
@@ -373,12 +375,14 @@ class SortableTable extends React.Component {
373
375
  });
374
376
  }
375
377
  }}
378
+ style={{ display: 'inline-block', width: '24px', textAlign: 'center' }}
376
379
  >
377
380
  <Tooltip
378
381
  placement="top"
379
382
  title={record?.fixed === 'right' ? '取消固定' : '固定列尾'}
380
383
  >
381
384
  <img
385
+ width={18}
382
386
  src={record?.fixed === 'right' ? fixedRightActive : fixedRight}
383
387
  />
384
388
  </Tooltip>
@@ -413,7 +417,7 @@ class SortableTable extends React.Component {
413
417
  });
414
418
  }}
415
419
  >
416
- <img src={close} />
420
+ <img width={24} src={close} />
417
421
  </span>
418
422
  );
419
423
  },
@@ -1,14 +1,10 @@
1
1
  import React, {useEffect, useImperativeHandle, useRef, useState} from 'react'
2
+ import {throttle} from "lodash";
3
+ import useSticky from "./hooks/useSticky";
2
4
 
3
5
  function getOffset(node: any) {
4
6
  const box = node.getBoundingClientRect();
5
7
  const docElem = document.documentElement;
6
- console.log(box, 'box', {
7
- left: box.left + (window.pageXOffset || docElem.scrollLeft) -
8
- (docElem.clientLeft || document.body.clientLeft || 0),
9
- top: box.top + (window.pageYOffset || docElem.scrollTop) -
10
- (docElem.clientTop || document.body.clientTop || 0),
11
- })
12
8
  // < ie8 不支持 win.pageXOffset, 则使用 docElem.scrollLeft
13
9
  return {
14
10
  left: box.left + (window.pageXOffset || docElem.scrollLeft) -
@@ -18,13 +14,11 @@ function getOffset(node: any) {
18
14
  };
19
15
  }
20
16
 
21
-
22
- const FixedScrollBar = ({viewPort, width}: any, ref: any) => {
23
-
17
+ const FixedScrollBar = ({viewPort, stickyProps}: any, ref: any) => {
18
+ const {isSticky, container} = useSticky(stickyProps)
24
19
  const [scrollState, setScrollState] = useState({
25
- isHiddenScrollBar: false
20
+ isHiddenScrollBar: !isSticky
26
21
  })
27
-
28
22
  const onContainerScroll = () => {
29
23
  if (!viewPort.current) {
30
24
  return;
@@ -32,7 +26,6 @@ const FixedScrollBar = ({viewPort, width}: any, ref: any) => {
32
26
  const tableOffsetTop = getOffset(viewPort.current).top;
33
27
  const tableBottomOffset = tableOffsetTop + viewPort.current.offsetHeight;
34
28
  const currentClientOffset = document.documentElement.scrollTop + window.innerHeight
35
-
36
29
  if (
37
30
  tableBottomOffset - 1 <= currentClientOffset ||
38
31
  tableOffsetTop >= currentClientOffset
@@ -51,9 +44,10 @@ const FixedScrollBar = ({viewPort, width}: any, ref: any) => {
51
44
  };
52
45
 
53
46
  useEffect(() => {
54
- document.addEventListener('scroll', onContainerScroll)
47
+ const onscroll = throttle(onContainerScroll, 50)
48
+ container.addEventListener('scroll', onscroll)
55
49
  return () => {
56
- document.removeEventListener('scroll', onContainerScroll)
50
+ container.removeEventListener('scroll', onscroll)
57
51
  }
58
52
  },[])
59
53
 
@@ -64,10 +58,10 @@ const FixedScrollBar = ({viewPort, width}: any, ref: any) => {
64
58
  return (
65
59
  <div
66
60
  ref={ref}
67
- onScroll={(e) => {
61
+ onScroll={throttle((e) => {
68
62
  // @ts-ignore
69
63
  viewPort.current.scrollTo(e.target.scrollLeft, 0)
70
- }}
64
+ }, 50)}
71
65
  style={{
72
66
  position:'fixed',
73
67
  zIndex: '9999',
@@ -83,7 +77,7 @@ const FixedScrollBar = ({viewPort, width}: any, ref: any) => {
83
77
  style={{
84
78
  height: '1px',
85
79
  backgroundColor: '#fff',
86
- width,
80
+ width: viewPort.current?.scrollWidth || 0,
87
81
  }}></div>
88
82
  </div>
89
83
  )
@@ -0,0 +1,21 @@
1
+ import React from 'react'
2
+
3
+ interface TableSticky{
4
+ getContainer?: () => Window | HTMLElement;
5
+ }
6
+
7
+ const useSticky = (sticky: boolean | TableSticky) => {
8
+ const {getContainer = () => window.document} = typeof sticky === 'object' ? sticky : {}
9
+
10
+ const container = getContainer()
11
+ return React.useMemo(() => {
12
+ const isSticky = !!sticky
13
+ return {
14
+ isSticky,
15
+ container,
16
+ }
17
+ },[sticky])
18
+
19
+ }
20
+
21
+ export default useSticky
@@ -152,11 +152,11 @@ export default forwardRef((props, ref) => {
152
152
  onScroll={onScroll}
153
153
  ref={viewPort}
154
154
  >
155
- {tableProps?.sticky && <FixedScrollBar
155
+ <FixedScrollBar
156
+ stickyProps={tableProps?.sticky}
156
157
  viewPort={viewPort}
157
- width={`${config.colHeaderWidth + 1 + placeholderWidth}px`}
158
158
  ref={topScrollBar}
159
- />}
159
+ />
160
160
  <div style={{
161
161
  width: `${config.colHeaderWidth + 1 + placeholderWidth}px`,
162
162
  position: 'absolute',