igniteui-react-inputs
Version:
Ignite UI React input components.
583 lines (579 loc) • 17.8 kB
JavaScript
import * as React from 'react';
import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { IgrMultiSliderThumbCollection } from "./igr-multi-slider-thumb-collection";
import { MultiSliderOrientation_$type } from "./MultiSliderOrientation";
import { IgrMultiSliderResolvingToolTipValueEventArgs } from "./igr-multi-slider-resolving-tool-tip-value-event-args";
import { IgrMultiSliderThumbValueChangingEventArgs } from "./igr-multi-slider-thumb-value-changing-event-args";
import { IgrMultiSliderYValueChangingEventArgs } from "./igr-multi-slider-y-value-changing-event-args";
import { MultiSlider } from "./MultiSlider";
import { TypeRegistrar } from "igniteui-react-core";
import { NamePatcher, getModifiedProps, isValidProp, fromRect, toRect, ensureEnum, brushToString, stringToBrush, ensureBool, toSpinal, initializePropertiesFromCss } from "igniteui-react-core";
import { MultiSliderThumbCollection as MultiSliderThumbCollection_internal } from "./MultiSliderThumbCollection";
import { MultiSliderThumb } from "./MultiSliderThumb";
import { SyncableObservableCollection$1 } from "igniteui-react-core";
import { FontInfo } from "igniteui-react-core";
export class IgrMultiSlider extends React.Component {
createImplementation() {
return new MultiSlider();
}
get nativeElement() {
return this._implementation.nativeElement;
}
/**
* @hidden
*/
get i() {
return this._implementation;
} /**
* @hidden
*/
static _createFromInternal(internal) {
if (!internal) {
return null;
}
if (!internal.$type) {
return null;
}
let name = internal.$type.name;
let externalName = "Igr" + name;
if (!TypeRegistrar.isRegistered(externalName)) {
return null;
}
return TypeRegistrar.create(externalName);
}
onImplementationCreated() {
}
constructor(props) {
super(props);
this.mounted = false;
this._thumbs = null;
this.__p = null;
this._hasUserValues = new Set();
this._stylingContainer = null;
this._stylingParent = null;
this._inStyling = false;
this._resolvingToolTipValue = null;
this._resolvingToolTipValue_wrapped = null;
this._thumbValueChanging = null;
this._thumbValueChanging_wrapped = null;
this._thumbValueChanged = null;
this._thumbValueChanged_wrapped = null;
this._yValueChanging = null;
this._yValueChanging_wrapped = null;
this._yValueChanged = null;
this._yValueChanged_wrapped = null;
if (this._styling) {
NamePatcher.ensureStylablePatched(Object.getPrototypeOf(this));
}
this._implementation = this.createImplementation();
this._implementation.externalObject = this;
this.onImplementationCreated();
if (this._initializeAdapters) {
this._initializeAdapters();
}
}
componentDidMount() {
this.mounted = true;
for (const p of Object.keys(this.props)) {
if (isValidProp(this, p)) {
this[p] = this.props[p];
}
}
}
shouldComponentUpdate(nextProps, nextState) {
const mod = getModifiedProps(this.props, nextProps);
for (const p of Object.keys(mod)) {
if (isValidProp(this, p)) {
this[p] = mod[p];
}
}
return true;
}
render() {
return null;
}
/**
* Gets the column definitions that are assigned to the grid. This collection can be modified to add or remove columns in the grid.
*/
get thumbs() {
if (this._thumbs === null) {
let coll = new IgrMultiSliderThumbCollection();
let innerColl = this.i.thumbs;
if (!innerColl) {
innerColl = new MultiSliderThumbCollection_internal();
}
this._thumbs = coll._fromInner(innerColl);
}
return this._thumbs;
}
set thumbs(v) {
if (this._thumbs !== null) {
this._thumbs._setSyncTarget(null);
this._thumbs = null;
}
let coll = new IgrMultiSliderThumbCollection();
this._thumbs = coll._fromOuter(v);
let syncColl = new SyncableObservableCollection$1(MultiSliderThumb.$type);
let innerColl = this.i.thumbs;
if (!innerColl) {
innerColl = new MultiSliderThumbCollection_internal();
}
syncColl._inner = innerColl;
syncColl.clear();
this._thumbs._setSyncTarget(syncColl);
}
get min() {
return this.i.bg;
}
set min(v) {
this.i.bg = +v;
}
get max() {
return this.i.bf;
}
set max(v) {
this.i.bf = +v;
}
get step() {
return this.i.bl;
}
set step(v) {
this.i.bl = +v;
}
get yMax() {
return this.i.bu;
}
set yMax(v) {
this.i.bu = +v;
}
get yMin() {
return this.i.bv;
}
set yMin(v) {
this.i.bv = +v;
}
get yStep() {
return this.i.bx;
}
set yStep(v) {
this.i.bx = +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.bh;
}
set pixelScalingRatio(v) {
this.i.bh = +v;
}
get actualPixelScalingRatio() {
return this.i.a9;
}
set actualPixelScalingRatio(v) {
this.i.a9 = +v;
}
get windowRect() {
return fromRect(this.i.e1);
}
set windowRect(v) {
this.i.e1 = toRect(v);
}
get yValue() {
return this.i.b0;
}
set yValue(v) {
this.i.b0 = +v;
}
get startInset() {
return this.i.bk;
}
set startInset(v) {
this.i.bk = +v;
}
get endInset() {
return this.i.be;
}
set endInset(v) {
this.i.be = +v;
}
get trackStartInset() {
return this.i.bq;
}
set trackStartInset(v) {
this.i.bq = +v;
}
get trackEndInset() {
return this.i.bp;
}
set trackEndInset(v) {
this.i.bp = +v;
}
get yTrackStartInset() {
return this.i.bz;
}
set yTrackStartInset(v) {
this.i.bz = +v;
}
get yTrackEndInset() {
return this.i.by;
}
set yTrackEndInset(v) {
this.i.by = +v;
}
get barExtent() {
return this.i.bb;
}
set barExtent(v) {
this.i.bb = +v;
}
get orientation() {
return this.i.e;
}
set orientation(v) {
this.i.e = ensureEnum(MultiSliderOrientation_$type, v);
}
get thumbBrush() {
return brushToString(this.i.es);
}
set thumbBrush(v) {
this.i.es = stringToBrush(v);
}
get thumbStrokeThickness() {
return this.i.bn;
}
set thumbStrokeThickness(v) {
this.i.bn = +v;
}
get thumbOutline() {
return brushToString(this.i.et);
}
set thumbOutline(v) {
this.i.et = stringToBrush(v);
}
get thumbWidth() {
return this.i.bo;
}
set thumbWidth(v) {
this.i.bo = +v;
}
get thumbHeight() {
return this.i.bm;
}
set thumbHeight(v) {
this.i.bm = +v;
}
get barBrush() {
return brushToString(this.i.ek);
}
set barBrush(v) {
this.i.ek = stringToBrush(v);
}
get barOutline() {
return brushToString(this.i.el);
}
set barOutline(v) {
this.i.el = stringToBrush(v);
}
get barStrokeThickness() {
return this.i.bc;
}
set barStrokeThickness(v) {
this.i.bc = +v;
}
get rangeThumbBrush() {
return brushToString(this.i.ep);
}
set rangeThumbBrush(v) {
this.i.ep = stringToBrush(v);
}
get rangeThumbOutline() {
return brushToString(this.i.eq);
}
set rangeThumbOutline(v) {
this.i.eq = stringToBrush(v);
}
get rangeThumbStrokeThickness() {
return this.i.bj;
}
set rangeThumbStrokeThickness(v) {
this.i.bj = +v;
}
get rangeThumbRidgesBrush() {
return brushToString(this.i.er);
}
set rangeThumbRidgesBrush(v) {
this.i.er = stringToBrush(v);
}
get thumbRidgesBrush() {
return brushToString(this.i.eu);
}
set thumbRidgesBrush(v) {
this.i.eu = stringToBrush(v);
}
get calloutBrush() {
return brushToString(this.i.em);
}
set calloutBrush(v) {
this.i.em = stringToBrush(v);
}
get calloutTextColor() {
return brushToString(this.i.eo);
}
set calloutTextColor(v) {
this.i.eo = stringToBrush(v);
}
get calloutOutline() {
return brushToString(this.i.en);
}
set calloutOutline(v) {
this.i.en = stringToBrush(v);
}
get calloutStrokeThickness() {
return this.i.bd;
}
set calloutStrokeThickness(v) {
this.i.bd = +v;
}
get isCustomThumbProvided() {
return this.i.ac;
}
get isCustomRangeThumbProvided() {
return this.i.aa;
}
get isCustomBarProvided() {
return this.i.z;
}
get isCustomShadeProvided() {
return this.i.ab;
}
get areThumbCalloutsEnabled() {
return this.i.t;
}
set areThumbCalloutsEnabled(v) {
this.i.t = ensureBool(v);
}
get thumbCalloutTextStyle() {
if (this.i.p == null) {
return null;
}
return this.i.p.fontString;
}
set thumbCalloutTextStyle(v) {
let fi = new FontInfo();
fi.fontString = v;
this.i.p = fi;
}
findByName(name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
if (this.thumbs != null && this.thumbs.findByName && this.thumbs.findByName(name)) {
return this.thumbs.findByName(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("MultiSlider");
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.c7();
}
trackDirty() {
this.i.trackDirty();
}
/**
* Shows the ZoomSlider.
*/
show() {
this.i.dw();
}
/**
* Hides the ZoomSlider.
*/
hide() {
this.i.c8();
}
get resolvingToolTipValue() {
return this._resolvingToolTipValue;
}
set resolvingToolTipValue(ev) {
if (this._resolvingToolTipValue_wrapped !== null) {
this.i.resolvingToolTipValue = delegateRemove(this.i.resolvingToolTipValue, this._resolvingToolTipValue_wrapped);
this._resolvingToolTipValue_wrapped = null;
this._resolvingToolTipValue = null;
}
this._resolvingToolTipValue = ev;
this._resolvingToolTipValue_wrapped = (o, e) => {
let outerArgs = new IgrMultiSliderResolvingToolTipValueEventArgs();
outerArgs._provideImplementation(e);
if (this.beforeResolvingToolTipValue) {
this.beforeResolvingToolTipValue(this, outerArgs);
}
if (this._resolvingToolTipValue) {
this._resolvingToolTipValue(this, outerArgs);
}
};
this.i.resolvingToolTipValue = delegateCombine(this.i.resolvingToolTipValue, this._resolvingToolTipValue_wrapped);
;
}
get thumbValueChanging() {
return this._thumbValueChanging;
}
set thumbValueChanging(ev) {
if (this._thumbValueChanging_wrapped !== null) {
this.i.thumbValueChanging = delegateRemove(this.i.thumbValueChanging, this._thumbValueChanging_wrapped);
this._thumbValueChanging_wrapped = null;
this._thumbValueChanging = null;
}
this._thumbValueChanging = ev;
this._thumbValueChanging_wrapped = (o, e) => {
let outerArgs = new IgrMultiSliderThumbValueChangingEventArgs();
outerArgs._provideImplementation(e);
if (this.beforeThumbValueChanging) {
this.beforeThumbValueChanging(this, outerArgs);
}
if (this._thumbValueChanging) {
this._thumbValueChanging(this, outerArgs);
}
};
this.i.thumbValueChanging = delegateCombine(this.i.thumbValueChanging, this._thumbValueChanging_wrapped);
;
}
get thumbValueChanged() {
return this._thumbValueChanged;
}
set thumbValueChanged(ev) {
if (this._thumbValueChanged_wrapped !== null) {
this.i.thumbValueChanged = delegateRemove(this.i.thumbValueChanged, this._thumbValueChanged_wrapped);
this._thumbValueChanged_wrapped = null;
this._thumbValueChanged = null;
}
this._thumbValueChanged = ev;
this._thumbValueChanged_wrapped = (o, e) => {
let outerArgs = new IgrMultiSliderThumbValueChangingEventArgs();
outerArgs._provideImplementation(e);
if (this.beforeThumbValueChanged) {
this.beforeThumbValueChanged(this, outerArgs);
}
if (this._thumbValueChanged) {
this._thumbValueChanged(this, outerArgs);
}
};
this.i.thumbValueChanged = delegateCombine(this.i.thumbValueChanged, this._thumbValueChanged_wrapped);
;
}
get yValueChanging() {
return this._yValueChanging;
}
set yValueChanging(ev) {
if (this._yValueChanging_wrapped !== null) {
this.i.yValueChanging = delegateRemove(this.i.yValueChanging, this._yValueChanging_wrapped);
this._yValueChanging_wrapped = null;
this._yValueChanging = null;
}
this._yValueChanging = ev;
this._yValueChanging_wrapped = (o, e) => {
let outerArgs = new IgrMultiSliderYValueChangingEventArgs();
outerArgs._provideImplementation(e);
if (this.beforeYValueChanging) {
this.beforeYValueChanging(this, outerArgs);
}
if (this._yValueChanging) {
this._yValueChanging(this, outerArgs);
}
};
this.i.yValueChanging = delegateCombine(this.i.yValueChanging, this._yValueChanging_wrapped);
;
}
get yValueChanged() {
return this._yValueChanged;
}
set yValueChanged(ev) {
if (this._yValueChanged_wrapped !== null) {
this.i.yValueChanged = delegateRemove(this.i.yValueChanged, this._yValueChanged_wrapped);
this._yValueChanged_wrapped = null;
this._yValueChanged = null;
}
this._yValueChanged = ev;
this._yValueChanged_wrapped = (o, e) => {
let outerArgs = new IgrMultiSliderYValueChangingEventArgs();
outerArgs._provideImplementation(e);
if (this.beforeYValueChanged) {
this.beforeYValueChanged(this, outerArgs);
}
if (this._yValueChanged) {
this._yValueChanged(this, outerArgs);
}
};
this.i.yValueChanged = delegateCombine(this.i.yValueChanged, this._yValueChanged_wrapped);
;
}
}