@seniorsistemas/angular-components 17.16.4 → 17.16.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/seniorsistemas-angular-components.umd.js +192 -194
- package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js +2 -2
- package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
- package/components/panel/panel.component.d.ts +2 -2
- package/components/slider/slider.component.d.ts +19 -17
- package/esm2015/components/panel/panel.component.js +7 -7
- package/esm2015/components/slider/slider.component.js +180 -187
- package/esm5/components/panel/panel.component.js +7 -7
- package/esm5/components/slider/slider.component.js +188 -190
- package/fesm2015/seniorsistemas-angular-components.js +185 -192
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +192 -194
- package/fesm5/seniorsistemas-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/seniorsistemas-angular-components.metadata.json +1 -1
|
@@ -17783,7 +17783,7 @@
|
|
|
17783
17783
|
|
|
17784
17784
|
var PanelComponent = /** @class */ (function () {
|
|
17785
17785
|
function PanelComponent() {
|
|
17786
|
-
this.
|
|
17786
|
+
this.toggleable = false;
|
|
17787
17787
|
this.collapsed = false;
|
|
17788
17788
|
this.severity = exports.EnumSeverity.Default;
|
|
17789
17789
|
this.collapsedChange = new core.EventEmitter();
|
|
@@ -17814,15 +17814,12 @@
|
|
|
17814
17814
|
this.bodyTemplate = this.getBodyTemplate();
|
|
17815
17815
|
this.footerTemplate = this.getFooterTemplate();
|
|
17816
17816
|
};
|
|
17817
|
-
__decorate([
|
|
17818
|
-
core.ContentChildren(TemplateDirective)
|
|
17819
|
-
], PanelComponent.prototype, "templates", void 0);
|
|
17820
17817
|
__decorate([
|
|
17821
17818
|
core.Input()
|
|
17822
17819
|
], PanelComponent.prototype, "header", void 0);
|
|
17823
17820
|
__decorate([
|
|
17824
17821
|
core.Input()
|
|
17825
|
-
], PanelComponent.prototype, "
|
|
17822
|
+
], PanelComponent.prototype, "toggleable", void 0);
|
|
17826
17823
|
__decorate([
|
|
17827
17824
|
core.Input()
|
|
17828
17825
|
], PanelComponent.prototype, "collapsed", void 0);
|
|
@@ -17838,10 +17835,13 @@
|
|
|
17838
17835
|
__decorate([
|
|
17839
17836
|
core.Output()
|
|
17840
17837
|
], PanelComponent.prototype, "collapsedChange", void 0);
|
|
17838
|
+
__decorate([
|
|
17839
|
+
core.ContentChildren(TemplateDirective)
|
|
17840
|
+
], PanelComponent.prototype, "templates", void 0);
|
|
17841
17841
|
PanelComponent = __decorate([
|
|
17842
17842
|
core.Component({
|
|
17843
17843
|
selector: "s-panel",
|
|
17844
|
-
template: "<div\n class=\"
|
|
17844
|
+
template: "<div\n [class]=\"class\"\n [ngClass]=\"{\n 'panel': true,\n 'panel--success': severity === EnumSeverity.Success,\n 'panel--info': severity === EnumSeverity.Info,\n 'panel--warn': severity === EnumSeverity.Warn,\n 'panel--error': severity === EnumSeverity.Error,\n 'panel--collapsed': collapsed\n }\"\n>\n <s-border-button\n *ngIf=\"borderButtonOptions?.visible ? borderButtonOptions?.visible(severity) : false\"\n [severity]=\"severity\"\n [options]=\"borderButtonOptions\"\n class=\"border-button\"\n [@BorderButtonAnimation]\n >\n </s-border-button>\n\n <div class=\"header\">\n <ng-container *ngIf=\"headerTemplate; then customHeaderTemplate; else simpleHeaderTemplate\"></ng-container>\n <ng-template #customHeaderTemplate>\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n </ng-template>\n <ng-template #simpleHeaderTemplate>\n <span>{{ header }}</span>\n </ng-template>\n\n <button\n *ngIf=\"toggleable\"\n class=\"collapse-button fas\"\n [ngClass]=\"{\n 'fa-plus': collapsed,\n 'fa-minus': !collapsed\n }\"\n (click)=\"toggleCollapsed()\"\n ></button>\n </div>\n\n <div *ngIf=\"!toggleable || !collapsed\" class=\"panel-content\">\n <div class=\"body\">\n <ng-content></ng-content>\n <ng-container *ngTemplateOutlet=\"bodyTemplate\"></ng-container>\n </div>\n\n <div *ngIf=\"footerTemplate\" class=\"footer\">\n <ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container>\n </div>\n </div>\n</div>\n",
|
|
17845
17845
|
animations: [
|
|
17846
17846
|
animations.trigger("BorderButtonAnimation", [
|
|
17847
17847
|
animations.transition(":enter", [
|
|
@@ -18592,14 +18592,16 @@
|
|
|
18592
18592
|
var SliderComponent = /** @class */ (function () {
|
|
18593
18593
|
function SliderComponent() {
|
|
18594
18594
|
var _this = this;
|
|
18595
|
+
this.MAX_RANGE_VALUE = 100;
|
|
18596
|
+
this.MIN_RANGE_VALUE = 0;
|
|
18595
18597
|
this.multiple = false;
|
|
18596
18598
|
this.value = 0;
|
|
18597
18599
|
this.valueChange = new core.EventEmitter();
|
|
18598
18600
|
this.step = 1;
|
|
18599
18601
|
this.hiddenThumb = false;
|
|
18600
18602
|
this.disabled = false;
|
|
18601
|
-
this.min =
|
|
18602
|
-
this.max =
|
|
18603
|
+
this.min = this.MIN_RANGE_VALUE;
|
|
18604
|
+
this.max = this.MAX_RANGE_VALUE;
|
|
18603
18605
|
this.tabindex = 0;
|
|
18604
18606
|
this.startValue = 0;
|
|
18605
18607
|
this.endValue = 0;
|
|
@@ -18618,13 +18620,11 @@
|
|
|
18618
18620
|
* @example
|
|
18619
18621
|
* with min = -10 and max = 10 will have this map.
|
|
18620
18622
|
* {
|
|
18621
|
-
* -10: {
|
|
18622
|
-
* -9: {
|
|
18623
|
+
* -10: { 0 },
|
|
18624
|
+
* -9: { 10 },
|
|
18623
18625
|
* ...
|
|
18624
|
-
* 10: {
|
|
18626
|
+
* 10: { 10 }
|
|
18625
18627
|
* }
|
|
18626
|
-
* the left value represent value for startValue, the right value represent value for endValue
|
|
18627
|
-
* left and right values are used when applying percentages in the slider
|
|
18628
18628
|
*/
|
|
18629
18629
|
this.mapRangeValuesForSlider = new Map();
|
|
18630
18630
|
this.activeMouseDown = false;
|
|
@@ -18637,16 +18637,16 @@
|
|
|
18637
18637
|
(_this.multiple && _this.draggingThumb === "end" && newPosition < _this.startValue)) {
|
|
18638
18638
|
return;
|
|
18639
18639
|
}
|
|
18640
|
-
var positionInUserRange = _this.
|
|
18640
|
+
var positionInUserRange = _this.getValueFromMapByValue(newPosition);
|
|
18641
18641
|
if (_this.multiple) {
|
|
18642
18642
|
if (_this.draggingThumb === "start") {
|
|
18643
18643
|
_this.startValue = _this.needParseValues
|
|
18644
|
-
? _this.mapRangeValuesForSlider.get(positionInUserRange)
|
|
18644
|
+
? _this.mapRangeValuesForSlider.get(positionInUserRange)
|
|
18645
18645
|
: newPosition;
|
|
18646
18646
|
}
|
|
18647
18647
|
else if (_this.draggingThumb === "end") {
|
|
18648
18648
|
_this.endValue = _this.needParseValues
|
|
18649
|
-
? _this.mapRangeValuesForSlider.get(positionInUserRange)
|
|
18649
|
+
? _this.mapRangeValuesForSlider.get(positionInUserRange)
|
|
18650
18650
|
: newPosition;
|
|
18651
18651
|
}
|
|
18652
18652
|
_this.setValue([_this.startValue, _this.endValue]);
|
|
@@ -18659,18 +18659,15 @@
|
|
|
18659
18659
|
}
|
|
18660
18660
|
}
|
|
18661
18661
|
else {
|
|
18662
|
-
var
|
|
18663
|
-
var
|
|
18664
|
-
|
|
18665
|
-
|
|
18666
|
-
|
|
18667
|
-
|
|
18668
|
-
|
|
18669
|
-
else if (pickRightValue) {
|
|
18670
|
-
_this.endValue = _this.needParseValues
|
|
18671
|
-
? _this.mapRangeValuesForSlider.get(positionInUserRange).right
|
|
18672
|
-
: newPosition;
|
|
18662
|
+
var currentValue = _this.value;
|
|
18663
|
+
var _value = _this.needParseValues ? positionInUserRange : newPosition;
|
|
18664
|
+
var isAtSameValue = _this.needParseValues ? positionInUserRange === _this.value : false;
|
|
18665
|
+
var hasStep = _this.step !== 0;
|
|
18666
|
+
var newValueIsValidByStep = hasStep ? currentValue + _this.step === _value || currentValue - _this.step === _value : false;
|
|
18667
|
+
if (isAtSameValue && !newValueIsValidByStep) {
|
|
18668
|
+
return;
|
|
18673
18669
|
}
|
|
18670
|
+
_this.endValue = _this.needParseValues ? _this.mapRangeValuesForSlider.get(positionInUserRange) : newPosition;
|
|
18674
18671
|
_this.startValue = _this.endValue;
|
|
18675
18672
|
_this.setValue(_this.endValue);
|
|
18676
18673
|
}
|
|
@@ -18691,20 +18688,20 @@
|
|
|
18691
18688
|
var startValueBeforeEvent = _this.startValueBeforeProgressBarEvent;
|
|
18692
18689
|
var range = _this.rangeBetweenElementsBeforeProgressBarEvent;
|
|
18693
18690
|
var _a = calculateNewRange(startValueBeforeEvent, startValueBeforeEvent + range, startPositionBeforeEvent, newCenter), newStart = _a.newStart, newEnd = _a.newEnd;
|
|
18694
|
-
if (newStart <
|
|
18691
|
+
if (newStart < _this.MIN_RANGE_VALUE || newEnd > _this.MAX_RANGE_VALUE) {
|
|
18695
18692
|
return;
|
|
18696
18693
|
}
|
|
18697
18694
|
if (_this.needParseValues) {
|
|
18698
|
-
var startValueBeforeEventUserRange = _this.
|
|
18699
|
-
var startPositionBeforeEventUserRange = _this.
|
|
18700
|
-
var centerUserRange = _this.
|
|
18695
|
+
var startValueBeforeEventUserRange = _this.getValueFromMapByValue(startValueBeforeEvent);
|
|
18696
|
+
var startPositionBeforeEventUserRange = _this.getValueFromMapByValue(startPositionBeforeEvent);
|
|
18697
|
+
var centerUserRange = _this.getValueFromMapByValue(newCenter);
|
|
18701
18698
|
var valueRange = _this.totalRangeBeforeProgressBarEvent;
|
|
18702
18699
|
var _b = calculateNewRange(startValueBeforeEventUserRange, startValueBeforeEventUserRange + valueRange, startPositionBeforeEventUserRange, centerUserRange), newStart_1 = _b.newStart, newEnd_1 = _b.newEnd;
|
|
18703
18700
|
if (newStart_1 < _this.min || newEnd_1 > _this.max) {
|
|
18704
18701
|
return;
|
|
18705
18702
|
}
|
|
18706
|
-
_this.startValue = _this.mapRangeValuesForSlider.get(newStart_1)
|
|
18707
|
-
_this.endValue = _this.mapRangeValuesForSlider.get(newEnd_1)
|
|
18703
|
+
_this.startValue = _this.mapRangeValuesForSlider.get(newStart_1);
|
|
18704
|
+
_this.endValue = _this.mapRangeValuesForSlider.get(newEnd_1);
|
|
18708
18705
|
}
|
|
18709
18706
|
else {
|
|
18710
18707
|
_this.startValue = newStart;
|
|
@@ -18727,8 +18724,15 @@
|
|
|
18727
18724
|
}
|
|
18728
18725
|
SliderComponent_1 = SliderComponent;
|
|
18729
18726
|
SliderComponent.prototype.ngOnInit = function () {
|
|
18730
|
-
|
|
18727
|
+
this.setUserRangeMapValues();
|
|
18728
|
+
};
|
|
18729
|
+
SliderComponent.prototype.ngOnChanges = function (changes) {
|
|
18730
|
+
var hasChangesOnMin = changes.min && !changes.min.firstChange;
|
|
18731
|
+
var hasChangesOnMax = changes.max && !changes.max.firstChange;
|
|
18732
|
+
var hasChanges = hasChangesOnMin || hasChangesOnMax;
|
|
18733
|
+
if (hasChanges) {
|
|
18731
18734
|
this.setUserRangeMapValues();
|
|
18735
|
+
this.setRangeValues();
|
|
18732
18736
|
}
|
|
18733
18737
|
};
|
|
18734
18738
|
SliderComponent.prototype.ngAfterViewInit = function () {
|
|
@@ -18751,14 +18755,16 @@
|
|
|
18751
18755
|
};
|
|
18752
18756
|
Object.defineProperty(SliderComponent.prototype, "tooltipStartText", {
|
|
18753
18757
|
get: function () {
|
|
18754
|
-
|
|
18758
|
+
var _a, _b;
|
|
18759
|
+
return Array.isArray(this.value) ? (_a = this.value[0]) === null || _a === void 0 ? void 0 : _a.toString() : (_b = this.value) === null || _b === void 0 ? void 0 : _b.toString();
|
|
18755
18760
|
},
|
|
18756
18761
|
enumerable: true,
|
|
18757
18762
|
configurable: true
|
|
18758
18763
|
});
|
|
18759
18764
|
Object.defineProperty(SliderComponent.prototype, "tooltipEndText", {
|
|
18760
18765
|
get: function () {
|
|
18761
|
-
|
|
18766
|
+
var _a, _b;
|
|
18767
|
+
return Array.isArray(this.value) ? (_a = this.value[1]) === null || _a === void 0 ? void 0 : _a.toString() : (_b = this.value) === null || _b === void 0 ? void 0 : _b.toString();
|
|
18762
18768
|
},
|
|
18763
18769
|
enumerable: true,
|
|
18764
18770
|
configurable: true
|
|
@@ -18787,11 +18793,11 @@
|
|
|
18787
18793
|
return;
|
|
18788
18794
|
}
|
|
18789
18795
|
var trackClickPercentage = this.getPercentageByEvent(evt);
|
|
18790
|
-
var trackClickToUserRange = this.
|
|
18796
|
+
var trackClickToUserRange = this.getValueFromMapByValue(trackClickPercentage);
|
|
18791
18797
|
var _trackClickValid = this.needParseValues ? trackClickToUserRange : trackClickPercentage;
|
|
18792
18798
|
var _setEndValue = function () {
|
|
18793
|
-
var _endValueUserValue = _this.
|
|
18794
|
-
var _endValue = _this.needParseValues ? _this.mapRangeValuesForSlider.get(trackClickToUserRange)
|
|
18799
|
+
var _endValueUserValue = _this.getValueFromMapByValue(_this.endValue);
|
|
18800
|
+
var _endValue = _this.needParseValues ? _this.mapRangeValuesForSlider.get(trackClickToUserRange) : trackClickPercentage;
|
|
18795
18801
|
if (_this.needParseValues && _endValueUserValue !== trackClickToUserRange) {
|
|
18796
18802
|
_this.endValue = _endValue;
|
|
18797
18803
|
}
|
|
@@ -18800,10 +18806,10 @@
|
|
|
18800
18806
|
}
|
|
18801
18807
|
};
|
|
18802
18808
|
var _setStartValue = function () {
|
|
18803
|
-
var _startValueUserValue = _this.
|
|
18809
|
+
var _startValueUserValue = _this.getValueFromMapByValue(_this.startValue);
|
|
18804
18810
|
if (_this.needParseValues && _startValueUserValue !== trackClickToUserRange) {
|
|
18805
18811
|
var _startValue = _this.needParseValues
|
|
18806
|
-
? _this.mapRangeValuesForSlider.get(trackClickToUserRange)
|
|
18812
|
+
? _this.mapRangeValuesForSlider.get(trackClickToUserRange)
|
|
18807
18813
|
: trackClickPercentage;
|
|
18808
18814
|
_this.startValue = _startValue;
|
|
18809
18815
|
}
|
|
@@ -18813,8 +18819,8 @@
|
|
|
18813
18819
|
};
|
|
18814
18820
|
if (this.multiple) {
|
|
18815
18821
|
var _a = __read(this.value, 2), start = _a[0], end = _a[1];
|
|
18816
|
-
var validStart_1 = this.needParseValues ? this.mapRangeValuesForSlider.get(start)
|
|
18817
|
-
var validEnd_1 = this.needParseValues ? this.mapRangeValuesForSlider.get(end)
|
|
18822
|
+
var validStart_1 = this.needParseValues ? this.mapRangeValuesForSlider.get(start) : start;
|
|
18823
|
+
var validEnd_1 = this.needParseValues ? this.mapRangeValuesForSlider.get(end) : end;
|
|
18818
18824
|
var _updateStart = function () {
|
|
18819
18825
|
_setStartValue();
|
|
18820
18826
|
_this.setValue([trackClickPercentage, validEnd_1]);
|
|
@@ -18877,11 +18883,15 @@
|
|
|
18877
18883
|
document.addEventListener("mouseup", this.onMouseUp);
|
|
18878
18884
|
};
|
|
18879
18885
|
SliderComponent.prototype.setRangeValues = function () {
|
|
18886
|
+
var _this = this;
|
|
18887
|
+
var _setStartAndEndValue = function (startValue, endValue) {
|
|
18888
|
+
_this.startValue = _this.getClosestValueFromMapSlider(startValue);
|
|
18889
|
+
_this.endValue = _this.getClosestValueFromMapSlider(endValue);
|
|
18890
|
+
};
|
|
18880
18891
|
if (Array.isArray(this.value) && !this.multiple) {
|
|
18881
18892
|
throw new Error('You must use "multiple" with value as array');
|
|
18882
18893
|
}
|
|
18883
|
-
|
|
18884
|
-
if (this.multiple && Array.isArray(this.value) && !hasRangeValues) {
|
|
18894
|
+
if (this.multiple && Array.isArray(this.value)) {
|
|
18885
18895
|
this.startValue = this.value[0];
|
|
18886
18896
|
this.endValue = this.value[1];
|
|
18887
18897
|
}
|
|
@@ -18893,13 +18903,40 @@
|
|
|
18893
18903
|
this.endValue = this.value;
|
|
18894
18904
|
}
|
|
18895
18905
|
if (this.needParseValues) {
|
|
18896
|
-
|
|
18897
|
-
|
|
18898
|
-
|
|
18899
|
-
|
|
18906
|
+
_setStartAndEndValue(this.startValue, this.endValue);
|
|
18907
|
+
if (this.multiple) {
|
|
18908
|
+
var _a = __read(this.value, 2), _startValue = _a[0], _endValue = _a[1];
|
|
18909
|
+
var difference = getDifference(_endValue, _startValue);
|
|
18910
|
+
var endValueIsGreatherThanMax = _endValue > this.max;
|
|
18911
|
+
var startValueIsLessThanMin = _startValue < this.min;
|
|
18912
|
+
var needUpdateValues = endValueIsGreatherThanMax || startValueIsLessThanMin;
|
|
18913
|
+
if (endValueIsGreatherThanMax) {
|
|
18914
|
+
_endValue = this.max;
|
|
18915
|
+
_startValue = _endValue - difference;
|
|
18916
|
+
}
|
|
18917
|
+
else if (startValueIsLessThanMin) {
|
|
18918
|
+
_startValue = this.min;
|
|
18919
|
+
_endValue = _startValue + difference;
|
|
18920
|
+
}
|
|
18921
|
+
if (needUpdateValues) {
|
|
18922
|
+
_setStartAndEndValue(_startValue, _endValue);
|
|
18923
|
+
this.setValue([this.startValue, this.endValue]);
|
|
18924
|
+
}
|
|
18900
18925
|
}
|
|
18901
18926
|
else {
|
|
18902
|
-
|
|
18927
|
+
var _value = this.value;
|
|
18928
|
+
var valueGreatherThanMax = _value > this.max;
|
|
18929
|
+
var valueLessThanMin = _value < this.min;
|
|
18930
|
+
var needUpdateValue = valueGreatherThanMax || valueLessThanMin;
|
|
18931
|
+
if (valueGreatherThanMax) {
|
|
18932
|
+
_value = this.max;
|
|
18933
|
+
}
|
|
18934
|
+
else if (valueLessThanMin) {
|
|
18935
|
+
_value = this.min;
|
|
18936
|
+
}
|
|
18937
|
+
if (needUpdateValue) {
|
|
18938
|
+
this.setValue(_value);
|
|
18939
|
+
}
|
|
18903
18940
|
}
|
|
18904
18941
|
}
|
|
18905
18942
|
this.setProgress();
|
|
@@ -18921,22 +18958,22 @@
|
|
|
18921
18958
|
*/
|
|
18922
18959
|
SliderComponent.prototype.getPercentageByEvent = function (mouseEvent) {
|
|
18923
18960
|
var trackRect = this.track.nativeElement.getBoundingClientRect();
|
|
18924
|
-
var newLeft = ((mouseEvent.clientX - trackRect.left) / trackRect.width) *
|
|
18925
|
-
newLeft = Math.
|
|
18926
|
-
newLeft = Math.max(0, Math.min(newLeft, 100));
|
|
18961
|
+
var newLeft = Math.round(((mouseEvent.clientX - trackRect.left) / trackRect.width) * this.MAX_RANGE_VALUE);
|
|
18962
|
+
newLeft = Math.max(0, Math.min(newLeft, this.MAX_RANGE_VALUE));
|
|
18927
18963
|
return newLeft;
|
|
18928
18964
|
};
|
|
18929
|
-
SliderComponent.prototype.setValue = function (value) {
|
|
18965
|
+
SliderComponent.prototype.setValue = function (value, parse) {
|
|
18930
18966
|
var _this = this;
|
|
18967
|
+
if (parse === void 0) { parse = true; }
|
|
18931
18968
|
if (this.disabled) {
|
|
18932
18969
|
return;
|
|
18933
18970
|
}
|
|
18934
|
-
if (this.needParseValues) {
|
|
18971
|
+
if (this.needParseValues && parse) {
|
|
18935
18972
|
if (Array.isArray(value)) {
|
|
18936
|
-
value = value.map(function (x) { return _this.
|
|
18973
|
+
value = value.map(function (x) { return _this.getValueFromMapByValue(x); });
|
|
18937
18974
|
}
|
|
18938
18975
|
else {
|
|
18939
|
-
value = this.
|
|
18976
|
+
value = this.getValueFromMapByValue(value);
|
|
18940
18977
|
}
|
|
18941
18978
|
}
|
|
18942
18979
|
this.value = value;
|
|
@@ -18949,54 +18986,84 @@
|
|
|
18949
18986
|
var _this = this;
|
|
18950
18987
|
var start = this.min;
|
|
18951
18988
|
var end = this.max;
|
|
18952
|
-
|
|
18953
|
-
|
|
18954
|
-
this.mapRangeValuesForSlider.clear();
|
|
18955
|
-
var mappedValues = [];
|
|
18956
|
-
for (var i = start; i <= end; i++) {
|
|
18957
|
-
var valuesWithMap = [];
|
|
18958
|
-
for (var j = forStart; j <= forEnd; j++) {
|
|
18959
|
-
var sliderToUserRangeValue = this.mapSliderToUserRange(j);
|
|
18960
|
-
if (sliderToUserRangeValue !== i) {
|
|
18961
|
-
forStart = j;
|
|
18962
|
-
break;
|
|
18963
|
-
}
|
|
18964
|
-
else {
|
|
18965
|
-
valuesWithMap.push(j);
|
|
18966
|
-
}
|
|
18967
|
-
}
|
|
18968
|
-
var left = valuesWithMap[0];
|
|
18969
|
-
var right = valuesWithMap[valuesWithMap.length - 1];
|
|
18970
|
-
mappedValues.push({ value: i, left: left, right: right });
|
|
18989
|
+
if (start > end) {
|
|
18990
|
+
throw new Error('Max value must be greater than min value');
|
|
18971
18991
|
}
|
|
18972
|
-
|
|
18973
|
-
|
|
18974
|
-
|
|
18992
|
+
this.mapRangeValuesForSlider.clear();
|
|
18993
|
+
var range = end - start;
|
|
18994
|
+
var decimalPlaces = 2;
|
|
18995
|
+
var stepCount = Math.floor(range / this.step);
|
|
18996
|
+
var values = [];
|
|
18997
|
+
for (var value = start; value <= end; value += this.step) {
|
|
18998
|
+
values.push(value);
|
|
18999
|
+
}
|
|
19000
|
+
if (values[values.length - 1] !== end) {
|
|
19001
|
+
values.push(end);
|
|
19002
|
+
}
|
|
19003
|
+
var mappedValues = values.map(function (value) {
|
|
19004
|
+
var mapped = ((value - start) / range) * _this.MAX_RANGE_VALUE;
|
|
19005
|
+
return parseFloat(mapped.toFixed(decimalPlaces));
|
|
19006
|
+
});
|
|
19007
|
+
mappedValues[0] = 0;
|
|
19008
|
+
mappedValues[mappedValues.length - 1] = this.MAX_RANGE_VALUE;
|
|
19009
|
+
var error = this.MAX_RANGE_VALUE - mappedValues[mappedValues.length - 1];
|
|
19010
|
+
var errorPerStep = error / stepCount;
|
|
19011
|
+
for (var i = 1; i < mappedValues.length - 1; i++) {
|
|
19012
|
+
mappedValues[i] += errorPerStep;
|
|
19013
|
+
mappedValues[i] = parseFloat(mappedValues[i].toFixed(decimalPlaces));
|
|
19014
|
+
}
|
|
19015
|
+
values.forEach(function (value, index) {
|
|
19016
|
+
_this.mapRangeValuesForSlider.set(value, mappedValues[index]);
|
|
18975
19017
|
});
|
|
18976
19018
|
};
|
|
18977
19019
|
/**
|
|
18978
|
-
*
|
|
19020
|
+
* Returns the user value from the given slider value by using the map of range values.
|
|
18979
19021
|
* @example
|
|
18980
|
-
* If
|
|
19022
|
+
* If the map is 0: { 0 }, 1: { 10 }, 2: { 30 }, 3: { 40 }, 4: { 50 }
|
|
19023
|
+
* and the sliderValue is 37, the function returns 3
|
|
19024
|
+
* or the slider value is 40, the function returns 4
|
|
19025
|
+
* @param sliderValue the value of the slider (values only between range MIN and MAX)
|
|
19026
|
+
* @returns the user value from the given slider value
|
|
18981
19027
|
*/
|
|
18982
|
-
SliderComponent.prototype.
|
|
18983
|
-
|
|
19028
|
+
SliderComponent.prototype.getValueFromMapByValue = function (sliderValue) {
|
|
19029
|
+
var mapToArray = Array.from(this.mapRangeValuesForSlider).map(function (_a) {
|
|
19030
|
+
var _b = __read(_a, 2), value = _b[0], mapped = _b[1];
|
|
19031
|
+
return ({ value: value, mapped: mapped });
|
|
19032
|
+
});
|
|
19033
|
+
var exactValue = mapToArray.find(function (x) { return x.mapped == sliderValue; });
|
|
19034
|
+
var closest = mapToArray.reduce(function (prev, curr) { return Math.abs(curr.mapped - sliderValue) < Math.abs(prev.mapped - sliderValue) ? curr : prev; });
|
|
19035
|
+
return exactValue ? exactValue.value : closest.value;
|
|
18984
19036
|
};
|
|
18985
19037
|
/**
|
|
18986
|
-
*
|
|
18987
|
-
* @
|
|
18988
|
-
*
|
|
18989
|
-
* and the sliderValue is 37, the function returns 1
|
|
18990
|
-
* @param sliderValue the value of the slider
|
|
18991
|
-
* @returns the user value from the given slider value
|
|
19038
|
+
* Retrieves the key from the map that is closest to the given slider value.
|
|
19039
|
+
* @param userValue - The value to find the closest key for. (values only between 0 - 100)
|
|
19040
|
+
* @returns The key that corresponds to the closest mapped value.
|
|
18992
19041
|
*/
|
|
18993
|
-
SliderComponent.prototype.
|
|
18994
|
-
var _a
|
|
18995
|
-
|
|
18996
|
-
return
|
|
19042
|
+
SliderComponent.prototype.getClosestValueFromMapSlider = function (userValue) {
|
|
19043
|
+
var mapToArray = Array.from(this.mapRangeValuesForSlider).map(function (_a) {
|
|
19044
|
+
var _b = __read(_a, 2), value = _b[0], mapped = _b[1];
|
|
19045
|
+
return ({ value: value, mapped: mapped });
|
|
18997
19046
|
});
|
|
18998
|
-
|
|
18999
|
-
|
|
19047
|
+
if (userValue >= this.max) {
|
|
19048
|
+
return mapToArray[mapToArray.length - 1].mapped;
|
|
19049
|
+
}
|
|
19050
|
+
else if (userValue <= this.min) {
|
|
19051
|
+
return mapToArray[0].mapped;
|
|
19052
|
+
}
|
|
19053
|
+
var exactValue = mapToArray.find(function (x) { return x.value == userValue; });
|
|
19054
|
+
var closestValue = mapToArray.reduce(function (prev, curr) { return Math.abs(curr.value - userValue) < Math.abs(prev.value - userValue) ? curr : prev; });
|
|
19055
|
+
var item = exactValue || closestValue;
|
|
19056
|
+
var isFirstItem = mapToArray[0] === item;
|
|
19057
|
+
var isLastItem = mapToArray[mapToArray.length - 1] === item;
|
|
19058
|
+
if (isFirstItem && userValue > this.min) {
|
|
19059
|
+
return getMidpoint(item.mapped, mapToArray[1].mapped);
|
|
19060
|
+
}
|
|
19061
|
+
else if (isLastItem && userValue < this.max) {
|
|
19062
|
+
return getMidpoint(item.mapped, mapToArray[mapToArray.length - 2].mapped);
|
|
19063
|
+
}
|
|
19064
|
+
else {
|
|
19065
|
+
return item.mapped;
|
|
19066
|
+
}
|
|
19000
19067
|
};
|
|
19001
19068
|
SliderComponent.prototype.handleArrowKeyLeft = function () {
|
|
19002
19069
|
if (this.multiple) {
|
|
@@ -19018,6 +19085,7 @@
|
|
|
19018
19085
|
};
|
|
19019
19086
|
SliderComponent.prototype._incrementOrDecrementStartAndEndValue = function (increment) {
|
|
19020
19087
|
var _a = __read(this.value, 2), start = _a[0], end = _a[1];
|
|
19088
|
+
var difference = getDifference(end, start);
|
|
19021
19089
|
if (increment) {
|
|
19022
19090
|
start += this.step;
|
|
19023
19091
|
end += this.step;
|
|
@@ -19026,31 +19094,28 @@
|
|
|
19026
19094
|
start -= this.step;
|
|
19027
19095
|
end -= this.step;
|
|
19028
19096
|
}
|
|
19029
|
-
|
|
19030
|
-
|
|
19031
|
-
|
|
19097
|
+
var startLessThanMin = start < this.min;
|
|
19098
|
+
var endGreaterThanMax = end > this.max;
|
|
19099
|
+
if (startLessThanMin || endGreaterThanMax) {
|
|
19100
|
+
if (startLessThanMin) {
|
|
19101
|
+
start = this.min;
|
|
19102
|
+
end = start + difference;
|
|
19032
19103
|
}
|
|
19033
|
-
|
|
19034
|
-
|
|
19035
|
-
start =
|
|
19036
|
-
end = start;
|
|
19037
|
-
}
|
|
19038
|
-
else {
|
|
19039
|
-
start = this.mapRangeValuesForSlider.get(start).left;
|
|
19040
|
-
if (isEqual) {
|
|
19041
|
-
end = start;
|
|
19042
|
-
}
|
|
19043
|
-
else {
|
|
19044
|
-
end = this.mapRangeValuesForSlider.get(end).right;
|
|
19045
|
-
}
|
|
19104
|
+
else if (endGreaterThanMax) {
|
|
19105
|
+
end = this.max;
|
|
19106
|
+
start = end - difference;
|
|
19046
19107
|
}
|
|
19047
19108
|
}
|
|
19048
|
-
if (start <
|
|
19109
|
+
if (start < this.min || end > this.max) {
|
|
19049
19110
|
return;
|
|
19050
19111
|
}
|
|
19112
|
+
this.setValue([start, end], false);
|
|
19113
|
+
if (this.needParseValues) {
|
|
19114
|
+
start = this.getClosestValueFromMapSlider(start);
|
|
19115
|
+
end = this.getClosestValueFromMapSlider(end);
|
|
19116
|
+
}
|
|
19051
19117
|
this.startValue = start;
|
|
19052
19118
|
this.endValue = end;
|
|
19053
|
-
this.setValue([start, end]);
|
|
19054
19119
|
};
|
|
19055
19120
|
SliderComponent.prototype._incrementOrDecrementEndValue = function (increment) {
|
|
19056
19121
|
var value = this.value;
|
|
@@ -19062,28 +19127,18 @@
|
|
|
19062
19127
|
}
|
|
19063
19128
|
var _newEndValue = value;
|
|
19064
19129
|
if (this.needParseValues) {
|
|
19065
|
-
|
|
19066
|
-
if (!valueParsedInSlider) {
|
|
19067
|
-
return;
|
|
19068
|
-
}
|
|
19069
|
-
var pickLeft = valueParsedInSlider.right <= 50;
|
|
19070
|
-
if (pickLeft) {
|
|
19071
|
-
_newEndValue = this.mapRangeValuesForSlider.get(value).left;
|
|
19072
|
-
}
|
|
19073
|
-
else {
|
|
19074
|
-
_newEndValue = this.mapRangeValuesForSlider.get(value).right;
|
|
19075
|
-
}
|
|
19130
|
+
_newEndValue = this.getClosestValueFromMapSlider(_newEndValue);
|
|
19076
19131
|
}
|
|
19077
|
-
if (_newEndValue <
|
|
19132
|
+
if (_newEndValue < this.MIN_RANGE_VALUE || _newEndValue > this.MAX_RANGE_VALUE) {
|
|
19078
19133
|
return;
|
|
19079
19134
|
}
|
|
19080
19135
|
this.endValue = _newEndValue;
|
|
19081
19136
|
this.startValue = this.endValue;
|
|
19082
|
-
this.setValue(
|
|
19137
|
+
this.setValue(_newEndValue);
|
|
19083
19138
|
};
|
|
19084
19139
|
Object.defineProperty(SliderComponent.prototype, "needParseValues", {
|
|
19085
19140
|
get: function () {
|
|
19086
|
-
return this.max !==
|
|
19141
|
+
return this.max !== this.MAX_RANGE_VALUE || this.min !== this.MIN_RANGE_VALUE;
|
|
19087
19142
|
},
|
|
19088
19143
|
enumerable: true,
|
|
19089
19144
|
configurable: true
|
|
@@ -19165,72 +19220,15 @@
|
|
|
19165
19220
|
return value >= min && value <= max;
|
|
19166
19221
|
};
|
|
19167
19222
|
var ɵ1$1 = isInRange;
|
|
19168
|
-
|
|
19169
|
-
|
|
19170
|
-
|
|
19171
|
-
|
|
19172
|
-
|
|
19173
|
-
|
|
19174
|
-
|
|
19175
|
-
* The function works by finding the gap between the last item and the penultimate item and
|
|
19176
|
-
* then distributing this gap among the previous items. The distribution is done by finding
|
|
19177
|
-
* the items that need to be fixed and then fixing them by shifting their left and right
|
|
19178
|
-
* positions.
|
|
19179
|
-
*
|
|
19180
|
-
* The function returns nothing, but it modifies the mappedValues array in place.
|
|
19181
|
-
*/
|
|
19182
|
-
var adjustLastItem = function (mappedValues) {
|
|
19183
|
-
var lastItem = mappedValues[mappedValues.length - 1];
|
|
19184
|
-
var lastDifference = lastItem.right - lastItem.left;
|
|
19185
|
-
var withoutLastItem = mappedValues.slice(0, mappedValues.length - 1);
|
|
19186
|
-
var differences = withoutLastItem.map(function (_a) {
|
|
19187
|
-
var left = _a.left, right = _a.right;
|
|
19188
|
-
return right - left;
|
|
19189
|
-
});
|
|
19190
|
-
var averageDifference = Math.floor(differences.reduce(function (sum, diff) { return sum + diff; }, 0) / differences.length);
|
|
19191
|
-
var _getRandomIndexFromArray = function (array, storedChanges) {
|
|
19192
|
-
if (storedChanges.length === array.length) {
|
|
19193
|
-
storedChanges = [];
|
|
19194
|
-
}
|
|
19195
|
-
var randomIndex = Math.floor(Math.random() * array.length);
|
|
19196
|
-
var randomIndexAlreadyStored = storedChanges.includes(randomIndex);
|
|
19197
|
-
while (randomIndexAlreadyStored) {
|
|
19198
|
-
randomIndex = Math.floor(Math.random() * withoutLastItem.length);
|
|
19199
|
-
randomIndexAlreadyStored = storedChanges.includes(randomIndex);
|
|
19200
|
-
}
|
|
19201
|
-
storedChanges.push(randomIndex);
|
|
19202
|
-
return { randomIndex: randomIndex, storedChanges: storedChanges };
|
|
19203
|
-
};
|
|
19204
|
-
var needFixLastItem = lastDifference < averageDifference;
|
|
19205
|
-
var arr = [];
|
|
19206
|
-
if (needFixLastItem) {
|
|
19207
|
-
var captureItensCount = averageDifference - lastDifference;
|
|
19208
|
-
var randomIndexStored = [];
|
|
19209
|
-
for (var i = 0; i <= captureItensCount; i++) {
|
|
19210
|
-
var _a = _getRandomIndexFromArray(withoutLastItem, randomIndexStored), randomIndex = _a.randomIndex, storedChanges = _a.storedChanges;
|
|
19211
|
-
randomIndexStored = storedChanges;
|
|
19212
|
-
arr.push(randomIndex);
|
|
19213
|
-
var randomItem = withoutLastItem[randomIndex];
|
|
19214
|
-
--lastItem.left;
|
|
19215
|
-
--randomItem.right;
|
|
19216
|
-
}
|
|
19217
|
-
mappedValues.forEach(function (mappedValue, index) {
|
|
19218
|
-
var _next = mappedValues[index + 1];
|
|
19219
|
-
if (!_next) {
|
|
19220
|
-
return;
|
|
19221
|
-
}
|
|
19222
|
-
var nextLeft = _next.left;
|
|
19223
|
-
var currentRight = mappedValue.right;
|
|
19224
|
-
if (currentRight !== currentRight + 1) {
|
|
19225
|
-
var _nextDiff = _next.right - nextLeft;
|
|
19226
|
-
var _nextLeft = currentRight + 1;
|
|
19227
|
-
_next.left = _nextLeft;
|
|
19228
|
-
_next.right = _nextLeft + _nextDiff;
|
|
19229
|
-
}
|
|
19230
|
-
});
|
|
19231
|
-
}
|
|
19223
|
+
var getMidpoint = function (start, end) {
|
|
19224
|
+
var midpoint = (start + end) / 2;
|
|
19225
|
+
return parseFloat(midpoint.toFixed(2));
|
|
19226
|
+
};
|
|
19227
|
+
var ɵ2 = getMidpoint;
|
|
19228
|
+
var getDifference = function (end, start) {
|
|
19229
|
+
return Math.abs(end - start);
|
|
19232
19230
|
};
|
|
19233
|
-
var ɵ
|
|
19231
|
+
var ɵ3 = getDifference;
|
|
19234
19232
|
|
|
19235
19233
|
var SliderModule = /** @class */ (function () {
|
|
19236
19234
|
function SliderModule() {
|
|
@@ -20604,7 +20602,7 @@
|
|
|
20604
20602
|
var _list = list instanceof Set ? Array.from(list) : list;
|
|
20605
20603
|
return _list.filter(function (x) { return !x.disabled; });
|
|
20606
20604
|
};
|
|
20607
|
-
var ɵ3 = filterEnabled;
|
|
20605
|
+
var ɵ3$1 = filterEnabled;
|
|
20608
20606
|
var mapData = function (list) {
|
|
20609
20607
|
return list.map(function (x) { return x.data; });
|
|
20610
20608
|
};
|
|
@@ -21153,7 +21151,7 @@
|
|
|
21153
21151
|
exports.ɵ0 = ɵ0$3;
|
|
21154
21152
|
exports.ɵ1 = ɵ1$2;
|
|
21155
21153
|
exports.ɵ2 = ɵ2$1;
|
|
21156
|
-
exports.ɵ3 = ɵ3;
|
|
21154
|
+
exports.ɵ3 = ɵ3$1;
|
|
21157
21155
|
exports.ɵ4 = ɵ4;
|
|
21158
21156
|
exports.ɵa = TooltipComponent;
|
|
21159
21157
|
exports.ɵb = TooltipDirective;
|