/**
 * @fileoverview added by tsickle
 * Generated from: business-component/chart/gauge/base-gauge/base-gauge.component.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { BaseGaugeService } from './base-gauge.service';
import { initOpts } from '../../config/initOpts';
import { fromEvent } from "rxjs";
import { debounceTime } from "rxjs/operators";
import { ChartResizeService } from '../../service/chart-resize.service';
import * as color from '../../config/colors';
import * as backgroundColor from '../../config/backgroundColor';
var BaseGaugeComponent = /** @class */ (function () {
    function BaseGaugeComponent(baseGaugeService, chartResizeService) {
        this.baseGaugeService = baseGaugeService;
        this.chartResizeService = chartResizeService;
        this.echartOption = this.baseGaugeService.getDefaultOption();
        this.cardBgColor = "#fff";
        this.cardPadding = "1rem";
        this.chartTitle = {
            show: true,
            label: "图表名称",
        };
        // 下拉框数据
        this.dataSourceSelectData = [];
        this.chartTitleColor = '';
        this.bcacDataSourceSelectEmit = new EventEmitter();
    }
    /**
     * @return {?}
     */
    BaseGaugeComponent.prototype.ngOnInit = /**
     * @return {?}
     */
    function () {
        var _this = this;
        this.initOpts = initOpts;
        this.initEchart();
        fromEvent(window, "resize")
            .pipe(debounceTime(200))
            .subscribe((/**
         * @return {?}
         */
        function () {
            _this.chartResizeService.autoResizeAdapt(_this.optionInit, _this.options);
        }));
    };
    // echart配置项
    // echart配置项
    /**
     * @return {?}
     */
    BaseGaugeComponent.prototype.initEchart = 
    // echart配置项
    /**
     * @return {?}
     */
    function () {
        this.options = this.echartOption;
    };
    /**
     * @param {?} ec
     * @return {?}
     */
    BaseGaugeComponent.prototype.onOptionInit = /**
     * @param {?} ec
     * @return {?}
     */
    function (ec) {
        this.optionInit = ec;
    };
    Object.defineProperty(BaseGaugeComponent.prototype, "bcacChartData", {
        //echarts数据
        set: 
        //echarts数据
        /**
         * @param {?} value
         * @return {?}
         */
        function (value) {
            this.baseGaugeService.setDatas(this.echartOption, value);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(BaseGaugeComponent.prototype, "bcacTitle", {
        // 标题
        set: 
        // 标题
        /**
         * @param {?} value
         * @return {?}
         */
        function (value) {
            this.chartTitle.show = true;
            this.chartTitle.label = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(BaseGaugeComponent.prototype, "bcacCloseTitle", {
        // 关闭标题
        set: 
        // 关闭标题
        /**
         * @param {?} value
         * @return {?}
         */
        function (value) {
            this.chartTitle.show = false;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(BaseGaugeComponent.prototype, "bcacDataSourceList", {
        set: /**
         * @param {?} value
         * @return {?}
         */
        function (value) {
            this.dataSourceSelectData = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(BaseGaugeComponent.prototype, "bcacSmallMode", {
        set: /**
         * @param {?} smallMode
         * @return {?}
         */
        function (smallMode) {
            if (smallMode) {
                this.cardPadding = "0";
            }
            else {
                this.cardPadding = "1rem";
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(BaseGaugeComponent.prototype, "bcacDarkMode", {
        set: /**
         * @param {?} darkMode
         * @return {?}
         */
        function (darkMode) {
            this.changeChartTitleColor(darkMode);
            this.changeCardBackgroundColor(darkMode);
        },
        enumerable: true,
        configurable: true
    });
    /**
     * @param {?} darkMode
     * @return {?}
     */
    BaseGaugeComponent.prototype.changeChartTitleColor = /**
     * @param {?} darkMode
     * @return {?}
     */
    function (darkMode) {
        if (!darkMode) {
            this.chartTitleColor = '';
        }
        else {
            this.chartTitleColor = color.darkModeTextColor;
        }
    };
    /**
     * @param {?} darkMode
     * @return {?}
     */
    BaseGaugeComponent.prototype.changeCardBackgroundColor = /**
     * @param {?} darkMode
     * @return {?}
     */
    function (darkMode) {
        if (typeof (darkMode) === 'string') {
            this.cardBgColor = darkMode;
        }
        else if (darkMode) {
            this.cardBgColor = backgroundColor.darkModeBGColor;
        }
    };
    /**
     * @param {?} e
     * @return {?}
     */
    BaseGaugeComponent.prototype.dataSourceChange = /**
     * @param {?} e
     * @return {?}
     */
    function (e) {
        this.bcacDataSourceSelectEmit.emit(e);
    };
    /**
     * @return {?}
     */
    BaseGaugeComponent.prototype.updateOption = /**
     * @return {?}
     */
    function () {
        if (this.optionInit) {
            this.optionInit.setOption(this.options, true);
        }
    };
    BaseGaugeComponent.decorators = [
        { type: Component, args: [{
                    selector: 'bcac-base-gauge',
                    template: "<div\u00A0class=\"chart-card\" [ngStyle]=\"{'background-color': cardBgColor, 'padding': cardPadding}\">\r\n    <div\u00A0nz-row\u00A0class=\"chart-header\" \u00A0*ngIf=\"chartTitle.show\">\r\n        <div\u00A0nz-col\u00A0nzSpan=\"12\" class=\"chart-title-label\">\r\n            <span [nzTooltipTitle]=\"chartTitle.label\" nz-tooltip [ngStyle]=\"{'color' : chartTitleColor ? chartTitleColor : 'unset'}\">\r\n                {{chartTitle.label}}\r\n            </span>\r\n        </div>\r\n        <div nz-col nzSpan=\"12\" class=\"custom-tool-box\">\r\n            <bcac-select-group *ngIf=\"dataSourceSelectData.length>0\" [bcacSelectList]=\"dataSourceSelectData\" (bcacSelectedChange)=\"dataSourceChange($event)\">\r\n            </bcac-select-group>\r\n            <!-- <bcac-single-select-icon *ngIf=\"intervalDatas.length>1\" [bcacSelectData]=\"intervalDatas\" (bcacSelectedEmit)=\"axisScaleChange($event)\">\r\n            </bcac-single-select-icon> -->\r\n            <!-- <bcac-legend-toolbox *ngIf=\"legendPosition === 'top'\" [bcacSelectValue]=\"legendDataArr\" (bcacSelectValueEmit)=\"legendChange($event)\">\r\n            </bcac-legend-toolbox> -->\r\n            <bcac-chart-menu [fileName]=\"chartTitle.label\" [chartInstance]=\"optionInit\"></bcac-chart-menu>\r\n        </div>\r\n    </div>\r\n    <div\u00A0class=\"chart-body\" [ngClass]=\"{'chart-body-full': !chartTitle.show}\">\r\n        <div echarts [options]=\"options\" class=\"echarts echartfontsize\" [loading]=\"bcacChartLoading\" [autoResize]=\"true\" [initOpts]=\"initOpts\"\r\n            (chartInit)=\"onOptionInit($event)\">\r\n        </div>\r\n    </div>\r\n</div>",
                    styles: ["@font-face{font-family:notoSans;src:url(/assets/font/SourceHanSansCN-Regular.ttf) format(\"opentype\")}@font-face{font-family:roboto;src:url(/assets/font/Roboto-Regular.ttf) format(\"opentype\")}body,html{font-family:roboto,notoSans}.chart-card{padding:1rem;background:#fff;height:100%}.chart-card .chart-header{font-size:1.4rem;color:#101010;line-height:1.5em;padding:.4rem}.chart-card .chart-header .chart-title-label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;line-height:1.5em}.chart-card .chart-header .custom-tool-box{text-align:right;display:flex;align-items:center;justify-content:flex-end}.chart-card .chart-body{position:relative;height:calc(100% - 2.9rem)}.chart-card .chart-body.chart-body-full{height:100%}.chart-card .chart-body .customToolBox{display:flex;position:absolute;z-index:2;right:3.8rem;top:-.3rem;min-height:3.2rem;align-items:center}.chart-card .chart-body .customToolBox>bcac-icon{font-size:1.6rem;line-height:1;cursor:pointer}.chart-card .echarts{width:100%;height:100%!important}.chart-card .echartfontsize{font-size:1.2rem}"]
                }] }
    ];
    /** @nocollapse */
    BaseGaugeComponent.ctorParameters = function () { return [
        { type: BaseGaugeService },
        { type: ChartResizeService }
    ]; };
    BaseGaugeComponent.propDecorators = {
        bcacChartData: [{ type: Input }],
        bcacTitle: [{ type: Input }],
        bcacCloseTitle: [{ type: Input }],
        bcacDataSourceList: [{ type: Input }],
        bcacChartLoading: [{ type: Input }],
        bcacSmallMode: [{ type: Input }],
        bcacDarkMode: [{ type: Input }],
        bcacDataSourceSelectEmit: [{ type: Output }]
    };
    return BaseGaugeComponent;
}());
export { BaseGaugeComponent };
if (false) {
    /** @type {?} */
    BaseGaugeComponent.prototype.initOpts;
    /** @type {?} */
    BaseGaugeComponent.prototype.echartOption;
    /** @type {?} */
    BaseGaugeComponent.prototype.options;
    /** @type {?} */
    BaseGaugeComponent.prototype.cardBgColor;
    /** @type {?} */
    BaseGaugeComponent.prototype.cardPadding;
    /** @type {?} */
    BaseGaugeComponent.prototype.chartTitle;
    /** @type {?} */
    BaseGaugeComponent.prototype.optionInit;
    /** @type {?} */
    BaseGaugeComponent.prototype.dataSourceSelectData;
    /** @type {?} */
    BaseGaugeComponent.prototype.bcacChartLoading;
    /** @type {?} */
    BaseGaugeComponent.prototype.chartTitleColor;
    /** @type {?} */
    BaseGaugeComponent.prototype.bcacDataSourceSelectEmit;
    /**
     * @type {?}
     * @private
     */
    BaseGaugeComponent.prototype.baseGaugeService;
    /**
     * @type {?}
     * @private
     */
    BaseGaugeComponent.prototype.chartResizeService;
}
//# sourceMappingURL=data:application/json;base64, 