material-slider.umd.js 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283
  1. /**
  2. * @license
  3. * Copyright Google LLC All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.io/license
  7. */
  8. (function (global, factory) {
  9. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/a11y'), require('@angular/cdk/bidi'), require('@angular/cdk/coercion'), require('@angular/cdk/keycodes'), require('@angular/core'), require('@angular/forms'), require('@angular/material/core'), require('@angular/platform-browser/animations'), require('rxjs'), require('@angular/common'), require('@angular/platform-browser')) :
  10. typeof define === 'function' && define.amd ? define('@angular/material/slider', ['exports', '@angular/cdk/a11y', '@angular/cdk/bidi', '@angular/cdk/coercion', '@angular/cdk/keycodes', '@angular/core', '@angular/forms', '@angular/material/core', '@angular/platform-browser/animations', 'rxjs', '@angular/common', '@angular/platform-browser'], factory) :
  11. (factory((global.ng = global.ng || {}, global.ng.material = global.ng.material || {}, global.ng.material.slider = {}),global.ng.cdk.a11y,global.ng.cdk.bidi,global.ng.cdk.coercion,global.ng.cdk.keycodes,global.ng.core,global.ng.forms,global.ng.material.core,global.ng.platformBrowser.animations,global.rxjs,global.ng.common,global.ng.platformBrowser));
  12. }(this, (function (exports,a11y,bidi,coercion,keycodes,core,forms,core$1,animations,rxjs,common,platformBrowser) { 'use strict';
  13. /*! *****************************************************************************
  14. Copyright (c) Microsoft Corporation. All rights reserved.
  15. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  16. this file except in compliance with the License. You may obtain a copy of the
  17. License at http://www.apache.org/licenses/LICENSE-2.0
  18. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  19. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  20. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  21. MERCHANTABLITY OR NON-INFRINGEMENT.
  22. See the Apache Version 2.0 License for specific language governing permissions
  23. and limitations under the License.
  24. ***************************************************************************** */
  25. /* global Reflect, Promise */
  26. var extendStatics = function(d, b) {
  27. extendStatics = Object.setPrototypeOf ||
  28. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  29. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  30. return extendStatics(d, b);
  31. };
  32. function __extends(d, b) {
  33. extendStatics(d, b);
  34. function __() { this.constructor = d; }
  35. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  36. }
  37. /**
  38. * @fileoverview added by tsickle
  39. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  40. */
  41. /**
  42. * Visually, a 30px separation between tick marks looks best. This is very subjective but it is
  43. * the default separation we chose.
  44. * @type {?}
  45. */
  46. var MIN_AUTO_TICK_SEPARATION = 30;
  47. /**
  48. * The thumb gap size for a disabled slider.
  49. * @type {?}
  50. */
  51. var DISABLED_THUMB_GAP = 7;
  52. /**
  53. * The thumb gap size for a non-active slider at its minimum value.
  54. * @type {?}
  55. */
  56. var MIN_VALUE_NONACTIVE_THUMB_GAP = 7;
  57. /**
  58. * The thumb gap size for an active slider at its minimum value.
  59. * @type {?}
  60. */
  61. var MIN_VALUE_ACTIVE_THUMB_GAP = 10;
  62. /**
  63. * Provider Expression that allows mat-slider to register as a ControlValueAccessor.
  64. * This allows it to support [(ngModel)] and [formControl].
  65. * \@docs-private
  66. * @type {?}
  67. */
  68. var MAT_SLIDER_VALUE_ACCESSOR = {
  69. provide: forms.NG_VALUE_ACCESSOR,
  70. useExisting: core.forwardRef((/**
  71. * @return {?}
  72. */
  73. function () { return MatSlider; })),
  74. multi: true
  75. };
  76. /**
  77. * A simple change event emitted by the MatSlider component.
  78. */
  79. var /**
  80. * A simple change event emitted by the MatSlider component.
  81. */
  82. MatSliderChange = /** @class */ (function () {
  83. function MatSliderChange() {
  84. }
  85. return MatSliderChange;
  86. }());
  87. // Boilerplate for applying mixins to MatSlider.
  88. /**
  89. * \@docs-private
  90. */
  91. var
  92. // Boilerplate for applying mixins to MatSlider.
  93. /**
  94. * \@docs-private
  95. */
  96. MatSliderBase = /** @class */ (function () {
  97. function MatSliderBase(_elementRef) {
  98. this._elementRef = _elementRef;
  99. }
  100. return MatSliderBase;
  101. }());
  102. /** @type {?} */
  103. var _MatSliderMixinBase = core$1.mixinTabIndex(core$1.mixinColor(core$1.mixinDisabled(MatSliderBase), 'accent'));
  104. /**
  105. * Allows users to select from a range of values by moving the slider thumb. It is similar in
  106. * behavior to the native `<input type="range">` element.
  107. */
  108. var MatSlider = /** @class */ (function (_super) {
  109. __extends(MatSlider, _super);
  110. function MatSlider(elementRef, _focusMonitor, _changeDetectorRef, _dir, tabIndex, _animationMode) {
  111. var _this = _super.call(this, elementRef) || this;
  112. _this._focusMonitor = _focusMonitor;
  113. _this._changeDetectorRef = _changeDetectorRef;
  114. _this._dir = _dir;
  115. _this._animationMode = _animationMode;
  116. _this._invert = false;
  117. _this._max = 100;
  118. _this._min = 0;
  119. _this._step = 1;
  120. _this._thumbLabel = false;
  121. _this._tickInterval = 0;
  122. _this._value = null;
  123. _this._vertical = false;
  124. /**
  125. * Event emitted when the slider value has changed.
  126. */
  127. _this.change = new core.EventEmitter();
  128. /**
  129. * Event emitted when the slider thumb moves.
  130. */
  131. _this.input = new core.EventEmitter();
  132. /**
  133. * Emits when the raw value of the slider changes. This is here primarily
  134. * to facilitate the two-way binding for the `value` input.
  135. * \@docs-private
  136. */
  137. _this.valueChange = new core.EventEmitter();
  138. /**
  139. * onTouch function registered via registerOnTouch (ControlValueAccessor).
  140. */
  141. _this.onTouched = (/**
  142. * @return {?}
  143. */
  144. function () { });
  145. _this._percent = 0;
  146. /**
  147. * Whether or not the thumb is sliding.
  148. * Used to determine if there should be a transition for the thumb and fill track.
  149. */
  150. _this._isSliding = false;
  151. /**
  152. * Whether or not the slider is active (clicked or sliding).
  153. * Used to shrink and grow the thumb as according to the Material Design spec.
  154. */
  155. _this._isActive = false;
  156. /**
  157. * The size of a tick interval as a percentage of the size of the track.
  158. */
  159. _this._tickIntervalPercent = 0;
  160. /**
  161. * The dimensions of the slider.
  162. */
  163. _this._sliderDimensions = null;
  164. _this._controlValueAccessorChangeFn = (/**
  165. * @return {?}
  166. */
  167. function () { });
  168. /**
  169. * Subscription to the Directionality change EventEmitter.
  170. */
  171. _this._dirChangeSubscription = rxjs.Subscription.EMPTY;
  172. _this.tabIndex = parseInt(tabIndex) || 0;
  173. return _this;
  174. }
  175. Object.defineProperty(MatSlider.prototype, "invert", {
  176. /** Whether the slider is inverted. */
  177. get: /**
  178. * Whether the slider is inverted.
  179. * @return {?}
  180. */
  181. function () { return this._invert; },
  182. set: /**
  183. * @param {?} value
  184. * @return {?}
  185. */
  186. function (value) {
  187. this._invert = coercion.coerceBooleanProperty(value);
  188. },
  189. enumerable: true,
  190. configurable: true
  191. });
  192. Object.defineProperty(MatSlider.prototype, "max", {
  193. /** The maximum value that the slider can have. */
  194. get: /**
  195. * The maximum value that the slider can have.
  196. * @return {?}
  197. */
  198. function () { return this._max; },
  199. set: /**
  200. * @param {?} v
  201. * @return {?}
  202. */
  203. function (v) {
  204. this._max = coercion.coerceNumberProperty(v, this._max);
  205. this._percent = this._calculatePercentage(this._value);
  206. // Since this also modifies the percentage, we need to let the change detection know.
  207. this._changeDetectorRef.markForCheck();
  208. },
  209. enumerable: true,
  210. configurable: true
  211. });
  212. Object.defineProperty(MatSlider.prototype, "min", {
  213. /** The minimum value that the slider can have. */
  214. get: /**
  215. * The minimum value that the slider can have.
  216. * @return {?}
  217. */
  218. function () { return this._min; },
  219. set: /**
  220. * @param {?} v
  221. * @return {?}
  222. */
  223. function (v) {
  224. this._min = coercion.coerceNumberProperty(v, this._min);
  225. // If the value wasn't explicitly set by the user, set it to the min.
  226. if (this._value === null) {
  227. this.value = this._min;
  228. }
  229. this._percent = this._calculatePercentage(this._value);
  230. // Since this also modifies the percentage, we need to let the change detection know.
  231. this._changeDetectorRef.markForCheck();
  232. },
  233. enumerable: true,
  234. configurable: true
  235. });
  236. Object.defineProperty(MatSlider.prototype, "step", {
  237. /** The values at which the thumb will snap. */
  238. get: /**
  239. * The values at which the thumb will snap.
  240. * @return {?}
  241. */
  242. function () { return this._step; },
  243. set: /**
  244. * @param {?} v
  245. * @return {?}
  246. */
  247. function (v) {
  248. this._step = coercion.coerceNumberProperty(v, this._step);
  249. if (this._step % 1 !== 0) {
  250. this._roundToDecimal = (/** @type {?} */ (this._step.toString().split('.').pop())).length;
  251. }
  252. // Since this could modify the label, we need to notify the change detection.
  253. this._changeDetectorRef.markForCheck();
  254. },
  255. enumerable: true,
  256. configurable: true
  257. });
  258. Object.defineProperty(MatSlider.prototype, "thumbLabel", {
  259. /** Whether or not to show the thumb label. */
  260. get: /**
  261. * Whether or not to show the thumb label.
  262. * @return {?}
  263. */
  264. function () { return this._thumbLabel; },
  265. set: /**
  266. * @param {?} value
  267. * @return {?}
  268. */
  269. function (value) { this._thumbLabel = coercion.coerceBooleanProperty(value); },
  270. enumerable: true,
  271. configurable: true
  272. });
  273. Object.defineProperty(MatSlider.prototype, "tickInterval", {
  274. /**
  275. * How often to show ticks. Relative to the step so that a tick always appears on a step.
  276. * Ex: Tick interval of 4 with a step of 3 will draw a tick every 4 steps (every 12 values).
  277. */
  278. get: /**
  279. * How often to show ticks. Relative to the step so that a tick always appears on a step.
  280. * Ex: Tick interval of 4 with a step of 3 will draw a tick every 4 steps (every 12 values).
  281. * @return {?}
  282. */
  283. function () { return this._tickInterval; },
  284. set: /**
  285. * @param {?} value
  286. * @return {?}
  287. */
  288. function (value) {
  289. if (value === 'auto') {
  290. this._tickInterval = 'auto';
  291. }
  292. else if (typeof value === 'number' || typeof value === 'string') {
  293. this._tickInterval = coercion.coerceNumberProperty(value, (/** @type {?} */ (this._tickInterval)));
  294. }
  295. else {
  296. this._tickInterval = 0;
  297. }
  298. },
  299. enumerable: true,
  300. configurable: true
  301. });
  302. Object.defineProperty(MatSlider.prototype, "value", {
  303. /** Value of the slider. */
  304. get: /**
  305. * Value of the slider.
  306. * @return {?}
  307. */
  308. function () {
  309. // If the value needs to be read and it is still uninitialized, initialize it to the min.
  310. if (this._value === null) {
  311. this.value = this._min;
  312. }
  313. return this._value;
  314. },
  315. set: /**
  316. * @param {?} v
  317. * @return {?}
  318. */
  319. function (v) {
  320. if (v !== this._value) {
  321. /** @type {?} */
  322. var value = coercion.coerceNumberProperty(v);
  323. // While incrementing by a decimal we can end up with values like 33.300000000000004.
  324. // Truncate it to ensure that it matches the label and to make it easier to work with.
  325. if (this._roundToDecimal) {
  326. value = parseFloat(value.toFixed(this._roundToDecimal));
  327. }
  328. this._value = value;
  329. this._percent = this._calculatePercentage(this._value);
  330. // Since this also modifies the percentage, we need to let the change detection know.
  331. this._changeDetectorRef.markForCheck();
  332. }
  333. },
  334. enumerable: true,
  335. configurable: true
  336. });
  337. Object.defineProperty(MatSlider.prototype, "vertical", {
  338. /** Whether the slider is vertical. */
  339. get: /**
  340. * Whether the slider is vertical.
  341. * @return {?}
  342. */
  343. function () { return this._vertical; },
  344. set: /**
  345. * @param {?} value
  346. * @return {?}
  347. */
  348. function (value) {
  349. this._vertical = coercion.coerceBooleanProperty(value);
  350. },
  351. enumerable: true,
  352. configurable: true
  353. });
  354. Object.defineProperty(MatSlider.prototype, "displayValue", {
  355. /** The value to be used for display purposes. */
  356. get: /**
  357. * The value to be used for display purposes.
  358. * @return {?}
  359. */
  360. function () {
  361. if (this.displayWith) {
  362. return this.displayWith(this.value);
  363. }
  364. // Note that this could be improved further by rounding something like 0.999 to 1 or
  365. // 0.899 to 0.9, however it is very performance sensitive, because it gets called on
  366. // every change detection cycle.
  367. if (this._roundToDecimal && this.value && this.value % 1 !== 0) {
  368. return this.value.toFixed(this._roundToDecimal);
  369. }
  370. return this.value || 0;
  371. },
  372. enumerable: true,
  373. configurable: true
  374. });
  375. /** set focus to the host element */
  376. /**
  377. * set focus to the host element
  378. * @param {?=} options
  379. * @return {?}
  380. */
  381. MatSlider.prototype.focus = /**
  382. * set focus to the host element
  383. * @param {?=} options
  384. * @return {?}
  385. */
  386. function (options) {
  387. this._focusHostElement(options);
  388. };
  389. /** blur the host element */
  390. /**
  391. * blur the host element
  392. * @return {?}
  393. */
  394. MatSlider.prototype.blur = /**
  395. * blur the host element
  396. * @return {?}
  397. */
  398. function () {
  399. this._blurHostElement();
  400. };
  401. Object.defineProperty(MatSlider.prototype, "percent", {
  402. /** The percentage of the slider that coincides with the value. */
  403. get: /**
  404. * The percentage of the slider that coincides with the value.
  405. * @return {?}
  406. */
  407. function () { return this._clamp(this._percent); },
  408. enumerable: true,
  409. configurable: true
  410. });
  411. Object.defineProperty(MatSlider.prototype, "_invertAxis", {
  412. /**
  413. * Whether the axis of the slider is inverted.
  414. * (i.e. whether moving the thumb in the positive x or y direction decreases the slider's value).
  415. */
  416. get: /**
  417. * Whether the axis of the slider is inverted.
  418. * (i.e. whether moving the thumb in the positive x or y direction decreases the slider's value).
  419. * @return {?}
  420. */
  421. function () {
  422. // Standard non-inverted mode for a vertical slider should be dragging the thumb from bottom to
  423. // top. However from a y-axis standpoint this is inverted.
  424. return this.vertical ? !this.invert : this.invert;
  425. },
  426. enumerable: true,
  427. configurable: true
  428. });
  429. Object.defineProperty(MatSlider.prototype, "_isMinValue", {
  430. /** Whether the slider is at its minimum value. */
  431. get: /**
  432. * Whether the slider is at its minimum value.
  433. * @return {?}
  434. */
  435. function () {
  436. return this.percent === 0;
  437. },
  438. enumerable: true,
  439. configurable: true
  440. });
  441. Object.defineProperty(MatSlider.prototype, "_thumbGap", {
  442. /**
  443. * The amount of space to leave between the slider thumb and the track fill & track background
  444. * elements.
  445. */
  446. get: /**
  447. * The amount of space to leave between the slider thumb and the track fill & track background
  448. * elements.
  449. * @return {?}
  450. */
  451. function () {
  452. if (this.disabled) {
  453. return DISABLED_THUMB_GAP;
  454. }
  455. if (this._isMinValue && !this.thumbLabel) {
  456. return this._isActive ? MIN_VALUE_ACTIVE_THUMB_GAP : MIN_VALUE_NONACTIVE_THUMB_GAP;
  457. }
  458. return 0;
  459. },
  460. enumerable: true,
  461. configurable: true
  462. });
  463. Object.defineProperty(MatSlider.prototype, "_trackBackgroundStyles", {
  464. /** CSS styles for the track background element. */
  465. get: /**
  466. * CSS styles for the track background element.
  467. * @return {?}
  468. */
  469. function () {
  470. /** @type {?} */
  471. var axis = this.vertical ? 'Y' : 'X';
  472. /** @type {?} */
  473. var scale = this.vertical ? "1, " + (1 - this.percent) + ", 1" : 1 - this.percent + ", 1, 1";
  474. /** @type {?} */
  475. var sign = this._shouldInvertMouseCoords() ? '-' : '';
  476. return {
  477. // scale3d avoids some rendering issues in Chrome. See #12071.
  478. transform: "translate" + axis + "(" + sign + this._thumbGap + "px) scale3d(" + scale + ")"
  479. };
  480. },
  481. enumerable: true,
  482. configurable: true
  483. });
  484. Object.defineProperty(MatSlider.prototype, "_trackFillStyles", {
  485. /** CSS styles for the track fill element. */
  486. get: /**
  487. * CSS styles for the track fill element.
  488. * @return {?}
  489. */
  490. function () {
  491. /** @type {?} */
  492. var axis = this.vertical ? 'Y' : 'X';
  493. /** @type {?} */
  494. var scale = this.vertical ? "1, " + this.percent + ", 1" : this.percent + ", 1, 1";
  495. /** @type {?} */
  496. var sign = this._shouldInvertMouseCoords() ? '' : '-';
  497. return {
  498. // scale3d avoids some rendering issues in Chrome. See #12071.
  499. transform: "translate" + axis + "(" + sign + this._thumbGap + "px) scale3d(" + scale + ")"
  500. };
  501. },
  502. enumerable: true,
  503. configurable: true
  504. });
  505. Object.defineProperty(MatSlider.prototype, "_ticksContainerStyles", {
  506. /** CSS styles for the ticks container element. */
  507. get: /**
  508. * CSS styles for the ticks container element.
  509. * @return {?}
  510. */
  511. function () {
  512. /** @type {?} */
  513. var axis = this.vertical ? 'Y' : 'X';
  514. // For a horizontal slider in RTL languages we push the ticks container off the left edge
  515. // instead of the right edge to avoid causing a horizontal scrollbar to appear.
  516. /** @type {?} */
  517. var sign = !this.vertical && this._getDirection() == 'rtl' ? '' : '-';
  518. /** @type {?} */
  519. var offset = this._tickIntervalPercent / 2 * 100;
  520. return {
  521. 'transform': "translate" + axis + "(" + sign + offset + "%)"
  522. };
  523. },
  524. enumerable: true,
  525. configurable: true
  526. });
  527. Object.defineProperty(MatSlider.prototype, "_ticksStyles", {
  528. /** CSS styles for the ticks element. */
  529. get: /**
  530. * CSS styles for the ticks element.
  531. * @return {?}
  532. */
  533. function () {
  534. /** @type {?} */
  535. var tickSize = this._tickIntervalPercent * 100;
  536. /** @type {?} */
  537. var backgroundSize = this.vertical ? "2px " + tickSize + "%" : tickSize + "% 2px";
  538. /** @type {?} */
  539. var axis = this.vertical ? 'Y' : 'X';
  540. // Depending on the direction we pushed the ticks container, push the ticks the opposite
  541. // direction to re-center them but clip off the end edge. In RTL languages we need to flip the
  542. // ticks 180 degrees so we're really cutting off the end edge abd not the start.
  543. /** @type {?} */
  544. var sign = !this.vertical && this._getDirection() == 'rtl' ? '-' : '';
  545. /** @type {?} */
  546. var rotate = !this.vertical && this._getDirection() == 'rtl' ? ' rotate(180deg)' : '';
  547. /** @type {?} */
  548. var styles = {
  549. 'backgroundSize': backgroundSize,
  550. // Without translateZ ticks sometimes jitter as the slider moves on Chrome & Firefox.
  551. 'transform': "translateZ(0) translate" + axis + "(" + sign + tickSize / 2 + "%)" + rotate
  552. };
  553. if (this._isMinValue && this._thumbGap) {
  554. /** @type {?} */
  555. var side = this.vertical ?
  556. (this._invertAxis ? 'Bottom' : 'Top') :
  557. (this._invertAxis ? 'Right' : 'Left');
  558. styles["padding" + side] = this._thumbGap + "px";
  559. }
  560. return styles;
  561. },
  562. enumerable: true,
  563. configurable: true
  564. });
  565. Object.defineProperty(MatSlider.prototype, "_thumbContainerStyles", {
  566. get: /**
  567. * @return {?}
  568. */
  569. function () {
  570. /** @type {?} */
  571. var axis = this.vertical ? 'Y' : 'X';
  572. // For a horizontal slider in RTL languages we push the thumb container off the left edge
  573. // instead of the right edge to avoid causing a horizontal scrollbar to appear.
  574. /** @type {?} */
  575. var invertOffset = (this._getDirection() == 'rtl' && !this.vertical) ? !this._invertAxis : this._invertAxis;
  576. /** @type {?} */
  577. var offset = (invertOffset ? this.percent : 1 - this.percent) * 100;
  578. return {
  579. 'transform': "translate" + axis + "(-" + offset + "%)"
  580. };
  581. },
  582. enumerable: true,
  583. configurable: true
  584. });
  585. /**
  586. * Whether mouse events should be converted to a slider position by calculating their distance
  587. * from the right or bottom edge of the slider as opposed to the top or left.
  588. */
  589. /**
  590. * Whether mouse events should be converted to a slider position by calculating their distance
  591. * from the right or bottom edge of the slider as opposed to the top or left.
  592. * @private
  593. * @return {?}
  594. */
  595. MatSlider.prototype._shouldInvertMouseCoords = /**
  596. * Whether mouse events should be converted to a slider position by calculating their distance
  597. * from the right or bottom edge of the slider as opposed to the top or left.
  598. * @private
  599. * @return {?}
  600. */
  601. function () {
  602. return (this._getDirection() == 'rtl' && !this.vertical) ? !this._invertAxis : this._invertAxis;
  603. };
  604. /** The language direction for this slider element. */
  605. /**
  606. * The language direction for this slider element.
  607. * @private
  608. * @return {?}
  609. */
  610. MatSlider.prototype._getDirection = /**
  611. * The language direction for this slider element.
  612. * @private
  613. * @return {?}
  614. */
  615. function () {
  616. return (this._dir && this._dir.value == 'rtl') ? 'rtl' : 'ltr';
  617. };
  618. /**
  619. * @return {?}
  620. */
  621. MatSlider.prototype.ngOnInit = /**
  622. * @return {?}
  623. */
  624. function () {
  625. var _this = this;
  626. this._focusMonitor
  627. .monitor(this._elementRef, true)
  628. .subscribe((/**
  629. * @param {?} origin
  630. * @return {?}
  631. */
  632. function (origin) {
  633. _this._isActive = !!origin && origin !== 'keyboard';
  634. _this._changeDetectorRef.detectChanges();
  635. }));
  636. if (this._dir) {
  637. this._dirChangeSubscription = this._dir.change.subscribe((/**
  638. * @return {?}
  639. */
  640. function () {
  641. _this._changeDetectorRef.markForCheck();
  642. }));
  643. }
  644. };
  645. /**
  646. * @return {?}
  647. */
  648. MatSlider.prototype.ngOnDestroy = /**
  649. * @return {?}
  650. */
  651. function () {
  652. this._focusMonitor.stopMonitoring(this._elementRef);
  653. this._dirChangeSubscription.unsubscribe();
  654. };
  655. /**
  656. * @return {?}
  657. */
  658. MatSlider.prototype._onMouseenter = /**
  659. * @return {?}
  660. */
  661. function () {
  662. if (this.disabled) {
  663. return;
  664. }
  665. // We save the dimensions of the slider here so we can use them to update the spacing of the
  666. // ticks and determine where on the slider click and slide events happen.
  667. this._sliderDimensions = this._getSliderDimensions();
  668. this._updateTickIntervalPercent();
  669. };
  670. /**
  671. * @param {?} event
  672. * @return {?}
  673. */
  674. MatSlider.prototype._onMousedown = /**
  675. * @param {?} event
  676. * @return {?}
  677. */
  678. function (event) {
  679. // Don't do anything if the slider is disabled or the
  680. // user is using anything other than the main mouse button.
  681. if (this.disabled || event.button !== 0) {
  682. return;
  683. }
  684. /** @type {?} */
  685. var oldValue = this.value;
  686. this._isSliding = false;
  687. this._focusHostElement();
  688. this._updateValueFromPosition({ x: event.clientX, y: event.clientY });
  689. // Emit a change and input event if the value changed.
  690. if (oldValue != this.value) {
  691. this._emitInputEvent();
  692. this._emitChangeEvent();
  693. }
  694. };
  695. /**
  696. * @param {?} event
  697. * @return {?}
  698. */
  699. MatSlider.prototype._onSlide = /**
  700. * @param {?} event
  701. * @return {?}
  702. */
  703. function (event) {
  704. if (this.disabled) {
  705. return;
  706. }
  707. // The slide start event sometimes fails to fire on iOS, so if we're not already in the sliding
  708. // state, call the slide start handler manually.
  709. if (!this._isSliding) {
  710. this._onSlideStart(null);
  711. }
  712. // Prevent the slide from selecting anything else.
  713. event.preventDefault();
  714. /** @type {?} */
  715. var oldValue = this.value;
  716. this._updateValueFromPosition({ x: event.center.x, y: event.center.y });
  717. // Native range elements always emit `input` events when the value changed while sliding.
  718. if (oldValue != this.value) {
  719. this._emitInputEvent();
  720. }
  721. };
  722. /**
  723. * @param {?} event
  724. * @return {?}
  725. */
  726. MatSlider.prototype._onSlideStart = /**
  727. * @param {?} event
  728. * @return {?}
  729. */
  730. function (event) {
  731. if (this.disabled || this._isSliding) {
  732. return;
  733. }
  734. // Simulate mouseenter in case this is a mobile device.
  735. this._onMouseenter();
  736. this._isSliding = true;
  737. this._focusHostElement();
  738. this._valueOnSlideStart = this.value;
  739. if (event) {
  740. this._updateValueFromPosition({ x: event.center.x, y: event.center.y });
  741. event.preventDefault();
  742. }
  743. };
  744. /**
  745. * @return {?}
  746. */
  747. MatSlider.prototype._onSlideEnd = /**
  748. * @return {?}
  749. */
  750. function () {
  751. this._isSliding = false;
  752. if (this._valueOnSlideStart != this.value && !this.disabled) {
  753. this._emitChangeEvent();
  754. }
  755. this._valueOnSlideStart = null;
  756. };
  757. /**
  758. * @return {?}
  759. */
  760. MatSlider.prototype._onFocus = /**
  761. * @return {?}
  762. */
  763. function () {
  764. // We save the dimensions of the slider here so we can use them to update the spacing of the
  765. // ticks and determine where on the slider click and slide events happen.
  766. this._sliderDimensions = this._getSliderDimensions();
  767. this._updateTickIntervalPercent();
  768. };
  769. /**
  770. * @return {?}
  771. */
  772. MatSlider.prototype._onBlur = /**
  773. * @return {?}
  774. */
  775. function () {
  776. this.onTouched();
  777. };
  778. /**
  779. * @param {?} event
  780. * @return {?}
  781. */
  782. MatSlider.prototype._onKeydown = /**
  783. * @param {?} event
  784. * @return {?}
  785. */
  786. function (event) {
  787. if (this.disabled || keycodes.hasModifierKey(event)) {
  788. return;
  789. }
  790. /** @type {?} */
  791. var oldValue = this.value;
  792. switch (event.keyCode) {
  793. case keycodes.PAGE_UP:
  794. this._increment(10);
  795. break;
  796. case keycodes.PAGE_DOWN:
  797. this._increment(-10);
  798. break;
  799. case keycodes.END:
  800. this.value = this.max;
  801. break;
  802. case keycodes.HOME:
  803. this.value = this.min;
  804. break;
  805. case keycodes.LEFT_ARROW:
  806. // NOTE: For a sighted user it would make more sense that when they press an arrow key on an
  807. // inverted slider the thumb moves in that direction. However for a blind user, nothing
  808. // about the slider indicates that it is inverted. They will expect left to be decrement,
  809. // regardless of how it appears on the screen. For speakers ofRTL languages, they probably
  810. // expect left to mean increment. Therefore we flip the meaning of the side arrow keys for
  811. // RTL. For inverted sliders we prefer a good a11y experience to having it "look right" for
  812. // sighted users, therefore we do not swap the meaning.
  813. this._increment(this._getDirection() == 'rtl' ? 1 : -1);
  814. break;
  815. case keycodes.UP_ARROW:
  816. this._increment(1);
  817. break;
  818. case keycodes.RIGHT_ARROW:
  819. // See comment on LEFT_ARROW about the conditions under which we flip the meaning.
  820. this._increment(this._getDirection() == 'rtl' ? -1 : 1);
  821. break;
  822. case keycodes.DOWN_ARROW:
  823. this._increment(-1);
  824. break;
  825. default:
  826. // Return if the key is not one that we explicitly handle to avoid calling preventDefault on
  827. // it.
  828. return;
  829. }
  830. if (oldValue != this.value) {
  831. this._emitInputEvent();
  832. this._emitChangeEvent();
  833. }
  834. this._isSliding = true;
  835. event.preventDefault();
  836. };
  837. /**
  838. * @return {?}
  839. */
  840. MatSlider.prototype._onKeyup = /**
  841. * @return {?}
  842. */
  843. function () {
  844. this._isSliding = false;
  845. };
  846. /** Increments the slider by the given number of steps (negative number decrements). */
  847. /**
  848. * Increments the slider by the given number of steps (negative number decrements).
  849. * @private
  850. * @param {?} numSteps
  851. * @return {?}
  852. */
  853. MatSlider.prototype._increment = /**
  854. * Increments the slider by the given number of steps (negative number decrements).
  855. * @private
  856. * @param {?} numSteps
  857. * @return {?}
  858. */
  859. function (numSteps) {
  860. this.value = this._clamp((this.value || 0) + this.step * numSteps, this.min, this.max);
  861. };
  862. /** Calculate the new value from the new physical location. The value will always be snapped. */
  863. /**
  864. * Calculate the new value from the new physical location. The value will always be snapped.
  865. * @private
  866. * @param {?} pos
  867. * @return {?}
  868. */
  869. MatSlider.prototype._updateValueFromPosition = /**
  870. * Calculate the new value from the new physical location. The value will always be snapped.
  871. * @private
  872. * @param {?} pos
  873. * @return {?}
  874. */
  875. function (pos) {
  876. if (!this._sliderDimensions) {
  877. return;
  878. }
  879. /** @type {?} */
  880. var offset = this.vertical ? this._sliderDimensions.top : this._sliderDimensions.left;
  881. /** @type {?} */
  882. var size = this.vertical ? this._sliderDimensions.height : this._sliderDimensions.width;
  883. /** @type {?} */
  884. var posComponent = this.vertical ? pos.y : pos.x;
  885. // The exact value is calculated from the event and used to find the closest snap value.
  886. /** @type {?} */
  887. var percent = this._clamp((posComponent - offset) / size);
  888. if (this._shouldInvertMouseCoords()) {
  889. percent = 1 - percent;
  890. }
  891. // Since the steps may not divide cleanly into the max value, if the user
  892. // slid to 0 or 100 percent, we jump to the min/max value. This approach
  893. // is slightly more intuitive than using `Math.ceil` below, because it
  894. // follows the user's pointer closer.
  895. if (percent === 0) {
  896. this.value = this.min;
  897. }
  898. else if (percent === 1) {
  899. this.value = this.max;
  900. }
  901. else {
  902. /** @type {?} */
  903. var exactValue = this._calculateValue(percent);
  904. // This calculation finds the closest step by finding the closest
  905. // whole number divisible by the step relative to the min.
  906. /** @type {?} */
  907. var closestValue = Math.round((exactValue - this.min) / this.step) * this.step + this.min;
  908. // The value needs to snap to the min and max.
  909. this.value = this._clamp(closestValue, this.min, this.max);
  910. }
  911. };
  912. /** Emits a change event if the current value is different from the last emitted value. */
  913. /**
  914. * Emits a change event if the current value is different from the last emitted value.
  915. * @private
  916. * @return {?}
  917. */
  918. MatSlider.prototype._emitChangeEvent = /**
  919. * Emits a change event if the current value is different from the last emitted value.
  920. * @private
  921. * @return {?}
  922. */
  923. function () {
  924. this._controlValueAccessorChangeFn(this.value);
  925. this.valueChange.emit(this.value);
  926. this.change.emit(this._createChangeEvent());
  927. };
  928. /** Emits an input event when the current value is different from the last emitted value. */
  929. /**
  930. * Emits an input event when the current value is different from the last emitted value.
  931. * @private
  932. * @return {?}
  933. */
  934. MatSlider.prototype._emitInputEvent = /**
  935. * Emits an input event when the current value is different from the last emitted value.
  936. * @private
  937. * @return {?}
  938. */
  939. function () {
  940. this.input.emit(this._createChangeEvent());
  941. };
  942. /** Updates the amount of space between ticks as a percentage of the width of the slider. */
  943. /**
  944. * Updates the amount of space between ticks as a percentage of the width of the slider.
  945. * @private
  946. * @return {?}
  947. */
  948. MatSlider.prototype._updateTickIntervalPercent = /**
  949. * Updates the amount of space between ticks as a percentage of the width of the slider.
  950. * @private
  951. * @return {?}
  952. */
  953. function () {
  954. if (!this.tickInterval || !this._sliderDimensions) {
  955. return;
  956. }
  957. if (this.tickInterval == 'auto') {
  958. /** @type {?} */
  959. var trackSize = this.vertical ? this._sliderDimensions.height : this._sliderDimensions.width;
  960. /** @type {?} */
  961. var pixelsPerStep = trackSize * this.step / (this.max - this.min);
  962. /** @type {?} */
  963. var stepsPerTick = Math.ceil(MIN_AUTO_TICK_SEPARATION / pixelsPerStep);
  964. /** @type {?} */
  965. var pixelsPerTick = stepsPerTick * this.step;
  966. this._tickIntervalPercent = pixelsPerTick / trackSize;
  967. }
  968. else {
  969. this._tickIntervalPercent = this.tickInterval * this.step / (this.max - this.min);
  970. }
  971. };
  972. /** Creates a slider change object from the specified value. */
  973. /**
  974. * Creates a slider change object from the specified value.
  975. * @private
  976. * @param {?=} value
  977. * @return {?}
  978. */
  979. MatSlider.prototype._createChangeEvent = /**
  980. * Creates a slider change object from the specified value.
  981. * @private
  982. * @param {?=} value
  983. * @return {?}
  984. */
  985. function (value) {
  986. if (value === void 0) { value = this.value; }
  987. /** @type {?} */
  988. var event = new MatSliderChange();
  989. event.source = this;
  990. event.value = value;
  991. return event;
  992. };
  993. /** Calculates the percentage of the slider that a value is. */
  994. /**
  995. * Calculates the percentage of the slider that a value is.
  996. * @private
  997. * @param {?} value
  998. * @return {?}
  999. */
  1000. MatSlider.prototype._calculatePercentage = /**
  1001. * Calculates the percentage of the slider that a value is.
  1002. * @private
  1003. * @param {?} value
  1004. * @return {?}
  1005. */
  1006. function (value) {
  1007. return ((value || 0) - this.min) / (this.max - this.min);
  1008. };
  1009. /** Calculates the value a percentage of the slider corresponds to. */
  1010. /**
  1011. * Calculates the value a percentage of the slider corresponds to.
  1012. * @private
  1013. * @param {?} percentage
  1014. * @return {?}
  1015. */
  1016. MatSlider.prototype._calculateValue = /**
  1017. * Calculates the value a percentage of the slider corresponds to.
  1018. * @private
  1019. * @param {?} percentage
  1020. * @return {?}
  1021. */
  1022. function (percentage) {
  1023. return this.min + percentage * (this.max - this.min);
  1024. };
  1025. /** Return a number between two numbers. */
  1026. /**
  1027. * Return a number between two numbers.
  1028. * @private
  1029. * @param {?} value
  1030. * @param {?=} min
  1031. * @param {?=} max
  1032. * @return {?}
  1033. */
  1034. MatSlider.prototype._clamp = /**
  1035. * Return a number between two numbers.
  1036. * @private
  1037. * @param {?} value
  1038. * @param {?=} min
  1039. * @param {?=} max
  1040. * @return {?}
  1041. */
  1042. function (value, min, max) {
  1043. if (min === void 0) { min = 0; }
  1044. if (max === void 0) { max = 1; }
  1045. return Math.max(min, Math.min(value, max));
  1046. };
  1047. /**
  1048. * Get the bounding client rect of the slider track element.
  1049. * The track is used rather than the native element to ignore the extra space that the thumb can
  1050. * take up.
  1051. */
  1052. /**
  1053. * Get the bounding client rect of the slider track element.
  1054. * The track is used rather than the native element to ignore the extra space that the thumb can
  1055. * take up.
  1056. * @private
  1057. * @return {?}
  1058. */
  1059. MatSlider.prototype._getSliderDimensions = /**
  1060. * Get the bounding client rect of the slider track element.
  1061. * The track is used rather than the native element to ignore the extra space that the thumb can
  1062. * take up.
  1063. * @private
  1064. * @return {?}
  1065. */
  1066. function () {
  1067. return this._sliderWrapper ? this._sliderWrapper.nativeElement.getBoundingClientRect() : null;
  1068. };
  1069. /**
  1070. * Focuses the native element.
  1071. * Currently only used to allow a blur event to fire but will be used with keyboard input later.
  1072. */
  1073. /**
  1074. * Focuses the native element.
  1075. * Currently only used to allow a blur event to fire but will be used with keyboard input later.
  1076. * @private
  1077. * @param {?=} options
  1078. * @return {?}
  1079. */
  1080. MatSlider.prototype._focusHostElement = /**
  1081. * Focuses the native element.
  1082. * Currently only used to allow a blur event to fire but will be used with keyboard input later.
  1083. * @private
  1084. * @param {?=} options
  1085. * @return {?}
  1086. */
  1087. function (options) {
  1088. this._elementRef.nativeElement.focus(options);
  1089. };
  1090. /** Blurs the native element. */
  1091. /**
  1092. * Blurs the native element.
  1093. * @private
  1094. * @return {?}
  1095. */
  1096. MatSlider.prototype._blurHostElement = /**
  1097. * Blurs the native element.
  1098. * @private
  1099. * @return {?}
  1100. */
  1101. function () {
  1102. this._elementRef.nativeElement.blur();
  1103. };
  1104. /**
  1105. * Sets the model value. Implemented as part of ControlValueAccessor.
  1106. * @param value
  1107. */
  1108. /**
  1109. * Sets the model value. Implemented as part of ControlValueAccessor.
  1110. * @param {?} value
  1111. * @return {?}
  1112. */
  1113. MatSlider.prototype.writeValue = /**
  1114. * Sets the model value. Implemented as part of ControlValueAccessor.
  1115. * @param {?} value
  1116. * @return {?}
  1117. */
  1118. function (value) {
  1119. this.value = value;
  1120. };
  1121. /**
  1122. * Registers a callback to be triggered when the value has changed.
  1123. * Implemented as part of ControlValueAccessor.
  1124. * @param fn Callback to be registered.
  1125. */
  1126. /**
  1127. * Registers a callback to be triggered when the value has changed.
  1128. * Implemented as part of ControlValueAccessor.
  1129. * @param {?} fn Callback to be registered.
  1130. * @return {?}
  1131. */
  1132. MatSlider.prototype.registerOnChange = /**
  1133. * Registers a callback to be triggered when the value has changed.
  1134. * Implemented as part of ControlValueAccessor.
  1135. * @param {?} fn Callback to be registered.
  1136. * @return {?}
  1137. */
  1138. function (fn) {
  1139. this._controlValueAccessorChangeFn = fn;
  1140. };
  1141. /**
  1142. * Registers a callback to be triggered when the component is touched.
  1143. * Implemented as part of ControlValueAccessor.
  1144. * @param fn Callback to be registered.
  1145. */
  1146. /**
  1147. * Registers a callback to be triggered when the component is touched.
  1148. * Implemented as part of ControlValueAccessor.
  1149. * @param {?} fn Callback to be registered.
  1150. * @return {?}
  1151. */
  1152. MatSlider.prototype.registerOnTouched = /**
  1153. * Registers a callback to be triggered when the component is touched.
  1154. * Implemented as part of ControlValueAccessor.
  1155. * @param {?} fn Callback to be registered.
  1156. * @return {?}
  1157. */
  1158. function (fn) {
  1159. this.onTouched = fn;
  1160. };
  1161. /**
  1162. * Sets whether the component should be disabled.
  1163. * Implemented as part of ControlValueAccessor.
  1164. * @param isDisabled
  1165. */
  1166. /**
  1167. * Sets whether the component should be disabled.
  1168. * Implemented as part of ControlValueAccessor.
  1169. * @param {?} isDisabled
  1170. * @return {?}
  1171. */
  1172. MatSlider.prototype.setDisabledState = /**
  1173. * Sets whether the component should be disabled.
  1174. * Implemented as part of ControlValueAccessor.
  1175. * @param {?} isDisabled
  1176. * @return {?}
  1177. */
  1178. function (isDisabled) {
  1179. this.disabled = isDisabled;
  1180. };
  1181. MatSlider.decorators = [
  1182. { type: core.Component, args: [{selector: 'mat-slider',
  1183. exportAs: 'matSlider',
  1184. providers: [MAT_SLIDER_VALUE_ACCESSOR],
  1185. host: {
  1186. '(focus)': '_onFocus()',
  1187. '(blur)': '_onBlur()',
  1188. '(mousedown)': '_onMousedown($event)',
  1189. '(keydown)': '_onKeydown($event)',
  1190. '(keyup)': '_onKeyup()',
  1191. '(mouseenter)': '_onMouseenter()',
  1192. '(slide)': '_onSlide($event)',
  1193. '(slideend)': '_onSlideEnd()',
  1194. '(slidestart)': '_onSlideStart($event)',
  1195. // On Safari starting to slide temporarily triggers text selection mode which
  1196. // show the wrong cursor. We prevent it by stopping the `selectstart` event.
  1197. '(selectstart)': '$event.preventDefault()',
  1198. 'class': 'mat-slider',
  1199. 'role': 'slider',
  1200. '[tabIndex]': 'tabIndex',
  1201. '[attr.aria-disabled]': 'disabled',
  1202. '[attr.aria-valuemax]': 'max',
  1203. '[attr.aria-valuemin]': 'min',
  1204. '[attr.aria-valuenow]': 'value',
  1205. '[attr.aria-orientation]': 'vertical ? "vertical" : "horizontal"',
  1206. '[class.mat-slider-disabled]': 'disabled',
  1207. '[class.mat-slider-has-ticks]': 'tickInterval',
  1208. '[class.mat-slider-horizontal]': '!vertical',
  1209. '[class.mat-slider-axis-inverted]': '_invertAxis',
  1210. '[class.mat-slider-sliding]': '_isSliding',
  1211. '[class.mat-slider-thumb-label-showing]': 'thumbLabel',
  1212. '[class.mat-slider-vertical]': 'vertical',
  1213. '[class.mat-slider-min-value]': '_isMinValue',
  1214. '[class.mat-slider-hide-last-tick]': 'disabled || _isMinValue && _thumbGap && _invertAxis',
  1215. '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
  1216. },
  1217. template: "<div class=\"mat-slider-wrapper\" #sliderWrapper><div class=\"mat-slider-track-wrapper\"><div class=\"mat-slider-track-background\" [ngStyle]=\"_trackBackgroundStyles\"></div><div class=\"mat-slider-track-fill\" [ngStyle]=\"_trackFillStyles\"></div></div><div class=\"mat-slider-ticks-container\" [ngStyle]=\"_ticksContainerStyles\"><div class=\"mat-slider-ticks\" [ngStyle]=\"_ticksStyles\"></div></div><div class=\"mat-slider-thumb-container\" [ngStyle]=\"_thumbContainerStyles\"><div class=\"mat-slider-focus-ring\"></div><div class=\"mat-slider-thumb\"></div><div class=\"mat-slider-thumb-label\"><span class=\"mat-slider-thumb-label-text\">{{displayValue}}</span></div></div></div>",
  1218. styles: [".mat-slider{display:inline-block;position:relative;box-sizing:border-box;padding:8px;outline:0;vertical-align:middle}.mat-slider.mat-slider-sliding:not(.mat-slider-disabled),.mat-slider:not(.mat-slider-disabled):active{cursor:-webkit-grabbing;cursor:grabbing}.mat-slider-wrapper{position:absolute}.mat-slider-track-wrapper{position:absolute;top:0;left:0;overflow:hidden}.mat-slider-track-fill{position:absolute;transform-origin:0 0;transition:transform .4s cubic-bezier(.25,.8,.25,1),background-color .4s cubic-bezier(.25,.8,.25,1)}.mat-slider-track-background{position:absolute;transform-origin:100% 100%;transition:transform .4s cubic-bezier(.25,.8,.25,1),background-color .4s cubic-bezier(.25,.8,.25,1)}.mat-slider-ticks-container{position:absolute;left:0;top:0;overflow:hidden}.mat-slider-ticks{background-repeat:repeat;background-clip:content-box;box-sizing:border-box;opacity:0;transition:opacity .4s cubic-bezier(.25,.8,.25,1)}.mat-slider-thumb-container{position:absolute;z-index:1;transition:transform .4s cubic-bezier(.25,.8,.25,1)}.mat-slider-focus-ring{position:absolute;width:30px;height:30px;border-radius:50%;transform:scale(0);opacity:0;transition:transform .4s cubic-bezier(.25,.8,.25,1),background-color .4s cubic-bezier(.25,.8,.25,1),opacity .4s cubic-bezier(.25,.8,.25,1)}.mat-slider.cdk-keyboard-focused .mat-slider-focus-ring,.mat-slider.cdk-program-focused .mat-slider-focus-ring{transform:scale(1);opacity:1}.mat-slider:not(.mat-slider-disabled):not(.mat-slider-sliding) .mat-slider-thumb,.mat-slider:not(.mat-slider-disabled):not(.mat-slider-sliding) .mat-slider-thumb-label{cursor:-webkit-grab;cursor:grab}.mat-slider-thumb{position:absolute;right:-10px;bottom:-10px;box-sizing:border-box;width:20px;height:20px;border:3px solid transparent;border-radius:50%;transform:scale(.7);transition:transform .4s cubic-bezier(.25,.8,.25,1),background-color .4s cubic-bezier(.25,.8,.25,1),border-color .4s cubic-bezier(.25,.8,.25,1)}.mat-slider-thumb-label{display:none;align-items:center;justify-content:center;position:absolute;width:28px;height:28px;border-radius:50%;transition:transform .4s cubic-bezier(.25,.8,.25,1),border-radius .4s cubic-bezier(.25,.8,.25,1),background-color .4s cubic-bezier(.25,.8,.25,1)}@media (-ms-high-contrast:active){.mat-slider-thumb-label{outline:solid 1px}}.mat-slider-thumb-label-text{z-index:1;opacity:0;transition:opacity .4s cubic-bezier(.25,.8,.25,1)}.mat-slider-sliding .mat-slider-thumb-container,.mat-slider-sliding .mat-slider-track-background,.mat-slider-sliding .mat-slider-track-fill{transition-duration:0s}.mat-slider-has-ticks .mat-slider-wrapper::after{content:'';position:absolute;border-width:0;border-style:solid;opacity:0;transition:opacity .4s cubic-bezier(.25,.8,.25,1)}.mat-slider-has-ticks.cdk-focused:not(.mat-slider-hide-last-tick) .mat-slider-wrapper::after,.mat-slider-has-ticks:hover:not(.mat-slider-hide-last-tick) .mat-slider-wrapper::after{opacity:1}.mat-slider-has-ticks.cdk-focused:not(.mat-slider-disabled) .mat-slider-ticks,.mat-slider-has-ticks:hover:not(.mat-slider-disabled) .mat-slider-ticks{opacity:1}.mat-slider-thumb-label-showing .mat-slider-focus-ring{display:none}.mat-slider-thumb-label-showing .mat-slider-thumb-label{display:flex}.mat-slider-axis-inverted .mat-slider-track-fill{transform-origin:100% 100%}.mat-slider-axis-inverted .mat-slider-track-background{transform-origin:0 0}.mat-slider:not(.mat-slider-disabled).cdk-focused.mat-slider-thumb-label-showing .mat-slider-thumb{transform:scale(0)}.mat-slider:not(.mat-slider-disabled).cdk-focused .mat-slider-thumb-label{border-radius:50% 50% 0}.mat-slider:not(.mat-slider-disabled).cdk-focused .mat-slider-thumb-label-text{opacity:1}.mat-slider:not(.mat-slider-disabled).cdk-mouse-focused .mat-slider-thumb,.mat-slider:not(.mat-slider-disabled).cdk-program-focused .mat-slider-thumb,.mat-slider:not(.mat-slider-disabled).cdk-touch-focused .mat-slider-thumb{border-width:2px;transform:scale(1)}.mat-slider-disabled .mat-slider-focus-ring{transform:scale(0);opacity:0}.mat-slider-disabled .mat-slider-thumb{border-width:4px;transform:scale(.5)}.mat-slider-disabled .mat-slider-thumb-label{display:none}.mat-slider-horizontal{height:48px;min-width:128px}.mat-slider-horizontal .mat-slider-wrapper{height:2px;top:23px;left:8px;right:8px}.mat-slider-horizontal .mat-slider-wrapper::after{height:2px;border-left-width:2px;right:0;top:0}.mat-slider-horizontal .mat-slider-track-wrapper{height:2px;width:100%}.mat-slider-horizontal .mat-slider-track-fill{height:2px;width:100%;transform:scaleX(0)}.mat-slider-horizontal .mat-slider-track-background{height:2px;width:100%;transform:scaleX(1)}.mat-slider-horizontal .mat-slider-ticks-container{height:2px;width:100%}@media (-ms-high-contrast:active){.mat-slider-horizontal .mat-slider-ticks-container{height:0;outline:solid 2px;top:1px}}.mat-slider-horizontal .mat-slider-ticks{height:2px;width:100%}.mat-slider-horizontal .mat-slider-thumb-container{width:100%;height:0;top:50%}.mat-slider-horizontal .mat-slider-focus-ring{top:-15px;right:-15px}.mat-slider-horizontal .mat-slider-thumb-label{right:-14px;top:-40px;transform:translateY(26px) scale(.01) rotate(45deg)}.mat-slider-horizontal .mat-slider-thumb-label-text{transform:rotate(-45deg)}.mat-slider-horizontal.cdk-focused .mat-slider-thumb-label{transform:rotate(45deg)}@media (-ms-high-contrast:active){.mat-slider-horizontal.cdk-focused .mat-slider-thumb-label,.mat-slider-horizontal.cdk-focused .mat-slider-thumb-label-text{transform:none}}.mat-slider-vertical{width:48px;min-height:128px}.mat-slider-vertical .mat-slider-wrapper{width:2px;top:8px;bottom:8px;left:23px}.mat-slider-vertical .mat-slider-wrapper::after{width:2px;border-top-width:2px;bottom:0;left:0}.mat-slider-vertical .mat-slider-track-wrapper{height:100%;width:2px}.mat-slider-vertical .mat-slider-track-fill{height:100%;width:2px;transform:scaleY(0)}.mat-slider-vertical .mat-slider-track-background{height:100%;width:2px;transform:scaleY(1)}.mat-slider-vertical .mat-slider-ticks-container{width:2px;height:100%}@media (-ms-high-contrast:active){.mat-slider-vertical .mat-slider-ticks-container{width:0;outline:solid 2px;left:1px}}.mat-slider-vertical .mat-slider-focus-ring{bottom:-15px;left:-15px}.mat-slider-vertical .mat-slider-ticks{width:2px;height:100%}.mat-slider-vertical .mat-slider-thumb-container{height:100%;width:0;left:50%}.mat-slider-vertical .mat-slider-thumb{-webkit-backface-visibility:hidden;backface-visibility:hidden}.mat-slider-vertical .mat-slider-thumb-label{bottom:-14px;left:-40px;transform:translateX(26px) scale(.01) rotate(-45deg)}.mat-slider-vertical .mat-slider-thumb-label-text{transform:rotate(45deg)}.mat-slider-vertical.cdk-focused .mat-slider-thumb-label{transform:rotate(-45deg)}[dir=rtl] .mat-slider-wrapper::after{left:0;right:auto}[dir=rtl] .mat-slider-horizontal .mat-slider-track-fill{transform-origin:100% 100%}[dir=rtl] .mat-slider-horizontal .mat-slider-track-background{transform-origin:0 0}[dir=rtl] .mat-slider-horizontal.mat-slider-axis-inverted .mat-slider-track-fill{transform-origin:0 0}[dir=rtl] .mat-slider-horizontal.mat-slider-axis-inverted .mat-slider-track-background{transform-origin:100% 100%}.mat-slider._mat-animation-noopable .mat-slider-focus-ring,.mat-slider._mat-animation-noopable .mat-slider-has-ticks .mat-slider-wrapper::after,.mat-slider._mat-animation-noopable .mat-slider-thumb,.mat-slider._mat-animation-noopable .mat-slider-thumb-container,.mat-slider._mat-animation-noopable .mat-slider-thumb-label,.mat-slider._mat-animation-noopable .mat-slider-thumb-label-text,.mat-slider._mat-animation-noopable .mat-slider-ticks,.mat-slider._mat-animation-noopable .mat-slider-track-background,.mat-slider._mat-animation-noopable .mat-slider-track-fill{transition:none}"],
  1219. inputs: ['disabled', 'color', 'tabIndex'],
  1220. encapsulation: core.ViewEncapsulation.None,
  1221. changeDetection: core.ChangeDetectionStrategy.OnPush,
  1222. },] },
  1223. ];
  1224. /** @nocollapse */
  1225. MatSlider.ctorParameters = function () { return [
  1226. { type: core.ElementRef },
  1227. { type: a11y.FocusMonitor },
  1228. { type: core.ChangeDetectorRef },
  1229. { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
  1230. { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] },
  1231. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
  1232. ]; };
  1233. MatSlider.propDecorators = {
  1234. invert: [{ type: core.Input }],
  1235. max: [{ type: core.Input }],
  1236. min: [{ type: core.Input }],
  1237. step: [{ type: core.Input }],
  1238. thumbLabel: [{ type: core.Input }],
  1239. tickInterval: [{ type: core.Input }],
  1240. value: [{ type: core.Input }],
  1241. displayWith: [{ type: core.Input }],
  1242. vertical: [{ type: core.Input }],
  1243. change: [{ type: core.Output }],
  1244. input: [{ type: core.Output }],
  1245. valueChange: [{ type: core.Output }],
  1246. _sliderWrapper: [{ type: core.ViewChild, args: ['sliderWrapper', { static: false },] }]
  1247. };
  1248. return MatSlider;
  1249. }(_MatSliderMixinBase));
  1250. /**
  1251. * @fileoverview added by tsickle
  1252. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1253. */
  1254. var MatSliderModule = /** @class */ (function () {
  1255. function MatSliderModule() {
  1256. }
  1257. MatSliderModule.decorators = [
  1258. { type: core.NgModule, args: [{
  1259. imports: [common.CommonModule, core$1.MatCommonModule],
  1260. exports: [MatSlider, core$1.MatCommonModule],
  1261. declarations: [MatSlider],
  1262. providers: [{ provide: platformBrowser.HAMMER_GESTURE_CONFIG, useClass: core$1.GestureConfig }]
  1263. },] },
  1264. ];
  1265. return MatSliderModule;
  1266. }());
  1267. exports.MatSliderModule = MatSliderModule;
  1268. exports.MAT_SLIDER_VALUE_ACCESSOR = MAT_SLIDER_VALUE_ACCESSOR;
  1269. exports.MatSliderChange = MatSliderChange;
  1270. exports.MatSlider = MatSlider;
  1271. Object.defineProperty(exports, '__esModule', { value: true });
  1272. })));
  1273. //# sourceMappingURL=material-slider.umd.js.map