Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getGridLeftAndWidth: function(days, narrowWeekend, startDayOfWeek, workweek) {
var limitDaysToApplyNarrowWeekend = 5;
var uniformWidth = 100 / days;
var wideWidth = days > limitDaysToApplyNarrowWeekend ? 100 / (days - 1) : uniformWidth;
var accumulatedWidth = 0;
var dates = util.range(startDayOfWeek, 7).concat(util.range(days)).slice(0, 7);
if (workweek) {
dates = util.filter(dates, function(day) {
return !datetime.isWeekend(day);
});
}
narrowWeekend = workweek ? false : narrowWeekend;
return util.map(dates, function(day) {
var model;
var width = narrowWeekend ? wideWidth : uniformWidth;
if (days > limitDaysToApplyNarrowWeekend && narrowWeekend && datetime.isWeekend(day)) {
width = wideWidth / 2;
}
function _createRepeatString(str, count) {
return util.range(0, count).map(() => str).join('');
}
const newRows = util.range(startRowIndex, startRowIndex + expandCount).map(rowIndex => (
util.range(0, cellCount).map(colIndex => tableDataHandler.createBasicCell(rowIndex, colIndex))
));
_expandRow(tableData, expandCount) {
const startRowIndex = tableData.length;
const cellCount = tableData[0].length;
const newRows = util.range(startRowIndex, startRowIndex + expandCount).map(rowIndex => (
util.range(0, cellCount).map(colIndex => tableDataHandler.createBasicCell(rowIndex, colIndex))
));
tableData.push(...newRows);
}
tableData.forEach(rowData => {
util.range(startColIndex, endColIndex + 1).forEach(colIndex => {
const cellData = rowData [colIndex];
if (util.isExisty(cellData.colMergeWith)) {
const merger = rowData [cellData.colMergeWith];
if (merger.colspan) {
merger.colspan -= 1;
}
} else if (cellData.colspan > 1) {
const lastMergedCellIndex = colIndex + cellData.colspan - 1;
cellData.colspan -= (endColIndex - colIndex + 1);
if (lastMergedCellIndex > endColIndex) {
rowData [endColIndex + 1] = util.extend({}, cellData);
}
_expandCoumn(tableData, expandCount) {
const startCellIndex = tableData[0].length;
const additionalCellRange = util.range(startCellIndex, startCellIndex + expandCount);
tableData.forEach((rowData, rowIndex) => {
const [{nodeName}] = rowData;
const newCells = additionalCellRange.map(colIndex => (
tableDataHandler.createBasicCell(rowIndex, colIndex, nodeName)
));
rowData.push(...newCells);
});
}
_getRanges(tickCount, firstPosition, tickInterval) {
let prev = firstPosition;
const halfInterval = tickInterval / 2;
return snippet.range(0, tickCount).map(() => {
const limit = {
min: prev - halfInterval,
max: prev + halfInterval
};
prev += tickInterval;
return limit;
});
}
calendar = this._getMonthCalendar(opt.renderMonth),
scheduleFilter = opt.scheduleFilter,
theme = controller ? controller.theme : null,
styles = this._getStyles(theme),
grids,
daynameViewModel,
baseViewModel;
grids = this.grids = datetime.getGridLeftAndWidth(
opt.daynames.length,
opt.narrowWeekend,
opt.startDayOfWeek
);
daynameViewModel = util.map(
util.range(opt.startDayOfWeek, 7).concat(util.range(7)).slice(0, 7),
function(day, index) {
return {
day: day,
label: daynames[day],
width: grids[index] ? grids[index].width : 0,
left: grids[index] ? grids[index].left : 0,
color: this._getDayNameColor(theme, day)
};
},
this
);
if (workweek) {
grids = this.grids = datetime.getGridLeftAndWidth(5, opt.narrowWeekend, opt.startDayOfWeek, workweek);
daynameViewModel = util.filter(daynameViewModel, function(daynameModel) {