@syncfusion/ej2-ribbon 21.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 (188) hide show
  1. package/.eslintrc.json +259 -0
  2. package/.github/PULL_REQUEST_TEMPLATE/Bug.md +60 -0
  3. package/.github/PULL_REQUEST_TEMPLATE/feature.md +37 -0
  4. package/CHANGELOG.md +19 -0
  5. package/README.md +3 -0
  6. package/dist/ej2-ribbon.umd.min.js +11 -0
  7. package/dist/ej2-ribbon.umd.min.js.map +1 -0
  8. package/dist/es6/ej2-ribbon.es2015.js +4946 -0
  9. package/dist/es6/ej2-ribbon.es2015.js.map +1 -0
  10. package/dist/es6/ej2-ribbon.es5.js +5253 -0
  11. package/dist/es6/ej2-ribbon.es5.js.map +1 -0
  12. package/dist/global/ej2-ribbon.min.js +11 -0
  13. package/dist/global/ej2-ribbon.min.js.map +1 -0
  14. package/dist/global/index.d.ts +14 -0
  15. package/index.d.ts +4 -0
  16. package/index.js +4 -0
  17. package/license +10 -0
  18. package/package.json +67 -0
  19. package/ribbon.d.ts +4 -0
  20. package/ribbon.js +4 -0
  21. package/src/global.js +3 -0
  22. package/src/index.d.ts +1 -0
  23. package/src/index.js +3 -0
  24. package/src/ribbon/base/constant.d.ts +151 -0
  25. package/src/ribbon/base/constant.js +151 -0
  26. package/src/ribbon/base/index.d.ts +8 -0
  27. package/src/ribbon/base/index.js +7 -0
  28. package/src/ribbon/base/interface.d.ts +194 -0
  29. package/src/ribbon/base/interface.js +106 -0
  30. package/src/ribbon/base/ribbon-model.d.ts +129 -0
  31. package/src/ribbon/base/ribbon.d.ts +357 -0
  32. package/src/ribbon/base/ribbon.js +2413 -0
  33. package/src/ribbon/base/utils.d.ts +113 -0
  34. package/src/ribbon/base/utils.js +288 -0
  35. package/src/ribbon/index.d.ts +7 -0
  36. package/src/ribbon/index.js +7 -0
  37. package/src/ribbon/items/index.d.ts +6 -0
  38. package/src/ribbon/items/index.js +6 -0
  39. package/src/ribbon/items/ribbon-button.d.ts +65 -0
  40. package/src/ribbon/items/ribbon-button.js +153 -0
  41. package/src/ribbon/items/ribbon-checkbox.d.ts +56 -0
  42. package/src/ribbon/items/ribbon-checkbox.js +134 -0
  43. package/src/ribbon/items/ribbon-colorpicker.d.ts +66 -0
  44. package/src/ribbon/items/ribbon-colorpicker.js +163 -0
  45. package/src/ribbon/items/ribbon-combobox.d.ts +78 -0
  46. package/src/ribbon/items/ribbon-combobox.js +185 -0
  47. package/src/ribbon/items/ribbon-dropdown.d.ts +123 -0
  48. package/src/ribbon/items/ribbon-dropdown.js +268 -0
  49. package/src/ribbon/items/ribbon-splitbutton.d.ts +86 -0
  50. package/src/ribbon/items/ribbon-splitbutton.js +227 -0
  51. package/src/ribbon/models/index.d.ts +24 -0
  52. package/src/ribbon/models/index.js +13 -0
  53. package/src/ribbon/models/ribbon-button-settings-model.d.ts +57 -0
  54. package/src/ribbon/models/ribbon-button-settings.d.ts +55 -0
  55. package/src/ribbon/models/ribbon-button-settings.js +61 -0
  56. package/src/ribbon/models/ribbon-checkbox-settings-model.d.ts +50 -0
  57. package/src/ribbon/models/ribbon-checkbox-settings.d.ts +50 -0
  58. package/src/ribbon/models/ribbon-checkbox-settings.js +58 -0
  59. package/src/ribbon/models/ribbon-collection-model.d.ts +30 -0
  60. package/src/ribbon/models/ribbon-collection.d.ts +33 -0
  61. package/src/ribbon/models/ribbon-collection.js +50 -0
  62. package/src/ribbon/models/ribbon-colorpicker-settings-model.d.ts +123 -0
  63. package/src/ribbon/models/ribbon-colorpicker-settings.d.ts +115 -0
  64. package/src/ribbon/models/ribbon-colorpicker-settings.js +88 -0
  65. package/src/ribbon/models/ribbon-combobox-settings-model.d.ts +241 -0
  66. package/src/ribbon/models/ribbon-combobox-settings.d.ts +223 -0
  67. package/src/ribbon/models/ribbon-combobox-settings.js +122 -0
  68. package/src/ribbon/models/ribbon-dropdown-settings-model.d.ts +100 -0
  69. package/src/ribbon/models/ribbon-dropdown-settings.d.ts +93 -0
  70. package/src/ribbon/models/ribbon-dropdown-settings.js +80 -0
  71. package/src/ribbon/models/ribbon-file-menu-settings-model.d.ts +108 -0
  72. package/src/ribbon/models/ribbon-file-menu-settings.d.ts +159 -0
  73. package/src/ribbon/models/ribbon-file-menu-settings.js +84 -0
  74. package/src/ribbon/models/ribbon-group-model.d.ts +91 -0
  75. package/src/ribbon/models/ribbon-group.d.ts +87 -0
  76. package/src/ribbon/models/ribbon-group.js +74 -0
  77. package/src/ribbon/models/ribbon-item-model.d.ts +120 -0
  78. package/src/ribbon/models/ribbon-item.d.ts +118 -0
  79. package/src/ribbon/models/ribbon-item.js +93 -0
  80. package/src/ribbon/models/ribbon-splitbutton-settings-model.d.ts +107 -0
  81. package/src/ribbon/models/ribbon-splitbutton-settings.d.ts +99 -0
  82. package/src/ribbon/models/ribbon-splitbutton-settings.js +83 -0
  83. package/src/ribbon/models/ribbon-tab-model.d.ts +37 -0
  84. package/src/ribbon/models/ribbon-tab.d.ts +39 -0
  85. package/src/ribbon/models/ribbon-tab.js +53 -0
  86. package/src/ribbon/models/ribbon-tooltip-model.d.ts +43 -0
  87. package/src/ribbon/models/ribbon-tooltip.d.ts +36 -0
  88. package/src/ribbon/models/ribbon-tooltip.js +46 -0
  89. package/src/ribbon/modules/index.d.ts +1 -0
  90. package/src/ribbon/modules/index.js +1 -0
  91. package/src/ribbon/modules/ribbon-filemenu.d.ts +94 -0
  92. package/src/ribbon/modules/ribbon-filemenu.js +318 -0
  93. package/styles/bootstrap-dark.css +1502 -0
  94. package/styles/bootstrap-dark.scss +1 -0
  95. package/styles/bootstrap.css +1507 -0
  96. package/styles/bootstrap.scss +1 -0
  97. package/styles/bootstrap4.css +1557 -0
  98. package/styles/bootstrap4.scss +1 -0
  99. package/styles/bootstrap5-dark.css +1586 -0
  100. package/styles/bootstrap5-dark.scss +1 -0
  101. package/styles/bootstrap5.css +1586 -0
  102. package/styles/bootstrap5.scss +1 -0
  103. package/styles/fabric-dark.css +1478 -0
  104. package/styles/fabric-dark.scss +1 -0
  105. package/styles/fabric.css +1476 -0
  106. package/styles/fabric.scss +1 -0
  107. package/styles/fluent-dark.css +1562 -0
  108. package/styles/fluent-dark.scss +1 -0
  109. package/styles/fluent.css +1562 -0
  110. package/styles/fluent.scss +1 -0
  111. package/styles/highcontrast-light.css +1485 -0
  112. package/styles/highcontrast-light.scss +1 -0
  113. package/styles/highcontrast.css +1494 -0
  114. package/styles/highcontrast.scss +1 -0
  115. package/styles/material-dark.css +1548 -0
  116. package/styles/material-dark.scss +1 -0
  117. package/styles/material.css +1581 -0
  118. package/styles/material.scss +1 -0
  119. package/styles/ribbon/_all.scss +2 -0
  120. package/styles/ribbon/_bootstrap-dark-definition.scss +206 -0
  121. package/styles/ribbon/_bootstrap-definition.scss +206 -0
  122. package/styles/ribbon/_bootstrap4-definition.scss +206 -0
  123. package/styles/ribbon/_bootstrap5-dark-definition.scss +1 -0
  124. package/styles/ribbon/_bootstrap5-definition.scss +206 -0
  125. package/styles/ribbon/_fabric-dark-definition.scss +206 -0
  126. package/styles/ribbon/_fabric-definition.scss +206 -0
  127. package/styles/ribbon/_fluent-dark-definition.scss +1 -0
  128. package/styles/ribbon/_fluent-definition.scss +206 -0
  129. package/styles/ribbon/_fusionnew-definition.scss +206 -0
  130. package/styles/ribbon/_highcontrast-definition.scss +206 -0
  131. package/styles/ribbon/_highcontrast-light-definition.scss +206 -0
  132. package/styles/ribbon/_layout.scss +1040 -0
  133. package/styles/ribbon/_material-dark-definition.scss +206 -0
  134. package/styles/ribbon/_material-definition.scss +206 -0
  135. package/styles/ribbon/_tailwind-dark-definition.scss +1 -0
  136. package/styles/ribbon/_tailwind-definition.scss +206 -0
  137. package/styles/ribbon/_theme.scss +343 -0
  138. package/styles/ribbon/bootstrap-dark.css +1502 -0
  139. package/styles/ribbon/bootstrap-dark.scss +17 -0
  140. package/styles/ribbon/bootstrap.css +1507 -0
  141. package/styles/ribbon/bootstrap.scss +17 -0
  142. package/styles/ribbon/bootstrap4.css +1557 -0
  143. package/styles/ribbon/bootstrap4.scss +17 -0
  144. package/styles/ribbon/bootstrap5-dark.css +1586 -0
  145. package/styles/ribbon/bootstrap5-dark.scss +17 -0
  146. package/styles/ribbon/bootstrap5.css +1586 -0
  147. package/styles/ribbon/bootstrap5.scss +17 -0
  148. package/styles/ribbon/fabric-dark.css +1478 -0
  149. package/styles/ribbon/fabric-dark.scss +17 -0
  150. package/styles/ribbon/fabric.css +1476 -0
  151. package/styles/ribbon/fabric.scss +17 -0
  152. package/styles/ribbon/fluent-dark.css +1562 -0
  153. package/styles/ribbon/fluent-dark.scss +17 -0
  154. package/styles/ribbon/fluent.css +1562 -0
  155. package/styles/ribbon/fluent.scss +17 -0
  156. package/styles/ribbon/highcontrast-light.css +1485 -0
  157. package/styles/ribbon/highcontrast-light.scss +16 -0
  158. package/styles/ribbon/highcontrast.css +1494 -0
  159. package/styles/ribbon/highcontrast.scss +17 -0
  160. package/styles/ribbon/icons/_bootstrap-dark.scss +9 -0
  161. package/styles/ribbon/icons/_bootstrap.scss +9 -0
  162. package/styles/ribbon/icons/_bootstrap4.scss +9 -0
  163. package/styles/ribbon/icons/_bootstrap5-dark.scss +1 -0
  164. package/styles/ribbon/icons/_bootstrap5.scss +9 -0
  165. package/styles/ribbon/icons/_fabric-dark.scss +9 -0
  166. package/styles/ribbon/icons/_fabric.scss +9 -0
  167. package/styles/ribbon/icons/_fluent-dark.scss +1 -0
  168. package/styles/ribbon/icons/_fluent.scss +9 -0
  169. package/styles/ribbon/icons/_fusionnew.scss +9 -0
  170. package/styles/ribbon/icons/_highcontrast.scss +9 -0
  171. package/styles/ribbon/icons/_material-dark.scss +9 -0
  172. package/styles/ribbon/icons/_material.scss +9 -0
  173. package/styles/ribbon/icons/_material3.scss +9 -0
  174. package/styles/ribbon/icons/_tailwind-dark.scss +9 -0
  175. package/styles/ribbon/icons/_tailwind.scss +9 -0
  176. package/styles/ribbon/material-dark.css +1548 -0
  177. package/styles/ribbon/material-dark.scss +17 -0
  178. package/styles/ribbon/material.css +1581 -0
  179. package/styles/ribbon/material.scss +17 -0
  180. package/styles/ribbon/tailwind-dark.css +1560 -0
  181. package/styles/ribbon/tailwind-dark.scss +17 -0
  182. package/styles/ribbon/tailwind.css +1560 -0
  183. package/styles/ribbon/tailwind.scss +17 -0
  184. package/styles/tailwind-dark.css +1560 -0
  185. package/styles/tailwind-dark.scss +1 -0
  186. package/styles/tailwind.css +1560 -0
  187. package/styles/tailwind.scss +1 -0
  188. package/tslint.json +111 -0
