@pisell/date-picker 1.0.44 → 1.0.46

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.
@@ -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;
@@ -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 {
@@ -48,6 +49,10 @@ export interface PisellDateRangePickerProps {
48
49
  popupClassName?: string;
49
50
  /** 默认显示月份 */
50
51
  defaultCalendarMonth?: Dayjs;
52
+ /** ok 按钮 props */
53
+ okButtonProps?: ButtonProps;
54
+ /** cancel 按钮 props */
55
+ cancelButtonProps?: ButtonProps;
51
56
  }
52
57
  declare const PisellDateRangePicker: (props: PisellDateRangePickerProps) => JSX.Element;
53
58
  export default PisellDateRangePicker;
@@ -49,7 +49,9 @@ 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;
53
55
  var _useState = useState(propsOpen !== null && propsOpen !== void 0 ? propsOpen : false),
54
56
  _useState2 = _slicedToArray(_useState, 2),
55
57
  open = _useState2[0],
@@ -160,7 +162,9 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
160
162
  onCancel: handleClose,
161
163
  showTime: showTime,
162
164
  onChange: handleChange,
163
- value: _value
165
+ value: _value,
166
+ okButtonProps: okButtonProps,
167
+ cancelButtonProps: cancelButtonProps
164
168
  },
165
169
  field: {
166
170
  value: _value,
@@ -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;
@@ -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 { ownerState, onCancel, onOk, onChange, showTime, value = [] } = props;
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 {
@@ -48,6 +49,10 @@ export interface PisellDateRangePickerProps {
48
49
  popupClassName?: string;
49
50
  /** 默认显示月份 */
50
51
  defaultCalendarMonth?: Dayjs;
52
+ /** ok 按钮 props */
53
+ okButtonProps?: ButtonProps;
54
+ /** cancel 按钮 props */
55
+ cancelButtonProps?: ButtonProps;
51
56
  }
52
57
  declare const PisellDateRangePicker: (props: PisellDateRangePickerProps) => JSX.Element;
53
58
  export default PisellDateRangePicker;
@@ -72,7 +72,9 @@ var PisellDateRangePicker = (props) => {
72
72
  onOpen,
73
73
  onMonthChange,
74
74
  popupClassName,
75
- defaultCalendarMonth
75
+ defaultCalendarMonth,
76
+ okButtonProps,
77
+ cancelButtonProps
76
78
  } = props;
77
79
  const [open, setOpen] = (0, import_react.useState)(propsOpen ?? false);
78
80
  (0, import_react.useEffect)(() => {
@@ -177,7 +179,9 @@ var PisellDateRangePicker = (props) => {
177
179
  onCancel: handleClose,
178
180
  showTime,
179
181
  onChange: handleChange,
180
- value: _value
182
+ value: _value,
183
+ okButtonProps,
184
+ cancelButtonProps
181
185
  },
182
186
  field: {
183
187
  value: _value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/date-picker",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
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.13"
29
+ "@pisell/utils": "1.0.14"
30
30
  },
31
31
  "files": [
32
32
  "es",