@ui5/webcomponents 1.10.0 → 1.10.2

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 (101) hide show
  1. package/.dev-server-port +1 -0
  2. package/CHANGELOG.md +101 -0
  3. package/dist/Avatar.d.ts +2 -2
  4. package/dist/Badge.d.ts +3 -3
  5. package/dist/Breadcrumbs.d.ts +5 -5
  6. package/dist/Breadcrumbs.js +1 -1
  7. package/dist/BusyIndicator.d.ts +136 -0
  8. package/dist/BusyIndicator.js +126 -208
  9. package/dist/BusyIndicator.js.map +1 -0
  10. package/dist/Button.d.ts +3 -3
  11. package/dist/Calendar.d.ts +3 -3
  12. package/dist/Calendar.js +1 -1
  13. package/dist/CalendarHeader.d.ts +2 -2
  14. package/dist/Card.d.ts +3 -3
  15. package/dist/Card.js +1 -1
  16. package/dist/CardHeader.d.ts +2 -2
  17. package/dist/Carousel.d.ts +318 -0
  18. package/dist/Carousel.js +446 -642
  19. package/dist/Carousel.js.map +1 -0
  20. package/dist/CheckBox.d.ts +3 -3
  21. package/dist/ColorPalette.d.ts +5 -5
  22. package/dist/ColorPalette.js +1 -1
  23. package/dist/ColorPaletteItem.d.ts +2 -2
  24. package/dist/ColorPalettePopover.d.ts +2 -2
  25. package/dist/ColorPicker.d.ts +2 -2
  26. package/dist/ComboBox.js +2 -2
  27. package/dist/CustomListItem.d.ts +1 -1
  28. package/dist/DatePicker.d.ts +2 -2
  29. package/dist/DateTimePicker.d.ts +1 -1
  30. package/dist/DayPicker.d.ts +2 -2
  31. package/dist/Dialog.d.ts +4 -5
  32. package/dist/FileUploader.d.ts +4 -4
  33. package/dist/GroupHeaderListItem.d.ts +1 -1
  34. package/dist/Icon.d.ts +2 -2
  35. package/dist/Input.d.ts +5 -5
  36. package/dist/Input.js +1 -1
  37. package/dist/Label.d.ts +2 -2
  38. package/dist/Link.d.ts +2 -2
  39. package/dist/List.d.ts +4 -3
  40. package/dist/List.js +1 -1
  41. package/dist/ListItem.d.ts +1 -1
  42. package/dist/Menu.d.ts +3 -3
  43. package/dist/Menu.js +1 -1
  44. package/dist/MessageStrip.d.ts +2 -2
  45. package/dist/MonthPicker.d.ts +2 -2
  46. package/dist/MultiComboBox.js +6 -2
  47. package/dist/MultiInput.js +1 -1
  48. package/dist/Panel.d.ts +2 -2
  49. package/dist/Popover.d.ts +1 -1
  50. package/dist/Popup.d.ts +3 -3
  51. package/dist/ProgressIndicator.d.ts +2 -2
  52. package/dist/RangeSlider.d.ts +1 -1
  53. package/dist/ResponsivePopover.d.ts +1 -1
  54. package/dist/SegmentedButton.js +1 -1
  55. package/dist/Select.js +1 -1
  56. package/dist/Slider.d.ts +1 -1
  57. package/dist/SplitButton.d.ts +2 -2
  58. package/dist/StandardListItem.d.ts +2 -2
  59. package/dist/StepInput.d.ts +2 -2
  60. package/dist/SuggestionListItem.d.ts +1 -1
  61. package/dist/Switch.d.ts +2 -2
  62. package/dist/TabContainer.js +1 -2
  63. package/dist/Table.d.ts +6 -4
  64. package/dist/Table.js +1 -1
  65. package/dist/TableCell.d.ts +2 -2
  66. package/dist/TableColumn.d.ts +2 -2
  67. package/dist/TableGroupRow.d.ts +2 -2
  68. package/dist/TableRow.d.ts +2 -2
  69. package/dist/TimePickerBase.d.ts +4 -4
  70. package/dist/TimeSelection.d.ts +2 -2
  71. package/dist/Title.d.ts +2 -2
  72. package/dist/Tree.js +1 -1
  73. package/dist/WheelSlider.d.ts +2 -2
  74. package/dist/YearPicker.d.ts +2 -2
  75. package/dist/api.json +1 -1
  76. package/dist/generated/templates/CarouselTemplate.lit.js +2 -2
  77. package/global.d.ts +2 -2
  78. package/package.json +7 -7
  79. package/src/Badge.ts +1 -1
  80. package/src/Breadcrumbs.ts +1 -1
  81. package/src/{BusyIndicator.js → BusyIndicator.ts} +95 -100
  82. package/src/Calendar.ts +1 -1
  83. package/src/Card.ts +1 -1
  84. package/src/Carousel.hbs +3 -3
  85. package/src/{Carousel.js → Carousel.ts} +242 -234
  86. package/src/CheckBox.ts +1 -1
  87. package/src/ColorPalette.ts +1 -1
  88. package/src/ComboBox.js +2 -2
  89. package/src/Dialog.ts +2 -2
  90. package/src/Input.ts +1 -1
  91. package/src/List.ts +1 -1
  92. package/src/ListItem.ts +1 -1
  93. package/src/Menu.ts +1 -1
  94. package/src/MultiComboBox.js +6 -2
  95. package/src/MultiInput.js +1 -1
  96. package/src/SegmentedButton.js +1 -1
  97. package/src/Select.js +1 -1
  98. package/src/TabContainer.js +1 -2
  99. package/src/Table.ts +1 -1
  100. package/src/Tree.hbs +1 -1
  101. package/src/Tree.js +1 -1
