@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.
Files changed (101) hide show
  1. package/es/ActionBar/index.js +19 -28
  2. package/es/ActionBar/index.less +2 -1
  3. package/es/CustomCalendarHeader/index.d.ts +2 -0
  4. package/es/CustomCalendarHeader/index.js +53 -0
  5. package/es/Dialog/index.d.ts +2 -0
  6. package/es/Dialog/index.js +22 -0
  7. package/es/Drawer/index.d.ts +11 -0
  8. package/es/Drawer/index.js +35 -0
  9. package/es/Drawer/index.less +40 -0
  10. package/es/PisellDateRangePicker/LocaleContext.d.ts +2 -0
  11. package/es/PisellDateRangePicker/index.d.ts +81 -0
  12. package/es/PisellDateRangePicker/index.js +112 -41
  13. package/es/PisellDateRangePicker/index.less +56 -0
  14. package/es/Shortcuts/index.d.ts +4 -3
  15. package/es/Toolbar/index.d.ts +3 -0
  16. package/es/Toolbar/index.js +122 -0
  17. package/es/Toolbar/index.less +32 -0
  18. package/es/browserSelect/chevron-down.png +0 -0
  19. package/es/browserSelect/index.d.ts +15 -0
  20. package/es/browserSelect/index.js +36 -0
  21. package/es/browserSelect/index.less +18 -0
  22. package/es/constants.d.ts +58 -0
  23. package/es/constants.js +128 -0
  24. package/es/hooks/useDocumentVisibility.d.ts +2 -0
  25. package/es/hooks/useDocumentVisibility.js +27 -0
  26. package/es/hooks/useNextDay.d.ts +2 -0
  27. package/es/hooks/useNextDay.js +15 -0
  28. package/es/hooks/useUpdateEffect.d.ts +2 -0
  29. package/es/hooks/useUpdateEffect.js +11 -0
  30. package/es/icon/ChevronLeft.d.ts +5 -0
  31. package/es/icon/ChevronLeft.js +23 -0
  32. package/es/icon/ChevronLeftDouble.d.ts +5 -0
  33. package/es/icon/ChevronLeftDouble.js +23 -0
  34. package/es/icon/ChevronRight.d.ts +5 -0
  35. package/es/icon/ChevronRight.js +23 -0
  36. package/es/icon/ChevronRightDouble.d.ts +5 -0
  37. package/es/icon/ChevronRightDouble.js +23 -0
  38. package/es/index.d.ts +23 -0
  39. package/es/index.js +1 -0
  40. package/es/locales/en-US.d.ts +17 -0
  41. package/es/locales/en-US.js +18 -1
  42. package/es/locales/index.d.ts +2 -0
  43. package/es/locales/zh-CN.d.ts +21 -4
  44. package/es/locales/zh-CN.js +21 -4
  45. package/es/locales/zh-TW.d.ts +17 -0
  46. package/es/locales/zh-TW.js +18 -1
  47. package/es/utils/index.d.ts +32 -0
  48. package/es/utils/index.js +86 -3
  49. package/lib/ActionBar/index.js +30 -25
  50. package/lib/ActionBar/index.less +2 -1
  51. package/lib/CustomCalendarHeader/index.d.ts +2 -0
  52. package/lib/CustomCalendarHeader/index.js +58 -0
  53. package/lib/Dialog/index.d.ts +2 -0
  54. package/lib/Dialog/index.js +52 -0
  55. package/lib/Drawer/index.d.ts +11 -0
  56. package/lib/Drawer/index.js +62 -0
  57. package/lib/Drawer/index.less +40 -0
  58. package/lib/PisellDateRangePicker/LocaleContext.d.ts +2 -0
  59. package/lib/PisellDateRangePicker/index.d.ts +81 -0
  60. package/lib/PisellDateRangePicker/index.js +89 -33
  61. package/lib/PisellDateRangePicker/index.less +56 -0
  62. package/lib/Shortcuts/index.d.ts +4 -3
  63. package/lib/Toolbar/index.d.ts +3 -0
  64. package/lib/Toolbar/index.js +139 -0
  65. package/lib/Toolbar/index.less +32 -0
  66. package/lib/browserSelect/chevron-down.png +0 -0
  67. package/lib/browserSelect/index.d.ts +15 -0
  68. package/lib/browserSelect/index.js +59 -0
  69. package/lib/browserSelect/index.less +18 -0
  70. package/lib/constants.d.ts +58 -0
  71. package/lib/constants.js +178 -0
  72. package/lib/hooks/useDocumentVisibility.d.ts +2 -0
  73. package/lib/hooks/useDocumentVisibility.js +40 -0
  74. package/lib/hooks/useNextDay.d.ts +2 -0
  75. package/lib/hooks/useNextDay.js +49 -0
  76. package/lib/hooks/useUpdateEffect.d.ts +2 -0
  77. package/lib/hooks/useUpdateEffect.js +35 -0
  78. package/lib/icon/ChevronLeft.d.ts +5 -0
  79. package/lib/icon/ChevronLeft.js +60 -0
  80. package/lib/icon/ChevronLeftDouble.d.ts +5 -0
  81. package/lib/icon/ChevronLeftDouble.js +60 -0
  82. package/lib/icon/ChevronRight.d.ts +5 -0
  83. package/lib/icon/ChevronRight.js +60 -0
  84. package/lib/icon/ChevronRightDouble.d.ts +5 -0
  85. package/lib/icon/ChevronRightDouble.js +60 -0
  86. package/lib/{PisellDateRangePicker → icon}/CloseCircle.js +1 -1
  87. package/lib/index.d.ts +23 -0
  88. package/lib/index.js +10 -1
  89. package/lib/locales/en-US.d.ts +17 -0
  90. package/lib/locales/en-US.js +18 -1
  91. package/lib/locales/index.d.ts +2 -0
  92. package/lib/locales/zh-CN.d.ts +21 -4
  93. package/lib/locales/zh-CN.js +18 -1
  94. package/lib/locales/zh-TW.d.ts +17 -0
  95. package/lib/locales/zh-TW.js +18 -1
  96. package/lib/utils/index.d.ts +32 -0
  97. package/lib/utils/index.js +58 -0
  98. package/package.json +1 -1
  99. /package/es/{PisellDateRangePicker → icon}/CloseCircle.d.ts +0 -0
  100. /package/es/{PisellDateRangePicker → icon}/CloseCircle.js +0 -0
  101. /package/lib/{PisellDateRangePicker → icon}/CloseCircle.d.ts +0 -0
