@syncfusion/ej2-ribbon 25.2.5 → 26.1.35

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 (112) hide show
  1. package/.eslintrc.json +3 -2
  2. package/dist/ej2-ribbon.umd.min.js +2 -2
  3. package/dist/ej2-ribbon.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-ribbon.es2015.js +821 -592
  5. package/dist/es6/ej2-ribbon.es2015.js.map +1 -1
  6. package/dist/es6/ej2-ribbon.es5.js +812 -577
  7. package/dist/es6/ej2-ribbon.es5.js.map +1 -1
  8. package/dist/global/ej2-ribbon.min.js +2 -2
  9. package/dist/global/ej2-ribbon.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +13 -13
  12. package/src/ribbon/base/interface.d.ts +14 -0
  13. package/src/ribbon/base/ribbon-model.d.ts +1 -1
  14. package/src/ribbon/base/ribbon.d.ts +3 -1
  15. package/src/ribbon/base/ribbon.js +195 -94
  16. package/src/ribbon/items/ribbon-button.js +6 -1
  17. package/src/ribbon/items/ribbon-gallery.d.ts +15 -6
  18. package/src/ribbon/items/ribbon-gallery.js +164 -96
  19. package/src/ribbon/items/ribbon-groupbutton.d.ts +1 -0
  20. package/src/ribbon/items/ribbon-groupbutton.js +11 -3
  21. package/src/ribbon/models/ribbon-contextual-tab-settings-model.d.ts +1 -1
  22. package/src/ribbon/models/ribbon-gallery-group-model.d.ts +5 -5
  23. package/src/ribbon/models/ribbon-gallery-group.d.ts +2 -2
  24. package/src/ribbon/models/ribbon-gallery-group.js +2 -2
  25. package/src/ribbon/models/ribbon-gallery-item-model.d.ts +5 -5
  26. package/src/ribbon/models/ribbon-gallery-item.d.ts +1 -1
  27. package/src/ribbon/models/ribbon-gallery-item.js +1 -1
  28. package/src/ribbon/models/ribbon-gallery-settings-model.d.ts +1 -1
  29. package/src/ribbon/models/ribbon-gallery-settings.d.ts +3 -3
  30. package/src/ribbon/models/ribbon-gallery-settings.js +2 -2
  31. package/src/ribbon/modules/ribbon-backstage.d.ts +6 -3
  32. package/src/ribbon/modules/ribbon-backstage.js +65 -12
  33. package/src/ribbon/modules/ribbon-contextualtab.js +5 -2
  34. package/src/ribbon/modules/ribbon-keytip.d.ts +1 -0
  35. package/src/ribbon/modules/ribbon-keytip.js +58 -46
  36. package/styles/bootstrap-dark.css +452 -269
  37. package/styles/bootstrap-dark.scss +18 -1
  38. package/styles/bootstrap.css +456 -276
  39. package/styles/bootstrap.scss +18 -1
  40. package/styles/bootstrap4.css +455 -272
  41. package/styles/bootstrap4.scss +18 -1
  42. package/styles/bootstrap5-dark.css +470 -278
  43. package/styles/bootstrap5-dark.scss +18 -1
  44. package/styles/bootstrap5.css +470 -278
  45. package/styles/bootstrap5.scss +18 -1
  46. package/styles/fabric-dark.css +451 -269
  47. package/styles/fabric-dark.scss +18 -1
  48. package/styles/fabric.css +450 -272
  49. package/styles/fabric.scss +18 -1
  50. package/styles/fluent-dark.css +472 -277
  51. package/styles/fluent-dark.scss +18 -1
  52. package/styles/fluent.css +472 -277
  53. package/styles/fluent.scss +18 -1
  54. package/styles/fluent2.css +3868 -0
  55. package/styles/fluent2.scss +18 -0
  56. package/styles/highcontrast-light.css +445 -263
  57. package/styles/highcontrast-light.scss +17 -1
  58. package/styles/highcontrast.css +451 -273
  59. package/styles/highcontrast.scss +18 -1
  60. package/styles/material-dark.css +540 -283
  61. package/styles/material-dark.scss +18 -1
  62. package/styles/material.css +539 -289
  63. package/styles/material.scss +18 -1
  64. package/styles/material3-dark.css +496 -280
  65. package/styles/material3-dark.scss +18 -1
  66. package/styles/material3.css +496 -280
  67. package/styles/material3.scss +18 -1
  68. package/styles/ribbon/_bds-definition.scss +56 -20
  69. package/styles/ribbon/_bootstrap-dark-definition.scss +56 -20
  70. package/styles/ribbon/_bootstrap-definition.scss +57 -21
  71. package/styles/ribbon/_bootstrap4-definition.scss +57 -21
  72. package/styles/ribbon/_bootstrap5-definition.scss +57 -21
  73. package/styles/ribbon/_bootstrap5.3-definition.scss +396 -0
  74. package/styles/ribbon/_fabric-dark-definition.scss +55 -19
  75. package/styles/ribbon/_fabric-definition.scss +56 -20
  76. package/styles/ribbon/_fluent-definition.scss +59 -23
  77. package/styles/ribbon/_fluent2-definition.scss +396 -0
  78. package/styles/ribbon/_fusionnew-definition.scss +50 -14
  79. package/styles/ribbon/_highcontrast-definition.scss +58 -22
  80. package/styles/ribbon/_highcontrast-light-definition.scss +49 -13
  81. package/styles/ribbon/_layout.scss +359 -399
  82. package/styles/ribbon/_material-dark-definition.scss +56 -20
  83. package/styles/ribbon/_material-definition.scss +56 -20
  84. package/styles/ribbon/_material3-definition.scss +56 -19
  85. package/styles/ribbon/_tailwind-definition.scss +56 -20
  86. package/styles/ribbon/_theme.scss +118 -170
  87. package/styles/ribbon/bootstrap-dark.css +452 -269
  88. package/styles/ribbon/bootstrap.css +456 -276
  89. package/styles/ribbon/bootstrap4.css +455 -272
  90. package/styles/ribbon/bootstrap5-dark.css +470 -278
  91. package/styles/ribbon/bootstrap5.css +470 -278
  92. package/styles/ribbon/fabric-dark.css +451 -269
  93. package/styles/ribbon/fabric.css +450 -272
  94. package/styles/ribbon/fluent-dark.css +472 -277
  95. package/styles/ribbon/fluent.css +472 -277
  96. package/styles/ribbon/fluent2.css +3868 -0
  97. package/styles/ribbon/fluent2.scss +18 -0
  98. package/styles/ribbon/highcontrast-light.css +445 -263
  99. package/styles/ribbon/highcontrast.css +451 -273
  100. package/styles/ribbon/icons/_bootstrap5.3.scss +9 -0
  101. package/styles/ribbon/icons/_fluent2.scss +9 -0
  102. package/styles/ribbon/material-dark.css +540 -283
  103. package/styles/ribbon/material.css +539 -289
  104. package/styles/ribbon/material3-dark.css +496 -280
  105. package/styles/ribbon/material3.css +496 -280
  106. package/styles/ribbon/tailwind-dark.css +506 -280
  107. package/styles/ribbon/tailwind.css +506 -280
  108. package/styles/tailwind-dark.css +506 -280
  109. package/styles/tailwind-dark.scss +18 -1
  110. package/styles/tailwind.css +506 -280
  111. package/styles/tailwind.scss +18 -1
  112. package/CHANGELOG.md +0 -101
