@syncfusion/ej2-navigations 30.2.5 → 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 (165) hide show
  1. package/dist/ej2-navigations.min.js +2 -2
  2. package/dist/ej2-navigations.umd.min.js +2 -2
  3. package/dist/ej2-navigations.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-navigations.es2015.js +1 -0
  5. package/dist/es6/ej2-navigations.es2015.js.map +1 -1
  6. package/dist/es6/ej2-navigations.es5.js +1 -0
  7. package/dist/es6/ej2-navigations.es5.js.map +1 -1
  8. package/dist/global/ej2-navigations.min.js +2 -2
  9. package/dist/global/ej2-navigations.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/dist/ts/accordion/accordion-model.d.ts +285 -0
  12. package/dist/ts/accordion/accordion.d.ts +458 -0
  13. package/dist/ts/accordion/accordion.ts +1580 -0
  14. package/dist/ts/accordion/index.d.ts +5 -0
  15. package/dist/ts/accordion/index.ts +5 -0
  16. package/dist/ts/appbar/appbar-model.d.ts +76 -0
  17. package/dist/ts/appbar/appbar.d.ts +115 -0
  18. package/dist/ts/appbar/appbar.ts +281 -0
  19. package/dist/ts/appbar/index.d.ts +3 -0
  20. package/dist/ts/appbar/index.ts +3 -0
  21. package/dist/ts/breadcrumb/breadcrumb-model.d.ts +170 -0
  22. package/dist/ts/breadcrumb/breadcrumb.d.ts +297 -0
  23. package/dist/ts/breadcrumb/breadcrumb.ts +959 -0
  24. package/dist/ts/breadcrumb/index.d.ts +5 -0
  25. package/dist/ts/breadcrumb/index.ts +5 -0
  26. package/dist/ts/carousel/carousel-model.d.ts +282 -0
  27. package/dist/ts/carousel/carousel.d.ts +439 -0
  28. package/dist/ts/carousel/carousel.ts +1633 -0
  29. package/dist/ts/carousel/index.d.ts +3 -0
  30. package/dist/ts/carousel/index.ts +3 -0
  31. package/dist/ts/common/h-scroll-model.d.ts +16 -0
  32. package/dist/ts/common/h-scroll.d.ts +105 -0
  33. package/dist/ts/common/h-scroll.ts +481 -0
  34. package/dist/ts/common/index.d.ts +9 -0
  35. package/dist/ts/common/index.ts +10 -0
  36. package/dist/ts/common/menu-base-model.d.ts +308 -0
  37. package/dist/ts/common/menu-base.d.ts +558 -0
  38. package/dist/ts/common/menu-base.ts +2736 -0
  39. package/dist/ts/common/menu-scroll.d.ts +29 -0
  40. package/dist/ts/common/menu-scroll.ts +105 -0
  41. package/dist/ts/common/v-scroll-model.d.ts +16 -0
  42. package/dist/ts/common/v-scroll.d.ts +106 -0
  43. package/dist/ts/common/v-scroll.ts +454 -0
  44. package/dist/ts/context-menu/context-menu-model.d.ts +47 -0
  45. package/dist/ts/context-menu/context-menu.d.ts +102 -0
  46. package/dist/ts/context-menu/context-menu.ts +165 -0
  47. package/dist/ts/context-menu/index.d.ts +5 -0
  48. package/dist/ts/context-menu/index.ts +5 -0
  49. package/dist/ts/index.d.ts +16 -0
  50. package/dist/ts/index.ts +16 -0
  51. package/dist/ts/menu/index.d.ts +5 -0
  52. package/dist/ts/menu/index.ts +5 -0
  53. package/dist/ts/menu/menu-model.d.ts +70 -0
  54. package/dist/ts/menu/menu.d.ts +127 -0
  55. package/dist/ts/menu/menu.ts +313 -0
  56. package/dist/ts/sidebar/index.d.ts +5 -0
  57. package/dist/ts/sidebar/index.ts +5 -0
  58. package/dist/ts/sidebar/sidebar-model.d.ts +200 -0
  59. package/dist/ts/sidebar/sidebar.d.ts +336 -0
  60. package/dist/ts/sidebar/sidebar.ts +907 -0
  61. package/dist/ts/stepper/index.d.ts +3 -0
  62. package/dist/ts/stepper/index.ts +3 -0
  63. package/dist/ts/stepper/stepper-model.d.ts +159 -0
  64. package/dist/ts/stepper/stepper.d.ts +381 -0
  65. package/dist/ts/stepper/stepper.ts +1350 -0
  66. package/dist/ts/stepper-base/index.d.ts +5 -0
  67. package/dist/ts/stepper-base/index.ts +6 -0
  68. package/dist/ts/stepper-base/stepper-base-model.d.ts +124 -0
  69. package/dist/ts/stepper-base/stepper-base.d.ts +187 -0
  70. package/dist/ts/stepper-base/stepper-base.ts +290 -0
  71. package/dist/ts/tab/index.d.ts +5 -0
  72. package/dist/ts/tab/index.ts +5 -0
  73. package/dist/ts/tab/tab-model.d.ts +408 -0
  74. package/dist/ts/tab/tab.d.ts +715 -0
  75. package/dist/ts/tab/tab.ts +2842 -0
  76. package/dist/ts/toolbar/index.d.ts +5 -0
  77. package/dist/ts/toolbar/index.ts +5 -0
  78. package/dist/ts/toolbar/toolbar-model.d.ts +294 -0
  79. package/dist/ts/toolbar/toolbar.d.ts +541 -0
  80. package/dist/ts/toolbar/toolbar.ts +2646 -0
  81. package/dist/ts/treeview/index.d.ts +5 -0
  82. package/dist/ts/treeview/index.ts +5 -0
  83. package/dist/ts/treeview/treeview-model.d.ts +637 -0
  84. package/dist/ts/treeview/treeview.d.ts +1518 -0
  85. package/dist/ts/treeview/treeview.ts +6780 -0
  86. package/package.json +70 -17
  87. package/src/context-menu/context-menu-model.d.ts +1 -1
  88. package/src/context-menu/context-menu.js +1 -1
  89. package/src/tab/tab.js +1 -0
  90. package/styles/accordion/_bootstrap-dark-definition.scss +1 -1
  91. package/styles/accordion/_bootstrap-definition.scss +1 -1
  92. package/styles/accordion/bootstrap-dark.css +1 -1
  93. package/styles/accordion/bootstrap.css +1 -1
  94. package/styles/bds-lite.css +1 -1
  95. package/styles/bds.css +1 -1
  96. package/styles/bootstrap-dark-lite.css +2 -2
  97. package/styles/bootstrap-dark.css +2 -2
  98. package/styles/bootstrap-lite.css +2 -2
  99. package/styles/bootstrap.css +2 -2
  100. package/styles/bootstrap4-lite.css +1 -1
  101. package/styles/bootstrap4.css +1 -1
  102. package/styles/bootstrap5-dark-lite.css +1 -1
  103. package/styles/bootstrap5-dark.css +1 -1
  104. package/styles/bootstrap5-lite.css +1 -1
  105. package/styles/bootstrap5.3-lite.css +1 -1
  106. package/styles/bootstrap5.3.css +9 -1
  107. package/styles/bootstrap5.css +1 -1
  108. package/styles/fabric-dark-lite.css +1 -1
  109. package/styles/fabric-dark.css +1 -1
  110. package/styles/fabric-lite.css +1 -1
  111. package/styles/fabric.css +1 -1
  112. package/styles/fluent-dark-lite.css +1 -1
  113. package/styles/fluent-dark.css +1 -1
  114. package/styles/fluent-lite.css +1 -1
  115. package/styles/fluent.css +1 -1
  116. package/styles/fluent2-lite.css +4 -1
  117. package/styles/fluent2.css +4 -1
  118. package/styles/h-scroll/_layout.scss +1 -1
  119. package/styles/h-scroll/bds.css +1 -1
  120. package/styles/h-scroll/bootstrap-dark.css +1 -1
  121. package/styles/h-scroll/bootstrap.css +1 -1
  122. package/styles/h-scroll/bootstrap4.css +1 -1
  123. package/styles/h-scroll/bootstrap5-dark.css +1 -1
  124. package/styles/h-scroll/bootstrap5.3.css +1 -1
  125. package/styles/h-scroll/bootstrap5.css +1 -1
  126. package/styles/h-scroll/fabric-dark.css +1 -1
  127. package/styles/h-scroll/fabric.css +1 -1
  128. package/styles/h-scroll/fluent-dark.css +1 -1
  129. package/styles/h-scroll/fluent.css +1 -1
  130. package/styles/h-scroll/fluent2.css +1 -1
  131. package/styles/h-scroll/highcontrast-light.css +1 -1
  132. package/styles/h-scroll/highcontrast.css +1 -1
  133. package/styles/h-scroll/material-dark.css +1 -1
  134. package/styles/h-scroll/material.css +1 -1
  135. package/styles/h-scroll/material3-dark.css +1 -1
  136. package/styles/h-scroll/material3.css +1 -1
  137. package/styles/h-scroll/tailwind-dark.css +1 -1
  138. package/styles/h-scroll/tailwind.css +1 -1
  139. package/styles/h-scroll/tailwind3.css +1 -1
  140. package/styles/highcontrast-light-lite.css +1 -1
  141. package/styles/highcontrast-light.css +1 -1
  142. package/styles/highcontrast-lite.css +1 -1
  143. package/styles/highcontrast.css +1 -1
  144. package/styles/material-dark-lite.css +1 -1
  145. package/styles/material-dark.css +1 -1
  146. package/styles/material-lite.css +1 -1
  147. package/styles/material.css +1 -1
  148. package/styles/material3-dark-lite.css +1 -1
  149. package/styles/material3-dark.css +1 -7
  150. package/styles/material3-lite.css +1 -1
  151. package/styles/material3.css +1 -7
  152. package/styles/tailwind-dark-lite.css +1 -1
  153. package/styles/tailwind-dark.css +1 -1
  154. package/styles/tailwind-lite.css +1 -1
  155. package/styles/tailwind.css +1 -1
  156. package/styles/tailwind3-lite.css +1 -1
  157. package/styles/tailwind3.css +1 -1
  158. package/styles/toolbar/_layout.scss +1 -1
  159. package/styles/treeview/_bigger.scss +2 -2
  160. package/styles/treeview/_bootstrap5.3-definition.scss +1 -0
  161. package/styles/treeview/_layout.scss +3 -0
  162. package/styles/treeview/bootstrap5.3.css +8 -0
  163. package/styles/treeview/fluent2.css +3 -0
  164. package/styles/treeview/material3-dark.css +0 -6
  165. package/styles/treeview/material3.css +0 -6
