@syncfusion/ej2-navigations 30.2.7 → 31.1.17

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.
Files changed (162) hide show
  1. package/dist/ej2-navigations.min.js +1 -1
  2. package/dist/ej2-navigations.umd.min.js +1 -1
  3. package/dist/ej2-navigations.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-navigations.es2015.js.map +1 -1
  5. package/dist/es6/ej2-navigations.es5.js.map +1 -1
  6. package/dist/global/ej2-navigations.min.js +1 -1
  7. package/dist/global/ej2-navigations.min.js.map +1 -1
  8. package/dist/global/index.d.ts +1 -1
  9. package/dist/ts/accordion/accordion-model.d.ts +285 -0
  10. package/dist/ts/accordion/accordion.d.ts +458 -0
  11. package/dist/ts/accordion/accordion.ts +1580 -0
  12. package/dist/ts/accordion/index.d.ts +5 -0
  13. package/dist/ts/accordion/index.ts +5 -0
  14. package/dist/ts/appbar/appbar-model.d.ts +76 -0
  15. package/dist/ts/appbar/appbar.d.ts +115 -0
  16. package/dist/ts/appbar/appbar.ts +281 -0
  17. package/dist/ts/appbar/index.d.ts +3 -0
  18. package/dist/ts/appbar/index.ts +3 -0
  19. package/dist/ts/breadcrumb/breadcrumb-model.d.ts +170 -0
  20. package/dist/ts/breadcrumb/breadcrumb.d.ts +297 -0
  21. package/dist/ts/breadcrumb/breadcrumb.ts +959 -0
  22. package/dist/ts/breadcrumb/index.d.ts +5 -0
  23. package/dist/ts/breadcrumb/index.ts +5 -0
  24. package/dist/ts/carousel/carousel-model.d.ts +282 -0
  25. package/dist/ts/carousel/carousel.d.ts +439 -0
  26. package/dist/ts/carousel/carousel.ts +1633 -0
  27. package/dist/ts/carousel/index.d.ts +3 -0
  28. package/dist/ts/carousel/index.ts +3 -0
  29. package/dist/ts/common/h-scroll-model.d.ts +16 -0
  30. package/dist/ts/common/h-scroll.d.ts +105 -0
  31. package/dist/ts/common/h-scroll.ts +481 -0
  32. package/dist/ts/common/index.d.ts +9 -0
  33. package/dist/ts/common/index.ts +10 -0
  34. package/dist/ts/common/menu-base-model.d.ts +308 -0
  35. package/dist/ts/common/menu-base.d.ts +558 -0
  36. package/dist/ts/common/menu-base.ts +2736 -0
  37. package/dist/ts/common/menu-scroll.d.ts +29 -0
  38. package/dist/ts/common/menu-scroll.ts +105 -0
  39. package/dist/ts/common/v-scroll-model.d.ts +16 -0
  40. package/dist/ts/common/v-scroll.d.ts +106 -0
  41. package/dist/ts/common/v-scroll.ts +454 -0
  42. package/dist/ts/context-menu/context-menu-model.d.ts +47 -0
  43. package/dist/ts/context-menu/context-menu.d.ts +102 -0
  44. package/dist/ts/context-menu/context-menu.ts +165 -0
  45. package/dist/ts/context-menu/index.d.ts +5 -0
  46. package/dist/ts/context-menu/index.ts +5 -0
  47. package/dist/ts/index.d.ts +16 -0
  48. package/dist/ts/index.ts +16 -0
  49. package/dist/ts/menu/index.d.ts +5 -0
  50. package/dist/ts/menu/index.ts +5 -0
  51. package/dist/ts/menu/menu-model.d.ts +70 -0
  52. package/dist/ts/menu/menu.d.ts +127 -0
  53. package/dist/ts/menu/menu.ts +313 -0
  54. package/dist/ts/sidebar/index.d.ts +5 -0
  55. package/dist/ts/sidebar/index.ts +5 -0
  56. package/dist/ts/sidebar/sidebar-model.d.ts +200 -0
  57. package/dist/ts/sidebar/sidebar.d.ts +336 -0
  58. package/dist/ts/sidebar/sidebar.ts +907 -0
  59. package/dist/ts/stepper/index.d.ts +3 -0
  60. package/dist/ts/stepper/index.ts +3 -0
  61. package/dist/ts/stepper/stepper-model.d.ts +159 -0
  62. package/dist/ts/stepper/stepper.d.ts +381 -0
  63. package/dist/ts/stepper/stepper.ts +1350 -0
  64. package/dist/ts/stepper-base/index.d.ts +5 -0
  65. package/dist/ts/stepper-base/index.ts +6 -0
  66. package/dist/ts/stepper-base/stepper-base-model.d.ts +124 -0
  67. package/dist/ts/stepper-base/stepper-base.d.ts +187 -0
  68. package/dist/ts/stepper-base/stepper-base.ts +290 -0
  69. package/dist/ts/tab/index.d.ts +5 -0
  70. package/dist/ts/tab/index.ts +5 -0
  71. package/dist/ts/tab/tab-model.d.ts +408 -0
  72. package/dist/ts/tab/tab.d.ts +715 -0
  73. package/dist/ts/tab/tab.ts +2842 -0
  74. package/dist/ts/toolbar/index.d.ts +5 -0
  75. package/dist/ts/toolbar/index.ts +5 -0
  76. package/dist/ts/toolbar/toolbar-model.d.ts +294 -0
  77. package/dist/ts/toolbar/toolbar.d.ts +541 -0
  78. package/dist/ts/toolbar/toolbar.ts +2646 -0
  79. package/dist/ts/treeview/index.d.ts +5 -0
  80. package/dist/ts/treeview/index.ts +5 -0
  81. package/dist/ts/treeview/treeview-model.d.ts +637 -0
  82. package/dist/ts/treeview/treeview.d.ts +1518 -0
  83. package/dist/ts/treeview/treeview.ts +6780 -0
  84. package/package.json +70 -17
  85. package/src/context-menu/context-menu-model.d.ts +1 -1
  86. package/src/context-menu/context-menu.js +1 -1
  87. package/styles/accordion/_bootstrap-dark-definition.scss +1 -1
  88. package/styles/accordion/_bootstrap-definition.scss +1 -1
  89. package/styles/accordion/bootstrap-dark.css +1 -1
  90. package/styles/accordion/bootstrap.css +1 -1
  91. package/styles/bds-lite.css +1 -1
  92. package/styles/bds.css +1 -1
  93. package/styles/bootstrap-dark-lite.css +2 -2
  94. package/styles/bootstrap-dark.css +2 -2
  95. package/styles/bootstrap-lite.css +2 -2
  96. package/styles/bootstrap.css +2 -2
  97. package/styles/bootstrap4-lite.css +1 -1
  98. package/styles/bootstrap4.css +1 -1
  99. package/styles/bootstrap5-dark-lite.css +1 -1
  100. package/styles/bootstrap5-dark.css +1 -1
  101. package/styles/bootstrap5-lite.css +1 -1
  102. package/styles/bootstrap5.3-lite.css +1 -1
  103. package/styles/bootstrap5.3.css +9 -1
  104. package/styles/bootstrap5.css +1 -1
  105. package/styles/fabric-dark-lite.css +1 -1
  106. package/styles/fabric-dark.css +1 -1
  107. package/styles/fabric-lite.css +1 -1
  108. package/styles/fabric.css +1 -1
  109. package/styles/fluent-dark-lite.css +1 -1
  110. package/styles/fluent-dark.css +1 -1
  111. package/styles/fluent-lite.css +1 -1
  112. package/styles/fluent.css +1 -1
  113. package/styles/fluent2-lite.css +4 -1
  114. package/styles/fluent2.css +4 -1
  115. package/styles/h-scroll/_layout.scss +1 -1
  116. package/styles/h-scroll/bds.css +1 -1
  117. package/styles/h-scroll/bootstrap-dark.css +1 -1
  118. package/styles/h-scroll/bootstrap.css +1 -1
  119. package/styles/h-scroll/bootstrap4.css +1 -1
  120. package/styles/h-scroll/bootstrap5-dark.css +1 -1
  121. package/styles/h-scroll/bootstrap5.3.css +1 -1
  122. package/styles/h-scroll/bootstrap5.css +1 -1
  123. package/styles/h-scroll/fabric-dark.css +1 -1
  124. package/styles/h-scroll/fabric.css +1 -1
  125. package/styles/h-scroll/fluent-dark.css +1 -1
  126. package/styles/h-scroll/fluent.css +1 -1
  127. package/styles/h-scroll/fluent2.css +1 -1
  128. package/styles/h-scroll/highcontrast-light.css +1 -1
  129. package/styles/h-scroll/highcontrast.css +1 -1
  130. package/styles/h-scroll/material-dark.css +1 -1
  131. package/styles/h-scroll/material.css +1 -1
  132. package/styles/h-scroll/material3-dark.css +1 -1
  133. package/styles/h-scroll/material3.css +1 -1
  134. package/styles/h-scroll/tailwind-dark.css +1 -1
  135. package/styles/h-scroll/tailwind.css +1 -1
  136. package/styles/h-scroll/tailwind3.css +1 -1
  137. package/styles/highcontrast-light-lite.css +1 -1
  138. package/styles/highcontrast-light.css +1 -1
  139. package/styles/highcontrast-lite.css +1 -1
  140. package/styles/highcontrast.css +1 -1
  141. package/styles/material-dark-lite.css +1 -1
  142. package/styles/material-dark.css +1 -1
  143. package/styles/material-lite.css +1 -1
  144. package/styles/material.css +1 -1
  145. package/styles/material3-dark-lite.css +1 -1
  146. package/styles/material3-dark.css +1 -7
  147. package/styles/material3-lite.css +1 -1
  148. package/styles/material3.css +1 -7
  149. package/styles/tailwind-dark-lite.css +1 -1
  150. package/styles/tailwind-dark.css +1 -1
  151. package/styles/tailwind-lite.css +1 -1
  152. package/styles/tailwind.css +1 -1
  153. package/styles/tailwind3-lite.css +1 -1
  154. package/styles/tailwind3.css +1 -1
  155. package/styles/toolbar/_layout.scss +1 -1
  156. package/styles/treeview/_bigger.scss +2 -2
  157. package/styles/treeview/_bootstrap5.3-definition.scss +1 -0
  158. package/styles/treeview/_layout.scss +3 -0
  159. package/styles/treeview/bootstrap5.3.css +8 -0
  160. package/styles/treeview/fluent2.css +3 -0
  161. package/styles/treeview/material3-dark.css +0 -6
  162. package/styles/treeview/material3.css +0 -6
