igniteui-react-grids
Version:
Ignite UI React grid components.
124 lines (123 loc) • 3.26 kB
JavaScript
import { DateTimeFormats_$type } from "./DateTimeFormats";
import { EditorType_$type } from "./EditorType";
import { IgrDataGridColumn } from "./igr-data-grid-column";
import { DateTimeColumn } from "./DateTimeColumn";
import { ensureEnum, ensureBool, arrayFindByName } from "igniteui-react-core";
/**
* A column for displaying date/time values.
*/
export class IgrDateTimeColumn extends IgrDataGridColumn {
createImplementation() {
return new DateTimeColumn();
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
constructor(props) {
super(props);
}
/**
* Gets or sets the date time format to use for this column. If FormatString is specificied this value is ignored.
*/
get dateTimeFormat() {
return this.i.n7;
}
set dateTimeFormat(v) {
this.i.n7 = ensureEnum(DateTimeFormats_$type, v);
}
/**
* 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.op;
}
set formatString(v) {
this.i.op = v;
}
/**
* Gets or sets the format string to use when editing dates.
*/
get editorFormatString() {
return this.i.oi;
}
set editorFormatString(v) {
this.i.oi = v;
}
get formatSpecifiers() {
return this.i.n3;
}
set formatSpecifiers(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.n3 = v;
}
/**
* Gets or sets the INTL DateTimeFormat object to use for formatting the date values.
*/
get formatOverride() {
return this.i.oe;
}
set formatOverride(v) {
this.i.oe = v;
}
/**
* Gets or sets the ShowTodayButton property to detirmine if the today button is shown
*/
get showTodayButton() {
return this.i.oa;
}
set showTodayButton(v) {
this.i.oa = ensureBool(v);
}
/**
* Gets or sets the editor type used for editing cells in this column.
*/
get editorType() {
return this.i.n8;
}
set editorType(v) {
this.i.n8 = ensureEnum(EditorType_$type, v);
}
/**
* Gets or sets the ComboBox data source.
*/
get editorDataSource() {
return this.i.od;
}
set editorDataSource(v) {
this.i.od = v;
}
/**
* Gets or sets the ComboBox text field.
*/
get editorTextField() {
return this.i.ok;
}
set editorTextField(v) {
this.i.ok = v;
}
/**
* Gets or sets the ComboBox value field.
*/
get editorValueField() {
return this.i.ol;
}
set editorValueField(v) {
this.i.ol = 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;
}
}