@angular/material 21.0.0-next.9 → 21.0.0-rc.0
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/core/tokens/_classes.scss +1 -1
- package/core/tokens/m2/_md-sys-color.scss +17 -17
- package/fesm2022/_animation-chunk.mjs +10 -16
- package/fesm2022/_animation-chunk.mjs.map +1 -1
- package/fesm2022/_date-formats-chunk.mjs +68 -164
- package/fesm2022/_date-formats-chunk.mjs.map +1 -1
- package/fesm2022/_date-range-input-harness-chunk.mjs +284 -463
- package/fesm2022/_date-range-input-harness-chunk.mjs.map +1 -1
- package/fesm2022/_error-options-chunk.mjs +56 -19
- package/fesm2022/_error-options-chunk.mjs.map +1 -1
- package/fesm2022/_error-state-chunk.mjs +24 -31
- package/fesm2022/_error-state-chunk.mjs.map +1 -1
- package/fesm2022/_form-field-chunk.mjs +1224 -1017
- package/fesm2022/_form-field-chunk.mjs.map +1 -1
- package/fesm2022/_icon-button-chunk.mjs +243 -187
- package/fesm2022/_icon-button-chunk.mjs.map +1 -1
- package/fesm2022/_icon-registry-chunk.mjs +350 -575
- package/fesm2022/_icon-registry-chunk.mjs.map +1 -1
- package/fesm2022/_input-harness-chunk.mjs +56 -107
- package/fesm2022/_input-harness-chunk.mjs.map +1 -1
- package/fesm2022/_input-value-accessor-chunk.mjs +0 -6
- package/fesm2022/_input-value-accessor-chunk.mjs.map +1 -1
- package/fesm2022/_internal-form-field-chunk.mjs +59 -19
- package/fesm2022/_internal-form-field-chunk.mjs.map +1 -1
- package/fesm2022/_line-chunk.mjs +83 -43
- package/fesm2022/_line-chunk.mjs.map +1 -1
- package/fesm2022/_option-chunk.mjs +348 -311
- package/fesm2022/_option-chunk.mjs.map +1 -1
- package/fesm2022/_option-harness-chunk.mjs +23 -39
- package/fesm2022/_option-harness-chunk.mjs.map +1 -1
- package/fesm2022/_option-module-chunk.mjs +36 -10
- package/fesm2022/_option-module-chunk.mjs.map +1 -1
- package/fesm2022/_pseudo-checkbox-chunk.mjs +79 -44
- package/fesm2022/_pseudo-checkbox-chunk.mjs.map +1 -1
- package/fesm2022/_pseudo-checkbox-module-chunk.mjs +36 -10
- package/fesm2022/_pseudo-checkbox-module-chunk.mjs.map +1 -1
- package/fesm2022/_public-api-chunk.mjs +71 -134
- package/fesm2022/_public-api-chunk.mjs.map +1 -1
- package/fesm2022/_ripple-chunk.mjs +504 -600
- package/fesm2022/_ripple-chunk.mjs.map +1 -1
- package/fesm2022/_ripple-loader-chunk.mjs +120 -138
- package/fesm2022/_ripple-loader-chunk.mjs.map +1 -1
- package/fesm2022/_ripple-module-chunk.mjs +36 -10
- package/fesm2022/_ripple-module-chunk.mjs.map +1 -1
- package/fesm2022/_structural-styles-chunk.mjs +37 -10
- package/fesm2022/_structural-styles-chunk.mjs.map +1 -1
- package/fesm2022/_tooltip-chunk.mjs +810 -888
- package/fesm2022/_tooltip-chunk.mjs.map +1 -1
- package/fesm2022/autocomplete-testing.mjs +62 -86
- package/fesm2022/autocomplete-testing.mjs.map +1 -1
- package/fesm2022/autocomplete.mjs +965 -1126
- package/fesm2022/autocomplete.mjs.map +1 -1
- package/fesm2022/badge-testing.mjs +38 -54
- package/fesm2022/badge-testing.mjs.map +1 -1
- package/fesm2022/badge.mjs +321 -272
- package/fesm2022/badge.mjs.map +1 -1
- package/fesm2022/bottom-sheet-testing.mjs +10 -24
- package/fesm2022/bottom-sheet-testing.mjs.map +1 -1
- package/fesm2022/bottom-sheet.mjs +349 -344
- package/fesm2022/bottom-sheet.mjs.map +1 -1
- package/fesm2022/button-testing.mjs +60 -94
- package/fesm2022/button-testing.mjs.map +1 -1
- package/fesm2022/button-toggle-testing.mjs +76 -125
- package/fesm2022/button-toggle-testing.mjs.map +1 -1
- package/fesm2022/button-toggle.mjs +752 -662
- package/fesm2022/button-toggle.mjs.map +1 -1
- package/fesm2022/button.mjs +263 -158
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/card-testing.mjs +19 -33
- package/fesm2022/card-testing.mjs.map +1 -1
- package/fesm2022/card.mjs +576 -272
- package/fesm2022/card.mjs.map +1 -1
- package/fesm2022/checkbox-testing.mjs +71 -123
- package/fesm2022/checkbox-testing.mjs.map +1 -1
- package/fesm2022/checkbox.mjs +515 -477
- package/fesm2022/checkbox.mjs.map +1 -1
- package/fesm2022/chips-testing.mjs +201 -344
- package/fesm2022/chips-testing.mjs.map +1 -1
- package/fesm2022/chips.mjs +2552 -2289
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core-testing.mjs +14 -28
- package/fesm2022/core-testing.mjs.map +1 -1
- package/fesm2022/core.mjs +357 -328
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker-testing.mjs +15 -25
- package/fesm2022/datepicker-testing.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +4826 -4563
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog-testing.mjs +93 -129
- package/fesm2022/dialog-testing.mjs.map +1 -1
- package/fesm2022/dialog.mjs +810 -829
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/divider-testing.mjs +10 -11
- package/fesm2022/divider-testing.mjs.map +1 -1
- package/fesm2022/divider.mjs +119 -43
- package/fesm2022/divider.mjs.map +1 -1
- package/fesm2022/expansion-testing.mjs +74 -130
- package/fesm2022/expansion-testing.mjs.map +1 -1
- package/fesm2022/expansion.mjs +703 -515
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field-testing-control.mjs +16 -33
- package/fesm2022/form-field-testing-control.mjs.map +1 -1
- package/fesm2022/form-field-testing.mjs +118 -179
- package/fesm2022/form-field-testing.mjs.map +1 -1
- package/fesm2022/form-field.mjs +36 -10
- package/fesm2022/form-field.mjs.map +1 -1
- package/fesm2022/grid-list-testing.mjs +65 -113
- package/fesm2022/grid-list-testing.mjs.map +1 -1
- package/fesm2022/grid-list.mjs +559 -494
- package/fesm2022/grid-list.mjs.map +1 -1
- package/fesm2022/icon-testing.mjs +148 -127
- package/fesm2022/icon-testing.mjs.map +1 -1
- package/fesm2022/icon.mjs +325 -351
- package/fesm2022/icon.mjs.map +1 -1
- package/fesm2022/input-testing.mjs +59 -99
- package/fesm2022/input-testing.mjs.map +1 -1
- package/fesm2022/input.mjs +457 -520
- package/fesm2022/input.mjs.map +1 -1
- package/fesm2022/list-testing.mjs +251 -434
- package/fesm2022/list-testing.mjs.map +1 -1
- package/fesm2022/list.mjs +1522 -1204
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/material.mjs +0 -5
- package/fesm2022/material.mjs.map +1 -1
- package/fesm2022/menu-testing.mjs +159 -228
- package/fesm2022/menu-testing.mjs.map +1 -1
- package/fesm2022/menu.mjs +1338 -1343
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/paginator-testing.mjs +55 -79
- package/fesm2022/paginator-testing.mjs.map +1 -1
- package/fesm2022/paginator.mjs +381 -309
- package/fesm2022/paginator.mjs.map +1 -1
- package/fesm2022/progress-bar-testing.mjs +12 -21
- package/fesm2022/progress-bar-testing.mjs.map +1 -1
- package/fesm2022/progress-bar.mjs +224 -169
- package/fesm2022/progress-bar.mjs.map +1 -1
- package/fesm2022/progress-spinner-testing.mjs +13 -23
- package/fesm2022/progress-spinner-testing.mjs.map +1 -1
- package/fesm2022/progress-spinner.mjs +235 -160
- package/fesm2022/progress-spinner.mjs.map +1 -1
- package/fesm2022/radio-testing.mjs +133 -208
- package/fesm2022/radio-testing.mjs.map +1 -1
- package/fesm2022/radio.mjs +712 -679
- package/fesm2022/radio.mjs.map +1 -1
- package/fesm2022/select-testing.mjs +83 -117
- package/fesm2022/select-testing.mjs.map +1 -1
- package/fesm2022/select.mjs +1116 -1246
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav-testing.mjs +54 -120
- package/fesm2022/sidenav-testing.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +1078 -995
- package/fesm2022/sidenav.mjs.map +1 -1
- package/fesm2022/slide-toggle-testing.mjs +57 -92
- package/fesm2022/slide-toggle-testing.mjs.map +1 -1
- package/fesm2022/slide-toggle.mjs +369 -279
- package/fesm2022/slide-toggle.mjs.map +1 -1
- package/fesm2022/slider-testing.mjs +90 -138
- package/fesm2022/slider-testing.mjs.map +1 -1
- package/fesm2022/slider.mjs +1651 -1716
- package/fesm2022/slider.mjs.map +1 -1
- package/fesm2022/snack-bar-testing.mjs +40 -87
- package/fesm2022/snack-bar-testing.mjs.map +1 -1
- package/fesm2022/snack-bar.mjs +763 -714
- package/fesm2022/snack-bar.mjs.map +1 -1
- package/fesm2022/sort-testing.mjs +45 -66
- package/fesm2022/sort-testing.mjs.map +1 -1
- package/fesm2022/sort.mjs +419 -344
- package/fesm2022/sort.mjs.map +1 -1
- package/fesm2022/stepper-testing.mjs +78 -154
- package/fesm2022/stepper-testing.mjs.map +1 -1
- package/fesm2022/stepper.mjs +790 -498
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table-testing.mjs +120 -213
- package/fesm2022/table-testing.mjs.map +1 -1
- package/fesm2022/table.mjs +1026 -684
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs-testing.mjs +125 -197
- package/fesm2022/tabs-testing.mjs.map +1 -1
- package/fesm2022/tabs.mjs +2351 -2028
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/timepicker-testing.mjs +113 -172
- package/fesm2022/timepicker-testing.mjs.map +1 -1
- package/fesm2022/timepicker.mjs +1019 -826
- package/fesm2022/timepicker.mjs.map +1 -1
- package/fesm2022/toolbar-testing.mjs +16 -27
- package/fesm2022/toolbar-testing.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +163 -78
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tooltip-testing.mjs +41 -52
- package/fesm2022/tooltip-testing.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +36 -10
- package/fesm2022/tooltip.mjs.map +1 -1
- package/fesm2022/tree-testing.mjs +86 -162
- package/fesm2022/tree-testing.mjs.map +1 -1
- package/fesm2022/tree.mjs +638 -466
- package/fesm2022/tree.mjs.map +1 -1
- package/package.json +2 -2
- package/schematics/ng-add/index.js +1 -1
- package/types/expansion.d.ts +4 -2
- package/types/menu-testing.d.ts +2 -0
- package/types/select.d.ts +1 -1
- package/types/timepicker.d.ts +1 -0
package/fesm2022/slider.mjs
CHANGED
|
@@ -13,1047 +13,1038 @@ import '@angular/cdk/a11y';
|
|
|
13
13
|
import '@angular/cdk/coercion';
|
|
14
14
|
import '@angular/cdk/layout';
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* Thumb types: range slider has two thumbs (START, END) whereas single point
|
|
18
|
-
* slider only has one thumb (END).
|
|
19
|
-
*/
|
|
20
16
|
var _MatThumb;
|
|
21
17
|
(function (_MatThumb) {
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
_MatThumb[_MatThumb["START"] = 1] = "START";
|
|
19
|
+
_MatThumb[_MatThumb["END"] = 2] = "END";
|
|
24
20
|
})(_MatThumb || (_MatThumb = {}));
|
|
25
|
-
/** Tick mark enum, for discrete sliders. */
|
|
26
21
|
var _MatTickMark;
|
|
27
22
|
(function (_MatTickMark) {
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
_MatTickMark[_MatTickMark["ACTIVE"] = 0] = "ACTIVE";
|
|
24
|
+
_MatTickMark[_MatTickMark["INACTIVE"] = 1] = "INACTIVE";
|
|
30
25
|
})(_MatTickMark || (_MatTickMark = {}));
|
|
31
|
-
/**
|
|
32
|
-
* Injection token that can be used for a `MatSlider` to provide itself as a
|
|
33
|
-
* parent to the `MatSliderThumb` and `MatSliderRangeThumb`.
|
|
34
|
-
* Used primarily to avoid circular imports.
|
|
35
|
-
* @docs-private
|
|
36
|
-
*/
|
|
37
26
|
const MAT_SLIDER = new InjectionToken('_MatSlider');
|
|
38
|
-
/**
|
|
39
|
-
* Injection token that can be used to query for a `MatSliderThumb`.
|
|
40
|
-
* Used primarily to avoid circular imports.
|
|
41
|
-
* @docs-private
|
|
42
|
-
*/
|
|
43
27
|
const MAT_SLIDER_THUMB = new InjectionToken('_MatSliderThumb');
|
|
44
|
-
/**
|
|
45
|
-
* Injection token that can be used to query for a `MatSliderRangeThumb`.
|
|
46
|
-
* Used primarily to avoid circular imports.
|
|
47
|
-
* @docs-private
|
|
48
|
-
*/
|
|
49
28
|
const MAT_SLIDER_RANGE_THUMB = new InjectionToken('_MatSliderRangeThumb');
|
|
50
|
-
/**
|
|
51
|
-
* Injection token that can be used to query for a `MatSliderVisualThumb`.
|
|
52
|
-
* Used primarily to avoid circular imports.
|
|
53
|
-
* @docs-private
|
|
54
|
-
*/
|
|
55
29
|
const MAT_SLIDER_VISUAL_THUMB = new InjectionToken('_MatSliderVisualThumb');
|
|
56
|
-
/**
|
|
57
|
-
* A simple change event emitted by the MatSlider component.
|
|
58
|
-
* @deprecated Use event bindings directly on the MatSliderThumbs for `change` and `input` events. See https://v17.material.angular.dev/guide/mdc-migration for information about migrating.
|
|
59
|
-
* @breaking-change 17.0.0
|
|
60
|
-
*/
|
|
61
30
|
class MatSliderChange {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
parent;
|
|
66
|
-
/** The new value of the source slider. */
|
|
67
|
-
value;
|
|
31
|
+
source;
|
|
32
|
+
parent;
|
|
33
|
+
value;
|
|
68
34
|
}
|
|
69
35
|
|
|
70
|
-
/**
|
|
71
|
-
* The visual slider thumb.
|
|
72
|
-
*
|
|
73
|
-
* Handles the slider thumb ripple states (hover, focus, and active),
|
|
74
|
-
* and displaying the value tooltip on discrete sliders.
|
|
75
|
-
* @docs-private
|
|
76
|
-
*/
|
|
77
36
|
class MatSliderVisualThumb {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
37
|
+
_cdr = inject(ChangeDetectorRef);
|
|
38
|
+
_ngZone = inject(NgZone);
|
|
39
|
+
_slider = inject(MAT_SLIDER);
|
|
40
|
+
_renderer = inject(Renderer2);
|
|
41
|
+
_listenerCleanups;
|
|
42
|
+
discrete;
|
|
43
|
+
thumbPosition;
|
|
44
|
+
valueIndicatorText;
|
|
45
|
+
_ripple;
|
|
46
|
+
_knob;
|
|
47
|
+
_valueIndicatorContainer;
|
|
48
|
+
_sliderInput;
|
|
49
|
+
_sliderInputEl;
|
|
50
|
+
_hoverRippleRef;
|
|
51
|
+
_focusRippleRef;
|
|
52
|
+
_activeRippleRef;
|
|
53
|
+
_isHovered = false;
|
|
54
|
+
_isActive = false;
|
|
55
|
+
_isValueIndicatorVisible = false;
|
|
56
|
+
_hostElement = inject(ElementRef).nativeElement;
|
|
57
|
+
_platform = inject(Platform);
|
|
58
|
+
constructor() {}
|
|
59
|
+
ngAfterViewInit() {
|
|
60
|
+
const sliderInput = this._slider._getInput(this.thumbPosition);
|
|
61
|
+
if (!sliderInput) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this._ripple.radius = 24;
|
|
65
|
+
this._sliderInput = sliderInput;
|
|
66
|
+
this._sliderInputEl = this._sliderInput._hostElement;
|
|
67
|
+
this._ngZone.runOutsideAngular(() => {
|
|
68
|
+
const input = this._sliderInputEl;
|
|
69
|
+
const renderer = this._renderer;
|
|
70
|
+
this._listenerCleanups = [renderer.listen(input, 'pointermove', this._onPointerMove), renderer.listen(input, 'pointerdown', this._onDragStart), renderer.listen(input, 'pointerup', this._onDragEnd), renderer.listen(input, 'pointerleave', this._onMouseLeave), renderer.listen(input, 'focus', this._onFocus), renderer.listen(input, 'blur', this._onBlur)];
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
ngOnDestroy() {
|
|
74
|
+
this._listenerCleanups?.forEach(cleanup => cleanup());
|
|
75
|
+
}
|
|
76
|
+
_onPointerMove = event => {
|
|
77
|
+
if (this._sliderInput._isFocused) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const rect = this._hostElement.getBoundingClientRect();
|
|
81
|
+
const isHovered = this._slider._isCursorOnSliderThumb(event, rect);
|
|
82
|
+
this._isHovered = isHovered;
|
|
83
|
+
if (isHovered) {
|
|
84
|
+
this._showHoverRipple();
|
|
85
|
+
} else {
|
|
86
|
+
this._hideRipple(this._hoverRippleRef);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
_onMouseLeave = () => {
|
|
90
|
+
this._isHovered = false;
|
|
91
|
+
this._hideRipple(this._hoverRippleRef);
|
|
92
|
+
};
|
|
93
|
+
_onFocus = () => {
|
|
94
|
+
this._hideRipple(this._hoverRippleRef);
|
|
95
|
+
this._showFocusRipple();
|
|
96
|
+
this._hostElement.classList.add('mdc-slider__thumb--focused');
|
|
97
|
+
};
|
|
98
|
+
_onBlur = () => {
|
|
99
|
+
if (!this._isActive) {
|
|
100
|
+
this._hideRipple(this._focusRippleRef);
|
|
101
|
+
}
|
|
102
|
+
if (this._isHovered) {
|
|
103
|
+
this._showHoverRipple();
|
|
104
|
+
}
|
|
105
|
+
this._hostElement.classList.remove('mdc-slider__thumb--focused');
|
|
106
|
+
};
|
|
107
|
+
_onDragStart = event => {
|
|
108
|
+
if (event.button !== 0) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
this._isActive = true;
|
|
112
|
+
this._showActiveRipple();
|
|
113
|
+
};
|
|
114
|
+
_onDragEnd = () => {
|
|
115
|
+
this._isActive = false;
|
|
116
|
+
this._hideRipple(this._activeRippleRef);
|
|
117
|
+
if (!this._sliderInput._isFocused) {
|
|
118
|
+
this._hideRipple(this._focusRippleRef);
|
|
119
|
+
}
|
|
120
|
+
if (this._platform.SAFARI) {
|
|
121
|
+
this._showHoverRipple();
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
_showHoverRipple() {
|
|
125
|
+
if (!this._isShowingRipple(this._hoverRippleRef)) {
|
|
126
|
+
this._hoverRippleRef = this._showRipple({
|
|
127
|
+
enterDuration: 0,
|
|
128
|
+
exitDuration: 0
|
|
129
|
+
});
|
|
130
|
+
this._hoverRippleRef?.element.classList.add('mat-mdc-slider-hover-ripple');
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
_showFocusRipple() {
|
|
134
|
+
if (!this._isShowingRipple(this._focusRippleRef)) {
|
|
135
|
+
this._focusRippleRef = this._showRipple({
|
|
136
|
+
enterDuration: 0,
|
|
137
|
+
exitDuration: 0
|
|
138
|
+
}, true);
|
|
139
|
+
this._focusRippleRef?.element.classList.add('mat-mdc-slider-focus-ripple');
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
_showActiveRipple() {
|
|
143
|
+
if (!this._isShowingRipple(this._activeRippleRef)) {
|
|
144
|
+
this._activeRippleRef = this._showRipple({
|
|
145
|
+
enterDuration: 225,
|
|
146
|
+
exitDuration: 400
|
|
147
|
+
});
|
|
148
|
+
this._activeRippleRef?.element.classList.add('mat-mdc-slider-active-ripple');
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
_isShowingRipple(rippleRef) {
|
|
152
|
+
return rippleRef?.state === RippleState.FADING_IN || rippleRef?.state === RippleState.VISIBLE;
|
|
153
|
+
}
|
|
154
|
+
_showRipple(animation, ignoreGlobalRippleConfig) {
|
|
155
|
+
if (this._slider.disabled) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
this._showValueIndicator();
|
|
159
|
+
if (this._slider._isRange) {
|
|
160
|
+
const sibling = this._slider._getThumb(this.thumbPosition === _MatThumb.START ? _MatThumb.END : _MatThumb.START);
|
|
161
|
+
sibling._showValueIndicator();
|
|
162
|
+
}
|
|
163
|
+
if (this._slider._globalRippleOptions?.disabled && !ignoreGlobalRippleConfig) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
return this._ripple.launch({
|
|
167
|
+
animation: this._slider._noopAnimations ? {
|
|
168
|
+
enterDuration: 0,
|
|
169
|
+
exitDuration: 0
|
|
170
|
+
} : animation,
|
|
171
|
+
centered: true,
|
|
172
|
+
persistent: true
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
_hideRipple(rippleRef) {
|
|
176
|
+
rippleRef?.fadeOut();
|
|
177
|
+
if (this._isShowingAnyRipple()) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (!this._slider._isRange) {
|
|
181
|
+
this._hideValueIndicator();
|
|
182
|
+
}
|
|
183
|
+
const sibling = this._getSibling();
|
|
184
|
+
if (!sibling._isShowingAnyRipple()) {
|
|
185
|
+
this._hideValueIndicator();
|
|
186
|
+
sibling._hideValueIndicator();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
_showValueIndicator() {
|
|
190
|
+
this._hostElement.classList.add('mdc-slider__thumb--with-indicator');
|
|
191
|
+
}
|
|
192
|
+
_hideValueIndicator() {
|
|
193
|
+
this._hostElement.classList.remove('mdc-slider__thumb--with-indicator');
|
|
194
|
+
}
|
|
195
|
+
_getSibling() {
|
|
196
|
+
return this._slider._getThumb(this.thumbPosition === _MatThumb.START ? _MatThumb.END : _MatThumb.START);
|
|
197
|
+
}
|
|
198
|
+
_getValueIndicatorContainer() {
|
|
199
|
+
return this._valueIndicatorContainer?.nativeElement;
|
|
200
|
+
}
|
|
201
|
+
_getKnob() {
|
|
202
|
+
return this._knob.nativeElement;
|
|
203
|
+
}
|
|
204
|
+
_isShowingAnyRipple() {
|
|
205
|
+
return this._isShowingRipple(this._hoverRippleRef) || this._isShowingRipple(this._focusRippleRef) || this._isShowingRipple(this._activeRippleRef);
|
|
206
|
+
}
|
|
207
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
208
|
+
minVersion: "12.0.0",
|
|
209
|
+
version: "20.2.0-next.2",
|
|
210
|
+
ngImport: i0,
|
|
211
|
+
type: MatSliderVisualThumb,
|
|
212
|
+
deps: [],
|
|
213
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
214
|
+
});
|
|
215
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
216
|
+
minVersion: "17.0.0",
|
|
217
|
+
version: "20.2.0-next.2",
|
|
218
|
+
type: MatSliderVisualThumb,
|
|
219
|
+
isStandalone: true,
|
|
220
|
+
selector: "mat-slider-visual-thumb",
|
|
221
|
+
inputs: {
|
|
222
|
+
discrete: "discrete",
|
|
223
|
+
thumbPosition: "thumbPosition",
|
|
224
|
+
valueIndicatorText: "valueIndicatorText"
|
|
225
|
+
},
|
|
226
|
+
host: {
|
|
227
|
+
classAttribute: "mdc-slider__thumb mat-mdc-slider-visual-thumb"
|
|
228
|
+
},
|
|
229
|
+
providers: [{
|
|
230
|
+
provide: MAT_SLIDER_VISUAL_THUMB,
|
|
231
|
+
useExisting: MatSliderVisualThumb
|
|
232
|
+
}],
|
|
233
|
+
viewQueries: [{
|
|
234
|
+
propertyName: "_ripple",
|
|
235
|
+
first: true,
|
|
236
|
+
predicate: MatRipple,
|
|
237
|
+
descendants: true
|
|
238
|
+
}, {
|
|
239
|
+
propertyName: "_knob",
|
|
240
|
+
first: true,
|
|
241
|
+
predicate: ["knob"],
|
|
242
|
+
descendants: true
|
|
243
|
+
}, {
|
|
244
|
+
propertyName: "_valueIndicatorContainer",
|
|
245
|
+
first: true,
|
|
246
|
+
predicate: ["valueIndicatorContainer"],
|
|
247
|
+
descendants: true
|
|
248
|
+
}],
|
|
249
|
+
ngImport: i0,
|
|
250
|
+
template: "@if (discrete) {\n <div class=\"mdc-slider__value-indicator-container\" #valueIndicatorContainer>\n <div class=\"mdc-slider__value-indicator\">\n <span class=\"mdc-slider__value-indicator-text\">{{valueIndicatorText}}</span>\n </div>\n </div>\n}\n<div class=\"mdc-slider__thumb-knob\" #knob></div>\n<div matRipple class=\"mat-focus-indicator\" [matRippleDisabled]=\"true\"></div>\n",
|
|
251
|
+
styles: [".mat-mdc-slider-visual-thumb .mat-ripple{height:100%;width:100%}.mat-mdc-slider .mdc-slider__tick-marks{justify-content:start}.mat-mdc-slider .mdc-slider__tick-marks .mdc-slider__tick-mark--active,.mat-mdc-slider .mdc-slider__tick-marks .mdc-slider__tick-mark--inactive{position:absolute;left:2px}\n"],
|
|
252
|
+
dependencies: [{
|
|
253
|
+
kind: "directive",
|
|
254
|
+
type: MatRipple,
|
|
255
|
+
selector: "[mat-ripple], [matRipple]",
|
|
256
|
+
inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"],
|
|
257
|
+
exportAs: ["matRipple"]
|
|
258
|
+
}],
|
|
259
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
260
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
261
|
+
});
|
|
288
262
|
}
|
|
289
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
263
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
264
|
+
minVersion: "12.0.0",
|
|
265
|
+
version: "20.2.0-next.2",
|
|
266
|
+
ngImport: i0,
|
|
267
|
+
type: MatSliderVisualThumb,
|
|
268
|
+
decorators: [{
|
|
269
|
+
type: Component,
|
|
270
|
+
args: [{
|
|
271
|
+
selector: 'mat-slider-visual-thumb',
|
|
272
|
+
host: {
|
|
273
|
+
'class': 'mdc-slider__thumb mat-mdc-slider-visual-thumb'
|
|
274
|
+
},
|
|
275
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
276
|
+
encapsulation: ViewEncapsulation.None,
|
|
277
|
+
providers: [{
|
|
278
|
+
provide: MAT_SLIDER_VISUAL_THUMB,
|
|
279
|
+
useExisting: MatSliderVisualThumb
|
|
280
|
+
}],
|
|
281
|
+
imports: [MatRipple],
|
|
282
|
+
template: "@if (discrete) {\n <div class=\"mdc-slider__value-indicator-container\" #valueIndicatorContainer>\n <div class=\"mdc-slider__value-indicator\">\n <span class=\"mdc-slider__value-indicator-text\">{{valueIndicatorText}}</span>\n </div>\n </div>\n}\n<div class=\"mdc-slider__thumb-knob\" #knob></div>\n<div matRipple class=\"mat-focus-indicator\" [matRippleDisabled]=\"true\"></div>\n",
|
|
283
|
+
styles: [".mat-mdc-slider-visual-thumb .mat-ripple{height:100%;width:100%}.mat-mdc-slider .mdc-slider__tick-marks{justify-content:start}.mat-mdc-slider .mdc-slider__tick-marks .mdc-slider__tick-mark--active,.mat-mdc-slider .mdc-slider__tick-marks .mdc-slider__tick-mark--inactive{position:absolute;left:2px}\n"]
|
|
284
|
+
}]
|
|
285
|
+
}],
|
|
286
|
+
ctorParameters: () => [],
|
|
287
|
+
propDecorators: {
|
|
288
|
+
discrete: [{
|
|
289
|
+
type: Input
|
|
290
|
+
}],
|
|
291
|
+
thumbPosition: [{
|
|
292
|
+
type: Input
|
|
293
|
+
}],
|
|
294
|
+
valueIndicatorText: [{
|
|
295
|
+
type: Input
|
|
296
|
+
}],
|
|
297
|
+
_ripple: [{
|
|
298
|
+
type: ViewChild,
|
|
299
|
+
args: [MatRipple]
|
|
300
|
+
}],
|
|
301
|
+
_knob: [{
|
|
302
|
+
type: ViewChild,
|
|
303
|
+
args: ['knob']
|
|
304
|
+
}],
|
|
305
|
+
_valueIndicatorContainer: [{
|
|
306
|
+
type: ViewChild,
|
|
307
|
+
args: ['valueIndicatorContainer']
|
|
308
|
+
}]
|
|
309
|
+
}
|
|
310
|
+
});
|
|
310
311
|
|
|
311
|
-
// TODO(wagnermaciel): maybe handle the following edge case:
|
|
312
|
-
// 1. start dragging discrete slider
|
|
313
|
-
// 2. tab to disable checkbox
|
|
314
|
-
// 3. without ending drag, disable the slider
|
|
315
|
-
/**
|
|
316
|
-
* Allows users to select from a range of values by moving the slider thumb. It is similar in
|
|
317
|
-
* behavior to the native `<input type="range">` element.
|
|
318
|
-
*/
|
|
319
312
|
class MatSlider {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
313
|
+
_ngZone = inject(NgZone);
|
|
314
|
+
_cdr = inject(ChangeDetectorRef);
|
|
315
|
+
_elementRef = inject(ElementRef);
|
|
316
|
+
_dir = inject(Directionality, {
|
|
317
|
+
optional: true
|
|
318
|
+
});
|
|
319
|
+
_globalRippleOptions = inject(MAT_RIPPLE_GLOBAL_OPTIONS, {
|
|
320
|
+
optional: true
|
|
321
|
+
});
|
|
322
|
+
_trackActive;
|
|
323
|
+
_thumbs;
|
|
324
|
+
_input;
|
|
325
|
+
_inputs;
|
|
326
|
+
get disabled() {
|
|
327
|
+
return this._disabled;
|
|
328
|
+
}
|
|
329
|
+
set disabled(v) {
|
|
330
|
+
this._disabled = v;
|
|
331
|
+
const endInput = this._getInput(_MatThumb.END);
|
|
332
|
+
const startInput = this._getInput(_MatThumb.START);
|
|
333
|
+
if (endInput) {
|
|
334
|
+
endInput.disabled = this._disabled;
|
|
335
|
+
}
|
|
336
|
+
if (startInput) {
|
|
337
|
+
startInput.disabled = this._disabled;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
_disabled = false;
|
|
341
|
+
get discrete() {
|
|
342
|
+
return this._discrete;
|
|
343
|
+
}
|
|
344
|
+
set discrete(v) {
|
|
345
|
+
this._discrete = v;
|
|
346
|
+
this._updateValueIndicatorUIs();
|
|
347
|
+
}
|
|
348
|
+
_discrete = false;
|
|
349
|
+
get showTickMarks() {
|
|
350
|
+
return this._showTickMarks;
|
|
351
|
+
}
|
|
352
|
+
set showTickMarks(value) {
|
|
353
|
+
this._showTickMarks = value;
|
|
354
|
+
if (this._hasViewInitialized) {
|
|
355
|
+
this._updateTickMarkUI();
|
|
356
|
+
this._updateTickMarkTrackUI();
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
_showTickMarks = false;
|
|
360
|
+
get min() {
|
|
361
|
+
return this._min;
|
|
362
|
+
}
|
|
363
|
+
set min(v) {
|
|
364
|
+
const min = v === undefined || v === null || isNaN(v) ? this._min : v;
|
|
365
|
+
if (this._min !== min) {
|
|
366
|
+
this._updateMin(min);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
_min = 0;
|
|
370
|
+
color;
|
|
371
|
+
disableRipple = false;
|
|
372
|
+
_updateMin(min) {
|
|
373
|
+
const prevMin = this._min;
|
|
374
|
+
this._min = min;
|
|
375
|
+
this._isRange ? this._updateMinRange({
|
|
376
|
+
old: prevMin,
|
|
377
|
+
new: min
|
|
378
|
+
}) : this._updateMinNonRange(min);
|
|
379
|
+
this._onMinMaxOrStepChange();
|
|
380
|
+
}
|
|
381
|
+
_updateMinRange(min) {
|
|
382
|
+
const endInput = this._getInput(_MatThumb.END);
|
|
383
|
+
const startInput = this._getInput(_MatThumb.START);
|
|
384
|
+
const oldEndValue = endInput.value;
|
|
385
|
+
const oldStartValue = startInput.value;
|
|
386
|
+
startInput.min = min.new;
|
|
387
|
+
endInput.min = Math.max(min.new, startInput.value);
|
|
388
|
+
startInput.max = Math.min(endInput.max, endInput.value);
|
|
389
|
+
startInput._updateWidthInactive();
|
|
390
|
+
endInput._updateWidthInactive();
|
|
391
|
+
min.new < min.old ? this._onTranslateXChangeBySideEffect(endInput, startInput) : this._onTranslateXChangeBySideEffect(startInput, endInput);
|
|
392
|
+
if (oldEndValue !== endInput.value) {
|
|
393
|
+
this._onValueChange(endInput);
|
|
394
|
+
}
|
|
395
|
+
if (oldStartValue !== startInput.value) {
|
|
396
|
+
this._onValueChange(startInput);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
_updateMinNonRange(min) {
|
|
400
|
+
const input = this._getInput(_MatThumb.END);
|
|
401
|
+
if (input) {
|
|
402
|
+
const oldValue = input.value;
|
|
403
|
+
input.min = min;
|
|
404
|
+
input._updateThumbUIByValue();
|
|
405
|
+
this._updateTrackUI(input);
|
|
406
|
+
if (oldValue !== input.value) {
|
|
407
|
+
this._onValueChange(input);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
get max() {
|
|
412
|
+
return this._max;
|
|
413
|
+
}
|
|
414
|
+
set max(v) {
|
|
415
|
+
const max = v === undefined || v === null || isNaN(v) ? this._max : v;
|
|
416
|
+
if (this._max !== max) {
|
|
417
|
+
this._updateMax(max);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
_max = 100;
|
|
421
|
+
_updateMax(max) {
|
|
422
|
+
const prevMax = this._max;
|
|
423
|
+
this._max = max;
|
|
424
|
+
this._isRange ? this._updateMaxRange({
|
|
425
|
+
old: prevMax,
|
|
426
|
+
new: max
|
|
427
|
+
}) : this._updateMaxNonRange(max);
|
|
428
|
+
this._onMinMaxOrStepChange();
|
|
429
|
+
}
|
|
430
|
+
_updateMaxRange(max) {
|
|
431
|
+
const endInput = this._getInput(_MatThumb.END);
|
|
432
|
+
const startInput = this._getInput(_MatThumb.START);
|
|
433
|
+
const oldEndValue = endInput.value;
|
|
434
|
+
const oldStartValue = startInput.value;
|
|
435
|
+
endInput.max = max.new;
|
|
436
|
+
startInput.max = Math.min(max.new, endInput.value);
|
|
437
|
+
endInput.min = startInput.value;
|
|
438
|
+
endInput._updateWidthInactive();
|
|
439
|
+
startInput._updateWidthInactive();
|
|
440
|
+
max.new > max.old ? this._onTranslateXChangeBySideEffect(startInput, endInput) : this._onTranslateXChangeBySideEffect(endInput, startInput);
|
|
441
|
+
if (oldEndValue !== endInput.value) {
|
|
442
|
+
this._onValueChange(endInput);
|
|
443
|
+
}
|
|
444
|
+
if (oldStartValue !== startInput.value) {
|
|
445
|
+
this._onValueChange(startInput);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
_updateMaxNonRange(max) {
|
|
449
|
+
const input = this._getInput(_MatThumb.END);
|
|
450
|
+
if (input) {
|
|
451
|
+
const oldValue = input.value;
|
|
452
|
+
input.max = max;
|
|
453
|
+
input._updateThumbUIByValue();
|
|
454
|
+
this._updateTrackUI(input);
|
|
455
|
+
if (oldValue !== input.value) {
|
|
456
|
+
this._onValueChange(input);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
get step() {
|
|
461
|
+
return this._step;
|
|
462
|
+
}
|
|
463
|
+
set step(v) {
|
|
464
|
+
const step = isNaN(v) ? this._step : v;
|
|
465
|
+
if (this._step !== step) {
|
|
466
|
+
this._updateStep(step);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
_step = 1;
|
|
470
|
+
_updateStep(step) {
|
|
471
|
+
this._step = step;
|
|
472
|
+
this._isRange ? this._updateStepRange() : this._updateStepNonRange();
|
|
473
|
+
this._onMinMaxOrStepChange();
|
|
474
|
+
}
|
|
475
|
+
_updateStepRange() {
|
|
476
|
+
const endInput = this._getInput(_MatThumb.END);
|
|
477
|
+
const startInput = this._getInput(_MatThumb.START);
|
|
478
|
+
const oldEndValue = endInput.value;
|
|
479
|
+
const oldStartValue = startInput.value;
|
|
480
|
+
const prevStartValue = startInput.value;
|
|
481
|
+
endInput.min = this._min;
|
|
482
|
+
startInput.max = this._max;
|
|
483
|
+
endInput.step = this._step;
|
|
484
|
+
startInput.step = this._step;
|
|
485
|
+
if (this._platform.SAFARI) {
|
|
486
|
+
endInput.value = endInput.value;
|
|
487
|
+
startInput.value = startInput.value;
|
|
488
|
+
}
|
|
489
|
+
endInput.min = Math.max(this._min, startInput.value);
|
|
490
|
+
startInput.max = Math.min(this._max, endInput.value);
|
|
491
|
+
startInput._updateWidthInactive();
|
|
492
|
+
endInput._updateWidthInactive();
|
|
493
|
+
endInput.value < prevStartValue ? this._onTranslateXChangeBySideEffect(startInput, endInput) : this._onTranslateXChangeBySideEffect(endInput, startInput);
|
|
494
|
+
if (oldEndValue !== endInput.value) {
|
|
495
|
+
this._onValueChange(endInput);
|
|
496
|
+
}
|
|
497
|
+
if (oldStartValue !== startInput.value) {
|
|
498
|
+
this._onValueChange(startInput);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
_updateStepNonRange() {
|
|
502
|
+
const input = this._getInput(_MatThumb.END);
|
|
503
|
+
if (input) {
|
|
504
|
+
const oldValue = input.value;
|
|
505
|
+
input.step = this._step;
|
|
506
|
+
if (this._platform.SAFARI) {
|
|
507
|
+
input.value = input.value;
|
|
508
|
+
}
|
|
509
|
+
input._updateThumbUIByValue();
|
|
510
|
+
if (oldValue !== input.value) {
|
|
511
|
+
this._onValueChange(input);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
displayWith = value => `${value}`;
|
|
516
|
+
_tickMarks;
|
|
517
|
+
_noopAnimations = _animationsDisabled();
|
|
518
|
+
_dirChangeSubscription;
|
|
519
|
+
_resizeObserver;
|
|
520
|
+
_cachedWidth;
|
|
521
|
+
_cachedLeft;
|
|
522
|
+
_rippleRadius = 24;
|
|
523
|
+
startValueIndicatorText = '';
|
|
524
|
+
endValueIndicatorText = '';
|
|
525
|
+
_endThumbTransform;
|
|
526
|
+
_startThumbTransform;
|
|
527
|
+
_isRange = false;
|
|
528
|
+
_isRtl = false;
|
|
529
|
+
_hasViewInitialized = false;
|
|
530
|
+
_tickMarkTrackWidth = 0;
|
|
531
|
+
_hasAnimation = false;
|
|
532
|
+
_resizeTimer = null;
|
|
533
|
+
_platform = inject(Platform);
|
|
534
|
+
constructor() {
|
|
535
|
+
inject(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
|
|
536
|
+
if (this._dir) {
|
|
537
|
+
this._dirChangeSubscription = this._dir.change.subscribe(() => this._onDirChange());
|
|
538
|
+
this._isRtl = this._dir.value === 'rtl';
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
_knobRadius = 8;
|
|
542
|
+
_inputPadding;
|
|
543
|
+
ngAfterViewInit() {
|
|
544
|
+
if (this._platform.isBrowser) {
|
|
545
|
+
this._updateDimensions();
|
|
546
|
+
}
|
|
547
|
+
const eInput = this._getInput(_MatThumb.END);
|
|
548
|
+
const sInput = this._getInput(_MatThumb.START);
|
|
549
|
+
this._isRange = !!eInput && !!sInput;
|
|
550
|
+
this._cdr.detectChanges();
|
|
551
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
552
|
+
_validateInputs(this._isRange, this._getInput(_MatThumb.END), this._getInput(_MatThumb.START));
|
|
553
|
+
}
|
|
554
|
+
const thumb = this._getThumb(_MatThumb.END);
|
|
555
|
+
this._rippleRadius = thumb._ripple.radius;
|
|
556
|
+
this._inputPadding = this._rippleRadius - this._knobRadius;
|
|
557
|
+
this._isRange ? this._initUIRange(eInput, sInput) : this._initUINonRange(eInput);
|
|
558
|
+
this._updateTrackUI(eInput);
|
|
559
|
+
this._updateTickMarkUI();
|
|
560
|
+
this._updateTickMarkTrackUI();
|
|
561
|
+
this._observeHostResize();
|
|
562
|
+
this._cdr.detectChanges();
|
|
563
|
+
}
|
|
564
|
+
_initUINonRange(eInput) {
|
|
565
|
+
eInput.initProps();
|
|
566
|
+
eInput.initUI();
|
|
567
|
+
this._updateValueIndicatorUI(eInput);
|
|
568
|
+
this._hasViewInitialized = true;
|
|
569
|
+
eInput._updateThumbUIByValue();
|
|
570
|
+
}
|
|
571
|
+
_initUIRange(eInput, sInput) {
|
|
572
|
+
eInput.initProps();
|
|
573
|
+
eInput.initUI();
|
|
574
|
+
sInput.initProps();
|
|
575
|
+
sInput.initUI();
|
|
576
|
+
eInput._updateMinMax();
|
|
577
|
+
sInput._updateMinMax();
|
|
578
|
+
eInput._updateStaticStyles();
|
|
579
|
+
sInput._updateStaticStyles();
|
|
580
|
+
this._updateValueIndicatorUIs();
|
|
581
|
+
this._hasViewInitialized = true;
|
|
582
|
+
eInput._updateThumbUIByValue();
|
|
583
|
+
sInput._updateThumbUIByValue();
|
|
584
|
+
}
|
|
585
|
+
ngOnDestroy() {
|
|
586
|
+
this._dirChangeSubscription.unsubscribe();
|
|
587
|
+
this._resizeObserver?.disconnect();
|
|
588
|
+
this._resizeObserver = null;
|
|
589
|
+
}
|
|
590
|
+
_onDirChange() {
|
|
591
|
+
this._isRtl = this._dir?.value === 'rtl';
|
|
592
|
+
this._isRange ? this._onDirChangeRange() : this._onDirChangeNonRange();
|
|
593
|
+
this._updateTickMarkUI();
|
|
594
|
+
}
|
|
595
|
+
_onDirChangeRange() {
|
|
596
|
+
const endInput = this._getInput(_MatThumb.END);
|
|
597
|
+
const startInput = this._getInput(_MatThumb.START);
|
|
598
|
+
endInput._setIsLeftThumb();
|
|
599
|
+
startInput._setIsLeftThumb();
|
|
600
|
+
endInput.translateX = endInput._calcTranslateXByValue();
|
|
601
|
+
startInput.translateX = startInput._calcTranslateXByValue();
|
|
602
|
+
endInput._updateStaticStyles();
|
|
603
|
+
startInput._updateStaticStyles();
|
|
604
|
+
endInput._updateWidthInactive();
|
|
605
|
+
startInput._updateWidthInactive();
|
|
606
|
+
endInput._updateThumbUIByValue();
|
|
607
|
+
startInput._updateThumbUIByValue();
|
|
608
|
+
}
|
|
609
|
+
_onDirChangeNonRange() {
|
|
610
|
+
const input = this._getInput(_MatThumb.END);
|
|
611
|
+
input._updateThumbUIByValue();
|
|
612
|
+
}
|
|
613
|
+
_observeHostResize() {
|
|
614
|
+
if (typeof ResizeObserver === 'undefined' || !ResizeObserver) {
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
this._ngZone.runOutsideAngular(() => {
|
|
618
|
+
this._resizeObserver = new ResizeObserver(() => {
|
|
619
|
+
if (this._isActive()) {
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
if (this._resizeTimer) {
|
|
623
|
+
clearTimeout(this._resizeTimer);
|
|
624
|
+
}
|
|
625
|
+
this._onResize();
|
|
626
|
+
});
|
|
627
|
+
this._resizeObserver.observe(this._elementRef.nativeElement);
|
|
326
628
|
});
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
startInput._updateWidthInactive();
|
|
408
|
-
endInput._updateWidthInactive();
|
|
409
|
-
min.new < min.old
|
|
410
|
-
? this._onTranslateXChangeBySideEffect(endInput, startInput)
|
|
411
|
-
: this._onTranslateXChangeBySideEffect(startInput, endInput);
|
|
412
|
-
if (oldEndValue !== endInput.value) {
|
|
413
|
-
this._onValueChange(endInput);
|
|
414
|
-
}
|
|
415
|
-
if (oldStartValue !== startInput.value) {
|
|
416
|
-
this._onValueChange(startInput);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
_updateMinNonRange(min) {
|
|
420
|
-
const input = this._getInput(_MatThumb.END);
|
|
421
|
-
if (input) {
|
|
422
|
-
const oldValue = input.value;
|
|
423
|
-
input.min = min;
|
|
424
|
-
input._updateThumbUIByValue();
|
|
425
|
-
this._updateTrackUI(input);
|
|
426
|
-
if (oldValue !== input.value) {
|
|
427
|
-
this._onValueChange(input);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
/** The maximum value that the slider can have. */
|
|
432
|
-
get max() {
|
|
433
|
-
return this._max;
|
|
434
|
-
}
|
|
435
|
-
set max(v) {
|
|
436
|
-
const max = v === undefined || v === null || isNaN(v) ? this._max : v;
|
|
437
|
-
if (this._max !== max) {
|
|
438
|
-
this._updateMax(max);
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
_max = 100;
|
|
442
|
-
_updateMax(max) {
|
|
443
|
-
const prevMax = this._max;
|
|
444
|
-
this._max = max;
|
|
445
|
-
this._isRange ? this._updateMaxRange({ old: prevMax, new: max }) : this._updateMaxNonRange(max);
|
|
446
|
-
this._onMinMaxOrStepChange();
|
|
447
|
-
}
|
|
448
|
-
_updateMaxRange(max) {
|
|
449
|
-
const endInput = this._getInput(_MatThumb.END);
|
|
450
|
-
const startInput = this._getInput(_MatThumb.START);
|
|
451
|
-
const oldEndValue = endInput.value;
|
|
452
|
-
const oldStartValue = startInput.value;
|
|
453
|
-
endInput.max = max.new;
|
|
454
|
-
startInput.max = Math.min(max.new, endInput.value);
|
|
455
|
-
endInput.min = startInput.value;
|
|
456
|
-
endInput._updateWidthInactive();
|
|
457
|
-
startInput._updateWidthInactive();
|
|
458
|
-
max.new > max.old
|
|
459
|
-
? this._onTranslateXChangeBySideEffect(startInput, endInput)
|
|
460
|
-
: this._onTranslateXChangeBySideEffect(endInput, startInput);
|
|
461
|
-
if (oldEndValue !== endInput.value) {
|
|
462
|
-
this._onValueChange(endInput);
|
|
463
|
-
}
|
|
464
|
-
if (oldStartValue !== startInput.value) {
|
|
465
|
-
this._onValueChange(startInput);
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
_updateMaxNonRange(max) {
|
|
469
|
-
const input = this._getInput(_MatThumb.END);
|
|
470
|
-
if (input) {
|
|
471
|
-
const oldValue = input.value;
|
|
472
|
-
input.max = max;
|
|
473
|
-
input._updateThumbUIByValue();
|
|
474
|
-
this._updateTrackUI(input);
|
|
475
|
-
if (oldValue !== input.value) {
|
|
476
|
-
this._onValueChange(input);
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
/** The values at which the thumb will snap. */
|
|
481
|
-
get step() {
|
|
482
|
-
return this._step;
|
|
483
|
-
}
|
|
484
|
-
set step(v) {
|
|
485
|
-
const step = isNaN(v) ? this._step : v;
|
|
486
|
-
if (this._step !== step) {
|
|
487
|
-
this._updateStep(step);
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
_step = 1;
|
|
491
|
-
_updateStep(step) {
|
|
492
|
-
this._step = step;
|
|
493
|
-
this._isRange ? this._updateStepRange() : this._updateStepNonRange();
|
|
494
|
-
this._onMinMaxOrStepChange();
|
|
495
|
-
}
|
|
496
|
-
_updateStepRange() {
|
|
497
|
-
const endInput = this._getInput(_MatThumb.END);
|
|
498
|
-
const startInput = this._getInput(_MatThumb.START);
|
|
499
|
-
const oldEndValue = endInput.value;
|
|
500
|
-
const oldStartValue = startInput.value;
|
|
501
|
-
const prevStartValue = startInput.value;
|
|
502
|
-
endInput.min = this._min;
|
|
503
|
-
startInput.max = this._max;
|
|
504
|
-
endInput.step = this._step;
|
|
505
|
-
startInput.step = this._step;
|
|
506
|
-
if (this._platform.SAFARI) {
|
|
507
|
-
endInput.value = endInput.value;
|
|
508
|
-
startInput.value = startInput.value;
|
|
509
|
-
}
|
|
510
|
-
endInput.min = Math.max(this._min, startInput.value);
|
|
511
|
-
startInput.max = Math.min(this._max, endInput.value);
|
|
512
|
-
startInput._updateWidthInactive();
|
|
513
|
-
endInput._updateWidthInactive();
|
|
514
|
-
endInput.value < prevStartValue
|
|
515
|
-
? this._onTranslateXChangeBySideEffect(startInput, endInput)
|
|
516
|
-
: this._onTranslateXChangeBySideEffect(endInput, startInput);
|
|
517
|
-
if (oldEndValue !== endInput.value) {
|
|
518
|
-
this._onValueChange(endInput);
|
|
519
|
-
}
|
|
520
|
-
if (oldStartValue !== startInput.value) {
|
|
521
|
-
this._onValueChange(startInput);
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
_updateStepNonRange() {
|
|
525
|
-
const input = this._getInput(_MatThumb.END);
|
|
526
|
-
if (input) {
|
|
527
|
-
const oldValue = input.value;
|
|
528
|
-
input.step = this._step;
|
|
529
|
-
if (this._platform.SAFARI) {
|
|
530
|
-
input.value = input.value;
|
|
531
|
-
}
|
|
532
|
-
input._updateThumbUIByValue();
|
|
533
|
-
if (oldValue !== input.value) {
|
|
534
|
-
this._onValueChange(input);
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* Function that will be used to format the value before it is displayed
|
|
540
|
-
* in the thumb label. Can be used to format very large number in order
|
|
541
|
-
* for them to fit into the slider thumb.
|
|
542
|
-
*/
|
|
543
|
-
displayWith = (value) => `${value}`;
|
|
544
|
-
/** Used to keep track of & render the active & inactive tick marks on the slider track. */
|
|
545
|
-
_tickMarks;
|
|
546
|
-
/** Whether animations have been disabled. */
|
|
547
|
-
_noopAnimations = _animationsDisabled();
|
|
548
|
-
/** Subscription to changes to the directionality (LTR / RTL) context for the application. */
|
|
549
|
-
_dirChangeSubscription;
|
|
550
|
-
/** Observer used to monitor size changes in the slider. */
|
|
551
|
-
_resizeObserver;
|
|
552
|
-
// Stored dimensions to avoid calling getBoundingClientRect redundantly.
|
|
553
|
-
_cachedWidth;
|
|
554
|
-
_cachedLeft;
|
|
555
|
-
_rippleRadius = 24;
|
|
556
|
-
// The value indicator tooltip text for the visual slider thumb(s).
|
|
557
|
-
/** @docs-private */
|
|
558
|
-
startValueIndicatorText = '';
|
|
559
|
-
/** @docs-private */
|
|
560
|
-
endValueIndicatorText = '';
|
|
561
|
-
// Used to control the translateX of the visual slider thumb(s).
|
|
562
|
-
_endThumbTransform;
|
|
563
|
-
_startThumbTransform;
|
|
564
|
-
_isRange = false;
|
|
565
|
-
/** Whether the slider is rtl. */
|
|
566
|
-
_isRtl = false;
|
|
567
|
-
_hasViewInitialized = false;
|
|
568
|
-
/**
|
|
569
|
-
* The width of the tick mark track.
|
|
570
|
-
* The tick mark track width is different from full track width
|
|
571
|
-
*/
|
|
572
|
-
_tickMarkTrackWidth = 0;
|
|
573
|
-
_hasAnimation = false;
|
|
574
|
-
_resizeTimer = null;
|
|
575
|
-
_platform = inject(Platform);
|
|
576
|
-
constructor() {
|
|
577
|
-
inject(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
|
|
578
|
-
if (this._dir) {
|
|
579
|
-
this._dirChangeSubscription = this._dir.change.subscribe(() => this._onDirChange());
|
|
580
|
-
this._isRtl = this._dir.value === 'rtl';
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
/** The radius of the native slider's knob. AFAIK there is no way to avoid hardcoding this. */
|
|
584
|
-
_knobRadius = 8;
|
|
585
|
-
_inputPadding;
|
|
586
|
-
ngAfterViewInit() {
|
|
587
|
-
if (this._platform.isBrowser) {
|
|
588
|
-
this._updateDimensions();
|
|
589
|
-
}
|
|
590
|
-
const eInput = this._getInput(_MatThumb.END);
|
|
591
|
-
const sInput = this._getInput(_MatThumb.START);
|
|
592
|
-
this._isRange = !!eInput && !!sInput;
|
|
593
|
-
this._cdr.detectChanges();
|
|
594
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
595
|
-
_validateInputs(this._isRange, this._getInput(_MatThumb.END), this._getInput(_MatThumb.START));
|
|
596
|
-
}
|
|
597
|
-
const thumb = this._getThumb(_MatThumb.END);
|
|
598
|
-
this._rippleRadius = thumb._ripple.radius;
|
|
599
|
-
this._inputPadding = this._rippleRadius - this._knobRadius;
|
|
600
|
-
this._isRange
|
|
601
|
-
? this._initUIRange(eInput, sInput)
|
|
602
|
-
: this._initUINonRange(eInput);
|
|
603
|
-
this._updateTrackUI(eInput);
|
|
604
|
-
this._updateTickMarkUI();
|
|
605
|
-
this._updateTickMarkTrackUI();
|
|
606
|
-
this._observeHostResize();
|
|
607
|
-
this._cdr.detectChanges();
|
|
608
|
-
}
|
|
609
|
-
_initUINonRange(eInput) {
|
|
610
|
-
eInput.initProps();
|
|
611
|
-
eInput.initUI();
|
|
612
|
-
this._updateValueIndicatorUI(eInput);
|
|
613
|
-
this._hasViewInitialized = true;
|
|
629
|
+
}
|
|
630
|
+
_isActive() {
|
|
631
|
+
return this._getThumb(_MatThumb.START)._isActive || this._getThumb(_MatThumb.END)._isActive;
|
|
632
|
+
}
|
|
633
|
+
_getValue(thumbPosition = _MatThumb.END) {
|
|
634
|
+
const input = this._getInput(thumbPosition);
|
|
635
|
+
if (!input) {
|
|
636
|
+
return this.min;
|
|
637
|
+
}
|
|
638
|
+
return input.value;
|
|
639
|
+
}
|
|
640
|
+
_skipUpdate() {
|
|
641
|
+
return !!(this._getInput(_MatThumb.START)?._skipUIUpdate || this._getInput(_MatThumb.END)?._skipUIUpdate);
|
|
642
|
+
}
|
|
643
|
+
_updateDimensions() {
|
|
644
|
+
this._cachedWidth = this._elementRef.nativeElement.offsetWidth;
|
|
645
|
+
this._cachedLeft = this._elementRef.nativeElement.getBoundingClientRect().left;
|
|
646
|
+
}
|
|
647
|
+
_setTrackActiveStyles(styles) {
|
|
648
|
+
const trackStyle = this._trackActive.nativeElement.style;
|
|
649
|
+
trackStyle.left = styles.left;
|
|
650
|
+
trackStyle.right = styles.right;
|
|
651
|
+
trackStyle.transformOrigin = styles.transformOrigin;
|
|
652
|
+
trackStyle.transform = styles.transform;
|
|
653
|
+
}
|
|
654
|
+
_calcTickMarkTransform(index) {
|
|
655
|
+
const offset = index * (this._tickMarkTrackWidth / (this._tickMarks.length - 1));
|
|
656
|
+
const translateX = this._isRtl ? this._cachedWidth - 6 - offset : offset;
|
|
657
|
+
return `translateX(${translateX}px`;
|
|
658
|
+
}
|
|
659
|
+
_onTranslateXChange(source) {
|
|
660
|
+
if (!this._hasViewInitialized) {
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
this._updateThumbUI(source);
|
|
664
|
+
this._updateTrackUI(source);
|
|
665
|
+
this._updateOverlappingThumbUI(source);
|
|
666
|
+
}
|
|
667
|
+
_onTranslateXChangeBySideEffect(input1, input2) {
|
|
668
|
+
if (!this._hasViewInitialized) {
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
input1._updateThumbUIByValue();
|
|
672
|
+
input2._updateThumbUIByValue();
|
|
673
|
+
}
|
|
674
|
+
_onValueChange(source) {
|
|
675
|
+
if (!this._hasViewInitialized) {
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
this._updateValueIndicatorUI(source);
|
|
679
|
+
this._updateTickMarkUI();
|
|
680
|
+
this._cdr.detectChanges();
|
|
681
|
+
}
|
|
682
|
+
_onMinMaxOrStepChange() {
|
|
683
|
+
if (!this._hasViewInitialized) {
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
this._updateTickMarkUI();
|
|
687
|
+
this._updateTickMarkTrackUI();
|
|
688
|
+
this._cdr.markForCheck();
|
|
689
|
+
}
|
|
690
|
+
_onResize() {
|
|
691
|
+
if (!this._hasViewInitialized) {
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
this._updateDimensions();
|
|
695
|
+
if (this._isRange) {
|
|
696
|
+
const eInput = this._getInput(_MatThumb.END);
|
|
697
|
+
const sInput = this._getInput(_MatThumb.START);
|
|
698
|
+
eInput._updateThumbUIByValue();
|
|
699
|
+
sInput._updateThumbUIByValue();
|
|
700
|
+
eInput._updateStaticStyles();
|
|
701
|
+
sInput._updateStaticStyles();
|
|
702
|
+
eInput._updateMinMax();
|
|
703
|
+
sInput._updateMinMax();
|
|
704
|
+
eInput._updateWidthInactive();
|
|
705
|
+
sInput._updateWidthInactive();
|
|
706
|
+
} else {
|
|
707
|
+
const eInput = this._getInput(_MatThumb.END);
|
|
708
|
+
if (eInput) {
|
|
614
709
|
eInput._updateThumbUIByValue();
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
const eInput = this._getInput(_MatThumb.END);
|
|
844
|
-
const sInput = this._getInput(_MatThumb.START);
|
|
845
|
-
if (eInput) {
|
|
846
|
-
this._updateValueIndicatorUI(eInput);
|
|
847
|
-
}
|
|
848
|
-
if (sInput) {
|
|
849
|
-
this._updateValueIndicatorUI(sInput);
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
// Update Tick Mark Track Width
|
|
853
|
-
//
|
|
854
|
-
// 1. Min, max, or step
|
|
855
|
-
// - Reason: The maximum reachable value may have changed.
|
|
856
|
-
// - Side note: The maximum reachable value is different from the maximum value set by the
|
|
857
|
-
// user. For example, a slider with [min: 5, max: 100, step: 10] would have a maximum
|
|
858
|
-
// reachable value of 95.
|
|
859
|
-
// 2. Resize
|
|
860
|
-
// - Reason: The position for the maximum reachable value needs to be recalculated.
|
|
861
|
-
/** Updates the width of the tick mark track. */
|
|
862
|
-
_updateTickMarkTrackUI() {
|
|
863
|
-
if (!this.showTickMarks || this._skipUpdate()) {
|
|
864
|
-
return;
|
|
865
|
-
}
|
|
866
|
-
const step = this._step && this._step > 0 ? this._step : 1;
|
|
867
|
-
const maxValue = Math.floor(this.max / step) * step;
|
|
868
|
-
const percentage = (maxValue - this.min) / (this.max - this.min);
|
|
869
|
-
this._tickMarkTrackWidth = (this._cachedWidth - 6) * percentage;
|
|
870
|
-
}
|
|
871
|
-
// Track active update conditions
|
|
872
|
-
//
|
|
873
|
-
// 1. TranslateX
|
|
874
|
-
// - Reason: The track active should line up with the new thumb position.
|
|
875
|
-
// 2. Min or max
|
|
876
|
-
// - Reason #1: The 'active' percentage needs to be recalculated.
|
|
877
|
-
// - Reason #2: The value may have silently changed.
|
|
878
|
-
// 3. Step
|
|
879
|
-
// - Reason: The value may have silently changed causing the thumb(s) to shift.
|
|
880
|
-
// 4. Dir change
|
|
881
|
-
// - Reason: The track active will need to be updated according to the new thumb position(s).
|
|
882
|
-
// 5. Resize
|
|
883
|
-
// - Reason: The total width the 'active' tracks translateX is based on has changed.
|
|
884
|
-
/** Updates the scale on the active portion of the track. */
|
|
885
|
-
_updateTrackUI(source) {
|
|
886
|
-
if (this._skipUpdate()) {
|
|
887
|
-
return;
|
|
888
|
-
}
|
|
889
|
-
this._isRange
|
|
890
|
-
? this._updateTrackUIRange(source)
|
|
891
|
-
: this._updateTrackUINonRange(source);
|
|
892
|
-
}
|
|
893
|
-
_updateTrackUIRange(source) {
|
|
894
|
-
const sibling = source.getSibling();
|
|
895
|
-
if (!sibling || !this._cachedWidth) {
|
|
896
|
-
return;
|
|
897
|
-
}
|
|
898
|
-
const activePercentage = Math.abs(sibling.translateX - source.translateX) / this._cachedWidth;
|
|
899
|
-
if (source._isLeftThumb && this._cachedWidth) {
|
|
900
|
-
this._setTrackActiveStyles({
|
|
901
|
-
left: 'auto',
|
|
902
|
-
right: `${this._cachedWidth - sibling.translateX}px`,
|
|
903
|
-
transformOrigin: 'right',
|
|
904
|
-
transform: `scaleX(${activePercentage})`,
|
|
905
|
-
});
|
|
906
|
-
}
|
|
907
|
-
else {
|
|
908
|
-
this._setTrackActiveStyles({
|
|
909
|
-
left: `${sibling.translateX}px`,
|
|
910
|
-
right: 'auto',
|
|
911
|
-
transformOrigin: 'left',
|
|
912
|
-
transform: `scaleX(${activePercentage})`,
|
|
913
|
-
});
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
_updateTrackUINonRange(source) {
|
|
917
|
-
this._isRtl
|
|
918
|
-
? this._setTrackActiveStyles({
|
|
919
|
-
left: 'auto',
|
|
920
|
-
right: '0px',
|
|
921
|
-
transformOrigin: 'right',
|
|
922
|
-
transform: `scaleX(${1 - source.fillPercentage})`,
|
|
923
|
-
})
|
|
924
|
-
: this._setTrackActiveStyles({
|
|
925
|
-
left: '0px',
|
|
926
|
-
right: 'auto',
|
|
927
|
-
transformOrigin: 'left',
|
|
928
|
-
transform: `scaleX(${source.fillPercentage})`,
|
|
929
|
-
});
|
|
930
|
-
}
|
|
931
|
-
// Tick mark update conditions
|
|
932
|
-
//
|
|
933
|
-
// 1. Value
|
|
934
|
-
// - Reason: a tick mark which was once active might now be inactive or vice versa.
|
|
935
|
-
// 2. Min, max, or step
|
|
936
|
-
// - Reason #1: the number of tick marks may have changed.
|
|
937
|
-
// - Reason #2: The value may have silently changed.
|
|
938
|
-
/** Updates the dots along the slider track. */
|
|
939
|
-
_updateTickMarkUI() {
|
|
940
|
-
if (!this.showTickMarks ||
|
|
941
|
-
this.step === undefined ||
|
|
942
|
-
this.min === undefined ||
|
|
943
|
-
this.max === undefined) {
|
|
944
|
-
return;
|
|
945
|
-
}
|
|
946
|
-
const step = this.step > 0 ? this.step : 1;
|
|
947
|
-
this._isRange ? this._updateTickMarkUIRange(step) : this._updateTickMarkUINonRange(step);
|
|
948
|
-
}
|
|
949
|
-
_updateTickMarkUINonRange(step) {
|
|
950
|
-
const value = this._getValue();
|
|
951
|
-
let numActive = Math.max(Math.round((value - this.min) / step), 0) + 1;
|
|
952
|
-
let numInactive = Math.max(Math.round((this.max - value) / step), 0) - 1;
|
|
953
|
-
this._isRtl ? numActive++ : numInactive++;
|
|
954
|
-
this._tickMarks = Array(numActive)
|
|
955
|
-
.fill(_MatTickMark.ACTIVE)
|
|
956
|
-
.concat(Array(numInactive).fill(_MatTickMark.INACTIVE));
|
|
957
|
-
}
|
|
958
|
-
_updateTickMarkUIRange(step) {
|
|
959
|
-
const endValue = this._getValue();
|
|
960
|
-
const startValue = this._getValue(_MatThumb.START);
|
|
961
|
-
const numInactiveBeforeStartThumb = Math.max(Math.round((startValue - this.min) / step), 0);
|
|
962
|
-
const numActive = Math.max(Math.round((endValue - startValue) / step) + 1, 0);
|
|
963
|
-
const numInactiveAfterEndThumb = Math.max(Math.round((this.max - endValue) / step), 0);
|
|
964
|
-
this._tickMarks = Array(numInactiveBeforeStartThumb)
|
|
965
|
-
.fill(_MatTickMark.INACTIVE)
|
|
966
|
-
.concat(Array(numActive).fill(_MatTickMark.ACTIVE), Array(numInactiveAfterEndThumb).fill(_MatTickMark.INACTIVE));
|
|
967
|
-
}
|
|
968
|
-
/** Gets the slider thumb input of the given thumb position. */
|
|
969
|
-
_getInput(thumbPosition) {
|
|
970
|
-
if (thumbPosition === _MatThumb.END && this._input) {
|
|
971
|
-
return this._input;
|
|
972
|
-
}
|
|
973
|
-
if (this._inputs?.length) {
|
|
974
|
-
return thumbPosition === _MatThumb.START ? this._inputs.first : this._inputs.last;
|
|
975
|
-
}
|
|
976
|
-
return;
|
|
977
|
-
}
|
|
978
|
-
/** Gets the slider thumb HTML input element of the given thumb position. */
|
|
979
|
-
_getThumb(thumbPosition) {
|
|
980
|
-
return thumbPosition === _MatThumb.END ? this._thumbs?.last : this._thumbs?.first;
|
|
981
|
-
}
|
|
982
|
-
_setTransition(withAnimation) {
|
|
983
|
-
this._hasAnimation = !this._platform.IOS && withAnimation && !this._noopAnimations;
|
|
984
|
-
this._elementRef.nativeElement.classList.toggle('mat-mdc-slider-with-animation', this._hasAnimation);
|
|
985
|
-
}
|
|
986
|
-
/** Whether the given pointer event occurred within the bounds of the slider pointer's DOM Rect. */
|
|
987
|
-
_isCursorOnSliderThumb(event, rect) {
|
|
988
|
-
const radius = rect.width / 2;
|
|
989
|
-
const centerX = rect.x + radius;
|
|
990
|
-
const centerY = rect.y + radius;
|
|
991
|
-
const dx = event.clientX - centerX;
|
|
992
|
-
const dy = event.clientY - centerY;
|
|
993
|
-
return Math.pow(dx, 2) + Math.pow(dy, 2) < Math.pow(radius, 2);
|
|
994
|
-
}
|
|
995
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatSlider, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
996
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.0-next.2", type: MatSlider, isStandalone: true, selector: "mat-slider", inputs: { disabled: ["disabled", "disabled", booleanAttribute], discrete: ["discrete", "discrete", booleanAttribute], showTickMarks: ["showTickMarks", "showTickMarks", booleanAttribute], min: ["min", "min", numberAttribute], color: "color", disableRipple: ["disableRipple", "disableRipple", booleanAttribute], max: ["max", "max", numberAttribute], step: ["step", "step", numberAttribute], displayWith: "displayWith" }, host: { properties: { "class": "\"mat-\" + (color || \"primary\")", "class.mdc-slider--range": "_isRange", "class.mdc-slider--disabled": "disabled", "class.mdc-slider--discrete": "discrete", "class.mdc-slider--tick-marks": "showTickMarks", "class._mat-animation-noopable": "_noopAnimations" }, classAttribute: "mat-mdc-slider mdc-slider" }, providers: [{ provide: MAT_SLIDER, useExisting: MatSlider }], queries: [{ propertyName: "_input", first: true, predicate: MAT_SLIDER_THUMB, descendants: true }, { propertyName: "_inputs", predicate: MAT_SLIDER_RANGE_THUMB }], viewQueries: [{ propertyName: "_trackActive", first: true, predicate: ["trackActive"], descendants: true }, { propertyName: "_thumbs", predicate: MAT_SLIDER_VISUAL_THUMB, descendants: true }], exportAs: ["matSlider"], ngImport: i0, template: "<!-- Inputs -->\n<ng-content></ng-content>\n\n<!-- Track -->\n<div class=\"mdc-slider__track\">\n <div class=\"mdc-slider__track--inactive\"></div>\n <div class=\"mdc-slider__track--active\">\n <div #trackActive class=\"mdc-slider__track--active_fill\"></div>\n </div>\n @if (showTickMarks) {\n <div class=\"mdc-slider__tick-marks\" #tickMarkContainer>\n @if (_cachedWidth) {\n @for (tickMark of _tickMarks; track i; let i = $index) {\n <div\n [class]=\"tickMark === 0 ? 'mdc-slider__tick-mark--active' : 'mdc-slider__tick-mark--inactive'\"\n [style.transform]=\"_calcTickMarkTransform(i)\"></div>\n }\n }\n </div>\n }\n</div>\n\n<!-- Thumbs -->\n@if (_isRange) {\n <mat-slider-visual-thumb\n [discrete]=\"discrete\"\n [thumbPosition]=\"1\"\n [valueIndicatorText]=\"startValueIndicatorText\">\n </mat-slider-visual-thumb>\n}\n\n<mat-slider-visual-thumb\n [discrete]=\"discrete\"\n [thumbPosition]=\"2\"\n [valueIndicatorText]=\"endValueIndicatorText\">\n</mat-slider-visual-thumb>\n", styles: [".mdc-slider__track{position:absolute;top:50%;transform:translateY(-50%);width:100%;pointer-events:none;height:var(--mat-slider-inactive-track-height, 4px)}.mdc-slider__track--active,.mdc-slider__track--inactive{display:flex;height:100%;position:absolute;width:100%}.mdc-slider__track--active{overflow:hidden;border-radius:var(--mat-slider-active-track-shape, var(--mat-sys-corner-full));height:var(--mat-slider-active-track-height, 4px);top:calc((var(--mat-slider-inactive-track-height, 4px) - var(--mat-slider-active-track-height, 4px))/2)}.mdc-slider__track--active_fill{border-top-style:solid;box-sizing:border-box;height:100%;width:100%;position:relative;transform-origin:left;transition:transform 80ms ease;border-color:var(--mat-slider-active-track-color, var(--mat-sys-primary));border-top-width:var(--mat-slider-active-track-height, 4px)}.mdc-slider--disabled .mdc-slider__track--active_fill{border-color:var(--mat-slider-disabled-active-track-color, var(--mat-sys-on-surface))}[dir=rtl] .mdc-slider__track--active_fill{-webkit-transform-origin:right;transform-origin:right}.mdc-slider__track--inactive{left:0;top:0;opacity:.24;background-color:var(--mat-slider-inactive-track-color, var(--mat-sys-surface-variant));height:var(--mat-slider-inactive-track-height, 4px);border-radius:var(--mat-slider-inactive-track-shape, var(--mat-sys-corner-full))}.mdc-slider--disabled .mdc-slider__track--inactive{background-color:var(--mat-slider-disabled-inactive-track-color, var(--mat-sys-on-surface));opacity:.24}.mdc-slider__track--inactive::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:1px solid rgba(0,0,0,0);border-radius:inherit;content:\"\";pointer-events:none}@media(forced-colors: active){.mdc-slider__track--inactive::before{border-color:CanvasText}}.mdc-slider__value-indicator-container{bottom:44px;left:50%;pointer-events:none;position:absolute;transform:var(--mat-slider-value-indicator-container-transform, translateX(-50%) rotate(-45deg))}.mdc-slider__thumb--with-indicator .mdc-slider__value-indicator-container{pointer-events:auto}.mdc-slider__value-indicator{display:flex;align-items:center;transform:scale(0);transform-origin:var(--mat-slider-value-indicator-transform-origin, 0 28px);transition:transform 100ms cubic-bezier(0.4, 0, 1, 1);word-break:normal;background-color:var(--mat-slider-label-container-color, var(--mat-sys-primary));color:var(--mat-slider-label-label-text-color, var(--mat-sys-on-primary));width:var(--mat-slider-value-indicator-width, 28px);height:var(--mat-slider-value-indicator-height, 28px);padding:var(--mat-slider-value-indicator-padding, 0);opacity:var(--mat-slider-value-indicator-opacity, 1);border-radius:var(--mat-slider-value-indicator-border-radius, 50% 50% 50% 0)}.mdc-slider__thumb--with-indicator .mdc-slider__value-indicator{transition:transform 100ms cubic-bezier(0, 0, 0.2, 1);transform:scale(1)}.mdc-slider__value-indicator::before{border-left:6px solid rgba(0,0,0,0);border-right:6px solid rgba(0,0,0,0);border-top:6px solid;bottom:-5px;content:\"\";height:0;left:50%;position:absolute;transform:translateX(-50%);width:0;display:var(--mat-slider-value-indicator-caret-display, none);border-top-color:var(--mat-slider-label-container-color, var(--mat-sys-primary))}.mdc-slider__value-indicator::after{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:1px solid rgba(0,0,0,0);border-radius:inherit;content:\"\";pointer-events:none}@media(forced-colors: active){.mdc-slider__value-indicator::after{border-color:CanvasText}}.mdc-slider__value-indicator-text{text-align:center;width:var(--mat-slider-value-indicator-width, 28px);transform:var(--mat-slider-value-indicator-text-transform, rotate(45deg));font-family:var(--mat-slider-label-label-text-font, var(--mat-sys-label-medium-font));font-size:var(--mat-slider-label-label-text-size, var(--mat-sys-label-medium-size));font-weight:var(--mat-slider-label-label-text-weight, var(--mat-sys-label-medium-weight));line-height:var(--mat-slider-label-label-text-line-height, var(--mat-sys-label-medium-line-height));letter-spacing:var(--mat-slider-label-label-text-tracking, var(--mat-sys-label-medium-tracking))}.mdc-slider__thumb{-webkit-user-select:none;user-select:none;display:flex;left:-24px;outline:none;position:absolute;height:48px;width:48px;pointer-events:none}.mdc-slider--discrete .mdc-slider__thumb{transition:transform 80ms ease}.mdc-slider--disabled .mdc-slider__thumb{pointer-events:none}.mdc-slider__thumb--top{z-index:1}.mdc-slider__thumb-knob{position:absolute;box-sizing:border-box;left:50%;top:50%;transform:translate(-50%, -50%);border-style:solid;width:var(--mat-slider-handle-width, 20px);height:var(--mat-slider-handle-height, 20px);border-width:calc(var(--mat-slider-handle-height, 20px)/2) calc(var(--mat-slider-handle-width, 20px)/2);box-shadow:var(--mat-slider-handle-elevation, var(--mat-sys-level1));background-color:var(--mat-slider-handle-color, var(--mat-sys-primary));border-color:var(--mat-slider-handle-color, var(--mat-sys-primary));border-radius:var(--mat-slider-handle-shape, var(--mat-sys-corner-full))}.mdc-slider__thumb:hover .mdc-slider__thumb-knob{background-color:var(--mat-slider-hover-handle-color, var(--mat-sys-primary));border-color:var(--mat-slider-hover-handle-color, var(--mat-sys-primary))}.mdc-slider__thumb--focused .mdc-slider__thumb-knob{background-color:var(--mat-slider-focus-handle-color, var(--mat-sys-primary));border-color:var(--mat-slider-focus-handle-color, var(--mat-sys-primary))}.mdc-slider--disabled .mdc-slider__thumb-knob{background-color:var(--mat-slider-disabled-handle-color, var(--mat-sys-on-surface));border-color:var(--mat-slider-disabled-handle-color, var(--mat-sys-on-surface))}.mdc-slider__thumb--top .mdc-slider__thumb-knob,.mdc-slider__thumb--top.mdc-slider__thumb:hover .mdc-slider__thumb-knob,.mdc-slider__thumb--top.mdc-slider__thumb--focused .mdc-slider__thumb-knob{border:solid 1px #fff;box-sizing:content-box;border-color:var(--mat-slider-with-overlap-handle-outline-color, var(--mat-sys-on-primary));border-width:var(--mat-slider-with-overlap-handle-outline-width, 1px)}.mdc-slider__tick-marks{align-items:center;box-sizing:border-box;display:flex;height:100%;justify-content:space-between;padding:0 1px;position:absolute;width:100%}.mdc-slider__tick-mark--active,.mdc-slider__tick-mark--inactive{width:var(--mat-slider-with-tick-marks-container-size, 2px);height:var(--mat-slider-with-tick-marks-container-size, 2px);border-radius:var(--mat-slider-with-tick-marks-container-shape, var(--mat-sys-corner-full))}.mdc-slider__tick-mark--inactive{opacity:var(--mat-slider-with-tick-marks-inactive-container-opacity, 0.38);background-color:var(--mat-slider-with-tick-marks-inactive-container-color, var(--mat-sys-on-surface-variant))}.mdc-slider--disabled .mdc-slider__tick-mark--inactive{opacity:var(--mat-slider-with-tick-marks-inactive-container-opacity, 0.38);background-color:var(--mat-slider-with-tick-marks-disabled-container-color, var(--mat-sys-on-surface))}.mdc-slider__tick-mark--active{opacity:var(--mat-slider-with-tick-marks-active-container-opacity, 0.38);background-color:var(--mat-slider-with-tick-marks-active-container-color, var(--mat-sys-on-primary))}.mdc-slider__input{cursor:pointer;left:2px;margin:0;height:44px;opacity:0;position:absolute;top:2px;width:44px;box-sizing:content-box}.mdc-slider__input.mat-mdc-slider-input-no-pointer-events{pointer-events:none}.mdc-slider__input.mat-slider__right-input{left:auto;right:0}.mat-mdc-slider{display:inline-block;box-sizing:border-box;outline:none;vertical-align:middle;cursor:pointer;height:48px;margin:0 8px;position:relative;touch-action:pan-y;width:auto;min-width:112px;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-slider.mdc-slider--disabled{cursor:auto;opacity:.38}.mat-mdc-slider.mdc-slider--disabled .mdc-slider__input{cursor:auto}.mat-mdc-slider .mdc-slider__thumb,.mat-mdc-slider .mdc-slider__track--active_fill{transition-duration:0ms}.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__thumb,.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__track--active_fill{transition-duration:80ms}.mat-mdc-slider.mdc-slider--discrete .mdc-slider__thumb,.mat-mdc-slider.mdc-slider--discrete .mdc-slider__track--active_fill{transition-duration:0ms}.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__thumb,.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__track--active_fill{transition-duration:80ms}.mat-mdc-slider .mat-ripple .mat-ripple-element{background-color:var(--mat-slider-ripple-color, var(--mat-sys-primary))}.mat-mdc-slider .mat-ripple .mat-mdc-slider-hover-ripple{background-color:var(--mat-slider-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-primary) 5%, transparent))}.mat-mdc-slider .mat-ripple .mat-mdc-slider-focus-ripple,.mat-mdc-slider .mat-ripple .mat-mdc-slider-active-ripple{background-color:var(--mat-slider-focus-state-layer-color, color-mix(in srgb, var(--mat-sys-primary) 20%, transparent))}.mat-mdc-slider._mat-animation-noopable.mdc-slider--discrete .mdc-slider__thumb,.mat-mdc-slider._mat-animation-noopable.mdc-slider--discrete .mdc-slider__track--active_fill,.mat-mdc-slider._mat-animation-noopable .mdc-slider__value-indicator{transition:none}.mat-mdc-slider .mat-focus-indicator::before{border-radius:50%}.mdc-slider__thumb--focused .mat-focus-indicator::before{content:\"\"}\n"], dependencies: [{ kind: "component", type: MatSliderVisualThumb, selector: "mat-slider-visual-thumb", inputs: ["discrete", "thumbPosition", "valueIndicatorText"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
this._updateTickMarkUI();
|
|
713
|
+
this._updateTickMarkTrackUI();
|
|
714
|
+
this._cdr.detectChanges();
|
|
715
|
+
}
|
|
716
|
+
_thumbsOverlap = false;
|
|
717
|
+
_areThumbsOverlapping() {
|
|
718
|
+
const startInput = this._getInput(_MatThumb.START);
|
|
719
|
+
const endInput = this._getInput(_MatThumb.END);
|
|
720
|
+
if (!startInput || !endInput) {
|
|
721
|
+
return false;
|
|
722
|
+
}
|
|
723
|
+
return endInput.translateX - startInput.translateX < 20;
|
|
724
|
+
}
|
|
725
|
+
_updateOverlappingThumbClassNames(source) {
|
|
726
|
+
const sibling = source.getSibling();
|
|
727
|
+
const sourceThumb = this._getThumb(source.thumbPosition);
|
|
728
|
+
const siblingThumb = this._getThumb(sibling.thumbPosition);
|
|
729
|
+
siblingThumb._hostElement.classList.remove('mdc-slider__thumb--top');
|
|
730
|
+
sourceThumb._hostElement.classList.toggle('mdc-slider__thumb--top', this._thumbsOverlap);
|
|
731
|
+
}
|
|
732
|
+
_updateOverlappingThumbUI(source) {
|
|
733
|
+
if (!this._isRange || this._skipUpdate()) {
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
if (this._thumbsOverlap !== this._areThumbsOverlapping()) {
|
|
737
|
+
this._thumbsOverlap = !this._thumbsOverlap;
|
|
738
|
+
this._updateOverlappingThumbClassNames(source);
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
_updateThumbUI(source) {
|
|
742
|
+
if (this._skipUpdate()) {
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
const thumb = this._getThumb(source.thumbPosition === _MatThumb.END ? _MatThumb.END : _MatThumb.START);
|
|
746
|
+
thumb._hostElement.style.transform = `translateX(${source.translateX}px)`;
|
|
747
|
+
}
|
|
748
|
+
_updateValueIndicatorUI(source) {
|
|
749
|
+
if (this._skipUpdate()) {
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
const valuetext = this.displayWith(source.value);
|
|
753
|
+
this._hasViewInitialized ? source._valuetext.set(valuetext) : source._hostElement.setAttribute('aria-valuetext', valuetext);
|
|
754
|
+
if (this.discrete) {
|
|
755
|
+
source.thumbPosition === _MatThumb.START ? this.startValueIndicatorText = valuetext : this.endValueIndicatorText = valuetext;
|
|
756
|
+
const visualThumb = this._getThumb(source.thumbPosition);
|
|
757
|
+
valuetext.length < 3 ? visualThumb._hostElement.classList.add('mdc-slider__thumb--short-value') : visualThumb._hostElement.classList.remove('mdc-slider__thumb--short-value');
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
_updateValueIndicatorUIs() {
|
|
761
|
+
const eInput = this._getInput(_MatThumb.END);
|
|
762
|
+
const sInput = this._getInput(_MatThumb.START);
|
|
763
|
+
if (eInput) {
|
|
764
|
+
this._updateValueIndicatorUI(eInput);
|
|
765
|
+
}
|
|
766
|
+
if (sInput) {
|
|
767
|
+
this._updateValueIndicatorUI(sInput);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
_updateTickMarkTrackUI() {
|
|
771
|
+
if (!this.showTickMarks || this._skipUpdate()) {
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
const step = this._step && this._step > 0 ? this._step : 1;
|
|
775
|
+
const maxValue = Math.floor(this.max / step) * step;
|
|
776
|
+
const percentage = (maxValue - this.min) / (this.max - this.min);
|
|
777
|
+
this._tickMarkTrackWidth = (this._cachedWidth - 6) * percentage;
|
|
778
|
+
}
|
|
779
|
+
_updateTrackUI(source) {
|
|
780
|
+
if (this._skipUpdate()) {
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
this._isRange ? this._updateTrackUIRange(source) : this._updateTrackUINonRange(source);
|
|
784
|
+
}
|
|
785
|
+
_updateTrackUIRange(source) {
|
|
786
|
+
const sibling = source.getSibling();
|
|
787
|
+
if (!sibling || !this._cachedWidth) {
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
const activePercentage = Math.abs(sibling.translateX - source.translateX) / this._cachedWidth;
|
|
791
|
+
if (source._isLeftThumb && this._cachedWidth) {
|
|
792
|
+
this._setTrackActiveStyles({
|
|
793
|
+
left: 'auto',
|
|
794
|
+
right: `${this._cachedWidth - sibling.translateX}px`,
|
|
795
|
+
transformOrigin: 'right',
|
|
796
|
+
transform: `scaleX(${activePercentage})`
|
|
797
|
+
});
|
|
798
|
+
} else {
|
|
799
|
+
this._setTrackActiveStyles({
|
|
800
|
+
left: `${sibling.translateX}px`,
|
|
801
|
+
right: 'auto',
|
|
802
|
+
transformOrigin: 'left',
|
|
803
|
+
transform: `scaleX(${activePercentage})`
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
_updateTrackUINonRange(source) {
|
|
808
|
+
this._isRtl ? this._setTrackActiveStyles({
|
|
809
|
+
left: 'auto',
|
|
810
|
+
right: '0px',
|
|
811
|
+
transformOrigin: 'right',
|
|
812
|
+
transform: `scaleX(${1 - source.fillPercentage})`
|
|
813
|
+
}) : this._setTrackActiveStyles({
|
|
814
|
+
left: '0px',
|
|
815
|
+
right: 'auto',
|
|
816
|
+
transformOrigin: 'left',
|
|
817
|
+
transform: `scaleX(${source.fillPercentage})`
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
_updateTickMarkUI() {
|
|
821
|
+
if (!this.showTickMarks || this.step === undefined || this.min === undefined || this.max === undefined) {
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
824
|
+
const step = this.step > 0 ? this.step : 1;
|
|
825
|
+
this._isRange ? this._updateTickMarkUIRange(step) : this._updateTickMarkUINonRange(step);
|
|
826
|
+
}
|
|
827
|
+
_updateTickMarkUINonRange(step) {
|
|
828
|
+
const value = this._getValue();
|
|
829
|
+
let numActive = Math.max(Math.round((value - this.min) / step), 0) + 1;
|
|
830
|
+
let numInactive = Math.max(Math.round((this.max - value) / step), 0) - 1;
|
|
831
|
+
this._isRtl ? numActive++ : numInactive++;
|
|
832
|
+
this._tickMarks = Array(numActive).fill(_MatTickMark.ACTIVE).concat(Array(numInactive).fill(_MatTickMark.INACTIVE));
|
|
833
|
+
}
|
|
834
|
+
_updateTickMarkUIRange(step) {
|
|
835
|
+
const endValue = this._getValue();
|
|
836
|
+
const startValue = this._getValue(_MatThumb.START);
|
|
837
|
+
const numInactiveBeforeStartThumb = Math.max(Math.round((startValue - this.min) / step), 0);
|
|
838
|
+
const numActive = Math.max(Math.round((endValue - startValue) / step) + 1, 0);
|
|
839
|
+
const numInactiveAfterEndThumb = Math.max(Math.round((this.max - endValue) / step), 0);
|
|
840
|
+
this._tickMarks = Array(numInactiveBeforeStartThumb).fill(_MatTickMark.INACTIVE).concat(Array(numActive).fill(_MatTickMark.ACTIVE), Array(numInactiveAfterEndThumb).fill(_MatTickMark.INACTIVE));
|
|
841
|
+
}
|
|
842
|
+
_getInput(thumbPosition) {
|
|
843
|
+
if (thumbPosition === _MatThumb.END && this._input) {
|
|
844
|
+
return this._input;
|
|
845
|
+
}
|
|
846
|
+
if (this._inputs?.length) {
|
|
847
|
+
return thumbPosition === _MatThumb.START ? this._inputs.first : this._inputs.last;
|
|
848
|
+
}
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
_getThumb(thumbPosition) {
|
|
852
|
+
return thumbPosition === _MatThumb.END ? this._thumbs?.last : this._thumbs?.first;
|
|
853
|
+
}
|
|
854
|
+
_setTransition(withAnimation) {
|
|
855
|
+
this._hasAnimation = !this._platform.IOS && withAnimation && !this._noopAnimations;
|
|
856
|
+
this._elementRef.nativeElement.classList.toggle('mat-mdc-slider-with-animation', this._hasAnimation);
|
|
857
|
+
}
|
|
858
|
+
_isCursorOnSliderThumb(event, rect) {
|
|
859
|
+
const radius = rect.width / 2;
|
|
860
|
+
const centerX = rect.x + radius;
|
|
861
|
+
const centerY = rect.y + radius;
|
|
862
|
+
const dx = event.clientX - centerX;
|
|
863
|
+
const dy = event.clientY - centerY;
|
|
864
|
+
return Math.pow(dx, 2) + Math.pow(dy, 2) < Math.pow(radius, 2);
|
|
865
|
+
}
|
|
866
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
867
|
+
minVersion: "12.0.0",
|
|
868
|
+
version: "20.2.0-next.2",
|
|
869
|
+
ngImport: i0,
|
|
870
|
+
type: MatSlider,
|
|
871
|
+
deps: [],
|
|
872
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
873
|
+
});
|
|
874
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
875
|
+
minVersion: "17.0.0",
|
|
876
|
+
version: "20.2.0-next.2",
|
|
877
|
+
type: MatSlider,
|
|
878
|
+
isStandalone: true,
|
|
879
|
+
selector: "mat-slider",
|
|
880
|
+
inputs: {
|
|
881
|
+
disabled: ["disabled", "disabled", booleanAttribute],
|
|
882
|
+
discrete: ["discrete", "discrete", booleanAttribute],
|
|
883
|
+
showTickMarks: ["showTickMarks", "showTickMarks", booleanAttribute],
|
|
884
|
+
min: ["min", "min", numberAttribute],
|
|
885
|
+
color: "color",
|
|
886
|
+
disableRipple: ["disableRipple", "disableRipple", booleanAttribute],
|
|
887
|
+
max: ["max", "max", numberAttribute],
|
|
888
|
+
step: ["step", "step", numberAttribute],
|
|
889
|
+
displayWith: "displayWith"
|
|
890
|
+
},
|
|
891
|
+
host: {
|
|
892
|
+
properties: {
|
|
893
|
+
"class": "\"mat-\" + (color || \"primary\")",
|
|
894
|
+
"class.mdc-slider--range": "_isRange",
|
|
895
|
+
"class.mdc-slider--disabled": "disabled",
|
|
896
|
+
"class.mdc-slider--discrete": "discrete",
|
|
897
|
+
"class.mdc-slider--tick-marks": "showTickMarks",
|
|
898
|
+
"class._mat-animation-noopable": "_noopAnimations"
|
|
899
|
+
},
|
|
900
|
+
classAttribute: "mat-mdc-slider mdc-slider"
|
|
901
|
+
},
|
|
902
|
+
providers: [{
|
|
903
|
+
provide: MAT_SLIDER,
|
|
904
|
+
useExisting: MatSlider
|
|
905
|
+
}],
|
|
906
|
+
queries: [{
|
|
907
|
+
propertyName: "_input",
|
|
908
|
+
first: true,
|
|
909
|
+
predicate: MAT_SLIDER_THUMB,
|
|
910
|
+
descendants: true
|
|
911
|
+
}, {
|
|
912
|
+
propertyName: "_inputs",
|
|
913
|
+
predicate: MAT_SLIDER_RANGE_THUMB
|
|
914
|
+
}],
|
|
915
|
+
viewQueries: [{
|
|
916
|
+
propertyName: "_trackActive",
|
|
917
|
+
first: true,
|
|
918
|
+
predicate: ["trackActive"],
|
|
919
|
+
descendants: true
|
|
920
|
+
}, {
|
|
921
|
+
propertyName: "_thumbs",
|
|
922
|
+
predicate: MAT_SLIDER_VISUAL_THUMB,
|
|
923
|
+
descendants: true
|
|
924
|
+
}],
|
|
925
|
+
exportAs: ["matSlider"],
|
|
926
|
+
ngImport: i0,
|
|
927
|
+
template: "<!-- Inputs -->\n<ng-content></ng-content>\n\n<!-- Track -->\n<div class=\"mdc-slider__track\">\n <div class=\"mdc-slider__track--inactive\"></div>\n <div class=\"mdc-slider__track--active\">\n <div #trackActive class=\"mdc-slider__track--active_fill\"></div>\n </div>\n @if (showTickMarks) {\n <div class=\"mdc-slider__tick-marks\" #tickMarkContainer>\n @if (_cachedWidth) {\n @for (tickMark of _tickMarks; track i; let i = $index) {\n <div\n [class]=\"tickMark === 0 ? 'mdc-slider__tick-mark--active' : 'mdc-slider__tick-mark--inactive'\"\n [style.transform]=\"_calcTickMarkTransform(i)\"></div>\n }\n }\n </div>\n }\n</div>\n\n<!-- Thumbs -->\n@if (_isRange) {\n <mat-slider-visual-thumb\n [discrete]=\"discrete\"\n [thumbPosition]=\"1\"\n [valueIndicatorText]=\"startValueIndicatorText\">\n </mat-slider-visual-thumb>\n}\n\n<mat-slider-visual-thumb\n [discrete]=\"discrete\"\n [thumbPosition]=\"2\"\n [valueIndicatorText]=\"endValueIndicatorText\">\n</mat-slider-visual-thumb>\n",
|
|
928
|
+
styles: [".mdc-slider__track{position:absolute;top:50%;transform:translateY(-50%);width:100%;pointer-events:none;height:var(--mat-slider-inactive-track-height, 4px)}.mdc-slider__track--active,.mdc-slider__track--inactive{display:flex;height:100%;position:absolute;width:100%}.mdc-slider__track--active{overflow:hidden;border-radius:var(--mat-slider-active-track-shape, var(--mat-sys-corner-full));height:var(--mat-slider-active-track-height, 4px);top:calc((var(--mat-slider-inactive-track-height, 4px) - var(--mat-slider-active-track-height, 4px))/2)}.mdc-slider__track--active_fill{border-top-style:solid;box-sizing:border-box;height:100%;width:100%;position:relative;transform-origin:left;transition:transform 80ms ease;border-color:var(--mat-slider-active-track-color, var(--mat-sys-primary));border-top-width:var(--mat-slider-active-track-height, 4px)}.mdc-slider--disabled .mdc-slider__track--active_fill{border-color:var(--mat-slider-disabled-active-track-color, var(--mat-sys-on-surface))}[dir=rtl] .mdc-slider__track--active_fill{-webkit-transform-origin:right;transform-origin:right}.mdc-slider__track--inactive{left:0;top:0;opacity:.24;background-color:var(--mat-slider-inactive-track-color, var(--mat-sys-surface-variant));height:var(--mat-slider-inactive-track-height, 4px);border-radius:var(--mat-slider-inactive-track-shape, var(--mat-sys-corner-full))}.mdc-slider--disabled .mdc-slider__track--inactive{background-color:var(--mat-slider-disabled-inactive-track-color, var(--mat-sys-on-surface));opacity:.24}.mdc-slider__track--inactive::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:1px solid rgba(0,0,0,0);border-radius:inherit;content:\"\";pointer-events:none}@media(forced-colors: active){.mdc-slider__track--inactive::before{border-color:CanvasText}}.mdc-slider__value-indicator-container{bottom:44px;left:50%;pointer-events:none;position:absolute;transform:var(--mat-slider-value-indicator-container-transform, translateX(-50%) rotate(-45deg))}.mdc-slider__thumb--with-indicator .mdc-slider__value-indicator-container{pointer-events:auto}.mdc-slider__value-indicator{display:flex;align-items:center;transform:scale(0);transform-origin:var(--mat-slider-value-indicator-transform-origin, 0 28px);transition:transform 100ms cubic-bezier(0.4, 0, 1, 1);word-break:normal;background-color:var(--mat-slider-label-container-color, var(--mat-sys-primary));color:var(--mat-slider-label-label-text-color, var(--mat-sys-on-primary));width:var(--mat-slider-value-indicator-width, 28px);height:var(--mat-slider-value-indicator-height, 28px);padding:var(--mat-slider-value-indicator-padding, 0);opacity:var(--mat-slider-value-indicator-opacity, 1);border-radius:var(--mat-slider-value-indicator-border-radius, 50% 50% 50% 0)}.mdc-slider__thumb--with-indicator .mdc-slider__value-indicator{transition:transform 100ms cubic-bezier(0, 0, 0.2, 1);transform:scale(1)}.mdc-slider__value-indicator::before{border-left:6px solid rgba(0,0,0,0);border-right:6px solid rgba(0,0,0,0);border-top:6px solid;bottom:-5px;content:\"\";height:0;left:50%;position:absolute;transform:translateX(-50%);width:0;display:var(--mat-slider-value-indicator-caret-display, none);border-top-color:var(--mat-slider-label-container-color, var(--mat-sys-primary))}.mdc-slider__value-indicator::after{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:1px solid rgba(0,0,0,0);border-radius:inherit;content:\"\";pointer-events:none}@media(forced-colors: active){.mdc-slider__value-indicator::after{border-color:CanvasText}}.mdc-slider__value-indicator-text{text-align:center;width:var(--mat-slider-value-indicator-width, 28px);transform:var(--mat-slider-value-indicator-text-transform, rotate(45deg));font-family:var(--mat-slider-label-label-text-font, var(--mat-sys-label-medium-font));font-size:var(--mat-slider-label-label-text-size, var(--mat-sys-label-medium-size));font-weight:var(--mat-slider-label-label-text-weight, var(--mat-sys-label-medium-weight));line-height:var(--mat-slider-label-label-text-line-height, var(--mat-sys-label-medium-line-height));letter-spacing:var(--mat-slider-label-label-text-tracking, var(--mat-sys-label-medium-tracking))}.mdc-slider__thumb{-webkit-user-select:none;user-select:none;display:flex;left:-24px;outline:none;position:absolute;height:48px;width:48px;pointer-events:none}.mdc-slider--discrete .mdc-slider__thumb{transition:transform 80ms ease}.mdc-slider--disabled .mdc-slider__thumb{pointer-events:none}.mdc-slider__thumb--top{z-index:1}.mdc-slider__thumb-knob{position:absolute;box-sizing:border-box;left:50%;top:50%;transform:translate(-50%, -50%);border-style:solid;width:var(--mat-slider-handle-width, 20px);height:var(--mat-slider-handle-height, 20px);border-width:calc(var(--mat-slider-handle-height, 20px)/2) calc(var(--mat-slider-handle-width, 20px)/2);box-shadow:var(--mat-slider-handle-elevation, var(--mat-sys-level1));background-color:var(--mat-slider-handle-color, var(--mat-sys-primary));border-color:var(--mat-slider-handle-color, var(--mat-sys-primary));border-radius:var(--mat-slider-handle-shape, var(--mat-sys-corner-full))}.mdc-slider__thumb:hover .mdc-slider__thumb-knob{background-color:var(--mat-slider-hover-handle-color, var(--mat-sys-primary));border-color:var(--mat-slider-hover-handle-color, var(--mat-sys-primary))}.mdc-slider__thumb--focused .mdc-slider__thumb-knob{background-color:var(--mat-slider-focus-handle-color, var(--mat-sys-primary));border-color:var(--mat-slider-focus-handle-color, var(--mat-sys-primary))}.mdc-slider--disabled .mdc-slider__thumb-knob{background-color:var(--mat-slider-disabled-handle-color, var(--mat-sys-on-surface));border-color:var(--mat-slider-disabled-handle-color, var(--mat-sys-on-surface))}.mdc-slider__thumb--top .mdc-slider__thumb-knob,.mdc-slider__thumb--top.mdc-slider__thumb:hover .mdc-slider__thumb-knob,.mdc-slider__thumb--top.mdc-slider__thumb--focused .mdc-slider__thumb-knob{border:solid 1px #fff;box-sizing:content-box;border-color:var(--mat-slider-with-overlap-handle-outline-color, var(--mat-sys-on-primary));border-width:var(--mat-slider-with-overlap-handle-outline-width, 1px)}.mdc-slider__tick-marks{align-items:center;box-sizing:border-box;display:flex;height:100%;justify-content:space-between;padding:0 1px;position:absolute;width:100%}.mdc-slider__tick-mark--active,.mdc-slider__tick-mark--inactive{width:var(--mat-slider-with-tick-marks-container-size, 2px);height:var(--mat-slider-with-tick-marks-container-size, 2px);border-radius:var(--mat-slider-with-tick-marks-container-shape, var(--mat-sys-corner-full))}.mdc-slider__tick-mark--inactive{opacity:var(--mat-slider-with-tick-marks-inactive-container-opacity, 0.38);background-color:var(--mat-slider-with-tick-marks-inactive-container-color, var(--mat-sys-on-surface-variant))}.mdc-slider--disabled .mdc-slider__tick-mark--inactive{opacity:var(--mat-slider-with-tick-marks-inactive-container-opacity, 0.38);background-color:var(--mat-slider-with-tick-marks-disabled-container-color, var(--mat-sys-on-surface))}.mdc-slider__tick-mark--active{opacity:var(--mat-slider-with-tick-marks-active-container-opacity, 0.38);background-color:var(--mat-slider-with-tick-marks-active-container-color, var(--mat-sys-on-primary))}.mdc-slider__input{cursor:pointer;left:2px;margin:0;height:44px;opacity:0;position:absolute;top:2px;width:44px;box-sizing:content-box}.mdc-slider__input.mat-mdc-slider-input-no-pointer-events{pointer-events:none}.mdc-slider__input.mat-slider__right-input{left:auto;right:0}.mat-mdc-slider{display:inline-block;box-sizing:border-box;outline:none;vertical-align:middle;cursor:pointer;height:48px;margin:0 8px;position:relative;touch-action:pan-y;width:auto;min-width:112px;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-slider.mdc-slider--disabled{cursor:auto;opacity:.38}.mat-mdc-slider.mdc-slider--disabled .mdc-slider__input{cursor:auto}.mat-mdc-slider .mdc-slider__thumb,.mat-mdc-slider .mdc-slider__track--active_fill{transition-duration:0ms}.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__thumb,.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__track--active_fill{transition-duration:80ms}.mat-mdc-slider.mdc-slider--discrete .mdc-slider__thumb,.mat-mdc-slider.mdc-slider--discrete .mdc-slider__track--active_fill{transition-duration:0ms}.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__thumb,.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__track--active_fill{transition-duration:80ms}.mat-mdc-slider .mat-ripple .mat-ripple-element{background-color:var(--mat-slider-ripple-color, var(--mat-sys-primary))}.mat-mdc-slider .mat-ripple .mat-mdc-slider-hover-ripple{background-color:var(--mat-slider-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-primary) 5%, transparent))}.mat-mdc-slider .mat-ripple .mat-mdc-slider-focus-ripple,.mat-mdc-slider .mat-ripple .mat-mdc-slider-active-ripple{background-color:var(--mat-slider-focus-state-layer-color, color-mix(in srgb, var(--mat-sys-primary) 20%, transparent))}.mat-mdc-slider._mat-animation-noopable.mdc-slider--discrete .mdc-slider__thumb,.mat-mdc-slider._mat-animation-noopable.mdc-slider--discrete .mdc-slider__track--active_fill,.mat-mdc-slider._mat-animation-noopable .mdc-slider__value-indicator{transition:none}.mat-mdc-slider .mat-focus-indicator::before{border-radius:50%}.mdc-slider__thumb--focused .mat-focus-indicator::before{content:\"\"}\n"],
|
|
929
|
+
dependencies: [{
|
|
930
|
+
kind: "component",
|
|
931
|
+
type: MatSliderVisualThumb,
|
|
932
|
+
selector: "mat-slider-visual-thumb",
|
|
933
|
+
inputs: ["discrete", "thumbPosition", "valueIndicatorText"]
|
|
934
|
+
}],
|
|
935
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
936
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
937
|
+
});
|
|
997
938
|
}
|
|
998
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
}, exportAs: 'matSlider', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [{ provide: MAT_SLIDER, useExisting: MatSlider }], imports: [MatSliderVisualThumb], template: "<!-- Inputs -->\n<ng-content></ng-content>\n\n<!-- Track -->\n<div class=\"mdc-slider__track\">\n <div class=\"mdc-slider__track--inactive\"></div>\n <div class=\"mdc-slider__track--active\">\n <div #trackActive class=\"mdc-slider__track--active_fill\"></div>\n </div>\n @if (showTickMarks) {\n <div class=\"mdc-slider__tick-marks\" #tickMarkContainer>\n @if (_cachedWidth) {\n @for (tickMark of _tickMarks; track i; let i = $index) {\n <div\n [class]=\"tickMark === 0 ? 'mdc-slider__tick-mark--active' : 'mdc-slider__tick-mark--inactive'\"\n [style.transform]=\"_calcTickMarkTransform(i)\"></div>\n }\n }\n </div>\n }\n</div>\n\n<!-- Thumbs -->\n@if (_isRange) {\n <mat-slider-visual-thumb\n [discrete]=\"discrete\"\n [thumbPosition]=\"1\"\n [valueIndicatorText]=\"startValueIndicatorText\">\n </mat-slider-visual-thumb>\n}\n\n<mat-slider-visual-thumb\n [discrete]=\"discrete\"\n [thumbPosition]=\"2\"\n [valueIndicatorText]=\"endValueIndicatorText\">\n</mat-slider-visual-thumb>\n", styles: [".mdc-slider__track{position:absolute;top:50%;transform:translateY(-50%);width:100%;pointer-events:none;height:var(--mat-slider-inactive-track-height, 4px)}.mdc-slider__track--active,.mdc-slider__track--inactive{display:flex;height:100%;position:absolute;width:100%}.mdc-slider__track--active{overflow:hidden;border-radius:var(--mat-slider-active-track-shape, var(--mat-sys-corner-full));height:var(--mat-slider-active-track-height, 4px);top:calc((var(--mat-slider-inactive-track-height, 4px) - var(--mat-slider-active-track-height, 4px))/2)}.mdc-slider__track--active_fill{border-top-style:solid;box-sizing:border-box;height:100%;width:100%;position:relative;transform-origin:left;transition:transform 80ms ease;border-color:var(--mat-slider-active-track-color, var(--mat-sys-primary));border-top-width:var(--mat-slider-active-track-height, 4px)}.mdc-slider--disabled .mdc-slider__track--active_fill{border-color:var(--mat-slider-disabled-active-track-color, var(--mat-sys-on-surface))}[dir=rtl] .mdc-slider__track--active_fill{-webkit-transform-origin:right;transform-origin:right}.mdc-slider__track--inactive{left:0;top:0;opacity:.24;background-color:var(--mat-slider-inactive-track-color, var(--mat-sys-surface-variant));height:var(--mat-slider-inactive-track-height, 4px);border-radius:var(--mat-slider-inactive-track-shape, var(--mat-sys-corner-full))}.mdc-slider--disabled .mdc-slider__track--inactive{background-color:var(--mat-slider-disabled-inactive-track-color, var(--mat-sys-on-surface));opacity:.24}.mdc-slider__track--inactive::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:1px solid rgba(0,0,0,0);border-radius:inherit;content:\"\";pointer-events:none}@media(forced-colors: active){.mdc-slider__track--inactive::before{border-color:CanvasText}}.mdc-slider__value-indicator-container{bottom:44px;left:50%;pointer-events:none;position:absolute;transform:var(--mat-slider-value-indicator-container-transform, translateX(-50%) rotate(-45deg))}.mdc-slider__thumb--with-indicator .mdc-slider__value-indicator-container{pointer-events:auto}.mdc-slider__value-indicator{display:flex;align-items:center;transform:scale(0);transform-origin:var(--mat-slider-value-indicator-transform-origin, 0 28px);transition:transform 100ms cubic-bezier(0.4, 0, 1, 1);word-break:normal;background-color:var(--mat-slider-label-container-color, var(--mat-sys-primary));color:var(--mat-slider-label-label-text-color, var(--mat-sys-on-primary));width:var(--mat-slider-value-indicator-width, 28px);height:var(--mat-slider-value-indicator-height, 28px);padding:var(--mat-slider-value-indicator-padding, 0);opacity:var(--mat-slider-value-indicator-opacity, 1);border-radius:var(--mat-slider-value-indicator-border-radius, 50% 50% 50% 0)}.mdc-slider__thumb--with-indicator .mdc-slider__value-indicator{transition:transform 100ms cubic-bezier(0, 0, 0.2, 1);transform:scale(1)}.mdc-slider__value-indicator::before{border-left:6px solid rgba(0,0,0,0);border-right:6px solid rgba(0,0,0,0);border-top:6px solid;bottom:-5px;content:\"\";height:0;left:50%;position:absolute;transform:translateX(-50%);width:0;display:var(--mat-slider-value-indicator-caret-display, none);border-top-color:var(--mat-slider-label-container-color, var(--mat-sys-primary))}.mdc-slider__value-indicator::after{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:1px solid rgba(0,0,0,0);border-radius:inherit;content:\"\";pointer-events:none}@media(forced-colors: active){.mdc-slider__value-indicator::after{border-color:CanvasText}}.mdc-slider__value-indicator-text{text-align:center;width:var(--mat-slider-value-indicator-width, 28px);transform:var(--mat-slider-value-indicator-text-transform, rotate(45deg));font-family:var(--mat-slider-label-label-text-font, var(--mat-sys-label-medium-font));font-size:var(--mat-slider-label-label-text-size, var(--mat-sys-label-medium-size));font-weight:var(--mat-slider-label-label-text-weight, var(--mat-sys-label-medium-weight));line-height:var(--mat-slider-label-label-text-line-height, var(--mat-sys-label-medium-line-height));letter-spacing:var(--mat-slider-label-label-text-tracking, var(--mat-sys-label-medium-tracking))}.mdc-slider__thumb{-webkit-user-select:none;user-select:none;display:flex;left:-24px;outline:none;position:absolute;height:48px;width:48px;pointer-events:none}.mdc-slider--discrete .mdc-slider__thumb{transition:transform 80ms ease}.mdc-slider--disabled .mdc-slider__thumb{pointer-events:none}.mdc-slider__thumb--top{z-index:1}.mdc-slider__thumb-knob{position:absolute;box-sizing:border-box;left:50%;top:50%;transform:translate(-50%, -50%);border-style:solid;width:var(--mat-slider-handle-width, 20px);height:var(--mat-slider-handle-height, 20px);border-width:calc(var(--mat-slider-handle-height, 20px)/2) calc(var(--mat-slider-handle-width, 20px)/2);box-shadow:var(--mat-slider-handle-elevation, var(--mat-sys-level1));background-color:var(--mat-slider-handle-color, var(--mat-sys-primary));border-color:var(--mat-slider-handle-color, var(--mat-sys-primary));border-radius:var(--mat-slider-handle-shape, var(--mat-sys-corner-full))}.mdc-slider__thumb:hover .mdc-slider__thumb-knob{background-color:var(--mat-slider-hover-handle-color, var(--mat-sys-primary));border-color:var(--mat-slider-hover-handle-color, var(--mat-sys-primary))}.mdc-slider__thumb--focused .mdc-slider__thumb-knob{background-color:var(--mat-slider-focus-handle-color, var(--mat-sys-primary));border-color:var(--mat-slider-focus-handle-color, var(--mat-sys-primary))}.mdc-slider--disabled .mdc-slider__thumb-knob{background-color:var(--mat-slider-disabled-handle-color, var(--mat-sys-on-surface));border-color:var(--mat-slider-disabled-handle-color, var(--mat-sys-on-surface))}.mdc-slider__thumb--top .mdc-slider__thumb-knob,.mdc-slider__thumb--top.mdc-slider__thumb:hover .mdc-slider__thumb-knob,.mdc-slider__thumb--top.mdc-slider__thumb--focused .mdc-slider__thumb-knob{border:solid 1px #fff;box-sizing:content-box;border-color:var(--mat-slider-with-overlap-handle-outline-color, var(--mat-sys-on-primary));border-width:var(--mat-slider-with-overlap-handle-outline-width, 1px)}.mdc-slider__tick-marks{align-items:center;box-sizing:border-box;display:flex;height:100%;justify-content:space-between;padding:0 1px;position:absolute;width:100%}.mdc-slider__tick-mark--active,.mdc-slider__tick-mark--inactive{width:var(--mat-slider-with-tick-marks-container-size, 2px);height:var(--mat-slider-with-tick-marks-container-size, 2px);border-radius:var(--mat-slider-with-tick-marks-container-shape, var(--mat-sys-corner-full))}.mdc-slider__tick-mark--inactive{opacity:var(--mat-slider-with-tick-marks-inactive-container-opacity, 0.38);background-color:var(--mat-slider-with-tick-marks-inactive-container-color, var(--mat-sys-on-surface-variant))}.mdc-slider--disabled .mdc-slider__tick-mark--inactive{opacity:var(--mat-slider-with-tick-marks-inactive-container-opacity, 0.38);background-color:var(--mat-slider-with-tick-marks-disabled-container-color, var(--mat-sys-on-surface))}.mdc-slider__tick-mark--active{opacity:var(--mat-slider-with-tick-marks-active-container-opacity, 0.38);background-color:var(--mat-slider-with-tick-marks-active-container-color, var(--mat-sys-on-primary))}.mdc-slider__input{cursor:pointer;left:2px;margin:0;height:44px;opacity:0;position:absolute;top:2px;width:44px;box-sizing:content-box}.mdc-slider__input.mat-mdc-slider-input-no-pointer-events{pointer-events:none}.mdc-slider__input.mat-slider__right-input{left:auto;right:0}.mat-mdc-slider{display:inline-block;box-sizing:border-box;outline:none;vertical-align:middle;cursor:pointer;height:48px;margin:0 8px;position:relative;touch-action:pan-y;width:auto;min-width:112px;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-slider.mdc-slider--disabled{cursor:auto;opacity:.38}.mat-mdc-slider.mdc-slider--disabled .mdc-slider__input{cursor:auto}.mat-mdc-slider .mdc-slider__thumb,.mat-mdc-slider .mdc-slider__track--active_fill{transition-duration:0ms}.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__thumb,.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__track--active_fill{transition-duration:80ms}.mat-mdc-slider.mdc-slider--discrete .mdc-slider__thumb,.mat-mdc-slider.mdc-slider--discrete .mdc-slider__track--active_fill{transition-duration:0ms}.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__thumb,.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__track--active_fill{transition-duration:80ms}.mat-mdc-slider .mat-ripple .mat-ripple-element{background-color:var(--mat-slider-ripple-color, var(--mat-sys-primary))}.mat-mdc-slider .mat-ripple .mat-mdc-slider-hover-ripple{background-color:var(--mat-slider-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-primary) 5%, transparent))}.mat-mdc-slider .mat-ripple .mat-mdc-slider-focus-ripple,.mat-mdc-slider .mat-ripple .mat-mdc-slider-active-ripple{background-color:var(--mat-slider-focus-state-layer-color, color-mix(in srgb, var(--mat-sys-primary) 20%, transparent))}.mat-mdc-slider._mat-animation-noopable.mdc-slider--discrete .mdc-slider__thumb,.mat-mdc-slider._mat-animation-noopable.mdc-slider--discrete .mdc-slider__track--active_fill,.mat-mdc-slider._mat-animation-noopable .mdc-slider__value-indicator{transition:none}.mat-mdc-slider .mat-focus-indicator::before{border-radius:50%}.mdc-slider__thumb--focused .mat-focus-indicator::before{content:\"\"}\n"] }]
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
939
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
940
|
+
minVersion: "12.0.0",
|
|
941
|
+
version: "20.2.0-next.2",
|
|
942
|
+
ngImport: i0,
|
|
943
|
+
type: MatSlider,
|
|
944
|
+
decorators: [{
|
|
945
|
+
type: Component,
|
|
946
|
+
args: [{
|
|
947
|
+
selector: 'mat-slider',
|
|
948
|
+
host: {
|
|
949
|
+
'class': 'mat-mdc-slider mdc-slider',
|
|
950
|
+
'[class]': '"mat-" + (color || "primary")',
|
|
951
|
+
'[class.mdc-slider--range]': '_isRange',
|
|
952
|
+
'[class.mdc-slider--disabled]': 'disabled',
|
|
953
|
+
'[class.mdc-slider--discrete]': 'discrete',
|
|
954
|
+
'[class.mdc-slider--tick-marks]': 'showTickMarks',
|
|
955
|
+
'[class._mat-animation-noopable]': '_noopAnimations'
|
|
956
|
+
},
|
|
957
|
+
exportAs: 'matSlider',
|
|
958
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
959
|
+
encapsulation: ViewEncapsulation.None,
|
|
960
|
+
providers: [{
|
|
961
|
+
provide: MAT_SLIDER,
|
|
962
|
+
useExisting: MatSlider
|
|
963
|
+
}],
|
|
964
|
+
imports: [MatSliderVisualThumb],
|
|
965
|
+
template: "<!-- Inputs -->\n<ng-content></ng-content>\n\n<!-- Track -->\n<div class=\"mdc-slider__track\">\n <div class=\"mdc-slider__track--inactive\"></div>\n <div class=\"mdc-slider__track--active\">\n <div #trackActive class=\"mdc-slider__track--active_fill\"></div>\n </div>\n @if (showTickMarks) {\n <div class=\"mdc-slider__tick-marks\" #tickMarkContainer>\n @if (_cachedWidth) {\n @for (tickMark of _tickMarks; track i; let i = $index) {\n <div\n [class]=\"tickMark === 0 ? 'mdc-slider__tick-mark--active' : 'mdc-slider__tick-mark--inactive'\"\n [style.transform]=\"_calcTickMarkTransform(i)\"></div>\n }\n }\n </div>\n }\n</div>\n\n<!-- Thumbs -->\n@if (_isRange) {\n <mat-slider-visual-thumb\n [discrete]=\"discrete\"\n [thumbPosition]=\"1\"\n [valueIndicatorText]=\"startValueIndicatorText\">\n </mat-slider-visual-thumb>\n}\n\n<mat-slider-visual-thumb\n [discrete]=\"discrete\"\n [thumbPosition]=\"2\"\n [valueIndicatorText]=\"endValueIndicatorText\">\n</mat-slider-visual-thumb>\n",
|
|
966
|
+
styles: [".mdc-slider__track{position:absolute;top:50%;transform:translateY(-50%);width:100%;pointer-events:none;height:var(--mat-slider-inactive-track-height, 4px)}.mdc-slider__track--active,.mdc-slider__track--inactive{display:flex;height:100%;position:absolute;width:100%}.mdc-slider__track--active{overflow:hidden;border-radius:var(--mat-slider-active-track-shape, var(--mat-sys-corner-full));height:var(--mat-slider-active-track-height, 4px);top:calc((var(--mat-slider-inactive-track-height, 4px) - var(--mat-slider-active-track-height, 4px))/2)}.mdc-slider__track--active_fill{border-top-style:solid;box-sizing:border-box;height:100%;width:100%;position:relative;transform-origin:left;transition:transform 80ms ease;border-color:var(--mat-slider-active-track-color, var(--mat-sys-primary));border-top-width:var(--mat-slider-active-track-height, 4px)}.mdc-slider--disabled .mdc-slider__track--active_fill{border-color:var(--mat-slider-disabled-active-track-color, var(--mat-sys-on-surface))}[dir=rtl] .mdc-slider__track--active_fill{-webkit-transform-origin:right;transform-origin:right}.mdc-slider__track--inactive{left:0;top:0;opacity:.24;background-color:var(--mat-slider-inactive-track-color, var(--mat-sys-surface-variant));height:var(--mat-slider-inactive-track-height, 4px);border-radius:var(--mat-slider-inactive-track-shape, var(--mat-sys-corner-full))}.mdc-slider--disabled .mdc-slider__track--inactive{background-color:var(--mat-slider-disabled-inactive-track-color, var(--mat-sys-on-surface));opacity:.24}.mdc-slider__track--inactive::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:1px solid rgba(0,0,0,0);border-radius:inherit;content:\"\";pointer-events:none}@media(forced-colors: active){.mdc-slider__track--inactive::before{border-color:CanvasText}}.mdc-slider__value-indicator-container{bottom:44px;left:50%;pointer-events:none;position:absolute;transform:var(--mat-slider-value-indicator-container-transform, translateX(-50%) rotate(-45deg))}.mdc-slider__thumb--with-indicator .mdc-slider__value-indicator-container{pointer-events:auto}.mdc-slider__value-indicator{display:flex;align-items:center;transform:scale(0);transform-origin:var(--mat-slider-value-indicator-transform-origin, 0 28px);transition:transform 100ms cubic-bezier(0.4, 0, 1, 1);word-break:normal;background-color:var(--mat-slider-label-container-color, var(--mat-sys-primary));color:var(--mat-slider-label-label-text-color, var(--mat-sys-on-primary));width:var(--mat-slider-value-indicator-width, 28px);height:var(--mat-slider-value-indicator-height, 28px);padding:var(--mat-slider-value-indicator-padding, 0);opacity:var(--mat-slider-value-indicator-opacity, 1);border-radius:var(--mat-slider-value-indicator-border-radius, 50% 50% 50% 0)}.mdc-slider__thumb--with-indicator .mdc-slider__value-indicator{transition:transform 100ms cubic-bezier(0, 0, 0.2, 1);transform:scale(1)}.mdc-slider__value-indicator::before{border-left:6px solid rgba(0,0,0,0);border-right:6px solid rgba(0,0,0,0);border-top:6px solid;bottom:-5px;content:\"\";height:0;left:50%;position:absolute;transform:translateX(-50%);width:0;display:var(--mat-slider-value-indicator-caret-display, none);border-top-color:var(--mat-slider-label-container-color, var(--mat-sys-primary))}.mdc-slider__value-indicator::after{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:1px solid rgba(0,0,0,0);border-radius:inherit;content:\"\";pointer-events:none}@media(forced-colors: active){.mdc-slider__value-indicator::after{border-color:CanvasText}}.mdc-slider__value-indicator-text{text-align:center;width:var(--mat-slider-value-indicator-width, 28px);transform:var(--mat-slider-value-indicator-text-transform, rotate(45deg));font-family:var(--mat-slider-label-label-text-font, var(--mat-sys-label-medium-font));font-size:var(--mat-slider-label-label-text-size, var(--mat-sys-label-medium-size));font-weight:var(--mat-slider-label-label-text-weight, var(--mat-sys-label-medium-weight));line-height:var(--mat-slider-label-label-text-line-height, var(--mat-sys-label-medium-line-height));letter-spacing:var(--mat-slider-label-label-text-tracking, var(--mat-sys-label-medium-tracking))}.mdc-slider__thumb{-webkit-user-select:none;user-select:none;display:flex;left:-24px;outline:none;position:absolute;height:48px;width:48px;pointer-events:none}.mdc-slider--discrete .mdc-slider__thumb{transition:transform 80ms ease}.mdc-slider--disabled .mdc-slider__thumb{pointer-events:none}.mdc-slider__thumb--top{z-index:1}.mdc-slider__thumb-knob{position:absolute;box-sizing:border-box;left:50%;top:50%;transform:translate(-50%, -50%);border-style:solid;width:var(--mat-slider-handle-width, 20px);height:var(--mat-slider-handle-height, 20px);border-width:calc(var(--mat-slider-handle-height, 20px)/2) calc(var(--mat-slider-handle-width, 20px)/2);box-shadow:var(--mat-slider-handle-elevation, var(--mat-sys-level1));background-color:var(--mat-slider-handle-color, var(--mat-sys-primary));border-color:var(--mat-slider-handle-color, var(--mat-sys-primary));border-radius:var(--mat-slider-handle-shape, var(--mat-sys-corner-full))}.mdc-slider__thumb:hover .mdc-slider__thumb-knob{background-color:var(--mat-slider-hover-handle-color, var(--mat-sys-primary));border-color:var(--mat-slider-hover-handle-color, var(--mat-sys-primary))}.mdc-slider__thumb--focused .mdc-slider__thumb-knob{background-color:var(--mat-slider-focus-handle-color, var(--mat-sys-primary));border-color:var(--mat-slider-focus-handle-color, var(--mat-sys-primary))}.mdc-slider--disabled .mdc-slider__thumb-knob{background-color:var(--mat-slider-disabled-handle-color, var(--mat-sys-on-surface));border-color:var(--mat-slider-disabled-handle-color, var(--mat-sys-on-surface))}.mdc-slider__thumb--top .mdc-slider__thumb-knob,.mdc-slider__thumb--top.mdc-slider__thumb:hover .mdc-slider__thumb-knob,.mdc-slider__thumb--top.mdc-slider__thumb--focused .mdc-slider__thumb-knob{border:solid 1px #fff;box-sizing:content-box;border-color:var(--mat-slider-with-overlap-handle-outline-color, var(--mat-sys-on-primary));border-width:var(--mat-slider-with-overlap-handle-outline-width, 1px)}.mdc-slider__tick-marks{align-items:center;box-sizing:border-box;display:flex;height:100%;justify-content:space-between;padding:0 1px;position:absolute;width:100%}.mdc-slider__tick-mark--active,.mdc-slider__tick-mark--inactive{width:var(--mat-slider-with-tick-marks-container-size, 2px);height:var(--mat-slider-with-tick-marks-container-size, 2px);border-radius:var(--mat-slider-with-tick-marks-container-shape, var(--mat-sys-corner-full))}.mdc-slider__tick-mark--inactive{opacity:var(--mat-slider-with-tick-marks-inactive-container-opacity, 0.38);background-color:var(--mat-slider-with-tick-marks-inactive-container-color, var(--mat-sys-on-surface-variant))}.mdc-slider--disabled .mdc-slider__tick-mark--inactive{opacity:var(--mat-slider-with-tick-marks-inactive-container-opacity, 0.38);background-color:var(--mat-slider-with-tick-marks-disabled-container-color, var(--mat-sys-on-surface))}.mdc-slider__tick-mark--active{opacity:var(--mat-slider-with-tick-marks-active-container-opacity, 0.38);background-color:var(--mat-slider-with-tick-marks-active-container-color, var(--mat-sys-on-primary))}.mdc-slider__input{cursor:pointer;left:2px;margin:0;height:44px;opacity:0;position:absolute;top:2px;width:44px;box-sizing:content-box}.mdc-slider__input.mat-mdc-slider-input-no-pointer-events{pointer-events:none}.mdc-slider__input.mat-slider__right-input{left:auto;right:0}.mat-mdc-slider{display:inline-block;box-sizing:border-box;outline:none;vertical-align:middle;cursor:pointer;height:48px;margin:0 8px;position:relative;touch-action:pan-y;width:auto;min-width:112px;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-slider.mdc-slider--disabled{cursor:auto;opacity:.38}.mat-mdc-slider.mdc-slider--disabled .mdc-slider__input{cursor:auto}.mat-mdc-slider .mdc-slider__thumb,.mat-mdc-slider .mdc-slider__track--active_fill{transition-duration:0ms}.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__thumb,.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__track--active_fill{transition-duration:80ms}.mat-mdc-slider.mdc-slider--discrete .mdc-slider__thumb,.mat-mdc-slider.mdc-slider--discrete .mdc-slider__track--active_fill{transition-duration:0ms}.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__thumb,.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__track--active_fill{transition-duration:80ms}.mat-mdc-slider .mat-ripple .mat-ripple-element{background-color:var(--mat-slider-ripple-color, var(--mat-sys-primary))}.mat-mdc-slider .mat-ripple .mat-mdc-slider-hover-ripple{background-color:var(--mat-slider-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-primary) 5%, transparent))}.mat-mdc-slider .mat-ripple .mat-mdc-slider-focus-ripple,.mat-mdc-slider .mat-ripple .mat-mdc-slider-active-ripple{background-color:var(--mat-slider-focus-state-layer-color, color-mix(in srgb, var(--mat-sys-primary) 20%, transparent))}.mat-mdc-slider._mat-animation-noopable.mdc-slider--discrete .mdc-slider__thumb,.mat-mdc-slider._mat-animation-noopable.mdc-slider--discrete .mdc-slider__track--active_fill,.mat-mdc-slider._mat-animation-noopable .mdc-slider__value-indicator{transition:none}.mat-mdc-slider .mat-focus-indicator::before{border-radius:50%}.mdc-slider__thumb--focused .mat-focus-indicator::before{content:\"\"}\n"]
|
|
967
|
+
}]
|
|
968
|
+
}],
|
|
969
|
+
ctorParameters: () => [],
|
|
970
|
+
propDecorators: {
|
|
971
|
+
_trackActive: [{
|
|
972
|
+
type: ViewChild,
|
|
973
|
+
args: ['trackActive']
|
|
974
|
+
}],
|
|
975
|
+
_thumbs: [{
|
|
976
|
+
type: ViewChildren,
|
|
977
|
+
args: [MAT_SLIDER_VISUAL_THUMB]
|
|
978
|
+
}],
|
|
979
|
+
_input: [{
|
|
980
|
+
type: ContentChild,
|
|
981
|
+
args: [MAT_SLIDER_THUMB]
|
|
982
|
+
}],
|
|
983
|
+
_inputs: [{
|
|
984
|
+
type: ContentChildren,
|
|
985
|
+
args: [MAT_SLIDER_RANGE_THUMB, {
|
|
986
|
+
descendants: false
|
|
987
|
+
}]
|
|
988
|
+
}],
|
|
989
|
+
disabled: [{
|
|
990
|
+
type: Input,
|
|
991
|
+
args: [{
|
|
992
|
+
transform: booleanAttribute
|
|
993
|
+
}]
|
|
994
|
+
}],
|
|
995
|
+
discrete: [{
|
|
996
|
+
type: Input,
|
|
997
|
+
args: [{
|
|
998
|
+
transform: booleanAttribute
|
|
999
|
+
}]
|
|
1000
|
+
}],
|
|
1001
|
+
showTickMarks: [{
|
|
1002
|
+
type: Input,
|
|
1003
|
+
args: [{
|
|
1004
|
+
transform: booleanAttribute
|
|
1005
|
+
}]
|
|
1006
|
+
}],
|
|
1007
|
+
min: [{
|
|
1008
|
+
type: Input,
|
|
1009
|
+
args: [{
|
|
1010
|
+
transform: numberAttribute
|
|
1011
|
+
}]
|
|
1012
|
+
}],
|
|
1013
|
+
color: [{
|
|
1014
|
+
type: Input
|
|
1015
|
+
}],
|
|
1016
|
+
disableRipple: [{
|
|
1017
|
+
type: Input,
|
|
1018
|
+
args: [{
|
|
1019
|
+
transform: booleanAttribute
|
|
1020
|
+
}]
|
|
1021
|
+
}],
|
|
1022
|
+
max: [{
|
|
1023
|
+
type: Input,
|
|
1024
|
+
args: [{
|
|
1025
|
+
transform: numberAttribute
|
|
1026
|
+
}]
|
|
1027
|
+
}],
|
|
1028
|
+
step: [{
|
|
1029
|
+
type: Input,
|
|
1030
|
+
args: [{
|
|
1031
|
+
transform: numberAttribute
|
|
1032
|
+
}]
|
|
1033
|
+
}],
|
|
1034
|
+
displayWith: [{
|
|
1035
|
+
type: Input
|
|
1036
|
+
}]
|
|
1037
|
+
}
|
|
1038
|
+
});
|
|
1048
1039
|
function _validateInputs(isRange, endInputElement, startInputElement) {
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1040
|
+
const startValid = !isRange || startInputElement?._hostElement.hasAttribute('matSliderStartThumb');
|
|
1041
|
+
const endValid = endInputElement?._hostElement.hasAttribute(isRange ? 'matSliderEndThumb' : 'matSliderThumb');
|
|
1042
|
+
if (!startValid || !endValid) {
|
|
1043
|
+
_throwInvalidInputConfigurationError();
|
|
1044
|
+
}
|
|
1054
1045
|
}
|
|
1055
1046
|
function _throwInvalidInputConfigurationError() {
|
|
1056
|
-
|
|
1047
|
+
throw Error(`Invalid slider thumb input configuration!
|
|
1057
1048
|
|
|
1058
1049
|
Valid configurations are as follows:
|
|
1059
1050
|
|
|
@@ -1070,716 +1061,660 @@ function _throwInvalidInputConfigurationError() {
|
|
|
1070
1061
|
`);
|
|
1071
1062
|
}
|
|
1072
1063
|
|
|
1073
|
-
/**
|
|
1074
|
-
* Provider that allows the slider thumb to register as a ControlValueAccessor.
|
|
1075
|
-
* @docs-private
|
|
1076
|
-
*/
|
|
1077
1064
|
const MAT_SLIDER_THUMB_VALUE_ACCESSOR = {
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1065
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1066
|
+
useExisting: forwardRef(() => MatSliderThumb),
|
|
1067
|
+
multi: true
|
|
1081
1068
|
};
|
|
1082
|
-
/**
|
|
1083
|
-
* Provider that allows the range slider thumb to register as a ControlValueAccessor.
|
|
1084
|
-
* @docs-private
|
|
1085
|
-
*/
|
|
1086
1069
|
const MAT_SLIDER_RANGE_THUMB_VALUE_ACCESSOR = {
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1070
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1071
|
+
useExisting: forwardRef(() => MatSliderRangeThumb),
|
|
1072
|
+
multi: true
|
|
1090
1073
|
};
|
|
1091
|
-
/**
|
|
1092
|
-
* Directive that adds slider-specific behaviors to an input element inside `<mat-slider>`.
|
|
1093
|
-
* Up to two may be placed inside of a `<mat-slider>`.
|
|
1094
|
-
*
|
|
1095
|
-
* If one is used, the selector `matSliderThumb` must be used, and the outcome will be a normal
|
|
1096
|
-
* slider. If two are used, the selectors `matSliderStartThumb` and `matSliderEndThumb` must be
|
|
1097
|
-
* used, and the outcome will be a range slider with two slider thumbs.
|
|
1098
|
-
*/
|
|
1099
1074
|
class MatSliderThumb {
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
}
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1075
|
+
_ngZone = inject(NgZone);
|
|
1076
|
+
_elementRef = inject(ElementRef);
|
|
1077
|
+
_cdr = inject(ChangeDetectorRef);
|
|
1078
|
+
_slider = inject(MAT_SLIDER);
|
|
1079
|
+
_platform = inject(Platform);
|
|
1080
|
+
_listenerCleanups;
|
|
1081
|
+
get value() {
|
|
1082
|
+
return numberAttribute(this._hostElement.value, 0);
|
|
1083
|
+
}
|
|
1084
|
+
set value(value) {
|
|
1085
|
+
if (value === null) {
|
|
1086
|
+
value = this._getDefaultValue();
|
|
1087
|
+
}
|
|
1088
|
+
value = isNaN(value) ? 0 : value;
|
|
1089
|
+
const stringValue = value + '';
|
|
1090
|
+
if (!this._hasSetInitialValue) {
|
|
1091
|
+
this._initialValue = stringValue;
|
|
1092
|
+
return;
|
|
1093
|
+
}
|
|
1094
|
+
if (this._isActive) {
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1097
|
+
this._setValue(stringValue);
|
|
1098
|
+
}
|
|
1099
|
+
_setValue(value) {
|
|
1100
|
+
this._hostElement.value = value;
|
|
1101
|
+
this._updateThumbUIByValue();
|
|
1102
|
+
this._slider._onValueChange(this);
|
|
1103
|
+
this._cdr.detectChanges();
|
|
1104
|
+
this._slider._cdr.markForCheck();
|
|
1105
|
+
}
|
|
1106
|
+
valueChange = new EventEmitter();
|
|
1107
|
+
dragStart = new EventEmitter();
|
|
1108
|
+
dragEnd = new EventEmitter();
|
|
1109
|
+
get translateX() {
|
|
1110
|
+
if (this._slider.min >= this._slider.max) {
|
|
1111
|
+
this._translateX = this._tickMarkOffset;
|
|
1112
|
+
return this._translateX;
|
|
1113
|
+
}
|
|
1114
|
+
if (this._translateX === undefined) {
|
|
1115
|
+
this._translateX = this._calcTranslateXByValue();
|
|
1116
|
+
}
|
|
1117
|
+
return this._translateX;
|
|
1118
|
+
}
|
|
1119
|
+
set translateX(v) {
|
|
1120
|
+
this._translateX = v;
|
|
1121
|
+
}
|
|
1122
|
+
_translateX;
|
|
1123
|
+
thumbPosition = _MatThumb.END;
|
|
1124
|
+
get min() {
|
|
1125
|
+
return numberAttribute(this._hostElement.min, 0);
|
|
1126
|
+
}
|
|
1127
|
+
set min(v) {
|
|
1128
|
+
this._hostElement.min = v + '';
|
|
1129
|
+
this._cdr.detectChanges();
|
|
1130
|
+
}
|
|
1131
|
+
get max() {
|
|
1132
|
+
return numberAttribute(this._hostElement.max, 0);
|
|
1133
|
+
}
|
|
1134
|
+
set max(v) {
|
|
1135
|
+
this._hostElement.max = v + '';
|
|
1136
|
+
this._cdr.detectChanges();
|
|
1137
|
+
}
|
|
1138
|
+
get step() {
|
|
1139
|
+
return numberAttribute(this._hostElement.step, 0);
|
|
1140
|
+
}
|
|
1141
|
+
set step(v) {
|
|
1142
|
+
this._hostElement.step = v + '';
|
|
1143
|
+
this._cdr.detectChanges();
|
|
1144
|
+
}
|
|
1145
|
+
get disabled() {
|
|
1146
|
+
return booleanAttribute(this._hostElement.disabled);
|
|
1147
|
+
}
|
|
1148
|
+
set disabled(v) {
|
|
1149
|
+
this._hostElement.disabled = v;
|
|
1150
|
+
this._cdr.detectChanges();
|
|
1151
|
+
if (this._slider.disabled !== this.disabled) {
|
|
1152
|
+
this._slider.disabled = this.disabled;
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
get percentage() {
|
|
1156
|
+
if (this._slider.min >= this._slider.max) {
|
|
1157
|
+
return this._slider._isRtl ? 1 : 0;
|
|
1158
|
+
}
|
|
1159
|
+
return (this.value - this._slider.min) / (this._slider.max - this._slider.min);
|
|
1160
|
+
}
|
|
1161
|
+
get fillPercentage() {
|
|
1162
|
+
if (!this._slider._cachedWidth) {
|
|
1163
|
+
return this._slider._isRtl ? 1 : 0;
|
|
1164
|
+
}
|
|
1165
|
+
if (this._translateX === 0) {
|
|
1166
|
+
return 0;
|
|
1167
|
+
}
|
|
1168
|
+
return this.translateX / this._slider._cachedWidth;
|
|
1169
|
+
}
|
|
1170
|
+
_hostElement = this._elementRef.nativeElement;
|
|
1171
|
+
_valuetext = signal('', ...(ngDevMode ? [{
|
|
1172
|
+
debugName: "_valuetext"
|
|
1173
|
+
}] : []));
|
|
1174
|
+
_knobRadius = 8;
|
|
1175
|
+
_tickMarkOffset = 3;
|
|
1176
|
+
_isActive = false;
|
|
1177
|
+
_isFocused = false;
|
|
1178
|
+
_setIsFocused(v) {
|
|
1179
|
+
this._isFocused = v;
|
|
1180
|
+
}
|
|
1181
|
+
_hasSetInitialValue = false;
|
|
1182
|
+
_initialValue;
|
|
1183
|
+
_formControl;
|
|
1184
|
+
_destroyed = new Subject();
|
|
1185
|
+
_skipUIUpdate = false;
|
|
1186
|
+
_onChangeFn;
|
|
1187
|
+
_onTouchedFn = () => {};
|
|
1188
|
+
_isControlInitialized = false;
|
|
1189
|
+
constructor() {
|
|
1190
|
+
const renderer = inject(Renderer2);
|
|
1191
|
+
this._ngZone.runOutsideAngular(() => {
|
|
1192
|
+
this._listenerCleanups = [renderer.listen(this._hostElement, 'pointerdown', this._onPointerDown.bind(this)), renderer.listen(this._hostElement, 'pointermove', this._onPointerMove.bind(this)), renderer.listen(this._hostElement, 'pointerup', this._onPointerUp.bind(this))];
|
|
1193
|
+
});
|
|
1194
|
+
}
|
|
1195
|
+
ngOnDestroy() {
|
|
1196
|
+
this._listenerCleanups.forEach(cleanup => cleanup());
|
|
1197
|
+
this._destroyed.next();
|
|
1198
|
+
this._destroyed.complete();
|
|
1199
|
+
this.dragStart.complete();
|
|
1200
|
+
this.dragEnd.complete();
|
|
1201
|
+
}
|
|
1202
|
+
initProps() {
|
|
1203
|
+
this._updateWidthInactive();
|
|
1204
|
+
if (this.disabled !== this._slider.disabled) {
|
|
1205
|
+
this._slider.disabled = true;
|
|
1206
|
+
}
|
|
1207
|
+
this.step = this._slider.step;
|
|
1208
|
+
this.min = this._slider.min;
|
|
1209
|
+
this.max = this._slider.max;
|
|
1210
|
+
this._initValue();
|
|
1211
|
+
}
|
|
1212
|
+
initUI() {
|
|
1213
|
+
this._updateThumbUIByValue();
|
|
1214
|
+
}
|
|
1215
|
+
_initValue() {
|
|
1216
|
+
this._hasSetInitialValue = true;
|
|
1217
|
+
if (this._initialValue === undefined) {
|
|
1218
|
+
this.value = this._getDefaultValue();
|
|
1219
|
+
} else {
|
|
1220
|
+
this._hostElement.value = this._initialValue;
|
|
1221
|
+
this._updateThumbUIByValue();
|
|
1222
|
+
this._slider._onValueChange(this);
|
|
1223
|
+
this._cdr.detectChanges();
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
_getDefaultValue() {
|
|
1227
|
+
return this.min;
|
|
1228
|
+
}
|
|
1229
|
+
_onBlur() {
|
|
1230
|
+
this._setIsFocused(false);
|
|
1231
|
+
this._onTouchedFn();
|
|
1232
|
+
}
|
|
1233
|
+
_onFocus() {
|
|
1234
|
+
this._slider._setTransition(false);
|
|
1235
|
+
this._slider._updateTrackUI(this);
|
|
1236
|
+
this._setIsFocused(true);
|
|
1237
|
+
}
|
|
1238
|
+
_onChange() {
|
|
1239
|
+
this.valueChange.emit(this.value);
|
|
1240
|
+
if (this._isActive) {
|
|
1241
|
+
this._updateThumbUIByValue({
|
|
1242
|
+
withAnimation: true
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
_onInput() {
|
|
1247
|
+
this._onChangeFn?.(this.value);
|
|
1248
|
+
if (this._slider.step || !this._isActive) {
|
|
1249
|
+
this._updateThumbUIByValue({
|
|
1250
|
+
withAnimation: true
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
this._slider._onValueChange(this);
|
|
1254
|
+
}
|
|
1255
|
+
_onNgControlValueChange() {
|
|
1256
|
+
if (!this._isActive || !this._isFocused) {
|
|
1257
|
+
this._slider._onValueChange(this);
|
|
1258
|
+
this._updateThumbUIByValue();
|
|
1259
|
+
}
|
|
1260
|
+
this._slider.disabled = this._formControl.disabled;
|
|
1261
|
+
}
|
|
1262
|
+
_onPointerDown(event) {
|
|
1263
|
+
if (this.disabled || event.button !== 0) {
|
|
1264
|
+
return;
|
|
1265
|
+
}
|
|
1266
|
+
if (this._platform.IOS) {
|
|
1267
|
+
const isCursorOnSliderThumb = this._slider._isCursorOnSliderThumb(event, this._slider._getThumb(this.thumbPosition)._hostElement.getBoundingClientRect());
|
|
1268
|
+
this._isActive = isCursorOnSliderThumb;
|
|
1269
|
+
this._updateWidthActive();
|
|
1270
|
+
this._slider._updateDimensions();
|
|
1271
|
+
return;
|
|
1272
|
+
}
|
|
1273
|
+
this._isActive = true;
|
|
1274
|
+
this._setIsFocused(true);
|
|
1275
|
+
this._updateWidthActive();
|
|
1276
|
+
this._slider._updateDimensions();
|
|
1277
|
+
if (!this._slider.step) {
|
|
1278
|
+
this._updateThumbUIByPointerEvent(event, {
|
|
1279
|
+
withAnimation: true
|
|
1280
|
+
});
|
|
1281
|
+
}
|
|
1282
|
+
if (!this.disabled) {
|
|
1283
|
+
this._handleValueCorrection(event);
|
|
1284
|
+
this.dragStart.emit({
|
|
1285
|
+
source: this,
|
|
1286
|
+
parent: this._slider,
|
|
1287
|
+
value: this.value
|
|
1288
|
+
});
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
_handleValueCorrection(event) {
|
|
1292
|
+
this._skipUIUpdate = true;
|
|
1293
|
+
setTimeout(() => {
|
|
1294
|
+
this._skipUIUpdate = false;
|
|
1295
|
+
this._fixValue(event);
|
|
1296
|
+
}, 0);
|
|
1297
|
+
}
|
|
1298
|
+
_fixValue(event) {
|
|
1299
|
+
const xPos = event.clientX - this._slider._cachedLeft;
|
|
1300
|
+
const width = this._slider._cachedWidth;
|
|
1301
|
+
const step = this._slider.step === 0 ? 1 : this._slider.step;
|
|
1302
|
+
const numSteps = Math.floor((this._slider.max - this._slider.min) / step);
|
|
1303
|
+
const percentage = this._slider._isRtl ? 1 - xPos / width : xPos / width;
|
|
1304
|
+
const fixedPercentage = Math.round(percentage * numSteps) / numSteps;
|
|
1305
|
+
const impreciseValue = fixedPercentage * (this._slider.max - this._slider.min) + this._slider.min;
|
|
1306
|
+
const value = Math.round(impreciseValue / step) * step;
|
|
1307
|
+
const prevValue = this.value;
|
|
1308
|
+
if (value === prevValue) {
|
|
1309
|
+
this._slider._onValueChange(this);
|
|
1310
|
+
this._slider.step > 0 ? this._updateThumbUIByValue() : this._updateThumbUIByPointerEvent(event, {
|
|
1311
|
+
withAnimation: this._slider._hasAnimation
|
|
1312
|
+
});
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1315
|
+
this.value = value;
|
|
1316
|
+
this.valueChange.emit(this.value);
|
|
1317
|
+
this._onChangeFn?.(this.value);
|
|
1318
|
+
this._slider._onValueChange(this);
|
|
1319
|
+
this._slider.step > 0 ? this._updateThumbUIByValue() : this._updateThumbUIByPointerEvent(event, {
|
|
1320
|
+
withAnimation: this._slider._hasAnimation
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
_onPointerMove(event) {
|
|
1324
|
+
if (!this._slider.step && this._isActive) {
|
|
1325
|
+
this._updateThumbUIByPointerEvent(event);
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
_onPointerUp() {
|
|
1329
|
+
if (this._isActive) {
|
|
1330
|
+
this._isActive = false;
|
|
1331
|
+
if (this._platform.SAFARI) {
|
|
1314
1332
|
this._setIsFocused(false);
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
this._slider
|
|
1319
|
-
this.
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
this._onChangeFn?.(this.value);
|
|
1422
|
-
this._slider._onValueChange(this);
|
|
1423
|
-
this._slider.step > 0
|
|
1424
|
-
? this._updateThumbUIByValue()
|
|
1425
|
-
: this._updateThumbUIByPointerEvent(event, { withAnimation: this._slider._hasAnimation });
|
|
1426
|
-
}
|
|
1427
|
-
_onPointerMove(event) {
|
|
1428
|
-
// Again, does nothing if a step is defined because
|
|
1429
|
-
// we want the value to snap to the values on input.
|
|
1430
|
-
if (!this._slider.step && this._isActive) {
|
|
1431
|
-
this._updateThumbUIByPointerEvent(event);
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
|
-
_onPointerUp() {
|
|
1435
|
-
if (this._isActive) {
|
|
1436
|
-
this._isActive = false;
|
|
1437
|
-
if (this._platform.SAFARI) {
|
|
1438
|
-
this._setIsFocused(false);
|
|
1439
|
-
}
|
|
1440
|
-
this.dragEnd.emit({ source: this, parent: this._slider, value: this.value });
|
|
1441
|
-
// This setTimeout is to prevent the pointerup from triggering a value
|
|
1442
|
-
// change on the input based on the inactive width. It's not clear why
|
|
1443
|
-
// but for some reason on IOS this race condition is even more common so
|
|
1444
|
-
// the timeout needs to be increased.
|
|
1445
|
-
setTimeout(() => this._updateWidthInactive(), this._platform.IOS ? 10 : 0);
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
_clamp(v) {
|
|
1449
|
-
const min = this._tickMarkOffset;
|
|
1450
|
-
const max = this._slider._cachedWidth - this._tickMarkOffset;
|
|
1451
|
-
return Math.max(Math.min(v, max), min);
|
|
1452
|
-
}
|
|
1453
|
-
_calcTranslateXByValue() {
|
|
1454
|
-
if (this._slider._isRtl) {
|
|
1455
|
-
return ((1 - this.percentage) * (this._slider._cachedWidth - this._tickMarkOffset * 2) +
|
|
1456
|
-
this._tickMarkOffset);
|
|
1457
|
-
}
|
|
1458
|
-
return (this.percentage * (this._slider._cachedWidth - this._tickMarkOffset * 2) +
|
|
1459
|
-
this._tickMarkOffset);
|
|
1460
|
-
}
|
|
1461
|
-
_calcTranslateXByPointerEvent(event) {
|
|
1462
|
-
return event.clientX - this._slider._cachedLeft;
|
|
1463
|
-
}
|
|
1464
|
-
/**
|
|
1465
|
-
* Used to set the slider width to the correct
|
|
1466
|
-
* dimensions while the user is dragging.
|
|
1467
|
-
*/
|
|
1468
|
-
_updateWidthActive() { }
|
|
1469
|
-
/**
|
|
1470
|
-
* Sets the slider input to disproportionate dimensions to allow for touch
|
|
1471
|
-
* events to be captured on touch devices.
|
|
1472
|
-
*/
|
|
1473
|
-
_updateWidthInactive() {
|
|
1474
|
-
this._hostElement.style.padding = `0 ${this._slider._inputPadding}px`;
|
|
1475
|
-
this._hostElement.style.width = `calc(100% + ${this._slider._inputPadding - this._tickMarkOffset * 2}px)`;
|
|
1476
|
-
this._hostElement.style.left = `-${this._slider._rippleRadius - this._tickMarkOffset}px`;
|
|
1477
|
-
}
|
|
1478
|
-
_updateThumbUIByValue(options) {
|
|
1479
|
-
this.translateX = this._clamp(this._calcTranslateXByValue());
|
|
1480
|
-
this._updateThumbUI(options);
|
|
1481
|
-
}
|
|
1482
|
-
_updateThumbUIByPointerEvent(event, options) {
|
|
1483
|
-
this.translateX = this._clamp(this._calcTranslateXByPointerEvent(event));
|
|
1484
|
-
this._updateThumbUI(options);
|
|
1485
|
-
}
|
|
1486
|
-
_updateThumbUI(options) {
|
|
1487
|
-
this._slider._setTransition(!!options?.withAnimation);
|
|
1488
|
-
this._slider._onTranslateXChange(this);
|
|
1489
|
-
}
|
|
1490
|
-
/**
|
|
1491
|
-
* Sets the input's value.
|
|
1492
|
-
* @param value The new value of the input
|
|
1493
|
-
* @docs-private
|
|
1494
|
-
*/
|
|
1495
|
-
writeValue(value) {
|
|
1496
|
-
if (this._isControlInitialized || value !== null) {
|
|
1497
|
-
this.value = value;
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
/**
|
|
1501
|
-
* Registers a callback to be invoked when the input's value changes from user input.
|
|
1502
|
-
* @param fn The callback to register
|
|
1503
|
-
* @docs-private
|
|
1504
|
-
*/
|
|
1505
|
-
registerOnChange(fn) {
|
|
1506
|
-
this._onChangeFn = fn;
|
|
1507
|
-
this._isControlInitialized = true;
|
|
1508
|
-
}
|
|
1509
|
-
/**
|
|
1510
|
-
* Registers a callback to be invoked when the input is blurred by the user.
|
|
1511
|
-
* @param fn The callback to register
|
|
1512
|
-
* @docs-private
|
|
1513
|
-
*/
|
|
1514
|
-
registerOnTouched(fn) {
|
|
1515
|
-
this._onTouchedFn = fn;
|
|
1516
|
-
}
|
|
1517
|
-
/**
|
|
1518
|
-
* Sets the disabled state of the slider.
|
|
1519
|
-
* @param isDisabled The new disabled state
|
|
1520
|
-
* @docs-private
|
|
1521
|
-
*/
|
|
1522
|
-
setDisabledState(isDisabled) {
|
|
1523
|
-
this.disabled = isDisabled;
|
|
1524
|
-
}
|
|
1525
|
-
focus() {
|
|
1526
|
-
this._hostElement.focus();
|
|
1527
|
-
}
|
|
1528
|
-
blur() {
|
|
1529
|
-
this._hostElement.blur();
|
|
1530
|
-
}
|
|
1531
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatSliderThumb, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1532
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "20.2.0-next.2", type: MatSliderThumb, isStandalone: true, selector: "input[matSliderThumb]", inputs: { value: ["value", "value", numberAttribute] }, outputs: { valueChange: "valueChange", dragStart: "dragStart", dragEnd: "dragEnd" }, host: { attributes: { "type": "range" }, listeners: { "change": "_onChange()", "input": "_onInput()", "blur": "_onBlur()", "focus": "_onFocus()" }, properties: { "attr.aria-valuetext": "_valuetext()" }, classAttribute: "mdc-slider__input" }, providers: [
|
|
1533
|
-
MAT_SLIDER_THUMB_VALUE_ACCESSOR,
|
|
1534
|
-
{ provide: MAT_SLIDER_THUMB, useExisting: MatSliderThumb },
|
|
1535
|
-
], exportAs: ["matSliderThumb"], ngImport: i0 });
|
|
1333
|
+
}
|
|
1334
|
+
this.dragEnd.emit({
|
|
1335
|
+
source: this,
|
|
1336
|
+
parent: this._slider,
|
|
1337
|
+
value: this.value
|
|
1338
|
+
});
|
|
1339
|
+
setTimeout(() => this._updateWidthInactive(), this._platform.IOS ? 10 : 0);
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
_clamp(v) {
|
|
1343
|
+
const min = this._tickMarkOffset;
|
|
1344
|
+
const max = this._slider._cachedWidth - this._tickMarkOffset;
|
|
1345
|
+
return Math.max(Math.min(v, max), min);
|
|
1346
|
+
}
|
|
1347
|
+
_calcTranslateXByValue() {
|
|
1348
|
+
if (this._slider._isRtl) {
|
|
1349
|
+
return (1 - this.percentage) * (this._slider._cachedWidth - this._tickMarkOffset * 2) + this._tickMarkOffset;
|
|
1350
|
+
}
|
|
1351
|
+
return this.percentage * (this._slider._cachedWidth - this._tickMarkOffset * 2) + this._tickMarkOffset;
|
|
1352
|
+
}
|
|
1353
|
+
_calcTranslateXByPointerEvent(event) {
|
|
1354
|
+
return event.clientX - this._slider._cachedLeft;
|
|
1355
|
+
}
|
|
1356
|
+
_updateWidthActive() {}
|
|
1357
|
+
_updateWidthInactive() {
|
|
1358
|
+
this._hostElement.style.padding = `0 ${this._slider._inputPadding}px`;
|
|
1359
|
+
this._hostElement.style.width = `calc(100% + ${this._slider._inputPadding - this._tickMarkOffset * 2}px)`;
|
|
1360
|
+
this._hostElement.style.left = `-${this._slider._rippleRadius - this._tickMarkOffset}px`;
|
|
1361
|
+
}
|
|
1362
|
+
_updateThumbUIByValue(options) {
|
|
1363
|
+
this.translateX = this._clamp(this._calcTranslateXByValue());
|
|
1364
|
+
this._updateThumbUI(options);
|
|
1365
|
+
}
|
|
1366
|
+
_updateThumbUIByPointerEvent(event, options) {
|
|
1367
|
+
this.translateX = this._clamp(this._calcTranslateXByPointerEvent(event));
|
|
1368
|
+
this._updateThumbUI(options);
|
|
1369
|
+
}
|
|
1370
|
+
_updateThumbUI(options) {
|
|
1371
|
+
this._slider._setTransition(!!options?.withAnimation);
|
|
1372
|
+
this._slider._onTranslateXChange(this);
|
|
1373
|
+
}
|
|
1374
|
+
writeValue(value) {
|
|
1375
|
+
if (this._isControlInitialized || value !== null) {
|
|
1376
|
+
this.value = value;
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
registerOnChange(fn) {
|
|
1380
|
+
this._onChangeFn = fn;
|
|
1381
|
+
this._isControlInitialized = true;
|
|
1382
|
+
}
|
|
1383
|
+
registerOnTouched(fn) {
|
|
1384
|
+
this._onTouchedFn = fn;
|
|
1385
|
+
}
|
|
1386
|
+
setDisabledState(isDisabled) {
|
|
1387
|
+
this.disabled = isDisabled;
|
|
1388
|
+
}
|
|
1389
|
+
focus() {
|
|
1390
|
+
this._hostElement.focus();
|
|
1391
|
+
}
|
|
1392
|
+
blur() {
|
|
1393
|
+
this._hostElement.blur();
|
|
1394
|
+
}
|
|
1395
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1396
|
+
minVersion: "12.0.0",
|
|
1397
|
+
version: "20.2.0-next.2",
|
|
1398
|
+
ngImport: i0,
|
|
1399
|
+
type: MatSliderThumb,
|
|
1400
|
+
deps: [],
|
|
1401
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
1402
|
+
});
|
|
1403
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
1404
|
+
minVersion: "16.1.0",
|
|
1405
|
+
version: "20.2.0-next.2",
|
|
1406
|
+
type: MatSliderThumb,
|
|
1407
|
+
isStandalone: true,
|
|
1408
|
+
selector: "input[matSliderThumb]",
|
|
1409
|
+
inputs: {
|
|
1410
|
+
value: ["value", "value", numberAttribute]
|
|
1411
|
+
},
|
|
1412
|
+
outputs: {
|
|
1413
|
+
valueChange: "valueChange",
|
|
1414
|
+
dragStart: "dragStart",
|
|
1415
|
+
dragEnd: "dragEnd"
|
|
1416
|
+
},
|
|
1417
|
+
host: {
|
|
1418
|
+
attributes: {
|
|
1419
|
+
"type": "range"
|
|
1420
|
+
},
|
|
1421
|
+
listeners: {
|
|
1422
|
+
"change": "_onChange()",
|
|
1423
|
+
"input": "_onInput()",
|
|
1424
|
+
"blur": "_onBlur()",
|
|
1425
|
+
"focus": "_onFocus()"
|
|
1426
|
+
},
|
|
1427
|
+
properties: {
|
|
1428
|
+
"attr.aria-valuetext": "_valuetext()"
|
|
1429
|
+
},
|
|
1430
|
+
classAttribute: "mdc-slider__input"
|
|
1431
|
+
},
|
|
1432
|
+
providers: [MAT_SLIDER_THUMB_VALUE_ACCESSOR, {
|
|
1433
|
+
provide: MAT_SLIDER_THUMB,
|
|
1434
|
+
useExisting: MatSliderThumb
|
|
1435
|
+
}],
|
|
1436
|
+
exportAs: ["matSliderThumb"],
|
|
1437
|
+
ngImport: i0
|
|
1438
|
+
});
|
|
1536
1439
|
}
|
|
1537
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1440
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1441
|
+
minVersion: "12.0.0",
|
|
1442
|
+
version: "20.2.0-next.2",
|
|
1443
|
+
ngImport: i0,
|
|
1444
|
+
type: MatSliderThumb,
|
|
1445
|
+
decorators: [{
|
|
1446
|
+
type: Directive,
|
|
1447
|
+
args: [{
|
|
1448
|
+
selector: 'input[matSliderThumb]',
|
|
1449
|
+
exportAs: 'matSliderThumb',
|
|
1450
|
+
host: {
|
|
1451
|
+
'class': 'mdc-slider__input',
|
|
1452
|
+
'type': 'range',
|
|
1453
|
+
'[attr.aria-valuetext]': '_valuetext()',
|
|
1454
|
+
'(change)': '_onChange()',
|
|
1455
|
+
'(input)': '_onInput()',
|
|
1456
|
+
'(blur)': '_onBlur()',
|
|
1457
|
+
'(focus)': '_onFocus()'
|
|
1458
|
+
},
|
|
1459
|
+
providers: [MAT_SLIDER_THUMB_VALUE_ACCESSOR, {
|
|
1460
|
+
provide: MAT_SLIDER_THUMB,
|
|
1461
|
+
useExisting: MatSliderThumb
|
|
1462
|
+
}]
|
|
1463
|
+
}]
|
|
1464
|
+
}],
|
|
1465
|
+
ctorParameters: () => [],
|
|
1466
|
+
propDecorators: {
|
|
1467
|
+
value: [{
|
|
1468
|
+
type: Input,
|
|
1469
|
+
args: [{
|
|
1470
|
+
transform: numberAttribute
|
|
1471
|
+
}]
|
|
1472
|
+
}],
|
|
1473
|
+
valueChange: [{
|
|
1474
|
+
type: Output
|
|
1475
|
+
}],
|
|
1476
|
+
dragStart: [{
|
|
1477
|
+
type: Output
|
|
1478
|
+
}],
|
|
1479
|
+
dragEnd: [{
|
|
1480
|
+
type: Output
|
|
1481
|
+
}]
|
|
1482
|
+
}
|
|
1483
|
+
});
|
|
1568
1484
|
class MatSliderRangeThumb extends MatSliderThumb {
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
}
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
}
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
}
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
}
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
}
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
}
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
this._updateWidthInactive();
|
|
1745
|
-
this._updateSibling();
|
|
1746
|
-
}
|
|
1747
|
-
}
|
|
1748
|
-
_setValue(value) {
|
|
1749
|
-
super._setValue(value);
|
|
1750
|
-
this._updateWidthInactive();
|
|
1751
|
-
this._updateSibling();
|
|
1752
|
-
}
|
|
1753
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatSliderRangeThumb, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1754
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: MatSliderRangeThumb, isStandalone: true, selector: "input[matSliderStartThumb], input[matSliderEndThumb]", providers: [
|
|
1755
|
-
MAT_SLIDER_RANGE_THUMB_VALUE_ACCESSOR,
|
|
1756
|
-
{ provide: MAT_SLIDER_RANGE_THUMB, useExisting: MatSliderRangeThumb },
|
|
1757
|
-
], exportAs: ["matSliderRangeThumb"], usesInheritance: true, ngImport: i0 });
|
|
1485
|
+
_cdr = inject(ChangeDetectorRef);
|
|
1486
|
+
getSibling() {
|
|
1487
|
+
if (!this._sibling) {
|
|
1488
|
+
this._sibling = this._slider._getInput(this._isEndThumb ? _MatThumb.START : _MatThumb.END);
|
|
1489
|
+
}
|
|
1490
|
+
return this._sibling;
|
|
1491
|
+
}
|
|
1492
|
+
_sibling;
|
|
1493
|
+
getMinPos() {
|
|
1494
|
+
const sibling = this.getSibling();
|
|
1495
|
+
if (!this._isLeftThumb && sibling) {
|
|
1496
|
+
return sibling.translateX;
|
|
1497
|
+
}
|
|
1498
|
+
return this._tickMarkOffset;
|
|
1499
|
+
}
|
|
1500
|
+
getMaxPos() {
|
|
1501
|
+
const sibling = this.getSibling();
|
|
1502
|
+
if (this._isLeftThumb && sibling) {
|
|
1503
|
+
return sibling.translateX;
|
|
1504
|
+
}
|
|
1505
|
+
return this._slider._cachedWidth - this._tickMarkOffset;
|
|
1506
|
+
}
|
|
1507
|
+
_setIsLeftThumb() {
|
|
1508
|
+
this._isLeftThumb = this._isEndThumb && this._slider._isRtl || !this._isEndThumb && !this._slider._isRtl;
|
|
1509
|
+
}
|
|
1510
|
+
_isLeftThumb;
|
|
1511
|
+
_isEndThumb;
|
|
1512
|
+
constructor() {
|
|
1513
|
+
super();
|
|
1514
|
+
this._isEndThumb = this._hostElement.hasAttribute('matSliderEndThumb');
|
|
1515
|
+
this._setIsLeftThumb();
|
|
1516
|
+
this.thumbPosition = this._isEndThumb ? _MatThumb.END : _MatThumb.START;
|
|
1517
|
+
}
|
|
1518
|
+
_getDefaultValue() {
|
|
1519
|
+
return this._isEndThumb && this._slider._isRange ? this.max : this.min;
|
|
1520
|
+
}
|
|
1521
|
+
_onInput() {
|
|
1522
|
+
super._onInput();
|
|
1523
|
+
this._updateSibling();
|
|
1524
|
+
if (!this._isActive) {
|
|
1525
|
+
this._updateWidthInactive();
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
_onNgControlValueChange() {
|
|
1529
|
+
super._onNgControlValueChange();
|
|
1530
|
+
this.getSibling()?._updateMinMax();
|
|
1531
|
+
}
|
|
1532
|
+
_onPointerDown(event) {
|
|
1533
|
+
if (this.disabled || event.button !== 0) {
|
|
1534
|
+
return;
|
|
1535
|
+
}
|
|
1536
|
+
if (this._sibling) {
|
|
1537
|
+
this._sibling._updateWidthActive();
|
|
1538
|
+
this._sibling._hostElement.classList.add('mat-mdc-slider-input-no-pointer-events');
|
|
1539
|
+
}
|
|
1540
|
+
super._onPointerDown(event);
|
|
1541
|
+
}
|
|
1542
|
+
_onPointerUp() {
|
|
1543
|
+
super._onPointerUp();
|
|
1544
|
+
if (this._sibling) {
|
|
1545
|
+
setTimeout(() => {
|
|
1546
|
+
this._sibling._updateWidthInactive();
|
|
1547
|
+
this._sibling._hostElement.classList.remove('mat-mdc-slider-input-no-pointer-events');
|
|
1548
|
+
});
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
_onPointerMove(event) {
|
|
1552
|
+
super._onPointerMove(event);
|
|
1553
|
+
if (!this._slider.step && this._isActive) {
|
|
1554
|
+
this._updateSibling();
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
_fixValue(event) {
|
|
1558
|
+
super._fixValue(event);
|
|
1559
|
+
this._sibling?._updateMinMax();
|
|
1560
|
+
}
|
|
1561
|
+
_clamp(v) {
|
|
1562
|
+
return Math.max(Math.min(v, this.getMaxPos()), this.getMinPos());
|
|
1563
|
+
}
|
|
1564
|
+
_updateMinMax() {
|
|
1565
|
+
const sibling = this.getSibling();
|
|
1566
|
+
if (!sibling) {
|
|
1567
|
+
return;
|
|
1568
|
+
}
|
|
1569
|
+
if (this._isEndThumb) {
|
|
1570
|
+
this.min = Math.max(this._slider.min, sibling.value);
|
|
1571
|
+
this.max = this._slider.max;
|
|
1572
|
+
} else {
|
|
1573
|
+
this.min = this._slider.min;
|
|
1574
|
+
this.max = Math.min(this._slider.max, sibling.value);
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
_updateWidthActive() {
|
|
1578
|
+
const minWidth = this._slider._rippleRadius * 2 - this._slider._inputPadding * 2;
|
|
1579
|
+
const maxWidth = this._slider._cachedWidth + this._slider._inputPadding - minWidth - this._tickMarkOffset * 2;
|
|
1580
|
+
const percentage = this._slider.min < this._slider.max ? (this.max - this.min) / (this._slider.max - this._slider.min) : 1;
|
|
1581
|
+
const width = maxWidth * percentage + minWidth;
|
|
1582
|
+
this._hostElement.style.width = `${width}px`;
|
|
1583
|
+
this._hostElement.style.padding = `0 ${this._slider._inputPadding}px`;
|
|
1584
|
+
}
|
|
1585
|
+
_updateWidthInactive() {
|
|
1586
|
+
const sibling = this.getSibling();
|
|
1587
|
+
if (!sibling) {
|
|
1588
|
+
return;
|
|
1589
|
+
}
|
|
1590
|
+
const maxWidth = this._slider._cachedWidth - this._tickMarkOffset * 2;
|
|
1591
|
+
const midValue = this._isEndThumb ? this.value - (this.value - sibling.value) / 2 : this.value + (sibling.value - this.value) / 2;
|
|
1592
|
+
const _percentage = this._isEndThumb ? (this.max - midValue) / (this._slider.max - this._slider.min) : (midValue - this.min) / (this._slider.max - this._slider.min);
|
|
1593
|
+
const percentage = this._slider.min < this._slider.max ? _percentage : 1;
|
|
1594
|
+
let ripplePadding = this._slider._rippleRadius;
|
|
1595
|
+
if (percentage === 1) {
|
|
1596
|
+
ripplePadding = 48;
|
|
1597
|
+
} else if (percentage === 0) {
|
|
1598
|
+
ripplePadding = 0;
|
|
1599
|
+
}
|
|
1600
|
+
const width = maxWidth * percentage + ripplePadding;
|
|
1601
|
+
this._hostElement.style.width = `${width}px`;
|
|
1602
|
+
this._hostElement.style.padding = '0px';
|
|
1603
|
+
if (this._isLeftThumb) {
|
|
1604
|
+
this._hostElement.style.left = `-${this._slider._rippleRadius - this._tickMarkOffset}px`;
|
|
1605
|
+
this._hostElement.style.right = 'auto';
|
|
1606
|
+
} else {
|
|
1607
|
+
this._hostElement.style.left = 'auto';
|
|
1608
|
+
this._hostElement.style.right = `-${this._slider._rippleRadius - this._tickMarkOffset}px`;
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
_updateStaticStyles() {
|
|
1612
|
+
this._hostElement.classList.toggle('mat-slider__right-input', !this._isLeftThumb);
|
|
1613
|
+
}
|
|
1614
|
+
_updateSibling() {
|
|
1615
|
+
const sibling = this.getSibling();
|
|
1616
|
+
if (!sibling) {
|
|
1617
|
+
return;
|
|
1618
|
+
}
|
|
1619
|
+
sibling._updateMinMax();
|
|
1620
|
+
if (this._isActive) {
|
|
1621
|
+
sibling._updateWidthActive();
|
|
1622
|
+
} else {
|
|
1623
|
+
sibling._updateWidthInactive();
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
writeValue(value) {
|
|
1627
|
+
if (this._isControlInitialized || value !== null) {
|
|
1628
|
+
this.value = value;
|
|
1629
|
+
this._updateWidthInactive();
|
|
1630
|
+
this._updateSibling();
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
_setValue(value) {
|
|
1634
|
+
super._setValue(value);
|
|
1635
|
+
this._updateWidthInactive();
|
|
1636
|
+
this._updateSibling();
|
|
1637
|
+
}
|
|
1638
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1639
|
+
minVersion: "12.0.0",
|
|
1640
|
+
version: "20.2.0-next.2",
|
|
1641
|
+
ngImport: i0,
|
|
1642
|
+
type: MatSliderRangeThumb,
|
|
1643
|
+
deps: [],
|
|
1644
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
1645
|
+
});
|
|
1646
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
1647
|
+
minVersion: "14.0.0",
|
|
1648
|
+
version: "20.2.0-next.2",
|
|
1649
|
+
type: MatSliderRangeThumb,
|
|
1650
|
+
isStandalone: true,
|
|
1651
|
+
selector: "input[matSliderStartThumb], input[matSliderEndThumb]",
|
|
1652
|
+
providers: [MAT_SLIDER_RANGE_THUMB_VALUE_ACCESSOR, {
|
|
1653
|
+
provide: MAT_SLIDER_RANGE_THUMB,
|
|
1654
|
+
useExisting: MatSliderRangeThumb
|
|
1655
|
+
}],
|
|
1656
|
+
exportAs: ["matSliderRangeThumb"],
|
|
1657
|
+
usesInheritance: true,
|
|
1658
|
+
ngImport: i0
|
|
1659
|
+
});
|
|
1758
1660
|
}
|
|
1759
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1661
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1662
|
+
minVersion: "12.0.0",
|
|
1663
|
+
version: "20.2.0-next.2",
|
|
1664
|
+
ngImport: i0,
|
|
1665
|
+
type: MatSliderRangeThumb,
|
|
1666
|
+
decorators: [{
|
|
1667
|
+
type: Directive,
|
|
1668
|
+
args: [{
|
|
1669
|
+
selector: 'input[matSliderStartThumb], input[matSliderEndThumb]',
|
|
1670
|
+
exportAs: 'matSliderRangeThumb',
|
|
1671
|
+
providers: [MAT_SLIDER_RANGE_THUMB_VALUE_ACCESSOR, {
|
|
1672
|
+
provide: MAT_SLIDER_RANGE_THUMB,
|
|
1673
|
+
useExisting: MatSliderRangeThumb
|
|
1674
|
+
}]
|
|
1675
|
+
}]
|
|
1676
|
+
}],
|
|
1677
|
+
ctorParameters: () => []
|
|
1678
|
+
});
|
|
1770
1679
|
|
|
1771
1680
|
class MatSliderModule {
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1681
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1682
|
+
minVersion: "12.0.0",
|
|
1683
|
+
version: "20.2.0-next.2",
|
|
1684
|
+
ngImport: i0,
|
|
1685
|
+
type: MatSliderModule,
|
|
1686
|
+
deps: [],
|
|
1687
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
1688
|
+
});
|
|
1689
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({
|
|
1690
|
+
minVersion: "14.0.0",
|
|
1691
|
+
version: "20.2.0-next.2",
|
|
1692
|
+
ngImport: i0,
|
|
1693
|
+
type: MatSliderModule,
|
|
1694
|
+
imports: [MatRippleModule, MatSlider, MatSliderThumb, MatSliderRangeThumb, MatSliderVisualThumb],
|
|
1695
|
+
exports: [MatSlider, MatSliderThumb, MatSliderRangeThumb, BidiModule]
|
|
1696
|
+
});
|
|
1697
|
+
static ɵinj = i0.ɵɵngDeclareInjector({
|
|
1698
|
+
minVersion: "12.0.0",
|
|
1699
|
+
version: "20.2.0-next.2",
|
|
1700
|
+
ngImport: i0,
|
|
1701
|
+
type: MatSliderModule,
|
|
1702
|
+
imports: [MatRippleModule, BidiModule]
|
|
1703
|
+
});
|
|
1775
1704
|
}
|
|
1776
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1705
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1706
|
+
minVersion: "12.0.0",
|
|
1707
|
+
version: "20.2.0-next.2",
|
|
1708
|
+
ngImport: i0,
|
|
1709
|
+
type: MatSliderModule,
|
|
1710
|
+
decorators: [{
|
|
1711
|
+
type: NgModule,
|
|
1712
|
+
args: [{
|
|
1713
|
+
imports: [MatRippleModule, MatSlider, MatSliderThumb, MatSliderRangeThumb, MatSliderVisualThumb],
|
|
1714
|
+
exports: [MatSlider, MatSliderThumb, MatSliderRangeThumb, BidiModule]
|
|
1715
|
+
}]
|
|
1716
|
+
}]
|
|
1717
|
+
});
|
|
1783
1718
|
|
|
1784
1719
|
export { MatSlider, MatSliderChange, MatSliderModule, MatSliderRangeThumb, MatSliderThumb, MatSliderVisualThumb };
|
|
1785
1720
|
//# sourceMappingURL=slider.mjs.map
|