ngx-perfect-scrollbar.umd.js 81 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs'), require('rxjs/operators'), require('@angular/core'), require('@angular/common'), require('perfect-scrollbar')) :
  3. typeof define === 'function' && define.amd ? define(['exports', 'rxjs', 'rxjs/operators', '@angular/core', '@angular/common', 'perfect-scrollbar'], factory) :
  4. (global = global || self, factory((global.zef = global.zef || {}, global.zef.ngxPerfectScrollbar = {}), global.Rx, global.Rx.Observable.prototype, global.ng.core, global.ng.common, global.PerfectScrollbar));
  5. }(this, function (exports, rxjs, operators, core, common, PerfectScrollbar) { 'use strict';
  6. PerfectScrollbar = PerfectScrollbar && PerfectScrollbar.hasOwnProperty('default') ? PerfectScrollbar['default'] : PerfectScrollbar;
  7. /**
  8. * A collection of shims that provide minimal functionality of the ES6 collections.
  9. *
  10. * These implementations are not meant to be used outside of the ResizeObserver
  11. * modules as they cover only a limited range of use cases.
  12. */
  13. /* eslint-disable require-jsdoc, valid-jsdoc */
  14. var MapShim = (function () {
  15. if (typeof Map !== 'undefined') {
  16. return Map;
  17. }
  18. /**
  19. * Returns index in provided array that matches the specified key.
  20. *
  21. * @param {Array<Array>} arr
  22. * @param {*} key
  23. * @returns {number}
  24. */
  25. function getIndex(arr, key) {
  26. var result = -1;
  27. arr.some(function (entry, index) {
  28. if (entry[0] === key) {
  29. result = index;
  30. return true;
  31. }
  32. return false;
  33. });
  34. return result;
  35. }
  36. return /** @class */ (function () {
  37. function class_1() {
  38. this.__entries__ = [];
  39. }
  40. Object.defineProperty(class_1.prototype, "size", {
  41. /**
  42. * @returns {boolean}
  43. */
  44. get: function () {
  45. return this.__entries__.length;
  46. },
  47. enumerable: true,
  48. configurable: true
  49. });
  50. /**
  51. * @param {*} key
  52. * @returns {*}
  53. */
  54. class_1.prototype.get = function (key) {
  55. var index = getIndex(this.__entries__, key);
  56. var entry = this.__entries__[index];
  57. return entry && entry[1];
  58. };
  59. /**
  60. * @param {*} key
  61. * @param {*} value
  62. * @returns {void}
  63. */
  64. class_1.prototype.set = function (key, value) {
  65. var index = getIndex(this.__entries__, key);
  66. if (~index) {
  67. this.__entries__[index][1] = value;
  68. }
  69. else {
  70. this.__entries__.push([key, value]);
  71. }
  72. };
  73. /**
  74. * @param {*} key
  75. * @returns {void}
  76. */
  77. class_1.prototype.delete = function (key) {
  78. var entries = this.__entries__;
  79. var index = getIndex(entries, key);
  80. if (~index) {
  81. entries.splice(index, 1);
  82. }
  83. };
  84. /**
  85. * @param {*} key
  86. * @returns {void}
  87. */
  88. class_1.prototype.has = function (key) {
  89. return !!~getIndex(this.__entries__, key);
  90. };
  91. /**
  92. * @returns {void}
  93. */
  94. class_1.prototype.clear = function () {
  95. this.__entries__.splice(0);
  96. };
  97. /**
  98. * @param {Function} callback
  99. * @param {*} [ctx=null]
  100. * @returns {void}
  101. */
  102. class_1.prototype.forEach = function (callback, ctx) {
  103. if (ctx === void 0) { ctx = null; }
  104. for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) {
  105. var entry = _a[_i];
  106. callback.call(ctx, entry[1], entry[0]);
  107. }
  108. };
  109. return class_1;
  110. }());
  111. })();
  112. /**
  113. * Detects whether window and document objects are available in current environment.
  114. */
  115. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document;
  116. // Returns global object of a current environment.
  117. var global$1 = (function () {
  118. if (typeof global !== 'undefined' && global.Math === Math) {
  119. return global;
  120. }
  121. if (typeof self !== 'undefined' && self.Math === Math) {
  122. return self;
  123. }
  124. if (typeof window !== 'undefined' && window.Math === Math) {
  125. return window;
  126. }
  127. // eslint-disable-next-line no-new-func
  128. return Function('return this')();
  129. })();
  130. /**
  131. * A shim for the requestAnimationFrame which falls back to the setTimeout if
  132. * first one is not supported.
  133. *
  134. * @returns {number} Requests' identifier.
  135. */
  136. var requestAnimationFrame$1 = (function () {
  137. if (typeof requestAnimationFrame === 'function') {
  138. // It's required to use a bounded function because IE sometimes throws
  139. // an "Invalid calling object" error if rAF is invoked without the global
  140. // object on the left hand side.
  141. return requestAnimationFrame.bind(global$1);
  142. }
  143. return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); };
  144. })();
  145. // Defines minimum timeout before adding a trailing call.
  146. var trailingTimeout = 2;
  147. /**
  148. * Creates a wrapper function which ensures that provided callback will be
  149. * invoked only once during the specified delay period.
  150. *
  151. * @param {Function} callback - Function to be invoked after the delay period.
  152. * @param {number} delay - Delay after which to invoke callback.
  153. * @returns {Function}
  154. */
  155. function throttle (callback, delay) {
  156. var leadingCall = false, trailingCall = false, lastCallTime = 0;
  157. /**
  158. * Invokes the original callback function and schedules new invocation if
  159. * the "proxy" was called during current request.
  160. *
  161. * @returns {void}
  162. */
  163. function resolvePending() {
  164. if (leadingCall) {
  165. leadingCall = false;
  166. callback();
  167. }
  168. if (trailingCall) {
  169. proxy();
  170. }
  171. }
  172. /**
  173. * Callback invoked after the specified delay. It will further postpone
  174. * invocation of the original function delegating it to the
  175. * requestAnimationFrame.
  176. *
  177. * @returns {void}
  178. */
  179. function timeoutCallback() {
  180. requestAnimationFrame$1(resolvePending);
  181. }
  182. /**
  183. * Schedules invocation of the original function.
  184. *
  185. * @returns {void}
  186. */
  187. function proxy() {
  188. var timeStamp = Date.now();
  189. if (leadingCall) {
  190. // Reject immediately following calls.
  191. if (timeStamp - lastCallTime < trailingTimeout) {
  192. return;
  193. }
  194. // Schedule new call to be in invoked when the pending one is resolved.
  195. // This is important for "transitions" which never actually start
  196. // immediately so there is a chance that we might miss one if change
  197. // happens amids the pending invocation.
  198. trailingCall = true;
  199. }
  200. else {
  201. leadingCall = true;
  202. trailingCall = false;
  203. setTimeout(timeoutCallback, delay);
  204. }
  205. lastCallTime = timeStamp;
  206. }
  207. return proxy;
  208. }
  209. // Minimum delay before invoking the update of observers.
  210. var REFRESH_DELAY = 20;
  211. // A list of substrings of CSS properties used to find transition events that
  212. // might affect dimensions of observed elements.
  213. var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight'];
  214. // Check if MutationObserver is available.
  215. var mutationObserverSupported = typeof MutationObserver !== 'undefined';
  216. /**
  217. * Singleton controller class which handles updates of ResizeObserver instances.
  218. */
  219. var ResizeObserverController = /** @class */ (function () {
  220. /**
  221. * Creates a new instance of ResizeObserverController.
  222. *
  223. * @private
  224. */
  225. function ResizeObserverController() {
  226. /**
  227. * Indicates whether DOM listeners have been added.
  228. *
  229. * @private {boolean}
  230. */
  231. this.connected_ = false;
  232. /**
  233. * Tells that controller has subscribed for Mutation Events.
  234. *
  235. * @private {boolean}
  236. */
  237. this.mutationEventsAdded_ = false;
  238. /**
  239. * Keeps reference to the instance of MutationObserver.
  240. *
  241. * @private {MutationObserver}
  242. */
  243. this.mutationsObserver_ = null;
  244. /**
  245. * A list of connected observers.
  246. *
  247. * @private {Array<ResizeObserverSPI>}
  248. */
  249. this.observers_ = [];
  250. this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
  251. this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY);
  252. }
  253. /**
  254. * Adds observer to observers list.
  255. *
  256. * @param {ResizeObserverSPI} observer - Observer to be added.
  257. * @returns {void}
  258. */
  259. ResizeObserverController.prototype.addObserver = function (observer) {
  260. if (!~this.observers_.indexOf(observer)) {
  261. this.observers_.push(observer);
  262. }
  263. // Add listeners if they haven't been added yet.
  264. if (!this.connected_) {
  265. this.connect_();
  266. }
  267. };
  268. /**
  269. * Removes observer from observers list.
  270. *
  271. * @param {ResizeObserverSPI} observer - Observer to be removed.
  272. * @returns {void}
  273. */
  274. ResizeObserverController.prototype.removeObserver = function (observer) {
  275. var observers = this.observers_;
  276. var index = observers.indexOf(observer);
  277. // Remove observer if it's present in registry.
  278. if (~index) {
  279. observers.splice(index, 1);
  280. }
  281. // Remove listeners if controller has no connected observers.
  282. if (!observers.length && this.connected_) {
  283. this.disconnect_();
  284. }
  285. };
  286. /**
  287. * Invokes the update of observers. It will continue running updates insofar
  288. * it detects changes.
  289. *
  290. * @returns {void}
  291. */
  292. ResizeObserverController.prototype.refresh = function () {
  293. var changesDetected = this.updateObservers_();
  294. // Continue running updates if changes have been detected as there might
  295. // be future ones caused by CSS transitions.
  296. if (changesDetected) {
  297. this.refresh();
  298. }
  299. };
  300. /**
  301. * Updates every observer from observers list and notifies them of queued
  302. * entries.
  303. *
  304. * @private
  305. * @returns {boolean} Returns "true" if any observer has detected changes in
  306. * dimensions of it's elements.
  307. */
  308. ResizeObserverController.prototype.updateObservers_ = function () {
  309. // Collect observers that have active observations.
  310. var activeObservers = this.observers_.filter(function (observer) {
  311. return observer.gatherActive(), observer.hasActive();
  312. });
  313. // Deliver notifications in a separate cycle in order to avoid any
  314. // collisions between observers, e.g. when multiple instances of
  315. // ResizeObserver are tracking the same element and the callback of one
  316. // of them changes content dimensions of the observed target. Sometimes
  317. // this may result in notifications being blocked for the rest of observers.
  318. activeObservers.forEach(function (observer) { return observer.broadcastActive(); });
  319. return activeObservers.length > 0;
  320. };
  321. /**
  322. * Initializes DOM listeners.
  323. *
  324. * @private
  325. * @returns {void}
  326. */
  327. ResizeObserverController.prototype.connect_ = function () {
  328. // Do nothing if running in a non-browser environment or if listeners
  329. // have been already added.
  330. if (!isBrowser || this.connected_) {
  331. return;
  332. }
  333. // Subscription to the "Transitionend" event is used as a workaround for
  334. // delayed transitions. This way it's possible to capture at least the
  335. // final state of an element.
  336. document.addEventListener('transitionend', this.onTransitionEnd_);
  337. window.addEventListener('resize', this.refresh);
  338. if (mutationObserverSupported) {
  339. this.mutationsObserver_ = new MutationObserver(this.refresh);
  340. this.mutationsObserver_.observe(document, {
  341. attributes: true,
  342. childList: true,
  343. characterData: true,
  344. subtree: true
  345. });
  346. }
  347. else {
  348. document.addEventListener('DOMSubtreeModified', this.refresh);
  349. this.mutationEventsAdded_ = true;
  350. }
  351. this.connected_ = true;
  352. };
  353. /**
  354. * Removes DOM listeners.
  355. *
  356. * @private
  357. * @returns {void}
  358. */
  359. ResizeObserverController.prototype.disconnect_ = function () {
  360. // Do nothing if running in a non-browser environment or if listeners
  361. // have been already removed.
  362. if (!isBrowser || !this.connected_) {
  363. return;
  364. }
  365. document.removeEventListener('transitionend', this.onTransitionEnd_);
  366. window.removeEventListener('resize', this.refresh);
  367. if (this.mutationsObserver_) {
  368. this.mutationsObserver_.disconnect();
  369. }
  370. if (this.mutationEventsAdded_) {
  371. document.removeEventListener('DOMSubtreeModified', this.refresh);
  372. }
  373. this.mutationsObserver_ = null;
  374. this.mutationEventsAdded_ = false;
  375. this.connected_ = false;
  376. };
  377. /**
  378. * "Transitionend" event handler.
  379. *
  380. * @private
  381. * @param {TransitionEvent} event
  382. * @returns {void}
  383. */
  384. ResizeObserverController.prototype.onTransitionEnd_ = function (_a) {
  385. var _b = _a.propertyName, propertyName = _b === void 0 ? '' : _b;
  386. // Detect whether transition may affect dimensions of an element.
  387. var isReflowProperty = transitionKeys.some(function (key) {
  388. return !!~propertyName.indexOf(key);
  389. });
  390. if (isReflowProperty) {
  391. this.refresh();
  392. }
  393. };
  394. /**
  395. * Returns instance of the ResizeObserverController.
  396. *
  397. * @returns {ResizeObserverController}
  398. */
  399. ResizeObserverController.getInstance = function () {
  400. if (!this.instance_) {
  401. this.instance_ = new ResizeObserverController();
  402. }
  403. return this.instance_;
  404. };
  405. /**
  406. * Holds reference to the controller's instance.
  407. *
  408. * @private {ResizeObserverController}
  409. */
  410. ResizeObserverController.instance_ = null;
  411. return ResizeObserverController;
  412. }());
  413. /**
  414. * Defines non-writable/enumerable properties of the provided target object.
  415. *
  416. * @param {Object} target - Object for which to define properties.
  417. * @param {Object} props - Properties to be defined.
  418. * @returns {Object} Target object.
  419. */
  420. var defineConfigurable = (function (target, props) {
  421. for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {
  422. var key = _a[_i];
  423. Object.defineProperty(target, key, {
  424. value: props[key],
  425. enumerable: false,
  426. writable: false,
  427. configurable: true
  428. });
  429. }
  430. return target;
  431. });
  432. /**
  433. * Returns the global object associated with provided element.
  434. *
  435. * @param {Object} target
  436. * @returns {Object}
  437. */
  438. var getWindowOf = (function (target) {
  439. // Assume that the element is an instance of Node, which means that it
  440. // has the "ownerDocument" property from which we can retrieve a
  441. // corresponding global object.
  442. var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;
  443. // Return the local global object if it's not possible extract one from
  444. // provided element.
  445. return ownerGlobal || global$1;
  446. });
  447. // Placeholder of an empty content rectangle.
  448. var emptyRect = createRectInit(0, 0, 0, 0);
  449. /**
  450. * Converts provided string to a number.
  451. *
  452. * @param {number|string} value
  453. * @returns {number}
  454. */
  455. function toFloat(value) {
  456. return parseFloat(value) || 0;
  457. }
  458. /**
  459. * Extracts borders size from provided styles.
  460. *
  461. * @param {CSSStyleDeclaration} styles
  462. * @param {...string} positions - Borders positions (top, right, ...)
  463. * @returns {number}
  464. */
  465. function getBordersSize(styles) {
  466. var positions = [];
  467. for (var _i = 1; _i < arguments.length; _i++) {
  468. positions[_i - 1] = arguments[_i];
  469. }
  470. return positions.reduce(function (size, position) {
  471. var value = styles['border-' + position + '-width'];
  472. return size + toFloat(value);
  473. }, 0);
  474. }
  475. /**
  476. * Extracts paddings sizes from provided styles.
  477. *
  478. * @param {CSSStyleDeclaration} styles
  479. * @returns {Object} Paddings box.
  480. */
  481. function getPaddings(styles) {
  482. var positions = ['top', 'right', 'bottom', 'left'];
  483. var paddings = {};
  484. for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
  485. var position = positions_1[_i];
  486. var value = styles['padding-' + position];
  487. paddings[position] = toFloat(value);
  488. }
  489. return paddings;
  490. }
  491. /**
  492. * Calculates content rectangle of provided SVG element.
  493. *
  494. * @param {SVGGraphicsElement} target - Element content rectangle of which needs
  495. * to be calculated.
  496. * @returns {DOMRectInit}
  497. */
  498. function getSVGContentRect(target) {
  499. var bbox = target.getBBox();
  500. return createRectInit(0, 0, bbox.width, bbox.height);
  501. }
  502. /**
  503. * Calculates content rectangle of provided HTMLElement.
  504. *
  505. * @param {HTMLElement} target - Element for which to calculate the content rectangle.
  506. * @returns {DOMRectInit}
  507. */
  508. function getHTMLElementContentRect(target) {
  509. // Client width & height properties can't be
  510. // used exclusively as they provide rounded values.
  511. var clientWidth = target.clientWidth, clientHeight = target.clientHeight;
  512. // By this condition we can catch all non-replaced inline, hidden and
  513. // detached elements. Though elements with width & height properties less
  514. // than 0.5 will be discarded as well.
  515. //
  516. // Without it we would need to implement separate methods for each of
  517. // those cases and it's not possible to perform a precise and performance
  518. // effective test for hidden elements. E.g. even jQuery's ':visible' filter
  519. // gives wrong results for elements with width & height less than 0.5.
  520. if (!clientWidth && !clientHeight) {
  521. return emptyRect;
  522. }
  523. var styles = getWindowOf(target).getComputedStyle(target);
  524. var paddings = getPaddings(styles);
  525. var horizPad = paddings.left + paddings.right;
  526. var vertPad = paddings.top + paddings.bottom;
  527. // Computed styles of width & height are being used because they are the
  528. // only dimensions available to JS that contain non-rounded values. It could
  529. // be possible to utilize the getBoundingClientRect if only it's data wasn't
  530. // affected by CSS transformations let alone paddings, borders and scroll bars.
  531. var width = toFloat(styles.width), height = toFloat(styles.height);
  532. // Width & height include paddings and borders when the 'border-box' box
  533. // model is applied (except for IE).
  534. if (styles.boxSizing === 'border-box') {
  535. // Following conditions are required to handle Internet Explorer which
  536. // doesn't include paddings and borders to computed CSS dimensions.
  537. //
  538. // We can say that if CSS dimensions + paddings are equal to the "client"
  539. // properties then it's either IE, and thus we don't need to subtract
  540. // anything, or an element merely doesn't have paddings/borders styles.
  541. if (Math.round(width + horizPad) !== clientWidth) {
  542. width -= getBordersSize(styles, 'left', 'right') + horizPad;
  543. }
  544. if (Math.round(height + vertPad) !== clientHeight) {
  545. height -= getBordersSize(styles, 'top', 'bottom') + vertPad;
  546. }
  547. }
  548. // Following steps can't be applied to the document's root element as its
  549. // client[Width/Height] properties represent viewport area of the window.
  550. // Besides, it's as well not necessary as the <html> itself neither has
  551. // rendered scroll bars nor it can be clipped.
  552. if (!isDocumentElement(target)) {
  553. // In some browsers (only in Firefox, actually) CSS width & height
  554. // include scroll bars size which can be removed at this step as scroll
  555. // bars are the only difference between rounded dimensions + paddings
  556. // and "client" properties, though that is not always true in Chrome.
  557. var vertScrollbar = Math.round(width + horizPad) - clientWidth;
  558. var horizScrollbar = Math.round(height + vertPad) - clientHeight;
  559. // Chrome has a rather weird rounding of "client" properties.
  560. // E.g. for an element with content width of 314.2px it sometimes gives
  561. // the client width of 315px and for the width of 314.7px it may give
  562. // 314px. And it doesn't happen all the time. So just ignore this delta
  563. // as a non-relevant.
  564. if (Math.abs(vertScrollbar) !== 1) {
  565. width -= vertScrollbar;
  566. }
  567. if (Math.abs(horizScrollbar) !== 1) {
  568. height -= horizScrollbar;
  569. }
  570. }
  571. return createRectInit(paddings.left, paddings.top, width, height);
  572. }
  573. /**
  574. * Checks whether provided element is an instance of the SVGGraphicsElement.
  575. *
  576. * @param {Element} target - Element to be checked.
  577. * @returns {boolean}
  578. */
  579. var isSVGGraphicsElement = (function () {
  580. // Some browsers, namely IE and Edge, don't have the SVGGraphicsElement
  581. // interface.
  582. if (typeof SVGGraphicsElement !== 'undefined') {
  583. return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; };
  584. }
  585. // If it's so, then check that element is at least an instance of the
  586. // SVGElement and that it has the "getBBox" method.
  587. // eslint-disable-next-line no-extra-parens
  588. return function (target) { return (target instanceof getWindowOf(target).SVGElement &&
  589. typeof target.getBBox === 'function'); };
  590. })();
  591. /**
  592. * Checks whether provided element is a document element (<html>).
  593. *
  594. * @param {Element} target - Element to be checked.
  595. * @returns {boolean}
  596. */
  597. function isDocumentElement(target) {
  598. return target === getWindowOf(target).document.documentElement;
  599. }
  600. /**
  601. * Calculates an appropriate content rectangle for provided html or svg element.
  602. *
  603. * @param {Element} target - Element content rectangle of which needs to be calculated.
  604. * @returns {DOMRectInit}
  605. */
  606. function getContentRect(target) {
  607. if (!isBrowser) {
  608. return emptyRect;
  609. }
  610. if (isSVGGraphicsElement(target)) {
  611. return getSVGContentRect(target);
  612. }
  613. return getHTMLElementContentRect(target);
  614. }
  615. /**
  616. * Creates rectangle with an interface of the DOMRectReadOnly.
  617. * Spec: https://drafts.fxtf.org/geometry/#domrectreadonly
  618. *
  619. * @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions.
  620. * @returns {DOMRectReadOnly}
  621. */
  622. function createReadOnlyRect(_a) {
  623. var x = _a.x, y = _a.y, width = _a.width, height = _a.height;
  624. // If DOMRectReadOnly is available use it as a prototype for the rectangle.
  625. var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object;
  626. var rect = Object.create(Constr.prototype);
  627. // Rectangle's properties are not writable and non-enumerable.
  628. defineConfigurable(rect, {
  629. x: x, y: y, width: width, height: height,
  630. top: y,
  631. right: x + width,
  632. bottom: height + y,
  633. left: x
  634. });
  635. return rect;
  636. }
  637. /**
  638. * Creates DOMRectInit object based on the provided dimensions and the x/y coordinates.
  639. * Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit
  640. *
  641. * @param {number} x - X coordinate.
  642. * @param {number} y - Y coordinate.
  643. * @param {number} width - Rectangle's width.
  644. * @param {number} height - Rectangle's height.
  645. * @returns {DOMRectInit}
  646. */
  647. function createRectInit(x, y, width, height) {
  648. return { x: x, y: y, width: width, height: height };
  649. }
  650. /**
  651. * Class that is responsible for computations of the content rectangle of
  652. * provided DOM element and for keeping track of it's changes.
  653. */
  654. var ResizeObservation = /** @class */ (function () {
  655. /**
  656. * Creates an instance of ResizeObservation.
  657. *
  658. * @param {Element} target - Element to be observed.
  659. */
  660. function ResizeObservation(target) {
  661. /**
  662. * Broadcasted width of content rectangle.
  663. *
  664. * @type {number}
  665. */
  666. this.broadcastWidth = 0;
  667. /**
  668. * Broadcasted height of content rectangle.
  669. *
  670. * @type {number}
  671. */
  672. this.broadcastHeight = 0;
  673. /**
  674. * Reference to the last observed content rectangle.
  675. *
  676. * @private {DOMRectInit}
  677. */
  678. this.contentRect_ = createRectInit(0, 0, 0, 0);
  679. this.target = target;
  680. }
  681. /**
  682. * Updates content rectangle and tells whether it's width or height properties
  683. * have changed since the last broadcast.
  684. *
  685. * @returns {boolean}
  686. */
  687. ResizeObservation.prototype.isActive = function () {
  688. var rect = getContentRect(this.target);
  689. this.contentRect_ = rect;
  690. return (rect.width !== this.broadcastWidth ||
  691. rect.height !== this.broadcastHeight);
  692. };
  693. /**
  694. * Updates 'broadcastWidth' and 'broadcastHeight' properties with a data
  695. * from the corresponding properties of the last observed content rectangle.
  696. *
  697. * @returns {DOMRectInit} Last observed content rectangle.
  698. */
  699. ResizeObservation.prototype.broadcastRect = function () {
  700. var rect = this.contentRect_;
  701. this.broadcastWidth = rect.width;
  702. this.broadcastHeight = rect.height;
  703. return rect;
  704. };
  705. return ResizeObservation;
  706. }());
  707. var ResizeObserverEntry = /** @class */ (function () {
  708. /**
  709. * Creates an instance of ResizeObserverEntry.
  710. *
  711. * @param {Element} target - Element that is being observed.
  712. * @param {DOMRectInit} rectInit - Data of the element's content rectangle.
  713. */
  714. function ResizeObserverEntry(target, rectInit) {
  715. var contentRect = createReadOnlyRect(rectInit);
  716. // According to the specification following properties are not writable
  717. // and are also not enumerable in the native implementation.
  718. //
  719. // Property accessors are not being used as they'd require to define a
  720. // private WeakMap storage which may cause memory leaks in browsers that
  721. // don't support this type of collections.
  722. defineConfigurable(this, { target: target, contentRect: contentRect });
  723. }
  724. return ResizeObserverEntry;
  725. }());
  726. var ResizeObserverSPI = /** @class */ (function () {
  727. /**
  728. * Creates a new instance of ResizeObserver.
  729. *
  730. * @param {ResizeObserverCallback} callback - Callback function that is invoked
  731. * when one of the observed elements changes it's content dimensions.
  732. * @param {ResizeObserverController} controller - Controller instance which
  733. * is responsible for the updates of observer.
  734. * @param {ResizeObserver} callbackCtx - Reference to the public
  735. * ResizeObserver instance which will be passed to callback function.
  736. */
  737. function ResizeObserverSPI(callback, controller, callbackCtx) {
  738. /**
  739. * Collection of resize observations that have detected changes in dimensions
  740. * of elements.
  741. *
  742. * @private {Array<ResizeObservation>}
  743. */
  744. this.activeObservations_ = [];
  745. /**
  746. * Registry of the ResizeObservation instances.
  747. *
  748. * @private {Map<Element, ResizeObservation>}
  749. */
  750. this.observations_ = new MapShim();
  751. if (typeof callback !== 'function') {
  752. throw new TypeError('The callback provided as parameter 1 is not a function.');
  753. }
  754. this.callback_ = callback;
  755. this.controller_ = controller;
  756. this.callbackCtx_ = callbackCtx;
  757. }
  758. /**
  759. * Starts observing provided element.
  760. *
  761. * @param {Element} target - Element to be observed.
  762. * @returns {void}
  763. */
  764. ResizeObserverSPI.prototype.observe = function (target) {
  765. if (!arguments.length) {
  766. throw new TypeError('1 argument required, but only 0 present.');
  767. }
  768. // Do nothing if current environment doesn't have the Element interface.
  769. if (typeof Element === 'undefined' || !(Element instanceof Object)) {
  770. return;
  771. }
  772. if (!(target instanceof getWindowOf(target).Element)) {
  773. throw new TypeError('parameter 1 is not of type "Element".');
  774. }
  775. var observations = this.observations_;
  776. // Do nothing if element is already being observed.
  777. if (observations.has(target)) {
  778. return;
  779. }
  780. observations.set(target, new ResizeObservation(target));
  781. this.controller_.addObserver(this);
  782. // Force the update of observations.
  783. this.controller_.refresh();
  784. };
  785. /**
  786. * Stops observing provided element.
  787. *
  788. * @param {Element} target - Element to stop observing.
  789. * @returns {void}
  790. */
  791. ResizeObserverSPI.prototype.unobserve = function (target) {
  792. if (!arguments.length) {
  793. throw new TypeError('1 argument required, but only 0 present.');
  794. }
  795. // Do nothing if current environment doesn't have the Element interface.
  796. if (typeof Element === 'undefined' || !(Element instanceof Object)) {
  797. return;
  798. }
  799. if (!(target instanceof getWindowOf(target).Element)) {
  800. throw new TypeError('parameter 1 is not of type "Element".');
  801. }
  802. var observations = this.observations_;
  803. // Do nothing if element is not being observed.
  804. if (!observations.has(target)) {
  805. return;
  806. }
  807. observations.delete(target);
  808. if (!observations.size) {
  809. this.controller_.removeObserver(this);
  810. }
  811. };
  812. /**
  813. * Stops observing all elements.
  814. *
  815. * @returns {void}
  816. */
  817. ResizeObserverSPI.prototype.disconnect = function () {
  818. this.clearActive();
  819. this.observations_.clear();
  820. this.controller_.removeObserver(this);
  821. };
  822. /**
  823. * Collects observation instances the associated element of which has changed
  824. * it's content rectangle.
  825. *
  826. * @returns {void}
  827. */
  828. ResizeObserverSPI.prototype.gatherActive = function () {
  829. var _this = this;
  830. this.clearActive();
  831. this.observations_.forEach(function (observation) {
  832. if (observation.isActive()) {
  833. _this.activeObservations_.push(observation);
  834. }
  835. });
  836. };
  837. /**
  838. * Invokes initial callback function with a list of ResizeObserverEntry
  839. * instances collected from active resize observations.
  840. *
  841. * @returns {void}
  842. */
  843. ResizeObserverSPI.prototype.broadcastActive = function () {
  844. // Do nothing if observer doesn't have active observations.
  845. if (!this.hasActive()) {
  846. return;
  847. }
  848. var ctx = this.callbackCtx_;
  849. // Create ResizeObserverEntry instance for every active observation.
  850. var entries = this.activeObservations_.map(function (observation) {
  851. return new ResizeObserverEntry(observation.target, observation.broadcastRect());
  852. });
  853. this.callback_.call(ctx, entries, ctx);
  854. this.clearActive();
  855. };
  856. /**
  857. * Clears the collection of active observations.
  858. *
  859. * @returns {void}
  860. */
  861. ResizeObserverSPI.prototype.clearActive = function () {
  862. this.activeObservations_.splice(0);
  863. };
  864. /**
  865. * Tells whether observer has active observations.
  866. *
  867. * @returns {boolean}
  868. */
  869. ResizeObserverSPI.prototype.hasActive = function () {
  870. return this.activeObservations_.length > 0;
  871. };
  872. return ResizeObserverSPI;
  873. }());
  874. // Registry of internal observers. If WeakMap is not available use current shim
  875. // for the Map collection as it has all required methods and because WeakMap
  876. // can't be fully polyfilled anyway.
  877. var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim();
  878. /**
  879. * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation
  880. * exposing only those methods and properties that are defined in the spec.
  881. */
  882. var ResizeObserver = /** @class */ (function () {
  883. /**
  884. * Creates a new instance of ResizeObserver.
  885. *
  886. * @param {ResizeObserverCallback} callback - Callback that is invoked when
  887. * dimensions of the observed elements change.
  888. */
  889. function ResizeObserver(callback) {
  890. if (!(this instanceof ResizeObserver)) {
  891. throw new TypeError('Cannot call a class as a function.');
  892. }
  893. if (!arguments.length) {
  894. throw new TypeError('1 argument required, but only 0 present.');
  895. }
  896. var controller = ResizeObserverController.getInstance();
  897. var observer = new ResizeObserverSPI(callback, controller, this);
  898. observers.set(this, observer);
  899. }
  900. return ResizeObserver;
  901. }());
  902. // Expose public methods of ResizeObserver.
  903. [
  904. 'observe',
  905. 'unobserve',
  906. 'disconnect'
  907. ].forEach(function (method) {
  908. ResizeObserver.prototype[method] = function () {
  909. var _a;
  910. return (_a = observers.get(this))[method].apply(_a, arguments);
  911. };
  912. });
  913. var index = (function () {
  914. // Export existing implementation if available.
  915. if (typeof global$1.ResizeObserver !== 'undefined') {
  916. return global$1.ResizeObserver;
  917. }
  918. return ResizeObserver;
  919. })();
  920. /**
  921. * @fileoverview added by tsickle
  922. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  923. */
  924. /** @type {?} */
  925. var PERFECT_SCROLLBAR_CONFIG = new core.InjectionToken('PERFECT_SCROLLBAR_CONFIG');
  926. var Geometry = /** @class */ (function () {
  927. function Geometry(x, y, w, h) {
  928. this.x = x;
  929. this.y = y;
  930. this.w = w;
  931. this.h = h;
  932. }
  933. return Geometry;
  934. }());
  935. var Position = /** @class */ (function () {
  936. function Position(x, y) {
  937. this.x = x;
  938. this.y = y;
  939. }
  940. return Position;
  941. }());
  942. /** @type {?} */
  943. var PerfectScrollbarEvents = [
  944. 'psScrollY',
  945. 'psScrollX',
  946. 'psScrollUp',
  947. 'psScrollDown',
  948. 'psScrollLeft',
  949. 'psScrollRight',
  950. 'psYReachEnd',
  951. 'psYReachStart',
  952. 'psXReachEnd',
  953. 'psXReachStart'
  954. ];
  955. var PerfectScrollbarConfig = /** @class */ (function () {
  956. function PerfectScrollbarConfig(config) {
  957. if (config === void 0) { config = {}; }
  958. this.assign(config);
  959. }
  960. /**
  961. * @param {?=} config
  962. * @return {?}
  963. */
  964. PerfectScrollbarConfig.prototype.assign = /**
  965. * @param {?=} config
  966. * @return {?}
  967. */
  968. function (config) {
  969. if (config === void 0) { config = {}; }
  970. for (var key in config) {
  971. this[(/** @type {?} */ (key))] = config[(/** @type {?} */ (key))];
  972. }
  973. };
  974. return PerfectScrollbarConfig;
  975. }());
  976. /**
  977. * @fileoverview added by tsickle
  978. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  979. */
  980. var PerfectScrollbarDirective = /** @class */ (function () {
  981. function PerfectScrollbarDirective(zone, differs, elementRef, platformId, defaults) {
  982. this.zone = zone;
  983. this.differs = differs;
  984. this.elementRef = elementRef;
  985. this.platformId = platformId;
  986. this.defaults = defaults;
  987. this.instance = null;
  988. this.ro = null;
  989. this.timeout = null;
  990. this.animation = null;
  991. this.configDiff = null;
  992. this.ngDestroy = new rxjs.Subject();
  993. this.disabled = false;
  994. this.psScrollY = new core.EventEmitter();
  995. this.psScrollX = new core.EventEmitter();
  996. this.psScrollUp = new core.EventEmitter();
  997. this.psScrollDown = new core.EventEmitter();
  998. this.psScrollLeft = new core.EventEmitter();
  999. this.psScrollRight = new core.EventEmitter();
  1000. this.psYReachEnd = new core.EventEmitter();
  1001. this.psYReachStart = new core.EventEmitter();
  1002. this.psXReachEnd = new core.EventEmitter();
  1003. this.psXReachStart = new core.EventEmitter();
  1004. }
  1005. /**
  1006. * @return {?}
  1007. */
  1008. PerfectScrollbarDirective.prototype.ngOnInit = /**
  1009. * @return {?}
  1010. */
  1011. function () {
  1012. var _this = this;
  1013. if (!this.disabled && common.isPlatformBrowser(this.platformId)) {
  1014. /** @type {?} */
  1015. var config_1 = new PerfectScrollbarConfig(this.defaults);
  1016. config_1.assign(this.config); // Custom configuration
  1017. this.zone.runOutsideAngular((/**
  1018. * @return {?}
  1019. */
  1020. function () {
  1021. _this.instance = new PerfectScrollbar(_this.elementRef.nativeElement, config_1);
  1022. }));
  1023. if (!this.configDiff) {
  1024. this.configDiff = this.differs.find(this.config || {}).create();
  1025. this.configDiff.diff(this.config || {});
  1026. }
  1027. this.zone.runOutsideAngular((/**
  1028. * @return {?}
  1029. */
  1030. function () {
  1031. _this.ro = new index((/**
  1032. * @return {?}
  1033. */
  1034. function () {
  1035. _this.update();
  1036. }));
  1037. if (_this.elementRef.nativeElement.children[0]) {
  1038. _this.ro.observe(_this.elementRef.nativeElement.children[0]);
  1039. }
  1040. _this.ro.observe(_this.elementRef.nativeElement);
  1041. }));
  1042. this.zone.runOutsideAngular((/**
  1043. * @return {?}
  1044. */
  1045. function () {
  1046. PerfectScrollbarEvents.forEach((/**
  1047. * @param {?} eventName
  1048. * @return {?}
  1049. */
  1050. function (eventName) {
  1051. /** @type {?} */
  1052. var eventType = eventName.replace(/([A-Z])/g, (/**
  1053. * @param {?} c
  1054. * @return {?}
  1055. */
  1056. function (c) { return "-" + c.toLowerCase(); }));
  1057. rxjs.fromEvent(_this.elementRef.nativeElement, eventType)
  1058. .pipe(operators.auditTime(20), operators.takeUntil(_this.ngDestroy))
  1059. .subscribe((/**
  1060. * @param {?} event
  1061. * @return {?}
  1062. */
  1063. function (event) {
  1064. _this[eventName].emit(event);
  1065. }));
  1066. }));
  1067. }));
  1068. }
  1069. };
  1070. /**
  1071. * @return {?}
  1072. */
  1073. PerfectScrollbarDirective.prototype.ngOnDestroy = /**
  1074. * @return {?}
  1075. */
  1076. function () {
  1077. var _this = this;
  1078. if (common.isPlatformBrowser(this.platformId)) {
  1079. this.ngDestroy.next();
  1080. this.ngDestroy.complete();
  1081. if (this.ro) {
  1082. this.ro.disconnect();
  1083. }
  1084. if (this.timeout && typeof window !== 'undefined') {
  1085. window.clearTimeout(this.timeout);
  1086. }
  1087. this.zone.runOutsideAngular((/**
  1088. * @return {?}
  1089. */
  1090. function () {
  1091. if (_this.instance) {
  1092. _this.instance.destroy();
  1093. }
  1094. }));
  1095. this.instance = null;
  1096. }
  1097. };
  1098. /**
  1099. * @return {?}
  1100. */
  1101. PerfectScrollbarDirective.prototype.ngDoCheck = /**
  1102. * @return {?}
  1103. */
  1104. function () {
  1105. if (!this.disabled && this.configDiff && common.isPlatformBrowser(this.platformId)) {
  1106. /** @type {?} */
  1107. var changes = this.configDiff.diff(this.config || {});
  1108. if (changes) {
  1109. this.ngOnDestroy();
  1110. this.ngOnInit();
  1111. }
  1112. }
  1113. };
  1114. /**
  1115. * @param {?} changes
  1116. * @return {?}
  1117. */
  1118. PerfectScrollbarDirective.prototype.ngOnChanges = /**
  1119. * @param {?} changes
  1120. * @return {?}
  1121. */
  1122. function (changes) {
  1123. if (changes['disabled'] && !changes['disabled'].isFirstChange() && common.isPlatformBrowser(this.platformId)) {
  1124. if (changes['disabled'].currentValue !== changes['disabled'].previousValue) {
  1125. if (changes['disabled'].currentValue === true) {
  1126. this.ngOnDestroy();
  1127. }
  1128. else if (changes['disabled'].currentValue === false) {
  1129. this.ngOnInit();
  1130. }
  1131. }
  1132. }
  1133. };
  1134. /**
  1135. * @return {?}
  1136. */
  1137. PerfectScrollbarDirective.prototype.ps = /**
  1138. * @return {?}
  1139. */
  1140. function () {
  1141. return this.instance;
  1142. };
  1143. /**
  1144. * @return {?}
  1145. */
  1146. PerfectScrollbarDirective.prototype.update = /**
  1147. * @return {?}
  1148. */
  1149. function () {
  1150. var _this = this;
  1151. if (typeof window !== 'undefined') {
  1152. if (this.timeout) {
  1153. window.clearTimeout(this.timeout);
  1154. }
  1155. this.timeout = window.setTimeout((/**
  1156. * @return {?}
  1157. */
  1158. function () {
  1159. if (!_this.disabled && _this.configDiff) {
  1160. try {
  1161. _this.zone.runOutsideAngular((/**
  1162. * @return {?}
  1163. */
  1164. function () {
  1165. if (_this.instance) {
  1166. _this.instance.update();
  1167. }
  1168. }));
  1169. }
  1170. catch (error) {
  1171. // Update can be finished after destroy so catch errors
  1172. }
  1173. }
  1174. }), 0);
  1175. }
  1176. };
  1177. /**
  1178. * @param {?=} prefix
  1179. * @return {?}
  1180. */
  1181. PerfectScrollbarDirective.prototype.geometry = /**
  1182. * @param {?=} prefix
  1183. * @return {?}
  1184. */
  1185. function (prefix) {
  1186. if (prefix === void 0) { prefix = 'scroll'; }
  1187. return new Geometry(this.elementRef.nativeElement[prefix + 'Left'], this.elementRef.nativeElement[prefix + 'Top'], this.elementRef.nativeElement[prefix + 'Width'], this.elementRef.nativeElement[prefix + 'Height']);
  1188. };
  1189. /**
  1190. * @param {?=} absolute
  1191. * @return {?}
  1192. */
  1193. PerfectScrollbarDirective.prototype.position = /**
  1194. * @param {?=} absolute
  1195. * @return {?}
  1196. */
  1197. function (absolute) {
  1198. if (absolute === void 0) { absolute = false; }
  1199. if (!absolute && this.instance) {
  1200. return new Position(this.instance.reach.x || 0, this.instance.reach.y || 0);
  1201. }
  1202. else {
  1203. return new Position(this.elementRef.nativeElement.scrollLeft, this.elementRef.nativeElement.scrollTop);
  1204. }
  1205. };
  1206. /**
  1207. * @param {?=} direction
  1208. * @return {?}
  1209. */
  1210. PerfectScrollbarDirective.prototype.scrollable = /**
  1211. * @param {?=} direction
  1212. * @return {?}
  1213. */
  1214. function (direction) {
  1215. if (direction === void 0) { direction = 'any'; }
  1216. /** @type {?} */
  1217. var element = this.elementRef.nativeElement;
  1218. if (direction === 'any') {
  1219. return element.classList.contains('ps--active-x') ||
  1220. element.classList.contains('ps--active-y');
  1221. }
  1222. else if (direction === 'both') {
  1223. return element.classList.contains('ps--active-x') &&
  1224. element.classList.contains('ps--active-y');
  1225. }
  1226. else {
  1227. return element.classList.contains('ps--active-' + direction);
  1228. }
  1229. };
  1230. /**
  1231. * @param {?} x
  1232. * @param {?=} y
  1233. * @param {?=} speed
  1234. * @return {?}
  1235. */
  1236. PerfectScrollbarDirective.prototype.scrollTo = /**
  1237. * @param {?} x
  1238. * @param {?=} y
  1239. * @param {?=} speed
  1240. * @return {?}
  1241. */
  1242. function (x, y, speed) {
  1243. if (!this.disabled) {
  1244. if (y == null && speed == null) {
  1245. this.animateScrolling('scrollTop', x, speed);
  1246. }
  1247. else {
  1248. if (x != null) {
  1249. this.animateScrolling('scrollLeft', x, speed);
  1250. }
  1251. if (y != null) {
  1252. this.animateScrolling('scrollTop', y, speed);
  1253. }
  1254. }
  1255. }
  1256. };
  1257. /**
  1258. * @param {?} x
  1259. * @param {?=} speed
  1260. * @return {?}
  1261. */
  1262. PerfectScrollbarDirective.prototype.scrollToX = /**
  1263. * @param {?} x
  1264. * @param {?=} speed
  1265. * @return {?}
  1266. */
  1267. function (x, speed) {
  1268. this.animateScrolling('scrollLeft', x, speed);
  1269. };
  1270. /**
  1271. * @param {?} y
  1272. * @param {?=} speed
  1273. * @return {?}
  1274. */
  1275. PerfectScrollbarDirective.prototype.scrollToY = /**
  1276. * @param {?} y
  1277. * @param {?=} speed
  1278. * @return {?}
  1279. */
  1280. function (y, speed) {
  1281. this.animateScrolling('scrollTop', y, speed);
  1282. };
  1283. /**
  1284. * @param {?=} offset
  1285. * @param {?=} speed
  1286. * @return {?}
  1287. */
  1288. PerfectScrollbarDirective.prototype.scrollToTop = /**
  1289. * @param {?=} offset
  1290. * @param {?=} speed
  1291. * @return {?}
  1292. */
  1293. function (offset, speed) {
  1294. this.animateScrolling('scrollTop', (offset || 0), speed);
  1295. };
  1296. /**
  1297. * @param {?=} offset
  1298. * @param {?=} speed
  1299. * @return {?}
  1300. */
  1301. PerfectScrollbarDirective.prototype.scrollToLeft = /**
  1302. * @param {?=} offset
  1303. * @param {?=} speed
  1304. * @return {?}
  1305. */
  1306. function (offset, speed) {
  1307. this.animateScrolling('scrollLeft', (offset || 0), speed);
  1308. };
  1309. /**
  1310. * @param {?=} offset
  1311. * @param {?=} speed
  1312. * @return {?}
  1313. */
  1314. PerfectScrollbarDirective.prototype.scrollToRight = /**
  1315. * @param {?=} offset
  1316. * @param {?=} speed
  1317. * @return {?}
  1318. */
  1319. function (offset, speed) {
  1320. /** @type {?} */
  1321. var left = this.elementRef.nativeElement.scrollWidth -
  1322. this.elementRef.nativeElement.clientWidth;
  1323. this.animateScrolling('scrollLeft', left - (offset || 0), speed);
  1324. };
  1325. /**
  1326. * @param {?=} offset
  1327. * @param {?=} speed
  1328. * @return {?}
  1329. */
  1330. PerfectScrollbarDirective.prototype.scrollToBottom = /**
  1331. * @param {?=} offset
  1332. * @param {?=} speed
  1333. * @return {?}
  1334. */
  1335. function (offset, speed) {
  1336. /** @type {?} */
  1337. var top = this.elementRef.nativeElement.scrollHeight -
  1338. this.elementRef.nativeElement.clientHeight;
  1339. this.animateScrolling('scrollTop', top - (offset || 0), speed);
  1340. };
  1341. /**
  1342. * @param {?} qs
  1343. * @param {?=} offset
  1344. * @param {?=} speed
  1345. * @return {?}
  1346. */
  1347. PerfectScrollbarDirective.prototype.scrollToElement = /**
  1348. * @param {?} qs
  1349. * @param {?=} offset
  1350. * @param {?=} speed
  1351. * @return {?}
  1352. */
  1353. function (qs, offset, speed) {
  1354. /** @type {?} */
  1355. var element = this.elementRef.nativeElement.querySelector(qs);
  1356. if (element) {
  1357. /** @type {?} */
  1358. var elementPos = element.getBoundingClientRect();
  1359. /** @type {?} */
  1360. var scrollerPos = this.elementRef.nativeElement.getBoundingClientRect();
  1361. if (this.elementRef.nativeElement.classList.contains('ps--active-x')) {
  1362. /** @type {?} */
  1363. var currentPos = this.elementRef.nativeElement['scrollLeft'];
  1364. /** @type {?} */
  1365. var position = elementPos.left - scrollerPos.left + currentPos;
  1366. this.animateScrolling('scrollLeft', position + (offset || 0), speed);
  1367. }
  1368. if (this.elementRef.nativeElement.classList.contains('ps--active-y')) {
  1369. /** @type {?} */
  1370. var currentPos = this.elementRef.nativeElement['scrollTop'];
  1371. /** @type {?} */
  1372. var position = elementPos.top - scrollerPos.top + currentPos;
  1373. this.animateScrolling('scrollTop', position + (offset || 0), speed);
  1374. }
  1375. }
  1376. };
  1377. /**
  1378. * @private
  1379. * @param {?} target
  1380. * @param {?} value
  1381. * @param {?=} speed
  1382. * @return {?}
  1383. */
  1384. PerfectScrollbarDirective.prototype.animateScrolling = /**
  1385. * @private
  1386. * @param {?} target
  1387. * @param {?} value
  1388. * @param {?=} speed
  1389. * @return {?}
  1390. */
  1391. function (target, value, speed) {
  1392. var _this = this;
  1393. if (this.animation) {
  1394. window.cancelAnimationFrame(this.animation);
  1395. this.animation = null;
  1396. }
  1397. if (!speed || typeof window === 'undefined') {
  1398. this.elementRef.nativeElement[target] = value;
  1399. }
  1400. else if (value !== this.elementRef.nativeElement[target]) {
  1401. /** @type {?} */
  1402. var newValue_1 = 0;
  1403. /** @type {?} */
  1404. var scrollCount_1 = 0;
  1405. /** @type {?} */
  1406. var oldTimestamp_1 = performance.now();
  1407. /** @type {?} */
  1408. var oldValue_1 = this.elementRef.nativeElement[target];
  1409. /** @type {?} */
  1410. var cosParameter_1 = (oldValue_1 - value) / 2;
  1411. /** @type {?} */
  1412. var step_1 = (/**
  1413. * @param {?} newTimestamp
  1414. * @return {?}
  1415. */
  1416. function (newTimestamp) {
  1417. scrollCount_1 += Math.PI / (speed / (newTimestamp - oldTimestamp_1));
  1418. newValue_1 = Math.round(value + cosParameter_1 + cosParameter_1 * Math.cos(scrollCount_1));
  1419. // Only continue animation if scroll position has not changed
  1420. if (_this.elementRef.nativeElement[target] === oldValue_1) {
  1421. if (scrollCount_1 >= Math.PI) {
  1422. _this.animateScrolling(target, value, 0);
  1423. }
  1424. else {
  1425. _this.elementRef.nativeElement[target] = newValue_1;
  1426. // On a zoomed out page the resulting offset may differ
  1427. oldValue_1 = _this.elementRef.nativeElement[target];
  1428. oldTimestamp_1 = newTimestamp;
  1429. _this.animation = window.requestAnimationFrame(step_1);
  1430. }
  1431. }
  1432. });
  1433. window.requestAnimationFrame(step_1);
  1434. }
  1435. };
  1436. PerfectScrollbarDirective.decorators = [
  1437. { type: core.Directive, args: [{
  1438. selector: '[perfectScrollbar]',
  1439. exportAs: 'ngxPerfectScrollbar'
  1440. },] }
  1441. ];
  1442. /** @nocollapse */
  1443. PerfectScrollbarDirective.ctorParameters = function () { return [
  1444. { type: core.NgZone },
  1445. { type: core.KeyValueDiffers },
  1446. { type: core.ElementRef },
  1447. { type: Object, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] },
  1448. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [PERFECT_SCROLLBAR_CONFIG,] }] }
  1449. ]; };
  1450. PerfectScrollbarDirective.propDecorators = {
  1451. disabled: [{ type: core.Input }],
  1452. config: [{ type: core.Input, args: ['perfectScrollbar',] }],
  1453. psScrollY: [{ type: core.Output }],
  1454. psScrollX: [{ type: core.Output }],
  1455. psScrollUp: [{ type: core.Output }],
  1456. psScrollDown: [{ type: core.Output }],
  1457. psScrollLeft: [{ type: core.Output }],
  1458. psScrollRight: [{ type: core.Output }],
  1459. psYReachEnd: [{ type: core.Output }],
  1460. psYReachStart: [{ type: core.Output }],
  1461. psXReachEnd: [{ type: core.Output }],
  1462. psXReachStart: [{ type: core.Output }]
  1463. };
  1464. return PerfectScrollbarDirective;
  1465. }());
  1466. /**
  1467. * @fileoverview added by tsickle
  1468. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1469. */
  1470. var PerfectScrollbarComponent = /** @class */ (function () {
  1471. function PerfectScrollbarComponent(zone, cdRef, platformId) {
  1472. this.zone = zone;
  1473. this.cdRef = cdRef;
  1474. this.platformId = platformId;
  1475. this.states = {};
  1476. this.indicatorX = false;
  1477. this.indicatorY = false;
  1478. this.interaction = false;
  1479. this.scrollPositionX = 0;
  1480. this.scrollPositionY = 0;
  1481. this.scrollDirectionX = 0;
  1482. this.scrollDirectionY = 0;
  1483. this.usePropagationX = false;
  1484. this.usePropagationY = false;
  1485. this.allowPropagationX = false;
  1486. this.allowPropagationY = false;
  1487. this.stateTimeout = null;
  1488. this.ngDestroy = new rxjs.Subject();
  1489. this.stateUpdate = new rxjs.Subject();
  1490. this.disabled = false;
  1491. this.usePSClass = true;
  1492. this.autoPropagation = false;
  1493. this.scrollIndicators = false;
  1494. this.psScrollY = new core.EventEmitter();
  1495. this.psScrollX = new core.EventEmitter();
  1496. this.psScrollUp = new core.EventEmitter();
  1497. this.psScrollDown = new core.EventEmitter();
  1498. this.psScrollLeft = new core.EventEmitter();
  1499. this.psScrollRight = new core.EventEmitter();
  1500. this.psYReachEnd = new core.EventEmitter();
  1501. this.psYReachStart = new core.EventEmitter();
  1502. this.psXReachEnd = new core.EventEmitter();
  1503. this.psXReachStart = new core.EventEmitter();
  1504. }
  1505. /**
  1506. * @return {?}
  1507. */
  1508. PerfectScrollbarComponent.prototype.ngOnInit = /**
  1509. * @return {?}
  1510. */
  1511. function () {
  1512. var _this = this;
  1513. if (common.isPlatformBrowser(this.platformId)) {
  1514. this.stateUpdate
  1515. .pipe(operators.takeUntil(this.ngDestroy), operators.distinctUntilChanged((/**
  1516. * @param {?} a
  1517. * @param {?} b
  1518. * @return {?}
  1519. */
  1520. function (a, b) { return (a === b && !_this.stateTimeout); })))
  1521. .subscribe((/**
  1522. * @param {?} state
  1523. * @return {?}
  1524. */
  1525. function (state) {
  1526. if (_this.stateTimeout && typeof window !== 'undefined') {
  1527. window.clearTimeout(_this.stateTimeout);
  1528. _this.stateTimeout = null;
  1529. }
  1530. if (state === 'x' || state === 'y') {
  1531. _this.interaction = false;
  1532. if (state === 'x') {
  1533. _this.indicatorX = false;
  1534. _this.states.left = false;
  1535. _this.states.right = false;
  1536. if (_this.autoPropagation && _this.usePropagationX) {
  1537. _this.allowPropagationX = false;
  1538. }
  1539. }
  1540. else if (state === 'y') {
  1541. _this.indicatorY = false;
  1542. _this.states.top = false;
  1543. _this.states.bottom = false;
  1544. if (_this.autoPropagation && _this.usePropagationY) {
  1545. _this.allowPropagationY = false;
  1546. }
  1547. }
  1548. }
  1549. else {
  1550. if (state === 'left' || state === 'right') {
  1551. _this.states.left = false;
  1552. _this.states.right = false;
  1553. _this.states[state] = true;
  1554. if (_this.autoPropagation && _this.usePropagationX) {
  1555. _this.indicatorX = true;
  1556. }
  1557. }
  1558. else if (state === 'top' || state === 'bottom') {
  1559. _this.states.top = false;
  1560. _this.states.bottom = false;
  1561. _this.states[state] = true;
  1562. if (_this.autoPropagation && _this.usePropagationY) {
  1563. _this.indicatorY = true;
  1564. }
  1565. }
  1566. if (_this.autoPropagation && typeof window !== 'undefined') {
  1567. _this.stateTimeout = window.setTimeout((/**
  1568. * @return {?}
  1569. */
  1570. function () {
  1571. _this.indicatorX = false;
  1572. _this.indicatorY = false;
  1573. _this.stateTimeout = null;
  1574. if (_this.interaction && (_this.states.left || _this.states.right)) {
  1575. _this.allowPropagationX = true;
  1576. }
  1577. if (_this.interaction && (_this.states.top || _this.states.bottom)) {
  1578. _this.allowPropagationY = true;
  1579. }
  1580. _this.cdRef.markForCheck();
  1581. }), 500);
  1582. }
  1583. }
  1584. _this.cdRef.markForCheck();
  1585. _this.cdRef.detectChanges();
  1586. }));
  1587. this.zone.runOutsideAngular((/**
  1588. * @return {?}
  1589. */
  1590. function () {
  1591. if (_this.directiveRef) {
  1592. /** @type {?} */
  1593. var element = _this.directiveRef.elementRef.nativeElement;
  1594. rxjs.fromEvent(element, 'wheel')
  1595. .pipe(operators.takeUntil(_this.ngDestroy))
  1596. .subscribe((/**
  1597. * @param {?} event
  1598. * @return {?}
  1599. */
  1600. function (event) {
  1601. if (!_this.disabled && _this.autoPropagation) {
  1602. /** @type {?} */
  1603. var scrollDeltaX = event.deltaX;
  1604. /** @type {?} */
  1605. var scrollDeltaY = event.deltaY;
  1606. _this.checkPropagation(event, scrollDeltaX, scrollDeltaY);
  1607. }
  1608. }));
  1609. rxjs.fromEvent(element, 'touchmove')
  1610. .pipe(operators.takeUntil(_this.ngDestroy))
  1611. .subscribe((/**
  1612. * @param {?} event
  1613. * @return {?}
  1614. */
  1615. function (event) {
  1616. if (!_this.disabled && _this.autoPropagation) {
  1617. /** @type {?} */
  1618. var scrollPositionX = event.touches[0].clientX;
  1619. /** @type {?} */
  1620. var scrollPositionY = event.touches[0].clientY;
  1621. /** @type {?} */
  1622. var scrollDeltaX = scrollPositionX - _this.scrollPositionX;
  1623. /** @type {?} */
  1624. var scrollDeltaY = scrollPositionY - _this.scrollPositionY;
  1625. _this.checkPropagation(event, scrollDeltaX, scrollDeltaY);
  1626. _this.scrollPositionX = scrollPositionX;
  1627. _this.scrollPositionY = scrollPositionY;
  1628. }
  1629. }));
  1630. rxjs.merge(rxjs.fromEvent(element, 'ps-scroll-x')
  1631. .pipe(operators.mapTo('x')), rxjs.fromEvent(element, 'ps-scroll-y')
  1632. .pipe(operators.mapTo('y')), rxjs.fromEvent(element, 'ps-x-reach-end')
  1633. .pipe(operators.mapTo('right')), rxjs.fromEvent(element, 'ps-y-reach-end')
  1634. .pipe(operators.mapTo('bottom')), rxjs.fromEvent(element, 'ps-x-reach-start')
  1635. .pipe(operators.mapTo('left')), rxjs.fromEvent(element, 'ps-y-reach-start')
  1636. .pipe(operators.mapTo('top')))
  1637. .pipe(operators.takeUntil(_this.ngDestroy))
  1638. .subscribe((/**
  1639. * @param {?} state
  1640. * @return {?}
  1641. */
  1642. function (state) {
  1643. if (!_this.disabled && (_this.autoPropagation || _this.scrollIndicators)) {
  1644. _this.stateUpdate.next(state);
  1645. }
  1646. }));
  1647. }
  1648. }));
  1649. window.setTimeout((/**
  1650. * @return {?}
  1651. */
  1652. function () {
  1653. PerfectScrollbarEvents.forEach((/**
  1654. * @param {?} eventName
  1655. * @return {?}
  1656. */
  1657. function (eventName) {
  1658. if (_this.directiveRef) {
  1659. _this.directiveRef[eventName] = _this[eventName];
  1660. }
  1661. }));
  1662. }), 0);
  1663. }
  1664. };
  1665. /**
  1666. * @return {?}
  1667. */
  1668. PerfectScrollbarComponent.prototype.ngOnDestroy = /**
  1669. * @return {?}
  1670. */
  1671. function () {
  1672. if (common.isPlatformBrowser(this.platformId)) {
  1673. this.ngDestroy.next();
  1674. this.ngDestroy.unsubscribe();
  1675. if (this.stateTimeout && typeof window !== 'undefined') {
  1676. window.clearTimeout(this.stateTimeout);
  1677. }
  1678. }
  1679. };
  1680. /**
  1681. * @return {?}
  1682. */
  1683. PerfectScrollbarComponent.prototype.ngDoCheck = /**
  1684. * @return {?}
  1685. */
  1686. function () {
  1687. if (common.isPlatformBrowser(this.platformId)) {
  1688. if (!this.disabled && this.autoPropagation && this.directiveRef) {
  1689. /** @type {?} */
  1690. var element = this.directiveRef.elementRef.nativeElement;
  1691. this.usePropagationX = element.classList.contains('ps--active-x');
  1692. this.usePropagationY = element.classList.contains('ps--active-y');
  1693. }
  1694. }
  1695. };
  1696. /**
  1697. * @private
  1698. * @param {?} event
  1699. * @param {?} deltaX
  1700. * @param {?} deltaY
  1701. * @return {?}
  1702. */
  1703. PerfectScrollbarComponent.prototype.checkPropagation = /**
  1704. * @private
  1705. * @param {?} event
  1706. * @param {?} deltaX
  1707. * @param {?} deltaY
  1708. * @return {?}
  1709. */
  1710. function (event, deltaX, deltaY) {
  1711. this.interaction = true;
  1712. /** @type {?} */
  1713. var scrollDirectionX = (deltaX < 0) ? -1 : 1;
  1714. /** @type {?} */
  1715. var scrollDirectionY = (deltaY < 0) ? -1 : 1;
  1716. if ((this.usePropagationX && this.usePropagationY) ||
  1717. (this.usePropagationX && (!this.allowPropagationX ||
  1718. (this.scrollDirectionX !== scrollDirectionX))) ||
  1719. (this.usePropagationY && (!this.allowPropagationY ||
  1720. (this.scrollDirectionY !== scrollDirectionY)))) {
  1721. event.preventDefault();
  1722. event.stopPropagation();
  1723. }
  1724. if (!!deltaX) {
  1725. this.scrollDirectionX = scrollDirectionX;
  1726. }
  1727. if (!!deltaY) {
  1728. this.scrollDirectionY = scrollDirectionY;
  1729. }
  1730. this.stateUpdate.next('interaction');
  1731. this.cdRef.detectChanges();
  1732. };
  1733. PerfectScrollbarComponent.decorators = [
  1734. { type: core.Component, args: [{
  1735. selector: 'perfect-scrollbar',
  1736. exportAs: 'ngxPerfectScrollbar',
  1737. template: "<div style=\"position: static;\" [class.ps]=\"usePSClass\" [perfectScrollbar]=\"config\" [disabled]=\"disabled\">\n <div class=\"ps-content\">\n <ng-content></ng-content>\n </div>\n\n <div *ngIf=\"scrollIndicators\" class=\"ps-overlay\" [class.ps-at-top]=\"states.top\" [class.ps-at-left]=\"states.left\" [class.ps-at-right]=\"states.right\" [class.ps-at-bottom]=\"states.bottom\">\n <div class=\"ps-indicator-top\" [class.ps-indicator-show]=\"indicatorY && interaction\"></div>\n <div class=\"ps-indicator-left\" [class.ps-indicator-show]=\"indicatorX && interaction\"></div>\n <div class=\"ps-indicator-right\" [class.ps-indicator-show]=\"indicatorX && interaction\"></div>\n <div class=\"ps-indicator-bottom\" [class.ps-indicator-show]=\"indicatorY && interaction\"></div>\n </div>\n</div>\n",
  1738. encapsulation: core.ViewEncapsulation.None,
  1739. styles: ["/*\n TODO: Remove important flags after this bug if fixed:\n https://github.com/angular/flex-layout/issues/381\n*/\n\nperfect-scrollbar {\n position: relative;\n\n display: block;\n overflow: hidden;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n}\n\nperfect-scrollbar[hidden] {\n display: none;\n}\n\nperfect-scrollbar[fxflex] {\n display: flex;\n flex-direction: column;\n height: auto;\n min-width: 0;\n min-height: 0;\n\n -webkit-box-direction: column;\n -webkit-box-orient: column;\n}\n\nperfect-scrollbar[fxflex] > .ps {\n -ms-flex: 1 1 auto;\n\n flex: 1 1 auto;\n width: auto;\n height: auto;\n min-width: 0;\n min-height: 0;\n\n -webkit-box-flex: 1;\n}\n\nperfect-scrollbar[fxlayout] > .ps,\nperfect-scrollbar[fxlayout] > .ps > .ps-content {\n display: flex;\n\n -ms-flex: 1 1 auto;\n\n flex: 1 1 auto;\n flex-direction: inherit;\n align-items: inherit;\n align-content: inherit;\n justify-content: inherit;\n width: 100%;\n height: 100%;\n\n -webkit-box-align: inherit;\n -webkit-box-direction: inherit;\n -webkit-box-flex: 1;\n -webkit-box-orient: inherit;\n -webkit-box-pack: inherit;\n}\n\nperfect-scrollbar[fxlayout='row'] > .ps,\nperfect-scrollbar[fxlayout='row'] > .ps > .ps-content, {\n flex-direction: row !important;\n\n -webkit-box-direction: row !important;\n -webkit-box-orient: row !important;\n}\n\nperfect-scrollbar[fxlayout='column'] > .ps,\nperfect-scrollbar[fxlayout='column'] > .ps > .ps-content {\n flex-direction: column !important;\n\n -webkit-box-direction: column !important;\n -webkit-box-orient: column !important;\n}\n\nperfect-scrollbar > .ps {\n position: static;\n\n display: block;\n width: inherit;\n height: inherit;\n max-width: inherit;\n max-height: inherit;\n}\n\nperfect-scrollbar > .ps textarea {\n -ms-overflow-style: scrollbar;\n}\n\nperfect-scrollbar > .ps > .ps-overlay {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n\n display: block;\n overflow: hidden;\n\n pointer-events: none;\n}\n\nperfect-scrollbar > .ps > .ps-overlay .ps-indicator-top,\nperfect-scrollbar > .ps > .ps-overlay .ps-indicator-left,\nperfect-scrollbar > .ps > .ps-overlay .ps-indicator-right,\nperfect-scrollbar > .ps > .ps-overlay .ps-indicator-bottom {\n position: absolute;\n\n opacity: 0;\n\n transition: opacity 300ms ease-in-out;\n}\n\nperfect-scrollbar > .ps > .ps-overlay .ps-indicator-top,\nperfect-scrollbar > .ps > .ps-overlay .ps-indicator-bottom {\n left: 0;\n\n min-width: 100%;\n min-height: 24px;\n}\n\nperfect-scrollbar > .ps > .ps-overlay .ps-indicator-left,\nperfect-scrollbar > .ps > .ps-overlay .ps-indicator-right {\n top: 0;\n\n min-width: 24px;\n min-height: 100%;\n}\n\nperfect-scrollbar > .ps > .ps-overlay .ps-indicator-top {\n top: 0;\n}\n\nperfect-scrollbar > .ps > .ps-overlay .ps-indicator-left {\n left: 0;\n}\n\nperfect-scrollbar > .ps > .ps-overlay .ps-indicator-right {\n right: 0;\n}\n\nperfect-scrollbar > .ps > .ps-overlay .ps-indicator-bottom {\n bottom: 0;\n}\n\nperfect-scrollbar > .ps.ps--active-y > .ps__rail-y {\n top: 0 !important;\n right: 0 !important;\n left: auto !important;\n\n width: 10px;\n\n cursor: default;\n\n transition:\n width 200ms linear,\n opacity 200ms linear,\n background-color 200ms linear;\n}\n\nperfect-scrollbar > .ps.ps--active-y > .ps__rail-y:hover,\nperfect-scrollbar > .ps.ps--active-y > .ps__rail-y.ps--clicking {\n width: 15px;\n}\n\nperfect-scrollbar > .ps.ps--active-x > .ps__rail-x {\n top: auto !important;\n bottom: 0 !important;\n left: 0 !important;\n\n height: 10px;\n\n cursor: default;\n\n transition:\n height 200ms linear,\n opacity 200ms linear,\n background-color 200ms linear;\n}\n\nperfect-scrollbar > .ps.ps--active-x > .ps__rail-x:hover,\nperfect-scrollbar > .ps.ps--active-x > .ps__rail-x.ps--clicking {\n height: 15px;\n}\n\nperfect-scrollbar > .ps.ps--active-x.ps--active-y > .ps__rail-y {\n margin: 0 0 10px;\n}\n\nperfect-scrollbar > .ps.ps--active-x.ps--active-y > .ps__rail-x {\n margin: 0 10px 0 0;\n}\n\nperfect-scrollbar > .ps.ps--scrolling-y > .ps__rail-y,\nperfect-scrollbar > .ps.ps--scrolling-x > .ps__rail-x {\n opacity: 0.9;\n\n background-color: #eee;\n}\n\nperfect-scrollbar.ps-show-always > .ps.ps--active-y > .ps__rail-y,\nperfect-scrollbar.ps-show-always > .ps.ps--active-x > .ps__rail-x {\n opacity: 0.6;\n}\n\nperfect-scrollbar.ps-show-active > .ps.ps--active-y > .ps-overlay:not(.ps-at-top) .ps-indicator-top {\n opacity: 1;\n\n background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);\n}\n\nperfect-scrollbar.ps-show-active > .ps.ps--active-y > .ps-overlay:not(.ps-at-bottom) .ps-indicator-bottom {\n opacity: 1;\n\n background: linear-gradient(to top, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);\n}\n\nperfect-scrollbar.ps-show-active > .ps.ps--active-x > .ps-overlay:not(.ps-at-left) .ps-indicator-left {\n opacity: 1;\n\n background: linear-gradient(to right, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);\n}\n\nperfect-scrollbar.ps-show-active > .ps.ps--active-x > .ps-overlay:not(.ps-at-right) .ps-indicator-right {\n opacity: 1;\n\n background: linear-gradient(to left, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);\n}\n\nperfect-scrollbar.ps-show-active.ps-show-limits > .ps.ps--active-y > .ps-overlay.ps-at-top .ps-indicator-top {\n background: linear-gradient(to bottom, rgba(170, 170, 170, 0.5) 0%, rgba(170, 170, 170, 0) 100%);\n}\n\nperfect-scrollbar.ps-show-active.ps-show-limits > .ps.ps--active-y > .ps-overlay.ps-at-bottom .ps-indicator-bottom {\n background: linear-gradient(to top, rgba(170, 170, 170, 0.5) 0%, rgba(170, 170, 170, 0) 100%);\n}\n\nperfect-scrollbar.ps-show-active.ps-show-limits > .ps.ps--active-x > .ps-overlay.ps-at-left .ps-indicator-left {\n background: linear-gradient(to right, rgba(170, 170, 170, 0.5) 0%, rgba(170, 170, 170, 0) 100%);\n}\n\nperfect-scrollbar.ps-show-active.ps-show-limits > .ps.ps--active-x > .ps-overlay.ps-at-right .ps-indicator-right {\n background: linear-gradient(to left, rgba(170, 170, 170, 0.5) 0%, rgba(170, 170, 170, 0) 100%);\n}\n\nperfect-scrollbar.ps-show-active.ps-show-limits > .ps.ps--active-y > .ps-overlay.ps-at-top .ps-indicator-top.ps-indicator-show,\nperfect-scrollbar.ps-show-active.ps-show-limits > .ps.ps--active-y > .ps-overlay.ps-at-bottom .ps-indicator-bottom.ps-indicator-show,\nperfect-scrollbar.ps-show-active.ps-show-limits > .ps.ps--active-x > .ps-overlay.ps-at-left .ps-indicator-left.ps-indicator-show,\nperfect-scrollbar.ps-show-active.ps-show-limits > .ps.ps--active-x > .ps-overlay.ps-at-right .ps-indicator-right.ps-indicator-show {\n opacity: 1;\n}\n", "/*\n * Container style\n */\n.ps {\n overflow: hidden !important;\n overflow-anchor: none;\n -ms-overflow-style: none;\n touch-action: auto;\n -ms-touch-action: auto;\n}\n\n/*\n * Scrollbar rail styles\n */\n.ps__rail-x {\n display: none;\n opacity: 0;\n transition: background-color .2s linear, opacity .2s linear;\n -webkit-transition: background-color .2s linear, opacity .2s linear;\n height: 15px;\n /* there must be 'bottom' or 'top' for ps__rail-x */\n bottom: 0px;\n /* please don't change 'position' */\n position: absolute;\n}\n\n.ps__rail-y {\n display: none;\n opacity: 0;\n transition: background-color .2s linear, opacity .2s linear;\n -webkit-transition: background-color .2s linear, opacity .2s linear;\n width: 15px;\n /* there must be 'right' or 'left' for ps__rail-y */\n right: 0;\n /* please don't change 'position' */\n position: absolute;\n}\n\n.ps--active-x > .ps__rail-x,\n.ps--active-y > .ps__rail-y {\n display: block;\n background-color: transparent;\n}\n\n.ps:hover > .ps__rail-x,\n.ps:hover > .ps__rail-y,\n.ps--focus > .ps__rail-x,\n.ps--focus > .ps__rail-y,\n.ps--scrolling-x > .ps__rail-x,\n.ps--scrolling-y > .ps__rail-y {\n opacity: 0.6;\n}\n\n.ps .ps__rail-x:hover,\n.ps .ps__rail-y:hover,\n.ps .ps__rail-x:focus,\n.ps .ps__rail-y:focus,\n.ps .ps__rail-x.ps--clicking,\n.ps .ps__rail-y.ps--clicking {\n background-color: #eee;\n opacity: 0.9;\n}\n\n/*\n * Scrollbar thumb styles\n */\n.ps__thumb-x {\n background-color: #aaa;\n border-radius: 6px;\n transition: background-color .2s linear, height .2s ease-in-out;\n -webkit-transition: background-color .2s linear, height .2s ease-in-out;\n height: 6px;\n /* there must be 'bottom' for ps__thumb-x */\n bottom: 2px;\n /* please don't change 'position' */\n position: absolute;\n}\n\n.ps__thumb-y {\n background-color: #aaa;\n border-radius: 6px;\n transition: background-color .2s linear, width .2s ease-in-out;\n -webkit-transition: background-color .2s linear, width .2s ease-in-out;\n width: 6px;\n /* there must be 'right' for ps__thumb-y */\n right: 2px;\n /* please don't change 'position' */\n position: absolute;\n}\n\n.ps__rail-x:hover > .ps__thumb-x,\n.ps__rail-x:focus > .ps__thumb-x,\n.ps__rail-x.ps--clicking .ps__thumb-x {\n background-color: #999;\n height: 11px;\n}\n\n.ps__rail-y:hover > .ps__thumb-y,\n.ps__rail-y:focus > .ps__thumb-y,\n.ps__rail-y.ps--clicking .ps__thumb-y {\n background-color: #999;\n width: 11px;\n}\n\n/* MS supports */\n@supports (-ms-overflow-style: none) {\n .ps {\n overflow: auto !important;\n }\n}\n\n@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {\n .ps {\n overflow: auto !important;\n }\n}\n"]
  1740. }] }
  1741. ];
  1742. /** @nocollapse */
  1743. PerfectScrollbarComponent.ctorParameters = function () { return [
  1744. { type: core.NgZone },
  1745. { type: core.ChangeDetectorRef },
  1746. { type: Object, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] }
  1747. ]; };
  1748. PerfectScrollbarComponent.propDecorators = {
  1749. disabled: [{ type: core.Input }],
  1750. usePSClass: [{ type: core.Input }],
  1751. autoPropagation: [{ type: core.HostBinding, args: ['class.ps-show-limits',] }, { type: core.Input }],
  1752. scrollIndicators: [{ type: core.HostBinding, args: ['class.ps-show-active',] }, { type: core.Input }],
  1753. config: [{ type: core.Input }],
  1754. psScrollY: [{ type: core.Output }],
  1755. psScrollX: [{ type: core.Output }],
  1756. psScrollUp: [{ type: core.Output }],
  1757. psScrollDown: [{ type: core.Output }],
  1758. psScrollLeft: [{ type: core.Output }],
  1759. psScrollRight: [{ type: core.Output }],
  1760. psYReachEnd: [{ type: core.Output }],
  1761. psYReachStart: [{ type: core.Output }],
  1762. psXReachEnd: [{ type: core.Output }],
  1763. psXReachStart: [{ type: core.Output }],
  1764. directiveRef: [{ type: core.ViewChild, args: [PerfectScrollbarDirective, { static: true },] }]
  1765. };
  1766. return PerfectScrollbarComponent;
  1767. }());
  1768. /**
  1769. * @fileoverview added by tsickle
  1770. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1771. */
  1772. var PerfectScrollbarModule = /** @class */ (function () {
  1773. function PerfectScrollbarModule() {
  1774. }
  1775. PerfectScrollbarModule.decorators = [
  1776. { type: core.NgModule, args: [{
  1777. imports: [common.CommonModule],
  1778. declarations: [PerfectScrollbarComponent, PerfectScrollbarDirective],
  1779. exports: [common.CommonModule, PerfectScrollbarComponent, PerfectScrollbarDirective]
  1780. },] }
  1781. ];
  1782. return PerfectScrollbarModule;
  1783. }());
  1784. exports.Geometry = Geometry;
  1785. exports.PERFECT_SCROLLBAR_CONFIG = PERFECT_SCROLLBAR_CONFIG;
  1786. exports.PerfectScrollbarComponent = PerfectScrollbarComponent;
  1787. exports.PerfectScrollbarConfig = PerfectScrollbarConfig;
  1788. exports.PerfectScrollbarDirective = PerfectScrollbarDirective;
  1789. exports.PerfectScrollbarModule = PerfectScrollbarModule;
  1790. exports.Position = Position;
  1791. Object.defineProperty(exports, '__esModule', { value: true });
  1792. }));
  1793. //# sourceMappingURL=ngx-perfect-scrollbar.umd.js.map