assui 2.0.147 → 2.1.2

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.
Files changed (120) hide show
  1. package/es/button-drawer/index.d.ts +1 -1
  2. package/es/button-modal/index.d.ts +1 -1
  3. package/es/copy-to-clipboard/style/index.css +58 -43
  4. package/es/customize-range-picker/defaultRadioList.d.ts +24 -0
  5. package/es/customize-range-picker/defaultRadioList.js +79 -0
  6. package/es/customize-range-picker/index.d.ts +15 -0
  7. package/es/customize-range-picker/index.js +172 -0
  8. package/es/customize-range-picker/style/index.css +1821 -0
  9. package/es/customize-range-picker/style/index.d.ts +1 -0
  10. package/es/customize-range-picker/style/index.js +1 -0
  11. package/es/customize-range-picker/style/index.less +46 -0
  12. package/es/highlight-textarea/extractSpansOfClasses.js +9 -7
  13. package/es/highlight-textarea/getRanges.js +9 -7
  14. package/es/highlight-textarea/index.js +3 -3
  15. package/es/highlight-textarea/style/index.css +169 -41
  16. package/es/highlight-textarea/types.js +1 -0
  17. package/es/img-crop/index.js +7 -7
  18. package/es/img-crop/style/index.css +1784 -0
  19. package/es/img-crop/style/index.less +1 -1
  20. package/es/keep-tab/style/index.css +40 -23
  21. package/es/label-auto-complete/style/index.css +1784 -0
  22. package/es/label-auto-complete/style/index.less +1 -1
  23. package/es/label-customize-range-picker/defaultRadioList.js +2 -2
  24. package/es/label-customize-range-picker/index.js +5 -3
  25. package/es/label-customize-range-picker/style/index.css +1792 -8
  26. package/es/label-customize-range-picker/style/index.less +6 -4
  27. package/es/label-date-picker/index.js +1 -1
  28. package/es/label-date-picker/style/index.css +1784 -0
  29. package/es/label-date-picker/style/index.less +1 -1
  30. package/es/label-number-input/index.js +1 -1
  31. package/es/label-range-picker/style/index.css +1784 -0
  32. package/es/label-range-picker/style/index.less +1 -1
  33. package/es/label-select/style/index.css +1784 -0
  34. package/es/label-select/style/index.less +1 -1
  35. package/es/label-tree-select/style/index.css +1784 -0
  36. package/es/label-tree-select/style/index.less +1 -1
  37. package/es/number-input/index.js +4 -4
  38. package/es/number-input/utils.js +1 -1
  39. package/es/rich-text-editor/style/index.css +6 -5
  40. package/es/single-img-upload/index.js +1 -1
  41. package/es/single-img-upload/style/index.css +1784 -0
  42. package/es/single-img-upload/style/index.less +1 -1
  43. package/es/step-number-input/index.js +8 -8
  44. package/es/step-number-input/style/index.css +1784 -0
  45. package/es/step-number-input/style/index.less +1 -1
  46. package/es/text-input/index.js +8 -6
  47. package/es/text-input/style/index.css +169 -41
  48. package/lib/beautiful-dnd/index.js +13 -7
  49. package/lib/button-drawer/index.d.ts +1 -1
  50. package/lib/button-drawer/index.js +18 -12
  51. package/lib/button-modal/index.d.ts +1 -1
  52. package/lib/button-modal/index.js +14 -8
  53. package/lib/condition-input/index.js +17 -11
  54. package/lib/condition-input/parse2RegexOption.js +3 -3
  55. package/lib/copy-to-clipboard/index.js +15 -9
  56. package/lib/copy-to-clipboard/style/index.css +58 -43
  57. package/lib/customize-range-picker/defaultRadioList.d.ts +24 -0
  58. package/lib/customize-range-picker/defaultRadioList.js +93 -0
  59. package/lib/customize-range-picker/index.d.ts +15 -0
  60. package/lib/customize-range-picker/index.js +228 -0
  61. package/lib/customize-range-picker/style/index.css +1821 -0
  62. package/lib/customize-range-picker/style/index.d.ts +1 -0
  63. package/lib/customize-range-picker/style/index.js +7 -0
  64. package/lib/customize-range-picker/style/index.less +46 -0
  65. package/lib/highlight-textarea/HighlighedContents.js +2 -2
  66. package/lib/highlight-textarea/extractSpansOfClasses.js +9 -7
  67. package/lib/highlight-textarea/getRanges.js +10 -8
  68. package/lib/highlight-textarea/index.js +19 -13
  69. package/lib/highlight-textarea/style/index.css +169 -41
  70. package/lib/img-crop/EasyCrop.js +13 -7
  71. package/lib/img-crop/index.js +21 -15
  72. package/lib/img-crop/style/index.css +1784 -0
  73. package/lib/img-crop/style/index.less +1 -1
  74. package/lib/index.js +38 -31
  75. package/lib/keep-tab/index.js +17 -11
  76. package/lib/keep-tab/style/index.css +40 -23
  77. package/lib/label-auto-complete/index.js +5 -5
  78. package/lib/label-auto-complete/style/index.css +1784 -0
  79. package/lib/label-auto-complete/style/index.less +1 -1
  80. package/lib/label-condition-input/index.js +5 -5
  81. package/lib/label-customize-range-picker/defaultRadioList.js +3 -3
  82. package/lib/label-customize-range-picker/index.js +22 -14
  83. package/lib/label-customize-range-picker/style/index.css +1792 -8
  84. package/lib/label-customize-range-picker/style/index.less +6 -4
  85. package/lib/label-date-picker/index.js +5 -5
  86. package/lib/label-date-picker/style/index.css +1784 -0
  87. package/lib/label-date-picker/style/index.less +1 -1
  88. package/lib/label-input/index.js +5 -5
  89. package/lib/label-number-input/index.js +6 -6
  90. package/lib/label-range-picker/index.js +3 -3
  91. package/lib/label-range-picker/style/index.css +1784 -0
  92. package/lib/label-range-picker/style/index.less +1 -1
  93. package/lib/label-select/index.js +5 -5
  94. package/lib/label-select/style/index.css +1784 -0
  95. package/lib/label-select/style/index.less +1 -1
  96. package/lib/label-text-area/index.js +4 -4
  97. package/lib/label-tree-select/index.js +4 -4
  98. package/lib/label-tree-select/style/index.css +1784 -0
  99. package/lib/label-tree-select/style/index.less +1 -1
  100. package/lib/number-input/index.js +21 -15
  101. package/lib/number-input/utils.js +8 -4
  102. package/lib/rc-echart/core.js +21 -15
  103. package/lib/rc-echart/index.js +13 -7
  104. package/lib/rc-qrcode/index.js +14 -8
  105. package/lib/rc-qrcode/useQrcode.js +4 -3
  106. package/lib/rc-transition-group/index.js +13 -7
  107. package/lib/rich-text-editor/index.js +1 -1
  108. package/lib/rich-text-editor/style/index.css +6 -5
  109. package/lib/single-img-upload/index.js +18 -12
  110. package/lib/single-img-upload/style/index.css +1784 -0
  111. package/lib/single-img-upload/style/index.less +1 -1
  112. package/lib/sortable-hoc/index.js +13 -7
  113. package/lib/split-pane/index.js +13 -7
  114. package/lib/step-number-input/index.js +32 -26
  115. package/lib/step-number-input/style/index.css +1784 -0
  116. package/lib/step-number-input/style/index.less +1 -1
  117. package/lib/text-area/index.js +14 -8
  118. package/lib/text-input/index.js +8 -6
  119. package/lib/text-input/style/index.css +169 -41
  120. package/package.json +5 -4
