x4js 1.4.17 → 1.4.21
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 +4 -3
- package/lib/application.d.ts +1 -1
- package/lib/application.js +4 -3
- package/lib/base_component.d.ts +1 -1
- package/lib/base_component.js +3 -3
- package/lib/button.d.ts +1 -1
- package/lib/button.js +3 -3
- package/lib/calendar.d.ts +1 -1
- package/lib/calendar.js +5 -4
- package/lib/canvas.d.ts +1 -1
- package/lib/canvas.js +2 -2
- package/lib/cardview.d.ts +1 -1
- package/lib/cardview.js +2 -2
- package/lib/checkbox.d.ts +1 -1
- package/lib/checkbox.js +2 -2
- package/lib/colorpicker.d.ts +1 -1
- package/lib/colorpicker.js +5 -5
- package/lib/combobox.d.ts +1 -1
- package/lib/combobox.js +3 -3
- package/lib/component.d.ts +1 -5
- package/lib/component.js +35 -39
- package/lib/datastore.d.ts +1 -1
- package/lib/datastore.js +5 -5
- package/lib/dialog.d.ts +1 -1
- package/lib/dialog.js +4 -3
- package/lib/drag_manager.js +30 -1
- package/lib/fileupload.js +2 -1
- package/lib/form.d.ts +1 -1
- package/lib/gridview.d.ts +1 -5
- package/lib/gridview.js +8 -7
- package/lib/i18n.d.ts +35 -33
- package/lib/i18n.js +180 -93
- package/lib/icon.d.ts +1 -1
- package/lib/icon.js +19 -16
- package/lib/image.js +4 -3
- package/lib/index.d.ts +1 -4
- package/lib/index.js +4 -4
- package/lib/input.js +1 -1
- package/lib/link.d.ts +1 -1
- package/lib/link.js +2 -2
- package/lib/listview.d.ts +1 -1
- package/lib/listview.js +10 -9
- package/lib/menu.d.ts +1 -1
- package/lib/menu.js +5 -4
- package/lib/popup.d.ts +1 -1
- package/lib/popup.js +13 -12
- package/lib/property_editor.d.ts +1 -1
- package/lib/property_editor.js +2 -2
- package/lib/radiobtn.d.ts +1 -1
- package/lib/radiobtn.js +4 -3
- package/lib/rating.d.ts +1 -1
- package/lib/rating.js +2 -2
- package/lib/router.d.ts +1 -1
- package/lib/router.js +5 -4
- package/lib/spreadsheet.d.ts +1 -1
- package/lib/spreadsheet.js +9 -8
- package/lib/styles.js +6 -5
- package/lib/svgcomponent.d.ts +1 -1
- package/lib/svgcomponent.js +4 -1
- package/lib/tabbar.d.ts +1 -1
- package/lib/tabbar.js +2 -2
- package/lib/textarea.d.ts +1 -1
- package/lib/textarea.js +2 -2
- package/lib/textedit.d.ts +1 -1
- package/lib/textedit.js +5 -4
- package/lib/tools.d.ts +1 -0
- package/lib/tools.js +15 -6
- package/lib/tooltips.js +6 -5
- package/lib/treeview.d.ts +1 -1
- package/lib/treeview.js +8 -8
- package/lib/x4dom.d.ts +49 -0
- package/lib/x4dom.js +32 -0
- package/lib/x4events.d.ts +266 -0
- package/lib/x4events.js +389 -0
- package/package.json +4 -3
- package/src/application.ts +5 -4
- package/src/base_component.ts +1 -1
- package/src/button.ts +1 -1
- package/src/calendar.ts +5 -3
- package/src/canvas.ts +1 -1
- package/src/cardview.ts +1 -1
- package/src/checkbox.ts +1 -1
- package/src/colorpicker.ts +1 -1
- package/src/combobox.ts +1 -1
- package/src/component.ts +34 -39
- package/src/datastore.ts +1 -1
- package/src/dialog.ts +4 -2
- package/src/drag_manager.ts +4 -1
- package/src/fileupload.ts +2 -1
- package/src/form.ts +1 -1
- package/src/gridview.ts +4 -3
- package/src/hosts/electron.ts +4 -1
- package/src/i18n.ts +234 -97
- package/src/icon.ts +18 -16
- package/src/image.ts +5 -3
- package/src/index.ts +4 -4
- package/src/input.ts +1 -1
- package/src/layout.ts +1 -1
- package/src/link.ts +1 -1
- package/src/listview.ts +6 -4
- package/src/menu.ts +5 -3
- package/src/popup.ts +14 -12
- package/src/property_editor.ts +1 -1
- package/src/radiobtn.ts +4 -2
- package/src/rating.ts +1 -1
- package/src/router.ts +4 -2
- package/src/smartedit.ts +3 -2
- package/src/spreadsheet.ts +8 -6
- package/src/styles.ts +7 -5
- package/src/svgcomponent.ts +4 -1
- package/src/tabbar.ts +1 -1
- package/src/textarea.ts +1 -1
- package/src/textedit.ts +4 -2
- package/src/tools.ts +15 -5
- package/src/tooltips.ts +7 -5
- package/src/treeview.ts +1 -1
- package/src/x4dom.ts +57 -0
- package/src/{x4_events.ts → x4events.ts} +1 -1
- package/tsconfig.json +11 -1
package/src/i18n.ts
CHANGED
|
@@ -28,6 +28,205 @@
|
|
|
28
28
|
**/
|
|
29
29
|
|
|
30
30
|
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* language definition
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
interface Language {
|
|
38
|
+
name: string;
|
|
39
|
+
base: string;
|
|
40
|
+
src_translations: any;
|
|
41
|
+
translations: any;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const sym_lang = Symbol( "i18n" );
|
|
45
|
+
|
|
46
|
+
let languages: Record<string,Language> = {
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* create a new language
|
|
51
|
+
* @param name language name (code)
|
|
52
|
+
* @param base base language (code)
|
|
53
|
+
* @example:
|
|
54
|
+
* ```js
|
|
55
|
+
* createLanguage( 'en', 'fr' );
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
export function createLanguage( name: string, base: string ) {
|
|
60
|
+
languages[name] = {
|
|
61
|
+
name,
|
|
62
|
+
base,
|
|
63
|
+
src_translations: {},
|
|
64
|
+
translations: {}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* check if the given language is known
|
|
70
|
+
* @param name language name (code)
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
export function isLanguage( name: string ): boolean {
|
|
74
|
+
return languages[name]!==undefined;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* build the language with given fragments
|
|
79
|
+
* @param name language name (code)
|
|
80
|
+
* @param parts misc elements that make the language
|
|
81
|
+
* @example:
|
|
82
|
+
* ```js
|
|
83
|
+
* createLanguage( 'en', 'fr' );
|
|
84
|
+
* const app = {
|
|
85
|
+
* clients: {
|
|
86
|
+
* translation1: "hello",
|
|
87
|
+
* }
|
|
88
|
+
* }
|
|
89
|
+
* addTranslation( 'en', app );
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
export function addTranslation( name, ...parts ) {
|
|
94
|
+
|
|
95
|
+
if( !isLanguage(name) ) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const lang = languages[name];
|
|
100
|
+
|
|
101
|
+
parts.forEach( p => {
|
|
102
|
+
_patch( lang.src_translations, p, lang.base );
|
|
103
|
+
} );
|
|
104
|
+
|
|
105
|
+
lang.translations = _mk_proxy( lang.src_translations, lang.base, true );
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
*
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
function _patch( obj: any, by: any, def: string ) {
|
|
113
|
+
for( let n in by ) {
|
|
114
|
+
if( obj[n] instanceof Object ) {
|
|
115
|
+
_patch( obj[n], by[n], def );
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
obj[n] = by[n];
|
|
119
|
+
obj[n] = _mk_proxy( obj[n], def, false );
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return obj;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* when we ask for _tr.xxx
|
|
128
|
+
* reqpath is set to [xxx]
|
|
129
|
+
*
|
|
130
|
+
* then when we try to get _tr.xxx.yyy
|
|
131
|
+
* reqpath is [xxx,yyy]
|
|
132
|
+
* if yyy is not found, we try with base langage for the full reqpath
|
|
133
|
+
* until no base found
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
let req_path: (string | symbol)[];
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
*
|
|
140
|
+
*/
|
|
141
|
+
|
|
142
|
+
function _findBaseTrans( base ) {
|
|
143
|
+
|
|
144
|
+
while( base ) {
|
|
145
|
+
const lang = languages[base];
|
|
146
|
+
let trans = lang.translations;
|
|
147
|
+
let value;
|
|
148
|
+
|
|
149
|
+
for( const p of req_path ) {
|
|
150
|
+
value = trans[p];
|
|
151
|
+
if( value===undefined ) {
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
trans = value;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if( value!==undefined ) {
|
|
159
|
+
return trans;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
base = lang.base;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
console.error( "I18N error: unable to find", '_tr.'+req_path.join('.') );
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
*
|
|
171
|
+
*/
|
|
172
|
+
|
|
173
|
+
function _mk_proxy( obj: any, base: string, root: boolean ) : any {
|
|
174
|
+
return new Proxy( obj, {
|
|
175
|
+
get: (target, prop) => {
|
|
176
|
+
if( root ) {
|
|
177
|
+
req_path = [prop];
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
req_path.push( prop );
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
let value = target[prop];
|
|
184
|
+
if( value===undefined && base ) {
|
|
185
|
+
value = _findBaseTrans( base );
|
|
186
|
+
// keep it for later
|
|
187
|
+
target[prop] = value;
|
|
188
|
+
}
|
|
189
|
+
return value;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export let _tr: any = {};
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* select the given language as current
|
|
198
|
+
* @param name laguage name (code)
|
|
199
|
+
*/
|
|
200
|
+
|
|
201
|
+
export function selectLanguage( name: string ) {
|
|
202
|
+
|
|
203
|
+
if( !isLanguage(name) ) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
_tr = languages[name].translations;
|
|
208
|
+
_tr[sym_lang] = name;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
*
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
export function getCurrentLanguage( ): string {
|
|
216
|
+
return _tr[sym_lang];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
*
|
|
221
|
+
*/
|
|
222
|
+
|
|
223
|
+
export function getAvailableLanguages( ): string[] {
|
|
224
|
+
return Object.keys( languages );
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
31
230
|
/**
|
|
32
231
|
* language definition
|
|
33
232
|
* x4 specific strings
|
|
@@ -55,9 +254,9 @@ let fr = {
|
|
|
55
254
|
invalid_email: 'adresse mail invalide',
|
|
56
255
|
invalid_number: 'valeur numérique invalide',
|
|
57
256
|
|
|
58
|
-
diff_date_seconds: '{0}
|
|
257
|
+
diff_date_seconds: '{0} secondes',
|
|
59
258
|
diff_date_minutes: '{0} minutes',
|
|
60
|
-
diff_date_hours: '{0}
|
|
259
|
+
diff_date_hours: '{0} heures',
|
|
61
260
|
|
|
62
261
|
invalid_date: 'Date non reconnue ({0})',
|
|
63
262
|
empty_list: 'Liste vide',
|
|
@@ -83,6 +282,7 @@ let fr = {
|
|
|
83
282
|
};
|
|
84
283
|
|
|
85
284
|
/** @ignore */
|
|
285
|
+
|
|
86
286
|
let en = {
|
|
87
287
|
global: {
|
|
88
288
|
ok: 'OK',
|
|
@@ -91,119 +291,56 @@ let en = {
|
|
|
91
291
|
yes: 'Yes',
|
|
92
292
|
no: 'No',
|
|
93
293
|
|
|
94
|
-
|
|
294
|
+
open: 'Open',
|
|
295
|
+
new: 'New',
|
|
296
|
+
delete: 'Delete',
|
|
297
|
+
close: 'Close',
|
|
298
|
+
save: 'Save',
|
|
299
|
+
|
|
300
|
+
search: 'Search',
|
|
301
|
+
search_tip: 'Type in the text to search. <b>Enter</b> to start the search. <b>Esc</b> to cancel.',
|
|
302
|
+
|
|
303
|
+
required_field: "missing information",
|
|
95
304
|
invalid_format: "invalid format",
|
|
305
|
+
invalid_email: 'invalid email address',
|
|
306
|
+
invalid_number: 'bad numeric value',
|
|
96
307
|
|
|
97
308
|
diff_date_seconds: '{0} seconds',
|
|
98
309
|
diff_date_minutes: '{0} minutes',
|
|
99
310
|
diff_date_hours: '{0} hours',
|
|
100
311
|
|
|
101
|
-
invalid_date: '
|
|
312
|
+
invalid_date: 'Unrecognized date({0})',
|
|
313
|
+
empty_list: 'Empty list',
|
|
102
314
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
paste: 'Paste'
|
|
106
|
-
}
|
|
107
|
-
}
|
|
315
|
+
date_input_formats: 'm/d/y|m.d.y|m d y|m-d-y|mdy',
|
|
316
|
+
date_format: 'M/D/Y',
|
|
108
317
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
'fr': fr,
|
|
112
|
-
'en': _mk_proxy( _patch( {}, en ) )
|
|
113
|
-
};
|
|
318
|
+
day_short: [ 'sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat' ],
|
|
319
|
+
day_long: [ 'sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday' ],
|
|
114
320
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
* FR by default
|
|
118
|
-
* @example ```typescript
|
|
119
|
-
* console.log( _tr.global.ok );
|
|
120
|
-
*/
|
|
321
|
+
month_short: [ 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jui', 'aug', 'sep', 'oct', 'nov', 'dec' ],
|
|
322
|
+
month_long: [ 'january', 'february', 'march', 'april', 'mau', 'june', 'jully', 'august', 'september', 'october', 'november', 'december' ],
|
|
121
323
|
|
|
122
|
-
|
|
324
|
+
property: 'Property',
|
|
325
|
+
value: 'Value',
|
|
123
326
|
|
|
124
|
-
|
|
125
|
-
* check if the language is known
|
|
126
|
-
* @param name - language name to test
|
|
127
|
-
* @example ```typescript
|
|
128
|
-
* if( isLanguage('fr') ) {
|
|
129
|
-
* }
|
|
130
|
-
*/
|
|
131
|
-
|
|
132
|
-
export function isLanguage( name ) {
|
|
133
|
-
return all_langs[name]!==undefined;
|
|
134
|
-
}
|
|
327
|
+
err_403: `You do not have sufficient rights to do that action`,
|
|
135
328
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
* @example ```typescript
|
|
140
|
-
* selectLanguage( 'en' );
|
|
141
|
-
*/
|
|
142
|
-
|
|
143
|
-
export function selectLanguage( name ) {
|
|
144
|
-
|
|
145
|
-
if( !isLanguage(name) ) {
|
|
146
|
-
return;
|
|
329
|
+
copy: 'Copy',
|
|
330
|
+
cut: 'Cut',
|
|
331
|
+
paste: 'Paste'
|
|
147
332
|
}
|
|
333
|
+
};
|
|
148
334
|
|
|
149
|
-
|
|
150
|
-
|
|
335
|
+
createLanguage( 'fr', null );
|
|
336
|
+
addTranslation( 'fr', fr );
|
|
151
337
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
* you can also patch 'global' elements witch are defined by x4
|
|
155
|
-
* @param name - language name
|
|
156
|
-
* @param definition - definition of the language
|
|
157
|
-
* @example ```typescript
|
|
158
|
-
* setTranslation( 'fr', {
|
|
159
|
-
* this_is_an_example: 'ceci est un exemple',
|
|
160
|
-
* this_is: {
|
|
161
|
-
* another_example: 'ceci est un autre exemple'
|
|
162
|
-
* },
|
|
163
|
-
* global: {
|
|
164
|
-
* ok: 'O.K.'
|
|
165
|
-
* }
|
|
166
|
-
* });
|
|
167
|
-
* console.log( _tr.this_is_an_example ); // defined by the previous line
|
|
168
|
-
* selectLanguage( 'en' );
|
|
169
|
-
* console.log( _tr.this_is_an_example ); // 'en' do not define this, so we get 'fr' one
|
|
170
|
-
*
|
|
171
|
-
*/
|
|
338
|
+
createLanguage( 'en', 'fr' );
|
|
339
|
+
addTranslation( 'en', en );
|
|
172
340
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
if( !isLanguage(name) ) {
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
341
|
+
selectLanguage( 'fr' ); // by default
|
|
178
342
|
|
|
179
|
-
_patch( all_langs[name], definition );
|
|
180
|
-
}
|
|
181
343
|
|
|
182
344
|
|
|
183
|
-
function _patch( obj, by ) {
|
|
184
|
-
for( let n in by ) {
|
|
185
|
-
if( obj[n] instanceof Object ) {
|
|
186
|
-
_patch( obj[n], by[n] );
|
|
187
|
-
}
|
|
188
|
-
else {
|
|
189
|
-
obj[n] = by[n];
|
|
190
|
-
if( obj[n] instanceof Object ) {
|
|
191
|
-
obj[n] = _mk_proxy( obj[n] );
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
345
|
|
|
196
|
-
return obj;
|
|
197
|
-
}
|
|
198
346
|
|
|
199
|
-
function _mk_proxy( obj: any ) : any {
|
|
200
|
-
return new Proxy( obj, {
|
|
201
|
-
get: function(target, prop, receiver) {
|
|
202
|
-
let value = target[prop];
|
|
203
|
-
if( value===undefined ) {
|
|
204
|
-
return fr[prop];
|
|
205
|
-
}
|
|
206
|
-
return value;
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
}
|
package/src/icon.ts
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
import { Component, CProps } from './component'
|
|
31
31
|
import { Stylesheet } from './styles'
|
|
32
32
|
import { HtmlString, isString } from './tools';
|
|
33
|
-
import { BasicEvent, EvChange, EventMap, EventSource } from './
|
|
33
|
+
import { BasicEvent, EvChange, EventMap, EventSource } from './x4events';
|
|
34
34
|
|
|
35
35
|
// ============================================================================
|
|
36
36
|
// [ICON]
|
|
@@ -100,10 +100,15 @@ class Loader extends EventSource<LoadingEventMap> {
|
|
|
100
100
|
const r = await fetch( url );
|
|
101
101
|
if( r.ok ) {
|
|
102
102
|
const svg = await r.text();
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
// check response, must be svg
|
|
104
|
+
if( !svg.startsWith("<svg") ) {
|
|
105
|
+
console.error( "svg loading error: ", svg );
|
|
106
|
+
this.signal( 'loaded', EvLoaded(url,"") );
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
this.svgs.set( url, svg );
|
|
110
|
+
this.signal( 'loaded', EvLoaded(url,svg) );
|
|
111
|
+
}
|
|
107
112
|
}
|
|
108
113
|
}
|
|
109
114
|
}
|
|
@@ -153,6 +158,7 @@ export class Icon extends Component<IconProps>
|
|
|
153
158
|
if (typeof (icon) === 'number') {
|
|
154
159
|
icon = icon.toString(16);
|
|
155
160
|
name = icon;
|
|
161
|
+
console.error( "deprecation error: invalid icon name" );
|
|
156
162
|
}
|
|
157
163
|
else {
|
|
158
164
|
// var( <var-name> )
|
|
@@ -160,7 +166,7 @@ export class Icon extends Component<IconProps>
|
|
|
160
166
|
// in the .css
|
|
161
167
|
// --------------------------
|
|
162
168
|
// :root {
|
|
163
|
-
// --chevron-up:
|
|
169
|
+
// --chevron-up: data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M0 96C0 78.33 14.33 64 32 64H416C433.7 64 448 78.33 448 96C448 113.7 433.7 128 416 128H32C14.33 128 0 113.7 0 96z"/></svg>';
|
|
164
170
|
// }
|
|
165
171
|
//
|
|
166
172
|
// var( "--chevron-up" )
|
|
@@ -193,15 +199,6 @@ export class Icon extends Component<IconProps>
|
|
|
193
199
|
return;
|
|
194
200
|
}
|
|
195
201
|
|
|
196
|
-
// svgpath( <svg-path> )
|
|
197
|
-
// svgpath( "M0 96C0 78.33 14.33 64 32 64H416C433.7 64 448 78.33 448 96C448 113.7 433.7 128 416 128H32C14.33 128 0 113.7 0 96z" )
|
|
198
|
-
const reSvg3 = /\s*svgpath\s*\(\s*(.+)\s*\)\s*/gi;
|
|
199
|
-
let match_pth = reSvg3.exec( icon );
|
|
200
|
-
if( match_pth ) {
|
|
201
|
-
const pth = this._setSVGPath( match_pth[1].trim( ) );
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
202
|
// data( <direct> )
|
|
206
203
|
// data( "data:image/svg+xml;utf8,<svg...></svg>" )
|
|
207
204
|
|
|
@@ -212,6 +209,8 @@ export class Icon extends Component<IconProps>
|
|
|
212
209
|
return;
|
|
213
210
|
}
|
|
214
211
|
|
|
212
|
+
// cls( "fas fa-angle-up" )
|
|
213
|
+
//
|
|
215
214
|
const reCls = /\s*cls\s*\(\s*(.+)\s*\)\s*/gi;
|
|
216
215
|
let match_cls = reCls.exec( icon );
|
|
217
216
|
if( match_cls ) {
|
|
@@ -220,6 +219,8 @@ export class Icon extends Component<IconProps>
|
|
|
220
219
|
return;
|
|
221
220
|
}
|
|
222
221
|
|
|
222
|
+
// url( "www.google.com" )
|
|
223
|
+
//
|
|
223
224
|
const reUrl = /\s*url\s*\(\s*(.+)\s*\)\s*/gi;
|
|
224
225
|
let match_url = reUrl.exec( icon );
|
|
225
226
|
if( match_url ) {
|
|
@@ -234,6 +235,8 @@ export class Icon extends Component<IconProps>
|
|
|
234
235
|
}
|
|
235
236
|
else {
|
|
236
237
|
// todo: deprecated
|
|
238
|
+
console.error( "deprecation error: invalid icon name" );
|
|
239
|
+
|
|
237
240
|
name = icon;
|
|
238
241
|
icon = Stylesheet.getVar( 'icon-'+icon ) as string;
|
|
239
242
|
|
|
@@ -241,7 +244,6 @@ export class Icon extends Component<IconProps>
|
|
|
241
244
|
// name your icon 'icon-xxx'
|
|
242
245
|
// ex:
|
|
243
246
|
// :root { --icon-zoom-p: f00e; }
|
|
244
|
-
console.assert( false );
|
|
245
247
|
icon = '0';
|
|
246
248
|
}
|
|
247
249
|
}
|
package/src/image.ts
CHANGED
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
29
|
|
|
30
|
+
import { x4document } from './x4dom'
|
|
31
|
+
|
|
30
32
|
import { Component, CProps, html } from './component'
|
|
31
33
|
|
|
32
34
|
// ============================================================================
|
|
@@ -167,7 +169,7 @@ export class Image extends Component<ImageProps>
|
|
|
167
169
|
src = el.src;
|
|
168
170
|
|
|
169
171
|
// skip deleted elements
|
|
170
|
-
if( !dom ||
|
|
172
|
+
if( !dom || dom.offsetParent === null ) {
|
|
171
173
|
// do not append to newList
|
|
172
174
|
return;
|
|
173
175
|
}
|
|
@@ -177,8 +179,8 @@ export class Image extends Component<ImageProps>
|
|
|
177
179
|
// if it is visible & inserted inside the document
|
|
178
180
|
if( !done && dom.offsetParent!==null &&
|
|
179
181
|
rc.bottom >= 0 && rc.right >= 0 &&
|
|
180
|
-
rc.top <= (window.innerHeight ||
|
|
181
|
-
rc.left <= (window.innerWidth ||
|
|
182
|
+
rc.top <= (window.innerHeight || x4document.documentElement.clientHeight) &&
|
|
183
|
+
rc.left <= (window.innerWidth || x4document.documentElement.clientWidth) ) {
|
|
182
184
|
|
|
183
185
|
// ok, we load the image
|
|
184
186
|
let img = <HTMLElement>dom.firstChild;
|
package/src/index.ts
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
export * from "./application"
|
|
31
31
|
export * from "./base_component"
|
|
32
|
-
export * from "./base64"
|
|
32
|
+
//export * from "./base64"
|
|
33
33
|
export * from "./button"
|
|
34
34
|
export * from "./calendar"
|
|
35
35
|
export * from "./canvas"
|
|
@@ -68,7 +68,7 @@ export * from "./request"
|
|
|
68
68
|
export * from "./router"
|
|
69
69
|
export * from "./settings"
|
|
70
70
|
export * from "./sidebarview"
|
|
71
|
-
export * from "./smartedit"
|
|
71
|
+
//export * from "./smartedit"
|
|
72
72
|
export * from "./spreadsheet"
|
|
73
73
|
export * from "./styles"
|
|
74
74
|
export * from "./svgcomponent"
|
|
@@ -76,9 +76,9 @@ export * from "./tabbar"
|
|
|
76
76
|
export * from "./tabview"
|
|
77
77
|
export * from "./textarea"
|
|
78
78
|
export * from "./textedit"
|
|
79
|
-
export * from "./texthiliter"
|
|
79
|
+
//export * from "./texthiliter"
|
|
80
80
|
export * from "./toaster"
|
|
81
81
|
export * from "./tools"
|
|
82
82
|
export * from "./tooltips"
|
|
83
83
|
export * from "./treeview"
|
|
84
|
-
export * from "./
|
|
84
|
+
export * from "./x4events"
|
package/src/input.ts
CHANGED
|
@@ -84,7 +84,7 @@ export class Input extends Component<InputProps,InputEventMap>
|
|
|
84
84
|
autofocus: props.autoFocus,
|
|
85
85
|
readonly: props.readOnly,
|
|
86
86
|
autocomplete: 'new-password', // chrome ignore 'off' but not something else than 'on'
|
|
87
|
-
|
|
87
|
+
tabIndex: props.tabIndex,
|
|
88
88
|
spellcheck: props.spellcheck===false ? 'false' : undefined,
|
|
89
89
|
min: props.min,
|
|
90
90
|
max: props.max,
|
package/src/layout.ts
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
import { Component, CProps, ComponentContent, Container, ContainerProps, ContainerEventMap } from './component'
|
|
31
|
-
import { } from './
|
|
31
|
+
import { } from './x4events'
|
|
32
32
|
import { isArray } from './tools';
|
|
33
33
|
|
|
34
34
|
// ============================================================================
|
package/src/link.ts
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
**/
|
|
29
29
|
|
|
30
30
|
import { Component, CProps, CEventMap, isHtmlString, HtmlString, html } from './component'
|
|
31
|
-
import { EvClick, EventCallback } from './
|
|
31
|
+
import { EvClick, EventCallback } from './x4events'
|
|
32
32
|
|
|
33
33
|
// ============================================================================
|
|
34
34
|
// [LINK]
|
package/src/listview.ts
CHANGED
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
29
|
|
|
30
|
+
import { x4document } from './x4dom'
|
|
31
|
+
|
|
30
32
|
import { Container, Component, ContainerProps, ContainerEventMap, EvDblClick } from './component'
|
|
31
33
|
import { IconID } from './icon';
|
|
32
34
|
import { HLayout, VLayout } from './layout'
|
|
@@ -34,7 +36,7 @@ import { Popup, PopupEventMap, PopupProps } from './popup';
|
|
|
34
36
|
import { HtmlString, isFunction } from './tools';
|
|
35
37
|
import { Menu, MenuItem } from "./menu";
|
|
36
38
|
|
|
37
|
-
import { EvContextMenu, EvSelectionChange, EvClick, EventCallback, BasicEvent, EvChange } from "./
|
|
39
|
+
import { EvContextMenu, EvSelectionChange, EvClick, EventCallback, BasicEvent, EvChange } from "./x4events";
|
|
38
40
|
|
|
39
41
|
/**
|
|
40
42
|
* item definition
|
|
@@ -728,18 +730,18 @@ export class PopupListView extends Popup<PopupListViewProps,PopupListViewEventMa
|
|
|
728
730
|
|
|
729
731
|
// todo: move into popup
|
|
730
732
|
show(modal?: boolean) {
|
|
731
|
-
|
|
733
|
+
x4document.addEventListener('mousedown', this._handleClick);
|
|
732
734
|
super.show(modal);
|
|
733
735
|
}
|
|
734
736
|
|
|
735
737
|
hide( ) {
|
|
736
|
-
|
|
738
|
+
x4document.removeEventListener('mousedown', this._handleClick);
|
|
737
739
|
super.hide( );
|
|
738
740
|
}
|
|
739
741
|
|
|
740
742
|
// todo: move into popup
|
|
741
743
|
close() {
|
|
742
|
-
|
|
744
|
+
x4document.removeEventListener('mousedown', this._handleClick);
|
|
743
745
|
super.close();
|
|
744
746
|
}
|
|
745
747
|
|
package/src/menu.ts
CHANGED
|
@@ -27,8 +27,10 @@
|
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
29
|
|
|
30
|
+
import { x4document } from './x4dom'
|
|
31
|
+
|
|
30
32
|
import { CEventMap, Component, CProps } from './component'
|
|
31
|
-
import { EvClick, EventCallback } from './
|
|
33
|
+
import { EvClick, EventCallback } from './x4events'
|
|
32
34
|
|
|
33
35
|
import { Popup, PopupProps } from './popup'
|
|
34
36
|
import { Icon, IconID } from './icon'
|
|
@@ -155,7 +157,7 @@ export class Menu extends Popup<MenuProps>
|
|
|
155
157
|
//console.log( 'addmenu' );
|
|
156
158
|
if (Menu.watchCount == 0) {
|
|
157
159
|
Menu.rootMenu = menu;
|
|
158
|
-
|
|
160
|
+
x4document.addEventListener('mousedown', Menu._mouseWatcher);
|
|
159
161
|
}
|
|
160
162
|
|
|
161
163
|
Menu.watchCount++;
|
|
@@ -167,7 +169,7 @@ export class Menu extends Popup<MenuProps>
|
|
|
167
169
|
Menu.watchCount--;
|
|
168
170
|
|
|
169
171
|
if (Menu.watchCount == 0) {
|
|
170
|
-
|
|
172
|
+
x4document.removeEventListener('mousedown', Menu._mouseWatcher);
|
|
171
173
|
}
|
|
172
174
|
}
|
|
173
175
|
|