@syncfusion/ej2-navigations 23.2.7 → 24.1.46

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 (206) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -1
  3. package/dist/ej2-navigations.min.js +2 -2
  4. package/dist/ej2-navigations.umd.min.js +2 -2
  5. package/dist/ej2-navigations.umd.min.js.map +1 -1
  6. package/dist/es6/ej2-navigations.es2015.js +1435 -13
  7. package/dist/es6/ej2-navigations.es2015.js.map +1 -1
  8. package/dist/es6/ej2-navigations.es5.js +1492 -22
  9. package/dist/es6/ej2-navigations.es5.js.map +1 -1
  10. package/dist/global/ej2-navigations.min.js +2 -2
  11. package/dist/global/ej2-navigations.min.js.map +1 -1
  12. package/dist/global/index.d.ts +1 -1
  13. package/package.json +12 -12
  14. package/src/breadcrumb/breadcrumb.js +6 -1
  15. package/src/carousel/carousel.js +3 -3
  16. package/src/common/menu-base.js +25 -0
  17. package/src/index.d.ts +2 -0
  18. package/src/index.js +2 -0
  19. package/src/stepper/index.d.ts +3 -0
  20. package/src/stepper/index.js +2 -0
  21. package/src/stepper/stepper-model.d.ts +153 -0
  22. package/src/stepper/stepper.d.ts +339 -0
  23. package/src/stepper/stepper.js +1163 -0
  24. package/src/stepper-base/index.d.ts +5 -0
  25. package/src/stepper-base/index.js +4 -0
  26. package/src/stepper-base/stepper-base-model.d.ts +121 -0
  27. package/src/stepper-base/stepper-base.d.ts +184 -0
  28. package/src/stepper-base/stepper-base.js +221 -0
  29. package/src/tab/tab.js +0 -1
  30. package/src/toolbar/toolbar.js +4 -0
  31. package/src/treeview/treeview.d.ts +1 -0
  32. package/src/treeview/treeview.js +68 -15
  33. package/stepper-base.d.ts +4 -0
  34. package/stepper-base.js +4 -0
  35. package/stepper.d.ts +4 -0
  36. package/stepper.js +4 -0
  37. package/styles/bootstrap-dark.css +755 -1
  38. package/styles/bootstrap-dark.scss +1 -0
  39. package/styles/bootstrap.css +755 -1
  40. package/styles/bootstrap.scss +1 -0
  41. package/styles/bootstrap4.css +755 -1
  42. package/styles/bootstrap4.scss +1 -0
  43. package/styles/bootstrap5-dark.css +762 -8
  44. package/styles/bootstrap5-dark.scss +1 -0
  45. package/styles/bootstrap5.css +762 -8
  46. package/styles/bootstrap5.scss +1 -0
  47. package/styles/fabric-dark.css +754 -0
  48. package/styles/fabric-dark.scss +1 -0
  49. package/styles/fabric.css +754 -0
  50. package/styles/fabric.scss +1 -0
  51. package/styles/fluent-dark.css +759 -5
  52. package/styles/fluent-dark.scss +1 -0
  53. package/styles/fluent.css +759 -5
  54. package/styles/fluent.scss +1 -0
  55. package/styles/highcontrast-light.css +755 -1
  56. package/styles/highcontrast-light.scss +1 -0
  57. package/styles/highcontrast.css +755 -1
  58. package/styles/highcontrast.scss +1 -0
  59. package/styles/material-dark.css +755 -1
  60. package/styles/material-dark.scss +1 -0
  61. package/styles/material.css +755 -1
  62. package/styles/material.scss +1 -0
  63. package/styles/material3-dark.css +754 -0
  64. package/styles/material3-dark.scss +1 -0
  65. package/styles/material3.css +754 -0
  66. package/styles/material3.scss +1 -0
  67. package/styles/pager/_bootstrap-dark-definition.scss +16 -0
  68. package/styles/pager/_bootstrap-definition.scss +16 -0
  69. package/styles/pager/_bootstrap4-definition.scss +16 -0
  70. package/styles/pager/_bootstrap5-definition.scss +16 -0
  71. package/styles/pager/_fabric-dark-definition.scss +16 -0
  72. package/styles/pager/_fabric-definition.scss +16 -0
  73. package/styles/pager/_fluent-definition.scss +16 -0
  74. package/styles/pager/_fusionnew-definition.scss +16 -0
  75. package/styles/pager/_highcontrast-definition.scss +16 -0
  76. package/styles/pager/_highcontrast-light-definition.scss +16 -0
  77. package/styles/pager/_layout.scss +114 -0
  78. package/styles/pager/_material-dark-definition.scss +16 -0
  79. package/styles/pager/_material-definition.scss +16 -0
  80. package/styles/pager/_material3-definition.scss +16 -0
  81. package/styles/pager/_tailwind-definition.scss +16 -0
  82. package/styles/pager/bootstrap-dark.css +107 -0
  83. package/styles/pager/bootstrap.css +107 -0
  84. package/styles/pager/bootstrap4.css +107 -0
  85. package/styles/pager/bootstrap5-dark.css +107 -0
  86. package/styles/pager/bootstrap5.css +107 -0
  87. package/styles/pager/fabric-dark.css +107 -0
  88. package/styles/pager/fabric.css +107 -0
  89. package/styles/pager/fluent-dark.css +107 -0
  90. package/styles/pager/fluent.css +107 -0
  91. package/styles/pager/highcontrast-light.css +107 -0
  92. package/styles/pager/highcontrast.css +107 -0
  93. package/styles/pager/material-dark.css +107 -0
  94. package/styles/pager/material.css +107 -0
  95. package/styles/pager/material3-dark.css +107 -0
  96. package/styles/pager/material3.css +107 -0
  97. package/styles/pager/tailwind-dark.css +107 -0
  98. package/styles/pager/tailwind.css +107 -0
  99. package/styles/stepper/_all.scss +2 -0
  100. package/styles/stepper/_bootstrap-dark-definition.scss +79 -0
  101. package/styles/stepper/_bootstrap-definition.scss +79 -0
  102. package/styles/stepper/_bootstrap4-definition.scss +79 -0
  103. package/styles/stepper/_bootstrap5-dark-definition.scss +1 -0
  104. package/styles/stepper/_bootstrap5-definition.scss +80 -0
  105. package/styles/stepper/_fabric-dark-definition.scss +79 -0
  106. package/styles/stepper/_fabric-definition.scss +79 -0
  107. package/styles/stepper/_fluent-dark-definition.scss +1 -0
  108. package/styles/stepper/_fluent-definition.scss +79 -0
  109. package/styles/stepper/_fusionnew-definition.scss +79 -0
  110. package/styles/stepper/_highcontrast-definition.scss +79 -0
  111. package/styles/stepper/_highcontrast-light-definition.scss +79 -0
  112. package/styles/stepper/_layout.scss +564 -0
  113. package/styles/stepper/_material-dark-definition.scss +79 -0
  114. package/styles/stepper/_material-definition.scss +79 -0
  115. package/styles/stepper/_material3-dark-definition.scss +1 -0
  116. package/styles/stepper/_material3-definition.scss +79 -0
  117. package/styles/stepper/_tailwind-dark-definition.scss +1 -0
  118. package/styles/stepper/_tailwind-definition.scss +79 -0
  119. package/styles/stepper/_theme.scss +229 -0
  120. package/styles/stepper/bootstrap-dark.css +646 -0
  121. package/styles/stepper/bootstrap-dark.scss +5 -0
  122. package/styles/stepper/bootstrap.css +646 -0
  123. package/styles/stepper/bootstrap.scss +5 -0
  124. package/styles/stepper/bootstrap4.css +646 -0
  125. package/styles/stepper/bootstrap4.scss +5 -0
  126. package/styles/stepper/bootstrap5-dark.css +646 -0
  127. package/styles/stepper/bootstrap5-dark.scss +5 -0
  128. package/styles/stepper/bootstrap5.css +646 -0
  129. package/styles/stepper/bootstrap5.scss +5 -0
  130. package/styles/stepper/fabric-dark.css +646 -0
  131. package/styles/stepper/fabric-dark.scss +5 -0
  132. package/styles/stepper/fabric.css +646 -0
  133. package/styles/stepper/fabric.scss +5 -0
  134. package/styles/stepper/fluent-dark.css +646 -0
  135. package/styles/stepper/fluent-dark.scss +5 -0
  136. package/styles/stepper/fluent.css +646 -0
  137. package/styles/stepper/fluent.scss +5 -0
  138. package/styles/stepper/highcontrast-light.css +646 -0
  139. package/styles/stepper/highcontrast-light.scss +5 -0
  140. package/styles/stepper/highcontrast.css +646 -0
  141. package/styles/stepper/highcontrast.scss +5 -0
  142. package/styles/stepper/icons/_bootstrap-dark.scss +5 -0
  143. package/styles/stepper/icons/_bootstrap.scss +5 -0
  144. package/styles/stepper/icons/_bootstrap4.scss +5 -0
  145. package/styles/stepper/icons/_bootstrap5-dark.scss +1 -0
  146. package/styles/stepper/icons/_bootstrap5.scss +5 -0
  147. package/styles/stepper/icons/_fabric-dark.scss +5 -0
  148. package/styles/stepper/icons/_fabric.scss +5 -0
  149. package/styles/stepper/icons/_fluent-dark.scss +1 -0
  150. package/styles/stepper/icons/_fluent.scss +5 -0
  151. package/styles/stepper/icons/_fusionnew.scss +5 -0
  152. package/styles/stepper/icons/_highcontrast-light.scss +5 -0
  153. package/styles/stepper/icons/_highcontrast.scss +5 -0
  154. package/styles/stepper/icons/_material-dark.scss +5 -0
  155. package/styles/stepper/icons/_material.scss +5 -0
  156. package/styles/stepper/icons/_material3-dark.scss +1 -0
  157. package/styles/stepper/icons/_material3.scss +5 -0
  158. package/styles/stepper/icons/_tailwind-dark.scss +1 -0
  159. package/styles/stepper/icons/_tailwind.scss +5 -0
  160. package/styles/stepper/material-dark.css +646 -0
  161. package/styles/stepper/material-dark.scss +5 -0
  162. package/styles/stepper/material.css +646 -0
  163. package/styles/stepper/material.scss +5 -0
  164. package/styles/stepper/material3-dark.css +701 -0
  165. package/styles/stepper/material3-dark.scss +6 -0
  166. package/styles/stepper/material3.css +757 -0
  167. package/styles/stepper/material3.scss +6 -0
  168. package/styles/stepper/tailwind-dark.css +646 -0
  169. package/styles/stepper/tailwind-dark.scss +5 -0
  170. package/styles/stepper/tailwind.css +646 -0
  171. package/styles/stepper/tailwind.scss +5 -0
  172. package/styles/tab/_bootstrap-dark-definition.scss +1 -1
  173. package/styles/tab/_bootstrap-definition.scss +1 -1
  174. package/styles/tab/_bootstrap4-definition.scss +1 -1
  175. package/styles/tab/_bootstrap5-definition.scss +3 -2
  176. package/styles/tab/_fluent-definition.scss +1 -1
  177. package/styles/tab/_fusionnew-definition.scss +1 -1
  178. package/styles/tab/_highcontrast-definition.scss +1 -1
  179. package/styles/tab/_highcontrast-light-definition.scss +1 -1
  180. package/styles/tab/_material-dark-definition.scss +1 -1
  181. package/styles/tab/_material-definition.scss +1 -1
  182. package/styles/tab/_theme.scss +6 -0
  183. package/styles/tab/bootstrap-dark.css +1 -1
  184. package/styles/tab/bootstrap.css +1 -1
  185. package/styles/tab/bootstrap4.css +1 -1
  186. package/styles/tab/bootstrap5-dark.css +2 -2
  187. package/styles/tab/bootstrap5.css +2 -2
  188. package/styles/tab/fluent-dark.css +1 -1
  189. package/styles/tab/fluent.css +1 -1
  190. package/styles/tab/highcontrast-light.css +1 -1
  191. package/styles/tab/highcontrast.css +1 -1
  192. package/styles/tab/material-dark.css +1 -1
  193. package/styles/tab/material.css +1 -1
  194. package/styles/tailwind-dark.css +758 -4
  195. package/styles/tailwind-dark.scss +1 -0
  196. package/styles/tailwind.css +758 -4
  197. package/styles/tailwind.scss +1 -0
  198. package/styles/toolbar/_bootstrap5-definition.scss +3 -3
  199. package/styles/toolbar/_fluent-definition.scss +2 -2
  200. package/styles/toolbar/_tailwind-definition.scss +2 -2
  201. package/styles/toolbar/bootstrap5-dark.css +6 -6
  202. package/styles/toolbar/bootstrap5.css +6 -6
  203. package/styles/toolbar/fluent-dark.css +4 -4
  204. package/styles/toolbar/fluent.css +4 -4
  205. package/styles/toolbar/tailwind-dark.css +4 -4
  206. package/styles/toolbar/tailwind.css +4 -4