@@ -4,7 +4,7 @@ export declare type DrawerAction = {
4
4
  close: () => void;
5
5
  open: () => void;
6
6
  };
7
- export interface ButtonDrawerProps extends DrawerProps {
7
+ export interface ButtonDrawerProps extends Omit<DrawerProps, 'children'> {
8
8
  onClose?: () => void;
9
9
  onOpen?: () => void;
10
10
  trigger: React.ReactElement;
@@ -4,7 +4,7 @@ export interface ModalAction {
4
4
  open: () => void;
5
5
  close: () => void;
6
6
  }
7
- export interface ButtonModalProps extends ModalProps {
7
+ export interface ButtonModalProps extends Omit<ModalProps, 'children'> {
8
8
  onClose?: () => void;
9
9
  onOpen?: () => void;
10
10
  trigger?: React.ReactElement;
@@ -18,6 +18,7 @@
18
18
  width: -webkit-max-content;
19
19
  width: -moz-max-content;
20
20
  width: max-content;
21
+ width: intrinsic;
21
22
  max-width: 250px;
22
23
  visibility: visible;
23
24
  }
@@ -27,22 +28,22 @@
27
28
  .ant-tooltip-placement-top,
28
29
  .ant-tooltip-placement-topLeft,
29
30
  .ant-tooltip-placement-topRight {
30
- padding-bottom: 8px;
31
+ padding-bottom: 14.3137085px;
31
32
  }
32
33
  .ant-tooltip-placement-right,
33
34
  .ant-tooltip-placement-rightTop,
34
35
  .ant-tooltip-placement-rightBottom {
35
- padding-left: 8px;
36
+ padding-left: 14.3137085px;
36
37
  }
37
38
  .ant-tooltip-placement-bottom,
38
39
  .ant-tooltip-placement-bottomLeft,
39
40
  .ant-tooltip-placement-bottomRight {
40
- padding-top: 8px;
41
+ padding-top: 14.3137085px;
41
42
  }
42
43
  .ant-tooltip-placement-left,
43
44
  .ant-tooltip-placement-leftTop,
44
45
  .ant-tooltip-placement-leftBottom {
45
- padding-right: 8px;
46
+ padding-right: 14.3137085px;
46
47
  }
47
48
  .ant-tooltip-inner {
48
49
  min-width: 30px;
@@ -59,36 +60,50 @@
59
60
  .ant-tooltip-arrow {
60
61
  position: absolute;
61
62
  display: block;
62
- width: 13.07106781px;
63
- height: 13.07106781px;
63
+ width: 22px;
64
+ height: 22px;
64
65
  overflow: hidden;
65
66
  background: transparent;
66
67
  pointer-events: none;
67
68
  }
68
69
  .ant-tooltip-arrow-content {
70
+ --antd-arrow-background-color: rgba(0, 0, 0, 0.75);
69
71
  position: absolute;
70
72
  top: 0;
71
73
  right: 0;
72
74
  bottom: 0;
73
75
  left: 0;
74
76
  display: block;
75
- width: 5px;
76
- height: 5px;
77
+ width: 11.3137085px;
78
+ height: 11.3137085px;
77
79
  margin: auto;
78
- background-color: rgba(0, 0, 0, 0.75);
80
+ background-color: transparent;
79
81
  content: '';
80
82
  pointer-events: auto;
83
+ border-radius: 0 0 2px;
84
+ pointer-events: none;
85
+ }
86
+ .ant-tooltip-arrow-content::before {
87
+ position: absolute;
88
+ top: -11.3137085px;
89
+ left: -11.3137085px;
90
+ width: 33.9411255px;
91
+ height: 33.9411255px;
92
+ background: linear-gradient(to left, var(--antd-arrow-background-color) 50%, var(--antd-arrow-background-color) 50%) no-repeat -10px -10px;
93
+ content: '';
94
+ -webkit-clip-path: path('M 9.849242404917499 24.091883092036785 A 5 5 0 0 1 13.384776310850237 22.627416997969522 L 20.627416997969522 22.627416997969522 A 2 2 0 0 0 22.627416997969522 20.627416997969522 L 22.627416997969522 13.384776310850237 A 5 5 0 0 1 24.091883092036785 9.849242404917499 Z');
95
+ clip-path: path('M 9.849242404917499 24.091883092036785 A 5 5 0 0 1 13.384776310850237 22.627416997969522 L 20.627416997969522 22.627416997969522 A 2 2 0 0 0 22.627416997969522 20.627416997969522 L 22.627416997969522 13.384776310850237 A 5 5 0 0 1 24.091883092036785 9.849242404917499 Z');
81
96
  }
82
97
  .ant-tooltip-placement-top .ant-tooltip-arrow,
83
98
  .ant-tooltip-placement-topLeft .ant-tooltip-arrow,
84
99
  .ant-tooltip-placement-topRight .ant-tooltip-arrow {
85
- bottom: -5.07106781px;
100
+ bottom: -7.4462915px;
86
101
  }
87
102
  .ant-tooltip-placement-top .ant-tooltip-arrow-content,
88
103
  .ant-tooltip-placement-topLeft .ant-tooltip-arrow-content,
89
104
  .ant-tooltip-placement-topRight .ant-tooltip-arrow-content {
90
105
  box-shadow: 3px 3px 7px rgba(0, 0, 0, 0.07);
91
- transform: translateY(-6.53553391px) rotate(45deg);
106
+ transform: translateY(-11px) rotate(45deg);
92
107
  }
93
108
  .ant-tooltip-placement-top .ant-tooltip-arrow {
94
109
  left: 50%;
@@ -103,13 +118,13 @@
103
118
  .ant-tooltip-placement-right .ant-tooltip-arrow,
104
119
  .ant-tooltip-placement-rightTop .ant-tooltip-arrow,
105
120
  .ant-tooltip-placement-rightBottom .ant-tooltip-arrow {
106
- left: -5.07106781px;
121
+ left: -7.5862915px;
107
122
  }
108
123
  .ant-tooltip-placement-right .ant-tooltip-arrow-content,
109
124
  .ant-tooltip-placement-rightTop .ant-tooltip-arrow-content,
110
125
  .ant-tooltip-placement-rightBottom .ant-tooltip-arrow-content {
111
126
  box-shadow: -3px 3px 7px rgba(0, 0, 0, 0.07);
112
- transform: translateX(6.53553391px) rotate(45deg);
127
+ transform: translateX(11px) rotate(135deg);
113
128
  }
114
129
  .ant-tooltip-placement-right .ant-tooltip-arrow {
115
130
  top: 50%;
@@ -124,13 +139,13 @@
124
139
  .ant-tooltip-placement-left .ant-tooltip-arrow,
125
140
  .ant-tooltip-placement-leftTop .ant-tooltip-arrow,
126
141
  .ant-tooltip-placement-leftBottom .ant-tooltip-arrow {
127
- right: -5.07106781px;
142
+ right: -7.6062915px;
128
143
  }
129
144
  .ant-tooltip-placement-left .ant-tooltip-arrow-content,
130
145
  .ant-tooltip-placement-leftTop .ant-tooltip-arrow-content,
131
146
  .ant-tooltip-placement-leftBottom .ant-tooltip-arrow-content {
132
147
  box-shadow: 3px -3px 7px rgba(0, 0, 0, 0.07);
133
- transform: translateX(-6.53553391px) rotate(45deg);
148
+ transform: translateX(-11px) rotate(315deg);
134
149
  }
135
150
  .ant-tooltip-placement-left .ant-tooltip-arrow {
136
151
  top: 50%;
@@ -145,13 +160,13 @@
145
160
  .ant-tooltip-placement-bottom .ant-tooltip-arrow,
146
161
  .ant-tooltip-placement-bottomLeft .ant-tooltip-arrow,
147
162
  .ant-tooltip-placement-bottomRight .ant-tooltip-arrow {
148
- top: -5.07106781px;
163
+ top: -7.5862915px;
149
164
  }
150
165
  .ant-tooltip-placement-bottom .ant-tooltip-arrow-content,
151
166
  .ant-tooltip-placement-bottomLeft .ant-tooltip-arrow-content,
152
167
  .ant-tooltip-placement-bottomRight .ant-tooltip-arrow-content {
153
168
  box-shadow: -3px -3px 7px rgba(0, 0, 0, 0.07);
154
- transform: translateY(6.53553391px) rotate(45deg);
169
+ transform: translateY(11px) rotate(225deg);
155
170
  }
156
171
  .ant-tooltip-placement-bottom .ant-tooltip-arrow {
157
172
  left: 50%;
@@ -166,80 +181,80 @@
166
181
  .ant-tooltip-pink .ant-tooltip-inner {
167
182
  background-color: #eb2f96;
168
183
  }
169
- .ant-tooltip-pink .ant-tooltip-arrow-content {
170
- background-color: #eb2f96;
184
+ .ant-tooltip-pink .ant-tooltip-arrow-content::before {
185
+ background: #eb2f96;
171
186
  }
172
187
  .ant-tooltip-magenta .ant-tooltip-inner {
173
188
  background-color: #eb2f96;
174
189
  }
175
- .ant-tooltip-magenta .ant-tooltip-arrow-content {
176
- background-color: #eb2f96;
190
+ .ant-tooltip-magenta .ant-tooltip-arrow-content::before {
191
+ background: #eb2f96;
177
192
  }
178
193
  .ant-tooltip-red .ant-tooltip-inner {
179
194
  background-color: #f5222d;
180
195
  }
181
- .ant-tooltip-red .ant-tooltip-arrow-content {
182
- background-color: #f5222d;
196
+ .ant-tooltip-red .ant-tooltip-arrow-content::before {
197
+ background: #f5222d;
183
198
  }
184
199
  .ant-tooltip-volcano .ant-tooltip-inner {
185
200
  background-color: #fa541c;
186
201
  }
187
- .ant-tooltip-volcano .ant-tooltip-arrow-content {
188
- background-color: #fa541c;
202
+ .ant-tooltip-volcano .ant-tooltip-arrow-content::before {
203
+ background: #fa541c;
189
204
  }
190
205
  .ant-tooltip-orange .ant-tooltip-inner {
191
206
  background-color: #fa8c16;
192
207
  }
193
- .ant-tooltip-orange .ant-tooltip-arrow-content {
194
- background-color: #fa8c16;
208
+ .ant-tooltip-orange .ant-tooltip-arrow-content::before {
209
+ background: #fa8c16;
195
210
  }
196
211
  .ant-tooltip-yellow .ant-tooltip-inner {
197
212
  background-color: #fadb14;
198
213
  }
199
- .ant-tooltip-yellow .ant-tooltip-arrow-content {
200
- background-color: #fadb14;
214
+ .ant-tooltip-yellow .ant-tooltip-arrow-content::before {
215
+ background: #fadb14;
201
216
  }
202
217
  .ant-tooltip-gold .ant-tooltip-inner {
203
218
  background-color: #faad14;
204
219
  }
205
- .ant-tooltip-gold .ant-tooltip-arrow-content {
206
- background-color: #faad14;
220
+ .ant-tooltip-gold .ant-tooltip-arrow-content::before {
221
+ background: #faad14;
207
222
  }
208
223
  .ant-tooltip-cyan .ant-tooltip-inner {
209
224
  background-color: #13c2c2;
210
225
  }
211
- .ant-tooltip-cyan .ant-tooltip-arrow-content {
212
- background-color: #13c2c2;
226
+ .ant-tooltip-cyan .ant-tooltip-arrow-content::before {
227
+ background: #13c2c2;
213
228
  }
214
229
  .ant-tooltip-lime .ant-tooltip-inner {
215
230
  background-color: #a0d911;
216
231
  }
217
- .ant-tooltip-lime .ant-tooltip-arrow-content {
218
- background-color: #a0d911;
232
+ .ant-tooltip-lime .ant-tooltip-arrow-content::before {
233
+ background: #a0d911;
219
234
  }
220
235
  .ant-tooltip-green .ant-tooltip-inner {
221
236
  background-color: #52c41a;
222
237
  }
223
- .ant-tooltip-green .ant-tooltip-arrow-content {
224
- background-color: #52c41a;
238
+ .ant-tooltip-green .ant-tooltip-arrow-content::before {
239
+ background: #52c41a;
225
240
  }
226
241
  .ant-tooltip-blue .ant-tooltip-inner {
227
242
  background-color: #1890ff;
228
243
  }
229
- .ant-tooltip-blue .ant-tooltip-arrow-content {
230
- background-color: #1890ff;
244
+ .ant-tooltip-blue .ant-tooltip-arrow-content::before {
245
+ background: #1890ff;
231
246
  }
232
247
  .ant-tooltip-geekblue .ant-tooltip-inner {
233
248
  background-color: #2f54eb;
234
249
  }
235
- .ant-tooltip-geekblue .ant-tooltip-arrow-content {
236
- background-color: #2f54eb;
250
+ .ant-tooltip-geekblue .ant-tooltip-arrow-content::before {
251
+ background: #2f54eb;
237
252
  }
238
253
  .ant-tooltip-purple .ant-tooltip-inner {
239
254
  background-color: #722ed1;
240
255
  }
241
- .ant-tooltip-purple .ant-tooltip-arrow-content {
242
- background-color: #722ed1;
256
+ .ant-tooltip-purple .ant-tooltip-arrow-content::before {
257
+ background: #722ed1;
243
258
  }
244
259
  .ant-tooltip-rtl {
245
260
  direction: rtl;
@@ -0,0 +1,24 @@
1
+ import type { Moment } from 'moment';
2
+ export declare enum dateTypeEnum {
3
+ TODAY = 1,
4
+ YESTERDAY = 2,
5
+ WEEK = 3,
6
+ LAST_WEEK = 4,
7
+ MONTH = 5,
8
+ LAST_MONTH = 6,
9
+ QUARTER = 7,
10
+ LAST_QUARTER = 8,
11
+ BEFORE_7_DAY = 9,
12
+ BEFORE_14_DAY = 10,
13
+ BEFORE_30_DAY = 11,
14
+ BEFORE_90_DAY = 12,
15
+ BEFORE_180_DAY = 13,
16
+ BEFORE_365_DAY = 14
17
+ }
18
+ export declare type RadioListType = {
19
+ key: string | number | dateTypeEnum;
20
+ text: string;
21
+ value: [Moment, Moment];
22
+ };
23
+ declare const defaultRadioList: RadioListType[];
24
+ export default defaultRadioList;
@@ -0,0 +1,79 @@
1
+ import moment from 'moment';
2
+ var now = moment();
3
+ export var dateTypeEnum;
4
+
5
+ (function (dateTypeEnum) {
6
+ dateTypeEnum[dateTypeEnum["TODAY"] = 1] = "TODAY";
7
+ dateTypeEnum[dateTypeEnum["YESTERDAY"] = 2] = "YESTERDAY";
8
+ dateTypeEnum[dateTypeEnum["WEEK"] = 3] = "WEEK";
9
+ dateTypeEnum[dateTypeEnum["LAST_WEEK"] = 4] = "LAST_WEEK";
10
+ dateTypeEnum[dateTypeEnum["MONTH"] = 5] = "MONTH";
11
+ dateTypeEnum[dateTypeEnum["LAST_MONTH"] = 6] = "LAST_MONTH";
12
+ dateTypeEnum[dateTypeEnum["QUARTER"] = 7] = "QUARTER";
13
+ dateTypeEnum[dateTypeEnum["LAST_QUARTER"] = 8] = "LAST_QUARTER";
14
+ dateTypeEnum[dateTypeEnum["BEFORE_7_DAY"] = 9] = "BEFORE_7_DAY";
15
+ dateTypeEnum[dateTypeEnum["BEFORE_14_DAY"] = 10] = "BEFORE_14_DAY";
16
+ dateTypeEnum[dateTypeEnum["BEFORE_30_DAY"] = 11] = "BEFORE_30_DAY";
17
+ dateTypeEnum[dateTypeEnum["BEFORE_90_DAY"] = 12] = "BEFORE_90_DAY";
18
+ dateTypeEnum[dateTypeEnum["BEFORE_180_DAY"] = 13] = "BEFORE_180_DAY";
19
+ dateTypeEnum[dateTypeEnum["BEFORE_365_DAY"] = 14] = "BEFORE_365_DAY";
20
+ })(dateTypeEnum || (dateTypeEnum = {}));
21
+
22
+ var defaultRadioList = [{
23
+ key: dateTypeEnum.TODAY,
24
+ text: '今日',
25
+ value: [now.clone().startOf('day'), now.clone().endOf('day')]
26
+ }, {
27
+ key: dateTypeEnum.YESTERDAY,
28
+ text: '昨日',
29
+ value: [now.clone().subtract(1, 'day').startOf('day'), now.clone().subtract(1, 'day').endOf('day')]
30
+ }, {
31
+ key: dateTypeEnum.WEEK,
32
+ text: '本周',
33
+ value: [now.clone().startOf('week'), now.clone().endOf('week')]
34
+ }, {
35
+ key: dateTypeEnum.LAST_WEEK,
36
+ text: '上周',
37
+ value: [now.clone().subtract(1, 'week').startOf('week'), now.clone().subtract(1, 'week').endOf('week')]
38
+ }, {
39
+ key: dateTypeEnum.MONTH,
40
+ text: '本月',
41
+ value: [now.clone().startOf('month'), now.clone().endOf('month')]
42
+ }, {
43
+ key: dateTypeEnum.LAST_MONTH,
44
+ text: '上月',
45
+ value: [now.clone().subtract(1, 'month').startOf('month'), now.clone().subtract(1, 'month').endOf('month')]
46
+ }, {
47
+ key: dateTypeEnum.QUARTER,
48
+ text: '本季度',
49
+ value: [now.clone().startOf('quarter'), now.clone().endOf('quarter')]
50
+ }, {
51
+ key: dateTypeEnum.LAST_QUARTER,
52
+ text: '上季度',
53
+ value: [now.clone().subtract(1, 'quarter').startOf('quarter'), now.clone().subtract(1, 'quarter').endOf('quarter')]
54
+ }, {
55
+ key: dateTypeEnum.BEFORE_7_DAY,
56
+ text: '最近7天',
57
+ value: [now.clone().subtract(6, 'day').startOf('day'), now.endOf('day')]
58
+ }, {
59
+ key: dateTypeEnum.BEFORE_14_DAY,
60
+ text: '最近14天',
61
+ value: [now.clone().subtract(13, 'day').startOf('day'), now.endOf('day')]
62
+ }, {
63
+ key: dateTypeEnum.BEFORE_30_DAY,
64
+ text: '最近30天',
65
+ value: [now.clone().subtract(29, 'day').startOf('day'), now.endOf('day')]
66
+ }, {
67
+ key: dateTypeEnum.BEFORE_90_DAY,
68
+ text: '最近90天',
69
+ value: [now.clone().subtract(89, 'day').startOf('day'), now.endOf('day')]
70
+ }, {
71
+ key: dateTypeEnum.BEFORE_180_DAY,
72
+ text: '最近180天',
73
+ value: [now.clone().subtract(179, 'day').startOf('day'), now.endOf('day')]
74
+ }, {
75
+ key: dateTypeEnum.BEFORE_365_DAY,
76
+ text: '最近365天',
77
+ value: [now.clone().subtract(364, 'day').startOf('day'), now.endOf('day')]
78
+ }];
79
+ export default defaultRadioList;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import type { Moment } from 'moment';
3
+ import type { RangePickerProps } from 'antd/lib/date-picker';
4
+ import type { dateTypeEnum } from './defaultRadioList';
5
+ export declare type RadioListType = {
6
+ key: string | number | dateTypeEnum;
7
+ text: string;
8
+ value: [Moment, Moment];
9
+ };
10
+ export interface CustomizeRangePickerProps extends Omit<RangePickerProps, ''> {
11
+ customizeTimeList?: dateTypeEnum[];
12
+ radioList?: RadioListType[];
13
+ }
14
+ declare const CustomizeRangePicker: React.FC<CustomizeRangePickerProps>;
15
+ export default CustomizeRangePicker;
@@ -0,0 +1,172 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+
6
+ for (var p in s) {
7
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
8
+ }
9
+ }
10
+
11
+ return t;
12
+ };
13
+
14
+ return __assign.apply(this, arguments);
15
+ };
16
+
17
+ var __rest = this && this.__rest || function (s, e) {
18
+ var t = {};
19
+
20
+ for (var p in s) {
21
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
22
+ }
23
+
24
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
25
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
26
+ }
27
+ return t;
28
+ };
29
+
30
+ var __read = this && this.__read || function (o, n) {
31
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
32
+ if (!m) return o;
33
+ var i = m.call(o),
34
+ r,
35
+ ar = [],
36
+ e;
37
+
38
+ try {
39
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
40
+ ar.push(r.value);
41
+ }
42
+ } catch (error) {
43
+ e = {
44
+ error: error
45
+ };
46
+ } finally {
47
+ try {
48
+ if (r && !r.done && (m = i["return"])) m.call(i);
49
+ } finally {
50
+ if (e) throw e.error;
51
+ }
52
+ }
53
+
54
+ return ar;
55
+ };
56
+
57
+ import React, { useState, useEffect } from 'react';
58
+ import { Radio, DatePicker, Checkbox } from 'antd';
59
+ import { useControllableValue } from 'ahooks';
60
+ import defaultRadioList from './defaultRadioList';
61
+ var RangePicker = DatePicker.RangePicker;
62
+
63
+ var CustomizeRangePicker = function CustomizeRangePicker(props) {
64
+ var customizeTimeList = props.customizeTimeList,
65
+ radioList = props.radioList,
66
+ options = __rest(props, ["customizeTimeList", "radioList"]);
67
+
68
+ var _a = __read(useControllableValue(props), 2),
69
+ date = _a[0],
70
+ setDate = _a[1];
71
+
72
+ var _b = __read(useState(false), 2),
73
+ open = _b[0],
74
+ setOpen = _b[1];
75
+
76
+ var _c = __read(useState(false), 2),
77
+ isVisiblePanel = _c[0],
78
+ setIsVisiblePanel = _c[1];
79
+
80
+ var _d = __read(useState(), 2),
81
+ radioKey = _d[0],
82
+ setRadioKey = _d[1];
83
+
84
+ var dataSource = radioList !== null && radioList !== void 0 ? radioList : defaultRadioList;
85
+ useEffect(function () {
86
+ var foundItem = dataSource.find(function (item) {
87
+ if (!date) return false;
88
+
89
+ var _a = __read(item.value, 2),
90
+ startTime = _a[0],
91
+ endTime = _a[1];
92
+
93
+ var _b = __read(date || [], 2),
94
+ defaultStartTime = _b[0],
95
+ defaultEndTime = _b[1];
96
+
97
+ if (startTime.isSame(defaultStartTime, 'day') && endTime.isSame(defaultEndTime, 'day')) {
98
+ return true;
99
+ }
100
+
101
+ return false;
102
+ });
103
+ var data = foundItem ? foundItem.key : null;
104
+ setRadioKey(data);
105
+ }, [date]);
106
+
107
+ var onDiyTimeChange = function onDiyTimeChange(event) {
108
+ var checked = event.target.checked;
109
+ setIsVisiblePanel(checked);
110
+ };
111
+
112
+ var onRadioChange = function onRadioChange(event) {
113
+ var value = event.target.value;
114
+ setRadioKey(value);
115
+ var selectRadioInfo = dataSource.find(function (item) {
116
+ return item.key === value;
117
+ });
118
+
119
+ if (selectRadioInfo) {
120
+ setDate(selectRadioInfo === null || selectRadioInfo === void 0 ? void 0 : selectRadioInfo.value);
121
+ }
122
+
123
+ setOpen(false);
124
+ };
125
+
126
+ var onOpenChange = function onOpenChange(nextOpen) {
127
+ setOpen(nextOpen);
128
+ };
129
+
130
+ var list = radioList !== null && radioList !== void 0 ? radioList : defaultRadioList.filter(function (item) {
131
+ return customizeTimeList ? customizeTimeList.includes(item.key) : true;
132
+ });
133
+
134
+ var panelRender = function panelRender(panel) {
135
+ return /*#__PURE__*/React.createElement("div", {
136
+ className: "customize-range-picker-panel"
137
+ }, /*#__PURE__*/React.createElement("div", {
138
+ className: "check-wrapper"
139
+ }, /*#__PURE__*/React.createElement("span", {
140
+ className: "customize-select"
141
+ }, /*#__PURE__*/React.createElement(Checkbox, {
142
+ onChange: onDiyTimeChange
143
+ }), /*#__PURE__*/React.createElement("span", {
144
+ className: "customize-select-text"
145
+ }, "\u81EA\u5B9A\u4E49\u65F6\u95F4"))), isVisiblePanel ? /*#__PURE__*/React.createElement("div", {
146
+ className: "panel"
147
+ }, panel) : /*#__PURE__*/React.createElement("div", {
148
+ className: "pick-box"
149
+ }, /*#__PURE__*/React.createElement(Radio.Group, {
150
+ onChange: onRadioChange,
151
+ value: radioKey
152
+ }, list.map(function (_a) {
153
+ var key = _a.key,
154
+ text = _a.text;
155
+ return /*#__PURE__*/React.createElement(Radio, {
156
+ className: "radio",
157
+ key: key,
158
+ value: key
159
+ }, text);
160
+ }))));
161
+ };
162
+
163
+ return /*#__PURE__*/React.createElement(RangePicker, __assign({
164
+ value: date,
165
+ onOpenChange: onOpenChange,
166
+ open: open,
167
+ allowClear: false,
168
+ panelRender: panelRender
169
+ }, options));
170
+ };
171
+
172
+ export default CustomizeRangePicker;