@zykj2024/much-library 1.0.12-beta.1 → 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.d.ts +21 -2
- package/dist/McContainer/index.js +85 -23
- 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 +2 -0
- package/dist/McInputNumber/demo/index.js +6 -0
- package/dist/McInputNumber/index.css +27 -0
- package/dist/McSelect/demo/panelInSearch.d.ts +2 -0
- package/dist/McSelect/demo/panelInSearch.js +47 -0
- package/dist/McThemeConfig/demo/card.d.ts +2 -0
- package/dist/McThemeConfig/demo/card.js +60 -0
- package/dist/McThemeConfig/globalStyle.js +1 -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 +5 -3
- 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 +1 -0
- package/dist/index.js +1 -0
- 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
|
},
|
@@ -1,4 +1,4 @@
|
|
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
4
|
export type McContainerPropsType = {
|
@@ -28,9 +28,28 @@ export type McContainerPropsType = {
|
|
28
28
|
[key: string]: any;
|
29
29
|
}) => void;
|
30
30
|
queryRender?: ReactNode;
|
31
|
-
actionBar?:
|
31
|
+
actionBar?: ReactElement;
|
32
|
+
/**
|
33
|
+
* @description 操作栏自定义渲染
|
34
|
+
* @param batchEl - 批量操作按钮实例
|
35
|
+
* @returns 操作栏元素
|
36
|
+
*/
|
37
|
+
actionBarRender?: (batchEl: ReactNode) => ReactNode;
|
32
38
|
batchNum?: number;
|
33
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
|
+
};
|
34
53
|
onCancel?: () => void;
|
35
54
|
tableProps?: TableProps<any>;
|
36
55
|
tableRender?: ReactNode;
|
@@ -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;
|
@@ -36,6 +38,8 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
36
38
|
_props$batchNum = props.batchNum,
|
37
39
|
batchNum = _props$batchNum === void 0 ? 0 : _props$batchNum,
|
38
40
|
batchBtns = props.batchBtns,
|
41
|
+
batch = props.batch,
|
42
|
+
actionBarRender = props.actionBarRender,
|
39
43
|
onCancel = props.onCancel,
|
40
44
|
tableProps = props.tableProps,
|
41
45
|
tableRender = props.tableRender,
|
@@ -53,12 +57,25 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
53
57
|
var defaultQueryParamsRef = useRef({});
|
54
58
|
var initializedRef = useRef(false);
|
55
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
|
+
|
56
73
|
/* 获取actionBar高度 */
|
57
74
|
var actionBarRef = useRef();
|
58
|
-
var
|
59
|
-
|
60
|
-
actionBarHeight =
|
61
|
-
setActionBarHeight =
|
75
|
+
var _useState7 = useState(0),
|
76
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
77
|
+
actionBarHeight = _useState8[0],
|
78
|
+
setActionBarHeight = _useState8[1];
|
62
79
|
var actionBarResizeObserver = new ResizeObserver(function (entries) {
|
63
80
|
setActionBarHeight(entries[0].contentRect.height + 40);
|
64
81
|
});
|
@@ -108,6 +125,45 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
108
125
|
return ELs;
|
109
126
|
};
|
110
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
|
+
|
111
167
|
// 格式化查询参数(返回当前可见的查询项的参数集)
|
112
168
|
var formatQueryParams = function formatQueryParams() {
|
113
169
|
var _tableProps$paginatio;
|
@@ -138,10 +194,10 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
138
194
|
if (params) {
|
139
195
|
var _params = _objectSpread({}, queryParamsRef.current);
|
140
196
|
// 仅支持设置过name属性的查询项(和current、pageSize)
|
141
|
-
Object.entries(params).forEach(function (
|
142
|
-
var
|
143
|
-
key =
|
144
|
-
value =
|
197
|
+
Object.entries(params).forEach(function (_ref2) {
|
198
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
199
|
+
key = _ref3[0],
|
200
|
+
value = _ref3[1];
|
145
201
|
if (allNamesRef.current.includes(key)) {
|
146
202
|
_params[key] = value;
|
147
203
|
}
|
@@ -194,10 +250,10 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
194
250
|
return !allNamesRef.current.includes(k) && allNamesRef.current.push(k);
|
195
251
|
});
|
196
252
|
// 仅支持设置过name属性的查询项(和current、pageSize)
|
197
|
-
Object.entries(params).forEach(function (
|
198
|
-
var
|
199
|
-
key =
|
200
|
-
value =
|
253
|
+
Object.entries(params).forEach(function (_ref4) {
|
254
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
255
|
+
key = _ref5[0],
|
256
|
+
value = _ref5[1];
|
201
257
|
if (allNamesRef.current.includes(key)) {
|
202
258
|
_params[key] = value;
|
203
259
|
}
|
@@ -236,6 +292,9 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
236
292
|
queryParamsRef.current = _params;
|
237
293
|
setQueryParams(_params);
|
238
294
|
};
|
295
|
+
useEffect(function () {
|
296
|
+
setShowBatchBar(batchNum > 0);
|
297
|
+
}, [batchNum]);
|
239
298
|
|
240
299
|
// 监听immediateQuery,初始设置默认查询参数并判断是否触发首次查询
|
241
300
|
useEffect(function () {
|
@@ -324,14 +383,14 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
324
383
|
})]
|
325
384
|
}), queryRender !== null && /*#__PURE__*/_jsx("div", {
|
326
385
|
className: "mc-container__divider"
|
327
|
-
}), actionBar && /*#__PURE__*/_jsx("div", {
|
386
|
+
}), actionBarRender ? actionBarRender(batchEl) : (!!actionBar || !!batchShow) && /*#__PURE__*/_jsx("div", {
|
328
387
|
ref: actionBarRef,
|
329
388
|
className: "mc-container__action-bar",
|
330
389
|
style: {
|
331
390
|
backgroundColor: backgroundColor
|
332
391
|
},
|
333
|
-
children:
|
334
|
-
}),
|
392
|
+
children: mapActionBar()
|
393
|
+
}), showBatchBar && /*#__PURE__*/_jsx("div", {
|
335
394
|
className: "mc-container__batch-bar",
|
336
395
|
style: {
|
337
396
|
backgroundColor: backgroundColor,
|
@@ -349,7 +408,10 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
349
408
|
style: {
|
350
409
|
marginLeft: 'auto'
|
351
410
|
},
|
352
|
-
onClick:
|
411
|
+
onClick: function onClick() {
|
412
|
+
onCancel === null || onCancel === void 0 || onCancel();
|
413
|
+
setShowBatchBar(false);
|
414
|
+
},
|
353
415
|
children: "\u53D6\u6D88"
|
354
416
|
})]
|
355
417
|
})
|
@@ -379,13 +441,13 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
379
441
|
pageSize: queryParams.pageSize
|
380
442
|
}, tableProps === null || tableProps === void 0 ? void 0 : tableProps.pagination),
|
381
443
|
expandable: _objectSpread({
|
382
|
-
expandIcon: function expandIcon(
|
444
|
+
expandIcon: function expandIcon(_ref6) {
|
383
445
|
var _tableProps$dataSourc2, _record$children;
|
384
|
-
var expanded =
|
385
|
-
onExpand =
|
386
|
-
record =
|
387
|
-
return tableProps !== null && tableProps !== void 0 && (_tableProps$dataSourc2 = tableProps.dataSource) !== null && _tableProps$dataSourc2 !== void 0 && _tableProps$dataSourc2.some(function (
|
388
|
-
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;
|
389
451
|
return (children === null || children === void 0 ? void 0 : children.length) > 0;
|
390
452
|
}) ? ((_record$children = record.children) === null || _record$children === void 0 ? void 0 : _record$children.length) > 0 ? /*#__PURE__*/_jsx(CaretDownFilled, {
|
391
453
|
className: "mc-container__table__expand-icon",
|
@@ -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
|
+
});
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { TextProps } from 'antd/es/typography/Text';
|
3
|
+
import './index.less';
|
4
|
+
export interface McEllipsisMiddleProps extends TextProps {
|
5
|
+
text: string;
|
6
|
+
/** 省略号结尾显示的字个数 */
|
7
|
+
suffixCount: number;
|
8
|
+
style?: React.CSSProperties;
|
9
|
+
className?: string;
|
10
|
+
}
|
11
|
+
export declare const McEllipsisMiddle: ({ text, suffixCount, style, className, ...rest }: McEllipsisMiddleProps) => import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
|
+
var _excluded = ["text", "suffixCount", "style", "className"];
|
4
|
+
import { Typography } from 'antd';
|
5
|
+
import "./index.css";
|
6
|
+
|
7
|
+
/** 中间省略 */
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
9
|
+
var Text = Typography.Text;
|
10
|
+
export var McEllipsisMiddle = function McEllipsisMiddle(_ref) {
|
11
|
+
var text = _ref.text,
|
12
|
+
suffixCount = _ref.suffixCount,
|
13
|
+
style = _ref.style,
|
14
|
+
className = _ref.className,
|
15
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
16
|
+
var labelStr = String(text || '').trim();
|
17
|
+
var isBeyond = labelStr.length > suffixCount;
|
18
|
+
var start = isBeyond ? labelStr.slice(0, labelStr.length - suffixCount) : labelStr;
|
19
|
+
var suffix = isBeyond ? labelStr.slice(-suffixCount).trim() : '';
|
20
|
+
return /*#__PURE__*/_jsx(Text, _objectSpread(_objectSpread({
|
21
|
+
className: ['mc-ellipsis-middle', className].filter(Boolean).join(''),
|
22
|
+
style: _objectSpread({
|
23
|
+
width: '100%'
|
24
|
+
}, style),
|
25
|
+
ellipsis: {
|
26
|
+
tooltip: labelStr,
|
27
|
+
suffix: suffix
|
28
|
+
}
|
29
|
+
}, rest), {}, {
|
30
|
+
children: start
|
31
|
+
}));
|
32
|
+
};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
2
|
import { useSortable } from '@dnd-kit/sortable';
|
3
3
|
import { Button, Typography } from 'antd';
|
4
|
+
import { MenuOutlined } from 'much-icons';
|
4
5
|
import { McIconFont } from "../../..";
|
5
6
|
import { memo, useMemo } from 'react';
|
6
7
|
import "../../index.css";
|
@@ -53,9 +54,7 @@ var SelectedItem = function SelectedItem(_ref) {
|
|
53
54
|
children: [sortable && /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({}, listeners), {}, {
|
54
55
|
className: "mc-group-panel__selected-item__drag",
|
55
56
|
type: "text",
|
56
|
-
icon: /*#__PURE__*/_jsx(
|
57
|
-
type: "icon-MenuOutlined"
|
58
|
-
})
|
57
|
+
icon: /*#__PURE__*/_jsx(MenuOutlined, {})
|
59
58
|
})), /*#__PURE__*/_jsx(Typography.Paragraph, {
|
60
59
|
style: {
|
61
60
|
margin: '0 auto 0 4px'
|
@@ -29,6 +29,7 @@
|
|
29
29
|
}
|
30
30
|
.mc-group-panel__card-body {
|
31
31
|
height: calc(100% - 40px);
|
32
|
+
overflow: auto;
|
32
33
|
padding: 8px;
|
33
34
|
}
|
34
35
|
.mc-group-panel__options {
|
@@ -49,6 +50,7 @@
|
|
49
50
|
-webkit-box-flex: 1;
|
50
51
|
-ms-flex: 1 1 44%;
|
51
52
|
flex: 1 1 44%;
|
53
|
+
overflow: auto;
|
52
54
|
}
|
53
55
|
.mc-group-panel__options-items {
|
54
56
|
-webkit-box-flex: 1;
|
@@ -65,23 +67,23 @@
|
|
65
67
|
padding: 0 8px;
|
66
68
|
}
|
67
69
|
.mc-group-panel__checkbox-wrapper {
|
68
|
-
width:
|
70
|
+
width: 100%;
|
69
71
|
height: 40px;
|
70
72
|
line-height: 40px;
|
71
73
|
padding: 0 12px;
|
74
|
+
display: -webkit-box;
|
75
|
+
display: -ms-flexbox;
|
76
|
+
display: flex;
|
77
|
+
-webkit-box-align: center;
|
78
|
+
-ms-flex-align: center;
|
79
|
+
align-items: center;
|
72
80
|
}
|
73
|
-
.mc-group-panel__checkbox-wrapper
|
74
|
-
max-width: 100%;
|
75
|
-
}
|
76
|
-
.mc-group-panel__checkbox-wrapper .ant-checkbox-wrapper .ant-checkbox + span {
|
77
|
-
overflow: hidden;
|
78
|
-
}
|
79
|
-
.mc-group-panel__checkbox-wrapper:not(:first-child):hover {
|
81
|
+
.mc-group-panel__checkbox-wrapper:not(.mc-group-panel__check-all):hover {
|
80
82
|
background: #f6f6f6;
|
81
83
|
cursor: pointer;
|
82
84
|
}
|
83
85
|
.mc-group-panel__checkbox {
|
84
|
-
width:
|
86
|
+
width: 100%;
|
85
87
|
height: 40px;
|
86
88
|
-webkit-box-align: center;
|
87
89
|
-ms-flex-align: center;
|
@@ -101,7 +103,7 @@
|
|
101
103
|
width: 240px;
|
102
104
|
}
|
103
105
|
.mc-group-panel__selected-item {
|
104
|
-
width:
|
106
|
+
width: 100%;
|
105
107
|
height: 40px;
|
106
108
|
display: -webkit-box;
|
107
109
|
display: -ms-flexbox;
|