@syncfusion/ej2-splitbuttons 30.2.4 → 31.1.17

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 (32) hide show
  1. package/dist/ej2-splitbuttons.min.js +1 -1
  2. package/dist/ej2-splitbuttons.umd.min.js +1 -1
  3. package/dist/global/ej2-splitbuttons.min.js +1 -1
  4. package/dist/global/index.d.ts +1 -1
  5. package/dist/ts/button-group/button-group.d.ts +38 -0
  6. package/dist/ts/button-group/button-group.ts +84 -0
  7. package/dist/ts/button-group/index.d.ts +4 -0
  8. package/dist/ts/button-group/index.ts +4 -0
  9. package/dist/ts/common/common-model.d.ts +51 -0
  10. package/dist/ts/common/common.d.ts +95 -0
  11. package/dist/ts/common/common.ts +218 -0
  12. package/dist/ts/common/index.d.ts +5 -0
  13. package/dist/ts/common/index.ts +5 -0
  14. package/dist/ts/drop-down-button/drop-down-button-model.d.ts +195 -0
  15. package/dist/ts/drop-down-button/drop-down-button.d.ts +308 -0
  16. package/dist/ts/drop-down-button/drop-down-button.ts +1110 -0
  17. package/dist/ts/drop-down-button/index.d.ts +5 -0
  18. package/dist/ts/drop-down-button/index.ts +5 -0
  19. package/dist/ts/index.d.ts +8 -0
  20. package/dist/ts/index.ts +8 -0
  21. package/dist/ts/progress-button/index.d.ts +5 -0
  22. package/dist/ts/progress-button/index.ts +5 -0
  23. package/dist/ts/progress-button/progress-button-model.d.ts +206 -0
  24. package/dist/ts/progress-button/progress-button.d.ts +323 -0
  25. package/dist/ts/progress-button/progress-button.ts +689 -0
  26. package/dist/ts/split-button/index.d.ts +5 -0
  27. package/dist/ts/split-button/index.ts +5 -0
  28. package/dist/ts/split-button/split-button-model.d.ts +133 -0
  29. package/dist/ts/split-button/split-button.d.ts +236 -0
  30. package/dist/ts/split-button/split-button.ts +535 -0
  31. package/package.json +59 -13
  32. package/aceconfig.js +0 -17
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: ej2-splitbuttons.min.js
3
- * version : 30.2.4
3
+ * version : 31.1.17
4
4
  * Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: ej2-splitbuttons.umd.min.js
3
- * version : 30.2.4
3
+ * version : 31.1.17
4
4
  * Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: ej2-splitbuttons.min.js
3
- * version : 30.2.4
3
+ * version : 31.1.17
4
4
  * Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 30.2.4
3
+ * version : 31.1.17
4
4
  * Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
