/**
 * DevExtreme (cjs/ui/gantt/ui.gantt.templates.js)
 * Version: 23.2.9 (build 24294-0112)
 * Build date: Sun Oct 20 2024
 *
 * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
exports.GanttTemplatesManager = void 0;
var _renderer = _interopRequireDefault(require("../../core/renderer"));
var _element = require("../../core/element");

function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    }
}
let GanttTemplatesManager = function() {
    function GanttTemplatesManager(gantt) {
        this._gantt = gantt
    }
    var _proto = GanttTemplatesManager.prototype;
    _proto.getTaskTooltipContentTemplateFunc = function(taskTooltipContentTemplateOption) {
        const template = taskTooltipContentTemplateOption && this._gantt._getTemplate(taskTooltipContentTemplateOption);
        const createTemplateFunction = template && ((container, item, callback) => {
            template.render({
                model: this._gantt.getTaskDataByCoreData(item),
                container: (0, _element.getPublicElement)((0, _renderer.default)(container)),
                onRendered: () => {
                    callback()
                }
            });
            return true
        });
        return createTemplateFunction
    };
    _proto.getTaskProgressTooltipContentTemplateFunc = function(taskTooltipContentTemplateOption) {
        const template = taskTooltipContentTemplateOption && this._gantt._getTemplate(taskTooltipContentTemplateOption);
        const createTemplateFunction = template && ((container, item, callback) => {
            template.render({
                model: item,
                container: (0, _element.getPublicElement)((0, _renderer.default)(container)),
                onRendered: () => {
                    callback()
                }
            });
            return true
        });
        return createTemplateFunction
    };
    _proto.getTaskTimeTooltipContentTemplateFunc = function(taskTooltipContentTemplateOption) {
        const template = taskTooltipContentTemplateOption && this._gantt._getTemplate(taskTooltipContentTemplateOption);
        const createTemplateFunction = template && ((container, item, callback) => {
            template.render({
                model: item,
                container: (0, _element.getPublicElement)((0, _renderer.default)(container)),
                onRendered: () => {
                    callback()
                }
            });
            return true
        });
        return createTemplateFunction
    };
    _proto.getTaskContentTemplateFunc = function(taskContentTemplateOption) {
        const template = taskContentTemplateOption && this._gantt._getTemplate(taskContentTemplateOption);
        const createTemplateFunction = template && ((container, item, callback, index) => {
            item.taskData = this._gantt.getTaskDataByCoreData(item.taskData);
            template.render({
                model: item,
                container: (0, _element.getPublicElement)((0, _renderer.default)(container)),
                onRendered: () => {
                    callback(container, index)
                }
            });
            return true
        });
        return createTemplateFunction
    };
    return GanttTemplatesManager
}();
exports.GanttTemplatesManager = GanttTemplatesManager;
