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,601 +0,0 @@
1
- /**
2
- * ___ ___ __
3
- * \ \/ / / _
4
- * \ / /_| |_
5
- * / \____ _|
6
- * /__/\__\ |_|
7
- *
8
- * @file components.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
- /**
30
- * @todo
31
- * create Container class
32
- */
33
- import { Rect, Size, HtmlString, Constructor } from './tools';
34
- import { Stylesheet, ComputedStyle } from './styles';
35
- import { BasicEvent, EventCallback } from './x4events';
36
- import { BaseComponent, BaseComponentProps, BaseComponentEventMap } from './base_component';
37
- import { IDOMEvents, X4ElementEventMap } from './dom_events';
38
- export { HtmlString, isHtmlString, html } from './tools';
39
- export interface EventHandler<T> {
40
- (ev: T): any;
41
- }
42
- export interface ICaptureInfo {
43
- initiator: Component;
44
- handler: EventHandler<UIEvent>;
45
- iframes: NodeListOf<HTMLIFrameElement>;
46
- }
47
- /** @ignore properties without 'px' unit */
48
- export declare const _x4_unitless: {
49
- animationIterationCount: number;
50
- borderImageOutset: number;
51
- borderImageSlice: number;
52
- borderImageWidth: number;
53
- boxFlex: number;
54
- boxFlexGroup: number;
55
- boxOrdinalGroup: number;
56
- columnCount: number;
57
- flex: number;
58
- flexGrow: number;
59
- flexPositive: number;
60
- flexShrink: number;
61
- flexNegative: number;
62
- flexOrder: number;
63
- gridRow: number;
64
- gridColumn: number;
65
- fontWeight: number;
66
- lineClamp: number;
67
- lineHeight: number;
68
- opacity: number;
69
- order: number;
70
- orphans: number;
71
- tabSize: number;
72
- widows: number;
73
- zIndex: number;
74
- zoom: number;
75
- fillOpacity: number;
76
- floodOpacity: number;
77
- stopOpacity: number;
78
- strokeDasharray: number;
79
- strokeDashoffset: number;
80
- strokeMiterlimit: number;
81
- strokeOpacity: number;
82
- strokeWidth: number;
83
- };
84
- /**
85
- *
86
- */
87
- export type VoidCallback = () => void;
88
- export type ComponentOrString = Component | string | HtmlString;
89
- export type ComponentContent = ComponentOrString | ComponentOrString[];
90
- interface IMap<T> {
91
- [key: string]: T;
92
- }
93
- /**
94
- * DblClick Event
95
- * double click event
96
- */
97
- export interface EvDblClick extends BasicEvent {
98
- }
99
- export declare function EvDblClick(context?: any): EvDblClick;
100
- /**
101
- * DblFocus Event
102
- * double click event
103
- */
104
- export interface EvFocus extends BasicEvent {
105
- readonly focus: boolean;
106
- }
107
- export declare function EvFocus(focus?: boolean, context?: any): EvFocus;
108
- /**
109
- * basic event map of Component
110
- */
111
- export interface CEventMap extends BaseComponentEventMap {
112
- }
113
- /**
114
- * Basic properties of every Component
115
- */
116
- export interface CProps<T extends CEventMap = CEventMap> extends BaseComponentProps<T> {
117
- tag?: string;
118
- ns?: string;
119
- cls?: string;
120
- id?: string;
121
- style?: IMap<string | number>;
122
- attrs?: object;
123
- dom_events?: IDOMEvents;
124
- data?: any;
125
- content?: ComponentContent;
126
- tooltip?: string;
127
- ref?: string;
128
- left?: number;
129
- top?: number;
130
- width?: number | string;
131
- height?: number | string;
132
- tabIndex?: number | boolean;
133
- flex?: number | string;
134
- enabled?: boolean;
135
- }
136
- /**
137
- *
138
- */
139
- export declare class Component<P extends CProps<CEventMap> = CProps<CEventMap>, E extends CEventMap = CEventMap> extends BaseComponent<P, E> {
140
- private m_dom;
141
- private m_iprops;
142
- private static __sb_width;
143
- private static __comp_guid;
144
- private static __privateEvents;
145
- private static __sizeObserver;
146
- private static __createObserver;
147
- private static __capture;
148
- private static __capture_mask;
149
- private static __css;
150
- constructor(props?: P);
151
- /**
152
- *
153
- */
154
- get uid(): number;
155
- /**
156
- * change the component content
157
- * @param content new content or null
158
- */
159
- setContent(content: ComponentContent, refreshAll?: boolean): void;
160
- getContent(): ComponentContent;
161
- /**
162
- * add a new child to the component content
163
- * @param content
164
- */
165
- appendChild(content: ComponentContent): void;
166
- /**
167
- *
168
- */
169
- setTag(tag: string, namespace?: string): void;
170
- /**
171
- * get the Component data value
172
- * @param name name to get
173
- */
174
- getData(name: string | Symbol): any;
175
- /**
176
- * set the Component data value
177
- * @param name name to get
178
- * @param value
179
- */
180
- setData(name: string | Symbol, value: any): void;
181
- /**
182
- * return the DOM associated with the Component (if any)
183
- */
184
- get dom(): HTMLElement;
185
- /**
186
- * shows the element
187
- * @param show
188
- */
189
- show(show?: boolean): void;
190
- /**
191
- * hides the element
192
- */
193
- hide(): void;
194
- /**
195
- * enable or disable the element
196
- * @param enable
197
- */
198
- enable(enable?: boolean): void;
199
- /**
200
- * disable the element
201
- */
202
- disable(): void;
203
- /**
204
- * set the focus on the element
205
- */
206
- focus(): void;
207
- /**
208
- * change the object style
209
- * @param style - style to add
210
- * @example ```typescript
211
- * el.setStyle( {left:100} );
212
- */
213
- setStyle(style: object): void;
214
- /**
215
- * change a style value
216
- * @param name string style nale
217
- * @param value any style value or null to remove style
218
- */
219
- setStyleValue(name: string, value: any): void;
220
- private _setDomStyleValue;
221
- /**
222
- * compute the element style
223
- * @return all styles computed
224
- */
225
- getComputedStyle(pseudoElt?: string): ComputedStyle;
226
- /**
227
- * return a single stype value
228
- * @param name - value to get
229
- */
230
- getStyleValue(name: string): any;
231
- /**
232
- * define the elements attributes
233
- * @param attrs
234
- */
235
- setAttributes(attrs: any): void;
236
- /**
237
- * change a single attribute
238
- * @param name attribute name
239
- * @param value new value
240
- */
241
- setAttribute(name: string, value: any): void;
242
- private _setDomAttribute;
243
- /**
244
- * remove an atrribute
245
- * @param name name of the attribute
246
- */
247
- removeAttribute(name: string): void;
248
- /**
249
- * get an attribute value
250
- * @param {string} name - attribute name
251
- * @return {string} attribute value
252
- * @example ```typescript
253
- * let chk = el.getAttribute( 'checked' );
254
- * @review double cache
255
- */
256
- getAttribute(name: string): string;
257
- /**
258
- * check if the element has an attribute
259
- * @param name attribute name
260
- * @return true is attribute is present
261
- * @example ```typescript
262
- * if( el.hasAttribute('checked') ) {
263
- * }
264
- */
265
- hasAttribute(name: string): boolean;
266
- /**
267
- * a some classnames to the component
268
- * classes can be separated by a space
269
- * @param cls class to add
270
- * @example ```typescript
271
- * addClass( 'my class name @flex' );
272
- */
273
- addClass(name: string): void;
274
- /**
275
- * Remove a class from the element
276
- * @param {string|array} name - classes in string form can be space separated
277
- *
278
- * @example ```typescript
279
- * el.removeClass( 'myclass' );
280
- * el.removeClass( 'myclass1 myclass2' );
281
- */
282
- removeClass(name: string): void;
283
- /**
284
- *
285
- * @param cls
286
- * @param set
287
- */
288
- setClass(cls: string, set: boolean): this;
289
- /**
290
- * Toggle a class from the element (if present remove, if absent add)
291
- * @param {string|string[]} name - classes in string form can be space separated
292
- * @example ```typescript
293
- * el.toggleClass( 'myclass' );
294
- * el.toggleClass( 'myclass1 myclass2');
295
- * el.toggleClass( ['myclass1','myclass2']);
296
- */
297
- toggleClass(name: string): void;
298
- /**
299
- * check if the object has the class
300
- * @param cls
301
- */
302
- hasClass(cls: string): boolean;
303
- /**
304
- * remove all classes from the object
305
- * this is usefull for component recycling & reusing
306
- */
307
- clearClasses(): string;
308
- _build(): HTMLElement;
309
- render(props: P): void;
310
- _createDOM(): HTMLElement;
311
- protected _setTabIndex(tabIndex: number | boolean, defValue?: number): void;
312
- private static _observeCreation;
313
- dispose(): void;
314
- protected _dispose(with_dom: boolean, timers: boolean): void;
315
- componentDisposed(): void;
316
- componentCreated(): void;
317
- /**
318
- *
319
- */
320
- update(delay?: number): void;
321
- /**
322
- * empty the node
323
- */
324
- _empty(): void;
325
- _updateContent(): void;
326
- /**
327
- * @return the bounding rectangle
328
- * @example ```typescript
329
- * let rc = el.getBoundingRect( );
330
- * console.log( rc.left, rc.top, rc.right, rc.bottom );
331
- */
332
- getBoundingRect(withMargins?: boolean): Rect;
333
- /**
334
- * append a new dom event handler
335
- * @param name - you can specify multiple names separated by a space
336
- * @param handler
337
- * @example
338
- *
339
- * this.setDomEvent( 'drag drop', this._handleDrag, this );
340
- * this.setDomEvent( 'dblclick', this._handleDblClick, this );
341
- */
342
- setDomEvent<K extends keyof X4ElementEventMap>(type: K, listener: (this: HTMLDivElement, ev: X4ElementEventMap[K]) => void): void;
343
- private _setDomEvent;
344
- /**
345
- *
346
- */
347
- clearDomEvent<K extends keyof X4ElementEventMap>(type: K): void;
348
- /**
349
- *
350
- * @param name
351
- * @param handler
352
- */
353
- createEvent(name: string, handler: Function): void;
354
- /**
355
- * dispatch a dom event to the appropriated component
356
- * called by the system
357
- */
358
- private static _dispatchEvent;
359
- /**
360
- * dispatch a dom event to the appropriated component
361
- * called by the system
362
- */
363
- private static _dispatchUnbubbleEvent;
364
- /**
365
- * called when a size change on an observed component
366
- */
367
- private static _observeSize;
368
- /**
369
- * enum all children recursively
370
- * @param recursive - if true do a full sub-child search
371
- * @param cb - callback
372
- * return true to stop enumeration
373
- */
374
- enumChilds(cb: (child: Component) => boolean | void, recursive?: boolean): boolean;
375
- /**
376
- * apprend a child to the DOM
377
- * @param props child to append (or string)
378
- */
379
- private _appendChild;
380
- /**
381
- * generate classes from the component inheritance
382
- * @example
383
- * Button extends Component will give
384
- * x-comp x-button
385
- */
386
- private _genClassName;
387
- /**
388
- * prepend the system class name prefix on a name if needed (if class starts with @)
389
- */
390
- private _makeCls;
391
- /**
392
- *
393
- */
394
- private static dispatchCaptures;
395
- /**
396
- * capture mouse events
397
- * @param capture name of the current capture
398
- * @param callback funciton to call on captured mouse events
399
- *
400
- * @example
401
- * Component.setCapture( this, ( ev: MouseEvent, initiator: Component ) => {
402
- * if( ev.type=='mousemove' ) {
403
- * this.setStyle( {
404
- * left: ev.clientX,
405
- * top: ev.clientY
406
- * } );
407
- * }
408
- * else if( ev.type=='mouseup' ) {
409
- * Component.releaseCapture( );
410
- * }
411
- * } );
412
- */
413
- protected static setCapture(initiator: Component, listener: EventHandler<UIEvent>): void;
414
- protected static releaseCapture(): void;
415
- /**
416
- * ensure the component is visible
417
- * @param: alignToTop
418
- */
419
- scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
420
- /**
421
- * search for a given css selector
422
- * @param selector
423
- * @returns child or null
424
- */
425
- queryItem<T extends Component>(selector: string): T;
426
- queryAll(selector: string, cb?: (el: Component) => void): HTMLElement[];
427
- /**
428
- * find a child with the given ID
429
- * @param id id (without '#')
430
- * @returns child or null
431
- *
432
- * @example
433
- * let btn = this.childWithId<Button>( 'myButtonId' );
434
- */
435
- itemWithId<T extends Component>(id: string): T;
436
- /**
437
- * find a child with given ref
438
- * @param ref
439
- * @return found child or null
440
- */
441
- itemWithRef<T = Component>(ref: string): T;
442
- /**
443
- *
444
- */
445
- get ref(): string;
446
- /**
447
- *
448
- */
449
- static getCss(): Stylesheet;
450
- /**
451
- * return the parent element
452
- * care, object must have been created (dom!=null)
453
- */
454
- getParent(): Component;
455
- /**
456
- * get a component from a DOM element
457
- * move up to the hierarchy to find the request class type.
458
- * @param dom
459
- * @param classname
460
- * @returns
461
- *
462
- * @example
463
- *
464
- * with a DOM like that:
465
- * Button
466
- * Label
467
- * Icon <- the DOM you have (dom-icon)
468
- *
469
- * let btn = Component.getElement( dom-icon, Button );
470
- */
471
- static getElement<T extends Component>(dom: HTMLElement | Element, classname?: Constructor<T> | string): T;
472
- /**
473
- * compute the scrollbar size ( width = height)
474
- */
475
- static getScrollbarSize(): any;
476
- /**
477
- * check if the Component is visible to the user
478
- */
479
- isUserVisible(): boolean;
480
- }
481
- /**
482
- * warp <b>temporarily</b> a DOM element to be able to acces to exact API
483
- * @param dom dom element to wrap
484
- * @review qui libere le fly_element ? -> timeout
485
- */
486
- export declare function flyWrap<T extends Component>(dom: HTMLElement | EventTarget): T;
487
- /**
488
- * simple flex spacer
489
- */
490
- export declare class Flex extends Component {
491
- constructor(props?: CProps);
492
- }
493
- /**
494
- * simple space between 2 elements
495
- */
496
- export declare class Space extends Component {
497
- m_size: number | string;
498
- constructor(size: number | string);
499
- componentCreated(): void;
500
- }
501
- /**
502
- * sizable separator
503
- */
504
- type SizeMode = null | 'minimize' | 'maximize' | 'restore';
505
- export interface EvSize extends BasicEvent {
506
- readonly size: Size;
507
- readonly mode: SizeMode;
508
- }
509
- export declare function EvSize(size: Size, mode?: SizeMode, context?: any): EvSize;
510
- interface SeparatorEventMap extends CEventMap {
511
- resize?: EvSize;
512
- }
513
- interface SeparatorProps extends CProps<SeparatorEventMap> {
514
- readonly orientation: 'vertical' | 'horizontal';
515
- readonly sizing: 'before' | 'after';
516
- readonly collapsible?: boolean;
517
- }
518
- export declare class Separator extends Component<SeparatorProps, SeparatorEventMap> {
519
- m_irect: Rect;
520
- m_delta: number;
521
- m_target: Component;
522
- constructor(props: SeparatorProps);
523
- render(): void;
524
- private _collapse;
525
- private _mousedown;
526
- _startMoving(x: number, y: number, ev: UIEvent): void;
527
- private _pointerMoved;
528
- private _findTarget;
529
- }
530
- /**
531
- * properties
532
- */
533
- type SizerOverlaySens = 'left' | 'top' | 'right' | 'bottom' | 'topleft' | 'topright' | 'bottomleft' | 'bottomright';
534
- export interface EvOverlayResize extends BasicEvent {
535
- ui_event: UIEvent;
536
- sens: SizerOverlaySens;
537
- }
538
- export declare function EvOverlayResize(ui_event: UIEvent, sens: SizerOverlaySens, context?: any): EvOverlayResize;
539
- interface SizerOverlayEventMap extends CEventMap {
540
- resize: EvSize;
541
- rawresize: EvOverlayResize;
542
- }
543
- export interface SizerOverlayProps extends CProps<SizerOverlayEventMap> {
544
- sens: SizerOverlaySens;
545
- target: Component;
546
- resize?: EventCallback<EvSize>;
547
- }
548
- export declare class SizerOverlay extends Component<SizerOverlayProps, SizerOverlayEventMap> {
549
- private m_delta;
550
- private m_irect;
551
- constructor(props: SizerOverlayProps);
552
- resetflex(event: UIEvent): void;
553
- _mousedown(ev: UIEvent): void;
554
- private _is_horz;
555
- get sens(): SizerOverlaySens;
556
- private _handle_mouse;
557
- }
558
- /**
559
- * sequence: Shift+Ctrl+Alt+A
560
- */
561
- export interface Shortcut {
562
- sequence: string;
563
- name: string;
564
- immediate: boolean;
565
- callback?: (domTarget: any) => void;
566
- }
567
- interface EvShortcut extends BasicEvent {
568
- name: string;
569
- }
570
- declare function EvShortcut(name: string): EvShortcut;
571
- export interface ContainerEventMap extends CEventMap {
572
- shortcut: EvShortcut;
573
- }
574
- export interface ContainerProps<E extends ContainerEventMap = ContainerEventMap> extends CProps<E> {
575
- }
576
- /**
577
- * you can construct a Container as usual with it's properties but also directly with it's children array
578
- *
579
- * @example
580
- * new Container( [
581
- * child1,
582
- * child2
583
- * ])
584
- */
585
- export declare class Container<P extends ContainerProps = ContainerProps, E extends ContainerEventMap = ContainerEventMap> extends Component<P, E> {
586
- private m_shortcuts;
587
- constructor(props: P | ComponentOrString[]);
588
- /**
589
- * add an application shortcut
590
- * @param sequence key sequence Shift+Ctrl+Alt+K
591
- * @param callback callback to call
592
- */
593
- addShortcut(sequence: string | string[], name: string, callback?: EventHandler<KeyboardEvent>, immediate?: boolean): void;
594
- /**
595
- * remove all shortcuts for a target
596
- */
597
- removeShortcuts(): void;
598
- /** @ignore this function is binded */
599
- private _handleKeydown;
600
- }
601
- export type ComponentConstructor<T> = new (props: CProps) => T;