@@ -66,7 +66,12 @@ var RibbonButton = /** @class */ (function () {
66
66
  btnSettings.clicked.call(_this, e);
67
67
  }
68
68
  };
69
- buttonEle.setAttribute('aria-label', btnSettings.content);
69
+ if (btnSettings.content) {
70
+ buttonEle.setAttribute('aria-label', btnSettings.content);
71
+ }
72
+ else {
73
+ buttonEle.setAttribute('aria-label', 'button');
74
+ }
70
75
  };
71
76
  /**
72
77
  * Adds the additional event handlers as the item moved into overflow popup.
@@ -1,6 +1,6 @@
1
1
  import { Ribbon } from '../base/index';
2
2
  import { RibbonItemModel } from '../models/index';
3
- import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
3
+ import { Popup } from '@syncfusion/ej2-popups';
4
4
  /**
5
5
  * Defines the items of Ribbon.
6
6
  */
@@ -9,6 +9,7 @@ export declare class RibbonGallery {
9
9
  private count;
10
10
  private isAdded;
11
11
  private galleryItemsIndex;
12
+ private registeredTemplate;
12
13
  constructor(parent: Ribbon);
13
14
  protected getModuleName(): string;
14
15
  protected destroy(): void;
@@ -26,13 +27,22 @@ export declare class RibbonGallery {
26
27
  /**
27
28
  * Checks the gallery items height.
28
29
  *
29
- * @param {number} selectedTab - Gets the current selected tab.
30
30
  * @param {HTMLElement} activeContent - Gets the current active content.
31
31
  * @returns {void}
32
32
  * @hidden
33
33
  */
34
- checkAvailableHeight(selectedTab: number, activeContent: HTMLElement): void;
35
- private checkCollision;
34
+ checkAvailableHeight(activeContent: HTMLElement): void;
35
+ /**
36
+ * Checks the popup collision.
37
+ *
38
+ * @param {Popup} popup - Gets the popup.
39
+ * @param {HTMLElement} popupEle - Gets the popup element.
40
+ * @param {number} offsetValue - Gets the offset value of gallery popup button.
41
+ * @returns {void}
42
+ * @hidden
43
+ */
44
+ checkCollision(popup: Popup, popupEle: HTMLElement, offsetValue?: number): void;
45
+ private setGalleryPopupHeight;
36
46
  private createPopup;
37
47
  /**
38
48
  * Updates gallery in mode switching.
@@ -48,11 +58,10 @@ export declare class RibbonGallery {
48
58
  *
49
59
  * @param {RibbonItemModel} item - Gets the ribbon item model.
50
60
  * @param {HTMLElement} itemEle - Gets the ribbon item element.
51
- * @param {DropDownButton} overflowButton - Gets the overflow button.
52
61
  * @returns {void}
53
62
  * @hidden
54
63
  */
55
- addOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement, overflowButton: DropDownButton): void;
64
+ addOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement): void;
56
65
  /**
57
66
  * Removes the additional event handlers as the item moved into overflow popup.
58
67
  *
@@ -1,4 +1,4 @@
1
- import { append, getComponent, remove, formatUnit, isNullOrUndefined } from '@syncfusion/ej2-base';
1
+ import { append, getComponent, remove, formatUnit, isNullOrUndefined, setValue } from '@syncfusion/ej2-base';
2
2
  import { getItem, getTemplateFunction, setCustomAttributes } from '../base/index';
3
3
  import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
4
4
  import * as constants from '../base/constant';
@@ -11,7 +11,12 @@ var RibbonGallery = /** @class */ (function () {
11
11
  this.count = 0;
12
12
  this.isAdded = false;
13
13
  this.galleryItemsIndex = 0;
14
+ this.registeredTemplate = {};
14
15
  this.parent = parent;
16
+ var ref = 'viewContainerRef';
17
+ setValue('registeredTemplate', this.registeredTemplate, this);
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
+ setValue(ref, this.parent["" + ref], this);
15
20
  }
16
21
  RibbonGallery.prototype.getModuleName = function () {
17
22
  return 'ribbonGallery';
@@ -35,13 +40,19 @@ var RibbonGallery = /** @class */ (function () {
35
40
  id: item.id + '_popupButton',
36
41
  className: 'e-ribbon-gallery-button e-icons e-drop-icon'
37
42
  });
43
+ buttonEle.setAttribute('aria-label', 'gallerydropdownbutton');
38
44
  itemEle.appendChild(buttonEle);
39
45
  this.createPopup(item, buttonEle);
40
46
  buttonEle.onclick = function (args) {
41
47
  var popupEle = document.querySelector('#' + item.id + '_galleryPopup');
42
48
  if (popupEle) {
43
49
  var popup = getComponent(popupEle, Popup);
44
- popupEle.classList.contains('e-popup-close') ? _this.showPopup(popup, popupEle, args, gallerySettings, item.id) : _this.hidePopup(popup, popupEle, args, gallerySettings, item.id);
50
+ if (popupEle.classList.contains('e-popup-close')) {
51
+ _this.showPopup(popup, popupEle, args, gallerySettings, item.id);
52
+ }
53
+ else {
54
+ _this.hidePopup(popup, popupEle, args, gallerySettings, item.id);
55
+ }
45
56
  }
46
57
  };
47
58
  document.onclick = function (args) {
@@ -97,7 +108,7 @@ var RibbonGallery = /** @class */ (function () {
97
108
  var _loop_2 = function (j) {
98
109
  galleryEle = this_1.parent.createElement('li', {
99
110
  className: 'e-ribbon-gallery-item',
100
- id: galleryContainerEle.id + '_gallery' + j,
111
+ id: (isPopup ? 'popup_' : '') + galleryContainerEle.id + '_gallery' + j,
101
112
  attrs: { 'tabindex': '0' }
102
113
  });
103
114
  var itemEventArgs = { name: 'beforeItemRender', item: gallerySettings.groups[parseInt(i.toString(), 10)].items[parseInt(j.toString(), 10)] };
@@ -116,11 +127,11 @@ var RibbonGallery = /** @class */ (function () {
116
127
  }
117
128
  this_1.count = this_1.count + 1;
118
129
  galleryEle.onclick = function (e) {
119
- _this.setActiveState(e.currentTarget, gallerySettings, id, true, e);
130
+ _this.setActiveState(e.currentTarget, gallerySettings, id, true, e, isPopup);
120
131
  };
121
132
  galleryEle.onkeydown = function (e) {
122
133
  if (e.key === 'Enter' || e.key === ' ') {
123
- _this.setActiveState(e.currentTarget, gallerySettings, id, true, e);
134
+ _this.setActiveState(e.currentTarget, gallerySettings, id, true, e, isPopup);
124
135
  }
125
136
  };
126
137
  galleryEle.onmouseover = function (e) {
@@ -140,9 +151,12 @@ var RibbonGallery = /** @class */ (function () {
140
151
  galleryContainerEle.style.flexFlow = 'wrap';
141
152
  }
142
153
  }
143
- if ((!gallerySettings.template && !gallerySettings.popupTemplate) || ((gallerySettings.template && !gallerySettings.popupTemplate) && isPopup) || ((gallerySettings.popupTemplate && !gallerySettings.template) && !isPopup)) {
154
+ if ((!gallerySettings.template && !gallerySettings.popupTemplate) ||
155
+ ((gallerySettings.template && !gallerySettings.popupTemplate) && isPopup) ||
156
+ ((gallerySettings.popupTemplate && !gallerySettings.template) && !isPopup)) {
144
157
  if (gallerySettings.groups[parseInt(i.toString(), 10)].items[parseInt(j.toString(), 10)].htmlAttributes) {
145
- setCustomAttributes(galleryEle, gallerySettings.groups[parseInt(i.toString(), 10)].items[parseInt(j.toString(), 10)].htmlAttributes);
158
+ setCustomAttributes(galleryEle, gallerySettings.groups[parseInt(i.toString(), 10)]
159
+ .items[parseInt(j.toString(), 10)].htmlAttributes);
146
160
  }
147
161
  if (gallerySettings.groups[parseInt(i.toString(), 10)].items[parseInt(j.toString(), 10)].iconCss) {
148
162
  var iconEle = this_1.parent.createElement('span', {
@@ -186,7 +200,12 @@ var RibbonGallery = /** @class */ (function () {
186
200
  if (this_1.isAdded && !isPopup) {
187
201
  return "break";
188
202
  }
189
- !isPopup ? galleryWrapper.appendChild(galleryContainerEle) : itemEle.appendChild(galleryContainerEle);
203
+ if (!isPopup) {
204
+ galleryWrapper.appendChild(galleryContainerEle);
205
+ }
206
+ else {
207
+ itemEle.appendChild(galleryContainerEle);
208
+ }
190
209
  if (isPopup && gallerySettings.groups[parseInt(i.toString(), 10)].header) {
191
210
  var headerEle = (this_1.parent.createElement('div', {
192
211
  className: 'e-ribbon-gallery-header',
@@ -203,6 +222,14 @@ var RibbonGallery = /** @class */ (function () {
203
222
  }
204
223
  this.count = 0;
205
224
  this.isAdded = false;
225
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
226
+ if (this.parent.isReact) {
227
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
228
+ this.parent.portals = this.parent.portals.concat(this['portals']);
229
+ this.parent['renderReactTemplates']();
230
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
231
+ this['portals'] = undefined;
232
+ }
206
233
  };
207
234
  RibbonGallery.prototype.setWrapperWidth = function (itemCount, galleryWrapper, gallerySettings, itemID) {
208
235
  var count = 1;
@@ -210,74 +237,77 @@ var RibbonGallery = /** @class */ (function () {
210
237
  var isWidthApplied = false;
211
238
  for (var i = 0; i < gallerySettings.groups.length; i++) {
212
239
  for (var j = 0; j < gallerySettings.groups[parseInt(i.toString(), 10)].items.length; j++) {
213
- if (gallerySettings.groups[parseInt(i.toString(), 10)].itemHeight && gallerySettings.groups[parseInt(i.toString(), 10)].itemHeight !== 'auto') {
214
- if (itemCount >= count) {
215
- var galleryItemEle = galleryWrapper.querySelector('#' + itemID + '_galleryContainer' + i + '_gallery' + j);
216
- if (galleryItemEle) {
217
- itemsWidth += galleryItemEle.offsetWidth;
218
- var itemStyles = window.getComputedStyle(galleryItemEle);
219
- if (itemStyles) {
220
- var paddingWidth = parseFloat(itemStyles.paddingLeft) + parseFloat(itemStyles.paddingRight);
221
- if (!(isNullOrUndefined(paddingWidth)))
222
- itemsWidth += paddingWidth;
223
- var marginWidth = parseFloat(itemStyles.marginLeft) + parseFloat(itemStyles.marginRight);
224
- if (!(isNullOrUndefined(marginWidth)))
225
- itemsWidth += marginWidth;
240
+ if (itemCount >= count) {
241
+ var galleryItemEle = galleryWrapper.querySelector('#' + itemID + '_galleryContainer' + i + '_gallery' + j);
242
+ if (galleryItemEle) {
243
+ itemsWidth += galleryItemEle.offsetWidth;
244
+ var itemStyles = window.getComputedStyle(galleryItemEle);
245
+ if (itemStyles) {
246
+ var paddingWidth = parseFloat(itemStyles.paddingLeft) + parseFloat(itemStyles.paddingRight);
247
+ if (!(isNullOrUndefined(paddingWidth))) {
248
+ itemsWidth += paddingWidth;
249
+ }
250
+ var marginWidth = parseFloat(itemStyles.marginLeft) + parseFloat(itemStyles.marginRight);
251
+ if (!(isNullOrUndefined(marginWidth))) {
252
+ itemsWidth += marginWidth;
226
253
  }
227
254
  }
228
255
  }
229
- else {
230
- isWidthApplied = true;
231
- break;
232
- }
233
- count++;
234
256
  }
257
+ else {
258
+ isWidthApplied = true;
259
+ break;
260
+ }
261
+ count++;
235
262
  }
236
263
  if (isWidthApplied) {
237
264
  break;
238
265
  }
239
266
  }
240
- if (itemsWidth > 0)
267
+ if (itemsWidth > 0) {
241
268
  galleryWrapper.style.width = itemsWidth + 'px';
269
+ }
242
270
  };
243
271
  /**
244
272
  * Checks the gallery items height.
245
273
  *
246
- * @param {number} selectedTab - Gets the current selected tab.
247
274
  * @param {HTMLElement} activeContent - Gets the current active content.
248
275
  * @returns {void}
249
276
  * @hidden
250
277
  */
251
- RibbonGallery.prototype.checkAvailableHeight = function (selectedTab, activeContent) {
278
+ RibbonGallery.prototype.checkAvailableHeight = function (activeContent) {
252
279
  var galleryWrapperItems = activeContent.querySelectorAll('.e-ribbon-gallery-wrapper');
253
280
  for (var n = 0; n < galleryWrapperItems.length; n++) {
281
+ var count = 0;
282
+ var simplifiedItemsCount = 0;
254
283
  var isHeight = false;
255
- var itemsCount = 0;
256
284
  var galleryWrapper = galleryWrapperItems[parseInt(n.toString(), 10)];
257
- var galleryWrapperHeight = galleryWrapper.offsetHeight;
258
285
  var itemID = galleryWrapper.id.replace(/_galleryWrapper/g, '');
286
+ var galleryWrapperHeight = galleryWrapper.offsetHeight;
259
287
  var itemProp = getItem(this.parent.tabs, itemID);
260
288
  if (itemProp) {
261
289
  this.setWrapperWidth(itemProp.item.gallerySettings.itemCount, galleryWrapper, itemProp.item.gallerySettings, itemID);
262
290
  for (var i = 0; i < itemProp.item.gallerySettings.groups.length; i++) {
263
- if (itemProp.item.gallerySettings.groups[parseInt(i.toString(), 10)].itemHeight && itemProp.item.gallerySettings.groups[parseInt(i.toString(), 10)].itemHeight !== 'auto') {
264
- for (var j = 0; j < itemProp.item.gallerySettings.groups[parseInt(i.toString(), 10)].items.length; j++) {
265
- var galleryItemEle = galleryWrapper.querySelector('#' + itemID + '_galleryContainer' + i + '_gallery' + j);
266
- if (galleryItemEle) {
267
- itemsCount++;
291
+ for (var j = 0; j < itemProp.item.gallerySettings.groups[parseInt(i.toString(), 10)].items.length; j++) {
292
+ var galleryItemEle = galleryWrapper.querySelector('#' + itemID + '_galleryContainer' + i + '_gallery' + j);
293
+ if (galleryItemEle) {
294
+ if (this.parent.activeLayout === 'Classic') {
295
+ if (galleryItemEle.classList.contains('e-hidden')) {
296
+ galleryItemEle.classList.remove('e-hidden');
297
+ }
268
298
  if (!isHeight) {
269
- if (itemsCount === 1) {
270
- var itemsValues = 0;
271
- var itemStyles = window.getComputedStyle(galleryItemEle);
272
- if (itemStyles) {
273
- var paddingWidth = parseFloat(itemStyles.paddingTop) + parseFloat(itemStyles.paddingBottom);
274
- if (!(isNullOrUndefined(paddingWidth)))
275
- itemsValues += paddingWidth;
276
- var marginWidth = parseFloat(itemStyles.marginTop) + parseFloat(itemStyles.marginBottom);
277
- if (!(isNullOrUndefined(marginWidth)))
278
- itemsValues += marginWidth;
299
+ var itemsValues = 0;
300
+ var itemStyles = window.getComputedStyle(galleryItemEle);
301
+ if (itemStyles) {
302
+ var marginWidth = parseFloat(itemStyles.marginTop) + parseFloat(itemStyles.marginBottom);
303
+ if (!(isNullOrUndefined(marginWidth))) {
304
+ itemsValues += marginWidth;
279
305
  }
280
- if (galleryWrapperHeight > (galleryItemEle.offsetHeight + itemsValues)) {
306
+ }
307
+ count++;
308
+ if (itemProp.item.gallerySettings.itemCount === count) {
309
+ count = 0;
310
+ if (galleryWrapperHeight >= (galleryItemEle.offsetHeight + itemsValues)) {
281
311
  galleryWrapperHeight -= (galleryItemEle.offsetHeight + itemsValues);
282
312
  }
283
313
  else {
@@ -285,30 +315,49 @@ var RibbonGallery = /** @class */ (function () {
285
315
  galleryItemEle.remove();
286
316
  }
287
317
  }
288
- if (itemsCount === itemProp.item.gallerySettings.itemCount) {
289
- itemsCount = 0;
318
+ else if (galleryWrapperHeight < (galleryItemEle.offsetHeight + itemsValues)) {
319
+ isHeight = true;
320
+ galleryItemEle.remove();
290
321
  }
291
322
  }
292
323
  else {
293
324
  galleryItemEle.remove();
294
325
  }
295
326
  }
327
+ else {
328
+ simplifiedItemsCount++;
329
+ if (simplifiedItemsCount > itemProp.item.gallerySettings.itemCount) {
330
+ galleryItemEle.classList.add('e-hidden');
331
+ }
332
+ }
296
333
  }
297
334
  }
298
335
  }
299
336
  }
300
337
  }
301
338
  };
302
- RibbonGallery.prototype.checkCollision = function (popup, popupEle) {
339
+ /**
340
+ * Checks the popup collision.
341
+ *
342
+ * @param {Popup} popup - Gets the popup.
343
+ * @param {HTMLElement} popupEle - Gets the popup element.
344
+ * @param {number} offsetValue - Gets the offset value of gallery popup button.
345
+ * @returns {void}
346
+ * @hidden
347
+ */
348
+ RibbonGallery.prototype.checkCollision = function (popup, popupEle, offsetValue) {
349
+ if (offsetValue === void 0) { offsetValue = 0; }
303
350
  var paddingWidth = 0;
304
351
  var marginWidth = 0;
305
352
  if (popupEle) {
306
- var screenWidth = window.innerWidth;
353
+ var windowWidth = window.innerWidth;
354
+ var screenWidth = offsetValue === 0 ? windowWidth : Math.abs(windowWidth - (windowWidth - offsetValue));
307
355
  var paddingStyles = window.getComputedStyle(popupEle);
308
356
  if (paddingStyles) {
309
357
  paddingWidth = parseFloat(paddingStyles.paddingLeft) + parseFloat(paddingStyles.paddingRight);
310
- if (!(isNullOrUndefined(paddingWidth)))
358
+ if (!(isNullOrUndefined(paddingWidth))) {
311
359
  screenWidth = screenWidth - paddingWidth;
360
+ }
312
361
  }
313
362
  var popupContainerItems = popupEle.querySelectorAll('.e-ribbon-gallery-container');
314
363
  if (popup.width !== 'auto') {
@@ -320,15 +369,16 @@ var RibbonGallery = /** @class */ (function () {
320
369
  for (var i = 0; i < popupContainerItems.length; i++) {
321
370
  var itemsWidth = 0;
322
371
  for (var j = 0; j < popupContainerItems[parseInt(i.toString(), 10)].querySelectorAll('.e-ribbon-gallery-item').length; j++) {
323
- var marginStyles = window.getComputedStyle(popupContainerItems[parseInt(i.toString(), 10)].querySelectorAll('.e-ribbon-gallery-item')[parseInt(j.toString(), 10)]);
324
- if (marginStyles) {
325
- marginWidth = parseFloat(marginStyles.marginLeft) + parseFloat(marginStyles.marginRight);
326
- if (!(isNullOrUndefined(marginWidth)))
372
+ var popupItemStyles = window.getComputedStyle(popupContainerItems[parseInt(i.toString(), 10)].querySelectorAll('.e-ribbon-gallery-item')[parseInt(j.toString(), 10)]);
373
+ if (popupItemStyles) {
374
+ marginWidth = parseFloat(popupItemStyles.marginLeft) + parseFloat(popupItemStyles.marginRight);
375
+ if (!(isNullOrUndefined(marginWidth))) {
327
376
  itemsWidth += marginWidth;
377
+ }
328
378
  }
329
- itemsWidth += popupContainerItems[parseInt(i.toString(), 10)].querySelectorAll('.e-ribbon-gallery-item')[parseInt(j.toString(), 10)].offsetWidth;
379
+ itemsWidth += Math.round(parseFloat(popupItemStyles.width));
330
380
  if (((screenWidth <= itemsWidth) && popup.width === 'auto') || ((popup.width !== 'auto') && (screenWidth <= parseInt(popup.width.toString(), 10)) && (screenWidth <= itemsWidth))) {
331
- popupEle.style.width = ((itemsWidth + Math.abs(paddingWidth - marginWidth)) - popupContainerItems[parseInt(i.toString(), 10)].querySelectorAll('.e-ribbon-gallery-item')[parseInt(j.toString(), 10)].offsetWidth) + 'px';
381
+ popupEle.style.width = ((itemsWidth + Math.abs(paddingWidth - marginWidth)) - Math.round(parseFloat(popupItemStyles.width))) + 'px';
332
382
  isCollideOccurs = true;
333
383
  break;
334
384
  }
@@ -337,6 +387,9 @@ var RibbonGallery = /** @class */ (function () {
337
387
  popupContainerItems.forEach(function (ele) {
338
388
  ele.style.flexFlow = 'wrap';
339
389
  });
390
+ if (popup.height === 'auto') {
391
+ this.setGalleryPopupHeight(popupEle, parseFloat(paddingStyles.height), parseFloat(paddingStyles.top));
392
+ }
340
393
  break;
341
394
  }
342
395
  }
@@ -350,9 +403,20 @@ var RibbonGallery = /** @class */ (function () {
350
403
  else {
351
404
  popupEle.style.width = (popup.width).toString();
352
405
  }
406
+ if (popup.height === 'auto') {
407
+ this.setGalleryPopupHeight(popupEle, parseFloat(paddingStyles.height), parseFloat(paddingStyles.top));
408
+ }
353
409
  }
354
410
  }
355
411
  };
412
+ RibbonGallery.prototype.setGalleryPopupHeight = function (popupEle, popupHeight, popupTop) {
413
+ if (window.innerHeight < popupHeight || window.innerHeight < Math.round(popupHeight + popupTop)) {
414
+ popupEle.style.height = (window.innerHeight - popupTop) + 'px';
415
+ }
416
+ else {
417
+ popupEle.style.height = 'auto';
418
+ }
419
+ };
356
420
  RibbonGallery.prototype.createPopup = function (item, buttonEle) {
357
421
  var popupContainer = this.parent.createElement('div', {
358
422
  className: 'e-ribbon-popup-container',
@@ -387,15 +451,18 @@ var RibbonGallery = /** @class */ (function () {
387
451
  */
388
452
  RibbonGallery.prototype.switchGalleryItems = function (activeLayout, itemID) {
389
453
  var itemEle = this.parent.element.querySelector('#' + itemID + constants.CONTAINER_ID);
390
- var count = 0;
391
454
  var itemProp = getItem(this.parent.tabs, itemID);
392
455
  if (itemEle) {
393
- var galleryWrapper = itemEle.querySelector('.e-ribbon-gallery-wrapper');
394
456
  var galleryIcons = itemEle.querySelectorAll('.e-ribbon-gallery-icons');
395
457
  var galleryContainer = itemEle.querySelectorAll('.e-ribbon-gallery-container');
396
458
  if (galleryIcons.length) {
397
459
  for (var i = 0; i < galleryIcons.length; i++) {
398
- activeLayout === 'Simplified' ? galleryIcons[parseInt(i.toString(), 10)].classList.add('e-hidden') : galleryIcons[parseInt(i.toString(), 10)].classList.remove('e-hidden');
460
+ if (activeLayout === 'Simplified') {
461
+ galleryIcons[parseInt(i.toString(), 10)].classList.add('e-hidden');
462
+ }
463
+ else {
464
+ galleryIcons[parseInt(i.toString(), 10)].classList.remove('e-hidden');
465
+ }
399
466
  }
400
467
  }
401
468
  if (galleryContainer.length && itemProp) {
@@ -403,24 +470,20 @@ var RibbonGallery = /** @class */ (function () {
403
470
  for (var i = 0; i < galleryContainer.length; i++) {
404
471
  if (itemProp.item.gallerySettings.groups[parseInt(n.toString(), 10)].itemHeight && itemProp.item.gallerySettings.groups[parseInt(n.toString(), 10)].itemHeight !== 'auto') {
405
472
  if (itemID + '_galleryContainer' + n === galleryContainer[parseInt(i.toString(), 10)].id) {
406
- activeLayout === 'Simplified' ? galleryContainer[parseInt(i.toString(), 10)].style.flexFlow = 'nowrap' : galleryContainer[parseInt(i.toString(), 10)].style.flexFlow = 'wrap';
473
+ if (activeLayout === 'Simplified') {
474
+ galleryContainer[parseInt(i.toString(), 10)].style.flexFlow = 'nowrap';
475
+ }
476
+ else {
477
+ galleryContainer[parseInt(i.toString(), 10)].style.flexFlow = 'wrap';
478
+ }
407
479
  }
408
480
  }
409
481
  }
410
482
  }
411
483
  }
412
- if (galleryWrapper) {
413
- for (var n = 0; n < itemProp.item.gallerySettings.groups.length; n++) {
414
- for (var i = 0; i < itemProp.item.gallerySettings.groups[parseInt(n.toString(), 10)].items.length; i++) {
415
- count++;
416
- if (count > itemProp.item.gallerySettings.itemCount) {
417
- var galleryItemEle = galleryWrapper.querySelector('#' + itemID + '_galleryContainer' + n + '_gallery' + i);
418
- if (galleryItemEle) {
419
- activeLayout === 'Simplified' ? galleryItemEle.classList.add('e-hidden') : galleryItemEle.classList.remove('e-hidden');
420
- }
421
- }
422
- }
423
- }
484
+ var activeContent = this.parent.tabObj.element.querySelector('#' + this.parent.tabs[this.parent.selectedTab].id + constants.CONTENT_ID);
485
+ if (activeContent) {
486
+ this.checkAvailableHeight(activeContent);
424
487
  }
425
488
  }
426
489
  };
@@ -429,15 +492,14 @@ var RibbonGallery = /** @class */ (function () {
429
492
  *
430
493
  * @param {RibbonItemModel} item - Gets the ribbon item model.
431
494
  * @param {HTMLElement} itemEle - Gets the ribbon item element.
432
- * @param {DropDownButton} overflowButton - Gets the overflow button.
433
495
  * @returns {void}
434
496
  * @hidden
435
497
  */
436
- RibbonGallery.prototype.addOverFlowEvents = function (item, itemEle, overflowButton) {
498
+ RibbonGallery.prototype.addOverFlowEvents = function (item, itemEle) {
437
499
  var _this = this;
438
500
  if (itemEle.closest('.e-ribbon-overflow-target')) {
439
501
  var buttonEle = this.parent.createElement('button', {
440
- id: item.id,
502
+ id: item.id
441
503
  });
442
504
  itemEle.appendChild(buttonEle);
443
505
  itemEle.querySelector('.e-ribbon-gallery-wrapper').classList.add('e-hidden');
@@ -445,8 +507,9 @@ var RibbonGallery = /** @class */ (function () {
445
507
  ele.classList.add('e-hidden');
446
508
  });
447
509
  var popupButton = itemEle.querySelector('#' + item.id + '_popupButton');
448
- if (popupButton)
510
+ if (popupButton) {
449
511
  popupButton.classList.add('e-hidden');
512
+ }
450
513
  var itemProp = getItem(this.parent.tabs, item.id);
451
514
  var iconCss = itemProp && itemProp.group.groupIconCss ? itemProp.group.groupIconCss : '';
452
515
  var content = itemProp && itemProp.group.header ? itemProp.group.header : '';
@@ -466,7 +529,7 @@ var RibbonGallery = /** @class */ (function () {
466
529
  var popupEle = document.querySelector('#' + item.id + '_galleryPopup');
467
530
  var popup = getComponent(popupEle, Popup);
468
531
  var popupContainerEle_1 = document.querySelector('#' + item.id + '_galleryPopup .e-ribbon-popup-container');
469
- var dropdown_1 = new DropDownButton({
532
+ var dropdown = new DropDownButton({
470
533
  iconCss: iconCss,
471
534
  content: content,
472
535
  target: popupContainerEle_1,
@@ -475,7 +538,6 @@ var RibbonGallery = /** @class */ (function () {
475
538
  disabled: item.disabled,
476
539
  open: function () {
477
540
  _this.setFoucsToFirstItem(popupContainerEle_1, true, item.id);
478
- _this.checkCollision(dropdown_1.dropDown, dropdown_1.dropDown.element);
479
541
  },
480
542
  beforeClose: function (args) {
481
543
  var isCancelled = _this.popupEvents(args.event, item.gallerySettings, 'popupClose', false);
@@ -485,11 +547,11 @@ var RibbonGallery = /** @class */ (function () {
485
547
  }
486
548
  }, buttonEle);
487
549
  if (popup.width !== 'auto') {
488
- dropdown_1.dropDown.width = formatUnit(popup.width);
550
+ dropdown.dropDown.width = formatUnit(popup.width);
489
551
  }
490
552
  if (popup.height !== 'auto') {
491
- dropdown_1.dropDown.height = formatUnit(popup.height);
492
- dropdown_1.dropDown.element.style.height = (popup.height).toString();
553
+ dropdown.dropDown.height = formatUnit(popup.height);
554
+ dropdown.dropDown.element.style.height = (popup.height).toString();
493
555
  }
494
556
  }
495
557
  };
@@ -519,7 +581,7 @@ var RibbonGallery = /** @class */ (function () {
519
581
  remove(galleryDDBEle);
520
582
  }
521
583
  };
522
- RibbonGallery.prototype.setActiveState = function (galleryEle, gallerySettings, itemID, isInteracted, event) {
584
+ RibbonGallery.prototype.setActiveState = function (galleryEle, gallerySettings, itemID, isInteracted, event, isPopup) {
523
585
  var previousItem;
524
586
  var currentItem;
525
587
  var itemEle = document.querySelector('#' + itemID + constants.CONTAINER_ID);
@@ -534,12 +596,13 @@ var RibbonGallery = /** @class */ (function () {
534
596
  if (selctedGalleryItem[0].id === itemID + '_galleryContainer' + i + '_gallery' + j) {
535
597
  previousItem = gallerySettings.groups[parseInt(i.toString(), 10)].items[parseInt(j.toString(), 10)];
536
598
  }
537
- if (galleryEle.id === itemID + '_galleryContainer' + i + '_gallery' + j) {
599
+ if (galleryEle.id === (isPopup ? 'popup_' : '') + itemID + '_galleryContainer' + i + '_gallery' + j) {
538
600
  currentItem = gallerySettings.groups[parseInt(i.toString(), 10)].items[parseInt(j.toString(), 10)];
539
601
  }
540
602
  }
541
603
  }
542
- var galleryItem = document.querySelectorAll('#' + galleryEle.id);
604
+ var galleryItem = document.getElementById(galleryEle.id);
605
+ var galleryItemPopup;
543
606
  var selectingEventArgs = { cancel: false, name: 'beforeSelect', previousItem: previousItem, currentItem: currentItem, isInteracted: isInteracted, event: event };
544
607
  if (gallerySettings.beforeSelect) {
545
608
  gallerySettings.beforeSelect.call(this, selectingEventArgs);
@@ -551,9 +614,16 @@ var RibbonGallery = /** @class */ (function () {
551
614
  for (var i = 0; i < selctedGalleryItem.length; i++) {
552
615
  selctedGalleryItem[parseInt(i.toString(), 10)].classList.remove('e-ribbon-gallery-selected');
553
616
  }
554
- for (var i = 0; i < galleryItem.length; i++) {
555
- galleryItem[parseInt(i.toString(), 10)].classList.add('e-ribbon-gallery-selected');
617
+ if (!galleryItem.id.startsWith('popup_')) {
618
+ galleryItemPopup = document.getElementById('popup_' + galleryEle.id);
619
+ }
620
+ else if (document.getElementById(galleryItem.id.slice(6))) {
621
+ galleryItemPopup = document.getElementById(galleryItem.id.slice(6));
556
622
  }
623
+ if (galleryItemPopup) {
624
+ galleryItemPopup.classList.add('e-ribbon-gallery-selected');
625
+ }
626
+ galleryItem.classList.add('e-ribbon-gallery-selected');
557
627
  var selectedEventArgs = { previousItem: previousItem, currentItem: currentItem, name: 'select', isInteracted: isInteracted, event: event };
558
628
  var galleryPopupItems = document.querySelectorAll('#' + itemID + '_popupContainer .e-ribbon-gallery-item');
559
629
  for (var i = 0; i < galleryPopupItems.length; i++) {
@@ -590,6 +660,9 @@ var RibbonGallery = /** @class */ (function () {
590
660
  var buttonEle = document.querySelector('#' + itemID + '_popupButton');
591
661
  buttonEle.classList.add('e-gallery-button-active');
592
662
  var buttonPosition = buttonEle.getBoundingClientRect();
663
+ if (popupEle.offsetWidth > buttonPosition.left) {
664
+ this.checkCollision(popup, popupEle, buttonPosition.left);
665
+ }
593
666
  var offsetX = Math.abs((popupEle.offsetWidth - buttonPosition.left)) + buttonEle.offsetWidth;
594
667
  popupEle.style.left = offsetX + 'px';
595
668
  popupEle.style.top = popupEle.getBoundingClientRect().top + 2 + 'px';
@@ -671,10 +744,7 @@ var RibbonGallery = /** @class */ (function () {
671
744
  galleryPopupEle[this.galleryItemsIndex].focus();
672
745
  }
673
746
  }
674
- else if (e.key === 'Enter' || e.code === 'Space') {
675
- galleryPopupEle[this.galleryItemsIndex].click();
676
- }
677
- else if (e.key === 'Escape' && !isDropdown) {
747
+ else if ((e.key === 'Enter' || e.code === 'Space') || (e.key === 'Escape' && !isDropdown)) {
678
748
  this.hidePopup(popup, popupEle, e, gallerySettings, itemID);
679
749
  }
680
750
  }
@@ -690,8 +760,7 @@ var RibbonGallery = /** @class */ (function () {
690
760
  if (items.cssClass) {
691
761
  galleryItemEle.classList.add(items.cssClass);
692
762
  }
693
- append(templateFunction({ items: items }, this, templateName, (id + 'galleryTemplate'), this.parent.isStringTemplate), galleryItemEle);
694
- this.parent['renderReactTemplates']();
763
+ append(templateFunction({ items: items }, this, templateName, (id + 'galleryTemplate'), this.parent.isStringTemplate, null, null, this.parent), galleryItemEle);
695
764
  };
696
765
  RibbonGallery.prototype.createGalleryPopupTemplate = function (galleryItemEle, gallerySettings, id, items) {
697
766
  galleryItemEle.classList.add('e-ribbon-gallery-popup-template');
@@ -704,8 +773,7 @@ var RibbonGallery = /** @class */ (function () {
704
773
  if (items.cssClass) {
705
774
  galleryItemEle.classList.add(items.cssClass);
706
775
  }
707
- append(templateFunction({ items: items }, this, templateName, (id + 'galleryPopupTemplate'), this.parent.isStringTemplate), galleryItemEle);
708
- this.parent['renderReactTemplates']();
776
+ append(templateFunction({ items: items }, this, templateName, (id + 'galleryPopupTemplate'), this.parent.isStringTemplate, null, null, this.parent), galleryItemEle);
709
777
  };
710
778
  return RibbonGallery;
711
779
  }());
@@ -39,6 +39,7 @@ export declare class RibbonGroupButton {
39
39
  *
40
40
  * @param {RibbonItemModel} item - Gets the ribbon item model.
41
41
  * @param {HTMLElement} itemEle - Gets the ribbon item element.
42
+ * @param {DropDownButton} overflowButton - Gets the overflow button.
42
43
  * @returns {void}
43
44
  * @hidden
44
45
  */