@pisell/date-picker 1.0.75-7 → 1.0.75-8
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.d.ts +2 -1
- package/es/ActionBar/index.js +11 -13
- package/es/DateRangeCalendar/DateRangeCalendar.js +11 -12
- package/es/DateRangeCalendar/useDragRange.js +6 -6
- package/es/DateRangePicker/DateRangePickerToolbar.d.ts +2 -1
- package/es/DateRangePicker/DateRangePickerToolbar.js +1 -1
- package/es/DateRangePicker/shared.js +5 -5
- package/es/DateRangePickerDay/DateRangePickerDay.js +8 -9
- package/es/DesktopDateRangePicker/DesktopDateRangePicker.js +5 -5
- package/es/MobileDateRangePicker/MobileDateRangePicker.js +5 -5
- package/es/MultiInputDateRangeField/MultiInputDateRangeField.js +5 -5
- package/es/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +5 -5
- package/es/MultiInputTimeRangeField/MultiInputTimeRangeField.js +5 -5
- package/es/PisellDateRangePicker/CloseCircle.d.ts +2 -1
- package/es/PisellDateRangePicker/LocaleContext.d.ts +7 -2
- package/es/PisellDateRangePicker/index.d.ts +1 -1
- package/es/PisellDateRangePicker/index.js +22 -45
- package/es/PisellDateRangePicker/useCssVariables.js +1 -1
- package/es/Shortcuts/index.d.ts +2 -1
- package/es/Shortcuts/index.js +1 -1
- package/es/SingleInputDateRangeField/SingleInputDateRangeField.js +5 -5
- package/es/SingleInputDateRangeField/useSingleInputDateRangeField.js +5 -5
- package/es/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +5 -5
- package/es/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +5 -5
- package/es/SingleInputTimeRangeField/SingleInputTimeRangeField.js +5 -5
- package/es/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +5 -5
- package/es/StaticDateRangePicker/StaticDateRangePicker.js +5 -5
- package/es/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -1
- package/es/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +2 -1
- package/es/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +5 -5
- package/es/internals/hooks/useEnrichedRangePickerFieldProps.js +9 -9
- package/es/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +2 -1
- package/es/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +6 -6
- package/es/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +5 -5
- package/es/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +5 -5
- package/es/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +5 -5
- package/es/internals/hooks/useRangePosition.js +2 -2
- package/es/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +2 -1
- package/es/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +7 -7
- package/es/internals/utils/date-fields-utils.d.ts +1 -1
- package/es/internals/utils/date-fields-utils.js +5 -5
- package/es/internals/utils/date-range-manager.js +1 -1
- package/es/internals/utils/validation/validateDateRange.js +6 -6
- package/es/internals/utils/validation/validateDateTimeRange.js +6 -6
- package/es/internals/utils/validation/validateTimeRange.js +1 -1
- package/es/internals/utils/valueManagers.js +6 -6
- package/es/locales/index.js +11 -3
- package/es/locales/ja.d.ts +26 -0
- package/es/locales/ja.js +25 -0
- package/es/locales/pt.d.ts +26 -0
- package/es/locales/pt.js +25 -0
- package/es/utils/index.d.ts +1 -1
- package/lib/ActionBar/index.d.ts +2 -1
- package/lib/ActionBar/index.js +2 -4
- package/lib/DateRangePicker/DateRangePickerToolbar.d.ts +2 -1
- package/lib/PisellDateRangePicker/CloseCircle.d.ts +2 -1
- package/lib/PisellDateRangePicker/LocaleContext.d.ts +7 -2
- package/lib/PisellDateRangePicker/index.d.ts +1 -1
- package/lib/PisellDateRangePicker/index.js +2 -26
- package/lib/PisellDateRangePicker/useCssVariables.js +1 -2
- package/lib/Shortcuts/index.d.ts +2 -1
- package/lib/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -1
- package/lib/index.d.ts +1 -5
- package/lib/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +2 -1
- package/lib/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +2 -1
- package/lib/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +2 -1
- package/lib/internals/utils/date-fields-utils.d.ts +1 -1
- package/lib/locales/index.js +11 -3
- package/lib/locales/ja.d.ts +26 -0
- package/lib/locales/ja.js +49 -0
- package/lib/locales/pt.d.ts +26 -0
- package/lib/locales/pt.js +49 -0
- package/lib/utils/index.d.ts +1 -1
- package/package.json +1 -1
- package/es/CustomCalendarHeader/index.d.ts +0 -2
- package/es/CustomCalendarHeader/index.js +0 -53
- package/es/Dialog/index.d.ts +0 -2
- package/es/Dialog/index.js +0 -25
- package/es/Drawer/index.d.ts +0 -11
- package/es/Drawer/index.js +0 -35
- package/es/Drawer/index.less +0 -40
- package/es/OldActionBar/index.d.ts +0 -19
- package/es/OldActionBar/index.js +0 -113
- package/es/OldActionBar/index.less +0 -18
- package/es/OldPisellDateRangePicker/index.d.ts +0 -79
- package/es/OldPisellDateRangePicker/index.js +0 -264
- package/es/OldPisellDateRangePicker/index.less +0 -102
- package/es/Toolbar/index.d.ts +0 -3
- package/es/Toolbar/index.js +0 -166
- package/es/Toolbar/index.less +0 -35
- package/es/browserSelect/chevron-down.png +0 -0
- package/es/browserSelect/index.d.ts +0 -15
- package/es/browserSelect/index.js +0 -36
- package/es/browserSelect/index.less +0 -18
- package/es/constants.d.ts +0 -58
- package/es/constants.js +0 -128
- package/es/hooks/useDocumentVisibility.d.ts +0 -2
- package/es/hooks/useDocumentVisibility.js +0 -27
- package/es/hooks/useNextDay.d.ts +0 -2
- package/es/hooks/useNextDay.js +0 -15
- package/es/hooks/useUpdateEffect.d.ts +0 -2
- package/es/hooks/useUpdateEffect.js +0 -11
- package/es/icon/ChevronLeft.d.ts +0 -5
- package/es/icon/ChevronLeft.js +0 -23
- package/es/icon/ChevronLeftDouble.d.ts +0 -5
- package/es/icon/ChevronLeftDouble.js +0 -23
- package/es/icon/ChevronRight.d.ts +0 -5
- package/es/icon/ChevronRight.js +0 -23
- package/es/icon/ChevronRightDouble.d.ts +0 -5
- package/es/icon/ChevronRightDouble.js +0 -23
- package/es/icon/CloseCircle.d.ts +0 -5
- package/es/icon/CloseCircle.js +0 -26
- package/lib/CustomCalendarHeader/index.d.ts +0 -2
- package/lib/CustomCalendarHeader/index.js +0 -58
- package/lib/Dialog/index.d.ts +0 -2
- package/lib/Dialog/index.js +0 -65
- package/lib/Drawer/index.d.ts +0 -11
- package/lib/Drawer/index.js +0 -62
- package/lib/Drawer/index.less +0 -40
- package/lib/OldActionBar/index.d.ts +0 -19
- package/lib/OldActionBar/index.js +0 -129
- package/lib/OldActionBar/index.less +0 -18
- package/lib/OldPisellDateRangePicker/index.d.ts +0 -79
- package/lib/OldPisellDateRangePicker/index.js +0 -281
- package/lib/OldPisellDateRangePicker/index.less +0 -102
- package/lib/Toolbar/index.d.ts +0 -3
- package/lib/Toolbar/index.js +0 -193
- package/lib/Toolbar/index.less +0 -35
- package/lib/browserSelect/chevron-down.png +0 -0
- package/lib/browserSelect/index.d.ts +0 -15
- package/lib/browserSelect/index.js +0 -59
- package/lib/browserSelect/index.less +0 -18
- package/lib/constants.d.ts +0 -58
- package/lib/constants.js +0 -217
- package/lib/hooks/useDocumentVisibility.d.ts +0 -2
- package/lib/hooks/useDocumentVisibility.js +0 -40
- package/lib/hooks/useNextDay.d.ts +0 -2
- package/lib/hooks/useNextDay.js +0 -49
- package/lib/hooks/useUpdateEffect.d.ts +0 -2
- package/lib/hooks/useUpdateEffect.js +0 -35
- package/lib/icon/ChevronLeft.d.ts +0 -5
- package/lib/icon/ChevronLeft.js +0 -60
- package/lib/icon/ChevronLeftDouble.d.ts +0 -5
- package/lib/icon/ChevronLeftDouble.js +0 -60
- package/lib/icon/ChevronRight.d.ts +0 -5
- package/lib/icon/ChevronRight.js +0 -60
- package/lib/icon/ChevronRightDouble.d.ts +0 -5
- package/lib/icon/ChevronRightDouble.js +0 -60
- package/lib/icon/CloseCircle.d.ts +0 -5
- package/lib/icon/CloseCircle.js +0 -67
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { Dayjs } from 'dayjs';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { ButtonProps } from 'antd';
|
|
4
|
-
import { PopperPlacementType } from '@mui/base/Popper/Popper.types';
|
|
5
|
-
import { PresetType } from '../Shortcuts';
|
|
6
|
-
import 'dayjs/locale/zh-cn';
|
|
7
|
-
import 'dayjs/locale/en';
|
|
8
|
-
import 'dayjs/locale/zh-tw';
|
|
9
|
-
import './index.less';
|
|
10
|
-
export interface PisellDateRangePickerProps {
|
|
11
|
-
/** 再次选择日期时是否清除结束时间 */
|
|
12
|
-
clearEndOnSelection?: boolean;
|
|
13
|
-
/** 日期选择确认回调 */
|
|
14
|
-
onChange?: (day: (Dayjs | null)[]) => void;
|
|
15
|
-
/** 日期改变回调 此处只为了组件外拿到当前日期项进行状态操作 通常情况下只使用onChange来拿value */
|
|
16
|
-
onDateChange?: (day: (Dayjs | null)[]) => void;
|
|
17
|
-
/** 日期选择值 */
|
|
18
|
-
value?: Dayjs[];
|
|
19
|
-
/** 日期选择默认值 */
|
|
20
|
-
defaultValue?: Dayjs[];
|
|
21
|
-
/** 快捷选择项 */
|
|
22
|
-
presets?: PresetType[];
|
|
23
|
-
/** 类名 */
|
|
24
|
-
className?: string;
|
|
25
|
-
/** 是否显示时间选择 这里参数为antd TimePickerProps */
|
|
26
|
-
showTime?: boolean | {
|
|
27
|
-
defaultValue: Dayjs;
|
|
28
|
-
[key: string]: any;
|
|
29
|
-
}[];
|
|
30
|
-
/** 占位符 */
|
|
31
|
-
placeholder?: string;
|
|
32
|
-
/** 是否禁用日期 */
|
|
33
|
-
disabledDate?: (day: Dayjs, position: 'start' | 'end', value: Dayjs[]) => boolean;
|
|
34
|
-
/** 日期格式 */
|
|
35
|
-
format?: string;
|
|
36
|
-
/** 后缀图标 */
|
|
37
|
-
suffixIcon?: React.ReactNode;
|
|
38
|
-
/** 是否显示边框 */
|
|
39
|
-
bordered?: boolean;
|
|
40
|
-
/** 是否打开日期选择 */
|
|
41
|
-
open?: boolean;
|
|
42
|
-
/** 关闭回调 */
|
|
43
|
-
onClose?: () => void;
|
|
44
|
-
/** 打开回调 */
|
|
45
|
-
onOpen?: () => void;
|
|
46
|
-
/** 弹窗宽度 */
|
|
47
|
-
popupWidth?: number;
|
|
48
|
-
/** 最小日期 */
|
|
49
|
-
minDate?: Dayjs;
|
|
50
|
-
/** 最大日期 */
|
|
51
|
-
maxDate?: Dayjs;
|
|
52
|
-
/** 月份切换事件 */
|
|
53
|
-
onMonthChange?: (value: Dayjs) => void;
|
|
54
|
-
/** 额外的弹出日历 className */
|
|
55
|
-
popupClassName?: string;
|
|
56
|
-
/** 默认显示月份 */
|
|
57
|
-
defaultCalendarMonth?: Dayjs;
|
|
58
|
-
/** ok 按钮 props */
|
|
59
|
-
okButtonProps?: ButtonProps;
|
|
60
|
-
/** cancel 按钮 props */
|
|
61
|
-
cancelButtonProps?: ButtonProps;
|
|
62
|
-
/**
|
|
63
|
-
* CSS media query when `Mobile` mode will be changed to `Desktop`.
|
|
64
|
-
* @default '@media (pointer: fine)'
|
|
65
|
-
* @example '@media (min-width: 720px)' or theme.breakpoints.up("sm")
|
|
66
|
-
*/
|
|
67
|
-
desktopModeMediaQuery?: string;
|
|
68
|
-
style?: React.CSSProperties;
|
|
69
|
-
/** 是否展示清除按钮 */
|
|
70
|
-
allowClear?: boolean;
|
|
71
|
-
/** true 将弹窗当前DOM层次结构下 false 追加到body */
|
|
72
|
-
disablePortal?: boolean;
|
|
73
|
-
/** 弹窗放置位置 */
|
|
74
|
-
placement?: PopperPlacementType;
|
|
75
|
-
/** 输入框只读 */
|
|
76
|
-
inputReadOnly: boolean;
|
|
77
|
-
}
|
|
78
|
-
declare const PisellDateRangePicker: (props: PisellDateRangePickerProps) => JSX.Element;
|
|
79
|
-
export default PisellDateRangePicker;
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
-
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."); }
|
|
9
|
-
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); }
|
|
10
|
-
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; }
|
|
11
|
-
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; } }
|
|
12
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import React, { useState, useEffect, useMemo, useContext } from 'react';
|
|
14
|
-
import { DateRangePicker } from "../DateRangePicker";
|
|
15
|
-
import ActionBar from "../OldActionBar";
|
|
16
|
-
import Shortcuts from "../Shortcuts";
|
|
17
|
-
import { SingleInputDateRangeField } from "../SingleInputDateRangeField";
|
|
18
|
-
import classNames from 'classnames';
|
|
19
|
-
import { isArr, isBoolean } from '@pisell/utils';
|
|
20
|
-
import useCssVariables from "../PisellDateRangePicker/useCssVariables";
|
|
21
|
-
import CloseCircle from "../icon/CloseCircle";
|
|
22
|
-
import 'dayjs/locale/zh-cn';
|
|
23
|
-
import 'dayjs/locale/en';
|
|
24
|
-
import 'dayjs/locale/zh-tw';
|
|
25
|
-
import { getCurrentLocale, isMobile } from "../utils";
|
|
26
|
-
import { LocaleContext } from "../PisellDateRangePicker/LocaleContext";
|
|
27
|
-
import { pLocaleMap } from "../locales";
|
|
28
|
-
import "./index.less";
|
|
29
|
-
var transDayjsArr = function transDayjsArr(dayjsArr, defaultValue) {
|
|
30
|
-
var _newArr;
|
|
31
|
-
var newArr = dayjsArr || defaultValue || [null, null];
|
|
32
|
-
if ((dayjsArr === null || dayjsArr === void 0 ? void 0 : dayjsArr.length) === 0) {
|
|
33
|
-
newArr = defaultValue || [null, null];
|
|
34
|
-
}
|
|
35
|
-
return (_newArr = newArr) === null || _newArr === void 0 ? void 0 : _newArr.map(function (item) {
|
|
36
|
-
return item ? item : null;
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
// api详情
|
|
40
|
-
// https://mui.com/x/api/date-pickers/date-range-picker/
|
|
41
|
-
var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
42
|
-
var propsOnChange = props.onChange,
|
|
43
|
-
propsValue = props.value,
|
|
44
|
-
_props$presets = props.presets,
|
|
45
|
-
presets = _props$presets === void 0 ? [] : _props$presets,
|
|
46
|
-
className = props.className,
|
|
47
|
-
showTime = props.showTime,
|
|
48
|
-
placeholder = props.placeholder,
|
|
49
|
-
disabledDate = props.disabledDate,
|
|
50
|
-
propsFormat = props.format,
|
|
51
|
-
defaultValue = props.defaultValue,
|
|
52
|
-
suffixIcon = props.suffixIcon,
|
|
53
|
-
_props$bordered = props.bordered,
|
|
54
|
-
bordered = _props$bordered === void 0 ? true : _props$bordered,
|
|
55
|
-
propsOpen = props.open,
|
|
56
|
-
onClose = props.onClose,
|
|
57
|
-
_props$popupWidth = props.popupWidth,
|
|
58
|
-
popupWidth = _props$popupWidth === void 0 ? 625 : _props$popupWidth,
|
|
59
|
-
clearEndOnSelection = props.clearEndOnSelection,
|
|
60
|
-
minDate = props.minDate,
|
|
61
|
-
maxDate = props.maxDate,
|
|
62
|
-
onOpen = props.onOpen,
|
|
63
|
-
onMonthChange = props.onMonthChange,
|
|
64
|
-
popupClassName = props.popupClassName,
|
|
65
|
-
defaultCalendarMonth = props.defaultCalendarMonth,
|
|
66
|
-
okButtonProps = props.okButtonProps,
|
|
67
|
-
cancelButtonProps = props.cancelButtonProps,
|
|
68
|
-
onDateChange = props.onDateChange,
|
|
69
|
-
desktopModeMediaQuery = props.desktopModeMediaQuery,
|
|
70
|
-
style = props.style,
|
|
71
|
-
allowClear = props.allowClear,
|
|
72
|
-
disablePortal = props.disablePortal,
|
|
73
|
-
_props$placement = props.placement,
|
|
74
|
-
placement = _props$placement === void 0 ? 'auto' : _props$placement,
|
|
75
|
-
inputReadOnly = props.inputReadOnly;
|
|
76
|
-
var _useState = useState(propsOpen !== null && propsOpen !== void 0 ? propsOpen : false),
|
|
77
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
78
|
-
open = _useState2[0],
|
|
79
|
-
setOpen = _useState2[1];
|
|
80
|
-
var _ref = useContext(LocaleContext) || {},
|
|
81
|
-
locale = _ref.locale;
|
|
82
|
-
useEffect(function () {
|
|
83
|
-
isBoolean(propsOpen) && setOpen(propsOpen);
|
|
84
|
-
}, [propsOpen]);
|
|
85
|
-
var _useState3 = useState(function () {
|
|
86
|
-
return transDayjsArr(propsValue, defaultValue);
|
|
87
|
-
}),
|
|
88
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
89
|
-
_value = _useState4[0],
|
|
90
|
-
setValue = _useState4[1];
|
|
91
|
-
useEffect(function () {
|
|
92
|
-
setValue(transDayjsArr(propsValue, defaultValue));
|
|
93
|
-
}, [propsValue]);
|
|
94
|
-
var handleOpen = function handleOpen() {
|
|
95
|
-
setOpen(true);
|
|
96
|
-
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
97
|
-
};
|
|
98
|
-
var handleClose = function handleClose() {
|
|
99
|
-
setOpen(false);
|
|
100
|
-
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
101
|
-
onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(transDayjsArr(propsValue, defaultValue));
|
|
102
|
-
setValue(transDayjsArr(propsValue, defaultValue));
|
|
103
|
-
};
|
|
104
|
-
var handleOk = function handleOk() {
|
|
105
|
-
setOpen(false);
|
|
106
|
-
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
107
|
-
propsOnChange === null || propsOnChange === void 0 ? void 0 : propsOnChange(_value);
|
|
108
|
-
};
|
|
109
|
-
var _presets = useMemo(function () {
|
|
110
|
-
if (isMobile()) return [];
|
|
111
|
-
return presets.map(function (item) {
|
|
112
|
-
var getValue = function getValue() {
|
|
113
|
-
if (typeof item.getValue === 'function') {
|
|
114
|
-
return item.getValue();
|
|
115
|
-
}
|
|
116
|
-
return item === null || item === void 0 ? void 0 : item.value;
|
|
117
|
-
};
|
|
118
|
-
return {
|
|
119
|
-
label: item.label,
|
|
120
|
-
getValue: getValue
|
|
121
|
-
};
|
|
122
|
-
});
|
|
123
|
-
}, [presets]);
|
|
124
|
-
var handleChange = function handleChange(val, type) {
|
|
125
|
-
var newVal = val;
|
|
126
|
-
if (isArr(showTime) && type !== 'time') {
|
|
127
|
-
newVal = newVal.map(function (item, index) {
|
|
128
|
-
var _showTime$index;
|
|
129
|
-
if (showTime !== null && showTime !== void 0 && (_showTime$index = showTime[index]) !== null && _showTime$index !== void 0 && _showTime$index.defaultValue) {
|
|
130
|
-
var _showTime$index2, _showTime$index2$defa, _showTime$index3, _showTime$index3$defa, _showTime$index4, _showTime$index4$defa;
|
|
131
|
-
return (item === null || item === void 0 ? void 0 : item.set('hour', (_showTime$index2 = showTime[index]) === null || _showTime$index2 === void 0 ? void 0 : (_showTime$index2$defa = _showTime$index2.defaultValue) === null || _showTime$index2$defa === void 0 ? void 0 : _showTime$index2$defa.get('hour')).set('minute', (_showTime$index3 = showTime[index]) === null || _showTime$index3 === void 0 ? void 0 : (_showTime$index3$defa = _showTime$index3.defaultValue) === null || _showTime$index3$defa === void 0 ? void 0 : _showTime$index3$defa.get('minute')).set('second', (_showTime$index4 = showTime[index]) === null || _showTime$index4 === void 0 ? void 0 : (_showTime$index4$defa = _showTime$index4.defaultValue) === null || _showTime$index4$defa === void 0 ? void 0 : _showTime$index4$defa.get('second'))) || null;
|
|
132
|
-
}
|
|
133
|
-
return item || null;
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
if (clearEndOnSelection && type !== 'set' && _value.filter(Boolean).length === 2) {
|
|
137
|
-
newVal = [newVal[0], null];
|
|
138
|
-
}
|
|
139
|
-
onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(newVal);
|
|
140
|
-
setValue(newVal);
|
|
141
|
-
};
|
|
142
|
-
var hasPreset = (_presets === null || _presets === void 0 ? void 0 : _presets.length) > 0;
|
|
143
|
-
useCssVariables({
|
|
144
|
-
variables: {
|
|
145
|
-
'--pisell-date-range-picker-popup-width': "".concat(hasPreset ? popupWidth + 192 : popupWidth, "px")
|
|
146
|
-
},
|
|
147
|
-
dom: document.body
|
|
148
|
-
});
|
|
149
|
-
var handleClear = function handleClear(e) {
|
|
150
|
-
e.stopPropagation();
|
|
151
|
-
setValue([null, null]);
|
|
152
|
-
setOpen(false);
|
|
153
|
-
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
154
|
-
propsOnChange === null || propsOnChange === void 0 ? void 0 : propsOnChange([null, null]);
|
|
155
|
-
};
|
|
156
|
-
var endAdornment = useMemo(function () {
|
|
157
|
-
if (!allowClear) {
|
|
158
|
-
return suffixIcon;
|
|
159
|
-
}
|
|
160
|
-
if (_value !== null && _value !== void 0 && _value.some(function (item) {
|
|
161
|
-
return !!item;
|
|
162
|
-
})) {
|
|
163
|
-
return /*#__PURE__*/React.createElement(CloseCircle, {
|
|
164
|
-
className: "pisell-date-range-picker-clear",
|
|
165
|
-
onClick: handleClear
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
}, [suffixIcon, allowClear, _value]);
|
|
169
|
-
var readOnlyProps = useMemo(function () {
|
|
170
|
-
if (inputReadOnly) {
|
|
171
|
-
return {
|
|
172
|
-
readOnly: true,
|
|
173
|
-
selectedSections: null
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
return {};
|
|
177
|
-
}, [inputReadOnly]);
|
|
178
|
-
var format = useMemo(function () {
|
|
179
|
-
if (propsFormat) {
|
|
180
|
-
return propsFormat;
|
|
181
|
-
}
|
|
182
|
-
var localeValue = locale;
|
|
183
|
-
if (!localeValue) {
|
|
184
|
-
localeValue = pLocaleMap[getCurrentLocale()];
|
|
185
|
-
}
|
|
186
|
-
return localeValue === 'en' || localeValue === 'en-US' ? 'DD/MM/YYYY' : 'YYYY/MM/DD';
|
|
187
|
-
}, [propsFormat, locale]);
|
|
188
|
-
console.log(_presets, presets, '_presets');
|
|
189
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
190
|
-
className: classNames(className, 'pisell-date-range-picker', 'pisell-date-range-picker-old', {
|
|
191
|
-
'pisell-date-range-picker-no-border': !bordered
|
|
192
|
-
}),
|
|
193
|
-
style: style,
|
|
194
|
-
onClick: function onClick(e) {
|
|
195
|
-
return e.stopPropagation();
|
|
196
|
-
}
|
|
197
|
-
}, /*#__PURE__*/React.createElement(DateRangePicker
|
|
198
|
-
// defaultValue={defaultValue}
|
|
199
|
-
// key={`${_value?.[0]?.valueOf()}-${_value?.[1]?.valueOf()}`}
|
|
200
|
-
, {
|
|
201
|
-
desktopModeMediaQuery: desktopModeMediaQuery,
|
|
202
|
-
onMonthChange: onMonthChange,
|
|
203
|
-
minDate: minDate,
|
|
204
|
-
maxDate: maxDate,
|
|
205
|
-
format: format,
|
|
206
|
-
label: placeholder,
|
|
207
|
-
value: _value,
|
|
208
|
-
closeOnSelect: false,
|
|
209
|
-
onClose: handleClose,
|
|
210
|
-
onChange: handleChange,
|
|
211
|
-
onOpen: handleOpen,
|
|
212
|
-
open: open,
|
|
213
|
-
defaultCalendarMonth: defaultCalendarMonth,
|
|
214
|
-
shouldDisableDate: function shouldDisableDate(current, position) {
|
|
215
|
-
return disabledDate === null || disabledDate === void 0 ? void 0 : disabledDate(current, position, _value);
|
|
216
|
-
},
|
|
217
|
-
slots: {
|
|
218
|
-
actionBar: ActionBar,
|
|
219
|
-
shortcuts: Shortcuts,
|
|
220
|
-
field: SingleInputDateRangeField
|
|
221
|
-
},
|
|
222
|
-
dayOfWeekFormatter: function dayOfWeekFormatter(day) {
|
|
223
|
-
return day;
|
|
224
|
-
},
|
|
225
|
-
slotProps: {
|
|
226
|
-
shortcuts: {
|
|
227
|
-
items: _presets,
|
|
228
|
-
changeImportance: 'set',
|
|
229
|
-
onChange: handleChange
|
|
230
|
-
},
|
|
231
|
-
actionBar: {
|
|
232
|
-
onOk: handleOk,
|
|
233
|
-
onCancel: handleClose,
|
|
234
|
-
showTime: showTime,
|
|
235
|
-
onChange: handleChange,
|
|
236
|
-
value: _value,
|
|
237
|
-
okButtonProps: okButtonProps,
|
|
238
|
-
cancelButtonProps: cancelButtonProps
|
|
239
|
-
},
|
|
240
|
-
field: _objectSpread({
|
|
241
|
-
value: _value,
|
|
242
|
-
size: 'small',
|
|
243
|
-
fullWidth: true,
|
|
244
|
-
// variant: "standard",
|
|
245
|
-
// hiddenLabel: true,
|
|
246
|
-
InputProps: {
|
|
247
|
-
endAdornment: endAdornment
|
|
248
|
-
}
|
|
249
|
-
}, readOnlyProps),
|
|
250
|
-
popper: {
|
|
251
|
-
className: classNames(popupClassName, "pisell-date-range-picker-popper-old"),
|
|
252
|
-
disablePortal: disablePortal,
|
|
253
|
-
placement: placement
|
|
254
|
-
},
|
|
255
|
-
dialog: {
|
|
256
|
-
disablePortal: disablePortal
|
|
257
|
-
},
|
|
258
|
-
mobilePaper: {
|
|
259
|
-
className: popupClassName
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}));
|
|
263
|
-
};
|
|
264
|
-
export default PisellDateRangePicker;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
.pisell-date-range-picker {
|
|
2
|
-
display: inline-block;
|
|
3
|
-
width: 100%;
|
|
4
|
-
//width: 350px;
|
|
5
|
-
//.MuiInputBase-input {
|
|
6
|
-
// padding: 10px;
|
|
7
|
-
//}
|
|
8
|
-
label {
|
|
9
|
-
font-size: 14px;
|
|
10
|
-
}
|
|
11
|
-
.pisell-date-range-picker-clear {
|
|
12
|
-
color: rgba(0, 0, 0, 0.25);
|
|
13
|
-
cursor: pointer;
|
|
14
|
-
display: none;
|
|
15
|
-
line-height: 0;
|
|
16
|
-
:hover {
|
|
17
|
-
color: rgba(0, 0, 0, 0.45);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
:hover {
|
|
21
|
-
.pisell-date-range-picker-clear {
|
|
22
|
-
display: block;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
.pisell-date-range-picker-no-border {
|
|
27
|
-
.MuiOutlinedInput-notchedOutline {
|
|
28
|
-
border: none;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
.MuiOutlinedInput-notchedOutline {
|
|
32
|
-
legend {
|
|
33
|
-
color: inherit !important;
|
|
34
|
-
width: auto !important;
|
|
35
|
-
margin-bottom: 0.5em !important;
|
|
36
|
-
font-size: 1.5em !important;
|
|
37
|
-
line-height: 11px !important;
|
|
38
|
-
border: none !important;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.MuiPickersPopper-root {
|
|
43
|
-
.MuiPickersLayout-root {
|
|
44
|
-
width: var(--pisell-date-range-picker-popup-width, 625px);
|
|
45
|
-
.MuiDateRangeCalendar-root {
|
|
46
|
-
width: 100%;
|
|
47
|
-
flex: 1;
|
|
48
|
-
.MuiDateRangeCalendar-monthContainer {
|
|
49
|
-
width: 50%;
|
|
50
|
-
.MuiDayCalendar-header {
|
|
51
|
-
padding: 0 20px;
|
|
52
|
-
.MuiDayCalendar-weekDayLabel {
|
|
53
|
-
flex: 1;
|
|
54
|
-
width: 100%;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
.MuiPickersSlideTransition-root {
|
|
58
|
-
min-width: 200px;
|
|
59
|
-
//min-height: auto;
|
|
60
|
-
&::before {
|
|
61
|
-
content: "";
|
|
62
|
-
display: block;
|
|
63
|
-
padding-top: 67%;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
.MuiDayCalendar-monthContainer {
|
|
67
|
-
padding: 0 20px;
|
|
68
|
-
}
|
|
69
|
-
.MuiDayCalendar-weekContainer {
|
|
70
|
-
.MuiDateRangePickerDay-root {
|
|
71
|
-
flex: 1;
|
|
72
|
-
.MuiDateRangePickerDay-day {
|
|
73
|
-
width: 100%;
|
|
74
|
-
height: auto;
|
|
75
|
-
&::before {
|
|
76
|
-
content: "";
|
|
77
|
-
display: block;
|
|
78
|
-
padding-top: 100%;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.MuiDialog-root {
|
|
89
|
-
.MuiPickersLayout-toolbar {
|
|
90
|
-
display: none;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.MuiPickersLayout-shortcuts {
|
|
95
|
-
grid-column: 1 !important;
|
|
96
|
-
grid-row: 1/3 !important;
|
|
97
|
-
}
|
|
98
|
-
.pisell-date-range-picker-popper-old {
|
|
99
|
-
.MuiPickersLayout-root {
|
|
100
|
-
display: grid !important;
|
|
101
|
-
}
|
|
102
|
-
}
|
package/es/Toolbar/index.d.ts
DELETED
package/es/Toolbar/index.js
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
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, useRef } from 'react';
|
|
12
|
-
import { Input } from 'antd';
|
|
13
|
-
import dayjs from 'dayjs';
|
|
14
|
-
import BrowserSelect from "../browserSelect";
|
|
15
|
-
import { getText, pLocaleMap } 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
|
-
disabledDate = props.disabledDate;
|
|
30
|
-
var format = locale === 'en' || locale === 'en-US' ? 'DD/MM/YYYY' : 'YYYY/MM/DD';
|
|
31
|
-
var _useState = useState(''),
|
|
32
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
-
startStr = _useState2[0],
|
|
34
|
-
setStartStr = _useState2[1];
|
|
35
|
-
var _useState3 = useState(''),
|
|
36
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
37
|
-
endStr = _useState4[0],
|
|
38
|
-
setEndStr = _useState4[1];
|
|
39
|
-
var _useState5 = useState(false),
|
|
40
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
41
|
-
startError = _useState6[0],
|
|
42
|
-
setStartError = _useState6[1];
|
|
43
|
-
var _useState7 = useState(false),
|
|
44
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
45
|
-
endError = _useState8[0],
|
|
46
|
-
setEndError = _useState8[1];
|
|
47
|
-
var valueRef = useRef(value);
|
|
48
|
-
valueRef.current = value;
|
|
49
|
-
useEffect(function () {
|
|
50
|
-
if (value !== null && value !== void 0 && value[0]) {
|
|
51
|
-
setStartStr(value[0].format(format));
|
|
52
|
-
setStartError(false);
|
|
53
|
-
} else {
|
|
54
|
-
setStartStr('');
|
|
55
|
-
}
|
|
56
|
-
if (value !== null && value !== void 0 && value[1]) {
|
|
57
|
-
setEndStr(value[1].format(format));
|
|
58
|
-
setEndError(false);
|
|
59
|
-
} else {
|
|
60
|
-
setEndStr('');
|
|
61
|
-
}
|
|
62
|
-
}, [value]);
|
|
63
|
-
var checkDateDisabled = function checkDateDisabled(position) {
|
|
64
|
-
var val = valueRef.current;
|
|
65
|
-
if (position === 'start' && val[0] && disabledDate !== null && disabledDate !== void 0 && disabledDate(val[1], position, val)) {
|
|
66
|
-
setStartError(true);
|
|
67
|
-
onChange([null, val[1]], 'write');
|
|
68
|
-
}
|
|
69
|
-
if (position === 'end' && val[1] && disabledDate !== null && disabledDate !== void 0 && disabledDate(val[1], position, val)) {
|
|
70
|
-
setEndError(true);
|
|
71
|
-
onChange([val[0], null], 'write');
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
var handleStartChange = function handleStartChange(e) {
|
|
75
|
-
var val = e.target.value;
|
|
76
|
-
setStartStr(val);
|
|
77
|
-
var objValue = dayjs(val, format);
|
|
78
|
-
if (isValidDate(val, format) && (value[1] ? objValue <= value[1] : true) && !(disabledDate !== null && disabledDate !== void 0 && disabledDate(objValue, 'start', value))) {
|
|
79
|
-
var _start$set, _start$set$set;
|
|
80
|
-
setStartError(false);
|
|
81
|
-
var valDate = dayjs(val, format);
|
|
82
|
-
var newValue = _toConsumableArray(value);
|
|
83
|
-
var start = newValue[0] || dayjs();
|
|
84
|
-
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;
|
|
85
|
-
onChange(newValue, 'write');
|
|
86
|
-
} else {
|
|
87
|
-
setStartError(true);
|
|
88
|
-
}
|
|
89
|
-
setTimeout(function () {
|
|
90
|
-
checkDateDisabled('end');
|
|
91
|
-
}, 200);
|
|
92
|
-
};
|
|
93
|
-
var handleEndChange = function handleEndChange(e) {
|
|
94
|
-
var val = e.target.value;
|
|
95
|
-
setEndStr(val);
|
|
96
|
-
var objValue = dayjs(val, format);
|
|
97
|
-
if (isValidDate(val, format) && (value[0] ? objValue >= value[0] : true) && !(disabledDate !== null && disabledDate !== void 0 && disabledDate(objValue, 'end', value))) {
|
|
98
|
-
var _end$set, _end$set$set;
|
|
99
|
-
setEndError(false);
|
|
100
|
-
var valDate = dayjs(val, format);
|
|
101
|
-
var newValue = _toConsumableArray(value);
|
|
102
|
-
var end = newValue[1] || dayjs();
|
|
103
|
-
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;
|
|
104
|
-
onChange(newValue, 'write');
|
|
105
|
-
} else {
|
|
106
|
-
setEndError(true);
|
|
107
|
-
}
|
|
108
|
-
setTimeout(function () {
|
|
109
|
-
checkDateDisabled('start');
|
|
110
|
-
}, 200);
|
|
111
|
-
};
|
|
112
|
-
var handleSelectChange = function handleSelectChange(e) {
|
|
113
|
-
var val = e.target.value;
|
|
114
|
-
var detail = presetItems.find(function (item) {
|
|
115
|
-
return item.value === val || item.label === val;
|
|
116
|
-
});
|
|
117
|
-
if (!detail) return;
|
|
118
|
-
var dateVal = detail.getValue();
|
|
119
|
-
onChange(dateVal, 'shortcuts', val);
|
|
120
|
-
};
|
|
121
|
-
var customPresetItems = useMemo(function () {
|
|
122
|
-
if (!currentShortcut) {
|
|
123
|
-
return presetItems.concat([{
|
|
124
|
-
label: getText('toolbar-date-range-shortcut-custom', pLocaleMap[locale]),
|
|
125
|
-
value: getText('toolbar-date-range-shortcut-custom', pLocaleMap[locale])
|
|
126
|
-
}]);
|
|
127
|
-
}
|
|
128
|
-
return presetItems;
|
|
129
|
-
}, [presetItems, currentShortcut]);
|
|
130
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
131
|
-
className: "date-picker-toolbar"
|
|
132
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
133
|
-
className: "date-picker-content-top"
|
|
134
|
-
}, /*#__PURE__*/React.createElement("span", null, getText('toolbar-date-range-shortcut-date-range', pLocaleMap[locale])), /*#__PURE__*/React.createElement(BrowserSelect
|
|
135
|
-
// @ts-ignore
|
|
136
|
-
, {
|
|
137
|
-
value: currentShortcut || getText('toolbar-date-range-shortcut-custom', pLocaleMap[locale]),
|
|
138
|
-
className: "date-picker-toolbar-select",
|
|
139
|
-
options: customPresetItems,
|
|
140
|
-
size: 'large',
|
|
141
|
-
onChange: handleSelectChange
|
|
142
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
143
|
-
className: "date-picker-content-bottom"
|
|
144
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
145
|
-
className: "date-picker-toolbar-start-wrap"
|
|
146
|
-
}, /*#__PURE__*/React.createElement("span", null, getText('toolbar-date-range-shortcut-starting', pLocaleMap[locale])), /*#__PURE__*/React.createElement(Input, {
|
|
147
|
-
status: startError ? 'error' : '',
|
|
148
|
-
size: "large",
|
|
149
|
-
value: startStr,
|
|
150
|
-
onChange: handleStartChange,
|
|
151
|
-
placeholder: dayjs().format(format)
|
|
152
|
-
}), startError && /*#__PURE__*/React.createElement("span", {
|
|
153
|
-
className: "date-picker-error"
|
|
154
|
-
}, getText('toolbar-date-range-invalid-start-date', pLocaleMap[locale]))), /*#__PURE__*/React.createElement("div", {
|
|
155
|
-
className: "date-picker-toolbar-end-wrap"
|
|
156
|
-
}, /*#__PURE__*/React.createElement("span", null, getText('toolbar-date-range-shortcut-ending', pLocaleMap[locale])), /*#__PURE__*/React.createElement(Input, {
|
|
157
|
-
status: endError ? 'error' : '',
|
|
158
|
-
size: "large",
|
|
159
|
-
value: endStr,
|
|
160
|
-
onChange: handleEndChange,
|
|
161
|
-
placeholder: dayjs().format(format)
|
|
162
|
-
}), endError && /*#__PURE__*/React.createElement("span", {
|
|
163
|
-
className: "date-picker-error"
|
|
164
|
-
}, getText('toolbar-date-range-invalid-end-date', pLocaleMap[locale])))));
|
|
165
|
-
};
|
|
166
|
-
export default Toolbar;
|
package/es/Toolbar/index.less
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
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
|
-
.date-picker-error {
|
|
33
|
-
color: #d4163a;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
Binary file
|
|
@@ -1,15 +0,0 @@
|
|
|
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;
|