igniteui-webcomponents-grids
Version:
Ignite UI Web Components grid components.
388 lines (387 loc) • 14.9 kB
JavaScript
import { __extends } from "tslib";
import { ensureEnum, brushToString, stringToBrush, initializePropertiesFromCss, NamePatcher, toSpinal, enumToString, getAllPropertyNames, fromSpinal } from "igniteui-webcomponents-core";
import { FontInfo } from "igniteui-webcomponents-core";
import { WebComponentRenderer } from "igniteui-webcomponents-core";
import { TypeRegistrar } from "igniteui-webcomponents-core";
import { RegisterElementHelper } from "igniteui-webcomponents-core";
import { ColumnPinning } from './ColumnPinning';
import { BaseControlTheme_$type } from "igniteui-webcomponents-core";
import { ControlDisplayDensity_$type } from "igniteui-webcomponents-core";
import { IgcHTMLElement } from "igniteui-webcomponents-core";
var IgcColumnPinningComponent = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgcColumnPinningComponent, _super);
function IgcColumnPinningComponent() {
var _this = _super.call(this) || this;
_this._disconnected = false;
_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._renderer = new WebComponentRenderer(_this, document, true, null);
_this._implementation = _this.createImplementation();
_this._container = _this._renderer.createElement("div");
_this._renderer.updateRoot(_this._container);
//this._renderer.rootWrapper.append(this._container);
_this._container.setStyleProperty("display", "block");
_this._container.setStyleProperty("width", "100%");
_this._container.setStyleProperty("height", "100%");
var columnPinning = _this.i;
_this._columnPinning = columnPinning;
_this._renderer.addSizeWatcher(function () {
_this._columnPinning.notifySizeChanged();
});
return _this;
}
Object.defineProperty(IgcColumnPinningComponent.prototype, "height", {
get: function () {
return this._height;
},
set: function (value) {
this._height = value;
this.style.height = value;
this.i.notifySizeChanged();
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcColumnPinningComponent.prototype, "width", {
get: function () {
return this._width;
},
set: function (value) {
this._width = value;
this.style.width = value;
this.i.notifySizeChanged();
},
enumerable: false,
configurable: true
});
// supports angular themes or custom properties set in CSS
IgcColumnPinningComponent.prototype.updateStyle = function () {
this._styling(this, this);
};
IgcColumnPinningComponent.prototype.destroy = function () {
this._columnPinning.destroy();
};
IgcColumnPinningComponent.prototype.createImplementation = function () {
return new ColumnPinning();
};
IgcColumnPinningComponent.prototype.disconnectedCallback = function () {
this._disconnected = true;
};
IgcColumnPinningComponent.prototype.connectedCallback = function () {
if (this._disconnected) {
this._disconnected = false;
return;
}
this.classList.add("ig-column-pinning");
this.classList.add("igc-column-pinning");
var rootWrapper = this._renderer.rootWrapper;
var rootElement = rootWrapper.getNativeElement();
this.appendChild(rootElement);
this._attached = true;
this.style.display = "block";
this.style.height = this._height;
this.style.width = this._width;
var title = this._renderer.createElement("span");
this._container.append(title);
var checkboxList = this._renderer.createElement("igc-checkbox-list");
this._container.append(checkboxList);
this._columnPinning.provideContainer(this._renderer, checkboxList.getNativeElement().i);
this._columnPinning.notifySizeChanged();
this._flushQueuedAttributes();
// supports themes or custom properties set in CSS
this._styling(this, this);
this.afterContentInit();
};
IgcColumnPinningComponent.prototype.afterContentInit = function () {
this.i.notifySizeChanged();
};
Object.defineProperty(IgcColumnPinningComponent.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
} /**
* @hidden
*/,
enumerable: false,
configurable: true
});
IgcColumnPinningComponent._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);
};
IgcColumnPinningComponent.prototype._enqueueSetAttribute = function (attrName, attrValue) {
this._queuedSetAttributes.push({ attrName: attrName, attrValue: attrValue });
};
IgcColumnPinningComponent.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;
};
IgcColumnPinningComponent.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;
};
Object.defineProperty(IgcColumnPinningComponent, "observedAttributes", {
get: function () {
if (IgcColumnPinningComponent._observedAttributesIgcColumnPinningComponent == null) {
var names = getAllPropertyNames(IgcColumnPinningComponent);
for (var i = 0; i < names.length; i++) {
names[i] = toSpinal(names[i]);
}
IgcColumnPinningComponent._observedAttributesIgcColumnPinningComponent = names;
}
return IgcColumnPinningComponent._observedAttributesIgcColumnPinningComponent;
},
enumerable: false,
configurable: true
});
IgcColumnPinningComponent.prototype.attributeChangedCallback = function (name, oldValue, newValue) {
if (this._settingAttributes) {
return;
}
var setName = fromSpinal(name);
this._updatingFromAttribute = true;
this[setName] = newValue;
this._updatingFromAttribute = false;
};
IgcColumnPinningComponent.register = function () {
if (!IgcColumnPinningComponent._isElementRegistered) {
IgcColumnPinningComponent._isElementRegistered = true;
RegisterElementHelper.registerElement(IgcColumnPinningComponent.htmlTagName, IgcColumnPinningComponent);
}
};
Object.defineProperty(IgcColumnPinningComponent.prototype, "targetGrid", {
/**
* Gets or Sets the property name that contains the values.
*/
get: function () {
var r = this.i.c;
if (r == null) {
return null;
}
return r.externalObject;
},
set: function (v) {
if (v != null && this._stylingContainer && v._styling)
v._styling(this._stylingContainer, this, this);
v == null ? this.i.c = null : this.i.c = v.i;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcColumnPinningComponent.prototype, "title", {
/**
* Gets or Sets the property name that contains the values.
*/
get: function () {
return this.i.v;
},
set: function (v) {
this.i.v = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcColumnPinningComponent.prototype, "titleStyle", {
/**
* Gets or Sets the property name that contains the values.
*/
get: function () {
if (this.i.j == null) {
return null;
}
return this.i.j.fontString;
},
set: function (v) {
var fi = new FontInfo();
fi.fontString = v;
this.i.j = fi;
this._a("titleStyle", this.i.j != null ? this.i.j.fontString : "");
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcColumnPinningComponent.prototype, "titleColor", {
/**
* Gets or Sets the property name that contains the values.
*/
get: function () {
return brushToString(this.i.ao);
},
set: function (v) {
this.i.ao = stringToBrush(v);
this._a("titleColor", brushToString(this.i.ao));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcColumnPinningComponent.prototype, "filterPlaceholderText", {
/**
* Gets or Sets the property name that contains the values.
*/
get: function () {
return this.i.s;
},
set: function (v) {
this.i.s = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcColumnPinningComponent.prototype, "baseTheme", {
/**
* Gets or Sets the property name that contains the values.
*/
get: function () {
return this.i.f;
},
set: function (v) {
this.i.f = ensureEnum(BaseControlTheme_$type, v);
this._a("baseTheme", enumToString(BaseControlTheme_$type, this.i.f));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcColumnPinningComponent.prototype, "density", {
/**
* Gets or Sets the property name that contains the values.
*/
get: function () {
return this.i.h;
},
set: function (v) {
this.i.h = ensureEnum(ControlDisplayDensity_$type, v);
this._a("density", enumToString(ControlDisplayDensity_$type, this.i.h));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcColumnPinningComponent.prototype, "backgroundColor", {
/**
* Gets or Sets the property name that contains the values.
*/
get: function () {
return brushToString(this.i.an);
},
set: function (v) {
this.i.an = stringToBrush(v);
this._a("backgroundColor", brushToString(this.i.an));
},
enumerable: false,
configurable: true
});
IgcColumnPinningComponent.prototype.findByName = function (name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
if (this.targetGrid && this.targetGrid.name && this.targetGrid.name == name) {
return this.targetGrid;
}
return null;
};
Object.defineProperty(IgcColumnPinningComponent.prototype, "hasUserValues", {
get: function () {
return this._hasUserValues;
},
enumerable: false,
configurable: true
});
IgcColumnPinningComponent.prototype.__m = function (propertyName) {
if (!this._inStyling) {
this._hasUserValues.add(propertyName);
}
};
IgcColumnPinningComponent.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("ColumnPinningComponent");
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.targetGrid && this.targetGrid._styling) {
this.targetGrid._styling(container, component, this);
}
if (this._otherStyling) {
this._otherStyling(container, component, parent);
}
this._inStyling = false;
};
IgcColumnPinningComponent._observedAttributesIgcColumnPinningComponent = null;
IgcColumnPinningComponent.htmlTagName = "igc-column-pinning";
IgcColumnPinningComponent._isElementRegistered = false;
return IgcColumnPinningComponent;
}(IgcHTMLElement));
export { IgcColumnPinningComponent };