angular-overflow-indicator 21.0.2 → 21.0.4

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/README.md CHANGED
@@ -1,73 +1,73 @@
1
- # angular-overflow-indicator
2
-
3
- This library includes a simple and performant component that displays a given button if the content of the component overflows.
4
-
5
- ## Features
6
-
7
- ### Button that displays/hides accordingly
8
-
9
- ![Overflow indicator example](./example-overflow-indicator.gif)
10
-
11
- ### Observe the scroll state
12
-
13
- ![Overflow indicator example](./example-scroll-state.gif)
14
-
15
-
16
- ## Basic Usage
17
-
18
- **Step 1: Install the package**
19
-
20
- ```console
21
- yarn add angular-overflow-indicator
22
- ```
23
- or
24
- ```console
25
- npm install angular-overflow-indicator
26
- ```
27
-
28
- **Step 2: Install the package**
29
-
30
- ```ts
31
- import { ScrollViewWithIndicatorComponent } from 'angular-overflow-indicator';
32
- ```
33
-
34
- **Step 3: Create a container with a maximum/fixed size**
35
-
36
- ```html
37
- <div [style]="{ height: '300px', width: '500px' }">
38
- // ...
39
- </div>
40
- ```
41
-
42
- **Step 4: Add a template that includes the indicator-button**
43
-
44
- ```html
45
- <div [style]="{ height: '300px', width: '500px' }">
46
- <ng-template #customButton>
47
- <button (click)="view.scrollToBottom()">There is more below <i>👇</i></button>
48
- </ng-template>
49
-
50
- // ...
51
- </div>
52
- ```
53
-
54
- **Step 5: Add the overflow-indicator-component with a list larger than the outer container and pass the template reference of the indicator-button**
55
-
56
- ```html
57
-
58
- <div [style]="{ height: '300px', width: '500px' }">
59
- <ng-template #customButton>
60
- <button (click)="view.scrollToBottom()">There is more below <i>👇</i></button>
61
- </ng-template>
62
-
63
- <ng-scroll-view-with-indicator #view [indicatorButton]="customButton">
64
- <ul>
65
- @for (item of items(); track item) {
66
- <li>List item {{ item }}</li>
67
- }
68
- </ul>
69
- </ng-scroll-view-with-indicator>
70
- </div>
71
- ```
72
-
73
-
1
+ # angular-overflow-indicator
2
+
3
+ This library includes a simple and performant component that displays a given button if the content of the component overflows.
4
+
5
+ ## Features
6
+
7
+ ### Button that displays/hides accordingly
8
+
9
+ ![Overflow indicator example](./example-overflow-indicator.gif)
10
+
11
+ ### Observe the scroll state
12
+
13
+ ![Overflow indicator example](./example-scroll-state.gif)
14
+
15
+
16
+ ## Basic Usage
17
+
18
+ **Step 1: Install the package**
19
+
20
+ ```console
21
+ yarn add angular-overflow-indicator
22
+ ```
23
+ or
24
+ ```console
25
+ npm install angular-overflow-indicator
26
+ ```
27
+
28
+ **Step 2: Install the package**
29
+
30
+ ```ts
31
+ import { ScrollViewWithIndicatorComponent } from 'angular-overflow-indicator';
32
+ ```
33
+
34
+ **Step 3: Create a container with a maximum/fixed size**
35
+
36
+ ```html
37
+ <div [style]="{ height: '300px', width: '500px' }">
38
+ // ...
39
+ </div>
40
+ ```
41
+
42
+ **Step 4: Add a template that includes the indicator-button**
43
+
44
+ ```html
45
+ <div [style]="{ height: '300px', width: '500px' }">
46
+ <ng-template #customButton>
47
+ <button (click)="view.scrollToBottom()">There is more below <i>👇</i></button>
48
+ </ng-template>
49
+
50
+ // ...
51
+ </div>
52
+ ```
53
+
54
+ **Step 5: Add the overflow-indicator-component with a list larger than the outer container and pass the template reference of the indicator-button**
55
+
56
+ ```html
57
+
58
+ <div [style]="{ height: '300px', width: '500px' }">
59
+ <ng-template #customButton>
60
+ <button (click)="view.scrollToBottom()">There is more below <i>👇</i></button>
61
+ </ng-template>
62
+
63
+ <ng-scroll-view-with-indicator #view [indicatorButton]="customButton">
64
+ <ul>
65
+ @for (item of items(); track item) {
66
+ <li>List item {{ item }}</li>
67
+ }
68
+ </ul>
69
+ </ng-scroll-view-with-indicator>
70
+ </div>
71
+ ```
72
+
73
+
@@ -7,28 +7,28 @@ class DefaultIndicatorButtonComponent {
7
7
  constructor() {
8
8
  this.buttonClicked = output();
9
9
  }
10
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: DefaultIndicatorButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
11
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.1", type: DefaultIndicatorButtonComponent, isStandalone: true, selector: "ng-scroll-view-default-indicator-button", outputs: { buttonClicked: "buttonClicked" }, ngImport: i0, template: `
12
- <button class="default-button" (click)="buttonClicked.emit()">
13
- <span>There is more content</span>
14
- </button>
10
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: DefaultIndicatorButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
11
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.6", type: DefaultIndicatorButtonComponent, isStandalone: true, selector: "ng-scroll-view-default-indicator-button", outputs: { buttonClicked: "buttonClicked" }, ngImport: i0, template: `
12
+ <button class="default-button" (click)="buttonClicked.emit()">
13
+ <span>There is more content</span>
14
+ </button>
15
15
  `, isInline: true, styles: ["button{border:none;font-size:.8rem;font-weight:500;padding:.4rem .6rem;background-color:#444;color:#fff;border-radius:1rem;margin-bottom:.4rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
16
16
  }
17
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: DefaultIndicatorButtonComponent, decorators: [{
17
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: DefaultIndicatorButtonComponent, decorators: [{
18
18
  type: Component,
19
- args: [{ selector: 'ng-scroll-view-default-indicator-button', template: `
20
- <button class="default-button" (click)="buttonClicked.emit()">
21
- <span>There is more content</span>
22
- </button>
19
+ args: [{ selector: 'ng-scroll-view-default-indicator-button', template: `
20
+ <button class="default-button" (click)="buttonClicked.emit()">
21
+ <span>There is more content</span>
22
+ </button>
23
23
  `, changeDetection: ChangeDetectionStrategy.OnPush, styles: ["button{border:none;font-size:.8rem;font-weight:500;padding:.4rem .6rem;background-color:#444;color:#fff;border-radius:1rem;margin-bottom:.4rem}\n"] }]
24
24
  }], propDecorators: { buttonClicked: [{ type: i0.Output, args: ["buttonClicked"] }] } });
