@syncfusion/ej2-splitbuttons 27.2.2 → 28.1.37

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 -12
  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, ChildProperty, Property, Component, attributes, getComponent, select, getUniqueID, SanitizeHtmlHelper, detach, removeClass, EventHandler, rippleEffect, isRippleEnabled, closest, classList, Collection, Event, NotifyPropertyChanges, getValue, setValue, remove, KeyboardEvents, getInstance, createElement, Animation, animationMode, Complex } from '@syncfusion/ej2-base';
1
+ import { extend, deleteObject, addClass, isNullOrUndefined, ChildProperty, Property, Component, attributes, getComponent, select, getUniqueID, append, compile, SanitizeHtmlHelper, detach, removeClass, EventHandler, rippleEffect, isRippleEnabled, closest, Animation, formatUnit, classList, Collection, Complex, Event, NotifyPropertyChanges, 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
 
@@ -92,9 +92,9 @@ function isValidLI(ul, li, index, keyCode, count = 0) {
92
92
  }
93
93
  return index;
94
94
  }
95
- // eslint-disable-next-line jsdoc/require-param, valid-jsdoc
96
95
  /** @hidden
97
96
  * @param {HTMLElement} popup - Specifies the popup element.
97
+ * @param {boolean} blankIcon - Specifies the blankIcon value.
98
98
  * @returns {void}
99
99
  */
