@syncfusion/ej2-navigations 23.2.7 → 24.1.41

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