"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * 实体日历视图
 *
 * @class IBizCalendarViewController
 * @extends {IBizMDViewController}
 */
var IBizCalendarViewController = /** @class */ (function (_super) {
    __extends(IBizCalendarViewController, _super);
    /**
     * Creates an instance of IBizCalendarViewController.
     * 创建 IBizCalendarViewController 实例
     *
     * @param {*} [opts={}]
     * @memberof IBizCalendarViewController
     */
    function IBizCalendarViewController(opts) {
        if (opts === void 0) { opts = {}; }
        return _super.call(this, opts) || this;
    }
    /**
     * 部件初始化
     *
     * @memberof IBizCalendarViewController
     */
    IBizCalendarViewController.prototype.onInitComponents = function () {
        var _this = this;
        _super.prototype.onInitComponents.call(this);
        var calender = this.getMDCtrl();
        if (calender) {
            // 双击行数据
            calender.on(IBizCalendar.ROWDBLCLICK).subscribe(function (args) {
                _this.onSelectionChange(args);
                _this.onDataActivated(args[0]);
            });
            calender.on(IBizCalendar.ROWDBLCLICKNEWDATA).subscribe(function (args) {
                _this.onNewData(args[0]);
            });
        }
    };
    /**
     * 新建功能
     *
     * @param {*} [arg={}]
     * @returns {void}
     * @memberof IBizCalendarViewController
     */
    IBizCalendarViewController.prototype.onNewData = function (arg) {
        if (arg === void 0) { arg = {}; }
        var loadParam = {};
        Object.assign(loadParam, arg);
        if (this.getViewParam()) {
            Object.assign(loadParam, this.getViewParam());
        }
        if (this.getParentMode()) {
            Object.assign(loadParam, this.getParentMode());
        }
        if (this.getParentData()) {
            Object.assign(loadParam, this.getParentData());
        }
        if (this.isEnableRowEdit() && (this.getMDCtrl() && this.getMDCtrl().getOpenEdit())) {
            this.doNewRow(loadParam);
            return;
        }
        if (this.isEnableBatchAdd()) {
            this.doNewDataBatch(loadParam);
            return;
        }
        if (this.doNewDataWizard(loadParam)) {
            return;
        }
        Object.assign(loadParam, { openerid: this.getId(), pviewusage: this.getViewUsage() });
        this.doNewDataNormal(loadParam);
    };
    /**
     * 获取多项数据控件对象
     *
     * @returns {*}
     * @memberof IBizCalendarViewController
     */
    IBizCalendarViewController.prototype.getMDCtrl = function () {
        return this.getCanender();
    };
    /**
     * 获取表格部件对象
     *
     * @returns {*}
     * @memberof IBizCalendarViewController
     */
    IBizCalendarViewController.prototype.getCanender = function () {
        return this.getControl('calendar');
    };
    return IBizCalendarViewController;
}(IBizMDViewController));
