igniteui-webcomponents-grids
Version:
Ignite UI Web Components grid components.
403 lines (402 loc) • 15.3 kB
JavaScript
import { __extends } from "tslib";
import { IgcHTMLElement } from "igniteui-webcomponents-core";
import { BaseControlTheme_$type } from "igniteui-webcomponents-core";
import { ControlDisplayDensity_$type } from "igniteui-webcomponents-core";
import { IgcDataGridColumnComponent } from "./igc-data-grid-column-component";
import { TypeRegistrar } from "igniteui-webcomponents-core";
import { NamePatcher, getAllPropertyNames, fromSpinal, toSpinal, ensureBool, brushToString, stringToBrush, ensureEnum, enumToString, initializePropertiesFromCss } from "igniteui-webcomponents-core";
import { FontInfo } from "igniteui-webcomponents-core";
var IgcGridColumnOptionsBaseComponent = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgcGridColumnOptionsBaseComponent, _super);
function IgcGridColumnOptionsBaseComponent() {
var _this = _super.call(this) || this;
_this._settingAttributes = false;
_this._attached = false;
_this._queuedSetAttributes = [];
_this._updatingFromAttribute = false;
_this.__p = null;
_this._hasUserValues = new Set();
_this._stylingContainer = null;
_this._stylingParent = null;
_this._inStyling = false;
if (_this._styling) {
NamePatcher.ensureStylablePatched(Object.getPrototypeOf(_this));
}
_this._implementation = _this.createImplementation();
_this._implementation.externalObject = _this;
_this.onImplementationCreated();
if (_this._initializeAdapters) {
_this._initializeAdapters();
}
return _this;
}
IgcGridColumnOptionsBaseComponent.prototype.createImplementation = function () {
return null;
};
Object.defineProperty(IgcGridColumnOptionsBaseComponent.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
} /**
* @hidden
*/,
enumerable: false,
configurable: true
});
IgcGridColumnOptionsBaseComponent._createFromInternal = function (internal) {
if (!internal) {
return null;
}
if (!internal.$type) {
return null;
}
var name = internal.$type.name;
var externalName = "Igc" + name + "Component";
if (!TypeRegistrar.isRegistered(externalName)) {
return null;
}
return TypeRegistrar.create(externalName);
};
IgcGridColumnOptionsBaseComponent.prototype.onImplementationCreated = function () {
};
IgcGridColumnOptionsBaseComponent.prototype._enqueueSetAttribute = function (attrName, attrValue) {
this._queuedSetAttributes.push({ attrName: attrName, attrValue: attrValue });
};
IgcGridColumnOptionsBaseComponent.prototype._flushQueuedAttributes = function () {
this._settingAttributes = true;
for (var i = 0; i < this._queuedSetAttributes.length; i++) {
this.setAttribute(this._queuedSetAttributes[i].attrName, this._queuedSetAttributes[i].attrValue);
}
this._settingAttributes = false;
this._queuedSetAttributes.length = 0;
};
IgcGridColumnOptionsBaseComponent.prototype._a = function (attrName, attrValue) {
if (this._updatingFromAttribute) {
return;
}
if (attrValue) {
attrValue = attrValue.toString();
}
this._settingAttributes = true;
attrName = toSpinal(attrName);
if (this._attached) {
this.setAttribute(attrName, attrValue);
}
else {
this._enqueueSetAttribute(attrName, attrValue);
}
this._settingAttributes = false;
};
IgcGridColumnOptionsBaseComponent.prototype.connectedCallback = function () {
if (_super.prototype["connectedCallback"]) {
_super.prototype["connectedCallback"].call(this);
}
if (this.i.connectedCallback) {
this.i.connectedCallback();
}
if (!this._attached) {
this._attached = true;
this._flushQueuedAttributes();
}
};
IgcGridColumnOptionsBaseComponent.prototype.disconnectedCallback = function () {
if (_super.prototype["disconnectedCallback"]) {
_super.prototype["disconnectedCallback"].call(this);
}
if (this.i.disconnectedCallback) {
this.i.disconnectedCallback();
}
if (this._attached) {
this._attached = false;
}
};
Object.defineProperty(IgcGridColumnOptionsBaseComponent, "observedAttributes", {
get: function () {
if (IgcGridColumnOptionsBaseComponent._observedAttributesIgcGridColumnOptionsBaseComponent == null) {
var names = getAllPropertyNames(IgcGridColumnOptionsBaseComponent);
for (var i = 0; i < names.length; i++) {
names[i] = toSpinal(names[i]);
}
IgcGridColumnOptionsBaseComponent._observedAttributesIgcGridColumnOptionsBaseComponent = names;
}
return IgcGridColumnOptionsBaseComponent._observedAttributesIgcGridColumnOptionsBaseComponent;
},
enumerable: false,
configurable: true
});
IgcGridColumnOptionsBaseComponent.prototype.attributeChangedCallback = function (name, oldValue, newValue) {
if (this._settingAttributes) {
return;
}
var setName = fromSpinal(name);
this._updatingFromAttribute = true;
this[setName] = newValue;
this._updatingFromAttribute = false;
};
Object.defineProperty(IgcGridColumnOptionsBaseComponent.prototype, "autoSize", {
/**
* Gets or sets the autoSize for which this AutoSizeOptions will apply.
*/
get: function () {
return this.i.ak;
},
set: function (v) {
this.i.ak = ensureBool(v);
this._a("autoSize", this.i.ak);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridColumnOptionsBaseComponent.prototype, "backgroundColor", {
/**
* Gets or sets the color to use for the background of the component.
*/
get: function () {
return brushToString(this.i.bo);
},
set: function (v) {
this.i.bo = stringToBrush(v);
this._a("backgroundColor", brushToString(this.i.bo));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridColumnOptionsBaseComponent.prototype, "baseTheme", {
/**
* Gets or sets the base built in theme to use for the component.
*/
get: function () {
return this.i.j;
},
set: function (v) {
this.i.j = ensureEnum(BaseControlTheme_$type, v);
this._a("baseTheme", enumToString(BaseControlTheme_$type, this.i.j));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridColumnOptionsBaseComponent.prototype, "actualBaseTheme", {
/**
* Gets the actual display baseTheme to use for the component.
*/
get: function () {
return this.i.i;
},
set: function (v) {
this.i.i = ensureEnum(BaseControlTheme_$type, v);
this._a("actualBaseTheme", enumToString(BaseControlTheme_$type, this.i.i));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridColumnOptionsBaseComponent.prototype, "buttonDensity", {
/**
* Gets or sets the display Density to use for the buttons in the component.
*/
get: function () {
return this.i.buttonDensity;
},
set: function (v) {
this.i.buttonDensity = ensureEnum(ControlDisplayDensity_$type, v);
this._a("buttonDensity", enumToString(ControlDisplayDensity_$type, this.i.buttonDensity));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridColumnOptionsBaseComponent.prototype, "actualButtonDensity", {
/**
* Gets the actual display buttonDensity to use for the component.
*/
get: function () {
return this.i.p;
},
set: function (v) {
this.i.p = ensureEnum(ControlDisplayDensity_$type, v);
this._a("actualButtonDensity", enumToString(ControlDisplayDensity_$type, this.i.p));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridColumnOptionsBaseComponent.prototype, "buttonTextStyle", {
/**
* Gets or sets the font to use for buttons.
*/
get: function () {
if (this.i.ab == null) {
return null;
}
return this.i.ab.fontString;
},
set: function (v) {
var fi = new FontInfo();
fi.fontString = v;
this.i.ab = fi;
this._a("buttonTextStyle", this.i.ab != null ? this.i.ab.fontString : "");
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridColumnOptionsBaseComponent.prototype, "column", {
/**
* Gets or sets the column for which this ColumnOptions will apply.
*/
get: function () {
var r = this.i.column;
if (r == null) {
return null;
}
if (!r.externalObject) {
var e = IgcDataGridColumnComponent._createFromInternal(r);
if (e) {
e._implementation = r;
}
r.externalObject = e;
}
return r.externalObject;
},
set: function (v) {
if (v != null && this._stylingContainer && v._styling)
v._styling(this._stylingContainer, this, this);
v == null ? this.i.column = null : this.i.column = v.i;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridColumnOptionsBaseComponent.prototype, "density", {
/**
* Gets or sets the display density to use for the component.
*/
get: function () {
return this.i.density;
},
set: function (v) {
this.i.density = ensureEnum(ControlDisplayDensity_$type, v);
this._a("density", enumToString(ControlDisplayDensity_$type, this.i.density));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridColumnOptionsBaseComponent.prototype, "actualDensity", {
/**
* Gets the actual display density to use for the component.
*/
get: function () {
return this.i.q;
},
set: function (v) {
this.i.q = ensureEnum(ControlDisplayDensity_$type, v);
this._a("actualDensity", enumToString(ControlDisplayDensity_$type, this.i.q));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridColumnOptionsBaseComponent.prototype, "labelTextStyle", {
/**
* Gets or sets the font to use for labels.
*/
get: function () {
if (this.i.ag == null) {
return null;
}
return this.i.ag.fontString;
},
set: function (v) {
var fi = new FontInfo();
fi.fontString = v;
this.i.ag = fi;
this._a("labelTextStyle", this.i.ag != null ? this.i.ag.fontString : "");
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridColumnOptionsBaseComponent.prototype, "textColor", {
/**
* Gets or sets the color to use for the text of the component.
*/
get: function () {
return brushToString(this.i.br);
},
set: function (v) {
this.i.br = stringToBrush(v);
this._a("textColor", brushToString(this.i.br));
},
enumerable: false,
configurable: true
});
IgcGridColumnOptionsBaseComponent.prototype.findByName = function (name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
if (this.column && this.column.name && this.column.name == name) {
return this.column;
}
return null;
};
Object.defineProperty(IgcGridColumnOptionsBaseComponent.prototype, "hasUserValues", {
get: function () {
return this._hasUserValues;
},
enumerable: false,
configurable: true
});
IgcGridColumnOptionsBaseComponent.prototype.__m = function (propertyName) {
if (!this._inStyling) {
this._hasUserValues.add(propertyName);
}
};
IgcGridColumnOptionsBaseComponent.prototype._styling = function (container, component, parent) {
if (this._inStyling) {
return;
}
this._inStyling = true;
this._stylingContainer = container;
this._stylingParent = component;
var genericPrefix = "";
var typeName = this.i.$type.name;
if (typeName.indexOf("Xam") === 0) {
typeName = typeName.substring(3);
}
genericPrefix = toSpinal("GridColumnOptionsBaseComponent");
var additionalPrefixes = [];
var prefix = toSpinal(typeName);
additionalPrefixes.push(prefix + "-");
var b = this.i.$type.baseType;
while (b && b.name != "Object" &&
b.name != "Base" &&
b.name != "Control" &&
b.Name != "DependencyObject" &&
b.Name != "FrameworkElement") {
typeName = b.name;
if (typeName.indexOf("Xam") === 0) {
typeName = typeName.substring(3);
}
var basePrefix = toSpinal(typeName);
additionalPrefixes.push(basePrefix + "-");
b = b.baseType;
}
if (parent) {
var parentTypeName = parent.i.$type.name;
if (parentTypeName.indexOf("Xam") === 0) {
parentTypeName = parentTypeName.substring(3);
}
var parentPrefix = toSpinal(parentTypeName);
additionalPrefixes.push(parentPrefix + "-" + genericPrefix + "-");
additionalPrefixes.push(parentPrefix + "-" + prefix + "-");
}
initializePropertiesFromCss(container, this, genericPrefix + "-", this.hasUserValues, false, additionalPrefixes);
if (this.column && this.column._styling) {
this.column._styling(container, component, this);
}
if (this._otherStyling) {
this._otherStyling(container, component, parent);
}
this._inStyling = false;
};
IgcGridColumnOptionsBaseComponent._observedAttributesIgcGridColumnOptionsBaseComponent = null;
return IgcGridColumnOptionsBaseComponent;
}(IgcHTMLElement));
export { IgcGridColumnOptionsBaseComponent };