@@ -0,0 +1,959 @@
1
+ import { Component, NotifyPropertyChanges, INotifyPropertyChanged, ChildProperty, Property, Collection, append, extend, Event, EmitType, BaseEventArgs, EventHandler, closest, addClass, removeClass, detach, remove, initializeCSPTemplate, isNullOrUndefined } from '@syncfusion/ej2-base';
2
+ import { ListBase, ListBaseOptions } from '@syncfusion/ej2-lists';
3
+ import { Popup } from '@syncfusion/ej2-popups';
4
+ import { BreadcrumbModel, BreadcrumbItemModel } from './breadcrumb-model';
5
+
6
+ type obj = { [key: string]: Object };
7
+ const ICONRIGHT: string = 'e-icon-right';
8
+ const ITEMTEXTCLASS: string = 'e-breadcrumb-text';
9
+ const ICONCLASS: string = 'e-breadcrumb-icon';
10
+ const MENUCLASS: string = 'e-breadcrumb-menu';
11
+ const ITEMCLASS: string = 'e-breadcrumb-item';
12
+ const POPUPCLASS: string = 'e-breadcrumb-popup';
13
+ const WRAPMODECLASS: string = 'e-breadcrumb-wrap-mode';
14
+ const SCROLLMODECLASS: string = 'e-breadcrumb-scroll-mode';
15
+ const TABINDEX: string = 'tabindex';
16
+ const DISABLEDCLASS: string = 'e-disabled';
17
+ const ARIADISABLED: string = 'aria-disabled';
18
+ const DOT: string = '.';
19
+ /**
20
+ * Defines the Breadcrumb overflow modes.
21
+ */
22
+ export enum BreadcrumbOverflowMode {
23
+ /**
24
+ * Hidden mode shows the maximum number of items possible in the container space and hides the remaining items.
25
+ * Clicking on a previous item will make the hidden item visible.
26
+ */
27
+ Hidden = 'Hidden',
28
+
29
+ /**
30
+ * Collapsed mode shows the first and last Breadcrumb items and hides the remaining items with a collapsed icon.
31
+ * When the collapsed icon is clicked, all items become visible and navigable.
32
+ */
33
+ Collapsed = 'Collapsed',
34
+
35
+ /**
36
+ * Menu mode shows the number of Breadcrumb items that can be accommodated within the container space and creates a submenu with the remaining items.
37
+ */
38
+ Menu = 'Menu',
39
+
40
+ /**
41
+ * Wrap mode wraps the items to multiple lines when the Breadcrumb’s width exceeds the container space.
42
+ */
43
+ Wrap = 'Wrap',
44
+ /**
45
+ * Scroll mode shows an HTML scroll bar when the Breadcrumb’s width exceeds the container space.
46
+ */
47
+ Scroll = 'Scroll',
48
+
49
+ /**
50
+ * None mode shows all the items in a single line.
51
+ */
52
+ None = 'None'
53
+ }
54
+
55
+ export class BreadcrumbItem extends ChildProperty<BreadcrumbItem> {
56
+ /**
57
+ * Specifies the text content of the Breadcrumb item.
58
+ *
59
+ * @default ''
60
+ */
61
+ @Property('')
62
+ public text: string;
63
+
64
+ /**
65
+ * Specifies the id of the Breadcrumb item.
66
+ *
67
+ * @default ''
68
+ */
69
+ @Property('')
70
+ public id: string;
71
+
72
+ /**
73
+ * Specifies the Url of the Breadcrumb item that will be activated when clicked.
74
+ *
75
+ * @default ''
76
+ */
77
+ @Property('')
78
+ public url: string;
79
+
80
+ /**
81
+ * Defines a class/multiple classes separated by a space for the item that is used to include an icon.
82
+ *
83
+ * @default null
84
+ */
85
+ @Property(null)
86
+ public iconCss: string;
87
+
88
+ /**
89
+ * Enable or disable the breadcrumb item, when set to true, the breadcrumb item will be disabled.
90
+ *
91
+ * @default false
92
+ */
93
+ @Property(false)
94
+ public disabled: boolean;
95
+ }
96
+
97
+ /**
98
+ * Interface for item click event.
99
+ */
100
+ export interface BreadcrumbClickEventArgs extends BaseEventArgs {
101
+ /**
102
+ * Specifies the item's element.
103
+ */
104
+ element: HTMLElement;
105
+ /**
106
+ * Specifies the Breadcrumb item.
107
+ */
108
+ item: BreadcrumbItemModel;
109
+ /**
110
+ * Specifies the item click event.
111
+ */
112
+ event: Event;
113
+ /**
114
+ * Cancels the Breadcrumb item after click action.
115
+ */
116
+ cancel: boolean;
117
+ }
118
+
119
+ /**
120
+ * Interface for before item render event.
121
+ */
122
+ export interface BreadcrumbBeforeItemRenderEventArgs extends BaseEventArgs {
123
+ /**
124
+ * Specifies the item's element.
125
+ */
126
+ element: HTMLElement;
127
+ /**
128
+ * Specifies the Breadcrumb item.
129
+ */
130
+ item: BreadcrumbItemModel;
131
+ /**
132
+ * Cancels the Breadcrumb item rendering.
133
+ */
134
+ cancel: boolean;
135
+ }
136
+
137
+ /**
138
+ * Breadcrumb is a graphical user interface that helps to identify or highlight the current location within a hierarchical structure of websites.
139
+ * The aim is to make the user aware of their current position in a hierarchy of website links.
140
+ * ```html
141
+ * <nav id='breadcrumb'></nav>
142
+ * ```
143
+ * ```typescript
144
+ * <script>
145
+ * var breadcrumbObj = new Breadcrumb({ items: [{ text: 'Home', url: '/' }, { text: 'Index', url: './index.html }]});
146
+ * breadcrumbObj.appendTo("#breadcrumb");
147
+ * </script>
148
+ * ```
149
+ */
150
+ @NotifyPropertyChanges
151
+ export class Breadcrumb extends Component<HTMLElement> implements INotifyPropertyChanged {
152
+ private isExpanded: boolean;
153
+ private startIndex: number;
154
+ private endIndex: number;
155
+ private _maxItems: number;
156
+ private popupObj: Popup;
157
+ private popupUl: HTMLElement;
158
+ private delegateClickHanlder: Function;
159
+ private isPopupCreated: boolean = false;
160
+ /**
161
+ * Defines the Url based on which the Breadcrumb items are generated.
162
+ *
163
+ * @default ''
164
+ */
165
+ @Property('')
166
+ public url: string;
167
+
168
+ /**
169
+ * Defines the list of Breadcrumb items.
170
+ *
171
+ * @default []
172
+ */
173
+ @Collection<BreadcrumbItemModel>([], BreadcrumbItem)
174
+ public items: BreadcrumbItemModel[];
175
+
176
+ /**
177
+ * Specifies the Url of the active Breadcrumb item.
178
+ *
179
+ * @default ''
180
+ */
181
+ @Property('')
182
+ public activeItem: string;
183
+
184
+ /**
185
+ * Specifies an integer to enable overflow behavior when the Breadcrumb items count exceeds and it is based on the overflowMode property.
186
+ *
187
+ * @default -1
188
+ * @aspType int
189
+ */
190
+ @Property(-1)
191
+ public maxItems: number;
192
+
193
+ /**
194
+ * Specifies the overflow mode of the Breadcrumb item when it exceeds maxItems count. The possible values are,
195
+ * - Default: Specified maxItems count will be visible and the remaining items will be hidden. While clicking on the previous item, the hidden item will become visible.
196
+ * - Collapsed: Only the first and last items will be visible, and the remaining items will be hidden in the collapsed icon. When the collapsed icon is clicked, all items become visible.
197
+ * - Menu: Shows the number of breadcrumb items that can be accommodated within the container space, and creates a sub menu with the remaining items.
198
+ * - Wrap: Wraps the items on multiple lines when the Breadcrumb’s width exceeds the container space.
199
+ * - Scroll: Shows an HTML scroll bar when the Breadcrumb’s width exceeds the container space.
200
+ * - None: Shows all the items on a single line.
201
+ *
202
+ * @isenumeration true
203
+ * @default BreadcrumbOverflowMode.Menu
204
+ * @asptype BreadcrumbOverflowMode
205
+ */
206
+ @Property('Menu')
207
+ public overflowMode: string | BreadcrumbOverflowMode;
208
+
209
+ /**
210
+ * Defines class/multiple classes separated by a space in the Breadcrumb element.
211
+ *
212
+ * @default ''
213
+ */
214
+ @Property('')
215
+ public cssClass: string;
216
+
217
+ /**
218
+ * Specifies the template for Breadcrumb item.
219
+ *
220
+ * @default null
221
+ * @aspType string
222
+ */
223
+ @Property(null)
224
+ public itemTemplate: string | Function;
225
+
226
+ /**
227
+ * Specifies the separator template for Breadcrumb.
228
+ *
229
+ * @default '/'
230
+ * @aspType string
231
+ */
232
+ @Property('/')
233
+ public separatorTemplate: string | Function;
234
+
235
+ /**
236
+ * Enable or disable the item's navigation, when set to false, each item navigation will be prevented.
237
+ *
238
+ * @default true
239
+ */
240
+ @Property(true)
241
+ public enableNavigation: boolean;
242
+
243
+ /**
244
+ * Enable or disable the active item navigation, when set to true, active item will be navigable.
245
+ *
246
+ * @default false
247
+ */
248
+ @Property(false)
249
+ public enableActiveItemNavigation: boolean;
250
+
251
+ /**
252
+ * Enable or disable the breadcrumb, when set to true, the breadcrumb will be disabled.
253
+ *
254
+ * @default false
255
+ */
256
+ @Property(false)
257
+ public disabled: boolean;
258
+
259
+ /**
260
+ * Overrides the global culture and localization value for this component. Default global culture is 'en-US'.
261
+ *
262
+ * @default ''
263
+ * @private
264
+ * @aspIgnore
265
+ */
266
+ @Property('')
267
+ public locale: string;
268
+
269
+ /**
270
+ * Triggers while rendering each breadcrumb item.
271
+ *
272
+ * @event beforeItemRender
273
+ */
274
+ @Event()
275
+ public beforeItemRender: EmitType<BreadcrumbBeforeItemRenderEventArgs>;
276
+
277
+ /**
278
+ * Triggers while clicking the breadcrumb item.
279
+ *
280
+ * @event itemClick
281
+ */
282
+ @Event()
283
+ public itemClick: EmitType<BreadcrumbClickEventArgs>;
284
+
285
+ /**
286
+ * Triggers once the component rendering is completed.
287
+ *
288
+ * @event created
289
+ */
290
+ @Event()
291
+ public created: EmitType<Event>;
292
+
293
+ /**
294
+ * Constructor for creating the widget.
295
+ *
296
+ * @private
297
+ * @param {BreadcrumbModel} options - Specifies the Breadcrumb model.
298
+ * @param {string | HTMLElement} element - Specifies the element.
299
+ */
300
+ public constructor(options?: BreadcrumbModel, element?: string | HTMLElement) {
301
+ super(options, <string | HTMLElement>element);
302
+ }
303
+
304
+ /**
305
+ * @private
306
+ * @returns {void}
307
+ */
308
+ protected preRender(): void {
309
+ // pre render code
310
+ }
311
+
312
+ /**
313
+ * Initialize the control rendering.
314
+ *
315
+ * @private
316
+ * @returns {void}
317
+ */
318
+ protected render(): void {
319
+ this.initialize();
320
+ this.renderItems(this.items);
321
+ this.wireEvents();
322
+ }
323
+
324
+ private initialize(): void {
325
+ this._maxItems = this.maxItems;
326
+ if (isNullOrUndefined(this.element.getAttribute('aria-label'))) {
327
+ this.element.setAttribute('aria-label', 'breadcrumb');
328
+ }
329
+ if (this.cssClass) {
330
+ addClass([this.element], this.cssClass.replace(/\s+/g, ' ').trim().split(' '));
331
+ }
332
+ if (this.enableRtl) {
333
+ this.element.classList.add('e-rtl');
334
+ }
335
+ if (this.disabled) {
336
+ this.element.classList.add(DISABLEDCLASS);
337
+ this.element.setAttribute(ARIADISABLED, 'true');
338
+ }
339
+ if (this.overflowMode === 'Wrap') {
340
+ this.element.classList.add(WRAPMODECLASS);
341
+ } else if (this.overflowMode === 'Scroll') {
342
+ this.element.classList.add(SCROLLMODECLASS);
343
+ }
344
+ this.initItems();
345
+ this.initPvtProps();
346
+ }
347
+
348
+ private initPvtProps(): void {
349
+ if (this.overflowMode === 'Hidden' && this._maxItems > 0) {
350
+ this.endIndex = this.getEndIndex();
351
+ this.startIndex = this.endIndex + 1 - (this._maxItems - 1);
352
+ }
353
+ if (this.overflowMode === 'Menu') {
354
+ if (this._maxItems >= 0) {
355
+ this.startIndex = this._maxItems > 1 ? 1 : 0;
356
+ this.endIndex = this.getEndIndex();
357
+ this.popupUl = this.createElement('ul', { attrs: { TABINDEX: '0', 'role': 'menu' } });
358
+ } else {
359
+ this.startIndex = this.endIndex = null;
360
+ }
361
+ }
362
+ }
363
+
364
+ private getEndIndex(): number {
365
+ let endIndex: number;
366
+ if (this.activeItem) {
367
+ this.items.forEach((item: BreadcrumbItemModel, idx: number) => {
368
+ if (item.url === this.activeItem || item.text === this.activeItem) {
369
+ endIndex = idx;
370
+ }
371
+ });
372
+ } else {
373
+ endIndex = this.items.length - 1;
374
+ }
375
+ return endIndex;
376
+ }
377
+
378
+ private initItems(): void {
379
+ if (!this.items.length) {
380
+ let baseUri: string;
381
+ let uri: string[];
382
+ const items: BreadcrumbItemModel[] = [];
383
+ if (this.url) {
384
+ const url: URL = new URL(this.url, window.location.origin);
385
+ baseUri = url.origin + '/';
386
+ uri = url.href.split(baseUri)[1].split('/');
387
+ } else {
388
+ baseUri = window.location.origin + '/';
389
+ uri = window.location.href.split(baseUri)[1].split('/');
390
+ }
391
+ items.push({ iconCss: 'e-icons e-home', url: baseUri });
392
+ for (let i: number = 0; i < uri.length; i++) {
393
+ if (uri[i as number]) {
394
+ items.push({ text: uri[i as number], url: baseUri + uri[i as number] });
395
+ baseUri += uri[i as number] + '/';
396
+ }
397
+ }
398
+ this.setProperties({ items: items }, true);
399
+ }
400
+ }
401
+
402
+ private renderItems(items: BreadcrumbItemModel[]): void {
403
+ let item: BreadcrumbItemModel[] | object[]; let isSingleLevel: boolean;
404
+ const isIconRight: boolean = this.element.classList.contains(ICONRIGHT);
405
+ const itemsLength: number = items.length;
406
+ if (itemsLength) {
407
+ let isActiveItem: boolean;
408
+ let isLastItem: boolean;
409
+ let isLastItemInPopup: boolean;
410
+ let j: number = 0;
411
+ let wrapDiv: HTMLElement;
412
+ const len: number = (itemsLength * 2) - 1;
413
+ let isItemCancelled: boolean = false;
414
+ const ol: HTMLElement = this.createElement('ol', { className: this.overflowMode === 'Wrap' ? 'e-breadcrumb-wrapped-ol' : '' });
415
+ const firstOl: HTMLElement = this.createElement('ol', { className: this.overflowMode === 'Wrap' ? 'e-breadcrumb-first-ol' : '' });
416
+ const showIcon: boolean = this.hasField(items, 'iconCss');
417
+ const isCollasped: boolean = (this.overflowMode === 'Collapsed' && this._maxItems > 0 && itemsLength > this._maxItems && !this.isExpanded);
418
+ const isDefaultOverflowMode: boolean = (this.overflowMode === 'Hidden' && this._maxItems > 0);
419
+ if (this.overflowMode === 'Menu' && this.popupUl) {
420
+ this.popupUl.innerHTML = '';
421
+ }
422
+ const listBaseOptions: ListBaseOptions = {
423
+ moduleName: this.getModuleName(),
424
+ showIcon: showIcon,
425
+ itemNavigable: true,
426
+ itemCreated: (args: { curData: BreadcrumbItemModel, item: HTMLElement, fields: obj }): void => {
427
+ const isLastItem: boolean = (args.curData as { isLastItem: boolean }).isLastItem;
428
+ if (isLastItem && args.item.children.length && !this.itemTemplate) {
429
+ delete (args.curData as { isLastItem: boolean }).isLastItem;
430
+ if (!isLastItemInPopup && !this.enableActiveItemNavigation) {
431
+ args.item.innerHTML = this.createElement('span', { className: ITEMTEXTCLASS, innerHTML: args.item.children[0].innerHTML }).outerHTML;
432
+ }
433
+ }
434
+ if (args.curData.iconCss && !args.curData.text && !this.itemTemplate) {
435
+ args.item.classList.add('e-icon-item');
436
+ }
437
+ if (isDefaultOverflowMode) {
438
+ args.item.setAttribute('item-index', j.toString());
439
+ }
440
+ const eventArgs: BreadcrumbBeforeItemRenderEventArgs = {
441
+ item: extend({}, (args.curData as { properties: object }).properties ?
442
+ (args.curData as { properties: object }).properties : args.curData), element: args.item, cancel: false
443
+ };
444
+ this.trigger('beforeItemRender', eventArgs);
445
+ isItemCancelled = eventArgs.cancel;
446
+ const containsRightIcon: boolean = (isIconRight || eventArgs.element.classList.contains(ICONRIGHT));
447
+ if (containsRightIcon && args.curData.iconCss && !this.itemTemplate) {
448
+ args.item.querySelector('.e-anchor-wrap').appendChild(args.item.querySelector(DOT + ICONCLASS));
449
+ }
450
+ if (eventArgs.item.disabled) {
451
+ args.item.setAttribute(ARIADISABLED, 'true');
452
+ args.item.classList.add(DISABLEDCLASS);
453
+ }
454
+ if (eventArgs.item.id) {
455
+ args.item.setAttribute('id', eventArgs.item.id);
456
+ }
457
+ if ((eventArgs.item.disabled || this.disabled) && args.item.children.length && !this.itemTemplate) {
458
+ args.item.children[0].setAttribute(TABINDEX, '-1');
459
+ }
460
+ if ((args.curData as { isEmptyUrl: boolean }).isEmptyUrl) {
461
+ args.item.children[0].removeAttribute('href');
462
+ if ((!isLastItem || (isLastItem && this.enableActiveItemNavigation)) && !(eventArgs.item.disabled
463
+ || this.disabled)) {
464
+ args.item.children[0].setAttribute(TABINDEX, '0');
465
+ EventHandler.add(args.item.children[0], 'keydown', this.keyDownHandler, this);
466
+ }
467
+ }
468
+ args.item.removeAttribute('role');
469
+ if (isLastItem) {
470
+ args.item.setAttribute('data-active-item', '');
471
+ }
472
+ if (!this.itemTemplate) {
473
+ this.beforeItemRenderChanges(args.curData, eventArgs.item, args.item, containsRightIcon);
474
+ }
475
+ }
476
+ };
477
+ for (let i: number = 0; i < len; (i % 2 && j++), i++) {
478
+ isActiveItem = (this.activeItem && (this.activeItem === items[j as number].url ||
479
+ this.activeItem === items[j as number].text));
480
+ if (isCollasped && i > 1 && i < len - 2) {
481
+ continue;
482
+ } else if (isDefaultOverflowMode && ((j < this.startIndex || j > this.endIndex)
483
+ && (i % 2 ? j !== this.startIndex - 1 : true)) && j !== 0) {
484
+ continue;
485
+ }
486
+ if (i % 2) {
487
+ // separator item
488
+ wrapDiv = this.createElement('div', { className: 'e-breadcrumb-item-wrapper' });
489
+ if ((this.separatorTemplate && this.separatorTemplate === '/') || isNullOrUndefined(this.separatorTemplate)) {
490
+ listBaseOptions.template = initializeCSPTemplate( function(): string {
491
+ return '/';
492
+ });
493
+ } else {
494
+ listBaseOptions.template = this.separatorTemplate as string | Function;
495
+ }
496
+ listBaseOptions.itemClass = 'e-breadcrumb-separator';
497
+ isSingleLevel = false;
498
+ item = [{ previousItem: items[j as number], nextItem: items[j + 1] }];
499
+ } else {
500
+ // list item
501
+ listBaseOptions.itemClass = '';
502
+ if (this.itemTemplate) {
503
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
504
+ listBaseOptions.template = this.itemTemplate as any;
505
+ isSingleLevel = false;
506
+ } else {
507
+ isSingleLevel = true;
508
+ }
509
+ item = [extend({}, (items[j as number] as { properties: object }).properties ?
510
+ (items[j as number] as { properties: object }).properties
511
+ : items[j as number])];
512
+ if (!(item as BreadcrumbItemModel[])[0].url && !this.itemTemplate) {
513
+ item = [extend({}, (item as BreadcrumbItemModel[])[0], { isEmptyUrl: true, url: '#' })];
514
+ }
515
+ isLastItem = (isDefaultOverflowMode || this.overflowMode === 'Menu') && (j === this.endIndex);
516
+ if (((i === len - 1 || isLastItem) && !this.itemTemplate) || isActiveItem) {
517
+ (item[0] as { isLastItem: boolean }).isLastItem = true;
518
+ }
519
+ }
520
+ let parent: HTMLElement = ol;
521
+ const lastPopupItemIdx: number = this.startIndex + this.endIndex - this._maxItems;
522
+ if (this.overflowMode === 'Menu' && ((j >= this.startIndex && (j <= lastPopupItemIdx && (i % 2 ? !(j === lastPopupItemIdx) : true)) && this.endIndex >= this._maxItems && this._maxItems > 0) || this._maxItems === 0)) {
523
+ if (i % 2) {
524
+ continue;
525
+ } else {
526
+ parent = this.popupUl;
527
+ if (isLastItem) {
528
+ isLastItemInPopup = true;
529
+ }
530
+ }
531
+ } else if (this.overflowMode === 'Wrap') {
532
+ if (i === 0) {
533
+ parent = firstOl;
534
+ } else {
535
+ parent = wrapDiv;
536
+ }
537
+ }
538
+ const li: NodeList = ListBase.createList(this.createElement, item as { [key: string]: Object; }[],
539
+ listBaseOptions, isSingleLevel, this).childNodes;
540
+ if (!isItemCancelled) {
541
+ append(li, parent);
542
+ } else if (isDefaultOverflowMode || isCollasped || this.overflowMode === 'Menu' || this.overflowMode === 'Wrap') {
543
+ items.splice(j, 1);
544
+ this.initPvtProps();
545
+ return this.reRenderItems();
546
+ }
547
+ else if ((i === len - 1 || isLastItem)) {
548
+ remove(parent.lastElementChild);
549
+ }
550
+ if (this.overflowMode === 'Wrap' && i !== 0 && i % 2 === 0) {
551
+ ol.appendChild(wrapDiv);
552
+ }
553
+ if (isCollasped && i === 1) {
554
+ const li: Element = this.createElement('li', { className: 'e-icons e-breadcrumb-collapsed', attrs: { TABINDEX: '0' } });
555
+ EventHandler.add(li, 'keyup', this.expandHandler, this);
556
+ ol.appendChild(li);
557
+ }
558
+ if (this.overflowMode === 'Menu' && this.startIndex === i && this.endIndex >= this._maxItems && this._maxItems >= 0) {
559
+ const menu: Element = this.getMenuElement();
560
+ EventHandler.add(menu, 'keyup', this.keyDownHandler, this);
561
+ ol.appendChild(menu);
562
+ }
563
+ if (isActiveItem || isLastItem) {
564
+ break;
565
+ }
566
+ if (isItemCancelled) {
567
+ i++;
568
+ }
569
+ }
570
+ if ((this as unknown as { isReact: boolean }).isReact) {
571
+ this.renderReactTemplates();
572
+ setTimeout(() => {
573
+ this.calculateMaxItems();
574
+ }, 5);
575
+ }
576
+ if (this.overflowMode === 'Wrap') {
577
+ this.element.appendChild(firstOl);
578
+ }
579
+ this.element.appendChild(ol);
580
+ if (!(this as unknown as { isReact: boolean }).isReact) {
581
+ this.calculateMaxItems();
582
+ }
583
+ }
584
+ }
585
+
586
+ private calculateMaxItems(): void {
587
+ if (this.overflowMode === 'Hidden' || this.overflowMode === 'Collapsed' || this.overflowMode === 'Menu') {
588
+ let maxItems: number;
589
+ const width: number = this.element.offsetWidth;
590
+ const liElems: HTMLElement[] = [].slice.call(this.element.children[0].children).reverse();
591
+ let liWidth: number = this.overflowMode === 'Menu' ? 0 : liElems[liElems.length - 1].offsetWidth + (liElems[liElems.length - 2] ? liElems[liElems.length - 2].offsetWidth : 0);
592
+ if (this.overflowMode === 'Menu') {
593
+ const menuEle: HTMLElement = this.getMenuElement();
594
+ this.element.appendChild(menuEle);
595
+ liWidth += menuEle.offsetWidth;
596
+ remove(menuEle);
597
+ }
598
+ for (let i: number = 0; i < liElems.length - 2; i++) {
599
+ if (liWidth > width) {
600
+ maxItems = Math.ceil((i - 1) / 2) + ((this.overflowMode === 'Menu' && i <= 2) ? 0 : 1);
601
+ if (((this.maxItems > maxItems && !(this.maxItems > -1 && maxItems === -1)) ||
602
+ this.maxItems === -1) && this._maxItems !== maxItems) {
603
+ this._maxItems = maxItems;
604
+ this.initPvtProps();
605
+ return this.reRenderItems();
606
+ } else {
607
+ break;
608
+ }
609
+ } else {
610
+ if (this.overflowMode === 'Menu' && i === 2) {
611
+ liWidth += liElems[liElems.length - 1].offsetWidth + liElems[liElems.length - 2].offsetWidth;
612
+ if (liWidth > width) {
613
+ this._maxItems = 1;
614
+ this.initPvtProps();
615
+ return this.reRenderItems();
616
+ }
617
+ }
618
+ if (!(this.overflowMode === 'Menu' && liElems[i as number].classList.contains(MENUCLASS))) {
619
+ liWidth += liElems[i as number].offsetWidth;
620
+ }
621
+ }
622
+ }
623
+ } else if ((this.overflowMode === 'Wrap' || this.overflowMode === 'Scroll') && this._maxItems > 0) {
624
+ let width: number = 0;
625
+ const liElems: NodeListOf<HTMLElement> = this.element.querySelectorAll(DOT + ITEMCLASS);
626
+ if (liElems.length > this._maxItems + this._maxItems - 1) {
627
+ for (let i: number = this.overflowMode === 'Wrap' ? 1 : 0; i < this._maxItems + this._maxItems - 1; i++) {
628
+ width += liElems[i as number].offsetWidth;
629
+ }
630
+ width = width + 5 + (parseInt(getComputedStyle(this.element.children[0]).paddingLeft, 10) * 2);
631
+ if (this.overflowMode === 'Wrap') {
632
+ (this.element.querySelector('.e-breadcrumb-wrapped-ol') as HTMLElement).style.width = width + 'px';
633
+ } else {
634
+ this.element.style.width = width + 'px';
635
+ }
636
+ }
637
+ }
638
+ }
639
+
640
+ private hasField(items: BreadcrumbItemModel[], field: string): boolean {
641
+ for (let i: number = 0, len: number = items.length; i < len; i++) {
642
+ if ((<obj>items[i as number])[`${field}`]) {
643
+ return true;
644
+ }
645
+ }
646
+ return false;
647
+ }
648
+
649
+ private getMenuElement(): HTMLElement {
650
+ return this.createElement('li', { className: 'e-icons e-breadcrumb-menu', attrs: { TABINDEX: '0' } });
651
+ }
652
+
653
+ private beforeItemRenderChanges(prevItem: BreadcrumbItemModel, currItem: BreadcrumbItemModel, elem: Element, isRightIcon: boolean)
654
+ : void {
655
+ const wrapElem: Element = elem.querySelector('.e-anchor-wrap');
656
+ if (wrapElem) {
657
+ wrapElem.parentElement.setAttribute('aria-label', 'home');
658
+ }
659
+ if (currItem.text !== prevItem.text && wrapElem) {
660
+ wrapElem.childNodes.forEach((child: Element) => {
661
+ if (child.nodeType === Node.TEXT_NODE) {
662
+ child.textContent = currItem.text;
663
+ }
664
+ });
665
+ }
666
+ if (currItem.iconCss !== prevItem.iconCss && wrapElem) { // wrapElem - for checking it is item not a separator
667
+ const iconElem: Element = elem.querySelector(DOT + ICONCLASS);
668
+ if (iconElem) {
669
+ if (currItem.iconCss) {
670
+ removeClass([iconElem], prevItem.iconCss.split(' '));
671
+ addClass([iconElem], currItem.iconCss.split(' '));
672
+ } else {
673
+ remove(iconElem);
674
+ }
675
+ } else if (currItem.iconCss) {
676
+ const iconElem: Element = this.createElement('span', { className: ICONCLASS + ' ' + currItem.iconCss });
677
+ if (isRightIcon) {
678
+ append([iconElem], wrapElem);
679
+ } else {
680
+ wrapElem.insertBefore(iconElem, wrapElem.childNodes[0]);
681
+ }
682
+ }
683
+ }
684
+ if (currItem.url !== prevItem.url && this.enableNavigation) {
685
+ const anchor: Element = elem.querySelector('a.' + ITEMTEXTCLASS);
686
+ if (anchor) {
687
+ if (currItem.url) {
688
+ anchor.setAttribute('href', currItem.url);
689
+ } else {
690
+ anchor.removeAttribute('href');
691
+ }
692
+ }
693
+ }
694
+ }
695
+
696
+ private reRenderItems(): void {
697
+ if (this.overflowMode === 'Menu' && this.popupObj && this.popupObj.element.classList.contains('e-popup-open') && this.popupObj.element.querySelector('.e-edit-template')) {
698
+ this.popupObj.hide();
699
+ this.popupObj.destroy();
700
+ this.isPopupCreated = false;
701
+ detach(this.popupObj.element);
702
+ }
703
+ this.element.innerHTML = '';
704
+ this.renderItems(this.items);
705
+ }
706
+
707
+ private clickHandler(e: MouseEvent): void {
708
+ const li: Element = closest(e.target as Element, DOT + ITEMCLASS + ':not(.e-breadcrumb-separator)');
709
+ if (!this.enableNavigation) {
710
+ e.preventDefault();
711
+ }
712
+ if (li && (closest(e.target as Element, DOT + ITEMTEXTCLASS) || this.itemTemplate)) {
713
+ let idx: number;
714
+ if (this.overflowMode === 'Wrap') {
715
+ idx = [].slice.call(this.element.querySelectorAll(DOT + ITEMCLASS)).indexOf(li);
716
+ } else {
717
+ idx = [].slice.call(li.parentElement.children).indexOf(li);
718
+ }
719
+ if (this.overflowMode === 'Menu') {
720
+ if (closest(e.target as Element, DOT + POPUPCLASS)) {
721
+ idx += this.startIndex;
722
+ this.endIndex = idx;
723
+ if (e.type === 'keydown') {
724
+ this.documentClickHandler(e);
725
+ }
726
+ } else if (this.element.querySelector(DOT + MENUCLASS)) {
727
+ if (idx > [].slice.call(this.element.children[0].children).indexOf(this.element.querySelector(DOT + MENUCLASS))) {
728
+ idx += (this.popupUl.childElementCount * 2) - 2;
729
+ idx = Math.floor(idx / 2);
730
+ this.endIndex = idx;
731
+ } else {
732
+ this.startIndex = this.endIndex = idx;
733
+ }
734
+ } else {
735
+ idx = Math.floor(idx / 2);
736
+ this.startIndex = this.endIndex = idx;
737
+ }
738
+ } else {
739
+ idx = Math.floor(idx / 2);
740
+ }
741
+ if (this.overflowMode === 'Hidden' && this._maxItems > 0 && this.endIndex !== 0) {
742
+ idx = parseInt(li.getAttribute('item-index'), 10);
743
+ if (this.startIndex > 1) {
744
+ this.startIndex -= (this.endIndex - idx);
745
+ }
746
+ this.endIndex = idx;
747
+ }
748
+ const itemClickArgs: BreadcrumbClickEventArgs = { element: li as HTMLElement,
749
+ item: this.items[idx as number], event: e, cancel: false };
750
+ this.trigger('itemClick', itemClickArgs);
751
+ if (itemClickArgs.cancel) { return; }
752
+ if (this.items[idx as number]) {
753
+ this.activeItem = this.items[idx as number].url || this.items[idx as number].text;
754
+ }
755
+ this.dataBind();
756
+ }
757
+ if ((e.target as Element).classList.contains('e-breadcrumb-collapsed')) {
758
+ this.isExpanded = true;
759
+ this.reRenderItems();
760
+ }
761
+ if ((e.target as Element).classList.contains(MENUCLASS) && !this.isPopupCreated) {
762
+ this.renderPopup();
763
+ }
764
+ }
765
+
766
+ private renderPopup(): void {
767
+ const wrapper: HTMLElement = this.createElement('div', { className: POPUPCLASS + ' ' + this.cssClass + (this.enableRtl ? ' e-rtl' : '') });
768
+ document.body.appendChild(wrapper);
769
+ this.isPopupCreated = true;
770
+ this.popupObj = new Popup(wrapper, {
771
+ content: this.popupUl,
772
+ relateTo: this.element.querySelector(DOT + MENUCLASS) as HTMLElement,
773
+ enableRtl: this.enableRtl,
774
+ position: { X: 'left', Y: 'bottom' },
775
+ collision: { X: 'fit', Y: 'flip' },
776
+ open: (): void => {
777
+ if (this.popupUl) { this.popupUl.focus(); }
778
+ }
779
+ });
780
+ this.popupWireEvents();
781
+ this.popupObj.show();
782
+ }
783
+
784
+ private documentClickHandler(e: Event): void {
785
+ if (this.overflowMode === 'Menu' && this.popupObj && this.popupObj.element.classList.contains('e-popup-open') && !closest(e.target as Element, DOT + MENUCLASS) && !closest(e.target as Element, DOT + 'e-edit-template')) {
786
+ this.popupObj.hide();
787
+ this.popupObj.destroy();
788
+ this.isPopupCreated = false;
789
+ detach(this.popupObj.element);
790
+ }
791
+ }
792
+
793
+ private resize(): void {
794
+ this._maxItems = this.maxItems;
795
+ this.initPvtProps();
796
+ this.reRenderItems();
797
+ }
798
+
799
+ private expandHandler(e: KeyboardEvent): void {
800
+ if (e.key === 'Enter') {
801
+ this.isExpanded = true;
802
+ this.reRenderItems();
803
+ }
804
+ }
805
+
806
+ private keyDownHandler(e: KeyboardEvent): void {
807
+ if (e.key === 'Enter') {
808
+ this.clickHandler(e as unknown as MouseEvent);
809
+ }
810
+ }
811
+
812
+ private popupKeyDownHandler(e: KeyboardEvent): void {
813
+ if (e.key === 'Escape') {
814
+ this.documentClickHandler(e);
815
+ }
816
+ }
817
+
818
+ /**
819
+ * Called internally if any of the property value changed.
820
+ *
821
+ * @private
822
+ * @param {BreadcrumbModel} newProp - Specifies the new properties.
823
+ * @param {BreadcrumbModel} oldProp - Specifies the old properties.
824
+ * @returns {void}
825
+ */
826
+ public onPropertyChanged(newProp: BreadcrumbModel, oldProp: BreadcrumbModel): void {
827
+ for (const prop of Object.keys(newProp)) {
828
+ switch (prop) {
829
+ case 'enableActiveItemNavigation':
830
+ this.reRenderItems();
831
+ break;
832
+ case 'items':
833
+ case 'activeItem':
834
+ this._maxItems = this.maxItems;
835
+ this.initPvtProps();
836
+ this.reRenderItems();
837
+ break;
838
+ case 'overflowMode':
839
+ case 'maxItems':
840
+ this._maxItems = this.maxItems;
841
+ this.initPvtProps();
842
+ this.reRenderItems();
843
+ if (oldProp.overflowMode === 'Wrap') {
844
+ this.element.classList.remove(WRAPMODECLASS);
845
+ } else if (newProp.overflowMode === 'Wrap') {
846
+ this.element.classList.add(WRAPMODECLASS);
847
+ }
848
+ if (oldProp.overflowMode === 'Scroll') {
849
+ this.element.classList.remove(SCROLLMODECLASS);
850
+ } else if (newProp.overflowMode === 'Scroll') {
851
+ this.element.classList.add(SCROLLMODECLASS);
852
+ }
853
+ break;
854
+ case 'url':
855
+ this.initItems();
856
+ this.reRenderItems();
857
+ break;
858
+ case 'cssClass':
859
+ if (oldProp.cssClass) {
860
+ removeClass([this.element], oldProp.cssClass.split(' '));
861
+ }
862
+ if (newProp.cssClass) {
863
+ addClass([this.element], newProp.cssClass.replace(/\s+/g, ' ').trim().split(' '));
864
+ }
865
+ if ((oldProp.cssClass && oldProp.cssClass.indexOf(ICONRIGHT) > -1) && !(newProp.cssClass &&
866
+ newProp.cssClass.indexOf(ICONRIGHT) > -1) || !(oldProp.cssClass && oldProp.cssClass.indexOf(ICONRIGHT) > -1) &&
867
+ (newProp.cssClass && newProp.cssClass.indexOf(ICONRIGHT) > -1)) {
868
+ this.reRenderItems();
869
+ }
870
+ break;
871
+ case 'enableRtl':
872
+ this.element.classList.toggle('e-rtl');
873
+ break;
874
+ case 'disabled':
875
+ this.element.classList.toggle(DISABLEDCLASS);
876
+ this.element.setAttribute(ARIADISABLED, newProp.disabled + '');
877
+ break;
878
+ }
879
+ }
880
+ }
881
+
882
+ private wireEvents(): void {
883
+ this.delegateClickHanlder = this.documentClickHandler.bind(this);
884
+ EventHandler.add(document, 'click', this.delegateClickHanlder, this);
885
+ EventHandler.add(this.element, 'click', this.clickHandler, this);
886
+ window.addEventListener('resize', this.resize.bind(this));
887
+ }
888
+
889
+ private popupWireEvents(): void {
890
+ EventHandler.add(this.popupObj.element, 'click', this.clickHandler, this);
891
+ EventHandler.add(this.popupObj.element, 'keydown', this.popupKeyDownHandler, this);
892
+ }
893
+
894
+ private unWireEvents(): void {
895
+ EventHandler.remove(document, 'click', this.delegateClickHanlder);
896
+ EventHandler.remove(this.element, 'click', this.clickHandler);
897
+ window.removeEventListener('resize', this.resize.bind(this));
898
+ if (this.popupObj) {
899
+ EventHandler.remove(this.popupObj.element, 'click', this.clickHandler);
900
+ EventHandler.remove(this.popupObj.element, 'keydown', this.popupKeyDownHandler);
901
+ }
902
+ }
903
+
904
+ /**
905
+ * Get the properties to be maintained in the persisted state.
906
+ *
907
+ * @returns {string} - Persist data
908
+ */
909
+ protected getPersistData(): string {
910
+ return this.addOnPersist(['activeItem']);
911
+ }
912
+
913
+ /**
914
+ * Get module name.
915
+ *
916
+ * @private
917
+ * @returns {string} - Module Name
918
+ */
919
+ protected getModuleName(): string {
920
+ return 'breadcrumb';
921
+ }
922
+
923
+ /**
924
+ * Destroys the widget.
925
+ *
926
+ * @returns {void}
927
+ */
928
+ public destroy(): void {
929
+ if (this.popupObj && this.popupObj.element.classList.contains('e-popup-open')) {
930
+ this.popupObj.destroy();
931
+ this.isPopupCreated = false;
932
+ detach(this.popupObj.element);
933
+ }
934
+ const classes: string[] = [];
935
+ const attributes: string[] = ['aria-label'];
936
+ if (this.cssClass) {
937
+ classes.concat(this.cssClass.split(' '));
938
+ }
939
+ if (this.enableRtl) {
940
+ classes.push('e-rtl');
941
+ }
942
+ if (this.disabled) {
943
+ classes.push(DISABLEDCLASS);
944
+ attributes.push(ARIADISABLED);
945
+ }
946
+ if (this.overflowMode === 'Wrap') {
947
+ classes.push(WRAPMODECLASS);
948
+ } else if (this.overflowMode === 'Scroll') {
949
+ classes.push(SCROLLMODECLASS);
950
+ }
951
+ this.unWireEvents();
952
+ this.element.innerHTML = '';
953
+ removeClass([this.element], classes);
954
+ attributes.forEach((attribute: string) => {
955
+ this.element.removeAttribute(attribute);
956
+ });
957
+ super.destroy();
958
+ }
959
+ }