colibri-ui 0.7.108 → 0.7.109
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/TimeSelect/helpers.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export declare const DEFAULT_TIME: {
|
|
|
6
6
|
export declare const formatTime: (date: Date) => string;
|
|
7
7
|
export declare const generateSuggest: (interval?: number) => Timestamp[];
|
|
8
8
|
export declare const checkIsBeforeNow: (time: string, currentDate?: Date | null) => boolean;
|
|
9
|
-
export declare const checkIsBeforeSelectedDate: (time: string, date?: Date | null) => boolean;
|
|
9
|
+
export declare const checkIsBeforeSelectedDate: (time: string, interval: number, date?: Date | null) => boolean;
|
package/TimeSelect/helpers.js
CHANGED
|
@@ -25,8 +25,13 @@ var generateSuggest = function generateSuggest(interval) {
|
|
|
25
25
|
var checkIsBeforeNow = function checkIsBeforeNow(time, currentDate) {
|
|
26
26
|
return currentDate ? dateFns.isBefore(dateFns.parse(time, "HH:mm", currentDate), new Date()) : false;
|
|
27
27
|
};
|
|
28
|
-
var checkIsBeforeSelectedDate = function checkIsBeforeSelectedDate(time, date) {
|
|
29
|
-
|
|
28
|
+
var checkIsBeforeSelectedDate = function checkIsBeforeSelectedDate(time, interval, date) {
|
|
29
|
+
if (date) {
|
|
30
|
+
var selectedDate = new Date(date);
|
|
31
|
+
selectedDate.setMinutes(selectedDate.getMinutes() + interval);
|
|
32
|
+
return dateFns.isBefore(dateFns.parse(time, "HH:mm", date), selectedDate);
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
30
35
|
};
|
|
31
36
|
|
|
32
37
|
exports.DEFAULT_TIME = DEFAULT_TIME;
|
package/TimeSelect/index.js
CHANGED
|
@@ -35,10 +35,10 @@ var TimeSelect = function TimeSelect(_a) {
|
|
|
35
35
|
var options = React.useMemo(function () {
|
|
36
36
|
return baseOptions.map(function (option) {
|
|
37
37
|
return tslib.__assign(tslib.__assign({}, option), {
|
|
38
|
-
disabled: !!selectedDate && helpers.checkIsBeforeSelectedDate(option.value, selectedDate) || !!currentDate && helpers.checkIsBeforeNow(option.value, currentDate)
|
|
38
|
+
disabled: !!selectedDate && helpers.checkIsBeforeSelectedDate(option.value, interval, selectedDate) || !!currentDate && helpers.checkIsBeforeNow(option.value, currentDate)
|
|
39
39
|
});
|
|
40
40
|
});
|
|
41
|
-
}, [baseOptions, currentDate, selectedDate]);
|
|
41
|
+
}, [baseOptions, currentDate, selectedDate, interval]);
|
|
42
42
|
return /*#__PURE__*/React__default.default.createElement(index$1.default, tslib.__assign({}, props, {
|
|
43
43
|
name: name,
|
|
44
44
|
value: value,
|
|
@@ -6,4 +6,4 @@ export declare const DEFAULT_TIME: {
|
|
|
6
6
|
export declare const formatTime: (date: Date) => string;
|
|
7
7
|
export declare const generateSuggest: (interval?: number) => Timestamp[];
|
|
8
8
|
export declare const checkIsBeforeNow: (time: string, currentDate?: Date | null) => boolean;
|
|
9
|
-
export declare const checkIsBeforeSelectedDate: (time: string, date?: Date | null) => boolean;
|
|
9
|
+
export declare const checkIsBeforeSelectedDate: (time: string, interval: number, date?: Date | null) => boolean;
|
|
@@ -23,8 +23,13 @@ var generateSuggest = function generateSuggest(interval) {
|
|
|
23
23
|
var checkIsBeforeNow = function checkIsBeforeNow(time, currentDate) {
|
|
24
24
|
return currentDate ? isBefore(parse(time, "HH:mm", currentDate), new Date()) : false;
|
|
25
25
|
};
|
|
26
|
-
var checkIsBeforeSelectedDate = function checkIsBeforeSelectedDate(time, date) {
|
|
27
|
-
|
|
26
|
+
var checkIsBeforeSelectedDate = function checkIsBeforeSelectedDate(time, interval, date) {
|
|
27
|
+
if (date) {
|
|
28
|
+
var selectedDate = new Date(date);
|
|
29
|
+
selectedDate.setMinutes(selectedDate.getMinutes() + interval);
|
|
30
|
+
return isBefore(parse(time, "HH:mm", date), selectedDate);
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
28
33
|
};
|
|
29
34
|
|
|
30
35
|
export { DEFAULT_TIME, checkIsBeforeNow, checkIsBeforeSelectedDate, formatTime, generateSuggest };
|
package/esm/TimeSelect/index.js
CHANGED
|
@@ -27,10 +27,10 @@ var TimeSelect = function TimeSelect(_a) {
|
|
|
27
27
|
var options = useMemo(function () {
|
|
28
28
|
return baseOptions.map(function (option) {
|
|
29
29
|
return __assign(__assign({}, option), {
|
|
30
|
-
disabled: !!selectedDate && checkIsBeforeSelectedDate(option.value, selectedDate) || !!currentDate && checkIsBeforeNow(option.value, currentDate)
|
|
30
|
+
disabled: !!selectedDate && checkIsBeforeSelectedDate(option.value, interval, selectedDate) || !!currentDate && checkIsBeforeNow(option.value, currentDate)
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
|
-
}, [baseOptions, currentDate, selectedDate]);
|
|
33
|
+
}, [baseOptions, currentDate, selectedDate, interval]);
|
|
34
34
|
return /*#__PURE__*/React__default.createElement(Select, __assign({}, props, {
|
|
35
35
|
name: name,
|
|
36
36
|
value: value,
|