@pisell/date-picker 1.0.67 → 1.0.68
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Dayjs } from "dayjs";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { ButtonProps } from "antd";
|
|
4
|
+
import { PopperPlacementType } from "@mui/base/Popper/Popper.types";
|
|
4
5
|
import { PresetType } from "../Shortcuts";
|
|
5
6
|
import 'dayjs/locale/zh-cn';
|
|
6
7
|
import 'dayjs/locale/en';
|
|
@@ -69,6 +70,8 @@ export interface PisellDateRangePickerProps {
|
|
|
69
70
|
allowClear?: boolean;
|
|
70
71
|
/** true 将弹窗当前DOM层次结构下 false 追加到body */
|
|
71
72
|
disablePortal?: boolean;
|
|
73
|
+
/** 弹窗放置位置 */
|
|
74
|
+
placement?: PopperPlacementType;
|
|
72
75
|
}
|
|
73
76
|
declare const PisellDateRangePicker: (props: PisellDateRangePickerProps) => JSX.Element;
|
|
74
77
|
export default PisellDateRangePicker;
|
|
@@ -60,7 +60,9 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
60
60
|
desktopModeMediaQuery = props.desktopModeMediaQuery,
|
|
61
61
|
style = props.style,
|
|
62
62
|
allowClear = props.allowClear,
|
|
63
|
-
disablePortal = props.disablePortal
|
|
63
|
+
disablePortal = props.disablePortal,
|
|
64
|
+
_props$placement = props.placement,
|
|
65
|
+
placement = _props$placement === void 0 ? "auto" : _props$placement;
|
|
64
66
|
var _useState = useState(propsOpen !== null && propsOpen !== void 0 ? propsOpen : false),
|
|
65
67
|
_useState2 = _slicedToArray(_useState, 2),
|
|
66
68
|
open = _useState2[0],
|
|
@@ -118,7 +120,7 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
118
120
|
return item || null;
|
|
119
121
|
});
|
|
120
122
|
}
|
|
121
|
-
if (clearEndOnSelection && _value.filter(Boolean).length === 2) {
|
|
123
|
+
if (clearEndOnSelection && type !== "set" && _value.filter(Boolean).length === 2) {
|
|
122
124
|
newVal = [newVal[0], null];
|
|
123
125
|
}
|
|
124
126
|
onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(newVal);
|
|
@@ -212,7 +214,7 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
212
214
|
popper: {
|
|
213
215
|
className: popupClassName,
|
|
214
216
|
disablePortal: disablePortal,
|
|
215
|
-
placement:
|
|
217
|
+
placement: placement
|
|
216
218
|
},
|
|
217
219
|
mobilePaper: {
|
|
218
220
|
className: popupClassName
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Dayjs } from "dayjs";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { ButtonProps } from "antd";
|
|
4
|
+
import { PopperPlacementType } from "@mui/base/Popper/Popper.types";
|
|
4
5
|
import { PresetType } from "../Shortcuts";
|
|
5
6
|
import 'dayjs/locale/zh-cn';
|
|
6
7
|
import 'dayjs/locale/en';
|
|
@@ -69,6 +70,8 @@ export interface PisellDateRangePickerProps {
|
|
|
69
70
|
allowClear?: boolean;
|
|
70
71
|
/** true 将弹窗当前DOM层次结构下 false 追加到body */
|
|
71
72
|
disablePortal?: boolean;
|
|
73
|
+
/** 弹窗放置位置 */
|
|
74
|
+
placement?: PopperPlacementType;
|
|
72
75
|
}
|
|
73
76
|
declare const PisellDateRangePicker: (props: PisellDateRangePickerProps) => JSX.Element;
|
|
74
77
|
export default PisellDateRangePicker;
|
|
@@ -83,7 +83,8 @@ var PisellDateRangePicker = (props) => {
|
|
|
83
83
|
desktopModeMediaQuery,
|
|
84
84
|
style,
|
|
85
85
|
allowClear,
|
|
86
|
-
disablePortal
|
|
86
|
+
disablePortal,
|
|
87
|
+
placement = "auto"
|
|
87
88
|
} = props;
|
|
88
89
|
const [open, setOpen] = (0, import_react.useState)(propsOpen ?? false);
|
|
89
90
|
(0, import_react.useEffect)(() => {
|
|
@@ -135,7 +136,7 @@ var PisellDateRangePicker = (props) => {
|
|
|
135
136
|
return item || null;
|
|
136
137
|
});
|
|
137
138
|
}
|
|
138
|
-
if (clearEndOnSelection && _value.filter(Boolean).length === 2) {
|
|
139
|
+
if (clearEndOnSelection && type !== "set" && _value.filter(Boolean).length === 2) {
|
|
139
140
|
newVal = [newVal[0], null];
|
|
140
141
|
}
|
|
141
142
|
onDateChange == null ? void 0 : onDateChange(newVal);
|
|
@@ -230,7 +231,7 @@ var PisellDateRangePicker = (props) => {
|
|
|
230
231
|
popper: {
|
|
231
232
|
className: popupClassName,
|
|
232
233
|
disablePortal,
|
|
233
|
-
placement
|
|
234
|
+
placement
|
|
234
235
|
},
|
|
235
236
|
mobilePaper: {
|
|
236
237
|
className: popupClassName
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/date-picker",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.68",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.less"
|
|
6
6
|
],
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"antd": "^5.5.0",
|
|
27
27
|
"react": "^18.0.0",
|
|
28
28
|
"react-dom": "^18.0.0",
|
|
29
|
-
"@pisell/utils": "1.0.
|
|
29
|
+
"@pisell/utils": "1.0.23"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"es",
|