@@ -1,4 +1,10 @@
1
1
  import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
2
+ import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
3
+ import languageAware from "@ui5/webcomponents-base/dist/decorators/languageAware.js";
4
+ import property from "@ui5/webcomponents-base/dist/decorators/property.js";
5
+ import event from "@ui5/webcomponents-base/dist/decorators/event.js";
6
+ import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
7
+ import fastNavigation from "@ui5/webcomponents-base/dist/decorators/fastNavigation.js";
2
8
  import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
3
9
  import Integer from "@ui5/webcomponents-base/dist/types/Integer.js";
4
10
  import {
@@ -9,7 +15,10 @@ import {
9
15
  isF7,
10
16
  } from "@ui5/webcomponents-base/dist/Keys.js";
11
17
  import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
18
+ import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
19
+ import type { I18nText } from "@ui5/webcomponents-base/dist/i18nBundle.js";
12
20
  import ScrollEnablement from "@ui5/webcomponents-base/dist/delegate/ScrollEnablement.js";
21
+ import type { ScrollEnablementEventListenerParam } from "@ui5/webcomponents-base/dist/delegate/ScrollEnablement.js";
13
22
  import ResizeHandler from "@ui5/webcomponents-base/dist/delegate/ResizeHandler.js";
14
23
  import { renderFinished } from "@ui5/webcomponents-base/dist/Render.js";
15
24
  import { isDesktop } from "@ui5/webcomponents-base/dist/Device.js";
@@ -20,6 +29,7 @@ import {
20
29
  CAROUSEL_DOT_TEXT,
21
30
  CAROUSEL_PREVIOUS_ARROW_TEXT,
22
31
  CAROUSEL_NEXT_ARROW_TEXT,
32
+ // @ts-ignore
23
33
  } from "./generated/i18n/i18n-defaults.js";
24
34
  import CarouselArrowsPlacement from "./types/CarouselArrowsPlacement.js";
25
35
  import CarouselPageIndicatorStyle from "./types/CarouselPageIndicatorStyle.js";
@@ -33,192 +43,9 @@ import Label from "./Label.js";
33
43
  // Styles
34
44
  import CarouselCss from "./generated/themes/Carousel.css.js";
35
45
 
36
- /**
37
- * @public
38
- */
39
- const metadata = {
40
- tag: "ui5-carousel",
41
- languageAware: true,
42
- fastNavigation: true,
43
- properties: /** @lends sap.ui.webc.main.Carousel.prototype */ {
44
- /**
45
- * Defines whether the carousel should loop, i.e show the first page after the last page is reached and vice versa.
46
- * @type {boolean}
47
- * @defaultvalue false
48
- * @public
49
- */
50
- cyclic: {
51
- type: Boolean,
52
- },
53
-
54
- /**
55
- * Defines the number of items per page on small size (up to 640px). One item per page shown by default.
56
- * @type {sap.ui.webc.base.types.Integer}
57
- * @defaultvalue 1
58
- * @public
59
- */
60
- itemsPerPageS: {
61
- type: Integer,
62
- defaultValue: 1,
63
- },
64
-
65
- /**
66
- * Defines the number of items per page on medium size (from 640px to 1024px). One item per page shown by default.
67
- * @type {sap.ui.webc.base.types.Integer}
68
- * @defaultvalue 1
69
- * @public
70
- */
71
- itemsPerPageM: {
72
- type: Integer,
73
- defaultValue: 1,
74
- },
75
-
76
- /**
77
- * Defines the number of items per page on large size (more than 1024px). One item per page shown by default.
78
- * @type {sap.ui.webc.base.types.Integer}
79
- * @defaultvalue 1
80
- * @public
81
- */
82
- itemsPerPageL: {
83
- type: Integer,
84
- defaultValue: 1,
85
- },
86
-
87
- /**
88
- * Defines the visibility of the navigation arrows.
89
- * If set to true the navigation arrows will be hidden.
90
- * <br><br>
91
- * <b>Note:</b> The navigation arrows are never displayed on touch devices.
92
- * In this case, the user can swipe to navigate through the items.
93
- * @type {boolean}
94
- * @since 1.0.0-rc.15
95
- * @defaultvalue false
96
- * @public
97
- */
98
- hideNavigationArrows: {
99
- type: Boolean,
100
- },
101
-
102
- /**
103
- * Defines the visibility of the page indicator.
104
- * If set to true the page indicator will be hidden.
105
- * @type {boolean}
106
- * @since 1.0.0-rc.15
107
- * @defaultvalue false
108
- * @public
109
- */
110
- hidePageIndicator: {
111
- type: Boolean,
112
- },
113
-
114
- /**
115
- * Defines the style of the page indicator.
116
- * Available options are:
117
- * <ul>
118
- * <li><code>Default</code> - The page indicator will be visualized as dots if there are fewer than 9 pages. If there are more pages, the page indicator will switch to displaying the current page and the total number of pages. (e.g. X of Y)</li>
119
- * <li><code>Numeric</code> - The page indicator will display the current page and the total number of pages. (e.g. X of Y)</li>
120
- * </ul>
121
- * @type {sap.ui.webc.main.types.CarouselPageIndicatorStyle}
122
- * @since 1.10
123
- * @defaultvalue "Default"
124
- * @public
125
- */
126
- pageIndicatorStyle: {
127
- type: CarouselPageIndicatorStyle,
128
- defaultValue: CarouselPageIndicatorStyle.Default,
129
- },
130
-
131
- /**
132
- * Defines the index of the initially selected item.
133
- * @type {sap.ui.webc.base.types.Integer}
134
- * @defaultvalue 0
135
- * @private
136
- */
137
- _selectedIndex: {
138
- type: Integer,
139
- defaultValue: 0,
140
- },
141
-
142
- /**
143
- * Defines the position of arrows.
144
- * <br><br>
145
- * Available options are:
146
- * <ul>
147
- * <li><code>Content</code></li>
148
- * <li><code>Navigation</code></li>
149
- * </ul>
150
- * <br>
151
- * When set to "Content", the arrows are placed on the sides of the current page.
152
- * <br>
153
- * When set to "Navigation", the arrows are placed on the sides of the page indicator.
154
- * @type {sap.ui.webc.main.types.CarouselArrowsPlacement}
155
- * @defaultvalue "Content"
156
- * @public
157
- */
158
- arrowsPlacement: {
159
- type: CarouselArrowsPlacement,
160
- defaultValue: CarouselArrowsPlacement.Content,
161
- },
162
-
163
- /**
164
- * Defines the carousel width in pixels.
165
- * @private
166
- */
167
- _width: {
168
- type: Integer,
169
- },
170
-
171
- /**
172
- * Defines the carousel item width in pixels.
173
- * @private
174
- */
175
- _itemWidth: {
176
- type: Integer,
177
- },
178
-
179
- /**
180
- * If set to true navigation arrows are shown.
181
- * @private
182
- * @since 1.0.0-rc.15
183
- */
184
- _visibleNavigationArrows: {
185
- type: Boolean,
186
- noAttribute: true,
187
- },
188
- },
189
- managedSlots: true,
190
- slots: /** @lends sap.ui.webc.main.Carousel.prototype */ {
191
- /**
192
- * Defines the content of the component.
193
- * @type {HTMLElement[]}
194
- * @slot content
195
- * @public
196
- */
197
- "default": {
198
- propertyName: "content",
199
- type: HTMLElement,
200
- individualSlots: true,
201
- },
202
- },
203
- events: /** @lends sap.ui.webc.main.Carousel.prototype */ {
204
-
205
- /**
206
- * Fired whenever the page changes due to user interaction,
207
- * when the user clicks on the navigation arrows or while resizing,
208
- * based on the <code>items-per-page-l</code>, <code>items-per-page-m</code> and <code>items-per-page-s</code> properties.
209
- *
210
- * @event
211
- * @param {Integer} selectedIndex the current selected index
212
- * @public
213
- * @since 1.0.0-rc.7
214
- */
215
- navigate: {
216
- detail: {
217
- selectedIndex: { type: Integer },
218
- },
219
- },
220
- },
221
- };
46
+ type CarouselNavigateEventDetail = {
47
+ selectedIndex: number;
48
+ }
222
49
 
223
50
  /**
224
51
  * @class
@@ -288,10 +115,179 @@ const metadata = {
288
115
  * @since 1.0.0-rc.6
289
116
  * @public
290
117
  */
118
+ @customElement("ui5-carousel")
119
+ @languageAware
120
+ @fastNavigation
121
+
122
+ /**
123
+ * Fired whenever the page changes due to user interaction,
124
+ * when the user clicks on the navigation arrows or while resizing,
125
+ * based on the <code>items-per-page-l</code>, <code>items-per-page-m</code> and <code>items-per-page-s</code> properties.
126
+ *
127
+ * @event sap.ui.webc.main.Carousel#navigate
128
+ * @param {Integer} selectedIndex the current selected index
129
+ * @public
130
+ * @since 1.0.0-rc.7
131
+ */
132
+ @event("navigate", {
133
+ detail: {
134
+ selectedIndex: { type: Integer },
135
+ },
136
+ })
137
+
291
138
  class Carousel extends UI5Element {
292
- static get metadata() {
293
- return metadata;
294
- }
139
+ /**
140
+ * Defines whether the carousel should loop, i.e show the first page after the last page is reached and vice versa.
141
+ * @type {boolean}
142
+ * @name sap.ui.webc.main.Carousel.prototype.cyclic
143
+ * @defaultvalue false
144
+ * @public
145
+ */
146
+ @property({ type: Boolean })
147
+ cyclic!: boolean;
148
+
149
+ /**
150
+ * Defines the number of items per page on small size (up to 640px). One item per page shown by default.
151
+ * @type {sap.ui.webc.base.types.Integer}
152
+ * @name sap.ui.webc.main.Carousel.prototype.itemsPerPageS
153
+ * @defaultvalue 1
154
+ * @public
155
+ */
156
+ @property({ validator: Integer, defaultValue: 1 })
157
+ itemsPerPageS!: number;
158
+
159
+ /**
160
+ * Defines the number of items per page on medium size (from 640px to 1024px). One item per page shown by default.
161
+ * @type {sap.ui.webc.base.types.Integer}
162
+ * @name sap.ui.webc.main.Carousel.prototype.itemsPerPageM
163
+ * @defaultvalue 1
164
+ * @public
165
+ */
166
+ @property({ validator: Integer, defaultValue: 1 })
167
+ itemsPerPageM!: number;
168
+
169
+ /**
170
+ * Defines the number of items per page on large size (more than 1024px). One item per page shown by default.
171
+ * @type {sap.ui.webc.base.types.Integer}
172
+ * @name sap.ui.webc.main.Carousel.prototype.itemsPerPageL
173
+ * @defaultvalue 1
174
+ * @public
175
+ */
176
+ @property({ validator: Integer, defaultValue: 1 })
177
+ itemsPerPageL!: number;
178
+
179
+ /**
180
+ * Defines the visibility of the navigation arrows.
181
+ * If set to true the navigation arrows will be hidden.
182
+ * <br><br>
183
+ * <b>Note:</b> The navigation arrows are never displayed on touch devices.
184
+ * In this case, the user can swipe to navigate through the items.
185
+ * @type {boolean}
186
+ * @name sap.ui.webc.main.Carousel.prototype.hideNavigationArrows
187
+ * @since 1.0.0-rc.15
188
+ * @defaultvalue false
189
+ * @public
190
+ */
191
+ @property({ type: Boolean })
192
+ hideNavigationArrows!: boolean;
193
+
194
+ /**
195
+ * Defines the visibility of the page indicator.
196
+ * If set to true the page indicator will be hidden.
197
+ * @type {boolean}
198
+ * @name sap.ui.webc.main.Carousel.prototype.hidePageIndicator
199
+ * @since 1.0.0-rc.15
200
+ * @defaultvalue false
201
+ * @public
202
+ */
203
+ @property({ type: Boolean })
204
+ hidePageIndicator!: boolean;
205
+
206
+ /**
207
+ * Defines the style of the page indicator.
208
+ * Available options are:
209
+ * <ul>
210
+ * <li><code>Default</code> - The page indicator will be visualized as dots if there are fewer than 9 pages. If there are more pages, the page indicator will switch to displaying the current page and the total number of pages. (e.g. X of Y)</li>
211
+ * <li><code>Numeric</code> - The page indicator will display the current page and the total number of pages. (e.g. X of Y)</li>
212
+ * </ul>
213
+ * @type {sap.ui.webc.main.types.CarouselPageIndicatorStyle}
214
+ * @name sap.ui.webc.main.Carousel.prototype.pageIndicatorStyle
215
+ * @since 1.10
216
+ * @defaultvalue "Default"
217
+ * @public
218
+ */
219
+ @property({ type: CarouselPageIndicatorStyle, defaultValue: CarouselPageIndicatorStyle.Default })
220
+ pageIndicatorStyle!: CarouselPageIndicatorStyle;
221
+
222
+ /**
223
+ * Defines the index of the initially selected item.
224
+ * @type {sap.ui.webc.base.types.Integer}
225
+ * @name sap.ui.webc.main.Carousel.prototype._selectedIndex
226
+ * @defaultvalue 0
227
+ * @private
228
+ */
229
+ @property({ validator: Integer, defaultValue: 0 })
230
+ _selectedIndex!: number;
231
+
232
+ /**
233
+ * Defines the position of arrows.
234
+ * <br><br>
235
+ * Available options are:
236
+ * <ul>
237
+ * <li><code>Content</code></li>
238
+ * <li><code>Navigation</code></li>
239
+ * </ul>
240
+ * <br>
241
+ * When set to "Content", the arrows are placed on the sides of the current page.
242
+ * <br>
243
+ * When set to "Navigation", the arrows are placed on the sides of the page indicator.
244
+ * @type {sap.ui.webc.main.types.CarouselArrowsPlacement}
245
+ * @name sap.ui.webc.main.Carousel.prototype.arrowsPlacement
246
+ * @defaultvalue "Content"
247
+ * @public
248
+ */
249
+ @property({ type: CarouselArrowsPlacement, defaultValue: CarouselArrowsPlacement.Content })
250
+ arrowsPlacement!: CarouselArrowsPlacement;
251
+
252
+ /**
253
+ * Defines the carousel width in pixels.
254
+ * @private
255
+ */
256
+ @property({ validator: Integer })
257
+ _width?: number;
258
+
259
+ /**
260
+ * Defines the carousel item width in pixels.
261
+ * @private
262
+ */
263
+ @property({ validator: Integer })
264
+ _itemWidth?: number;
265
+
266
+ /**
267
+ * If set to true navigation arrows are shown.
268
+ * @private
269
+ * @since 1.0.0-rc.15
270
+ */
271
+ @property({ type: Boolean, noAttribute: true })
272
+ _visibleNavigationArrows!: boolean;
273
+
274
+ _scrollEnablement: ScrollEnablement;
275
+ _onResizeBound: () => void;
276
+ _resizing: boolean;
277
+ _lastFocusedElements: Array<HTMLElement>;
278
+ _orderOfLastFocusedPages: Array<number>;
279
+
280
+ /**
281
+ * Defines the content of the component.
282
+ * @type {HTMLElement[]}
283
+ * @slot
284
+ * @name sap.ui.webc.main.Carousel.prototype.default
285
+ * @public
286
+ */
287
+ @slot({ "default": true, type: HTMLElement, individualSlots: true })
288
+ content!: Array<HTMLElement>;
289
+
290
+ static i18nBundle: I18nBundle;
295
291
 
296
292
  static get render() {
297
293
  return litRender;
@@ -313,8 +309,8 @@ class Carousel extends UI5Element {
313
309
  super();
314
310
 
315
311
  this._scrollEnablement = new ScrollEnablement(this);
316
- this._scrollEnablement.attachEvent("touchend", event => {
317
- this._updateScrolling(event);
312
+ this._scrollEnablement.attachEvent("touchend", e => {
313
+ this._updateScrolling(e);
318
314
  });
319
315
  this._onResizeBound = this._onResize.bind(this);
320
316
  this._resizing = false; // indicates if the carousel is in process of resizing
@@ -332,7 +328,7 @@ class Carousel extends UI5Element {
332
328
  }
333
329
 
334
330
  onAfterRendering() {
335
- this._scrollEnablement.scrollContainer = this.getDomRef();
331
+ this._scrollEnablement.scrollContainer = this.getDomRef()!;
336
332
  this._resizing = false; // not invalidating
337
333
  }
338
334
 
@@ -368,52 +364,53 @@ class Carousel extends UI5Element {
368
364
 
369
365
  if (this._selectedIndex > this.pagesCount - 1) {
370
366
  this._selectedIndex = this.pagesCount - 1;
371
- this.fireEvent("navigate", { selectedIndex: this._selectedIndex });
367
+ this.fireEvent<CarouselNavigateEventDetail>("navigate", { selectedIndex: this._selectedIndex });
372
368
  }
373
369
  }
374
370
 
375
- _updateScrolling(event) {
376
- if (!event) {
371
+ _updateScrolling(e: ScrollEnablementEventListenerParam) {
372
+ if (!e) {
377
373
  return;
378
374
  }
379
375
 
380
- if (event.isLeft) {
376
+ if (e.isLeft) {
381
377
  this.navigateLeft();
382
- } else if (event.isRight) {
378
+ } else if (e.isRight) {
383
379
  this.navigateRight();
384
380
  }
385
381
  }
386
382
 
387
- async _onkeydown(event) {
388
- if (isF7(event)) {
389
- this._handleF7Key(event);
383
+ async _onkeydown(e: KeyboardEvent) {
384
+ if (isF7(e)) {
385
+ this._handleF7Key(e);
390
386
  return;
391
387
  }
392
388
 
393
- if (event.target !== this.getDomRef()) {
389
+ if (e.target !== this.getDomRef()) {
394
390
  return;
395
391
  }
396
392
 
397
- if (isLeft(event) || isDown(event)) {
393
+ if (isLeft(e) || isDown(e)) {
398
394
  this.navigateLeft();
399
395
  await renderFinished();
400
- this.getDomRef().focus();
401
- } else if (isRight(event) || isUp(event)) {
396
+ this.getDomRef()!.focus();
397
+ } else if (isRight(e) || isUp(e)) {
402
398
  this.navigateRight();
403
399
  await renderFinished();
404
- this.getDomRef().focus();
400
+ this.getDomRef()!.focus();
405
401
  }
406
402
  }
407
403
 
408
- _onfocusin(event) {
409
- if (event.target === this.getDomRef()) {
404
+ _onfocusin(e: FocusEvent) {
405
+ const target = e.target as HTMLElement;
406
+
407
+ if (target === this.getDomRef()) {
410
408
  return;
411
409
  }
412
410
 
413
411
  let pageIndex = -1;
414
-
415
412
  for (let i = 0; i < this.content.length; i++) {
416
- if (this.content[i].contains(event.target)) {
413
+ if (this.content[i].contains(target)) {
417
414
  pageIndex = i;
418
415
  break;
419
416
  }
@@ -424,7 +421,7 @@ class Carousel extends UI5Element {
424
421
  }
425
422
 
426
423
  // Save reference of the last focused element for each page
427
- this._lastFocusedElements[pageIndex] = event.target;
424
+ this._lastFocusedElements[pageIndex] = target;
428
425
 
429
426
  const sortedPageIndex = this._orderOfLastFocusedPages.indexOf(pageIndex);
430
427
  if (sortedPageIndex === -1) {
@@ -446,13 +443,13 @@ class Carousel extends UI5Element {
446
443
  }
447
444
  }
448
445
 
449
- _handleF7Key(event) {
446
+ _handleF7Key(e: KeyboardEvent) {
450
447
  const lastFocusedElement = this._lastFocusedElements[this._getLastFocusedActivePageIndex];
451
448
 
452
- if (event.target === this.getDomRef() && lastFocusedElement) {
449
+ if (e.target === this.getDomRef() && lastFocusedElement) {
453
450
  lastFocusedElement.focus();
454
451
  } else {
455
- this.getDomRef().focus();
452
+ this.getDomRef()!.focus();
456
453
  }
457
454
  }
458
455
 
@@ -482,7 +479,7 @@ class Carousel extends UI5Element {
482
479
  }
483
480
 
484
481
  if (previousSelectedIndex !== this._selectedIndex) {
485
- this.fireEvent("navigate", { selectedIndex: this._selectedIndex });
482
+ this.fireEvent<CarouselNavigateEventDetail>("navigate", { selectedIndex: this._selectedIndex });
486
483
  }
487
484
  }
488
485
 
@@ -502,12 +499,13 @@ class Carousel extends UI5Element {
502
499
  }
503
500
 
504
501
  if (previousSelectedIndex !== this._selectedIndex) {
505
- this.fireEvent("navigate", { selectedIndex: this._selectedIndex });
502
+ this.fireEvent<CarouselNavigateEventDetail>("navigate", { selectedIndex: this._selectedIndex });
506
503
  }
507
504
  }
508
505
 
509
- _navButtonClick(event) {
510
- if (event.target.hasAttribute("arrow-forward")) {
506
+ _navButtonClick(e: MouseEvent) {
507
+ const button = e.target as Button;
508
+ if (button.hasAttribute("arrow-forward")) {
511
509
  this.navigateRight();
512
510
  } else {
513
511
  this.navigateLeft();
@@ -520,9 +518,11 @@ class Carousel extends UI5Element {
520
518
  * Changes the currently displayed page.
521
519
  * @param {Integer} itemIndex The index of the target page
522
520
  * @since 1.0.0-rc.15
521
+ * @method
522
+ * @name sap.ui.webc.main.Carousel#navigateTo
523
523
  * @public
524
524
  */
525
- navigateTo(itemIndex) {
525
+ navigateTo(itemIndex: number) {
526
526
  this._resizing = false;
527
527
  this._selectedIndex = itemIndex;
528
528
  }
@@ -538,17 +538,21 @@ class Carousel extends UI5Element {
538
538
  id: `${this._id}-carousel-item-${idx + 1}`,
539
539
  item,
540
540
  tabIndex: visible ? "0" : "-1",
541
- posinset: idx + 1,
542
- setsize: this.content.length,
541
+ posinset: `${idx + 1}`,
542
+ setsize: `${this.content.length}`,
543
543
  styles: {
544
- width: `${this._itemWidth}px`,
544
+ width: `${this._itemWidth || 0}px`,
545
545
  },
546
546
  classes: visible ? "" : "ui5-carousel-item--hidden",
547
547
  };
548
548
  });
549
549
  }
550
550
 
551
- get effectiveItemsPerPage() {
551
+ get effectiveItemsPerPage(): number {
552
+ if (!this._width) {
553
+ return this.itemsPerPageL;
554
+ }
555
+
552
556
  if (this._width <= 640) {
553
557
  return this.itemsPerPageS;
554
558
  }
@@ -560,11 +564,11 @@ class Carousel extends UI5Element {
560
564
  return this.itemsPerPageL;
561
565
  }
562
566
 
563
- isItemInViewport(index) {
567
+ isItemInViewport(index: number): boolean {
564
568
  return index >= this._selectedIndex && index <= this._selectedIndex + this.effectiveItemsPerPage - 1;
565
569
  }
566
570
 
567
- isIndexInRange(index) {
571
+ isIndexInRange(index: number): boolean {
568
572
  return index >= 0 && index <= this.pagesCount - 1;
569
573
  }
570
574
 
@@ -592,9 +596,10 @@ class Carousel extends UI5Element {
592
596
  }
593
597
 
594
598
  get styles() {
599
+ const items = this._itemWidth || 0;
595
600
  return {
596
601
  content: {
597
- transform: `translateX(${this._isRTL ? "" : "-"}${this._selectedIndex * this._itemWidth}px`,
602
+ transform: `translateX(${this._isRTL ? "" : "-"}${this._selectedIndex * items}px`,
598
603
  },
599
604
  };
600
605
  }
@@ -644,19 +649,19 @@ class Carousel extends UI5Element {
644
649
  for (let index = 0; index < pages; index++) {
645
650
  dots.push({
646
651
  active: index === this._selectedIndex,
647
- ariaLabel: Carousel.i18nBundle.getText(CAROUSEL_DOT_TEXT, index + 1, pages),
652
+ ariaLabel: Carousel.i18nBundle.getText(CAROUSEL_DOT_TEXT as I18nText, index + 1, pages),
648
653
  });
649
654
  }
650
655
 
651
656
  return dots;
652
657
  }
653
658
 
654
- get arrows() {
655
- const showArrows = this._visibleNavigationArrows && this.hasManyPages && isDesktop();
659
+ get showArrows() {
660
+ const displayArrows = this._visibleNavigationArrows && this.hasManyPages && isDesktop();
656
661
 
657
662
  return {
658
- content: !this.hideNavigationArrows && showArrows && this.arrowsPlacement === CarouselArrowsPlacement.Content,
659
- navigation: !this.hideNavigationArrows && showArrows && this.arrowsPlacement === CarouselArrowsPlacement.Navigation,
663
+ content: !this.hideNavigationArrows && displayArrows && this.arrowsPlacement === CarouselArrowsPlacement.Content,
664
+ navigation: !this.hideNavigationArrows && displayArrows && this.arrowsPlacement === CarouselArrowsPlacement.Navigation,
660
665
  };
661
666
  }
662
667
 
@@ -681,7 +686,7 @@ class Carousel extends UI5Element {
681
686
  }
682
687
 
683
688
  get ofText() {
684
- return Carousel.i18nBundle.getText(CAROUSEL_OF_TEXT);
689
+ return Carousel.i18nBundle.getText(CAROUSEL_OF_TEXT as I18nText);
685
690
  }
686
691
 
687
692
  get ariaActiveDescendant() {
@@ -689,11 +694,11 @@ class Carousel extends UI5Element {
689
694
  }
690
695
 
691
696
  get nextPageText() {
692
- return Carousel.i18nBundle.getText(CAROUSEL_NEXT_ARROW_TEXT);
697
+ return Carousel.i18nBundle.getText(CAROUSEL_NEXT_ARROW_TEXT as I18nText);
693
698
  }
694
699
 
695
700
  get previousPageText() {
696
- return Carousel.i18nBundle.getText(CAROUSEL_PREVIOUS_ARROW_TEXT);
701
+ return Carousel.i18nBundle.getText(CAROUSEL_PREVIOUS_ARROW_TEXT as I18nText);
697
702
  }
698
703
 
699
704
  /**
@@ -703,7 +708,7 @@ class Carousel extends UI5Element {
703
708
  * @returns {Integer[]} the indices of the visible items
704
709
  */
705
710
  get visibleItemsIndices() {
706
- const visibleItemsIndices = [];
711
+ const visibleItemsIndices: Array<number> = [];
707
712
 
708
713
  this.items.forEach((item, index) => {
709
714
  if (this.isItemInViewport(index)) {
@@ -729,3 +734,6 @@ class Carousel extends UI5Element {
729
734
  Carousel.define();
730
735
 
731
736
  export default Carousel;
737
+ export type {
738
+ CarouselNavigateEventDetail,
739
+ };
package/src/CheckBox.ts CHANGED
@@ -131,7 +131,7 @@ class CheckBox extends UI5Element implements IFormElement {
131
131
  /**
132
132
  * Defines whether the component is read-only.
133
133
  * <br><br>
134
- * <b>Note:</b> A red-only component is not editable,
134
+ * <b>Note:</b> A read-only component is not editable,
135
135
  * but still provides visual feedback upon user interaction.
136
136
  *
137
137
  * @type {boolean}
@@ -64,7 +64,7 @@ type ColorPaletteItemClickEventDetail = {
64
64
  * @extends sap.ui.webc.base.UI5Element
65
65
  * @tagname ui5-color-palette
66
66
  * @since 1.0.0-rc.12
67
- * @appenddocs ColorPaletteItem
67
+ * @appenddocs sap.ui.webc.main.ColorPaletteItem
68
68
  * @public
69
69
  */
70
70
  @customElement("ui5-color-palette")