How to use the tui-code-snippet.pick 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 / view / month / weekdayInMonth.js View on Github external
WeekdayInMonth.prototype._getRenderLimitIndex = function(panelHeight) {
    var opt = this.options;
    var containerHeight = panelHeight || this.getViewBound().height;
    var gridHeaderHeight = util.pick(opt, 'grid', 'header', 'height') || 0;
    var gridFooterHeight = util.pick(opt, 'grid', 'footer', 'height') || 0;
    var visibleScheduleCount = opt.visibleScheduleCount || 0;
    var count;

    containerHeight -= (gridHeaderHeight + gridFooterHeight);

    count = mfloor(containerHeight / (opt.scheduleHeight + opt.scheduleGutter));

    if (!visibleScheduleCount) {
        visibleScheduleCount = count;
    }

    return mmin(count, visibleScheduleCount); // subtraction for '+n' label block
};
github nhn / tui.calendar / src / js / view / week / week.js View on Github external
this.children.each(function(childView) {
        var matrices;
        var viewName = util.pick(childView.options, 'viewName');
        childView.render(viewModel);

        if (viewName) {
            matrices = viewModel.schedulesInDateRange[viewName]; // DayGrid limits schedule count by visibleScheduleCount after rendering it.

            if (util.isArray(matrices)) {
                self._invokeAfterRenderSchedule(matrices);
            } else {
                util.forEach(matrices, function(matricesOfDay) {
                    self._invokeAfterRenderSchedule(matricesOfDay);
                });
            }
        }
    });
github nhn / tui.chart / src / js / charts / lineAreaComboChart.js View on Github external
onResetZoom() {
        let rawData = this.dataProcessor.getOriginalRawData();

        if (this._dynamicDataHelper.checkedLegends) {
            rawData = rawDataHandler.filterCheckedRawData(rawData, this._dynamicDataHelper.checkedLegends);
        }

        this.dataProcessor.initData(rawData);
        this.dataProcessor.initZoomedRawData();
        this.dataProcessor.addDataFromRemainDynamicData(snippet.pick(this.options.series, 'shifting'));
        this._renderForZoom(true);
        this._dynamicDataHelper.restartAnimation();
    }
}
github nhn / tui.calendar / src / js / common / common.js View on Github external
lastIn2dArray: function(arr2d) {
        var lastRow = arr2d.length - 1,
            lastCol = arr2d[lastRow].length - 1;

        return util.pick(arr2d, lastRow, lastCol);
    },
github nhn / tui.calendar / src / js / common / common.js View on Github external
then: function(fn) {
                var args;

                if (!result) {
                    return undefined;    //eslint-disable-line
                }

                args = aps.call(arguments, 1);

                if (util.isString(fn)) {
                    return (util.pick(result, fn) || function() {}).apply(result, args);
                }

                return fn.call(result, result);
            }
        };
github nhn / tui.calendar / src / js / view / week / timeGrid.js View on Github external
TimeGrid.prototype._getBaseViewModel = function(viewModel) {
    var grids = viewModel.grids;
    var range = viewModel.range;
    var opt = this.options;
    var baseViewModel = this._getHourmarkerViewModel(new TZDate().toLocalTime(), grids, range);
    var timezonesCollapsed = util.pick(viewModel, 'state', 'timezonesCollapsed');
    var styles = this._getStyles(viewModel.theme, timezonesCollapsed);

    return util.extend(baseViewModel, {
        timezones: this._getTimezoneViewModel(baseViewModel.todaymarkerLeft, timezonesCollapsed, styles),
        hoursLabels: getHoursLabels(opt, baseViewModel.todaymarkerLeft >= 0, 0, styles),
        styles: styles,
        showTimezoneCollapseButton: util.pick(opt, 'showTimezoneCollapseButton'),
        timezonesCollapsed: timezonesCollapsed
    });
};
github nhn / tui.calendar / src / js / handler / daygrid / resize.js View on Github external
}

    target = domutil.closest(target, config.classname('.weekday'));

    if (!target) {
        return false;
    }

    cssClass = domutil.getClass(target);
    matches = cssClass.match(config.daygrid.getViewIDRegExp);

    if (!matches || matches.length < 2) {
        return false;
    }

    return util.pick(this.view.children.items, matches[1]);
};
github nhn / tui.calendar / src / js / handler / month / core.js View on Github external
function getDate(mouseEvent) {
        var pos = domevent.getMousePosition(mouseEvent, relativeContainer),
            x = getX(common.ratio(size[0], 100, pos[0])),
            y = mfloor(common.ratio(size[1], weekCount, pos[1])),
            weekdayView, date;

        weekdayView = util.pick(weeks, y);

        if (!weekdayView) {
            return null;
        }

        date = util.pick(weekdayView.getRenderDateRange(), x);

        if (!date) {
            return null;
        }

        return {
            x: x,
            y: y,
            sizeX: dayCount,
            sizeY: weekCount,
            date: date,
            weekdayView: weekdayView,
            triggerEvent: mouseEvent.type
        };
    }
github nhn / tui.chart / src / js / models / data / dataProcessorBase.js View on Github external
_findFormatFunctions() {
        const format = snippet.pick(this.options, 'chart', 'format');
        let funcs = [];

        if (snippet.isFunction(format)) {
            funcs = [format];
        } else if (snippet.isString(format)) {
            funcs = this._findSimpleTypeFormatFunctions(format);
        }

        return funcs;
    }
github nhn / tui.grid / src / js / model / renderer.js View on Github external
_triggerEditingStateChanged: function(rowKey, columnName) {
        var cellData = this.getCellData(rowKey, columnName);

        if (snippet.pick(cellData, 'columnModel', 'editOptions', 'useViewMode') !== false &&
            cellData.convertedHTML === null) {
            this.trigger('editingStateChanged', cellData);
        }
    },