@pisell/date-picker 1.0.89 → 1.0.90
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 +18 -0
- package/es/CustomCalendarHeader/index.d.ts +2 -0
- package/es/Dialog/index.d.ts +2 -0
- package/es/Drawer/index.d.ts +11 -0
- package/es/OldActionBar/index.d.ts +18 -0
- package/es/OldPisellDateRangePicker/index.d.ts +79 -0
- package/es/PisellDateRangePicker/LocaleContext.d.ts +2 -0
- package/es/PisellDateRangePicker/index.d.ts +81 -0
- package/es/PisellDateRangePicker/index.js +9 -1
- package/es/Shortcuts/index.d.ts +15 -0
- package/es/Toolbar/index.d.ts +3 -0
- package/es/Toolbar/index.js +28 -6
- package/es/browserSelect/index.d.ts +15 -0
- package/es/constants.d.ts +58 -0
- package/es/hooks/useDocumentVisibility.d.ts +2 -0
- package/es/hooks/useNextDay.d.ts +2 -0
- package/es/hooks/useUpdateEffect.d.ts +2 -0
- package/es/icon/ChevronLeft.d.ts +5 -0
- package/es/icon/ChevronLeftDouble.d.ts +5 -0
- package/es/icon/ChevronRight.d.ts +5 -0
- package/es/icon/ChevronRightDouble.d.ts +5 -0
- package/es/icon/CloseCircle.d.ts +5 -0
- package/es/index.d.ts +26 -0
- package/es/locales/en-US.d.ts +26 -0
- package/es/locales/index.d.ts +2 -0
- package/es/locales/zh-CN.d.ts +26 -0
- package/es/locales/zh-TW.d.ts +26 -0
- package/es/utils/index.d.ts +42 -0
- package/lib/ActionBar/index.d.ts +18 -0
- package/lib/CustomCalendarHeader/index.d.ts +2 -0
- package/lib/Dialog/index.d.ts +2 -0
- package/lib/Drawer/index.d.ts +11 -0
- package/lib/OldActionBar/index.d.ts +18 -0
- package/lib/OldPisellDateRangePicker/index.d.ts +79 -0
- package/lib/PisellDateRangePicker/LocaleContext.d.ts +2 -0
- package/lib/PisellDateRangePicker/index.d.ts +81 -0
- package/lib/PisellDateRangePicker/index.js +7 -1
- package/lib/Shortcuts/index.d.ts +15 -0
- package/lib/Toolbar/index.d.ts +3 -0
- package/lib/Toolbar/index.js +25 -3
- package/lib/browserSelect/index.d.ts +15 -0
- package/lib/constants.d.ts +58 -0
- package/lib/hooks/useDocumentVisibility.d.ts +2 -0
- package/lib/hooks/useNextDay.d.ts +2 -0
- package/lib/hooks/useUpdateEffect.d.ts +2 -0
- package/lib/icon/ChevronLeft.d.ts +5 -0
- package/lib/icon/ChevronLeftDouble.d.ts +5 -0
- package/lib/icon/ChevronRight.d.ts +5 -0
- package/lib/icon/ChevronRightDouble.d.ts +5 -0
- package/lib/icon/CloseCircle.d.ts +5 -0
- package/lib/index.d.ts +26 -0
- package/lib/locales/en-US.d.ts +26 -0
- package/lib/locales/index.d.ts +2 -0
- package/lib/locales/zh-CN.d.ts +26 -0
- package/lib/locales/zh-TW.d.ts +26 -0
- package/lib/utils/index.d.ts +42 -0
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ButtonProps } from "antd";
|
|
2
|
+
import { Dayjs } from "dayjs";
|
|
3
|
+
import "./index.less";
|
|
4
|
+
interface ActionBarProps {
|
|
5
|
+
ownerState: any;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
onChange: (val: any[], type?: "time") => void;
|
|
8
|
+
onOk: () => void;
|
|
9
|
+
value: any[];
|
|
10
|
+
showTime?: boolean | {
|
|
11
|
+
defaultValue: Dayjs;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}[];
|
|
14
|
+
okButtonProps?: ButtonProps;
|
|
15
|
+
cancelButtonProps?: ButtonProps;
|
|
16
|
+
}
|
|
17
|
+
declare const ActionBar: (props: ActionBarProps) => JSX.Element;
|
|
18
|
+
export default ActionBar;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
interface DrawerProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
height?: number;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const Drawer: (props: DrawerProps) => JSX.Element | null;
|
|
11
|
+
export default Drawer;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ButtonProps } from "antd";
|
|
2
|
+
import { Dayjs } from "dayjs";
|
|
3
|
+
import "./index.less";
|
|
4
|
+
interface ActionBarProps {
|
|
5
|
+
ownerState: any;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
onChange: (val: any[], type?: "time") => void;
|
|
8
|
+
onOk: () => void;
|
|
9
|
+
value: any[];
|
|
10
|
+
showTime?: boolean | {
|
|
11
|
+
defaultValue: Dayjs;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}[];
|
|
14
|
+
okButtonProps?: ButtonProps;
|
|
15
|
+
cancelButtonProps?: ButtonProps;
|
|
16
|
+
}
|
|
17
|
+
declare const ActionBar: (props: ActionBarProps) => JSX.Element;
|
|
18
|
+
export default ActionBar;
|
|
@@ -0,0 +1,79 @@
|
|
|
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;
|
|
@@ -0,0 +1,81 @@
|
|
|
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)[] | string) => void;
|
|
15
|
+
/** 日期改变回调 此处只为了组件外拿到当前日期项进行状态操作 通常情况下只使用onChange来拿value */
|
|
16
|
+
onDateChange?: (day: (Dayjs | null)[]) => void;
|
|
17
|
+
/** 日期选择值 */
|
|
18
|
+
value?: Dayjs[] | string;
|
|
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
|
+
returnShortcutString?: boolean;
|
|
79
|
+
}
|
|
80
|
+
declare const PisellDateRangePicker: (props: PisellDateRangePickerProps) => JSX.Element;
|
|
81
|
+
export default PisellDateRangePicker;
|
|
@@ -144,6 +144,10 @@ var PisellDateRangePicker = (props) => {
|
|
|
144
144
|
setCurrentShortcut(lastConfirmShortcut.current);
|
|
145
145
|
};
|
|
146
146
|
const handleOk = () => {
|
|
147
|
+
const val = getVal();
|
|
148
|
+
if (val.some((item) => !item)) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
147
151
|
setOpen(false);
|
|
148
152
|
onClose == null ? void 0 : onClose();
|
|
149
153
|
propsOnChange == null ? void 0 : propsOnChange(getVal());
|
|
@@ -305,7 +309,9 @@ var PisellDateRangePicker = (props) => {
|
|
|
305
309
|
locale,
|
|
306
310
|
onChange: handleChange,
|
|
307
311
|
currentShortcut,
|
|
308
|
-
setCurrentShortcut
|
|
312
|
+
setCurrentShortcut,
|
|
313
|
+
disabledDate,
|
|
314
|
+
value: _value
|
|
309
315
|
},
|
|
310
316
|
layout: {
|
|
311
317
|
orientation: "portrait"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./index.less";
|
|
2
|
+
import { Dayjs } from "dayjs";
|
|
3
|
+
export declare type PresetType = {
|
|
4
|
+
label?: string;
|
|
5
|
+
getValue?: () => [Dayjs, Dayjs];
|
|
6
|
+
value: [Dayjs, Dayjs] | "today" | "yesterday" | "last_3_days" | "last_7_days" | "last_30_days" | "last_90_days" | "last_180_days" | "tomorrow" | "next_3_days" | "next_7_days" | "next_30_days" | "next_90_days" | "next_180_days";
|
|
7
|
+
key?: string;
|
|
8
|
+
};
|
|
9
|
+
interface ShortcutsProps {
|
|
10
|
+
items: PresetType[];
|
|
11
|
+
onChange: (day: [Dayjs, Dayjs], changeImportance?: "accept" | "set") => void;
|
|
12
|
+
changeImportance?: "accept" | "set";
|
|
13
|
+
}
|
|
14
|
+
declare const Shortcuts: (props: ShortcutsProps) => JSX.Element | null;
|
|
15
|
+
export default Shortcuts;
|
package/lib/Toolbar/index.js
CHANGED
|
@@ -49,13 +49,16 @@ var Toolbar = (props) => {
|
|
|
49
49
|
locale,
|
|
50
50
|
onChange,
|
|
51
51
|
currentShortcut,
|
|
52
|
-
setCurrentShortcut
|
|
52
|
+
setCurrentShortcut,
|
|
53
|
+
disabledDate
|
|
53
54
|
} = props;
|
|
54
55
|
const format = locale === "en" || locale === "en-US" ? "DD/MM/YYYY" : "YYYY/MM/DD";
|
|
55
56
|
const [startStr, setStartStr] = (0, import_react.useState)("");
|
|
56
57
|
const [endStr, setEndStr] = (0, import_react.useState)("");
|
|
57
58
|
const [startError, setStartError] = (0, import_react.useState)(false);
|
|
58
59
|
const [endError, setEndError] = (0, import_react.useState)(false);
|
|
60
|
+
const valueRef = (0, import_react.useRef)(value);
|
|
61
|
+
valueRef.current = value;
|
|
59
62
|
(0, import_react.useEffect)(() => {
|
|
60
63
|
if (value == null ? void 0 : value[0]) {
|
|
61
64
|
setStartStr(value[0].format(format));
|
|
@@ -70,11 +73,23 @@ var Toolbar = (props) => {
|
|
|
70
73
|
setEndStr("");
|
|
71
74
|
}
|
|
72
75
|
}, [value]);
|
|
76
|
+
const checkDateDisabled = (position) => {
|
|
77
|
+
const val = valueRef.current;
|
|
78
|
+
if (position === "start" && val[0] && (disabledDate == null ? void 0 : disabledDate(val[1], position, val))) {
|
|
79
|
+
setStartError(true);
|
|
80
|
+
onChange([null, val[1]], "write");
|
|
81
|
+
}
|
|
82
|
+
if (position === "end" && val[1] && (disabledDate == null ? void 0 : disabledDate(val[1], position, val))) {
|
|
83
|
+
setEndError(true);
|
|
84
|
+
onChange([val[0], null], "write");
|
|
85
|
+
}
|
|
86
|
+
};
|
|
73
87
|
const handleStartChange = (e) => {
|
|
74
88
|
var _a, _b;
|
|
75
89
|
const val = e.target.value;
|
|
76
90
|
setStartStr(val);
|
|
77
|
-
|
|
91
|
+
const objValue = (0, import_dayjs.default)(val, format);
|
|
92
|
+
if (isValidDate(val, format) && (value[1] ? objValue <= value[1] : true) && !(disabledDate == null ? void 0 : disabledDate(objValue, "start", value))) {
|
|
78
93
|
setStartError(false);
|
|
79
94
|
const valDate = (0, import_dayjs.default)(val, format);
|
|
80
95
|
const newValue = [...value];
|
|
@@ -84,12 +99,16 @@ var Toolbar = (props) => {
|
|
|
84
99
|
} else {
|
|
85
100
|
setStartError(true);
|
|
86
101
|
}
|
|
102
|
+
setTimeout(() => {
|
|
103
|
+
checkDateDisabled("end");
|
|
104
|
+
}, 200);
|
|
87
105
|
};
|
|
88
106
|
const handleEndChange = (e) => {
|
|
89
107
|
var _a, _b;
|
|
90
108
|
const val = e.target.value;
|
|
91
109
|
setEndStr(val);
|
|
92
|
-
|
|
110
|
+
const objValue = (0, import_dayjs.default)(val, format);
|
|
111
|
+
if (isValidDate(val, format) && (value[0] ? objValue >= value[0] : true) && !(disabledDate == null ? void 0 : disabledDate(objValue, "end", value))) {
|
|
93
112
|
setEndError(false);
|
|
94
113
|
const valDate = (0, import_dayjs.default)(val, format);
|
|
95
114
|
const newValue = [...value];
|
|
@@ -99,6 +118,9 @@ var Toolbar = (props) => {
|
|
|
99
118
|
} else {
|
|
100
119
|
setEndError(true);
|
|
101
120
|
}
|
|
121
|
+
setTimeout(() => {
|
|
122
|
+
checkDateDisabled("start");
|
|
123
|
+
}, 200);
|
|
102
124
|
};
|
|
103
125
|
const handleSelectChange = (e) => {
|
|
104
126
|
const val = e.target.value;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
interface BrowserSelectProps extends React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement> {
|
|
4
|
+
options: any[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* @title: 系统级别的下拉框
|
|
8
|
+
* @description:
|
|
9
|
+
* @param {BrowserSelectProps} props
|
|
10
|
+
* @return {*}
|
|
11
|
+
* @Author: zhiwei.Wang
|
|
12
|
+
* @Date: 2024-01-30 16:43
|
|
13
|
+
*/
|
|
14
|
+
declare const BrowserSelect: (props: BrowserSelectProps) => JSX.Element;
|
|
15
|
+
export default BrowserSelect;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import { PresetType } from './Shortcuts';
|
|
3
|
+
export declare const presetValueArr: string[];
|
|
4
|
+
export declare const presetDetailMap: {
|
|
5
|
+
today: {
|
|
6
|
+
getValue: () => dayjs.Dayjs[];
|
|
7
|
+
label: (locale?: string) => any;
|
|
8
|
+
};
|
|
9
|
+
yesterday: {
|
|
10
|
+
getValue: () => dayjs.Dayjs[];
|
|
11
|
+
label: (locale?: string) => any;
|
|
12
|
+
};
|
|
13
|
+
last_3_days: {
|
|
14
|
+
getValue: () => dayjs.Dayjs[];
|
|
15
|
+
label: (locale?: string) => any;
|
|
16
|
+
};
|
|
17
|
+
last_7_days: {
|
|
18
|
+
getValue: () => dayjs.Dayjs[];
|
|
19
|
+
label: (locale?: string) => any;
|
|
20
|
+
};
|
|
21
|
+
last_30_days: {
|
|
22
|
+
getValue: () => dayjs.Dayjs[];
|
|
23
|
+
label: (locale?: string) => any;
|
|
24
|
+
};
|
|
25
|
+
last_90_days: {
|
|
26
|
+
getValue: () => dayjs.Dayjs[];
|
|
27
|
+
label: (locale?: string) => any;
|
|
28
|
+
};
|
|
29
|
+
last_180_days: {
|
|
30
|
+
getValue: () => dayjs.Dayjs[];
|
|
31
|
+
label: (locale?: string) => any;
|
|
32
|
+
};
|
|
33
|
+
tomorrow: {
|
|
34
|
+
getValue: () => dayjs.Dayjs[];
|
|
35
|
+
label: (locale?: string) => any;
|
|
36
|
+
};
|
|
37
|
+
next_3_days: {
|
|
38
|
+
getValue: () => dayjs.Dayjs[];
|
|
39
|
+
label: (locale?: string) => any;
|
|
40
|
+
};
|
|
41
|
+
next_7_days: {
|
|
42
|
+
getValue: () => dayjs.Dayjs[];
|
|
43
|
+
label: (locale?: string) => any;
|
|
44
|
+
};
|
|
45
|
+
next_30_days: {
|
|
46
|
+
getValue: () => dayjs.Dayjs[];
|
|
47
|
+
label: (locale?: string) => any;
|
|
48
|
+
};
|
|
49
|
+
next_90_days: {
|
|
50
|
+
getValue: () => dayjs.Dayjs[];
|
|
51
|
+
label: (locale?: string) => any;
|
|
52
|
+
};
|
|
53
|
+
next_180_days: {
|
|
54
|
+
getValue: () => dayjs.Dayjs[];
|
|
55
|
+
label: (locale?: string) => any;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export declare const defaultPresets: PresetType[];
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ConfigProvider } from 'antd';
|
|
2
|
+
import PisellDateRangePicker from "./PisellDateRangePicker";
|
|
3
|
+
import OldPisellDateRangePicker from "./OldPisellDateRangePicker";
|
|
4
|
+
import { LocaleContext, LocaleProvider } from "./PisellDateRangePicker/LocaleContext";
|
|
5
|
+
export * from "@mui/x-date-pickers";
|
|
6
|
+
export * from "@mui/material/styles";
|
|
7
|
+
export * from "./DateRangePickerDay";
|
|
8
|
+
export * from "./MultiInputDateRangeField";
|
|
9
|
+
export * from "./MultiInputTimeRangeField";
|
|
10
|
+
export * from "./MultiInputDateTimeRangeField";
|
|
11
|
+
export * from "./SingleInputDateRangeField";
|
|
12
|
+
export * from "./SingleInputTimeRangeField";
|
|
13
|
+
export * from "./SingleInputDateTimeRangeField";
|
|
14
|
+
export type { RangeFieldSection, BaseMultiInputFieldProps, MultiInputFieldSlotTextFieldProps, } from "./internals/models/fields";
|
|
15
|
+
export * from "./DateRangeCalendar";
|
|
16
|
+
export * from "./DesktopDateRangePicker";
|
|
17
|
+
export * from "./MobileDateRangePicker";
|
|
18
|
+
export * from "./StaticDateRangePicker";
|
|
19
|
+
export * from "./dateRangeViewRenderers";
|
|
20
|
+
export type { DateRange, RangePosition } from "./internals/models/range";
|
|
21
|
+
export type { UseDateRangeFieldProps } from "./internals/models/dateRange";
|
|
22
|
+
export { PisellDateRangePicker as RangePicker };
|
|
23
|
+
export { OldPisellDateRangePicker };
|
|
24
|
+
export { LocaleContext, LocaleProvider, ConfigProvider };
|
|
25
|
+
export { getDatePickerValueByShortcut, formatPresets, getShortcutValue, getPresetLabel, getDatePickerValue, } from "./utils/index";
|
|
26
|
+
export * from "./models";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
'action-bar-cancel': string;
|
|
3
|
+
'action-bar-apply': string;
|
|
4
|
+
'action-bar-start.time': string;
|
|
5
|
+
'action-bar-end.time': string;
|
|
6
|
+
'toolbar-date-range-shortcut-custom': string;
|
|
7
|
+
"toolbar-date-range-shortcut-date-range": string;
|
|
8
|
+
"toolbar-date-range-shortcut-starting": string;
|
|
9
|
+
"toolbar-date-range-shortcut-ending": string;
|
|
10
|
+
"toolbar-date-range-shortcut-today": string;
|
|
11
|
+
"toolbar-date-range-shortcut-yesterday": string;
|
|
12
|
+
"toolbar-date-range-shortcut-tomorrow": string;
|
|
13
|
+
"toolbar-date-range-shortcut-last-3-days": string;
|
|
14
|
+
"toolbar-date-range-shortcut-last-7-days": string;
|
|
15
|
+
"toolbar-date-range-shortcut-last-30-days": string;
|
|
16
|
+
"toolbar-date-range-shortcut-last-90-days": string;
|
|
17
|
+
"toolbar-date-range-shortcut-last-180-days": string;
|
|
18
|
+
"toolbar-date-range-shortcut-next-3-days": string;
|
|
19
|
+
"toolbar-date-range-shortcut-next-7-days": string;
|
|
20
|
+
"toolbar-date-range-shortcut-next-30-days": string;
|
|
21
|
+
"toolbar-date-range-shortcut-next-90-days": string;
|
|
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;
|
|
25
|
+
};
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"action-bar-cancel": string;
|
|
3
|
+
"action-bar-apply": string;
|
|
4
|
+
"action-bar-start.time": string;
|
|
5
|
+
"action-bar-end.time": string;
|
|
6
|
+
"toolbar-date-range-shortcut-date-range": string;
|
|
7
|
+
"toolbar-date-range-shortcut-starting": string;
|
|
8
|
+
"toolbar-date-range-shortcut-ending": string;
|
|
9
|
+
"toolbar-date-range-shortcut-custom": string;
|
|
10
|
+
"toolbar-date-range-shortcut-today": string;
|
|
11
|
+
"toolbar-date-range-shortcut-yesterday": string;
|
|
12
|
+
"toolbar-date-range-shortcut-tomorrow": string;
|
|
13
|
+
"toolbar-date-range-shortcut-last-3-days": string;
|
|
14
|
+
"toolbar-date-range-shortcut-last-7-days": string;
|
|
15
|
+
"toolbar-date-range-shortcut-last-30-days": string;
|
|
16
|
+
"toolbar-date-range-shortcut-last-90-days": string;
|
|
17
|
+
"toolbar-date-range-shortcut-last-180-days": string;
|
|
18
|
+
"toolbar-date-range-shortcut-next-3-days": string;
|
|
19
|
+
"toolbar-date-range-shortcut-next-7-days": string;
|
|
20
|
+
"toolbar-date-range-shortcut-next-30-days": string;
|
|
21
|
+
"toolbar-date-range-shortcut-next-90-days": string;
|
|
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;
|
|
25
|
+
};
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
'action-bar-cancel': string;
|
|
3
|
+
'action-bar-apply': string;
|
|
4
|
+
'action-bar-start.time': string;
|
|
5
|
+
'action-bar-end.time': string;
|
|
6
|
+
'toolbar-date-range-shortcut-custom': string;
|
|
7
|
+
"toolbar-date-range-shortcut-date-range": string;
|
|
8
|
+
"toolbar-date-range-shortcut-starting": string;
|
|
9
|
+
"toolbar-date-range-shortcut-ending": string;
|
|
10
|
+
"toolbar-date-range-shortcut-today": string;
|
|
11
|
+
"toolbar-date-range-shortcut-yesterday": string;
|
|
12
|
+
"toolbar-date-range-shortcut-tomorrow": string;
|
|
13
|
+
"toolbar-date-range-shortcut-last-3-days": string;
|
|
14
|
+
"toolbar-date-range-shortcut-last-7-days": string;
|
|
15
|
+
"toolbar-date-range-shortcut-last-30-days": string;
|
|
16
|
+
"toolbar-date-range-shortcut-last-90-days": string;
|
|
17
|
+
"toolbar-date-range-shortcut-last-180-days": string;
|
|
18
|
+
"toolbar-date-range-shortcut-next-3-days": string;
|
|
19
|
+
"toolbar-date-range-shortcut-next-7-days": string;
|
|
20
|
+
"toolbar-date-range-shortcut-next-30-days": string;
|
|
21
|
+
"toolbar-date-range-shortcut-next-90-days": string;
|
|
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;
|
|
25
|
+
};
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { PresetType } from "../Shortcuts";
|
|
2
|
+
import { Dayjs } from "dayjs";
|
|
3
|
+
export declare const getCurrentLocale: () => string;
|
|
4
|
+
export declare const isBrowser: boolean;
|
|
5
|
+
export declare const isMobile: () => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* 格式化预设
|
|
8
|
+
* @param presets
|
|
9
|
+
*/
|
|
10
|
+
export declare const formatPresets: (presets: PresetType[], locale?: string) => ({
|
|
11
|
+
label: any;
|
|
12
|
+
getValue: (() => Dayjs[]) | (() => [Dayjs, Dayjs] | "today" | "yesterday" | "last_3_days" | "last_7_days" | "last_30_days" | "last_90_days" | "last_180_days" | "tomorrow" | "next_3_days" | "next_7_days" | "next_30_days" | "next_90_days" | "next_180_days");
|
|
13
|
+
value: [Dayjs, Dayjs] | "today" | "yesterday" | "last_3_days" | "last_7_days" | "last_30_days" | "last_90_days" | "last_180_days" | "tomorrow" | "next_3_days" | "next_7_days" | "next_30_days" | "next_90_days" | "next_180_days";
|
|
14
|
+
key?: string | undefined;
|
|
15
|
+
} | {
|
|
16
|
+
label: string | undefined;
|
|
17
|
+
getValue: () => [Dayjs, Dayjs] | "today" | "yesterday" | "last_3_days" | "last_7_days" | "last_30_days" | "last_90_days" | "last_180_days" | "tomorrow" | "next_3_days" | "next_7_days" | "next_30_days" | "next_90_days" | "next_180_days";
|
|
18
|
+
})[];
|
|
19
|
+
/**
|
|
20
|
+
* 获取预设的label
|
|
21
|
+
* @param currentShortcut
|
|
22
|
+
* @param presets
|
|
23
|
+
*/
|
|
24
|
+
export declare const getPresetLabel: (currentShortcut: string | null, presets: any[], locale: string) => any;
|
|
25
|
+
/**
|
|
26
|
+
* 获取预设的value
|
|
27
|
+
* @param value
|
|
28
|
+
* @param preset
|
|
29
|
+
*/
|
|
30
|
+
export declare const getShortcutValue: (value: string, preset: any[]) => any;
|
|
31
|
+
/**
|
|
32
|
+
* 通过快捷字符串获取对应的value值
|
|
33
|
+
* @param value
|
|
34
|
+
* @param preset
|
|
35
|
+
*/
|
|
36
|
+
export declare const getDatePickerValueByShortcut: (value: string, preset?: any[]) => any;
|
|
37
|
+
/**
|
|
38
|
+
* 获取datePicker 时间值 [dayjs,dayjs]
|
|
39
|
+
* @param value
|
|
40
|
+
* @param preset
|
|
41
|
+
*/
|
|
42
|
+
export declare const getDatePickerValue: (value: string | Dayjs[], preset?: any[]) => any;
|