@vtx/components 3.1.136 → 3.1.138
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/README.md +19 -19
- package/lib/_util/filterSpecialCharacters.js +66 -55
- package/lib/_util/filterSpecialCharacters.js.map +1 -1
- package/lib/_util/getComponentProps.js +1 -4
- package/lib/_util/getComponentProps.js.map +1 -1
- package/lib/_util/getToken.js +8 -16
- package/lib/_util/getToken.js.map +1 -1
- package/lib/_util/getUrlParam.js +2 -9
- package/lib/_util/getUrlParam.js.map +1 -1
- package/lib/_util/isFunction.js +0 -1
- package/lib/_util/isFunction.js.map +1 -1
- package/lib/_util/isObject.js +0 -1
- package/lib/_util/isObject.js.map +1 -1
- package/lib/_util/useColSize.js +3 -13
- package/lib/_util/useColSize.js.map +1 -1
- package/lib/_util/useInterval.js +0 -3
- package/lib/_util/useInterval.js.map +1 -1
- package/lib/_util/useSet.js +26 -42
- package/lib/_util/useSet.js.map +1 -1
- package/lib/config.js +1 -2
- package/lib/config.js.map +1 -1
- package/lib/index.js +1 -30
- package/lib/index.js.map +1 -1
- package/lib/style/index.less +2 -2
- package/lib/style/themes/compact.less +1 -1
- package/lib/style/themes/dark.less +9 -9
- package/lib/style/themes/default.less +7 -7
- package/lib/style/themes/index.less +1 -1
- package/lib/style/themes/variable.less +5 -5
- package/lib/vtx-color-picker/index.js +14 -33
- package/lib/vtx-color-picker/index.js.map +1 -1
- package/lib/vtx-color-picker/style/css.js +0 -2
- package/lib/vtx-color-picker/style/css.js.map +1 -1
- package/lib/vtx-color-picker/style/index.js +0 -2
- package/lib/vtx-color-picker/style/index.js.map +1 -1
- package/lib/vtx-color-picker/style/index.less +12 -12
- package/lib/vtx-combogrid/Combogrid.js +55 -96
- package/lib/vtx-combogrid/Combogrid.js.map +1 -1
- package/lib/vtx-combogrid/index.js +41 -66
- package/lib/vtx-combogrid/index.js.map +1 -1
- package/lib/vtx-combogrid/style/css.js +0 -7
- package/lib/vtx-combogrid/style/css.js.map +1 -1
- package/lib/vtx-combogrid/style/index.js +0 -7
- package/lib/vtx-combogrid/style/index.js.map +1 -1
- package/lib/vtx-datagrid/Alert.js +6 -15
- package/lib/vtx-datagrid/Alert.js.map +1 -1
- package/lib/vtx-datagrid/ColumnSetting.js +83 -96
- package/lib/vtx-datagrid/ColumnSetting.js.map +1 -1
- package/lib/vtx-datagrid/ResizeableTitle.js +6 -18
- package/lib/vtx-datagrid/ResizeableTitle.js.map +1 -1
- package/lib/vtx-datagrid/index.js +188 -239
- package/lib/vtx-datagrid/index.js.map +1 -1
- package/lib/vtx-datagrid/renderColumnButtons.js +15 -46
- package/lib/vtx-datagrid/renderColumnButtons.js.map +1 -1
- package/lib/vtx-datagrid/style/css.js +0 -10
- package/lib/vtx-datagrid/style/css.js.map +1 -1
- package/lib/vtx-datagrid/style/index.js +0 -10
- package/lib/vtx-datagrid/style/index.js.map +1 -1
- package/lib/vtx-date-picker/QdatePicker.js +28 -58
- package/lib/vtx-date-picker/QdatePicker.js.map +1 -1
- package/lib/vtx-date-picker/generatePicker.js +35 -77
- package/lib/vtx-date-picker/generatePicker.js.map +1 -1
- package/lib/vtx-date-picker/index.js +2 -8
- package/lib/vtx-date-picker/index.js.map +1 -1
- package/lib/vtx-date-picker/style/css.js +0 -1
- package/lib/vtx-date-picker/style/css.js.map +1 -1
- package/lib/vtx-date-picker/style/index.js +0 -1
- package/lib/vtx-date-picker/style/index.js.map +1 -1
- package/lib/vtx-date-picker/style/index.less +39 -39
- package/lib/vtx-editor/index.js +13 -32
- package/lib/vtx-editor/index.js.map +1 -1
- package/lib/vtx-editor/style/css.js +0 -1
- package/lib/vtx-editor/style/css.js.map +1 -1
- package/lib/vtx-editor/style/index.js +0 -1
- package/lib/vtx-editor/style/index.js.map +1 -1
- package/lib/vtx-editor/style/index.less +8 -8
- package/lib/vtx-ellipsis-text/index.js +16 -29
- package/lib/vtx-ellipsis-text/index.js.map +1 -1
- package/lib/vtx-ellipsis-text/style/css.js +0 -1
- package/lib/vtx-ellipsis-text/style/css.js.map +1 -1
- package/lib/vtx-ellipsis-text/style/index.js +0 -1
- package/lib/vtx-ellipsis-text/style/index.js.map +1 -1
- package/lib/vtx-ellipsis-text/style/index.less +13 -13
- package/lib/vtx-export/index.js +38 -73
- package/lib/vtx-export/index.js.map +1 -1
- package/lib/vtx-export/style/css.js +0 -5
- package/lib/vtx-export/style/css.js.map +1 -1
- package/lib/vtx-export/style/index.js +0 -5
- package/lib/vtx-export/style/index.js.map +1 -1
- package/lib/vtx-export/style/index.less +6 -6
- package/lib/vtx-export-async/History.js +75 -117
- package/lib/vtx-export-async/History.js.map +1 -1
- package/lib/vtx-export-async/index.js +80 -121
- package/lib/vtx-export-async/index.js.map +1 -1
- package/lib/vtx-export-async/style/css.js.map +1 -1
- package/lib/vtx-export-async/style/index.js.map +1 -1
- package/lib/vtx-export-async/util.js +9 -21
- package/lib/vtx-export-async/util.js.map +1 -1
- package/lib/vtx-form-layout/Card.js +17 -39
- package/lib/vtx-form-layout/Card.js.map +1 -1
- package/lib/vtx-form-layout/Divider.js +6 -12
- package/lib/vtx-form-layout/Divider.js.map +1 -1
- package/lib/vtx-form-layout/FormItem.js +16 -38
- package/lib/vtx-form-layout/FormItem.js.map +1 -1
- package/lib/vtx-form-layout/Pane.js +4 -10
- package/lib/vtx-form-layout/Pane.js.map +1 -1
- package/lib/vtx-form-layout/Row.js +2 -9
- package/lib/vtx-form-layout/Row.js.map +1 -1
- package/lib/vtx-form-layout/context.js +1 -4
- package/lib/vtx-form-layout/context.js.map +1 -1
- package/lib/vtx-form-layout/demo/Modal.less +43 -43
- package/lib/vtx-form-layout/index.js +10 -25
- package/lib/vtx-form-layout/index.js.map +1 -1
- package/lib/vtx-form-layout/style/css.js +0 -7
- package/lib/vtx-form-layout/style/css.js.map +1 -1
- package/lib/vtx-form-layout/style/index.js +0 -7
- package/lib/vtx-form-layout/style/index.js.map +1 -1
- package/lib/vtx-form-layout/style/index.less +220 -220
- package/lib/vtx-image/Image.js +77 -117
- package/lib/vtx-image/Image.js.map +1 -1
- package/lib/vtx-image/Preview.js +34 -63
- package/lib/vtx-image/Preview.js.map +1 -1
- package/lib/vtx-image/PreviewGroup.js +24 -54
- package/lib/vtx-image/PreviewGroup.js.map +1 -1
- package/lib/vtx-image/index.js +4 -11
- package/lib/vtx-image/index.js.map +1 -1
- package/lib/vtx-image/style/css.js +0 -1
- package/lib/vtx-image/style/css.js.map +1 -1
- package/lib/vtx-image/style/index.js +0 -1
- package/lib/vtx-image/style/index.js.map +1 -1
- package/lib/vtx-import/index.js +91 -143
- package/lib/vtx-import/index.js.map +1 -1
- package/lib/vtx-import/result.js +15 -33
- package/lib/vtx-import/result.js.map +1 -1
- package/lib/vtx-import/style/css.js +0 -3
- package/lib/vtx-import/style/css.js.map +1 -1
- package/lib/vtx-import/style/index.js +0 -3
- package/lib/vtx-import/style/index.js.map +1 -1
- package/lib/vtx-import/style/index.less +8 -8
- package/lib/vtx-import2/CheckResult.js +2 -9
- package/lib/vtx-import2/CheckResult.js.map +1 -1
- package/lib/vtx-import2/Content.js +16 -38
- package/lib/vtx-import2/Content.js.map +1 -1
- package/lib/vtx-import2/DownloadSvg.js +2 -7
- package/lib/vtx-import2/DownloadSvg.js.map +1 -1
- package/lib/vtx-import2/ImportResult.js +8 -15
- package/lib/vtx-import2/ImportResult.js.map +1 -1
- package/lib/vtx-import2/UploadSvg.js +2 -7
- package/lib/vtx-import2/UploadSvg.js.map +1 -1
- package/lib/vtx-import2/index.js +91 -176
- package/lib/vtx-import2/index.js.map +1 -1
- package/lib/vtx-import2/style/css.js +0 -3
- package/lib/vtx-import2/style/css.js.map +1 -1
- package/lib/vtx-import2/style/index.js +0 -3
- package/lib/vtx-import2/style/index.js.map +1 -1
- package/lib/vtx-import2/style/index.less +102 -102
- package/lib/vtx-input/TextArea.js +14 -31
- package/lib/vtx-input/TextArea.js.map +1 -1
- package/lib/vtx-input/index.js +24 -49
- package/lib/vtx-input/index.js.map +1 -1
- package/lib/vtx-input/style/css.js +0 -1
- package/lib/vtx-input/style/css.js.map +1 -1
- package/lib/vtx-input/style/index.js +0 -1
- package/lib/vtx-input/style/index.js.map +1 -1
- package/lib/vtx-input/style/index.less +24 -24
- package/lib/vtx-input/useLength.js +10 -23
- package/lib/vtx-input/useLength.js.map +1 -1
- package/lib/vtx-modal/Title.js +3 -9
- package/lib/vtx-modal/Title.js.map +1 -1
- package/lib/vtx-modal/index.js +52 -85
- package/lib/vtx-modal/index.js.map +1 -1
- package/lib/vtx-modal/style/css.js +0 -1
- package/lib/vtx-modal/style/css.js.map +1 -1
- package/lib/vtx-modal/style/index.js +0 -1
- package/lib/vtx-modal/style/index.js.map +1 -1
- package/lib/vtx-page-layout/Basic.js +6 -11
- package/lib/vtx-page-layout/Basic.js.map +1 -1
- package/lib/vtx-page-layout/Content.js +16 -27
- package/lib/vtx-page-layout/Content.js.map +1 -1
- package/lib/vtx-page-layout/Pane.js +4 -13
- package/lib/vtx-page-layout/Pane.js.map +1 -1
- package/lib/vtx-page-layout/TableLayout.js +34 -64
- package/lib/vtx-page-layout/TableLayout.js.map +1 -1
- package/lib/vtx-page-layout/TableWrap.js +12 -23
- package/lib/vtx-page-layout/TableWrap.js.map +1 -1
- package/lib/vtx-page-layout/container.js +32 -61
- package/lib/vtx-page-layout/container.js.map +1 -1
- package/lib/vtx-page-layout/index.js +2 -11
- package/lib/vtx-page-layout/index.js.map +1 -1
- package/lib/vtx-page-layout/style/css.js.map +1 -1
- package/lib/vtx-page-layout/style/index.js.map +1 -1
- package/lib/vtx-page-layout/style/index.less +138 -138
- package/lib/vtx-rps-frame/index.js +38 -58
- package/lib/vtx-rps-frame/index.js.map +1 -1
- package/lib/vtx-rps-frame/style/css.js.map +1 -1
- package/lib/vtx-rps-frame/style/index.js.map +1 -1
- package/lib/vtx-rps-frame/style/index.less +8 -8
- package/lib/vtx-scrollable-row/index.js +34 -68
- package/lib/vtx-scrollable-row/index.js.map +1 -1
- package/lib/vtx-scrollable-row/style/css.js.map +1 -1
- package/lib/vtx-scrollable-row/style/index.js.map +1 -1
- package/lib/vtx-scrollable-row/style/index.less +113 -113
- package/lib/vtx-search/VtxCol.js +8 -27
- package/lib/vtx-search/VtxCol.js.map +1 -1
- package/lib/vtx-search/VtxRow.js +8 -15
- package/lib/vtx-search/VtxRow.js.map +1 -1
- package/lib/vtx-search/index.js +67 -112
- package/lib/vtx-search/index.js.map +1 -1
- package/lib/vtx-search/style/css.js +0 -4
- package/lib/vtx-search/style/css.js.map +1 -1
- package/lib/vtx-search/style/index.js +0 -4
- package/lib/vtx-search/style/index.js.map +1 -1
- package/lib/vtx-search-map-input/index.js +63 -98
- package/lib/vtx-search-map-input/index.js.map +1 -1
- package/lib/vtx-search-map-input/style/css.js +0 -2
- package/lib/vtx-search-map-input/style/css.js.map +1 -1
- package/lib/vtx-search-map-input/style/index.js +0 -2
- package/lib/vtx-search-map-input/style/index.js.map +1 -1
- package/lib/vtx-select/index.js +47 -99
- package/lib/vtx-select/index.js.map +1 -1
- package/lib/vtx-select/style/css.js +0 -8
- package/lib/vtx-select/style/css.js.map +1 -1
- package/lib/vtx-select/style/index.js +0 -8
- package/lib/vtx-select/style/index.js.map +1 -1
- package/lib/vtx-select/style/index.less +68 -68
- package/lib/vtx-signature/index.js +19 -34
- package/lib/vtx-signature/index.js.map +1 -1
- package/lib/vtx-signature/style/css.js +0 -2
- package/lib/vtx-signature/style/css.js.map +1 -1
- package/lib/vtx-signature/style/index.js +0 -2
- package/lib/vtx-signature/style/index.js.map +1 -1
- package/lib/vtx-signature/style/index.less +33 -33
- package/lib/vtx-split-pane/Pane.js +12 -23
- package/lib/vtx-split-pane/Pane.js.map +1 -1
- package/lib/vtx-split-pane/Resizer.js +21 -41
- package/lib/vtx-split-pane/Resizer.js.map +1 -1
- package/lib/vtx-split-pane/SplitPane.js +55 -111
- package/lib/vtx-split-pane/SplitPane.js.map +1 -1
- package/lib/vtx-split-pane/index.js +2 -7
- package/lib/vtx-split-pane/index.js.map +1 -1
- package/lib/vtx-split-pane/style/css.js +0 -3
- package/lib/vtx-split-pane/style/css.js.map +1 -1
- package/lib/vtx-split-pane/style/index.js +0 -3
- package/lib/vtx-split-pane/style/index.js.map +1 -1
- package/lib/vtx-split-pane/style/index.less +76 -76
- package/lib/vtx-statistics-column/Back.js +4 -11
- package/lib/vtx-statistics-column/Back.js.map +1 -1
- package/lib/vtx-statistics-column/Item.js +16 -32
- package/lib/vtx-statistics-column/Item.js.map +1 -1
- package/lib/vtx-statistics-column/Total.js +15 -31
- package/lib/vtx-statistics-column/Total.js.map +1 -1
- package/lib/vtx-statistics-column/context.js +1 -4
- package/lib/vtx-statistics-column/context.js.map +1 -1
- package/lib/vtx-statistics-column/index.js +2 -19
- package/lib/vtx-statistics-column/index.js.map +1 -1
- package/lib/vtx-statistics-column/style/css.js +0 -1
- package/lib/vtx-statistics-column/style/css.js.map +1 -1
- package/lib/vtx-statistics-column/style/index.js +0 -1
- package/lib/vtx-statistics-column/style/index.js.map +1 -1
- package/lib/vtx-statistics-column/style/index.less +59 -59
- package/lib/vtx-time-picker/index.js +8 -22
- package/lib/vtx-time-picker/index.js.map +1 -1
- package/lib/vtx-time-picker/style/css.js.map +1 -1
- package/lib/vtx-time-picker/style/index.js.map +1 -1
- package/lib/vtx-tree/index.js +83 -153
- package/lib/vtx-tree/index.js.map +1 -1
- package/lib/vtx-tree/style/css.js +0 -2
- package/lib/vtx-tree/style/css.js.map +1 -1
- package/lib/vtx-tree/style/index.js +0 -2
- package/lib/vtx-tree/style/index.js.map +1 -1
- package/lib/vtx-tree/utils.js +10 -31
- package/lib/vtx-tree/utils.js.map +1 -1
- package/lib/vtx-tree-select/index.js +37 -81
- package/lib/vtx-tree-select/index.js.map +1 -1
- package/lib/vtx-tree-select/style/css.js +0 -4
- package/lib/vtx-tree-select/style/css.js.map +1 -1
- package/lib/vtx-tree-select/style/index.js +0 -4
- package/lib/vtx-tree-select/style/index.js.map +1 -1
- package/lib/vtx-upload/FilePreview.js +17 -35
- package/lib/vtx-upload/FilePreview.js.map +1 -1
- package/lib/vtx-upload/index.js +90 -167
- package/lib/vtx-upload/index.js.map +1 -1
- package/lib/vtx-upload/style/css.js +0 -6
- package/lib/vtx-upload/style/css.js.map +1 -1
- package/lib/vtx-upload/style/index.js +0 -6
- package/lib/vtx-upload/style/index.js.map +1 -1
- package/lib/vtx-upload/style/index.less +61 -61
- package/lib/vtx-wang-editor/index.js +84 -126
- package/lib/vtx-wang-editor/index.js.map +1 -1
- package/lib/vtx-wang-editor/style/css.js +0 -1
- package/lib/vtx-wang-editor/style/css.js.map +1 -1
- package/lib/vtx-wang-editor/style/index.js +0 -1
- package/lib/vtx-wang-editor/style/index.js.map +1 -1
- package/lib/vtx-wang-editor/style/index.less +12 -12
- package/lib/vtx-wang-editor/wangEditorUtil.js +80 -141
- package/lib/vtx-wang-editor/wangEditorUtil.js.map +1 -1
- package/lib/vtx-ztree/index.js +77 -133
- package/lib/vtx-ztree/index.js.map +1 -1
- package/lib/vtx-ztree/style/css.js +0 -1
- package/lib/vtx-ztree/style/css.js.map +1 -1
- package/lib/vtx-ztree/style/index.js +0 -1
- package/lib/vtx-ztree/style/index.js.map +1 -1
- package/lib/vtx-ztree/style/index.less +45 -45
- package/lib/vtx-ztree-select/index.js +91 -159
- package/lib/vtx-ztree-select/index.js.map +1 -1
- package/lib/vtx-ztree-select/style/css.js +0 -3
- package/lib/vtx-ztree-select/style/css.js.map +1 -1
- package/lib/vtx-ztree-select/style/index.js +0 -3
- package/lib/vtx-ztree-select/style/index.js.map +1 -1
- package/lib/vtx-ztree-select/style/index.less +109 -109
- package/package.json +2 -2
|
@@ -1,178 +1,135 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
4
|
-
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = VtxDatagrid;
|
|
9
|
-
|
|
8
|
+
exports.indexColumnKey = void 0;
|
|
10
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
10
|
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
12
|
var _table = _interopRequireDefault(require("antd/lib/table"));
|
|
17
|
-
|
|
18
13
|
var _tooltip = _interopRequireDefault(require("antd/lib/tooltip"));
|
|
19
|
-
|
|
20
14
|
var _dropdown = _interopRequireDefault(require("antd/lib/dropdown"));
|
|
21
|
-
|
|
22
15
|
var _menu = _interopRequireDefault(require("antd/lib/menu"));
|
|
23
|
-
|
|
24
16
|
var _empty = _interopRequireDefault(require("antd/lib/empty"));
|
|
25
|
-
|
|
26
17
|
var _RedoOutlined = _interopRequireDefault(require("@ant-design/icons/RedoOutlined"));
|
|
27
|
-
|
|
28
18
|
var _ColumnHeightOutlined = _interopRequireDefault(require("@ant-design/icons/ColumnHeightOutlined"));
|
|
29
|
-
|
|
30
19
|
var _SettingOutlined = _interopRequireDefault(require("@ant-design/icons/SettingOutlined"));
|
|
31
|
-
|
|
32
20
|
var _Alert = _interopRequireDefault(require("./Alert"));
|
|
33
|
-
|
|
34
21
|
var _ColumnSetting = _interopRequireDefault(require("./ColumnSetting"));
|
|
35
|
-
|
|
36
22
|
var _ResizeableTitle = _interopRequireDefault(require("./ResizeableTitle"));
|
|
37
|
-
|
|
38
23
|
var _renderColumnButtons = _interopRequireDefault(require("./renderColumnButtons"));
|
|
39
|
-
|
|
40
24
|
var _useSet3 = _interopRequireDefault(require("../_util/useSet"));
|
|
41
|
-
|
|
42
25
|
var _isFunction = _interopRequireDefault(require("../_util/isFunction"));
|
|
43
|
-
|
|
44
26
|
var _axios = _interopRequireDefault(require("axios"));
|
|
45
|
-
|
|
46
27
|
var _ahooks = require("ahooks");
|
|
47
|
-
|
|
48
28
|
var _getSignature = _interopRequireDefault(require("@vtx/utils/lib/getSignature"));
|
|
49
|
-
|
|
29
|
+
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
50
30
|
var _excluded = ["prefixCls", "toolbar", "toolbarClassName", "toolbarTilte", "buttonGroup", "refreshIconVisible", "hideColumnSetting", "hideColumnHeight", "visibleColumnKeys", "defaultVisibleColumnKeys", "onVisibleColumnsChange", "onRefresh", "indexColumn", "indexFixed", "bordered", "indexTitle", "startIndex", "autoFit", "headFootHeight", "columnResizable", "components", "className", "style", "emptyText", "onRowSelectionClear", "disabledColumnKeys", "onColumnsSave", "uniqueKey", "prefixUrl", "customEnumText", "hideSelectionClear", "indexWidth"];
|
|
51
|
-
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
57
|
-
|
|
58
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
59
|
-
|
|
60
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
61
|
-
|
|
31
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
32
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
33
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
34
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
35
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
62
36
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
63
|
-
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
-
function
|
|
67
|
-
|
|
68
|
-
function
|
|
69
|
-
|
|
70
|
-
function
|
|
71
|
-
|
|
72
|
-
function
|
|
73
|
-
|
|
74
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
75
|
-
|
|
76
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
77
|
-
|
|
78
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
79
|
-
|
|
37
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
38
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
39
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
40
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
41
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
42
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
43
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
44
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
45
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
46
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
80
47
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
81
|
-
|
|
82
|
-
function
|
|
83
|
-
|
|
84
|
-
function
|
|
85
|
-
|
|
86
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
87
|
-
|
|
88
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
89
|
-
|
|
48
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
49
|
+
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; }
|
|
50
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
51
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
90
52
|
var isMac = navigator.userAgent.indexOf('Mac OS') !== -1;
|
|
91
|
-
|
|
53
|
+
var indexColumnKey = exports.indexColumnKey = '_serialNum';
|
|
92
54
|
function VtxDatagrid(props) {
|
|
93
|
-
var _rest$dataSource, _rest$rowSelection, _rest$rowSelection2, _dataSource2,
|
|
94
|
-
|
|
55
|
+
var _rest$dataSource, _rest$rowSelection, _rest$rowSelection2, _dataSource2, _rest$rowSelection3, _dataSource3;
|
|
95
56
|
var _useSet = (0, _useSet3["default"])({
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
setState = _useSet2[1];
|
|
112
|
-
|
|
57
|
+
// 显示列
|
|
58
|
+
visibleColumns: [],
|
|
59
|
+
// 列设置选中的列
|
|
60
|
+
checkedColumnKeys: [],
|
|
61
|
+
// 列设置选项
|
|
62
|
+
columnSettingOptions: [],
|
|
63
|
+
datagridId: "vtx-datagrid-".concat(new Date().getTime()),
|
|
64
|
+
scrollY: 0,
|
|
65
|
+
size: 'middle',
|
|
66
|
+
projectKey: '',
|
|
67
|
+
firstChangeVisibleColumnKeys: true
|
|
68
|
+
}),
|
|
69
|
+
_useSet2 = _slicedToArray(_useSet, 2),
|
|
70
|
+
state = _useSet2[0],
|
|
71
|
+
setState = _useSet2[1];
|
|
113
72
|
var visibleColumns = state.visibleColumns,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
var datagridRef = (0, _react.useRef)(null);
|
|
120
|
-
|
|
121
|
-
var alertHeight = (0, _react.useRef)(0);
|
|
122
|
-
|
|
123
|
-
var toolbarHeight = (0, _react.useRef)(0);
|
|
124
|
-
|
|
73
|
+
checkedColumnKeys = state.checkedColumnKeys,
|
|
74
|
+
columnSettingOptions = state.columnSettingOptions,
|
|
75
|
+
datagridId = state.datagridId,
|
|
76
|
+
scrollY = state.scrollY,
|
|
77
|
+
size = state.size;
|
|
78
|
+
var datagridRef = (0, _react.useRef)(null);
|
|
79
|
+
// 列设置提示高度
|
|
80
|
+
var alertHeight = (0, _react.useRef)(0);
|
|
81
|
+
// 工具栏高度
|
|
82
|
+
var toolbarHeight = (0, _react.useRef)(0);
|
|
83
|
+
// 列接口显示字段
|
|
125
84
|
var settingRef = (0, _react.useRef)();
|
|
126
|
-
|
|
127
85
|
var _props$prefixCls = props.prefixCls,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
86
|
+
prefixCls = _props$prefixCls === void 0 ? 'vtx-datagrid' : _props$prefixCls,
|
|
87
|
+
_props$toolbar = props.toolbar,
|
|
88
|
+
toolbar = _props$toolbar === void 0 ? true : _props$toolbar,
|
|
89
|
+
toolbarClassName = props.toolbarClassName,
|
|
90
|
+
_props$toolbarTilte = props.toolbarTilte,
|
|
91
|
+
toolbarTilte = _props$toolbarTilte === void 0 ? '查询结果' : _props$toolbarTilte,
|
|
92
|
+
buttonGroup = props.buttonGroup,
|
|
93
|
+
_props$refreshIconVis = props.refreshIconVisible,
|
|
94
|
+
refreshIconVisible = _props$refreshIconVis === void 0 ? true : _props$refreshIconVis,
|
|
95
|
+
hideColumnSetting = props.hideColumnSetting,
|
|
96
|
+
hideColumnHeight = props.hideColumnHeight,
|
|
97
|
+
visibleColumnKeys = props.visibleColumnKeys,
|
|
98
|
+
defaultVisibleColumnKeys = props.defaultVisibleColumnKeys,
|
|
99
|
+
onVisibleColumnsChange = props.onVisibleColumnsChange,
|
|
100
|
+
onRefresh = props.onRefresh,
|
|
101
|
+
_props$indexColumn = props.indexColumn,
|
|
102
|
+
indexColumn = _props$indexColumn === void 0 ? true : _props$indexColumn,
|
|
103
|
+
_props$indexFixed = props.indexFixed,
|
|
104
|
+
indexFixed = _props$indexFixed === void 0 ? false : _props$indexFixed,
|
|
105
|
+
_props$bordered = props.bordered,
|
|
106
|
+
bordered = _props$bordered === void 0 ? true : _props$bordered,
|
|
107
|
+
_props$indexTitle = props.indexTitle,
|
|
108
|
+
indexTitle = _props$indexTitle === void 0 ? '序号' : _props$indexTitle,
|
|
109
|
+
_props$startIndex = props.startIndex,
|
|
110
|
+
startIndex = _props$startIndex === void 0 ? 1 : _props$startIndex,
|
|
111
|
+
_props$autoFit = props.autoFit,
|
|
112
|
+
autoFit = _props$autoFit === void 0 ? true : _props$autoFit,
|
|
113
|
+
_props$headFootHeight = props.headFootHeight,
|
|
114
|
+
headFootHeight = _props$headFootHeight === void 0 ? 115 : _props$headFootHeight,
|
|
115
|
+
columnResizable = props.columnResizable,
|
|
116
|
+
components = props.components,
|
|
117
|
+
className = props.className,
|
|
118
|
+
style = props.style,
|
|
119
|
+
_props$emptyText = props.emptyText,
|
|
120
|
+
emptyText = _props$emptyText === void 0 ? '暂无数据' : _props$emptyText,
|
|
121
|
+
onRowSelectionClear = props.onRowSelectionClear,
|
|
122
|
+
disabledColumnKeys = props.disabledColumnKeys,
|
|
123
|
+
onColumnsSave = props.onColumnsSave,
|
|
124
|
+
uniqueKey = props.uniqueKey,
|
|
125
|
+
prefixUrl = props.prefixUrl,
|
|
126
|
+
_props$customEnumText = props.customEnumText,
|
|
127
|
+
customEnumText = _props$customEnumText === void 0 ? {} : _props$customEnumText,
|
|
128
|
+
_props$hideSelectionC = props.hideSelectionClear,
|
|
129
|
+
hideSelectionClear = _props$hideSelectionC === void 0 ? false : _props$hideSelectionC,
|
|
130
|
+
_props$indexWidth = props.indexWidth,
|
|
131
|
+
indexWidth = _props$indexWidth === void 0 ? 70 : _props$indexWidth,
|
|
132
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
176
133
|
var TextEnum = _objectSpread({
|
|
177
134
|
refreshText: '刷新',
|
|
178
135
|
densityDefaultText: '默认',
|
|
@@ -191,12 +148,11 @@ function VtxDatagrid(props) {
|
|
|
191
148
|
messageWarningOneText: '至少勾选一列保存',
|
|
192
149
|
paginationTotalText: '共',
|
|
193
150
|
paginationItemText: '条'
|
|
194
|
-
}, customEnumText);
|
|
195
|
-
|
|
151
|
+
}, customEnumText);
|
|
196
152
|
|
|
153
|
+
// 规则,菜单根目录_页面路由
|
|
197
154
|
function getUniqueKey() {
|
|
198
155
|
var route = location.href.match(/#\/(\S*)\?/);
|
|
199
|
-
|
|
200
156
|
if (route) {
|
|
201
157
|
(0, _axios["default"])({
|
|
202
158
|
method: 'GET',
|
|
@@ -204,7 +160,6 @@ function VtxDatagrid(props) {
|
|
|
204
160
|
headers: _objectSpread({}, (0, _getSignature["default"])({}))
|
|
205
161
|
}).then(function (res) {
|
|
206
162
|
var _res$data;
|
|
207
|
-
|
|
208
163
|
if ((res === null || res === void 0 ? void 0 : res.status) == 200 && (_res$data = res.data) !== null && _res$data !== void 0 && _res$data.key) {
|
|
209
164
|
setState({
|
|
210
165
|
projectKey: "".concat(res.data.key, "_").concat(route ? route[1] : 'test')
|
|
@@ -212,53 +167,48 @@ function VtxDatagrid(props) {
|
|
|
212
167
|
}
|
|
213
168
|
});
|
|
214
169
|
}
|
|
215
|
-
}
|
|
216
|
-
|
|
170
|
+
}
|
|
217
171
|
|
|
172
|
+
// 高度计算
|
|
218
173
|
var _useThrottleFn = (0, _ahooks.useThrottleFn)(function () {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}),
|
|
237
|
-
calculateHeight = _useThrottleFn.run;
|
|
238
|
-
|
|
174
|
+
var _datagridRef$current;
|
|
175
|
+
if (!datagridRef.current) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
var bodyHeight = ((_datagridRef$current = datagridRef.current) === null || _datagridRef$current === void 0 ? void 0 : _datagridRef$current.clientHeight) - headFootHeight - toolbarHeight.current - alertHeight.current;
|
|
179
|
+
var divs = datagridRef.current.getElementsByTagName('div');
|
|
180
|
+
var bodyDiv = Array.prototype.filter.call(divs, function (dom) {
|
|
181
|
+
return dom.className.includes('ant-table-body') || dom.className.includes('ant-table-content');
|
|
182
|
+
})[0];
|
|
183
|
+
bodyDiv.style.minHeight = "".concat(bodyHeight - (rest.scrollY || 0), "px");
|
|
184
|
+
setState({
|
|
185
|
+
scrollY: bodyHeight
|
|
186
|
+
});
|
|
187
|
+
}, {
|
|
188
|
+
wait: 350
|
|
189
|
+
}),
|
|
190
|
+
calculateHeight = _useThrottleFn.run;
|
|
239
191
|
(0, _react.useEffect)(function () {
|
|
240
192
|
// 当没有传入唯一值而且没有自定义列保存的时候且根据规则自动生成唯一值
|
|
241
193
|
if (!uniqueKey && !onColumnsSave && toolbar && !hideColumnSetting) {
|
|
242
194
|
getUniqueKey();
|
|
243
195
|
}
|
|
244
|
-
|
|
245
196
|
var resizeObserver = new ResizeObserver(function () {
|
|
246
197
|
calculateHeight();
|
|
247
|
-
});
|
|
248
|
-
|
|
198
|
+
});
|
|
199
|
+
// componentDidMount
|
|
249
200
|
if (autoFit && datagridRef.current) {
|
|
250
201
|
resizeObserver.observe(datagridRef.current, {
|
|
251
202
|
box: 'border-box'
|
|
252
203
|
});
|
|
253
204
|
}
|
|
254
|
-
|
|
255
205
|
return function () {
|
|
256
206
|
// componentWillUnmount
|
|
257
207
|
if (autoFit) {
|
|
258
208
|
resizeObserver.disconnect();
|
|
259
209
|
}
|
|
260
210
|
};
|
|
261
|
-
}, []);
|
|
211
|
+
}, [autoFit]);
|
|
262
212
|
(0, _react.useLayoutEffect)(function () {
|
|
263
213
|
if (autoFit) {
|
|
264
214
|
calculateHeight();
|
|
@@ -266,8 +216,6 @@ function VtxDatagrid(props) {
|
|
|
266
216
|
}, [(_rest$dataSource = rest.dataSource) === null || _rest$dataSource === void 0 ? void 0 : _rest$dataSource.length, (((_rest$rowSelection = rest.rowSelection) === null || _rest$rowSelection === void 0 ? void 0 : _rest$rowSelection.selectedRowKeys) || []).join(',')]);
|
|
267
217
|
(0, _react.useEffect)(function () {
|
|
268
218
|
var _rest$columns;
|
|
269
|
-
|
|
270
|
-
parseColumns();
|
|
271
219
|
var keys = [];
|
|
272
220
|
var options = (_rest$columns = rest.columns) === null || _rest$columns === void 0 ? void 0 : _rest$columns.map(function (col) {
|
|
273
221
|
keys.push(col.dataIndex || col.key);
|
|
@@ -275,76 +223,89 @@ function VtxDatagrid(props) {
|
|
|
275
223
|
key: col.dataIndex || col.key
|
|
276
224
|
});
|
|
277
225
|
});
|
|
226
|
+
// 序号添加操作列
|
|
227
|
+
if (indexColumn) {
|
|
228
|
+
options = [{
|
|
229
|
+
title: indexTitle,
|
|
230
|
+
dataIndex: indexColumnKey,
|
|
231
|
+
key: indexColumnKey,
|
|
232
|
+
width: indexWidth,
|
|
233
|
+
fixed: indexFixed
|
|
234
|
+
}].concat(_toConsumableArray(options));
|
|
235
|
+
}
|
|
278
236
|
setState({
|
|
279
|
-
columnSettingOptions: options
|
|
280
|
-
keysInColumns: keys
|
|
237
|
+
columnSettingOptions: options
|
|
281
238
|
});
|
|
282
|
-
}, [rest.columns]);
|
|
239
|
+
}, [JSON.stringify(rest.columns), indexColumn]);
|
|
283
240
|
(0, _react.useEffect)(function () {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
(_settingRef$current = settingRef.current) === null || _settingRef$current === void 0 ? void 0 : _settingRef$current.updateShowColumns(visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.join(","));
|
|
287
|
-
}, [visibleColumnKeys]);
|
|
241
|
+
parseColumns();
|
|
242
|
+
}, [JSON.stringify(columnSettingOptions)]);
|
|
288
243
|
(0, _react.useEffect)(function () {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
244
|
+
/**
|
|
245
|
+
* 首次传入(后面修改 采用内部的checkedColumnKeys控制)
|
|
246
|
+
* 有值
|
|
247
|
+
* 并且和当前选中的不一样才需要更新
|
|
248
|
+
*/
|
|
249
|
+
if (state.firstChangeVisibleColumnKeys && visibleColumnKeys && !(0, _isEqual["default"])(checkedColumnKeys, visibleColumnKeys)) {
|
|
250
|
+
var _settingRef$current;
|
|
251
|
+
setState({
|
|
252
|
+
firstChangeVisibleColumnKeys: false
|
|
253
|
+
});
|
|
254
|
+
var newVisibleColumnKeys = state.firstChangeVisibleColumnKeys ? [indexColumn ? [indexColumnKey] : []].concat(_toConsumableArray(visibleColumnKeys)) : visibleColumnKeys;
|
|
255
|
+
(_settingRef$current = settingRef.current) === null || _settingRef$current === void 0 || _settingRef$current.updateShowColumns(newVisibleColumnKeys === null || newVisibleColumnKeys === void 0 ? void 0 : newVisibleColumnKeys.join(','));
|
|
256
|
+
}
|
|
257
|
+
}, [Array.isArray(visibleColumnKeys) ? JSON.stringify(visibleColumnKeys) : visibleColumnKeys]);
|
|
292
258
|
var parseColumns = function parseColumns(type) {
|
|
293
259
|
// 显示工具栏的同时并显示列设置
|
|
294
260
|
if (toolbar && !hideColumnSetting) {
|
|
295
261
|
var _settingRef$current2;
|
|
296
|
-
|
|
297
262
|
if (defaultVisibleColumnKeys || visibleColumnKeys || (_settingRef$current2 = settingRef.current) !== null && _settingRef$current2 !== void 0 && _settingRef$current2.showColumns) {
|
|
298
|
-
var
|
|
299
|
-
|
|
300
|
-
var columnKeys = type === 'reset' ? defaultVisibleColumnKeys || ((_rest$columns2 = rest.columns) === null || _rest$columns2 === void 0 ? void 0 : _rest$columns2.map(function (item) {
|
|
263
|
+
var _settingRef$current3;
|
|
264
|
+
var columnKeys = type === 'reset' ? defaultVisibleColumnKeys || (columnSettingOptions === null || columnSettingOptions === void 0 ? void 0 : columnSettingOptions.map(function (item) {
|
|
301
265
|
return item.key;
|
|
302
266
|
})) : ((_settingRef$current3 = settingRef.current) === null || _settingRef$current3 === void 0 ? void 0 : _settingRef$current3.showColumns) || visibleColumnKeys || defaultVisibleColumnKeys;
|
|
303
267
|
setState({
|
|
304
268
|
checkedColumnKeys: columnKeys,
|
|
305
|
-
visibleColumns:
|
|
269
|
+
visibleColumns: columnSettingOptions === null || columnSettingOptions === void 0 ? void 0 : columnSettingOptions.filter(function (item) {
|
|
306
270
|
return columnKeys.includes(item.dataIndex || item.key);
|
|
307
271
|
})
|
|
308
272
|
});
|
|
309
273
|
} else {
|
|
310
|
-
var _rest$columns4;
|
|
311
|
-
|
|
312
274
|
setState({
|
|
313
|
-
checkedColumnKeys:
|
|
275
|
+
checkedColumnKeys: columnSettingOptions === null || columnSettingOptions === void 0 ? void 0 : columnSettingOptions.map(function (item) {
|
|
314
276
|
return item.dataIndex || item.key;
|
|
315
277
|
}),
|
|
316
|
-
visibleColumns:
|
|
278
|
+
visibleColumns: columnSettingOptions
|
|
317
279
|
});
|
|
318
280
|
}
|
|
319
281
|
} else {
|
|
320
282
|
setState({
|
|
321
|
-
visibleColumns:
|
|
283
|
+
visibleColumns: columnSettingOptions
|
|
322
284
|
});
|
|
323
285
|
}
|
|
324
286
|
};
|
|
325
|
-
|
|
326
287
|
var hasAlert = (((_rest$rowSelection2 = rest.rowSelection) === null || _rest$rowSelection2 === void 0 ? void 0 : _rest$rowSelection2.selectedRowKeys) || []).length > 0;
|
|
327
288
|
alertHeight.current = !hideSelectionClear && hasAlert ? 49 : 0;
|
|
328
|
-
toolbarHeight.current = toolbar ? 56 : 0;
|
|
289
|
+
toolbarHeight.current = toolbar ? 56 : 0;
|
|
329
290
|
|
|
291
|
+
// 列设置回调
|
|
330
292
|
var handleChangeColumns = function handleChangeColumns(keys) {
|
|
331
|
-
var
|
|
332
|
-
|
|
333
|
-
var columnKeys = keys || ((_rest$columns5 = rest.columns) === null || _rest$columns5 === void 0 ? void 0 : _rest$columns5.map(function (item) {
|
|
293
|
+
var columnKeys = keys || (columnSettingOptions === null || columnSettingOptions === void 0 ? void 0 : columnSettingOptions.map(function (item) {
|
|
334
294
|
return item.dataIndex || item.key;
|
|
335
295
|
}));
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
296
|
+
if (!(0, _isEqual["default"])(checkedColumnKeys, columnKeys)) {
|
|
297
|
+
setState({
|
|
298
|
+
checkedColumnKeys: columnKeys,
|
|
299
|
+
visibleColumns: columnSettingOptions === null || columnSettingOptions === void 0 ? void 0 : columnSettingOptions.filter(function (item) {
|
|
300
|
+
return columnKeys.includes(item.key);
|
|
301
|
+
})
|
|
302
|
+
});
|
|
303
|
+
onVisibleColumnsChange && onVisibleColumnsChange(columnKeys);
|
|
304
|
+
}
|
|
305
|
+
};
|
|
345
306
|
|
|
307
|
+
// 工具栏
|
|
346
308
|
var toolbarRender;
|
|
347
|
-
|
|
348
309
|
if (toolbar) {
|
|
349
310
|
toolbarRender = /*#__PURE__*/_react["default"].createElement("div", {
|
|
350
311
|
className: (0, _classnames2["default"])("".concat(prefixCls, "-toolbar"), toolbarClassName)
|
|
@@ -406,14 +367,13 @@ function VtxDatagrid(props) {
|
|
|
406
367
|
}, /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
|
|
407
368
|
title: TextEnum.columnSettingText
|
|
408
369
|
}, /*#__PURE__*/_react["default"].createElement(_SettingOutlined["default"], null)))))));
|
|
409
|
-
}
|
|
410
|
-
|
|
370
|
+
}
|
|
411
371
|
|
|
372
|
+
// 分页
|
|
412
373
|
var getPagination = function getPagination(pagination) {
|
|
413
374
|
if (typeof pagination === 'boolean' && !pagination) {
|
|
414
375
|
return pagination;
|
|
415
376
|
}
|
|
416
|
-
|
|
417
377
|
return _objectSpread({
|
|
418
378
|
pageSizeOptions: ['10', '20', '30', '40', '50'],
|
|
419
379
|
showSizeChanger: true,
|
|
@@ -422,20 +382,16 @@ function VtxDatagrid(props) {
|
|
|
422
382
|
return "".concat(TextEnum.paginationTotalText, " ").concat(total, " ").concat(TextEnum.paginationItemText);
|
|
423
383
|
}
|
|
424
384
|
}, pagination);
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
|
|
385
|
+
};
|
|
386
|
+
// 处理操作按钮
|
|
428
387
|
var columns = (visibleColumns || []).map(function (column) {
|
|
429
388
|
var newColumn = _objectSpread({}, column);
|
|
430
|
-
|
|
431
389
|
if (newColumn.renderButtons) {
|
|
432
390
|
delete newColumn.renderButtons;
|
|
433
391
|
}
|
|
434
|
-
|
|
435
392
|
if (newColumn.renderButtonsVisibleNum) {
|
|
436
393
|
delete newColumn.renderButtonsVisibleNum;
|
|
437
394
|
}
|
|
438
|
-
|
|
439
395
|
return _objectSpread(_objectSpread({}, newColumn), {}, {
|
|
440
396
|
render: (0, _isFunction["default"])(column.renderButtons) ? function (text, record, index) {
|
|
441
397
|
return (0, _renderColumnButtons["default"])(column.renderButtons, column.renderButtonsVisibleNum, text, record, index, TextEnum);
|
|
@@ -443,8 +399,8 @@ function VtxDatagrid(props) {
|
|
|
443
399
|
return ['', null, undefined].includes(text) ? '-' : text;
|
|
444
400
|
}
|
|
445
401
|
});
|
|
446
|
-
});
|
|
447
|
-
|
|
402
|
+
});
|
|
403
|
+
// 配置了列可伸缩
|
|
448
404
|
if (columnResizable) {
|
|
449
405
|
columns = columns.map(function (col, index) {
|
|
450
406
|
return _objectSpread(_objectSpread({}, col), {}, {
|
|
@@ -456,15 +412,12 @@ function VtxDatagrid(props) {
|
|
|
456
412
|
}
|
|
457
413
|
});
|
|
458
414
|
});
|
|
459
|
-
|
|
460
415
|
var handleResize = function handleResize(index) {
|
|
461
416
|
return function (e, _ref2) {
|
|
462
417
|
var size = _ref2.size;
|
|
463
418
|
setState(function (_ref3) {
|
|
464
419
|
var visibleColumns = _ref3.visibleColumns;
|
|
465
|
-
|
|
466
420
|
var nextColumns = _toConsumableArray(visibleColumns);
|
|
467
|
-
|
|
468
421
|
nextColumns[index] = _objectSpread(_objectSpread({}, nextColumns[index]), {}, {
|
|
469
422
|
width: size.width
|
|
470
423
|
});
|
|
@@ -474,39 +427,36 @@ function VtxDatagrid(props) {
|
|
|
474
427
|
});
|
|
475
428
|
};
|
|
476
429
|
};
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
|
|
430
|
+
}
|
|
431
|
+
// 序号添加
|
|
480
432
|
var dataSource = rest.dataSource;
|
|
481
|
-
|
|
482
433
|
if (indexColumn) {
|
|
483
434
|
var _dataSource;
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
}
|
|
435
|
+
// columns = [
|
|
436
|
+
// {
|
|
437
|
+
// title: indexTitle,
|
|
438
|
+
// dataIndex: indexColumnKey,
|
|
439
|
+
// key: indexColumnKey,
|
|
440
|
+
// width: indexWidth,
|
|
441
|
+
// fixed: indexFixed,
|
|
442
|
+
// },
|
|
443
|
+
// ...columns,
|
|
444
|
+
// ];
|
|
492
445
|
dataSource = (_dataSource = dataSource) === null || _dataSource === void 0 ? void 0 : _dataSource.map(function (item, i) {
|
|
493
446
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
494
447
|
_serialNum: i + startIndex
|
|
495
448
|
});
|
|
496
449
|
});
|
|
497
450
|
}
|
|
498
|
-
|
|
499
451
|
var scroll = rest.scroll || {};
|
|
500
|
-
|
|
501
452
|
if (autoFit) {
|
|
502
453
|
scroll = _objectSpread(_objectSpread({}, scroll), {}, {
|
|
503
454
|
y: scrollY - (rest.scrollY || 0)
|
|
504
455
|
});
|
|
505
456
|
}
|
|
506
|
-
|
|
507
457
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
508
458
|
id: datagridId,
|
|
509
|
-
className: (0, _classnames2["default"])(prefixCls, className, (
|
|
459
|
+
className: (0, _classnames2["default"])(prefixCls, className, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-fit"), autoFit), "".concat(prefixCls, "-noFit"), !autoFit), "".concat(prefixCls, "-nodata"), !((_dataSource2 = dataSource) !== null && _dataSource2 !== void 0 && _dataSource2.length)), "".concat(prefixCls, "-userAgent-mac"), isMac)),
|
|
510
460
|
style: style,
|
|
511
461
|
ref: datagridRef
|
|
512
462
|
}, toolbarRender, !hideSelectionClear && hasAlert ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -539,7 +489,6 @@ function VtxDatagrid(props) {
|
|
|
539
489
|
}) : components
|
|
540
490
|
})));
|
|
541
491
|
}
|
|
542
|
-
|
|
543
492
|
VtxDatagrid.propTypes = {
|
|
544
493
|
prefixCls: _propTypes["default"].string,
|
|
545
494
|
refreshIconVisible: _propTypes["default"].bool,
|