@kdcloudjs/table 1.2.1-canary.6 → 1.2.2-canary.3
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 +5480 -6087
- package/dist/@kdcloudjs/table.js.map +1 -1
- package/dist/@kdcloudjs/table.min.css +1 -1
- package/dist/@kdcloudjs/table.min.js +18 -16
- package/dist/@kdcloudjs/table.min.js.map +1 -1
- package/dist/kd-ui-complete.less +777 -777
- package/es/_utils/arrayUtil.js +0 -3
- package/es/_utils/devwarning.js +0 -1
- package/es/_utils/formatUtil.js +36 -101
- package/es/_utils/hooks.js +21 -45
- package/es/_utils/index.js +0 -2
- package/es/_utils/numberUtil.js +32 -55
- package/es/_utils/omit.js +0 -2
- package/es/_utils/type.js +0 -2
- package/es/_utils/usePopper.js +81 -144
- package/es/config-provider/compDefaultProps.js +0 -1
- package/es/config-provider/configProvider.js +2 -7
- package/es/config-provider/defaultConfig.js +0 -1
- package/es/index.js +0 -2
- package/es/locale/locale.js +11 -50
- 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 +25 -75
- package/es/table/base/colgroup.js +0 -1
- package/es/table/base/empty.js +6 -6
- package/es/table/base/globalStyleComponent.d.ts +4 -0
- package/es/table/base/globalStyleComponent.js +24 -0
- package/es/table/base/header.js +21 -76
- package/es/table/base/helpers/SpanManager.js +4 -11
- package/es/table/base/helpers/TableDOMUtils.js +9 -34
- package/es/table/base/helpers/__test__/SpanManager.test.js +2 -2
- package/es/table/base/helpers/__test__/TableDOMUtils.test.js +0 -1
- package/es/table/base/helpers/getRichVisibleRectsStream.js +13 -45
- package/es/table/base/helpers/rowHeightManager.js +0 -28
- package/es/table/base/html-table.js +17 -39
- package/es/table/base/loading.js +8 -10
- package/es/table/base/renderTemplates.js +42 -60
- package/es/table/base/styles.d.ts +10 -0
- package/es/table/base/styles.js +17 -16
- package/es/table/base/table.js +113 -201
- package/es/table/base/utils.js +17 -57
- package/es/table/common-views.js +0 -7
- package/es/table/interfaces.d.ts +38 -0
- package/es/table/internals.js +0 -13
- package/es/table/pipeline/const.d.ts +3 -0
- package/es/table/pipeline/const.js +3 -0
- package/es/table/pipeline/features/autoFill.js +11 -40
- package/es/table/pipeline/features/autoRowSpan.js +1 -14
- package/es/table/pipeline/features/colGroupExtendable.js +4 -19
- package/es/table/pipeline/features/columnDrag.js +41 -97
- package/es/table/pipeline/features/columnFilter.js +12 -51
- package/es/table/pipeline/features/columnHover.js +1 -7
- package/es/table/pipeline/features/columnRangeHover.js +1 -8
- package/es/table/pipeline/features/columnResizeWidth.js +13 -39
- package/es/table/pipeline/features/contextMenu.js +22 -95
- package/es/table/pipeline/features/featureApi/RowDragApi.d.ts +15 -0
- package/es/table/pipeline/features/featureApi/RowDragApi.js +66 -0
- package/es/table/pipeline/features/featureApi/utils.d.ts +2 -0
- package/es/table/pipeline/features/featureApi/utils.js +10 -0
- package/es/table/pipeline/features/filter/DefaultFilterContent.js +14 -30
- package/es/table/pipeline/features/filter/DefaultFilterIcon.js +1 -1
- package/es/table/pipeline/features/filter/Filter.js +27 -51
- package/es/table/pipeline/features/filter/FilterPanel.js +11 -25
- package/es/table/pipeline/features/filter/util.js +0 -4
- package/es/table/pipeline/features/footerDataSource.js +0 -3
- package/es/table/pipeline/features/mergeCellHover.js +0 -1
- package/es/table/pipeline/features/multiSelect.js +15 -57
- package/es/table/pipeline/features/rangeSelection.js +73 -152
- package/es/table/pipeline/features/rowDetail.js +4 -43
- package/es/table/pipeline/features/rowDrag.d.ts +10 -12
- package/es/table/pipeline/features/rowDrag.js +491 -236
- package/es/table/pipeline/features/rowGrouping.js +4 -37
- package/es/table/pipeline/features/singleSelect.js +0 -24
- package/es/table/pipeline/features/sort.js +38 -96
- package/es/table/pipeline/features/tips.js +4 -10
- package/es/table/pipeline/features/treeMode.d.ts +1 -0
- package/es/table/pipeline/features/treeMode.js +38 -57
- package/es/table/pipeline/features/treeSelect.js +2 -28
- package/es/table/pipeline/pipeline.d.ts +3 -0
- package/es/table/pipeline/pipeline.js +35 -54
- package/es/table/pivot/cross-table/buildCrossTable.js +21 -72
- package/es/table/pivot/cross-table/cross-table.js +23 -31
- package/es/table/pivot/cross-tree-table/buildCrossTreeTable.js +22 -57
- package/es/table/pivot/cross-tree-table/cross-tree-table.js +36 -61
- package/es/table/pivot/pivot-utils/buildDrillTree.js +10 -23
- package/es/table/pivot/pivot-utils/builders.js +34 -74
- package/es/table/pivot/pivot-utils/convert-utils.js +16 -42
- package/es/table/pivot/pivot-utils/simpleEncode.js +0 -1
- package/es/table/style/index.less +1 -1
- package/es/table/transforms/autoRowSpan.js +1 -15
- package/es/table/transforms/autoWidth.js +13 -35
- package/es/table/transforms/buildTree.js +1 -2
- package/es/table/transforms/columnHover.js +9 -15
- package/es/table/transforms/columnRangeHover.js +12 -19
- package/es/table/transforms/columnResize.js +18 -42
- package/es/table/transforms/flatten.js +0 -3
- package/es/table/transforms/orderField.js +0 -3
- package/es/table/transforms/sort.js +42 -101
- package/es/table/transforms/tips.js +5 -10
- package/es/table/transforms/treeMode.js +36 -77
- package/es/table/transforms/visible.js +0 -2
- package/es/table/use/useResizeObserver.js +1 -4
- package/es/table/utils/applyTransforms.js +0 -1
- package/es/table/utils/browserType.js +12 -19
- package/es/table/utils/buildTree.js +7 -22
- package/es/table/utils/collectNodes.js +4 -13
- package/es/table/utils/console.js +0 -14
- package/es/table/utils/copyToClipboard.js +0 -4
- package/es/table/utils/element.js +14 -41
- package/es/table/utils/exportTableAsExcel.js +7 -43
- package/es/table/utils/getTreeDepth.js +4 -12
- package/es/table/utils/groupBy.js +4 -13
- package/es/table/utils/layeredFilter.js +0 -4
- package/es/table/utils/layeredSort.js +0 -5
- package/es/table/utils/makeRecursiveMapper.js +4 -15
- package/es/table/utils/mergeCellProps.js +6 -14
- package/es/table/utils/others.js +6 -19
- package/es/table/utils/proto.js +2 -30
- package/es/table/utils/smartCompare.js +4 -12
- package/es/table/utils/traverseColumn.js +5 -18
- package/es/table/utils/tree-data-helpers/StrictTreeDataHelper.js +8 -30
- package/es/table/utils/tree-data-helpers/TreeDataHelper.js +19 -74
- package/es/table/utils/uiDegrade.js +0 -5
- package/lib/_utils/arrayUtil.js +2 -8
- package/lib/_utils/devwarning.js +0 -5
- package/lib/_utils/formatUtil.js +36 -105
- package/lib/_utils/hooks.js +21 -56
- package/lib/_utils/index.js +2 -9
- package/lib/_utils/numberUtil.js +32 -63
- package/lib/_utils/omit.js +0 -5
- package/lib/_utils/react-children.js +0 -5
- package/lib/_utils/type.js +3 -11
- package/lib/_utils/usePopper.js +86 -173
- package/lib/config-provider/ConfigContext.js +2 -6
- package/lib/config-provider/compDefaultProps.js +1 -3
- package/lib/config-provider/configProvider.js +6 -22
- package/lib/config-provider/defaultConfig.js +1 -7
- package/lib/config-provider/index.js +1 -8
- package/lib/index.js +2 -8
- package/lib/locale/index.js +3 -11
- package/lib/locale/locale.js +15 -71
- package/lib/locale/zh-CN.js +1 -2
- 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 +25 -86
- package/lib/table/base/colgroup.js +0 -5
- package/lib/table/base/empty.js +8 -20
- package/lib/table/base/globalStyleComponent.d.ts +4 -0
- package/lib/table/base/globalStyleComponent.js +35 -0
- package/lib/table/base/header.js +21 -86
- package/lib/table/base/helpers/SpanManager.js +6 -16
- package/lib/table/base/helpers/TableDOMUtils.js +9 -37
- package/lib/table/base/helpers/__test__/SpanManager.test.js +2 -4
- package/lib/table/base/helpers/__test__/TableDOMUtils.test.js +0 -5
- package/lib/table/base/helpers/__test__/rowHeightManager.test.js +0 -1
- package/lib/table/base/helpers/getRichVisibleRectsStream.js +15 -65
- package/lib/table/base/helpers/rowHeightManager.js +0 -33
- package/lib/table/base/html-table.js +17 -49
- package/lib/table/base/index.js +0 -2
- package/lib/table/base/loading.js +8 -14
- package/lib/table/base/renderTemplates.js +45 -76
- package/lib/table/base/styles.d.ts +10 -0
- package/lib/table/base/styles.js +24 -42
- package/lib/table/base/table.js +125 -245
- package/lib/table/base/utils.js +27 -109
- package/lib/table/common-views.js +4 -24
- package/lib/table/index.js +0 -13
- package/lib/table/interfaces.d.ts +38 -0
- package/lib/table/internals.js +2 -17
- package/lib/table/pipeline/const.d.ts +3 -0
- package/lib/table/pipeline/const.js +9 -0
- package/lib/table/pipeline/features/autoFill.js +14 -53
- package/lib/table/pipeline/features/autoRowSpan.js +1 -19
- package/lib/table/pipeline/features/buildTree.js +0 -2
- package/lib/table/pipeline/features/colGroupExtendable.js +6 -35
- package/lib/table/pipeline/features/columnDrag.js +41 -103
- package/lib/table/pipeline/features/columnFilter.js +12 -65
- package/lib/table/pipeline/features/columnHover.js +1 -11
- package/lib/table/pipeline/features/columnRangeHover.js +1 -13
- package/lib/table/pipeline/features/columnResizeWidth.js +18 -63
- package/lib/table/pipeline/features/contextMenu.js +24 -121
- package/lib/table/pipeline/features/featureApi/RowDragApi.d.ts +15 -0
- package/lib/table/pipeline/features/featureApi/RowDragApi.js +72 -0
- package/lib/table/pipeline/features/featureApi/utils.d.ts +2 -0
- package/lib/table/pipeline/features/featureApi/utils.js +17 -0
- package/lib/table/pipeline/features/filter/DefaultFilterContent.js +17 -52
- package/lib/table/pipeline/features/filter/DefaultFilterIcon.js +1 -4
- package/lib/table/pipeline/features/filter/Filter.js +30 -77
- package/lib/table/pipeline/features/filter/FilterPanel.js +14 -44
- package/lib/table/pipeline/features/filter/index.js +0 -5
- package/lib/table/pipeline/features/filter/util.js +2 -10
- package/lib/table/pipeline/features/footerDataSource.js +1 -12
- package/lib/table/pipeline/features/index.js +0 -23
- package/lib/table/pipeline/features/mergeCellHover.js +0 -5
- package/lib/table/pipeline/features/multiSelect.js +15 -71
- package/lib/table/pipeline/features/rangeSelection.js +75 -173
- package/lib/table/pipeline/features/rowDetail.js +4 -67
- package/lib/table/pipeline/features/rowDrag.d.ts +10 -12
- package/lib/table/pipeline/features/rowDrag.js +494 -252
- package/lib/table/pipeline/features/rowGrouping.js +4 -57
- package/lib/table/pipeline/features/singleSelect.js +0 -34
- package/lib/table/pipeline/features/sort.js +37 -115
- package/lib/table/pipeline/features/tips.js +4 -19
- package/lib/table/pipeline/features/treeMode.d.ts +1 -0
- package/lib/table/pipeline/features/treeMode.js +40 -80
- package/lib/table/pipeline/features/treeSelect.js +2 -36
- package/lib/table/pipeline/index.js +2 -10
- package/lib/table/pipeline/pipeline.d.ts +3 -0
- package/lib/table/pipeline/pipeline.js +36 -65
- package/lib/table/pivot/cross-table/buildCrossTable.js +21 -83
- package/lib/table/pivot/cross-table/constants.js +1 -2
- package/lib/table/pivot/cross-table/cross-table.js +25 -42
- package/lib/table/pivot/cross-table/index.js +0 -4
- package/lib/table/pivot/cross-tree-table/buildCrossTreeTable.js +22 -70
- package/lib/table/pivot/cross-tree-table/cross-tree-table.js +37 -73
- package/lib/table/pivot/cross-tree-table/index.js +0 -3
- package/lib/table/pivot/pivot-utils/buildDrillTree.js +10 -29
- package/lib/table/pivot/pivot-utils/builders.js +34 -85
- package/lib/table/pivot/pivot-utils/convert-utils.js +16 -60
- package/lib/table/pivot/pivot-utils/index.js +0 -7
- package/lib/table/pivot/pivot-utils/simpleEncode.js +0 -2
- package/lib/table/style/css.js +0 -1
- package/lib/table/style/index.js +0 -1
- package/lib/table/style/index.less +1 -1
- package/lib/table/transforms/autoRowSpan.js +1 -21
- package/lib/table/transforms/autoWidth.js +15 -58
- package/lib/table/transforms/buildTree.js +1 -4
- package/lib/table/transforms/columnHover.js +9 -22
- package/lib/table/transforms/columnRangeHover.js +12 -27
- package/lib/table/transforms/columnResize.js +20 -63
- package/lib/table/transforms/flatten.js +0 -5
- package/lib/table/transforms/index.js +0 -12
- package/lib/table/transforms/orderField.js +0 -7
- package/lib/table/transforms/sort.js +44 -127
- package/lib/table/transforms/tips.js +5 -20
- package/lib/table/transforms/treeMode.js +38 -106
- package/lib/table/transforms/visible.js +0 -7
- package/lib/table/transforms/warnTransformsDeprecated.js +0 -4
- package/lib/table/use/useResizeObserver.js +2 -10
- package/lib/table/utils/applyTransforms.js +0 -2
- package/lib/table/utils/browserType.js +14 -23
- package/lib/table/utils/buildTree.js +7 -33
- package/lib/table/utils/collectNodes.js +4 -18
- package/lib/table/utils/console.js +2 -19
- package/lib/table/utils/copyToClipboard.js +1 -8
- package/lib/table/utils/element.js +14 -46
- package/lib/table/utils/exportTableAsExcel.js +7 -52
- package/lib/table/utils/getTreeDepth.js +4 -17
- package/lib/table/utils/groupBy.js +4 -17
- package/lib/table/utils/index.js +0 -22
- package/lib/table/utils/isGroupColumn.js +0 -3
- package/lib/table/utils/isLeafNode.js +0 -1
- package/lib/table/utils/keyCode.js +1 -2
- package/lib/table/utils/layeredFilter.js +0 -10
- package/lib/table/utils/layeredSort.js +0 -10
- package/lib/table/utils/makeRecursiveMapper.js +4 -24
- package/lib/table/utils/mergeCellProps.js +6 -18
- package/lib/table/utils/others.js +7 -36
- package/lib/table/utils/proto.js +3 -35
- package/lib/table/utils/selectColumn.js +2 -5
- package/lib/table/utils/smartCompare.js +4 -13
- package/lib/table/utils/traverseColumn.js +5 -25
- package/lib/table/utils/tree-data-helpers/StrictTreeDataHelper.js +10 -41
- package/lib/table/utils/tree-data-helpers/TreeDataHelper.js +21 -90
- package/lib/table/utils/uiDegrade.js +1 -8
- package/package.json +218 -218
|
@@ -5,29 +5,23 @@ export function columnHover() {
|
|
|
5
5
|
var stateKey = 'columnHover';
|
|
6
6
|
return function (pipeline) {
|
|
7
7
|
var _a, _b, _c, _d;
|
|
8
|
-
|
|
9
8
|
var hoverColor = (_a = opts.hoverColor) !== null && _a !== void 0 ? _a : 'var(--hover-bgcolor)';
|
|
10
9
|
var hoverColIndex = (_d = (_c = (_b = opts.hoverColIndex) !== null && _b !== void 0 ? _b : pipeline.getStateAtKey(stateKey)) !== null && _c !== void 0 ? _c : opts.defaultHoverColIndex) !== null && _d !== void 0 ? _d : -1;
|
|
11
|
-
|
|
12
10
|
var onChangeHoverColIndex = function onChangeHoverColIndex(nextColIndex) {
|
|
13
11
|
var _a;
|
|
14
|
-
|
|
15
12
|
pipeline.setStateAtKey(stateKey, nextColIndex);
|
|
16
13
|
(_a = opts.onChangeHoverColIndex) === null || _a === void 0 ? void 0 : _a.call(opts, nextColIndex);
|
|
17
14
|
};
|
|
18
|
-
|
|
19
15
|
return pipeline.mapColumns(makeRecursiveMapper(function (col, _ref) {
|
|
20
16
|
var startIndex = _ref.startIndex,
|
|
21
|
-
|
|
17
|
+
endIndex = _ref.endIndex;
|
|
22
18
|
var range = {
|
|
23
19
|
start: startIndex,
|
|
24
20
|
end: endIndex
|
|
25
21
|
};
|
|
26
|
-
|
|
27
22
|
if (!isLeafNode(col)) {
|
|
28
23
|
return col;
|
|
29
24
|
}
|
|
30
|
-
|
|
31
25
|
var colIndexMatched = range.start <= hoverColIndex && hoverColIndex < range.end;
|
|
32
26
|
var prevGetCellProps = col.getCellProps;
|
|
33
27
|
return _extends(_extends({}, col), {
|
|
@@ -9,32 +9,26 @@ export function columnRangeHover() {
|
|
|
9
9
|
var stateKey = 'columnHover';
|
|
10
10
|
return function columnRangeHoverStep(pipeline) {
|
|
11
11
|
var _a, _b, _c, _d, _e;
|
|
12
|
-
|
|
13
12
|
var hoverRange = (_c = (_b = (_a = opts.hoverRange) !== null && _a !== void 0 ? _a : pipeline.getStateAtKey(stateKey)) !== null && _b !== void 0 ? _b : opts.defaultHoverRange) !== null && _c !== void 0 ? _c : EMPTY_RANGE;
|
|
14
13
|
var hoverColor = (_d = opts.hoverColor) !== null && _d !== void 0 ? _d : 'var(--hover-bgcolor)';
|
|
15
14
|
var headerHoverColor = (_e = opts.headerHoverColor) !== null && _e !== void 0 ? _e : 'var(--header-hover-bgcolor)';
|
|
16
|
-
|
|
17
15
|
var onChangeHoverRange = function onChangeHoverRange(nextColIndexRange) {
|
|
18
16
|
var _a;
|
|
19
|
-
|
|
20
17
|
pipeline.setStateAtKey(stateKey, nextColIndexRange);
|
|
21
18
|
(_a = opts.onChangeHoverRange) === null || _a === void 0 ? void 0 : _a.call(opts, nextColIndexRange);
|
|
22
19
|
};
|
|
23
|
-
|
|
24
20
|
return pipeline.mapColumns(makeRecursiveMapper(function (col, _ref) {
|
|
25
21
|
var startIndex = _ref.startIndex,
|
|
26
|
-
|
|
22
|
+
endIndex = _ref.endIndex;
|
|
27
23
|
var colRange = {
|
|
28
24
|
start: startIndex,
|
|
29
25
|
end: endIndex
|
|
30
26
|
};
|
|
31
27
|
var match = colRange.end > hoverRange.start && hoverRange.end > colRange.start;
|
|
32
|
-
|
|
33
28
|
if (!isLeafNode(col)) {
|
|
34
29
|
if (headerHoverColor == null) {
|
|
35
30
|
return col;
|
|
36
31
|
}
|
|
37
|
-
|
|
38
32
|
return _extends(_extends({}, col), {
|
|
39
33
|
headerCellProps: mergeCellProps(col.headerCellProps, {
|
|
40
34
|
onMouseEnter: function onMouseEnter() {
|
|
@@ -49,7 +43,6 @@ export function columnRangeHover() {
|
|
|
49
43
|
})
|
|
50
44
|
});
|
|
51
45
|
}
|
|
52
|
-
|
|
53
46
|
var prevGetCellProps = col.getCellProps;
|
|
54
47
|
return _extends(_extends({}, col), {
|
|
55
48
|
headerCellProps: mergeCellProps(col.headerCellProps, {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
2
|
import _taggedTemplateLiteral from "@babel/runtime-corejs3/helpers/taggedTemplateLiteral";
|
|
3
|
-
|
|
4
3
|
var _templateObject, _templateObject2;
|
|
5
|
-
|
|
6
4
|
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
7
5
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
8
6
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
@@ -17,36 +15,29 @@ var TableHeaderCellResize = styled.div(_templateObject || (_templateObject = _ta
|
|
|
17
15
|
var TableHeaderGroupCellResize = styled(function (props) {
|
|
18
16
|
return /*#__PURE__*/React.createElement(TableHeaderCellResize, _extends({}, props));
|
|
19
17
|
})(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &:after {\n height: 100%;\n top: 0;\n }\n"])));
|
|
20
|
-
|
|
21
18
|
function clamp(min, x, max) {
|
|
22
19
|
return Math.max(min, Math.min(max, x));
|
|
23
20
|
}
|
|
24
|
-
|
|
25
21
|
function disableSelect(event) {
|
|
26
22
|
event.preventDefault();
|
|
27
23
|
}
|
|
28
|
-
|
|
29
24
|
var stateKey = 'columnResize';
|
|
30
25
|
export var COLUMN_SIZE_KEY = 'columnResize';
|
|
31
26
|
export var RESIZED_COLUMN_KEY = 'resizedColumn';
|
|
32
27
|
export var LAST_RESIZED_COLUMN_KEY = 'lastResizedColumn';
|
|
33
28
|
export function columnResize() {
|
|
34
29
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
35
|
-
|
|
36
30
|
var _a, _b, _c;
|
|
37
|
-
|
|
38
31
|
var minSize = (_a = opts.minSize) !== null && _a !== void 0 ? _a : 60;
|
|
39
32
|
var fallbackSize = (_b = opts.fallbackSize) !== null && _b !== void 0 ? _b : 150;
|
|
40
33
|
var maxSize = (_c = opts.maxSize) !== null && _c !== void 0 ? _c : 1000;
|
|
41
34
|
return function columnResizeFeature(pipeline) {
|
|
42
35
|
var _a, _b;
|
|
43
|
-
|
|
44
36
|
var columnSize = (_b = (_a = opts.columnSize) !== null && _a !== void 0 ? _a : pipeline.getStateAtKey(stateKey)) !== null && _b !== void 0 ? _b : {};
|
|
45
37
|
var leafColumns = collectNodes(pipeline.getColumns(), 'leaf-only');
|
|
46
38
|
leafColumns.forEach(function (_ref) {
|
|
47
39
|
var code = _ref.code,
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
width = _ref.width;
|
|
50
41
|
if (columnSize[code] === undefined) {
|
|
51
42
|
if (typeof width === 'number') {
|
|
52
43
|
columnSize[code] = width;
|
|
@@ -54,36 +45,31 @@ export function columnResize() {
|
|
|
54
45
|
columnSize[code] = fallbackSize;
|
|
55
46
|
}
|
|
56
47
|
}
|
|
57
|
-
});
|
|
48
|
+
});
|
|
49
|
+
// 实时存储一份最新的columnSize,与autoFill共用一份数据
|
|
58
50
|
// 存在state里可能存到取不到最新的
|
|
59
|
-
|
|
60
51
|
pipeline.setFeatureOptions(COLUMN_SIZE_KEY, columnSize);
|
|
61
|
-
|
|
62
52
|
var onChangeSize = function onChangeSize(nextColumnSize) {
|
|
63
53
|
window.requestAnimationFrame(function () {
|
|
64
54
|
var _a;
|
|
65
|
-
|
|
66
55
|
pipeline.setStateAtKey(stateKey, nextColumnSize);
|
|
67
56
|
(_a = opts === null || opts === void 0 ? void 0 : opts.onChangeSize) === null || _a === void 0 ? void 0 : _a.call(opts, nextColumnSize);
|
|
68
57
|
});
|
|
69
58
|
};
|
|
70
|
-
|
|
71
59
|
var handleDoubleClick = function handleDoubleClick(e, col) {
|
|
72
60
|
var _a;
|
|
73
|
-
|
|
74
61
|
(_a = opts.doubleClickCallback) === null || _a === void 0 ? void 0 : _a.call(opts, e, col);
|
|
75
62
|
};
|
|
76
|
-
|
|
77
63
|
var handleMouseDown = function handleMouseDown(e, col) {
|
|
78
64
|
window.addEventListener('selectstart', disableSelect);
|
|
79
65
|
var changedColumnSize = {};
|
|
80
66
|
var startX = e.clientX;
|
|
81
67
|
var children = col.children,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
68
|
+
code = col.code,
|
|
69
|
+
_col$features = col.features,
|
|
70
|
+
features = _col$features === void 0 ? {} : _col$features;
|
|
85
71
|
var minWidth = features.minWidth,
|
|
86
|
-
|
|
72
|
+
maxWidth = features.maxWidth;
|
|
87
73
|
var realMinSize = typeof minWidth === 'number' ? minWidth : minSize;
|
|
88
74
|
var realMaxSize = typeof maxWidth === 'number' ? maxWidth : maxSize;
|
|
89
75
|
var columnSize = pipeline.getFeatureOptions(COLUMN_SIZE_KEY);
|
|
@@ -91,12 +77,9 @@ export function columnResize() {
|
|
|
91
77
|
e.stopPropagation();
|
|
92
78
|
var nextSize$ = fromEvent(window, 'mousemove').pipe(op.takeUntil(fromEvent(window, 'mouseup')), op.map(function (e) {
|
|
93
79
|
var movingX = e.clientX;
|
|
94
|
-
|
|
95
80
|
var nextColumnSize = _extends({}, columnSize);
|
|
96
|
-
|
|
97
81
|
var deltaSum = movingX - startX;
|
|
98
82
|
var deltaRemaining = deltaSum;
|
|
99
|
-
|
|
100
83
|
if ((children === null || children === void 0 ? void 0 : children.length) > 0) {
|
|
101
84
|
var leafChildColumns = collectNodes(children, 'leaf-only');
|
|
102
85
|
var childrenWidthSum = leafChildColumns.reduce(function (sum, _ref2) {
|
|
@@ -107,7 +90,6 @@ export function columnResize() {
|
|
|
107
90
|
var code = _ref3.code;
|
|
108
91
|
var startSize = columnSize[code];
|
|
109
92
|
var currentDeltaWidth = Math.round(deltaSum * startSize / childrenWidthSum);
|
|
110
|
-
|
|
111
93
|
if (index < leafChildColumns.length - 1) {
|
|
112
94
|
nextColumnSize[code] = clamp(realMinSize, startSize + currentDeltaWidth, realMaxSize);
|
|
113
95
|
changedColumnSize[code] = nextColumnSize[code];
|
|
@@ -122,54 +104,46 @@ export function columnResize() {
|
|
|
122
104
|
nextColumnSize[code] = clamp(realMinSize, startSize + deltaSum, realMaxSize);
|
|
123
105
|
changedColumnSize[code] = nextColumnSize[code];
|
|
124
106
|
}
|
|
125
|
-
|
|
126
107
|
recordColumnSize = nextColumnSize;
|
|
127
108
|
return nextColumnSize;
|
|
128
109
|
}));
|
|
129
110
|
nextSize$.subscribe({
|
|
130
111
|
next: function next(nextColumnSize) {
|
|
131
|
-
onChangeSize(nextColumnSize);
|
|
132
|
-
|
|
112
|
+
onChangeSize(nextColumnSize);
|
|
113
|
+
// 由于COLUMN_RESIZE_KEY记录的是全量的列宽,此处记录被改变过的列宽
|
|
133
114
|
var resizedColumnSet = pipeline.getFeatureOptions(RESIZED_COLUMN_KEY) || new _Set();
|
|
134
|
-
|
|
135
115
|
_Object$keys(changedColumnSize).forEach(function (code) {
|
|
136
116
|
resizedColumnSet.add(code, changedColumnSize[code]);
|
|
137
117
|
});
|
|
138
|
-
|
|
139
118
|
pipeline.setFeatureOptions(RESIZED_COLUMN_KEY, resizedColumnSet);
|
|
140
119
|
pipeline.setFeatureOptions(LAST_RESIZED_COLUMN_KEY, code);
|
|
141
120
|
},
|
|
142
121
|
complete: function complete() {
|
|
143
122
|
var _context;
|
|
144
|
-
|
|
145
123
|
var changedColumnSizes = _mapInstanceProperty(_context = _Object$keys(changedColumnSize)).call(_context, function (code) {
|
|
146
124
|
return {
|
|
147
125
|
code: code,
|
|
148
126
|
width: changedColumnSize[code]
|
|
149
127
|
};
|
|
150
128
|
});
|
|
151
|
-
|
|
152
129
|
window.requestAnimationFrame(function () {
|
|
153
130
|
var _a;
|
|
154
|
-
|
|
155
131
|
(_a = opts === null || opts === void 0 ? void 0 : opts.afterChangeSize) === null || _a === void 0 ? void 0 : _a.call(opts, recordColumnSize, changedColumnSizes);
|
|
156
132
|
});
|
|
157
133
|
window.removeEventListener('selectstart', disableSelect);
|
|
158
134
|
}
|
|
159
135
|
});
|
|
160
136
|
};
|
|
161
|
-
|
|
162
137
|
var isGroup = isGroupColumn(pipeline.getColumns());
|
|
163
138
|
return pipeline.mapColumns(makeRecursiveMapper(function (col) {
|
|
164
139
|
var _a;
|
|
165
|
-
|
|
166
140
|
var prevTitle = internals.safeRenderHeader(col);
|
|
167
141
|
var code = col.code,
|
|
168
|
-
|
|
169
|
-
|
|
142
|
+
features = col.features,
|
|
143
|
+
width = col.width;
|
|
170
144
|
return _extends(_extends({}, col), {
|
|
171
145
|
width: (_a = columnSize[code]) !== null && _a !== void 0 ? _a : width,
|
|
172
|
-
title: /*#__PURE__*/React.createElement(React.Fragment, null, prevTitle, (features === null || features === void 0 ? void 0 : features.resizeable) !== false && (isGroup ? /*#__PURE__*/React.createElement(TableHeaderGroupCellResize, {
|
|
146
|
+
title: (/*#__PURE__*/React.createElement(React.Fragment, null, prevTitle, (features === null || features === void 0 ? void 0 : features.resizeable) !== false && (isGroup ? /*#__PURE__*/React.createElement(TableHeaderGroupCellResize, {
|
|
173
147
|
className: Classes.tableHeaderCellResize,
|
|
174
148
|
onDoubleClick: function onDoubleClick(e) {
|
|
175
149
|
return handleDoubleClick(e, col);
|
|
@@ -185,7 +159,7 @@ export function columnResize() {
|
|
|
185
159
|
onMouseDown: function onMouseDown(e) {
|
|
186
160
|
return handleMouseDown(e, col);
|
|
187
161
|
}
|
|
188
|
-
}))),
|
|
162
|
+
})))),
|
|
189
163
|
headerCellProps: mergeCellProps(col.headerCellProps, {
|
|
190
164
|
className: 'resizeable'
|
|
191
165
|
})
|
|
@@ -17,36 +17,31 @@ export function contextMenu() {
|
|
|
17
17
|
var popupParent = opts.popupParent || document.body;
|
|
18
18
|
var menuClassName = opts.menuClassName;
|
|
19
19
|
var menuHelper = new MenuHelper();
|
|
20
|
-
|
|
21
20
|
var addPopup = function addPopup(menu) {
|
|
22
21
|
var ePopupDiv = document.createElement('div');
|
|
23
22
|
ePopupDiv.setAttribute('class', 'kd-table-popup');
|
|
24
23
|
popupParent.appendChild(ePopupDiv);
|
|
25
24
|
var popupHidden = false;
|
|
26
25
|
var eventList = ['mousedown', 'contextmenu'];
|
|
27
|
-
|
|
28
|
-
var hidePopup = function hidePopup(event) {
|
|
26
|
+
var _hidePopup2 = function hidePopup(event) {
|
|
29
27
|
if (isEventFromCurrentPopup(event, ePopupDiv) || popupHidden) {
|
|
30
28
|
return;
|
|
31
29
|
}
|
|
32
|
-
|
|
33
30
|
popupHidden = true;
|
|
34
31
|
popupParent.removeChild(ePopupDiv);
|
|
35
32
|
eventList.forEach(function (eventType) {
|
|
36
|
-
window.removeEventListener(eventType,
|
|
33
|
+
window.removeEventListener(eventType, _hidePopup2, true);
|
|
37
34
|
});
|
|
38
35
|
};
|
|
39
|
-
|
|
40
36
|
ReactDOM.render(menu, ePopupDiv, function () {
|
|
41
37
|
setTimeout(function () {
|
|
42
38
|
eventList.forEach(function (eventType) {
|
|
43
|
-
window.addEventListener(eventType,
|
|
39
|
+
window.addEventListener(eventType, _hidePopup2, true);
|
|
44
40
|
});
|
|
45
41
|
}, 0);
|
|
46
42
|
});
|
|
47
|
-
return
|
|
43
|
+
return _hidePopup2;
|
|
48
44
|
};
|
|
49
|
-
|
|
50
45
|
var onContextMenu = function onContextMenu(e) {
|
|
51
46
|
if (canShowContextMenu(e, pipeline)) {
|
|
52
47
|
e.preventDefault();
|
|
@@ -54,18 +49,14 @@ export function contextMenu() {
|
|
|
54
49
|
showContextMenu(e);
|
|
55
50
|
}
|
|
56
51
|
};
|
|
57
|
-
|
|
58
52
|
pipeline.addTableProps({
|
|
59
53
|
onContextMenu: onContextMenu
|
|
60
54
|
});
|
|
61
|
-
|
|
62
55
|
var getContextMenuOptions = function getContextMenuOptions(record, column, value, event) {
|
|
63
56
|
var defaultMenuOptions = [];
|
|
64
|
-
|
|
65
57
|
if (column) {
|
|
66
58
|
defaultMenuOptions.push(getCopyItem(value));
|
|
67
59
|
}
|
|
68
|
-
|
|
69
60
|
if (opts.getContextMenuItems) {
|
|
70
61
|
var params = {
|
|
71
62
|
record: record,
|
|
@@ -75,25 +66,20 @@ export function contextMenu() {
|
|
|
75
66
|
};
|
|
76
67
|
return opts.getContextMenuItems(params);
|
|
77
68
|
}
|
|
78
|
-
|
|
79
69
|
return defaultMenuOptions;
|
|
80
70
|
};
|
|
81
|
-
|
|
82
71
|
var hideContextMenu = function hideContextMenu() {
|
|
83
72
|
menuHelper.destroy();
|
|
84
73
|
};
|
|
85
|
-
|
|
86
74
|
var getPopupParent = function getPopupParent() {
|
|
87
75
|
return popupParent;
|
|
88
76
|
};
|
|
89
|
-
|
|
90
77
|
var showContextMenu = function showContextMenu(e) {
|
|
91
78
|
var path = getEventPath(e);
|
|
92
79
|
var cellEle = getCellEleInEventPath(path);
|
|
93
80
|
var code;
|
|
94
81
|
var rowIndex;
|
|
95
82
|
var isInFooter;
|
|
96
|
-
|
|
97
83
|
if (cellEle) {
|
|
98
84
|
code = cellEle.getAttribute('data-code');
|
|
99
85
|
rowIndex = cellEle.getAttribute('data-rowindex');
|
|
@@ -103,7 +89,6 @@ export function contextMenu() {
|
|
|
103
89
|
rowIndex = rowEle === null || rowEle === void 0 ? void 0 : rowEle.getAttribute('data-rowindex');
|
|
104
90
|
isInFooter = isElementInsideTheFooter(rowEle);
|
|
105
91
|
}
|
|
106
|
-
|
|
107
92
|
var dataSource = isInFooter ? pipeline.getFooterDataSource() || [] : pipeline.getDataSource();
|
|
108
93
|
var record = dataSource[rowIndex];
|
|
109
94
|
var column = code !== undefined && findByTree(pipeline.getColumns(), function (item) {
|
|
@@ -111,12 +96,10 @@ export function contextMenu() {
|
|
|
111
96
|
});
|
|
112
97
|
var value = column && record && internals.safeGetValue(column, record, rowIndex);
|
|
113
98
|
var options = getContextMenuOptions(record, column, value, e);
|
|
114
|
-
|
|
115
99
|
if (options.length === 0) {
|
|
116
100
|
console.warn('context menu options is empty');
|
|
117
101
|
return;
|
|
118
102
|
}
|
|
119
|
-
|
|
120
103
|
var position = positionForMenu(e, popupParent);
|
|
121
104
|
var menu = /*#__PURE__*/React.createElement(Menu, {
|
|
122
105
|
options: options,
|
|
@@ -125,54 +108,42 @@ export function contextMenu() {
|
|
|
125
108
|
getPopupParent: getPopupParent,
|
|
126
109
|
className: menuClassName
|
|
127
110
|
});
|
|
128
|
-
|
|
129
111
|
var _hidePopup = addPopup(menu);
|
|
130
|
-
|
|
131
112
|
menuHelper.init(_hidePopup);
|
|
132
113
|
};
|
|
133
|
-
|
|
134
114
|
return pipeline;
|
|
135
115
|
};
|
|
136
116
|
}
|
|
137
|
-
|
|
138
117
|
function getMenuItemKey(_ref) {
|
|
139
118
|
var name = _ref.name,
|
|
140
|
-
|
|
141
|
-
|
|
119
|
+
index = _ref.index;
|
|
142
120
|
if (name) {
|
|
143
121
|
var _context;
|
|
144
|
-
|
|
145
122
|
var _key = 0;
|
|
146
123
|
name = name + '';
|
|
147
|
-
|
|
148
124
|
for (var i = 0; i < name.length; i++) {
|
|
149
125
|
_key += name.charCodeAt(name[i]);
|
|
150
126
|
}
|
|
151
|
-
|
|
152
127
|
return _concatInstanceProperty(_context = "".concat(_key, "_")).call(_context, index);
|
|
153
128
|
}
|
|
154
|
-
|
|
155
129
|
return index;
|
|
156
130
|
}
|
|
157
|
-
|
|
158
131
|
function Menu(props) {
|
|
159
132
|
var className = props.className,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
133
|
+
_props$options = props.options,
|
|
134
|
+
options = _props$options === void 0 ? [] : _props$options,
|
|
135
|
+
hideContextMenu = props.hideContextMenu,
|
|
136
|
+
position = props.position,
|
|
137
|
+
getPopupParent = props.getPopupParent;
|
|
165
138
|
var menuRef = useRef();
|
|
166
139
|
useEffect(function () {
|
|
167
140
|
if (menuRef.current) {
|
|
168
141
|
var popupParent = getPopupParent();
|
|
169
142
|
var x = position.x,
|
|
170
|
-
|
|
171
|
-
|
|
143
|
+
y = position.y;
|
|
172
144
|
var _keepWithinBounds = keepWithinBounds(popupParent, menuRef.current, x, y),
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
145
|
+
_x = _keepWithinBounds.x,
|
|
146
|
+
_y = _keepWithinBounds.y;
|
|
176
147
|
menuRef.current.style.left = _x + 'px';
|
|
177
148
|
menuRef.current.style.top = _y + 'px';
|
|
178
149
|
}
|
|
@@ -200,50 +171,40 @@ function Menu(props) {
|
|
|
200
171
|
});
|
|
201
172
|
})));
|
|
202
173
|
}
|
|
203
|
-
|
|
204
174
|
function MenuItem(props) {
|
|
205
175
|
var name = props.name,
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
176
|
+
action = props.action,
|
|
177
|
+
className = props.className,
|
|
178
|
+
disabled = props.disabled,
|
|
179
|
+
hideContextMenu = props.hideContextMenu;
|
|
210
180
|
var itemRef = useRef();
|
|
211
|
-
|
|
212
181
|
var handleClick = function handleClick() {
|
|
213
182
|
if (disabled) {
|
|
214
183
|
return;
|
|
215
184
|
}
|
|
216
|
-
|
|
217
185
|
hideContextMenu();
|
|
218
186
|
typeof action === 'function' && action();
|
|
219
187
|
};
|
|
220
|
-
|
|
221
188
|
var handleMouseEnter = function handleMouseEnter(e) {
|
|
222
189
|
if (disabled) {
|
|
223
190
|
return;
|
|
224
191
|
}
|
|
225
|
-
|
|
226
192
|
var itemDom = itemRef.current;
|
|
227
|
-
|
|
228
193
|
if (itemDom) {
|
|
229
194
|
itemDom.classList.add(MenuClasses.menuOptionActive);
|
|
230
195
|
}
|
|
231
196
|
};
|
|
232
|
-
|
|
233
197
|
var handleMouseLeave = function handleMouseLeave(e) {
|
|
234
198
|
if (disabled) {
|
|
235
199
|
return;
|
|
236
200
|
}
|
|
237
|
-
|
|
238
201
|
var itemDom = itemRef.current;
|
|
239
|
-
|
|
240
202
|
if (itemDom) {
|
|
241
203
|
setTimeout(function () {
|
|
242
204
|
itemDom.classList.remove(MenuClasses.menuOptionActive);
|
|
243
205
|
}, 10);
|
|
244
206
|
}
|
|
245
207
|
};
|
|
246
|
-
|
|
247
208
|
return /*#__PURE__*/React.createElement("div", {
|
|
248
209
|
className: cx(MenuClasses.menuOption, className, _defineProperty({}, MenuClasses.menuOptionDisable, disabled)),
|
|
249
210
|
ref: itemRef,
|
|
@@ -254,40 +215,29 @@ function MenuItem(props) {
|
|
|
254
215
|
className: MenuClasses.menuOptionText
|
|
255
216
|
}, name));
|
|
256
217
|
}
|
|
257
|
-
|
|
258
218
|
var MenuHelper = /*#__PURE__*/_createClass(function MenuHelper() {
|
|
259
219
|
var _this = this;
|
|
260
|
-
|
|
261
220
|
_classCallCheck(this, MenuHelper);
|
|
262
|
-
|
|
263
221
|
this.init = function (hidePopup) {
|
|
264
222
|
_this.hidePopup = hidePopup;
|
|
265
223
|
};
|
|
266
|
-
|
|
267
224
|
this.destroy = function () {
|
|
268
225
|
_this.hidePopup && _this.hidePopup();
|
|
269
226
|
_this.hidePopup = null;
|
|
270
227
|
};
|
|
271
228
|
});
|
|
272
229
|
/** 是否点击是外部 start */
|
|
273
|
-
|
|
274
|
-
|
|
275
230
|
function isEventFromCurrentPopup(event, ele) {
|
|
276
231
|
if (!event || !ele) {
|
|
277
232
|
return false;
|
|
278
233
|
}
|
|
279
|
-
|
|
280
234
|
if (isElementInEventPath(ele, event)) {
|
|
281
235
|
return true;
|
|
282
236
|
}
|
|
283
|
-
|
|
284
237
|
return false;
|
|
285
238
|
}
|
|
286
239
|
/** 是否点击是外部 end */
|
|
287
|
-
|
|
288
240
|
/** 计算位置 start */
|
|
289
|
-
|
|
290
|
-
|
|
291
241
|
function calculatePointerRelative(event, popupParent) {
|
|
292
242
|
var parentRect = popupParent.getBoundingClientRect();
|
|
293
243
|
var documentRect = document.documentElement.getBoundingClientRect();
|
|
@@ -296,31 +246,25 @@ function calculatePointerRelative(event, popupParent) {
|
|
|
296
246
|
y: event.clientY - (popupParent === document.body ? documentRect.top : parentRect.top)
|
|
297
247
|
};
|
|
298
248
|
}
|
|
299
|
-
|
|
300
249
|
function positionForMenu(event, popupParent, params) {
|
|
301
250
|
var _calculatePointerRela = calculatePointerRelative(event, popupParent),
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
251
|
+
x = _calculatePointerRela.x,
|
|
252
|
+
y = _calculatePointerRela.y;
|
|
305
253
|
if (params) {
|
|
306
254
|
var offsetX = params.offsetX,
|
|
307
|
-
|
|
308
|
-
|
|
255
|
+
offsetY = params.offsetY;
|
|
309
256
|
if (offsetX) {
|
|
310
257
|
x -= offsetX;
|
|
311
258
|
}
|
|
312
|
-
|
|
313
259
|
if (offsetY) {
|
|
314
260
|
y -= offsetY;
|
|
315
261
|
}
|
|
316
262
|
}
|
|
317
|
-
|
|
318
263
|
return {
|
|
319
264
|
x: x,
|
|
320
265
|
y: y
|
|
321
266
|
};
|
|
322
267
|
}
|
|
323
|
-
|
|
324
268
|
function keepWithinBounds(popupParent, ePopup, x, y) {
|
|
325
269
|
var parentRect = popupParent.getBoundingClientRect();
|
|
326
270
|
var docElement = document.documentElement;
|
|
@@ -328,75 +272,58 @@ function keepWithinBounds(popupParent, ePopup, x, y) {
|
|
|
328
272
|
var ePopupRect = ePopup.getBoundingClientRect();
|
|
329
273
|
var parentWidth = parentRect.width;
|
|
330
274
|
var parentHeight = parentRect.height;
|
|
331
|
-
|
|
332
275
|
if (popupParent === document.body) {
|
|
333
276
|
parentWidth = documentRect.width;
|
|
334
277
|
parentWidth -= Math.abs(documentRect.left - parentRect.left);
|
|
335
278
|
parentHeight = documentRect.height + docElement.scrollTop;
|
|
336
279
|
parentHeight -= Math.abs(documentRect.top - parentRect.top);
|
|
337
280
|
}
|
|
338
|
-
|
|
339
281
|
if (x) {
|
|
340
282
|
var minWidth = Math.min(ePopupRect.width, 120);
|
|
341
283
|
ePopup.style.minWidth = minWidth + 'px';
|
|
342
284
|
var maxX = parentWidth - minWidth;
|
|
343
285
|
x = Math.min(Math.max(x, 0), Math.abs(maxX)); // 目前位置,最大支持的位置
|
|
344
286
|
}
|
|
345
|
-
|
|
346
287
|
if (y) {
|
|
347
288
|
var maxY = parentHeight - ePopupRect.height;
|
|
348
289
|
y = Math.min(Math.max(y, 0), Math.abs(maxY)); // 目前位置,最大支持的位置
|
|
349
290
|
}
|
|
350
|
-
|
|
351
291
|
return {
|
|
352
292
|
x: x,
|
|
353
293
|
y: y
|
|
354
294
|
};
|
|
355
295
|
}
|
|
356
296
|
/** 计算位置 end */
|
|
357
|
-
|
|
358
297
|
/** 获得点击的元素 start */
|
|
359
|
-
|
|
360
|
-
|
|
361
298
|
function getCellEleInEventPath(path) {
|
|
362
299
|
return getTargetEleInEventPath(path, function (ele) {
|
|
363
300
|
return ele && ele.getAttribute('data-role') === 'table-cell';
|
|
364
301
|
});
|
|
365
302
|
}
|
|
366
|
-
|
|
367
303
|
function getRowEleInEventPath(path) {
|
|
368
304
|
return getTargetEleInEventPath(path, function (ele) {
|
|
369
305
|
return ele && ele.getAttribute('data-role') === 'table-row';
|
|
370
306
|
});
|
|
371
307
|
}
|
|
372
308
|
/** 获得点击的元素 end */
|
|
373
|
-
|
|
374
|
-
|
|
375
309
|
function isElementInsideTheFooter(ele) {
|
|
376
310
|
var pointer = ele;
|
|
377
|
-
|
|
378
311
|
while (pointer) {
|
|
379
312
|
if (pointer.tagName === 'TFOOT') {
|
|
380
313
|
return true;
|
|
381
314
|
}
|
|
382
|
-
|
|
383
315
|
if (pointer.tagName === 'TABLE' || pointer.tagName === 'TBODY') {
|
|
384
316
|
return false;
|
|
385
317
|
}
|
|
386
|
-
|
|
387
318
|
pointer = pointer.parentElement;
|
|
388
319
|
}
|
|
389
|
-
|
|
390
320
|
return false;
|
|
391
321
|
}
|
|
392
|
-
|
|
393
322
|
function canShowContextMenu(e, pipeline) {
|
|
394
323
|
var _a, _b;
|
|
395
|
-
|
|
396
324
|
return ((_a = pipeline.ref.current.domHelper) === null || _a === void 0 ? void 0 : _a.tableBody.contains(e.target)) || ((_b = pipeline.ref.current.domHelper) === null || _b === void 0 ? void 0 : _b.tableFooter.contains(e.target));
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
|
|
325
|
+
}
|
|
326
|
+
// 默认选项
|
|
400
327
|
function getCopyItem(v) {
|
|
401
328
|
return {
|
|
402
329
|
name: '复制',
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RowDropZoneParams } from '../../../interfaces';
|
|
2
|
+
export default class RowDragApi {
|
|
3
|
+
private pipeline;
|
|
4
|
+
private rowDropZoneParams;
|
|
5
|
+
private rowDropZones;
|
|
6
|
+
private dragStatus;
|
|
7
|
+
constructor(pipeline: any);
|
|
8
|
+
getRowDropZoneParams(): RowDropZoneParams;
|
|
9
|
+
setRowDropZoneParams(params: any): void;
|
|
10
|
+
addRowDropZone(rowDropZone: any): void;
|
|
11
|
+
getRowDropZone(): RowDropZoneParams[];
|
|
12
|
+
removeRowDropZone(rowDropZone: any): void;
|
|
13
|
+
private setDragStatus;
|
|
14
|
+
private getDragStatus;
|
|
15
|
+
}
|