x4js 1.5.4 → 1.5.6
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/lib/changelog.txt +8 -0
- package/lib/cjs/combobox.js +111 -21
- package/lib/cjs/label.js +2 -2
- package/lib/cjs/listview.js +3 -1
- package/lib/cjs/messagebox.js +27 -0
- package/lib/cjs/tools.js +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/combobox.js +114 -22
- package/lib/esm/label.js +3 -3
- package/lib/esm/listview.js +3 -1
- package/lib/esm/messagebox.js +16 -0
- package/lib/esm/tools.js +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/src/combobox.ts +141 -38
- package/lib/src/gridview.ts +2 -2
- package/lib/src/label.ts +3 -3
- package/lib/src/listview.ts +5 -2
- package/lib/src/messagebox.ts +21 -0
- package/lib/src/radiobtn.ts +3 -2
- package/lib/src/spreadsheet.ts +2 -2
- package/lib/src/tabbar.ts +1 -1
- package/lib/src/textedit.ts +2 -2
- package/lib/src/tools.ts +1 -1
- package/lib/src/version.ts +1 -1
- package/lib/types/combobox.d.ts +11 -5
- package/lib/types/gridview.d.ts +2 -2
- package/lib/types/listview.d.ts +1 -1
- package/lib/types/messagebox.d.ts +1 -0
- package/lib/types/radiobtn.d.ts +3 -2
- package/lib/types/spreadsheet.d.ts +2 -2
- package/lib/types/tabbar.d.ts +1 -1
- package/lib/types/textedit.d.ts +2 -2
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/src/combobox.ts
CHANGED
|
@@ -38,7 +38,7 @@ import { Input } from './input'
|
|
|
38
38
|
import { Label } from './label'
|
|
39
39
|
import { Button } from './button'
|
|
40
40
|
import { HLayout } from './layout'
|
|
41
|
-
import { PopupListView, ListViewItem,
|
|
41
|
+
import { PopupListView, ListViewItem, EvCancel, PopulateItems } from './listview';
|
|
42
42
|
import { DataStore, DataView, Record } from './datastore'
|
|
43
43
|
import { isFunction, HtmlString } from './tools'
|
|
44
44
|
|
|
@@ -73,12 +73,12 @@ export interface ComboBoxProps extends CProps<ComboBoxEventMap> {
|
|
|
73
73
|
|
|
74
74
|
labelAlign?: 'left' | 'right';
|
|
75
75
|
|
|
76
|
-
items?: ListViewItem[];
|
|
77
|
-
populate?: PopulateItems; // if not specified, fire 'populate' event
|
|
76
|
+
items?: ListViewItem[] | PopulateItems;
|
|
78
77
|
value?: any; // shown value at init
|
|
79
78
|
|
|
80
79
|
renderer?: ComboItemRender;
|
|
81
80
|
selectionChange?: EventCallback<EvSelectionChange>;// shortcut to events: { selectionChange: ... }
|
|
81
|
+
editable?: boolean;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/**
|
|
@@ -87,43 +87,97 @@ export interface ComboBoxProps extends CProps<ComboBoxEventMap> {
|
|
|
87
87
|
|
|
88
88
|
export class ComboBox extends HLayout<ComboBoxProps,ComboBoxEventMap> {
|
|
89
89
|
|
|
90
|
-
private m_ui_input: Component;
|
|
90
|
+
private m_ui_input: Input | Component;
|
|
91
91
|
private m_ui_button: Button;
|
|
92
92
|
private m_popup: PopupListView;
|
|
93
|
-
|
|
93
|
+
private m_lockpop: boolean;
|
|
94
|
+
private m_lockchg: boolean;
|
|
95
|
+
private m_popvis: boolean;
|
|
94
96
|
private m_selection: ListViewItem;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
|
|
97
98
|
constructor(props: ComboBoxProps) {
|
|
98
99
|
super(props);
|
|
99
100
|
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
if( !props.editable ) {
|
|
102
|
+
this.setDomEvent( 'keypress', () => this.showPopup() );
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
this.setDomEvent( 'click', () => {
|
|
106
|
+
if( this.m_props.editable ) {
|
|
107
|
+
this.m_ui_input.focus( );
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
this.showPopup();
|
|
111
|
+
} );
|
|
102
112
|
|
|
113
|
+
this.setDomEvent("keydown", e => this._onKey(e));
|
|
103
114
|
this.mapPropEvents(props, 'selectionChange' );
|
|
115
|
+
|
|
116
|
+
this.m_popvis = false;
|
|
117
|
+
this.m_lockpop = false;
|
|
118
|
+
this.m_lockchg = false;
|
|
104
119
|
}
|
|
105
120
|
|
|
121
|
+
_onKey(e) {
|
|
122
|
+
if (this.m_popvis) {
|
|
123
|
+
if (e.key == "ArrowUp" || e.key == "ArrowDown") {
|
|
124
|
+
this.m_lockpop = true;
|
|
125
|
+
this.m_popup.handleKey(e);
|
|
126
|
+
this.m_lockpop = false;
|
|
127
|
+
e.preventDefault();
|
|
128
|
+
e.stopPropagation();
|
|
129
|
+
}
|
|
130
|
+
else if (e.key == "Escape") {
|
|
131
|
+
this._hidePopup();
|
|
132
|
+
e.preventDefault();
|
|
133
|
+
e.stopPropagation();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
106
138
|
set items( items: ListViewItem[] ) {
|
|
107
139
|
this.m_props.items = items;
|
|
108
140
|
if( this.m_popup ) {
|
|
109
141
|
this.m_popup.items = items;
|
|
110
142
|
}
|
|
111
143
|
}
|
|
112
|
-
|
|
144
|
+
|
|
113
145
|
/** @ignore */
|
|
114
146
|
render( props: ComboBoxProps ) {
|
|
115
147
|
|
|
116
148
|
if( !props.renderer ) {
|
|
117
|
-
|
|
149
|
+
|
|
150
|
+
const input = new Input( {
|
|
118
151
|
flex : 1,
|
|
119
|
-
readOnly : true,
|
|
152
|
+
readOnly : this.m_props.editable ? false : true,
|
|
120
153
|
tabIndex : 0,
|
|
121
154
|
name: props.name,
|
|
122
155
|
value_hook: {
|
|
123
156
|
get: (): string => { return this.value; },
|
|
124
157
|
set: (v: string) => { this.value = v; }
|
|
158
|
+
},
|
|
159
|
+
dom_events: {
|
|
160
|
+
focus: () => {
|
|
161
|
+
if( this.m_props.editable && input.value.length==0 ) {
|
|
162
|
+
this.showPopup( );
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
input: ( ) => {
|
|
166
|
+
if( this.m_lockchg ) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const text = input.value;
|
|
171
|
+
this.m_selection = { id: undefined, text };
|
|
172
|
+
let items = this.showPopup( );
|
|
173
|
+
if( items && items.length && items[0].text==text ) {
|
|
174
|
+
this.m_selection = { id: items[0].id, text };
|
|
175
|
+
}
|
|
176
|
+
}
|
|
125
177
|
}
|
|
126
178
|
});
|
|
179
|
+
|
|
180
|
+
this.m_ui_input = input;
|
|
127
181
|
}
|
|
128
182
|
else {
|
|
129
183
|
this.m_ui_input = new Component( {
|
|
@@ -162,7 +216,9 @@ export class ComboBox extends HLayout<ComboBoxProps,ComboBoxEventMap> {
|
|
|
162
216
|
cls: 'gadget',
|
|
163
217
|
icon: 'var( --x4-icon-angle-down )',
|
|
164
218
|
tabIndex: false,
|
|
165
|
-
click: () =>
|
|
219
|
+
click: () => {
|
|
220
|
+
this.showPopup( false )
|
|
221
|
+
},
|
|
166
222
|
dom_events: {
|
|
167
223
|
focus: () => { this.dom.focus(); },
|
|
168
224
|
}
|
|
@@ -188,11 +244,21 @@ export class ComboBox extends HLayout<ComboBoxProps,ComboBoxEventMap> {
|
|
|
188
244
|
* display the popup
|
|
189
245
|
*/
|
|
190
246
|
|
|
191
|
-
showPopup() {
|
|
247
|
+
showPopup( filter_items: boolean = true ) {
|
|
192
248
|
|
|
193
249
|
let props = this.m_props;
|
|
194
250
|
if (props.readOnly || this.hasClass("@disable") ) {
|
|
195
|
-
return;
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
let items = props.items;
|
|
255
|
+
if( isFunction( items ) ) {
|
|
256
|
+
const filter = filter_items ? (this.m_ui_input as Input).value : null;
|
|
257
|
+
items = items( filter );
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if( items.length==0 ) {
|
|
261
|
+
return null;
|
|
196
262
|
}
|
|
197
263
|
|
|
198
264
|
// need creation ?
|
|
@@ -205,10 +271,17 @@ export class ComboBox extends HLayout<ComboBoxProps,ComboBoxEventMap> {
|
|
|
205
271
|
// prepare the combo listview
|
|
206
272
|
this.m_popup = new PopupListView({
|
|
207
273
|
cls: '@combo-popup',
|
|
208
|
-
items: props.items,
|
|
209
274
|
populate: props.populate,
|
|
210
275
|
renderItem: this.m_props.renderer,
|
|
211
|
-
selectionChange: (e) =>
|
|
276
|
+
selectionChange: (e) => {
|
|
277
|
+
|
|
278
|
+
this._selectItem(e);
|
|
279
|
+
|
|
280
|
+
if (!this.m_lockpop) {
|
|
281
|
+
this._hidePopup();
|
|
282
|
+
this.focus();
|
|
283
|
+
}
|
|
284
|
+
},
|
|
212
285
|
cancel: ( e ) => this.signal( 'cancel', e ),
|
|
213
286
|
style: {
|
|
214
287
|
fontFamily,
|
|
@@ -216,6 +289,8 @@ export class ComboBox extends HLayout<ComboBoxProps,ComboBoxEventMap> {
|
|
|
216
289
|
}
|
|
217
290
|
});
|
|
218
291
|
}
|
|
292
|
+
|
|
293
|
+
this.m_popup.items = items;
|
|
219
294
|
|
|
220
295
|
let r1 = this.m_ui_button.getBoundingRect(),
|
|
221
296
|
r2 = this.m_ui_input.getBoundingRect();
|
|
@@ -225,10 +300,14 @@ export class ComboBox extends HLayout<ComboBoxProps,ComboBoxEventMap> {
|
|
|
225
300
|
});
|
|
226
301
|
|
|
227
302
|
this.m_popup.displayAt(r2.left, r2.bottom);
|
|
303
|
+
this.m_popvis = true;
|
|
304
|
+
this.startTimer("focus-check", 100, true, () => this._checkFocus());
|
|
228
305
|
|
|
229
306
|
if( this.value!==undefined ) {
|
|
230
307
|
this.m_popup.selection = this.value;
|
|
231
308
|
}
|
|
309
|
+
|
|
310
|
+
return items;
|
|
232
311
|
}
|
|
233
312
|
|
|
234
313
|
/** @ignore
|
|
@@ -241,8 +320,10 @@ export class ComboBox extends HLayout<ComboBoxProps,ComboBoxEventMap> {
|
|
|
241
320
|
return;
|
|
242
321
|
}
|
|
243
322
|
|
|
323
|
+
this.m_lockchg = true;
|
|
244
324
|
this._setInput( item, true );
|
|
245
|
-
|
|
325
|
+
this.m_lockchg = false;
|
|
326
|
+
|
|
246
327
|
this.m_selection = {
|
|
247
328
|
id: item.id,
|
|
248
329
|
text: item.text
|
|
@@ -250,9 +331,8 @@ export class ComboBox extends HLayout<ComboBoxProps,ComboBoxEventMap> {
|
|
|
250
331
|
|
|
251
332
|
this.emit( 'selectionChange', EvSelectionChange( item ) );
|
|
252
333
|
this.emit( 'change', EvChange(item.id) );
|
|
253
|
-
this.m_ui_input.focus( );
|
|
254
|
-
|
|
255
|
-
this.m_popup.hide( );
|
|
334
|
+
//this.m_ui_input.focus( );
|
|
335
|
+
//this.m_popup.hide( );
|
|
256
336
|
}
|
|
257
337
|
|
|
258
338
|
/**
|
|
@@ -294,7 +374,15 @@ export class ComboBox extends HLayout<ComboBoxProps,ComboBoxEventMap> {
|
|
|
294
374
|
}
|
|
295
375
|
|
|
296
376
|
public get valueText( ) {
|
|
297
|
-
|
|
377
|
+
if( this.m_selection ) {
|
|
378
|
+
return this.m_selection.text;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
if( this.m_props.editable ) {
|
|
382
|
+
return (this.m_ui_input as Input).value;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
return '';
|
|
298
386
|
}
|
|
299
387
|
|
|
300
388
|
/**
|
|
@@ -305,9 +393,9 @@ export class ComboBox extends HLayout<ComboBoxProps,ComboBoxEventMap> {
|
|
|
305
393
|
let items = this.m_props.items;
|
|
306
394
|
|
|
307
395
|
if( isFunction(items) ) {
|
|
308
|
-
items = items( );
|
|
396
|
+
items = items( null );
|
|
309
397
|
}
|
|
310
|
-
|
|
398
|
+
|
|
311
399
|
const found = items.some( (v) => {
|
|
312
400
|
if (v.id === id) {
|
|
313
401
|
this._setInput( v );
|
|
@@ -326,6 +414,27 @@ export class ComboBox extends HLayout<ComboBoxProps,ComboBoxEventMap> {
|
|
|
326
414
|
return this.m_ui_input instanceof Input ? this.m_ui_input : null;
|
|
327
415
|
}
|
|
328
416
|
|
|
417
|
+
_checkFocus() {
|
|
418
|
+
const focus = document.activeElement;
|
|
419
|
+
if (this.dom && this.dom.contains(focus) || focus==document.body ) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
if (this.m_popup && this.m_popup.dom && this.m_popup.dom.contains(focus)) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
this._hidePopup();
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
_hidePopup() {
|
|
431
|
+
if (this.m_popvis) {
|
|
432
|
+
this.m_popup.close();
|
|
433
|
+
this.m_popvis = false;
|
|
434
|
+
this.stopTimer("focus-check");
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
329
438
|
static storeProxy( props: ComboStoreProxyProps ): PopulateItems {
|
|
330
439
|
|
|
331
440
|
let view: DataView = props.store instanceof DataStore ? props.store.createView() : props.store;
|
|
@@ -343,20 +452,14 @@ export class ComboBox extends HLayout<ComboBoxProps,ComboBoxEventMap> {
|
|
|
343
452
|
return result;
|
|
344
453
|
};
|
|
345
454
|
}
|
|
346
|
-
}
|
|
347
455
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
456
|
+
focus( ) {
|
|
457
|
+
if( this.m_props.editable ) {
|
|
458
|
+
this.m_ui_input.focus( );
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
super.focus( );
|
|
462
|
+
}
|
|
463
|
+
}
|
|
355
464
|
}
|
|
356
465
|
|
|
357
|
-
*/
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
package/lib/src/gridview.ts
CHANGED
|
@@ -40,7 +40,7 @@ import { HLayout, VLayout } from './layout'
|
|
|
40
40
|
import { Component, ContainerEventMap, EvSize, EvDblClick, CProps, flyWrap, html, HtmlString, SizerOverlay, Flex } from './component'
|
|
41
41
|
import { Label } from './label'
|
|
42
42
|
import { _tr } from './i18n'
|
|
43
|
-
import
|
|
43
|
+
import { FormatFunc } from './formatters'
|
|
44
44
|
import { downloadData, isFunction } from './tools'
|
|
45
45
|
import { DataView, DataStore, Record } from './datastore'
|
|
46
46
|
|
|
@@ -71,7 +71,7 @@ export interface GridColumn {
|
|
|
71
71
|
flex?: number;
|
|
72
72
|
align?: 'left' | 'center' | 'right';
|
|
73
73
|
renderer?: CellRenderer;
|
|
74
|
-
formatter?:
|
|
74
|
+
formatter?: FormatFunc;
|
|
75
75
|
cls?: string;
|
|
76
76
|
sortable?: boolean;
|
|
77
77
|
}
|
package/lib/src/label.ts
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
**/
|
|
29
29
|
|
|
30
30
|
import { Component, CProps } from './component'
|
|
31
|
-
import { HtmlString } from './tools'
|
|
31
|
+
import { escapeHtml, HtmlString } from './tools'
|
|
32
32
|
import { Icon, IconID } from './icon'
|
|
33
33
|
|
|
34
34
|
// ============================================================================
|
|
@@ -69,7 +69,7 @@ export class Label extends Component<LabelProps>
|
|
|
69
69
|
|
|
70
70
|
let text: any = this.m_props.text;
|
|
71
71
|
if( this.m_props.multiline && !(text instanceof HtmlString) ) {
|
|
72
|
-
text = new HtmlString( (text
|
|
72
|
+
text = new HtmlString( escapeHtml(text,true) );
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
if( !props.icon ) {
|
|
@@ -102,7 +102,7 @@ export class Label extends Component<LabelProps>
|
|
|
102
102
|
|
|
103
103
|
let text: any = this.m_props.text;
|
|
104
104
|
if( this.m_props.multiline && !(text instanceof HtmlString) ) {
|
|
105
|
-
text = new HtmlString(
|
|
105
|
+
text = new HtmlString(escapeHtml(text,true) );
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
if( this.dom ) {
|
package/lib/src/listview.ts
CHANGED
|
@@ -62,7 +62,7 @@ export interface RenderListItem {
|
|
|
62
62
|
* callback to fill the list
|
|
63
63
|
*/
|
|
64
64
|
export interface PopulateItems {
|
|
65
|
-
(): ListViewItem[];
|
|
65
|
+
( filter: string ): ListViewItem[];
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
/**
|
|
@@ -137,7 +137,7 @@ export class ListView extends VLayout<ListViewProps,ListViewEventMap> {
|
|
|
137
137
|
this._buildItems();
|
|
138
138
|
}
|
|
139
139
|
else if( this.m_props.populate ) {
|
|
140
|
-
this.items = this.m_props.populate( );
|
|
140
|
+
this.items = this.m_props.populate( null );
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
@@ -449,6 +449,9 @@ export class ListView extends VLayout<ListViewProps,ListViewEventMap> {
|
|
|
449
449
|
/** @ignore */
|
|
450
450
|
private _handleClick(e: MouseEvent) {
|
|
451
451
|
|
|
452
|
+
e.stopImmediatePropagation();
|
|
453
|
+
e.preventDefault( );
|
|
454
|
+
|
|
452
455
|
let dom = e.target as HTMLElement,
|
|
453
456
|
self = this.dom,
|
|
454
457
|
list_items = this.m_props.items as ListViewItem[]; // already created by build
|
package/lib/src/messagebox.ts
CHANGED
|
@@ -105,6 +105,27 @@ export class MessageBox extends Dialog<MessageBoxProps>
|
|
|
105
105
|
return msg;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
static async showAsync( props: string | HtmlString | MessageBoxProps): Promise<string> {
|
|
109
|
+
return new Promise( (resolve, reject ) => {
|
|
110
|
+
|
|
111
|
+
let _props: MessageBoxProps;
|
|
112
|
+
|
|
113
|
+
const cb = ( btn: string ) => {
|
|
114
|
+
resolve( btn );
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (isString(props) || isHtmlString(props)) {
|
|
118
|
+
_props = { message: props, click: cb };
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
_props = { ...props, click: cb };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const msg = new MessageBox(_props);
|
|
125
|
+
msg.show();
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
108
129
|
/**
|
|
109
130
|
* display an alert message
|
|
110
131
|
*/
|
package/lib/src/radiobtn.ts
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
**/
|
|
29
29
|
|
|
30
30
|
import { x4document } from './x4dom'
|
|
31
|
+
import { HtmlString } from './tools'
|
|
31
32
|
|
|
32
33
|
import { Component, CProps, CEventMap } from './component'
|
|
33
34
|
import { EvChange, EventCallback } from './x4events'
|
|
@@ -185,11 +186,11 @@ export class RadioBtn extends Component<RadioBtnProps,RadioBtnEventMap> {
|
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
188
|
|
|
188
|
-
get text( ) {
|
|
189
|
+
get text( ): HtmlString | string {
|
|
189
190
|
return this.itemWithRef<Label>('label').text;
|
|
190
191
|
}
|
|
191
192
|
|
|
192
|
-
set text( text ) {
|
|
193
|
+
set text( text: HtmlString | string ) {
|
|
193
194
|
this.itemWithRef<Label>('label').text = text;
|
|
194
195
|
}
|
|
195
196
|
}
|
package/lib/src/spreadsheet.ts
CHANGED
|
@@ -33,7 +33,7 @@ import { Component, SizerOverlay, EvDblClick, EvSize, ContainerEventMap, Contain
|
|
|
33
33
|
import { Input, InputProps } from './input';
|
|
34
34
|
import { HLayout, VLayout } from './layout';
|
|
35
35
|
import { TextEditProps, TextEdit } from './textedit';
|
|
36
|
-
import
|
|
36
|
+
import { FormatFunc } from './formatters'
|
|
37
37
|
import { asap, parseIntlFloat } from './tools';
|
|
38
38
|
import { deferCall } from './tools';
|
|
39
39
|
import { EvContextMenu, EvChange, EvSelectionChange, EventCallback } from './x4events'
|
|
@@ -56,7 +56,7 @@ export interface ColProp {
|
|
|
56
56
|
align?: string;
|
|
57
57
|
cls?: string;
|
|
58
58
|
min_width?: number;
|
|
59
|
-
renderer?:
|
|
59
|
+
renderer?: FormatFunc;
|
|
60
60
|
createEditor?: EditorFactory; // null => disable edition
|
|
61
61
|
}
|
|
62
62
|
|
package/lib/src/tabbar.ts
CHANGED
package/lib/src/textedit.ts
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
import { x4document } from './x4dom'
|
|
31
31
|
|
|
32
32
|
import { Component, EvFocus, HtmlString } from './component'
|
|
33
|
-
import { Input, InputProps, InputEventMap } from './input'
|
|
33
|
+
import { Input, InputProps, InputEventMap, EditType } from './input'
|
|
34
34
|
import { IconID } from './icon'
|
|
35
35
|
import { Button } from './button'
|
|
36
36
|
import { HLayout } from './layout'
|
|
@@ -538,7 +538,7 @@ export class TextEdit<T extends TextEditProps = TextEditProps, E extends TextEdi
|
|
|
538
538
|
return this.m_ui_input;
|
|
539
539
|
}
|
|
540
540
|
|
|
541
|
-
get type() {
|
|
541
|
+
get type(): EditType {
|
|
542
542
|
return this.m_props.type;
|
|
543
543
|
}
|
|
544
544
|
}
|
package/lib/src/tools.ts
CHANGED
|
@@ -346,7 +346,7 @@ export function sprintf(format: string, ...args) {
|
|
|
346
346
|
*/
|
|
347
347
|
export function escapeHtml(unsafe: string, nl_br = false): string {
|
|
348
348
|
if (!unsafe || unsafe.length == 0) {
|
|
349
|
-
return
|
|
349
|
+
return "";
|
|
350
350
|
}
|
|
351
351
|
|
|
352
352
|
let result = unsafe.replace(/[<>\&\"\']/g, function (c) {
|
package/lib/src/version.ts
CHANGED
package/lib/types/combobox.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ import { Component, CProps, ContainerEventMap } from './component';
|
|
|
33
33
|
import { EvChange, EvSelectionChange, EventCallback } from './x4events';
|
|
34
34
|
import { Input } from './input';
|
|
35
35
|
import { HLayout } from './layout';
|
|
36
|
-
import { ListViewItem,
|
|
36
|
+
import { ListViewItem, EvCancel, PopulateItems } from './listview';
|
|
37
37
|
import { DataStore, DataView, Record } from './datastore';
|
|
38
38
|
import { HtmlString } from './tools';
|
|
39
39
|
export interface ComboStoreProxyProps {
|
|
@@ -55,11 +55,11 @@ export interface ComboBoxProps extends CProps<ComboBoxEventMap> {
|
|
|
55
55
|
label?: string;
|
|
56
56
|
labelWidth?: number;
|
|
57
57
|
labelAlign?: 'left' | 'right';
|
|
58
|
-
items?: ListViewItem[];
|
|
59
|
-
populate?: PopulateItems;
|
|
58
|
+
items?: ListViewItem[] | PopulateItems;
|
|
60
59
|
value?: any;
|
|
61
60
|
renderer?: ComboItemRender;
|
|
62
61
|
selectionChange?: EventCallback<EvSelectionChange>;
|
|
62
|
+
editable?: boolean;
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* @review use textedit
|
|
@@ -68,9 +68,12 @@ export declare class ComboBox extends HLayout<ComboBoxProps, ComboBoxEventMap> {
|
|
|
68
68
|
private m_ui_input;
|
|
69
69
|
private m_ui_button;
|
|
70
70
|
private m_popup;
|
|
71
|
+
private m_lockpop;
|
|
72
|
+
private m_lockchg;
|
|
73
|
+
private m_popvis;
|
|
71
74
|
private m_selection;
|
|
72
|
-
private m_defer_sel;
|
|
73
75
|
constructor(props: ComboBoxProps);
|
|
76
|
+
_onKey(e: any): void;
|
|
74
77
|
set items(items: ListViewItem[]);
|
|
75
78
|
/** @ignore */
|
|
76
79
|
render(props: ComboBoxProps): void;
|
|
@@ -78,7 +81,7 @@ export declare class ComboBox extends HLayout<ComboBoxProps, ComboBoxEventMap> {
|
|
|
78
81
|
/**
|
|
79
82
|
* display the popup
|
|
80
83
|
*/
|
|
81
|
-
showPopup():
|
|
84
|
+
showPopup(filter_items?: boolean): ListViewItem[];
|
|
82
85
|
/** @ignore
|
|
83
86
|
*/
|
|
84
87
|
private _selectItem;
|
|
@@ -96,6 +99,9 @@ export declare class ComboBox extends HLayout<ComboBoxProps, ComboBoxEventMap> {
|
|
|
96
99
|
*/
|
|
97
100
|
set value(id: any);
|
|
98
101
|
get input(): Input;
|
|
102
|
+
_checkFocus(): void;
|
|
103
|
+
_hidePopup(): void;
|
|
99
104
|
static storeProxy(props: ComboStoreProxyProps): PopulateItems;
|
|
105
|
+
focus(): void;
|
|
100
106
|
}
|
|
101
107
|
export {};
|
package/lib/types/gridview.d.ts
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
import { VLayout } from './layout';
|
|
30
30
|
import { Component, ContainerEventMap, EvDblClick, CProps, HtmlString } from './component';
|
|
31
31
|
import { Label } from './label';
|
|
32
|
-
import
|
|
32
|
+
import { FormatFunc } from './formatters';
|
|
33
33
|
import { DataView, DataStore, Record } from './datastore';
|
|
34
34
|
import { EvContextMenu, EvSelectionChange, BasicEvent, EventDisposer } from "./x4events";
|
|
35
35
|
export interface EvGridCheck extends BasicEvent {
|
|
@@ -47,7 +47,7 @@ export interface GridColumn {
|
|
|
47
47
|
flex?: number;
|
|
48
48
|
align?: 'left' | 'center' | 'right';
|
|
49
49
|
renderer?: CellRenderer;
|
|
50
|
-
formatter?:
|
|
50
|
+
formatter?: FormatFunc;
|
|
51
51
|
cls?: string;
|
|
52
52
|
sortable?: boolean;
|
|
53
53
|
}
|
package/lib/types/listview.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export declare class MessageBox extends Dialog<MessageBoxProps> {
|
|
|
46
46
|
* display a messagebox
|
|
47
47
|
*/
|
|
48
48
|
static show(props: string | HtmlString | MessageBoxProps): MessageBox;
|
|
49
|
+
static showAsync(props: string | HtmlString | MessageBoxProps): Promise<string>;
|
|
49
50
|
/**
|
|
50
51
|
* display an alert message
|
|
51
52
|
*/
|
package/lib/types/radiobtn.d.ts
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
|
+
import { HtmlString } from './tools';
|
|
29
30
|
import { Component, CProps, CEventMap } from './component';
|
|
30
31
|
import { EvChange, EventCallback } from './x4events';
|
|
31
32
|
import { IconID } from './icon';
|
|
@@ -66,7 +67,7 @@ export declare class RadioBtn extends Component<RadioBtnProps, RadioBtnEventMap>
|
|
|
66
67
|
* @param {boolean} ck new checked value
|
|
67
68
|
*/
|
|
68
69
|
set check(ck: boolean);
|
|
69
|
-
get text():
|
|
70
|
-
set text(text:
|
|
70
|
+
get text(): HtmlString | string;
|
|
71
|
+
set text(text: HtmlString | string);
|
|
71
72
|
}
|
|
72
73
|
export {};
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
import { Component, EvDblClick, ContainerEventMap, ContainerProps } from './component';
|
|
30
30
|
import { InputProps } from './input';
|
|
31
31
|
import { VLayout } from './layout';
|
|
32
|
-
import
|
|
32
|
+
import { FormatFunc } from './formatters';
|
|
33
33
|
import { EvContextMenu, EvChange, EvSelectionChange, EventCallback } from './x4events';
|
|
34
34
|
export interface EditorFactory {
|
|
35
35
|
(props: InputProps, row: number, col: number): Component;
|
|
@@ -44,7 +44,7 @@ export interface ColProp {
|
|
|
44
44
|
align?: string;
|
|
45
45
|
cls?: string;
|
|
46
46
|
min_width?: number;
|
|
47
|
-
renderer?:
|
|
47
|
+
renderer?: FormatFunc;
|
|
48
48
|
createEditor?: EditorFactory;
|
|
49
49
|
}
|
|
50
50
|
/**
|
package/lib/types/tabbar.d.ts
CHANGED
|
@@ -53,6 +53,6 @@ export declare class TabBar extends Container<TabBarProps, TabBarEventMap> {
|
|
|
53
53
|
render(): void;
|
|
54
54
|
select(id: string | null, notify?: boolean): boolean;
|
|
55
55
|
private _select;
|
|
56
|
-
get selection(): Component
|
|
56
|
+
get selection(): Component;
|
|
57
57
|
}
|
|
58
58
|
export {};
|
package/lib/types/textedit.d.ts
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
29
|
import { Component, EvFocus, HtmlString } from './component';
|
|
30
|
-
import { Input, InputProps, InputEventMap } from './input';
|
|
30
|
+
import { Input, InputProps, InputEventMap, EditType } from './input';
|
|
31
31
|
import { IconID } from './icon';
|
|
32
32
|
import { EvClick, EvChange, EventCallback } from './x4events';
|
|
33
33
|
type ValidationFunction = (value: string) => string;
|
|
@@ -118,6 +118,6 @@ export declare class TextEdit<T extends TextEditProps = TextEditProps, E extends
|
|
|
118
118
|
_date_validator(value: string): string;
|
|
119
119
|
private _showDatePicker;
|
|
120
120
|
get input(): Input;
|
|
121
|
-
get type():
|
|
121
|
+
get type(): EditType;
|
|
122
122
|
}
|
|
123
123
|
export {};
|
package/lib/types/version.d.ts
CHANGED