@kdcloudjs/table 1.0.1 → 1.0.2
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 +1 -1
- package/README.md +34 -33
- package/dist/@kdcloudjs/table.css +1 -1
- package/dist/@kdcloudjs/table.css.map +1 -1
- package/dist/@kdcloudjs/table.js +6323 -3240
- package/dist/@kdcloudjs/table.js.map +1 -1
- package/dist/@kdcloudjs/table.min.css +1 -1
- package/dist/@kdcloudjs/table.min.js +32 -24
- package/dist/@kdcloudjs/table.min.js.map +1 -1
- package/es/_utils/hooks.js +1 -2
- package/es/_utils/numberUtil.js +3 -4
- package/es/locale/locale.js +1 -2
- package/es/table/base/calculations.js +2 -3
- package/es/table/base/header.d.ts +6 -2
- package/es/table/base/header.js +36 -13
- package/es/table/base/helpers/SpanManager.js +1 -1
- package/es/table/base/helpers/TableDOMUtils.d.ts +3 -0
- package/es/table/base/helpers/TableDOMUtils.js +23 -5
- package/es/table/base/helpers/getRichVisibleRectsStream.d.ts +23 -0
- package/es/table/base/helpers/getRichVisibleRectsStream.js +216 -0
- package/es/table/base/html-table.d.ts +3 -1
- package/es/table/base/html-table.js +34 -8
- package/es/table/base/interfaces.d.ts +1 -0
- package/es/table/base/renderTemplates.d.ts +1 -0
- package/es/table/base/renderTemplates.js +344 -0
- package/es/table/base/styles.d.ts +14 -0
- package/es/table/base/styles.js +20 -8
- package/es/table/base/table.d.ts +12 -4
- package/es/table/base/table.js +183 -136
- package/es/table/base/utils.d.ts +6 -3
- package/es/table/base/utils.js +27 -6
- package/es/table/common-views.js +1 -1
- package/es/table/pipeline/features/autoFill.js +7 -1
- package/es/table/pipeline/features/columnDrag.js +109 -41
- package/es/table/pipeline/features/columnFilter.js +7 -9
- package/es/table/pipeline/features/columnResizeWidth.d.ts +3 -0
- package/es/table/pipeline/features/columnResizeWidth.js +11 -4
- package/es/table/pipeline/features/contextMenu.js +42 -10
- package/es/table/pipeline/features/filter/Filter.js +74 -37
- package/es/table/pipeline/features/index.d.ts +1 -0
- package/es/table/pipeline/features/index.js +2 -1
- package/es/table/pipeline/features/rangeSelection.d.ts +10 -0
- package/es/table/pipeline/features/rangeSelection.js +231 -0
- package/es/table/pipeline/features/rowDetail.js +37 -15
- package/es/table/pipeline/features/singleSelect.js +4 -1
- package/es/table/pipeline/features/sort.js +2 -3
- package/es/table/pipeline/features/treeMode.js +1 -2
- package/es/table/pipeline/pipeline.d.ts +4 -0
- package/es/table/pipeline/pipeline.js +32 -5
- package/es/table/pivot/cross-table/buildCrossTable.js +1 -2
- package/es/table/pivot/cross-tree-table/buildCrossTreeTable.js +1 -2
- package/es/table/pivot/pivot-utils/builders.js +1 -2
- package/es/table/pivot/pivot-utils/convert-utils.js +1 -2
- package/es/table/transforms/autoWidth.js +1 -2
- package/es/table/transforms/sort.js +1 -2
- package/es/table/transforms/treeMode.js +1 -2
- package/es/table/utils/applyTransforms.js +1 -3
- package/es/table/utils/browserType.d.ts +6 -0
- package/es/table/utils/browserType.js +6 -0
- package/es/table/utils/buildTree.js +4 -5
- package/es/table/utils/collectNodes.js +1 -2
- package/es/table/utils/exportTableAsExcel.js +1 -2
- package/es/table/utils/getTreeDepth.js +1 -2
- package/es/table/utils/groupBy.js +1 -2
- package/es/table/utils/index.d.ts +1 -0
- package/es/table/utils/index.js +2 -1
- package/es/table/utils/layeredSort.js +5 -2
- package/es/table/utils/makeRecursiveMapper.js +4 -5
- package/es/table/utils/others.d.ts +1 -1
- package/es/table/utils/others.js +20 -14
- package/es/table/utils/traverseColumn.js +1 -2
- package/es/table/utils/tree-data-helpers/StrictTreeDataHelper.js +4 -5
- package/es/table/utils/tree-data-helpers/TreeDataHelper.js +4 -5
- package/lib/_utils/formatUtil.js +1 -1
- package/lib/_utils/hooks.js +2 -4
- package/lib/_utils/numberUtil.js +7 -9
- package/lib/_utils/usePopper.js +9 -1
- package/lib/config-provider/configProvider.js +9 -1
- package/lib/config-provider/index.js +5 -5
- package/lib/locale/index.js +14 -6
- package/lib/locale/locale.js +2 -4
- package/lib/table/base/calculations.js +3 -5
- package/lib/table/base/empty.js +9 -1
- package/lib/table/base/header.d.ts +6 -2
- package/lib/table/base/header.js +33 -10
- package/lib/table/base/helpers/SpanManager.js +1 -1
- package/lib/table/base/helpers/TableDOMUtils.d.ts +3 -0
- package/lib/table/base/helpers/TableDOMUtils.js +21 -5
- package/lib/table/base/helpers/getRichVisibleRectsStream.d.ts +23 -0
- package/lib/table/base/helpers/getRichVisibleRectsStream.js +246 -0
- package/lib/table/base/html-table.d.ts +3 -1
- package/lib/table/base/html-table.js +34 -8
- package/lib/table/base/index.js +4 -4
- package/lib/table/base/interfaces.d.ts +1 -0
- package/lib/table/base/renderTemplates.d.ts +1 -0
- package/lib/table/base/renderTemplates.js +370 -0
- package/lib/table/base/styles.d.ts +14 -0
- package/lib/table/base/styles.js +31 -12
- package/lib/table/base/table.d.ts +12 -4
- package/lib/table/base/table.js +191 -137
- package/lib/table/base/utils.d.ts +6 -3
- package/lib/table/base/utils.js +47 -10
- package/lib/table/common-views.js +2 -2
- package/lib/table/pipeline/features/__test__/sort.test.js +5 -3
- package/lib/table/pipeline/features/autoFill.js +9 -2
- package/lib/table/pipeline/features/columnDrag.js +108 -40
- package/lib/table/pipeline/features/columnFilter.js +6 -9
- package/lib/table/pipeline/features/columnResizeWidth.d.ts +3 -0
- package/lib/table/pipeline/features/columnResizeWidth.js +21 -5
- package/lib/table/pipeline/features/contextMenu.js +53 -11
- package/lib/table/pipeline/features/filter/DefaultFilterContent.js +10 -2
- package/lib/table/pipeline/features/filter/Filter.js +88 -37
- package/lib/table/pipeline/features/filter/FilterPanel.js +10 -2
- package/lib/table/pipeline/features/filter/index.js +4 -4
- package/lib/table/pipeline/features/index.d.ts +1 -0
- package/lib/table/pipeline/features/index.js +37 -27
- package/lib/table/pipeline/features/rangeSelection.d.ts +10 -0
- package/lib/table/pipeline/features/rangeSelection.js +256 -0
- package/lib/table/pipeline/features/rowDetail.js +39 -15
- package/lib/table/pipeline/features/singleSelect.js +4 -1
- package/lib/table/pipeline/features/sort.js +2 -4
- package/lib/table/pipeline/features/treeMode.js +2 -4
- package/lib/table/pipeline/index.js +11 -3
- package/lib/table/pipeline/pipeline.d.ts +4 -0
- package/lib/table/pipeline/pipeline.js +33 -7
- package/lib/table/pivot/cross-table/buildCrossTable.js +1 -3
- package/lib/table/pivot/cross-table/index.js +4 -4
- package/lib/table/pivot/cross-tree-table/buildCrossTreeTable.js +1 -3
- package/lib/table/pivot/pivot-utils/builders.js +2 -4
- package/lib/table/pivot/pivot-utils/convert-utils.js +1 -3
- package/lib/table/pivot/pivot-utils/index.js +4 -4
- package/lib/table/transforms/autoWidth.js +10 -4
- package/lib/table/transforms/columnResize.js +10 -2
- package/lib/table/transforms/index.js +32 -32
- package/lib/table/transforms/sort.js +10 -4
- package/lib/table/transforms/treeMode.js +9 -3
- package/lib/table/utils/applyTransforms.js +1 -5
- package/lib/table/utils/browserType.d.ts +6 -0
- package/lib/table/utils/browserType.js +13 -0
- package/lib/table/utils/buildTree.js +1 -3
- package/lib/table/utils/collectNodes.js +1 -3
- package/lib/table/utils/copyToClipboard.js +1 -1
- package/lib/table/utils/element.js +3 -3
- package/lib/table/utils/exportTableAsExcel.js +1 -3
- package/lib/table/utils/getTreeDepth.js +1 -3
- package/lib/table/utils/groupBy.js +1 -3
- package/lib/table/utils/index.d.ts +1 -0
- package/lib/table/utils/index.js +57 -49
- package/lib/table/utils/layeredSort.js +6 -2
- package/lib/table/utils/makeRecursiveMapper.js +1 -3
- package/lib/table/utils/others.d.ts +1 -1
- package/lib/table/utils/others.js +23 -18
- package/lib/table/utils/traverseColumn.js +1 -3
- package/lib/table/utils/tree-data-helpers/StrictTreeDataHelper.js +5 -7
- package/lib/table/utils/tree-data-helpers/TreeDataHelper.js +5 -7
- package/package.json +6 -2
- package/dist/kd-table.css +0 -422
- package/dist/kd-table.css.map +0 -1
- package/dist/kd-table.js +0 -38578
- package/dist/kd-table.js.map +0 -1
- package/dist/kd-table.min.css +0 -9
- package/dist/kd-table.min.js +0 -208
- package/dist/kd-table.min.js.map +0 -1
- package/es/table/base/helpers/__test__/visible-part.test.d.ts +0 -1
- package/es/table/base/helpers/__test__/visible-part.test.js +0 -28
- package/es/table/base/helpers/visible-part.d.ts +0 -23
- package/es/table/base/helpers/visible-part.js +0 -58
- package/lib/table/base/helpers/__test__/visible-part.test.d.ts +0 -1
- package/lib/table/base/helpers/__test__/visible-part.test.js +0 -31
- package/lib/table/base/helpers/visible-part.d.ts +0 -23
- package/lib/table/base/helpers/visible-part.js +0 -72
package/es/table/base/table.js
CHANGED
|
@@ -2,7 +2,6 @@ import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/co
|
|
|
2
2
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
3
3
|
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
4
4
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
5
|
-
import _getIterator from "@babel/runtime-corejs3/core-js/get-iterator";
|
|
6
5
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
7
6
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
8
7
|
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
@@ -12,14 +11,14 @@ import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleC
|
|
|
12
11
|
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
13
12
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
14
13
|
|
|
15
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it
|
|
14
|
+
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; } } }; }
|
|
16
15
|
|
|
17
16
|
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); }
|
|
18
17
|
|
|
19
18
|
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; }
|
|
20
19
|
|
|
21
|
-
import _flatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/flat";
|
|
22
20
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
21
|
+
import _flatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/flat";
|
|
23
22
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
24
23
|
|
|
25
24
|
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); }; }
|
|
@@ -28,20 +27,21 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_R
|
|
|
28
27
|
|
|
29
28
|
import cx from 'classnames';
|
|
30
29
|
import React from 'react';
|
|
31
|
-
import {
|
|
30
|
+
import { BehaviorSubject, combineLatest, noop, Subscription, Subject } from 'rxjs';
|
|
32
31
|
import * as op from 'rxjs/operators';
|
|
33
32
|
import { calculateRenderInfo } from './calculations';
|
|
34
33
|
import { EmptyHtmlTable } from './empty';
|
|
35
34
|
import TableHeader from './header';
|
|
35
|
+
import { getRichVisibleRectsStream } from './helpers/getRichVisibleRectsStream';
|
|
36
36
|
import { getFullRenderRange, makeRowHeightManager } from './helpers/rowHeightManager';
|
|
37
37
|
import { TableDOMHelper } from './helpers/TableDOMUtils';
|
|
38
|
-
import { getVisiblePartObservable } from './helpers/visible-part';
|
|
39
38
|
import { HtmlTable } from './html-table';
|
|
40
39
|
import Loading from './loading';
|
|
41
40
|
import { Classes, LOCK_SHADOW_PADDING, StyledArtTableWrapper, defaultCSSVariables } from './styles';
|
|
42
|
-
import { addResizeObserver, getScrollbarSize, OVERSCAN_SIZE, shallowEqual, STYLED_REF_PROP, sum, syncScrollLeft, throttledWindowResize
|
|
41
|
+
import { addResizeObserver, getScrollbarSize, OVERSCAN_SIZE, shallowEqual, STYLED_REF_PROP, sum, syncScrollLeft, throttledWindowResize$, getTableScrollFooterDOM, getTableScrollHeaderDOM } from './utils';
|
|
43
42
|
import cssVars from 'css-vars-ponyfill';
|
|
44
|
-
import { console } from '../utils';
|
|
43
|
+
import { console, browserType } from '../utils';
|
|
44
|
+
import getTableRenderTemplate from './renderTemplates';
|
|
45
45
|
|
|
46
46
|
var cssPolifill = function cssPolifill(_ref) {
|
|
47
47
|
var variables = _ref.variables,
|
|
@@ -57,7 +57,6 @@ var cssPolifill = function cssPolifill(_ref) {
|
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
var t0 = performance.now();
|
|
61
60
|
cssVars({
|
|
62
61
|
// exclude: 'link[href*="semantic-ui"]',
|
|
63
62
|
// onlyLegacy: false,
|
|
@@ -65,12 +64,7 @@ var cssPolifill = function cssPolifill(_ref) {
|
|
|
65
64
|
include: 'style[data-styled]',
|
|
66
65
|
variables: _extends({}, defaultCSSVariables, variables),
|
|
67
66
|
watch: true,
|
|
68
|
-
silent: true
|
|
69
|
-
onComplete: function onComplete() {
|
|
70
|
-
var t1 = performance.now();
|
|
71
|
-
var time = ((t1 - t0) / 1000).toFixed(2);
|
|
72
|
-
console.log("css-vars-ponyfill completed in ".concat(time, " seconds"));
|
|
73
|
-
}
|
|
67
|
+
silent: true
|
|
74
68
|
});
|
|
75
69
|
};
|
|
76
70
|
|
|
@@ -99,6 +93,130 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
99
93
|
_this.rootSubscription = new Subscription();
|
|
100
94
|
_this.hasScrollY = false;
|
|
101
95
|
_this.resizeSubject = new Subject();
|
|
96
|
+
|
|
97
|
+
_this.getRowNodeListByEvent = function (e) {
|
|
98
|
+
var nodeList = null;
|
|
99
|
+
var rowIndex = e.currentTarget.dataset.rowindex;
|
|
100
|
+
|
|
101
|
+
if (rowIndex !== undefined) {
|
|
102
|
+
var _this$domHelper = _this.domHelper,
|
|
103
|
+
tableBody = _this$domHelper.tableBody,
|
|
104
|
+
tableFooter = _this$domHelper.tableFooter;
|
|
105
|
+
var targetParent = tableBody.contains(e.currentTarget) ? tableBody : tableFooter;
|
|
106
|
+
nodeList = targetParent.querySelectorAll("tr[data-rowindex=\"".concat(rowIndex, "\"]"));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return nodeList;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
_this.handleRowMouseEnter = function (e) {
|
|
113
|
+
var nodeList = _this.getRowNodeListByEvent(e);
|
|
114
|
+
|
|
115
|
+
nodeList && nodeList.forEach(function (node) {
|
|
116
|
+
node.classList.add('row-hover');
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
_this.handleRowMouseLeave = function (e) {
|
|
121
|
+
var nodeList = _this.getRowNodeListByEvent(e);
|
|
122
|
+
|
|
123
|
+
nodeList && nodeList.forEach(function (node) {
|
|
124
|
+
node.classList.remove('row-hover');
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
_this.renderTableBody = function (info) {
|
|
129
|
+
// console.log('render body')
|
|
130
|
+
var _this$props = _this.props,
|
|
131
|
+
dataSource = _this$props.dataSource,
|
|
132
|
+
getRowProps = _this$props.getRowProps,
|
|
133
|
+
primaryKey = _this$props.primaryKey,
|
|
134
|
+
isLoading = _this$props.isLoading,
|
|
135
|
+
emptyCellHeight = _this$props.emptyCellHeight,
|
|
136
|
+
footerDataSource = _this$props.footerDataSource;
|
|
137
|
+
var tableBodyClassName = cx(Classes.tableBody, Classes.horizontalScrollContainer); // 低版本Edge浏览器下也会出现双滚动条,这里设置overflow: 'hidden',先去掉edge的方向键控制滚动条的功能
|
|
138
|
+
|
|
139
|
+
var virtualStyle = browserType.isIE || browserType.isEdge ? {
|
|
140
|
+
overflow: 'hidden'
|
|
141
|
+
} : {};
|
|
142
|
+
|
|
143
|
+
if (dataSource.length === 0) {
|
|
144
|
+
var _this$props2 = _this.props,
|
|
145
|
+
components = _this$props2.components,
|
|
146
|
+
emptyContent = _this$props2.emptyContent;
|
|
147
|
+
var EmptyContent = components.EmptyContent;
|
|
148
|
+
|
|
149
|
+
if (EmptyContent == null && emptyContent != null) {
|
|
150
|
+
warnPropsDotEmptyContentIsDeprecated();
|
|
151
|
+
|
|
152
|
+
EmptyContent = function EmptyContent() {
|
|
153
|
+
return emptyContent;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
158
|
+
className: cx(tableBodyClassName, 'empty')
|
|
159
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
160
|
+
className: Classes.virtual,
|
|
161
|
+
style: virtualStyle
|
|
162
|
+
}, /*#__PURE__*/React.createElement(EmptyHtmlTable, {
|
|
163
|
+
descriptors: info.visible,
|
|
164
|
+
isLoading: isLoading,
|
|
165
|
+
EmptyContent: EmptyContent,
|
|
166
|
+
emptyCellHeight: emptyCellHeight
|
|
167
|
+
})));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
var _info$verticalRenderR = info.verticalRenderRange,
|
|
171
|
+
topIndex = _info$verticalRenderR.topIndex,
|
|
172
|
+
bottomBlank = _info$verticalRenderR.bottomBlank,
|
|
173
|
+
topBlank = _info$verticalRenderR.topBlank,
|
|
174
|
+
bottomIndex = _info$verticalRenderR.bottomIndex;
|
|
175
|
+
var renderBody = getTableRenderTemplate('body');
|
|
176
|
+
|
|
177
|
+
if (typeof renderBody === 'function') {
|
|
178
|
+
return renderBody(info, _this.props, {
|
|
179
|
+
rowProps: {
|
|
180
|
+
onMouseEnter: _this.handleRowMouseEnter,
|
|
181
|
+
onMouseLeave: _this.handleRowMouseLeave
|
|
182
|
+
},
|
|
183
|
+
hasScrollY: _this.hasScrollY
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
188
|
+
className: tableBodyClassName
|
|
189
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
190
|
+
className: Classes.virtual,
|
|
191
|
+
style: virtualStyle
|
|
192
|
+
}, topBlank > 0 && /*#__PURE__*/React.createElement("div", {
|
|
193
|
+
key: "top-blank",
|
|
194
|
+
className: cx(Classes.virtualBlank, 'top'),
|
|
195
|
+
style: {
|
|
196
|
+
height: topBlank
|
|
197
|
+
}
|
|
198
|
+
}), /*#__PURE__*/React.createElement(HtmlTable, {
|
|
199
|
+
tbodyHtmlTag: "tbody",
|
|
200
|
+
getRowProps: getRowProps,
|
|
201
|
+
primaryKey: primaryKey,
|
|
202
|
+
data: _sliceInstanceProperty(dataSource).call(dataSource, topIndex, bottomIndex),
|
|
203
|
+
hasScrollY: _this.hasScrollY,
|
|
204
|
+
horizontalRenderInfo: info,
|
|
205
|
+
verticalRenderInfo: {
|
|
206
|
+
first: 0,
|
|
207
|
+
offset: topIndex,
|
|
208
|
+
limit: bottomIndex,
|
|
209
|
+
last: dataSource.length - 1
|
|
210
|
+
}
|
|
211
|
+
}), bottomBlank > 0 && /*#__PURE__*/React.createElement("div", {
|
|
212
|
+
key: "bottom-blank",
|
|
213
|
+
className: cx(Classes.virtualBlank, 'bottom'),
|
|
214
|
+
style: {
|
|
215
|
+
height: bottomBlank
|
|
216
|
+
}
|
|
217
|
+
})));
|
|
218
|
+
};
|
|
219
|
+
|
|
102
220
|
_this.state = {
|
|
103
221
|
hasScroll: true,
|
|
104
222
|
hasScrollY: true,
|
|
@@ -129,10 +247,10 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
129
247
|
value: function updateStickyScroll() {
|
|
130
248
|
var _a, _b;
|
|
131
249
|
|
|
132
|
-
var _this$
|
|
133
|
-
stickyScroll = _this$
|
|
134
|
-
artTable = _this$
|
|
135
|
-
stickyScrollItem = _this$
|
|
250
|
+
var _this$domHelper2 = this.domHelper,
|
|
251
|
+
stickyScroll = _this$domHelper2.stickyScroll,
|
|
252
|
+
artTable = _this$domHelper2.artTable,
|
|
253
|
+
stickyScrollItem = _this$domHelper2.stickyScrollItem;
|
|
136
254
|
var _lastHasScrollY = this.hasScrollY;
|
|
137
255
|
|
|
138
256
|
if (!artTable) {
|
|
@@ -163,7 +281,7 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
163
281
|
}
|
|
164
282
|
}
|
|
165
283
|
|
|
166
|
-
if (this.domHelper.
|
|
284
|
+
if (this.domHelper.virtual.offsetHeight > this.domHelper.tableBody.offsetHeight) {
|
|
167
285
|
// if (!this.state.hasScroll) {
|
|
168
286
|
// this.setState({
|
|
169
287
|
// hasScrollY: true
|
|
@@ -171,7 +289,7 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
171
289
|
// }
|
|
172
290
|
this.hasScrollY = true;
|
|
173
291
|
} else {
|
|
174
|
-
stickyScroll.style.
|
|
292
|
+
stickyScroll.style.paddingRight = "".concat(stickyScrollHeight, "px"); // this.setState({
|
|
175
293
|
// hasScrollY: false
|
|
176
294
|
// })
|
|
177
295
|
|
|
@@ -188,9 +306,14 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
188
306
|
}, {
|
|
189
307
|
key: "renderTableHeader",
|
|
190
308
|
value: function renderTableHeader(info) {
|
|
191
|
-
var _this$
|
|
192
|
-
stickyTop = _this$
|
|
193
|
-
hasHeader = _this$
|
|
309
|
+
var _this$props3 = this.props,
|
|
310
|
+
stickyTop = _this$props3.stickyTop,
|
|
311
|
+
hasHeader = _this$props3.hasHeader;
|
|
312
|
+
var renderHeader = getTableRenderTemplate('header');
|
|
313
|
+
|
|
314
|
+
if (typeof renderHeader === 'function') {
|
|
315
|
+
return renderHeader(info, this.props);
|
|
316
|
+
}
|
|
194
317
|
|
|
195
318
|
return /*#__PURE__*/React.createElement("div", {
|
|
196
319
|
className: cx(Classes.tableHeader, 'no-scrollbar'),
|
|
@@ -200,6 +323,11 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
200
323
|
}
|
|
201
324
|
}, /*#__PURE__*/React.createElement(TableHeader, {
|
|
202
325
|
info: info
|
|
326
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
327
|
+
className: Classes.verticalScrollPlaceholder,
|
|
328
|
+
style: this.hasScrollY ? {
|
|
329
|
+
width: getScrollbarSize().width
|
|
330
|
+
} : undefined
|
|
203
331
|
}));
|
|
204
332
|
}
|
|
205
333
|
}, {
|
|
@@ -266,80 +394,6 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
266
394
|
return getFullRenderRange(rowCount);
|
|
267
395
|
}
|
|
268
396
|
}
|
|
269
|
-
}, {
|
|
270
|
-
key: "renderTableBody",
|
|
271
|
-
value: function renderTableBody(info) {
|
|
272
|
-
// console.log('render body')
|
|
273
|
-
var _this$props2 = this.props,
|
|
274
|
-
dataSource = _this$props2.dataSource,
|
|
275
|
-
getRowProps = _this$props2.getRowProps,
|
|
276
|
-
primaryKey = _this$props2.primaryKey,
|
|
277
|
-
isLoading = _this$props2.isLoading,
|
|
278
|
-
emptyCellHeight = _this$props2.emptyCellHeight,
|
|
279
|
-
footerDataSource = _this$props2.footerDataSource;
|
|
280
|
-
var tableBodyClassName = cx(Classes.tableBody, Classes.horizontalScrollContainer);
|
|
281
|
-
|
|
282
|
-
if (dataSource.length === 0) {
|
|
283
|
-
var _this$props3 = this.props,
|
|
284
|
-
components = _this$props3.components,
|
|
285
|
-
emptyContent = _this$props3.emptyContent;
|
|
286
|
-
var EmptyContent = components.EmptyContent;
|
|
287
|
-
|
|
288
|
-
if (EmptyContent == null && emptyContent != null) {
|
|
289
|
-
warnPropsDotEmptyContentIsDeprecated();
|
|
290
|
-
|
|
291
|
-
EmptyContent = function EmptyContent() {
|
|
292
|
-
return emptyContent;
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
297
|
-
className: cx(tableBodyClassName, 'empty')
|
|
298
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
299
|
-
className: Classes.virtual
|
|
300
|
-
}, /*#__PURE__*/React.createElement(EmptyHtmlTable, {
|
|
301
|
-
descriptors: info.visible,
|
|
302
|
-
isLoading: isLoading,
|
|
303
|
-
EmptyContent: EmptyContent,
|
|
304
|
-
emptyCellHeight: emptyCellHeight
|
|
305
|
-
})));
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
var _info$verticalRenderR = info.verticalRenderRange,
|
|
309
|
-
topIndex = _info$verticalRenderR.topIndex,
|
|
310
|
-
bottomBlank = _info$verticalRenderR.bottomBlank,
|
|
311
|
-
topBlank = _info$verticalRenderR.topBlank,
|
|
312
|
-
bottomIndex = _info$verticalRenderR.bottomIndex;
|
|
313
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
314
|
-
className: tableBodyClassName
|
|
315
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
316
|
-
className: Classes.virtual
|
|
317
|
-
}, topBlank > 0 && /*#__PURE__*/React.createElement("div", {
|
|
318
|
-
key: "top-blank",
|
|
319
|
-
className: cx(Classes.virtualBlank, 'top'),
|
|
320
|
-
style: {
|
|
321
|
-
height: topBlank
|
|
322
|
-
}
|
|
323
|
-
}), /*#__PURE__*/React.createElement(HtmlTable, {
|
|
324
|
-
tbodyHtmlTag: "tbody",
|
|
325
|
-
getRowProps: getRowProps,
|
|
326
|
-
primaryKey: primaryKey,
|
|
327
|
-
data: _sliceInstanceProperty(dataSource).call(dataSource, topIndex, bottomIndex),
|
|
328
|
-
horizontalRenderInfo: info,
|
|
329
|
-
verticalRenderInfo: {
|
|
330
|
-
first: 0,
|
|
331
|
-
offset: topIndex,
|
|
332
|
-
limit: bottomIndex,
|
|
333
|
-
last: dataSource.length - 1
|
|
334
|
-
}
|
|
335
|
-
}), bottomBlank > 0 && /*#__PURE__*/React.createElement("div", {
|
|
336
|
-
key: "bottom-blank",
|
|
337
|
-
className: cx(Classes.virtualBlank, 'bottom'),
|
|
338
|
-
style: {
|
|
339
|
-
height: bottomBlank
|
|
340
|
-
}
|
|
341
|
-
})));
|
|
342
|
-
}
|
|
343
397
|
}, {
|
|
344
398
|
key: "renderTableFooter",
|
|
345
399
|
value: function renderTableFooter(info) {
|
|
@@ -350,6 +404,17 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
350
404
|
getRowProps = _this$props4.getRowProps,
|
|
351
405
|
primaryKey = _this$props4.primaryKey,
|
|
352
406
|
stickyBottom = _this$props4.stickyBottom;
|
|
407
|
+
var renderFooter = getTableRenderTemplate('footer');
|
|
408
|
+
|
|
409
|
+
if (typeof renderFooter === 'function') {
|
|
410
|
+
return renderFooter(info, this.props, {
|
|
411
|
+
rowProps: {
|
|
412
|
+
onMouseEnter: this.handleRowMouseEnter,
|
|
413
|
+
onMouseLeave: this.handleRowMouseLeave
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
|
|
353
418
|
return /*#__PURE__*/React.createElement("div", {
|
|
354
419
|
className: cx(Classes.tableFooter, Classes.horizontalScrollContainer),
|
|
355
420
|
style: {
|
|
@@ -367,6 +432,12 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
367
432
|
last: footerDataSource.length - 1,
|
|
368
433
|
limit: Infinity
|
|
369
434
|
}
|
|
435
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
436
|
+
className: Classes.verticalScrollPlaceholder,
|
|
437
|
+
style: this.hasScrollY ? {
|
|
438
|
+
width: getScrollbarSize().width,
|
|
439
|
+
visibility: 'initial'
|
|
440
|
+
} : undefined
|
|
370
441
|
}));
|
|
371
442
|
}
|
|
372
443
|
}, {
|
|
@@ -435,7 +506,8 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
435
506
|
'has-header': hasHeader,
|
|
436
507
|
'sticky-header': isStickyHeader !== null && isStickyHeader !== void 0 ? isStickyHeader : isStickyHead,
|
|
437
508
|
'has-footer': footerDataSource.length > 0,
|
|
438
|
-
'sticky-footer': isStickyFooter
|
|
509
|
+
'sticky-footer': isStickyFooter,
|
|
510
|
+
'ie-polyfill-wrapper': browserType.isIE
|
|
439
511
|
}, className);
|
|
440
512
|
|
|
441
513
|
var artTableWrapperProps = _defineProperty({
|
|
@@ -454,7 +526,7 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
454
526
|
}, {
|
|
455
527
|
key: "componentDidMount",
|
|
456
528
|
value: function componentDidMount() {
|
|
457
|
-
var _a, _b; // console.log('did mount start')
|
|
529
|
+
var _a, _b, _c, _d; // console.log('did mount start')
|
|
458
530
|
// console.log('update dom helper start')
|
|
459
531
|
|
|
460
532
|
|
|
@@ -472,6 +544,7 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
472
544
|
enableCSSVariables: enableCSSVariables
|
|
473
545
|
});
|
|
474
546
|
(_b = (_a = this.props).setTableWidth) === null || _b === void 0 ? void 0 : _b.call(_a, this.domHelper.tableBody.clientWidth);
|
|
547
|
+
(_d = (_c = this.props).setTableDomHelper) === null || _d === void 0 ? void 0 : _d.call(_c, this.domHelper);
|
|
475
548
|
}
|
|
476
549
|
}, {
|
|
477
550
|
key: "componentDidUpdate",
|
|
@@ -504,7 +577,7 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
504
577
|
var currentHasFooter = this.props.footerDataSource.length > 0;
|
|
505
578
|
|
|
506
579
|
if (!prevHasFooter && currentHasFooter) {
|
|
507
|
-
this.domHelper.
|
|
580
|
+
getTableScrollFooterDOM(this.domHelper).scrollLeft = this.domHelper.tableBody.scrollLeft;
|
|
508
581
|
}
|
|
509
582
|
}
|
|
510
583
|
}
|
|
@@ -513,11 +586,9 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
513
586
|
value: function initSubscriptions() {
|
|
514
587
|
var _this2 = this;
|
|
515
588
|
|
|
516
|
-
var _this$
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
tableFooter = _this$domHelper2.tableFooter,
|
|
520
|
-
stickyScroll = _this$domHelper2.stickyScroll;
|
|
589
|
+
var _this$domHelper3 = this.domHelper,
|
|
590
|
+
virtual = _this$domHelper3.virtual,
|
|
591
|
+
stickyScroll = _this$domHelper3.stickyScroll;
|
|
521
592
|
this.rootSubscription.add(throttledWindowResize$.subscribe(function () {
|
|
522
593
|
_this2.updateStickyScroll();
|
|
523
594
|
|
|
@@ -535,36 +606,12 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
535
606
|
|
|
536
607
|
this.resizeObserver = addResizeObserver(this.domHelper.artTableWrapper, handleTableWrapperResize); // 滚动同步
|
|
537
608
|
|
|
538
|
-
this.rootSubscription.add(syncScrollLeft([
|
|
609
|
+
this.rootSubscription.add(syncScrollLeft([getTableScrollHeaderDOM(this.domHelper), virtual, getTableScrollFooterDOM(this.domHelper), stickyScroll], function (scrollLeft) {
|
|
539
610
|
_this2.syncHorizontalScroll(scrollLeft);
|
|
540
|
-
}));
|
|
541
|
-
|
|
542
|
-
var resolvedFlowRoot$ = this.props$.pipe(op.map(function (props) {
|
|
543
|
-
return props.flowRoot;
|
|
544
|
-
}), op.switchMap(function (flowRoot) {
|
|
545
|
-
var wrapper = _this2.domHelper.tableBody;
|
|
546
|
-
|
|
547
|
-
if (flowRoot === 'auto') {
|
|
548
|
-
var computedStyle = getComputedStyle(wrapper);
|
|
549
|
-
return of(computedStyle.overflowY !== 'visible' ? wrapper : window);
|
|
550
|
-
} else if (flowRoot === 'self') {
|
|
551
|
-
return of(wrapper);
|
|
552
|
-
} else {
|
|
553
|
-
if (typeof flowRoot === 'function') {
|
|
554
|
-
// 在一些情况下 flowRoot 需要在父组件 didMount 时才会准备好
|
|
555
|
-
// 故这里使用 animationFrameScheduler 等下一个动画帧
|
|
556
|
-
return timer(0, animationFrameScheduler).pipe(op.map(flowRoot));
|
|
557
|
-
} else {
|
|
558
|
-
return of(flowRoot);
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
}), op.distinctUntilChanged()); // 表格在 flowRoot 中的可见部分
|
|
562
|
-
|
|
563
|
-
var visiblePart$ = resolvedFlowRoot$.pipe(op.switchMap(function (resolvedFlowRoot) {
|
|
564
|
-
return getVisiblePartObservable(_this2.domHelper.virtual, resolvedFlowRoot);
|
|
565
|
-
})); // 每当可见部分发生变化的时候,调整 loading icon 的未知(如果 loading icon 存在的话)
|
|
611
|
+
}));
|
|
612
|
+
var richVisibleRects$ = getRichVisibleRectsStream(this.domHelper.virtual, this.props$.pipe(op.skip(1), op.mapTo('structure-may-change')), this.props.virtualDebugLabel).pipe(op.shareReplay()); // 每当可见部分发生变化的时候,调整 loading icon 的未知(如果 loading icon 存在的话)
|
|
566
613
|
|
|
567
|
-
this.rootSubscription.add(combineLatest([
|
|
614
|
+
this.rootSubscription.add(combineLatest([richVisibleRects$.pipe(op.map(function (p) {
|
|
568
615
|
return p.clipRect;
|
|
569
616
|
}), op.distinctUntilChanged(shallowEqual)), this.props$.pipe(op.startWith(null), op.pairwise(), op.filter(function (_ref2) {
|
|
570
617
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
@@ -582,12 +629,13 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
582
629
|
return;
|
|
583
630
|
}
|
|
584
631
|
|
|
585
|
-
var height = clipRect.bottom - clipRect.top;
|
|
632
|
+
var height = clipRect.bottom - clipRect.top; // fixme 这里的定位在有些特殊情况下可能会出错 see #132
|
|
633
|
+
|
|
586
634
|
loadingIndicator.style.top = "".concat(height / 2, "px");
|
|
587
635
|
loadingIndicator.style.marginTop = "".concat(height / 2, "px");
|
|
588
636
|
})); // 每当可见部分发生变化的时候,如果开启了虚拟滚动,则重新触发 render
|
|
589
637
|
|
|
590
|
-
this.rootSubscription.add(
|
|
638
|
+
this.rootSubscription.add(richVisibleRects$.pipe(op.filter(function () {
|
|
591
639
|
var _this2$lastInfo$useVi = _this2.lastInfo.useVirtual,
|
|
592
640
|
horizontal = _this2$lastInfo$useVi.horizontal,
|
|
593
641
|
vertical = _this2$lastInfo$useVi.vertical;
|
|
@@ -727,7 +775,6 @@ BaseTable.defaultProps = {
|
|
|
727
775
|
components: {},
|
|
728
776
|
getTableProps: noop,
|
|
729
777
|
getRowProps: noop,
|
|
730
|
-
flowRoot: 'auto',
|
|
731
778
|
dataSource: [],
|
|
732
779
|
useOuterBorder: true
|
|
733
780
|
};
|
package/es/table/base/utils.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { Subscription } from 'rxjs';
|
|
2
3
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
4
|
+
import { TableDOMHelper } from './helpers/TableDOMUtils';
|
|
3
5
|
/** styled-components 类库的版本,ali-react-table 同时支持 v3 和 v5 */
|
|
4
6
|
export declare const STYLED_VERSION: string;
|
|
5
7
|
export declare const STYLED_REF_PROP: string;
|
|
@@ -29,8 +31,9 @@ export declare function syncScrollLeft(elements: HTMLElement[], callback: (scrol
|
|
|
29
31
|
* Performs equality by iterating through keys on an object and returning false
|
|
30
32
|
* when any key has values which are not strictly equal between the arguments.
|
|
31
33
|
* Returns true when the values of all keys are strictly equal.
|
|
32
|
-
*
|
|
33
|
-
* 这个函数是从 facebook 某个官方库中复制过来的
|
|
34
34
|
*/
|
|
35
|
-
export declare function shallowEqual(objA:
|
|
35
|
+
export declare function shallowEqual<T>(objA: T, objB: T): boolean;
|
|
36
|
+
export declare function composeRowPropsGetter(getRowProps: (record: any, rowIndex: number) => React.HTMLAttributes<HTMLTableRowElement>, pendingRowProps?: React.HTMLAttributes<HTMLTableRowElement>): (record: any, rowIndex: number) => React.HTMLAttributes<HTMLTableRowElement>;
|
|
37
|
+
export declare function getTableScrollHeaderDOM(domHelper: TableDOMHelper): HTMLDivElement;
|
|
38
|
+
export declare function getTableScrollFooterDOM(domHelper: TableDOMHelper): HTMLDivElement;
|
|
36
39
|
export {};
|
package/es/table/base/utils.js
CHANGED
|
@@ -2,11 +2,10 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
|
|
|
2
2
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
3
3
|
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
4
4
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
5
|
-
import _getIterator from "@babel/runtime-corejs3/core-js/get-iterator";
|
|
6
5
|
import _typeof from "@babel/runtime-corejs3/helpers/typeof";
|
|
7
6
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
8
7
|
|
|
9
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it
|
|
8
|
+
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; } } }; }
|
|
10
9
|
|
|
11
10
|
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); }
|
|
12
11
|
|
|
@@ -19,6 +18,8 @@ import { asyncScheduler, BehaviorSubject, defer, fromEvent, Subscription } from
|
|
|
19
18
|
import { map, throttleTime } from 'rxjs/operators';
|
|
20
19
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
21
20
|
import * as styledComponents from 'styled-components';
|
|
21
|
+
import mergeCellProps from '../utils/mergeCellProps';
|
|
22
|
+
import { browserType } from '../utils';
|
|
22
23
|
/** styled-components 类库的版本,ali-react-table 同时支持 v3 和 v5 */
|
|
23
24
|
|
|
24
25
|
export var STYLED_VERSION = styledComponents.createGlobalStyle != null ? 'v5' : 'v3';
|
|
@@ -34,7 +35,9 @@ export function sum(arr) {
|
|
|
34
35
|
} // 使用 defer 避免过早引用 window,导致在 SSR 场景下报错
|
|
35
36
|
|
|
36
37
|
export var throttledWindowResize$ = defer(function () {
|
|
37
|
-
return fromEvent(window, 'resize'
|
|
38
|
+
return fromEvent(window, 'resize', {
|
|
39
|
+
passive: true
|
|
40
|
+
}).pipe(throttleTime(150, asyncScheduler, {
|
|
38
41
|
leading: true,
|
|
39
42
|
trailing: true
|
|
40
43
|
}));
|
|
@@ -161,11 +164,11 @@ export function syncScrollLeft(elements, callback) {
|
|
|
161
164
|
* Performs equality by iterating through keys on an object and returning false
|
|
162
165
|
* when any key has values which are not strictly equal between the arguments.
|
|
163
166
|
* Returns true when the values of all keys are strictly equal.
|
|
164
|
-
*
|
|
165
|
-
* 这个函数是从 facebook 某个官方库中复制过来的
|
|
166
167
|
*/
|
|
167
168
|
|
|
168
169
|
export function shallowEqual(objA, objB) {
|
|
170
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
171
|
+
|
|
169
172
|
if (_Object$is(objA, objB)) {
|
|
170
173
|
return true;
|
|
171
174
|
}
|
|
@@ -184,10 +187,28 @@ export function shallowEqual(objA, objB) {
|
|
|
184
187
|
|
|
185
188
|
|
|
186
189
|
for (var i = 0; i < keysA.length; i++) {
|
|
187
|
-
if (!
|
|
190
|
+
if (!hasOwnProperty.call(objB, keysA[i]) || !_Object$is(objA[keysA[i]], objB[keysA[i]])) {
|
|
188
191
|
return false;
|
|
189
192
|
}
|
|
190
193
|
}
|
|
191
194
|
|
|
192
195
|
return true;
|
|
196
|
+
} // todo: 抽出mergeRowProps
|
|
197
|
+
|
|
198
|
+
export function composeRowPropsGetter(getRowProps, pendingRowProps) {
|
|
199
|
+
var keys = _Object$keys(pendingRowProps);
|
|
200
|
+
|
|
201
|
+
if (keys.length) {
|
|
202
|
+
return function (row, rowIndex) {
|
|
203
|
+
return mergeCellProps(getRowProps(row, rowIndex), pendingRowProps);
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return getRowProps;
|
|
208
|
+
}
|
|
209
|
+
export function getTableScrollHeaderDOM(domHelper) {
|
|
210
|
+
return browserType.isIE ? domHelper.tableHeaderMain : domHelper.tableHeader;
|
|
211
|
+
}
|
|
212
|
+
export function getTableScrollFooterDOM(domHelper) {
|
|
213
|
+
return browserType.isIE ? domHelper.tableFooterMain : domHelper.tableFooter;
|
|
193
214
|
}
|
package/es/table/common-views.js
CHANGED
|
@@ -67,4 +67,4 @@ export var icons = {
|
|
|
67
67
|
CaretRight: CaretRightIcon,
|
|
68
68
|
Info: InfoIcon
|
|
69
69
|
};
|
|
70
|
-
export var ContextMenuStyleWrap = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &.", "{\n border: 1px solid #e9ecf1;\n border-radius: 2px;\n background-color: #Fff;\n box-shadow: 0px 0px 5px 0px rgb(154 154 154 / 50%);\n cursor: default;\n font-size: 13px;\n position:absolute;\n z-index: 1050;\n width:120px;\n }\n\n .", "{\n width:100%;\n display: table;\n }\n\n .", " .", "{\n display: table-row;\n }\n\n .", " .", "{\n background-color: #f5f5f5;\n }\n\n .", " .", " .", "{\n display: table-cell;\n padding: 5px 8px;\n
|
|
70
|
+
export var ContextMenuStyleWrap = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &.", "{\n border: 1px solid #e9ecf1;\n border-radius: 2px;\n background-color: #Fff;\n box-shadow: 0px 0px 5px 0px rgb(154 154 154 / 50%);\n cursor: default;\n font-size: 13px;\n position:absolute;\n z-index: 1050;\n width:120px;\n }\n\n .", "{\n width:100%;\n display: table;\n }\n\n .", " .", "{\n display: table-row;\n color: #666666;\n }\n\n .", " .", "{\n background-color: #f5f5f5;\n }\n\n .", " .", " .", "{\n display: table-cell;\n padding: 5px 8px;\n }\n .", " .", ".", "{\n opacity: .5;\n }\n\n"])), MenuClasses.menu, MenuClasses.menuList, MenuClasses.menuList, MenuClasses.menuOption, MenuClasses.menuList, MenuClasses.menuOptionActive, MenuClasses.menuList, MenuClasses.menuOption, MenuClasses.menuOptionText, MenuClasses.menuList, MenuClasses.menuOption, MenuClasses.menuOptionDisable);
|
|
@@ -3,6 +3,7 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
|
|
|
3
3
|
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
|
|
4
4
|
import { getLeftNestedLockCount } from '../../base/calculations';
|
|
5
5
|
import { isLeafNode, makeRecursiveMapper } from '../../utils';
|
|
6
|
+
import { Classes } from '../../base/styles';
|
|
6
7
|
export var FILL_COLUMN_CODE = '$_fill_column_&';
|
|
7
8
|
export var tableWidthKey = 'tableWidth';
|
|
8
9
|
var fillColumnWidthKey = 'fillColumnWidth';
|
|
@@ -26,10 +27,15 @@ export var autoFillTableWidth = function autoFillTableWidth() {
|
|
|
26
27
|
width: width,
|
|
27
28
|
features: {
|
|
28
29
|
resizeable: false
|
|
30
|
+
},
|
|
31
|
+
getCellProps: function getCellProps(value, record, rowIndex) {
|
|
32
|
+
return {
|
|
33
|
+
className: Classes.emptyColCell
|
|
34
|
+
};
|
|
29
35
|
}
|
|
30
36
|
};
|
|
31
37
|
|
|
32
|
-
_spliceInstanceProperty(columns).call(columns, spliceIndex, 0, _fillColumns);
|
|
38
|
+
_spliceInstanceProperty(columns).call(columns, spliceIndex || columns.length, 0, _fillColumns);
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
pipeline.columns(columns);
|