@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,189 @@
|
|
1
|
+
.mc-period-select {
|
2
|
+
width: 960px;
|
3
|
+
background: #fff;
|
4
|
+
border: 1px solid #ebebeb;
|
5
|
+
border-radius: 4px;
|
6
|
+
}
|
7
|
+
.mc-period-select__header {
|
8
|
+
display: -webkit-box;
|
9
|
+
display: -ms-flexbox;
|
10
|
+
display: flex;
|
11
|
+
height: 68px;
|
12
|
+
color: rgba(0, 0, 0, 0.847);
|
13
|
+
font-weight: bold;
|
14
|
+
font-size: 14px;
|
15
|
+
border-bottom: 1px solid #ebebeb;
|
16
|
+
}
|
17
|
+
.mc-period-select__title {
|
18
|
+
-ms-flex-negative: 0;
|
19
|
+
flex-shrink: 0;
|
20
|
+
width: 95px;
|
21
|
+
line-height: 68px;
|
22
|
+
text-align: center;
|
23
|
+
border-right: 1px solid #ebebeb;
|
24
|
+
}
|
25
|
+
.mc-period-select__subtitle-box {
|
26
|
+
-webkit-box-flex: 1;
|
27
|
+
-ms-flex: 1;
|
28
|
+
flex: 1;
|
29
|
+
}
|
30
|
+
.mc-period-select__time-bar {
|
31
|
+
display: -webkit-box;
|
32
|
+
display: -ms-flexbox;
|
33
|
+
display: flex;
|
34
|
+
border-bottom: 1px solid #ebebeb;
|
35
|
+
}
|
36
|
+
.mc-period-select__time-bar div {
|
37
|
+
-webkit-box-flex: 1;
|
38
|
+
-ms-flex: 1;
|
39
|
+
flex: 1;
|
40
|
+
height: 40px;
|
41
|
+
line-height: 40px;
|
42
|
+
text-align: center;
|
43
|
+
}
|
44
|
+
.mc-period-select__time-bar div:last-child {
|
45
|
+
border-left: 1px solid #ebebeb;
|
46
|
+
}
|
47
|
+
.mc-period-select__hour-bar {
|
48
|
+
display: -webkit-box;
|
49
|
+
display: -ms-flexbox;
|
50
|
+
display: flex;
|
51
|
+
}
|
52
|
+
.mc-period-select__hour-bar div {
|
53
|
+
width: 36px;
|
54
|
+
height: 27px;
|
55
|
+
color: rgba(0, 0, 0, 0.65);
|
56
|
+
font-weight: normal;
|
57
|
+
font-size: 12px;
|
58
|
+
line-height: 27px;
|
59
|
+
text-align: center;
|
60
|
+
}
|
61
|
+
.mc-period-select__body {
|
62
|
+
display: -webkit-box;
|
63
|
+
display: -ms-flexbox;
|
64
|
+
display: flex;
|
65
|
+
}
|
66
|
+
.mc-period-select__side-bar {
|
67
|
+
width: 95px;
|
68
|
+
border-right: 1px solid #ebebeb;
|
69
|
+
}
|
70
|
+
.mc-period-select__side-bar div {
|
71
|
+
height: 52px;
|
72
|
+
color: rgba(0, 0, 0, 0.65);
|
73
|
+
line-height: 52px;
|
74
|
+
text-align: center;
|
75
|
+
background: #f9f9f9;
|
76
|
+
border-bottom: 1px solid #ebebeb;
|
77
|
+
}
|
78
|
+
.mc-period-select__side-bar div:last-child {
|
79
|
+
border-bottom: 0;
|
80
|
+
}
|
81
|
+
.mc-period-select__wrapper {
|
82
|
+
-webkit-box-flex: 1;
|
83
|
+
-ms-flex: 1;
|
84
|
+
flex: 1;
|
85
|
+
}
|
86
|
+
.mc-period-select__day {
|
87
|
+
display: -webkit-box;
|
88
|
+
display: -ms-flexbox;
|
89
|
+
display: flex;
|
90
|
+
}
|
91
|
+
.mc-period-select__day:last-child .mc-period-select__item {
|
92
|
+
border-bottom: 0;
|
93
|
+
}
|
94
|
+
.mc-period-select__item {
|
95
|
+
position: relative;
|
96
|
+
-webkit-box-flex: 1;
|
97
|
+
-ms-flex: 1;
|
98
|
+
flex: 1;
|
99
|
+
height: 52px;
|
100
|
+
background: #f9f9f9;
|
101
|
+
border-right: 1px solid #ebebeb;
|
102
|
+
border-bottom: 1px solid #ebebeb;
|
103
|
+
}
|
104
|
+
.mc-period-select__item__mask {
|
105
|
+
position: absolute;
|
106
|
+
top: 0;
|
107
|
+
right: 0;
|
108
|
+
bottom: 0;
|
109
|
+
left: 0;
|
110
|
+
display: none;
|
111
|
+
background: #91caff;
|
112
|
+
opacity: 0.5;
|
113
|
+
}
|
114
|
+
.mc-period-select__item:last-child {
|
115
|
+
border-right: 0;
|
116
|
+
}
|
117
|
+
.mc-period-select__item.mc-period-select__item--selected {
|
118
|
+
background: #325cf7;
|
119
|
+
}
|
120
|
+
.mc-period-select__item.mc-period-select__item--active .mc-period-select__item__mask {
|
121
|
+
display: block;
|
122
|
+
}
|
123
|
+
.mc-period-select__footer {
|
124
|
+
padding: 24px;
|
125
|
+
border-top: 1px solid #ebebeb;
|
126
|
+
}
|
127
|
+
.mc-period-select__action-bar {
|
128
|
+
display: -webkit-box;
|
129
|
+
display: -ms-flexbox;
|
130
|
+
display: flex;
|
131
|
+
-webkit-box-align: center;
|
132
|
+
-ms-flex-align: center;
|
133
|
+
align-items: center;
|
134
|
+
-webkit-box-pack: justify;
|
135
|
+
-ms-flex-pack: justify;
|
136
|
+
justify-content: space-between;
|
137
|
+
color: rgba(0, 0, 0, 0.428);
|
138
|
+
}
|
139
|
+
.mc-period-select__selected-item {
|
140
|
+
display: -webkit-box;
|
141
|
+
display: -ms-flexbox;
|
142
|
+
display: flex;
|
143
|
+
margin-top: 16px;
|
144
|
+
padding: 5px 8px;
|
145
|
+
color: rgba(0, 0, 0, 0.85);
|
146
|
+
line-height: 22px;
|
147
|
+
background: #f5f5f5;
|
148
|
+
border-radius: 4px;
|
149
|
+
}
|
150
|
+
.mc-period-select__selected-item__title {
|
151
|
+
-ms-flex-negative: 0;
|
152
|
+
flex-shrink: 0;
|
153
|
+
margin-right: 8px;
|
154
|
+
}
|
155
|
+
.mc-period-select__selected-item__content {
|
156
|
+
-webkit-box-flex: 1;
|
157
|
+
-ms-flex: 1;
|
158
|
+
flex: 1;
|
159
|
+
margin-right: 16px;
|
160
|
+
}
|
161
|
+
.mc-period-select__selected-item__remove {
|
162
|
+
height: 22px;
|
163
|
+
margin-left: auto;
|
164
|
+
color: #8c8c8c;
|
165
|
+
}
|
166
|
+
.mc-period-select__selected-item__remove:hover {
|
167
|
+
color: #262626;
|
168
|
+
cursor: pointer;
|
169
|
+
}
|
170
|
+
.mc-period-select.mc-period-select--disabled {
|
171
|
+
position: relative;
|
172
|
+
-webkit-user-select: none;
|
173
|
+
-moz-user-select: none;
|
174
|
+
-ms-user-select: none;
|
175
|
+
user-select: none;
|
176
|
+
}
|
177
|
+
.mc-period-select.mc-period-select--disabled::before {
|
178
|
+
position: absolute;
|
179
|
+
display: block;
|
180
|
+
right: 0;
|
181
|
+
bottom: 0;
|
182
|
+
left: 0;
|
183
|
+
z-index: 1000;
|
184
|
+
width: 100%;
|
185
|
+
height: 100%;
|
186
|
+
background: rgba(0, 0, 0, 0.04);
|
187
|
+
cursor: not-allowed;
|
188
|
+
content: '';
|
189
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { CSSProperties, FC } from 'react';
|
2
|
+
import './index.less';
|
3
|
+
type PropsType = {
|
4
|
+
style?: CSSProperties;
|
5
|
+
className?: string;
|
6
|
+
half?: boolean;
|
7
|
+
value?: string;
|
8
|
+
onChange?: (value?: string) => void;
|
9
|
+
disabled?: boolean;
|
10
|
+
[key: string]: any;
|
11
|
+
};
|
12
|
+
declare const McPeriodSelect: FC<PropsType>;
|
13
|
+
export default McPeriodSelect;
|
@@ -0,0 +1,305 @@
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
4
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
5
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
6
|
+
import { Button } from 'antd';
|
7
|
+
import { McIconFont } from "./..";
|
8
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
9
|
+
import "./index.css";
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
12
|
+
var getHours = function getHours() {
|
13
|
+
var hours = [];
|
14
|
+
for (var i = 0; i < 24; i++) {
|
15
|
+
hours.push(i);
|
16
|
+
}
|
17
|
+
return hours;
|
18
|
+
};
|
19
|
+
var days = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日'];
|
20
|
+
// 根据是不是半小时初始化内部使用的全0字符串
|
21
|
+
var get0str = function get0str(length) {
|
22
|
+
var tempValue = '';
|
23
|
+
for (var i = 0; i < length; i++) {
|
24
|
+
tempValue += 0;
|
25
|
+
}
|
26
|
+
return tempValue;
|
27
|
+
};
|
28
|
+
// 根据是否是半小时将外部值转换为内部使用的值
|
29
|
+
var aa2a = function aa2a(value) {
|
30
|
+
var res = '',
|
31
|
+
len = value.length;
|
32
|
+
for (var i = 0; i < len; i += 2) {
|
33
|
+
res += value[i];
|
34
|
+
}
|
35
|
+
return res;
|
36
|
+
};
|
37
|
+
var valueToList = function valueToList(v, half) {
|
38
|
+
var tempValue = v ? half ? v : aa2a(v) : get0str(half ? 336 : 168);
|
39
|
+
return tempValue.split('').map(function (value, index) {
|
40
|
+
return {
|
41
|
+
value: value,
|
42
|
+
index: index
|
43
|
+
};
|
44
|
+
});
|
45
|
+
};
|
46
|
+
var listToValue = function listToValue(v, half) {
|
47
|
+
var tempValue = v.map(function (item) {
|
48
|
+
return half ? item.value : item.value + item.value;
|
49
|
+
}).join('');
|
50
|
+
return tempValue.includes('1') ? tempValue : undefined;
|
51
|
+
};
|
52
|
+
|
53
|
+
// 将一维数组按指定数量拆分为二维数组
|
54
|
+
var chunkArray = function chunkArray(arr, size) {
|
55
|
+
var res = [];
|
56
|
+
for (var i = 0; i < arr.length; i += size) {
|
57
|
+
res.push(arr.slice(i, i + size));
|
58
|
+
}
|
59
|
+
return res;
|
60
|
+
};
|
61
|
+
var numToTime = function numToTime(num) {
|
62
|
+
return num.toFixed(1).split('.').map(function (v, i) {
|
63
|
+
return v === '5' && i === 1 ? '30' : +v > 9 ? v : '0' + v;
|
64
|
+
}).join(':');
|
65
|
+
};
|
66
|
+
var getTimePair = function getTimePair(index, half) {
|
67
|
+
return [numToTime(index * (half ? 0.5 : 1)), numToTime((index + 1) * (half ? 0.5 : 1))];
|
68
|
+
};
|
69
|
+
var McPeriodSelect = function McPeriodSelect(props) {
|
70
|
+
var style = props.style,
|
71
|
+
className = props.className,
|
72
|
+
half = props.half,
|
73
|
+
value = props.value,
|
74
|
+
onChange = props.onChange,
|
75
|
+
_props$disabled = props.disabled,
|
76
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled;
|
77
|
+
var _useState = useState([]),
|
78
|
+
_useState2 = _slicedToArray(_useState, 2),
|
79
|
+
list = _useState2[0],
|
80
|
+
setList = _useState2[1];
|
81
|
+
var chunkList = useMemo(function () {
|
82
|
+
return chunkArray(list, list.length / 7);
|
83
|
+
}, [list]);
|
84
|
+
var startCoord = useRef();
|
85
|
+
var _useState3 = useState([]),
|
86
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
87
|
+
activeItems = _useState4[0],
|
88
|
+
setActiveItems = _useState4[1];
|
89
|
+
var currentSelectedList = useMemo(function () {
|
90
|
+
var res = [];
|
91
|
+
chunkList.forEach(function (day, dayIndex) {
|
92
|
+
if (day.some(function (item) {
|
93
|
+
return item.value === '1';
|
94
|
+
})) {
|
95
|
+
var chunks = day.map(function (item, index) {
|
96
|
+
return item.value === '1' ? "".concat(index, ",") : '-';
|
97
|
+
}).join('').split('-').filter(function (v) {
|
98
|
+
return v;
|
99
|
+
}).map(function (v) {
|
100
|
+
return v.split(',').filter(function (i) {
|
101
|
+
return !!i;
|
102
|
+
}).map(function (i) {
|
103
|
+
return +i;
|
104
|
+
});
|
105
|
+
}).map(function (c) {
|
106
|
+
var times = [];
|
107
|
+
c.forEach(function (i) {
|
108
|
+
return times.push.apply(times, _toConsumableArray(getTimePair(i, half)));
|
109
|
+
});
|
110
|
+
return [times[0], times[times.length - 1]];
|
111
|
+
});
|
112
|
+
res.push({
|
113
|
+
dayIndex: dayIndex,
|
114
|
+
periodText: chunks.reduce(function (p, c) {
|
115
|
+
return "".concat(p, "\u3001").concat(c.join('-'));
|
116
|
+
}, '').slice(1)
|
117
|
+
});
|
118
|
+
}
|
119
|
+
});
|
120
|
+
return res;
|
121
|
+
}, [chunkList, half]);
|
122
|
+
useEffect(function () {
|
123
|
+
setList(valueToList(value, half));
|
124
|
+
}, [value]);
|
125
|
+
var mouseDown = /*#__PURE__*/function () {
|
126
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(x, y, item) {
|
127
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
128
|
+
while (1) switch (_context.prev = _context.next) {
|
129
|
+
case 0:
|
130
|
+
_context.next = 2;
|
131
|
+
return setActiveItems([]);
|
132
|
+
case 2:
|
133
|
+
startCoord.current = {
|
134
|
+
x: x,
|
135
|
+
y: y
|
136
|
+
};
|
137
|
+
setActiveItems([item]);
|
138
|
+
case 4:
|
139
|
+
case "end":
|
140
|
+
return _context.stop();
|
141
|
+
}
|
142
|
+
}, _callee);
|
143
|
+
}));
|
144
|
+
return function mouseDown(_x, _x2, _x3) {
|
145
|
+
return _ref.apply(this, arguments);
|
146
|
+
};
|
147
|
+
}();
|
148
|
+
var mouseEnter = function mouseEnter(x, y) {
|
149
|
+
if (startCoord.current) {
|
150
|
+
var currentActiveItems = [];
|
151
|
+
var startX = startCoord.current.x > x ? x : startCoord.current.x,
|
152
|
+
endX = startCoord.current.x > x ? startCoord.current.x : x,
|
153
|
+
startY = startCoord.current.y > y ? y : startCoord.current.y,
|
154
|
+
endY = startCoord.current.y > y ? startCoord.current.y : y;
|
155
|
+
for (var i = startX; i <= endX; i++) {
|
156
|
+
for (var j = startY; j <= endY; j++) {
|
157
|
+
currentActiveItems.push(chunkList[i][j]);
|
158
|
+
}
|
159
|
+
}
|
160
|
+
setActiveItems(currentActiveItems);
|
161
|
+
}
|
162
|
+
};
|
163
|
+
var mouseUp = function mouseUp() {
|
164
|
+
var newList = _toConsumableArray(list);
|
165
|
+
var tempValue = activeItems.every(function (item) {
|
166
|
+
return item.value === '1';
|
167
|
+
}) ? '0' : '1';
|
168
|
+
activeItems.forEach(function (item) {
|
169
|
+
return newList[item.index].value = tempValue;
|
170
|
+
});
|
171
|
+
if (!props.hasOwnProperty('value')) {
|
172
|
+
setList(newList);
|
173
|
+
}
|
174
|
+
onChange === null || onChange === void 0 || onChange(listToValue(newList, half));
|
175
|
+
startCoord.current = undefined;
|
176
|
+
setActiveItems([]);
|
177
|
+
};
|
178
|
+
return /*#__PURE__*/_jsxs("div", {
|
179
|
+
style: style,
|
180
|
+
className: "mc-period-select ".concat(disabled ? 'mc-period-select--disabled' : '', " ").concat(className || ''),
|
181
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
182
|
+
className: "mc-period-select__header",
|
183
|
+
children: [/*#__PURE__*/_jsx("div", {
|
184
|
+
className: "mc-period-select__title",
|
185
|
+
children: "\u661F\u671F/\u65F6\u95F4"
|
186
|
+
}), /*#__PURE__*/_jsxs("div", {
|
187
|
+
className: "mc-period-select__subtitle-box",
|
188
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
189
|
+
className: "mc-period-select__time-bar",
|
190
|
+
children: [/*#__PURE__*/_jsx("div", {
|
191
|
+
children: "00:00-12:00"
|
192
|
+
}), /*#__PURE__*/_jsx("div", {
|
193
|
+
children: "12:00-24:00"
|
194
|
+
})]
|
195
|
+
}), /*#__PURE__*/_jsx("div", {
|
196
|
+
className: "mc-period-select__hour-bar",
|
197
|
+
children: getHours().map(function (i) {
|
198
|
+
return /*#__PURE__*/_jsx("div", {
|
199
|
+
children: i
|
200
|
+
}, i);
|
201
|
+
})
|
202
|
+
})]
|
203
|
+
})]
|
204
|
+
}), /*#__PURE__*/_jsxs("div", {
|
205
|
+
className: "mc-period-select__body",
|
206
|
+
children: [/*#__PURE__*/_jsx("div", {
|
207
|
+
className: "mc-period-select__side-bar",
|
208
|
+
children: days.map(function (i) {
|
209
|
+
return /*#__PURE__*/_jsx("div", {
|
210
|
+
children: i
|
211
|
+
}, i);
|
212
|
+
})
|
213
|
+
}), /*#__PURE__*/_jsx("div", {
|
214
|
+
className: "mc-period-select__wrapper",
|
215
|
+
onMouseLeave: function onMouseLeave() {
|
216
|
+
startCoord.current = undefined;
|
217
|
+
setActiveItems([]);
|
218
|
+
},
|
219
|
+
children: chunkList.map(function (day, dayIndex) {
|
220
|
+
return /*#__PURE__*/_jsx("div", {
|
221
|
+
className: "mc-period-select__day",
|
222
|
+
children: day.map(function (item, index) {
|
223
|
+
return /*#__PURE__*/_jsx("div", {
|
224
|
+
className: "mc-period-select__item ".concat(activeItems.some(function (aItem) {
|
225
|
+
return aItem.index === item.index;
|
226
|
+
}) ? 'mc-period-select__item--active' : '', " ").concat(item.value === '1' ? 'mc-period-select__item--selected' : ''),
|
227
|
+
onMouseDown: function onMouseDown() {
|
228
|
+
return mouseDown(dayIndex, index, item);
|
229
|
+
},
|
230
|
+
onMouseEnter: function onMouseEnter() {
|
231
|
+
return mouseEnter(dayIndex, index);
|
232
|
+
},
|
233
|
+
onMouseMove: function onMouseMove(e) {
|
234
|
+
return e.preventDefault();
|
235
|
+
},
|
236
|
+
onMouseUp: mouseUp,
|
237
|
+
children: /*#__PURE__*/_jsx("div", {
|
238
|
+
className: "mc-period-select__item__mask"
|
239
|
+
})
|
240
|
+
}, item.index);
|
241
|
+
})
|
242
|
+
}, dayIndex);
|
243
|
+
})
|
244
|
+
})]
|
245
|
+
}), /*#__PURE__*/_jsxs("div", {
|
246
|
+
className: "mc-period-select__footer",
|
247
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
248
|
+
className: "mc-period-select__action-bar",
|
249
|
+
children: [/*#__PURE__*/_jsx("div", {
|
250
|
+
children: "\u53EF\u62D6\u5230\u9F20\u6807\u9009\u62E9\u65F6\u6BB5"
|
251
|
+
}), /*#__PURE__*/_jsx(Button, {
|
252
|
+
style: {
|
253
|
+
padding: 0,
|
254
|
+
height: 'auto'
|
255
|
+
},
|
256
|
+
type: "link",
|
257
|
+
icon: /*#__PURE__*/_jsx(McIconFont, {
|
258
|
+
type: "icon-DeleteOutlined",
|
259
|
+
style: {
|
260
|
+
marginRight: -4
|
261
|
+
}
|
262
|
+
}),
|
263
|
+
onClick: function onClick() {
|
264
|
+
if (!props.hasOwnProperty('value')) {
|
265
|
+
setList(function (os) {
|
266
|
+
return os.map(function (item) {
|
267
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
268
|
+
value: '0'
|
269
|
+
});
|
270
|
+
});
|
271
|
+
});
|
272
|
+
}
|
273
|
+
onChange === null || onChange === void 0 || onChange(undefined);
|
274
|
+
},
|
275
|
+
children: "\u6E05\u7A7A"
|
276
|
+
})]
|
277
|
+
}), currentSelectedList.map(function (item) {
|
278
|
+
return /*#__PURE__*/_jsxs("div", {
|
279
|
+
className: "mc-period-select__selected-item",
|
280
|
+
children: [/*#__PURE__*/_jsx("div", {
|
281
|
+
className: "mc-period-select__selected-item__title",
|
282
|
+
children: days[item.dayIndex]
|
283
|
+
}), /*#__PURE__*/_jsx("div", {
|
284
|
+
className: "mc-period-select__selected-item__content",
|
285
|
+
children: item.periodText
|
286
|
+
}), /*#__PURE__*/_jsx(McIconFont, {
|
287
|
+
className: "mc-period-select__selected-item__remove",
|
288
|
+
type: "icon-CloseOutlined",
|
289
|
+
onClick: function onClick() {
|
290
|
+
var newlist = _toConsumableArray(list);
|
291
|
+
chunkList[item.dayIndex].forEach(function (i) {
|
292
|
+
return newlist[i.index].value = '0';
|
293
|
+
});
|
294
|
+
if (!props.hasOwnProperty('value')) {
|
295
|
+
setList(newlist);
|
296
|
+
}
|
297
|
+
onChange === null || onChange === void 0 || onChange(listToValue(newlist, half));
|
298
|
+
}
|
299
|
+
})]
|
300
|
+
}, item.dayIndex);
|
301
|
+
})]
|
302
|
+
})]
|
303
|
+
});
|
304
|
+
};
|
305
|
+
export default McPeriodSelect;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { ButtonProps, PopconfirmProps } from 'antd';
|
2
|
+
import React, { ReactNode } from 'react';
|
3
|
+
type McPopoverButtonProps = Omit<PopconfirmProps, 'title'> & {
|
4
|
+
title?: string;
|
5
|
+
description?: string | ReactNode;
|
6
|
+
btnText?: string;
|
7
|
+
btnProps?: ButtonProps;
|
8
|
+
placement?: PopconfirmProps['placement'];
|
9
|
+
disabled?: boolean;
|
10
|
+
children?: ReactNode;
|
11
|
+
onConfirm: () => void;
|
12
|
+
};
|
13
|
+
declare const McPopoverButton: React.FC<McPopoverButtonProps>;
|
14
|
+
export default McPopoverButton;
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
|
+
var _excluded = ["title", "description", "btnText", "btnProps", "children", "placement", "disabled", "onConfirm"];
|
4
|
+
import { Button, Popconfirm } from 'antd';
|
5
|
+
import { WarningFilled } from 'much-icons';
|
6
|
+
import React from 'react';
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
+
var McPopoverButton = function McPopoverButton(_ref) {
|
9
|
+
var _ref$title = _ref.title,
|
10
|
+
title = _ref$title === void 0 ? '提示' : _ref$title,
|
11
|
+
_ref$description = _ref.description,
|
12
|
+
description = _ref$description === void 0 ? '删除后,将无法恢复,请谨慎!' : _ref$description,
|
13
|
+
_ref$btnText = _ref.btnText,
|
14
|
+
btnText = _ref$btnText === void 0 ? '删除' : _ref$btnText,
|
15
|
+
_ref$btnProps = _ref.btnProps,
|
16
|
+
btnProps = _ref$btnProps === void 0 ? {} : _ref$btnProps,
|
17
|
+
children = _ref.children,
|
18
|
+
_ref$placement = _ref.placement,
|
19
|
+
placement = _ref$placement === void 0 ? 'topRight' : _ref$placement,
|
20
|
+
_ref$disabled = _ref.disabled,
|
21
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
22
|
+
onConfirm = _ref.onConfirm,
|
23
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
24
|
+
return /*#__PURE__*/_jsx(Popconfirm, _objectSpread(_objectSpread({
|
25
|
+
title: title,
|
26
|
+
icon: /*#__PURE__*/_jsx(WarningFilled, {
|
27
|
+
style: {
|
28
|
+
color: '#FF4D4F',
|
29
|
+
fontSize: 16,
|
30
|
+
marginRight: 4
|
31
|
+
}
|
32
|
+
}),
|
33
|
+
description: description,
|
34
|
+
okText: "\u5220\u9664",
|
35
|
+
cancelText: "\u53D6\u6D88",
|
36
|
+
placement: placement,
|
37
|
+
disabled: disabled,
|
38
|
+
onConfirm: onConfirm
|
39
|
+
}, rest), {}, {
|
40
|
+
children: children ? children : /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
|
41
|
+
type: "link",
|
42
|
+
danger: true,
|
43
|
+
disabled: disabled,
|
44
|
+
style: {
|
45
|
+
padding: 0
|
46
|
+
}
|
47
|
+
}, btnProps), {}, {
|
48
|
+
children: btnText
|
49
|
+
}))
|
50
|
+
}));
|
51
|
+
};
|
52
|
+
export default McPopoverButton;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { FormProps, PopconfirmProps } from 'antd';
|
2
|
+
import React, { ReactNode } from 'react';
|
3
|
+
type McPopoverFormProps = Omit<PopconfirmProps, 'title' | 'description' | 'onConfirm'> & {
|
4
|
+
children?: ReactNode;
|
5
|
+
title?: string;
|
6
|
+
placement?: PopconfirmProps['placement'];
|
7
|
+
disabled?: boolean;
|
8
|
+
formProps?: FormProps;
|
9
|
+
formItem?: ReactNode;
|
10
|
+
formData?: Record<string, unknown>;
|
11
|
+
onConfirm: (values: Record<string, unknown>) => PromiseLike<any> | any;
|
12
|
+
};
|
13
|
+
declare const McPopoverForm: React.FC<McPopoverFormProps>;
|
14
|
+
export default McPopoverForm;
|
@@ -0,0 +1,95 @@
|
|
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 = ["children", "title", "placement", "disabled", "formItem", "formData", "formProps", "onConfirm"];
|
5
|
+
import { Form, Popconfirm } from 'antd';
|
6
|
+
import React, { useEffect, useRef, useState } from 'react';
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
+
var McPopoverForm = function McPopoverForm(_ref) {
|
9
|
+
var children = _ref.children,
|
10
|
+
title = _ref.title,
|
11
|
+
_ref$placement = _ref.placement,
|
12
|
+
placement = _ref$placement === void 0 ? 'rightTop' : _ref$placement,
|
13
|
+
_ref$disabled = _ref.disabled,
|
14
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
15
|
+
formItem = _ref.formItem,
|
16
|
+
formData = _ref.formData,
|
17
|
+
formProps = _ref.formProps,
|
18
|
+
onConfirm = _ref.onConfirm,
|
19
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
20
|
+
var _Form$useForm = Form.useForm(),
|
21
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
22
|
+
form = _Form$useForm2[0];
|
23
|
+
var _useState = useState(false),
|
24
|
+
_useState2 = _slicedToArray(_useState, 2),
|
25
|
+
open = _useState2[0],
|
26
|
+
setOpen = _useState2[1];
|
27
|
+
var clickTypeRef = useRef('');
|
28
|
+
var handelConfirm = function handelConfirm() {
|
29
|
+
clickTypeRef.current = 'confirm';
|
30
|
+
form.validateFields().then(function (values) {
|
31
|
+
onConfirm(values);
|
32
|
+
setOpen(false);
|
33
|
+
});
|
34
|
+
};
|
35
|
+
var handelCancel = function handelCancel() {
|
36
|
+
clickTypeRef.current = 'confirm';
|
37
|
+
setOpen(false);
|
38
|
+
};
|
39
|
+
var handelOpenPageChange = function handelOpenPageChange(value, e) {
|
40
|
+
if (value) {
|
41
|
+
setOpen(true);
|
42
|
+
} else {
|
43
|
+
if (e) {
|
44
|
+
clickTypeRef.current = 'cancel';
|
45
|
+
if (clickTypeRef.current === 'comfirm') {
|
46
|
+
handelConfirm();
|
47
|
+
}
|
48
|
+
} else {
|
49
|
+
clickTypeRef.current = '';
|
50
|
+
setOpen(false);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
};
|
54
|
+
useEffect(function () {
|
55
|
+
if (formData && open) {
|
56
|
+
var _form$setFieldsValue;
|
57
|
+
form === null || form === void 0 || (_form$setFieldsValue = form.setFieldsValue) === null || _form$setFieldsValue === void 0 || _form$setFieldsValue.call(form, formData);
|
58
|
+
}
|
59
|
+
}, [formData, open]);
|
60
|
+
return /*#__PURE__*/_jsx(Popconfirm, _objectSpread(_objectSpread({
|
61
|
+
title: /*#__PURE__*/_jsx("div", {
|
62
|
+
style: {
|
63
|
+
marginBottom: 8
|
64
|
+
},
|
65
|
+
children: title
|
66
|
+
}),
|
67
|
+
icon: false,
|
68
|
+
open: open,
|
69
|
+
onOpenChange: handelOpenPageChange,
|
70
|
+
description: /*#__PURE__*/_jsx("div", {
|
71
|
+
style: {
|
72
|
+
marginBottom: 8
|
73
|
+
},
|
74
|
+
children: /*#__PURE__*/_jsx(Form, _objectSpread(_objectSpread({
|
75
|
+
form: form,
|
76
|
+
autoComplete: "off"
|
77
|
+
}, formProps), {}, {
|
78
|
+
children: formItem
|
79
|
+
}))
|
80
|
+
}),
|
81
|
+
overlayInnerStyle: {
|
82
|
+
padding: 16
|
83
|
+
},
|
84
|
+
okText: "\u4FDD\u5B58",
|
85
|
+
cancelText: "\u53D6\u6D88",
|
86
|
+
placement: placement,
|
87
|
+
disabled: disabled,
|
88
|
+
destroyTooltipOnHide: true,
|
89
|
+
onCancel: handelCancel,
|
90
|
+
onConfirm: handelConfirm
|
91
|
+
}, rest), {}, {
|
92
|
+
children: children
|
93
|
+
}));
|
94
|
+
};
|
95
|
+
export default McPopoverForm;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const DEFAULT_MAP: Record<string, any>;
|