@syncfusion/ej2-navigations 19.4.56 → 20.1.51
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/CHANGELOG.md +53 -2
- package/README.md +16 -1
- package/carousel.d.ts +4 -0
- package/carousel.js +4 -0
- package/dist/ej2-navigations.umd.min.js +2 -2
- package/dist/ej2-navigations.umd.min.js.map +1 -1
- package/dist/es6/ej2-navigations.es2015.js +1065 -30
- package/dist/es6/ej2-navigations.es2015.js.map +1 -1
- package/dist/es6/ej2-navigations.es5.js +1106 -33
- package/dist/es6/ej2-navigations.es5.js.map +1 -1
- package/dist/global/ej2-navigations.min.js +2 -2
- package/dist/global/ej2-navigations.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +11 -11
- package/src/accordion/accordion.js +11 -3
- package/src/breadcrumb/breadcrumb.js +6 -0
- package/src/carousel/carousel-model.d.ts +227 -0
- package/src/carousel/carousel.d.ts +338 -0
- package/src/carousel/carousel.js +988 -0
- package/src/carousel/index.d.ts +3 -0
- package/src/carousel/index.js +2 -0
- package/src/common/h-scroll.js +5 -3
- package/src/common/menu-base.js +11 -13
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/tab/tab-model.d.ts +1 -1
- package/src/tab/tab.js +72 -11
- package/src/toolbar/toolbar.js +11 -0
- package/src/treeview/treeview.js +5 -2
- package/styles/accordion/_bootstrap-dark-definition.scss +4 -4
- package/styles/accordion/_bootstrap-definition.scss +4 -4
- package/styles/accordion/_bootstrap4-definition.scss +4 -4
- package/styles/accordion/_bootstrap5-definition.scss +10 -10
- package/styles/accordion/_fabric-dark-definition.scss +9 -9
- package/styles/accordion/_fabric-definition.scss +9 -9
- package/styles/accordion/_fluent-dark-definition.scss +1 -0
- package/styles/accordion/_fluent-definition.scss +10 -10
- package/styles/accordion/_highcontrast-definition.scss +8 -8
- package/styles/accordion/_highcontrast-light-definition.scss +8 -8
- package/styles/accordion/_layout.scss +56 -86
- package/styles/accordion/_material-dark-definition.scss +8 -8
- package/styles/accordion/_material-definition.scss +8 -8
- package/styles/accordion/_tailwind-definition.scss +10 -10
- package/styles/accordion/_theme.scss +14 -1
- package/styles/accordion/bootstrap-dark.css +48 -63
- package/styles/accordion/bootstrap.css +48 -63
- package/styles/accordion/bootstrap4.css +48 -63
- package/styles/accordion/bootstrap5-dark.css +51 -66
- package/styles/accordion/bootstrap5.css +51 -66
- package/styles/accordion/fabric-dark.css +50 -65
- package/styles/accordion/fabric.css +50 -65
- package/styles/accordion/fluent-dark.css +395 -0
- package/styles/accordion/fluent-dark.scss +4 -0
- package/styles/accordion/fluent.css +395 -0
- package/styles/accordion/fluent.scss +4 -0
- package/styles/accordion/highcontrast-light.css +49 -64
- package/styles/accordion/highcontrast.css +49 -64
- package/styles/accordion/icons/_fluent-dark.scss +1 -0
- package/styles/accordion/icons/_fluent.scss +2 -1
- package/styles/accordion/icons/_tailwind.scss +2 -1
- package/styles/accordion/material-dark.css +49 -64
- package/styles/accordion/material.css +49 -64
- package/styles/accordion/tailwind-dark.css +52 -67
- package/styles/accordion/tailwind.css +52 -67
- package/styles/bootstrap-dark.css +309 -68
- package/styles/bootstrap-dark.scss +1 -0
- package/styles/bootstrap.css +309 -68
- package/styles/bootstrap.scss +1 -0
- package/styles/bootstrap4.css +309 -68
- package/styles/bootstrap4.scss +1 -0
- package/styles/bootstrap5-dark.css +414 -170
- package/styles/bootstrap5-dark.scss +1 -0
- package/styles/bootstrap5.css +414 -170
- package/styles/bootstrap5.scss +1 -0
- package/styles/breadcrumb/_bootstrap5-definition.scss +2 -2
- package/styles/breadcrumb/_fluent-dark-definition.scss +1 -0
- package/styles/breadcrumb/_fluent-definition.scss +4 -1
- package/styles/breadcrumb/_layout.scss +42 -5
- package/styles/breadcrumb/_tailwind-dark-definition.scss +1 -60
- package/styles/breadcrumb/_tailwind-definition.scss +2 -2
- package/styles/breadcrumb/_theme.scss +11 -5
- package/styles/breadcrumb/bootstrap-dark.css +9 -1
- package/styles/breadcrumb/bootstrap.css +9 -1
- package/styles/breadcrumb/bootstrap4.css +9 -1
- package/styles/breadcrumb/bootstrap5-dark.css +11 -3
- package/styles/breadcrumb/bootstrap5.css +11 -3
- package/styles/breadcrumb/fabric-dark.css +9 -3
- package/styles/breadcrumb/fabric.css +9 -3
- package/styles/breadcrumb/fluent-dark.css +444 -0
- package/styles/breadcrumb/fluent-dark.scss +4 -0
- package/styles/breadcrumb/fluent.css +444 -0
- package/styles/breadcrumb/fluent.scss +4 -0
- package/styles/breadcrumb/highcontrast-light.css +9 -3
- package/styles/breadcrumb/highcontrast.css +9 -3
- package/styles/breadcrumb/icons/_fluent-dark.scss +1 -0
- package/styles/breadcrumb/icons/_fluent.scss +4 -4
- package/styles/breadcrumb/icons/_tailwind-dark.scss +13 -2
- package/styles/breadcrumb/icons/_tailwind.scss +13 -2
- package/styles/breadcrumb/material-dark.css +9 -1
- package/styles/breadcrumb/material.css +9 -1
- package/styles/breadcrumb/tailwind-dark.css +27 -10
- package/styles/breadcrumb/tailwind.css +26 -9
- package/styles/carousel/_all.scss +2 -0
- package/styles/carousel/_bootstrap-dark-definition.scss +22 -0
- package/styles/carousel/_bootstrap-definition.scss +22 -0
- package/styles/carousel/_bootstrap4-definition.scss +22 -0
- package/styles/carousel/_bootstrap5-dark-definition.scss +1 -0
- package/styles/carousel/_bootstrap5-definition.scss +22 -0
- package/styles/carousel/_fabric-dark-definition.scss +22 -0
- package/styles/carousel/_fabric-definition.scss +22 -0
- package/styles/carousel/_fluent-dark-definition.scss +1 -0
- package/styles/carousel/_fluent-definition.scss +22 -0
- package/styles/carousel/_highcontrast-definition.scss +22 -0
- package/styles/carousel/_highcontrast-light-definition.scss +22 -0
- package/styles/carousel/_layout.scss +150 -0
- package/styles/carousel/_material-dark-definition.scss +22 -0
- package/styles/carousel/_material-definition.scss +22 -0
- package/styles/carousel/_tailwind-dark-definition.scss +1 -0
- package/styles/carousel/_tailwind-definition.scss +22 -0
- package/styles/carousel/_theme.scss +56 -0
- package/styles/carousel/bootstrap-dark.css +236 -0
- package/styles/carousel/bootstrap-dark.scss +5 -0
- package/styles/carousel/bootstrap.css +236 -0
- package/styles/carousel/bootstrap.scss +5 -0
- package/styles/carousel/bootstrap4.css +236 -0
- package/styles/carousel/bootstrap4.scss +5 -0
- package/styles/carousel/bootstrap5-dark.css +236 -0
- package/styles/carousel/bootstrap5-dark.scss +5 -0
- package/styles/carousel/bootstrap5.css +236 -0
- package/styles/carousel/bootstrap5.scss +5 -0
- package/styles/carousel/fabric-dark.css +236 -0
- package/styles/carousel/fabric-dark.scss +5 -0
- package/styles/carousel/fabric.css +236 -0
- package/styles/carousel/fabric.scss +5 -0
- package/styles/carousel/fluent-dark.css +236 -0
- package/styles/carousel/fluent-dark.scss +5 -0
- package/styles/carousel/fluent.css +236 -0
- package/styles/carousel/fluent.scss +5 -0
- package/styles/carousel/highcontrast-light.css +236 -0
- package/styles/carousel/highcontrast-light.scss +5 -0
- package/styles/carousel/highcontrast.css +236 -0
- package/styles/carousel/highcontrast.scss +5 -0
- package/styles/carousel/icons/_bootstrap-dark.scss +30 -0
- package/styles/carousel/icons/_bootstrap.scss +30 -0
- package/styles/carousel/icons/_bootstrap4.scss +30 -0
- package/styles/carousel/icons/_bootstrap5-dark.scss +1 -0
- package/styles/carousel/icons/_bootstrap5.scss +30 -0
- package/styles/carousel/icons/_fabric-dark.scss +30 -0
- package/styles/carousel/icons/_fabric.scss +30 -0
- package/styles/carousel/icons/_fluent-dark.scss +1 -0
- package/styles/carousel/icons/_fluent.scss +30 -0
- package/styles/carousel/icons/_highcontrast-light.scss +30 -0
- package/styles/carousel/icons/_highcontrast.scss +30 -0
- package/styles/carousel/icons/_material-dark.scss +30 -0
- package/styles/carousel/icons/_material.scss +30 -0
- package/styles/carousel/icons/_tailwind-dark.scss +1 -0
- package/styles/carousel/icons/_tailwind.scss +30 -0
- package/styles/carousel/material-dark.css +237 -0
- package/styles/carousel/material-dark.scss +5 -0
- package/styles/carousel/material.css +237 -0
- package/styles/carousel/material.scss +5 -0
- package/styles/carousel/tailwind-dark.css +237 -0
- package/styles/carousel/tailwind-dark.scss +5 -0
- package/styles/carousel/tailwind.css +237 -0
- package/styles/carousel/tailwind.scss +5 -0
- package/styles/context-menu/_bootstrap5-definition.scss +2 -2
- package/styles/context-menu/_fluent-dark-definition.scss +1 -0
- package/styles/context-menu/_fluent-definition.scss +10 -10
- package/styles/context-menu/_layout-mixin.scss +3 -0
- package/styles/context-menu/_layout.scss +11 -1
- package/styles/context-menu/_tailwind-definition.scss +2 -1
- package/styles/context-menu/bootstrap-dark.css +5 -0
- package/styles/context-menu/bootstrap.css +5 -0
- package/styles/context-menu/bootstrap4.css +5 -0
- package/styles/context-menu/bootstrap5-dark.css +16 -8
- package/styles/context-menu/bootstrap5.css +16 -8
- package/styles/context-menu/fabric-dark.css +5 -0
- package/styles/context-menu/fabric.css +5 -0
- package/styles/context-menu/fluent-dark.css +388 -0
- package/styles/context-menu/fluent-dark.scss +4 -0
- package/styles/context-menu/fluent.css +388 -0
- package/styles/context-menu/fluent.scss +4 -0
- package/styles/context-menu/highcontrast-light.css +5 -0
- package/styles/context-menu/highcontrast.css +5 -0
- package/styles/context-menu/icons/_fluent-dark.scss +1 -0
- package/styles/context-menu/icons/_fluent.scss +3 -3
- package/styles/context-menu/icons/_tailwind-dark.scss +3 -3
- package/styles/context-menu/icons/_tailwind.scss +3 -3
- package/styles/context-menu/material-dark.css +5 -0
- package/styles/context-menu/material.css +5 -0
- package/styles/context-menu/tailwind-dark.css +11 -4
- package/styles/context-menu/tailwind.css +11 -4
- package/styles/fabric-dark.css +311 -72
- package/styles/fabric-dark.scss +1 -0
- package/styles/fabric.css +311 -72
- package/styles/fabric.scss +1 -0
- package/styles/fluent-dark.css +10263 -0
- package/styles/fluent-dark.scss +11 -0
- package/styles/fluent.css +10263 -0
- package/styles/fluent.scss +11 -0
- package/styles/h-scroll/_bootstrap5-definition.scss +3 -3
- package/styles/h-scroll/_fluent-dark-definition.scss +1 -0
- package/styles/h-scroll/_layout.scss +0 -1
- package/styles/h-scroll/_material-dark-definition.scss +3 -3
- package/styles/h-scroll/bootstrap-dark.css +0 -1
- package/styles/h-scroll/bootstrap.css +0 -1
- package/styles/h-scroll/bootstrap4.css +0 -1
- package/styles/h-scroll/bootstrap5-dark.css +10 -11
- package/styles/h-scroll/bootstrap5.css +10 -11
- package/styles/h-scroll/fabric-dark.css +0 -1
- package/styles/h-scroll/fabric.css +0 -1
- package/styles/h-scroll/fluent-dark.css +326 -0
- package/styles/h-scroll/fluent-dark.scss +4 -0
- package/styles/h-scroll/fluent.css +326 -0
- package/styles/h-scroll/fluent.scss +4 -0
- package/styles/h-scroll/highcontrast-light.css +0 -1
- package/styles/h-scroll/highcontrast.css +0 -1
- package/styles/h-scroll/icons/_fluent-dark.scss +1 -0
- package/styles/h-scroll/icons/_fluent.scss +9 -9
- package/styles/h-scroll/icons/_tailwind.scss +8 -8
- package/styles/h-scroll/material-dark.css +3 -4
- package/styles/h-scroll/material.css +0 -1
- package/styles/h-scroll/tailwind-dark.css +8 -9
- package/styles/h-scroll/tailwind.css +8 -9
- package/styles/highcontrast-light.css +310 -71
- package/styles/highcontrast-light.scss +1 -0
- package/styles/highcontrast.css +311 -72
- package/styles/highcontrast.scss +1 -0
- package/styles/material-dark.css +313 -72
- package/styles/material-dark.scss +1 -0
- package/styles/material.css +310 -69
- package/styles/material.scss +1 -0
- package/styles/menu/_bootstrap5-definition.scss +4 -5
- package/styles/menu/_fluent-dark-definition.scss +1 -0
- package/styles/menu/_fluent-definition.scss +9 -9
- package/styles/menu/_layout.scss +8 -4
- package/styles/menu/_tailwind-definition.scss +1 -0
- package/styles/menu/_theme.scss +9 -0
- package/styles/menu/bootstrap-dark.css +1 -2
- package/styles/menu/bootstrap.css +1 -2
- package/styles/menu/bootstrap4.css +1 -2
- package/styles/menu/bootstrap5-dark.css +23 -24
- package/styles/menu/bootstrap5.css +23 -24
- package/styles/menu/fabric-dark.css +1 -2
- package/styles/menu/fabric.css +1 -2
- package/styles/menu/fluent-dark.css +1261 -0
- package/styles/menu/fluent-dark.scss +8 -0
- package/styles/menu/fluent.css +1261 -0
- package/styles/menu/fluent.scss +8 -0
- package/styles/menu/highcontrast-light.css +1 -2
- package/styles/menu/highcontrast.css +1 -2
- package/styles/menu/icons/_fluent-dark.scss +1 -0
- package/styles/menu/icons/_fluent.scss +14 -14
- package/styles/menu/icons/_tailwind-dark.scss +14 -14
- package/styles/menu/icons/_tailwind.scss +15 -15
- package/styles/menu/material-dark.css +1 -2
- package/styles/menu/material.css +1 -2
- package/styles/menu/tailwind-dark.css +18 -18
- package/styles/menu/tailwind.css +18 -18
- package/styles/sidebar/_fluent-dark-definition.scss +1 -0
- package/styles/sidebar/_theme.scss +5 -0
- package/styles/sidebar/bootstrap-dark.css +4 -0
- package/styles/sidebar/bootstrap.css +4 -0
- package/styles/sidebar/bootstrap4.css +4 -0
- package/styles/sidebar/bootstrap5-dark.css +4 -0
- package/styles/sidebar/bootstrap5.css +4 -0
- package/styles/sidebar/fabric-dark.css +4 -0
- package/styles/sidebar/fabric.css +4 -0
- package/styles/sidebar/fluent-dark.css +158 -0
- package/styles/sidebar/fluent-dark.scss +3 -0
- package/styles/sidebar/fluent.css +158 -0
- package/styles/sidebar/fluent.scss +3 -0
- package/styles/sidebar/highcontrast-light.css +4 -0
- package/styles/sidebar/highcontrast.css +4 -0
- package/styles/sidebar/material-dark.css +4 -0
- package/styles/sidebar/material.css +4 -0
- package/styles/sidebar/tailwind-dark.css +4 -0
- package/styles/sidebar/tailwind.css +4 -0
- package/styles/tab/_bootstrap5-definition.scss +7 -7
- package/styles/tab/_fluent-dark-definition.scss +1 -0
- package/styles/tab/_fluent-definition.scss +20 -20
- package/styles/tab/_highcontrast-definition.scss +1 -1
- package/styles/tab/_layout.scss +68 -12
- package/styles/tab/_tailwind-definition.scss +7 -7
- package/styles/tab/_theme.scss +12 -6
- package/styles/tab/bootstrap-dark.css +1 -1
- package/styles/tab/bootstrap.css +1 -1
- package/styles/tab/bootstrap4.css +1 -1
- package/styles/tab/bootstrap5-dark.css +23 -23
- package/styles/tab/bootstrap5.css +23 -23
- package/styles/tab/fabric-dark.css +1 -1
- package/styles/tab/fabric.css +1 -1
- package/styles/tab/fluent-dark.css +4394 -0
- package/styles/tab/fluent-dark.scss +5 -0
- package/styles/tab/fluent.css +4394 -0
- package/styles/tab/fluent.scss +5 -0
- package/styles/tab/highcontrast-light.css +1 -1
- package/styles/tab/highcontrast.css +2 -2
- package/styles/tab/icons/_fluent-dark.scss +1 -0
- package/styles/tab/icons/_fluent.scss +19 -18
- package/styles/tab/icons/_tailwind.scss +19 -18
- package/styles/tab/material-dark.css +1 -1
- package/styles/tab/material.css +1 -1
- package/styles/tab/tailwind-dark.css +43 -45
- package/styles/tab/tailwind.css +43 -45
- package/styles/tailwind-dark.css +428 -177
- package/styles/tailwind-dark.scss +1 -0
- package/styles/tailwind.css +427 -176
- package/styles/tailwind.scss +1 -0
- package/styles/toolbar/_bootstrap-dark-definition.scss +1 -0
- package/styles/toolbar/_bootstrap-definition.scss +1 -0
- package/styles/toolbar/_bootstrap4-definition.scss +1 -0
- package/styles/toolbar/_bootstrap5-definition.scss +12 -11
- package/styles/toolbar/_fabric-dark-definition.scss +1 -0
- package/styles/toolbar/_fabric-definition.scss +1 -0
- package/styles/toolbar/_fluent-dark-definition.scss +1 -0
- package/styles/toolbar/_fluent-definition.scss +14 -13
- package/styles/toolbar/_highcontrast-definition.scss +1 -0
- package/styles/toolbar/_highcontrast-light-definition.scss +1 -0
- package/styles/toolbar/_layout.scss +13 -5
- package/styles/toolbar/_material-dark-definition.scss +1 -0
- package/styles/toolbar/_material-definition.scss +1 -0
- package/styles/toolbar/_tailwind-definition.scss +4 -3
- package/styles/toolbar/_theme.scss +5 -1
- package/styles/toolbar/bootstrap-dark.css +4 -0
- package/styles/toolbar/bootstrap.css +4 -0
- package/styles/toolbar/bootstrap4.css +4 -0
- package/styles/toolbar/bootstrap5-dark.css +35 -31
- package/styles/toolbar/bootstrap5.css +35 -31
- package/styles/toolbar/fabric-dark.css +4 -0
- package/styles/toolbar/fabric.css +4 -0
- package/styles/toolbar/fluent-dark.css +1365 -0
- package/styles/toolbar/fluent-dark.scss +8 -0
- package/styles/toolbar/fluent.css +1365 -0
- package/styles/toolbar/fluent.scss +8 -0
- package/styles/toolbar/highcontrast-light.css +4 -0
- package/styles/toolbar/highcontrast.css +4 -0
- package/styles/toolbar/icons/_fluent-dark.scss +1 -0
- package/styles/toolbar/icons/_fluent.scss +3 -2
- package/styles/toolbar/icons/_tailwind.scss +3 -2
- package/styles/toolbar/material-dark.css +4 -0
- package/styles/toolbar/material.css +4 -0
- package/styles/toolbar/tailwind-dark.css +10 -6
- package/styles/toolbar/tailwind.css +10 -6
- package/styles/treeview/_bootstrap5-definition.scss +2 -2
- package/styles/treeview/_fluent-dark-definition.scss +1 -0
- package/styles/treeview/_fluent-definition.scss +2 -2
- package/styles/treeview/_layout.scss +8 -3
- package/styles/treeview/_tailwind-definition.scss +5 -5
- package/styles/treeview/bootstrap5-dark.css +4 -4
- package/styles/treeview/bootstrap5.css +4 -4
- package/styles/treeview/fluent-dark.css +1039 -0
- package/styles/treeview/fluent-dark.scss +6 -0
- package/styles/treeview/fluent.css +1039 -0
- package/styles/treeview/fluent.scss +6 -0
- package/styles/treeview/icons/_fluent-dark.scss +1 -0
- package/styles/treeview/icons/_fluent.scss +5 -5
- package/styles/treeview/icons/_tailwind-dark.scss +5 -5
- package/styles/treeview/icons/_tailwind.scss +5 -5
- package/styles/treeview/tailwind-dark.css +13 -14
- package/styles/treeview/tailwind.css +13 -14
- package/styles/v-scroll/_fluent-dark-definition.scss +1 -0
- package/styles/v-scroll/fluent-dark.css +247 -0
- package/styles/v-scroll/fluent-dark.scss +4 -0
- package/styles/v-scroll/fluent.css +247 -0
- package/styles/v-scroll/fluent.scss +4 -0
- package/styles/v-scroll/icons/_fluent-dark.scss +1 -0
- package/styles/v-scroll/icons/_fluent.scss +5 -4
- package/styles/v-scroll/icons/_tailwind.scss +5 -4
- package/styles/v-scroll/tailwind-dark.css +4 -4
- package/styles/v-scroll/tailwind.css +4 -4
|
@@ -0,0 +1,988 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
extendStatics(d, b);
|
|
10
|
+
function __() { this.constructor = d; }
|
|
11
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
+
};
|
|
13
|
+
})();
|
|
14
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
15
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
+
};
|
|
20
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
21
|
+
import { Component, EventHandler, Collection, Property, Event, formatUnit, NotifyPropertyChanges } from '@syncfusion/ej2-base';
|
|
22
|
+
import { ChildProperty, addClass, removeClass, setStyleAttribute, attributes, getUniqueID, compile, Complex, getInstance, L10n } from '@syncfusion/ej2-base';
|
|
23
|
+
import { append, closest, isNullOrUndefined, remove, classList, Touch, KeyboardEvents } from '@syncfusion/ej2-base';
|
|
24
|
+
import { Button } from '@syncfusion/ej2-buttons';
|
|
25
|
+
// Constant variables
|
|
26
|
+
var CLS_CAROUSEL = 'e-carousel';
|
|
27
|
+
var CLS_ACTIVE = 'e-active';
|
|
28
|
+
var CLS_RTL = 'e-rtl';
|
|
29
|
+
var CLS_ITEMS = 'e-carousel-items';
|
|
30
|
+
var CLS_ITEM = 'e-carousel-item';
|
|
31
|
+
var CLS_PREVIOUS = 'e-previous';
|
|
32
|
+
var CLS_NEXT = 'e-next';
|
|
33
|
+
var CLS_PREV_ICON = 'e-previous-icon';
|
|
34
|
+
var CLS_NEXT_ICON = 'e-next-icon';
|
|
35
|
+
var CLS_NAVIGATORS = 'e-carousel-navigators';
|
|
36
|
+
var CLS_INDICATORS = 'e-carousel-indicators';
|
|
37
|
+
var CLS_INDICATOR_BARS = 'e-indicator-bars';
|
|
38
|
+
var CLS_INDICATOR_BAR = 'e-indicator-bar';
|
|
39
|
+
var CLS_INDICATOR = 'e-indicator';
|
|
40
|
+
var CLS_ICON = 'e-icons';
|
|
41
|
+
var CLS_PLAY_PAUSE = 'e-play-pause';
|
|
42
|
+
var CLS_PLAY_ICON = 'e-play-icon';
|
|
43
|
+
var CLS_PAUSE_ICON = 'e-pause-icon';
|
|
44
|
+
var CLS_PREV_BUTTON = 'e-previous-button';
|
|
45
|
+
var CLS_NEXT_BUTTON = 'e-next-button';
|
|
46
|
+
var CLS_PLAY_BUTTON = 'e-play-button';
|
|
47
|
+
var CLS_FLAT = 'e-flat';
|
|
48
|
+
var CLS_ROUND = 'e-round';
|
|
49
|
+
var CLS_HOVER_ARROWS = 'e-hover-arrows';
|
|
50
|
+
var CLS_HOVER = 'e-carousel-hover';
|
|
51
|
+
var CLS_TEMPLATE = 'e-template';
|
|
52
|
+
var CLS_SLIDE_ANIMATION = 'e-carousel-slide-animation';
|
|
53
|
+
var CLS_FADE_ANIMATION = 'e-carousel-fade-animation';
|
|
54
|
+
var CLS_PREV_SLIDE = 'e-prev';
|
|
55
|
+
var CLS_NEXT_SLIDE = 'e-next';
|
|
56
|
+
var CLS_TRANSITION_START = 'e-transition-start';
|
|
57
|
+
var CLS_TRANSITION_END = 'e-transition-end';
|
|
58
|
+
/** Specifies the carousel individual item. */
|
|
59
|
+
var CarouselItem = /** @class */ (function (_super) {
|
|
60
|
+
__extends(CarouselItem, _super);
|
|
61
|
+
function CarouselItem() {
|
|
62
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
63
|
+
}
|
|
64
|
+
__decorate([
|
|
65
|
+
Property()
|
|
66
|
+
], CarouselItem.prototype, "cssClass", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
Property()
|
|
69
|
+
], CarouselItem.prototype, "interval", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
Property()
|
|
72
|
+
], CarouselItem.prototype, "template", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
Property()
|
|
75
|
+
], CarouselItem.prototype, "htmlAttributes", void 0);
|
|
76
|
+
return CarouselItem;
|
|
77
|
+
}(ChildProperty));
|
|
78
|
+
export { CarouselItem };
|
|
79
|
+
/** Specifies the animation configuration for carousel items. */
|
|
80
|
+
var CarouselAnimationSettings = /** @class */ (function (_super) {
|
|
81
|
+
__extends(CarouselAnimationSettings, _super);
|
|
82
|
+
function CarouselAnimationSettings() {
|
|
83
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
84
|
+
}
|
|
85
|
+
__decorate([
|
|
86
|
+
Property('Slide')
|
|
87
|
+
], CarouselAnimationSettings.prototype, "effect", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
Property()
|
|
90
|
+
], CarouselAnimationSettings.prototype, "customEffect", void 0);
|
|
91
|
+
return CarouselAnimationSettings;
|
|
92
|
+
}(ChildProperty));
|
|
93
|
+
export { CarouselAnimationSettings };
|
|
94
|
+
var Carousel = /** @class */ (function (_super) {
|
|
95
|
+
__extends(Carousel, _super);
|
|
96
|
+
/**
|
|
97
|
+
* Constructor for creating the Carousel widget
|
|
98
|
+
*
|
|
99
|
+
* @param {CarouselModel} options Accepts the carousel model properties to initiate the rendering
|
|
100
|
+
* @param {string | HTMLElement} element Accepts the DOM element reference
|
|
101
|
+
*/
|
|
102
|
+
function Carousel(options, element) {
|
|
103
|
+
return _super.call(this, options, element) || this;
|
|
104
|
+
}
|
|
105
|
+
Carousel.prototype.getModuleName = function () {
|
|
106
|
+
return CLS_CAROUSEL.replace('e-', '');
|
|
107
|
+
};
|
|
108
|
+
Carousel.prototype.getPersistData = function () {
|
|
109
|
+
return this.addOnPersist(['selectedIndex']);
|
|
110
|
+
};
|
|
111
|
+
Carousel.prototype.preRender = function () {
|
|
112
|
+
this.keyConfigs = {
|
|
113
|
+
home: 'home',
|
|
114
|
+
end: 'end',
|
|
115
|
+
space: 'space',
|
|
116
|
+
moveLeft: 'leftarrow',
|
|
117
|
+
moveRight: 'rightarrow',
|
|
118
|
+
moveUp: 'uparrow',
|
|
119
|
+
moveDown: 'downarrow'
|
|
120
|
+
};
|
|
121
|
+
var defaultLocale = {
|
|
122
|
+
nextSlide: 'Next slide',
|
|
123
|
+
of: 'of',
|
|
124
|
+
pauseSlideTransition: 'Pause slide transition',
|
|
125
|
+
playSlideTransition: 'Play slide transition',
|
|
126
|
+
previousSlide: 'Previous slide',
|
|
127
|
+
slide: 'Slide',
|
|
128
|
+
slideShow: 'Slide show'
|
|
129
|
+
};
|
|
130
|
+
this.localeObj = new L10n(this.getModuleName(), defaultLocale, this.locale);
|
|
131
|
+
};
|
|
132
|
+
Carousel.prototype.render = function () {
|
|
133
|
+
this.initialize();
|
|
134
|
+
this.renderSlides();
|
|
135
|
+
this.renderNavigators();
|
|
136
|
+
this.renderPlayButton();
|
|
137
|
+
this.renderIndicators();
|
|
138
|
+
this.applyAnimation();
|
|
139
|
+
this.wireEvents();
|
|
140
|
+
};
|
|
141
|
+
Carousel.prototype.onPropertyChanged = function (newProp, oldProp) {
|
|
142
|
+
var target;
|
|
143
|
+
for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
|
|
144
|
+
var prop = _a[_i];
|
|
145
|
+
switch (prop) {
|
|
146
|
+
case 'animation':
|
|
147
|
+
for (var _b = 0, _c = Object.keys(newProp.animation); _b < _c.length; _b++) {
|
|
148
|
+
var propName = _c[_b];
|
|
149
|
+
if (propName === 'customEffect' && !isNullOrUndefined(oldProp.animation.customEffect)) {
|
|
150
|
+
removeClass([this.element.querySelector("." + CLS_ITEMS)], oldProp.animation.customEffect);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
this.applyAnimation();
|
|
154
|
+
break;
|
|
155
|
+
case 'cssClass':
|
|
156
|
+
classList(this.element, [newProp.cssClass], [oldProp.cssClass]);
|
|
157
|
+
break;
|
|
158
|
+
case 'selectedIndex':
|
|
159
|
+
this.setActiveSlide(this.selectedIndex, oldProp.selectedIndex > this.selectedIndex ? 'Previous' : 'Next');
|
|
160
|
+
this.autoSlide();
|
|
161
|
+
break;
|
|
162
|
+
case 'htmlAttributes':
|
|
163
|
+
if (!isNullOrUndefined(this.htmlAttributes)) {
|
|
164
|
+
this.setHtmlAttributes(this.htmlAttributes, this.element);
|
|
165
|
+
}
|
|
166
|
+
break;
|
|
167
|
+
case 'enableTouchSwipe':
|
|
168
|
+
if (!this.enableTouchSwipe && this.touchModule) {
|
|
169
|
+
this.touchModule.destroy();
|
|
170
|
+
}
|
|
171
|
+
if (this.element.querySelector("." + CLS_ITEMS)) {
|
|
172
|
+
this.renderTouchActions();
|
|
173
|
+
}
|
|
174
|
+
break;
|
|
175
|
+
case 'loop':
|
|
176
|
+
if (this.loop && isNullOrUndefined(this.autoSlideInterval)) {
|
|
177
|
+
this.applySlideInterval();
|
|
178
|
+
}
|
|
179
|
+
this.handleNavigatorsActions(this.selectedIndex);
|
|
180
|
+
break;
|
|
181
|
+
case 'enableRtl':
|
|
182
|
+
if (this.enableRtl) {
|
|
183
|
+
addClass([this.element], CLS_RTL);
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
removeClass([this.element], CLS_RTL);
|
|
187
|
+
}
|
|
188
|
+
break;
|
|
189
|
+
case 'buttonsVisibility':
|
|
190
|
+
target = this.element.querySelector("." + CLS_NAVIGATORS);
|
|
191
|
+
if (target) {
|
|
192
|
+
switch (this.buttonsVisibility) {
|
|
193
|
+
case 'Hidden':
|
|
194
|
+
this.resetTemplates(['previousButtonTemplate', 'nextButtonTemplate']);
|
|
195
|
+
remove(target);
|
|
196
|
+
break;
|
|
197
|
+
case 'VisibleOnHover':
|
|
198
|
+
addClass([].slice.call(target.childNodes), CLS_HOVER_ARROWS);
|
|
199
|
+
break;
|
|
200
|
+
case 'Visible':
|
|
201
|
+
removeClass([].slice.call(target.childNodes), CLS_HOVER_ARROWS);
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
this.renderNavigators();
|
|
207
|
+
this.renderPlayButton();
|
|
208
|
+
}
|
|
209
|
+
break;
|
|
210
|
+
case 'width':
|
|
211
|
+
setStyleAttribute(this.element, { 'width': formatUnit(this.width) });
|
|
212
|
+
break;
|
|
213
|
+
case 'height':
|
|
214
|
+
setStyleAttribute(this.element, { 'height': formatUnit(this.height) });
|
|
215
|
+
break;
|
|
216
|
+
case 'autoPlay':
|
|
217
|
+
if (this.showPlayButton && isNullOrUndefined(this.playButtonTemplate)) {
|
|
218
|
+
this.playButtonClickHandler(null, true);
|
|
219
|
+
}
|
|
220
|
+
this.autoSlide();
|
|
221
|
+
break;
|
|
222
|
+
case 'interval':
|
|
223
|
+
this.autoSlide();
|
|
224
|
+
break;
|
|
225
|
+
case 'showIndicators':
|
|
226
|
+
target = this.element.querySelector("." + CLS_INDICATORS);
|
|
227
|
+
if (!this.showIndicators && target) {
|
|
228
|
+
this.resetTemplates(['indicatorsTemplate']);
|
|
229
|
+
remove(target);
|
|
230
|
+
}
|
|
231
|
+
this.renderIndicators();
|
|
232
|
+
break;
|
|
233
|
+
case 'showPlayButton':
|
|
234
|
+
target = this.element.querySelector("." + CLS_PLAY_PAUSE);
|
|
235
|
+
if (!this.showPlayButton && target) {
|
|
236
|
+
remove(target);
|
|
237
|
+
this.resetTemplates(['playButtonTemplate']);
|
|
238
|
+
}
|
|
239
|
+
this.renderPlayButton();
|
|
240
|
+
break;
|
|
241
|
+
case 'items':
|
|
242
|
+
case 'dataSource':
|
|
243
|
+
target = this.element.querySelector("." + CLS_ITEMS);
|
|
244
|
+
if (target) {
|
|
245
|
+
this.resetTemplates(['itemTemplate']);
|
|
246
|
+
remove(target);
|
|
247
|
+
}
|
|
248
|
+
this.renderSlides();
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
Carousel.prototype.initialize = function () {
|
|
254
|
+
var carouselClasses = [];
|
|
255
|
+
if (this.cssClass) {
|
|
256
|
+
carouselClasses.push(this.cssClass);
|
|
257
|
+
}
|
|
258
|
+
if (this.enableRtl) {
|
|
259
|
+
carouselClasses.push(CLS_RTL);
|
|
260
|
+
}
|
|
261
|
+
addClass([this.element], carouselClasses);
|
|
262
|
+
setStyleAttribute(this.element, { 'width': formatUnit(this.width), 'height': formatUnit(this.height) });
|
|
263
|
+
attributes(this.element, { 'tabindex': '0', 'aria-roledescription': 'carousel', 'aria-label': this.localeObj.getConstant('slideShow') });
|
|
264
|
+
if (!isNullOrUndefined(this.htmlAttributes)) {
|
|
265
|
+
this.setHtmlAttributes(this.htmlAttributes, this.element);
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
Carousel.prototype.renderSlides = function () {
|
|
269
|
+
var _this = this;
|
|
270
|
+
var itemsContainer = this.createElement('div', { className: CLS_ITEMS, attrs: { 'aria-live': this.autoPlay ? 'off' : 'polite' } });
|
|
271
|
+
this.element.appendChild(itemsContainer);
|
|
272
|
+
if (this.items.length > 0) {
|
|
273
|
+
this.slideItems = this.items;
|
|
274
|
+
this.items.forEach(function (item, index) {
|
|
275
|
+
_this.renderSlide(item, item.template, index, itemsContainer);
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
else if (this.dataSource.length > 0) {
|
|
279
|
+
this.slideItems = this.dataSource;
|
|
280
|
+
this.dataSource.forEach(function (item, index) {
|
|
281
|
+
_this.renderSlide(item, _this.itemTemplate, index, itemsContainer);
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
this.renderTemplates();
|
|
285
|
+
this.autoSlide();
|
|
286
|
+
this.renderTouchActions();
|
|
287
|
+
this.renderKeyboardActions();
|
|
288
|
+
};
|
|
289
|
+
Carousel.prototype.renderSlide = function (item, itemTemplate, index, container) {
|
|
290
|
+
var itemEle = this.createElement('div', {
|
|
291
|
+
id: getUniqueID('carousel_item'),
|
|
292
|
+
className: CLS_ITEM + " " + (item.cssClass ? item.cssClass : '') + " " + (this.selectedIndex === index ? CLS_ACTIVE : ''),
|
|
293
|
+
attrs: {
|
|
294
|
+
'aria-hidden': this.selectedIndex === index ? 'false' : 'true', 'data-index': index.toString(),
|
|
295
|
+
'aria-role': 'group', 'aria-roledescription': 'slide'
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
if (!isNullOrUndefined(item.htmlAttributes)) {
|
|
299
|
+
this.setHtmlAttributes(item.htmlAttributes, itemEle);
|
|
300
|
+
}
|
|
301
|
+
var templateId = this.element.id + '_template';
|
|
302
|
+
var template = this.templateParser(itemTemplate)(item, this, 'itemTemplate', templateId, false);
|
|
303
|
+
append(template, itemEle);
|
|
304
|
+
container.appendChild(itemEle);
|
|
305
|
+
};
|
|
306
|
+
Carousel.prototype.renderNavigators = function () {
|
|
307
|
+
if (this.buttonsVisibility === 'Hidden') {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
var navigators = this.createElement('div', { className: CLS_NAVIGATORS });
|
|
311
|
+
var itemsContainer = this.element.querySelector("." + CLS_ITEMS);
|
|
312
|
+
itemsContainer.insertAdjacentElement('afterend', navigators);
|
|
313
|
+
this.renderNavigatorButton('Previous');
|
|
314
|
+
this.renderNavigatorButton('Next');
|
|
315
|
+
this.renderTemplates();
|
|
316
|
+
};
|
|
317
|
+
Carousel.prototype.renderNavigatorButton = function (direction) {
|
|
318
|
+
var buttonContainer = this.createElement('div', {
|
|
319
|
+
className: (direction === 'Previous' ? CLS_PREVIOUS : CLS_NEXT) + ' ' + (this.buttonsVisibility === 'VisibleOnHover' ? CLS_HOVER_ARROWS : ''),
|
|
320
|
+
attrs: { 'aria-label': this.localeObj.getConstant(direction === 'Previous' ? 'previousSlide' : 'nextSlide') }
|
|
321
|
+
});
|
|
322
|
+
if (direction === 'Previous' && this.previousButtonTemplate) {
|
|
323
|
+
addClass([buttonContainer], CLS_TEMPLATE);
|
|
324
|
+
var templateId = this.element.id + '_previousButtonTemplate';
|
|
325
|
+
var template = this.templateParser(this.previousButtonTemplate)({ type: 'Previous' }, this, 'previousButtonTemplate', templateId, false);
|
|
326
|
+
append(template, buttonContainer);
|
|
327
|
+
}
|
|
328
|
+
else if (direction === 'Next' && this.nextButtonTemplate) {
|
|
329
|
+
addClass([buttonContainer], CLS_TEMPLATE);
|
|
330
|
+
var templateId = this.element.id + '_nextButtonTemplate';
|
|
331
|
+
var template = this.templateParser(this.nextButtonTemplate)({ type: 'Next' }, this, 'nextButtonTemplate', templateId, false);
|
|
332
|
+
append(template, buttonContainer);
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
var button = this.createElement('button');
|
|
336
|
+
var buttonObj = new Button({
|
|
337
|
+
cssClass: CLS_FLAT + ' ' + CLS_ROUND + ' ' + (direction === 'Previous' ? CLS_PREV_BUTTON : CLS_NEXT_BUTTON),
|
|
338
|
+
iconCss: CLS_ICON + ' ' + (direction === 'Previous' ? CLS_PREV_ICON : CLS_NEXT_ICON),
|
|
339
|
+
enableRtl: this.enableRtl,
|
|
340
|
+
disabled: !this.loop && this.selectedIndex === (direction === 'Previous' ? 0 : this.slideItems.length - 1)
|
|
341
|
+
});
|
|
342
|
+
buttonObj.appendTo(button);
|
|
343
|
+
buttonContainer.appendChild(button);
|
|
344
|
+
}
|
|
345
|
+
this.element.querySelector('.' + CLS_NAVIGATORS).appendChild(buttonContainer);
|
|
346
|
+
EventHandler.add(buttonContainer, 'click', this.navigatorClickHandler, this);
|
|
347
|
+
};
|
|
348
|
+
Carousel.prototype.renderPlayButton = function () {
|
|
349
|
+
if (this.buttonsVisibility === 'Hidden' || !this.showPlayButton) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
var playPauseWrap = this.createElement('div', {
|
|
353
|
+
className: CLS_PLAY_PAUSE + ' ' + (this.buttonsVisibility === 'VisibleOnHover' ? CLS_HOVER_ARROWS : '')
|
|
354
|
+
});
|
|
355
|
+
if (this.playButtonTemplate) {
|
|
356
|
+
addClass([playPauseWrap], CLS_TEMPLATE);
|
|
357
|
+
var templateId = this.element.id + '_playButtonTemplate';
|
|
358
|
+
var template = this.templateParser(this.playButtonTemplate)({}, this, 'playButtonTemplate', templateId, false);
|
|
359
|
+
append(template, playPauseWrap);
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
var playButton = this.createElement('button', {
|
|
363
|
+
attrs: { 'aria-label': this.localeObj.getConstant(this.autoPlay ? 'pauseSlideTransition' : 'playSlideTransition') }
|
|
364
|
+
});
|
|
365
|
+
var isLastSlide = this.selectedIndex === this.slideItems.length - 1 && !this.loop;
|
|
366
|
+
var buttonObj = new Button({
|
|
367
|
+
cssClass: CLS_FLAT + ' ' + CLS_ROUND + ' ' + CLS_PLAY_BUTTON,
|
|
368
|
+
iconCss: CLS_ICON + ' ' + (this.autoPlay && !isLastSlide ? CLS_PAUSE_ICON : CLS_PLAY_ICON),
|
|
369
|
+
isToggle: true,
|
|
370
|
+
enableRtl: this.enableRtl
|
|
371
|
+
});
|
|
372
|
+
if (isLastSlide) {
|
|
373
|
+
this.setProperties({ autoPlay: false }, true);
|
|
374
|
+
playButton.setAttribute('aria-label', this.localeObj.getConstant('playSlideTransition'));
|
|
375
|
+
var itemsContainer = this.element.querySelector("." + CLS_ITEMS);
|
|
376
|
+
itemsContainer.setAttribute('aria-live', 'polite');
|
|
377
|
+
}
|
|
378
|
+
buttonObj.appendTo(playButton);
|
|
379
|
+
playPauseWrap.appendChild(playButton);
|
|
380
|
+
}
|
|
381
|
+
var navigators = this.element.querySelector("." + CLS_NAVIGATORS);
|
|
382
|
+
navigators.insertBefore(playPauseWrap, navigators.lastElementChild);
|
|
383
|
+
this.renderTemplates();
|
|
384
|
+
EventHandler.add(playPauseWrap, 'click', this.playButtonClickHandler, this);
|
|
385
|
+
};
|
|
386
|
+
Carousel.prototype.renderIndicators = function () {
|
|
387
|
+
var _this = this;
|
|
388
|
+
if (!this.showIndicators) {
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
var indicatorWrap = this.createElement('div', { className: CLS_INDICATORS });
|
|
392
|
+
var indicatorBars = this.createElement('div', { className: CLS_INDICATOR_BARS });
|
|
393
|
+
indicatorWrap.appendChild(indicatorBars);
|
|
394
|
+
if (this.slideItems) {
|
|
395
|
+
this.slideItems.forEach(function (item, index) {
|
|
396
|
+
var indicatorBar = _this.createElement('div', {
|
|
397
|
+
className: CLS_INDICATOR_BAR + ' ' + (_this.selectedIndex === index ? CLS_ACTIVE : ''),
|
|
398
|
+
attrs: { 'data-index': index.toString(), 'aria-current': _this.selectedIndex === index ? 'true' : 'false' }
|
|
399
|
+
});
|
|
400
|
+
if (_this.indicatorsTemplate) {
|
|
401
|
+
addClass([indicatorBar], CLS_TEMPLATE);
|
|
402
|
+
var templateId = _this.element.id + '_indicatorsTemplate';
|
|
403
|
+
var template = _this.templateParser(_this.indicatorsTemplate)({ index: index, selectedIndex: _this.selectedIndex }, _this, 'indicatorsTemplate', templateId, false);
|
|
404
|
+
append(template, indicatorBar);
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
var indicator = _this.createElement('button', { className: CLS_INDICATOR });
|
|
408
|
+
indicatorBar.appendChild(indicator);
|
|
409
|
+
indicator.appendChild(_this.createElement('div', {
|
|
410
|
+
attrs: {
|
|
411
|
+
'aria-label': _this.localeObj.getConstant('slide') + ' ' + (index + 1) + ' ' + _this.localeObj.getConstant('of') + ' ' + _this.slideItems.length
|
|
412
|
+
}
|
|
413
|
+
}));
|
|
414
|
+
var buttonObj = new Button({ cssClass: 'e-flat e-small' });
|
|
415
|
+
buttonObj.appendTo(indicator);
|
|
416
|
+
}
|
|
417
|
+
indicatorBars.appendChild(indicatorBar);
|
|
418
|
+
EventHandler.add(indicatorBar, 'click', _this.indicatorClickHandler, _this);
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
this.element.appendChild(indicatorWrap);
|
|
422
|
+
};
|
|
423
|
+
Carousel.prototype.renderKeyboardActions = function () {
|
|
424
|
+
this.keyModule = new KeyboardEvents(this.element, { keyAction: this.keyHandler.bind(this), keyConfigs: this.keyConfigs });
|
|
425
|
+
};
|
|
426
|
+
Carousel.prototype.renderTouchActions = function () {
|
|
427
|
+
if (!this.enableTouchSwipe) {
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
this.touchModule = new Touch(this.element, { swipe: this.swipeHandler.bind(this) });
|
|
431
|
+
};
|
|
432
|
+
Carousel.prototype.applyAnimation = function () {
|
|
433
|
+
var animationTarget = this.element.querySelector("." + CLS_ITEMS);
|
|
434
|
+
removeClass([animationTarget], [CLS_FADE_ANIMATION, CLS_SLIDE_ANIMATION]);
|
|
435
|
+
if (this.animation.customEffect) {
|
|
436
|
+
addClass([animationTarget], this.animation.customEffect);
|
|
437
|
+
}
|
|
438
|
+
else if (this.animation.effect !== 'None') {
|
|
439
|
+
var animationClass = this.animation.effect === 'Fade' ? CLS_FADE_ANIMATION : CLS_SLIDE_ANIMATION;
|
|
440
|
+
addClass([animationTarget], animationClass);
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
Carousel.prototype.autoSlide = function () {
|
|
444
|
+
this.resetSlideInterval();
|
|
445
|
+
this.applySlideInterval();
|
|
446
|
+
};
|
|
447
|
+
Carousel.prototype.autoSlideChange = function () {
|
|
448
|
+
var activeSlide = this.element.querySelector("." + CLS_ACTIVE);
|
|
449
|
+
if (isNullOrUndefined(activeSlide)) {
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
var activeIndex = parseInt(activeSlide.dataset.index, 10);
|
|
453
|
+
if (!this.loop && activeIndex === this.slideItems.length - 1) {
|
|
454
|
+
this.resetSlideInterval();
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
var index = (activeIndex + 1) % this.slideItems.length;
|
|
458
|
+
if (!this.element.classList.contains(CLS_HOVER)) {
|
|
459
|
+
this.setActiveSlide(index, 'Next');
|
|
460
|
+
}
|
|
461
|
+
this.autoSlide();
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
Carousel.prototype.applySlideInterval = function () {
|
|
465
|
+
var _this = this;
|
|
466
|
+
if (!this.autoPlay || this.element.classList.contains(CLS_HOVER)) {
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
var itemInterval = this.interval;
|
|
470
|
+
if (this.items.length > 0 && !isNullOrUndefined(this.items[this.selectedIndex].interval)) {
|
|
471
|
+
itemInterval = this.items[this.selectedIndex].interval;
|
|
472
|
+
}
|
|
473
|
+
this.autoSlideInterval = setInterval(function () { return _this.autoSlideChange(); }, itemInterval);
|
|
474
|
+
};
|
|
475
|
+
Carousel.prototype.resetSlideInterval = function () {
|
|
476
|
+
clearInterval(this.autoSlideInterval);
|
|
477
|
+
this.autoSlideInterval = null;
|
|
478
|
+
};
|
|
479
|
+
Carousel.prototype.getSlideIndex = function (direction) {
|
|
480
|
+
var currentIndex = this.selectedIndex;
|
|
481
|
+
if (direction === 'Previous') {
|
|
482
|
+
currentIndex--;
|
|
483
|
+
if (currentIndex < 0) {
|
|
484
|
+
currentIndex = this.slideItems.length - 1;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
currentIndex++;
|
|
489
|
+
if (currentIndex === this.slideItems.length) {
|
|
490
|
+
currentIndex = 0;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return currentIndex;
|
|
494
|
+
};
|
|
495
|
+
Carousel.prototype.setActiveSlide = function (currentIndex, direction, isSwiped) {
|
|
496
|
+
var _this = this;
|
|
497
|
+
if (isSwiped === void 0) { isSwiped = false; }
|
|
498
|
+
if (this.element.querySelectorAll("." + CLS_ITEM + "." + CLS_PREV_SLIDE + ",." + CLS_ITEM + "." + CLS_NEXT_SLIDE).length > 0) {
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
var allSlides = [].slice.call(this.element.querySelectorAll("." + CLS_ITEM));
|
|
502
|
+
var activeSlide = this.element.querySelector("." + CLS_ITEM + "." + CLS_ACTIVE);
|
|
503
|
+
if (isNullOrUndefined(activeSlide) && this.showIndicators) {
|
|
504
|
+
var activeIndicator = this.element.querySelector("." + CLS_INDICATOR_BAR + "." + CLS_ACTIVE);
|
|
505
|
+
var activeIndex_1 = parseInt(activeIndicator.dataset.index, 10);
|
|
506
|
+
addClass([allSlides[activeIndex_1]], CLS_ACTIVE);
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
else if (isNullOrUndefined(activeSlide)) {
|
|
510
|
+
addClass([allSlides[currentIndex]], CLS_ACTIVE);
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
var activeIndex = parseInt(activeSlide.dataset.index, 10);
|
|
514
|
+
var currentSlide = allSlides[currentIndex];
|
|
515
|
+
var eventArgs = {
|
|
516
|
+
currentIndex: activeIndex,
|
|
517
|
+
nextIndex: currentIndex,
|
|
518
|
+
currentSlide: activeSlide,
|
|
519
|
+
nextSlide: currentSlide,
|
|
520
|
+
slideDirection: direction,
|
|
521
|
+
isSwiped: isSwiped,
|
|
522
|
+
cancel: false
|
|
523
|
+
};
|
|
524
|
+
this.trigger('slideChanging', eventArgs, function (args) {
|
|
525
|
+
if (args.cancel) {
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
_this.setProperties({ selectedIndex: currentIndex }, true);
|
|
529
|
+
attributes(args.currentSlide, { 'aria-hidden': 'true' });
|
|
530
|
+
attributes(args.nextSlide, { 'aria-hidden': 'false' });
|
|
531
|
+
var slideIndicators = [].slice.call(_this.element.querySelectorAll("." + CLS_INDICATOR_BAR));
|
|
532
|
+
if (slideIndicators.length > 0) {
|
|
533
|
+
attributes(slideIndicators[activeIndex], { 'aria-current': 'false' });
|
|
534
|
+
attributes(slideIndicators[currentIndex], { 'aria-current': 'true' });
|
|
535
|
+
removeClass(slideIndicators, CLS_ACTIVE);
|
|
536
|
+
addClass([slideIndicators[currentIndex]], CLS_ACTIVE);
|
|
537
|
+
}
|
|
538
|
+
_this.slideChangedEventArgs = {
|
|
539
|
+
currentIndex: args.nextIndex,
|
|
540
|
+
previousIndex: args.currentIndex,
|
|
541
|
+
currentSlide: args.nextSlide,
|
|
542
|
+
previousSlide: args.currentSlide,
|
|
543
|
+
slideDirection: direction,
|
|
544
|
+
isSwiped: isSwiped
|
|
545
|
+
};
|
|
546
|
+
var slideHeight;
|
|
547
|
+
if (_this.animation.effect === 'None' || _this.animation.customEffect) {
|
|
548
|
+
_this.onTransitionEnd();
|
|
549
|
+
}
|
|
550
|
+
else if (_this.animation.effect === 'Slide') {
|
|
551
|
+
if (direction === 'Previous') {
|
|
552
|
+
addClass([args.nextSlide], CLS_PREV_SLIDE);
|
|
553
|
+
slideHeight = args.nextSlide.offsetHeight;
|
|
554
|
+
addClass([args.currentSlide, args.nextSlide], CLS_TRANSITION_END);
|
|
555
|
+
}
|
|
556
|
+
else {
|
|
557
|
+
addClass([args.nextSlide], CLS_NEXT_SLIDE);
|
|
558
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
559
|
+
slideHeight = args.nextSlide.offsetHeight;
|
|
560
|
+
addClass([args.currentSlide, args.nextSlide], CLS_TRANSITION_START);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
else if (_this.animation.effect === 'Fade') {
|
|
564
|
+
removeClass([args.currentSlide], CLS_ACTIVE);
|
|
565
|
+
addClass([args.nextSlide], CLS_ACTIVE);
|
|
566
|
+
}
|
|
567
|
+
_this.handleNavigatorsActions(currentIndex);
|
|
568
|
+
});
|
|
569
|
+
};
|
|
570
|
+
Carousel.prototype.onTransitionEnd = function () {
|
|
571
|
+
var _this = this;
|
|
572
|
+
if (this.slideChangedEventArgs) {
|
|
573
|
+
addClass([this.slideChangedEventArgs.currentSlide], CLS_ACTIVE);
|
|
574
|
+
removeClass([this.slideChangedEventArgs.previousSlide], CLS_ACTIVE);
|
|
575
|
+
this.trigger('slideChanged', this.slideChangedEventArgs, function () {
|
|
576
|
+
removeClass(_this.element.querySelectorAll("." + CLS_ITEM), [CLS_PREV_SLIDE, CLS_NEXT_SLIDE, CLS_TRANSITION_START, CLS_TRANSITION_END]);
|
|
577
|
+
_this.slideChangedEventArgs = null;
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
Carousel.prototype.setHtmlAttributes = function (attribute, element) {
|
|
582
|
+
var keys = Object.keys(attribute);
|
|
583
|
+
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
|
|
584
|
+
var key = keys_1[_i];
|
|
585
|
+
if (key === 'class') {
|
|
586
|
+
addClass([element], attribute[key]);
|
|
587
|
+
}
|
|
588
|
+
else {
|
|
589
|
+
element.setAttribute(key, attribute[key]);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
Carousel.prototype.templateParser = function (template) {
|
|
594
|
+
if (template) {
|
|
595
|
+
try {
|
|
596
|
+
if (document.querySelectorAll(template).length) {
|
|
597
|
+
return compile(document.querySelector(template).innerHTML.trim());
|
|
598
|
+
}
|
|
599
|
+
else {
|
|
600
|
+
return compile(template);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
catch (error) {
|
|
604
|
+
return compile(template);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
return undefined;
|
|
608
|
+
};
|
|
609
|
+
Carousel.prototype.getNavigatorState = function (target, isPrevious) {
|
|
610
|
+
var button = target.querySelector("." + (isPrevious ? CLS_PREV_BUTTON : CLS_NEXT_BUTTON));
|
|
611
|
+
if (button) {
|
|
612
|
+
var buttonObj = getInstance(button, Button);
|
|
613
|
+
return buttonObj.disabled;
|
|
614
|
+
}
|
|
615
|
+
return false;
|
|
616
|
+
};
|
|
617
|
+
Carousel.prototype.navigatorClickHandler = function (e) {
|
|
618
|
+
var target = e.currentTarget;
|
|
619
|
+
var isDisabled = this.getNavigatorState(target, target.classList.contains(CLS_PREVIOUS));
|
|
620
|
+
if (isDisabled) {
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
var direction = target.classList.contains(CLS_PREVIOUS) ? 'Previous' : 'Next';
|
|
624
|
+
this.setActiveSlide(this.getSlideIndex(direction), direction);
|
|
625
|
+
this.autoSlide();
|
|
626
|
+
};
|
|
627
|
+
Carousel.prototype.indicatorClickHandler = function (e) {
|
|
628
|
+
var target = closest(e.target, "." + CLS_INDICATOR_BAR);
|
|
629
|
+
var index = parseInt(target.dataset.index, 10);
|
|
630
|
+
if (this.selectedIndex !== index) {
|
|
631
|
+
this.setActiveSlide(index, this.selectedIndex > index ? 'Previous' : 'Next');
|
|
632
|
+
this.autoSlide();
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
Carousel.prototype.playButtonClickHandler = function (e, isPropertyChange) {
|
|
636
|
+
if (isPropertyChange === void 0) { isPropertyChange = false; }
|
|
637
|
+
var playButton = this.element.querySelector("." + CLS_PLAY_BUTTON);
|
|
638
|
+
if (playButton) {
|
|
639
|
+
var buttonObj = getInstance(playButton, Button);
|
|
640
|
+
if (!isPropertyChange) {
|
|
641
|
+
this.setProperties({ autoPlay: !this.autoPlay }, true);
|
|
642
|
+
}
|
|
643
|
+
playButton.setAttribute('aria-label', this.localeObj.getConstant(this.autoPlay ? 'pauseSlideTransition' : 'playSlideTransition'));
|
|
644
|
+
buttonObj.iconCss = CLS_ICON + ' ' + (this.autoPlay ? CLS_PAUSE_ICON : CLS_PLAY_ICON);
|
|
645
|
+
buttonObj.dataBind();
|
|
646
|
+
var itemsContainer = this.element.querySelector("." + CLS_ITEMS);
|
|
647
|
+
itemsContainer.setAttribute('aria-live', this.autoPlay ? 'off' : 'polite');
|
|
648
|
+
if (this.autoPlay && !this.loop && this.selectedIndex === this.slideItems.length - 1) {
|
|
649
|
+
this.setActiveSlide(0, 'Next');
|
|
650
|
+
}
|
|
651
|
+
this.autoSlide();
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
Carousel.prototype.keyHandler = function (e) {
|
|
655
|
+
var direction;
|
|
656
|
+
var slideIndex;
|
|
657
|
+
var isSlideTransition = false;
|
|
658
|
+
var target = e.target;
|
|
659
|
+
e.preventDefault();
|
|
660
|
+
switch (e.action) {
|
|
661
|
+
case 'space':
|
|
662
|
+
if (this.showIndicators && target.classList.contains(CLS_INDICATOR)) {
|
|
663
|
+
target.click();
|
|
664
|
+
}
|
|
665
|
+
else if (target.classList.contains(CLS_CAROUSEL) || target.classList.contains(CLS_PLAY_BUTTON)) {
|
|
666
|
+
this.playButtonClickHandler(e);
|
|
667
|
+
}
|
|
668
|
+
else if (target.classList.contains(CLS_NEXT_BUTTON)) {
|
|
669
|
+
this.next();
|
|
670
|
+
}
|
|
671
|
+
else if (target.classList.contains(CLS_PREV_BUTTON)) {
|
|
672
|
+
this.prev();
|
|
673
|
+
}
|
|
674
|
+
break;
|
|
675
|
+
case 'end':
|
|
676
|
+
slideIndex = this.slideItems.length - 1;
|
|
677
|
+
direction = 'Next';
|
|
678
|
+
isSlideTransition = true;
|
|
679
|
+
break;
|
|
680
|
+
case 'home':
|
|
681
|
+
slideIndex = 0;
|
|
682
|
+
direction = 'Previous';
|
|
683
|
+
isSlideTransition = true;
|
|
684
|
+
break;
|
|
685
|
+
case 'moveUp':
|
|
686
|
+
case 'moveLeft':
|
|
687
|
+
case 'moveDown':
|
|
688
|
+
case 'moveRight':
|
|
689
|
+
if (this.showIndicators && isNullOrUndefined(this.indicatorsTemplate)) {
|
|
690
|
+
this.element.focus();
|
|
691
|
+
}
|
|
692
|
+
direction = (e.action === 'moveUp' || e.action === 'moveLeft') ? 'Previous' : 'Next';
|
|
693
|
+
slideIndex = this.getSlideIndex(direction);
|
|
694
|
+
isSlideTransition = !this.isSuspendSlideTransition(slideIndex, direction);
|
|
695
|
+
break;
|
|
696
|
+
}
|
|
697
|
+
if (isSlideTransition) {
|
|
698
|
+
this.setActiveSlide(slideIndex, direction);
|
|
699
|
+
this.autoSlide();
|
|
700
|
+
isSlideTransition = false;
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
Carousel.prototype.swipeHandler = function (e) {
|
|
704
|
+
if (this.element.classList.contains(CLS_HOVER)) {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
var direction = (e.swipeDirection === 'Right') ? 'Previous' : 'Next';
|
|
708
|
+
var slideIndex = this.getSlideIndex(direction);
|
|
709
|
+
if (!this.isSuspendSlideTransition(slideIndex, direction)) {
|
|
710
|
+
this.setActiveSlide(slideIndex, direction, true);
|
|
711
|
+
this.autoSlide();
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
Carousel.prototype.isSuspendSlideTransition = function (index, direction) {
|
|
715
|
+
return !this.loop && (direction === 'Next' && index === 0 || direction === 'Previous' && index === this.slideItems.length - 1);
|
|
716
|
+
};
|
|
717
|
+
Carousel.prototype.handleNavigatorsActions = function (index) {
|
|
718
|
+
if (this.buttonsVisibility === 'Hidden') {
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
if (this.showPlayButton) {
|
|
722
|
+
var playButton = this.element.querySelector("." + CLS_PLAY_BUTTON);
|
|
723
|
+
var isLastSlide = this.selectedIndex === this.slideItems.length - 1 && !this.loop;
|
|
724
|
+
var isButtonUpdate = isNullOrUndefined(this.playButtonTemplate) && playButton && isLastSlide;
|
|
725
|
+
if (isNullOrUndefined(this.playButtonTemplate) && playButton && !isLastSlide) {
|
|
726
|
+
isButtonUpdate = !playButton.classList.contains(CLS_ACTIVE);
|
|
727
|
+
}
|
|
728
|
+
if (isButtonUpdate) {
|
|
729
|
+
this.setProperties({ autoPlay: !isLastSlide }, true);
|
|
730
|
+
playButton.setAttribute('aria-label', this.localeObj.getConstant(this.autoPlay ? 'pauseSlideTransition' : 'playSlideTransition'));
|
|
731
|
+
var itemsContainer = this.element.querySelector("." + CLS_ITEMS);
|
|
732
|
+
itemsContainer.setAttribute('aria-live', this.autoPlay ? 'off' : 'polite');
|
|
733
|
+
var buttonObj = getInstance(playButton, Button);
|
|
734
|
+
buttonObj.iconCss = CLS_ICON + ' ' + (this.autoPlay ? CLS_PAUSE_ICON : CLS_PLAY_ICON);
|
|
735
|
+
buttonObj.dataBind();
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
var prevButton = this.element.querySelector("." + CLS_PREV_BUTTON);
|
|
739
|
+
if (prevButton && isNullOrUndefined(this.previousButtonTemplate)) {
|
|
740
|
+
var buttonObj = getInstance(prevButton, Button);
|
|
741
|
+
buttonObj.disabled = !this.loop && index === 0;
|
|
742
|
+
buttonObj.dataBind();
|
|
743
|
+
}
|
|
744
|
+
var nextButton = this.element.querySelector("." + CLS_NEXT_BUTTON);
|
|
745
|
+
if (nextButton && isNullOrUndefined(this.nextButtonTemplate)) {
|
|
746
|
+
var buttonObj = getInstance(nextButton, Button);
|
|
747
|
+
buttonObj.disabled = !this.loop && index === this.slideItems.length - 1;
|
|
748
|
+
buttonObj.dataBind();
|
|
749
|
+
}
|
|
750
|
+
};
|
|
751
|
+
Carousel.prototype.onHoverActions = function (e) {
|
|
752
|
+
var navigator = this.element.querySelector("." + CLS_NAVIGATORS);
|
|
753
|
+
switch (e.type) {
|
|
754
|
+
case 'mouseenter':
|
|
755
|
+
if (this.buttonsVisibility === 'VisibleOnHover' && navigator) {
|
|
756
|
+
removeClass([].slice.call(navigator.childNodes), CLS_HOVER_ARROWS);
|
|
757
|
+
}
|
|
758
|
+
addClass([this.element], CLS_HOVER);
|
|
759
|
+
break;
|
|
760
|
+
case 'mouseleave':
|
|
761
|
+
if (this.buttonsVisibility === 'VisibleOnHover' && navigator) {
|
|
762
|
+
addClass([].slice.call(navigator.childNodes), CLS_HOVER_ARROWS);
|
|
763
|
+
}
|
|
764
|
+
removeClass([this.element], CLS_HOVER);
|
|
765
|
+
break;
|
|
766
|
+
}
|
|
767
|
+
this.autoSlide();
|
|
768
|
+
};
|
|
769
|
+
Carousel.prototype.onFocusActions = function (e) {
|
|
770
|
+
switch (e.type) {
|
|
771
|
+
case 'focusin':
|
|
772
|
+
addClass([this.element], CLS_HOVER);
|
|
773
|
+
break;
|
|
774
|
+
case 'focusout':
|
|
775
|
+
removeClass([this.element], CLS_HOVER);
|
|
776
|
+
break;
|
|
777
|
+
}
|
|
778
|
+
this.autoSlide();
|
|
779
|
+
};
|
|
780
|
+
Carousel.prototype.destroyButtons = function () {
|
|
781
|
+
var buttonCollections = [].slice.call(this.element.querySelectorAll('.e-control.e-btn'));
|
|
782
|
+
for (var _i = 0, buttonCollections_1 = buttonCollections; _i < buttonCollections_1.length; _i++) {
|
|
783
|
+
var button = buttonCollections_1[_i];
|
|
784
|
+
var instance = getInstance(button, Button);
|
|
785
|
+
if (instance) {
|
|
786
|
+
instance.destroy();
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
Carousel.prototype.wireEvents = function () {
|
|
791
|
+
EventHandler.add(this.element, 'focusin focusout', this.onFocusActions, this);
|
|
792
|
+
EventHandler.add(this.element, 'mouseenter mouseleave', this.onHoverActions, this);
|
|
793
|
+
EventHandler.add(this.element.firstElementChild, 'transitionend', this.onTransitionEnd, this);
|
|
794
|
+
};
|
|
795
|
+
Carousel.prototype.unWireEvents = function () {
|
|
796
|
+
var _this = this;
|
|
797
|
+
var indicators = [].slice.call(this.element.querySelectorAll("." + CLS_INDICATOR_BAR));
|
|
798
|
+
indicators.forEach(function (indicator) {
|
|
799
|
+
EventHandler.remove(indicator, 'click', _this.indicatorClickHandler);
|
|
800
|
+
});
|
|
801
|
+
var navigators = [].slice.call(this.element.querySelectorAll("." + CLS_PREVIOUS + ",." + CLS_NEXT));
|
|
802
|
+
navigators.forEach(function (navigator) {
|
|
803
|
+
EventHandler.remove(navigator, 'click', _this.navigatorClickHandler);
|
|
804
|
+
});
|
|
805
|
+
var playIcon = this.element.querySelector("." + CLS_PLAY_PAUSE);
|
|
806
|
+
if (playIcon) {
|
|
807
|
+
EventHandler.remove(playIcon, 'click', this.playButtonClickHandler);
|
|
808
|
+
}
|
|
809
|
+
EventHandler.remove(this.element.firstElementChild, 'transitionend', this.onTransitionEnd);
|
|
810
|
+
EventHandler.clearEvents(this.element);
|
|
811
|
+
};
|
|
812
|
+
/**
|
|
813
|
+
* Method to transit from the current slide to the previous slide.
|
|
814
|
+
*
|
|
815
|
+
* @returns {void}
|
|
816
|
+
*/
|
|
817
|
+
Carousel.prototype.prev = function () {
|
|
818
|
+
if (!this.loop && this.selectedIndex === 0) {
|
|
819
|
+
return;
|
|
820
|
+
}
|
|
821
|
+
var index = (this.selectedIndex === 0) ? this.slideItems.length - 1 : this.selectedIndex - 1;
|
|
822
|
+
this.setActiveSlide(index, 'Previous');
|
|
823
|
+
this.autoSlide();
|
|
824
|
+
};
|
|
825
|
+
/**
|
|
826
|
+
* Method to transit from the current slide to the next slide.
|
|
827
|
+
*
|
|
828
|
+
* @returns {void}
|
|
829
|
+
*/
|
|
830
|
+
Carousel.prototype.next = function () {
|
|
831
|
+
if (!this.loop && this.selectedIndex === this.slideItems.length - 1) {
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
var index = (this.selectedIndex === this.slideItems.length - 1) ? 0 : this.selectedIndex + 1;
|
|
835
|
+
this.setActiveSlide(index, 'Next');
|
|
836
|
+
this.autoSlide();
|
|
837
|
+
};
|
|
838
|
+
/**
|
|
839
|
+
* Method to play the slides programmatically.
|
|
840
|
+
*
|
|
841
|
+
* @returns {void}
|
|
842
|
+
*/
|
|
843
|
+
Carousel.prototype.play = function () {
|
|
844
|
+
var playIcon = this.element.querySelector("." + CLS_PLAY_ICON);
|
|
845
|
+
if (this.showPlayButton && playIcon) {
|
|
846
|
+
classList(playIcon, [CLS_PAUSE_ICON], [CLS_PLAY_ICON]);
|
|
847
|
+
var playButton = this.element.querySelector("." + CLS_PLAY_BUTTON);
|
|
848
|
+
playButton.setAttribute('aria-label', this.localeObj.getConstant('pauseSlideTransition'));
|
|
849
|
+
}
|
|
850
|
+
this.setProperties({ autoPlay: true }, true);
|
|
851
|
+
var itemsContainer = this.element.querySelector("." + CLS_ITEMS);
|
|
852
|
+
itemsContainer.setAttribute('aria-live', 'off');
|
|
853
|
+
this.applySlideInterval();
|
|
854
|
+
};
|
|
855
|
+
/**
|
|
856
|
+
* Method to pause the slides programmatically.
|
|
857
|
+
*
|
|
858
|
+
* @returns {void}
|
|
859
|
+
*/
|
|
860
|
+
Carousel.prototype.pause = function () {
|
|
861
|
+
var pauseIcon = this.element.querySelector("." + CLS_PAUSE_ICON);
|
|
862
|
+
if (this.showPlayButton && pauseIcon) {
|
|
863
|
+
var playButton = this.element.querySelector("." + CLS_PLAY_BUTTON);
|
|
864
|
+
playButton.setAttribute('aria-label', this.localeObj.getConstant('playSlideTransition'));
|
|
865
|
+
classList(pauseIcon, [CLS_PLAY_ICON], [CLS_PAUSE_ICON]);
|
|
866
|
+
}
|
|
867
|
+
this.setProperties({ autoPlay: false }, true);
|
|
868
|
+
var itemsContainer = this.element.querySelector("." + CLS_ITEMS);
|
|
869
|
+
itemsContainer.setAttribute('aria-live', 'off');
|
|
870
|
+
this.resetSlideInterval();
|
|
871
|
+
};
|
|
872
|
+
/**
|
|
873
|
+
* Method to render react and angular templates
|
|
874
|
+
*
|
|
875
|
+
* @returns {void}
|
|
876
|
+
* @private
|
|
877
|
+
*/
|
|
878
|
+
Carousel.prototype.renderTemplates = function () {
|
|
879
|
+
if (this.isAngular || this.isReact) {
|
|
880
|
+
this.renderReactTemplates();
|
|
881
|
+
}
|
|
882
|
+
};
|
|
883
|
+
/**
|
|
884
|
+
* Method to reset react and angular templates
|
|
885
|
+
*
|
|
886
|
+
* @param {string[]} templates Accepts the template ID
|
|
887
|
+
* @returns {void}
|
|
888
|
+
* @private
|
|
889
|
+
*/
|
|
890
|
+
Carousel.prototype.resetTemplates = function (templates) {
|
|
891
|
+
if (this.isAngular || this.isReact) {
|
|
892
|
+
this.clearTemplate(templates);
|
|
893
|
+
}
|
|
894
|
+
};
|
|
895
|
+
/**
|
|
896
|
+
* Method for destroy the carousel component.
|
|
897
|
+
*
|
|
898
|
+
* @returns {void}
|
|
899
|
+
*/
|
|
900
|
+
Carousel.prototype.destroy = function () {
|
|
901
|
+
var _this = this;
|
|
902
|
+
this.resetTemplates();
|
|
903
|
+
if (this.touchModule) {
|
|
904
|
+
this.touchModule.destroy();
|
|
905
|
+
this.touchModule = null;
|
|
906
|
+
}
|
|
907
|
+
this.keyModule.destroy();
|
|
908
|
+
this.keyModule = null;
|
|
909
|
+
this.resetSlideInterval();
|
|
910
|
+
this.destroyButtons();
|
|
911
|
+
this.unWireEvents();
|
|
912
|
+
[].slice.call(this.element.children).forEach(function (ele) { _this.element.removeChild(ele); });
|
|
913
|
+
removeClass([this.element], [CLS_CAROUSEL, this.cssClass, CLS_RTL]);
|
|
914
|
+
['tabindex', 'role', 'style'].forEach(function (attr) { _this.element.removeAttribute(attr); });
|
|
915
|
+
_super.prototype.destroy.call(this);
|
|
916
|
+
};
|
|
917
|
+
__decorate([
|
|
918
|
+
Collection([], CarouselItem)
|
|
919
|
+
], Carousel.prototype, "items", void 0);
|
|
920
|
+
__decorate([
|
|
921
|
+
Complex({}, CarouselAnimationSettings)
|
|
922
|
+
], Carousel.prototype, "animation", void 0);
|
|
923
|
+
__decorate([
|
|
924
|
+
Property()
|
|
925
|
+
], Carousel.prototype, "previousButtonTemplate", void 0);
|
|
926
|
+
__decorate([
|
|
927
|
+
Property()
|
|
928
|
+
], Carousel.prototype, "nextButtonTemplate", void 0);
|
|
929
|
+
__decorate([
|
|
930
|
+
Property()
|
|
931
|
+
], Carousel.prototype, "indicatorsTemplate", void 0);
|
|
932
|
+
__decorate([
|
|
933
|
+
Property()
|
|
934
|
+
], Carousel.prototype, "playButtonTemplate", void 0);
|
|
935
|
+
__decorate([
|
|
936
|
+
Property()
|
|
937
|
+
], Carousel.prototype, "cssClass", void 0);
|
|
938
|
+
__decorate([
|
|
939
|
+
Property([])
|
|
940
|
+
], Carousel.prototype, "dataSource", void 0);
|
|
941
|
+
__decorate([
|
|
942
|
+
Property()
|
|
943
|
+
], Carousel.prototype, "itemTemplate", void 0);
|
|
944
|
+
__decorate([
|
|
945
|
+
Property(0)
|
|
946
|
+
], Carousel.prototype, "selectedIndex", void 0);
|
|
947
|
+
__decorate([
|
|
948
|
+
Property('100%')
|
|
949
|
+
], Carousel.prototype, "width", void 0);
|
|
950
|
+
__decorate([
|
|
951
|
+
Property('100%')
|
|
952
|
+
], Carousel.prototype, "height", void 0);
|
|
953
|
+
__decorate([
|
|
954
|
+
Property(5000)
|
|
955
|
+
], Carousel.prototype, "interval", void 0);
|
|
956
|
+
__decorate([
|
|
957
|
+
Property(true)
|
|
958
|
+
], Carousel.prototype, "autoPlay", void 0);
|
|
959
|
+
__decorate([
|
|
960
|
+
Property(true)
|
|
961
|
+
], Carousel.prototype, "loop", void 0);
|
|
962
|
+
__decorate([
|
|
963
|
+
Property(false)
|
|
964
|
+
], Carousel.prototype, "showPlayButton", void 0);
|
|
965
|
+
__decorate([
|
|
966
|
+
Property(true)
|
|
967
|
+
], Carousel.prototype, "enableTouchSwipe", void 0);
|
|
968
|
+
__decorate([
|
|
969
|
+
Property(true)
|
|
970
|
+
], Carousel.prototype, "showIndicators", void 0);
|
|
971
|
+
__decorate([
|
|
972
|
+
Property('Visible')
|
|
973
|
+
], Carousel.prototype, "buttonsVisibility", void 0);
|
|
974
|
+
__decorate([
|
|
975
|
+
Property()
|
|
976
|
+
], Carousel.prototype, "htmlAttributes", void 0);
|
|
977
|
+
__decorate([
|
|
978
|
+
Event()
|
|
979
|
+
], Carousel.prototype, "slideChanging", void 0);
|
|
980
|
+
__decorate([
|
|
981
|
+
Event()
|
|
982
|
+
], Carousel.prototype, "slideChanged", void 0);
|
|
983
|
+
Carousel = __decorate([
|
|
984
|
+
NotifyPropertyChanges
|
|
985
|
+
], Carousel);
|
|
986
|
+
return Carousel;
|
|
987
|
+
}(Component));
|
|
988
|
+
export { Carousel };
|