UNPKG

igniteui-react-charts

Version:

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

884 lines (880 loc) 28.7 kB
import { __extends, __values } from "tslib"; import * as React from 'react'; import { ZoomSliderOrientation_$type } from './ZoomSliderOrientation'; import { IgrZoomSliderResolvingAxisValueEventArgs } from './igr-zoom-slider-resolving-axis-value-event-args'; import { IgrRectChangedEventArgs } from "igniteui-react-core"; import { ZoomSlider } from "./ZoomSlider"; import { fromRect, toRect, ensureEnum, brushToString, stringToBrush, ensureBool, initializePropertiesFromCss, NamePatcher, isValidProp, toSpinal, getModifiedProps } from "igniteui-react-core"; import { FontInfo } from "igniteui-react-core"; import { ReactRenderer } from "igniteui-react-core"; import { delegateCombine, delegateRemove } from "igniteui-react-core"; var ZoomSliderStylingDefaults = {}; var IgrZoomSlider = /** @class */ /*@__PURE__*/ (function (_super) { __extends(IgrZoomSlider, _super); function IgrZoomSlider(props) { var _this = _super.call(this, props) || this; _this._wrapper = null; _this._implementation = null; _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._getMainRef = _this._getMainRef.bind(_this); _this._implementation = _this.createImplementation(); if (document) { _this._container = document.createElement("div"); _this._container.style.display = "block"; _this._container.style.width = "100%"; _this._container.style.height = "100%"; } var root; root = _this._container; if (_this._container != null) { root = _this._container; } var ren = new ReactRenderer(root, document, true, ZoomSliderStylingDefaults); _this._wrapper = ren; var zoomSlider = _this.i; _this._zoomSlider = zoomSlider; zoomSlider.provideContainer(ren); zoomSlider.notifySizeChanged(); if (props) { _this.initializeProperties(); } ren.addSizeWatcher(function () { _this._zoomSlider.notifySizeChanged(); }); return _this; } Object.defineProperty(IgrZoomSlider.prototype, "height", { get: function () { return this._height; }, set: function (value) { this._height = value; if (this._elRef) { this._elRef.style.height = value; this._zoomSlider.notifySizeChanged(); } }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "width", { get: function () { return this._width; }, set: function (value) { this._width = value; if (this._elRef) { this._elRef.style.height = value; this._zoomSlider.notifySizeChanged(); } }, enumerable: false, configurable: true }); IgrZoomSlider.prototype._getMainRef = function (ref) { this._elRef = ref; }; IgrZoomSlider.prototype.render = function () { var div = React.createElement("div", { className: "ig-zoom-slider igr-zoom-slider", ref: this._getMainRef }); //} return div; }; IgrZoomSlider.prototype.shouldComponentUpdate = function (nextProps, nextState) { var e_1, _a; var mod = getModifiedProps(this.props, nextProps); try { for (var _b = __values(Object.keys(mod)), _c = _b.next(); !_c.done; _c = _b.next()) { var p = _c.value; if (isValidProp(this, p)) { this[p] = mod[p]; } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } return true; }; IgrZoomSlider.prototype.initializeProperties = function () { var e_2, _a; try { for (var _b = __values(Object.keys(this.props)), _c = _b.next(); !_c.done; _c = _b.next()) { var p = _c.value; if (isValidProp(this, p)) { this[p] = this.props[p]; } } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_2) throw e_2.error; } } }; // supports angular themes or custom properties set in CSS IgrZoomSlider.prototype.updateStyle = function () { this._styling(this._elRef, this); }; /** * Release any resources held by the ZoomSlider. */ IgrZoomSlider.prototype.destroy = function () { this.i.destroy(); this._zoomSlider.destroy(); this._wrapper.destroy(); }; IgrZoomSlider.prototype.componentWillUnmount = function () { }; IgrZoomSlider.prototype.componentDidMount = function () { this._elRef.style.width = this._width ? this._width : ""; this._elRef.style.height = this._height ? this._height : ""; this._elRef.appendChild(this._container); this._zoomSlider.notifySizeChanged(); this.initializeContent(); }; IgrZoomSlider.prototype.initializeContent = function () { this.updateStyle(); }; IgrZoomSlider.prototype.createImplementation = function () { return new ZoomSlider(); }; Object.defineProperty(IgrZoomSlider.prototype, "i", { get: function () { return this._implementation; }, enumerable: false, configurable: true }); IgrZoomSlider._staticStyling = function (container, component, parent) { var genericPrefix = ""; var typeName = (component.i ? component.i : component).$type.name; if (typeName.indexOf("Xam") === 0) { typeName = typeName.substring(3); } genericPrefix = toSpinal("ZoomSlider"); var additionalPrefixes = []; var prefix = toSpinal(typeName); additionalPrefixes.push(prefix + "-"); var 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); } var basePrefix = toSpinal(typeName); additionalPrefixes.push(basePrefix + "-"); b = b.baseType; } if (parent) { var parentTypeName = parent.i.$type.name; if (parentTypeName.indexOf("Xam") === 0) { parentTypeName = parentTypeName.substring(3); } var parentPrefix = toSpinal(parentTypeName); additionalPrefixes.push(parentPrefix + "-" + genericPrefix + "-"); additionalPrefixes.push(parentPrefix + "-" + prefix + "-"); } initializePropertiesFromCss(container, component, genericPrefix + "-", new Set(), false, additionalPrefixes); }; Object.defineProperty(IgrZoomSlider.prototype, "panTransitionDuration", { get: function () { return this.i.bl; }, set: function (v) { this.i.bl = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "maxZoomWidth", { get: function () { return this.i.bg; }, set: function (v) { this.i.bg = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "pixelScalingRatio", { /** * 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: function () { return this.i.bi; }, set: function (v) { this.i.bi = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "actualPixelScalingRatio", { get: function () { return this.i.a4; }, set: function (v) { this.i.a4 = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "windowRect", { get: function () { return fromRect(this.i.windowRect); }, set: function (v) { this.i.windowRect = toRect(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "minZoomWidth", { get: function () { return this.i.bh; }, set: function (v) { this.i.bh = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "startInset", { get: function () { return this.i.startInset; }, set: function (v) { this.i.startInset = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "endInset", { get: function () { return this.i.endInset; }, set: function (v) { this.i.endInset = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "trackStartInset", { get: function () { return this.i.trackStartInset; }, set: function (v) { this.i.trackStartInset = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "trackEndInset", { get: function () { return this.i.trackEndInset; }, set: function (v) { this.i.trackEndInset = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "barExtent", { get: function () { return this.i.barExtent; }, set: function (v) { this.i.barExtent = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "orientation", { get: function () { return this.i.e; }, set: function (v) { this.i.e = ensureEnum(ZoomSliderOrientation_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "lowerThumbBrush", { get: function () { return brushToString(this.i.e8); }, set: function (v) { this.i.e8 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "lowerThumbStrokeThickness", { get: function () { return this.i.be; }, set: function (v) { this.i.be = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "higherThumbStrokeThickness", { get: function () { return this.i.a9; }, set: function (v) { this.i.a9 = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "higherThumbBrush", { get: function () { return brushToString(this.i.e0); }, set: function (v) { this.i.e0 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "lowerThumbOutline", { get: function () { return brushToString(this.i.e9); }, set: function (v) { this.i.e9 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "higherThumbOutline", { get: function () { return brushToString(this.i.e1); }, set: function (v) { this.i.e1 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "lowerThumbRidgesBrush", { get: function () { return brushToString(this.i.fa); }, set: function (v) { this.i.fa = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "higherThumbRidgesBrush", { get: function () { return brushToString(this.i.e2); }, set: function (v) { this.i.e2 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "lowerThumbWidth", { get: function () { return this.i.bf; }, set: function (v) { this.i.bf = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "higherThumbWidth", { get: function () { return this.i.ba; }, set: function (v) { this.i.ba = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "lowerThumbHeight", { get: function () { return this.i.bd; }, set: function (v) { this.i.bd = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "higherThumbHeight", { get: function () { return this.i.a8; }, set: function (v) { this.i.a8 = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "lowerShadeBrush", { get: function () { return brushToString(this.i.e6); }, set: function (v) { this.i.e6 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "lowerShadeOutline", { get: function () { return brushToString(this.i.e7); }, set: function (v) { this.i.e7 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "lowerShadeStrokeThickness", { get: function () { return this.i.bc; }, set: function (v) { this.i.bc = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "higherShadeBrush", { get: function () { return brushToString(this.i.ey); }, set: function (v) { this.i.ey = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "higherShadeOutline", { get: function () { return brushToString(this.i.ez); }, set: function (v) { this.i.ez = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "higherShadeStrokeThickness", { get: function () { return this.i.a7; }, set: function (v) { this.i.a7 = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "barBrush", { get: function () { return brushToString(this.i.et); }, set: function (v) { this.i.et = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "barOutline", { get: function () { return brushToString(this.i.eu); }, set: function (v) { this.i.eu = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "barStrokeThickness", { get: function () { return this.i.a5; }, set: function (v) { this.i.a5 = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "rangeThumbBrush", { get: function () { return brushToString(this.i.fb); }, set: function (v) { this.i.fb = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "rangeThumbOutline", { get: function () { return brushToString(this.i.fc); }, set: function (v) { this.i.fc = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "rangeThumbStrokeThickness", { get: function () { return this.i.bj; }, set: function (v) { this.i.bj = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "rangeThumbRidgesBrush", { get: function () { return brushToString(this.i.fd); }, set: function (v) { this.i.fd = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "lowerCalloutBrush", { get: function () { return brushToString(this.i.e3); }, set: function (v) { this.i.e3 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "lowerCalloutTextColor", { get: function () { return brushToString(this.i.e5); }, set: function (v) { this.i.e5 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "lowerCalloutOutline", { get: function () { return brushToString(this.i.e4); }, set: function (v) { this.i.e4 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "lowerCalloutStrokeThickness", { get: function () { return this.i.bb; }, set: function (v) { this.i.bb = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "higherCalloutBrush", { get: function () { return brushToString(this.i.ev); }, set: function (v) { this.i.ev = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "higherCalloutTextColor", { get: function () { return brushToString(this.i.ex); }, set: function (v) { this.i.ex = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "higherCalloutOutline", { get: function () { return brushToString(this.i.ew); }, set: function (v) { this.i.ew = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "higherCalloutStrokeThickness", { get: function () { return this.i.a6; }, set: function (v) { this.i.a6 = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "isCustomThumbProvided", { get: function () { return this.i.ab; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "isCustomRangeThumbProvided", { get: function () { return this.i.z; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "isCustomBarProvided", { get: function () { return this.i.y; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "isCustomShadeProvided", { get: function () { return this.i.aa; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "areThumbCalloutsEnabled", { get: function () { return this.i.q; }, set: function (v) { this.i.q = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "thumbCalloutTextStyle", { get: function () { if (this.i.o == null) { return null; } return this.i.o.fontString; }, set: function (v) { var fi = new FontInfo(); fi.fontString = v; this.i.o = fi; }, enumerable: false, configurable: true }); IgrZoomSlider.prototype.findByName = function (name) { if (this.findEphemera) { if (name && name.indexOf("@@e:") == 0) { return this.findEphemera(name); } } return null; }; Object.defineProperty(IgrZoomSlider.prototype, "hasUserValues", { get: function () { return this._hasUserValues; }, enumerable: false, configurable: true }); IgrZoomSlider.prototype.__m = function (propertyName) { if (!this._inStyling) { this._hasUserValues.add(propertyName); } }; IgrZoomSlider.prototype._styling = function (container, component, parent) { if (this._inStyling) { return; } this._inStyling = true; this._stylingContainer = container; this._stylingParent = component; var genericPrefix = ""; var typeName = this.i.$type.name; if (typeName.indexOf("Xam") === 0) { typeName = typeName.substring(3); } genericPrefix = toSpinal("ZoomSlider"); var additionalPrefixes = []; var prefix = toSpinal(typeName); additionalPrefixes.push(prefix + "-"); var 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); } var basePrefix = toSpinal(typeName); additionalPrefixes.push(basePrefix + "-"); b = b.baseType; } if (parent) { var parentTypeName = parent.i.$type.name; if (parentTypeName.indexOf("Xam") === 0) { parentTypeName = parentTypeName.substring(3); } var 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; }; IgrZoomSlider.prototype.onDetachedFromUI = function () { this.i.onDetachedFromUI(); }; IgrZoomSlider.prototype.onAttachedToUI = function () { this.i.onAttachedToUI(); }; /** * Called by the UI framework to provide a UI container for rendering this control. * @param container * The UI container element. */ IgrZoomSlider.prototype.provideContainer = function (container) { this.i.provideContainer(container); }; IgrZoomSlider.prototype.flush = function () { this.i.c3(); }; IgrZoomSlider.prototype.trackDirty = function () { this.i.trackDirty(); }; /** * Shows the ZoomSlider. */ IgrZoomSlider.prototype.show = function () { this.i.show(); }; /** * Hides the ZoomSlider. */ IgrZoomSlider.prototype.hide = function () { this.i.hide(); }; Object.defineProperty(IgrZoomSlider.prototype, "resolvingAxisValue", { get: function () { return this._resolvingAxisValue; }, set: function (ev) { var _this = this; 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 = function (o, e) { var outerArgs = new IgrZoomSliderResolvingAxisValueEventArgs(); 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); ; }, enumerable: false, configurable: true }); Object.defineProperty(IgrZoomSlider.prototype, "windowRectChanged", { /** * Occurs just after the current ZoomSlider's window rectangle is changed. */ get: function () { return this._windowRectChanged; }, set: function (ev) { var _this = this; 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 = function (o, e) { var outerArgs = new IgrRectChangedEventArgs(); 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); ; }, enumerable: false, configurable: true }); return IgrZoomSlider; }(React.Component)); export { IgrZoomSlider };