@@ -5,6 +5,7 @@
5
5
  //.MuiInputBase-input {
6
6
  // padding: 10px;
7
7
  //}
8
+
8
9
  label {
9
10
  font-size: 14px;
10
11
  }
@@ -42,11 +43,13 @@
42
43
  .MuiPickersPopper-root {
43
44
  .MuiPickersLayout-root {
44
45
  width: var(--pisell-date-range-picker-popup-width, 625px);
46
+ display: block;
45
47
  .MuiDateRangeCalendar-root {
46
48
  width: 100%;
47
49
  flex: 1;
48
50
  .MuiDateRangeCalendar-monthContainer {
49
51
  width: 50%;
52
+ border: none;
50
53
  .MuiDayCalendar-header {
51
54
  padding: 0 20px;
52
55
  .MuiDayCalendar-weekDayLabel {
@@ -95,3 +98,56 @@
95
98
  grid-column: 1 !important;
96
99
  grid-row: 1/3 !important;
97
100
  }
101
+
102
+ .date-picker-paid-drawer {
103
+ .MuiPickersLayout-root {
104
+ display: block;
105
+ }
106
+ }
107
+
108
+ .date-picker-custom-drawer {
109
+ .MuiPickersCalendarHeader-root {
110
+ padding-left: 35px;
111
+ padding-right: 22px;
112
+ }
113
+ .MuiPickersLayout-root {
114
+ display: block;
115
+ }
116
+ .MuiPickersLayout-toolbar {
117
+ display: none;
118
+ }
119
+ .MuiDayCalendar-header {
120
+ padding: 0 20px;
121
+ .MuiDayCalendar-weekDayLabel {
122
+ flex: 1;
123
+ max-width: 46px;
124
+ }
125
+ }
126
+ .MuiDayCalendar-slideTransition {
127
+ height: 315px;
128
+ .MuiDayCalendar-monthContainer {
129
+ padding: 0 20px;
130
+ }
131
+ }
132
+ .MuiDateRangeCalendar-monthContainer {
133
+ width: 100%;
134
+ .MuiDateRangePickerDay-root {
135
+ flex: 1;
136
+ max-width: 50px;
137
+ max-height: 50px;
138
+ .MuiDateRangePickerDay-day {
139
+ width: 100%;
140
+ height: auto;
141
+ &::before {
142
+ content: "";
143
+ display: block;
144
+ padding-top: 100%;
145
+ }
146
+ }
147
+ }
148
+ }
149
+ .MuiDrawer-paperAnchorBottom {
150
+ border-top-left-radius: 8px;
151
+ border-top-right-radius: 8px;
152
+ }
153
+ }
@@ -1,9 +1,10 @@
1
1
  import "./index.less";
2
2
  import { Dayjs } from "dayjs";
3
3
  export declare type PresetType = {
4
- label: string;
5
- getValue: () => [Dayjs, Dayjs];
6
- value: [Dayjs, Dayjs];
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;
7
8
  };
8
9
  interface ShortcutsProps {
9
10
  items: PresetType[];
@@ -0,0 +1,3 @@
1
+ import "./index.less";
2
+ declare const Toolbar: (props: any) => JSX.Element;
3
+ export default Toolbar;
@@ -0,0 +1,122 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
4
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
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
+ 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
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import React, { useMemo, useState, useEffect } from "react";
12
+ import { Input } from "antd";
13
+ import dayjs from "dayjs";
14
+ import BrowserSelect from "../browserSelect";
15
+ import { getText } from "../locales";
16
+ import "./index.less";
17
+ var isValidDate = function isValidDate(dateString, format) {
18
+ var date = dayjs(dateString, format, true);
19
+ return date.isValid();
20
+ };
21
+ var Toolbar = function Toolbar(props) {
22
+ var presetItems = props.presetItems,
23
+ _props$value = props.value,
24
+ value = _props$value === void 0 ? [] : _props$value,
25
+ locale = props.locale,
26
+ onChange = props.onChange,
27
+ currentShortcut = props.currentShortcut,
28
+ setCurrentShortcut = props.setCurrentShortcut;
29
+ var format = locale === "en" || locale === "en-US" ? "DD/MM/YYYY" : "YYYY/MM/DD";
30
+ var _useState = useState(""),
31
+ _useState2 = _slicedToArray(_useState, 2),
32
+ startStr = _useState2[0],
33
+ setStartStr = _useState2[1];
34
+ var _useState3 = useState(""),
35
+ _useState4 = _slicedToArray(_useState3, 2),
36
+ endStr = _useState4[0],
37
+ setEndStr = _useState4[1];
38
+ useEffect(function () {
39
+ if (value !== null && value !== void 0 && value[0]) {
40
+ setStartStr(value[0].format(format));
41
+ } else {
42
+ setStartStr("");
43
+ }
44
+ if (value !== null && value !== void 0 && value[1]) {
45
+ setEndStr(value[1].format(format));
46
+ } else {
47
+ setEndStr("");
48
+ }
49
+ }, [value]);
50
+ var handleStartChange = function handleStartChange(e) {
51
+ var val = e.target.value;
52
+ setStartStr(val);
53
+ if (isValidDate(val, format)) {
54
+ var _start$set, _start$set$set;
55
+ var valDate = dayjs(val, format);
56
+ var newValue = _toConsumableArray(value);
57
+ var start = newValue[0] || dayjs();
58
+ newValue[0] = (start === null || start === void 0 ? void 0 : (_start$set = start.set("year", (valDate === null || valDate === void 0 ? void 0 : valDate.get("year")) || 0)) === null || _start$set === void 0 ? void 0 : (_start$set$set = _start$set.set("month", (valDate === null || valDate === void 0 ? void 0 : valDate.get("month")) || 0)) === null || _start$set$set === void 0 ? void 0 : _start$set$set.set("date", (valDate === null || valDate === void 0 ? void 0 : valDate.get("date")) || 0)) || null;
59
+ onChange(newValue);
60
+ }
61
+ };
62
+ var handleEndChange = function handleEndChange(e) {
63
+ var val = e.target.value;
64
+ setEndStr(val);
65
+ if (isValidDate(val, format)) {
66
+ var _end$set, _end$set$set;
67
+ var valDate = dayjs(val, format);
68
+ var newValue = _toConsumableArray(value);
69
+ var end = newValue[1] || dayjs();
70
+ newValue[1] = (end === null || end === void 0 ? void 0 : (_end$set = end.set("year", (valDate === null || valDate === void 0 ? void 0 : valDate.get("year")) || 0)) === null || _end$set === void 0 ? void 0 : (_end$set$set = _end$set.set("month", (valDate === null || valDate === void 0 ? void 0 : valDate.get("month")) || 0)) === null || _end$set$set === void 0 ? void 0 : _end$set$set.set("date", (valDate === null || valDate === void 0 ? void 0 : valDate.get("date")) || 0)) || null;
71
+ onChange(newValue);
72
+ }
73
+ };
74
+ var handleSelectChange = function handleSelectChange(e) {
75
+ var val = e.target.value;
76
+ var detail = presetItems.find(function (item) {
77
+ return item.value === val || item.label === val;
78
+ });
79
+ if (!detail) return;
80
+ var dateVal = detail.getValue();
81
+ onChange(dateVal, 'shortcuts', val);
82
+ };
83
+ var customPresetItems = useMemo(function () {
84
+ if (!currentShortcut) {
85
+ return presetItems.concat([{
86
+ label: getText("toolbar-date-range-shortcut-custom"),
87
+ value: getText("toolbar-date-range-shortcut-custom")
88
+ }]);
89
+ }
90
+ return presetItems;
91
+ }, [presetItems]);
92
+ return /*#__PURE__*/React.createElement("div", {
93
+ className: "date-picker-toolbar"
94
+ }, /*#__PURE__*/React.createElement("div", {
95
+ className: "date-picker-content-top"
96
+ }, /*#__PURE__*/React.createElement("span", null, getText("toolbar-date-range-shortcut-date-range")), /*#__PURE__*/React.createElement(BrowserSelect
97
+ // @ts-ignore
98
+ , {
99
+ value: currentShortcut || getText("toolbar-date-range-shortcut-custom"),
100
+ className: "date-picker-toolbar-select",
101
+ options: customPresetItems,
102
+ size: "large",
103
+ onChange: handleSelectChange
104
+ })), /*#__PURE__*/React.createElement("div", {
105
+ className: "date-picker-content-bottom"
106
+ }, /*#__PURE__*/React.createElement("div", {
107
+ className: "date-picker-toolbar-start-wrap"
108
+ }, /*#__PURE__*/React.createElement("span", null, getText("toolbar-date-range-shortcut-starting")), /*#__PURE__*/React.createElement(Input, {
109
+ size: "large",
110
+ value: startStr,
111
+ onChange: handleStartChange,
112
+ placeholder: dayjs().format(format)
113
+ })), /*#__PURE__*/React.createElement("div", {
114
+ className: "date-picker-toolbar-end-wrap"
115
+ }, /*#__PURE__*/React.createElement("span", null, getText("toolbar-date-range-shortcut-ending")), /*#__PURE__*/React.createElement(Input, {
116
+ size: "large",
117
+ value: endStr,
118
+ onChange: handleEndChange,
119
+ placeholder: dayjs().format(format)
120
+ }))));
121
+ };
122
+ export default Toolbar;
@@ -0,0 +1,32 @@
1
+ .date-picker-toolbar {
2
+ padding: 20px 20px 0;
3
+ color: var(--Gray-700, #344054);
4
+ font-size: 14px;
5
+ font-style: normal;
6
+ font-weight: 600;
7
+ line-height: 20px; /* 142.857% */
8
+ display: flex;
9
+ flex-direction: column;
10
+ gap: 12px;
11
+ .date-picker-content-top {
12
+ display: flex;
13
+ flex-direction: column;
14
+ gap: 8px;
15
+ }
16
+ .date-picker-content-bottom {
17
+ display: flex;
18
+ gap: 16px;
19
+ }
20
+ .date-picker-toolbar-start-wrap {
21
+ display: flex;
22
+ flex-direction: column;
23
+ gap: 8px;
24
+ flex: 1;
25
+ }
26
+ .date-picker-toolbar-end-wrap {
27
+ display: flex;
28
+ flex-direction: column;
29
+ gap: 8px;
30
+ flex: 1;
31
+ }
32
+ }
@@ -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,36 @@
1
+ var _excluded = ["options"];
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
+ import React, { useMemo } from "react";
6
+ import classNames from "classnames";
7
+ import "./index.less";
8
+ /**
9
+ * @title: 系统级别的下拉框
10
+ * @description:
11
+ * @param {BrowserSelectProps} props
12
+ * @return {*}
13
+ * @Author: zhiwei.Wang
14
+ * @Date: 2024-01-30 16:43
15
+ */
16
+ var BrowserSelect = function BrowserSelect(props) {
17
+ var options = props.options,
18
+ resetProps = _objectWithoutProperties(props, _excluded);
19
+ var _options = useMemo(function () {
20
+ return (props.options || []).map(function (d) {
21
+ return /*#__PURE__*/React.createElement("option", {
22
+ value: d.value,
23
+ key: d.value
24
+ }, d.label);
25
+ });
26
+ }, [props.options]);
27
+ return /*#__PURE__*/React.createElement("select", _extends({}, resetProps, {
28
+ className: classNames("date-picker-pisell-browser-select", resetProps.className),
29
+ onChange: function onChange(e) {
30
+ var _resetProps$onChange;
31
+ e.persist();
32
+ (_resetProps$onChange = resetProps.onChange) === null || _resetProps$onChange === void 0 ? void 0 : _resetProps$onChange.call(resetProps, e);
33
+ }
34
+ }), _options);
35
+ };
36
+ export default BrowserSelect;
@@ -0,0 +1,18 @@
1
+ .date-picker-pisell-browser-select {
2
+ padding: 9px 16px;
3
+ border-radius: 8px;
4
+ background-color: #fff;
5
+ background-image: url('./chevron-down.png');
6
+ color: var(--Gray-true-900, #141414);
7
+ font-size: 16px;
8
+ font-style: normal;
9
+ font-weight: 600;
10
+ border: 1px solid var(--Gray-300, #D0D5DD);
11
+ cursor: pointer;
12
+ appearance: none;
13
+ -webkit-appearance: none;
14
+ -moz-appearance: none;
15
+ background-position: right 10px center;
16
+ background-size: 12px;
17
+ background-repeat: no-repeat;
18
+ }
@@ -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[];
@@ -0,0 +1,128 @@
1
+ import dayjs from 'dayjs';
2
+ import { getText } from "./locales";
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
+ export var presetDetailMap = {
5
+ today: {
6
+ getValue: function getValue() {
7
+ return [dayjs().startOf('day'), dayjs().endOf('day')];
8
+ },
9
+ label: function label() {
10
+ return getText('toolbar-date-range-shortcut-today');
11
+ }
12
+ },
13
+ yesterday: {
14
+ getValue: function getValue() {
15
+ return [dayjs().add(-1, 'd').startOf('day'), dayjs().add(-1, 'd').endOf('day')];
16
+ },
17
+ label: function label() {
18
+ return getText('toolbar-date-range-shortcut-yesterday');
19
+ }
20
+ },
21
+ last_3_days: {
22
+ getValue: function getValue() {
23
+ return [dayjs().add(-3, 'd').startOf('day'), dayjs().add(-1, 'd').endOf('day')];
24
+ },
25
+ label: function label() {
26
+ return getText('toolbar-date-range-shortcut-last-3-days');
27
+ }
28
+ },
29
+ last_7_days: {
30
+ getValue: function getValue() {
31
+ return [dayjs().add(-7, 'd').startOf('day'), dayjs().add(-1, 'd').endOf('day')];
32
+ },
33
+ label: function label() {
34
+ return getText('toolbar-date-range-shortcut-last-7-days');
35
+ }
36
+ },
37
+ last_30_days: {
38
+ getValue: function getValue() {
39
+ return [dayjs().add(-30, 'd').startOf('day'), dayjs().add(-1, 'd').endOf('day')];
40
+ },
41
+ label: function label() {
42
+ return getText('toolbar-date-range-shortcut-last-30-days');
43
+ }
44
+ },
45
+ last_90_days: {
46
+ getValue: function getValue() {
47
+ return [dayjs().add(-90, 'd').startOf('day'), dayjs().add(-1, 'd').endOf('day')];
48
+ },
49
+ label: function label() {
50
+ return getText('toolbar-date-range-shortcut-last-90-days');
51
+ }
52
+ },
53
+ last_180_days: {
54
+ getValue: function getValue() {
55
+ return [dayjs().add(-180, 'd').startOf('day'), dayjs().add(-1, 'd').endOf('day')];
56
+ },
57
+ label: function label() {
58
+ return getText('toolbar-date-range-shortcut-last-180-days');
59
+ }
60
+ },
61
+ tomorrow: {
62
+ getValue: function getValue() {
63
+ return [dayjs().add(1, 'd').startOf('day'), dayjs().add(1, 'd').endOf('day')];
64
+ },
65
+ label: function label() {
66
+ return getText('toolbar-date-range-shortcut-tomorrow');
67
+ }
68
+ },
69
+ next_3_days: {
70
+ getValue: function getValue() {
71
+ return [dayjs().add(1, 'd').startOf('day'), dayjs().add(3, 'd').endOf('day')];
72
+ },
73
+ label: function label() {
74
+ return getText('toolbar-date-range-shortcut-next-3-days');
75
+ }
76
+ },
77
+ next_7_days: {
78
+ getValue: function getValue() {
79
+ return [dayjs().add(1, 'd').startOf('day'), dayjs().add(7, 'd').endOf('day')];
80
+ },
81
+ label: function label() {
82
+ return getText('toolbar-date-range-shortcut-next-7-days');
83
+ }
84
+ },
85
+ next_30_days: {
86
+ getValue: function getValue() {
87
+ return [dayjs().add(1, 'd').startOf('day'), dayjs().add(30, 'd').endOf('day')];
88
+ },
89
+ label: function label() {
90
+ return getText('toolbar-date-range-shortcut-next-30-days');
91
+ }
92
+ },
93
+ next_90_days: {
94
+ getValue: function getValue() {
95
+ return [dayjs().add(1, 'd').startOf('day'), dayjs().add(90, 'd').endOf('day')];
96
+ },
97
+ label: function label() {
98
+ return getText('toolbar-date-range-shortcut-next-90-days');
99
+ }
100
+ },
101
+ next_180_days: {
102
+ getValue: function getValue() {
103
+ return [dayjs().add(1, 'd').startOf('day'), dayjs().add(180, 'd').endOf('day')];
104
+ },
105
+ label: function label() {
106
+ return getText('toolbar-date-range-shortcut-next-180-days');
107
+ }
108
+ }
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
+ }];
@@ -0,0 +1,2 @@
1
+ declare const useDocumentVisibility: () => any;
2
+ export default useDocumentVisibility;
@@ -0,0 +1,27 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ 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; }
5
+ 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; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { useState, useEffect } from "react";
8
+ var getVisible = function getVisible() {
9
+ return document.visibilityState;
10
+ };
11
+ var useDocumentVisibility = function useDocumentVisibility() {
12
+ var _useState = useState(getVisible()),
13
+ _useState2 = _slicedToArray(_useState, 2),
14
+ visible = _useState2[0],
15
+ setVisible = _useState2[1];
16
+ useEffect(function () {
17
+ var handleVisibilityChange = function handleVisibilityChange() {
18
+ setVisible(getVisible());
19
+ };
20
+ document.addEventListener("visibilitychange", handleVisibilityChange);
21
+ return function () {
22
+ document.removeEventListener("visibilitychange", handleVisibilityChange);
23
+ };
24
+ }, []);
25
+ return visible;
26
+ };
27
+ export default useDocumentVisibility;
@@ -0,0 +1,2 @@
1
+ declare const useNextDay: (fn: Function) => void;
2
+ export default useNextDay;
@@ -0,0 +1,15 @@
1
+ import { useRef } from "react";
2
+ import useUpdateEffect from "./useUpdateEffect";
3
+ import useDocumentVisibility from "./useDocumentVisibility";
4
+ import dayjs from "dayjs";
5
+ var useNextDay = function useNextDay(fn) {
6
+ var visible = useDocumentVisibility();
7
+ var currentDay = useRef(dayjs());
8
+ useUpdateEffect(function () {
9
+ if (visible && !currentDay.current.isSame(dayjs(), "day")) {
10
+ currentDay.current = dayjs();
11
+ fn();
12
+ }
13
+ }, [visible]);
14
+ };
15
+ export default useNextDay;
@@ -0,0 +1,2 @@
1
+ declare const useUpdateEffect: (fn: Function, deps: any[]) => void;
2
+ export default useUpdateEffect;
@@ -0,0 +1,11 @@
1
+ import { useRef, useEffect } from "react";
2
+ var useUpdateEffect = function useUpdateEffect(fn, deps) {
3
+ var isMount = useRef(false);
4
+ useEffect(function () {
5
+ if (isMount.current) {
6
+ fn();
7
+ }
8
+ isMount.current = true;
9
+ }, deps);
10
+ };
11
+ export default useUpdateEffect;
@@ -0,0 +1,5 @@
1
+ declare const ChevronLeft: (props: {
2
+ className?: string | undefined;
3
+ onClick?: any;
4
+ }) => JSX.Element;
5
+ export default ChevronLeft;
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ var ChevronLeft = function ChevronLeft(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: "M15.7071 5.29289C16.0976 5.68342 16.0976 6.31658 15.7071 6.70711L10.4142 12L15.7071 17.2929C16.0976 17.6834 16.0976 18.3166 15.7071 18.7071C15.3166 19.0976 14.6834 19.0976 14.2929 18.7071L8.29289 12.7071C7.90237 12.3166 7.90237 11.6834 8.29289 11.2929L14.2929 5.29289C14.6834 4.90237 15.3166 4.90237 15.7071 5.29289Z",
20
+ fill: "currentColor"
21
+ })));
22
+ };
23
+ export default ChevronLeft;
@@ -0,0 +1,5 @@
1
+ declare const ChevronLeftDouble: (props: {
2
+ className?: string | undefined;
3
+ onClick?: any;
4
+ }) => JSX.Element;
5
+ export default ChevronLeftDouble;
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ var ChevronLeftDouble = function ChevronLeftDouble(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: "M11.7071 6.29289C12.0976 6.68342 12.0976 7.31658 11.7071 7.70711L7.41421 12L11.7071 16.2929C12.0976 16.6834 12.0976 17.3166 11.7071 17.7071C11.3166 18.0976 10.6834 18.0976 10.2929 17.7071L5.29289 12.7071C4.90237 12.3166 4.90237 11.6834 5.29289 11.2929L10.2929 6.29289C10.6834 5.90237 11.3166 5.90237 11.7071 6.29289ZM18.7071 6.29289C19.0976 6.68342 19.0976 7.31658 18.7071 7.70711L14.4142 12L18.7071 16.2929C19.0976 16.6834 19.0976 17.3166 18.7071 17.7071C18.3166 18.0976 17.6834 18.0976 17.2929 17.7071L12.2929 12.7071C11.9024 12.3166 11.9024 11.6834 12.2929 11.2929L17.2929 6.29289C17.6834 5.90237 18.3166 5.90237 18.7071 6.29289Z",
20
+ fill: "currentColor"
21
+ })));
22
+ };
23
+ export default ChevronLeftDouble;
@@ -0,0 +1,5 @@
1
+ declare const ChevronRight: (props: {
2
+ className?: string | undefined;
3
+ onClick?: any;
4
+ }) => JSX.Element;
5
+ export default ChevronRight;