@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.
- package/dist/ej2-navigations.min.js +1 -1
- package/dist/ej2-navigations.umd.min.js +1 -1
- package/dist/ej2-navigations.umd.min.js.map +1 -1
- package/dist/es6/ej2-navigations.es2015.js.map +1 -1
- package/dist/es6/ej2-navigations.es5.js.map +1 -1
- package/dist/global/ej2-navigations.min.js +1 -1
- package/dist/global/ej2-navigations.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/dist/ts/accordion/accordion-model.d.ts +285 -0
- package/dist/ts/accordion/accordion.d.ts +458 -0
- package/dist/ts/accordion/accordion.ts +1580 -0
- package/dist/ts/accordion/index.d.ts +5 -0
- package/dist/ts/accordion/index.ts +5 -0
- package/dist/ts/appbar/appbar-model.d.ts +76 -0
- package/dist/ts/appbar/appbar.d.ts +115 -0
- package/dist/ts/appbar/appbar.ts +281 -0
- package/dist/ts/appbar/index.d.ts +3 -0
- package/dist/ts/appbar/index.ts +3 -0
- package/dist/ts/breadcrumb/breadcrumb-model.d.ts +170 -0
- package/dist/ts/breadcrumb/breadcrumb.d.ts +297 -0
- package/dist/ts/breadcrumb/breadcrumb.ts +959 -0
- package/dist/ts/breadcrumb/index.d.ts +5 -0
- package/dist/ts/breadcrumb/index.ts +5 -0
- package/dist/ts/carousel/carousel-model.d.ts +282 -0
- package/dist/ts/carousel/carousel.d.ts +439 -0
- package/dist/ts/carousel/carousel.ts +1633 -0
- package/dist/ts/carousel/index.d.ts +3 -0
- package/dist/ts/carousel/index.ts +3 -0
- package/dist/ts/common/h-scroll-model.d.ts +16 -0
- package/dist/ts/common/h-scroll.d.ts +105 -0
- package/dist/ts/common/h-scroll.ts +481 -0
- package/dist/ts/common/index.d.ts +9 -0
- package/dist/ts/common/index.ts +10 -0
- package/dist/ts/common/menu-base-model.d.ts +308 -0
- package/dist/ts/common/menu-base.d.ts +558 -0
- package/dist/ts/common/menu-base.ts +2736 -0
- package/dist/ts/common/menu-scroll.d.ts +29 -0
- package/dist/ts/common/menu-scroll.ts +105 -0
- package/dist/ts/common/v-scroll-model.d.ts +16 -0
- package/dist/ts/common/v-scroll.d.ts +106 -0
- package/dist/ts/common/v-scroll.ts +454 -0
- package/dist/ts/context-menu/context-menu-model.d.ts +47 -0
- package/dist/ts/context-menu/context-menu.d.ts +102 -0
- package/dist/ts/context-menu/context-menu.ts +165 -0
- package/dist/ts/context-menu/index.d.ts +5 -0
- package/dist/ts/context-menu/index.ts +5 -0
- package/dist/ts/index.d.ts +16 -0
- package/dist/ts/index.ts +16 -0
- package/dist/ts/menu/index.d.ts +5 -0
- package/dist/ts/menu/index.ts +5 -0
- package/dist/ts/menu/menu-model.d.ts +70 -0
- package/dist/ts/menu/menu.d.ts +127 -0
- package/dist/ts/menu/menu.ts +313 -0
- package/dist/ts/sidebar/index.d.ts +5 -0
- package/dist/ts/sidebar/index.ts +5 -0
- package/dist/ts/sidebar/sidebar-model.d.ts +200 -0
- package/dist/ts/sidebar/sidebar.d.ts +336 -0
- package/dist/ts/sidebar/sidebar.ts +907 -0
- package/dist/ts/stepper/index.d.ts +3 -0
- package/dist/ts/stepper/index.ts +3 -0
- package/dist/ts/stepper/stepper-model.d.ts +159 -0
- package/dist/ts/stepper/stepper.d.ts +381 -0
- package/dist/ts/stepper/stepper.ts +1350 -0
- package/dist/ts/stepper-base/index.d.ts +5 -0
- package/dist/ts/stepper-base/index.ts +6 -0
- package/dist/ts/stepper-base/stepper-base-model.d.ts +124 -0
- package/dist/ts/stepper-base/stepper-base.d.ts +187 -0
- package/dist/ts/stepper-base/stepper-base.ts +290 -0
- package/dist/ts/tab/index.d.ts +5 -0
- package/dist/ts/tab/index.ts +5 -0
- package/dist/ts/tab/tab-model.d.ts +408 -0
- package/dist/ts/tab/tab.d.ts +715 -0
- package/dist/ts/tab/tab.ts +2842 -0
- package/dist/ts/toolbar/index.d.ts +5 -0
- package/dist/ts/toolbar/index.ts +5 -0
- package/dist/ts/toolbar/toolbar-model.d.ts +294 -0
- package/dist/ts/toolbar/toolbar.d.ts +541 -0
- package/dist/ts/toolbar/toolbar.ts +2646 -0
- package/dist/ts/treeview/index.d.ts +5 -0
- package/dist/ts/treeview/index.ts +5 -0
- package/dist/ts/treeview/treeview-model.d.ts +637 -0
- package/dist/ts/treeview/treeview.d.ts +1518 -0
- package/dist/ts/treeview/treeview.ts +6780 -0
- package/package.json +70 -17
- package/src/context-menu/context-menu-model.d.ts +1 -1
- package/src/context-menu/context-menu.js +1 -1
- package/styles/accordion/_bootstrap-dark-definition.scss +1 -1
- package/styles/accordion/_bootstrap-definition.scss +1 -1
- package/styles/accordion/bootstrap-dark.css +1 -1
- package/styles/accordion/bootstrap.css +1 -1
- package/styles/bds-lite.css +1 -1
- package/styles/bds.css +1 -1
- package/styles/bootstrap-dark-lite.css +2 -2
- package/styles/bootstrap-dark.css +2 -2
- package/styles/bootstrap-lite.css +2 -2
- package/styles/bootstrap.css +2 -2
- package/styles/bootstrap4-lite.css +1 -1
- package/styles/bootstrap4.css +1 -1
- package/styles/bootstrap5-dark-lite.css +1 -1
- package/styles/bootstrap5-dark.css +1 -1
- package/styles/bootstrap5-lite.css +1 -1
- package/styles/bootstrap5.3-lite.css +1 -1
- package/styles/bootstrap5.3.css +9 -1
- package/styles/bootstrap5.css +1 -1
- package/styles/fabric-dark-lite.css +1 -1
- package/styles/fabric-dark.css +1 -1
- package/styles/fabric-lite.css +1 -1
- package/styles/fabric.css +1 -1
- package/styles/fluent-dark-lite.css +1 -1
- package/styles/fluent-dark.css +1 -1
- package/styles/fluent-lite.css +1 -1
- package/styles/fluent.css +1 -1
- package/styles/fluent2-lite.css +4 -1
- package/styles/fluent2.css +4 -1
- package/styles/h-scroll/_layout.scss +1 -1
- package/styles/h-scroll/bds.css +1 -1
- package/styles/h-scroll/bootstrap-dark.css +1 -1
- package/styles/h-scroll/bootstrap.css +1 -1
- package/styles/h-scroll/bootstrap4.css +1 -1
- package/styles/h-scroll/bootstrap5-dark.css +1 -1
- package/styles/h-scroll/bootstrap5.3.css +1 -1
- package/styles/h-scroll/bootstrap5.css +1 -1
- package/styles/h-scroll/fabric-dark.css +1 -1
- package/styles/h-scroll/fabric.css +1 -1
- package/styles/h-scroll/fluent-dark.css +1 -1
- package/styles/h-scroll/fluent.css +1 -1
- package/styles/h-scroll/fluent2.css +1 -1
- package/styles/h-scroll/highcontrast-light.css +1 -1
- package/styles/h-scroll/highcontrast.css +1 -1
- package/styles/h-scroll/material-dark.css +1 -1
- package/styles/h-scroll/material.css +1 -1
- package/styles/h-scroll/material3-dark.css +1 -1
- package/styles/h-scroll/material3.css +1 -1
- package/styles/h-scroll/tailwind-dark.css +1 -1
- package/styles/h-scroll/tailwind.css +1 -1
- package/styles/h-scroll/tailwind3.css +1 -1
- package/styles/highcontrast-light-lite.css +1 -1
- package/styles/highcontrast-light.css +1 -1
- package/styles/highcontrast-lite.css +1 -1
- package/styles/highcontrast.css +1 -1
- package/styles/material-dark-lite.css +1 -1
- package/styles/material-dark.css +1 -1
- package/styles/material-lite.css +1 -1
- package/styles/material.css +1 -1
- package/styles/material3-dark-lite.css +1 -1
- package/styles/material3-dark.css +1 -7
- package/styles/material3-lite.css +1 -1
- package/styles/material3.css +1 -7
- package/styles/tailwind-dark-lite.css +1 -1
- package/styles/tailwind-dark.css +1 -1
- package/styles/tailwind-lite.css +1 -1
- package/styles/tailwind.css +1 -1
- package/styles/tailwind3-lite.css +1 -1
- package/styles/tailwind3.css +1 -1
- package/styles/toolbar/_layout.scss +1 -1
- package/styles/treeview/_bigger.scss +2 -2
- package/styles/treeview/_bootstrap5.3-definition.scss +1 -0
- package/styles/treeview/_layout.scss +3 -0
- package/styles/treeview/bootstrap5.3.css +8 -0
- package/styles/treeview/fluent2.css +3 -0
- package/styles/treeview/material3-dark.css +0 -6
- package/styles/treeview/material3.css +0 -6
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/triple-slash-reference */
|
|
2
|
+
/// <reference path='../common/menu-base-model.d.ts'/>
|
|
3
|
+
import { attributes, NotifyPropertyChanges, INotifyPropertyChanged, Property } from '@syncfusion/ej2-base';
|
|
4
|
+
import { Browser, Complex, getUniqueID, SanitizeHtmlHelper } from '@syncfusion/ej2-base';
|
|
5
|
+
import { MenuBase, FieldSettings } from '../common/menu-base';
|
|
6
|
+
import { MenuItemModel, FieldSettingsModel } from '../common/menu-base-model';
|
|
7
|
+
import { MenuModel } from './menu-model';
|
|
8
|
+
|
|
9
|
+
const VMENU: string = 'e-vertical';
|
|
10
|
+
|
|
11
|
+
const SCROLLABLE: string = 'e-scrollable';
|
|
12
|
+
|
|
13
|
+
const HAMBURGER: string = 'e-hamburger';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Defines the different types of orientation option available in the Menu.
|
|
17
|
+
* ```props
|
|
18
|
+
* Horizontal - It renders the menu in a horizontal orientation mode.
|
|
19
|
+
* Vertical - It renders the menu in a vertical orientation mode.
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export type Orientation = 'Horizontal' | 'Vertical';
|
|
23
|
+
|
|
24
|
+
type objColl = { [key: string]: Object }[];
|
|
25
|
+
type obj = { [key: string]: Object };
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The Menu is a graphical user interface that serve as navigation headers for your application or site.
|
|
29
|
+
* ```html
|
|
30
|
+
* <ul id = 'menu'></ul>
|
|
31
|
+
* ```
|
|
32
|
+
* ```typescript
|
|
33
|
+
* <script>
|
|
34
|
+
* var menuObj = new Menu({ items: [{ text: 'Home' }, { text: 'Contact Us' },{ text: 'Login' }]});
|
|
35
|
+
* menuObj.appendTo("#menu");
|
|
36
|
+
* </script>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
@NotifyPropertyChanges
|
|
40
|
+
export class Menu extends MenuBase implements INotifyPropertyChanged {
|
|
41
|
+
private tempItems: objColl = [];
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Specified the orientation of Menu whether it can be horizontal or vertical.
|
|
45
|
+
*
|
|
46
|
+
* @default 'Horizontal'
|
|
47
|
+
*/
|
|
48
|
+
@Property('Horizontal')
|
|
49
|
+
public orientation: Orientation;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Specifies target element to open/close Menu while click in Hamburger mode.
|
|
53
|
+
*
|
|
54
|
+
* @default ''
|
|
55
|
+
*/
|
|
56
|
+
@Property('')
|
|
57
|
+
public target: string;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Specifies the template for Menu item.
|
|
61
|
+
*
|
|
62
|
+
* @default null
|
|
63
|
+
* @aspType string
|
|
64
|
+
*/
|
|
65
|
+
@Property(null)
|
|
66
|
+
public template: string | Function;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Specifies whether to enable / disable the scrollable option in Menu.
|
|
70
|
+
*
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
@Property(false)
|
|
74
|
+
public enableScrolling: boolean;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Specifies whether to enable / disable the hamburger mode in Menu.
|
|
78
|
+
*
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
@Property(false)
|
|
82
|
+
public hamburgerMode: boolean;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Specifies the title text for hamburger mode in Menu.
|
|
86
|
+
*
|
|
87
|
+
* @default 'Menu'
|
|
88
|
+
*/
|
|
89
|
+
@Property('Menu')
|
|
90
|
+
public title: string;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Specifies whether to enable the rendering of untrusted HTML values in the Menu component.
|
|
94
|
+
* If 'enableHtmlSanitizer' set to true, the component will sanitize any suspected untrusted strings and scripts before rendering them.
|
|
95
|
+
*
|
|
96
|
+
* @default true
|
|
97
|
+
*/
|
|
98
|
+
@Property(true)
|
|
99
|
+
public enableHtmlSanitizer: boolean;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Specifies mapping fields from the dataSource.
|
|
103
|
+
*
|
|
104
|
+
* @default { itemId: "id", text: "text", parentId: "parentId", iconCss: "iconCss", url: "url", separator: "separator",
|
|
105
|
+
* children: "items" }
|
|
106
|
+
*/
|
|
107
|
+
// eslint:disable-next-line
|
|
108
|
+
@Complex<FieldSettingsModel>({ itemId: 'id', text: 'text', parentId: 'parentId', iconCss: 'iconCss', url: 'url', separator: 'separator', children: 'items' }, FieldSettings)
|
|
109
|
+
public fields: FieldSettingsModel;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Constructor for creating the component.
|
|
113
|
+
*
|
|
114
|
+
* @private
|
|
115
|
+
* @param {MenuModel} options - Specifies the menu model
|
|
116
|
+
* @param {string} element - Specifies the element
|
|
117
|
+
*/
|
|
118
|
+
constructor(options?: MenuModel, element?: string | HTMLUListElement) {
|
|
119
|
+
super(options, <HTMLUListElement | string>element);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Get module name.
|
|
124
|
+
*
|
|
125
|
+
* @private
|
|
126
|
+
* @returns {string} - Module Name
|
|
127
|
+
*/
|
|
128
|
+
protected getModuleName(): string {
|
|
129
|
+
return 'menu';
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* For internal use only - prerender processing.
|
|
134
|
+
*
|
|
135
|
+
* @private
|
|
136
|
+
* @returns {void}
|
|
137
|
+
*/
|
|
138
|
+
protected preRender(): void {
|
|
139
|
+
this.isMenu = true;
|
|
140
|
+
this.element.id = this.element.id || getUniqueID('ej2-menu');
|
|
141
|
+
if (this.template) {
|
|
142
|
+
try {
|
|
143
|
+
if (typeof this.template !== 'function' && document.querySelectorAll(this.template).length) {
|
|
144
|
+
this.template = document.querySelector(this.template).innerHTML.trim();
|
|
145
|
+
this.clearChanges();
|
|
146
|
+
}
|
|
147
|
+
} catch (e) {
|
|
148
|
+
/* action on catch */
|
|
149
|
+
}
|
|
150
|
+
this.updateMenuItems(this.items);
|
|
151
|
+
} else {
|
|
152
|
+
this.updateMenuItems(this.items);
|
|
153
|
+
}
|
|
154
|
+
super.preRender();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
protected initialize(): void {
|
|
158
|
+
super.initialize();
|
|
159
|
+
attributes(this.element, <{ [key: string]: string }>{ 'role': 'menubar', 'tabindex': '0' });
|
|
160
|
+
if (this.orientation === 'Vertical') {
|
|
161
|
+
this.element.classList.add(VMENU);
|
|
162
|
+
if (this.hamburgerMode && !this.target) {
|
|
163
|
+
this.element.previousElementSibling.classList.add(VMENU);
|
|
164
|
+
}
|
|
165
|
+
this.element.setAttribute('aria-orientation', 'vertical');
|
|
166
|
+
} else {
|
|
167
|
+
if (Browser.isDevice && !this.enableScrolling) {
|
|
168
|
+
this.element.parentElement.classList.add(SCROLLABLE);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (this.hamburgerMode) {
|
|
172
|
+
this.element.parentElement.classList.add(HAMBURGER);
|
|
173
|
+
if (this.orientation === 'Horizontal') {
|
|
174
|
+
this.element.classList.add('e-hide-menu');
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private updateMenuItems(items: MenuItemModel[]): void {
|
|
180
|
+
this.tempItems = items as objColl;
|
|
181
|
+
this.items = [];
|
|
182
|
+
this.tempItems.map(this.createMenuItems, this);
|
|
183
|
+
this.setProperties({ items: this.items }, true);
|
|
184
|
+
this.tempItems = [];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Called internally if any of the property value changed.
|
|
189
|
+
*
|
|
190
|
+
* @private
|
|
191
|
+
* @param {MenuModel} newProp - Specifies the new properties.
|
|
192
|
+
* @param {MenuModel} oldProp - Specifies the old properties.
|
|
193
|
+
* @returns {void}
|
|
194
|
+
*/
|
|
195
|
+
public onPropertyChanged(newProp: MenuModel, oldProp: MenuModel): void {
|
|
196
|
+
for (const prop of Object.keys(newProp)) {
|
|
197
|
+
switch (prop) {
|
|
198
|
+
case 'orientation':
|
|
199
|
+
if (newProp.orientation === 'Vertical') {
|
|
200
|
+
this.element.classList.add(VMENU);
|
|
201
|
+
if (this.hamburgerMode) {
|
|
202
|
+
if (!this.target) { this.element.previousElementSibling.classList.add(VMENU); }
|
|
203
|
+
this.element.classList.remove('e-hide-menu');
|
|
204
|
+
}
|
|
205
|
+
this.element.setAttribute('aria-orientation', 'vertical');
|
|
206
|
+
} else {
|
|
207
|
+
this.element.classList.remove(VMENU);
|
|
208
|
+
if (this.hamburgerMode) {
|
|
209
|
+
if (!this.target) { this.element.previousElementSibling.classList.remove(VMENU); }
|
|
210
|
+
this.element.classList.add('e-hide-menu');
|
|
211
|
+
}
|
|
212
|
+
this.element.removeAttribute('aria-orientation');
|
|
213
|
+
}
|
|
214
|
+
break;
|
|
215
|
+
case 'items':
|
|
216
|
+
if (!Object.keys(oldProp.items).length) { this.updateMenuItems(newProp.items); }
|
|
217
|
+
break;
|
|
218
|
+
case 'hamburgerMode':
|
|
219
|
+
if (!this.element.previousElementSibling) {
|
|
220
|
+
super.createHeaderContainer();
|
|
221
|
+
}
|
|
222
|
+
if (newProp.hamburgerMode) {
|
|
223
|
+
this.element.parentElement.classList.add(HAMBURGER);
|
|
224
|
+
[].slice.call(this.element.getElementsByClassName('e-blankicon')).forEach((li: HTMLElement): void => {
|
|
225
|
+
li.style[this.enableRtl ? 'paddingRight' : 'paddingLeft'] = '';
|
|
226
|
+
});
|
|
227
|
+
} else {
|
|
228
|
+
this.element.parentElement.classList.remove(HAMBURGER);
|
|
229
|
+
if (this.orientation === 'Vertical') { this.setBlankIconStyle(this.element); }
|
|
230
|
+
}
|
|
231
|
+
if (this.orientation === 'Vertical') {
|
|
232
|
+
if (!this.target) { this.element.previousElementSibling.classList.add(VMENU); }
|
|
233
|
+
this.element.classList.remove('e-hide-menu');
|
|
234
|
+
} else {
|
|
235
|
+
if (this.target) {
|
|
236
|
+
this.element.previousElementSibling.classList.add(VMENU);
|
|
237
|
+
} else {
|
|
238
|
+
this.element.previousElementSibling.classList.remove(VMENU);
|
|
239
|
+
}
|
|
240
|
+
this.element.classList[newProp.hamburgerMode ? 'add' : 'remove']('e-hide-menu');
|
|
241
|
+
}
|
|
242
|
+
break;
|
|
243
|
+
case 'title':
|
|
244
|
+
if (this.hamburgerMode && this.element.previousElementSibling) {
|
|
245
|
+
newProp.title = (this.enableHtmlSanitizer) ? SanitizeHtmlHelper.sanitize(newProp.title) : newProp.title;
|
|
246
|
+
this.element.previousElementSibling.querySelector('.e-menu-title').innerHTML = newProp.title;
|
|
247
|
+
}
|
|
248
|
+
break;
|
|
249
|
+
case 'target':
|
|
250
|
+
if (this.hamburgerMode) {
|
|
251
|
+
this.unWireEvents(oldProp.target);
|
|
252
|
+
this.wireEvents();
|
|
253
|
+
if (this.orientation === 'Horizontal') {
|
|
254
|
+
if (!newProp.target) {
|
|
255
|
+
if (!this.element.previousElementSibling) {
|
|
256
|
+
super.createHeaderContainer();
|
|
257
|
+
}
|
|
258
|
+
this.element.previousElementSibling.classList.remove(VMENU);
|
|
259
|
+
} else {
|
|
260
|
+
this.element.previousElementSibling.classList.add(VMENU);
|
|
261
|
+
}
|
|
262
|
+
this.element.classList.add('e-hide-menu');
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
break;
|
|
266
|
+
case 'template':
|
|
267
|
+
this.template = newProp.template;
|
|
268
|
+
this.refresh();
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
super.onPropertyChanged(newProp, oldProp);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
private createMenuItems(item: obj): void {
|
|
276
|
+
let idx: number[];
|
|
277
|
+
let i: number;
|
|
278
|
+
let items: MenuItemModel[] = this.items as objColl;
|
|
279
|
+
const pIdField: string = this.getField('parentId');
|
|
280
|
+
if (item[`${pIdField}`]) {
|
|
281
|
+
idx = this.getIndex(item[`${pIdField}`].toString(), true);
|
|
282
|
+
for (i = 0; i < idx.length; i++) {
|
|
283
|
+
if (!items[idx[i as number]].items) {
|
|
284
|
+
items[idx[i as number]].items = [];
|
|
285
|
+
}
|
|
286
|
+
items = items[idx[i as number]].items;
|
|
287
|
+
}
|
|
288
|
+
items.push(item);
|
|
289
|
+
} else {
|
|
290
|
+
(<MenuItemModel[]>this.items).push(item);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* This method is used to open the Menu in hamburger mode.
|
|
296
|
+
*
|
|
297
|
+
* @function open
|
|
298
|
+
* @returns {void}
|
|
299
|
+
*/
|
|
300
|
+
public open(): void {
|
|
301
|
+
super.openHamburgerMenu();
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Closes the Menu if it is opened in hamburger mode.
|
|
306
|
+
*
|
|
307
|
+
* @function close
|
|
308
|
+
* @returns {void}
|
|
309
|
+
*/
|
|
310
|
+
public close(): void {
|
|
311
|
+
super.closeHamburgerMenu();
|
|
312
|
+
}
|
|
313
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { Component, formatUnit, EventHandler, Event, isNullOrUndefined, closest, Browser } from '@syncfusion/ej2-base';import { Property, EmitType, NotifyPropertyChanges, INotifyPropertyChanged, isNullOrUndefined as isNOU } from '@syncfusion/ej2-base';import { setStyleAttribute as setStyle, addClass, removeClass, Touch, SwipeEventArgs } from '@syncfusion/ej2-base';
|
|
2
|
+
import {SidebarPosition,SidebarType,EventArgs,ChangeEventArgs} from "./sidebar";
|
|
3
|
+
import {ComponentModel} from '@syncfusion/ej2-base';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Interface for a class Sidebar
|
|
7
|
+
*/
|
|
8
|
+
export interface SidebarModel extends ComponentModel{
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Specifies the size of the Sidebar in dock state.
|
|
12
|
+
* > For more details about dockSize refer to
|
|
13
|
+
* [`Dock`](https://ej2.syncfusion.com/documentation/sidebar/docking-sidebar/) documentation.
|
|
14
|
+
*
|
|
15
|
+
* @default 'auto'
|
|
16
|
+
*/
|
|
17
|
+
dockSize?: string | number;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Specifies the media query string for resolution, which when met opens the Sidebar.
|
|
21
|
+
* ```typescript
|
|
22
|
+
* let defaultSidebar: Sidebar = new Sidebar({
|
|
23
|
+
* mediaQuery:'(min-width: 600px)'
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
* > For more details about mediaQuery refer to
|
|
27
|
+
* [`Auto Close`](https://ej2.syncfusion.com/documentation/sidebar/auto-close/) documentation.
|
|
28
|
+
*
|
|
29
|
+
* @default null
|
|
30
|
+
* @aspType string
|
|
31
|
+
*/
|
|
32
|
+
mediaQuery?: string | MediaQueryList;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Specifies the docking state of the component.
|
|
36
|
+
* > For more details about enableDock refer to
|
|
37
|
+
* [`Dock`](https://ej2.syncfusion.com/documentation/sidebar/docking-sidebar/) documentation.
|
|
38
|
+
*
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
enableDock?: boolean;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Enables the expand or collapse while swiping in touch devices.
|
|
45
|
+
* This is not a sidebar property.
|
|
46
|
+
*
|
|
47
|
+
* @default 'en-US'
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
locale?: string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Enable or disable persisting component's state between page reloads. If enabled, following list of states will be persisted.
|
|
54
|
+
* 1. Position
|
|
55
|
+
* 2. Type
|
|
56
|
+
*
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
|
+
enablePersistence?: boolean;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Enables the expand or collapse while swiping in touch devices.
|
|
63
|
+
*
|
|
64
|
+
* @default true
|
|
65
|
+
*/
|
|
66
|
+
enableGestures?: boolean;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Gets or sets the Sidebar component is open or close.
|
|
70
|
+
* > When the Sidebar type is set to `Auto`,
|
|
71
|
+
* the component will be expanded in the desktop and collapsed in the mobile mode regardless of the isOpen property.
|
|
72
|
+
*
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
75
|
+
isOpen?: boolean;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Specifies the Sidebar in RTL mode that displays the content in the right-to-left direction.
|
|
79
|
+
*
|
|
80
|
+
* @default false
|
|
81
|
+
*/
|
|
82
|
+
enableRtl?: boolean;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Enable or disable the animation transitions on expanding or collapsing the Sidebar.
|
|
86
|
+
*
|
|
87
|
+
* @default true
|
|
88
|
+
*/
|
|
89
|
+
animate?: boolean;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Specifies the height of the Sidebar.
|
|
93
|
+
*
|
|
94
|
+
* @default 'auto'
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
height?: string | number;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Specifies whether the Sidebar need to be closed or not when document area is clicked.
|
|
101
|
+
*
|
|
102
|
+
* @default false
|
|
103
|
+
*/
|
|
104
|
+
closeOnDocumentClick?: boolean;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Specifies the position of the Sidebar (Left/Right) corresponding to the main content.
|
|
108
|
+
* > For more details about SidebarPosition refer to
|
|
109
|
+
* [`position`](https://ej2.syncfusion.com/documentation/sidebar/getting-started/#position) documentation.
|
|
110
|
+
*
|
|
111
|
+
* @default 'Left'
|
|
112
|
+
*/
|
|
113
|
+
position?: SidebarPosition;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Allows to place the sidebar inside the target element.
|
|
117
|
+
* > For more details about target refer to
|
|
118
|
+
* [`Custom Context`](https://ej2.syncfusion.com/documentation/sidebar/custom-context/) documentation.
|
|
119
|
+
*
|
|
120
|
+
* @default null
|
|
121
|
+
*/
|
|
122
|
+
target?: HTMLElement | string;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Specifies the whether to apply overlay options to main content when the Sidebar is in an open state.
|
|
126
|
+
* > For more details about showBackdrop refer to
|
|
127
|
+
* [`Backdrop`](https://ej2.syncfusion.com/documentation/sidebar/getting-started/#enable-backdrop) documentation.
|
|
128
|
+
*
|
|
129
|
+
* @default false
|
|
130
|
+
*/
|
|
131
|
+
showBackdrop?: boolean;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Specifies the expanding types of the Sidebar.
|
|
135
|
+
* * `Over` - The sidebar floats over the main content area.
|
|
136
|
+
* * `Push` - The sidebar pushes the main content area to appear side-by-side, and shrinks the main content within the screen width.
|
|
137
|
+
* * `Slide` - The sidebar translates the x and y positions of main content area based on the sidebar width.
|
|
138
|
+
* The main content area will not be adjusted within the screen width.
|
|
139
|
+
* * `Auto` - Sidebar with `Over` type in mobile resolution and `Push` type in other higher resolutions.
|
|
140
|
+
* > For more details about SidebarType refer to
|
|
141
|
+
* [`SidebarType`](../../sidebar/variations/) documentation.
|
|
142
|
+
*
|
|
143
|
+
* @default 'Auto'
|
|
144
|
+
*/
|
|
145
|
+
type?: SidebarType;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Specifies the width of the Sidebar. By default, the width of the Sidebar sets based on the size of its content.
|
|
149
|
+
* Width can also be set in pixel values.
|
|
150
|
+
*
|
|
151
|
+
* @default 'auto'
|
|
152
|
+
*/
|
|
153
|
+
width?: string | number;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Specifies the z-index of the Sidebar. It is applicable only when sidebar act as overlay type.
|
|
157
|
+
*
|
|
158
|
+
* @default 1000
|
|
159
|
+
* @aspType double
|
|
160
|
+
*/
|
|
161
|
+
zIndex?: string | number;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Triggers when component is created.
|
|
165
|
+
*
|
|
166
|
+
* @event created
|
|
167
|
+
*
|
|
168
|
+
*
|
|
169
|
+
*/
|
|
170
|
+
created?: EmitType<Object>;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Triggers when component is closed.
|
|
174
|
+
*
|
|
175
|
+
* @event close
|
|
176
|
+
*/
|
|
177
|
+
close?: EmitType<EventArgs>;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Triggers when component is opened.
|
|
181
|
+
*
|
|
182
|
+
* @event open
|
|
183
|
+
*/
|
|
184
|
+
open?: EmitType<EventArgs>;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Triggers when the state(expand/collapse) of the component is changed.
|
|
188
|
+
*
|
|
189
|
+
* @event change
|
|
190
|
+
*/
|
|
191
|
+
change?: EmitType<ChangeEventArgs>;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Triggers when component gets destroyed.
|
|
195
|
+
*
|
|
196
|
+
* @event destroyed
|
|
197
|
+
*/
|
|
198
|
+
destroyed?: EmitType<Object>;
|
|
199
|
+
|
|
200
|
+
}
|