@syncfusion/ej2-navigations 21.2.9 → 22.1.34
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/.eslintrc.json +1 -0
- package/CHANGELOG.md +9 -0
- package/dist/ej2-navigations.min.js +2 -2
- 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 +288 -93
- package/dist/es6/ej2-navigations.es2015.js.map +1 -1
- package/dist/es6/ej2-navigations.es5.js +292 -94
- 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-model.d.ts +4 -2
- package/src/accordion/accordion.d.ts +4 -2
- package/src/accordion/accordion.js +1 -1
- package/src/breadcrumb/breadcrumb-model.d.ts +4 -2
- package/src/breadcrumb/breadcrumb.d.ts +4 -2
- package/src/carousel/carousel-model.d.ts +37 -8
- package/src/carousel/carousel.d.ts +69 -6
- package/src/carousel/carousel.js +287 -89
- package/src/common/menu-base-model.d.ts +2 -1
- package/src/common/menu-base.d.ts +2 -1
- package/src/common/menu-base.js +2 -2
- package/src/menu/menu-model.d.ts +3 -2
- package/src/menu/menu.d.ts +2 -1
- package/src/menu/menu.js +1 -1
- package/src/sidebar/sidebar.d.ts +12 -26
- package/src/tab/tab-model.d.ts +3 -2
- package/src/tab/tab.d.ts +3 -2
- package/src/toolbar/toolbar-model.d.ts +3 -1
- package/src/toolbar/toolbar.d.ts +3 -1
- package/src/treeview/treeview-model.d.ts +4 -1
- package/src/treeview/treeview.d.ts +17 -31
- package/src/treeview/treeview.js +1 -1
- package/styles/accordion/_bootstrap-dark-definition.scss +3 -1
- package/styles/accordion/_bootstrap-definition.scss +3 -1
- package/styles/accordion/_bootstrap4-definition.scss +2 -0
- package/styles/accordion/_bootstrap5-definition.scss +3 -1
- package/styles/accordion/_fabric-dark-definition.scss +2 -0
- package/styles/accordion/_fabric-definition.scss +2 -0
- package/styles/accordion/_fluent-definition.scss +2 -0
- package/styles/accordion/_fusionnew-definition.scss +2 -0
- package/styles/accordion/_highcontrast-definition.scss +2 -0
- package/styles/accordion/_highcontrast-light-definition.scss +2 -0
- package/styles/accordion/_layout.scss +9 -0
- package/styles/accordion/_material-dark-definition.scss +2 -0
- package/styles/accordion/_material-definition.scss +2 -0
- package/styles/accordion/_material3-dark-definition.scss +1 -0
- package/styles/accordion/_material3-definition.scss +182 -0
- package/styles/accordion/_tailwind-definition.scss +2 -0
- package/styles/accordion/_theme.scss +9 -0
- package/styles/accordion/bootstrap-dark.css +11 -1
- package/styles/accordion/bootstrap.css +11 -1
- package/styles/accordion/bootstrap4.css +10 -0
- package/styles/accordion/bootstrap5-dark.css +11 -1
- package/styles/accordion/bootstrap5.css +11 -1
- package/styles/accordion/fabric-dark.css +10 -0
- package/styles/accordion/fabric.css +10 -0
- package/styles/accordion/fluent-dark.css +10 -0
- package/styles/accordion/fluent.css +10 -0
- package/styles/accordion/highcontrast-light.css +10 -0
- package/styles/accordion/highcontrast.css +10 -0
- package/styles/accordion/icons/_material3-dark.scss +1 -0
- package/styles/accordion/material-dark.css +10 -0
- package/styles/accordion/material.css +10 -0
- package/styles/accordion/material3-dark.css +596 -0
- package/styles/accordion/material3-dark.scss +5 -0
- package/styles/accordion/material3.css +652 -0
- package/styles/accordion/material3.scss +5 -0
- package/styles/accordion/tailwind-dark.css +10 -0
- package/styles/accordion/tailwind.css +10 -0
- package/styles/appbar/_layout.scss +6 -1
- package/styles/appbar/_material3-dark-definition.scss +1 -0
- package/styles/appbar/_material3-definition.scss +8 -0
- package/styles/appbar/_theme.scss +12 -2
- package/styles/appbar/bootstrap-dark.css +7 -3
- package/styles/appbar/bootstrap.css +7 -3
- package/styles/appbar/bootstrap4.css +7 -3
- package/styles/appbar/bootstrap5-dark.css +7 -3
- package/styles/appbar/bootstrap5.css +7 -3
- package/styles/appbar/fabric-dark.css +7 -3
- package/styles/appbar/fabric.css +7 -3
- package/styles/appbar/fluent-dark.css +7 -3
- package/styles/appbar/fluent.css +7 -3
- package/styles/appbar/highcontrast-light.css +7 -3
- package/styles/appbar/highcontrast.css +7 -3
- package/styles/appbar/material-dark.css +7 -3
- package/styles/appbar/material.css +7 -3
- package/styles/appbar/material3-dark.css +307 -0
- package/styles/appbar/material3-dark.scss +4 -0
- package/styles/appbar/material3.css +363 -0
- package/styles/appbar/material3.scss +4 -0
- package/styles/appbar/tailwind-dark.css +7 -3
- package/styles/appbar/tailwind.css +7 -3
- package/styles/bootstrap-dark.css +185 -126
- package/styles/bootstrap.css +185 -126
- package/styles/bootstrap4.css +183 -124
- package/styles/bootstrap5-dark.css +179 -120
- package/styles/bootstrap5.css +179 -120
- package/styles/breadcrumb/_material3-dark-definition.scss +1 -0
- package/styles/breadcrumb/_material3-definition.scss +60 -0
- package/styles/breadcrumb/_theme.scss +13 -11
- package/styles/breadcrumb/bootstrap-dark.css +9 -9
- package/styles/breadcrumb/bootstrap.css +9 -9
- package/styles/breadcrumb/bootstrap4.css +9 -9
- package/styles/breadcrumb/bootstrap5-dark.css +8 -8
- package/styles/breadcrumb/bootstrap5.css +8 -8
- package/styles/breadcrumb/fabric-dark.css +7 -7
- package/styles/breadcrumb/fabric.css +7 -7
- package/styles/breadcrumb/fluent-dark.css +5 -5
- package/styles/breadcrumb/fluent.css +5 -5
- package/styles/breadcrumb/highcontrast-light.css +7 -7
- package/styles/breadcrumb/highcontrast.css +7 -7
- package/styles/breadcrumb/icons/_material3-dark.scss +1 -0
- package/styles/breadcrumb/icons/_material3.scss +0 -11
- package/styles/breadcrumb/material-dark.css +9 -9
- package/styles/breadcrumb/material.css +9 -9
- package/styles/breadcrumb/material3-dark.css +424 -0
- package/styles/breadcrumb/material3-dark.scss +5 -0
- package/styles/breadcrumb/material3.css +480 -0
- package/styles/breadcrumb/material3.scss +5 -0
- package/styles/breadcrumb/tailwind-dark.css +8 -8
- package/styles/breadcrumb/tailwind.css +8 -8
- package/styles/carousel/_bootstrap-dark-definition.scss +5 -0
- package/styles/carousel/_bootstrap-definition.scss +5 -0
- package/styles/carousel/_bootstrap4-definition.scss +5 -0
- package/styles/carousel/_bootstrap5-definition.scss +5 -0
- package/styles/carousel/_fabric-dark-definition.scss +5 -0
- package/styles/carousel/_fabric-definition.scss +5 -0
- package/styles/carousel/_fluent-definition.scss +5 -0
- package/styles/carousel/_fusionnew-definition.scss +5 -0
- package/styles/carousel/_highcontrast-definition.scss +5 -0
- package/styles/carousel/_highcontrast-light-definition.scss +5 -0
- package/styles/carousel/_layout.scss +96 -67
- package/styles/carousel/_material-dark-definition.scss +5 -0
- package/styles/carousel/_material-definition.scss +5 -0
- package/styles/carousel/_material3-dark-definition.scss +1 -0
- package/styles/carousel/_material3-definition.scss +28 -0
- package/styles/carousel/_tailwind-definition.scss +5 -0
- package/styles/carousel/_theme.scss +49 -20
- package/styles/carousel/bootstrap-dark.css +101 -62
- package/styles/carousel/bootstrap.css +101 -62
- package/styles/carousel/bootstrap4.css +101 -62
- package/styles/carousel/bootstrap5-dark.css +101 -62
- package/styles/carousel/bootstrap5.css +101 -62
- package/styles/carousel/fabric-dark.css +101 -62
- package/styles/carousel/fabric.css +101 -62
- package/styles/carousel/fluent-dark.css +101 -62
- package/styles/carousel/fluent.css +101 -62
- package/styles/carousel/highcontrast-light.css +101 -62
- package/styles/carousel/highcontrast.css +101 -62
- package/styles/carousel/icons/_material3-dark.scss +1 -0
- package/styles/carousel/material-dark.css +101 -62
- package/styles/carousel/material.css +101 -62
- package/styles/carousel/material3-dark.css +359 -0
- package/styles/carousel/material3-dark.scss +6 -0
- package/styles/carousel/material3.css +415 -0
- package/styles/carousel/material3.scss +6 -0
- package/styles/carousel/tailwind-dark.css +101 -62
- package/styles/carousel/tailwind.css +101 -62
- package/styles/context-menu/_layout.scss +2 -2
- package/styles/context-menu/_material3-dark-definition.scss +1 -0
- package/styles/context-menu/_material3-definition.scss +52 -0
- package/styles/context-menu/_theme.scss +6 -1
- package/styles/context-menu/icons/_material3-dark.scss +1 -0
- package/styles/context-menu/material3-dark.css +435 -0
- package/styles/context-menu/material3-dark.scss +8 -0
- package/styles/context-menu/material3.css +491 -0
- package/styles/context-menu/material3.scss +8 -0
- package/styles/fabric-dark.css +186 -127
- package/styles/fabric.css +185 -126
- package/styles/fluent-dark.css +179 -120
- package/styles/fluent.css +179 -120
- package/styles/h-scroll/_material3-dark-definition.scss +1 -0
- package/styles/h-scroll/_material3-definition.scss +83 -0
- package/styles/h-scroll/icons/_material3-dark.scss +1 -0
- package/styles/h-scroll/material3-dark.css +336 -0
- package/styles/h-scroll/material3-dark.scss +5 -0
- package/styles/h-scroll/material3.css +392 -0
- package/styles/h-scroll/material3.scss +5 -0
- package/styles/highcontrast-light.css +178 -119
- package/styles/highcontrast.css +182 -123
- package/styles/material-dark.css +189 -130
- package/styles/material.css +188 -129
- package/styles/material3-dark.css +10343 -0
- package/styles/material3-dark.scss +15 -0
- package/styles/material3.css +10399 -0
- package/styles/material3.scss +15 -0
- package/styles/menu/_layout.scss +7 -0
- package/styles/menu/_material3-dark-definition.scss +1 -0
- package/styles/menu/_material3-definition.scss +67 -0
- package/styles/menu/_theme.scss +5 -2
- package/styles/menu/bootstrap-dark.css +4 -0
- package/styles/menu/bootstrap.css +4 -0
- package/styles/menu/bootstrap4.css +4 -0
- package/styles/menu/bootstrap5-dark.css +4 -0
- package/styles/menu/bootstrap5.css +4 -0
- package/styles/menu/fabric-dark.css +4 -0
- package/styles/menu/fabric.css +4 -0
- package/styles/menu/fluent-dark.css +4 -0
- package/styles/menu/fluent.css +4 -0
- package/styles/menu/highcontrast-light.css +4 -0
- package/styles/menu/highcontrast.css +4 -0
- package/styles/menu/icons/_material3-dark.scss +1 -0
- package/styles/menu/material-dark.css +4 -0
- package/styles/menu/material.css +4 -0
- package/styles/menu/material3-dark.css +1162 -0
- package/styles/menu/material3-dark.scss +9 -0
- package/styles/menu/material3.css +1218 -0
- package/styles/menu/material3.scss +9 -0
- package/styles/menu/tailwind-dark.css +4 -0
- package/styles/menu/tailwind.css +4 -0
- package/styles/pager/_bootstrap-dark-definition.scss +9 -5
- package/styles/pager/_bootstrap-definition.scss +9 -5
- package/styles/pager/_bootstrap4-definition.scss +8 -4
- package/styles/pager/_bootstrap5-definition.scss +4 -0
- package/styles/pager/_fabric-dark-definition.scss +10 -6
- package/styles/pager/_fabric-definition.scss +10 -6
- package/styles/pager/_fluent-definition.scss +8 -4
- package/styles/pager/_fusionnew-definition.scss +4 -0
- package/styles/pager/_highcontrast-definition.scss +8 -4
- package/styles/pager/_highcontrast-light-definition.scss +4 -0
- package/styles/pager/_layout.scss +63 -48
- package/styles/pager/_material-dark-definition.scss +12 -8
- package/styles/pager/_material-definition.scss +11 -7
- package/styles/pager/_material3-dark-definition.scss +1 -0
- package/styles/pager/_material3-definition.scss +150 -0
- package/styles/pager/_tailwind-definition.scss +9 -5
- package/styles/pager/_theme.scss +12 -5
- package/styles/pager/bootstrap-dark.css +15 -43
- package/styles/pager/bootstrap.css +15 -43
- package/styles/pager/bootstrap4.css +14 -42
- package/styles/pager/bootstrap5-dark.css +10 -38
- package/styles/pager/bootstrap5.css +10 -38
- package/styles/pager/fabric-dark.css +17 -45
- package/styles/pager/fabric.css +16 -44
- package/styles/pager/fluent-dark.css +14 -42
- package/styles/pager/fluent.css +14 -42
- package/styles/pager/highcontrast-light.css +10 -38
- package/styles/pager/highcontrast.css +14 -42
- package/styles/pager/icons/_material3-dark.scss +1 -0
- package/styles/pager/icons/_material3.scss +4 -4
- package/styles/pager/material-dark.css +18 -46
- package/styles/pager/material.css +17 -45
- package/styles/pager/material3-dark.css +765 -0
- package/styles/pager/material3-dark.scss +5 -0
- package/styles/pager/material3.css +821 -0
- package/styles/pager/material3.scss +5 -0
- package/styles/pager/tailwind-dark.css +15 -43
- package/styles/pager/tailwind.css +15 -43
- package/styles/sidebar/_material3-dark-definition.scss +1 -0
- package/styles/sidebar/_material3-definition.scss +7 -0
- package/styles/sidebar/material3-dark.css +204 -0
- package/styles/sidebar/material3-dark.scss +4 -0
- package/styles/sidebar/material3.css +260 -0
- package/styles/sidebar/material3.scss +4 -0
- package/styles/tab/_bootstrap-dark-definition.scss +4 -0
- package/styles/tab/_bootstrap-definition.scss +4 -0
- package/styles/tab/_bootstrap4-definition.scss +4 -0
- package/styles/tab/_bootstrap5-definition.scss +4 -0
- package/styles/tab/_fabric-dark-definition.scss +4 -0
- package/styles/tab/_fabric-definition.scss +4 -0
- package/styles/tab/_fluent-definition.scss +4 -0
- package/styles/tab/_fusionnew-definition.scss +4 -0
- package/styles/tab/_highcontrast-definition.scss +4 -0
- package/styles/tab/_highcontrast-light-definition.scss +4 -0
- package/styles/tab/_layout.scss +37 -13
- package/styles/tab/_material-dark-definition.scss +4 -0
- package/styles/tab/_material-definition.scss +4 -0
- package/styles/tab/_material3-dark-definition.scss +1 -0
- package/styles/tab/_material3-definition.scss +661 -0
- package/styles/tab/_tailwind-definition.scss +4 -0
- package/styles/tab/_theme.scss +44 -1
- package/styles/tab/bootstrap-dark.css +30 -7
- package/styles/tab/bootstrap.css +30 -7
- package/styles/tab/bootstrap4.css +30 -7
- package/styles/tab/bootstrap5-dark.css +30 -7
- package/styles/tab/bootstrap5.css +30 -7
- package/styles/tab/fabric-dark.css +30 -7
- package/styles/tab/fabric.css +30 -7
- package/styles/tab/fluent-dark.css +30 -7
- package/styles/tab/fluent.css +30 -7
- package/styles/tab/highcontrast-light.css +30 -7
- package/styles/tab/highcontrast.css +30 -7
- package/styles/tab/icons/_material3-dark.scss +1 -0
- package/styles/tab/material-dark.css +30 -7
- package/styles/tab/material.css +30 -7
- package/styles/tab/material3-dark.css +4109 -0
- package/styles/tab/material3-dark.scss +6 -0
- package/styles/tab/material3.css +4165 -0
- package/styles/tab/material3.scss +6 -0
- package/styles/tab/tailwind-dark.css +29 -6
- package/styles/tab/tailwind.css +29 -6
- package/styles/tailwind-dark.css +185 -126
- package/styles/tailwind.css +185 -126
- package/styles/toolbar/_fabric-dark-definition.scss +3 -3
- package/styles/toolbar/_fabric-definition.scss +3 -3
- package/styles/toolbar/_highcontrast-definition.scss +1 -1
- package/styles/toolbar/_highcontrast-light-definition.scss +1 -1
- package/styles/toolbar/_layout.scss +8 -0
- package/styles/toolbar/_material-dark-definition.scss +3 -3
- package/styles/toolbar/_material-definition.scss +3 -3
- package/styles/toolbar/_material3-dark-definition.scss +1 -0
- package/styles/toolbar/_material3-definition.scss +220 -0
- package/styles/toolbar/_tailwind-definition.scss +3 -3
- package/styles/toolbar/_theme.scss +2 -1
- package/styles/toolbar/bootstrap-dark.css +8 -1
- package/styles/toolbar/bootstrap.css +8 -1
- package/styles/toolbar/bootstrap4.css +8 -1
- package/styles/toolbar/bootstrap5-dark.css +8 -1
- package/styles/toolbar/bootstrap5.css +8 -1
- package/styles/toolbar/fabric-dark.css +10 -3
- package/styles/toolbar/fabric.css +10 -3
- package/styles/toolbar/fluent-dark.css +8 -1
- package/styles/toolbar/fluent.css +8 -1
- package/styles/toolbar/highcontrast-light.css +9 -2
- package/styles/toolbar/highcontrast.css +9 -2
- package/styles/toolbar/icons/_material3-dark.scss +1 -0
- package/styles/toolbar/material-dark.css +10 -3
- package/styles/toolbar/material.css +10 -3
- package/styles/toolbar/material3-dark.css +1145 -0
- package/styles/toolbar/material3-dark.scss +9 -0
- package/styles/toolbar/material3.css +1201 -0
- package/styles/toolbar/material3.scss +9 -0
- package/styles/toolbar/tailwind-dark.css +11 -4
- package/styles/toolbar/tailwind.css +11 -4
- package/styles/treeview/_layout.scss +15 -2
- package/styles/treeview/_material3-dark-definition.scss +1 -0
- package/styles/treeview/_material3-definition.scss +121 -0
- package/styles/treeview/icons/_material3-dark.scss +1 -0
- package/styles/treeview/icons/_material3.scss +1 -1
- package/styles/treeview/material3-dark.css +903 -0
- package/styles/treeview/material3-dark.scss +7 -0
- package/styles/treeview/material3.css +959 -0
- package/styles/treeview/material3.scss +7 -0
- package/styles/v-scroll/_material3-dark-definition.scss +1 -0
- package/styles/v-scroll/_material3-definition.scss +49 -0
- package/styles/v-scroll/icons/_material3-dark.scss +1 -0
- package/styles/v-scroll/material3-dark.css +258 -0
- package/styles/v-scroll/material3-dark.scss +5 -0
- package/styles/v-scroll/material3.css +314 -0
- package/styles/v-scroll/material3.scss +5 -0
package/src/carousel/carousel.js
CHANGED
|
@@ -18,7 +18,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
18
18
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
19
|
};
|
|
20
20
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
21
|
-
import { Component, EventHandler, Collection, Property, Event, formatUnit, NotifyPropertyChanges } from '@syncfusion/ej2-base';
|
|
21
|
+
import { Component, EventHandler, Collection, Property, Event, formatUnit, NotifyPropertyChanges, Browser } from '@syncfusion/ej2-base';
|
|
22
22
|
import { ChildProperty, addClass, removeClass, setStyleAttribute, attributes, getUniqueID, compile, getInstance, L10n } from '@syncfusion/ej2-base';
|
|
23
23
|
import { append, closest, isNullOrUndefined, remove, classList, Touch, KeyboardEvents } from '@syncfusion/ej2-base';
|
|
24
24
|
import { Button } from '@syncfusion/ej2-buttons';
|
|
@@ -27,6 +27,7 @@ var CLS_CAROUSEL = 'e-carousel';
|
|
|
27
27
|
var CLS_ACTIVE = 'e-active';
|
|
28
28
|
var CLS_RTL = 'e-rtl';
|
|
29
29
|
var CLS_PARTIAL = 'e-partial';
|
|
30
|
+
var CLS_SWIPE = 'e-swipe';
|
|
30
31
|
var CLS_SLIDE_CONTAINER = 'e-carousel-slide-container';
|
|
31
32
|
var CLS_ITEMS = 'e-carousel-items';
|
|
32
33
|
var CLS_CLONED = 'e-cloned';
|
|
@@ -60,6 +61,19 @@ var CLS_PREV_SLIDE = 'e-prev';
|
|
|
60
61
|
var CLS_NEXT_SLIDE = 'e-next';
|
|
61
62
|
var CLS_TRANSITION_START = 'e-transition-start';
|
|
62
63
|
var CLS_TRANSITION_END = 'e-transition-end';
|
|
64
|
+
/**
|
|
65
|
+
* Specifies the action (touch & mouse) which enables the slide swiping action in carousel.
|
|
66
|
+
* * Touch - Enables or disables the swiping action in touch interaction.
|
|
67
|
+
* * Mouse - Enables or disables the swiping action in mouse interaction.
|
|
68
|
+
* @aspNumberEnum
|
|
69
|
+
*/
|
|
70
|
+
export var CarouselSwipeMode;
|
|
71
|
+
(function (CarouselSwipeMode) {
|
|
72
|
+
/** Enables or disables the swiping action in touch interaction. */
|
|
73
|
+
CarouselSwipeMode[CarouselSwipeMode["Touch"] = 1] = "Touch";
|
|
74
|
+
/** Enables or disables the swiping action in mouse interaction. */
|
|
75
|
+
CarouselSwipeMode[CarouselSwipeMode["Mouse"] = 2] = "Mouse";
|
|
76
|
+
})(CarouselSwipeMode || (CarouselSwipeMode = {}));
|
|
63
77
|
/** Specifies the carousel individual item. */
|
|
64
78
|
var CarouselItem = /** @class */ (function (_super) {
|
|
65
79
|
__extends(CarouselItem, _super);
|
|
@@ -90,7 +104,9 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
90
104
|
* @param {string | HTMLElement} element Accepts the DOM element reference
|
|
91
105
|
*/
|
|
92
106
|
function Carousel(options, element) {
|
|
93
|
-
|
|
107
|
+
var _this = _super.call(this, options, element) || this;
|
|
108
|
+
_this.isSwipe = false;
|
|
109
|
+
return _this;
|
|
94
110
|
}
|
|
95
111
|
Carousel.prototype.getModuleName = function () {
|
|
96
112
|
return CLS_CAROUSEL.replace('e-', '');
|
|
@@ -162,7 +178,7 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
162
178
|
this.applySlideInterval();
|
|
163
179
|
}
|
|
164
180
|
this.handleNavigatorsActions(this.selectedIndex);
|
|
165
|
-
if (this.partialVisible) {
|
|
181
|
+
if (this.partialVisible || !(this.swipeMode === (~CarouselSwipeMode.Touch & ~CarouselSwipeMode.Mouse))) {
|
|
166
182
|
this.reRenderSlides();
|
|
167
183
|
}
|
|
168
184
|
break;
|
|
@@ -175,11 +191,10 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
175
191
|
else {
|
|
176
192
|
removeClass(rtlElement, CLS_RTL);
|
|
177
193
|
}
|
|
178
|
-
if (this.partialVisible) {
|
|
179
|
-
var
|
|
180
|
-
var
|
|
181
|
-
|
|
182
|
-
itemsContainer.style.transform = this.getTranslateX(slideWidth, this.selectedIndex + cloneCount);
|
|
194
|
+
if (this.partialVisible || !(this.swipeMode === (~CarouselSwipeMode.Touch & ~CarouselSwipeMode.Mouse))) {
|
|
195
|
+
var cloneCount = this.loop ? this.getNumOfItems() : 0;
|
|
196
|
+
var slideWidth = this.itemsContainer.firstElementChild.clientWidth;
|
|
197
|
+
this.itemsContainer.style.transform = this.getTranslateX(slideWidth, this.selectedIndex + cloneCount);
|
|
183
198
|
}
|
|
184
199
|
break;
|
|
185
200
|
case 'buttonsVisibility':
|
|
@@ -219,8 +234,9 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
219
234
|
this.autoSlide();
|
|
220
235
|
break;
|
|
221
236
|
case 'showIndicators':
|
|
237
|
+
case 'indicatorsType':
|
|
222
238
|
target = this.element.querySelector("." + CLS_INDICATORS);
|
|
223
|
-
if (
|
|
239
|
+
if (target) {
|
|
224
240
|
this.resetTemplates(['indicatorsTemplate']);
|
|
225
241
|
remove(target);
|
|
226
242
|
}
|
|
@@ -247,6 +263,13 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
247
263
|
}
|
|
248
264
|
this.reRenderSlides();
|
|
249
265
|
break;
|
|
266
|
+
case 'swipeMode':
|
|
267
|
+
EventHandler.remove(this.element, 'mousedown touchstart', this.swipeStart);
|
|
268
|
+
EventHandler.remove(this.element, 'mousemove touchmove', this.swiping);
|
|
269
|
+
EventHandler.remove(this.element, 'mouseup touchend', this.swipStop);
|
|
270
|
+
this.swipeModehandlers();
|
|
271
|
+
this.reRenderSlides();
|
|
272
|
+
break;
|
|
250
273
|
}
|
|
251
274
|
}
|
|
252
275
|
};
|
|
@@ -269,6 +292,9 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
269
292
|
if (this.partialVisible) {
|
|
270
293
|
carouselClasses.push(CLS_PARTIAL);
|
|
271
294
|
}
|
|
295
|
+
if (!(this.swipeMode === (~CarouselSwipeMode.Touch & ~CarouselSwipeMode.Mouse))) {
|
|
296
|
+
carouselClasses.push(CLS_SWIPE);
|
|
297
|
+
}
|
|
272
298
|
addClass([this.element], carouselClasses);
|
|
273
299
|
setStyleAttribute(this.element, { 'width': formatUnit(this.width), 'height': formatUnit(this.height) });
|
|
274
300
|
attributes(this.element, { 'tabindex': '0', 'aria-roledescription': 'carousel', 'aria-label': this.localeObj.getConstant('slideShow') });
|
|
@@ -283,52 +309,52 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
283
309
|
slideContainer = this.createElement('div', { className: CLS_SLIDE_CONTAINER });
|
|
284
310
|
this.element.appendChild(slideContainer);
|
|
285
311
|
}
|
|
286
|
-
|
|
287
|
-
slideContainer.appendChild(itemsContainer);
|
|
288
|
-
|
|
312
|
+
this.itemsContainer = this.createElement('div', { className: CLS_ITEMS, attrs: { 'aria-live': this.autoPlay ? 'off' : 'polite' } });
|
|
313
|
+
slideContainer.appendChild(this.itemsContainer);
|
|
314
|
+
var numOfItems = this.getNumOfItems();
|
|
315
|
+
if (numOfItems > 0 && this.loop) {
|
|
289
316
|
if (this.items.length > 0) {
|
|
290
|
-
this.items.slice(-
|
|
291
|
-
_this.renderSlide(item, item.template, index, itemsContainer, true);
|
|
317
|
+
this.items.slice(-numOfItems).forEach(function (item, index) {
|
|
318
|
+
_this.renderSlide(item, item.template, index, _this.itemsContainer, true);
|
|
292
319
|
});
|
|
293
320
|
}
|
|
294
321
|
else if (this.dataSource.length > 0) {
|
|
295
|
-
this.dataSource.slice(-
|
|
296
|
-
_this.renderSlide(item, _this.itemTemplate, index, itemsContainer, true);
|
|
322
|
+
this.dataSource.slice(-numOfItems).forEach(function (item, index) {
|
|
323
|
+
_this.renderSlide(item, _this.itemTemplate, index, _this.itemsContainer, true);
|
|
297
324
|
});
|
|
298
325
|
}
|
|
299
326
|
}
|
|
300
327
|
if (this.items.length > 0) {
|
|
301
328
|
this.slideItems = this.items;
|
|
302
329
|
this.items.forEach(function (item, index) {
|
|
303
|
-
_this.renderSlide(item, item.template, index, itemsContainer);
|
|
330
|
+
_this.renderSlide(item, item.template, index, _this.itemsContainer);
|
|
304
331
|
});
|
|
305
332
|
}
|
|
306
333
|
else if (this.dataSource.length > 0) {
|
|
307
334
|
this.slideItems = this.dataSource;
|
|
308
335
|
this.dataSource.forEach(function (item, index) {
|
|
309
|
-
_this.renderSlide(item, _this.itemTemplate, index, itemsContainer);
|
|
336
|
+
_this.renderSlide(item, _this.itemTemplate, index, _this.itemsContainer);
|
|
310
337
|
});
|
|
311
338
|
}
|
|
312
|
-
if (
|
|
339
|
+
if (numOfItems > 0 && this.loop) {
|
|
313
340
|
if (this.items.length > 0) {
|
|
314
|
-
this.items.slice(0,
|
|
315
|
-
_this.renderSlide(item, item.template, index, itemsContainer, true);
|
|
341
|
+
this.items.slice(0, numOfItems).forEach(function (item, index) {
|
|
342
|
+
_this.renderSlide(item, item.template, index, _this.itemsContainer, true);
|
|
316
343
|
});
|
|
317
344
|
}
|
|
318
345
|
else if (this.dataSource.length > 0) {
|
|
319
|
-
this.dataSource.slice(0,
|
|
320
|
-
_this.renderSlide(item, _this.itemTemplate, index, itemsContainer, true);
|
|
346
|
+
this.dataSource.slice(0, numOfItems).forEach(function (item, index) {
|
|
347
|
+
_this.renderSlide(item, _this.itemTemplate, index, _this.itemsContainer, true);
|
|
321
348
|
});
|
|
322
349
|
}
|
|
323
350
|
}
|
|
324
351
|
this.renderTemplates();
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
}
|
|
352
|
+
this.itemsContainer.style.setProperty('--carousel-items-count', "" + this.itemsContainer.children.length);
|
|
353
|
+
var slideWidth = isNullOrUndefined(this.itemsContainer.firstElementChild) ? 0 :
|
|
354
|
+
this.itemsContainer.firstElementChild.clientWidth;
|
|
355
|
+
this.itemsContainer.style.transitionProperty = 'none';
|
|
356
|
+
var cloneCount = this.loop ? numOfItems : 0;
|
|
357
|
+
this.itemsContainer.style.transform = this.getTranslateX(slideWidth, this.selectedIndex + cloneCount);
|
|
332
358
|
this.autoSlide();
|
|
333
359
|
this.renderTouchActions();
|
|
334
360
|
this.renderKeyboardActions();
|
|
@@ -431,8 +457,7 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
431
457
|
if (isLastSlide) {
|
|
432
458
|
this.setProperties({ autoPlay: false }, true);
|
|
433
459
|
playButton.setAttribute('aria-label', this.localeObj.getConstant('playSlideTransition'));
|
|
434
|
-
|
|
435
|
-
itemsContainer.setAttribute('aria-live', 'polite');
|
|
460
|
+
this.itemsContainer.setAttribute('aria-live', 'polite');
|
|
436
461
|
}
|
|
437
462
|
buttonObj.appendTo(playButton);
|
|
438
463
|
playPauseWrap.appendChild(playButton);
|
|
@@ -447,34 +472,70 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
447
472
|
if (!this.showIndicators) {
|
|
448
473
|
return;
|
|
449
474
|
}
|
|
450
|
-
var
|
|
475
|
+
var indicatorClass = 'e-default';
|
|
476
|
+
if (!this.indicatorsTemplate) {
|
|
477
|
+
indicatorClass = "e-" + this.indicatorsType.toLowerCase();
|
|
478
|
+
}
|
|
479
|
+
var indicatorWrap = this.createElement('div', { className: CLS_INDICATORS + " " + indicatorClass });
|
|
451
480
|
var indicatorBars = this.createElement('div', { className: CLS_INDICATOR_BARS });
|
|
452
481
|
indicatorWrap.appendChild(indicatorBars);
|
|
482
|
+
var progress;
|
|
453
483
|
if (this.slideItems) {
|
|
454
|
-
this.
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
484
|
+
switch (this.indicatorsType) {
|
|
485
|
+
case 'Fraction':
|
|
486
|
+
if (this.indicatorsTemplate) {
|
|
487
|
+
this.renderIndicatorTemplate(indicatorBars, this.selectedIndex + 1);
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
indicatorBars.innerText = this.selectedIndex + 1 + " / " + this.slideItems.length;
|
|
491
|
+
}
|
|
492
|
+
break;
|
|
493
|
+
case 'Progress':
|
|
494
|
+
if (this.indicatorsTemplate) {
|
|
495
|
+
this.renderIndicatorTemplate(indicatorBars, this.selectedIndex + 1);
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
progress = this.createElement('div', { className: CLS_INDICATOR_BAR });
|
|
499
|
+
progress.style.setProperty('--carousel-items-current', "" + (this.selectedIndex + 1));
|
|
500
|
+
progress.style.setProperty('--carousel-items-count', "" + this.slideItems.length);
|
|
501
|
+
indicatorBars.appendChild(progress);
|
|
502
|
+
}
|
|
503
|
+
break;
|
|
504
|
+
case 'Default':
|
|
505
|
+
case 'Dynamic':
|
|
506
|
+
this.slideItems.forEach(function (item, index) {
|
|
507
|
+
var indicatorBar = _this.createElement('div', {
|
|
508
|
+
className: CLS_INDICATOR_BAR + ' ' + (_this.selectedIndex === index ? CLS_ACTIVE : _this.selectedIndex - 1 === index ? CLS_PREV_SLIDE : _this.selectedIndex + 1 === index ? CLS_NEXT_SLIDE : ''),
|
|
509
|
+
attrs: { 'data-index': index.toString(), 'aria-current': _this.selectedIndex === index ? 'true' : 'false' }
|
|
510
|
+
});
|
|
511
|
+
indicatorBar.style.setProperty('--carousel-items-current', "" + _this.selectedIndex);
|
|
512
|
+
if (_this.indicatorsTemplate) {
|
|
513
|
+
_this.renderIndicatorTemplate(indicatorBar, index);
|
|
514
|
+
}
|
|
515
|
+
else if (_this.indicatorsType === 'Default') {
|
|
516
|
+
var indicator = _this.createElement('button', { className: CLS_INDICATOR, attrs: { 'type': 'button', 'aria-label': _this.localeObj.getConstant('slide') + ' ' + (index + 1) + ' ' + _this.localeObj.getConstant('of') + ' ' + _this.slideItems.length } });
|
|
517
|
+
indicatorBar.appendChild(indicator);
|
|
518
|
+
indicator.appendChild(_this.createElement('div', {}));
|
|
519
|
+
var buttonObj = new Button({ cssClass: 'e-flat e-small' });
|
|
520
|
+
buttonObj.appendTo(indicator);
|
|
521
|
+
}
|
|
522
|
+
indicatorBars.appendChild(indicatorBar);
|
|
523
|
+
if (_this.indicatorsType === 'Default') {
|
|
524
|
+
EventHandler.add(indicatorBar, 'click', _this.indicatorClickHandler, _this);
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
break;
|
|
528
|
+
}
|
|
475
529
|
}
|
|
476
530
|
this.element.appendChild(indicatorWrap);
|
|
477
531
|
};
|
|
532
|
+
Carousel.prototype.renderIndicatorTemplate = function (indicatorBar, index) {
|
|
533
|
+
if (index === void 0) { index = 0; }
|
|
534
|
+
addClass([indicatorBar], CLS_TEMPLATE);
|
|
535
|
+
var templateId = this.element.id + '_indicatorsTemplate';
|
|
536
|
+
var template = this.templateParser(this.indicatorsTemplate)({ index: index, selectedIndex: this.selectedIndex }, this, 'indicatorsTemplate', templateId, false);
|
|
537
|
+
append(template, indicatorBar);
|
|
538
|
+
};
|
|
478
539
|
Carousel.prototype.renderKeyboardActions = function () {
|
|
479
540
|
this.keyModule = new KeyboardEvents(this.element, { keyAction: this.keyHandler.bind(this), keyConfigs: this.keyConfigs });
|
|
480
541
|
};
|
|
@@ -592,13 +653,7 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
592
653
|
_this.setProperties({ selectedIndex: currentIndex }, true);
|
|
593
654
|
attributes(args.currentSlide, { 'aria-hidden': 'true' });
|
|
594
655
|
attributes(args.nextSlide, { 'aria-hidden': 'false' });
|
|
595
|
-
|
|
596
|
-
if (slideIndicators.length > 0) {
|
|
597
|
-
attributes(slideIndicators[parseInt(activeIndex.toString(), 10)], { 'aria-current': 'false' });
|
|
598
|
-
attributes(slideIndicators[parseInt(currentIndex.toString(), 10)], { 'aria-current': 'true' });
|
|
599
|
-
removeClass(slideIndicators, CLS_ACTIVE);
|
|
600
|
-
addClass([slideIndicators[parseInt(currentIndex.toString(), 10)]], CLS_ACTIVE);
|
|
601
|
-
}
|
|
656
|
+
_this.refreshIndicators(activeIndex, currentIndex);
|
|
602
657
|
_this.slideChangedEventArgs = {
|
|
603
658
|
currentIndex: args.nextIndex,
|
|
604
659
|
previousIndex: args.currentIndex,
|
|
@@ -607,25 +662,32 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
607
662
|
slideDirection: direction,
|
|
608
663
|
isSwiped: isSwiped
|
|
609
664
|
};
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
665
|
+
var slideWidth = allSlides[parseInt(currentIndex.toString(), 10)].clientWidth;
|
|
666
|
+
var numOfItems = _this.getNumOfItems();
|
|
667
|
+
if (!_this.isSwipe) {
|
|
668
|
+
_this.itemsContainer.style.transitionDuration = '0.6s';
|
|
669
|
+
}
|
|
670
|
+
_this.isSwipe = false;
|
|
671
|
+
if ((_this.animationEffect === 'Fade')) {
|
|
672
|
+
_this.itemsContainer.classList.add('e-fade-in-out');
|
|
673
|
+
}
|
|
674
|
+
else {
|
|
675
|
+
_this.itemsContainer.style.transitionProperty = 'transform';
|
|
676
|
+
}
|
|
677
|
+
if (_this.loop) {
|
|
678
|
+
if (_this.slideChangedEventArgs.currentIndex === 0 && _this.slideChangedEventArgs.slideDirection === 'Next') {
|
|
679
|
+
_this.itemsContainer.style.transform = _this.getTranslateX(slideWidth, allSlides.length + numOfItems);
|
|
680
|
+
}
|
|
681
|
+
else if (_this.slideChangedEventArgs.currentIndex === _this.slideItems.length - 1 && _this.slideChangedEventArgs.slideDirection === 'Previous') {
|
|
682
|
+
_this.itemsContainer.style.transform = _this.partialVisible ? _this.getTranslateX(slideWidth) : 'translateX(0px)';
|
|
624
683
|
}
|
|
625
684
|
else {
|
|
626
|
-
|
|
685
|
+
_this.itemsContainer.style.transform = _this.getTranslateX(slideWidth, currentIndex + numOfItems);
|
|
627
686
|
}
|
|
628
687
|
}
|
|
688
|
+
else {
|
|
689
|
+
_this.itemsContainer.style.transform = _this.getTranslateX(slideWidth, currentIndex);
|
|
690
|
+
}
|
|
629
691
|
if (_this.animationEffect === 'Slide') {
|
|
630
692
|
if (direction === 'Previous') {
|
|
631
693
|
addClass([args.nextSlide], CLS_PREV_SLIDE);
|
|
@@ -660,13 +722,14 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
660
722
|
};
|
|
661
723
|
Carousel.prototype.onTransitionEnd = function () {
|
|
662
724
|
var _this = this;
|
|
725
|
+
removeClass(this.element.querySelectorAll("." + CLS_ITEMS), 'e-fade-in-out');
|
|
726
|
+
var numOfItems = this.getNumOfItems();
|
|
663
727
|
if (this.slideChangedEventArgs) {
|
|
664
|
-
|
|
728
|
+
this.itemsContainer.style.transitionProperty = 'none';
|
|
729
|
+
if (this.loop && (this.slideChangedEventArgs.currentIndex === 0 && this.slideChangedEventArgs.slideDirection === 'Next' ||
|
|
665
730
|
this.slideChangedEventArgs.currentIndex === this.slideItems.length - 1 && this.slideChangedEventArgs.slideDirection === 'Previous')) {
|
|
666
|
-
var container = this.element.querySelector('.' + CLS_ITEMS);
|
|
667
731
|
var slideWidth = this.slideChangedEventArgs.currentSlide.clientWidth;
|
|
668
|
-
|
|
669
|
-
container.style.transform = this.getTranslateX(slideWidth, this.slideChangedEventArgs.currentIndex + 2);
|
|
732
|
+
this.itemsContainer.style.transform = this.getTranslateX(slideWidth, this.slideChangedEventArgs.currentIndex + numOfItems);
|
|
670
733
|
}
|
|
671
734
|
addClass([this.slideChangedEventArgs.currentSlide], CLS_ACTIVE);
|
|
672
735
|
removeClass([this.slideChangedEventArgs.previousSlide], CLS_ACTIVE);
|
|
@@ -676,6 +739,52 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
676
739
|
});
|
|
677
740
|
}
|
|
678
741
|
};
|
|
742
|
+
Carousel.prototype.refreshIndicators = function (activeIndex, currentIndex) {
|
|
743
|
+
var _this = this;
|
|
744
|
+
var slideIndicator = this.element.querySelector("." + CLS_INDICATOR_BARS);
|
|
745
|
+
if (isNullOrUndefined(slideIndicator)) {
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
var indicators = [].slice.call(slideIndicator.childNodes);
|
|
749
|
+
switch (this.indicatorsType) {
|
|
750
|
+
case 'Default':
|
|
751
|
+
case 'Dynamic':
|
|
752
|
+
attributes(indicators[parseInt(activeIndex.toString(), 10)], { 'aria-current': 'false' });
|
|
753
|
+
attributes(indicators[parseInt(currentIndex.toString(), 10)], { 'aria-current': 'true' });
|
|
754
|
+
removeClass(indicators, [CLS_ACTIVE, CLS_PREV_SLIDE, CLS_NEXT_SLIDE]);
|
|
755
|
+
addClass([indicators[parseInt(currentIndex.toString(), 10)]], CLS_ACTIVE);
|
|
756
|
+
if (indicators[currentIndex - 1]) {
|
|
757
|
+
addClass([indicators[currentIndex - 1]], CLS_PREV_SLIDE);
|
|
758
|
+
}
|
|
759
|
+
if (indicators[currentIndex + 1]) {
|
|
760
|
+
addClass([indicators[currentIndex + 1]], CLS_NEXT_SLIDE);
|
|
761
|
+
}
|
|
762
|
+
indicators.forEach(function (item) { return item.style.setProperty('--carousel-items-current', "" + _this.selectedIndex); });
|
|
763
|
+
break;
|
|
764
|
+
case 'Fraction':
|
|
765
|
+
if (this.indicatorsTemplate) {
|
|
766
|
+
if (slideIndicator.children.length > 0) {
|
|
767
|
+
slideIndicator.removeChild(slideIndicator.firstElementChild);
|
|
768
|
+
}
|
|
769
|
+
this.renderIndicatorTemplate(slideIndicator, currentIndex + 1);
|
|
770
|
+
}
|
|
771
|
+
else {
|
|
772
|
+
slideIndicator.innerText = this.selectedIndex + 1 + " / " + this.slideItems.length;
|
|
773
|
+
}
|
|
774
|
+
break;
|
|
775
|
+
case 'Progress':
|
|
776
|
+
if (this.indicatorsTemplate) {
|
|
777
|
+
if (slideIndicator.children.length > 0) {
|
|
778
|
+
slideIndicator.removeChild(slideIndicator.firstElementChild);
|
|
779
|
+
}
|
|
780
|
+
this.renderIndicatorTemplate(slideIndicator, currentIndex + 1);
|
|
781
|
+
}
|
|
782
|
+
else {
|
|
783
|
+
slideIndicator.firstElementChild.style.setProperty('--carousel-items-current', "" + (this.selectedIndex + 1));
|
|
784
|
+
}
|
|
785
|
+
break;
|
|
786
|
+
}
|
|
787
|
+
};
|
|
679
788
|
Carousel.prototype.setHtmlAttributes = function (attribute, element) {
|
|
680
789
|
var keys = Object.keys(attribute);
|
|
681
790
|
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
|
|
@@ -691,7 +800,7 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
691
800
|
Carousel.prototype.templateParser = function (template) {
|
|
692
801
|
if (template) {
|
|
693
802
|
try {
|
|
694
|
-
if (document.querySelectorAll(template).length) {
|
|
803
|
+
if (typeof template !== 'function' && document.querySelectorAll(template).length) {
|
|
695
804
|
return compile(document.querySelector(template).innerHTML.trim());
|
|
696
805
|
}
|
|
697
806
|
else {
|
|
@@ -741,8 +850,7 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
741
850
|
playButton.setAttribute('aria-label', this.localeObj.getConstant(this.autoPlay ? 'pauseSlideTransition' : 'playSlideTransition'));
|
|
742
851
|
buttonObj.iconCss = CLS_ICON + ' ' + (this.autoPlay ? CLS_PAUSE_ICON : CLS_PLAY_ICON);
|
|
743
852
|
buttonObj.dataBind();
|
|
744
|
-
|
|
745
|
-
itemsContainer.setAttribute('aria-live', this.autoPlay ? 'off' : 'polite');
|
|
853
|
+
this.itemsContainer.setAttribute('aria-live', this.autoPlay ? 'off' : 'polite');
|
|
746
854
|
if (this.autoPlay && !this.loop && this.selectedIndex === this.slideItems.length - 1) {
|
|
747
855
|
this.setActiveSlide(0, 'Next');
|
|
748
856
|
}
|
|
@@ -826,8 +934,7 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
826
934
|
if (isButtonUpdate) {
|
|
827
935
|
this.setProperties({ autoPlay: !isLastSlide }, true);
|
|
828
936
|
playButton.setAttribute('aria-label', this.localeObj.getConstant(this.autoPlay ? 'pauseSlideTransition' : 'playSlideTransition'));
|
|
829
|
-
|
|
830
|
-
itemsContainer.setAttribute('aria-live', this.autoPlay ? 'off' : 'polite');
|
|
937
|
+
this.itemsContainer.setAttribute('aria-live', this.autoPlay ? 'off' : 'polite');
|
|
831
938
|
var buttonObj = getInstance(playButton, Button);
|
|
832
939
|
buttonObj.iconCss = CLS_ICON + ' ' + (this.autoPlay ? CLS_PAUSE_ICON : CLS_PLAY_ICON);
|
|
833
940
|
buttonObj.dataBind();
|
|
@@ -887,7 +994,94 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
887
994
|
}
|
|
888
995
|
}
|
|
889
996
|
};
|
|
997
|
+
Carousel.prototype.getNumOfItems = function () {
|
|
998
|
+
return this.partialVisible ? 2 : 1;
|
|
999
|
+
};
|
|
1000
|
+
Carousel.prototype.getTranslateValue = function (element) {
|
|
1001
|
+
var style = getComputedStyle(element);
|
|
1002
|
+
return window.WebKitCSSMatrix ?
|
|
1003
|
+
new WebKitCSSMatrix(style.webkitTransform).m41 : 0;
|
|
1004
|
+
};
|
|
1005
|
+
Carousel.prototype.swipeStart = function (e) {
|
|
1006
|
+
if (!this.timeStampStart) {
|
|
1007
|
+
this.timeStampStart = Date.now();
|
|
1008
|
+
}
|
|
1009
|
+
this.isSwipe = false;
|
|
1010
|
+
this.itemsContainer.classList.add('e-swipe-start');
|
|
1011
|
+
this.prevPageX = e.touches ? e.touches[0].pageX : e.pageX;
|
|
1012
|
+
this.initialTranslate = this.getTranslateValue(this.itemsContainer);
|
|
1013
|
+
};
|
|
1014
|
+
Carousel.prototype.swiping = function (e) {
|
|
1015
|
+
if (!this.itemsContainer.classList.contains('e-swipe-start')) {
|
|
1016
|
+
return;
|
|
1017
|
+
}
|
|
1018
|
+
e.preventDefault();
|
|
1019
|
+
var pageX = e.touches ? e.touches[0].pageX : e.pageX;
|
|
1020
|
+
var positionDiff = this.prevPageX - (pageX);
|
|
1021
|
+
if (!this.loop && ((this.enableRtl && ((this.selectedIndex === 0 && positionDiff > 0) ||
|
|
1022
|
+
(this.selectedIndex === this.itemsContainer.childElementCount - 1 && positionDiff < 0))) ||
|
|
1023
|
+
(!this.enableRtl && ((this.selectedIndex === 0 && positionDiff < 0) ||
|
|
1024
|
+
(this.selectedIndex === this.itemsContainer.childElementCount - 1 && positionDiff > 0))))) {
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
this.itemsContainer.style.transform = "translateX(" + (this.initialTranslate + (this.enableRtl ? positionDiff : -positionDiff)) + "px)";
|
|
1028
|
+
};
|
|
1029
|
+
Carousel.prototype.swipStop = function () {
|
|
1030
|
+
this.isSwipe = true;
|
|
1031
|
+
var time = Date.now() - this.timeStampStart;
|
|
1032
|
+
var distanceX = this.getTranslateValue(this.itemsContainer) - this.initialTranslate;
|
|
1033
|
+
distanceX = distanceX < 0 ? distanceX * -1 : distanceX;
|
|
1034
|
+
if (this.isSwipe) {
|
|
1035
|
+
var offsetDist = distanceX * (Browser.isDevice ? 6 : 1.66);
|
|
1036
|
+
this.itemsContainer.style.transitionDuration = (((Browser.isDevice ? distanceX : offsetDist) / time) / 10) + 's';
|
|
1037
|
+
}
|
|
1038
|
+
var slideWidth = this.itemsContainer.firstElementChild.clientWidth;
|
|
1039
|
+
var threshold = slideWidth / 2;
|
|
1040
|
+
this.itemsContainer.classList.remove('e-swipe-start');
|
|
1041
|
+
var value = this.getTranslateValue(this.itemsContainer);
|
|
1042
|
+
if (value - this.initialTranslate < -threshold) {
|
|
1043
|
+
this.swipeNavigation(!this.enableRtl);
|
|
1044
|
+
}
|
|
1045
|
+
else if (value - this.initialTranslate > threshold) {
|
|
1046
|
+
this.swipeNavigation(this.enableRtl);
|
|
1047
|
+
}
|
|
1048
|
+
else {
|
|
1049
|
+
this.itemsContainer.style.transform = "translateX(" + this.initialTranslate + "px)";
|
|
1050
|
+
if (this.animationEffect === 'Fade') {
|
|
1051
|
+
this.itemsContainer.classList.add('e-fade-in-out');
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
};
|
|
1055
|
+
Carousel.prototype.swipeNavigation = function (isRtl) {
|
|
1056
|
+
if (isRtl) {
|
|
1057
|
+
this.next();
|
|
1058
|
+
}
|
|
1059
|
+
else {
|
|
1060
|
+
this.prev();
|
|
1061
|
+
}
|
|
1062
|
+
};
|
|
1063
|
+
Carousel.prototype.swipeModehandlers = function () {
|
|
1064
|
+
if ((this.swipeMode & CarouselSwipeMode.Touch) === CarouselSwipeMode.Touch) {
|
|
1065
|
+
EventHandler.add(this.itemsContainer, 'touchstart', this.swipeStart, this);
|
|
1066
|
+
EventHandler.add(this.itemsContainer, 'touchmove', this.swiping, this);
|
|
1067
|
+
EventHandler.add(this.itemsContainer, 'touchend', this.swipStop, this);
|
|
1068
|
+
}
|
|
1069
|
+
if ((this.swipeMode & CarouselSwipeMode.Mouse) === CarouselSwipeMode.Mouse) {
|
|
1070
|
+
EventHandler.add(this.itemsContainer, 'mousedown', this.swipeStart, this);
|
|
1071
|
+
EventHandler.add(this.itemsContainer, 'mousemove', this.swiping, this);
|
|
1072
|
+
EventHandler.add(this.itemsContainer, 'mouseup', this.swipStop, this);
|
|
1073
|
+
}
|
|
1074
|
+
if ((this.swipeMode === 0) && (this.swipeMode & CarouselSwipeMode.Mouse & CarouselSwipeMode.Touch) ===
|
|
1075
|
+
(CarouselSwipeMode.Mouse & CarouselSwipeMode.Touch)) {
|
|
1076
|
+
EventHandler.add(this.itemsContainer, 'mousedown touchstart', this.swipeStart, this);
|
|
1077
|
+
EventHandler.add(this.itemsContainer, 'mousemove touchmove', this.swiping, this);
|
|
1078
|
+
EventHandler.add(this.itemsContainer, 'mouseup touchend', this.swipStop, this);
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
890
1081
|
Carousel.prototype.wireEvents = function () {
|
|
1082
|
+
if (!(this.animationEffect === 'Custom')) {
|
|
1083
|
+
this.swipeModehandlers();
|
|
1084
|
+
}
|
|
891
1085
|
EventHandler.add(this.element, 'focusin focusout', this.onFocusActions, this);
|
|
892
1086
|
EventHandler.add(this.element, 'mouseenter mouseleave', this.onHoverActions, this);
|
|
893
1087
|
EventHandler.add(this.element.firstElementChild, 'animationend', this.onTransitionEnd, this);
|
|
@@ -950,8 +1144,7 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
950
1144
|
playButton.setAttribute('aria-label', this.localeObj.getConstant('pauseSlideTransition'));
|
|
951
1145
|
}
|
|
952
1146
|
this.setProperties({ autoPlay: true }, true);
|
|
953
|
-
|
|
954
|
-
itemsContainer.setAttribute('aria-live', 'off');
|
|
1147
|
+
this.itemsContainer.setAttribute('aria-live', 'off');
|
|
955
1148
|
this.applySlideInterval();
|
|
956
1149
|
};
|
|
957
1150
|
/**
|
|
@@ -967,8 +1160,7 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
967
1160
|
classList(pauseIcon, [CLS_PLAY_ICON], [CLS_PAUSE_ICON]);
|
|
968
1161
|
}
|
|
969
1162
|
this.setProperties({ autoPlay: false }, true);
|
|
970
|
-
|
|
971
|
-
itemsContainer.setAttribute('aria-live', 'off');
|
|
1163
|
+
this.itemsContainer.setAttribute('aria-live', 'off');
|
|
972
1164
|
this.resetSlideInterval();
|
|
973
1165
|
};
|
|
974
1166
|
/**
|
|
@@ -1073,12 +1265,18 @@ var Carousel = /** @class */ (function (_super) {
|
|
|
1073
1265
|
__decorate([
|
|
1074
1266
|
Property(true)
|
|
1075
1267
|
], Carousel.prototype, "showIndicators", void 0);
|
|
1268
|
+
__decorate([
|
|
1269
|
+
Property('Default')
|
|
1270
|
+
], Carousel.prototype, "indicatorsType", void 0);
|
|
1076
1271
|
__decorate([
|
|
1077
1272
|
Property('Visible')
|
|
1078
1273
|
], Carousel.prototype, "buttonsVisibility", void 0);
|
|
1079
1274
|
__decorate([
|
|
1080
1275
|
Property(false)
|
|
1081
1276
|
], Carousel.prototype, "partialVisible", void 0);
|
|
1277
|
+
__decorate([
|
|
1278
|
+
Property(CarouselSwipeMode.Touch)
|
|
1279
|
+
], Carousel.prototype, "swipeMode", void 0);
|
|
1082
1280
|
__decorate([
|
|
1083
1281
|
Property()
|
|
1084
1282
|
], Carousel.prototype, "htmlAttributes", void 0);
|
|
@@ -251,9 +251,10 @@ export interface MenuBaseModel extends ComponentModel{
|
|
|
251
251
|
* Not applicable to ContextMenu component.
|
|
252
252
|
*
|
|
253
253
|
* @default null
|
|
254
|
+
* @aspType string
|
|
254
255
|
* @private
|
|
255
256
|
*/
|
|
256
|
-
template?: string;
|
|
257
|
+
template?: string | Function;
|
|
257
258
|
|
|
258
259
|
/**
|
|
259
260
|
* Specifies whether to enable / disable the scrollable option in Menu.
|
|
@@ -270,9 +270,10 @@ export declare abstract class MenuBase extends Component<HTMLUListElement> imple
|
|
|
270
270
|
* Not applicable to ContextMenu component.
|
|
271
271
|
*
|
|
272
272
|
* @default null
|
|
273
|
+
* @aspType string
|
|
273
274
|
* @private
|
|
274
275
|
*/
|
|
275
|
-
template: string;
|
|
276
|
+
template: string | Function;
|
|
276
277
|
/**
|
|
277
278
|
* Specifies whether to enable / disable the scrollable option in Menu.
|
|
278
279
|
* Not applicable to ContextMenu component.
|
package/src/common/menu-base.js
CHANGED
|
@@ -479,6 +479,7 @@ var MenuBase = /** @class */ (function (_super) {
|
|
|
479
479
|
var _this = this;
|
|
480
480
|
if (navIdxLen === void 0) { navIdxLen = this.navIdx.length; }
|
|
481
481
|
if (this.isMenu) {
|
|
482
|
+
var popup = [this.getWrapper()].concat([].slice.call(selectAll('.' + POPUP)))[navIdxLen];
|
|
482
483
|
var popups_1 = [];
|
|
483
484
|
var allPopup = selectAll('.' + POPUP);
|
|
484
485
|
allPopup.forEach(function (elem) {
|
|
@@ -486,7 +487,7 @@ var MenuBase = /** @class */ (function (_super) {
|
|
|
486
487
|
popups_1.push(elem);
|
|
487
488
|
}
|
|
488
489
|
});
|
|
489
|
-
|
|
490
|
+
popup = [this.getWrapper()].concat([].slice.call(popups_1))[navIdxLen];
|
|
490
491
|
return isNullOrUndefined(popup) ? null : select('.e-menu-parent', popup);
|
|
491
492
|
}
|
|
492
493
|
else {
|
|
@@ -863,7 +864,6 @@ var MenuBase = /** @class */ (function (_super) {
|
|
|
863
864
|
}
|
|
864
865
|
}
|
|
865
866
|
};
|
|
866
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
867
867
|
MenuBase.prototype.copyObject = function (source, destination) {
|
|
868
868
|
for (var prop in source) {
|
|
869
869
|
destination["" + prop] = source["" + prop];
|
package/src/menu/menu-model.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { attributes, NotifyPropertyChanges, INotifyPropertyChanged, Property } from '@syncfusion/ej2-base';import { Browser, Complex, getUniqueID, SanitizeHtmlHelper } from '@syncfusion/ej2-base';import { MenuBase, FieldSettings } from '../common/menu-base';import { MenuItemModel, FieldSettingsModel } from '../common/menu-base-model';
|
|
1
|
+
import { attributes, NotifyPropertyChanges, INotifyPropertyChanged, Property } from '@syncfusion/ej2-base';import { Browser, Complex, getUniqueID, SanitizeHtmlHelper, compile } from '@syncfusion/ej2-base';import { MenuBase, FieldSettings } from '../common/menu-base';import { MenuItemModel, FieldSettingsModel } from '../common/menu-base-model';
|
|
2
2
|
import {Orientation} from "./menu";
|
|
3
3
|
import {MenuBaseModel} from "../common/menu-base-model";
|
|
4
4
|
|
|
@@ -25,8 +25,9 @@ export interface MenuModel extends MenuBaseModel{
|
|
|
25
25
|
* Specifies the template for Menu item.
|
|
26
26
|
*
|
|
27
27
|
* @default null
|
|
28
|
+
* @aspType string
|
|
28
29
|
*/
|
|
29
|
-
template?: string;
|
|
30
|
+
template?: string | Function;
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* Specifies whether to enable / disable the scrollable option in Menu.
|