x4js 2.3.19 → 2.3.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/aicontext.md +48 -28
- package/package.json +1 -1
- package/src/components/autocomplete/autocomplete.ts +3 -0
- package/src/components/boxes/boxes.ts +1 -1
- package/src/components/chart/chart.ts +12 -3
- package/src/components/colorinput/colorinput.module.scss +11 -2
- package/src/components/colorinput/colorinput.ts +37 -4
- package/src/components/colorpicker/colorpicker.module.scss +14 -2
- package/src/components/colorpicker/colorpicker.ts +57 -11
- package/src/components/dialog/dialog.ts +16 -5
- package/src/components/form/form.ts +3 -4
- package/src/components/gridview/gridview.module.scss +18 -16
- package/src/components/gridview/gridview.ts +5 -0
- package/src/components/icon/icon.ts +34 -18
- package/src/components/keyboard/keyboard.ts +7 -3
- package/src/components/link/link.ts +18 -7
- package/src/components/messages/messages.ts +1 -1
- package/src/components/panel/panel.ts +3 -2
- package/src/components/spreadsheet/spreadsheet.module.scss +18 -16
- package/src/components/textarea/textarea.module.scss +10 -3
- package/src/components/video/video.ts +17 -3
- package/src/core/core_colors.ts +21 -10
- package/src/core/core_dragdrop.ts +5 -4
- package/src/core/core_i18n.ts +34 -54
- package/src/core/core_pdf.ts +524 -8
- package/src/core/core_shortcuts.ts +5 -1
- package/src/core/core_styles.ts +46 -25
- package/src/core/core_svg.ts +24 -16
- package/src/core/core_tools.ts +18 -9
package/src/core/core_i18n.ts
CHANGED
|
@@ -85,7 +85,12 @@ export function addTranslation( name: string, ...parts: any[] ) {
|
|
|
85
85
|
_patch( lang.src_translations, p );
|
|
86
86
|
} );
|
|
87
87
|
|
|
88
|
-
lang.translations = _proxyfy( lang.src_translations, lang.base,
|
|
88
|
+
lang.translations = _proxyfy( lang.src_translations, lang.base, [] );
|
|
89
|
+
|
|
90
|
+
// the current language: _tr sees the new translations at once
|
|
91
|
+
if( name==current.name ) {
|
|
92
|
+
current.translations = lang.translations;
|
|
93
|
+
}
|
|
89
94
|
}
|
|
90
95
|
|
|
91
96
|
/**
|
|
@@ -117,96 +122,71 @@ function _patch( obj: any, by: any ) {
|
|
|
117
122
|
/**
|
|
118
123
|
* create a proxy for all sub objects
|
|
119
124
|
* (deep traverse)
|
|
125
|
+
* @param path where obj is, from _tr: [] for _tr itself, ["global"] for _tr.global
|
|
120
126
|
*/
|
|
121
127
|
|
|
122
|
-
function _proxyfy( obj: any, base:
|
|
128
|
+
function _proxyfy( obj: any, base: string, path: string[] ) {
|
|
123
129
|
|
|
124
130
|
const result: any = {}
|
|
125
131
|
|
|
126
132
|
for( const n in obj ) {
|
|
127
133
|
if( typeof obj[n]!=="string" && !Array.isArray(obj[n])) {
|
|
128
|
-
result[n] = _proxyfy( obj[n], base,
|
|
134
|
+
result[n] = _proxyfy( obj[n], base, [...path, n] );
|
|
129
135
|
}
|
|
130
136
|
else {
|
|
131
137
|
result[n] = obj[n];
|
|
132
138
|
}
|
|
133
139
|
}
|
|
134
140
|
|
|
135
|
-
return _mk_proxy( result, base,
|
|
141
|
+
return _mk_proxy( result, base, path );
|
|
136
142
|
}
|
|
137
143
|
|
|
138
144
|
|
|
139
145
|
/**
|
|
140
146
|
* create a proxy for the given object
|
|
147
|
+
* what is not found is asked to the base language, at the same path
|
|
141
148
|
*/
|
|
142
149
|
|
|
143
|
-
function _mk_proxy( obj: any, base: string,
|
|
150
|
+
function _mk_proxy( obj: any, base: string, path: string[] ) : any {
|
|
144
151
|
return new Proxy( obj, {
|
|
145
152
|
get: (target, prop) => {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
153
|
+
const value = target[prop];
|
|
154
|
+
|
|
155
|
+
// a symbol is not a translation
|
|
156
|
+
if( value!==undefined || typeof prop==="symbol" ) {
|
|
157
|
+
return value;
|
|
151
158
|
}
|
|
152
159
|
|
|
153
|
-
|
|
154
|
-
if( value===undefined ) {
|
|
155
|
-
if( base ) {
|
|
156
|
-
value = _findBaseTrans( base );
|
|
157
|
-
}
|
|
160
|
+
const asked = [...path, prop];
|
|
158
161
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
+
// not in this language: in its base, which looks in its own base
|
|
163
|
+
if( base ) {
|
|
164
|
+
return _findBaseTrans( base, asked );
|
|
162
165
|
}
|
|
163
166
|
|
|
164
|
-
|
|
167
|
+
console.error( "I18N error: unable to find", '_tr.'+asked.join('.') );
|
|
168
|
+
return undefined;
|
|
165
169
|
}
|
|
166
170
|
});
|
|
167
171
|
}
|
|
168
172
|
|
|
169
|
-
|
|
170
173
|
/**
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* then when we try to get _tr.xxx.yyy
|
|
175
|
-
* reqpath is [xxx,yyy]
|
|
176
|
-
* if yyy is not found, we try with base langage for the full reqpath
|
|
177
|
-
* until no base found
|
|
174
|
+
* the translation at path in the language base
|
|
175
|
+
* its proxies look in their own base: the last language of the chain tells what is missing
|
|
178
176
|
*/
|
|
179
177
|
|
|
180
|
-
|
|
178
|
+
function _findBaseTrans( base: string, path: string[] ) {
|
|
181
179
|
|
|
182
|
-
|
|
183
|
-
*
|
|
184
|
-
*/
|
|
185
|
-
|
|
186
|
-
function _findBaseTrans( base: any ) {
|
|
187
|
-
|
|
188
|
-
while( base ) {
|
|
189
|
-
const lang = languages[base];
|
|
190
|
-
let trans = lang.translations;
|
|
191
|
-
let value;
|
|
192
|
-
|
|
193
|
-
for( const p of req_path ) {
|
|
194
|
-
value = trans[p];
|
|
195
|
-
if( value===undefined ) {
|
|
196
|
-
break;
|
|
197
|
-
}
|
|
180
|
+
let trans = languages[base].translations;
|
|
198
181
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
return trans;
|
|
182
|
+
for( const p of path ) {
|
|
183
|
+
trans = trans[p];
|
|
184
|
+
if( trans===undefined ) {
|
|
185
|
+
return undefined;
|
|
204
186
|
}
|
|
205
|
-
|
|
206
|
-
base = lang.base;
|
|
207
187
|
}
|
|
208
188
|
|
|
209
|
-
return
|
|
189
|
+
return trans;
|
|
210
190
|
}
|
|
211
191
|
|
|
212
192
|
/**
|
|
@@ -320,7 +300,7 @@ let fr = {
|
|
|
320
300
|
|
|
321
301
|
diff_date_seconds: '{0} secondes',
|
|
322
302
|
diff_date_minutes: '{0} minutes',
|
|
323
|
-
diff_date_hours: '{0} heures',
|
|
303
|
+
diff_date_hours: '{0} heures {1} minutes',
|
|
324
304
|
|
|
325
305
|
invalid_date: 'Date non reconnue ({0})',
|
|
326
306
|
empty_list: 'Liste vide',
|
|
@@ -385,7 +365,7 @@ let en = {
|
|
|
385
365
|
|
|
386
366
|
diff_date_seconds: '{0} seconds',
|
|
387
367
|
diff_date_minutes: '{0} minutes',
|
|
388
|
-
diff_date_hours: '{0} hours',
|
|
368
|
+
diff_date_hours: '{0} hours {1} minutes',
|
|
389
369
|
|
|
390
370
|
invalid_date: 'Unrecognized date({0})',
|
|
391
371
|
empty_list: 'Empty list',
|