import { delegateCombine, delegateRemove } from "igniteui-webcomponents-core";
import { IgcGridColumnAnimationSettings } from "./igc-grid-column-animation-settings";
import { IgcColumnWidth } from "./igc-column-width";
import { IgcHeaderComponent } from "./igc-header-component";
import { ColumnSortDirection_$type } from "./ColumnSortDirection";
import { PinnedPositions_$type } from "./PinnedPositions";
import { ColumnOptionsIconAlignment_$type } from "./ColumnOptionsIconAlignment";
import { ColumnOptionsIconBehavior_$type } from "./ColumnOptionsIconBehavior";
import { IgcDefinitionBaseComponent } from "./igc-definition-base-component";
import { getAllPropertyNames, toSpinal, brushToString, stringToBrush, ensureBool, ensureEnum, enumToString } from "igniteui-webcomponents-core";
import { ColumnWidth as ColumnWidth_internal } from "./ColumnWidth";
import { FontInfo } from "igniteui-webcomponents-core";
/**
 * A column in the data grid.
*/
export let IgcColumnComponent = /*@__PURE__*/ (() => {
    class IgcColumnComponent extends IgcDefinitionBaseComponent {
        constructor() {
            super();
            this._actualHeaderTextChange = null;
            this._actualHeaderTextChange_wrapped = null;
        }
        /**
                                     * @hidden
                                     */
        get i() {
            return this._implementation;
        }
        connectedCallback() {
            if (super["connectedCallback"]) {
                super["connectedCallback"]();
            }
            if (!this._attached) {
                this._attached = true;
                this._flushQueuedAttributes();
            }
        }
        static get observedAttributes() {
            if (IgcColumnComponent._observedAttributesIgcColumnComponent == null) {
                let names = getAllPropertyNames(IgcColumnComponent);
                for (let i = 0; i < names.length; i++) {
                    names[i] = toSpinal(names[i]);
                }
                IgcColumnComponent._observedAttributesIgcColumnComponent = names;
            }
            return IgcColumnComponent._observedAttributesIgcColumnComponent;
        }
        /**
         * Gets or sets the amount of left padding to use for the cell content for this column.
        */
        get paddingLeft() {
            return this.i.g2;
        }
        set paddingLeft(v) {
            this.i.g2 = +v;
            this._a("paddingLeft", this.i.g2);
        }
        /**
         * Gets or sets the amount of top padding to use for the cell content for this column.
        */
        get paddingTop() {
            return this.i.g4;
        }
        set paddingTop(v) {
            this.i.g4 = +v;
            this._a("paddingTop", this.i.g4);
        }
        /**
         * Gets or sets the amount of right padding to use for the cell content of this column.
        */
        get paddingRight() {
            return this.i.g3;
        }
        set paddingRight(v) {
            this.i.g3 = +v;
            this._a("paddingRight", this.i.g3);
        }
        /**
         * Gets or sets the amount of bottom padding to use for the cell content of this column.
        */
        get paddingBottom() {
            return this.i.g1;
        }
        set paddingBottom(v) {
            this.i.g1 = +v;
            this._a("paddingBottom", this.i.g1);
        }
        /**
         * Gets or sets an unique name of the Column
        */
        get name() {
            return this.i.il;
        }
        set name(v) {
            this.i.il = v;
        }
        /**
         * Gets or sets the key used for the column binding
        */
        get field() {
            return this.i.h4;
        }
        set field(v) {
            this.i.h4 = v;
        }
        /**
         * Gets or sets the text displayed in the header of the column
        */
        get headerText() {
            return this.i.h8;
        }
        set headerText(v) {
            this.i.h8 = v;
        }
        /**
         * Gets the actual text displayed in the header of the column
        */
        get actualHeaderText() {
            return this.i.hl;
        }
        set actualHeaderText(v) {
            this.i.hl = v;
        }
        /**
         * Gets or sets the background color to use for the cells when they are selected
        */
        get selectedBackground() {
            return brushToString(this.i.j1);
        }
        set selectedBackground(v) {
            this.i.j1 = stringToBrush(v);
            this._a("selectedBackground", brushToString(this.i.j1));
        }
        /**
         * Gets the actual background color that is used for the cells when they are selected
        */
        get actualSelectedBackground() {
            return brushToString(this.i.ju);
        }
        set actualSelectedBackground(v) {
            this.i.ju = stringToBrush(v);
            this._a("actualSelectedBackground", brushToString(this.i.ju));
        }
        /**
         * Gets or sets the background color to use for the cells when the row is hovered.
        */
        get rowHoverBackground() {
            return brushToString(this.i.jz);
        }
        set rowHoverBackground(v) {
            this.i.jz = stringToBrush(v);
            this._a("rowHoverBackground", brushToString(this.i.jz));
        }
        /**
         * Gets the actual background color that is used for the cells when they are hovered.
        */
        get actualHoverBackground() {
            return brushToString(this.i.js);
        }
        set actualHoverBackground(v) {
            this.i.js = stringToBrush(v);
            this._a("actualHoverBackground", brushToString(this.i.js));
        }
        /**
         * Gets or sets the text color to use for the cells when the row is hovered.
        */
        get rowHoverTextColor() {
            return brushToString(this.i.j0);
        }
        set rowHoverTextColor(v) {
            this.i.j0 = stringToBrush(v);
            this._a("rowHoverTextColor", brushToString(this.i.j0));
        }
        /**
         * Gets the actual text color that is used for the cells when they are hovered.
        */
        get actualRowHoverTextColor() {
            return brushToString(this.i.jt);
        }
        set actualRowHoverTextColor(v) {
            this.i.jt = stringToBrush(v);
            this._a("actualRowHoverTextColor", brushToString(this.i.jt));
        }
        /**
         * Gets or sets the animation settings to use for this column.
        */
        get animationSettings() {
            if (this.i.fe == null) {
                return null;
            }
            if (!this.i.fe.externalObject) {
                let e = new IgcGridColumnAnimationSettings();
                e._implementation = this.i.fe;
                this.i.fe.externalObject = e;
            }
            return this.i.fe.externalObject;
        }
        set animationSettings(v) {
            v == null ? this.i.fe = null : this.i.fe = v.i;
        }
        /**
         * Gets or sets the width to use for this column.
        */
        get width() {
            if (this.i.width == null) {
                return null;
            }
            if (!this.i.width.externalObject) {
                let e = new IgcColumnWidth();
                e._implementation = this.i.width;
                this.i.width.externalObject = e;
            }
            return this.i.width.externalObject;
        }
        set width(v) {
            if (typeof v == "string") {
                let int = ColumnWidth_internal.parse(v);
                let ext = new IgcColumnWidth();
                ext._implementation = int;
                v = ext;
            }
            v == null ? this.i.width = null : this.i.width = v.i;
        }
        /**
         * Gets or sets the minimum width to use for this column. Overrides the DefaultColumnMinWidth from the grid, if set.
        */
        get minWidth() {
            return this.i.gq;
        }
        set minWidth(v) {
            this.i.gq = +v;
            this._a("minWidth", this.i.gq);
        }
        /**
         * Gets whether this column was projected from markup/templates and is constrained.
        */
        get isFromMarkup() {
            return this.i.gg;
        }
        set isFromMarkup(v) {
            this.i.gg = ensureBool(v);
            this._a("isFromMarkup", this.i.gg);
        }
        /**
         * Gets whether this column was auto generated.
        */
        get isAutoGenerated() {
            return this.i.gb;
        }
        set isAutoGenerated(v) {
            this.i.gb = ensureBool(v);
            this._a("isAutoGenerated", this.i.gb);
        }
        /**
         * Gets or sets a filter to apply on the values of this column
        */
        get filter() {
            return this.i.eo;
        }
        set filter(v) {
            this.i.eo = v;
        }
        /**
         * Gets or sets the header definition for this column.
        */
        get header() {
            if (this.i.header == null) {
                return null;
            }
            if (!this.i.header.externalObject) {
                let e = IgcHeaderComponent._createFromInternal(this.i.header);
                if (e) {
                    e._implementation = this.i.header;
                }
                this.i.header.externalObject = e;
            }
            return this.i.header.externalObject;
        }
        set header(v) {
            if (v != null && this._stylingContainer && v._styling)
                v._styling(this._stylingContainer, this, this);
            v == null ? this.i.header = null : this.i.header = v.i;
        }
        /**
         * Gets or sets whether filtering is enabled for this column.
        */
        get isFilteringEnabled() {
            return this.i.gf;
        }
        set isFilteringEnabled(v) {
            this.i.gf = ensureBool(v);
            this._a("isFilteringEnabled", this.i.gf);
        }
        /**
         * Gets or sets whether resizing is enabled for this column.
        */
        get isResizingEnabled() {
            return this.i.gi;
        }
        set isResizingEnabled(v) {
            this.i.gi = ensureBool(v);
            this._a("isResizingEnabled", this.i.gi);
        }
        /**
         * Gets or sets whether or not a column is hidden from the grid
        */
        get isHidden() {
            return this.i.gh;
        }
        set isHidden(v) {
            this.i.gh = ensureBool(v);
            this._a("isHidden", this.i.gh);
        }
        /**
         * Gets or sets if a column should be removed from the grid when it is fully hidden
        */
        get shouldRemoveWhenHidden() {
            return this.i.gk;
        }
        set shouldRemoveWhenHidden(v) {
            this.i.gk = ensureBool(v);
            this._a("shouldRemoveWhenHidden", this.i.gk);
        }
        /**
         * Gets the current sort direction (None, Ascending, Descending) for this column.
        */
        get sortDirection() {
            return this.i.e6;
        }
        set sortDirection(v) {
            this.i.e6 = ensureEnum(ColumnSortDirection_$type, v);
            this._a("sortDirection", enumToString(ColumnSortDirection_$type, this.i.e6));
        }
        /**
         * Gets or sets the current fixed position for this column.
        */
        get pinned() {
            return this.i.fk;
        }
        set pinned(v) {
            this.i.fk = ensureEnum(PinnedPositions_$type, v);
            this._a("pinned", enumToString(PinnedPositions_$type, this.i.fk));
        }
        /**
         * Gets the actual column options icon alignment for this column.
        */
        get actualColumnOptionsIconAlignment() {
            return this.i.ex;
        }
        set actualColumnOptionsIconAlignment(v) {
            this.i.ex = ensureEnum(ColumnOptionsIconAlignment_$type, v);
            this._a("actualColumnOptionsIconAlignment", enumToString(ColumnOptionsIconAlignment_$type, this.i.ex));
        }
        /**
         * Gets or sets whether the column options icon is aligned opposite the header text or not.
        */
        get columnOptionsIconAlignment() {
            return this.i.ey;
        }
        set columnOptionsIconAlignment(v) {
            this.i.ey = ensureEnum(ColumnOptionsIconAlignment_$type, v);
            this._a("columnOptionsIconAlignment", enumToString(ColumnOptionsIconAlignment_$type, this.i.ey));
        }
        /**
         * Gets the actual column options icon color for this column.
        */
        get actualColumnOptionsIconColor() {
            return brushToString(this.i.jq);
        }
        set actualColumnOptionsIconColor(v) {
            this.i.jq = stringToBrush(v);
            this._a("actualColumnOptionsIconColor", brushToString(this.i.jq));
        }
        /**
         * Gets or sets the column options icon color for this column.
        */
        get columnOptionsIconColor() {
            return brushToString(this.i.jv);
        }
        set columnOptionsIconColor(v) {
            this.i.jv = stringToBrush(v);
            this._a("columnOptionsIconColor", brushToString(this.i.jv));
        }
        /**
         * Gets or sets how the column option icon will behave in the column header.
        */
        get columnOptionsIconBehavior() {
            return this.i.e2;
        }
        set columnOptionsIconBehavior(v) {
            this.i.e2 = ensureEnum(ColumnOptionsIconBehavior_$type, v);
            this._a("columnOptionsIconBehavior", enumToString(ColumnOptionsIconBehavior_$type, this.i.e2));
        }
        /**
         * Gets or sets how the column option icon will behave in the column header.
        */
        get actualColumnOptionsIconBehavior() {
            return this.i.e1;
        }
        set actualColumnOptionsIconBehavior(v) {
            this.i.e1 = ensureEnum(ColumnOptionsIconBehavior_$type, v);
            this._a("actualColumnOptionsIconBehavior", enumToString(ColumnOptionsIconBehavior_$type, this.i.e1));
        }
        /**
         * Gets the actual state of the column options for this column.
        */
        get actualIsColumnOptionsEnabled() {
            return this.i.f5;
        }
        set actualIsColumnOptionsEnabled(v) {
            this.i.f5 = ensureBool(v);
            this._a("actualIsColumnOptionsEnabled", this.i.f5);
        }
        /**
         * Gets or sets the preferred state of the column options for this column. If the feature is disabled at the grid level
         * then it will be disabled for the column regardless of what this is set to.
        */
        get isColumnOptionsEnabled() {
            return this.i.gc;
        }
        set isColumnOptionsEnabled(v) {
            this.i.gc = ensureBool(v);
            this._a("isColumnOptionsEnabled", this.i.gc);
        }
        /**
         * Gets the actual state of the column options for this column.
        */
        get actualIsColumnOptionsSummariesEnabled() {
            return this.i.f6;
        }
        set actualIsColumnOptionsSummariesEnabled(v) {
            this.i.f6 = ensureBool(v);
            this._a("actualIsColumnOptionsSummariesEnabled", this.i.f6);
        }
        /**
         * Gets or sets whether to show the summaries option in the column options menu for this column.
        */
        get isColumnOptionsSummariesEnabled() {
            return this.i.gd;
        }
        set isColumnOptionsSummariesEnabled(v) {
            this.i.gd = ensureBool(v);
            this._a("isColumnOptionsSummariesEnabled", this.i.gd);
        }
        /**
         * Gets or sets if the column is editable.
        */
        get isEditable() {
            return this.i.ge;
        }
        set isEditable(v) {
            this.i.ge = ensureBool(v);
            this._a("isEditable", this.i.ge);
        }
        /**
         * Gets or sets the text color used for deleted rows.
        */
        get deletedTextColor() {
            return brushToString(this.i.jw);
        }
        set deletedTextColor(v) {
            this.i.jw = stringToBrush(v);
            this._a("deletedTextColor", brushToString(this.i.jw));
        }
        /**
         * Gets the actual text color used for deleted rows.
        */
        get actualDeletedTextColor() {
            return brushToString(this.i.jr);
        }
        set actualDeletedTextColor(v) {
            this.i.jr = stringToBrush(v);
            this._a("actualDeletedTextColor", brushToString(this.i.jr));
        }
        /**
         * Gets or sets the opacity to use for unsaved edited cell values.
        */
        get editOpacity() {
            return this.i.gp;
        }
        set editOpacity(v) {
            this.i.gp = +v;
            this._a("editOpacity", this.i.gp);
        }
        /**
         * Gets the actual opacity for unsaved edited cell values.
        */
        get actualEditOpacity() {
            return this.i.go;
        }
        set actualEditOpacity(v) {
            this.i.go = +v;
            this._a("actualEditOpacity", this.i.go);
        }
        /**
         * Gets or sets the font style to use for unsaved cell edits.
        */
        get textEditStyle() {
            if (this.i.textEditStyle == null) {
                return null;
            }
            return this.i.textEditStyle.fontString;
        }
        set textEditStyle(v) {
            let fi = new FontInfo();
            fi.fontString = v;
            this.i.textEditStyle = fi;
            this._a("textEditStyle", this.i.textEditStyle != null ? this.i.textEditStyle.fontString : "");
        }
        /**
         * Gets the actual font style used for unsaved cell edits.
        */
        get actualEditFontInfo() {
            if (this.i.fp == null) {
                return null;
            }
            return this.i.fp.fontString;
        }
        set actualEditFontInfo(v) {
            let fi = new FontInfo();
            fi.fontString = v;
            this.i.fp = fi;
            this._a("actualEditFontInfo", this.i.fp != null ? this.i.fp.fontString : "");
        }
        findByName(name) {
            var baseResult = super.findByName(name);
            if (baseResult) {
                return baseResult;
            }
            if (this.animationSettings && this.animationSettings.name && this.animationSettings.name == name) {
                return this.animationSettings;
            }
            if (this.width && this.width.name && this.width.name == name) {
                return this.width;
            }
            if (this.header && this.header.name && this.header.name == name) {
                return this.header;
            }
            return null;
        }
        _styling(container, component, parent) {
            super._styling(container, component, parent);
            this._inStyling = true;
            if (this.header && this.header._styling) {
                this.header._styling(container, component, this);
            }
            this._inStyling = false;
        }
        /**
         * Get the unique key used to identify this column.
        
        */
        getUniqueKey() {
            let iv = this.i.h6();
            return (iv);
        }
        setNamedHeaderValue(valueName, animationType, value) {
            this.i.i2(valueName, (animationType == null ? null : animationType), value);
        }
        /**
         * Returns if the column has named header values.
        
        */
        hasNamedHeaderValues() {
            let iv = this.i.f9();
            return (iv);
        }
        /**
         * Returns if there is a named header value with a given name.
        
        * @param valueName  * The named value to check for.
        */
        hasNamedHeaderValue(valueName) {
            let iv = this.i.f8(valueName);
            return (iv);
        }
        /**
         * Removes a named header value with the given name from the named header values for this column.
        
        * @param valueName  * The named header value to remove.
        */
        removeNamedHeaderValue(valueName) {
            this.i.i1(valueName);
        }
        /**
         * Gets the value of a named header value for this column by name.
        
        * @param valueName  * Name of the named header value to retrieve.
        */
        getNamedHeaderValue(valueName) {
            let iv = this.i.g9(valueName);
            return (iv);
        }
        get actualHeaderTextChange() {
            return this._actualHeaderTextChange;
        }
        set actualHeaderTextChange(ev) {
            if (this._actualHeaderTextChange_wrapped !== null) {
                this.i.propertyChanged = delegateRemove(this.i.propertyChanged, this._actualHeaderTextChange_wrapped);
                this._actualHeaderTextChange_wrapped = null;
                this._actualHeaderTextChange = null;
            }
            this._actualHeaderTextChange = ev;
            this._actualHeaderTextChange_wrapped = (o, e) => {
                let ext = this.actualHeaderText;
                if (e.propertyName == 'Hl') {
                    if (this.beforeActualHeaderTextChange) {
                        this.beforeActualHeaderTextChange(this, ext);
                    }
                    if (this._actualHeaderTextChange) {
                        this._actualHeaderTextChange(this, ext);
                    }
                }
            };
            this.i.propertyChanged = delegateCombine(this.i.propertyChanged, this._actualHeaderTextChange_wrapped);
        }
    }
    IgcColumnComponent._observedAttributesIgcColumnComponent = null;
    return IgcColumnComponent;
})();
//# sourceMappingURL=igc-column-component.js.map
