CSR-886: more cleanup
This commit is contained in:
parent
d7f406b2ba
commit
a585627110
1 changed files with 7 additions and 40 deletions
|
|
@ -84,32 +84,6 @@ export default {
|
||||||
selectableDatesData: [], // NOTE: uses monthNum (1-based), NOT monthIndex (0-based)
|
selectableDatesData: [], // NOTE: uses monthNum (1-based), NOT monthIndex (0-based)
|
||||||
today: null,
|
today: null,
|
||||||
hideSomeDaysForInitialView: null,
|
hideSomeDaysForInitialView: null,
|
||||||
|
|
||||||
// TO BE MADE "CONSTANTS"
|
|
||||||
monthsBeforeToLoadOffset: 36,
|
|
||||||
monthsAfterToLoadOffset: 12,
|
|
||||||
initialViewRowsToShow: 5,
|
|
||||||
|
|
||||||
// TBD OR REMOVED
|
|
||||||
hasPartialMonthInitialView: true,
|
|
||||||
hasSplitInitialView: true,
|
|
||||||
initialViewIncludesFullSecondMonth: false,
|
|
||||||
initialViewRowsTally: 0,
|
|
||||||
isAddingNewMonth: false,
|
|
||||||
currentScrollTop: 0,
|
|
||||||
lastApiCallStartDate: null,
|
|
||||||
lastApiCallEndDate: null,
|
|
||||||
newToday: {
|
|
||||||
dateObj: null,
|
|
||||||
dateNum: null,
|
|
||||||
dayIndex: null,
|
|
||||||
yearNum: null,
|
|
||||||
monthIndex: null,
|
|
||||||
monthEndDateNum: null,
|
|
||||||
},
|
|
||||||
initialViewStartDateNum: null,
|
|
||||||
initialViewEndDateNum: null,
|
|
||||||
daysLeftOver: null,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
|
@ -228,14 +202,9 @@ export default {
|
||||||
|
|
||||||
let todayMonthIndex = todayDate.getMonth() + 1;
|
let todayMonthIndex = todayDate.getMonth() + 1;
|
||||||
let todayYearNum = todayDate.getFullYear();
|
let todayYearNum = todayDate.getFullYear();
|
||||||
let todayDayIndex = todayDate.getDay();
|
|
||||||
let todayDateNum = todayDate.getDate();
|
|
||||||
let currentMonthStart = new Date(todayYearNum, todayMonthIndex - 1, 1);
|
let currentMonthStart = new Date(todayYearNum, todayMonthIndex - 1, 1);
|
||||||
let currentMonthEnd = new Date(todayYearNum, todayMonthIndex, 0);
|
let currentMonthEnd = new Date(todayYearNum, todayMonthIndex, 0);
|
||||||
|
|
||||||
let currentWeekStartDate = this.getWeekStartDate(todayDate);
|
|
||||||
let currentWeekEndDateNum = this.getWeekEndDate(todayDate);
|
|
||||||
|
|
||||||
let calendarViewDirection = "none";
|
let calendarViewDirection = "none";
|
||||||
if (config.selectableDatesSetting === "past") calendarViewDirection = "past";
|
if (config.selectableDatesSetting === "past") calendarViewDirection = "past";
|
||||||
if (config.selectableDatesSetting === "custom") calendarViewDirection = "future";
|
if (config.selectableDatesSetting === "custom") calendarViewDirection = "future";
|
||||||
|
|
@ -245,15 +214,14 @@ export default {
|
||||||
config.initialViewRowsToShow
|
config.initialViewRowsToShow
|
||||||
);
|
);
|
||||||
|
|
||||||
let initialViewStartDate = todayDate; // <<<<<<<<<<<<<
|
let initialViewStartDate = todayDate;
|
||||||
let initialViewEndDate = initialViewWeeks[initialViewWeeks.length - 1].weekEndDate;
|
let initialViewEndDate = initialViewWeeks[initialViewWeeks.length - 1].weekEndDate;
|
||||||
let secondMonthEnd;
|
let saturday1month = initialViewWeeks[0].weekEndDate.getMonth();
|
||||||
let saturday1month = initialViewWeeks[0].weekEndDate.getMonth(); // <<<<<<<<<<<<<
|
|
||||||
let sunday5month =
|
let sunday5month =
|
||||||
initialViewWeeks[initialViewWeeks.length - 1].weekStartDate.getMonth(); // <<<<<<<<<<<<<
|
initialViewWeeks[initialViewWeeks.length - 1].weekStartDate.getMonth();
|
||||||
|
|
||||||
let hideSomeDaysForInitialView = false; // <<<<<<<<<<<<<
|
let hideSomeDaysForInitialView = false;
|
||||||
let hideSecondMonth = false; // <<<<<<<<<<<<<
|
let hideSecondMonth = false;
|
||||||
|
|
||||||
// TODO - NEED TO CREATE OPPOSITE LOGIC FOR "past" DIRECTION LIKE BELOW vvvvv
|
// TODO - NEED TO CREATE OPPOSITE LOGIC FOR "past" DIRECTION LIKE BELOW vvvvv
|
||||||
if (calendarViewDirection === "future") {
|
if (calendarViewDirection === "future") {
|
||||||
|
|
@ -293,8 +261,8 @@ export default {
|
||||||
initializeComponent(initialData) {
|
initializeComponent(initialData) {
|
||||||
this.setCalendarData(initialData);
|
this.setCalendarData(initialData);
|
||||||
},
|
},
|
||||||
|
|
||||||
scrollToElement(elementId, speed, easing) {
|
scrollToElement(elementId, speed, easing) {
|
||||||
|
// TODO - needs to be cleaned up & refactored
|
||||||
function scrollTopSmooth(wrapper, target, duration = 300, timingName = "linear") {
|
function scrollTopSmooth(wrapper, target, duration = 300, timingName = "linear") {
|
||||||
const initY = wrapper.scrollTop;
|
const initY = wrapper.scrollTop;
|
||||||
const wrapperRect = wrapper.getBoundingClientRect();
|
const wrapperRect = wrapper.getBoundingClientRect();
|
||||||
|
|
@ -365,7 +333,7 @@ export default {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO - IF A CALENDAR WITH BOTH PAST AND FUTURE WAS EVER NEEDED
|
// TODO - IF A CALENDAR WITH BOTH PAST AND FUTURE WAS EVER NEEDED
|
||||||
// for (let i = this.monthsAfterToLoadOffset; i >= this.monthsBeforeToLoadOffset; i--) {
|
// for (let i = monthsAfterToLoadOffset; i >= monthsBeforeToLoadOffset; i--) {
|
||||||
// months.push(this.getMonthDataPAST(i));
|
// months.push(this.getMonthDataPAST(i));
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
@ -541,7 +509,6 @@ export default {
|
||||||
monthToShow.dates[monthToShow.dates.length - 1].inputValue.dateString
|
monthToShow.dates[monthToShow.dates.length - 1].inputValue.dateString
|
||||||
);
|
);
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
// this.hasSplitInitialView = false; // if was partial view, this removes hidden styling on days
|
|
||||||
this.hideSomeDaysForInitialView = false; // if hid days on initial partial view, this removes hidden styling on days
|
this.hideSomeDaysForInitialView = false; // if hid days on initial partial view, this removes hidden styling on days
|
||||||
monthToShow.monthClass = monthToShow.monthClass.replace(" month-hidden", "");
|
monthToShow.monthClass = monthToShow.monthClass.replace(" month-hidden", "");
|
||||||
this.scrollToElement(monthToShow.monthString);
|
this.scrollToElement(monthToShow.monthString);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue