@syncfusion/ej2-splitbuttons 27.2.2 → 28.1.33

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/README.md +4 -4
  2. package/dist/ej2-splitbuttons.min.js +3 -3
  3. package/dist/ej2-splitbuttons.umd.min.js +3 -3
  4. package/dist/ej2-splitbuttons.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-splitbuttons.es2015.js +140 -46
  6. package/dist/es6/ej2-splitbuttons.es2015.js.map +1 -1
  7. package/dist/es6/ej2-splitbuttons.es5.js +146 -46
  8. package/dist/es6/ej2-splitbuttons.es5.js.map +1 -1
  9. package/dist/global/ej2-splitbuttons.min.js +3 -3
  10. package/dist/global/ej2-splitbuttons.min.js.map +1 -1
  11. package/dist/global/index.d.ts +2 -2
  12. package/package.json +8 -8
  13. package/src/common/common.d.ts +5 -0
  14. package/src/common/common.js +2 -2
  15. package/src/drop-down-button/drop-down-button-model.d.ts +63 -1
  16. package/src/drop-down-button/drop-down-button.d.ts +60 -3
  17. package/src/drop-down-button/drop-down-button.js +146 -45
  18. package/styles/bds-lite.css +1937 -0
  19. package/styles/bds-lite.scss +13 -0
  20. package/styles/bds.css +2148 -0
  21. package/styles/bds.scss +17 -0
  22. package/styles/bootstrap-dark-lite.css +11 -0
  23. package/styles/bootstrap-dark.css +11 -1
  24. package/styles/bootstrap-lite.css +11 -0
  25. package/styles/bootstrap.css +11 -1
  26. package/styles/bootstrap4-lite.css +11 -0
  27. package/styles/bootstrap4.css +11 -1
  28. package/styles/bootstrap5-dark-lite.css +11 -0
  29. package/styles/bootstrap5-dark.css +11 -1
  30. package/styles/bootstrap5-lite.css +11 -0
  31. package/styles/bootstrap5.3-lite.css +11 -0
  32. package/styles/bootstrap5.3.css +11 -1
  33. package/styles/bootstrap5.css +11 -1
  34. package/styles/button-group/_group-button-mixin.scss +2 -2
  35. package/styles/button-group/_layout.scss +1 -1
  36. package/styles/button-group/_tailwind3-definition.scss +31 -0
  37. package/styles/button-group/_theme.scss +83 -12
  38. package/styles/button-group/bds.css +861 -0
  39. package/styles/button-group/bds.scss +5 -0
  40. package/styles/button-group/tailwind3.css +847 -0
  41. package/styles/button-group/tailwind3.scss +5 -0
  42. package/styles/drop-down-button/_bigger.scss +20 -0
  43. package/styles/drop-down-button/_layout.scss +36 -3
  44. package/styles/drop-down-button/_tailwind3-definition.scss +53 -0
  45. package/styles/drop-down-button/_theme.scss +7 -0
  46. package/styles/drop-down-button/bds.css +372 -0
  47. package/styles/drop-down-button/bds.scss +7 -0
  48. package/styles/drop-down-button/bootstrap-dark.css +11 -1
  49. package/styles/drop-down-button/bootstrap.css +11 -1
  50. package/styles/drop-down-button/bootstrap4.css +11 -1
  51. package/styles/drop-down-button/bootstrap5-dark.css +11 -1
  52. package/styles/drop-down-button/bootstrap5.3.css +11 -1
  53. package/styles/drop-down-button/bootstrap5.css +11 -1
  54. package/styles/drop-down-button/fabric-dark.css +11 -1
  55. package/styles/drop-down-button/fabric.css +11 -1
  56. package/styles/drop-down-button/fluent-dark.css +11 -1
  57. package/styles/drop-down-button/fluent.css +11 -1
  58. package/styles/drop-down-button/fluent2.css +11 -1
  59. package/styles/drop-down-button/highcontrast-light.css +11 -1
  60. package/styles/drop-down-button/highcontrast.css +11 -1
  61. package/styles/drop-down-button/icons/_tailwind3.scss +10 -0
  62. package/styles/drop-down-button/material-dark.css +11 -1
  63. package/styles/drop-down-button/material.css +11 -1
  64. package/styles/drop-down-button/material3-dark.css +11 -1
  65. package/styles/drop-down-button/material3.css +11 -1
  66. package/styles/drop-down-button/tailwind-dark.css +11 -1
  67. package/styles/drop-down-button/tailwind.css +11 -1
  68. package/styles/drop-down-button/tailwind3.css +295 -0
  69. package/styles/drop-down-button/tailwind3.scss +7 -0
  70. package/styles/fabric-dark-lite.css +11 -0
  71. package/styles/fabric-dark.css +11 -1
  72. package/styles/fabric-lite.css +11 -0
  73. package/styles/fabric.css +11 -1
  74. package/styles/fluent-dark-lite.css +11 -0
  75. package/styles/fluent-dark.css +11 -1
  76. package/styles/fluent-lite.css +11 -0
  77. package/styles/fluent.css +11 -1
  78. package/styles/fluent2-lite.css +11 -0
  79. package/styles/fluent2.css +11 -1
  80. package/styles/highcontrast-light-lite.css +11 -0
  81. package/styles/highcontrast-light.css +11 -1
  82. package/styles/highcontrast-lite.css +11 -0
  83. package/styles/highcontrast.css +11 -1
  84. package/styles/material-dark-lite.css +11 -0
  85. package/styles/material-dark.css +11 -1
  86. package/styles/material-lite.css +11 -0
  87. package/styles/material.css +11 -1
  88. package/styles/material3-dark-lite.css +11 -0
  89. package/styles/material3-dark.css +11 -1
  90. package/styles/material3-lite.css +11 -0
  91. package/styles/material3.css +11 -1
  92. package/styles/progress-button/_tailwind3-definition.scss +20 -0
  93. package/styles/progress-button/_theme.scss +70 -0
  94. package/styles/progress-button/bds.css +683 -0
  95. package/styles/progress-button/bds.scss +6 -0
  96. package/styles/progress-button/tailwind3.css +636 -0
  97. package/styles/progress-button/tailwind3.scss +6 -0
  98. package/styles/split-button/_layout.scss +2 -2
  99. package/styles/split-button/_tailwind3-definition.scss +23 -0
  100. package/styles/split-button/_theme.scss +6 -1
  101. package/styles/split-button/bds.css +461 -0
  102. package/styles/split-button/bds.scss +7 -0
  103. package/styles/split-button/tailwind3.css +342 -0
  104. package/styles/split-button/tailwind3.scss +7 -0
  105. package/styles/tailwind-dark-lite.css +11 -0
  106. package/styles/tailwind-dark.css +11 -1
  107. package/styles/tailwind-lite.css +11 -0
  108. package/styles/tailwind.css +11 -1
  109. package/styles/tailwind3-lite.css +1891 -0
  110. package/styles/tailwind3-lite.scss +13 -0
  111. package/styles/tailwind3.css +2110 -0
  112. package/styles/tailwind3.scss +17 -0
