@kdcloudjs/table 1.2.2-canary.10 → 1.2.2-canary.11-hotfix.0
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/LICENSE +568 -568
- package/README.md +111 -111
- package/dist/@kdcloudjs/table.css +1 -1
- package/dist/@kdcloudjs/table.js +3306 -3341
- package/dist/@kdcloudjs/table.js.map +1 -1
- package/dist/@kdcloudjs/table.min.css +1 -1
- package/dist/@kdcloudjs/table.min.js +11 -13
- package/dist/@kdcloudjs/table.min.js.map +1 -1
- package/dist/kd-ui-complete.less +777 -777
- package/es/_utils/formatUtil.js +5 -1
- package/es/_utils/hooks.js +3 -3
- package/es/_utils/usePopper.js +13 -13
- package/es/locale/locale.js +7 -6
- package/es/style/color/colors.less +1 -1
- package/es/style/core/index.less +1 -1
- package/es/style/core/motion/other.less +27 -27
- package/es/style/core/motion/slide.less +53 -53
- package/es/style/core/motion.less +1 -1
- package/es/style/core/reset.less +185 -185
- package/es/style/index.less +1 -1
- package/es/style/mixins/index.less +18 -18
- package/es/style/mixins/overlay.less +21 -21
- package/es/style/mixins/reset.less +12 -12
- package/es/style/themes/default.less +445 -445
- package/es/table/base/BlankComponent.d.ts +11 -0
- package/es/table/base/BlankComponent.js +61 -0
- package/es/table/base/calculations.js +3 -3
- package/es/table/base/empty.js +2 -2
- package/es/table/base/globalStyleComponent.js +8 -6
- package/es/table/base/header.js +7 -5
- package/es/table/base/helpers/FastScrollManager.d.ts +96 -0
- package/es/table/base/helpers/FastScrollManager.js +167 -0
- package/es/table/base/helpers/SpanManager.js +2 -1
- package/es/table/base/helpers/TableDOMUtils.js +6 -5
- package/es/table/base/html-table.js +4 -3
- package/es/table/base/loading.js +2 -2
- package/es/table/base/renderTemplates.js +16 -16
- package/es/table/base/styles.js +1 -1
- package/es/table/base/table.d.ts +13 -0
- package/es/table/base/table.js +141 -84
- package/es/table/base/utils.js +3 -3
- package/es/table/pipeline/features/columnDrag.js +1 -0
- package/es/table/pipeline/features/columnFilter.js +3 -1
- package/es/table/pipeline/features/columnResizeWidth.js +2 -2
- package/es/table/pipeline/features/contextMenu.js +6 -4
- package/es/table/pipeline/features/featureApi/RowDragApi.js +2 -1
- package/es/table/pipeline/features/filter/DefaultFilterContent.js +5 -4
- package/es/table/pipeline/features/filter/Filter.js +3 -2
- package/es/table/pipeline/features/rangeSelection.js +10 -10
- package/es/table/pipeline/features/rowDetail.js +2 -2
- package/es/table/pipeline/features/rowDrag.js +2 -1
- package/es/table/pipeline/features/rowGrouping.js +2 -2
- package/es/table/pipeline/features/sort.js +7 -6
- package/es/table/pipeline/features/tips.js +4 -4
- package/es/table/pipeline/features/treeMode.js +5 -5
- package/es/table/pipeline/features/treeSelect.js +2 -2
- package/es/table/pipeline/pipeline.js +2 -1
- package/es/table/pivot/cross-table/buildCrossTable.js +8 -6
- package/es/table/pivot/cross-table/cross-table.js +3 -1
- package/es/table/pivot/cross-tree-table/buildCrossTreeTable.js +10 -8
- package/es/table/pivot/cross-tree-table/cross-tree-table.js +11 -8
- package/es/table/pivot/pivot-utils/builders.js +3 -3
- package/es/table/pivot/pivot-utils/convert-utils.js +3 -3
- package/es/table/style/index.less +1 -1
- package/es/table/transforms/autoWidth.js +3 -3
- package/es/table/transforms/columnResize.js +5 -3
- package/es/table/transforms/sort.js +8 -6
- package/es/table/transforms/tips.js +4 -4
- package/es/table/transforms/treeMode.js +8 -6
- package/es/table/utils/buildTree.js +3 -3
- package/es/table/utils/collectNodes.js +3 -3
- package/es/table/utils/exportTableAsExcel.js +3 -3
- package/es/table/utils/getTreeDepth.js +3 -3
- package/es/table/utils/groupBy.js +3 -3
- package/es/table/utils/makeRecursiveMapper.js +3 -3
- package/es/table/utils/mergeCellProps.js +1 -0
- package/es/table/utils/others.js +3 -3
- package/es/table/utils/traverseColumn.js +3 -3
- package/es/table/utils/tree-data-helpers/StrictTreeDataHelper.js +8 -7
- package/es/table/utils/tree-data-helpers/TreeDataHelper.js +5 -4
- package/lib/_utils/arrayUtil.js +3 -2
- package/lib/_utils/formatUtil.js +5 -1
- package/lib/_utils/hooks.js +3 -3
- package/lib/_utils/index.js +3 -2
- package/lib/_utils/type.js +5 -3
- package/lib/_utils/usePopper.js +21 -18
- package/lib/config-provider/ConfigContext.js +2 -1
- package/lib/config-provider/compDefaultProps.js +2 -1
- package/lib/config-provider/configProvider.js +4 -3
- package/lib/config-provider/defaultConfig.js +2 -1
- package/lib/config-provider/index.js +2 -1
- package/lib/locale/index.js +4 -3
- package/lib/locale/locale.js +14 -10
- package/lib/locale/zh-CN.js +2 -1
- package/lib/style/color/colors.less +1 -1
- package/lib/style/components.less +1 -1
- package/lib/style/core/index.less +1 -1
- package/lib/style/core/motion/other.less +27 -27
- package/lib/style/core/motion/slide.less +53 -53
- package/lib/style/core/motion.less +1 -1
- package/lib/style/core/reset.less +185 -185
- package/lib/style/index.less +1 -1
- package/lib/style/mixins/index.less +18 -18
- package/lib/style/mixins/overlay.less +21 -21
- package/lib/style/mixins/reset.less +12 -12
- package/lib/style/themes/default.less +445 -445
- package/lib/table/base/BlankComponent.d.ts +11 -0
- package/lib/table/base/BlankComponent.js +75 -0
- package/lib/table/base/calculations.js +3 -3
- package/lib/table/base/empty.js +4 -4
- package/lib/table/base/globalStyleComponent.js +13 -10
- package/lib/table/base/header.js +7 -5
- package/lib/table/base/helpers/FastScrollManager.d.ts +96 -0
- package/lib/table/base/helpers/FastScrollManager.js +175 -0
- package/lib/table/base/helpers/SpanManager.js +5 -3
- package/lib/table/base/helpers/TableDOMUtils.js +9 -7
- package/lib/table/base/helpers/getRichVisibleRectsStream.js +2 -2
- package/lib/table/base/html-table.js +4 -3
- package/lib/table/base/loading.js +2 -2
- package/lib/table/base/renderTemplates.js +18 -18
- package/lib/table/base/styles.js +18 -10
- package/lib/table/base/table.d.ts +13 -0
- package/lib/table/base/table.js +152 -96
- package/lib/table/base/utils.js +20 -13
- package/lib/table/common-views.js +8 -4
- package/lib/table/internals.js +3 -2
- package/lib/table/pipeline/const.js +3 -2
- package/lib/table/pipeline/features/autoFill.js +6 -3
- package/lib/table/pipeline/features/colGroupExtendable.js +3 -2
- package/lib/table/pipeline/features/columnDrag.js +1 -0
- package/lib/table/pipeline/features/columnFilter.js +3 -1
- package/lib/table/pipeline/features/columnResizeWidth.js +10 -7
- package/lib/table/pipeline/features/contextMenu.js +8 -6
- package/lib/table/pipeline/features/featureApi/RowDragApi.js +5 -3
- package/lib/table/pipeline/features/filter/DefaultFilterContent.js +9 -7
- package/lib/table/pipeline/features/filter/Filter.js +7 -5
- package/lib/table/pipeline/features/filter/FilterPanel.js +4 -3
- package/lib/table/pipeline/features/filter/util.js +3 -2
- package/lib/table/pipeline/features/footerDataSource.js +2 -1
- package/lib/table/pipeline/features/rangeSelection.js +14 -12
- package/lib/table/pipeline/features/rowDetail.js +2 -2
- package/lib/table/pipeline/features/rowDrag.js +8 -4
- package/lib/table/pipeline/features/rowGrouping.js +2 -2
- package/lib/table/pipeline/features/sort.js +7 -6
- package/lib/table/pipeline/features/tips.js +4 -4
- package/lib/table/pipeline/features/treeMode.js +9 -7
- package/lib/table/pipeline/features/treeSelect.js +2 -2
- package/lib/table/pipeline/index.js +2 -2
- package/lib/table/pipeline/pipeline.js +4 -2
- package/lib/table/pivot/cross-table/buildCrossTable.js +8 -6
- package/lib/table/pivot/cross-table/constants.js +2 -1
- package/lib/table/pivot/cross-table/cross-table.js +6 -3
- package/lib/table/pivot/cross-tree-table/buildCrossTreeTable.js +10 -8
- package/lib/table/pivot/cross-tree-table/cross-tree-table.js +13 -9
- package/lib/table/pivot/pivot-utils/builders.js +3 -3
- package/lib/table/pivot/pivot-utils/convert-utils.js +3 -3
- package/lib/table/style/index.less +1 -1
- package/lib/table/transforms/autoWidth.js +5 -5
- package/lib/table/transforms/columnResize.js +7 -5
- package/lib/table/transforms/sort.js +10 -8
- package/lib/table/transforms/tips.js +4 -4
- package/lib/table/transforms/treeMode.js +10 -8
- package/lib/table/use/useResizeObserver.js +2 -1
- package/lib/table/utils/browserType.js +4 -2
- package/lib/table/utils/buildTree.js +3 -3
- package/lib/table/utils/collectNodes.js +3 -3
- package/lib/table/utils/console.js +3 -2
- package/lib/table/utils/copyToClipboard.js +2 -1
- package/lib/table/utils/exportTableAsExcel.js +3 -3
- package/lib/table/utils/getTreeDepth.js +3 -3
- package/lib/table/utils/groupBy.js +3 -3
- package/lib/table/utils/keyCode.js +2 -1
- package/lib/table/utils/makeRecursiveMapper.js +3 -3
- package/lib/table/utils/mergeCellProps.js +1 -0
- package/lib/table/utils/others.js +5 -4
- package/lib/table/utils/proto.js +2 -1
- package/lib/table/utils/selectColumn.js +4 -2
- package/lib/table/utils/traverseColumn.js +3 -3
- package/lib/table/utils/tree-data-helpers/StrictTreeDataHelper.js +11 -9
- package/lib/table/utils/tree-data-helpers/TreeDataHelper.js +8 -6
- package/package.json +218 -218
package/es/table/base/table.js
CHANGED
|
@@ -7,17 +7,17 @@ import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
|
7
7
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
8
8
|
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
9
9
|
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
10
|
+
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
10
11
|
import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
|
|
11
12
|
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
function
|
|
15
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
13
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
14
|
+
function _unsupportedIterableToArray(o, minLen) { var _context2; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context2 = Object.prototype.toString.call(o)).call(_context2, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
16
16
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
17
17
|
import _flatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/flat";
|
|
18
18
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
19
|
-
function
|
|
20
|
-
function _isNativeReflectConstruct() {
|
|
19
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
20
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
21
21
|
import cx from 'classnames';
|
|
22
22
|
import React from 'react';
|
|
23
23
|
import { BehaviorSubject, combineLatest, noop, Subscription, Subject, from } from 'rxjs';
|
|
@@ -28,6 +28,7 @@ import TableHeader from './header';
|
|
|
28
28
|
import { getRichVisibleRectsStream } from './helpers/getRichVisibleRectsStream';
|
|
29
29
|
import { getFullRenderRange, makeRowHeightManager } from './helpers/rowHeightManager';
|
|
30
30
|
import { TableDOMHelper } from './helpers/TableDOMUtils';
|
|
31
|
+
import { FastScrollManager } from './helpers/FastScrollManager';
|
|
31
32
|
import { HtmlTable } from './html-table';
|
|
32
33
|
import Loading from './loading';
|
|
33
34
|
import { Classes, LOCK_SHADOW_PADDING, StyledArtTableWrapper } from './styles';
|
|
@@ -35,6 +36,7 @@ import GlobalStyleComponent from './globalStyleComponent';
|
|
|
35
36
|
import { addResizeObserver, getScrollbarSize, OVERSCAN_SIZE, shallowEqual, STYLED_REF_PROP, sum, syncScrollLeft, throttledWindowResize$, getTableScrollFooterDOM, getTableScrollHeaderDOM, cssPolifill } from './utils';
|
|
36
37
|
import { console, browserType, isStickyUIDegrade } from '../utils';
|
|
37
38
|
import getTableRenderTemplate from './renderTemplates';
|
|
39
|
+
import { TopBlank, BottomBlank } from './BlankComponent';
|
|
38
40
|
var propsDotEmptyContentDeprecatedWarned = false;
|
|
39
41
|
function warnPropsDotEmptyContentIsDeprecated() {
|
|
40
42
|
if (!propsDotEmptyContentDeprecatedWarned) {
|
|
@@ -43,14 +45,19 @@ function warnPropsDotEmptyContentIsDeprecated() {
|
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
48
|
+
_inherits(BaseTable, _React$Component);
|
|
49
|
+
var _super = _createSuper(BaseTable);
|
|
46
50
|
function BaseTable(props) {
|
|
47
51
|
var _this;
|
|
48
52
|
_classCallCheck(this, BaseTable);
|
|
49
|
-
_this =
|
|
53
|
+
_this = _super.call(this, props);
|
|
50
54
|
_this.rowHeightManager = makeRowHeightManager(_this.props.dataSource.length, _this.props.estimatedRowHeight);
|
|
51
55
|
_this.artTableWrapperRef = /*#__PURE__*/React.createRef();
|
|
52
56
|
_this.hasScrollY = false;
|
|
53
57
|
_this.offsetY = 0;
|
|
58
|
+
// Blank组件的引用,用于快速滚动时直接更新
|
|
59
|
+
_this.topBlankRef = /*#__PURE__*/React.createRef();
|
|
60
|
+
_this.bottomBlankRef = /*#__PURE__*/React.createRef();
|
|
54
61
|
_this.handleRowMouseEnter = function (e) {
|
|
55
62
|
var nodeList = _this.domHelper.getRowNodeListByEvent(e);
|
|
56
63
|
nodeList && nodeList.forEach(function (node) {
|
|
@@ -70,8 +77,7 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
70
77
|
getRowProps = _this$props.getRowProps,
|
|
71
78
|
primaryKey = _this$props.primaryKey,
|
|
72
79
|
isLoading = _this$props.isLoading,
|
|
73
|
-
emptyCellHeight = _this$props.emptyCellHeight
|
|
74
|
-
footerDataSource = _this$props.footerDataSource;
|
|
80
|
+
emptyCellHeight = _this$props.emptyCellHeight;
|
|
75
81
|
var tableBodyClassName = cx(Classes.tableBody, Classes.horizontalScrollContainer);
|
|
76
82
|
// 低版本Edge浏览器下也会出现双滚动条,这里设置overflow: 'hidden',先去掉edge的方向键控制滚动条的功能
|
|
77
83
|
var virtualStyle = browserType.isIE || browserType.isEdge ? {
|
|
@@ -121,13 +127,10 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
121
127
|
className: Classes.virtual,
|
|
122
128
|
tabIndex: -1,
|
|
123
129
|
style: virtualStyle
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
height: topBlank
|
|
129
|
-
}
|
|
130
|
-
})), /*#__PURE__*/React.createElement(HtmlTable, {
|
|
130
|
+
}, /*#__PURE__*/React.createElement(TopBlank, {
|
|
131
|
+
ref: _this.topBlankRef,
|
|
132
|
+
height: topBlank
|
|
133
|
+
}), /*#__PURE__*/React.createElement(HtmlTable, {
|
|
131
134
|
tbodyHtmlTag: "tbody",
|
|
132
135
|
getRowProps: getRowProps,
|
|
133
136
|
primaryKey: primaryKey,
|
|
@@ -139,13 +142,10 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
139
142
|
limit: bottomIndex,
|
|
140
143
|
last: dataSource.length - 1
|
|
141
144
|
}
|
|
142
|
-
}),
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
height: bottomBlank
|
|
147
|
-
}
|
|
148
|
-
}))));
|
|
145
|
+
}), /*#__PURE__*/React.createElement(BottomBlank, {
|
|
146
|
+
ref: _this.bottomBlankRef,
|
|
147
|
+
height: bottomBlank
|
|
148
|
+
})));
|
|
149
149
|
};
|
|
150
150
|
_this.state = {
|
|
151
151
|
hasScroll: true,
|
|
@@ -159,11 +159,30 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
159
159
|
maxRenderHeight: 600,
|
|
160
160
|
maxRenderWidth: 800
|
|
161
161
|
};
|
|
162
|
+
// 初始化快速滚动管理器
|
|
163
|
+
var fastScrollCallbacks = {
|
|
164
|
+
onFastScrollStart: function onFastScrollStart(renderData) {
|
|
165
|
+
_this.setState({
|
|
166
|
+
previousRenderData: renderData
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
onFastScrollEnd: function onFastScrollEnd(scrollData) {
|
|
170
|
+
_this.setState({
|
|
171
|
+
previousRenderData: undefined,
|
|
172
|
+
offsetY: scrollData.offsetY,
|
|
173
|
+
maxRenderHeight: scrollData.maxRenderHeight,
|
|
174
|
+
maxRenderWidth: scrollData.maxRenderWidth
|
|
175
|
+
});
|
|
176
|
+
},
|
|
177
|
+
getCurrentRenderRange: function getCurrentRenderRange(offsetY, maxRenderHeight, dataLength) {
|
|
178
|
+
return _this.rowHeightManager.getRenderRange(offsetY, maxRenderHeight, dataLength);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
_this.fastScrollManager = new FastScrollManager(fastScrollCallbacks);
|
|
162
182
|
return _this;
|
|
163
183
|
}
|
|
164
184
|
/** @deprecated BaseTable.getDoms() 已经过时,请勿调用 */
|
|
165
|
-
|
|
166
|
-
return _createClass(BaseTable, [{
|
|
185
|
+
_createClass(BaseTable, [{
|
|
167
186
|
key: "getDoms",
|
|
168
187
|
value: function getDoms() {
|
|
169
188
|
console.warn('[kd-table] BaseTable.getDoms() 已经过时');
|
|
@@ -305,11 +324,18 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
305
324
|
}, {
|
|
306
325
|
key: "getVerticalRenderRange",
|
|
307
326
|
value: function getVerticalRenderRange(useVirtual) {
|
|
308
|
-
var
|
|
327
|
+
var _this$props4 = this.props,
|
|
328
|
+
dataSource = _this$props4.dataSource,
|
|
329
|
+
isLowPerformance = _this$props4.isLowPerformance;
|
|
309
330
|
var _this$state = this.state,
|
|
310
331
|
offsetY = _this$state.offsetY,
|
|
311
|
-
maxRenderHeight = _this$state.maxRenderHeight
|
|
332
|
+
maxRenderHeight = _this$state.maxRenderHeight,
|
|
333
|
+
previousRenderData = _this$state.previousRenderData;
|
|
312
334
|
var rowCount = dataSource.length;
|
|
335
|
+
// 只有在启用快速滚动时才使用 FastScrollManager 的判断
|
|
336
|
+
if (isLowPerformance && this.fastScrollManager.getIsFastScrolling() && (previousRenderData === null || previousRenderData === void 0 ? void 0 : previousRenderData.verticalRenderRange)) {
|
|
337
|
+
return previousRenderData.verticalRenderRange;
|
|
338
|
+
}
|
|
313
339
|
if (useVirtual.vertical) {
|
|
314
340
|
return this.rowHeightManager.getRenderRange(offsetY, maxRenderHeight, rowCount);
|
|
315
341
|
} else {
|
|
@@ -320,12 +346,12 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
320
346
|
key: "renderTableFooter",
|
|
321
347
|
value: function renderTableFooter(info) {
|
|
322
348
|
// console.log('render footer')
|
|
323
|
-
var _this$
|
|
324
|
-
_this$
|
|
325
|
-
footerDataSource = _this$
|
|
326
|
-
getRowProps = _this$
|
|
327
|
-
primaryKey = _this$
|
|
328
|
-
stickyBottom = _this$
|
|
349
|
+
var _this$props5 = this.props,
|
|
350
|
+
_this$props5$footerDa = _this$props5.footerDataSource,
|
|
351
|
+
footerDataSource = _this$props5$footerDa === void 0 ? [] : _this$props5$footerDa,
|
|
352
|
+
getRowProps = _this$props5.getRowProps,
|
|
353
|
+
primaryKey = _this$props5.primaryKey,
|
|
354
|
+
stickyBottom = _this$props5.stickyBottom;
|
|
329
355
|
var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0;
|
|
330
356
|
var renderFooter = getTableRenderTemplate('footer');
|
|
331
357
|
if (typeof renderFooter === 'function') {
|
|
@@ -390,9 +416,9 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
390
416
|
key: "renderStickyScroll",
|
|
391
417
|
value: function renderStickyScroll(info) {
|
|
392
418
|
// console.log('render stickyscroll')
|
|
393
|
-
var _this$
|
|
394
|
-
hasStickyScroll = _this$
|
|
395
|
-
stickyBottom = _this$
|
|
419
|
+
var _this$props6 = this.props,
|
|
420
|
+
hasStickyScroll = _this$props6.hasStickyScroll,
|
|
421
|
+
stickyBottom = _this$props6.stickyBottom;
|
|
396
422
|
var hasScroll = this.state.hasScroll;
|
|
397
423
|
var isScroll = hasStickyScroll && hasScroll;
|
|
398
424
|
var stickyScrollContainerStyle = this.getStickyScrollContainerStyle();
|
|
@@ -429,9 +455,9 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
429
455
|
}, {
|
|
430
456
|
key: "getStickyScrollContainerStyle",
|
|
431
457
|
value: function getStickyScrollContainerStyle() {
|
|
432
|
-
var _this$
|
|
433
|
-
hasStickyScroll = _this$
|
|
434
|
-
stickyScrollHeight = _this$
|
|
458
|
+
var _this$props7 = this.props,
|
|
459
|
+
hasStickyScroll = _this$props7.hasStickyScroll,
|
|
460
|
+
stickyScrollHeight = _this$props7.stickyScrollHeight;
|
|
435
461
|
var hasScroll = this.state.hasScroll;
|
|
436
462
|
var isScroll = hasStickyScroll && hasScroll;
|
|
437
463
|
var height = stickyScrollHeight === 'auto' ? this.getScrollBarWidth() : stickyScrollHeight;
|
|
@@ -445,24 +471,25 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
445
471
|
}, {
|
|
446
472
|
key: "render",
|
|
447
473
|
value: function render() {
|
|
474
|
+
var _cx;
|
|
448
475
|
// console.log('render table')
|
|
449
476
|
var info = calculateRenderInfo(this);
|
|
450
477
|
this.lastInfo = info;
|
|
451
|
-
var _this$
|
|
452
|
-
dataSource = _this$
|
|
453
|
-
className = _this$
|
|
454
|
-
style = _this$
|
|
455
|
-
hasHeader = _this$
|
|
456
|
-
useOuterBorder = _this$
|
|
457
|
-
isStickyHead = _this$
|
|
458
|
-
isStickyHeader = _this$
|
|
459
|
-
isStickyFooter = _this$
|
|
460
|
-
isLoading = _this$
|
|
461
|
-
getTableProps = _this$
|
|
462
|
-
footerDataSource = _this$
|
|
463
|
-
components = _this$
|
|
464
|
-
bordered = _this$
|
|
465
|
-
var artTableWrapperClassName = cx(Classes.artTableWrapper,
|
|
478
|
+
var _this$props8 = this.props,
|
|
479
|
+
dataSource = _this$props8.dataSource,
|
|
480
|
+
className = _this$props8.className,
|
|
481
|
+
style = _this$props8.style,
|
|
482
|
+
hasHeader = _this$props8.hasHeader,
|
|
483
|
+
useOuterBorder = _this$props8.useOuterBorder,
|
|
484
|
+
isStickyHead = _this$props8.isStickyHead,
|
|
485
|
+
isStickyHeader = _this$props8.isStickyHeader,
|
|
486
|
+
isStickyFooter = _this$props8.isStickyFooter,
|
|
487
|
+
isLoading = _this$props8.isLoading,
|
|
488
|
+
getTableProps = _this$props8.getTableProps,
|
|
489
|
+
footerDataSource = _this$props8.footerDataSource,
|
|
490
|
+
components = _this$props8.components,
|
|
491
|
+
bordered = _this$props8.bordered;
|
|
492
|
+
var artTableWrapperClassName = cx(Classes.artTableWrapper, (_cx = {
|
|
466
493
|
'use-outer-border': useOuterBorder,
|
|
467
494
|
empty: dataSource.length === 0,
|
|
468
495
|
lock: info.hasLockColumn,
|
|
@@ -470,7 +497,7 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
470
497
|
'sticky-header': isStickyHeader !== null && isStickyHeader !== void 0 ? isStickyHeader : isStickyHead,
|
|
471
498
|
'has-footer': footerDataSource.length > 0,
|
|
472
499
|
'sticky-footer': isStickyFooter
|
|
473
|
-
}, Classes.artTableBordered, bordered), 'ie-polyfill-wrapper', browserType.isIE), 'sticky-polyfill-wrapper', isStickyUIDegrade()), className);
|
|
500
|
+
}, _defineProperty(_cx, Classes.artTableBordered, bordered), _defineProperty(_cx, 'ie-polyfill-wrapper', browserType.isIE), _defineProperty(_cx, 'sticky-polyfill-wrapper', isStickyUIDegrade()), _cx), className);
|
|
474
501
|
var artTableWrapperProps = _defineProperty({
|
|
475
502
|
className: artTableWrapperClassName,
|
|
476
503
|
style: style
|
|
@@ -495,10 +522,10 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
495
522
|
this.initSubscriptions();
|
|
496
523
|
this.didMountOrUpdate();
|
|
497
524
|
// console.log('did mount end')
|
|
498
|
-
var _this$
|
|
499
|
-
cssVariables = _this$
|
|
500
|
-
enableCSSVariables = _this$
|
|
501
|
-
bordered = _this$
|
|
525
|
+
var _this$props9 = this.props,
|
|
526
|
+
cssVariables = _this$props9.cssVariables,
|
|
527
|
+
enableCSSVariables = _this$props9.enableCSSVariables,
|
|
528
|
+
bordered = _this$props9.bordered;
|
|
502
529
|
cssPolifill({
|
|
503
530
|
variables: cssVariables || {},
|
|
504
531
|
enableCSSVariables: enableCSSVariables,
|
|
@@ -513,10 +540,10 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
513
540
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
514
541
|
var _a;
|
|
515
542
|
// console.log('did update start')
|
|
516
|
-
var _this$
|
|
517
|
-
cssVariables = _this$
|
|
518
|
-
enableCSSVariables = _this$
|
|
519
|
-
bordered = _this$
|
|
543
|
+
var _this$props10 = this.props,
|
|
544
|
+
cssVariables = _this$props10.cssVariables,
|
|
545
|
+
enableCSSVariables = _this$props10.enableCSSVariables,
|
|
546
|
+
bordered = _this$props10.bordered;
|
|
520
547
|
if (!shallowEqual(prevProps === null || prevProps === void 0 ? void 0 : prevProps.cssVariables, (_a = this.props) === null || _a === void 0 ? void 0 : _a.cssVariables)) {
|
|
521
548
|
cssPolifill({
|
|
522
549
|
variables: cssVariables || {},
|
|
@@ -532,10 +559,13 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
532
559
|
}, {
|
|
533
560
|
key: "didMountOrUpdate",
|
|
534
561
|
value: function didMountOrUpdate(prevProps, prevState) {
|
|
535
|
-
this
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
562
|
+
var _this2 = this;
|
|
563
|
+
window.requestAnimationFrame(function () {
|
|
564
|
+
_this2.syncHorizontalScrollFromTableBody();
|
|
565
|
+
_this2.updateStickyScroll();
|
|
566
|
+
_this2.adjustNeedRenderLock();
|
|
567
|
+
_this2.updateRowHeightManager();
|
|
568
|
+
});
|
|
539
569
|
this.updateScrollLeftWhenLayoutChanged(prevProps, prevState);
|
|
540
570
|
}
|
|
541
571
|
}, {
|
|
@@ -557,25 +587,25 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
557
587
|
}, {
|
|
558
588
|
key: "initSubscriptions",
|
|
559
589
|
value: function initSubscriptions() {
|
|
560
|
-
var
|
|
590
|
+
var _this3 = this;
|
|
561
591
|
var _this$domHelper2 = this.domHelper,
|
|
562
592
|
virtual = _this$domHelper2.virtual,
|
|
563
593
|
stickyScroll = _this$domHelper2.stickyScroll;
|
|
564
594
|
this.rootSubscription.add(throttledWindowResize$.subscribe(function () {
|
|
565
|
-
|
|
566
|
-
|
|
595
|
+
_this3.updateStickyScroll();
|
|
596
|
+
_this3.adjustNeedRenderLock();
|
|
567
597
|
}));
|
|
568
598
|
this.resizeSubject.pipe(op.debounceTime(100)).subscribe(function () {
|
|
569
599
|
var _a, _b;
|
|
570
|
-
(_b = (_a =
|
|
600
|
+
(_b = (_a = _this3.props).setTableWidth) === null || _b === void 0 ? void 0 : _b.call(_a, _this3.domHelper.tableBody.clientWidth);
|
|
571
601
|
});
|
|
572
602
|
var handleTableWrapperResize = function handleTableWrapperResize() {
|
|
573
|
-
|
|
603
|
+
_this3.resizeSubject.next();
|
|
574
604
|
};
|
|
575
605
|
this.resizeObserver = addResizeObserver(this.domHelper.artTableWrapper, handleTableWrapperResize);
|
|
576
606
|
// 滚动同步
|
|
577
607
|
this.rootSubscription.add(syncScrollLeft([getTableScrollHeaderDOM(this.domHelper), virtual, getTableScrollFooterDOM(this.domHelper), stickyScroll], function (scrollLeft) {
|
|
578
|
-
|
|
608
|
+
_this3.syncHorizontalScroll(scrollLeft);
|
|
579
609
|
}));
|
|
580
610
|
var richVisibleRects$ = getRichVisibleRectsStream(this.domHelper.virtual, this.props$.pipe(op.skip(1), op.mapTo('structure-may-change')), this.props.virtualDebugLabel).pipe(op.shareReplay());
|
|
581
611
|
// 每当可见部分发生变化的时候,调整 loading icon 的未知(如果 loading icon 存在的话)
|
|
@@ -589,7 +619,7 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
589
619
|
}))]).subscribe(function (_ref3) {
|
|
590
620
|
var _ref4 = _slicedToArray(_ref3, 1),
|
|
591
621
|
clipRect = _ref4[0];
|
|
592
|
-
var loadingIndicator =
|
|
622
|
+
var loadingIndicator = _this3.domHelper.getLoadingIndicator();
|
|
593
623
|
if (!loadingIndicator) {
|
|
594
624
|
return;
|
|
595
625
|
}
|
|
@@ -600,9 +630,9 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
600
630
|
}));
|
|
601
631
|
// 每当可见部分发生变化的时候,如果开启了虚拟滚动,则重新触发 render
|
|
602
632
|
this.rootSubscription.add(richVisibleRects$.pipe(op.filter(function () {
|
|
603
|
-
var
|
|
604
|
-
horizontal =
|
|
605
|
-
vertical =
|
|
633
|
+
var _this3$lastInfo$useVi = _this3.lastInfo.useVirtual,
|
|
634
|
+
horizontal = _this3$lastInfo$useVi.horizontal,
|
|
635
|
+
vertical = _this3$lastInfo$useVi.vertical;
|
|
606
636
|
return horizontal || vertical;
|
|
607
637
|
}), op.map(function (_ref5) {
|
|
608
638
|
var clipRect = _ref5.clipRect,
|
|
@@ -619,8 +649,29 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
619
649
|
}
|
|
620
650
|
// 因为 overscan 的存在,滚动较小的距离时不需要触发组件重渲染
|
|
621
651
|
return Math.abs(x.maxRenderWidth - y.maxRenderWidth) < OVERSCAN_SIZE / 2 && Math.abs(x.maxRenderHeight - y.maxRenderHeight) < OVERSCAN_SIZE / 2 && Math.abs(x.offsetY - y.offsetY) < OVERSCAN_SIZE / 2;
|
|
652
|
+
}),
|
|
653
|
+
// 快速滚动检测和处理
|
|
654
|
+
op.tap(function (sizeAndOffset) {
|
|
655
|
+
// 只有在启用快速滚动时才使用 FastScrollManager 处理滚动事件
|
|
656
|
+
if (_this3.props.isLowPerformance) {
|
|
657
|
+
_this3.fastScrollManager.handleScrollEvent(sizeAndOffset, {
|
|
658
|
+
offsetY: _this3.state.offsetY,
|
|
659
|
+
maxRenderHeight: _this3.state.maxRenderHeight,
|
|
660
|
+
maxRenderWidth: _this3.state.maxRenderWidth
|
|
661
|
+
}, _this3.props.dataSource.length, _this3.domHelper.virtual.scrollHeight);
|
|
662
|
+
}
|
|
622
663
|
})).subscribe(function (sizeAndOffset) {
|
|
623
|
-
|
|
664
|
+
var _a, _b;
|
|
665
|
+
// 正常滚动时也需要实时更新 blank 高度,确保缓慢滚动时的视觉连续性
|
|
666
|
+
var currentRange = _this3.rowHeightManager.getRenderRange(sizeAndOffset.offsetY, sizeAndOffset.maxRenderHeight, _this3.props.dataSource.length);
|
|
667
|
+
// 直接更新 DOM,避免等待下次渲染
|
|
668
|
+
(_a = _this3.topBlankRef.current) === null || _a === void 0 ? void 0 : _a.updateHeight(currentRange.topBlank);
|
|
669
|
+
(_b = _this3.bottomBlankRef.current) === null || _b === void 0 ? void 0 : _b.updateHeight(currentRange.bottomBlank);
|
|
670
|
+
// 只有在启用快速滚动时才检查快速滚动状态
|
|
671
|
+
if (_this3.props.isLowPerformance && _this3.fastScrollManager.getIsFastScrolling()) {
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
_this3.setState(sizeAndOffset);
|
|
624
675
|
}));
|
|
625
676
|
this.rootSubscription.add(richVisibleRects$.pipe(op.map(function (_ref6) {
|
|
626
677
|
var clipRect = _ref6.clipRect,
|
|
@@ -638,13 +689,13 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
638
689
|
var _a;
|
|
639
690
|
var offsetY = sizeAndOffset.offsetY,
|
|
640
691
|
maxRenderHeight = sizeAndOffset.maxRenderHeight;
|
|
641
|
-
var scrollDirection = offsetY -
|
|
642
|
-
|
|
643
|
-
var rowCount =
|
|
644
|
-
var vertical =
|
|
692
|
+
var scrollDirection = offsetY - _this3.offsetY >= 0 ? 'down' : 'up';
|
|
693
|
+
_this3.offsetY = offsetY;
|
|
694
|
+
var rowCount = _this3.props.dataSource.length;
|
|
695
|
+
var vertical = _this3.rowHeightManager.getRenderRange(offsetY, maxRenderHeight, rowCount);
|
|
645
696
|
var topIndex = vertical.topIndex,
|
|
646
697
|
bottomIndex = vertical.bottomIndex;
|
|
647
|
-
var blockSize = ((_a =
|
|
698
|
+
var blockSize = ((_a = _this3.props.scrollLoad) === null || _a === void 0 ? void 0 : _a.blockSize) || 200;
|
|
648
699
|
var topBlockStartIndex = Math.floor(Math.max(topIndex - 1, 0) / blockSize) * blockSize;
|
|
649
700
|
var bottomBlockStartIndex = Math.floor((bottomIndex + 1) / blockSize) * blockSize;
|
|
650
701
|
return scrollDirection === 'down' ? [topBlockStartIndex, bottomBlockStartIndex] : [bottomBlockStartIndex, topBlockStartIndex];
|
|
@@ -659,7 +710,7 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
659
710
|
// 过滤掉重复掉值
|
|
660
711
|
op.distinctUntilChanged()).subscribe(function (startIndex) {
|
|
661
712
|
var _a;
|
|
662
|
-
(_a =
|
|
713
|
+
(_a = _this3.props.scrollLoad) === null || _a === void 0 ? void 0 : _a.callback(startIndex);
|
|
663
714
|
}));
|
|
664
715
|
}
|
|
665
716
|
}, {
|
|
@@ -669,6 +720,10 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
669
720
|
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
670
721
|
this.rootSubscription.unsubscribe();
|
|
671
722
|
this.resizeSubject.unsubscribe();
|
|
723
|
+
// 只有在启用快速滚动时才清理快速滚动管理器
|
|
724
|
+
if (this.props.isLowPerformance) {
|
|
725
|
+
this.fastScrollManager.cleanup();
|
|
726
|
+
}
|
|
672
727
|
}
|
|
673
728
|
/** 更新 DOM 节点的引用,方便其他方法直接操作 DOM */
|
|
674
729
|
}, {
|
|
@@ -750,6 +805,7 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
750
805
|
}
|
|
751
806
|
}
|
|
752
807
|
}]);
|
|
808
|
+
return BaseTable;
|
|
753
809
|
}(React.Component);
|
|
754
810
|
BaseTable.defaultProps = {
|
|
755
811
|
hasHeader: true,
|
|
@@ -762,6 +818,7 @@ BaseTable.defaultProps = {
|
|
|
762
818
|
stickyScrollHeight: 'auto',
|
|
763
819
|
useVirtual: 'auto',
|
|
764
820
|
estimatedRowHeight: 48,
|
|
821
|
+
isLowPerformance: false,
|
|
765
822
|
isLoading: false,
|
|
766
823
|
components: {},
|
|
767
824
|
getTableProps: noop,
|
package/es/table/base/utils.js
CHANGED
|
@@ -4,9 +4,9 @@ import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
|
4
4
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
5
5
|
import _typeof from "@babel/runtime-corejs3/helpers/typeof";
|
|
6
6
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
7
|
-
function _createForOfIteratorHelper(
|
|
8
|
-
function _unsupportedIterableToArray(
|
|
9
|
-
function _arrayLikeToArray(
|
|
7
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
8
|
+
function _unsupportedIterableToArray(o, minLen) { var _context; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
10
|
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
11
11
|
import _Object$is from "@babel/runtime-corejs3/core-js-stable/object/is";
|
|
12
12
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
@@ -216,6 +216,7 @@ export function columnDrag() {
|
|
|
216
216
|
e.stopPropagation(); // 存在移动就阻止冒泡
|
|
217
217
|
currentTarget.addEventListener('click', stopClickPropagation); // 阻止列头点击事件,防止拖动后触发列头过滤事件
|
|
218
218
|
}
|
|
219
|
+
|
|
219
220
|
window.requestAnimationFrame(function () {
|
|
220
221
|
// 取消阻止列头点击事件
|
|
221
222
|
currentTarget.removeEventListener('click', stopClickPropagation);
|
|
@@ -45,6 +45,7 @@ export function filter() {
|
|
|
45
45
|
var filterable = col.code && ((_a = col.features) === null || _a === void 0 ? void 0 : _a.filterable);
|
|
46
46
|
var filterActive = !!(filterable && (inputFiltersMap === null || inputFiltersMap === void 0 ? void 0 : inputFiltersMap.get(col.code)));
|
|
47
47
|
if (filterable) {
|
|
48
|
+
var _cx;
|
|
48
49
|
var handleFilterChanged = function handleFilterChanged(filterItem) {
|
|
49
50
|
var nextFiltersMap = new _Map(inputFiltersMap);
|
|
50
51
|
var currentFilter = _extends({
|
|
@@ -79,7 +80,7 @@ export function filter() {
|
|
|
79
80
|
setFilterModel: handleFilterChanged,
|
|
80
81
|
setFilter: setFilter,
|
|
81
82
|
isFilterActive: filterActive,
|
|
82
|
-
className: cx(
|
|
83
|
+
className: cx((_cx = {}, _defineProperty(_cx, Classes.tableFilterTrigger, true), _defineProperty(_cx, "active", filterActive), _cx)),
|
|
83
84
|
stopClickEventPropagation: stopClickEventPropagation,
|
|
84
85
|
stopESCKeyDownEventPropagation: stopESCKeyDownEventPropagation,
|
|
85
86
|
hideFilterPopupHeader: hideFilterPopupHeader,
|
|
@@ -98,6 +99,7 @@ export function filter() {
|
|
|
98
99
|
// }
|
|
99
100
|
// })
|
|
100
101
|
}
|
|
102
|
+
|
|
101
103
|
if (!isLeafNode(col)) {
|
|
102
104
|
var _context3;
|
|
103
105
|
result.children = _mapInstanceProperty(_context3 = col.children).call(_context3, dfs);
|
|
@@ -143,7 +143,7 @@ export function columnResize() {
|
|
|
143
143
|
width = col.width;
|
|
144
144
|
return _extends(_extends({}, col), {
|
|
145
145
|
width: (_a = columnSize[code]) !== null && _a !== void 0 ? _a : width,
|
|
146
|
-
title:
|
|
146
|
+
title: /*#__PURE__*/React.createElement(React.Fragment, null, prevTitle, (features === null || features === void 0 ? void 0 : features.resizeable) !== false && (isGroup ? /*#__PURE__*/React.createElement(TableHeaderGroupCellResize, {
|
|
147
147
|
className: Classes.tableHeaderCellResize,
|
|
148
148
|
onDoubleClick: function onDoubleClick(e) {
|
|
149
149
|
return handleDoubleClick(e, col);
|
|
@@ -159,7 +159,7 @@ export function columnResize() {
|
|
|
159
159
|
onMouseDown: function onMouseDown(e) {
|
|
160
160
|
return handleMouseDown(e, col);
|
|
161
161
|
}
|
|
162
|
-
})))
|
|
162
|
+
}))),
|
|
163
163
|
headerCellProps: mergeCellProps(col.headerCellProps, {
|
|
164
164
|
className: 'resizeable'
|
|
165
165
|
})
|
|
@@ -23,24 +23,24 @@ export function contextMenu() {
|
|
|
23
23
|
popupParent.appendChild(ePopupDiv);
|
|
24
24
|
var popupHidden = false;
|
|
25
25
|
var eventList = ['mousedown', 'contextmenu'];
|
|
26
|
-
var
|
|
26
|
+
var hidePopup = function hidePopup(event) {
|
|
27
27
|
if (isEventFromCurrentPopup(event, ePopupDiv) || popupHidden) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
popupHidden = true;
|
|
31
31
|
popupParent.removeChild(ePopupDiv);
|
|
32
32
|
eventList.forEach(function (eventType) {
|
|
33
|
-
window.removeEventListener(eventType,
|
|
33
|
+
window.removeEventListener(eventType, hidePopup, true);
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
36
|
ReactDOM.render(menu, ePopupDiv, function () {
|
|
37
37
|
setTimeout(function () {
|
|
38
38
|
eventList.forEach(function (eventType) {
|
|
39
|
-
window.addEventListener(eventType,
|
|
39
|
+
window.addEventListener(eventType, hidePopup, true);
|
|
40
40
|
});
|
|
41
41
|
}, 0);
|
|
42
42
|
});
|
|
43
|
-
return
|
|
43
|
+
return hidePopup;
|
|
44
44
|
};
|
|
45
45
|
var onContextMenu = function onContextMenu(e) {
|
|
46
46
|
if (canShowContextMenu(e, pipeline)) {
|
|
@@ -284,10 +284,12 @@ function keepWithinBounds(popupParent, ePopup, x, y) {
|
|
|
284
284
|
var maxX = parentWidth - minWidth;
|
|
285
285
|
x = Math.min(Math.max(x, 0), Math.abs(maxX)); // 目前位置,最大支持的位置
|
|
286
286
|
}
|
|
287
|
+
|
|
287
288
|
if (y) {
|
|
288
289
|
var maxY = parentHeight - ePopupRect.height;
|
|
289
290
|
y = Math.min(Math.max(y, 0), Math.abs(maxY)); // 目前位置,最大支持的位置
|
|
290
291
|
}
|
|
292
|
+
|
|
291
293
|
return {
|
|
292
294
|
x: x,
|
|
293
295
|
y: y
|
|
@@ -10,7 +10,7 @@ var RowDragApi = /*#__PURE__*/function () {
|
|
|
10
10
|
this.rowDropZones = [];
|
|
11
11
|
this.dragStatus = 'finished';
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
_createClass(RowDragApi, [{
|
|
14
14
|
key: "getRowDropZoneParams",
|
|
15
15
|
value: function getRowDropZoneParams() {
|
|
16
16
|
return this.rowDropZoneParams;
|
|
@@ -62,5 +62,6 @@ var RowDragApi = /*#__PURE__*/function () {
|
|
|
62
62
|
return this.dragStatus;
|
|
63
63
|
}
|
|
64
64
|
}]);
|
|
65
|
+
return RowDragApi;
|
|
65
66
|
}();
|
|
66
67
|
export { RowDragApi as default };
|
|
@@ -12,6 +12,7 @@ import { Classes, ButtonCSS } from '../../../base/styles';
|
|
|
12
12
|
import KeyCode from '../../../utils/keyCode';
|
|
13
13
|
var DefaultFilterContentStyle = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n background-color: #ffffff;\n border-radius: 2px;\n width: 100%;\n\n ", "\n .filter-option-list {\n display: flex;\n flex-direction: column;\n margin-top: 8px;\n ul {\n margin: 0;\n padding: 0;\n li {\n display: flex;\n position: relative;\n flex-shrink: 0;\n height: 32px;\n align-items: center;\n border-radius: 2px;\n font-size: 12px;\n color: var(--color);\n padding: 0 12px;\n overflow: hidden;\n cursor: pointer;\n &:hover{\n background-color: var(--primary-color-level1);\n }\n }\n li.active{\n background-color: var(--primary-color-level1);\n }\n }\n }\n\n .filter-search {\n display: flex;\n padding: 6px 12px;\n\n .filter-search-inner {\n width: 100%;\n font-size: 12px;\n color: #333333;\n height: 28px;\n line-height: 28px;\n padding: 0 8px;\n outline: none;\n background-color: #FAFAFA;\n border-radius: 2px;\n border: 1px solid var(--strong-border-color);\n &:hover{\n border-color: var(--primary-color)\n } \n &:focus{\n border-color: var(--primary-color)\n } \n }\n }\n\n .filter-footer {\n display: flex;\n flex-direction: row;\n padding: 8px 12px;\n justify-content: space-between;\n\n .filter-btn {\n text-align: center;\n font-size: 12px;\n width: 60px;\n height: 24px;\n line-height: 24px;\n }\n \n }\n"])), ButtonCSS);
|
|
14
14
|
function DefaultFilterContent(_ref) {
|
|
15
|
+
var _cx2;
|
|
15
16
|
var setFilterModel = _ref.setFilterModel,
|
|
16
17
|
filterModel = _ref.filterModel,
|
|
17
18
|
hidePanel = _ref.hidePanel,
|
|
@@ -74,7 +75,7 @@ function DefaultFilterContent(_ref) {
|
|
|
74
75
|
}
|
|
75
76
|
}, (_a = localeText[option.key]) !== null && _a !== void 0 ? _a : option.title)
|
|
76
77
|
);
|
|
77
|
-
}))), selectedValue !== 'notIsNull' && selectedValue !== 'isNull' &&
|
|
78
|
+
}))), selectedValue !== 'notIsNull' && selectedValue !== 'isNull' && /*#__PURE__*/React.createElement("div", {
|
|
78
79
|
className: 'filter-search'
|
|
79
80
|
}, /*#__PURE__*/React.createElement("input", {
|
|
80
81
|
className: 'filter-search-inner',
|
|
@@ -84,7 +85,7 @@ function DefaultFilterContent(_ref) {
|
|
|
84
85
|
},
|
|
85
86
|
onKeyDown: handleKeyDown,
|
|
86
87
|
ref: inputRef
|
|
87
|
-
}))
|
|
88
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
88
89
|
className: 'filter-footer'
|
|
89
90
|
}, /*#__PURE__*/React.createElement("button", {
|
|
90
91
|
className: cx(_defineProperty({
|
|
@@ -92,9 +93,9 @@ function DefaultFilterContent(_ref) {
|
|
|
92
93
|
}, Classes.button, true)),
|
|
93
94
|
onClick: reset
|
|
94
95
|
}, (_a = localeText.resetFilter) !== null && _a !== void 0 ? _a : '重置'), /*#__PURE__*/React.createElement("button", {
|
|
95
|
-
className: cx(
|
|
96
|
+
className: cx((_cx2 = {
|
|
96
97
|
'filter-btn': true
|
|
97
|
-
}, Classes.button, true), Classes.buttonPrimary, true)),
|
|
98
|
+
}, _defineProperty(_cx2, Classes.button, true), _defineProperty(_cx2, Classes.buttonPrimary, true), _cx2)),
|
|
98
99
|
onClick: confirm
|
|
99
100
|
}, (_b = localeText.confirmFilter) !== null && _b !== void 0 ? _b : '确定')));
|
|
100
101
|
}
|