x4js 1.5.39 → 1.6.0
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.
- package/README.md +1 -1
- package/changelog.txt +23 -0
- package/lib/README.txt +1 -1
- package/lib/changelog.txt +3 -0
- package/lib/cjs/{index.js → x4js.js} +3 -3
- package/lib/cjs/x4js.js.map +7 -0
- package/lib/esm/{index.mjs → x4js.mjs} +3 -3
- package/lib/esm/{index.mjs.map → x4js.mjs.map} +1 -1
- package/lib/src/MIT-license.md +1 -1
- package/lib/src/action.ts +1 -1
- package/lib/src/app_sockets.ts +1 -1
- package/lib/src/application.ts +1 -1
- package/lib/src/autocomplete.ts +1 -1
- package/lib/src/base64.ts +1 -1
- package/lib/src/base_component.ts +1 -1
- package/lib/src/button.ts +1 -1
- package/lib/src/calendar.ts +1 -1
- package/lib/src/canvas.ts +1 -1
- package/lib/src/cardview.ts +1 -1
- package/lib/src/checkbox.ts +1 -1
- package/lib/src/color.ts +1 -1
- package/lib/src/colorpicker.ts +1 -1
- package/lib/src/combobox.ts +1 -1
- package/lib/src/component.ts +1 -1
- package/lib/src/copyright.txt +1 -1
- package/lib/src/datastore.ts +1 -1
- package/lib/src/dialog.ts +1 -1
- package/lib/src/dom_events.ts +1 -1
- package/lib/src/drag_manager.ts +1 -1
- package/lib/src/drawtext.ts +1 -1
- package/lib/src/fileupload.ts +1 -1
- package/lib/src/form.ts +1 -1
- package/lib/src/formatters.ts +1 -1
- package/lib/src/gridview.ts +1 -1
- package/lib/src/i18n.ts +1 -1
- package/lib/src/icon.ts +1 -1
- package/lib/src/image.ts +1 -1
- package/lib/src/index.ts +1 -1
- package/lib/src/input.ts +1 -1
- package/lib/src/label.ts +1 -1
- package/lib/src/layout.ts +1 -1
- package/lib/src/link.ts +1 -1
- package/lib/src/listview.ts +1 -1
- package/lib/src/md5.ts +1 -1
- package/lib/src/menu.ts +1 -1
- package/lib/src/messagebox.ts +1 -1
- package/lib/src/panel.ts +1 -1
- package/lib/src/popup.ts +1 -1
- package/lib/src/property_editor.ts +1 -1
- package/lib/src/radiobtn.ts +1 -1
- package/lib/src/rating.ts +1 -1
- package/lib/src/request.ts +1 -1
- package/lib/src/router.ts +1 -1
- package/lib/src/settings.ts +1 -1
- package/lib/src/sidebarview.ts +1 -1
- package/lib/src/spreadsheet.ts +1 -1
- package/lib/src/styles.ts +1 -1
- package/lib/src/svgcomponent.ts +1 -1
- package/lib/src/tabbar.ts +1 -1
- package/lib/src/tabview.ts +1 -1
- package/lib/src/textarea.ts +1 -1
- package/lib/src/textedit.ts +1 -1
- package/lib/src/toaster.ts +1 -1
- package/lib/src/tools.ts +1 -1
- package/lib/src/tooltips.ts +1 -1
- package/lib/src/treeview.ts +1 -1
- package/lib/src/version.ts +2 -2
- package/lib/src/x4.less +1 -1
- package/lib/src/x4dom.ts +1 -1
- package/lib/src/x4events.ts +1 -1
- package/lib/src/x4js.ts +89 -0
- package/lib/src/x4react.ts +1 -1
- package/lib/styles/x4.css +1 -1
- package/lib/styles/x4.less +1 -1
- package/lib/types/x4js.d.ts +6762 -0
- package/package.json +10 -8
- package/lib/cjs/index.js.map +0 -7
- package/lib/esm/index.js.map +0 -7
- package/lib/types/action.d.ts +0 -57
- package/lib/types/app_sockets.d.ts +0 -29
- package/lib/types/application.d.ts +0 -108
- package/lib/types/autocomplete.d.ts +0 -63
- package/lib/types/base_component.d.ts +0 -88
- package/lib/types/button.d.ts +0 -151
- package/lib/types/calendar.d.ts +0 -82
- package/lib/types/canvas.d.ts +0 -92
- package/lib/types/cardview.d.ts +0 -87
- package/lib/types/checkbox.d.ts +0 -77
- package/lib/types/color.d.ts +0 -148
- package/lib/types/colorpicker.d.ts +0 -107
- package/lib/types/combobox.d.ts +0 -111
- package/lib/types/component.d.ts +0 -603
- package/lib/types/datastore.d.ts +0 -396
- package/lib/types/dialog.d.ts +0 -175
- package/lib/types/dom_events.d.ts +0 -302
- package/lib/types/drag_manager.d.ts +0 -58
- package/lib/types/drawtext.d.ts +0 -48
- package/lib/types/fileupload.d.ts +0 -64
- package/lib/types/form.d.ts +0 -142
- package/lib/types/formatters.d.ts +0 -35
- package/lib/types/gridview.d.ts +0 -175
- package/lib/types/i18n.d.ts +0 -73
- package/lib/types/icon.d.ts +0 -71
- package/lib/types/image.d.ts +0 -56
- package/lib/types/index.d.ts +0 -84
- package/lib/types/input.d.ts +0 -97
- package/lib/types/label.d.ts +0 -67
- package/lib/types/layout.d.ts +0 -89
- package/lib/types/link.d.ts +0 -50
- package/lib/types/listview.d.ts +0 -178
- package/lib/types/md5.d.ts +0 -61
- package/lib/types/menu.d.ts +0 -130
- package/lib/types/messagebox.d.ts +0 -69
- package/lib/types/panel.d.ts +0 -47
- package/lib/types/popup.d.ts +0 -75
- package/lib/types/property_editor.d.ts +0 -71
- package/lib/types/radiobtn.d.ts +0 -73
- package/lib/types/rating.d.ts +0 -53
- package/lib/types/request.d.ts +0 -52
- package/lib/types/router.d.ts +0 -67
- package/lib/types/settings.d.ts +0 -37
- package/lib/types/sidebarview.d.ts +0 -51
- package/lib/types/spreadsheet.d.ts +0 -222
- package/lib/types/styles.d.ts +0 -85
- package/lib/types/svgcomponent.d.ts +0 -216
- package/lib/types/tabbar.d.ts +0 -58
- package/lib/types/tabview.d.ts +0 -49
- package/lib/types/textarea.d.ts +0 -77
- package/lib/types/textedit.d.ts +0 -126
- package/lib/types/toaster.d.ts +0 -42
- package/lib/types/tools.d.ts +0 -394
- package/lib/types/tooltips.d.ts +0 -46
- package/lib/types/treeview.d.ts +0 -144
- package/lib/types/version.d.ts +0 -29
- package/lib/types/x4dom.d.ts +0 -49
- package/lib/types/x4events.d.ts +0 -269
- package/lib/types/x4react.d.ts +0 -41
package/lib/types/component.d.ts
DELETED
|
@@ -1,603 +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
|
-
removeChild(item: Component): void;
|
|
167
|
-
/**
|
|
168
|
-
*
|
|
169
|
-
*/
|
|
170
|
-
setTag(tag: string, namespace?: string): void;
|
|
171
|
-
/**
|
|
172
|
-
* get the Component data value
|
|
173
|
-
* @param name name to get
|
|
174
|
-
*/
|
|
175
|
-
getData(name: string | Symbol): any;
|
|
176
|
-
/**
|
|
177
|
-
* set the Component data value
|
|
178
|
-
* @param name name to get
|
|
179
|
-
* @param value
|
|
180
|
-
*/
|
|
181
|
-
setData(name: string | Symbol, value: any): void;
|
|
182
|
-
/**
|
|
183
|
-
* return the DOM associated with the Component (if any)
|
|
184
|
-
*/
|
|
185
|
-
get dom(): HTMLElement;
|
|
186
|
-
/**
|
|
187
|
-
* shows the element
|
|
188
|
-
* @param show
|
|
189
|
-
*/
|
|
190
|
-
show(show?: boolean): void;
|
|
191
|
-
/**
|
|
192
|
-
* hides the element
|
|
193
|
-
*/
|
|
194
|
-
hide(): void;
|
|
195
|
-
/**
|
|
196
|
-
* enable or disable the element
|
|
197
|
-
* @param enable
|
|
198
|
-
*/
|
|
199
|
-
enable(enable?: boolean): void;
|
|
200
|
-
/**
|
|
201
|
-
* disable the element
|
|
202
|
-
*/
|
|
203
|
-
disable(): void;
|
|
204
|
-
/**
|
|
205
|
-
* set the focus on the element
|
|
206
|
-
*/
|
|
207
|
-
focus(): void;
|
|
208
|
-
/**
|
|
209
|
-
* change the object style
|
|
210
|
-
* @param style - style to add
|
|
211
|
-
* @example ```typescript
|
|
212
|
-
* el.setStyle( {left:100} );
|
|
213
|
-
*/
|
|
214
|
-
setStyle(style: object): void;
|
|
215
|
-
/**
|
|
216
|
-
* change a style value
|
|
217
|
-
* @param name string style nale
|
|
218
|
-
* @param value any style value or null to remove style
|
|
219
|
-
*/
|
|
220
|
-
setStyleValue(name: string, value: any): void;
|
|
221
|
-
private _setDomStyleValue;
|
|
222
|
-
/**
|
|
223
|
-
* compute the element style
|
|
224
|
-
* @return all styles computed
|
|
225
|
-
*/
|
|
226
|
-
getComputedStyle(pseudoElt?: string): ComputedStyle;
|
|
227
|
-
/**
|
|
228
|
-
* return a single stype value
|
|
229
|
-
* @param name - value to get
|
|
230
|
-
*/
|
|
231
|
-
getStyleValue(name: string): any;
|
|
232
|
-
/**
|
|
233
|
-
* define the elements attributes
|
|
234
|
-
* @param attrs
|
|
235
|
-
*/
|
|
236
|
-
setAttributes(attrs: any): void;
|
|
237
|
-
/**
|
|
238
|
-
* change a single attribute
|
|
239
|
-
* @param name attribute name
|
|
240
|
-
* @param value new value
|
|
241
|
-
*/
|
|
242
|
-
setAttribute(name: string, value: any): void;
|
|
243
|
-
private _setDomAttribute;
|
|
244
|
-
/**
|
|
245
|
-
* remove an atrribute
|
|
246
|
-
* @param name name of the attribute
|
|
247
|
-
*/
|
|
248
|
-
removeAttribute(name: string): void;
|
|
249
|
-
/**
|
|
250
|
-
* get an attribute value
|
|
251
|
-
* @param {string} name - attribute name
|
|
252
|
-
* @return {string} attribute value
|
|
253
|
-
* @example ```typescript
|
|
254
|
-
* let chk = el.getAttribute( 'checked' );
|
|
255
|
-
* @review double cache
|
|
256
|
-
*/
|
|
257
|
-
getAttribute(name: string): string;
|
|
258
|
-
/**
|
|
259
|
-
* check if the element has an attribute
|
|
260
|
-
* @param name attribute name
|
|
261
|
-
* @return true is attribute is present
|
|
262
|
-
* @example ```typescript
|
|
263
|
-
* if( el.hasAttribute('checked') ) {
|
|
264
|
-
* }
|
|
265
|
-
*/
|
|
266
|
-
hasAttribute(name: string): boolean;
|
|
267
|
-
/**
|
|
268
|
-
* a some classnames to the component
|
|
269
|
-
* classes can be separated by a space
|
|
270
|
-
* @param cls class to add
|
|
271
|
-
* @example ```typescript
|
|
272
|
-
* addClass( 'my class name @flex' );
|
|
273
|
-
*/
|
|
274
|
-
addClass(name: string): void;
|
|
275
|
-
/**
|
|
276
|
-
* Remove a class from the element
|
|
277
|
-
* @param {string|array} name - classes in string form can be space separated
|
|
278
|
-
*
|
|
279
|
-
* @example ```typescript
|
|
280
|
-
* el.removeClass( 'myclass' );
|
|
281
|
-
* el.removeClass( 'myclass1 myclass2' );
|
|
282
|
-
*/
|
|
283
|
-
removeClass(name: string): void;
|
|
284
|
-
/**
|
|
285
|
-
*
|
|
286
|
-
* @param cls
|
|
287
|
-
* @param set
|
|
288
|
-
*/
|
|
289
|
-
setClass(cls: string, set: boolean): this;
|
|
290
|
-
/**
|
|
291
|
-
* Toggle a class from the element (if present remove, if absent add)
|
|
292
|
-
* @param {string|string[]} name - classes in string form can be space separated
|
|
293
|
-
* @example ```typescript
|
|
294
|
-
* el.toggleClass( 'myclass' );
|
|
295
|
-
* el.toggleClass( 'myclass1 myclass2');
|
|
296
|
-
* el.toggleClass( ['myclass1','myclass2']);
|
|
297
|
-
*/
|
|
298
|
-
toggleClass(name: string): void;
|
|
299
|
-
/**
|
|
300
|
-
* check if the object has the class
|
|
301
|
-
* @param cls
|
|
302
|
-
*/
|
|
303
|
-
hasClass(cls: string): boolean;
|
|
304
|
-
/**
|
|
305
|
-
* remove all classes from the object
|
|
306
|
-
* this is usefull for component recycling & reusing
|
|
307
|
-
*/
|
|
308
|
-
clearClasses(): string;
|
|
309
|
-
_build(): HTMLElement;
|
|
310
|
-
render(props: P): void;
|
|
311
|
-
_createDOM(): HTMLElement;
|
|
312
|
-
protected _setTabIndex(tabIndex: number | boolean, defValue?: number): void;
|
|
313
|
-
private static _observeCreation;
|
|
314
|
-
dispose(): void;
|
|
315
|
-
protected _dispose(with_dom: boolean, timers: boolean): void;
|
|
316
|
-
componentDisposed(): void;
|
|
317
|
-
componentCreated(): void;
|
|
318
|
-
/**
|
|
319
|
-
*
|
|
320
|
-
*/
|
|
321
|
-
update(delay?: number): void;
|
|
322
|
-
/**
|
|
323
|
-
* empty the node
|
|
324
|
-
*/
|
|
325
|
-
_empty(): void;
|
|
326
|
-
_updateContent(): void;
|
|
327
|
-
/**
|
|
328
|
-
* @return the bounding rectangle
|
|
329
|
-
* @example ```typescript
|
|
330
|
-
* let rc = el.getBoundingRect( );
|
|
331
|
-
* console.log( rc.left, rc.top, rc.right, rc.bottom );
|
|
332
|
-
*/
|
|
333
|
-
getBoundingRect(withMargins?: boolean): Rect;
|
|
334
|
-
/**
|
|
335
|
-
* append a new dom event handler
|
|
336
|
-
* @param name - you can specify multiple names separated by a space
|
|
337
|
-
* @param handler
|
|
338
|
-
* @example
|
|
339
|
-
*
|
|
340
|
-
* this.setDomEvent( 'drag drop', this._handleDrag, this );
|
|
341
|
-
* this.setDomEvent( 'dblclick', this._handleDblClick, this );
|
|
342
|
-
*/
|
|
343
|
-
setDomEvent<K extends keyof X4ElementEventMap>(type: K, listener: (this: HTMLDivElement, ev: X4ElementEventMap[K]) => void, passive?: boolean): void;
|
|
344
|
-
private _setDomEvent;
|
|
345
|
-
/**
|
|
346
|
-
*
|
|
347
|
-
*/
|
|
348
|
-
clearDomEvent<K extends keyof X4ElementEventMap>(type: K): void;
|
|
349
|
-
/**
|
|
350
|
-
*
|
|
351
|
-
* @param name
|
|
352
|
-
* @param handler
|
|
353
|
-
*/
|
|
354
|
-
private _createEvent;
|
|
355
|
-
/**
|
|
356
|
-
* dispatch a dom event to the appropriated component
|
|
357
|
-
* called by the system
|
|
358
|
-
*/
|
|
359
|
-
private static _dispatchEvent;
|
|
360
|
-
/**
|
|
361
|
-
* dispatch a dom event to the appropriated component
|
|
362
|
-
* called by the system
|
|
363
|
-
*/
|
|
364
|
-
private static _dispatchUnbubbleEvent;
|
|
365
|
-
/**
|
|
366
|
-
* called when a size change on an observed component
|
|
367
|
-
*/
|
|
368
|
-
private static _observeSize;
|
|
369
|
-
/**
|
|
370
|
-
* enum all children recursively
|
|
371
|
-
* @param recursive - if true do a full sub-child search
|
|
372
|
-
* @param cb - callback
|
|
373
|
-
* return true to stop enumeration
|
|
374
|
-
*/
|
|
375
|
-
enumChilds(cb: (child: Component) => boolean | void, recursive?: boolean): boolean;
|
|
376
|
-
/**
|
|
377
|
-
* apprend a child to the DOM
|
|
378
|
-
* @param props child to append (or string)
|
|
379
|
-
*/
|
|
380
|
-
private _appendChild;
|
|
381
|
-
/**
|
|
382
|
-
* generate classes from the component inheritance
|
|
383
|
-
* @example
|
|
384
|
-
* Button extends Component will give
|
|
385
|
-
* x-comp x-button
|
|
386
|
-
*/
|
|
387
|
-
private _genClassName;
|
|
388
|
-
/**
|
|
389
|
-
* prepend the system class name prefix on a name if needed (if class starts with @)
|
|
390
|
-
*/
|
|
391
|
-
private _makeCls;
|
|
392
|
-
/**
|
|
393
|
-
*
|
|
394
|
-
*/
|
|
395
|
-
private static dispatchCaptures;
|
|
396
|
-
/**
|
|
397
|
-
* capture mouse events
|
|
398
|
-
* @param capture name of the current capture
|
|
399
|
-
* @param callback funciton to call on captured mouse events
|
|
400
|
-
*
|
|
401
|
-
* @example
|
|
402
|
-
* Component.setCapture( this, ( ev: MouseEvent, initiator: Component ) => {
|
|
403
|
-
* if( ev.type=='mousemove' ) {
|
|
404
|
-
* this.setStyle( {
|
|
405
|
-
* left: ev.clientX,
|
|
406
|
-
* top: ev.clientY
|
|
407
|
-
* } );
|
|
408
|
-
* }
|
|
409
|
-
* else if( ev.type=='mouseup' ) {
|
|
410
|
-
* Component.releaseCapture( );
|
|
411
|
-
* }
|
|
412
|
-
* } );
|
|
413
|
-
*/
|
|
414
|
-
protected static setCapture(initiator: Component, listener: EventHandler<UIEvent>): void;
|
|
415
|
-
protected static releaseCapture(): void;
|
|
416
|
-
/**
|
|
417
|
-
* ensure the component is visible
|
|
418
|
-
* @param: alignToTop
|
|
419
|
-
*/
|
|
420
|
-
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
|
|
421
|
-
/**
|
|
422
|
-
* search for a given css selector
|
|
423
|
-
* @param selector
|
|
424
|
-
* @returns child or null
|
|
425
|
-
*/
|
|
426
|
-
queryItem<T extends Component>(selector: string): T;
|
|
427
|
-
queryAll(selector: string, cb?: (el: Component) => void): HTMLElement[];
|
|
428
|
-
/**
|
|
429
|
-
* find a child with the given ID
|
|
430
|
-
* @param id id (without '#')
|
|
431
|
-
* @returns child or null
|
|
432
|
-
*
|
|
433
|
-
* @example
|
|
434
|
-
* let btn = this.childWithId<Button>( 'myButtonId' );
|
|
435
|
-
*/
|
|
436
|
-
itemWithId<T extends Component>(id: string): T;
|
|
437
|
-
/**
|
|
438
|
-
* find a child with given ref
|
|
439
|
-
* @param ref
|
|
440
|
-
* @return found child or null
|
|
441
|
-
*/
|
|
442
|
-
itemWithRef<T = Component>(ref: string): T;
|
|
443
|
-
/**
|
|
444
|
-
*
|
|
445
|
-
*/
|
|
446
|
-
get ref(): string;
|
|
447
|
-
/**
|
|
448
|
-
*
|
|
449
|
-
*/
|
|
450
|
-
static getCss(): Stylesheet;
|
|
451
|
-
/**
|
|
452
|
-
* return the parent element
|
|
453
|
-
* care, object must have been created (dom!=null)
|
|
454
|
-
*/
|
|
455
|
-
getParent(): Component;
|
|
456
|
-
/**
|
|
457
|
-
* get a component from a DOM element
|
|
458
|
-
* move up to the hierarchy to find the request class type.
|
|
459
|
-
* @param dom
|
|
460
|
-
* @param classname
|
|
461
|
-
* @returns
|
|
462
|
-
*
|
|
463
|
-
* @example
|
|
464
|
-
*
|
|
465
|
-
* with a DOM like that:
|
|
466
|
-
* Button
|
|
467
|
-
* Label
|
|
468
|
-
* Icon <- the DOM you have (dom-icon)
|
|
469
|
-
*
|
|
470
|
-
* let btn = Component.getElement( dom-icon, Button );
|
|
471
|
-
*/
|
|
472
|
-
static getElement<T extends Component>(dom: HTMLElement | Element, classname?: Constructor<T> | string): T;
|
|
473
|
-
/**
|
|
474
|
-
* compute the scrollbar size ( width = height)
|
|
475
|
-
*/
|
|
476
|
-
static getScrollbarSize(): any;
|
|
477
|
-
/**
|
|
478
|
-
* check if the Component is visible to the user
|
|
479
|
-
*/
|
|
480
|
-
isUserVisible(): boolean;
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
|
-
* warp <b>temporarily</b> a DOM element to be able to acces to exact API
|
|
484
|
-
* @param dom dom element to wrap
|
|
485
|
-
* @review qui libere le fly_element ? -> timeout
|
|
486
|
-
*/
|
|
487
|
-
export declare function flyWrap<T extends Component>(dom: HTMLElement | EventTarget): T;
|
|
488
|
-
/**
|
|
489
|
-
* simple flex spacer
|
|
490
|
-
*/
|
|
491
|
-
export declare class Flex extends Component {
|
|
492
|
-
constructor(props?: CProps);
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* simple space between 2 elements
|
|
496
|
-
*/
|
|
497
|
-
export declare class Space extends Component {
|
|
498
|
-
m_size: number | string;
|
|
499
|
-
constructor(size: number | string);
|
|
500
|
-
componentCreated(): void;
|
|
501
|
-
}
|
|
502
|
-
/**
|
|
503
|
-
* sizable separator
|
|
504
|
-
*/
|
|
505
|
-
type SizeMode = null | 'minimize' | 'maximize' | 'restore';
|
|
506
|
-
export interface EvSize extends BasicEvent {
|
|
507
|
-
readonly size: Size;
|
|
508
|
-
readonly mode: SizeMode;
|
|
509
|
-
}
|
|
510
|
-
export declare function EvSize(size: Size, mode?: SizeMode, context?: any): EvSize;
|
|
511
|
-
interface SeparatorEventMap extends CEventMap {
|
|
512
|
-
resize?: EvSize;
|
|
513
|
-
}
|
|
514
|
-
interface SeparatorProps extends CProps<SeparatorEventMap> {
|
|
515
|
-
readonly orientation: 'vertical' | 'horizontal';
|
|
516
|
-
readonly sizing: 'before' | 'after';
|
|
517
|
-
readonly collapsible?: boolean;
|
|
518
|
-
}
|
|
519
|
-
export declare class Separator extends Component<SeparatorProps, SeparatorEventMap> {
|
|
520
|
-
m_irect: Rect;
|
|
521
|
-
m_delta: number;
|
|
522
|
-
m_target: Component;
|
|
523
|
-
constructor(props: SeparatorProps);
|
|
524
|
-
render(): void;
|
|
525
|
-
private _collapse;
|
|
526
|
-
private _mousedown;
|
|
527
|
-
_startMoving(x: number, y: number, ev: UIEvent): void;
|
|
528
|
-
private _pointerMoved;
|
|
529
|
-
private _findTarget;
|
|
530
|
-
}
|
|
531
|
-
/**
|
|
532
|
-
* properties
|
|
533
|
-
*/
|
|
534
|
-
type SizerOverlaySens = 'left' | 'top' | 'right' | 'bottom' | 'topleft' | 'topright' | 'bottomleft' | 'bottomright';
|
|
535
|
-
export interface EvOverlayResize extends BasicEvent {
|
|
536
|
-
ui_event: UIEvent;
|
|
537
|
-
sens: SizerOverlaySens;
|
|
538
|
-
}
|
|
539
|
-
export declare function EvOverlayResize(ui_event: UIEvent, sens: SizerOverlaySens, context?: any): EvOverlayResize;
|
|
540
|
-
interface SizerOverlayEventMap extends CEventMap {
|
|
541
|
-
resize: EvSize;
|
|
542
|
-
rawresize: EvOverlayResize;
|
|
543
|
-
}
|
|
544
|
-
export interface SizerOverlayProps extends CProps<SizerOverlayEventMap> {
|
|
545
|
-
sens: SizerOverlaySens;
|
|
546
|
-
target: Component;
|
|
547
|
-
resize?: EventCallback<EvSize>;
|
|
548
|
-
}
|
|
549
|
-
export declare class SizerOverlay extends Component<SizerOverlayProps, SizerOverlayEventMap> {
|
|
550
|
-
private m_delta;
|
|
551
|
-
private m_irect;
|
|
552
|
-
constructor(props: SizerOverlayProps);
|
|
553
|
-
resetflex(event: UIEvent): void;
|
|
554
|
-
_mousedown(ev: UIEvent): void;
|
|
555
|
-
private _is_horz;
|
|
556
|
-
get sens(): SizerOverlaySens;
|
|
557
|
-
private _handle_mouse;
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* sequence: Shift+Ctrl+Alt+A
|
|
561
|
-
*/
|
|
562
|
-
export interface Shortcut {
|
|
563
|
-
sequence: string;
|
|
564
|
-
name: string;
|
|
565
|
-
immediate: boolean;
|
|
566
|
-
callback?: (domTarget: any) => void;
|
|
567
|
-
}
|
|
568
|
-
interface EvShortcut extends BasicEvent {
|
|
569
|
-
name: string;
|
|
570
|
-
}
|
|
571
|
-
declare function EvShortcut(name: string): EvShortcut;
|
|
572
|
-
export interface ContainerEventMap extends CEventMap {
|
|
573
|
-
shortcut: EvShortcut;
|
|
574
|
-
}
|
|
575
|
-
export interface ContainerProps<E extends ContainerEventMap = ContainerEventMap> extends CProps<E> {
|
|
576
|
-
}
|
|
577
|
-
/**
|
|
578
|
-
* you can construct a Container as usual with it's properties but also directly with it's children array
|
|
579
|
-
*
|
|
580
|
-
* @example
|
|
581
|
-
* new Container( [
|
|
582
|
-
* child1,
|
|
583
|
-
* child2
|
|
584
|
-
* ])
|
|
585
|
-
*/
|
|
586
|
-
export declare class Container<P extends ContainerProps = ContainerProps, E extends ContainerEventMap = ContainerEventMap> extends Component<P, E> {
|
|
587
|
-
private m_shortcuts;
|
|
588
|
-
constructor(props: P);
|
|
589
|
-
constructor(items: ComponentOrString[], cls?: string);
|
|
590
|
-
/**
|
|
591
|
-
* add an application shortcut
|
|
592
|
-
* @param sequence key sequence Shift+Ctrl+Alt+K
|
|
593
|
-
* @param callback callback to call
|
|
594
|
-
*/
|
|
595
|
-
addShortcut(sequence: string | string[], name: string, callback?: EventHandler<KeyboardEvent>, immediate?: boolean): void;
|
|
596
|
-
/**
|
|
597
|
-
* remove all shortcuts for a target
|
|
598
|
-
*/
|
|
599
|
-
removeShortcuts(): void;
|
|
600
|
-
/** @ignore this function is binded */
|
|
601
|
-
private _handleKeydown;
|
|
602
|
-
}
|
|
603
|
-
export type ComponentConstructor<T> = new (props: CProps) => T;
|