@bit-sun/business-component 2.2.42 → 2.2.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Business/BsLayouts/Components/AllFunc/drawContent.d.ts +1 -1
- package/dist/components/Business/BsLayouts/Components/AllFunc/index.d.ts +1 -1
- package/dist/components/Business/BsLayouts/Components/RightContent/index.d.ts +2 -2
- package/dist/components/Business/BsLayouts/Components/SearchFunc/index.d.ts +2 -2
- package/dist/components/Business/BsLayouts/index.d.ts +2 -2
- package/dist/components/Business/BsSulaQueryTable/utils.d.ts +2 -2
- package/dist/components/Business/moreTreeTable/FixedScrollBar.d.ts +3 -0
- package/dist/components/Business/moreTreeTable/hooks/useSticky.d.ts +8 -0
- package/dist/index.esm.js +185 -102
- package/dist/index.js +191 -108
- package/dist/utils/TableUtils.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/Business/moreTreeTable/FixedScrollBar.tsx +86 -0
- package/src/components/Business/moreTreeTable/hooks/useSticky.ts +21 -0
- package/src/components/Business/moreTreeTable/index.tsx +13 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './home.less';
|
|
3
|
-
export type SiderTheme = 'light' | 'dark';
|
|
4
|
-
export type GlobalHeaderRightProps = {
|
|
3
|
+
export declare type SiderTheme = 'light' | 'dark';
|
|
4
|
+
export declare 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 type SiderTheme = 'light' | 'dark';
|
|
4
|
-
export type GlobalHeaderRightProps = {
|
|
3
|
+
export declare type SiderTheme = 'light' | 'dark';
|
|
4
|
+
export declare 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 type BasicLayoutProps = {
|
|
5
|
+
export declare 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 type BasicLayoutContext = {
|
|
12
|
+
export declare 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
|
-
type tableColumnsImageType = {
|
|
49
|
+
declare 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
|
-
type UserColumnsType = {
|
|
55
|
+
declare type UserColumnsType = {
|
|
56
56
|
name: string;
|
|
57
57
|
department?: string;
|
|
58
58
|
position?: string;
|
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
|
|
13
|
+
import isEqual 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,33 +135,6 @@ 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
|
-
}
|
|
165
138
|
function ownKeys(object, enumerableOnly) {
|
|
166
139
|
var keys = Object.keys(object);
|
|
167
140
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -318,9 +291,14 @@ function _regeneratorRuntime() {
|
|
|
318
291
|
};
|
|
319
292
|
}
|
|
320
293
|
function maybeInvokeDelegate(delegate, context) {
|
|
321
|
-
var
|
|
322
|
-
|
|
323
|
-
|
|
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
|
+
}
|
|
324
302
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
325
303
|
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
326
304
|
var info = record.arg;
|
|
@@ -534,7 +512,7 @@ function _defineProperties(target, props) {
|
|
|
534
512
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
535
513
|
descriptor.configurable = true;
|
|
536
514
|
if ("value" in descriptor) descriptor.writable = true;
|
|
537
|
-
Object.defineProperty(target,
|
|
515
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
538
516
|
}
|
|
539
517
|
}
|
|
540
518
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
@@ -546,7 +524,6 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
546
524
|
return Constructor;
|
|
547
525
|
}
|
|
548
526
|
function _defineProperty(obj, key, value) {
|
|
549
|
-
key = _toPropertyKey(key);
|
|
550
527
|
if (key in obj) {
|
|
551
528
|
Object.defineProperty(obj, key, {
|
|
552
529
|
value: value,
|
|
@@ -675,6 +652,30 @@ function _arrayWithHoles(arr) {
|
|
|
675
652
|
function _iterableToArray(iter) {
|
|
676
653
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
677
654
|
}
|
|
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
|
+
}
|
|
678
679
|
function _unsupportedIterableToArray(o, minLen) {
|
|
679
680
|
if (!o) return;
|
|
680
681
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -694,20 +695,6 @@ function _nonIterableSpread() {
|
|
|
694
695
|
function _nonIterableRest() {
|
|
695
696
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
696
697
|
}
|
|
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
|
-
}
|
|
711
698
|
|
|
712
699
|
var checkQuantityAccuracy = function checkQuantityAccuracy(value, accuracy, errorInfo) {
|
|
713
700
|
var errorMessage = _objectSpread2({
|
|
@@ -3675,52 +3662,41 @@ var setInitialShowColumn = function setInitialShowColumn(tableCode, columns, cal
|
|
|
3675
3662
|
callback(showColumns);
|
|
3676
3663
|
};
|
|
3677
3664
|
|
|
3678
|
-
var
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
function
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
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];
|
|
3699
3686
|
}
|
|
3700
|
-
return true;
|
|
3701
|
-
}
|
|
3702
3687
|
|
|
3703
|
-
|
|
3704
|
-
|
|
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;
|
|
3688
|
+
if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) {
|
|
3689
|
+
return lastResult;
|
|
3722
3690
|
}
|
|
3723
|
-
|
|
3691
|
+
|
|
3692
|
+
lastResult = resultFn.apply(this, newArgs);
|
|
3693
|
+
calledOnce = true;
|
|
3694
|
+
lastThis = this;
|
|
3695
|
+
lastArgs = newArgs;
|
|
3696
|
+
return lastResult;
|
|
3697
|
+
};
|
|
3698
|
+
|
|
3699
|
+
return result;
|
|
3724
3700
|
}
|
|
3725
3701
|
|
|
3726
3702
|
//! moment.js
|
|
@@ -9680,7 +9656,7 @@ var formatter = function formatter(data, parentAuthority, parentName) {
|
|
|
9680
9656
|
return item;
|
|
9681
9657
|
});
|
|
9682
9658
|
};
|
|
9683
|
-
var memoizeOneFormatter =
|
|
9659
|
+
var memoizeOneFormatter = index(formatter, isEqual);
|
|
9684
9660
|
var go2BackAndClose = function go2BackAndClose() {
|
|
9685
9661
|
localStorage.setItem(ENUM.BROWSER_CACHE.CHILD_APP_BACK, 1);
|
|
9686
9662
|
history.goBack();
|
|
@@ -15239,7 +15215,7 @@ var CommodityEntry = function CommodityEntry(props) {
|
|
|
15239
15215
|
* @LastEditTime: 2022-01-14 17:17:26
|
|
15240
15216
|
* @LastEditors: rodchen
|
|
15241
15217
|
*/
|
|
15242
|
-
var index = (function (storageKeyString) {
|
|
15218
|
+
var index$1 = (function (storageKeyString) {
|
|
15243
15219
|
var seconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
15244
15220
|
var tipsCallFunction = arguments.length > 2 ? arguments[2] : undefined;
|
|
15245
15221
|
if (typeof seconds !== 'number') throw new Error('seconds should be number');
|
|
@@ -15582,7 +15558,7 @@ var BusinessTreeSearchSelect = function BusinessTreeSearchSelect(props) {
|
|
|
15582
15558
|
}, [props === null || props === void 0 ? void 0 : props.value]);
|
|
15583
15559
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(MemoTreeSearchSelect, _objectSpread2({}, currentProps)));
|
|
15584
15560
|
};
|
|
15585
|
-
var index$
|
|
15561
|
+
var index$2 = /*#__PURE__*/React.memo(BusinessTreeSearchSelect, function (props, nextProps) {
|
|
15586
15562
|
if (props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
|
|
15587
15563
|
return false;
|
|
15588
15564
|
}
|
|
@@ -15595,7 +15571,7 @@ var index$1 = /*#__PURE__*/React.memo(BusinessTreeSearchSelect, function (props,
|
|
|
15595
15571
|
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";
|
|
15596
15572
|
styleInject(css_248z$8);
|
|
15597
15573
|
|
|
15598
|
-
var index$
|
|
15574
|
+
var index$3 = (function (props) {
|
|
15599
15575
|
var _props$formStatusMapp = props.formStatusMapping,
|
|
15600
15576
|
formStatusMapping = _props$formStatusMapp === void 0 ? [] : _props$formStatusMapp;
|
|
15601
15577
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -17019,7 +16995,7 @@ var iconMap = {
|
|
|
17019
16995
|
src: moreIcon
|
|
17020
16996
|
})
|
|
17021
16997
|
};
|
|
17022
|
-
var index$
|
|
16998
|
+
var index$4 = (function (props) {
|
|
17023
16999
|
var _useLocation = useLocation(),
|
|
17024
17000
|
pathname = _useLocation.pathname;
|
|
17025
17001
|
var _useState = useState(pathname + 'id'),
|
|
@@ -17236,7 +17212,7 @@ var css_248z$d = ".home_page_head {\n height: 54px;\n display: flex;\n justif
|
|
|
17236
17212
|
styleInject(css_248z$d);
|
|
17237
17213
|
|
|
17238
17214
|
var _excluded$c = ["children"];
|
|
17239
|
-
var index$
|
|
17215
|
+
var index$5 = (function (props) {
|
|
17240
17216
|
var _useLocation = useLocation(),
|
|
17241
17217
|
pathname = _useLocation.pathname;
|
|
17242
17218
|
var _useState = useState(pathname + 'id'),
|
|
@@ -22316,7 +22292,7 @@ var WrapperComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
22316
22292
|
}]);
|
|
22317
22293
|
return WrapperComponent;
|
|
22318
22294
|
}(React.Component);
|
|
22319
|
-
var index$
|
|
22295
|
+
var index$6 = (function (props) {
|
|
22320
22296
|
var _useModel = useModel('@@initialState'),
|
|
22321
22297
|
_useModel$initialStat = _useModel.initialState,
|
|
22322
22298
|
initialState = _useModel$initialStat === void 0 ? {} : _useModel$initialStat;
|
|
@@ -22459,7 +22435,105 @@ var headersToRows = function headersToRows(originColumns) {
|
|
|
22459
22435
|
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";
|
|
22460
22436
|
styleInject(css_248z$n);
|
|
22461
22437
|
|
|
22462
|
-
var
|
|
22438
|
+
var useSticky = function useSticky(sticky) {
|
|
22439
|
+
var _ref = _typeof(sticky) === 'object' ? sticky : {},
|
|
22440
|
+
_ref$getContainer = _ref.getContainer,
|
|
22441
|
+
getContainer = _ref$getContainer === void 0 ? function () {
|
|
22442
|
+
return window.document;
|
|
22443
|
+
} : _ref$getContainer;
|
|
22444
|
+
var container = getContainer();
|
|
22445
|
+
return React.useMemo(function () {
|
|
22446
|
+
var isSticky = !!sticky;
|
|
22447
|
+
return {
|
|
22448
|
+
isSticky: isSticky,
|
|
22449
|
+
container: container
|
|
22450
|
+
};
|
|
22451
|
+
}, [sticky]);
|
|
22452
|
+
};
|
|
22453
|
+
|
|
22454
|
+
function getOffset(node) {
|
|
22455
|
+
var box = node.getBoundingClientRect();
|
|
22456
|
+
var docElem = document.documentElement;
|
|
22457
|
+
// < ie8 不支持 win.pageXOffset, 则使用 docElem.scrollLeft
|
|
22458
|
+
return {
|
|
22459
|
+
left: box.left + (window.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || document.body.clientLeft || 0),
|
|
22460
|
+
top: box.top + (window.pageYOffset || docElem.scrollTop) - (docElem.clientTop || document.body.clientTop || 0)
|
|
22461
|
+
};
|
|
22462
|
+
}
|
|
22463
|
+
var FixedScrollBar = function FixedScrollBar(_ref, ref) {
|
|
22464
|
+
var _viewPort$current, _viewPort$current2;
|
|
22465
|
+
var viewPort = _ref.viewPort,
|
|
22466
|
+
stickyProps = _ref.stickyProps;
|
|
22467
|
+
var _useSticky = useSticky(stickyProps),
|
|
22468
|
+
isSticky = _useSticky.isSticky,
|
|
22469
|
+
container = _useSticky.container;
|
|
22470
|
+
var _useState = useState({
|
|
22471
|
+
isHiddenScrollBar: !isSticky
|
|
22472
|
+
}),
|
|
22473
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
22474
|
+
scrollState = _useState2[0],
|
|
22475
|
+
setScrollState = _useState2[1];
|
|
22476
|
+
var onContainerScroll = function onContainerScroll() {
|
|
22477
|
+
if (!viewPort.current) {
|
|
22478
|
+
return;
|
|
22479
|
+
}
|
|
22480
|
+
var tableOffsetTop = getOffset(viewPort.current).top;
|
|
22481
|
+
var tableBottomOffset = tableOffsetTop + viewPort.current.offsetHeight;
|
|
22482
|
+
var currentClientOffset = document.documentElement.scrollTop + window.innerHeight;
|
|
22483
|
+
if (tableBottomOffset - 1 <= currentClientOffset || tableOffsetTop >= currentClientOffset) {
|
|
22484
|
+
setScrollState(function (state) {
|
|
22485
|
+
return _objectSpread2(_objectSpread2({}, state), {}, {
|
|
22486
|
+
isHiddenScrollBar: true
|
|
22487
|
+
});
|
|
22488
|
+
});
|
|
22489
|
+
} else {
|
|
22490
|
+
var _ref$current;
|
|
22491
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.scrollTo(viewPort.current.scrollLeft, 0);
|
|
22492
|
+
setScrollState(function (state) {
|
|
22493
|
+
return _objectSpread2(_objectSpread2({}, state), {}, {
|
|
22494
|
+
isHiddenScrollBar: false
|
|
22495
|
+
});
|
|
22496
|
+
});
|
|
22497
|
+
}
|
|
22498
|
+
};
|
|
22499
|
+
useEffect(function () {
|
|
22500
|
+
var onscroll = throttle(onContainerScroll, 50);
|
|
22501
|
+
container.addEventListener('scroll', onscroll);
|
|
22502
|
+
return function () {
|
|
22503
|
+
container.removeEventListener('scroll', onscroll);
|
|
22504
|
+
};
|
|
22505
|
+
}, []);
|
|
22506
|
+
if (scrollState.isHiddenScrollBar) {
|
|
22507
|
+
return null;
|
|
22508
|
+
}
|
|
22509
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
22510
|
+
ref: ref,
|
|
22511
|
+
onScroll: throttle(function (e) {
|
|
22512
|
+
// @ts-ignore
|
|
22513
|
+
viewPort.current.scrollTo(e.target.scrollLeft, 0);
|
|
22514
|
+
}, 50),
|
|
22515
|
+
style: {
|
|
22516
|
+
position: 'fixed',
|
|
22517
|
+
zIndex: '9999',
|
|
22518
|
+
bottom: '45px',
|
|
22519
|
+
overflowY: 'hidden',
|
|
22520
|
+
overflowX: 'auto',
|
|
22521
|
+
width: ((_viewPort$current = viewPort.current) === null || _viewPort$current === void 0 ? void 0 : _viewPort$current.offsetWidth) || 0,
|
|
22522
|
+
background: '#fff',
|
|
22523
|
+
opacity: 0.6
|
|
22524
|
+
}
|
|
22525
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
22526
|
+
className: 'ant-table-sticky-scroll-bar',
|
|
22527
|
+
style: {
|
|
22528
|
+
height: '1px',
|
|
22529
|
+
backgroundColor: '#fff',
|
|
22530
|
+
width: ((_viewPort$current2 = viewPort.current) === null || _viewPort$current2 === void 0 ? void 0 : _viewPort$current2.scrollWidth) || 0
|
|
22531
|
+
}
|
|
22532
|
+
}));
|
|
22533
|
+
};
|
|
22534
|
+
var FixedScrollBar$1 = /*#__PURE__*/React.forwardRef(FixedScrollBar);
|
|
22535
|
+
|
|
22536
|
+
var index$7 = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
22463
22537
|
var _useState = useState(false),
|
|
22464
22538
|
_useState2 = _slicedToArray(_useState, 2),
|
|
22465
22539
|
show = _useState2[0],
|
|
@@ -22490,6 +22564,7 @@ var index$6 = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
22490
22564
|
setViewCount = _useState10[1]; //虚拟表格每次渲染数量
|
|
22491
22565
|
var itemWidth = 100; // 表格每一项宽度
|
|
22492
22566
|
var viewPort = useRef(null);
|
|
22567
|
+
var topScrollBar = useRef(null);
|
|
22493
22568
|
//起始渲染item
|
|
22494
22569
|
var _useState11 = useState(0),
|
|
22495
22570
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
@@ -22511,6 +22586,9 @@ var index$6 = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
22511
22586
|
setViewCount(viewCount);
|
|
22512
22587
|
}, []);
|
|
22513
22588
|
var onScroll = function onScroll() {
|
|
22589
|
+
if (topScrollBar.current) {
|
|
22590
|
+
topScrollBar.current.scrollTo(viewPort.current.scrollLeft, 0);
|
|
22591
|
+
}
|
|
22514
22592
|
var scrollWidth = viewPort.current.scrollLeft;
|
|
22515
22593
|
var startIndex = Math.floor(scrollWidth / itemWidth);
|
|
22516
22594
|
var offsetWidth = startIndex * itemWidth;
|
|
@@ -22596,7 +22674,8 @@ var index$6 = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
22596
22674
|
// return <div>loading</div>;
|
|
22597
22675
|
// }
|
|
22598
22676
|
var width = props.width,
|
|
22599
|
-
height = props.height
|
|
22677
|
+
height = props.height,
|
|
22678
|
+
tableProps = props.tableProps;
|
|
22600
22679
|
var tableWidth = width ? "".concat(width, "px") : '100%';
|
|
22601
22680
|
var tableHeight = "".concat(height || 400, "px");
|
|
22602
22681
|
var rightAreaWidth = 'calc(100% - ' + "".concat(config.colHeaderWidth, "px") + ')';
|
|
@@ -22609,7 +22688,11 @@ var index$6 = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
22609
22688
|
className: 'editTableWrapper',
|
|
22610
22689
|
onScroll: onScroll,
|
|
22611
22690
|
ref: viewPort
|
|
22612
|
-
}, /*#__PURE__*/React.createElement(
|
|
22691
|
+
}, /*#__PURE__*/React.createElement(FixedScrollBar$1, {
|
|
22692
|
+
stickyProps: tableProps === null || tableProps === void 0 ? void 0 : tableProps.sticky,
|
|
22693
|
+
viewPort: viewPort,
|
|
22694
|
+
ref: topScrollBar
|
|
22695
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
22613
22696
|
style: {
|
|
22614
22697
|
width: "".concat(config.colHeaderWidth + 1 + placeholderWidth, "px"),
|
|
22615
22698
|
position: 'absolute',
|
|
@@ -31162,4 +31245,4 @@ var JsonQueryTable = /*#__PURE__*/React.memo(function (props) {
|
|
|
31162
31245
|
}, "setting"));
|
|
31163
31246
|
});
|
|
31164
31247
|
|
|
31165
|
-
export { AddSelect, AddSkcSelect, AddSkuSelect, AddSpuSelect, BillEntry, index$
|
|
31248
|
+
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 };
|
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
|
|
17
|
+
var isEqual = 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);
|
|
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,33 +153,6 @@ 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
|
-
}
|
|
183
156
|
function ownKeys(object, enumerableOnly) {
|
|
184
157
|
var keys = Object.keys(object);
|
|
185
158
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -336,9 +309,14 @@ function _regeneratorRuntime() {
|
|
|
336
309
|
};
|
|
337
310
|
}
|
|
338
311
|
function maybeInvokeDelegate(delegate, context) {
|
|
339
|
-
var
|
|
340
|
-
|
|
341
|
-
|
|
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
|
+
}
|
|
342
320
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
343
321
|
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
344
322
|
var info = record.arg;
|
|
@@ -552,7 +530,7 @@ function _defineProperties(target, props) {
|
|
|
552
530
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
553
531
|
descriptor.configurable = true;
|
|
554
532
|
if ("value" in descriptor) descriptor.writable = true;
|
|
555
|
-
Object.defineProperty(target,
|
|
533
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
556
534
|
}
|
|
557
535
|
}
|
|
558
536
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
@@ -564,7 +542,6 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
564
542
|
return Constructor;
|
|
565
543
|
}
|
|
566
544
|
function _defineProperty(obj, key, value) {
|
|
567
|
-
key = _toPropertyKey(key);
|
|
568
545
|
if (key in obj) {
|
|
569
546
|
Object.defineProperty(obj, key, {
|
|
570
547
|
value: value,
|
|
@@ -693,6 +670,30 @@ function _arrayWithHoles(arr) {
|
|
|
693
670
|
function _iterableToArray(iter) {
|
|
694
671
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
695
672
|
}
|
|
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
|
+
}
|
|
696
697
|
function _unsupportedIterableToArray(o, minLen) {
|
|
697
698
|
if (!o) return;
|
|
698
699
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -712,20 +713,6 @@ function _nonIterableSpread() {
|
|
|
712
713
|
function _nonIterableRest() {
|
|
713
714
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
714
715
|
}
|
|
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
|
-
}
|
|
729
716
|
|
|
730
717
|
var checkQuantityAccuracy = function checkQuantityAccuracy(value, accuracy, errorInfo) {
|
|
731
718
|
var errorMessage = _objectSpread2({
|
|
@@ -3693,52 +3680,41 @@ var setInitialShowColumn = function setInitialShowColumn(tableCode, columns, cal
|
|
|
3693
3680
|
callback(showColumns);
|
|
3694
3681
|
};
|
|
3695
3682
|
|
|
3696
|
-
var
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
function
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
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];
|
|
3717
3704
|
}
|
|
3718
|
-
return true;
|
|
3719
|
-
}
|
|
3720
3705
|
|
|
3721
|
-
|
|
3722
|
-
|
|
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;
|
|
3706
|
+
if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) {
|
|
3707
|
+
return lastResult;
|
|
3740
3708
|
}
|
|
3741
|
-
|
|
3709
|
+
|
|
3710
|
+
lastResult = resultFn.apply(this, newArgs);
|
|
3711
|
+
calledOnce = true;
|
|
3712
|
+
lastThis = this;
|
|
3713
|
+
lastArgs = newArgs;
|
|
3714
|
+
return lastResult;
|
|
3715
|
+
};
|
|
3716
|
+
|
|
3717
|
+
return result;
|
|
3742
3718
|
}
|
|
3743
3719
|
|
|
3744
3720
|
//! moment.js
|
|
@@ -9698,7 +9674,7 @@ var formatter = function formatter(data, parentAuthority, parentName) {
|
|
|
9698
9674
|
return item;
|
|
9699
9675
|
});
|
|
9700
9676
|
};
|
|
9701
|
-
var memoizeOneFormatter =
|
|
9677
|
+
var memoizeOneFormatter = index(formatter, isEqual__default['default']);
|
|
9702
9678
|
var go2BackAndClose = function go2BackAndClose() {
|
|
9703
9679
|
localStorage.setItem(ENUM.BROWSER_CACHE.CHILD_APP_BACK, 1);
|
|
9704
9680
|
umi.history.goBack();
|
|
@@ -15257,7 +15233,7 @@ var CommodityEntry = function CommodityEntry(props) {
|
|
|
15257
15233
|
* @LastEditTime: 2022-01-14 17:17:26
|
|
15258
15234
|
* @LastEditors: rodchen
|
|
15259
15235
|
*/
|
|
15260
|
-
var index = (function (storageKeyString) {
|
|
15236
|
+
var index$1 = (function (storageKeyString) {
|
|
15261
15237
|
var seconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
15262
15238
|
var tipsCallFunction = arguments.length > 2 ? arguments[2] : undefined;
|
|
15263
15239
|
if (typeof seconds !== 'number') throw new Error('seconds should be number');
|
|
@@ -15600,7 +15576,7 @@ var BusinessTreeSearchSelect = function BusinessTreeSearchSelect(props) {
|
|
|
15600
15576
|
}, [props === null || props === void 0 ? void 0 : props.value]);
|
|
15601
15577
|
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(MemoTreeSearchSelect, _objectSpread2({}, currentProps)));
|
|
15602
15578
|
};
|
|
15603
|
-
var index$
|
|
15579
|
+
var index$2 = /*#__PURE__*/React__default['default'].memo(BusinessTreeSearchSelect, function (props, nextProps) {
|
|
15604
15580
|
if (props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
|
|
15605
15581
|
return false;
|
|
15606
15582
|
}
|
|
@@ -15613,7 +15589,7 @@ var index$1 = /*#__PURE__*/React__default['default'].memo(BusinessTreeSearchSele
|
|
|
15613
15589
|
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";
|
|
15614
15590
|
styleInject(css_248z$8);
|
|
15615
15591
|
|
|
15616
|
-
var index$
|
|
15592
|
+
var index$3 = (function (props) {
|
|
15617
15593
|
var _props$formStatusMapp = props.formStatusMapping,
|
|
15618
15594
|
formStatusMapping = _props$formStatusMapp === void 0 ? [] : _props$formStatusMapp;
|
|
15619
15595
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -17037,7 +17013,7 @@ var iconMap = {
|
|
|
17037
17013
|
src: moreIcon
|
|
17038
17014
|
})
|
|
17039
17015
|
};
|
|
17040
|
-
var index$
|
|
17016
|
+
var index$4 = (function (props) {
|
|
17041
17017
|
var _useLocation = umi.useLocation(),
|
|
17042
17018
|
pathname = _useLocation.pathname;
|
|
17043
17019
|
var _useState = React.useState(pathname + 'id'),
|
|
@@ -17254,7 +17230,7 @@ var css_248z$d = ".home_page_head {\n height: 54px;\n display: flex;\n justif
|
|
|
17254
17230
|
styleInject(css_248z$d);
|
|
17255
17231
|
|
|
17256
17232
|
var _excluded$c = ["children"];
|
|
17257
|
-
var index$
|
|
17233
|
+
var index$5 = (function (props) {
|
|
17258
17234
|
var _useLocation = umi.useLocation(),
|
|
17259
17235
|
pathname = _useLocation.pathname;
|
|
17260
17236
|
var _useState = React.useState(pathname + 'id'),
|
|
@@ -22334,7 +22310,7 @@ var WrapperComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
22334
22310
|
}]);
|
|
22335
22311
|
return WrapperComponent;
|
|
22336
22312
|
}(React__default['default'].Component);
|
|
22337
|
-
var index$
|
|
22313
|
+
var index$6 = (function (props) {
|
|
22338
22314
|
var _useModel = umi.useModel('@@initialState'),
|
|
22339
22315
|
_useModel$initialStat = _useModel.initialState,
|
|
22340
22316
|
initialState = _useModel$initialStat === void 0 ? {} : _useModel$initialStat;
|
|
@@ -22477,7 +22453,105 @@ var headersToRows = function headersToRows(originColumns) {
|
|
|
22477
22453
|
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";
|
|
22478
22454
|
styleInject(css_248z$n);
|
|
22479
22455
|
|
|
22480
|
-
var
|
|
22456
|
+
var useSticky = function useSticky(sticky) {
|
|
22457
|
+
var _ref = _typeof(sticky) === 'object' ? sticky : {},
|
|
22458
|
+
_ref$getContainer = _ref.getContainer,
|
|
22459
|
+
getContainer = _ref$getContainer === void 0 ? function () {
|
|
22460
|
+
return window.document;
|
|
22461
|
+
} : _ref$getContainer;
|
|
22462
|
+
var container = getContainer();
|
|
22463
|
+
return React__default['default'].useMemo(function () {
|
|
22464
|
+
var isSticky = !!sticky;
|
|
22465
|
+
return {
|
|
22466
|
+
isSticky: isSticky,
|
|
22467
|
+
container: container
|
|
22468
|
+
};
|
|
22469
|
+
}, [sticky]);
|
|
22470
|
+
};
|
|
22471
|
+
|
|
22472
|
+
function getOffset(node) {
|
|
22473
|
+
var box = node.getBoundingClientRect();
|
|
22474
|
+
var docElem = document.documentElement;
|
|
22475
|
+
// < ie8 不支持 win.pageXOffset, 则使用 docElem.scrollLeft
|
|
22476
|
+
return {
|
|
22477
|
+
left: box.left + (window.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || document.body.clientLeft || 0),
|
|
22478
|
+
top: box.top + (window.pageYOffset || docElem.scrollTop) - (docElem.clientTop || document.body.clientTop || 0)
|
|
22479
|
+
};
|
|
22480
|
+
}
|
|
22481
|
+
var FixedScrollBar = function FixedScrollBar(_ref, ref) {
|
|
22482
|
+
var _viewPort$current, _viewPort$current2;
|
|
22483
|
+
var viewPort = _ref.viewPort,
|
|
22484
|
+
stickyProps = _ref.stickyProps;
|
|
22485
|
+
var _useSticky = useSticky(stickyProps),
|
|
22486
|
+
isSticky = _useSticky.isSticky,
|
|
22487
|
+
container = _useSticky.container;
|
|
22488
|
+
var _useState = React.useState({
|
|
22489
|
+
isHiddenScrollBar: !isSticky
|
|
22490
|
+
}),
|
|
22491
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
22492
|
+
scrollState = _useState2[0],
|
|
22493
|
+
setScrollState = _useState2[1];
|
|
22494
|
+
var onContainerScroll = function onContainerScroll() {
|
|
22495
|
+
if (!viewPort.current) {
|
|
22496
|
+
return;
|
|
22497
|
+
}
|
|
22498
|
+
var tableOffsetTop = getOffset(viewPort.current).top;
|
|
22499
|
+
var tableBottomOffset = tableOffsetTop + viewPort.current.offsetHeight;
|
|
22500
|
+
var currentClientOffset = document.documentElement.scrollTop + window.innerHeight;
|
|
22501
|
+
if (tableBottomOffset - 1 <= currentClientOffset || tableOffsetTop >= currentClientOffset) {
|
|
22502
|
+
setScrollState(function (state) {
|
|
22503
|
+
return _objectSpread2(_objectSpread2({}, state), {}, {
|
|
22504
|
+
isHiddenScrollBar: true
|
|
22505
|
+
});
|
|
22506
|
+
});
|
|
22507
|
+
} else {
|
|
22508
|
+
var _ref$current;
|
|
22509
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.scrollTo(viewPort.current.scrollLeft, 0);
|
|
22510
|
+
setScrollState(function (state) {
|
|
22511
|
+
return _objectSpread2(_objectSpread2({}, state), {}, {
|
|
22512
|
+
isHiddenScrollBar: false
|
|
22513
|
+
});
|
|
22514
|
+
});
|
|
22515
|
+
}
|
|
22516
|
+
};
|
|
22517
|
+
React.useEffect(function () {
|
|
22518
|
+
var onscroll = _.throttle(onContainerScroll, 50);
|
|
22519
|
+
container.addEventListener('scroll', onscroll);
|
|
22520
|
+
return function () {
|
|
22521
|
+
container.removeEventListener('scroll', onscroll);
|
|
22522
|
+
};
|
|
22523
|
+
}, []);
|
|
22524
|
+
if (scrollState.isHiddenScrollBar) {
|
|
22525
|
+
return null;
|
|
22526
|
+
}
|
|
22527
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
22528
|
+
ref: ref,
|
|
22529
|
+
onScroll: _.throttle(function (e) {
|
|
22530
|
+
// @ts-ignore
|
|
22531
|
+
viewPort.current.scrollTo(e.target.scrollLeft, 0);
|
|
22532
|
+
}, 50),
|
|
22533
|
+
style: {
|
|
22534
|
+
position: 'fixed',
|
|
22535
|
+
zIndex: '9999',
|
|
22536
|
+
bottom: '45px',
|
|
22537
|
+
overflowY: 'hidden',
|
|
22538
|
+
overflowX: 'auto',
|
|
22539
|
+
width: ((_viewPort$current = viewPort.current) === null || _viewPort$current === void 0 ? void 0 : _viewPort$current.offsetWidth) || 0,
|
|
22540
|
+
background: '#fff',
|
|
22541
|
+
opacity: 0.6
|
|
22542
|
+
}
|
|
22543
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
22544
|
+
className: 'ant-table-sticky-scroll-bar',
|
|
22545
|
+
style: {
|
|
22546
|
+
height: '1px',
|
|
22547
|
+
backgroundColor: '#fff',
|
|
22548
|
+
width: ((_viewPort$current2 = viewPort.current) === null || _viewPort$current2 === void 0 ? void 0 : _viewPort$current2.scrollWidth) || 0
|
|
22549
|
+
}
|
|
22550
|
+
}));
|
|
22551
|
+
};
|
|
22552
|
+
var FixedScrollBar$1 = /*#__PURE__*/React__default['default'].forwardRef(FixedScrollBar);
|
|
22553
|
+
|
|
22554
|
+
var index$7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
22481
22555
|
var _useState = React.useState(false),
|
|
22482
22556
|
_useState2 = _slicedToArray(_useState, 2),
|
|
22483
22557
|
show = _useState2[0],
|
|
@@ -22508,6 +22582,7 @@ var index$6 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
22508
22582
|
setViewCount = _useState10[1]; //虚拟表格每次渲染数量
|
|
22509
22583
|
var itemWidth = 100; // 表格每一项宽度
|
|
22510
22584
|
var viewPort = React.useRef(null);
|
|
22585
|
+
var topScrollBar = React.useRef(null);
|
|
22511
22586
|
//起始渲染item
|
|
22512
22587
|
var _useState11 = React.useState(0),
|
|
22513
22588
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
@@ -22529,6 +22604,9 @@ var index$6 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
22529
22604
|
setViewCount(viewCount);
|
|
22530
22605
|
}, []);
|
|
22531
22606
|
var onScroll = function onScroll() {
|
|
22607
|
+
if (topScrollBar.current) {
|
|
22608
|
+
topScrollBar.current.scrollTo(viewPort.current.scrollLeft, 0);
|
|
22609
|
+
}
|
|
22532
22610
|
var scrollWidth = viewPort.current.scrollLeft;
|
|
22533
22611
|
var startIndex = Math.floor(scrollWidth / itemWidth);
|
|
22534
22612
|
var offsetWidth = startIndex * itemWidth;
|
|
@@ -22614,7 +22692,8 @@ var index$6 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
22614
22692
|
// return <div>loading</div>;
|
|
22615
22693
|
// }
|
|
22616
22694
|
var width = props.width,
|
|
22617
|
-
height = props.height
|
|
22695
|
+
height = props.height,
|
|
22696
|
+
tableProps = props.tableProps;
|
|
22618
22697
|
var tableWidth = width ? "".concat(width, "px") : '100%';
|
|
22619
22698
|
var tableHeight = "".concat(height || 400, "px");
|
|
22620
22699
|
var rightAreaWidth = 'calc(100% - ' + "".concat(config.colHeaderWidth, "px") + ')';
|
|
@@ -22627,7 +22706,11 @@ var index$6 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
22627
22706
|
className: 'editTableWrapper',
|
|
22628
22707
|
onScroll: onScroll,
|
|
22629
22708
|
ref: viewPort
|
|
22630
|
-
}, /*#__PURE__*/React__default['default'].createElement(
|
|
22709
|
+
}, /*#__PURE__*/React__default['default'].createElement(FixedScrollBar$1, {
|
|
22710
|
+
stickyProps: tableProps === null || tableProps === void 0 ? void 0 : tableProps.sticky,
|
|
22711
|
+
viewPort: viewPort,
|
|
22712
|
+
ref: topScrollBar
|
|
22713
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
22631
22714
|
style: {
|
|
22632
22715
|
width: "".concat(config.colHeaderWidth + 1 + placeholderWidth, "px"),
|
|
22633
22716
|
position: 'absolute',
|
|
@@ -31185,24 +31268,24 @@ exports.AddSkcSelect = AddSkcSelect;
|
|
|
31185
31268
|
exports.AddSkuSelect = AddSkuSelect;
|
|
31186
31269
|
exports.AddSpuSelect = AddSpuSelect;
|
|
31187
31270
|
exports.BillEntry = BillEntry;
|
|
31188
|
-
exports.BsLayout = index$
|
|
31271
|
+
exports.BsLayout = index$6;
|
|
31189
31272
|
exports.BsSulaQueryTable = BsSulaQueryTable;
|
|
31190
31273
|
exports.BusinessSearchSelect = BusinessSearchSelect$1;
|
|
31191
|
-
exports.BusinessTreeSearchSelect = index$
|
|
31192
|
-
exports.CheckOneUser = index;
|
|
31274
|
+
exports.BusinessTreeSearchSelect = index$2;
|
|
31275
|
+
exports.CheckOneUser = index$1;
|
|
31193
31276
|
exports.ColumnSettingTable = ColumnSettingTable;
|
|
31194
31277
|
exports.CommodityEntry = CommodityEntry;
|
|
31195
31278
|
exports.DataImport = DataImport;
|
|
31196
31279
|
exports.DataValidation = DataValidation;
|
|
31197
|
-
exports.DetailPageWrapper = index$
|
|
31280
|
+
exports.DetailPageWrapper = index$4;
|
|
31198
31281
|
exports.ExportIcon = ExportIcon;
|
|
31199
31282
|
exports.GuideWrapper = GuideWrapper;
|
|
31200
|
-
exports.HomePageWrapper = index$
|
|
31283
|
+
exports.HomePageWrapper = index$5;
|
|
31201
31284
|
exports.JsonQueryTable = JsonQueryTable;
|
|
31202
|
-
exports.MoreTreeTable = index$
|
|
31285
|
+
exports.MoreTreeTable = index$7;
|
|
31203
31286
|
exports.QueryMutipleInput = QueryMutipleInput;
|
|
31204
31287
|
exports.SearchSelect = SearchSelect;
|
|
31205
|
-
exports.StateFlow = index$
|
|
31288
|
+
exports.StateFlow = index$3;
|
|
31206
31289
|
exports.SulaColumnSettingTable = ColumnSettingSulaTable;
|
|
31207
31290
|
exports.TableColumnSetting = TableColumnSetting;
|
|
31208
31291
|
exports.TreeSearchSelect = TreeSearchSelect;
|
package/package.json
CHANGED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React, {useEffect, useImperativeHandle, useRef, useState} from 'react'
|
|
2
|
+
import {throttle} from "lodash";
|
|
3
|
+
import useSticky from "./hooks/useSticky";
|
|
4
|
+
|
|
5
|
+
function getOffset(node: any) {
|
|
6
|
+
const box = node.getBoundingClientRect();
|
|
7
|
+
const docElem = document.documentElement;
|
|
8
|
+
// < ie8 不支持 win.pageXOffset, 则使用 docElem.scrollLeft
|
|
9
|
+
return {
|
|
10
|
+
left: box.left + (window.pageXOffset || docElem.scrollLeft) -
|
|
11
|
+
(docElem.clientLeft || document.body.clientLeft || 0),
|
|
12
|
+
top: box.top + (window.pageYOffset || docElem.scrollTop) -
|
|
13
|
+
(docElem.clientTop || document.body.clientTop || 0),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const FixedScrollBar = ({viewPort, stickyProps}: any, ref: any) => {
|
|
18
|
+
const {isSticky, container} = useSticky(stickyProps)
|
|
19
|
+
const [scrollState, setScrollState] = useState({
|
|
20
|
+
isHiddenScrollBar: !isSticky
|
|
21
|
+
})
|
|
22
|
+
const onContainerScroll = () => {
|
|
23
|
+
if (!viewPort.current) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const tableOffsetTop = getOffset(viewPort.current).top;
|
|
27
|
+
const tableBottomOffset = tableOffsetTop + viewPort.current.offsetHeight;
|
|
28
|
+
const currentClientOffset = document.documentElement.scrollTop + window.innerHeight
|
|
29
|
+
if (
|
|
30
|
+
tableBottomOffset - 1 <= currentClientOffset ||
|
|
31
|
+
tableOffsetTop >= currentClientOffset
|
|
32
|
+
) {
|
|
33
|
+
setScrollState(state => ({
|
|
34
|
+
...state,
|
|
35
|
+
isHiddenScrollBar: true,
|
|
36
|
+
}));
|
|
37
|
+
} else {
|
|
38
|
+
ref.current?.scrollTo(viewPort.current.scrollLeft, 0)
|
|
39
|
+
setScrollState(state => ({
|
|
40
|
+
...state,
|
|
41
|
+
isHiddenScrollBar: false,
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const onscroll = throttle(onContainerScroll, 50)
|
|
48
|
+
container.addEventListener('scroll', onscroll)
|
|
49
|
+
return () => {
|
|
50
|
+
container.removeEventListener('scroll', onscroll)
|
|
51
|
+
}
|
|
52
|
+
},[])
|
|
53
|
+
|
|
54
|
+
if(scrollState.isHiddenScrollBar){
|
|
55
|
+
return null
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div
|
|
60
|
+
ref={ref}
|
|
61
|
+
onScroll={throttle((e) => {
|
|
62
|
+
// @ts-ignore
|
|
63
|
+
viewPort.current.scrollTo(e.target.scrollLeft, 0)
|
|
64
|
+
}, 50)}
|
|
65
|
+
style={{
|
|
66
|
+
position:'fixed',
|
|
67
|
+
zIndex: '9999',
|
|
68
|
+
bottom: '45px',
|
|
69
|
+
overflowY: 'hidden',
|
|
70
|
+
overflowX: 'auto',
|
|
71
|
+
width: viewPort.current?.offsetWidth || 0,
|
|
72
|
+
background:'#fff',
|
|
73
|
+
opacity: 0.6,
|
|
74
|
+
}}>
|
|
75
|
+
<div
|
|
76
|
+
className={'ant-table-sticky-scroll-bar'}
|
|
77
|
+
style={{
|
|
78
|
+
height: '1px',
|
|
79
|
+
backgroundColor: '#fff',
|
|
80
|
+
width: viewPort.current?.scrollWidth || 0,
|
|
81
|
+
}}></div>
|
|
82
|
+
</div>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export default React.forwardRef(FixedScrollBar)
|
|
@@ -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
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import React, { useState, useEffect, useImperativeHandle, forwardRef, useMemo, useRef } from 'react';
|
|
3
3
|
import { getAllColumns, convertToRows, headersToRows } from './utils';
|
|
4
4
|
import './index.less';
|
|
5
|
+
import FixedScrollBar from "./FixedScrollBar";
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
export default forwardRef((props, ref) => {
|
|
@@ -21,10 +22,11 @@ export default forwardRef((props, ref) => {
|
|
|
21
22
|
const itemWidth = 100; // 表格每一项宽度
|
|
22
23
|
|
|
23
24
|
const viewPort = useRef(null);
|
|
25
|
+
const topScrollBar = useRef(null)
|
|
24
26
|
|
|
25
27
|
//起始渲染item
|
|
26
28
|
const [startIndex, setStartIndex] = useState(0);
|
|
27
|
-
|
|
29
|
+
|
|
28
30
|
//结束渲染item
|
|
29
31
|
const endIndex = useMemo(() => {
|
|
30
32
|
return startIndex + viewCount;
|
|
@@ -41,6 +43,9 @@ export default forwardRef((props, ref) => {
|
|
|
41
43
|
}, [])
|
|
42
44
|
|
|
43
45
|
const onScroll = () => {
|
|
46
|
+
if(topScrollBar.current){
|
|
47
|
+
topScrollBar.current.scrollTo(viewPort.current.scrollLeft, 0)
|
|
48
|
+
}
|
|
44
49
|
const scrollWidth = viewPort.current.scrollLeft;
|
|
45
50
|
const startIndex = Math.floor(scrollWidth/itemWidth);
|
|
46
51
|
const offsetWidth = startIndex * itemWidth;
|
|
@@ -134,8 +139,8 @@ export default forwardRef((props, ref) => {
|
|
|
134
139
|
// if (!show) {
|
|
135
140
|
// return <div>loading</div>;
|
|
136
141
|
// }
|
|
137
|
-
|
|
138
|
-
const {width, height } = props;
|
|
142
|
+
|
|
143
|
+
const {width, height, tableProps } = props;
|
|
139
144
|
let tableWidth = width ? `${width}px` : '100%';
|
|
140
145
|
let tableHeight = `${height || 400}px`;
|
|
141
146
|
const rightAreaWidth = 'calc(100% - ' + `${config.colHeaderWidth}px` + ')';
|
|
@@ -147,6 +152,11 @@ export default forwardRef((props, ref) => {
|
|
|
147
152
|
onScroll={onScroll}
|
|
148
153
|
ref={viewPort}
|
|
149
154
|
>
|
|
155
|
+
<FixedScrollBar
|
|
156
|
+
stickyProps={tableProps?.sticky}
|
|
157
|
+
viewPort={viewPort}
|
|
158
|
+
ref={topScrollBar}
|
|
159
|
+
/>
|
|
150
160
|
<div style={{
|
|
151
161
|
width: `${config.colHeaderWidth + 1 + placeholderWidth}px`,
|
|
152
162
|
position: 'absolute',
|