"use strict";

Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.TableTheme = void 0;

const helper_1 = require("../tools/helper"), util_1 = require("../tools/util"), global_1 = require("../tools/global"), component_1 = require("./component");

function getProp(obj, superObj, names, defNames) {
    var _a, _b, _c;
    return null !== (_c = null !== (_b = null !== (_a = (0, helper_1.getChainSafe)(obj, ...names)) && void 0 !== _a ? _a : (0, 
    helper_1.getChainSafe)(superObj, ...names)) && void 0 !== _b ? _b : defNames && (0, 
    helper_1.getChainSafe)(obj, ...defNames)) && void 0 !== _c ? _c : defNames && (0, 
    helper_1.getChainSafe)(superObj, ...defNames);
}

class TableTheme {
    constructor(obj, superTheme) {
        this._defaultStyle = null, this._header = null, this._cornerHeader = null, this._cornerRightTopCell = null, 
        this._cornerLeftBottomCell = null, this._cornerRightBottomCell = null, this._rightFrozen = null, 
        this._bottomFrozen = null, this._rowHeader = null, this._body = null, this._groupTitle = null, 
        this._scroll = null, this._tooltip = null, this._frameStyle = null, this._columnResize = null, 
        this._dragHeaderSplitLine = null, this._frozenColumnLine = null, this._selectionStyle = null, 
        this._axisStyle = null, this._checkboxStyle = null, this._radioStyle = null, this._switchStyle = null, 
        this._buttonStyle = null, this._textPopTipStyle = null, this._internalIconsStyle = null, 
        this.isPivot = !1, this.name = "", this.internalTheme = {
            obj: obj,
            superTheme: superTheme
        }, this.name = getProp(obj, superTheme, [ "name" ]);
    }
    getExtendTheme() {
        return this.internalTheme.obj;
    }
    clearBodyStyleCache() {
        this._body = null;
    }
    get font() {
        const {obj: obj, superTheme: superTheme} = this.internalTheme;
        return getProp(obj, superTheme, [ "font" ], [ "bodyStyle", "font" ]);
    }
    get underlayBackgroundColor() {
        const {obj: obj, superTheme: superTheme} = this.internalTheme;
        return getProp(obj, superTheme, [ "underlayBackgroundColor" ]);
    }
    get cellInnerBorder() {
        var _a;
        const {obj: obj, superTheme: superTheme} = this.internalTheme;
        return null === (_a = getProp(obj, superTheme, [ "cellInnerBorder" ])) || void 0 === _a || _a;
    }
    get cellBorderClipDirection() {
        var _a;
        const {obj: obj, superTheme: superTheme} = this.internalTheme;
        return null !== (_a = getProp(obj, superTheme, [ "cellBorderClipDirection" ])) && void 0 !== _a ? _a : "top-left";
    }
    get _contentOffset() {
        var _a;
        const {obj: obj, superTheme: superTheme} = this.internalTheme;
        return null !== (_a = getProp(obj, superTheme, [ "_contentOffset" ])) && void 0 !== _a ? _a : 0;
    }
    get defaultStyle() {
        const that = this;
        if (!this._defaultStyle) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, defaultStyle = (0, 
            util_1.ingoreNoneValueMerge)({}, superTheme.defaultStyle, obj.defaultStyle);
            this._defaultStyle = {
                get fontSize() {
                    var _a;
                    return null !== (_a = defaultStyle.fontSize) && void 0 !== _a ? _a : global_1.DEFAULTFONTSIZE;
                },
                get fontFamily() {
                    var _a;
                    return null !== (_a = defaultStyle.fontFamily) && void 0 !== _a ? _a : global_1.DEFAULTFONTFAMILY;
                },
                get fontWeight() {
                    return defaultStyle.fontWeight;
                },
                get fontVariant() {
                    return defaultStyle.fontVariant;
                },
                get fontStyle() {
                    return defaultStyle.fontStyle;
                },
                get bgColor() {
                    var _a;
                    return null !== (_a = defaultStyle.bgColor) && void 0 !== _a ? _a : global_1.DEFAULTBGCOLOR;
                },
                get color() {
                    var _a;
                    return null !== (_a = defaultStyle.color) && void 0 !== _a ? _a : global_1.DEFAULTFONTCOLOR;
                },
                get borderColor() {
                    var _a;
                    return null !== (_a = defaultStyle.borderColor) && void 0 !== _a ? _a : global_1.DEFAULTBORDERCOLOR;
                },
                get borderLineWidth() {
                    var _a;
                    return null !== (_a = defaultStyle.borderLineWidth) && void 0 !== _a ? _a : global_1.DEFAULTBORDERLINEWIDTH;
                },
                get borderLineDash() {
                    var _a;
                    return null !== (_a = defaultStyle.borderLineDash) && void 0 !== _a ? _a : global_1.DEFAULTBORDERLINEDASH;
                },
                get hover() {
                    if (defaultStyle.hover) return {
                        get cellBgColor() {
                            var _a, _b;
                            return null !== (_b = null === (_a = defaultStyle.hover) || void 0 === _a ? void 0 : _a.cellBgColor) && void 0 !== _b ? _b : void 0;
                        },
                        get inlineColumnBgColor() {
                            var _a, _b, _c, _d, _e, _f, _g;
                            return null !== (_g = null !== (_b = null === (_a = defaultStyle.hover) || void 0 === _a ? void 0 : _a.inlineColumnBgColor) && void 0 !== _b ? _b : (null === (_c = defaultStyle.hover) || void 0 === _c ? void 0 : _c.cellBgColor) && "string" == typeof (null === (_d = defaultStyle.hover) || void 0 === _d ? void 0 : _d.cellBgColor) && "transparent" !== (null === (_e = defaultStyle.hover) || void 0 === _e ? void 0 : _e.cellBgColor) ? (0, 
                            util_1.changeColor)(null === (_f = defaultStyle.hover) || void 0 === _f ? void 0 : _f.cellBgColor, .1, !1) : void 0) && void 0 !== _g ? _g : void 0;
                        },
                        get inlineRowBgColor() {
                            var _a, _b, _c, _d, _e, _f, _g;
                            return null !== (_g = null !== (_b = null === (_a = defaultStyle.hover) || void 0 === _a ? void 0 : _a.inlineRowBgColor) && void 0 !== _b ? _b : (null === (_c = defaultStyle.hover) || void 0 === _c ? void 0 : _c.cellBgColor) && "string" == typeof (null === (_d = defaultStyle.hover) || void 0 === _d ? void 0 : _d.cellBgColor) && "transparent" !== (null === (_e = defaultStyle.hover) || void 0 === _e ? void 0 : _e.cellBgColor) ? (0, 
                            util_1.changeColor)(null === (_f = defaultStyle.hover) || void 0 === _f ? void 0 : _f.cellBgColor, .1, !1) : void 0) && void 0 !== _g ? _g : void 0;
                        }
                    };
                },
                get select() {
                    if (defaultStyle.select) return {
                        get inlineColumnBgColor() {
                            var _a, _b, _c, _d, _e, _f;
                            return null !== (_f = null !== (_d = null !== (_b = null === (_a = defaultStyle.select) || void 0 === _a ? void 0 : _a.inlineColumnBgColor) && void 0 !== _b ? _b : null === (_c = that.selectionStyle) || void 0 === _c ? void 0 : _c.inlineColumnBgColor) && void 0 !== _d ? _d : (null === (_e = that.selectionStyle) || void 0 === _e ? void 0 : _e.cellBgColor) && "string" == typeof that.selectionStyle.cellBgColor && "transparent" !== that.selectionStyle.cellBgColor ? (0, 
                            util_1.changeColor)(that.selectionStyle.cellBgColor, .1, !1) : void 0) && void 0 !== _f ? _f : void 0;
                        },
                        get inlineRowBgColor() {
                            var _a, _b, _c, _d, _e;
                            return null !== (_e = null !== (_c = null !== (_b = null === (_a = defaultStyle.select) || void 0 === _a ? void 0 : _a.inlineRowBgColor) && void 0 !== _b ? _b : that.selectionStyle.inlineRowBgColor) && void 0 !== _c ? _c : (null === (_d = that.selectionStyle) || void 0 === _d ? void 0 : _d.cellBgColor) && "string" == typeof that.selectionStyle.cellBgColor && "transparent" !== that.selectionStyle.cellBgColor ? (0, 
                            util_1.changeColor)(that.selectionStyle.cellBgColor, .1, !1) : void 0) && void 0 !== _e ? _e : void 0;
                        }
                    };
                },
                get padding() {
                    var _a;
                    return null !== (_a = defaultStyle.padding) && void 0 !== _a ? _a : [ 10, 16, 10, 16 ];
                },
                get textAlign() {
                    var _a;
                    return null !== (_a = defaultStyle.textAlign) && void 0 !== _a ? _a : "left";
                },
                get textBaseline() {
                    var _a;
                    return null !== (_a = defaultStyle.textBaseline) && void 0 !== _a ? _a : "middle";
                },
                get textOverflow() {
                    var _a;
                    return null !== (_a = defaultStyle.textOverflow) && void 0 !== _a ? _a : "ellipsis";
                },
                get lineHeight() {
                    return defaultStyle.lineHeight;
                },
                get autoWrapText() {
                    var _a;
                    return null !== (_a = defaultStyle.autoWrapText) && void 0 !== _a && _a;
                },
                get lineClamp() {
                    var _a;
                    return null !== (_a = defaultStyle.lineClamp) && void 0 !== _a ? _a : "auto";
                },
                get linkColor() {
                    var _a;
                    return null !== (_a = defaultStyle.linkColor) && void 0 !== _a ? _a : "#3772ff";
                },
                get cursor() {
                    var _a;
                    return null !== (_a = defaultStyle.cursor) && void 0 !== _a ? _a : "auto";
                },
                get marked() {
                    var _a;
                    return null !== (_a = defaultStyle.marked) && void 0 !== _a && _a;
                },
                get underline() {
                    var _a;
                    return null !== (_a = defaultStyle.underline) && void 0 !== _a && _a;
                },
                get underlineColor() {
                    return defaultStyle.underlineColor;
                },
                get underlineDash() {
                    return defaultStyle.underlineDash;
                },
                get underlineOffset() {
                    return defaultStyle.underlineOffset;
                },
                get lineThrough() {
                    var _a;
                    return null !== (_a = defaultStyle.lineThrough) && void 0 !== _a && _a;
                },
                get lineThroughColor() {
                    return defaultStyle.lineThroughColor;
                },
                get lineThroughDash() {
                    return defaultStyle.lineThroughDash;
                }
            };
        }
        return this._defaultStyle;
    }
    get cornerHeaderStyle() {
        if (!this._cornerHeader) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, header = (0, util_1.ingoreNoneValueMerge)({}, this.defaultStyle, superTheme.cornerHeaderStyle, obj.cornerHeaderStyle);
            this._cornerHeader = this.getStyle(header);
        }
        return this._cornerHeader;
    }
    get cornerRightTopCellStyle() {
        if (!this._cornerRightTopCell) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme;
            if (!superTheme.cornerRightTopCellStyle && !obj.cornerRightTopCellStyle) return this._cornerRightTopCell;
            const header = (0, util_1.ingoreNoneValueMerge)({}, this.defaultStyle, superTheme.cornerRightTopCellStyle, obj.cornerRightTopCellStyle);
            this._cornerRightTopCell = this.getStyle(header);
        }
        return this._cornerRightTopCell;
    }
    get cornerLeftBottomCellStyle() {
        if (!this._cornerLeftBottomCell) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme;
            if (!superTheme.cornerLeftBottomCellStyle && !obj.cornerLeftBottomCellStyle) return this._cornerLeftBottomCell;
            const header = (0, util_1.ingoreNoneValueMerge)({}, this.defaultStyle, superTheme.cornerLeftBottomCellStyle, obj.cornerLeftBottomCellStyle);
            this._cornerLeftBottomCell = this.getStyle(header);
        }
        return this._cornerLeftBottomCell;
    }
    get cornerRightBottomCellStyle() {
        if (!this._cornerRightBottomCell) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme;
            if (!superTheme.cornerRightBottomCellStyle && !obj.cornerRightBottomCellStyle) return this._cornerRightBottomCell;
            const header = (0, util_1.ingoreNoneValueMerge)({}, this.defaultStyle, superTheme.cornerRightBottomCellStyle, obj.cornerRightBottomCellStyle);
            this._cornerRightBottomCell = this.getStyle(header);
        }
        return this._cornerRightBottomCell;
    }
    get rightFrozenStyle() {
        if (!this._rightFrozen) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme;
            if (!superTheme.rightFrozenStyle && !obj.rightFrozenStyle) return this._rightFrozen;
            const header = (0, util_1.ingoreNoneValueMerge)({}, this.defaultStyle, this.rowHeaderStyle, superTheme.rightFrozenStyle, obj.rightFrozenStyle);
            this._rightFrozen = this.getStyle(header);
        }
        return this._rightFrozen;
    }
    get bottomFrozenStyle() {
        if (!this._bottomFrozen) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme;
            if (!superTheme.bottomFrozenStyle && !obj.bottomFrozenStyle) return this._bottomFrozen;
            const header = (0, util_1.ingoreNoneValueMerge)({}, this.defaultStyle, this.headerStyle, superTheme.bottomFrozenStyle, obj.bottomFrozenStyle);
            this._bottomFrozen = this.getStyle(header);
        }
        return this._bottomFrozen;
    }
    get rowHeaderStyle() {
        var _a;
        if (!this._rowHeader) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, header = (0, util_1.ingoreNoneValueMerge)({}, this.defaultStyle, superTheme.rowHeaderStyle, null !== (_a = obj.rowHeaderStyle) && void 0 !== _a ? _a : this.isPivot ? null : obj.headerStyle);
            this._rowHeader = this.getStyle(header);
        }
        return this._rowHeader;
    }
    get headerStyle() {
        if (!this._header) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, header = (0, util_1.ingoreNoneValueMerge)({}, this.defaultStyle, superTheme.headerStyle, obj.headerStyle);
            this._header = this.getStyle(header);
        }
        return this._header;
    }
    get bodyStyle() {
        if (!this._body) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, body = (0, util_1.ingoreNoneValueMerge)({}, this.defaultStyle, superTheme.bodyStyle, obj.bodyStyle);
            this._body = this.getStyle(body);
        }
        return this._body;
    }
    get groupTitleStyle() {
        if (!this._groupTitle) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme;
            if (!superTheme.groupTitleStyle && !obj.groupTitleStyle) return this._groupTitle;
            const groupTitle = (0, util_1.ingoreNoneValueMerge)({}, this.defaultStyle, superTheme.groupTitleStyle, obj.groupTitleStyle);
            this._groupTitle = this.getStyle(groupTitle);
        }
        return this._groupTitle;
    }
    get frameStyle() {
        if (!this._frameStyle) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, frameStyle = (0, 
            util_1.ingoreNoneValueMerge)({}, superTheme.frameStyle, obj.frameStyle);
            this._frameStyle = {
                get borderColor() {
                    return frameStyle.borderColor;
                },
                get borderLineWidth() {
                    return frameStyle.borderLineWidth;
                },
                get borderLineDash() {
                    return frameStyle.borderLineDash;
                },
                get innerBorder() {
                    return frameStyle.innerBorder;
                },
                get shadowBlur() {
                    return frameStyle.shadowBlur;
                },
                get shadowColor() {
                    return frameStyle.shadowColor;
                },
                get shadowOffsetX() {
                    return frameStyle.shadowOffsetX;
                },
                get shadowOffsetY() {
                    return frameStyle.shadowOffsetY;
                },
                get cornerRadius() {
                    return frameStyle.cornerRadius;
                }
            };
        }
        return this._frameStyle;
    }
    get scrollStyle() {
        if (!this._scroll) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, scroll = (0, util_1.ingoreNoneValueMerge)({}, superTheme.scrollStyle, obj.scrollStyle);
            this._scroll = {
                get scrollSliderColor() {
                    var _a;
                    return null !== (_a = scroll.scrollSliderColor) && void 0 !== _a ? _a : "#C0C0C0";
                },
                get scrollSliderCornerRadius() {
                    return scroll.scrollSliderCornerRadius;
                },
                get scrollRailColor() {
                    return scroll.scrollRailColor;
                },
                get visible() {
                    var _a;
                    return null !== (_a = scroll.visible) && void 0 !== _a ? _a : "scrolling";
                },
                get verticalVisible() {
                    return scroll.verticalVisible;
                },
                get horizontalVisible() {
                    return scroll.horizontalVisible;
                },
                get width() {
                    var _a;
                    return null !== (_a = scroll.width) && void 0 !== _a ? _a : 7;
                },
                get hoverOn() {
                    var _a;
                    return null === (_a = scroll.hoverOn) || void 0 === _a || _a;
                },
                get barToSide() {
                    var _a;
                    return null !== (_a = scroll.barToSide) && void 0 !== _a && _a;
                },
                get horizontalPadding() {
                    var _a;
                    return null !== (_a = scroll.horizontalPadding) && void 0 !== _a ? _a : 0;
                },
                get verticalPadding() {
                    var _a;
                    return null !== (_a = scroll.verticalPadding) && void 0 !== _a ? _a : 0;
                },
                get ignoreFrozenCols() {
                    var _a;
                    return null !== (_a = scroll.ignoreFrozenCols) && void 0 !== _a && _a;
                }
            };
        }
        return this._scroll;
    }
    get tooltipStyle() {
        if (!this._tooltip) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, tooltip = (0, util_1.ingoreNoneValueMerge)({}, superTheme.tooltipStyle, obj.tooltipStyle);
            this._tooltip = {
                get fontFamily() {
                    var _a;
                    return null !== (_a = tooltip.fontFamily) && void 0 !== _a ? _a : global_1.DEFAULTFONTFAMILY;
                },
                get fontSize() {
                    var _a;
                    return null !== (_a = tooltip.fontSize) && void 0 !== _a ? _a : global_1.DEFAULTFONTSIZE;
                },
                get bgColor() {
                    var _a;
                    return null !== (_a = tooltip.bgColor) && void 0 !== _a ? _a : "#000";
                },
                get padding() {
                    var _a;
                    return null !== (_a = tooltip.padding) && void 0 !== _a ? _a : [ 6, 8 ];
                },
                get color() {
                    var _a;
                    return null !== (_a = tooltip.color) && void 0 !== _a ? _a : "#FFF";
                },
                get maxWidth() {
                    return tooltip.maxWidth;
                },
                get maxHeight() {
                    return tooltip.maxHeight;
                }
            };
        }
        return this._tooltip;
    }
    get columnResize() {
        if (!this._columnResize) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, columnResize = (0, 
            util_1.ingoreNoneValueMerge)({}, superTheme.columnResize, obj.columnResize);
            this._columnResize = {
                get lineColor() {
                    var _a;
                    return null !== (_a = columnResize.lineColor) && void 0 !== _a ? _a : "#416EFF";
                },
                get bgColor() {
                    var _a;
                    return null !== (_a = columnResize.bgColor) && void 0 !== _a ? _a : "#D9E2FF";
                },
                get lineWidth() {
                    var _a;
                    return null !== (_a = columnResize.lineWidth) && void 0 !== _a ? _a : 1;
                },
                get width() {
                    var _a;
                    return null !== (_a = columnResize.width) && void 0 !== _a ? _a : columnResize.lineWidth + 2;
                },
                get resizeHotSpotSize() {
                    var _a;
                    return null !== (_a = columnResize.resizeHotSpotSize) && void 0 !== _a ? _a : 16;
                },
                get labelColor() {
                    var _a;
                    return null !== (_a = columnResize.labelColor) && void 0 !== _a ? _a : "#FFF";
                },
                get labelFontSize() {
                    var _a;
                    return null !== (_a = columnResize.labelFontSize) && void 0 !== _a ? _a : 10;
                },
                get labelFontFamily() {
                    var _a;
                    return null !== (_a = columnResize.labelFontFamily) && void 0 !== _a ? _a : "sans-serif";
                },
                get labelBackgroundFill() {
                    var _a;
                    return null !== (_a = columnResize.labelBackgroundFill) && void 0 !== _a ? _a : "#3073F2";
                },
                get labelBackgroundCornerRadius() {
                    var _a;
                    return null !== (_a = columnResize.labelBackgroundCornerRadius) && void 0 !== _a ? _a : 5;
                },
                get labelVisible() {
                    var _a;
                    return null === (_a = columnResize.labelVisible) || void 0 === _a || _a;
                },
                get visibleOnHover() {
                    var _a;
                    return null !== (_a = columnResize.visibleOnHover) && void 0 !== _a && _a;
                }
            };
        }
        return this._columnResize;
    }
    get dragHeaderSplitLine() {
        if (!this._dragHeaderSplitLine) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, dragHeaderSplitLine = (0, 
            util_1.ingoreNoneValueMerge)({}, superTheme.dragHeaderSplitLine, obj.dragHeaderSplitLine);
            this._dragHeaderSplitLine = {
                get lineColor() {
                    var _a;
                    return null !== (_a = dragHeaderSplitLine.lineColor) && void 0 !== _a ? _a : "blue";
                },
                get lineWidth() {
                    var _a;
                    return null !== (_a = dragHeaderSplitLine.lineWidth) && void 0 !== _a ? _a : 2;
                },
                get shadowBlockColor() {
                    var _a;
                    return null !== (_a = dragHeaderSplitLine.shadowBlockColor) && void 0 !== _a ? _a : "rgba(204,204,204,0.3)";
                }
            };
        }
        return this._dragHeaderSplitLine;
    }
    get frozenColumnLine() {
        if (!this._frozenColumnLine) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, frozenColumnLine = (0, 
            util_1.ingoreNoneValueMerge)({}, superTheme.frozenColumnLine, obj.frozenColumnLine);
            this._frozenColumnLine = {
                get shadow() {
                    if (frozenColumnLine.shadow) return {
                        get width() {
                            var _a, _b;
                            return null !== (_b = null === (_a = frozenColumnLine.shadow) || void 0 === _a ? void 0 : _a.width) && void 0 !== _b ? _b : 24;
                        },
                        get startColor() {
                            var _a, _b;
                            return null !== (_b = null === (_a = frozenColumnLine.shadow) || void 0 === _a ? void 0 : _a.startColor) && void 0 !== _b ? _b : "rgba(00, 24, 47, 0.06)";
                        },
                        get endColor() {
                            var _a, _b;
                            return null !== (_b = null === (_a = frozenColumnLine.shadow) || void 0 === _a ? void 0 : _a.endColor) && void 0 !== _b ? _b : "rgba(00, 24, 47, 0)";
                        },
                        get visible() {
                            var _a, _b;
                            return null !== (_b = null === (_a = frozenColumnLine.shadow) || void 0 === _a ? void 0 : _a.visible) && void 0 !== _b ? _b : "always";
                        }
                    };
                },
                get border() {
                    if (frozenColumnLine.border) return {
                        get lineColor() {
                            var _a, _b;
                            return null !== (_b = null === (_a = frozenColumnLine.border) || void 0 === _a ? void 0 : _a.lineColor) && void 0 !== _b ? _b : "rgba(00, 24, 47, 0.06)";
                        },
                        get bgColor() {
                            var _a, _b, _c, _d;
                            return null !== (_d = null !== (_b = null === (_a = frozenColumnLine.border) || void 0 === _a ? void 0 : _a.bgColor) && void 0 !== _b ? _b : null === (_c = frozenColumnLine.border) || void 0 === _c ? void 0 : _c.lineColor) && void 0 !== _d ? _d : "rgba(00, 24, 47, 0.06)";
                        },
                        get lineWidth() {
                            var _a, _b;
                            return null !== (_b = null === (_a = frozenColumnLine.border) || void 0 === _a ? void 0 : _a.lineWidth) && void 0 !== _b ? _b : 4;
                        },
                        get width() {
                            var _a, _b, _c, _d;
                            return null !== (_d = null !== (_b = null === (_a = frozenColumnLine.border) || void 0 === _a ? void 0 : _a.width) && void 0 !== _b ? _b : null === (_c = frozenColumnLine.border) || void 0 === _c ? void 0 : _c.lineWidth) && void 0 !== _d ? _d : 4;
                        }
                    };
                }
            };
        }
        return this._frozenColumnLine;
    }
    get selectionStyle() {
        if (!this._selectionStyle) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, selectionStyle = (0, 
            util_1.ingoreNoneValueMerge)({}, superTheme.selectionStyle, obj.selectionStyle);
            this._selectionStyle = {
                get cellBgColor() {
                    var _a;
                    return null !== (_a = null == selectionStyle ? void 0 : selectionStyle.cellBgColor) && void 0 !== _a ? _a : "rgba(0, 0, 255,0.1)";
                },
                get cellBorderColor() {
                    var _a;
                    return null !== (_a = null == selectionStyle ? void 0 : selectionStyle.cellBorderColor) && void 0 !== _a ? _a : "#3073f2";
                },
                get cellBorderLineWidth() {
                    var _a;
                    return null !== (_a = null == selectionStyle ? void 0 : selectionStyle.cellBorderLineWidth) && void 0 !== _a ? _a : 2;
                },
                get inlineColumnBgColor() {
                    return null == selectionStyle ? void 0 : selectionStyle.inlineColumnBgColor;
                },
                get inlineRowBgColor() {
                    return null == selectionStyle ? void 0 : selectionStyle.inlineRowBgColor;
                },
                get selectionFillMode() {
                    var _a;
                    return null !== (_a = null == selectionStyle ? void 0 : selectionStyle.selectionFillMode) && void 0 !== _a ? _a : "overlay";
                },
                get dynamicUpdateSelectionSize() {
                    var _a;
                    return null !== (_a = null == selectionStyle ? void 0 : selectionStyle.dynamicUpdateSelectionSize) && void 0 !== _a && _a;
                }
            };
        }
        return this._selectionStyle;
    }
    get axisStyle() {
        if (!this._axisStyle) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, axisStyle = (0, util_1.ingoreNoneValueMerge)({}, superTheme.axisStyle, obj.axisStyle);
            this._axisStyle = (0, component_1.getAxisStyle)(axisStyle);
        }
        return this._axisStyle;
    }
    get checkboxStyle() {
        if (!this._checkboxStyle) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, checkboxStyle = (0, 
            util_1.ingoreNoneValueMerge)({}, superTheme.checkboxStyle, obj.checkboxStyle);
            this._checkboxStyle = checkboxStyle;
        }
        return this._checkboxStyle;
    }
    get radioStyle() {
        if (!this._radioStyle) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, radioStyle = (0, 
            util_1.ingoreNoneValueMerge)({}, superTheme.radioStyle, obj.radioStyle);
            this._radioStyle = radioStyle;
        }
        return this._radioStyle;
    }
    get switchStyle() {
        if (!this._switchStyle) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, switchStyle = (0, 
            util_1.ingoreNoneValueMerge)({}, superTheme.switchStyle, obj.switchStyle);
            this._switchStyle = switchStyle;
        }
        return this._switchStyle;
    }
    get buttonStyle() {
        if (!this._buttonStyle) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, buttonStyle = (0, 
            util_1.ingoreNoneValueMerge)({}, superTheme.buttonStyle, obj.buttonStyle);
            this._buttonStyle = buttonStyle;
        }
        return this._buttonStyle;
    }
    get textPopTipStyle() {
        if (!this._textPopTipStyle) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, textPopTipStyle = (0, 
            util_1.ingoreNoneValueMerge)({}, component_1.defalutPoptipStyle, superTheme.textPopTipStyle, obj.textPopTipStyle);
            this._textPopTipStyle = textPopTipStyle;
        }
        return this._textPopTipStyle;
    }
    get functionalIconsStyle() {
        if (!this._internalIconsStyle) {
            const {obj: obj, superTheme: superTheme} = this.internalTheme, functionalIconsStyle = (0, 
            util_1.ingoreNoneValueMerge)({}, superTheme.functionalIconsStyle, obj.functionalIconsStyle);
            this._internalIconsStyle = functionalIconsStyle;
        }
        return this._internalIconsStyle;
    }
    hasProperty(names) {
        const {obj: obj, superTheme: superTheme} = this.internalTheme;
        return hasThemeProperty(obj, names) || hasThemeProperty(superTheme, names);
    }
    extends(obj) {
        return new TableTheme((0, util_1.ingoreNoneValueMerge)({}, obj), (0, util_1.ingoreNoneValueMerge)({}, this.internalTheme.superTheme, this.internalTheme.obj));
    }
    getStyle(style) {
        const that = this;
        return {
            get fontSize() {
                return style.fontSize;
            },
            get fontFamily() {
                return style.fontFamily;
            },
            get fontWeight() {
                return style.fontWeight;
            },
            get fontVariant() {
                return style.fontVariant;
            },
            get fontStyle() {
                return style.fontStyle;
            },
            get bgColor() {
                return style.bgColor;
            },
            get color() {
                return style.color;
            },
            get strokeColor() {
                return style.strokeColor;
            },
            get borderColor() {
                return style.borderColor;
            },
            get borderLineWidth() {
                return style.borderLineWidth;
            },
            get borderLineDash() {
                return style.borderLineDash;
            },
            get hover() {
                if (style.hover) return {
                    get cellBgColor() {
                        var _a, _b;
                        return null !== (_b = null === (_a = style.hover) || void 0 === _a ? void 0 : _a.cellBgColor) && void 0 !== _b ? _b : void 0;
                    },
                    get inlineColumnBgColor() {
                        var _a, _b, _c, _d, _e, _f, _g;
                        return null !== (_g = null !== (_b = null === (_a = style.hover) || void 0 === _a ? void 0 : _a.inlineColumnBgColor) && void 0 !== _b ? _b : (null === (_c = style.hover) || void 0 === _c ? void 0 : _c.cellBgColor) && "string" == typeof (null === (_d = style.hover) || void 0 === _d ? void 0 : _d.cellBgColor) && "transparent" !== (null === (_e = style.hover) || void 0 === _e ? void 0 : _e.cellBgColor) ? (0, 
                        util_1.changeColor)(null === (_f = style.hover) || void 0 === _f ? void 0 : _f.cellBgColor, .1, !1) : void 0) && void 0 !== _g ? _g : void 0;
                    },
                    get inlineRowBgColor() {
                        var _a, _b, _c, _d, _e, _f, _g;
                        return null !== (_g = null !== (_b = null === (_a = style.hover) || void 0 === _a ? void 0 : _a.inlineRowBgColor) && void 0 !== _b ? _b : (null === (_c = style.hover) || void 0 === _c ? void 0 : _c.cellBgColor) && "string" == typeof (null === (_d = style.hover) || void 0 === _d ? void 0 : _d.cellBgColor) && "transparent" !== (null === (_e = style.hover) || void 0 === _e ? void 0 : _e.cellBgColor) ? (0, 
                        util_1.changeColor)(null === (_f = style.hover) || void 0 === _f ? void 0 : _f.cellBgColor, .1, !1) : void 0) && void 0 !== _g ? _g : void 0;
                    }
                };
            },
            get select() {
                return {
                    get inlineColumnBgColor() {
                        var _a, _b, _c, _d, _e, _f;
                        return null !== (_f = null !== (_d = null !== (_b = null === (_a = style.select) || void 0 === _a ? void 0 : _a.inlineColumnBgColor) && void 0 !== _b ? _b : null === (_c = that.selectionStyle) || void 0 === _c ? void 0 : _c.inlineColumnBgColor) && void 0 !== _d ? _d : (null === (_e = that.selectionStyle) || void 0 === _e ? void 0 : _e.cellBgColor) && "string" == typeof that.selectionStyle.cellBgColor && "transparent" !== that.selectionStyle.cellBgColor ? (0, 
                        util_1.changeColor)(that.selectionStyle.cellBgColor, .1, !1) : void 0) && void 0 !== _f ? _f : void 0;
                    },
                    get inlineRowBgColor() {
                        var _a, _b, _c, _d, _e;
                        return null !== (_e = null !== (_c = null !== (_b = null === (_a = style.select) || void 0 === _a ? void 0 : _a.inlineRowBgColor) && void 0 !== _b ? _b : that.selectionStyle.inlineRowBgColor) && void 0 !== _c ? _c : (null === (_d = that.selectionStyle) || void 0 === _d ? void 0 : _d.cellBgColor) && "string" == typeof that.selectionStyle.cellBgColor && "transparent" !== that.selectionStyle.cellBgColor ? (0, 
                        util_1.changeColor)(that.selectionStyle.cellBgColor, .1, !1) : void 0) && void 0 !== _e ? _e : void 0;
                    },
                    get cellBgColor() {
                        var _a, _b, _c;
                        if ("replace" === that.selectionStyle.selectionFillMode) return null !== (_c = null !== (_b = null === (_a = style.select) || void 0 === _a ? void 0 : _a.cellBgColor) && void 0 !== _b ? _b : that.selectionStyle.cellBgColor) && void 0 !== _c ? _c : void 0;
                    }
                };
            },
            get frameStyle() {
                if (style.frameStyle) return {
                    get borderColor() {
                        var _a, _b;
                        return null !== (_b = null === (_a = style.frameStyle) || void 0 === _a ? void 0 : _a.borderColor) && void 0 !== _b ? _b : void 0;
                    },
                    get borderLineWidth() {
                        var _a, _b;
                        return null !== (_b = null === (_a = style.frameStyle) || void 0 === _a ? void 0 : _a.borderLineWidth) && void 0 !== _b ? _b : void 0;
                    },
                    get borderLineDash() {
                        var _a, _b;
                        return null !== (_b = null === (_a = style.frameStyle) || void 0 === _a ? void 0 : _a.borderLineDash) && void 0 !== _b ? _b : void 0;
                    }
                };
            },
            get padding() {
                return style.padding;
            },
            get textAlign() {
                return style.textAlign;
            },
            get textBaseline() {
                return style.textBaseline;
            },
            get textOverflow() {
                return style.textOverflow;
            },
            get lineHeight() {
                return style.lineHeight;
            },
            get autoWrapText() {
                return style.autoWrapText;
            },
            get lineClamp() {
                return style.lineClamp;
            },
            get linkColor() {
                return style.linkColor;
            },
            get cursor() {
                return style.cursor;
            },
            get textStick() {
                return style.textStick;
            },
            get marked() {
                return style.marked;
            },
            get underline() {
                var _a;
                return null !== (_a = style.underline) && void 0 !== _a && _a;
            },
            get underlineColor() {
                return style.underlineColor;
            },
            get underlineDash() {
                return style.underlineDash;
            },
            get underlineOffset() {
                return style.underlineOffset;
            },
            get lineThrough() {
                var _a;
                return null !== (_a = style.lineThrough) && void 0 !== _a && _a;
            },
            get lineThroughColor() {
                return style.lineThroughColor;
            },
            get lineThroughDash() {
                return style.lineThroughDash;
            }
        };
    }
}

function hasThemeProperty(obj, names) {
    if (obj instanceof TableTheme) return obj.hasProperty(names);
    let o = obj;
    if (!o) return !1;
    for (let index = 0; index < names.length; index++) {
        if (o = o[names[index]], !o) return !1;
    }
    return !!o;
}

exports.TableTheme = TableTheme;
//# sourceMappingURL=theme-define.js.map
