@pisell/date-picker 1.0.82 → 1.0.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Dialog/index.js +16 -13
- package/es/PisellDateRangePicker/index.js +32 -6
- package/es/PisellDateRangePicker/index.less +33 -6
- package/es/Toolbar/index.js +24 -2
- package/es/Toolbar/index.less +3 -0
- package/es/locales/en-US.d.ts +2 -0
- package/es/locales/en-US.js +3 -1
- package/es/locales/zh-CN.d.ts +2 -0
- package/es/locales/zh-CN.js +3 -1
- package/es/locales/zh-TW.d.ts +2 -0
- package/es/locales/zh-TW.js +3 -1
- package/lib/Dialog/index.js +18 -5
- package/lib/PisellDateRangePicker/index.js +24 -2
- package/lib/PisellDateRangePicker/index.less +33 -6
- package/lib/Toolbar/index.js +20 -2
- package/lib/Toolbar/index.less +3 -0
- package/lib/locales/en-US.d.ts +2 -0
- package/lib/locales/en-US.js +3 -1
- package/lib/locales/zh-CN.d.ts +2 -0
- package/lib/locales/zh-CN.js +3 -1
- package/lib/locales/zh-TW.d.ts +2 -0
- package/lib/locales/zh-TW.js +3 -1
- package/package.json +1 -1
package/es/Dialog/index.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import Drawer from "@mui/material/Drawer";
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import MuiDialog from '@mui/material/Dialog';
|
|
3
|
+
import Drawer from '@mui/material/Drawer';
|
|
5
4
|
var Dialog = function Dialog(props) {
|
|
6
5
|
var open = props.open,
|
|
7
6
|
onClose = props.onClose,
|
|
8
7
|
children = props.children;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
var isMobile = window.innerWidth < 768;
|
|
9
|
+
if (isMobile) {
|
|
10
|
+
return /*#__PURE__*/React.createElement(Drawer, {
|
|
11
|
+
anchor: 'bottom',
|
|
12
|
+
open: open,
|
|
13
|
+
onClose: onClose,
|
|
14
|
+
height: 650,
|
|
15
|
+
autoFocus: true,
|
|
16
|
+
className: 'date-picker-custom-drawer'
|
|
17
|
+
}, children);
|
|
18
|
+
}
|
|
19
|
+
return /*#__PURE__*/React.createElement(MuiDialog, {
|
|
15
20
|
open: open,
|
|
16
21
|
onClose: onClose,
|
|
17
|
-
|
|
18
|
-
autoFocus: true,
|
|
19
|
-
className: window.innerWidth > 800 ? 'date-picker-paid-drawer' : 'date-picker-custom-drawer'
|
|
22
|
+
className: "date-picker-paid-drawer date-picker-custom-drawer"
|
|
20
23
|
}, children);
|
|
21
24
|
};
|
|
22
25
|
export default Dialog;
|
|
@@ -72,8 +72,7 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
72
72
|
okButtonProps = props.okButtonProps,
|
|
73
73
|
cancelButtonProps = props.cancelButtonProps,
|
|
74
74
|
onDateChange = props.onDateChange,
|
|
75
|
-
|
|
76
|
-
desktopModeMediaQuery = _props$desktopModeMed === void 0 ? '(min-width: 625px)' : _props$desktopModeMed,
|
|
75
|
+
desktopModeMediaQuery = props.desktopModeMediaQuery,
|
|
77
76
|
style = props.style,
|
|
78
77
|
allowClear = props.allowClear,
|
|
79
78
|
disablePortal = props.disablePortal,
|
|
@@ -93,6 +92,9 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
93
92
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
94
93
|
currentShortcut = _useState4[0],
|
|
95
94
|
setCurrentShortcut = _useState4[1];
|
|
95
|
+
|
|
96
|
+
// const [rangePosition, setRangePosition] = useState('start');
|
|
97
|
+
|
|
96
98
|
var lastConfirmShortcut = useRef(isString(propsValue) ? propsValue : null);
|
|
97
99
|
useEffect(function () {
|
|
98
100
|
isBoolean(propsOpen) && setOpen(propsOpen);
|
|
@@ -244,7 +246,12 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
244
246
|
// defaultValue={defaultValue}
|
|
245
247
|
// key={`${_value?.[0]?.valueOf()}-${_value?.[1]?.valueOf()}`}
|
|
246
248
|
, {
|
|
247
|
-
desktopModeMediaQuery: desktopModeMediaQuery
|
|
249
|
+
desktopModeMediaQuery: desktopModeMediaQuery
|
|
250
|
+
// onSelectedSectionsChange={(val) => {
|
|
251
|
+
// console.log(val,'valval');
|
|
252
|
+
// }}
|
|
253
|
+
// selectedSections={null}
|
|
254
|
+
,
|
|
248
255
|
onMonthChange: onMonthChange,
|
|
249
256
|
minDate: minDate,
|
|
250
257
|
maxDate: maxDate,
|
|
@@ -264,8 +271,8 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
264
271
|
// setRangePosition(rp)
|
|
265
272
|
// // }
|
|
266
273
|
// }}
|
|
267
|
-
//
|
|
268
|
-
// rangePosition={
|
|
274
|
+
// defaultRangePosition="start"
|
|
275
|
+
// rangePosition={rangePosition}
|
|
269
276
|
,
|
|
270
277
|
defaultCalendarMonth: defaultCalendarMonth,
|
|
271
278
|
shouldDisableDate: function shouldDisableDate(current, position) {
|
|
@@ -321,7 +328,26 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
321
328
|
popper: {
|
|
322
329
|
className: popupClassName,
|
|
323
330
|
disablePortal: disablePortal,
|
|
324
|
-
placement: placement
|
|
331
|
+
placement: placement,
|
|
332
|
+
modifiers: [{
|
|
333
|
+
name: 'flip',
|
|
334
|
+
enabled: true,
|
|
335
|
+
options: {
|
|
336
|
+
altBoundary: true,
|
|
337
|
+
rootBoundary: 'viewport',
|
|
338
|
+
padding: 8
|
|
339
|
+
}
|
|
340
|
+
}, {
|
|
341
|
+
name: 'preventOverflow',
|
|
342
|
+
enabled: true,
|
|
343
|
+
options: {
|
|
344
|
+
altAxis: true,
|
|
345
|
+
altBoundary: true,
|
|
346
|
+
tether: true,
|
|
347
|
+
rootBoundary: 'viewport',
|
|
348
|
+
padding: 8
|
|
349
|
+
}
|
|
350
|
+
}]
|
|
325
351
|
},
|
|
326
352
|
dialog: {
|
|
327
353
|
disablePortal: disablePortal
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.MuiPickersPopper-root {
|
|
44
|
+
font-size: 14px;
|
|
44
45
|
.MuiPickersLayout-root {
|
|
45
46
|
width: var(--pisell-date-range-picker-popup-width, 625px);
|
|
46
47
|
display: block;
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
}
|
|
60
61
|
.MuiPickersSlideTransition-root {
|
|
61
62
|
min-width: 200px;
|
|
63
|
+
min-height: 235px;
|
|
62
64
|
//min-height: auto;
|
|
63
65
|
&::before {
|
|
64
66
|
content: "";
|
|
@@ -75,6 +77,7 @@
|
|
|
75
77
|
.MuiDateRangePickerDay-day {
|
|
76
78
|
width: 100%;
|
|
77
79
|
height: auto;
|
|
80
|
+
font-size: 14px;
|
|
78
81
|
&::before {
|
|
79
82
|
content: "";
|
|
80
83
|
display: block;
|
|
@@ -89,6 +92,7 @@
|
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
.MuiDialog-root {
|
|
95
|
+
font-size: 14px;
|
|
92
96
|
.MuiPickersLayout-toolbar {
|
|
93
97
|
display: none;
|
|
94
98
|
}
|
|
@@ -99,13 +103,8 @@
|
|
|
99
103
|
grid-row: 1/3 !important;
|
|
100
104
|
}
|
|
101
105
|
|
|
102
|
-
.date-picker-paid-drawer {
|
|
103
|
-
.MuiPickersLayout-root {
|
|
104
|
-
display: block;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
106
|
.date-picker-custom-drawer {
|
|
107
|
+
font-size: 14px;
|
|
109
108
|
.MuiPickersCalendarHeader-root {
|
|
110
109
|
padding-left: 35px;
|
|
111
110
|
padding-right: 22px;
|
|
@@ -138,6 +137,7 @@
|
|
|
138
137
|
.MuiDateRangePickerDay-day {
|
|
139
138
|
width: 100%;
|
|
140
139
|
height: auto;
|
|
140
|
+
font-size: 14px;
|
|
141
141
|
&::before {
|
|
142
142
|
content: "";
|
|
143
143
|
display: block;
|
|
@@ -151,3 +151,30 @@
|
|
|
151
151
|
border-top-right-radius: 8px;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
.date-picker-paid-drawer {
|
|
157
|
+
font-size: 14px;
|
|
158
|
+
.MuiPickersLayout-root {
|
|
159
|
+
display: block;
|
|
160
|
+
}
|
|
161
|
+
.MuiDayCalendar-slideTransition {
|
|
162
|
+
height: 370px;
|
|
163
|
+
}
|
|
164
|
+
.MuiDateRangeCalendar-monthContainer {
|
|
165
|
+
.MuiDateRangePickerDay-root {
|
|
166
|
+
max-width: 60px;
|
|
167
|
+
max-height: 60px;
|
|
168
|
+
.MuiDateRangePickerDay-day {
|
|
169
|
+
width: 100%;
|
|
170
|
+
height: auto;
|
|
171
|
+
font-size: 14px;
|
|
172
|
+
&::before {
|
|
173
|
+
content: "";
|
|
174
|
+
display: block;
|
|
175
|
+
padding-top: 100%;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
package/es/Toolbar/index.js
CHANGED
|
@@ -35,14 +35,24 @@ var Toolbar = function Toolbar(props) {
|
|
|
35
35
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
36
36
|
endStr = _useState4[0],
|
|
37
37
|
setEndStr = _useState4[1];
|
|
38
|
+
var _useState5 = useState(false),
|
|
39
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
40
|
+
startError = _useState6[0],
|
|
41
|
+
setStartError = _useState6[1];
|
|
42
|
+
var _useState7 = useState(false),
|
|
43
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
44
|
+
endError = _useState8[0],
|
|
45
|
+
setEndError = _useState8[1];
|
|
38
46
|
useEffect(function () {
|
|
39
47
|
if (value !== null && value !== void 0 && value[0]) {
|
|
40
48
|
setStartStr(value[0].format(format));
|
|
49
|
+
setStartError(false);
|
|
41
50
|
} else {
|
|
42
51
|
setStartStr('');
|
|
43
52
|
}
|
|
44
53
|
if (value !== null && value !== void 0 && value[1]) {
|
|
45
54
|
setEndStr(value[1].format(format));
|
|
55
|
+
setEndError(false);
|
|
46
56
|
} else {
|
|
47
57
|
setEndStr('');
|
|
48
58
|
}
|
|
@@ -52,11 +62,14 @@ var Toolbar = function Toolbar(props) {
|
|
|
52
62
|
setStartStr(val);
|
|
53
63
|
if (isValidDate(val, format)) {
|
|
54
64
|
var _start$set, _start$set$set;
|
|
65
|
+
setStartError(false);
|
|
55
66
|
var valDate = dayjs(val, format);
|
|
56
67
|
var newValue = _toConsumableArray(value);
|
|
57
68
|
var start = newValue[0] || dayjs();
|
|
58
69
|
newValue[0] = (start === null || start === void 0 ? void 0 : (_start$set = start.set('year', (valDate === null || valDate === void 0 ? void 0 : valDate.get('year')) || 0)) === null || _start$set === void 0 ? void 0 : (_start$set$set = _start$set.set('month', (valDate === null || valDate === void 0 ? void 0 : valDate.get('month')) || 0)) === null || _start$set$set === void 0 ? void 0 : _start$set$set.set('date', (valDate === null || valDate === void 0 ? void 0 : valDate.get('date')) || 0)) || null;
|
|
59
70
|
onChange(newValue);
|
|
71
|
+
} else {
|
|
72
|
+
setStartError(true);
|
|
60
73
|
}
|
|
61
74
|
};
|
|
62
75
|
var handleEndChange = function handleEndChange(e) {
|
|
@@ -64,11 +77,14 @@ var Toolbar = function Toolbar(props) {
|
|
|
64
77
|
setEndStr(val);
|
|
65
78
|
if (isValidDate(val, format)) {
|
|
66
79
|
var _end$set, _end$set$set;
|
|
80
|
+
setEndError(false);
|
|
67
81
|
var valDate = dayjs(val, format);
|
|
68
82
|
var newValue = _toConsumableArray(value);
|
|
69
83
|
var end = newValue[1] || dayjs();
|
|
70
84
|
newValue[1] = (end === null || end === void 0 ? void 0 : (_end$set = end.set('year', (valDate === null || valDate === void 0 ? void 0 : valDate.get('year')) || 0)) === null || _end$set === void 0 ? void 0 : (_end$set$set = _end$set.set('month', (valDate === null || valDate === void 0 ? void 0 : valDate.get('month')) || 0)) === null || _end$set$set === void 0 ? void 0 : _end$set$set.set('date', (valDate === null || valDate === void 0 ? void 0 : valDate.get('date')) || 0)) || null;
|
|
71
85
|
onChange(newValue);
|
|
86
|
+
} else {
|
|
87
|
+
setEndError(true);
|
|
72
88
|
}
|
|
73
89
|
};
|
|
74
90
|
var handleSelectChange = function handleSelectChange(e) {
|
|
@@ -106,17 +122,23 @@ var Toolbar = function Toolbar(props) {
|
|
|
106
122
|
}, /*#__PURE__*/React.createElement("div", {
|
|
107
123
|
className: "date-picker-toolbar-start-wrap"
|
|
108
124
|
}, /*#__PURE__*/React.createElement("span", null, getText('toolbar-date-range-shortcut-starting', pLocaleMap[locale])), /*#__PURE__*/React.createElement(Input, {
|
|
125
|
+
status: startError ? "error" : "",
|
|
109
126
|
size: "large",
|
|
110
127
|
value: startStr,
|
|
111
128
|
onChange: handleStartChange,
|
|
112
129
|
placeholder: dayjs().format(format)
|
|
113
|
-
})
|
|
130
|
+
}), startError && /*#__PURE__*/React.createElement("span", {
|
|
131
|
+
className: "date-picker-error"
|
|
132
|
+
}, getText('toolbar-date-range-invalid-start-date', pLocaleMap[locale]))), /*#__PURE__*/React.createElement("div", {
|
|
114
133
|
className: "date-picker-toolbar-end-wrap"
|
|
115
134
|
}, /*#__PURE__*/React.createElement("span", null, getText('toolbar-date-range-shortcut-ending', pLocaleMap[locale])), /*#__PURE__*/React.createElement(Input, {
|
|
135
|
+
status: endError ? "error" : "",
|
|
116
136
|
size: "large",
|
|
117
137
|
value: endStr,
|
|
118
138
|
onChange: handleEndChange,
|
|
119
139
|
placeholder: dayjs().format(format)
|
|
120
|
-
})
|
|
140
|
+
}), endError && /*#__PURE__*/React.createElement("span", {
|
|
141
|
+
className: "date-picker-error"
|
|
142
|
+
}, getText('toolbar-date-range-invalid-end-date', pLocaleMap[locale])))));
|
|
121
143
|
};
|
|
122
144
|
export default Toolbar;
|
package/es/Toolbar/index.less
CHANGED
package/es/locales/en-US.d.ts
CHANGED
|
@@ -20,5 +20,7 @@ declare const _default: {
|
|
|
20
20
|
"toolbar-date-range-shortcut-next-30-days": string;
|
|
21
21
|
"toolbar-date-range-shortcut-next-90-days": string;
|
|
22
22
|
"toolbar-date-range-shortcut-next-180-days": string;
|
|
23
|
+
"toolbar-date-range-invalid-start-date": string;
|
|
24
|
+
"toolbar-date-range-invalid-end-date": string;
|
|
23
25
|
};
|
|
24
26
|
export default _default;
|
package/es/locales/en-US.js
CHANGED
|
@@ -19,5 +19,7 @@ export default {
|
|
|
19
19
|
"toolbar-date-range-shortcut-next-7-days": "Next 7 days",
|
|
20
20
|
"toolbar-date-range-shortcut-next-30-days": "Next 30 days",
|
|
21
21
|
"toolbar-date-range-shortcut-next-90-days": "Next 90 days",
|
|
22
|
-
"toolbar-date-range-shortcut-next-180-days": "Next 180 days"
|
|
22
|
+
"toolbar-date-range-shortcut-next-180-days": "Next 180 days",
|
|
23
|
+
"toolbar-date-range-invalid-start-date": "Invalid start date",
|
|
24
|
+
"toolbar-date-range-invalid-end-date": "Invalid end date"
|
|
23
25
|
};
|
package/es/locales/zh-CN.d.ts
CHANGED
|
@@ -20,5 +20,7 @@ declare const _default: {
|
|
|
20
20
|
"toolbar-date-range-shortcut-next-30-days": string;
|
|
21
21
|
"toolbar-date-range-shortcut-next-90-days": string;
|
|
22
22
|
"toolbar-date-range-shortcut-next-180-days": string;
|
|
23
|
+
"toolbar-date-range-invalid-start-date": string;
|
|
24
|
+
"toolbar-date-range-invalid-end-date": string;
|
|
23
25
|
};
|
|
24
26
|
export default _default;
|
package/es/locales/zh-CN.js
CHANGED
|
@@ -19,5 +19,7 @@ export default {
|
|
|
19
19
|
"toolbar-date-range-shortcut-next-7-days": "未来7天",
|
|
20
20
|
"toolbar-date-range-shortcut-next-30-days": "未来30天",
|
|
21
21
|
"toolbar-date-range-shortcut-next-90-days": "未来90天",
|
|
22
|
-
"toolbar-date-range-shortcut-next-180-days": "未来180天"
|
|
22
|
+
"toolbar-date-range-shortcut-next-180-days": "未来180天",
|
|
23
|
+
"toolbar-date-range-invalid-start-date": "开始日期无效",
|
|
24
|
+
"toolbar-date-range-invalid-end-date": "结束日期无效"
|
|
23
25
|
};
|
package/es/locales/zh-TW.d.ts
CHANGED
|
@@ -20,5 +20,7 @@ declare const _default: {
|
|
|
20
20
|
"toolbar-date-range-shortcut-next-30-days": string;
|
|
21
21
|
"toolbar-date-range-shortcut-next-90-days": string;
|
|
22
22
|
"toolbar-date-range-shortcut-next-180-days": string;
|
|
23
|
+
"toolbar-date-range-invalid-start-date": string;
|
|
24
|
+
"toolbar-date-range-invalid-end-date": string;
|
|
23
25
|
};
|
|
24
26
|
export default _default;
|
package/es/locales/zh-TW.js
CHANGED
|
@@ -19,5 +19,7 @@ export default {
|
|
|
19
19
|
"toolbar-date-range-shortcut-next-7-days": "未來7天",
|
|
20
20
|
"toolbar-date-range-shortcut-next-30-days": "未來30天",
|
|
21
21
|
"toolbar-date-range-shortcut-next-90-days": "未來90天",
|
|
22
|
-
"toolbar-date-range-shortcut-next-180-days": "未來180天"
|
|
22
|
+
"toolbar-date-range-shortcut-next-180-days": "未來180天",
|
|
23
|
+
"toolbar-date-range-invalid-start-date": "開始日期無效",
|
|
24
|
+
"toolbar-date-range-invalid-end-date": "結束日期無效"
|
|
23
25
|
};
|
package/lib/Dialog/index.js
CHANGED
|
@@ -33,18 +33,31 @@ __export(Dialog_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(Dialog_exports);
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_Dialog = __toESM(require("@mui/material/Dialog"));
|
|
36
37
|
var import_Drawer = __toESM(require("@mui/material/Drawer"));
|
|
37
38
|
var Dialog = (props) => {
|
|
38
39
|
const { open, onClose, children } = props;
|
|
40
|
+
const isMobile = window.innerWidth < 768;
|
|
41
|
+
if (isMobile) {
|
|
42
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
43
|
+
import_Drawer.default,
|
|
44
|
+
{
|
|
45
|
+
anchor: "bottom",
|
|
46
|
+
open,
|
|
47
|
+
onClose,
|
|
48
|
+
height: 650,
|
|
49
|
+
autoFocus: true,
|
|
50
|
+
className: "date-picker-custom-drawer"
|
|
51
|
+
},
|
|
52
|
+
children
|
|
53
|
+
);
|
|
54
|
+
}
|
|
39
55
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
40
|
-
|
|
56
|
+
import_Dialog.default,
|
|
41
57
|
{
|
|
42
|
-
anchor: "bottom",
|
|
43
58
|
open,
|
|
44
59
|
onClose,
|
|
45
|
-
|
|
46
|
-
autoFocus: true,
|
|
47
|
-
className: window.innerWidth > 800 ? "date-picker-paid-drawer" : "date-picker-custom-drawer"
|
|
60
|
+
className: "date-picker-paid-drawer date-picker-custom-drawer"
|
|
48
61
|
},
|
|
49
62
|
children
|
|
50
63
|
);
|
|
@@ -90,7 +90,7 @@ var PisellDateRangePicker = (props) => {
|
|
|
90
90
|
okButtonProps,
|
|
91
91
|
cancelButtonProps,
|
|
92
92
|
onDateChange,
|
|
93
|
-
desktopModeMediaQuery
|
|
93
|
+
desktopModeMediaQuery,
|
|
94
94
|
style,
|
|
95
95
|
allowClear,
|
|
96
96
|
disablePortal,
|
|
@@ -315,7 +315,29 @@ var PisellDateRangePicker = (props) => {
|
|
|
315
315
|
popper: {
|
|
316
316
|
className: popupClassName,
|
|
317
317
|
disablePortal,
|
|
318
|
-
placement
|
|
318
|
+
placement,
|
|
319
|
+
modifiers: [
|
|
320
|
+
{
|
|
321
|
+
name: "flip",
|
|
322
|
+
enabled: true,
|
|
323
|
+
options: {
|
|
324
|
+
altBoundary: true,
|
|
325
|
+
rootBoundary: "viewport",
|
|
326
|
+
padding: 8
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
name: "preventOverflow",
|
|
331
|
+
enabled: true,
|
|
332
|
+
options: {
|
|
333
|
+
altAxis: true,
|
|
334
|
+
altBoundary: true,
|
|
335
|
+
tether: true,
|
|
336
|
+
rootBoundary: "viewport",
|
|
337
|
+
padding: 8
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
]
|
|
319
341
|
},
|
|
320
342
|
dialog: {
|
|
321
343
|
disablePortal
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.MuiPickersPopper-root {
|
|
44
|
+
font-size: 14px;
|
|
44
45
|
.MuiPickersLayout-root {
|
|
45
46
|
width: var(--pisell-date-range-picker-popup-width, 625px);
|
|
46
47
|
display: block;
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
}
|
|
60
61
|
.MuiPickersSlideTransition-root {
|
|
61
62
|
min-width: 200px;
|
|
63
|
+
min-height: 235px;
|
|
62
64
|
//min-height: auto;
|
|
63
65
|
&::before {
|
|
64
66
|
content: "";
|
|
@@ -75,6 +77,7 @@
|
|
|
75
77
|
.MuiDateRangePickerDay-day {
|
|
76
78
|
width: 100%;
|
|
77
79
|
height: auto;
|
|
80
|
+
font-size: 14px;
|
|
78
81
|
&::before {
|
|
79
82
|
content: "";
|
|
80
83
|
display: block;
|
|
@@ -89,6 +92,7 @@
|
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
.MuiDialog-root {
|
|
95
|
+
font-size: 14px;
|
|
92
96
|
.MuiPickersLayout-toolbar {
|
|
93
97
|
display: none;
|
|
94
98
|
}
|
|
@@ -99,13 +103,8 @@
|
|
|
99
103
|
grid-row: 1/3 !important;
|
|
100
104
|
}
|
|
101
105
|
|
|
102
|
-
.date-picker-paid-drawer {
|
|
103
|
-
.MuiPickersLayout-root {
|
|
104
|
-
display: block;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
106
|
.date-picker-custom-drawer {
|
|
107
|
+
font-size: 14px;
|
|
109
108
|
.MuiPickersCalendarHeader-root {
|
|
110
109
|
padding-left: 35px;
|
|
111
110
|
padding-right: 22px;
|
|
@@ -138,6 +137,7 @@
|
|
|
138
137
|
.MuiDateRangePickerDay-day {
|
|
139
138
|
width: 100%;
|
|
140
139
|
height: auto;
|
|
140
|
+
font-size: 14px;
|
|
141
141
|
&::before {
|
|
142
142
|
content: "";
|
|
143
143
|
display: block;
|
|
@@ -151,3 +151,30 @@
|
|
|
151
151
|
border-top-right-radius: 8px;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
.date-picker-paid-drawer {
|
|
157
|
+
font-size: 14px;
|
|
158
|
+
.MuiPickersLayout-root {
|
|
159
|
+
display: block;
|
|
160
|
+
}
|
|
161
|
+
.MuiDayCalendar-slideTransition {
|
|
162
|
+
height: 370px;
|
|
163
|
+
}
|
|
164
|
+
.MuiDateRangeCalendar-monthContainer {
|
|
165
|
+
.MuiDateRangePickerDay-root {
|
|
166
|
+
max-width: 60px;
|
|
167
|
+
max-height: 60px;
|
|
168
|
+
.MuiDateRangePickerDay-day {
|
|
169
|
+
width: 100%;
|
|
170
|
+
height: auto;
|
|
171
|
+
font-size: 14px;
|
|
172
|
+
&::before {
|
|
173
|
+
content: "";
|
|
174
|
+
display: block;
|
|
175
|
+
padding-top: 100%;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
package/lib/Toolbar/index.js
CHANGED
|
@@ -54,14 +54,18 @@ var Toolbar = (props) => {
|
|
|
54
54
|
const format = locale === "en" || locale === "en-US" ? "DD/MM/YYYY" : "YYYY/MM/DD";
|
|
55
55
|
const [startStr, setStartStr] = (0, import_react.useState)("");
|
|
56
56
|
const [endStr, setEndStr] = (0, import_react.useState)("");
|
|
57
|
+
const [startError, setStartError] = (0, import_react.useState)(false);
|
|
58
|
+
const [endError, setEndError] = (0, import_react.useState)(false);
|
|
57
59
|
(0, import_react.useEffect)(() => {
|
|
58
60
|
if (value == null ? void 0 : value[0]) {
|
|
59
61
|
setStartStr(value[0].format(format));
|
|
62
|
+
setStartError(false);
|
|
60
63
|
} else {
|
|
61
64
|
setStartStr("");
|
|
62
65
|
}
|
|
63
66
|
if (value == null ? void 0 : value[1]) {
|
|
64
67
|
setEndStr(value[1].format(format));
|
|
68
|
+
setEndError(false);
|
|
65
69
|
} else {
|
|
66
70
|
setEndStr("");
|
|
67
71
|
}
|
|
@@ -71,11 +75,14 @@ var Toolbar = (props) => {
|
|
|
71
75
|
const val = e.target.value;
|
|
72
76
|
setStartStr(val);
|
|
73
77
|
if (isValidDate(val, format)) {
|
|
78
|
+
setStartError(false);
|
|
74
79
|
const valDate = (0, import_dayjs.default)(val, format);
|
|
75
80
|
const newValue = [...value];
|
|
76
81
|
const start = newValue[0] || (0, import_dayjs.default)();
|
|
77
82
|
newValue[0] = ((_b = (_a = start == null ? void 0 : start.set("year", (valDate == null ? void 0 : valDate.get("year")) || 0)) == null ? void 0 : _a.set("month", (valDate == null ? void 0 : valDate.get("month")) || 0)) == null ? void 0 : _b.set("date", (valDate == null ? void 0 : valDate.get("date")) || 0)) || null;
|
|
78
83
|
onChange(newValue);
|
|
84
|
+
} else {
|
|
85
|
+
setStartError(true);
|
|
79
86
|
}
|
|
80
87
|
};
|
|
81
88
|
const handleEndChange = (e) => {
|
|
@@ -83,11 +90,14 @@ var Toolbar = (props) => {
|
|
|
83
90
|
const val = e.target.value;
|
|
84
91
|
setEndStr(val);
|
|
85
92
|
if (isValidDate(val, format)) {
|
|
93
|
+
setEndError(false);
|
|
86
94
|
const valDate = (0, import_dayjs.default)(val, format);
|
|
87
95
|
const newValue = [...value];
|
|
88
96
|
const end = newValue[1] || (0, import_dayjs.default)();
|
|
89
97
|
newValue[1] = ((_b = (_a = end == null ? void 0 : end.set("year", (valDate == null ? void 0 : valDate.get("year")) || 0)) == null ? void 0 : _a.set("month", (valDate == null ? void 0 : valDate.get("month")) || 0)) == null ? void 0 : _b.set("date", (valDate == null ? void 0 : valDate.get("date")) || 0)) || null;
|
|
90
98
|
onChange(newValue);
|
|
99
|
+
} else {
|
|
100
|
+
setEndError(true);
|
|
91
101
|
}
|
|
92
102
|
};
|
|
93
103
|
const handleSelectChange = (e) => {
|
|
@@ -135,19 +145,27 @@ var Toolbar = (props) => {
|
|
|
135
145
|
)), /* @__PURE__ */ import_react.default.createElement(
|
|
136
146
|
import_antd.Input,
|
|
137
147
|
{
|
|
148
|
+
status: startError ? "error" : "",
|
|
138
149
|
size: "large",
|
|
139
150
|
value: startStr,
|
|
140
151
|
onChange: handleStartChange,
|
|
141
152
|
placeholder: (0, import_dayjs.default)().format(format)
|
|
142
153
|
}
|
|
143
|
-
)
|
|
154
|
+
), startError && /* @__PURE__ */ import_react.default.createElement("span", { className: "date-picker-error" }, (0, import_locales.getText)(
|
|
155
|
+
"toolbar-date-range-invalid-start-date",
|
|
156
|
+
import_locales.pLocaleMap[locale]
|
|
157
|
+
))), /* @__PURE__ */ import_react.default.createElement("div", { className: "date-picker-toolbar-end-wrap" }, /* @__PURE__ */ import_react.default.createElement("span", null, (0, import_locales.getText)("toolbar-date-range-shortcut-ending", import_locales.pLocaleMap[locale])), /* @__PURE__ */ import_react.default.createElement(
|
|
144
158
|
import_antd.Input,
|
|
145
159
|
{
|
|
160
|
+
status: endError ? "error" : "",
|
|
146
161
|
size: "large",
|
|
147
162
|
value: endStr,
|
|
148
163
|
onChange: handleEndChange,
|
|
149
164
|
placeholder: (0, import_dayjs.default)().format(format)
|
|
150
165
|
}
|
|
151
|
-
))
|
|
166
|
+
), endError && /* @__PURE__ */ import_react.default.createElement("span", { className: "date-picker-error" }, (0, import_locales.getText)(
|
|
167
|
+
"toolbar-date-range-invalid-end-date",
|
|
168
|
+
import_locales.pLocaleMap[locale]
|
|
169
|
+
)))));
|
|
152
170
|
};
|
|
153
171
|
var Toolbar_default = Toolbar;
|
package/lib/Toolbar/index.less
CHANGED
package/lib/locales/en-US.d.ts
CHANGED
|
@@ -20,5 +20,7 @@ declare const _default: {
|
|
|
20
20
|
"toolbar-date-range-shortcut-next-30-days": string;
|
|
21
21
|
"toolbar-date-range-shortcut-next-90-days": string;
|
|
22
22
|
"toolbar-date-range-shortcut-next-180-days": string;
|
|
23
|
+
"toolbar-date-range-invalid-start-date": string;
|
|
24
|
+
"toolbar-date-range-invalid-end-date": string;
|
|
23
25
|
};
|
|
24
26
|
export default _default;
|
package/lib/locales/en-US.js
CHANGED
|
@@ -43,5 +43,7 @@ var en_US_default = {
|
|
|
43
43
|
"toolbar-date-range-shortcut-next-7-days": "Next 7 days",
|
|
44
44
|
"toolbar-date-range-shortcut-next-30-days": "Next 30 days",
|
|
45
45
|
"toolbar-date-range-shortcut-next-90-days": "Next 90 days",
|
|
46
|
-
"toolbar-date-range-shortcut-next-180-days": "Next 180 days"
|
|
46
|
+
"toolbar-date-range-shortcut-next-180-days": "Next 180 days",
|
|
47
|
+
"toolbar-date-range-invalid-start-date": "Invalid start date",
|
|
48
|
+
"toolbar-date-range-invalid-end-date": "Invalid end date"
|
|
47
49
|
};
|
package/lib/locales/zh-CN.d.ts
CHANGED
|
@@ -20,5 +20,7 @@ declare const _default: {
|
|
|
20
20
|
"toolbar-date-range-shortcut-next-30-days": string;
|
|
21
21
|
"toolbar-date-range-shortcut-next-90-days": string;
|
|
22
22
|
"toolbar-date-range-shortcut-next-180-days": string;
|
|
23
|
+
"toolbar-date-range-invalid-start-date": string;
|
|
24
|
+
"toolbar-date-range-invalid-end-date": string;
|
|
23
25
|
};
|
|
24
26
|
export default _default;
|
package/lib/locales/zh-CN.js
CHANGED
|
@@ -43,5 +43,7 @@ var zh_CN_default = {
|
|
|
43
43
|
"toolbar-date-range-shortcut-next-7-days": "未来7天",
|
|
44
44
|
"toolbar-date-range-shortcut-next-30-days": "未来30天",
|
|
45
45
|
"toolbar-date-range-shortcut-next-90-days": "未来90天",
|
|
46
|
-
"toolbar-date-range-shortcut-next-180-days": "未来180天"
|
|
46
|
+
"toolbar-date-range-shortcut-next-180-days": "未来180天",
|
|
47
|
+
"toolbar-date-range-invalid-start-date": "开始日期无效",
|
|
48
|
+
"toolbar-date-range-invalid-end-date": "结束日期无效"
|
|
47
49
|
};
|
package/lib/locales/zh-TW.d.ts
CHANGED
|
@@ -20,5 +20,7 @@ declare const _default: {
|
|
|
20
20
|
"toolbar-date-range-shortcut-next-30-days": string;
|
|
21
21
|
"toolbar-date-range-shortcut-next-90-days": string;
|
|
22
22
|
"toolbar-date-range-shortcut-next-180-days": string;
|
|
23
|
+
"toolbar-date-range-invalid-start-date": string;
|
|
24
|
+
"toolbar-date-range-invalid-end-date": string;
|
|
23
25
|
};
|
|
24
26
|
export default _default;
|
package/lib/locales/zh-TW.js
CHANGED
|
@@ -43,5 +43,7 @@ var zh_TW_default = {
|
|
|
43
43
|
"toolbar-date-range-shortcut-next-7-days": "未來7天",
|
|
44
44
|
"toolbar-date-range-shortcut-next-30-days": "未來30天",
|
|
45
45
|
"toolbar-date-range-shortcut-next-90-days": "未來90天",
|
|
46
|
-
"toolbar-date-range-shortcut-next-180-days": "未來180天"
|
|
46
|
+
"toolbar-date-range-shortcut-next-180-days": "未來180天",
|
|
47
|
+
"toolbar-date-range-invalid-start-date": "開始日期無效",
|
|
48
|
+
"toolbar-date-range-invalid-end-date": "結束日期無效"
|
|
47
49
|
};
|