Skip to content

Commit

Permalink
update scroller docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetcetin01140 committed Dec 19, 2024
1 parent d7633d3 commit d3d203d
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 72 deletions.
6 changes: 3 additions & 3 deletions apps/showcase/doc/scroller/basicdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
</app-docsectiontext>
<div class="card flex justify-center">
<p-virtualscroller [items]="items" [itemSize]="50" scrollHeight="200px" styleClass="border border-surface" [style]="{ width: '200px', height: '200px' }">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div class="flex items-center p-2" [ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }" style="height: 50px;">
{{ item }}
</div>
Expand All @@ -39,7 +39,7 @@ export class BasicDoc {
styleClass="border border-surface"
[style]="{ width: '200px', height: '200px' }"
>
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div
class="flex items-center p-2"
[ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }"
Expand All @@ -58,7 +58,7 @@ export class BasicDoc {
styleClass="border border-surface"
[style]="{ width: '200px', height: '200px' }"
>
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div
class="flex items-center p-2"
[ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }"
Expand Down
18 changes: 9 additions & 9 deletions apps/showcase/doc/scroller/delaydoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Component } from '@angular/core';
<div>
<span class="font-bold block mb-2">No Delay</span>
<p-virtualscroller [items]="items" [itemSize]="50" styleClass="border border-surface" [style]="{ width: '200px', height: '200px' }">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div class="flex items-center p-2" [ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }" style="height: 50px;">
{{ item }}
</div>
Expand All @@ -22,7 +22,7 @@ import { Component } from '@angular/core';
<div>
<span class="font-bold block mb-2">150ms</span>
<p-virtualscroller [items]="items" [itemSize]="50" [delay]="150" styleClass="border border-surface" [style]="{ width: '200px', height: '200px' }">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div class="flex items-center p-2" [ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }" style="height: 50px;">
{{ item }}
</div>
Expand All @@ -32,7 +32,7 @@ import { Component } from '@angular/core';
<div>
<span class="font-bold block mb-2">500ms</span>
<p-virtualscroller [items]="items" [itemSize]="50" [delay]="500" styleClass="border border-surface" [style]="{ width: '200px', height: '200px' }">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div class="flex items-center p-2" [ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }" style="height: 50px;">
{{ item }}
</div>
Expand All @@ -56,7 +56,7 @@ export class DelayDoc {
[itemSize]="50"
styleClass="border border-surface"
[style]="{'width': '200px', 'height': '200px'}">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div
class="flex items-center p-2"
[ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }"
Expand All @@ -72,7 +72,7 @@ export class DelayDoc {
[delay]="150"
styleClass="border border-surface"
[style]="{'width': '200px', 'height': '200px'}">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div
class="flex items-center p-2"
[ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }"
Expand All @@ -88,7 +88,7 @@ export class DelayDoc {
[delay]="500"
styleClass="border border-surface"
[style]="{'width': '200px', 'height': '200px'}">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div
class="flex items-center p-2"
[ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }"
Expand All @@ -106,7 +106,7 @@ export class DelayDoc {
[itemSize]="50"
styleClass="border border-surface"
[style]="{'width': '200px', 'height': '200px'}">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div
class="flex items-center p-2"
[ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }"
Expand All @@ -124,7 +124,7 @@ export class DelayDoc {
[delay]="150"
styleClass="border border-surface"
[style]="{'width': '200px', 'height': '200px'}">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div
class="flex items-center p-2"
[ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }"
Expand All @@ -142,7 +142,7 @@ export class DelayDoc {
[delay]="500"
styleClass="border border-surface"
[style]="{'width': '200px', 'height': '200px'}">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div
class="flex items-center p-2"
[ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }"
Expand Down
6 changes: 3 additions & 3 deletions apps/showcase/doc/scroller/griddoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@
</app-docsectiontext>
<div class="card flex justify-center">
<p-virtualscroller [items]="items" [itemSize]="[50, 100]" orientation="both" styleClass="border border-surface" [style]="{ width: '200px', height: '200px' }">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div class="flex items-center p-2" [ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }" style="height: 50px;">
<div *ngFor="let el of item" style="width: 100px">{{ el }}</div>
</div>
Expand Down Expand Up @@ -38,7 +38,7 @@ export class GridDoc implements OnInit {
orientation="both"
styleClass="border border-surface"
[style]="{'width': '200px', 'height': '200px'}">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div
class="flex items-center p-2"
[ngClass]="{ 'bg-surface-100 dark:bg-surface-700' : options.odd }"
Expand All @@ -57,7 +57,7 @@ export class GridDoc implements OnInit {
orientation="both"
styleClass="border border-surface"
[style]="{'width': '200px', 'height': '200px'}">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div
class="flex items-center p-2"
[ngClass]="{ 'bg-surface-100 dark:bg-surface-700' : options.odd }"
Expand Down
6 changes: 3 additions & 3 deletions apps/showcase/doc/scroller/horizontaldoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
</app-docsectiontext>
<div class="card flex justify-center">
<p-virtualscroller [items]="items" [itemSize]="50" scrollHeight="200px" orientation="horizontal" styleClass="border border-surface" [style]="{ width: '200px', height: '200px' }">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div class="flex items-center p-2" style="writing-mode: vertical-lr; width: 50px;" [ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }">
{{ item }}
</div>
Expand All @@ -36,7 +36,7 @@ export class HorizontalDoc {
orientation="horizontal"
styleClass="border border-surface"
[style]="{'width': '200px', 'height': '200px'}">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div
class="flex items-center p-2"
style="writing-mode: vertical-lr; width: 50px;"
Expand All @@ -55,7 +55,7 @@ export class HorizontalDoc {
orientation="horizontal"
styleClass="border border-surface"
[style]="{'width': '200px', 'height': '200px'}">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div
class="flex items-center p-2"
style="writing-mode: vertical-lr; width: 50px;"
Expand Down
20 changes: 7 additions & 13 deletions apps/showcase/doc/scroller/lazyloaddoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface LazyEvent {
</app-docsectiontext>
<div class="card flex justify-center">
<p-virtualscroller [items]="items" [itemSize]="50" [showLoader]="true" [delay]="250" [loading]="lazyLoading" [lazy]="true" (onLazyLoad)="onLazyLoad($event)" styleClass="border border-surface" [style]="{ width: '200px', height: '200px' }">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div class="flex items-center p-2" [ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }" style="height: 50px;">
{{ item }}
</div>
Expand Down Expand Up @@ -79,12 +79,9 @@ export class LazyLoadDoc {
(onLazyLoad)="onLazyLoad($event)"
styleClass="border border-surface"
[style]="{'width': '200px', 'height': '200px'}">
<ng-template pTemplate="item" let-item let-options="options">
<div
class="flex items-center p-2"
[ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }"
style="height: 50px;">
{{ item }}
<ng-template #item let-item let-options="options">
<div class="flex items-center p-2" [ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }" style="height: 50px;">
{{ item }}
</div>
</ng-template>
</p-virtualscroller>`,
Expand All @@ -100,12 +97,9 @@ export class LazyLoadDoc {
(onLazyLoad)="onLazyLoad($event)"
styleClass="border border-surface"
[style]="{'width': '200px', 'height': '200px'}">
<ng-template pTemplate="item" let-item let-options="options">
<div
class="flex items-center p-2"
[ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }"
style="height: 50px;">
{{ item }}
<ng-template #item let-item let-options="options">
<div class="flex items-center p-2" [ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }" style="height: 50px;">
{{ item }}
</div>
</ng-template>
</p-virtualscroller>
Expand Down
50 changes: 27 additions & 23 deletions apps/showcase/doc/scroller/loaderdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
<div class="card flex flex-wrap justify-center gap-4">
<div>
<p-virtualscroller [items]="items" [itemSize]="50" [showLoader]="true" [delay]="250" styleClass="border border-surface" [style]="{ width: '200px', height: '200px' }">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div class="flex items-center p-2" [ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }" style="height: 50px;">
{{ item }}
</div>
Expand All @@ -20,7 +20,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
</div>
<div>
<p-virtualscroller [items]="items" [itemSize]="50" [showLoader]="true" [delay]="250" styleClass="border border-surface" [style]="{ width: '200px', height: '200px' }">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div class="flex items-center p-2" [ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }" style="height: 50px;">
{{ item }}
</div>
Expand Down Expand Up @@ -52,33 +52,37 @@ export class LoaderDoc {
[delay]="250"
styleClass="border border-surface"
[style]="{'width': '200px', 'height': '200px'}">
<ng-template pTemplate="item" let-item let-options="options">
<div
class="flex items-center p-2"
[ngClass]="{ 'bg-surface-100 dark:bg-surface-700' : options.odd }"
style="height: 50px;">
{{ item }}
<ng-template #item let-item let-options="options">
<div class="flex items-center p-2" [ngClass]="{ 'bg-surface-100 dark:bg-surface-700' : options.odd }" style="height: 50px;">
{{ item }}
</div>
</ng-template>
</p-virtualscroller>`,

html: `<div class="card flex justify-center">
<p-virtualscroller
[items]="items"
[itemSize]="50"
[showLoader]="true"
[delay]="250"
styleClass="border border-surface"
[style]="{'width': '200px', 'height': '200px'}">
<ng-template pTemplate="item" let-item let-options="options">
<div
class="flex items-center p-2"
[ngClass]="{ 'bg-surface-100 dark:bg-surface-700' : options.odd }"
style="height: 50px;">
{{ item }}
html: `<div class="card flex flex-wrap justify-center gap-4">
<div>
<p-virtualscroller [items]="items" [itemSize]="50" [showLoader]="true" [delay]="250" styleClass="border border-surface" [style]="{ width: '200px', height: '200px' }">
<ng-template #item let-item let-options="options">
<div class="flex items-center p-2" [ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }" style="height: 50px;">
{{ item }}
</div>
</ng-template>
</p-virtualscroller>
</div>
<div>
<p-virtualscroller [items]="items" [itemSize]="50" [showLoader]="true" [delay]="250" styleClass="border border-surface" [style]="{ width: '200px', height: '200px' }">
<ng-template #item let-item let-options="options">
<div class="flex items-center p-2" [ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }" style="height: 50px;">
{{ item }}
</div>
</ng-template>
<ng-template pTemplate="loader" let-options="options">
<div class="flex items-center p-2" [ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }" style="height: 50px;">
<p-skeleton [width]="options.even ? '60%' : '50%'" height="1.3rem"></p-skeleton>
</div>
</ng-template>
</p-virtualscroller>
</p-virtualscroller>
</div>
</div>`,

typescript: `import { Component, OnInit } from '@angular/core';
Expand Down
18 changes: 6 additions & 12 deletions apps/showcase/doc/scroller/programmaticdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Scroller } from 'primeng/scroller';
<div class="card flex flex-col items-center gap-4">
<p-button label="Reset" (click)="reset()" />
<p-virtualscroller #sc [items]="items" [itemSize]="50" scrollHeight="200px" styleClass="border border-surface" [style]="{ width: '200px', height: '200px' }">
<ng-template pTemplate="item" let-item let-options="options">
<ng-template #item let-item let-options="options">
<div class="flex items-center p-2" [ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }" style="height: 50px;">
{{ item }}
</div>
Expand Down Expand Up @@ -44,12 +44,9 @@ export class ProgrammaticDoc implements OnInit {
scrollHeight="200px"
styleClass="border border-surface"
[style]="{'width': '200px', 'height': '200px'}">
<ng-template pTemplate="item" let-item let-options="options">
<div
class="flex items-center p-2"
[ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }"
style="height: 50px;">
{{ item }}
<ng-template #item let-item let-options="options">
<div class="flex items-center p-2" [ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }" style="height: 50px;">
{{ item }}
</div>
</ng-template>
</p-virtualscroller>`,
Expand All @@ -63,11 +60,8 @@ export class ProgrammaticDoc implements OnInit {
scrollHeight="200px"
styleClass="border border-surface"
[style]="{'width': '200px', 'height': '200px'}">
<ng-template pTemplate="item" let-item let-options="options">
<div
class="flex items-center p-2"
[ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }"
style="height: 50px;">
<ng-template #item let-item let-options="options">
<div class="flex items-center p-2" [ngClass]="{ 'bg-surface-100 dark:bg-surface-700': options.odd }" style="height: 50px;">
{{ item }}
</div>
</ng-template>
Expand Down
Loading

0 comments on commit d3d203d

Please sign in to comment.