UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

149 lines (148 loc) 3.6 kB
import { IgrCellInfo } from "./igr-cell-info"; import { NumericCellModel as NumericCellModel_internal } from "./NumericCellModel"; import { ensureBool, arrayFindByName } from "igniteui-react-core"; /** * Backing information for a numeric cell in the grid. */ export class IgrNumericCellInfo extends IgrCellInfo { createImplementation() { return new NumericCellModel_internal(); } /** * @hidden */ get i() { return this._implementation; } constructor() { super(); } /** * Sets or gets the numeric value to use for the cell. */ get numericValue() { return this.i.mo; } set numericValue(v) { this.i.mo = +v; } /** * Sets or gets whether there is a decimal numeric value to use for the cell. */ get hasDecimalValue() { return this.i.mk; } set hasDecimalValue(v) { this.i.mk = ensureBool(v); } /** * The format string to apply to the value */ get formatStringOverride() { return this.i.ni; } set formatStringOverride(v) { this.i.ni = v; } get formatSpecifiers() { return this.i.mg; } set formatSpecifiers(v) { if (v && !Array.isArray(v) && typeof (v) == "string") { const re = /\s*(?:,|\s|$)\s*/gm; v = v.split(re); } this.i.mg = v; } /** * The format options to apply to the value */ get formatOverride() { return this.i.na; } set formatOverride(v) { this.i.na = v; } /** * Sets or gets the text prepended to a negative numeric value */ get negativePrefix() { return this.i.no; } set negativePrefix(v) { this.i.no = v; } /** * Sets or gets the text prepended to a positive numeric value */ get positivePrefix() { return this.i.nt; } set positivePrefix(v) { this.i.nt = v; } /** * Sets or gets the text appended to a negative numeric value */ get negativeSuffix() { return this.i.nq; } set negativeSuffix(v) { this.i.nq = v; } /** * Sets or gets the text appended to a positive numeric value */ get positiveSuffix() { return this.i.nv; } set positiveSuffix(v) { this.i.nv = v; } /** * The maximum number of decimal places to display when formatting */ get maxFractionDigits() { return this.i.mw; } set maxFractionDigits(v) { this.i.mw = +v; } /** * The minimum number of decimal places to display when formatting */ get minFractionDigits() { return this.i.my; } set minFractionDigits(v) { this.i.my = +v; } /** * The minimum number of integer digits to display when formatting */ get minIntegerDigits() { return this.i.m0; } set minIntegerDigits(v) { this.i.m0 = +v; } /** * Sets or gets if the grouping separator is shown */ get showGroupingSeparator() { return this.i.mm; } set showGroupingSeparator(v) { this.i.mm = ensureBool(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; } }