@@ -1,4 +1,4 @@
1
- import { extend, deleteObject, addClass, isNullOrUndefined, Property, ChildProperty, attributes, getComponent, select, getUniqueID, SanitizeHtmlHelper, detach, removeClass, EventHandler, rippleEffect, isRippleEnabled, closest, classList, Collection, Event, NotifyPropertyChanges, Component, getValue, setValue, remove, KeyboardEvents, getInstance, createElement, Animation, animationMode, Complex } from '@syncfusion/ej2-base';
1
+ import { extend, deleteObject, addClass, isNullOrUndefined, Property, ChildProperty, attributes, getComponent, select, getUniqueID, append, compile, SanitizeHtmlHelper, detach, removeClass, EventHandler, rippleEffect, isRippleEnabled, closest, Animation, formatUnit, classList, Collection, Complex, Event, NotifyPropertyChanges, Component, getValue, setValue, remove, KeyboardEvents, getInstance, createElement, animationMode } from '@syncfusion/ej2-base';
2
2
  import { Button } from '@syncfusion/ej2-buttons';
3
3
  import { Popup, createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';
4
4
 
@@ -107,9 +107,9 @@ function isValidLI(ul, li, index, keyCode, count) {
107
107
  }
108
108
  return index;
109
109
  }
110
- // eslint-disable-next-line jsdoc/require-param, valid-jsdoc
111
110
  /** @hidden
112
111
  * @param {HTMLElement} popup - Specifies the popup element.
112
+ * @param {boolean} blankIcon - Specifies the blankIcon value.
113
113
  * @returns {void}
114
114
  */
