@pisell/date-picker 3.0.8 → 3.0.10

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 (62) hide show
  1. package/es/ActionBar/index.d.ts +14 -1
  2. package/es/ActionBar/index.js +41 -28
  3. package/es/ActionBar/index.less +31 -9
  4. package/es/CustomCalendarHeader/index.d.ts +2 -1
  5. package/es/Dialog/index.d.ts +2 -1
  6. package/es/Drawer/index.d.ts +1 -1
  7. package/es/OldActionBar/index.d.ts +2 -1
  8. package/es/OldPisellDateRangePicker/index.d.ts +1 -1
  9. package/es/PisellDateRangePicker/index.d.ts +10 -1
  10. package/es/PisellDateRangePicker/index.js +10 -3
  11. package/es/Shortcuts/index.d.ts +2 -1
  12. package/es/Toolbar/index.d.ts +2 -1
  13. package/es/browserSelect/index.d.ts +1 -1
  14. package/es/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -1
  15. package/es/icon/ChevronLeft.d.ts +2 -1
  16. package/es/icon/ChevronLeftDouble.d.ts +2 -1
  17. package/es/icon/ChevronRight.d.ts +2 -1
  18. package/es/icon/ChevronRightDouble.d.ts +2 -1
  19. package/es/icon/CloseCircle.d.ts +2 -1
  20. package/es/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +2 -1
  21. package/es/locales/index.js +19 -11
  22. package/es/locales/ja.d.ts +26 -0
  23. package/es/locales/ja.js +25 -0
  24. package/es/locales/pt.d.ts +26 -0
  25. package/es/locales/pt.js +25 -0
  26. package/es/utils/index.d.ts +2 -2
  27. package/es/utils/index.js +3 -3
  28. package/lib/ActionBar/index.d.ts +14 -1
  29. package/lib/ActionBar/index.js +50 -35
  30. package/lib/ActionBar/index.less +31 -9
  31. package/lib/CustomCalendarHeader/index.d.ts +2 -1
  32. package/lib/Dialog/index.d.ts +2 -1
  33. package/lib/Drawer/index.d.ts +1 -1
  34. package/lib/OldActionBar/index.d.ts +2 -1
  35. package/lib/OldPisellDateRangePicker/index.d.ts +1 -1
  36. package/lib/PisellDateRangePicker/index.d.ts +10 -1
  37. package/lib/PisellDateRangePicker/index.js +10 -3
  38. package/lib/Shortcuts/index.d.ts +2 -1
  39. package/lib/Toolbar/index.d.ts +2 -1
  40. package/lib/browserSelect/index.d.ts +1 -1
  41. package/lib/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -1
  42. package/lib/icon/ChevronLeft.d.ts +2 -1
  43. package/lib/icon/ChevronLeftDouble.d.ts +2 -1
  44. package/lib/icon/ChevronRight.d.ts +2 -1
  45. package/lib/icon/ChevronRightDouble.d.ts +2 -1
  46. package/lib/icon/CloseCircle.d.ts +2 -1
  47. package/lib/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +2 -1
  48. package/lib/locales/index.js +12 -4
  49. package/lib/locales/ja.d.ts +26 -0
  50. package/lib/locales/ja.js +49 -0
  51. package/lib/locales/pt.d.ts +26 -0
  52. package/lib/locales/pt.js +49 -0
  53. package/lib/utils/index.d.ts +2 -2
  54. package/package.json +2 -2
  55. package/es/DateRangePickerDay/DateRangePickerDay.d.ts +0 -50
  56. package/es/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +0 -5
  57. package/es/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +0 -5
  58. package/es/themeAugmentation/index.d.ts +0 -4
  59. package/lib/DateRangePickerDay/DateRangePickerDay.d.ts +0 -50
  60. package/lib/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +0 -5
  61. package/lib/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +0 -5
  62. package/lib/themeAugmentation/index.d.ts +0 -4
@@ -1,6 +1,17 @@
1
+ import React from 'react';
1
2
  import { ButtonProps } from 'antd';
2
3
  import { Dayjs } from 'dayjs';
3
4
  import './index.less';
