igniteui-react-grids
Version:
Ignite UI React grid components.
87 lines (86 loc) • 2.27 kB
JavaScript
import { DateTimeFormats_$type } from "./DateTimeFormats";
import { IgrCellInfo } from "./igr-cell-info";
import { DateTimeCellModel as DateTimeCellModel_internal } from "./DateTimeCellModel";
import { ensureEnum, ensureBool, arrayFindByName } from "igniteui-react-core";
/**
* Backing information about a date time cell for the grid.
*/
export class IgrDateTimeCellInfo extends IgrCellInfo {
createImplementation() {
return new DateTimeCellModel_internal();
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
constructor() {
super();
}
/**
* Sets or gets the DateTime value for the cell.
*/
get dateTimeValue() {
return this.i.mp;
}
set dateTimeValue(v) {
this.i.mp = v;
}
/**
* The format string to apply to the value
*/
get formatStringOverride() {
return this.i.m6;
}
set formatStringOverride(v) {
this.i.m6 = 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.mz;
}
set formatOverride(v) {
this.i.mz = v;
}
/**
* Sets or gets the simple DateTimeFormat to use for the cell.
*/
get dateTimeFormat() {
return this.i.ml;
}
set dateTimeFormat(v) {
this.i.ml = ensureEnum(DateTimeFormats_$type, v);
}
/**
* Sets or gets whether the value to use is a DateTimeOffset value.
*/
get isOffsetValue() {
return this.i.mn;
}
set isOffsetValue(v) {
this.i.mn = 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;
}
}