@pisell/date-picker 1.0.112 → 3.0.1
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/CustomCalendarHeader/index.d.ts +2 -0
- package/es/DesktopDateRangePicker/DesktopDateRangePicker.d.ts +7 -0
- package/es/Dialog/index.d.ts +2 -0
- package/es/Drawer/index.d.ts +11 -0
- package/es/MobileDateRangePicker/MobileDateRangePicker.d.ts +7 -0
- package/es/PisellDateRangePicker/LocaleContext.d.ts +2 -0
- package/es/PisellDateRangePicker/index.d.ts +2 -0
- package/es/PisellDateRangePicker/index.js +13 -2
- package/es/Shortcuts/index.d.ts +15 -0
- package/es/Toolbar/index.d.ts +0 -1
- package/es/Toolbar/index.js +4 -3
- package/es/browserSelect/index.d.ts +15 -0
- package/es/hooks/useDocumentVisibility.d.ts +2 -0
- package/es/hooks/useNextDay.d.ts +2 -0
- package/es/hooks/useUpdateEffect.d.ts +2 -0
- package/es/icon/ChevronLeft.d.ts +5 -0
- package/es/icon/ChevronLeftDouble.d.ts +5 -0
- package/es/icon/ChevronRight.d.ts +5 -0
- package/es/icon/ChevronRightDouble.d.ts +5 -0
- package/es/icon/CloseCircle.d.ts +5 -0
- package/es/internals/utils/date-fields-utils.d.ts +1 -1
- package/es/locales/en-US.d.ts +26 -0
- package/es/locales/zh-CN.d.ts +26 -0
- package/es/locales/zh-TW.d.ts +26 -0
- package/lib/CustomCalendarHeader/index.d.ts +2 -0
- package/lib/DesktopDateRangePicker/DesktopDateRangePicker.d.ts +7 -0
- package/lib/Dialog/index.d.ts +2 -0
- package/lib/Drawer/index.d.ts +11 -0
- package/lib/MobileDateRangePicker/MobileDateRangePicker.d.ts +7 -0
- package/lib/PisellDateRangePicker/LocaleContext.d.ts +2 -0
- package/lib/PisellDateRangePicker/index.d.ts +2 -0
- package/lib/PisellDateRangePicker/index.js +9 -2
- package/lib/Shortcuts/index.d.ts +15 -0
- package/lib/Toolbar/index.d.ts +0 -1
- package/lib/Toolbar/index.js +5 -3
- package/lib/browserSelect/index.d.ts +15 -0
- package/lib/hooks/useDocumentVisibility.d.ts +2 -0
- package/lib/hooks/useNextDay.d.ts +2 -0
- package/lib/hooks/useUpdateEffect.d.ts +2 -0
- package/lib/icon/ChevronLeft.d.ts +5 -0
- package/lib/icon/ChevronLeftDouble.d.ts +5 -0
- package/lib/icon/ChevronRight.d.ts +5 -0
- package/lib/icon/ChevronRightDouble.d.ts +5 -0
- package/lib/icon/CloseCircle.d.ts +5 -0
- package/lib/internals/utils/date-fields-utils.d.ts +1 -1
- package/lib/locales/en-US.d.ts +26 -0
- package/lib/locales/zh-CN.d.ts +26 -0
- package/lib/locales/zh-TW.d.ts +26 -0
- package/package.json +2 -2
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { DesktopDateRangePickerProps } from './DesktopDateRangePicker.types';
|
|
3
|
+
declare type DesktopDateRangePickerComponent = (<TDate>(props: DesktopDateRangePickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => JSX.Element) & {
|
|
4
|
+
propTypes?: any;
|
|
5
|
+
};
|
|
6
|
+
declare const DesktopDateRangePicker: DesktopDateRangePickerComponent;
|
|
7
|
+
export { DesktopDateRangePicker };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
interface DrawerProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
height?: number;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const Drawer: (props: DrawerProps) => JSX.Element | null;
|
|
11
|
+
export default Drawer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MobileDateRangePickerProps } from './MobileDateRangePicker.types';
|
|
3
|
+
declare type MobileDateRangePickerComponent = (<TDate>(props: MobileDateRangePickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => JSX.Element) & {
|
|
4
|
+
propTypes?: any;
|
|
5
|
+
};
|
|
6
|
+
declare const MobileDateRangePicker: MobileDateRangePickerComponent;
|
|
7
|
+
export { MobileDateRangePicker };
|
|
@@ -76,6 +76,8 @@ export interface PisellDateRangePickerProps {
|
|
|
76
76
|
inputReadOnly: boolean;
|
|
77
77
|
/** 使用快捷筛选时返回快捷字符串 */
|
|
78
78
|
returnShortcutString?: boolean;
|
|
79
|
+
isHideCustomSelect?: boolean;
|
|
80
|
+
endDateDays?: number;
|
|
79
81
|
}
|
|
80
82
|
declare const PisellDateRangePicker: (props: PisellDateRangePickerProps) => JSX.Element;
|
|
81
83
|
export default PisellDateRangePicker;
|
|
@@ -10,6 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
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
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
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import dayjs from 'dayjs';
|
|
13
14
|
import React, { useState, useEffect, useMemo, useContext, useRef } from 'react';
|
|
14
15
|
import { DateRangePicker } from "../DateRangePicker";
|
|
15
16
|
import ActionBar from "../ActionBar";
|
|
@@ -81,7 +82,11 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
81
82
|
_props$inputReadOnly = props.inputReadOnly,
|
|
82
83
|
inputReadOnly = _props$inputReadOnly === void 0 ? true : _props$inputReadOnly,
|
|
83
84
|
_props$returnShortcut = props.returnShortcutString,
|
|
84
|
-
returnShortcutString = _props$returnShortcut === void 0 ? false : _props$returnShortcut
|
|
85
|
+
returnShortcutString = _props$returnShortcut === void 0 ? false : _props$returnShortcut,
|
|
86
|
+
_props$isHideCustomSe = props.isHideCustomSelect,
|
|
87
|
+
isHideCustomSelect = _props$isHideCustomSe === void 0 ? false : _props$isHideCustomSe,
|
|
88
|
+
_props$endDateDays = props.endDateDays,
|
|
89
|
+
endDateDays = _props$endDateDays === void 0 ? 0 : _props$endDateDays;
|
|
85
90
|
var _useState = useState(propsOpen !== null && propsOpen !== void 0 ? propsOpen : false),
|
|
86
91
|
_useState2 = _slicedToArray(_useState, 2),
|
|
87
92
|
open = _useState2[0],
|
|
@@ -162,6 +167,11 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
162
167
|
if (!clearEndOnSelection && !['time', 'write', 'shortcuts'].includes(type)) {
|
|
163
168
|
if (rangePosition === 'start') {
|
|
164
169
|
newVal = [newVal[0], newVal[0]];
|
|
170
|
+
|
|
171
|
+
// 默认结束日期为开始日期加n天
|
|
172
|
+
if (endDateDays) {
|
|
173
|
+
newVal = [newVal[0], dayjs(newVal[0]).add(endDateDays, 'day')];
|
|
174
|
+
}
|
|
165
175
|
}
|
|
166
176
|
if (!newVal[1]) {
|
|
167
177
|
newVal = [newVal[0], newVal[0]];
|
|
@@ -330,7 +340,8 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
330
340
|
currentShortcut: currentShortcut,
|
|
331
341
|
setCurrentShortcut: setCurrentShortcut,
|
|
332
342
|
disabledDate: disabledDate,
|
|
333
|
-
value: _value
|
|
343
|
+
value: _value,
|
|
344
|
+
isHideCustomSelect: isHideCustomSelect
|
|
334
345
|
},
|
|
335
346
|
layout: {
|
|
336
347
|
orientation: 'portrait'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./index.less";
|
|
2
|
+
import { Dayjs } from "dayjs";
|
|
3
|
+
export declare type PresetType = {
|
|
4
|
+
label?: string;
|
|
5
|
+
getValue?: () => [Dayjs, Dayjs];
|
|
6
|
+
value: [Dayjs, Dayjs] | "today" | "yesterday" | "last_3_days" | "last_7_days" | "last_30_days" | "last_90_days" | "last_180_days" | "tomorrow" | "next_3_days" | "next_7_days" | "next_30_days" | "next_90_days" | "next_180_days";
|
|
7
|
+
key?: string;
|
|
8
|
+
};
|
|
9
|
+
interface ShortcutsProps {
|
|
10
|
+
items: PresetType[];
|
|
11
|
+
onChange: (day: [Dayjs, Dayjs], changeImportance?: "accept" | "set") => void;
|
|
12
|
+
changeImportance?: "accept" | "set";
|
|
13
|
+
}
|
|
14
|
+
declare const Shortcuts: (props: ShortcutsProps) => JSX.Element | null;
|
|
15
|
+
export default Shortcuts;
|
package/es/Toolbar/index.d.ts
CHANGED
package/es/Toolbar/index.js
CHANGED
|
@@ -27,7 +27,8 @@ var Toolbar = function Toolbar(props) {
|
|
|
27
27
|
currentShortcut = props.currentShortcut,
|
|
28
28
|
setCurrentShortcut = props.setCurrentShortcut,
|
|
29
29
|
disabledDate = props.disabledDate,
|
|
30
|
-
hidden = props.hidden
|
|
30
|
+
hidden = props.hidden,
|
|
31
|
+
isHideCustomSelect = props.isHideCustomSelect;
|
|
31
32
|
var format = locale === 'en' || locale === 'en-US' ? 'DD/MM/YYYY' : 'YYYY/MM/DD';
|
|
32
33
|
var _useState = useState(''),
|
|
33
34
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -133,7 +134,7 @@ var Toolbar = function Toolbar(props) {
|
|
|
133
134
|
}
|
|
134
135
|
return /*#__PURE__*/React.createElement("div", {
|
|
135
136
|
className: "date-picker-toolbar"
|
|
136
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
137
|
+
}, !isHideCustomSelect ? /*#__PURE__*/React.createElement("div", {
|
|
137
138
|
className: "date-picker-content-top"
|
|
138
139
|
}, /*#__PURE__*/React.createElement("span", null, getText('toolbar-date-range-shortcut-date-range', pLocaleMap[locale])), /*#__PURE__*/React.createElement(BrowserSelect
|
|
139
140
|
// @ts-ignore
|
|
@@ -143,7 +144,7 @@ var Toolbar = function Toolbar(props) {
|
|
|
143
144
|
options: customPresetItems,
|
|
144
145
|
size: 'large',
|
|
145
146
|
onChange: handleSelectChange
|
|
146
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
147
|
+
})) : null, /*#__PURE__*/React.createElement("div", {
|
|
147
148
|
className: "date-picker-content-bottom"
|
|
148
149
|
}, /*#__PURE__*/React.createElement("div", {
|
|
149
150
|
className: "date-picker-toolbar-start-wrap"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
interface BrowserSelectProps extends React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement> {
|
|
4
|
+
options: any[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* @title: 系统级别的下拉框
|
|
8
|
+
* @description:
|
|
9
|
+
* @param {BrowserSelectProps} props
|
|
10
|
+
* @return {*}
|
|
11
|
+
* @Author: zhiwei.Wang
|
|
12
|
+
* @Date: 2024-01-30 16:43
|
|
13
|
+
*/
|
|
14
|
+
declare const BrowserSelect: (props: BrowserSelectProps) => JSX.Element;
|
|
15
|
+
export default BrowserSelect;
|
|
@@ -5,7 +5,7 @@ export declare const splitDateRangeSections: (sections: RangeFieldSection[]) =>
|
|
|
5
5
|
};
|
|
6
6
|
export declare const removeLastSeparator: (dateSections: RangeFieldSection[]) => (RangeFieldSection | {
|
|
7
7
|
separator: null;
|
|
8
|
-
dateName: "
|
|
8
|
+
dateName: "start" | "end";
|
|
9
9
|
value: string;
|
|
10
10
|
format: string;
|
|
11
11
|
maxLength: number | null;
|
|
@@ -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,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-date-range": string;
|
|
7
|
+
"toolbar-date-range-shortcut-starting": string;
|
|
8
|
+
"toolbar-date-range-shortcut-ending": string;
|
|
9
|
+
"toolbar-date-range-shortcut-custom": string;
|
|
10
|
+
"toolbar-date-range-shortcut-today": string;
|
|
11
|
+
"toolbar-date-range-shortcut-yesterday": string;
|
|
12
|
+
"toolbar-date-range-shortcut-tomorrow": string;
|
|
13
|
+
"toolbar-date-range-shortcut-last-3-days": string;
|
|
14
|
+
"toolbar-date-range-shortcut-last-7-days": string;
|
|
15
|
+
"toolbar-date-range-shortcut-last-30-days": string;
|
|
16
|
+
"toolbar-date-range-shortcut-last-90-days": string;
|
|
17
|
+
"toolbar-date-range-shortcut-last-180-days": string;
|
|
18
|
+
"toolbar-date-range-shortcut-next-3-days": string;
|
|
19
|
+
"toolbar-date-range-shortcut-next-7-days": string;
|
|
20
|
+
"toolbar-date-range-shortcut-next-30-days": string;
|
|
21
|
+
"toolbar-date-range-shortcut-next-90-days": string;
|
|
22
|
+
"toolbar-date-range-shortcut-next-180-days": string;
|
|
23
|
+
"toolbar-date-range-invalid-start-date": string;
|
|
24
|
+
"toolbar-date-range-invalid-end-date": string;
|
|
25
|
+
};
|
|
26
|
+
export default _default;
|
|
@@ -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,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { DesktopDateRangePickerProps } from './DesktopDateRangePicker.types';
|
|
3
|
+
declare type DesktopDateRangePickerComponent = (<TDate>(props: DesktopDateRangePickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => JSX.Element) & {
|
|
4
|
+
propTypes?: any;
|
|
5
|
+
};
|
|
6
|
+
declare const DesktopDateRangePicker: DesktopDateRangePickerComponent;
|
|
7
|
+
export { DesktopDateRangePicker };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
interface DrawerProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
height?: number;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const Drawer: (props: DrawerProps) => JSX.Element | null;
|
|
11
|
+
export default Drawer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MobileDateRangePickerProps } from './MobileDateRangePicker.types';
|
|
3
|
+
declare type MobileDateRangePickerComponent = (<TDate>(props: MobileDateRangePickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => JSX.Element) & {
|
|
4
|
+
propTypes?: any;
|
|
5
|
+
};
|
|
6
|
+
declare const MobileDateRangePicker: MobileDateRangePickerComponent;
|
|
7
|
+
export { MobileDateRangePicker };
|
|
@@ -76,6 +76,8 @@ export interface PisellDateRangePickerProps {
|
|
|
76
76
|
inputReadOnly: boolean;
|
|
77
77
|
/** 使用快捷筛选时返回快捷字符串 */
|
|
78
78
|
returnShortcutString?: boolean;
|
|
79
|
+
isHideCustomSelect?: boolean;
|
|
80
|
+
endDateDays?: number;
|
|
79
81
|
}
|
|
80
82
|
declare const PisellDateRangePicker: (props: PisellDateRangePickerProps) => JSX.Element;
|
|
81
83
|
export default PisellDateRangePicker;
|
|
@@ -32,6 +32,7 @@ __export(PisellDateRangePicker_exports, {
|
|
|
32
32
|
default: () => PisellDateRangePicker_default
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(PisellDateRangePicker_exports);
|
|
35
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
35
36
|
var import_react = __toESM(require("react"));
|
|
36
37
|
var import_DateRangePicker = require("../DateRangePicker");
|
|
37
38
|
var import_ActionBar = __toESM(require("../ActionBar"));
|
|
@@ -96,7 +97,9 @@ var PisellDateRangePicker = (props) => {
|
|
|
96
97
|
disablePortal,
|
|
97
98
|
placement = "auto",
|
|
98
99
|
inputReadOnly = true,
|
|
99
|
-
returnShortcutString = false
|
|
100
|
+
returnShortcutString = false,
|
|
101
|
+
isHideCustomSelect = false,
|
|
102
|
+
endDateDays = 0
|
|
100
103
|
} = props;
|
|
101
104
|
const [open, setOpen] = (0, import_react.useState)(propsOpen ?? false);
|
|
102
105
|
const { locale } = (0, import_react.useContext)(import_LocaleContext.LocaleContext) || {};
|
|
@@ -163,6 +166,9 @@ var PisellDateRangePicker = (props) => {
|
|
|
163
166
|
if (!clearEndOnSelection && !["time", "write", "shortcuts"].includes(type)) {
|
|
164
167
|
if (rangePosition === "start") {
|
|
165
168
|
newVal = [newVal[0], newVal[0]];
|
|
169
|
+
if (endDateDays) {
|
|
170
|
+
newVal = [newVal[0], (0, import_dayjs.default)(newVal[0]).add(endDateDays, "day")];
|
|
171
|
+
}
|
|
166
172
|
}
|
|
167
173
|
if (!newVal[1]) {
|
|
168
174
|
newVal = [newVal[0], newVal[0]];
|
|
@@ -321,7 +327,8 @@ var PisellDateRangePicker = (props) => {
|
|
|
321
327
|
currentShortcut,
|
|
322
328
|
setCurrentShortcut,
|
|
323
329
|
disabledDate,
|
|
324
|
-
value: _value
|
|
330
|
+
value: _value,
|
|
331
|
+
isHideCustomSelect
|
|
325
332
|
},
|
|
326
333
|
layout: {
|
|
327
334
|
orientation: "portrait"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./index.less";
|
|
2
|
+
import { Dayjs } from "dayjs";
|
|
3
|
+
export declare type PresetType = {
|
|
4
|
+
label?: string;
|
|
5
|
+
getValue?: () => [Dayjs, Dayjs];
|
|
6
|
+
value: [Dayjs, Dayjs] | "today" | "yesterday" | "last_3_days" | "last_7_days" | "last_30_days" | "last_90_days" | "last_180_days" | "tomorrow" | "next_3_days" | "next_7_days" | "next_30_days" | "next_90_days" | "next_180_days";
|
|
7
|
+
key?: string;
|
|
8
|
+
};
|
|
9
|
+
interface ShortcutsProps {
|
|
10
|
+
items: PresetType[];
|
|
11
|
+
onChange: (day: [Dayjs, Dayjs], changeImportance?: "accept" | "set") => void;
|
|
12
|
+
changeImportance?: "accept" | "set";
|
|
13
|
+
}
|
|
14
|
+
declare const Shortcuts: (props: ShortcutsProps) => JSX.Element | null;
|
|
15
|
+
export default Shortcuts;
|
package/lib/Toolbar/index.d.ts
CHANGED
package/lib/Toolbar/index.js
CHANGED
|
@@ -51,7 +51,9 @@ var Toolbar = (props) => {
|
|
|
51
51
|
currentShortcut,
|
|
52
52
|
setCurrentShortcut,
|
|
53
53
|
disabledDate,
|
|
54
|
-
hidden
|
|
54
|
+
hidden,
|
|
55
|
+
// 是否隐藏自定义范围
|
|
56
|
+
isHideCustomSelect
|
|
55
57
|
} = props;
|
|
56
58
|
const format = locale === "en" || locale === "en-US" ? "DD/MM/YYYY" : "YYYY/MM/DD";
|
|
57
59
|
const [startStr, setStartStr] = (0, import_react.useState)("");
|
|
@@ -153,7 +155,7 @@ var Toolbar = (props) => {
|
|
|
153
155
|
if (hidden) {
|
|
154
156
|
return null;
|
|
155
157
|
}
|
|
156
|
-
return /* @__PURE__ */ import_react.default.createElement("div", { className: "date-picker-toolbar" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "date-picker-content-top" }, /* @__PURE__ */ import_react.default.createElement("span", null, (0, import_locales.getText)(
|
|
158
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "date-picker-toolbar" }, !isHideCustomSelect ? /* @__PURE__ */ import_react.default.createElement("div", { className: "date-picker-content-top" }, /* @__PURE__ */ import_react.default.createElement("span", null, (0, import_locales.getText)(
|
|
157
159
|
"toolbar-date-range-shortcut-date-range",
|
|
158
160
|
import_locales.pLocaleMap[locale]
|
|
159
161
|
)), /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -165,7 +167,7 @@ var Toolbar = (props) => {
|
|
|
165
167
|
size: "large",
|
|
166
168
|
onChange: handleSelectChange
|
|
167
169
|
}
|
|
168
|
-
)), /* @__PURE__ */ import_react.default.createElement("div", { className: "date-picker-content-bottom" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "date-picker-toolbar-start-wrap" }, /* @__PURE__ */ import_react.default.createElement("span", null, (0, import_locales.getText)(
|
|
170
|
+
)) : null, /* @__PURE__ */ import_react.default.createElement("div", { className: "date-picker-content-bottom" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "date-picker-toolbar-start-wrap" }, /* @__PURE__ */ import_react.default.createElement("span", null, (0, import_locales.getText)(
|
|
169
171
|
"toolbar-date-range-shortcut-starting",
|
|
170
172
|
import_locales.pLocaleMap[locale]
|
|
171
173
|
)), /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
interface BrowserSelectProps extends React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement> {
|
|
4
|
+
options: any[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* @title: 系统级别的下拉框
|
|
8
|
+
* @description:
|
|
9
|
+
* @param {BrowserSelectProps} props
|
|
10
|
+
* @return {*}
|
|
11
|
+
* @Author: zhiwei.Wang
|
|
12
|
+
* @Date: 2024-01-30 16:43
|
|
13
|
+
*/
|
|
14
|
+
declare const BrowserSelect: (props: BrowserSelectProps) => JSX.Element;
|
|
15
|
+
export default BrowserSelect;
|
|
@@ -5,7 +5,7 @@ export declare const splitDateRangeSections: (sections: RangeFieldSection[]) =>
|
|
|
5
5
|
};
|
|
6
6
|
export declare const removeLastSeparator: (dateSections: RangeFieldSection[]) => (RangeFieldSection | {
|
|
7
7
|
separator: null;
|
|
8
|
-
dateName: "
|
|
8
|
+
dateName: "start" | "end";
|
|
9
9
|
value: string;
|
|
10
10
|
format: string;
|
|
11
11
|
maxLength: number | null;
|
|
@@ -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,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-date-range": string;
|
|
7
|
+
"toolbar-date-range-shortcut-starting": string;
|
|
8
|
+
"toolbar-date-range-shortcut-ending": string;
|
|
9
|
+
"toolbar-date-range-shortcut-custom": string;
|
|
10
|
+
"toolbar-date-range-shortcut-today": string;
|
|
11
|
+
"toolbar-date-range-shortcut-yesterday": string;
|
|
12
|
+
"toolbar-date-range-shortcut-tomorrow": string;
|
|
13
|
+
"toolbar-date-range-shortcut-last-3-days": string;
|
|
14
|
+
"toolbar-date-range-shortcut-last-7-days": string;
|
|
15
|
+
"toolbar-date-range-shortcut-last-30-days": string;
|
|
16
|
+
"toolbar-date-range-shortcut-last-90-days": string;
|
|
17
|
+
"toolbar-date-range-shortcut-last-180-days": string;
|
|
18
|
+
"toolbar-date-range-shortcut-next-3-days": string;
|
|
19
|
+
"toolbar-date-range-shortcut-next-7-days": string;
|
|
20
|
+
"toolbar-date-range-shortcut-next-30-days": string;
|
|
21
|
+
"toolbar-date-range-shortcut-next-90-days": string;
|
|
22
|
+
"toolbar-date-range-shortcut-next-180-days": string;
|
|
23
|
+
"toolbar-date-range-invalid-start-date": string;
|
|
24
|
+
"toolbar-date-range-invalid-end-date": string;
|
|
25
|
+
};
|
|
26
|
+
export default _default;
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/date-picker",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.less"
|
|
6
6
|
],
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"antd": "^5.5.0",
|
|
27
27
|
"react": "^18.0.0",
|
|
28
28
|
"react-dom": "^18.0.0",
|
|
29
|
-
"@pisell/utils": "1.0.
|
|
29
|
+
"@pisell/utils": "1.0.42"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"es",
|