rm-range-slider 0.0.1 → 3.0.1

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/README.md CHANGED
@@ -1,85 +1,57 @@
1
-
2
- # Range-slider
3
-
4
- A highly optimized and fully customizable pure angular component for value range selection.
5
-
6
- The component is not re-rendered while user moves the thumb.
7
- Even if there is a label, only the label component is re-rendered when values are changed.
8
-
9
- RangeSlider uses angular Native's Animated library to transform thumbs / label / selected rail.
10
- These optimizations help to achieve as much native look & feel as possible using only the JS layer.
11
-
12
-
13
- ## Installation
14
-
15
- Install my-project with npm
16
-
17
- ```bash
18
- npm: npm install --save rm-range-slider
19
- yarn: yarn add rn-range-slider
20
- ```
21
-
22
-
23
- ## Usage
24
-
25
- Dual Range Slider uses angular hooks, so this component doesn't work with angular below below version 2.
26
-
27
-
28
-
29
-
30
- ```
31
- ...
32
-
33
- import {RmRangeSliderModule} from "@rm-range-slider";
34
-
35
- ...
36
-
37
- <rm-range-slider
38
- [SliderMinRange]="0"
39
- [showToolTip]="true"
40
- [doubleSlider]="true"
41
- [SliderMaxRange]="100"
42
- [disabled]="false"
43
- [setMinValue]="10"
44
- [setMaxValue]="60"
45
- [toolTipColor]="'#8a00e5'"
46
- [rangeColor]="'#8a00e5'"
47
- [sliderColor]="'#C6C6C6'"
48
- [toolTipColorHover]="'#b200e5ff'"
49
- [toolTipColorHoverShadow]="'rgba(108, 0, 119, 0.3)'"
50
- [sliderColorRight]="'rgba(239,7,65,0.98)'"
51
- (onValueChanged)="onValueChanged($event)"
52
- ></rm-range-slider>
53
- ...
54
-
55
- add root lavel style file
56
- :root {
57
- --tooltip-arrow: red;
58
- --slider-thumb-color: blue;
59
- --slider-thumb-color-hover: blue;
60
- --slider-thumb-color-hover-shadow: rgba(108, 0, 119, 0.3);
61
- }
62
- ...
63
- ```
64
-
65
- ### Properties
66
-
67
- | Name | Description | Type | Default Value |
68
- |---------------------------|----------------------------------------------------------------------|---------|:--------------------------------------------------------------------:|
69
- | `SliderMinRange` | Minimum value of slider | number | Initially `min` value will be set `0` if not provided |
70
- | `SliderMaxRange` | Maximum value of slider | number | Initially `max` value will be set `100` if not provided |
71
- | `showToolTip` | Show or hide tool tip | boolean | Initially value will be set `false` if not provided |
72
- | `doubleSlider` | Use like SIngle Slider or double slider | boolean | Initially value will be set `true` if not provided |
73
- | `disabled` | Disable or enable the slider moment | boolean | Initially value will be set `false` if not provided |
74
- | `setMinValue` | Min value for slider's thumbnail to set on | number | Initially `min` value will be set `0` if not provided |
75
- | `setMaxValue` | Max value for slider's thumbnail to set on | boolean | Initially `max` value will be set `100` if not provided |
76
- | `toolTipColor` | set color for tool tip | string | Initially set default color for tool tip is `#8a00e5` |
77
- | `rangeColor` | Set color for slider line between both min and max slider's thumnail | string | Initially set default color for tool tip is `rgba(255,255,255,0.99)` |
78
- | `sliderColor` | Set color for slider line | string | Initially set default color for tool tip is `rgba(255,255,255,0.47)` |
79
- | `toolTipColorHover` | set color for tool tip on hover | string | Initially set default color for tool tip is `#8a00e5'` |
80
- | `toolTipColorHoverShadow` | set shadow color for tool tip on hover | string | Initially set default color for tool tip is `#8a00e5'` |
81
- | `sliderColorRight` | Set color for right side slider line | string | Initially set default color for tool tip is `rgb(198, 198, 198)` |
82
- | `onValueChanged` | Emit both value object of min and max | object | It do not return any value until changes |
83
-
84
- All the other props (e.g. style) will be passed to root container component.
85
-
1
+ # Range-slider
2
+
3
+ A highly optimized and fully customizable pure angular component for value range selection.
4
+
5
+ The component is not re-rendered while user moves the thumb.
6
+ Even if there is a label, only the label component is re-rendered when values are changed.
7
+
8
+ RangeSlider uses angular Native's Animated library to transform thumbs / label / selected rail.
9
+ These optimizations help to achieve as much native look & feel as possible using only the JS layer.
10
+
11
+ ## Installation
12
+
13
+ Install my-project with npm
14
+
15
+ ```bash
16
+ npm: npm install --save rm-range-slider
17
+ yarn: yarn add rn-range-slider
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ Dual Range Slider uses angular hooks, so this component doesn't work with angular below below version 2.
23
+
24
+ ```
25
+ ...
26
+
27
+ import {RmRangeSliderModule} from "@rm-range-slider";
28
+
29
+ ...
30
+ <rm-range-slider
31
+ min="0"
32
+ max="100"
33
+ startValue="0"
34
+ endValue="10"
35
+ (onValueChanged)="onValueChanged($event)"
36
+ ></rm-range-slider>
37
+
38
+ ```
39
+
40
+ ### Version Mapping
41
+
42
+ | Slider | Ng |
43
+ | ------ | ---- |
44
+ | 0.0.1 | 14.x |
45
+ | 1.0.0 | 15.x |
46
+ | 2.0.0 | 16.x |
47
+ | 3.0.0 | 17.x |
48
+
49
+ ### Properties
50
+
51
+ | Name | Description | Type | Default Value |
52
+ | ---------------- | ------------------------------------- | ------ | :-----------------------------------------------------: |
53
+ | `min` | Minimum value of slider | number | Initially `min` value will be set `0` if not provided |
54
+ | `max` | Maximum value of slider | number | Initially `max` value will be set `100` if not provided |
55
+ | `startValue` | Maximum value of slider | number | Initially `min` value will be set `0` if not provided |
56
+ | `endValue` | Maximum value of slider | number | Initially `max` value will be set `100` if not provided |
57
+ | `onValueChanged` | Emit both value object of min and max | MINMAX | It do not return any value until changes |
@@ -0,0 +1,140 @@
1
+ import { Component, EventEmitter, Input, Output, numberAttribute, } from '@angular/core';
2
+ import { FormsModule } from '@angular/forms';
3
+ import { MatSliderModule } from '@angular/material/slider';
4
+ import { Subject, takeUntil, throttleTime } from 'rxjs';
5
+ import * as i0 from "@angular/core";
6
+ import * as i1 from "@angular/material/slider";
7
+ import * as i2 from "@angular/forms";
8
+ export class RmRangeSliderComponent {
9
+ constructor() {
10
+ this.destroy$ = new Subject();
11
+ /* The `@Input` decorator in the TypeScript code snippet is used to define an input property for the
12
+ `RmRangeSliderComponent` component in Angular. In this specific case: */
13
+ this.startValue = 0;
14
+ /* The `@Input` decorator in the TypeScript code snippet is used to define an input property for the
15
+ `RmRangeSliderComponent` component in Angular. In this specific case, the `endValue` property is
16
+ being defined as an input property with the following configuration: */
17
+ this.endValue = 10;
18
+ /* The `@Input` decorator in the TypeScript code snippet is used to define an input property for the
19
+ `RmRangeSliderComponent` component in Angular. In this specific case, the `min` property is being
20
+ defined as an input property with the following configuration: */
21
+ this.min = 0;
22
+ /* The `@Input` decorator in the TypeScript code snippet is used to define an input property for the
23
+ `RmRangeSliderComponent` component in Angular. In this specific case, the `max` property is being
24
+ defined as an input property with the following configuration: */
25
+ this.max = 100;
26
+ /* The `@Output()` decorator in the TypeScript code snippet is used to define an output property for
27
+ the `RmRangeSliderComponent` component in Angular. In this specific case, the `getMinMax` property
28
+ is being defined as an output property with the type of `EventEmitter<MINMAX>`. */
29
+ this.onValueChanged = new EventEmitter();
30
+ }
31
+ /**
32
+ * The `onSliderInput` function sets the `value` object with `startValue` and `endValue` properties and
33
+ * calls the `onSliderChange` function with this value.
34
+ */
35
+ onSliderInput() {
36
+ const value = {
37
+ from: this.startValue,
38
+ to: this.endValue,
39
+ };
40
+ this.onSliderChange(value);
41
+ }
42
+ /**
43
+ * The `formatLabel` function in TypeScript formats a number value by rounding it to the nearest
44
+ * hundredth and appending a 'k' if the value is greater than or equal to 1000.
45
+ * @param {number} value - The `value` parameter is a number that represents a numerical value which
46
+ * needs to be formatted. The `formatLabel` function takes this number as input and returns a formatted
47
+ * string representation of the number. If the value is greater than or equal to 1000, it will be
48
+ * rounded and displayed in
49
+ * @returns If the `value` is greater than or equal to 1000, the function will return the value divided
50
+ * by 100 and rounded, followed by the letter 'k'. Otherwise, it will return the value as a string.
51
+ */
52
+ formatLabel(value) {
53
+ if (value >= 1000) {
54
+ return Math.round(value / 100) + 'k';
55
+ }
56
+ return `${value}`;
57
+ }
58
+ /**
59
+ * The `onSliderChange` function in TypeScript sets up a Subject to emit slider value changes with a
60
+ * throttle time of 5000 milliseconds.
61
+ * @param {MINMAX} value - The `value` parameter in the `onSliderChange` method represents the current
62
+ * value of the slider, which is of type `MINMAX`.
63
+ */
64
+ onSliderChange(value) {
65
+ this.destroy$.next();
66
+ this.destroy$.complete();
67
+ const sliderValueChanges$ = new Subject();
68
+ sliderValueChanges$
69
+ .pipe(throttleTime(5000), takeUntil(this.destroy$))
70
+ .subscribe((newValue) => {
71
+ this.onValueChanged.emit(newValue);
72
+ });
73
+ sliderValueChanges$.next(value);
74
+ }
75
+ /**
76
+ * The ngOnDestroy function in TypeScript is used to clean up resources and unsubscribe from
77
+ * observables by completing a subject.
78
+ */
79
+ ngOnDestroy() {
80
+ this.destroy$.next();
81
+ this.destroy$.complete();
82
+ }
83
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.2", ngImport: i0, type: RmRangeSliderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
84
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.2.2", type: RmRangeSliderComponent, isStandalone: true, selector: "rm-range-slider", inputs: { startValue: ["startValue", "startValue", numberAttribute], endValue: ["endValue", "endValue", numberAttribute], min: ["min", "min", numberAttribute], max: ["max", "max", numberAttribute] }, outputs: { onValueChanged: "onValueChanged" }, ngImport: i0, template: `
85
+ <mat-slider
86
+ [min]="this.min"
87
+ [max]="this.max"
88
+ showTickMarks
89
+ discrete
90
+ [displayWith]="formatLabel"
91
+ (change)="onSliderInput()"
92
+ >
93
+ <input matSliderStartThumb [(ngModel)]="startValue" />
94
+ <input matSliderEndThumb [(ngModel)]="endValue" />
95
+ </mat-slider>
96
+ `, isInline: true, styles: ["mat-slider{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: MatSliderModule }, { kind: "component", type: i1.MatSlider, selector: "mat-slider", inputs: ["disabled", "discrete", "showTickMarks", "min", "color", "disableRipple", "max", "step", "displayWith"], exportAs: ["matSlider"] }, { kind: "directive", type: i1.MatSliderRangeThumb, selector: "input[matSliderStartThumb], input[matSliderEndThumb]", exportAs: ["matSliderRangeThumb"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
97
+ }
98
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.2", ngImport: i0, type: RmRangeSliderComponent, decorators: [{
99
+ type: Component,
100
+ args: [{ selector: 'rm-range-slider', standalone: true, imports: [MatSliderModule, FormsModule], template: `
101
+ <mat-slider
102
+ [min]="this.min"
103
+ [max]="this.max"
104
+ showTickMarks
105
+ discrete
106
+ [displayWith]="formatLabel"
107
+ (change)="onSliderInput()"
108
+ >
109
+ <input matSliderStartThumb [(ngModel)]="startValue" />
110
+ <input matSliderEndThumb [(ngModel)]="endValue" />
111
+ </mat-slider>
112
+ `, styles: ["mat-slider{width:100%}\n"] }]
113
+ }], propDecorators: { startValue: [{
114
+ type: Input,
115
+ args: [{
116
+ required: true,
117
+ transform: numberAttribute,
118
+ }]
119
+ }], endValue: [{
120
+ type: Input,
121
+ args: [{
122
+ required: true,
123
+ transform: numberAttribute,
124
+ }]
125
+ }], min: [{
126
+ type: Input,
127
+ args: [{
128
+ required: true,
129
+ transform: numberAttribute,
130
+ }]
131
+ }], max: [{
132
+ type: Input,
133
+ args: [{
134
+ required: true,
135
+ transform: numberAttribute,
136
+ }]
137
+ }], onValueChanged: [{
138
+ type: Output
139
+ }] } });
140
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm0tcmFuZ2Utc2xpZGVyLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL3JtLXJhbmdlLXNsaWRlci9zcmM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Ck6IHZvaWQge1xuICAgIHRoaXMuZGVzdHJveSQubmV4dCgpO1xuICAgIHRoaXMuZGVzdHJveSQuY29tcGxldGUoKTtcbiAgICBjb25zdCBzbGlkZXJWYWx1ZUNoYW5nZXMkID0gbmV3IFN1YmplY3Q8TUlOTUFYPigpO1xuICAgIHNsaWRlclZhbHVlQ2hhbmdlcyRcbiAgICAgIC5waXBlKHRocm90dGxlVGltZSg1MDAwKSwgdGFrZVVudGlsKHRoaXMuZGVzdHJveSQpKVxuICAgICAgLnN1YnNjcmliZSgobmV3VmFsdWU6IE1JTk1BWCkgPT4ge1xuICAgICAgICB0aGlzLm9uVmFsdWVDaGFuZ2VkLmVtaXQobmV3VmFsdWUpO1xuICAgICAgfSk7XG4gICAgc2xpZGVyVmFsdWVDaGFuZ2VzJC5uZXh0KHZhbHVlKTtcbiAgfVxuXG4gIC8qKlxuICAgKiBUaGUgbmdPbkRlc3Ryb3kgZnVuY3Rpb24gaW4gVHlwZVNjcmlwdCBpcyB1c2VkIHRvIGNsZWFuIHVwIHJlc291cmNlcyBhbmQgdW5zdWJzY3JpYmUgZnJvbVxuICAgKiBvYnNlcnZhYmxlcyBieSBjb21wbGV0aW5nIGEgc3ViamVjdC5cbiAgICovXG4gIG5nT25EZXN0cm95KCk6IHZvaWQge1xuICAgIHRoaXMuZGVzdHJveSQubmV4dCgpO1xuICAgIHRoaXMuZGVzdHJveSQuY29tcGxldGUoKTtcbiAgfVxufVxuIl19
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Public API Surface of rm-range-slider
3
+ */
4
+ export * from './lib/rm-range-slider.component';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL3JtLXJhbmdlLXNsaWRlci9zcmMvcHVibGljLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsaUNBQWlDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKlxuICogUHVibGljIEFQSSBTdXJmYWNlIG9mIHJtLXJhbmdlLXNsaWRlclxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vbGliL3JtLXJhbmdlLXNsaWRlci5jb21wb25lbnQnO1xuIl19
@@ -1,5 +1,5 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './public-api';
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public-api';
5
5
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm0tcmFuZ2Utc2xpZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vcHJvamVjdHMvcm0tcmFuZ2Utc2xpZGVyL3NyYy9ybS1yYW5nZS1zbGlkZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
@@ -0,0 +1,151 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, numberAttribute, Component, Input, Output } from '@angular/core';
3
+ import * as i2 from '@angular/forms';
4
+ import { FormsModule } from '@angular/forms';
5
+ import * as i1 from '@angular/material/slider';
6
+ import { MatSliderModule } from '@angular/material/slider';
7
+ import { Subject, throttleTime, takeUntil } from 'rxjs';
8
+
9
+ class RmRangeSliderComponent {
10
+ constructor() {
11
+ this.destroy$ = new Subject();
12
+ /* The `@Input` decorator in the TypeScript code snippet is used to define an input property for the
13
+ `RmRangeSliderComponent` component in Angular. In this specific case: */
14
+ this.startValue = 0;
15
+ /* The `@Input` decorator in the TypeScript code snippet is used to define an input property for the
16
+ `RmRangeSliderComponent` component in Angular. In this specific case, the `endValue` property is
17
+ being defined as an input property with the following configuration: */
18
+ this.endValue = 10;
19
+ /* The `@Input` decorator in the TypeScript code snippet is used to define an input property for the
20
+ `RmRangeSliderComponent` component in Angular. In this specific case, the `min` property is being
21
+ defined as an input property with the following configuration: */
22
+ this.min = 0;
23
+ /* The `@Input` decorator in the TypeScript code snippet is used to define an input property for the
24
+ `RmRangeSliderComponent` component in Angular. In this specific case, the `max` property is being
25
+ defined as an input property with the following configuration: */
26
+ this.max = 100;
27
+ /* The `@Output()` decorator in the TypeScript code snippet is used to define an output property for
28
+ the `RmRangeSliderComponent` component in Angular. In this specific case, the `getMinMax` property
29
+ is being defined as an output property with the type of `EventEmitter<MINMAX>`. */
30
+ this.onValueChanged = new EventEmitter();
31
+ }
32
+ /**
33
+ * The `onSliderInput` function sets the `value` object with `startValue` and `endValue` properties and
34
+ * calls the `onSliderChange` function with this value.
35
+ */
36
+ onSliderInput() {
37
+ const value = {
38
+ from: this.startValue,
39
+ to: this.endValue,
40
+ };
41
+ this.onSliderChange(value);
42
+ }
43
+ /**
44
+ * The `formatLabel` function in TypeScript formats a number value by rounding it to the nearest
45
+ * hundredth and appending a 'k' if the value is greater than or equal to 1000.
46
+ * @param {number} value - The `value` parameter is a number that represents a numerical value which
47
+ * needs to be formatted. The `formatLabel` function takes this number as input and returns a formatted
48
+ * string representation of the number. If the value is greater than or equal to 1000, it will be
49
+ * rounded and displayed in
50
+ * @returns If the `value` is greater than or equal to 1000, the function will return the value divided
51
+ * by 100 and rounded, followed by the letter 'k'. Otherwise, it will return the value as a string.
52
+ */
53
+ formatLabel(value) {
54
+ if (value >= 1000) {
55
+ return Math.round(value / 100) + 'k';
56
+ }
57
+ return `${value}`;
58
+ }
59
+ /**
60
+ * The `onSliderChange` function in TypeScript sets up a Subject to emit slider value changes with a
61
+ * throttle time of 5000 milliseconds.
62
+ * @param {MINMAX} value - The `value` parameter in the `onSliderChange` method represents the current
63
+ * value of the slider, which is of type `MINMAX`.
64
+ */
65
+ onSliderChange(value) {
66
+ this.destroy$.next();
67
+ this.destroy$.complete();
68
+ const sliderValueChanges$ = new Subject();
69
+ sliderValueChanges$
70
+ .pipe(throttleTime(5000), takeUntil(this.destroy$))
71
+ .subscribe((newValue) => {
72
+ this.onValueChanged.emit(newValue);
73
+ });
74
+ sliderValueChanges$.next(value);
75
+ }
76
+ /**
77
+ * The ngOnDestroy function in TypeScript is used to clean up resources and unsubscribe from
78
+ * observables by completing a subject.
79
+ */
80
+ ngOnDestroy() {
81
+ this.destroy$.next();
82
+ this.destroy$.complete();
83
+ }
84
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.2", ngImport: i0, type: RmRangeSliderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
85
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.2.2", type: RmRangeSliderComponent, isStandalone: true, selector: "rm-range-slider", inputs: { startValue: ["startValue", "startValue", numberAttribute], endValue: ["endValue", "endValue", numberAttribute], min: ["min", "min", numberAttribute], max: ["max", "max", numberAttribute] }, outputs: { onValueChanged: "onValueChanged" }, ngImport: i0, template: `
86
+ <mat-slider
87
+ [min]="this.min"
88
+ [max]="this.max"
89
+ showTickMarks
90
+ discrete
91
+ [displayWith]="formatLabel"
92
+ (change)="onSliderInput()"
93
+ >
94
+ <input matSliderStartThumb [(ngModel)]="startValue" />
95
+ <input matSliderEndThumb [(ngModel)]="endValue" />
96
+ </mat-slider>
97
+ `, isInline: true, styles: ["mat-slider{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: MatSliderModule }, { kind: "component", type: i1.MatSlider, selector: "mat-slider", inputs: ["disabled", "discrete", "showTickMarks", "min", "color", "disableRipple", "max", "step", "displayWith"], exportAs: ["matSlider"] }, { kind: "directive", type: i1.MatSliderRangeThumb, selector: "input[matSliderStartThumb], input[matSliderEndThumb]", exportAs: ["matSliderRangeThumb"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
98
+ }
99
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.2", ngImport: i0, type: RmRangeSliderComponent, decorators: [{
100
+ type: Component,
101
+ args: [{ selector: 'rm-range-slider', standalone: true, imports: [MatSliderModule, FormsModule], template: `
102
+ <mat-slider
103
+ [min]="this.min"
104
+ [max]="this.max"
105
+ showTickMarks
106
+ discrete
107
+ [displayWith]="formatLabel"
108
+ (change)="onSliderInput()"
109
+ >
110
+ <input matSliderStartThumb [(ngModel)]="startValue" />
111
+ <input matSliderEndThumb [(ngModel)]="endValue" />
112
+ </mat-slider>
113
+ `, styles: ["mat-slider{width:100%}\n"] }]
114
+ }], propDecorators: { startValue: [{
115
+ type: Input,
116
+ args: [{
117
+ required: true,
118
+ transform: numberAttribute,
119
+ }]
120
+ }], endValue: [{
121
+ type: Input,
122
+ args: [{
123
+ required: true,
124
+ transform: numberAttribute,
125
+ }]
126
+ }], min: [{
127
+ type: Input,
128
+ args: [{
129
+ required: true,
130
+ transform: numberAttribute,
131
+ }]
132
+ }], max: [{
133
+ type: Input,
134
+ args: [{
135
+ required: true,
136
+ transform: numberAttribute,
137
+ }]
138
+ }], onValueChanged: [{
139
+ type: Output
140
+ }] } });
141
+
142
+ /*
143
+ * Public API Surface of rm-range-slider
144
+ */
145
+
146
+ /**
147
+ * Generated bundle index. Do not edit.
148
+ */
149
+
150
+ export { RmRangeSliderComponent };
151
+ //# sourceMappingURL=rm-range-slider.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rm-range-slider.mjs","sources":["../../../projects/rm-range-slider/src/lib/rm-range-slider.component.ts","../../../projects/rm-range-slider/src/public-api.ts","../../../projects/rm-range-slider/src/rm-range-slider.ts"],"sourcesContent":["import {\n Component,\n EventEmitter,\n Input,\n OnDestroy,\n Output,\n numberAttribute,\n} from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MatSliderModule } from '@angular/material/slider';\nimport { Subject, takeUntil, throttleTime } from 'rxjs';\nexport interface MINMAX {\n from: number;\n to: number;\n}\n\n@Component({\n selector: 'rm-range-slider',\n standalone: true,\n imports: [MatSliderModule, FormsModule],\n template: `\n <mat-slider\n [min]=\"this.min\"\n [max]=\"this.max\"\n showTickMarks\n discrete\n [displayWith]=\"formatLabel\"\n (change)=\"onSliderInput()\"\n >\n <input matSliderStartThumb [(ngModel)]=\"startValue\" />\n <input matSliderEndThumb [(ngModel)]=\"endValue\" />\n </mat-slider>\n `,\n styles: `\n mat-slider {\n width: 100%;\n }\n `,\n})\nexport class RmRangeSliderComponent implements OnDestroy {\n private destroy$ = new Subject<void>();\n\n /* The `@Input` decorator in the TypeScript code snippet is used to define an input property for the\n`RmRangeSliderComponent` component in Angular. In this specific case: */\n @Input({\n required: true,\n transform: numberAttribute,\n })\n startValue: number = 0;\n\n /* The `@Input` decorator in the TypeScript code snippet is used to define an input property for the\n`RmRangeSliderComponent` component in Angular. In this specific case, the `endValue` property is\nbeing defined as an input property with the following configuration: */\n @Input({\n required: true,\n transform: numberAttribute,\n })\n endValue: number = 10;\n\n /* The `@Input` decorator in the TypeScript code snippet is used to define an input property for the\n`RmRangeSliderComponent` component in Angular. In this specific case, the `min` property is being\ndefined as an input property with the following configuration: */\n @Input({\n required: true,\n transform: numberAttribute,\n })\n min: number = 0;\n\n /* The `@Input` decorator in the TypeScript code snippet is used to define an input property for the\n`RmRangeSliderComponent` component in Angular. In this specific case, the `max` property is being\ndefined as an input property with the following configuration: */\n @Input({\n required: true,\n transform: numberAttribute,\n })\n max: number = 100;\n\n /* The `@Output()` decorator in the TypeScript code snippet is used to define an output property for\nthe `RmRangeSliderComponent` component in Angular. In this specific case, the `getMinMax` property\nis being defined as an output property with the type of `EventEmitter<MINMAX>`. */\n @Output()\n public onValueChanged = new EventEmitter<MINMAX>();\n\n /**\n * The `onSliderInput` function sets the `value` object with `startValue` and `endValue` properties and\n * calls the `onSliderChange` function with this value.\n */\n onSliderInput(): void {\n const value: MINMAX = {\n from: this.startValue,\n to: this.endValue,\n };\n this.onSliderChange(value);\n }\n\n /**\n * The `formatLabel` function in TypeScript formats a number value by rounding it to the nearest\n * hundredth and appending a 'k' if the value is greater than or equal to 1000.\n * @param {number} value - The `value` parameter is a number that represents a numerical value which\n * needs to be formatted. The `formatLabel` function takes this number as input and returns a formatted\n * string representation of the number. If the value is greater than or equal to 1000, it will be\n * rounded and displayed in\n * @returns If the `value` is greater than or equal to 1000, the function will return the value divided\n * by 100 and rounded, followed by the letter 'k'. Otherwise, it will return the value as a string.\n */\n\n formatLabel(value: number): string {\n if (value >= 1000) {\n return Math.round(value / 100) + 'k';\n }\n return `${value}`;\n }\n\n /**\n * The `onSliderChange` function in TypeScript sets up a Subject to emit slider value changes with a\n * throttle time of 5000 milliseconds.\n * @param {MINMAX} value - The `value` parameter in the `onSliderChange` method represents the current\n * value of the slider, which is of type `MINMAX`.\n */\n onSliderChange(value: MINMAX): void {\n this.destroy$.next();\n this.destroy$.complete();\n const sliderValueChanges$ = new Subject<MINMAX>();\n sliderValueChanges$\n .pipe(throttleTime(5000), takeUntil(this.destroy$))\n .subscribe((newValue: MINMAX) => {\n this.onValueChanged.emit(newValue);\n });\n sliderValueChanges$.next(value);\n }\n\n /**\n * The ngOnDestroy function in TypeScript is used to clean up resources and unsubscribe from\n * observables by completing a subject.\n */\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n}\n","/*\n * Public API Surface of rm-range-slider\n */\n\nexport * from './lib/rm-range-slider.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;MAuCa,sBAAsB,CAAA;AAvBnC,IAAA,WAAA,GAAA;AAwBU,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,OAAO,EAAQ,CAAC;AAEvC;AACsE;QAKtE,IAAU,CAAA,UAAA,GAAW,CAAC,CAAC;AAEvB;;AAEqE;QAKrE,IAAQ,CAAA,QAAA,GAAW,EAAE,CAAC;AAEtB;;AAE+D;QAK/D,IAAG,CAAA,GAAA,GAAW,CAAC,CAAC;AAEhB;;AAE+D;QAK/D,IAAG,CAAA,GAAA,GAAW,GAAG,CAAC;AAElB;;AAEgF;AAEzE,QAAA,IAAA,CAAA,cAAc,GAAG,IAAI,YAAY,EAAU,CAAC;AA0DpD,KAAA;AAxDC;;;AAGG;IACH,aAAa,GAAA;AACX,QAAA,MAAM,KAAK,GAAW;YACpB,IAAI,EAAE,IAAI,CAAC,UAAU;YACrB,EAAE,EAAE,IAAI,CAAC,QAAQ;SAClB,CAAC;AACF,QAAA,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;KAC5B;AAED;;;;;;;;;AASG;AAEH,IAAA,WAAW,CAAC,KAAa,EAAA;AACvB,QAAA,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;SACtC;QACD,OAAO,CAAA,EAAG,KAAK,CAAA,CAAE,CAAC;KACnB;AAED;;;;;AAKG;AACH,IAAA,cAAc,CAAC,KAAa,EAAA;AAC1B,QAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AACrB,QAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;AACzB,QAAA,MAAM,mBAAmB,GAAG,IAAI,OAAO,EA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M,cAAc,EAAA,CAAA;sBADpB,MAAM;;;AChFT;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="rm-range-slider" />
5
- export * from './public-api';
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="rm-range-slider" />
5
+ export * from './public-api';
@@ -1,82 +1,48 @@
1
- import { AfterViewInit, ElementRef, EventEmitter, OnInit, Renderer2, SimpleChanges } from '@angular/core';
2
- import { FormBuilder, FormGroup } from '@angular/forms';
3
- import { MINMAX } from './rm-range-slider.component.interface';
4
- import * as i0 from "@angular/core";
5
- export declare class RmRangeSliderComponent implements OnInit, AfterViewInit {
6
- #private;
7
- private readonly fb;
8
- private renderer;
9
- slider: FormGroup;
10
- min: number;
11
- max: number;
12
- setMinValue: number;
13
- disabled: boolean;
14
- showToolTip: boolean;
15
- setMaxValue: number;
16
- showScale: boolean;
17
- doubleSlider: boolean;
18
- toolTipColor: string;
19
- toolTipColorHover: string;
20
- toolTipColorHoverShadow: string;
21
- rangeColor: string;
22
- sliderColor: string;
23
- sliderColorRight: string;
24
- onValueChanged: EventEmitter<MINMAX>;
25
- toSliders: ElementRef;
26
- fromSlider: ElementRef;
27
- toSliderToolTip: ElementRef;
28
- fromSliderToolTip: ElementRef;
29
- private gradient;
30
- private destroyed$;
31
- /**
32
- * The constructor function is a special function that is called when a new instance of the class is created
33
- * @param {FormBuilder} fb - FormBuilder - This is the FormBuilder service that we'll use to create our form.
34
- * @param {Renderer2} renderer - Renderer2 - This is the Angular Renderer2 service. It's used to manipulate the DOM.
35
- */
36
- constructor(fb: FormBuilder, renderer: Renderer2);
37
- /**
38
- * It creates a form.
39
- */
40
- ngOnInit(): void;
41
- /**
42
- * A lifecycle hook that is called after a component's view has been fully initialized.
43
- */
44
- ngAfterViewInit(): void;
45
- /**
46
- * When the component is destroyed, we want to complete the observable and let any subscribers know that the observable is
47
- * complete.
48
- */
49
- ngOnDestroy(): void;
50
- /**
51
- * If the changes object has a property called disabled and it's not the first change and the current value is true, then
52
- * call the #disabledSlider function with the current value of the disabled property
53
- * @param {SimpleChanges} changes - SimpleChanges - this is the object that contains the changes that have been made to
54
- * the component.
55
- */
56
- ngOnChanges(changes: SimpleChanges): void;
57
- /**
58
- * It's a function that takes a string as an argument and if the showToolTip property is true, it calls the
59
- * fromSliderToolTipPosition() or toSliderToolTipPosition() function depending on the value of the string argument
60
- * @param {string} slideType - string - This is the type of slider that is being moved. It can be either 'from' or 'to'.
61
- */
62
- fireEventOnInput(slideType: string): void;
63
- /**
64
- * We're calculating the position of the tooltip based on the value of the slider
65
- */
66
- fromSliderToolTipPosition(): void;
67
- /**
68
- * The function takes the value of the toSlider and converts it to a percentage value that is used to position the
69
- * toSliderToolTip
70
- */
71
- /**
72
- * The function takes the value of the toSlider and converts it to a percentage value that is used to position the
73
- * toSliderToolTip
74
- */
75
- toSliderToolTipPosition(): void;
76
- /**
77
- * We're getting the values of the two sliders, and then emitting an event with those values
78
- */
79
- fireEventOnChange(): void;
80
- static ɵfac: i0.ɵɵFactoryDeclaration<RmRangeSliderComponent, never>;
81
- static ɵcmp: i0.ɵɵComponentDeclaration<RmRangeSliderComponent, "rm-range-slider", never, { "min": "SliderMinRange"; "max": "SliderMaxRange"; "setMinValue": "setMinValue"; "disabled": "disabled"; "showToolTip": "showToolTip"; "setMaxValue": "setMaxValue"; "showScale": "showScale"; "doubleSlider": "doubleSlider"; "toolTipColor": "toolTipColor"; "toolTipColorHover": "toolTipColorHover"; "toolTipColorHoverShadow": "toolTipColorHoverShadow"; "rangeColor": "rangeColor"; "sliderColor": "sliderColor"; "sliderColorRight": "sliderColorRight"; }, { "onValueChanged": "onValueChanged"; }, never, never, false>;
82
- }
1
+ import { EventEmitter, OnDestroy } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export interface MINMAX {
4
+ from: number;
5
+ to: number;
6
+ }
7
+ export declare class RmRangeSliderComponent implements OnDestroy {
8
+ private destroy$;
9
+ startValue: number;
10
+ endValue: number;
11
+ min: number;
12
+ max: number;
13
+ onValueChanged: EventEmitter<MINMAX>;
14
+ /**
15
+ * The `onSliderInput` function sets the `value` object with `startValue` and `endValue` properties and
16
+ * calls the `onSliderChange` function with this value.
17
+ */
18
+ onSliderInput(): void;
19
+ /**
20
+ * The `formatLabel` function in TypeScript formats a number value by rounding it to the nearest
21
+ * hundredth and appending a 'k' if the value is greater than or equal to 1000.
22
+ * @param {number} value - The `value` parameter is a number that represents a numerical value which
23
+ * needs to be formatted. The `formatLabel` function takes this number as input and returns a formatted
24
+ * string representation of the number. If the value is greater than or equal to 1000, it will be
25
+ * rounded and displayed in
26
+ * @returns If the `value` is greater than or equal to 1000, the function will return the value divided
27
+ * by 100 and rounded, followed by the letter 'k'. Otherwise, it will return the value as a string.
28
+ */
29
+ formatLabel(value: number): string;
30
+ /**
31
+ * The `onSliderChange` function in TypeScript sets up a Subject to emit slider value changes with a
32
+ * throttle time of 5000 milliseconds.
33
+ * @param {MINMAX} value - The `value` parameter in the `onSliderChange` method represents the current
34
+ * value of the slider, which is of type `MINMAX`.
35
+ */
36
+ onSliderChange(value: MINMAX): void;
37
+ /**
38
+ * The ngOnDestroy function in TypeScript is used to clean up resources and unsubscribe from
39
+ * observables by completing a subject.
40
+ */
41
+ ngOnDestroy(): void;
42
+ static ɵfac: i0.ɵɵFactoryDeclaration<RmRangeSliderComponent, never>;
43
+ static ɵcmp: i0.ɵɵComponentDeclaration<RmRangeSliderComponent, "rm-range-slider", never, { "startValue": { "alias": "startValue"; "required": true; }; "endValue": { "alias": "endValue"; "required": true; }; "min": { "alias": "min"; "required": true; }; "max": { "alias": "max"; "required": true; }; }, { "onValueChanged": "onValueChanged"; }, never, never, true, never>;
44
+ static ngAcceptInputType_startValue: unknown;
45
+ static ngAcceptInputType_endValue: unknown;
46
+ static ngAcceptInputType_min: unknown;
47
+ static ngAcceptInputType_max: unknown;
48
+ }