igniteui-webcomponents-grids
Version:
Ignite UI Web Components grid components.
179 lines (178 loc) • 6.21 kB
JavaScript
import { DateTimeFormats_$type } from "./DateTimeFormats";
import { EditorType_$type } from "./EditorType";
import { IgcDataGridColumnComponent } from "./igc-data-grid-column-component";
import { DateTimeColumn } from "./DateTimeColumn";
import { getAllPropertyNames, toSpinal, ensureEnum, enumToString, ensureBool, arrayFindByName } from "igniteui-webcomponents-core";
import { RegisterElementHelper } from "igniteui-webcomponents-core";
/**
* A column for displaying date/time values.
*/
export let IgcDateTimeColumnComponent = /*@__PURE__*/ (() => {
class IgcDateTimeColumnComponent extends IgcDataGridColumnComponent {
createImplementation() {
return new DateTimeColumn();
}
/**
* @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 (IgcDateTimeColumnComponent._observedAttributesIgcDateTimeColumnComponent == null) {
let names = getAllPropertyNames(IgcDateTimeColumnComponent);
for (let i = 0; i < names.length; i++) {
names[i] = toSpinal(names[i]);
}
IgcDateTimeColumnComponent._observedAttributesIgcDateTimeColumnComponent = names;
}
return IgcDateTimeColumnComponent._observedAttributesIgcDateTimeColumnComponent;
}
static register() {
if (!IgcDateTimeColumnComponent._isElementRegistered) {
IgcDateTimeColumnComponent._isElementRegistered = true;
RegisterElementHelper.registerElement(IgcDateTimeColumnComponent.htmlTagName, IgcDateTimeColumnComponent);
}
}
/**
* 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.n8;
}
set dateTimeFormat(v) {
this.i.n8 = ensureEnum(DateTimeFormats_$type, v);
this._a("dateTimeFormat", enumToString(DateTimeFormats_$type, 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.oq;
}
set formatString(v) {
this.i.oq = v;
}
/**
* Gets or sets the format string to use when editing dates.
*/
get editorFormatString() {
return this.i.oj;
}
set editorFormatString(v) {
this.i.oj = 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 DateTimeFormat object to use for formatting the date values.
*/
get formatOverride() {
return this.i.of;
}
set formatOverride(v) {
this.i.of = v;
}
/**
* Gets or sets the ShowTodayButton property to detirmine if the today button is shown
*/
get showTodayButton() {
return this.i.ob;
}
set showTodayButton(v) {
this.i.ob = ensureBool(v);
this._a("showTodayButton", this.i.ob);
}
/**
* Gets or sets the editor type used for editing cells in this column.
*/
get editorType() {
return this.i.n9;
}
set editorType(v) {
this.i.n9 = ensureEnum(EditorType_$type, v);
this._a("editorType", enumToString(EditorType_$type, this.i.n9));
}
/**
* Gets or sets the ComboBox data source.
*/
get editorDataSource() {
return this.i.oe;
}
set editorDataSource(v) {
this.i.oe = v;
}
/**
* Gets or sets the ComboBox text field.
*/
get editorTextField() {
return this.i.ol;
}
set editorTextField(v) {
this.i.ol = v;
}
/**
* Gets or sets the ComboBox value field.
*/
get editorValueField() {
return this.i.om;
}
set editorValueField(v) {
this.i.om = 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;
}
}
IgcDateTimeColumnComponent._observedAttributesIgcDateTimeColumnComponent = null;
IgcDateTimeColumnComponent.htmlTagName = "igc-date-time-column";
IgcDateTimeColumnComponent._isElementRegistered = false;
return IgcDateTimeColumnComponent;
})();