igniteui-webcomponents-grids
Version:
Ignite UI Web Components grid components.
225 lines (224 loc) • 7.69 kB
JavaScript
import { EditorType_$type } from "./EditorType";
import { IgcDataGridColumnComponent } from "./igc-data-grid-column-component";
import { NumericColumn } from "./NumericColumn";
import { getAllPropertyNames, toSpinal, ensureBool, ensureEnum, enumToString, arrayFindByName } from "igniteui-webcomponents-core";
import { RegisterElementHelper } from "igniteui-webcomponents-core";
/**
* Represents a Numeric grid column, used to allow the developer to display a formatted number in a cell.
*/
export let IgcNumericColumnComponent = /*@__PURE__*/ (() => {
class IgcNumericColumnComponent extends IgcDataGridColumnComponent {
createImplementation() {
return new NumericColumn();
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
constructor() {
super();
}
connectedCallback() {
if (super["connectedCallback"]) {
super["connectedCallback"]();
}
if (this.i.connectedCallback) {
this.i.connectedCallback();
}
if (this.updateContentChildren) {
this.updateContentChildren();
}
else if (this._updateAdapters) {
this._updateAdapters();
}
if (!this._attached) {
this._attached = true;
this._flushQueuedAttributes();
}
}
disconnectedCallback() {
if (super["disconnectedCallback"]) {
super["disconnectedCallback"]();
}
if (this.i.disconnectedCallback) {
this.i.disconnectedCallback();
}
if (this._attached) {
this._attached = false;
}
}
static get observedAttributes() {
if (IgcNumericColumnComponent._observedAttributesIgcNumericColumnComponent == null) {
let names = getAllPropertyNames(IgcNumericColumnComponent);
for (let i = 0; i < names.length; i++) {
names[i] = toSpinal(names[i]);
}
IgcNumericColumnComponent._observedAttributesIgcNumericColumnComponent = names;
}
return IgcNumericColumnComponent._observedAttributesIgcNumericColumnComponent;
}
static register() {
if (!IgcNumericColumnComponent._isElementRegistered) {
IgcNumericColumnComponent._isElementRegistered = true;
RegisterElementHelper.registerElement(IgcNumericColumnComponent.htmlTagName, IgcNumericColumnComponent);
}
}
/**
* Gets or sets the string to prefix a negative value. If FormatString is specificied this value is ignored.
*/
get negativePrefix() {
return this.i.oy;
}
set negativePrefix(v) {
this.i.oy = v;
}
/**
* Gets or sets the string to prefix a positive value. If FormatString is specificied this value is ignored.
*/
get positivePrefix() {
return this.i.o2;
}
set positivePrefix(v) {
this.i.o2 = v;
}
/**
* Gets or sets the string to suffix a negative value. If FormatString is specificied this value is ignored.
*/
get negativeSuffix() {
return this.i.o0;
}
set negativeSuffix(v) {
this.i.o0 = v;
}
/**
* Gets or sets the string to suffix a positive value. If FormatString is specificied this value is ignored.
*/
get positiveSuffix() {
return this.i.o4;
}
set positiveSuffix(v) {
this.i.o4 = v;
}
/**
* Gets or sets the maximum fraction digits. If FormatString is specificied this value is ignored.
*/
get maxFractionDigits() {
return this.i.od;
}
set maxFractionDigits(v) {
this.i.od = +v;
this._a("maxFractionDigits", this.i.od);
}
/**
* Gets or sets the minimum fraction digits. If FormatString is specificied this value is ignored.
*/
get minFractionDigits() {
return this.i.oe;
}
set minFractionDigits(v) {
this.i.oe = +v;
this._a("minFractionDigits", this.i.oe);
}
/**
* Gets or sets the minimum integer digits. If FormatString is specificied this value is ignored.
*/
get minIntegerDigits() {
return this.i.of;
}
set minIntegerDigits(v) {
this.i.of = +v;
this._a("minIntegerDigits", this.i.of);
}
/**
* Gets or sets whether to show a grouping separator. If FormatString is specificied this value is ignored.
*/
get showGroupingSeparator() {
return this.i.n8;
}
set showGroupingSeparator(v) {
this.i.n8 = ensureBool(v);
this._a("showGroupingSeparator", this.i.n8);
}
/**
* Gets or sets the format string to apply to the value. If set, the other value formatting properties on this column are ignored.
*/
get formatString() {
return this.i.ot;
}
set formatString(v) {
this.i.ot = v;
}
get formatSpecifiers() {
return this.i.n4;
}
set formatSpecifiers(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.n4 = v;
}
/**
* Gets or sets the INTL NumericFormat object to use for formatting the date values.
*/
get formatOverride() {
return this.i.oi;
}
set formatOverride(v) {
this.i.oi = v;
}
/**
* Gets or sets the editor type used for editing cells in this column.
*/
get editorType() {
return this.i.n6;
}
set editorType(v) {
this.i.n6 = ensureEnum(EditorType_$type, v);
this._a("editorType", enumToString(EditorType_$type, this.i.n6));
}
/**
* Gets or sets the ComboBox data source.
*/
get editorDataSource() {
return this.i.oh;
}
set editorDataSource(v) {
this.i.oh = v;
}
/**
* Gets or sets the ComboBox text field.
*/
get editorTextField() {
return this.i.oo;
}
set editorTextField(v) {
this.i.oo = v;
}
/**
* Gets or sets the ComboBox value field.
*/
get editorValueField() {
return this.i.op;
}
set editorValueField(v) {
this.i.op = v;
}
findByName(name) {
var baseResult = super.findByName(name);
if (baseResult) {
return baseResult;
}
if (this.formatSpecifiers != null && arrayFindByName(this.formatSpecifiers, name)) {
return arrayFindByName(this.formatSpecifiers, name);
}
return null;
}
}
IgcNumericColumnComponent._observedAttributesIgcNumericColumnComponent = null;
IgcNumericColumnComponent.htmlTagName = "igc-numeric-column";
IgcNumericColumnComponent._isElementRegistered = false;
return IgcNumericColumnComponent;
})();