100
100
  function setBlankIconStyle(popup, blankIcon) {
@@ -130,7 +130,7 @@ function setBlankIconStyle(popup, blankIcon) {
130
130
  let size = `${parseInt(getComputedStyle(icon).fontSize, 10) + parseInt((enableRtl ? getComputedStyle(icon)[cssProp.margin] : getComputedStyle(icon)[cssProp.margin]), 10)
131
131
  + parseInt(getComputedStyle(iconLi).paddingLeft, 10)}px`;
132
132
  blankIconList.forEach((li) => {
133
- if (li.classList.contains('e-url')) {
133
+ if (li.classList.contains('e-url') && li.querySelector('.e-menu-url')) {
134
134
  li.querySelector('.e-menu-url').style[cssProp.padding] = size;
135
135
  }
136
136
  else {
@@ -177,8 +177,23 @@ const classNames = {
177
177
  POPUP: 'e-dropdown-popup',
178
178
  RTL: 'e-rtl',
179
179
  SEPARATOR: 'e-separator',
180
- VERTICAL: 'e-vertical'
180
+ VERTICAL: 'e-vertical',
181
+ POPUPWIDTH: 'e-dropdown-popup-width'
181
182
  };
183
+ /**
184
+ * Animation configuration settings.
185
+ */
186
+ class DropDownMenuAnimationSettings extends ChildProperty {
187
+ }
188
+ __decorate$1([
189
+ Property('SlideDown')
190
+ ], DropDownMenuAnimationSettings.prototype, "effect", void 0);
191
+ __decorate$1([
192
+ Property(400)
193
+ ], DropDownMenuAnimationSettings.prototype, "duration", void 0);
194
+ __decorate$1([
195
+ Property('ease')
196
+ ], DropDownMenuAnimationSettings.prototype, "easing", void 0);
182
197
  /**
183
198
  * DropDownButton component is used to toggle contextual overlays for displaying list of action items.
184
199
  * It can contain both text and images.
@@ -295,11 +310,12 @@ let DropDownButton = class DropDownButton extends Component {
295
310
  }
296
311
  createPopup() {
297
312
  const div = this.createElement('div', {
298
- className: classNames.POPUP,
313
+ className: this.popupWidth !== 'auto' ? `${classNames.POPUP} ${classNames.POPUPWIDTH}` : classNames.POPUP,
299
314
  id: this.element.id + '-popup'
300
315
  });
301
316
  document.body.appendChild(div);
302
317
  this.dropDown = new Popup(div, {
318
+ width: this.popupWidth,
303
319
  relateTo: this.element,
304
320
  collision: { X: 'fit', Y: 'flip' },
305
321
  position: { X: 'left', Y: 'bottom' },
@@ -353,55 +369,82 @@ let DropDownButton = class DropDownButton extends Component {
353
369
  attrs: { 'role': 'menu', 'tabindex': '0' }
354
370
  });
355
371
  }
356
- for (let i = 0; i < items.length; i++) {
357
- item = items[i];
358
- const tempItem = item.text;
359
- li = this.createElement('li', {
360
- innerHTML: item.url ? '' : tempItem,
361
- className: item.separator ? classNames.ITEM + ' ' + classNames.SEPARATOR : classNames.ITEM,
362
- attrs: item.separator ? { 'role': 'separator', 'tabindex': '-1', 'aria-label': 'separator', 'aria-hidden': 'true' } : { 'role': 'menuitem', 'tabindex': '-1', 'aria-label': tempItem },
363
- id: item.id ? item.id : getUniqueID('e-' + this.getModuleName() + '-item')
372
+ if (this.itemTemplate) {
373
+ const compiledTemplate = this.compiletemplate(this.itemTemplate);
374
+ items.forEach((item) => {
375
+ const li = this.createElement('li', {
376
+ className: item.separator ? classNames.ITEM + ' ' + classNames.SEPARATOR : classNames.ITEM,
377
+ attrs: item.separator
378
+ ? { 'role': 'separator', 'tabindex': '-1', 'aria-label': 'separator', 'aria-hidden': 'true' }
379
+ : { 'role': 'menuitem', 'tabindex': '-1', 'aria-label': item.text },
380
+ id: item.id ? item.id : getUniqueID('e-' + this.getModuleName() + '-item')
381
+ });
382
+ const compiledElement = compiledTemplate(item, this, 'template', null, false, null, li);
383
+ if (compiledElement) {
384
+ append(compiledElement, li);
385
+ }
386
+ if (item.disabled) {
387
+ li.classList.add('e-disabled');
388
+ }
389
+ const eventArgs = { item, element: li };
390
+ this.trigger('beforeItemRender', eventArgs);
391
+ if (eventArgs.item.disabled !== item.disabled) {
392
+ li.classList[eventArgs.item.disabled ? 'add' : 'remove']('e-disabled');
393
+ }
394
+ ul.appendChild(li);
364
395
  });
365
- if (this.enableHtmlSanitizer) {
366
- li.textContent = item.url ? '' : tempItem;
367
- }
368
- else {
369
- li.innerHTML = item.url ? '' : tempItem;
370
- }
371
- if (item.url) {
372
- li.appendChild(this.createAnchor(item));
373
- li.classList.add('e-url');
374
- }
375
- if (item.iconCss) {
376
- span = this.createElement('span', { className: classNames.ICON + ' ' + item.iconCss });
377
- if (item.url) {
378
- li.childNodes[0].appendChild(span);
396
+ }
397
+ else {
398
+ for (let i = 0; i < items.length; i++) {
399
+ item = items[i];
400
+ const tempItem = item.text;
401
+ li = this.createElement('li', {
402
+ innerHTML: item.url ? '' : tempItem,
403
+ className: item.separator ? classNames.ITEM + ' ' + classNames.SEPARATOR : classNames.ITEM,
404
+ attrs: item.separator ? { 'role': 'separator', 'tabindex': '-1', 'aria-label': 'separator', 'aria-hidden': 'true' } : { 'role': 'menuitem', 'tabindex': '-1', 'aria-label': tempItem },
405
+ id: item.id ? item.id : getUniqueID('e-' + this.getModuleName() + '-item')
406
+ });
407
+ if (this.enableHtmlSanitizer) {
408
+ li.textContent = item.url ? '' : tempItem;
379
409
  }
380
410
  else {
381
- li.insertBefore(span, li.childNodes[0]);
411
+ li.innerHTML = item.url ? '' : tempItem;
382
412
  }
383
- }
384
- else {
385
- if (showIcon && !item.separator) {
386
- li.classList.add('e-blank-icon');
413
+ if (item.url) {
414
+ li.appendChild(this.createAnchor(item));
415
+ li.classList.add('e-url');
387
416
  }
388
- }
389
- const beforeDisabled = item.disabled;
390
- if (item.disabled) {
391
- li.classList.add('e-disabled');
392
- }
393
- eventArgs = { item: item, element: li };
394
- this.trigger('beforeItemRender', eventArgs);
395
- const afterDisabled = eventArgs.item.disabled;
396
- if (beforeDisabled !== afterDisabled) {
397
- if (eventArgs.item.disabled) {
398
- li.classList.add('e-disabled');
417
+ if (item.iconCss) {
418
+ span = this.createElement('span', { className: classNames.ICON + ' ' + item.iconCss });
419
+ if (item.url) {
420
+ li.childNodes[0].appendChild(span);
421
+ }
422
+ else {
423
+ li.insertBefore(span, li.childNodes[0]);
424
+ }
399
425
  }
400
426
  else {
401
- li.classList.remove('e-disabled');
427
+ if (showIcon && !item.separator) {
428
+ li.classList.add('e-blank-icon');
429
+ }
430
+ }
431
+ const beforeDisabled = item.disabled;
432
+ if (item.disabled) {
433
+ li.classList.add('e-disabled');
434
+ }
435
+ eventArgs = { item: item, element: li };
436
+ this.trigger('beforeItemRender', eventArgs);
437
+ const afterDisabled = eventArgs.item.disabled;
438
+ if (beforeDisabled !== afterDisabled) {
439
+ if (eventArgs.item.disabled) {
440
+ li.classList.add('e-disabled');
441
+ }
442
+ else {
443
+ li.classList.remove('e-disabled');
444
+ }
402
445
  }
446
+ ul.appendChild(li);
403
447
  }
404
- ul.appendChild(li);
405
448
  }
406
449
  if (appendItems) {
407
450
  this.getPopUpElement().appendChild(ul);
@@ -410,6 +453,24 @@ let DropDownButton = class DropDownButton extends Component {
410
453
  setBlankIconStyle(this.getPopUpElement());
411
454
  }
412
455
  }
456
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
457
+ compiletemplate(template) {
458
+ if (!this.itemTemplate) {
459
+ return undefined;
460
+ }
461
+ try {
462
+ if (typeof this.itemTemplate !== 'function') {
463
+ const templateElement = document.querySelector(this.itemTemplate);
464
+ if (templateElement) {
465
+ return compile(templateElement.innerHTML.trim());
466
+ }
467
+ }
468
+ return compile(template);
469
+ }
470
+ catch (_a) {
471
+ return compile(template);
472
+ }
473
+ }
413
474
  hasIcon(items, field) {
414
475
  for (let i = 0, len = items.length; i < len; i++) {
415
476
  if (items[i][`${field}`]) {
@@ -745,6 +806,9 @@ let DropDownButton = class DropDownButton extends Component {
745
806
  }
746
807
  openPopUp(e = null) {
747
808
  const popupElem = this.getPopUpElement();
809
+ if (this.activeElem[0] && this.activeElem[0].classList.contains('e-dropdown-btn') && popupElem.style.width && popupElem.style.width !== 'auto') {
810
+ this.setWidth(popupElem);
811
+ }
748
812
  if (!this.target) {
749
813
  this.createItems(true);
750
814
  }
@@ -779,6 +843,13 @@ let DropDownButton = class DropDownButton extends Component {
779
843
  this.trigger('beforeOpen', beforeOpenArgs, (observedArgs) => {
780
844
  if (!observedArgs.cancel) {
781
845
  const ul = this.getULElement();
846
+ const animationOptions = this.animationSettings.effect !== 'None' ? {
847
+ name: this.animationSettings.effect, duration: this.animationSettings.duration,
848
+ timingFunction: this.animationSettings.easing
849
+ } : null;
850
+ if (animationOptions) {
851
+ this.animatePopup(animationOptions, ul);
852
+ }
782
853
  this.dropDown.show(null, this.element);
783
854
  addClass([this.element], 'e-active');
784
855
  this.element.setAttribute('aria-expanded', 'true');
@@ -809,6 +880,20 @@ let DropDownButton = class DropDownButton extends Component {
809
880
  }
810
881
  });
811
882
  }
883
+ animatePopup(animationOptions, element) {
884
+ new Animation(animationOptions).animate(element, {
885
+ begin: (args) => {
886
+ args.element.parentElement.style.height = args.element.parentElement.offsetHeight + 'px';
887
+ }
888
+ });
889
+ }
890
+ setWidth(popupElem) {
891
+ const width = formatUnit(popupElem.style.width);
892
+ if (width.indexOf('%') > -1) {
893
+ const btnWidth = this.element.offsetWidth * parseFloat(width) / 100;
894
+ popupElem.style.width = `${btnWidth}px`;
895
+ }
896
+ }
812
897
  closePopup(e = null, focusEle) {
813
898
  const ul = this.getULElement();
814
899
  const beforeCloseArgs = { element: ul, items: this.items, event: e, cancel: false };
@@ -982,6 +1067,15 @@ __decorate$1([
982
1067
  __decorate$1([
983
1068
  Property('')
984
1069
  ], DropDownButton.prototype, "closeActionEvents", void 0);
1070
+ __decorate$1([
1071
+ Property(null)
1072
+ ], DropDownButton.prototype, "itemTemplate", void 0);
1073
+ __decorate$1([
1074
+ Property('auto')
1075
+ ], DropDownButton.prototype, "popupWidth", void 0);
1076
+ __decorate$1([
1077
+ Complex({ effect: 'None' }, DropDownMenuAnimationSettings)
1078
+ ], DropDownButton.prototype, "animationSettings", void 0);
985
1079
  __decorate$1([
986
1080
  Event()
987
1081
  ], DropDownButton.prototype, "beforeItemRender", void 0);
@@ -1988,5 +2082,5 @@ ProgressButton = __decorate$3([
1988
2082
  NotifyPropertyChanges
1989
2083
  ], ProgressButton);
1990
2084
 
1991
- export { AnimationSettings, Deferred, DropDownButton, Item, ProgressButton, SpinSettings, SplitButton, createButtonGroup, getModel, setBlankIconStyle, upDownKeyHandler };
2085
+ export { AnimationSettings, Deferred, DropDownButton, DropDownMenuAnimationSettings, Item, ProgressButton, SpinSettings, SplitButton, createButtonGroup, getModel, setBlankIconStyle, upDownKeyHandler };
1992
2086
  //# sourceMappingURL=ej2-splitbuttons.es2015.js.map