@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.
- package/README.md +4 -4
- package/dist/ej2-splitbuttons.min.js +3 -3
- package/dist/ej2-splitbuttons.umd.min.js +3 -3
- package/dist/ej2-splitbuttons.umd.min.js.map +1 -1
- package/dist/es6/ej2-splitbuttons.es2015.js +140 -46
- package/dist/es6/ej2-splitbuttons.es2015.js.map +1 -1
- package/dist/es6/ej2-splitbuttons.es5.js +146 -46
- package/dist/es6/ej2-splitbuttons.es5.js.map +1 -1
- package/dist/global/ej2-splitbuttons.min.js +3 -3
- package/dist/global/ej2-splitbuttons.min.js.map +1 -1
- package/dist/global/index.d.ts +2 -2
- package/package.json +8 -12
- package/src/common/common.d.ts +5 -0
- package/src/common/common.js +2 -2
- package/src/drop-down-button/drop-down-button-model.d.ts +63 -1
- package/src/drop-down-button/drop-down-button.d.ts +60 -3
- package/src/drop-down-button/drop-down-button.js +146 -45
- package/styles/bds-lite.css +1937 -0
- package/styles/bds-lite.scss +13 -0
- package/styles/bds.css +2148 -0
- package/styles/bds.scss +17 -0
- package/styles/bootstrap-dark-lite.css +11 -0
- package/styles/bootstrap-dark.css +11 -1
- package/styles/bootstrap-lite.css +11 -0
- package/styles/bootstrap.css +11 -1
- package/styles/bootstrap4-lite.css +11 -0
- package/styles/bootstrap4.css +11 -1
- package/styles/bootstrap5-dark-lite.css +11 -0
- package/styles/bootstrap5-dark.css +11 -1
- package/styles/bootstrap5-lite.css +11 -0
- package/styles/bootstrap5.3-lite.css +11 -0
- package/styles/bootstrap5.3.css +11 -1
- package/styles/bootstrap5.css +11 -1
- package/styles/button-group/_group-button-mixin.scss +2 -2
- package/styles/button-group/_layout.scss +1 -1
- package/styles/button-group/_tailwind3-definition.scss +31 -0
- package/styles/button-group/_theme.scss +83 -12
- package/styles/button-group/bds.css +861 -0
- package/styles/button-group/bds.scss +5 -0
- package/styles/button-group/tailwind3.css +847 -0
- package/styles/button-group/tailwind3.scss +5 -0
- package/styles/drop-down-button/_bigger.scss +20 -0
- package/styles/drop-down-button/_layout.scss +36 -3
- package/styles/drop-down-button/_tailwind3-definition.scss +53 -0
- package/styles/drop-down-button/_theme.scss +7 -0
- package/styles/drop-down-button/bds.css +372 -0
- package/styles/drop-down-button/bds.scss +7 -0
- package/styles/drop-down-button/bootstrap-dark.css +11 -1
- package/styles/drop-down-button/bootstrap.css +11 -1
- package/styles/drop-down-button/bootstrap4.css +11 -1
- package/styles/drop-down-button/bootstrap5-dark.css +11 -1
- package/styles/drop-down-button/bootstrap5.3.css +11 -1
- package/styles/drop-down-button/bootstrap5.css +11 -1
- package/styles/drop-down-button/fabric-dark.css +11 -1
- package/styles/drop-down-button/fabric.css +11 -1
- package/styles/drop-down-button/fluent-dark.css +11 -1
- package/styles/drop-down-button/fluent.css +11 -1
- package/styles/drop-down-button/fluent2.css +11 -1
- package/styles/drop-down-button/highcontrast-light.css +11 -1
- package/styles/drop-down-button/highcontrast.css +11 -1
- package/styles/drop-down-button/icons/_tailwind3.scss +10 -0
- package/styles/drop-down-button/material-dark.css +11 -1
- package/styles/drop-down-button/material.css +11 -1
- package/styles/drop-down-button/material3-dark.css +11 -1
- package/styles/drop-down-button/material3.css +11 -1
- package/styles/drop-down-button/tailwind-dark.css +11 -1
- package/styles/drop-down-button/tailwind.css +11 -1
- package/styles/drop-down-button/tailwind3.css +295 -0
- package/styles/drop-down-button/tailwind3.scss +7 -0
- package/styles/fabric-dark-lite.css +11 -0
- package/styles/fabric-dark.css +11 -1
- package/styles/fabric-lite.css +11 -0
- package/styles/fabric.css +11 -1
- package/styles/fluent-dark-lite.css +11 -0
- package/styles/fluent-dark.css +11 -1
- package/styles/fluent-lite.css +11 -0
- package/styles/fluent.css +11 -1
- package/styles/fluent2-lite.css +11 -0
- package/styles/fluent2.css +11 -1
- package/styles/highcontrast-light-lite.css +11 -0
- package/styles/highcontrast-light.css +11 -1
- package/styles/highcontrast-lite.css +11 -0
- package/styles/highcontrast.css +11 -1
- package/styles/material-dark-lite.css +11 -0
- package/styles/material-dark.css +11 -1
- package/styles/material-lite.css +11 -0
- package/styles/material.css +11 -1
- package/styles/material3-dark-lite.css +11 -0
- package/styles/material3-dark.css +11 -1
- package/styles/material3-lite.css +11 -0
- package/styles/material3.css +11 -1
- package/styles/progress-button/_tailwind3-definition.scss +20 -0
- package/styles/progress-button/_theme.scss +70 -0
- package/styles/progress-button/bds.css +683 -0
- package/styles/progress-button/bds.scss +6 -0
- package/styles/progress-button/tailwind3.css +636 -0
- package/styles/progress-button/tailwind3.scss +6 -0
- package/styles/split-button/_layout.scss +2 -2
- package/styles/split-button/_tailwind3-definition.scss +23 -0
- package/styles/split-button/_theme.scss +6 -1
- package/styles/split-button/bds.css +461 -0
- package/styles/split-button/bds.scss +7 -0
- package/styles/split-button/tailwind3.css +342 -0
- package/styles/split-button/tailwind3.scss +7 -0
- package/styles/tailwind-dark-lite.css +11 -0
- package/styles/tailwind-dark.css +11 -1
- package/styles/tailwind-lite.css +11 -0
- package/styles/tailwind.css +11 -1
- package/styles/tailwind3-lite.css +1891 -0
- package/styles/tailwind3-lite.scss +13 -0
- package/styles/tailwind3.css +2110 -0
- 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,
|
|
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
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
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
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
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.
|
|
411
|
+
li.innerHTML = item.url ? '' : tempItem;
|
|
382
412
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
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
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
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
|
-
|
|
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
|