@@ -0,0 +1,3 @@
1
+ /** Carousel export modules */
2
+ export * from './carousel';
3
+ export * from './carousel-model';
@@ -0,0 +1,3 @@
1
+ /** Carousel export modules */
2
+ export * from './carousel';
3
+ export * from './carousel-model';
@@ -0,0 +1,16 @@
1
+ import { Touch, ScrollEventArgs, TouchEventArgs, Component, EventHandler, selectAll, getUniqueID } from '@syncfusion/ej2-base';import { NotifyPropertyChanges, INotifyPropertyChanged, Property, Browser, detach } from '@syncfusion/ej2-base';import { classList, SwipeEventArgs, isNullOrUndefined} from '@syncfusion/ej2-base';
2
+ import {ComponentModel} from '@syncfusion/ej2-base';
3
+
4
+ /**
5
+ * Interface for a class HScroll
6
+ */
7
+ export interface HScrollModel extends ComponentModel{
8
+
9
+ /**
10
+ * Specifies the left or right scrolling distance of the horizontal scrollbar moving.
11
+ *
12
+ * @default null
13
+ */
14
+ scrollStep?: number;
15
+
16
+ }
@@ -0,0 +1,105 @@
1
+ import { Component } from '@syncfusion/ej2-base';
2
+ import { INotifyPropertyChanged } from '@syncfusion/ej2-base';
3
+ import { HScrollModel } from './h-scroll-model';
4
+ /**
5
+ * HScroll module is introduces horizontal scroller when content exceeds the current viewing area.
6
+ * It can be useful for the components like Toolbar, Tab which needs horizontal scrolling alone.
7
+ * Hidden content can be view by touch moving or icon click.
8
+ * ```html
9
+ * <div id="scroll"/>
10
+ * <script>
11
+ * var scrollObj = new HScroll();
12
+ * scrollObj.appendTo("#scroll");
13
+ * </script>
14
+ * ```
15
+ */
16
+ export declare class HScroll extends Component<HTMLElement> implements INotifyPropertyChanged {
17
+ private isDevice;
18
+ private touchModule;
19
+ private scrollEle;
20
+ private scrollItems;
21
+ private uniqueId;
22
+ private timeout;
23
+ private keyTimeout;
24
+ private keyTimer;
25
+ private browser;
26
+ private browserCheck;
27
+ private ieCheck;
28
+ private customStep;
29
+ /**
30
+ * Specifies the left or right scrolling distance of the horizontal scrollbar moving.
31
+ *
32
+ * @default null
33
+ */
34
+ scrollStep: number;
35
+ /**
36
+ * Initialize the event handler
37
+ *
38
+ * @private
39
+ * @returns {void}
40
+ */
41
+ protected preRender(): void;
42
+ /**
43
+ * To Initialize the horizontal scroll rendering
44
+ *
45
+ * @private
46
+ * @returns {void}
47
+ */
48
+ protected render(): void;
49
+ private setScrollState;
50
+ /**
51
+ * Initializes a new instance of the HScroll class.
52
+ *
53
+ * @param {HScrollModel} options - Specifies HScroll model properties as options.
54
+ * @param {string | HTMLElement} element - Specifies the element for which horizontal scrolling applies.
55
+ */
56
+ constructor(options?: HScrollModel, element?: string | HTMLElement);
57
+ private initialize;
58
+ protected getPersistData(): string;
59
+ /**
60
+ * Returns the current module name.
61
+ *
62
+ * @returns {string} - It returns the current module name.
63
+ * @private
64
+ */
65
+ protected getModuleName(): string;
66
+ /**
67
+ * Removes the control from the DOM and also removes all its related events.
68
+ *
69
+ * @returns {void}
70
+ */
71
+ destroy(): void;
72
+ /**
73
+ * Specifies the value to disable/enable the HScroll component.
74
+ * When set to `true` , the component will be disabled.
75
+ *
76
+ * @param {boolean} value - Based on this Boolean value, HScroll will be enabled (false) or disabled (true).
77
+ * @returns {void}.
78
+ */
79
+ disable(value: boolean): void;
80
+ private createOverlay;
81
+ private createNavIcon;
82
+ private onKeyPress;
83
+ private onKeyUp;
84
+ private eventBinding;
85
+ private repeatScroll;
86
+ private tabHoldHandler;
87
+ private contains;
88
+ private eleScrolling;
89
+ private clickEventHandler;
90
+ private swipeHandler;
91
+ private scrollUpdating;
92
+ private frameScrollRequest;
93
+ private touchHandler;
94
+ private arrowDisabling;
95
+ private scrollHandler;
96
+ /**
97
+ * Gets called when the model property changes.The data that describes the old and new values of property that changed.
98
+ *
99
+ * @param {HScrollModel} newProp - It contains the new value of data.
100
+ * @param {HScrollModel} oldProp - It contains the old value of data.
101
+ * @returns {void}
102
+ * @private
103
+ */
104
+ onPropertyChanged(newProp: HScrollModel, oldProp: HScrollModel): void;
105
+ }
@@ -0,0 +1,481 @@
1
+ import { Touch, ScrollEventArgs, TouchEventArgs, Component, EventHandler, selectAll, getUniqueID } from '@syncfusion/ej2-base';
2
+ import { NotifyPropertyChanges, INotifyPropertyChanged, Property, Browser, detach } from '@syncfusion/ej2-base';
3
+ import { classList, SwipeEventArgs, isNullOrUndefined} from '@syncfusion/ej2-base';
4
+ import { HScrollModel } from './h-scroll-model';
5
+
6
+ type HTEle = HTMLElement;
7
+
8
+ const CLS_ROOT: string = 'e-hscroll';
9
+ const CLS_RTL: string = 'e-rtl';
10
+ const CLS_DISABLE: string = 'e-overlay';
11
+ const CLS_HSCROLLBAR: string = 'e-hscroll-bar';
12
+ const CLS_HSCROLLCON: string = 'e-hscroll-content';
13
+ const CLS_NAVARROW: string = 'e-nav-arrow';
14
+ const CLS_NAVRIGHTARROW: string = 'e-nav-right-arrow';
15
+ const CLS_NAVLEFTARROW: string = 'e-nav-left-arrow';
16
+ const CLS_HSCROLLNAV: string = 'e-scroll-nav';
17
+ const CLS_HSCROLLNAVRIGHT: string = 'e-scroll-right-nav';
18
+ const CLS_HSCROLLNAVLEFT: string = 'e-scroll-left-nav';
19
+ const CLS_DEVICE: string = 'e-scroll-device';
20
+ const CLS_OVERLAY: string = 'e-scroll-overlay';
21
+ const CLS_RIGHTOVERLAY: string = 'e-scroll-right-overlay';
22
+ const CLS_LEFTOVERLAY: string = 'e-scroll-left-overlay';
23
+ const OVERLAY_MAXWID: number = 40;
24
+
25
+ interface TapEventArgs {
26
+ name: string
27
+ originalEvent: TouchEventArgs | TouchEvent | KeyboardEvent
28
+ }
29
+ /**
30
+ * HScroll module is introduces horizontal scroller when content exceeds the current viewing area.
31
+ * It can be useful for the components like Toolbar, Tab which needs horizontal scrolling alone.
32
+ * Hidden content can be view by touch moving or icon click.
33
+ * ```html
34
+ * <div id="scroll"/>
35
+ * <script>
36
+ * var scrollObj = new HScroll();
37
+ * scrollObj.appendTo("#scroll");
38
+ * </script>
39
+ * ```
40
+ */
41
+ @NotifyPropertyChanges
42
+ export class HScroll extends Component<HTMLElement> implements INotifyPropertyChanged {
43
+ /* eslint-disable */
44
+ private isDevice: Boolean;
45
+ private touchModule: Touch;
46
+ private scrollEle: HTEle;
47
+ private scrollItems: HTEle;
48
+ private uniqueId: boolean;
49
+ private timeout: number;
50
+ private keyTimeout: boolean;
51
+ private keyTimer: number;
52
+ private browser: string;
53
+ private browserCheck: boolean;
54
+ private ieCheck: boolean;
55
+ private customStep: boolean;
56
+
57
+ /**
58
+ * Specifies the left or right scrolling distance of the horizontal scrollbar moving.
59
+ *
60
+ * @default null
61
+ */
62
+ @Property(null)
63
+ public scrollStep: number;
64
+ /**
65
+ * Initialize the event handler
66
+ *
67
+ * @private
68
+ * @returns {void}
69
+ */
70
+ protected preRender(): void {
71
+ this.browser = Browser.info.name;
72
+ this.browserCheck = this.browser === 'mozilla';
73
+ this.isDevice = Browser.isDevice;
74
+ this.customStep = true;
75
+ const element: HTEle = this.element;
76
+ this.ieCheck = this.browser === 'edge' || this.browser === 'msie';
77
+ this.initialize();
78
+ if (element.id === '') {
79
+ element.id = getUniqueID('hscroll');
80
+ this.uniqueId = true;
81
+ }
82
+ element.style.display = 'block';
83
+ if (this.enableRtl) {
84
+ element.classList.add(CLS_RTL);
85
+ }
86
+ }
87
+ /**
88
+ * To Initialize the horizontal scroll rendering
89
+ *
90
+ * @private
91
+ * @returns {void}
92
+ */
93
+ protected render(): void {
94
+ this.touchModule = new Touch(this.element, { scroll: this.touchHandler.bind(this), swipe: this.swipeHandler.bind(this) });
95
+ EventHandler.add(this.scrollEle, 'scroll', this.scrollHandler, this);
96
+ if ( !this.isDevice) {
97
+ this.createNavIcon(this.element);
98
+ } else {
99
+ this.element.classList.add(CLS_DEVICE);
100
+ this.createOverlay(this.element);
101
+ }
102
+ this.setScrollState();
103
+ }
104
+ private setScrollState(): void {
105
+ if (isNullOrUndefined(this.scrollStep) || this.scrollStep < 0) {
106
+ this.scrollStep = this.scrollEle.offsetWidth;
107
+ this.customStep = false;
108
+ } else {
109
+ this.customStep = true;
110
+ }
111
+ }
112
+ /**
113
+ * Initializes a new instance of the HScroll class.
114
+ *
115
+ * @param {HScrollModel} options - Specifies HScroll model properties as options.
116
+ * @param {string | HTMLElement} element - Specifies the element for which horizontal scrolling applies.
117
+ */
118
+ public constructor(options?: HScrollModel, element?: string | HTMLElement) {
119
+ super(options, <HTEle | string>element);
120
+ }
121
+ private initialize(): void {
122
+ const scrollEle: HTEle = this.createElement('div', { className: CLS_HSCROLLCON });
123
+ const scrollDiv: HTEle = this.createElement('div', { className: CLS_HSCROLLBAR });
124
+ scrollDiv.setAttribute('tabindex', '-1');
125
+ const ele: HTEle = this.element;
126
+ const innerEle: HTEle[] = [].slice.call(ele.children);
127
+ for (const ele of innerEle) {
128
+ scrollEle.appendChild(ele);
129
+ }
130
+ scrollDiv.appendChild(scrollEle);
131
+ ele.appendChild(scrollDiv);
132
+ scrollDiv.style.overflowX = 'hidden';
133
+ this.scrollEle = scrollDiv;
134
+ this.scrollItems = scrollEle;
135
+ }
136
+ protected getPersistData(): string {
137
+ const keyEntity: string[] = ['scrollStep'];
138
+ return this.addOnPersist(keyEntity);
139
+ }
140
+ /**
141
+ * Returns the current module name.
142
+ *
143
+ * @returns {string} - It returns the current module name.
144
+ * @private
145
+ */
146
+ protected getModuleName(): string {
147
+ return 'hScroll';
148
+ }
149
+ /**
150
+ * Removes the control from the DOM and also removes all its related events.
151
+ *
152
+ * @returns {void}
153
+ */
154
+ public destroy(): void {
155
+ const ele: HTEle = this.element;
156
+ ele.style.display = '';
157
+ ele.classList.remove(CLS_ROOT);
158
+ ele.classList.remove(CLS_DEVICE);
159
+ ele.classList.remove(CLS_RTL);
160
+ const nav: HTEle[] = selectAll('.e-' + ele.id + '_nav.' + CLS_HSCROLLNAV, ele);
161
+ const overlay: HTEle[] = selectAll('.' + CLS_OVERLAY, ele);
162
+ [].slice.call(overlay).forEach((ele: HTEle) => {
163
+ detach(ele);
164
+ });
165
+ for (const elem of [].slice.call(this.scrollItems.children)) {
166
+ ele.appendChild(elem);
167
+ }
168
+ if (this.uniqueId) {
169
+ this.element.removeAttribute('id');
170
+ }
171
+ detach(this.scrollEle);
172
+ if (nav.length > 0) {
173
+ detach(nav[0]);
174
+ if (!isNullOrUndefined(nav[1])) {
175
+ detach(nav[1]);
176
+ }
177
+ }
178
+ EventHandler.remove(this.scrollEle, 'scroll', this.scrollHandler);
179
+ this.touchModule.destroy();
180
+ this.touchModule = null;
181
+ super.destroy();
182
+ }
183
+ /**
184
+ * Specifies the value to disable/enable the HScroll component.
185
+ * When set to `true` , the component will be disabled.
186
+ *
187
+ * @param {boolean} value - Based on this Boolean value, HScroll will be enabled (false) or disabled (true).
188
+ * @returns {void}.
189
+ */
190
+ public disable(value: boolean): void {
191
+ const navEles: HTMLElement[] = selectAll('.e-scroll-nav:not(.' + CLS_DISABLE + ')', this.element );
192
+ if (value) {
193
+ this.element.classList.add(CLS_DISABLE);
194
+ } else {
195
+ this.element.classList.remove(CLS_DISABLE);
196
+ }
197
+ [].slice.call(navEles).forEach((el: HTMLElement) => {
198
+ el.setAttribute('tabindex', !value ? '0' : '-1');
199
+ });
200
+ }
201
+ private createOverlay(element: HTEle): void {
202
+ const id: string = element.id.concat('_nav');
203
+ const rightOverlayEle: HTEle = this.createElement('div', {className: CLS_OVERLAY + ' ' + CLS_RIGHTOVERLAY});
204
+ const clsRight: string = 'e-' + element.id.concat('_nav ' + CLS_HSCROLLNAV + ' ' + CLS_HSCROLLNAVRIGHT);
205
+ const rightEle: HTEle = this.createElement('div', { id: id.concat('_right'), className: clsRight });
206
+ const navItem: HTEle = this.createElement('div', { className: CLS_NAVRIGHTARROW + ' ' + CLS_NAVARROW + ' e-icons' });
207
+ rightEle.appendChild(navItem);
208
+ const leftEle: HTEle = this.createElement('div', {className: CLS_OVERLAY + ' ' + CLS_LEFTOVERLAY});
209
+ if (this.ieCheck ) {
210
+ rightEle.classList.add('e-ie-align');
211
+ }
212
+ element.appendChild(rightOverlayEle);
213
+ element.appendChild(rightEle);
214
+ element.insertBefore(leftEle, element.firstChild);
215
+ this.eventBinding([rightEle]);
216
+ }
217
+ private createNavIcon(element: HTEle): void {
218
+ const id: string = element.id.concat('_nav');
219
+ const clsRight: string = 'e-' + element.id.concat('_nav ' + CLS_HSCROLLNAV + ' ' + CLS_HSCROLLNAVRIGHT);
220
+ const rightAttributes: { [key: string]: string; } = { 'role': 'button', 'id': id.concat('_right'), 'aria-label': 'Scroll right' };
221
+ const nav: HTEle = this.createElement('div', { className: clsRight, attrs: rightAttributes });
222
+ nav.setAttribute('aria-disabled', 'false');
223
+ const navItem: HTEle = this.createElement('div', { className: CLS_NAVRIGHTARROW + ' ' + CLS_NAVARROW + ' e-icons' });
224
+ const clsLeft: string = 'e-' + element.id.concat('_nav ' + CLS_HSCROLLNAV + ' ' + CLS_HSCROLLNAVLEFT);
225
+ const leftAttributes: { [key: string]: string; } = { 'role': 'button', 'id': id.concat('_left'), 'aria-label': 'Scroll left' };
226
+ const navEle: HTEle = this.createElement('div', { className: clsLeft + ' ' + CLS_DISABLE, attrs: leftAttributes });
227
+ navEle.setAttribute('aria-disabled', 'true');
228
+ const navLeftItem: HTEle = this.createElement('div', { className: CLS_NAVLEFTARROW + ' ' + CLS_NAVARROW + ' e-icons' });
229
+ navEle.appendChild(navLeftItem);
230
+ nav.appendChild(navItem);
231
+ element.appendChild(nav);
232
+ element.insertBefore(navEle, element.firstChild);
233
+ if (this.ieCheck ) {
234
+ nav.classList.add('e-ie-align');
235
+ navEle.classList.add('e-ie-align');
236
+ }
237
+ this.eventBinding([nav, navEle]);
238
+ }
239
+ private onKeyPress(e: KeyboardEvent): void {
240
+ if (e.key === 'Enter') {
241
+ const timeoutFun: () => void = () => {
242
+ this.keyTimeout = true;
243
+ this.eleScrolling(10, <HTEle>e.target, true);
244
+ };
245
+ this.keyTimer = window.setTimeout(
246
+ () => {
247
+ timeoutFun();
248
+ }, 100);
249
+ }
250
+ }
251
+ private onKeyUp(e: KeyboardEvent): void {
252
+ if (e.key !== 'Enter') {
253
+ return;
254
+ }
255
+ if (this.keyTimeout) {
256
+ this.keyTimeout = false;
257
+ } else {
258
+ (<HTEle>e.target).click();
259
+ }
260
+ clearTimeout(this.keyTimer);
261
+ }
262
+ private eventBinding(ele: HTEle[]): void {
263
+ [].slice.call(ele).forEach((el: HTEle) => {
264
+ new Touch(el, {tapHold: this.tabHoldHandler.bind(this), tapHoldThreshold: 500 });
265
+ el.addEventListener('keydown' , this.onKeyPress.bind(this));
266
+ el.addEventListener('keyup', this.onKeyUp.bind(this));
267
+ el.addEventListener('mouseup', this.repeatScroll.bind(this));
268
+ el.addEventListener('touchend', this.repeatScroll.bind(this));
269
+ el.addEventListener('contextmenu', (e: Event) => {
270
+ e.preventDefault();
271
+ });
272
+ EventHandler.add(el, 'click', this.clickEventHandler, this);
273
+ });
274
+ }
275
+ private repeatScroll(): void {
276
+ clearInterval (this.timeout);
277
+ }
278
+ private tabHoldHandler(e: TapEventArgs): void {
279
+ let trgt: HTEle = e.originalEvent.target as HTEle;
280
+ trgt = this.contains(trgt, CLS_HSCROLLNAV) ? <HTEle>trgt.firstElementChild : trgt;
281
+ const scrollDis: number = 10;
282
+ const timeoutFun: () => void = () => {
283
+ this.eleScrolling(scrollDis, trgt, true);
284
+ };
285
+ this.timeout = window.setInterval(
286
+ () => {
287
+ timeoutFun();
288
+ }, 50);
289
+ }
290
+ private contains(ele: HTEle, className: string): boolean {
291
+ return ele.classList.contains(className);
292
+ }
293
+ private eleScrolling(scrollDis: number, trgt: HTEle, isContinuous: boolean ): void {
294
+ const rootEle: HTEle = this.element;
295
+ let classList: DOMTokenList = trgt.classList;
296
+ if (classList.contains(CLS_HSCROLLNAV)) {
297
+ classList = trgt.querySelector('.' + CLS_NAVARROW).classList;
298
+ }
299
+ if (this.contains(rootEle, CLS_RTL) && this.browserCheck) {
300
+ scrollDis = - scrollDis;
301
+ }
302
+ if ((!this.contains(rootEle, CLS_RTL) || this.browserCheck) || this.ieCheck) {
303
+ if (classList.contains(CLS_NAVRIGHTARROW)) {
304
+ this.frameScrollRequest(scrollDis, 'add', isContinuous);
305
+ } else {
306
+ this.frameScrollRequest(scrollDis, '', isContinuous);
307
+ }
308
+ } else {
309
+ if (classList.contains(CLS_NAVLEFTARROW)) {
310
+ this.frameScrollRequest(scrollDis, 'add', isContinuous);
311
+ } else {
312
+ this.frameScrollRequest(scrollDis, '', isContinuous);
313
+ }
314
+ }
315
+ }
316
+ private clickEventHandler(e: Event): void {
317
+ this.eleScrolling(this.scrollStep , <HTEle>e.target, false);
318
+ }
319
+
320
+ private swipeHandler(e: SwipeEventArgs): void {
321
+ const swipeEle: HTEle = this.scrollEle;
322
+ let distance: number;
323
+ if (e.velocity <= 1) {
324
+ distance = e.distanceX / (e.velocity * 10);
325
+ } else {
326
+ distance = e.distanceX / e.velocity;
327
+ }
328
+ let start: number = 0.5;
329
+ const animate: () => void = () => {
330
+ const step: number = Math.sin(start);
331
+ if (step <= 0) {
332
+ window.cancelAnimationFrame(step);
333
+ } else {
334
+ if (e.swipeDirection === 'Left') {
335
+ swipeEle.scrollLeft += distance * step;
336
+ } else if (e.swipeDirection === 'Right') {
337
+ swipeEle.scrollLeft -= distance * step;
338
+ }
339
+ start -= 0.5;
340
+ window.requestAnimationFrame(animate as FrameRequestCallback);
341
+ }
342
+ };
343
+ animate();
344
+ }
345
+
346
+ private scrollUpdating(scrollVal: number, action: string): void {
347
+ if (action === 'add') {
348
+ this.scrollEle.scrollLeft += scrollVal;
349
+ } else {
350
+ this.scrollEle.scrollLeft -= scrollVal;
351
+ }
352
+ if (this.enableRtl && this.scrollEle.scrollLeft > 0) {
353
+ this.scrollEle.scrollLeft = 0;
354
+ }
355
+ }
356
+
357
+ private frameScrollRequest(scrollVal: number, action: string, isContinuous: boolean): void {
358
+ const step: number = 10;
359
+ if (isContinuous) {
360
+ this.scrollUpdating(scrollVal, action);
361
+ return;
362
+ }
363
+ if (!this.customStep) {
364
+ [].slice.call(selectAll('.' + CLS_OVERLAY, this.element)).forEach((el: HTMLElement) => {
365
+ scrollVal -= el.offsetWidth;
366
+ });
367
+ }
368
+ const animate: () => void = () => {
369
+ let scrollValue: number;
370
+ let scrollStep: number;
371
+ if (this.contains(this.element, CLS_RTL) && this.browserCheck) {
372
+ scrollValue = - scrollVal;
373
+ scrollStep = - step;
374
+ } else {
375
+ scrollValue = scrollVal;
376
+ scrollStep = step;
377
+ }
378
+ if (scrollValue < step) {
379
+ window.cancelAnimationFrame(scrollStep);
380
+ } else {
381
+ this.scrollUpdating(scrollStep, action);
382
+ scrollVal -= scrollStep;
383
+ window.requestAnimationFrame(animate as FrameRequestCallback);
384
+ }
385
+ };
386
+ animate();
387
+ }
388
+
389
+ private touchHandler(e: ScrollEventArgs): void {
390
+ const ele: HTEle = this.scrollEle;
391
+ let distance: number = e.distanceX;
392
+ if ((this.ieCheck) && this.contains(this.element, CLS_RTL)) {
393
+ distance = - distance;
394
+ }
395
+ if (e.scrollDirection === 'Left') {
396
+ ele.scrollLeft = ele.scrollLeft + distance;
397
+ } else if (e.scrollDirection === 'Right') {
398
+ ele.scrollLeft = ele.scrollLeft - distance;
399
+ }
400
+ }
401
+ private arrowDisabling(addDisable: HTEle, removeDisable: HTEle): void {
402
+ if (this.isDevice) {
403
+ const arrowEle: HTMLElement = isNullOrUndefined(addDisable) ? removeDisable : addDisable;
404
+ const arrowIcon: HTMLElement = arrowEle.querySelector('.' + CLS_NAVARROW) as HTMLElement;
405
+ if (isNullOrUndefined(addDisable)) {
406
+ classList(arrowIcon, [CLS_NAVRIGHTARROW], [CLS_NAVLEFTARROW]);
407
+ } else {
408
+ classList(arrowIcon, [CLS_NAVLEFTARROW], [CLS_NAVRIGHTARROW]);
409
+ }
410
+ } else if (addDisable && removeDisable) {
411
+ addDisable.classList.add(CLS_DISABLE);
412
+ addDisable.setAttribute('aria-disabled' , 'true');
413
+ addDisable.removeAttribute('tabindex');
414
+ removeDisable.classList.remove(CLS_DISABLE);
415
+ removeDisable.setAttribute('aria-disabled' , 'false');
416
+ removeDisable.setAttribute('tabindex', '0');
417
+ }
418
+ this.repeatScroll();
419
+ }
420
+ private scrollHandler(e: Event): void {
421
+ const target: HTEle = <HTEle>e.target;
422
+ const width: number = target.offsetWidth;
423
+ const rootEle: HTEle = this.element;
424
+ const navLeftEle: HTEle = (<HTEle>this.element.querySelector('.' + CLS_HSCROLLNAVLEFT));
425
+ const navRightEle: HTEle = (<HTEle>this.element.querySelector('.' + CLS_HSCROLLNAVRIGHT));
426
+ let leftOverlay: HTEle = (<HTEle>this.element.querySelector('.' + CLS_LEFTOVERLAY));
427
+ let rightOverlay: HTEle = (<HTEle>this.element.querySelector('.' + CLS_RIGHTOVERLAY));
428
+ let scrollLeft: number = target.scrollLeft;
429
+ if (scrollLeft <= 0) {
430
+ scrollLeft = -scrollLeft;
431
+ }
432
+ if (this.isDevice) {
433
+ if (this.enableRtl && !(this.browserCheck || this.ieCheck)) {
434
+ leftOverlay = (<HTEle>this.element.querySelector('.' + CLS_RIGHTOVERLAY));
435
+ rightOverlay = (<HTEle>this.element.querySelector('.' + CLS_LEFTOVERLAY));
436
+ }
437
+ if (scrollLeft < OVERLAY_MAXWID) {
438
+ leftOverlay.style.width = scrollLeft + 'px';
439
+ } else {
440
+ leftOverlay.style.width = '40px';
441
+ }
442
+ if (( target.scrollWidth - Math.ceil(width + scrollLeft)) < OVERLAY_MAXWID ) {
443
+ rightOverlay.style.width = ( target.scrollWidth - Math.ceil(width + scrollLeft)) + 'px';
444
+ } else {
445
+ rightOverlay.style.width = '40px';
446
+ }
447
+ }
448
+ if (scrollLeft === 0) {
449
+ this.arrowDisabling(navLeftEle, navRightEle);
450
+ } else if (Math.ceil(width + scrollLeft + .1) >= target.scrollWidth) {
451
+ this.arrowDisabling(navRightEle, navLeftEle);
452
+ } else {
453
+ const disEle: HTEle = <HTEle>this.element.querySelector('.' + CLS_HSCROLLNAV + '.' + CLS_DISABLE);
454
+ if (disEle) {
455
+ disEle.classList.remove(CLS_DISABLE);
456
+ disEle.setAttribute('aria-disabled', 'false');
457
+ disEle.setAttribute('tabindex', '0');
458
+ }
459
+ }
460
+ }
461
+ /**
462
+ * Gets called when the model property changes.The data that describes the old and new values of property that changed.
463
+ *
464
+ * @param {HScrollModel} newProp - It contains the new value of data.
465
+ * @param {HScrollModel} oldProp - It contains the old value of data.
466
+ * @returns {void}
467
+ * @private
468
+ */
469
+ public onPropertyChanged(newProp: HScrollModel, oldProp: HScrollModel): void {
470
+ for (const prop of Object.keys(newProp)) {
471
+ switch (prop) {
472
+ case 'scrollStep':
473
+ this.setScrollState();
474
+ break;
475
+ case 'enableRtl':
476
+ newProp.enableRtl ? this.element.classList.add(CLS_RTL) : this.element.classList.remove(CLS_RTL);
477
+ break;
478
+ }
479
+ }
480
+ }
481
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Navigation Common modules
3
+ */
4
+ export * from './h-scroll';
5
+ export * from './v-scroll';
6
+ export * from './menu-scroll';
7
+ export { MenuEventArgs, OpenCloseMenuEventArgs, BeforeOpenCloseMenuEventArgs, MenuAnimationSettings, MenuEffect } from './menu-base';
8
+ export { MenuItem, FieldSettings } from './menu-base';
9
+ export { MenuItemModel, FieldSettingsModel, MenuAnimationSettingsModel } from './menu-base-model';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Navigation Common modules
3
+ */
4
+
5
+ export * from './h-scroll';
6
+ export * from './v-scroll';
7
+ export * from './menu-scroll';
8
+ export { MenuEventArgs, OpenCloseMenuEventArgs, BeforeOpenCloseMenuEventArgs, MenuAnimationSettings, MenuEffect } from './menu-base';
9
+ export { MenuItem, FieldSettings } from './menu-base';
10
+ export { MenuItemModel, FieldSettingsModel, MenuAnimationSettingsModel } from './menu-base-model';