@salutejs/plasma-new-hope 0.324.0-canary.1983.15135554391.0 → 0.324.0-canary.1984.15135602558.0
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/cjs/components/Calendar/utils/getDateWithModification.js +30 -24
- package/cjs/components/Calendar/utils/getDateWithModification.js.map +1 -1
- package/emotion/cjs/components/Calendar/utils/getDateWithModification.js +30 -24
- package/emotion/cjs/engines/emotion.js +3 -8
- package/emotion/es/components/Calendar/utils/getDateWithModification.js +30 -24
- package/emotion/es/engines/emotion.js +3 -8
- package/es/components/Calendar/utils/getDateWithModification.js +30 -24
- package/es/components/Calendar/utils/getDateWithModification.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Calendar/utils/getDateWithModification.js +30 -24
- package/styled-components/cjs/engines/styled-components.js +3 -8
- package/styled-components/es/components/Calendar/utils/getDateWithModification.js +30 -24
- package/styled-components/es/engines/styled-components.js +3 -8
- package/types/components/Calendar/utils/getDateWithModification.d.ts.map +1 -1
- package/types/engines/emotion.d.ts.map +1 -1
- package/types/engines/styled-components.d.ts.map +1 -1
@@ -47,7 +47,7 @@ var normalizeDate = function normalizeDate(date, type) {
|
|
47
47
|
date.setMonth(0);
|
48
48
|
}
|
49
49
|
};
|
50
|
-
var isDisabledNextDate = function isDisabledNextDate(_ref, type, max) {
|
50
|
+
var isDisabledNextDate = function isDisabledNextDate(_ref, type, max, includeEdgeDates) {
|
51
51
|
var year = _ref.year,
|
52
52
|
monthIndex = _ref.monthIndex,
|
53
53
|
day = _ref.day;
|
@@ -59,13 +59,14 @@ var isDisabledNextDate = function isDisabledNextDate(_ref, type, max) {
|
|
59
59
|
var currentDate = new Date(year, monthIndex, day);
|
60
60
|
dateOperationHandler[type].add(currentDate);
|
61
61
|
var isOut = true;
|
62
|
-
|
63
|
-
|
62
|
+
var maxDateCondition = includeEdgeDates ? currentDate < maxDate : currentDate <= maxDate;
|
63
|
+
while (isOut && maxDateCondition) {
|
64
|
+
isOut = maxDateCondition;
|
64
65
|
dateOperationHandler[type].add(currentDate);
|
65
66
|
}
|
66
67
|
return isOut;
|
67
68
|
};
|
68
|
-
var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min) {
|
69
|
+
var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min, includeEdgeDates) {
|
69
70
|
var year = _ref2.year,
|
70
71
|
monthIndex = _ref2.monthIndex,
|
71
72
|
day = _ref2.day;
|
@@ -77,54 +78,59 @@ var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min) {
|
|
77
78
|
var currentDate = new Date(year, monthIndex, day);
|
78
79
|
dateOperationHandler[type].subtract(currentDate);
|
79
80
|
var isOut = true;
|
80
|
-
|
81
|
-
|
81
|
+
var minDateCondition = includeEdgeDates ? currentDate > minDate : currentDate >= minDate;
|
82
|
+
while (isOut && minDateCondition) {
|
83
|
+
isOut = minDateCondition;
|
82
84
|
dateOperationHandler[type].subtract(currentDate);
|
83
85
|
}
|
84
86
|
return isOut;
|
85
87
|
};
|
86
|
-
var getDisabledDates = function getDisabledDates(list, type, min, max) {
|
88
|
+
var getDisabledDates = function getDisabledDates(list, type, min, max, includeEdgeDates) {
|
87
89
|
var disabledDate = [];
|
88
|
-
if (isDisabledPreviousDate(list[0], type, min)) {
|
90
|
+
if (isDisabledPreviousDate(list[0], type, min, includeEdgeDates)) {
|
89
91
|
disabledDate.push('previous');
|
90
92
|
}
|
91
|
-
if (isDisabledNextDate(list[list.length - 1], type, max)) {
|
93
|
+
if (isDisabledNextDate(list[list.length - 1], type, max, includeEdgeDates)) {
|
92
94
|
disabledDate.push('next');
|
93
95
|
}
|
94
96
|
return disabledDate.join(',');
|
95
97
|
};
|
96
|
-
var isDisabledArrowLeft = function isDisabledArrowLeft(date, min) {
|
98
|
+
var isDisabledArrowLeft = function isDisabledArrowLeft(date, min, includeEdgeDates) {
|
97
99
|
var currentDate = new Date(date);
|
98
100
|
currentDate.setDate(currentDate.getDate() - 1);
|
99
|
-
|
101
|
+
var disableCondition = min && (includeEdgeDates ? min > currentDate : min >= currentDate);
|
102
|
+
return disableCondition;
|
100
103
|
};
|
101
|
-
var isDisabledArrowRight = function isDisabledArrowRight(date, max) {
|
104
|
+
var isDisabledArrowRight = function isDisabledArrowRight(date, max, includeEdgeDates) {
|
102
105
|
var currentDate = new Date(date);
|
103
106
|
currentDate.setDate(currentDate.getDate() + 1);
|
104
|
-
|
107
|
+
var disableCondition = max && (includeEdgeDates ? max < currentDate : max <= currentDate);
|
108
|
+
return disableCondition;
|
105
109
|
};
|
106
|
-
var isDisabledArrowUp = function isDisabledArrowUp(date, min) {
|
110
|
+
var isDisabledArrowUp = function isDisabledArrowUp(date, min, includeEdgeDates) {
|
107
111
|
var currentDate = new Date(date);
|
108
112
|
currentDate.setDate(date.getDate() - 7);
|
109
|
-
|
113
|
+
var disableCondition = min && (includeEdgeDates ? min > currentDate : min >= currentDate);
|
114
|
+
return disableCondition;
|
110
115
|
};
|
111
|
-
var isDisabledArrowDown = function isDisabledArrowDown(date, max) {
|
116
|
+
var isDisabledArrowDown = function isDisabledArrowDown(date, max, includeEdgeDates) {
|
112
117
|
var currentDate = new Date(date);
|
113
118
|
currentDate.setDate(date.getDate() + 7);
|
114
|
-
|
119
|
+
var disableCondition = max && (includeEdgeDates ? max < currentDate : max <= currentDate);
|
120
|
+
return disableCondition;
|
115
121
|
};
|
116
|
-
var getDisabledArrowKey = function getDisabledArrowKey(currentDate, min, max) {
|
122
|
+
var getDisabledArrowKey = function getDisabledArrowKey(currentDate, min, max, includeEdgeDates) {
|
117
123
|
var disabledArrowKey = [];
|
118
|
-
if (isDisabledArrowLeft(currentDate, min)) {
|
124
|
+
if (isDisabledArrowLeft(currentDate, min, includeEdgeDates)) {
|
119
125
|
disabledArrowKey.push('left');
|
120
126
|
}
|
121
|
-
if (isDisabledArrowRight(currentDate, max)) {
|
127
|
+
if (isDisabledArrowRight(currentDate, max, includeEdgeDates)) {
|
122
128
|
disabledArrowKey.push('right');
|
123
129
|
}
|
124
|
-
if (isDisabledArrowDown(currentDate, max)) {
|
130
|
+
if (isDisabledArrowDown(currentDate, max, includeEdgeDates)) {
|
125
131
|
disabledArrowKey.push('down');
|
126
132
|
}
|
127
|
-
if (isDisabledArrowUp(currentDate, min)) {
|
133
|
+
if (isDisabledArrowUp(currentDate, min, includeEdgeDates)) {
|
128
134
|
disabledArrowKey.push('up');
|
129
135
|
}
|
130
136
|
return disabledArrowKey.join(',');
|
@@ -153,7 +159,7 @@ var getDatesWithModifications = function getDatesWithModifications(_ref3) {
|
|
153
159
|
var date = _ref5.date;
|
154
160
|
return date;
|
155
161
|
});
|
156
|
-
var disabledDates = getDisabledDates(datesList, type, min, max);
|
162
|
+
var disabledDates = getDisabledDates(datesList, type, min, max, includeEdgeDates);
|
157
163
|
return dates.map(function (dateItem) {
|
158
164
|
var date = dateItem.date;
|
159
165
|
var year = date.year,
|
@@ -178,7 +184,7 @@ var getDatesWithModifications = function getDatesWithModifications(_ref3) {
|
|
178
184
|
dateItem.events = eventsMap.get(keyDate);
|
179
185
|
dateItem.disabled = disabledDatesMap.has(keyDate) || isOutOfMinMaxRange;
|
180
186
|
dateItem.isOutOfMinMaxRange = isOutOfMinMaxRange;
|
181
|
-
dateItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max);
|
187
|
+
dateItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max, includeEdgeDates);
|
182
188
|
dateItem.disabledDates = disabledDates;
|
183
189
|
return dateItem;
|
184
190
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getDateWithModification.js","sources":["../../../../src/components/Calendar/utils/getDateWithModification.ts"],"sourcesContent":["import type { DateItem, DateObject, DisabledDay, EventDay } from '../Calendar.types';\nimport { CalendarState, CalendarStateType } from '../store/types';\n\nimport { getPropsMap } from './calendarGridHelper';\n\ntype GetDatesWithModificationsArgs = {\n dates: DateItem[];\n type: CalendarStateType;\n eventList?: EventDay[];\n disabledList?: DisabledDay[];\n includeEdgeDates?: boolean;\n min?: Date;\n max?: Date;\n};\n\ntype DateOperationHandler = {\n [k in CalendarStateType]: {\n [t in 'add' | 'subtract']: (date: Date) => number;\n };\n};\n\nconst dateOperationHandler: DateOperationHandler = {\n Days: {\n add: (date: Date) => date.setDate(date.getDate() + 1),\n subtract: (date: Date) => date.setDate(date.getDate() - 1),\n },\n Months: {\n add: (date: Date) => date.setMonth(date.getMonth() + 1),\n subtract: (date: Date) => date.setMonth(date.getMonth() - 1),\n },\n Quarters: {\n add: (date: Date) => date.setMonth(date.getMonth() + 3),\n subtract: (date: Date) => date.setMonth(date.getMonth() - 3),\n },\n Years: {\n add: (date: Date) => date.setFullYear(date.getFullYear() + 1),\n subtract: (date: Date) => date.setFullYear(date.getFullYear() - 1),\n },\n};\n\nconst normalizeDate = (date: Date, type: CalendarStateType) => {\n if (type === CalendarState.Months || type === CalendarState.Years) {\n date.setDate(1);\n }\n\n if (type === CalendarState.Years) {\n date.setMonth(0);\n }\n};\n\nconst isDisabledNextDate = ({ year, monthIndex, day }: DateObject, type: CalendarStateType, max?: Date) => {\n if (!max) {\n return false;\n }\n\n const maxDate = new Date(max);\n\n normalizeDate(maxDate, type);\n\n const currentDate = new Date(year, monthIndex, day);\n dateOperationHandler[type].add(currentDate);\n\n let isOut = true;\n\n while (isOut && currentDate <= maxDate) {\n isOut = maxDate <= currentDate;\n\n dateOperationHandler[type].add(currentDate);\n }\n\n return isOut;\n};\n\nconst isDisabledPreviousDate = ({ year, monthIndex, day }: DateObject, type: CalendarStateType, min?: Date) => {\n if (!min) {\n return false;\n }\n\n const minDate = new Date(min);\n\n normalizeDate(minDate, type);\n\n const currentDate = new Date(year, monthIndex, day);\n dateOperationHandler[type].subtract(currentDate);\n\n let isOut = true;\n\n while (isOut && currentDate >= minDate) {\n isOut = minDate >= currentDate;\n\n dateOperationHandler[type].subtract(currentDate);\n }\n\n return isOut;\n};\n\nconst getDisabledDates = (list: DateObject[], type: CalendarStateType, min?: Date, max?: Date) => {\n const disabledDate: string[] = [];\n\n if (isDisabledPreviousDate(list[0], type, min)) {\n disabledDate.push('previous');\n }\n\n if (isDisabledNextDate(list[list.length - 1], type, max)) {\n disabledDate.push('next');\n }\n\n return disabledDate.join(',');\n};\n\nconst isDisabledArrowLeft = (date: Date, min?: Date) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(currentDate.getDate() - 1);\n\n return (min && min >= currentDate) || (min && min >= date);\n};\n\nconst isDisabledArrowRight = (date: Date, max?: Date) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(currentDate.getDate() + 1);\n\n return (max && max <= currentDate) || (max && max <= date);\n};\n\nconst isDisabledArrowUp = (date: Date, min?: Date) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(date.getDate() - 7);\n\n return min && min >= currentDate;\n};\n\nconst isDisabledArrowDown = (date: Date, max?: Date) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(date.getDate() + 7);\n\n return max && max <= currentDate;\n};\n\nconst getDisabledArrowKey = (currentDate: Date, min?: Date, max?: Date) => {\n const disabledArrowKey: string[] = [];\n\n if (isDisabledArrowLeft(currentDate, min)) {\n disabledArrowKey.push('left');\n }\n\n if (isDisabledArrowRight(currentDate, max)) {\n disabledArrowKey.push('right');\n }\n\n if (isDisabledArrowDown(currentDate, max)) {\n disabledArrowKey.push('down');\n }\n\n if (isDisabledArrowUp(currentDate, min)) {\n disabledArrowKey.push('up');\n }\n\n return disabledArrowKey.join(',');\n};\n\n/**\n * Метод модифицирующий дату (добавляющий свойства events и disabled).\n */\nexport const getDatesWithModifications = ({\n dates,\n type,\n eventList = [],\n disabledList = [],\n includeEdgeDates,\n min,\n max,\n}: GetDatesWithModificationsArgs) => {\n const eventsMap = getPropsMap(eventList);\n const disabledDatesMap = getPropsMap(disabledList);\n\n const filteredDates =\n type === CalendarState.Days ? dates.filter(({ isDayInCurrentMonth }) => isDayInCurrentMonth) : dates;\n const datesList = filteredDates.map(({ date }) => date);\n\n const disabledDates = getDisabledDates(datesList, type, min, max);\n\n return dates.map((dateItem) => {\n const { date } = dateItem;\n const { year, monthIndex, day } = date;\n\n const keyDate = `${year}-${monthIndex}-${day}`;\n const currentDate = new Date(year, monthIndex, day);\n\n const minDate = min && new Date(min);\n minDate && normalizeDate(minDate, type);\n\n const maxDate = max && new Date(max);\n maxDate && normalizeDate(maxDate, type);\n\n let minValue: boolean | undefined;\n let maxValue: boolean | undefined;\n\n if (type === CalendarState.Days) {\n minValue = min && (includeEdgeDates ? min > currentDate : min >= currentDate);\n maxValue = max && (includeEdgeDates ? max < currentDate : max <= currentDate);\n } else {\n minValue = minDate && minDate > currentDate;\n maxValue = maxDate && maxDate < currentDate;\n }\n\n const isOutOfMinMaxRange = minValue || maxValue;\n\n dateItem.events = eventsMap.get(keyDate);\n dateItem.disabled = disabledDatesMap.has(keyDate) || isOutOfMinMaxRange;\n\n dateItem.isOutOfMinMaxRange = isOutOfMinMaxRange;\n dateItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max);\n dateItem.disabledDates = disabledDates;\n\n return dateItem;\n });\n};\n"],"names":["dateOperationHandler","Days","add","date","setDate","getDate","subtract","Months","setMonth","getMonth","Quarters","Years","setFullYear","getFullYear","normalizeDate","type","CalendarState","isDisabledNextDate","_ref","max","year","monthIndex","day","maxDate","Date","currentDate","isOut","isDisabledPreviousDate","_ref2","min","minDate","getDisabledDates","list","disabledDate","push","length","join","isDisabledArrowLeft","isDisabledArrowRight","isDisabledArrowUp","isDisabledArrowDown","getDisabledArrowKey","disabledArrowKey","getDatesWithModifications","_ref3","dates","_ref3$eventList","eventList","_ref3$disabledList","disabledList","includeEdgeDates","eventsMap","getPropsMap","disabledDatesMap","filteredDates","filter","_ref4","isDayInCurrentMonth","datesList","map","_ref5","disabledDates","dateItem","keyDate","concat","minValue","maxValue","isOutOfMinMaxRange","events","get","disabled","has"],"mappings":";;;;;;;AAqBA,IAAMA,oBAA0C,GAAG;AAC/CC,EAAAA,IAAI,EAAE;I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GnC,OAAO,IAAIA,OAAO,GAAGL,WAAW,CAAA;AAC3CyC,MAAAA,QAAQ,GAAG3C,OAAO,IAAIA,OAAO,GAAGE,WAAW,CAAA;AAC/C,KAAA;AAEA,IAAA,IAAM0C,kBAAkB,GAAGF,QAAQ,IAAIC,QAAQ,CAAA;IAE/CJ,QAAQ,CAACM,MAAM,GAAGjB,SAAS,CAACkB,GAAG,CAACN,OAAO,CAAC,CAAA;IACxCD,QAAQ,CAACQ,QAAQ,GAAGjB,gBAAgB,CAACkB,GAAG,CAACR,OAAO,CAAC,IAAII,kBAAkB,CAAA;IAEvEL,QAAQ,CAACK,kBAAkB,GAAGA,kBAAkB,CAAA;IAChDL,QAAQ,CAACpB,gBAAgB,GAAGD,mBAAmB,CAAChB,WAAW,EAAEI,GAAG,EAAEV,GAAG,CAAC,CAAA;IACtE2C,QAAQ,CAACD,aAAa,GAAGA,aAAa,CAAA;AAEtC,IAAA,OAAOC,QAAQ,CAAA;AACnB,GAAC,CAAC,CAAA;AACN;;;;"}
|
1
|
+
{"version":3,"file":"getDateWithModification.js","sources":["../../../../src/components/Calendar/utils/getDateWithModification.ts"],"sourcesContent":["import type { DateItem, DateObject, DisabledDay, EventDay } from '../Calendar.types';\nimport { CalendarState, CalendarStateType } from '../store/types';\n\nimport { getPropsMap } from './calendarGridHelper';\n\ntype GetDatesWithModificationsArgs = {\n dates: DateItem[];\n type: CalendarStateType;\n eventList?: EventDay[];\n disabledList?: DisabledDay[];\n includeEdgeDates?: boolean;\n min?: Date;\n max?: Date;\n};\n\ntype DateOperationHandler = {\n [k in CalendarStateType]: {\n [t in 'add' | 'subtract']: (date: Date) => number;\n };\n};\n\nconst dateOperationHandler: DateOperationHandler = {\n Days: {\n add: (date: Date) => date.setDate(date.getDate() + 1),\n subtract: (date: Date) => date.setDate(date.getDate() - 1),\n },\n Months: {\n add: (date: Date) => date.setMonth(date.getMonth() + 1),\n subtract: (date: Date) => date.setMonth(date.getMonth() - 1),\n },\n Quarters: {\n add: (date: Date) => date.setMonth(date.getMonth() + 3),\n subtract: (date: Date) => date.setMonth(date.getMonth() - 3),\n },\n Years: {\n add: (date: Date) => date.setFullYear(date.getFullYear() + 1),\n subtract: (date: Date) => date.setFullYear(date.getFullYear() - 1),\n },\n};\n\nconst normalizeDate = (date: Date, type: CalendarStateType) => {\n if (type === CalendarState.Months || type === CalendarState.Years) {\n date.setDate(1);\n }\n\n if (type === CalendarState.Years) {\n date.setMonth(0);\n }\n};\n\nconst isDisabledNextDate = (\n { year, monthIndex, day }: DateObject,\n type: CalendarStateType,\n max?: Date,\n includeEdgeDates?: boolean,\n) => {\n if (!max) {\n return false;\n }\n\n const maxDate = new Date(max);\n\n normalizeDate(maxDate, type);\n\n const currentDate = new Date(year, monthIndex, day);\n dateOperationHandler[type].add(currentDate);\n\n let isOut = true;\n const maxDateCondition = includeEdgeDates ? currentDate < maxDate : currentDate <= maxDate;\n\n while (isOut && maxDateCondition) {\n isOut = maxDateCondition;\n\n dateOperationHandler[type].add(currentDate);\n }\n\n return isOut;\n};\n\nconst isDisabledPreviousDate = (\n { year, monthIndex, day }: DateObject,\n type: CalendarStateType,\n min?: Date,\n includeEdgeDates?: boolean,\n) => {\n if (!min) {\n return false;\n }\n\n const minDate = new Date(min);\n\n normalizeDate(minDate, type);\n\n const currentDate = new Date(year, monthIndex, day);\n dateOperationHandler[type].subtract(currentDate);\n\n let isOut = true;\n const minDateCondition = includeEdgeDates ? currentDate > minDate : currentDate >= minDate;\n\n while (isOut && minDateCondition) {\n isOut = minDateCondition;\n\n dateOperationHandler[type].subtract(currentDate);\n }\n\n return isOut;\n};\n\nconst getDisabledDates = (\n list: DateObject[],\n type: CalendarStateType,\n min?: Date,\n max?: Date,\n includeEdgeDates?: boolean,\n) => {\n const disabledDate: string[] = [];\n\n if (isDisabledPreviousDate(list[0], type, min, includeEdgeDates)) {\n disabledDate.push('previous');\n }\n\n if (isDisabledNextDate(list[list.length - 1], type, max, includeEdgeDates)) {\n disabledDate.push('next');\n }\n\n return disabledDate.join(',');\n};\n\nconst isDisabledArrowLeft = (date: Date, min?: Date, includeEdgeDates?: boolean) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(currentDate.getDate() - 1);\n\n const disableCondition = min && (includeEdgeDates ? min > currentDate : min >= currentDate);\n\n return disableCondition;\n};\n\nconst isDisabledArrowRight = (date: Date, max?: Date, includeEdgeDates?: boolean) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(currentDate.getDate() + 1);\n\n const disableCondition = max && (includeEdgeDates ? max < currentDate : max <= currentDate);\n\n return disableCondition;\n};\n\nconst isDisabledArrowUp = (date: Date, min?: Date, includeEdgeDates?: boolean) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(date.getDate() - 7);\n\n const disableCondition = min && (includeEdgeDates ? min > currentDate : min >= currentDate);\n\n return disableCondition;\n};\n\nconst isDisabledArrowDown = (date: Date, max?: Date, includeEdgeDates?: boolean) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(date.getDate() + 7);\n\n const disableCondition = max && (includeEdgeDates ? max < currentDate : max <= currentDate);\n\n return disableCondition;\n};\n\nconst getDisabledArrowKey = (currentDate: Date, min?: Date, max?: Date, includeEdgeDates?: boolean) => {\n const disabledArrowKey: string[] = [];\n\n if (isDisabledArrowLeft(currentDate, min, includeEdgeDates)) {\n disabledArrowKey.push('left');\n }\n\n if (isDisabledArrowRight(currentDate, max, includeEdgeDates)) {\n disabledArrowKey.push('right');\n }\n\n if (isDisabledArrowDown(currentDate, max, includeEdgeDates)) {\n disabledArrowKey.push('down');\n }\n\n if (isDisabledArrowUp(currentDate, min, includeEdgeDates)) {\n disabledArrowKey.push('up');\n }\n\n return disabledArrowKey.join(',');\n};\n\n/**\n * Метод модифицирующий дату (добавляющий свойства events и disabled).\n */\nexport const getDatesWithModifications = ({\n dates,\n type,\n eventList = [],\n disabledList = [],\n includeEdgeDates,\n min,\n max,\n}: GetDatesWithModificationsArgs) => {\n const eventsMap = getPropsMap(eventList);\n const disabledDatesMap = getPropsMap(disabledList);\n\n const filteredDates =\n type === CalendarState.Days ? dates.filter(({ isDayInCurrentMonth }) => isDayInCurrentMonth) : dates;\n const datesList = filteredDates.map(({ date }) => date);\n\n const disabledDates = getDisabledDates(datesList, type, min, max, includeEdgeDates);\n\n return dates.map((dateItem) => {\n const { date } = dateItem;\n const { year, monthIndex, day } = date;\n\n const keyDate = `${year}-${monthIndex}-${day}`;\n const currentDate = new Date(year, monthIndex, day);\n\n const minDate = min && new Date(min);\n minDate && normalizeDate(minDate, type);\n\n const maxDate = max && new Date(max);\n maxDate && normalizeDate(maxDate, type);\n\n let minValue: boolean | undefined;\n let maxValue: boolean | undefined;\n\n if (type === CalendarState.Days) {\n minValue = min && (includeEdgeDates ? min > currentDate : min >= currentDate);\n maxValue = max && (includeEdgeDates ? max < currentDate : max <= currentDate);\n } else {\n minValue = minDate && minDate > currentDate;\n maxValue = maxDate && maxDate < currentDate;\n }\n\n const isOutOfMinMaxRange = minValue || maxValue;\n\n dateItem.events = eventsMap.get(keyDate);\n dateItem.disabled = disabledDatesMap.has(keyDate) || isOutOfMinMaxRange;\n\n dateItem.isOutOfMinMaxRange = isOutOfMinMaxRange;\n dateItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max, includeEdgeDates);\n dateItem.disabledDates = disabledDates;\n\n return dateItem;\n });\n};\n"],"names":["dateOperationHandler","Days","add","date","setDate","getDate","subtract","Months","setMonth","getMonth","Quarters","Years","setFullYear","getFullYear","normalizeDate","type","CalendarState","isDisabledNextDate","_ref","max","includeEdgeDates","year","monthIndex","day","maxDate","Date","currentDate","isOut","maxDateCondition","isDisabledPreviousDate","_ref2","min","minDate","minDateCondition","getDisabledDates","list","disabledDate","push","length","join","isDisabledArrowLeft","disableCondition","isDisabledArrowRight","isDisabledArrowUp","isDisabledArrowDown","getDisabledArrowKey","disabledArrowKey","getDatesWithModifications","_ref3","dates","_ref3$eventList","eventList","_ref3$disabledList","disabledList","eventsMap","getPropsMap","disabledDatesMap","filteredDates","filter","_ref4","isDayInCurrentMonth","datesList","map","_ref5","disabledDates","dateItem","keyDate","concat","minValue","maxValue","isOutOfMinMaxRange","events","get","disabled","has"],"mappings":";;;;;;;AAqBA,IAAMA,oBAA0C,GAAG;AAC/CC,EAAAA,IAAI,EAAE;IACFC,GAAG,EAAE,SAAAA,GAAAA,CAACC,IAAU,EAAA;MAAA,OAAKA,IAAI,CAACC,OAAO,CAACD,IAAI,CAACE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;AAAA,KAAA;IACrDC,QAAQ,EAAE,SAAAA,QAAAA,CAACH,IAAU,EAAA;MAAA,OAAKA,IAAI,CAACC,OAAO,CAACD,IAAI,CAACE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;AAAA,KAAA;GAC7D;AACDE,EAAAA,MAAM,EAAE;IACJL,GAAG,EAAE,SAAAA,GAAAA,CAACC,IAAU,EAAA;MAAA,OAAKA,IAAI,CAACK,QAAQ,CAACL,IAAI,CAACM,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAA;AAAA,KAAA;IACvDH,QAAQ,EAAE,SAAAA,QAAAA,CAACH,IAAU,EAAA;MAAA,OAAKA,IAAI,CAACK,QAAQ,CAACL,IAAI,CAACM,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAA;AAAA,KAAA;GAC/D;AACDC,EAAAA,QAAQ,EAAE;IACNR,GAAG,EAAE,SAAAA,GAAAA,CAACC,IAAU,EAAA;MAAA,OAAKA,IAAI,CAACK,QAAQ,CAACL,IAAI,CAACM,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAA;AAAA,KAAA;IACvDH,QAAQ,EAAE,SAAAA,QAAAA,CAACH,IAAU,EAAA;MAAA,OAAKA,IAAI,CAACK,QAAQ,CAACL,IAAI,CAACM,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAA;AAAA,KAAA;GAC/D;AACDE,EAAAA,KAAK,EAAE;IACHT,GAAG,EAAE,SAAAA,GAAAA,CAACC,IAAU,EAAA;MAA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IAAII,kBAAkB,CAAA;IAEvEL,QAAQ,CAACK,kBAAkB,GAAGA,kBAAkB,CAAA;AAChDL,IAAAA,QAAQ,CAACnB,gBAAgB,GAAGD,mBAAmB,CAACnB,WAAW,EAAEK,GAAG,EAAEZ,GAAG,EAAEC,gBAAgB,CAAC,CAAA;IACxF6C,QAAQ,CAACD,aAAa,GAAGA,aAAa,CAAA;AAEtC,IAAA,OAAOC,QAAQ,CAAA;AACnB,GAAC,CAAC,CAAA;AACN;;;;"}
|
@@ -48,7 +48,7 @@ var normalizeDate = function normalizeDate(date, type) {
|
|
48
48
|
date.setMonth(0);
|
49
49
|
}
|
50
50
|
};
|
51
|
-
var isDisabledNextDate = function isDisabledNextDate(_ref, type, max) {
|
51
|
+
var isDisabledNextDate = function isDisabledNextDate(_ref, type, max, includeEdgeDates) {
|
52
52
|
var year = _ref.year,
|
53
53
|
monthIndex = _ref.monthIndex,
|
54
54
|
day = _ref.day;
|
@@ -60,13 +60,14 @@ var isDisabledNextDate = function isDisabledNextDate(_ref, type, max) {
|
|
60
60
|
var currentDate = new Date(year, monthIndex, day);
|
61
61
|
dateOperationHandler[type].add(currentDate);
|
62
62
|
var isOut = true;
|
63
|
-
|
64
|
-
|
63
|
+
var maxDateCondition = includeEdgeDates ? currentDate < maxDate : currentDate <= maxDate;
|
64
|
+
while (isOut && maxDateCondition) {
|
65
|
+
isOut = maxDateCondition;
|
65
66
|
dateOperationHandler[type].add(currentDate);
|
66
67
|
}
|
67
68
|
return isOut;
|
68
69
|
};
|
69
|
-
var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min) {
|
70
|
+
var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min, includeEdgeDates) {
|
70
71
|
var year = _ref2.year,
|
71
72
|
monthIndex = _ref2.monthIndex,
|
72
73
|
day = _ref2.day;
|
@@ -78,54 +79,59 @@ var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min) {
|
|
78
79
|
var currentDate = new Date(year, monthIndex, day);
|
79
80
|
dateOperationHandler[type].subtract(currentDate);
|
80
81
|
var isOut = true;
|
81
|
-
|
82
|
-
|
82
|
+
var minDateCondition = includeEdgeDates ? currentDate > minDate : currentDate >= minDate;
|
83
|
+
while (isOut && minDateCondition) {
|
84
|
+
isOut = minDateCondition;
|
83
85
|
dateOperationHandler[type].subtract(currentDate);
|
84
86
|
}
|
85
87
|
return isOut;
|
86
88
|
};
|
87
|
-
var getDisabledDates = function getDisabledDates(list, type, min, max) {
|
89
|
+
var getDisabledDates = function getDisabledDates(list, type, min, max, includeEdgeDates) {
|
88
90
|
var disabledDate = [];
|
89
|
-
if (isDisabledPreviousDate(list[0], type, min)) {
|
91
|
+
if (isDisabledPreviousDate(list[0], type, min, includeEdgeDates)) {
|
90
92
|
disabledDate.push('previous');
|
91
93
|
}
|
92
|
-
if (isDisabledNextDate(list[list.length - 1], type, max)) {
|
94
|
+
if (isDisabledNextDate(list[list.length - 1], type, max, includeEdgeDates)) {
|
93
95
|
disabledDate.push('next');
|
94
96
|
}
|
95
97
|
return disabledDate.join(',');
|
96
98
|
};
|
97
|
-
var isDisabledArrowLeft = function isDisabledArrowLeft(date, min) {
|
99
|
+
var isDisabledArrowLeft = function isDisabledArrowLeft(date, min, includeEdgeDates) {
|
98
100
|
var currentDate = new Date(date);
|
99
101
|
currentDate.setDate(currentDate.getDate() - 1);
|
100
|
-
|
102
|
+
var disableCondition = min && (includeEdgeDates ? min > currentDate : min >= currentDate);
|
103
|
+
return disableCondition;
|
101
104
|
};
|
102
|
-
var isDisabledArrowRight = function isDisabledArrowRight(date, max) {
|
105
|
+
var isDisabledArrowRight = function isDisabledArrowRight(date, max, includeEdgeDates) {
|
103
106
|
var currentDate = new Date(date);
|
104
107
|
currentDate.setDate(currentDate.getDate() + 1);
|
105
|
-
|
108
|
+
var disableCondition = max && (includeEdgeDates ? max < currentDate : max <= currentDate);
|
109
|
+
return disableCondition;
|
106
110
|
};
|
107
|
-
var isDisabledArrowUp = function isDisabledArrowUp(date, min) {
|
111
|
+
var isDisabledArrowUp = function isDisabledArrowUp(date, min, includeEdgeDates) {
|
108
112
|
var currentDate = new Date(date);
|
109
113
|
currentDate.setDate(date.getDate() - 7);
|
110
|
-
|
114
|
+
var disableCondition = min && (includeEdgeDates ? min > currentDate : min >= currentDate);
|
115
|
+
return disableCondition;
|
111
116
|
};
|
112
|
-
var isDisabledArrowDown = function isDisabledArrowDown(date, max) {
|
117
|
+
var isDisabledArrowDown = function isDisabledArrowDown(date, max, includeEdgeDates) {
|
113
118
|
var currentDate = new Date(date);
|
114
119
|
currentDate.setDate(date.getDate() + 7);
|
115
|
-
|
120
|
+
var disableCondition = max && (includeEdgeDates ? max < currentDate : max <= currentDate);
|
121
|
+
return disableCondition;
|
116
122
|
};
|
117
|
-
var getDisabledArrowKey = function getDisabledArrowKey(currentDate, min, max) {
|
123
|
+
var getDisabledArrowKey = function getDisabledArrowKey(currentDate, min, max, includeEdgeDates) {
|
118
124
|
var disabledArrowKey = [];
|
119
|
-
if (isDisabledArrowLeft(currentDate, min)) {
|
125
|
+
if (isDisabledArrowLeft(currentDate, min, includeEdgeDates)) {
|
120
126
|
disabledArrowKey.push('left');
|
121
127
|
}
|
122
|
-
if (isDisabledArrowRight(currentDate, max)) {
|
128
|
+
if (isDisabledArrowRight(currentDate, max, includeEdgeDates)) {
|
123
129
|
disabledArrowKey.push('right');
|
124
130
|
}
|
125
|
-
if (isDisabledArrowDown(currentDate, max)) {
|
131
|
+
if (isDisabledArrowDown(currentDate, max, includeEdgeDates)) {
|
126
132
|
disabledArrowKey.push('down');
|
127
133
|
}
|
128
|
-
if (isDisabledArrowUp(currentDate, min)) {
|
134
|
+
if (isDisabledArrowUp(currentDate, min, includeEdgeDates)) {
|
129
135
|
disabledArrowKey.push('up');
|
130
136
|
}
|
131
137
|
return disabledArrowKey.join(',');
|
@@ -154,7 +160,7 @@ var getDatesWithModifications = exports.getDatesWithModifications = function get
|
|
154
160
|
var date = _ref5.date;
|
155
161
|
return date;
|
156
162
|
});
|
157
|
-
var disabledDates = getDisabledDates(datesList, type, min, max);
|
163
|
+
var disabledDates = getDisabledDates(datesList, type, min, max, includeEdgeDates);
|
158
164
|
return dates.map(function (dateItem) {
|
159
165
|
var date = dateItem.date;
|
160
166
|
var year = date.year,
|
@@ -179,7 +185,7 @@ var getDatesWithModifications = exports.getDatesWithModifications = function get
|
|
179
185
|
dateItem.events = eventsMap.get(keyDate);
|
180
186
|
dateItem.disabled = disabledDatesMap.has(keyDate) || isOutOfMinMaxRange;
|
181
187
|
dateItem.isOutOfMinMaxRange = isOutOfMinMaxRange;
|
182
|
-
dateItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max);
|
188
|
+
dateItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max, includeEdgeDates);
|
183
189
|
dateItem.disabledDates = disabledDates;
|
184
190
|
return dateItem;
|
185
191
|
});
|
@@ -34,17 +34,13 @@ var Root = /*#__PURE__*/(0, _base["default"])("div", {
|
|
34
34
|
}, ";", function (_ref4) {
|
35
35
|
var intersectionStyles = _ref4.intersectionStyles;
|
36
36
|
return intersectionStyles;
|
37
|
-
}, ";"
|
38
|
-
var invariants = _ref5.invariants;
|
39
|
-
return invariants;
|
40
|
-
}, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy1lbW90aW9uL2VuZ2luZXMvZW1vdGlvbi50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBZUUiLCJmaWxlIjoiLi4vLi4vLi4vc3JjLWVtb3Rpb24vZW5naW5lcy9lbW90aW9uLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCwgeyBmb3J3YXJkUmVmIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsgY3NzLCBTZXJpYWxpemVkU3R5bGVzIH0gZnJvbSAnQGVtb3Rpb24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bmVudCA9IChjb21wb25lbnRDb25maWc6IENvbXBvbmVudENvbmZpZykgPT4ge1xuICAgIGNvbnN0IHsgdGFnLCBiYXNlLCBpbnRlcnNlY3Rpb25zLCBpbnZhcmlhbnRzIH0gPSBjb21wb25lbnRDb25maWc7XG4gICAgY29uc3Qgc3RhdGljVmFyaWFudHMgPSBnZXRTdGF0aWNWYXJpYW50cyhjb21wb25lbnRDb25maWcpO1xuICAgIGNvbnN0IGR5bmFtaWNWYXJpYW50cyA9IGdldER5bmFtaWNWYXJpYW50cyhjb21wb25lbnRDb25maWcpO1xuXG4gICAgLy8gVE9ETzogc2hvdWxkIHdlIHR5cGUgdGFnIGFzIG1vcmUgdGhlbiBzdHJpbmcgP1xuICAgIGNvbnN0IFIgPSBSb290LndpdGhDb21wb25lbnQodGFnIGFzIGtleW9mIEpTWC5JbnRyaW5zaWNFbGVtZW50cyk7XG5cbiAgICByZXR1cm4gZm9yd2FyZFJlZjxIVE1MRWxlbWVudCwgSFRNTEFueUF0dHJpYnV0ZXM+KChwcm9wcywgcmVmKSA9PiB7XG4gICAgICAgIGNvbnN0IGludGVyc2VjdGlvblN0eWxlcyA9IGdldEludGVyc2VjdGlvblN0eWxlcyhwcm9wcywgaW50ZXJzZWN0aW9ucyk7XG5cbiAgICAgICAgcmV0dXJuIChcbiAgICAgICAgICAgIDxSXG4gICAgICAgICAgICAgICAgYmFzZT17YmFzZX1cbiAgICAgICAgICAgICAgICBzdGF0aWNWYXJpYW50cz17c3RhdGljVmFyaWFudHN9XG4gICAgICAgICAgICAgICAgZHluYW1pY1ZhcmlhbnRzPXtkeW5hbWljVmFyaWFudHN9XG4gICAgICAgICAgICAgICAgaW50ZXJzZWN0aW9uU3R5bGVzPXtpbnRlcnNlY3Rpb25TdHlsZXN9XG4gICAgICAgICAgICAgICAgaW52YXJpYW50cz17aW52YXJpYW50c31cbiAgICAgICAgICAgICAgICB7Li4ucHJvcHN9XG4gICAgICAgICAgICAgICAgcmVmPXtyZWZ9XG4gICAgICAgICAgICAvPlxuICAgICAgICApO1xuICAgIH0pO1xufTtcbiJdfQ== */"));
|
37
|
+
}, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy1lbW90aW9uL2VuZ2luZXMvZW1vdGlvbi50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBY0UiLCJmaWxlIjoiLi4vLi4vLi4vc3JjLWVtb3Rpb24vZW5naW5lcy9lbW90aW9uLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCwgeyBmb3J3YXJkUmVmIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsgY3NzLCBTZXJpYWxpemVkU3R5bGVzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuXG5pbXBvcnQgeyBnZXRTdGF0aWNWYXJpYW50cywgZ2V0RHluYW1pY1ZhcmlhbnRzLCBnZXRJbnRlcnNlY3Rpb25TdHlsZXMgfSBmcm9tICcuL3V0aWxzJztcbmltcG9ydCB7IENvbXBvbmVudENvbmZpZywgSFRNTEFueUF0dHJpYnV0ZXMsIFBvbHltb3JwaGljQ2xhc3NOYW1lIH0gZnJvbSAnLi90eXBlcyc7XG5cbmV4cG9ydCB7IGNzcyB9O1xuXG5jb25zdCBSb290ID0gc3R5bGVkLmRpdjx7XG4gICAgYmFzZTogc3RyaW5nIHwgU2VyaWFsaXplZFN0eWxlcztcbiAgICBzdGF0aWNWYXJpYW50czogKHN0cmluZyB8IFNlcmlhbGl6ZWRTdHlsZXMpW107XG4gICAgZHluYW1pY1ZhcmlhbnRzOiAocHJvcHM6IEhUTUxBbnlBdHRyaWJ1dGVzKSA9PiBhbnlbXTtcbiAgICBpbnRlcnNlY3Rpb25TdHlsZXM6IFBvbHlt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AgPFJcbiAgICAgICAgICAgICAgICBiYXNlPXtiYXNlfVxuICAgICAgICAgICAgICAgIHN0YXRpY1ZhcmlhbnRzPXtzdGF0aWNWYXJpYW50c31cbiAgICAgICAgICAgICAgICBkeW5hbWljVmFyaWFudHM9e2R5bmFtaWNWYXJpYW50c31cbiAgICAgICAgICAgICAgICBpbnRlcnNlY3Rpb25TdHlsZXM9e2ludGVyc2VjdGlvblN0eWxlc31cbiAgICAgICAgICAgICAgICB7Li4ucHJvcHN9XG4gICAgICAgICAgICAgICAgcmVmPXtyZWZ9XG4gICAgICAgICAgICAvPlxuICAgICAgICApO1xuICAgIH0pO1xufTtcbiJdfQ== */"));
|
41
38
|
|
42
39
|
/* eslint-disable no-underscore-dangle */
|
43
40
|
var _component = exports._component = function _component(componentConfig) {
|
44
41
|
var tag = componentConfig.tag,
|
45
42
|
base = componentConfig.base,
|
46
|
-
intersections = componentConfig.intersections
|
47
|
-
invariants = componentConfig.invariants;
|
43
|
+
intersections = componentConfig.intersections;
|
48
44
|
var staticVariants = (0, _utils.getStaticVariants)(componentConfig);
|
49
45
|
var dynamicVariants = (0, _utils.getDynamicVariants)(componentConfig);
|
50
46
|
|
@@ -59,8 +55,7 @@ var _component = exports._component = function _component(componentConfig) {
|
|
59
55
|
base: base,
|
60
56
|
staticVariants: staticVariants,
|
61
57
|
dynamicVariants: dynamicVariants,
|
62
|
-
intersectionStyles: intersectionStyles
|
63
|
-
invariants: invariants
|
58
|
+
intersectionStyles: intersectionStyles
|
64
59
|
}, props, {
|
65
60
|
ref: ref
|
66
61
|
}));
|
@@ -42,7 +42,7 @@ var normalizeDate = function normalizeDate(date, type) {
|
|
42
42
|
date.setMonth(0);
|
43
43
|
}
|
44
44
|
};
|
45
|
-
var isDisabledNextDate = function isDisabledNextDate(_ref, type, max) {
|
45
|
+
var isDisabledNextDate = function isDisabledNextDate(_ref, type, max, includeEdgeDates) {
|
46
46
|
var year = _ref.year,
|
47
47
|
monthIndex = _ref.monthIndex,
|
48
48
|
day = _ref.day;
|
@@ -54,13 +54,14 @@ var isDisabledNextDate = function isDisabledNextDate(_ref, type, max) {
|
|
54
54
|
var currentDate = new Date(year, monthIndex, day);
|
55
55
|
dateOperationHandler[type].add(currentDate);
|
56
56
|
var isOut = true;
|
57
|
-
|
58
|
-
|
57
|
+
var maxDateCondition = includeEdgeDates ? currentDate < maxDate : currentDate <= maxDate;
|
58
|
+
while (isOut && maxDateCondition) {
|
59
|
+
isOut = maxDateCondition;
|
59
60
|
dateOperationHandler[type].add(currentDate);
|
60
61
|
}
|
61
62
|
return isOut;
|
62
63
|
};
|
63
|
-
var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min) {
|
64
|
+
var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min, includeEdgeDates) {
|
64
65
|
var year = _ref2.year,
|
65
66
|
monthIndex = _ref2.monthIndex,
|
66
67
|
day = _ref2.day;
|
@@ -72,54 +73,59 @@ var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min) {
|
|
72
73
|
var currentDate = new Date(year, monthIndex, day);
|
73
74
|
dateOperationHandler[type].subtract(currentDate);
|
74
75
|
var isOut = true;
|
75
|
-
|
76
|
-
|
76
|
+
var minDateCondition = includeEdgeDates ? currentDate > minDate : currentDate >= minDate;
|
77
|
+
while (isOut && minDateCondition) {
|
78
|
+
isOut = minDateCondition;
|
77
79
|
dateOperationHandler[type].subtract(currentDate);
|
78
80
|
}
|
79
81
|
return isOut;
|
80
82
|
};
|
81
|
-
var getDisabledDates = function getDisabledDates(list, type, min, max) {
|
83
|
+
var getDisabledDates = function getDisabledDates(list, type, min, max, includeEdgeDates) {
|
82
84
|
var disabledDate = [];
|
83
|
-
if (isDisabledPreviousDate(list[0], type, min)) {
|
85
|
+
if (isDisabledPreviousDate(list[0], type, min, includeEdgeDates)) {
|
84
86
|
disabledDate.push('previous');
|
85
87
|
}
|
86
|
-
if (isDisabledNextDate(list[list.length - 1], type, max)) {
|
88
|
+
if (isDisabledNextDate(list[list.length - 1], type, max, includeEdgeDates)) {
|
87
89
|
disabledDate.push('next');
|
88
90
|
}
|
89
91
|
return disabledDate.join(',');
|
90
92
|
};
|
91
|
-
var isDisabledArrowLeft = function isDisabledArrowLeft(date, min) {
|
93
|
+
var isDisabledArrowLeft = function isDisabledArrowLeft(date, min, includeEdgeDates) {
|
92
94
|
var currentDate = new Date(date);
|
93
95
|
currentDate.setDate(currentDate.getDate() - 1);
|
94
|
-
|
96
|
+
var disableCondition = min && (includeEdgeDates ? min > currentDate : min >= currentDate);
|
97
|
+
return disableCondition;
|
95
98
|
};
|
96
|
-
var isDisabledArrowRight = function isDisabledArrowRight(date, max) {
|
99
|
+
var isDisabledArrowRight = function isDisabledArrowRight(date, max, includeEdgeDates) {
|
97
100
|
var currentDate = new Date(date);
|
98
101
|
currentDate.setDate(currentDate.getDate() + 1);
|
99
|
-
|
102
|
+
var disableCondition = max && (includeEdgeDates ? max < currentDate : max <= currentDate);
|
103
|
+
return disableCondition;
|
100
104
|
};
|
101
|
-
var isDisabledArrowUp = function isDisabledArrowUp(date, min) {
|
105
|
+
var isDisabledArrowUp = function isDisabledArrowUp(date, min, includeEdgeDates) {
|
102
106
|
var currentDate = new Date(date);
|
103
107
|
currentDate.setDate(date.getDate() - 7);
|
104
|
-
|
108
|
+
var disableCondition = min && (includeEdgeDates ? min > currentDate : min >= currentDate);
|
109
|
+
return disableCondition;
|
105
110
|
};
|
106
|
-
var isDisabledArrowDown = function isDisabledArrowDown(date, max) {
|
111
|
+
var isDisabledArrowDown = function isDisabledArrowDown(date, max, includeEdgeDates) {
|
107
112
|
var currentDate = new Date(date);
|
108
113
|
currentDate.setDate(date.getDate() + 7);
|
109
|
-
|
114
|
+
var disableCondition = max && (includeEdgeDates ? max < currentDate : max <= currentDate);
|
115
|
+
return disableCondition;
|
110
116
|
};
|
111
|
-
var getDisabledArrowKey = function getDisabledArrowKey(currentDate, min, max) {
|
117
|
+
var getDisabledArrowKey = function getDisabledArrowKey(currentDate, min, max, includeEdgeDates) {
|
112
118
|
var disabledArrowKey = [];
|
113
|
-
if (isDisabledArrowLeft(currentDate, min)) {
|
119
|
+
if (isDisabledArrowLeft(currentDate, min, includeEdgeDates)) {
|
114
120
|
disabledArrowKey.push('left');
|
115
121
|
}
|
116
|
-
if (isDisabledArrowRight(currentDate, max)) {
|
122
|
+
if (isDisabledArrowRight(currentDate, max, includeEdgeDates)) {
|
117
123
|
disabledArrowKey.push('right');
|
118
124
|
}
|
119
|
-
if (isDisabledArrowDown(currentDate, max)) {
|
125
|
+
if (isDisabledArrowDown(currentDate, max, includeEdgeDates)) {
|
120
126
|
disabledArrowKey.push('down');
|
121
127
|
}
|
122
|
-
if (isDisabledArrowUp(currentDate, min)) {
|
128
|
+
if (isDisabledArrowUp(currentDate, min, includeEdgeDates)) {
|
123
129
|
disabledArrowKey.push('up');
|
124
130
|
}
|
125
131
|
return disabledArrowKey.join(',');
|
@@ -148,7 +154,7 @@ export var getDatesWithModifications = function getDatesWithModifications(_ref3)
|
|
148
154
|
var date = _ref5.date;
|
149
155
|
return date;
|
150
156
|
});
|
151
|
-
var disabledDates = getDisabledDates(datesList, type, min, max);
|
157
|
+
var disabledDates = getDisabledDates(datesList, type, min, max, includeEdgeDates);
|
152
158
|
return dates.map(function (dateItem) {
|
153
159
|
var date = dateItem.date;
|
154
160
|
var year = date.year,
|
@@ -173,7 +179,7 @@ export var getDatesWithModifications = function getDatesWithModifications(_ref3)
|
|
173
179
|
dateItem.events = eventsMap.get(keyDate);
|
174
180
|
dateItem.disabled = disabledDatesMap.has(keyDate) || isOutOfMinMaxRange;
|
175
181
|
dateItem.isOutOfMinMaxRange = isOutOfMinMaxRange;
|
176
|
-
dateItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max);
|
182
|
+
dateItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max, includeEdgeDates);
|
177
183
|
dateItem.disabledDates = disabledDates;
|
178
184
|
return dateItem;
|
179
185
|
});
|
@@ -19,17 +19,13 @@ var Root = /*#__PURE__*/_styled("div", {
|
|
19
19
|
}, ";", function (_ref4) {
|
20
20
|
var intersectionStyles = _ref4.intersectionStyles;
|
21
21
|
return intersectionStyles;
|
22
|
-
}, ";"
|
23
|
-
var invariants = _ref5.invariants;
|
24
|
-
return invariants;
|
25
|
-
}, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy1lbW90aW9uL2VuZ2luZXMvZW1vdGlvbi50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBZUUiLCJmaWxlIjoiLi4vLi4vLi4vc3JjLWVtb3Rpb24vZW5naW5lcy9lbW90aW9uLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCwgeyBmb3J3YXJkUmVmIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsgY3NzLCBTZXJpYWxpemVkU3R5bGVzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuXG5pbXBvcnQgeyBnZXRTdGF0aWNWYXJpYW50cywgZ2V0RHluYW1pY1ZhcmlhbnRzLCBnZXRJbnRlcnNlY3Rpb25TdHlsZXMgfSBmcm9tICcuL3V0aWxzJztcbmltcG9ydCB7IENvbXBvbmVudENvbmZpZywgSFRNTEFueUF0dHJpYnV0ZXMsIFBvbHltb3JwaGljQ2xhc3NOYW1lIH0gZnJvbSAnLi90eXBlcyc7XG5cbmV4cG9ydCB7IGNzcyB9O1xuXG5jb25zdCBSb290ID0gc3R5bGVkLmRpdjx7XG4gICAgYmFzZTogc3RyaW5nIHwgU2VyaWFsaXplZFN0eWxlcztcbiAgICBzdGF0aWNWYXJpYW50czogKHN0cmluZyB8IFNlcmlhbGl6ZWRTdHlsZXMpW107XG4gICAgZHluYW1pY1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gZm9yd2FyZFJlZjxIVE1MRWxlbWVudCwgSFRNTEFueUF0dHJpYnV0ZXM+KChwcm9wcywgcmVmKSA9PiB7XG4gICAgICAgIGNvbnN0IGludGVyc2VjdGlvblN0eWxlcyA9IGdldEludGVyc2VjdGlvblN0eWxlcyhwcm9wcywgaW50ZXJzZWN0aW9ucyk7XG5cbiAgICAgICAgcmV0dXJuIChcbiAgICAgICAgICAgIDxSXG4gICAgICAgICAgICAgICAgYmFzZT17YmFzZX1cbiAgICAgICAgICAgICAgICBzdGF0aWNWYXJpYW50cz17c3RhdGljVmFyaWFudHN9XG4gICAgICAgICAgICAgICAgZHluYW1pY1ZhcmlhbnRzPXtkeW5hbWljVmFyaWFudHN9XG4gICAgICAgICAgICAgICAgaW50ZXJzZWN0aW9uU3R5bGVzPXtpbnRlcnNlY3Rpb25TdHlsZXN9XG4gICAgICAgICAgICAgICAgaW52YXJpYW50cz17aW52YXJpYW50c31cbiAgICAgICAgICAgICAgICB7Li4ucHJvcHN9XG4gICAgICAgICAgICAgICAgcmVmPXtyZWZ9XG4gICAgICAgICAgICAvPlxuICAgICAgICApO1xuICAgIH0pO1xufTtcbiJdfQ== */"));
|
22
|
+
}, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy1lbW90aW9uL2VuZ2luZXMvZW1vdGlvbi50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBY0UiLCJmaWxlIjoiLi4vLi4vLi4vc3JjLWVtb3Rpb24vZW5naW5lcy9lbW90aW9uLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCwgeyBmb3J3YXJkUmVmIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsgY3NzLCBTZXJpYWxpemVkU3R5bGVzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHN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AgICBjb25zdCBzdGF0aWNWYXJpYW50cyA9IGdldFN0YXRpY1ZhcmlhbnRzKGNvbXBvbmVudENvbmZpZyk7XG4gICAgY29uc3QgZHluYW1pY1ZhcmlhbnRzID0gZ2V0RHluYW1pY1ZhcmlhbnRzKGNvbXBvbmVudENvbmZpZyk7XG5cbiAgICAvLyBUT0RPOiBzaG91bGQgd2UgdHlwZSB0YWcgYXMgbW9yZSB0aGVuIHN0cmluZyA/XG4gICAgY29uc3QgUiA9IFJvb3Qud2l0aENvbXBvbmVudCh0YWcgYXMga2V5b2YgSlNYLkludHJpbnNpY0VsZW1lbnRzKTtcblxuICAgIHJldHVybiBmb3J3YXJkUmVmPEhUTUxFbGVtZW50LCBIVE1MQW55QXR0cmlidXRlcz4oKHByb3BzLCByZWYpID0+IHtcbiAgICAgICAgY29uc3QgaW50ZXJzZWN0aW9uU3R5bGVzID0gZ2V0SW50ZXJzZWN0aW9uU3R5bGVzKHByb3BzLCBpbnRlcnNlY3Rpb25zKTtcblxuICAgICAgICByZXR1cm4gKFxuICAgICAgICAgICAgPFJcbiAgICAgICAgICAgICAgICBiYXNlPXtiYXNlfVxuICAgICAgICAgICAgICAgIHN0YXRpY1ZhcmlhbnRzPXtzdGF0aWNWYXJpYW50c31cbiAgICAgICAgICAgICAgICBkeW5hbWljVmFyaWFudHM9e2R5bmFtaWNWYXJpYW50c31cbiAgICAgICAgICAgICAgICBpbnRlcnNlY3Rpb25TdHlsZXM9e2ludGVyc2VjdGlvblN0eWxlc31cbiAgICAgICAgICAgICAgICB7Li4ucHJvcHN9XG4gICAgICAgICAgICAgICAgcmVmPXtyZWZ9XG4gICAgICAgICAgICAvPlxuICAgICAgICApO1xuICAgIH0pO1xufTtcbiJdfQ== */"));
|
26
23
|
|
27
24
|
/* eslint-disable no-underscore-dangle */
|
28
25
|
export var _component = function _component(componentConfig) {
|
29
26
|
var tag = componentConfig.tag,
|
30
27
|
base = componentConfig.base,
|
31
|
-
intersections = componentConfig.intersections
|
32
|
-
invariants = componentConfig.invariants;
|
28
|
+
intersections = componentConfig.intersections;
|
33
29
|
var staticVariants = getStaticVariants(componentConfig);
|
34
30
|
var dynamicVariants = getDynamicVariants(componentConfig);
|
35
31
|
|
@@ -44,8 +40,7 @@ export var _component = function _component(componentConfig) {
|
|
44
40
|
base: base,
|
45
41
|
staticVariants: staticVariants,
|
46
42
|
dynamicVariants: dynamicVariants,
|
47
|
-
intersectionStyles: intersectionStyles
|
48
|
-
invariants: invariants
|
43
|
+
intersectionStyles: intersectionStyles
|
49
44
|
}, props, {
|
50
45
|
ref: ref
|
51
46
|
}));
|
@@ -43,7 +43,7 @@ var normalizeDate = function normalizeDate(date, type) {
|
|
43
43
|
date.setMonth(0);
|
44
44
|
}
|
45
45
|
};
|
46
|
-
var isDisabledNextDate = function isDisabledNextDate(_ref, type, max) {
|
46
|
+
var isDisabledNextDate = function isDisabledNextDate(_ref, type, max, includeEdgeDates) {
|
47
47
|
var year = _ref.year,
|
48
48
|
monthIndex = _ref.monthIndex,
|
49
49
|
day = _ref.day;
|
@@ -55,13 +55,14 @@ var isDisabledNextDate = function isDisabledNextDate(_ref, type, max) {
|
|
55
55
|
var currentDate = new Date(year, monthIndex, day);
|
56
56
|
dateOperationHandler[type].add(currentDate);
|
57
57
|
var isOut = true;
|
58
|
-
|
59
|
-
|
58
|
+
var maxDateCondition = includeEdgeDates ? currentDate < maxDate : currentDate <= maxDate;
|
59
|
+
while (isOut && maxDateCondition) {
|
60
|
+
isOut = maxDateCondition;
|
60
61
|
dateOperationHandler[type].add(currentDate);
|
61
62
|
}
|
62
63
|
return isOut;
|
63
64
|
};
|
64
|
-
var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min) {
|
65
|
+
var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min, includeEdgeDates) {
|
65
66
|
var year = _ref2.year,
|
66
67
|
monthIndex = _ref2.monthIndex,
|
67
68
|
day = _ref2.day;
|
@@ -73,54 +74,59 @@ var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min) {
|
|
73
74
|
var currentDate = new Date(year, monthIndex, day);
|
74
75
|
dateOperationHandler[type].subtract(currentDate);
|
75
76
|
var isOut = true;
|
76
|
-
|
77
|
-
|
77
|
+
var minDateCondition = includeEdgeDates ? currentDate > minDate : currentDate >= minDate;
|
78
|
+
while (isOut && minDateCondition) {
|
79
|
+
isOut = minDateCondition;
|
78
80
|
dateOperationHandler[type].subtract(currentDate);
|
79
81
|
}
|
80
82
|
return isOut;
|
81
83
|
};
|
82
|
-
var getDisabledDates = function getDisabledDates(list, type, min, max) {
|
84
|
+
var getDisabledDates = function getDisabledDates(list, type, min, max, includeEdgeDates) {
|
83
85
|
var disabledDate = [];
|
84
|
-
if (isDisabledPreviousDate(list[0], type, min)) {
|
86
|
+
if (isDisabledPreviousDate(list[0], type, min, includeEdgeDates)) {
|
85
87
|
disabledDate.push('previous');
|
86
88
|
}
|
87
|
-
if (isDisabledNextDate(list[list.length - 1], type, max)) {
|
89
|
+
if (isDisabledNextDate(list[list.length - 1], type, max, includeEdgeDates)) {
|
88
90
|
disabledDate.push('next');
|
89
91
|
}
|
90
92
|
return disabledDate.join(',');
|
91
93
|
};
|
92
|
-
var isDisabledArrowLeft = function isDisabledArrowLeft(date, min) {
|
94
|
+
var isDisabledArrowLeft = function isDisabledArrowLeft(date, min, includeEdgeDates) {
|
93
95
|
var currentDate = new Date(date);
|
94
96
|
currentDate.setDate(currentDate.getDate() - 1);
|
95
|
-
|
97
|
+
var disableCondition = min && (includeEdgeDates ? min > currentDate : min >= currentDate);
|
98
|
+
return disableCondition;
|
96
99
|
};
|
97
|
-
var isDisabledArrowRight = function isDisabledArrowRight(date, max) {
|
100
|
+
var isDisabledArrowRight = function isDisabledArrowRight(date, max, includeEdgeDates) {
|
98
101
|
var currentDate = new Date(date);
|
99
102
|
currentDate.setDate(currentDate.getDate() + 1);
|
100
|
-
|
103
|
+
var disableCondition = max && (includeEdgeDates ? max < currentDate : max <= currentDate);
|
104
|
+
return disableCondition;
|
101
105
|
};
|
102
|
-
var isDisabledArrowUp = function isDisabledArrowUp(date, min) {
|
106
|
+
var isDisabledArrowUp = function isDisabledArrowUp(date, min, includeEdgeDates) {
|
103
107
|
var currentDate = new Date(date);
|
104
108
|
currentDate.setDate(date.getDate() - 7);
|
105
|
-
|
109
|
+
var disableCondition = min && (includeEdgeDates ? min > currentDate : min >= currentDate);
|
110
|
+
return disableCondition;
|
106
111
|
};
|
107
|
-
var isDisabledArrowDown = function isDisabledArrowDown(date, max) {
|
112
|
+
var isDisabledArrowDown = function isDisabledArrowDown(date, max, includeEdgeDates) {
|
108
113
|
var currentDate = new Date(date);
|
109
114
|
currentDate.setDate(date.getDate() + 7);
|
110
|
-
|
115
|
+
var disableCondition = max && (includeEdgeDates ? max < currentDate : max <= currentDate);
|
116
|
+
return disableCondition;
|
111
117
|
};
|
112
|
-
var getDisabledArrowKey = function getDisabledArrowKey(currentDate, min, max) {
|
118
|
+
var getDisabledArrowKey = function getDisabledArrowKey(currentDate, min, max, includeEdgeDates) {
|
113
119
|
var disabledArrowKey = [];
|
114
|
-
if (isDisabledArrowLeft(currentDate, min)) {
|
120
|
+
if (isDisabledArrowLeft(currentDate, min, includeEdgeDates)) {
|
115
121
|
disabledArrowKey.push('left');
|
116
122
|
}
|
117
|
-
if (isDisabledArrowRight(currentDate, max)) {
|
123
|
+
if (isDisabledArrowRight(currentDate, max, includeEdgeDates)) {
|
118
124
|
disabledArrowKey.push('right');
|
119
125
|
}
|
120
|
-
if (isDisabledArrowDown(currentDate, max)) {
|
126
|
+
if (isDisabledArrowDown(currentDate, max, includeEdgeDates)) {
|
121
127
|
disabledArrowKey.push('down');
|
122
128
|
}
|
123
|
-
if (isDisabledArrowUp(currentDate, min)) {
|
129
|
+
if (isDisabledArrowUp(currentDate, min, includeEdgeDates)) {
|
124
130
|
disabledArrowKey.push('up');
|
125
131
|
}
|
126
132
|
return disabledArrowKey.join(',');
|
@@ -149,7 +155,7 @@ var getDatesWithModifications = function getDatesWithModifications(_ref3) {
|
|
149
155
|
var date = _ref5.date;
|
150
156
|
return date;
|
151
157
|
});
|
152
|
-
var disabledDates = getDisabledDates(datesList, type, min, max);
|
158
|
+
var disabledDates = getDisabledDates(datesList, type, min, max, includeEdgeDates);
|
153
159
|
return dates.map(function (dateItem) {
|
154
160
|
var date = dateItem.date;
|
155
161
|
var year = date.year,
|
@@ -174,7 +180,7 @@ var getDatesWithModifications = function getDatesWithModifications(_ref3) {
|
|
174
180
|
dateItem.events = eventsMap.get(keyDate);
|
175
181
|
dateItem.disabled = disabledDatesMap.has(keyDate) || isOutOfMinMaxRange;
|
176
182
|
dateItem.isOutOfMinMaxRange = isOutOfMinMaxRange;
|
177
|
-
dateItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max);
|
183
|
+
dateItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max, includeEdgeDates);
|
178
184
|
dateItem.disabledDates = disabledDates;
|
179
185
|
return dateItem;
|
180
186
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getDateWithModification.js","sources":["../../../../src/components/Calendar/utils/getDateWithModification.ts"],"sourcesContent":["import type { DateItem, DateObject, DisabledDay, EventDay } from '../Calendar.types';\nimport { CalendarState, CalendarStateType } from '../store/types';\n\nimport { getPropsMap } from './calendarGridHelper';\n\ntype GetDatesWithModificationsArgs = {\n dates: DateItem[];\n type: CalendarStateType;\n eventList?: EventDay[];\n disabledList?: DisabledDay[];\n includeEdgeDates?: boolean;\n min?: Date;\n max?: Date;\n};\n\ntype DateOperationHandler = {\n [k in CalendarStateType]: {\n [t in 'add' | 'subtract']: (date: Date) => number;\n };\n};\n\nconst dateOperationHandler: DateOperationHandler = {\n Days: {\n add: (date: Date) => date.setDate(date.getDate() + 1),\n subtract: (date: Date) => date.setDate(date.getDate() - 1),\n },\n Months: {\n add: (date: Date) => date.setMonth(date.getMonth() + 1),\n subtract: (date: Date) => date.setMonth(date.getMonth() - 1),\n },\n Quarters: {\n add: (date: Date) => date.setMonth(date.getMonth() + 3),\n subtract: (date: Date) => date.setMonth(date.getMonth() - 3),\n },\n Years: {\n add: (date: Date) => date.setFullYear(date.getFullYear() + 1),\n subtract: (date: Date) => date.setFullYear(date.getFullYear() - 1),\n },\n};\n\nconst normalizeDate = (date: Date, type: CalendarStateType) => {\n if (type === CalendarState.Months || type === CalendarState.Years) {\n date.setDate(1);\n }\n\n if (type === CalendarState.Years) {\n date.setMonth(0);\n }\n};\n\nconst isDisabledNextDate = ({ year, monthIndex, day }: DateObject, type: CalendarStateType, max?: Date) => {\n if (!max) {\n return false;\n }\n\n const maxDate = new Date(max);\n\n normalizeDate(maxDate, type);\n\n const currentDate = new Date(year, monthIndex, day);\n dateOperationHandler[type].add(currentDate);\n\n let isOut = true;\n\n while (isOut && currentDate <= maxDate) {\n isOut = maxDate <= currentDate;\n\n dateOperationHandler[type].add(currentDate);\n }\n\n return isOut;\n};\n\nconst isDisabledPreviousDate = ({ year, monthIndex, day }: DateObject, type: CalendarStateType, min?: Date) => {\n if (!min) {\n return false;\n }\n\n const minDate = new Date(min);\n\n normalizeDate(minDate, type);\n\n const currentDate = new Date(year, monthIndex, day);\n dateOperationHandler[type].subtract(currentDate);\n\n let isOut = true;\n\n while (isOut && currentDate >= minDate) {\n isOut = minDate >= currentDate;\n\n dateOperationHandler[type].subtract(currentDate);\n }\n\n return isOut;\n};\n\nconst getDisabledDates = (list: DateObject[], type: CalendarStateType, min?: Date, max?: Date) => {\n const disabledDate: string[] = [];\n\n if (isDisabledPreviousDate(list[0], type, min)) {\n disabledDate.push('previous');\n }\n\n if (isDisabledNextDate(list[list.length - 1], type, max)) {\n disabledDate.push('next');\n }\n\n return disabledDate.join(',');\n};\n\nconst isDisabledArrowLeft = (date: Date, min?: Date) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(currentDate.getDate() - 1);\n\n return (min && min >= currentDate) || (min && min >= date);\n};\n\nconst isDisabledArrowRight = (date: Date, max?: Date) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(currentDate.getDate() + 1);\n\n return (max && max <= currentDate) || (max && max <= date);\n};\n\nconst isDisabledArrowUp = (date: Date, min?: Date) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(date.getDate() - 7);\n\n return min && min >= currentDate;\n};\n\nconst isDisabledArrowDown = (date: Date, max?: Date) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(date.getDate() + 7);\n\n return max && max <= currentDate;\n};\n\nconst getDisabledArrowKey = (currentDate: Date, min?: Date, max?: Date) => {\n const disabledArrowKey: string[] = [];\n\n if (isDisabledArrowLeft(currentDate, min)) {\n disabledArrowKey.push('left');\n }\n\n if (isDisabledArrowRight(currentDate, max)) {\n disabledArrowKey.push('right');\n }\n\n if (isDisabledArrowDown(currentDate, max)) {\n disabledArrowKey.push('down');\n }\n\n if (isDisabledArrowUp(currentDate, min)) {\n disabledArrowKey.push('up');\n }\n\n return disabledArrowKey.join(',');\n};\n\n/**\n * Метод модифицирующий дату (добавляющий свойства events и disabled).\n */\nexport const getDatesWithModifications = ({\n dates,\n type,\n eventList = [],\n disabledList = [],\n includeEdgeDates,\n min,\n max,\n}: GetDatesWithModificationsArgs) => {\n const eventsMap = getPropsMap(eventList);\n const disabledDatesMap = getPropsMap(disabledList);\n\n const filteredDates =\n type === CalendarState.Days ? dates.filter(({ isDayInCurrentMonth }) => isDayInCurrentMonth) : dates;\n const datesList = filteredDates.map(({ date }) => date);\n\n const disabledDates = getDisabledDates(datesList, type, min, max);\n\n return dates.map((dateItem) => {\n const { date } = dateItem;\n const { year, monthIndex, day } = date;\n\n const keyDate = `${year}-${monthIndex}-${day}`;\n const currentDate = new Date(year, monthIndex, day);\n\n const minDate = min && new Date(min);\n minDate && normalizeDate(minDate, type);\n\n const maxDate = max && new Date(max);\n maxDate && normalizeDate(maxDate, type);\n\n let minValue: boolean | undefined;\n let maxValue: boolean | undefined;\n\n if (type === CalendarState.Days) {\n minValue = min && (includeEdgeDates ? min > currentDate : min >= currentDate);\n maxValue = max && (includeEdgeDates ? max < currentDate : max <= currentDate);\n } else {\n minValue = minDate && minDate > currentDate;\n maxValue = maxDate && maxDate < currentDate;\n }\n\n const isOutOfMinMaxRange = minValue || maxValue;\n\n dateItem.events = eventsMap.get(keyDate);\n dateItem.disabled = disabledDatesMap.has(keyDate) || isOutOfMinMaxRange;\n\n dateItem.isOutOfMinMaxRange = isOutOfMinMaxRange;\n dateItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max);\n dateItem.disabledDates = disabledDates;\n\n return dateItem;\n });\n};\n"],"names":["dateOperationHandler","Days","add","date","setDate","getDate","subtract","Months","setMonth","getMonth","Quarters","Years","setFullYear","getFullYear","normalizeDate","type","CalendarState","isDisabledNextDate","_ref","max","year","monthIndex","day","maxDate","Date","currentDate","isOut","isDisabledPreviousDate","_ref2","min","minDate","getDisabledDates","list","disabledDate","push","length","join","isDisabledArrowLeft","isDisabledArrowRight","isDisabledArrowUp","isDisabledArrowDown","getDisabledArrowKey","disabledArrowKey","getDatesWithModifications","_ref3","dates","_ref3$eventList","eventList","_ref3$disabledList","disabledList","includeEdgeDates","eventsMap","getPropsMap","disabledDatesMap","filteredDates","filter","_ref4","isDayInCurrentMonth","datesList","map","_ref5","disabledDates","dateItem","keyDate","concat","minValue","maxValue","isOutOfMinMaxRange","events","get","disabled","has"],"mappings":";;;AAqBA,IAAMA,oBAA0C,GAAG;AAC/CC,EAAAA,IAAI,EAAE;IACFC,GAAG,EAAE,SAAAA,GAAAA,CAACC,IAAU,EAAA;MAAA,OAAKA,IAAI,CAACC,OAAO,CAACD,IAAI,CAACE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;AAAA,KAAA;IACrDC,QAAQ,EAAE,SAAAA,QAAAA,CAACH,IAAU,EAAA;MAAA,OAAKA,IAAI,CAACC,OAAO,CAACD,IAAI,CAACE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;AAAA,KAAA;GAC7D;AACDE,EAAAA,MAAM,EAAE;IACJL,G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AC,IAAII,kBAAkB,CAAA;IAEvEL,QAAQ,CAACK,kBAAkB,GAAGA,kBAAkB,CAAA;IAChDL,QAAQ,CAACpB,gBAAgB,GAAGD,mBAAmB,CAAChB,WAAW,EAAEI,GAAG,EAAEV,GAAG,CAAC,CAAA;IACtE2C,QAAQ,CAACD,aAAa,GAAGA,aAAa,CAAA;AAEtC,IAAA,OAAOC,QAAQ,CAAA;AACnB,GAAC,CAAC,CAAA;AACN;;;;"}
|
1
|
+
{"version":3,"file":"getDateWithModification.js","sources":["../../../../src/components/Calendar/utils/getDateWithModification.ts"],"sourcesContent":["import type { DateItem, DateObject, DisabledDay, EventDay } from '../Calendar.types';\nimport { CalendarState, CalendarStateType } from '../store/types';\n\nimport { getPropsMap } from './calendarGridHelper';\n\ntype GetDatesWithModificationsArgs = {\n dates: DateItem[];\n type: CalendarStateType;\n eventList?: EventDay[];\n disabledList?: DisabledDay[];\n includeEdgeDates?: boolean;\n min?: Date;\n max?: Date;\n};\n\ntype DateOperationHandler = {\n [k in CalendarStateType]: {\n [t in 'add' | 'subtract']: (date: Date) => number;\n };\n};\n\nconst dateOperationHandler: DateOperationHandler = {\n Days: {\n add: (date: Date) => date.setDate(date.getDate() + 1),\n subtract: (date: Date) => date.setDate(date.getDate() - 1),\n },\n Months: {\n add: (date: Date) => date.setMonth(date.getMonth() + 1),\n subtract: (date: Date) => date.setMonth(date.getMonth() - 1),\n },\n Quarters: {\n add: (date: Date) => date.setMonth(date.getMonth() + 3),\n subtract: (date: Date) => date.setMonth(date.getMonth() - 3),\n },\n Years: {\n add: (date: Date) => date.setFullYear(date.getFullYear() + 1),\n subtract: (date: Date) => date.setFullYear(date.getFullYear() - 1),\n },\n};\n\nconst normalizeDate = (date: Date, type: CalendarStateType) => {\n if (type === CalendarState.Months || type === CalendarState.Years) {\n date.setDate(1);\n }\n\n if (type === CalendarState.Years) {\n date.setMonth(0);\n }\n};\n\nconst isDisabledNextDate = (\n { year, monthIndex, day }: DateObject,\n type: CalendarStateType,\n max?: Date,\n includeEdgeDates?: boolean,\n) => {\n if (!max) {\n return false;\n }\n\n const maxDate = new Date(max);\n\n normalizeDate(maxDate, type);\n\n const currentDate = new Date(year, monthIndex, day);\n dateOperationHandler[type].add(currentDate);\n\n let isOut = true;\n const maxDateCondition = includeEdgeDates ? currentDate < maxDate : currentDate <= maxDate;\n\n while (isOut && maxDateCondition) {\n isOut = maxDateCondition;\n\n dateOperationHandler[type].add(currentDate);\n }\n\n return isOut;\n};\n\nconst isDisabledPreviousDate = (\n { year, monthIndex, day }: DateObject,\n type: CalendarStateType,\n min?: Date,\n includeEdgeDates?: boolean,\n) => {\n if (!min) {\n return false;\n }\n\n const minDate = new Date(min);\n\n normalizeDate(minDate, type);\n\n const currentDate = new Date(year, monthIndex, day);\n dateOperationHandler[type].subtract(currentDate);\n\n let isOut = true;\n const minDateCondition = includeEdgeDates ? currentDate > minDate : currentDate >= minDate;\n\n while (isOut && minDateCondition) {\n isOut = minDateCondition;\n\n dateOperationHandler[type].subtract(currentDate);\n }\n\n return isOut;\n};\n\nconst getDisabledDates = (\n list: DateObject[],\n type: CalendarStateType,\n min?: Date,\n max?: Date,\n includeEdgeDates?: boolean,\n) => {\n const disabledDate: string[] = [];\n\n if (isDisabledPreviousDate(list[0], type, min, includeEdgeDates)) {\n disabledDate.push('previous');\n }\n\n if (isDisabledNextDate(list[list.length - 1], type, max, includeEdgeDates)) {\n disabledDate.push('next');\n }\n\n return disabledDate.join(',');\n};\n\nconst isDisabledArrowLeft = (date: Date, min?: Date, includeEdgeDates?: boolean) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(currentDate.getDate() - 1);\n\n const disableCondition = min && (includeEdgeDates ? min > currentDate : min >= currentDate);\n\n return disableCondition;\n};\n\nconst isDisabledArrowRight = (date: Date, max?: Date, includeEdgeDates?: boolean) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(currentDate.getDate() + 1);\n\n const disableCondition = max && (includeEdgeDates ? max < currentDate : max <= currentDate);\n\n return disableCondition;\n};\n\nconst isDisabledArrowUp = (date: Date, min?: Date, includeEdgeDates?: boolean) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(date.getDate() - 7);\n\n const disableCondition = min && (includeEdgeDates ? min > currentDate : min >= currentDate);\n\n return disableCondition;\n};\n\nconst isDisabledArrowDown = (date: Date, max?: Date, includeEdgeDates?: boolean) => {\n const currentDate = new Date(date);\n\n currentDate.setDate(date.getDate() + 7);\n\n const disableCondition = max && (includeEdgeDates ? max < currentDate : max <= currentDate);\n\n return disableCondition;\n};\n\nconst getDisabledArrowKey = (currentDate: Date, min?: Date, max?: Date, includeEdgeDates?: boolean) => {\n const disabledArrowKey: string[] = [];\n\n if (isDisabledArrowLeft(currentDate, min, includeEdgeDates)) {\n disabledArrowKey.push('left');\n }\n\n if (isDisabledArrowRight(currentDate, max, includeEdgeDates)) {\n disabledArrowKey.push('right');\n }\n\n if (isDisabledArrowDown(currentDate, max, includeEdgeDates)) {\n disabledArrowKey.push('down');\n }\n\n if (isDisabledArrowUp(currentDate, min, includeEdgeDates)) {\n disabledArrowKey.push('up');\n }\n\n return disabledArrowKey.join(',');\n};\n\n/**\n * Метод модифицирующий дату (добавляющий свойства events и disabled).\n */\nexport const getDatesWithModifications = ({\n dates,\n type,\n eventList = [],\n disabledList = [],\n includeEdgeDates,\n min,\n max,\n}: GetDatesWithModificationsArgs) => {\n const eventsMap = getPropsMap(eventList);\n const disabledDatesMap = getPropsMap(disabledList);\n\n const filteredDates =\n type === CalendarState.Days ? dates.filter(({ isDayInCurrentMonth }) => isDayInCurrentMonth) : dates;\n const datesList = filteredDates.map(({ date }) => date);\n\n const disabledDates = getDisabledDates(datesList, type, min, max, includeEdgeDates);\n\n return dates.map((dateItem) => {\n const { date } = dateItem;\n const { year, monthIndex, day } = date;\n\n const keyDate = `${year}-${monthIndex}-${day}`;\n const currentDate = new Date(year, monthIndex, day);\n\n const minDate = min && new Date(min);\n minDate && normalizeDate(minDate, type);\n\n const maxDate = max && new Date(max);\n maxDate && normalizeDate(maxDate, type);\n\n let minValue: boolean | undefined;\n let maxValue: boolean | undefined;\n\n if (type === CalendarState.Days) {\n minValue = min && (includeEdgeDates ? min > currentDate : min >= currentDate);\n maxValue = max && (includeEdgeDates ? max < currentDate : max <= currentDate);\n } else {\n minValue = minDate && minDate > currentDate;\n maxValue = maxDate && maxDate < currentDate;\n }\n\n const isOutOfMinMaxRange = minValue || maxValue;\n\n dateItem.events = eventsMap.get(keyDate);\n dateItem.disabled = disabledDatesMap.has(keyDate) || isOutOfMinMaxRange;\n\n dateItem.isOutOfMinMaxRange = isOutOfMinMaxRange;\n dateItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max, includeEdgeDates);\n dateItem.disabledDates = disabledDates;\n\n return dateItem;\n });\n};\n"],"names":["dateOperationHandler","Days","add","date","setDate","getDate","subtract","Months","setMonth","getMonth","Quarters","Years","setFullYear","getFullYear","normalizeDate","type","CalendarState","isDisabledNextDate","_ref","max","includeEdgeDates","year","monthIndex","day","maxDate","Date","currentDate","isOut","maxDateCondition","isDisabledPreviousDate","_ref2","min","minDate","minDateCondition","getDisabledDates","list","disabledDate","push","length","join","isDisabledArrowLeft","disableCondition","isDisabledArrowRight","isDisabledArrowUp","isDisabledArrowDown","getDisabledArrowKey","disabledArrowKey","getDatesWithModifications","_ref3","dates","_ref3$eventList","eventList","_ref3$disabledList","disabledList","eventsMap","getPropsMap","disabledDatesMap","filteredDates","filter","_ref4","isDayInCurrentMonth","datesList","map","_ref5","disabledDates","dateItem","keyDate","concat","minValue","maxValue","isOutOfMinMaxRange","events","get","disabled","has"],"mappings":";;;AAqBA,IAAMA,oBAA0C,GAAG;AAC/CC,EAAAA,IAAI,EAAE;IACFC,GAAG,EAAE,SAAAA,GAAAA,CAACC,IAAU,EAAA;MAAA,OAAKA,IAAI,CAACC,OAAO,CAACD,IAAI,CAACE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;AAAA,KAAA;IACrDC,QAAQ,EAAE,SAAAA,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{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.324.0-canary.
|
3
|
+
"version": "0.324.0-canary.1984.15135602558.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -137,5 +137,5 @@
|
|
137
137
|
"sideEffects": [
|
138
138
|
"*.css"
|
139
139
|
],
|
140
|
-
"gitHead": "
|
140
|
+
"gitHead": "06b84e72e39b254bae813211840524997b8b0d39"
|
141
141
|
}
|
@@ -48,7 +48,7 @@ var normalizeDate = function normalizeDate(date, type) {
|
|
48
48
|
date.setMonth(0);
|
49
49
|
}
|
50
50
|
};
|
51
|
-
var isDisabledNextDate = function isDisabledNextDate(_ref, type, max) {
|
51
|
+
var isDisabledNextDate = function isDisabledNextDate(_ref, type, max, includeEdgeDates) {
|
52
52
|
var year = _ref.year,
|
53
53
|
monthIndex = _ref.monthIndex,
|
54
54
|
day = _ref.day;
|
@@ -60,13 +60,14 @@ var isDisabledNextDate = function isDisabledNextDate(_ref, type, max) {
|
|
60
60
|
var currentDate = new Date(year, monthIndex, day);
|
61
61
|
dateOperationHandler[type].add(currentDate);
|
62
62
|
var isOut = true;
|
63
|
-
|
64
|
-
|
63
|
+
var maxDateCondition = includeEdgeDates ? currentDate < maxDate : currentDate <= maxDate;
|
64
|
+
while (isOut && maxDateCondition) {
|
65
|
+
isOut = maxDateCondition;
|
65
66
|
dateOperationHandler[type].add(currentDate);
|
66
67
|
}
|
67
68
|
return isOut;
|
68
69
|
};
|
69
|
-
var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min) {
|
70
|
+
var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min, includeEdgeDates) {
|
70
71
|
var year = _ref2.year,
|
71
72
|
monthIndex = _ref2.monthIndex,
|
72
73
|
day = _ref2.day;
|
@@ -78,54 +79,59 @@ var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min) {
|
|
78
79
|
var currentDate = new Date(year, monthIndex, day);
|
79
80
|
dateOperationHandler[type].subtract(currentDate);
|
80
81
|
var isOut = true;
|
81
|
-
|
82
|
-
|
82
|
+
var minDateCondition = includeEdgeDates ? currentDate > minDate : currentDate >= minDate;
|
83
|
+
while (isOut && minDateCondition) {
|
84
|
+
isOut = minDateCondition;
|
83
85
|
dateOperationHandler[type].subtract(currentDate);
|
84
86
|
}
|
85
87
|
return isOut;
|
86
88
|
};
|
87
|
-
var getDisabledDates = function getDisabledDates(list, type, min, max) {
|
89
|
+
var getDisabledDates = function getDisabledDates(list, type, min, max, includeEdgeDates) {
|
88
90
|
var disabledDate = [];
|
89
|
-
if (isDisabledPreviousDate(list[0], type, min)) {
|
91
|
+
if (isDisabledPreviousDate(list[0], type, min, includeEdgeDates)) {
|
90
92
|
disabledDate.push('previous');
|
91
93
|
}
|
92
|
-
if (isDisabledNextDate(list[list.length - 1], type, max)) {
|
94
|
+
if (isDisabledNextDate(list[list.length - 1], type, max, includeEdgeDates)) {
|
93
95
|
disabledDate.push('next');
|
94
96
|
}
|
95
97
|
return disabledDate.join(',');
|
96
98
|
};
|
97
|
-
var isDisabledArrowLeft = function isDisabledArrowLeft(date, min) {
|
99
|
+
var isDisabledArrowLeft = function isDisabledArrowLeft(date, min, includeEdgeDates) {
|
98
100
|
var currentDate = new Date(date);
|
99
101
|
currentDate.setDate(currentDate.getDate() - 1);
|
100
|
-
|
102
|
+
var disableCondition = min && (includeEdgeDates ? min > currentDate : min >= currentDate);
|
103
|
+
return disableCondition;
|
101
104
|
};
|
102
|
-
var isDisabledArrowRight = function isDisabledArrowRight(date, max) {
|
105
|
+
var isDisabledArrowRight = function isDisabledArrowRight(date, max, includeEdgeDates) {
|
103
106
|
var currentDate = new Date(date);
|
104
107
|
currentDate.setDate(currentDate.getDate() + 1);
|
105
|
-
|
108
|
+
var disableCondition = max && (includeEdgeDates ? max < currentDate : max <= currentDate);
|
109
|
+
return disableCondition;
|
106
110
|
};
|
107
|
-
var isDisabledArrowUp = function isDisabledArrowUp(date, min) {
|
111
|
+
var isDisabledArrowUp = function isDisabledArrowUp(date, min, includeEdgeDates) {
|
108
112
|
var currentDate = new Date(date);
|
109
113
|
currentDate.setDate(date.getDate() - 7);
|
110
|
-
|
114
|
+
var disableCondition = min && (includeEdgeDates ? min > currentDate : min >= currentDate);
|
115
|
+
return disableCondition;
|
111
116
|
};
|
112
|
-
var isDisabledArrowDown = function isDisabledArrowDown(date, max) {
|
117
|
+
var isDisabledArrowDown = function isDisabledArrowDown(date, max, includeEdgeDates) {
|
113
118
|
var currentDate = new Date(date);
|
114
119
|
currentDate.setDate(date.getDate() + 7);
|
115
|
-
|
120
|
+
var disableCondition = max && (includeEdgeDates ? max < currentDate : max <= currentDate);
|
121
|
+
return disableCondition;
|
116
122
|
};
|
117
|
-
var getDisabledArrowKey = function getDisabledArrowKey(currentDate, min, max) {
|
123
|
+
var getDisabledArrowKey = function getDisabledArrowKey(currentDate, min, max, includeEdgeDates) {
|
118
124
|
var disabledArrowKey = [];
|
119
|
-
if (isDisabledArrowLeft(currentDate, min)) {
|
125
|
+
if (isDisabledArrowLeft(currentDate, min, includeEdgeDates)) {
|
120
126
|
disabledArrowKey.push('left');
|
121
127
|
}
|
122
|
-
if (isDisabledArrowRight(currentDate, max)) {
|
128
|
+
if (isDisabledArrowRight(currentDate, max, includeEdgeDates)) {
|
123
129
|
disabledArrowKey.push('right');
|
124
130
|
}
|
125
|
-
if (isDisabledArrowDown(currentDate, max)) {
|
131
|
+
if (isDisabledArrowDown(currentDate, max, includeEdgeDates)) {
|
126
132
|
disabledArrowKey.push('down');
|
127
133
|
}
|
128
|
-
if (isDisabledArrowUp(currentDate, min)) {
|
134
|
+
if (isDisabledArrowUp(currentDate, min, includeEdgeDates)) {
|
129
135
|
disabledArrowKey.push('up');
|
130
136
|
}
|
131
137
|
return disabledArrowKey.join(',');
|
@@ -154,7 +160,7 @@ var getDatesWithModifications = exports.getDatesWithModifications = function get
|
|
154
160
|
var date = _ref5.date;
|
155
161
|
return date;
|
156
162
|
});
|
157
|
-
var disabledDates = getDisabledDates(datesList, type, min, max);
|
163
|
+
var disabledDates = getDisabledDates(datesList, type, min, max, includeEdgeDates);
|
158
164
|
return dates.map(function (dateItem) {
|
159
165
|
var date = dateItem.date;
|
160
166
|
var year = date.year,
|
@@ -179,7 +185,7 @@ var getDatesWithModifications = exports.getDatesWithModifications = function get
|
|
179
185
|
dateItem.events = eventsMap.get(keyDate);
|
180
186
|
dateItem.disabled = disabledDatesMap.has(keyDate) || isOutOfMinMaxRange;
|
181
187
|
dateItem.isOutOfMinMaxRange = isOutOfMinMaxRange;
|
182
|
-
dateItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max);
|
188
|
+
dateItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max, includeEdgeDates);
|
183
189
|
dateItem.disabledDates = disabledDates;
|
184
190
|
return dateItem;
|
185
191
|
});
|
@@ -25,7 +25,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
25
25
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
26
26
|
var Root = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
27
27
|
componentId: "plasma-new-hope__sc-1xug4g9-0"
|
28
|
-
})(["", ";", ";", ";", ";"
|
28
|
+
})(["", ";", ";", ";", ";"], function (_ref) {
|
29
29
|
var base = _ref.base;
|
30
30
|
return base;
|
31
31
|
}, function (_ref2) {
|
@@ -37,17 +37,13 @@ var Root = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
37
37
|
}, function (_ref4) {
|
38
38
|
var intersectionStyles = _ref4.intersectionStyles;
|
39
39
|
return intersectionStyles;
|
40
|
-
}, function (_ref5) {
|
41
|
-
var invariants = _ref5.invariants;
|
42
|
-
return invariants;
|
43
40
|
});
|
44
41
|
|
45
42
|
/* eslint-disable no-underscore-dangle */
|
46
43
|
var _component = exports._component = function _component(componentConfig) {
|
47
44
|
var tag = componentConfig.tag,
|
48
45
|
base = componentConfig.base,
|
49
|
-
intersections = componentConfig.intersections
|
50
|
-
invariants = componentConfig.invariants;
|
46
|
+
intersections = componentConfig.intersections;
|
51
47
|
var staticVariants = (0, _utils.getStaticVariants)(componentConfig);
|
52
48
|
var dynamicVariants = (0, _utils.getDynamicVariants)(componentConfig);
|
53
49
|
return /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
@@ -57,8 +53,7 @@ var _component = exports._component = function _component(componentConfig) {
|
|
57
53
|
base: base,
|
58
54
|
staticVariants: staticVariants,
|
59
55
|
dynamicVariants: dynamicVariants,
|
60
|
-
intersectionStyles: intersectionStyles
|
61
|
-
invariants: invariants
|
56
|
+
intersectionStyles: intersectionStyles
|
62
57
|
}, props, {
|
63
58
|
ref: ref
|
64
59
|
}));
|
@@ -42,7 +42,7 @@ var normalizeDate = function normalizeDate(date, type) {
|
|
42
42
|
date.setMonth(0);
|
43
43
|
}
|
44
44
|
};
|
45
|
-
var isDisabledNextDate = function isDisabledNextDate(_ref, type, max) {
|
45
|
+
var isDisabledNextDate = function isDisabledNextDate(_ref, type, max, includeEdgeDates) {
|
46
46
|
var year = _ref.year,
|
47
47
|
monthIndex = _ref.monthIndex,
|
48
48
|
day = _ref.day;
|
@@ -54,13 +54,14 @@ var isDisabledNextDate = function isDisabledNextDate(_ref, type, max) {
|
|
54
54
|
var currentDate = new Date(year, monthIndex, day);
|
55
55
|
dateOperationHandler[type].add(currentDate);
|
56
56
|
var isOut = true;
|
57
|
-
|
58
|
-
|
57
|
+
var maxDateCondition = includeEdgeDates ? currentDate < maxDate : currentDate <= maxDate;
|
58
|
+
while (isOut && maxDateCondition) {
|
59
|
+
isOut = maxDateCondition;
|
59
60
|
dateOperationHandler[type].add(currentDate);
|
60
61
|
}
|
61
62
|
return isOut;
|
62
63
|
};
|
63
|
-
var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min) {
|
64
|
+
var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min, includeEdgeDates) {
|
64
65
|
var year = _ref2.year,
|
65
66
|
monthIndex = _ref2.monthIndex,
|
66
67
|
day = _ref2.day;
|
@@ -72,54 +73,59 @@ var isDisabledPreviousDate = function isDisabledPreviousDate(_ref2, type, min) {
|
|
72
73
|
var currentDate = new Date(year, monthIndex, day);
|
73
74
|
dateOperationHandler[type].subtract(currentDate);
|
74
75
|
var isOut = true;
|
75
|
-
|
76
|
-
|
76
|
+
var minDateCondition = includeEdgeDates ? currentDate > minDate : currentDate >= minDate;
|
77
|
+
while (isOut && minDateCondition) {
|
78
|
+
isOut = minDateCondition;
|
77
79
|
dateOperationHandler[type].subtract(currentDate);
|
78
80
|
}
|
79
81
|
return isOut;
|
80
82
|
};
|
81
|
-
var getDisabledDates = function getDisabledDates(list, type, min, max) {
|
83
|
+
var getDisabledDates = function getDisabledDates(list, type, min, max, includeEdgeDates) {
|
82
84
|
var disabledDate = [];
|
83
|
-
if (isDisabledPreviousDate(list[0], type, min)) {
|
85
|
+
if (isDisabledPreviousDate(list[0], type, min, includeEdgeDates)) {
|
84
86
|
disabledDate.push('previous');
|
85
87
|
}
|
86
|
-
if (isDisabledNextDate(list[list.length - 1], type, max)) {
|
88
|
+
if (isDisabledNextDate(list[list.length - 1], type, max, includeEdgeDates)) {
|
87
89
|
disabledDate.push('next');
|
88
90
|
}
|
89
91
|
return disabledDate.join(',');
|
90
92
|
};
|
91
|
-
var isDisabledArrowLeft = function isDisabledArrowLeft(date, min) {
|
93
|
+
var isDisabledArrowLeft = function isDisabledArrowLeft(date, min, includeEdgeDates) {
|
92
94
|
var currentDate = new Date(date);
|
93
95
|
currentDate.setDate(currentDate.getDate() - 1);
|
94
|
-
|
96
|
+
var disableCondition = min && (includeEdgeDates ? min > currentDate : min >= currentDate);
|
97
|
+
return disableCondition;
|
95
98
|
};
|
96
|
-
var isDisabledArrowRight = function isDisabledArrowRight(date, max) {
|
99
|
+
var isDisabledArrowRight = function isDisabledArrowRight(date, max, includeEdgeDates) {
|
97
100
|
var currentDate = new Date(date);
|
98
101
|
currentDate.setDate(currentDate.getDate() + 1);
|
99
|
-
|
102
|
+
var disableCondition = max && (includeEdgeDates ? max < currentDate : max <= currentDate);
|
103
|
+
return disableCondition;
|
100
104
|
};
|
101
|
-
var isDisabledArrowUp = function isDisabledArrowUp(date, min) {
|
105
|
+
var isDisabledArrowUp = function isDisabledArrowUp(date, min, includeEdgeDates) {
|
102
106
|
var currentDate = new Date(date);
|
103
107
|
currentDate.setDate(date.getDate() - 7);
|
104
|
-
|
108
|
+
var disableCondition = min && (includeEdgeDates ? min > currentDate : min >= currentDate);
|
109
|
+
return disableCondition;
|
105
110
|
};
|
106
|
-
var isDisabledArrowDown = function isDisabledArrowDown(date, max) {
|
111
|
+
var isDisabledArrowDown = function isDisabledArrowDown(date, max, includeEdgeDates) {
|
107
112
|
var currentDate = new Date(date);
|
108
113
|
currentDate.setDate(date.getDate() + 7);
|
109
|
-
|
114
|
+
var disableCondition = max && (includeEdgeDates ? max < currentDate : max <= currentDate);
|
115
|
+
return disableCondition;
|
110
116
|
};
|
111
|
-
var getDisabledArrowKey = function getDisabledArrowKey(currentDate, min, max) {
|
117
|
+
var getDisabledArrowKey = function getDisabledArrowKey(currentDate, min, max, includeEdgeDates) {
|
112
118
|
var disabledArrowKey = [];
|
113
|
-
if (isDisabledArrowLeft(currentDate, min)) {
|
119
|
+
if (isDisabledArrowLeft(currentDate, min, includeEdgeDates)) {
|
114
120
|
disabledArrowKey.push('left');
|
115
121
|
}
|
116
|
-
if (isDisabledArrowRight(currentDate, max)) {
|
122
|
+
if (isDisabledArrowRight(currentDate, max, includeEdgeDates)) {
|
117
123
|
disabledArrowKey.push('right');
|
118
124
|
}
|
119
|
-
if (isDisabledArrowDown(currentDate, max)) {
|
125
|
+
if (isDisabledArrowDown(currentDate, max, includeEdgeDates)) {
|
120
126
|
disabledArrowKey.push('down');
|
121
127
|
}
|
122
|
-
if (isDisabledArrowUp(currentDate, min)) {
|
128
|
+
if (isDisabledArrowUp(currentDate, min, includeEdgeDates)) {
|
123
129
|
disabledArrowKey.push('up');
|
124
130
|
}
|
125
131
|
return disabledArrowKey.join(',');
|
@@ -148,7 +154,7 @@ export var getDatesWithModifications = function getDatesWithModifications(_ref3)
|
|
148
154
|
var date = _ref5.date;
|
149
155
|
return date;
|
150
156
|
});
|
151
|
-
var disabledDates = getDisabledDates(datesList, type, min, max);
|
157
|
+
var disabledDates = getDisabledDates(datesList, type, min, max, includeEdgeDates);
|
152
158
|
return dates.map(function (dateItem) {
|
153
159
|
var date = dateItem.date;
|
154
160
|
var year = date.year,
|
@@ -173,7 +179,7 @@ export var getDatesWithModifications = function getDatesWithModifications(_ref3)
|
|
173
179
|
dateItem.events = eventsMap.get(keyDate);
|
174
180
|
dateItem.disabled = disabledDatesMap.has(keyDate) || isOutOfMinMaxRange;
|
175
181
|
dateItem.isOutOfMinMaxRange = isOutOfMinMaxRange;
|
176
|
-
dateItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max);
|
182
|
+
dateItem.disabledArrowKey = getDisabledArrowKey(currentDate, min, max, includeEdgeDates);
|
177
183
|
dateItem.disabledDates = disabledDates;
|
178
184
|
return dateItem;
|
179
185
|
});
|
@@ -5,7 +5,7 @@ import { getStaticVariants, getDynamicVariants, getIntersectionStyles } from "./
|
|
5
5
|
export { styled, css };
|
6
6
|
var Root = /*#__PURE__*/styled.div.withConfig({
|
7
7
|
componentId: "plasma-new-hope__sc-1xug4g9-0"
|
8
|
-
})(["", ";", ";", ";", ";"
|
8
|
+
})(["", ";", ";", ";", ";"], function (_ref) {
|
9
9
|
var base = _ref.base;
|
10
10
|
return base;
|
11
11
|
}, function (_ref2) {
|
@@ -17,17 +17,13 @@ var Root = /*#__PURE__*/styled.div.withConfig({
|
|
17
17
|
}, function (_ref4) {
|
18
18
|
var intersectionStyles = _ref4.intersectionStyles;
|
19
19
|
return intersectionStyles;
|
20
|
-
}, function (_ref5) {
|
21
|
-
var invariants = _ref5.invariants;
|
22
|
-
return invariants;
|
23
20
|
});
|
24
21
|
|
25
22
|
/* eslint-disable no-underscore-dangle */
|
26
23
|
export var _component = function _component(componentConfig) {
|
27
24
|
var tag = componentConfig.tag,
|
28
25
|
base = componentConfig.base,
|
29
|
-
intersections = componentConfig.intersections
|
30
|
-
invariants = componentConfig.invariants;
|
26
|
+
intersections = componentConfig.intersections;
|
31
27
|
var staticVariants = getStaticVariants(componentConfig);
|
32
28
|
var dynamicVariants = getDynamicVariants(componentConfig);
|
33
29
|
return /*#__PURE__*/forwardRef(function (props, ref) {
|
@@ -37,8 +33,7 @@ export var _component = function _component(componentConfig) {
|
|
37
33
|
base: base,
|
38
34
|
staticVariants: staticVariants,
|
39
35
|
dynamicVariants: dynamicVariants,
|
40
|
-
intersectionStyles: intersectionStyles
|
41
|
-
invariants: invariants
|
36
|
+
intersectionStyles: intersectionStyles
|
42
37
|
}, props, {
|
43
38
|
ref: ref
|
44
39
|
}));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getDateWithModification.d.ts","sourceRoot":"","sources":["../../../../src/components/Calendar/utils/getDateWithModification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAc,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAiB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIlE,aAAK,6BAA6B,GAAG;IACjC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,IAAI,EAAE,iBAAiB,CAAC;IACxB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;CACd,CAAC;
|
1
|
+
{"version":3,"file":"getDateWithModification.d.ts","sourceRoot":"","sources":["../../../../src/components/Calendar/utils/getDateWithModification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAc,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAiB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIlE,aAAK,6BAA6B,GAAG;IACjC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,IAAI,EAAE,iBAAiB,CAAC;IACxB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;CACd,CAAC;AAiLF;;GAEG;AACH,eAAO,MAAM,yBAAyB,0EAQnC,6BAA6B,eA6C/B,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"emotion.d.ts","sourceRoot":"","sources":["../../src/engines/emotion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAoB,MAAM,gBAAgB,CAAC;AAIvD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAwB,MAAM,SAAS,CAAC;AAEnF,OAAO,EAAE,GAAG,EAAE,CAAC;
|
1
|
+
{"version":3,"file":"emotion.d.ts","sourceRoot":"","sources":["../../src/engines/emotion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAoB,MAAM,gBAAgB,CAAC;AAIvD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAwB,MAAM,SAAS,CAAC;AAEnF,OAAO,EAAE,GAAG,EAAE,CAAC;AAef,eAAO,MAAM,UAAU,oBAAqB,eAAe,uGAsB1D,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"styled-components.d.ts","sourceRoot":"","sources":["../../src/engines/styled-components.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAElE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;
|
1
|
+
{"version":3,"file":"styled-components.d.ts","sourceRoot":"","sources":["../../src/engines/styled-components.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAElE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAevB,eAAO,MAAM,UAAU,oBAAqB,eAAe,uGAoB1D,CAAC"}
|