@zykj2024/much-library 1.1.6-beta.1 → 1.1.7-beta.1
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/generic.d.ts +8 -0
- package/dist/McContainer/demo/generic.js +91 -0
- package/dist/McContainer/index.d.ts +147 -108
- package/dist/McContainer/index.js +16 -7
- package/dist/McEllipsis/demo/base.d.ts +6 -0
- package/dist/McEllipsis/demo/base.js +22 -0
- package/dist/McEllipsis/demo/middle.d.ts +6 -0
- package/dist/McEllipsis/demo/middle.js +24 -0
- package/dist/McEllipsis/demo/table.d.ts +5 -0
- package/dist/McEllipsis/demo/table.js +93 -0
- package/dist/McEllipsis/demo/tooltip-size.d.ts +6 -0
- package/dist/McEllipsis/demo/tooltip-size.js +20 -0
- package/dist/McEllipsis/demo/tooltip.d.ts +6 -0
- package/dist/McEllipsis/demo/tooltip.js +53 -0
- package/dist/McEllipsis/index.css +4 -0
- package/dist/McEllipsis/index.d.ts +40 -0
- package/dist/McEllipsis/index.js +115 -0
- package/dist/McGroupPanel/index.css +8 -3
- package/dist/McGroupPanel/index.d.ts +1 -0
- package/dist/McGroupPanel/index.js +156 -141
- package/dist/McInputNumber/index.d.ts +3 -0
- package/dist/McInputNumber/index.js +16 -9
- package/dist/McListSelect/comps/ListSelect.d.ts +67 -0
- package/dist/McListSelect/comps/ListSelect.js +289 -0
- package/dist/McListSelect/comps/ListSelectPanel.d.ts +138 -0
- package/dist/McListSelect/comps/ListSelectPanel.js +451 -0
- package/dist/McListSelect/comps/SelectedItem.d.ts +17 -0
- package/dist/McListSelect/comps/SelectedItem.js +76 -0
- package/dist/McListSelect/demo/base.d.ts +6 -0
- package/dist/McListSelect/demo/base.js +125 -0
- package/dist/McListSelect/demo/inexistent.d.ts +6 -0
- package/dist/McListSelect/demo/inexistent.js +111 -0
- package/dist/McListSelect/demo/layout.d.ts +6 -0
- package/dist/McListSelect/demo/layout.js +70 -0
- package/dist/McListSelect/demo/other.d.ts +6 -0
- package/dist/McListSelect/demo/other.js +68 -0
- package/dist/McListSelect/demo/panel-inexistent.d.ts +6 -0
- package/dist/McListSelect/demo/panel-inexistent.js +86 -0
- package/dist/McListSelect/index.css +273 -0
- package/dist/McListSelect/index.d.ts +10 -0
- package/dist/McListSelect/index.js +5 -0
- package/dist/McListSelect/mock/index.d.ts +1 -0
- package/dist/McListSelect/mock/index.js +27 -0
- package/dist/McModalProvider/index.d.ts +2 -2
- package/dist/McThemeConfig/layoutStyle.d.ts +1 -1
- package/dist/McThemeConfig/layoutStyle.js +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/package.json +3 -1
@@ -0,0 +1,53 @@
|
|
1
|
+
/**
|
2
|
+
* title: 自定义提示内容
|
3
|
+
* description: 设置 `tooltip` 或使用 `TooltipProps` 属性自定义提示内容<br>设置 `tooltip` 为 false 则不展示<br>设置 `alwaysTooltip` 为 true 则不省略也展示
|
4
|
+
*/
|
5
|
+
|
6
|
+
import { McEllipsis } from "../..";
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
9
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
|
+
export default (function () {
|
11
|
+
var longText = '一-二-三-四-五-六-七-八-九-十=壹-贰-叁-肆-伍-陆-柒-捌-玖-拾=yī-èr-sān-sì-wǔ-liù-qī-bā-jiǔ-shí=one-two-three-four-five-six-seven-eight-nine-ten';
|
12
|
+
return /*#__PURE__*/_jsxs("div", {
|
13
|
+
style: {
|
14
|
+
width: 240
|
15
|
+
},
|
16
|
+
children: [/*#__PURE__*/_jsx(McEllipsis, {
|
17
|
+
text: '提示与文字内容不同:' + longText,
|
18
|
+
tooltip: /*#__PURE__*/_jsxs(_Fragment, {
|
19
|
+
children: [/*#__PURE__*/_jsx("div", {
|
20
|
+
children: "\u81EA\u5B9A\u4E49\u63D0\u793A\u5185\u5BB9\uFF1A"
|
21
|
+
}), /*#__PURE__*/_jsx("div", {
|
22
|
+
children: "\u4E00-\u4E8C-\u4E09-\u56DB-\u4E94-\u516D-\u4E03-\u516B-\u4E5D-\u5341"
|
23
|
+
})]
|
24
|
+
})
|
25
|
+
}), /*#__PURE__*/_jsx("hr", {}), /*#__PURE__*/_jsx(McEllipsis, {
|
26
|
+
text: '使用TooltipProps属性:' + longText,
|
27
|
+
tooltip: {
|
28
|
+
title: /*#__PURE__*/_jsxs(_Fragment, {
|
29
|
+
children: [/*#__PURE__*/_jsx("div", {
|
30
|
+
children: "\u81EA\u5B9A\u4E49\u63D0\u793A\u5185\u5BB9\uFF1A"
|
31
|
+
}), /*#__PURE__*/_jsx("div", {
|
32
|
+
children: "\u4E00-\u4E8C-\u4E09-\u56DB-\u4E94-\u516D-\u4E03-\u516B-\u4E5D-\u5341"
|
33
|
+
})]
|
34
|
+
}),
|
35
|
+
placement: 'topLeft',
|
36
|
+
color: '#325CF7'
|
37
|
+
}
|
38
|
+
}), /*#__PURE__*/_jsx("hr", {}), /*#__PURE__*/_jsx(McEllipsis, {
|
39
|
+
text: '省略也不展示:' + longText,
|
40
|
+
tooltip: false
|
41
|
+
}), /*#__PURE__*/_jsx("hr", {}), /*#__PURE__*/_jsx(McEllipsis, {
|
42
|
+
text: "\u4E0D\u7701\u7565\u4E5F\u5C55\u793A",
|
43
|
+
tooltip: /*#__PURE__*/_jsxs(_Fragment, {
|
44
|
+
children: [/*#__PURE__*/_jsx("div", {
|
45
|
+
children: "\u81EA\u5B9A\u4E49\u63D0\u793A\u5185\u5BB9\uFF1A"
|
46
|
+
}), /*#__PURE__*/_jsx("div", {
|
47
|
+
children: "\u4E00-\u4E8C-\u4E09-\u56DB-\u4E94-\u516D-\u4E03-\u516B-\u4E5D-\u5341"
|
48
|
+
})]
|
49
|
+
}),
|
50
|
+
alwaysTooltip: true
|
51
|
+
})]
|
52
|
+
});
|
53
|
+
});
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { TooltipProps } from 'antd';
|
2
|
+
import { ParagraphProps } from 'antd/es/typography/Paragraph';
|
3
|
+
import { CSSProperties, FC, ReactNode } from 'react';
|
4
|
+
import './index.less';
|
5
|
+
export type McEllipsisProps = ParagraphProps & {
|
6
|
+
/** 要显示的文字内容 */
|
7
|
+
text?: string;
|
8
|
+
/**
|
9
|
+
* 文字行数,默认1
|
10
|
+
* @remarks 中间省略时无效,仅支持1行文字
|
11
|
+
*/
|
12
|
+
rows?: number;
|
13
|
+
/** 是否使用中间省略,默认false */
|
14
|
+
middle?: boolean;
|
15
|
+
/**
|
16
|
+
* 使用中间省略时,结尾显示的字个数
|
17
|
+
* @defaultValue 4
|
18
|
+
*/
|
19
|
+
suffixCount?: number;
|
20
|
+
/**
|
21
|
+
* 自定义提示内容(默认展示text)
|
22
|
+
* @remarks 若设置为false则无论省略与否都不展示(此时alwaysTooltip无效)
|
23
|
+
*/
|
24
|
+
tooltip?: ReactNode | TooltipProps;
|
25
|
+
/**
|
26
|
+
* 是否无论省略与否都展示提示信息
|
27
|
+
* @remarks 默认为省略时展示
|
28
|
+
* @defaultValue false
|
29
|
+
*/
|
30
|
+
alwaysTooltip?: boolean;
|
31
|
+
/** tooltip提示框最大宽度,默认800 */
|
32
|
+
tooltipMaxWidth?: number;
|
33
|
+
/** tooltip提示框最大高度,默认不限 */
|
34
|
+
tooltipMaxHeight?: number;
|
35
|
+
/** 自定义样式 */
|
36
|
+
style?: CSSProperties;
|
37
|
+
/** 自定义类名 */
|
38
|
+
className?: string;
|
39
|
+
};
|
40
|
+
export declare const McEllipsis: FC<McEllipsisProps>;
|
@@ -0,0 +1,115 @@
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4
|
+
var _excluded = ["text", "rows", "middle", "suffixCount", "tooltip", "alwaysTooltip", "tooltipMaxWidth", "tooltipMaxHeight", "copyable", "style", "className"];
|
5
|
+
import { Tooltip, Typography } from 'antd';
|
6
|
+
import classNames from 'classnames';
|
7
|
+
import { McIconFont } from "./..";
|
8
|
+
import "./index.css";
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
10
|
+
var Paragraph = Typography.Paragraph,
|
11
|
+
Text = Typography.Text;
|
12
|
+
export var McEllipsis = function McEllipsis(props) {
|
13
|
+
var text = props.text,
|
14
|
+
_props$rows = props.rows,
|
15
|
+
rows = _props$rows === void 0 ? 1 : _props$rows,
|
16
|
+
_props$middle = props.middle,
|
17
|
+
middle = _props$middle === void 0 ? false : _props$middle,
|
18
|
+
_props$suffixCount = props.suffixCount,
|
19
|
+
suffixCount = _props$suffixCount === void 0 ? 4 : _props$suffixCount,
|
20
|
+
tooltip = props.tooltip,
|
21
|
+
_props$alwaysTooltip = props.alwaysTooltip,
|
22
|
+
alwaysTooltip = _props$alwaysTooltip === void 0 ? false : _props$alwaysTooltip,
|
23
|
+
_props$tooltipMaxWidt = props.tooltipMaxWidth,
|
24
|
+
tooltipMaxWidth = _props$tooltipMaxWidt === void 0 ? 800 : _props$tooltipMaxWidt,
|
25
|
+
_props$tooltipMaxHeig = props.tooltipMaxHeight,
|
26
|
+
tooltipMaxHeight = _props$tooltipMaxHeig === void 0 ? 'auto' : _props$tooltipMaxHeig,
|
27
|
+
_props$copyable = props.copyable,
|
28
|
+
copyable = _props$copyable === void 0 ? false : _props$copyable,
|
29
|
+
style = props.style,
|
30
|
+
className = props.className,
|
31
|
+
rest = _objectWithoutProperties(props, _excluded);
|
32
|
+
var alwaysTooltip0 = tooltip === false ? false : alwaysTooltip;
|
33
|
+
var copyable0 = copyable && !!text ? _objectSpread({
|
34
|
+
icon: /*#__PURE__*/_jsx(McIconFont, {
|
35
|
+
type: "icon-CopyOutlined"
|
36
|
+
})
|
37
|
+
}, copyable === true ? {} : copyable) : false;
|
38
|
+
|
39
|
+
/* 提示信息相关逻辑 */
|
40
|
+
// 提示框基础样式
|
41
|
+
var overlayBaseStyles = {
|
42
|
+
overlayStyle: {
|
43
|
+
maxWidth: tooltipMaxWidth,
|
44
|
+
maxHeight: tooltipMaxHeight
|
45
|
+
},
|
46
|
+
overlayInnerStyle: {
|
47
|
+
maxHeight: tooltipMaxHeight,
|
48
|
+
overflow: 'auto'
|
49
|
+
}
|
50
|
+
};
|
51
|
+
var tooltip0 = _objectSpread({
|
52
|
+
title: text
|
53
|
+
}, overlayBaseStyles);
|
54
|
+
if (props.hasOwnProperty('tooltip')) {
|
55
|
+
if (tooltip === false) {
|
56
|
+
tooltip0 = false;
|
57
|
+
} else {
|
58
|
+
if (_typeof(tooltip) === 'object' && tooltip !== null && tooltip !== void 0 && tooltip.hasOwnProperty('title')) {
|
59
|
+
tooltip0 = _objectSpread(_objectSpread({}, tooltip), {}, {
|
60
|
+
overlayStyle: _objectSpread(_objectSpread({}, overlayBaseStyles.overlayStyle), tooltip.overlayStyle || {}),
|
61
|
+
overlayInnerStyle: _objectSpread(_objectSpread({}, overlayBaseStyles.overlayInnerStyle), tooltip.overlayInnerStyle || {})
|
62
|
+
});
|
63
|
+
} else {
|
64
|
+
tooltip0 = _objectSpread({
|
65
|
+
title: tooltip
|
66
|
+
}, overlayBaseStyles);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
/* 中间省略相关逻辑 */
|
72
|
+
// 为单行展示时使用中间省略且尾缀0的逻辑,以保布局样式不错位
|
73
|
+
var middle0 = middle || rows === 1 ? true : false;
|
74
|
+
var suffixCount0 = middle ? suffixCount : 0;
|
75
|
+
var start = '',
|
76
|
+
suffix = '';
|
77
|
+
if (middle0) {
|
78
|
+
var textStr = String(text || '').trim();
|
79
|
+
var isBeyond = textStr.length > suffixCount0;
|
80
|
+
start = isBeyond ? textStr.slice(0, textStr.length - suffixCount0) : textStr;
|
81
|
+
suffix = isBeyond && suffixCount0 ? textStr.slice(-suffixCount0).trim() : '';
|
82
|
+
}
|
83
|
+
|
84
|
+
/* 渲染函数 */
|
85
|
+
var innerRender = function innerRender() {
|
86
|
+
return middle0 ? /*#__PURE__*/_jsx(Text, _objectSpread(_objectSpread({
|
87
|
+
style: _objectSpread({
|
88
|
+
width: '100%'
|
89
|
+
}, style),
|
90
|
+
className: classNames('mc-ellipsis', className),
|
91
|
+
ellipsis: {
|
92
|
+
suffix: suffix,
|
93
|
+
tooltip: alwaysTooltip0 ? false : tooltip0
|
94
|
+
},
|
95
|
+
copyable: copyable0
|
96
|
+
}, rest), {}, {
|
97
|
+
children: start
|
98
|
+
}), text) : /*#__PURE__*/_jsx(Paragraph, _objectSpread(_objectSpread({
|
99
|
+
style: _objectSpread({
|
100
|
+
marginBottom: 0
|
101
|
+
}, style),
|
102
|
+
className: classNames('mc-ellipsis', className),
|
103
|
+
ellipsis: {
|
104
|
+
rows: rows,
|
105
|
+
tooltip: alwaysTooltip0 ? false : tooltip0
|
106
|
+
},
|
107
|
+
copyable: copyable0
|
108
|
+
}, rest), {}, {
|
109
|
+
children: text
|
110
|
+
}), text);
|
111
|
+
};
|
112
|
+
return alwaysTooltip0 ? /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({}, tooltip0), {}, {
|
113
|
+
children: innerRender()
|
114
|
+
})) : innerRender();
|
115
|
+
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
.mc-group-panel {
|
2
2
|
width: 100%;
|
3
|
-
height:
|
3
|
+
height: 341px;
|
4
4
|
display: -webkit-box;
|
5
5
|
display: -ms-flexbox;
|
6
6
|
display: flex;
|
@@ -12,7 +12,7 @@
|
|
12
12
|
.mc-group-panel__card-header {
|
13
13
|
height: 40px;
|
14
14
|
background: #fafafa;
|
15
|
-
padding: 0
|
15
|
+
padding: 0 8px;
|
16
16
|
display: -webkit-box;
|
17
17
|
display: -ms-flexbox;
|
18
18
|
display: flex;
|
@@ -26,6 +26,10 @@
|
|
26
26
|
.mc-group-panel__card-title {
|
27
27
|
color: rgba(0, 0, 0, 0.847);
|
28
28
|
font-weight: 600;
|
29
|
+
font-size: 14px;
|
30
|
+
}
|
31
|
+
.mc-group-panel__card-icon {
|
32
|
+
color: #8c8c8c;
|
29
33
|
}
|
30
34
|
.mc-group-panel__card-body {
|
31
35
|
height: calc(100% - 40px);
|
@@ -58,13 +62,14 @@
|
|
58
62
|
flex: 1 1 56%;
|
59
63
|
border-left: 1px solid #ebebeb;
|
60
64
|
overflow: auto;
|
65
|
+
padding-bottom: 20px;
|
61
66
|
}
|
62
67
|
.mc-group-panel__options-list {
|
63
68
|
height: calc(100% - 40px);
|
64
69
|
overflow: auto;
|
65
70
|
}
|
66
71
|
.mc-group-panel__search-bar {
|
67
|
-
padding: 0
|
72
|
+
padding: 0 12px;
|
68
73
|
}
|
69
74
|
.mc-group-panel__checkbox-wrapper {
|
70
75
|
width: 100%;
|
@@ -22,6 +22,8 @@ var McGroupPanel = function McGroupPanel(props) {
|
|
22
22
|
_props$inexistent = props.inexistent,
|
23
23
|
inexistent = _props$inexistent === void 0 ? false : _props$inexistent,
|
24
24
|
sortable = props.sortable,
|
25
|
+
_props$title = props.title,
|
26
|
+
title = _props$title === void 0 ? '标题' : _props$title,
|
25
27
|
value = props.value,
|
26
28
|
onChange = props.onChange;
|
27
29
|
var _ref = typeof inexistent === 'boolean' ? {} : inexistent,
|
@@ -179,172 +181,181 @@ var McGroupPanel = function McGroupPanel(props) {
|
|
179
181
|
children: [/*#__PURE__*/_jsxs("div", {
|
180
182
|
className: "mc-group-panel__options",
|
181
183
|
children: [/*#__PURE__*/_jsx("div", {
|
182
|
-
className: "mc-group-panel__card-header mc-group-panel__search-bar",
|
183
|
-
children:
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
}) && allValues.some(function (v) {
|
208
|
-
return selected.includes(v);
|
209
|
-
}),
|
210
|
-
onChange: function onChange(e) {
|
211
|
-
return changeHandle(e.target.checked ? Array.from(new Set([].concat(_toConsumableArray(selected), _toConsumableArray(allValues)))) : reserved ? selected.filter(function (i) {
|
212
|
-
return !itemMap[i];
|
213
|
-
}) : []);
|
214
|
-
},
|
215
|
-
disabled: disabled,
|
216
|
-
children: "\u5168\u9009"
|
217
|
-
})
|
218
|
-
}), /*#__PURE__*/_jsx("div", {
|
219
|
-
className: "mc-group-panel__options-list",
|
220
|
-
children: _options.map(function (item) {
|
221
|
-
var _groupMap$item$value, _groupMap$item$value2;
|
222
|
-
return /*#__PURE__*/_jsxs("div", {
|
223
|
-
className: "mc-group-panel__checkbox-wrapper",
|
224
|
-
style: {
|
225
|
-
background: activeGroup === item.value ? '#EAEEFE' : ''
|
226
|
-
},
|
227
|
-
onClick: function onClick() {
|
228
|
-
return setActiveGroup(item.value);
|
229
|
-
},
|
230
|
-
children: [/*#__PURE__*/_jsx(Checkbox, {
|
231
|
-
checked: ((_groupMap$item$value = groupMap[item.value]) === null || _groupMap$item$value === void 0 ? void 0 : _groupMap$item$value.length) > 0 && groupMap[item.value].every(function (_ref2) {
|
232
|
-
var value = _ref2.value;
|
233
|
-
return selected.includes(value);
|
234
|
-
}),
|
235
|
-
indeterminate: ((_groupMap$item$value2 = groupMap[item.value]) === null || _groupMap$item$value2 === void 0 ? void 0 : _groupMap$item$value2.length) > 0 && !groupMap[item.value].every(function (_ref3) {
|
236
|
-
var value = _ref3.value;
|
237
|
-
return selected.includes(value);
|
238
|
-
}) && groupMap[item.value].some(function (_ref4) {
|
239
|
-
var value = _ref4.value;
|
240
|
-
return selected.includes(value);
|
241
|
-
}),
|
242
|
-
onChange: function onChange(e) {
|
243
|
-
var _groupMap$item$value3;
|
244
|
-
return changeHandle(e.target.checked ? Array.from(new Set([].concat(_toConsumableArray(selected), _toConsumableArray(((_groupMap$item$value3 = groupMap[item.value]) === null || _groupMap$item$value3 === void 0 ? void 0 : _groupMap$item$value3.map(function (_ref5) {
|
245
|
-
var value = _ref5.value;
|
246
|
-
return value;
|
247
|
-
})) || [])))) : selected.filter(function (i) {
|
248
|
-
var _groupMap$item$value4;
|
249
|
-
return !((_groupMap$item$value4 = groupMap[item.value]) !== null && _groupMap$item$value4 !== void 0 && _groupMap$item$value4.some(function (_ref6) {
|
250
|
-
var value = _ref6.value;
|
251
|
-
return value === i;
|
252
|
-
}));
|
253
|
-
}));
|
254
|
-
},
|
255
|
-
disabled: disabled,
|
256
|
-
onClick: function onClick(e) {
|
257
|
-
return e.stopPropagation();
|
258
|
-
}
|
259
|
-
}), /*#__PURE__*/_jsx(Typography.Paragraph, {
|
260
|
-
style: {
|
261
|
-
margin: '0 0 0 8px'
|
262
|
-
},
|
263
|
-
ellipsis: {
|
264
|
-
tooltip: item.label
|
265
|
-
},
|
266
|
-
children: item.label
|
267
|
-
})]
|
268
|
-
}, item.value);
|
269
|
-
})
|
270
|
-
})]
|
271
|
-
}), /*#__PURE__*/_jsx("div", {
|
272
|
-
className: "mc-group-panel__options-items",
|
273
|
-
children: ((_groupMap$activeGroup = groupMap[activeGroup]) === null || _groupMap$activeGroup === void 0 ? void 0 : _groupMap$activeGroup.length) > 0 ? /*#__PURE__*/_jsxs(_Fragment, {
|
184
|
+
className: "mc-group-panel__card-title mc-group-panel__card-header mc-group-panel__search-bar",
|
185
|
+
children: title
|
186
|
+
}), /*#__PURE__*/_jsxs(_Fragment, {
|
187
|
+
children: [/*#__PURE__*/_jsx("div", {
|
188
|
+
style: {
|
189
|
+
padding: 12
|
190
|
+
},
|
191
|
+
children: /*#__PURE__*/_jsx(Input, {
|
192
|
+
prefix: /*#__PURE__*/_jsx(SearchOutlined, {
|
193
|
+
className: "mc-group-panel__card-icon"
|
194
|
+
}),
|
195
|
+
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD",
|
196
|
+
allowClear: true,
|
197
|
+
autoComplete: "off",
|
198
|
+
value: searchValue,
|
199
|
+
onChange: function onChange(e) {
|
200
|
+
var v = e.target.value.trim();
|
201
|
+
setSearchValue(v);
|
202
|
+
v !== searchValue && debounceSearch(v);
|
203
|
+
}
|
204
|
+
})
|
205
|
+
}), _options.length > 0 ? /*#__PURE__*/_jsxs("div", {
|
206
|
+
className: "mc-group-panel__options-wrapper",
|
207
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
208
|
+
className: "mc-group-panel__options-groups",
|
274
209
|
children: [/*#__PURE__*/_jsx("div", {
|
275
210
|
className: "mc-group-panel__checkbox-wrapper mc-group-panel__check-all",
|
276
211
|
children: /*#__PURE__*/_jsx(Checkbox, {
|
277
|
-
checked:
|
278
|
-
|
279
|
-
return selected.includes(value);
|
212
|
+
checked: allValues.length > 0 && allValues.every(function (v) {
|
213
|
+
return selected.includes(v);
|
280
214
|
}),
|
281
|
-
indeterminate:
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
var value = _ref9.value;
|
286
|
-
return selected.includes(value);
|
215
|
+
indeterminate: allValues.length > 0 && !allValues.every(function (v) {
|
216
|
+
return selected.includes(v);
|
217
|
+
}) && allValues.some(function (v) {
|
218
|
+
return selected.includes(v);
|
287
219
|
}),
|
288
220
|
onChange: function onChange(e) {
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
return value;
|
293
|
-
})) || [])))) : selected.filter(function (i) {
|
294
|
-
var _groupMap$activeGroup5;
|
295
|
-
return !((_groupMap$activeGroup5 = groupMap[activeGroup]) !== null && _groupMap$activeGroup5 !== void 0 && _groupMap$activeGroup5.some(function (_ref11) {
|
296
|
-
var value = _ref11.value;
|
297
|
-
return value === i;
|
298
|
-
}));
|
299
|
-
}));
|
221
|
+
return changeHandle(e.target.checked ? Array.from(new Set([].concat(_toConsumableArray(selected), _toConsumableArray(allValues)))) : reserved ? selected.filter(function (i) {
|
222
|
+
return !itemMap[i];
|
223
|
+
}) : []);
|
300
224
|
},
|
301
225
|
disabled: disabled,
|
302
226
|
children: "\u5168\u9009"
|
303
227
|
})
|
304
228
|
}), /*#__PURE__*/_jsx("div", {
|
305
229
|
className: "mc-group-panel__options-list",
|
306
|
-
children:
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
return i !== item.value;
|
313
|
-
}));
|
230
|
+
children: _options.map(function (item) {
|
231
|
+
var _groupMap$item$value, _groupMap$item$value2;
|
232
|
+
return /*#__PURE__*/_jsxs("div", {
|
233
|
+
className: "mc-group-panel__checkbox-wrapper",
|
234
|
+
style: {
|
235
|
+
background: activeGroup === item.value ? '#EAEEFE' : ''
|
314
236
|
},
|
315
|
-
|
316
|
-
|
237
|
+
onClick: function onClick() {
|
238
|
+
return setActiveGroup(item.value);
|
239
|
+
},
|
240
|
+
children: [/*#__PURE__*/_jsx(Checkbox, {
|
241
|
+
checked: ((_groupMap$item$value = groupMap[item.value]) === null || _groupMap$item$value === void 0 ? void 0 : _groupMap$item$value.length) > 0 && groupMap[item.value].every(function (_ref2) {
|
242
|
+
var value = _ref2.value;
|
243
|
+
return selected.includes(value);
|
244
|
+
}),
|
245
|
+
indeterminate: ((_groupMap$item$value2 = groupMap[item.value]) === null || _groupMap$item$value2 === void 0 ? void 0 : _groupMap$item$value2.length) > 0 && !groupMap[item.value].every(function (_ref3) {
|
246
|
+
var value = _ref3.value;
|
247
|
+
return selected.includes(value);
|
248
|
+
}) && groupMap[item.value].some(function (_ref4) {
|
249
|
+
var value = _ref4.value;
|
250
|
+
return selected.includes(value);
|
251
|
+
}),
|
252
|
+
onChange: function onChange(e) {
|
253
|
+
var _groupMap$item$value3;
|
254
|
+
return changeHandle(e.target.checked ? Array.from(new Set([].concat(_toConsumableArray(selected), _toConsumableArray(((_groupMap$item$value3 = groupMap[item.value]) === null || _groupMap$item$value3 === void 0 ? void 0 : _groupMap$item$value3.map(function (_ref5) {
|
255
|
+
var value = _ref5.value;
|
256
|
+
return value;
|
257
|
+
})) || [])))) : selected.filter(function (i) {
|
258
|
+
var _groupMap$item$value4;
|
259
|
+
return !((_groupMap$item$value4 = groupMap[item.value]) !== null && _groupMap$item$value4 !== void 0 && _groupMap$item$value4.some(function (_ref6) {
|
260
|
+
var value = _ref6.value;
|
261
|
+
return value === i;
|
262
|
+
}));
|
263
|
+
}));
|
264
|
+
},
|
265
|
+
disabled: disabled,
|
266
|
+
onClick: function onClick(e) {
|
267
|
+
return e.stopPropagation();
|
268
|
+
}
|
269
|
+
}), /*#__PURE__*/_jsx(Typography.Paragraph, {
|
317
270
|
style: {
|
318
|
-
margin: 0
|
271
|
+
margin: '0 0 0 8px'
|
319
272
|
},
|
320
273
|
ellipsis: {
|
321
274
|
tooltip: item.label
|
322
275
|
},
|
323
276
|
children: item.label
|
324
|
-
})
|
277
|
+
})]
|
325
278
|
}, item.value);
|
326
279
|
})
|
327
280
|
})]
|
328
|
-
})
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
281
|
+
}), /*#__PURE__*/_jsx("div", {
|
282
|
+
className: "mc-group-panel__options-items",
|
283
|
+
children: ((_groupMap$activeGroup = groupMap[activeGroup]) === null || _groupMap$activeGroup === void 0 ? void 0 : _groupMap$activeGroup.length) > 0 ? /*#__PURE__*/_jsxs(_Fragment, {
|
284
|
+
children: [/*#__PURE__*/_jsx("div", {
|
285
|
+
className: "mc-group-panel__checkbox-wrapper mc-group-panel__check-all",
|
286
|
+
children: /*#__PURE__*/_jsx(Checkbox, {
|
287
|
+
checked: ((_groupMap$activeGroup2 = groupMap[activeGroup]) === null || _groupMap$activeGroup2 === void 0 ? void 0 : _groupMap$activeGroup2.length) > 0 && groupMap[activeGroup].every(function (_ref7) {
|
288
|
+
var value = _ref7.value;
|
289
|
+
return selected.includes(value);
|
290
|
+
}),
|
291
|
+
indeterminate: ((_groupMap$activeGroup3 = groupMap[activeGroup]) === null || _groupMap$activeGroup3 === void 0 ? void 0 : _groupMap$activeGroup3.length) > 0 && !groupMap[activeGroup].every(function (_ref8) {
|
292
|
+
var value = _ref8.value;
|
293
|
+
return selected.includes(value);
|
294
|
+
}) && groupMap[activeGroup].some(function (_ref9) {
|
295
|
+
var value = _ref9.value;
|
296
|
+
return selected.includes(value);
|
297
|
+
}),
|
298
|
+
onChange: function onChange(e) {
|
299
|
+
var _groupMap$activeGroup4;
|
300
|
+
return changeHandle(e.target.checked ? Array.from(new Set([].concat(_toConsumableArray(selected), _toConsumableArray(((_groupMap$activeGroup4 = groupMap[activeGroup]) === null || _groupMap$activeGroup4 === void 0 ? void 0 : _groupMap$activeGroup4.map(function (_ref10) {
|
301
|
+
var value = _ref10.value;
|
302
|
+
return value;
|
303
|
+
})) || [])))) : selected.filter(function (i) {
|
304
|
+
var _groupMap$activeGroup5;
|
305
|
+
return !((_groupMap$activeGroup5 = groupMap[activeGroup]) !== null && _groupMap$activeGroup5 !== void 0 && _groupMap$activeGroup5.some(function (_ref11) {
|
306
|
+
var value = _ref11.value;
|
307
|
+
return value === i;
|
308
|
+
}));
|
309
|
+
}));
|
310
|
+
},
|
311
|
+
disabled: disabled,
|
312
|
+
children: "\u5168\u9009"
|
313
|
+
})
|
314
|
+
}), /*#__PURE__*/_jsx("div", {
|
315
|
+
className: "mc-group-panel__options-list",
|
316
|
+
children: groupMap[activeGroup].map(function (item) {
|
317
|
+
return /*#__PURE__*/_jsx(Checkbox, {
|
318
|
+
className: "mc-group-panel__checkbox",
|
319
|
+
checked: selected.includes(item.value),
|
320
|
+
onChange: function onChange(e) {
|
321
|
+
return changeHandle(e.target.checked ? [].concat(_toConsumableArray(selected), [item.value]) : selected.filter(function (i) {
|
322
|
+
return i !== item.value;
|
323
|
+
}));
|
324
|
+
},
|
325
|
+
disabled: disabled,
|
326
|
+
children: /*#__PURE__*/_jsx(Typography.Paragraph, {
|
327
|
+
style: {
|
328
|
+
margin: 0
|
329
|
+
},
|
330
|
+
ellipsis: {
|
331
|
+
tooltip: item.label
|
332
|
+
},
|
333
|
+
children: item.label
|
334
|
+
})
|
335
|
+
}, item.value);
|
336
|
+
})
|
337
|
+
})]
|
338
|
+
}) : /*#__PURE__*/_jsx("div", {
|
339
|
+
style: {
|
340
|
+
height: '100%',
|
341
|
+
display: 'grid',
|
342
|
+
placeItems: 'center'
|
343
|
+
},
|
344
|
+
children: /*#__PURE__*/_jsx(Empty, {
|
345
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE
|
346
|
+
})
|
336
347
|
})
|
348
|
+
})]
|
349
|
+
}) : /*#__PURE__*/_jsx("div", {
|
350
|
+
style: {
|
351
|
+
height: 'calc(100% - 40px)',
|
352
|
+
display: 'grid',
|
353
|
+
placeItems: 'center'
|
354
|
+
},
|
355
|
+
children: /*#__PURE__*/_jsx(Empty, {
|
356
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE
|
337
357
|
})
|
338
358
|
})]
|
339
|
-
}) : /*#__PURE__*/_jsx("div", {
|
340
|
-
style: {
|
341
|
-
height: 'calc(100% - 40px)',
|
342
|
-
display: 'grid',
|
343
|
-
placeItems: 'center'
|
344
|
-
},
|
345
|
-
children: /*#__PURE__*/_jsx(Empty, {
|
346
|
-
image: Empty.PRESENTED_IMAGE_SIMPLE
|
347
|
-
})
|
348
359
|
})]
|
349
360
|
}), /*#__PURE__*/_jsxs("div", {
|
350
361
|
className: "mc-group-panel__selected",
|
@@ -354,6 +365,10 @@ var McGroupPanel = function McGroupPanel(props) {
|
|
354
365
|
className: "mc-group-panel__card-title",
|
355
366
|
children: ["\u5DF2\u9009", selected.length, "\u9879"]
|
356
367
|
}), /*#__PURE__*/_jsx(Button, {
|
368
|
+
className: "mc-group-panel__card-button",
|
369
|
+
style: {
|
370
|
+
padding: 0
|
371
|
+
},
|
357
372
|
type: "link",
|
358
373
|
onClick: function onClick() {
|
359
374
|
return changeHandle(reserved ? selected.filter(function (i) {
|
@@ -2,8 +2,11 @@ import { InputNumberProps } from 'antd';
|
|
2
2
|
import { FC, ReactNode } from 'react';
|
3
3
|
import './index.less';
|
4
4
|
type McInputNumberProps = Omit<InputNumberProps, 'precision' | 'value' | 'onChange'> & {
|
5
|
+
/** 查询项的字段名(配合McContainer组件的查询功能使用) */
|
5
6
|
name?: string;
|
7
|
+
/** 查询项的标签文字(若未设置,样式为表单项形态) */
|
6
8
|
label?: ReactNode;
|
9
|
+
/** 最多保留多少位小数,默认0 */
|
7
10
|
precision?: number;
|
8
11
|
value?: number | null;
|
9
12
|
onChange?: (value?: number | null) => void;
|