igniteui-webcomponents-inputs
Version:
Ignite UI Web Components inputs components.
228 lines (225 loc) • 8.24 kB
JavaScript
import { __extends, __values } from "tslib";
import { XPrefix } from "./XPrefix";
import { ensureBool, NamePatcher, toSpinal, getAllPropertyNames } from "igniteui-webcomponents-core";
import { WebComponentRenderer, PortalManager } from "igniteui-webcomponents-core";
import { RegisterElementHelper } from "igniteui-webcomponents-core";
import { IgcXInputGroupItemComponent } from './igc-x-input-group-item-component';
export var IgcXPrefixComponent = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgcXPrefixComponent, _super);
function IgcXPrefixComponent() {
var _this = _super.call(this) || this;
_this._disconnected = false;
if (_this._styling) {
NamePatcher.ensureStylablePatched(Object.getPrototypeOf(_this));
}
_this._portalManager = new PortalManager("prefixContent");
_this._renderer = new WebComponentRenderer(_this, document, true, {}, _this._portalManager);
_this._container = _this._renderer.createElement("div");
_this._renderer.updateRoot(_this._container);
_this._implementation = _this.createImplementation();
_this._implementation.externalObject = _this;
//this._container.setStyleProperty("width", "100%");
//this._container.setStyleProperty("height", "100%");
var root;
root = _this._container;
if (_this._container.getNativeElement() != null) {
root = _this._container.getNativeElement();
}
_this._wrapper = _this._renderer;
var prefix = _this.i;
_this._prefix = prefix;
prefix.provideContainer(_this._renderer);
_this._onChildrenChanged();
//Checkbox.notifySizeChanged();
var mut = new MutationObserver(function (list) {
var e_1, _b;
try {
for (var list_1 = __values(list), list_1_1 = list_1.next(); !list_1_1.done; list_1_1 = list_1.next()) {
var mutation = list_1_1.value;
if (mutation.type == 'childList') {
_this._onChildrenChanged();
}
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (list_1_1 && !list_1_1.done && (_b = list_1.return))
_b.call(list_1);
}
finally {
if (e_1)
throw e_1.error;
}
}
});
mut.observe(_this, {
childList: true
});
return _this;
//this._renderer.addSizeWatcher(() => {
// this._checkbox.notifySizeChanged();
//});
}
IgcXPrefixComponent.prototype._onChildrenChanged = function () {
var children = [];
for (var i = 0; i < this.childNodes.length; i++) {
var child = this.childNodes[i];
if (child !== this._container.getNativeElement()) {
children.push(child);
}
}
this._portalManager.onChildrenChanged(children);
};
// supports angular themes or custom properties set in CSS
IgcXPrefixComponent.prototype.updateStyle = function () {
this._styling(this, this);
};
IgcXPrefixComponent.prototype.destroy = function () {
this._prefix.destroy();
this._wrapper.destroy();
};
IgcXPrefixComponent.prototype.createImplementation = function () {
return new XPrefix();
};
IgcXPrefixComponent.prototype.disconnectedCallback = function () {
this._disconnected = true;
if (this.i) {
this.i.onDetachedFromUI();
}
};
IgcXPrefixComponent.prototype.connectedCallback = function () {
if (this._disconnected) {
this._disconnected = false;
if (this.i) {
this.i.onAttachedToUI();
}
return;
}
this.classList.add("ig-x-prefix");
this.classList.add("igc-x-prefix");
this.appendChild(this._container.getNativeElement());
this._attached = true;
this.style.display = "inline-block";
this.style.verticalAlign = "middle";
//this.style.height = this._height;
//this.style.width = this._width;
this._flushQueuedAttributes();
// supports themes or custom properties set in CSS
this._styling(this, this);
this.afterContentInit();
};
IgcXPrefixComponent.prototype.afterContentInit = function () {
//this.i.notifySizeChanged();
};
Object.defineProperty(IgcXPrefixComponent.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcXPrefixComponent, "observedAttributes", {
get: function () {
if (IgcXPrefixComponent._observedAttributesIgcXPrefixComponent == null) {
var names = getAllPropertyNames(IgcXPrefixComponent);
for (var i = 0; i < names.length; i++) {
names[i] = toSpinal(names[i]);
}
IgcXPrefixComponent._observedAttributesIgcXPrefixComponent = names;
}
return IgcXPrefixComponent._observedAttributesIgcXPrefixComponent;
},
enumerable: false,
configurable: true
});
IgcXPrefixComponent.register = function () {
if (!IgcXPrefixComponent._isElementRegistered) {
IgcXPrefixComponent._isElementRegistered = true;
RegisterElementHelper.registerElement(IgcXPrefixComponent.htmlTagName, IgcXPrefixComponent);
}
};
Object.defineProperty(IgcXPrefixComponent.prototype, "id", {
/**
* Gets or sets the id to use for the checkbox.
*/
get: function () {
return this.i.z;
},
set: function (v) {
this.i.z = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcXPrefixComponent.prototype, "ariaLabel", {
/**
* Gets or sets the value of the aria-label attribute.
*/
get: function () {
return this.i.w;
},
set: function (v) {
this.i.w = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcXPrefixComponent.prototype, "isHover", {
/**
* Gets or sets whether the prefix is hovered.
*/
get: function () {
return this.i.q;
},
set: function (v) {
this.i.q = ensureBool(v);
this._a("isHover", this.i.q);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcXPrefixComponent.prototype, "disabled", {
/**
* Gets or sets whether the checkbox is disabled.
*/
get: function () {
return this.i.disabled;
},
set: function (v) {
this.i.disabled = ensureBool(v);
this._a("disabled", this.i.disabled);
},
enumerable: false,
configurable: true
});
IgcXPrefixComponent.prototype.onDetachedFromUI = function () {
this.i.onDetachedFromUI();
};
IgcXPrefixComponent.prototype.onAttachedToUI = function () {
this.i.onAttachedToUI();
};
/**
* Exports visual information about the current state of the grid.
*/
IgcXPrefixComponent.prototype.exportVisualModel = function () {
var iv = this.i.t();
return (iv);
};
/**
* Returns a serialized copy of the exported visual model
*/
IgcXPrefixComponent.prototype.exportSerializedVisualModel = function () {
var iv = this.i.y();
return (iv);
};
IgcXPrefixComponent._observedAttributesIgcXPrefixComponent = null;
IgcXPrefixComponent.htmlTagName = "igc-x-prefix";
IgcXPrefixComponent._isElementRegistered = false;
return IgcXPrefixComponent;
}(IgcXInputGroupItemComponent));