@@ -0,0 +1,56 @@
1
+ import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
2
+ import { Ribbon } from '../base/index';
3
+ import { RibbonCheckBoxSettingsModel, RibbonItemModel } from '../models/index';
4
+ /**
5
+ * Defines the items of Ribbon.
6
+ */
7
+ export declare class RibbonCheckBox {
8
+ private parent;
9
+ constructor(parent: Ribbon);
10
+ protected getModuleName(): string;
11
+ protected destroy(): void;
12
+ /**
13
+ * Creates the check box.
14
+ *
15
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
16
+ * @param {HTMLElement} itemEle - Gets the ribbon item element.
17
+ * @returns {void}
18
+ * @hidden
19
+ */
20
+ createCheckBox(item: RibbonItemModel, itemEle: HTMLElement): void;
21
+ /**
22
+ * Adds the additional event handlers as the item moved into overflow popup.
23
+ *
24
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
25
+ * @param {HTMLElement} itemEle - Gets the ribbon item element.
26
+ * @param {DropDownButton} overflowButton - Gets the overflow button.
27
+ * @returns {void}
28
+ * @hidden
29
+ */
30
+ addOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement, overflowButton: DropDownButton): void;
31
+ /**
32
+ * Removes the additional event handlers as the item moved from overflow popup.
33
+ *
34
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
35
+ * @param {HTMLElement} itemEle - Gets the ribbon item element.
36
+ * @param {DropDownButton} overflowButton - Gets the overflow button.
37
+ * @returns {void}
38
+ * @hidden
39
+ */
40
+ removeOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement): void;
41
+ /**
42
+ * Triggers the click action on the Checkbox.
43
+ *
44
+ * @param {string} controlId - Gets the control ID.
45
+ * @returns {void}
46
+ */
47
+ click(controlId: string): void;
48
+ /**
49
+ * Updates the checkbox.
50
+ *
51
+ * @param {RibbonCheckBoxSettingsModel} prop - Gets the checkbox property.
52
+ * @param {string} id - Gets the ID of checkbox.
53
+ * @returns {void}
54
+ */
55
+ updateCheckBox(prop: RibbonCheckBoxSettingsModel, id: string): void;
56
+ }
@@ -0,0 +1,134 @@
1
+ import { getComponent, merge } from '@syncfusion/ej2-base';
2
+ import { CheckBox } from '@syncfusion/ej2-buttons';
3
+ import { getItem, getItemElement, RIBBON_CONTROL, SPACE, RIBBON_POPUP_CONTROL } from '../base/index';
4
+ /**
5
+ * Defines the items of Ribbon.
6
+ */
7
+ var RibbonCheckBox = /** @class */ (function () {
8
+ function RibbonCheckBox(parent) {
9
+ this.parent = parent;
10
+ }
11
+ RibbonCheckBox.prototype.getModuleName = function () {
12
+ return 'ribbonCheckBox';
13
+ };
14
+ RibbonCheckBox.prototype.destroy = function () {
15
+ this.parent = null;
16
+ };
17
+ /**
18
+ * Creates the check box.
19
+ *
20
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
21
+ * @param {HTMLElement} itemEle - Gets the ribbon item element.
22
+ * @returns {void}
23
+ * @hidden
24
+ */
25
+ RibbonCheckBox.prototype.createCheckBox = function (item, itemEle) {
26
+ var _this = this;
27
+ var inputEle = this.parent.createElement('input', {
28
+ id: item.id
29
+ });
30
+ itemEle.appendChild(inputEle);
31
+ var checkBoxSettings = item.checkBoxSettings;
32
+ new CheckBox({
33
+ locale: this.parent.locale,
34
+ enableRtl: this.parent.enableRtl,
35
+ enablePersistence: this.parent.enablePersistence,
36
+ checked: checkBoxSettings.checked,
37
+ cssClass: (RIBBON_CONTROL + SPACE + (checkBoxSettings.cssClass ? checkBoxSettings.cssClass : '')).trim(),
38
+ label: checkBoxSettings.label,
39
+ labelPosition: checkBoxSettings.labelPosition,
40
+ disabled: item.disabled,
41
+ created: checkBoxSettings.created,
42
+ change: function (e) {
43
+ if (checkBoxSettings.change) {
44
+ checkBoxSettings.change.call(_this, e);
45
+ }
46
+ }
47
+ }, inputEle);
48
+ };
49
+ /**
50
+ * Adds the additional event handlers as the item moved into overflow popup.
51
+ *
52
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
53
+ * @param {HTMLElement} itemEle - Gets the ribbon item element.
54
+ * @param {DropDownButton} overflowButton - Gets the overflow button.
55
+ * @returns {void}
56
+ * @hidden
57
+ */
58
+ RibbonCheckBox.prototype.addOverFlowEvents = function (item, itemEle, overflowButton) {
59
+ var _this = this;
60
+ var inputEle = itemEle.querySelector('#' + item.id);
61
+ var checkBoxObj = getComponent(inputEle, CheckBox);
62
+ checkBoxObj.cssClass = checkBoxObj.cssClass + SPACE + RIBBON_POPUP_CONTROL;
63
+ checkBoxObj.dataBind();
64
+ checkBoxObj.change = function (e) {
65
+ if (item.checkBoxSettings.change) {
66
+ item.checkBoxSettings.change.call(_this, e);
67
+ }
68
+ overflowButton.toggle();
69
+ };
70
+ };
71
+ /**
72
+ * Removes the additional event handlers as the item moved from overflow popup.
73
+ *
74
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
75
+ * @param {HTMLElement} itemEle - Gets the ribbon item element.
76
+ * @param {DropDownButton} overflowButton - Gets the overflow button.
77
+ * @returns {void}
78
+ * @hidden
79
+ */
80
+ RibbonCheckBox.prototype.removeOverFlowEvents = function (item, itemEle) {
81
+ var _this = this;
82
+ var inputEle = itemEle.querySelector('#' + item.id);
83
+ var checkBoxObj = getComponent(inputEle, CheckBox);
84
+ var cssClass = checkBoxObj.cssClass.split(SPACE);
85
+ cssClass = cssClass.filter(function (value) { return value !== RIBBON_POPUP_CONTROL; });
86
+ checkBoxObj.cssClass = cssClass.join(SPACE);
87
+ checkBoxObj.dataBind();
88
+ checkBoxObj.change = function (e) {
89
+ if (item.checkBoxSettings.change) {
90
+ item.checkBoxSettings.change.call(_this, e);
91
+ }
92
+ };
93
+ };
94
+ /**
95
+ * Triggers the click action on the Checkbox.
96
+ *
97
+ * @param {string} controlId - Gets the control ID.
98
+ * @returns {void}
99
+ */
100
+ RibbonCheckBox.prototype.click = function (controlId) {
101
+ var inputEle = getItemElement(this.parent, controlId);
102
+ if (!inputEle) {
103
+ return;
104
+ }
105
+ var checkBoxObj = getComponent(inputEle, CheckBox);
106
+ checkBoxObj.click();
107
+ };
108
+ /**
109
+ * Updates the checkbox.
110
+ *
111
+ * @param {RibbonCheckBoxSettingsModel} prop - Gets the checkbox property.
112
+ * @param {string} id - Gets the ID of checkbox.
113
+ * @returns {void}
114
+ */
115
+ RibbonCheckBox.prototype.updateCheckBox = function (prop, id) {
116
+ var itemProp = getItem(this.parent.tabs, id);
117
+ if (!itemProp) {
118
+ return;
119
+ }
120
+ merge(itemProp.item.checkBoxSettings, prop);
121
+ var inputEle = getItemElement(this.parent, id, itemProp);
122
+ if (!inputEle) {
123
+ return;
124
+ }
125
+ if (prop.cssClass) {
126
+ prop.cssClass = (RIBBON_CONTROL + SPACE + prop.cssClass).trim();
127
+ }
128
+ delete prop.change;
129
+ var checkBoxObj = getComponent(inputEle, CheckBox);
130
+ checkBoxObj.setProperties(prop);
131
+ };
132
+ return RibbonCheckBox;
133
+ }());
134
+ export { RibbonCheckBox };
@@ -0,0 +1,66 @@
1
+ import { Ribbon } from '../base/index';
2
+ import { RibbonItemModel, RibbonColorPickerSettingsModel } from '../models/index';
3
+ import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
4
+ /**
5
+ * Defines the items of Ribbon.
6
+ */
7
+ export declare class RibbonColorPicker {
8
+ private parent;
9
+ constructor(parent: Ribbon);
10
+ protected getModuleName(): string;
11
+ protected destroy(): void;
12
+ /**
13
+ * Creates the colorpicker.
14
+ *
15
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
16
+ * @param {HTMLElement} itemEle - Gets the ribbon item element.
17
+ * @returns {void}
18
+ * @hidden
19
+ */
20
+ createColorPicker(item: RibbonItemModel, itemEle: HTMLElement): void;
21
+ /**
22
+ * Adds the additional event handlers as the item moved into overflow popup.
23
+ *
24
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
25
+ * @param {HTMLElement} itemEle - Gets the ribbon item element.
26
+ * @param {DropDownButton} overflowButton - Gets the overflow button.
27
+ * @returns {void}
28
+ * @hidden
29
+ */
30
+ addOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement, overflowButton: DropDownButton): void;
31
+ /**
32
+ * Removes the additional event handlers as the item moved from overflow popup.
33
+ *
34
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
35
+ * @param {HTMLElement} itemEle - Gets the ribbon item element.
36
+ * @param {DropDownButton} overflowButton - Gets the overflow button.
37
+ * @returns {void}
38
+ * @hidden
39
+ */
40
+ removeOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement): void;
41
+ private getColorPickerObj;
42
+ /**
43
+ * Gets color value in specified type.
44
+ *
45
+ * @param {string} controlId -Gets the control ID.
46
+ * @param {string} value - Specify the color value.
47
+ * @param {string} type - Specify the type to which the specified color needs to be converted.
48
+ * @returns {string} - Returns string.
49
+ */
50
+ getValue(controlId: string, value?: string, type?: string): string;
51
+ /**
52
+ * To show/hide ColorPicker popup based on current state of the SplitButton.
53
+ *
54
+ * @param {string} controlId - set the id of the control.
55
+ * @returns {void} - Returns void.
56
+ */
57
+ toggle(controlId: string): void;
58
+ /**
59
+ * Updates the colorpicker properties.
60
+ *
61
+ * @param {RibbonColorPickerSettingsModel} prop - Gets the colorpicker property.
62
+ * @param {string} id - Gets the ID of colorpicker.
63
+ * @returns {void}
64
+ */
65
+ updateColorPicker(prop: RibbonColorPickerSettingsModel, id: string): void;
66
+ }
@@ -0,0 +1,163 @@
1
+ import { EventHandler, getComponent, merge } from '@syncfusion/ej2-base';
2
+ import { ColorPicker } from '@syncfusion/ej2-inputs';
3
+ import { getItem, getItemElement } from '../base/index';
4
+ import { RIBBON_CONTROL, RIBBON_HOVER, RIBBON_POPUP_CONTROL, RIBBON_POPUP_OPEN, SPACE } from '../base/constant';
5
+ /**
6
+ * Defines the items of Ribbon.
7
+ */
8
+ var RibbonColorPicker = /** @class */ (function () {
9
+ function RibbonColorPicker(parent) {
10
+ this.parent = parent;
11
+ }
12
+ RibbonColorPicker.prototype.getModuleName = function () {
13
+ return 'ribbonColorPicker';
14
+ };
15
+ RibbonColorPicker.prototype.destroy = function () {
16
+ this.parent = null;
17
+ };
18
+ /**
19
+ * Creates the colorpicker.
20
+ *
21
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
22
+ * @param {HTMLElement} itemEle - Gets the ribbon item element.
23
+ * @returns {void}
24
+ * @hidden
25
+ */
26
+ RibbonColorPicker.prototype.createColorPicker = function (item, itemEle) {
27
+ var _this = this;
28
+ var inputEle = this.parent.createElement('input', {
29
+ id: item.id
30
+ });
31
+ itemEle.appendChild(inputEle);
32
+ var colorPickerSettings = item.colorPickerSettings;
33
+ var colorPicker = new ColorPicker({
34
+ locale: this.parent.locale,
35
+ enableRtl: this.parent.enableRtl,
36
+ enablePersistence: this.parent.enablePersistence,
37
+ columns: colorPickerSettings.columns,
38
+ cssClass: (RIBBON_CONTROL + SPACE + (colorPickerSettings.cssClass ? colorPickerSettings.cssClass : '')).trim(),
39
+ disabled: item.disabled,
40
+ enableOpacity: colorPickerSettings.enableOpacity,
41
+ mode: colorPickerSettings.mode,
42
+ modeSwitcher: colorPickerSettings.modeSwitcher,
43
+ noColor: colorPickerSettings.noColor,
44
+ presetColors: colorPickerSettings.presetColors,
45
+ showButtons: colorPickerSettings.showButtons,
46
+ value: colorPickerSettings.value,
47
+ beforeClose: function () {
48
+ colorPicker.element.parentElement.classList.remove(RIBBON_POPUP_OPEN);
49
+ if (colorPickerSettings.beforeClose) {
50
+ colorPickerSettings.beforeClose.call(_this);
51
+ }
52
+ },
53
+ beforeOpen: colorPickerSettings.beforeOpen,
54
+ beforeTileRender: colorPickerSettings.beforeTileRender,
55
+ created: colorPickerSettings.created,
56
+ change: colorPickerSettings.change,
57
+ open: function () {
58
+ colorPicker.element.parentElement.classList.add(RIBBON_POPUP_OPEN);
59
+ if (colorPickerSettings.open) {
60
+ colorPickerSettings.open.call(_this);
61
+ }
62
+ },
63
+ select: colorPickerSettings.select
64
+ }, inputEle);
65
+ var wrapper = colorPicker.element.parentElement;
66
+ EventHandler.add(wrapper, 'mouseenter', function () { wrapper.classList.add(RIBBON_HOVER); }, this);
67
+ EventHandler.add(wrapper, 'mouseleave', function () { wrapper.classList.remove(RIBBON_HOVER); }, this);
68
+ };
69
+ /**
70
+ * Adds the additional event handlers as the item moved into overflow popup.
71
+ *
72
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
73
+ * @param {HTMLElement} itemEle - Gets the ribbon item element.
74
+ * @param {DropDownButton} overflowButton - Gets the overflow button.
75
+ * @returns {void}
76
+ * @hidden
77
+ */
78
+ RibbonColorPicker.prototype.addOverFlowEvents = function (item, itemEle, overflowButton) {
79
+ var colorPickerEle = itemEle.querySelector('#' + item.id);
80
+ var colorPickerObj = getComponent(colorPickerEle, ColorPicker);
81
+ colorPickerObj.setProperties({ cssClass: colorPickerObj.cssClass + SPACE + RIBBON_POPUP_CONTROL });
82
+ //Accessing the private property 'splitBtn' of ColorPicker component to get the colorpicker instance as there is no close event in colorpicker.
83
+ var splitBtn = colorPickerObj['splitBtn'];
84
+ splitBtn.close = function () {
85
+ overflowButton.toggle();
86
+ };
87
+ };
88
+ /**
89
+ * Removes the additional event handlers as the item moved from overflow popup.
90
+ *
91
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
92
+ * @param {HTMLElement} itemEle - Gets the ribbon item element.
93
+ * @param {DropDownButton} overflowButton - Gets the overflow button.
94
+ * @returns {void}
95
+ * @hidden
96
+ */
97
+ RibbonColorPicker.prototype.removeOverFlowEvents = function (item, itemEle) {
98
+ var colorPickerEle = itemEle.querySelector('#' + item.id);
99
+ var colorPickerObj = getComponent(colorPickerEle, ColorPicker);
100
+ var cssClass = colorPickerObj.cssClass.split(SPACE);
101
+ cssClass = cssClass.filter(function (value) { return value !== RIBBON_POPUP_CONTROL; });
102
+ colorPickerObj.setProperties({ cssClass: cssClass.join(SPACE) });
103
+ var splitBtn = colorPickerObj['splitBtn'];
104
+ //Accessing the private property 'splitBtn' of ColorPicker component to get the colorpicker instance as there is no close event in colorpicker.
105
+ splitBtn.close = null;
106
+ };
107
+ RibbonColorPicker.prototype.getColorPickerObj = function (controlId) {
108
+ var inputEle = getItemElement(this.parent, controlId);
109
+ return inputEle ? getComponent(inputEle, ColorPicker) : null;
110
+ };
111
+ /**
112
+ * Gets color value in specified type.
113
+ *
114
+ * @param {string} controlId -Gets the control ID.
115
+ * @param {string} value - Specify the color value.
116
+ * @param {string} type - Specify the type to which the specified color needs to be converted.
117
+ * @returns {string} - Returns string.
118
+ */
119
+ RibbonColorPicker.prototype.getValue = function (controlId, value, type) {
120
+ var colorPickerObj = this.getColorPickerObj(controlId);
121
+ return colorPickerObj ? colorPickerObj.getValue(value, type) : '';
122
+ };
123
+ /**
124
+ * To show/hide ColorPicker popup based on current state of the SplitButton.
125
+ *
126
+ * @param {string} controlId - set the id of the control.
127
+ * @returns {void} - Returns void.
128
+ */
129
+ RibbonColorPicker.prototype.toggle = function (controlId) {
130
+ var colorPickerObj = this.getColorPickerObj(controlId);
131
+ if (!colorPickerObj) {
132
+ return;
133
+ }
134
+ colorPickerObj.toggle();
135
+ };
136
+ /**
137
+ * Updates the colorpicker properties.
138
+ *
139
+ * @param {RibbonColorPickerSettingsModel} prop - Gets the colorpicker property.
140
+ * @param {string} id - Gets the ID of colorpicker.
141
+ * @returns {void}
142
+ */
143
+ RibbonColorPicker.prototype.updateColorPicker = function (prop, id) {
144
+ var itemProp = getItem(this.parent.tabs, id);
145
+ if (!itemProp) {
146
+ return;
147
+ }
148
+ merge(itemProp.item.checkBoxSettings, prop);
149
+ var inputEle = getItemElement(this.parent, id, itemProp);
150
+ if (!inputEle) {
151
+ return;
152
+ }
153
+ if (prop.cssClass) {
154
+ prop.cssClass = (RIBBON_CONTROL + SPACE + prop.cssClass).trim();
155
+ }
156
+ delete prop.beforeClose;
157
+ delete prop.open;
158
+ var colorPickerObj = getComponent(inputEle, ColorPicker);
159
+ colorPickerObj.setProperties(prop);
160
+ };
161
+ return RibbonColorPicker;
162
+ }());
163
+ export { RibbonColorPicker };
@@ -0,0 +1,78 @@
1
+ import { FieldSettingsModel } from '@syncfusion/ej2-dropdowns';
2
+ import { Query } from '@syncfusion/ej2-data';
3
+ import { RibbonComboBoxSettingsModel, RibbonItemModel } from '../models/index';
4
+ import { Ribbon } from '../base/index';
5
+ import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
6
+ /**
7
+ * Defines the items of Ribbon.
8
+ */
9
+ export declare class RibbonComboBox {
10
+ private parent;
11
+ constructor(parent: Ribbon);
12
+ protected getModuleName(): string;
13
+ protected destroy(): void;
14
+ /**
15
+ * Creates the combobox.
16
+ *
17
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
18
+ * @param {HTMLElement} itemEle - Gets the ribbon item element.
19
+ * @returns {void}
20
+ * @hidden
21
+ */
22
+ createComboBox(item: RibbonItemModel, itemEle: HTMLElement): void;
23
+ /**
24
+ * Adds the additional event handlers as the item moved into overflow popup.
25
+ *
26
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
27
+ * @param {HTMLElement} itemEle - Gets the ribbon item element.
28
+ * @param {DropDownButton} overflowButton - Gets the overflow button.
29
+ * @returns {void}
30
+ * @hidden
31
+ */
32
+ addOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement, overflowButton: DropDownButton): void;
33
+ /**
34
+ * Removes the additional event handlers as the item moved from overflow popup.
35
+ *
36
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
37
+ * @param {HTMLElement} itemEle - Gets the ribbon item element.
38
+ * @param {DropDownButton} overflowButton - Gets the overflow button.
39
+ * @returns {void}
40
+ * @hidden
41
+ */
42
+ removeOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement): void;
43
+ private getComboBoxObj;
44
+ /**
45
+ * To filter the data from given data source by using query
46
+ *
47
+ * @param {string } controlId - set the id of the control in which methods needs to be called.
48
+ * @param {Object[] } dataSource - Set the data source to filter.
49
+ * @param {Query} query - Specify the query to filter the data.
50
+ * @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
51
+ * @returns {void}
52
+ */
53
+ filter(controlId: string, dataSource: {
54
+ [key: string]: Object;
55
+ }[] | string[] | number[] | boolean[], query?: Query, fields?: FieldSettingsModel): void;
56
+ /**
57
+ * To open/close DropDownButton popup based on current state of the combobox.
58
+ *
59
+ * @param {string} controlId - Gets the id of the control.
60
+ * @returns {void}
61
+ */
62
+ hidePopup(controlId: string): void;
63
+ /**
64
+ * To open/close DropDownButton popup based on current state of the combobox.
65
+ *
66
+ * @param {string} controlId - Gets the id of the control.
67
+ * @returns {void}
68
+ */
69
+ showPopup(controlId: string): void;
70
+ /**
71
+ * Updates the combobox properties.
72
+ *
73
+ * @param {RibbonComboBoxSettingsModel} prop - Gets the combobox property.
74
+ * @param {string} id - Gets the ID of combobox.
75
+ * @returns {void}
76
+ */
77
+ updateComboBox(prop: RibbonComboBoxSettingsModel, id: string): void;
78
+ }
@@ -0,0 +1,185 @@
1
+ import { getComponent, merge } from '@syncfusion/ej2-base';
2
+ import { ComboBox } from '@syncfusion/ej2-dropdowns';
3
+ import { getItem, getItemElement, RIBBON_CONTROL, SPACE, RIBBON_POPUP_CONTROL } from '../base/index';
4
+ /**
5
+ * Defines the items of Ribbon.
6
+ */
7
+ var RibbonComboBox = /** @class */ (function () {
8
+ function RibbonComboBox(parent) {
9
+ this.parent = parent;
10
+ }
11
+ RibbonComboBox.prototype.getModuleName = function () {
12
+ return 'ribbonComboBox';
13
+ };
14
+ RibbonComboBox.prototype.destroy = function () {
15
+ this.parent = null;
16
+ };
17
+ /**
18
+ * Creates the combobox.
19
+ *
20
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
21
+ * @param {HTMLElement} itemEle - Gets the ribbon item element.
22
+ * @returns {void}
23
+ * @hidden
24
+ */
25
+ RibbonComboBox.prototype.createComboBox = function (item, itemEle) {
26
+ var _this = this;
27
+ var inputEle = this.parent.createElement('input', {
28
+ id: item.id
29
+ });
30
+ itemEle.appendChild(inputEle);
31
+ var comboBoxSettings = item.comboBoxSettings;
32
+ new ComboBox({
33
+ locale: this.parent.locale,
34
+ enableRtl: this.parent.enableRtl,
35
+ enablePersistence: this.parent.enablePersistence,
36
+ allowCustom: false,
37
+ floatLabelType: 'Never',
38
+ ignoreAccent: true,
39
+ ignoreCase: true,
40
+ allowFiltering: comboBoxSettings.allowFiltering,
41
+ autofill: comboBoxSettings.autofill,
42
+ cssClass: (RIBBON_CONTROL + SPACE + (comboBoxSettings.cssClass ? comboBoxSettings.cssClass : '')).trim(),
43
+ dataSource: comboBoxSettings.dataSource,
44
+ enabled: !item.disabled,
45
+ fields: comboBoxSettings.fields,
46
+ filterType: comboBoxSettings.filterType,
47
+ footerTemplate: comboBoxSettings.footerTemplate,
48
+ groupTemplate: comboBoxSettings.groupTemplate,
49
+ headerTemplate: comboBoxSettings.headerTemplate,
50
+ index: comboBoxSettings.index,
51
+ itemTemplate: comboBoxSettings.itemTemplate,
52
+ noRecordsTemplate: comboBoxSettings.noRecordsTemplate,
53
+ placeholder: comboBoxSettings.placeholder,
54
+ popupHeight: comboBoxSettings.popupHeight,
55
+ popupWidth: comboBoxSettings.popupWidth,
56
+ showClearButton: comboBoxSettings.showClearButton,
57
+ sortOrder: comboBoxSettings.sortOrder,
58
+ text: comboBoxSettings.text,
59
+ value: comboBoxSettings.value,
60
+ width: comboBoxSettings.width,
61
+ beforeOpen: comboBoxSettings.beforeOpen,
62
+ open: comboBoxSettings.open,
63
+ close: function (e) {
64
+ if (comboBoxSettings.close) {
65
+ comboBoxSettings.close.call(_this, e);
66
+ }
67
+ },
68
+ filtering: comboBoxSettings.filtering,
69
+ change: comboBoxSettings.change,
70
+ select: comboBoxSettings.select,
71
+ created: comboBoxSettings.created
72
+ }, inputEle);
73
+ };
74
+ /**
75
+ * Adds the additional event handlers as the item moved into overflow popup.
76
+ *
77
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
78
+ * @param {HTMLElement} itemEle - Gets the ribbon item element.
79
+ * @param {DropDownButton} overflowButton - Gets the overflow button.
80
+ * @returns {void}
81
+ * @hidden
82
+ */
83
+ RibbonComboBox.prototype.addOverFlowEvents = function (item, itemEle, overflowButton) {
84
+ var _this = this;
85
+ var inputEle = itemEle.querySelector('#' + item.id);
86
+ var comboBoxObj = getComponent(inputEle, ComboBox);
87
+ comboBoxObj.setProperties({ cssClass: comboBoxObj.cssClass + SPACE + RIBBON_POPUP_CONTROL });
88
+ comboBoxObj.close = function (e) {
89
+ if (item.comboBoxSettings.close) {
90
+ item.comboBoxSettings.close.call(_this, e);
91
+ }
92
+ overflowButton.toggle();
93
+ };
94
+ };
95
+ /**
96
+ * Removes the additional event handlers as the item moved from overflow popup.
97
+ *
98
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
99
+ * @param {HTMLElement} itemEle - Gets the ribbon item element.
100
+ * @param {DropDownButton} overflowButton - Gets the overflow button.
101
+ * @returns {void}
102
+ * @hidden
103
+ */
104
+ RibbonComboBox.prototype.removeOverFlowEvents = function (item, itemEle) {
105
+ var _this = this;
106
+ var inputEle = itemEle.querySelector('#' + item.id);
107
+ var comboBoxObj = getComponent(inputEle, ComboBox);
108
+ var cssClass = comboBoxObj.cssClass.split(SPACE);
109
+ cssClass = cssClass.filter(function (value) { return value !== RIBBON_POPUP_CONTROL; });
110
+ comboBoxObj.setProperties({ cssClass: cssClass.join(SPACE) });
111
+ comboBoxObj.close = function (e) {
112
+ if (item.comboBoxSettings.close) {
113
+ item.comboBoxSettings.close.call(_this, e);
114
+ }
115
+ };
116
+ };
117
+ RibbonComboBox.prototype.getComboBoxObj = function (controlId) {
118
+ var inputEle = getItemElement(this.parent, controlId);
119
+ return inputEle ? getComponent(inputEle, ComboBox) : null;
120
+ };
121
+ /**
122
+ * To filter the data from given data source by using query
123
+ *
124
+ * @param {string } controlId - set the id of the control in which methods needs to be called.
125
+ * @param {Object[] } dataSource - Set the data source to filter.
126
+ * @param {Query} query - Specify the query to filter the data.
127
+ * @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
128
+ * @returns {void}
129
+ */
130
+ RibbonComboBox.prototype.filter = function (controlId, dataSource, query, fields) {
131
+ this.getComboBoxObj(controlId).filter(dataSource, query, fields);
132
+ };
133
+ /**
134
+ * To open/close DropDownButton popup based on current state of the combobox.
135
+ *
136
+ * @param {string} controlId - Gets the id of the control.
137
+ * @returns {void}
138
+ */
139
+ RibbonComboBox.prototype.hidePopup = function (controlId) {
140
+ var comboBoxObj = this.getComboBoxObj(controlId);
141
+ if (!comboBoxObj) {
142
+ return;
143
+ }
144
+ comboBoxObj.hidePopup();
145
+ };
146
+ /**
147
+ * To open/close DropDownButton popup based on current state of the combobox.
148
+ *
149
+ * @param {string} controlId - Gets the id of the control.
150
+ * @returns {void}
151
+ */
152
+ RibbonComboBox.prototype.showPopup = function (controlId) {
153
+ var comboBoxObj = this.getComboBoxObj(controlId);
154
+ if (!comboBoxObj) {
155
+ return;
156
+ }
157
+ comboBoxObj.showPopup();
158
+ };
159
+ /**
160
+ * Updates the combobox properties.
161
+ *
162
+ * @param {RibbonComboBoxSettingsModel} prop - Gets the combobox property.
163
+ * @param {string} id - Gets the ID of combobox.
164
+ * @returns {void}
165
+ */
166
+ RibbonComboBox.prototype.updateComboBox = function (prop, id) {
167
+ var itemProp = getItem(this.parent.tabs, id);
168
+ if (!itemProp) {
169
+ return;
170
+ }
171
+ merge(itemProp.item.comboBoxSettings, prop);
172
+ var inputEle = getItemElement(this.parent, id, itemProp);
173
+ if (!inputEle) {
174
+ return;
175
+ }
176
+ if (prop.cssClass) {
177
+ prop.cssClass = (RIBBON_CONTROL + SPACE + prop.cssClass).trim();
178
+ }
179
+ delete prop.close;
180
+ var comboBoxObj = getComponent(inputEle, ComboBox);
181
+ comboBoxObj.setProperties(prop);
182
+ };
183
+ return RibbonComboBox;
184
+ }());
185
+ export { RibbonComboBox };