@mailstep/design-system 0.7.14 → 0.7.15-beta.1
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 +2 -2
- package/ui/Blocks/CommonGrid/storybook/stories/complexWithPaginationAndRedux.stories.js +1 -1
- package/ui/Blocks/CommonGrid/storybook/utils/columnDefinition.js +3 -0
- package/ui/Blocks/CommonGrid/styles.d.ts +1 -0
- package/ui/Blocks/CommonGrid/styles.js +4 -1
- package/ui/Blocks/CommonGrid/types.d.ts +1 -0
- package/ui/Elements/DatePicker/DatePicker.d.ts +1 -0
- package/ui/Elements/DatePicker/Datetime/DateTime.js +1 -0
- package/ui/Elements/DatePicker/Datetime/components/FooterRow.d.ts +1 -0
- package/ui/Elements/DatePicker/Datetime/components/FooterRow.js +7 -0
- package/ui/Elements/DatePicker/Datetime/components/FooterRowLabel.d.ts +1 -0
- package/ui/Elements/DatePicker/Datetime/components/FooterRowLabel.js +7 -0
- package/ui/Elements/DatePicker/Datetime/components/ShortDatePick.d.ts +7 -0
- package/ui/Elements/DatePicker/Datetime/components/ShortDatePick.js +19 -0
- package/ui/Elements/DatePicker/Datetime/components/TimeInput.d.ts +1 -0
- package/ui/Elements/DatePicker/Datetime/components/TimeInput.js +7 -0
- package/ui/Elements/DatePicker/Datetime/components/Timepicker.js +11 -40
- package/ui/Elements/DatePicker/Datetime/views/DaysView.d.ts +1 -1
- package/ui/Elements/DatePicker/Datetime/views/DaysView.js +5 -5
- package/ui/index.es.js +10277 -10220
- package/ui/index.umd.js +524 -540
- package/ui/utils/translations.js +1 -1
package/package.json
CHANGED
|
@@ -80,7 +80,7 @@ var DatePickerRange = function (props) {
|
|
|
80
80
|
secondDate.setMonth(secondDate.getMonth() + 1);
|
|
81
81
|
}
|
|
82
82
|
else {
|
|
83
|
-
firstDate.setMonth(firstDate.getMonth()
|
|
83
|
+
firstDate.setMonth(firstDate.getMonth());
|
|
84
84
|
}
|
|
85
85
|
return [firstDate, secondDate];
|
|
86
86
|
}, [cleanValue, initialView]);
|
|
@@ -107,7 +107,7 @@ var DatePickerRange = function (props) {
|
|
|
107
107
|
// Check if the second value is not selected and the first value is the same as the initial value
|
|
108
108
|
var secondDatePickerValue = cleanValue[1] === null ? cleanValue[0] : cleanValue[1];
|
|
109
109
|
var ref = useClickOutside({ onClose: onClose });
|
|
110
|
-
return (_jsxs("div", { ref: ref, children: [_jsx(Input, { name: props.name, placeholder: placeholder, type: "text", icon: "calendar", value: pickerRangeToString(cleanValue), label: props.label, onFocus: openPicker, iconOnClick: openPicker, onClear: clear, error: error, readOnly: true }), _jsx(OverlayComponent, { children: _jsx(_Fragment, { children: isOpen && (_jsxs(RangeWrapper, { className: "ignore-element-for-closing-hook", children: [_jsx(DatePicker, __assign({}, rest, { timeFormat: timeFormat, value: (_c = cleanValue[0]) !== null && _c !== void 0 ? _c : '', initialViewDate: initialViewDate[0], secondValue: endRangeValue, onChange: setDateFrom, icon: false, label: isOpen && i18n._({ id: 'dataGrid.filterCell.from', message: 'From' }), isValidDate: isValidDateFrom, input: false, spaceAround: true, open: true, disabled: cleanValue[0] === null })), _jsx(DatePicker, __assign({}, rest, { timeFormat: timeFormat, value: secondDatePickerValue, initialViewDate: initialViewDate[1], secondValue: startRangeValue, onChange: setDateTo, icon: false, label: isOpen && i18n._({ id: 'dataGrid.filterCell.to', message: 'To' }), isValidDate: isValidDateTo, input: false, spaceAround: true, open: true, disabled: secondDatePickerValue === null }))] })) }) })] }));
|
|
110
|
+
return (_jsxs("div", { ref: ref, children: [_jsx(Input, { name: props.name, placeholder: placeholder, type: "text", icon: "calendar", value: pickerRangeToString(cleanValue), label: props.label, onFocus: openPicker, iconOnClick: openPicker, onClear: clear, error: error, readOnly: true }), _jsx(OverlayComponent, { children: _jsx(_Fragment, { children: isOpen && (_jsxs(RangeWrapper, { className: "ignore-element-for-closing-hook", children: [_jsx(DatePicker, __assign({}, rest, { timeFormat: timeFormat, value: (_c = cleanValue[0]) !== null && _c !== void 0 ? _c : '', initialViewDate: initialViewDate[0], secondValue: endRangeValue, onChange: setDateFrom, icon: false, label: isOpen && i18n._({ id: 'dataGrid.filterCell.from', message: 'From' }), isValidDate: isValidDateFrom, input: false, spaceAround: true, open: true, disabled: cleanValue[0] === null })), _jsx(DatePicker, __assign({}, rest, { timeFormat: timeFormat, value: secondDatePickerValue, initialViewDate: initialViewDate[1], secondValue: startRangeValue, onChange: setDateTo, icon: false, label: isOpen && i18n._({ id: 'dataGrid.filterCell.to', message: 'To' }), isValidDate: isValidDateTo, input: false, spaceAround: true, open: true, disabled: secondDatePickerValue === null, isSecondDatePicker: true }))] })) }) })] }));
|
|
111
111
|
};
|
|
112
112
|
export default DatePickerRange;
|
|
113
113
|
var templateObject_1;
|
|
@@ -46,7 +46,7 @@ export default {
|
|
|
46
46
|
title: 'Blocks/CommonGrid',
|
|
47
47
|
decorators: [withRedux]
|
|
48
48
|
};
|
|
49
|
-
export var ComplexWithPaginationAndRedux = function () { return (_jsxs(LinguiContainer, { children: [_jsx(ConnectedFilterSetter, { gridActions: gridDummyActions }), _jsx(ReduxGrid, { columnsDefinitions: columnDefinitions, actionColumnDefinition: ActionColumnButtons, rowsData: createRandomData(10), onRowAction: onRowAction, onRowReadClick: onRowReadClick, onRowEditClick: onRowEditClick, totalRowsCount: 200, onBatchAction: onBatchAction, getRowsPerPage: getRowsPerPage, quickFilter: "
|
|
49
|
+
export var ComplexWithPaginationAndRedux = function () { return (_jsxs(LinguiContainer, { children: [_jsx(ConnectedFilterSetter, { gridActions: gridDummyActions }), _jsx(ReduxGrid, { columnsDefinitions: columnDefinitions, actionColumnDefinition: ActionColumnButtons, rowsData: createRandomData(10), onRowAction: onRowAction, onRowReadClick: onRowReadClick, onRowEditClick: onRowEditClick, totalRowsCount: 200, onBatchAction: onBatchAction, getRowsPerPage: getRowsPerPage, quickFilter: "textColumn", extraControlButtons: extraControlButtons, comparators: comparators, gridName: "gridName" })] })); };
|
|
50
50
|
ComplexWithPaginationAndRedux.story = {
|
|
51
51
|
name: 'Complex, with pagination and redux'
|
|
52
52
|
};
|
|
@@ -15,7 +15,7 @@ export var BottomWrapper = styled(x.div)(templateObject_1 || (templateObject_1 =
|
|
|
15
15
|
export var ContentContainer = styled(x.div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n background-color: white;\n box-shadow: gridShadow;\n border-radius: 8px;\n flex-grow: 1;\n"], ["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n background-color: white;\n box-shadow: gridShadow;\n border-radius: 8px;\n flex-grow: 1;\n"])));
|
|
16
16
|
export var CommonGridWrap = styled(x.div)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-grow: 1;\n"], ["\n flex-grow: 1;\n"])));
|
|
17
17
|
export var StyledButtonStrip = styled(x.div)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: relative;\n padding: 18px 20px;\n display: flex;\n justify-content: space-between;\n width: 100%;\n min-height: 75px;\n flex-wrap: wrap;\n z-index: 2;\n"], ["\n position: relative;\n padding: 18px 20px;\n display: flex;\n justify-content: space-between;\n width: 100%;\n min-height: 75px;\n flex-wrap: wrap;\n z-index: 2;\n"])));
|
|
18
|
-
export var CommonGridWithStyles = styled(CommonGrid)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n & .cell {\n padding: 0 4px;\n }\n & .dataRow {\n font-size: 12px;\n font-family: ", ";\n color: typoPrimary;\n font-weight: normal;\n border-bottom: 1px solid;\n border-color: lightGray3;\n height: 40px;\n }\n & .gridHead {\n background-color: neutral20;\n padding-bottom: 8px;\n position: sticky;\n top: -1px;\n z-index: 1;\n padding-left: 12px;\n border-top: 1px solid ", ";\n @media (min-width: 1024px) {\n padding-left: 20px;\n }\n }\n & .headRow {\n font-size: 12px;\n font-family: ", ";\n color: typoPrimary;\n font-weight: bold;\n border-bottom: none; // TODO fix in common-grid\n\n & .cell {\n overflow: hidden;\n position: relative;\n }\n & .sticky {\n background-color: #fafbfc;\n }\n }\n & .filterRow {\n & .cell {\n overflow: visible;\n }\n & .cell > div {\n width: 100%; // TODO fix in common-grid\n }\n & .sticky {\n background-color: #fafbfc;\n }\n border-bottom: none; // TODO fix in common-grid\n }\n & .body {\n margin: 0 1px 1px 1px; // matching margin with .gridHead\n padding-left: 12px;\n flex-grow: 1;\n @media (min-width: 1024px) {\n padding-left: 20px;\n }\n }\n & .gridWrapper {\n background-color: ", ";\n width: ", ";\n padding-bottom: ", ";\n\n @media (min-width: 1024px) {\n height: ", ";\n overflow-y: auto;\n width: auto;\n padding-bottom: 0;\n }\n @media print {\n margin: 0;\n width: 100%;\n height: auto;\n overflow-x: hidden;\n }\n }\n\n & .fullWidthGrid > .gridWrapper > div {\n width: 100% !important;\n }\n\n & .paginatorWrapper,\n & .buttonsStrip {\n @media print {\n display: none;\n }\n }\n & .cell {\n padding-left: 2px;\n padding-right: 2px;\n @media print {\n white-space: unset;\n }\n }\n\n .dataRow {\n &.grayedOut {\n background: lightGray1;\n }\n\n .sticky-right {\n border-left: 1px solid #dfe1e6;\n }\n .sticky-left {\n border-right: 1px solid #dfe1e6;\n }\n }\n\n @media print {\n .filterRow .sticky {\n display: none;\n }\n\n .headRow .sticky {\n display: none;\n }\n\n .dataRow .sticky {\n display: none;\n }\n }\n\n .resizer {\n z-index: unset;\n }\n\n // hotfix table head\n .cell .sortable {\n display: flex;\n align-items: center;\n padding-right: 2px;\n }\n\n .sticky {\n position: sticky !important;\n max-width: 88px;\n }\n\n .sticky-left {\n left: 0;\n }\n\n .sticky-right {\n right: 0;\n }\n"], ["\n & .cell {\n padding: 0 4px;\n }\n & .dataRow {\n font-size: 12px;\n font-family: ", ";\n color: typoPrimary;\n font-weight: normal;\n border-bottom: 1px solid;\n border-color: lightGray3;\n height: 40px;\n }\n & .gridHead {\n background-color: neutral20;\n padding-bottom: 8px;\n position: sticky;\n top: -1px;\n z-index: 1;\n padding-left: 12px;\n border-top: 1px solid ", ";\n @media (min-width: 1024px) {\n padding-left: 20px;\n }\n }\n & .headRow {\n font-size: 12px;\n font-family: ", ";\n color: typoPrimary;\n font-weight: bold;\n border-bottom: none; // TODO fix in common-grid\n\n & .cell {\n overflow: hidden;\n position: relative;\n }\n & .sticky {\n background-color: #fafbfc;\n }\n }\n & .filterRow {\n & .cell {\n overflow: visible;\n }\n & .cell > div {\n width: 100%; // TODO fix in common-grid\n }\n & .sticky {\n background-color: #fafbfc;\n }\n border-bottom: none; // TODO fix in common-grid\n }\n & .body {\n margin: 0 1px 1px 1px; // matching margin with .gridHead\n padding-left: 12px;\n flex-grow: 1;\n @media (min-width: 1024px) {\n padding-left: 20px;\n }\n }\n & .gridWrapper {\n background-color: ", ";\n width: ", ";\n padding-bottom: ", ";\n\n @media (min-width: 1024px) {\n height: ", ";\n overflow-y: auto;\n width: auto;\n padding-bottom: 0;\n }\n @media print {\n margin: 0;\n width: 100%;\n height: auto;\n overflow-x: hidden;\n }\n }\n\n & .fullWidthGrid > .gridWrapper > div {\n width: 100% !important;\n }\n\n & .paginatorWrapper,\n & .buttonsStrip {\n @media print {\n display: none;\n }\n }\n & .cell {\n padding-left: 2px;\n padding-right: 2px;\n @media print {\n white-space: unset;\n }\n }\n\n .dataRow {\n &.grayedOut {\n background: lightGray1;\n }\n\n .sticky-right {\n border-left: 1px solid #dfe1e6;\n }\n .sticky-left {\n border-right: 1px solid #dfe1e6;\n }\n }\n\n @media print {\n .filterRow .sticky {\n display: none;\n }\n\n .headRow .sticky {\n display: none;\n }\n\n .dataRow .sticky {\n display: none;\n }\n }\n\n .resizer {\n z-index: unset;\n }\n\n // hotfix table head\n .cell .sortable {\n display: flex;\n align-items: center;\n padding-right: 2px;\n }\n\n .sticky {\n position: sticky !important;\n max-width: 88px;\n }\n\n .sticky-left {\n left: 0;\n }\n\n .sticky-right {\n right: 0;\n }\n"])), th('fonts.primary'), th('colors.lightGray6'), th('fonts.primary'), function (_a) {
|
|
18
|
+
export var CommonGridWithStyles = styled(CommonGrid)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n & .cell {\n padding: 0 4px;\n }\n & .dataRow {\n font-size: 12px;\n font-family: ", ";\n color: typoPrimary;\n font-weight: normal;\n border-bottom: 1px solid;\n border-color: lightGray3;\n height: 40px;\n }\n & .gridHead {\n background-color: neutral20;\n padding-bottom: 8px;\n position: sticky;\n top: -1px;\n z-index: 1;\n padding-left: 12px;\n border-top: 1px solid ", ";\n @media (min-width: 1024px) {\n padding-left: 20px;\n }\n }\n & .headRow {\n font-size: 12px;\n font-family: ", ";\n color: typoPrimary;\n font-weight: bold;\n border-bottom: none; // TODO fix in common-grid\n\n & .cell {\n overflow: hidden;\n position: relative;\n }\n & .sticky {\n background-color: #fafbfc;\n }\n }\n & .filterRow {\n & .cell {\n overflow: visible;\n }\n & .cell > div {\n width: 100%; // TODO fix in common-grid\n }\n & .sticky {\n background-color: #fafbfc;\n }\n border-bottom: none; // TODO fix in common-grid\n }\n & .body {\n margin: 0 1px 1px 1px; // matching margin with .gridHead\n padding-left: 12px;\n flex-grow: 1;\n @media (min-width: 1024px) {\n padding-left: 20px;\n }\n }\n & .gridWrapper {\n background-color: ", ";\n width: ", ";\n padding-bottom: ", ";\n min-height: ", ";\n\n @media (min-width: 1024px) {\n height: ", ";\n overflow-y: auto;\n width: auto;\n padding-bottom: 0;\n }\n @media print {\n margin: 0;\n width: 100%;\n height: auto;\n overflow-x: hidden;\n }\n }\n\n & .fullWidthGrid > .gridWrapper > div {\n width: 100% !important;\n }\n\n & .paginatorWrapper,\n & .buttonsStrip {\n @media print {\n display: none;\n }\n }\n & .cell {\n padding-left: 2px;\n padding-right: 2px;\n @media print {\n white-space: unset;\n }\n }\n\n .dataRow {\n &.grayedOut {\n background: lightGray1;\n }\n\n .sticky-right {\n border-left: 1px solid #dfe1e6;\n }\n .sticky-left {\n border-right: 1px solid #dfe1e6;\n }\n }\n\n @media print {\n .filterRow .sticky {\n display: none;\n }\n\n .headRow .sticky {\n display: none;\n }\n\n .dataRow .sticky {\n display: none;\n }\n }\n\n .resizer {\n z-index: unset;\n }\n\n // hotfix table head\n .cell .sortable {\n display: flex;\n align-items: center;\n padding-right: 2px;\n }\n\n .sticky {\n position: sticky !important;\n max-width: 88px;\n }\n\n .sticky-left {\n left: 0;\n }\n\n .sticky-right {\n right: 0;\n }\n"], ["\n & .cell {\n padding: 0 4px;\n }\n & .dataRow {\n font-size: 12px;\n font-family: ", ";\n color: typoPrimary;\n font-weight: normal;\n border-bottom: 1px solid;\n border-color: lightGray3;\n height: 40px;\n }\n & .gridHead {\n background-color: neutral20;\n padding-bottom: 8px;\n position: sticky;\n top: -1px;\n z-index: 1;\n padding-left: 12px;\n border-top: 1px solid ", ";\n @media (min-width: 1024px) {\n padding-left: 20px;\n }\n }\n & .headRow {\n font-size: 12px;\n font-family: ", ";\n color: typoPrimary;\n font-weight: bold;\n border-bottom: none; // TODO fix in common-grid\n\n & .cell {\n overflow: hidden;\n position: relative;\n }\n & .sticky {\n background-color: #fafbfc;\n }\n }\n & .filterRow {\n & .cell {\n overflow: visible;\n }\n & .cell > div {\n width: 100%; // TODO fix in common-grid\n }\n & .sticky {\n background-color: #fafbfc;\n }\n border-bottom: none; // TODO fix in common-grid\n }\n & .body {\n margin: 0 1px 1px 1px; // matching margin with .gridHead\n padding-left: 12px;\n flex-grow: 1;\n @media (min-width: 1024px) {\n padding-left: 20px;\n }\n }\n & .gridWrapper {\n background-color: ", ";\n width: ", ";\n padding-bottom: ", ";\n min-height: ", ";\n\n @media (min-width: 1024px) {\n height: ", ";\n overflow-y: auto;\n width: auto;\n padding-bottom: 0;\n }\n @media print {\n margin: 0;\n width: 100%;\n height: auto;\n overflow-x: hidden;\n }\n }\n\n & .fullWidthGrid > .gridWrapper > div {\n width: 100% !important;\n }\n\n & .paginatorWrapper,\n & .buttonsStrip {\n @media print {\n display: none;\n }\n }\n & .cell {\n padding-left: 2px;\n padding-right: 2px;\n @media print {\n white-space: unset;\n }\n }\n\n .dataRow {\n &.grayedOut {\n background: lightGray1;\n }\n\n .sticky-right {\n border-left: 1px solid #dfe1e6;\n }\n .sticky-left {\n border-right: 1px solid #dfe1e6;\n }\n }\n\n @media print {\n .filterRow .sticky {\n display: none;\n }\n\n .headRow .sticky {\n display: none;\n }\n\n .dataRow .sticky {\n display: none;\n }\n }\n\n .resizer {\n z-index: unset;\n }\n\n // hotfix table head\n .cell .sortable {\n display: flex;\n align-items: center;\n padding-right: 2px;\n }\n\n .sticky {\n position: sticky !important;\n max-width: 88px;\n }\n\n .sticky-left {\n left: 0;\n }\n\n .sticky-right {\n right: 0;\n }\n"])), th('fonts.primary'), th('colors.lightGray6'), th('fonts.primary'), function (_a) {
|
|
19
19
|
var theme = _a.theme;
|
|
20
20
|
return theme.colors.white;
|
|
21
21
|
}, function (_a) {
|
|
@@ -24,6 +24,9 @@ export var CommonGridWithStyles = styled(CommonGrid)(templateObject_5 || (templa
|
|
|
24
24
|
}, function (_a) {
|
|
25
25
|
var height = _a.height;
|
|
26
26
|
return (height ? '35px' : '0');
|
|
27
|
+
}, function (_a) {
|
|
28
|
+
var minHeight = _a.minHeight;
|
|
29
|
+
return (minHeight ? "".concat(minHeight, "px") : '0');
|
|
27
30
|
}, function (_a) {
|
|
28
31
|
var height = _a.height;
|
|
29
32
|
return (height ? "".concat(height, "px") : '475px');
|
|
@@ -254,6 +254,7 @@ export type CommonGridProps<TData extends RowProps = RowProps> = {
|
|
|
254
254
|
gridActions: GridActionsType;
|
|
255
255
|
isLoading?: boolean;
|
|
256
256
|
autoHeight?: boolean;
|
|
257
|
+
minHeight?: number;
|
|
257
258
|
rowsData: TData[];
|
|
258
259
|
hasColouredRows?: boolean;
|
|
259
260
|
columnsDefinitions: ColumnDefinition[];
|
|
@@ -49,6 +49,7 @@ var Datetime = /** @class */ (function (_super) {
|
|
|
49
49
|
var viewProps = {
|
|
50
50
|
viewDate: state.viewDate.clone(),
|
|
51
51
|
label: props.label,
|
|
52
|
+
isSecondDatePicker: props.isSecondDatePicker,
|
|
52
53
|
secondValue: props.secondValue,
|
|
53
54
|
selectedDate: _this.getSelectedDate(),
|
|
54
55
|
isValidDate: props.isValidDate,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FooterRow: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {}, never>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import { styled } from '@xstyled/styled-components';
|
|
6
|
+
export var FooterRow = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n font-size: 15px;\n line-height: 23px;\n"], ["\n display: flex;\n justify-content: space-between;\n align-items: center;\n font-size: 15px;\n line-height: 23px;\n"])));
|
|
7
|
+
var templateObject_1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FooterRowLabel: import("styled-components").StyledComponent<"span", import("@xstyled/system").Theme, {}, never>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import styled from '@xstyled/styled-components';
|
|
6
|
+
export var FooterRowLabel = styled.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-left: 8px;\n text-align: left;\n width: 100%;\n\n &[data-value] {\n cursor: pointer;\n &:hover {\n font-weight: 500;\n }\n }\n"], ["\n margin-left: 8px;\n text-align: left;\n width: 100%;\n\n &[data-value] {\n cursor: pointer;\n &:hover {\n font-weight: 500;\n }\n }\n"])));
|
|
7
|
+
var templateObject_1;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Icon from '../../../Icon';
|
|
3
|
+
import { i18n } from '@lingui/core';
|
|
4
|
+
import { x } from '@xstyled/styled-components';
|
|
5
|
+
import { FooterRow } from './FooterRow';
|
|
6
|
+
import { FooterRowLabel } from './FooterRowLabel';
|
|
7
|
+
export var ShortDatePick = function (_a) {
|
|
8
|
+
var setDate = _a.setDate, isSecondDatePicker = _a.isSecondDatePicker;
|
|
9
|
+
var today = new Date();
|
|
10
|
+
var yesterday = new Date(today.getTime() - 24 * 60 * 60 * 1000);
|
|
11
|
+
var tomorrow = new Date(today.getTime() + 24 * 60 * 60 * 1000);
|
|
12
|
+
var last7Days = new Date(today.getTime() - 24 * 60 * 60 * 1000 * 7);
|
|
13
|
+
var nextWeek = new Date(today.getTime() + 24 * 60 * 60 * 1000 * 7);
|
|
14
|
+
return (_jsxs(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, { onClick: setDate, "data-value": today.getDate(), "data-month": today.getMonth(), "data-year": today.getFullYear(), children: i18n._({ id: 'dataGrid.filterCell.today', message: 'Today' }) })] }), _jsxs(x.div, { textTransform: "capitalize", children: [new Intl.DateTimeFormat(undefined, { weekday: 'short' }).format(today), ",", ' ', new Intl.DateTimeFormat(undefined, { month: 'short' }).format(today), " ", today.getDate()] })] }), _jsxs(FooterRow, { children: [_jsxs(x.div, { display: "flex", alignItems: "center", flex: "1", children: [_jsx(Icon, { icon: "calendar" }), _jsx(FooterRowLabel, { onClick: setDate, "data-value": (isSecondDatePicker ? tomorrow : yesterday).getDate(), "data-month": (isSecondDatePicker ? tomorrow : yesterday).getMonth(), "data-year": (isSecondDatePicker ? tomorrow : yesterday).getFullYear(), children: isSecondDatePicker
|
|
15
|
+
? i18n._({ id: 'dataGrid.filterCell.tomorrow', message: 'Tomorrow' })
|
|
16
|
+
: i18n._({ id: 'dataGrid.filterCell.yesterday', message: 'Yesterday' }) })] }), _jsx(x.div, { children: _jsxs(x.div, { textTransform: "capitalize", children: [new Intl.DateTimeFormat(undefined, { weekday: 'short' }).format(isSecondDatePicker ? tomorrow : yesterday), ",", ' ', new Intl.DateTimeFormat(undefined, { month: 'short' }).format(isSecondDatePicker ? tomorrow : yesterday), ' ', isSecondDatePicker ? tomorrow.getDate() : yesterday.getDate()] }) })] }), _jsxs(FooterRow, { children: [_jsxs(x.div, { display: "flex", alignItems: "center", flex: "1", children: [_jsx(Icon, { icon: "calendar" }), _jsx(FooterRowLabel, { onClick: setDate, "data-value": isSecondDatePicker ? nextWeek.getDate() : last7Days.getDate(), "data-month": isSecondDatePicker ? nextWeek.getMonth() : last7Days.getMonth(), "data-year": isSecondDatePicker ? nextWeek.getFullYear() : last7Days.getFullYear(), children: isSecondDatePicker
|
|
17
|
+
? i18n._({ id: 'dataGrid.filterCell.nextWeek', message: 'Next week' })
|
|
18
|
+
: i18n._({ id: 'dataGrid.filterCell.lastWeek', message: 'Last week' }) })] }), _jsxs(x.div, { textTransform: "capitalize", children: [new Intl.DateTimeFormat(undefined, { weekday: 'short' }).format(isSecondDatePicker ? nextWeek : last7Days), ",", ' ', new Intl.DateTimeFormat(undefined, { month: 'short' }).format(isSecondDatePicker ? nextWeek : last7Days), ' ', isSecondDatePicker ? nextWeek.getDate() : last7Days.getDate()] })] })] }));
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TimeInput: import("styled-components").StyledComponent<"input", import("@xstyled/system").Theme, {}, never>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import styled from '@xstyled/styled-components';
|
|
6
|
+
export var TimeInput = styled.input(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin: 0;\n margin-right: -1px;\n padding: 0;\n border: none;\n outline: none;\n color: blue2;\n\n &::-webkit-calendar-picker-indicator {\n display: none;\n }\n"], ["\n margin: 0;\n margin-right: -1px;\n padding: 0;\n border: none;\n outline: none;\n color: blue2;\n\n &::-webkit-calendar-picker-indicator {\n display: none;\n }\n"])));
|
|
7
|
+
var templateObject_1;
|
|
@@ -1,50 +1,22 @@
|
|
|
1
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
-
return cooked;
|
|
4
|
-
};
|
|
5
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
2
|
import { useCallback, useEffect, useState } from 'react';
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
import Icon from '../../../Icon';
|
|
4
|
+
import { i18n } from '@lingui/core';
|
|
5
|
+
import { x } from '@xstyled/styled-components';
|
|
6
|
+
import { FooterRow } from './FooterRow';
|
|
7
|
+
import { FooterRowLabel } from './FooterRowLabel';
|
|
8
|
+
import { TimeInput } from './TimeInput';
|
|
13
9
|
export var Timepicker = function (_a) {
|
|
14
10
|
var _b, _c, _d, _e;
|
|
15
11
|
var setTime = _a.setTime, value = _a.value, disabled = _a.disabled;
|
|
16
12
|
var initialHours = (_c = (_b = value === null || value === void 0 ? void 0 : value.getHours) === null || _b === void 0 ? void 0 : _b.call(value)) !== null && _c !== void 0 ? _c : 0;
|
|
17
13
|
var initialMinutes = (_e = (_d = value === null || value === void 0 ? void 0 : value.getMinutes) === null || _d === void 0 ? void 0 : _d.call(value)) !== null && _e !== void 0 ? _e : 0;
|
|
18
|
-
var regExp = '^[0-9]*$';
|
|
19
14
|
var _f = useState(initialHours), hours = _f[0], setHours = _f[1];
|
|
20
15
|
var _g = useState(initialMinutes), minutes = _g[0], setMinutes = _g[1];
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
hours === 0 ? setHours(23) : setHours(hours - 1);
|
|
26
|
-
}, [hours]);
|
|
27
|
-
var increaseMinutes = useCallback(function () {
|
|
28
|
-
minutes >= 55 ? setMinutes(minutes - 55) : setMinutes(minutes + 5);
|
|
29
|
-
}, [minutes]);
|
|
30
|
-
var decreaseMinutes = useCallback(function () {
|
|
31
|
-
minutes <= 5 ? setMinutes(minutes + 55) : setMinutes(minutes - 5);
|
|
32
|
-
}, [minutes]);
|
|
33
|
-
var onHoursChange = useCallback(function (e) {
|
|
34
|
-
if (e.target.value.match(regExp) && Number(e.target.value) <= 23) {
|
|
35
|
-
setHours(Number(e.target.value));
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
setHours(0);
|
|
39
|
-
}
|
|
40
|
-
}, []);
|
|
41
|
-
var onMinutesChange = useCallback(function (e) {
|
|
42
|
-
if (e.target.value.match(regExp) && Number(e.target.value) <= 59) {
|
|
43
|
-
setMinutes(Number(e.target.value));
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
setMinutes(0);
|
|
47
|
-
}
|
|
16
|
+
var onChange = useCallback(function (e) {
|
|
17
|
+
var _a = e.target.value.split(':'), hours = _a[0], minutes = _a[1];
|
|
18
|
+
setHours(Number(hours));
|
|
19
|
+
setMinutes(Number(minutes));
|
|
48
20
|
}, []);
|
|
49
21
|
useEffect(function () {
|
|
50
22
|
!!value && setTime('hours', hours);
|
|
@@ -52,6 +24,5 @@ export var Timepicker = function (_a) {
|
|
|
52
24
|
useEffect(function () {
|
|
53
25
|
!!value && setTime('minutes', minutes);
|
|
54
26
|
}, [minutes]);
|
|
55
|
-
return (_jsx(
|
|
27
|
+
return (_jsx(x.div, { borderTop: "1px solid", borderColor: "lightGray2", pt: "8px", mb: "8px", children: _jsxs(FooterRow, { children: [_jsxs(x.div, { children: [_jsx(Icon, { icon: "clock" }), _jsx(FooterRowLabel, { children: i18n._({ id: 'dataGrid.filterCell.time', message: 'Time' }) })] }), _jsx(x.div, { display: "flex", alignItems: "center", children: _jsx(TimeInput, { type: "time", onChange: onChange, disabled: disabled, defaultValue: "00:00" }) })] }) }));
|
|
56
28
|
};
|
|
57
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -9,6 +9,6 @@ export default class DaysView extends React.Component {
|
|
|
9
9
|
renderDayHeaders(): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
renderDays(): import("react/jsx-runtime").JSX.Element[];
|
|
11
11
|
renderDay(date: any, startOfMonth: any, endOfMonth: any): any;
|
|
12
|
-
renderFooter(): import("react/jsx-runtime").JSX.Element
|
|
12
|
+
renderFooter(): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
_setDate: (e: any) => void;
|
|
14
14
|
}
|
|
@@ -29,6 +29,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
29
29
|
import React from 'react';
|
|
30
30
|
import { Timepicker } from '../components/Timepicker';
|
|
31
31
|
import ViewNavigation from '../components/ViewNavigation';
|
|
32
|
+
import { ShortDatePick } from '../components/ShortDatePick';
|
|
32
33
|
var DaysView = /** @class */ (function (_super) {
|
|
33
34
|
__extends(DaysView, _super);
|
|
34
35
|
function DaysView() {
|
|
@@ -78,7 +79,7 @@ var DaysView = /** @class */ (function (_super) {
|
|
|
78
79
|
key: date.format('M_D'),
|
|
79
80
|
'data-value': date.date(),
|
|
80
81
|
'data-month': date.month(),
|
|
81
|
-
'data-year': date.year()
|
|
82
|
+
'data-year': date.year()
|
|
82
83
|
};
|
|
83
84
|
var className = 'rdtDay';
|
|
84
85
|
if (date.isBefore(startOfMonth)) {
|
|
@@ -112,16 +113,15 @@ var DaysView = /** @class */ (function (_super) {
|
|
|
112
113
|
return this.props.renderDay(dayProps, date.clone(), selectedDate && selectedDate.clone());
|
|
113
114
|
};
|
|
114
115
|
DaysView.prototype.renderFooter = function () {
|
|
115
|
-
if (!this.props.timeFormat)
|
|
116
|
-
return;
|
|
117
116
|
var setTime = this.props.setTime;
|
|
117
|
+
var setDate = this._setDate;
|
|
118
118
|
var value = this.props.value;
|
|
119
119
|
var disabled = this.props.disabled;
|
|
120
|
-
return (_jsx("tfoot", { children: _jsx("tr", { children: _jsx(Timepicker, { setTime: setTime, value: value, disabled: disabled }) }) }));
|
|
120
|
+
return (_jsx("tfoot", { children: _jsx("tr", { children: _jsxs("td", { colSpan: 7, children: [_jsx(ShortDatePick, { setDate: setDate, isSecondDatePicker: this.props.isSecondDatePicker }), this.props.timeFormat && _jsx(Timepicker, { setTime: setTime, value: value, disabled: disabled })] }) }) }));
|
|
121
121
|
};
|
|
122
122
|
DaysView.defaultProps = {
|
|
123
123
|
isValidDate: function () { return true; },
|
|
124
|
-
renderDay: function (props, date) { return _jsx("td", __assign({}, props, { children: date.date() })); }
|
|
124
|
+
renderDay: function (props, date) { return _jsx("td", __assign({}, props, { children: date.date() })); }
|
|
125
125
|
};
|
|
126
126
|
return DaysView;
|
|
127
127
|
}(React.Component));
|