@@ -0,0 +1,1163 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
15
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
17
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
18
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
19
+ };
20
+ // eslint-disable-next-line @typescript-eslint/triple-slash-reference
21
+ ///<reference path='../stepper-base/stepper-base-model.d.ts'/>
22
+ import { attributes, NotifyPropertyChanges, L10n, append, isNullOrUndefined, getUniqueID, Complex, KeyboardEvents, ChildProperty, Property, EventHandler, Event, addClass, remove, removeClass, initializeCSPTemplate, select, compile } from '@syncfusion/ej2-base';
23
+ import { StepperBase, StepStatus } from '../stepper-base/stepper-base';
24
+ import { Tooltip } from '@syncfusion/ej2-popups';
25
+ var ITEMCONTAINER = 'e-step-container';
26
+ var ITEMLIST = 'e-stepper-steps';
27
+ var ICONCSS = 'e-indicator';
28
+ var TEXTCSS = 'e-step-text-container';
29
+ var STEPLABEL = 'e-step-label-container';
30
+ var OPTIONAL = 'e-step-label-optional';
31
+ var SELECTED = 'e-step-selected';
32
+ var INPROGRESS = 'e-step-inprogress';
33
+ var NOTSTARTED = 'e-step-notstarted';
34
+ var FOCUS = 'e-step-focus';
35
+ var COMPLETED = 'e-step-completed';
36
+ var DISABLED = 'e-step-disabled';
37
+ var READONLY = 'e-stepper-readonly';
38
+ var PROGRESSVALUE = '--progress-value';
39
+ var RTL = 'e-rtl';
40
+ var TEMPLATE = 'e-step-template';
41
+ var LABELAFTER = 'e-label-after';
42
+ var LABELBEFORE = 'e-label-before';
43
+ var VERTICALSTEP = 'e-vertical';
44
+ var HORIZSTEP = 'e-horizontal';
45
+ var STEPICON = 'e-step-icon';
46
+ var STEPTEXT = 'e-step-text';
47
+ var TEXT = 'e-text';
48
+ var STEPSLABEL = 'e-step-label';
49
+ var LABEL = 'e-label';
50
+ var STEPINDICATOR = 'e-step-type-indicator';
51
+ var LABELINDICATOR = 'e-step-type-label';
52
+ var INDICATORICON = 'e-step-indicator';
53
+ var STEPPERTOOLTIP = 'e-stepper-tooltip';
54
+ var STEPPERIPROGRESSTIP = 'e-step-inprogress-tip';
55
+ /**
56
+ * Defines the step progress animation of the Stepper.
57
+ */
58
+ var StepperAnimationSettings = /** @class */ (function (_super) {
59
+ __extends(StepperAnimationSettings, _super);
60
+ function StepperAnimationSettings() {
61
+ return _super !== null && _super.apply(this, arguments) || this;
62
+ }
63
+ __decorate([
64
+ Property(true)
65
+ ], StepperAnimationSettings.prototype, "enable", void 0);
66
+ __decorate([
67
+ Property(2000)
68
+ ], StepperAnimationSettings.prototype, "duration", void 0);
69
+ __decorate([
70
+ Property(0)
71
+ ], StepperAnimationSettings.prototype, "delay", void 0);
72
+ return StepperAnimationSettings;
73
+ }(ChildProperty));
74
+ export { StepperAnimationSettings };
75
+ /**
76
+ * Defines the label position in the Stepper.
77
+ */
78
+ export var StepLabelPosition;
79
+ (function (StepLabelPosition) {
80
+ /**
81
+ * Displays the label on top position regardless of the Stepper's orientation.
82
+ */
83
+ StepLabelPosition["Top"] = "Top";
84
+ /**
85
+ * Displays the label on bottom position regardless of the Stepper's orientation.
86
+ */
87
+ StepLabelPosition["Bottom"] = "Bottom";
88
+ /**
89
+ * Displays the label on left side regardless of the Stepper's orientation.
90
+ */
91
+ StepLabelPosition["Start"] = "Start";
92
+ /**
93
+ * Displays the label on right side regardless of the Stepper's orientation.
94
+ */
95
+ StepLabelPosition["End"] = "End";
96
+ })(StepLabelPosition || (StepLabelPosition = {}));
97
+ /**
98
+ * Defines whether steps are display with only indicator, only labels or combination of both.
99
+ */
100
+ export var StepType;
101
+ (function (StepType) {
102
+ /**
103
+ * Steps are shown indicator with label defined.
104
+ */
105
+ StepType["Default"] = "Default";
106
+ /**
107
+ * Steps are shown with only label.
108
+ */
109
+ StepType["Label"] = "Label";
110
+ /**
111
+ * Steps are shown with only indicator.
112
+ */
113
+ StepType["Indicator"] = "Indicator";
114
+ })(StepType || (StepType = {}));
115
+ /**
116
+ * The Stepper component visualizes several steps and indicates the current progress by highlighting already completed steps.
117
+ *
118
+ * ```html
119
+ * <nav id="stepper"></nav>
120
+ * ```
121
+ * ```typescript
122
+ * <script>
123
+ * let stepperObj: Stepper = new Stepper({steps : [{}, {}, {}, {}, {}]});
124
+ * stepperObj.appendTo('#stepper');
125
+ * </script>
126
+ * ```
127
+ */
128
+ var Stepper = /** @class */ (function (_super) {
129
+ __extends(Stepper, _super);
130
+ /**
131
+ * * Constructor for creating the Stepper component.
132
+ *
133
+ * @param {StepperModel} options - Specifies the Stepper model.
134
+ * @param {string | HTMLElement} element - Specifies the element to render as component.
135
+ * @private
136
+ */
137
+ function Stepper(options, element) {
138
+ var _this = _super.call(this, options, element) || this;
139
+ _this.stepperItemElements = [];
140
+ return _this;
141
+ }
142
+ Stepper.prototype.preRender = function () {
143
+ if (!this.element.id) {
144
+ this.element.id = getUniqueID('e-' + this.getModuleName());
145
+ }
146
+ var localeText = { optional: 'Optional' };
147
+ this.l10n = new L10n('stepper', localeText, this.locale);
148
+ this.keyConfigs = {
149
+ downarrow: 'downarrow',
150
+ leftarrow: 'leftarrow',
151
+ rightarrow: 'rightarrow',
152
+ uparrow: 'uparrow',
153
+ space: 'space',
154
+ enter: 'enter',
155
+ home: 'home',
156
+ end: 'end',
157
+ tab: 'tab',
158
+ shiftTab: 'shift+tab',
159
+ escape: 'escape'
160
+ };
161
+ this.tooltipOpen = false;
162
+ };
163
+ /**
164
+ * To get component name.
165
+ *
166
+ * @returns {string} - Module Name
167
+ * @private
168
+ */
169
+ Stepper.prototype.getModuleName = function () {
170
+ return 'stepper';
171
+ };
172
+ Stepper.prototype.render = function () {
173
+ this.initialize();
174
+ this.navigationHandler(this.activeStep, null, false);
175
+ this.updateStepperStatus(true);
176
+ };
177
+ Stepper.prototype.initialize = function () {
178
+ var _this = this;
179
+ this.element.setAttribute('aria-label', this.element.id);
180
+ this.updatePosition();
181
+ this.stepperItemList = this.createElement('ol', { className: ITEMLIST });
182
+ this.updateOrientaion(this.element);
183
+ this.updateStepType();
184
+ this.element.appendChild(this.stepperItemList);
185
+ if (this.cssClass) {
186
+ addClass([this.element], this.cssClass.trim().split(' '));
187
+ }
188
+ if (this.readOnly) {
189
+ this.element.classList.add(READONLY);
190
+ }
191
+ if (this.enableRtl) {
192
+ this.element.classList.add(RTL);
193
+ }
194
+ this.wireEvents();
195
+ this.updateTemplateFunction();
196
+ this.renderItems();
197
+ if (this.steps.length > 0) {
198
+ if (this.steps.length > 1) {
199
+ if (this.isAngular && this.template) {
200
+ setTimeout(function () {
201
+ _this.renderProgressBar(_this.element);
202
+ });
203
+ }
204
+ else {
205
+ this.renderProgressBar(this.element);
206
+ }
207
+ }
208
+ this.checkValidStep();
209
+ this.updateAnimation();
210
+ this.updateTooltip();
211
+ this.wireKeyboardEvent();
212
+ }
213
+ };
214
+ Stepper.prototype.updatePosition = function () {
215
+ this.progressBarPosition = this.beforeLabelWidth = this.textEleWidth = 0;
216
+ };
217
+ Stepper.prototype.renderDefault = function (index) {
218
+ return (!this.steps[parseInt((index).toString(), 10)].iconCss && !this.steps[parseInt((index).toString(), 10)].text &&
219
+ !this.steps[parseInt((index).toString(), 10)].label) ? true : false;
220
+ };
221
+ Stepper.prototype.updateAnimation = function () {
222
+ var progressEle = this.element.querySelector('.e-progressbar-value');
223
+ if (this.animation.enable) {
224
+ if (this.animation.duration >= 0) {
225
+ if (progressEle) {
226
+ progressEle.style.setProperty('--duration', ((this.animation.duration) + 'ms'));
227
+ }
228
+ }
229
+ if (this.animation.delay >= 0) {
230
+ if (progressEle) {
231
+ progressEle.style.setProperty('--delay', ((this.animation.delay) + 'ms'));
232
+ }
233
+ }
234
+ }
235
+ else {
236
+ if (progressEle) {
237
+ progressEle.style.setProperty('--delay', (0 + 'ms'));
238
+ progressEle.style.setProperty('--duration', (0 + 'ms'));
239
+ }
240
+ }
241
+ };
242
+ Stepper.prototype.updateStepType = function () {
243
+ if (this.stepType.toLowerCase() === 'indicator' || 'label' || 'default') {
244
+ this.stepType.toLowerCase() !== 'default' ? this.element.classList.add('e-step-type-' + this.stepType.toLowerCase()) : '';
245
+ if (((this.stepType.toLowerCase() === 'indicator' || 'label') && (this.labelContainer))) {
246
+ this.clearLabelPosition();
247
+ }
248
+ }
249
+ };
250
+ Stepper.prototype.wireEvents = function () {
251
+ var _this = this;
252
+ EventHandler.add(window, 'resize', function () {
253
+ if (_this.stepperItemList && _this.progressbar && _this.element.classList.contains(HORIZSTEP)) {
254
+ _this.setProgressPosition(_this.element, true);
255
+ }
256
+ }, this);
257
+ EventHandler.add(window, 'click', function () { _this.updateStepFocus(); }, this);
258
+ };
259
+ Stepper.prototype.updateStepFocus = function () {
260
+ if (this.isKeyNavFocus) {
261
+ this.isKeyNavFocus = false;
262
+ var isFocus = this.element.querySelector('.' + FOCUS);
263
+ if (isFocus) {
264
+ isFocus.classList.remove(FOCUS);
265
+ this.element.classList.remove('e-steps-focus');
266
+ }
267
+ }
268
+ };
269
+ Stepper.prototype.updateStepperStatus = function (isInitial) {
270
+ for (var index = 0; index < this.steps.length; index++) {
271
+ var item = this.steps[parseInt(index.toString(), 10)];
272
+ var status_1 = item.status.toLowerCase();
273
+ if (isInitial && this.activeStep === 0 && index === 0) {
274
+ item.status = StepStatus.InProgress;
275
+ }
276
+ if (item && status_1 !== 'notstarted' && index === this.activeStep) {
277
+ for (var i = 0; i < this.steps.length; i++) {
278
+ var itemElement = this.stepperItemElements[parseInt(i.toString(), 10)];
279
+ itemElement.classList.remove(SELECTED, INPROGRESS, COMPLETED, NOTSTARTED);
280
+ var prevOnChange = this.isProtectedOnChange;
281
+ this.isProtectedOnChange = true;
282
+ if (status_1 === 'completed') {
283
+ this.updateStatusClass(i, index, itemElement);
284
+ }
285
+ else {
286
+ this.updateStatusClass(i, index, itemElement, true);
287
+ }
288
+ this.isProtectedOnChange = prevOnChange;
289
+ }
290
+ }
291
+ else if (item && status_1 !== 'notstarted' && index !== this.activeStep) {
292
+ this.navigationHandler(this.activeStep, null, true);
293
+ }
294
+ }
295
+ };
296
+ Stepper.prototype.updateStatusClass = function (currentStep, index, ele, isInprogress) {
297
+ var stepItem = this.steps[parseInt(currentStep.toString(), 10)];
298
+ if (currentStep < index) {
299
+ ele.classList.add(COMPLETED);
300
+ stepItem.status = StepStatus.Completed;
301
+ }
302
+ else if (currentStep === index) {
303
+ ele.classList.add(isInprogress ? INPROGRESS : COMPLETED, SELECTED);
304
+ }
305
+ else {
306
+ ele.classList.add(NOTSTARTED);
307
+ }
308
+ };
309
+ Stepper.prototype.renderItems = function () {
310
+ var _this = this;
311
+ for (var index = 0; index < this.steps.length; index++) {
312
+ this.stepperItemContainer = this.createElement('li', { className: ITEMCONTAINER });
313
+ this.stepperItemContainer.classList[(index === 0) ? 'add' : 'remove'](SELECTED, INPROGRESS);
314
+ this.stepperItemContainer.classList[(index !== 0) ? 'add' : 'remove'](NOTSTARTED);
315
+ if (this.element.classList.contains(HORIZSTEP)) {
316
+ this.stepperItemContainer.style.setProperty('--max-width', 100 / this.steps.length + '%');
317
+ }
318
+ var stepSpan = this.createElement('span', { className: 'e-step' });
319
+ if (this.renderDefault(index) && (isNullOrUndefined(this.template) || this.template === '')) {
320
+ var isIndicator = (!this.element.classList.contains('e-step-type-default') && this.stepType.toLowerCase() === 'indicator') ? true : false;
321
+ if (isIndicator) {
322
+ stepSpan.classList.add('e-icons', INDICATORICON);
323
+ }
324
+ if (!isIndicator) {
325
+ stepSpan.classList.add('e-step-content');
326
+ stepSpan.innerHTML = (index + 1).toString();
327
+ }
328
+ this.stepperItemContainer.appendChild(stepSpan);
329
+ }
330
+ else if (isNullOrUndefined(this.template) || this.template === '') {
331
+ var isRender = true;
332
+ var item = this.steps[parseInt(index.toString(), 10)];
333
+ if (item.iconCss && (((!item.text && !item.label) || !this.element.classList.contains(LABELINDICATOR)))) {
334
+ var itemIcon = item.iconCss.trim().split(' ');
335
+ stepSpan.classList.add(ICONCSS);
336
+ for (var i = 0; i < itemIcon.length; i++) {
337
+ stepSpan.classList.add(itemIcon[parseInt(i.toString(), 10)]);
338
+ }
339
+ this.stepperItemContainer.appendChild(stepSpan);
340
+ this.stepperItemContainer.classList.add(STEPICON);
341
+ if ((this.element.classList.contains(HORIZSTEP) && (this.labelPosition.toLowerCase() === 'start' || this.labelPosition.toLowerCase() === 'end') && item.label) ||
342
+ (this.element.classList.contains(VERTICALSTEP) && (this.labelPosition.toLowerCase() === 'top' || this.labelPosition.toLowerCase() === 'bottom') && item.label)) {
343
+ this.element.classList.add('e-label-' + this.labelPosition.toLowerCase());
344
+ var textSpan = this.createElement('span', { className: TEXTCSS + ' ' + TEXT });
345
+ textSpan.innerText = item.label;
346
+ this.stepperItemContainer.appendChild(textSpan);
347
+ this.stepperItemContainer.classList.add(STEPTEXT);
348
+ isRender = false;
349
+ }
350
+ }
351
+ if (item.text && (!item.iconCss || !this.element.classList.contains(STEPINDICATOR)) && isRender && !(item.iconCss && item.label)) {
352
+ if (!item.iconCss && this.element.classList.contains(STEPINDICATOR)) {
353
+ this.checkValidState(item, stepSpan);
354
+ var prevOnChange = this.isProtectedOnChange;
355
+ this.isProtectedOnChange = true;
356
+ item.label = null;
357
+ this.isProtectedOnChange = prevOnChange;
358
+ }
359
+ else {
360
+ this.textContainer = this.createElement('span', { className: TEXTCSS });
361
+ var textSpan = this.createElement('span', { className: TEXT });
362
+ if (!item.label) {
363
+ textSpan.innerText = item.text;
364
+ (item.isValid !== null && (!item.iconCss || this.element.classList.contains(LABELINDICATOR))) ? this.textContainer.appendChild(textSpan) : textSpan.classList.add(TEXTCSS);
365
+ this.stepperItemContainer.appendChild((item.isValid !== null && (!item.iconCss || this.element.classList.contains(LABELINDICATOR))) ? this.textContainer : textSpan);
366
+ this.stepperItemContainer.classList.add(STEPTEXT);
367
+ }
368
+ if (!item.iconCss || this.element.classList.contains(LABELINDICATOR)) {
369
+ this.stepperItemContainer.classList.add('e-step-text-only');
370
+ if (!item.label && item.isValid !== null) {
371
+ var iconSpan = this.createElement('span', { className: 'e-step-validation-icon e-icons' });
372
+ this.textContainer.appendChild(iconSpan);
373
+ }
374
+ }
375
+ if (item.label && this.element.classList.contains(LABELINDICATOR)) {
376
+ textSpan.innerText = item.label;
377
+ }
378
+ var prevOnChange = this.isProtectedOnChange;
379
+ this.isProtectedOnChange = true;
380
+ item.text = item.label ? null : item.text;
381
+ this.isProtectedOnChange = prevOnChange;
382
+ }
383
+ }
384
+ if (item.cssClass) {
385
+ addClass([this.stepperItemContainer], item.cssClass.trim().split(' '));
386
+ }
387
+ if (item.disabled) {
388
+ this.stepperItemContainer.classList[item.disabled ? 'add' : 'remove'](DISABLED);
389
+ attributes(this.stepperItemContainer, { 'tabindex': '-1', 'aria-disabled': 'true' });
390
+ }
391
+ if (item.label && (!item.iconCss || !this.element.classList.contains(STEPINDICATOR)) && isRender) {
392
+ if (!item.iconCss && !item.text && this.element.classList.contains(STEPINDICATOR)) {
393
+ this.checkValidState(item, stepSpan, true);
394
+ }
395
+ else if ((!((this.element.classList.contains(LABELINDICATOR)) && item.text)) || (this.element.classList.contains(LABELINDICATOR) && item.label)) {
396
+ this.labelContainer = this.createElement('span', { className: STEPLABEL });
397
+ var labelSpan = this.createElement('span', { className: LABEL });
398
+ labelSpan.innerText = item.label;
399
+ this.labelContainer.appendChild(labelSpan);
400
+ this.stepperItemContainer.classList.add(STEPSLABEL);
401
+ this.updateLabelPosition();
402
+ if ((!item.iconCss && !item.text) || this.element.classList.contains(LABELINDICATOR)) {
403
+ this.stepperItemContainer.classList.add('e-step-label-only');
404
+ if (item.isValid !== null) {
405
+ var iconSpan = this.createElement('span', { className: 'e-step-validation-icon e-icons' });
406
+ this.labelContainer.appendChild(iconSpan);
407
+ }
408
+ }
409
+ }
410
+ }
411
+ if (item.optional) {
412
+ var optionalSpan = this.createElement('span', { className: OPTIONAL });
413
+ this.l10n.setLocale(this.locale);
414
+ var optionalContent = this.l10n.getConstant('optional');
415
+ optionalSpan.innerText = optionalContent;
416
+ if (item.label && (this.labelContainer && ((this.element.classList.contains(LABELAFTER) && !this.stepperItemContainer.classList.contains('e-step-label-only'))
417
+ || (this.element.classList.contains(HORIZSTEP) && this.element.classList.contains(LABELBEFORE) && !this.stepperItemContainer.classList.contains('e-step-label-only'))))
418
+ || (this.element.classList.contains(VERTICALSTEP) && this.element.classList.contains(LABELBEFORE))) {
419
+ this.labelContainer.appendChild(optionalSpan);
420
+ }
421
+ else {
422
+ this.stepperItemContainer.appendChild(optionalSpan);
423
+ }
424
+ }
425
+ if (item.isValid !== null) {
426
+ item.isValid ? this.stepperItemContainer.classList.add('e-step-valid') : this.stepperItemContainer.classList.add('e-step-error');
427
+ }
428
+ }
429
+ this.renderItemContent(index, false);
430
+ if (this.stepperItemContainer.classList.contains(INPROGRESS)) {
431
+ attributes(this.stepperItemContainer, { 'tabindex': '0', 'aria-current': 'true' });
432
+ }
433
+ else {
434
+ attributes(this.stepperItemContainer, { 'tabindex': '-1' });
435
+ }
436
+ this.wireItemsEvents(this.stepperItemContainer, index);
437
+ this.stepperItemElements.push(this.stepperItemContainer);
438
+ var eventArgs = { element: this.stepperItemContainer, index: index };
439
+ this.trigger('beforeStepRender', eventArgs, function (args) {
440
+ _this.stepperItemList.appendChild(args.element);
441
+ });
442
+ if (this.isAngular && this.template) {
443
+ setTimeout(function () {
444
+ _this.calculateProgressBarPosition();
445
+ });
446
+ }
447
+ else {
448
+ this.calculateProgressBarPosition();
449
+ }
450
+ }
451
+ if (this.element.classList.contains(VERTICALSTEP)) {
452
+ if (this.element.classList.contains(LABELBEFORE)) {
453
+ var listItems = this.stepperItemList.querySelectorAll('.' + LABEL);
454
+ for (var i = 0; i < listItems.length; i++) {
455
+ var labelEle = listItems[parseInt((i).toString(), 10)];
456
+ labelEle.style.setProperty('--label-width', (this.beforeLabelWidth) + 5 + 'px');
457
+ }
458
+ }
459
+ }
460
+ };
461
+ Stepper.prototype.calculateProgressBarPosition = function () {
462
+ var isBeforeLabel = (this.element.classList.contains(LABELBEFORE)) ? true : false;
463
+ var isStepVertical = (this.element.classList.contains(VERTICALSTEP)) ? true : false;
464
+ if (isStepVertical) {
465
+ var iconOnly = (this.stepperItemContainer.classList.contains(STEPICON) && !this.stepperItemContainer.classList.contains(STEPTEXT) && !this.stepperItemContainer.classList.contains(STEPSLABEL)) ? true : false;
466
+ var textEle = (this.stepperItemContainer.querySelector('.' + TEXTCSS));
467
+ if (textEle) {
468
+ this.textEleWidth = this.textEleWidth < textEle.offsetWidth ? textEle.offsetWidth : this.textEleWidth;
469
+ }
470
+ if (isBeforeLabel) {
471
+ var itemWidth = void 0;
472
+ var labelWidth = this.stepperItemContainer.querySelector('.' + LABEL).offsetWidth + 15;
473
+ if (this.beforeLabelWidth < labelWidth) {
474
+ this.beforeLabelWidth = labelWidth;
475
+ }
476
+ if (this.element.querySelector('ol').lastChild.querySelector('.' + ICONCSS)) {
477
+ itemWidth = (this.beforeLabelWidth + (this.stepperItemContainer.querySelector('.' + ICONCSS).offsetWidth / 2));
478
+ }
479
+ else if (this.stepperItemContainer.querySelector('.' + TEXTCSS)) {
480
+ itemWidth = (this.beforeLabelWidth + (this.stepperItemContainer.querySelector('.' + TEXTCSS).offsetWidth / 2));
481
+ }
482
+ if (this.progressBarPosition < itemWidth) {
483
+ this.progressBarPosition = itemWidth;
484
+ }
485
+ }
486
+ else if (this.progressBarPosition < (iconOnly ? this.stepperItemContainer.offsetWidth : this.element.querySelector('ol').lastChild.firstChild.offsetWidth)) {
487
+ this.progressBarPosition = iconOnly ? this.stepperItemContainer.offsetWidth : this.element.querySelector('ol').lastChild.firstChild.offsetWidth;
488
+ }
489
+ }
490
+ };
491
+ Stepper.prototype.checkValidState = function (item, stepSpan, isLabel) {
492
+ if (item.isValid == null) {
493
+ stepSpan.classList.add('e-step-content');
494
+ if (isLabel) {
495
+ stepSpan.innerHTML = item.label;
496
+ }
497
+ else {
498
+ stepSpan.innerHTML = item.label ? item.label : item.text;
499
+ }
500
+ this.stepperItemContainer.appendChild(stepSpan);
501
+ }
502
+ else {
503
+ stepSpan.classList.add(ICONCSS);
504
+ this.stepperItemContainer.appendChild(stepSpan);
505
+ this.stepperItemContainer.classList.add(STEPICON);
506
+ }
507
+ };
508
+ Stepper.prototype.updateCurrentLabel = function () {
509
+ var currentLabelPos;
510
+ if (this.element.classList.contains(HORIZSTEP)) {
511
+ currentLabelPos = this.labelPosition.toLowerCase() === 'top' ? 'before' : this.labelPosition.toLowerCase() === 'bottom' ? 'after' : this.labelPosition.toLowerCase();
512
+ }
513
+ else {
514
+ currentLabelPos = this.labelPosition.toLowerCase() === 'start' ? 'before' : this.labelPosition.toLowerCase() === 'end' ? 'after' : this.labelPosition.toLowerCase();
515
+ }
516
+ return currentLabelPos;
517
+ };
518
+ Stepper.prototype.updateLabelPosition = function () {
519
+ this.clearLabelPosition();
520
+ this.labelContainer.classList.add('e-label-' + this.updateCurrentLabel());
521
+ if (this.labelPosition.toLowerCase() === 'start' && this.orientation.toLowerCase() === 'vertical') {
522
+ this.stepperItemContainer.firstChild ? this.stepperItemContainer.firstChild.before(this.labelContainer) : this.stepperItemContainer.appendChild(this.labelContainer);
523
+ }
524
+ else {
525
+ this.stepperItemContainer.appendChild(this.labelContainer);
526
+ }
527
+ this.element.classList.add('e-label-' + this.updateCurrentLabel());
528
+ };
529
+ Stepper.prototype.clearLabelPosition = function () {
530
+ var removeCss = this.labelContainer.classList.value.match(/(e-label-[after|before]+)/g);
531
+ if (removeCss) {
532
+ removeClass([this.labelContainer], removeCss);
533
+ removeClass([this.element], removeCss);
534
+ }
535
+ };
536
+ Stepper.prototype.checkValidStep = function () {
537
+ for (var index = 0; index < this.steps.length; index++) {
538
+ var item = this.steps[parseInt(index.toString(), 10)];
539
+ var itemElement = this.stepperItemElements[parseInt(index.toString(), 10)];
540
+ if (item.isValid !== null) {
541
+ var indicatorEle = void 0;
542
+ var iconEle = void 0;
543
+ if (this.element.classList.contains(STEPINDICATOR) && !item.iconCss) {
544
+ indicatorEle = itemElement.querySelector('.' + ICONCSS);
545
+ }
546
+ else {
547
+ iconEle = itemElement.querySelector('.' + ICONCSS);
548
+ }
549
+ var textLabelIcon = itemElement.querySelector('.e-step-validation-icon');
550
+ var itemIcon = item.iconCss.trim().split(' ');
551
+ var validStep = itemElement.classList.contains('e-step-valid');
552
+ if (indicatorEle) {
553
+ indicatorEle.classList.add('e-icons', validStep ? 'e-check' : 'e-circle-info');
554
+ }
555
+ if (iconEle) {
556
+ for (var i = 0; i < itemIcon.length; i++) {
557
+ iconEle.classList.remove(itemIcon[parseInt(i.toString(), 10)]);
558
+ }
559
+ iconEle.classList.add('e-icons', validStep ? 'e-check' : 'e-circle-info');
560
+ }
561
+ if (textLabelIcon) {
562
+ textLabelIcon.classList.add(validStep ? 'e-circle-check' : 'e-circle-info');
563
+ if (this.element.classList.contains(VERTICALSTEP)) {
564
+ var labelEle = itemElement.querySelector('.' + LABEL);
565
+ var textEle = itemElement.querySelector('.' + TEXT);
566
+ var itemWidth = textEle ? textEle.offsetWidth + textEle.getBoundingClientRect().left :
567
+ labelEle.offsetWidth + labelEle.getBoundingClientRect().left;
568
+ var validationIcon = itemElement.querySelector('.e-step-validation-icon');
569
+ validationIcon.style.setProperty('--icon-position', (itemWidth + 20) + 'px');
570
+ }
571
+ }
572
+ }
573
+ }
574
+ };
575
+ Stepper.prototype.updateTooltip = function () {
576
+ if (this.showTooltip) {
577
+ this.tooltipObj = new Tooltip({
578
+ target: '.e-step-container', windowCollision: true,
579
+ opensOn: 'Custom', cssClass: this.cssClass ? (STEPPERTOOLTIP + ' ' + this.cssClass) : STEPPERTOOLTIP,
580
+ position: 'TopCenter'
581
+ });
582
+ this.tooltipObj.appendTo(this.stepperItemList);
583
+ }
584
+ else {
585
+ if (!isNullOrUndefined(this.tooltipObj)) {
586
+ this.tooltipObj.destroy();
587
+ this.tooltipObj = null;
588
+ }
589
+ }
590
+ };
591
+ Stepper.prototype.wireItemsEvents = function (itemElement, index) {
592
+ var _this = this;
593
+ EventHandler.add(itemElement, 'click', function (e) {
594
+ if (_this.linear) {
595
+ var linearModeValue = index - _this.activeStep;
596
+ if (Math.abs(linearModeValue) === 1) {
597
+ _this.stepClickHandler(index, e, itemElement);
598
+ }
599
+ }
600
+ else {
601
+ _this.stepClickHandler(index, e, itemElement);
602
+ }
603
+ }, this);
604
+ EventHandler.add(itemElement, 'mouseover', function () { return _this.openStepperTooltip(index); }, this);
605
+ EventHandler.add(itemElement, 'mouseleave', function () { return _this.closeStepperTooltip(); }, this);
606
+ };
607
+ Stepper.prototype.openStepperTooltip = function (index) {
608
+ var currentStep = this.steps[parseInt(index.toString(), 10)];
609
+ if (this.showTooltip && (currentStep.label || currentStep.text)) {
610
+ if (!this.tooltipOpen) {
611
+ this.updateTooltipContent(index);
612
+ this.tooltipObj.open(this.stepperItemElements[parseInt((index).toString(), 10)]);
613
+ if (this.stepType.toLocaleLowerCase() !== 'label' && ((this.stepType.toLocaleLowerCase() === 'indicator') ||
614
+ (currentStep.label !== '' && currentStep.iconCss !== ''))) {
615
+ var tooltipPopupClass = currentStep.status.toLowerCase() === 'inprogress' ?
616
+ STEPPERTOOLTIP + " " + STEPPERIPROGRESSTIP + " " + (this.cssClass ? this.cssClass : '') : STEPPERTOOLTIP + " " + (this.cssClass ? this.cssClass : '');
617
+ this.tooltipObj.setProperties({ cssClass: tooltipPopupClass.trim() });
618
+ }
619
+ this.tooltipOpen = true;
620
+ }
621
+ }
622
+ };
623
+ Stepper.prototype.closeStepperTooltip = function () {
624
+ if (this.tooltipOpen) {
625
+ this.tooltipObj.close();
626
+ this.tooltipOpen = false;
627
+ }
628
+ };
629
+ Stepper.prototype.updateTooltipContent = function (index) {
630
+ if (this.showTooltip) {
631
+ if (this.isReact) {
632
+ this.clearTemplate(['stepperTooltipTemplate']);
633
+ }
634
+ var content = void 0;
635
+ var currentStep = this.steps[parseInt(index.toString(), 10)];
636
+ if (this.tooltipTemplate) {
637
+ content = this.createElement('span', { className: 'e-stepper-tooltip-content' });
638
+ var templateFunction = this.getTemplateFunction(this.tooltipTemplate);
639
+ append(templateFunction({ value: currentStep }, this, 'stepperTooltipTemplate', (this.element.id + 'tooltipTemplate'), this.isStringTemplate), content);
640
+ this.tooltipObj.setProperties({ content: content }, true);
641
+ }
642
+ else {
643
+ var content_1 = currentStep.label ? currentStep.label : currentStep.text;
644
+ this.tooltipObj.setProperties({ content: initializeCSPTemplate(function () { return content_1; }) }, true);
645
+ }
646
+ this.renderReactTemplates();
647
+ }
648
+ };
649
+ Stepper.prototype.stepClickHandler = function (index, e, itemElement) {
650
+ var clickEventArgs = {
651
+ element: itemElement, event: e, previousStep: this.activeStep,
652
+ activeStep: index
653
+ };
654
+ this.trigger('stepClick', clickEventArgs);
655
+ this.navigateToStep(index, e, itemElement, true);
656
+ };
657
+ Stepper.prototype.updateTemplateFunction = function () {
658
+ this.templateFunction = this.template ? this.getTemplateFunction(this.template) : null;
659
+ };
660
+ Stepper.prototype.renderItemContent = function (index, isrerender) {
661
+ var listItems = this.stepperItemList.querySelectorAll('li');
662
+ if (isrerender) {
663
+ this.removeItemContent(listItems[parseInt((index).toString(), 10)]);
664
+ }
665
+ if (this.template) {
666
+ isrerender ? listItems[parseInt((index).toString(), 10)].classList.add(TEMPLATE) :
667
+ this.stepperItemContainer.classList.add(TEMPLATE);
668
+ var item = this.steps[parseInt(index.toString(), 10)];
669
+ append(this.templateFunction({ step: item, currentStep: index }, this, 'stepperTemplate', (this.element.id + '_stepperTemplate'), this.isStringTemplate), isrerender ? listItems[parseInt((index).toString(), 10)] : this.stepperItemContainer);
670
+ }
671
+ this.renderReactTemplates();
672
+ };
673
+ Stepper.prototype.removeItemContent = function (ele) {
674
+ ele.classList.remove(TEMPLATE);
675
+ var firstChild = ele.firstElementChild;
676
+ for (var i = 0; i < ele.childElementCount; i++) {
677
+ firstChild.remove();
678
+ }
679
+ };
680
+ Stepper.prototype.updateContent = function () {
681
+ if (this.isReact) {
682
+ this.clearTemplate(['stepperTemplate']);
683
+ }
684
+ for (var i = 0; i < this.steps.length; i++) {
685
+ this.renderItemContent(i, true);
686
+ }
687
+ };
688
+ /**
689
+ * Gets template content based on the template property value.
690
+ *
691
+ * @param {string | Function} template - Template property value.
692
+ * @returns {Function} - Return template function.
693
+ * @hidden
694
+ */
695
+ Stepper.prototype.getTemplateFunction = function (template) {
696
+ if (typeof template === 'string') {
697
+ var content = '';
698
+ try {
699
+ var tempEle = select(template);
700
+ if (tempEle) {
701
+ //Return innerHTML incase of jsrenderer script else outerHTML
702
+ content = tempEle.tagName === 'SCRIPT' ? tempEle.innerHTML : tempEle.outerHTML;
703
+ }
704
+ else {
705
+ content = template;
706
+ }
707
+ }
708
+ catch (e) {
709
+ content = template;
710
+ }
711
+ return compile(content);
712
+ }
713
+ else {
714
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
715
+ return compile(template);
716
+ }
717
+ };
718
+ Stepper.prototype.navigateToStep = function (index, e, itemElement, isInteracted, isUpdated) {
719
+ var _this = this;
720
+ var eventArgs = {
721
+ element: itemElement, event: e, isInteracted: isInteracted,
722
+ previousStep: this.activeStep, activeStep: index, cancel: false
723
+ };
724
+ if (isUpdated != false) {
725
+ var previousStep_1 = this.activeStep;
726
+ this.trigger('stepChanging', eventArgs, function (args) {
727
+ if (args.cancel) {
728
+ return;
729
+ }
730
+ _this.navigationHandler(index);
731
+ var eventArgs = {
732
+ element: itemElement, event: e, isInteracted: isInteracted,
733
+ previousStep: previousStep_1, activeStep: _this.activeStep
734
+ };
735
+ _this.trigger('stepChanged', eventArgs);
736
+ });
737
+ }
738
+ else {
739
+ this.navigationHandler(index);
740
+ }
741
+ };
742
+ Stepper.prototype.navigationHandler = function (index, stepStatus, isUpdated) {
743
+ index = (index >= this.steps.length - 1) ? this.steps.length - 1 : index;
744
+ var Itemslength = this.stepperItemElements.length;
745
+ if (index >= 0 && index < Itemslength - 1) {
746
+ index = this.stepperItemElements[parseInt(index.toString(), 10)].classList.contains(DISABLED) ? this.activeStep : index;
747
+ }
748
+ var prevOnChange = this.isProtectedOnChange;
749
+ this.isProtectedOnChange = true;
750
+ this.activeStep = index;
751
+ this.isProtectedOnChange = prevOnChange;
752
+ for (var i = 0; i < this.steps.length; i++) {
753
+ var itemElement = this.stepperItemElements[parseInt(i.toString(), 10)];
754
+ var item = this.steps[parseInt(i.toString(), 10)];
755
+ itemElement.classList.remove(SELECTED, INPROGRESS, COMPLETED, NOTSTARTED);
756
+ if (i === this.activeStep) {
757
+ itemElement.classList.add(SELECTED);
758
+ }
759
+ if (this.activeStep >= 0 && this.progressbar) {
760
+ if (this.element.classList.contains(HORIZSTEP)) {
761
+ if ((this.element.classList.contains(LABELBEFORE) || this.element.classList.contains(LABELAFTER)) && !this.element.classList.contains(STEPINDICATOR) &&
762
+ this.stepperItemElements[parseInt(this.activeStep.toString(), 10)].classList.contains(STEPICON)) {
763
+ var progressPos = this.element.querySelector('.e-stepper-progressbar');
764
+ var selectedEle = this.stepperItemElements[parseInt(this.activeStep.toString(), 10)].firstChild;
765
+ var value = this.activeStep === 0 ? 0 : (selectedEle.offsetLeft - progressPos.offsetLeft + (selectedEle.offsetWidth / 2)) / progressPos.offsetWidth * 100;
766
+ if (this.element.classList.contains(RTL)) {
767
+ var elementPos = this.stepperItemElements[0].firstChild;
768
+ value = ((progressPos.offsetWidth - selectedEle.offsetLeft) + Math.abs((elementPos.offsetLeft + elementPos.offsetWidth) - this.stepperItemList.offsetWidth)) / progressPos.offsetWidth * 100;
769
+ this.progressbar.style.setProperty(PROGRESSVALUE, (value) + '%');
770
+ }
771
+ else {
772
+ this.progressbar.style.setProperty(PROGRESSVALUE, (value) + '%');
773
+ }
774
+ }
775
+ else {
776
+ var totalLiWidth = 0;
777
+ var activeLiWidth = 0;
778
+ for (var j = 0; j < this.stepperItemElements.length; j++) {
779
+ totalLiWidth = totalLiWidth + this.stepperItemElements[parseInt(j.toString(), 10)].offsetWidth;
780
+ if (j <= this.activeStep) {
781
+ if (j < this.activeStep) {
782
+ activeLiWidth = activeLiWidth + this.stepperItemElements[parseInt(j.toString(), 10)].offsetWidth;
783
+ }
784
+ else if (j == this.activeStep && j !== 0) {
785
+ activeLiWidth = activeLiWidth + (this.stepperItemElements[parseInt(j.toString(), 10)].offsetWidth / 2);
786
+ }
787
+ }
788
+ }
789
+ var spaceWidth = (this.stepperItemList.offsetWidth - totalLiWidth) / (this.stepperItemElements.length - 1);
790
+ var progressValue = ((activeLiWidth + (spaceWidth * this.activeStep)) / this.stepperItemList.offsetWidth) * 100;
791
+ this.progressbar.style.setProperty(PROGRESSVALUE, (progressValue) + '%');
792
+ }
793
+ }
794
+ else {
795
+ this.progressbar.style.setProperty(PROGRESSVALUE, ((100 / (this.steps.length - 1)) * index) + '%');
796
+ }
797
+ }
798
+ else if (this.activeStep < 0 && this.progressbar) {
799
+ this.progressbar.style.setProperty(PROGRESSVALUE, 0 + '%');
800
+ }
801
+ if (i === this.activeStep) {
802
+ itemElement.classList.add(INPROGRESS);
803
+ }
804
+ else if (this.activeStep > 0 && i < this.activeStep) {
805
+ itemElement.classList.add(COMPLETED);
806
+ }
807
+ else {
808
+ itemElement.classList.add(NOTSTARTED);
809
+ }
810
+ if (itemElement.classList.contains(INPROGRESS)) {
811
+ attributes(itemElement, { 'tabindex': '0', 'aria-current': 'true' });
812
+ }
813
+ else {
814
+ attributes(itemElement, { 'tabindex': '-1', 'aria-current': 'false' });
815
+ }
816
+ var prevOnChange_1 = this.isProtectedOnChange;
817
+ this.isProtectedOnChange = true;
818
+ if (isUpdated !== false) {
819
+ if (i < this.activeStep || (this.steps.length - 1 === this.activeStep && item.status.toLowerCase() === "completed")) {
820
+ item.status = StepStatus.Completed;
821
+ }
822
+ else if (i === this.activeStep) {
823
+ item.status = StepStatus.InProgress;
824
+ }
825
+ else if (i > this.activeStep) {
826
+ item.status = StepStatus.NotStarted;
827
+ }
828
+ if (stepStatus && this.activeStep === i) {
829
+ item.status = stepStatus;
830
+ }
831
+ if (item.status.toLowerCase() === "completed") {
832
+ itemElement.classList.remove(SELECTED, INPROGRESS, NOTSTARTED);
833
+ itemElement.classList.add(COMPLETED);
834
+ }
835
+ if (item.status.toLowerCase() === "notstarted") {
836
+ itemElement.classList.remove(SELECTED, INPROGRESS, COMPLETED);
837
+ itemElement.classList.add(NOTSTARTED);
838
+ }
839
+ }
840
+ this.isProtectedOnChange = prevOnChange_1;
841
+ if (this.renderDefault(i) && this.element.classList.contains(STEPINDICATOR)) {
842
+ if (itemElement.classList.contains(COMPLETED)) {
843
+ itemElement.firstChild.classList.remove('e-icons', 'e-step-indicator');
844
+ itemElement.firstChild.classList.add(ICONCSS, 'e-icons', 'e-check');
845
+ }
846
+ else if (itemElement.classList.contains(INPROGRESS) || itemElement.classList.contains(NOTSTARTED)) {
847
+ itemElement.firstChild.classList.remove(ICONCSS, 'e-icons', 'e-check');
848
+ itemElement.firstChild.classList.add('e-icons', 'e-step-indicator');
849
+ }
850
+ }
851
+ }
852
+ };
853
+ Stepper.prototype.removeItemElements = function () {
854
+ for (var i = 0; i < this.stepperItemElements.length; i++) {
855
+ remove(this.stepperItemElements[parseInt(i.toString(), 10)]);
856
+ }
857
+ this.stepperItemElements = [];
858
+ };
859
+ Stepper.prototype.nextStep = function () {
860
+ if (this.activeStep !== this.steps.length - 1) {
861
+ this.navigateToStep(this.activeStep + 1, null, null, false);
862
+ }
863
+ };
864
+ Stepper.prototype.previousStep = function () {
865
+ if (this.activeStep > 0) {
866
+ this.navigateToStep(this.activeStep - 1, null, null, false);
867
+ }
868
+ };
869
+ Stepper.prototype.reset = function () {
870
+ if (this.activeStep !== 0) {
871
+ var isDisabled = this.stepperItemElements[0].classList.contains(DISABLED) ? true : false;
872
+ this.navigateToStep(isDisabled ? -1 : 0, null, null, false);
873
+ }
874
+ };
875
+ Stepper.prototype.updateElementClassArray = function () {
876
+ var classArray = [RTL, READONLY, 'e-steps-focus', LABELAFTER, LABELBEFORE, 'e-label-top',
877
+ 'e-label-bottom', 'e-label-start', 'e-label-end', STEPINDICATOR, LABELINDICATOR, VERTICALSTEP, HORIZSTEP];
878
+ removeClass([this.element], classArray);
879
+ };
880
+ Stepper.prototype.destroy = function () {
881
+ var _this = this;
882
+ _super.prototype.destroy.call(this);
883
+ EventHandler.remove(window, 'resize', function () { if (_this.stepperItemList && _this.progressbar) {
884
+ _this.setProgressPosition(_this.element, true);
885
+ } });
886
+ EventHandler.remove(window, 'click', function () { _this.updateStepFocus(); });
887
+ // unwires the events and detach the li elements
888
+ this.removeItemElements();
889
+ this.clearTemplate();
890
+ if (this.stepperItemList) {
891
+ remove(this.stepperItemList);
892
+ }
893
+ this.stepperItemList = null;
894
+ if (this.progressStep) {
895
+ remove(this.progressStep);
896
+ }
897
+ this.progressStep = null;
898
+ this.progressbar = null;
899
+ this.progressBarPosition = null;
900
+ this.stepperItemContainer = null;
901
+ this.textContainer = null;
902
+ this.labelContainer = null;
903
+ this.updateElementClassArray();
904
+ this.element.removeAttribute('aria-label');
905
+ if (this.showTooltip) {
906
+ this.tooltipObj.destroy();
907
+ this.tooltipObj = null;
908
+ }
909
+ if (this.keyboardModuleStepper) {
910
+ this.keyboardModuleStepper.destroy();
911
+ }
912
+ this.keyboardModuleStepper = null;
913
+ };
914
+ Stepper.prototype.wireKeyboardEvent = function () {
915
+ this.keyboardModuleStepper = new KeyboardEvents(this.element, {
916
+ keyAction: this.keyActionHandler.bind(this),
917
+ keyConfigs: this.keyConfigs,
918
+ eventName: 'keydown'
919
+ });
920
+ };
921
+ Stepper.prototype.keyActionHandler = function (e) {
922
+ if (this.readOnly) {
923
+ return;
924
+ }
925
+ switch (e.action) {
926
+ case 'uparrow':
927
+ case 'downarrow':
928
+ case 'leftarrow':
929
+ case 'rightarrow':
930
+ case 'tab':
931
+ case 'shiftTab':
932
+ this.handleNavigation(this.enableRtl && this.element.classList.contains(HORIZSTEP) ? (e.action === 'leftarrow' || e.action === 'shiftTab' || e.action === 'uparrow') : (e.action === 'rightarrow' || e.action === 'tab' || e.action === 'downarrow'), e);
933
+ break;
934
+ case 'space':
935
+ case 'enter':
936
+ case 'escape':
937
+ this.handleNavigation(null, e);
938
+ break;
939
+ case 'home':
940
+ case 'end':
941
+ this.handleNavigation(null, e, this.enableRtl);
942
+ break;
943
+ }
944
+ };
945
+ Stepper.prototype.handleNavigation = function (isNextStep, e, isRTL) {
946
+ this.isKeyNavFocus = true;
947
+ this.element.classList.add('e-steps-focus');
948
+ var focusedEle = this.element.querySelector('.' + FOCUS);
949
+ if (!focusedEle) {
950
+ focusedEle = this.element.querySelector('.' + SELECTED);
951
+ }
952
+ var stepItems = Array.prototype.slice.call(this.stepperItemList.children);
953
+ var index = stepItems.indexOf(focusedEle);
954
+ if (e.action === 'tab' || e.action === 'shiftTab' || e.action === 'downarrow' || e.action === 'uparrow' || e.action === 'space' || e.action === 'home' || e.action === 'end') {
955
+ if ((e.action === 'tab' && index === stepItems.length - 1) || (e.action === 'shiftTab' && index === 0)) {
956
+ if (focusedEle.classList.contains(FOCUS)) {
957
+ this.updateStepFocus();
958
+ return;
959
+ }
960
+ }
961
+ else {
962
+ e.preventDefault();
963
+ }
964
+ }
965
+ if (e.action === 'escape') {
966
+ stepItems[parseInt(index.toString(), 10)].classList.remove(FOCUS);
967
+ this.element.classList.remove('e-steps-focus');
968
+ }
969
+ if (!(e.action === 'space' || e.action === 'enter')) {
970
+ var prevIndex = index;
971
+ index = isNextStep ? index + 1 : index - 1;
972
+ while ((index >= 0 && index < stepItems.length) && stepItems[parseInt(index.toString(), 10)].classList.contains(DISABLED)) {
973
+ index = isNextStep ? index + 1 : index - 1;
974
+ }
975
+ index = (index < 0) ? 0 : (index > stepItems.length - 1) ? stepItems.length - 1 : index;
976
+ if (stepItems[parseInt(prevIndex.toString(), 10)].classList.contains(FOCUS)) {
977
+ stepItems[parseInt(prevIndex.toString(), 10)].classList.remove(FOCUS);
978
+ }
979
+ if ((e.action === 'home' || e.action === 'end')) {
980
+ if (e.action === 'home') {
981
+ isRTL ? index = stepItems.length - 1 : index = 0;
982
+ }
983
+ else {
984
+ isRTL ? index = 0 : index = stepItems.length - 1;
985
+ }
986
+ }
987
+ if (index >= 0 && index < stepItems.length) {
988
+ stepItems[parseInt(index.toString(), 10)].classList.add(FOCUS);
989
+ }
990
+ }
991
+ else if ((e.action === 'space' || e.action === 'enter')) {
992
+ var isupdateFocus = false;
993
+ if (this.linear) {
994
+ var linearModeValue = this.activeStep - index;
995
+ if (Math.abs(linearModeValue) === 1) {
996
+ this.navigateToStep(index, null, null, true);
997
+ isupdateFocus = true;
998
+ }
999
+ }
1000
+ else {
1001
+ this.navigateToStep(index, null, null, true);
1002
+ isupdateFocus = true;
1003
+ }
1004
+ if (isupdateFocus) {
1005
+ this.updateStepFocus();
1006
+ this.stepperItemElements[index].focus();
1007
+ }
1008
+ }
1009
+ };
1010
+ Stepper.prototype.renderStepperItems = function (isUpdate, isStepType) {
1011
+ this.updateElementClassArray();
1012
+ this.removeItemElements();
1013
+ this.element.querySelector('.e-stepper-progressbar').remove();
1014
+ isUpdate ? this.updatePosition() : null;
1015
+ isStepType ? this.updateStepType() : null;
1016
+ this.readOnly ? (!this.element.classList.contains(READONLY)) ? this.element.classList.add(READONLY) : null : null;
1017
+ this.enableRtl ? (!this.element.classList.contains(RTL)) ? this.element.classList.add(RTL) : null : null;
1018
+ this.updateOrientaion(this.element);
1019
+ this.renderItems();
1020
+ this.renderProgressBar(this.element);
1021
+ this.checkValidStep();
1022
+ this.updateAnimation();
1023
+ this.navigateToStep(this.activeStep, null, this.stepperItemElements[this.activeStep], true);
1024
+ };
1025
+ /**
1026
+ * Called internally if any of the property value changed.
1027
+ *
1028
+ * @param {StepperModel} newProp - Specifies new properties
1029
+ * @param {StepperModel} oldProp - Specifies old properties
1030
+ * @returns {void}
1031
+ * @private
1032
+ */
1033
+ Stepper.prototype.onPropertyChanged = function (newProp, oldProp) {
1034
+ for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
1035
+ var prop = _a[_i];
1036
+ switch (prop) {
1037
+ case 'steps': {
1038
+ if (!(newProp.steps instanceof Array && oldProp.steps instanceof Array)) {
1039
+ var stepCounts = Object.keys(newProp.steps);
1040
+ for (var i = 0; i < stepCounts.length; i++) {
1041
+ var index = parseInt(Object.keys(newProp.steps)[i], 10);
1042
+ var changedPropsCount = Object.keys(newProp.steps[index]).length;
1043
+ for (var j = 0; j < changedPropsCount; j++) {
1044
+ var property = Object.keys(newProp.steps[index])[j];
1045
+ if (property === 'status') {
1046
+ if (this.activeStep === index) {
1047
+ this.navigationHandler(index, newProp.steps[index].status);
1048
+ }
1049
+ else {
1050
+ this.steps[index].status = oldProp.steps[index].status;
1051
+ }
1052
+ }
1053
+ else {
1054
+ this.removeItemElements();
1055
+ this.renderItems();
1056
+ this.updateStepperStatus();
1057
+ }
1058
+ this.checkValidStep();
1059
+ }
1060
+ }
1061
+ }
1062
+ else {
1063
+ this.renderStepperItems(true, true);
1064
+ }
1065
+ break;
1066
+ }
1067
+ case 'orientation':
1068
+ this.updateOrientaion(this.element);
1069
+ this.renderStepperItems(true);
1070
+ break;
1071
+ case 'activeStep':
1072
+ this.activeStep = (newProp.activeStep > this.steps.length - 1 || newProp.activeStep < -1) ? oldProp.activeStep : this.activeStep;
1073
+ if (this.activeStep >= 0 && this.stepperItemElements[parseInt(this.activeStep.toString(), 10)].classList.contains(DISABLED)) {
1074
+ this.activeStep = oldProp.activeStep;
1075
+ }
1076
+ if (this.linear) {
1077
+ var linearModeValue = oldProp.activeStep - this.activeStep;
1078
+ if (Math.abs(linearModeValue) === 1) {
1079
+ this.navigateToStep(this.activeStep, null, null, true);
1080
+ }
1081
+ }
1082
+ else {
1083
+ this.navigateToStep(this.activeStep, null, this.stepperItemElements[this.activeStep], true);
1084
+ }
1085
+ break;
1086
+ case 'enableRtl':
1087
+ this.element.classList[this.enableRtl ? 'add' : 'remove'](RTL);
1088
+ break;
1089
+ case 'readOnly':
1090
+ this.element.classList[this.readOnly ? 'add' : 'remove'](READONLY);
1091
+ break;
1092
+ case 'cssClass':
1093
+ if (oldProp.cssClass) {
1094
+ removeClass([this.element], oldProp.cssClass.trim().split(' '));
1095
+ }
1096
+ if (newProp.cssClass) {
1097
+ addClass([this.element], newProp.cssClass.trim().split(' '));
1098
+ }
1099
+ if (this.tooltipObj) {
1100
+ this.tooltipObj.setProperties({ cssClass: this.cssClass ? (STEPPERTOOLTIP + ' ' + this.cssClass) : STEPPERTOOLTIP });
1101
+ }
1102
+ break;
1103
+ case 'labelPosition':
1104
+ this.renderStepperItems(true);
1105
+ break;
1106
+ case 'showTooltip':
1107
+ this.updateTooltip();
1108
+ break;
1109
+ case 'stepType':
1110
+ this.renderStepperItems(true, true);
1111
+ break;
1112
+ case 'template':
1113
+ this.updateTemplateFunction();
1114
+ this.updateContent();
1115
+ break;
1116
+ case 'animation':
1117
+ this.updateAnimation();
1118
+ break;
1119
+ }
1120
+ }
1121
+ };
1122
+ __decorate([
1123
+ Property(0)
1124
+ ], Stepper.prototype, "activeStep", void 0);
1125
+ __decorate([
1126
+ Complex({}, StepperAnimationSettings)
1127
+ ], Stepper.prototype, "animation", void 0);
1128
+ __decorate([
1129
+ Property(false)
1130
+ ], Stepper.prototype, "linear", void 0);
1131
+ __decorate([
1132
+ Property(false)
1133
+ ], Stepper.prototype, "showTooltip", void 0);
1134
+ __decorate([
1135
+ Property('')
1136
+ ], Stepper.prototype, "template", void 0);
1137
+ __decorate([
1138
+ Property('')
1139
+ ], Stepper.prototype, "tooltipTemplate", void 0);
1140
+ __decorate([
1141
+ Property(StepLabelPosition.Bottom)
1142
+ ], Stepper.prototype, "labelPosition", void 0);
1143
+ __decorate([
1144
+ Property(StepType.Default)
1145
+ ], Stepper.prototype, "stepType", void 0);
1146
+ __decorate([
1147
+ Event()
1148
+ ], Stepper.prototype, "stepChanged", void 0);
1149
+ __decorate([
1150
+ Event()
1151
+ ], Stepper.prototype, "stepChanging", void 0);
1152
+ __decorate([
1153
+ Event()
1154
+ ], Stepper.prototype, "stepClick", void 0);
1155
+ __decorate([
1156
+ Event()
1157
+ ], Stepper.prototype, "beforeStepRender", void 0);
1158
+ Stepper = __decorate([
1159
+ NotifyPropertyChanges
1160
+ ], Stepper);
1161
+ return Stepper;
1162
+ }(StepperBase));
1163
+ export { Stepper };