@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
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
13
|
+
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."); }
|
|
14
|
+
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); }
|
|
15
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
16
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
17
|
+
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; }
|
|
18
|
+
var indexColumnKey = exports.indexColumnKey = '_serialNum';
|
|
19
|
+
function buildColumnKeyMap() {
|
|
20
|
+
var tableColumn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
21
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
22
|
+
visibleColumnKeys = _ref.visibleColumnKeys,
|
|
23
|
+
defaultVisibleColumnKeys = _ref.defaultVisibleColumnKeys,
|
|
24
|
+
_ref$previousColumnsM = _ref.previousColumnsMap,
|
|
25
|
+
previousColumnsMap = _ref$previousColumnsM === void 0 ? {} : _ref$previousColumnsM,
|
|
26
|
+
_ref$indexColumn = _ref.indexColumn,
|
|
27
|
+
indexColumn = _ref$indexColumn === void 0 ? true : _ref$indexColumn;
|
|
28
|
+
var hasVisibleColumnKeys = Array.isArray(visibleColumnKeys);
|
|
29
|
+
var hasDefaultVisibleColumnKeys = Array.isArray(defaultVisibleColumnKeys);
|
|
30
|
+
return (tableColumn || []).reduce(function (columnKeyMap, _ref2, index) {
|
|
31
|
+
var _previousConfig$fixed, _previousConfig$width;
|
|
32
|
+
var key = _ref2.key,
|
|
33
|
+
dataIndex = _ref2.dataIndex,
|
|
34
|
+
fixed = _ref2.fixed,
|
|
35
|
+
disable = _ref2.disable,
|
|
36
|
+
width = _ref2.width;
|
|
37
|
+
var columnKey = (0, _genColumnKey.genColumnKey)(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
38
|
+
var previousConfig = previousColumnsMap[columnKey] || {};
|
|
39
|
+
var show = previousConfig.show;
|
|
40
|
+
if (indexColumn && indexColumnKey === columnKey) {
|
|
41
|
+
show = true;
|
|
42
|
+
} else if (hasVisibleColumnKeys) {
|
|
43
|
+
show = visibleColumnKeys.includes(columnKey);
|
|
44
|
+
} else if (show === undefined && hasDefaultVisibleColumnKeys) {
|
|
45
|
+
show = defaultVisibleColumnKeys.includes(columnKey);
|
|
46
|
+
} else if (show === undefined) {
|
|
47
|
+
show = true;
|
|
48
|
+
}
|
|
49
|
+
columnKeyMap[columnKey] = {
|
|
50
|
+
show: show,
|
|
51
|
+
fixed: (_previousConfig$fixed = previousConfig.fixed) !== null && _previousConfig$fixed !== void 0 ? _previousConfig$fixed : fixed,
|
|
52
|
+
disable: disable,
|
|
53
|
+
width: (_previousConfig$width = previousConfig.width) !== null && _previousConfig$width !== void 0 ? _previousConfig$width : width
|
|
54
|
+
};
|
|
55
|
+
if (previousConfig.order !== undefined) {
|
|
56
|
+
columnKeyMap[columnKey].order = previousConfig.order;
|
|
57
|
+
}
|
|
58
|
+
return columnKeyMap;
|
|
59
|
+
}, {});
|
|
60
|
+
}
|
|
61
|
+
function buildSortKeyColumns() {
|
|
62
|
+
var columnsMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
63
|
+
var visibleColumnKeys = arguments.length > 1 ? arguments[1] : undefined;
|
|
64
|
+
var defaultVisibleColumnKeys = arguments.length > 2 ? arguments[2] : undefined;
|
|
65
|
+
var columnKeys = Object.keys(columnsMap);
|
|
66
|
+
var sortKeys = visibleColumnKeys || defaultVisibleColumnKeys || [];
|
|
67
|
+
if (sortKeys.length > 0) {
|
|
68
|
+
return (0, _sortByGivenOrder.sortByGivenOrder)(columnKeys, sortKeys);
|
|
69
|
+
}
|
|
70
|
+
return columnKeys;
|
|
71
|
+
}
|
|
72
|
+
function getVisibleColumnKeysFromMap() {
|
|
73
|
+
var columnsMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
74
|
+
var sortKeyColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
75
|
+
var allColumnKeys = Array.from(new Set([].concat(_toConsumableArray(sortKeyColumns), _toConsumableArray(Object.keys(columnsMap)))));
|
|
76
|
+
var sortIndexMap = new Map(sortKeyColumns.map(function (columnKey, index) {
|
|
77
|
+
return [columnKey, index];
|
|
78
|
+
}));
|
|
79
|
+
return allColumnKeys.filter(function (columnKey) {
|
|
80
|
+
var _columnsMap$columnKey;
|
|
81
|
+
return (_columnsMap$columnKey = columnsMap[columnKey]) === null || _columnsMap$columnKey === void 0 ? void 0 : _columnsMap$columnKey.show;
|
|
82
|
+
}).sort(function (leftKey, rightKey) {
|
|
83
|
+
var leftConfig = columnsMap[leftKey] || {};
|
|
84
|
+
var rightConfig = columnsMap[rightKey] || {};
|
|
85
|
+
var leftFixed = leftConfig.fixed,
|
|
86
|
+
leftOrder = leftConfig.order;
|
|
87
|
+
var rightFixed = rightConfig.fixed,
|
|
88
|
+
rightOrder = rightConfig.order;
|
|
89
|
+
if (leftFixed === 'left' && rightFixed !== 'left' || rightFixed === 'right' && leftFixed !== 'right') {
|
|
90
|
+
return -2;
|
|
91
|
+
}
|
|
92
|
+
if (rightFixed === 'left' && leftFixed !== 'left' || leftFixed === 'right' && rightFixed !== 'right') {
|
|
93
|
+
return 2;
|
|
94
|
+
}
|
|
95
|
+
if (leftOrder !== undefined || rightOrder !== undefined) {
|
|
96
|
+
return (leftOrder !== null && leftOrder !== void 0 ? leftOrder : 0) - (rightOrder !== null && rightOrder !== void 0 ? rightOrder : 0);
|
|
97
|
+
}
|
|
98
|
+
return (sortIndexMap.has(leftKey) ? sortIndexMap.get(leftKey) : Number.MAX_SAFE_INTEGER) - (sortIndexMap.has(rightKey) ? sortIndexMap.get(rightKey) : Number.MAX_SAFE_INTEGER);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
@@ -17,6 +17,7 @@ var _useSet3 = _interopRequireDefault(require("../utils/useSet"));
|
|
|
17
17
|
var _Alert = _interopRequireDefault(require("./Alert"));
|
|
18
18
|
var _ToolBar = _interopRequireDefault(require("./ToolBar"));
|
|
19
19
|
var _Provide = require("./Store/Provide");
|
|
20
|
+
var _mergeComponents = require("./mergeComponents");
|
|
20
21
|
var _index = require("./style/index");
|
|
21
22
|
var _reactAntdColumnResize = require("react-antd-column-resize");
|
|
22
23
|
var _vtxProvider = require("../vtx-provider");
|
|
@@ -42,8 +43,8 @@ var isMac = navigator.userAgent.indexOf('Mac OS') !== -1;
|
|
|
42
43
|
var indexColumnKey = exports.indexColumnKey = '_serialNum';
|
|
43
44
|
var DEFAULT_HEIGHTS = exports.DEFAULT_HEIGHTS = {
|
|
44
45
|
HEAD_FOOT: 115,
|
|
45
|
-
ALERT:
|
|
46
|
-
TOOLBAR:
|
|
46
|
+
ALERT: 48,
|
|
47
|
+
TOOLBAR: 64
|
|
47
48
|
};
|
|
48
49
|
function VtxTable(props) {
|
|
49
50
|
var _rest$dataSource, _rest$rowSelection, _rest$rowSelection3, _rest$rowSelection4;
|
|
@@ -62,17 +63,19 @@ function VtxTable(props) {
|
|
|
62
63
|
isDragRef = _useContext2.isDragRef,
|
|
63
64
|
rootDomRef = _useContext2.rootDomRef,
|
|
64
65
|
sortKeyColumns = _useContext2.sortKeyColumns,
|
|
65
|
-
TextEnum = _useContext2.TextEnum
|
|
66
|
+
TextEnum = _useContext2.TextEnum,
|
|
67
|
+
tableSize = _useContext2.tableSize;
|
|
66
68
|
var _useSet = (0, _useSet3.default)({
|
|
67
69
|
// 表格id
|
|
68
70
|
datagridId: "vtx-datagrid-".concat(new Date().getTime()),
|
|
69
|
-
scrollY:
|
|
71
|
+
scrollY: undefined
|
|
70
72
|
}),
|
|
71
73
|
_useSet2 = _slicedToArray(_useSet, 2),
|
|
72
74
|
_useSet2$ = _useSet2[0],
|
|
73
75
|
datagridId = _useSet2$.datagridId,
|
|
74
76
|
scrollY = _useSet2$.scrollY,
|
|
75
77
|
setState = _useSet2[1];
|
|
78
|
+
var scrollYRef = (0, _react.useRef)(undefined);
|
|
76
79
|
// 列设置提示高度
|
|
77
80
|
var alertHeight = (0, _react.useRef)(0);
|
|
78
81
|
// 工具栏高度
|
|
@@ -117,25 +120,65 @@ function VtxTable(props) {
|
|
|
117
120
|
|
|
118
121
|
// 高度计算
|
|
119
122
|
var _useThrottleFn = (0, _ahooks.useThrottleFn)(function () {
|
|
120
|
-
var _rootDomRef$current;
|
|
123
|
+
var _rootDomRef$current, _bodyDiv$getElementsB;
|
|
121
124
|
if (!rootDomRef.current) {
|
|
122
125
|
return null;
|
|
123
126
|
}
|
|
124
|
-
var bodyHeight = ((_rootDomRef$current = rootDomRef.current) === null || _rootDomRef$current === void 0 ? void 0 : _rootDomRef$current.clientHeight) - headFootHeight - toolbarHeight.current - alertHeight.current;
|
|
125
127
|
var divs = rootDomRef.current.getElementsByTagName('div');
|
|
128
|
+
var pagination = Array.prototype.filter.call(rootDomRef.current.getElementsByTagName('ul'), function (dom) {
|
|
129
|
+
return dom.className.includes('ant-pagination');
|
|
130
|
+
})[0];
|
|
131
|
+
var tableHeader = Array.prototype.filter.call(rootDomRef.current.getElementsByTagName('thead'), function (dom) {
|
|
132
|
+
return dom.className.includes('ant-table-thead');
|
|
133
|
+
})[0];
|
|
134
|
+
var _headFootHeight = headFootHeight;
|
|
135
|
+
if (tableHeader) {
|
|
136
|
+
_headFootHeight = ((pagination === null || pagination === void 0 ? void 0 : pagination.clientHeight) || 0) + 32 + (tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.clientHeight);
|
|
137
|
+
}
|
|
138
|
+
var bodyHeight = ((_rootDomRef$current = rootDomRef.current) === null || _rootDomRef$current === void 0 ? void 0 : _rootDomRef$current.clientHeight) - _headFootHeight - toolbarHeight.current - alertHeight.current;
|
|
139
|
+
if (!bodyHeight || bodyHeight <= 0) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
126
142
|
var bodyDiv = Array.prototype.filter.call(divs, function (dom) {
|
|
127
|
-
return dom.className.includes('ant-table-body') || dom.className.includes('ant-table-content');
|
|
143
|
+
return dom.className.includes('ant-table-body') || dom.className.includes('ant-table-content') || dom.className.includes('ant-table-tbody');
|
|
128
144
|
})[0];
|
|
145
|
+
var tablePlaceholder = Array.prototype.filter.call(rootDomRef.current.getElementsByTagName('tr'), function (dom) {
|
|
146
|
+
return dom.className.includes('ant-table-placeholder');
|
|
147
|
+
})[0];
|
|
148
|
+
if (!bodyDiv) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
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) || 0;
|
|
152
|
+
var minBodyHeight = Math.max(bodyHeight - (rest.scrollY || 0), 0);
|
|
129
153
|
if (bodyDiv) {
|
|
130
|
-
bodyDiv.style.minHeight = "".concat(
|
|
154
|
+
bodyDiv.style.minHeight = "".concat(minBodyHeight, "px");
|
|
155
|
+
}
|
|
156
|
+
if (tablePlaceholder) {
|
|
157
|
+
var placeholderHeight = Math.max(bodyHeight - (rest.scrollY || 0) - 48 - 12, 0);
|
|
158
|
+
tablePlaceholder.style.height = "".concat(placeholderHeight, "px");
|
|
159
|
+
var tableCell = Array.prototype.filter.call(tablePlaceholder.getElementsByTagName('td'), function (dom) {
|
|
160
|
+
return dom.className.includes('ant-table-cell');
|
|
161
|
+
})[0];
|
|
162
|
+
if (tableCell) {
|
|
163
|
+
tableCell.style.height = "".concat(placeholderHeight, "px");
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// antd6.x 的bug 如果table的高度 没有body 高 则没有滚动条
|
|
167
|
+
|
|
168
|
+
var nextScrollY = tableHeight > bodyHeight ? bodyHeight : undefined;
|
|
169
|
+
if (scrollYRef.current !== nextScrollY) {
|
|
170
|
+
scrollYRef.current = nextScrollY;
|
|
171
|
+
setState({
|
|
172
|
+
scrollY: nextScrollY
|
|
173
|
+
});
|
|
131
174
|
}
|
|
132
|
-
setState({
|
|
133
|
-
scrollY: bodyHeight
|
|
134
|
-
});
|
|
135
175
|
}, {
|
|
136
176
|
wait: 350
|
|
137
177
|
}),
|
|
138
178
|
calculateHeight = _useThrottleFn.run;
|
|
179
|
+
(0, _react.useEffect)(function () {
|
|
180
|
+
scrollYRef.current = scrollY;
|
|
181
|
+
}, [scrollY]);
|
|
139
182
|
(0, _react.useEffect)(function () {
|
|
140
183
|
var resizeObserver = new ResizeObserver(function () {
|
|
141
184
|
calculateHeight();
|
|
@@ -150,7 +193,14 @@ function VtxTable(props) {
|
|
|
150
193
|
resizeObserver.disconnect();
|
|
151
194
|
}
|
|
152
195
|
};
|
|
153
|
-
}, [autoFit]);
|
|
196
|
+
}, [autoFit, tableSize]);
|
|
197
|
+
|
|
198
|
+
// fix: 最后一页,横向滚动条上移问题
|
|
199
|
+
(0, _react.useEffect)(function () {
|
|
200
|
+
if (scrollY > 0) {
|
|
201
|
+
calculateHeight();
|
|
202
|
+
}
|
|
203
|
+
}, [scrollY]);
|
|
154
204
|
(0, _react.useLayoutEffect)(function () {
|
|
155
205
|
if (autoFit) {
|
|
156
206
|
calculateHeight();
|
|
@@ -191,9 +241,6 @@ function VtxTable(props) {
|
|
|
191
241
|
});
|
|
192
242
|
};
|
|
193
243
|
var _tableColumn = loopFilter(counter.tableColumn);
|
|
194
|
-
if (!columnsMap['_serialNum']) {
|
|
195
|
-
return [];
|
|
196
|
-
}
|
|
197
244
|
return (0, _utils.sortByKeyArrayExtract)(_tableColumn, sortKeyColumns, columnsMap, 'key');
|
|
198
245
|
}, [columnsMap, counter.tableColumn, sortKeyColumns]);
|
|
199
246
|
|
|
@@ -231,9 +278,12 @@ function VtxTable(props) {
|
|
|
231
278
|
result = _objectSpread(_objectSpread({}, result), {}, {
|
|
232
279
|
y: scrollY - (rest.scrollY || 0)
|
|
233
280
|
});
|
|
281
|
+
if (scrollY == undefined) {
|
|
282
|
+
result.y = undefined;
|
|
283
|
+
}
|
|
234
284
|
}
|
|
235
285
|
return result;
|
|
236
|
-
}, [rest.scroll, rest.scrollY, autoFit]);
|
|
286
|
+
}, [rest.scroll, rest.scrollY, scrollY, autoFit]);
|
|
237
287
|
var hasAlert = (0, _react.useMemo)(function () {
|
|
238
288
|
var _rest$rowSelection2;
|
|
239
289
|
return (((_rest$rowSelection2 = rest.rowSelection) === null || _rest$rowSelection2 === void 0 ? void 0 : _rest$rowSelection2.selectedRowKeys) || []).length > 0;
|
|
@@ -247,15 +297,44 @@ function VtxTable(props) {
|
|
|
247
297
|
var _useAntdColumnResize = (0, _reactAntdColumnResize.useAntdColumnResize)(function () {
|
|
248
298
|
return {
|
|
249
299
|
columns: columns,
|
|
250
|
-
minWidth:
|
|
300
|
+
minWidth: 10
|
|
251
301
|
};
|
|
252
302
|
}, [columns]),
|
|
253
303
|
resizableColumns = _useAntdColumnResize.resizableColumns,
|
|
254
304
|
resizeComponents = _useAntdColumnResize.components,
|
|
255
305
|
tableWidth = _useAntdColumnResize.tableWidth,
|
|
256
306
|
resetColumns = _useAntdColumnResize.resetColumns;
|
|
307
|
+
|
|
308
|
+
// const _columns = useMemo(() => {
|
|
309
|
+
// let result = [];
|
|
310
|
+
// if (!showTable) {
|
|
311
|
+
// result = []
|
|
312
|
+
// } else if (isDragRef) {
|
|
313
|
+
// result = resizableColumns
|
|
314
|
+
// } else {
|
|
315
|
+
// result = columns
|
|
316
|
+
// }
|
|
317
|
+
// let flag = false;
|
|
318
|
+
// result?.map((v) => {
|
|
319
|
+
// if (columnsMap[v.key].width !== v.width) {
|
|
320
|
+
// flag = true;
|
|
321
|
+
// columnsMap[v.key] = {
|
|
322
|
+
// ...columnsMap[v.key],
|
|
323
|
+
// width: v.width
|
|
324
|
+
// };
|
|
325
|
+
// }
|
|
326
|
+
// })
|
|
327
|
+
// if (flag) {
|
|
328
|
+
// counter.setColumnsMap(
|
|
329
|
+
// columnsMap
|
|
330
|
+
// )
|
|
331
|
+
// }
|
|
332
|
+
// return result;
|
|
333
|
+
|
|
334
|
+
// }, [isDragRef, resizableColumns, showTable, columns, columnsMap])
|
|
335
|
+
|
|
336
|
+
// 1. 先计算列配置
|
|
257
337
|
var _columns = (0, _react.useMemo)(function () {
|
|
258
|
-
var _result;
|
|
259
338
|
var result = [];
|
|
260
339
|
if (!showTable) {
|
|
261
340
|
result = [];
|
|
@@ -264,24 +343,30 @@ function VtxTable(props) {
|
|
|
264
343
|
} else {
|
|
265
344
|
result = columns;
|
|
266
345
|
}
|
|
346
|
+
return result;
|
|
347
|
+
}, [isDragRef, resizableColumns, showTable, columns]);
|
|
348
|
+
|
|
349
|
+
// 2. 在 effect 中同步列宽到 columnsMap
|
|
350
|
+
(0, _react.useEffect)(function () {
|
|
351
|
+
if (!showTable || !_columns.length) return;
|
|
267
352
|
var flag = false;
|
|
268
|
-
|
|
269
|
-
|
|
353
|
+
var newColumnsMap = _objectSpread({}, columnsMap); // 创建副本避免直接修改
|
|
354
|
+
|
|
355
|
+
_columns.forEach(function (v) {
|
|
356
|
+
var _columnsMap$v$key;
|
|
357
|
+
if (((_columnsMap$v$key = columnsMap[v.key]) === null || _columnsMap$v$key === void 0 ? void 0 : _columnsMap$v$key.width) !== v.width) {
|
|
270
358
|
flag = true;
|
|
271
|
-
|
|
359
|
+
newColumnsMap[v.key] = _objectSpread(_objectSpread({}, newColumnsMap[v.key]), {}, {
|
|
360
|
+
width: v.width
|
|
361
|
+
});
|
|
272
362
|
}
|
|
273
363
|
});
|
|
274
364
|
if (flag) {
|
|
275
|
-
counter.setColumnsMap(
|
|
365
|
+
counter.setColumnsMap(newColumnsMap);
|
|
276
366
|
}
|
|
277
|
-
|
|
278
|
-
}, [isDragRef, resizableColumns, showTable, columns, columnsMap]);
|
|
367
|
+
}, [_columns, columnsMap, counter, showTable]);
|
|
279
368
|
var _components = (0, _react.useMemo)(function () {
|
|
280
|
-
|
|
281
|
-
return resizeComponents;
|
|
282
|
-
} else {
|
|
283
|
-
return components;
|
|
284
|
-
}
|
|
369
|
+
return (0, _mergeComponents.mergeComponentsForResize)(components, resizeComponents, isDragRef);
|
|
285
370
|
}, [isDragRef, resizeComponents, components]);
|
|
286
371
|
|
|
287
372
|
// 工具栏
|
|
@@ -303,20 +388,24 @@ function VtxTable(props) {
|
|
|
303
388
|
}) : null;
|
|
304
389
|
return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
305
390
|
id: datagridId,
|
|
306
|
-
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),
|
|
391
|
+
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),
|
|
307
392
|
ref: rootDomRef,
|
|
308
393
|
style: style,
|
|
309
394
|
children: [toolbarRender, alertRender, /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Table, _objectSpread(_objectSpread({
|
|
310
395
|
size: counter.tableSize,
|
|
311
396
|
bordered: true
|
|
397
|
+
// virtual
|
|
312
398
|
}, rest), {}, {
|
|
313
399
|
dataSource: dataSource,
|
|
314
400
|
scroll: _objectSpread({
|
|
315
401
|
x: 'max-content'
|
|
316
402
|
}, scroll),
|
|
317
403
|
pagination: getPagination(rest.pagination),
|
|
318
|
-
|
|
319
|
-
|
|
404
|
+
xs: true,
|
|
405
|
+
styles: {
|
|
406
|
+
root: {
|
|
407
|
+
height: "calc(100% - ".concat(toolbarHeight.current + alertHeight.current, "px)")
|
|
408
|
+
}
|
|
320
409
|
},
|
|
321
410
|
locale: _objectSpread({
|
|
322
411
|
emptyText: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Empty, {
|
|
@@ -325,6 +414,9 @@ function VtxTable(props) {
|
|
|
325
414
|
}, rest.locale),
|
|
326
415
|
components: _components,
|
|
327
416
|
columns: _columns
|
|
417
|
+
// tableLayout={'auto'}
|
|
418
|
+
,
|
|
419
|
+
tableLayout: "fixed"
|
|
328
420
|
}))]
|
|
329
421
|
}));
|
|
330
422
|
}
|
|
@@ -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);
|
|
@@ -14,37 +14,85 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
14
14
|
var genVtxStyle = function genVtxStyle(token) {
|
|
15
15
|
var componentCls = token.componentCls,
|
|
16
16
|
antCls = token.antCls;
|
|
17
|
-
return _defineProperty(
|
|
17
|
+
return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty(_defineProperty({
|
|
18
18
|
position: 'relative',
|
|
19
|
-
overflow: 'hidden'
|
|
20
|
-
|
|
19
|
+
// overflow: 'hidden',
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flexDirection: 'column'
|
|
22
|
+
}, "".concat(antCls, "-table-cell-ellipsis"), {
|
|
23
|
+
whiteSpace: 'normal'
|
|
24
|
+
}), "".concat(antCls, "-table-wrapper"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "table", {
|
|
25
|
+
// minWidth: "calc(100% - 2px) !important"
|
|
26
|
+
}), '.ant-spin, .ant-spin-nested-loading', _defineProperty({
|
|
27
|
+
height: '100%'
|
|
28
|
+
}, '.ant-spin-container', _defineProperty({
|
|
29
|
+
height: '100%',
|
|
30
|
+
display: 'flex',
|
|
31
|
+
flexDirection: 'column'
|
|
32
|
+
}, '.ant-table', _defineProperty({
|
|
33
|
+
// height: '100%',
|
|
34
|
+
flex: 1
|
|
35
|
+
}, '.ant-table-container', _defineProperty(_defineProperty({
|
|
36
|
+
height: '100%',
|
|
37
|
+
borderInlineStart: 'none'
|
|
38
|
+
}, '.ant-table-body', {
|
|
39
|
+
scrollbarWidth: 'thin'
|
|
40
|
+
}), '.ant-table-content', _defineProperty({
|
|
41
|
+
height: '100%',
|
|
42
|
+
scrollbarWidth: 'thin'
|
|
43
|
+
}, 'table', {
|
|
44
|
+
// height: '100%',
|
|
45
|
+
minWidth: 'calc(100% - 1px) !important'
|
|
46
|
+
})))))), '.ant-table', _defineProperty(_defineProperty(_defineProperty({}, '.ant-table-header', _defineProperty({}, '.ant-table-thead', {
|
|
21
47
|
'>tr>th': {
|
|
22
|
-
background: token.colorBgContainer
|
|
48
|
+
background: token.colorBgContainer,
|
|
49
|
+
'&:first-child': {
|
|
50
|
+
borderInlineStart: 'var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)'
|
|
51
|
+
}
|
|
23
52
|
}
|
|
24
53
|
})), '.ant-table-cell', {
|
|
25
|
-
minWidth:
|
|
26
|
-
}), '.ant-table-
|
|
54
|
+
// minWidth: 10,
|
|
55
|
+
}), '.ant-table-tbody', {
|
|
56
|
+
'>tr>td': {
|
|
57
|
+
'&:first-child': {
|
|
58
|
+
borderInlineStart: 'var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)'
|
|
59
|
+
}
|
|
60
|
+
},
|
|
27
61
|
'>tr.ant-table-placeholder': {
|
|
28
62
|
position: 'absolute',
|
|
29
|
-
top: '
|
|
63
|
+
top: 'auto',
|
|
64
|
+
bottom: 'auto',
|
|
30
65
|
right: 0,
|
|
31
66
|
left: 0,
|
|
32
67
|
backgroundColor: 'transparent',
|
|
33
68
|
borderTop: 'none',
|
|
69
|
+
// borderInlineEnd: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)",
|
|
70
|
+
// borderBottom: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)",
|
|
34
71
|
'>td.ant-table-cell': {
|
|
35
|
-
|
|
36
|
-
alignItems: 'center',
|
|
37
|
-
justifyContent: 'center',
|
|
72
|
+
padding: 0,
|
|
38
73
|
width: '100%',
|
|
39
74
|
height: '100%',
|
|
40
|
-
border: 'none'
|
|
75
|
+
border: 'none',
|
|
76
|
+
'>.ant-table-expanded-row-fixed': {
|
|
77
|
+
display: 'flex',
|
|
78
|
+
alignItems: 'center',
|
|
79
|
+
justifyContent: 'center',
|
|
80
|
+
height: '100%',
|
|
81
|
+
width: '100%',
|
|
82
|
+
'&::after': {
|
|
83
|
+
border: 'none'
|
|
84
|
+
}
|
|
85
|
+
}
|
|
41
86
|
}
|
|
42
87
|
}
|
|
43
|
-
}))
|
|
88
|
+
})), '.ant-pagination', _defineProperty({
|
|
89
|
+
margin: 'var(--ant-margin) 0 0 0'
|
|
90
|
+
}, '.ant-pagination-item', {
|
|
44
91
|
borderRadius: token.borderRadiusSM
|
|
45
|
-
}))), "
|
|
46
|
-
height: '100%'
|
|
47
|
-
|
|
92
|
+
})))), "".concat(componentCls, "-fit"), {
|
|
93
|
+
height: '100%',
|
|
94
|
+
minHeight: 200
|
|
95
|
+
}), "".concat(componentCls, "-noFit"), {}), "".concat(componentCls, "-no-border"), _defineProperty({}, "".concat(antCls, "-table-wrapper"), _defineProperty({}, "".concat(antCls, "-table"), _defineProperty({}, '>.ant-table-container', _defineProperty(_defineProperty({
|
|
48
96
|
borderColor: 'transparent'
|
|
49
97
|
}, '.ant-table-thead', {
|
|
50
98
|
'>tr>th': {
|
|
@@ -53,10 +101,14 @@ var genVtxStyle = function genVtxStyle(token) {
|
|
|
53
101
|
}), '.ant-table-body', {
|
|
54
102
|
'>table >tbody>tr>td': {
|
|
55
103
|
borderInlineColor: 'transparent !important'
|
|
104
|
+
},
|
|
105
|
+
'>table >tbody>tr.ant-table-placeholder': {
|
|
106
|
+
borderInlineColor: 'transparent !important',
|
|
107
|
+
borderBottomColor: 'transparent !important'
|
|
56
108
|
}
|
|
57
|
-
}))))), "
|
|
109
|
+
}))))), "".concat(componentCls, "-striped"), _defineProperty({}, "".concat(antCls, "-table-wrapper"), _defineProperty({}, "".concat(antCls, "-table"), _defineProperty({}, '>.ant-table-container', _defineProperty(_defineProperty({}, '.ant-table-body', {
|
|
58
110
|
'>table >tbody>tr:nth-child(odd)>td': {
|
|
59
|
-
backgroundColor: token.
|
|
111
|
+
backgroundColor: token.colorBgLayoutTable,
|
|
60
112
|
'&.ant-table-cell-row-hover': {
|
|
61
113
|
backgroundColor: token.colorFillAlterSolid
|
|
62
114
|
}
|
|
@@ -70,11 +122,41 @@ var genVtxStyle = function genVtxStyle(token) {
|
|
|
70
122
|
backgroundColor: token.controlItemBgActiveHover
|
|
71
123
|
}
|
|
72
124
|
}
|
|
73
|
-
})
|
|
125
|
+
}), '.ant-table-tbody', {
|
|
126
|
+
'>tr:nth-child(odd)>td': {
|
|
127
|
+
backgroundColor: token.colorBgLayoutTable,
|
|
128
|
+
'&.ant-table-cell-row-hover': {
|
|
129
|
+
backgroundColor: token.colorFillAlterSolid
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
'>tr:nth-child(odd)>td.ant-table-column-sort': {
|
|
133
|
+
backgroundColor: token.colorFillAlterSolid
|
|
134
|
+
},
|
|
135
|
+
'>tr.ant-table-row-selected:nth-child(odd)>td': {
|
|
136
|
+
backgroundColor: token.controlItemBgActive,
|
|
137
|
+
'&.ant-table-cell-row-hover': {
|
|
138
|
+
backgroundColor: token.controlItemBgActiveHover
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}))))), "".concat(componentCls, "-header-background"), _defineProperty({}, "".concat(antCls, "-table-wrapper"), _defineProperty({}, '.ant-table', _defineProperty({}, '.ant-table-header', _defineProperty({}, '.ant-table-thead', {
|
|
74
142
|
'>tr>th': {
|
|
75
|
-
background: token.
|
|
143
|
+
background: token.colorBgLayoutTable
|
|
144
|
+
}
|
|
145
|
+
}))))), "".concat(componentCls, "-no-header-background"), _defineProperty({}, "".concat(antCls, "-table-wrapper "), _defineProperty({}, '.ant-table-thead', {
|
|
146
|
+
'>tr>th': {
|
|
147
|
+
background: token.colorBgContainer
|
|
76
148
|
}
|
|
77
|
-
})))))
|
|
149
|
+
}))), "".concat(componentCls, "-no-data"), _defineProperty({}, "".concat(antCls, "-table-wrapper"), _defineProperty({}, '.ant-spin', _defineProperty({}, '.ant-spin-container', _defineProperty({}, '.ant-table', _defineProperty({}, '.ant-table-container', _defineProperty({
|
|
150
|
+
borderInlineStart: 'var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)'
|
|
151
|
+
}, '.ant-table-content', _defineProperty({
|
|
152
|
+
borderRight: 'var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)',
|
|
153
|
+
borderBottom: 'var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)'
|
|
154
|
+
}, 'table', {})))))))), "".concat(componentCls, "-no-data").concat(componentCls, "-no-border"), _defineProperty({}, "".concat(antCls, "-table-wrapper"), _defineProperty({}, '.ant-spin', _defineProperty({}, '.ant-spin-container', _defineProperty({}, '.ant-table', _defineProperty({}, '.ant-table-container', _defineProperty({
|
|
155
|
+
borderInlineStart: 'none'
|
|
156
|
+
}, '.ant-table-content', {
|
|
157
|
+
borderRight: 'none',
|
|
158
|
+
borderBottom: 'none'
|
|
159
|
+
})))))));
|
|
78
160
|
};
|
|
79
161
|
function useStyle(prefix) {
|
|
80
162
|
return (0, _vtxProvider.useStyle)(prefix, function (token) {
|