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