@vtx/components 4.0.0-beta.7 → 4.0.0-beta.71
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-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 +15 -9
- 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-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 +11 -3
- package/es/vtx-export-async/index.js +45 -15
- 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 +11 -6
- package/es/vtx-modal/style/index.js +5 -3
- package/es/vtx-page-layout/Basic.js +2 -2
- package/es/vtx-page-layout/Content.js +1 -1
- package/es/vtx-page-layout/TabLayout.js +7 -13
- package/es/vtx-page-layout/TableLayout.js +24 -14
- package/es/vtx-page-layout/TableWrap.js +3 -2
- package/es/vtx-page-layout/TreeLayout.js +8 -14
- package/es/vtx-page-layout/container.js +8 -7
- package/es/vtx-page-layout/style/index.js +4 -2
- package/es/vtx-provider/index.js +50 -40
- package/es/vtx-provider/intl.js +9 -9
- 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 +25 -21
- 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/style/index.less +12 -12
- package/es/vtx-wang-editor/wangEditorUtil.js +59 -9
- 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-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 +15 -10
- 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-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 +11 -3
- package/lib/vtx-export-async/index.js +43 -13
- 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 +11 -6
- package/lib/vtx-modal/style/index.js +5 -3
- package/lib/vtx-page-layout/Basic.js +2 -2
- package/lib/vtx-page-layout/Content.js +1 -1
- package/lib/vtx-page-layout/TabLayout.js +8 -14
- package/lib/vtx-page-layout/TableLayout.js +24 -14
- package/lib/vtx-page-layout/TableWrap.js +3 -2
- package/lib/vtx-page-layout/TreeLayout.js +9 -15
- package/lib/vtx-page-layout/container.js +8 -7
- package/lib/vtx-page-layout/style/index.js +4 -2
- package/lib/vtx-provider/index.js +49 -40
- package/lib/vtx-provider/intl.js +9 -9
- 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 +25 -21
- 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/style/index.less +12 -12
- package/lib/vtx-wang-editor/wangEditorUtil.js +59 -10
- package/package.json +238 -222
- package/es/utils/hooks/useFetchData/index.js +0 -82
- package/lib/utils/hooks/useFetchData/index.js +0 -89
|
@@ -4,21 +4,45 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
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; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
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); }
|
|
7
|
-
import 'rc-color-picker/assets/index.css';
|
|
8
7
|
import { useStyle as useAntdStyle } from "../../vtx-provider";
|
|
9
8
|
var genVtxColorPickerStyle = function genVtxColorPickerStyle(token) {
|
|
10
9
|
var componentCls = token.componentCls;
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
return {
|
|
11
|
+
'.ant-color-picker-inner': _defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty({}, "&-vertical, &-horizontal", {
|
|
12
|
+
'.ant-color-picker-presets': {
|
|
13
|
+
paddingTop: 4,
|
|
14
|
+
'.ant-color-picker-presets-items': {
|
|
15
|
+
'.ant-color-picker-presets-color': {
|
|
16
|
+
width: 18,
|
|
17
|
+
height: 18,
|
|
18
|
+
'&::before': {
|
|
19
|
+
width: "calc(18px + var(--ant-line-width) * 4)",
|
|
20
|
+
height: "calc(18px + var(--ant-line-width) * 4)"
|
|
21
|
+
},
|
|
22
|
+
'&::affter': {
|
|
23
|
+
width: "calc(18px / 13 * 5)",
|
|
24
|
+
height: "calc(18px / 13 * 8)"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}), "&-vertical", {
|
|
30
|
+
'.ant-collapse-header': {
|
|
31
|
+
display: 'none'
|
|
32
|
+
}
|
|
33
|
+
}), "&-horizontal", {
|
|
34
|
+
display: 'flex',
|
|
35
|
+
gap: 12,
|
|
36
|
+
'.ant-color-picker-presets': {
|
|
37
|
+
flex: 1
|
|
38
|
+
},
|
|
39
|
+
'>div': {
|
|
40
|
+
display: 'flex',
|
|
41
|
+
flexDirection: 'column',
|
|
42
|
+
width: 234
|
|
43
|
+
}
|
|
44
|
+
}))
|
|
45
|
+
};
|
|
22
46
|
};
|
|
23
47
|
export function useStyle(prefixCls) {
|
|
24
48
|
return useAntdStyle('VtxColorPicker', function (token) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
var _excluded = ["setPopoverVisible", "multiple", "onChange", "getTableData", "columns", "searchForms", "selectedRowKeys", "setSelectedRowKeys", "spread", "defaultPageSize", "customEnumText"];
|
|
2
|
+
var _excluded = ["setPopoverVisible", "multiple", "onChange", "getTableData", "columns", "searchForms", "selectedRowKeys", "setSelectedRowKeys", "spread", "defaultPageSize", "customEnumText", "headFootHeight", "popoverWidth"];
|
|
3
3
|
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; }
|
|
4
4
|
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; }
|
|
5
5
|
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; }
|
|
@@ -27,10 +27,6 @@ function VtxCombogrid(props, ref) {
|
|
|
27
27
|
var intl = useIntl();
|
|
28
28
|
var _useContext = useContext(ConfigProvider.ConfigContext),
|
|
29
29
|
getPrefixCls = _useContext.getPrefixCls;
|
|
30
|
-
var prefixCls = getPrefixCls('', 'vtx-combogrid');
|
|
31
|
-
var _useStyle = useStyle(prefixCls),
|
|
32
|
-
wrapSSR = _useStyle.wrapSSR,
|
|
33
|
-
hashId = _useStyle.hashId;
|
|
34
30
|
var _useState = useState(!!props.defaultExpandSearch),
|
|
35
31
|
_useState2 = _slicedToArray(_useState, 2),
|
|
36
32
|
more = _useState2[0],
|
|
@@ -47,11 +43,21 @@ function VtxCombogrid(props, ref) {
|
|
|
47
43
|
searchForms = _props$searchForms === void 0 ? [] : _props$searchForms,
|
|
48
44
|
selectedRowKeys = props.selectedRowKeys,
|
|
49
45
|
setSelectedRowKeys = props.setSelectedRowKeys,
|
|
50
|
-
spread = props.spread,
|
|
46
|
+
_props$spread = props.spread,
|
|
47
|
+
spread = _props$spread === void 0 ? false : _props$spread,
|
|
51
48
|
defaultPageSize = props.defaultPageSize,
|
|
52
49
|
_props$customEnumText = props.customEnumText,
|
|
53
50
|
customEnumText = _props$customEnumText === void 0 ? {} : _props$customEnumText,
|
|
51
|
+
_props$headFootHeight = props.headFootHeight,
|
|
52
|
+
headFootHeight = _props$headFootHeight === void 0 ? 95 : _props$headFootHeight,
|
|
53
|
+
popoverWidth = props.popoverWidth,
|
|
54
54
|
rest = _objectWithoutProperties(props, _excluded);
|
|
55
|
+
var prefixCls = getPrefixCls('', 'vtx-combogrid');
|
|
56
|
+
var _useStyle = useStyle(prefixCls, {
|
|
57
|
+
popoverWidth: popoverWidth
|
|
58
|
+
}),
|
|
59
|
+
wrapSSR = _useStyle.wrapSSR,
|
|
60
|
+
hashId = _useStyle.hashId;
|
|
55
61
|
var TextEnum = _objectSpread({
|
|
56
62
|
indexTitle: intl.getMessage('indexTitle', '序号'),
|
|
57
63
|
actionMoreText: intl.getMessage('actionMoreText', '更多'),
|
|
@@ -86,7 +92,7 @@ function VtxCombogrid(props, ref) {
|
|
|
86
92
|
columns: columns,
|
|
87
93
|
startIndex: (current - 1) * pageSize + 1,
|
|
88
94
|
size: 'small',
|
|
89
|
-
headFootHeight:
|
|
95
|
+
headFootHeight: headFootHeight,
|
|
90
96
|
indexTitle: TextEnum.indexTitle,
|
|
91
97
|
onRowSelectionClear: clearSelectedRow,
|
|
92
98
|
pagination: _objectSpread(_objectSpread({}, pagination), {}, {
|
|
@@ -125,16 +131,16 @@ function VtxCombogrid(props, ref) {
|
|
|
125
131
|
});
|
|
126
132
|
}
|
|
127
133
|
|
|
128
|
-
//
|
|
134
|
+
// 重置会清空 selectedRowKeys,因此也需清空文本中的 value 值
|
|
129
135
|
var query = function query() {
|
|
130
136
|
submit();
|
|
131
|
-
if (multiple && selectedRowKeys.length) {
|
|
137
|
+
if (!spread && multiple && selectedRowKeys.length) {
|
|
132
138
|
clearSelectedRow();
|
|
133
139
|
}
|
|
134
140
|
};
|
|
135
141
|
var clear = function clear() {
|
|
136
142
|
reset();
|
|
137
|
-
if (multiple && selectedRowKeys.length) {
|
|
143
|
+
if (!spread && multiple && selectedRowKeys.length) {
|
|
138
144
|
clearSelectedRow();
|
|
139
145
|
}
|
|
140
146
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
var _excluded = ["className", "style", "placeholder", "prefixCls", "value", "allowClear", "selectedRowKeys", "popoverProps", "inputProps", "content", "disabled"];
|
|
2
|
+
var _excluded = ["className", "style", "placeholder", "prefixCls", "value", "allowClear", "selectedRowKeys", "popoverProps", "inputProps", "content", "disabled", "spread"];
|
|
3
3
|
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; }
|
|
4
4
|
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; }
|
|
5
5
|
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; }
|
|
@@ -48,6 +48,8 @@ var VtxCombogrid = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
48
48
|
content = _props$content === void 0 ? null : _props$content,
|
|
49
49
|
_props$disabled = props.disabled,
|
|
50
50
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
51
|
+
_props$spread = props.spread,
|
|
52
|
+
spread = _props$spread === void 0 ? false : _props$spread,
|
|
51
53
|
rest = _objectWithoutProperties(props, _excluded);
|
|
52
54
|
useEffect(function () {
|
|
53
55
|
setSelectedRowKeys(defaultSelectedRowKeys);
|
|
@@ -71,11 +73,12 @@ var VtxCombogrid = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
71
73
|
defaultSelectedRowKeys: defaultSelectedRowKeys,
|
|
72
74
|
setSelectedRowKeys: setSelectedRowKeys,
|
|
73
75
|
setPopoverVisible: setVisible,
|
|
76
|
+
spread: spread,
|
|
74
77
|
ref: comboRef
|
|
75
78
|
})),
|
|
76
79
|
trigger: "click",
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
open: disabled ? false : visible,
|
|
81
|
+
onOpenChange: function onOpenChange(visible) {
|
|
79
82
|
return setVisible(visible);
|
|
80
83
|
},
|
|
81
84
|
classNames: {
|
|
@@ -109,7 +112,7 @@ export { VtxCombogrid };
|
|
|
109
112
|
VtxCombogrid.propTypes = {
|
|
110
113
|
prefixCls: PropTypes.string,
|
|
111
114
|
placeholder: PropTypes.string,
|
|
112
|
-
value: PropTypes.string,
|
|
115
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
113
116
|
allowClear: PropTypes.bool,
|
|
114
117
|
disabled: PropTypes.bool,
|
|
115
118
|
className: PropTypes.string,
|
|
@@ -5,10 +5,10 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
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); }
|
|
7
7
|
import { useStyle as useAntdStyle } from "../../vtx-provider";
|
|
8
|
-
var genVtxStyle = function genVtxStyle(token) {
|
|
8
|
+
var genVtxStyle = function genVtxStyle(token, options) {
|
|
9
9
|
var componentCls = token.componentCls;
|
|
10
10
|
return _defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "&-popover", {
|
|
11
|
-
width: 550,
|
|
11
|
+
width: options.popoverWidth || 550,
|
|
12
12
|
'.ant-form-item': {
|
|
13
13
|
marginBottom: 12
|
|
14
14
|
}
|
|
@@ -32,11 +32,11 @@ var genVtxStyle = function genVtxStyle(token) {
|
|
|
32
32
|
}
|
|
33
33
|
}));
|
|
34
34
|
};
|
|
35
|
-
export function useStyle(prefixCls) {
|
|
35
|
+
export function useStyle(prefixCls, options) {
|
|
36
36
|
return useAntdStyle(prefixCls, function (token) {
|
|
37
37
|
var vtxToken = _objectSpread(_objectSpread({}, token), {}, {
|
|
38
38
|
componentCls: ".".concat(prefixCls)
|
|
39
39
|
});
|
|
40
|
-
return [genVtxStyle(vtxToken)];
|
|
40
|
+
return [genVtxStyle(vtxToken, options)];
|
|
41
41
|
});
|
|
42
42
|
}
|
|
@@ -3,48 +3,97 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
|
|
|
3
3
|
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."); }
|
|
4
4
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
5
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
|
+
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); }
|
|
6
11
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
12
|
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."); }
|
|
8
13
|
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); }
|
|
9
14
|
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; }
|
|
10
15
|
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; } }
|
|
11
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
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; }
|
|
13
|
-
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; }
|
|
14
|
-
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; }
|
|
15
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
|
-
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); }
|
|
17
17
|
import { useMergedState } from '@rc-component/util';
|
|
18
|
-
import
|
|
18
|
+
import request from '@vtx/utils/lib/request';
|
|
19
19
|
import getSignature from '@vtx/utils/lib/getSignature';
|
|
20
|
-
import
|
|
20
|
+
import VtxEllipsisText from "../../vtx-ellipsis-text";
|
|
21
|
+
import { createContext, useEffect, useMemo, useRef, useState, useCallback } from 'react';
|
|
21
22
|
import { useIntl } from "../../vtx-provider";
|
|
22
23
|
import { message } from 'antd';
|
|
23
|
-
import { genColumnKey, isFunction,
|
|
24
|
+
import { genColumnKey, isFunction, useDeepCompareEffectDebounce } from "../../utils";
|
|
24
25
|
import renderColumnButtons from "../renderColumnButtons";
|
|
25
26
|
import { getVtxToken } from '@vtx/utils';
|
|
27
|
+
import { buildColumnKeyMap, buildSortKeyColumns } from "../columnState";
|
|
26
28
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
29
|
export var indexColumnKey = '_serialNum';
|
|
30
|
+
function useMergedState1(defaultValue, option) {
|
|
31
|
+
var _ref = option || {},
|
|
32
|
+
controlledValue = _ref.value,
|
|
33
|
+
onChange = _ref.onChange,
|
|
34
|
+
id = _ref.id;
|
|
35
|
+
|
|
36
|
+
// 1. 初始化内部非受控状态
|
|
37
|
+
var _useState = useState(defaultValue),
|
|
38
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
+
innerValue = _useState2[0],
|
|
40
|
+
setInnerValue = _useState2[1];
|
|
41
|
+
// 记录上一次的值,用于 onChange 回调传参
|
|
42
|
+
var prevValueRef = useRef(controlledValue !== null && controlledValue !== void 0 ? controlledValue : innerValue);
|
|
43
|
+
// 2. 受控模式下,同步更新 prevValueRef
|
|
44
|
+
useEffect(function () {
|
|
45
|
+
if (controlledValue !== undefined) {
|
|
46
|
+
prevValueRef.current = controlledValue;
|
|
47
|
+
}
|
|
48
|
+
}, [controlledValue]);
|
|
49
|
+
// 3. 统一的取值逻辑:优先用受控值,否则用内部值
|
|
50
|
+
var mergedValue = controlledValue !== undefined ? controlledValue : innerValue;
|
|
51
|
+
// 4. 统一的更新方法
|
|
52
|
+
var setValue = useCallback(function (value) {
|
|
53
|
+
var prevValue = mergedValue;
|
|
54
|
+
// 处理函数式更新(和 useState 保持一致)
|
|
55
|
+
var nextValue = typeof value === 'function' ? value(prevValue) : value;
|
|
56
|
+
|
|
57
|
+
// 受控模式:调用 onChange,不更新内部 state
|
|
58
|
+
if (controlledValue !== undefined) {
|
|
59
|
+
onChange === null || onChange === void 0 || onChange(nextValue, prevValue);
|
|
60
|
+
}
|
|
61
|
+
// 非受控模式:更新内部 state,同时触发 onChange
|
|
62
|
+
else {
|
|
63
|
+
setInnerValue(nextValue);
|
|
64
|
+
onChange === null || onChange === void 0 || onChange(nextValue, prevValue);
|
|
65
|
+
}
|
|
66
|
+
// 更新上一次值的缓存
|
|
67
|
+
prevValueRef.current = nextValue;
|
|
68
|
+
}, [controlledValue, mergedValue, onChange]);
|
|
69
|
+
// 5. 重置方法:恢复到初始默认值
|
|
70
|
+
var reset = useCallback(function () {
|
|
71
|
+
var resetValue = typeof defaultValue === 'function' ? defaultValue() : defaultValue;
|
|
72
|
+
setValue(resetValue);
|
|
73
|
+
}, [defaultValue, setValue]);
|
|
74
|
+
return [mergedValue, setValue, reset];
|
|
75
|
+
}
|
|
28
76
|
function useContainer() {
|
|
29
77
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
userId =
|
|
33
|
-
|
|
34
|
-
tenantId =
|
|
78
|
+
var _ref2 = getVtxToken() || {},
|
|
79
|
+
_ref2$userId = _ref2.userId,
|
|
80
|
+
userId = _ref2$userId === void 0 ? '' : _ref2$userId,
|
|
81
|
+
_ref2$tenantId = _ref2.tenantId,
|
|
82
|
+
tenantId = _ref2$tenantId === void 0 ? '' : _ref2$tenantId;
|
|
35
83
|
var intl = useIntl();
|
|
36
84
|
var _props$indexColumn = props.indexColumn,
|
|
37
85
|
indexColumn = _props$indexColumn === void 0 ? true : _props$indexColumn,
|
|
38
86
|
_props$indexFixed = props.indexFixed,
|
|
39
87
|
indexFixed = _props$indexFixed === void 0 ? false : _props$indexFixed,
|
|
40
88
|
_props$indexTitle = props.indexTitle,
|
|
41
|
-
indexTitle = _props$indexTitle === void 0 ? '序号' : _props$indexTitle,
|
|
89
|
+
indexTitle = _props$indexTitle === void 0 ? intl.getMessage('indexTitle', '序号') : _props$indexTitle,
|
|
42
90
|
_props$indexWidth = props.indexWidth,
|
|
43
91
|
indexWidth = _props$indexWidth === void 0 ? 70 : _props$indexWidth,
|
|
44
92
|
onColumnsSave = props.onColumnsSave,
|
|
45
93
|
disabledColumnKeys = props.disabledColumnKeys,
|
|
46
94
|
hideColumnSetting = props.hideColumnSetting,
|
|
47
|
-
customEnumText = props.customEnumText
|
|
95
|
+
_props$customEnumText = props.customEnumText,
|
|
96
|
+
customEnumText = _props$customEnumText === void 0 ? {} : _props$customEnumText;
|
|
48
97
|
var TextEnum = _objectSpread({
|
|
49
98
|
refreshText: intl.getMessage('tableToolBar.reload', '刷新'),
|
|
50
99
|
densityDefaultText: intl.getMessage('tableToolBar.densityDefault', '默认'),
|
|
@@ -73,8 +122,8 @@ function useContainer() {
|
|
|
73
122
|
noFixedTitle: intl.getMessage('tableToolBar.noFixedTitle', '不固定'),
|
|
74
123
|
rightFixedTitle: intl.getMessage('tableToolBar.rightFixedTitle', '固定在右侧'),
|
|
75
124
|
columnAll: intl.getMessage('tableToolBar.columnAll', '全部'),
|
|
76
|
-
|
|
77
|
-
|
|
125
|
+
paginationTotalText: intl.getMessage('pagination.total.total', '共'),
|
|
126
|
+
paginationItemText: intl.getMessage('pagination.total.item', '条')
|
|
78
127
|
}, customEnumText);
|
|
79
128
|
var isFirst = useRef(true);
|
|
80
129
|
var actionRef = useRef();
|
|
@@ -86,22 +135,22 @@ function useContainer() {
|
|
|
86
135
|
var columnsMapRef = useRef({});
|
|
87
136
|
// 是否可拖拽, 除非columns 至少需要一项不设置 width 让其自适应。
|
|
88
137
|
var isDragRef = useRef(false);
|
|
89
|
-
var
|
|
90
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
91
|
-
columnsMap = _useState2[0],
|
|
92
|
-
setColumnsMap = _useState2[1];
|
|
93
|
-
var _useState3 = useState(false),
|
|
138
|
+
var _useState3 = useState({}),
|
|
94
139
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var _useState5 = useState(
|
|
140
|
+
columnsMap = _useState4[0],
|
|
141
|
+
setColumnsMap = _useState4[1];
|
|
142
|
+
var _useState5 = useState(false),
|
|
98
143
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
var _useState7 = useState(
|
|
144
|
+
showTable = _useState6[0],
|
|
145
|
+
setShowTable = _useState6[1];
|
|
146
|
+
var _useState7 = useState(''),
|
|
102
147
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
103
|
-
|
|
104
|
-
|
|
148
|
+
keyWords = _useState8[0],
|
|
149
|
+
_setKeyWords = _useState8[1];
|
|
150
|
+
var _useState9 = useState({}),
|
|
151
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
152
|
+
tableConfig = _useState10[0],
|
|
153
|
+
setTableConfig = _useState10[1];
|
|
105
154
|
var _useMergedState = useMergedState(function () {
|
|
106
155
|
return props.size || props.defaultSize || 'middle';
|
|
107
156
|
}, {
|
|
@@ -112,7 +161,7 @@ function useContainer() {
|
|
|
112
161
|
tableSize = _useMergedState2[0],
|
|
113
162
|
setTableSize = _useMergedState2[1];
|
|
114
163
|
var _useMergedState3 = useMergedState(function () {
|
|
115
|
-
return props.tableStyles || ['striped', 'header-background', 'border'];
|
|
164
|
+
return props.tableStyles || props.defaultTableStyles || ['striped', 'header-background', 'border'];
|
|
116
165
|
}, {
|
|
117
166
|
value: props.tableStyles,
|
|
118
167
|
onChange: props.onChangeTableStyles
|
|
@@ -121,7 +170,7 @@ function useContainer() {
|
|
|
121
170
|
tableStyles = _useMergedState4[0],
|
|
122
171
|
setTableStyles = _useMergedState4[1];
|
|
123
172
|
var _useMergedState5 = useMergedState(function () {
|
|
124
|
-
return props.visibleColumnKeys || undefined;
|
|
173
|
+
return props.visibleColumnKeys || props.defaultVisibleColumnKeys || undefined;
|
|
125
174
|
}, {
|
|
126
175
|
value: props.visibleColumnKeys,
|
|
127
176
|
onChange: props.onVisibleColumnsChange
|
|
@@ -130,7 +179,7 @@ function useContainer() {
|
|
|
130
179
|
visibleColumnKeys = _useMergedState6[0],
|
|
131
180
|
setVisibleColumnKeys = _useMergedState6[1];
|
|
132
181
|
var _useMergedState7 = useMergedState(function () {
|
|
133
|
-
return props.uniqueKey || undefined;
|
|
182
|
+
return props.uniqueKey || props.defaultUniqueKey || undefined;
|
|
134
183
|
}, {
|
|
135
184
|
value: props.uniqueKey,
|
|
136
185
|
onChange: props.onChangesUniqueKey
|
|
@@ -169,16 +218,24 @@ function useContainer() {
|
|
|
169
218
|
key: newColumn.key || newColumn.dataIndex,
|
|
170
219
|
disable: disabledColumnKeys === null || disabledColumnKeys === void 0 ? void 0 : disabledColumnKeys.includes(column.dataIndex || column.key),
|
|
171
220
|
render: isFunction(column.renderButtons) ? function (text, record, index) {
|
|
172
|
-
return
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
221
|
+
return /*#__PURE__*/_jsx("div", {
|
|
222
|
+
style: {
|
|
223
|
+
whiteSpace: 'nowrap'
|
|
224
|
+
},
|
|
225
|
+
children: renderColumnButtons({
|
|
226
|
+
renderButtons: column.renderButtons,
|
|
227
|
+
visible: column.renderButtonsVisibleNum,
|
|
228
|
+
text: text,
|
|
229
|
+
record: record,
|
|
230
|
+
index: index,
|
|
231
|
+
TextEnum: TextEnum
|
|
232
|
+
})
|
|
179
233
|
});
|
|
180
234
|
} : 'render' in column ? column.render : function (text) {
|
|
181
|
-
return ['', null, undefined].includes(text) ? '-' : text
|
|
235
|
+
return ['', null, undefined].includes(text) ? '-' : column.ellipse && typeof text === 'string' ? /*#__PURE__*/_jsx(VtxEllipsisText, {
|
|
236
|
+
text: text,
|
|
237
|
+
lineClamp: 2
|
|
238
|
+
}) : text;
|
|
182
239
|
}
|
|
183
240
|
});
|
|
184
241
|
});
|
|
@@ -187,111 +244,31 @@ function useContainer() {
|
|
|
187
244
|
|
|
188
245
|
// 默认值 可以从接口里获取
|
|
189
246
|
var defaultColumnKeyMap = useMemo(function () {
|
|
190
|
-
var columnKeyMap = {};
|
|
191
247
|
if (tableConfig.columnsMap && tableConfig.sortKeyColumns) {
|
|
192
248
|
setColumnsMap(tableConfig.columnsMap);
|
|
193
249
|
sortKeyColumns.current = tableConfig.sortKeyColumns;
|
|
194
250
|
return tableConfig.columnsMap;
|
|
195
|
-
} else if (Array.isArray(props.defaultVisibleColumnKeys)) {
|
|
196
|
-
tableColumn === null || tableColumn === void 0 || tableColumn.forEach(function (_ref2, index) {
|
|
197
|
-
var _ref3;
|
|
198
|
-
var key = _ref2.key,
|
|
199
|
-
dataIndex = _ref2.dataIndex,
|
|
200
|
-
fixed = _ref2.fixed,
|
|
201
|
-
disable = _ref2.disable,
|
|
202
|
-
width = _ref2.width;
|
|
203
|
-
var columnKey = genColumnKey(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
204
|
-
columnKeyMap[columnKey] = {
|
|
205
|
-
show: indexColumn && indexColumnKey == columnKey ? true : (_ref3 = _toConsumableArray(props.defaultVisibleColumnKeys)) === null || _ref3 === void 0 ? void 0 : _ref3.includes(columnKey),
|
|
206
|
-
fixed: fixed,
|
|
207
|
-
disable: disable,
|
|
208
|
-
width: width
|
|
209
|
-
};
|
|
210
|
-
});
|
|
211
|
-
} else {
|
|
212
|
-
tableColumn === null || tableColumn === void 0 || tableColumn.forEach(function (_ref4, index) {
|
|
213
|
-
var key = _ref4.key,
|
|
214
|
-
dataIndex = _ref4.dataIndex,
|
|
215
|
-
fixed = _ref4.fixed,
|
|
216
|
-
disable = _ref4.disable,
|
|
217
|
-
width = _ref4.width;
|
|
218
|
-
var columnKey = genColumnKey(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
219
|
-
columnKeyMap[columnKey] = {
|
|
220
|
-
show: true,
|
|
221
|
-
fixed: fixed,
|
|
222
|
-
disable: disable,
|
|
223
|
-
width: width
|
|
224
|
-
};
|
|
225
|
-
});
|
|
226
251
|
}
|
|
227
|
-
return
|
|
252
|
+
return buildColumnKeyMap(tableColumn, {
|
|
253
|
+
defaultVisibleColumnKeys: props.defaultVisibleColumnKeys,
|
|
254
|
+
indexColumn: indexColumn
|
|
255
|
+
});
|
|
228
256
|
}, [tableColumn, props.defaultVisibleColumnKeys, tableConfig, uniqueKey]);
|
|
229
257
|
|
|
230
258
|
// 深度比较 + 防抖 + 忽略这render函数引用变化
|
|
231
259
|
useDeepCompareEffectDebounce(function () {
|
|
232
|
-
var columnKeyMap = {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
dataIndex = _ref5.dataIndex,
|
|
238
|
-
fixed = _ref5.fixed,
|
|
239
|
-
disable = _ref5.disable,
|
|
240
|
-
width = _ref5.width;
|
|
241
|
-
var columnKey = genColumnKey(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
242
|
-
columnKeyMap[columnKey] = {
|
|
243
|
-
show: isFirst.current && indexColumn && indexColumnKey == columnKey ? true : (_ref6 = _toConsumableArray(visibleColumnKeys)) === null || _ref6 === void 0 ? void 0 : _ref6.includes(columnKey),
|
|
244
|
-
fixed: fixed,
|
|
245
|
-
disable: disable,
|
|
246
|
-
width: width
|
|
247
|
-
};
|
|
248
|
-
});
|
|
249
|
-
} else if (Array.isArray(props.defaultVisibleColumnKeys)) {
|
|
250
|
-
tableColumn === null || tableColumn === void 0 || tableColumn.forEach(function (_ref7, index) {
|
|
251
|
-
var _ref8;
|
|
252
|
-
var key = _ref7.key,
|
|
253
|
-
dataIndex = _ref7.dataIndex,
|
|
254
|
-
fixed = _ref7.fixed,
|
|
255
|
-
disable = _ref7.disable,
|
|
256
|
-
width = _ref7.width;
|
|
257
|
-
var columnKey = genColumnKey(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
258
|
-
columnKeyMap[columnKey] = {
|
|
259
|
-
show: isFirst.current && indexColumn && indexColumnKey == columnKey ? true : (_ref8 = _toConsumableArray(props.defaultVisibleColumnKeys)) === null || _ref8 === void 0 ? void 0 : _ref8.includes(columnKey),
|
|
260
|
-
fixed: fixed,
|
|
261
|
-
disable: disable,
|
|
262
|
-
width: width
|
|
263
|
-
};
|
|
264
|
-
});
|
|
265
|
-
} else {
|
|
266
|
-
tableColumn === null || tableColumn === void 0 || tableColumn.forEach(function (_ref9, index) {
|
|
267
|
-
var key = _ref9.key,
|
|
268
|
-
dataIndex = _ref9.dataIndex,
|
|
269
|
-
fixed = _ref9.fixed,
|
|
270
|
-
disable = _ref9.disable,
|
|
271
|
-
width = _ref9.width;
|
|
272
|
-
var columnKey = genColumnKey(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
273
|
-
columnKeyMap[columnKey] = {
|
|
274
|
-
show: true,
|
|
275
|
-
fixed: fixed,
|
|
276
|
-
disable: disable,
|
|
277
|
-
width: width
|
|
278
|
-
};
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
var sortKeys = visibleColumnKeys || props.defaultVisibleColumnKeys || [];
|
|
282
|
-
sortKeyColumns.current = Object.entries(columnKeyMap).map(function (_ref10) {
|
|
283
|
-
var _ref11 = _slicedToArray(_ref10, 1),
|
|
284
|
-
key = _ref11[0];
|
|
285
|
-
return key;
|
|
260
|
+
var columnKeyMap = buildColumnKeyMap(tableColumn, {
|
|
261
|
+
visibleColumnKeys: visibleColumnKeys,
|
|
262
|
+
defaultVisibleColumnKeys: props.defaultVisibleColumnKeys,
|
|
263
|
+
previousColumnsMap: columnsMapRef.current,
|
|
264
|
+
indexColumn: indexColumn
|
|
286
265
|
});
|
|
287
|
-
|
|
288
|
-
sortKeyColumns.current = sortByGivenOrder(sortKeyColumns.current, sortKeys);
|
|
289
|
-
}
|
|
266
|
+
sortKeyColumns.current = buildSortKeyColumns(columnKeyMap, visibleColumnKeys, props.defaultVisibleColumnKeys);
|
|
290
267
|
setColumnsMap(columnKeyMap);
|
|
291
268
|
if (isFirst.current) {
|
|
292
269
|
isFirst.current = false;
|
|
293
270
|
}
|
|
294
|
-
}, [visibleColumnKeys], ['render'], 100);
|
|
271
|
+
}, [visibleColumnKeys, props.defaultVisibleColumnKeys, tableColumn], ['render'], 100);
|
|
295
272
|
useDeepCompareEffectDebounce(function () {
|
|
296
273
|
var _sortKeyColumns$curre, _props$onVisibleColum;
|
|
297
274
|
var visibleColumnKeys = [];
|
|
@@ -29,6 +29,8 @@ import { VtxProvider } from "../../../../vtx-provider";
|
|
|
29
29
|
import { TableContext } from "../../../Store/Provide";
|
|
30
30
|
import VtxIcon from "../../../../vtx-icon";
|
|
31
31
|
import { useStyle } from "./style";
|
|
32
|
+
import { getVisibleColumnKeysFromMap } from "../../../columnState";
|
|
33
|
+
// omit 用于从对象中排除指定的属性,返回一个新对象
|
|
32
34
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
33
35
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
34
36
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -243,7 +245,6 @@ var CheckboxList = function CheckboxList(_ref3) {
|
|
|
243
245
|
var dropPosition = info.dropPosition,
|
|
244
246
|
dropToGap = info.dropToGap;
|
|
245
247
|
var position = dropPosition === -1 || !dropToGap ? dropPosition + 1 : dropPosition;
|
|
246
|
-
console.log('newMap info', dragKey, dropKey, position);
|
|
247
248
|
move(dragKey, dropKey, position);
|
|
248
249
|
},
|
|
249
250
|
treeIcon: false,
|
|
@@ -360,22 +361,24 @@ export default function ColumnSetting(props) {
|
|
|
360
361
|
var _useStyle = useStyle(prefixCls),
|
|
361
362
|
wrapSSR = _useStyle.wrapSSR,
|
|
362
363
|
hashId = _useStyle.hashId;
|
|
363
|
-
var localColumns = props.columns;
|
|
364
364
|
var _useContext8 = useContext(TableContext),
|
|
365
365
|
uniqueKey = _useContext8.uniqueKey,
|
|
366
366
|
columnsMap = _useContext8.columnsMap,
|
|
367
367
|
setColumnsMap = _useContext8.setColumnsMap,
|
|
368
368
|
defaultColumnKeyMap = _useContext8.defaultColumnKeyMap,
|
|
369
369
|
setSortKeyColumns = _useContext8.setSortKeyColumns,
|
|
370
|
+
sortKeyColumns = _useContext8.sortKeyColumns,
|
|
370
371
|
saveColumns = _useContext8.saveColumns,
|
|
371
|
-
TextEnum = _useContext8.TextEnum
|
|
372
|
+
TextEnum = _useContext8.TextEnum,
|
|
373
|
+
tableColumn = _useContext8.tableColumn;
|
|
374
|
+
var localColumns = props.localColumns;
|
|
372
375
|
var checkedColumnKeys = props.checkedColumnKeys,
|
|
373
376
|
onColumnsSave = props.onColumnsSave;
|
|
374
377
|
|
|
375
|
-
/**
|
|
376
|
-
* 设置全部选中,或全部未选中
|
|
377
|
-
*
|
|
378
|
-
* @param show
|
|
378
|
+
/**
|
|
379
|
+
* 设置全部选中,或全部未选中
|
|
380
|
+
*
|
|
381
|
+
* @param show
|
|
379
382
|
*/
|
|
380
383
|
var setAllSelectAction = useRefFunction(function () {
|
|
381
384
|
var show = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
@@ -428,7 +431,7 @@ export default function ColumnSetting(props) {
|
|
|
428
431
|
|
|
429
432
|
// 保存按钮
|
|
430
433
|
var onSaveChange = function onSaveChange() {
|
|
431
|
-
onColumnsSave(checkedColumnKeys);
|
|
434
|
+
onColumnsSave(Array.isArray(checkedColumnKeys) ? checkedColumnKeys : getVisibleColumnKeysFromMap(columnsMap, sortKeyColumns));
|
|
432
435
|
};
|
|
433
436
|
// 未选中的 key 列表
|
|
434
437
|
var unCheckedKeys = Object.values(columnsMap).filter(function (value) {
|
|
@@ -499,7 +502,10 @@ export default function ColumnSetting(props) {
|
|
|
499
502
|
children: TextEnum.columnSettingSaveText
|
|
500
503
|
})]
|
|
501
504
|
}) : null]
|
|
502
|
-
})
|
|
505
|
+
}),
|
|
506
|
+
getPopupContainer: function getPopupContainer(triggerNode) {
|
|
507
|
+
return triggerNode.parentNode;
|
|
508
|
+
}
|
|
503
509
|
// open={true}
|
|
504
510
|
,
|
|
505
511
|
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
@@ -21,7 +21,8 @@ var genVtxStyle = function genVtxStyle(token) {
|
|
|
21
21
|
padding: 0,
|
|
22
22
|
marginBottom: 10
|
|
23
23
|
}), '.ant-popover-content', _defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
24
|
-
padding: '0 16px 16px 16px'
|
|
24
|
+
padding: '0 16px 16px 16px',
|
|
25
|
+
width: 196
|
|
25
26
|
}, "".concat(token.antCls, "-tree-node-content-wrapper:hover"), {
|
|
26
27
|
backgroundColor: 'transparent'
|
|
27
28
|
}), ".ant-tree-switcher", {
|
|
@@ -29,7 +30,9 @@ var genVtxStyle = function genVtxStyle(token) {
|
|
|
29
30
|
}), "".concat(token.antCls, "-tree-draggable-icon"), {
|
|
30
31
|
cursor: 'grab'
|
|
31
32
|
}), "".concat(token.antCls, "-tree-treenode"), _defineProperty(_defineProperty({
|
|
32
|
-
alignItems: 'center'
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
paddingRight: 12,
|
|
35
|
+
boxSizing: 'border-box'
|
|
33
36
|
}, "".concat(token.antCls, "-tree-checkbox"), {
|
|
34
37
|
marginInlineEnd: 4
|
|
35
38
|
}), "".concat(token.antCls, "-tree-title"), {
|
|
@@ -28,6 +28,9 @@ function Density() {
|
|
|
28
28
|
selectedKeys: [counter.tableSize]
|
|
29
29
|
},
|
|
30
30
|
trigger: ['click'],
|
|
31
|
+
getPopupContainer: function getPopupContainer(triggerNode) {
|
|
32
|
+
return triggerNode.parentNode;
|
|
33
|
+
},
|
|
31
34
|
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
32
35
|
title: TextEnum.columnDensityText,
|
|
33
36
|
children: /*#__PURE__*/_jsx("span", {
|
|
@@ -31,6 +31,9 @@ function TableStyle() {
|
|
|
31
31
|
trigger: ['click'],
|
|
32
32
|
placement: "bottomRight",
|
|
33
33
|
title: null,
|
|
34
|
+
getPopupContainer: function getPopupContainer(triggerNode) {
|
|
35
|
+
return triggerNode.parentNode;
|
|
36
|
+
},
|
|
34
37
|
content: list === null || list === void 0 ? void 0 : list.map(function (v) {
|
|
35
38
|
return /*#__PURE__*/_jsx("div", {
|
|
36
39
|
children: /*#__PURE__*/_jsx(Checkbox, {
|