@pisell/date-picker 1.0.45 → 1.0.47
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 +3 -0
- package/es/ActionBar/index.js +8 -5
- package/es/PisellDateRangePicker/index.d.ts +7 -0
- package/es/PisellDateRangePicker/index.js +9 -2
- package/lib/ActionBar/index.d.ts +3 -0
- package/lib/ActionBar/index.js +11 -2
- package/lib/PisellDateRangePicker/index.d.ts +7 -0
- package/lib/PisellDateRangePicker/index.js +9 -2
- package/package.json +1 -1
package/es/ActionBar/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ButtonProps } from "antd";
|
|
1
2
|
import { Dayjs } from "dayjs";
|
|
2
3
|
import "./index.less";
|
|
3
4
|
interface ActionBarProps {
|
|
@@ -10,6 +11,8 @@ interface ActionBarProps {
|
|
|
10
11
|
defaultValue: Dayjs;
|
|
11
12
|
[key: string]: any;
|
|
12
13
|
}[];
|
|
14
|
+
okButtonProps?: ButtonProps;
|
|
15
|
+
cancelButtonProps?: ButtonProps;
|
|
13
16
|
}
|
|
14
17
|
declare const ActionBar: (props: ActionBarProps) => JSX.Element;
|
|
15
18
|
export default ActionBar;
|
package/es/ActionBar/index.js
CHANGED
|
@@ -25,7 +25,9 @@ var ActionBar = function ActionBar(props) {
|
|
|
25
25
|
onChange = props.onChange,
|
|
26
26
|
showTime = props.showTime,
|
|
27
27
|
_props$value = props.value,
|
|
28
|
-
value = _props$value === void 0 ? [] : _props$value
|
|
28
|
+
value = _props$value === void 0 ? [] : _props$value,
|
|
29
|
+
okButtonProps = props.okButtonProps,
|
|
30
|
+
cancelButtonProps = props.cancelButtonProps;
|
|
29
31
|
var slotProps = ownerState.slotProps;
|
|
30
32
|
var _ref = (slotProps === null || slotProps === void 0 ? void 0 : slotProps.shortcuts) || {},
|
|
31
33
|
items = _ref.items;
|
|
@@ -95,11 +97,12 @@ var ActionBar = function ActionBar(props) {
|
|
|
95
97
|
style: _objectSpread(_objectSpread({}, spaceStyle), {}, {
|
|
96
98
|
margin: 0
|
|
97
99
|
})
|
|
98
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
100
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({}, cancelButtonProps || {}, {
|
|
99
101
|
onClick: onCancel
|
|
100
|
-
}, getText("action-bar-cancel")), /*#__PURE__*/React.createElement(Button, {
|
|
101
|
-
type: "primary"
|
|
102
|
+
}), getText("action-bar-cancel")), /*#__PURE__*/React.createElement(Button, _extends({
|
|
103
|
+
type: "primary"
|
|
104
|
+
}, okButtonProps || {}, {
|
|
102
105
|
onClick: onOk
|
|
103
|
-
}, getText("action-bar-apply")))));
|
|
106
|
+
}), getText("action-bar-apply")))));
|
|
104
107
|
};
|
|
105
108
|
export default ActionBar;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Dayjs } from "dayjs";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import { ButtonProps } from "antd";
|
|
3
4
|
import { PresetType } from "../Shortcuts";
|
|
4
5
|
import "./index.less";
|
|
5
6
|
export interface PisellDateRangePickerProps {
|
|
@@ -7,6 +8,8 @@ export interface PisellDateRangePickerProps {
|
|
|
7
8
|
clearEndOnSelection?: boolean;
|
|
8
9
|
/** 日期选择确认回调 */
|
|
9
10
|
onChange?: (day: Dayjs[]) => void;
|
|
11
|
+
/** 日期改变回调 此处只为了组件外拿到当前日期项进行状态操作 通常情况下只使用onChange来拿value */
|
|
12
|
+
onDateChange?: (day: Dayjs[]) => void;
|
|
10
13
|
/** 日期选择值 */
|
|
11
14
|
value?: Dayjs[];
|
|
12
15
|
/** 日期选择默认值 */
|
|
@@ -48,6 +51,10 @@ export interface PisellDateRangePickerProps {
|
|
|
48
51
|
popupClassName?: string;
|
|
49
52
|
/** 默认显示月份 */
|
|
50
53
|
defaultCalendarMonth?: Dayjs;
|
|
54
|
+
/** ok 按钮 props */
|
|
55
|
+
okButtonProps?: ButtonProps;
|
|
56
|
+
/** cancel 按钮 props */
|
|
57
|
+
cancelButtonProps?: ButtonProps;
|
|
51
58
|
}
|
|
52
59
|
declare const PisellDateRangePicker: (props: PisellDateRangePickerProps) => JSX.Element;
|
|
53
60
|
export default PisellDateRangePicker;
|
|
@@ -49,7 +49,10 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
49
49
|
onOpen = props.onOpen,
|
|
50
50
|
onMonthChange = props.onMonthChange,
|
|
51
51
|
popupClassName = props.popupClassName,
|
|
52
|
-
defaultCalendarMonth = props.defaultCalendarMonth
|
|
52
|
+
defaultCalendarMonth = props.defaultCalendarMonth,
|
|
53
|
+
okButtonProps = props.okButtonProps,
|
|
54
|
+
cancelButtonProps = props.cancelButtonProps,
|
|
55
|
+
onDateChange = props.onDateChange;
|
|
53
56
|
var _useState = useState(propsOpen !== null && propsOpen !== void 0 ? propsOpen : false),
|
|
54
57
|
_useState2 = _slicedToArray(_useState, 2),
|
|
55
58
|
open = _useState2[0],
|
|
@@ -73,6 +76,7 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
73
76
|
var handleClose = function handleClose() {
|
|
74
77
|
setOpen(false);
|
|
75
78
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
79
|
+
onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(transDayjsArr(propsValue, defaultValue));
|
|
76
80
|
setValue(transDayjsArr(propsValue, defaultValue));
|
|
77
81
|
};
|
|
78
82
|
var handleOk = function handleOk() {
|
|
@@ -109,6 +113,7 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
109
113
|
if (clearEndOnSelection && _value.filter(Boolean).length === 2) {
|
|
110
114
|
newVal = [newVal[0], null];
|
|
111
115
|
}
|
|
116
|
+
onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(newVal);
|
|
112
117
|
setValue(newVal);
|
|
113
118
|
};
|
|
114
119
|
var hasPreset = (_presets === null || _presets === void 0 ? void 0 : _presets.length) > 0;
|
|
@@ -160,7 +165,9 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
160
165
|
onCancel: handleClose,
|
|
161
166
|
showTime: showTime,
|
|
162
167
|
onChange: handleChange,
|
|
163
|
-
value: _value
|
|
168
|
+
value: _value,
|
|
169
|
+
okButtonProps: okButtonProps,
|
|
170
|
+
cancelButtonProps: cancelButtonProps
|
|
164
171
|
},
|
|
165
172
|
field: {
|
|
166
173
|
value: _value,
|
package/lib/ActionBar/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ButtonProps } from "antd";
|
|
1
2
|
import { Dayjs } from "dayjs";
|
|
2
3
|
import "./index.less";
|
|
3
4
|
interface ActionBarProps {
|
|
@@ -10,6 +11,8 @@ interface ActionBarProps {
|
|
|
10
11
|
defaultValue: Dayjs;
|
|
11
12
|
[key: string]: any;
|
|
12
13
|
}[];
|
|
14
|
+
okButtonProps?: ButtonProps;
|
|
15
|
+
cancelButtonProps?: ButtonProps;
|
|
13
16
|
}
|
|
14
17
|
declare const ActionBar: (props: ActionBarProps) => JSX.Element;
|
|
15
18
|
export default ActionBar;
|
package/lib/ActionBar/index.js
CHANGED
|
@@ -40,7 +40,16 @@ var import_dayjs = __toESM(require("dayjs"));
|
|
|
40
40
|
var import_locales = require("../locales");
|
|
41
41
|
var import_index = require("./index.less");
|
|
42
42
|
var ActionBar = (props) => {
|
|
43
|
-
const {
|
|
43
|
+
const {
|
|
44
|
+
ownerState,
|
|
45
|
+
onCancel,
|
|
46
|
+
onOk,
|
|
47
|
+
onChange,
|
|
48
|
+
showTime,
|
|
49
|
+
value = [],
|
|
50
|
+
okButtonProps,
|
|
51
|
+
cancelButtonProps
|
|
52
|
+
} = props;
|
|
44
53
|
const { slotProps } = ownerState;
|
|
45
54
|
const { items } = (slotProps == null ? void 0 : slotProps.shortcuts) || {};
|
|
46
55
|
const hasShortcuts = !!items.length;
|
|
@@ -106,7 +115,7 @@ var ActionBar = (props) => {
|
|
|
106
115
|
inputReadOnly: true
|
|
107
116
|
}
|
|
108
117
|
)) : /* @__PURE__ */ import_react.default.createElement("div", null)),
|
|
109
|
-
/* @__PURE__ */ import_react.default.createElement(import_antd.Space, { style: { ...spaceStyle, margin: 0 } }, /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: onCancel }, (0, import_locales.getText)("action-bar-cancel")), /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { type: "primary", onClick: onOk }, (0, import_locales.getText)("action-bar-apply")))
|
|
118
|
+
/* @__PURE__ */ import_react.default.createElement(import_antd.Space, { style: { ...spaceStyle, margin: 0 } }, /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { ...cancelButtonProps || {}, onClick: onCancel }, (0, import_locales.getText)("action-bar-cancel")), /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { type: "primary", ...okButtonProps || {}, onClick: onOk }, (0, import_locales.getText)("action-bar-apply")))
|
|
110
119
|
));
|
|
111
120
|
};
|
|
112
121
|
var ActionBar_default = ActionBar;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Dayjs } from "dayjs";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import { ButtonProps } from "antd";
|
|
3
4
|
import { PresetType } from "../Shortcuts";
|
|
4
5
|
import "./index.less";
|
|
5
6
|
export interface PisellDateRangePickerProps {
|
|
@@ -7,6 +8,8 @@ export interface PisellDateRangePickerProps {
|
|
|
7
8
|
clearEndOnSelection?: boolean;
|
|
8
9
|
/** 日期选择确认回调 */
|
|
9
10
|
onChange?: (day: Dayjs[]) => void;
|
|
11
|
+
/** 日期改变回调 此处只为了组件外拿到当前日期项进行状态操作 通常情况下只使用onChange来拿value */
|
|
12
|
+
onDateChange?: (day: Dayjs[]) => void;
|
|
10
13
|
/** 日期选择值 */
|
|
11
14
|
value?: Dayjs[];
|
|
12
15
|
/** 日期选择默认值 */
|
|
@@ -48,6 +51,10 @@ export interface PisellDateRangePickerProps {
|
|
|
48
51
|
popupClassName?: string;
|
|
49
52
|
/** 默认显示月份 */
|
|
50
53
|
defaultCalendarMonth?: Dayjs;
|
|
54
|
+
/** ok 按钮 props */
|
|
55
|
+
okButtonProps?: ButtonProps;
|
|
56
|
+
/** cancel 按钮 props */
|
|
57
|
+
cancelButtonProps?: ButtonProps;
|
|
51
58
|
}
|
|
52
59
|
declare const PisellDateRangePicker: (props: PisellDateRangePickerProps) => JSX.Element;
|
|
53
60
|
export default PisellDateRangePicker;
|
|
@@ -72,7 +72,10 @@ var PisellDateRangePicker = (props) => {
|
|
|
72
72
|
onOpen,
|
|
73
73
|
onMonthChange,
|
|
74
74
|
popupClassName,
|
|
75
|
-
defaultCalendarMonth
|
|
75
|
+
defaultCalendarMonth,
|
|
76
|
+
okButtonProps,
|
|
77
|
+
cancelButtonProps,
|
|
78
|
+
onDateChange
|
|
76
79
|
} = props;
|
|
77
80
|
const [open, setOpen] = (0, import_react.useState)(propsOpen ?? false);
|
|
78
81
|
(0, import_react.useEffect)(() => {
|
|
@@ -91,6 +94,7 @@ var PisellDateRangePicker = (props) => {
|
|
|
91
94
|
const handleClose = () => {
|
|
92
95
|
setOpen(false);
|
|
93
96
|
onClose == null ? void 0 : onClose();
|
|
97
|
+
onDateChange == null ? void 0 : onDateChange(transDayjsArr(propsValue, defaultValue));
|
|
94
98
|
setValue(transDayjsArr(propsValue, defaultValue));
|
|
95
99
|
};
|
|
96
100
|
const handleOk = () => {
|
|
@@ -126,6 +130,7 @@ var PisellDateRangePicker = (props) => {
|
|
|
126
130
|
if (clearEndOnSelection && _value.filter(Boolean).length === 2) {
|
|
127
131
|
newVal = [newVal[0], null];
|
|
128
132
|
}
|
|
133
|
+
onDateChange == null ? void 0 : onDateChange(newVal);
|
|
129
134
|
setValue(newVal);
|
|
130
135
|
};
|
|
131
136
|
const hasPreset = (_presets == null ? void 0 : _presets.length) > 0;
|
|
@@ -177,7 +182,9 @@ var PisellDateRangePicker = (props) => {
|
|
|
177
182
|
onCancel: handleClose,
|
|
178
183
|
showTime,
|
|
179
184
|
onChange: handleChange,
|
|
180
|
-
value: _value
|
|
185
|
+
value: _value,
|
|
186
|
+
okButtonProps,
|
|
187
|
+
cancelButtonProps
|
|
181
188
|
},
|
|
182
189
|
field: {
|
|
183
190
|
value: _value,
|