@zohodesk/components 1.2.49 → 1.2.51
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/.cli/propValidation_report.html +1 -1
- package/README.md +19 -1
- package/es/DateTime/CalendarView.js +8 -5
- package/es/DateTime/DateTime.js +18 -4
- package/es/DateTime/DateTime.module.css +5 -5
- package/es/DateTime/DateWidget.js +5 -1
- package/es/DateTime/DaysRow.js +3 -2
- package/es/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +7 -7
- package/es/DateTime/props/defaultProps.js +9 -3
- package/es/DateTime/props/propTypes.js +11 -4
- package/es/Popup/Popup.js +32 -13
- package/es/Popup/intersectionObserver.js +33 -23
- package/es/v1/DateTime/CalendarView.js +9 -6
- package/es/v1/DateTime/DateTime.js +18 -4
- package/es/v1/DateTime/DateWidget.js +5 -1
- package/es/v1/DateTime/DaysRow.js +3 -2
- package/es/v1/DateTime/props/defaultProps.js +9 -3
- package/es/v1/DateTime/props/propTypes.js +11 -4
- package/lib/DateTime/CalendarView.js +8 -5
- package/lib/DateTime/DateTime.js +27 -4
- package/lib/DateTime/DateTime.module.css +5 -5
- package/lib/DateTime/DateWidget.js +5 -1
- package/lib/DateTime/DaysRow.js +3 -2
- package/lib/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +7 -7
- package/lib/DateTime/props/defaultProps.js +9 -3
- package/lib/DateTime/props/propTypes.js +11 -4
- package/lib/Popup/Popup.js +32 -14
- package/lib/Popup/intersectionObserver.js +35 -25
- package/lib/v1/DateTime/CalendarView.js +9 -6
- package/lib/v1/DateTime/DateTime.js +27 -4
- package/lib/v1/DateTime/DateWidget.js +5 -1
- package/lib/v1/DateTime/DaysRow.js +3 -2
- package/lib/v1/DateTime/props/defaultProps.js +9 -3
- package/lib/v1/DateTime/props/propTypes.js +11 -4
- package/package.json +3 -3
- package/result.json +1 -1
|
@@ -80,9 +80,11 @@ var CalendarView = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
80
80
|
dayNamesShort = _this$props.dayNamesShort,
|
|
81
81
|
todayMonth = _this$props.todayMonth,
|
|
82
82
|
todayDate = _this$props.todayDate,
|
|
83
|
-
todayYear = _this$props.todayYear
|
|
83
|
+
todayYear = _this$props.todayYear,
|
|
84
|
+
weekStartDay = _this$props.weekStartDay,
|
|
85
|
+
holidays = _this$props.holidays;
|
|
84
86
|
var userSeeDate = new Date(year, month, 1);
|
|
85
|
-
var userSeeDay = userSeeDate.getDay() + 1;
|
|
87
|
+
var userSeeDay = (userSeeDate.getDay() - weekStartDay + dayNames.length) % dayNames.length + 1;
|
|
86
88
|
var userSeeYear = userSeeDate.getFullYear();
|
|
87
89
|
var userSeeMonth = userSeeDate.getMonth();
|
|
88
90
|
var monthEnd = (0, _common.getMonthEnd)(month, year);
|
|
@@ -113,8 +115,8 @@ var CalendarView = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
113
115
|
isSelectedDay = false;
|
|
114
116
|
var tdclass = "".concat(_DateTimeModule["default"].datesStr, " ").concat(_DateTimeModule["default"].grid);
|
|
115
117
|
|
|
116
|
-
if (i
|
|
117
|
-
tdclass += " ".concat(_DateTimeModule["default"].
|
|
118
|
+
if (holidays.includes(i - 1)) {
|
|
119
|
+
tdclass += " ".concat(_DateTimeModule["default"].holiday);
|
|
118
120
|
}
|
|
119
121
|
|
|
120
122
|
if (incremleti >= userSeeDay && incremday <= monthEnd) {
|
|
@@ -218,7 +220,8 @@ var CalendarView = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
218
220
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_DaysRow["default"], {
|
|
219
221
|
dayNames: dayNames,
|
|
220
222
|
dayNamesShort: dayNamesShort,
|
|
221
|
-
ariaLabel: dayNamesShort
|
|
223
|
+
ariaLabel: dayNamesShort,
|
|
224
|
+
holidays: holidays
|
|
222
225
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
223
226
|
"data-id": "".concat(dataId, "_dateContainer"),
|
|
224
227
|
"data-test-id": "".concat(dataId, "_dateContainer"),
|
package/lib/DateTime/DateTime.js
CHANGED
|
@@ -43,6 +43,14 @@ var _dateFormat = require("./dateFormatUtils/dateFormat");
|
|
|
43
43
|
|
|
44
44
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
45
45
|
|
|
46
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
47
|
+
|
|
48
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
49
|
+
|
|
50
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
51
|
+
|
|
52
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
53
|
+
|
|
46
54
|
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
47
55
|
|
|
48
56
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -726,7 +734,9 @@ var DateTime = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
726
734
|
isRestrictScroll = _this$props7.isRestrictScroll,
|
|
727
735
|
dropBoxPortalId = _this$props7.dropBoxPortalId,
|
|
728
736
|
_this$props7$customPr = _this$props7.customProps,
|
|
729
|
-
customProps = _this$props7$customPr === void 0 ? {} : _this$props7$customPr
|
|
737
|
+
customProps = _this$props7$customPr === void 0 ? {} : _this$props7$customPr,
|
|
738
|
+
weekStartDay = _this$props7.weekStartDay,
|
|
739
|
+
holidays = _this$props7.holidays;
|
|
730
740
|
var _customProps$TimeProp = customProps.TimeProps,
|
|
731
741
|
TimeProps = _customProps$TimeProp === void 0 ? {} : _customProps$TimeProp;
|
|
732
742
|
var _i18nKeys$timeText = i18nKeys.timeText,
|
|
@@ -752,6 +762,17 @@ var DateTime = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
752
762
|
_i18nKeys$dayNamesSho = i18nKeys.dayNamesShort,
|
|
753
763
|
dayNamesShort = _i18nKeys$dayNamesSho === void 0 ? _constants.dayNamesShortDefault : _i18nKeys$dayNamesSho;
|
|
754
764
|
var showmonthtxt = title(date, year, month, monthNames);
|
|
765
|
+
var customDayNames = dayNames,
|
|
766
|
+
customDayNamesShort = dayNamesShort,
|
|
767
|
+
customizedHolidays = holidays;
|
|
768
|
+
|
|
769
|
+
if (weekStartDay !== 0) {
|
|
770
|
+
customDayNames = [].concat(_toConsumableArray(dayNames.slice(weekStartDay)), _toConsumableArray(dayNames.slice(0, weekStartDay)));
|
|
771
|
+
customDayNamesShort = [].concat(_toConsumableArray(dayNamesShort.slice(weekStartDay)), _toConsumableArray(dayNamesShort.slice(0, weekStartDay)));
|
|
772
|
+
customizedHolidays = holidays.map(function (dayIndex) {
|
|
773
|
+
return customDayNames.indexOf(dayNames[dayIndex]);
|
|
774
|
+
});
|
|
775
|
+
}
|
|
755
776
|
|
|
756
777
|
var childEle = /*#__PURE__*/_react["default"].createElement("div", {
|
|
757
778
|
className: "".concat(_DateTimeModule["default"].container, " ").concat(innerClass),
|
|
@@ -774,11 +795,13 @@ var DateTime = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
774
795
|
year: year,
|
|
775
796
|
month: month,
|
|
776
797
|
onSelect: this.dateSelect,
|
|
777
|
-
dayNames:
|
|
778
|
-
dayNamesShort:
|
|
798
|
+
dayNames: customDayNames,
|
|
799
|
+
dayNamesShort: customDayNamesShort,
|
|
779
800
|
todayDate: todayDate,
|
|
780
801
|
todayMonth: todayMonth,
|
|
781
|
-
todayYear: todayYear
|
|
802
|
+
todayYear: todayYear,
|
|
803
|
+
weekStartDay: weekStartDay,
|
|
804
|
+
holidays: customizedHolidays
|
|
782
805
|
}), isDateTimeField ? /*#__PURE__*/_react["default"].createElement(_Time["default"], {
|
|
783
806
|
timeText: timeText,
|
|
784
807
|
dataId: dataId,
|
|
@@ -112,9 +112,9 @@
|
|
|
112
112
|
margin-bottom: 0 ;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
.
|
|
116
|
-
.
|
|
117
|
-
.invalidDate.
|
|
115
|
+
.holiday,
|
|
116
|
+
.holiday:hover,
|
|
117
|
+
.invalidDate.holiday:hover {
|
|
118
118
|
color: var(--zdt_datetime_invalid_hover_text);
|
|
119
119
|
}
|
|
120
120
|
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
color: var(--zdt_datetime_invalid_text);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
.invalidDate.
|
|
125
|
+
.invalidDate.holiday,.inActiveDate.holiday:hover {
|
|
126
126
|
color: var(--zdt_datetime_invaliddate_text);
|
|
127
127
|
}
|
|
128
128
|
|
|
@@ -155,7 +155,7 @@ cursor: no-drop;
|
|
|
155
155
|
{
|
|
156
156
|
color: var(--zdt_datetime_invalid_text);
|
|
157
157
|
}
|
|
158
|
-
.inActiveDate:hover, .inActiveDate.
|
|
158
|
+
.inActiveDate:hover, .inActiveDate.holiday:hover{
|
|
159
159
|
background-color: var(--zdt_datetime_inactivedate_hover_bg);
|
|
160
160
|
|
|
161
161
|
}
|
|
@@ -1032,6 +1032,8 @@ var DateWidgetComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1032
1032
|
a11y = _this$props12.a11y,
|
|
1033
1033
|
boxSize = _this$props12.boxSize,
|
|
1034
1034
|
onError = _this$props12.onError,
|
|
1035
|
+
weekStartDay = _this$props12.weekStartDay,
|
|
1036
|
+
holidays = _this$props12.holidays,
|
|
1035
1037
|
_this$props12$customP = _this$props12.customProps,
|
|
1036
1038
|
customProps = _this$props12$customP === void 0 ? {} : _this$props12$customP;
|
|
1037
1039
|
var _customProps$DateTime = customProps.DateTimeProps,
|
|
@@ -1134,7 +1136,9 @@ var DateWidgetComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1134
1136
|
dropBoxPortalId: dropBoxPortalId,
|
|
1135
1137
|
boxSize: boxSize,
|
|
1136
1138
|
onError: onError,
|
|
1137
|
-
customProps: DateTimeProps
|
|
1139
|
+
customProps: DateTimeProps,
|
|
1140
|
+
weekStartDay: weekStartDay,
|
|
1141
|
+
holidays: holidays
|
|
1138
1142
|
}));
|
|
1139
1143
|
}
|
|
1140
1144
|
}]);
|
package/lib/DateTime/DaysRow.js
CHANGED
|
@@ -57,7 +57,8 @@ var DaysRow = /*#__PURE__*/function (_PureComponent) {
|
|
|
57
57
|
value: function render() {
|
|
58
58
|
var _this$props = this.props,
|
|
59
59
|
dayNames = _this$props.dayNames,
|
|
60
|
-
dayNamesShort = _this$props.dayNamesShort
|
|
60
|
+
dayNamesShort = _this$props.dayNamesShort,
|
|
61
|
+
holidays = _this$props.holidays;
|
|
61
62
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
62
63
|
alignBox: "row",
|
|
63
64
|
align: "center",
|
|
@@ -65,7 +66,7 @@ var DaysRow = /*#__PURE__*/function (_PureComponent) {
|
|
|
65
66
|
}, dayNames.map(function (dayName, index) {
|
|
66
67
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
67
68
|
key: dayName,
|
|
68
|
-
className: "".concat(_DateTimeModule["default"].daysStr, " ").concat(_DateTimeModule["default"].grid, " ").concat(index
|
|
69
|
+
className: "".concat(_DateTimeModule["default"].daysStr, " ").concat(_DateTimeModule["default"].grid, " ").concat(holidays.includes(index) ? _DateTimeModule["default"].holiday : ''),
|
|
69
70
|
"data-title": dayName,
|
|
70
71
|
"aria-label": dayName
|
|
71
72
|
}, dayNamesShort[index]);
|
|
@@ -96,7 +96,7 @@ exports[`DateTime rendering the isActive is true and isDefaultPosition is true 1
|
|
|
96
96
|
>
|
|
97
97
|
<div
|
|
98
98
|
aria-label="Sunday"
|
|
99
|
-
class="daysStr grid
|
|
99
|
+
class="daysStr grid holiday shrinkOff"
|
|
100
100
|
data-id="boxComponent"
|
|
101
101
|
data-selector-id="box"
|
|
102
102
|
data-test-id="boxComponent"
|
|
@@ -178,7 +178,7 @@ exports[`DateTime rendering the isActive is true and isDefaultPosition is true 1
|
|
|
178
178
|
>
|
|
179
179
|
<div
|
|
180
180
|
aria-label="25"
|
|
181
|
-
class="datesStr grid
|
|
181
|
+
class="datesStr grid holiday invalidDate shrinkOff"
|
|
182
182
|
data-id="dateTime_invalidDate"
|
|
183
183
|
data-selector-id="box"
|
|
184
184
|
data-test-id="dateTime_invalidDate"
|
|
@@ -248,7 +248,7 @@ exports[`DateTime rendering the isActive is true and isDefaultPosition is true 1
|
|
|
248
248
|
>
|
|
249
249
|
<div
|
|
250
250
|
aria-label="2"
|
|
251
|
-
class="datesStr grid
|
|
251
|
+
class="datesStr grid holiday shrinkOff"
|
|
252
252
|
data-id="dateTime_date"
|
|
253
253
|
data-selector-id="box"
|
|
254
254
|
data-test-id="dateTime_date"
|
|
@@ -318,7 +318,7 @@ exports[`DateTime rendering the isActive is true and isDefaultPosition is true 1
|
|
|
318
318
|
>
|
|
319
319
|
<div
|
|
320
320
|
aria-label="9"
|
|
321
|
-
class="datesStr grid
|
|
321
|
+
class="datesStr grid holiday shrinkOff"
|
|
322
322
|
data-id="dateTime_date"
|
|
323
323
|
data-selector-id="box"
|
|
324
324
|
data-test-id="dateTime_date"
|
|
@@ -388,7 +388,7 @@ exports[`DateTime rendering the isActive is true and isDefaultPosition is true 1
|
|
|
388
388
|
>
|
|
389
389
|
<div
|
|
390
390
|
aria-label="16"
|
|
391
|
-
class="datesStr grid
|
|
391
|
+
class="datesStr grid holiday shrinkOff"
|
|
392
392
|
data-id="dateTime_date"
|
|
393
393
|
data-selector-id="box"
|
|
394
394
|
data-test-id="dateTime_date"
|
|
@@ -458,7 +458,7 @@ exports[`DateTime rendering the isActive is true and isDefaultPosition is true 1
|
|
|
458
458
|
>
|
|
459
459
|
<div
|
|
460
460
|
aria-label="23"
|
|
461
|
-
class="datesStr grid
|
|
461
|
+
class="datesStr grid holiday shrinkOff"
|
|
462
462
|
data-id="dateTime_date"
|
|
463
463
|
data-selector-id="box"
|
|
464
464
|
data-test-id="dateTime_date"
|
|
@@ -528,7 +528,7 @@ exports[`DateTime rendering the isActive is true and isDefaultPosition is true 1
|
|
|
528
528
|
>
|
|
529
529
|
<div
|
|
530
530
|
aria-label="30"
|
|
531
|
-
class="datesStr grid
|
|
531
|
+
class="datesStr grid holiday shrinkOff"
|
|
532
532
|
data-id="dateTime_date"
|
|
533
533
|
data-selector-id="box"
|
|
534
534
|
data-test-id="dateTime_date"
|
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.YearView_defaultProps = exports.Time_defaultProps = exports.Span_defaultProps = exports.DateWidget_defaultProps = exports.DateTime_defaultProps = exports.DateTimePopupFooter_defaultProps = exports.CalendarView_defaultProps = void 0;
|
|
7
7
|
var CalendarView_defaultProps = {
|
|
8
8
|
dataId: 'dateContainer',
|
|
9
|
-
needBorder: true
|
|
9
|
+
needBorder: true,
|
|
10
|
+
weekStartDay: 0,
|
|
11
|
+
holidays: [0]
|
|
10
12
|
};
|
|
11
13
|
exports.CalendarView_defaultProps = CalendarView_defaultProps;
|
|
12
14
|
var Span_defaultProps = {
|
|
@@ -29,7 +31,9 @@ var DateTime_defaultProps = {
|
|
|
29
31
|
is24Hour: false,
|
|
30
32
|
isDefaultPosition: false,
|
|
31
33
|
customDateFormat: null,
|
|
32
|
-
customProps: {}
|
|
34
|
+
customProps: {},
|
|
35
|
+
weekStartDay: 0,
|
|
36
|
+
holidays: [0]
|
|
33
37
|
};
|
|
34
38
|
exports.DateTime_defaultProps = DateTime_defaultProps;
|
|
35
39
|
var DateWidget_defaultProps = {
|
|
@@ -53,7 +57,9 @@ var DateWidget_defaultProps = {
|
|
|
53
57
|
needErrorOnBlur: false,
|
|
54
58
|
isEditable: false,
|
|
55
59
|
iconOnHover: false,
|
|
56
|
-
is24Hour: false
|
|
60
|
+
is24Hour: false,
|
|
61
|
+
weekStartDay: 0,
|
|
62
|
+
holidays: [0]
|
|
57
63
|
};
|
|
58
64
|
exports.DateWidget_defaultProps = DateWidget_defaultProps;
|
|
59
65
|
var YearView_defaultProps = {
|
|
@@ -34,7 +34,9 @@ var CalendarView_propTypes = {
|
|
|
34
34
|
dayNamesShort: _propTypes["default"].array,
|
|
35
35
|
todayMonth: _propTypes["default"].string,
|
|
36
36
|
todayDate: _propTypes["default"].string,
|
|
37
|
-
todayYear: _propTypes["default"].string
|
|
37
|
+
todayYear: _propTypes["default"].string,
|
|
38
|
+
weekStartDay: _propTypes["default"].oneOf([0, 1, 2, 3, 4, 5, 6]),
|
|
39
|
+
holidays: _propTypes["default"].arrayOf(_propTypes["default"].number)
|
|
38
40
|
};
|
|
39
41
|
exports.CalendarView_propTypes = CalendarView_propTypes;
|
|
40
42
|
var Span_propTypes = {
|
|
@@ -98,7 +100,9 @@ var DateTime_propTypes = {
|
|
|
98
100
|
targetOffset: _propTypes["default"].string,
|
|
99
101
|
isRestrictScroll: _propTypes["default"].bool,
|
|
100
102
|
dropBoxPortalId: _propTypes["default"].string,
|
|
101
|
-
customProps: _propTypes["default"].object
|
|
103
|
+
customProps: _propTypes["default"].object,
|
|
104
|
+
weekStartDay: _propTypes["default"].oneOf([0, 1, 2, 3, 4, 5, 6]),
|
|
105
|
+
holidays: _propTypes["default"].arrayOf(_propTypes["default"].number)
|
|
102
106
|
};
|
|
103
107
|
exports.DateTime_propTypes = DateTime_propTypes;
|
|
104
108
|
var DateWidget_propTypes = {
|
|
@@ -168,7 +172,9 @@ var DateWidget_propTypes = {
|
|
|
168
172
|
dropBoxPortalId: _propTypes["default"].string,
|
|
169
173
|
a11y: _propTypes["default"].object,
|
|
170
174
|
getPopupProps: _propTypes["default"].func,
|
|
171
|
-
customProps: _propTypes["default"].object
|
|
175
|
+
customProps: _propTypes["default"].object,
|
|
176
|
+
weekStartDay: _propTypes["default"].oneOf([0, 1, 2, 3, 4, 5, 6]),
|
|
177
|
+
holidays: _propTypes["default"].arrayOf(_propTypes["default"].number)
|
|
172
178
|
};
|
|
173
179
|
exports.DateWidget_propTypes = DateWidget_propTypes;
|
|
174
180
|
var YearView_propTypes = {
|
|
@@ -199,7 +205,8 @@ var DateTimePopupHeader_propTypes = {
|
|
|
199
205
|
exports.DateTimePopupHeader_propTypes = DateTimePopupHeader_propTypes;
|
|
200
206
|
var DaysRow_propTypes = {
|
|
201
207
|
dayNames: _propTypes["default"].array,
|
|
202
|
-
dayNamesShort: _propTypes["default"].object
|
|
208
|
+
dayNamesShort: _propTypes["default"].object,
|
|
209
|
+
holidays: _propTypes["default"].arrayOf(_propTypes["default"].number)
|
|
203
210
|
};
|
|
204
211
|
exports.DaysRow_propTypes = DaysRow_propTypes;
|
|
205
212
|
var Time_propTypes = {
|
package/lib/Popup/Popup.js
CHANGED
|
@@ -158,6 +158,8 @@ var Popup = function Popup(Component) {
|
|
|
158
158
|
_this.preventKeyboardScroll = _this.preventKeyboardScroll.bind(_assertThisInitialized(_this));
|
|
159
159
|
_this.addScrollBlockListeners = _this.addScrollBlockListeners.bind(_assertThisInitialized(_this));
|
|
160
160
|
_this.removeScrollBlockListeners = _this.removeScrollBlockListeners.bind(_assertThisInitialized(_this));
|
|
161
|
+
_this.handleAddingScrollBlock = _this.handleAddingScrollBlock.bind(_assertThisInitialized(_this));
|
|
162
|
+
_this.handleRemovingScrollBlock = _this.handleRemovingScrollBlock.bind(_assertThisInitialized(_this));
|
|
161
163
|
_this.handleIntersectionObserver = _this.handleIntersectionObserver.bind(_assertThisInitialized(_this));
|
|
162
164
|
_this.popupObserver = new _ResizeObserver["default"](_this.handlePopupResize); //dropBoxSize
|
|
163
165
|
|
|
@@ -216,10 +218,7 @@ var Popup = function Popup(Component) {
|
|
|
216
218
|
oldStateOpen = _ref2$isPopupReady === void 0 ? false : _ref2$isPopupReady;
|
|
217
219
|
|
|
218
220
|
var dropElement = this.dropElement;
|
|
219
|
-
var
|
|
220
|
-
propResizeHandling = _this$props.needResizeHandling,
|
|
221
|
-
isAbsolutePositioningNeeded = _this$props.isAbsolutePositioningNeeded,
|
|
222
|
-
isOutsideScrollBlocked = _this$props.isOutsideScrollBlocked;
|
|
221
|
+
var propResizeHandling = this.props.needResizeHandling;
|
|
223
222
|
|
|
224
223
|
if (oldStateOpen !== isPopupReady) {
|
|
225
224
|
if (isPopupReady && dropElement && (propResizeHandling !== undefined ? propResizeHandling : needResizeHandling)) {
|
|
@@ -229,14 +228,10 @@ var Popup = function Popup(Component) {
|
|
|
229
228
|
this.popupObserver.disconnect();
|
|
230
229
|
}
|
|
231
230
|
|
|
232
|
-
if (
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
} else {
|
|
237
|
-
(0, _intersectionObserver.removeIntersectionObserver)(this.placeHolderElement, this.handleIntersectionObserver);
|
|
238
|
-
this.removeScrollBlockListeners();
|
|
239
|
-
}
|
|
231
|
+
if (isPopupReady) {
|
|
232
|
+
this.handleAddingScrollBlock();
|
|
233
|
+
} else {
|
|
234
|
+
this.handleRemovingScrollBlock();
|
|
240
235
|
}
|
|
241
236
|
}
|
|
242
237
|
}
|
|
@@ -258,8 +253,7 @@ var Popup = function Popup(Component) {
|
|
|
258
253
|
|
|
259
254
|
return res;
|
|
260
255
|
}, popups);
|
|
261
|
-
|
|
262
|
-
this.removeScrollBlockListeners();
|
|
256
|
+
this.handleRemovingScrollBlock();
|
|
263
257
|
var noPopups = true;
|
|
264
258
|
|
|
265
259
|
for (var i in popups) {
|
|
@@ -283,6 +277,30 @@ var Popup = function Popup(Component) {
|
|
|
283
277
|
document.removeEventListener('focus', this.handleDocumentFocus, true);
|
|
284
278
|
}
|
|
285
279
|
}
|
|
280
|
+
}, {
|
|
281
|
+
key: "handleAddingScrollBlock",
|
|
282
|
+
value: function handleAddingScrollBlock() {
|
|
283
|
+
var _this$props = this.props,
|
|
284
|
+
isAbsolutePositioningNeeded = _this$props.isAbsolutePositioningNeeded,
|
|
285
|
+
isOutsideScrollBlocked = _this$props.isOutsideScrollBlocked;
|
|
286
|
+
|
|
287
|
+
if (isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
|
|
288
|
+
(0, _intersectionObserver.addIntersectionObserver)(this.placeHolderElement, this.handleIntersectionObserver);
|
|
289
|
+
this.addScrollBlockListeners();
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}, {
|
|
293
|
+
key: "handleRemovingScrollBlock",
|
|
294
|
+
value: function handleRemovingScrollBlock() {
|
|
295
|
+
var _this$props2 = this.props,
|
|
296
|
+
isAbsolutePositioningNeeded = _this$props2.isAbsolutePositioningNeeded,
|
|
297
|
+
isOutsideScrollBlocked = _this$props2.isOutsideScrollBlocked;
|
|
298
|
+
|
|
299
|
+
if (isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
|
|
300
|
+
(0, _intersectionObserver.removeIntersectionObserver)(this.placeHolderElement, this.handleIntersectionObserver);
|
|
301
|
+
this.removeScrollBlockListeners();
|
|
302
|
+
}
|
|
303
|
+
}
|
|
286
304
|
}, {
|
|
287
305
|
key: "addScrollBlockListeners",
|
|
288
306
|
value: function addScrollBlockListeners() {
|
|
@@ -22,41 +22,51 @@ var observerCallbacks = null;
|
|
|
22
22
|
var intersectionObserver = null;
|
|
23
23
|
|
|
24
24
|
function handleObserverCallbacks(entries) {
|
|
25
|
-
entries.
|
|
25
|
+
entries.forEach(function (entry) {
|
|
26
26
|
var oldCallbacks = observerCallbacks.get(entry.target);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
|
|
28
|
+
if (Array.isArray(oldCallbacks) && oldCallbacks.length) {
|
|
29
|
+
oldCallbacks.forEach(function (callback) {
|
|
30
|
+
callback && callback(entry);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
30
33
|
});
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
function addIntersectionObserver(element, callback, options) {
|
|
34
|
-
if (
|
|
35
|
-
intersectionObserver
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
if (!!element && typeof callback == 'function') {
|
|
38
|
+
if (intersectionObserver === null && observerCallbacks === null) {
|
|
39
|
+
intersectionObserver = new IntersectionObserver(function (entries) {
|
|
40
|
+
handleObserverCallbacks(entries);
|
|
41
|
+
}, options);
|
|
42
|
+
observerCallbacks = new Map();
|
|
43
|
+
}
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
intersectionObserver.observe(element);
|
|
46
|
+
var oldCallbacks = observerCallbacks.get(element) || [];
|
|
47
|
+
observerCallbacks.set(element, [].concat(_toConsumableArray(oldCallbacks), [callback]));
|
|
48
|
+
}
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
function removeIntersectionObserver(element, callback) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return handler !== callback;
|
|
50
|
-
});
|
|
52
|
+
if (!!element && typeof callback == 'function') {
|
|
53
|
+
var oldCallbacks = observerCallbacks ? observerCallbacks.get(element) : null;
|
|
51
54
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
if (Array.isArray(oldCallbacks)) {
|
|
56
|
+
var callbacks = oldCallbacks.filter(function (handler) {
|
|
57
|
+
return handler !== callback;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (intersectionObserver && callbacks.length === 0) {
|
|
61
|
+
observerCallbacks["delete"](element);
|
|
62
|
+
intersectionObserver.unobserve(element);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
56
65
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
if (intersectionObserver && observerCallbacks && observerCallbacks.size === 0) {
|
|
67
|
+
intersectionObserver.disconnect();
|
|
68
|
+
intersectionObserver = null;
|
|
69
|
+
observerCallbacks = null;
|
|
70
|
+
}
|
|
61
71
|
}
|
|
62
72
|
}
|
|
@@ -84,9 +84,11 @@ var CalendarView = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
84
84
|
todayDate = _this$props.todayDate,
|
|
85
85
|
todayYear = _this$props.todayYear,
|
|
86
86
|
startDate = _this$props.startDate,
|
|
87
|
-
endDate = _this$props.endDate
|
|
87
|
+
endDate = _this$props.endDate,
|
|
88
|
+
weekStartDay = _this$props.weekStartDay,
|
|
89
|
+
holidays = _this$props.holidays;
|
|
88
90
|
var userSeeDate = new Date(year, month, 1);
|
|
89
|
-
var userSeeDay = userSeeDate.getDay() + 1;
|
|
91
|
+
var userSeeDay = (userSeeDate.getDay() - weekStartDay + dayNames.length) % dayNames.length + 1;
|
|
90
92
|
var userSeeYear = userSeeDate.getFullYear();
|
|
91
93
|
var userSeeMonth = userSeeDate.getMonth();
|
|
92
94
|
var monthEnd = (0, _common.getMonthEnd)(month, year);
|
|
@@ -114,10 +116,10 @@ var CalendarView = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
114
116
|
var output = null;
|
|
115
117
|
|
|
116
118
|
for (var i = 1; i <= 7; i++) {
|
|
117
|
-
var tdclass = "".concat(_DateTimeModule["default"].datesStr, " ").concat(_DateTimeModule["default"].grid);
|
|
119
|
+
var tdclass = "".concat(_DateTimeModule["default"].datesStr, " ").concat(_DateTimeModule["default"].grid); // if (i === 1) {
|
|
118
120
|
|
|
119
|
-
if (i
|
|
120
|
-
tdclass += " ".concat(_DateTimeModule["default"].
|
|
121
|
+
if (holidays.includes(i - 1)) {
|
|
122
|
+
tdclass += " ".concat(_DateTimeModule["default"].holiday);
|
|
121
123
|
}
|
|
122
124
|
|
|
123
125
|
if (incremleti >= userSeeDay && incremday <= monthEnd) {
|
|
@@ -226,7 +228,8 @@ var CalendarView = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
226
228
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_DaysRow["default"], {
|
|
227
229
|
dayNames: dayNames,
|
|
228
230
|
dayNamesShort: dayNamesShort,
|
|
229
|
-
ariaLabel: dayNamesShort
|
|
231
|
+
ariaLabel: dayNamesShort,
|
|
232
|
+
holidays: holidays
|
|
230
233
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
231
234
|
"data-id": "".concat(dataId, "_dateContainer"),
|
|
232
235
|
"data-test-id": "".concat(dataId, "_dateContainer"),
|
|
@@ -43,6 +43,14 @@ var _dateFormat = require("./../../DateTime/dateFormatUtils/dateFormat");
|
|
|
43
43
|
|
|
44
44
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
45
45
|
|
|
46
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
47
|
+
|
|
48
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
49
|
+
|
|
50
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
51
|
+
|
|
52
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
53
|
+
|
|
46
54
|
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
47
55
|
|
|
48
56
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -728,7 +736,9 @@ var DateTime = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
728
736
|
startDate = _this$props7.startDate,
|
|
729
737
|
endDate = _this$props7.endDate,
|
|
730
738
|
_this$props7$customPr = _this$props7.customProps,
|
|
731
|
-
customProps = _this$props7$customPr === void 0 ? {} : _this$props7$customPr
|
|
739
|
+
customProps = _this$props7$customPr === void 0 ? {} : _this$props7$customPr,
|
|
740
|
+
holidays = _this$props7.holidays,
|
|
741
|
+
weekStartDay = _this$props7.weekStartDay;
|
|
732
742
|
var _customProps$TimeProp = customProps.TimeProps,
|
|
733
743
|
TimeProps = _customProps$TimeProp === void 0 ? {} : _customProps$TimeProp;
|
|
734
744
|
var _i18nKeys$timeText = i18nKeys.timeText,
|
|
@@ -754,6 +764,17 @@ var DateTime = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
754
764
|
_i18nKeys$dayNamesSho = i18nKeys.dayNamesShort,
|
|
755
765
|
dayNamesShort = _i18nKeys$dayNamesSho === void 0 ? _constants.dayNamesShortDefault : _i18nKeys$dayNamesSho;
|
|
756
766
|
var showmonthtxt = title(date, year, month, monthNames);
|
|
767
|
+
var customDayNames = dayNames,
|
|
768
|
+
customDayNamesShort = dayNamesShort,
|
|
769
|
+
customizedHolidays = holidays;
|
|
770
|
+
|
|
771
|
+
if (weekStartDay !== 0) {
|
|
772
|
+
customDayNames = [].concat(_toConsumableArray(dayNames.slice(weekStartDay)), _toConsumableArray(dayNames.slice(0, weekStartDay)));
|
|
773
|
+
customDayNamesShort = [].concat(_toConsumableArray(dayNamesShort.slice(weekStartDay)), _toConsumableArray(dayNamesShort.slice(0, weekStartDay)));
|
|
774
|
+
customizedHolidays = holidays.map(function (dayIndex) {
|
|
775
|
+
return customDayNames.indexOf(dayNames[dayIndex]);
|
|
776
|
+
});
|
|
777
|
+
}
|
|
757
778
|
|
|
758
779
|
var childEle = /*#__PURE__*/_react["default"].createElement("div", {
|
|
759
780
|
className: "".concat(_DateTimeModule["default"].container, " ").concat(innerClass),
|
|
@@ -776,13 +797,15 @@ var DateTime = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
776
797
|
year: year,
|
|
777
798
|
month: month,
|
|
778
799
|
onSelect: this.dateSelect,
|
|
779
|
-
dayNames:
|
|
780
|
-
dayNamesShort:
|
|
800
|
+
dayNames: customDayNames,
|
|
801
|
+
dayNamesShort: customDayNamesShort,
|
|
781
802
|
todayDate: todayDate,
|
|
782
803
|
todayMonth: todayMonth,
|
|
783
804
|
todayYear: todayYear,
|
|
784
805
|
startDate: startDate,
|
|
785
|
-
endDate: endDate
|
|
806
|
+
endDate: endDate,
|
|
807
|
+
weekStartDay: weekStartDay,
|
|
808
|
+
holidays: customizedHolidays
|
|
786
809
|
}), isDateTimeField ? /*#__PURE__*/_react["default"].createElement(_Time["default"], {
|
|
787
810
|
timeText: timeText,
|
|
788
811
|
dataId: dataId,
|
|
@@ -1032,6 +1032,8 @@ var DateWidgetComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1032
1032
|
onError = _this$props12.onError,
|
|
1033
1033
|
startDate = _this$props12.startDate,
|
|
1034
1034
|
endDate = _this$props12.endDate,
|
|
1035
|
+
weekStartDay = _this$props12.weekStartDay,
|
|
1036
|
+
holidays = _this$props12.holidays,
|
|
1035
1037
|
_this$props12$customP = _this$props12.customProps,
|
|
1036
1038
|
customProps = _this$props12$customP === void 0 ? {} : _this$props12$customP;
|
|
1037
1039
|
var _customProps$DateTime = customProps.DateTimeProps,
|
|
@@ -1131,7 +1133,9 @@ var DateWidgetComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1131
1133
|
onError: onError,
|
|
1132
1134
|
startDate: startDate,
|
|
1133
1135
|
endDate: endDate,
|
|
1134
|
-
customProps: DateTimeProps
|
|
1136
|
+
customProps: DateTimeProps,
|
|
1137
|
+
weekStartDay: weekStartDay,
|
|
1138
|
+
holidays: holidays
|
|
1135
1139
|
}));
|
|
1136
1140
|
}
|
|
1137
1141
|
}]);
|
|
@@ -57,7 +57,8 @@ var DaysRow = /*#__PURE__*/function (_PureComponent) {
|
|
|
57
57
|
value: function render() {
|
|
58
58
|
var _this$props = this.props,
|
|
59
59
|
dayNames = _this$props.dayNames,
|
|
60
|
-
dayNamesShort = _this$props.dayNamesShort
|
|
60
|
+
dayNamesShort = _this$props.dayNamesShort,
|
|
61
|
+
holidays = _this$props.holidays;
|
|
61
62
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
62
63
|
alignBox: "row",
|
|
63
64
|
align: "center",
|
|
@@ -65,7 +66,7 @@ var DaysRow = /*#__PURE__*/function (_PureComponent) {
|
|
|
65
66
|
}, dayNames.map(function (dayName, index) {
|
|
66
67
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
67
68
|
key: dayName,
|
|
68
|
-
className: "".concat(_DateTimeModule["default"].daysStr, " ").concat(_DateTimeModule["default"].grid, " ").concat(index
|
|
69
|
+
className: "".concat(_DateTimeModule["default"].daysStr, " ").concat(_DateTimeModule["default"].grid, " ").concat(holidays.includes(index) ? _DateTimeModule["default"].holiday : ''),
|
|
69
70
|
"data-title": dayName,
|
|
70
71
|
"aria-label": dayName
|
|
71
72
|
}, dayNamesShort[index]);
|
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.YearView_defaultProps = exports.Time_defaultProps = exports.Span_defaultProps = exports.DateWidget_defaultProps = exports.DateTime_defaultProps = exports.DateTimePopupFooter_defaultProps = exports.CalendarView_defaultProps = void 0;
|
|
7
7
|
var CalendarView_defaultProps = {
|
|
8
8
|
dataId: 'dateContainer',
|
|
9
|
-
needBorder: true
|
|
9
|
+
needBorder: true,
|
|
10
|
+
weekStartDay: 0,
|
|
11
|
+
holidays: [0]
|
|
10
12
|
};
|
|
11
13
|
exports.CalendarView_defaultProps = CalendarView_defaultProps;
|
|
12
14
|
var Span_defaultProps = {
|
|
@@ -28,7 +30,9 @@ var DateTime_defaultProps = {
|
|
|
28
30
|
i18nKeys: {},
|
|
29
31
|
is24Hour: false,
|
|
30
32
|
isDefaultPosition: false,
|
|
31
|
-
customDateFormat: null
|
|
33
|
+
customDateFormat: null,
|
|
34
|
+
weekStartDay: 0,
|
|
35
|
+
holidays: [0]
|
|
32
36
|
};
|
|
33
37
|
exports.DateTime_defaultProps = DateTime_defaultProps;
|
|
34
38
|
var DateWidget_defaultProps = {
|
|
@@ -52,7 +56,9 @@ var DateWidget_defaultProps = {
|
|
|
52
56
|
needErrorOnBlur: false,
|
|
53
57
|
isEditable: false,
|
|
54
58
|
iconOnHover: false,
|
|
55
|
-
is24Hour: false
|
|
59
|
+
is24Hour: false,
|
|
60
|
+
weekStartDay: 0,
|
|
61
|
+
holidays: [0]
|
|
56
62
|
};
|
|
57
63
|
exports.DateWidget_defaultProps = DateWidget_defaultProps;
|
|
58
64
|
var YearView_defaultProps = {
|