igniteui-react-grids
Version:
Ignite UI React grid components.
112 lines (111 loc) • 3.42 kB
JavaScript
import { GridColumnDataType_$type } from "./GridColumnDataType";
import { IgrPivotDimension } from "./igr-pivot-dimension";
import { IgcPivotDateDimension } from "./../../grids/combined";
import { PivotDateDimension as PivotDateDimension_internal } from "./PivotDateDimension";
import { ensureBool, ensureEnum, interfaceToInternal } from "igniteui-react-core";
import { GridResourceStrings } from "./GridResourceStrings";
import { PivotDateDimensionOptions } from "./PivotDateDimensionOptions";
export class IgrPivotDateDimension extends IgrPivotDimension {
createImplementation() {
let impl = new PivotDateDimension_internal();
if (impl.setNativeElement) {
impl.setNativeElement(new IgcPivotDateDimension());
}
return impl;
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
constructor() {
super();
}
/**
* Enables/Disables a particular dimension from pivot structure.
*/
get enabled() {
return this.i.w;
}
set enabled(v) {
this.i.w = ensureBool(v);
}
/**
* Gets/Sets data type
*/
get dataType() {
return this.i.s;
}
set dataType(v) {
this.i.s = ensureEnum(GridColumnDataType_$type, v);
}
/**
* Gets/Sets the resource strings.
* @remarks
* By default it uses EN resources.
*/
get resourceStrings() {
return this.i.t.nativeElement;
}
set resourceStrings(v) {
this.i.t = interfaceToInternal(v, () => new GridResourceStrings());
}
/**
* Gets/Sets the base dimension that is used by this class to determine the other dimensions and their values.
* Having base dimension set is required in order for the Date Dimensions to show.
*/
get baseDimension() {
const r = this.i.v;
if (r == null) {
return null;
}
if (!r.externalObject) {
let e = new IgrPivotDimension();
if (r.$type) {
e._implementation = r;
}
else {
if (e.i.setNativeElement) {
e.i.setNativeElement(r);
}
}
r.externalObject = e;
}
return r.externalObject;
}
set baseDimension(v) {
v == null ? this.i.v = null : this.i.v = v.i;
}
/**
* Gets/Sets the options for the predefined date dimensions whether to show quarter, years and etc.
*/
get options() {
return this.i.u.nativeElement;
}
set options(v) {
this.i.u = interfaceToInternal(v, () => new PivotDateDimensionOptions());
}
get displayName() {
return this.i.x;
}
set displayName(v) {
this.i.x = v;
}
findByName(name) {
var baseResult = super.findByName(name);
if (baseResult) {
return baseResult;
}
if (this.resourceStrings && this.resourceStrings.name && this.resourceStrings.name == name) {
return this.resourceStrings;
}
if (this.baseDimension && this.baseDimension.name && this.baseDimension.name == name) {
return this.baseDimension;
}
if (this.options && this.options.name && this.options.name == name) {
return this.options;
}
return null;
}
}