Skip to content

Commit

Permalink
docs: add JS docs to the inputs/outputs
Browse files Browse the repository at this point in the history
Previously those were in the GH's wiki, but that's a bad DX.
  • Loading branch information
daelmaak committed Sep 29, 2023
1 parent d0385a2 commit ec5018b
Showing 1 changed file with 89 additions and 2 deletions.
91 changes: 89 additions & 2 deletions libs/gallery/src/lib/components/gallery/gallery.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,48 +37,135 @@ import { ViewerComponent } from '../viewer/viewer.component';
imports: [CommonModule, ThumbsComponent, ViewerComponent],
})
export class GalleryComponent {
/**
* Gallery items to display
*/
@Input() items: GalleryItem[];
/**
* Initially selected item, 0-based
*/
@Input() selectedIndex = 0;
/**
* Aria labels
*/
@Input() aria: Aria = defaultAria;
/**
* Show left and right icons to navigate between images in the viewer
*/
@Input() arrows = true;
/**
* Displayes item descriptions if any are present in `GalleryItem`
*/
@Input() descriptions = false;
/**
* Text to be shown when media loading failed
*/
@Input() errorText: string;
/**
* Allow mouse swipes
*/
@Input() mouseGestures = true;
/**
* Allow touch swipes
*/
@Input() touchGestures = true;
/**
* Controls whether items outside gallery's scrollport should overflow it. When clip == false,
* items overflowing the gallery will be visible on both sides. Otherwise they will be hidden
* with `overflow: hidden`.
*/
@Input() clip = true;
/**
* Show item counter in the slider area
*/
@Input() counter = true;
@Input() counterOrientation: VerticalOrientation = 'bottom';
@Input() visibleItems = 1;
@Input() moveByItems?: number;
/**
* Either makes images load eagerly or lazily. The lazy loading is managed by the browser itself.
*/
@Input() loading: Loading = 'lazy';
/**
* Turns on infinite looping for swiping and arrows navigation.
*/
@Input() loop = false;
/**
* The way an image or video should fill its container.
*/
@Input() objectFit: ObjectFit = 'cover';
/**
* Right to left mode
*/
@HostBinding('class.rtl')
@Input()
isRtl: boolean;
/**
* By how many items the slider shifts when user navigates with arrows.
*/
@Input() moveByItems?: number;
/**
* How many items are visible in the scrollport.
*/
@Input() visibleItems = 1;
/**
* Custom template for gallery items.
*/
@Input() itemTemplate: TemplateRef<ItemTemplateContext>;
/**
* Custom item template for media that failed to load
*/
@Input() errorTemplate: TemplateRef<any>;
/**
* Custom template for navigation arrows for the slider.
*/
@Input() arrowTemplate: TemplateRef<any>;
/**
* Custom template whose content appears in the gallery viewer.
*/
@Input() contentTemplate: TemplateRef<ContentTemplateContext>;
/**
* Show thumbnail list.
*/
@Input() thumbs = true;
/**
* Scroll thumbnails automatically as you navigate in image viewer.
*/
@Input() thumbsAutoScroll = true;
/**
* Where thumbnails will be placed in relation to slider.
*/
@Input() thumbsOrientation: Orientation = 'bottom';
/**
* Show arrows to navigate thumbnails.
*/
@Input() thumbsArrows = true;
/**
* By how far in pixels the thumbnails are scrolled when using arrows.
*/
@Input() thumbsArrowSlideByLength: number;
/**
* Smooth or instant navigation in thumbnails.
*/
@Input() thumbsScrollBehavior: ScrollBehavior = 'smooth';
/**
* Custom template for thumbnail items.
*/
@Input() thumbTemplate: TemplateRef<ThumbTemplateContext>;
/**
* Custom template for navigation arrows in thumbnail list.
*/
@Input() thumbsArrowTemplate: TemplateRef<never>;
/**
* Custom template for thumbnails that failed to load.
*/
@Input() thumbErrorTemplate: TemplateRef<never>;

@Output() itemClick = new EventEmitter<GalleryItemEvent>();
@Output() thumbClick = new EventEmitter<GalleryItemEvent>();
@Output() thumbHover = new EventEmitter<GalleryItemEvent>();
@Output() descriptionClick = new EventEmitter<Event>();
/**
* Triggers when item or group of items gets selected, ie. they get displayed in scrollport.
*/
@Output() selection = new EventEmitter<GalleryItem>();

@ViewChild(ViewerComponent) _viewerRef: ViewerComponent;
Expand Down

0 comments on commit ec5018b

Please sign in to comment.