25
25
 
26
26
  class ScrollViewWithIndicatorComponent {
27
27
  constructor() {
28
28
  this.scrollState = output();
29
- this.indicatorButton = input.required(...(ngDevMode ? [{ debugName: "indicatorButton" }] : []));
30
- this.isOverflowing = signal(false, ...(ngDevMode ? [{ debugName: "isOverflowing" }] : []));
31
- this.isAtBottom = signal(false, ...(ngDevMode ? [{ debugName: "isAtBottom" }] : []));
29
+ this.indicatorButton = input.required(...(ngDevMode ? [{ debugName: "indicatorButton" }] : /* istanbul ignore next */ []));
30
+ this.isOverflowing = signal(false, ...(ngDevMode ? [{ debugName: "isOverflowing" }] : /* istanbul ignore next */ []));
31
+ this.isAtBottom = signal(false, ...(ngDevMode ? [{ debugName: "isAtBottom" }] : /* istanbul ignore next */ []));
32
32
  this.cdr = inject(ChangeDetectorRef);
33
33
  this.resizeObserver = null;
34
34
  }
@@ -67,12 +67,12 @@ class ScrollViewWithIndicatorComponent {
67
67
  this.isAtBottom.set(element.scrollTop + 1 >= maxScroll);
68
68
  this.scrollState.emit(Math.round((100 / maxScroll) * (element.scrollTop + 1)));
69
69
  }
70
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: ScrollViewWithIndicatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
71
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.1", type: ScrollViewWithIndicatorComponent, isStandalone: true, selector: "ng-scroll-view-with-indicator", inputs: { indicatorButton: { classPropertyName: "indicatorButton", publicName: "indicatorButton", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { scrollState: "scrollState" }, viewQueries: [{ propertyName: "contentWrapper", first: true, predicate: ["contentWrapper"], descendants: true }], ngImport: i0, template: "<div class=\"content-wrapper\" #contentWrapper (scroll)=\"onScroll()\">\r\n <ng-content />\r\n</div>\r\n\r\n@if (isOverflowing() && !isAtBottom()) {\r\n <div class=\"scroll-indicator\">\r\n @if (indicatorButton()) {\r\n <ng-container [ngTemplateOutlet]=\"indicatorButton()\" />\r\n } @else {\r\n <ng-scroll-view-default-indicator-button (buttonClicked)=\"scrollToBottom()\" />\r\n }\r\n </div>\r\n}\r\n", styles: [":host{height:100%;max-height:100%;position:relative;min-height:0;display:flex}.content-wrapper{flex:1;max-height:100%;min-height:0;overflow-y:auto;box-sizing:border-box}.scroll-indicator{position:absolute;bottom:0;left:0;right:0;display:flex;justify-content:center}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: DefaultIndicatorButtonComponent, selector: "ng-scroll-view-default-indicator-button", outputs: ["buttonClicked"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
70
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: ScrollViewWithIndicatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
71
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: ScrollViewWithIndicatorComponent, isStandalone: true, selector: "ng-scroll-view-with-indicator", inputs: { indicatorButton: { classPropertyName: "indicatorButton", publicName: "indicatorButton", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { scrollState: "scrollState" }, viewQueries: [{ propertyName: "contentWrapper", first: true, predicate: ["contentWrapper"], descendants: true }], ngImport: i0, template: "<div class=\"content-wrapper\" #contentWrapper (scroll)=\"onScroll()\">\n <ng-content />\n</div>\n\n@if (isOverflowing() && !isAtBottom()) {\n <div class=\"scroll-indicator\">\n @if (indicatorButton()) {\n <ng-container [ngTemplateOutlet]=\"indicatorButton()\" />\n } @else {\n <ng-scroll-view-default-indicator-button (buttonClicked)=\"scrollToBottom()\" />\n }\n </div>\n}\n", styles: [":host{height:100%;max-height:100%;position:relative;min-height:0;display:flex}.content-wrapper{flex:1;max-height:100%;min-height:0;overflow-y:auto;box-sizing:border-box}.scroll-indicator{position:absolute;bottom:0;left:0;right:0;display:flex;justify-content:center}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: DefaultIndicatorButtonComponent, selector: "ng-scroll-view-default-indicator-button", outputs: ["buttonClicked"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
72
72
  }
73
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: ScrollViewWithIndicatorComponent, decorators: [{
73
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: ScrollViewWithIndicatorComponent, decorators: [{
74
74
  type: Component,
75
- args: [{ selector: 'ng-scroll-view-with-indicator', imports: [CommonModule, DefaultIndicatorButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"content-wrapper\" #contentWrapper (scroll)=\"onScroll()\">\r\n <ng-content />\r\n</div>\r\n\r\n@if (isOverflowing() && !isAtBottom()) {\r\n <div class=\"scroll-indicator\">\r\n @if (indicatorButton()) {\r\n <ng-container [ngTemplateOutlet]=\"indicatorButton()\" />\r\n } @else {\r\n <ng-scroll-view-default-indicator-button (buttonClicked)=\"scrollToBottom()\" />\r\n }\r\n </div>\r\n}\r\n", styles: [":host{height:100%;max-height:100%;position:relative;min-height:0;display:flex}.content-wrapper{flex:1;max-height:100%;min-height:0;overflow-y:auto;box-sizing:border-box}.scroll-indicator{position:absolute;bottom:0;left:0;right:0;display:flex;justify-content:center}\n"] }]
75
+ args: [{ selector: 'ng-scroll-view-with-indicator', imports: [CommonModule, DefaultIndicatorButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"content-wrapper\" #contentWrapper (scroll)=\"onScroll()\">\n <ng-content />\n</div>\n\n@if (isOverflowing() && !isAtBottom()) {\n <div class=\"scroll-indicator\">\n @if (indicatorButton()) {\n <ng-container [ngTemplateOutlet]=\"indicatorButton()\" />\n } @else {\n <ng-scroll-view-default-indicator-button (buttonClicked)=\"scrollToBottom()\" />\n }\n </div>\n}\n", styles: [":host{height:100%;max-height:100%;position:relative;min-height:0;display:flex}.content-wrapper{flex:1;max-height:100%;min-height:0;overflow-y:auto;box-sizing:border-box}.scroll-indicator{position:absolute;bottom:0;left:0;right:0;display:flex;justify-content:center}\n"] }]
76
76
  }], propDecorators: { contentWrapper: [{
77
77
  type: ViewChild,
78
78
  args: ['contentWrapper']
@@ -1 +1 @@
1
- {"version":3,"file":"angular-overflow-indicator.mjs","sources":["../../../../libs/angular-overflow-indicator/src/lib/default-indicator-button/default-indicator-button.component.ts","../../../../libs/angular-overflow-indicator/src/lib/scroll-view-with-indicator/scroll-view-with-indicator.component.ts","../../../../libs/angular-overflow-indicator/src/lib/scroll-view-with-indicator/scroll-view-with-indicator.component.html","../../../../libs/angular-overflow-indicator/src/angular-overflow-indicator.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, output } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'ng-scroll-view-default-indicator-button',\r\n template: `\r\n <button class=\"default-button\" (click)=\"buttonClicked.emit()\">\r\n <span>There is more content</span>\r\n </button>\r\n `,\r\n styles: `\r\n button {\r\n border: none;\r\n font-size: 0.8rem;\r\n font-weight: 500;\r\n padding: 0.4rem 0.6rem;\r\n background-color: #444444;\r\n color: #ffffff;\r\n border-radius: 1rem;\r\n margin-bottom: 0.4rem;\r\n }\r\n `,\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class DefaultIndicatorButtonComponent {\r\n buttonClicked = output();\r\n}\r\n","import {\r\n AfterViewInit,\r\n ChangeDetectionStrategy,\r\n ChangeDetectorRef,\r\n Component,\r\n ElementRef,\r\n inject,\r\n input,\r\n OnDestroy,\r\n output,\r\n signal,\r\n TemplateRef,\r\n ViewChild\r\n} from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { DefaultIndicatorButtonComponent } from '../default-indicator-button';\r\n\r\n@Component({\r\n selector: 'ng-scroll-view-with-indicator',\r\n templateUrl: './scroll-view-with-indicator.component.html',\r\n styleUrls: ['./scroll-view-with-indicator.component.css'],\r\n imports: [CommonModule, DefaultIndicatorButtonComponent],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class ScrollViewWithIndicatorComponent implements AfterViewInit, OnDestroy {\r\n @ViewChild('contentWrapper') contentWrapper!: ElementRef<HTMLDivElement>;\r\n scrollState = output<number>();\r\n\r\n readonly indicatorButton = input.required<TemplateRef<unknown>>();\r\n readonly isOverflowing = signal(false);\r\n readonly isAtBottom = signal(false);\r\n\r\n private readonly cdr = inject(ChangeDetectorRef);\r\n private resizeObserver: ResizeObserver | null = null;\r\n\r\n ngAfterViewInit(): void {\r\n this.resizeObserver = new ResizeObserver(() => {\r\n this.updateOverflowState();\r\n this.updateScrollState();\r\n this.cdr.detectChanges();\r\n });\r\n\r\n this.resizeObserver.observe(this.contentWrapper.nativeElement);\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.resizeObserver?.disconnect();\r\n }\r\n\r\n /**\r\n * Manually scrolls the content-container to the bottom\r\n */\r\n scrollToBottom(): void {\r\n this.contentWrapper.nativeElement.scrollTop = this.contentWrapper.nativeElement.scrollHeight;\r\n }\r\n\r\n /**\r\n * If the user scrolled all the way to the end of the container,\r\n * the indicator button can be hidden\r\n */\r\n onScroll(): void {\r\n this.updateScrollState();\r\n }\r\n\r\n private updateOverflowState(): void {\r\n const element = this.contentWrapper.nativeElement;\r\n const maxScroll = element.scrollHeight - element.offsetHeight;\r\n this.isOverflowing.set(element.offsetHeight < element.scrollHeight && element.scrollTop < maxScroll);\r\n }\r\n\r\n private updateScrollState(): void {\r\n const element = this.contentWrapper.nativeElement;\r\n const maxScroll = element.scrollHeight - element.offsetHeight;\r\n this.isAtBottom.set(element.scrollTop + 1 >= maxScroll);\r\n this.scrollState.emit(Math.round((100 / maxScroll) * (element.scrollTop + 1)));\r\n }\r\n}\r\n","<div class=\"content-wrapper\" #contentWrapper (scroll)=\"onScroll()\">\r\n <ng-content />\r\n</div>\r\n\r\n@if (isOverflowing() && !isAtBottom()) {\r\n <div class=\"scroll-indicator\">\r\n @if (indicatorButton()) {\r\n <ng-container [ngTemplateOutlet]=\"indicatorButton()\" />\r\n } @else {\r\n <ng-scroll-view-default-indicator-button (buttonClicked)=\"scrollToBottom()\" />\r\n }\r\n </div>\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAuBa,+BAA+B,CAAA;AArB5C,IAAA,WAAA,GAAA;QAsBE,IAAA,CAAA,aAAa,GAAG,MAAM,EAAE;AACzB,IAAA;8GAFY,+BAA+B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAA/B,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,+BAA+B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,yCAAA,EAAA,OAAA,EAAA,EAAA,aAAA,EAAA,eAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAnBhC,CAAA;;;;AAIT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,mJAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAeU,+BAA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AA,EAAA,SAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,WAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECxB7C,0aAaA,EAAA,MAAA,EAAA,CAAA,6QAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EDQY,YAAY,sMAAE,+BAA+B,EAAA,QAAA,EAAA,yCAAA,EAAA,OAAA,EAAA,CAAA,eAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAG5C,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAP5C,SAAS;+BACE,+BAA+B,EAAA,OAAA,EAGhC,CAAC,YAAY,EAAE,+BAA+B,CAAC,EAAA,eAAA,EACvC,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,0aAAA,EAAA,MAAA,EAAA,CAAA,6QAAA,CAAA,EAAA;;sBAG9C,SAAS;uBAAC,gBAAgB;;;AEzB7B;;AAEG;;;;"}
1
+ {"version":3,"file":"angular-overflow-indicator.mjs","sources":["../../../../libs/angular-overflow-indicator/src/lib/default-indicator-button/default-indicator-button.component.ts","../../../../libs/angular-overflow-indicator/src/lib/scroll-view-with-indicator/scroll-view-with-indicator.component.ts","../../../../libs/angular-overflow-indicator/src/lib/scroll-view-with-indicator/scroll-view-with-indicator.component.html","../../../../libs/angular-overflow-indicator/src/angular-overflow-indicator.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, output } from '@angular/core';\n\n@Component({\n selector: 'ng-scroll-view-default-indicator-button',\n template: `\n <button class=\"default-button\" (click)=\"buttonClicked.emit()\">\n <span>There is more content</span>\n </button>\n `,\n styles: `\n button {\n border: none;\n font-size: 0.8rem;\n font-weight: 500;\n padding: 0.4rem 0.6rem;\n background-color: #444444;\n color: #ffffff;\n border-radius: 1rem;\n margin-bottom: 0.4rem;\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DefaultIndicatorButtonComponent {\n buttonClicked = output();\n}\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n inject,\n input,\n OnDestroy,\n output,\n signal,\n TemplateRef,\n ViewChild\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { DefaultIndicatorButtonComponent } from '../default-indicator-button';\n\n@Component({\n selector: 'ng-scroll-view-with-indicator',\n templateUrl: './scroll-view-with-indicator.component.html',\n styleUrls: ['./scroll-view-with-indicator.component.css'],\n imports: [CommonModule, DefaultIndicatorButtonComponent],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ScrollViewWithIndicatorComponent implements AfterViewInit, OnDestroy {\n @ViewChild('contentWrapper') contentWrapper!: ElementRef<HTMLDivElement>;\n scrollState = output<number>();\n\n readonly indicatorButton = input.required<TemplateRef<unknown>>();\n readonly isOverflowing = signal(false);\n readonly isAtBottom = signal(false);\n\n private readonly cdr = inject(ChangeDetectorRef);\n private resizeObserver: ResizeObserver | null = null;\n\n ngAfterViewInit(): void {\n this.resizeObserver = new ResizeObserver(() => {\n this.updateOverflowState();\n this.updateScrollState();\n this.cdr.detectChanges();\n });\n\n this.resizeObserver.observe(this.contentWrapper.nativeElement);\n }\n\n ngOnDestroy(): void {\n this.resizeObserver?.disconnect();\n }\n\n /**\n * Manually scrolls the content-container to the bottom\n */\n scrollToBottom(): void {\n this.contentWrapper.nativeElement.scrollTop = this.contentWrapper.nativeElement.scrollHeight;\n }\n\n /**\n * If the user scrolled all the way to the end of the container,\n * the indicator button can be hidden\n */\n onScroll(): void {\n this.updateScrollState();\n }\n\n private updateOverflowState(): void {\n const element = this.contentWrapper.nativeElement;\n const maxScroll = element.scrollHeight - element.offsetHeight;\n this.isOverflowing.set(element.offsetHeight < element.scrollHeight && element.scrollTop < maxScroll);\n }\n\n private updateScrollState(): void {\n const element = this.contentWrapper.nativeElement;\n const maxScroll = element.scrollHeight - element.offsetHeight;\n this.isAtBottom.set(element.scrollTop + 1 >= maxScroll);\n this.scrollState.emit(Math.round((100 / maxScroll) * (element.scrollTop + 1)));\n }\n}\n","<div class=\"content-wrapper\" #contentWrapper (scroll)=\"onScroll()\">\n <ng-content />\n</div>\n\n@if (isOverflowing() && !isAtBottom()) {\n <div class=\"scroll-indicator\">\n @if (indicatorButton()) {\n <ng-container [ngTemplateOutlet]=\"indicatorButton()\" />\n } @else {\n <ng-scroll-view-default-indicator-button (buttonClicked)=\"scrollToBottom()\" />\n }\n </div>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAuBa,+BAA+B,CAAA;AArB5C,IAAA,WAAA,GAAA;QAsBE,IAAA,CAAA,aAAa,GAAG,MAAM,EAAE;AACzB,IAAA;8GAFY,+BAA+B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAA/B,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,+BAA+B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,yCAAA,EAAA,OAAA,EAAA,EAAA,aAAA,EAAA,eAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAnBhC;;;;AAIT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,mJAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAeU,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBArB3C,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,yCAAyC,EAAA,QAAA,EACzC;;;;GAIT,EAAA,eAAA,EAagB,uBAAuB,CAAC,M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,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EDQY,YAAY,sMAAE,+BAA+B,EAAA,QAAA,EAAA,yCAAA,EAAA,OAAA,EAAA,CAAA,eAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAG5C,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAP5C,SAAS;+BACE,+BAA+B,EAAA,OAAA,EAGhC,CAAC,YAAY,EAAE,+BAA+B,CAAC,EAAA,eAAA,EACvC,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,gZAAA,EAAA,MAAA,EAAA,CAAA,6QAAA,CAAA,EAAA;;sBAG9C,SAAS;uBAAC,gBAAgB;;;AEzB7B;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angular-overflow-indicator",
3
- "version": "21.0.2",
3
+ "version": "21.0.4",
4
4
  "description": "A simple and performant component that displays a given button if the content of the component overflows",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,5 +33,6 @@
33
33
  "types": "./types/angular-overflow-indicator.d.ts",
34
34
  "default": "./fesm2022/angular-overflow-indicator.mjs"
35
35
  }
36
- }
36
+ },
37
+ "type": "module"
37
38
  }