@componyx/ui 0.0.0-stage → 1.0.3

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 (169) hide show
  1. package/AppSkin/AppSkin.css +1268 -0
  2. package/AppSkin/AppSkin.js +2748 -0
  3. package/AppSkin/Themes/Default.css +241 -0
  4. package/Base/Base.js +3407 -0
  5. package/Base/ComponentIcons.css +66 -0
  6. package/Base/Font/ComponentIcons.woff +0 -0
  7. package/Base/Font/UI.woff +0 -0
  8. package/Base/Library.js +8432 -0
  9. package/Base/NavigationManager.js +462 -0
  10. package/Base/ResponsiveTemplates.js +371 -0
  11. package/Base/Sanitizer.js +288 -0
  12. package/Base/Themes/Default.css +255 -0
  13. package/Base/UI.css +618 -0
  14. package/Base/UIResourcePath.js +6 -0
  15. package/Bindary/Bindary.js +2011 -0
  16. package/Bindary/Modules/Connection.js +216 -0
  17. package/Bindary/Modules/Core.js +854 -0
  18. package/Bindary/Modules/DataUpdater.js +351 -0
  19. package/Bindary/Modules/ExpressionEngine.js +347 -0
  20. package/Bindary/Modules/ProxyManager.js +482 -0
  21. package/Bindary/Modules/Renderer.js +605 -0
  22. package/Bindary/Modules/Router.js +291 -0
  23. package/Bindary/Modules/Scroller.js +89 -0
  24. package/Bindary/Modules/Template.js +1273 -0
  25. package/BookmarkSpy/BookmarkSpy.js +430 -0
  26. package/Box/Box.css +36 -0
  27. package/Box/Box.js +1685 -0
  28. package/Button/Button.css +470 -0
  29. package/Button/Button.js +1398 -0
  30. package/Button/Themes/Default.css +200 -0
  31. package/Carousel/Carousel.css +273 -0
  32. package/Carousel/Carousel.js +607 -0
  33. package/ColorButton/ColorButton.css +39 -0
  34. package/ColorButton/ColorButton.js +336 -0
  35. package/ColorPicker/ColorPicker.css +359 -0
  36. package/ColorPicker/ColorPicker.js +972 -0
  37. package/ComboBox/ComboBox.css +357 -0
  38. package/ComboBox/ComboBox.js +2342 -0
  39. package/ComboBox/Themes/Default.css +23 -0
  40. package/DataPager/DataPager.css +72 -0
  41. package/DataPager/DataPager.js +674 -0
  42. package/DatePicker/DatePicker.css +227 -0
  43. package/DatePicker/DatePicker.js +1531 -0
  44. package/DatePicker/Themes/Default.css +26 -0
  45. package/Dialog/Dialog.css +106 -0
  46. package/Dialog/Dialog.js +572 -0
  47. package/Dialog/Themes/Default.css +10 -0
  48. package/Editor/Data/Emoji.json +8285 -0
  49. package/Editor/Data/Special.json +1042 -0
  50. package/Editor/Editor.css +1562 -0
  51. package/Editor/Editor.js +4058 -0
  52. package/Editor/Font/Editor.woff +0 -0
  53. package/Editor/Modules/ComponentFactory.js +565 -0
  54. package/Editor/Modules/ContentManager.js +748 -0
  55. package/Editor/Modules/DialogManager.js +1234 -0
  56. package/Editor/Modules/EventManager.js +458 -0
  57. package/Editor/Modules/Format.js +950 -0
  58. package/Editor/Modules/History.js +191 -0
  59. package/Editor/Modules/LayoutState.js +379 -0
  60. package/Editor/Modules/ListManager.js +296 -0
  61. package/Editor/Modules/MenuManager.js +388 -0
  62. package/Editor/Modules/NodeManager.js +681 -0
  63. package/Editor/Modules/ParagraphButtons.js +122 -0
  64. package/Editor/Modules/Resizer.js +176 -0
  65. package/Editor/Modules/SelectionRange.js +564 -0
  66. package/Editor/Modules/SourceViewBuilder.js +212 -0
  67. package/Editor/Modules/SymbolPicker.js +208 -0
  68. package/Editor/Modules/Table.js +2327 -0
  69. package/Editor/Modules/TableDialog.js +757 -0
  70. package/Editor/Modules/Toolbar.js +375 -0
  71. package/Editor/Modules/TooltipMenu.js +125 -0
  72. package/Editor/Modules/Utility.js +131 -0
  73. package/Editor/Themes/Default.css +204 -0
  74. package/FileUpload/FileUpload.css +156 -0
  75. package/FileUpload/FileUpload.js +898 -0
  76. package/FileUpload/Themes/Default.css +17 -0
  77. package/Form/Form.css +1934 -0
  78. package/Form/Form.js +4943 -0
  79. package/Form/Modules/ActionManager.js +368 -0
  80. package/Form/Modules/BuildPanelManager.js +319 -0
  81. package/Form/Modules/ComponentFactory.js +468 -0
  82. package/Form/Modules/ComponentPanel.js +265 -0
  83. package/Form/Modules/ConfigPanelManager.js +685 -0
  84. package/Form/Modules/DataObserver.js +717 -0
  85. package/Form/Modules/Databinder.js +602 -0
  86. package/Form/Modules/Draggable.js +756 -0
  87. package/Form/Modules/OptionsPanel.js +342 -0
  88. package/Form/Modules/Renderer.js +1889 -0
  89. package/Form/Modules/RuleEngine.js +585 -0
  90. package/Form/Modules/RulesPanel.js +1158 -0
  91. package/Form/Modules/Types.js +1709 -0
  92. package/Form/Modules/ValidationManager.js +194 -0
  93. package/Form/Themes/Default.css +216 -0
  94. package/FormField/FormField.css +468 -0
  95. package/FormField/FormField.js +576 -0
  96. package/FormField/Themes/Default.css +99 -0
  97. package/Grid/Grid.css +544 -0
  98. package/Grid/Grid.js +3761 -0
  99. package/Grid/Themes/Default.css +43 -0
  100. package/LICENSE +126 -0
  101. package/MaskedTextBox/MaskedTextBox.css +28 -0
  102. package/MaskedTextBox/MaskedTextBox.js +642 -0
  103. package/MaskedTextBox/Themes/Default.css +6 -0
  104. package/Menu/Menu.css +328 -0
  105. package/Menu/Menu.js +2386 -0
  106. package/Menu/Themes/Default.css +24 -0
  107. package/NumericBox/NumericBox.css +120 -0
  108. package/NumericBox/NumericBox.js +984 -0
  109. package/PanelBar/PanelBar.css +123 -0
  110. package/PanelBar/PanelBar.js +505 -0
  111. package/PanelBar/Themes/Default.css +51 -0
  112. package/PieChart/PieChart.css +95 -0
  113. package/PieChart/PieChart.js +820 -0
  114. package/PieChart/Themes/Default.css +9 -0
  115. package/README.md +178 -3
  116. package/Slider/Slider.css +348 -0
  117. package/Slider/Slider.js +1306 -0
  118. package/Slider/Themes/Default.css +44 -0
  119. package/TabStrip/TabStrip.css +52 -0
  120. package/TabStrip/TabStrip.js +362 -0
  121. package/TabStrip/Themes/Default.css +35 -0
  122. package/TimePicker/Themes/Default.css +30 -0
  123. package/TimePicker/TimePicker.css +253 -0
  124. package/TimePicker/TimePicker.js +1485 -0
  125. package/TooltipManager/Themes/Default.css +21 -0
  126. package/TooltipManager/TooltipManager.css +227 -0
  127. package/TooltipManager/TooltipManager.js +791 -0
  128. package/Validator/Validator.css +54 -0
  129. package/Validator/Validator.js +2508 -0
  130. package/componyx.html-data.json +619 -0
  131. package/index.js +27 -0
  132. package/package.json +43 -4
  133. package/types/AppSkin.d.ts +842 -0
  134. package/types/Base.d.ts +1034 -0
  135. package/types/Bindary.d.ts +1196 -0
  136. package/types/BookmarkSpy.d.ts +112 -0
  137. package/types/Box.d.ts +374 -0
  138. package/types/Button.d.ts +455 -0
  139. package/types/Carousel.d.ts +136 -0
  140. package/types/ColorButton.d.ts +120 -0
  141. package/types/ColorPicker.d.ts +225 -0
  142. package/types/ComboBox.d.ts +507 -0
  143. package/types/DataPager.d.ts +152 -0
  144. package/types/DatePicker.d.ts +354 -0
  145. package/types/Dialog.d.ts +160 -0
  146. package/types/Editor.d.ts +1289 -0
  147. package/types/FileUpload.d.ts +206 -0
  148. package/types/Form.d.ts +3078 -0
  149. package/types/FormField.d.ts +204 -0
  150. package/types/Grid.d.ts +911 -0
  151. package/types/Library.d.ts +1899 -0
  152. package/types/MaskedTextBox.d.ts +91 -0
  153. package/types/Menu.d.ts +577 -0
  154. package/types/NumericBox.d.ts +310 -0
  155. package/types/PanelBar.d.ts +223 -0
  156. package/types/PieChart.d.ts +224 -0
  157. package/types/ResponsiveTemplates.d.ts +108 -0
  158. package/types/Slider.d.ts +227 -0
  159. package/types/TabStrip.d.ts +185 -0
  160. package/types/TimePicker.d.ts +265 -0
  161. package/types/TooltipManager.d.ts +178 -0
  162. package/types/UI.d.ts +29 -0
  163. package/types/Validator.d.ts +653 -0
  164. package/types/index.d.ts +59 -0
  165. package/ui.css +11783 -0
  166. package/ui.js +79477 -0
  167. package/ui.min.css +138 -0
  168. package/ui.min.js +264 -0
  169. package/ui.min.js.map +1 -0
