@pisell/date-picker 1.0.76 → 1.0.78
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/PisellDateRangePicker/index.d.ts +81 -0
- package/es/PisellDateRangePicker/index.js +5 -4
- package/es/Shortcuts/index.d.ts +15 -0
- package/es/Toolbar/index.d.ts +3 -0
- package/es/browserSelect/index.d.ts +15 -0
- package/es/browserSelect/index.js +1 -1
- package/es/browserSelect/index.less +1 -1
- package/es/constants.d.ts +58 -0
- package/es/constants.js +48 -29
- 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 +23 -0
- package/es/index.js +1 -1
- package/es/internals/utils/date-fields-utils.d.ts +1 -1
- package/es/locales/en-US.d.ts +24 -0
- package/es/locales/zh-CN.d.ts +24 -0
- package/es/locales/zh-TW.d.ts +24 -0
- package/es/utils/index.d.ts +42 -0
- package/es/utils/index.js +14 -2
- 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/PisellDateRangePicker/index.d.ts +81 -0
- package/lib/PisellDateRangePicker/index.js +5 -3
- package/lib/Shortcuts/index.d.ts +15 -0
- package/lib/Toolbar/index.d.ts +3 -0
- package/lib/browserSelect/index.d.ts +15 -0
- package/lib/browserSelect/index.js +1 -1
- package/lib/browserSelect/index.less +1 -1
- package/lib/constants.d.ts +58 -0
- package/lib/constants.js +31 -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 +23 -0
- package/lib/index.js +2 -0
- package/lib/internals/utils/date-fields-utils.d.ts +1 -1
- package/lib/locales/en-US.d.ts +24 -0
- package/lib/locales/zh-CN.d.ts +24 -0
- package/lib/locales/zh-TW.d.ts +24 -0
- package/lib/utils/index.d.ts +42 -0
- package/lib/utils/index.js +9 -1
- 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,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;
|
|
@@ -29,6 +29,7 @@ import { pLocaleMap } from "../locales";
|
|
|
29
29
|
import Dialog from "../Dialog";
|
|
30
30
|
import Toolbar from "../Toolbar";
|
|
31
31
|
import useNextDay from "../hooks/useNextDay";
|
|
32
|
+
import { defaultPresets } from "../constants";
|
|
32
33
|
var transDayjsArr = function transDayjsArr(dayjsArr, defaultValue, _presets) {
|
|
33
34
|
var _newArr;
|
|
34
35
|
if (isString(dayjsArr)) {
|
|
@@ -47,8 +48,7 @@ var transDayjsArr = function transDayjsArr(dayjsArr, defaultValue, _presets) {
|
|
|
47
48
|
var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
48
49
|
var propsOnChange = props.onChange,
|
|
49
50
|
propsValue = props.value,
|
|
50
|
-
|
|
51
|
-
presets = _props$presets === void 0 ? [] : _props$presets,
|
|
51
|
+
presets = props.presets,
|
|
52
52
|
className = props.className,
|
|
53
53
|
showTime = props.showTime,
|
|
54
54
|
placeholder = props.placeholder,
|
|
@@ -97,7 +97,7 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
97
97
|
isBoolean(propsOpen) && setOpen(propsOpen);
|
|
98
98
|
}, [propsOpen]);
|
|
99
99
|
var _presets = useMemo(function () {
|
|
100
|
-
return formatPresets(presets);
|
|
100
|
+
return formatPresets(presets || defaultPresets);
|
|
101
101
|
}, [presets]);
|
|
102
102
|
var _useState5 = useState(function () {
|
|
103
103
|
return transDayjsArr(propsValue, defaultValue, _presets);
|
|
@@ -220,10 +220,11 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
220
220
|
return localeValue === "en" || localeValue === "en-US" ? "DD/MM/YYYY" : "YYYY/MM/DD";
|
|
221
221
|
}, [propsFormat, locale]);
|
|
222
222
|
var inputPropsObj = useMemo(function () {
|
|
223
|
+
var _value$every;
|
|
223
224
|
var obj = {
|
|
224
225
|
endAdornment: endAdornment
|
|
225
226
|
};
|
|
226
|
-
if (_value.every(Boolean) && getPresetLabel(currentShortcut, _presets)) {
|
|
227
|
+
if (_value !== null && _value !== void 0 && (_value$every = _value.every) !== null && _value$every !== void 0 && _value$every.call(_value, Boolean) && getPresetLabel(currentShortcut, _presets)) {
|
|
227
228
|
obj = _objectSpread(_objectSpread({}, obj), {}, {
|
|
228
229
|
value: getPresetLabel(currentShortcut, _presets)
|
|
229
230
|
});
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -25,7 +25,7 @@ var BrowserSelect = function BrowserSelect(props) {
|
|
|
25
25
|
});
|
|
26
26
|
}, [props.options]);
|
|
27
27
|
return /*#__PURE__*/React.createElement("select", _extends({}, resetProps, {
|
|
28
|
-
className: classNames("pisell-browser-select", resetProps.className),
|
|
28
|
+
className: classNames("date-picker-pisell-browser-select", resetProps.className),
|
|
29
29
|
onChange: function onChange(e) {
|
|
30
30
|
var _resetProps$onChange;
|
|
31
31
|
e.persist();
|
|
@@ -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: () => any;
|
|
8
|
+
};
|
|
9
|
+
yesterday: {
|
|
10
|
+
getValue: () => dayjs.Dayjs[];
|
|
11
|
+
label: () => any;
|
|
12
|
+
};
|
|
13
|
+
last_3_days: {
|
|
14
|
+
getValue: () => dayjs.Dayjs[];
|
|
15
|
+
label: () => any;
|
|
16
|
+
};
|
|
17
|
+
last_7_days: {
|
|
18
|
+
getValue: () => dayjs.Dayjs[];
|
|
19
|
+
label: () => any;
|
|
20
|
+
};
|
|
21
|
+
last_30_days: {
|
|
22
|
+
getValue: () => dayjs.Dayjs[];
|
|
23
|
+
label: () => any;
|
|
24
|
+
};
|
|
25
|
+
last_90_days: {
|
|
26
|
+
getValue: () => dayjs.Dayjs[];
|
|
27
|
+
label: () => any;
|
|
28
|
+
};
|
|
29
|
+
last_180_days: {
|
|
30
|
+
getValue: () => dayjs.Dayjs[];
|
|
31
|
+
label: () => any;
|
|
32
|
+
};
|
|
33
|
+
tomorrow: {
|
|
34
|
+
getValue: () => dayjs.Dayjs[];
|
|
35
|
+
label: () => any;
|
|
36
|
+
};
|
|
37
|
+
next_3_days: {
|
|
38
|
+
getValue: () => dayjs.Dayjs[];
|
|
39
|
+
label: () => any;
|
|
40
|
+
};
|
|
41
|
+
next_7_days: {
|
|
42
|
+
getValue: () => dayjs.Dayjs[];
|
|
43
|
+
label: () => any;
|
|
44
|
+
};
|
|
45
|
+
next_30_days: {
|
|
46
|
+
getValue: () => dayjs.Dayjs[];
|
|
47
|
+
label: () => any;
|
|
48
|
+
};
|
|
49
|
+
next_90_days: {
|
|
50
|
+
getValue: () => dayjs.Dayjs[];
|
|
51
|
+
label: () => any;
|
|
52
|
+
};
|
|
53
|
+
next_180_days: {
|
|
54
|
+
getValue: () => dayjs.Dayjs[];
|
|
55
|
+
label: () => any;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export declare const defaultPresets: PresetType[];
|
package/es/constants.js
CHANGED
|
@@ -1,109 +1,128 @@
|
|
|
1
|
-
import dayjs from
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
2
|
import { getText } from "./locales";
|
|
3
|
-
export var presetValueArr = [
|
|
3
|
+
export var presetValueArr = ['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'];
|
|
4
4
|
export var presetDetailMap = {
|
|
5
5
|
today: {
|
|
6
6
|
getValue: function getValue() {
|
|
7
|
-
return [dayjs().startOf(
|
|
7
|
+
return [dayjs().startOf('day'), dayjs().endOf('day')];
|
|
8
8
|
},
|
|
9
9
|
label: function label() {
|
|
10
|
-
return getText(
|
|
10
|
+
return getText('toolbar-date-range-shortcut-today');
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
yesterday: {
|
|
14
14
|
getValue: function getValue() {
|
|
15
|
-
return [dayjs().add(-1,
|
|
15
|
+
return [dayjs().add(-1, 'd').startOf('day'), dayjs().add(-1, 'd').endOf('day')];
|
|
16
16
|
},
|
|
17
17
|
label: function label() {
|
|
18
|
-
return getText(
|
|
18
|
+
return getText('toolbar-date-range-shortcut-yesterday');
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
last_3_days: {
|
|
22
22
|
getValue: function getValue() {
|
|
23
|
-
return [dayjs().add(-3,
|
|
23
|
+
return [dayjs().add(-3, 'd').startOf('day'), dayjs().add(-1, 'd').endOf('day')];
|
|
24
24
|
},
|
|
25
25
|
label: function label() {
|
|
26
|
-
return getText(
|
|
26
|
+
return getText('toolbar-date-range-shortcut-last-3-days');
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
last_7_days: {
|
|
30
30
|
getValue: function getValue() {
|
|
31
|
-
return [dayjs().add(-7,
|
|
31
|
+
return [dayjs().add(-7, 'd').startOf('day'), dayjs().add(-1, 'd').endOf('day')];
|
|
32
32
|
},
|
|
33
33
|
label: function label() {
|
|
34
|
-
return getText(
|
|
34
|
+
return getText('toolbar-date-range-shortcut-last-7-days');
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
last_30_days: {
|
|
38
38
|
getValue: function getValue() {
|
|
39
|
-
return [dayjs().add(-30,
|
|
39
|
+
return [dayjs().add(-30, 'd').startOf('day'), dayjs().add(-1, 'd').endOf('day')];
|
|
40
40
|
},
|
|
41
41
|
label: function label() {
|
|
42
|
-
return getText(
|
|
42
|
+
return getText('toolbar-date-range-shortcut-last-30-days');
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
last_90_days: {
|
|
46
46
|
getValue: function getValue() {
|
|
47
|
-
return [dayjs().add(-90,
|
|
47
|
+
return [dayjs().add(-90, 'd').startOf('day'), dayjs().add(-1, 'd').endOf('day')];
|
|
48
48
|
},
|
|
49
49
|
label: function label() {
|
|
50
|
-
return getText(
|
|
50
|
+
return getText('toolbar-date-range-shortcut-last-90-days');
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
last_180_days: {
|
|
54
54
|
getValue: function getValue() {
|
|
55
|
-
return [dayjs().add(-180,
|
|
55
|
+
return [dayjs().add(-180, 'd').startOf('day'), dayjs().add(-1, 'd').endOf('day')];
|
|
56
56
|
},
|
|
57
57
|
label: function label() {
|
|
58
|
-
return getText(
|
|
58
|
+
return getText('toolbar-date-range-shortcut-last-180-days');
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
tomorrow: {
|
|
62
62
|
getValue: function getValue() {
|
|
63
|
-
return [dayjs().add(1,
|
|
63
|
+
return [dayjs().add(1, 'd').startOf('day'), dayjs().add(1, 'd').endOf('day')];
|
|
64
64
|
},
|
|
65
65
|
label: function label() {
|
|
66
|
-
return getText(
|
|
66
|
+
return getText('toolbar-date-range-shortcut-tomorrow');
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
next_3_days: {
|
|
70
70
|
getValue: function getValue() {
|
|
71
|
-
return [dayjs().add(1,
|
|
71
|
+
return [dayjs().add(1, 'd').startOf('day'), dayjs().add(3, 'd').endOf('day')];
|
|
72
72
|
},
|
|
73
73
|
label: function label() {
|
|
74
|
-
return getText(
|
|
74
|
+
return getText('toolbar-date-range-shortcut-next-3-days');
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
next_7_days: {
|
|
78
78
|
getValue: function getValue() {
|
|
79
|
-
return [dayjs().add(1,
|
|
79
|
+
return [dayjs().add(1, 'd').startOf('day'), dayjs().add(7, 'd').endOf('day')];
|
|
80
80
|
},
|
|
81
81
|
label: function label() {
|
|
82
|
-
return getText(
|
|
82
|
+
return getText('toolbar-date-range-shortcut-next-7-days');
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
85
|
next_30_days: {
|
|
86
86
|
getValue: function getValue() {
|
|
87
|
-
return [dayjs().add(1,
|
|
87
|
+
return [dayjs().add(1, 'd').startOf('day'), dayjs().add(30, 'd').endOf('day')];
|
|
88
88
|
},
|
|
89
89
|
label: function label() {
|
|
90
|
-
return getText(
|
|
90
|
+
return getText('toolbar-date-range-shortcut-next-30-days');
|
|
91
91
|
}
|
|
92
92
|
},
|
|
93
93
|
next_90_days: {
|
|
94
94
|
getValue: function getValue() {
|
|
95
|
-
return [dayjs().add(1,
|
|
95
|
+
return [dayjs().add(1, 'd').startOf('day'), dayjs().add(90, 'd').endOf('day')];
|
|
96
96
|
},
|
|
97
97
|
label: function label() {
|
|
98
|
-
return getText(
|
|
98
|
+
return getText('toolbar-date-range-shortcut-next-90-days');
|
|
99
99
|
}
|
|
100
100
|
},
|
|
101
101
|
next_180_days: {
|
|
102
102
|
getValue: function getValue() {
|
|
103
|
-
return [dayjs().add(1,
|
|
103
|
+
return [dayjs().add(1, 'd').startOf('day'), dayjs().add(180, 'd').endOf('day')];
|
|
104
104
|
},
|
|
105
105
|
label: function label() {
|
|
106
|
-
return getText(
|
|
106
|
+
return getText('toolbar-date-range-shortcut-next-180-days');
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
};
|
|
109
|
+
};
|
|
110
|
+
export var defaultPresets = [{
|
|
111
|
+
value: 'today'
|
|
112
|
+
}, {
|
|
113
|
+
value: 'yesterday'
|
|
114
|
+
}, {
|
|
115
|
+
value: 'tomorrow'
|
|
116
|
+
}, {
|
|
117
|
+
value: 'next_7_days'
|
|
118
|
+
}, {
|
|
119
|
+
value: 'next_30_days'
|
|
120
|
+
}, {
|
|
121
|
+
value: 'next_90_days'
|
|
122
|
+
}, {
|
|
123
|
+
value: 'last_7_days'
|
|
124
|
+
}, {
|
|
125
|
+
value: 'last_30_days'
|
|
126
|
+
}, {
|
|
127
|
+
value: 'last_90_days'
|
|
128
|
+
}];
|
package/es/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import PisellDateRangePicker from "./PisellDateRangePicker";
|
|
2
|
+
import { LocaleContext, LocaleProvider } from "./PisellDateRangePicker/LocaleContext";
|
|
3
|
+
export * from "@mui/x-date-pickers";
|
|
4
|
+
export * from "@mui/material/styles";
|
|
5
|
+
export * from "./DateRangePickerDay";
|
|
6
|
+
export * from "./MultiInputDateRangeField";
|
|
7
|
+
export * from "./MultiInputTimeRangeField";
|
|
8
|
+
export * from "./MultiInputDateTimeRangeField";
|
|
9
|
+
export * from "./SingleInputDateRangeField";
|
|
10
|
+
export * from "./SingleInputTimeRangeField";
|
|
11
|
+
export * from "./SingleInputDateTimeRangeField";
|
|
12
|
+
export type { RangeFieldSection, BaseMultiInputFieldProps, MultiInputFieldSlotTextFieldProps, } from "./internals/models/fields";
|
|
13
|
+
export * from "./DateRangeCalendar";
|
|
14
|
+
export * from "./DesktopDateRangePicker";
|
|
15
|
+
export * from "./MobileDateRangePicker";
|
|
16
|
+
export * from "./StaticDateRangePicker";
|
|
17
|
+
export * from "./dateRangeViewRenderers";
|
|
18
|
+
export type { DateRange, RangePosition } from "./internals/models/range";
|
|
19
|
+
export type { UseDateRangeFieldProps } from "./internals/models/dateRange";
|
|
20
|
+
export { PisellDateRangePicker as RangePicker };
|
|
21
|
+
export { LocaleContext, LocaleProvider };
|
|
22
|
+
export { getDatePickerValueByShortcut, formatPresets, getShortcutValue, getPresetLabel, getDatePickerValue, } from "./utils/index";
|
|
23
|
+
export * from "./models";
|
package/es/index.js
CHANGED
|
@@ -24,5 +24,5 @@ export * from "./StaticDateRangePicker";
|
|
|
24
24
|
export * from "./dateRangeViewRenderers";
|
|
25
25
|
export { PisellDateRangePicker as RangePicker };
|
|
26
26
|
export { LocaleContext, LocaleProvider };
|
|
27
|
-
export { getDatePickerValueByShortcut, formatPresets, getShortcutValue, getPresetLabel } from "./utils/index";
|
|
27
|
+
export { getDatePickerValueByShortcut, formatPresets, getShortcutValue, getPresetLabel, getDatePickerValue } from "./utils/index";
|
|
28
28
|
export * from "./models";
|
|
@@ -5,7 +5,7 @@ export declare const splitDateRangeSections: (sections: RangeFieldSection[]) =>
|
|
|
5
5
|
};
|
|
6
6
|
export declare const removeLastSeparator: (dateSections: RangeFieldSection[]) => (RangeFieldSection | {
|
|
7
7
|
separator: null;
|
|
8
|
-
dateName: "
|
|
8
|
+
dateName: "start" | "end";
|
|
9
9
|
value: string;
|
|
10
10
|
format: string;
|
|
11
11
|
maxLength: number | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
};
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
};
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
};
|
|
24
|
+
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[]) => ({
|
|
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[]) => 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;
|