@hero-design/rn-work-uikit 1.6.2-alpha.0 → 1.6.2-alpha.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/CHANGELOG.md +9 -0
- package/lib/index.js +164 -121
- package/package.json +2 -2
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @hero-design/rn-work-uikit
|
|
2
2
|
|
|
3
|
+
## 1.6.2-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#4123](https://github.com/Thinkei/hero-design/pull/4123) [`ecc5905dec81783858f57595a0af4306ff3b0b89`](https://github.com/Thinkei/hero-design/commit/ecc5905dec81783858f57595a0af4306ff3b0b89) Thanks [@truongnguyen-eh](https://github.com/truongnguyen-eh)! - [ANG-3740] Resolve conflict between alpha and master-react-18
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`e92d1dab57316441e7b5054debe823328e1a1083`](https://github.com/Thinkei/hero-design/commit/e92d1dab57316441e7b5054debe823328e1a1083), [`ecc5905dec81783858f57595a0af4306ff3b0b89`](https://github.com/Thinkei/hero-design/commit/ecc5905dec81783858f57595a0af4306ff3b0b89)]:
|
|
10
|
+
- @hero-design/rn@8.104.1-alpha.3
|
|
11
|
+
|
|
3
12
|
## 1.6.2-alpha.0
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/lib/index.js
CHANGED
|
@@ -7325,7 +7325,8 @@ var getTypographyTheme = function getTypographyTheme(theme) {
|
|
|
7325
7325
|
inverted: theme.colors.onDarkGlobalSurface,
|
|
7326
7326
|
archived: theme.colors.onArchivedSurface,
|
|
7327
7327
|
disabled: theme.colors.disabledOnDefaultGlobalSurface,
|
|
7328
|
-
muted: theme.colors.mutedOnDefaultGlobalSurface
|
|
7328
|
+
muted: theme.colors.mutedOnDefaultGlobalSurface,
|
|
7329
|
+
inactive: theme.colors.inactiveOnDefaultGlobalSurface
|
|
7329
7330
|
};
|
|
7330
7331
|
var fontSizes = {
|
|
7331
7332
|
xsmall: theme.fontSizes.xsmall,
|
|
@@ -13810,6 +13811,16 @@ var CalendarRowItem = function CalendarRowItem(_ref) {
|
|
|
13810
13811
|
}) : null));
|
|
13811
13812
|
};
|
|
13812
13813
|
|
|
13814
|
+
var DAYS_OF_WEEK = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
|
|
13815
|
+
|
|
13816
|
+
// Sunday first column => 0
|
|
13817
|
+
// Sunday last column => 1
|
|
13818
|
+
var WEEK_INDEX_OFFSET = 1;
|
|
13819
|
+
var SUNDAY_INDEX = 6;
|
|
13820
|
+
|
|
13821
|
+
// Always render 7 rows x 6 items for consistent layout
|
|
13822
|
+
var TOTAL_DATES_ITEMS = 7 * 6;
|
|
13823
|
+
|
|
13813
13824
|
var initArray = function initArray(length, func) {
|
|
13814
13825
|
return Array.from(Array(length)).map(function (_, index) {
|
|
13815
13826
|
return func(index);
|
|
@@ -13886,6 +13897,74 @@ var setStartOrEndDate = function setStartOrEndDate(_ref2) {
|
|
|
13886
13897
|
endDate: undefined
|
|
13887
13898
|
};
|
|
13888
13899
|
};
|
|
13900
|
+
var shouldUseMonthPicker = function shouldUseMonthPicker(onMonthChange) {
|
|
13901
|
+
return onMonthChange !== noop$2;
|
|
13902
|
+
};
|
|
13903
|
+
var getCalendarDate = function getCalendarDate(_ref3) {
|
|
13904
|
+
var visibleDate = _ref3.visibleDate,
|
|
13905
|
+
_ref3$markedDates = _ref3.markedDates,
|
|
13906
|
+
markedDates = _ref3$markedDates === void 0 ? [] : _ref3$markedDates,
|
|
13907
|
+
minDate = _ref3.minDate,
|
|
13908
|
+
maxDate = _ref3.maxDate;
|
|
13909
|
+
var currentMonth = visibleDate.getMonth();
|
|
13910
|
+
var currentYear = visibleDate.getFullYear();
|
|
13911
|
+
var parsedMaskedDate = markedDates.reduce(function (current, markedDate) {
|
|
13912
|
+
return _objectSpread2(_objectSpread2({}, current), {}, _defineProperty({}, markedDate.toDateString(), true));
|
|
13913
|
+
}, {});
|
|
13914
|
+
var firstDateOfMonth = new Date(currentYear, currentMonth, 1);
|
|
13915
|
+
var lastDateOfMonth = new Date(currentYear, currentMonth + 1, 0);
|
|
13916
|
+
var lastDateOfPreviousMonth = new Date(currentYear, currentMonth, 0);
|
|
13917
|
+
|
|
13918
|
+
// Index of day in week is shifted by 1 due to Sunday is the last column
|
|
13919
|
+
var firstDayWeekIndexOfMonth = firstDateOfMonth.getDay() === 0 ? SUNDAY_INDEX : firstDateOfMonth.getDay() - WEEK_INDEX_OFFSET;
|
|
13920
|
+
var lastDayIndexOfCurrentMonth = lastDateOfMonth.getDate();
|
|
13921
|
+
var lastDayIndexOfPreviousMonth = lastDateOfPreviousMonth.getDate();
|
|
13922
|
+
var daysOfPreviousMonth = initArray(firstDayWeekIndexOfMonth, function (index) {
|
|
13923
|
+
var reversedIndex = firstDayWeekIndexOfMonth - index - 1;
|
|
13924
|
+
var count = lastDayIndexOfPreviousMonth - reversedIndex;
|
|
13925
|
+
return getValidDate(new Date(currentYear, currentMonth - 1, count), minDate, maxDate);
|
|
13926
|
+
});
|
|
13927
|
+
var daysOfCurrentMonth = initArray(lastDayIndexOfCurrentMonth, function (index) {
|
|
13928
|
+
return getValidDate(new Date(currentYear, currentMonth, index + 1), minDate, maxDate);
|
|
13929
|
+
});
|
|
13930
|
+
var daysOfNextMonth = initArray(TOTAL_DATES_ITEMS - (daysOfPreviousMonth.length + daysOfCurrentMonth.length), function (index) {
|
|
13931
|
+
return getValidDate(new Date(currentYear, currentMonth + 1, index + 1), minDate, maxDate);
|
|
13932
|
+
});
|
|
13933
|
+
return {
|
|
13934
|
+
firstDateOfMonth: firstDateOfMonth,
|
|
13935
|
+
lastDateOfMonth: lastDateOfMonth,
|
|
13936
|
+
parsedMaskedDate: parsedMaskedDate,
|
|
13937
|
+
daysOfPreviousMonth: daysOfPreviousMonth,
|
|
13938
|
+
daysOfCurrentMonth: daysOfCurrentMonth,
|
|
13939
|
+
daysOfNextMonth: daysOfNextMonth
|
|
13940
|
+
};
|
|
13941
|
+
};
|
|
13942
|
+
var getCalendarButtonState = function getCalendarButtonState(_ref4) {
|
|
13943
|
+
var visibleDate = _ref4.visibleDate,
|
|
13944
|
+
markedDates = _ref4.markedDates,
|
|
13945
|
+
minDate = _ref4.minDate,
|
|
13946
|
+
maxDate = _ref4.maxDate;
|
|
13947
|
+
var _getCalendarDate = getCalendarDate({
|
|
13948
|
+
visibleDate: visibleDate,
|
|
13949
|
+
markedDates: markedDates,
|
|
13950
|
+
minDate: minDate,
|
|
13951
|
+
maxDate: maxDate
|
|
13952
|
+
}),
|
|
13953
|
+
daysOfPreviousMonth = _getCalendarDate.daysOfPreviousMonth,
|
|
13954
|
+
daysOfNextMonth = _getCalendarDate.daysOfNextMonth,
|
|
13955
|
+
firstDateOfMonth = _getCalendarDate.firstDateOfMonth,
|
|
13956
|
+
lastDateOfMonth = _getCalendarDate.lastDateOfMonth;
|
|
13957
|
+
var disablePrevButton = minDate === undefined ? false : !daysOfPreviousMonth.some(function (date) {
|
|
13958
|
+
return date !== undefined;
|
|
13959
|
+
}) && minDate >= firstDateOfMonth;
|
|
13960
|
+
var disableNextButton = maxDate === undefined ? false : !daysOfNextMonth.some(function (date) {
|
|
13961
|
+
return date !== undefined;
|
|
13962
|
+
}) || maxDate <= lastDateOfMonth;
|
|
13963
|
+
return {
|
|
13964
|
+
disablePrevButton: disablePrevButton,
|
|
13965
|
+
disableNextButton: disableNextButton
|
|
13966
|
+
};
|
|
13967
|
+
};
|
|
13889
13968
|
|
|
13890
13969
|
var SelectedDate = function SelectedDate(_ref) {
|
|
13891
13970
|
var date = _ref.date,
|
|
@@ -13921,14 +14000,36 @@ var SelectedDate = function SelectedDate(_ref) {
|
|
|
13921
14000
|
}) : null));
|
|
13922
14001
|
};
|
|
13923
14002
|
|
|
13924
|
-
var
|
|
13925
|
-
|
|
13926
|
-
|
|
13927
|
-
|
|
13928
|
-
|
|
14003
|
+
var useCalendarLayout = function useCalendarLayout() {
|
|
14004
|
+
var theme = useTheme();
|
|
14005
|
+
var _useState = React.useState(0),
|
|
14006
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
14007
|
+
contentHeight = _useState2[0],
|
|
14008
|
+
setContentHeight = _useState2[1];
|
|
14009
|
+
var calendarItemHeight = contentHeight - theme.__hd__.calendar.space.iosPickerMarginVertical * 2;
|
|
14010
|
+
var _useState3 = React.useState(0),
|
|
14011
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
14012
|
+
contentWidth = _useState4[0],
|
|
14013
|
+
setContentWidth = _useState4[1];
|
|
14014
|
+
var calendarItemWidth = React.useMemo(function () {
|
|
14015
|
+
return contentWidth > 0 ? Math.floor((contentWidth - theme.__hd__.calendar.space.cellPadding) / 7) : undefined;
|
|
14016
|
+
}, [contentWidth, theme]);
|
|
14017
|
+
var onLayout = React.useCallback(function (e) {
|
|
14018
|
+
var _e$nativeEvent$layout = e.nativeEvent.layout,
|
|
14019
|
+
width = _e$nativeEvent$layout.width,
|
|
14020
|
+
height = _e$nativeEvent$layout.height;
|
|
14021
|
+
setContentHeight(height);
|
|
14022
|
+
setContentWidth(width);
|
|
14023
|
+
}, []);
|
|
14024
|
+
return {
|
|
14025
|
+
onLayout: onLayout,
|
|
14026
|
+
contentHeight: contentHeight,
|
|
14027
|
+
calendarItemHeight: calendarItemHeight,
|
|
14028
|
+
contentWidth: contentWidth,
|
|
14029
|
+
calendarItemWidth: calendarItemWidth
|
|
14030
|
+
};
|
|
14031
|
+
};
|
|
13929
14032
|
|
|
13930
|
-
// Always render 7 rows x 6 items for consistent layout
|
|
13931
|
-
var TOTAL_DATES_ITEMS$1 = 7 * 6;
|
|
13932
14033
|
var CalendarRange = function CalendarRange(_ref) {
|
|
13933
14034
|
var value = _ref.value,
|
|
13934
14035
|
visibleDate = _ref.visibleDate,
|
|
@@ -13951,53 +14052,35 @@ var CalendarRange = function CalendarRange(_ref) {
|
|
|
13951
14052
|
monthPickerConfirmLabel = _ref.monthPickerConfirmLabel,
|
|
13952
14053
|
monthPickerCancelLabel = _ref.monthPickerCancelLabel;
|
|
13953
14054
|
var theme = useTheme();
|
|
13954
|
-
var currentMonth = visibleDate.getMonth();
|
|
13955
|
-
var currentYear = visibleDate.getFullYear();
|
|
13956
|
-
var now = new Date();
|
|
13957
|
-
var parsedMaskedDate = markedDates.reduce(function (current, markedDate) {
|
|
13958
|
-
return _objectSpread2(_objectSpread2({}, current), {}, _defineProperty({}, markedDate.toDateString(), true));
|
|
13959
|
-
}, {});
|
|
13960
14055
|
var _useState = React.useState(false),
|
|
13961
14056
|
_useState2 = _slicedToArray(_useState, 2),
|
|
13962
14057
|
monthPickerVisible = _useState2[0],
|
|
13963
14058
|
setMonthPickerVisible = _useState2[1];
|
|
13964
|
-
var
|
|
13965
|
-
|
|
13966
|
-
contentHeight =
|
|
13967
|
-
|
|
13968
|
-
|
|
13969
|
-
|
|
13970
|
-
|
|
13971
|
-
|
|
13972
|
-
|
|
13973
|
-
|
|
13974
|
-
|
|
13975
|
-
|
|
13976
|
-
|
|
13977
|
-
|
|
13978
|
-
|
|
13979
|
-
|
|
13980
|
-
|
|
13981
|
-
|
|
13982
|
-
|
|
13983
|
-
|
|
13984
|
-
|
|
13985
|
-
|
|
13986
|
-
|
|
13987
|
-
|
|
13988
|
-
|
|
13989
|
-
var daysOfCurrentMonth = initArray(lastDayIndexOfCurrentMonth, function (index) {
|
|
13990
|
-
return getValidDate(new Date(currentYear, currentMonth, index + 1), minDate, maxDate);
|
|
13991
|
-
});
|
|
13992
|
-
var daysOfNextMonth = initArray(TOTAL_DATES_ITEMS$1 - (daysOfPreviousMonth.length + daysOfCurrentMonth.length), function (index) {
|
|
13993
|
-
return getValidDate(new Date(currentYear, currentMonth + 1, index + 1), minDate, maxDate);
|
|
13994
|
-
});
|
|
13995
|
-
var disablePrevButton = minDate === undefined ? false : !daysOfPreviousMonth.some(function (date) {
|
|
13996
|
-
return date !== undefined;
|
|
13997
|
-
}) && minDate >= firstDateOfMonth;
|
|
13998
|
-
var disableNextButton = maxDate === undefined ? false : !daysOfNextMonth.some(function (date) {
|
|
13999
|
-
return date !== undefined;
|
|
14000
|
-
}) || maxDate <= lastDateOfMonth;
|
|
14059
|
+
var _useCalendarLayout = useCalendarLayout(),
|
|
14060
|
+
onLayout = _useCalendarLayout.onLayout,
|
|
14061
|
+
contentHeight = _useCalendarLayout.contentHeight,
|
|
14062
|
+
contentWidth = _useCalendarLayout.contentWidth,
|
|
14063
|
+
calendarItemWidth = _useCalendarLayout.calendarItemWidth;
|
|
14064
|
+
var _getCalendarDate = getCalendarDate({
|
|
14065
|
+
visibleDate: visibleDate,
|
|
14066
|
+
markedDates: markedDates,
|
|
14067
|
+
minDate: minDate,
|
|
14068
|
+
maxDate: maxDate,
|
|
14069
|
+
onMonthChange: onMonthChange
|
|
14070
|
+
}),
|
|
14071
|
+
parsedMaskedDate = _getCalendarDate.parsedMaskedDate,
|
|
14072
|
+
daysOfPreviousMonth = _getCalendarDate.daysOfPreviousMonth,
|
|
14073
|
+
daysOfCurrentMonth = _getCalendarDate.daysOfCurrentMonth,
|
|
14074
|
+
daysOfNextMonth = _getCalendarDate.daysOfNextMonth;
|
|
14075
|
+
var _getCalendarButtonSta = getCalendarButtonState({
|
|
14076
|
+
visibleDate: visibleDate,
|
|
14077
|
+
minDate: minDate,
|
|
14078
|
+
maxDate: maxDate
|
|
14079
|
+
}),
|
|
14080
|
+
disablePrevButton = _getCalendarButtonSta.disablePrevButton,
|
|
14081
|
+
disableNextButton = _getCalendarButtonSta.disableNextButton;
|
|
14082
|
+
var shouldShowMonthPicker = shouldUseMonthPicker(onMonthChange);
|
|
14083
|
+
var now = new Date();
|
|
14001
14084
|
var onDateChange = function onDateChange(date) {
|
|
14002
14085
|
var newDateRange = setStartOrEndDate({
|
|
14003
14086
|
date: date,
|
|
@@ -14045,17 +14128,10 @@ var CalendarRange = function CalendarRange(_ref) {
|
|
|
14045
14128
|
textIntent: isCurrentMonth ? undefined : 'subdued'
|
|
14046
14129
|
});
|
|
14047
14130
|
};
|
|
14048
|
-
var onLayout = function onLayout(e) {
|
|
14049
|
-
var _e$nativeEvent$layout = e.nativeEvent.layout,
|
|
14050
|
-
width = _e$nativeEvent$layout.width,
|
|
14051
|
-
height = _e$nativeEvent$layout.height;
|
|
14052
|
-
setContentHeight(height);
|
|
14053
|
-
setContentWidth(width);
|
|
14054
|
-
};
|
|
14055
14131
|
return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$9, {
|
|
14056
14132
|
testID: testID
|
|
14057
14133
|
}, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__namespace.default.createElement(ContentNavigator, {
|
|
14058
|
-
value: !
|
|
14134
|
+
value: !shouldShowMonthPicker ? formatTime('MMMM yyyy', visibleDate) : /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
|
|
14059
14135
|
testID: "calendar-month-picker",
|
|
14060
14136
|
onPress: function onPress() {
|
|
14061
14137
|
onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(!monthPickerVisible);
|
|
@@ -14077,7 +14153,7 @@ var CalendarRange = function CalendarRange(_ref) {
|
|
|
14077
14153
|
}))),
|
|
14078
14154
|
onPreviousPress: onPreviousPress,
|
|
14079
14155
|
onNextPress: onNextPress,
|
|
14080
|
-
onPress:
|
|
14156
|
+
onPress: shouldShowMonthPicker ? undefined : onTitlePress,
|
|
14081
14157
|
previousDisabled: disablePrevButton,
|
|
14082
14158
|
nextDisabled: disableNextButton,
|
|
14083
14159
|
fontSize: "large"
|
|
@@ -14097,7 +14173,7 @@ var CalendarRange = function CalendarRange(_ref) {
|
|
|
14097
14173
|
}
|
|
14098
14174
|
})) : /*#__PURE__*/React__namespace.default.createElement(Box, {
|
|
14099
14175
|
onLayout: onLayout
|
|
14100
|
-
}, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRow, null, DAYS_OF_WEEK
|
|
14176
|
+
}, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRow, null, DAYS_OF_WEEK.map(function (day) {
|
|
14101
14177
|
return /*#__PURE__*/React__namespace.default.createElement(StyledCalendarRowItem, {
|
|
14102
14178
|
key: day
|
|
14103
14179
|
}, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarDayNameCell, {
|
|
@@ -14137,14 +14213,6 @@ var CalendarRange = function CalendarRange(_ref) {
|
|
|
14137
14213
|
})));
|
|
14138
14214
|
};
|
|
14139
14215
|
|
|
14140
|
-
var DAYS_OF_WEEK = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
|
|
14141
|
-
// Sunday first column => 0
|
|
14142
|
-
// Sunday last column => 1
|
|
14143
|
-
var WEEK_INDEX_OFFSET = 1;
|
|
14144
|
-
var SUNDAY_INDEX = 6;
|
|
14145
|
-
|
|
14146
|
-
// Always render 7 rows x 6 items for consistent layout
|
|
14147
|
-
var TOTAL_DATES_ITEMS = 7 * 6;
|
|
14148
14216
|
var Calendar = function Calendar(_ref) {
|
|
14149
14217
|
var value = _ref.value,
|
|
14150
14218
|
visibleDate = _ref.visibleDate,
|
|
@@ -14167,64 +14235,39 @@ var Calendar = function Calendar(_ref) {
|
|
|
14167
14235
|
monthPickerConfirmLabel = _ref.monthPickerConfirmLabel,
|
|
14168
14236
|
monthPickerCancelLabel = _ref.monthPickerCancelLabel;
|
|
14169
14237
|
var theme = useTheme();
|
|
14170
|
-
var
|
|
14171
|
-
|
|
14172
|
-
|
|
14173
|
-
|
|
14174
|
-
|
|
14175
|
-
|
|
14238
|
+
var _useCalendarLayout = useCalendarLayout(),
|
|
14239
|
+
onLayout = _useCalendarLayout.onLayout,
|
|
14240
|
+
contentHeight = _useCalendarLayout.contentHeight,
|
|
14241
|
+
contentWidth = _useCalendarLayout.contentWidth,
|
|
14242
|
+
calendarItemWidth = _useCalendarLayout.calendarItemWidth;
|
|
14243
|
+
var _getCalendarDate = getCalendarDate({
|
|
14244
|
+
visibleDate: visibleDate,
|
|
14245
|
+
markedDates: markedDates,
|
|
14246
|
+
minDate: minDate,
|
|
14247
|
+
maxDate: maxDate,
|
|
14248
|
+
onMonthChange: onMonthChange
|
|
14249
|
+
}),
|
|
14250
|
+
parsedMaskedDate = _getCalendarDate.parsedMaskedDate,
|
|
14251
|
+
daysOfPreviousMonth = _getCalendarDate.daysOfPreviousMonth,
|
|
14252
|
+
daysOfCurrentMonth = _getCalendarDate.daysOfCurrentMonth,
|
|
14253
|
+
daysOfNextMonth = _getCalendarDate.daysOfNextMonth;
|
|
14254
|
+
var _getCalendarButtonSta = getCalendarButtonState({
|
|
14255
|
+
visibleDate: visibleDate,
|
|
14256
|
+
minDate: minDate,
|
|
14257
|
+
maxDate: maxDate
|
|
14258
|
+
}),
|
|
14259
|
+
disablePrevButton = _getCalendarButtonSta.disablePrevButton,
|
|
14260
|
+
disableNextButton = _getCalendarButtonSta.disableNextButton;
|
|
14261
|
+
var shouldShowMonthPicker = shouldUseMonthPicker(onMonthChange);
|
|
14176
14262
|
var _useState = React.useState(false),
|
|
14177
14263
|
_useState2 = _slicedToArray(_useState, 2),
|
|
14178
14264
|
monthPickerVisible = _useState2[0],
|
|
14179
14265
|
setMonthPickerVisible = _useState2[1];
|
|
14180
|
-
var
|
|
14181
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
14182
|
-
contentHeight = _useState4[0],
|
|
14183
|
-
setContentHeight = _useState4[1];
|
|
14184
|
-
var _useState5 = React.useState(0),
|
|
14185
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
14186
|
-
contentWidth = _useState6[0],
|
|
14187
|
-
setContentWidth = _useState6[1];
|
|
14188
|
-
var calendarItemWidth = React.useMemo(function () {
|
|
14189
|
-
return contentWidth > 0 ? Math.floor((contentWidth - theme.__hd__.calendar.space.cellPadding) / 7) : undefined;
|
|
14190
|
-
}, [contentWidth, theme]);
|
|
14191
|
-
var useMonthPicker = onMonthChange !== noop$2;
|
|
14192
|
-
var firstDateOfMonth = new Date(currentYear, currentMonth, 1);
|
|
14193
|
-
var lastDateOfMonth = new Date(currentYear, currentMonth + 1, 0);
|
|
14194
|
-
var lastDateOfPreviousMonth = new Date(currentYear, currentMonth, 0);
|
|
14195
|
-
|
|
14196
|
-
// Index of day in week is shifted by 1 due to Sunday is the last column
|
|
14197
|
-
var firstDayWeekIndexOfMonth = firstDateOfMonth.getDay() === 0 ? SUNDAY_INDEX : firstDateOfMonth.getDay() - WEEK_INDEX_OFFSET;
|
|
14198
|
-
var lastDayIndexOfCurrentMonth = lastDateOfMonth.getDate();
|
|
14199
|
-
var lastDayIndexOfPreviousMonth = lastDateOfPreviousMonth.getDate();
|
|
14200
|
-
var daysOfPreviousMonth = initArray(firstDayWeekIndexOfMonth, function (index) {
|
|
14201
|
-
var reversedIndex = firstDayWeekIndexOfMonth - index - 1;
|
|
14202
|
-
var count = lastDayIndexOfPreviousMonth - reversedIndex;
|
|
14203
|
-
return getValidDate(new Date(currentYear, currentMonth - 1, count), minDate, maxDate);
|
|
14204
|
-
});
|
|
14205
|
-
var daysOfCurrentMonth = initArray(lastDayIndexOfCurrentMonth, function (index) {
|
|
14206
|
-
return getValidDate(new Date(currentYear, currentMonth, index + 1), minDate, maxDate);
|
|
14207
|
-
});
|
|
14208
|
-
var daysOfNextMonth = initArray(TOTAL_DATES_ITEMS - (daysOfPreviousMonth.length + daysOfCurrentMonth.length), function (index) {
|
|
14209
|
-
return getValidDate(new Date(currentYear, currentMonth + 1, index + 1), minDate, maxDate);
|
|
14210
|
-
});
|
|
14211
|
-
var disablePrevButton = minDate === undefined ? false : !daysOfPreviousMonth.some(function (date) {
|
|
14212
|
-
return date !== undefined;
|
|
14213
|
-
}) && minDate >= firstDateOfMonth;
|
|
14214
|
-
var disableNextButton = maxDate === undefined ? false : !daysOfNextMonth.some(function (date) {
|
|
14215
|
-
return date !== undefined;
|
|
14216
|
-
}) || maxDate <= lastDateOfMonth;
|
|
14217
|
-
var onLayout = function onLayout(e) {
|
|
14218
|
-
var _e$nativeEvent$layout = e.nativeEvent.layout,
|
|
14219
|
-
width = _e$nativeEvent$layout.width,
|
|
14220
|
-
height = _e$nativeEvent$layout.height;
|
|
14221
|
-
setContentHeight(height);
|
|
14222
|
-
setContentWidth(width);
|
|
14223
|
-
};
|
|
14266
|
+
var now = new Date();
|
|
14224
14267
|
return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$9, {
|
|
14225
14268
|
testID: testID
|
|
14226
14269
|
}, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__namespace.default.createElement(ContentNavigator, {
|
|
14227
|
-
value: !
|
|
14270
|
+
value: !shouldShowMonthPicker ? formatTime('MMMM yyyy', visibleDate) : /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
|
|
14228
14271
|
testID: "calendar-month-picker",
|
|
14229
14272
|
onPress: function onPress() {
|
|
14230
14273
|
onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(!monthPickerVisible);
|
|
@@ -14246,7 +14289,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
14246
14289
|
}))),
|
|
14247
14290
|
onPreviousPress: onPreviousPress,
|
|
14248
14291
|
onNextPress: onNextPress,
|
|
14249
|
-
onPress:
|
|
14292
|
+
onPress: shouldShowMonthPicker ? undefined : onTitlePress,
|
|
14250
14293
|
previousDisabled: disablePrevButton,
|
|
14251
14294
|
nextDisabled: disableNextButton,
|
|
14252
14295
|
fontSize: "large"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn-work-uikit",
|
|
3
|
-
"version": "1.6.2-alpha.
|
|
3
|
+
"version": "1.6.2-alpha.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@emotion/native": "^11.9.3",
|
|
24
24
|
"@emotion/primitives-core": "11.0.0",
|
|
25
25
|
"@emotion/react": "^11.9.3",
|
|
26
|
-
"@hero-design/rn": "^8.104.1-alpha.
|
|
26
|
+
"@hero-design/rn": "^8.104.1-alpha.3",
|
|
27
27
|
"hero-editor": "^1.15.5"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|