@kdcloudjs/table 1.2.2-canary.11 → 1.2.2-canary.12
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 +3169 -3413
- 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/calculations.js +3 -3
- package/es/table/base/empty.js +2 -2
- package/es/table/base/globalStyleComponent.d.ts +5 -1
- package/es/table/base/globalStyleComponent.js +11 -7
- package/es/table/base/header.js +19 -8
- package/es/table/base/helpers/SpanManager.js +2 -1
- package/es/table/base/helpers/TableDOMUtils.js +6 -5
- package/es/table/base/html-table.d.ts +1 -1
- package/es/table/base/html-table.js +16 -5
- package/es/table/base/interfaces.d.ts +2 -0
- package/es/table/base/loading.js +2 -2
- package/es/table/base/renderTemplates.js +16 -16
- package/es/table/base/styles.d.ts +2 -2
- package/es/table/base/styles.js +59 -4
- package/es/table/base/table.d.ts +1 -0
- package/es/table/base/table.js +42 -30
- package/es/table/base/utils.d.ts +1 -0
- package/es/table/base/utils.js +9 -3
- package/es/table/pipeline/features/colGroupExtendable.d.ts +1 -1
- package/es/table/pipeline/features/colGroupExtendable.js +7 -3
- package/es/table/pipeline/features/columnDrag.js +21 -12
- package/es/table/pipeline/features/columnFilter.js +5 -2
- package/es/table/pipeline/features/columnResizeWidth.js +11 -4
- package/es/table/pipeline/features/contextMenu.js +15 -8
- 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.d.ts +2 -1
- package/es/table/pipeline/features/filter/Filter.js +13 -8
- package/es/table/pipeline/features/filter/FilterPanel.d.ts +3 -1
- package/es/table/pipeline/features/filter/FilterPanel.js +15 -5
- 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 +47 -19
- 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 +10 -6
- 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-table/interfaces.d.ts +1 -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/element.d.ts +1 -1
- package/es/table/utils/element.js +5 -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/calculations.js +3 -3
- package/lib/table/base/empty.js +4 -4
- package/lib/table/base/globalStyleComponent.d.ts +5 -1
- package/lib/table/base/globalStyleComponent.js +16 -11
- package/lib/table/base/header.js +19 -8
- 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.d.ts +1 -1
- package/lib/table/base/html-table.js +16 -5
- package/lib/table/base/interfaces.d.ts +2 -0
- package/lib/table/base/loading.js +2 -2
- package/lib/table/base/renderTemplates.js +18 -18
- package/lib/table/base/styles.d.ts +2 -2
- package/lib/table/base/styles.js +74 -11
- package/lib/table/base/table.d.ts +1 -0
- package/lib/table/base/table.js +52 -41
- package/lib/table/base/utils.d.ts +1 -0
- package/lib/table/base/utils.js +28 -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.d.ts +1 -1
- package/lib/table/pipeline/features/colGroupExtendable.js +10 -5
- package/lib/table/pipeline/features/columnDrag.js +21 -12
- package/lib/table/pipeline/features/columnFilter.js +5 -2
- package/lib/table/pipeline/features/columnResizeWidth.js +19 -9
- package/lib/table/pipeline/features/contextMenu.js +16 -9
- 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.d.ts +2 -1
- package/lib/table/pipeline/features/filter/Filter.js +17 -11
- package/lib/table/pipeline/features/filter/FilterPanel.d.ts +3 -1
- package/lib/table/pipeline/features/filter/FilterPanel.js +19 -8
- 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 +53 -22
- 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 +10 -6
- 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-table/interfaces.d.ts +1 -1
- 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/element.d.ts +1 -1
- package/lib/table/utils/element.js +5 -3
- 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';
|
|
@@ -32,7 +32,7 @@ import { HtmlTable } from './html-table';
|
|
|
32
32
|
import Loading from './loading';
|
|
33
33
|
import { Classes, LOCK_SHADOW_PADDING, StyledArtTableWrapper } from './styles';
|
|
34
34
|
import GlobalStyleComponent from './globalStyleComponent';
|
|
35
|
-
import { addResizeObserver, getScrollbarSize, OVERSCAN_SIZE, shallowEqual, STYLED_REF_PROP, sum, syncScrollLeft, throttledWindowResize$, getTableScrollFooterDOM, getTableScrollHeaderDOM, cssPolifill } from './utils';
|
|
35
|
+
import { addResizeObserver, getScrollbarSize, OVERSCAN_SIZE, shallowEqual, STYLED_REF_PROP, sum, syncScrollLeft, throttledWindowResize$, getTableScrollFooterDOM, getTableScrollHeaderDOM, cssPolifill, swapRTLDirection } from './utils';
|
|
36
36
|
import { console, browserType, isStickyUIDegrade } from '../utils';
|
|
37
37
|
import getTableRenderTemplate from './renderTemplates';
|
|
38
38
|
var propsDotEmptyContentDeprecatedWarned = false;
|
|
@@ -43,10 +43,12 @@ function warnPropsDotEmptyContentIsDeprecated() {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
46
|
+
_inherits(BaseTable, _React$Component);
|
|
47
|
+
var _super = _createSuper(BaseTable);
|
|
46
48
|
function BaseTable(props) {
|
|
47
49
|
var _this;
|
|
48
50
|
_classCallCheck(this, BaseTable);
|
|
49
|
-
_this =
|
|
51
|
+
_this = _super.call(this, props);
|
|
50
52
|
_this.rowHeightManager = makeRowHeightManager(_this.props.dataSource.length, _this.props.estimatedRowHeight);
|
|
51
53
|
_this.artTableWrapperRef = /*#__PURE__*/React.createRef();
|
|
52
54
|
_this.hasScrollY = false;
|
|
@@ -121,13 +123,13 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
121
123
|
className: Classes.virtual,
|
|
122
124
|
tabIndex: -1,
|
|
123
125
|
style: virtualStyle
|
|
124
|
-
}, topBlank > 0 &&
|
|
126
|
+
}, topBlank > 0 && /*#__PURE__*/React.createElement("div", {
|
|
125
127
|
key: "top-blank",
|
|
126
128
|
className: cx(Classes.virtualBlank, 'top'),
|
|
127
129
|
style: {
|
|
128
130
|
height: topBlank
|
|
129
131
|
}
|
|
130
|
-
})
|
|
132
|
+
}), /*#__PURE__*/React.createElement(HtmlTable, {
|
|
131
133
|
tbodyHtmlTag: "tbody",
|
|
132
134
|
getRowProps: getRowProps,
|
|
133
135
|
primaryKey: primaryKey,
|
|
@@ -139,13 +141,13 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
139
141
|
limit: bottomIndex,
|
|
140
142
|
last: dataSource.length - 1
|
|
141
143
|
}
|
|
142
|
-
}), bottomBlank > 0 &&
|
|
144
|
+
}), bottomBlank > 0 && /*#__PURE__*/React.createElement("div", {
|
|
143
145
|
key: "bottom-blank",
|
|
144
146
|
className: cx(Classes.virtualBlank, 'bottom'),
|
|
145
147
|
style: {
|
|
146
148
|
height: bottomBlank
|
|
147
149
|
}
|
|
148
|
-
})))
|
|
150
|
+
})));
|
|
149
151
|
};
|
|
150
152
|
_this.state = {
|
|
151
153
|
hasScroll: true,
|
|
@@ -162,8 +164,7 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
162
164
|
return _this;
|
|
163
165
|
}
|
|
164
166
|
/** @deprecated BaseTable.getDoms() 已经过时,请勿调用 */
|
|
165
|
-
|
|
166
|
-
return _createClass(BaseTable, [{
|
|
167
|
+
_createClass(BaseTable, [{
|
|
167
168
|
key: "getDoms",
|
|
168
169
|
value: function getDoms() {
|
|
169
170
|
console.warn('[kd-table] BaseTable.getDoms() 已经过时');
|
|
@@ -281,11 +282,15 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
281
282
|
}, {
|
|
282
283
|
key: "syncHorizontalScroll",
|
|
283
284
|
value: function syncHorizontalScroll(x) {
|
|
284
|
-
this.
|
|
285
|
+
var direction = this.props.direction;
|
|
286
|
+
var _x = Math.abs(x);
|
|
287
|
+
this.updateOffsetX(_x);
|
|
285
288
|
var flat = _flatInstanceProperty(this.lastInfo);
|
|
289
|
+
var shouldShowLeftByScroll = _x > 0;
|
|
290
|
+
var shouldShowRighByScroll = _x < this.domHelper.virtual.scrollWidth - this.domHelper.virtual.clientWidth;
|
|
286
291
|
var leftLockShadow = this.domHelper.getLeftLockShadow();
|
|
287
292
|
if (leftLockShadow) {
|
|
288
|
-
var shouldShowLeftLockShadow = flat.left.length > 0 && this.state.needRenderLock &&
|
|
293
|
+
var shouldShowLeftLockShadow = flat.left.length > 0 && this.state.needRenderLock && shouldShowLeftByScroll;
|
|
289
294
|
if (shouldShowLeftLockShadow) {
|
|
290
295
|
leftLockShadow.classList.add('show-shadow');
|
|
291
296
|
} else {
|
|
@@ -294,7 +299,7 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
294
299
|
}
|
|
295
300
|
var rightLockShadow = this.domHelper.getRightLockShadow();
|
|
296
301
|
if (rightLockShadow) {
|
|
297
|
-
var shouldShowRightLockShadow = flat.right.length > 0 && this.state.needRenderLock &&
|
|
302
|
+
var shouldShowRightLockShadow = flat.right.length > 0 && this.state.needRenderLock && shouldShowRighByScroll;
|
|
298
303
|
if (shouldShowRightLockShadow) {
|
|
299
304
|
rightLockShadow.classList.add('show-shadow');
|
|
300
305
|
} else {
|
|
@@ -366,22 +371,19 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
366
371
|
}, {
|
|
367
372
|
key: "renderLockShadows",
|
|
368
373
|
value: function renderLockShadows(info) {
|
|
374
|
+
var _style, _style2;
|
|
369
375
|
var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0;
|
|
370
376
|
// console.log('render LockShadows')
|
|
377
|
+
var leftLockShadowWidth = info.leftLockTotalWidth + LOCK_SHADOW_PADDING;
|
|
378
|
+
var rightLockShadownWidth = info.rightLockTotalWidth + LOCK_SHADOW_PADDING + stickyRightOffset;
|
|
371
379
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
372
380
|
className: Classes.lockShadowMask,
|
|
373
|
-
style: {
|
|
374
|
-
left: 0,
|
|
375
|
-
width: info.leftLockTotalWidth + LOCK_SHADOW_PADDING
|
|
376
|
-
}
|
|
381
|
+
style: (_style = {}, _defineProperty(_style, swapRTLDirection(info.direction, 'left'), 0), _defineProperty(_style, "width", leftLockShadowWidth), _style)
|
|
377
382
|
}, /*#__PURE__*/React.createElement("div", {
|
|
378
383
|
className: cx(Classes.lockShadow, Classes.leftLockShadow)
|
|
379
384
|
})), /*#__PURE__*/React.createElement("div", {
|
|
380
385
|
className: Classes.lockShadowMask,
|
|
381
|
-
style: {
|
|
382
|
-
right: 0,
|
|
383
|
-
width: info.rightLockTotalWidth + LOCK_SHADOW_PADDING + stickyRightOffset
|
|
384
|
-
}
|
|
386
|
+
style: (_style2 = {}, _defineProperty(_style2, swapRTLDirection(info.direction, 'right'), 0), _defineProperty(_style2, "width", rightLockShadownWidth), _style2)
|
|
385
387
|
}, /*#__PURE__*/React.createElement("div", {
|
|
386
388
|
className: cx(Classes.lockShadow, Classes.rightLockShadow)
|
|
387
389
|
})));
|
|
@@ -445,6 +447,7 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
445
447
|
}, {
|
|
446
448
|
key: "render",
|
|
447
449
|
value: function render() {
|
|
450
|
+
var _cx;
|
|
448
451
|
// console.log('render table')
|
|
449
452
|
var info = calculateRenderInfo(this);
|
|
450
453
|
this.lastInfo = info;
|
|
@@ -461,8 +464,10 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
461
464
|
getTableProps = _this$props7.getTableProps,
|
|
462
465
|
footerDataSource = _this$props7.footerDataSource,
|
|
463
466
|
components = _this$props7.components,
|
|
464
|
-
bordered = _this$props7.bordered
|
|
465
|
-
|
|
467
|
+
bordered = _this$props7.bordered,
|
|
468
|
+
direction = _this$props7.direction;
|
|
469
|
+
info.direction = direction;
|
|
470
|
+
var artTableWrapperClassName = cx(Classes.artTableWrapper, (_cx = {
|
|
466
471
|
'use-outer-border': useOuterBorder,
|
|
467
472
|
empty: dataSource.length === 0,
|
|
468
473
|
lock: info.hasLockColumn,
|
|
@@ -470,13 +475,19 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
470
475
|
'sticky-header': isStickyHeader !== null && isStickyHeader !== void 0 ? isStickyHeader : isStickyHead,
|
|
471
476
|
'has-footer': footerDataSource.length > 0,
|
|
472
477
|
'sticky-footer': isStickyFooter
|
|
473
|
-
}, Classes.artTableBordered, bordered), 'ie-polyfill-wrapper', browserType.isIE), 'sticky-polyfill-wrapper', isStickyUIDegrade()), className);
|
|
478
|
+
}, _defineProperty(_cx, Classes.artTableBordered, bordered), _defineProperty(_cx, 'ie-polyfill-wrapper', browserType.isIE), _defineProperty(_cx, 'sticky-polyfill-wrapper', isStickyUIDegrade()), _cx), className);
|
|
474
479
|
var artTableWrapperProps = _defineProperty({
|
|
475
480
|
className: artTableWrapperClassName,
|
|
476
|
-
style: style
|
|
481
|
+
style: _extends(_extends({}, style), {
|
|
482
|
+
direction: direction
|
|
483
|
+
})
|
|
477
484
|
}, STYLED_REF_PROP, this.artTableWrapperRef);
|
|
478
485
|
var tableProps = getTableProps() || {};
|
|
479
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GlobalStyleComponent,
|
|
486
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GlobalStyleComponent, {
|
|
487
|
+
direction: info.direction
|
|
488
|
+
}), /*#__PURE__*/React.createElement(StyledArtTableWrapper, _extends({}, artTableWrapperProps, {
|
|
489
|
+
direction: info.direction
|
|
490
|
+
}), /*#__PURE__*/React.createElement(Loading, {
|
|
480
491
|
visible: isLoading,
|
|
481
492
|
LoadingIcon: components.LoadingIcon,
|
|
482
493
|
LoadingContentWrapper: components.LoadingContentWrapper
|
|
@@ -750,6 +761,7 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
750
761
|
}
|
|
751
762
|
}
|
|
752
763
|
}]);
|
|
764
|
+
return BaseTable;
|
|
753
765
|
}(React.Component);
|
|
754
766
|
BaseTable.defaultProps = {
|
|
755
767
|
hasHeader: true,
|
package/es/table/base/utils.d.ts
CHANGED
|
@@ -43,4 +43,5 @@ export declare const cssPolifill: ({ variables, enableCSSVariables, bordered }:
|
|
|
43
43
|
enableCSSVariables?: boolean;
|
|
44
44
|
bordered?: boolean;
|
|
45
45
|
}) => void;
|
|
46
|
+
export declare const swapRTLDirection: (direction: string, directionKey: 'left' | 'right') => 'left' | 'right';
|
|
46
47
|
export {};
|
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";
|
|
@@ -205,4 +205,10 @@ export var cssPolifill = function cssPolifill(_ref) {
|
|
|
205
205
|
watch: true,
|
|
206
206
|
silent: true
|
|
207
207
|
});
|
|
208
|
+
};
|
|
209
|
+
export var swapRTLDirection = function swapRTLDirection(direction, directionKey) {
|
|
210
|
+
var isRTL = direction === 'rtl';
|
|
211
|
+
if (directionKey === 'left' && isRTL) return 'right';
|
|
212
|
+
if (directionKey === 'right' && isRTL) return 'left';
|
|
213
|
+
return directionKey;
|
|
208
214
|
};
|
|
@@ -9,7 +9,10 @@ import { internals } from '../../internals';
|
|
|
9
9
|
import { makeRecursiveMapper } from '../../utils';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import { Classes } from '../../base/styles';
|
|
12
|
-
|
|
12
|
+
import { swapRTLDirection } from '../../base/utils';
|
|
13
|
+
var ExtendIconStyle = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size:12px;\n margin-", ":4px;\n"])), function (props) {
|
|
14
|
+
return swapRTLDirection(props.direction, 'left');
|
|
15
|
+
});
|
|
13
16
|
var stateKey = 'colExtend';
|
|
14
17
|
var ExpandIcon = function ExpandIcon(_ref) {
|
|
15
18
|
var style = _ref.style,
|
|
@@ -56,13 +59,14 @@ export var colGroupExtendable = function colGroupExtendable() {
|
|
|
56
59
|
var addIconNode = /*#__PURE__*/React.createElement(React.Fragment, null, internals.safeRenderHeader(_extends({}, col)), /*#__PURE__*/React.createElement(ExtendIconStyle, {
|
|
57
60
|
onClick: function onClick() {
|
|
58
61
|
toggle(col);
|
|
59
|
-
}
|
|
62
|
+
},
|
|
63
|
+
direction: pipeline.ctx.direction
|
|
60
64
|
}, displaycolExtendIcon || /*#__PURE__*/React.createElement(ExpandIcon, {
|
|
61
65
|
style: {
|
|
62
66
|
userSelect: 'none',
|
|
63
67
|
marginLeft: 2,
|
|
64
68
|
flexShrink: 0,
|
|
65
|
-
cursor:
|
|
69
|
+
cursor: 'pointer',
|
|
66
70
|
verticalAlign: 'middle'
|
|
67
71
|
},
|
|
68
72
|
className: cx(_defineProperty({}, Classes.tableExtendIcon, true)),
|
|
@@ -24,9 +24,16 @@ function sortColumns(columns, sort) {
|
|
|
24
24
|
function stopClickPropagation(e) {
|
|
25
25
|
e.stopPropagation();
|
|
26
26
|
}
|
|
27
|
+
function adjustTranslation(isRTL) {
|
|
28
|
+
return function (value) {
|
|
29
|
+
return isRTL ? -value : value;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
27
32
|
export function columnDrag() {
|
|
28
33
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
29
34
|
return function (pipeline) {
|
|
35
|
+
var direction = pipeline.ctx.direction;
|
|
36
|
+
var _adjustTranslation = adjustTranslation(direction === 'rtl');
|
|
30
37
|
var _pipeline$getStateAtK = pipeline.getStateAtKey(stateKey, {}),
|
|
31
38
|
cloumnsTranslateData = _pipeline$getStateAtK.cloumnsTranslateData;
|
|
32
39
|
var columns = pipeline.getColumns();
|
|
@@ -78,7 +85,7 @@ export function columnDrag() {
|
|
|
78
85
|
});
|
|
79
86
|
var currentTarget = e.currentTarget;
|
|
80
87
|
var rect = e.currentTarget.parentElement.getClientRects()[0];
|
|
81
|
-
var startX = rect.left;
|
|
88
|
+
var startX = direction === 'rtl' ? rect.right : rect.left;
|
|
82
89
|
var mouseDownClientX = e.clientX;
|
|
83
90
|
var mouseDownClientY = e.clientY;
|
|
84
91
|
var moveData = [];
|
|
@@ -102,9 +109,10 @@ export function columnDrag() {
|
|
|
102
109
|
clientY: e.clientY
|
|
103
110
|
};
|
|
104
111
|
var scrollDistance = pipeline.ref.current.domHelper.virtual.scrollLeft - startScrollLeft;
|
|
105
|
-
var
|
|
112
|
+
var startPosition = startX - scrollDistance; // 表头最左边起点
|
|
113
|
+
var offsetDistance = direction === 'rtl' ? startPosition - e.clientX : e.clientX - startPosition;
|
|
106
114
|
updateScrollPosition(client);
|
|
107
|
-
if (
|
|
115
|
+
if (offsetDistance < 20) {
|
|
108
116
|
return;
|
|
109
117
|
} else {
|
|
110
118
|
e.stopPropagation();
|
|
@@ -141,7 +149,7 @@ export function columnDrag() {
|
|
|
141
149
|
// 计算平移位置
|
|
142
150
|
var replaceIndex = 0;
|
|
143
151
|
var totalWitdth = getColumnWidth(columns[replaceIndex]);
|
|
144
|
-
while (totalWitdth <
|
|
152
|
+
while (totalWitdth < offsetDistance && replaceIndex < columns.length - 1) {
|
|
145
153
|
replaceIndex++;
|
|
146
154
|
totalWitdth += getColumnWidth(columns[replaceIndex]);
|
|
147
155
|
}
|
|
@@ -166,12 +174,12 @@ export function columnDrag() {
|
|
|
166
174
|
code: code,
|
|
167
175
|
lock: lock
|
|
168
176
|
})) {
|
|
169
|
-
cloumnsTranslateData[code] += optionColumn.width;
|
|
177
|
+
cloumnsTranslateData[code] += _adjustTranslation(optionColumn.width);
|
|
170
178
|
if (isLeafNode(columns[index])) {
|
|
171
|
-
cloumnsTranslateData[optionColumn.code] -= width;
|
|
179
|
+
cloumnsTranslateData[optionColumn.code] -= _adjustTranslation(width);
|
|
172
180
|
} else {
|
|
173
|
-
cloumnsTranslateData[optionColumn.code] -= getColumnWidth(columns[index]);
|
|
174
|
-
moveAllChildren(children, cloumnsTranslateData, optionColumn.width);
|
|
181
|
+
cloumnsTranslateData[optionColumn.code] -= _adjustTranslation(getColumnWidth(columns[index]));
|
|
182
|
+
moveAllChildren(children, cloumnsTranslateData, _adjustTranslation(optionColumn.width));
|
|
175
183
|
}
|
|
176
184
|
columnMoved = true;
|
|
177
185
|
}
|
|
@@ -189,12 +197,12 @@ export function columnDrag() {
|
|
|
189
197
|
code: _code,
|
|
190
198
|
lock: _lock
|
|
191
199
|
})) {
|
|
192
|
-
cloumnsTranslateData[_code] -= optionColumn.width;
|
|
200
|
+
cloumnsTranslateData[_code] -= _adjustTranslation(optionColumn.width);
|
|
193
201
|
if (isLeafNode(columns[index])) {
|
|
194
|
-
cloumnsTranslateData[optionColumn.code] += _width;
|
|
202
|
+
cloumnsTranslateData[optionColumn.code] += _adjustTranslation(_width);
|
|
195
203
|
} else {
|
|
196
|
-
cloumnsTranslateData[optionColumn.code] += getColumnWidth(columns[index]);
|
|
197
|
-
moveAllChildren(_children, cloumnsTranslateData, optionColumn.width, true);
|
|
204
|
+
cloumnsTranslateData[optionColumn.code] += _adjustTranslation(getColumnWidth(columns[index]));
|
|
205
|
+
moveAllChildren(_children, cloumnsTranslateData, _adjustTranslation(optionColumn.width), true);
|
|
198
206
|
}
|
|
199
207
|
columnMoved = true;
|
|
200
208
|
}
|
|
@@ -216,6 +224,7 @@ export function columnDrag() {
|
|
|
216
224
|
e.stopPropagation(); // 存在移动就阻止冒泡
|
|
217
225
|
currentTarget.addEventListener('click', stopClickPropagation); // 阻止列头点击事件,防止拖动后触发列头过滤事件
|
|
218
226
|
}
|
|
227
|
+
|
|
219
228
|
window.requestAnimationFrame(function () {
|
|
220
229
|
// 取消阻止列头点击事件
|
|
221
230
|
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,12 +80,13 @@ 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,
|
|
86
87
|
getPopupParent: getPopupParent,
|
|
87
|
-
localeText: localeText
|
|
88
|
+
localeText: localeText,
|
|
89
|
+
direction: pipeline.ctx.direction
|
|
88
90
|
});
|
|
89
91
|
if (col.renderHeader) {
|
|
90
92
|
result.title = col.renderHeader(result.title, _Filter);
|
|
@@ -98,6 +100,7 @@ export function filter() {
|
|
|
98
100
|
// }
|
|
99
101
|
// })
|
|
100
102
|
}
|
|
103
|
+
|
|
101
104
|
if (!isLeafNode(col)) {
|
|
102
105
|
var _context3;
|
|
103
106
|
result.children = _mapInstanceProperty(_context3 = col.children).call(_context3, dfs);
|
|
@@ -11,7 +11,12 @@ import * as op from 'rxjs/operators';
|
|
|
11
11
|
import { mergeCellProps, collectNodes, makeRecursiveMapper, isGroupColumn } from '../../utils';
|
|
12
12
|
import { internals } from '../../internals';
|
|
13
13
|
import { Classes } from '../../base/styles';
|
|
14
|
-
|
|
14
|
+
import { swapRTLDirection } from '../../base/utils';
|
|
15
|
+
var TableHeaderCellResize = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n ", ": -5px;\n height: 100%;\n width: 10px;\n cursor: ew-resize;\n display: flex;\n flex-direction: column;\n align-items: center;\n z-index:1;\n\n &:after {\n content: \"\";\n position: absolute;\n display: block;\n ", ": calc(50% - 1px);\n width: 1px;\n height: calc(100% - 14px);\n top: 7px;\n }\n"])), function (props) {
|
|
16
|
+
return swapRTLDirection(props.direction, 'right');
|
|
17
|
+
}, function (props) {
|
|
18
|
+
return swapRTLDirection(props.direction, 'left');
|
|
19
|
+
});
|
|
15
20
|
var TableHeaderGroupCellResize = styled(function (props) {
|
|
16
21
|
return /*#__PURE__*/React.createElement(TableHeaderCellResize, _extends({}, props));
|
|
17
22
|
})(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &:after {\n height: 100%;\n top: 0;\n }\n"])));
|
|
@@ -78,7 +83,7 @@ export function columnResize() {
|
|
|
78
83
|
var nextSize$ = fromEvent(window, 'mousemove').pipe(op.takeUntil(fromEvent(window, 'mouseup')), op.map(function (e) {
|
|
79
84
|
var movingX = e.clientX;
|
|
80
85
|
var nextColumnSize = _extends({}, columnSize);
|
|
81
|
-
var deltaSum = movingX - startX;
|
|
86
|
+
var deltaSum = pipeline.ctx.direction === 'rtl' ? startX - movingX : movingX - startX;
|
|
82
87
|
var deltaRemaining = deltaSum;
|
|
83
88
|
if ((children === null || children === void 0 ? void 0 : children.length) > 0) {
|
|
84
89
|
var leafChildColumns = collectNodes(children, 'leaf-only');
|
|
@@ -143,7 +148,8 @@ export function columnResize() {
|
|
|
143
148
|
width = col.width;
|
|
144
149
|
return _extends(_extends({}, col), {
|
|
145
150
|
width: (_a = columnSize[code]) !== null && _a !== void 0 ? _a : width,
|
|
146
|
-
title:
|
|
151
|
+
title: /*#__PURE__*/React.createElement(React.Fragment, null, prevTitle, (features === null || features === void 0 ? void 0 : features.resizeable) !== false && (isGroup ? /*#__PURE__*/React.createElement(TableHeaderGroupCellResize, {
|
|
152
|
+
direction: pipeline.ctx.direction,
|
|
147
153
|
className: Classes.tableHeaderCellResize,
|
|
148
154
|
onDoubleClick: function onDoubleClick(e) {
|
|
149
155
|
return handleDoubleClick(e, col);
|
|
@@ -152,6 +158,7 @@ export function columnResize() {
|
|
|
152
158
|
return handleMouseDown(e, col);
|
|
153
159
|
}
|
|
154
160
|
}) : /*#__PURE__*/React.createElement(TableHeaderCellResize, {
|
|
161
|
+
direction: pipeline.ctx.direction,
|
|
155
162
|
className: Classes.tableHeaderCellResize,
|
|
156
163
|
onDoubleClick: function onDoubleClick(e) {
|
|
157
164
|
return handleDoubleClick(e, col);
|
|
@@ -159,7 +166,7 @@ export function columnResize() {
|
|
|
159
166
|
onMouseDown: function onMouseDown(e) {
|
|
160
167
|
return handleMouseDown(e, col);
|
|
161
168
|
}
|
|
162
|
-
})))
|
|
169
|
+
}))),
|
|
163
170
|
headerCellProps: mergeCellProps(col.headerCellProps, {
|
|
164
171
|
className: 'resizeable'
|
|
165
172
|
})
|
|
@@ -3,7 +3,7 @@ import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
|
3
3
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
4
4
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
5
5
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
6
|
-
import React, { useRef,
|
|
6
|
+
import React, { useRef, useLayoutEffect } from 'react';
|
|
7
7
|
import ReactDOM from 'react-dom';
|
|
8
8
|
import cx from 'classnames';
|
|
9
9
|
import { ContextMenuStyleWrap } from '../../common-views';
|
|
@@ -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)) {
|
|
@@ -106,7 +106,8 @@ export function contextMenu() {
|
|
|
106
106
|
hideContextMenu: hideContextMenu,
|
|
107
107
|
position: position,
|
|
108
108
|
getPopupParent: getPopupParent,
|
|
109
|
-
className: menuClassName
|
|
109
|
+
className: menuClassName,
|
|
110
|
+
direction: pipeline.ctx.direction
|
|
110
111
|
});
|
|
111
112
|
var _hidePopup = addPopup(menu);
|
|
112
113
|
menuHelper.init(_hidePopup);
|
|
@@ -136,18 +137,22 @@ function Menu(props) {
|
|
|
136
137
|
position = props.position,
|
|
137
138
|
getPopupParent = props.getPopupParent;
|
|
138
139
|
var menuRef = useRef();
|
|
139
|
-
|
|
140
|
+
useLayoutEffect(function () {
|
|
140
141
|
if (menuRef.current) {
|
|
141
142
|
var popupParent = getPopupParent();
|
|
142
143
|
var x = position.x,
|
|
143
144
|
y = position.y;
|
|
145
|
+
var isRTL = props.direction === 'rtl';
|
|
146
|
+
if (isRTL) {
|
|
147
|
+
x -= menuRef.current.offsetWidth;
|
|
148
|
+
}
|
|
144
149
|
var _keepWithinBounds = keepWithinBounds(popupParent, menuRef.current, x, y),
|
|
145
150
|
_x = _keepWithinBounds.x,
|
|
146
151
|
_y = _keepWithinBounds.y;
|
|
147
152
|
menuRef.current.style.left = _x + 'px';
|
|
148
153
|
menuRef.current.style.top = _y + 'px';
|
|
149
154
|
}
|
|
150
|
-
}, [position]);
|
|
155
|
+
}, [position, props.direction]);
|
|
151
156
|
return /*#__PURE__*/React.createElement(ContextMenuStyleWrap, {
|
|
152
157
|
className: cx(MenuClasses.menu, className),
|
|
153
158
|
ref: menuRef,
|
|
@@ -284,10 +289,12 @@ function keepWithinBounds(popupParent, ePopup, x, y) {
|
|
|
284
289
|
var maxX = parentWidth - minWidth;
|
|
285
290
|
x = Math.min(Math.max(x, 0), Math.abs(maxX)); // 目前位置,最大支持的位置
|
|
286
291
|
}
|
|
292
|
+
|
|
287
293
|
if (y) {
|
|
288
294
|
var maxY = parentHeight - ePopupRect.height;
|
|
289
295
|
y = Math.min(Math.max(y, 0), Math.abs(maxY)); // 目前位置,最大支持的位置
|
|
290
296
|
}
|
|
297
|
+
|
|
291
298
|
return {
|
|
292
299
|
x: x,
|
|
293
300
|
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
|
}
|
|
@@ -18,6 +18,7 @@ interface FilterProps {
|
|
|
18
18
|
localeText?: {
|
|
19
19
|
[key: string]: string;
|
|
20
20
|
};
|
|
21
|
+
direction?: string;
|
|
21
22
|
}
|
|
22
|
-
declare function Filter({ size, style, className, FilterPanelContent, filterIcon, setFilter, setFilterModel, filterModel, isFilterActive, stopClickEventPropagation, stopESCKeyDownEventPropagation, hideFilterPopupHeader, getPopupParent, localeText }: FilterProps): JSX.Element;
|
|
23
|
+
declare function Filter({ size, style, className, FilterPanelContent, filterIcon, setFilter, setFilterModel, filterModel, isFilterActive, stopClickEventPropagation, stopESCKeyDownEventPropagation, hideFilterPopupHeader, getPopupParent, localeText, direction }: FilterProps): JSX.Element;
|
|
23
24
|
export default Filter;
|