@ringcentral/juno 2.22.1 → 2.23.0
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/components/Forms/Picker/DatePicker/Calendar.d.ts +4 -4
- package/components/Forms/Picker/DatePicker/Calendar.js +2 -2
- package/components/Forms/Picker/DatePicker/DatePicker.d.ts +9 -9
- package/components/Forms/Picker/DatePicker/DatePicker.js +12 -12
- package/components/Forms/Picker/DatePicker/Years.d.ts +2 -2
- package/components/Forms/Picker/DatePicker/utils/DatePickerUtils.d.ts +1 -1
- package/es6/components/Forms/Picker/DatePicker/Calendar.js +2 -2
- package/es6/components/Forms/Picker/DatePicker/DatePicker.js +12 -12
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
3
|
import { MaterialUiPickersDate as MuiPickersDate } from '@material-ui/pickers/typings/date';
|
|
4
4
|
import { RcClassesProps } from '../../../../foundation';
|
|
5
5
|
import { DatePickerHeaderProps } from './DatePickerHeader';
|
|
@@ -44,9 +44,9 @@ declare const Calendar: React.ForwardRefExoticComponent<{
|
|
|
44
44
|
/** DateRange for setting */
|
|
45
45
|
dateRange: {
|
|
46
46
|
/** Min date @DateIOType */
|
|
47
|
-
min?:
|
|
47
|
+
min?: dayjs.Dayjs | null | undefined;
|
|
48
48
|
/** Max date @DateIOType */
|
|
49
|
-
max?:
|
|
49
|
+
max?: dayjs.Dayjs | null | undefined;
|
|
50
50
|
};
|
|
51
51
|
/** Disable past dates */
|
|
52
52
|
disablePast?: boolean | undefined;
|
|
@@ -66,7 +66,7 @@ declare const Calendar: React.ForwardRefExoticComponent<{
|
|
|
66
66
|
loadingIndicator?: JSX.Element | undefined;
|
|
67
67
|
date: MuiPickersDate;
|
|
68
68
|
handleDaySelect: (day: MuiPickersDate, fromUserSelect?: boolean | undefined) => void;
|
|
69
|
-
getInvalidateDateInRange: (day: MuiPickersDate) => false |
|
|
69
|
+
getInvalidateDateInRange: (day: MuiPickersDate) => false | dayjs.Dayjs | null;
|
|
70
70
|
} & Pick<DayProps, "size"> & RcClassesProps<"footer" | "progress" | "calendarSlider"> & Pick<DatePickerHeaderProps, "classes"> & React.RefAttributes<any>>;
|
|
71
71
|
export { Calendar };
|
|
72
72
|
export type { CalendarProps };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
4
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
-
var
|
|
5
|
+
var dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
6
6
|
var CircularProgress_1 = tslib_1.__importDefault(require("@material-ui/core/CircularProgress"));
|
|
7
7
|
var pickers_1 = require("@material-ui/pickers");
|
|
8
8
|
var useKeyDown_1 = require("@material-ui/pickers/_shared/hooks/useKeyDown");
|
|
@@ -22,7 +22,7 @@ var Calendar = react_1.forwardRef(function (_a, ref) {
|
|
|
22
22
|
var previousView = foundation_1.usePrevious(function () { return view; });
|
|
23
23
|
var weeks = react_1.useRef([]);
|
|
24
24
|
// * `getWeekdays` not set locale, need set locale before get
|
|
25
|
-
|
|
25
|
+
dayjs_1.default.locale(utils.locale);
|
|
26
26
|
var weekdays = foundation_1.useResultRef(function () { return utils.getWeekdays(); }).current;
|
|
27
27
|
var _b = react_1.useMemo(function () {
|
|
28
28
|
var nowDate = utils.date();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
3
|
import { MaterialUiPickersDate as MuiPickersDate } from '@material-ui/pickers/typings/date';
|
|
4
4
|
import { RcBaseProps, RcBaseSize, RcClassesProps } from '../../../../foundation';
|
|
5
5
|
import { RcPopoverProps } from '../../../Popover';
|
|
@@ -62,15 +62,15 @@ declare const RcDatePicker: import("styled-components").StyledComponentClass<{
|
|
|
62
62
|
/** when hover on the textField, if show the clearBtn. With default is true. */
|
|
63
63
|
clearBtn?: boolean | undefined;
|
|
64
64
|
/** Min date */
|
|
65
|
-
min?: Date |
|
|
65
|
+
min?: Date | dayjs.Dayjs | null | undefined;
|
|
66
66
|
/** Max date */
|
|
67
|
-
max?: Date |
|
|
67
|
+
max?: Date | dayjs.Dayjs | null | undefined;
|
|
68
68
|
/** Text label for Today button */
|
|
69
69
|
todayButtonText?: string | undefined;
|
|
70
70
|
/** @deprecated Min date @DateIOType, using min instead */
|
|
71
|
-
minDate?:
|
|
71
|
+
minDate?: dayjs.Dayjs | null | undefined;
|
|
72
72
|
/** @deprecated Max date @DateIOType, using max instead */
|
|
73
|
-
maxDate?:
|
|
73
|
+
maxDate?: dayjs.Dayjs | null | undefined;
|
|
74
74
|
/** @deprecated please use value to replace that */
|
|
75
75
|
date?: Date | null | undefined;
|
|
76
76
|
} & Pick<Partial<CalendarProps>, "classes" | "size" | "disablePast" | "disableFuture" | "todayButtonText" | "formatString" | "renderDay" | "shouldDisableDate" | "onMonthChange" | "loadingIndicator"> & Pick<PickerTextFieldProps, "className" | "id" | "radius" | "onFocus" | "onBlur" | "onKeyDown" | "onClick" | "label" | "placeholder" | "size" | "variant" | "disabled" | "action" | "autoFocus" | "fullWidth" | "error" | "inputProps" | "inputRef" | "required" | "InputProps" | "helperText" | "gutterBottom" | "onClear" | "clearBtn" | "clearButtonProps" | "validate" | "PopoverProps" | "ActionSymbol"> & Pick<Pick<import("@material-ui/core").PopoverProps, "ref" | "className" | "color" | "id" | "lang" | "style" | "role" | "tabIndex" | "elevation" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "slot" | "title" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "innerRef" | "TransitionComponent" | "TransitionProps" | "action" | "disablePortal" | "onClose" | "onEnter" | "onEntering" | "onEntered" | "onExit" | "onExiting" | "onExited" | "open" | "transitionDuration" | "anchorOrigin" | "BackdropComponent" | "BackdropProps" | "closeAfterTransition" | "container" | "disableAutoFocus" | "disableBackdropClick" | "disableEnforceFocus" | "disableEscapeKeyDown" | "disableRestoreFocus" | "disableScrollLock" | "hideBackdrop" | "keepMounted" | "manager" | "onBackdropClick" | "onEscapeKeyDown" | "onRendered" | "anchorEl" | "anchorPosition" | "anchorReference" | "getContentAnchorEl" | "marginThreshold" | "PaperProps" | "transformOrigin">, "onClose"> & RcClassesProps<"popover" | "popoverPaper"> & React.RefAttributes<any>, import("../../../../foundation").RcTheme, Pick<{
|
|
@@ -94,15 +94,15 @@ declare const RcDatePicker: import("styled-components").StyledComponentClass<{
|
|
|
94
94
|
/** when hover on the textField, if show the clearBtn. With default is true. */
|
|
95
95
|
clearBtn?: boolean | undefined;
|
|
96
96
|
/** Min date */
|
|
97
|
-
min?: Date |
|
|
97
|
+
min?: Date | dayjs.Dayjs | null | undefined;
|
|
98
98
|
/** Max date */
|
|
99
|
-
max?: Date |
|
|
99
|
+
max?: Date | dayjs.Dayjs | null | undefined;
|
|
100
100
|
/** Text label for Today button */
|
|
101
101
|
todayButtonText?: string | undefined;
|
|
102
102
|
/** @deprecated Min date @DateIOType, using min instead */
|
|
103
|
-
minDate?:
|
|
103
|
+
minDate?: dayjs.Dayjs | null | undefined;
|
|
104
104
|
/** @deprecated Max date @DateIOType, using max instead */
|
|
105
|
-
maxDate?:
|
|
105
|
+
maxDate?: dayjs.Dayjs | null | undefined;
|
|
106
106
|
/** @deprecated please use value to replace that */
|
|
107
107
|
date?: Date | null | undefined;
|
|
108
108
|
} & Pick<Partial<CalendarProps>, "classes" | "size" | "disablePast" | "disableFuture" | "todayButtonText" | "formatString" | "renderDay" | "shouldDisableDate" | "onMonthChange" | "loadingIndicator"> & Pick<PickerTextFieldProps, "className" | "id" | "radius" | "onFocus" | "onBlur" | "onKeyDown" | "onClick" | "label" | "placeholder" | "size" | "variant" | "disabled" | "action" | "autoFocus" | "fullWidth" | "error" | "inputProps" | "inputRef" | "required" | "InputProps" | "helperText" | "gutterBottom" | "onClear" | "clearBtn" | "clearButtonProps" | "validate" | "PopoverProps" | "ActionSymbol"> & Pick<Pick<import("@material-ui/core").PopoverProps, "ref" | "className" | "color" | "id" | "lang" | "style" | "role" | "tabIndex" | "elevation" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "slot" | "title" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "innerRef" | "TransitionComponent" | "TransitionProps" | "action" | "disablePortal" | "onClose" | "onEnter" | "onEntering" | "onEntered" | "onExit" | "onExiting" | "onExited" | "open" | "transitionDuration" | "anchorOrigin" | "BackdropComponent" | "BackdropProps" | "closeAfterTransition" | "container" | "disableAutoFocus" | "disableBackdropClick" | "disableEnforceFocus" | "disableEscapeKeyDown" | "disableRestoreFocus" | "disableScrollLock" | "hideBackdrop" | "keepMounted" | "manager" | "onBackdropClick" | "onEscapeKeyDown" | "onRendered" | "anchorEl" | "anchorPosition" | "anchorReference" | "getContentAnchorEl" | "marginThreshold" | "PaperProps" | "transformOrigin">, "onClose"> & RcClassesProps<"popover" | "popoverPaper"> & React.RefAttributes<any>, "ref" | "key" | "className" | "id" | "max" | "min" | "radius" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "onClick" | "date" | "label" | "classes" | "placeholder" | "size" | "value" | "variant" | "disabled" | "action" | "autoFocus" | "onClose" | "fullWidth" | "error" | "inputProps" | "inputRef" | "required" | "InputProps" | "helperText" | "gutterBottom" | "onClear" | "clearBtn" | "clearButtonProps" | "validate" | "disablePast" | "disableFuture" | "todayButtonText" | "formatString" | "renderDay" | "shouldDisableDate" | "onMonthChange" | "loadingIndicator" | "PopoverProps" | "ActionSymbol" | "locale" | "screenReaderProps" | "minDate" | "maxDate"> & {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
4
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
6
|
+
var dayjs_2 = tslib_1.__importDefault(require("@date-io/dayjs"));
|
|
7
7
|
var pickers_1 = require("@material-ui/pickers");
|
|
8
8
|
var date_utils_1 = require("@material-ui/pickers/_helpers/date-utils");
|
|
9
9
|
var juno_icon_1 = require("@ringcentral/juno-icon");
|
|
@@ -30,8 +30,8 @@ var InnerRcDatePicker = react_1.forwardRef(function (props, ref) {
|
|
|
30
30
|
var minDate = maxDateProp || min;
|
|
31
31
|
var actionRef = react_1.useRef(null);
|
|
32
32
|
var dateRange = react_1.useMemo(function () { return ({
|
|
33
|
-
min:
|
|
34
|
-
max:
|
|
33
|
+
min: dayjs_1.default(minDate || defaultMinDate),
|
|
34
|
+
max: dayjs_1.default(maxDate || defaultMaxDate),
|
|
35
35
|
}); }, [minDate, maxDate]);
|
|
36
36
|
var getInvalidateDateInRange = foundation_1.useEventCallback(function (day) {
|
|
37
37
|
return utils_2.invalidateDateInRange(day, { dateRange: dateRange, now: utils.date(), disableFuture: disableFuture, disablePast: disablePast }, utils);
|
|
@@ -59,11 +59,11 @@ var InnerRcDatePicker = react_1.forwardRef(function (props, ref) {
|
|
|
59
59
|
utils,
|
|
60
60
|
]);
|
|
61
61
|
var initDate = react_1.useMemo(function () {
|
|
62
|
-
return getClosestEnableDate(
|
|
62
|
+
return getClosestEnableDate(dayjs_1.default(utils.date()));
|
|
63
63
|
}, [getClosestEnableDate, utils]);
|
|
64
|
-
var
|
|
65
|
-
var nowDate =
|
|
66
|
-
var textFiledValue = react_1.useMemo(function () { return (
|
|
64
|
+
var dayjsValue = react_1.useMemo(function () { return (controlledValue ? dayjs_1.default(controlledValue) : null); }, [controlledValue]);
|
|
65
|
+
var nowDate = dayjsValue || initDate;
|
|
66
|
+
var textFiledValue = react_1.useMemo(function () { return (dayjsValue ? utils.format(dayjsValue, formatString) : ''); }, [dayjsValue, utils, formatString]);
|
|
67
67
|
var PopoverProps = react_1.useMemo(function () {
|
|
68
68
|
return foundation_1.combineProps({
|
|
69
69
|
classes: foundation_1.combineClasses({
|
|
@@ -99,10 +99,10 @@ var InnerRcDatePicker = react_1.forwardRef(function (props, ref) {
|
|
|
99
99
|
react_1.useEffect(function () {
|
|
100
100
|
if (
|
|
101
101
|
// only when inner value change need check again is that value is valid
|
|
102
|
-
|
|
102
|
+
dayjsValue &&
|
|
103
103
|
value !== emitValueRef.current &&
|
|
104
|
-
shouldDisableDate(
|
|
105
|
-
var closestEnabledDate = getClosestEnableDate(
|
|
104
|
+
shouldDisableDate(dayjsValue)) {
|
|
105
|
+
var closestEnabledDate = getClosestEnableDate(dayjsValue);
|
|
106
106
|
handleDaySelect(closestEnabledDate, false);
|
|
107
107
|
}
|
|
108
108
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -133,7 +133,7 @@ var _RcDatePicker = react_1.forwardRef(function (inProps, ref) {
|
|
|
133
133
|
},
|
|
134
134
|
]);
|
|
135
135
|
}
|
|
136
|
-
return (react_1.default.createElement(pickers_1.MuiPickersUtilsProvider, { utils:
|
|
136
|
+
return (react_1.default.createElement(pickers_1.MuiPickersUtilsProvider, { utils: dayjs_2.default, locale: props.locale, libInstance: dayjs_1.default },
|
|
137
137
|
react_1.default.createElement(InnerRcDatePicker, tslib_1.__assign({ ref: ref }, props))));
|
|
138
138
|
});
|
|
139
139
|
var RcDatePicker = foundation_1.styled(_RcDatePicker)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject([""], [""])));
|
|
@@ -22,9 +22,9 @@ declare const Years: React.ForwardRefExoticComponent<{
|
|
|
22
22
|
/** the selected date. */
|
|
23
23
|
date: MuiPickersDate;
|
|
24
24
|
/** min Date of the displayed years range. */
|
|
25
|
-
minDate: import("
|
|
25
|
+
minDate: import("dayjs").Dayjs;
|
|
26
26
|
/** max Date of the displayed years range. */
|
|
27
|
-
maxDate: import("
|
|
27
|
+
maxDate: import("dayjs").Dayjs;
|
|
28
28
|
/** is disable the past years. */
|
|
29
29
|
disablePast?: boolean | undefined;
|
|
30
30
|
/** is disable the future years. */
|
|
@@ -22,5 +22,5 @@ export declare const onTransitionEnd: (event: any) => void;
|
|
|
22
22
|
declare type ValidateDateInRange = {
|
|
23
23
|
now: MuiPickersDate;
|
|
24
24
|
} & Pick<CalendarProps, 'dateRange' | 'disableFuture' | 'disablePast'>;
|
|
25
|
-
export declare const invalidateDateInRange: (day: MuiPickersDate, { dateRange: { min, max }, disableFuture, disablePast, now, }: ValidateDateInRange, utils: import("@date-io/core/IUtils").IUtils<MuiPickersDate>) => false | import("
|
|
25
|
+
export declare const invalidateDateInRange: (day: MuiPickersDate, { dateRange: { min, max }, disableFuture, disablePast, now, }: ValidateDateInRange, utils: import("@date-io/core/IUtils").IUtils<MuiPickersDate>) => false | import("dayjs").Dayjs | null;
|
|
26
26
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __read } from "tslib";
|
|
2
2
|
import React, { forwardRef, useLayoutEffect, useMemo, useRef, useState, } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
4
|
import MuiCircularProgress from '@material-ui/core/CircularProgress';
|
|
5
5
|
import { useUtils as useMuiUtils } from '@material-ui/pickers';
|
|
6
6
|
import { runKeyHandler } from '@material-ui/pickers/_shared/hooks/useKeyDown';
|
|
@@ -20,7 +20,7 @@ var Calendar = forwardRef(function (_a, ref) {
|
|
|
20
20
|
var previousView = usePrevious(function () { return view; });
|
|
21
21
|
var weeks = useRef([]);
|
|
22
22
|
// * `getWeekdays` not set locale, need set locale before get
|
|
23
|
-
|
|
23
|
+
dayjs.locale(utils.locale);
|
|
24
24
|
var weekdays = useResultRef(function () { return utils.getWeekdays(); }).current;
|
|
25
25
|
var _b = useMemo(function () {
|
|
26
26
|
var nowDate = utils.date();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign, __makeTemplateObject, __read, __rest } from "tslib";
|
|
2
2
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, } from 'react';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
import DayjsUtils from '@date-io/dayjs';
|
|
5
5
|
import { MuiPickersUtilsProvider, useUtils as useMuiUtils, } from '@material-ui/pickers';
|
|
6
6
|
import { findClosestEnabledDate as MuiFindClosestEnabledDate } from '@material-ui/pickers/_helpers/date-utils';
|
|
7
7
|
import { DateBorder } from '@ringcentral/juno-icon';
|
|
@@ -26,8 +26,8 @@ var InnerRcDatePicker = forwardRef(function (props, ref) {
|
|
|
26
26
|
var minDate = maxDateProp || min;
|
|
27
27
|
var actionRef = useRef(null);
|
|
28
28
|
var dateRange = useMemo(function () { return ({
|
|
29
|
-
min:
|
|
30
|
-
max:
|
|
29
|
+
min: dayjs(minDate || defaultMinDate),
|
|
30
|
+
max: dayjs(maxDate || defaultMaxDate),
|
|
31
31
|
}); }, [minDate, maxDate]);
|
|
32
32
|
var getInvalidateDateInRange = useEventCallback(function (day) {
|
|
33
33
|
return invalidateDateInRange(day, { dateRange: dateRange, now: utils.date(), disableFuture: disableFuture, disablePast: disablePast }, utils);
|
|
@@ -55,11 +55,11 @@ var InnerRcDatePicker = forwardRef(function (props, ref) {
|
|
|
55
55
|
utils,
|
|
56
56
|
]);
|
|
57
57
|
var initDate = useMemo(function () {
|
|
58
|
-
return getClosestEnableDate(
|
|
58
|
+
return getClosestEnableDate(dayjs(utils.date()));
|
|
59
59
|
}, [getClosestEnableDate, utils]);
|
|
60
|
-
var
|
|
61
|
-
var nowDate =
|
|
62
|
-
var textFiledValue = useMemo(function () { return (
|
|
60
|
+
var dayjsValue = useMemo(function () { return (controlledValue ? dayjs(controlledValue) : null); }, [controlledValue]);
|
|
61
|
+
var nowDate = dayjsValue || initDate;
|
|
62
|
+
var textFiledValue = useMemo(function () { return (dayjsValue ? utils.format(dayjsValue, formatString) : ''); }, [dayjsValue, utils, formatString]);
|
|
63
63
|
var PopoverProps = useMemo(function () {
|
|
64
64
|
return combineProps({
|
|
65
65
|
classes: combineClasses({
|
|
@@ -95,10 +95,10 @@ var InnerRcDatePicker = forwardRef(function (props, ref) {
|
|
|
95
95
|
useEffect(function () {
|
|
96
96
|
if (
|
|
97
97
|
// only when inner value change need check again is that value is valid
|
|
98
|
-
|
|
98
|
+
dayjsValue &&
|
|
99
99
|
value !== emitValueRef.current &&
|
|
100
|
-
shouldDisableDate(
|
|
101
|
-
var closestEnabledDate = getClosestEnableDate(
|
|
100
|
+
shouldDisableDate(dayjsValue)) {
|
|
101
|
+
var closestEnabledDate = getClosestEnableDate(dayjsValue);
|
|
102
102
|
handleDaySelect(closestEnabledDate, false);
|
|
103
103
|
}
|
|
104
104
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -129,7 +129,7 @@ var _RcDatePicker = forwardRef(function (inProps, ref) {
|
|
|
129
129
|
},
|
|
130
130
|
]);
|
|
131
131
|
}
|
|
132
|
-
return (React.createElement(MuiPickersUtilsProvider, { utils:
|
|
132
|
+
return (React.createElement(MuiPickersUtilsProvider, { utils: DayjsUtils, locale: props.locale, libInstance: dayjs },
|
|
133
133
|
React.createElement(InnerRcDatePicker, __assign({ ref: ref }, props))));
|
|
134
134
|
});
|
|
135
135
|
var RcDatePicker = styled(_RcDatePicker)(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ringcentral/juno",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.0",
|
|
4
4
|
"author": "RingCentral",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"url": "https://github.com/ringcentral/juno.git"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@date-io/
|
|
18
|
+
"@date-io/dayjs": "^1.3.13",
|
|
19
19
|
"@material-ui/core": "^4.12.3",
|
|
20
20
|
"@material-ui/lab": "^4.0.0-alpha.60",
|
|
21
21
|
"@material-ui/pickers": "^3.3.10",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@ringcentral/juno-icon": ">=1.0.0 <2.0.0",
|
|
38
|
-
"
|
|
38
|
+
"dayjs": "^1.11.6",
|
|
39
39
|
"react": "^17.0.2",
|
|
40
40
|
"react-dom": "^17.0.2",
|
|
41
41
|
"styled-components": "^5.3.3"
|