@vtx/components 4.0.0-beta.7 → 4.0.0-beta.70
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/es/index.js +3 -0
- package/es/utils/filterSpecialCharacters.js +47 -46
- package/es/utils/index.js +1 -2
- package/es/vtx-color-picker/index.js +138 -33
- package/es/vtx-color-picker/style/index.js +36 -12
- package/es/vtx-combogrid/Combogrid.js +16 -10
- package/es/vtx-combogrid/index.js +7 -4
- package/es/vtx-combogrid/style/index.js +4 -4
- package/es/vtx-datagrid/Store/Provide.js +109 -132
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +11 -5
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/es/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
- package/es/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
- package/es/vtx-datagrid/ToolBar/index.js +2 -2
- package/es/vtx-datagrid/columnState.js +64 -0
- package/es/vtx-datagrid/index.js +114 -35
- package/es/vtx-datagrid/mergeComponents.js +15 -0
- package/es/vtx-datagrid/renderColumnButtons.js +30 -11
- package/es/vtx-datagrid/style/index.js +102 -20
- package/es/vtx-date-picker/QdatePicker.js +1 -1
- package/es/vtx-descriptions/Descriptions.js +29 -0
- package/es/vtx-descriptions/index.js +3 -0
- package/es/vtx-descriptions/style/index.js +19 -0
- package/es/vtx-ellipsis-text/index.js +7 -2
- package/es/vtx-ellipsis-text/style/index.js +3 -1
- package/es/vtx-export/index.js +25 -25
- package/es/vtx-export-async/History.js +7 -3
- package/es/vtx-export-async/index.js +42 -14
- package/es/vtx-form-layout/Card.js +10 -10
- package/es/vtx-form-layout/Divider.js +1 -1
- package/es/vtx-form-layout/FormItem.js +18 -17
- package/es/vtx-form-layout/Pane.js +23 -12
- package/es/vtx-icon/index.js +54 -45
- package/es/vtx-icon/index.js1 +90 -0
- package/es/vtx-image/Preview.js +11 -6
- package/es/vtx-image/style/index.js +0 -1
- package/es/vtx-import/index.js +155 -43
- package/es/vtx-import/result.js +6 -2
- package/es/vtx-import/style/index.js +16 -1
- package/es/vtx-import2/Content.js +2 -1
- package/es/vtx-import2/index.js +31 -20
- package/es/vtx-import2/style/index.js +60 -9
- package/es/vtx-input/TextArea/index.js +11 -6
- package/es/vtx-modal/index.js +9 -4
- package/es/vtx-modal/style/index.js +5 -3
- package/es/vtx-page-layout/Content.js +1 -1
- package/es/vtx-page-layout/TabLayout.js +1 -7
- package/es/vtx-page-layout/TableLayout.js +14 -4
- package/es/vtx-page-layout/TableWrap.js +3 -2
- package/es/vtx-page-layout/TreeLayout.js +2 -8
- package/es/vtx-page-layout/container.js +6 -5
- package/es/vtx-page-layout/style/index.js +4 -2
- package/es/vtx-provider/index.js +20 -10
- package/es/vtx-provider/locale/en_US.js +65 -5
- package/es/vtx-provider/locale/zh_CN.js +75 -5
- package/es/vtx-provider/useStyle/index.js +8 -4
- package/es/vtx-scrollable-row/index.js +38 -28
- package/es/vtx-search/index.js +18 -13
- package/es/vtx-search/style/index.js +2 -1
- package/es/vtx-select/index.js +132 -46
- package/es/vtx-select/style/index.js +11 -56
- package/es/vtx-signature/index.js +5 -4
- package/es/vtx-signature/style/index.js +1 -1
- package/es/vtx-split-pane/Resizer.js +0 -1
- package/es/vtx-split-pane/SplitPane.js +34 -25
- package/es/vtx-split-pane/style/index.js +8 -112
- package/es/vtx-time-picker/index.js +27 -1
- package/es/vtx-transfer/Transfer.js +29 -0
- package/es/vtx-transfer/index.js +3 -0
- package/es/vtx-transfer/style/index.js +19 -0
- package/es/vtx-transfer-select/TransferSelect.js +143 -0
- package/es/vtx-transfer-select/index.js +3 -0
- package/es/vtx-transfer-select/style/index.js +19 -0
- package/es/vtx-tree/index.js +104 -40
- package/es/vtx-tree-select/index.js +75 -105
- package/es/vtx-tree-select/style/index.js +9 -3
- package/es/vtx-upload/FilePreview.js +2 -1
- package/es/vtx-wang-editor/index.js +291 -113
- package/es/vtx-wang-editor/wangEditorUtil.js +59 -9
- package/lib/index.js +36 -0
- package/lib/utils/filterSpecialCharacters.js +48 -46
- package/lib/utils/index.js +0 -7
- package/lib/vtx-color-picker/index.js +139 -34
- package/lib/vtx-color-picker/style/index.js +36 -12
- package/lib/vtx-combogrid/Combogrid.js +16 -10
- package/lib/vtx-combogrid/index.js +7 -4
- package/lib/vtx-combogrid/style/index.js +4 -4
- package/lib/vtx-datagrid/Store/Provide.js +116 -138
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +11 -6
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/lib/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
- package/lib/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
- package/lib/vtx-datagrid/ToolBar/index.js +2 -2
- package/lib/vtx-datagrid/columnState.js +73 -0
- package/lib/vtx-datagrid/index.js +115 -35
- package/lib/vtx-datagrid/mergeComponents.js +21 -0
- package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
- package/lib/vtx-datagrid/style/index.js +102 -20
- package/lib/vtx-date-picker/QdatePicker.js +1 -1
- package/lib/vtx-descriptions/Descriptions.js +38 -0
- package/lib/vtx-descriptions/index.js +15 -0
- package/lib/vtx-descriptions/style/index.js +25 -0
- package/lib/vtx-ellipsis-text/index.js +7 -2
- package/lib/vtx-ellipsis-text/style/index.js +3 -1
- package/lib/vtx-export/index.js +26 -26
- package/lib/vtx-export-async/History.js +7 -3
- package/lib/vtx-export-async/index.js +40 -12
- package/lib/vtx-form-layout/Card.js +9 -9
- package/lib/vtx-form-layout/Divider.js +1 -1
- package/lib/vtx-form-layout/FormItem.js +18 -17
- package/lib/vtx-form-layout/Pane.js +22 -11
- package/lib/vtx-icon/index.js +54 -52
- package/lib/vtx-icon/index.js1 +90 -0
- package/lib/vtx-image/Preview.js +11 -6
- package/lib/vtx-image/style/index.js +0 -1
- package/lib/vtx-import/index.js +154 -42
- package/lib/vtx-import/result.js +6 -2
- package/lib/vtx-import/style/index.js +16 -1
- package/lib/vtx-import2/Content.js +2 -1
- package/lib/vtx-import2/index.js +30 -19
- package/lib/vtx-import2/style/index.js +60 -9
- package/lib/vtx-input/TextArea/index.js +11 -6
- package/lib/vtx-modal/index.js +9 -4
- package/lib/vtx-modal/style/index.js +5 -3
- package/lib/vtx-page-layout/Content.js +1 -1
- package/lib/vtx-page-layout/TabLayout.js +3 -9
- package/lib/vtx-page-layout/TableLayout.js +14 -4
- package/lib/vtx-page-layout/TableWrap.js +3 -2
- package/lib/vtx-page-layout/TreeLayout.js +4 -10
- package/lib/vtx-page-layout/container.js +6 -5
- package/lib/vtx-page-layout/style/index.js +4 -2
- package/lib/vtx-provider/index.js +19 -10
- package/lib/vtx-provider/locale/en_US.js +65 -5
- package/lib/vtx-provider/locale/zh_CN.js +75 -5
- package/lib/vtx-provider/useStyle/index.js +8 -4
- package/lib/vtx-scrollable-row/index.js +38 -28
- package/lib/vtx-search/index.js +18 -13
- package/lib/vtx-search/style/index.js +2 -1
- package/lib/vtx-select/index.js +134 -48
- package/lib/vtx-select/style/index.js +11 -56
- package/lib/vtx-signature/index.js +4 -3
- package/lib/vtx-signature/style/index.js +1 -1
- package/lib/vtx-split-pane/Resizer.js +0 -1
- package/lib/vtx-split-pane/SplitPane.js +32 -23
- package/lib/vtx-split-pane/style/index.js +8 -112
- package/lib/vtx-time-picker/index.js +27 -1
- package/lib/vtx-transfer/Transfer.js +38 -0
- package/lib/vtx-transfer/index.js +15 -0
- package/lib/vtx-transfer/style/index.js +25 -0
- package/lib/vtx-transfer-select/TransferSelect.js +151 -0
- package/lib/vtx-transfer-select/index.js +15 -0
- package/lib/vtx-transfer-select/style/index.js +25 -0
- package/lib/vtx-tree/index.js +102 -38
- package/lib/vtx-tree-select/index.js +75 -105
- package/lib/vtx-tree-select/style/index.js +9 -3
- package/lib/vtx-upload/FilePreview.js +2 -1
- package/lib/vtx-wang-editor/index.js +289 -113
- package/lib/vtx-wang-editor/wangEditorUtil.js +59 -10
- package/package.json +44 -28
- package/es/utils/hooks/useFetchData/index.js +0 -82
- package/lib/utils/hooks/useFetchData/index.js +0 -89
|
@@ -14,7 +14,7 @@ var _vtxDatagrid = _interopRequireDefault(require("../vtx-datagrid"));
|
|
|
14
14
|
var _style = require("./style");
|
|
15
15
|
var _vtxProvider = require("../vtx-provider");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
var _excluded = ["setPopoverVisible", "multiple", "onChange", "getTableData", "columns", "searchForms", "selectedRowKeys", "setSelectedRowKeys", "spread", "defaultPageSize", "customEnumText"];
|
|
17
|
+
var _excluded = ["setPopoverVisible", "multiple", "onChange", "getTableData", "columns", "searchForms", "selectedRowKeys", "setSelectedRowKeys", "spread", "defaultPageSize", "customEnumText", "headFootHeight", "popoverWidth"];
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
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); }
|
|
20
20
|
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 && Object.prototype.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; }
|
|
@@ -35,10 +35,6 @@ function VtxCombogrid(props, ref) {
|
|
|
35
35
|
var intl = (0, _vtxProvider.useIntl)();
|
|
36
36
|
var _useContext = (0, _react.useContext)(_antd.ConfigProvider.ConfigContext),
|
|
37
37
|
getPrefixCls = _useContext.getPrefixCls;
|
|
38
|
-
var prefixCls = getPrefixCls('', 'vtx-combogrid');
|
|
39
|
-
var _useStyle = (0, _style.useStyle)(prefixCls),
|
|
40
|
-
wrapSSR = _useStyle.wrapSSR,
|
|
41
|
-
hashId = _useStyle.hashId;
|
|
42
38
|
var _useState = (0, _react.useState)(!!props.defaultExpandSearch),
|
|
43
39
|
_useState2 = _slicedToArray(_useState, 2),
|
|
44
40
|
more = _useState2[0],
|
|
@@ -55,11 +51,21 @@ function VtxCombogrid(props, ref) {
|
|
|
55
51
|
searchForms = _props$searchForms === void 0 ? [] : _props$searchForms,
|
|
56
52
|
selectedRowKeys = props.selectedRowKeys,
|
|
57
53
|
setSelectedRowKeys = props.setSelectedRowKeys,
|
|
58
|
-
spread = props.spread,
|
|
54
|
+
_props$spread = props.spread,
|
|
55
|
+
spread = _props$spread === void 0 ? false : _props$spread,
|
|
59
56
|
defaultPageSize = props.defaultPageSize,
|
|
60
57
|
_props$customEnumText = props.customEnumText,
|
|
61
58
|
customEnumText = _props$customEnumText === void 0 ? {} : _props$customEnumText,
|
|
59
|
+
_props$headFootHeight = props.headFootHeight,
|
|
60
|
+
headFootHeight = _props$headFootHeight === void 0 ? 95 : _props$headFootHeight,
|
|
61
|
+
popoverWidth = props.popoverWidth,
|
|
62
62
|
rest = _objectWithoutProperties(props, _excluded);
|
|
63
|
+
var prefixCls = getPrefixCls('', 'vtx-combogrid');
|
|
64
|
+
var _useStyle = (0, _style.useStyle)(prefixCls, {
|
|
65
|
+
popoverWidth: popoverWidth
|
|
66
|
+
}),
|
|
67
|
+
wrapSSR = _useStyle.wrapSSR,
|
|
68
|
+
hashId = _useStyle.hashId;
|
|
63
69
|
var TextEnum = _objectSpread({
|
|
64
70
|
indexTitle: intl.getMessage('indexTitle', '序号'),
|
|
65
71
|
actionMoreText: intl.getMessage('actionMoreText', '更多'),
|
|
@@ -94,7 +100,7 @@ function VtxCombogrid(props, ref) {
|
|
|
94
100
|
columns: columns,
|
|
95
101
|
startIndex: (current - 1) * pageSize + 1,
|
|
96
102
|
size: 'small',
|
|
97
|
-
headFootHeight:
|
|
103
|
+
headFootHeight: headFootHeight,
|
|
98
104
|
indexTitle: TextEnum.indexTitle,
|
|
99
105
|
onRowSelectionClear: clearSelectedRow,
|
|
100
106
|
pagination: _objectSpread(_objectSpread({}, pagination), {}, {
|
|
@@ -133,16 +139,16 @@ function VtxCombogrid(props, ref) {
|
|
|
133
139
|
});
|
|
134
140
|
}
|
|
135
141
|
|
|
136
|
-
//
|
|
142
|
+
// 重置会清空 selectedRowKeys,因此也需清空文本中的 value 值
|
|
137
143
|
var query = function query() {
|
|
138
144
|
submit();
|
|
139
|
-
if (multiple && selectedRowKeys.length) {
|
|
145
|
+
if (!spread && multiple && selectedRowKeys.length) {
|
|
140
146
|
clearSelectedRow();
|
|
141
147
|
}
|
|
142
148
|
};
|
|
143
149
|
var clear = function clear() {
|
|
144
150
|
reset();
|
|
145
|
-
if (multiple && selectedRowKeys.length) {
|
|
151
|
+
if (!spread && multiple && selectedRowKeys.length) {
|
|
146
152
|
clearSelectedRow();
|
|
147
153
|
}
|
|
148
154
|
};
|
|
@@ -10,7 +10,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
10
10
|
var _Combogrid = _interopRequireDefault(require("./Combogrid"));
|
|
11
11
|
var _antd = require("antd");
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
var _excluded = ["className", "style", "placeholder", "prefixCls", "value", "allowClear", "selectedRowKeys", "popoverProps", "inputProps", "content", "disabled"];
|
|
13
|
+
var _excluded = ["className", "style", "placeholder", "prefixCls", "value", "allowClear", "selectedRowKeys", "popoverProps", "inputProps", "content", "disabled", "spread"];
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
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); }
|
|
16
16
|
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 && Object.prototype.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; }
|
|
@@ -57,6 +57,8 @@ var VtxCombogrid = exports.VtxCombogrid = /*#__PURE__*/(0, _react.forwardRef)(fu
|
|
|
57
57
|
content = _props$content === void 0 ? null : _props$content,
|
|
58
58
|
_props$disabled = props.disabled,
|
|
59
59
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
60
|
+
_props$spread = props.spread,
|
|
61
|
+
spread = _props$spread === void 0 ? false : _props$spread,
|
|
60
62
|
rest = _objectWithoutProperties(props, _excluded);
|
|
61
63
|
(0, _react.useEffect)(function () {
|
|
62
64
|
setSelectedRowKeys(defaultSelectedRowKeys);
|
|
@@ -80,11 +82,12 @@ var VtxCombogrid = exports.VtxCombogrid = /*#__PURE__*/(0, _react.forwardRef)(fu
|
|
|
80
82
|
defaultSelectedRowKeys: defaultSelectedRowKeys,
|
|
81
83
|
setSelectedRowKeys: setSelectedRowKeys,
|
|
82
84
|
setPopoverVisible: setVisible,
|
|
85
|
+
spread: spread,
|
|
83
86
|
ref: comboRef
|
|
84
87
|
})),
|
|
85
88
|
trigger: "click",
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
open: disabled ? false : visible,
|
|
90
|
+
onOpenChange: function onOpenChange(visible) {
|
|
88
91
|
return setVisible(visible);
|
|
89
92
|
},
|
|
90
93
|
classNames: {
|
|
@@ -117,7 +120,7 @@ var _default = exports.default = VtxCombogrid;
|
|
|
117
120
|
VtxCombogrid.propTypes = {
|
|
118
121
|
prefixCls: _propTypes.default.string,
|
|
119
122
|
placeholder: _propTypes.default.string,
|
|
120
|
-
value: _propTypes.default.string,
|
|
123
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.array]),
|
|
121
124
|
allowClear: _propTypes.default.bool,
|
|
122
125
|
disabled: _propTypes.default.bool,
|
|
123
126
|
className: _propTypes.default.string,
|
|
@@ -11,10 +11,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
11
11
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
12
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
13
13
|
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); }
|
|
14
|
-
var genVtxStyle = function genVtxStyle(token) {
|
|
14
|
+
var genVtxStyle = function genVtxStyle(token, options) {
|
|
15
15
|
var componentCls = token.componentCls;
|
|
16
16
|
return _defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "&-popover", {
|
|
17
|
-
width: 550,
|
|
17
|
+
width: options.popoverWidth || 550,
|
|
18
18
|
'.ant-form-item': {
|
|
19
19
|
marginBottom: 12
|
|
20
20
|
}
|
|
@@ -38,11 +38,11 @@ var genVtxStyle = function genVtxStyle(token) {
|
|
|
38
38
|
}
|
|
39
39
|
}));
|
|
40
40
|
};
|
|
41
|
-
function useStyle(prefixCls) {
|
|
41
|
+
function useStyle(prefixCls, options) {
|
|
42
42
|
return (0, _vtxProvider.useStyle)(prefixCls, function (token) {
|
|
43
43
|
var vtxToken = _objectSpread(_objectSpread({}, token), {}, {
|
|
44
44
|
componentCls: ".".concat(prefixCls)
|
|
45
45
|
});
|
|
46
|
-
return [genVtxStyle(vtxToken)];
|
|
46
|
+
return [genVtxStyle(vtxToken, options)];
|
|
47
47
|
});
|
|
48
48
|
}
|
|
@@ -1,56 +1,106 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
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); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.indexColumnKey = exports.TableContext = exports.Container = void 0;
|
|
7
8
|
var _util = require("@rc-component/util");
|
|
8
|
-
var
|
|
9
|
+
var _request = _interopRequireDefault(require("@vtx/utils/lib/request"));
|
|
9
10
|
var _getSignature = _interopRequireDefault(require("@vtx/utils/lib/getSignature"));
|
|
11
|
+
var _vtxEllipsisText = _interopRequireDefault(require("../../vtx-ellipsis-text"));
|
|
10
12
|
var _react = require("react");
|
|
11
13
|
var _vtxProvider = require("../../vtx-provider");
|
|
12
14
|
var _antd = require("antd");
|
|
13
|
-
var
|
|
15
|
+
var _utils = require("../../utils");
|
|
14
16
|
var _renderColumnButtons = _interopRequireDefault(require("../renderColumnButtons"));
|
|
17
|
+
var _utils2 = require("@vtx/utils");
|
|
18
|
+
var _columnState = require("../columnState");
|
|
15
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
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); }
|
|
18
21
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
19
22
|
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."); }
|
|
20
23
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
21
24
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
25
|
+
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; }
|
|
26
|
+
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; }
|
|
27
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
28
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
29
|
+
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); }
|
|
22
30
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
23
31
|
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."); }
|
|
24
32
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
25
33
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
26
34
|
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; } }
|
|
27
35
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
|
-
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; }
|
|
29
|
-
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; }
|
|
30
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
32
|
-
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); }
|
|
33
36
|
var indexColumnKey = exports.indexColumnKey = '_serialNum';
|
|
37
|
+
function useMergedState1(defaultValue, option) {
|
|
38
|
+
var _ref = option || {},
|
|
39
|
+
controlledValue = _ref.value,
|
|
40
|
+
onChange = _ref.onChange,
|
|
41
|
+
id = _ref.id;
|
|
42
|
+
|
|
43
|
+
// 1. 初始化内部非受控状态
|
|
44
|
+
var _useState = (0, _react.useState)(defaultValue),
|
|
45
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
46
|
+
innerValue = _useState2[0],
|
|
47
|
+
setInnerValue = _useState2[1];
|
|
48
|
+
// 记录上一次的值,用于 onChange 回调传参
|
|
49
|
+
var prevValueRef = (0, _react.useRef)(controlledValue !== null && controlledValue !== void 0 ? controlledValue : innerValue);
|
|
50
|
+
// 2. 受控模式下,同步更新 prevValueRef
|
|
51
|
+
(0, _react.useEffect)(function () {
|
|
52
|
+
if (controlledValue !== undefined) {
|
|
53
|
+
prevValueRef.current = controlledValue;
|
|
54
|
+
}
|
|
55
|
+
}, [controlledValue]);
|
|
56
|
+
// 3. 统一的取值逻辑:优先用受控值,否则用内部值
|
|
57
|
+
var mergedValue = controlledValue !== undefined ? controlledValue : innerValue;
|
|
58
|
+
// 4. 统一的更新方法
|
|
59
|
+
var setValue = (0, _react.useCallback)(function (value) {
|
|
60
|
+
var prevValue = mergedValue;
|
|
61
|
+
// 处理函数式更新(和 useState 保持一致)
|
|
62
|
+
var nextValue = typeof value === 'function' ? value(prevValue) : value;
|
|
63
|
+
|
|
64
|
+
// 受控模式:调用 onChange,不更新内部 state
|
|
65
|
+
if (controlledValue !== undefined) {
|
|
66
|
+
onChange === null || onChange === void 0 || onChange(nextValue, prevValue);
|
|
67
|
+
}
|
|
68
|
+
// 非受控模式:更新内部 state,同时触发 onChange
|
|
69
|
+
else {
|
|
70
|
+
setInnerValue(nextValue);
|
|
71
|
+
onChange === null || onChange === void 0 || onChange(nextValue, prevValue);
|
|
72
|
+
}
|
|
73
|
+
// 更新上一次值的缓存
|
|
74
|
+
prevValueRef.current = nextValue;
|
|
75
|
+
}, [controlledValue, mergedValue, onChange]);
|
|
76
|
+
// 5. 重置方法:恢复到初始默认值
|
|
77
|
+
var reset = (0, _react.useCallback)(function () {
|
|
78
|
+
var resetValue = typeof defaultValue === 'function' ? defaultValue() : defaultValue;
|
|
79
|
+
setValue(resetValue);
|
|
80
|
+
}, [defaultValue, setValue]);
|
|
81
|
+
return [mergedValue, setValue, reset];
|
|
82
|
+
}
|
|
34
83
|
function useContainer() {
|
|
35
84
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
userId =
|
|
39
|
-
|
|
40
|
-
tenantId =
|
|
85
|
+
var _ref2 = (0, _utils2.getVtxToken)() || {},
|
|
86
|
+
_ref2$userId = _ref2.userId,
|
|
87
|
+
userId = _ref2$userId === void 0 ? '' : _ref2$userId,
|
|
88
|
+
_ref2$tenantId = _ref2.tenantId,
|
|
89
|
+
tenantId = _ref2$tenantId === void 0 ? '' : _ref2$tenantId;
|
|
41
90
|
var intl = (0, _vtxProvider.useIntl)();
|
|
42
91
|
var _props$indexColumn = props.indexColumn,
|
|
43
92
|
indexColumn = _props$indexColumn === void 0 ? true : _props$indexColumn,
|
|
44
93
|
_props$indexFixed = props.indexFixed,
|
|
45
94
|
indexFixed = _props$indexFixed === void 0 ? false : _props$indexFixed,
|
|
46
95
|
_props$indexTitle = props.indexTitle,
|
|
47
|
-
indexTitle = _props$indexTitle === void 0 ? '序号' : _props$indexTitle,
|
|
96
|
+
indexTitle = _props$indexTitle === void 0 ? intl.getMessage('indexTitle', '序号') : _props$indexTitle,
|
|
48
97
|
_props$indexWidth = props.indexWidth,
|
|
49
98
|
indexWidth = _props$indexWidth === void 0 ? 70 : _props$indexWidth,
|
|
50
99
|
onColumnsSave = props.onColumnsSave,
|
|
51
100
|
disabledColumnKeys = props.disabledColumnKeys,
|
|
52
101
|
hideColumnSetting = props.hideColumnSetting,
|
|
53
|
-
customEnumText = props.customEnumText
|
|
102
|
+
_props$customEnumText = props.customEnumText,
|
|
103
|
+
customEnumText = _props$customEnumText === void 0 ? {} : _props$customEnumText;
|
|
54
104
|
var TextEnum = _objectSpread({
|
|
55
105
|
refreshText: intl.getMessage('tableToolBar.reload', '刷新'),
|
|
56
106
|
densityDefaultText: intl.getMessage('tableToolBar.densityDefault', '默认'),
|
|
@@ -79,8 +129,8 @@ function useContainer() {
|
|
|
79
129
|
noFixedTitle: intl.getMessage('tableToolBar.noFixedTitle', '不固定'),
|
|
80
130
|
rightFixedTitle: intl.getMessage('tableToolBar.rightFixedTitle', '固定在右侧'),
|
|
81
131
|
columnAll: intl.getMessage('tableToolBar.columnAll', '全部'),
|
|
82
|
-
|
|
83
|
-
|
|
132
|
+
paginationTotalText: intl.getMessage('pagination.total.total', '共'),
|
|
133
|
+
paginationItemText: intl.getMessage('pagination.total.item', '条')
|
|
84
134
|
}, customEnumText);
|
|
85
135
|
var isFirst = (0, _react.useRef)(true);
|
|
86
136
|
var actionRef = (0, _react.useRef)();
|
|
@@ -92,22 +142,22 @@ function useContainer() {
|
|
|
92
142
|
var columnsMapRef = (0, _react.useRef)({});
|
|
93
143
|
// 是否可拖拽, 除非columns 至少需要一项不设置 width 让其自适应。
|
|
94
144
|
var isDragRef = (0, _react.useRef)(false);
|
|
95
|
-
var
|
|
96
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
97
|
-
columnsMap = _useState2[0],
|
|
98
|
-
setColumnsMap = _useState2[1];
|
|
99
|
-
var _useState3 = (0, _react.useState)(false),
|
|
145
|
+
var _useState3 = (0, _react.useState)({}),
|
|
100
146
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
var _useState5 = (0, _react.useState)(
|
|
147
|
+
columnsMap = _useState4[0],
|
|
148
|
+
setColumnsMap = _useState4[1];
|
|
149
|
+
var _useState5 = (0, _react.useState)(false),
|
|
104
150
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
var _useState7 = (0, _react.useState)(
|
|
151
|
+
showTable = _useState6[0],
|
|
152
|
+
setShowTable = _useState6[1];
|
|
153
|
+
var _useState7 = (0, _react.useState)(''),
|
|
108
154
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
109
|
-
|
|
110
|
-
|
|
155
|
+
keyWords = _useState8[0],
|
|
156
|
+
_setKeyWords = _useState8[1];
|
|
157
|
+
var _useState9 = (0, _react.useState)({}),
|
|
158
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
159
|
+
tableConfig = _useState10[0],
|
|
160
|
+
setTableConfig = _useState10[1];
|
|
111
161
|
var _useMergedState = (0, _util.useMergedState)(function () {
|
|
112
162
|
return props.size || props.defaultSize || 'middle';
|
|
113
163
|
}, {
|
|
@@ -118,7 +168,7 @@ function useContainer() {
|
|
|
118
168
|
tableSize = _useMergedState2[0],
|
|
119
169
|
setTableSize = _useMergedState2[1];
|
|
120
170
|
var _useMergedState3 = (0, _util.useMergedState)(function () {
|
|
121
|
-
return props.tableStyles || ['striped', 'header-background', 'border'];
|
|
171
|
+
return props.tableStyles || props.defaultTableStyles || ['striped', 'header-background', 'border'];
|
|
122
172
|
}, {
|
|
123
173
|
value: props.tableStyles,
|
|
124
174
|
onChange: props.onChangeTableStyles
|
|
@@ -127,7 +177,7 @@ function useContainer() {
|
|
|
127
177
|
tableStyles = _useMergedState4[0],
|
|
128
178
|
setTableStyles = _useMergedState4[1];
|
|
129
179
|
var _useMergedState5 = (0, _util.useMergedState)(function () {
|
|
130
|
-
return props.visibleColumnKeys || undefined;
|
|
180
|
+
return props.visibleColumnKeys || props.defaultVisibleColumnKeys || undefined;
|
|
131
181
|
}, {
|
|
132
182
|
value: props.visibleColumnKeys,
|
|
133
183
|
onChange: props.onVisibleColumnsChange
|
|
@@ -136,7 +186,7 @@ function useContainer() {
|
|
|
136
186
|
visibleColumnKeys = _useMergedState6[0],
|
|
137
187
|
setVisibleColumnKeys = _useMergedState6[1];
|
|
138
188
|
var _useMergedState7 = (0, _util.useMergedState)(function () {
|
|
139
|
-
return props.uniqueKey || undefined;
|
|
189
|
+
return props.uniqueKey || props.defaultUniqueKey || undefined;
|
|
140
190
|
}, {
|
|
141
191
|
value: props.uniqueKey,
|
|
142
192
|
onChange: props.onChangesUniqueKey
|
|
@@ -174,17 +224,25 @@ function useContainer() {
|
|
|
174
224
|
return _objectSpread(_objectSpread({}, newColumn), {}, {
|
|
175
225
|
key: newColumn.key || newColumn.dataIndex,
|
|
176
226
|
disable: disabledColumnKeys === null || disabledColumnKeys === void 0 ? void 0 : disabledColumnKeys.includes(column.dataIndex || column.key),
|
|
177
|
-
render: (0,
|
|
178
|
-
return (0,
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
227
|
+
render: (0, _utils.isFunction)(column.renderButtons) ? function (text, record, index) {
|
|
228
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
229
|
+
style: {
|
|
230
|
+
whiteSpace: 'nowrap'
|
|
231
|
+
},
|
|
232
|
+
children: (0, _renderColumnButtons.default)({
|
|
233
|
+
renderButtons: column.renderButtons,
|
|
234
|
+
visible: column.renderButtonsVisibleNum,
|
|
235
|
+
text: text,
|
|
236
|
+
record: record,
|
|
237
|
+
index: index,
|
|
238
|
+
TextEnum: TextEnum
|
|
239
|
+
})
|
|
185
240
|
});
|
|
186
241
|
} : 'render' in column ? column.render : function (text) {
|
|
187
|
-
return ['', null, undefined].includes(text) ? '-' : text
|
|
242
|
+
return ['', null, undefined].includes(text) ? '-' : column.ellipse && typeof text === 'string' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_vtxEllipsisText.default, {
|
|
243
|
+
text: text,
|
|
244
|
+
lineClamp: 2
|
|
245
|
+
}) : text;
|
|
188
246
|
}
|
|
189
247
|
});
|
|
190
248
|
});
|
|
@@ -193,112 +251,32 @@ function useContainer() {
|
|
|
193
251
|
|
|
194
252
|
// 默认值 可以从接口里获取
|
|
195
253
|
var defaultColumnKeyMap = (0, _react.useMemo)(function () {
|
|
196
|
-
var columnKeyMap = {};
|
|
197
254
|
if (tableConfig.columnsMap && tableConfig.sortKeyColumns) {
|
|
198
255
|
setColumnsMap(tableConfig.columnsMap);
|
|
199
256
|
sortKeyColumns.current = tableConfig.sortKeyColumns;
|
|
200
257
|
return tableConfig.columnsMap;
|
|
201
|
-
} else if (Array.isArray(props.defaultVisibleColumnKeys)) {
|
|
202
|
-
tableColumn === null || tableColumn === void 0 || tableColumn.forEach(function (_ref2, index) {
|
|
203
|
-
var _ref3;
|
|
204
|
-
var key = _ref2.key,
|
|
205
|
-
dataIndex = _ref2.dataIndex,
|
|
206
|
-
fixed = _ref2.fixed,
|
|
207
|
-
disable = _ref2.disable,
|
|
208
|
-
width = _ref2.width;
|
|
209
|
-
var columnKey = (0, _utils2.genColumnKey)(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
210
|
-
columnKeyMap[columnKey] = {
|
|
211
|
-
show: indexColumn && indexColumnKey == columnKey ? true : (_ref3 = _toConsumableArray(props.defaultVisibleColumnKeys)) === null || _ref3 === void 0 ? void 0 : _ref3.includes(columnKey),
|
|
212
|
-
fixed: fixed,
|
|
213
|
-
disable: disable,
|
|
214
|
-
width: width
|
|
215
|
-
};
|
|
216
|
-
});
|
|
217
|
-
} else {
|
|
218
|
-
tableColumn === null || tableColumn === void 0 || tableColumn.forEach(function (_ref4, index) {
|
|
219
|
-
var key = _ref4.key,
|
|
220
|
-
dataIndex = _ref4.dataIndex,
|
|
221
|
-
fixed = _ref4.fixed,
|
|
222
|
-
disable = _ref4.disable,
|
|
223
|
-
width = _ref4.width;
|
|
224
|
-
var columnKey = (0, _utils2.genColumnKey)(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
225
|
-
columnKeyMap[columnKey] = {
|
|
226
|
-
show: true,
|
|
227
|
-
fixed: fixed,
|
|
228
|
-
disable: disable,
|
|
229
|
-
width: width
|
|
230
|
-
};
|
|
231
|
-
});
|
|
232
258
|
}
|
|
233
|
-
return
|
|
259
|
+
return (0, _columnState.buildColumnKeyMap)(tableColumn, {
|
|
260
|
+
defaultVisibleColumnKeys: props.defaultVisibleColumnKeys,
|
|
261
|
+
indexColumn: indexColumn
|
|
262
|
+
});
|
|
234
263
|
}, [tableColumn, props.defaultVisibleColumnKeys, tableConfig, uniqueKey]);
|
|
235
264
|
|
|
236
265
|
// 深度比较 + 防抖 + 忽略这render函数引用变化
|
|
237
|
-
(0,
|
|
238
|
-
var columnKeyMap = {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
dataIndex = _ref5.dataIndex,
|
|
244
|
-
fixed = _ref5.fixed,
|
|
245
|
-
disable = _ref5.disable,
|
|
246
|
-
width = _ref5.width;
|
|
247
|
-
var columnKey = (0, _utils2.genColumnKey)(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
248
|
-
columnKeyMap[columnKey] = {
|
|
249
|
-
show: isFirst.current && indexColumn && indexColumnKey == columnKey ? true : (_ref6 = _toConsumableArray(visibleColumnKeys)) === null || _ref6 === void 0 ? void 0 : _ref6.includes(columnKey),
|
|
250
|
-
fixed: fixed,
|
|
251
|
-
disable: disable,
|
|
252
|
-
width: width
|
|
253
|
-
};
|
|
254
|
-
});
|
|
255
|
-
} else if (Array.isArray(props.defaultVisibleColumnKeys)) {
|
|
256
|
-
tableColumn === null || tableColumn === void 0 || tableColumn.forEach(function (_ref7, index) {
|
|
257
|
-
var _ref8;
|
|
258
|
-
var key = _ref7.key,
|
|
259
|
-
dataIndex = _ref7.dataIndex,
|
|
260
|
-
fixed = _ref7.fixed,
|
|
261
|
-
disable = _ref7.disable,
|
|
262
|
-
width = _ref7.width;
|
|
263
|
-
var columnKey = (0, _utils2.genColumnKey)(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
264
|
-
columnKeyMap[columnKey] = {
|
|
265
|
-
show: isFirst.current && indexColumn && indexColumnKey == columnKey ? true : (_ref8 = _toConsumableArray(props.defaultVisibleColumnKeys)) === null || _ref8 === void 0 ? void 0 : _ref8.includes(columnKey),
|
|
266
|
-
fixed: fixed,
|
|
267
|
-
disable: disable,
|
|
268
|
-
width: width
|
|
269
|
-
};
|
|
270
|
-
});
|
|
271
|
-
} else {
|
|
272
|
-
tableColumn === null || tableColumn === void 0 || tableColumn.forEach(function (_ref9, index) {
|
|
273
|
-
var key = _ref9.key,
|
|
274
|
-
dataIndex = _ref9.dataIndex,
|
|
275
|
-
fixed = _ref9.fixed,
|
|
276
|
-
disable = _ref9.disable,
|
|
277
|
-
width = _ref9.width;
|
|
278
|
-
var columnKey = (0, _utils2.genColumnKey)(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
279
|
-
columnKeyMap[columnKey] = {
|
|
280
|
-
show: true,
|
|
281
|
-
fixed: fixed,
|
|
282
|
-
disable: disable,
|
|
283
|
-
width: width
|
|
284
|
-
};
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
var sortKeys = visibleColumnKeys || props.defaultVisibleColumnKeys || [];
|
|
288
|
-
sortKeyColumns.current = Object.entries(columnKeyMap).map(function (_ref10) {
|
|
289
|
-
var _ref11 = _slicedToArray(_ref10, 1),
|
|
290
|
-
key = _ref11[0];
|
|
291
|
-
return key;
|
|
266
|
+
(0, _utils.useDeepCompareEffectDebounce)(function () {
|
|
267
|
+
var columnKeyMap = (0, _columnState.buildColumnKeyMap)(tableColumn, {
|
|
268
|
+
visibleColumnKeys: visibleColumnKeys,
|
|
269
|
+
defaultVisibleColumnKeys: props.defaultVisibleColumnKeys,
|
|
270
|
+
previousColumnsMap: columnsMapRef.current,
|
|
271
|
+
indexColumn: indexColumn
|
|
292
272
|
});
|
|
293
|
-
|
|
294
|
-
sortKeyColumns.current = (0, _utils2.sortByGivenOrder)(sortKeyColumns.current, sortKeys);
|
|
295
|
-
}
|
|
273
|
+
sortKeyColumns.current = (0, _columnState.buildSortKeyColumns)(columnKeyMap, visibleColumnKeys, props.defaultVisibleColumnKeys);
|
|
296
274
|
setColumnsMap(columnKeyMap);
|
|
297
275
|
if (isFirst.current) {
|
|
298
276
|
isFirst.current = false;
|
|
299
277
|
}
|
|
300
|
-
}, [visibleColumnKeys], ['render'], 100);
|
|
301
|
-
(0,
|
|
278
|
+
}, [visibleColumnKeys, props.defaultVisibleColumnKeys, tableColumn], ['render'], 100);
|
|
279
|
+
(0, _utils.useDeepCompareEffectDebounce)(function () {
|
|
302
280
|
var _sortKeyColumns$curre, _props$onVisibleColum;
|
|
303
281
|
var visibleColumnKeys = [];
|
|
304
282
|
(_sortKeyColumns$curre = sortKeyColumns.current) === null || _sortKeyColumns$curre === void 0 || _sortKeyColumns$curre.map(function (columnKey) {
|
|
@@ -318,7 +296,7 @@ function useContainer() {
|
|
|
318
296
|
var params = {
|
|
319
297
|
tableCode: uniqueKey
|
|
320
298
|
};
|
|
321
|
-
|
|
299
|
+
_request.default.get("".concat(location.origin, "/cloud/management/api/v101/user/config/table/page"), {
|
|
322
300
|
body: params
|
|
323
301
|
}).then(function (res) {
|
|
324
302
|
var _res$data;
|
|
@@ -345,7 +323,7 @@ function useContainer() {
|
|
|
345
323
|
var getUniqueKey = function getUniqueKey() {
|
|
346
324
|
var route = location.href.match(/#\/(\S*)\?/);
|
|
347
325
|
if (route) {
|
|
348
|
-
|
|
326
|
+
_request.default.get("".concat(location.pathname, "resources/json/menu.json"), {
|
|
349
327
|
headers: _objectSpread({}, (0, _getSignature.default)({}))
|
|
350
328
|
}).then(function (res) {
|
|
351
329
|
var _res$data2;
|
|
@@ -357,7 +335,7 @@ function useContainer() {
|
|
|
357
335
|
// setUniqueKey('test_demo_7')
|
|
358
336
|
};
|
|
359
337
|
var saveColumns = function saveColumns() {
|
|
360
|
-
|
|
338
|
+
_request.default.post("/cloud/management/api/v101/user/config/table/save", {
|
|
361
339
|
body: JSON.stringify({
|
|
362
340
|
showColumns: "".concat(sortKeyColumns.current.join(','), ";").concat(JSON.stringify(columnsMap)),
|
|
363
341
|
tableCode: uniqueKey,
|
|
@@ -15,6 +15,7 @@ var _vtxProvider = require("../../../../vtx-provider");
|
|
|
15
15
|
var _Provide = require("../../../Store/Provide");
|
|
16
16
|
var _vtxIcon = _interopRequireDefault(require("../../../../vtx-icon"));
|
|
17
17
|
var _style = require("./style");
|
|
18
|
+
var _columnState = require("../../../columnState");
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
20
|
var _excluded = ["key", "dataIndex", "children"],
|
|
20
21
|
_excluded2 = ["disabled"];
|
|
@@ -36,7 +37,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
36
37
|
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; }
|
|
37
38
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
38
39
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
39
|
-
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); }
|
|
40
|
+
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); } // omit 用于从对象中排除指定的属性,返回一个新对象
|
|
40
41
|
var ToolTipIcon = function ToolTipIcon(_ref) {
|
|
41
42
|
var title = _ref.title,
|
|
42
43
|
show = _ref.show,
|
|
@@ -248,7 +249,6 @@ var CheckboxList = function CheckboxList(_ref3) {
|
|
|
248
249
|
var dropPosition = info.dropPosition,
|
|
249
250
|
dropToGap = info.dropToGap;
|
|
250
251
|
var position = dropPosition === -1 || !dropToGap ? dropPosition + 1 : dropPosition;
|
|
251
|
-
console.log('newMap info', dragKey, dropKey, position);
|
|
252
252
|
move(dragKey, dropKey, position);
|
|
253
253
|
},
|
|
254
254
|
treeIcon: false,
|
|
@@ -365,15 +365,17 @@ function ColumnSetting(props) {
|
|
|
365
365
|
var _useStyle = (0, _style.useStyle)(prefixCls),
|
|
366
366
|
wrapSSR = _useStyle.wrapSSR,
|
|
367
367
|
hashId = _useStyle.hashId;
|
|
368
|
-
var localColumns = props.columns;
|
|
369
368
|
var _useContext8 = (0, _react.useContext)(_Provide.TableContext),
|
|
370
369
|
uniqueKey = _useContext8.uniqueKey,
|
|
371
370
|
columnsMap = _useContext8.columnsMap,
|
|
372
371
|
setColumnsMap = _useContext8.setColumnsMap,
|
|
373
372
|
defaultColumnKeyMap = _useContext8.defaultColumnKeyMap,
|
|
374
373
|
setSortKeyColumns = _useContext8.setSortKeyColumns,
|
|
374
|
+
sortKeyColumns = _useContext8.sortKeyColumns,
|
|
375
375
|
saveColumns = _useContext8.saveColumns,
|
|
376
|
-
TextEnum = _useContext8.TextEnum
|
|
376
|
+
TextEnum = _useContext8.TextEnum,
|
|
377
|
+
tableColumn = _useContext8.tableColumn;
|
|
378
|
+
var localColumns = props.localColumns;
|
|
377
379
|
var checkedColumnKeys = props.checkedColumnKeys,
|
|
378
380
|
onColumnsSave = props.onColumnsSave;
|
|
379
381
|
|
|
@@ -433,7 +435,7 @@ function ColumnSetting(props) {
|
|
|
433
435
|
|
|
434
436
|
// 保存按钮
|
|
435
437
|
var onSaveChange = function onSaveChange() {
|
|
436
|
-
onColumnsSave(checkedColumnKeys);
|
|
438
|
+
onColumnsSave(Array.isArray(checkedColumnKeys) ? checkedColumnKeys : (0, _columnState.getVisibleColumnKeysFromMap)(columnsMap, sortKeyColumns));
|
|
437
439
|
};
|
|
438
440
|
// 未选中的 key 列表
|
|
439
441
|
var unCheckedKeys = Object.values(columnsMap).filter(function (value) {
|
|
@@ -504,7 +506,10 @@ function ColumnSetting(props) {
|
|
|
504
506
|
children: TextEnum.columnSettingSaveText
|
|
505
507
|
})]
|
|
506
508
|
}) : null]
|
|
507
|
-
})
|
|
509
|
+
}),
|
|
510
|
+
getPopupContainer: function getPopupContainer(triggerNode) {
|
|
511
|
+
return triggerNode.parentNode;
|
|
512
|
+
}
|
|
508
513
|
// open={true}
|
|
509
514
|
,
|
|
510
515
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
@@ -27,7 +27,8 @@ var genVtxStyle = function genVtxStyle(token) {
|
|
|
27
27
|
padding: 0,
|
|
28
28
|
marginBottom: 10
|
|
29
29
|
}), '.ant-popover-content', _defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
30
|
-
padding: '0 16px 16px 16px'
|
|
30
|
+
padding: '0 16px 16px 16px',
|
|
31
|
+
width: 196
|
|
31
32
|
}, "".concat(token.antCls, "-tree-node-content-wrapper:hover"), {
|
|
32
33
|
backgroundColor: 'transparent'
|
|
33
34
|
}), ".ant-tree-switcher", {
|
|
@@ -35,7 +36,9 @@ var genVtxStyle = function genVtxStyle(token) {
|
|
|
35
36
|
}), "".concat(token.antCls, "-tree-draggable-icon"), {
|
|
36
37
|
cursor: 'grab'
|
|
37
38
|
}), "".concat(token.antCls, "-tree-treenode"), _defineProperty(_defineProperty({
|
|
38
|
-
alignItems: 'center'
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
paddingRight: 12,
|
|
41
|
+
boxSizing: 'border-box'
|
|
39
42
|
}, "".concat(token.antCls, "-tree-checkbox"), {
|
|
40
43
|
marginInlineEnd: 4
|
|
41
44
|
}), "".concat(token.antCls, "-tree-title"), {
|
|
@@ -34,6 +34,9 @@ function Density() {
|
|
|
34
34
|
selectedKeys: [counter.tableSize]
|
|
35
35
|
},
|
|
36
36
|
trigger: ['click'],
|
|
37
|
+
getPopupContainer: function getPopupContainer(triggerNode) {
|
|
38
|
+
return triggerNode.parentNode;
|
|
39
|
+
},
|
|
37
40
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
38
41
|
title: TextEnum.columnDensityText,
|
|
39
42
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
@@ -37,6 +37,9 @@ function TableStyle() {
|
|
|
37
37
|
trigger: ['click'],
|
|
38
38
|
placement: "bottomRight",
|
|
39
39
|
title: null,
|
|
40
|
+
getPopupContainer: function getPopupContainer(triggerNode) {
|
|
41
|
+
return triggerNode.parentNode;
|
|
42
|
+
},
|
|
40
43
|
content: list === null || list === void 0 ? void 0 : list.map(function (v) {
|
|
41
44
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
42
45
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Checkbox, {
|