x4js 1.5.17 → 1.5.20

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 (242) hide show
  1. package/lib/{README.md → README.txt} +0 -0
  2. package/lib/cjs/index.js +39 -103
  3. package/lib/cjs/index.js.map +7 -0
  4. package/lib/esm/index.mjs +39 -87
  5. package/lib/esm/index.mjs.map +7 -0
  6. package/lib/{license.md → licence.md} +0 -0
  7. package/lib/src/MIT-license.md +14 -0
  8. package/lib/{types/action.d.ts → src/action.ts} +64 -33
  9. package/lib/src/alpha.jpg +0 -0
  10. package/lib/src/app_sockets.ts +81 -0
  11. package/lib/src/application.ts +251 -0
  12. package/lib/src/autocomplete.ts +197 -0
  13. package/lib/src/base64.ts +166 -0
  14. package/lib/src/base_component.ts +152 -0
  15. package/lib/src/button.ts +355 -0
  16. package/lib/src/calendar.ts +328 -0
  17. package/lib/src/canvas.ts +505 -0
  18. package/lib/src/cardview.ts +227 -0
  19. package/lib/src/checkbox.ts +188 -0
  20. package/lib/src/color.ts +752 -0
  21. package/lib/src/colorpicker.ts +1639 -0
  22. package/lib/src/combobox.ts +465 -0
  23. package/lib/src/component.ts +2329 -0
  24. package/lib/{esm/dom_events.js → src/copyright.txt} +27 -29
  25. package/lib/src/datastore.ts +1322 -0
  26. package/lib/src/dialog.ts +656 -0
  27. package/lib/src/dom_events.ts +315 -0
  28. package/lib/src/drag_manager.ts +199 -0
  29. package/lib/src/drawtext.ts +355 -0
  30. package/lib/src/fileupload.ts +213 -0
  31. package/lib/src/form.ts +375 -0
  32. package/lib/src/formatters.ts +105 -0
  33. package/lib/src/gridview.ts +1185 -0
  34. package/lib/src/i18n.ts +346 -0
  35. package/lib/src/icon.ts +335 -0
  36. package/lib/src/image.ts +204 -0
  37. package/lib/src/index.ts +89 -0
  38. package/lib/src/input.ts +249 -0
  39. package/lib/src/label.ts +128 -0
  40. package/lib/src/layout.ts +430 -0
  41. package/lib/src/link.ts +86 -0
  42. package/lib/src/listview.ts +765 -0
  43. package/lib/{esm/md5.js → src/md5.ts} +438 -403
  44. package/lib/src/menu.ts +425 -0
  45. package/lib/src/messagebox.ts +224 -0
  46. package/lib/src/panel.ts +86 -0
  47. package/lib/src/popup.ts +494 -0
  48. package/lib/src/property_editor.ts +337 -0
  49. package/lib/src/radiobtn.ts +197 -0
  50. package/lib/src/rating.ts +135 -0
  51. package/lib/src/request.ts +300 -0
  52. package/lib/src/router.ts +185 -0
  53. package/lib/src/settings.ts +77 -0
  54. package/lib/src/sidebarview.ts +103 -0
  55. package/lib/src/spreadsheet.ts +1449 -0
  56. package/lib/src/styles.ts +343 -0
  57. package/lib/src/svgcomponent.ts +577 -0
  58. package/lib/src/tabbar.ts +151 -0
  59. package/lib/src/tabview.ts +110 -0
  60. package/lib/src/textarea.ts +235 -0
  61. package/lib/src/textedit.ts +544 -0
  62. package/lib/src/toaster.ts +80 -0
  63. package/lib/src/tools.ts +1473 -0
  64. package/lib/src/tooltips.ts +191 -0
  65. package/lib/src/treeview.ts +716 -0
  66. package/lib/{esm/version.js → src/version.ts} +30 -29
  67. package/lib/{styles → src}/x4.less +0 -0
  68. package/lib/src/x4dom.ts +57 -0
  69. package/lib/src/x4events.ts +585 -0
  70. package/lib/src/x4react.ts +90 -0
  71. package/package.json +52 -49
  72. package/lib/cjs/action.js +0 -58
  73. package/lib/cjs/app_sockets.js +0 -74
  74. package/lib/cjs/application.js +0 -182
  75. package/lib/cjs/autocomplete.js +0 -155
  76. package/lib/cjs/base_component.js +0 -124
  77. package/lib/cjs/button.js +0 -263
  78. package/lib/cjs/calendar.js +0 -254
  79. package/lib/cjs/canvas.js +0 -361
  80. package/lib/cjs/cardview.js +0 -161
  81. package/lib/cjs/checkbox.js +0 -139
  82. package/lib/cjs/color.js +0 -591
  83. package/lib/cjs/colorpicker.js +0 -1468
  84. package/lib/cjs/combobox.js +0 -349
  85. package/lib/cjs/component.js +0 -1719
  86. package/lib/cjs/datastore.js +0 -985
  87. package/lib/cjs/dialog.js +0 -478
  88. package/lib/cjs/dom_events.js +0 -30
  89. package/lib/cjs/drag_manager.js +0 -145
  90. package/lib/cjs/drawtext.js +0 -276
  91. package/lib/cjs/fileupload.js +0 -167
  92. package/lib/cjs/form.js +0 -304
  93. package/lib/cjs/formatters.js +0 -90
  94. package/lib/cjs/gridview.js +0 -881
  95. package/lib/cjs/i18n.js +0 -266
  96. package/lib/cjs/icon.js +0 -272
  97. package/lib/cjs/image.js +0 -157
  98. package/lib/cjs/input.js +0 -174
  99. package/lib/cjs/label.js +0 -95
  100. package/lib/cjs/layout.js +0 -322
  101. package/lib/cjs/link.js +0 -64
  102. package/lib/cjs/listview.js +0 -546
  103. package/lib/cjs/md5.js +0 -403
  104. package/lib/cjs/menu.js +0 -301
  105. package/lib/cjs/messagebox.js +0 -177
  106. package/lib/cjs/panel.js +0 -68
  107. package/lib/cjs/popup.js +0 -383
  108. package/lib/cjs/property_editor.js +0 -252
  109. package/lib/cjs/radiobtn.js +0 -140
  110. package/lib/cjs/rating.js +0 -102
  111. package/lib/cjs/request.js +0 -246
  112. package/lib/cjs/router.js +0 -139
  113. package/lib/cjs/settings.js +0 -69
  114. package/lib/cjs/sidebarview.js +0 -82
  115. package/lib/cjs/spreadsheet.js +0 -1084
  116. package/lib/cjs/styles.js +0 -275
  117. package/lib/cjs/svgcomponent.js +0 -447
  118. package/lib/cjs/tabbar.js +0 -111
  119. package/lib/cjs/tabview.js +0 -85
  120. package/lib/cjs/textarea.js +0 -165
  121. package/lib/cjs/textedit.js +0 -415
  122. package/lib/cjs/toaster.js +0 -64
  123. package/lib/cjs/tools.js +0 -1197
  124. package/lib/cjs/tooltips.js +0 -157
  125. package/lib/cjs/treeview.js +0 -535
  126. package/lib/cjs/version.js +0 -32
  127. package/lib/cjs/x4dom.js +0 -32
  128. package/lib/cjs/x4events.js +0 -384
  129. package/lib/cjs/x4react.js +0 -72
  130. package/lib/esm/action.js +0 -53
  131. package/lib/esm/app_sockets.js +0 -70
  132. package/lib/esm/application.js +0 -184
  133. package/lib/esm/autocomplete.js +0 -155
  134. package/lib/esm/base_component.js +0 -107
  135. package/lib/esm/button.js +0 -257
  136. package/lib/esm/calendar.js +0 -249
  137. package/lib/esm/canvas.js +0 -358
  138. package/lib/esm/cardview.js +0 -159
  139. package/lib/esm/checkbox.js +0 -134
  140. package/lib/esm/color.js +0 -588
  141. package/lib/esm/colorpicker.js +0 -1475
  142. package/lib/esm/combobox.js +0 -351
  143. package/lib/esm/component.js +0 -1711
  144. package/lib/esm/datastore.js +0 -990
  145. package/lib/esm/dialog.js +0 -490
  146. package/lib/esm/drag_manager.js +0 -147
  147. package/lib/esm/drawtext.js +0 -271
  148. package/lib/esm/fileupload.js +0 -163
  149. package/lib/esm/form.js +0 -304
  150. package/lib/esm/formatters.js +0 -81
  151. package/lib/esm/gridview.js +0 -889
  152. package/lib/esm/i18n.js +0 -257
  153. package/lib/esm/icon.js +0 -261
  154. package/lib/esm/image.js +0 -154
  155. package/lib/esm/input.js +0 -182
  156. package/lib/esm/label.js +0 -90
  157. package/lib/esm/layout.js +0 -310
  158. package/lib/esm/link.js +0 -59
  159. package/lib/esm/listview.js +0 -534
  160. package/lib/esm/menu.js +0 -300
  161. package/lib/esm/messagebox.js +0 -161
  162. package/lib/esm/panel.js +0 -65
  163. package/lib/esm/popup.js +0 -379
  164. package/lib/esm/property_editor.js +0 -251
  165. package/lib/esm/radiobtn.js +0 -136
  166. package/lib/esm/rating.js +0 -97
  167. package/lib/esm/request.js +0 -224
  168. package/lib/esm/router.js +0 -136
  169. package/lib/esm/settings.js +0 -66
  170. package/lib/esm/sidebarview.js +0 -79
  171. package/lib/esm/spreadsheet.js +0 -1097
  172. package/lib/esm/styles.js +0 -270
  173. package/lib/esm/svgcomponent.js +0 -450
  174. package/lib/esm/tabbar.js +0 -107
  175. package/lib/esm/tabview.js +0 -83
  176. package/lib/esm/textarea.js +0 -160
  177. package/lib/esm/textedit.js +0 -412
  178. package/lib/esm/toaster.js +0 -62
  179. package/lib/esm/tools.js +0 -1158
  180. package/lib/esm/tooltips.js +0 -153
  181. package/lib/esm/treeview.js +0 -527
  182. package/lib/esm/x4dom.js +0 -29
  183. package/lib/esm/x4events.js +0 -376
  184. package/lib/esm/x4react.js +0 -71
  185. package/lib/types/app_sockets.d.ts +0 -29
  186. package/lib/types/application.d.ts +0 -104
  187. package/lib/types/autocomplete.d.ts +0 -58
  188. package/lib/types/base_component.d.ts +0 -88
  189. package/lib/types/button.d.ts +0 -151
  190. package/lib/types/calendar.d.ts +0 -82
  191. package/lib/types/canvas.d.ts +0 -92
  192. package/lib/types/cardview.d.ts +0 -87
  193. package/lib/types/checkbox.d.ts +0 -77
  194. package/lib/types/color.d.ts +0 -148
  195. package/lib/types/colorpicker.d.ts +0 -107
  196. package/lib/types/combobox.d.ts +0 -107
  197. package/lib/types/component.d.ts +0 -601
  198. package/lib/types/datastore.d.ts +0 -396
  199. package/lib/types/dialog.d.ts +0 -175
  200. package/lib/types/dom_events.d.ts +0 -302
  201. package/lib/types/drag_manager.d.ts +0 -54
  202. package/lib/types/drawtext.d.ts +0 -48
  203. package/lib/types/fileupload.d.ts +0 -64
  204. package/lib/types/form.d.ts +0 -133
  205. package/lib/types/formatters.d.ts +0 -35
  206. package/lib/types/gridview.d.ts +0 -175
  207. package/lib/types/i18n.d.ts +0 -73
  208. package/lib/types/icon.d.ts +0 -64
  209. package/lib/types/image.d.ts +0 -55
  210. package/lib/types/index.d.ts +0 -84
  211. package/lib/types/input.d.ts +0 -91
  212. package/lib/types/label.d.ts +0 -58
  213. package/lib/types/layout.d.ts +0 -87
  214. package/lib/types/link.d.ts +0 -50
  215. package/lib/types/listview.d.ts +0 -178
  216. package/lib/types/md5.d.ts +0 -61
  217. package/lib/types/menu.d.ts +0 -130
  218. package/lib/types/messagebox.d.ts +0 -69
  219. package/lib/types/panel.d.ts +0 -47
  220. package/lib/types/popup.d.ts +0 -75
  221. package/lib/types/property_editor.d.ts +0 -71
  222. package/lib/types/radiobtn.d.ts +0 -73
  223. package/lib/types/rating.d.ts +0 -53
  224. package/lib/types/request.d.ts +0 -52
  225. package/lib/types/router.d.ts +0 -42
  226. package/lib/types/settings.d.ts +0 -37
  227. package/lib/types/sidebarview.d.ts +0 -49
  228. package/lib/types/spreadsheet.d.ts +0 -222
  229. package/lib/types/styles.d.ts +0 -85
  230. package/lib/types/svgcomponent.d.ts +0 -215
  231. package/lib/types/tabbar.d.ts +0 -58
  232. package/lib/types/tabview.d.ts +0 -49
  233. package/lib/types/textarea.d.ts +0 -77
  234. package/lib/types/textedit.d.ts +0 -123
  235. package/lib/types/toaster.d.ts +0 -42
  236. package/lib/types/tools.d.ts +0 -394
  237. package/lib/types/tooltips.d.ts +0 -46
  238. package/lib/types/treeview.d.ts +0 -144
  239. package/lib/types/version.d.ts +0 -29
  240. package/lib/types/x4dom.d.ts +0 -49
  241. package/lib/types/x4events.d.ts +0 -269
  242. package/lib/types/x4react.d.ts +0 -41