115
115
  function setBlankIconStyle(popup, blankIcon) {
@@ -145,7 +145,7 @@ function setBlankIconStyle(popup, blankIcon) {
145
145
  var size = parseInt(getComputedStyle(icon).fontSize, 10) + parseInt((enableRtl ? getComputedStyle(icon)[cssProp.margin] : getComputedStyle(icon)[cssProp.margin]), 10)
146
146
  + parseInt(getComputedStyle(iconLi).paddingLeft, 10) + "px";
147
147
  blankIconList.forEach(function (li) {
148
- if (li.classList.contains('e-url')) {
148
+ if (li.classList.contains('e-url') && li.querySelector('.e-menu-url')) {
149
149
  li.querySelector('.e-menu-url').style[cssProp.padding] = size;
150
150
  }
151
151
  else {
@@ -210,8 +210,28 @@ var classNames = {
210
210
  POPUP: 'e-dropdown-popup',
211
211
  RTL: 'e-rtl',
212
212
  SEPARATOR: 'e-separator',
213
- VERTICAL: 'e-vertical'
213
+ VERTICAL: 'e-vertical',
214
+ POPUPWIDTH: 'e-dropdown-popup-width'
214
215
  };
216
+ /**
217
+ * Animation configuration settings.
218
+ */
219
+ var DropDownMenuAnimationSettings = /** @__PURE__ @class */ (function (_super) {
220
+ __extends$1(DropDownMenuAnimationSettings, _super);
221
+ function DropDownMenuAnimationSettings() {
222
+ return _super !== null && _super.apply(this, arguments) || this;
223
+ }
224
+ __decorate$1([
225
+ Property('SlideDown')
226
+ ], DropDownMenuAnimationSettings.prototype, "effect", void 0);
227
+ __decorate$1([
228
+ Property(400)
229
+ ], DropDownMenuAnimationSettings.prototype, "duration", void 0);
230
+ __decorate$1([
231
+ Property('ease')
232
+ ], DropDownMenuAnimationSettings.prototype, "easing", void 0);
233
+ return DropDownMenuAnimationSettings;
234
+ }(ChildProperty));
215
235
  /**
216
236
  * DropDownButton component is used to toggle contextual overlays for displaying list of action items.
217
237
  * It can contain both text and images.
@@ -331,11 +351,12 @@ var DropDownButton = /** @__PURE__ @class */ (function (_super) {
331
351
  DropDownButton.prototype.createPopup = function () {
332
352
  var _a;
333
353
  var div = this.createElement('div', {
334
- className: classNames.POPUP,
354
+ className: this.popupWidth !== 'auto' ? classNames.POPUP + " " + classNames.POPUPWIDTH : classNames.POPUP,
335
355
  id: this.element.id + '-popup'
336
356
  });
337
357
  document.body.appendChild(div);
338
358
  this.dropDown = new Popup(div, {
359
+ width: this.popupWidth,
339
360
  relateTo: this.element,
340
361
  collision: { X: 'fit', Y: 'flip' },
341
362
  position: { X: 'left', Y: 'bottom' },
@@ -375,6 +396,7 @@ var DropDownButton = /** @__PURE__ @class */ (function (_super) {
375
396
  return typeof (this.target) === 'string' ? select(this.target) : this.target;
376
397
  };
377
398
  DropDownButton.prototype.createItems = function (appendItems) {
399
+ var _this = this;
378
400
  var items = this.items;
379
401
  var showIcon = this.hasIcon(this.items, 'iconCss');
380
402
  var span;
@@ -390,55 +412,82 @@ var DropDownButton = /** @__PURE__ @class */ (function (_super) {
390
412
  attrs: { 'role': 'menu', 'tabindex': '0' }
391
413
  });
392
414
  }
393
- for (var i = 0; i < items.length; i++) {
394
- item = items[i];
395
- var tempItem = item.text;
396
- li = this.createElement('li', {
397
- innerHTML: item.url ? '' : tempItem,
398
- className: item.separator ? classNames.ITEM + ' ' + classNames.SEPARATOR : classNames.ITEM,
399
- attrs: item.separator ? { 'role': 'separator', 'tabindex': '-1', 'aria-label': 'separator', 'aria-hidden': 'true' } : { 'role': 'menuitem', 'tabindex': '-1', 'aria-label': tempItem },
400
- id: item.id ? item.id : getUniqueID('e-' + this.getModuleName() + '-item')
415
+ if (this.itemTemplate) {
416
+ var compiledTemplate_1 = this.compiletemplate(this.itemTemplate);
417
+ items.forEach(function (item) {
418
+ var li = _this.createElement('li', {
419
+ className: item.separator ? classNames.ITEM + ' ' + classNames.SEPARATOR : classNames.ITEM,
420
+ attrs: item.separator
421
+ ? { 'role': 'separator', 'tabindex': '-1', 'aria-label': 'separator', 'aria-hidden': 'true' }
422
+ : { 'role': 'menuitem', 'tabindex': '-1', 'aria-label': item.text },
423
+ id: item.id ? item.id : getUniqueID('e-' + _this.getModuleName() + '-item')
424
+ });
425
+ var compiledElement = compiledTemplate_1(item, _this, 'template', null, false, null, li);
426
+ if (compiledElement) {
427
+ append(compiledElement, li);
428
+ }
429
+ if (item.disabled) {
430
+ li.classList.add('e-disabled');
431
+ }
432
+ var eventArgs = { item: item, element: li };
433
+ _this.trigger('beforeItemRender', eventArgs);
434
+ if (eventArgs.item.disabled !== item.disabled) {
435
+ li.classList[eventArgs.item.disabled ? 'add' : 'remove']('e-disabled');
436
+ }
437
+ ul.appendChild(li);
401
438
  });
402
- if (this.enableHtmlSanitizer) {
403
- li.textContent = item.url ? '' : tempItem;
404
- }
405
- else {
406
- li.innerHTML = item.url ? '' : tempItem;
407
- }
408
- if (item.url) {
409
- li.appendChild(this.createAnchor(item));
410
- li.classList.add('e-url');
411
- }
412
- if (item.iconCss) {
413
- span = this.createElement('span', { className: classNames.ICON + ' ' + item.iconCss });
414
- if (item.url) {
415
- li.childNodes[0].appendChild(span);
439
+ }
440
+ else {
441
+ for (var i = 0; i < items.length; i++) {
442
+ item = items[i];
443
+ var tempItem = item.text;
444
+ li = this.createElement('li', {
445
+ innerHTML: item.url ? '' : tempItem,
446
+ className: item.separator ? classNames.ITEM + ' ' + classNames.SEPARATOR : classNames.ITEM,
447
+ attrs: item.separator ? { 'role': 'separator', 'tabindex': '-1', 'aria-label': 'separator', 'aria-hidden': 'true' } : { 'role': 'menuitem', 'tabindex': '-1', 'aria-label': tempItem },
448
+ id: item.id ? item.id : getUniqueID('e-' + this.getModuleName() + '-item')
449
+ });
450
+ if (this.enableHtmlSanitizer) {
451
+ li.textContent = item.url ? '' : tempItem;
416
452
  }
417
453
  else {
418
- li.insertBefore(span, li.childNodes[0]);
454
+ li.innerHTML = item.url ? '' : tempItem;
419
455
  }
420
- }
421
- else {
422
- if (showIcon && !item.separator) {
423
- li.classList.add('e-blank-icon');
456
+ if (item.url) {
457
+ li.appendChild(this.createAnchor(item));
458
+ li.classList.add('e-url');
424
459
  }
425
- }
426
- var beforeDisabled = item.disabled;
427
- if (item.disabled) {
428
- li.classList.add('e-disabled');
429
- }
430
- eventArgs = { item: item, element: li };
431
- this.trigger('beforeItemRender', eventArgs);
432
- var afterDisabled = eventArgs.item.disabled;
433
- if (beforeDisabled !== afterDisabled) {
434
- if (eventArgs.item.disabled) {
435
- li.classList.add('e-disabled');
460
+ if (item.iconCss) {
461
+ span = this.createElement('span', { className: classNames.ICON + ' ' + item.iconCss });
462
+ if (item.url) {
463
+ li.childNodes[0].appendChild(span);
464
+ }
465
+ else {
466
+ li.insertBefore(span, li.childNodes[0]);
467
+ }
436
468
  }
437
469
  else {
438
- li.classList.remove('e-disabled');
470
+ if (showIcon && !item.separator) {
471
+ li.classList.add('e-blank-icon');
472
+ }
473
+ }
474
+ var beforeDisabled = item.disabled;
475
+ if (item.disabled) {
476
+ li.classList.add('e-disabled');
439
477
  }
478
+ eventArgs = { item: item, element: li };
479
+ this.trigger('beforeItemRender', eventArgs);
480
+ var afterDisabled = eventArgs.item.disabled;
481
+ if (beforeDisabled !== afterDisabled) {
482
+ if (eventArgs.item.disabled) {
483
+ li.classList.add('e-disabled');
484
+ }
485
+ else {
486
+ li.classList.remove('e-disabled');
487
+ }
488
+ }
489
+ ul.appendChild(li);
440
490
  }
441
- ul.appendChild(li);
442
491
  }
443
492
  if (appendItems) {
444
493
  this.getPopUpElement().appendChild(ul);
@@ -447,6 +496,24 @@ var DropDownButton = /** @__PURE__ @class */ (function (_super) {
447
496
  setBlankIconStyle(this.getPopUpElement());
448
497
  }
449
498
  };
499
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
500
+ DropDownButton.prototype.compiletemplate = function (template) {
501
+ if (!this.itemTemplate) {
502
+ return undefined;
503
+ }
504
+ try {
505
+ if (typeof this.itemTemplate !== 'function') {
506
+ var templateElement = document.querySelector(this.itemTemplate);
507
+ if (templateElement) {
508
+ return compile(templateElement.innerHTML.trim());
509
+ }
510
+ }
511
+ return compile(template);
512
+ }
513
+ catch (_a) {
514
+ return compile(template);
515
+ }
516
+ };
450
517
  DropDownButton.prototype.hasIcon = function (items, field) {
451
518
  for (var i = 0, len = items.length; i < len; i++) {
452
519
  if (items[i]["" + field]) {
@@ -785,6 +852,9 @@ var DropDownButton = /** @__PURE__ @class */ (function (_super) {
785
852
  var _this = this;
786
853
  if (e === void 0) { e = null; }
787
854
  var popupElem = this.getPopUpElement();
855
+ if (this.activeElem[0] && this.activeElem[0].classList.contains('e-dropdown-btn') && popupElem.style.width && popupElem.style.width !== 'auto') {
856
+ this.setWidth(popupElem);
857
+ }
788
858
  if (!this.target) {
789
859
  this.createItems(true);
790
860
  }
@@ -819,6 +889,13 @@ var DropDownButton = /** @__PURE__ @class */ (function (_super) {
819
889
  this.trigger('beforeOpen', beforeOpenArgs, function (observedArgs) {
820
890
  if (!observedArgs.cancel) {
821
891
  var ul_1 = _this.getULElement();
892
+ var animationOptions = _this.animationSettings.effect !== 'None' ? {
893
+ name: _this.animationSettings.effect, duration: _this.animationSettings.duration,
894
+ timingFunction: _this.animationSettings.easing
895
+ } : null;
896
+ if (animationOptions) {
897
+ _this.animatePopup(animationOptions, ul_1);
898
+ }
822
899
  _this.dropDown.show(null, _this.element);
823
900
  addClass([_this.element], 'e-active');
824
901
  _this.element.setAttribute('aria-expanded', 'true');
@@ -849,6 +926,20 @@ var DropDownButton = /** @__PURE__ @class */ (function (_super) {
849
926
  }
850
927
  });
851
928
  };
929
+ DropDownButton.prototype.animatePopup = function (animationOptions, element) {
930
+ new Animation(animationOptions).animate(element, {
931
+ begin: function (args) {
932
+ args.element.parentElement.style.height = args.element.parentElement.offsetHeight + 'px';
933
+ }
934
+ });
935
+ };
936
+ DropDownButton.prototype.setWidth = function (popupElem) {
937
+ var width = formatUnit(popupElem.style.width);
938
+ if (width.indexOf('%') > -1) {
939
+ var btnWidth = this.element.offsetWidth * parseFloat(width) / 100;
940
+ popupElem.style.width = btnWidth + "px";
941
+ }
942
+ };
852
943
  DropDownButton.prototype.closePopup = function (e, focusEle) {
853
944
  var _this = this;
854
945
  if (e === void 0) { e = null; }
@@ -1024,6 +1115,15 @@ var DropDownButton = /** @__PURE__ @class */ (function (_super) {
1024
1115
  __decorate$1([
1025
1116
  Property('')
1026
1117
  ], DropDownButton.prototype, "closeActionEvents", void 0);
1118
+ __decorate$1([
1119
+ Property(null)
1120
+ ], DropDownButton.prototype, "itemTemplate", void 0);
1121
+ __decorate$1([
1122
+ Property('auto')
1123
+ ], DropDownButton.prototype, "popupWidth", void 0);
1124
+ __decorate$1([
1125
+ Complex({ effect: 'None' }, DropDownMenuAnimationSettings)
1126
+ ], DropDownButton.prototype, "animationSettings", void 0);
1027
1127
  __decorate$1([
1028
1128
  Event()
1029
1129
  ], DropDownButton.prototype, "beforeItemRender", void 0);
@@ -2084,5 +2184,5 @@ var ProgressButton = /** @__PURE__ @class */ (function (_super) {
2084
2184
  return ProgressButton;
2085
2185
  }(Button));
2086
2186
 
2087
- export { AnimationSettings, Deferred, DropDownButton, Item, ProgressButton, SpinSettings, SplitButton, createButtonGroup, getModel, setBlankIconStyle, upDownKeyHandler };
2187
+ export { AnimationSettings, Deferred, DropDownButton, DropDownMenuAnimationSettings, Item, ProgressButton, SpinSettings, SplitButton, createButtonGroup, getModel, setBlankIconStyle, upDownKeyHandler };
2088
2188
  //# sourceMappingURL=ej2-splitbuttons.es5.js.map