@@ -0,0 +1,26 @@
1
+ /*! Componyx.UI | (c) E.H. Daanen / Componyx | BUSL-1.1 | componyx.com/license */
2
+ .date-picker.theme.theme-default .dialog.theme table th,
3
+ .date-picker.theme.theme-default .dialog.theme table td.week-number,
4
+ .date-picker.theme.theme-default .dialog.theme .box.dialog-box div.content div.footer
5
+ {
6
+ color: var(--cui-base-text-color);
7
+ background: var(--cui-base-bg-color);
8
+ }
9
+
10
+ .date-picker.theme.theme-default tr:not(.disabled):not(.selected):hover > td
11
+ {
12
+ color: var(--cui-item-hover-text-color);
13
+ background: var(--cui-item-hover-bg-color);
14
+ }
15
+
16
+ .date-picker.theme.theme-default tr.selected:not(.select-all) > td
17
+ {
18
+ color: var(--cui-item-selected-text-color);
19
+ background: var(--cui-item-selected-bg-color);
20
+ }
21
+
22
+ .date-picker.theme.theme-default tr.selected:not(.select-all):hover > td
23
+ {
24
+ color: var(--cui-item-selected-hover-text-color);
25
+ background: var(--cui-item-selected-hover-bg-color);
26
+ }
@@ -0,0 +1,106 @@
1
+ /*! Componyx.UI | (c) E.H. Daanen / Componyx | BUSL-1.1 | componyx.com/license */
2
+ .dialog.theme
3
+ {
4
+ --header-height: 36px;
5
+ }
6
+
7
+ .dialog.theme .box.dialog-box
8
+ {
9
+ display: block;
10
+ z-index: 9;
11
+ min-width: 300px;
12
+ }
13
+
14
+ .dialog.theme.collapsed .box.dialog-box
15
+ {
16
+ height: 0px;
17
+ }
18
+
19
+ .dialog.theme .box.dialog-box > div.content
20
+ {
21
+ position: relative;
22
+ }
23
+
24
+ .dialog.theme.collapsed .box.dialog-box > div.content div.content-holder,
25
+ .dialog.theme.collapsed .box.dialog-box > div.content div.footer
26
+ {
27
+ display: none;
28
+ }
29
+
30
+ .dialog.theme .box.dialog-box > div.content
31
+ {
32
+ height: 100%;
33
+ }
34
+
35
+ .dialog.theme .box.dialog-box > div.content > div
36
+ {
37
+ display: flex;
38
+ flex-direction: column;
39
+ height: 100%;
40
+ }
41
+
42
+ .dialog.theme .box.dialog-box > div.content > div > div.header
43
+ {
44
+ order: 1;
45
+ position: relative;
46
+ height: var(--header-height);
47
+ line-height: var(--header-height);
48
+ border-bottom-left-radius: 0;
49
+ border-bottom-right-radius: 0;
50
+ padding-left: 1rem;
51
+ }
52
+
53
+ .dialog.theme .box.dialog-box > div.content > div > div.footer
54
+ {
55
+ order: 3;
56
+ padding: 8px;
57
+ text-align: right;
58
+ background: transparent;
59
+ }
60
+
61
+ .dialog.theme .box.dialog-box > div.content > div > div.header > *
62
+ {
63
+ line-height: 28px;
64
+ vertical-align: top;
65
+ display: inline-block;
66
+ position: relative;
67
+ top: 50%;
68
+ transform: translateY(-50%);
69
+ }
70
+
71
+ .dialog.theme .box.dialog-box > div.content > div > div.header > div.button-holder
72
+ {
73
+ position: absolute;
74
+ right: 8px;
75
+ }
76
+
77
+ .dialog.theme .box.dialog-box > div.content > div > div.footer > div.button-holder .button.theme
78
+ {
79
+ margin-left: 8px;
80
+ }
81
+
82
+ .dialog.theme .box.dialog-box > div.content > div > div.content-holder
83
+ {
84
+ position: relative;
85
+ order: 2;
86
+ padding-top: 1rem;
87
+ padding-left: 1rem;
88
+ padding-right: 1rem;
89
+ padding-bottom: 1rem;
90
+ max-width: 90vw;
91
+ max-height: calc(90vh - (var(--header-height) + 46px + 2rem)); /* view height minus (header + footer + padding) */
92
+ overflow: auto;
93
+ flex: 1;
94
+ }
95
+
96
+ /* close button icon */
97
+ .dialog.theme .box.dialog-box .button.theme.close span.icon::after
98
+ {
99
+ font-family: 'UI';
100
+ content: '\e90a';
101
+ }
102
+
103
+ .dialog.theme .box.dialog-box
104
+ {
105
+ background: none;
106
+ }
@@ -0,0 +1,572 @@
1
+ /*! Componyx.UI | (c) E.H. Daanen / Componyx | BUSL-1.1 | componyx.com/license */
2
+ import '../Base/Base.js';
3
+ import '../Base/Library.js';
4
+ import '../Box/Box.js';
5
+ import '../Button/Button.js';
6
+
7
+ (function (window)
8
+ {
9
+ /**
10
+ * Dialog class.
11
+ * @class
12
+ * @memberof componyx.UI
13
+ * @augments componyx.UI.Box
14
+ * @mixes componyx.UI.base.methods
15
+ * @param {String} id The id of the component.
16
+ * @param {Object|HTMLElement} properties The properties used to initialize the component or the container element.
17
+ * @returns {Object} An instance of the component.
18
+ */
19
+ componyx.UI.Dialog = function Dialog(id, properties)
20
+ {
21
+ // define private properties
22
+ var _instance = this;
23
+ $base.static.ThemeOption;
24
+
25
+ // define public properties
26
+ /**
27
+ * Gets or sets the css class of the box, which is used for the dialog layout.
28
+ * @type {String}
29
+ */
30
+ this.cssClassBox = '';
31
+
32
+ /**
33
+ * Gets or sets the css class of the content header.
34
+ * @type {String}
35
+ */
36
+ this.cssClassContentHeader = '';
37
+
38
+ /**
39
+ * Gets or sets the css class of the content footer.
40
+ * @type {String}
41
+ */
42
+ this.cssClassContentFooter = '';
43
+
44
+ /**
45
+ * Gets or sets the css class of the content holder.
46
+ * @type {String}
47
+ */
48
+ this.cssClassContentHolder = '';
49
+
50
+ /**
51
+ * Gets or sets the css class of the button holder for both the header and footer of the dialog.
52
+ * @type {String}
53
+ */
54
+ this.cssClassButtonHolder = '';
55
+
56
+ /**
57
+ * Gets or sets a value indicating whether the dialog will be automatically closed on a button event.
58
+ * @type {Boolean}
59
+ */
60
+ this.autoClose = true;
61
+
62
+ /**
63
+ * Gets or sets a value indicating whether the dialog confirm action is executed when the enter-key is pressed within a field inside the box element.
64
+ * @type {Boolean}
65
+ */
66
+ this.confirmOnEnterKey = true;
67
+
68
+ /**
69
+ * Gets or sets the button settings.
70
+ * @type {Object}
71
+ */
72
+ this.buttons = {
73
+ /**
74
+ * Gets or sets a value indicating if the close button is displayed.
75
+ * @type {Boolean}
76
+ */
77
+ close: true,
78
+
79
+ /**
80
+ * Gets or sets a value indicating if the confirm button is displayed.
81
+ * @type {Boolean}
82
+ */
83
+ confirm: true,
84
+
85
+ /**
86
+ * Gets or sets a value indicating if the deny button is displayed.
87
+ * @type {Boolean}
88
+ */
89
+ deny: true,
90
+
91
+ /**
92
+ * Gets or sets a value indicating if the cancel button is displayed.
93
+ * @type {Boolean}
94
+ */
95
+ cancel: true,
96
+
97
+ /**
98
+ * Gets or sets the confirm button text.
99
+ * @type {String}
100
+ */
101
+ confirmText: 'OK',
102
+
103
+ /**
104
+ * Gets or sets the deny button text.
105
+ * @type {String}
106
+ */
107
+ denyText: 'No',
108
+
109
+ /**
110
+ * Gets or sets the cancel button text.
111
+ * @type {String}
112
+ */
113
+ cancelText: 'Cancel',
114
+
115
+ /**
116
+ * Gets or sets the id of the button component used as base for the close button.
117
+ * @type {String|null}
118
+ */
119
+ closeButtonId: null,
120
+
121
+ /**
122
+ * Gets or sets the id of the button component used as base for the confirm button.
123
+ * @type {String|null}
124
+ */
125
+ confirmButtonId: null,
126
+
127
+ /**
128
+ * Gets or sets the id of the button component used as base for the deny button.
129
+ * @type {String|null}
130
+ */
131
+ denyButtonId: null,
132
+
133
+ /**
134
+ * Gets or sets the id of the button component used as base for the cancel button.
135
+ * @type {String|null}
136
+ */
137
+ cancelButtonId: null,
138
+ };
139
+
140
+ /**
141
+ * @class
142
+ * @augments componyx.UI.base.Events
143
+ * @memberof componyx.UI.Dialog
144
+ * @property {componyx.UI.base.Event} onConfirm - Event which fires when the dialog is confirmed. @see {@link componyx.UI.Dialog.DialogEventArgs}
145
+ * @property {componyx.UI.base.Event} onDeny - Event which fires when the dialog is denied. @see {@link componyx.UI.Dialog.DialogEventArgs}
146
+ * @property {componyx.UI.base.Event} onCancel - Event which fires when the dialog is cancelled. @see {@link componyx.UI.Dialog.DialogEventArgs}
147
+ * @property {componyx.UI.base.Event} onClose - Event which fires when the dialog is closed. @see {@link componyx.UI.Dialog.DialogEventArgs}
148
+ * @property {componyx.UI.base.Event} onShowComplete - Event which fires when the show animation has completed. Also called when animation type is 'none'. @see {@link componyx.UI.Dialog.DialogEventArgs}
149
+ * @property {componyx.UI.base.Event} onHideComplete - Event which fires when the hide animation has completed. Also called when animation type is 'none'. @see {@link componyx.UI.Dialog.DialogEventArgs}
150
+ * @see {@link componyx.UI.base.Events}
151
+ */
152
+ function DialogEvents(events)
153
+ {
154
+ Object.assign(this, events);
155
+
156
+ this.onConfirm = $base.static.createEvent('onConfirm');
157
+ this.onDeny = $base.static.createEvent('onDeny');
158
+ this.onCancel = $base.static.createEvent('onCancel');
159
+ this.onClose = $base.static.createEvent('onClose');
160
+ this.onShowComplete = $base.static.createEvent('onShowComplete');
161
+ this.onHideComplete = $base.static.createEvent('onHideComplete');
162
+ }
163
+ /**
164
+ * Dialog events
165
+ * @type {componyx.UI.Dialog.DialogEvents}
166
+ */
167
+ this.events = new DialogEvents(this.events);
168
+
169
+ /**
170
+ * @typedef {Object} componyx.UI.Dialog.DialogEventArgs
171
+ * @property {componyx.UI.Dialog} Dialog - The Dialog instance.
172
+ */
173
+
174
+ // inherit base and box members
175
+ $base.Component.apply(this, [id, properties, componyx.UI.Box]);
176
+
177
+ /**
178
+ * Sets the header template
179
+ * @param {HTMLElement|HTMLElement[]|DocumentFragment|String} content HTML string or element node as content. Pass null or empty string to remove the existing template.
180
+ * @see {@link componyx.UI.base.addTemplate}
181
+ */
182
+ this.setHeaderTemplate = function (content)
183
+ {
184
+ _instance.addTemplate('Header', content, false);
185
+ };
186
+
187
+ /**
188
+ * Sets the footer template
189
+ * @param {HTMLElement|HTMLElement[]|DocumentFragment|String} content HTML string or element node as content. Pass null or empty string to remove the existing template.
190
+ * @see {@link componyx.UI.base.addTemplate}
191
+ */
192
+ this.setFooterTemplate = function (content)
193
+ {
194
+ _instance.addTemplate('Footer', content, false);
195
+ };
196
+
197
+ /**
198
+ * Sets the content template
199
+ * @param {HTMLElement|HTMLElement[]|DocumentFragment|String} content HTML string or element node as content. Pass null or empty string to remove the existing template.
200
+ * @see {@link componyx.UI.base.addTemplate}
201
+ */
202
+ this.setContentTemplate = function (content)
203
+ {
204
+ _instance.addTemplate('Content', content, false);
205
+ };
206
+
207
+ /**
208
+ * Gets the underlaying box component.
209
+ * @returns {componyx.UI.Box}
210
+ */
211
+ this.getBox = function ()
212
+ {
213
+ return $UI.store[_instance.id + '_Box'];
214
+ };
215
+
216
+ /**
217
+ * Shows the component.
218
+ */
219
+ this.show = function ()
220
+ {
221
+ $base.methods.show.call(_instance);
222
+ show();
223
+ };
224
+
225
+ /**
226
+ * Shows the dialog in confirmation mode.
227
+ * @param {Function} callBack A callback function to invoke after confirmation.
228
+ * @param {HTMLElement|HTMLElement[]|DocumentFragment|String} [header] HTML string or element node as content.
229
+ * @param {HTMLElement|HTMLElement[]|DocumentFragment|String} [content] HTML string or element node as content.
230
+ * @param {HTMLElement|HTMLElement[]|DocumentFragment|String} [footer] HTML string or element node as content.
231
+ * @param {String} [confirmText] The text of the confirmation button.
232
+ * @param {String} [denyText] The text of the deny button.
233
+ */
234
+ this.confirm = function (callBack, header, content, footer, confirmText, denyText)
235
+ {
236
+ _instance.destroy();
237
+
238
+ _instance.buttons.cancel = false;
239
+ _instance.buttons.confirmText = (confirmText) ? confirmText : this.buttons.confirmText;
240
+ _instance.buttons.denyText = (denyText) ? denyText : this.buttons.denyText;
241
+ _instance.autoClose = _instance.modal = true;
242
+ _instance.autoPosition = _instance.autoPosition || componyx.UI.Box.AutoPositionOption.CENTER;
243
+
244
+ if (callBack)
245
+ {
246
+ _instance.events.onConfirm.priorityAdd(callBack, [_instance, true], true);
247
+ _instance.events.onDeny.priorityAdd(callBack, [_instance, false], true);
248
+ }
249
+
250
+ if (header)
251
+ _instance.setHeaderTemplate(header);
252
+
253
+ if (content)
254
+ _instance.setContentTemplate(content);
255
+
256
+ if (footer)
257
+ _instance.setFooterTemplate(footer);
258
+
259
+ _instance.show();
260
+ };
261
+
262
+ /**
263
+ * Shows the dialog in alert mode.
264
+ * @param {Function} callBack A callback function to invoke after confirmation.
265
+ * @param {HTMLElement|HTMLElement[]|DocumentFragment|String} [header] HTML string or element node as content.
266
+ * @param {HTMLElement|HTMLElement[]|DocumentFragment|String} [content] HTML string or element node as content.
267
+ * @param {HTMLElement|HTMLElement[]|DocumentFragment|String} [footer] HTML string or element node as content.
268
+ * @param {String} [confirmText] The text of the confirmation button.
269
+ */
270
+ this.alert = function (callBack, header, content, footer, confirmText)
271
+ {
272
+ _instance.destroy();
273
+
274
+ _instance.buttons.deny = _instance.buttons.cancel = false;
275
+ _instance.buttons.confirmText = (confirmText) ? confirmText : this.buttons.confirmText;
276
+ _instance.autoClose = _instance.modal = true;
277
+ _instance.autoPosition = _instance.autoPosition || componyx.UI.Box.AutoPositionOption.CENTER;
278
+
279
+ if (callBack)
280
+ _instance.events.onConfirm.priorityAdd(callBack, [_instance]);
281
+
282
+ if (header)
283
+ _instance.setHeaderTemplate(header);
284
+
285
+ if (content)
286
+ _instance.setContentTemplate(content);
287
+
288
+ if (footer)
289
+ _instance.setFooterTemplate(footer);
290
+
291
+ _instance.show();
292
+ };
293
+
294
+ /**
295
+ * Hides the component
296
+ */
297
+ this.hide = function ()
298
+ {
299
+ hide();
300
+ };
301
+
302
+ /**
303
+ * Renders the component
304
+ */
305
+ this.render = function ()
306
+ {
307
+ if (_instance.renderState != $base.static.RenderState.RENDERING)
308
+ {
309
+ // call base render and return
310
+ $base.methods.render.call(_instance, preRender, 'dialog');
311
+ return;
312
+ }
313
+
314
+ // render logic after loading resources
315
+ if (_instance.ajax.load && _instance.ajax.load.isDefined())
316
+ load();
317
+ else
318
+ draw();
319
+ };
320
+
321
+ /**
322
+ * Executes the post render procedure.
323
+ */
324
+ this.postRender = function ()
325
+ {
326
+ if (_instance.renderState == $base.static.RenderState.RENDERED)
327
+ return;
328
+
329
+ $base.methods.postRender.call(_instance);
330
+ };
331
+
332
+ /**
333
+ * Destroys the component.
334
+ * @see {@link componyx.UI.base.methods#destroy}
335
+ */
336
+ this.destroy = function (...args)
337
+ {
338
+ var store = $UI.store;
339
+
340
+ // destroy box to complete possible animation and fire hide complete event
341
+ if (store[_instance.id + '_Box'])
342
+ store[_instance.id + '_Box'].destroy();
343
+
344
+ $base.methods.destroy.call(this, ...args);
345
+ };
346
+
347
+
348
+ function show()
349
+ {
350
+ _instance.showing = true;
351
+
352
+ if (_instance.renderState != $base.static.RenderState.RENDERED)
353
+ return;
354
+
355
+ var box = $UI.store[_instance.id + '_Box'];
356
+ box.style = _instance.style;
357
+ box.top = _instance.top;
358
+ box.right = _instance.right;
359
+ box.bottom = _instance.bottom;
360
+ box.left = _instance.left;
361
+ box.width = _instance.width;
362
+ box.height = _instance.height;
363
+ box.autoPosition = $lib.isEmpty(_instance.autoPosition) ? componyx.UI.Box.AutoPositionOption.CENTER : _instance.autoPosition;
364
+ box.expander = _instance.expander;
365
+ box.autoFit = _instance.autoFit;
366
+ box.autoInvertFit = _instance.autoInvertFit;
367
+ box.autoResizeFit = _instance.autoResizeFit;
368
+ box.invertMarginHorizontal = _instance.invertMarginHorizontal;
369
+ box.invertMarginVertical = _instance.invertMarginVertical;
370
+ box.show();
371
+ }
372
+
373
+ function hide()
374
+ {
375
+ if (!_instance.showing)
376
+ return;
377
+
378
+ _instance.showing = false;
379
+ _instance.events.onHide.fire(_instance);
380
+
381
+ if (_instance.renderState != $base.static.RenderState.RENDERED)
382
+ return;
383
+
384
+ var box = $UI.store[_instance.id + '_Box'];
385
+
386
+ if (box.showing)
387
+ box.hide();
388
+ }
389
+
390
+ function showComplete()
391
+ {
392
+ _instance.events.onShowComplete.fire(_instance);
393
+ }
394
+
395
+ function hideComplete()
396
+ {
397
+ _instance.showing = false;
398
+ $base.methods.hide.call(_instance, false);
399
+ _instance.events.onHideComplete.fire(_instance);
400
+ }
401
+
402
+ function preRender()
403
+ {
404
+ // initialize script and css
405
+ return ['Dialog', ['Box', 'Button']];
406
+ }
407
+
408
+ function load(parentItem, initialLoad)
409
+ {
410
+ _instance.ajaxCall('load', null, { onSuccess: dataLoaded });
411
+ }
412
+
413
+ function dataLoaded(ajaxArgs)
414
+ {
415
+ draw(ajaxArgs.data);
416
+ }
417
+
418
+ function draw(data)
419
+ {
420
+ $lib.setStyle(_instance.element, '');
421
+
422
+ createBox(data);
423
+ _instance.renderChildren();
424
+ }
425
+
426
+ function createBox(data)
427
+ {
428
+ var box = $UI.createComponent(componyx.UI.Box, { id: _instance.id + '_Box' });
429
+ var divContent = document.createElement('div');
430
+ var divHeader = document.createElement('div');
431
+ var divHeaderButtonHolder = document.createElement('div');
432
+ var divContentHolder = document.createElement('div');
433
+ var divFooter = document.createElement('div');
434
+ var divFooterButtonHolder = document.createElement('div');
435
+
436
+ divHeader.id = _instance.id + '_Header';
437
+ divHeader.className = _instance.cssClassContentHeader || 'header';
438
+ divContentHolder.className = _instance.cssClassContentHolder || 'content-holder';
439
+ divFooter.className = _instance.cssClassContentFooter || 'footer';
440
+ divHeaderButtonHolder.id = _instance.id + '_HButtonHolder';
441
+ divFooterButtonHolder.id = _instance.id + '_FButtonHolder';
442
+ divFooterButtonHolder.className = divHeaderButtonHolder.className = _instance.cssClassButtonHolder || 'button-holder';
443
+
444
+ _instance.applyTemplate(divHeader, 'Header');
445
+ _instance.applyTemplate(divFooter, 'Footer');
446
+
447
+ if (data)
448
+ {
449
+ divContentHolder.innerHTML = data;
450
+ }
451
+ else
452
+ {
453
+ _instance.applyTemplate(divContentHolder, 'Content');
454
+ }
455
+
456
+ divHeader.appendChild(divHeaderButtonHolder);
457
+ divFooter.appendChild(divFooterButtonHolder);
458
+ createButtons(divHeaderButtonHolder, divFooterButtonHolder);
459
+
460
+ divContent.appendChild(divContentHolder);
461
+ divContent.appendChild(divFooter);
462
+ divContent.appendChild(divHeader);
463
+
464
+ // copy dialog properties to the box
465
+ box.clone(_instance, _instance, false, false);
466
+ box.containerElement = _instance.element;
467
+ box.element = null;
468
+ box.renderState = $base.static.RenderState.NONE;
469
+ box.theme = $base.static.ThemeOption.NONE;
470
+ box.cssClass = _instance.cssClassBox || 'box dialog-box';
471
+ box.setContentTemplate(divContent);
472
+ box.showing = false;
473
+ box.dragSettings.dragHandle = divHeader.id;
474
+ box.events.onPostRender.priorityAdd(() => { _instance.isReady.apply(_instance); }, null);
475
+ box.events.onHide.priorityAdd(hide, null);
476
+ box.events.onShowComplete.priorityAdd(function (args) { showComplete(); }, null);
477
+ box.events.onHideComplete.priorityAdd(function (args) { hideComplete(); }, null);
478
+ }
479
+
480
+ function createButtons(header, footer)
481
+ {
482
+ if (_instance.buttons.close)
483
+ createButton(_instance.id + '_Close', _instance.buttons.closeButtonId, header, close, { cssClass: 'close', hasIcon: true, primary: true });
484
+
485
+ if (_instance.buttons.confirm)
486
+ createButton(_instance.id + '_Confirm', _instance.buttons.confirmButtonId, footer, confirm, { cssClass: 'confirm', text: _instance.buttons.confirmText, primary: true });
487
+
488
+ if (_instance.buttons.deny)
489
+ createButton(_instance.id + '_Deny', _instance.buttons.denyButtonId, footer, deny, { cssClass: 'deny', text: _instance.buttons.denyText });
490
+
491
+ if (_instance.buttons.cancel)
492
+ createButton(_instance.id + '_Cancel', _instance.buttons.cancelButtonId, footer, cancel, { cssClass: 'cancel', text: _instance.buttons.cancelText });
493
+ }
494
+
495
+ function createButton(id, cloneId, container, command, props)
496
+ {
497
+ let button = $UI.createComponent(componyx.UI.Button, { id: id, containerElement: container });
498
+
499
+ button.clone($UI.store[cloneId], _instance);
500
+ button.transparentBorder = button.primary = (props.primary) ? true : false;
501
+ button.cssClass = button.cssClass || props.cssClass || '';
502
+
503
+ if (!button.hasIcon)
504
+ button.hasIcon = button.transparent = props.hasIcon;
505
+
506
+ button.text = button.text || props.text || '';
507
+ button.events.onPostRender.priorityAdd(function (command, button, args)
508
+ {
509
+ var buttonCommand = button.command;
510
+ button.command = function ()
511
+ {
512
+ var returnValue = true;
513
+
514
+ if (buttonCommand)
515
+ returnValue = buttonCommand(button, args);
516
+
517
+ if (!$lib.isEmpty(returnValue) && returnValue == false)
518
+ return false;
519
+
520
+ command();
521
+ }.bind(_instance);
522
+
523
+ if (_instance.confirmOnEnterKey && id.indexOf('_Confirm') > -1)
524
+ $UI.store[_instance.id + '_Box'].enterKeySubmitter = button.getCommandButton();
525
+
526
+ }.bind(_instance, command), null);
527
+
528
+ button.events.onPostRender.priorityAdd(() => { _instance.isReady.apply(_instance); }, null);
529
+ button.showing = true;
530
+ }
531
+
532
+ function close()
533
+ {
534
+ _instance.events.onClose.fire(_instance);
535
+ _instance.hide();
536
+ }
537
+
538
+ function confirm()
539
+ {
540
+ _instance.events.onConfirm.fire(_instance);
541
+
542
+ if (_instance.autoClose)
543
+ close();
544
+ }
545
+
546
+ function deny()
547
+ {
548
+ _instance.events.onDeny.fire(_instance);
549
+
550
+ if (_instance.autoClose)
551
+ close();
552
+ }
553
+
554
+ function cancel()
555
+ {
556
+ _instance.events.onCancel.fire(_instance);
557
+
558
+ if (_instance.autoClose)
559
+ close();
560
+ }
561
+ };
562
+
563
+ /**
564
+ * @see {@link componyx.UI.base.methods}
565
+ */
566
+ componyx.UI.Dialog.prototype = Object.create($base.methods);
567
+ componyx.UI.Dialog.prototype.constructor = componyx.UI.Dialog;
568
+ })();
569
+
570
+ const Dialog = componyx.UI.Dialog;
571
+
572
+ export { Dialog };