@@ -1,376 +0,0 @@
1
- /**
2
- * ___ ___ __
3
- * \ \_/ / / _
4
- * \ / /_| |_
5
- * / _ \____ _|
6
- * /__/ \__\ |_|
7
- *
8
- * @file x4events.ts
9
- * @author Etienne Cochard
10
- *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
12
- *
13
- * Permission is hereby granted, free of charge, to any person obtaining a copy
14
- * of this software and associated documentation files (the "Software"), to deal
15
- * in the Software without restriction, including without limitation the rights
16
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
17
- * of the Software, and to permit persons to whom the Software is furnished to do so,
18
- * subject to the following conditions:
19
- * The above copyright notice and this permission notice shall be included in all copies
20
- * or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
23
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24
- * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
- **/
29
- // default stopPropagation implementation for Events
30
- const stopPropagation = function () {
31
- this.propagationStopped = true;
32
- };
33
- // default preventDefault implementation for Events
34
- const preventDefault = function () {
35
- this.defaultPrevented = true;
36
- };
37
- ;
38
- /**
39
- * BasicEvent Builder
40
- * this function is responsable of BasicEvent creation
41
- * ie. is equivalent of new BasicEvent( xxx );
42
- * @param params
43
- * @returns BasicEvent
44
- */
45
- export function BasicEvent(params) {
46
- return {
47
- stopPropagation,
48
- preventDefault,
49
- ...params,
50
- };
51
- }
52
- export function EvClick(context = null) {
53
- return BasicEvent({ context });
54
- }
55
- export function EvChange(value, context = null) {
56
- return BasicEvent({ value, context });
57
- }
58
- export function EvSelectionChange(selection, context = null) {
59
- return BasicEvent({ selection, context });
60
- }
61
- export function EvContextMenu(uievent, context = null) {
62
- return BasicEvent({ uievent, context });
63
- }
64
- export function EvTimer(timer, time = 0, context = null) {
65
- return BasicEvent({ timer, time, context });
66
- }
67
- export function EvMessage(msg, params, source) {
68
- return BasicEvent({ msg, params, source });
69
- }
70
- export function EvDrag(element, data, ctx) {
71
- return BasicEvent({ element, data, context: ctx });
72
- }
73
- export function EvError(code, message) {
74
- return BasicEvent({ code, message });
75
- }
76
- /**
77
- * Event emitter class
78
- * this class allow you to emit and handle events
79
- *
80
- * @example:
81
- * ```ts
82
- *
83
- * interface EvDoIt extends BasicEvent {
84
- * param: unknown;
85
- * }
86
- *
87
- * function EvDoIt( e: EvDoIt ) : EvDoIt {
88
- * return BasicEvent<EvDoIt>( e );
89
- * }
90
- *
91
- * interface TestEventMap extends EventMap {
92
- * doit: EvDoIt;
93
- * }
94
- *
95
- * let ee = new EventSource<TestEventMap>(null);
96
- * ee.listen({
97
- * doit: (e) => {
98
- * console.log(e);
99
- * e.preventDefault();
100
- * },
101
- * });
102
- *
103
- * ee.defaults({
104
- * doit: (e) => {
105
- * console.log('default handler for ', e.type, e.selection);
106
- * },
107
- * })
108
- *
109
- * ee.on('doit', (e) => {
110
- * debugger;
111
- * })
112
- *
113
- * const ev = EvDoIt({ param: 10 });
114
- * ee.emit('change', ev);
115
- * if (ev.defaultPrevented) {
116
- * console.log('prevented');
117
- * }
118
- * ```
119
- */
120
- export class EventSource {
121
- m_source;
122
- m_eventRegistry;
123
- m_defaultHandlers;
124
- constructor(source = null) {
125
- this.m_source = source ?? this;
126
- }
127
- /**
128
- * emit an event
129
- * you can stop propagation of event or prevent default
130
- * @param eventName - name of event to emit
131
- * @param event - event data
132
- */
133
- emit(type, event) {
134
- this._emit(type, event);
135
- }
136
- _emit(eventName, e) {
137
- let listeners = this.m_eventRegistry?.get(eventName);
138
- const defaultHandler = this.m_defaultHandlers?.get(eventName);
139
- if (!e) {
140
- e = {};
141
- }
142
- if (!e.source) {
143
- e.source = this.m_source;
144
- }
145
- if (!e.type) {
146
- e.type = eventName;
147
- }
148
- if (listeners && listeners.length) {
149
- if (!e.preventDefault) {
150
- e.preventDefault = preventDefault;
151
- }
152
- if (!e.stopPropagation) {
153
- e.stopPropagation = stopPropagation;
154
- }
155
- // small optimisation
156
- if (listeners.length == 1) {
157
- listeners[0](e);
158
- }
159
- else {
160
- const temp = listeners.slice();
161
- for (let i = 0, n = temp.length; i < n; i++) {
162
- temp[i](e);
163
- if (e.propagationStopped) {
164
- break;
165
- }
166
- }
167
- }
168
- }
169
- if (defaultHandler && defaultHandler.length && !e.defaultPrevented) {
170
- return defaultHandler[0](e);
171
- }
172
- }
173
- /**
174
- * signal en event
175
- * signaled event are notification : no way to prevent default not stop propagation
176
- * @param eventName name of event to signal
177
- * @param event event data
178
- */
179
- signal(type, event, delay = -1) {
180
- this._signal(type, event, delay);
181
- }
182
- _signal(eventName, e, delay = -1) {
183
- if (!this.m_eventRegistry) {
184
- return;
185
- }
186
- const listeners = this.m_eventRegistry.get(eventName);
187
- if (!listeners || !listeners.length) {
188
- return;
189
- }
190
- if (!e) {
191
- e = {};
192
- }
193
- if (!e.type) {
194
- e.type = eventName;
195
- }
196
- if (!e.source) {
197
- e.source = this.m_source;
198
- }
199
- e.preventDefault = e.stopPropagation = () => {
200
- console.error('this event cannot be stopped not default prevented');
201
- };
202
- // small optimisation
203
- if (listeners.length == 1 && delay == -1) {
204
- listeners[0](e);
205
- }
206
- else {
207
- const temp = listeners.slice();
208
- const call = () => {
209
- for (let i = 0, n = temp.length; i < n; i++) {
210
- temp[i](e);
211
- }
212
- };
213
- if (delay == -1) {
214
- call();
215
- }
216
- else {
217
- setTimeout(call, delay);
218
- }
219
- }
220
- }
221
- /**
222
- * handle an event one time
223
- * @param eventName - event name to handle
224
- * @param callback - callback to call when event is signaled
225
- * @returns Promise if callback is null
226
- *
227
- * take care with that because if the event is never fired and you await it,
228
- * the system may overflow
229
- */
230
- once(type, callback) {
231
- //@ts-ignore
232
- this._once(type, callback);
233
- }
234
- _once(eventName, callback) {
235
- const newCallback = (ev) => {
236
- this._off(eventName, newCallback);
237
- callback(ev);
238
- };
239
- this._on(eventName, newCallback);
240
- if (!callback) {
241
- return new Promise(function (resolve) {
242
- callback = resolve;
243
- });
244
- }
245
- }
246
- /**
247
- * set the event default handler
248
- * @param eventName - name of the event
249
- * @param callback - callback to call when the event is not handled (and preventDeault has not been called)
250
- */
251
- setDefaultHandler(eventName, callback) {
252
- let handlers = this.m_defaultHandlers;
253
- if (!handlers) {
254
- handlers = this.m_defaultHandlers = new Map();
255
- }
256
- let stack = handlers.get(eventName);
257
- if (stack) {
258
- // if already in the stack, remove it
259
- const idx = stack.indexOf(callback);
260
- if (idx != -1) {
261
- stack.splice(idx, 1);
262
- }
263
- // then make it first
264
- stack.unshift(callback);
265
- }
266
- else {
267
- handlers.set(eventName, [callback]);
268
- }
269
- }
270
- /**
271
- * remove the previous default handler installed for an event
272
- * @param eventName - event name
273
- * @param callback - callback handler to remove (must be the same as in setDefaultHandler)
274
- */
275
- removeDefaultHandler(eventName, callback) {
276
- const handlers = this.m_defaultHandlers;
277
- if (!handlers) {
278
- return;
279
- }
280
- const stack = handlers.get(eventName);
281
- if (stack) {
282
- const idx = stack.indexOf(callback);
283
- if (idx != -1) {
284
- stack.splice(idx, 1);
285
- }
286
- }
287
- }
288
- /**
289
- * define a set of listeners in one call
290
- * @param events
291
- */
292
- listen(events) {
293
- for (let n in events) {
294
- this._on(n, events[n]);
295
- }
296
- }
297
- /**
298
- * define a set of default handlers in one call
299
- * @param events
300
- */
301
- defaults(events) {
302
- for (let n in events) {
303
- this.setDefaultHandler(n, events[n]);
304
- }
305
- }
306
- /**
307
- * listen for an event
308
- * @param eventName - event name to listen on
309
- * @param callback - callback to call
310
- * @param capturing - if true, capture event before other registred event handlers
311
- */
312
- on(type, callback) {
313
- //@ts-ignore
314
- return this._on(type, callback);
315
- }
316
- _on(eventName, callback, capturing = false) {
317
- if (!this.m_eventRegistry) {
318
- this.m_eventRegistry = new Map();
319
- }
320
- let listeners = this.m_eventRegistry.get(eventName);
321
- if (!listeners) {
322
- listeners = [];
323
- this.m_eventRegistry.set(eventName, listeners);
324
- }
325
- if (listeners.indexOf(callback) == -1) {
326
- if (capturing) {
327
- listeners.unshift(callback);
328
- }
329
- else {
330
- listeners.push(callback);
331
- }
332
- }
333
- return {
334
- dispose: () => { this._off(eventName, callback); }
335
- };
336
- }
337
- /**
338
- * stop listening to an event
339
- * @param eventName - event name
340
- * @param callback - callback to remove (must be the same as in on )
341
- */
342
- off(type, callback) {
343
- //@ts-ignore
344
- return this._off(type, callback);
345
- }
346
- _off(eventName, callback) {
347
- if (!this.m_eventRegistry) {
348
- return;
349
- }
350
- let listeners = this.m_eventRegistry.get(eventName);
351
- if (!listeners) {
352
- return;
353
- }
354
- const idx = listeners.indexOf(callback);
355
- if (idx !== -1) {
356
- listeners.splice(idx, 1);
357
- }
358
- }
359
- /**
360
- * remove all listeners for an event
361
- * @param eventName - event name
362
- */
363
- removeAllListeners(eventName) {
364
- if (!eventName) {
365
- this.m_eventRegistry = this.m_defaultHandlers = undefined;
366
- }
367
- else {
368
- if (this.m_eventRegistry) {
369
- this.m_eventRegistry[eventName] = undefined;
370
- }
371
- if (this.m_defaultHandlers) {
372
- this.m_defaultHandlers[eventName] = undefined;
373
- }
374
- }
375
- }
376
- }
@@ -1,71 +0,0 @@
1
- /**
2
- * ___ ___ __
3
- * \ \_/ / / _
4
- * \ / /_| |_
5
- * / _ \____ _|
6
- * /__/ \__\ |_|
7
- *
8
- * @file x4react.ts
9
- * @author Etienne Cochard
10
- *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
12
- *
13
- * Permission is hereby granted, free of charge, to any person obtaining a copy
14
- * of this software and associated documentation files (the "Software"), to deal
15
- * in the Software without restriction, including without limitation the rights
16
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
17
- * of the Software, and to permit persons to whom the Software is furnished to do so,
18
- * subject to the following conditions:
19
- * The above copyright notice and this permission notice shall be included in all copies
20
- * or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
23
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24
- * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
- **/
29
- import { Component } from './component';
30
- const createElement = (clsOrTag, attrs, ...children) => {
31
- let comp;
32
- // fragment
33
- if (clsOrTag == createFragment || clsOrTag == Fragment) {
34
- return children;
35
- }
36
- // class constructor, yes : dirty
37
- else if (clsOrTag instanceof Function) {
38
- comp = new clsOrTag(attrs);
39
- }
40
- // basic tag
41
- else {
42
- comp = new Component({
43
- tag: clsOrTag,
44
- ...attrs,
45
- });
46
- }
47
- if (children && children.length) {
48
- comp.setContent(children);
49
- }
50
- return comp;
51
- };
52
- const Fragment = Symbol("fragment");
53
- const createFragment = () => {
54
- return null;
55
- };
56
- export let React = {
57
- createElement,
58
- createFragment,
59
- Fragment,
60
- };
61
- /**
62
- *
63
- */
64
- export class TSXComponent extends Component {
65
- render(props) {
66
- const tsx = this.renderTSX(props);
67
- if (tsx) {
68
- this.setContent(tsx);
69
- }
70
- }
71
- }
@@ -1,29 +0,0 @@
1
- /**
2
- * ___ ___ __
3
- * \ \/ / / _
4
- * \ / /_| |_
5
- * / \____ _|
6
- * /__/\__\ |_|
7
- *
8
- * @file app_sockets.ts
9
- * @author Etienne Cochard
10
- *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
12
- *
13
- * Permission is hereby granted, free of charge, to any person obtaining a copy
14
- * of this software and associated documentation files (the "Software"), to deal
15
- * in the Software without restriction, including without limitation the rights
16
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
17
- * of the Software, and to permit persons to whom the Software is furnished to do so,
18
- * subject to the following conditions:
19
- * The above copyright notice and this permission notice shall be included in all copies
20
- * or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
23
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24
- * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
- **/
29
- export declare function setupWSMessaging(closeCB: () => void): void;
@@ -1,104 +0,0 @@
1
- /**
2
- * ___ ___ __
3
- * \ \/ / / _
4
- * \ / /_| |_
5
- * / \____ _|
6
- * /__/\__\ |_|
7
- *
8
- * @file application.ts
9
- * @author Etienne Cochard
10
- *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
12
- *
13
- * Permission is hereby granted, free of charge, to any person obtaining a copy
14
- * of this software and associated documentation files (the "Software"), to deal
15
- * in the Software without restriction, including without limitation the rights
16
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
17
- * of the Software, and to permit persons to whom the Software is furnished to do so,
18
- * subject to the following conditions:
19
- * The above copyright notice and this permission notice shall be included in all copies
20
- * or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
23
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24
- * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
- **/
29
- import { EvMessage } from './x4events';
30
- import { BaseComponent, BaseComponentEventMap, BaseComponentProps } from './base_component';
31
- import { Component } from './component';
32
- import { Settings } from './settings';
33
- interface ApplicationEventMap extends BaseComponentEventMap {
34
- message: EvMessage;
35
- global: EvMessage;
36
- }
37
- /**
38
- *
39
- */
40
- export interface ApplicationProps extends BaseComponentProps<ApplicationEventMap> {
41
- app_name: string;
42
- app_version: string;
43
- app_uid?: string;
44
- locale?: string;
45
- renderTo?: HTMLElement;
46
- }
47
- /**
48
- * Represents an x4 application, which is typically a single page app.
49
- * You should inherit Application to define yours.
50
- * Application derives from BaseComponent so you can use that to implement a global messaging system.
51
- * @example ```ts
52
- *
53
- * // in yout main caode
54
- * let app = new Application( );
55
- *
56
- * app.events.close.on( ( ev ) => {
57
- * ... do something
58
- * });
59
- *
60
- * // somewhere else in the source
61
- * function xxx( ) {
62
- * let app = Application.instance( );
63
- * app.events.close.emit( new Events.close() );
64
- * }
65
- */
66
- export declare class Application<P extends ApplicationProps = ApplicationProps, E extends ApplicationEventMap = ApplicationEventMap> extends BaseComponent<P, E> {
67
- private static self;
68
- /**
69
- * the application singleton
70
- */
71
- static instance(): Application;
72
- private m_mainView;
73
- private m_app_name;
74
- private m_app_version;
75
- private m_app_uid;
76
- private m_local_storage;
77
- private m_user_data;
78
- private m_touch_time;
79
- private m_touch_count;
80
- constructor(props: P);
81
- ApplicationCreated(): void;
82
- get app_name(): string;
83
- get app_uid(): string;
84
- get app_version(): string;
85
- get local_storage(): Settings;
86
- get user_data(): any;
87
- get history(): any;
88
- /**
89
- * define the application root object (MainView)
90
- * @example ```ts
91
- *
92
- * let myApp = new Application( ... );
93
- * let mainView = new VLayout( ... );
94
- * myApp.mainView = mainView;
95
- */
96
- setMainView(root: Component, clearBefore: boolean): void;
97
- set mainView(root: Component);
98
- get mainView(): Component;
99
- setTitle(title: string): void;
100
- disableZoomWheel(): void;
101
- enterModal(enter: boolean): void;
102
- enableTouchDblClick(): void;
103
- }
104
- export {};
@@ -1,58 +0,0 @@
1
- /**
2
- * ___ ___ __
3
- * \ \/ / / _
4
- * \ / /_| |_
5
- * / \____ _|
6
- * /__/\__\ |_|
7
- *
8
- * @file autocomplete.ts
9
- * @author Etienne Cochard
10
- *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
12
- *
13
- * Permission is hereby granted, free of charge, to any person obtaining a copy
14
- * of this software and associated documentation files (the "Software"), to deal
15
- * in the Software without restriction, including without limitation the rights
16
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
17
- * of the Software, and to permit persons to whom the Software is furnished to do so,
18
- * subject to the following conditions:
19
- * The above copyright notice and this permission notice shall be included in all copies
20
- * or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
23
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24
- * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
- **/
29
- import { TextEdit, TextEditProps } from './textedit';
30
- /**
31
- *
32
- */
33
- interface AutoCompleteProps extends TextEditProps {
34
- enumValues: (filter: string) => string[];
35
- }
36
- /**
37
- *
38
- */
39
- export declare class AutoComplete extends TextEdit<AutoCompleteProps> {
40
- private m_popup;
41
- private m_popvis;
42
- private m_needval;
43
- private m_lockpop;
44
- constructor(props: AutoCompleteProps);
45
- _onKey(e: KeyboardEvent): void;
46
- private _onChange;
47
- componentDisposed(): void;
48
- /**
49
- * display the popup
50
- */
51
- showPopup(items: string[]): void;
52
- protected _validate(value: string): boolean;
53
- validate(): boolean;
54
- private _checkFocus;
55
- private _hidePopup;
56
- private _onFocus;
57
- }
58
- export {};