@pisell/date-picker 1.0.5 → 1.0.6
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.
|
@@ -72,7 +72,8 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
72
72
|
};
|
|
73
73
|
});
|
|
74
74
|
}, [presets]);
|
|
75
|
-
|
|
75
|
+
|
|
76
|
+
// console.log(_value,'_value');
|
|
76
77
|
return /*#__PURE__*/React.createElement(DateRangePicker
|
|
77
78
|
// defaultValue={defaultValue}
|
|
78
79
|
, {
|
|
@@ -93,7 +94,8 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
93
94
|
},
|
|
94
95
|
slotProps: {
|
|
95
96
|
shortcuts: {
|
|
96
|
-
items: _presets
|
|
97
|
+
items: _presets,
|
|
98
|
+
changeImportance: 'set'
|
|
97
99
|
},
|
|
98
100
|
actionBar: {
|
|
99
101
|
onOk: handleOk,
|
package/es/Shortcuts/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ export declare type PresetType = {
|
|
|
7
7
|
};
|
|
8
8
|
interface ShortcutsProps {
|
|
9
9
|
items: PresetType[];
|
|
10
|
-
onChange: (day: [Dayjs, Dayjs]) => void;
|
|
10
|
+
onChange: (day: [Dayjs, Dayjs], changeImportance?: 'accept' | 'set') => void;
|
|
11
|
+
changeImportance?: 'accept' | 'set';
|
|
11
12
|
}
|
|
12
13
|
declare const Shortcuts: (props: ShortcutsProps) => JSX.Element | null;
|
|
13
14
|
export default Shortcuts;
|
package/es/Shortcuts/index.js
CHANGED
|
@@ -9,13 +9,14 @@ import classNames from "classnames";
|
|
|
9
9
|
import "./index.less";
|
|
10
10
|
var Shortcuts = function Shortcuts(props) {
|
|
11
11
|
var onChange = props.onChange,
|
|
12
|
-
items = props.items
|
|
12
|
+
items = props.items,
|
|
13
|
+
changeImportance = props.changeImportance;
|
|
13
14
|
var _useState = useState(-1),
|
|
14
15
|
_useState2 = _slicedToArray(_useState, 2),
|
|
15
16
|
activeIndex = _useState2[0],
|
|
16
17
|
setActiveIndex = _useState2[1];
|
|
17
18
|
var handleClick = function handleClick(item, index) {
|
|
18
|
-
onChange(item.getValue());
|
|
19
|
+
onChange(item.getValue(), changeImportance);
|
|
19
20
|
setActiveIndex(index);
|
|
20
21
|
};
|
|
21
22
|
if (items.length === 0) {
|
|
@@ -90,7 +90,6 @@ var PisellDateRangePicker = (props) => {
|
|
|
90
90
|
};
|
|
91
91
|
});
|
|
92
92
|
}, [presets]);
|
|
93
|
-
console.log(_value, "_value");
|
|
94
93
|
return /* @__PURE__ */ React.createElement(
|
|
95
94
|
import_DateRangePicker.DateRangePicker,
|
|
96
95
|
{
|
|
@@ -111,7 +110,8 @@ var PisellDateRangePicker = (props) => {
|
|
|
111
110
|
},
|
|
112
111
|
slotProps: {
|
|
113
112
|
shortcuts: {
|
|
114
|
-
items: _presets
|
|
113
|
+
items: _presets,
|
|
114
|
+
changeImportance: "set"
|
|
115
115
|
},
|
|
116
116
|
actionBar: {
|
|
117
117
|
onOk: handleOk,
|
package/lib/Shortcuts/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ export declare type PresetType = {
|
|
|
7
7
|
};
|
|
8
8
|
interface ShortcutsProps {
|
|
9
9
|
items: PresetType[];
|
|
10
|
-
onChange: (day: [Dayjs, Dayjs]) => void;
|
|
10
|
+
onChange: (day: [Dayjs, Dayjs], changeImportance?: 'accept' | 'set') => void;
|
|
11
|
+
changeImportance?: 'accept' | 'set';
|
|
11
12
|
}
|
|
12
13
|
declare const Shortcuts: (props: ShortcutsProps) => JSX.Element | null;
|
|
13
14
|
export default Shortcuts;
|
package/lib/Shortcuts/index.js
CHANGED
|
@@ -36,10 +36,10 @@ var import_react = __toESM(require("react"));
|
|
|
36
36
|
var import_classnames = __toESM(require("classnames"));
|
|
37
37
|
var import_index = require("./index.less");
|
|
38
38
|
var Shortcuts = (props) => {
|
|
39
|
-
const { onChange, items } = props;
|
|
39
|
+
const { onChange, items, changeImportance } = props;
|
|
40
40
|
const [activeIndex, setActiveIndex] = (0, import_react.useState)(-1);
|
|
41
41
|
const handleClick = (item, index) => {
|
|
42
|
-
onChange(item.getValue());
|
|
42
|
+
onChange(item.getValue(), changeImportance);
|
|
43
43
|
setActiveIndex(index);
|
|
44
44
|
};
|
|
45
45
|
if (items.length === 0) {
|