@pisell/date-picker 1.0.85 → 1.0.86
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.
|
@@ -163,7 +163,7 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
163
163
|
return item || null;
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
|
-
if (!clearEndOnSelection && type !== "shortcuts") {
|
|
166
|
+
if (!clearEndOnSelection && type !== "shortcuts" && type !== "write") {
|
|
167
167
|
if (rangePosition === 'start') {
|
|
168
168
|
newVal = [newVal[0], newVal[0]];
|
|
169
169
|
}
|
|
@@ -209,7 +209,7 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
209
209
|
if (inputReadOnly) {
|
|
210
210
|
return {
|
|
211
211
|
readOnly: true,
|
|
212
|
-
selectedSections:
|
|
212
|
+
selectedSections: 0
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
215
|
return {};
|
package/es/Toolbar/index.js
CHANGED
|
@@ -60,14 +60,14 @@ var Toolbar = function Toolbar(props) {
|
|
|
60
60
|
var handleStartChange = function handleStartChange(e) {
|
|
61
61
|
var val = e.target.value;
|
|
62
62
|
setStartStr(val);
|
|
63
|
-
if (isValidDate(val, format)) {
|
|
63
|
+
if (isValidDate(val, format) && (value[1] ? dayjs(val, format) <= value[1] : true)) {
|
|
64
64
|
var _start$set, _start$set$set;
|
|
65
65
|
setStartError(false);
|
|
66
66
|
var valDate = dayjs(val, format);
|
|
67
67
|
var newValue = _toConsumableArray(value);
|
|
68
68
|
var start = newValue[0] || dayjs();
|
|
69
69
|
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;
|
|
70
|
-
onChange(newValue);
|
|
70
|
+
onChange(newValue, 'write');
|
|
71
71
|
} else {
|
|
72
72
|
setStartError(true);
|
|
73
73
|
}
|
|
@@ -75,14 +75,14 @@ var Toolbar = function Toolbar(props) {
|
|
|
75
75
|
var handleEndChange = function handleEndChange(e) {
|
|
76
76
|
var val = e.target.value;
|
|
77
77
|
setEndStr(val);
|
|
78
|
-
if (isValidDate(val, format)) {
|
|
78
|
+
if (isValidDate(val, format) && (value[0] ? dayjs(val, format) >= value[0] : true)) {
|
|
79
79
|
var _end$set, _end$set$set;
|
|
80
80
|
setEndError(false);
|
|
81
81
|
var valDate = dayjs(val, format);
|
|
82
82
|
var newValue = _toConsumableArray(value);
|
|
83
83
|
var end = newValue[1] || dayjs();
|
|
84
84
|
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;
|
|
85
|
-
onChange(newValue);
|
|
85
|
+
onChange(newValue, 'write');
|
|
86
86
|
} else {
|
|
87
87
|
setEndError(true);
|
|
88
88
|
}
|
|
@@ -165,7 +165,7 @@ var PisellDateRangePicker = (props) => {
|
|
|
165
165
|
return item || null;
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
-
if (!clearEndOnSelection && type !== "shortcuts") {
|
|
168
|
+
if (!clearEndOnSelection && type !== "shortcuts" && type !== "write") {
|
|
169
169
|
if (rangePosition === "start") {
|
|
170
170
|
newVal = [newVal[0], newVal[0]];
|
|
171
171
|
}
|
|
@@ -212,7 +212,7 @@ var PisellDateRangePicker = (props) => {
|
|
|
212
212
|
if (inputReadOnly) {
|
|
213
213
|
return {
|
|
214
214
|
readOnly: true,
|
|
215
|
-
selectedSections:
|
|
215
|
+
selectedSections: 0
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
218
|
return {};
|
package/lib/Toolbar/index.js
CHANGED
|
@@ -74,13 +74,13 @@ var Toolbar = (props) => {
|
|
|
74
74
|
var _a, _b;
|
|
75
75
|
const val = e.target.value;
|
|
76
76
|
setStartStr(val);
|
|
77
|
-
if (isValidDate(val, format)) {
|
|
77
|
+
if (isValidDate(val, format) && (value[1] ? (0, import_dayjs.default)(val, format) <= value[1] : true)) {
|
|
78
78
|
setStartError(false);
|
|
79
79
|
const valDate = (0, import_dayjs.default)(val, format);
|
|
80
80
|
const newValue = [...value];
|
|
81
81
|
const start = newValue[0] || (0, import_dayjs.default)();
|
|
82
82
|
newValue[0] = ((_b = (_a = start == null ? void 0 : start.set("year", (valDate == null ? void 0 : valDate.get("year")) || 0)) == null ? void 0 : _a.set("month", (valDate == null ? void 0 : valDate.get("month")) || 0)) == null ? void 0 : _b.set("date", (valDate == null ? void 0 : valDate.get("date")) || 0)) || null;
|
|
83
|
-
onChange(newValue);
|
|
83
|
+
onChange(newValue, "write");
|
|
84
84
|
} else {
|
|
85
85
|
setStartError(true);
|
|
86
86
|
}
|
|
@@ -89,13 +89,13 @@ var Toolbar = (props) => {
|
|
|
89
89
|
var _a, _b;
|
|
90
90
|
const val = e.target.value;
|
|
91
91
|
setEndStr(val);
|
|
92
|
-
if (isValidDate(val, format)) {
|
|
92
|
+
if (isValidDate(val, format) && (value[0] ? (0, import_dayjs.default)(val, format) >= value[0] : true)) {
|
|
93
93
|
setEndError(false);
|
|
94
94
|
const valDate = (0, import_dayjs.default)(val, format);
|
|
95
95
|
const newValue = [...value];
|
|
96
96
|
const end = newValue[1] || (0, import_dayjs.default)();
|
|
97
97
|
newValue[1] = ((_b = (_a = end == null ? void 0 : end.set("year", (valDate == null ? void 0 : valDate.get("year")) || 0)) == null ? void 0 : _a.set("month", (valDate == null ? void 0 : valDate.get("month")) || 0)) == null ? void 0 : _b.set("date", (valDate == null ? void 0 : valDate.get("date")) || 0)) || null;
|
|
98
|
-
onChange(newValue);
|
|
98
|
+
onChange(newValue, "write");
|
|
99
99
|
} else {
|
|
100
100
|
setEndError(true);
|
|
101
101
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/date-picker",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.86",
|
|
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.25"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"es",
|