@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;
|
|
@@ -141,6 +141,12 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
141
141
|
setCurrentShortcut(lastConfirmShortcut.current);
|
|
142
142
|
};
|
|
143
143
|
var handleOk = function handleOk() {
|
|
144
|
+
var val = getVal();
|
|
145
|
+
if (val.some(function (item) {
|
|
146
|
+
return !item;
|
|
147
|
+
})) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
144
150
|
setOpen(false);
|
|
145
151
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
146
152
|
propsOnChange === null || propsOnChange === void 0 ? void 0 : propsOnChange(getVal());
|
|
@@ -310,7 +316,9 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
310
316
|
locale: locale,
|
|
311
317
|
onChange: handleChange,
|
|
312
318
|
currentShortcut: currentShortcut,
|
|
313
|
-
setCurrentShortcut: setCurrentShortcut
|
|
319
|
+
setCurrentShortcut: setCurrentShortcut,
|
|
320
|
+
disabledDate: disabledDate,
|
|
321
|
+
value: _value
|
|
314
322
|
},
|
|
315
323
|
layout: {
|
|
316
324
|
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/es/Toolbar/index.js
CHANGED
|
@@ -8,7 +8,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
8
8
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
9
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
-
import React, { useMemo, useState, useEffect } from 'react';
|
|
11
|
+
import React, { useMemo, useState, useEffect, useRef } from 'react';
|
|
12
12
|
import { Input } from 'antd';
|
|
13
13
|
import dayjs from 'dayjs';
|
|
14
14
|
import BrowserSelect from "../browserSelect";
|
|
@@ -25,7 +25,8 @@ var Toolbar = function Toolbar(props) {
|
|
|
25
25
|
locale = props.locale,
|
|
26
26
|
onChange = props.onChange,
|
|
27
27
|
currentShortcut = props.currentShortcut,
|
|
28
|
-
setCurrentShortcut = props.setCurrentShortcut
|
|
28
|
+
setCurrentShortcut = props.setCurrentShortcut,
|
|
29
|
+
disabledDate = props.disabledDate;
|
|
29
30
|
var format = locale === 'en' || locale === 'en-US' ? 'DD/MM/YYYY' : 'YYYY/MM/DD';
|
|
30
31
|
var _useState = useState(''),
|
|
31
32
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -43,6 +44,8 @@ var Toolbar = function Toolbar(props) {
|
|
|
43
44
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
44
45
|
endError = _useState8[0],
|
|
45
46
|
setEndError = _useState8[1];
|
|
47
|
+
var valueRef = useRef(value);
|
|
48
|
+
valueRef.current = value;
|
|
46
49
|
useEffect(function () {
|
|
47
50
|
if (value !== null && value !== void 0 && value[0]) {
|
|
48
51
|
setStartStr(value[0].format(format));
|
|
@@ -57,10 +60,22 @@ var Toolbar = function Toolbar(props) {
|
|
|
57
60
|
setEndStr('');
|
|
58
61
|
}
|
|
59
62
|
}, [value]);
|
|
63
|
+
var checkDateDisabled = function checkDateDisabled(position) {
|
|
64
|
+
var val = valueRef.current;
|
|
65
|
+
if (position === 'start' && val[0] && disabledDate !== null && disabledDate !== void 0 && disabledDate(val[1], position, val)) {
|
|
66
|
+
setStartError(true);
|
|
67
|
+
onChange([null, val[1]], 'write');
|
|
68
|
+
}
|
|
69
|
+
if (position === 'end' && val[1] && disabledDate !== null && disabledDate !== void 0 && disabledDate(val[1], position, val)) {
|
|
70
|
+
setEndError(true);
|
|
71
|
+
onChange([val[0], null], 'write');
|
|
72
|
+
}
|
|
73
|
+
};
|
|
60
74
|
var handleStartChange = function handleStartChange(e) {
|
|
61
75
|
var val = e.target.value;
|
|
62
76
|
setStartStr(val);
|
|
63
|
-
|
|
77
|
+
var objValue = dayjs(val, format);
|
|
78
|
+
if (isValidDate(val, format) && (value[1] ? objValue <= value[1] : true) && !(disabledDate !== null && disabledDate !== void 0 && disabledDate(objValue, 'start', value))) {
|
|
64
79
|
var _start$set, _start$set$set;
|
|
65
80
|
setStartError(false);
|
|
66
81
|
var valDate = dayjs(val, format);
|
|
@@ -71,11 +86,15 @@ var Toolbar = function Toolbar(props) {
|
|
|
71
86
|
} else {
|
|
72
87
|
setStartError(true);
|
|
73
88
|
}
|
|
89
|
+
setTimeout(function () {
|
|
90
|
+
checkDateDisabled('end');
|
|
91
|
+
}, 200);
|
|
74
92
|
};
|
|
75
93
|
var handleEndChange = function handleEndChange(e) {
|
|
76
94
|
var val = e.target.value;
|
|
77
95
|
setEndStr(val);
|
|
78
|
-
|
|
96
|
+
var objValue = dayjs(val, format);
|
|
97
|
+
if (isValidDate(val, format) && (value[0] ? objValue >= value[0] : true) && !(disabledDate !== null && disabledDate !== void 0 && disabledDate(objValue, 'end', value))) {
|
|
79
98
|
var _end$set, _end$set$set;
|
|
80
99
|
setEndError(false);
|
|
81
100
|
var valDate = dayjs(val, format);
|
|
@@ -86,6 +105,9 @@ var Toolbar = function Toolbar(props) {
|
|
|
86
105
|
} else {
|
|
87
106
|
setEndError(true);
|
|
88
107
|
}
|
|
108
|
+
setTimeout(function () {
|
|
109
|
+
checkDateDisabled('start');
|
|
110
|
+
}, 200);
|
|
89
111
|
};
|
|
90
112
|
var handleSelectChange = function handleSelectChange(e) {
|
|
91
113
|
var val = e.target.value;
|
|
@@ -122,7 +144,7 @@ var Toolbar = function Toolbar(props) {
|
|
|
122
144
|
}, /*#__PURE__*/React.createElement("div", {
|
|
123
145
|
className: "date-picker-toolbar-start-wrap"
|
|
124
146
|
}, /*#__PURE__*/React.createElement("span", null, getText('toolbar-date-range-shortcut-starting', pLocaleMap[locale])), /*#__PURE__*/React.createElement(Input, {
|
|
125
|
-
status: startError ?
|
|
147
|
+
status: startError ? 'error' : '',
|
|
126
148
|
size: "large",
|
|
127
149
|
value: startStr,
|
|
128
150
|
onChange: handleStartChange,
|
|
@@ -132,7 +154,7 @@ var Toolbar = function Toolbar(props) {
|
|
|
132
154
|
}, getText('toolbar-date-range-invalid-start-date', pLocaleMap[locale]))), /*#__PURE__*/React.createElement("div", {
|
|
133
155
|
className: "date-picker-toolbar-end-wrap"
|
|
134
156
|
}, /*#__PURE__*/React.createElement("span", null, getText('toolbar-date-range-shortcut-ending', pLocaleMap[locale])), /*#__PURE__*/React.createElement(Input, {
|
|
135
|
-
status: endError ?
|
|
157
|
+
status: endError ? 'error' : '',
|
|
136
158
|
size: "large",
|
|
137
159
|
value: endStr,
|
|
138
160
|
onChange: handleEndChange,
|
|
@@ -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/es/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;
|