ng-virtual-list 21.10.10 → 21.11.1

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
@@ -16,9 +16,12 @@ Works correctly in all browsers and platforms.
16
16
  ![npm downloads](https://img.shields.io/npm/dm/ng-virtual-list)
17
17
  ![npm total downloads](https://img.shields.io/npm/dt/ng-virtual-list)
18
18
 
19
- [Live Demo](https://chat-demo.eugene-grebennikov.pro/)
19
+ [Chat Demo](https://chat-demo.eugene-grebennikov.pro/)
20
20
  [(Code)](https://github.com/DjonnyX/ng-virtual-list-chat-demo)
21
21
 
22
+ [News Feed Demo](https://news-feed-demo.eugene-grebennikov.pro/)
23
+ [(Code)](https://github.com/DjonnyX/ng-virtual-list-news-feed-demo)
24
+
22
25
  [Live Examples (Storybook)](https://ng-virtual-list-examples.eugene-grebennikov.pro/)
23
26
 
24
27
  [Examples](https://ng-virtual-list.eugene-grebennikov.pro/)
@@ -511,96 +514,32 @@ export class AppComponent {
511
514
 
512
515
  ## 🖼️ Stylization
513
516
 
514
- - Scrollbar theme
515
- ```ts
516
- import { NgVirtualListComponent, GradientColor, RoundedCorner, ScrollBarTheme } from 'ng-virtual-list';
517
-
518
- const X_LITE_BLUE_PLASMA_GRADIENT: GradientColor = ["rgba(133, 142, 255, 0)", "rgb(0, 133, 160)"],
519
- ROUND_CORNER: RoundedCorner = [3, 3, 3, 3],
520
- SCROLLBAR_GRADIENT: ScrollBarTheme = {
521
- fill: "rgba(51, 0, 97, 1)",
522
- hoverFill: "rgba(73, 6, 133, 1)",
523
- pressedFill: "rgba(73, 6, 150, 1)",
524
- strokeGradientColor: X_LITE_BLUE_PLASMA_GRADIENT,
525
- strokeAnimationDuration: 1000,
526
- thickness: 6,
527
- roundCorner: ROUND_CORNER,
528
- rippleColor: 'rgba(255,255,255,0.5)',
529
- rippleEnabled: true,
530
- };
531
-
532
- @Component({
533
- selector: 'app-root',
534
- imports: [FormsModule, NgVirtualListComponent],
535
- templateUrl: './app.component.html',
536
- styleUrl: './app.component.scss'
537
- })
538
- export class AppComponent {
539
- scrollbarTheme = SCROLLBAR_GRADIENT;
540
-
541
- items = Array.from({ length: 100000 }, (_, i) => ({ id: i, name: `Item #${i}` }));
542
- }
543
-
544
- ```
517
+ ### Scrollbar stylization
545
518
 
546
519
  ```scss
547
-
548
- .list {
549
- &::part(scrollbar-track) {
550
- margin-right: 2px;
551
- overflow: initial;
552
- }
553
-
554
- &::part(scrollbar-thumb) {
555
- border: 1px solid #8738c3;
556
- border-radius: 4px;
557
- }
520
+ .list::part(scrollbar-thumb__shape) {
521
+ background-color: rgba(51, 0, 97, 1);
522
+ border-radius: 3px;
558
523
  }
559
524
  ```
560
525
 
561
526
  ```html
562
- <ng-virtual-list class="list" [scrollbarTheme]="scrollbarTheme" [items]="items" [itemRenderer]="itemRenderer"></ng-virtual-list>
527
+ <ng-virtual-list class="list" [scrollbarThickness]="12" [items]="items" [itemRenderer]="itemRenderer"></ng-virtual-list>
563
528
 
564
- <ng-template #horizontalItemRenderer let-data="data" let-config="config">
565
- @if (data) {
566
- <div [ngClass]="{'list__h-container': true, 'selected': config.selected}">
567
- <span>{{data.name}}</span>
568
- </div>
569
- }
529
+ <ng-template #itemRenderer let-data="data" let-config="config">
530
+ <span>{{data.name}}</span>
570
531
  </ng-template>
571
532
  ```
572
533
 
534
+ ### Scrollbar castomization
535
+
536
+ [Examples](https://github.com/DjonnyX/ng-virtual-list/blob/21.x/src/app/app.component.html)
537
+ [CustomScrollbarComponent](https://github.com/DjonnyX/ng-virtual-list/blob/21.x/src/app/components/custom-scrollbar/custom-scrollbar.component.ts)
538
+
573
539
  List items are encapsulated in shadowDOM, so to override default styles you need to use ::part access
574
540
 
575
541
  - Customize a scroll area of list
576
542
  ```css
577
- .list::part(scroller) {
578
- scroll-behavior: auto;
579
-
580
- /* custom scrollbar */
581
- &::-webkit-scrollbar {
582
- width: 16px;
583
- height: 16px;
584
- }
585
-
586
- &::-webkit-scrollbar-track {
587
- background-color: #ffffff;
588
- }
589
-
590
- &::-webkit-scrollbar-thumb {
591
- background-color: #d6dee1;
592
- border-radius: 20px;
593
- border: 6px solid transparent;
594
- background-clip: content-box;
595
- min-width: 60px;
596
- min-height: 60px;
597
- }
598
-
599
- &::-webkit-scrollbar-thumb:hover {
600
- background-color: #a8bbbf;
601
- }
602
- }
603
-
604
543
  .list {
605
544
  border-radius: 3px;
606
545
  box-shadow: 1px 2px 8px 4px rgba(0, 0, 0, 0.075);
@@ -684,7 +623,6 @@ Inputs
684
623
  | snap | boolean? = false | Determines whether elements will snap. Default value is "false". |
685
624
  | selectedIds | Array<[Id](https://github.com/DjonnyX/ng-virtual-list/blob/21.x/projects/ng-virtual-list/src/lib/types/id.ts)> \| [Id](https://github.com/DjonnyX/ng-virtual-list/blob/21.x/projects/ng-virtual-list/src/lib/types/id.ts) \| null | Sets the selected items. |
686
625
  | screenReaderMessage | string? = "Showing items $1 to $2" | Message for screen reader. The message format is: "some text `$1` some text `$2`", where `$1` is the number of the first element of the screen collection, `$2` is the number of the last element of the screen collection. |
687
- | scrollbarTheme | [ScrollBarTheme?](https://github.com/DjonnyX/ng-virtual-list/blob/21.x/projects/ng-virtual-list/src/lib/types/scrollbar-theme.ts) | Scrollbar theme. |
688
626
  | clickDistance | number? = 40 | The maximum scroll distance at which a click event is triggered. |
689
627
  | waitForPreparation | boolean? = true | If true, it will wait until the list items are fully prepared before displaying them.. The default value is `true`. |
690
628
  | scrollStartOffset | number? = 0 | Sets the scroll start offset value; Default value is "0". |
@@ -693,9 +631,12 @@ Inputs
693
631
  | snapScrollToStart | boolean? = true | Determines whether the scroll will be anchored to the start of the list. Default value is "true". This property takes precedence over the snapScrollToEnd property. That is, if snapScrollToStart and snapScrollToEnd are enabled, the list will initially snap to the beginning; if you move the scroll bar to the end, the list will snap to the end. If snapScrollToStart is disabled and snapScrollToEnd is enabled, the list will snap to the end; if you move the scroll bar to the beginning, the list will snap to the beginning. If both snapScrollToStart and snapScrollToEnd are disabled, the list will never snap to the beginning or end. |
694
632
  | snapScrollToEnd | boolean? = true | Determines whether the scroll will be anchored to the утв of the list. Default value is "true". That is, if snapScrollToStart and snapScrollToEnd are enabled, the list will initially snap to the beginning; if you move the scroll bar to the end, the list will snap to the end. If snapScrollToStart is disabled and snapScrollToEnd is enabled, the list will snap to the end; if you move the scroll bar to the beginning, the list will snap to the beginning. If both snapScrollToStart and snapScrollToEnd are disabled, the list will never snap to the beginning or end. |
695
633
  | snapToEndTransitionInstantOffset | number? = 0 | Sets the offset value; if the scroll area value is exceeded, the scroll animation will be disabled. Default value is "0". |
696
- | scrollbarMinSize | number? = 80 | Minimum scrollbar size. |
697
634
  | scrollbarEnabled | boolean? = true | Determines whether the scrollbar is shown or not. The default value is "true". |
698
635
  | scrollbarInteractive | boolean? = true | Determines whether scrolling using the scrollbar will be possible. The default value is "true". |
636
+ | scrollbarMinSize | number? = 80 | Minimum scrollbar size. |
637
+ | scrollbarThickness | number? = 6 | Scrollbar thickness. |
638
+ | scrollbarThumbRenderer | TemplateRef<any> \| null = null | Scrollbar customization template. |
639
+ | scrollbarThumbParams | {[propName: string]: any;} \| null | Additional options for the scrollbar. |
699
640
  | scrollBehavior | ScrollBehavior? = 'smooth' | Defines the scrolling behavior for any element on the page. The default value is "smooth". |
700
641
  | trackBy | string? = 'id' | The name of the property by which tracking is performed. |
701
642
 
@@ -732,7 +673,7 @@ Methods
732
673
  ### Template API
733
674
 
734
675
  ```html
735
- <ng-template #itemRenderer let-data="data" let-config="config" let-measures="measures">
676
+ <ng-template #itemRenderer let-data="data" let-config="config" let-measures="measures" let-api="api">
736
677
  <!-- content -->
737
678
  </ng-template>
738
679
  ```
@@ -741,6 +682,7 @@ Properties
741
682
 
742
683
  | Property | Type | Description |
743
684
  |--|--|--|
685
+ | api | [NgVirtualListPublicService](https://github.com/DjonnyX/ng-virtual-list/blob/21.x/projects/ng-virtual-list/src/lib/ng-virtual-list-public.service.ts) | List API Provider. |
744
686
  | data | {\[id: [Id](https://github.com/DjonnyX/ng-virtual-list/blob/21.x/projects/ng-virtual-list/src/lib/types/id.ts) \], [otherProps: string]: any;} | Collection item data. |
745
687
  | config | [IDisplayObjectConfig](https://github.com/DjonnyX/ng-virtual-list/blob/21.x/projects/ng-virtual-list/src/lib/models/display-object-config.model.ts) | Display object configuration. A set of `select`, `collapse`, and `focus` methods are also provided. |
746
688
  | measures | [IDisplayObjectMeasures](https://github.com/DjonnyX/ng-virtual-list/blob/21.x/projects/ng-virtual-list/src/lib/models/display-object-measures.model.ts) \| null | Display object metrics. |
@@ -751,13 +693,13 @@ Properties
751
693
 
752
694
  | Angular version | ng-virtual-list version | git | npm |
753
695
  |--|--|--|--|
754
- | 20.x | 20.10.19 | [20.x](https://github.com/DjonnyX/ng-virtual-list/tree/21.x) | [20.10.19](https://www.npmjs.com/package/ng-virtual-list/v/20.10.19) |
755
- | 19.x | 19.10.7 | [19.x](https://github.com/DjonnyX/ng-virtual-list/tree/19.x) | [19.10.7](https://www.npmjs.com/package/ng-virtual-list/v/19.10.7) |
756
- | 18.x | 18.10.7 | [18.x](https://github.com/DjonnyX/ng-virtual-list/tree/18.x) | [18.10.7](https://www.npmjs.com/package/ng-virtual-list/v/18.10.7) |
757
- | 17.x | 17.10.7 | [17.x](https://github.com/DjonnyX/ng-virtual-list/tree/17.x) | [17.10.7](https://www.npmjs.com/package/ng-virtual-list/v/17.10.7) |
758
- | 16.x | 16.10.8 | [16.x](https://github.com/DjonnyX/ng-virtual-list/tree/16.x) | [16.10.8](https://www.npmjs.com/package/ng-virtual-list/v/16.10.8) |
759
- | 15.x | 15.10.9 | [15.x](https://github.com/DjonnyX/ng-virtual-list/tree/15.x) | [15.10.9](https://www.npmjs.com/package/ng-virtual-list/v/15.10.9) |
760
- | 14.x | 14.10.9 | [14.x](https://github.com/DjonnyX/ng-virtual-list/tree/14.x) | [14.10.9](https://www.npmjs.com/package/ng-virtual-list/v/14.10.9) |
696
+ | 20.x | 20.11.7 | [20.x](https://github.com/DjonnyX/ng-virtual-list/tree/21.x) | [20.11.7](https://www.npmjs.com/package/ng-virtual-list/v/20.11.7) |
697
+ | 19.x | 19.11.2 | [19.x](https://github.com/DjonnyX/ng-virtual-list/tree/19.x) | [19.11.2](https://www.npmjs.com/package/ng-virtual-list/v/19.11.2) |
698
+ | 18.x | 18.11.1 | [18.x](https://github.com/DjonnyX/ng-virtual-list/tree/18.x) | [18.11.1](https://www.npmjs.com/package/ng-virtual-list/v/18.11.1) |
699
+ | 17.x | 17.11.1 | [17.x](https://github.com/DjonnyX/ng-virtual-list/tree/17.x) | [17.11.1](https://www.npmjs.com/package/ng-virtual-list/v/17.11.1) |
700
+ | 16.x | 16.11.1 | [16.x](https://github.com/DjonnyX/ng-virtual-list/tree/16.x) | [16.11.1](https://www.npmjs.com/package/ng-virtual-list/v/16.11.1) |
701
+ | 15.x | 15.11.2 | [15.x](https://github.com/DjonnyX/ng-virtual-list/tree/15.x) | [15.11.2](https://www.npmjs.com/package/ng-virtual-list/v/15.11.2) |
702
+ | 14.x | 14.11.2 | [14.x](https://github.com/DjonnyX/ng-virtual-list/tree/14.x) | [14.11.2](https://www.npmjs.com/package/ng-virtual-list/v/14.11.2) |
761
703
  <br/>
762
704
 
763
705
  ## 🤝 Contributing