ng-virtual-list 21.10.9 → 21.11.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/README.md CHANGED
@@ -511,96 +511,32 @@ export class AppComponent {
511
511
 
512
512
  ## 🖼️ Stylization
513
513
 
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
- ```
514
+ ### Scrollbar stylization
545
515
 
546
516
  ```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
- }
517
+ .list::part(scrollbar-thumb__shape) {
518
+ background-color: rgba(51, 0, 97, 1);
519
+ border-radius: 3px;
558
520
  }
559
521
  ```
560
522
 
561
523
  ```html
562
- <ng-virtual-list class="list" [scrollbarTheme]="scrollbarTheme" [items]="items" [itemRenderer]="itemRenderer"></ng-virtual-list>
524
+ <ng-virtual-list class="list" [scrollbarThickness]="12" [items]="items" [itemRenderer]="itemRenderer"></ng-virtual-list>
563
525
 
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
- }
526
+ <ng-template #itemRenderer let-data="data" let-config="config">
527
+ <span>{{data.name}}</span>
570
528
  </ng-template>
571
529
  ```
572
530
 
531
+ ### Scrollbar castomization
532
+
533
+ [Examples](https://github.com/DjonnyX/ng-virtual-list/blob/21.x/src/app/app.component.html)
534
+ [CustomScrollbarComponent](https://github.com/DjonnyX/ng-virtual-list/blob/21.x/src/app/components/custom-scrollbar/custom-scrollbar.component.ts)
535
+
573
536
  List items are encapsulated in shadowDOM, so to override default styles you need to use ::part access
574
537
 
575
538
  - Customize a scroll area of list
576
539
  ```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
540
  .list {
605
541
  border-radius: 3px;
606
542
  box-shadow: 1px 2px 8px 4px rgba(0, 0, 0, 0.075);
@@ -684,7 +620,6 @@ Inputs
684
620
  | snap | boolean? = false | Determines whether elements will snap. Default value is "false". |
685
621
  | 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
622
  | 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
623
  | clickDistance | number? = 40 | The maximum scroll distance at which a click event is triggered. |
689
624
  | waitForPreparation | boolean? = true | If true, it will wait until the list items are fully prepared before displaying them.. The default value is `true`. |
690
625
  | scrollStartOffset | number? = 0 | Sets the scroll start offset value; Default value is "0". |
@@ -693,9 +628,12 @@ Inputs
693
628
  | 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
629
  | 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
630
  | 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
631
  | scrollbarEnabled | boolean? = true | Determines whether the scrollbar is shown or not. The default value is "true". |
698
632
  | scrollbarInteractive | boolean? = true | Determines whether scrolling using the scrollbar will be possible. The default value is "true". |
633
+ | scrollbarMinSize | number? = 80 | Minimum scrollbar size. |
634
+ | scrollbarThickness | number? = 6 | Scrollbar thickness. |
635
+ | scrollbarThumbRenderer | TemplateRef<any> \| null = null | Scrollbar customization template. |
636
+ | scrollbarThumbParams | {[propName: string]: any;} \| null | Additional options for the scrollbar. |
699
637
  | scrollBehavior | ScrollBehavior? = 'smooth' | Defines the scrolling behavior for any element on the page. The default value is "smooth". |
700
638
  | trackBy | string? = 'id' | The name of the property by which tracking is performed. |
701
639
 
@@ -732,7 +670,7 @@ Methods
732
670
  ### Template API
733
671
 
734
672
  ```html
735
- <ng-template #itemRenderer let-data="data" let-config="config" let-measures="measures">
673
+ <ng-template #itemRenderer let-data="data" let-config="config" let-measures="measures" let-api="api">
736
674
  <!-- content -->
737
675
  </ng-template>
738
676
  ```
@@ -741,6 +679,7 @@ Properties
741
679
 
742
680
  | Property | Type | Description |
743
681
  |--|--|--|
682
+ | 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
683
  | 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
684
  | 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
685
  | 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 +690,13 @@ Properties
751
690
 
752
691
  | Angular version | ng-virtual-list version | git | npm |
753
692
  |--|--|--|--|
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) |
693
+ | 20.x | 20.11.3 | [20.x](https://github.com/DjonnyX/ng-virtual-list/tree/21.x) | [20.11.3](https://www.npmjs.com/package/ng-virtual-list/v/20.11.3) |
694
+ | 19.x | 19.11.0 | [19.x](https://github.com/DjonnyX/ng-virtual-list/tree/19.x) | [19.11.0](https://www.npmjs.com/package/ng-virtual-list/v/19.11.0) |
695
+ | 18.x | 18.11.0 | [18.x](https://github.com/DjonnyX/ng-virtual-list/tree/18.x) | [18.11.0](https://www.npmjs.com/package/ng-virtual-list/v/18.11.0) |
696
+ | 17.x | 17.11.0 | [17.x](https://github.com/DjonnyX/ng-virtual-list/tree/17.x) | [17.11.0](https://www.npmjs.com/package/ng-virtual-list/v/17.11.0) |
697
+ | 16.x | 16.11.0 | [16.x](https://github.com/DjonnyX/ng-virtual-list/tree/16.x) | [16.11.0](https://www.npmjs.com/package/ng-virtual-list/v/16.11.0) |
698
+ | 15.x | 15.11.0 | [15.x](https://github.com/DjonnyX/ng-virtual-list/tree/15.x) | [15.11.0](https://www.npmjs.com/package/ng-virtual-list/v/15.11.0) |
699
+ | 14.x | 14.11.0 | [14.x](https://github.com/DjonnyX/ng-virtual-list/tree/14.x) | [14.11.0](https://www.npmjs.com/package/ng-virtual-list/v/14.11.0) |
761
700
  <br/>
762
701
 
763
702
  ## 🤝 Contributing