pds-dev-kit-web 2.2.160 → 2.2.161
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.
|
@@ -57,6 +57,22 @@ var DatePicker = function (_a) {
|
|
|
57
57
|
var _d = (0, react_1.useState)(function () {
|
|
58
58
|
return dateHelper_1.DateHelper.startOfMonth(dateHelper_1.DateHelper.parseDate(startDate));
|
|
59
59
|
}), currentMonth = _d[0], setCurrentMonth = _d[1];
|
|
60
|
+
var isPrevButtonDisabled = (0, react_1.useMemo)(function () {
|
|
61
|
+
if (!minDate)
|
|
62
|
+
return false;
|
|
63
|
+
var parsedMinDate = dateHelper_1.DateHelper.parseDate(minDate);
|
|
64
|
+
return (currentMonth.getFullYear() < parsedMinDate.getFullYear() ||
|
|
65
|
+
(currentMonth.getFullYear() === parsedMinDate.getFullYear() &&
|
|
66
|
+
currentMonth.getMonth() <= parsedMinDate.getMonth()));
|
|
67
|
+
}, [currentMonth, minDate]);
|
|
68
|
+
var isNextButtonDisabled = (0, react_1.useMemo)(function () {
|
|
69
|
+
if (!maxDate)
|
|
70
|
+
return false;
|
|
71
|
+
var parsedMaxDate = dateHelper_1.DateHelper.parseDate(maxDate);
|
|
72
|
+
return (currentMonth.getFullYear() > parsedMaxDate.getFullYear() ||
|
|
73
|
+
(currentMonth.getFullYear() === parsedMaxDate.getFullYear() &&
|
|
74
|
+
currentMonth.getMonth() >= parsedMaxDate.getMonth()));
|
|
75
|
+
}, [currentMonth, maxDate]);
|
|
60
76
|
var handleDateClick = function (target) {
|
|
61
77
|
if (!onChange)
|
|
62
78
|
return;
|
|
@@ -95,7 +111,8 @@ var DatePicker = function (_a) {
|
|
|
95
111
|
return ((0, jsx_runtime_1.jsxs)(CalendarContainer, __assign({ id: id }, { children: [(0, jsx_runtime_1.jsx)(DatePickerHeader_1.default, { headerTitle: t('str_35', {
|
|
96
112
|
year: currentMonth.getFullYear(),
|
|
97
113
|
month: String(currentMonth.getMonth() + 1)
|
|
98
|
-
}), textButtonText: quickActionMode === 'use' ? quickActionBtnText : undefined, isTextButtonDisabled: currentMonth.
|
|
114
|
+
}), textButtonText: quickActionMode === 'use' ? quickActionBtnText : undefined, isTextButtonDisabled: currentMonth.getFullYear() === new Date().getFullYear() &&
|
|
115
|
+
currentMonth.getMonth() === new Date().getMonth(), isPrevButtonDisabled: isPrevButtonDisabled, isNextButtonDisabled: isNextButtonDisabled, onClickPrevButton: function () { return setCurrentMonth(function (prev) { return dateHelper_1.DateHelper.addMonths(prev, -1); }); }, onClickNextButton: function () { return setCurrentMonth(function (prev) { return dateHelper_1.DateHelper.addMonths(prev, 1); }); }, onClickTextButton: handleQuickActionButtonClick }), (0, jsx_runtime_1.jsx)(components_1.Spacing, { size: "spacing_a" }), (0, jsx_runtime_1.jsxs)(S_MonthContainer, { children: [(0, jsx_runtime_1.jsx)(S_DayOfWeekContainer, __assign({ id: "weeks" }, { children: days
|
|
99
116
|
.slice(startOfWeek === 'monday' ? 1 : 0)
|
|
100
117
|
.concat(startOfWeek === 'monday' ? [t('str_3893')] : [])
|
|
101
118
|
.map(function (day) { return ((0, jsx_runtime_1.jsx)(S_DayOfWeek, { children: (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: day, styleTheme: "caption2Bold", colorTheme: "sysTextSecondary", textAlign: "center" }) }, "".concat(id, "_").concat(day))); }) })), (0, jsx_runtime_1.jsx)(S_Grid, { children: calendarDates.map(function (d) {
|
|
@@ -4,9 +4,11 @@ type Props = {
|
|
|
4
4
|
headerTitle: string;
|
|
5
5
|
textButtonText?: PDSTextType;
|
|
6
6
|
isTextButtonDisabled: boolean;
|
|
7
|
+
isPrevButtonDisabled: boolean;
|
|
8
|
+
isNextButtonDisabled: boolean;
|
|
7
9
|
onClickPrevButton: () => void;
|
|
8
10
|
onClickNextButton: () => void;
|
|
9
11
|
onClickTextButton: () => void;
|
|
10
12
|
};
|
|
11
|
-
declare function DatePickerHeader({ headerTitle, textButtonText, isTextButtonDisabled, onClickPrevButton, onClickNextButton, onClickTextButton }: Props): JSX.Element;
|
|
13
|
+
declare function DatePickerHeader({ headerTitle, textButtonText, isTextButtonDisabled, isPrevButtonDisabled, isNextButtonDisabled, onClickPrevButton, onClickNextButton, onClickTextButton }: Props): JSX.Element;
|
|
12
14
|
export default DatePickerHeader;
|
|
@@ -13,8 +13,8 @@ var IconButton_1 = require("../IconButton");
|
|
|
13
13
|
var TextButton_1 = require("../TextButton");
|
|
14
14
|
var TextLabel_1 = require("../TextLabel");
|
|
15
15
|
function DatePickerHeader(_a) {
|
|
16
|
-
var headerTitle = _a.headerTitle, textButtonText = _a.textButtonText, isTextButtonDisabled = _a.isTextButtonDisabled, onClickPrevButton = _a.onClickPrevButton, onClickNextButton = _a.onClickNextButton, onClickTextButton = _a.onClickTextButton;
|
|
17
|
-
return ((0, jsx_runtime_1.jsxs)(S_HeaderContainer, { children: [(0, jsx_runtime_1.jsx)(S_LeftIconWrapper, { children: (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { onClick: onClickPrevButton, iconName: "ic_arrow_left", baseColorKey: "ui_cpnt_button_fill_base_transparent", iconSize: 16, baseSize: "medium" }) }), (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: headerTitle, textAlign: "center" }), (0, jsx_runtime_1.jsx)(S_RightIconWrapper, { children: (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { onClick: onClickNextButton, iconName: "ic_arrow_right", baseColorKey: "ui_cpnt_button_fill_base_transparent", iconSize: 16, baseSize: "medium" }) }), textButtonText && ((0, jsx_runtime_1.jsx)(S_TextButtonWrapper, { children: (0, jsx_runtime_1.jsx)(TextButton_1.TextButton, { text: textButtonText, size: "xsmall", fontWeight: "bold", onClick: onClickTextButton, state: isTextButtonDisabled ? 'disabled' : 'normal' }) }))] }));
|
|
16
|
+
var headerTitle = _a.headerTitle, textButtonText = _a.textButtonText, isTextButtonDisabled = _a.isTextButtonDisabled, isPrevButtonDisabled = _a.isPrevButtonDisabled, isNextButtonDisabled = _a.isNextButtonDisabled, onClickPrevButton = _a.onClickPrevButton, onClickNextButton = _a.onClickNextButton, onClickTextButton = _a.onClickTextButton;
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)(S_HeaderContainer, { children: [(0, jsx_runtime_1.jsx)(S_LeftIconWrapper, { children: (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { onClick: onClickPrevButton, iconName: "ic_arrow_left", baseColorKey: "ui_cpnt_button_fill_base_transparent", iconSize: 16, baseSize: "medium", state: isPrevButtonDisabled ? 'disabled' : 'normal' }) }), (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, { text: headerTitle, textAlign: "center" }), (0, jsx_runtime_1.jsx)(S_RightIconWrapper, { children: (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { onClick: onClickNextButton, iconName: "ic_arrow_right", baseColorKey: "ui_cpnt_button_fill_base_transparent", iconSize: 16, baseSize: "medium", state: isNextButtonDisabled ? 'disabled' : 'normal' }) }), textButtonText && ((0, jsx_runtime_1.jsx)(S_TextButtonWrapper, { children: (0, jsx_runtime_1.jsx)(TextButton_1.TextButton, { text: textButtonText, size: "xsmall", fontWeight: "bold", onClick: onClickTextButton, state: isTextButtonDisabled ? 'disabled' : 'normal' }) }))] }));
|
|
18
18
|
}
|
|
19
19
|
var S_HeaderContainer = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-items: center;\n box-sizing: border-box;\n display: flex;\n justify-content: center;\n justify-items: center;\n margin: 0 ", ";\n position: relative;\n"], ["\n align-items: center;\n box-sizing: border-box;\n display: flex;\n justify-content: center;\n justify-items: center;\n margin: 0 ", ";\n position: relative;\n"])), function (_a) {
|
|
20
20
|
var theme = _a.theme;
|
package/package.json
CHANGED
package/release-note.md
CHANGED