UNPKG

igniteui-webcomponents-charts

Version:

Ignite UI Web Components charting components for building rich data visualizations using TypeScript APIs.

702 lines (698 loc) 25.9 kB
import { delegateCombine, delegateRemove } from "igniteui-webcomponents-core"; import { ZoomSliderOrientation_$type } from "./ZoomSliderOrientation"; import { IgcZoomSliderResolvingAxisValueEventArgs } from "./igc-zoom-slider-resolving-axis-value-event-args"; import { IgcRectChangedEventArgs } from "igniteui-webcomponents-core"; import { ZoomSlider } from "./ZoomSlider"; import { brushToString, stringToBrush, toRect, fromRect, ensureBool, ensureEnum, initializePropertiesFromCss, NamePatcher, toSpinal, fromSpinal, enumToString, getAllPropertyNames, rectToString } from "igniteui-webcomponents-core"; import { RegisterElementHelper } from "igniteui-webcomponents-core"; import { FontInfo } from "igniteui-webcomponents-core"; import { WebComponentRenderer } from "igniteui-webcomponents-core"; import { IgcHTMLElement } from "igniteui-webcomponents-core"; const ZoomSliderStylingDefaults = {}; export let IgcZoomSliderComponent = /*@__PURE__*/ (() => { class IgcZoomSliderComponent extends IgcHTMLElement { set height(value) { this._height = value; this.style.height = value; this._zoomSlider.notifySizeChanged(); } get height() { return this._height; } set width(value) { this._width = value; this.style.width = value; this._zoomSlider.notifySizeChanged(); } get width() { return this._width; } constructor() { super(); this._wrapper = null; this._renderer = null; this._disconnected = false; this._implementation = null; this._settingAttributes = false; this._attached = false; this._queuedSetAttributes = []; this._updatingFromAttribute = false; this.__p = null; this._hasUserValues = new Set(); this._stylingContainer = null; this._stylingParent = null; this._inStyling = false; this._resolvingAxisValue = null; this._resolvingAxisValue_wrapped = null; this._windowRectChanged = null; this._windowRectChanged_wrapped = null; if (this._styling) { NamePatcher.ensureStylablePatched(Object.getPrototypeOf(this)); } this._implementation = this.createImplementation(); this._renderer = new WebComponentRenderer(this, document, true, ZoomSliderStylingDefaults); this._container = this._renderer.createElement("div"); this._renderer.updateRoot(this._container); //this._renderer.rootWrapper.append(this._container); this._container.setStyleProperty("display", "block"); this._container.setStyleProperty("width", "100%"); this._container.setStyleProperty("height", "100%"); var root; root = this._container; if (this._container.getNativeElement() != null) { root = this._container.getNativeElement(); } this._wrapper = this._renderer; var zoomSlider = this.i; this._zoomSlider = zoomSlider; zoomSlider.provideContainer(this._renderer); zoomSlider.notifySizeChanged(); this._renderer.addSizeWatcher(() => { this._zoomSlider.notifySizeChanged(); }); } disconnectedCallback() { this._disconnected = true; if (this.i) { this.i.onDetachedFromUI(); } } connectedCallback() { if (this._disconnected) { this._disconnected = false; if (this.i) { this.i.onAttachedToUI(); } return; } this.classList.add("ig-zoom-slider"); this.classList.add("igc-zoom-slider"); this.appendChild(this._renderer.rootWrapper.getNativeElement()); this._attached = true; this.style.display = "block"; this.style.height = this._height; this.style.width = this._width; this._flushQueuedAttributes(); // supports themes or custom properties set in CSS this._styling(this, this); this.afterContentInit(); } afterContentInit() { this._zoomSlider.notifySizeChanged(); } // supports themes or custom properties set in CSS updateStyle() { this._styling(this, this); } 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); } _enqueueSetAttribute(attrName, attrValue) { this._queuedSetAttributes.push({ attrName: attrName, attrValue: attrValue }); } _flushQueuedAttributes() { this._settingAttributes = true; for (let i = 0; i < this._queuedSetAttributes.length; i++) { this.setAttribute(this._queuedSetAttributes[i].attrName, this._queuedSetAttributes[i].attrValue); } this._settingAttributes = false; this._queuedSetAttributes.length = 0; } _a(attrName, attrValue) { if (this._updatingFromAttribute) { return; } if (attrValue) { attrValue = attrValue.toString(); } this._settingAttributes = true; attrName = toSpinal(attrName); if (this._attached) { this.setAttribute(attrName, attrValue); } else { this._enqueueSetAttribute(attrName, attrValue); } this._settingAttributes = false; } static get observedAttributes() { if (IgcZoomSliderComponent._observedAttributesIgcZoomSliderComponent == null) { let names = getAllPropertyNames(IgcZoomSliderComponent); for (let i = 0; i < names.length; i++) { names[i] = toSpinal(names[i]); } IgcZoomSliderComponent._observedAttributesIgcZoomSliderComponent = names; } return IgcZoomSliderComponent._observedAttributesIgcZoomSliderComponent; } attributeChangedCallback(name, oldValue, newValue) { if (this._settingAttributes) { return; } let setName = fromSpinal(name); this._updatingFromAttribute = true; this[setName] = newValue; this._updatingFromAttribute = false; } static register() { if (!IgcZoomSliderComponent._isElementRegistered) { IgcZoomSliderComponent._isElementRegistered = true; RegisterElementHelper.registerElement(IgcZoomSliderComponent.htmlTagName, IgcZoomSliderComponent); } } get panTransitionDuration() { return this.i.bl; } set panTransitionDuration(v) { this.i.bl = +v; this._a("panTransitionDuration", this.i.bl); } get maxZoomWidth() { return this.i.bg; } set maxZoomWidth(v) { this.i.bg = +v; this._a("maxZoomWidth", this.i.bg); } /** * 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; this._a("pixelScalingRatio", this.i.bi); } get actualPixelScalingRatio() { return this.i.a4; } set actualPixelScalingRatio(v) { this.i.a4 = +v; this._a("actualPixelScalingRatio", this.i.a4); } get windowRect() { return fromRect(this.i.windowRect); } set windowRect(v) { this.i.windowRect = toRect(v); this._a("windowRect", rectToString(this.i.windowRect)); } get minZoomWidth() { return this.i.bh; } set minZoomWidth(v) { this.i.bh = +v; this._a("minZoomWidth", this.i.bh); } get startInset() { return this.i.startInset; } set startInset(v) { this.i.startInset = +v; this._a("startInset", this.i.startInset); } get endInset() { return this.i.endInset; } set endInset(v) { this.i.endInset = +v; this._a("endInset", this.i.endInset); } get trackStartInset() { return this.i.trackStartInset; } set trackStartInset(v) { this.i.trackStartInset = +v; this._a("trackStartInset", this.i.trackStartInset); } get trackEndInset() { return this.i.trackEndInset; } set trackEndInset(v) { this.i.trackEndInset = +v; this._a("trackEndInset", this.i.trackEndInset); } get barExtent() { return this.i.barExtent; } set barExtent(v) { this.i.barExtent = +v; this._a("barExtent", this.i.barExtent); } get orientation() { return this.i.e; } set orientation(v) { this.i.e = ensureEnum(ZoomSliderOrientation_$type, v); this._a("orientation", enumToString(ZoomSliderOrientation_$type, this.i.e)); } get lowerThumbBrush() { return brushToString(this.i.e8); } set lowerThumbBrush(v) { this.i.e8 = stringToBrush(v); this._a("lowerThumbBrush", brushToString(this.i.e8)); } get lowerThumbStrokeThickness() { return this.i.be; } set lowerThumbStrokeThickness(v) { this.i.be = +v; this._a("lowerThumbStrokeThickness", this.i.be); } get higherThumbStrokeThickness() { return this.i.a9; } set higherThumbStrokeThickness(v) { this.i.a9 = +v; this._a("higherThumbStrokeThickness", this.i.a9); } get higherThumbBrush() { return brushToString(this.i.e0); } set higherThumbBrush(v) { this.i.e0 = stringToBrush(v); this._a("higherThumbBrush", brushToString(this.i.e0)); } get lowerThumbOutline() { return brushToString(this.i.e9); } set lowerThumbOutline(v) { this.i.e9 = stringToBrush(v); this._a("lowerThumbOutline", brushToString(this.i.e9)); } get higherThumbOutline() { return brushToString(this.i.e1); } set higherThumbOutline(v) { this.i.e1 = stringToBrush(v); this._a("higherThumbOutline", brushToString(this.i.e1)); } get lowerThumbRidgesBrush() { return brushToString(this.i.fa); } set lowerThumbRidgesBrush(v) { this.i.fa = stringToBrush(v); this._a("lowerThumbRidgesBrush", brushToString(this.i.fa)); } get higherThumbRidgesBrush() { return brushToString(this.i.e2); } set higherThumbRidgesBrush(v) { this.i.e2 = stringToBrush(v); this._a("higherThumbRidgesBrush", brushToString(this.i.e2)); } get lowerThumbWidth() { return this.i.bf; } set lowerThumbWidth(v) { this.i.bf = +v; this._a("lowerThumbWidth", this.i.bf); } get higherThumbWidth() { return this.i.ba; } set higherThumbWidth(v) { this.i.ba = +v; this._a("higherThumbWidth", this.i.ba); } get lowerThumbHeight() { return this.i.bd; } set lowerThumbHeight(v) { this.i.bd = +v; this._a("lowerThumbHeight", this.i.bd); } get higherThumbHeight() { return this.i.a8; } set higherThumbHeight(v) { this.i.a8 = +v; this._a("higherThumbHeight", this.i.a8); } get lowerShadeBrush() { return brushToString(this.i.e6); } set lowerShadeBrush(v) { this.i.e6 = stringToBrush(v); this._a("lowerShadeBrush", brushToString(this.i.e6)); } get lowerShadeOutline() { return brushToString(this.i.e7); } set lowerShadeOutline(v) { this.i.e7 = stringToBrush(v); this._a("lowerShadeOutline", brushToString(this.i.e7)); } get lowerShadeStrokeThickness() { return this.i.bc; } set lowerShadeStrokeThickness(v) { this.i.bc = +v; this._a("lowerShadeStrokeThickness", this.i.bc); } get higherShadeBrush() { return brushToString(this.i.ey); } set higherShadeBrush(v) { this.i.ey = stringToBrush(v); this._a("higherShadeBrush", brushToString(this.i.ey)); } get higherShadeOutline() { return brushToString(this.i.ez); } set higherShadeOutline(v) { this.i.ez = stringToBrush(v); this._a("higherShadeOutline", brushToString(this.i.ez)); } get higherShadeStrokeThickness() { return this.i.a7; } set higherShadeStrokeThickness(v) { this.i.a7 = +v; this._a("higherShadeStrokeThickness", this.i.a7); } get barBrush() { return brushToString(this.i.et); } set barBrush(v) { this.i.et = stringToBrush(v); this._a("barBrush", brushToString(this.i.et)); } get barOutline() { return brushToString(this.i.eu); } set barOutline(v) { this.i.eu = stringToBrush(v); this._a("barOutline", brushToString(this.i.eu)); } get barStrokeThickness() { return this.i.a5; } set barStrokeThickness(v) { this.i.a5 = +v; this._a("barStrokeThickness", this.i.a5); } get rangeThumbBrush() { return brushToString(this.i.fb); } set rangeThumbBrush(v) { this.i.fb = stringToBrush(v); this._a("rangeThumbBrush", brushToString(this.i.fb)); } get rangeThumbOutline() { return brushToString(this.i.fc); } set rangeThumbOutline(v) { this.i.fc = stringToBrush(v); this._a("rangeThumbOutline", brushToString(this.i.fc)); } get rangeThumbStrokeThickness() { return this.i.bj; } set rangeThumbStrokeThickness(v) { this.i.bj = +v; this._a("rangeThumbStrokeThickness", this.i.bj); } get rangeThumbRidgesBrush() { return brushToString(this.i.fd); } set rangeThumbRidgesBrush(v) { this.i.fd = stringToBrush(v); this._a("rangeThumbRidgesBrush", brushToString(this.i.fd)); } get lowerCalloutBrush() { return brushToString(this.i.e3); } set lowerCalloutBrush(v) { this.i.e3 = stringToBrush(v); this._a("lowerCalloutBrush", brushToString(this.i.e3)); } get lowerCalloutTextColor() { return brushToString(this.i.e5); } set lowerCalloutTextColor(v) { this.i.e5 = stringToBrush(v); this._a("lowerCalloutTextColor", brushToString(this.i.e5)); } get lowerCalloutOutline() { return brushToString(this.i.e4); } set lowerCalloutOutline(v) { this.i.e4 = stringToBrush(v); this._a("lowerCalloutOutline", brushToString(this.i.e4)); } get lowerCalloutStrokeThickness() { return this.i.bb; } set lowerCalloutStrokeThickness(v) { this.i.bb = +v; this._a("lowerCalloutStrokeThickness", this.i.bb); } get higherCalloutBrush() { return brushToString(this.i.ev); } set higherCalloutBrush(v) { this.i.ev = stringToBrush(v); this._a("higherCalloutBrush", brushToString(this.i.ev)); } get higherCalloutTextColor() { return brushToString(this.i.ex); } set higherCalloutTextColor(v) { this.i.ex = stringToBrush(v); this._a("higherCalloutTextColor", brushToString(this.i.ex)); } get higherCalloutOutline() { return brushToString(this.i.ew); } set higherCalloutOutline(v) { this.i.ew = stringToBrush(v); this._a("higherCalloutOutline", brushToString(this.i.ew)); } get higherCalloutStrokeThickness() { return this.i.a6; } set higherCalloutStrokeThickness(v) { this.i.a6 = +v; this._a("higherCalloutStrokeThickness", this.i.a6); } 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); this._a("areThumbCalloutsEnabled", this.i.q); } 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; this._a("thumbCalloutTextStyle", this.i.o != null ? this.i.o.fontString : ""); } 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() { return this._resolvingAxisValue; } set resolvingAxisValue(ev) { if (this._resolvingAxisValue_wrapped !== null) { this.i.resolvingAxisValue = delegateRemove(this.i.resolvingAxisValue, this._resolvingAxisValue_wrapped); this._resolvingAxisValue_wrapped = null; this._resolvingAxisValue = null; } this._resolvingAxisValue = ev; this._resolvingAxisValue_wrapped = (o, e) => { let outerArgs = new IgcZoomSliderResolvingAxisValueEventArgs(); outerArgs._provideImplementation(e); if (this.beforeResolvingAxisValue) { this.beforeResolvingAxisValue(this, outerArgs); } if (this._resolvingAxisValue) { this._resolvingAxisValue(this, outerArgs); } }; this.i.resolvingAxisValue = delegateCombine(this.i.resolvingAxisValue, this._resolvingAxisValue_wrapped); ; } /** * Occurs just after the current ZoomSlider's window rectangle is changed. */ get windowRectChanged() { return this._windowRectChanged; } set windowRectChanged(ev) { if (this._windowRectChanged_wrapped !== null) { this.i.windowRectChanged = delegateRemove(this.i.windowRectChanged, this._windowRectChanged_wrapped); this._windowRectChanged_wrapped = null; this._windowRectChanged = null; } this._windowRectChanged = ev; this._windowRectChanged_wrapped = (o, e) => { let outerArgs = new IgcRectChangedEventArgs(); outerArgs._provideImplementation(e); if (this.beforeWindowRectChanged) { this.beforeWindowRectChanged(this, outerArgs); } if (this._windowRectChanged) { this._windowRectChanged(this, outerArgs); } }; this.i.windowRectChanged = delegateCombine(this.i.windowRectChanged, this._windowRectChanged_wrapped); ; } } IgcZoomSliderComponent._observedAttributesIgcZoomSliderComponent = null; IgcZoomSliderComponent.htmlTagName = "igc-zoom-slider"; IgcZoomSliderComponent._isElementRegistered = false; return IgcZoomSliderComponent; })();