@vtx/components 4.0.0-beta.9 → 4.0.0-beta.90
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 +6 -6
- 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 +109 -140
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -6
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/es/vtx-datagrid/ToolBar/index.js +2 -1
- package/es/vtx-datagrid/ToolBar/style.js +6 -3
- package/es/vtx-datagrid/columnState.js +91 -0
- package/es/vtx-datagrid/index.js +134 -37
- package/es/vtx-datagrid/mergeComponents.js +15 -0
- package/es/vtx-datagrid/renderColumnButtons.js +30 -11
- package/es/vtx-datagrid/style/index.js +108 -18
- 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 +2 -2
- package/es/vtx-ellipsis-text/style/index.js +3 -1
- package/es/vtx-export/index.js +33 -38
- package/es/vtx-export-async/History.js +15 -7
- package/es/vtx-export-async/index.js +18 -8
- package/es/vtx-export-async/util.js +16 -5
- package/es/vtx-form-layout/FormItem.js +16 -16
- package/es/vtx-form-layout/style/index.js +6 -4
- package/es/vtx-icon/index.js +54 -45
- package/es/vtx-icon/index.js1 +90 -0
- package/es/vtx-image/style/index.js +0 -1
- package/es/vtx-import/index.js +143 -42
- 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 +29 -19
- package/es/vtx-import2/style/index.js +59 -8
- package/es/vtx-modal/index.js +11 -6
- package/es/vtx-modal/style/index.js +5 -2
- 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 +33 -31
- package/es/vtx-provider/intl.js +9 -9
- package/es/vtx-provider/locale/en_GB.js +1 -1
- package/es/vtx-provider/locale/en_US.js +58 -4
- 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 +30 -12
- package/es/vtx-search/style/index.js +6 -3
- package/es/vtx-select/index.js +123 -40
- package/es/vtx-select/style/index.js +11 -56
- 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 +27 -9
- package/es/vtx-tree-select/index.js +81 -110
- 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 +41 -32
- package/es/vtx-wang-editor/style/index.less +12 -12
- 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 +6 -6
- 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 +112 -142
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -6
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/lib/vtx-datagrid/ToolBar/index.js +2 -1
- package/lib/vtx-datagrid/ToolBar/style.js +6 -3
- package/lib/vtx-datagrid/columnState.js +100 -0
- package/lib/vtx-datagrid/index.js +134 -37
- package/lib/vtx-datagrid/mergeComponents.js +21 -0
- package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
- package/lib/vtx-datagrid/style/index.js +108 -18
- 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 +2 -2
- package/lib/vtx-ellipsis-text/style/index.js +3 -1
- package/lib/vtx-export/index.js +34 -39
- package/lib/vtx-export-async/History.js +14 -8
- package/lib/vtx-export-async/index.js +18 -8
- package/lib/vtx-export-async/util.js +16 -5
- package/lib/vtx-form-layout/FormItem.js +16 -16
- package/lib/vtx-form-layout/style/index.js +6 -4
- package/lib/vtx-icon/index.js +54 -52
- package/lib/vtx-icon/index.js1 +90 -0
- package/lib/vtx-image/style/index.js +0 -1
- package/lib/vtx-import/index.js +141 -43
- 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 -19
- package/lib/vtx-import2/style/index.js +59 -8
- package/lib/vtx-modal/index.js +11 -6
- package/lib/vtx-modal/style/index.js +5 -2
- 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 +33 -31
- package/lib/vtx-provider/intl.js +9 -9
- package/lib/vtx-provider/locale/en_GB.js +1 -1
- package/lib/vtx-provider/locale/en_US.js +58 -4
- 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 +32 -12
- package/lib/vtx-search/style/index.js +6 -3
- package/lib/vtx-select/index.js +125 -42
- package/lib/vtx-select/style/index.js +11 -56
- 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 +27 -9
- package/lib/vtx-tree-select/index.js +81 -112
- 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 +39 -30
- package/lib/vtx-wang-editor/style/index.less +12 -12
- package/package.json +239 -238
- package/es/utils/hooks/useFetchData/index.js +0 -82
- package/lib/utils/hooks/useFetchData/index.js +0 -89
|
@@ -29,6 +29,7 @@ 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";
|
|
32
33
|
// omit 用于从对象中排除指定的属性,返回一个新对象
|
|
33
34
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
34
35
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -244,7 +245,6 @@ var CheckboxList = function CheckboxList(_ref3) {
|
|
|
244
245
|
var dropPosition = info.dropPosition,
|
|
245
246
|
dropToGap = info.dropToGap;
|
|
246
247
|
var position = dropPosition === -1 || !dropToGap ? dropPosition + 1 : dropPosition;
|
|
247
|
-
console.log('newMap info', dragKey, dropKey, position);
|
|
248
248
|
move(dragKey, dropKey, position);
|
|
249
249
|
},
|
|
250
250
|
treeIcon: false,
|
|
@@ -367,6 +367,7 @@ export default function ColumnSetting(props) {
|
|
|
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
372
|
TextEnum = _useContext8.TextEnum,
|
|
372
373
|
tableColumn = _useContext8.tableColumn;
|
|
@@ -374,10 +375,10 @@ export default function ColumnSetting(props) {
|
|
|
374
375
|
var checkedColumnKeys = props.checkedColumnKeys,
|
|
375
376
|
onColumnsSave = props.onColumnsSave;
|
|
376
377
|
|
|
377
|
-
/**
|
|
378
|
-
* 设置全部选中,或全部未选中
|
|
379
|
-
*
|
|
380
|
-
* @param show
|
|
378
|
+
/**
|
|
379
|
+
* 设置全部选中,或全部未选中
|
|
380
|
+
*
|
|
381
|
+
* @param show
|
|
381
382
|
*/
|
|
382
383
|
var setAllSelectAction = useRefFunction(function () {
|
|
383
384
|
var show = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
@@ -430,7 +431,7 @@ export default function ColumnSetting(props) {
|
|
|
430
431
|
|
|
431
432
|
// 保存按钮
|
|
432
433
|
var onSaveChange = function onSaveChange() {
|
|
433
|
-
onColumnsSave(checkedColumnKeys);
|
|
434
|
+
onColumnsSave(Array.isArray(checkedColumnKeys) ? checkedColumnKeys : getVisibleColumnKeysFromMap(columnsMap, sortKeyColumns));
|
|
434
435
|
};
|
|
435
436
|
// 未选中的 key 列表
|
|
436
437
|
var unCheckedKeys = Object.values(columnsMap).filter(function (value) {
|
|
@@ -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"), {
|
|
@@ -18,6 +18,7 @@ function ToolBar(props) {
|
|
|
18
18
|
toolbarTilte = props.toolbarTilte,
|
|
19
19
|
buttonGroup = props.buttonGroup,
|
|
20
20
|
refreshIconVisible = props.refreshIconVisible,
|
|
21
|
+
fullScreenVisible = props.fullScreenVisible,
|
|
21
22
|
onRefresh = props.onRefresh,
|
|
22
23
|
hideColumnHeight = props.hideColumnHeight,
|
|
23
24
|
hideColumnSetting = props.hideColumnSetting,
|
|
@@ -63,7 +64,7 @@ function ToolBar(props) {
|
|
|
63
64
|
}), !hideColumnHeight && /*#__PURE__*/_jsx("div", {
|
|
64
65
|
className: "".concat(prefix, "-toolbar-setting-item"),
|
|
65
66
|
children: /*#__PURE__*/_jsx(Density, {})
|
|
66
|
-
}),
|
|
67
|
+
}), fullScreenVisible && /*#__PURE__*/_jsx("div", {
|
|
67
68
|
className: "".concat(prefix, "-toolbar-setting-item"),
|
|
68
69
|
onClick: (_fullScreenRef$curren = fullScreenRef.current) === null || _fullScreenRef$curren === void 0 ? void 0 : _fullScreenRef$curren.fullScreen,
|
|
69
70
|
children: /*#__PURE__*/_jsx(Fullscreen, {
|
|
@@ -17,7 +17,8 @@ var genVtxStyle = function genVtxStyle(token) {
|
|
|
17
17
|
verticalAlign: 'middle'
|
|
18
18
|
}), "&-left", {
|
|
19
19
|
color: token.colorText,
|
|
20
|
-
fontSize: '16px'
|
|
20
|
+
fontSize: '16px',
|
|
21
|
+
fontWeight: 600
|
|
21
22
|
}), "&-right", {
|
|
22
23
|
float: 'right',
|
|
23
24
|
display: 'flex',
|
|
@@ -34,14 +35,16 @@ var genVtxStyle = function genVtxStyle(token) {
|
|
|
34
35
|
}), "&-setting-item", _defineProperty(_defineProperty({
|
|
35
36
|
width: '32px',
|
|
36
37
|
height: '32px',
|
|
37
|
-
background: token.colorFillContent,
|
|
38
|
+
// background: token.colorFillContent,
|
|
39
|
+
background: '#F0F2F5',
|
|
38
40
|
borderRadius: '6px',
|
|
39
41
|
display: 'flex',
|
|
40
42
|
alignItems: 'center',
|
|
41
43
|
justifyContent: 'center',
|
|
42
44
|
marginLeft: '6px',
|
|
43
45
|
cursor: 'pointer',
|
|
44
|
-
color: token.colorIcon
|
|
46
|
+
// color: token.colorIcon,
|
|
47
|
+
color: '#595959'
|
|
45
48
|
}, '&:nth-child(1)', {
|
|
46
49
|
marginLeft: '8px'
|
|
47
50
|
}), "&:hover", {
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
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; }
|
|
7
|
+
import { genColumnKey } from "../utils/genColumnKey";
|
|
8
|
+
import { sortByGivenOrder } from "../utils/sortByGivenOrder";
|
|
9
|
+
export var indexColumnKey = '_serialNum';
|
|
10
|
+
export function buildColumnKeyMap() {
|
|
11
|
+
var tableColumn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
12
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
13
|
+
visibleColumnKeys = _ref.visibleColumnKeys,
|
|
14
|
+
defaultVisibleColumnKeys = _ref.defaultVisibleColumnKeys,
|
|
15
|
+
_ref$previousColumnsM = _ref.previousColumnsMap,
|
|
16
|
+
previousColumnsMap = _ref$previousColumnsM === void 0 ? {} : _ref$previousColumnsM,
|
|
17
|
+
_ref$indexColumn = _ref.indexColumn,
|
|
18
|
+
indexColumn = _ref$indexColumn === void 0 ? true : _ref$indexColumn;
|
|
19
|
+
var hasVisibleColumnKeys = Array.isArray(visibleColumnKeys);
|
|
20
|
+
var hasDefaultVisibleColumnKeys = Array.isArray(defaultVisibleColumnKeys);
|
|
21
|
+
return (tableColumn || []).reduce(function (columnKeyMap, _ref2, index) {
|
|
22
|
+
var _previousConfig$fixed, _previousConfig$width;
|
|
23
|
+
var key = _ref2.key,
|
|
24
|
+
dataIndex = _ref2.dataIndex,
|
|
25
|
+
fixed = _ref2.fixed,
|
|
26
|
+
disable = _ref2.disable,
|
|
27
|
+
width = _ref2.width;
|
|
28
|
+
var columnKey = genColumnKey(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
29
|
+
var previousConfig = previousColumnsMap[columnKey] || {};
|
|
30
|
+
var show = previousConfig.show;
|
|
31
|
+
if (indexColumn && indexColumnKey === columnKey) {
|
|
32
|
+
show = true;
|
|
33
|
+
} else if (hasVisibleColumnKeys) {
|
|
34
|
+
show = visibleColumnKeys.includes(columnKey);
|
|
35
|
+
} else if (show === undefined && hasDefaultVisibleColumnKeys) {
|
|
36
|
+
show = defaultVisibleColumnKeys.includes(columnKey);
|
|
37
|
+
} else if (show === undefined) {
|
|
38
|
+
show = true;
|
|
39
|
+
}
|
|
40
|
+
columnKeyMap[columnKey] = {
|
|
41
|
+
show: show,
|
|
42
|
+
fixed: (_previousConfig$fixed = previousConfig.fixed) !== null && _previousConfig$fixed !== void 0 ? _previousConfig$fixed : fixed,
|
|
43
|
+
disable: disable,
|
|
44
|
+
width: (_previousConfig$width = previousConfig.width) !== null && _previousConfig$width !== void 0 ? _previousConfig$width : width
|
|
45
|
+
};
|
|
46
|
+
if (previousConfig.order !== undefined) {
|
|
47
|
+
columnKeyMap[columnKey].order = previousConfig.order;
|
|
48
|
+
}
|
|
49
|
+
return columnKeyMap;
|
|
50
|
+
}, {});
|
|
51
|
+
}
|
|
52
|
+
export function buildSortKeyColumns() {
|
|
53
|
+
var columnsMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
54
|
+
var visibleColumnKeys = arguments.length > 1 ? arguments[1] : undefined;
|
|
55
|
+
var defaultVisibleColumnKeys = arguments.length > 2 ? arguments[2] : undefined;
|
|
56
|
+
var columnKeys = Object.keys(columnsMap);
|
|
57
|
+
var sortKeys = visibleColumnKeys || defaultVisibleColumnKeys || [];
|
|
58
|
+
if (sortKeys.length > 0) {
|
|
59
|
+
return sortByGivenOrder(columnKeys, sortKeys);
|
|
60
|
+
}
|
|
61
|
+
return columnKeys;
|
|
62
|
+
}
|
|
63
|
+
export function getVisibleColumnKeysFromMap() {
|
|
64
|
+
var columnsMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
65
|
+
var sortKeyColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
66
|
+
var allColumnKeys = Array.from(new Set([].concat(_toConsumableArray(sortKeyColumns), _toConsumableArray(Object.keys(columnsMap)))));
|
|
67
|
+
var sortIndexMap = new Map(sortKeyColumns.map(function (columnKey, index) {
|
|
68
|
+
return [columnKey, index];
|
|
69
|
+
}));
|
|
70
|
+
return allColumnKeys.filter(function (columnKey) {
|
|
71
|
+
var _columnsMap$columnKey;
|
|
72
|
+
return (_columnsMap$columnKey = columnsMap[columnKey]) === null || _columnsMap$columnKey === void 0 ? void 0 : _columnsMap$columnKey.show;
|
|
73
|
+
}).sort(function (leftKey, rightKey) {
|
|
74
|
+
var leftConfig = columnsMap[leftKey] || {};
|
|
75
|
+
var rightConfig = columnsMap[rightKey] || {};
|
|
76
|
+
var leftFixed = leftConfig.fixed,
|
|
77
|
+
leftOrder = leftConfig.order;
|
|
78
|
+
var rightFixed = rightConfig.fixed,
|
|
79
|
+
rightOrder = rightConfig.order;
|
|
80
|
+
if (leftFixed === 'left' && rightFixed !== 'left' || rightFixed === 'right' && leftFixed !== 'right') {
|
|
81
|
+
return -2;
|
|
82
|
+
}
|
|
83
|
+
if (rightFixed === 'left' && leftFixed !== 'left' || leftFixed === 'right' && rightFixed !== 'right') {
|
|
84
|
+
return 2;
|
|
85
|
+
}
|
|
86
|
+
if (leftOrder !== undefined || rightOrder !== undefined) {
|
|
87
|
+
return (leftOrder !== null && leftOrder !== void 0 ? leftOrder : 0) - (rightOrder !== null && rightOrder !== void 0 ? rightOrder : 0);
|
|
88
|
+
}
|
|
89
|
+
return (sortIndexMap.has(leftKey) ? sortIndexMap.get(leftKey) : Number.MAX_SAFE_INTEGER) - (sortIndexMap.has(rightKey) ? sortIndexMap.get(rightKey) : Number.MAX_SAFE_INTEGER);
|
|
90
|
+
});
|
|
91
|
+
}
|
package/es/vtx-datagrid/index.js
CHANGED
|
@@ -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 = ["toolbar", "toolbarClassName", "toolbarTilte", "buttonGroup", "refreshIconVisible", "hideColumnSetting", "hideColumnHeight", "onRefresh", "bordered", "startIndex", "autoFit", "headFootHeight", "columnResizable", "components", "className", "style", "emptyText", "onRowSelectionClear", "onColumnsSave", "uniqueKey", "prefixUrl", "hideSelectionClear", "customEnumText"];
|
|
2
|
+
var _excluded = ["toolbar", "toolbarClassName", "toolbarTilte", "buttonGroup", "refreshIconVisible", "fullScreenVisible", "hideColumnSetting", "hideColumnHeight", "onRefresh", "bordered", "startIndex", "autoFit", "headFootHeight", "columnResizable", "components", "className", "style", "emptyText", "onRowSelectionClear", "onColumnsSave", "uniqueKey", "prefixUrl", "hideSelectionClear", "customEnumText"];
|
|
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; }
|
|
@@ -18,22 +18,23 @@ import { ConfigProvider, Empty, Table } from 'antd';
|
|
|
18
18
|
import classnames from 'classnames';
|
|
19
19
|
import PropTypes from 'prop-types';
|
|
20
20
|
import React, { useContext, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
|
|
21
|
+
import { useAntdColumnResize } from 'react-antd-column-resize';
|
|
21
22
|
import { ErrorBoundary, genColumnKey, sortByKeyArrayExtract } from "../utils";
|
|
22
23
|
import useSet from "../utils/useSet";
|
|
24
|
+
import { useIntl } from "../vtx-provider";
|
|
23
25
|
import Alert from "./Alert";
|
|
24
|
-
import ToolBar from "./ToolBar";
|
|
25
26
|
import { Container, TableContext } from "./Store/Provide";
|
|
27
|
+
import ToolBar from "./ToolBar";
|
|
28
|
+
import { mergeComponentsForResize } from "./mergeComponents";
|
|
26
29
|
import { useStyle } from "./style/index";
|
|
27
|
-
import { useAntdColumnResize } from 'react-antd-column-resize';
|
|
28
|
-
import { useIntl } from "../vtx-provider";
|
|
29
30
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
30
31
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
31
32
|
var isMac = navigator.userAgent.indexOf('Mac OS') !== -1;
|
|
32
33
|
export var indexColumnKey = '_serialNum';
|
|
33
34
|
export var DEFAULT_HEIGHTS = {
|
|
34
35
|
HEAD_FOOT: 115,
|
|
35
|
-
ALERT:
|
|
36
|
-
TOOLBAR:
|
|
36
|
+
ALERT: 48,
|
|
37
|
+
TOOLBAR: 64
|
|
37
38
|
};
|
|
38
39
|
function VtxTable(props) {
|
|
39
40
|
var _rest$dataSource, _rest$rowSelection, _rest$rowSelection3, _rest$rowSelection4;
|
|
@@ -52,17 +53,19 @@ function VtxTable(props) {
|
|
|
52
53
|
isDragRef = _useContext2.isDragRef,
|
|
53
54
|
rootDomRef = _useContext2.rootDomRef,
|
|
54
55
|
sortKeyColumns = _useContext2.sortKeyColumns,
|
|
55
|
-
TextEnum = _useContext2.TextEnum
|
|
56
|
+
TextEnum = _useContext2.TextEnum,
|
|
57
|
+
tableSize = _useContext2.tableSize;
|
|
56
58
|
var _useSet = useSet({
|
|
57
59
|
// 表格id
|
|
58
60
|
datagridId: "vtx-datagrid-".concat(new Date().getTime()),
|
|
59
|
-
scrollY:
|
|
61
|
+
scrollY: undefined
|
|
60
62
|
}),
|
|
61
63
|
_useSet2 = _slicedToArray(_useSet, 2),
|
|
62
64
|
_useSet2$ = _useSet2[0],
|
|
63
65
|
datagridId = _useSet2$.datagridId,
|
|
64
66
|
scrollY = _useSet2$.scrollY,
|
|
65
67
|
setState = _useSet2[1];
|
|
68
|
+
var scrollYRef = useRef(undefined);
|
|
66
69
|
// 列设置提示高度
|
|
67
70
|
var alertHeight = useRef(0);
|
|
68
71
|
// 工具栏高度
|
|
@@ -77,6 +80,8 @@ function VtxTable(props) {
|
|
|
77
80
|
buttonGroup = props.buttonGroup,
|
|
78
81
|
_props$refreshIconVis = props.refreshIconVisible,
|
|
79
82
|
refreshIconVisible = _props$refreshIconVis === void 0 ? true : _props$refreshIconVis,
|
|
83
|
+
_props$fullScreenVisi = props.fullScreenVisible,
|
|
84
|
+
fullScreenVisible = _props$fullScreenVisi === void 0 ? false : _props$fullScreenVisi,
|
|
80
85
|
hideColumnSetting = props.hideColumnSetting,
|
|
81
86
|
hideColumnHeight = props.hideColumnHeight,
|
|
82
87
|
onRefresh = props.onRefresh,
|
|
@@ -107,25 +112,65 @@ function VtxTable(props) {
|
|
|
107
112
|
|
|
108
113
|
// 高度计算
|
|
109
114
|
var _useThrottleFn = useThrottleFn(function () {
|
|
110
|
-
var _rootDomRef$current;
|
|
115
|
+
var _rootDomRef$current, _bodyDiv$getElementsB;
|
|
111
116
|
if (!rootDomRef.current) {
|
|
112
117
|
return null;
|
|
113
118
|
}
|
|
114
|
-
var bodyHeight = ((_rootDomRef$current = rootDomRef.current) === null || _rootDomRef$current === void 0 ? void 0 : _rootDomRef$current.clientHeight) - headFootHeight - toolbarHeight.current - alertHeight.current;
|
|
115
119
|
var divs = rootDomRef.current.getElementsByTagName('div');
|
|
120
|
+
var pagination = Array.prototype.filter.call(rootDomRef.current.getElementsByTagName('ul'), function (dom) {
|
|
121
|
+
return dom.className.includes('ant-pagination');
|
|
122
|
+
})[0];
|
|
123
|
+
var tableHeader = Array.prototype.filter.call(rootDomRef.current.getElementsByTagName('thead'), function (dom) {
|
|
124
|
+
return dom.className.includes('ant-table-thead');
|
|
125
|
+
})[0];
|
|
126
|
+
var _headFootHeight = headFootHeight;
|
|
127
|
+
if (tableHeader) {
|
|
128
|
+
_headFootHeight = (pagination ? ((pagination === null || pagination === void 0 ? void 0 : pagination.clientHeight) || 0) + 32 : 0) + (tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.clientHeight);
|
|
129
|
+
}
|
|
130
|
+
var bodyHeight = ((_rootDomRef$current = rootDomRef.current) === null || _rootDomRef$current === void 0 ? void 0 : _rootDomRef$current.clientHeight) - _headFootHeight - toolbarHeight.current - alertHeight.current;
|
|
131
|
+
if (!bodyHeight || bodyHeight <= 0) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
116
134
|
var bodyDiv = Array.prototype.filter.call(divs, function (dom) {
|
|
117
|
-
return dom.className.includes('ant-table-body') || dom.className.includes('ant-table-content');
|
|
135
|
+
return dom.className.includes('ant-table-body') || dom.className.includes('ant-table-content') || dom.className.includes('ant-table-tbody');
|
|
118
136
|
})[0];
|
|
137
|
+
var tablePlaceholder = Array.prototype.filter.call(rootDomRef.current.getElementsByTagName('tr'), function (dom) {
|
|
138
|
+
return dom.className.includes('ant-table-placeholder');
|
|
139
|
+
})[0];
|
|
140
|
+
if (!bodyDiv) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
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;
|
|
144
|
+
var minBodyHeight = Math.max(bodyHeight - (rest.scrollY || 0), 0);
|
|
119
145
|
if (bodyDiv) {
|
|
120
|
-
bodyDiv.style.minHeight = "".concat(
|
|
146
|
+
bodyDiv.style.minHeight = "".concat(minBodyHeight, "px");
|
|
147
|
+
}
|
|
148
|
+
if (tablePlaceholder) {
|
|
149
|
+
var placeholderHeight = Math.max(bodyHeight - (rest.scrollY || 0) - 48 - 12, 0);
|
|
150
|
+
tablePlaceholder.style.height = "".concat(placeholderHeight, "px");
|
|
151
|
+
var tableCell = Array.prototype.filter.call(tablePlaceholder.getElementsByTagName('td'), function (dom) {
|
|
152
|
+
return dom.className.includes('ant-table-cell');
|
|
153
|
+
})[0];
|
|
154
|
+
if (tableCell) {
|
|
155
|
+
tableCell.style.height = "".concat(placeholderHeight, "px");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// antd6.x 的bug 如果table的高度 没有body 高 则没有滚动条
|
|
159
|
+
|
|
160
|
+
var nextScrollY = tableHeight > minBodyHeight ? minBodyHeight : undefined;
|
|
161
|
+
if (scrollYRef.current !== nextScrollY) {
|
|
162
|
+
scrollYRef.current = nextScrollY;
|
|
163
|
+
setState({
|
|
164
|
+
scrollY: nextScrollY
|
|
165
|
+
});
|
|
121
166
|
}
|
|
122
|
-
setState({
|
|
123
|
-
scrollY: bodyHeight
|
|
124
|
-
});
|
|
125
167
|
}, {
|
|
126
168
|
wait: 350
|
|
127
169
|
}),
|
|
128
170
|
calculateHeight = _useThrottleFn.run;
|
|
171
|
+
useEffect(function () {
|
|
172
|
+
scrollYRef.current = scrollY;
|
|
173
|
+
}, [scrollY]);
|
|
129
174
|
useEffect(function () {
|
|
130
175
|
var resizeObserver = new ResizeObserver(function () {
|
|
131
176
|
calculateHeight();
|
|
@@ -140,7 +185,14 @@ function VtxTable(props) {
|
|
|
140
185
|
resizeObserver.disconnect();
|
|
141
186
|
}
|
|
142
187
|
};
|
|
143
|
-
}, [autoFit]);
|
|
188
|
+
}, [autoFit, tableSize]);
|
|
189
|
+
|
|
190
|
+
// fix: 最后一页,横向滚动条上移问题
|
|
191
|
+
useEffect(function () {
|
|
192
|
+
if (scrollY > 0) {
|
|
193
|
+
calculateHeight();
|
|
194
|
+
}
|
|
195
|
+
}, [scrollY]);
|
|
144
196
|
useLayoutEffect(function () {
|
|
145
197
|
if (autoFit) {
|
|
146
198
|
calculateHeight();
|
|
@@ -158,7 +210,8 @@ function VtxTable(props) {
|
|
|
158
210
|
showQuickJumper: true,
|
|
159
211
|
showTotal: function showTotal(total) {
|
|
160
212
|
return "".concat(TextEnum.paginationTotalText, " ").concat(total, " ").concat(TextEnum.paginationItemText);
|
|
161
|
-
}
|
|
213
|
+
},
|
|
214
|
+
size: 'medium'
|
|
162
215
|
}, pagination);
|
|
163
216
|
};
|
|
164
217
|
// 先排序,排序的结果给列设置作用
|
|
@@ -181,9 +234,6 @@ function VtxTable(props) {
|
|
|
181
234
|
});
|
|
182
235
|
};
|
|
183
236
|
var _tableColumn = loopFilter(counter.tableColumn);
|
|
184
|
-
if (!columnsMap['_serialNum']) {
|
|
185
|
-
return [];
|
|
186
|
-
}
|
|
187
237
|
return sortByKeyArrayExtract(_tableColumn, sortKeyColumns, columnsMap, 'key');
|
|
188
238
|
}, [columnsMap, counter.tableColumn, sortKeyColumns]);
|
|
189
239
|
|
|
@@ -221,9 +271,12 @@ function VtxTable(props) {
|
|
|
221
271
|
result = _objectSpread(_objectSpread({}, result), {}, {
|
|
222
272
|
y: scrollY - (rest.scrollY || 0)
|
|
223
273
|
});
|
|
274
|
+
if (scrollY == undefined) {
|
|
275
|
+
result.y = undefined;
|
|
276
|
+
}
|
|
224
277
|
}
|
|
225
278
|
return result;
|
|
226
|
-
}, [rest.scroll, rest.scrollY, autoFit]);
|
|
279
|
+
}, [rest.scroll, rest.scrollY, scrollY, autoFit]);
|
|
227
280
|
var hasAlert = useMemo(function () {
|
|
228
281
|
var _rest$rowSelection2;
|
|
229
282
|
return (((_rest$rowSelection2 = rest.rowSelection) === null || _rest$rowSelection2 === void 0 ? void 0 : _rest$rowSelection2.selectedRowKeys) || []).length > 0;
|
|
@@ -237,15 +290,44 @@ function VtxTable(props) {
|
|
|
237
290
|
var _useAntdColumnResize = useAntdColumnResize(function () {
|
|
238
291
|
return {
|
|
239
292
|
columns: columns,
|
|
240
|
-
minWidth:
|
|
293
|
+
minWidth: 10
|
|
241
294
|
};
|
|
242
295
|
}, [columns]),
|
|
243
296
|
resizableColumns = _useAntdColumnResize.resizableColumns,
|
|
244
297
|
resizeComponents = _useAntdColumnResize.components,
|
|
245
298
|
tableWidth = _useAntdColumnResize.tableWidth,
|
|
246
299
|
resetColumns = _useAntdColumnResize.resetColumns;
|
|
300
|
+
|
|
301
|
+
// const _columns = useMemo(() => {
|
|
302
|
+
// let result = [];
|
|
303
|
+
// if (!showTable) {
|
|
304
|
+
// result = []
|
|
305
|
+
// } else if (isDragRef) {
|
|
306
|
+
// result = resizableColumns
|
|
307
|
+
// } else {
|
|
308
|
+
// result = columns
|
|
309
|
+
// }
|
|
310
|
+
// let flag = false;
|
|
311
|
+
// result?.map((v) => {
|
|
312
|
+
// if (columnsMap[v.key].width !== v.width) {
|
|
313
|
+
// flag = true;
|
|
314
|
+
// columnsMap[v.key] = {
|
|
315
|
+
// ...columnsMap[v.key],
|
|
316
|
+
// width: v.width
|
|
317
|
+
// };
|
|
318
|
+
// }
|
|
319
|
+
// })
|
|
320
|
+
// if (flag) {
|
|
321
|
+
// counter.setColumnsMap(
|
|
322
|
+
// columnsMap
|
|
323
|
+
// )
|
|
324
|
+
// }
|
|
325
|
+
// return result;
|
|
326
|
+
|
|
327
|
+
// }, [isDragRef, resizableColumns, showTable, columns, columnsMap])
|
|
328
|
+
|
|
329
|
+
// 1. 先计算列配置
|
|
247
330
|
var _columns = useMemo(function () {
|
|
248
|
-
var _result;
|
|
249
331
|
var result = [];
|
|
250
332
|
if (!showTable) {
|
|
251
333
|
result = [];
|
|
@@ -254,24 +336,30 @@ function VtxTable(props) {
|
|
|
254
336
|
} else {
|
|
255
337
|
result = columns;
|
|
256
338
|
}
|
|
339
|
+
return result;
|
|
340
|
+
}, [isDragRef, resizableColumns, showTable, columns]);
|
|
341
|
+
|
|
342
|
+
// 2. 在 effect 中同步列宽到 columnsMap
|
|
343
|
+
useEffect(function () {
|
|
344
|
+
if (!showTable || !_columns.length) return;
|
|
257
345
|
var flag = false;
|
|
258
|
-
|
|
259
|
-
|
|
346
|
+
var newColumnsMap = _objectSpread({}, columnsMap); // 创建副本避免直接修改
|
|
347
|
+
|
|
348
|
+
_columns.forEach(function (v) {
|
|
349
|
+
var _columnsMap$v$key;
|
|
350
|
+
if (((_columnsMap$v$key = columnsMap[v.key]) === null || _columnsMap$v$key === void 0 ? void 0 : _columnsMap$v$key.width) !== v.width) {
|
|
260
351
|
flag = true;
|
|
261
|
-
|
|
352
|
+
newColumnsMap[v.key] = _objectSpread(_objectSpread({}, newColumnsMap[v.key]), {}, {
|
|
353
|
+
width: v.width
|
|
354
|
+
});
|
|
262
355
|
}
|
|
263
356
|
});
|
|
264
357
|
if (flag) {
|
|
265
|
-
counter.setColumnsMap(
|
|
358
|
+
counter.setColumnsMap(newColumnsMap);
|
|
266
359
|
}
|
|
267
|
-
|
|
268
|
-
}, [isDragRef, resizableColumns, showTable, columns, columnsMap]);
|
|
360
|
+
}, [_columns, columnsMap, counter, showTable]);
|
|
269
361
|
var _components = useMemo(function () {
|
|
270
|
-
|
|
271
|
-
return resizeComponents;
|
|
272
|
-
} else {
|
|
273
|
-
return components;
|
|
274
|
-
}
|
|
362
|
+
return mergeComponentsForResize(components, resizeComponents, isDragRef);
|
|
275
363
|
}, [isDragRef, resizeComponents, components]);
|
|
276
364
|
|
|
277
365
|
// 工具栏
|
|
@@ -281,6 +369,7 @@ function VtxTable(props) {
|
|
|
281
369
|
toolbarTilte: toolbarTilte,
|
|
282
370
|
buttonGroup: buttonGroup,
|
|
283
371
|
refreshIconVisible: refreshIconVisible,
|
|
372
|
+
fullScreenVisible: fullScreenVisible,
|
|
284
373
|
hideColumnHeight: hideColumnHeight,
|
|
285
374
|
hideColumnSetting: hideColumnSetting,
|
|
286
375
|
onRefresh: onRefresh,
|
|
@@ -293,20 +382,24 @@ function VtxTable(props) {
|
|
|
293
382
|
}) : null;
|
|
294
383
|
return wrapSSR( /*#__PURE__*/_jsxs("div", {
|
|
295
384
|
id: datagridId,
|
|
296
|
-
className: classnames(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),
|
|
385
|
+
className: classnames(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),
|
|
297
386
|
ref: rootDomRef,
|
|
298
387
|
style: style,
|
|
299
388
|
children: [toolbarRender, alertRender, /*#__PURE__*/_jsx(Table, _objectSpread(_objectSpread({
|
|
300
389
|
size: counter.tableSize,
|
|
301
390
|
bordered: true
|
|
391
|
+
// virtual
|
|
302
392
|
}, rest), {}, {
|
|
303
393
|
dataSource: dataSource,
|
|
304
394
|
scroll: _objectSpread({
|
|
305
395
|
x: 'max-content'
|
|
306
396
|
}, scroll),
|
|
307
397
|
pagination: getPagination(rest.pagination),
|
|
308
|
-
|
|
309
|
-
|
|
398
|
+
xs: true,
|
|
399
|
+
styles: {
|
|
400
|
+
root: {
|
|
401
|
+
height: "calc(100% - ".concat(toolbarHeight.current + alertHeight.current, "px)")
|
|
402
|
+
}
|
|
310
403
|
},
|
|
311
404
|
locale: _objectSpread({
|
|
312
405
|
emptyText: /*#__PURE__*/_jsx(Empty, {
|
|
@@ -315,6 +408,9 @@ function VtxTable(props) {
|
|
|
315
408
|
}, rest.locale),
|
|
316
409
|
components: _components,
|
|
317
410
|
columns: _columns
|
|
411
|
+
// tableLayout={'auto'}
|
|
412
|
+
,
|
|
413
|
+
tableLayout: "fixed"
|
|
318
414
|
}))]
|
|
319
415
|
}));
|
|
320
416
|
}
|
|
@@ -333,6 +429,7 @@ export default VtxDatagrid;
|
|
|
333
429
|
VtxDatagrid.propTypes = {
|
|
334
430
|
prefix: PropTypes.string,
|
|
335
431
|
refreshIconVisible: PropTypes.bool,
|
|
432
|
+
fullScreenVisible: PropTypes.bool,
|
|
336
433
|
hideColumnSetting: PropTypes.bool,
|
|
337
434
|
hideSelectionClear: PropTypes.bool,
|
|
338
435
|
hideColumnHeight: PropTypes.bool,
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
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; }
|
|
3
|
+
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; }
|
|
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
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
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
|
+
export function mergeComponentsForResize(components, resizeComponents, isDragRef) {
|
|
8
|
+
if (!isDragRef) {
|
|
9
|
+
return components;
|
|
10
|
+
}
|
|
11
|
+
return _objectSpread(_objectSpread(_objectSpread({}, resizeComponents || {}), components || {}), {}, {
|
|
12
|
+
header: _objectSpread(_objectSpread({}, (components === null || components === void 0 ? void 0 : components.header) || {}), (resizeComponents === null || resizeComponents === void 0 ? void 0 : resizeComponents.header) || {}),
|
|
13
|
+
body: _objectSpread(_objectSpread({}, (resizeComponents === null || resizeComponents === void 0 ? void 0 : resizeComponents.body) || {}), (components === null || components === void 0 ? void 0 : components.body) || {})
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -1,5 +1,12 @@
|
|
|
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 = ["confirm"]
|
|
2
|
+
var _excluded = ["confirm"],
|
|
3
|
+
_excluded2 = ["confirm"];
|
|
4
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
|
+
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."); }
|
|
6
|
+
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); }
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
9
|
+
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; }
|
|
3
10
|
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
11
|
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
12
|
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; }
|
|
@@ -7,12 +14,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
7
14
|
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); }
|
|
8
15
|
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; }
|
|
9
16
|
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; }
|
|
10
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
11
|
-
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."); }
|
|
12
|
-
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); }
|
|
13
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
14
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
15
|
-
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; }
|
|
16
17
|
import { DownOutlined } from '@ant-design/icons';
|
|
17
18
|
import { Divider, Dropdown, Popconfirm } from 'antd';
|
|
18
19
|
import Icon from "../vtx-icon";
|
|
@@ -45,14 +46,32 @@ var renderColumnButtons = function renderColumnButtons(_ref) {
|
|
|
45
46
|
/* eslint-disable */
|
|
46
47
|
moreRender = /*#__PURE__*/_jsx(Dropdown, {
|
|
47
48
|
menu: {
|
|
48
|
-
items: (moreActions === null || moreActions === void 0 ? void 0 : moreActions.map(function (item,
|
|
49
|
+
items: (moreActions === null || moreActions === void 0 ? void 0 : moreActions.map(function (item, index) {
|
|
50
|
+
var name = item.name,
|
|
51
|
+
popconfirm = item.popconfirm;
|
|
52
|
+
if (popconfirm) {
|
|
53
|
+
var confirm = popconfirm.confirm,
|
|
54
|
+
rest = _objectWithoutProperties(popconfirm, _excluded);
|
|
55
|
+
return {
|
|
56
|
+
key: index,
|
|
57
|
+
label: /*#__PURE__*/_jsx(Popconfirm, _objectSpread(_objectSpread({
|
|
58
|
+
trigger: ['hover'],
|
|
59
|
+
onConfirm: confirm ? function () {
|
|
60
|
+
return confirm(record, index);
|
|
61
|
+
} : undefined
|
|
62
|
+
}, rest), {}, {
|
|
63
|
+
children: name
|
|
64
|
+
}))
|
|
65
|
+
};
|
|
66
|
+
}
|
|
49
67
|
return {
|
|
50
|
-
key:
|
|
68
|
+
key: index,
|
|
51
69
|
label: item.name
|
|
52
70
|
};
|
|
53
71
|
})) || [],
|
|
54
72
|
onClick: function onClick(e) {
|
|
55
|
-
|
|
73
|
+
var _moreActions$e$key, _moreActions$e$key$on;
|
|
74
|
+
(_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);
|
|
56
75
|
}
|
|
57
76
|
},
|
|
58
77
|
children: /*#__PURE__*/_jsxs("a", {
|
|
@@ -82,7 +101,7 @@ var renderColumnButtons = function renderColumnButtons(_ref) {
|
|
|
82
101
|
}, name);
|
|
83
102
|
if (popconfirm) {
|
|
84
103
|
var confirm = popconfirm.confirm,
|
|
85
|
-
rest = _objectWithoutProperties(popconfirm,
|
|
104
|
+
rest = _objectWithoutProperties(popconfirm, _excluded2);
|
|
86
105
|
btnNode = /*#__PURE__*/_createElement(Popconfirm, _objectSpread(_objectSpread({}, rest), {}, {
|
|
87
106
|
onConfirm: confirm ? function () {
|
|
88
107
|
return confirm(record, index);
|