@@ -0,0 +1,38 @@
1
+ import { ButtonModel } from '@syncfusion/ej2-buttons';
2
+ /**
3
+ * Initialize ButtonGroup CSS component with specified properties.
4
+ * ```html
5
+ * <div id='buttongroup'>
6
+ * <button></button>
7
+ * <button></button>
8
+ * <button></button>
9
+ * </div>
10
+ * ```
11
+ * ```typescript
12
+ * createButtonGroup('#buttongroup', {
13
+ * cssClass: 'e-outline',
14
+ * buttons: [
15
+ * { content: 'Day' },
16
+ * { content: 'Week' },
17
+ * { content: 'Work Week'}
18
+ * ]
19
+ * });
20
+ * ```
21
+ *
22
+ * @param {string} selector
23
+ * @param {CreateButtonGroupModel} options
24
+ * @returns HTMLElement
25
+ */
26
+ /**
27
+ * Creates button group.
28
+ *
29
+ * @param {string} selector - Specifies the selector.
30
+ * @param {CreateButtonGroupModel} options - Specifies the button group model.
31
+ * @param {Function} createElement - Specifies the element.
32
+ * @returns {HTMLElement} - Button group element.
33
+ */
34
+ export declare function createButtonGroup(selector: string, options?: CreateButtonGroupModel, createElement?: Function): HTMLElement;
35
+ export interface CreateButtonGroupModel {
36
+ cssClass?: string;
37
+ buttons?: (ButtonModel | null)[];
38
+ }
@@ -0,0 +1,84 @@
1
+ import { addClass, createElement as internalCreateElement, isNullOrUndefined } from '@syncfusion/ej2-base';
2
+ import { ButtonModel, Button } from '@syncfusion/ej2-buttons';
3
+
4
+ /**
5
+ * Initialize ButtonGroup CSS component with specified properties.
6
+ * ```html
7
+ * <div id='buttongroup'>
8
+ * <button></button>
9
+ * <button></button>
10
+ * <button></button>
11
+ * </div>
12
+ * ```
13
+ * ```typescript
14
+ * createButtonGroup('#buttongroup', {
15
+ * cssClass: 'e-outline',
16
+ * buttons: [
17
+ * { content: 'Day' },
18
+ * { content: 'Week' },
19
+ * { content: 'Work Week'}
20
+ * ]
21
+ * });
22
+ * ```
23
+ *
24
+ * @param {string} selector
25
+ * @param {CreateButtonGroupModel} options
26
+ * @returns HTMLElement
27
+ */
28
+
29
+ /**
30
+ * Creates button group.
31
+ *
32
+ * @param {string} selector - Specifies the selector.
33
+ * @param {CreateButtonGroupModel} options - Specifies the button group model.
34
+ * @param {Function} createElement - Specifies the element.
35
+ * @returns {HTMLElement} - Button group element.
36
+ */
37
+ export function createButtonGroup(selector: string, options: CreateButtonGroupModel = {}, createElement?: Function): HTMLElement {
38
+ let child: Element;
39
+ let btnElem: Element;
40
+ let nextChild: Element;
41
+ let btnModel: ButtonModel | null;
42
+ if (isNullOrUndefined(createElement)) {
43
+ createElement = internalCreateElement;
44
+ }
45
+ const wrapper: HTMLElement = document.querySelector(selector) as HTMLElement;
46
+ addClass([wrapper], ['e-btn-group', 'e-css']);
47
+ wrapper.setAttribute('role', 'group');
48
+ const childs: HTMLCollection = wrapper.children;
49
+ options.buttons = options.buttons || [] as ButtonModel[];
50
+ for (let i: number = 0, j: number = 0; j < childs.length; i++, j++) {
51
+ child = childs[j as number];
52
+ btnModel = options.buttons[i as number];
53
+ if (btnModel !== null) {
54
+ if (child.tagName === 'BUTTON') {
55
+ btnElem = child;
56
+ } else {
57
+ btnElem = createElement('label');
58
+ nextChild = childs[j + 1];
59
+ if (nextChild) {
60
+ wrapper.insertBefore(btnElem, nextChild);
61
+ } else {
62
+ wrapper.appendChild(btnElem);
63
+ }
64
+ if (child.id) {
65
+ btnElem.setAttribute('for', child.id);
66
+ }
67
+ if (btnModel && btnModel.disabled) {
68
+ (child as HTMLInputElement).disabled = true;
69
+ }
70
+ j++;
71
+ }
72
+ if (options.cssClass && btnModel && !btnModel.cssClass) {
73
+ btnModel.cssClass = options.cssClass;
74
+ }
75
+ new Button(btnModel || {}, btnElem as HTMLButtonElement);
76
+ }
77
+ }
78
+ return wrapper;
79
+ }
80
+
81
+ export interface CreateButtonGroupModel {
82
+ cssClass?: string;
83
+ buttons?: (ButtonModel | null)[];
84
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * ButtonGroup modules
3
+ */
4
+ export * from './button-group';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * ButtonGroup modules
3
+ */
4
+ export * from './button-group';
@@ -0,0 +1,51 @@
1
+ import { ChildProperty, extend, deleteObject, Property, BaseEventArgs, addClass, isNullOrUndefined } from '@syncfusion/ej2-base';
2
+
3
+ /**
4
+ * Interface for a class Item
5
+ */
6
+ export interface ItemModel {
7
+
8
+ /**
9
+ * Defines class/multiple classes separated by a space for the item that is used to include an icon.
10
+ * Action item can include font icon and sprite image.
11
+ *
12
+ * @default ''
13
+ */
14
+ iconCss?: string;
15
+
16
+ /**
17
+ * Specifies the id for item.
18
+ *
19
+ * @default ''
20
+ */
21
+ id?: string;
22
+
23
+ /**
24
+ * Specifies separator between the items. Separator are horizontal lines used to group action items.
25
+ *
26
+ * @default false
27
+ */
28
+ separator?: boolean;
29
+
30
+ /**
31
+ * Specifies text for item.
32
+ *
33
+ * @default ''
34
+ */
35
+ text?: string;
36
+
37
+ /**
38
+ * Specifies url for item that creates the anchor link to navigate to the url provided.
39
+ *
40
+ * @default ''
41
+ */
42
+ url?: string;
43
+
44
+ /**
45
+ * Used to enable or disable the item.
46
+ *
47
+ * @default false
48
+ */
49
+ disabled?: boolean;
50
+
51
+ }
@@ -0,0 +1,95 @@
1
+ import { ChildProperty, BaseEventArgs } from '@syncfusion/ej2-base';
2
+ import { ItemModel } from './common-model';
3
+ /**
4
+ * Defines the icon position of Split Button.
5
+ */
6
+ export declare type SplitButtonIconPosition = 'Left' | 'Top';
7
+ /**
8
+ * @param {Object} props - Specifies the properties
9
+ * @param {string[]} model - Specifies the model
10
+ * @returns {Object} Component Model
11
+ */
12
+ export declare function getModel(props: Object, model: string[]): Object;
13
+ /** @hidden
14
+ * @param {HTMLElement} ul - Specifies the UL element
15
+ * @param {number} keyCode - Specifies the keycode
16
+ * @returns {void}
17
+ */
18
+ export declare function upDownKeyHandler(ul: HTMLElement, keyCode: number): void;
19
+ /** @hidden
20
+ * @param {HTMLElement} popup - Specifies the popup element.
21
+ * @param {boolean} blankIcon - Specifies the blankIcon value.
22
+ * @returns {void}
23
+ */
24
+ export declare function setBlankIconStyle(popup: HTMLElement, blankIcon?: boolean): void;
25
+ /**
26
+ * Defines the items of Split Button/DropDownButton.
27
+ */
28
+ export declare class Item extends ChildProperty<Item> {
29
+ /**
30
+ * Defines class/multiple classes separated by a space for the item that is used to include an icon.
31
+ * Action item can include font icon and sprite image.
32
+ *
33
+ * @default ''
34
+ */
35
+ iconCss: string;
36
+ /**
37
+ * Specifies the id for item.
38
+ *
39
+ * @default ''
40
+ */
41
+ id: string;
42
+ /**
43
+ * Specifies separator between the items. Separator are horizontal lines used to group action items.
44
+ *
45
+ * @default false
46
+ */
47
+ separator: boolean;
48
+ /**
49
+ * Specifies text for item.
50
+ *
51
+ * @default ''
52
+ */
53
+ text: string;
54
+ /**
55
+ * Specifies url for item that creates the anchor link to navigate to the url provided.
56
+ *
57
+ * @default ''
58
+ */
59
+ url: string;
60
+ /**
61
+ * Used to enable or disable the item.
62
+ *
63
+ * @default false
64
+ */
65
+ disabled: boolean;
66
+ }
67
+ /**
68
+ * Interface for before item render / select event.
69
+ */
70
+ export interface MenuEventArgs extends BaseEventArgs {
71
+ element: HTMLElement;
72
+ item: ItemModel;
73
+ event?: Event;
74
+ }
75
+ /**
76
+ * Interface for before open / close event.
77
+ */
78
+ export interface BeforeOpenCloseMenuEventArgs extends BaseEventArgs {
79
+ element: HTMLElement;
80
+ items: ItemModel[];
81
+ event: Event;
82
+ cancel?: boolean;
83
+ }
84
+ /**
85
+ * Interface for open/close event.
86
+ */
87
+ export interface OpenCloseMenuEventArgs extends BaseEventArgs {
88
+ element: HTMLElement;
89
+ items: ItemModel[];
90
+ parentItem?: ItemModel;
91
+ }
92
+ /**
93
+ * Interface for animation effects.
94
+ */
95
+ export declare type DropDownAnimationEffect = 'None' | 'SlideDown' | 'ZoomIn' | 'FadeIn';
@@ -0,0 +1,218 @@
1
+ import { ChildProperty, extend, deleteObject, Property, BaseEventArgs, addClass, isNullOrUndefined } from '@syncfusion/ej2-base';
2
+ import { ItemModel } from './common-model';
3
+ /**
4
+ * Defines the icon position of Split Button.
5
+ */
6
+ export type SplitButtonIconPosition = 'Left' | 'Top';
7
+
8
+ /**
9
+ * @param {Object} props - Specifies the properties
10
+ * @param {string[]} model - Specifies the model
11
+ * @returns {Object} Component Model
12
+ */
13
+ export function getModel(props: Object, model: string[]): Object {
14
+
15
+ const obj: Object = extend({}, props);
16
+ for (const prop of Object.keys(obj)) {
17
+ if ((model).indexOf(prop) < 0) {
18
+ deleteObject(obj, prop);
19
+ }
20
+ }
21
+
22
+ return obj as Object;
23
+ }
24
+
25
+ /** @hidden
26
+ * @param {HTMLElement} ul - Specifies the UL element
27
+ * @param {number} keyCode - Specifies the keycode
28
+ * @returns {void}
29
+ */
30
+ export function upDownKeyHandler(ul: HTMLElement, keyCode: number): void {
31
+ const defaultIdx: number = keyCode === 40 ? 0 : ul.childElementCount - 1;
32
+ let liIdx: number = defaultIdx;
33
+ let li: Element;
34
+ const selectedLi: Element = ul.querySelector('.e-selected');
35
+ if (selectedLi) { selectedLi.classList.remove('e-selected'); }
36
+ for (let i: number = 0, len: number = ul.children.length; i < len; i++) {
37
+ if (ul.children[i as number].classList.contains('e-focused')) {
38
+ li = ul.children[i as number];
39
+ liIdx = i;
40
+ li.classList.remove('e-focused');
41
+ if (keyCode === 40) {
42
+ liIdx++;
43
+ } else {
44
+ liIdx--;
45
+ }
46
+ if (liIdx === (keyCode === 40 ? ul.childElementCount : -1)) {
47
+ liIdx = defaultIdx;
48
+ }
49
+ }
50
+ }
51
+ li = ul.children[liIdx as number];
52
+ liIdx = isValidLI(ul, li, liIdx, keyCode);
53
+ if (liIdx !== -1) {
54
+ addClass([ul.children[liIdx as number]], 'e-focused');
55
+ (ul.children[liIdx as number] as HTMLElement).focus();
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Get Valid LI element
61
+ *
62
+ * @param {HTMLElement} ul - Specifies the UL element
63
+ * @param {Element} li - Specifies the LI element
64
+ * @param {number} index - Specifies the index
65
+ * @param {number} keyCode - Specifies the keycode
66
+ * @param {number} count - Specifies the count
67
+ * @returns {number} - Index
68
+ */
69
+ function isValidLI(ul: HTMLElement, li: Element, index: number, keyCode: number, count: number = 0): number {
70
+ if (li.classList.contains('e-separator') || li.classList.contains('e-disabled')) {
71
+ if (index === (keyCode === 40 ? ul.childElementCount - 1 : 0)) {
72
+ index = keyCode === 40 ? 0 : ul.childElementCount - 1;
73
+ } else {
74
+ if (keyCode === 40) {
75
+ index++;
76
+ } else {
77
+ index--;
78
+ }
79
+ }
80
+ }
81
+ li = ul.children[index as number];
82
+ if (li.classList.contains('e-separator') || li.classList.contains('e-disabled')) {
83
+ count++;
84
+ if (count === ul.childElementCount) {
85
+ return index = -1;
86
+ }
87
+ index = isValidLI(ul, li, index, keyCode, count);
88
+ }
89
+ return index;
90
+ }
91
+
92
+ /** @hidden
93
+ * @param {HTMLElement} popup - Specifies the popup element.
94
+ * @param {boolean} blankIcon - Specifies the blankIcon value.
95
+ * @returns {void}
96
+ */
97
+ export function setBlankIconStyle(popup: HTMLElement, blankIcon?: boolean): void {
98
+ const blankIconList: HTMLElement[] = [].slice.call(popup.getElementsByClassName('e-blank-icon'));
99
+ if (blankIcon) {
100
+ const menuItem: HTMLElement[] = [].slice.call(popup.getElementsByClassName('e-item'));
101
+ menuItem.forEach((li: HTMLElement): void => {
102
+ if (li.style.paddingLeft || li.style.paddingRight) {
103
+ li.removeAttribute('style');
104
+ }
105
+ });
106
+ }
107
+ if (!blankIconList.length) { return; }
108
+ let iconLi: HTMLElement = popup.querySelector('.e-item:not(.e-blank-icon):not(.e-separator)') as HTMLElement;
109
+ if (isNullOrUndefined(iconLi)) {return; }
110
+ if (iconLi.classList.contains('e-url')) { iconLi = iconLi.querySelector('.e-menu-url'); }
111
+ const icon: HTMLElement = iconLi.querySelector('.e-menu-icon') as HTMLElement;
112
+ let cssProp: { padding: string, margin: string };
113
+ const enableRtl: boolean = popup.classList.contains('e-rtl');
114
+ if (enableRtl) {
115
+ cssProp = { padding: 'paddingRight', margin: 'marginLeft' };
116
+ } else {
117
+ cssProp = { padding: 'paddingLeft', margin: 'marginRight' };
118
+ }
119
+ /* eslint-disable */
120
+ let size: string = `${parseInt(getComputedStyle(icon).fontSize, 10) + parseInt(
121
+ (enableRtl ? (getComputedStyle(icon) as any)[cssProp.margin] : (getComputedStyle(icon) as any)[cssProp.margin]), 10)
122
+ + parseInt(getComputedStyle(iconLi).paddingLeft, 10)}px`;
123
+ blankIconList.forEach((li: HTMLElement): void => {
124
+ if (li.classList.contains('e-url') && (li.querySelector('.e-menu-url') as HTMLElement)) {
125
+ ((li.querySelector('.e-menu-url') as HTMLElement).style as any)[cssProp.padding] = size;
126
+ } else {
127
+ (li.style as any)[cssProp.padding] = size;
128
+ }
129
+ });
130
+ /* eslint-enable */
131
+ }
132
+
133
+ /**
134
+ * Defines the items of Split Button/DropDownButton.
135
+ */
136
+ export class Item extends ChildProperty<Item> {
137
+ /**
138
+ * Defines class/multiple classes separated by a space for the item that is used to include an icon.
139
+ * Action item can include font icon and sprite image.
140
+ *
141
+ * @default ''
142
+ */
143
+ @Property('')
144
+ public iconCss: string;
145
+
146
+ /**
147
+ * Specifies the id for item.
148
+ *
149
+ * @default ''
150
+ */
151
+ @Property('')
152
+ public id: string;
153
+
154
+ /**
155
+ * Specifies separator between the items. Separator are horizontal lines used to group action items.
156
+ *
157
+ * @default false
158
+ */
159
+ @Property(false)
160
+ public separator: boolean;
161
+
162
+ /**
163
+ * Specifies text for item.
164
+ *
165
+ * @default ''
166
+ */
167
+ @Property('')
168
+ public text: string;
169
+
170
+ /**
171
+ * Specifies url for item that creates the anchor link to navigate to the url provided.
172
+ *
173
+ * @default ''
174
+ */
175
+ @Property('')
176
+ public url: string;
177
+
178
+ /**
179
+ * Used to enable or disable the item.
180
+ *
181
+ * @default false
182
+ */
183
+ @Property(false)
184
+ public disabled: boolean;
185
+ }
186
+
187
+ /**
188
+ * Interface for before item render / select event.
189
+ */
190
+ export interface MenuEventArgs extends BaseEventArgs {
191
+ element: HTMLElement;
192
+ item: ItemModel;
193
+ event?: Event;
194
+ }
195
+
196
+ /**
197
+ * Interface for before open / close event.
198
+ */
199
+ export interface BeforeOpenCloseMenuEventArgs extends BaseEventArgs {
200
+ element: HTMLElement;
201
+ items: ItemModel[];
202
+ event: Event;
203
+ cancel?: boolean;
204
+ }
205
+
206
+ /**
207
+ * Interface for open/close event.
208
+ */
209
+ export interface OpenCloseMenuEventArgs extends BaseEventArgs {
210
+ element: HTMLElement;
211
+ items: ItemModel[];
212
+ parentItem?: ItemModel;
213
+ }
214
+
215
+ /**
216
+ * Interface for animation effects.
217
+ */
218
+ export type DropDownAnimationEffect = 'None' | 'SlideDown' | 'ZoomIn' | 'FadeIn';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Common modules
3
+ */
4
+ export * from './common';
5
+ export * from './common-model';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Common modules
3
+ */
4
+ export * from './common';
5
+ export * from './common-model';