@progress/kendo-angular-scrollview
Version:
A ScrollView Component for Angular
68 lines (67 loc) • 3.43 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Component, Input, Output } from '@angular/core';
import { EventEmitter } from '@angular/core';
import { LocalizationService } from '@progress/kendo-angular-l10n';
import { NgFor, NgClass } from '@angular/common';
import { replaceMessagePlaceholder } from '@progress/kendo-angular-common';
import * as i0 from "@angular/core";
import * as i1 from "@progress/kendo-angular-l10n";
/**
* @hidden
*/
export class ScrollViewPagerComponent {
localization;
activeIndex;
data;
pagerIndexChange = new EventEmitter();
constructor(localization) {
this.localization = localization;
}
itemClass(idx) {
return {
'k-primary': idx === this.activeIndex
};
}
indexChange(selectedIndex) {
this.pagerIndexChange.emit(selectedIndex);
}
pagerButtonLabel(itemIndex) {
const localizationMsg = this.localization.get('pagerButtonLabel') || '';
return replaceMessagePlaceholder(localizationMsg, 'itemIndex', itemIndex.toString());
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ScrollViewPagerComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ScrollViewPagerComponent, isStandalone: true, selector: "kendo-scrollview-pager", inputs: { activeIndex: "activeIndex", data: "data" }, outputs: { pagerIndexChange: "pagerIndexChange" }, ngImport: i0, template: `
<div class="k-scrollview-nav">
<span [attr.aria-label]="pagerButtonLabel(i + 1)" role="button" class="k-link" *ngFor="let item of data; let i = index"
[ngClass]="itemClass(i)"
(click)="indexChange(i)">
</span>
</div>
`, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ScrollViewPagerComponent, decorators: [{
type: Component,
args: [{
selector: 'kendo-scrollview-pager',
template: `
<div class="k-scrollview-nav">
<span [attr.aria-label]="pagerButtonLabel(i + 1)" role="button" class="k-link" *ngFor="let item of data; let i = index"
[ngClass]="itemClass(i)"
(click)="indexChange(i)">
</span>
</div>
`,
standalone: true,
imports: [NgFor, NgClass]
}]
}], ctorParameters: function () { return [{ type: i1.LocalizationService }]; }, propDecorators: { activeIndex: [{
type: Input
}], data: [{
type: Input
}], pagerIndexChange: [{
type: Output
}] } });