@vtx/components 4.0.0-beta.8 → 4.0.0-beta.81
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/es/index.js +3 -0
- package/es/utils/components/LabelIconTip/index.js +7 -7
- package/es/utils/conversionMomentValue/index.js +25 -25
- package/es/utils/filterSpecialCharacters.js +53 -52
- package/es/utils/genCopyable/index.js +6 -6
- package/es/utils/getFieldPropsOrFormItemProps/index.js +7 -7
- package/es/utils/hooks/useDebounceFn/index.js +4 -4
- package/es/utils/hooks/useDebounceValue/index.js +6 -6
- package/es/utils/hooks/useDeepCompareMemo/index.js +7 -7
- package/es/utils/hooks/useLatest/index.js +2 -2
- package/es/utils/hooks/useRefCallback/index.js +5 -5
- package/es/utils/index.js +1 -2
- package/es/utils/isBrowser/index.js +7 -7
- package/es/utils/isUrl/index.js +4 -4
- package/es/utils/merge/index.js +4 -4
- package/es/utils/nanoid/index.js +4 -4
- package/es/utils/omitBoolean/index.js +4 -4
- package/es/utils/parseValueToMoment/index.js +4 -4
- package/es/utils/proFieldParsingText/index.js +10 -10
- package/es/utils/transformKeySubmitValue/index.js +57 -57
- package/es/utils/useEditableArray/index.js +46 -46
- package/es/utils/useEditableMap/index.js +22 -22
- package/es/utils/useMediaQuery/index.js +5 -5
- package/es/vtx-combogrid/Combogrid.js +5 -4
- package/es/vtx-combogrid/index.js +7 -4
- package/es/vtx-datagrid/Store/Provide.js +106 -137
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +11 -7
- 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/columnState.js +91 -0
- package/es/vtx-datagrid/index.js +124 -32
- 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-datagrid/style/index.less +242 -242
- package/es/vtx-date-picker/QdatePicker.js +1 -1
- package/es/vtx-date-picker/style/index.less +39 -39
- 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 +33 -33
- package/es/vtx-export-async/History.js +15 -7
- package/es/vtx-export-async/index.js +45 -15
- package/es/vtx-export-async/util.js +16 -5
- 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 +16 -16
- 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 +211 -70
- package/es/vtx-import/result.js +28 -26
- package/es/vtx-import/style/index.js +16 -1
- package/es/vtx-import2/Content.js +2 -1
- package/es/vtx-import2/index.js +30 -19
- package/es/vtx-import2/style/index.js +60 -9
- package/es/vtx-modal/index.js +11 -6
- package/es/vtx-page-layout/Basic.js +2 -2
- package/es/vtx-page-layout/TabLayout.js +6 -6
- package/es/vtx-page-layout/TableLayout.js +10 -10
- package/es/vtx-page-layout/TreeLayout.js +6 -6
- package/es/vtx-page-layout/container.js +2 -2
- package/es/vtx-page-layout/style/index.js +4 -2
- package/es/vtx-provider/index.js +37 -33
- package/es/vtx-provider/intl.js +9 -9
- package/es/vtx-provider/locale/en_US.js +57 -3
- package/es/vtx-provider/locale/zh_CN.js +57 -3
- package/es/vtx-provider/useStyle/index.js +17 -17
- package/es/vtx-search/index.js +13 -9
- package/es/vtx-search/style/index.js +2 -1
- package/es/vtx-select/index.js +102 -36
- 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 +42 -34
- 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 +98 -35
- package/es/vtx-tree-select/index.js +71 -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 +93 -39
- package/es/vtx-wang-editor/style/index.less +12 -12
- package/es/vtx-wang-editor/wangEditorUtil.js +4 -0
- package/lib/index.js +36 -0
- package/lib/utils/components/LabelIconTip/index.js +7 -7
- package/lib/utils/conversionMomentValue/index.js +25 -25
- package/lib/utils/filterSpecialCharacters.js +54 -52
- package/lib/utils/genCopyable/index.js +6 -6
- package/lib/utils/getFieldPropsOrFormItemProps/index.js +7 -7
- package/lib/utils/hooks/useDebounceFn/index.js +4 -4
- package/lib/utils/hooks/useDebounceValue/index.js +6 -6
- package/lib/utils/hooks/useDeepCompareMemo/index.js +7 -7
- package/lib/utils/hooks/useLatest/index.js +2 -2
- package/lib/utils/hooks/useRefCallback/index.js +5 -5
- package/lib/utils/index.js +0 -7
- package/lib/utils/isBrowser/index.js +7 -7
- package/lib/utils/isUrl/index.js +4 -4
- package/lib/utils/merge/index.js +4 -4
- package/lib/utils/nanoid/index.js +4 -4
- package/lib/utils/omitBoolean/index.js +4 -4
- package/lib/utils/parseValueToMoment/index.js +4 -4
- package/lib/utils/proFieldParsingText/index.js +10 -10
- package/lib/utils/transformKeySubmitValue/index.js +57 -57
- package/lib/utils/useEditableArray/index.js +46 -46
- package/lib/utils/useEditableMap/index.js +22 -22
- package/lib/utils/useMediaQuery/index.js +5 -5
- package/lib/vtx-combogrid/Combogrid.js +5 -4
- package/lib/vtx-combogrid/index.js +7 -4
- package/lib/vtx-datagrid/Store/Provide.js +113 -143
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +11 -7
- 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/columnState.js +100 -0
- package/lib/vtx-datagrid/index.js +124 -32
- 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-datagrid/style/index.less +242 -242
- package/lib/vtx-date-picker/QdatePicker.js +1 -1
- package/lib/vtx-date-picker/style/index.less +39 -39
- 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 +34 -34
- package/lib/vtx-export-async/History.js +14 -8
- package/lib/vtx-export-async/index.js +43 -13
- package/lib/vtx-export-async/util.js +16 -5
- 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 +16 -16
- 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 +209 -71
- package/lib/vtx-import/result.js +29 -27
- package/lib/vtx-import/style/index.js +16 -1
- package/lib/vtx-import2/Content.js +2 -1
- package/lib/vtx-import2/index.js +29 -18
- package/lib/vtx-import2/style/index.js +60 -9
- package/lib/vtx-modal/index.js +11 -6
- package/lib/vtx-page-layout/Basic.js +2 -2
- package/lib/vtx-page-layout/TabLayout.js +6 -6
- package/lib/vtx-page-layout/TableLayout.js +10 -10
- package/lib/vtx-page-layout/TreeLayout.js +6 -6
- package/lib/vtx-page-layout/container.js +2 -2
- package/lib/vtx-page-layout/style/index.js +4 -2
- package/lib/vtx-provider/index.js +37 -33
- package/lib/vtx-provider/intl.js +9 -9
- package/lib/vtx-provider/locale/en_US.js +57 -3
- package/lib/vtx-provider/locale/zh_CN.js +57 -3
- package/lib/vtx-provider/useStyle/index.js +17 -17
- package/lib/vtx-search/index.js +13 -9
- package/lib/vtx-search/style/index.js +2 -1
- package/lib/vtx-select/index.js +104 -38
- 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 +40 -31
- 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 +96 -33
- package/lib/vtx-tree-select/index.js +71 -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 +91 -37
- package/lib/vtx-wang-editor/style/index.less +12 -12
- package/lib/vtx-wang-editor/wangEditorUtil.js +4 -0
- package/package.json +240 -225
- package/es/utils/hooks/useFetchData/index.js +0 -82
- package/lib/utils/hooks/useFetchData/index.js +0 -89
|
@@ -25,19 +25,19 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
25
25
|
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; }
|
|
26
26
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
27
27
|
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); } /* eslint-disable react-hooks/exhaustive-deps */
|
|
28
|
-
/**
|
|
29
|
-
* 显示警告信息
|
|
30
|
-
* @param messageStr
|
|
28
|
+
/**
|
|
29
|
+
* 显示警告信息
|
|
30
|
+
* @param messageStr
|
|
31
31
|
*/
|
|
32
32
|
var warning = function warning(messageStr) {
|
|
33
33
|
return _antd.message.warning(messageStr);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
/**
|
|
37
|
-
* 使用map 来删除数据,性能一般 但是准确率比较高
|
|
38
|
-
*
|
|
39
|
-
* @param params
|
|
40
|
-
* @param action
|
|
36
|
+
/**
|
|
37
|
+
* 使用map 来删除数据,性能一般 但是准确率比较高
|
|
38
|
+
*
|
|
39
|
+
* @param params
|
|
40
|
+
* @param action
|
|
41
41
|
*/
|
|
42
42
|
function editableRowByKey(_ref) {
|
|
43
43
|
var data = _ref.data,
|
|
@@ -45,14 +45,14 @@ function editableRowByKey(_ref) {
|
|
|
45
45
|
return _objectSpread(_objectSpread({}, data), row);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
/**
|
|
49
|
-
* 一个方便的hooks 用于维护编辑的状态
|
|
50
|
-
*
|
|
51
|
-
* @param props
|
|
48
|
+
/**
|
|
49
|
+
* 一个方便的hooks 用于维护编辑的状态
|
|
50
|
+
*
|
|
51
|
+
* @param props
|
|
52
52
|
*/
|
|
53
53
|
function useEditableMap(props) {
|
|
54
|
-
/**
|
|
55
|
-
* 点击开始编辑之前的保存数据用的
|
|
54
|
+
/**
|
|
55
|
+
* 点击开始编辑之前的保存数据用的
|
|
56
56
|
*/
|
|
57
57
|
var preEditRowRef = (0, _react.useRef)(null);
|
|
58
58
|
var editableType = props.type || 'single';
|
|
@@ -84,10 +84,10 @@ function useEditableMap(props) {
|
|
|
84
84
|
return false;
|
|
85
85
|
}, [(editableKeys || []).join(',')]);
|
|
86
86
|
|
|
87
|
-
/**
|
|
88
|
-
* 进入编辑状态
|
|
89
|
-
*
|
|
90
|
-
* @param recordKey
|
|
87
|
+
/**
|
|
88
|
+
* 进入编辑状态
|
|
89
|
+
*
|
|
90
|
+
* @param recordKey
|
|
91
91
|
*/
|
|
92
92
|
var startEditable = function startEditable(recordKey, recordValue) {
|
|
93
93
|
var _ref2;
|
|
@@ -102,10 +102,10 @@ function useEditableMap(props) {
|
|
|
102
102
|
return true;
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
-
/**
|
|
106
|
-
* 退出编辑状态
|
|
107
|
-
*
|
|
108
|
-
* @param recordKey
|
|
105
|
+
/**
|
|
106
|
+
* 退出编辑状态
|
|
107
|
+
*
|
|
108
|
+
* @param recordKey
|
|
109
109
|
*/
|
|
110
110
|
var cancelEditable = function cancelEditable(recordKey) {
|
|
111
111
|
// 防止多次渲染
|
|
@@ -44,11 +44,11 @@ var MediaQueryEnum = exports.MediaQueryEnum = {
|
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
/**
|
|
48
|
-
* loop query screen className
|
|
49
|
-
* Array.find will throw a error
|
|
50
|
-
* `Rendered more hooks than during the previous render.`
|
|
51
|
-
* So should use Array.forEach
|
|
47
|
+
/**
|
|
48
|
+
* loop query screen className
|
|
49
|
+
* Array.find will throw a error
|
|
50
|
+
* `Rendered more hooks than during the previous render.`
|
|
51
|
+
* So should use Array.forEach
|
|
52
52
|
*/
|
|
53
53
|
var getScreenClassName = exports.getScreenClassName = function getScreenClassName() {
|
|
54
54
|
var queryKey = undefined;
|
|
@@ -51,7 +51,8 @@ function VtxCombogrid(props, ref) {
|
|
|
51
51
|
searchForms = _props$searchForms === void 0 ? [] : _props$searchForms,
|
|
52
52
|
selectedRowKeys = props.selectedRowKeys,
|
|
53
53
|
setSelectedRowKeys = props.setSelectedRowKeys,
|
|
54
|
-
spread = props.spread,
|
|
54
|
+
_props$spread = props.spread,
|
|
55
|
+
spread = _props$spread === void 0 ? false : _props$spread,
|
|
55
56
|
defaultPageSize = props.defaultPageSize,
|
|
56
57
|
_props$customEnumText = props.customEnumText,
|
|
57
58
|
customEnumText = _props$customEnumText === void 0 ? {} : _props$customEnumText,
|
|
@@ -138,16 +139,16 @@ function VtxCombogrid(props, ref) {
|
|
|
138
139
|
});
|
|
139
140
|
}
|
|
140
141
|
|
|
141
|
-
//
|
|
142
|
+
// 重置会清空 selectedRowKeys,因此也需清空文本中的 value 值
|
|
142
143
|
var query = function query() {
|
|
143
144
|
submit();
|
|
144
|
-
if (multiple && selectedRowKeys.length) {
|
|
145
|
+
if (!spread && multiple && selectedRowKeys.length) {
|
|
145
146
|
clearSelectedRow();
|
|
146
147
|
}
|
|
147
148
|
};
|
|
148
149
|
var clear = function clear() {
|
|
149
150
|
reset();
|
|
150
|
-
if (multiple && selectedRowKeys.length) {
|
|
151
|
+
if (!spread && multiple && selectedRowKeys.length) {
|
|
151
152
|
clearSelectedRow();
|
|
152
153
|
}
|
|
153
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,
|
|
@@ -1,43 +1,92 @@
|
|
|
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,
|
|
@@ -93,22 +142,22 @@ function useContainer() {
|
|
|
93
142
|
var columnsMapRef = (0, _react.useRef)({});
|
|
94
143
|
// 是否可拖拽, 除非columns 至少需要一项不设置 width 让其自适应。
|
|
95
144
|
var isDragRef = (0, _react.useRef)(false);
|
|
96
|
-
var
|
|
97
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
98
|
-
columnsMap = _useState2[0],
|
|
99
|
-
setColumnsMap = _useState2[1];
|
|
100
|
-
var _useState3 = (0, _react.useState)(false),
|
|
145
|
+
var _useState3 = (0, _react.useState)({}),
|
|
101
146
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
var _useState5 = (0, _react.useState)(
|
|
147
|
+
columnsMap = _useState4[0],
|
|
148
|
+
setColumnsMap = _useState4[1];
|
|
149
|
+
var _useState5 = (0, _react.useState)(false),
|
|
105
150
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
var _useState7 = (0, _react.useState)(
|
|
151
|
+
showTable = _useState6[0],
|
|
152
|
+
setShowTable = _useState6[1];
|
|
153
|
+
var _useState7 = (0, _react.useState)(''),
|
|
109
154
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
110
|
-
|
|
111
|
-
|
|
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];
|
|
112
161
|
var _useMergedState = (0, _util.useMergedState)(function () {
|
|
113
162
|
return props.size || props.defaultSize || 'middle';
|
|
114
163
|
}, {
|
|
@@ -119,7 +168,7 @@ function useContainer() {
|
|
|
119
168
|
tableSize = _useMergedState2[0],
|
|
120
169
|
setTableSize = _useMergedState2[1];
|
|
121
170
|
var _useMergedState3 = (0, _util.useMergedState)(function () {
|
|
122
|
-
return props.tableStyles || ['striped', 'header-background', 'border'];
|
|
171
|
+
return props.tableStyles || props.defaultTableStyles || ['striped', 'header-background', 'border'];
|
|
123
172
|
}, {
|
|
124
173
|
value: props.tableStyles,
|
|
125
174
|
onChange: props.onChangeTableStyles
|
|
@@ -128,7 +177,7 @@ function useContainer() {
|
|
|
128
177
|
tableStyles = _useMergedState4[0],
|
|
129
178
|
setTableStyles = _useMergedState4[1];
|
|
130
179
|
var _useMergedState5 = (0, _util.useMergedState)(function () {
|
|
131
|
-
return props.visibleColumnKeys || undefined;
|
|
180
|
+
return props.visibleColumnKeys || props.defaultVisibleColumnKeys || undefined;
|
|
132
181
|
}, {
|
|
133
182
|
value: props.visibleColumnKeys,
|
|
134
183
|
onChange: props.onVisibleColumnsChange
|
|
@@ -137,7 +186,7 @@ function useContainer() {
|
|
|
137
186
|
visibleColumnKeys = _useMergedState6[0],
|
|
138
187
|
setVisibleColumnKeys = _useMergedState6[1];
|
|
139
188
|
var _useMergedState7 = (0, _util.useMergedState)(function () {
|
|
140
|
-
return props.uniqueKey || undefined;
|
|
189
|
+
return props.uniqueKey || props.defaultUniqueKey || undefined;
|
|
141
190
|
}, {
|
|
142
191
|
value: props.uniqueKey,
|
|
143
192
|
onChange: props.onChangesUniqueKey
|
|
@@ -175,17 +224,25 @@ function useContainer() {
|
|
|
175
224
|
return _objectSpread(_objectSpread({}, newColumn), {}, {
|
|
176
225
|
key: newColumn.key || newColumn.dataIndex,
|
|
177
226
|
disable: disabledColumnKeys === null || disabledColumnKeys === void 0 ? void 0 : disabledColumnKeys.includes(column.dataIndex || column.key),
|
|
178
|
-
render: (0,
|
|
179
|
-
return (0,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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
|
+
})
|
|
186
240
|
});
|
|
187
241
|
} : 'render' in column ? column.render : function (text) {
|
|
188
|
-
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;
|
|
189
246
|
}
|
|
190
247
|
});
|
|
191
248
|
});
|
|
@@ -194,121 +251,34 @@ function useContainer() {
|
|
|
194
251
|
|
|
195
252
|
// 默认值 可以从接口里获取
|
|
196
253
|
var defaultColumnKeyMap = (0, _react.useMemo)(function () {
|
|
197
|
-
var columnKeyMap = {};
|
|
198
254
|
if (tableConfig.columnsMap && tableConfig.sortKeyColumns) {
|
|
199
255
|
setColumnsMap(tableConfig.columnsMap);
|
|
200
256
|
sortKeyColumns.current = tableConfig.sortKeyColumns;
|
|
201
257
|
return tableConfig.columnsMap;
|
|
202
|
-
} else if (Array.isArray(props.defaultVisibleColumnKeys)) {
|
|
203
|
-
tableColumn === null || tableColumn === void 0 || tableColumn.forEach(function (_ref2, index) {
|
|
204
|
-
var _ref3;
|
|
205
|
-
var key = _ref2.key,
|
|
206
|
-
dataIndex = _ref2.dataIndex,
|
|
207
|
-
fixed = _ref2.fixed,
|
|
208
|
-
disable = _ref2.disable,
|
|
209
|
-
width = _ref2.width;
|
|
210
|
-
var columnKey = (0, _utils2.genColumnKey)(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
211
|
-
columnKeyMap[columnKey] = {
|
|
212
|
-
show: indexColumn && indexColumnKey == columnKey ? true : (_ref3 = _toConsumableArray(props.defaultVisibleColumnKeys)) === null || _ref3 === void 0 ? void 0 : _ref3.includes(columnKey),
|
|
213
|
-
fixed: fixed,
|
|
214
|
-
disable: disable,
|
|
215
|
-
width: width
|
|
216
|
-
};
|
|
217
|
-
});
|
|
218
|
-
} else {
|
|
219
|
-
tableColumn === null || tableColumn === void 0 || tableColumn.forEach(function (_ref4, index) {
|
|
220
|
-
var key = _ref4.key,
|
|
221
|
-
dataIndex = _ref4.dataIndex,
|
|
222
|
-
fixed = _ref4.fixed,
|
|
223
|
-
disable = _ref4.disable,
|
|
224
|
-
width = _ref4.width;
|
|
225
|
-
var columnKey = (0, _utils2.genColumnKey)(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
226
|
-
columnKeyMap[columnKey] = {
|
|
227
|
-
show: true,
|
|
228
|
-
fixed: fixed,
|
|
229
|
-
disable: disable,
|
|
230
|
-
width: width
|
|
231
|
-
};
|
|
232
|
-
});
|
|
233
258
|
}
|
|
234
|
-
return
|
|
259
|
+
return (0, _columnState.buildColumnKeyMap)(tableColumn, {
|
|
260
|
+
defaultVisibleColumnKeys: props.defaultVisibleColumnKeys,
|
|
261
|
+
indexColumn: indexColumn
|
|
262
|
+
});
|
|
235
263
|
}, [tableColumn, props.defaultVisibleColumnKeys, tableConfig, uniqueKey]);
|
|
236
264
|
|
|
237
265
|
// 深度比较 + 防抖 + 忽略这render函数引用变化
|
|
238
|
-
(0,
|
|
239
|
-
var columnKeyMap = {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
dataIndex = _ref5.dataIndex,
|
|
245
|
-
fixed = _ref5.fixed,
|
|
246
|
-
disable = _ref5.disable,
|
|
247
|
-
width = _ref5.width;
|
|
248
|
-
var columnKey = (0, _utils2.genColumnKey)(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
249
|
-
columnKeyMap[columnKey] = {
|
|
250
|
-
show: isFirst.current && indexColumn && indexColumnKey == columnKey ? true : (_ref6 = _toConsumableArray(visibleColumnKeys)) === null || _ref6 === void 0 ? void 0 : _ref6.includes(columnKey),
|
|
251
|
-
fixed: fixed,
|
|
252
|
-
disable: disable,
|
|
253
|
-
width: width
|
|
254
|
-
};
|
|
255
|
-
});
|
|
256
|
-
} else if (Array.isArray(props.defaultVisibleColumnKeys)) {
|
|
257
|
-
tableColumn === null || tableColumn === void 0 || tableColumn.forEach(function (_ref7, index) {
|
|
258
|
-
var _ref8;
|
|
259
|
-
var key = _ref7.key,
|
|
260
|
-
dataIndex = _ref7.dataIndex,
|
|
261
|
-
fixed = _ref7.fixed,
|
|
262
|
-
disable = _ref7.disable,
|
|
263
|
-
width = _ref7.width;
|
|
264
|
-
var columnKey = (0, _utils2.genColumnKey)(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
265
|
-
columnKeyMap[columnKey] = {
|
|
266
|
-
show: isFirst.current && indexColumn && indexColumnKey == columnKey ? true : (_ref8 = _toConsumableArray(props.defaultVisibleColumnKeys)) === null || _ref8 === void 0 ? void 0 : _ref8.includes(columnKey),
|
|
267
|
-
fixed: fixed,
|
|
268
|
-
disable: disable,
|
|
269
|
-
width: width
|
|
270
|
-
};
|
|
271
|
-
});
|
|
272
|
-
} else {
|
|
273
|
-
tableColumn === null || tableColumn === void 0 || tableColumn.forEach(function (_ref9, index) {
|
|
274
|
-
var key = _ref9.key,
|
|
275
|
-
dataIndex = _ref9.dataIndex,
|
|
276
|
-
fixed = _ref9.fixed,
|
|
277
|
-
disable = _ref9.disable,
|
|
278
|
-
width = _ref9.width;
|
|
279
|
-
var columnKey = (0, _utils2.genColumnKey)(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
280
|
-
columnKeyMap[columnKey] = {
|
|
281
|
-
show: true,
|
|
282
|
-
fixed: fixed,
|
|
283
|
-
disable: disable,
|
|
284
|
-
width: width
|
|
285
|
-
};
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
var sortKeys = visibleColumnKeys || props.defaultVisibleColumnKeys || [];
|
|
289
|
-
sortKeyColumns.current = Object.entries(columnKeyMap).map(function (_ref10) {
|
|
290
|
-
var _ref11 = _slicedToArray(_ref10, 1),
|
|
291
|
-
key = _ref11[0];
|
|
292
|
-
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
|
|
293
272
|
});
|
|
294
|
-
|
|
295
|
-
sortKeyColumns.current = (0, _utils2.sortByGivenOrder)(sortKeyColumns.current, sortKeys);
|
|
296
|
-
}
|
|
273
|
+
sortKeyColumns.current = (0, _columnState.buildSortKeyColumns)(columnKeyMap, visibleColumnKeys, props.defaultVisibleColumnKeys);
|
|
297
274
|
setColumnsMap(columnKeyMap);
|
|
298
275
|
if (isFirst.current) {
|
|
299
276
|
isFirst.current = false;
|
|
300
277
|
}
|
|
301
|
-
}, [visibleColumnKeys], ['render'], 100);
|
|
302
|
-
(0,
|
|
303
|
-
var
|
|
304
|
-
|
|
305
|
-
(_sortKeyColumns$curre = sortKeyColumns.current) === null || _sortKeyColumns$curre === void 0 || _sortKeyColumns$curre.map(function (columnKey) {
|
|
306
|
-
var config = columnsMap[columnKey];
|
|
307
|
-
if (config !== null && config !== void 0 && config.show) {
|
|
308
|
-
visibleColumnKeys.push(columnKey);
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
(_props$onVisibleColum = props.onVisibleColumnsChange) === null || _props$onVisibleColum === void 0 || _props$onVisibleColum.call(props, visibleColumnKeys);
|
|
278
|
+
}, [visibleColumnKeys, props.defaultVisibleColumnKeys, tableColumn], ['render'], 100);
|
|
279
|
+
(0, _utils.useDeepCompareEffectDebounce)(function () {
|
|
280
|
+
var _props$onVisibleColum;
|
|
281
|
+
(_props$onVisibleColum = props.onVisibleColumnsChange) === null || _props$onVisibleColum === void 0 || _props$onVisibleColum.call(props, (0, _columnState.getVisibleColumnKeysFromMap)(columnsMap, sortKeyColumns.current));
|
|
312
282
|
}, [JSON.stringify(columnsMap), sortKeyColumns.current], ['render'], 200);
|
|
313
283
|
var show = function show() {
|
|
314
284
|
setTimeout(function () {
|
|
@@ -319,7 +289,7 @@ function useContainer() {
|
|
|
319
289
|
var params = {
|
|
320
290
|
tableCode: uniqueKey
|
|
321
291
|
};
|
|
322
|
-
|
|
292
|
+
_request.default.get("".concat(location.origin, "/cloud/management/api/v101/user/config/table/page"), {
|
|
323
293
|
body: params
|
|
324
294
|
}).then(function (res) {
|
|
325
295
|
var _res$data;
|
|
@@ -346,7 +316,7 @@ function useContainer() {
|
|
|
346
316
|
var getUniqueKey = function getUniqueKey() {
|
|
347
317
|
var route = location.href.match(/#\/(\S*)\?/);
|
|
348
318
|
if (route) {
|
|
349
|
-
|
|
319
|
+
_request.default.get("".concat(location.pathname, "resources/json/menu.json"), {
|
|
350
320
|
headers: _objectSpread({}, (0, _getSignature.default)({}))
|
|
351
321
|
}).then(function (res) {
|
|
352
322
|
var _res$data2;
|
|
@@ -358,7 +328,7 @@ function useContainer() {
|
|
|
358
328
|
// setUniqueKey('test_demo_7')
|
|
359
329
|
};
|
|
360
330
|
var saveColumns = function saveColumns() {
|
|
361
|
-
|
|
331
|
+
_request.default.post("/cloud/management/api/v101/user/config/table/save", {
|
|
362
332
|
body: JSON.stringify({
|
|
363
333
|
showColumns: "".concat(sortKeyColumns.current.join(','), ";").concat(JSON.stringify(columnsMap)),
|
|
364
334
|
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"];
|
|
@@ -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,
|
|
@@ -371,6 +371,7 @@ function ColumnSetting(props) {
|
|
|
371
371
|
setColumnsMap = _useContext8.setColumnsMap,
|
|
372
372
|
defaultColumnKeyMap = _useContext8.defaultColumnKeyMap,
|
|
373
373
|
setSortKeyColumns = _useContext8.setSortKeyColumns,
|
|
374
|
+
sortKeyColumns = _useContext8.sortKeyColumns,
|
|
374
375
|
saveColumns = _useContext8.saveColumns,
|
|
375
376
|
TextEnum = _useContext8.TextEnum,
|
|
376
377
|
tableColumn = _useContext8.tableColumn;
|
|
@@ -378,10 +379,10 @@ function ColumnSetting(props) {
|
|
|
378
379
|
var checkedColumnKeys = props.checkedColumnKeys,
|
|
379
380
|
onColumnsSave = props.onColumnsSave;
|
|
380
381
|
|
|
381
|
-
/**
|
|
382
|
-
* 设置全部选中,或全部未选中
|
|
383
|
-
*
|
|
384
|
-
* @param show
|
|
382
|
+
/**
|
|
383
|
+
* 设置全部选中,或全部未选中
|
|
384
|
+
*
|
|
385
|
+
* @param show
|
|
385
386
|
*/
|
|
386
387
|
var setAllSelectAction = (0, _utils.useRefFunction)(function () {
|
|
387
388
|
var show = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
@@ -434,7 +435,7 @@ function ColumnSetting(props) {
|
|
|
434
435
|
|
|
435
436
|
// 保存按钮
|
|
436
437
|
var onSaveChange = function onSaveChange() {
|
|
437
|
-
onColumnsSave(checkedColumnKeys);
|
|
438
|
+
onColumnsSave(Array.isArray(checkedColumnKeys) ? checkedColumnKeys : (0, _columnState.getVisibleColumnKeysFromMap)(columnsMap, sortKeyColumns));
|
|
438
439
|
};
|
|
439
440
|
// 未选中的 key 列表
|
|
440
441
|
var unCheckedKeys = Object.values(columnsMap).filter(function (value) {
|
|
@@ -505,7 +506,10 @@ function ColumnSetting(props) {
|
|
|
505
506
|
children: TextEnum.columnSettingSaveText
|
|
506
507
|
})]
|
|
507
508
|
}) : null]
|
|
508
|
-
})
|
|
509
|
+
}),
|
|
510
|
+
getPopupContainer: function getPopupContainer(triggerNode) {
|
|
511
|
+
return triggerNode.parentNode;
|
|
512
|
+
}
|
|
509
513
|
// open={true}
|
|
510
514
|
,
|
|
511
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, {
|