How to use the tui-code-snippet.range function in tui-code-snippet

To help you get started, weโ€™ve selected a few tui-code-snippet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nhn / tui.calendar / src / js / common / datetime.js View on Github external
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;
            }
github nhn / tui.editor / src / js / extensions / table / toMarkRenderer.js View on Github external
function _createRepeatString(str, count) {
  return util.range(0, count).map(() => str).join('');
}
github nhn / tui.editor / src / js / extensions / table / wwMergedTableManager.js View on Github external
const newRows = util.range(startRowIndex, startRowIndex + expandCount).map(rowIndex => (
      util.range(0, cellCount).map(colIndex => tableDataHandler.createBasicCell(rowIndex, colIndex))
    ));
github nhn / tui.editor / src / js / extensions / table / wwMergedTableManager.js View on Github external
_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);
  }
github nhn / tui.editor / src / js / extensions / table / mergedTableRemoveCol.js View on Github external
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);
        }
github nhn / tui.editor / src / js / extensions / table / wwMergedTableManager.js View on Github external
_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);
    });
  }
github nhn / tui.chart / src / js / components / mouseEventDetectors / tickBaseCoordinateModel.js View on Github external
_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;
        });
    }
github nhn / tui.calendar / src / js / view / month / month.js View on Github external
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) {