@progress/kendo-angular-scrollview 5.0.2-dev.202211170813 → 11.0.0-develop.100
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/LICENSE.md +1 -1
- package/NOTICE.txt +4 -4
- package/README.md +1 -1
- package/change-event-args.d.ts +1 -1
- package/data.collection.d.ts +1 -1
- package/direction.d.ts +1 -1
- package/enums.d.ts +1 -1
- package/{esm2015/change-event-args.js → esm2020/change-event-args.mjs} +1 -1
- package/{esm2015/data.collection.js → esm2020/data.collection.mjs} +3 -3
- package/{esm2015/direction.js → esm2020/direction.mjs} +1 -1
- package/{esm2015/enums.js → esm2020/enums.mjs} +1 -1
- package/{esm2015/main.js → esm2020/index.mjs} +1 -1
- package/{esm2015/package-metadata.js → esm2020/package-metadata.mjs} +3 -3
- package/{esm2015/kendo-angular-scrollview.js → esm2020/progress-kendo-angular-scrollview.mjs} +2 -2
- package/{esm2015/scrollview-pager.component.js → esm2020/scrollview-pager.component.mjs} +4 -4
- package/{esm2015/scrollview.component.js → esm2020/scrollview.component.mjs} +40 -15
- package/{esm2015/scrollview.module.js → esm2020/scrollview.module.mjs} +8 -7
- package/fesm2015/{kendo-angular-scrollview.js → progress-kendo-angular-scrollview.mjs} +53 -27
- package/fesm2020/progress-kendo-angular-scrollview.mjs +811 -0
- package/{main.d.ts → index.d.ts} +1 -1
- package/package-metadata.d.ts +1 -1
- package/package.json +28 -54
- package/{kendo-angular-scrollview.d.ts → progress-kendo-angular-scrollview.d.ts} +2 -2
- package/schematics/ngAdd/index.js +5 -7
- package/scrollview-pager.component.d.ts +1 -1
- package/scrollview.component.d.ts +10 -1
- package/scrollview.module.d.ts +3 -2
- package/bundles/kendo-angular-scrollview.umd.js +0 -5
- package/schematics/ngAdd/index.js.map +0 -1
|
@@ -0,0 +1,811 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as i0 from '@angular/core';
|
|
6
|
+
import { EventEmitter, Component, Input, Output, TemplateRef, ContentChild, ViewChild, HostBinding, HostListener, NgModule } from '@angular/core';
|
|
7
|
+
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
8
|
+
import * as i4 from '@progress/kendo-angular-common';
|
|
9
|
+
import { Keys, DraggableModule } from '@progress/kendo-angular-common';
|
|
10
|
+
import { validatePackage } from '@progress/kendo-licensing';
|
|
11
|
+
import * as i1 from '@progress/kendo-angular-l10n';
|
|
12
|
+
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
13
|
+
import { chevronLeftIcon, chevronRightIcon } from '@progress/kendo-svg-icons';
|
|
14
|
+
import * as i2 from '@progress/kendo-angular-icons';
|
|
15
|
+
import { IconsModule } from '@progress/kendo-angular-icons';
|
|
16
|
+
import * as i5 from '@angular/common';
|
|
17
|
+
import { CommonModule } from '@angular/common';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
var Dir;
|
|
23
|
+
(function (Dir) {
|
|
24
|
+
Dir[Dir["Next"] = 1] = "Next";
|
|
25
|
+
Dir[Dir["Prev"] = -1] = "Prev";
|
|
26
|
+
})(Dir || (Dir = {}));
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @hidden
|
|
30
|
+
*/
|
|
31
|
+
const packageMetadata = {
|
|
32
|
+
name: '@progress/kendo-angular-scrollview',
|
|
33
|
+
productName: 'Kendo UI for Angular',
|
|
34
|
+
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
35
|
+
publishDate: 1673469184,
|
|
36
|
+
version: '',
|
|
37
|
+
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** @hidden */
|
|
41
|
+
const iterator = getIterator();
|
|
42
|
+
// TODO: Move to kendo-common
|
|
43
|
+
function getIterator() {
|
|
44
|
+
if (typeof Symbol === 'function' && Symbol.iterator) {
|
|
45
|
+
return Symbol.iterator;
|
|
46
|
+
}
|
|
47
|
+
const keys = Object.getOwnPropertyNames(Map.prototype);
|
|
48
|
+
const proto = Map.prototype;
|
|
49
|
+
for (let i = 0; i < keys.length; ++i) {
|
|
50
|
+
const key = keys[i];
|
|
51
|
+
if (key !== 'entries' && key !== 'size' && proto[key] === proto.entries) {
|
|
52
|
+
return key;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const EMPTY_OBJ = {};
|
|
57
|
+
/**
|
|
58
|
+
* @hidden
|
|
59
|
+
*/
|
|
60
|
+
class DataResultIterator {
|
|
61
|
+
constructor(source, index, endless, pageIndex, rtl) {
|
|
62
|
+
this.rtl = false;
|
|
63
|
+
this.source = source ? source : [];
|
|
64
|
+
this.index = index ? index : 0;
|
|
65
|
+
this.endless = endless;
|
|
66
|
+
this.pageIndex = pageIndex;
|
|
67
|
+
this.rtl = rtl;
|
|
68
|
+
}
|
|
69
|
+
get data() {
|
|
70
|
+
const itemCount = this.total;
|
|
71
|
+
let result;
|
|
72
|
+
if (this.endless) {
|
|
73
|
+
result = [
|
|
74
|
+
this.source[(this.index - 1 + itemCount) % itemCount],
|
|
75
|
+
this.source[this.index % itemCount],
|
|
76
|
+
this.source[(this.index + 1 + itemCount) % itemCount]
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
const data = [EMPTY_OBJ, ...this.source, EMPTY_OBJ];
|
|
81
|
+
result = data.slice(this.index, this.index + 3);
|
|
82
|
+
}
|
|
83
|
+
if (this.pageIndex !== null) {
|
|
84
|
+
const isForward = this.pageIndex > this.index;
|
|
85
|
+
result[isForward ? 2 : 0] = this.source[this.pageIndex];
|
|
86
|
+
}
|
|
87
|
+
return this.rtl ? result.reverse() : result;
|
|
88
|
+
}
|
|
89
|
+
get total() {
|
|
90
|
+
return this.source.length;
|
|
91
|
+
}
|
|
92
|
+
canMoveNext() {
|
|
93
|
+
return (this.endless || (this.index < this.total - 1));
|
|
94
|
+
}
|
|
95
|
+
canMovePrev() {
|
|
96
|
+
return (this.endless || this.index > 0);
|
|
97
|
+
}
|
|
98
|
+
[iterator]() {
|
|
99
|
+
return this.data[iterator]();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* @hidden
|
|
104
|
+
*/
|
|
105
|
+
class DataCollection {
|
|
106
|
+
constructor(accessor) {
|
|
107
|
+
this.accessor = accessor;
|
|
108
|
+
}
|
|
109
|
+
get length() { return this.accessor().data.length; }
|
|
110
|
+
get total() { return this.accessor().total; }
|
|
111
|
+
item(index) {
|
|
112
|
+
return this.accessor().data[index];
|
|
113
|
+
}
|
|
114
|
+
canMoveNext() {
|
|
115
|
+
return this.accessor().canMoveNext();
|
|
116
|
+
}
|
|
117
|
+
canMovePrev() {
|
|
118
|
+
return this.accessor().canMovePrev();
|
|
119
|
+
}
|
|
120
|
+
[Symbol.iterator]() {
|
|
121
|
+
return this.accessor()[Symbol.iterator]();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @hidden
|
|
127
|
+
*/
|
|
128
|
+
class ScrollViewPagerComponent {
|
|
129
|
+
constructor() {
|
|
130
|
+
this.pagerIndexChange = new EventEmitter();
|
|
131
|
+
}
|
|
132
|
+
itemClass(idx) {
|
|
133
|
+
return {
|
|
134
|
+
'k-primary': idx === this.activeIndex
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
indexChange(selectedIndex) {
|
|
138
|
+
this.pagerIndexChange.emit(selectedIndex);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
ScrollViewPagerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ScrollViewPagerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
142
|
+
ScrollViewPagerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: ScrollViewPagerComponent, selector: "kendo-scrollview-pager", inputs: { activeIndex: "activeIndex", data: "data" }, outputs: { pagerIndexChange: "pagerIndexChange" }, ngImport: i0, template: `
|
|
143
|
+
<ul class="k-scrollview-pageable k-scrollview-nav">
|
|
144
|
+
<li class="k-button" *ngFor="let item of data; let i = index"
|
|
145
|
+
[ngClass]="itemClass(i)"
|
|
146
|
+
(click)="indexChange(i)">
|
|
147
|
+
</li>
|
|
148
|
+
</ul>
|
|
149
|
+
`, isInline: true, directives: [{ type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
150
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ScrollViewPagerComponent, decorators: [{
|
|
151
|
+
type: Component,
|
|
152
|
+
args: [{
|
|
153
|
+
selector: 'kendo-scrollview-pager',
|
|
154
|
+
template: `
|
|
155
|
+
<ul class="k-scrollview-pageable k-scrollview-nav">
|
|
156
|
+
<li class="k-button" *ngFor="let item of data; let i = index"
|
|
157
|
+
[ngClass]="itemClass(i)"
|
|
158
|
+
(click)="indexChange(i)">
|
|
159
|
+
</li>
|
|
160
|
+
</ul>
|
|
161
|
+
`
|
|
162
|
+
}]
|
|
163
|
+
}], propDecorators: { activeIndex: [{
|
|
164
|
+
type: Input
|
|
165
|
+
}], data: [{
|
|
166
|
+
type: Input
|
|
167
|
+
}], pagerIndexChange: [{
|
|
168
|
+
type: Output
|
|
169
|
+
}] } });
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Represents the [Kendo UI ScrollView component for Angular]({% slug overview_scrollview %}).
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
*
|
|
177
|
+
* _@Component({
|
|
178
|
+
* selector: 'my-app',
|
|
179
|
+
* template: `
|
|
180
|
+
* <kendo-scrollview
|
|
181
|
+
* [data]="items"
|
|
182
|
+
* [width]="width"
|
|
183
|
+
* [height]="height"
|
|
184
|
+
* [endless]="endless"
|
|
185
|
+
* [pageable]="pageable">
|
|
186
|
+
* <ng-template let-item="item">
|
|
187
|
+
* <h2 class="demo-title">{{item.title}}</h2>
|
|
188
|
+
* <img src='{{item.url}}' alt='{{item.title}}' [ngStyle]="{minWidth: width}" draggable="false" />
|
|
189
|
+
* </ng-template>
|
|
190
|
+
* </kendo-scrollview>
|
|
191
|
+
* `,
|
|
192
|
+
* styles: [`
|
|
193
|
+
* .k-scrollview-wrap {
|
|
194
|
+
* margin: 0 auto;
|
|
195
|
+
* }
|
|
196
|
+
* .demo-title {
|
|
197
|
+
* position: absolute;
|
|
198
|
+
* top: 0;
|
|
199
|
+
* left: 0;
|
|
200
|
+
* right: 0;
|
|
201
|
+
* margin: 0;
|
|
202
|
+
* padding: 15px;
|
|
203
|
+
* color: #fff;
|
|
204
|
+
* background-color: rgba(0,0,0,.4);
|
|
205
|
+
* text-align: center;
|
|
206
|
+
* font-size: 24px;
|
|
207
|
+
* }
|
|
208
|
+
* `]
|
|
209
|
+
* })
|
|
210
|
+
*
|
|
211
|
+
* class AppComponent {
|
|
212
|
+
* public width: string = "600px";
|
|
213
|
+
* public height: string = "400px";
|
|
214
|
+
* public endless: boolean = false;
|
|
215
|
+
* public pageable: boolean = false;
|
|
216
|
+
* public items: any[] = [
|
|
217
|
+
* { title: 'Flower', url: 'https://bit.ly/2cJjYuB' },
|
|
218
|
+
* { title: 'Mountain', url: 'https://bit.ly/2cTBNaL' },
|
|
219
|
+
* { title: 'Sky', url: 'https://bit.ly/2cJl3Cx' }
|
|
220
|
+
* ];
|
|
221
|
+
* }
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
class ScrollViewComponent {
|
|
225
|
+
constructor(element, localization, ngZone, renderer) {
|
|
226
|
+
this.element = element;
|
|
227
|
+
this.localization = localization;
|
|
228
|
+
this.ngZone = ngZone;
|
|
229
|
+
this.renderer = renderer;
|
|
230
|
+
/**
|
|
231
|
+
* @hidden
|
|
232
|
+
*/
|
|
233
|
+
this.chevronLeftIcon = chevronLeftIcon;
|
|
234
|
+
/**
|
|
235
|
+
* @hidden
|
|
236
|
+
*/
|
|
237
|
+
this.chevronRightIcon = chevronRightIcon;
|
|
238
|
+
/**
|
|
239
|
+
* Provides the data source for the ScrollView ([see example]({% slug datasources_scrollview %})).
|
|
240
|
+
*/
|
|
241
|
+
this.data = [];
|
|
242
|
+
/**
|
|
243
|
+
* Enables or disables the endless scrolling mode in which the data source items are endlessly looped
|
|
244
|
+
* ([see example]({% slug endlessscrolling_scrollview %})). By default, `endless` is set to `false`
|
|
245
|
+
* and the endless scrolling mode is disabled.
|
|
246
|
+
*/
|
|
247
|
+
this.endless = false;
|
|
248
|
+
/**
|
|
249
|
+
* Sets `pagerOverlay` to one of three possible values: `dark`, `light` or `none`.
|
|
250
|
+
* By default, the pager overlay is set to `none`.
|
|
251
|
+
*/
|
|
252
|
+
this.pagerOverlay = 'none';
|
|
253
|
+
/**
|
|
254
|
+
* Enables or disables the built-in animations ([see example]({% slug animations_scrollview %})).
|
|
255
|
+
* By default, `animate` is set to `true` and animations are enabled.
|
|
256
|
+
*/
|
|
257
|
+
this.animate = true;
|
|
258
|
+
/**
|
|
259
|
+
* Enables or disables the built-in pager ([see example]({% slug paging_scrollview %})).
|
|
260
|
+
* By default, `pageable` is set to `false` and paging is disabled.
|
|
261
|
+
*/
|
|
262
|
+
this.pageable = false;
|
|
263
|
+
/**
|
|
264
|
+
* Enables or disables the built-in navigation arrows ([see example]({% slug arrows_scrollview %})).
|
|
265
|
+
* By default, `arrows` is set to `false` and arrows are disabled.
|
|
266
|
+
*/
|
|
267
|
+
this.arrows = false;
|
|
268
|
+
/**
|
|
269
|
+
* Fires after the current item is changed.
|
|
270
|
+
*/
|
|
271
|
+
this.itemChanged = new EventEmitter();
|
|
272
|
+
/**
|
|
273
|
+
* Fires after the activeIndex has changed. Allows for two-way binding of the activeIndex property.
|
|
274
|
+
*/
|
|
275
|
+
this.activeIndexChange = new EventEmitter();
|
|
276
|
+
this.scrollViewClass = true;
|
|
277
|
+
this.tabIndex = 1;
|
|
278
|
+
this.ariaLive = 'assertive';
|
|
279
|
+
this.touchAction = 'pan-y pinch-zoom';
|
|
280
|
+
this.animationState = null;
|
|
281
|
+
this.view = new DataCollection(() => new DataResultIterator(this.data, this.activeIndex, this.endless, this.pageIndex, this.isRTL));
|
|
282
|
+
this.isDataSourceEmpty = false;
|
|
283
|
+
this._activeIndex = 0;
|
|
284
|
+
this.index = 0;
|
|
285
|
+
this.pageIndex = null;
|
|
286
|
+
this.transforms = ['translateX(-100%)', 'translateX(0%)', 'translateX(100%)'];
|
|
287
|
+
validatePackage(packageMetadata);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Represents the current item index ([see example]({% slug activeitems_scrollview %})).
|
|
291
|
+
*/
|
|
292
|
+
set activeIndex(value) {
|
|
293
|
+
this.index = this._activeIndex = value;
|
|
294
|
+
}
|
|
295
|
+
get activeIndex() {
|
|
296
|
+
return this._activeIndex;
|
|
297
|
+
}
|
|
298
|
+
get scrollViewLightOverlayClass() {
|
|
299
|
+
return this.pagerOverlay === 'light';
|
|
300
|
+
}
|
|
301
|
+
get scrollViewDarkOverlayClass() {
|
|
302
|
+
return this.pagerOverlay === 'dark';
|
|
303
|
+
}
|
|
304
|
+
get hostWidth() { return this.width; }
|
|
305
|
+
get hostHeight() { return this.height; }
|
|
306
|
+
get dir() {
|
|
307
|
+
return this.direction;
|
|
308
|
+
}
|
|
309
|
+
get direction() {
|
|
310
|
+
return this.localization.rtl ? 'rtl' : 'ltr';
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* @hidden
|
|
314
|
+
*/
|
|
315
|
+
keyDown(e) {
|
|
316
|
+
if (e.keyCode === Keys.ArrowLeft) {
|
|
317
|
+
if (this.isRTL) {
|
|
318
|
+
this.next();
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
this.prev();
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
if (e.keyCode === Keys.ArrowRight) {
|
|
325
|
+
if (this.isRTL) {
|
|
326
|
+
this.prev();
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
this.next();
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
ngOnChanges(_) {
|
|
334
|
+
this.activeIndex = Math.max(Math.min(this.activeIndex, this.view.total - 1), 0);
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Navigates the ScrollView to the previous item.
|
|
338
|
+
*/
|
|
339
|
+
prev() {
|
|
340
|
+
this.navigate(Dir.Prev);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Navigates the ScrollView to the next item.
|
|
344
|
+
*/
|
|
345
|
+
next() {
|
|
346
|
+
this.navigate(Dir.Next);
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* @hidden
|
|
350
|
+
*/
|
|
351
|
+
transitionEndHandler(e) {
|
|
352
|
+
this.animationState = null;
|
|
353
|
+
if (e.toState === 'left' || e.toState === 'right') {
|
|
354
|
+
if (this.pageIndex !== null) {
|
|
355
|
+
this.activeIndex = this.pageIndex;
|
|
356
|
+
this.pageIndex = null;
|
|
357
|
+
}
|
|
358
|
+
this.activeIndex = this.index;
|
|
359
|
+
this.activeIndexChange.emit(this.activeIndex);
|
|
360
|
+
this.itemChanged.emit({ index: this.activeIndex, item: this.view.item(1) });
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* @hidden
|
|
365
|
+
*/
|
|
366
|
+
handlePress(e) {
|
|
367
|
+
this.initialTouchCoordinate = e.pageX;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* @hidden
|
|
371
|
+
*/
|
|
372
|
+
handleDrag(e) {
|
|
373
|
+
const deltaX = e.pageX - this.initialTouchCoordinate;
|
|
374
|
+
if (!this.animationState && !this.isDragForbidden(deltaX) && this.draggedInsideBounds(deltaX)) {
|
|
375
|
+
this.renderer.setStyle(this.itemWrapper.nativeElement, 'transform', `translateX(${deltaX}px)`);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* @hidden
|
|
380
|
+
*/
|
|
381
|
+
handleRelease(e) {
|
|
382
|
+
const deltaX = e.pageX - this.initialTouchCoordinate;
|
|
383
|
+
if (this.isDragForbidden(deltaX)) {
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
this.ngZone.run(() => {
|
|
387
|
+
if (this.draggedEnoughToNavigate(deltaX)) {
|
|
388
|
+
if (this.isRTL) {
|
|
389
|
+
this.changeIndex(deltaX < 0 ? Dir.Prev : Dir.Next);
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
this.changeIndex(deltaX > 0 ? Dir.Prev : Dir.Next);
|
|
393
|
+
}
|
|
394
|
+
if (!this.animate) {
|
|
395
|
+
this.renderer.removeStyle(this.itemWrapper.nativeElement, 'transform');
|
|
396
|
+
this.activeIndexChange.emit(this.activeIndex);
|
|
397
|
+
this.itemChanged.emit({ index: this.activeIndex, item: this.view.item(1) });
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
if (this.animate && deltaX) {
|
|
402
|
+
this.animationState = 'center';
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
this.renderer.removeStyle(this.itemWrapper.nativeElement, 'transform');
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* @hidden
|
|
412
|
+
*/
|
|
413
|
+
pageChange(idx) {
|
|
414
|
+
if (!this.animationState && this.activeIndex !== idx) {
|
|
415
|
+
if (this.animate) {
|
|
416
|
+
this.pageIndex = idx;
|
|
417
|
+
if (this.isRTL) {
|
|
418
|
+
this.animationState = (this.pageIndex > this.index ? 'right' : 'left');
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
this.animationState = (this.pageIndex > this.index ? 'left' : 'right');
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
this.activeIndex = idx;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* @hidden
|
|
431
|
+
*/
|
|
432
|
+
inlineListItemStyles(idx) {
|
|
433
|
+
return {
|
|
434
|
+
'height': this.height,
|
|
435
|
+
'transform': this.transforms[idx],
|
|
436
|
+
'width': '100%'
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* @hidden
|
|
441
|
+
*/
|
|
442
|
+
displayLeftArrow() {
|
|
443
|
+
let isNotBorderItem;
|
|
444
|
+
if (this.isRTL) {
|
|
445
|
+
isNotBorderItem = this.activeIndex + 1 < this.view.total;
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
isNotBorderItem = this.activeIndex > 0;
|
|
449
|
+
}
|
|
450
|
+
return (this.endless || isNotBorderItem) && this.view.total > 0;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* @hidden
|
|
454
|
+
*/
|
|
455
|
+
leftArrowClick() {
|
|
456
|
+
if (this.isRTL) {
|
|
457
|
+
this.next();
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
this.prev();
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* @hidden
|
|
465
|
+
*/
|
|
466
|
+
displayRightArrow() {
|
|
467
|
+
let isNotBorderItem;
|
|
468
|
+
if (this.isRTL) {
|
|
469
|
+
isNotBorderItem = this.activeIndex > 0;
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
isNotBorderItem = this.activeIndex + 1 < this.view.total;
|
|
473
|
+
}
|
|
474
|
+
return (this.endless || isNotBorderItem) && this.view.total > 0;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* @hidden
|
|
478
|
+
*/
|
|
479
|
+
rightArrowClick() {
|
|
480
|
+
if (this.isRTL) {
|
|
481
|
+
this.prev();
|
|
482
|
+
}
|
|
483
|
+
else {
|
|
484
|
+
this.next();
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
draggedInsideBounds(deltaX) {
|
|
488
|
+
return Math.abs(deltaX) <= this.element.nativeElement.offsetWidth;
|
|
489
|
+
}
|
|
490
|
+
draggedEnoughToNavigate(deltaX) {
|
|
491
|
+
return Math.abs(deltaX) > (this.element.nativeElement.offsetWidth / 2);
|
|
492
|
+
}
|
|
493
|
+
isDragForbidden(deltaX) {
|
|
494
|
+
let pastEnd;
|
|
495
|
+
if (this.isRTL) {
|
|
496
|
+
pastEnd = deltaX < 0 && deltaX !== 0;
|
|
497
|
+
}
|
|
498
|
+
else {
|
|
499
|
+
pastEnd = deltaX > 0 && deltaX !== 0;
|
|
500
|
+
}
|
|
501
|
+
const isEndReached = ((this.activeIndex === 0 && pastEnd) || (this.activeIndex === this.view.total - 1 && !pastEnd));
|
|
502
|
+
return !this.endless && isEndReached;
|
|
503
|
+
}
|
|
504
|
+
navigate(direction) {
|
|
505
|
+
if (this.isDataSourceEmpty || this.animationState) {
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
this.changeIndex(direction);
|
|
509
|
+
if (!this.animate) {
|
|
510
|
+
this.activeIndexChange.emit(this.activeIndex);
|
|
511
|
+
this.itemChanged.emit({ index: this.activeIndex, item: this.view.item(1) });
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
changeIndex(direction) {
|
|
515
|
+
if (direction === Dir.Next && this.view.canMoveNext()) {
|
|
516
|
+
this.index = (this.index + 1) % this.view.total;
|
|
517
|
+
if (this.animate) {
|
|
518
|
+
this.animationState = this.isRTL ? 'right' : 'left';
|
|
519
|
+
}
|
|
520
|
+
else {
|
|
521
|
+
this.activeIndex = this.index;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
else if (direction === Dir.Prev && this.view.canMovePrev()) {
|
|
525
|
+
this.index = this.index === 0 ? this.view.total - 1 : this.index - 1;
|
|
526
|
+
if (this.animate) {
|
|
527
|
+
this.animationState = this.isRTL ? 'left' : 'right';
|
|
528
|
+
}
|
|
529
|
+
else {
|
|
530
|
+
this.activeIndex = this.index;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
get isRTL() {
|
|
535
|
+
return this.direction === 'rtl';
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
ScrollViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ScrollViewComponent, deps: [{ token: i0.ElementRef }, { token: i1.LocalizationService }, { token: i0.NgZone }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
|
|
539
|
+
ScrollViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: ScrollViewComponent, selector: "kendo-scrollview", inputs: { data: "data", activeIndex: "activeIndex", width: "width", height: "height", endless: "endless", pagerOverlay: "pagerOverlay", animate: "animate", pageable: "pageable", arrows: "arrows" }, outputs: { itemChanged: "itemChanged", activeIndexChange: "activeIndexChange" }, host: { listeners: { "keydown": "keyDown($event)" }, properties: { "class.k-scrollview": "this.scrollViewClass", "class.k-scrollview-light": "this.scrollViewLightOverlayClass", "class.k-scrollview-dark": "this.scrollViewDarkOverlayClass", "style.width": "this.hostWidth", "style.height": "this.hostHeight", "attr.tabindex": "this.tabIndex", "attr.aria-live": "this.ariaLive", "attr.dir": "this.dir", "style.touch-action": "this.touchAction" } }, providers: [
|
|
540
|
+
LocalizationService,
|
|
541
|
+
{
|
|
542
|
+
provide: L10N_PREFIX,
|
|
543
|
+
useValue: 'kendo.scrollview'
|
|
544
|
+
}
|
|
545
|
+
], queries: [{ propertyName: "itemTemplateRef", first: true, predicate: TemplateRef, descendants: true }], viewQueries: [{ propertyName: "itemWrapper", first: true, predicate: ["itemWrapper"], descendants: true }], exportAs: ["kendoScrollView"], usesOnChanges: true, ngImport: i0, template: `
|
|
546
|
+
<ul class='k-scrollview-wrap'
|
|
547
|
+
#itemWrapper
|
|
548
|
+
[@animateTo]="animationState"
|
|
549
|
+
(@animateTo.done)="transitionEndHandler($event)"
|
|
550
|
+
kendoDraggable
|
|
551
|
+
(kendoDrag)="handleDrag($event)"
|
|
552
|
+
(kendoPress)="handlePress($event)"
|
|
553
|
+
(kendoRelease)="handleRelease($event)"
|
|
554
|
+
>
|
|
555
|
+
<li
|
|
556
|
+
*ngFor="let item of view;let i=index"
|
|
557
|
+
[ngStyle]="inlineListItemStyles(i)"
|
|
558
|
+
[attr.aria-hidden]="i !== 1"
|
|
559
|
+
>
|
|
560
|
+
<ng-template
|
|
561
|
+
[ngTemplateOutlet]="itemTemplateRef"
|
|
562
|
+
[ngTemplateOutletContext]="{ item: item }">
|
|
563
|
+
</ng-template>
|
|
564
|
+
</li>
|
|
565
|
+
</ul>
|
|
566
|
+
<div class='k-scrollview-elements'
|
|
567
|
+
[ngStyle]="{'height': height}"
|
|
568
|
+
*ngIf="!isDataSourceEmpty && (pageable||arrows)">
|
|
569
|
+
|
|
570
|
+
<a class="k-scrollview-prev"
|
|
571
|
+
aria-label="previous"
|
|
572
|
+
*ngIf="arrows && displayLeftArrow()"
|
|
573
|
+
(click)="leftArrowClick()">
|
|
574
|
+
<kendo-icon-wrapper
|
|
575
|
+
name="chevron-left"
|
|
576
|
+
[svgIcon]="chevronLeftIcon"
|
|
577
|
+
>
|
|
578
|
+
</kendo-icon-wrapper>
|
|
579
|
+
</a>
|
|
580
|
+
<a class="k-scrollview-next"
|
|
581
|
+
aria-label="next"
|
|
582
|
+
*ngIf="arrows && displayRightArrow()"
|
|
583
|
+
(click)="rightArrowClick()">
|
|
584
|
+
<kendo-icon-wrapper
|
|
585
|
+
name="chevron-right"
|
|
586
|
+
[svgIcon]="chevronRightIcon"
|
|
587
|
+
>
|
|
588
|
+
</kendo-icon-wrapper>
|
|
589
|
+
</a>
|
|
590
|
+
<kendo-scrollview-pager
|
|
591
|
+
class='k-scrollview-nav-wrap'
|
|
592
|
+
*ngIf="pageable"
|
|
593
|
+
(pagerIndexChange)="pageChange($event)"
|
|
594
|
+
[data]="data"
|
|
595
|
+
[activeIndex]="activeIndex">
|
|
596
|
+
</kendo-scrollview-pager>
|
|
597
|
+
</div>
|
|
598
|
+
`, isInline: true, components: [{ type: i2.IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass"], exportAs: ["kendoIconWrapper"] }, { type: ScrollViewPagerComponent, selector: "kendo-scrollview-pager", inputs: ["activeIndex", "data"], outputs: ["pagerIndexChange"] }], directives: [{ type: i4.DraggableDirective, selector: "[kendoDraggable]", inputs: ["enableDrag"], outputs: ["kendoPress", "kendoDrag", "kendoRelease"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], animations: [
|
|
599
|
+
trigger('animateTo', [
|
|
600
|
+
state('center, left, right', style({ transform: 'translateX(0)' })),
|
|
601
|
+
transition('* => right', [
|
|
602
|
+
animate('300ms ease-out', style({ transform: 'translateX(100%)' }))
|
|
603
|
+
]),
|
|
604
|
+
transition('* => left', [
|
|
605
|
+
animate('300ms ease-out', style({ transform: 'translateX(-100%)' }))
|
|
606
|
+
]),
|
|
607
|
+
transition('* => center', [
|
|
608
|
+
animate('300ms ease-out')
|
|
609
|
+
])
|
|
610
|
+
])
|
|
611
|
+
] });
|
|
612
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ScrollViewComponent, decorators: [{
|
|
613
|
+
type: Component,
|
|
614
|
+
args: [{
|
|
615
|
+
animations: [
|
|
616
|
+
trigger('animateTo', [
|
|
617
|
+
state('center, left, right', style({ transform: 'translateX(0)' })),
|
|
618
|
+
transition('* => right', [
|
|
619
|
+
animate('300ms ease-out', style({ transform: 'translateX(100%)' }))
|
|
620
|
+
]),
|
|
621
|
+
transition('* => left', [
|
|
622
|
+
animate('300ms ease-out', style({ transform: 'translateX(-100%)' }))
|
|
623
|
+
]),
|
|
624
|
+
transition('* => center', [
|
|
625
|
+
animate('300ms ease-out')
|
|
626
|
+
])
|
|
627
|
+
])
|
|
628
|
+
],
|
|
629
|
+
exportAs: 'kendoScrollView',
|
|
630
|
+
providers: [
|
|
631
|
+
LocalizationService,
|
|
632
|
+
{
|
|
633
|
+
provide: L10N_PREFIX,
|
|
634
|
+
useValue: 'kendo.scrollview'
|
|
635
|
+
}
|
|
636
|
+
],
|
|
637
|
+
selector: 'kendo-scrollview',
|
|
638
|
+
template: `
|
|
639
|
+
<ul class='k-scrollview-wrap'
|
|
640
|
+
#itemWrapper
|
|
641
|
+
[@animateTo]="animationState"
|
|
642
|
+
(@animateTo.done)="transitionEndHandler($event)"
|
|
643
|
+
kendoDraggable
|
|
644
|
+
(kendoDrag)="handleDrag($event)"
|
|
645
|
+
(kendoPress)="handlePress($event)"
|
|
646
|
+
(kendoRelease)="handleRelease($event)"
|
|
647
|
+
>
|
|
648
|
+
<li
|
|
649
|
+
*ngFor="let item of view;let i=index"
|
|
650
|
+
[ngStyle]="inlineListItemStyles(i)"
|
|
651
|
+
[attr.aria-hidden]="i !== 1"
|
|
652
|
+
>
|
|
653
|
+
<ng-template
|
|
654
|
+
[ngTemplateOutlet]="itemTemplateRef"
|
|
655
|
+
[ngTemplateOutletContext]="{ item: item }">
|
|
656
|
+
</ng-template>
|
|
657
|
+
</li>
|
|
658
|
+
</ul>
|
|
659
|
+
<div class='k-scrollview-elements'
|
|
660
|
+
[ngStyle]="{'height': height}"
|
|
661
|
+
*ngIf="!isDataSourceEmpty && (pageable||arrows)">
|
|
662
|
+
|
|
663
|
+
<a class="k-scrollview-prev"
|
|
664
|
+
aria-label="previous"
|
|
665
|
+
*ngIf="arrows && displayLeftArrow()"
|
|
666
|
+
(click)="leftArrowClick()">
|
|
667
|
+
<kendo-icon-wrapper
|
|
668
|
+
name="chevron-left"
|
|
669
|
+
[svgIcon]="chevronLeftIcon"
|
|
670
|
+
>
|
|
671
|
+
</kendo-icon-wrapper>
|
|
672
|
+
</a>
|
|
673
|
+
<a class="k-scrollview-next"
|
|
674
|
+
aria-label="next"
|
|
675
|
+
*ngIf="arrows && displayRightArrow()"
|
|
676
|
+
(click)="rightArrowClick()">
|
|
677
|
+
<kendo-icon-wrapper
|
|
678
|
+
name="chevron-right"
|
|
679
|
+
[svgIcon]="chevronRightIcon"
|
|
680
|
+
>
|
|
681
|
+
</kendo-icon-wrapper>
|
|
682
|
+
</a>
|
|
683
|
+
<kendo-scrollview-pager
|
|
684
|
+
class='k-scrollview-nav-wrap'
|
|
685
|
+
*ngIf="pageable"
|
|
686
|
+
(pagerIndexChange)="pageChange($event)"
|
|
687
|
+
[data]="data"
|
|
688
|
+
[activeIndex]="activeIndex">
|
|
689
|
+
</kendo-scrollview-pager>
|
|
690
|
+
</div>
|
|
691
|
+
`
|
|
692
|
+
}]
|
|
693
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.LocalizationService }, { type: i0.NgZone }, { type: i0.Renderer2 }]; }, propDecorators: { data: [{
|
|
694
|
+
type: Input
|
|
695
|
+
}], activeIndex: [{
|
|
696
|
+
type: Input
|
|
697
|
+
}], width: [{
|
|
698
|
+
type: Input
|
|
699
|
+
}], height: [{
|
|
700
|
+
type: Input
|
|
701
|
+
}], endless: [{
|
|
702
|
+
type: Input
|
|
703
|
+
}], pagerOverlay: [{
|
|
704
|
+
type: Input
|
|
705
|
+
}], animate: [{
|
|
706
|
+
type: Input
|
|
707
|
+
}], pageable: [{
|
|
708
|
+
type: Input
|
|
709
|
+
}], arrows: [{
|
|
710
|
+
type: Input
|
|
711
|
+
}], itemChanged: [{
|
|
712
|
+
type: Output
|
|
713
|
+
}], activeIndexChange: [{
|
|
714
|
+
type: Output
|
|
715
|
+
}], itemTemplateRef: [{
|
|
716
|
+
type: ContentChild,
|
|
717
|
+
args: [TemplateRef, { static: false }]
|
|
718
|
+
}], itemWrapper: [{
|
|
719
|
+
type: ViewChild,
|
|
720
|
+
args: ['itemWrapper', { static: false }]
|
|
721
|
+
}], scrollViewClass: [{
|
|
722
|
+
type: HostBinding,
|
|
723
|
+
args: ['class.k-scrollview']
|
|
724
|
+
}], scrollViewLightOverlayClass: [{
|
|
725
|
+
type: HostBinding,
|
|
726
|
+
args: ['class.k-scrollview-light']
|
|
727
|
+
}], scrollViewDarkOverlayClass: [{
|
|
728
|
+
type: HostBinding,
|
|
729
|
+
args: ['class.k-scrollview-dark']
|
|
730
|
+
}], hostWidth: [{
|
|
731
|
+
type: HostBinding,
|
|
732
|
+
args: ['style.width']
|
|
733
|
+
}], hostHeight: [{
|
|
734
|
+
type: HostBinding,
|
|
735
|
+
args: ['style.height']
|
|
736
|
+
}], tabIndex: [{
|
|
737
|
+
type: HostBinding,
|
|
738
|
+
args: ['attr.tabindex']
|
|
739
|
+
}], ariaLive: [{
|
|
740
|
+
type: HostBinding,
|
|
741
|
+
args: ['attr.aria-live']
|
|
742
|
+
}], dir: [{
|
|
743
|
+
type: HostBinding,
|
|
744
|
+
args: ['attr.dir']
|
|
745
|
+
}], touchAction: [{
|
|
746
|
+
type: HostBinding,
|
|
747
|
+
args: ['style.touch-action']
|
|
748
|
+
}], keyDown: [{
|
|
749
|
+
type: HostListener,
|
|
750
|
+
args: ['keydown', ['$event']]
|
|
751
|
+
}] } });
|
|
752
|
+
|
|
753
|
+
const DECLARATIONS = [
|
|
754
|
+
ScrollViewComponent,
|
|
755
|
+
ScrollViewPagerComponent
|
|
756
|
+
];
|
|
757
|
+
const EXPORTS = [
|
|
758
|
+
ScrollViewComponent
|
|
759
|
+
];
|
|
760
|
+
/**
|
|
761
|
+
* Represents the [NgModule](link:site.data.urls.angular['ngmoduleapi'])
|
|
762
|
+
* definition for the ScrollView component.
|
|
763
|
+
*
|
|
764
|
+
* @example
|
|
765
|
+
*
|
|
766
|
+
* ```ts-no-run
|
|
767
|
+
* // Import the ScrollView module
|
|
768
|
+
* import { ScrollViewModule } from '@progress/kendo-angular-scrollview';
|
|
769
|
+
*
|
|
770
|
+
* // The browser platform with a compiler
|
|
771
|
+
* import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
772
|
+
*
|
|
773
|
+
* import { NgModule } from '@angular/core';
|
|
774
|
+
*
|
|
775
|
+
* // Import the app component
|
|
776
|
+
* import { AppComponent } from './app.component';
|
|
777
|
+
*
|
|
778
|
+
* // Define the app module
|
|
779
|
+
* _@NgModule({
|
|
780
|
+
* declarations: [AppComponent], // declare app component
|
|
781
|
+
* imports: [BrowserModule, ScrollViewModule], // import ScrollView module
|
|
782
|
+
* bootstrap: [AppComponent]
|
|
783
|
+
* })
|
|
784
|
+
* export class AppModule {}
|
|
785
|
+
*
|
|
786
|
+
* // Compile and launch the module
|
|
787
|
+
* platformBrowserDynamic().bootstrapModule(AppModule);
|
|
788
|
+
*
|
|
789
|
+
* ```
|
|
790
|
+
*/
|
|
791
|
+
class ScrollViewModule {
|
|
792
|
+
}
|
|
793
|
+
ScrollViewModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ScrollViewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
794
|
+
ScrollViewModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ScrollViewModule, declarations: [ScrollViewComponent,
|
|
795
|
+
ScrollViewPagerComponent], imports: [CommonModule, DraggableModule, IconsModule], exports: [ScrollViewComponent] });
|
|
796
|
+
ScrollViewModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ScrollViewModule, imports: [[CommonModule, DraggableModule, IconsModule]] });
|
|
797
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ScrollViewModule, decorators: [{
|
|
798
|
+
type: NgModule,
|
|
799
|
+
args: [{
|
|
800
|
+
declarations: [DECLARATIONS],
|
|
801
|
+
exports: [EXPORTS],
|
|
802
|
+
imports: [CommonModule, DraggableModule, IconsModule]
|
|
803
|
+
}]
|
|
804
|
+
}] });
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* Generated bundle index. Do not edit.
|
|
808
|
+
*/
|
|
809
|
+
|
|
810
|
+
export { ScrollViewComponent, ScrollViewModule, ScrollViewPagerComponent };
|
|
811
|
+
|