@pisell/date-picker 1.0.75-7 → 1.0.75-8
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/ActionBar/index.d.ts +2 -1
- package/es/ActionBar/index.js +11 -13
- package/es/DateRangeCalendar/DateRangeCalendar.js +11 -12
- package/es/DateRangeCalendar/useDragRange.js +6 -6
- package/es/DateRangePicker/DateRangePickerToolbar.d.ts +2 -1
- package/es/DateRangePicker/DateRangePickerToolbar.js +1 -1
- package/es/DateRangePicker/shared.js +5 -5
- package/es/DateRangePickerDay/DateRangePickerDay.js +8 -9
- package/es/DesktopDateRangePicker/DesktopDateRangePicker.js +5 -5
- package/es/MobileDateRangePicker/MobileDateRangePicker.js +5 -5
- package/es/MultiInputDateRangeField/MultiInputDateRangeField.js +5 -5
- package/es/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +5 -5
- package/es/MultiInputTimeRangeField/MultiInputTimeRangeField.js +5 -5
- package/es/PisellDateRangePicker/CloseCircle.d.ts +2 -1
- package/es/PisellDateRangePicker/LocaleContext.d.ts +7 -2
- package/es/PisellDateRangePicker/index.d.ts +1 -1
- package/es/PisellDateRangePicker/index.js +22 -45
- package/es/PisellDateRangePicker/useCssVariables.js +1 -1
- package/es/Shortcuts/index.d.ts +2 -1
- package/es/Shortcuts/index.js +1 -1
- package/es/SingleInputDateRangeField/SingleInputDateRangeField.js +5 -5
- package/es/SingleInputDateRangeField/useSingleInputDateRangeField.js +5 -5
- package/es/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +5 -5
- package/es/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +5 -5
- package/es/SingleInputTimeRangeField/SingleInputTimeRangeField.js +5 -5
- package/es/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +5 -5
- package/es/StaticDateRangePicker/StaticDateRangePicker.js +5 -5
- package/es/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -1
- package/es/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +2 -1
- package/es/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +5 -5
- package/es/internals/hooks/useEnrichedRangePickerFieldProps.js +9 -9
- package/es/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +2 -1
- package/es/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +6 -6
- package/es/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +5 -5
- package/es/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +5 -5
- package/es/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +5 -5
- package/es/internals/hooks/useRangePosition.js +2 -2
- package/es/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +2 -1
- package/es/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +7 -7
- package/es/internals/utils/date-fields-utils.d.ts +1 -1
- package/es/internals/utils/date-fields-utils.js +5 -5
- package/es/internals/utils/date-range-manager.js +1 -1
- package/es/internals/utils/validation/validateDateRange.js +6 -6
- package/es/internals/utils/validation/validateDateTimeRange.js +6 -6
- package/es/internals/utils/validation/validateTimeRange.js +1 -1
- package/es/internals/utils/valueManagers.js +6 -6
- package/es/locales/index.js +11 -3
- package/es/locales/ja.d.ts +26 -0
- package/es/locales/ja.js +25 -0
- package/es/locales/pt.d.ts +26 -0
- package/es/locales/pt.js +25 -0
- package/es/utils/index.d.ts +1 -1
- package/lib/ActionBar/index.d.ts +2 -1
- package/lib/ActionBar/index.js +2 -4
- package/lib/DateRangePicker/DateRangePickerToolbar.d.ts +2 -1
- package/lib/PisellDateRangePicker/CloseCircle.d.ts +2 -1
- package/lib/PisellDateRangePicker/LocaleContext.d.ts +7 -2
- package/lib/PisellDateRangePicker/index.d.ts +1 -1
- package/lib/PisellDateRangePicker/index.js +2 -26
- package/lib/PisellDateRangePicker/useCssVariables.js +1 -2
- package/lib/Shortcuts/index.d.ts +2 -1
- package/lib/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -1
- package/lib/index.d.ts +1 -5
- package/lib/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +2 -1
- package/lib/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +2 -1
- package/lib/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +2 -1
- package/lib/internals/utils/date-fields-utils.d.ts +1 -1
- package/lib/locales/index.js +11 -3
- package/lib/locales/ja.d.ts +26 -0
- package/lib/locales/ja.js +49 -0
- package/lib/locales/pt.d.ts +26 -0
- package/lib/locales/pt.js +49 -0
- package/lib/utils/index.d.ts +1 -1
- package/package.json +1 -1
- package/es/CustomCalendarHeader/index.d.ts +0 -2
- package/es/CustomCalendarHeader/index.js +0 -53
- package/es/Dialog/index.d.ts +0 -2
- package/es/Dialog/index.js +0 -25
- package/es/Drawer/index.d.ts +0 -11
- package/es/Drawer/index.js +0 -35
- package/es/Drawer/index.less +0 -40
- package/es/OldActionBar/index.d.ts +0 -19
- package/es/OldActionBar/index.js +0 -113
- package/es/OldActionBar/index.less +0 -18
- package/es/OldPisellDateRangePicker/index.d.ts +0 -79
- package/es/OldPisellDateRangePicker/index.js +0 -264
- package/es/OldPisellDateRangePicker/index.less +0 -102
- package/es/Toolbar/index.d.ts +0 -3
- package/es/Toolbar/index.js +0 -166
- package/es/Toolbar/index.less +0 -35
- package/es/browserSelect/chevron-down.png +0 -0
- package/es/browserSelect/index.d.ts +0 -15
- package/es/browserSelect/index.js +0 -36
- package/es/browserSelect/index.less +0 -18
- package/es/constants.d.ts +0 -58
- package/es/constants.js +0 -128
- package/es/hooks/useDocumentVisibility.d.ts +0 -2
- package/es/hooks/useDocumentVisibility.js +0 -27
- package/es/hooks/useNextDay.d.ts +0 -2
- package/es/hooks/useNextDay.js +0 -15
- package/es/hooks/useUpdateEffect.d.ts +0 -2
- package/es/hooks/useUpdateEffect.js +0 -11
- package/es/icon/ChevronLeft.d.ts +0 -5
- package/es/icon/ChevronLeft.js +0 -23
- package/es/icon/ChevronLeftDouble.d.ts +0 -5
- package/es/icon/ChevronLeftDouble.js +0 -23
- package/es/icon/ChevronRight.d.ts +0 -5
- package/es/icon/ChevronRight.js +0 -23
- package/es/icon/ChevronRightDouble.d.ts +0 -5
- package/es/icon/ChevronRightDouble.js +0 -23
- package/es/icon/CloseCircle.d.ts +0 -5
- package/es/icon/CloseCircle.js +0 -26
- package/lib/CustomCalendarHeader/index.d.ts +0 -2
- package/lib/CustomCalendarHeader/index.js +0 -58
- package/lib/Dialog/index.d.ts +0 -2
- package/lib/Dialog/index.js +0 -65
- package/lib/Drawer/index.d.ts +0 -11
- package/lib/Drawer/index.js +0 -62
- package/lib/Drawer/index.less +0 -40
- package/lib/OldActionBar/index.d.ts +0 -19
- package/lib/OldActionBar/index.js +0 -129
- package/lib/OldActionBar/index.less +0 -18
- package/lib/OldPisellDateRangePicker/index.d.ts +0 -79
- package/lib/OldPisellDateRangePicker/index.js +0 -281
- package/lib/OldPisellDateRangePicker/index.less +0 -102
- package/lib/Toolbar/index.d.ts +0 -3
- package/lib/Toolbar/index.js +0 -193
- package/lib/Toolbar/index.less +0 -35
- package/lib/browserSelect/chevron-down.png +0 -0
- package/lib/browserSelect/index.d.ts +0 -15
- package/lib/browserSelect/index.js +0 -59
- package/lib/browserSelect/index.less +0 -18
- package/lib/constants.d.ts +0 -58
- package/lib/constants.js +0 -217
- package/lib/hooks/useDocumentVisibility.d.ts +0 -2
- package/lib/hooks/useDocumentVisibility.js +0 -40
- package/lib/hooks/useNextDay.d.ts +0 -2
- package/lib/hooks/useNextDay.js +0 -49
- package/lib/hooks/useUpdateEffect.d.ts +0 -2
- package/lib/hooks/useUpdateEffect.js +0 -35
- package/lib/icon/ChevronLeft.d.ts +0 -5
- package/lib/icon/ChevronLeft.js +0 -60
- package/lib/icon/ChevronLeftDouble.d.ts +0 -5
- package/lib/icon/ChevronLeftDouble.js +0 -60
- package/lib/icon/ChevronRight.d.ts +0 -5
- package/lib/icon/ChevronRight.js +0 -60
- package/lib/icon/ChevronRightDouble.d.ts +0 -5
- package/lib/icon/ChevronRightDouble.js +0 -60
- package/lib/icon/CloseCircle.d.ts +0 -5
- package/lib/icon/CloseCircle.js +0 -67
package/lib/Drawer/index.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/Drawer/index.tsx
|
|
30
|
-
var Drawer_exports = {};
|
|
31
|
-
__export(Drawer_exports, {
|
|
32
|
-
default: () => Drawer_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(Drawer_exports);
|
|
35
|
-
var import_react = __toESM(require("react"));
|
|
36
|
-
var import_classnames = __toESM(require("classnames"));
|
|
37
|
-
var import_index = require("./index.less");
|
|
38
|
-
var Drawer = (props) => {
|
|
39
|
-
const { open, className, onClose, children, height = 375 } = props;
|
|
40
|
-
if (!open) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, open && /* @__PURE__ */ import_react.default.createElement("div", { className: "date-picker-drawer-overlay", onClick: onClose }), /* @__PURE__ */ import_react.default.createElement(
|
|
44
|
-
"div",
|
|
45
|
-
{
|
|
46
|
-
className: (0, import_classnames.default)("date-picker-drawer", className, {
|
|
47
|
-
open
|
|
48
|
-
}),
|
|
49
|
-
onClick: () => {
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
53
|
-
"div",
|
|
54
|
-
{
|
|
55
|
-
className: "date-picker-drawer-content",
|
|
56
|
-
style: { height }
|
|
57
|
-
},
|
|
58
|
-
children
|
|
59
|
-
)
|
|
60
|
-
));
|
|
61
|
-
};
|
|
62
|
-
var Drawer_default = Drawer;
|
package/lib/Drawer/index.less
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
.date-picker-drawer {
|
|
2
|
-
position: fixed;
|
|
3
|
-
bottom: 0;
|
|
4
|
-
left: 0;
|
|
5
|
-
width: 100%;
|
|
6
|
-
background-color: white;
|
|
7
|
-
box-shadow: 0px -2px 10px rgba(0, 0, 0, 0.1);
|
|
8
|
-
transform: translateY(100%);
|
|
9
|
-
transition: transform 0.3s ease-out;
|
|
10
|
-
z-index: 1000;
|
|
11
|
-
border-radius: 8px 8px 0 0;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.date-picker-drawer-content {
|
|
15
|
-
//transform: translateY(100%);
|
|
16
|
-
//transition: transform 0.3s ease-out;
|
|
17
|
-
//position: absolute;
|
|
18
|
-
//padding: 20px;
|
|
19
|
-
//bottom: 0;
|
|
20
|
-
//width: 100vw;
|
|
21
|
-
//background-color: #fff;
|
|
22
|
-
//z-index: 1000;
|
|
23
|
-
//box-shadow: 0px -2px 10px rgba(0, 0, 0, 0.1);
|
|
24
|
-
//border-radius: 8px 8px 0px 0px;
|
|
25
|
-
//height: 650px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.date-picker-drawer.open {
|
|
29
|
-
transform: translateY(0);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.date-picker-drawer-overlay {
|
|
33
|
-
position: fixed;
|
|
34
|
-
top: 0;
|
|
35
|
-
left: 0;
|
|
36
|
-
width: 100%;
|
|
37
|
-
height: 100%;
|
|
38
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
39
|
-
z-index: 999;
|
|
40
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ButtonProps } from "antd";
|
|
3
|
-
import { Dayjs } from "dayjs";
|
|
4
|
-
import "./index.less";
|
|
5
|
-
interface ActionBarProps {
|
|
6
|
-
ownerState: any;
|
|
7
|
-
onCancel: () => void;
|
|
8
|
-
onChange: (val: any[], type?: "time") => void;
|
|
9
|
-
onOk: () => void;
|
|
10
|
-
value: any[];
|
|
11
|
-
showTime?: boolean | {
|
|
12
|
-
defaultValue: Dayjs;
|
|
13
|
-
[key: string]: any;
|
|
14
|
-
}[];
|
|
15
|
-
okButtonProps?: ButtonProps;
|
|
16
|
-
cancelButtonProps?: ButtonProps;
|
|
17
|
-
}
|
|
18
|
-
declare const ActionBar: (props: ActionBarProps) => JSX.Element;
|
|
19
|
-
export default ActionBar;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/OldActionBar/index.tsx
|
|
30
|
-
var OldActionBar_exports = {};
|
|
31
|
-
__export(OldActionBar_exports, {
|
|
32
|
-
default: () => OldActionBar_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(OldActionBar_exports);
|
|
35
|
-
var import_react = __toESM(require("react"));
|
|
36
|
-
var import_classnames = __toESM(require("classnames"));
|
|
37
|
-
var import_antd = require("antd");
|
|
38
|
-
var import_x_date_pickers = require("@mui/x-date-pickers");
|
|
39
|
-
var import_utils = require("@pisell/utils");
|
|
40
|
-
var import_dayjs = __toESM(require("dayjs"));
|
|
41
|
-
var import_locales = require("../locales");
|
|
42
|
-
var import_index = require("./index.less");
|
|
43
|
-
var ActionBar = (props) => {
|
|
44
|
-
const {
|
|
45
|
-
ownerState,
|
|
46
|
-
onCancel,
|
|
47
|
-
onOk,
|
|
48
|
-
onChange,
|
|
49
|
-
showTime,
|
|
50
|
-
value = [],
|
|
51
|
-
okButtonProps,
|
|
52
|
-
cancelButtonProps
|
|
53
|
-
} = props;
|
|
54
|
-
const local = (0, import_react.useContext)(import_x_date_pickers.MuiPickersAdapterContext);
|
|
55
|
-
const locale = (0, import_react.useMemo)(() => {
|
|
56
|
-
return local.utils.locale || "en";
|
|
57
|
-
}, [local.utils.locale]);
|
|
58
|
-
const { slotProps } = ownerState;
|
|
59
|
-
const { items } = (slotProps == null ? void 0 : slotProps.shortcuts) || {};
|
|
60
|
-
const hasShortcuts = !!items.length;
|
|
61
|
-
const handleStartChange = (val) => {
|
|
62
|
-
var _a, _b;
|
|
63
|
-
const newValue = [...value];
|
|
64
|
-
const start = newValue[0] || (0, import_dayjs.default)();
|
|
65
|
-
newValue[0] = ((_b = (_a = start == null ? void 0 : start.set("hour", (val == null ? void 0 : val.get("hour")) || 0)) == null ? void 0 : _a.set("minute", (val == null ? void 0 : val.get("minute")) || 0)) == null ? void 0 : _b.set("second", (val == null ? void 0 : val.get("second")) || 0)) || null;
|
|
66
|
-
onChange(newValue, "time");
|
|
67
|
-
};
|
|
68
|
-
const handleEndChange = (val) => {
|
|
69
|
-
var _a, _b;
|
|
70
|
-
const newValue = [...value];
|
|
71
|
-
const end = newValue[1] || (0, import_dayjs.default)();
|
|
72
|
-
newValue[1] = ((_b = (_a = end == null ? void 0 : end.set("hour", (val == null ? void 0 : val.get("hour")) || 0)) == null ? void 0 : _a.set("minute", (val == null ? void 0 : val.get("minute")) || 0)) == null ? void 0 : _b.set("second", (val == null ? void 0 : val.get("second")) || 0)) || null;
|
|
73
|
-
onChange(newValue, "time");
|
|
74
|
-
};
|
|
75
|
-
const spaceStyle = (0, import_react.useMemo)(() => {
|
|
76
|
-
return (0, import_utils.isMobile)() ? {
|
|
77
|
-
display: "flex",
|
|
78
|
-
justifyContent: "end",
|
|
79
|
-
marginBottom: 12
|
|
80
|
-
} : {
|
|
81
|
-
display: "flex"
|
|
82
|
-
};
|
|
83
|
-
}, []);
|
|
84
|
-
const startTimeProps = (0, import_react.useMemo)(() => {
|
|
85
|
-
if ((0, import_utils.isArr)(showTime) && showTime[0]) {
|
|
86
|
-
return showTime[0];
|
|
87
|
-
}
|
|
88
|
-
return {};
|
|
89
|
-
}, [showTime]);
|
|
90
|
-
const endTimeProps = (0, import_react.useMemo)(() => {
|
|
91
|
-
if ((0, import_utils.isArr)(showTime) && showTime[1]) {
|
|
92
|
-
return showTime[1];
|
|
93
|
-
}
|
|
94
|
-
return {};
|
|
95
|
-
}, [showTime]);
|
|
96
|
-
return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(props.className, "date-picker-action-bar") }, hasShortcuts && /* @__PURE__ */ import_react.default.createElement("div", { className: "date-picker-action-bar-left" }), /* @__PURE__ */ import_react.default.createElement(
|
|
97
|
-
"div",
|
|
98
|
-
{
|
|
99
|
-
className: "date-picker-action-bar-right",
|
|
100
|
-
style: (0, import_utils.isMobile)() ? { display: "block" } : {}
|
|
101
|
-
},
|
|
102
|
-
/* @__PURE__ */ import_react.default.createElement(import_antd.Space, { split: "-", style: { ...spaceStyle } }, showTime ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
103
|
-
import_antd.TimePicker,
|
|
104
|
-
{
|
|
105
|
-
placeholder: (0, import_locales.getText)(
|
|
106
|
-
"action-bar-start.time",
|
|
107
|
-
import_locales.pLocaleMap[locale]
|
|
108
|
-
),
|
|
109
|
-
...startTimeProps,
|
|
110
|
-
value: value[0],
|
|
111
|
-
popupClassName: "date-picker-action-bar-time-picker-popup",
|
|
112
|
-
onChange: handleStartChange,
|
|
113
|
-
inputReadOnly: true
|
|
114
|
-
}
|
|
115
|
-
), /* @__PURE__ */ import_react.default.createElement(
|
|
116
|
-
import_antd.TimePicker,
|
|
117
|
-
{
|
|
118
|
-
placeholder: (0, import_locales.getText)("action-bar-end.time", import_locales.pLocaleMap[locale]),
|
|
119
|
-
...endTimeProps,
|
|
120
|
-
value: value[1],
|
|
121
|
-
popupClassName: "date-picker-action-bar-time-picker-popup",
|
|
122
|
-
onChange: handleEndChange,
|
|
123
|
-
inputReadOnly: true
|
|
124
|
-
}
|
|
125
|
-
)) : /* @__PURE__ */ import_react.default.createElement("div", null)),
|
|
126
|
-
/* @__PURE__ */ import_react.default.createElement(import_antd.Space, { style: { ...spaceStyle, margin: 0 } }, /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { ...cancelButtonProps || {}, onClick: onCancel }, (0, import_locales.getText)("action-bar-cancel", import_locales.pLocaleMap[locale])), /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { type: "primary", ...okButtonProps || {}, onClick: onOk }, (0, import_locales.getText)("action-bar-apply", import_locales.pLocaleMap[locale])))
|
|
127
|
-
));
|
|
128
|
-
};
|
|
129
|
-
var OldActionBar_default = ActionBar;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
.date-picker-action-bar {
|
|
2
|
-
display: flex;
|
|
3
|
-
.date-picker-action-bar-left {
|
|
4
|
-
width: 192px;
|
|
5
|
-
border-right: 1px solid rgba(0, 0, 0, 0.12);
|
|
6
|
-
}
|
|
7
|
-
.date-picker-action-bar-right {
|
|
8
|
-
flex: 1;
|
|
9
|
-
display: flex;
|
|
10
|
-
justify-content: space-between;
|
|
11
|
-
padding: 16px;
|
|
12
|
-
border-top: 1px solid rgba(0, 0, 0, 0.12);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.date-picker-action-bar-time-picker-popup {
|
|
17
|
-
z-index: 1400;
|
|
18
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { Dayjs } from 'dayjs';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { ButtonProps } from 'antd';
|
|
4
|
-
import { PopperPlacementType } from '@mui/base/Popper/Popper.types';
|
|
5
|
-
import { PresetType } from '../Shortcuts';
|
|
6
|
-
import 'dayjs/locale/zh-cn';
|
|
7
|
-
import 'dayjs/locale/en';
|
|
8
|
-
import 'dayjs/locale/zh-tw';
|
|
9
|
-
import './index.less';
|
|
10
|
-
export interface PisellDateRangePickerProps {
|
|
11
|
-
/** 再次选择日期时是否清除结束时间 */
|
|
12
|
-
clearEndOnSelection?: boolean;
|
|
13
|
-
/** 日期选择确认回调 */
|
|
14
|
-
onChange?: (day: (Dayjs | null)[]) => void;
|
|
15
|
-
/** 日期改变回调 此处只为了组件外拿到当前日期项进行状态操作 通常情况下只使用onChange来拿value */
|
|
16
|
-
onDateChange?: (day: (Dayjs | null)[]) => void;
|
|
17
|
-
/** 日期选择值 */
|
|
18
|
-
value?: Dayjs[];
|
|
19
|
-
/** 日期选择默认值 */
|
|
20
|
-
defaultValue?: Dayjs[];
|
|
21
|
-
/** 快捷选择项 */
|
|
22
|
-
presets?: PresetType[];
|
|
23
|
-
/** 类名 */
|
|
24
|
-
className?: string;
|
|
25
|
-
/** 是否显示时间选择 这里参数为antd TimePickerProps */
|
|
26
|
-
showTime?: boolean | {
|
|
27
|
-
defaultValue: Dayjs;
|
|
28
|
-
[key: string]: any;
|
|
29
|
-
}[];
|
|
30
|
-
/** 占位符 */
|
|
31
|
-
placeholder?: string;
|
|
32
|
-
/** 是否禁用日期 */
|
|
33
|
-
disabledDate?: (day: Dayjs, position: 'start' | 'end', value: Dayjs[]) => boolean;
|
|
34
|
-
/** 日期格式 */
|
|
35
|
-
format?: string;
|
|
36
|
-
/** 后缀图标 */
|
|
37
|
-
suffixIcon?: React.ReactNode;
|
|
38
|
-
/** 是否显示边框 */
|
|
39
|
-
bordered?: boolean;
|
|
40
|
-
/** 是否打开日期选择 */
|
|
41
|
-
open?: boolean;
|
|
42
|
-
/** 关闭回调 */
|
|
43
|
-
onClose?: () => void;
|
|
44
|
-
/** 打开回调 */
|
|
45
|
-
onOpen?: () => void;
|
|
46
|
-
/** 弹窗宽度 */
|
|
47
|
-
popupWidth?: number;
|
|
48
|
-
/** 最小日期 */
|
|
49
|
-
minDate?: Dayjs;
|
|
50
|
-
/** 最大日期 */
|
|
51
|
-
maxDate?: Dayjs;
|
|
52
|
-
/** 月份切换事件 */
|
|
53
|
-
onMonthChange?: (value: Dayjs) => void;
|
|
54
|
-
/** 额外的弹出日历 className */
|
|
55
|
-
popupClassName?: string;
|
|
56
|
-
/** 默认显示月份 */
|
|
57
|
-
defaultCalendarMonth?: Dayjs;
|
|
58
|
-
/** ok 按钮 props */
|
|
59
|
-
okButtonProps?: ButtonProps;
|
|
60
|
-
/** cancel 按钮 props */
|
|
61
|
-
cancelButtonProps?: ButtonProps;
|
|
62
|
-
/**
|
|
63
|
-
* CSS media query when `Mobile` mode will be changed to `Desktop`.
|
|
64
|
-
* @default '@media (pointer: fine)'
|
|
65
|
-
* @example '@media (min-width: 720px)' or theme.breakpoints.up("sm")
|
|
66
|
-
*/
|
|
67
|
-
desktopModeMediaQuery?: string;
|
|
68
|
-
style?: React.CSSProperties;
|
|
69
|
-
/** 是否展示清除按钮 */
|
|
70
|
-
allowClear?: boolean;
|
|
71
|
-
/** true 将弹窗当前DOM层次结构下 false 追加到body */
|
|
72
|
-
disablePortal?: boolean;
|
|
73
|
-
/** 弹窗放置位置 */
|
|
74
|
-
placement?: PopperPlacementType;
|
|
75
|
-
/** 输入框只读 */
|
|
76
|
-
inputReadOnly: boolean;
|
|
77
|
-
}
|
|
78
|
-
declare const PisellDateRangePicker: (props: PisellDateRangePickerProps) => JSX.Element;
|
|
79
|
-
export default PisellDateRangePicker;
|
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/OldPisellDateRangePicker/index.tsx
|
|
30
|
-
var OldPisellDateRangePicker_exports = {};
|
|
31
|
-
__export(OldPisellDateRangePicker_exports, {
|
|
32
|
-
default: () => OldPisellDateRangePicker_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(OldPisellDateRangePicker_exports);
|
|
35
|
-
var import_react = __toESM(require("react"));
|
|
36
|
-
var import_DateRangePicker = require("../DateRangePicker");
|
|
37
|
-
var import_OldActionBar = __toESM(require("../OldActionBar"));
|
|
38
|
-
var import_Shortcuts = __toESM(require("../Shortcuts"));
|
|
39
|
-
var import_SingleInputDateRangeField = require("../SingleInputDateRangeField");
|
|
40
|
-
var import_classnames = __toESM(require("classnames"));
|
|
41
|
-
var import_utils = require("@pisell/utils");
|
|
42
|
-
var import_useCssVariables = __toESM(require("../PisellDateRangePicker/useCssVariables"));
|
|
43
|
-
var import_CloseCircle = __toESM(require("../icon/CloseCircle"));
|
|
44
|
-
var import_zh_cn = require("dayjs/locale/zh-cn");
|
|
45
|
-
var import_en = require("dayjs/locale/en");
|
|
46
|
-
var import_zh_tw = require("dayjs/locale/zh-tw");
|
|
47
|
-
var import_utils2 = require("../utils");
|
|
48
|
-
var import_LocaleContext = require("../PisellDateRangePicker/LocaleContext");
|
|
49
|
-
var import_locales = require("../locales");
|
|
50
|
-
var import_index = require("./index.less");
|
|
51
|
-
var transDayjsArr = (dayjsArr, defaultValue) => {
|
|
52
|
-
let newArr = dayjsArr || defaultValue || [null, null];
|
|
53
|
-
if ((dayjsArr == null ? void 0 : dayjsArr.length) === 0) {
|
|
54
|
-
newArr = defaultValue || [null, null];
|
|
55
|
-
}
|
|
56
|
-
return newArr == null ? void 0 : newArr.map((item) => {
|
|
57
|
-
return item ? item : null;
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
var PisellDateRangePicker = (props) => {
|
|
61
|
-
const {
|
|
62
|
-
onChange: propsOnChange,
|
|
63
|
-
value: propsValue,
|
|
64
|
-
presets = [],
|
|
65
|
-
className,
|
|
66
|
-
showTime,
|
|
67
|
-
placeholder,
|
|
68
|
-
disabledDate,
|
|
69
|
-
format: propsFormat,
|
|
70
|
-
defaultValue,
|
|
71
|
-
suffixIcon,
|
|
72
|
-
bordered = true,
|
|
73
|
-
open: propsOpen,
|
|
74
|
-
onClose,
|
|
75
|
-
popupWidth = 625,
|
|
76
|
-
clearEndOnSelection,
|
|
77
|
-
minDate,
|
|
78
|
-
maxDate,
|
|
79
|
-
onOpen,
|
|
80
|
-
onMonthChange,
|
|
81
|
-
popupClassName,
|
|
82
|
-
defaultCalendarMonth,
|
|
83
|
-
okButtonProps,
|
|
84
|
-
cancelButtonProps,
|
|
85
|
-
onDateChange,
|
|
86
|
-
desktopModeMediaQuery,
|
|
87
|
-
style,
|
|
88
|
-
allowClear,
|
|
89
|
-
disablePortal,
|
|
90
|
-
placement = "auto",
|
|
91
|
-
inputReadOnly
|
|
92
|
-
} = props;
|
|
93
|
-
const [open, setOpen] = (0, import_react.useState)(propsOpen ?? false);
|
|
94
|
-
const { locale } = (0, import_react.useContext)(import_LocaleContext.LocaleContext) || {};
|
|
95
|
-
(0, import_react.useEffect)(() => {
|
|
96
|
-
(0, import_utils.isBoolean)(propsOpen) && setOpen(propsOpen);
|
|
97
|
-
}, [propsOpen]);
|
|
98
|
-
const [_value, setValue] = (0, import_react.useState)(
|
|
99
|
-
() => transDayjsArr(propsValue, defaultValue)
|
|
100
|
-
);
|
|
101
|
-
(0, import_react.useEffect)(() => {
|
|
102
|
-
setValue(transDayjsArr(propsValue, defaultValue));
|
|
103
|
-
}, [propsValue]);
|
|
104
|
-
const handleOpen = () => {
|
|
105
|
-
setOpen(true);
|
|
106
|
-
onOpen == null ? void 0 : onOpen();
|
|
107
|
-
};
|
|
108
|
-
const handleClose = () => {
|
|
109
|
-
setOpen(false);
|
|
110
|
-
onClose == null ? void 0 : onClose();
|
|
111
|
-
onDateChange == null ? void 0 : onDateChange(transDayjsArr(propsValue, defaultValue));
|
|
112
|
-
setValue(transDayjsArr(propsValue, defaultValue));
|
|
113
|
-
};
|
|
114
|
-
const handleOk = () => {
|
|
115
|
-
setOpen(false);
|
|
116
|
-
onClose == null ? void 0 : onClose();
|
|
117
|
-
propsOnChange == null ? void 0 : propsOnChange(_value);
|
|
118
|
-
};
|
|
119
|
-
const _presets = (0, import_react.useMemo)(() => {
|
|
120
|
-
if ((0, import_utils2.isMobile)())
|
|
121
|
-
return [];
|
|
122
|
-
return presets.map((item) => {
|
|
123
|
-
const getValue = () => {
|
|
124
|
-
if (typeof item.getValue === "function") {
|
|
125
|
-
return item.getValue();
|
|
126
|
-
}
|
|
127
|
-
return item == null ? void 0 : item.value;
|
|
128
|
-
};
|
|
129
|
-
return {
|
|
130
|
-
label: item.label,
|
|
131
|
-
getValue
|
|
132
|
-
};
|
|
133
|
-
});
|
|
134
|
-
}, [presets]);
|
|
135
|
-
const handleChange = (val, type) => {
|
|
136
|
-
let newVal = val;
|
|
137
|
-
if ((0, import_utils.isArr)(showTime) && type !== "time") {
|
|
138
|
-
newVal = newVal.map((item, index) => {
|
|
139
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
140
|
-
if ((_a = showTime == null ? void 0 : showTime[index]) == null ? void 0 : _a.defaultValue) {
|
|
141
|
-
return (item == null ? void 0 : item.set("hour", (_c = (_b = showTime[index]) == null ? void 0 : _b.defaultValue) == null ? void 0 : _c.get("hour")).set("minute", (_e = (_d = showTime[index]) == null ? void 0 : _d.defaultValue) == null ? void 0 : _e.get("minute")).set("second", (_g = (_f = showTime[index]) == null ? void 0 : _f.defaultValue) == null ? void 0 : _g.get("second"))) || null;
|
|
142
|
-
}
|
|
143
|
-
return item || null;
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
if (clearEndOnSelection && type !== "set" && _value.filter(Boolean).length === 2) {
|
|
147
|
-
newVal = [newVal[0], null];
|
|
148
|
-
}
|
|
149
|
-
onDateChange == null ? void 0 : onDateChange(newVal);
|
|
150
|
-
setValue(newVal);
|
|
151
|
-
};
|
|
152
|
-
const hasPreset = (_presets == null ? void 0 : _presets.length) > 0;
|
|
153
|
-
(0, import_useCssVariables.default)({
|
|
154
|
-
variables: {
|
|
155
|
-
"--pisell-date-range-picker-popup-width": `${hasPreset ? popupWidth + 192 : popupWidth}px`
|
|
156
|
-
},
|
|
157
|
-
dom: document.body
|
|
158
|
-
});
|
|
159
|
-
const handleClear = (e) => {
|
|
160
|
-
e.stopPropagation();
|
|
161
|
-
setValue([null, null]);
|
|
162
|
-
setOpen(false);
|
|
163
|
-
onClose == null ? void 0 : onClose();
|
|
164
|
-
propsOnChange == null ? void 0 : propsOnChange([null, null]);
|
|
165
|
-
};
|
|
166
|
-
const endAdornment = (0, import_react.useMemo)(() => {
|
|
167
|
-
if (!allowClear) {
|
|
168
|
-
return suffixIcon;
|
|
169
|
-
}
|
|
170
|
-
if (_value == null ? void 0 : _value.some((item) => !!item)) {
|
|
171
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
172
|
-
import_CloseCircle.default,
|
|
173
|
-
{
|
|
174
|
-
className: "pisell-date-range-picker-clear",
|
|
175
|
-
onClick: handleClear
|
|
176
|
-
}
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
}, [suffixIcon, allowClear, _value]);
|
|
180
|
-
const readOnlyProps = (0, import_react.useMemo)(() => {
|
|
181
|
-
if (inputReadOnly) {
|
|
182
|
-
return {
|
|
183
|
-
readOnly: true,
|
|
184
|
-
selectedSections: null
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
return {};
|
|
188
|
-
}, [inputReadOnly]);
|
|
189
|
-
const format = (0, import_react.useMemo)(() => {
|
|
190
|
-
if (propsFormat) {
|
|
191
|
-
return propsFormat;
|
|
192
|
-
}
|
|
193
|
-
let localeValue = locale;
|
|
194
|
-
if (!localeValue) {
|
|
195
|
-
localeValue = import_locales.pLocaleMap[(0, import_utils2.getCurrentLocale)()];
|
|
196
|
-
}
|
|
197
|
-
return localeValue === "en" || localeValue === "en-US" ? "DD/MM/YYYY" : "YYYY/MM/DD";
|
|
198
|
-
}, [propsFormat, locale]);
|
|
199
|
-
console.log(_presets, presets, "_presets");
|
|
200
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
201
|
-
"span",
|
|
202
|
-
{
|
|
203
|
-
className: (0, import_classnames.default)(
|
|
204
|
-
className,
|
|
205
|
-
"pisell-date-range-picker",
|
|
206
|
-
"pisell-date-range-picker-old",
|
|
207
|
-
{
|
|
208
|
-
"pisell-date-range-picker-no-border": !bordered
|
|
209
|
-
}
|
|
210
|
-
),
|
|
211
|
-
style,
|
|
212
|
-
onClick: (e) => e.stopPropagation()
|
|
213
|
-
},
|
|
214
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
215
|
-
import_DateRangePicker.DateRangePicker,
|
|
216
|
-
{
|
|
217
|
-
desktopModeMediaQuery,
|
|
218
|
-
onMonthChange,
|
|
219
|
-
minDate,
|
|
220
|
-
maxDate,
|
|
221
|
-
format,
|
|
222
|
-
label: placeholder,
|
|
223
|
-
value: _value,
|
|
224
|
-
closeOnSelect: false,
|
|
225
|
-
onClose: handleClose,
|
|
226
|
-
onChange: handleChange,
|
|
227
|
-
onOpen: handleOpen,
|
|
228
|
-
open,
|
|
229
|
-
defaultCalendarMonth,
|
|
230
|
-
shouldDisableDate: (current, position) => disabledDate == null ? void 0 : disabledDate(current, position, _value),
|
|
231
|
-
slots: {
|
|
232
|
-
actionBar: import_OldActionBar.default,
|
|
233
|
-
shortcuts: import_Shortcuts.default,
|
|
234
|
-
field: import_SingleInputDateRangeField.SingleInputDateRangeField
|
|
235
|
-
},
|
|
236
|
-
dayOfWeekFormatter: (day) => {
|
|
237
|
-
return day;
|
|
238
|
-
},
|
|
239
|
-
slotProps: {
|
|
240
|
-
shortcuts: {
|
|
241
|
-
items: _presets,
|
|
242
|
-
changeImportance: "set",
|
|
243
|
-
onChange: handleChange
|
|
244
|
-
},
|
|
245
|
-
actionBar: {
|
|
246
|
-
onOk: handleOk,
|
|
247
|
-
onCancel: handleClose,
|
|
248
|
-
showTime,
|
|
249
|
-
onChange: handleChange,
|
|
250
|
-
value: _value,
|
|
251
|
-
okButtonProps,
|
|
252
|
-
cancelButtonProps
|
|
253
|
-
},
|
|
254
|
-
field: {
|
|
255
|
-
value: _value,
|
|
256
|
-
size: "small",
|
|
257
|
-
fullWidth: true,
|
|
258
|
-
// variant: "standard",
|
|
259
|
-
// hiddenLabel: true,
|
|
260
|
-
InputProps: {
|
|
261
|
-
endAdornment
|
|
262
|
-
},
|
|
263
|
-
...readOnlyProps
|
|
264
|
-
},
|
|
265
|
-
popper: {
|
|
266
|
-
className: (0, import_classnames.default)(popupClassName, "pisell-date-range-picker-popper-old"),
|
|
267
|
-
disablePortal,
|
|
268
|
-
placement
|
|
269
|
-
},
|
|
270
|
-
dialog: {
|
|
271
|
-
disablePortal
|
|
272
|
-
},
|
|
273
|
-
mobilePaper: {
|
|
274
|
-
className: popupClassName
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
)
|
|
279
|
-
);
|
|
280
|
-
};
|
|
281
|
-
var OldPisellDateRangePicker_default = PisellDateRangePicker;
|