@mailstep/design-system 0.7.31-beta.2 → 0.7.31-beta.4
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/package.json +1 -1
- package/ui/Blocks/CommonGrid/components/Filters/DatePickerRange/DatePickerRange.js +1 -1
- package/ui/Blocks/CommonGrid/components/Filters/DatePickerRange/utils/pickerRangeToString.d.ts +1 -1
- package/ui/Blocks/CommonGrid/components/Filters/DatePickerRange/utils/pickerRangeToString.js +13 -5
- package/ui/Elements/DatePicker/Datetime/components/DateRepeater.js +1 -1
- package/ui/Elements/DatePicker/Datetime/components/Timepicker.js +2 -9
- package/ui/Elements/DatePicker/Datetime/types.d.ts +1 -3
- package/ui/Elements/DatePicker/Datetime/types.js +0 -1
- package/ui/Elements/DatePicker/Datetime/views/DaysView.js +0 -1
- package/ui/Elements/DatePicker/utils/constants.js +0 -1
- package/ui/index.es.js +4370 -4378
- package/ui/index.umd.js +162 -162
- package/ui/utils/translations.js +1 -1
package/package.json
CHANGED
package/ui/Blocks/CommonGrid/components/Filters/DatePickerRange/utils/pickerRangeToString.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { DateTimeOthers } from '../../../../../../Elements/DatePicker/Datetime/types';
|
|
2
|
-
export declare const pickerRangeToString: (values?: Date[], others?: DateTimeOthers) => string;
|
|
2
|
+
export declare const pickerRangeToString: (values?: Date[], others?: DateTimeOthers[]) => string;
|
package/ui/Blocks/CommonGrid/components/Filters/DatePickerRange/utils/pickerRangeToString.js
CHANGED
|
@@ -3,12 +3,20 @@ import { DatePickerRepeatTrans, TimePickerRepeatTrans } from '../../../../../../
|
|
|
3
3
|
import { sameDate } from './sameDate';
|
|
4
4
|
// User readable date range.
|
|
5
5
|
export var pickerRangeToString = function (values, others) {
|
|
6
|
+
var _a, _b;
|
|
6
7
|
if (values === void 0) { values = []; }
|
|
7
|
-
if (others === null || others === void 0 ? void 0 : others.dateTypeRepeater) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
if (((_a = others === null || others === void 0 ? void 0 : others[0]) === null || _a === void 0 ? void 0 : _a.dateTypeRepeater) || ((_b = others === null || others === void 0 ? void 0 : others[1]) === null || _b === void 0 ? void 0 : _b.dateTypeRepeater)) {
|
|
9
|
+
return others
|
|
10
|
+
.map(function (other, i) {
|
|
11
|
+
if (!other)
|
|
12
|
+
return false;
|
|
13
|
+
var repeaterDate = DatePickerRepeatTrans[other === null || other === void 0 ? void 0 : other.dateTypeRepeater];
|
|
14
|
+
var repeaterTime = i === 0 ? TimePickerRepeatTrans.from : TimePickerRepeatTrans.to;
|
|
15
|
+
var time = (other === null || other === void 0 ? void 0 : other.time) ? "".concat(String(other === null || other === void 0 ? void 0 : other.time.h).padStart(2, '0'), ":").concat(String(other === null || other === void 0 ? void 0 : other.time.m).padStart(2, '0')) : '';
|
|
16
|
+
return "".concat(repeaterTime, " ").concat(repeaterDate, " ").concat(time).trim();
|
|
17
|
+
})
|
|
18
|
+
.filter(Boolean)
|
|
19
|
+
.join(' - ');
|
|
12
20
|
}
|
|
13
21
|
// If no date is specified
|
|
14
22
|
if (!values[0] && !values[1]) {
|
|
@@ -27,5 +27,5 @@ export var DateRepeater = function (_a) {
|
|
|
27
27
|
}
|
|
28
28
|
onChangeOthers === null || onChangeOthers === void 0 ? void 0 : onChangeOthers(__assign(__assign({}, others), { dateTypeRepeater: dateTypeRepeater }));
|
|
29
29
|
}, [onChangeOthers, reset, others]);
|
|
30
|
-
return (_jsx(x.div, { borderTop: "1px solid", borderColor: "lightGray2", mt: "8px", pt: "8px", mb: "8px", children: _jsxs(FooterRow, { children: [_jsxs(x.div, { display: "flex", alignItems: "center", flex: "1", children: [_jsx(Icon, { icon: "calendar" }), _jsx(FooterRowLabel, { children: i18n._({ id: 'dataGrid.repeat', message: 'Repeat' }) })] }), _jsxs(x.select, { textAlign: "right", onChange: handleChange, value: others === null || others === void 0 ? void 0 : others.dateTypeRepeater, border: "none", children: [_jsx("option", { value: "", children: i18n._({ id: 'dataGrid.noRepeat', message: 'No repeat' }) }), _jsx("option", { value: DatePickerRepeat.EVERY_TODAY, children: DatePickerRepeatTrans[DatePickerRepeat.EVERY_TODAY] }), _jsx("option", { value: DatePickerRepeat.EVERY_YESTERDAY, children: DatePickerRepeatTrans[DatePickerRepeat.EVERY_YESTERDAY] })
|
|
30
|
+
return (_jsx(x.div, { borderTop: "1px solid", borderColor: "lightGray2", mt: "8px", pt: "8px", mb: "8px", children: _jsxs(FooterRow, { children: [_jsxs(x.div, { display: "flex", alignItems: "center", flex: "1", children: [_jsx(Icon, { icon: "calendar" }), _jsx(FooterRowLabel, { children: i18n._({ id: 'dataGrid.repeat', message: 'Repeat' }) })] }), _jsxs(x.select, { textAlign: "right", onChange: handleChange, value: others === null || others === void 0 ? void 0 : others.dateTypeRepeater, border: "none", children: [_jsx("option", { value: "", children: i18n._({ id: 'dataGrid.noRepeat', message: 'No repeat' }) }), _jsx("option", { value: DatePickerRepeat.EVERY_TODAY, children: DatePickerRepeatTrans[DatePickerRepeat.EVERY_TODAY] }), _jsx("option", { value: DatePickerRepeat.EVERY_YESTERDAY, children: DatePickerRepeatTrans[DatePickerRepeat.EVERY_YESTERDAY] })] })] }) }));
|
|
31
31
|
};
|
|
@@ -29,14 +29,9 @@ export var Timepicker = function (_a) {
|
|
|
29
29
|
var onChange = useCallback(function (e) {
|
|
30
30
|
var value = e.target.value;
|
|
31
31
|
var _a = value.split(':'), hours = _a[0], minutes = _a[1];
|
|
32
|
-
var defaultTimePickerType = isSecondDatePicker ? TimePickerRepeat.TO : TimePickerRepeat.FROM;
|
|
33
|
-
var timeTypeRepeater = (others === null || others === void 0 ? void 0 : others.dateTypeRepeater) ? (others === null || others === void 0 ? void 0 : others.timeTypeRepeater) || defaultTimePickerType : undefined;
|
|
34
32
|
setHours(Number(hours));
|
|
35
33
|
setMinutes(Number(minutes));
|
|
36
|
-
onChangeOthers === null || onChangeOthers === void 0 ? void 0 : onChangeOthers(__assign(__assign({}, others), {
|
|
37
|
-
}, [onChangeOthers, others, isSecondDatePicker]);
|
|
38
|
-
var handleChangeTimer = useCallback(function (e) {
|
|
39
|
-
onChangeOthers === null || onChangeOthers === void 0 ? void 0 : onChangeOthers(__assign(__assign({}, others), { timeTypeRepeater: e.target.value }));
|
|
34
|
+
onChangeOthers === null || onChangeOthers === void 0 ? void 0 : onChangeOthers(__assign(__assign({}, others), { time: { h: Number(hours), m: Number(minutes) } }));
|
|
40
35
|
}, [onChangeOthers, others]);
|
|
41
36
|
useEffect(function () {
|
|
42
37
|
!!value && setTime('hours', hours);
|
|
@@ -45,7 +40,5 @@ export var Timepicker = function (_a) {
|
|
|
45
40
|
!!value && setTime('minutes', minutes);
|
|
46
41
|
}, [minutes]);
|
|
47
42
|
var timeValue = "".concat(hours.toString().padStart(2, '0'), ":").concat(minutes.toString().padStart(2, '0'));
|
|
48
|
-
|
|
49
|
-
var timeTypeRepeaterValue = (others === null || others === void 0 ? void 0 : others.dateTypeRepeater) ? others === null || others === void 0 ? void 0 : others.timeTypeRepeater : staticTimerValue;
|
|
50
|
-
return (_jsx(x.div, { borderTop: "1px solid", borderColor: "lightGray2", pt: "8px", mb: "8px", children: _jsxs(FooterRow, { disabled: disabled, children: [_jsxs(x.div, { children: [_jsx(Icon, { icon: "clock" }), _jsx(FooterRowLabel, { children: i18n._({ id: 'dataGrid.filterCell.time', message: 'Time' }) })] }), _jsxs(x.div, { display: "flex", alignItems: "center", children: [_jsxs(x.select, { onChange: handleChangeTimer, value: timeTypeRepeaterValue, textAlign: "right", disabled: disabled || !(others === null || others === void 0 ? void 0 : others.dateTypeRepeater), border: "none", children: [_jsx("option", { value: TimePickerRepeat.AT, children: TimePickerRepeatTrans[TimePickerRepeat.AT] }), isSecondDatePicker ? (_jsx("option", { value: TimePickerRepeat.TO, children: TimePickerRepeatTrans[TimePickerRepeat.TO] })) : (_jsx("option", { value: TimePickerRepeat.FROM, children: TimePickerRepeatTrans[TimePickerRepeat.FROM] }))] }), _jsx(TimeInput, { type: "time", onChange: onChange, disabled: disabled, value: timeValue })] })] }) }));
|
|
43
|
+
return (_jsx(x.div, { borderTop: "1px solid", borderColor: "lightGray2", pt: "8px", mb: "8px", children: _jsxs(FooterRow, { disabled: disabled, children: [_jsxs(x.div, { children: [_jsx(Icon, { icon: "clock" }), _jsx(FooterRowLabel, { children: i18n._({ id: 'dataGrid.filterCell.time', message: 'Time' }) })] }), _jsxs(x.div, { display: "flex", alignItems: "center", children: [_jsxs("b", { children: [isSecondDatePicker ? TimePickerRepeatTrans[TimePickerRepeat.TO] : TimePickerRepeatTrans[TimePickerRepeat.FROM], ":", ' '] }), _jsx(TimeInput, { type: "time", onChange: onChange, disabled: disabled, value: timeValue })] })] }) }));
|
|
51
44
|
};
|
|
@@ -61,7 +61,6 @@ export interface DatetimepickerState {
|
|
|
61
61
|
}
|
|
62
62
|
export type DateTimeOthers = {
|
|
63
63
|
dateTypeRepeater: DatePickerRepeat;
|
|
64
|
-
timeTypeRepeater?: TimePickerRepeat;
|
|
65
64
|
time?: {
|
|
66
65
|
h: number;
|
|
67
66
|
m: number;
|
|
@@ -69,8 +68,7 @@ export type DateTimeOthers = {
|
|
|
69
68
|
};
|
|
70
69
|
export declare enum DatePickerRepeat {
|
|
71
70
|
EVERY_TODAY = "every-today",
|
|
72
|
-
EVERY_YESTERDAY = "every-yesterday"
|
|
73
|
-
EVERY_LAST_WEEK = "every-last-week"
|
|
71
|
+
EVERY_YESTERDAY = "every-yesterday"
|
|
74
72
|
}
|
|
75
73
|
export declare enum TimePickerRepeat {
|
|
76
74
|
FROM = "from",
|
|
@@ -2,7 +2,6 @@ export var DatePickerRepeat;
|
|
|
2
2
|
(function (DatePickerRepeat) {
|
|
3
3
|
DatePickerRepeat["EVERY_TODAY"] = "every-today";
|
|
4
4
|
DatePickerRepeat["EVERY_YESTERDAY"] = "every-yesterday";
|
|
5
|
-
DatePickerRepeat["EVERY_LAST_WEEK"] = "every-last-week";
|
|
6
5
|
})(DatePickerRepeat || (DatePickerRepeat = {}));
|
|
7
6
|
export var TimePickerRepeat;
|
|
8
7
|
(function (TimePickerRepeat) {
|
|
@@ -123,7 +123,6 @@ var DaysView = /** @class */ (function (_super) {
|
|
|
123
123
|
var value = this.props.value;
|
|
124
124
|
var others = this.props.others;
|
|
125
125
|
var disabled = this.props.disabled;
|
|
126
|
-
console.log('foooter: ', others);
|
|
127
126
|
return (_jsx("tfoot", { children: _jsx("tr", { children: _jsxs("td", { colSpan: 7, children: [onChangeOthers && _jsx(DateRepeater, { onChangeOthers: onChangeOthers, others: others, reset: reset }), this.props.timeFormat && (_jsx(Timepicker, { setTime: setTime, value: value, disabled: disabled || (!value && !(others === null || others === void 0 ? void 0 : others.dateTypeRepeater)), others: others, onChangeOthers: onChangeOthers, isSecondDatePicker: this.props.isSecondDatePicker }))] }) }) }));
|
|
128
127
|
};
|
|
129
128
|
DaysView.defaultProps = {
|
|
@@ -4,7 +4,6 @@ import { i18n } from '@lingui/core';
|
|
|
4
4
|
export var DatePickerRepeatTrans = (_a = {},
|
|
5
5
|
_a[DatePickerRepeat.EVERY_TODAY] = i18n._({ id: 'dataGrid.everyToday', message: 'Every today' }),
|
|
6
6
|
_a[DatePickerRepeat.EVERY_YESTERDAY] = i18n._({ id: 'dataGrid.everyYesterday', message: 'Every yesterday' }),
|
|
7
|
-
_a[DatePickerRepeat.EVERY_LAST_WEEK] = i18n._({ id: 'dataGrid.everyLastWeek', message: 'Every last week' }),
|
|
8
7
|
_a);
|
|
9
8
|
export var TimePickerRepeatTrans = (_b = {},
|
|
10
9
|
_b[TimePickerRepeat.FROM] = i18n._({ id: 'dataGrid.timepicker.from', message: 'from' }),
|