@zykj2024/much-library 1.0.11 → 1.0.12-beta.10
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/dist/McContainer/demo/actionBar.d.ts +1 -1
- package/dist/McContainer/demo/actionBar.js +58 -10
- package/dist/McContainer/demo/batch.d.ts +1 -1
- package/dist/McContainer/demo/batch.js +70 -30
- package/dist/McContainer/demo/standard.js +1 -2
- package/dist/McContainer/index.css +9 -8
- package/dist/McContainer/index.d.ts +29 -4
- package/dist/McContainer/index.js +97 -29
- package/dist/McDateRange/index.d.ts +1 -1
- package/dist/McDateRange/index.js +1 -1
- package/dist/McEllipsisMiddle/demo/base.d.ts +6 -0
- package/dist/McEllipsisMiddle/demo/base.js +25 -0
- package/dist/McEllipsisMiddle/index.css +4 -0
- package/dist/McEllipsisMiddle/index.d.ts +11 -0
- package/dist/McEllipsisMiddle/index.js +32 -0
- package/dist/McGroupPanel/comps/SelectedItem/index.js +2 -3
- package/dist/McGroupPanel/index.css +12 -10
- package/dist/McGroupPanel/index.js +34 -34
- package/dist/McInput/index.css +27 -0
- package/dist/McInputNumber/demo/index.js +6 -0
- package/dist/McInputNumber/index.css +27 -0
- package/dist/McSelect/components/PanelSearchInput/index.css +6 -0
- package/dist/McSelect/components/PanelSearchInput/index.d.ts +12 -0
- package/dist/McSelect/components/PanelSearchInput/index.js +45 -0
- package/dist/McSelect/demo/fetchOptions.js +1 -0
- package/dist/McSelect/demo/panelInSearch.d.ts +2 -0
- package/dist/McSelect/demo/panelInSearch.js +47 -0
- package/dist/McSelect/index.d.ts +7 -0
- package/dist/McSelect/index.js +94 -10
- package/dist/McThemeConfig/demo/card.d.ts +2 -0
- package/dist/McThemeConfig/demo/card.js +60 -0
- package/dist/McThemeConfig/globalStyle.js +9 -1
- package/dist/McThemeConfig/layoutStyle.d.ts +1 -1
- package/dist/McThemeConfig/layoutStyle.js +1 -1
- package/dist/McThemeConfig/provider.d.ts +1 -0
- package/dist/McThemeConfig/provider.js +1 -0
- package/dist/McThemeConfig/themeToken.json +7 -4
- package/dist/Styles/demo/basic.d.ts +2 -0
- package/dist/Styles/demo/basic.js +44 -0
- package/dist/Styles/demo/delete-icon.d.ts +2 -0
- package/dist/Styles/demo/delete-icon.js +72 -0
- package/dist/Styles/demo/form-bottom-0.d.ts +2 -0
- package/dist/Styles/demo/form-bottom-0.js +33 -0
- package/dist/Styles/index.css +41 -0
- package/dist/Styles/mixins.css +2 -0
- package/dist/Styles/utilities.css +41 -0
- package/dist/index.d.ts +12 -6
- package/dist/index.js +12 -6
- package/package.json +6 -1
@@ -1,17 +1,21 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
1
2
|
/**
|
2
3
|
* title: 操作栏区域
|
3
|
-
* description:
|
4
|
+
* description: 若未设置该项,则不显示。`actionBarRender` 可自定义操作栏区域,提供批量操作按钮实例
|
4
5
|
* transform: true
|
5
6
|
* compact: true
|
6
7
|
*/
|
7
8
|
|
8
|
-
import {
|
9
|
+
import { useToggle } from "../../../packages/hooks/src";
|
10
|
+
import { Button, Space, Switch } from 'antd';
|
9
11
|
import { AddOutlined } from 'much-icons';
|
10
12
|
import { McContainer, McInput } from "../..";
|
13
|
+
import { useState } from 'react';
|
11
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
12
15
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
13
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
14
17
|
export default (function () {
|
18
|
+
var _selectedRows$length;
|
15
19
|
var dataSource = Array.from({
|
16
20
|
length: 5
|
17
21
|
}, function (_, index) {
|
@@ -21,6 +25,14 @@ export default (function () {
|
|
21
25
|
age: 18 + index
|
22
26
|
};
|
23
27
|
});
|
28
|
+
var _useState = useState([]),
|
29
|
+
_useState2 = _slicedToArray(_useState, 2),
|
30
|
+
selectedRows = _useState2[0],
|
31
|
+
setSelectedRows = _useState2[1];
|
32
|
+
var _useToggle = useToggle(false),
|
33
|
+
_useToggle2 = _slicedToArray(_useToggle, 2),
|
34
|
+
showCustomActionBar = _useToggle2[0],
|
35
|
+
toggle = _useToggle2[1].toggle;
|
24
36
|
var columns = [{
|
25
37
|
title: 'ID',
|
26
38
|
dataIndex: 'id'
|
@@ -58,13 +70,49 @@ export default (function () {
|
|
58
70
|
children: "\u4E0A\u4F20"
|
59
71
|
})]
|
60
72
|
});
|
61
|
-
return /*#__PURE__*/
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
73
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
74
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
75
|
+
style: {
|
76
|
+
padding: '24px 24px 0'
|
77
|
+
},
|
78
|
+
children: ["\u662F\u5426\u81EA\u5B9A\u4E49\u6E32\u67D3\u64CD\u4F5C\u533A\uFF1A", /*#__PURE__*/_jsx(Switch, {
|
79
|
+
checked: showCustomActionBar,
|
80
|
+
onChange: toggle
|
81
|
+
})]
|
82
|
+
}), /*#__PURE__*/_jsx(McContainer, {
|
83
|
+
height: "100%",
|
84
|
+
queryItems: queryItems,
|
85
|
+
actionBar: actionBar,
|
86
|
+
actionBarRender: showCustomActionBar ? function (batchEl) {
|
87
|
+
return /*#__PURE__*/_jsxs(Space, {
|
88
|
+
size: 16,
|
89
|
+
style: {
|
90
|
+
marginBottom: 16
|
91
|
+
},
|
92
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
93
|
+
type: "primary",
|
94
|
+
children: "\u4E0B\u8F7D"
|
95
|
+
}), batchEl]
|
96
|
+
});
|
97
|
+
} : undefined,
|
98
|
+
batchNum: (_selectedRows$length = selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.length) !== null && _selectedRows$length !== void 0 ? _selectedRows$length : 0,
|
99
|
+
onCancel: function onCancel() {
|
100
|
+
return setSelectedRows([]);
|
101
|
+
},
|
102
|
+
tableProps: {
|
103
|
+
columns: columns,
|
104
|
+
dataSource: dataSource,
|
105
|
+
rowKey: 'id',
|
106
|
+
rowSelection: {
|
107
|
+
selectedRowKeys: selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.map(function (item) {
|
108
|
+
return item.id;
|
109
|
+
}),
|
110
|
+
preserveSelectedRowKeys: true,
|
111
|
+
onChange: function onChange(selectedRowKeys, selectedRows) {
|
112
|
+
return setSelectedRows(selectedRows);
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
})]
|
69
117
|
});
|
70
118
|
});
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
2
|
* title: 预设批量操作
|
3
|
-
* description: 包括多选数据的处理、展示、批量操作区,开启多选功能时,在`tableProps`中进行多选的配置,`rowKey`必须设置且唯一。`batchNum`展示批量操作数、`batchBtns`配置批量操作区、`onCancel
|
3
|
+
* description: 包括多选数据的处理、展示、批量操作区,开启多选功能时,在`tableProps`中进行多选的配置,`rowKey`必须设置且唯一。`batchNum`展示批量操作数、`batchBtns`配置批量操作区、`onCancel`取消批量选中,配合实现多选功能。设置`batch`参数时,注意`actionBar`要为合法的React节点,如`<Button>操作1</Button>`、`<>只需要字符串的场景</>`,设置`batch.show`为`true`显示批量操作按钮,设置`batch.order`可以调整批量操作按钮的位置
|
4
4
|
* transform: true
|
5
5
|
* compact: true
|
6
6
|
*/
|
@@ -1,13 +1,14 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
2
|
/**
|
3
3
|
* title: 预设批量操作
|
4
|
-
* description: 包括多选数据的处理、展示、批量操作区,开启多选功能时,在`tableProps`中进行多选的配置,`rowKey`必须设置且唯一。`batchNum`展示批量操作数、`batchBtns`配置批量操作区、`onCancel
|
4
|
+
* description: 包括多选数据的处理、展示、批量操作区,开启多选功能时,在`tableProps`中进行多选的配置,`rowKey`必须设置且唯一。`batchNum`展示批量操作数、`batchBtns`配置批量操作区、`onCancel`取消批量选中,配合实现多选功能。设置`batch`参数时,注意`actionBar`要为合法的React节点,如`<Button>操作1</Button>`、`<>只需要字符串的场景</>`,设置`batch.show`为`true`显示批量操作按钮,设置`batch.order`可以调整批量操作按钮的位置
|
5
5
|
* transform: true
|
6
6
|
* compact: true
|
7
7
|
*/
|
8
8
|
|
9
|
-
import {
|
10
|
-
import {
|
9
|
+
import { useToggle } from "../../../packages/hooks/src";
|
10
|
+
import { Button, Switch } from 'antd';
|
11
|
+
import { McContainer, McInput, McInputNumber } from "../..";
|
11
12
|
import { useState } from 'react';
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
13
14
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
@@ -27,6 +28,14 @@ export default (function () {
|
|
27
28
|
age: 18 + index
|
28
29
|
};
|
29
30
|
});
|
31
|
+
var _useToggle = useToggle(true),
|
32
|
+
_useToggle2 = _slicedToArray(_useToggle, 2),
|
33
|
+
showBatchBtn = _useToggle2[0],
|
34
|
+
toggle = _useToggle2[1].toggle;
|
35
|
+
var _useState3 = useState(),
|
36
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
37
|
+
batchBtnOrder = _useState4[0],
|
38
|
+
setBatchBtnOrder = _useState4[1];
|
30
39
|
var columns = [{
|
31
40
|
title: 'ID',
|
32
41
|
dataIndex: 'id'
|
@@ -55,35 +64,66 @@ export default (function () {
|
|
55
64
|
}
|
56
65
|
})
|
57
66
|
});
|
58
|
-
return /*#__PURE__*/
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
67
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
68
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
69
|
+
style: {
|
70
|
+
padding: 24
|
71
|
+
},
|
72
|
+
children: ["\u662F\u5426\u5C55\u793A\u6279\u91CF\u64CD\u4F5C\u6309\u94AE\uFF1A", /*#__PURE__*/_jsx(Switch, {
|
73
|
+
checked: showBatchBtn,
|
74
|
+
onChange: toggle
|
75
|
+
})]
|
76
|
+
}), /*#__PURE__*/_jsxs("div", {
|
77
|
+
style: {
|
78
|
+
padding: '0 0 24px 24px'
|
79
|
+
},
|
80
|
+
children: ["\u6279\u91CF\u64CD\u4F5C\u6309\u94AE\u4F4D\u7F6E\uFF1A", /*#__PURE__*/_jsx(McInputNumber, {
|
81
|
+
value: batchBtnOrder,
|
82
|
+
onChange: setBatchBtnOrder
|
72
83
|
})]
|
73
|
-
}),
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
84
|
+
}), /*#__PURE__*/_jsx(McContainer, {
|
85
|
+
height: "100%",
|
86
|
+
queryItems: queryItems,
|
87
|
+
batchNum: (_selectedRows$length = selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.length) !== null && _selectedRows$length !== void 0 ? _selectedRows$length : 0,
|
88
|
+
onCancel: function onCancel() {
|
89
|
+
return setSelectedRows([]);
|
90
|
+
},
|
91
|
+
actionBar: /*#__PURE__*/_jsxs(_Fragment, {
|
92
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
93
|
+
type: "primary",
|
94
|
+
children: "\u64CD\u4F5C1"
|
95
|
+
}), /*#__PURE__*/_jsx(Button, {
|
96
|
+
type: "primary",
|
97
|
+
children: "\u64CD\u4F5C2"
|
98
|
+
})]
|
99
|
+
}),
|
100
|
+
batchBtns: /*#__PURE__*/_jsxs(_Fragment, {
|
101
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
102
|
+
type: "primary",
|
103
|
+
children: "\u6279\u91CF\u64CD\u4F5C1"
|
104
|
+
}), /*#__PURE__*/_jsx(Button, {
|
105
|
+
type: "primary",
|
106
|
+
children: "\u6279\u91CF\u64CD\u4F5C2"
|
107
|
+
})]
|
108
|
+
}),
|
109
|
+
batch: {
|
110
|
+
show: showBatchBtn,
|
111
|
+
order: batchBtnOrder
|
112
|
+
},
|
113
|
+
tableProps: {
|
114
|
+
columns: columns,
|
115
|
+
dataSource: dataSource,
|
116
|
+
rowKey: 'id',
|
117
|
+
rowSelection: {
|
118
|
+
selectedRowKeys: selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.map(function (item) {
|
119
|
+
return item.id;
|
120
|
+
}),
|
121
|
+
preserveSelectedRowKeys: true,
|
122
|
+
onChange: function onChange(selectedRowKeys, selectedRows) {
|
123
|
+
return setSelectedRows(selectedRows);
|
124
|
+
}
|
85
125
|
}
|
86
126
|
}
|
87
|
-
}
|
127
|
+
})]
|
88
128
|
});
|
89
129
|
});
|
@@ -24,7 +24,6 @@ var tableData = Array.from({
|
|
24
24
|
};
|
25
25
|
});
|
26
26
|
export default (function () {
|
27
|
-
var _selectedRows$length;
|
28
27
|
var mcContainerRef = useRef();
|
29
28
|
var _useState = useState(0),
|
30
29
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -138,7 +137,7 @@ export default (function () {
|
|
138
137
|
icon: /*#__PURE__*/_jsx(AddOutlined, {}),
|
139
138
|
children: "\u65B0\u589E"
|
140
139
|
}),
|
141
|
-
batchNum:
|
140
|
+
batchNum: selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.length,
|
142
141
|
onCancel: function onCancel() {
|
143
142
|
return setSelectedRows([]);
|
144
143
|
},
|
@@ -2,17 +2,18 @@
|
|
2
2
|
position: relative;
|
3
3
|
}
|
4
4
|
.mc-container__ceiling {
|
5
|
-
width: calc(100% -
|
5
|
+
width: calc(100% - 40px);
|
6
6
|
height: 24px;
|
7
7
|
position: absolute;
|
8
8
|
top: 0;
|
9
|
-
left:
|
9
|
+
left: 16px;
|
10
10
|
z-index: 9;
|
11
11
|
}
|
12
12
|
.mc-container__wrapper {
|
13
13
|
height: 100%;
|
14
|
-
padding: 24px 24px
|
15
|
-
overflow: auto;
|
14
|
+
padding: 24px 24px 50px 16px;
|
15
|
+
overflow-y: auto;
|
16
|
+
border-top-right-radius: 12px;
|
16
17
|
}
|
17
18
|
.mc-container__query {
|
18
19
|
display: -webkit-box;
|
@@ -27,7 +28,7 @@
|
|
27
28
|
.mc-container__query .mc-select,
|
28
29
|
.mc-container__query .mc-cascader,
|
29
30
|
.mc-container__query .mc-input-number {
|
30
|
-
width:
|
31
|
+
width: 270px;
|
31
32
|
}
|
32
33
|
.mc-container__query .mc-date-range {
|
33
34
|
width: 330px;
|
@@ -113,11 +114,11 @@
|
|
113
114
|
transition: all 0.3s;
|
114
115
|
}
|
115
116
|
.mc-container__pagination {
|
116
|
-
padding:
|
117
|
+
padding: 8px 0 16px;
|
117
118
|
margin: 0 !important;
|
118
|
-
width: calc(100% -
|
119
|
+
width: calc(100% - 40px);
|
119
120
|
position: absolute;
|
120
|
-
left:
|
121
|
+
left: 16px;
|
121
122
|
bottom: 0;
|
122
123
|
z-index: 9;
|
123
124
|
}
|
@@ -1,11 +1,15 @@
|
|
1
|
-
import { TableProps } from 'antd';
|
1
|
+
import { ButtonProps, TableProps } from 'antd';
|
2
2
|
import { CSSProperties, FC, ReactElement, ReactNode } from 'react';
|
3
3
|
import './index.less';
|
4
|
-
export type
|
4
|
+
export type McContainerPropsType = {
|
5
5
|
style?: CSSProperties;
|
6
6
|
className?: string;
|
7
7
|
height?: string;
|
8
8
|
backgroundColor?: string;
|
9
|
+
/**
|
10
|
+
* 是否展示头部遮罩,默认显示
|
11
|
+
*/
|
12
|
+
showCell?: boolean;
|
9
13
|
immediateQuery?: boolean;
|
10
14
|
loading?: boolean;
|
11
15
|
queryItems?: ReactElement;
|
@@ -24,12 +28,33 @@ export type PropsType = {
|
|
24
28
|
[key: string]: any;
|
25
29
|
}) => void;
|
26
30
|
queryRender?: ReactNode;
|
27
|
-
actionBar?:
|
31
|
+
actionBar?: ReactElement;
|
32
|
+
/**
|
33
|
+
* @description 操作栏自定义渲染
|
34
|
+
* @param batchEl - 批量操作按钮实例
|
35
|
+
* @returns 操作栏元素
|
36
|
+
*/
|
37
|
+
actionBarRender?: (batchEl: ReactNode) => ReactNode;
|
28
38
|
batchNum?: number;
|
29
39
|
batchBtns?: ReactNode;
|
40
|
+
/**
|
41
|
+
* @description 批量操作按钮配置
|
42
|
+
* @param show - 是否显示批量操作按钮(默认不显示 false)
|
43
|
+
* @param buttonText - 批量操作按钮文字
|
44
|
+
* @param buttonProps - 批量操作按钮属性
|
45
|
+
* @param order - 批量操作按钮在操作栏中的位置(默认为最后一个)
|
46
|
+
*/
|
47
|
+
batch?: {
|
48
|
+
show?: boolean;
|
49
|
+
buttonText?: string;
|
50
|
+
buttonProps?: ButtonProps;
|
51
|
+
order?: number;
|
52
|
+
};
|
30
53
|
onCancel?: () => void;
|
31
54
|
tableProps?: TableProps<any>;
|
32
55
|
tableRender?: ReactNode;
|
56
|
+
/** 折叠事件的回调 */
|
57
|
+
onCollapse?: (v: boolean) => void;
|
33
58
|
[key: string]: any;
|
34
59
|
};
|
35
60
|
export type McContainerRef = {
|
@@ -45,5 +70,5 @@ export type McContainerRef = {
|
|
45
70
|
getQueryParams: () => any;
|
46
71
|
resetQueryParams: () => void;
|
47
72
|
};
|
48
|
-
declare const McContainer: FC<
|
73
|
+
declare const McContainer: FC<McContainerPropsType>;
|
49
74
|
export default McContainer;
|
@@ -2,10 +2,12 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
4
4
|
import { Button, Spin, Table } from 'antd';
|
5
|
+
import { isNumber } from 'lodash';
|
5
6
|
import { CaretDownFilled, DoubleLeftOutlined } from 'much-icons';
|
6
|
-
import { Children, cloneElement, forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
7
|
+
import { Children, cloneElement, forwardRef, isValidElement, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
7
8
|
import "./index.css";
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
10
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
9
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
12
|
var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
11
13
|
var _tableProps$dataSourc;
|
@@ -15,6 +17,8 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
15
17
|
height = _props$height === void 0 ? 'calc(100vh - 88px)' : _props$height,
|
16
18
|
_props$backgroundColo = props.backgroundColor,
|
17
19
|
backgroundColor = _props$backgroundColo === void 0 ? '#ffffff' : _props$backgroundColo,
|
20
|
+
_props$showCell = props.showCell,
|
21
|
+
showCell = _props$showCell === void 0 ? true : _props$showCell,
|
18
22
|
_props$immediateQuery = props.immediateQuery,
|
19
23
|
immediateQuery = _props$immediateQuery === void 0 ? true : _props$immediateQuery,
|
20
24
|
_props$loading = props.loading,
|
@@ -34,9 +38,12 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
34
38
|
_props$batchNum = props.batchNum,
|
35
39
|
batchNum = _props$batchNum === void 0 ? 0 : _props$batchNum,
|
36
40
|
batchBtns = props.batchBtns,
|
41
|
+
batch = props.batch,
|
42
|
+
actionBarRender = props.actionBarRender,
|
37
43
|
onCancel = props.onCancel,
|
38
44
|
tableProps = props.tableProps,
|
39
|
-
tableRender = props.tableRender
|
45
|
+
tableRender = props.tableRender,
|
46
|
+
onCollapse = props.onCollapse;
|
40
47
|
var _useState = useState(false),
|
41
48
|
_useState2 = _slicedToArray(_useState, 2),
|
42
49
|
collapse = _useState2[0],
|
@@ -50,12 +57,25 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
50
57
|
var defaultQueryParamsRef = useRef({});
|
51
58
|
var initializedRef = useRef(false);
|
52
59
|
|
60
|
+
/* 批量操作相关 */
|
61
|
+
var _ref = batch || {},
|
62
|
+
_ref$buttonText = _ref.buttonText,
|
63
|
+
buttonText = _ref$buttonText === void 0 ? '批量操作' : _ref$buttonText,
|
64
|
+
buttonProps = _ref.buttonProps,
|
65
|
+
_ref$show = _ref.show,
|
66
|
+
batchShow = _ref$show === void 0 ? false : _ref$show,
|
67
|
+
batchOrder = _ref.order;
|
68
|
+
var _useState5 = useState(false),
|
69
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
70
|
+
showBatchBar = _useState6[0],
|
71
|
+
setShowBatchBar = _useState6[1];
|
72
|
+
|
53
73
|
/* 获取actionBar高度 */
|
54
74
|
var actionBarRef = useRef();
|
55
|
-
var
|
56
|
-
|
57
|
-
actionBarHeight =
|
58
|
-
setActionBarHeight =
|
75
|
+
var _useState7 = useState(0),
|
76
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
77
|
+
actionBarHeight = _useState8[0],
|
78
|
+
setActionBarHeight = _useState8[1];
|
59
79
|
var actionBarResizeObserver = new ResizeObserver(function (entries) {
|
60
80
|
setActionBarHeight(entries[0].contentRect.height + 40);
|
61
81
|
});
|
@@ -67,6 +87,9 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
67
87
|
return actionBarResizeObserver.disconnect();
|
68
88
|
};
|
69
89
|
}, []);
|
90
|
+
useEffect(function () {
|
91
|
+
onCollapse === null || onCollapse === void 0 || onCollapse(collapse);
|
92
|
+
}, [collapse]);
|
70
93
|
|
71
94
|
// 为设置过name属性的查询项添加value属性和onChange事件,从而收集查询项的值(查询项自身已绑定value属性的除外,需自行编写相关业务逻辑代码进行状态管理)
|
72
95
|
var mapQuerys = function mapQuerys(items) {
|
@@ -102,6 +125,45 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
102
125
|
return ELs;
|
103
126
|
};
|
104
127
|
|
128
|
+
// 批量操作按钮
|
129
|
+
var handelBatchClick = function handelBatchClick() {
|
130
|
+
if (showBatchBar) {
|
131
|
+
onCancel === null || onCancel === void 0 || onCancel();
|
132
|
+
}
|
133
|
+
setShowBatchBar(!showBatchBar);
|
134
|
+
};
|
135
|
+
|
136
|
+
// 批量操作按钮
|
137
|
+
var batchEl = /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
|
138
|
+
onClick: handelBatchClick
|
139
|
+
}, buttonProps), {}, {
|
140
|
+
children: buttonText
|
141
|
+
}));
|
142
|
+
|
143
|
+
// 生成 actionBar
|
144
|
+
var mapActionBar = function mapActionBar() {
|
145
|
+
var Els;
|
146
|
+
// 是否展示批量操作按钮
|
147
|
+
if (batchShow) {
|
148
|
+
// 是否配置actionBar
|
149
|
+
if (actionBar) {
|
150
|
+
var _actionBar$props;
|
151
|
+
// 判断是否为合法的React节点
|
152
|
+
var itemsCount = /*#__PURE__*/isValidElement(actionBar) ? Children.count(actionBar === null || actionBar === void 0 || (_actionBar$props = actionBar.props) === null || _actionBar$props === void 0 ? void 0 : _actionBar$props.children) : 1;
|
153
|
+
var newEls = Children.toArray(itemsCount > 1 ? actionBar.props.children : actionBar);
|
154
|
+
var _batchOrder = isNumber(batchOrder) && batchOrder >= 0 && batchOrder <= itemsCount ? batchOrder : itemsCount;
|
155
|
+
// 插入批量操作按钮,默认放在actionBar操作项后面
|
156
|
+
newEls.splice(_batchOrder, 0, batchEl);
|
157
|
+
Els = /*#__PURE__*/cloneElement(itemsCount > 1 ? actionBar : /*#__PURE__*/_jsx(_Fragment, {}), {}, newEls);
|
158
|
+
} else {
|
159
|
+
Els = batchEl;
|
160
|
+
}
|
161
|
+
} else {
|
162
|
+
Els = actionBar;
|
163
|
+
}
|
164
|
+
return Els;
|
165
|
+
};
|
166
|
+
|
105
167
|
// 格式化查询参数(返回当前可见的查询项的参数集)
|
106
168
|
var formatQueryParams = function formatQueryParams() {
|
107
169
|
var _tableProps$paginatio;
|
@@ -132,10 +194,10 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
132
194
|
if (params) {
|
133
195
|
var _params = _objectSpread({}, queryParamsRef.current);
|
134
196
|
// 仅支持设置过name属性的查询项(和current、pageSize)
|
135
|
-
Object.entries(params).forEach(function (
|
136
|
-
var
|
137
|
-
key =
|
138
|
-
value =
|
197
|
+
Object.entries(params).forEach(function (_ref2) {
|
198
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
199
|
+
key = _ref3[0],
|
200
|
+
value = _ref3[1];
|
139
201
|
if (allNamesRef.current.includes(key)) {
|
140
202
|
_params[key] = value;
|
141
203
|
}
|
@@ -188,10 +250,10 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
188
250
|
return !allNamesRef.current.includes(k) && allNamesRef.current.push(k);
|
189
251
|
});
|
190
252
|
// 仅支持设置过name属性的查询项(和current、pageSize)
|
191
|
-
Object.entries(params).forEach(function (
|
192
|
-
var
|
193
|
-
key =
|
194
|
-
value =
|
253
|
+
Object.entries(params).forEach(function (_ref4) {
|
254
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
255
|
+
key = _ref5[0],
|
256
|
+
value = _ref5[1];
|
195
257
|
if (allNamesRef.current.includes(key)) {
|
196
258
|
_params[key] = value;
|
197
259
|
}
|
@@ -230,6 +292,9 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
230
292
|
queryParamsRef.current = _params;
|
231
293
|
setQueryParams(_params);
|
232
294
|
};
|
295
|
+
useEffect(function () {
|
296
|
+
setShowBatchBar(batchNum > 0);
|
297
|
+
}, [batchNum]);
|
233
298
|
|
234
299
|
// 监听immediateQuery,初始设置默认查询参数并判断是否触发首次查询
|
235
300
|
useEffect(function () {
|
@@ -265,7 +330,7 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
265
330
|
height: height,
|
266
331
|
backgroundColor: backgroundColor
|
267
332
|
}, style),
|
268
|
-
children: [/*#__PURE__*/_jsx("div", {
|
333
|
+
children: [showCell && /*#__PURE__*/_jsx("div", {
|
269
334
|
className: "mc-container__ceiling",
|
270
335
|
style: {
|
271
336
|
backgroundColor: backgroundColor
|
@@ -273,7 +338,7 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
273
338
|
}), /*#__PURE__*/_jsxs("div", {
|
274
339
|
className: "mc-container__wrapper",
|
275
340
|
style: {
|
276
|
-
paddingBottom: tableRender || tableRender === null || (tableProps === null || tableProps === void 0 ? void 0 : tableProps.pagination) === false ?
|
341
|
+
paddingBottom: tableRender || tableRender === null || (tableProps === null || tableProps === void 0 ? void 0 : tableProps.pagination) === false ? 16 : 50
|
277
342
|
},
|
278
343
|
children: [queryRender || queryRender === null ? queryRender : /*#__PURE__*/_jsxs("div", {
|
279
344
|
className: "mc-container__query",
|
@@ -300,7 +365,8 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
300
365
|
style: {
|
301
366
|
marginLeft: 16,
|
302
367
|
fontSize: 12,
|
303
|
-
padding: 0
|
368
|
+
padding: 0,
|
369
|
+
gap: 4
|
304
370
|
},
|
305
371
|
onClick: function onClick() {
|
306
372
|
return setCollapse(function (os) {
|
@@ -309,8 +375,7 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
309
375
|
},
|
310
376
|
children: [collapse ? '展开' : '收起', /*#__PURE__*/_jsx(DoubleLeftOutlined, {
|
311
377
|
style: {
|
312
|
-
fontSize: 12
|
313
|
-
marginLeft: 2
|
378
|
+
fontSize: 12
|
314
379
|
},
|
315
380
|
rotate: collapse ? -90 : 90
|
316
381
|
})]
|
@@ -318,14 +383,14 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
318
383
|
})]
|
319
384
|
}), queryRender !== null && /*#__PURE__*/_jsx("div", {
|
320
385
|
className: "mc-container__divider"
|
321
|
-
}), actionBar && /*#__PURE__*/_jsx("div", {
|
386
|
+
}), actionBarRender ? actionBarRender(batchEl) : (!!actionBar || !!batchShow) && /*#__PURE__*/_jsx("div", {
|
322
387
|
ref: actionBarRef,
|
323
388
|
className: "mc-container__action-bar",
|
324
389
|
style: {
|
325
390
|
backgroundColor: backgroundColor
|
326
391
|
},
|
327
|
-
children:
|
328
|
-
}),
|
392
|
+
children: mapActionBar()
|
393
|
+
}), showBatchBar && /*#__PURE__*/_jsx("div", {
|
329
394
|
className: "mc-container__batch-bar",
|
330
395
|
style: {
|
331
396
|
backgroundColor: backgroundColor,
|
@@ -343,7 +408,10 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
343
408
|
style: {
|
344
409
|
marginLeft: 'auto'
|
345
410
|
},
|
346
|
-
onClick:
|
411
|
+
onClick: function onClick() {
|
412
|
+
onCancel === null || onCancel === void 0 || onCancel();
|
413
|
+
setShowBatchBar(false);
|
414
|
+
},
|
347
415
|
children: "\u53D6\u6D88"
|
348
416
|
})]
|
349
417
|
})
|
@@ -373,13 +441,13 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
373
441
|
pageSize: queryParams.pageSize
|
374
442
|
}, tableProps === null || tableProps === void 0 ? void 0 : tableProps.pagination),
|
375
443
|
expandable: _objectSpread({
|
376
|
-
expandIcon: function expandIcon(
|
444
|
+
expandIcon: function expandIcon(_ref6) {
|
377
445
|
var _tableProps$dataSourc2, _record$children;
|
378
|
-
var expanded =
|
379
|
-
onExpand =
|
380
|
-
record =
|
381
|
-
return tableProps !== null && tableProps !== void 0 && (_tableProps$dataSourc2 = tableProps.dataSource) !== null && _tableProps$dataSourc2 !== void 0 && _tableProps$dataSourc2.some(function (
|
382
|
-
var children =
|
446
|
+
var expanded = _ref6.expanded,
|
447
|
+
onExpand = _ref6.onExpand,
|
448
|
+
record = _ref6.record;
|
449
|
+
return tableProps !== null && tableProps !== void 0 && (_tableProps$dataSourc2 = tableProps.dataSource) !== null && _tableProps$dataSourc2 !== void 0 && _tableProps$dataSourc2.some(function (_ref7) {
|
450
|
+
var children = _ref7.children;
|
383
451
|
return (children === null || children === void 0 ? void 0 : children.length) > 0;
|
384
452
|
}) ? ((_record$children = record.children) === null || _record$children === void 0 ? void 0 : _record$children.length) > 0 ? /*#__PURE__*/_jsx(CaretDownFilled, {
|
385
453
|
className: "mc-container__table__expand-icon",
|
@@ -10,7 +10,7 @@ declare const shortcutValueMap: {
|
|
10
10
|
last60days: string[];
|
11
11
|
last90days: string[];
|
12
12
|
};
|
13
|
-
export declare const
|
13
|
+
export declare const SHORTCUT_VALUE_MAP: typeof shortcutValueMap & {
|
14
14
|
[key: string]: any;
|
15
15
|
};
|
16
16
|
export type McDateRangeProps = Omit<RangePickerProps, 'value' | 'onChange'> & {
|
@@ -18,7 +18,7 @@ var shortcutValueMap = {
|
|
18
18
|
last60days: [dayjs().add(-59, 'd').format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')],
|
19
19
|
last90days: [dayjs().add(-89, 'd').format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')]
|
20
20
|
};
|
21
|
-
export var
|
21
|
+
export var SHORTCUT_VALUE_MAP = shortcutValueMap;
|
22
22
|
var McDateRange = /*#__PURE__*/forwardRef(function (props, ref) {
|
23
23
|
var style = props.style,
|
24
24
|
className = props.className,
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/**
|
2
|
+
* title: 基础用法
|
3
|
+
* description: 中间省略号,超出时展示省略号,并且移入会有tooltip
|
4
|
+
*/
|
5
|
+
|
6
|
+
import { McEllipsisMiddle } from "../..";
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
|
+
export default (function () {
|
10
|
+
return /*#__PURE__*/_jsxs("div", {
|
11
|
+
children: [/*#__PURE__*/_jsx(McEllipsisMiddle, {
|
12
|
+
style: {
|
13
|
+
width: 250
|
14
|
+
},
|
15
|
+
text: "\u8FD9\u662F\u4E00\u6BB5\u6CA1\u6709\u6EA2\u51FA\u7684\u6587\u5B57",
|
16
|
+
suffixCount: 4
|
17
|
+
}), /*#__PURE__*/_jsx(McEllipsisMiddle, {
|
18
|
+
style: {
|
19
|
+
width: 250
|
20
|
+
},
|
21
|
+
text: "\u8FD9\u662F\u4E00\u6BB5\u6709\u6EA2\u51FA\u7684\u6587\u5B57\uFF0C\u8FD9\u662F\u4E00\u6BB5\u6709\u6EA2\u51FA\u7684\u6587\u5B57",
|
22
|
+
suffixCount: 4
|
23
|
+
})]
|
24
|
+
});
|
25
|
+
});
|