@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,167 @@
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4
|
+
var _excluded = ["style", "className", "label", "valueFormat", "value", "onChange", "onShortcut", "disabled"];
|
5
|
+
import { DatePicker } from 'antd';
|
6
|
+
import dayjs from 'dayjs';
|
7
|
+
import { forwardRef, useEffect, useRef, useState } from 'react';
|
8
|
+
import "./index.css";
|
9
|
+
|
10
|
+
/* 快捷选择日期对应值的映射集合 */
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
12
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
13
|
+
var shortcutValueMap = {
|
14
|
+
today: [dayjs().format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')],
|
15
|
+
yesterday: [dayjs().add(-1, 'd').format('YYYY-MM-DD'), dayjs().add(-1, 'd').format('YYYY-MM-DD')],
|
16
|
+
last7days: [dayjs().add(-6, 'd').format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')],
|
17
|
+
last30days: [dayjs().add(-29, 'd').format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')],
|
18
|
+
last60days: [dayjs().add(-59, 'd').format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')],
|
19
|
+
last90days: [dayjs().add(-89, 'd').format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')]
|
20
|
+
};
|
21
|
+
export var SHORTCUTprivateValue_MAP = shortcutValueMap;
|
22
|
+
var McDateRange = /*#__PURE__*/forwardRef(function (props, ref) {
|
23
|
+
var style = props.style,
|
24
|
+
className = props.className,
|
25
|
+
label = props.label,
|
26
|
+
_props$valueFormat = props.valueFormat,
|
27
|
+
valueFormat = _props$valueFormat === void 0 ? 'YYYY-MM-DD' : _props$valueFormat,
|
28
|
+
value = props.value,
|
29
|
+
onChange = props.onChange,
|
30
|
+
onShortcut = props.onShortcut,
|
31
|
+
disabled = props.disabled,
|
32
|
+
rest = _objectWithoutProperties(props, _excluded);
|
33
|
+
|
34
|
+
/* 获取label宽度 */
|
35
|
+
var labelRef = useRef();
|
36
|
+
var _useState = useState(11),
|
37
|
+
_useState2 = _slicedToArray(_useState, 2),
|
38
|
+
paddingLeft = _useState2[0],
|
39
|
+
setPaddingLeft = _useState2[1];
|
40
|
+
var labelResizeObserver = new ResizeObserver(function (entries) {
|
41
|
+
setPaddingLeft(entries[0].contentRect.width + 11);
|
42
|
+
});
|
43
|
+
useEffect(function () {
|
44
|
+
if (labelRef.current) {
|
45
|
+
labelResizeObserver.observe(labelRef.current);
|
46
|
+
}
|
47
|
+
return function () {
|
48
|
+
return labelResizeObserver.disconnect();
|
49
|
+
};
|
50
|
+
}, []);
|
51
|
+
var _useState3 = useState(),
|
52
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
53
|
+
privateValue = _useState4[0],
|
54
|
+
setPrivateValue = _useState4[1];
|
55
|
+
var currentRef = useRef();
|
56
|
+
var oldRef = useRef();
|
57
|
+
var isShortcutRef = useRef(false);
|
58
|
+
useEffect(function () {
|
59
|
+
var tempValue = value ? value === null || value === void 0 ? void 0 : value.map(function (i) {
|
60
|
+
return dayjs(i, valueFormat);
|
61
|
+
}) : null;
|
62
|
+
setPrivateValue(tempValue);
|
63
|
+
currentRef.current = tempValue;
|
64
|
+
}, [value]);
|
65
|
+
var change = function change(dates) {
|
66
|
+
if (!props.hasOwnProperty('value')) {
|
67
|
+
setPrivateValue(dates);
|
68
|
+
}
|
69
|
+
currentRef.current = dates;
|
70
|
+
// 当清空时
|
71
|
+
if (dates === null) {
|
72
|
+
if (props.hasOwnProperty('value')) {
|
73
|
+
setPrivateValue(value ? value === null || value === void 0 ? void 0 : value.map(function (i) {
|
74
|
+
return dayjs(i, valueFormat);
|
75
|
+
}) : null);
|
76
|
+
}
|
77
|
+
onChange === null || onChange === void 0 || onChange(null);
|
78
|
+
onShortcut === null || onShortcut === void 0 || onShortcut(undefined);
|
79
|
+
isShortcutRef.current = false;
|
80
|
+
}
|
81
|
+
};
|
82
|
+
var openChange = function openChange(open) {
|
83
|
+
if (open) {
|
84
|
+
oldRef.current = privateValue;
|
85
|
+
} else {
|
86
|
+
if (currentRef.current && currentRef.current !== oldRef.current) {
|
87
|
+
onChange === null || onChange === void 0 || onChange(currentRef.current.map(function (i) {
|
88
|
+
return i.format(valueFormat);
|
89
|
+
}), currentRef.current);
|
90
|
+
if (!isShortcutRef.current) {
|
91
|
+
onShortcut === null || onShortcut === void 0 || onShortcut(undefined);
|
92
|
+
}
|
93
|
+
isShortcutRef.current = false;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
};
|
97
|
+
var shortcut = function shortcut(type) {
|
98
|
+
isShortcutRef.current = true;
|
99
|
+
onShortcut === null || onShortcut === void 0 || onShortcut(type);
|
100
|
+
};
|
101
|
+
return /*#__PURE__*/_jsxs("div", {
|
102
|
+
style: _objectSpread({
|
103
|
+
position: label ? 'relative' : 'static',
|
104
|
+
height: 32
|
105
|
+
}, style),
|
106
|
+
className: "mc-date-range ".concat(className || ''),
|
107
|
+
children: [label && /*#__PURE__*/_jsx("span", {
|
108
|
+
ref: labelRef,
|
109
|
+
className: "mc-date-range__label ".concat(disabled ? 'mc-date-range--disabled' : ''),
|
110
|
+
children: label
|
111
|
+
}), /*#__PURE__*/_jsx(DatePicker.RangePicker, _objectSpread({
|
112
|
+
ref: ref,
|
113
|
+
style: {
|
114
|
+
paddingLeft: paddingLeft
|
115
|
+
},
|
116
|
+
className: "mc-date-range__content",
|
117
|
+
value: privateValue,
|
118
|
+
onChange: change,
|
119
|
+
onOpenChange: openChange,
|
120
|
+
disabled: disabled,
|
121
|
+
presets: [{
|
122
|
+
label: /*#__PURE__*/_jsx("div", {
|
123
|
+
className: "mc-date-range__preset-label",
|
124
|
+
onClick: shortcut.bind(null, 'today'),
|
125
|
+
children: "\u4ECA\u5929"
|
126
|
+
}),
|
127
|
+
value: [dayjs(), dayjs()]
|
128
|
+
}, {
|
129
|
+
label: /*#__PURE__*/_jsx("div", {
|
130
|
+
className: "mc-date-range__preset-label",
|
131
|
+
onClick: shortcut === null || shortcut === void 0 ? void 0 : shortcut.bind(null, 'yesterday'),
|
132
|
+
children: "\u6628\u5929"
|
133
|
+
}),
|
134
|
+
value: [dayjs().add(-1, 'd'), dayjs().add(-1, 'd')]
|
135
|
+
}, {
|
136
|
+
label: /*#__PURE__*/_jsx("div", {
|
137
|
+
className: "mc-date-range__preset-label",
|
138
|
+
onClick: shortcut === null || shortcut === void 0 ? void 0 : shortcut.bind(null, 'last7days'),
|
139
|
+
children: "\u6700\u8FD17\u5929"
|
140
|
+
}),
|
141
|
+
value: [dayjs().add(-6, 'd'), dayjs()]
|
142
|
+
}, {
|
143
|
+
label: /*#__PURE__*/_jsx("div", {
|
144
|
+
className: "mc-date-range__preset-label",
|
145
|
+
onClick: shortcut === null || shortcut === void 0 ? void 0 : shortcut.bind(null, 'last30days'),
|
146
|
+
children: "\u6700\u8FD130\u5929"
|
147
|
+
}),
|
148
|
+
value: [dayjs().add(-29, 'd'), dayjs()]
|
149
|
+
}, {
|
150
|
+
label: /*#__PURE__*/_jsx("div", {
|
151
|
+
className: "mc-date-range__preset-label",
|
152
|
+
onClick: shortcut === null || shortcut === void 0 ? void 0 : shortcut.bind(null, 'last60days'),
|
153
|
+
children: "\u6700\u8FD160\u5929"
|
154
|
+
}),
|
155
|
+
value: [dayjs().add(-59, 'd'), dayjs()]
|
156
|
+
}, {
|
157
|
+
label: /*#__PURE__*/_jsx("div", {
|
158
|
+
className: "mc-date-range__preset-label",
|
159
|
+
onClick: shortcut === null || shortcut === void 0 ? void 0 : shortcut.bind(null, 'last90days'),
|
160
|
+
children: "\u6700\u8FD190\u5929"
|
161
|
+
}),
|
162
|
+
value: [dayjs().add(-89, 'd'), dayjs()]
|
163
|
+
}]
|
164
|
+
}, rest))]
|
165
|
+
});
|
166
|
+
});
|
167
|
+
export default McDateRange;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { default as Bold } from "./public/SourceHanSansCN-Bold.otf";
|
2
|
+
import { default as Light } from "./public/SourceHanSansCN-Light.otf";
|
3
|
+
import { default as Medium } from "./public/SourceHanSansCN-Medium.otf";
|
4
|
+
import { default as Regular } from "./public/SourceHanSansCN-Regular.otf";
|
5
|
+
export default {
|
6
|
+
Regular: Regular,
|
7
|
+
Bold: Bold,
|
8
|
+
Light: Light,
|
9
|
+
Medium: Medium
|
10
|
+
};
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,4 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import '../../index.less';
|
3
|
+
declare const _default: import("react").MemoExoticComponent<({ sortable, itemMap, inexistent, text, color, reserved, inexistentItemMap, value, onRemove, }: any) => import("react/jsx-runtime").JSX.Element>;
|
4
|
+
export default _default;
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
+
import { useSortable } from '@dnd-kit/sortable';
|
3
|
+
import { Button, Typography } from 'antd';
|
4
|
+
import { McIconFont } from "../../..";
|
5
|
+
import { memo, useMemo } from 'react';
|
6
|
+
import "../../index.css";
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
|
+
var SelectedItem = function SelectedItem(_ref) {
|
10
|
+
var sortable = _ref.sortable,
|
11
|
+
itemMap = _ref.itemMap,
|
12
|
+
inexistent = _ref.inexistent,
|
13
|
+
text = _ref.text,
|
14
|
+
color = _ref.color,
|
15
|
+
reserved = _ref.reserved,
|
16
|
+
inexistentItemMap = _ref.inexistentItemMap,
|
17
|
+
value = _ref.value,
|
18
|
+
onRemove = _ref.onRemove;
|
19
|
+
var _label = useMemo(function () {
|
20
|
+
var _itemMap$value, _inexistentItemMap$va;
|
21
|
+
var label = ((_itemMap$value = itemMap[value]) === null || _itemMap$value === void 0 ? void 0 : _itemMap$value.label) || "".concat((_inexistentItemMap$va = inexistentItemMap[value]) === null || _inexistentItemMap$va === void 0 ? void 0 : _inexistentItemMap$va.label).concat(inexistent && !reserved ? "\u300C".concat(text, "\u300D") : '');
|
22
|
+
var fn = function fn() {
|
23
|
+
var isTooltip = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
24
|
+
return /*#__PURE__*/_jsx("span", {
|
25
|
+
style: {
|
26
|
+
color: !itemMap[value] && inexistent && !reserved ? color : isTooltip ? '#ffffff' : '#262626'
|
27
|
+
},
|
28
|
+
children: label
|
29
|
+
});
|
30
|
+
};
|
31
|
+
return fn;
|
32
|
+
}, [itemMap, inexistent, text, color, reserved, inexistentItemMap, value]);
|
33
|
+
var _useSortable = useSortable({
|
34
|
+
id: value
|
35
|
+
}),
|
36
|
+
setNodeRef = _useSortable.setNodeRef,
|
37
|
+
attributes = _useSortable.attributes,
|
38
|
+
listeners = _useSortable.listeners,
|
39
|
+
transform = _useSortable.transform,
|
40
|
+
transition = _useSortable.transition,
|
41
|
+
isDragging = _useSortable.isDragging;
|
42
|
+
var style = transform ? {
|
43
|
+
transform: "translate3d(".concat(transform.x, "px, ").concat(transform.y, "px, 0)"),
|
44
|
+
transition: isDragging ? 'unset' : transition
|
45
|
+
} : {
|
46
|
+
transition: 'unset'
|
47
|
+
};
|
48
|
+
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
49
|
+
ref: setNodeRef,
|
50
|
+
style: style
|
51
|
+
}, attributes), {}, {
|
52
|
+
className: "mc-group-panel__selected-item",
|
53
|
+
children: [sortable && /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({}, listeners), {}, {
|
54
|
+
className: "mc-group-panel__selected-item__drag",
|
55
|
+
type: "text",
|
56
|
+
icon: /*#__PURE__*/_jsx(McIconFont, {
|
57
|
+
type: "icon-MenuOutlined"
|
58
|
+
})
|
59
|
+
})), /*#__PURE__*/_jsx(Typography.Paragraph, {
|
60
|
+
style: {
|
61
|
+
margin: '0 auto 0 4px'
|
62
|
+
},
|
63
|
+
ellipsis: {
|
64
|
+
tooltip: _label(true)
|
65
|
+
},
|
66
|
+
children: _label()
|
67
|
+
}), /*#__PURE__*/_jsx(McIconFont, {
|
68
|
+
className: "mc-group-panel__selected-item__remove",
|
69
|
+
type: "icon-CloseOutlined",
|
70
|
+
onClick: onRemove
|
71
|
+
}), !itemMap[value] && reserved && /*#__PURE__*/_jsx("div", {
|
72
|
+
className: "mc-group-panel__selected-item--disabled"
|
73
|
+
})]
|
74
|
+
}));
|
75
|
+
};
|
76
|
+
export default /*#__PURE__*/memo(SelectedItem);
|
@@ -0,0 +1,162 @@
|
|
1
|
+
.mc-group-panel {
|
2
|
+
width: 100%;
|
3
|
+
height: 329px;
|
4
|
+
display: -webkit-box;
|
5
|
+
display: -ms-flexbox;
|
6
|
+
display: flex;
|
7
|
+
-webkit-column-gap: 8px;
|
8
|
+
-moz-column-gap: 8px;
|
9
|
+
column-gap: 8px;
|
10
|
+
position: relative;
|
11
|
+
}
|
12
|
+
.mc-group-panel__card-header {
|
13
|
+
height: 40px;
|
14
|
+
background: #fafafa;
|
15
|
+
padding: 0 16px;
|
16
|
+
display: -webkit-box;
|
17
|
+
display: -ms-flexbox;
|
18
|
+
display: flex;
|
19
|
+
-webkit-box-align: center;
|
20
|
+
-ms-flex-align: center;
|
21
|
+
align-items: center;
|
22
|
+
-webkit-box-pack: justify;
|
23
|
+
-ms-flex-pack: justify;
|
24
|
+
justify-content: space-between;
|
25
|
+
}
|
26
|
+
.mc-group-panel__card-title {
|
27
|
+
color: rgba(0, 0, 0, 0.847);
|
28
|
+
font-weight: 600;
|
29
|
+
}
|
30
|
+
.mc-group-panel__card-body {
|
31
|
+
height: calc(100% - 40px);
|
32
|
+
padding: 8px;
|
33
|
+
}
|
34
|
+
.mc-group-panel__options {
|
35
|
+
border-radius: 4px;
|
36
|
+
border: 1px solid #ebebeb;
|
37
|
+
overflow: hidden;
|
38
|
+
-webkit-box-flex: 1;
|
39
|
+
-ms-flex: 1;
|
40
|
+
flex: 1;
|
41
|
+
}
|
42
|
+
.mc-group-panel__options-wrapper {
|
43
|
+
display: -webkit-box;
|
44
|
+
display: -ms-flexbox;
|
45
|
+
display: flex;
|
46
|
+
height: calc(100% - 40px);
|
47
|
+
}
|
48
|
+
.mc-group-panel__options-groups {
|
49
|
+
-webkit-box-flex: 1;
|
50
|
+
-ms-flex: 1 1 44%;
|
51
|
+
flex: 1 1 44%;
|
52
|
+
}
|
53
|
+
.mc-group-panel__options-items {
|
54
|
+
-webkit-box-flex: 1;
|
55
|
+
-ms-flex: 1 1 56%;
|
56
|
+
flex: 1 1 56%;
|
57
|
+
border-left: 1px solid #ebebeb;
|
58
|
+
overflow: auto;
|
59
|
+
}
|
60
|
+
.mc-group-panel__options-list {
|
61
|
+
height: calc(100% - 40px);
|
62
|
+
overflow: auto;
|
63
|
+
}
|
64
|
+
.mc-group-panel__search-bar {
|
65
|
+
padding: 0 8px;
|
66
|
+
}
|
67
|
+
.mc-group-panel__checkbox-wrapper {
|
68
|
+
width: calc(100% - 24px);
|
69
|
+
height: 40px;
|
70
|
+
line-height: 40px;
|
71
|
+
padding: 0 12px;
|
72
|
+
}
|
73
|
+
.mc-group-panel__checkbox-wrapper .ant-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 {
|
80
|
+
background: #f6f6f6;
|
81
|
+
cursor: pointer;
|
82
|
+
}
|
83
|
+
.mc-group-panel__checkbox {
|
84
|
+
width: calc(100% - 24px);
|
85
|
+
height: 40px;
|
86
|
+
-webkit-box-align: center;
|
87
|
+
-ms-flex-align: center;
|
88
|
+
align-items: center;
|
89
|
+
padding: 0 12px;
|
90
|
+
}
|
91
|
+
.mc-group-panel__checkbox .ant-checkbox + span {
|
92
|
+
overflow: hidden;
|
93
|
+
}
|
94
|
+
.mc-group-panel__checkbox:hover {
|
95
|
+
background: #f6f6f6;
|
96
|
+
}
|
97
|
+
.mc-group-panel__selected {
|
98
|
+
border-radius: 4px;
|
99
|
+
border: 1px solid #ebebeb;
|
100
|
+
overflow: hidden;
|
101
|
+
width: 240px;
|
102
|
+
}
|
103
|
+
.mc-group-panel__selected-item {
|
104
|
+
width: calc(100% - 16px);
|
105
|
+
height: 40px;
|
106
|
+
display: -webkit-box;
|
107
|
+
display: -ms-flexbox;
|
108
|
+
display: flex;
|
109
|
+
-webkit-box-align: center;
|
110
|
+
-ms-flex-align: center;
|
111
|
+
align-items: center;
|
112
|
+
padding: 0 8px;
|
113
|
+
background: #f5f5f5;
|
114
|
+
border-radius: 4px;
|
115
|
+
overflow: hidden;
|
116
|
+
position: relative;
|
117
|
+
}
|
118
|
+
.mc-group-panel__selected-item:not(:first-child) {
|
119
|
+
margin-top: 8px;
|
120
|
+
}
|
121
|
+
.mc-group-panel__selected-item__drag {
|
122
|
+
-ms-flex-negative: 0;
|
123
|
+
flex-shrink: 0;
|
124
|
+
color: #8c8c8c;
|
125
|
+
padding: 5px 0 3px;
|
126
|
+
}
|
127
|
+
.mc-group-panel__selected-item__drag:hover {
|
128
|
+
background: rgba(38, 38, 38, 0.15) !important;
|
129
|
+
cursor: move;
|
130
|
+
}
|
131
|
+
.mc-group-panel__selected-item__remove {
|
132
|
+
-ms-flex-negative: 0;
|
133
|
+
flex-shrink: 0;
|
134
|
+
color: #8c8c8c;
|
135
|
+
margin-left: 8px;
|
136
|
+
}
|
137
|
+
.mc-group-panel__selected-item__remove:hover {
|
138
|
+
cursor: pointer;
|
139
|
+
color: #262626;
|
140
|
+
}
|
141
|
+
.mc-group-panel__selected-item--disabled {
|
142
|
+
position: absolute;
|
143
|
+
top: 0;
|
144
|
+
right: 0;
|
145
|
+
bottom: 0;
|
146
|
+
left: 0;
|
147
|
+
z-index: 9;
|
148
|
+
border-radius: 4px;
|
149
|
+
background: rgba(246, 246, 246, 0.66);
|
150
|
+
cursor: no-drop;
|
151
|
+
}
|
152
|
+
.mc-group-panel--disabled {
|
153
|
+
position: absolute;
|
154
|
+
top: 0;
|
155
|
+
right: 0;
|
156
|
+
bottom: 0;
|
157
|
+
left: 0;
|
158
|
+
z-index: 9;
|
159
|
+
border-radius: 4px;
|
160
|
+
background: rgba(228, 228, 228, 0.3);
|
161
|
+
cursor: no-drop;
|
162
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { CSSProperties, FC } from 'react';
|
2
|
+
import './index.less';
|
3
|
+
type Option = {
|
4
|
+
value: any;
|
5
|
+
label: string;
|
6
|
+
[key: string]: any;
|
7
|
+
};
|
8
|
+
type Options = Array<Option & {
|
9
|
+
children: Option[];
|
10
|
+
}>;
|
11
|
+
type Inexistent = {
|
12
|
+
text?: string;
|
13
|
+
color?: string;
|
14
|
+
reserved?: boolean;
|
15
|
+
};
|
16
|
+
type PropsType = {
|
17
|
+
style?: CSSProperties;
|
18
|
+
className?: string;
|
19
|
+
options?: Options;
|
20
|
+
disabled?: boolean;
|
21
|
+
labelInValue?: boolean;
|
22
|
+
inexistent?: boolean | Inexistent;
|
23
|
+
sortable?: boolean;
|
24
|
+
value?: any[];
|
25
|
+
onChange?: (value?: any[]) => void;
|
26
|
+
[key: string]: any;
|
27
|
+
};
|
28
|
+
declare const McGroupPanel: FC<PropsType>;
|
29
|
+
export default McGroupPanel;
|