@syncfusion/ej2-navigations 31.1.17 → 31.1.20
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/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 +1 -0
- package/dist/es6/ej2-navigations.es2015.js.map +1 -1
- package/dist/es6/ej2-navigations.es5.js +1 -0
- 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 +14 -67
- package/src/treeview/treeview.js +1 -0
- package/styles/bds-lite.css +7 -6
- package/styles/bds.css +7 -6
- package/styles/bootstrap-dark-lite.css +6 -3
- package/styles/bootstrap-dark.css +6 -3
- package/styles/bootstrap-lite.css +6 -3
- package/styles/bootstrap.css +6 -3
- package/styles/bootstrap4-lite.css +13 -9
- package/styles/bootstrap4.css +24 -13
- package/styles/bootstrap5-dark-lite.css +6 -5
- package/styles/bootstrap5-dark.css +16 -7
- package/styles/bootstrap5-lite.css +6 -5
- package/styles/bootstrap5.3-lite.css +23 -10
- package/styles/bootstrap5.3.css +34 -13
- package/styles/bootstrap5.css +16 -7
- package/styles/fabric-dark-lite.css +6 -3
- package/styles/fabric-dark.css +6 -3
- package/styles/fabric-lite.css +6 -3
- package/styles/fabric.css +6 -3
- package/styles/fluent-dark-lite.css +16 -12
- package/styles/fluent-dark.css +26 -15
- package/styles/fluent-lite.css +16 -12
- package/styles/fluent.css +26 -15
- package/styles/fluent2-lite.css +6 -4
- package/styles/fluent2.css +6 -4
- package/styles/highcontrast-light-lite.css +4 -4
- package/styles/highcontrast-light.css +4 -4
- package/styles/highcontrast-lite.css +14 -10
- package/styles/highcontrast.css +26 -13
- package/styles/material-dark-lite.css +19 -13
- package/styles/material-dark.css +39 -17
- package/styles/material-lite.css +19 -10
- package/styles/material.css +36 -13
- package/styles/material3-dark-lite.css +4 -4
- package/styles/material3-dark.css +5 -4
- package/styles/material3-lite.css +4 -4
- package/styles/material3.css +5 -4
- package/styles/menu/_bootstrap-dark-definition.scss +1 -0
- package/styles/menu/_bootstrap-definition.scss +1 -0
- package/styles/menu/_fluent-definition.scss +1 -1
- package/styles/menu/_fluent2-definition.scss +1 -1
- package/styles/menu/_layout.scss +7 -1
- package/styles/menu/bds.css +1 -0
- package/styles/menu/bootstrap-dark.css +1 -0
- package/styles/menu/bootstrap.css +1 -0
- package/styles/menu/bootstrap4.css +1 -0
- package/styles/menu/bootstrap5-dark.css +1 -0
- package/styles/menu/bootstrap5.3.css +1 -0
- package/styles/menu/bootstrap5.css +1 -0
- package/styles/menu/fabric-dark.css +1 -0
- package/styles/menu/fabric.css +1 -0
- package/styles/menu/fluent-dark.css +2 -1
- package/styles/menu/fluent.css +2 -1
- package/styles/menu/fluent2.css +2 -1
- package/styles/menu/highcontrast-light.css +1 -0
- package/styles/menu/highcontrast.css +1 -0
- package/styles/menu/material-dark.css +1 -0
- package/styles/menu/material.css +1 -0
- package/styles/menu/material3-dark.css +1 -0
- package/styles/menu/material3.css +1 -0
- package/styles/menu/tailwind-dark.css +1 -0
- package/styles/menu/tailwind.css +1 -0
- package/styles/menu/tailwind3.css +1 -0
- package/styles/tailwind-dark-lite.css +6 -5
- package/styles/tailwind-dark.css +6 -5
- package/styles/tailwind-lite.css +6 -5
- package/styles/tailwind.css +6 -5
- package/styles/tailwind3-lite.css +11 -5
- package/styles/tailwind3.css +18 -5
- package/styles/treeview/_bds-definition.scss +1 -1
- package/styles/treeview/_bigger.scss +91 -0
- package/styles/treeview/_bootstrap4-definition.scss +7 -7
- package/styles/treeview/_bootstrap5-definition.scss +2 -2
- package/styles/treeview/_bootstrap5.3-definition.scss +8 -8
- package/styles/treeview/_fluent-definition.scss +6 -6
- package/styles/treeview/_highcontrast-definition.scss +6 -6
- package/styles/treeview/_layout.scss +67 -16
- package/styles/treeview/_material-dark-definition.scss +7 -7
- package/styles/treeview/_material-definition.scss +6 -6
- package/styles/treeview/_tailwind3-definition.scss +1 -1
- package/styles/treeview/_theme.scss +7 -2
- package/styles/treeview/bds.css +6 -6
- package/styles/treeview/bootstrap-dark.css +5 -3
- package/styles/treeview/bootstrap.css +5 -3
- package/styles/treeview/bootstrap4.css +23 -13
- package/styles/treeview/bootstrap5-dark.css +15 -7
- package/styles/treeview/bootstrap5.3.css +33 -13
- package/styles/treeview/bootstrap5.css +15 -7
- package/styles/treeview/fabric-dark.css +5 -3
- package/styles/treeview/fabric.css +5 -3
- package/styles/treeview/fluent-dark.css +24 -14
- package/styles/treeview/fluent.css +24 -14
- package/styles/treeview/fluent2.css +4 -3
- package/styles/treeview/highcontrast-light.css +3 -4
- package/styles/treeview/highcontrast.css +25 -13
- package/styles/treeview/material-dark.css +38 -17
- package/styles/treeview/material.css +35 -13
- package/styles/treeview/material3-dark.css +4 -4
- package/styles/treeview/material3.css +4 -4
- package/styles/treeview/tailwind-dark.css +5 -5
- package/styles/treeview/tailwind.css +5 -5
- package/styles/treeview/tailwind3.css +17 -5
- package/dist/ts/accordion/accordion-model.d.ts +0 -285
- package/dist/ts/accordion/accordion.d.ts +0 -458
- package/dist/ts/accordion/accordion.ts +0 -1580
- package/dist/ts/accordion/index.d.ts +0 -5
- package/dist/ts/accordion/index.ts +0 -5
- package/dist/ts/appbar/appbar-model.d.ts +0 -76
- package/dist/ts/appbar/appbar.d.ts +0 -115
- package/dist/ts/appbar/appbar.ts +0 -281
- package/dist/ts/appbar/index.d.ts +0 -3
- package/dist/ts/appbar/index.ts +0 -3
- package/dist/ts/breadcrumb/breadcrumb-model.d.ts +0 -170
- package/dist/ts/breadcrumb/breadcrumb.d.ts +0 -297
- package/dist/ts/breadcrumb/breadcrumb.ts +0 -959
- package/dist/ts/breadcrumb/index.d.ts +0 -5
- package/dist/ts/breadcrumb/index.ts +0 -5
- package/dist/ts/carousel/carousel-model.d.ts +0 -282
- package/dist/ts/carousel/carousel.d.ts +0 -439
- package/dist/ts/carousel/carousel.ts +0 -1633
- package/dist/ts/carousel/index.d.ts +0 -3
- package/dist/ts/carousel/index.ts +0 -3
- package/dist/ts/common/h-scroll-model.d.ts +0 -16
- package/dist/ts/common/h-scroll.d.ts +0 -105
- package/dist/ts/common/h-scroll.ts +0 -481
- package/dist/ts/common/index.d.ts +0 -9
- package/dist/ts/common/index.ts +0 -10
- package/dist/ts/common/menu-base-model.d.ts +0 -308
- package/dist/ts/common/menu-base.d.ts +0 -558
- package/dist/ts/common/menu-base.ts +0 -2736
- package/dist/ts/common/menu-scroll.d.ts +0 -29
- package/dist/ts/common/menu-scroll.ts +0 -105
- package/dist/ts/common/v-scroll-model.d.ts +0 -16
- package/dist/ts/common/v-scroll.d.ts +0 -106
- package/dist/ts/common/v-scroll.ts +0 -454
- package/dist/ts/context-menu/context-menu-model.d.ts +0 -47
- package/dist/ts/context-menu/context-menu.d.ts +0 -102
- package/dist/ts/context-menu/context-menu.ts +0 -165
- package/dist/ts/context-menu/index.d.ts +0 -5
- package/dist/ts/context-menu/index.ts +0 -5
- package/dist/ts/index.d.ts +0 -16
- package/dist/ts/index.ts +0 -16
- package/dist/ts/menu/index.d.ts +0 -5
- package/dist/ts/menu/index.ts +0 -5
- package/dist/ts/menu/menu-model.d.ts +0 -70
- package/dist/ts/menu/menu.d.ts +0 -127
- package/dist/ts/menu/menu.ts +0 -313
- package/dist/ts/sidebar/index.d.ts +0 -5
- package/dist/ts/sidebar/index.ts +0 -5
- package/dist/ts/sidebar/sidebar-model.d.ts +0 -200
- package/dist/ts/sidebar/sidebar.d.ts +0 -336
- package/dist/ts/sidebar/sidebar.ts +0 -907
- package/dist/ts/stepper/index.d.ts +0 -3
- package/dist/ts/stepper/index.ts +0 -3
- package/dist/ts/stepper/stepper-model.d.ts +0 -159
- package/dist/ts/stepper/stepper.d.ts +0 -381
- package/dist/ts/stepper/stepper.ts +0 -1350
- package/dist/ts/stepper-base/index.d.ts +0 -5
- package/dist/ts/stepper-base/index.ts +0 -6
- package/dist/ts/stepper-base/stepper-base-model.d.ts +0 -124
- package/dist/ts/stepper-base/stepper-base.d.ts +0 -187
- package/dist/ts/stepper-base/stepper-base.ts +0 -290
- package/dist/ts/tab/index.d.ts +0 -5
- package/dist/ts/tab/index.ts +0 -5
- package/dist/ts/tab/tab-model.d.ts +0 -408
- package/dist/ts/tab/tab.d.ts +0 -715
- package/dist/ts/tab/tab.ts +0 -2842
- package/dist/ts/toolbar/index.d.ts +0 -5
- package/dist/ts/toolbar/index.ts +0 -5
- package/dist/ts/toolbar/toolbar-model.d.ts +0 -294
- package/dist/ts/toolbar/toolbar.d.ts +0 -541
- package/dist/ts/toolbar/toolbar.ts +0 -2646
- package/dist/ts/treeview/index.d.ts +0 -5
- package/dist/ts/treeview/index.ts +0 -5
- package/dist/ts/treeview/treeview-model.d.ts +0 -637
- package/dist/ts/treeview/treeview.d.ts +0 -1518
- package/dist/ts/treeview/treeview.ts +0 -6780
|
@@ -1,454 +0,0 @@
|
|
|
1
|
-
import { Touch, ScrollEventArgs, TouchEventArgs, Component, EventHandler, selectAll, getUniqueID, removeClass } from '@syncfusion/ej2-base';
|
|
2
|
-
import { NotifyPropertyChanges, INotifyPropertyChanged, Property, Browser, detach, createElement as buildTag } from '@syncfusion/ej2-base';
|
|
3
|
-
import { classList, SwipeEventArgs, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
4
|
-
import { VScrollModel } from './v-scroll-model';
|
|
5
|
-
|
|
6
|
-
type HTEle = HTMLElement;
|
|
7
|
-
type Str = string;
|
|
8
|
-
|
|
9
|
-
const CLS_ROOT: Str = 'e-vscroll';
|
|
10
|
-
const CLS_RTL: Str = 'e-rtl';
|
|
11
|
-
const CLS_DISABLE: Str = 'e-overlay';
|
|
12
|
-
const CLS_VSCROLLBAR: Str = 'e-vscroll-bar';
|
|
13
|
-
const CLS_VSCROLLCON: Str = 'e-vscroll-content';
|
|
14
|
-
const CLS_NAVARROW: Str = 'e-nav-arrow';
|
|
15
|
-
const CLS_NAVUPARROW: Str = 'e-nav-up-arrow';
|
|
16
|
-
const CLS_NAVDOWNARROW: Str = 'e-nav-down-arrow';
|
|
17
|
-
const CLS_VSCROLLNAV: Str = 'e-scroll-nav';
|
|
18
|
-
const CLS_VSCROLLNAVUP: Str = 'e-scroll-up-nav';
|
|
19
|
-
const CLS_VSCROLLNAVDOWN: Str = 'e-scroll-down-nav';
|
|
20
|
-
const CLS_DEVICE: Str = 'e-scroll-device';
|
|
21
|
-
const CLS_OVERLAY: Str = 'e-scroll-overlay';
|
|
22
|
-
const CLS_UPOVERLAY: Str = 'e-scroll-up-overlay';
|
|
23
|
-
const CLS_DOWNOVERLAY: Str = 'e-scroll-down-overlay';
|
|
24
|
-
const OVERLAY_MAXWID: number = 40;
|
|
25
|
-
|
|
26
|
-
interface TapEventArgs {
|
|
27
|
-
name: string
|
|
28
|
-
originalEvent: TouchEventArgs | TouchEvent | KeyboardEvent
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* VScroll module is introduces vertical scroller when content exceeds the current viewing area.
|
|
32
|
-
* It can be useful for the components like Toolbar, Tab which needs vertical scrolling alone.
|
|
33
|
-
* Hidden content can be view by touch moving or icon click.
|
|
34
|
-
* ```html
|
|
35
|
-
* <div id="scroll"/>
|
|
36
|
-
* <script>
|
|
37
|
-
* var scrollObj = new VScroll();
|
|
38
|
-
* scrollObj.appendTo("#scroll");
|
|
39
|
-
* </script>
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
@NotifyPropertyChanges
|
|
43
|
-
export class VScroll extends Component<HTMLElement> implements INotifyPropertyChanged {
|
|
44
|
-
private touchModule: Touch;
|
|
45
|
-
private scrollEle: HTEle;
|
|
46
|
-
private scrollItems: HTEle;
|
|
47
|
-
private uniqueId: boolean;
|
|
48
|
-
private timeout: number;
|
|
49
|
-
private keyTimeout: boolean;
|
|
50
|
-
private keyTimer: number;
|
|
51
|
-
private browser: string;
|
|
52
|
-
private browserCheck: boolean;
|
|
53
|
-
private ieCheck: boolean;
|
|
54
|
-
/* eslint-disable */
|
|
55
|
-
private isDevice: Boolean;
|
|
56
|
-
private customStep: boolean;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Specifies the up or down scrolling distance of the vertical scrollbar moving.
|
|
60
|
-
*
|
|
61
|
-
* @default null
|
|
62
|
-
*/
|
|
63
|
-
@Property(null)
|
|
64
|
-
public scrollStep: number;
|
|
65
|
-
/**
|
|
66
|
-
* Initialize the event handler
|
|
67
|
-
*
|
|
68
|
-
* @private
|
|
69
|
-
* @returns {void}
|
|
70
|
-
*/
|
|
71
|
-
protected preRender(): void {
|
|
72
|
-
this.browser = Browser.info.name;
|
|
73
|
-
this.browserCheck = this.browser === 'mozilla';
|
|
74
|
-
this.isDevice = Browser.isDevice;
|
|
75
|
-
this.customStep = true;
|
|
76
|
-
const ele: HTEle = this.element;
|
|
77
|
-
this.ieCheck = this.browser === 'edge' || this.browser === 'msie';
|
|
78
|
-
this.initialize();
|
|
79
|
-
if (ele.id === '') {
|
|
80
|
-
ele.id = getUniqueID('vscroll');
|
|
81
|
-
this.uniqueId = true;
|
|
82
|
-
}
|
|
83
|
-
ele.style.display = 'block';
|
|
84
|
-
if (this.enableRtl) {
|
|
85
|
-
ele.classList.add(CLS_RTL);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* To Initialize the vertical scroll rendering
|
|
90
|
-
*
|
|
91
|
-
* @private
|
|
92
|
-
* @returns {void}
|
|
93
|
-
*/
|
|
94
|
-
protected render(): void {
|
|
95
|
-
this.touchModule = new Touch(this.element, { scroll: this.touchHandler.bind(this), swipe: this.swipeHandler.bind(this) });
|
|
96
|
-
EventHandler.add(this.scrollEle, 'scroll', this.scrollEventHandler, this);
|
|
97
|
-
if (!this.isDevice) {
|
|
98
|
-
this.createNavIcon(this.element);
|
|
99
|
-
} else {
|
|
100
|
-
this.element.classList.add(CLS_DEVICE);
|
|
101
|
-
this.createOverlayElement(this.element);
|
|
102
|
-
}
|
|
103
|
-
this.setScrollState();
|
|
104
|
-
EventHandler.add(this.element, 'wheel', this.wheelEventHandler, this);
|
|
105
|
-
}
|
|
106
|
-
private setScrollState(): void {
|
|
107
|
-
if (isNullOrUndefined(this.scrollStep) || this.scrollStep < 0) {
|
|
108
|
-
this.scrollStep = this.scrollEle.offsetHeight;
|
|
109
|
-
this.customStep = false;
|
|
110
|
-
} else {
|
|
111
|
-
this.customStep = true;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Initializes a new instance of the VScroll class.
|
|
116
|
-
*
|
|
117
|
-
* @param {VScrollModel} options - Specifies VScroll model properties as options.
|
|
118
|
-
* @param {string | HTMLElement} element - Specifies the element for which vertical scrolling applies.
|
|
119
|
-
*/
|
|
120
|
-
public constructor(options?: VScrollModel, element?: string | HTMLElement) {
|
|
121
|
-
super(options, <HTEle | string>element);
|
|
122
|
-
}
|
|
123
|
-
private initialize(): void {
|
|
124
|
-
const scrollCnt: HTEle = buildTag('div', { className: CLS_VSCROLLCON });
|
|
125
|
-
const scrollBar: HTEle = buildTag('div', { className: CLS_VSCROLLBAR });
|
|
126
|
-
scrollBar.setAttribute('tabindex', '-1');
|
|
127
|
-
const ele: HTEle = this.element;
|
|
128
|
-
const innerEle: HTEle[] = [].slice.call(ele.children);
|
|
129
|
-
for (const ele of innerEle) {
|
|
130
|
-
scrollCnt.appendChild(ele);
|
|
131
|
-
}
|
|
132
|
-
scrollBar.appendChild(scrollCnt);
|
|
133
|
-
ele.appendChild(scrollBar);
|
|
134
|
-
scrollBar.style.overflow = 'hidden';
|
|
135
|
-
this.scrollEle = scrollBar;
|
|
136
|
-
this.scrollItems = scrollCnt;
|
|
137
|
-
}
|
|
138
|
-
protected getPersistData(): string {
|
|
139
|
-
const keyEntity: string[] = ['scrollStep'];
|
|
140
|
-
return this.addOnPersist(keyEntity);
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Returns the current module name.
|
|
144
|
-
*
|
|
145
|
-
* @returns {string} - It returns the current module name.
|
|
146
|
-
* @private
|
|
147
|
-
*/
|
|
148
|
-
protected getModuleName(): string {
|
|
149
|
-
return 'vScroll';
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Removes the control from the DOM and also removes all its related events.
|
|
153
|
-
*
|
|
154
|
-
* @returns {void}
|
|
155
|
-
*/
|
|
156
|
-
public destroy(): void {
|
|
157
|
-
const el: HTEle = this.element;
|
|
158
|
-
el.style.display = '';
|
|
159
|
-
removeClass([this.element], [CLS_ROOT, CLS_DEVICE, CLS_RTL]);
|
|
160
|
-
const navs: HTEle[] = selectAll('.e-' + el.id + '_nav.' + CLS_VSCROLLNAV, el);
|
|
161
|
-
const overlays: HTEle[] = selectAll('.' + CLS_OVERLAY, el);
|
|
162
|
-
[].slice.call(overlays).forEach((ele: HTMLElement) => {
|
|
163
|
-
detach(ele);
|
|
164
|
-
});
|
|
165
|
-
for (const elem of [].slice.call(this.scrollItems.children)) {
|
|
166
|
-
el.appendChild(elem);
|
|
167
|
-
}
|
|
168
|
-
if (this.uniqueId) {
|
|
169
|
-
this.element.removeAttribute('id');
|
|
170
|
-
}
|
|
171
|
-
detach(this.scrollEle);
|
|
172
|
-
if (navs.length > 0) {
|
|
173
|
-
detach(navs[0]);
|
|
174
|
-
if (!isNullOrUndefined(navs[1])) {
|
|
175
|
-
detach(navs[1]);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
EventHandler.remove(this.scrollEle, 'scroll', this.scrollEventHandler);
|
|
179
|
-
this.touchModule.destroy();
|
|
180
|
-
this.touchModule = null;
|
|
181
|
-
super.destroy();
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Specifies the value to disable/enable the VScroll component.
|
|
185
|
-
* When set to `true` , the component will be disabled.
|
|
186
|
-
*
|
|
187
|
-
* @param {boolean} value - Based on this Boolean value, VScroll will be enabled (false) or disabled (true).
|
|
188
|
-
* @returns {void}.
|
|
189
|
-
*/
|
|
190
|
-
public disable(value: boolean): void {
|
|
191
|
-
const navEle: 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(navEle).forEach((el: HTMLElement) => {
|
|
198
|
-
el.setAttribute('tabindex', !value ? '0' : '-1');
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
private createOverlayElement(element: HTEle): void {
|
|
202
|
-
const id: string = element.id.concat('_nav');
|
|
203
|
-
const downOverlayEle: HTEle = buildTag('div', { className: CLS_OVERLAY + ' ' + CLS_DOWNOVERLAY });
|
|
204
|
-
const clsDown: string = 'e-' + element.id.concat('_nav ' + CLS_VSCROLLNAV + ' ' + CLS_VSCROLLNAVDOWN);
|
|
205
|
-
const downEle: HTEle = buildTag('div', { id: id.concat('down'), className: clsDown });
|
|
206
|
-
const navItem: HTEle = buildTag('div', { className: CLS_NAVDOWNARROW + ' ' + CLS_NAVARROW + ' e-icons' });
|
|
207
|
-
downEle.appendChild(navItem);
|
|
208
|
-
const upEle: HTEle = buildTag('div', { className: CLS_OVERLAY + ' ' + CLS_UPOVERLAY });
|
|
209
|
-
if (this.ieCheck) {
|
|
210
|
-
downEle.classList.add('e-ie-align');
|
|
211
|
-
}
|
|
212
|
-
element.appendChild(downOverlayEle);
|
|
213
|
-
element.appendChild(downEle);
|
|
214
|
-
element.insertBefore(upEle, element.firstChild);
|
|
215
|
-
this.eventBinding([downEle]);
|
|
216
|
-
}
|
|
217
|
-
private createNavIcon(element: HTEle): void {
|
|
218
|
-
const id: string = element.id.concat('_nav');
|
|
219
|
-
const clsDown: string = 'e-' + element.id.concat('_nav ' + CLS_VSCROLLNAV + ' ' + CLS_VSCROLLNAVDOWN);
|
|
220
|
-
const nav: HTEle = buildTag('div', { id: id.concat('_down'), className: clsDown });
|
|
221
|
-
nav.setAttribute('aria-disabled', 'false');
|
|
222
|
-
const navItem: HTEle = buildTag('div', { className: CLS_NAVDOWNARROW + ' ' + CLS_NAVARROW + ' e-icons' });
|
|
223
|
-
const clsUp: string = 'e-' + element.id.concat('_nav ' + CLS_VSCROLLNAV + ' ' + CLS_VSCROLLNAVUP);
|
|
224
|
-
const navElement: HTEle = buildTag('div', { id: id.concat('_up'), className: clsUp + ' ' + CLS_DISABLE });
|
|
225
|
-
navElement.setAttribute('aria-disabled', 'true');
|
|
226
|
-
const navUpItem: HTEle = buildTag('div', { className: CLS_NAVUPARROW + ' ' + CLS_NAVARROW + ' e-icons' });
|
|
227
|
-
navElement.appendChild(navUpItem);
|
|
228
|
-
nav.appendChild(navItem);
|
|
229
|
-
nav.setAttribute('tabindex', '0');
|
|
230
|
-
element.appendChild(nav);
|
|
231
|
-
element.insertBefore(navElement, element.firstChild);
|
|
232
|
-
if (this.ieCheck) {
|
|
233
|
-
nav.classList.add('e-ie-align');
|
|
234
|
-
navElement.classList.add('e-ie-align');
|
|
235
|
-
}
|
|
236
|
-
this.eventBinding([nav, navElement]);
|
|
237
|
-
}
|
|
238
|
-
private onKeyPress(ev: KeyboardEvent): void {
|
|
239
|
-
if (ev.key === 'Enter') {
|
|
240
|
-
const timeoutFun: () => void = () => {
|
|
241
|
-
this.keyTimeout = true;
|
|
242
|
-
this.eleScrolling(10, <HTEle>ev.target, true);
|
|
243
|
-
};
|
|
244
|
-
this.keyTimer = window.setTimeout(() => {
|
|
245
|
-
timeoutFun();
|
|
246
|
-
}, 100);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
private onKeyUp(ev: KeyboardEvent): void {
|
|
250
|
-
if (ev.key !== 'Enter') {
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
if (this.keyTimeout) {
|
|
254
|
-
this.keyTimeout = false;
|
|
255
|
-
} else {
|
|
256
|
-
(<HTEle>ev.target).click();
|
|
257
|
-
}
|
|
258
|
-
clearTimeout(this.keyTimer);
|
|
259
|
-
}
|
|
260
|
-
private eventBinding(element: HTEle[]): void {
|
|
261
|
-
[].slice.call(element).forEach((ele: HTEle) => {
|
|
262
|
-
new Touch(ele, { tapHold: this.tabHoldHandler.bind(this), tapHoldThreshold: 500 });
|
|
263
|
-
ele.addEventListener('keydown', this.onKeyPress.bind(this));
|
|
264
|
-
ele.addEventListener('keyup', this.onKeyUp.bind(this));
|
|
265
|
-
ele.addEventListener('mouseup', this.repeatScroll.bind(this));
|
|
266
|
-
ele.addEventListener('touchend', this.repeatScroll.bind(this));
|
|
267
|
-
ele.addEventListener('contextmenu', (e: Event) => {
|
|
268
|
-
e.preventDefault();
|
|
269
|
-
});
|
|
270
|
-
EventHandler.add(ele, 'click', this.clickEventHandler, this);
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
private repeatScroll(): void {
|
|
274
|
-
clearInterval(this.timeout);
|
|
275
|
-
}
|
|
276
|
-
private tabHoldHandler(ev: TapEventArgs): void {
|
|
277
|
-
let trgt: HTEle = ev.originalEvent.target as HTEle;
|
|
278
|
-
trgt = this.contains(trgt, CLS_VSCROLLNAV) ? <HTEle>trgt.firstElementChild : trgt;
|
|
279
|
-
const scrollDistance: number = 10;
|
|
280
|
-
const timeoutFun: () => void = () => {
|
|
281
|
-
this.eleScrolling(scrollDistance, trgt, true);
|
|
282
|
-
};
|
|
283
|
-
this.timeout = window.setInterval(() => {
|
|
284
|
-
timeoutFun();
|
|
285
|
-
}, 50);
|
|
286
|
-
}
|
|
287
|
-
private contains(element: HTEle, className: string): boolean {
|
|
288
|
-
return element.classList.contains(className);
|
|
289
|
-
}
|
|
290
|
-
private eleScrolling(scrollDis: number, trgt: HTEle, isContinuous: boolean): void {
|
|
291
|
-
let classList: DOMTokenList = trgt.classList;
|
|
292
|
-
if (classList.contains(CLS_VSCROLLNAV)) {
|
|
293
|
-
classList = trgt.querySelector('.' + CLS_NAVARROW).classList;
|
|
294
|
-
}
|
|
295
|
-
if (classList.contains(CLS_NAVDOWNARROW)) {
|
|
296
|
-
this.frameScrollRequest(scrollDis, 'add', isContinuous);
|
|
297
|
-
} else if (classList.contains(CLS_NAVUPARROW)) {
|
|
298
|
-
this.frameScrollRequest(scrollDis, '', isContinuous);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
private clickEventHandler(event: Event): void {
|
|
302
|
-
this.eleScrolling(this.scrollStep, <HTEle>event.target, false);
|
|
303
|
-
}
|
|
304
|
-
private wheelEventHandler(e: WheelEvent): void {
|
|
305
|
-
e.preventDefault();
|
|
306
|
-
this.frameScrollRequest(this.scrollStep, (e.deltaY > 0 ? 'add' : ''), false);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
private swipeHandler(e: SwipeEventArgs): void {
|
|
310
|
-
const swipeElement: HTEle = this.scrollEle;
|
|
311
|
-
let distance: number;
|
|
312
|
-
if (e.velocity <= 1) {
|
|
313
|
-
distance = e.distanceY / (e.velocity * 10);
|
|
314
|
-
} else {
|
|
315
|
-
distance = e.distanceY / e.velocity;
|
|
316
|
-
}
|
|
317
|
-
let start: number = 0.5;
|
|
318
|
-
const animate: () => void = () => {
|
|
319
|
-
const step: number = Math.sin(start);
|
|
320
|
-
if (step <= 0) {
|
|
321
|
-
window.cancelAnimationFrame(step);
|
|
322
|
-
} else {
|
|
323
|
-
if (e.swipeDirection === 'Up') {
|
|
324
|
-
swipeElement.scrollTop += distance * step;
|
|
325
|
-
} else if (e.swipeDirection === 'Down') {
|
|
326
|
-
swipeElement.scrollTop -= distance * step;
|
|
327
|
-
}
|
|
328
|
-
start -= 0.02;
|
|
329
|
-
window.requestAnimationFrame(animate as FrameRequestCallback);
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
animate();
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
private scrollUpdating(scrollVal: number, action: string): void {
|
|
336
|
-
if (action === 'add') {
|
|
337
|
-
this.scrollEle.scrollTop += scrollVal;
|
|
338
|
-
} else {
|
|
339
|
-
this.scrollEle.scrollTop -= scrollVal;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
private frameScrollRequest(scrollValue: number, action: string, isContinuous: boolean): void {
|
|
344
|
-
const step: number = 10;
|
|
345
|
-
if (isContinuous) {
|
|
346
|
-
this.scrollUpdating(scrollValue, action);
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
if (!this.customStep) {
|
|
350
|
-
[].slice.call(selectAll('.' + CLS_OVERLAY, this.element)).forEach((el: HTMLElement) => {
|
|
351
|
-
scrollValue -= el.offsetHeight;
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
const animate: () => void = () => {
|
|
355
|
-
if (scrollValue < step) {
|
|
356
|
-
window.cancelAnimationFrame(step);
|
|
357
|
-
} else {
|
|
358
|
-
this.scrollUpdating(step, action);
|
|
359
|
-
scrollValue -= step;
|
|
360
|
-
window.requestAnimationFrame(animate as FrameRequestCallback);
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
animate();
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
private touchHandler(e: ScrollEventArgs): void {
|
|
367
|
-
const el: HTEle = this.scrollEle;
|
|
368
|
-
const distance: number = e.distanceY;
|
|
369
|
-
if (e.scrollDirection === 'Up') {
|
|
370
|
-
el.scrollTop = el.scrollTop + distance;
|
|
371
|
-
} else if (e.scrollDirection === 'Down') {
|
|
372
|
-
el.scrollTop = el.scrollTop - distance;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
private arrowDisabling(addDisableCls: HTEle, removeDisableCls: HTEle): void {
|
|
376
|
-
if (this.isDevice) {
|
|
377
|
-
const arrowEle: HTMLElement = isNullOrUndefined(addDisableCls) ? removeDisableCls : addDisableCls;
|
|
378
|
-
const arrowIcon: HTMLElement = arrowEle.querySelector('.' + CLS_NAVARROW) as HTMLElement;
|
|
379
|
-
if (isNullOrUndefined(addDisableCls)) {
|
|
380
|
-
classList(arrowIcon, [CLS_NAVDOWNARROW], [CLS_NAVUPARROW]);
|
|
381
|
-
} else {
|
|
382
|
-
classList(arrowIcon, [CLS_NAVUPARROW], [CLS_NAVDOWNARROW]);
|
|
383
|
-
}
|
|
384
|
-
} else {
|
|
385
|
-
addDisableCls.classList.add(CLS_DISABLE);
|
|
386
|
-
addDisableCls.setAttribute('aria-disabled', 'true');
|
|
387
|
-
addDisableCls.removeAttribute('tabindex');
|
|
388
|
-
removeDisableCls.classList.remove(CLS_DISABLE);
|
|
389
|
-
removeDisableCls.setAttribute('aria-disabled', 'false');
|
|
390
|
-
removeDisableCls.setAttribute('tabindex', '0');
|
|
391
|
-
}
|
|
392
|
-
this.repeatScroll();
|
|
393
|
-
}
|
|
394
|
-
private scrollEventHandler(e: Event): void {
|
|
395
|
-
const target: HTEle = <HTEle>e.target;
|
|
396
|
-
const height: number = target.offsetHeight;
|
|
397
|
-
const navUpEle: HTEle = (<HTEle>this.element.querySelector('.' + CLS_VSCROLLNAVUP));
|
|
398
|
-
const navDownEle: HTEle = (<HTEle>this.element.querySelector('.' + CLS_VSCROLLNAVDOWN));
|
|
399
|
-
const upOverlay: HTEle = (<HTEle>this.element.querySelector('.' + CLS_UPOVERLAY));
|
|
400
|
-
const downOverlay: HTEle = (<HTEle>this.element.querySelector('.' + CLS_DOWNOVERLAY));
|
|
401
|
-
let scrollTop: number = target.scrollTop;
|
|
402
|
-
if (scrollTop <= 0) {
|
|
403
|
-
scrollTop = -scrollTop;
|
|
404
|
-
}
|
|
405
|
-
if (this.isDevice) {
|
|
406
|
-
if (scrollTop < OVERLAY_MAXWID) {
|
|
407
|
-
upOverlay.style.height = scrollTop + 'px';
|
|
408
|
-
} else {
|
|
409
|
-
upOverlay.style.height = '40px';
|
|
410
|
-
}
|
|
411
|
-
if ((target.scrollHeight - Math.ceil(height + scrollTop)) < OVERLAY_MAXWID) {
|
|
412
|
-
downOverlay.style.height = (target.scrollHeight - Math.ceil(height + scrollTop)) + 'px';
|
|
413
|
-
} else {
|
|
414
|
-
downOverlay.style.height = '40px';
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
if (scrollTop === 0) {
|
|
418
|
-
this.arrowDisabling(navUpEle, navDownEle);
|
|
419
|
-
} else if (Math.ceil(height + scrollTop + .1) >= target.scrollHeight) {
|
|
420
|
-
this.arrowDisabling(navDownEle, navUpEle);
|
|
421
|
-
} else {
|
|
422
|
-
const disEle: HTEle = <HTEle>this.element.querySelector('.' + CLS_VSCROLLNAV + '.' + CLS_DISABLE);
|
|
423
|
-
if (disEle) {
|
|
424
|
-
disEle.classList.remove(CLS_DISABLE);
|
|
425
|
-
disEle.setAttribute('aria-disabled', 'false');
|
|
426
|
-
disEle.setAttribute('tabindex', '0');
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Gets called when the model property changes.The data that describes the old and new values of property that changed.
|
|
432
|
-
*
|
|
433
|
-
* @param {VScrollModel} newProp - It contains the new value of data.
|
|
434
|
-
* @param {VScrollModel} oldProp - It contains the old value of data.
|
|
435
|
-
* @returns {void}
|
|
436
|
-
* @private
|
|
437
|
-
*/
|
|
438
|
-
public onPropertyChanged(newProp: VScrollModel, oldProp: VScrollModel): void {
|
|
439
|
-
for (const prop of Object.keys(newProp)) {
|
|
440
|
-
switch (prop) {
|
|
441
|
-
case 'scrollStep':
|
|
442
|
-
this.setScrollState();
|
|
443
|
-
break;
|
|
444
|
-
case 'enableRtl':
|
|
445
|
-
if (newProp.enableRtl) {
|
|
446
|
-
this.element.classList.add(CLS_RTL);
|
|
447
|
-
} else {
|
|
448
|
-
this.element.classList.remove(CLS_RTL);
|
|
449
|
-
}
|
|
450
|
-
break;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { attributes, getUniqueID, Collection, NotifyPropertyChanges, INotifyPropertyChanged, Property, removeClass, isNullOrUndefined, addClass } from '@syncfusion/ej2-base';import { getZindexPartial } from '@syncfusion/ej2-popups';import { MenuBase, MenuItem } from '../common/menu-base';import { MenuItemModel } from './../common/menu-base-model';
|
|
2
|
-
import {MenuBaseModel} from "../common/menu-base-model";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Interface for a class ContextMenu
|
|
6
|
-
*/
|
|
7
|
-
export interface ContextMenuModel extends MenuBaseModel{
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Specifies target element selector in which the ContextMenu should be opened.
|
|
11
|
-
*
|
|
12
|
-
* @default ''
|
|
13
|
-
*/
|
|
14
|
-
target?: string;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Specifies the filter selector for elements inside the target in that the context menu will be opened.
|
|
18
|
-
*
|
|
19
|
-
* @default ''
|
|
20
|
-
*/
|
|
21
|
-
filter?: string;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Specifies menu items with its properties which will be rendered as ContextMenu.
|
|
25
|
-
*
|
|
26
|
-
* @default []
|
|
27
|
-
* @aspType object
|
|
28
|
-
* @blazorType object
|
|
29
|
-
*/
|
|
30
|
-
items?: MenuItemModel[];
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* This property allows you to define custom templates for items in the ContextMenu.
|
|
34
|
-
*
|
|
35
|
-
* @default null
|
|
36
|
-
* @aspType string
|
|
37
|
-
*/
|
|
38
|
-
itemTemplate?: string | Function;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Specifies whether to enable / disable the scrollable option in ContextMenu.
|
|
42
|
-
*
|
|
43
|
-
* @default false
|
|
44
|
-
*/
|
|
45
|
-
enableScrolling?: boolean;
|
|
46
|
-
|
|
47
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/// <reference path="../common/menu-base-model.d.ts" />
|
|
2
|
-
import { INotifyPropertyChanged } from '@syncfusion/ej2-base';
|
|
3
|
-
import { ContextMenuModel } from './context-menu-model';
|
|
4
|
-
import { MenuBase } from '../common/menu-base';
|
|
5
|
-
import { MenuItemModel } from './../common/menu-base-model';
|
|
6
|
-
/**
|
|
7
|
-
* The ContextMenu is a graphical user interface that appears on the user right click/touch hold operation.
|
|
8
|
-
* ```html
|
|
9
|
-
* <div id = 'target'></div>
|
|
10
|
-
* <ul id = 'contextmenu'></ul>
|
|
11
|
-
* ```
|
|
12
|
-
* ```typescript
|
|
13
|
-
* <script>
|
|
14
|
-
* var contextMenuObj = new ContextMenu({items: [{ text: 'Cut' }, { text: 'Copy' },{ text: 'Paste' }], target: '#target'});
|
|
15
|
-
* </script>
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare class ContextMenu extends MenuBase implements INotifyPropertyChanged {
|
|
19
|
-
/**
|
|
20
|
-
* Constructor for creating the widget.
|
|
21
|
-
*
|
|
22
|
-
* @private
|
|
23
|
-
* @param {ContextMenuModel} options - Specifies the context menu model
|
|
24
|
-
* @param {string} element - Specifies the element
|
|
25
|
-
*/
|
|
26
|
-
constructor(options?: ContextMenuModel, element?: string | HTMLUListElement);
|
|
27
|
-
/**
|
|
28
|
-
* Specifies target element selector in which the ContextMenu should be opened.
|
|
29
|
-
*
|
|
30
|
-
* @default ''
|
|
31
|
-
*/
|
|
32
|
-
target: string;
|
|
33
|
-
/**
|
|
34
|
-
* Specifies the filter selector for elements inside the target in that the context menu will be opened.
|
|
35
|
-
*
|
|
36
|
-
* @default ''
|
|
37
|
-
*/
|
|
38
|
-
filter: string;
|
|
39
|
-
/**
|
|
40
|
-
* Specifies menu items with its properties which will be rendered as ContextMenu.
|
|
41
|
-
*
|
|
42
|
-
* @default []
|
|
43
|
-
* @aspType object
|
|
44
|
-
* @blazorType object
|
|
45
|
-
*/
|
|
46
|
-
items: MenuItemModel[];
|
|
47
|
-
/**
|
|
48
|
-
* This property allows you to define custom templates for items in the ContextMenu.
|
|
49
|
-
*
|
|
50
|
-
* @default null
|
|
51
|
-
* @aspType string
|
|
52
|
-
*/
|
|
53
|
-
itemTemplate: string | Function;
|
|
54
|
-
/**
|
|
55
|
-
* Specifies whether to enable / disable the scrollable option in ContextMenu.
|
|
56
|
-
*
|
|
57
|
-
* @default false
|
|
58
|
-
*/
|
|
59
|
-
enableScrolling: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* For internal use only - prerender processing.
|
|
62
|
-
*
|
|
63
|
-
* @private
|
|
64
|
-
* @returns {void}
|
|
65
|
-
*/
|
|
66
|
-
protected preRender(): void;
|
|
67
|
-
protected initialize(): void;
|
|
68
|
-
/**
|
|
69
|
-
* This method is used to open the ContextMenu in specified position.
|
|
70
|
-
*
|
|
71
|
-
* @param {number} top - To specify ContextMenu vertical positioning.
|
|
72
|
-
* @param {number} left - To specify ContextMenu horizontal positioning.
|
|
73
|
-
* @param {HTMLElement} target - To calculate z-index for ContextMenu based upon the specified target.
|
|
74
|
-
* @function open
|
|
75
|
-
* @returns {void}
|
|
76
|
-
*/
|
|
77
|
-
open(top: number, left: number, target?: HTMLElement): void;
|
|
78
|
-
/**
|
|
79
|
-
* Closes the ContextMenu if it is opened.
|
|
80
|
-
*
|
|
81
|
-
* @function close
|
|
82
|
-
* @returns {void}
|
|
83
|
-
*/
|
|
84
|
-
close(): void;
|
|
85
|
-
private addTemplateClass;
|
|
86
|
-
/**
|
|
87
|
-
* Called internally if any of the property value changed.
|
|
88
|
-
*
|
|
89
|
-
* @private
|
|
90
|
-
* @param {ContextMenuModel} newProp - Specifies new properties
|
|
91
|
-
* @param {ContextMenuModel} oldProp - Specifies old properties
|
|
92
|
-
* @returns {void}
|
|
93
|
-
*/
|
|
94
|
-
onPropertyChanged(newProp: ContextMenuModel, oldProp: ContextMenuModel): void;
|
|
95
|
-
/**
|
|
96
|
-
* Get module name.
|
|
97
|
-
*
|
|
98
|
-
* @returns {string} - Module Name
|
|
99
|
-
* @private
|
|
100
|
-
*/
|
|
101
|
-
protected getModuleName(): string;
|
|
102
|
-
}
|