rm-range-slider 0.0.1 → 3.0.2

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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7XHJcbiAgICB0aGlzLmRlc3Ryb3kkLmNvbXBsZXRlKCk7XHJcbiAgfVxyXG59XHJcbiJdfQ==
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL3JtLXJhbmdlLXNsaWRlci9zcmMvcHVibGljLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsaUNBQWlDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKlxyXG4gKiBQdWJsaWMgQVBJIFN1cmZhY2Ugb2Ygcm0tcmFuZ2Utc2xpZGVyXHJcbiAqL1xyXG5cclxuZXhwb3J0ICogZnJvbSAnLi9saWIvcm0tcmFuZ2Utc2xpZGVyLmNvbXBvbmVudCc7XHJcbiJdfQ==
@@ -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 {\r\n Component,\r\n EventEmitter,\r\n Input,\r\n OnDestroy,\r\n Output,\r\n numberAttribute,\r\n} from '@angular/core';\r\nimport { FormsModule } from '@angular/forms';\r\nimport { MatSliderModule } from '@angular/material/slider';\r\nimport { Subject, takeUntil, throttleTime } from 'rxjs';\r\nexport interface MINMAX {\r\n from: number;\r\n to: number;\r\n}\r\n\r\n@Component({\r\n selector: 'rm-range-slider',\r\n standalone: true,\r\n imports: [MatSliderModule, FormsModule],\r\n template: `\r\n <mat-slider\r\n [min]=\"this.min\"\r\n [max]=\"this.max\"\r\n showTickMarks\r\n discrete\r\n [displayWith]=\"formatLabel\"\r\n (change)=\"onSliderInput()\"\r\n >\r\n <input matSliderStartThumb [(ngModel)]=\"startValue\" />\r\n <input matSliderEndThumb [(ngModel)]=\"endValue\" />\r\n </mat-slider>\r\n `,\r\n styles: `\r\n mat-slider {\r\n width: 100%;\r\n }\r\n `,\r\n})\r\nexport class RmRangeSliderComponent implements OnDestroy {\r\n private destroy$ = new Subject<void>();\r\n\r\n /* The `@Input` decorator in the TypeScript code snippet is used to define an input property for the\r\n`RmRangeSliderComponent` component in Angular. In this specific case: */\r\n @Input({\r\n required: true,\r\n transform: numberAttribute,\r\n })\r\n startValue: number = 0;\r\n\r\n /* The `@Input` decorator in the TypeScript code snippet is used to define an input property for the\r\n`RmRangeSliderComponent` component in Angular. In this specific case, the `endValue` property is\r\nbeing defined as an input property with the following configuration: */\r\n @Input({\r\n required: true,\r\n transform: numberAttribute,\r\n })\r\n endValue: number = 10;\r\n\r\n /* The `@Input` decorator in the TypeScript code snippet is used to define an input property for the\r\n`RmRangeSliderComponent` component in Angular. In this specific case, the `min` property is being\r\ndefined as an input property with the following configuration: */\r\n @Input({\r\n required: true,\r\n transform: numberAttribute,\r\n })\r\n min: number = 0;\r\n\r\n /* The `@Input` decorator in the TypeScript code snippet is used to define an input property for the\r\n`RmRangeSliderComponent` component in Angular. In this specific case, the `max` property is being\r\ndefined as an input property with the following configuration: */\r\n @Input({\r\n required: true,\r\n transform: numberAttribute,\r\n })\r\n max: number = 100;\r\n\r\n /* The `@Output()` decorator in the TypeScript code snippet is used to define an output property for\r\nthe `RmRangeSliderComponent` component in Angular. In this specific case, the `getMinMax` property\r\nis being defined as an output property with the type of `EventEmitter<MINMAX>`. */\r\n @Output()\r\n public onValueChanged = new EventEmitter<MINMAX>();\r\n\r\n /**\r\n * The `onSliderInput` function sets the `value` object with `startValue` and `endValue` properties and\r\n * calls the `onSliderChange` function with this value.\r\n */\r\n onSliderInput(): void {\r\n const value: MINMAX = {\r\n from: this.startValue,\r\n to: this.endValue,\r\n };\r\n this.onSliderChange(value);\r\n }\r\n\r\n /**\r\n * The `formatLabel` function in TypeScript formats a number value by rounding it to the nearest\r\n * hundredth and appending a 'k' if the value is greater than or equal to 1000.\r\n * @param {number} value - The `value` parameter is a number that represents a numerical value which\r\n * needs to be formatted. The `formatLabel` function takes this number as input and returns a formatted\r\n * string representation of the number. If the value is greater than or equal to 1000, it will be\r\n * rounded and displayed in\r\n * @returns If the `value` is greater than or equal to 1000, the function will return the value divided\r\n * by 100 and rounded, followed by the letter 'k'. Otherwise, it will return the value as a string.\r\n */\r\n\r\n formatLabel(value: number): string {\r\n if (value >= 1000) {\r\n return Math.round(value / 100) + 'k';\r\n }\r\n return `${value}`;\r\n }\r\n\r\n /**\r\n * The `onSliderChange` function in TypeScript sets up a Subject to emit slider value changes with a\r\n * throttle time of 5000 milliseconds.\r\n * @param {MINMAX} value - The `value` parameter in the `onSliderChange` method represents the current\r\n * value of the slider, which is of type `MINMAX`.\r\n */\r\n onSliderChange(value: MINMAX): void {\r\n this.destroy$.next();\r\n this.destroy$.complete();\r\n const sliderValueChanges$ = new Subject<MINMAX>();\r\n sliderValueChanges$\r\n .pipe(throttleTime(5000), takeUntil(this.destroy$))\r\n .subscribe((newValue: MINMAX) => {\r\n this.onValueChanged.emit(newValue);\r\n });\r\n sliderValueChanges$.next(value);\r\n }\r\n\r\n /**\r\n * The ngOnDestroy function in TypeScript is used to clean up resources and unsubscribe from\r\n * observables by completing a subject.\r\n */\r\n ngOnDestroy(): void {\r\n this.destroy$.next();\r\n this.destroy$.complete();\r\n }\r\n}\r\n","/*\r\n * Public API Surface of rm-range-slider\r\n */\r\n\r\nexport * from './lib/rm-range-slider.component';\r\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;AA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,iBAAiB,EAAA,UAAA,EACf,IAAI,EACP,OAAA,EAAA,CAAC,eAAe,EAAE,WAAW,CAAC,EAC7B,QAAA,EAAA,CAAA;;;;;;;;;;;;AAYT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,0BAAA,CAAA,EAAA,CAAA;8BAgBD,UAAU,EAAA,CAAA;sBAJT,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA;AACL,wBAAA,QAAQ,EAAE,IAAI;AACd,wBAAA,SAAS,EAAE,eAAe;AAC3B,qBAAA,CAAA;gBAUD,QAAQ,EAAA,CAAA;sBAJP,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA;AACL,wBAAA,QAAQ,EAAE,IAAI;AACd,wBAAA,SAAS,EAAE,eAAe;AAC3B,qBAAA,CAAA;gBAUD,GAAG,EAAA,CAAA;sBAJF,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA;AACL,wBAAA,QAAQ,EAAE,IAAI;AACd,wBAAA,SAAS,EAAE,eAAe;AAC3B,qBAAA,CAAA;gBAUD,GAAG,EAAA,CAAA;sBAJF,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA;AACL,wBAAA,QAAQ,EAAE,IAAI;AACd,wBAAA,SAAS,EAAE,eAAe;AAC3B,qBAAA,CAAA;gBAOM,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';