5
+ export interface DateRangeTimeInputProps {
6
+ value?: string;
7
+ onChange?: (value: string) => void;
8
+ slice?: number;
9
+ theme?: 'light' | 'dark';
10
+ className?: string;
11
+ popoverClassName?: string;
12
+ popupContainerClassName?: string;
13
+ [key: string]: any;
14
+ }
4
15
  interface ActionBarProps {
5
16
  ownerState: any;
6
17
  onCancel: () => void;
@@ -14,6 +25,8 @@ interface ActionBarProps {
14
25
  okButtonProps?: ButtonProps;
15
26
  cancelButtonProps?: ButtonProps;
16
27
  isDesktop: boolean;
28
+ timeInputComponent?: React.ComponentType<DateRangeTimeInputProps>;
29
+ timeInputProps?: Omit<DateRangeTimeInputProps, 'value' | 'onChange'>;
17
30
  }
18
- declare const ActionBar: (props: ActionBarProps) => JSX.Element;
31
+ declare const ActionBar: (props: ActionBarProps) => React.JSX.Element;
19
32
  export default ActionBar;
@@ -20,7 +20,7 @@ import dayjs from 'dayjs';
20
20
  import { getText, pLocaleMap } from "../locales";
21
21
  import "./index.less";
22
22
  var ActionBar = function ActionBar(props) {
23
- var _value$, _value$2;
23
+ var _value$, _value$2, _value$3, _value$4;
24
24
  var ownerState = props.ownerState,
25
25
  onCancel = props.onCancel,
26
26
  onOk = props.onOk,
@@ -30,7 +30,9 @@ var ActionBar = function ActionBar(props) {
30
30
  value = _props$value === void 0 ? [] : _props$value,
31
31
  okButtonProps = props.okButtonProps,
32
32
  cancelButtonProps = props.cancelButtonProps,
33
- isDesktop = props.isDesktop;
33
+ isDesktop = props.isDesktop,
34
+ TimeInputComponent = props.timeInputComponent,
35
+ timeInputProps = props.timeInputProps;
34
36
  var local = useContext(MuiPickersAdapterContext);
35
37
  var locale = useMemo(function () {
36
38
  return local.utils.locale || 'en';
@@ -87,51 +89,62 @@ var ActionBar = function ActionBar(props) {
87
89
  format: 'HH:mm'
88
90
  };
89
91
  }, [showTime]);
92
+ var renderTimeInput = function renderTimeInput(currentValue, onTimeChange, pickerProps, placeholder, popupClassName) {
93
+ if (TimeInputComponent) {
94
+ return /*#__PURE__*/React.createElement(TimeInputComponent, _extends({}, timeInputProps, {
95
+ value: currentValue === null || currentValue === void 0 ? void 0 : currentValue.format('HH:mm'),
96
+ onChange: function onChange(nextTime) {
97
+ if (!nextTime) return;
98
+ onTimeChange(dayjs(nextTime, 'HH:mm'));
99
+ }
100
+ }));
101
+ }
102
+ return /*#__PURE__*/React.createElement(TimePicker, _extends({
103
+ placeholder: placeholder
104
+ }, pickerProps, {
105
+ changeOnBlur: true,
106
+ value: currentValue,
107
+ size: "large",
108
+ popupClassName: popupClassName,
109
+ onChange: onTimeChange,
110
+ inputReadOnly: true
111
+ }));
112
+ };
90
113
  return /*#__PURE__*/React.createElement(React.Fragment, null, showTime ? /*#__PURE__*/React.createElement("div", {
91
114
  className: "date-picker-action-time"
92
115
  }, /*#__PURE__*/React.createElement("div", {
93
116
  className: "date-picker-action-time-item"
94
117
  }, /*#__PURE__*/React.createElement("div", {
95
118
  className: "date-picker-action-time-item-label"
96
- }, getText('action-bar-start.time', pLocaleMap[locale])), isDesktop ? /*#__PURE__*/React.createElement(TimePicker, _extends({
97
- placeholder: getText('action-bar-start.time', pLocaleMap[locale])
98
- }, startTimeProps, {
99
- changeOnBlur: true,
100
- value: value[0],
101
- size: "large",
102
- popupClassName: "date-picker-action-bar-time-picker-popup",
103
- onChange: handleStartChange,
104
- inputReadOnly: true
105
- })) : /*#__PURE__*/React.createElement("input", {
119
+ }, getText('action-bar-start.time', pLocaleMap[locale])), isDesktop ? renderTimeInput(value[0], handleStartChange, startTimeProps, getText('action-bar-start.time', pLocaleMap[locale]), 'date-picker-action-bar-time-picker-popup') : /*#__PURE__*/React.createElement("div", {
120
+ className: "date-picker-time-wrapper"
121
+ }, /*#__PURE__*/React.createElement("div", {
122
+ className: "date-picker-time-display"
123
+ }, ((_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.format('HH:mm')) || '--:--'), /*#__PURE__*/React.createElement("input", {
106
124
  type: "time",
107
125
  onChange: function onChange(e) {
108
126
  var val = e.target.value;
109
127
  handleStartChange(dayjs(val, 'HH:mm'));
110
128
  },
111
- className: "date-picker-input-time",
112
- value: (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.format('HH:mm')
113
- })), /*#__PURE__*/React.createElement("div", {
129
+ className: "date-picker-input-time-native",
130
+ value: (_value$2 = value[0]) === null || _value$2 === void 0 ? void 0 : _value$2.format('HH:mm')
131
+ }))), /*#__PURE__*/React.createElement("div", {
114
132
  className: "date-picker-action-time-item"
115
133
  }, /*#__PURE__*/React.createElement("div", {
116
134
  className: "date-picker-action-time-item-label"
117
- }, getText('action-bar-end.time', pLocaleMap[locale])), isDesktop ? /*#__PURE__*/React.createElement(TimePicker, _extends({
118
- placeholder: getText('action-bar-end.time', pLocaleMap[locale])
119
- }, endTimeProps, {
120
- changeOnBlur: true,
121
- value: value[1],
122
- size: "large",
123
- popupClassName: "date-picker-action-bar-time-picker-popup",
124
- onChange: handleEndChange,
125
- inputReadOnly: true
126
- })) : /*#__PURE__*/React.createElement("input", {
135
+ }, getText('action-bar-end.time', pLocaleMap[locale])), isDesktop ? renderTimeInput(value[1], handleEndChange, endTimeProps, getText('action-bar-end.time', pLocaleMap[locale]), 'date-picker-action-bar-time-picker-popup') : /*#__PURE__*/React.createElement("div", {
136
+ className: "date-picker-time-wrapper"
137
+ }, /*#__PURE__*/React.createElement("div", {
138
+ className: "date-picker-time-display"
139
+ }, ((_value$3 = value[1]) === null || _value$3 === void 0 ? void 0 : _value$3.format('HH:mm')) || '--:--'), /*#__PURE__*/React.createElement("input", {
127
140
  type: "time",
128
141
  onChange: function onChange(e) {
129
142
  var val = e.target.value;
130
143
  handleEndChange(dayjs(val, 'HH:mm'));
131
144
  },
132
- className: "date-picker-input-time",
133
- value: (_value$2 = value[1]) === null || _value$2 === void 0 ? void 0 : _value$2.format('HH:mm')
134
- }))) : null, /*#__PURE__*/React.createElement("div", {
145
+ className: "date-picker-input-time-native",
146
+ value: (_value$4 = value[1]) === null || _value$4 === void 0 ? void 0 : _value$4.format('HH:mm')
147
+ })))) : null, /*#__PURE__*/React.createElement("div", {
135
148
  className: classNames(props.className, 'date-picker-action-bar')
136
149
  }, /*#__PURE__*/React.createElement("div", {
137
150
  className: "date-picker-action-bar-right",
@@ -27,17 +27,39 @@
27
27
  flex-direction: column;
28
28
  gap: 8px;
29
29
  flex: 1;
30
- .date-picker-input-time {
31
- padding: 6.5px 11px 6.5px;
32
- background: #ffffff;
33
- border: 1px solid #D0D5DD;
34
- border-radius: 8px;
35
- height: 40px;
36
- line-height: 40px;
30
+ .date-picker-time-wrapper {
31
+ position: relative;
37
32
  width: 100%;
38
- display: block;
39
33
  min-width: 160px;
40
- font-size: 16px;
34
+
35
+ .date-picker-time-display {
36
+ display: flex;
37
+ align-items: center;
38
+ height: 40px;
39
+ padding: 0 11px;
40
+ background: #ffffff;
41
+ border: 1px solid #D0D5DD;
42
+ border-radius: 8px;
43
+ font-size: 16px;
44
+ color: rgba(0, 0, 0, 0.88);
45
+ pointer-events: none;
46
+ }
47
+
48
+ .date-picker-input-time-native {
49
+ position: absolute;
50
+ top: 0;
51
+ left: 0;
52
+ width: 100%;
53
+ height: 100%;
54
+ opacity: 0;
55
+ cursor: pointer;
56
+ -webkit-appearance: none;
57
+ appearance: none;
58
+ border: none;
59
+ padding: 0;
60
+ margin: 0;
61
+ font-size: 16px; // 防止 iOS focus 时页面缩放
62
+ }
41
63
  }
42
64
  .date-picker-action-time-item-label {
43
65
  color: var(--Gray-700, #344054);
@@ -1,2 +1,3 @@
1
- declare const CustomCalendarHeader: (props: any) => JSX.Element;
1
+ import React from 'react';
2
+ declare const CustomCalendarHeader: (props: any) => React.JSX.Element;
2
3
  export default CustomCalendarHeader;
@@ -1,2 +1,3 @@
1
- declare const Dialog: (props: any) => JSX.Element;
1
+ import React from 'react';
2
+ declare const Dialog: (props: any) => React.JSX.Element;
2
3
  export default Dialog;
@@ -7,5 +7,5 @@ interface DrawerProps {
7
7
  children: React.ReactNode;
8
8
  onClose: () => void;
9
9
  }
10
- declare const Drawer: (props: DrawerProps) => JSX.Element | null;
10
+ declare const Drawer: (props: DrawerProps) => React.JSX.Element | null;
11
11
  export default Drawer;
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import { ButtonProps } from "antd";
2
3
  import { Dayjs } from "dayjs";
3
4
  import "./index.less";
@@ -14,5 +15,5 @@ interface ActionBarProps {
14
15
  okButtonProps?: ButtonProps;
15
16
  cancelButtonProps?: ButtonProps;
16
17
  }
17
- declare const ActionBar: (props: ActionBarProps) => JSX.Element;
18
+ declare const ActionBar: (props: ActionBarProps) => React.JSX.Element;
18
19
  export default ActionBar;
@@ -75,5 +75,5 @@ export interface PisellDateRangePickerProps {
75
75
  /** 输入框只读 */
76
76
  inputReadOnly: boolean;
77
77
  }
78
- declare const PisellDateRangePicker: (props: PisellDateRangePickerProps) => JSX.Element;
78
+ declare const PisellDateRangePicker: (props: PisellDateRangePickerProps) => React.JSX.Element;
79
79
  export default PisellDateRangePicker;
@@ -2,6 +2,7 @@ import { Dayjs } from 'dayjs';
2
2
  import React from 'react';
3
3
  import { ButtonProps } from 'antd';
4
4
  import { PopperPlacementType } from '@mui/base/Popper/Popper.types';
5
+ import type { DateRangeTimeInputProps } from '../ActionBar';
5
6
  import { PresetType } from '../Shortcuts';
6
7
  import 'dayjs/locale/zh-cn';
7
8
  import 'dayjs/locale/en';
@@ -65,6 +66,14 @@ export interface PisellDateRangePickerProps {
65
66
  * @example '@media (min-width: 720px)' or theme.breakpoints.up("sm")
66
67
  */
67
68
  desktopModeMediaQuery?: string;
69
+ /** 桌面端展示的日历数量:单日 1 个,多日 2 个 */
70
+ calendars?: 1 | 2 | 3;
71
+ /** 自定义弹层底部时间输入组件;不传则使用默认 antd TimePicker */
72
+ timeInputComponent?: React.ComponentType<DateRangeTimeInputProps>;
73
+ /** 自定义时间输入组件 props */
74
+ timeInputProps?: Omit<DateRangeTimeInputProps, 'value' | 'onChange'>;
75
+ /** showTime 模式下是否仍展示弹层顶部 Starting/Ending 日期输入区 */
76
+ showToolbarWhenShowTime?: boolean;
68
77
  style?: React.CSSProperties;
69
78
  /** 是否展示清除按钮 */
70
79
  allowClear?: boolean;
@@ -79,5 +88,5 @@ export interface PisellDateRangePickerProps {
79
88
  isHideCustomSelect?: boolean;
80
89
  endDateDays?: number;
81
90
  }
82
- declare const PisellDateRangePicker: (props: PisellDateRangePickerProps) => JSX.Element;
91
+ declare const PisellDateRangePicker: (props: PisellDateRangePickerProps) => React.JSX.Element;
83
92
  export default PisellDateRangePicker;
@@ -74,6 +74,10 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
74
74
  cancelButtonProps = props.cancelButtonProps,
75
75
  onDateChange = props.onDateChange,
76
76
  desktopModeMediaQuery = props.desktopModeMediaQuery,
77
+ calendars = props.calendars,
78
+ timeInputComponent = props.timeInputComponent,
79
+ timeInputProps = props.timeInputProps,
80
+ showToolbarWhenShowTime = props.showToolbarWhenShowTime,
77
81
  style = props.style,
78
82
  allowClear = props.allowClear,
79
83
  disablePortal = props.disablePortal,
@@ -237,7 +241,7 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
237
241
  if (inputReadOnly) {
238
242
  return {
239
243
  readOnly: true,
240
- selectedSections: 0
244
+ selectedSections: null
241
245
  };
242
246
  }
243
247
  return {};
@@ -285,6 +289,7 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
285
289
  onMonthChange: onMonthChange,
286
290
  minDate: minDate,
287
291
  maxDate: maxDate,
292
+ calendars: calendars,
288
293
  format: format,
289
294
  label: placeholder,
290
295
  value: _value,
@@ -329,10 +334,12 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
329
334
  onChange: handleChange,
330
335
  value: _value,
331
336
  okButtonProps: okButtonProps,
332
- cancelButtonProps: cancelButtonProps
337
+ cancelButtonProps: cancelButtonProps,
338
+ timeInputComponent: timeInputComponent,
339
+ timeInputProps: timeInputProps
333
340
  },
334
341
  toolbar: {
335
- hidden: showTime,
342
+ hidden: showTime && !showToolbarWhenShowTime,
336
343
  presetItems: _presets,
337
344
  format: format,
338
345
  locale: locale,
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import "./index.less";
2
3
  import { Dayjs } from "dayjs";
3
4
  export declare type PresetType = {
@@ -11,5 +12,5 @@ interface ShortcutsProps {
11
12
  onChange: (day: [Dayjs, Dayjs], changeImportance?: "accept" | "set") => void;
12
13
  changeImportance?: "accept" | "set";
13
14
  }
14
- declare const Shortcuts: (props: ShortcutsProps) => JSX.Element | null;
15
+ declare const Shortcuts: (props: ShortcutsProps) => React.JSX.Element | null;
15
16
  export default Shortcuts;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import './index.less';
2
- declare const Toolbar: (props: any) => JSX.Element | null;
3
+ declare const Toolbar: (props: any) => React.JSX.Element | null;
3
4
  export default Toolbar;
@@ -11,5 +11,5 @@ interface BrowserSelectProps extends React.DetailedHTMLProps<React.SelectHTMLAtt
11
11
  * @Author: zhiwei.Wang
12
12
  * @Date: 2024-01-30 16:43
13
13
  */
14
- declare const BrowserSelect: (props: BrowserSelectProps) => JSX.Element;
14
+ declare const BrowserSelect: (props: BrowserSelectProps) => React.JSX.Element;
15
15
  export default BrowserSelect;
@@ -1,3 +1,4 @@
1
+ import * as React from 'react';
1
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models';
2
3
  import { DateRangeCalendarProps } from '../DateRangeCalendar';
3
4
  export interface DateRangeViewRendererProps<TDate, TView extends DateOrTimeViewWithMeridiem> extends DateRangeCalendarProps<TDate> {
@@ -9,4 +10,4 @@ export interface DateRangeViewRendererProps<TDate, TView extends DateOrTimeViewW
9
10
  * We don't pass all the props down to `DateRangeCalendar`,
10
11
  * because otherwise some unwanted props would be passed to the HTML element.
11
12
  */
12
- export declare const renderDateRangeViewCalendar: <TDate extends unknown>({ value, defaultValue, onChange, className, classes, disableFuture, disablePast, minDate, maxDate, shouldDisableDate, reduceAnimations, onMonthChange, defaultCalendarMonth, rangePosition, defaultRangePosition, onRangePositionChange, calendars, currentMonthCalendarPosition, components, componentsProps, slots, slotProps, loading, renderLoading, disableHighlightToday, readOnly, disabled, showDaysOutsideCurrentMonth, dayOfWeekFormatter, disableAutoMonthSwitching, sx, autoFocus, fixedWeekNumber, disableDragEditing, displayWeekNumber, timezone, }: DateRangeViewRendererProps<TDate, any>) => JSX.Element;
13
+ export declare const renderDateRangeViewCalendar: <TDate extends unknown>({ value, defaultValue, onChange, className, classes, disableFuture, disablePast, minDate, maxDate, shouldDisableDate, reduceAnimations, onMonthChange, defaultCalendarMonth, rangePosition, defaultRangePosition, onRangePositionChange, calendars, currentMonthCalendarPosition, components, componentsProps, slots, slotProps, loading, renderLoading, disableHighlightToday, readOnly, disabled, showDaysOutsideCurrentMonth, dayOfWeekFormatter, disableAutoMonthSwitching, sx, autoFocus, fixedWeekNumber, disableDragEditing, displayWeekNumber, timezone, }: DateRangeViewRendererProps<TDate, any>) => React.JSX.Element;
@@ -1,5 +1,6 @@
1
+ import React from "react";
1
2
  declare const ChevronLeft: (props: {
2
3
  className?: string | undefined;
3
4
  onClick?: any;
4
- }) => JSX.Element;
5
+ }) => React.JSX.Element;
5
6
  export default ChevronLeft;
@@ -1,5 +1,6 @@
1
+ import React from "react";
1
2
  declare const ChevronLeftDouble: (props: {
2
3
  className?: string | undefined;
3
4
  onClick?: any;
4
- }) => JSX.Element;
5
+ }) => React.JSX.Element;
5
6
  export default ChevronLeftDouble;
@@ -1,5 +1,6 @@
1
+ import React from "react";
1
2
  declare const ChevronRight: (props: {
2
3
  className?: string | undefined;
3
4
  onClick?: any;
4
- }) => JSX.Element;
5
+ }) => React.JSX.Element;
5
6
  export default ChevronRight;
@@ -1,5 +1,6 @@
1
+ import React from "react";
1
2
  declare const ChevronRightDouble: (props: {
2
3
  className?: string | undefined;
3
4
  onClick?: any;
4
- }) => JSX.Element;
5
+ }) => React.JSX.Element;
5
6
  export default ChevronRightDouble;
@@ -1,5 +1,6 @@
1
+ import React from "react";
1
2
  declare const CloseCircle: (props: {
2
3
  className: string;
3
4
  onClick: any;
4
- }) => JSX.Element;
5
+ }) => React.JSX.Element;
5
6
  export default CloseCircle;
@@ -1,3 +1,4 @@
1
+ import * as React from 'react';
1
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models';
2
3
  import { UseStaticRangePickerParams, UseStaticRangePickerProps } from './useStaticRangePicker.types';
3
4
  /**
@@ -5,5 +6,5 @@ import { UseStaticRangePickerParams, UseStaticRangePickerProps } from './useStat
5
6
  * - StaticDateRangePicker
6
7
  */
7
8
  export declare const useStaticRangePicker: <TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticRangePickerProps<TDate, TView, any, TExternalProps>>({ props, ref, ...pickerParams }: UseStaticRangePickerParams<TDate, TView, TExternalProps>) => {
8
- renderPicker: () => JSX.Element;
9
+ renderPicker: () => React.JSX.Element;
9
10
  };
@@ -1,19 +1,27 @@
1
1
  import zhCN from "./zh-CN";
2
2
  import enUS from "./en-US";
3
3
  import zhTW from "./zh-TW";
4
+ import ja from "./ja";
5
+ import pt from "./pt";
4
6
  import { getCurrentLocale } from "../utils";
5
7
  var langMap = {
6
- "zh-CN": zhCN,
7
- "en-US": enUS,
8
- "zh-TW": zhTW
8
+ 'zh-CN': zhCN,
9
+ 'en-US': enUS,
10
+ 'zh-TW': zhTW,
11
+ 'zh-HK': zhTW,
12
+ ja: ja,
13
+ pt: pt
9
14
  };
10
15
  export var pLocaleMap = {
11
- "en": "en-US",
12
- "zh-cn": "zh-CN",
13
- "zh-tw": "zh-TW",
14
- "en-US": "en-US",
15
- "zh-CN": "zh-CN",
16
- "zh-TW": "zh-TW"
16
+ en: 'en-US',
17
+ 'zh-cn': 'zh-CN',
18
+ 'zh-tw': 'zh-TW',
19
+ 'en-US': 'en-US',
20
+ 'zh-CN': 'zh-CN',
21
+ 'zh-TW': 'zh-TW',
22
+ 'zh-HK': 'zh-TW',
23
+ ja: 'ja',
24
+ pt: 'pt'
17
25
  };
18
26
  export var getText = function getText(id, pLocale) {
19
27
  if (!id) {
@@ -23,7 +31,7 @@ export var getText = function getText(id, pLocale) {
23
31
  //@ts-ignore
24
32
  return langMap[pLocale][id] || id;
25
33
  }
26
- var locale = getCurrentLocale() || "en-US";
34
+ var locale = getCurrentLocale() || 'en-US';
27
35
  //@ts-ignore
28
- return langMap[locale][id] || id;
36
+ return langMap[locale][id] || langMap['en-US'][id] || id;
29
37
  };
@@ -0,0 +1,26 @@
1
+ declare const _default: {
2
+ 'action-bar-cancel': string;
3
+ 'action-bar-apply': string;
4
+ 'action-bar-start.time': string;
5
+ 'action-bar-end.time': string;
6
+ 'toolbar-date-range-shortcut-custom': string;
7
+ "toolbar-date-range-shortcut-date-range": string;
8
+ "toolbar-date-range-shortcut-starting": string;
9
+ "toolbar-date-range-shortcut-ending": string;
10
+ "toolbar-date-range-shortcut-today": string;
11
+ "toolbar-date-range-shortcut-yesterday": string;
12
+ "toolbar-date-range-shortcut-tomorrow": string;
13
+ "toolbar-date-range-shortcut-last-3-days": string;
14
+ "toolbar-date-range-shortcut-last-7-days": string;
15
+ "toolbar-date-range-shortcut-last-30-days": string;
16
+ "toolbar-date-range-shortcut-last-90-days": string;
17
+ "toolbar-date-range-shortcut-last-180-days": string;
18
+ "toolbar-date-range-shortcut-next-3-days": string;
19
+ "toolbar-date-range-shortcut-next-7-days": string;
20
+ "toolbar-date-range-shortcut-next-30-days": string;
21
+ "toolbar-date-range-shortcut-next-90-days": string;
22
+ "toolbar-date-range-shortcut-next-180-days": string;
23
+ "toolbar-date-range-invalid-start-date": string;
24
+ "toolbar-date-range-invalid-end-date": string;
25
+ };
26
+ export default _default;
@@ -0,0 +1,25 @@
1
+ export default {
2
+ 'action-bar-cancel': 'キャンセル',
3
+ 'action-bar-apply': '適用',
4
+ 'action-bar-start.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日",
23
+ "toolbar-date-range-invalid-start-date": "開始日が無効です",
24
+ "toolbar-date-range-invalid-end-date": "終了日が無効です"
25
+ };
@@ -0,0 +1,26 @@
1
+ declare const _default: {
2
+ 'action-bar-cancel': string;
3
+ 'action-bar-apply': string;
4
+ 'action-bar-start.time': string;
5
+ 'action-bar-end.time': string;
6
+ 'toolbar-date-range-shortcut-custom': string;
7
+ "toolbar-date-range-shortcut-date-range": string;
8
+ "toolbar-date-range-shortcut-starting": string;
9
+ "toolbar-date-range-shortcut-ending": string;
10
+ "toolbar-date-range-shortcut-today": string;
11
+ "toolbar-date-range-shortcut-yesterday": string;
12
+ "toolbar-date-range-shortcut-tomorrow": string;
13
+ "toolbar-date-range-shortcut-last-3-days": string;
14
+ "toolbar-date-range-shortcut-last-7-days": string;
15
+ "toolbar-date-range-shortcut-last-30-days": string;
16
+ "toolbar-date-range-shortcut-last-90-days": string;
17
+ "toolbar-date-range-shortcut-last-180-days": string;
18
+ "toolbar-date-range-shortcut-next-3-days": string;
19
+ "toolbar-date-range-shortcut-next-7-days": string;
20
+ "toolbar-date-range-shortcut-next-30-days": string;
21
+ "toolbar-date-range-shortcut-next-90-days": string;
22
+ "toolbar-date-range-shortcut-next-180-days": string;
23
+ "toolbar-date-range-invalid-start-date": string;
24
+ "toolbar-date-range-invalid-end-date": string;
25
+ };
26
+ export default _default;
@@ -0,0 +1,25 @@
1
+ export default {
2
+ 'action-bar-cancel': 'Cancelar',
3
+ 'action-bar-apply': 'Aplicar',
4
+ 'action-bar-start.time': 'Hora de início',
5
+ 'action-bar-end.time': 'Hora de término',
6
+ 'toolbar-date-range-shortcut-custom': 'Personalizado',
7
+ "toolbar-date-range-shortcut-date-range": "Intervalo de datas",
8
+ "toolbar-date-range-shortcut-starting": "Início",
9
+ "toolbar-date-range-shortcut-ending": "Fim",
10
+ "toolbar-date-range-shortcut-today": "Hoje",
11
+ "toolbar-date-range-shortcut-yesterday": "Ontem",
12
+ "toolbar-date-range-shortcut-tomorrow": "Amanhã",
13
+ "toolbar-date-range-shortcut-last-3-days": "Últimos 3 dias",
14
+ "toolbar-date-range-shortcut-last-7-days": "Últimos 7 dias",
15
+ "toolbar-date-range-shortcut-last-30-days": "Últimos 30 dias",
16
+ "toolbar-date-range-shortcut-last-90-days": "Últimos 90 dias",
17
+ "toolbar-date-range-shortcut-last-180-days": "Últimos 180 dias",
18
+ "toolbar-date-range-shortcut-next-3-days": "Próximos 3 dias",
19
+ "toolbar-date-range-shortcut-next-7-days": "Próximos 7 dias",
20
+ "toolbar-date-range-shortcut-next-30-days": "Próximos 30 dias",
21
+ "toolbar-date-range-shortcut-next-90-days": "Próximos 90 dias",
22
+ "toolbar-date-range-shortcut-next-180-days": "Próximos 180 dias",
23
+ "toolbar-date-range-invalid-start-date": "Data de início inválida",
24
+ "toolbar-date-range-invalid-end-date": "Data de término inválida"
25
+ };
@@ -1,5 +1,5 @@
1
- import { PresetType } from "../Shortcuts";
2
- import { Dayjs } from "dayjs";
1
+ import { PresetType } from '../Shortcuts';
2
+ import { Dayjs } from 'dayjs';
3
3
  export declare const getCurrentLocale: () => string;
4
4
  export declare const isBrowser: boolean;
5
5
  export declare const isMobile: () => boolean;
package/es/utils/index.js CHANGED
@@ -4,14 +4,14 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
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
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- import { isFunction, isMobile as isMobileUtils, isString } from "@pisell/utils";
7
+ import { isFunction, isMobile as isMobileUtils, isString } from '@pisell/utils';
8
8
  import { defaultPresets, presetDetailMap, presetValueArr } from "../constants";
9
9
  export var getCurrentLocale = function getCurrentLocale() {
10
- var locale = localStorage.getItem("umi_locale") || "en-US";
10
+ var locale = localStorage.getItem('umi_locale') || 'en-US';
11
11
  //@ts-ignore
12
12
  return locale;
13
13
  };
14
- export var isBrowser = !!(typeof window !== "undefined" && window.document && window.document.createElement);
14
+ export var isBrowser = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
15
15
  export var isMobile = function isMobile() {
16
16
  if (isBrowser) {
17
17
  return window.innerWidth <= 768 || isMobileUtils();
@@ -1,6 +1,17 @@
1
+ import React from 'react';
1
2
  import { ButtonProps } from 'antd';
2
3
  import { Dayjs } from 'dayjs';
3
4
  import './index.less';
5
+ export interface DateRangeTimeInputProps {
6
+ value?: string;
7
+ onChange?: (value: string) => void;
8
+ slice?: number;
9
+ theme?: 'light' | 'dark';
10
+ className?: string;
11
+ popoverClassName?: string;
12
+ popupContainerClassName?: string;
13
+ [key: string]: any;
14
+ }
4
15
  interface ActionBarProps {
5
16
  ownerState: any;
6
17
  onCancel: () => void;
@@ -14,6 +25,8 @@ interface ActionBarProps {
14
25
  okButtonProps?: ButtonProps;
15
26
  cancelButtonProps?: ButtonProps;
16
27
  isDesktop: boolean;
28
+ timeInputComponent?: React.ComponentType<DateRangeTimeInputProps>;
29
+ timeInputProps?: Omit<DateRangeTimeInputProps, 'value' | 'onChange'>;
17
30
  }
18
- declare const ActionBar: (props: ActionBarProps) => JSX.Element;
31
+ declare const ActionBar: (props: ActionBarProps) => React.JSX.Element;
19
32
  export default ActionBar;