igniteui-react-inputs
Version:
Ignite UI React input components.
827 lines (823 loc) • 27.9 kB
JavaScript
import { __extends, __values } from "tslib";
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";
var IgrMultiSlider = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgrMultiSlider, _super);
function IgrMultiSlider(props) {
var _this = _super.call(this, props) || this;
_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();
}
return _this;
}
IgrMultiSlider.prototype.createImplementation = function () {
return new MultiSlider();
};
Object.defineProperty(IgrMultiSlider.prototype, "nativeElement", {
get: function () {
return this._implementation.nativeElement;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
} /**
* @hidden
*/,
enumerable: false,
configurable: true
});
IgrMultiSlider._createFromInternal = function (internal) {
if (!internal) {
return null;
}
if (!internal.$type) {
return null;
}
var name = internal.$type.name;
var externalName = "Igr" + name;
if (!TypeRegistrar.isRegistered(externalName)) {
return null;
}
return TypeRegistrar.create(externalName);
};
IgrMultiSlider.prototype.onImplementationCreated = function () {
};
IgrMultiSlider.prototype.componentDidMount = function () {
var e_1, _a;
this.mounted = true;
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_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;
}
}
};
IgrMultiSlider.prototype.shouldComponentUpdate = function (nextProps, nextState) {
var e_2, _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_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;
}
}
return true;
};
IgrMultiSlider.prototype.render = function () {
return null;
};
Object.defineProperty(IgrMultiSlider.prototype, "thumbs", {
/**
* Gets the column definitions that are assigned to the grid. This collection can be modified to add or remove columns in the grid.
*/
get: function () {
if (this._thumbs === null) {
var coll = new IgrMultiSliderThumbCollection();
var innerColl = this.i.thumbs;
if (!innerColl) {
innerColl = new MultiSliderThumbCollection_internal();
}
this._thumbs = coll._fromInner(innerColl);
}
return this._thumbs;
},
set: function (v) {
if (this._thumbs !== null) {
this._thumbs._setSyncTarget(null);
this._thumbs = null;
}
var coll = new IgrMultiSliderThumbCollection();
this._thumbs = coll._fromOuter(v);
var syncColl = new SyncableObservableCollection$1(MultiSliderThumb.$type);
var innerColl = this.i.thumbs;
if (!innerColl) {
innerColl = new MultiSliderThumbCollection_internal();
}
syncColl._inner = innerColl;
syncColl.clear();
this._thumbs._setSyncTarget(syncColl);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "min", {
get: function () {
return this.i.bg;
},
set: function (v) {
this.i.bg = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "max", {
get: function () {
return this.i.bf;
},
set: function (v) {
this.i.bf = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "step", {
get: function () {
return this.i.bl;
},
set: function (v) {
this.i.bl = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "yMax", {
get: function () {
return this.i.bu;
},
set: function (v) {
this.i.bu = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "yMin", {
get: function () {
return this.i.bv;
},
set: function (v) {
this.i.bv = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "yStep", {
get: function () {
return this.i.bx;
},
set: function (v) {
this.i.bx = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.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.bh;
},
set: function (v) {
this.i.bh = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "actualPixelScalingRatio", {
get: function () {
return this.i.a9;
},
set: function (v) {
this.i.a9 = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "windowRect", {
get: function () {
return fromRect(this.i.e1);
},
set: function (v) {
this.i.e1 = toRect(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "yValue", {
get: function () {
return this.i.b0;
},
set: function (v) {
this.i.b0 = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "startInset", {
get: function () {
return this.i.bk;
},
set: function (v) {
this.i.bk = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "endInset", {
get: function () {
return this.i.be;
},
set: function (v) {
this.i.be = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "trackStartInset", {
get: function () {
return this.i.bq;
},
set: function (v) {
this.i.bq = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "trackEndInset", {
get: function () {
return this.i.bp;
},
set: function (v) {
this.i.bp = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "yTrackStartInset", {
get: function () {
return this.i.bz;
},
set: function (v) {
this.i.bz = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "yTrackEndInset", {
get: function () {
return this.i.by;
},
set: function (v) {
this.i.by = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "barExtent", {
get: function () {
return this.i.bb;
},
set: function (v) {
this.i.bb = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "orientation", {
get: function () {
return this.i.e;
},
set: function (v) {
this.i.e = ensureEnum(MultiSliderOrientation_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "thumbBrush", {
get: function () {
return brushToString(this.i.es);
},
set: function (v) {
this.i.es = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "thumbStrokeThickness", {
get: function () {
return this.i.bn;
},
set: function (v) {
this.i.bn = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "thumbOutline", {
get: function () {
return brushToString(this.i.et);
},
set: function (v) {
this.i.et = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "thumbWidth", {
get: function () {
return this.i.bo;
},
set: function (v) {
this.i.bo = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "thumbHeight", {
get: function () {
return this.i.bm;
},
set: function (v) {
this.i.bm = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "barBrush", {
get: function () {
return brushToString(this.i.ek);
},
set: function (v) {
this.i.ek = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "barOutline", {
get: function () {
return brushToString(this.i.el);
},
set: function (v) {
this.i.el = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "barStrokeThickness", {
get: function () {
return this.i.bc;
},
set: function (v) {
this.i.bc = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "rangeThumbBrush", {
get: function () {
return brushToString(this.i.ep);
},
set: function (v) {
this.i.ep = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "rangeThumbOutline", {
get: function () {
return brushToString(this.i.eq);
},
set: function (v) {
this.i.eq = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "rangeThumbStrokeThickness", {
get: function () {
return this.i.bj;
},
set: function (v) {
this.i.bj = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "rangeThumbRidgesBrush", {
get: function () {
return brushToString(this.i.er);
},
set: function (v) {
this.i.er = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "thumbRidgesBrush", {
get: function () {
return brushToString(this.i.eu);
},
set: function (v) {
this.i.eu = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "calloutBrush", {
get: function () {
return brushToString(this.i.em);
},
set: function (v) {
this.i.em = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "calloutTextColor", {
get: function () {
return brushToString(this.i.eo);
},
set: function (v) {
this.i.eo = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "calloutOutline", {
get: function () {
return brushToString(this.i.en);
},
set: function (v) {
this.i.en = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "calloutStrokeThickness", {
get: function () {
return this.i.bd;
},
set: function (v) {
this.i.bd = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "isCustomThumbProvided", {
get: function () {
return this.i.ac;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "isCustomRangeThumbProvided", {
get: function () {
return this.i.aa;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "isCustomBarProvided", {
get: function () {
return this.i.z;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "isCustomShadeProvided", {
get: function () {
return this.i.ab;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "areThumbCalloutsEnabled", {
get: function () {
return this.i.t;
},
set: function (v) {
this.i.t = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "thumbCalloutTextStyle", {
get: function () {
if (this.i.p == null) {
return null;
}
return this.i.p.fontString;
},
set: function (v) {
var fi = new FontInfo();
fi.fontString = v;
this.i.p = fi;
},
enumerable: false,
configurable: true
});
IgrMultiSlider.prototype.findByName = function (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;
};
Object.defineProperty(IgrMultiSlider.prototype, "hasUserValues", {
get: function () {
return this._hasUserValues;
},
enumerable: false,
configurable: true
});
IgrMultiSlider.prototype.__m = function (propertyName) {
if (!this._inStyling) {
this._hasUserValues.add(propertyName);
}
};
IgrMultiSlider.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("MultiSlider");
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;
};
IgrMultiSlider.prototype.onDetachedFromUI = function () {
this.i.onDetachedFromUI();
};
IgrMultiSlider.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.
*/
IgrMultiSlider.prototype.provideContainer = function (container) {
this.i.provideContainer(container);
};
IgrMultiSlider.prototype.flush = function () {
this.i.c7();
};
IgrMultiSlider.prototype.trackDirty = function () {
this.i.trackDirty();
};
/**
* Shows the ZoomSlider.
*/
IgrMultiSlider.prototype.show = function () {
this.i.dw();
};
/**
* Hides the ZoomSlider.
*/
IgrMultiSlider.prototype.hide = function () {
this.i.c8();
};
Object.defineProperty(IgrMultiSlider.prototype, "resolvingToolTipValue", {
get: function () {
return this._resolvingToolTipValue;
},
set: function (ev) {
var _this = this;
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 = function (o, e) {
var 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);
;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "thumbValueChanging", {
get: function () {
return this._thumbValueChanging;
},
set: function (ev) {
var _this = this;
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 = function (o, e) {
var 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);
;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "thumbValueChanged", {
get: function () {
return this._thumbValueChanged;
},
set: function (ev) {
var _this = this;
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 = function (o, e) {
var 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);
;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "yValueChanging", {
get: function () {
return this._yValueChanging;
},
set: function (ev) {
var _this = this;
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 = function (o, e) {
var 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);
;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrMultiSlider.prototype, "yValueChanged", {
get: function () {
return this._yValueChanged;
},
set: function (ev) {
var _this = this;
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 = function (o, e) {
var 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);
;
},
enumerable: false,
configurable: true
});
return IgrMultiSlider;
}(React.Component));
export { IgrMultiSlider };