@zohodesk/components 1.2.49 → 1.2.50
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 +16 -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/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/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 +1 -1
- package/result.json +1 -1
package/README.md
CHANGED
|
@@ -32,7 +32,22 @@ In this Package, we Provide Some Basic Components to Build Web App
|
|
|
32
32
|
- TextBoxIcon
|
|
33
33
|
- Tooltip
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
# 1.2.50
|
|
37
|
+
|
|
38
|
+
- **DateTime (v0&v1), CalendarView (v0&v1)**
|
|
39
|
+
|
|
40
|
+
- Week starting day customization support added with `weekStartDay` props and week holiday customization support with `holidays` prop
|
|
41
|
+
|
|
42
|
+
- **DateWidget (v0&v1)**
|
|
43
|
+
|
|
44
|
+
- Support has been added for `weekStartDay`, `holidays` props
|
|
45
|
+
|
|
46
|
+
- **DaysRow (v0&v1)**
|
|
47
|
+
|
|
48
|
+
- `holidays` prop added for holiday column indication
|
|
49
|
+
|
|
50
|
+
# 1.2.49
|
|
36
51
|
|
|
37
52
|
- **Popup**
|
|
38
53
|
- `isOutsideScrollBlocked` prop supported - Scroll blocking behaviours supported
|
|
@@ -31,10 +31,12 @@ export default class CalendarView extends React.PureComponent {
|
|
|
31
31
|
dayNamesShort,
|
|
32
32
|
todayMonth,
|
|
33
33
|
todayDate,
|
|
34
|
-
todayYear
|
|
34
|
+
todayYear,
|
|
35
|
+
weekStartDay,
|
|
36
|
+
holidays
|
|
35
37
|
} = this.props;
|
|
36
38
|
const userSeeDate = new Date(year, month, 1);
|
|
37
|
-
const userSeeDay = userSeeDate.getDay() + 1;
|
|
39
|
+
const userSeeDay = (userSeeDate.getDay() - weekStartDay + dayNames.length) % dayNames.length + 1;
|
|
38
40
|
const userSeeYear = userSeeDate.getFullYear();
|
|
39
41
|
const userSeeMonth = userSeeDate.getMonth();
|
|
40
42
|
const monthEnd = getMonthEnd(month, year);
|
|
@@ -65,8 +67,8 @@ export default class CalendarView extends React.PureComponent {
|
|
|
65
67
|
isSelectedDay = false;
|
|
66
68
|
let tdclass = `${style.datesStr} ${style.grid}`;
|
|
67
69
|
|
|
68
|
-
if (i
|
|
69
|
-
tdclass += ` ${style.
|
|
70
|
+
if (holidays.includes(i - 1)) {
|
|
71
|
+
tdclass += ` ${style.holiday}`;
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
if (incremleti >= userSeeDay && incremday <= monthEnd) {
|
|
@@ -170,7 +172,8 @@ export default class CalendarView extends React.PureComponent {
|
|
|
170
172
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DaysRow, {
|
|
171
173
|
dayNames: dayNames,
|
|
172
174
|
dayNamesShort: dayNamesShort,
|
|
173
|
-
ariaLabel: dayNamesShort
|
|
175
|
+
ariaLabel: dayNamesShort,
|
|
176
|
+
holidays: holidays
|
|
174
177
|
}), /*#__PURE__*/React.createElement("div", {
|
|
175
178
|
"data-id": `${dataId}_dateContainer`,
|
|
176
179
|
"data-test-id": `${dataId}_dateContainer`,
|
package/es/DateTime/DateTime.js
CHANGED
|
@@ -650,7 +650,9 @@ export default class DateTime extends React.PureComponent {
|
|
|
650
650
|
targetOffset,
|
|
651
651
|
isRestrictScroll,
|
|
652
652
|
dropBoxPortalId,
|
|
653
|
-
customProps = {}
|
|
653
|
+
customProps = {},
|
|
654
|
+
weekStartDay,
|
|
655
|
+
holidays
|
|
654
656
|
} = this.props;
|
|
655
657
|
const {
|
|
656
658
|
TimeProps = {}
|
|
@@ -669,6 +671,16 @@ export default class DateTime extends React.PureComponent {
|
|
|
669
671
|
dayNamesShort = dayNamesShortDefault
|
|
670
672
|
} = i18nKeys;
|
|
671
673
|
const showmonthtxt = title(date, year, month, monthNames);
|
|
674
|
+
let customDayNames = dayNames,
|
|
675
|
+
customDayNamesShort = dayNamesShort,
|
|
676
|
+
customizedHolidays = holidays;
|
|
677
|
+
|
|
678
|
+
if (weekStartDay !== 0) {
|
|
679
|
+
customDayNames = [...dayNames.slice(weekStartDay), ...dayNames.slice(0, weekStartDay)];
|
|
680
|
+
customDayNamesShort = [...dayNamesShort.slice(weekStartDay), ...dayNamesShort.slice(0, weekStartDay)];
|
|
681
|
+
customizedHolidays = holidays.map(dayIndex => customDayNames.indexOf(dayNames[dayIndex]));
|
|
682
|
+
}
|
|
683
|
+
|
|
672
684
|
const childEle = /*#__PURE__*/React.createElement("div", {
|
|
673
685
|
className: `${style.container} ${innerClass}`,
|
|
674
686
|
"data-id": `${dataId}_Calendar`,
|
|
@@ -690,11 +702,13 @@ export default class DateTime extends React.PureComponent {
|
|
|
690
702
|
year: year,
|
|
691
703
|
month: month,
|
|
692
704
|
onSelect: this.dateSelect,
|
|
693
|
-
dayNames:
|
|
694
|
-
dayNamesShort:
|
|
705
|
+
dayNames: customDayNames,
|
|
706
|
+
dayNamesShort: customDayNamesShort,
|
|
695
707
|
todayDate: todayDate,
|
|
696
708
|
todayMonth: todayMonth,
|
|
697
|
-
todayYear: todayYear
|
|
709
|
+
todayYear: todayYear,
|
|
710
|
+
weekStartDay: weekStartDay,
|
|
711
|
+
holidays: customizedHolidays
|
|
698
712
|
}), isDateTimeField ? /*#__PURE__*/React.createElement(Time, {
|
|
699
713
|
timeText: timeText,
|
|
700
714
|
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
|
}
|
|
@@ -1004,6 +1004,8 @@ class DateWidgetComponent extends React.Component {
|
|
|
1004
1004
|
a11y,
|
|
1005
1005
|
boxSize,
|
|
1006
1006
|
onError,
|
|
1007
|
+
weekStartDay,
|
|
1008
|
+
holidays,
|
|
1007
1009
|
customProps = {}
|
|
1008
1010
|
} = this.props;
|
|
1009
1011
|
const {
|
|
@@ -1106,7 +1108,9 @@ class DateWidgetComponent extends React.Component {
|
|
|
1106
1108
|
dropBoxPortalId: dropBoxPortalId,
|
|
1107
1109
|
boxSize: boxSize,
|
|
1108
1110
|
onError: onError,
|
|
1109
|
-
customProps: DateTimeProps
|
|
1111
|
+
customProps: DateTimeProps,
|
|
1112
|
+
weekStartDay: weekStartDay,
|
|
1113
|
+
holidays: holidays
|
|
1110
1114
|
}));
|
|
1111
1115
|
}
|
|
1112
1116
|
|
package/es/DateTime/DaysRow.js
CHANGED
|
@@ -13,7 +13,8 @@ export default class DaysRow extends PureComponent {
|
|
|
13
13
|
render() {
|
|
14
14
|
const {
|
|
15
15
|
dayNames,
|
|
16
|
-
dayNamesShort
|
|
16
|
+
dayNamesShort,
|
|
17
|
+
holidays
|
|
17
18
|
} = this.props;
|
|
18
19
|
return /*#__PURE__*/React.createElement(Container, {
|
|
19
20
|
alignBox: "row",
|
|
@@ -21,7 +22,7 @@ export default class DaysRow extends PureComponent {
|
|
|
21
22
|
className: style.days
|
|
22
23
|
}, dayNames.map((dayName, index) => /*#__PURE__*/React.createElement(Box, {
|
|
23
24
|
key: dayName,
|
|
24
|
-
className: `${style.daysStr} ${style.grid} ${index
|
|
25
|
+
className: `${style.daysStr} ${style.grid} ${holidays.includes(index) ? style.holiday : ''}`,
|
|
25
26
|
"data-title": dayName,
|
|
26
27
|
"aria-label": dayName
|
|
27
28
|
}, 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"
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export const CalendarView_defaultProps = {
|
|
2
2
|
dataId: 'dateContainer',
|
|
3
|
-
needBorder: true
|
|
3
|
+
needBorder: true,
|
|
4
|
+
weekStartDay: 0,
|
|
5
|
+
holidays: [0]
|
|
4
6
|
};
|
|
5
7
|
export const Span_defaultProps = {
|
|
6
8
|
dataId: 'calendar-view'
|
|
@@ -21,7 +23,9 @@ export const DateTime_defaultProps = {
|
|
|
21
23
|
is24Hour: false,
|
|
22
24
|
isDefaultPosition: false,
|
|
23
25
|
customDateFormat: null,
|
|
24
|
-
customProps: {}
|
|
26
|
+
customProps: {},
|
|
27
|
+
weekStartDay: 0,
|
|
28
|
+
holidays: [0]
|
|
25
29
|
};
|
|
26
30
|
export const DateWidget_defaultProps = {
|
|
27
31
|
borderColor: 'default',
|
|
@@ -44,7 +48,9 @@ export const DateWidget_defaultProps = {
|
|
|
44
48
|
needErrorOnBlur: false,
|
|
45
49
|
isEditable: false,
|
|
46
50
|
iconOnHover: false,
|
|
47
|
-
is24Hour: false
|
|
51
|
+
is24Hour: false,
|
|
52
|
+
weekStartDay: 0,
|
|
53
|
+
holidays: [0]
|
|
48
54
|
};
|
|
49
55
|
export const YearView_defaultProps = {
|
|
50
56
|
dataId: 'dateContainer',
|
|
@@ -11,7 +11,9 @@ export const CalendarView_propTypes = {
|
|
|
11
11
|
dayNamesShort: PropTypes.array,
|
|
12
12
|
todayMonth: PropTypes.string,
|
|
13
13
|
todayDate: PropTypes.string,
|
|
14
|
-
todayYear: PropTypes.string
|
|
14
|
+
todayYear: PropTypes.string,
|
|
15
|
+
weekStartDay: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6]),
|
|
16
|
+
holidays: PropTypes.arrayOf(PropTypes.number)
|
|
15
17
|
};
|
|
16
18
|
export const Span_propTypes = {
|
|
17
19
|
dataId: PropTypes.string,
|
|
@@ -73,7 +75,9 @@ export const DateTime_propTypes = {
|
|
|
73
75
|
targetOffset: PropTypes.string,
|
|
74
76
|
isRestrictScroll: PropTypes.bool,
|
|
75
77
|
dropBoxPortalId: PropTypes.string,
|
|
76
|
-
customProps: PropTypes.object
|
|
78
|
+
customProps: PropTypes.object,
|
|
79
|
+
weekStartDay: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6]),
|
|
80
|
+
holidays: PropTypes.arrayOf(PropTypes.number)
|
|
77
81
|
};
|
|
78
82
|
export const DateWidget_propTypes = {
|
|
79
83
|
borderColor: PropTypes.oneOf(['transparent', 'default']),
|
|
@@ -142,7 +146,9 @@ export const DateWidget_propTypes = {
|
|
|
142
146
|
dropBoxPortalId: PropTypes.string,
|
|
143
147
|
a11y: PropTypes.object,
|
|
144
148
|
getPopupProps: PropTypes.func,
|
|
145
|
-
customProps: PropTypes.object
|
|
149
|
+
customProps: PropTypes.object,
|
|
150
|
+
weekStartDay: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6]),
|
|
151
|
+
holidays: PropTypes.arrayOf(PropTypes.number)
|
|
146
152
|
};
|
|
147
153
|
export const YearView_propTypes = {
|
|
148
154
|
onSelectMonth: PropTypes.func,
|
|
@@ -169,7 +175,8 @@ export const DateTimePopupHeader_propTypes = {
|
|
|
169
175
|
};
|
|
170
176
|
export const DaysRow_propTypes = {
|
|
171
177
|
dayNames: PropTypes.array,
|
|
172
|
-
dayNamesShort: PropTypes.object
|
|
178
|
+
dayNamesShort: PropTypes.object,
|
|
179
|
+
holidays: PropTypes.arrayOf(PropTypes.number)
|
|
173
180
|
};
|
|
174
181
|
export const Time_propTypes = {
|
|
175
182
|
timeText: PropTypes.string,
|
|
@@ -34,10 +34,12 @@ export default class CalendarView extends React.PureComponent {
|
|
|
34
34
|
todayDate,
|
|
35
35
|
todayYear,
|
|
36
36
|
startDate,
|
|
37
|
-
endDate
|
|
37
|
+
endDate,
|
|
38
|
+
weekStartDay,
|
|
39
|
+
holidays
|
|
38
40
|
} = this.props;
|
|
39
41
|
const userSeeDate = new Date(year, month, 1);
|
|
40
|
-
const userSeeDay = userSeeDate.getDay() + 1;
|
|
42
|
+
const userSeeDay = (userSeeDate.getDay() - weekStartDay + dayNames.length) % dayNames.length + 1;
|
|
41
43
|
const userSeeYear = userSeeDate.getFullYear();
|
|
42
44
|
const userSeeMonth = userSeeDate.getMonth();
|
|
43
45
|
const monthEnd = getMonthEnd(month, year);
|
|
@@ -65,10 +67,10 @@ export default class CalendarView extends React.PureComponent {
|
|
|
65
67
|
let output = null;
|
|
66
68
|
|
|
67
69
|
for (let i = 1; i <= 7; i++) {
|
|
68
|
-
let tdclass = `${style.datesStr} ${style.grid}`;
|
|
70
|
+
let tdclass = `${style.datesStr} ${style.grid}`; // if (i === 1) {
|
|
69
71
|
|
|
70
|
-
if (i
|
|
71
|
-
tdclass += ` ${style.
|
|
72
|
+
if (holidays.includes(i - 1)) {
|
|
73
|
+
tdclass += ` ${style.holiday}`;
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
if (incremleti >= userSeeDay && incremday <= monthEnd) {
|
|
@@ -177,7 +179,8 @@ export default class CalendarView extends React.PureComponent {
|
|
|
177
179
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DaysRow, {
|
|
178
180
|
dayNames: dayNames,
|
|
179
181
|
dayNamesShort: dayNamesShort,
|
|
180
|
-
ariaLabel: dayNamesShort
|
|
182
|
+
ariaLabel: dayNamesShort,
|
|
183
|
+
holidays: holidays
|
|
181
184
|
}), /*#__PURE__*/React.createElement("div", {
|
|
182
185
|
"data-id": `${dataId}_dateContainer`,
|
|
183
186
|
"data-test-id": `${dataId}_dateContainer`,
|
|
@@ -652,7 +652,9 @@ export default class DateTime extends React.PureComponent {
|
|
|
652
652
|
dropBoxPortalId,
|
|
653
653
|
startDate,
|
|
654
654
|
endDate,
|
|
655
|
-
customProps = {}
|
|
655
|
+
customProps = {},
|
|
656
|
+
holidays,
|
|
657
|
+
weekStartDay
|
|
656
658
|
} = this.props;
|
|
657
659
|
const {
|
|
658
660
|
TimeProps = {}
|
|
@@ -671,6 +673,16 @@ export default class DateTime extends React.PureComponent {
|
|
|
671
673
|
dayNamesShort = dayNamesShortDefault
|
|
672
674
|
} = i18nKeys;
|
|
673
675
|
const showmonthtxt = title(date, year, month, monthNames);
|
|
676
|
+
let customDayNames = dayNames,
|
|
677
|
+
customDayNamesShort = dayNamesShort,
|
|
678
|
+
customizedHolidays = holidays;
|
|
679
|
+
|
|
680
|
+
if (weekStartDay !== 0) {
|
|
681
|
+
customDayNames = [...dayNames.slice(weekStartDay), ...dayNames.slice(0, weekStartDay)];
|
|
682
|
+
customDayNamesShort = [...dayNamesShort.slice(weekStartDay), ...dayNamesShort.slice(0, weekStartDay)];
|
|
683
|
+
customizedHolidays = holidays.map(dayIndex => customDayNames.indexOf(dayNames[dayIndex]));
|
|
684
|
+
}
|
|
685
|
+
|
|
674
686
|
const childEle = /*#__PURE__*/React.createElement("div", {
|
|
675
687
|
className: `${style.container} ${innerClass}`,
|
|
676
688
|
"data-id": `${dataId}_Calendar`,
|
|
@@ -692,13 +704,15 @@ export default class DateTime extends React.PureComponent {
|
|
|
692
704
|
year: year,
|
|
693
705
|
month: month,
|
|
694
706
|
onSelect: this.dateSelect,
|
|
695
|
-
dayNames:
|
|
696
|
-
dayNamesShort:
|
|
707
|
+
dayNames: customDayNames,
|
|
708
|
+
dayNamesShort: customDayNamesShort,
|
|
697
709
|
todayDate: todayDate,
|
|
698
710
|
todayMonth: todayMonth,
|
|
699
711
|
todayYear: todayYear,
|
|
700
712
|
startDate: startDate,
|
|
701
|
-
endDate: endDate
|
|
713
|
+
endDate: endDate,
|
|
714
|
+
weekStartDay: weekStartDay,
|
|
715
|
+
holidays: customizedHolidays
|
|
702
716
|
}), isDateTimeField ? /*#__PURE__*/React.createElement(Time, {
|
|
703
717
|
timeText: timeText,
|
|
704
718
|
dataId: dataId,
|
|
@@ -1006,6 +1006,8 @@ class DateWidgetComponent extends React.Component {
|
|
|
1006
1006
|
onError,
|
|
1007
1007
|
startDate,
|
|
1008
1008
|
endDate,
|
|
1009
|
+
weekStartDay,
|
|
1010
|
+
holidays,
|
|
1009
1011
|
customProps = {}
|
|
1010
1012
|
} = this.props;
|
|
1011
1013
|
const {
|
|
@@ -1105,7 +1107,9 @@ class DateWidgetComponent extends React.Component {
|
|
|
1105
1107
|
onError: onError,
|
|
1106
1108
|
startDate: startDate,
|
|
1107
1109
|
endDate: endDate,
|
|
1108
|
-
customProps: DateTimeProps
|
|
1110
|
+
customProps: DateTimeProps,
|
|
1111
|
+
weekStartDay: weekStartDay,
|
|
1112
|
+
holidays: holidays
|
|
1109
1113
|
}));
|
|
1110
1114
|
}
|
|
1111
1115
|
|
|
@@ -13,7 +13,8 @@ export default class DaysRow extends PureComponent {
|
|
|
13
13
|
render() {
|
|
14
14
|
const {
|
|
15
15
|
dayNames,
|
|
16
|
-
dayNamesShort
|
|
16
|
+
dayNamesShort,
|
|
17
|
+
holidays
|
|
17
18
|
} = this.props;
|
|
18
19
|
return /*#__PURE__*/React.createElement(Container, {
|
|
19
20
|
alignBox: "row",
|
|
@@ -21,7 +22,7 @@ export default class DaysRow extends PureComponent {
|
|
|
21
22
|
className: style.days
|
|
22
23
|
}, dayNames.map((dayName, index) => /*#__PURE__*/React.createElement(Box, {
|
|
23
24
|
key: dayName,
|
|
24
|
-
className: `${style.daysStr} ${style.grid} ${index
|
|
25
|
+
className: `${style.daysStr} ${style.grid} ${holidays.includes(index) ? style.holiday : ''}`,
|
|
25
26
|
"data-title": dayName,
|
|
26
27
|
"aria-label": dayName
|
|
27
28
|
}, dayNamesShort[index])));
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export const CalendarView_defaultProps = {
|
|
2
2
|
dataId: 'dateContainer',
|
|
3
|
-
needBorder: true
|
|
3
|
+
needBorder: true,
|
|
4
|
+
weekStartDay: 0,
|
|
5
|
+
holidays: [0]
|
|
4
6
|
};
|
|
5
7
|
export const Span_defaultProps = {
|
|
6
8
|
dataId: 'calendar-view'
|
|
@@ -20,7 +22,9 @@ export const DateTime_defaultProps = {
|
|
|
20
22
|
i18nKeys: {},
|
|
21
23
|
is24Hour: false,
|
|
22
24
|
isDefaultPosition: false,
|
|
23
|
-
customDateFormat: null
|
|
25
|
+
customDateFormat: null,
|
|
26
|
+
weekStartDay: 0,
|
|
27
|
+
holidays: [0]
|
|
24
28
|
};
|
|
25
29
|
export const DateWidget_defaultProps = {
|
|
26
30
|
borderColor: 'default',
|
|
@@ -43,7 +47,9 @@ export const DateWidget_defaultProps = {
|
|
|
43
47
|
needErrorOnBlur: false,
|
|
44
48
|
isEditable: false,
|
|
45
49
|
iconOnHover: false,
|
|
46
|
-
is24Hour: false
|
|
50
|
+
is24Hour: false,
|
|
51
|
+
weekStartDay: 0,
|
|
52
|
+
holidays: [0]
|
|
47
53
|
};
|
|
48
54
|
export const YearView_defaultProps = {
|
|
49
55
|
dataId: 'dateContainer',
|
|
@@ -13,7 +13,9 @@ export const CalendarView_propTypes = {
|
|
|
13
13
|
todayDate: PropTypes.string,
|
|
14
14
|
todayYear: PropTypes.string,
|
|
15
15
|
startDate: PropTypes.string,
|
|
16
|
-
endDate: PropTypes.string
|
|
16
|
+
endDate: PropTypes.string,
|
|
17
|
+
weekStartDay: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6]),
|
|
18
|
+
holidays: PropTypes.arrayOf(PropTypes.number)
|
|
17
19
|
};
|
|
18
20
|
export const Span_propTypes = {
|
|
19
21
|
dataId: PropTypes.string,
|
|
@@ -79,7 +81,9 @@ export const DateTime_propTypes = {
|
|
|
79
81
|
dropBoxPortalId: PropTypes.string,
|
|
80
82
|
startDate: PropTypes.string,
|
|
81
83
|
endDate: PropTypes.string,
|
|
82
|
-
customProps: PropTypes.object
|
|
84
|
+
customProps: PropTypes.object,
|
|
85
|
+
weekStartDay: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6]),
|
|
86
|
+
holidays: PropTypes.arrayOf(PropTypes.number)
|
|
83
87
|
};
|
|
84
88
|
export const DateWidget_propTypes = {
|
|
85
89
|
borderColor: PropTypes.oneOf(['transparent', 'default']),
|
|
@@ -150,7 +154,9 @@ export const DateWidget_propTypes = {
|
|
|
150
154
|
startDate: PropTypes.string,
|
|
151
155
|
endDate: PropTypes.string,
|
|
152
156
|
getPopupProps: PropTypes.func,
|
|
153
|
-
customProps: PropTypes.object
|
|
157
|
+
customProps: PropTypes.object,
|
|
158
|
+
weekStartDay: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6]),
|
|
159
|
+
holidays: PropTypes.arrayOf(PropTypes.number)
|
|
154
160
|
};
|
|
155
161
|
export const YearView_propTypes = {
|
|
156
162
|
onSelectMonth: PropTypes.func,
|
|
@@ -177,7 +183,8 @@ export const DateTimePopupHeader_propTypes = {
|
|
|
177
183
|
};
|
|
178
184
|
export const DaysRow_propTypes = {
|
|
179
185
|
dayNames: PropTypes.array,
|
|
180
|
-
dayNamesShort: PropTypes.object
|
|
186
|
+
dayNamesShort: PropTypes.object,
|
|
187
|
+
holidays: PropTypes.arrayOf(PropTypes.number)
|
|
181
188
|
};
|
|
182
189
|
export const Time_propTypes = {
|
|
183
190
|
timeText: PropTypes.string,
|
|
@@ -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
|
}]);
|