@vtx/components 4.0.0-beta.7 → 4.0.0-beta.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.js +3 -0
- package/es/utils/filterSpecialCharacters.js +47 -46
- package/es/utils/index.js +1 -2
- package/es/vtx-color-picker/index.js +138 -33
- package/es/vtx-color-picker/style/index.js +36 -12
- package/es/vtx-combogrid/Combogrid.js +16 -10
- package/es/vtx-combogrid/index.js +7 -4
- package/es/vtx-combogrid/style/index.js +4 -4
- package/es/vtx-datagrid/Store/Provide.js +109 -132
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +11 -5
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/es/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
- package/es/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
- package/es/vtx-datagrid/ToolBar/index.js +2 -2
- package/es/vtx-datagrid/columnState.js +64 -0
- package/es/vtx-datagrid/index.js +114 -35
- package/es/vtx-datagrid/mergeComponents.js +15 -0
- package/es/vtx-datagrid/renderColumnButtons.js +30 -11
- package/es/vtx-datagrid/style/index.js +102 -20
- package/es/vtx-date-picker/QdatePicker.js +1 -1
- package/es/vtx-descriptions/Descriptions.js +29 -0
- package/es/vtx-descriptions/index.js +3 -0
- package/es/vtx-descriptions/style/index.js +19 -0
- package/es/vtx-ellipsis-text/index.js +7 -2
- package/es/vtx-ellipsis-text/style/index.js +3 -1
- package/es/vtx-export/index.js +25 -25
- package/es/vtx-export-async/History.js +7 -3
- package/es/vtx-export-async/index.js +42 -14
- package/es/vtx-form-layout/Card.js +10 -10
- package/es/vtx-form-layout/Divider.js +1 -1
- package/es/vtx-form-layout/FormItem.js +18 -17
- package/es/vtx-form-layout/Pane.js +23 -12
- package/es/vtx-icon/index.js +54 -45
- package/es/vtx-icon/index.js1 +90 -0
- package/es/vtx-image/Preview.js +11 -6
- package/es/vtx-image/style/index.js +0 -1
- package/es/vtx-import/index.js +155 -43
- package/es/vtx-import/result.js +6 -2
- package/es/vtx-import/style/index.js +16 -1
- package/es/vtx-import2/Content.js +2 -1
- package/es/vtx-import2/index.js +31 -20
- package/es/vtx-import2/style/index.js +60 -9
- package/es/vtx-input/TextArea/index.js +11 -6
- package/es/vtx-modal/index.js +9 -4
- package/es/vtx-modal/style/index.js +5 -3
- package/es/vtx-page-layout/Content.js +1 -1
- package/es/vtx-page-layout/TabLayout.js +1 -7
- package/es/vtx-page-layout/TableLayout.js +14 -4
- package/es/vtx-page-layout/TableWrap.js +3 -2
- package/es/vtx-page-layout/TreeLayout.js +2 -8
- package/es/vtx-page-layout/container.js +6 -5
- package/es/vtx-page-layout/style/index.js +4 -2
- package/es/vtx-provider/index.js +20 -10
- package/es/vtx-provider/locale/en_US.js +65 -5
- package/es/vtx-provider/locale/zh_CN.js +75 -5
- package/es/vtx-provider/useStyle/index.js +8 -4
- package/es/vtx-scrollable-row/index.js +38 -28
- package/es/vtx-search/index.js +18 -13
- package/es/vtx-search/style/index.js +2 -1
- package/es/vtx-select/index.js +132 -46
- package/es/vtx-select/style/index.js +11 -56
- package/es/vtx-signature/index.js +5 -4
- package/es/vtx-signature/style/index.js +1 -1
- package/es/vtx-split-pane/Resizer.js +0 -1
- package/es/vtx-split-pane/SplitPane.js +34 -25
- package/es/vtx-split-pane/style/index.js +8 -112
- package/es/vtx-time-picker/index.js +27 -1
- package/es/vtx-transfer/Transfer.js +29 -0
- package/es/vtx-transfer/index.js +3 -0
- package/es/vtx-transfer/style/index.js +19 -0
- package/es/vtx-transfer-select/TransferSelect.js +143 -0
- package/es/vtx-transfer-select/index.js +3 -0
- package/es/vtx-transfer-select/style/index.js +19 -0
- package/es/vtx-tree/index.js +104 -40
- package/es/vtx-tree-select/index.js +75 -105
- package/es/vtx-tree-select/style/index.js +9 -3
- package/es/vtx-upload/FilePreview.js +2 -1
- package/es/vtx-wang-editor/index.js +291 -113
- package/es/vtx-wang-editor/wangEditorUtil.js +59 -9
- package/lib/index.js +36 -0
- package/lib/utils/filterSpecialCharacters.js +48 -46
- package/lib/utils/index.js +0 -7
- package/lib/vtx-color-picker/index.js +139 -34
- package/lib/vtx-color-picker/style/index.js +36 -12
- package/lib/vtx-combogrid/Combogrid.js +16 -10
- package/lib/vtx-combogrid/index.js +7 -4
- package/lib/vtx-combogrid/style/index.js +4 -4
- package/lib/vtx-datagrid/Store/Provide.js +116 -138
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +11 -6
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/lib/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
- package/lib/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
- package/lib/vtx-datagrid/ToolBar/index.js +2 -2
- package/lib/vtx-datagrid/columnState.js +73 -0
- package/lib/vtx-datagrid/index.js +115 -35
- package/lib/vtx-datagrid/mergeComponents.js +21 -0
- package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
- package/lib/vtx-datagrid/style/index.js +102 -20
- package/lib/vtx-date-picker/QdatePicker.js +1 -1
- package/lib/vtx-descriptions/Descriptions.js +38 -0
- package/lib/vtx-descriptions/index.js +15 -0
- package/lib/vtx-descriptions/style/index.js +25 -0
- package/lib/vtx-ellipsis-text/index.js +7 -2
- package/lib/vtx-ellipsis-text/style/index.js +3 -1
- package/lib/vtx-export/index.js +26 -26
- package/lib/vtx-export-async/History.js +7 -3
- package/lib/vtx-export-async/index.js +40 -12
- package/lib/vtx-form-layout/Card.js +9 -9
- package/lib/vtx-form-layout/Divider.js +1 -1
- package/lib/vtx-form-layout/FormItem.js +18 -17
- package/lib/vtx-form-layout/Pane.js +22 -11
- package/lib/vtx-icon/index.js +54 -52
- package/lib/vtx-icon/index.js1 +90 -0
- package/lib/vtx-image/Preview.js +11 -6
- package/lib/vtx-image/style/index.js +0 -1
- package/lib/vtx-import/index.js +154 -42
- package/lib/vtx-import/result.js +6 -2
- package/lib/vtx-import/style/index.js +16 -1
- package/lib/vtx-import2/Content.js +2 -1
- package/lib/vtx-import2/index.js +30 -19
- package/lib/vtx-import2/style/index.js +60 -9
- package/lib/vtx-input/TextArea/index.js +11 -6
- package/lib/vtx-modal/index.js +9 -4
- package/lib/vtx-modal/style/index.js +5 -3
- package/lib/vtx-page-layout/Content.js +1 -1
- package/lib/vtx-page-layout/TabLayout.js +3 -9
- package/lib/vtx-page-layout/TableLayout.js +14 -4
- package/lib/vtx-page-layout/TableWrap.js +3 -2
- package/lib/vtx-page-layout/TreeLayout.js +4 -10
- package/lib/vtx-page-layout/container.js +6 -5
- package/lib/vtx-page-layout/style/index.js +4 -2
- package/lib/vtx-provider/index.js +19 -10
- package/lib/vtx-provider/locale/en_US.js +65 -5
- package/lib/vtx-provider/locale/zh_CN.js +75 -5
- package/lib/vtx-provider/useStyle/index.js +8 -4
- package/lib/vtx-scrollable-row/index.js +38 -28
- package/lib/vtx-search/index.js +18 -13
- package/lib/vtx-search/style/index.js +2 -1
- package/lib/vtx-select/index.js +134 -48
- package/lib/vtx-select/style/index.js +11 -56
- package/lib/vtx-signature/index.js +4 -3
- package/lib/vtx-signature/style/index.js +1 -1
- package/lib/vtx-split-pane/Resizer.js +0 -1
- package/lib/vtx-split-pane/SplitPane.js +32 -23
- package/lib/vtx-split-pane/style/index.js +8 -112
- package/lib/vtx-time-picker/index.js +27 -1
- package/lib/vtx-transfer/Transfer.js +38 -0
- package/lib/vtx-transfer/index.js +15 -0
- package/lib/vtx-transfer/style/index.js +25 -0
- package/lib/vtx-transfer-select/TransferSelect.js +151 -0
- package/lib/vtx-transfer-select/index.js +15 -0
- package/lib/vtx-transfer-select/style/index.js +25 -0
- package/lib/vtx-tree/index.js +102 -38
- package/lib/vtx-tree-select/index.js +75 -105
- package/lib/vtx-tree-select/style/index.js +9 -3
- package/lib/vtx-upload/FilePreview.js +2 -1
- package/lib/vtx-wang-editor/index.js +289 -113
- package/lib/vtx-wang-editor/wangEditorUtil.js +59 -10
- package/package.json +44 -28
- package/es/utils/hooks/useFetchData/index.js +0 -82
- package/lib/utils/hooks/useFetchData/index.js +0 -89
|
@@ -29,9 +29,9 @@ function ToolBar(props) {
|
|
|
29
29
|
onRefresh = props.onRefresh,
|
|
30
30
|
hideColumnHeight = props.hideColumnHeight,
|
|
31
31
|
hideColumnSetting = props.hideColumnSetting,
|
|
32
|
-
columns = props.columns,
|
|
33
32
|
onColumnsSave = props.onColumnsSave,
|
|
34
33
|
uniqueKey = props.uniqueKey,
|
|
34
|
+
columns = props.columns,
|
|
35
35
|
TextEnum = props.TextEnum;
|
|
36
36
|
var _useStyle = (0, _style.useStyle)("".concat(prefix, "-toolbar")),
|
|
37
37
|
wrapSSR = _useStyle.wrapSSR,
|
|
@@ -80,7 +80,7 @@ function ToolBar(props) {
|
|
|
80
80
|
}), !hideColumnSetting && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
81
81
|
className: "".concat(prefix, "-toolbar-setting-item"),
|
|
82
82
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ColumnSetting.default, {
|
|
83
|
-
|
|
83
|
+
localColumns: columns,
|
|
84
84
|
uniqueKey: uniqueKey,
|
|
85
85
|
onColumnsSave: onColumnsSave
|
|
86
86
|
})
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buildColumnKeyMap = buildColumnKeyMap;
|
|
7
|
+
exports.buildSortKeyColumns = buildSortKeyColumns;
|
|
8
|
+
exports.getVisibleColumnKeysFromMap = getVisibleColumnKeysFromMap;
|
|
9
|
+
exports.indexColumnKey = void 0;
|
|
10
|
+
var _genColumnKey = require("../utils/genColumnKey");
|
|
11
|
+
var _sortByGivenOrder = require("../utils/sortByGivenOrder");
|
|
12
|
+
var indexColumnKey = exports.indexColumnKey = '_serialNum';
|
|
13
|
+
function buildColumnKeyMap() {
|
|
14
|
+
var tableColumn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
15
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
16
|
+
visibleColumnKeys = _ref.visibleColumnKeys,
|
|
17
|
+
defaultVisibleColumnKeys = _ref.defaultVisibleColumnKeys,
|
|
18
|
+
_ref$previousColumnsM = _ref.previousColumnsMap,
|
|
19
|
+
previousColumnsMap = _ref$previousColumnsM === void 0 ? {} : _ref$previousColumnsM,
|
|
20
|
+
_ref$indexColumn = _ref.indexColumn,
|
|
21
|
+
indexColumn = _ref$indexColumn === void 0 ? true : _ref$indexColumn;
|
|
22
|
+
var hasVisibleColumnKeys = Array.isArray(visibleColumnKeys);
|
|
23
|
+
var hasDefaultVisibleColumnKeys = Array.isArray(defaultVisibleColumnKeys);
|
|
24
|
+
return (tableColumn || []).reduce(function (columnKeyMap, _ref2, index) {
|
|
25
|
+
var _previousConfig$fixed, _previousConfig$width;
|
|
26
|
+
var key = _ref2.key,
|
|
27
|
+
dataIndex = _ref2.dataIndex,
|
|
28
|
+
fixed = _ref2.fixed,
|
|
29
|
+
disable = _ref2.disable,
|
|
30
|
+
width = _ref2.width;
|
|
31
|
+
var columnKey = (0, _genColumnKey.genColumnKey)(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
32
|
+
var previousConfig = previousColumnsMap[columnKey] || {};
|
|
33
|
+
var show = previousConfig.show;
|
|
34
|
+
if (indexColumn && indexColumnKey === columnKey) {
|
|
35
|
+
show = true;
|
|
36
|
+
} else if (hasVisibleColumnKeys) {
|
|
37
|
+
show = visibleColumnKeys.includes(columnKey);
|
|
38
|
+
} else if (show === undefined && hasDefaultVisibleColumnKeys) {
|
|
39
|
+
show = defaultVisibleColumnKeys.includes(columnKey);
|
|
40
|
+
} else if (show === undefined) {
|
|
41
|
+
show = true;
|
|
42
|
+
}
|
|
43
|
+
columnKeyMap[columnKey] = {
|
|
44
|
+
show: show,
|
|
45
|
+
fixed: (_previousConfig$fixed = previousConfig.fixed) !== null && _previousConfig$fixed !== void 0 ? _previousConfig$fixed : fixed,
|
|
46
|
+
disable: disable,
|
|
47
|
+
width: (_previousConfig$width = previousConfig.width) !== null && _previousConfig$width !== void 0 ? _previousConfig$width : width
|
|
48
|
+
};
|
|
49
|
+
if (previousConfig.order !== undefined) {
|
|
50
|
+
columnKeyMap[columnKey].order = previousConfig.order;
|
|
51
|
+
}
|
|
52
|
+
return columnKeyMap;
|
|
53
|
+
}, {});
|
|
54
|
+
}
|
|
55
|
+
function buildSortKeyColumns() {
|
|
56
|
+
var columnsMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
57
|
+
var visibleColumnKeys = arguments.length > 1 ? arguments[1] : undefined;
|
|
58
|
+
var defaultVisibleColumnKeys = arguments.length > 2 ? arguments[2] : undefined;
|
|
59
|
+
var columnKeys = Object.keys(columnsMap);
|
|
60
|
+
var sortKeys = visibleColumnKeys || defaultVisibleColumnKeys || [];
|
|
61
|
+
if (sortKeys.length > 0) {
|
|
62
|
+
return (0, _sortByGivenOrder.sortByGivenOrder)(columnKeys, sortKeys);
|
|
63
|
+
}
|
|
64
|
+
return columnKeys;
|
|
65
|
+
}
|
|
66
|
+
function getVisibleColumnKeysFromMap() {
|
|
67
|
+
var columnsMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
68
|
+
var sortKeyColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
69
|
+
return sortKeyColumns.filter(function (columnKey) {
|
|
70
|
+
var _columnsMap$columnKey;
|
|
71
|
+
return (_columnsMap$columnKey = columnsMap[columnKey]) === null || _columnsMap$columnKey === void 0 ? void 0 : _columnsMap$columnKey.show;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
@@ -4,6 +4,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.DEFAULT_HEIGHTS = void 0;
|
|
7
8
|
exports.VtxDatagrid = VtxDatagrid;
|
|
8
9
|
exports.indexColumnKey = exports.default = void 0;
|
|
9
10
|
var _ahooks = require("ahooks");
|
|
@@ -16,8 +17,10 @@ var _useSet3 = _interopRequireDefault(require("../utils/useSet"));
|
|
|
16
17
|
var _Alert = _interopRequireDefault(require("./Alert"));
|
|
17
18
|
var _ToolBar = _interopRequireDefault(require("./ToolBar"));
|
|
18
19
|
var _Provide = require("./Store/Provide");
|
|
20
|
+
var _mergeComponents = require("./mergeComponents");
|
|
19
21
|
var _index = require("./style/index");
|
|
20
22
|
var _reactAntdColumnResize = require("react-antd-column-resize");
|
|
23
|
+
var _vtxProvider = require("../vtx-provider");
|
|
21
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
25
|
var _excluded = ["toolbar", "toolbarClassName", "toolbarTilte", "buttonGroup", "refreshIconVisible", "hideColumnSetting", "hideColumnHeight", "onRefresh", "bordered", "startIndex", "autoFit", "headFootHeight", "columnResizable", "components", "className", "style", "emptyText", "onRowSelectionClear", "onColumnsSave", "uniqueKey", "prefixUrl", "hideSelectionClear", "customEnumText"];
|
|
23
26
|
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); }
|
|
@@ -38,8 +41,14 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
38
41
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
39
42
|
var isMac = navigator.userAgent.indexOf('Mac OS') !== -1;
|
|
40
43
|
var indexColumnKey = exports.indexColumnKey = '_serialNum';
|
|
44
|
+
var DEFAULT_HEIGHTS = exports.DEFAULT_HEIGHTS = {
|
|
45
|
+
HEAD_FOOT: 115,
|
|
46
|
+
ALERT: 48,
|
|
47
|
+
TOOLBAR: 64
|
|
48
|
+
};
|
|
41
49
|
function VtxTable(props) {
|
|
42
50
|
var _rest$dataSource, _rest$rowSelection, _rest$rowSelection3, _rest$rowSelection4;
|
|
51
|
+
var intl = (0, _vtxProvider.useIntl)();
|
|
43
52
|
var _useContext = (0, _react.useContext)(_antd.ConfigProvider.ConfigContext),
|
|
44
53
|
getPrefixCls = _useContext.getPrefixCls;
|
|
45
54
|
var prefixCls = getPrefixCls('', 'vtx-datagrid');
|
|
@@ -54,7 +63,8 @@ function VtxTable(props) {
|
|
|
54
63
|
isDragRef = _useContext2.isDragRef,
|
|
55
64
|
rootDomRef = _useContext2.rootDomRef,
|
|
56
65
|
sortKeyColumns = _useContext2.sortKeyColumns,
|
|
57
|
-
TextEnum = _useContext2.TextEnum
|
|
66
|
+
TextEnum = _useContext2.TextEnum,
|
|
67
|
+
tableSize = _useContext2.tableSize;
|
|
58
68
|
var _useSet = (0, _useSet3.default)({
|
|
59
69
|
// 表格id
|
|
60
70
|
datagridId: "vtx-datagrid-".concat(new Date().getTime()),
|
|
@@ -75,7 +85,7 @@ function VtxTable(props) {
|
|
|
75
85
|
toolbar = _props$toolbar === void 0 ? true : _props$toolbar,
|
|
76
86
|
toolbarClassName = props.toolbarClassName,
|
|
77
87
|
_props$toolbarTilte = props.toolbarTilte,
|
|
78
|
-
toolbarTilte = _props$toolbarTilte === void 0 ? '查询结果' : _props$toolbarTilte,
|
|
88
|
+
toolbarTilte = _props$toolbarTilte === void 0 ? intl.getMessage('datagrid.queryResults', '查询结果') : _props$toolbarTilte,
|
|
79
89
|
buttonGroup = props.buttonGroup,
|
|
80
90
|
_props$refreshIconVis = props.refreshIconVisible,
|
|
81
91
|
refreshIconVisible = _props$refreshIconVis === void 0 ? true : _props$refreshIconVis,
|
|
@@ -89,14 +99,14 @@ function VtxTable(props) {
|
|
|
89
99
|
_props$autoFit = props.autoFit,
|
|
90
100
|
autoFit = _props$autoFit === void 0 ? true : _props$autoFit,
|
|
91
101
|
_props$headFootHeight = props.headFootHeight,
|
|
92
|
-
headFootHeight = _props$headFootHeight === void 0 ?
|
|
102
|
+
headFootHeight = _props$headFootHeight === void 0 ? DEFAULT_HEIGHTS.HEAD_FOOT : _props$headFootHeight,
|
|
93
103
|
_props$columnResizabl = props.columnResizable,
|
|
94
104
|
columnResizable = _props$columnResizabl === void 0 ? true : _props$columnResizabl,
|
|
95
105
|
components = props.components,
|
|
96
106
|
className = props.className,
|
|
97
107
|
style = props.style,
|
|
98
108
|
_props$emptyText = props.emptyText,
|
|
99
|
-
emptyText = _props$emptyText === void 0 ? '暂无数据' : _props$emptyText,
|
|
109
|
+
emptyText = _props$emptyText === void 0 ? intl.getMessage('select.empty', '暂无数据') : _props$emptyText,
|
|
100
110
|
onRowSelectionClear = props.onRowSelectionClear,
|
|
101
111
|
onColumnsSave = props.onColumnsSave,
|
|
102
112
|
uniqueKey = props.uniqueKey,
|
|
@@ -109,20 +119,43 @@ function VtxTable(props) {
|
|
|
109
119
|
|
|
110
120
|
// 高度计算
|
|
111
121
|
var _useThrottleFn = (0, _ahooks.useThrottleFn)(function () {
|
|
112
|
-
var _rootDomRef$current;
|
|
122
|
+
var _rootDomRef$current, _bodyDiv$getElementsB;
|
|
113
123
|
if (!rootDomRef.current) {
|
|
114
124
|
return null;
|
|
115
125
|
}
|
|
116
|
-
var bodyHeight = ((_rootDomRef$current = rootDomRef.current) === null || _rootDomRef$current === void 0 ? void 0 : _rootDomRef$current.clientHeight) - headFootHeight - toolbarHeight.current - alertHeight.current;
|
|
117
126
|
var divs = rootDomRef.current.getElementsByTagName('div');
|
|
127
|
+
var pagination = Array.prototype.filter.call(rootDomRef.current.getElementsByTagName('ul'), function (dom) {
|
|
128
|
+
return dom.className.includes('ant-pagination');
|
|
129
|
+
})[0];
|
|
130
|
+
var tableHeader = Array.prototype.filter.call(rootDomRef.current.getElementsByTagName('thead'), function (dom) {
|
|
131
|
+
return dom.className.includes('ant-table-thead');
|
|
132
|
+
})[0];
|
|
133
|
+
var _headFootHeight = headFootHeight;
|
|
134
|
+
if (tableHeader) {
|
|
135
|
+
_headFootHeight = ((pagination === null || pagination === void 0 ? void 0 : pagination.clientHeight) || 0) + 32 + (tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.clientHeight);
|
|
136
|
+
}
|
|
137
|
+
var bodyHeight = ((_rootDomRef$current = rootDomRef.current) === null || _rootDomRef$current === void 0 ? void 0 : _rootDomRef$current.clientHeight) - _headFootHeight - toolbarHeight.current - alertHeight.current;
|
|
118
138
|
var bodyDiv = Array.prototype.filter.call(divs, function (dom) {
|
|
119
|
-
return dom.className.includes('ant-table-body') || dom.className.includes('ant-table-content');
|
|
139
|
+
return dom.className.includes('ant-table-body') || dom.className.includes('ant-table-content') || dom.className.includes('ant-table-tbody');
|
|
140
|
+
})[0];
|
|
141
|
+
var tablePlaceholder = Array.prototype.filter.call(rootDomRef.current.getElementsByTagName('tr'), function (dom) {
|
|
142
|
+
return dom.className.includes('ant-table-placeholder');
|
|
120
143
|
})[0];
|
|
121
144
|
if (bodyDiv) {
|
|
122
145
|
bodyDiv.style.minHeight = "".concat(bodyHeight - (rest.scrollY || 0), "px");
|
|
123
146
|
}
|
|
147
|
+
var tableHeight = (_bodyDiv$getElementsB = bodyDiv.getElementsByTagName('table')) === null || _bodyDiv$getElementsB === void 0 || (_bodyDiv$getElementsB = _bodyDiv$getElementsB[0]) === null || _bodyDiv$getElementsB === void 0 ? void 0 : _bodyDiv$getElementsB.clientHeight;
|
|
148
|
+
if (tablePlaceholder) {
|
|
149
|
+
tablePlaceholder.style.height = "".concat(bodyHeight - (rest.scrollY || 0) - 48 - 12, "px");
|
|
150
|
+
var tableCell = Array.prototype.filter.call(tablePlaceholder.getElementsByTagName('td'), function (dom) {
|
|
151
|
+
return dom.className.includes('ant-table-cell');
|
|
152
|
+
})[0];
|
|
153
|
+
tableCell.style.height = "".concat(bodyHeight - (rest.scrollY || 0) - 48 - 12, "px");
|
|
154
|
+
}
|
|
155
|
+
// antd6.x 的bug 如果table的高度 没有body 高 则没有滚动条
|
|
156
|
+
|
|
124
157
|
setState({
|
|
125
|
-
scrollY: bodyHeight
|
|
158
|
+
scrollY: tableHeight > bodyHeight ? bodyHeight : undefined
|
|
126
159
|
});
|
|
127
160
|
}, {
|
|
128
161
|
wait: 350
|
|
@@ -132,19 +165,24 @@ function VtxTable(props) {
|
|
|
132
165
|
var resizeObserver = new ResizeObserver(function () {
|
|
133
166
|
calculateHeight();
|
|
134
167
|
});
|
|
135
|
-
// componentDidMount
|
|
136
168
|
if (autoFit && rootDomRef.current) {
|
|
137
169
|
resizeObserver.observe(rootDomRef.current, {
|
|
138
170
|
box: 'border-box'
|
|
139
171
|
});
|
|
140
172
|
}
|
|
141
173
|
return function () {
|
|
142
|
-
// componentWillUnmount
|
|
143
174
|
if (autoFit) {
|
|
144
175
|
resizeObserver.disconnect();
|
|
145
176
|
}
|
|
146
177
|
};
|
|
147
|
-
}, [autoFit]);
|
|
178
|
+
}, [autoFit, tableSize]);
|
|
179
|
+
|
|
180
|
+
// fix: 最后一页,横向滚动条上移问题
|
|
181
|
+
(0, _react.useEffect)(function () {
|
|
182
|
+
if (scrollY > 0) {
|
|
183
|
+
calculateHeight();
|
|
184
|
+
}
|
|
185
|
+
}, [scrollY]);
|
|
148
186
|
(0, _react.useLayoutEffect)(function () {
|
|
149
187
|
if (autoFit) {
|
|
150
188
|
calculateHeight();
|
|
@@ -161,7 +199,7 @@ function VtxTable(props) {
|
|
|
161
199
|
showSizeChanger: true,
|
|
162
200
|
showQuickJumper: true,
|
|
163
201
|
showTotal: function showTotal(total) {
|
|
164
|
-
return "".concat(TextEnum.
|
|
202
|
+
return "".concat(TextEnum.paginationTotalText, " ").concat(total, " ").concat(TextEnum.paginationItemText);
|
|
165
203
|
}
|
|
166
204
|
}, pagination);
|
|
167
205
|
};
|
|
@@ -185,9 +223,6 @@ function VtxTable(props) {
|
|
|
185
223
|
});
|
|
186
224
|
};
|
|
187
225
|
var _tableColumn = loopFilter(counter.tableColumn);
|
|
188
|
-
if (!columnsMap['_serialNum']) {
|
|
189
|
-
return [];
|
|
190
|
-
}
|
|
191
226
|
return (0, _utils.sortByKeyArrayExtract)(_tableColumn, sortKeyColumns, columnsMap, 'key');
|
|
192
227
|
}, [columnsMap, counter.tableColumn, sortKeyColumns]);
|
|
193
228
|
|
|
@@ -225,9 +260,12 @@ function VtxTable(props) {
|
|
|
225
260
|
result = _objectSpread(_objectSpread({}, result), {}, {
|
|
226
261
|
y: scrollY - (rest.scrollY || 0)
|
|
227
262
|
});
|
|
263
|
+
if (scrollY == undefined) {
|
|
264
|
+
result.y = undefined;
|
|
265
|
+
}
|
|
228
266
|
}
|
|
229
267
|
return result;
|
|
230
|
-
}, [rest.scroll, rest.scrollY, autoFit]);
|
|
268
|
+
}, [rest.scroll, rest.scrollY, scrollY, autoFit]);
|
|
231
269
|
var hasAlert = (0, _react.useMemo)(function () {
|
|
232
270
|
var _rest$rowSelection2;
|
|
233
271
|
return (((_rest$rowSelection2 = rest.rowSelection) === null || _rest$rowSelection2 === void 0 ? void 0 : _rest$rowSelection2.selectedRowKeys) || []).length > 0;
|
|
@@ -236,20 +274,49 @@ function VtxTable(props) {
|
|
|
236
274
|
selectedRowKeys: (_rest$rowSelection4 = rest.rowSelection) === null || _rest$rowSelection4 === void 0 ? void 0 : _rest$rowSelection4.selectedRowKeys,
|
|
237
275
|
onRowSelectionClear: onRowSelectionClear
|
|
238
276
|
}) : null;
|
|
239
|
-
alertHeight.current = !hideSelectionClear && hasAlert ?
|
|
240
|
-
toolbarHeight.current = toolbar ?
|
|
277
|
+
alertHeight.current = !hideSelectionClear && hasAlert ? DEFAULT_HEIGHTS.ALERT : 0;
|
|
278
|
+
toolbarHeight.current = toolbar ? DEFAULT_HEIGHTS.TOOLBAR : 0;
|
|
241
279
|
var _useAntdColumnResize = (0, _reactAntdColumnResize.useAntdColumnResize)(function () {
|
|
242
280
|
return {
|
|
243
281
|
columns: columns,
|
|
244
|
-
minWidth:
|
|
282
|
+
minWidth: 10
|
|
245
283
|
};
|
|
246
284
|
}, [columns]),
|
|
247
285
|
resizableColumns = _useAntdColumnResize.resizableColumns,
|
|
248
286
|
resizeComponents = _useAntdColumnResize.components,
|
|
249
287
|
tableWidth = _useAntdColumnResize.tableWidth,
|
|
250
288
|
resetColumns = _useAntdColumnResize.resetColumns;
|
|
289
|
+
|
|
290
|
+
// const _columns = useMemo(() => {
|
|
291
|
+
// let result = [];
|
|
292
|
+
// if (!showTable) {
|
|
293
|
+
// result = []
|
|
294
|
+
// } else if (isDragRef) {
|
|
295
|
+
// result = resizableColumns
|
|
296
|
+
// } else {
|
|
297
|
+
// result = columns
|
|
298
|
+
// }
|
|
299
|
+
// let flag = false;
|
|
300
|
+
// result?.map((v) => {
|
|
301
|
+
// if (columnsMap[v.key].width !== v.width) {
|
|
302
|
+
// flag = true;
|
|
303
|
+
// columnsMap[v.key] = {
|
|
304
|
+
// ...columnsMap[v.key],
|
|
305
|
+
// width: v.width
|
|
306
|
+
// };
|
|
307
|
+
// }
|
|
308
|
+
// })
|
|
309
|
+
// if (flag) {
|
|
310
|
+
// counter.setColumnsMap(
|
|
311
|
+
// columnsMap
|
|
312
|
+
// )
|
|
313
|
+
// }
|
|
314
|
+
// return result;
|
|
315
|
+
|
|
316
|
+
// }, [isDragRef, resizableColumns, showTable, columns, columnsMap])
|
|
317
|
+
|
|
318
|
+
// 1. 先计算列配置
|
|
251
319
|
var _columns = (0, _react.useMemo)(function () {
|
|
252
|
-
var _result;
|
|
253
320
|
var result = [];
|
|
254
321
|
if (!showTable) {
|
|
255
322
|
result = [];
|
|
@@ -258,24 +325,30 @@ function VtxTable(props) {
|
|
|
258
325
|
} else {
|
|
259
326
|
result = columns;
|
|
260
327
|
}
|
|
328
|
+
return result;
|
|
329
|
+
}, [isDragRef, resizableColumns, showTable, columns]);
|
|
330
|
+
|
|
331
|
+
// 2. 在 effect 中同步列宽到 columnsMap
|
|
332
|
+
(0, _react.useEffect)(function () {
|
|
333
|
+
if (!showTable || !_columns.length) return;
|
|
261
334
|
var flag = false;
|
|
262
|
-
|
|
263
|
-
|
|
335
|
+
var newColumnsMap = _objectSpread({}, columnsMap); // 创建副本避免直接修改
|
|
336
|
+
|
|
337
|
+
_columns.forEach(function (v) {
|
|
338
|
+
var _columnsMap$v$key;
|
|
339
|
+
if (((_columnsMap$v$key = columnsMap[v.key]) === null || _columnsMap$v$key === void 0 ? void 0 : _columnsMap$v$key.width) !== v.width) {
|
|
264
340
|
flag = true;
|
|
265
|
-
|
|
341
|
+
newColumnsMap[v.key] = _objectSpread(_objectSpread({}, newColumnsMap[v.key]), {}, {
|
|
342
|
+
width: v.width
|
|
343
|
+
});
|
|
266
344
|
}
|
|
267
345
|
});
|
|
268
346
|
if (flag) {
|
|
269
|
-
counter.setColumnsMap(
|
|
347
|
+
counter.setColumnsMap(newColumnsMap);
|
|
270
348
|
}
|
|
271
|
-
|
|
272
|
-
}, [isDragRef, resizableColumns, showTable, columns, columnsMap]);
|
|
349
|
+
}, [_columns, columnsMap, counter, showTable]);
|
|
273
350
|
var _components = (0, _react.useMemo)(function () {
|
|
274
|
-
|
|
275
|
-
return resizeComponents;
|
|
276
|
-
} else {
|
|
277
|
-
return components;
|
|
278
|
-
}
|
|
351
|
+
return (0, _mergeComponents.mergeComponentsForResize)(components, resizeComponents, isDragRef);
|
|
279
352
|
}, [isDragRef, resizeComponents, components]);
|
|
280
353
|
|
|
281
354
|
// 工具栏
|
|
@@ -288,7 +361,7 @@ function VtxTable(props) {
|
|
|
288
361
|
hideColumnHeight: hideColumnHeight,
|
|
289
362
|
hideColumnSetting: hideColumnSetting,
|
|
290
363
|
onRefresh: onRefresh,
|
|
291
|
-
columns:
|
|
364
|
+
columns: tableColumn,
|
|
292
365
|
onColumnsSave: onColumnsSave,
|
|
293
366
|
uniqueKey: uniqueKey,
|
|
294
367
|
prefixUrl: prefixUrl,
|
|
@@ -297,20 +370,24 @@ function VtxTable(props) {
|
|
|
297
370
|
}) : null;
|
|
298
371
|
return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
299
372
|
id: datagridId,
|
|
300
|
-
className: (0, _classnames2.default)(prefixCls, className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-fit"), autoFit), "".concat(prefixCls, "-noFit"), !autoFit), "".concat(prefixCls, "-nodata"), !(dataSource !== null && dataSource !== void 0 && dataSource.length)), "".concat(prefixCls, "-userAgent-mac"), isMac), "".concat(prefixCls, "-striped"), tableStyles.includes('striped')), "".concat(prefixCls, "-no-border"), !tableStyles.includes('border')), "".concat(prefixCls, "-header-background"), tableStyles.includes('header-background')), hashId),
|
|
373
|
+
className: (0, _classnames2.default)(prefixCls, className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-fit"), autoFit), "".concat(prefixCls, "-noFit"), !autoFit), "".concat(prefixCls, "-nodata"), !(dataSource !== null && dataSource !== void 0 && dataSource.length)), "".concat(prefixCls, "-userAgent-mac"), isMac), "".concat(prefixCls, "-striped"), tableStyles.includes('striped')), "".concat(prefixCls, "-no-border"), !tableStyles.includes('border')), "".concat(prefixCls, "-no-data"), (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) === 0), "".concat(prefixCls, "-header-background"), tableStyles.includes('header-background')), "".concat(prefixCls, "-no-header-background"), !tableStyles.includes('header-background')), hashId),
|
|
301
374
|
ref: rootDomRef,
|
|
302
375
|
style: style,
|
|
303
376
|
children: [toolbarRender, alertRender, /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Table, _objectSpread(_objectSpread({
|
|
304
377
|
size: counter.tableSize,
|
|
305
378
|
bordered: true
|
|
379
|
+
// virtual
|
|
306
380
|
}, rest), {}, {
|
|
307
381
|
dataSource: dataSource,
|
|
308
382
|
scroll: _objectSpread({
|
|
309
383
|
x: 'max-content'
|
|
310
384
|
}, scroll),
|
|
311
385
|
pagination: getPagination(rest.pagination),
|
|
312
|
-
|
|
313
|
-
|
|
386
|
+
xs: true,
|
|
387
|
+
styles: {
|
|
388
|
+
root: {
|
|
389
|
+
height: "calc(100% - ".concat(toolbarHeight.current + alertHeight.current, "px)")
|
|
390
|
+
}
|
|
314
391
|
},
|
|
315
392
|
locale: _objectSpread({
|
|
316
393
|
emptyText: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Empty, {
|
|
@@ -319,6 +396,9 @@ function VtxTable(props) {
|
|
|
319
396
|
}, rest.locale),
|
|
320
397
|
components: _components,
|
|
321
398
|
columns: _columns
|
|
399
|
+
// tableLayout={'auto'}
|
|
400
|
+
,
|
|
401
|
+
tableLayout: "fixed"
|
|
322
402
|
}))]
|
|
323
403
|
}));
|
|
324
404
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.mergeComponentsForResize = mergeComponentsForResize;
|
|
7
|
+
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); }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
|
+
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); }
|
|
13
|
+
function mergeComponentsForResize(components, resizeComponents, isDragRef) {
|
|
14
|
+
if (!isDragRef) {
|
|
15
|
+
return components;
|
|
16
|
+
}
|
|
17
|
+
return _objectSpread(_objectSpread(_objectSpread({}, resizeComponents || {}), components || {}), {}, {
|
|
18
|
+
header: _objectSpread(_objectSpread({}, (components === null || components === void 0 ? void 0 : components.header) || {}), (resizeComponents === null || resizeComponents === void 0 ? void 0 : resizeComponents.header) || {}),
|
|
19
|
+
body: _objectSpread(_objectSpread({}, (resizeComponents === null || resizeComponents === void 0 ? void 0 : resizeComponents.body) || {}), (components === null || components === void 0 ? void 0 : components.body) || {})
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -10,8 +10,15 @@ var _antd = require("antd");
|
|
|
10
10
|
var _vtxIcon = _interopRequireDefault(require("../vtx-icon"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
var _react = require("react");
|
|
13
|
-
var _excluded = ["confirm"]
|
|
13
|
+
var _excluded = ["confirm"],
|
|
14
|
+
_excluded2 = ["confirm"];
|
|
14
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
17
|
+
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."); }
|
|
18
|
+
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); }
|
|
19
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
20
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
21
|
+
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; }
|
|
15
22
|
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; }
|
|
16
23
|
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; }
|
|
17
24
|
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; }
|
|
@@ -19,12 +26,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
19
26
|
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); }
|
|
20
27
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
21
28
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
22
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
23
|
-
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."); }
|
|
24
|
-
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
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
26
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
27
|
-
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; }
|
|
28
29
|
var renderColumnButtons = function renderColumnButtons(_ref) {
|
|
29
30
|
var _renderButtons;
|
|
30
31
|
var renderButtons = _ref.renderButtons,
|
|
@@ -51,14 +52,32 @@ var renderColumnButtons = function renderColumnButtons(_ref) {
|
|
|
51
52
|
/* eslint-disable */
|
|
52
53
|
moreRender = /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Dropdown, {
|
|
53
54
|
menu: {
|
|
54
|
-
items: (moreActions === null || moreActions === void 0 ? void 0 : moreActions.map(function (item,
|
|
55
|
+
items: (moreActions === null || moreActions === void 0 ? void 0 : moreActions.map(function (item, index) {
|
|
56
|
+
var name = item.name,
|
|
57
|
+
popconfirm = item.popconfirm;
|
|
58
|
+
if (popconfirm) {
|
|
59
|
+
var confirm = popconfirm.confirm,
|
|
60
|
+
rest = _objectWithoutProperties(popconfirm, _excluded);
|
|
61
|
+
return {
|
|
62
|
+
key: index,
|
|
63
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Popconfirm, _objectSpread(_objectSpread({
|
|
64
|
+
trigger: ['hover'],
|
|
65
|
+
onConfirm: confirm ? function () {
|
|
66
|
+
return confirm(record, index);
|
|
67
|
+
} : undefined
|
|
68
|
+
}, rest), {}, {
|
|
69
|
+
children: name
|
|
70
|
+
}))
|
|
71
|
+
};
|
|
72
|
+
}
|
|
55
73
|
return {
|
|
56
|
-
key:
|
|
74
|
+
key: index,
|
|
57
75
|
label: item.name
|
|
58
76
|
};
|
|
59
77
|
})) || [],
|
|
60
78
|
onClick: function onClick(e) {
|
|
61
|
-
|
|
79
|
+
var _moreActions$e$key, _moreActions$e$key$on;
|
|
80
|
+
(_moreActions$e$key = moreActions[e.key]) === null || _moreActions$e$key === void 0 || (_moreActions$e$key$on = _moreActions$e$key.onClick) === null || _moreActions$e$key$on === void 0 || _moreActions$e$key$on.call(_moreActions$e$key, record, index);
|
|
62
81
|
}
|
|
63
82
|
},
|
|
64
83
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("a", {
|
|
@@ -88,7 +107,7 @@ var renderColumnButtons = function renderColumnButtons(_ref) {
|
|
|
88
107
|
}, name);
|
|
89
108
|
if (popconfirm) {
|
|
90
109
|
var confirm = popconfirm.confirm,
|
|
91
|
-
rest = _objectWithoutProperties(popconfirm,
|
|
110
|
+
rest = _objectWithoutProperties(popconfirm, _excluded2);
|
|
92
111
|
btnNode = /*#__PURE__*/(0, _react.createElement)(_antd.Popconfirm, _objectSpread(_objectSpread({}, rest), {}, {
|
|
93
112
|
onConfirm: confirm ? function () {
|
|
94
113
|
return confirm(record, index);
|