@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
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
4
|
+
var ROW_DRAG_STATUS = 'rowDragStatus';
|
|
5
|
+
var RowDragApi = /*#__PURE__*/function () {
|
|
6
|
+
function RowDragApi(pipeline) {
|
|
7
|
+
_classCallCheck(this, RowDragApi);
|
|
8
|
+
this.pipeline = pipeline;
|
|
9
|
+
this.rowDropZoneParams = null;
|
|
10
|
+
this.rowDropZones = [];
|
|
11
|
+
this.dragStatus = 'finished';
|
|
12
|
+
}
|
|
13
|
+
return _createClass(RowDragApi, [{
|
|
14
|
+
key: "getRowDropZoneParams",
|
|
15
|
+
value: function getRowDropZoneParams() {
|
|
16
|
+
return this.rowDropZoneParams;
|
|
17
|
+
}
|
|
18
|
+
}, {
|
|
19
|
+
key: "setRowDropZoneParams",
|
|
20
|
+
value: function setRowDropZoneParams(params) {
|
|
21
|
+
this.rowDropZoneParams = params;
|
|
22
|
+
}
|
|
23
|
+
}, {
|
|
24
|
+
key: "addRowDropZone",
|
|
25
|
+
value: function addRowDropZone(rowDropZone) {
|
|
26
|
+
if (!rowDropZone || !(rowDropZone === null || rowDropZone === void 0 ? void 0 : rowDropZone.getContainer())) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
var isExist = this.rowDropZones.some(function (zone) {
|
|
30
|
+
return zone.getContainer() === rowDropZone.getContainer();
|
|
31
|
+
});
|
|
32
|
+
if (isExist) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
this.rowDropZones.push(rowDropZone);
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
key: "getRowDropZone",
|
|
39
|
+
value: function getRowDropZone() {
|
|
40
|
+
return this.rowDropZones;
|
|
41
|
+
}
|
|
42
|
+
}, {
|
|
43
|
+
key: "removeRowDropZone",
|
|
44
|
+
value: function removeRowDropZone(rowDropZone) {
|
|
45
|
+
var _context;
|
|
46
|
+
this.rowDropZones = _filterInstanceProperty(_context = this.rowDropZones).call(_context, function (zone) {
|
|
47
|
+
return zone.getContainer() !== rowDropZone.getContainer();
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
key: "setDragStatus",
|
|
52
|
+
value: function setDragStatus(status) {
|
|
53
|
+
var currentStatus = this.dragStatus;
|
|
54
|
+
this.dragStatus = status;
|
|
55
|
+
if (currentStatus !== status) {
|
|
56
|
+
this.pipeline.setStateAtKey(ROW_DRAG_STATUS, status);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}, {
|
|
60
|
+
key: "getDragStatus",
|
|
61
|
+
value: function getDragStatus() {
|
|
62
|
+
return this.dragStatus;
|
|
63
|
+
}
|
|
64
|
+
}]);
|
|
65
|
+
}();
|
|
66
|
+
export { RowDragApi as default };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
3
3
|
import _taggedTemplateLiteral from "@babel/runtime-corejs3/helpers/taggedTemplateLiteral";
|
|
4
|
-
|
|
5
4
|
var _templateObject;
|
|
6
|
-
|
|
7
5
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
8
6
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
9
7
|
import React, { useEffect, useRef } from 'react';
|
|
@@ -13,38 +11,29 @@ import { DEFAULT_FILTER_OPTIONS } from './util';
|
|
|
13
11
|
import { Classes, ButtonCSS } from '../../../base/styles';
|
|
14
12
|
import KeyCode from '../../../utils/keyCode';
|
|
15
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);
|
|
16
|
-
|
|
17
14
|
function DefaultFilterContent(_ref) {
|
|
18
|
-
var _cx2;
|
|
19
|
-
|
|
20
15
|
var setFilterModel = _ref.setFilterModel,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
filterModel = _ref.filterModel,
|
|
17
|
+
hidePanel = _ref.hidePanel,
|
|
18
|
+
_ref$localeText = _ref.localeText,
|
|
19
|
+
localeText = _ref$localeText === void 0 ? {} : _ref$localeText;
|
|
26
20
|
var _a, _b;
|
|
27
|
-
|
|
28
21
|
var _React$useState = React.useState((filterModel === null || filterModel === void 0 ? void 0 : filterModel.filterCondition) || 'contain'),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
23
|
+
selectedValue = _React$useState2[0],
|
|
24
|
+
setSelectedValue = _React$useState2[1];
|
|
33
25
|
var _React$useState3 = React.useState((filterModel === null || filterModel === void 0 ? void 0 : _filterInstanceProperty(filterModel)) || []),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
27
|
+
innerValue = _React$useState4[0],
|
|
28
|
+
setInnerValue = _React$useState4[1];
|
|
38
29
|
var inputRef = useRef();
|
|
39
30
|
var handleClick = React.useCallback(function (option) {
|
|
40
31
|
setSelectedValue(option.key);
|
|
41
32
|
}, []);
|
|
42
|
-
|
|
43
33
|
var reset = function reset() {
|
|
44
34
|
hidePanel();
|
|
45
35
|
setFilterModel();
|
|
46
36
|
};
|
|
47
|
-
|
|
48
37
|
var confirm = function confirm() {
|
|
49
38
|
hidePanel();
|
|
50
39
|
setFilterModel({
|
|
@@ -52,13 +41,11 @@ function DefaultFilterContent(_ref) {
|
|
|
52
41
|
filterCondition: selectedValue
|
|
53
42
|
});
|
|
54
43
|
};
|
|
55
|
-
|
|
56
44
|
var handleKeyDown = function handleKeyDown(e) {
|
|
57
45
|
if (e.keyCode === KeyCode.ENTER) {
|
|
58
46
|
confirm();
|
|
59
47
|
}
|
|
60
48
|
};
|
|
61
|
-
|
|
62
49
|
useEffect(function () {
|
|
63
50
|
setSelectedValue((filterModel === null || filterModel === void 0 ? void 0 : filterModel.filterCondition) || 'contain');
|
|
64
51
|
setInnerValue((filterModel === null || filterModel === void 0 ? void 0 : _filterInstanceProperty(filterModel)) || []);
|
|
@@ -67,7 +54,6 @@ function DefaultFilterContent(_ref) {
|
|
|
67
54
|
// 兼容设置焦点后发生滚动
|
|
68
55
|
setTimeout(function () {
|
|
69
56
|
var _a;
|
|
70
|
-
|
|
71
57
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus({
|
|
72
58
|
preventScroll: true
|
|
73
59
|
});
|
|
@@ -77,7 +63,6 @@ function DefaultFilterContent(_ref) {
|
|
|
77
63
|
className: 'filter-option-list'
|
|
78
64
|
}, /*#__PURE__*/React.createElement("ul", null, _mapInstanceProperty(DEFAULT_FILTER_OPTIONS).call(DEFAULT_FILTER_OPTIONS, function (option, index) {
|
|
79
65
|
var _a;
|
|
80
|
-
|
|
81
66
|
return (
|
|
82
67
|
/*#__PURE__*/
|
|
83
68
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
@@ -89,7 +74,7 @@ function DefaultFilterContent(_ref) {
|
|
|
89
74
|
}
|
|
90
75
|
}, (_a = localeText[option.key]) !== null && _a !== void 0 ? _a : option.title)
|
|
91
76
|
);
|
|
92
|
-
}))), selectedValue !== 'notIsNull' && selectedValue !== 'isNull' && /*#__PURE__*/React.createElement("div", {
|
|
77
|
+
}))), selectedValue !== 'notIsNull' && selectedValue !== 'isNull' && (/*#__PURE__*/React.createElement("div", {
|
|
93
78
|
className: 'filter-search'
|
|
94
79
|
}, /*#__PURE__*/React.createElement("input", {
|
|
95
80
|
className: 'filter-search-inner',
|
|
@@ -99,7 +84,7 @@ function DefaultFilterContent(_ref) {
|
|
|
99
84
|
},
|
|
100
85
|
onKeyDown: handleKeyDown,
|
|
101
86
|
ref: inputRef
|
|
102
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
103
88
|
className: 'filter-footer'
|
|
104
89
|
}, /*#__PURE__*/React.createElement("button", {
|
|
105
90
|
className: cx(_defineProperty({
|
|
@@ -107,11 +92,10 @@ function DefaultFilterContent(_ref) {
|
|
|
107
92
|
}, Classes.button, true)),
|
|
108
93
|
onClick: reset
|
|
109
94
|
}, (_a = localeText.resetFilter) !== null && _a !== void 0 ? _a : '重置'), /*#__PURE__*/React.createElement("button", {
|
|
110
|
-
className: cx((
|
|
95
|
+
className: cx(_defineProperty(_defineProperty({
|
|
111
96
|
'filter-btn': true
|
|
112
|
-
},
|
|
97
|
+
}, Classes.button, true), Classes.buttonPrimary, true)),
|
|
113
98
|
onClick: confirm
|
|
114
99
|
}, (_b = localeText.confirmFilter) !== null && _b !== void 0 ? _b : '确定')));
|
|
115
100
|
}
|
|
116
|
-
|
|
117
101
|
export default DefaultFilterContent;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
3
3
|
import _taggedTemplateLiteral from "@babel/runtime-corejs3/helpers/taggedTemplateLiteral";
|
|
4
|
-
|
|
5
4
|
var _templateObject;
|
|
6
|
-
|
|
7
5
|
import React, { useEffect } from 'react';
|
|
8
6
|
import { createPortal } from 'react-dom';
|
|
9
7
|
import styled from 'styled-components';
|
|
@@ -16,34 +14,27 @@ import { calculatePopupRelative } from '../../../utils';
|
|
|
16
14
|
import { addResizeObserver } from '../../../base/utils';
|
|
17
15
|
import KeyCode from '../../../utils/keyCode';
|
|
18
16
|
var HEADER_ICON_OFFSET_Y = 8 + 1; // padding-top + border
|
|
19
|
-
|
|
20
17
|
var HEADER_ICON_OFFSET_X = 16 + 1; // padding-left+ border
|
|
21
|
-
|
|
22
18
|
var FilterIconSpanStyle = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n // position: absolute;\n // right: 4px;\n // cursor: pointer;\n // transform: translateY(-50%);\n // top: 50%;\n // height: 12px; \n > .", " {\n display: flex\n }\n"])), Classes.filterIcon);
|
|
23
|
-
|
|
24
19
|
function Panel(_ref) {
|
|
25
20
|
var ele = _ref.ele,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
filterIcon = _ref.filterIcon,
|
|
22
|
+
hidePanel = _ref.hidePanel,
|
|
23
|
+
renderPanelContent = _ref.renderPanelContent,
|
|
24
|
+
hideFilterPopupHeader = _ref.hideFilterPopupHeader,
|
|
25
|
+
popupParent = _ref.popupParent;
|
|
31
26
|
var filterPanelRef = React.useRef(null);
|
|
32
|
-
|
|
33
27
|
var _React$useState = React.useState(calculatePopupRelative(ele, popupParent, _getPanelOffset(ele, hideFilterPopupHeader))),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
29
|
+
position = _React$useState2[0],
|
|
30
|
+
setPosition = _React$useState2[1];
|
|
38
31
|
var style = {
|
|
39
32
|
position: 'absolute',
|
|
40
33
|
zIndex: 1050
|
|
41
34
|
};
|
|
42
|
-
|
|
43
35
|
var handleFilterPanelResize = function handleFilterPanelResize(resize) {
|
|
44
36
|
setPosition(calculatePopupRelative(ele, popupParent, _getPanelOffset(ele, hideFilterPopupHeader)));
|
|
45
37
|
};
|
|
46
|
-
|
|
47
38
|
useEffect(function () {
|
|
48
39
|
var resizeObserver = addResizeObserver(filterPanelRef.current.children[0], handleFilterPanelResize);
|
|
49
40
|
return function () {
|
|
@@ -60,38 +51,31 @@ function Panel(_ref) {
|
|
|
60
51
|
hideFilterPopupHeader: hideFilterPopupHeader
|
|
61
52
|
}, renderPanelContent()));
|
|
62
53
|
}
|
|
63
|
-
|
|
64
54
|
function Filter(_ref2) {
|
|
65
|
-
var _cx;
|
|
66
|
-
|
|
67
55
|
var _ref2$size = _ref2.size,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
56
|
+
size = _ref2$size === void 0 ? 12 : _ref2$size,
|
|
57
|
+
style = _ref2.style,
|
|
58
|
+
className = _ref2.className,
|
|
59
|
+
FilterPanelContent = _ref2.FilterPanelContent,
|
|
60
|
+
filterIcon = _ref2.filterIcon,
|
|
61
|
+
setFilter = _ref2.setFilter,
|
|
62
|
+
setFilterModel = _ref2.setFilterModel,
|
|
63
|
+
filterModel = _ref2.filterModel,
|
|
64
|
+
isFilterActive = _ref2.isFilterActive,
|
|
65
|
+
stopClickEventPropagation = _ref2.stopClickEventPropagation,
|
|
66
|
+
stopESCKeyDownEventPropagation = _ref2.stopESCKeyDownEventPropagation,
|
|
67
|
+
hideFilterPopupHeader = _ref2.hideFilterPopupHeader,
|
|
68
|
+
getPopupParent = _ref2.getPopupParent,
|
|
69
|
+
localeText = _ref2.localeText;
|
|
83
70
|
var _React$useState3 = React.useState(false),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
71
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
72
|
+
showPanel = _React$useState4[0],
|
|
73
|
+
setShowPanel = _React$useState4[1];
|
|
88
74
|
var iconRef = React.useRef(null);
|
|
89
75
|
var iconWrapRef = React.useRef();
|
|
90
|
-
|
|
91
76
|
var hidePanel = function hidePanel() {
|
|
92
77
|
return setShowPanel(false);
|
|
93
78
|
};
|
|
94
|
-
|
|
95
79
|
var renderPanelContent = function renderPanelContent() {
|
|
96
80
|
if (FilterPanelContent) {
|
|
97
81
|
return /*#__PURE__*/React.createElement(FilterPanelContent, {
|
|
@@ -110,32 +94,27 @@ function Filter(_ref2) {
|
|
|
110
94
|
});
|
|
111
95
|
}
|
|
112
96
|
};
|
|
113
|
-
|
|
114
97
|
var handleIconClick = function handleIconClick(e) {
|
|
115
98
|
// 只有当icon区域点击会触发面板展开
|
|
116
99
|
// 防止 createPortal 区域的点击触发该事件
|
|
117
100
|
if (e.currentTarget.contains(e.target)) {
|
|
118
101
|
setShowPanel(true);
|
|
119
102
|
}
|
|
120
|
-
|
|
121
103
|
if (stopClickEventPropagation) {
|
|
122
104
|
e.stopPropagation();
|
|
123
105
|
}
|
|
124
106
|
};
|
|
125
|
-
|
|
126
107
|
var handleKeyDown = function handleKeyDown(e) {
|
|
127
108
|
if (e.keyCode === KeyCode.ESC) {
|
|
128
109
|
if (e.currentTarget.contains(e.target)) {
|
|
129
110
|
setShowPanel(false);
|
|
130
111
|
}
|
|
131
|
-
|
|
132
112
|
if (stopESCKeyDownEventPropagation) {
|
|
133
113
|
e.stopPropagation();
|
|
134
114
|
}
|
|
135
115
|
}
|
|
136
116
|
};
|
|
137
|
-
|
|
138
|
-
var iconClassName = cx((_cx = {}, _defineProperty(_cx, className, true), _defineProperty(_cx, 'filter-panel-open', showPanel), _cx));
|
|
117
|
+
var iconClassName = cx(_defineProperty(_defineProperty({}, className, true), 'filter-panel-open', showPanel));
|
|
139
118
|
var displayFilterIcon = typeof filterIcon === 'function' ? filterIcon(isFilterActive) : filterIcon;
|
|
140
119
|
var popupParent = (getPopupParent === null || getPopupParent === void 0 ? void 0 : getPopupParent(iconWrapRef.current)) || document.body;
|
|
141
120
|
return /*#__PURE__*/React.createElement(FilterIconSpanStyle, {
|
|
@@ -151,7 +130,7 @@ function Filter(_ref2) {
|
|
|
151
130
|
}, displayFilterIcon || /*#__PURE__*/React.createElement(DefaultFilterIcon, {
|
|
152
131
|
width: size,
|
|
153
132
|
height: size
|
|
154
|
-
})), showPanel && /*#__PURE__*/createPortal(
|
|
133
|
+
})), showPanel && /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement(Panel, {
|
|
155
134
|
ele: hideFilterPopupHeader ? iconWrapRef.current : iconRef.current,
|
|
156
135
|
filterIcon: displayFilterIcon,
|
|
157
136
|
hidePanel: hidePanel,
|
|
@@ -160,7 +139,6 @@ function Filter(_ref2) {
|
|
|
160
139
|
popupParent: popupParent
|
|
161
140
|
}), popupParent));
|
|
162
141
|
}
|
|
163
|
-
|
|
164
142
|
function _getPanelOffset(ele, hideFilterPopupHeader) {
|
|
165
143
|
if (hideFilterPopupHeader) {
|
|
166
144
|
return {
|
|
@@ -168,11 +146,9 @@ function _getPanelOffset(ele, hideFilterPopupHeader) {
|
|
|
168
146
|
y: 0 - ele.offsetHeight
|
|
169
147
|
};
|
|
170
148
|
}
|
|
171
|
-
|
|
172
149
|
return {
|
|
173
150
|
x: HEADER_ICON_OFFSET_X,
|
|
174
151
|
y: HEADER_ICON_OFFSET_Y
|
|
175
152
|
};
|
|
176
153
|
}
|
|
177
|
-
|
|
178
154
|
export default Filter;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
3
3
|
import _taggedTemplateLiteral from "@babel/runtime-corejs3/helpers/taggedTemplateLiteral";
|
|
4
|
-
|
|
5
4
|
var _templateObject;
|
|
6
|
-
|
|
7
5
|
import React, { useEffect, useState, useRef } from 'react';
|
|
8
6
|
import styled from 'styled-components';
|
|
9
7
|
import { isElementInEventPath, keepWithinBounds } from '../../../utils/';
|
|
@@ -11,7 +9,6 @@ import DefaultFilterIcon from './DefaultFilterIcon';
|
|
|
11
9
|
import { Classes } from '../../../base/styles';
|
|
12
10
|
import KeyCode from '../../../utils/keyCode';
|
|
13
11
|
var FilterPanelStyle = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n max-height: 450px;\n min-width: 160px;\n border-radius: 2px;\n background-color: #fff;\n box-shadow: 0 0 5px 0 rgba(154,154,154,.5);\n cursor: default;\n\n .", " {\n display: flex;\n background-color: #ebedf1;\n\n .", " {\n display: flex;\n color:#666;\n background-color: #fff;\n padding: 8px 16px 8px 16px;\n border-right: 1px solid transparent;\n border-left: 1px solid transparent;\n border-top: 1px solid transparent;\n border-top-right-radius: 2px;\n border-top-left-radius: 2px;\n }\n }\n\n .", " {\n display: flex;\n }\n"])), Classes.popupHeader, Classes.filterIcon, Classes.popupBody);
|
|
14
|
-
|
|
15
12
|
var useWindowEvents = function useWindowEvents(func, evens) {
|
|
16
13
|
React.useEffect(function () {
|
|
17
14
|
evens.forEach(function (event) {
|
|
@@ -24,55 +21,45 @@ var useWindowEvents = function useWindowEvents(func, evens) {
|
|
|
24
21
|
};
|
|
25
22
|
}, [evens, func]);
|
|
26
23
|
};
|
|
27
|
-
|
|
28
24
|
function FilterPanel(_ref) {
|
|
29
25
|
var style = _ref.style,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
children = _ref.children,
|
|
27
|
+
position = _ref.position,
|
|
28
|
+
filterIcon = _ref.filterIcon,
|
|
29
|
+
onClose = _ref.onClose,
|
|
30
|
+
hideFilterPopupHeader = _ref.hideFilterPopupHeader;
|
|
36
31
|
var _useState = useState(position),
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
perfectPosition = _useState2[0],
|
|
34
|
+
setPerfectPosition = _useState2[1];
|
|
41
35
|
var _useState3 = useState(false),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
37
|
+
visible = _useState4[0],
|
|
38
|
+
setVisible = _useState4[1];
|
|
46
39
|
var ref = React.useRef(null);
|
|
47
|
-
|
|
48
40
|
var isContainPanel = function isContainPanel(e) {
|
|
49
41
|
return isElementInEventPath(ref.current, e);
|
|
50
42
|
};
|
|
51
|
-
|
|
52
43
|
useEffect(function () {
|
|
53
44
|
setPerfectPosition(keepWithinBounds(document.body, ref.current, position.x, position.y, true));
|
|
54
45
|
setVisible(true);
|
|
55
46
|
}, [position]);
|
|
56
47
|
var hasPopupMouseEvent = useRef(false);
|
|
57
|
-
|
|
58
48
|
var handleMouseEvent = function handleMouseEvent() {
|
|
59
49
|
// 当弹出的过滤面板内部发生鼠标按下、抬起事件时,标记当前事件,并在click捕获期清除标记,用来确定鼠标按下、抬起发生在过滤面板内部
|
|
60
50
|
// 利用了React.createPortal冒泡是根据React Tree的特性:
|
|
61
51
|
// https://jwwnz.medium.com/react-portals-and-event-bubbling-8df3e35ca3f1
|
|
62
52
|
hasPopupMouseEvent.current = true;
|
|
63
53
|
};
|
|
64
|
-
|
|
65
54
|
useWindowEvents(function (e) {
|
|
66
55
|
!isContainPanel(e) && !hasPopupMouseEvent.current && onClose();
|
|
67
56
|
hasPopupMouseEvent.current = false;
|
|
68
57
|
}, ['click']);
|
|
69
|
-
|
|
70
58
|
var handleKeyDown = function handleKeyDown(e) {
|
|
71
59
|
if (e.currentTarget.contains(e.target) && e.keyCode === KeyCode.ESC) {
|
|
72
60
|
onClose();
|
|
73
61
|
}
|
|
74
62
|
};
|
|
75
|
-
|
|
76
63
|
return /*#__PURE__*/React.createElement(FilterPanelStyle, {
|
|
77
64
|
className: Classes.popup,
|
|
78
65
|
style: _extends(_extends({}, style), {
|
|
@@ -96,5 +83,4 @@ function FilterPanel(_ref) {
|
|
|
96
83
|
className: Classes.popupBody
|
|
97
84
|
}, children));
|
|
98
85
|
}
|
|
99
|
-
|
|
100
86
|
export default FilterPanel;
|
|
@@ -7,11 +7,9 @@ var DEFAULT_FILTER_OPTIONS = [{
|
|
|
7
7
|
if (data == null) {
|
|
8
8
|
return false;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
10
|
if (typeof data === 'number') {
|
|
12
11
|
data = data + '';
|
|
13
12
|
}
|
|
14
|
-
|
|
15
13
|
return _includesInstanceProperty(data).call(data, value[0]);
|
|
16
14
|
};
|
|
17
15
|
}
|
|
@@ -23,11 +21,9 @@ var DEFAULT_FILTER_OPTIONS = [{
|
|
|
23
21
|
if (data == null) {
|
|
24
22
|
return true;
|
|
25
23
|
}
|
|
26
|
-
|
|
27
24
|
if (typeof data === 'number') {
|
|
28
25
|
data = data + '';
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
return !_includesInstanceProperty(data).call(data, value[0]);
|
|
32
28
|
};
|
|
33
29
|
}
|
|
@@ -7,11 +7,9 @@ export function footerDataSource() {
|
|
|
7
7
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8
8
|
return function footerDataSourceStep(pipeline) {
|
|
9
9
|
var _a, _b;
|
|
10
|
-
|
|
11
10
|
var footerDataSource = (_a = opts.dataSource) !== null && _a !== void 0 ? _a : pipeline.getFooterDataSource();
|
|
12
11
|
var footerRowMetaKey = (_b = opts.footerRowMetaKey) !== null && _b !== void 0 ? _b : footerRowMetaSymbol;
|
|
13
12
|
pipeline.setFeatureOptions('footerRowMetaKey', footerRowMetaKey);
|
|
14
|
-
|
|
15
13
|
if (footerDataSource) {
|
|
16
14
|
pipeline.footerDataSource(_mapInstanceProperty(footerDataSource).call(footerDataSource, function (row) {
|
|
17
15
|
return _extends(_defineProperty({}, footerRowMetaKey, true), row);
|
|
@@ -19,7 +17,6 @@ export function footerDataSource() {
|
|
|
19
17
|
} else {
|
|
20
18
|
console.warn('调用 pipeline.use(features.footerDataSource()) 前请先设置页脚数据源,设置方法有:pipeline.use(features.footerDataSource({dataSource:any[]})) 或者 pipeline.footerDataSource(any[])');
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
return pipeline;
|
|
24
21
|
};
|
|
25
22
|
}
|