@zykj2024/much-library 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -0
- package/README.md +35 -0
- package/dist/McCascader/city.js +909 -0
- package/dist/McCascader/index.css +60 -0
- package/dist/McCascader/index.d.ts +19 -0
- package/dist/McCascader/index.js +221 -0
- package/dist/McContainer/demo/actionBar.d.ts +8 -0
- package/dist/McContainer/demo/actionBar.js +70 -0
- package/dist/McContainer/demo/base.d.ts +8 -0
- package/dist/McContainer/demo/base.js +80 -0
- package/dist/McContainer/demo/batch.d.ts +8 -0
- package/dist/McContainer/demo/batch.js +89 -0
- package/dist/McContainer/demo/collapse.d.ts +8 -0
- package/dist/McContainer/demo/collapse.js +76 -0
- package/dist/McContainer/demo/expand.d.ts +8 -0
- package/dist/McContainer/demo/expand.js +90 -0
- package/dist/McContainer/demo/pagination.d.ts +7 -0
- package/dist/McContainer/demo/pagination.js +93 -0
- package/dist/McContainer/demo/search.d.ts +7 -0
- package/dist/McContainer/demo/search.js +101 -0
- package/dist/McContainer/demo/standard.d.ts +7 -0
- package/dist/McContainer/demo/standard.js +168 -0
- package/dist/McContainer/index.css +123 -0
- package/dist/McContainer/index.d.ts +49 -0
- package/dist/McContainer/index.js +407 -0
- package/dist/McDateRange/demo/base.d.ts +6 -0
- package/dist/McDateRange/demo/base.js +22 -0
- package/dist/McDateRange/demo/cancelPresets.d.ts +6 -0
- package/dist/McDateRange/demo/cancelPresets.js +23 -0
- package/dist/McDateRange/demo/overlap.d.ts +2 -0
- package/dist/McDateRange/demo/overlap.js +32 -0
- package/dist/McDateRange/index.css +31 -0
- package/dist/McDateRange/index.d.ts +28 -0
- package/dist/McDateRange/index.js +167 -0
- package/dist/McFonts/index.d.ts +7 -0
- package/dist/McFonts/index.js +10 -0
- package/dist/McFonts/public/FF DIN Pro Bold.otf +0 -0
- package/dist/McFonts/public/SourceHanSansCN-Bold.otf +0 -0
- package/dist/McFonts/public/SourceHanSansCN-Light.otf +0 -0
- package/dist/McFonts/public/SourceHanSansCN-Medium.otf +0 -0
- package/dist/McFonts/public/SourceHanSansCN-Regular.otf +0 -0
- package/dist/McGroupPanel/comps/SelectedItem/index.d.ts +4 -0
- package/dist/McGroupPanel/comps/SelectedItem/index.js +76 -0
- package/dist/McGroupPanel/index.css +162 -0
- package/dist/McGroupPanel/index.d.ts +29 -0
- package/dist/McGroupPanel/index.js +411 -0
- package/dist/McIconFont/iconfont.js +1 -0
- package/dist/McIconFont/index.d.ts +5 -0
- package/dist/McIconFont/index.js +8 -0
- package/dist/McIcons/business.json +137 -0
- package/dist/McInput/Input.d.ts +19 -0
- package/dist/McInput/Input.js +48 -0
- package/dist/McInput/Search.d.ts +39 -0
- package/dist/McInput/Search.js +81 -0
- package/dist/McInput/TextArea.d.ts +11 -0
- package/dist/McInput/TextArea.js +37 -0
- package/dist/McInput/demo/Input/addonBefore.d.ts +3 -0
- package/dist/McInput/demo/Input/addonBefore.js +67 -0
- package/dist/McInput/demo/Input/base.d.ts +2 -0
- package/dist/McInput/demo/Input/base.js +31 -0
- package/dist/McInput/demo/Input/isTrim.d.ts +2 -0
- package/dist/McInput/demo/Input/isTrim.js +22 -0
- package/dist/McInput/demo/Input/label.d.ts +2 -0
- package/dist/McInput/demo/Input/label.js +26 -0
- package/dist/McInput/demo/Input/ref.d.ts +3 -0
- package/dist/McInput/demo/Input/ref.js +53 -0
- package/dist/McInput/demo/Input/status.d.ts +2 -0
- package/dist/McInput/demo/Input/status.js +23 -0
- package/dist/McInput/demo/Search/search-base.d.ts +2 -0
- package/dist/McInput/demo/Search/search-base.js +38 -0
- package/dist/McInput/demo/TextArea/text-area-base.d.ts +2 -0
- package/dist/McInput/demo/TextArea/text-area-base.js +38 -0
- package/dist/McInput/index.css +44 -0
- package/dist/McInput/index.d.ts +13 -0
- package/dist/McInput/index.js +7 -0
- package/dist/McInputNumber/demo/index.d.ts +2 -0
- package/dist/McInputNumber/demo/index.js +28 -0
- package/dist/McInputNumber/demo/label.d.ts +2 -0
- package/dist/McInputNumber/demo/label.js +26 -0
- package/dist/McInputNumber/demo/precision.d.ts +2 -0
- package/dist/McInputNumber/demo/precision.js +20 -0
- package/dist/McInputNumber/index.css +9 -0
- package/dist/McInputNumber/index.d.ts +13 -0
- package/dist/McInputNumber/index.js +43 -0
- package/dist/McModalProvider/index.d.ts +174 -0
- package/dist/McModalProvider/index.js +498 -0
- package/dist/McPeriodSelect/demo/base.d.ts +6 -0
- package/dist/McPeriodSelect/demo/base.js +19 -0
- package/dist/McPeriodSelect/demo/half.d.ts +6 -0
- package/dist/McPeriodSelect/demo/half.js +20 -0
- package/dist/McPeriodSelect/index.css +189 -0
- package/dist/McPeriodSelect/index.d.ts +13 -0
- package/dist/McPeriodSelect/index.js +305 -0
- package/dist/McPopoverButton/index.d.ts +14 -0
- package/dist/McPopoverButton/index.js +52 -0
- package/dist/McPopoverForm/index.d.ts +14 -0
- package/dist/McPopoverForm/index.js +95 -0
- package/dist/McResult/default.d.ts +1 -0
- package/dist/McResult/default.js +84 -0
- package/dist/McResult/demo/403.d.ts +6 -0
- package/dist/McResult/demo/403.js +17 -0
- package/dist/McResult/demo/404.d.ts +6 -0
- package/dist/McResult/demo/404.js +17 -0
- package/dist/McResult/demo/500.d.ts +6 -0
- package/dist/McResult/demo/500.js +17 -0
- package/dist/McResult/demo/building.d.ts +6 -0
- package/dist/McResult/demo/building.js +12 -0
- package/dist/McResult/demo/empty.d.ts +2 -0
- package/dist/McResult/demo/empty.js +11 -0
- package/dist/McResult/demo/noFunction.d.ts +2 -0
- package/dist/McResult/demo/noFunction.js +11 -0
- package/dist/McResult/demo/noUser.d.ts +6 -0
- package/dist/McResult/demo/noUser.js +12 -0
- package/dist/McResult/demo/preview.d.ts +2 -0
- package/dist/McResult/demo/preview.js +14 -0
- package/dist/McResult/icon.d.ts +25 -0
- package/dist/McResult/icon.js +946 -0
- package/dist/McResult/index.css +20 -0
- package/dist/McResult/index.d.ts +27 -0
- package/dist/McResult/index.js +103 -0
- package/dist/McResult/public/403.svg +164 -0
- package/dist/McResult/public/404.svg +123 -0
- package/dist/McResult/public/500.svg +129 -0
- package/dist/McResult/public/building.svg +127 -0
- package/dist/McResult/public/code403.svg +7 -0
- package/dist/McResult/public/code404.svg +5 -0
- package/dist/McResult/public/code500.svg +5 -0
- package/dist/McResult/public/empty.svg +1 -0
- package/dist/McResult/public/noFunction.svg +1 -0
- package/dist/McResult/public/noUser.svg +90 -0
- package/dist/McSelect/demo/base.d.ts +2 -0
- package/dist/McSelect/demo/base.js +63 -0
- package/dist/McSelect/demo/changeOnHidden.d.ts +2 -0
- package/dist/McSelect/demo/changeOnHidden.js +43 -0
- package/dist/McSelect/demo/dropdownRender.d.ts +7 -0
- package/dist/McSelect/demo/dropdownRender.js +78 -0
- package/dist/McSelect/demo/fetchOptions.d.ts +7 -0
- package/dist/McSelect/demo/fetchOptions.js +210 -0
- package/dist/McSelect/demo/inexistent.d.ts +2 -0
- package/dist/McSelect/demo/inexistent.js +79 -0
- package/dist/McSelect/demo/labelInValue.d.ts +2 -0
- package/dist/McSelect/demo/labelInValue.js +72 -0
- package/dist/McSelect/demo/maxTagCount.d.ts +3 -0
- package/dist/McSelect/demo/maxTagCount.js +51 -0
- package/dist/McSelect/demo/multiple.d.ts +2 -0
- package/dist/McSelect/demo/multiple.js +46 -0
- package/dist/McSelect/demo/optionRender.d.ts +3 -0
- package/dist/McSelect/demo/optionRender.js +51 -0
- package/dist/McSelect/demo/tagRender.d.ts +3 -0
- package/dist/McSelect/demo/tagRender.js +51 -0
- package/dist/McSelect/index.css +60 -0
- package/dist/McSelect/index.d.ts +40 -0
- package/dist/McSelect/index.js +350 -0
- package/dist/McThemeConfig/customToken.json +38 -0
- package/dist/McThemeConfig/demo/button.d.ts +2 -0
- package/dist/McThemeConfig/demo/button.js +226 -0
- package/dist/McThemeConfig/demo/drawer.d.ts +2 -0
- package/dist/McThemeConfig/demo/drawer.js +59 -0
- package/dist/McThemeConfig/demo/modal.d.ts +2 -0
- package/dist/McThemeConfig/demo/modal.js +78 -0
- package/dist/McThemeConfig/demo/radio.d.ts +2 -0
- package/dist/McThemeConfig/demo/radio.js +97 -0
- package/dist/McThemeConfig/demo/switch.d.ts +2 -0
- package/dist/McThemeConfig/demo/switch.js +96 -0
- package/dist/McThemeConfig/demo/tabs.d.ts +2 -0
- package/dist/McThemeConfig/demo/tabs.js +35 -0
- package/dist/McThemeConfig/globalStyle.d.ts +2 -0
- package/dist/McThemeConfig/globalStyle.js +172 -0
- package/dist/McThemeConfig/index.d.ts +9 -0
- package/dist/McThemeConfig/index.js +16 -0
- package/dist/McThemeConfig/layoutStyle.d.ts +2 -0
- package/dist/McThemeConfig/layoutStyle.js +1 -0
- package/dist/McThemeConfig/provider.d.ts +7 -0
- package/dist/McThemeConfig/provider.js +19 -0
- package/dist/McThemeConfig/themeToken.json +149 -0
- package/dist/McTreePanel/SelectedItem.d.ts +4 -0
- package/dist/McTreePanel/SelectedItem.js +75 -0
- package/dist/McTreePanel/demo/base.d.ts +6 -0
- package/dist/McTreePanel/demo/base.js +45 -0
- package/dist/McTreePanel/demo/fieldNames.d.ts +6 -0
- package/dist/McTreePanel/demo/fieldNames.js +37 -0
- package/dist/McTreePanel/demo/inexistent.d.ts +6 -0
- package/dist/McTreePanel/demo/inexistent.js +56 -0
- package/dist/McTreePanel/demo/labelInValue.d.ts +6 -0
- package/dist/McTreePanel/demo/labelInValue.js +56 -0
- package/dist/McTreePanel/demo/sortable.d.ts +6 -0
- package/dist/McTreePanel/demo/sortable.js +34 -0
- package/dist/McTreePanel/index.css +110 -0
- package/dist/McTreePanel/index.d.ts +27 -0
- package/dist/McTreePanel/index.js +315 -0
- package/dist/McTreeSelect/demo/base.d.ts +5 -0
- package/dist/McTreeSelect/demo/base.js +58 -0
- package/dist/McTreeSelect/demo/inexistent.d.ts +5 -0
- package/dist/McTreeSelect/demo/inexistent.js +63 -0
- package/dist/McTreeSelect/demo/label.d.ts +5 -0
- package/dist/McTreeSelect/demo/label.js +60 -0
- package/dist/McTreeSelect/demo/multiple.d.ts +5 -0
- package/dist/McTreeSelect/demo/multiple.js +71 -0
- package/dist/McTreeSelect/index.css +60 -0
- package/dist/McTreeSelect/index.d.ts +13 -0
- package/dist/McTreeSelect/index.js +182 -0
- package/dist/Utils/index.d.ts +4 -0
- package/dist/Utils/index.js +26 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +19 -0
- package/dist/typings.d.ts +20 -0
- package/package.json +82 -0
@@ -0,0 +1,411 @@
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
4
|
+
import { DndContext } from '@dnd-kit/core';
|
5
|
+
import { SortableContext, arrayMove, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
6
|
+
import { Button, Checkbox, Empty, Input, Typography } from 'antd';
|
7
|
+
import { SearchOutlined } from 'much-icons';
|
8
|
+
import { Utils } from "./..";
|
9
|
+
import { useEffect, useMemo, useState } from 'react';
|
10
|
+
import SelectedItem from "./comps/SelectedItem";
|
11
|
+
import "./index.css";
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
13
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
14
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
15
|
+
var McGroupPanel = function McGroupPanel(props) {
|
16
|
+
var _groupMap$activeGroup, _groupMap$activeGroup2, _groupMap$activeGroup3;
|
17
|
+
var style = props.style,
|
18
|
+
className = props.className,
|
19
|
+
options = props.options,
|
20
|
+
disabled = props.disabled,
|
21
|
+
labelInValue = props.labelInValue,
|
22
|
+
_props$inexistent = props.inexistent,
|
23
|
+
inexistent = _props$inexistent === void 0 ? false : _props$inexistent,
|
24
|
+
sortable = props.sortable,
|
25
|
+
value = props.value,
|
26
|
+
onChange = props.onChange;
|
27
|
+
var _ref = typeof inexistent === 'boolean' ? {} : inexistent,
|
28
|
+
_ref$text = _ref.text,
|
29
|
+
text = _ref$text === void 0 ? '不存在' : _ref$text,
|
30
|
+
_ref$color = _ref.color,
|
31
|
+
color = _ref$color === void 0 ? '#ff4d4f' : _ref$color,
|
32
|
+
_ref$reserved = _ref.reserved,
|
33
|
+
reserved = _ref$reserved === void 0 ? false : _ref$reserved;
|
34
|
+
var _useState = useState([]),
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
36
|
+
selected = _useState2[0],
|
37
|
+
setSelected = _useState2[1];
|
38
|
+
var _useState3 = useState(''),
|
39
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
40
|
+
searchValue = _useState4[0],
|
41
|
+
setSearchValue = _useState4[1];
|
42
|
+
var _useState5 = useState([]),
|
43
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
44
|
+
_options = _useState6[0],
|
45
|
+
set_options = _useState6[1];
|
46
|
+
var _useState7 = useState([]),
|
47
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
48
|
+
allValues = _useState8[0],
|
49
|
+
setAllValues = _useState8[1];
|
50
|
+
var _useState9 = useState({}),
|
51
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
52
|
+
groupMap = _useState10[0],
|
53
|
+
setGroupMap = _useState10[1];
|
54
|
+
var _useState11 = useState(),
|
55
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
56
|
+
activeGroup = _useState12[0],
|
57
|
+
setActiveGroup = _useState12[1];
|
58
|
+
var _useState13 = useState({}),
|
59
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
60
|
+
itemMap = _useState14[0],
|
61
|
+
setItemMap = _useState14[1];
|
62
|
+
var _useState15 = useState({}),
|
63
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
64
|
+
inexistentItemMap = _useState16[0],
|
65
|
+
setInexistentItemMap = _useState16[1];
|
66
|
+
|
67
|
+
/* 监听options变化,重置搜索关键词、分组列表、当前全部值列表、分组映射集合、选中组、选项映射集合 */
|
68
|
+
useEffect(function () {
|
69
|
+
var _options$;
|
70
|
+
var _groupMap = {},
|
71
|
+
_itemMap = {},
|
72
|
+
_allValues = [],
|
73
|
+
_options = (options === null || options === void 0 ? void 0 : options.map(function (group) {
|
74
|
+
var _group$children;
|
75
|
+
var children = (group === null || group === void 0 || (_group$children = group.children) === null || _group$children === void 0 ? void 0 : _group$children.map(function (item) {
|
76
|
+
var _item = _objectSpread({}, item);
|
77
|
+
_itemMap[_item.value] = _item;
|
78
|
+
_allValues.push(_item.value);
|
79
|
+
return _item;
|
80
|
+
})) || [];
|
81
|
+
_groupMap[group.value] = children;
|
82
|
+
return _objectSpread(_objectSpread({}, group), {}, {
|
83
|
+
children: children
|
84
|
+
});
|
85
|
+
})) || [];
|
86
|
+
setSearchValue('');
|
87
|
+
set_options(_options);
|
88
|
+
setAllValues(_allValues);
|
89
|
+
setGroupMap(_groupMap);
|
90
|
+
setActiveGroup(_options === null || _options === void 0 || (_options$ = _options[0]) === null || _options$ === void 0 ? void 0 : _options$.value);
|
91
|
+
setItemMap(_itemMap);
|
92
|
+
}, [options]);
|
93
|
+
|
94
|
+
/* 防抖的搜索方法 */
|
95
|
+
var debounceSearch = useMemo(function () {
|
96
|
+
// 根据关键词过滤,重置分组列表、当前全部值列表、分组映射集合、选中组
|
97
|
+
var fn = function fn(keyword) {
|
98
|
+
var _options$2;
|
99
|
+
var _groupMap = {},
|
100
|
+
_allValues = [],
|
101
|
+
_options = (options === null || options === void 0 ? void 0 : options.filter(function (group) {
|
102
|
+
var _group$children2;
|
103
|
+
var children = (group === null || group === void 0 || (_group$children2 = group.children) === null || _group$children2 === void 0 ? void 0 : _group$children2.filter(function (item) {
|
104
|
+
if (item.label.includes(keyword)) {
|
105
|
+
_allValues.push(item.value);
|
106
|
+
return true;
|
107
|
+
} else {
|
108
|
+
return false;
|
109
|
+
}
|
110
|
+
})) || [];
|
111
|
+
if (children.length > 0) {
|
112
|
+
_groupMap[group.value] = children;
|
113
|
+
return _objectSpread(_objectSpread({}, group), {}, {
|
114
|
+
children: children
|
115
|
+
});
|
116
|
+
} else {
|
117
|
+
return false;
|
118
|
+
}
|
119
|
+
})) || [];
|
120
|
+
set_options(_options);
|
121
|
+
setAllValues(_allValues);
|
122
|
+
setGroupMap(_groupMap);
|
123
|
+
setActiveGroup(_options === null || _options === void 0 || (_options$2 = _options[0]) === null || _options$2 === void 0 ? void 0 : _options$2.value);
|
124
|
+
};
|
125
|
+
return Utils.debounce(fn, 350);
|
126
|
+
}, [options]);
|
127
|
+
var echo = function echo(value) {
|
128
|
+
var _inexistentItemMap = {};
|
129
|
+
value === null || value === void 0 || value.forEach(function (item) {
|
130
|
+
var v = labelInValue ? item.value : item,
|
131
|
+
l = labelInValue ? item.label || item.value : item;
|
132
|
+
if (!itemMap[v]) _inexistentItemMap[v] = {
|
133
|
+
value: v,
|
134
|
+
label: l
|
135
|
+
};
|
136
|
+
});
|
137
|
+
setSelected(value ? labelInValue ? value.map(function (item) {
|
138
|
+
return item.value;
|
139
|
+
}) : value : []);
|
140
|
+
setInexistentItemMap(_inexistentItemMap);
|
141
|
+
};
|
142
|
+
|
143
|
+
/* 回显 */
|
144
|
+
useEffect(function () {
|
145
|
+
echo(value);
|
146
|
+
}, [value]);
|
147
|
+
|
148
|
+
/* 更新选中项状态并触发change事件 */
|
149
|
+
var changeHandle = function changeHandle(v) {
|
150
|
+
// 若无需保留不存在值,则将不存在的项移除
|
151
|
+
var _v = reserved ? _toConsumableArray(v) : v.filter(function (i) {
|
152
|
+
return !!itemMap[i];
|
153
|
+
});
|
154
|
+
setSelected(_v);
|
155
|
+
onChange === null || onChange === void 0 || onChange(_v.length > 0 ? labelInValue ? _v.map(function (i) {
|
156
|
+
return itemMap[i] || inexistentItemMap[i];
|
157
|
+
}) : _v : undefined);
|
158
|
+
};
|
159
|
+
|
160
|
+
/* 拖拽结束事件 */
|
161
|
+
var dragEnd = function dragEnd(dragItem) {
|
162
|
+
var active = dragItem.active,
|
163
|
+
over = dragItem.over;
|
164
|
+
if (!active || !over) return;
|
165
|
+
if (active.id !== over.id) {
|
166
|
+
var _selected = _toConsumableArray(selected);
|
167
|
+
var activeIndex = _selected.findIndex(function (v) {
|
168
|
+
return v === active.id;
|
169
|
+
});
|
170
|
+
var overIndex = _selected.findIndex(function (v) {
|
171
|
+
return v === over.id;
|
172
|
+
});
|
173
|
+
changeHandle(arrayMove(_selected, activeIndex, overIndex));
|
174
|
+
}
|
175
|
+
};
|
176
|
+
return /*#__PURE__*/_jsxs("div", {
|
177
|
+
style: style,
|
178
|
+
className: "mc-group-panel ".concat(className || ''),
|
179
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
180
|
+
className: "mc-group-panel__options",
|
181
|
+
children: [/*#__PURE__*/_jsx("div", {
|
182
|
+
className: "mc-group-panel__card-header mc-group-panel__search-bar",
|
183
|
+
children: /*#__PURE__*/_jsx(Input, {
|
184
|
+
prefix: /*#__PURE__*/_jsx(SearchOutlined, {}),
|
185
|
+
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD",
|
186
|
+
allowClear: true,
|
187
|
+
autoComplete: "off",
|
188
|
+
value: searchValue,
|
189
|
+
onChange: function onChange(e) {
|
190
|
+
var v = e.target.value.trim();
|
191
|
+
setSearchValue(v);
|
192
|
+
if (v !== searchValue) {
|
193
|
+
debounceSearch(v);
|
194
|
+
}
|
195
|
+
}
|
196
|
+
})
|
197
|
+
}), _options.length > 0 ? /*#__PURE__*/_jsxs("div", {
|
198
|
+
className: "mc-group-panel__options-wrapper",
|
199
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
200
|
+
className: "mc-group-panel__options-groups",
|
201
|
+
children: [/*#__PURE__*/_jsx("div", {
|
202
|
+
className: "mc-group-panel__checkbox-wrapper",
|
203
|
+
children: /*#__PURE__*/_jsx(Checkbox, {
|
204
|
+
checked: allValues.length > 0 && allValues.every(function (v) {
|
205
|
+
return selected.includes(v);
|
206
|
+
}),
|
207
|
+
indeterminate: allValues.length > 0 && !allValues.every(function (v) {
|
208
|
+
return selected.includes(v);
|
209
|
+
}) && allValues.some(function (v) {
|
210
|
+
return selected.includes(v);
|
211
|
+
}),
|
212
|
+
onChange: function onChange(e) {
|
213
|
+
return changeHandle(e.target.checked ? Array.from(new Set([].concat(_toConsumableArray(selected), _toConsumableArray(allValues)))) : reserved ? selected.filter(function (i) {
|
214
|
+
return !itemMap[i];
|
215
|
+
}) : []);
|
216
|
+
},
|
217
|
+
disabled: disabled,
|
218
|
+
children: "\u5168\u9009"
|
219
|
+
})
|
220
|
+
}), /*#__PURE__*/_jsx("div", {
|
221
|
+
className: "mc-group-panel__options-list",
|
222
|
+
children: _options.map(function (item) {
|
223
|
+
var _groupMap$item$value, _groupMap$item$value2;
|
224
|
+
return /*#__PURE__*/_jsx("div", {
|
225
|
+
className: "mc-group-panel__checkbox-wrapper",
|
226
|
+
style: {
|
227
|
+
background: activeGroup === item.value ? '#EAEEFE' : ''
|
228
|
+
},
|
229
|
+
onClick: function onClick() {
|
230
|
+
return setActiveGroup(item.value);
|
231
|
+
},
|
232
|
+
children: /*#__PURE__*/_jsx(Checkbox, {
|
233
|
+
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) {
|
234
|
+
var value = _ref2.value;
|
235
|
+
return selected.includes(value);
|
236
|
+
}),
|
237
|
+
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) {
|
238
|
+
var value = _ref3.value;
|
239
|
+
return selected.includes(value);
|
240
|
+
}) && groupMap[item.value].some(function (_ref4) {
|
241
|
+
var value = _ref4.value;
|
242
|
+
return selected.includes(value);
|
243
|
+
}),
|
244
|
+
onChange: function onChange(e) {
|
245
|
+
var _groupMap$item$value3;
|
246
|
+
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) {
|
247
|
+
var value = _ref5.value;
|
248
|
+
return value;
|
249
|
+
})) || [])))) : selected.filter(function (i) {
|
250
|
+
var _groupMap$item$value4;
|
251
|
+
return !((_groupMap$item$value4 = groupMap[item.value]) !== null && _groupMap$item$value4 !== void 0 && _groupMap$item$value4.some(function (_ref6) {
|
252
|
+
var value = _ref6.value;
|
253
|
+
return value === i;
|
254
|
+
}));
|
255
|
+
}));
|
256
|
+
},
|
257
|
+
disabled: disabled,
|
258
|
+
children: /*#__PURE__*/_jsx(Typography.Paragraph, {
|
259
|
+
style: {
|
260
|
+
margin: 0
|
261
|
+
},
|
262
|
+
ellipsis: {
|
263
|
+
tooltip: item.label
|
264
|
+
},
|
265
|
+
children: item.label
|
266
|
+
})
|
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, {
|
274
|
+
children: [/*#__PURE__*/_jsx("div", {
|
275
|
+
className: "mc-group-panel__checkbox-wrapper",
|
276
|
+
children: /*#__PURE__*/_jsx(Checkbox, {
|
277
|
+
checked: ((_groupMap$activeGroup2 = groupMap[activeGroup]) === null || _groupMap$activeGroup2 === void 0 ? void 0 : _groupMap$activeGroup2.length) > 0 && groupMap[activeGroup].every(function (_ref7) {
|
278
|
+
var value = _ref7.value;
|
279
|
+
return selected.includes(value);
|
280
|
+
}),
|
281
|
+
indeterminate: ((_groupMap$activeGroup3 = groupMap[activeGroup]) === null || _groupMap$activeGroup3 === void 0 ? void 0 : _groupMap$activeGroup3.length) > 0 && !groupMap[activeGroup].every(function (_ref8) {
|
282
|
+
var value = _ref8.value;
|
283
|
+
return selected.includes(value);
|
284
|
+
}) && groupMap[activeGroup].some(function (_ref9) {
|
285
|
+
var value = _ref9.value;
|
286
|
+
return selected.includes(value);
|
287
|
+
}),
|
288
|
+
onChange: function onChange(e) {
|
289
|
+
var _groupMap$activeGroup4;
|
290
|
+
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) {
|
291
|
+
var value = _ref10.value;
|
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
|
+
}));
|
300
|
+
},
|
301
|
+
disabled: disabled,
|
302
|
+
children: "\u5168\u9009"
|
303
|
+
})
|
304
|
+
}), /*#__PURE__*/_jsx("div", {
|
305
|
+
className: "mc-group-panel__options-list",
|
306
|
+
children: groupMap[activeGroup].map(function (item) {
|
307
|
+
return /*#__PURE__*/_jsx(Checkbox, {
|
308
|
+
className: "mc-group-panel__checkbox",
|
309
|
+
checked: selected.includes(item.value),
|
310
|
+
onChange: function onChange(e) {
|
311
|
+
return changeHandle(e.target.checked ? [].concat(_toConsumableArray(selected), [item.value]) : selected.filter(function (i) {
|
312
|
+
return i !== item.value;
|
313
|
+
}));
|
314
|
+
},
|
315
|
+
disabled: disabled,
|
316
|
+
children: /*#__PURE__*/_jsx(Typography.Paragraph, {
|
317
|
+
style: {
|
318
|
+
margin: 0
|
319
|
+
},
|
320
|
+
ellipsis: {
|
321
|
+
tooltip: item.label
|
322
|
+
},
|
323
|
+
children: item.label
|
324
|
+
})
|
325
|
+
}, item.value);
|
326
|
+
})
|
327
|
+
})]
|
328
|
+
}) : /*#__PURE__*/_jsx("div", {
|
329
|
+
style: {
|
330
|
+
height: '100%',
|
331
|
+
display: 'grid',
|
332
|
+
placeItems: 'center'
|
333
|
+
},
|
334
|
+
children: /*#__PURE__*/_jsx(Empty, {
|
335
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE
|
336
|
+
})
|
337
|
+
})
|
338
|
+
})]
|
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
|
+
})]
|
349
|
+
}), /*#__PURE__*/_jsxs("div", {
|
350
|
+
className: "mc-group-panel__selected",
|
351
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
352
|
+
className: "mc-group-panel__card-header",
|
353
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
354
|
+
className: "mc-group-panel__card-title",
|
355
|
+
children: ["\u5DF2\u9009", selected.length, "\u9879"]
|
356
|
+
}), /*#__PURE__*/_jsx(Button, {
|
357
|
+
type: "link",
|
358
|
+
onClick: function onClick() {
|
359
|
+
return changeHandle(reserved ? selected.filter(function (i) {
|
360
|
+
return !itemMap[i];
|
361
|
+
}) : []);
|
362
|
+
},
|
363
|
+
disabled: disabled,
|
364
|
+
children: "\u6E05\u7A7A"
|
365
|
+
})]
|
366
|
+
}), selected.length > 0 ? /*#__PURE__*/_jsx(DndContext, {
|
367
|
+
onDragEnd: dragEnd,
|
368
|
+
children: /*#__PURE__*/_jsx(SortableContext, {
|
369
|
+
items: selected,
|
370
|
+
strategy: verticalListSortingStrategy,
|
371
|
+
children: /*#__PURE__*/_jsx("div", {
|
372
|
+
style: {
|
373
|
+
overflowX: 'hidden'
|
374
|
+
},
|
375
|
+
className: "mc-group-panel__card-body",
|
376
|
+
children: selected.map(function (v) {
|
377
|
+
return /*#__PURE__*/_jsx(SelectedItem, {
|
378
|
+
sortable: sortable,
|
379
|
+
itemMap: itemMap,
|
380
|
+
inexistent: inexistent,
|
381
|
+
text: text,
|
382
|
+
color: color,
|
383
|
+
reserved: reserved,
|
384
|
+
inexistentItemMap: inexistentItemMap,
|
385
|
+
value: v,
|
386
|
+
onRemove: function onRemove() {
|
387
|
+
return changeHandle(selected.filter(function (i) {
|
388
|
+
return i !== v;
|
389
|
+
}));
|
390
|
+
}
|
391
|
+
}, v);
|
392
|
+
})
|
393
|
+
})
|
394
|
+
})
|
395
|
+
}) : /*#__PURE__*/_jsx("div", {
|
396
|
+
style: {
|
397
|
+
height: 'calc(100% - 40px)',
|
398
|
+
display: 'grid',
|
399
|
+
placeItems: 'center'
|
400
|
+
},
|
401
|
+
children: /*#__PURE__*/_jsx(Empty, {
|
402
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
403
|
+
description: "\u8BF7\u9009\u62E9"
|
404
|
+
})
|
405
|
+
})]
|
406
|
+
}), disabled && /*#__PURE__*/_jsx("div", {
|
407
|
+
className: "mc-group-panel--disabled"
|
408
|
+
})]
|
409
|
+
});
|
410
|
+
};
|
411
|
+
export default McGroupPanel;
|