igniteui-webcomponents-charts
Version:
Ignite UI Web Components charting components for building rich data visualizations using TypeScript APIs.
259 lines (257 loc) • 10.8 kB
JavaScript
import { __extends } from "tslib";
import { IgcTimeAxisBreakCollection } from "./igc-time-axis-break-collection";
import { TimeAxisLabellingMode_$type } from "./TimeAxisLabellingMode";
import { IgcTimeAxisLabelFormatCollection } from "./igc-time-axis-label-format-collection";
import { IgcTimeAxisIntervalCollection } from "./igc-time-axis-interval-collection";
import { IgcTimeAxisBaseComponent } from "./igc-time-axis-base-component";
import { TimeXAxis } from "./TimeXAxis";
import { getAllPropertyNames, toSpinal, ensureEnum, enumToString } from "igniteui-webcomponents-core";
import { RegisterElementHelper } from "igniteui-webcomponents-core";
import { TimeAxisBreakCollection as TimeAxisBreakCollection_internal } from "./TimeAxisBreakCollection";
import { TimeAxisBreak } from "./TimeAxisBreak";
import { SyncableObservableCollection$1 } from "igniteui-webcomponents-core";
import { TimeAxisLabelFormatCollection as TimeAxisLabelFormatCollection_internal } from "./TimeAxisLabelFormatCollection";
import { TimeAxisLabelFormat } from "./TimeAxisLabelFormat";
import { TimeAxisIntervalCollection as TimeAxisIntervalCollection_internal } from "./TimeAxisIntervalCollection";
import { TimeAxisInterval } from "./TimeAxisInterval";
/**
* A horizontal axis that uses a DateTime scale.
*
* The `TimeXAxis` is a horizontal axis that uses a DateTime scale.
*/
var IgcTimeXAxisComponent = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgcTimeXAxisComponent, _super);
function IgcTimeXAxisComponent() {
var _this = _super.call(this) || this;
_this._breaks = null;
_this._labelFormats = null;
_this._intervals = null;
return _this;
}
IgcTimeXAxisComponent.prototype.createImplementation = function () {
return new TimeXAxis();
};
Object.defineProperty(IgcTimeXAxisComponent.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
IgcTimeXAxisComponent.prototype.connectedCallback = function () {
if (_super.prototype["connectedCallback"]) {
_super.prototype["connectedCallback"].call(this);
}
if (this.i.connectedCallback) {
this.i.connectedCallback();
}
if (!this._attached) {
this._attached = true;
this._flushQueuedAttributes();
}
};
IgcTimeXAxisComponent.prototype.disconnectedCallback = function () {
if (_super.prototype["disconnectedCallback"]) {
_super.prototype["disconnectedCallback"].call(this);
}
if (this.i.disconnectedCallback) {
this.i.disconnectedCallback();
}
if (this._attached) {
this._attached = false;
}
};
Object.defineProperty(IgcTimeXAxisComponent, "observedAttributes", {
get: function () {
if (IgcTimeXAxisComponent._observedAttributesIgcTimeXAxisComponent == null) {
var names = getAllPropertyNames(IgcTimeXAxisComponent);
for (var i = 0; i < names.length; i++) {
names[i] = toSpinal(names[i]);
}
IgcTimeXAxisComponent._observedAttributesIgcTimeXAxisComponent = names;
}
return IgcTimeXAxisComponent._observedAttributesIgcTimeXAxisComponent;
},
enumerable: false,
configurable: true
});
IgcTimeXAxisComponent.register = function () {
if (!IgcTimeXAxisComponent._isElementRegistered) {
IgcTimeXAxisComponent._isElementRegistered = true;
RegisterElementHelper.registerElement(IgcTimeXAxisComponent.htmlTagName, IgcTimeXAxisComponent);
}
};
Object.defineProperty(IgcTimeXAxisComponent.prototype, "isPiecewise", {
get: function () {
return this.i.cl;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcTimeXAxisComponent.prototype, "breaks", {
/**
* TimeAxisBreaks to apply to this axis, representing spans of time to omit, such as weekends.
*
* The `Breaks` to apply to this axis, representing spans of time to omit, such as weekends.
*/
get: function () {
if (this._breaks === null) {
var coll = new IgcTimeAxisBreakCollection();
var innerColl = this.i.breaks;
if (!innerColl) {
innerColl = new TimeAxisBreakCollection_internal();
}
this._breaks = coll._fromInner(innerColl);
}
return this._breaks;
},
set: function (v) {
if (this._breaks !== null) {
this._breaks._setSyncTarget(null);
this._breaks = null;
}
var coll = new IgcTimeAxisBreakCollection();
this._breaks = coll._fromOuter(v);
var syncColl = new SyncableObservableCollection$1(TimeAxisBreak.$type);
var innerColl = this.i.breaks;
if (!innerColl) {
innerColl = new TimeAxisBreakCollection_internal();
}
syncColl._inner = innerColl;
syncColl.clear();
this._breaks._setSyncTarget(syncColl);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcTimeXAxisComponent.prototype, "labellingMode", {
/**
* Gets or sets the labelling mode to use when the automatic label formats are applied.
*/
get: function () {
return this.i.n5;
},
set: function (v) {
this.i.n5 = ensureEnum(TimeAxisLabellingMode_$type, v);
this._a("labellingMode", enumToString(TimeAxisLabellingMode_$type, this.i.n5));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcTimeXAxisComponent.prototype, "labelFormats", {
/**
* A list of axis label formats to apply, which are selected according to the visible axis range.
* The label format selected will be the one with the largest range smaller than the visible range of the axis.
*/
get: function () {
if (this._labelFormats === null) {
var coll = new IgcTimeAxisLabelFormatCollection();
var innerColl = this.i.labelFormats;
if (!innerColl) {
innerColl = new TimeAxisLabelFormatCollection_internal();
}
this._labelFormats = coll._fromInner(innerColl);
}
return this._labelFormats;
},
set: function (v) {
if (this._labelFormats !== null) {
this._labelFormats._setSyncTarget(null);
this._labelFormats = null;
}
var coll = new IgcTimeAxisLabelFormatCollection();
this._labelFormats = coll._fromOuter(v);
var syncColl = new SyncableObservableCollection$1(TimeAxisLabelFormat.$type);
var innerColl = this.i.labelFormats;
if (!innerColl) {
innerColl = new TimeAxisLabelFormatCollection_internal();
}
syncColl._inner = innerColl;
syncColl.clear();
this._labelFormats._setSyncTarget(syncColl);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcTimeXAxisComponent.prototype, "intervals", {
/**
* A list of axis label intervals to apply, which are selected according to the visible axis range.
* The interval selected will be the one with the largest range smaller than the visible range of the axis.
*/
get: function () {
if (this._intervals === null) {
var coll = new IgcTimeAxisIntervalCollection();
var innerColl = this.i.intervals;
if (!innerColl) {
innerColl = new TimeAxisIntervalCollection_internal();
}
this._intervals = coll._fromInner(innerColl);
}
return this._intervals;
},
set: function (v) {
if (this._intervals !== null) {
this._intervals._setSyncTarget(null);
this._intervals = null;
}
var coll = new IgcTimeAxisIntervalCollection();
this._intervals = coll._fromOuter(v);
var syncColl = new SyncableObservableCollection$1(TimeAxisInterval.$type);
var innerColl = this.i.intervals;
if (!innerColl) {
innerColl = new TimeAxisIntervalCollection_internal();
}
syncColl._inner = innerColl;
syncColl.clear();
this._intervals._setSyncTarget(syncColl);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcTimeXAxisComponent.prototype, "isCategoryDateTime", {
/**
* Gets if the current axis is of category date time axis type
*/
get: function () {
return this.i.cc;
},
enumerable: false,
configurable: true
});
IgcTimeXAxisComponent.prototype.findByName = function (name) {
var baseResult = _super.prototype.findByName.call(this, name);
if (baseResult) {
return baseResult;
}
if (this.breaks != null && this.breaks.findByName && this.breaks.findByName(name)) {
return this.breaks.findByName(name);
}
if (this.labelFormats != null && this.labelFormats.findByName && this.labelFormats.findByName(name)) {
return this.labelFormats.findByName(name);
}
if (this.intervals != null && this.intervals.findByName && this.intervals.findByName(name)) {
return this.intervals.findByName(name);
}
return null;
};
IgcTimeXAxisComponent.prototype.getValueLabel = function (value) {
var iv = this.i.gf(value);
return (iv);
};
/**
* Gets the index of the data item with the value nearest the given value.
* @param unscaledValue * The value to find a value close to.
*/
IgcTimeXAxisComponent.prototype.getIndexClosestToUnscaledValue = function (unscaledValue) {
var iv = this.i.i$f(unscaledValue);
return (iv);
};
IgcTimeXAxisComponent._observedAttributesIgcTimeXAxisComponent = null;
IgcTimeXAxisComponent.htmlTagName = "igc-time-x-axis";
IgcTimeXAxisComponent._isElementRegistered = false;
return IgcTimeXAxisComponent;
}(IgcTimeAxisBaseComponent));
export { IgcTimeXAxisComponent };