@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,60 @@
|
|
|
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/icon/ChevronRightDouble.tsx
|
|
30
|
+
var ChevronRightDouble_exports = {};
|
|
31
|
+
__export(ChevronRightDouble_exports, {
|
|
32
|
+
default: () => ChevronRightDouble_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(ChevronRightDouble_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var ChevronRightDouble = (props) => {
|
|
37
|
+
const { className, onClick } = props;
|
|
38
|
+
return /* @__PURE__ */ import_react.default.createElement("span", { className, onClick }, /* @__PURE__ */ import_react.default.createElement(
|
|
39
|
+
"svg",
|
|
40
|
+
{
|
|
41
|
+
className: "icon",
|
|
42
|
+
viewBox: "0 0 1024 1024",
|
|
43
|
+
version: "1.1",
|
|
44
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
45
|
+
"p-id": "35105",
|
|
46
|
+
width: "1em",
|
|
47
|
+
height: "1em"
|
|
48
|
+
},
|
|
49
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
50
|
+
"path",
|
|
51
|
+
{
|
|
52
|
+
"fill-rule": "evenodd",
|
|
53
|
+
"clip-rule": "evenodd",
|
|
54
|
+
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",
|
|
55
|
+
fill: "currentColor"
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
));
|
|
59
|
+
};
|
|
60
|
+
var ChevronRightDouble_default = ChevronRightDouble;
|
|
@@ -26,7 +26,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
));
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
28
|
|
|
29
|
-
// src/
|
|
29
|
+
// src/icon/CloseCircle.tsx
|
|
30
30
|
var CloseCircle_exports = {};
|
|
31
31
|
__export(CloseCircle_exports, {
|
|
32
32
|
default: () => CloseCircle_default
|
package/lib/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/lib/index.js
CHANGED
|
@@ -32,7 +32,11 @@ var src_exports = {};
|
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
LocaleContext: () => import_LocaleContext.LocaleContext,
|
|
34
34
|
LocaleProvider: () => import_LocaleContext.LocaleProvider,
|
|
35
|
-
RangePicker: () => import_PisellDateRangePicker.default
|
|
35
|
+
RangePicker: () => import_PisellDateRangePicker.default,
|
|
36
|
+
formatPresets: () => import_utils.formatPresets,
|
|
37
|
+
getDatePickerValueByShortcut: () => import_utils.getDatePickerValueByShortcut,
|
|
38
|
+
getPresetLabel: () => import_utils.getPresetLabel,
|
|
39
|
+
getShortcutValue: () => import_utils.getShortcutValue
|
|
36
40
|
});
|
|
37
41
|
module.exports = __toCommonJS(src_exports);
|
|
38
42
|
var import_PisellDateRangePicker = __toESM(require("./PisellDateRangePicker"));
|
|
@@ -51,12 +55,17 @@ __reExport(src_exports, require("./DesktopDateRangePicker"), module.exports);
|
|
|
51
55
|
__reExport(src_exports, require("./MobileDateRangePicker"), module.exports);
|
|
52
56
|
__reExport(src_exports, require("./StaticDateRangePicker"), module.exports);
|
|
53
57
|
__reExport(src_exports, require("./dateRangeViewRenderers"), module.exports);
|
|
58
|
+
var import_utils = require("./utils/index");
|
|
54
59
|
__reExport(src_exports, require("./models"), module.exports);
|
|
55
60
|
// Annotate the CommonJS export names for ESM import in node:
|
|
56
61
|
0 && (module.exports = {
|
|
57
62
|
LocaleContext,
|
|
58
63
|
LocaleProvider,
|
|
59
64
|
RangePicker,
|
|
65
|
+
formatPresets,
|
|
66
|
+
getDatePickerValueByShortcut,
|
|
67
|
+
getPresetLabel,
|
|
68
|
+
getShortcutValue,
|
|
60
69
|
...require("@mui/x-date-pickers"),
|
|
61
70
|
...require("@mui/material/styles"),
|
|
62
71
|
...require("./DateRangePickerDay"),
|
package/lib/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/lib/locales/en-US.js
CHANGED
|
@@ -26,5 +26,22 @@ var en_US_default = {
|
|
|
26
26
|
"action-bar-cancel": "Cancel",
|
|
27
27
|
"action-bar-apply": "Apply",
|
|
28
28
|
"action-bar-start.time": "Start time",
|
|
29
|
-
"action-bar-end.time": "End time"
|
|
29
|
+
"action-bar-end.time": "End time",
|
|
30
|
+
"toolbar-date-range-shortcut-custom": "Custom",
|
|
31
|
+
"toolbar-date-range-shortcut-date-range": "Date range",
|
|
32
|
+
"toolbar-date-range-shortcut-starting": "Starting",
|
|
33
|
+
"toolbar-date-range-shortcut-ending": "Ending",
|
|
34
|
+
"toolbar-date-range-shortcut-today": "Today",
|
|
35
|
+
"toolbar-date-range-shortcut-yesterday": "Yesterday",
|
|
36
|
+
"toolbar-date-range-shortcut-tomorrow": "Tomorrow",
|
|
37
|
+
"toolbar-date-range-shortcut-last-3-days": "Last 3 days",
|
|
38
|
+
"toolbar-date-range-shortcut-last-7-days": "Last 7 days",
|
|
39
|
+
"toolbar-date-range-shortcut-last-30-days": "Last 30 days",
|
|
40
|
+
"toolbar-date-range-shortcut-last-90-days": "Last 90 days",
|
|
41
|
+
"toolbar-date-range-shortcut-last-180-days": "Last 180 days",
|
|
42
|
+
"toolbar-date-range-shortcut-next-3-days": "Next 3 days",
|
|
43
|
+
"toolbar-date-range-shortcut-next-7-days": "Next 7 days",
|
|
44
|
+
"toolbar-date-range-shortcut-next-30-days": "Next 30 days",
|
|
45
|
+
"toolbar-date-range-shortcut-next-90-days": "Next 90 days",
|
|
46
|
+
"toolbar-date-range-shortcut-next-180-days": "Next 180 days"
|
|
30
47
|
};
|
package/lib/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/lib/locales/zh-CN.js
CHANGED
|
@@ -26,5 +26,22 @@ var zh_CN_default = {
|
|
|
26
26
|
"action-bar-cancel": "取消",
|
|
27
27
|
"action-bar-apply": "确定",
|
|
28
28
|
"action-bar-start.time": "开始时间",
|
|
29
|
-
"action-bar-end.time": "结束时间"
|
|
29
|
+
"action-bar-end.time": "结束时间",
|
|
30
|
+
"toolbar-date-range-shortcut-date-range": "日期范围",
|
|
31
|
+
"toolbar-date-range-shortcut-starting": "开始",
|
|
32
|
+
"toolbar-date-range-shortcut-ending": "结束",
|
|
33
|
+
"toolbar-date-range-shortcut-custom": "自定义",
|
|
34
|
+
"toolbar-date-range-shortcut-today": "今天",
|
|
35
|
+
"toolbar-date-range-shortcut-yesterday": "昨天",
|
|
36
|
+
"toolbar-date-range-shortcut-tomorrow": "明天",
|
|
37
|
+
"toolbar-date-range-shortcut-last-3-days": "过去3天",
|
|
38
|
+
"toolbar-date-range-shortcut-last-7-days": "过去7天",
|
|
39
|
+
"toolbar-date-range-shortcut-last-30-days": "过去30天",
|
|
40
|
+
"toolbar-date-range-shortcut-last-90-days": "过去90天",
|
|
41
|
+
"toolbar-date-range-shortcut-last-180-days": "过去180天",
|
|
42
|
+
"toolbar-date-range-shortcut-next-3-days": "未来3天",
|
|
43
|
+
"toolbar-date-range-shortcut-next-7-days": "未来7天",
|
|
44
|
+
"toolbar-date-range-shortcut-next-30-days": "未来30天",
|
|
45
|
+
"toolbar-date-range-shortcut-next-90-days": "未来90天",
|
|
46
|
+
"toolbar-date-range-shortcut-next-180-days": "未来180天"
|
|
30
47
|
};
|
package/lib/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/lib/locales/zh-TW.js
CHANGED
|
@@ -26,5 +26,22 @@ var zh_TW_default = {
|
|
|
26
26
|
"action-bar-cancel": "取消",
|
|
27
27
|
"action-bar-apply": "確定",
|
|
28
28
|
"action-bar-start.time": "開始時間",
|
|
29
|
-
"action-bar-end.time": "結束時間"
|
|
29
|
+
"action-bar-end.time": "結束時間",
|
|
30
|
+
"toolbar-date-range-shortcut-custom": "自定義",
|
|
31
|
+
"toolbar-date-range-shortcut-date-range": "日期範圍",
|
|
32
|
+
"toolbar-date-range-shortcut-starting": "開始",
|
|
33
|
+
"toolbar-date-range-shortcut-ending": "結束",
|
|
34
|
+
"toolbar-date-range-shortcut-today": "今天",
|
|
35
|
+
"toolbar-date-range-shortcut-yesterday": "昨天",
|
|
36
|
+
"toolbar-date-range-shortcut-tomorrow": "明天",
|
|
37
|
+
"toolbar-date-range-shortcut-last-3-days": "過去3天",
|
|
38
|
+
"toolbar-date-range-shortcut-last-7-days": "過去7天",
|
|
39
|
+
"toolbar-date-range-shortcut-last-30-days": "過去30天",
|
|
40
|
+
"toolbar-date-range-shortcut-last-90-days": "過去90天",
|
|
41
|
+
"toolbar-date-range-shortcut-last-180-days": "過去180天",
|
|
42
|
+
"toolbar-date-range-shortcut-next-3-days": "未來3天",
|
|
43
|
+
"toolbar-date-range-shortcut-next-7-days": "未來7天",
|
|
44
|
+
"toolbar-date-range-shortcut-next-30-days": "未來30天",
|
|
45
|
+
"toolbar-date-range-shortcut-next-90-days": "未來90天",
|
|
46
|
+
"toolbar-date-range-shortcut-next-180-days": "未來180天"
|
|
30
47
|
};
|
package/lib/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/lib/utils/index.js
CHANGED
|
@@ -19,12 +19,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// src/utils/index.ts
|
|
20
20
|
var utils_exports = {};
|
|
21
21
|
__export(utils_exports, {
|
|
22
|
+
formatPresets: () => formatPresets,
|
|
22
23
|
getCurrentLocale: () => getCurrentLocale,
|
|
24
|
+
getDatePickerValueByShortcut: () => getDatePickerValueByShortcut,
|
|
25
|
+
getPresetLabel: () => getPresetLabel,
|
|
26
|
+
getShortcutValue: () => getShortcutValue,
|
|
23
27
|
isBrowser: () => isBrowser,
|
|
24
28
|
isMobile: () => isMobile
|
|
25
29
|
});
|
|
26
30
|
module.exports = __toCommonJS(utils_exports);
|
|
27
31
|
var import_utils = require("@pisell/utils");
|
|
32
|
+
var import_constants = require("../constants");
|
|
28
33
|
var getCurrentLocale = () => {
|
|
29
34
|
let locale = localStorage.getItem("umi_locale") || "en-US";
|
|
30
35
|
return locale;
|
|
@@ -36,9 +41,62 @@ var isMobile = () => {
|
|
|
36
41
|
}
|
|
37
42
|
return (0, import_utils.isMobile)();
|
|
38
43
|
};
|
|
44
|
+
var formatPresets = (presets) => {
|
|
45
|
+
return presets.map((item) => {
|
|
46
|
+
var _a, _b, _c;
|
|
47
|
+
if ((0, import_utils.isString)(item.value)) {
|
|
48
|
+
let getValue2;
|
|
49
|
+
if ((0, import_utils.isFunction)(item.getValue)) {
|
|
50
|
+
getValue2 = item.getValue;
|
|
51
|
+
} else if (import_constants.presetValueArr.includes(item.value)) {
|
|
52
|
+
getValue2 = import_constants.presetDetailMap[item.value].getValue;
|
|
53
|
+
} else {
|
|
54
|
+
getValue2 = () => item.value;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
...item,
|
|
58
|
+
label: item.label || ((_c = (_b = (_a = import_constants.presetDetailMap) == null ? void 0 : _a[item.value]) == null ? void 0 : _b.label) == null ? void 0 : _c.call(_b)),
|
|
59
|
+
getValue: getValue2
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const getValue = () => {
|
|
63
|
+
if ((0, import_utils.isFunction)(item.getValue)) {
|
|
64
|
+
return item.getValue();
|
|
65
|
+
}
|
|
66
|
+
return item == null ? void 0 : item.value;
|
|
67
|
+
};
|
|
68
|
+
return {
|
|
69
|
+
label: item.label,
|
|
70
|
+
getValue
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
var getPresetLabel = (currentShortcut, presets) => {
|
|
75
|
+
var _a, _b, _c;
|
|
76
|
+
const label = (_c = (_b = (_a = import_constants.presetDetailMap) == null ? void 0 : _a[currentShortcut]) == null ? void 0 : _b.label) == null ? void 0 : _c.call(_b);
|
|
77
|
+
if (label) {
|
|
78
|
+
return label;
|
|
79
|
+
}
|
|
80
|
+
const detail = presets.find(
|
|
81
|
+
(item) => item.label === currentShortcut || item.value === currentShortcut
|
|
82
|
+
);
|
|
83
|
+
return detail == null ? void 0 : detail.label;
|
|
84
|
+
};
|
|
85
|
+
var getShortcutValue = (value, preset) => {
|
|
86
|
+
var _a;
|
|
87
|
+
return (_a = preset.find((item) => item.value === value || item.label === value)) == null ? void 0 : _a.getValue();
|
|
88
|
+
};
|
|
89
|
+
var getDatePickerValueByShortcut = (value, preset) => {
|
|
90
|
+
const p = formatPresets(preset);
|
|
91
|
+
return getShortcutValue(value, p);
|
|
92
|
+
};
|
|
39
93
|
// Annotate the CommonJS export names for ESM import in node:
|
|
40
94
|
0 && (module.exports = {
|
|
95
|
+
formatPresets,
|
|
41
96
|
getCurrentLocale,
|
|
97
|
+
getDatePickerValueByShortcut,
|
|
98
|
+
getPresetLabel,
|
|
99
|
+
getShortcutValue,
|
|
42
100
|
isBrowser,
|
|
43
101
|
isMobile
|
|
44
102
|
});
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|