1 | (function (global, factory) {
|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('perfect-scrollbar'), require('rxjs'), require('rxjs/operators'), require('@angular/common')) :
|
3 | typeof define === 'function' && define.amd ? define(['exports', '@angular/core', 'perfect-scrollbar', 'rxjs', 'rxjs/operators', '@angular/common'], factory) :
|
4 | (factory((global.zef = global.zef || {}, global.zef.ngxPerfectScrollbar = {}),global.ng.core,global.PerfectScrollbar,global.Rx,global.Rx.Observable.prototype,global.ng.common));
|
5 | }(this, (function (exports,core,PerfectScrollbar,rxjs,operators,common) { 'use strict';
|
6 |
|
7 | PerfectScrollbar = PerfectScrollbar && PerfectScrollbar.hasOwnProperty('default') ? PerfectScrollbar['default'] : PerfectScrollbar;
|
8 |
|
9 | |
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | var MapShim = (function () {
|
17 | if (typeof Map !== 'undefined') {
|
18 | return Map;
|
19 | }
|
20 |
|
21 | |
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | function getIndex(arr, key) {
|
29 | var result = -1;
|
30 |
|
31 | arr.some(function (entry, index) {
|
32 | if (entry[0] === key) {
|
33 | result = index;
|
34 |
|
35 | return true;
|
36 | }
|
37 |
|
38 | return false;
|
39 | });
|
40 |
|
41 | return result;
|
42 | }
|
43 |
|
44 | return (function () {
|
45 | function anonymous() {
|
46 | this.__entries__ = [];
|
47 | }
|
48 |
|
49 | var prototypeAccessors = { size: { configurable: true } };
|
50 |
|
51 | |
52 |
|
53 |
|
54 | prototypeAccessors.size.get = function () {
|
55 | return this.__entries__.length;
|
56 | };
|
57 |
|
58 | |
59 |
|
60 |
|
61 |
|
62 | anonymous.prototype.get = function (key) {
|
63 | var index = getIndex(this.__entries__, key);
|
64 | var entry = this.__entries__[index];
|
65 |
|
66 | return entry && entry[1];
|
67 | };
|
68 |
|
69 | |
70 |
|
71 |
|
72 |
|
73 |
|
74 | anonymous.prototype.set = function (key, value) {
|
75 | var index = getIndex(this.__entries__, key);
|
76 |
|
77 | if (~index) {
|
78 | this.__entries__[index][1] = value;
|
79 | } else {
|
80 | this.__entries__.push([key, value]);
|
81 | }
|
82 | };
|
83 |
|
84 | |
85 |
|
86 |
|
87 |
|
88 | anonymous.prototype.delete = function (key) {
|
89 | var entries = this.__entries__;
|
90 | var index = getIndex(entries, key);
|
91 |
|
92 | if (~index) {
|
93 | entries.splice(index, 1);
|
94 | }
|
95 | };
|
96 |
|
97 | |
98 |
|
99 |
|
100 |
|
101 | anonymous.prototype.has = function (key) {
|
102 | return !!~getIndex(this.__entries__, key);
|
103 | };
|
104 |
|
105 | |
106 |
|
107 |
|
108 | anonymous.prototype.clear = function () {
|
109 | this.__entries__.splice(0);
|
110 | };
|
111 |
|
112 | |
113 |
|
114 |
|
115 |
|
116 |
|
117 | anonymous.prototype.forEach = function (callback, ctx) {
|
118 | var this$1 = this;
|
119 | if ( ctx === void 0 ) ctx = null;
|
120 |
|
121 | for (var i = 0, list = this$1.__entries__; i < list.length; i += 1) {
|
122 | var entry = list[i];
|
123 |
|
124 | callback.call(ctx, entry[1], entry[0]);
|
125 | }
|
126 | };
|
127 |
|
128 | Object.defineProperties( anonymous.prototype, prototypeAccessors );
|
129 |
|
130 | return anonymous;
|
131 | }());
|
132 | })();
|
133 |
|
134 | |
135 |
|
136 |
|
137 | var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document;
|
138 |
|
139 |
|
140 | var global$1 = (function () {
|
141 | if (typeof global !== 'undefined' && global.Math === Math) {
|
142 | return global;
|
143 | }
|
144 |
|
145 | if (typeof self !== 'undefined' && self.Math === Math) {
|
146 | return self;
|
147 | }
|
148 |
|
149 | if (typeof window !== 'undefined' && window.Math === Math) {
|
150 | return window;
|
151 | }
|
152 |
|
153 |
|
154 | return Function('return this')();
|
155 | })();
|
156 |
|
157 | |
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 | var requestAnimationFrame$1 = (function () {
|
164 | if (typeof requestAnimationFrame === 'function') {
|
165 |
|
166 |
|
167 |
|
168 | return requestAnimationFrame.bind(global$1);
|
169 | }
|
170 |
|
171 | return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); };
|
172 | })();
|
173 |
|
174 |
|
175 | var trailingTimeout = 2;
|
176 |
|
177 | |
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 | var throttle = function (callback, delay) {
|
186 | var leadingCall = false,
|
187 | trailingCall = false,
|
188 | lastCallTime = 0;
|
189 |
|
190 | |
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 | function resolvePending() {
|
197 | if (leadingCall) {
|
198 | leadingCall = false;
|
199 |
|
200 | callback();
|
201 | }
|
202 |
|
203 | if (trailingCall) {
|
204 | proxy();
|
205 | }
|
206 | }
|
207 |
|
208 | |
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 | function timeoutCallback() {
|
216 | requestAnimationFrame$1(resolvePending);
|
217 | }
|
218 |
|
219 | |
220 |
|
221 |
|
222 |
|
223 |
|
224 | function proxy() {
|
225 | var timeStamp = Date.now();
|
226 |
|
227 | if (leadingCall) {
|
228 |
|
229 | if (timeStamp - lastCallTime < trailingTimeout) {
|
230 | return;
|
231 | }
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 | trailingCall = true;
|
238 | } else {
|
239 | leadingCall = true;
|
240 | trailingCall = false;
|
241 |
|
242 | setTimeout(timeoutCallback, delay);
|
243 | }
|
244 |
|
245 | lastCallTime = timeStamp;
|
246 | }
|
247 |
|
248 | return proxy;
|
249 | };
|
250 |
|
251 |
|
252 | var REFRESH_DELAY = 20;
|
253 |
|
254 |
|
255 |
|
256 | var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight'];
|
257 |
|
258 |
|
259 | var mutationObserverSupported = typeof MutationObserver !== 'undefined';
|
260 |
|
261 | |
262 |
|
263 |
|
264 | var ResizeObserverController = function() {
|
265 | this.connected_ = false;
|
266 | this.mutationEventsAdded_ = false;
|
267 | this.mutationsObserver_ = null;
|
268 | this.observers_ = [];
|
269 |
|
270 | this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
|
271 | this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY);
|
272 | };
|
273 |
|
274 | |
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 | |
283 |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 | |
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 | |
296 |
|
297 |
|
298 |
|
299 |
|
300 | ResizeObserverController.prototype.addObserver = function (observer) {
|
301 | if (!~this.observers_.indexOf(observer)) {
|
302 | this.observers_.push(observer);
|
303 | }
|
304 |
|
305 |
|
306 | if (!this.connected_) {
|
307 | this.connect_();
|
308 | }
|
309 | };
|
310 |
|
311 | |
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 | ResizeObserverController.prototype.removeObserver = function (observer) {
|
318 | var observers = this.observers_;
|
319 | var index = observers.indexOf(observer);
|
320 |
|
321 |
|
322 | if (~index) {
|
323 | observers.splice(index, 1);
|
324 | }
|
325 |
|
326 |
|
327 | if (!observers.length && this.connected_) {
|
328 | this.disconnect_();
|
329 | }
|
330 | };
|
331 |
|
332 | |
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 | ResizeObserverController.prototype.refresh = function () {
|
339 | var changesDetected = this.updateObservers_();
|
340 |
|
341 |
|
342 |
|
343 | if (changesDetected) {
|
344 | this.refresh();
|
345 | }
|
346 | };
|
347 |
|
348 | |
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 |
|
356 | ResizeObserverController.prototype.updateObservers_ = function () {
|
357 |
|
358 | var activeObservers = this.observers_.filter(function (observer) {
|
359 | return observer.gatherActive(), observer.hasActive();
|
360 | });
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 | activeObservers.forEach(function (observer) { return observer.broadcastActive(); });
|
368 |
|
369 | return activeObservers.length > 0;
|
370 | };
|
371 |
|
372 | |
373 |
|
374 |
|
375 |
|
376 |
|
377 |
|
378 | ResizeObserverController.prototype.connect_ = function () {
|
379 |
|
380 |
|
381 | if (!isBrowser || this.connected_) {
|
382 | return;
|
383 | }
|
384 |
|
385 |
|
386 |
|
387 |
|
388 | document.addEventListener('transitionend', this.onTransitionEnd_);
|
389 |
|
390 | window.addEventListener('resize', this.refresh);
|
391 |
|
392 | if (mutationObserverSupported) {
|
393 | this.mutationsObserver_ = new MutationObserver(this.refresh);
|
394 |
|
395 | this.mutationsObserver_.observe(document, {
|
396 | attributes: true,
|
397 | childList: true,
|
398 | characterData: true,
|
399 | subtree: true
|
400 | });
|
401 | } else {
|
402 | document.addEventListener('DOMSubtreeModified', this.refresh);
|
403 |
|
404 | this.mutationEventsAdded_ = true;
|
405 | }
|
406 |
|
407 | this.connected_ = true;
|
408 | };
|
409 |
|
410 | |
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 | ResizeObserverController.prototype.disconnect_ = function () {
|
417 |
|
418 |
|
419 | if (!isBrowser || !this.connected_) {
|
420 | return;
|
421 | }
|
422 |
|
423 | document.removeEventListener('transitionend', this.onTransitionEnd_);
|
424 | window.removeEventListener('resize', this.refresh);
|
425 |
|
426 | if (this.mutationsObserver_) {
|
427 | this.mutationsObserver_.disconnect();
|
428 | }
|
429 |
|
430 | if (this.mutationEventsAdded_) {
|
431 | document.removeEventListener('DOMSubtreeModified', this.refresh);
|
432 | }
|
433 |
|
434 | this.mutationsObserver_ = null;
|
435 | this.mutationEventsAdded_ = false;
|
436 | this.connected_ = false;
|
437 | };
|
438 |
|
439 | |
440 |
|
441 |
|
442 |
|
443 |
|
444 |
|
445 |
|
446 | ResizeObserverController.prototype.onTransitionEnd_ = function (ref) {
|
447 | var propertyName = ref.propertyName; if ( propertyName === void 0 ) propertyName = '';
|
448 |
|
449 |
|
450 | var isReflowProperty = transitionKeys.some(function (key) {
|
451 | return !!~propertyName.indexOf(key);
|
452 | });
|
453 |
|
454 | if (isReflowProperty) {
|
455 | this.refresh();
|
456 | }
|
457 | };
|
458 |
|
459 | |
460 |
|
461 |
|
462 |
|
463 |
|
464 | ResizeObserverController.getInstance = function () {
|
465 | if (!this.instance_) {
|
466 | this.instance_ = new ResizeObserverController();
|
467 | }
|
468 |
|
469 | return this.instance_;
|
470 | };
|
471 |
|
472 | ResizeObserverController.instance_ = null;
|
473 |
|
474 | |
475 |
|
476 |
|
477 |
|
478 |
|
479 |
|
480 |
|
481 | var defineConfigurable = (function (target, props) {
|
482 | for (var i = 0, list = Object.keys(props); i < list.length; i += 1) {
|
483 | var key = list[i];
|
484 |
|
485 | Object.defineProperty(target, key, {
|
486 | value: props[key],
|
487 | enumerable: false,
|
488 | writable: false,
|
489 | configurable: true
|
490 | });
|
491 | }
|
492 |
|
493 | return target;
|
494 | });
|
495 |
|
496 | |
497 |
|
498 |
|
499 |
|
500 |
|
501 |
|
502 | var getWindowOf = (function (target) {
|
503 |
|
504 |
|
505 |
|
506 | var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;
|
507 |
|
508 |
|
509 |
|
510 | return ownerGlobal || global$1;
|
511 | });
|
512 |
|
513 |
|
514 | var emptyRect = createRectInit(0, 0, 0, 0);
|
515 |
|
516 | |
517 |
|
518 |
|
519 |
|
520 |
|
521 |
|
522 | function toFloat(value) {
|
523 | return parseFloat(value) || 0;
|
524 | }
|
525 |
|
526 | |
527 |
|
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 | function getBordersSize(styles) {
|
534 | var positions = [], len = arguments.length - 1;
|
535 | while ( len-- > 0 ) positions[ len ] = arguments[ len + 1 ];
|
536 |
|
537 | return positions.reduce(function (size, position) {
|
538 | var value = styles['border-' + position + '-width'];
|
539 |
|
540 | return size + toFloat(value);
|
541 | }, 0);
|
542 | }
|
543 |
|
544 | |
545 |
|
546 |
|
547 |
|
548 |
|
549 |
|
550 | function getPaddings(styles) {
|
551 | var positions = ['top', 'right', 'bottom', 'left'];
|
552 | var paddings = {};
|
553 |
|
554 | for (var i = 0, list = positions; i < list.length; i += 1) {
|
555 | var position = list[i];
|
556 |
|
557 | var value = styles['padding-' + position];
|
558 |
|
559 | paddings[position] = toFloat(value);
|
560 | }
|
561 |
|
562 | return paddings;
|
563 | }
|
564 |
|
565 | |
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 | function getSVGContentRect(target) {
|
573 | var bbox = target.getBBox();
|
574 |
|
575 | return createRectInit(0, 0, bbox.width, bbox.height);
|
576 | }
|
577 |
|
578 | |
579 |
|
580 |
|
581 |
|
582 |
|
583 |
|
584 | function getHTMLElementContentRect(target) {
|
585 |
|
586 |
|
587 | var clientWidth = target.clientWidth;
|
588 | var clientHeight = target.clientHeight;
|
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 |
|
598 | if (!clientWidth && !clientHeight) {
|
599 | return emptyRect;
|
600 | }
|
601 |
|
602 | var styles = getWindowOf(target).getComputedStyle(target);
|
603 | var paddings = getPaddings(styles);
|
604 | var horizPad = paddings.left + paddings.right;
|
605 | var vertPad = paddings.top + paddings.bottom;
|
606 |
|
607 |
|
608 |
|
609 |
|
610 |
|
611 | var width = toFloat(styles.width),
|
612 | height = toFloat(styles.height);
|
613 |
|
614 |
|
615 |
|
616 | if (styles.boxSizing === 'border-box') {
|
617 |
|
618 |
|
619 |
|
620 |
|
621 |
|
622 |
|
623 | if (Math.round(width + horizPad) !== clientWidth) {
|
624 | width -= getBordersSize(styles, 'left', 'right') + horizPad;
|
625 | }
|
626 |
|
627 | if (Math.round(height + vertPad) !== clientHeight) {
|
628 | height -= getBordersSize(styles, 'top', 'bottom') + vertPad;
|
629 | }
|
630 | }
|
631 |
|
632 |
|
633 |
|
634 |
|
635 |
|
636 | if (!isDocumentElement(target)) {
|
637 |
|
638 |
|
639 |
|
640 |
|
641 | var vertScrollbar = Math.round(width + horizPad) - clientWidth;
|
642 | var horizScrollbar = Math.round(height + vertPad) - clientHeight;
|
643 |
|
644 |
|
645 |
|
646 |
|
647 |
|
648 |
|
649 | if (Math.abs(vertScrollbar) !== 1) {
|
650 | width -= vertScrollbar;
|
651 | }
|
652 |
|
653 | if (Math.abs(horizScrollbar) !== 1) {
|
654 | height -= horizScrollbar;
|
655 | }
|
656 | }
|
657 |
|
658 | return createRectInit(paddings.left, paddings.top, width, height);
|
659 | }
|
660 |
|
661 | |
662 |
|
663 |
|
664 |
|
665 |
|
666 |
|
667 | var isSVGGraphicsElement = (function () {
|
668 |
|
669 |
|
670 | if (typeof SVGGraphicsElement !== 'undefined') {
|
671 | return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; };
|
672 | }
|
673 |
|
674 |
|
675 |
|
676 |
|
677 | return function (target) { return target instanceof getWindowOf(target).SVGElement && typeof target.getBBox === 'function'; };
|
678 | })();
|
679 |
|
680 | |
681 |
|
682 |
|
683 |
|
684 |
|
685 |
|
686 | function isDocumentElement(target) {
|
687 | return target === getWindowOf(target).document.documentElement;
|
688 | }
|
689 |
|
690 | |
691 |
|
692 |
|
693 |
|
694 |
|
695 |
|
696 | function getContentRect(target) {
|
697 | if (!isBrowser) {
|
698 | return emptyRect;
|
699 | }
|
700 |
|
701 | if (isSVGGraphicsElement(target)) {
|
702 | return getSVGContentRect(target);
|
703 | }
|
704 |
|
705 | return getHTMLElementContentRect(target);
|
706 | }
|
707 |
|
708 | |
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 | function createReadOnlyRect(ref) {
|
716 | var x = ref.x;
|
717 | var y = ref.y;
|
718 | var width = ref.width;
|
719 | var height = ref.height;
|
720 |
|
721 |
|
722 | var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object;
|
723 | var rect = Object.create(Constr.prototype);
|
724 |
|
725 |
|
726 | defineConfigurable(rect, {
|
727 | x: x, y: y, width: width, height: height,
|
728 | top: y,
|
729 | right: x + width,
|
730 | bottom: height + y,
|
731 | left: x
|
732 | });
|
733 |
|
734 | return rect;
|
735 | }
|
736 |
|
737 | |
738 |
|
739 |
|
740 |
|
741 |
|
742 |
|
743 |
|
744 |
|
745 |
|
746 |
|
747 | function createRectInit(x, y, width, height) {
|
748 | return { x: x, y: y, width: width, height: height };
|
749 | }
|
750 |
|
751 | |
752 |
|
753 |
|
754 |
|
755 | var ResizeObservation = function(target) {
|
756 | this.broadcastWidth = 0;
|
757 | this.broadcastHeight = 0;
|
758 | this.contentRect_ = createRectInit(0, 0, 0, 0);
|
759 |
|
760 | this.target = target;
|
761 | };
|
762 |
|
763 | |
764 |
|
765 |
|
766 |
|
767 |
|
768 |
|
769 |
|
770 |
|
771 | |
772 |
|
773 |
|
774 |
|
775 |
|
776 |
|
777 |
|
778 | |
779 |
|
780 |
|
781 |
|
782 |
|
783 | ResizeObservation.prototype.isActive = function () {
|
784 | var rect = getContentRect(this.target);
|
785 |
|
786 | this.contentRect_ = rect;
|
787 |
|
788 | return rect.width !== this.broadcastWidth || rect.height !== this.broadcastHeight;
|
789 | };
|
790 |
|
791 | |
792 |
|
793 |
|
794 |
|
795 |
|
796 |
|
797 | ResizeObservation.prototype.broadcastRect = function () {
|
798 | var rect = this.contentRect_;
|
799 |
|
800 | this.broadcastWidth = rect.width;
|
801 | this.broadcastHeight = rect.height;
|
802 |
|
803 | return rect;
|
804 | };
|
805 |
|
806 | var ResizeObserverEntry = function(target, rectInit) {
|
807 | var contentRect = createReadOnlyRect(rectInit);
|
808 |
|
809 |
|
810 |
|
811 |
|
812 |
|
813 |
|
814 |
|
815 | defineConfigurable(this, { target: target, contentRect: contentRect });
|
816 | };
|
817 |
|
818 | var ResizeObserverSPI = function(callback, controller, callbackCtx) {
|
819 | this.activeObservations_ = [];
|
820 | this.observations_ = new MapShim();
|
821 |
|
822 | if (typeof callback !== 'function') {
|
823 | throw new TypeError('The callback provided as parameter 1 is not a function.');
|
824 | }
|
825 |
|
826 | this.callback_ = callback;
|
827 | this.controller_ = controller;
|
828 | this.callbackCtx_ = callbackCtx;
|
829 | };
|
830 |
|
831 | |
832 |
|
833 |
|
834 |
|
835 |
|
836 |
|
837 |
|
838 |
|
839 | |
840 |
|
841 |
|
842 |
|
843 |
|
844 |
|
845 |
|
846 | |
847 |
|
848 |
|
849 |
|
850 |
|
851 |
|
852 |
|
853 | |
854 |
|
855 |
|
856 |
|
857 |
|
858 |
|
859 | ResizeObserverSPI.prototype.observe = function (target) {
|
860 | if (!arguments.length) {
|
861 | throw new TypeError('1 argument required, but only 0 present.');
|
862 | }
|
863 |
|
864 |
|
865 | if (typeof Element === 'undefined' || !(Element instanceof Object)) {
|
866 | return;
|
867 | }
|
868 |
|
869 | if (!(target instanceof getWindowOf(target).Element)) {
|
870 | throw new TypeError('parameter 1 is not of type "Element".');
|
871 | }
|
872 |
|
873 | var observations = this.observations_;
|
874 |
|
875 |
|
876 | if (observations.has(target)) {
|
877 | return;
|
878 | }
|
879 |
|
880 | observations.set(target, new ResizeObservation(target));
|
881 |
|
882 | this.controller_.addObserver(this);
|
883 |
|
884 |
|
885 | this.controller_.refresh();
|
886 | };
|
887 |
|
888 | |
889 |
|
890 |
|
891 |
|
892 |
|
893 |
|
894 | ResizeObserverSPI.prototype.unobserve = function (target) {
|
895 | if (!arguments.length) {
|
896 | throw new TypeError('1 argument required, but only 0 present.');
|
897 | }
|
898 |
|
899 |
|
900 | if (typeof Element === 'undefined' || !(Element instanceof Object)) {
|
901 | return;
|
902 | }
|
903 |
|
904 | if (!(target instanceof getWindowOf(target).Element)) {
|
905 | throw new TypeError('parameter 1 is not of type "Element".');
|
906 | }
|
907 |
|
908 | var observations = this.observations_;
|
909 |
|
910 |
|
911 | if (!observations.has(target)) {
|
912 | return;
|
913 | }
|
914 |
|
915 | observations.delete(target);
|
916 |
|
917 | if (!observations.size) {
|
918 | this.controller_.removeObserver(this);
|
919 | }
|
920 | };
|
921 |
|
922 | |
923 |
|
924 |
|
925 |
|
926 |
|
927 | ResizeObserverSPI.prototype.disconnect = function () {
|
928 | this.clearActive();
|
929 | this.observations_.clear();
|
930 | this.controller_.removeObserver(this);
|
931 | };
|
932 |
|
933 | |
934 |
|
935 |
|
936 |
|
937 |
|
938 |
|
939 | ResizeObserverSPI.prototype.gatherActive = function () {
|
940 | var this$1 = this;
|
941 |
|
942 | this.clearActive();
|
943 |
|
944 | this.observations_.forEach(function (observation) {
|
945 | if (observation.isActive()) {
|
946 | this$1.activeObservations_.push(observation);
|
947 | }
|
948 | });
|
949 | };
|
950 |
|
951 | |
952 |
|
953 |
|
954 |
|
955 |
|
956 |
|
957 | ResizeObserverSPI.prototype.broadcastActive = function () {
|
958 |
|
959 | if (!this.hasActive()) {
|
960 | return;
|
961 | }
|
962 |
|
963 | var ctx = this.callbackCtx_;
|
964 |
|
965 |
|
966 | var entries = this.activeObservations_.map(function (observation) {
|
967 | return new ResizeObserverEntry(observation.target, observation.broadcastRect());
|
968 | });
|
969 |
|
970 | this.callback_.call(ctx, entries, ctx);
|
971 | this.clearActive();
|
972 | };
|
973 |
|
974 | |
975 |
|
976 |
|
977 |
|
978 |
|
979 | ResizeObserverSPI.prototype.clearActive = function () {
|
980 | this.activeObservations_.splice(0);
|
981 | };
|
982 |
|
983 | |
984 |
|
985 |
|
986 |
|
987 |
|
988 | ResizeObserverSPI.prototype.hasActive = function () {
|
989 | return this.activeObservations_.length > 0;
|
990 | };
|
991 |
|
992 |
|
993 |
|
994 |
|
995 | var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim();
|
996 |
|
997 | |
998 |
|
999 |
|
1000 |
|
1001 | var ResizeObserver = function(callback) {
|
1002 | if (!(this instanceof ResizeObserver)) {
|
1003 | throw new TypeError('Cannot call a class as a function.');
|
1004 | }
|
1005 | if (!arguments.length) {
|
1006 | throw new TypeError('1 argument required, but only 0 present.');
|
1007 | }
|
1008 |
|
1009 | var controller = ResizeObserverController.getInstance();
|
1010 | var observer = new ResizeObserverSPI(callback, controller, this);
|
1011 |
|
1012 | observers.set(this, observer);
|
1013 | };
|
1014 |
|
1015 |
|
1016 | ['observe', 'unobserve', 'disconnect'].forEach(function (method) {
|
1017 | ResizeObserver.prototype[method] = function () {
|
1018 | return (ref = observers.get(this))[method].apply(ref, arguments);
|
1019 | var ref;
|
1020 | };
|
1021 | });
|
1022 |
|
1023 | var index = (function () {
|
1024 |
|
1025 | if (typeof global$1.ResizeObserver !== 'undefined') {
|
1026 | return global$1.ResizeObserver;
|
1027 | }
|
1028 |
|
1029 | return ResizeObserver;
|
1030 | })();
|
1031 |
|
1032 | |
1033 |
|
1034 |
|
1035 |
|
1036 |
|
1037 | var PERFECT_SCROLLBAR_CONFIG = new core.InjectionToken('PERFECT_SCROLLBAR_CONFIG');
|
1038 | var Geometry = (function () {
|
1039 | function Geometry(x, y, w, h) {
|
1040 | this.x = x;
|
1041 | this.y = y;
|
1042 | this.w = w;
|
1043 | this.h = h;
|
1044 | }
|
1045 | return Geometry;
|
1046 | }());
|
1047 | var Position = (function () {
|
1048 | function Position(x, y) {
|
1049 | this.x = x;
|
1050 | this.y = y;
|
1051 | }
|
1052 | return Position;
|
1053 | }());
|
1054 |
|
1055 | var PerfectScrollbarEvents = [
|
1056 | 'psScrollY',
|
1057 | 'psScrollX',
|
1058 | 'psScrollUp',
|
1059 | 'psScrollDown',
|
1060 | 'psScrollLeft',
|
1061 | 'psScrollRight',
|
1062 | 'psYReachEnd',
|
1063 | 'psYReachStart',
|
1064 | 'psXReachEnd',
|
1065 | 'psXReachStart'
|
1066 | ];
|
1067 | var PerfectScrollbarConfig = (function () {
|
1068 | function PerfectScrollbarConfig(config) {
|
1069 | if (config === void 0) { config = {}; }
|
1070 | this.assign(config);
|
1071 | }
|
1072 | |
1073 |
|
1074 |
|
1075 |
|
1076 | PerfectScrollbarConfig.prototype.assign = |
1077 |
|
1078 |
|
1079 |
|
1080 | function (config) {
|
1081 | if (config === void 0) { config = {}; }
|
1082 | for (var key in config) {
|
1083 | this[( (key))] = config[( (key))];
|
1084 | }
|
1085 | };
|
1086 | return PerfectScrollbarConfig;
|
1087 | }());
|
1088 |
|
1089 | |
1090 |
|
1091 |
|
1092 |
|
1093 | var PerfectScrollbarDirective = (function () {
|
1094 | function PerfectScrollbarDirective(zone, differs, elementRef, platformId, defaults) {
|
1095 | this.zone = zone;
|
1096 | this.differs = differs;
|
1097 | this.elementRef = elementRef;
|
1098 | this.platformId = platformId;
|
1099 | this.defaults = defaults;
|
1100 | this.instance = null;
|
1101 | this.ro = null;
|
1102 | this.timeout = null;
|
1103 | this.animation = null;
|
1104 | this.configDiff = null;
|
1105 | this.ngDestroy = new rxjs.Subject();
|
1106 | this.disabled = false;
|
1107 | this.psScrollY = new core.EventEmitter();
|
1108 | this.psScrollX = new core.EventEmitter();
|
1109 | this.psScrollUp = new core.EventEmitter();
|
1110 | this.psScrollDown = new core.EventEmitter();
|
1111 | this.psScrollLeft = new core.EventEmitter();
|
1112 | this.psScrollRight = new core.EventEmitter();
|
1113 | this.psYReachEnd = new core.EventEmitter();
|
1114 | this.psYReachStart = new core.EventEmitter();
|
1115 | this.psXReachEnd = new core.EventEmitter();
|
1116 | this.psXReachStart = new core.EventEmitter();
|
1117 | }
|
1118 | |
1119 |
|
1120 |
|
1121 | PerfectScrollbarDirective.prototype.ngOnInit = |
1122 |
|
1123 |
|
1124 | function () {
|
1125 | var _this = this;
|
1126 | if (!this.disabled && common.isPlatformBrowser(this.platformId)) {
|
1127 |
|
1128 | var config_1 = new PerfectScrollbarConfig(this.defaults);
|
1129 | config_1.assign(this.config);
|
1130 | this.zone.runOutsideAngular(function () {
|
1131 | _this.instance = new PerfectScrollbar(_this.elementRef.nativeElement, config_1);
|
1132 | });
|
1133 | if (!this.configDiff) {
|
1134 | this.configDiff = this.differs.find(this.config || {}).create();
|
1135 | this.configDiff.diff(this.config || {});
|
1136 | }
|
1137 | this.zone.runOutsideAngular(function () {
|
1138 | _this.ro = new index(function () {
|
1139 | _this.update();
|
1140 | });
|
1141 | if (_this.elementRef.nativeElement.children[0]) {
|
1142 | _this.ro.observe(_this.elementRef.nativeElement.children[0]);
|
1143 | }
|
1144 | _this.ro.observe(_this.elementRef.nativeElement);
|
1145 | });
|
1146 | this.zone.runOutsideAngular(function () {
|
1147 | PerfectScrollbarEvents.forEach(function (eventName) {
|
1148 |
|
1149 | var eventType = eventName.replace(/([A-Z])/g, function (c) { return "-" + c.toLowerCase(); });
|
1150 | rxjs.fromEvent(_this.elementRef.nativeElement, eventType)
|
1151 | .pipe(operators.debounceTime(20), operators.takeUntil(_this.ngDestroy))
|
1152 | .subscribe(function (event) {
|
1153 | _this[eventName].emit(event);
|
1154 | });
|
1155 | });
|
1156 | });
|
1157 | }
|
1158 | };
|
1159 | |
1160 |
|
1161 |
|
1162 | PerfectScrollbarDirective.prototype.ngOnDestroy = |
1163 |
|
1164 |
|
1165 | function () {
|
1166 | var _this = this;
|
1167 | if (common.isPlatformBrowser(this.platformId)) {
|
1168 | this.ngDestroy.next();
|
1169 | this.ngDestroy.complete();
|
1170 | if (this.ro) {
|
1171 | this.ro.disconnect();
|
1172 | }
|
1173 | if (this.timeout && typeof window !== 'undefined') {
|
1174 | window.clearTimeout(this.timeout);
|
1175 | }
|
1176 | this.zone.runOutsideAngular(function () {
|
1177 | if (_this.instance) {
|
1178 | _this.instance.destroy();
|
1179 | }
|
1180 | });
|
1181 | this.instance = null;
|
1182 | }
|
1183 | };
|
1184 | |
1185 |
|
1186 |
|
1187 | PerfectScrollbarDirective.prototype.ngDoCheck = |
1188 |
|
1189 |
|
1190 | function () {
|
1191 | if (!this.disabled && this.configDiff && common.isPlatformBrowser(this.platformId)) {
|
1192 |
|
1193 | var changes = this.configDiff.diff(this.config || {});
|
1194 | if (changes) {
|
1195 | this.ngOnDestroy();
|
1196 | this.ngOnInit();
|
1197 | }
|
1198 | }
|
1199 | };
|
1200 | |
1201 |
|
1202 |
|
1203 |
|
1204 | PerfectScrollbarDirective.prototype.ngOnChanges = |
1205 |
|
1206 |
|
1207 |
|
1208 | function (changes) {
|
1209 | if (changes['disabled'] && !changes['disabled'].isFirstChange() && common.isPlatformBrowser(this.platformId)) {
|
1210 | if (changes['disabled'].currentValue !== changes['disabled'].previousValue) {
|
1211 | if (changes['disabled'].currentValue === true) {
|
1212 | this.ngOnDestroy();
|
1213 | }
|
1214 | else if (changes['disabled'].currentValue === false) {
|
1215 | this.ngOnInit();
|
1216 | }
|
1217 | }
|
1218 | }
|
1219 | };
|
1220 | |
1221 |
|
1222 |
|
1223 | PerfectScrollbarDirective.prototype.ps = |
1224 |
|
1225 |
|
1226 | function () {
|
1227 | return this.instance;
|
1228 | };
|
1229 | |
1230 |
|
1231 |
|
1232 | PerfectScrollbarDirective.prototype.update = |
1233 |
|
1234 |
|
1235 | function () {
|
1236 | var _this = this;
|
1237 | if (typeof window !== 'undefined') {
|
1238 | if (this.timeout) {
|
1239 | window.clearTimeout(this.timeout);
|
1240 | }
|
1241 | this.timeout = window.setTimeout(function () {
|
1242 | if (!_this.disabled && _this.configDiff) {
|
1243 | try {
|
1244 | _this.zone.runOutsideAngular(function () {
|
1245 | if (_this.instance) {
|
1246 | _this.instance.update();
|
1247 | }
|
1248 | });
|
1249 | }
|
1250 | catch (error) {
|
1251 |
|
1252 | }
|
1253 | }
|
1254 | }, 0);
|
1255 | }
|
1256 | };
|
1257 | |
1258 |
|
1259 |
|
1260 |
|
1261 | PerfectScrollbarDirective.prototype.geometry = |
1262 |
|
1263 |
|
1264 |
|
1265 | function (prefix) {
|
1266 | if (prefix === void 0) { prefix = 'scroll'; }
|
1267 | return new Geometry(this.elementRef.nativeElement[prefix + 'Left'], this.elementRef.nativeElement[prefix + 'Top'], this.elementRef.nativeElement[prefix + 'Width'], this.elementRef.nativeElement[prefix + 'Height']);
|
1268 | };
|
1269 | |
1270 |
|
1271 |
|
1272 |
|
1273 | PerfectScrollbarDirective.prototype.position = |
1274 |
|
1275 |
|
1276 |
|
1277 | function (absolute) {
|
1278 | if (absolute === void 0) { absolute = false; }
|
1279 | if (!absolute && this.instance) {
|
1280 | return new Position(this.instance.reach.x || 0, this.instance.reach.y || 0);
|
1281 | }
|
1282 | else {
|
1283 | return new Position(this.elementRef.nativeElement.scrollLeft, this.elementRef.nativeElement.scrollTop);
|
1284 | }
|
1285 | };
|
1286 | |
1287 |
|
1288 |
|
1289 |
|
1290 | PerfectScrollbarDirective.prototype.scrollable = |
1291 |
|
1292 |
|
1293 |
|
1294 | function (direction) {
|
1295 | if (direction === void 0) { direction = 'any'; }
|
1296 |
|
1297 | var element = this.elementRef.nativeElement;
|
1298 | if (direction === 'any') {
|
1299 | return element.classList.contains('ps--active-x') ||
|
1300 | element.classList.contains('ps--active-y');
|
1301 | }
|
1302 | else if (direction === 'both') {
|
1303 | return element.classList.contains('ps--active-x') &&
|
1304 | element.classList.contains('ps--active-y');
|
1305 | }
|
1306 | else {
|
1307 | return element.classList.contains('ps--active-' + direction);
|
1308 | }
|
1309 | };
|
1310 | |
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 | PerfectScrollbarDirective.prototype.scrollTo = |
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 | function (x, y, speed) {
|
1323 | if (!this.disabled) {
|
1324 | if (y == null && speed == null) {
|
1325 | this.animateScrolling('scrollTop', x, speed);
|
1326 | }
|
1327 | else {
|
1328 | if (x != null) {
|
1329 | this.animateScrolling('scrollLeft', x, speed);
|
1330 | }
|
1331 | if (y != null) {
|
1332 | this.animateScrolling('scrollTop', y, speed);
|
1333 | }
|
1334 | }
|
1335 | }
|
1336 | };
|
1337 | |
1338 |
|
1339 |
|
1340 |
|
1341 |
|
1342 | PerfectScrollbarDirective.prototype.scrollToX = |
1343 |
|
1344 |
|
1345 |
|
1346 |
|
1347 | function (x, speed) {
|
1348 | this.animateScrolling('scrollLeft', x, speed);
|
1349 | };
|
1350 | |
1351 |
|
1352 |
|
1353 |
|
1354 |
|
1355 | PerfectScrollbarDirective.prototype.scrollToY = |
1356 |
|
1357 |
|
1358 |
|
1359 |
|
1360 | function (y, speed) {
|
1361 | this.animateScrolling('scrollTop', y, speed);
|
1362 | };
|
1363 | |
1364 |
|
1365 |
|
1366 |
|
1367 |
|
1368 | PerfectScrollbarDirective.prototype.scrollToTop = |
1369 |
|
1370 |
|
1371 |
|
1372 |
|
1373 | function (offset, speed) {
|
1374 | this.animateScrolling('scrollTop', (offset || 0), speed);
|
1375 | };
|
1376 | |
1377 |
|
1378 |
|
1379 |
|
1380 |
|
1381 | PerfectScrollbarDirective.prototype.scrollToLeft = |
1382 |
|
1383 |
|
1384 |
|
1385 |
|
1386 | function (offset, speed) {
|
1387 | this.animateScrolling('scrollLeft', (offset || 0), speed);
|
1388 | };
|
1389 | |
1390 |
|
1391 |
|
1392 |
|
1393 |
|
1394 | PerfectScrollbarDirective.prototype.scrollToRight = |
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 | function (offset, speed) {
|
1400 |
|
1401 | var left = this.elementRef.nativeElement.scrollWidth -
|
1402 | this.elementRef.nativeElement.clientWidth;
|
1403 | this.animateScrolling('scrollLeft', left - (offset || 0), speed);
|
1404 | };
|
1405 | |
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 | PerfectScrollbarDirective.prototype.scrollToBottom = |
1411 |
|
1412 |
|
1413 |
|
1414 |
|
1415 | function (offset, speed) {
|
1416 |
|
1417 | var top = this.elementRef.nativeElement.scrollHeight -
|
1418 | this.elementRef.nativeElement.clientHeight;
|
1419 | this.animateScrolling('scrollTop', top - (offset || 0), speed);
|
1420 | };
|
1421 | |
1422 |
|
1423 |
|
1424 |
|
1425 |
|
1426 |
|
1427 | PerfectScrollbarDirective.prototype.scrollToElement = |
1428 |
|
1429 |
|
1430 |
|
1431 |
|
1432 |
|
1433 | function (qs, offset, speed) {
|
1434 |
|
1435 | var element = this.elementRef.nativeElement.querySelector(qs);
|
1436 | if (element) {
|
1437 |
|
1438 | var elementPos = element.getBoundingClientRect();
|
1439 |
|
1440 | var scrollerPos = this.elementRef.nativeElement.getBoundingClientRect();
|
1441 | if (this.elementRef.nativeElement.classList.contains('ps--active-x')) {
|
1442 |
|
1443 | var currentPos = this.elementRef.nativeElement['scrollLeft'];
|
1444 |
|
1445 | var position = elementPos.left - scrollerPos.left + currentPos;
|
1446 | this.animateScrolling('scrollLeft', position + (offset || 0), speed);
|
1447 | }
|
1448 | if (this.elementRef.nativeElement.classList.contains('ps--active-y')) {
|
1449 |
|
1450 | var currentPos = this.elementRef.nativeElement['scrollTop'];
|
1451 |
|
1452 | var position = elementPos.top - scrollerPos.top + currentPos;
|
1453 | this.animateScrolling('scrollTop', position + (offset || 0), speed);
|
1454 | }
|
1455 | }
|
1456 | };
|
1457 | |
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 | PerfectScrollbarDirective.prototype.animateScrolling = |
1464 |
|
1465 |
|
1466 |
|
1467 |
|
1468 |
|
1469 | function (target, value, speed) {
|
1470 | var _this = this;
|
1471 | if (this.animation) {
|
1472 | window.cancelAnimationFrame(this.animation);
|
1473 | this.animation = null;
|
1474 | }
|
1475 | if (!speed || typeof window === 'undefined') {
|
1476 | this.elementRef.nativeElement[target] = value;
|
1477 | }
|
1478 | else if (value !== this.elementRef.nativeElement[target]) {
|
1479 |
|
1480 | var newValue_1 = 0;
|
1481 |
|
1482 | var scrollCount_1 = 0;
|
1483 |
|
1484 | var oldTimestamp_1 = performance.now();
|
1485 |
|
1486 | var oldValue_1 = this.elementRef.nativeElement[target];
|
1487 |
|
1488 | var cosParameter_1 = (oldValue_1 - value) / 2;
|
1489 |
|
1490 | var step_1 = function (newTimestamp) {
|
1491 | scrollCount_1 += Math.PI / (speed / (newTimestamp - oldTimestamp_1));
|
1492 | newValue_1 = Math.round(value + cosParameter_1 + cosParameter_1 * Math.cos(scrollCount_1));
|
1493 |
|
1494 | if (_this.elementRef.nativeElement[target] === oldValue_1) {
|
1495 | if (scrollCount_1 >= Math.PI) {
|
1496 | _this.animateScrolling(target, value, 0);
|
1497 | }
|
1498 | else {
|
1499 | _this.elementRef.nativeElement[target] = newValue_1;
|
1500 |
|
1501 | oldValue_1 = _this.elementRef.nativeElement[target];
|
1502 | oldTimestamp_1 = newTimestamp;
|
1503 | _this.animation = window.requestAnimationFrame(step_1);
|
1504 | }
|
1505 | }
|
1506 | };
|
1507 | window.requestAnimationFrame(step_1);
|
1508 | }
|
1509 | };
|
1510 | PerfectScrollbarDirective.decorators = [
|
1511 | { type: core.Directive, args: [{
|
1512 | selector: '[perfectScrollbar]',
|
1513 | exportAs: 'ngxPerfectScrollbar'
|
1514 | },] }
|
1515 | ];
|
1516 |
|
1517 | PerfectScrollbarDirective.ctorParameters = function () { return [
|
1518 | { type: core.NgZone },
|
1519 | { type: core.KeyValueDiffers },
|
1520 | { type: core.ElementRef },
|
1521 | { type: Object, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] },
|
1522 | { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [PERFECT_SCROLLBAR_CONFIG,] }] }
|
1523 | ]; };
|
1524 | PerfectScrollbarDirective.propDecorators = {
|
1525 | disabled: [{ type: core.Input }],
|
1526 | config: [{ type: core.Input, args: ['perfectScrollbar',] }],
|
1527 | psScrollY: [{ type: core.Output }],
|
1528 | psScrollX: [{ type: core.Output }],
|
1529 | psScrollUp: [{ type: core.Output }],
|
1530 | psScrollDown: [{ type: core.Output }],
|
1531 | psScrollLeft: [{ type: core.Output }],
|
1532 | psScrollRight: [{ type: core.Output }],
|
1533 | psYReachEnd: [{ type: core.Output }],
|
1534 | psYReachStart: [{ type: core.Output }],
|
1535 | psXReachEnd: [{ type: core.Output }],
|
1536 | psXReachStart: [{ type: core.Output }]
|
1537 | };
|
1538 | return PerfectScrollbarDirective;
|
1539 | }());
|
1540 |
|
1541 | |
1542 |
|
1543 |
|
1544 |
|
1545 | var PerfectScrollbarComponent = (function () {
|
1546 | function PerfectScrollbarComponent(zone, cdRef, platformId) {
|
1547 | this.zone = zone;
|
1548 | this.cdRef = cdRef;
|
1549 | this.platformId = platformId;
|
1550 | this.states = {};
|
1551 | this.indicatorX = false;
|
1552 | this.indicatorY = false;
|
1553 | this.interaction = false;
|
1554 | this.scrollPositionX = 0;
|
1555 | this.scrollPositionY = 0;
|
1556 | this.scrollDirectionX = 0;
|
1557 | this.scrollDirectionY = 0;
|
1558 | this.usePropagationX = false;
|
1559 | this.usePropagationY = false;
|
1560 | this.allowPropagationX = false;
|
1561 | this.allowPropagationY = false;
|
1562 | this.stateTimeout = null;
|
1563 | this.ngDestroy = new rxjs.Subject();
|
1564 | this.stateUpdate = new rxjs.Subject();
|
1565 | this.disabled = false;
|
1566 | this.usePSClass = true;
|
1567 | this.autoPropagation = false;
|
1568 | this.scrollIndicators = false;
|
1569 | this.psScrollY = new core.EventEmitter();
|
1570 | this.psScrollX = new core.EventEmitter();
|
1571 | this.psScrollUp = new core.EventEmitter();
|
1572 | this.psScrollDown = new core.EventEmitter();
|
1573 | this.psScrollLeft = new core.EventEmitter();
|
1574 | this.psScrollRight = new core.EventEmitter();
|
1575 | this.psYReachEnd = new core.EventEmitter();
|
1576 | this.psYReachStart = new core.EventEmitter();
|
1577 | this.psXReachEnd = new core.EventEmitter();
|
1578 | this.psXReachStart = new core.EventEmitter();
|
1579 | }
|
1580 | |
1581 |
|
1582 |
|
1583 | PerfectScrollbarComponent.prototype.ngOnInit = |
1584 |
|
1585 |
|
1586 | function () {
|
1587 | var _this = this;
|
1588 | if (common.isPlatformBrowser(this.platformId)) {
|
1589 | this.stateUpdate
|
1590 | .pipe(operators.takeUntil(this.ngDestroy), operators.distinctUntilChanged(function (a, b) { return (a === b && !_this.stateTimeout); }))
|
1591 | .subscribe(function (state) {
|
1592 | if (_this.stateTimeout && typeof window !== 'undefined') {
|
1593 | window.clearTimeout(_this.stateTimeout);
|
1594 | _this.stateTimeout = null;
|
1595 | }
|
1596 | if (state === 'x' || state === 'y') {
|
1597 | _this.interaction = false;
|
1598 | if (state === 'x') {
|
1599 | _this.indicatorX = false;
|
1600 | _this.states.left = false;
|
1601 | _this.states.right = false;
|
1602 | if (_this.autoPropagation && _this.usePropagationX) {
|
1603 | _this.allowPropagationX = false;
|
1604 | }
|
1605 | }
|
1606 | else if (state === 'y') {
|
1607 | _this.indicatorY = false;
|
1608 | _this.states.top = false;
|
1609 | _this.states.bottom = false;
|
1610 | if (_this.autoPropagation && _this.usePropagationY) {
|
1611 | _this.allowPropagationY = false;
|
1612 | }
|
1613 | }
|
1614 | }
|
1615 | else {
|
1616 | if (state === 'left' || state === 'right') {
|
1617 | _this.states.left = false;
|
1618 | _this.states.right = false;
|
1619 | _this.states[state] = true;
|
1620 | if (_this.autoPropagation && _this.usePropagationX) {
|
1621 | _this.indicatorX = true;
|
1622 | }
|
1623 | }
|
1624 | else if (state === 'top' || state === 'bottom') {
|
1625 | _this.states.top = false;
|
1626 | _this.states.bottom = false;
|
1627 | _this.states[state] = true;
|
1628 | if (_this.autoPropagation && _this.usePropagationY) {
|
1629 | _this.indicatorY = true;
|
1630 | }
|
1631 | }
|
1632 | if (_this.autoPropagation && typeof window !== 'undefined') {
|
1633 | _this.stateTimeout = window.setTimeout(function () {
|
1634 | _this.indicatorX = false;
|
1635 | _this.indicatorY = false;
|
1636 | _this.stateTimeout = null;
|
1637 | if (_this.interaction && (_this.states.left || _this.states.right)) {
|
1638 | _this.allowPropagationX = true;
|
1639 | }
|
1640 | if (_this.interaction && (_this.states.top || _this.states.bottom)) {
|
1641 | _this.allowPropagationY = true;
|
1642 | }
|
1643 | _this.cdRef.markForCheck();
|
1644 | }, 500);
|
1645 | }
|
1646 | }
|
1647 | _this.cdRef.markForCheck();
|
1648 | _this.cdRef.detectChanges();
|
1649 | });
|
1650 | this.zone.runOutsideAngular(function () {
|
1651 | if (_this.directiveRef) {
|
1652 |
|
1653 | var element = _this.directiveRef.elementRef.nativeElement;
|
1654 | rxjs.fromEvent(element, 'wheel')
|
1655 | .pipe(operators.takeUntil(_this.ngDestroy))
|
1656 | .subscribe(function (event) {
|
1657 | if (!_this.disabled && _this.autoPropagation) {
|
1658 |
|
1659 | var scrollDeltaX = event.deltaX;
|
1660 |
|
1661 | var scrollDeltaY = event.deltaY;
|
1662 | _this.checkPropagation(event, scrollDeltaX, scrollDeltaY);
|
1663 | }
|
1664 | });
|
1665 | rxjs.fromEvent(element, 'touchmove')
|
1666 | .pipe(operators.takeUntil(_this.ngDestroy))
|
1667 | .subscribe(function (event) {
|
1668 | if (!_this.disabled && _this.autoPropagation) {
|
1669 |
|
1670 | var scrollPositionX = event.touches[0].clientX;
|
1671 |
|
1672 | var scrollPositionY = event.touches[0].clientY;
|
1673 |
|
1674 | var scrollDeltaX = scrollPositionX - _this.scrollPositionX;
|
1675 |
|
1676 | var scrollDeltaY = scrollPositionY - _this.scrollPositionY;
|
1677 | _this.checkPropagation(event, scrollDeltaX, scrollDeltaY);
|
1678 | _this.scrollPositionX = scrollPositionX;
|
1679 | _this.scrollPositionY = scrollPositionY;
|
1680 | }
|
1681 | });
|
1682 | rxjs.merge(rxjs.fromEvent(element, 'ps-scroll-x')
|
1683 | .pipe(operators.mapTo('x')), rxjs.fromEvent(element, 'ps-scroll-y')
|
1684 | .pipe(operators.mapTo('y')), rxjs.fromEvent(element, 'ps-x-reach-end')
|
1685 | .pipe(operators.mapTo('right')), rxjs.fromEvent(element, 'ps-y-reach-end')
|
1686 | .pipe(operators.mapTo('bottom')), rxjs.fromEvent(element, 'ps-x-reach-start')
|
1687 | .pipe(operators.mapTo('left')), rxjs.fromEvent(element, 'ps-y-reach-start')
|
1688 | .pipe(operators.mapTo('top')))
|
1689 | .pipe(operators.takeUntil(_this.ngDestroy))
|
1690 | .subscribe(function (state) {
|
1691 | if (!_this.disabled && (_this.autoPropagation || _this.scrollIndicators)) {
|
1692 | _this.stateUpdate.next(state);
|
1693 | }
|
1694 | });
|
1695 | }
|
1696 | });
|
1697 | window.setTimeout(function () {
|
1698 | PerfectScrollbarEvents.forEach(function (eventName) {
|
1699 | if (_this.directiveRef) {
|
1700 | _this.directiveRef[eventName] = _this[eventName];
|
1701 | }
|
1702 | });
|
1703 | }, 0);
|
1704 | }
|
1705 | };
|
1706 | |
1707 |
|
1708 |
|
1709 | PerfectScrollbarComponent.prototype.ngOnDestroy = |
1710 |
|
1711 |
|
1712 | function () {
|
1713 | if (common.isPlatformBrowser(this.platformId)) {
|
1714 | this.ngDestroy.next();
|
1715 | this.ngDestroy.unsubscribe();
|
1716 | if (this.stateTimeout && typeof window !== 'undefined') {
|
1717 | window.clearTimeout(this.stateTimeout);
|
1718 | }
|
1719 | }
|
1720 | };
|
1721 | |
1722 |
|
1723 |
|
1724 | PerfectScrollbarComponent.prototype.ngDoCheck = |
1725 |
|
1726 |
|
1727 | function () {
|
1728 | if (common.isPlatformBrowser(this.platformId)) {
|
1729 | if (!this.disabled && this.autoPropagation && this.directiveRef) {
|
1730 |
|
1731 | var element = this.directiveRef.elementRef.nativeElement;
|
1732 | this.usePropagationX = element.classList.contains('ps--active-x');
|
1733 | this.usePropagationY = element.classList.contains('ps--active-y');
|
1734 | }
|
1735 | }
|
1736 | };
|
1737 | |
1738 |
|
1739 |
|
1740 |
|
1741 |
|
1742 |
|
1743 | PerfectScrollbarComponent.prototype.checkPropagation = |
1744 |
|
1745 |
|
1746 |
|
1747 |
|
1748 |
|
1749 | function (event, deltaX, deltaY) {
|
1750 | this.interaction = true;
|
1751 |
|
1752 | var scrollDirectionX = (deltaX < 0) ? -1 : 1;
|
1753 |
|
1754 | var scrollDirectionY = (deltaY < 0) ? -1 : 1;
|
1755 | if ((this.usePropagationX && this.usePropagationY) ||
|
1756 | (this.usePropagationX && (!this.allowPropagationX ||
|
1757 | (this.scrollDirectionX !== scrollDirectionX))) ||
|
1758 | (this.usePropagationY && (!this.allowPropagationY ||
|
1759 | (this.scrollDirectionY !== scrollDirectionY)))) {
|
1760 | event.preventDefault();
|
1761 | event.stopPropagation();
|
1762 | }
|
1763 | if (!!deltaX) {
|
1764 | this.scrollDirectionX = scrollDirectionX;
|
1765 | }
|
1766 | if (!!deltaY) {
|
1767 | this.scrollDirectionY = scrollDirectionY;
|
1768 | }
|
1769 | this.stateUpdate.next('interaction');
|
1770 | this.cdRef.detectChanges();
|
1771 | };
|
1772 | PerfectScrollbarComponent.decorators = [
|
1773 | { type: core.Component, args: [{
|
1774 | selector: 'perfect-scrollbar',
|
1775 | exportAs: 'ngxPerfectScrollbar',
|
1776 | 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",
|
1777 | encapsulation: core.ViewEncapsulation.None,
|
1778 | 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 > .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"]
|
1779 | }] }
|
1780 | ];
|
1781 |
|
1782 | PerfectScrollbarComponent.ctorParameters = function () { return [
|
1783 | { type: core.NgZone },
|
1784 | { type: core.ChangeDetectorRef },
|
1785 | { type: Object, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] }
|
1786 | ]; };
|
1787 | PerfectScrollbarComponent.propDecorators = {
|
1788 | disabled: [{ type: core.Input }],
|
1789 | usePSClass: [{ type: core.Input }],
|
1790 | autoPropagation: [{ type: core.HostBinding, args: ['class.ps-show-limits',] }, { type: core.Input }],
|
1791 | scrollIndicators: [{ type: core.HostBinding, args: ['class.ps-show-active',] }, { type: core.Input }],
|
1792 | config: [{ type: core.Input }],
|
1793 | psScrollY: [{ type: core.Output }],
|
1794 | psScrollX: [{ type: core.Output }],
|
1795 | psScrollUp: [{ type: core.Output }],
|
1796 | psScrollDown: [{ type: core.Output }],
|
1797 | psScrollLeft: [{ type: core.Output }],
|
1798 | psScrollRight: [{ type: core.Output }],
|
1799 | psYReachEnd: [{ type: core.Output }],
|
1800 | psYReachStart: [{ type: core.Output }],
|
1801 | psXReachEnd: [{ type: core.Output }],
|
1802 | psXReachStart: [{ type: core.Output }],
|
1803 | directiveRef: [{ type: core.ViewChild, args: [PerfectScrollbarDirective,] }]
|
1804 | };
|
1805 | return PerfectScrollbarComponent;
|
1806 | }());
|
1807 |
|
1808 | |
1809 |
|
1810 |
|
1811 |
|
1812 | var PerfectScrollbarModule = (function () {
|
1813 | function PerfectScrollbarModule() {
|
1814 | }
|
1815 | PerfectScrollbarModule.decorators = [
|
1816 | { type: core.NgModule, args: [{
|
1817 | imports: [common.CommonModule],
|
1818 | declarations: [PerfectScrollbarComponent, PerfectScrollbarDirective],
|
1819 | exports: [common.CommonModule, PerfectScrollbarComponent, PerfectScrollbarDirective]
|
1820 | },] }
|
1821 | ];
|
1822 | return PerfectScrollbarModule;
|
1823 | }());
|
1824 |
|
1825 | exports.PerfectScrollbarComponent = PerfectScrollbarComponent;
|
1826 | exports.PerfectScrollbarDirective = PerfectScrollbarDirective;
|
1827 | exports.Geometry = Geometry;
|
1828 | exports.Position = Position;
|
1829 | exports.PERFECT_SCROLLBAR_CONFIG = PERFECT_SCROLLBAR_CONFIG;
|
1830 | exports.PerfectScrollbarConfig = PerfectScrollbarConfig;
|
1831 | exports.PerfectScrollbarModule = PerfectScrollbarModule;
|
1832 |
|
1833 | Object.defineProperty(exports, '__esModule', { value: true });
|
1834 |
|
1835 | })));
|
1836 |
|