@scion/components 18.1.1 → 19.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dimension/dimension.directive.d.ts +2 -2
- package/dimension/dimension.module.d.ts +2 -0
- package/dimension/public_api.d.ts +1 -1
- package/fesm2022/scion-components-dimension.mjs +18 -17
- package/fesm2022/scion-components-dimension.mjs.map +1 -1
- package/fesm2022/scion-components-sashbox.mjs +222 -215
- package/fesm2022/scion-components-sashbox.mjs.map +1 -1
- package/fesm2022/scion-components-splitter.mjs +69 -74
- package/fesm2022/scion-components-splitter.mjs.map +1 -1
- package/fesm2022/scion-components-throbber.mjs +43 -45
- package/fesm2022/scion-components-throbber.mjs.map +1 -1
- package/fesm2022/scion-components-viewport.mjs +94 -99
- package/fesm2022/scion-components-viewport.mjs.map +1 -1
- package/package.json +4 -16
- package/sashbox/element-ref.directive.d.ts +1 -4
- package/sashbox/sash-initializer.directive.d.ts +4 -7
- package/sashbox/sash.directive.d.ts +21 -20
- package/sashbox/sashbox-accessor.d.ts +3 -4
- package/sashbox/sashbox.component.d.ts +36 -27
- package/sashbox/sashbox.module.d.ts +2 -0
- package/splitter/public_api.d.ts +1 -1
- package/splitter/splitter.component.d.ts +22 -26
- package/splitter/splitter.module.d.ts +2 -0
- package/throbber/spinner-throbber/spinner-throbber.component.d.ts +1 -1
- package/throbber/throbber.component.d.ts +2 -2
- package/throbber/throbber.module.d.ts +2 -0
- package/viewport/native-scrollbar-track-size-provider.service.d.ts +2 -2
- package/viewport/public_api.d.ts +1 -1
- package/viewport/scrollable.directive.d.ts +4 -4
- package/viewport/scrollbar/scrollbar.component.d.ts +16 -22
- package/viewport/viewport.component.d.ts +13 -12
- package/viewport/viewport.module.d.ts +2 -0
- package/esm2022/dimension/bounding-client-rect.signal.mjs +0 -54
- package/esm2022/dimension/dimension.directive.mjs +0 -67
- package/esm2022/dimension/dimension.mjs +0 -11
- package/esm2022/dimension/dimension.module.mjs +0 -34
- package/esm2022/dimension/dimension.signal.mjs +0 -63
- package/esm2022/dimension/public_api.mjs +0 -19
- package/esm2022/dimension/scion-components-dimension.mjs +0 -5
- package/esm2022/public-api.mjs +0 -11
- package/esm2022/sashbox/element-ref.directive.mjs +0 -31
- package/esm2022/sashbox/public_api.mjs +0 -18
- package/esm2022/sashbox/sash-initializer.directive.mjs +0 -35
- package/esm2022/sashbox/sash.directive.mjs +0 -145
- package/esm2022/sashbox/sashbox-accessor.mjs +0 -6
- package/esm2022/sashbox/sashbox.component.mjs +0 -282
- package/esm2022/sashbox/sashbox.module.mjs +0 -55
- package/esm2022/sashbox/scion-components-sashbox.mjs +0 -5
- package/esm2022/scion-components.mjs +0 -5
- package/esm2022/splitter/public_api.mjs +0 -17
- package/esm2022/splitter/scion-components-splitter.mjs +0 -5
- package/esm2022/splitter/splitter.component.mjs +0 -226
- package/esm2022/splitter/splitter.module.mjs +0 -38
- package/esm2022/throbber/ellipsis-throbber/ellipsis-throbber.component.mjs +0 -25
- package/esm2022/throbber/public_api.mjs +0 -17
- package/esm2022/throbber/ripple-throbber/ripple-throbber.component.mjs +0 -25
- package/esm2022/throbber/roller-throbber/roller-throbber.component.mjs +0 -25
- package/esm2022/throbber/scion-components-throbber.mjs +0 -5
- package/esm2022/throbber/spinner-throbber/spinner-throbber.component.mjs +0 -26
- package/esm2022/throbber/throbber.component.mjs +0 -72
- package/esm2022/throbber/throbber.module.mjs +0 -32
- package/esm2022/viewport/native-scrollbar-track-size-provider.service.mjs +0 -91
- package/esm2022/viewport/public_api.mjs +0 -19
- package/esm2022/viewport/scion-components-viewport.mjs +0 -5
- package/esm2022/viewport/scrollable.directive.mjs +0 -92
- package/esm2022/viewport/scrollbar/scrollbar.component.mjs +0 -305
- package/esm2022/viewport/viewport.component.mjs +0 -264
- package/esm2022/viewport/viewport.module.mjs +0 -42
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, NgZone, Injectable, ElementRef, Renderer2,
|
|
2
|
+
import { inject, NgZone, Injectable, input, ElementRef, Renderer2, effect, untracked, Directive, DestroyRef, viewChild, computed, Component, ChangeDetectionStrategy, HostBinding, output, ViewEncapsulation, HostListener, NgModule } from '@angular/core';
|
|
3
3
|
import { DOCUMENT } from '@angular/common';
|
|
4
4
|
import { fromEvent, merge, mergeWith, timer, of } from 'rxjs';
|
|
5
5
|
import { debounceTime, startWith, map, distinctUntilChanged, first, withLatestFrom, takeWhile, takeUntil, switchMap } from 'rxjs/operators';
|
|
@@ -23,9 +23,13 @@ import { ScrollingModule } from '@angular/cdk/scrolling';
|
|
|
23
23
|
* Provides the native scrollbar tracksize.
|
|
24
24
|
*/
|
|
25
25
|
class SciNativeScrollbarTrackSizeProvider {
|
|
26
|
+
_document = inject(DOCUMENT);
|
|
27
|
+
_zone = inject(NgZone);
|
|
28
|
+
/**
|
|
29
|
+
* Provides the track size of the native scrollbar, or `null` if the native scrollbars sit on top of the content.
|
|
30
|
+
*/
|
|
31
|
+
trackSize;
|
|
26
32
|
constructor() {
|
|
27
|
-
this._document = inject(DOCUMENT);
|
|
28
|
-
this._zone = inject(NgZone);
|
|
29
33
|
this.trackSize = this.createNativeScrollbarTrackSizeSignal();
|
|
30
34
|
}
|
|
31
35
|
/**
|
|
@@ -41,14 +45,14 @@ class SciNativeScrollbarTrackSizeProvider {
|
|
|
41
45
|
overflow: 'scroll',
|
|
42
46
|
height: '100px',
|
|
43
47
|
width: '100px',
|
|
44
|
-
border: 0,
|
|
48
|
+
border: '0',
|
|
45
49
|
visibility: 'hidden',
|
|
46
50
|
});
|
|
47
51
|
const viewportClientDiv = this._document.createElement('div');
|
|
48
52
|
setStyle(viewportClientDiv, {
|
|
49
53
|
height: '100%',
|
|
50
54
|
width: '100%',
|
|
51
|
-
border: 0,
|
|
55
|
+
border: '0',
|
|
52
56
|
});
|
|
53
57
|
viewportDiv.appendChild(viewportClientDiv);
|
|
54
58
|
this._document.body.appendChild(viewportDiv);
|
|
@@ -75,10 +79,10 @@ class SciNativeScrollbarTrackSizeProvider {
|
|
|
75
79
|
map(() => this.computeTrackSize()), distinctUntilChanged((t1, t2) => t1?.hScrollbarTrackHeight === t2?.hScrollbarTrackHeight && t1?.vScrollbarTrackWidth === t2?.vScrollbarTrackWidth));
|
|
76
80
|
return toSignal(trackSize$, { initialValue: null });
|
|
77
81
|
}
|
|
78
|
-
static
|
|
79
|
-
static
|
|
82
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciNativeScrollbarTrackSizeProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
83
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciNativeScrollbarTrackSizeProvider, providedIn: 'root' });
|
|
80
84
|
}
|
|
81
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
85
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciNativeScrollbarTrackSizeProvider, decorators: [{
|
|
82
86
|
type: Injectable,
|
|
83
87
|
args: [{ providedIn: 'root' }]
|
|
84
88
|
}], ctorParameters: () => [] });
|
|
@@ -90,8 +94,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImpor
|
|
|
90
94
|
*
|
|
91
95
|
* @ignore
|
|
92
96
|
*/
|
|
93
|
-
function setStyle(element,
|
|
94
|
-
Object.
|
|
97
|
+
function setStyle(element, styles) {
|
|
98
|
+
Object.entries(styles).forEach(([name, value]) => element.style.setProperty(name, value));
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
/*
|
|
@@ -115,15 +119,15 @@ function setStyle(element, style) {
|
|
|
115
119
|
* to hide the pushed out native scrollbars.
|
|
116
120
|
*/
|
|
117
121
|
class SciScrollableDirective {
|
|
122
|
+
/**
|
|
123
|
+
* Controls whether to display native scrollbars.
|
|
124
|
+
* Has no effect if the native scrollbar sits on top of the content, e.g. in OS X.
|
|
125
|
+
*/
|
|
126
|
+
displayNativeScrollbar = input(false, { alias: 'sciScrollableDisplayNativeScrollbar' });
|
|
127
|
+
_host = inject((ElementRef)).nativeElement;
|
|
128
|
+
_renderer = inject(Renderer2);
|
|
129
|
+
_nativeScrollbarTrackSizeProvider = inject(SciNativeScrollbarTrackSizeProvider);
|
|
118
130
|
constructor() {
|
|
119
|
-
this._host = inject((ElementRef)).nativeElement;
|
|
120
|
-
this._renderer = inject(Renderer2);
|
|
121
|
-
this._nativeScrollbarTrackSizeProvider = inject(SciNativeScrollbarTrackSizeProvider);
|
|
122
|
-
/**
|
|
123
|
-
* Controls whether to display native scrollbars.
|
|
124
|
-
* Has no effect if the native scrollbar sits on top of the content, e.g. in OS X.
|
|
125
|
-
*/
|
|
126
|
-
this.displayNativeScrollbar = input(false, { alias: 'sciScrollableDisplayNativeScrollbar' });
|
|
127
131
|
this.controlDisplayOfNativeScrollbar();
|
|
128
132
|
}
|
|
129
133
|
/**
|
|
@@ -172,15 +176,12 @@ class SciScrollableDirective {
|
|
|
172
176
|
setStyle(element, style) {
|
|
173
177
|
Object.keys(style).forEach(key => this._renderer.setStyle(element, key, style[key]));
|
|
174
178
|
}
|
|
175
|
-
static
|
|
176
|
-
static
|
|
179
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciScrollableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
180
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.0", type: SciScrollableDirective, isStandalone: true, selector: "[sciScrollable]", inputs: { displayNativeScrollbar: { classPropertyName: "displayNativeScrollbar", publicName: "sciScrollableDisplayNativeScrollbar", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
177
181
|
}
|
|
178
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
182
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciScrollableDirective, decorators: [{
|
|
179
183
|
type: Directive,
|
|
180
|
-
args: [{
|
|
181
|
-
selector: '[sciScrollable]',
|
|
182
|
-
standalone: true,
|
|
183
|
-
}]
|
|
184
|
+
args: [{ selector: '[sciScrollable]' }]
|
|
184
185
|
}], ctorParameters: () => [] });
|
|
185
186
|
|
|
186
187
|
/*
|
|
@@ -226,7 +227,25 @@ class SciScrollbarComponent {
|
|
|
226
227
|
*
|
|
227
228
|
* @internal
|
|
228
229
|
*/
|
|
229
|
-
static
|
|
230
|
+
static VIEWPORT_RESIZE_DEBOUNCE_TIME = 50;
|
|
231
|
+
/**
|
|
232
|
+
* Specifies the direction of the scrollbar. Defaults to a vertical scrollbar.
|
|
233
|
+
*/
|
|
234
|
+
direction = input('vscroll');
|
|
235
|
+
/**
|
|
236
|
+
* The viewport to provide scrollbars for.
|
|
237
|
+
*/
|
|
238
|
+
viewport = input.required();
|
|
239
|
+
_host = inject(ElementRef).nativeElement;
|
|
240
|
+
_document = inject(DOCUMENT);
|
|
241
|
+
_zone = inject(NgZone);
|
|
242
|
+
_destroyRef = inject(DestroyRef);
|
|
243
|
+
_thumbElement = viewChild.required('thumb_handle');
|
|
244
|
+
_vertical = computed(() => this.direction() === 'vscroll');
|
|
245
|
+
_lastDragPosition = null;
|
|
246
|
+
_overflow = false;
|
|
247
|
+
_thumbSizeFr = 0;
|
|
248
|
+
_thumbPositionFr = 0;
|
|
230
249
|
get vertical() {
|
|
231
250
|
return this._vertical();
|
|
232
251
|
}
|
|
@@ -237,26 +256,6 @@ class SciScrollbarComponent {
|
|
|
237
256
|
return this._lastDragPosition !== null;
|
|
238
257
|
}
|
|
239
258
|
constructor() {
|
|
240
|
-
this._host = inject((ElementRef)).nativeElement;
|
|
241
|
-
this._document = inject(DOCUMENT);
|
|
242
|
-
this._zone = inject(NgZone);
|
|
243
|
-
this._destroyRef = inject(DestroyRef);
|
|
244
|
-
this._lastDragPosition = null;
|
|
245
|
-
this._overflow = false;
|
|
246
|
-
this._thumbSizeFr = 0;
|
|
247
|
-
this._thumbPositionFr = 0;
|
|
248
|
-
this._thumbElement = viewChild.required('thumb_handle');
|
|
249
|
-
this._vertical = computed(() => this.direction() === 'vscroll');
|
|
250
|
-
/**
|
|
251
|
-
* Specifies the direction of the scrollbar.
|
|
252
|
-
*
|
|
253
|
-
* By default, if not specified, renders a vertical scrollbar.
|
|
254
|
-
*/
|
|
255
|
-
this.direction = input('vscroll');
|
|
256
|
-
/**
|
|
257
|
-
* The viewport to provide scrollbars for.
|
|
258
|
-
*/
|
|
259
|
-
this.viewport = input.required();
|
|
260
259
|
this.installScrollPositionRenderer();
|
|
261
260
|
}
|
|
262
261
|
/**
|
|
@@ -280,18 +279,6 @@ class SciScrollbarComponent {
|
|
|
280
279
|
overflow ? this._host.classList.add('overflow') : this._host.classList.remove('overflow');
|
|
281
280
|
}
|
|
282
281
|
}
|
|
283
|
-
/**
|
|
284
|
-
* Clears CSS variables used for rendering the scroll position in the UI.
|
|
285
|
-
*/
|
|
286
|
-
unsetScrollPosition() {
|
|
287
|
-
NgZone.assertNotInAngularZone();
|
|
288
|
-
this._thumbPositionFr = 0;
|
|
289
|
-
this._thumbSizeFr = 0;
|
|
290
|
-
this._overflow = false;
|
|
291
|
-
this.setCssVariable('--ɵsci-scrollbar-thumb-position-fr', 0);
|
|
292
|
-
this.setCssVariable('--ɵsci-scrollbar-thumb-size-fr', 0);
|
|
293
|
-
this._host.classList.remove('overflow');
|
|
294
|
-
}
|
|
295
282
|
onTouchStart(event) {
|
|
296
283
|
event.preventDefault();
|
|
297
284
|
this._lastDragPosition = this.vertical ? event.touches[0].screenY : event.touches[0].screenX;
|
|
@@ -347,10 +334,6 @@ class SciScrollbarComponent {
|
|
|
347
334
|
effect(onCleanup => {
|
|
348
335
|
const viewport = this.viewport();
|
|
349
336
|
untracked(() => {
|
|
350
|
-
if (!viewport) {
|
|
351
|
-
this.unsetScrollPosition();
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
337
|
const subscription = viewportScroll$(viewport)
|
|
355
338
|
.pipe(mergeWith(viewportSize$(viewport, { debounceTime: SciScrollbarComponent.VIEWPORT_RESIZE_DEBOUNCE_TIME })), mergeWith(viewportClientSize$(viewport, { debounceTime: SciScrollbarComponent.VIEWPORT_RESIZE_DEBOUNCE_TIME })), subscribeIn(fn => this._zone.runOutsideAngular(fn)))
|
|
356
339
|
.subscribe(() => this.renderScrollPosition());
|
|
@@ -407,16 +390,16 @@ class SciScrollbarComponent {
|
|
|
407
390
|
});
|
|
408
391
|
}
|
|
409
392
|
setCssVariable(key, value) {
|
|
410
|
-
this._host.style.setProperty(key, value);
|
|
393
|
+
this._host.style.setProperty(key, `${value}`);
|
|
411
394
|
}
|
|
412
395
|
get viewportSize() {
|
|
413
|
-
return this.
|
|
396
|
+
return this.vertical ? this.viewport().clientHeight : this.viewport().clientWidth;
|
|
414
397
|
}
|
|
415
398
|
get viewportClientSize() {
|
|
416
|
-
return this.
|
|
399
|
+
return this.vertical ? this.viewport().scrollHeight : this.viewport().scrollWidth;
|
|
417
400
|
}
|
|
418
401
|
get scrollPosition() {
|
|
419
|
-
return this.
|
|
402
|
+
return this.vertical ? this.viewport().scrollTop : this.viewport().scrollLeft;
|
|
420
403
|
}
|
|
421
404
|
get thumbSize() {
|
|
422
405
|
const thumbElement = this._thumbElement().nativeElement;
|
|
@@ -425,12 +408,12 @@ class SciScrollbarComponent {
|
|
|
425
408
|
get trackSize() {
|
|
426
409
|
return this.vertical ? this._host.clientHeight : this._host.clientWidth;
|
|
427
410
|
}
|
|
428
|
-
static
|
|
429
|
-
static
|
|
411
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciScrollbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
412
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.0.0", type: SciScrollbarComponent, isStandalone: true, selector: "sci-scrollbar", inputs: { direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, viewport: { classPropertyName: "viewport", publicName: "viewport", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class.vertical": "this.vertical", "class.horizontal": "this.horizontal", "class.scrolling": "this.scrolling" } }, viewQueries: [{ propertyName: "_thumbElement", first: true, predicate: ["thumb_handle"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- scrolltrack to move the viewport client upwards (paging) -->\n<div class=\"scrolltrack-start\" (mousedown)=\"onScrollTrackMouseDown($event, 'up')\"></div>\n\n<!-- scrollthumb -->\n<div #thumb_handle\n class=\"thumb-handle\"\n [class.vertical]=\"vertical\"\n [class.horizontal]=\"horizontal\"\n (mousedown)=\"onMouseDown($event)\"\n (touchstart)=\"onTouchStart($event)\"\n (touchmove)=\"onTouchMove($event)\"\n (touchend)=\"onTouchEnd($event)\"\n (touchcancel)=\"onTouchEnd($event)\">\n <div class=\"thumb\"\n [class.vertical]=\"vertical\"\n [class.horizontal]=\"horizontal\">\n </div>\n</div>\n\n<!-- scrolltrack to move the viewport client downwards (paging) -->\n<div class=\"scrolltrack-end\" (mousedown)=\"onScrollTrackMouseDown($event, 'down')\"></div>\n", styles: ["@charset \"UTF-8\";:host{display:flex;border:2px solid transparent;box-sizing:border-box;--\\275sci-scrollbar-thumb-position-fr: 0;--\\275sci-scrollbar-thumb-size-fr: 0}:host.vertical{flex-direction:column}:host.horizontal{flex-direction:row}:host>div.scrolltrack-start{flex-grow:var(--\\275sci-scrollbar-thumb-position-fr)}:host>div.thumb-handle{flex-basis:20px;display:flex;flex-grow:var(--\\275sci-scrollbar-thumb-size-fr);align-items:center}:host>div.thumb-handle.vertical{flex-direction:column}:host>div.thumb-handle.horizontal{flex-direction:row}:host>div.thumb-handle>div.thumb{flex:auto;border-radius:4px;background-color:var(--sci-scrollbar-color);opacity:.4;transition-duration:125ms;transition-property:width,height;transition-timing-function:ease-out}:host>div.thumb-handle>div.thumb.vertical{width:60%}:host>div.thumb-handle>div.thumb.horizontal{height:60%}:host>div.scrolltrack-end{flex-grow:calc(1 - (var(--\\275sci-scrollbar-thumb-position-fr) + var(--\\275sci-scrollbar-thumb-size-fr)))}:host-context:not(.overflow){display:none}:host-context:hover>div.thumb-handle>div.thumb,:host-context(.scrolling)>div.thumb-handle>div.thumb{background-color:var(--sci-scrollbar-color);opacity:.75}:host-context:hover>div.thumb-handle>div.thumb.vertical,:host-context(.scrolling)>div.thumb-handle>div.thumb.vertical{width:100%}:host-context:hover>div.thumb-handle>div.thumb.horizontal,:host-context(.scrolling)>div.thumb-handle>div.thumb.horizontal{height:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
430
413
|
}
|
|
431
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
414
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciScrollbarComponent, decorators: [{
|
|
432
415
|
type: Component,
|
|
433
|
-
args: [{ selector: 'sci-scrollbar', changeDetection: ChangeDetectionStrategy.OnPush,
|
|
416
|
+
args: [{ selector: 'sci-scrollbar', changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- scrolltrack to move the viewport client upwards (paging) -->\n<div class=\"scrolltrack-start\" (mousedown)=\"onScrollTrackMouseDown($event, 'up')\"></div>\n\n<!-- scrollthumb -->\n<div #thumb_handle\n class=\"thumb-handle\"\n [class.vertical]=\"vertical\"\n [class.horizontal]=\"horizontal\"\n (mousedown)=\"onMouseDown($event)\"\n (touchstart)=\"onTouchStart($event)\"\n (touchmove)=\"onTouchMove($event)\"\n (touchend)=\"onTouchEnd($event)\"\n (touchcancel)=\"onTouchEnd($event)\">\n <div class=\"thumb\"\n [class.vertical]=\"vertical\"\n [class.horizontal]=\"horizontal\">\n </div>\n</div>\n\n<!-- scrolltrack to move the viewport client downwards (paging) -->\n<div class=\"scrolltrack-end\" (mousedown)=\"onScrollTrackMouseDown($event, 'down')\"></div>\n", styles: ["@charset \"UTF-8\";:host{display:flex;border:2px solid transparent;box-sizing:border-box;--\\275sci-scrollbar-thumb-position-fr: 0;--\\275sci-scrollbar-thumb-size-fr: 0}:host.vertical{flex-direction:column}:host.horizontal{flex-direction:row}:host>div.scrolltrack-start{flex-grow:var(--\\275sci-scrollbar-thumb-position-fr)}:host>div.thumb-handle{flex-basis:20px;display:flex;flex-grow:var(--\\275sci-scrollbar-thumb-size-fr);align-items:center}:host>div.thumb-handle.vertical{flex-direction:column}:host>div.thumb-handle.horizontal{flex-direction:row}:host>div.thumb-handle>div.thumb{flex:auto;border-radius:4px;background-color:var(--sci-scrollbar-color);opacity:.4;transition-duration:125ms;transition-property:width,height;transition-timing-function:ease-out}:host>div.thumb-handle>div.thumb.vertical{width:60%}:host>div.thumb-handle>div.thumb.horizontal{height:60%}:host>div.scrolltrack-end{flex-grow:calc(1 - (var(--\\275sci-scrollbar-thumb-position-fr) + var(--\\275sci-scrollbar-thumb-size-fr)))}:host-context:not(.overflow){display:none}:host-context:hover>div.thumb-handle>div.thumb,:host-context(.scrolling)>div.thumb-handle>div.thumb{background-color:var(--sci-scrollbar-color);opacity:.75}:host-context:hover>div.thumb-handle>div.thumb.vertical,:host-context(.scrolling)>div.thumb-handle>div.thumb.vertical{width:100%}:host-context:hover>div.thumb-handle>div.thumb.horizontal,:host-context(.scrolling)>div.thumb-handle>div.thumb.horizontal{height:100%}\n"] }]
|
|
434
417
|
}], ctorParameters: () => [], propDecorators: { vertical: [{
|
|
435
418
|
type: HostBinding,
|
|
436
419
|
args: ['class.vertical']
|
|
@@ -557,29 +540,24 @@ function children$(element) {
|
|
|
557
540
|
* ```
|
|
558
541
|
*/
|
|
559
542
|
class SciViewportComponent {
|
|
543
|
+
/**
|
|
544
|
+
* Controls if to use the native scrollbar or a scrollbar that sits on top of the viewport. Defaults to `on-top`.
|
|
545
|
+
*/
|
|
546
|
+
scrollbarStyle = input('on-top');
|
|
547
|
+
/**
|
|
548
|
+
* Emits when the viewport is scrolled. The event is emitted outside the Angular zone to avoid unnecessary change detection cycles.
|
|
549
|
+
*/
|
|
550
|
+
scroll = output(); // eslint-disable-line @angular-eslint/no-output-native
|
|
551
|
+
_host = inject(ElementRef).nativeElement;
|
|
552
|
+
_viewport = viewChild.required('viewport');
|
|
553
|
+
_viewportClient = viewChild.required('viewport_client');
|
|
554
|
+
nativeScrollbarTrackSizeProvider = inject(SciNativeScrollbarTrackSizeProvider);
|
|
560
555
|
constructor() {
|
|
561
|
-
this.
|
|
562
|
-
this._viewportClient = viewChild.required('viewport_client');
|
|
563
|
-
this._host = inject((ElementRef)).nativeElement;
|
|
564
|
-
this.nativeScrollbarTrackSizeProvider = inject(SciNativeScrollbarTrackSizeProvider);
|
|
565
|
-
/**
|
|
566
|
-
* Controls whether to use native scrollbars or, which is by default, emulated scrollbars that sit on top of the viewport client.
|
|
567
|
-
* In the latter, the viewport client remains natively scrollable.
|
|
568
|
-
*/
|
|
569
|
-
this.scrollbarStyle = input('on-top');
|
|
570
|
-
/**
|
|
571
|
-
* Emits upon a scroll event.
|
|
572
|
-
*
|
|
573
|
-
* You can add [sciDimension] directive to the viewport or viewport client to be notified about layout changes.
|
|
574
|
-
*/
|
|
575
|
-
this.scroll = output();
|
|
556
|
+
this.installScrollEmitter();
|
|
576
557
|
}
|
|
577
558
|
focus() {
|
|
578
559
|
this.viewportElement.focus();
|
|
579
560
|
}
|
|
580
|
-
onScroll(event) {
|
|
581
|
-
this.scroll.emit(event);
|
|
582
|
-
}
|
|
583
561
|
/**
|
|
584
562
|
* Returns the number of pixels that the viewport client is scrolled vertically.
|
|
585
563
|
*
|
|
@@ -721,17 +699,32 @@ class SciViewportComponent {
|
|
|
721
699
|
} while (el !== this._host);
|
|
722
700
|
return offset;
|
|
723
701
|
}
|
|
724
|
-
|
|
725
|
-
|
|
702
|
+
/**
|
|
703
|
+
* Emits when the scroll position changes.
|
|
704
|
+
*/
|
|
705
|
+
installScrollEmitter() {
|
|
706
|
+
const zone = inject(NgZone);
|
|
707
|
+
effect(onCleanup => {
|
|
708
|
+
const viewport = this._viewport();
|
|
709
|
+
untracked(() => {
|
|
710
|
+
const subscription = fromEvent(viewport.nativeElement, 'scroll')
|
|
711
|
+
.pipe(subscribeIn(fn => zone.runOutsideAngular(fn)))
|
|
712
|
+
.subscribe(event => this.scroll.emit(event));
|
|
713
|
+
onCleanup(() => subscription.unsubscribe());
|
|
714
|
+
});
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciViewportComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
718
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.0", type: SciViewportComponent, isStandalone: true, selector: "sci-viewport", inputs: { scrollbarStyle: { classPropertyName: "scrollbarStyle", publicName: "scrollbarStyle", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { scroll: "scroll" }, host: { listeners: { "focus": "focus()" } }, viewQueries: [{ propertyName: "_viewport", first: true, predicate: ["viewport"], descendants: true, isSignal: true }, { propertyName: "_viewportClient", first: true, predicate: ["viewport_client"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- viewport and viewport client -->\n<div #viewport\n class=\"viewport\"\n tabindex=\"-1\"\n sciScrollable [sciScrollableDisplayNativeScrollbar]=\"scrollbarStyle() === 'native'\"\n cdkScrollable>\n <div #viewport_client class=\"viewport-client\" part=\"content\">\n <slot></slot>\n </div>\n</div>\n\n<!-- render emulated scrollbars which sit on-top -->\n@if (scrollbarStyle() === 'on-top' && nativeScrollbarTrackSizeProvider.trackSize() !== null) {\n <sci-scrollbar [direction]=\"'vscroll'\" [viewport]=\"viewport\" class=\"e2e-vertical\"/>\n <sci-scrollbar [direction]=\"'hscroll'\" [viewport]=\"viewport\" class=\"e2e-horizontal\"/>\n}\n", styles: [":host{display:grid;grid-template-columns:100%;grid-template-rows:100%;position:relative;overflow:hidden;outline:none}:host:host-context(:not(:hover):not(:active)) sci-scrollbar:not(.scrolling){opacity:0}:host>div.viewport{display:grid;position:relative;outline:none;-webkit-overflow-scrolling:touch}:host>div.viewport>div.viewport-client{display:grid}:host>sci-scrollbar{--sci-scrollbar-color: var(--sci-viewport-scrollbar-color);position:absolute;transition-duration:1s;transition-property:opacity;transition-timing-function:ease-out}:host>sci-scrollbar.vertical{top:0;right:0;bottom:0;left:unset;width:12px}:host>sci-scrollbar.horizontal{top:unset;right:0;bottom:0;left:0;height:12px}\n"], dependencies: [{ kind: "ngmodule", type: ScrollingModule }, { kind: "directive", type: i1.CdkScrollable, selector: "[cdk-scrollable], [cdkScrollable]" }, { kind: "directive", type: SciScrollableDirective, selector: "[sciScrollable]", inputs: ["sciScrollableDisplayNativeScrollbar"] }, { kind: "component", type: SciScrollbarComponent, selector: "sci-scrollbar", inputs: ["direction", "viewport"] }], encapsulation: i0.ViewEncapsulation.ShadowDom });
|
|
726
719
|
}
|
|
727
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
720
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciViewportComponent, decorators: [{
|
|
728
721
|
type: Component,
|
|
729
|
-
args: [{ selector: 'sci-viewport', encapsulation: ViewEncapsulation.ShadowDom,
|
|
722
|
+
args: [{ selector: 'sci-viewport', encapsulation: ViewEncapsulation.ShadowDom, imports: [
|
|
730
723
|
ScrollingModule,
|
|
731
724
|
SciScrollableDirective,
|
|
732
725
|
SciScrollbarComponent,
|
|
733
|
-
], template: "<!-- viewport and viewport client -->\n<div #viewport\n class=\"viewport\"\n tabindex=\"-1\"\n sciScrollable [sciScrollableDisplayNativeScrollbar]=\"scrollbarStyle() === 'native'\"\n cdkScrollable
|
|
734
|
-
}], propDecorators: { focus: [{
|
|
726
|
+
], template: "<!-- viewport and viewport client -->\n<div #viewport\n class=\"viewport\"\n tabindex=\"-1\"\n sciScrollable [sciScrollableDisplayNativeScrollbar]=\"scrollbarStyle() === 'native'\"\n cdkScrollable>\n <div #viewport_client class=\"viewport-client\" part=\"content\">\n <slot></slot>\n </div>\n</div>\n\n<!-- render emulated scrollbars which sit on-top -->\n@if (scrollbarStyle() === 'on-top' && nativeScrollbarTrackSizeProvider.trackSize() !== null) {\n <sci-scrollbar [direction]=\"'vscroll'\" [viewport]=\"viewport\" class=\"e2e-vertical\"/>\n <sci-scrollbar [direction]=\"'hscroll'\" [viewport]=\"viewport\" class=\"e2e-horizontal\"/>\n}\n", styles: [":host{display:grid;grid-template-columns:100%;grid-template-rows:100%;position:relative;overflow:hidden;outline:none}:host:host-context(:not(:hover):not(:active)) sci-scrollbar:not(.scrolling){opacity:0}:host>div.viewport{display:grid;position:relative;outline:none;-webkit-overflow-scrolling:touch}:host>div.viewport>div.viewport-client{display:grid}:host>sci-scrollbar{--sci-scrollbar-color: var(--sci-viewport-scrollbar-color);position:absolute;transition-duration:1s;transition-property:opacity;transition-timing-function:ease-out}:host>sci-scrollbar.vertical{top:0;right:0;bottom:0;left:unset;width:12px}:host>sci-scrollbar.horizontal{top:unset;right:0;bottom:0;left:0;height:12px}\n"] }]
|
|
727
|
+
}], ctorParameters: () => [], propDecorators: { focus: [{
|
|
735
728
|
type: HostListener,
|
|
736
729
|
args: ['focus']
|
|
737
730
|
}] } });
|
|
@@ -747,17 +740,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImpor
|
|
|
747
740
|
*/
|
|
748
741
|
/**
|
|
749
742
|
* Provides a viewport component with scrollbars that sit on top of the viewport client.
|
|
743
|
+
*
|
|
744
|
+
* @deprecated since version 19.0.0; Import standalone components and directive instead; API will be removed in a future release.
|
|
750
745
|
*/
|
|
751
746
|
class SciViewportModule {
|
|
752
|
-
static
|
|
753
|
-
static
|
|
747
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciViewportModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
748
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0", ngImport: i0, type: SciViewportModule, imports: [SciViewportComponent,
|
|
754
749
|
SciScrollbarComponent,
|
|
755
750
|
SciScrollableDirective], exports: [SciViewportComponent,
|
|
756
751
|
SciScrollbarComponent,
|
|
757
|
-
SciScrollableDirective] });
|
|
758
|
-
static
|
|
752
|
+
SciScrollableDirective] });
|
|
753
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciViewportModule, imports: [SciViewportComponent] });
|
|
759
754
|
}
|
|
760
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
755
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SciViewportModule, decorators: [{
|
|
761
756
|
type: NgModule,
|
|
762
757
|
args: [{
|
|
763
758
|
imports: [
|