@pisell/date-picker 1.0.75 → 1.0.77
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.js +19 -28
- package/es/ActionBar/index.less +2 -1
- package/es/CustomCalendarHeader/index.d.ts +2 -0
- package/es/CustomCalendarHeader/index.js +53 -0
- package/es/Dialog/index.d.ts +2 -0
- package/es/Dialog/index.js +22 -0
- package/es/Drawer/index.d.ts +11 -0
- package/es/Drawer/index.js +35 -0
- package/es/Drawer/index.less +40 -0
- package/es/PisellDateRangePicker/LocaleContext.d.ts +2 -0
- package/es/PisellDateRangePicker/index.d.ts +81 -0
- package/es/PisellDateRangePicker/index.js +112 -41
- package/es/PisellDateRangePicker/index.less +56 -0
- package/es/Shortcuts/index.d.ts +4 -3
- package/es/Toolbar/index.d.ts +3 -0
- package/es/Toolbar/index.js +122 -0
- package/es/Toolbar/index.less +32 -0
- package/es/browserSelect/chevron-down.png +0 -0
- package/es/browserSelect/index.d.ts +15 -0
- package/es/browserSelect/index.js +36 -0
- package/es/browserSelect/index.less +18 -0
- package/es/constants.d.ts +58 -0
- package/es/constants.js +128 -0
- package/es/hooks/useDocumentVisibility.d.ts +2 -0
- package/es/hooks/useDocumentVisibility.js +27 -0
- package/es/hooks/useNextDay.d.ts +2 -0
- package/es/hooks/useNextDay.js +15 -0
- package/es/hooks/useUpdateEffect.d.ts +2 -0
- package/es/hooks/useUpdateEffect.js +11 -0
- package/es/icon/ChevronLeft.d.ts +5 -0
- package/es/icon/ChevronLeft.js +23 -0
- package/es/icon/ChevronLeftDouble.d.ts +5 -0
- package/es/icon/ChevronLeftDouble.js +23 -0
- package/es/icon/ChevronRight.d.ts +5 -0
- package/es/icon/ChevronRight.js +23 -0
- package/es/icon/ChevronRightDouble.d.ts +5 -0
- package/es/icon/ChevronRightDouble.js +23 -0
- package/es/index.d.ts +23 -0
- package/es/index.js +1 -0
- package/es/locales/en-US.d.ts +17 -0
- package/es/locales/en-US.js +18 -1
- package/es/locales/index.d.ts +2 -0
- package/es/locales/zh-CN.d.ts +21 -4
- package/es/locales/zh-CN.js +21 -4
- package/es/locales/zh-TW.d.ts +17 -0
- package/es/locales/zh-TW.js +18 -1
- package/es/utils/index.d.ts +32 -0
- package/es/utils/index.js +86 -3
- package/lib/ActionBar/index.js +30 -25
- package/lib/ActionBar/index.less +2 -1
- package/lib/CustomCalendarHeader/index.d.ts +2 -0
- package/lib/CustomCalendarHeader/index.js +58 -0
- package/lib/Dialog/index.d.ts +2 -0
- package/lib/Dialog/index.js +52 -0
- package/lib/Drawer/index.d.ts +11 -0
- package/lib/Drawer/index.js +62 -0
- package/lib/Drawer/index.less +40 -0
- package/lib/PisellDateRangePicker/LocaleContext.d.ts +2 -0
- package/lib/PisellDateRangePicker/index.d.ts +81 -0
- package/lib/PisellDateRangePicker/index.js +89 -33
- package/lib/PisellDateRangePicker/index.less +56 -0
- package/lib/Shortcuts/index.d.ts +4 -3
- package/lib/Toolbar/index.d.ts +3 -0
- package/lib/Toolbar/index.js +139 -0
- package/lib/Toolbar/index.less +32 -0
- package/lib/browserSelect/chevron-down.png +0 -0
- package/lib/browserSelect/index.d.ts +15 -0
- package/lib/browserSelect/index.js +59 -0
- package/lib/browserSelect/index.less +18 -0
- package/lib/constants.d.ts +58 -0
- package/lib/constants.js +178 -0
- package/lib/hooks/useDocumentVisibility.d.ts +2 -0
- package/lib/hooks/useDocumentVisibility.js +40 -0
- package/lib/hooks/useNextDay.d.ts +2 -0
- package/lib/hooks/useNextDay.js +49 -0
- package/lib/hooks/useUpdateEffect.d.ts +2 -0
- package/lib/hooks/useUpdateEffect.js +35 -0
- package/lib/icon/ChevronLeft.d.ts +5 -0
- package/lib/icon/ChevronLeft.js +60 -0
- package/lib/icon/ChevronLeftDouble.d.ts +5 -0
- package/lib/icon/ChevronLeftDouble.js +60 -0
- package/lib/icon/ChevronRight.d.ts +5 -0
- package/lib/icon/ChevronRight.js +60 -0
- package/lib/icon/ChevronRightDouble.d.ts +5 -0
- package/lib/icon/ChevronRightDouble.js +60 -0
- package/lib/{PisellDateRangePicker → icon}/CloseCircle.js +1 -1
- package/lib/index.d.ts +23 -0
- package/lib/index.js +10 -1
- package/lib/locales/en-US.d.ts +17 -0
- package/lib/locales/en-US.js +18 -1
- package/lib/locales/index.d.ts +2 -0
- package/lib/locales/zh-CN.d.ts +21 -4
- package/lib/locales/zh-CN.js +18 -1
- package/lib/locales/zh-TW.d.ts +17 -0
- package/lib/locales/zh-TW.js +18 -1
- package/lib/utils/index.d.ts +32 -0
- package/lib/utils/index.js +58 -0
- package/package.json +1 -1
- /package/es/{PisellDateRangePicker → icon}/CloseCircle.d.ts +0 -0
- /package/es/{PisellDateRangePicker → icon}/CloseCircle.js +0 -0
- /package/lib/{PisellDateRangePicker → icon}/CloseCircle.d.ts +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
var ChevronRight = function ChevronRight(props) {
|
|
3
|
+
var className = props.className,
|
|
4
|
+
onClick = props.onClick;
|
|
5
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
6
|
+
className: className,
|
|
7
|
+
onClick: onClick
|
|
8
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
9
|
+
className: "icon",
|
|
10
|
+
viewBox: "0 0 1024 1024",
|
|
11
|
+
version: "1.1",
|
|
12
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13
|
+
"p-id": "35105",
|
|
14
|
+
width: "1em",
|
|
15
|
+
height: "1em"
|
|
16
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
17
|
+
"fill-rule": "evenodd",
|
|
18
|
+
"clip-rule": "evenodd",
|
|
19
|
+
d: "M8.29289 5.29289C8.68342 4.90237 9.31658 4.90237 9.70711 5.29289L15.7071 11.2929C16.0976 11.6834 16.0976 12.3166 15.7071 12.7071L9.70711 18.7071C9.31658 19.0976 8.68342 19.0976 8.29289 18.7071C7.90237 18.3166 7.90237 17.6834 8.29289 17.2929L13.5858 12L8.29289 6.70711C7.90237 6.31658 7.90237 5.68342 8.29289 5.29289Z",
|
|
20
|
+
fill: "currentColor"
|
|
21
|
+
})));
|
|
22
|
+
};
|
|
23
|
+
export default ChevronRight;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
var ChevronRightDouble = function ChevronRightDouble(props) {
|
|
3
|
+
var className = props.className,
|
|
4
|
+
onClick = props.onClick;
|
|
5
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
6
|
+
className: className,
|
|
7
|
+
onClick: onClick
|
|
8
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
9
|
+
className: "icon",
|
|
10
|
+
viewBox: "0 0 1024 1024",
|
|
11
|
+
version: "1.1",
|
|
12
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13
|
+
"p-id": "35105",
|
|
14
|
+
width: "1em",
|
|
15
|
+
height: "1em"
|
|
16
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
17
|
+
"fill-rule": "evenodd",
|
|
18
|
+
"clip-rule": "evenodd",
|
|
19
|
+
d: "M5.29289 6.29289C5.68342 5.90237 6.31658 5.90237 6.70711 6.29289L11.7071 11.2929C12.0976 11.6834 12.0976 12.3166 11.7071 12.7071L6.70711 17.7071C6.31658 18.0976 5.68342 18.0976 5.29289 17.7071C4.90237 17.3166 4.90237 16.6834 5.29289 16.2929L9.58579 12L5.29289 7.70711C4.90237 7.31658 4.90237 6.68342 5.29289 6.29289ZM12.2929 6.29289C12.6834 5.90237 13.3166 5.90237 13.7071 6.29289L18.7071 11.2929C19.0976 11.6834 19.0976 12.3166 18.7071 12.7071L13.7071 17.7071C13.3166 18.0976 12.6834 18.0976 12.2929 17.7071C11.9024 17.3166 11.9024 16.6834 12.2929 16.2929L16.5858 12L12.2929 7.70711C11.9024 7.31658 11.9024 6.68342 12.2929 6.29289Z",
|
|
20
|
+
fill: "currentColor"
|
|
21
|
+
})));
|
|
22
|
+
};
|
|
23
|
+
export default ChevronRightDouble;
|
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, } from "./utils/index";
|
|
23
|
+
export * from "./models";
|
package/es/index.js
CHANGED
|
@@ -24,4 +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
28
|
export * from "./models";
|
package/es/locales/en-US.d.ts
CHANGED
|
@@ -3,5 +3,22 @@ declare const _default: {
|
|
|
3
3
|
'action-bar-apply': string;
|
|
4
4
|
'action-bar-start.time': string;
|
|
5
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;
|
|
6
23
|
};
|
|
7
24
|
export default _default;
|
package/es/locales/en-US.js
CHANGED
|
@@ -2,5 +2,22 @@ export default {
|
|
|
2
2
|
'action-bar-cancel': 'Cancel',
|
|
3
3
|
'action-bar-apply': 'Apply',
|
|
4
4
|
'action-bar-start.time': 'Start time',
|
|
5
|
-
'action-bar-end.time': 'End time'
|
|
5
|
+
'action-bar-end.time': 'End time',
|
|
6
|
+
'toolbar-date-range-shortcut-custom': 'Custom',
|
|
7
|
+
"toolbar-date-range-shortcut-date-range": "Date range",
|
|
8
|
+
"toolbar-date-range-shortcut-starting": "Starting",
|
|
9
|
+
"toolbar-date-range-shortcut-ending": "Ending",
|
|
10
|
+
"toolbar-date-range-shortcut-today": "Today",
|
|
11
|
+
"toolbar-date-range-shortcut-yesterday": "Yesterday",
|
|
12
|
+
"toolbar-date-range-shortcut-tomorrow": "Tomorrow",
|
|
13
|
+
"toolbar-date-range-shortcut-last-3-days": "Last 3 days",
|
|
14
|
+
"toolbar-date-range-shortcut-last-7-days": "Last 7 days",
|
|
15
|
+
"toolbar-date-range-shortcut-last-30-days": "Last 30 days",
|
|
16
|
+
"toolbar-date-range-shortcut-last-90-days": "Last 90 days",
|
|
17
|
+
"toolbar-date-range-shortcut-last-180-days": "Last 180 days",
|
|
18
|
+
"toolbar-date-range-shortcut-next-3-days": "Next 3 days",
|
|
19
|
+
"toolbar-date-range-shortcut-next-7-days": "Next 7 days",
|
|
20
|
+
"toolbar-date-range-shortcut-next-30-days": "Next 30 days",
|
|
21
|
+
"toolbar-date-range-shortcut-next-90-days": "Next 90 days",
|
|
22
|
+
"toolbar-date-range-shortcut-next-180-days": "Next 180 days"
|
|
6
23
|
};
|
package/es/locales/zh-CN.d.ts
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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;
|
|
6
23
|
};
|
|
7
24
|
export default _default;
|
package/es/locales/zh-CN.js
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
"action-bar-cancel": "取消",
|
|
3
|
+
"action-bar-apply": "确定",
|
|
4
|
+
"action-bar-start.time": "开始时间",
|
|
5
|
+
"action-bar-end.time": "结束时间",
|
|
6
|
+
"toolbar-date-range-shortcut-date-range": "日期范围",
|
|
7
|
+
"toolbar-date-range-shortcut-starting": "开始",
|
|
8
|
+
"toolbar-date-range-shortcut-ending": "结束",
|
|
9
|
+
"toolbar-date-range-shortcut-custom": "自定义",
|
|
10
|
+
"toolbar-date-range-shortcut-today": "今天",
|
|
11
|
+
"toolbar-date-range-shortcut-yesterday": "昨天",
|
|
12
|
+
"toolbar-date-range-shortcut-tomorrow": "明天",
|
|
13
|
+
"toolbar-date-range-shortcut-last-3-days": "过去3天",
|
|
14
|
+
"toolbar-date-range-shortcut-last-7-days": "过去7天",
|
|
15
|
+
"toolbar-date-range-shortcut-last-30-days": "过去30天",
|
|
16
|
+
"toolbar-date-range-shortcut-last-90-days": "过去90天",
|
|
17
|
+
"toolbar-date-range-shortcut-last-180-days": "过去180天",
|
|
18
|
+
"toolbar-date-range-shortcut-next-3-days": "未来3天",
|
|
19
|
+
"toolbar-date-range-shortcut-next-7-days": "未来7天",
|
|
20
|
+
"toolbar-date-range-shortcut-next-30-days": "未来30天",
|
|
21
|
+
"toolbar-date-range-shortcut-next-90-days": "未来90天",
|
|
22
|
+
"toolbar-date-range-shortcut-next-180-days": "未来180天"
|
|
6
23
|
};
|
package/es/locales/zh-TW.d.ts
CHANGED
|
@@ -3,5 +3,22 @@ declare const _default: {
|
|
|
3
3
|
'action-bar-apply': string;
|
|
4
4
|
'action-bar-start.time': string;
|
|
5
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;
|
|
6
23
|
};
|
|
7
24
|
export default _default;
|
package/es/locales/zh-TW.js
CHANGED
|
@@ -2,5 +2,22 @@ export default {
|
|
|
2
2
|
'action-bar-cancel': '取消',
|
|
3
3
|
'action-bar-apply': '確定',
|
|
4
4
|
'action-bar-start.time': '開始時間',
|
|
5
|
-
'action-bar-end.time': '結束時間'
|
|
5
|
+
'action-bar-end.time': '結束時間',
|
|
6
|
+
'toolbar-date-range-shortcut-custom': '自定義',
|
|
7
|
+
"toolbar-date-range-shortcut-date-range": "日期範圍",
|
|
8
|
+
"toolbar-date-range-shortcut-starting": "開始",
|
|
9
|
+
"toolbar-date-range-shortcut-ending": "結束",
|
|
10
|
+
"toolbar-date-range-shortcut-today": "今天",
|
|
11
|
+
"toolbar-date-range-shortcut-yesterday": "昨天",
|
|
12
|
+
"toolbar-date-range-shortcut-tomorrow": "明天",
|
|
13
|
+
"toolbar-date-range-shortcut-last-3-days": "過去3天",
|
|
14
|
+
"toolbar-date-range-shortcut-last-7-days": "過去7天",
|
|
15
|
+
"toolbar-date-range-shortcut-last-30-days": "過去30天",
|
|
16
|
+
"toolbar-date-range-shortcut-last-90-days": "過去90天",
|
|
17
|
+
"toolbar-date-range-shortcut-last-180-days": "過去180天",
|
|
18
|
+
"toolbar-date-range-shortcut-next-3-days": "未來3天",
|
|
19
|
+
"toolbar-date-range-shortcut-next-7-days": "未來7天",
|
|
20
|
+
"toolbar-date-range-shortcut-next-30-days": "未來30天",
|
|
21
|
+
"toolbar-date-range-shortcut-next-90-days": "未來90天",
|
|
22
|
+
"toolbar-date-range-shortcut-next-180-days": "未來180天"
|
|
6
23
|
};
|
package/es/utils/index.d.ts
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
import { PresetType } from "../Shortcuts";
|
|
1
2
|
export declare const getCurrentLocale: () => string;
|
|
2
3
|
export declare const isBrowser: boolean;
|
|
3
4
|
export declare const isMobile: () => boolean;
|
|
5
|
+
/**
|
|
6
|
+
* 格式化预设
|
|
7
|
+
* @param presets
|
|
8
|
+
*/
|
|
9
|
+
export declare const formatPresets: (presets: PresetType[]) => ({
|
|
10
|
+
label: any;
|
|
11
|
+
getValue: (() => import("dayjs").Dayjs[]) | (() => [import("dayjs").Dayjs, import("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");
|
|
12
|
+
value: [import("dayjs").Dayjs, import("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
|
+
key?: string | undefined;
|
|
14
|
+
} | {
|
|
15
|
+
label: string | undefined;
|
|
16
|
+
getValue: () => [import("dayjs").Dayjs, import("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";
|
|
17
|
+
})[];
|
|
18
|
+
/**
|
|
19
|
+
* 获取预设的label
|
|
20
|
+
* @param currentShortcut
|
|
21
|
+
* @param presets
|
|
22
|
+
*/
|
|
23
|
+
export declare const getPresetLabel: (currentShortcut: string | null, presets: any[]) => any;
|
|
24
|
+
/**
|
|
25
|
+
* 获取预设的value
|
|
26
|
+
* @param value
|
|
27
|
+
* @param preset
|
|
28
|
+
*/
|
|
29
|
+
export declare const getShortcutValue: (value: string, preset: any[]) => any;
|
|
30
|
+
/**
|
|
31
|
+
* 通过快捷字符串获取对应的value值
|
|
32
|
+
* @param value
|
|
33
|
+
* @param preset
|
|
34
|
+
*/
|
|
35
|
+
export declare const getDatePickerValueByShortcut: (value: string, preset: any[]) => any;
|
package/es/utils/index.js
CHANGED
|
@@ -1,13 +1,96 @@
|
|
|
1
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
import { isFunction, isMobile as isMobileUtils, isString } from "@pisell/utils";
|
|
8
|
+
import { presetDetailMap, presetValueArr } from "../constants";
|
|
2
9
|
export var getCurrentLocale = function getCurrentLocale() {
|
|
3
|
-
var locale = localStorage.getItem(
|
|
10
|
+
var locale = localStorage.getItem("umi_locale") || "en-US";
|
|
4
11
|
//@ts-ignore
|
|
5
12
|
return locale;
|
|
6
13
|
};
|
|
7
|
-
export var isBrowser = !!(typeof window !==
|
|
14
|
+
export var isBrowser = !!(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
8
15
|
export var isMobile = function isMobile() {
|
|
9
16
|
if (isBrowser) {
|
|
10
17
|
return window.innerWidth <= 768 || isMobileUtils();
|
|
11
18
|
}
|
|
12
19
|
return isMobileUtils();
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 格式化预设
|
|
24
|
+
* @param presets
|
|
25
|
+
*/
|
|
26
|
+
export var formatPresets = function formatPresets(presets) {
|
|
27
|
+
return presets.map(function (item) {
|
|
28
|
+
// value包含在预设当中时
|
|
29
|
+
if (isString(item.value)) {
|
|
30
|
+
var _presetDetailMap$item, _presetDetailMap$item2;
|
|
31
|
+
var _getValue;
|
|
32
|
+
if (isFunction(item.getValue)) {
|
|
33
|
+
_getValue = item.getValue;
|
|
34
|
+
} else if (presetValueArr.includes(item.value)) {
|
|
35
|
+
_getValue = presetDetailMap[item.value].getValue;
|
|
36
|
+
} else {
|
|
37
|
+
_getValue = function _getValue() {
|
|
38
|
+
return item.value;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
42
|
+
label: item.label || (presetDetailMap === null || presetDetailMap === void 0 ? void 0 : (_presetDetailMap$item = presetDetailMap[item.value]) === null || _presetDetailMap$item === void 0 ? void 0 : (_presetDetailMap$item2 = _presetDetailMap$item.label) === null || _presetDetailMap$item2 === void 0 ? void 0 : _presetDetailMap$item2.call(_presetDetailMap$item)),
|
|
43
|
+
getValue: _getValue
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
var getValue = function getValue() {
|
|
47
|
+
if (isFunction(item.getValue)) {
|
|
48
|
+
return item.getValue();
|
|
49
|
+
}
|
|
50
|
+
return item === null || item === void 0 ? void 0 : item.value;
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
label: item.label,
|
|
54
|
+
getValue: getValue
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 获取预设的label
|
|
61
|
+
* @param currentShortcut
|
|
62
|
+
* @param presets
|
|
63
|
+
*/
|
|
64
|
+
export var getPresetLabel = function getPresetLabel(currentShortcut, presets) {
|
|
65
|
+
var _ref, _ref$label;
|
|
66
|
+
var label = presetDetailMap === null || presetDetailMap === void 0 ? void 0 : (_ref = presetDetailMap[currentShortcut]) === null || _ref === void 0 ? void 0 : (_ref$label = _ref.label) === null || _ref$label === void 0 ? void 0 : _ref$label.call(_ref);
|
|
67
|
+
if (label) {
|
|
68
|
+
return label;
|
|
69
|
+
}
|
|
70
|
+
var detail = presets.find(function (item) {
|
|
71
|
+
return item.label === currentShortcut || item.value === currentShortcut;
|
|
72
|
+
});
|
|
73
|
+
return detail === null || detail === void 0 ? void 0 : detail.label;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 获取预设的value
|
|
78
|
+
* @param value
|
|
79
|
+
* @param preset
|
|
80
|
+
*/
|
|
81
|
+
export var getShortcutValue = function getShortcutValue(value, preset) {
|
|
82
|
+
var _preset$find;
|
|
83
|
+
return (_preset$find = preset.find(function (item) {
|
|
84
|
+
return item.value === value || item.label === value;
|
|
85
|
+
})) === null || _preset$find === void 0 ? void 0 : _preset$find.getValue();
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 通过快捷字符串获取对应的value值
|
|
90
|
+
* @param value
|
|
91
|
+
* @param preset
|
|
92
|
+
*/
|
|
93
|
+
export var getDatePickerValueByShortcut = function getDatePickerValueByShortcut(value, preset) {
|
|
94
|
+
var p = formatPresets(preset);
|
|
95
|
+
return getShortcutValue(value, p);
|
|
13
96
|
};
|
package/lib/ActionBar/index.js
CHANGED
|
@@ -73,6 +73,15 @@ var ActionBar = (props) => {
|
|
|
73
73
|
onChange(newValue, "time");
|
|
74
74
|
};
|
|
75
75
|
const spaceStyle = (0, import_react.useMemo)(() => {
|
|
76
|
+
return (0, import_utils.isMobile)() ? {
|
|
77
|
+
display: "flex",
|
|
78
|
+
justifyContent: "end",
|
|
79
|
+
gap: 16
|
|
80
|
+
} : {
|
|
81
|
+
display: "flex"
|
|
82
|
+
};
|
|
83
|
+
}, []);
|
|
84
|
+
const buttonStyle = (0, import_react.useMemo)(() => {
|
|
76
85
|
return (0, import_utils.isMobile)() ? {
|
|
77
86
|
display: "flex",
|
|
78
87
|
justifyContent: "end",
|
|
@@ -93,37 +102,33 @@ var ActionBar = (props) => {
|
|
|
93
102
|
}
|
|
94
103
|
return {};
|
|
95
104
|
}, [showTime]);
|
|
96
|
-
return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(props.className, "date-picker-action-bar") },
|
|
105
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(props.className, "date-picker-action-bar") }, /* @__PURE__ */ import_react.default.createElement(
|
|
97
106
|
"div",
|
|
98
107
|
{
|
|
99
108
|
className: "date-picker-action-bar-right",
|
|
100
|
-
style:
|
|
109
|
+
style: { ...spaceStyle, margin: 0 }
|
|
101
110
|
},
|
|
102
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
103
|
-
import_antd.
|
|
111
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
112
|
+
import_antd.Button,
|
|
104
113
|
{
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
), /* @__PURE__ */ import_react.default.createElement(
|
|
116
|
-
import_antd.TimePicker,
|
|
114
|
+
block: (0, import_utils.isMobile)(),
|
|
115
|
+
size: "large",
|
|
116
|
+
...cancelButtonProps || {},
|
|
117
|
+
onClick: onCancel
|
|
118
|
+
},
|
|
119
|
+
(0, import_locales.getText)("action-bar-cancel", import_locales.pLocaleMap[locale])
|
|
120
|
+
),
|
|
121
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
122
|
+
import_antd.Button,
|
|
117
123
|
{
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
)
|
|
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])))
|
|
124
|
+
type: "primary",
|
|
125
|
+
size: "large",
|
|
126
|
+
block: (0, import_utils.isMobile)(),
|
|
127
|
+
...okButtonProps || {},
|
|
128
|
+
onClick: onOk
|
|
129
|
+
},
|
|
130
|
+
(0, import_locales.getText)("action-bar-apply", import_locales.pLocaleMap[locale])
|
|
131
|
+
)
|
|
127
132
|
));
|
|
128
133
|
};
|
|
129
134
|
var ActionBar_default = ActionBar;
|
package/lib/ActionBar/index.less
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
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/CustomCalendarHeader/index.tsx
|
|
30
|
+
var CustomCalendarHeader_exports = {};
|
|
31
|
+
__export(CustomCalendarHeader_exports, {
|
|
32
|
+
default: () => CustomCalendarHeader_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(CustomCalendarHeader_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_Stack = __toESM(require("@mui/material/Stack"));
|
|
37
|
+
var import_IconButton = __toESM(require("@mui/material/IconButton"));
|
|
38
|
+
var import_Typography = __toESM(require("@mui/material/Typography"));
|
|
39
|
+
var import_styles = require("@mui/material/styles");
|
|
40
|
+
var import_ChevronLeft = __toESM(require("../icon/ChevronLeft"));
|
|
41
|
+
var import_ChevronLeftDouble = __toESM(require("../icon/ChevronLeftDouble"));
|
|
42
|
+
var import_ChevronRight = __toESM(require("../icon/ChevronRight"));
|
|
43
|
+
var import_ChevronRightDouble = __toESM(require("../icon/ChevronRightDouble"));
|
|
44
|
+
var CustomCalendarHeaderRoot = (0, import_styles.styled)("div")({
|
|
45
|
+
display: "flex",
|
|
46
|
+
justifyContent: "space-between",
|
|
47
|
+
padding: "8px 16px",
|
|
48
|
+
alignItems: "center"
|
|
49
|
+
});
|
|
50
|
+
var CustomCalendarHeader = (props) => {
|
|
51
|
+
const { currentMonth, onMonthChange } = props;
|
|
52
|
+
const selectNextMonth = () => onMonthChange(currentMonth.add(1, "month"), "left");
|
|
53
|
+
const selectNextYear = () => onMonthChange(currentMonth.add(1, "year"), "left");
|
|
54
|
+
const selectPreviousMonth = () => onMonthChange(currentMonth.subtract(1, "month"), "right");
|
|
55
|
+
const selectPreviousYear = () => onMonthChange(currentMonth.subtract(1, "year"), "right");
|
|
56
|
+
return /* @__PURE__ */ import_react.default.createElement(CustomCalendarHeaderRoot, null, /* @__PURE__ */ import_react.default.createElement(import_Stack.default, { spacing: 1, direction: "row" }, /* @__PURE__ */ import_react.default.createElement(import_IconButton.default, { onClick: selectPreviousYear, title: "Previous year" }, /* @__PURE__ */ import_react.default.createElement(import_ChevronLeftDouble.default, null)), /* @__PURE__ */ import_react.default.createElement(import_IconButton.default, { onClick: selectPreviousMonth, title: "Previous month" }, /* @__PURE__ */ import_react.default.createElement(import_ChevronLeft.default, null))), /* @__PURE__ */ import_react.default.createElement(import_Typography.default, { variant: "body2" }, currentMonth.format("MMMM YYYY")), /* @__PURE__ */ import_react.default.createElement(import_Stack.default, { spacing: 1, direction: "row" }, /* @__PURE__ */ import_react.default.createElement(import_IconButton.default, { onClick: selectNextMonth, title: "Next month" }, /* @__PURE__ */ import_react.default.createElement(import_ChevronRight.default, null)), /* @__PURE__ */ import_react.default.createElement(import_IconButton.default, { onClick: selectNextYear, title: "Next year" }, /* @__PURE__ */ import_react.default.createElement(import_ChevronRightDouble.default, null))));
|
|
57
|
+
};
|
|
58
|
+
var CustomCalendarHeader_default = CustomCalendarHeader;
|
|
@@ -0,0 +1,52 @@
|
|
|
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/Dialog/index.tsx
|
|
30
|
+
var Dialog_exports = {};
|
|
31
|
+
__export(Dialog_exports, {
|
|
32
|
+
default: () => Dialog_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Dialog_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_Drawer = __toESM(require("@mui/material/Drawer"));
|
|
37
|
+
var Dialog = (props) => {
|
|
38
|
+
const { open, onClose, children } = props;
|
|
39
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
40
|
+
import_Drawer.default,
|
|
41
|
+
{
|
|
42
|
+
anchor: "bottom",
|
|
43
|
+
open,
|
|
44
|
+
onClose,
|
|
45
|
+
height: 650,
|
|
46
|
+
autoFocus: true,
|
|
47
|
+
className: window.innerWidth > 800 ? "date-picker-paid-drawer" : "date-picker-custom-drawer"
|
|
48
|
+
},
|
|
49
|
+
children
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
var Dialog_default = Dialog;
|
|
@@ -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;
|