igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
700 lines (696 loc) • 26.6 kB
JavaScript
import { Output, EventEmitter, Component, ViewContainerRef, ViewChild, Input, ChangeDetectionStrategy } from '@angular/core';
import { ZoomSliderOrientation_$type } from './ZoomSliderOrientation';
import { IgxZoomSliderResolvingAxisValueEventArgs } from './igx-zoom-slider-resolving-axis-value-event-args';
import { IgxRectChangedEventArgs } from "igniteui-angular-core";
import { ZoomSlider } from "./ZoomSlider";
import { fromRect, toRect, ensureEnum, brushToString, stringToBrush, ensureBool, toSpinal, initializePropertiesFromCss, NamePatcher } from "igniteui-angular-core";
import { FontInfo } from "igniteui-angular-core";
import { AngularRenderer } from "igniteui-angular-core";
import { delegateCombine } from "igniteui-angular-core";
import * as i0 from "@angular/core";
const ZoomSliderStylingDefaults = {};
export let IgxZoomSliderComponent = /*@__PURE__*/ (() => {
class IgxZoomSliderComponent {
constructor(renderer, _elRef, ngZone, injector, componentFactoryResolver) {
this.renderer = renderer;
this._elRef = _elRef;
this.ngZone = ngZone;
this.injector = injector;
this.componentFactoryResolver = componentFactoryResolver;
this._wrapper = null;
this._root = null;
this._implementation = null;
this.__p = null;
this._hasUserValues = new Set();
this._stylingContainer = null;
this._stylingParent = null;
this._inStyling = false;
this._resolvingAxisValue = null;
this._windowRectChanged = null;
this._zoneRunner = null;
if (this._styling) {
NamePatcher.ensureStylablePatched(Object.getPrototypeOf(this));
}
this._implementation = this.createImplementation();
if (renderer) {
this.container = renderer.createElement("div");
renderer.appendChild(_elRef.element.nativeElement, this.container);
renderer.setStyle(this.container, "display", "block");
renderer.setStyle(this.container, "width", "100%");
renderer.setStyle(this.container, "height", "100%");
}
var root;
root = this.container;
if (this.container != null) {
root = this.container;
}
if (root && root.nativeElement) {
root = root.nativeElement;
}
this._root = root;
var zoomSlider = this.i;
this._zoomSlider = zoomSlider;
if (renderer) {
var ren = new AngularRenderer(root, this.renderer, window.document, this.ngZone, true, ZoomSliderStylingDefaults);
this._wrapper = ren;
zoomSlider.provideContainer(ren);
zoomSlider.notifySizeChanged();
ren.addSizeWatcher(() => {
this._zoomSlider.notifySizeChanged();
});
}
}
set height(value) {
this._height = value;
this.renderer.setStyle(this._elRef.element.nativeElement, "height", value);
this._zoomSlider.notifySizeChanged();
}
get height() {
return this._height;
}
set width(value) {
this._width = value;
this.renderer.setStyle(this._elRef.element.nativeElement, "width", value);
this._zoomSlider.notifySizeChanged();
}
get width() {
return this._width;
}
// supports angular themes or custom properties set in CSS
updateStyle() {
this._styling(this._root, this);
}
ngOnDestroy() {
this._zoomSlider.destroy();
this._wrapper.destroy();
}
ngAfterContentInit() {
this.updateStyle();
}
createImplementation() {
return new ZoomSlider();
}
get i() {
return this._implementation;
}
static _staticStyling(container, component, parent) {
let genericPrefix = "";
let typeName = (component.i ? component.i : component).$type.name;
if (typeName.indexOf("Xam") === 0) {
typeName = typeName.substring(3);
}
genericPrefix = toSpinal("ZoomSlider");
let additionalPrefixes = [];
let prefix = toSpinal(typeName);
additionalPrefixes.push(prefix + "-");
let b = (component.i ? component.i : component).$type.baseType;
while (b && b.name != "Object" &&
b.name != "Base" &&
b.name != "Control" &&
b.Name != "DependencyObject" &&
b.Name != "FrameworkElement") {
typeName = b.name;
if (typeName.indexOf("Xam") === 0) {
typeName = typeName.substring(3);
}
let basePrefix = toSpinal(typeName);
additionalPrefixes.push(basePrefix + "-");
b = b.baseType;
}
if (parent) {
let parentTypeName = parent.i.$type.name;
if (parentTypeName.indexOf("Xam") === 0) {
parentTypeName = parentTypeName.substring(3);
}
let parentPrefix = toSpinal(parentTypeName);
additionalPrefixes.push(parentPrefix + "-" + genericPrefix + "-");
additionalPrefixes.push(parentPrefix + "-" + prefix + "-");
}
initializePropertiesFromCss(container, component, genericPrefix + "-", new Set(), false, additionalPrefixes);
}
get panTransitionDuration() {
return this.i.bl;
}
set panTransitionDuration(v) {
this.i.bl = +v;
}
get maxZoomWidth() {
return this.i.bg;
}
set maxZoomWidth(v) {
this.i.bg = +v;
}
/**
* Gets or sets the scaling value used to affect the pixel density of the control.
* A higher scaling ratio will produce crisper visuals at the expense of memory. Lower values will cause the control
* to appear blurry.
*/
get pixelScalingRatio() {
return this.i.bi;
}
set pixelScalingRatio(v) {
this.i.bi = +v;
}
get actualPixelScalingRatio() {
return this.i.a4;
}
set actualPixelScalingRatio(v) {
this.i.a4 = +v;
}
get windowRect() {
return fromRect(this.i.windowRect);
}
set windowRect(v) {
this.i.windowRect = toRect(v);
}
get minZoomWidth() {
return this.i.bh;
}
set minZoomWidth(v) {
this.i.bh = +v;
}
get startInset() {
return this.i.startInset;
}
set startInset(v) {
this.i.startInset = +v;
}
get endInset() {
return this.i.endInset;
}
set endInset(v) {
this.i.endInset = +v;
}
get trackStartInset() {
return this.i.trackStartInset;
}
set trackStartInset(v) {
this.i.trackStartInset = +v;
}
get trackEndInset() {
return this.i.trackEndInset;
}
set trackEndInset(v) {
this.i.trackEndInset = +v;
}
get barExtent() {
return this.i.barExtent;
}
set barExtent(v) {
this.i.barExtent = +v;
}
get orientation() {
return this.i.e;
}
set orientation(v) {
this.i.e = ensureEnum(ZoomSliderOrientation_$type, v);
}
get lowerThumbBrush() {
return brushToString(this.i.e8);
}
set lowerThumbBrush(v) {
this.i.e8 = stringToBrush(v);
}
get lowerThumbStrokeThickness() {
return this.i.be;
}
set lowerThumbStrokeThickness(v) {
this.i.be = +v;
}
get higherThumbStrokeThickness() {
return this.i.a9;
}
set higherThumbStrokeThickness(v) {
this.i.a9 = +v;
}
get higherThumbBrush() {
return brushToString(this.i.e0);
}
set higherThumbBrush(v) {
this.i.e0 = stringToBrush(v);
}
get lowerThumbOutline() {
return brushToString(this.i.e9);
}
set lowerThumbOutline(v) {
this.i.e9 = stringToBrush(v);
}
get higherThumbOutline() {
return brushToString(this.i.e1);
}
set higherThumbOutline(v) {
this.i.e1 = stringToBrush(v);
}
get lowerThumbRidgesBrush() {
return brushToString(this.i.fa);
}
set lowerThumbRidgesBrush(v) {
this.i.fa = stringToBrush(v);
}
get higherThumbRidgesBrush() {
return brushToString(this.i.e2);
}
set higherThumbRidgesBrush(v) {
this.i.e2 = stringToBrush(v);
}
get lowerThumbWidth() {
return this.i.bf;
}
set lowerThumbWidth(v) {
this.i.bf = +v;
}
get higherThumbWidth() {
return this.i.ba;
}
set higherThumbWidth(v) {
this.i.ba = +v;
}
get lowerThumbHeight() {
return this.i.bd;
}
set lowerThumbHeight(v) {
this.i.bd = +v;
}
get higherThumbHeight() {
return this.i.a8;
}
set higherThumbHeight(v) {
this.i.a8 = +v;
}
get lowerShadeBrush() {
return brushToString(this.i.e6);
}
set lowerShadeBrush(v) {
this.i.e6 = stringToBrush(v);
}
get lowerShadeOutline() {
return brushToString(this.i.e7);
}
set lowerShadeOutline(v) {
this.i.e7 = stringToBrush(v);
}
get lowerShadeStrokeThickness() {
return this.i.bc;
}
set lowerShadeStrokeThickness(v) {
this.i.bc = +v;
}
get higherShadeBrush() {
return brushToString(this.i.ey);
}
set higherShadeBrush(v) {
this.i.ey = stringToBrush(v);
}
get higherShadeOutline() {
return brushToString(this.i.ez);
}
set higherShadeOutline(v) {
this.i.ez = stringToBrush(v);
}
get higherShadeStrokeThickness() {
return this.i.a7;
}
set higherShadeStrokeThickness(v) {
this.i.a7 = +v;
}
get barBrush() {
return brushToString(this.i.et);
}
set barBrush(v) {
this.i.et = stringToBrush(v);
}
get barOutline() {
return brushToString(this.i.eu);
}
set barOutline(v) {
this.i.eu = stringToBrush(v);
}
get barStrokeThickness() {
return this.i.a5;
}
set barStrokeThickness(v) {
this.i.a5 = +v;
}
get rangeThumbBrush() {
return brushToString(this.i.fb);
}
set rangeThumbBrush(v) {
this.i.fb = stringToBrush(v);
}
get rangeThumbOutline() {
return brushToString(this.i.fc);
}
set rangeThumbOutline(v) {
this.i.fc = stringToBrush(v);
}
get rangeThumbStrokeThickness() {
return this.i.bj;
}
set rangeThumbStrokeThickness(v) {
this.i.bj = +v;
}
get rangeThumbRidgesBrush() {
return brushToString(this.i.fd);
}
set rangeThumbRidgesBrush(v) {
this.i.fd = stringToBrush(v);
}
get lowerCalloutBrush() {
return brushToString(this.i.e3);
}
set lowerCalloutBrush(v) {
this.i.e3 = stringToBrush(v);
}
get lowerCalloutTextColor() {
return brushToString(this.i.e5);
}
set lowerCalloutTextColor(v) {
this.i.e5 = stringToBrush(v);
}
get lowerCalloutOutline() {
return brushToString(this.i.e4);
}
set lowerCalloutOutline(v) {
this.i.e4 = stringToBrush(v);
}
get lowerCalloutStrokeThickness() {
return this.i.bb;
}
set lowerCalloutStrokeThickness(v) {
this.i.bb = +v;
}
get higherCalloutBrush() {
return brushToString(this.i.ev);
}
set higherCalloutBrush(v) {
this.i.ev = stringToBrush(v);
}
get higherCalloutTextColor() {
return brushToString(this.i.ex);
}
set higherCalloutTextColor(v) {
this.i.ex = stringToBrush(v);
}
get higherCalloutOutline() {
return brushToString(this.i.ew);
}
set higherCalloutOutline(v) {
this.i.ew = stringToBrush(v);
}
get higherCalloutStrokeThickness() {
return this.i.a6;
}
set higherCalloutStrokeThickness(v) {
this.i.a6 = +v;
}
get isCustomThumbProvided() {
return this.i.ab;
}
get isCustomRangeThumbProvided() {
return this.i.z;
}
get isCustomBarProvided() {
return this.i.y;
}
get isCustomShadeProvided() {
return this.i.aa;
}
get areThumbCalloutsEnabled() {
return this.i.q;
}
set areThumbCalloutsEnabled(v) {
this.i.q = ensureBool(v);
}
get thumbCalloutTextStyle() {
if (this.i.o == null) {
return null;
}
return this.i.o.fontString;
}
set thumbCalloutTextStyle(v) {
let fi = new FontInfo();
fi.fontString = v;
this.i.o = fi;
}
findByName(name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
return null;
}
get hasUserValues() {
return this._hasUserValues;
}
__m(propertyName) {
if (!this._inStyling) {
this._hasUserValues.add(propertyName);
}
}
_styling(container, component, parent) {
if (this._inStyling) {
return;
}
this._inStyling = true;
this._stylingContainer = container;
this._stylingParent = component;
let genericPrefix = "";
let typeName = this.i.$type.name;
if (typeName.indexOf("Xam") === 0) {
typeName = typeName.substring(3);
}
genericPrefix = toSpinal("ZoomSliderComponent");
let additionalPrefixes = [];
let prefix = toSpinal(typeName);
additionalPrefixes.push(prefix + "-");
let b = this.i.$type.baseType;
while (b && b.name != "Object" &&
b.name != "Base" &&
b.name != "Control" &&
b.Name != "DependencyObject" &&
b.Name != "FrameworkElement") {
typeName = b.name;
if (typeName.indexOf("Xam") === 0) {
typeName = typeName.substring(3);
}
let basePrefix = toSpinal(typeName);
additionalPrefixes.push(basePrefix + "-");
b = b.baseType;
}
if (parent) {
let parentTypeName = parent.i.$type.name;
if (parentTypeName.indexOf("Xam") === 0) {
parentTypeName = parentTypeName.substring(3);
}
let parentPrefix = toSpinal(parentTypeName);
additionalPrefixes.push(parentPrefix + "-" + genericPrefix + "-");
additionalPrefixes.push(parentPrefix + "-" + prefix + "-");
}
initializePropertiesFromCss(container, this, genericPrefix + "-", this.hasUserValues, false, additionalPrefixes);
if (this._otherStyling) {
this._otherStyling(container, component, parent);
}
this._inStyling = false;
}
onDetachedFromUI() {
this.i.onDetachedFromUI();
}
onAttachedToUI() {
this.i.onAttachedToUI();
}
/**
* Called by the UI framework to provide a UI container for rendering this control.
* @param container * The UI container element.
*/
provideContainer(container) {
this.i.provideContainer(container);
}
flush() {
this.i.c3();
}
trackDirty() {
this.i.trackDirty();
}
/**
* Shows the ZoomSlider.
*/
show() {
this.i.show();
}
/**
* Hides the ZoomSlider.
*/
hide() {
this.i.hide();
}
get resolvingAxisValue() {
if (this._resolvingAxisValue == null) {
this._resolvingAxisValue = new EventEmitter();
this.i.resolvingAxisValue = delegateCombine(this.i.resolvingAxisValue, (o, e) => {
let outerArgs = new IgxZoomSliderResolvingAxisValueEventArgs();
outerArgs._provideImplementation(e);
if (this.beforeResolvingAxisValue) {
this.beforeResolvingAxisValue(this, outerArgs);
}
this._resolvingAxisValue.emit({
sender: this,
args: outerArgs
});
});
}
return this._resolvingAxisValue;
}
/**
* Occurs just after the current ZoomSlider's window rectangle is changed.
*/
get windowRectChanged() {
if (this._windowRectChanged == null) {
this._windowRectChanged = new EventEmitter();
this.i.windowRectChanged = delegateCombine(this.i.windowRectChanged, (o, e) => {
let outerArgs = new IgxRectChangedEventArgs();
outerArgs._provideImplementation(e);
if (this.beforeWindowRectChanged) {
this.beforeWindowRectChanged(this, outerArgs);
}
this._windowRectChanged.emit({
sender: this,
args: outerArgs
});
});
}
return this._windowRectChanged;
}
_runInZone(act) {
if (this._zoneRunner != null) {
this._zoneRunner(act);
}
else {
act();
}
}
}
IgxZoomSliderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxZoomSliderComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ViewContainerRef }, { token: i0.NgZone }, { token: i0.Injector }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component });
IgxZoomSliderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: IgxZoomSliderComponent, selector: "igx-zoom-slider", inputs: { height: "height", width: "width", panTransitionDuration: "panTransitionDuration", maxZoomWidth: "maxZoomWidth", pixelScalingRatio: "pixelScalingRatio", actualPixelScalingRatio: "actualPixelScalingRatio", windowRect: "windowRect", minZoomWidth: "minZoomWidth", startInset: "startInset", endInset: "endInset", trackStartInset: "trackStartInset", trackEndInset: "trackEndInset", barExtent: "barExtent", orientation: "orientation", lowerThumbBrush: "lowerThumbBrush", lowerThumbStrokeThickness: "lowerThumbStrokeThickness", higherThumbStrokeThickness: "higherThumbStrokeThickness", higherThumbBrush: "higherThumbBrush", lowerThumbOutline: "lowerThumbOutline", higherThumbOutline: "higherThumbOutline", lowerThumbRidgesBrush: "lowerThumbRidgesBrush", higherThumbRidgesBrush: "higherThumbRidgesBrush", lowerThumbWidth: "lowerThumbWidth", higherThumbWidth: "higherThumbWidth", lowerThumbHeight: "lowerThumbHeight", higherThumbHeight: "higherThumbHeight", lowerShadeBrush: "lowerShadeBrush", lowerShadeOutline: "lowerShadeOutline", lowerShadeStrokeThickness: "lowerShadeStrokeThickness", higherShadeBrush: "higherShadeBrush", higherShadeOutline: "higherShadeOutline", higherShadeStrokeThickness: "higherShadeStrokeThickness", barBrush: "barBrush", barOutline: "barOutline", barStrokeThickness: "barStrokeThickness", rangeThumbBrush: "rangeThumbBrush", rangeThumbOutline: "rangeThumbOutline", rangeThumbStrokeThickness: "rangeThumbStrokeThickness", rangeThumbRidgesBrush: "rangeThumbRidgesBrush", lowerCalloutBrush: "lowerCalloutBrush", lowerCalloutTextColor: "lowerCalloutTextColor", lowerCalloutOutline: "lowerCalloutOutline", lowerCalloutStrokeThickness: "lowerCalloutStrokeThickness", higherCalloutBrush: "higherCalloutBrush", higherCalloutTextColor: "higherCalloutTextColor", higherCalloutOutline: "higherCalloutOutline", higherCalloutStrokeThickness: "higherCalloutStrokeThickness", areThumbCalloutsEnabled: "areThumbCalloutsEnabled", thumbCalloutTextStyle: "thumbCalloutTextStyle" }, outputs: { resolvingAxisValue: "resolvingAxisValue", windowRectChanged: "windowRectChanged" }, host: { classAttribute: "ig-zoom-slider igx-zoom-slider" }, providers: [], viewQueries: [{ propertyName: "_dynamicContent", first: true, predicate: ["dynamicContent"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: ``, isInline: true, styles: ["\n\t\t:host {\n\t\t\tdisplay: block;\n\t\t}\n\t"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
return IgxZoomSliderComponent;
})();
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxZoomSliderComponent, decorators: [{
type: Component,
args: [{
selector: 'igx-zoom-slider',
template: ``,
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [],
host: { 'class': 'ig-zoom-slider igx-zoom-slider' },
styles: [`
:host {
display: block;
}
`]
}]
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i0.NgZone }, { type: i0.Injector }, { type: i0.ComponentFactoryResolver }]; }, propDecorators: { height: [{
type: Input
}], width: [{
type: Input
}], _dynamicContent: [{
type: ViewChild,
args: ["dynamicContent", { read: ViewContainerRef, static: true }]
}], panTransitionDuration: [{
type: Input
}], maxZoomWidth: [{
type: Input
}], pixelScalingRatio: [{
type: Input
}], actualPixelScalingRatio: [{
type: Input
}], windowRect: [{
type: Input
}], minZoomWidth: [{
type: Input
}], startInset: [{
type: Input
}], endInset: [{
type: Input
}], trackStartInset: [{
type: Input
}], trackEndInset: [{
type: Input
}], barExtent: [{
type: Input
}], orientation: [{
type: Input
}], lowerThumbBrush: [{
type: Input
}], lowerThumbStrokeThickness: [{
type: Input
}], higherThumbStrokeThickness: [{
type: Input
}], higherThumbBrush: [{
type: Input
}], lowerThumbOutline: [{
type: Input
}], higherThumbOutline: [{
type: Input
}], lowerThumbRidgesBrush: [{
type: Input
}], higherThumbRidgesBrush: [{
type: Input
}], lowerThumbWidth: [{
type: Input
}], higherThumbWidth: [{
type: Input
}], lowerThumbHeight: [{
type: Input
}], higherThumbHeight: [{
type: Input
}], lowerShadeBrush: [{
type: Input
}], lowerShadeOutline: [{
type: Input
}], lowerShadeStrokeThickness: [{
type: Input
}], higherShadeBrush: [{
type: Input
}], higherShadeOutline: [{
type: Input
}], higherShadeStrokeThickness: [{
type: Input
}], barBrush: [{
type: Input
}], barOutline: [{
type: Input
}], barStrokeThickness: [{
type: Input
}], rangeThumbBrush: [{
type: Input
}], rangeThumbOutline: [{
type: Input
}], rangeThumbStrokeThickness: [{
type: Input
}], rangeThumbRidgesBrush: [{
type: Input
}], lowerCalloutBrush: [{
type: Input
}], lowerCalloutTextColor: [{
type: Input
}], lowerCalloutOutline: [{
type: Input
}], lowerCalloutStrokeThickness: [{
type: Input
}], higherCalloutBrush: [{
type: Input
}], higherCalloutTextColor: [{
type: Input
}], higherCalloutOutline: [{
type: Input
}], higherCalloutStrokeThickness: [{
type: Input
}], areThumbCalloutsEnabled: [{
type: Input
}], thumbCalloutTextStyle: [{
type: Input
}], resolvingAxisValue: [{
type: Output
}], windowRectChanged: [{
type: Output
}] } });