x4js 1.4.4 → 1.4.7

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 (85) hide show
  1. package/lib/application.d.ts +96 -0
  2. package/lib/application.js +146 -0
  3. package/lib/base64.d.ts +31 -0
  4. package/lib/base64.js +139 -0
  5. package/lib/base_component.d.ts +64 -0
  6. package/lib/base_component.js +81 -0
  7. package/lib/button.d.ts +145 -0
  8. package/lib/button.js +241 -0
  9. package/lib/calendar.d.ts +77 -0
  10. package/lib/calendar.js +241 -0
  11. package/lib/canvas.d.ts +88 -0
  12. package/lib/canvas.js +358 -0
  13. package/lib/cardview.d.ts +83 -0
  14. package/lib/cardview.js +156 -0
  15. package/lib/checkbox.d.ts +72 -0
  16. package/lib/checkbox.js +130 -0
  17. package/lib/color.d.ts +144 -0
  18. package/lib/color.js +588 -0
  19. package/lib/colorpicker.js +86 -80
  20. package/lib/combobox.js +26 -22
  21. package/lib/component.d.ts +572 -0
  22. package/lib/component.js +1729 -0
  23. package/lib/datastore.js +29 -20
  24. package/lib/dialog.js +41 -36
  25. package/lib/dom_events.d.ts +284 -0
  26. package/lib/dom_events.js +14 -0
  27. package/lib/drag_manager.js +4 -1
  28. package/lib/drawtext.js +9 -5
  29. package/lib/fileupload.js +19 -12
  30. package/lib/form.js +29 -25
  31. package/lib/formatters.js +19 -10
  32. package/lib/gridview.js +40 -35
  33. package/lib/hosts/host.d.ts +44 -0
  34. package/lib/hosts/host.js +73 -0
  35. package/lib/i18n.d.ts +67 -0
  36. package/lib/i18n.js +175 -0
  37. package/lib/icon.d.ts +56 -0
  38. package/lib/icon.js +178 -0
  39. package/lib/image.js +7 -3
  40. package/lib/index.js +71 -55
  41. package/lib/input.d.ts +86 -0
  42. package/lib/input.js +176 -0
  43. package/lib/label.d.ts +54 -0
  44. package/lib/label.js +90 -0
  45. package/lib/layout.d.ts +77 -0
  46. package/lib/layout.js +271 -0
  47. package/lib/link.js +9 -5
  48. package/lib/listview.js +34 -27
  49. package/lib/md5.js +5 -1
  50. package/lib/menu.d.ts +122 -0
  51. package/lib/menu.js +284 -0
  52. package/lib/messagebox.js +22 -17
  53. package/lib/panel.js +13 -9
  54. package/lib/popup.d.ts +71 -0
  55. package/lib/popup.js +378 -0
  56. package/lib/property_editor.js +20 -16
  57. package/lib/radiobtn.js +13 -9
  58. package/lib/rating.js +13 -9
  59. package/lib/request.js +16 -9
  60. package/lib/router.js +5 -1
  61. package/lib/settings.d.ts +33 -0
  62. package/lib/settings.js +67 -0
  63. package/lib/sidebarview.js +12 -8
  64. package/lib/smartedit.js +16 -11
  65. package/lib/spreadsheet.js +35 -31
  66. package/lib/styles.d.ts +81 -0
  67. package/lib/styles.js +268 -0
  68. package/lib/svgcomponent.js +8 -3
  69. package/lib/tabbar.js +10 -6
  70. package/lib/tabview.js +10 -6
  71. package/lib/textarea.js +10 -6
  72. package/lib/textedit.js +39 -35
  73. package/lib/texthiliter.js +8 -4
  74. package/lib/toaster.js +8 -4
  75. package/lib/tools.d.ts +382 -0
  76. package/lib/tools.js +1142 -0
  77. package/lib/tooltips.js +14 -9
  78. package/lib/treeview.js +30 -26
  79. package/lib/x4_events.d.ts +253 -0
  80. package/lib/x4_events.js +375 -0
  81. package/package.json +1 -1
  82. package/src/application.ts +9 -4
  83. package/src/x4.less +143 -107
  84. package/tsconfig.json +1 -1
  85. package/x4.css +1541 -0
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * ___ ___ __
3
4
  * \ \/ / / _
@@ -22,16 +23,18 @@
22
23
  *
23
24
  * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
24
25
  **/
25
- import { Container, Component } from './component';
26
- import { CheckBox } from './checkbox';
27
- import { Dialog } from './dialog';
28
- import { EvChange } from './x4_events';
29
- import { VLayout, HLayout } from './layout';
30
- import { Label } from './label';
31
- import { Color } from './color';
32
- import { isString, getMousePos, clamp, classNames } from './tools';
33
- import { TextEdit } from './textedit';
34
- import { Menu, MenuItem } from './menu';
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.ColorPickerEditor = exports.ColorPickerBox = exports.ColorPicker = void 0;
28
+ const component_1 = require("./component");
29
+ const checkbox_1 = require("./checkbox");
30
+ const dialog_1 = require("./dialog");
31
+ const x4_events_1 = require("./x4_events");
32
+ const layout_1 = require("./layout");
33
+ const label_1 = require("./label");
34
+ const color_1 = require("./color");
35
+ const tools_1 = require("./tools");
36
+ const textedit_1 = require("./textedit");
37
+ const menu_1 = require("./menu");
35
38
  const pal_colors = {
36
39
  blue: [0x0e5a8a, 0x106ba3, 0x137cbd, 0x2b95d6, 0x48aff0,],
37
40
  green: [0x0a6640, 0x0d8050, 0x0f9960, 0x15b371, 0x3dcc91,],
@@ -49,7 +52,7 @@ const pal_colors = {
49
52
  sepia: [0x63411e, 0x7d5125, 0x96622d, 0xb07b46, 0xc99765,],
50
53
  bw: [0x000000, 0x444444, 0x666666, 0xcccccc, 0xffffff,],
51
54
  };
52
- export class ColorPicker extends Container {
55
+ class ColorPicker extends component_1.Container {
53
56
  m_colorSel;
54
57
  m_colorHue;
55
58
  m_colorAlpha;
@@ -69,9 +72,9 @@ export class ColorPicker extends Container {
69
72
  this.setDomEvent('contextmenu', (e) => this._showCtx(e));
70
73
  }
71
74
  _showCtx(e) {
72
- const menu = new Menu({
75
+ const menu = new menu_1.Menu({
73
76
  items: [
74
- new MenuItem({
77
+ new menu_1.MenuItem({
75
78
  text: 'Palette', checked: this.m_palmode, click: () => {
76
79
  this.m_palmode = !this.m_palmode;
77
80
  ColorPicker.last_palmode = this.m_palmode;
@@ -80,12 +83,12 @@ export class ColorPicker extends Container {
80
83
  })
81
84
  ]
82
85
  });
83
- let pt = getMousePos(e, true);
86
+ let pt = (0, tools_1.getMousePos)(e, true);
84
87
  menu.displayAt(pt.x, pt.y);
85
88
  }
86
89
  render(props) {
87
90
  this.m_baseColor = props.color;
88
- this.m_baseHSV = Color.toHSV(this.m_baseColor);
91
+ this.m_baseHSV = color_1.Color.toHSV(this.m_baseColor);
89
92
  if (this.m_palmode) {
90
93
  this.addClass("pal-mode");
91
94
  let selector = null;
@@ -98,16 +101,16 @@ export class ColorPicker extends Container {
98
101
  let selected = color === ccolor;
99
102
  if (!selected) {
100
103
  selected = mc.variations.some(c => {
101
- const cc = new Color(c.hex).value();
104
+ const cc = new color_1.Color(c.hex).value();
102
105
  if (cc === ccolor) {
103
106
  return true;
104
107
  }
105
108
  });
106
109
  }
107
- let cls = classNames('clr-box xbox', { selected });
108
- let el = new Component({
110
+ let cls = (0, tools_1.classNames)('clr-box xbox', { selected });
111
+ let el = new component_1.Component({
109
112
  cls,
110
- style: { backgroundColor: new Color(color).toHex() },
113
+ style: { backgroundColor: new color_1.Color(color).toHex() },
111
114
  data: { color, main: mc.variations }
112
115
  });
113
116
  if (selected) {
@@ -118,12 +121,12 @@ export class ColorPicker extends Container {
118
121
  function fillSubs(colors) {
119
122
  sub_sel = [];
120
123
  colors.forEach(mc => {
121
- let clr = new Color(mc.hex);
124
+ let clr = new color_1.Color(mc.hex);
122
125
  const selected = clr.value() == ccolor;
123
- let cls = classNames('hclr-box xbox', { selected });
124
- let el = new Component({
126
+ let cls = (0, tools_1.classNames)('hclr-box xbox', { selected });
127
+ let el = new component_1.Component({
125
128
  cls,
126
- style: { backgroundColor: clr.toHex(), color: Color.contrastColor(clr).toHex() },
129
+ style: { backgroundColor: clr.toHex(), color: color_1.Color.contrastColor(clr).toHex() },
127
130
  data: { color: clr.value() },
128
131
  content: clr.toHex()
129
132
  });
@@ -136,13 +139,13 @@ export class ColorPicker extends Container {
136
139
  selector.itemWithId('vsel').setContent(sub_sel);
137
140
  }
138
141
  }
139
- selector = new VLayout({
142
+ selector = new layout_1.VLayout({
140
143
  content: [
141
- new HLayout({
144
+ new layout_1.HLayout({
142
145
  id: 'hsel',
143
146
  content: main_sel
144
147
  }),
145
- new VLayout({
148
+ new layout_1.VLayout({
146
149
  id: 'vsel',
147
150
  flex: 1,
148
151
  content: sub_sel
@@ -193,22 +196,22 @@ export class ColorPicker extends Container {
193
196
  ]
194
197
  });
195
198
  */
196
- this.m_colorEdit = new TextEdit({
199
+ this.m_colorEdit = new textedit_1.TextEdit({
197
200
  cls: 'hexv',
198
201
  value: '',
199
202
  attrs: {
200
203
  spellcheck: false,
201
204
  },
202
205
  change: (ev) => {
203
- const clr = new Color(ev.value);
206
+ const clr = new color_1.Color(ev.value);
204
207
  if (clr) {
205
208
  this.m_baseColor = clr;
206
- this.m_baseHSV = Color.toHSV(clr);
209
+ this.m_baseHSV = color_1.Color.toHSV(clr);
207
210
  this._updateColor(false);
208
211
  }
209
212
  }
210
213
  });
211
- this.m_transpCk = new CheckBox({
214
+ this.m_transpCk = new checkbox_1.CheckBox({
212
215
  cls: 'transp',
213
216
  text: 'transparent',
214
217
  change: (ev) => {
@@ -223,16 +226,16 @@ export class ColorPicker extends Container {
223
226
  cur.removeClass('selected');
224
227
  cur = null;
225
228
  }
226
- let cell = Component.getElement(ev.target, 'xbox');
229
+ let cell = component_1.Component.getElement(ev.target, 'xbox');
227
230
  if (cell) {
228
231
  const subs = cell.getData('main');
229
232
  if (subs) {
230
233
  fillSubs(subs);
231
234
  }
232
235
  else {
233
- const clr = new Color(cell.getData('color'));
236
+ const clr = new color_1.Color(cell.getData('color'));
234
237
  this.m_baseColor = clr;
235
- this.m_baseHSV = Color.toHSV(clr);
238
+ this.m_baseHSV = color_1.Color.toHSV(clr);
236
239
  this._updateColor();
237
240
  cur = cell;
238
241
  cell.addClass('selected');
@@ -242,37 +245,37 @@ export class ColorPicker extends Container {
242
245
  }
243
246
  else {
244
247
  this.removeClass("pal-mode");
245
- this.m_selMark = new Component({ cls: 'marker' });
246
- this.m_colorSel = new Component({
248
+ this.m_selMark = new component_1.Component({ cls: 'marker' });
249
+ this.m_colorSel = new component_1.Component({
247
250
  cls: 'sel',
248
251
  content: [
249
- new Component({ cls: '@fit light' }),
250
- new Component({ cls: '@fit dark' }),
252
+ new component_1.Component({ cls: '@fit light' }),
253
+ new component_1.Component({ cls: '@fit dark' }),
251
254
  this.m_selMark,
252
255
  ]
253
256
  });
254
- this.m_hueMark = new Component({ cls: 'marker' });
255
- this.m_colorHue = new Component({
257
+ this.m_hueMark = new component_1.Component({ cls: 'marker' });
258
+ this.m_colorHue = new component_1.Component({
256
259
  cls: 'hue',
257
260
  content: [
258
261
  this.m_hueMark
259
262
  ]
260
263
  });
261
- this.m_sample = new Component({ cls: 'sample' });
264
+ this.m_sample = new component_1.Component({ cls: 'sample' });
262
265
  if (props.hasAlpha) {
263
266
  this.addClass('with-alpha');
264
- this.m_alphaMark = new Component({ cls: 'marker' });
265
- this.m_colorAlpha = new Component({
267
+ this.m_alphaMark = new component_1.Component({ cls: 'marker' });
268
+ this.m_colorAlpha = new component_1.Component({
266
269
  cls: 'alpha',
267
270
  content: [
268
- new Component({ cls: 'bk @fit', ref: 'color' }),
271
+ new component_1.Component({ cls: 'bk @fit', ref: 'color' }),
269
272
  this.m_alphaMark
270
273
  ]
271
274
  });
272
275
  }
273
276
  else {
274
277
  this.removeClass('with-alpha');
275
- this.m_transpCk = new CheckBox({
278
+ this.m_transpCk = new checkbox_1.CheckBox({
276
279
  cls: 'transp',
277
280
  text: 'transparent',
278
281
  change: (ev) => {
@@ -281,17 +284,17 @@ export class ColorPicker extends Container {
281
284
  }
282
285
  });
283
286
  }
284
- this.m_colorEdit = new TextEdit({
287
+ this.m_colorEdit = new textedit_1.TextEdit({
285
288
  cls: 'hexv',
286
289
  value: '',
287
290
  attrs: {
288
291
  spellcheck: false,
289
292
  },
290
293
  change: (ev) => {
291
- const clr = new Color(ev.value);
294
+ const clr = new color_1.Color(ev.value);
292
295
  if (clr) {
293
296
  this.m_baseColor = clr;
294
- this.m_baseHSV = Color.toHSV(clr);
297
+ this.m_baseHSV = color_1.Color.toHSV(clr);
295
298
  this._updateColor(false);
296
299
  }
297
300
  }
@@ -305,14 +308,14 @@ export class ColorPicker extends Container {
305
308
  this.m_sample,
306
309
  ]);
307
310
  this.m_colorSel.setDomEvent('mousedown', (ev) => {
308
- Component.setCapture(this, (e) => this._selChange(e));
311
+ component_1.Component.setCapture(this, (e) => this._selChange(e));
309
312
  });
310
313
  this.m_colorHue.setDomEvent('mousedown', (ev) => {
311
- Component.setCapture(this, (e) => this._hueChange(e));
314
+ component_1.Component.setCapture(this, (e) => this._hueChange(e));
312
315
  });
313
316
  if (props.hasAlpha) {
314
317
  this.m_colorAlpha.setDomEvent('mousedown', (ev) => {
315
- Component.setCapture(this, (e) => this._alphaChange(e));
318
+ component_1.Component.setCapture(this, (e) => this._alphaChange(e));
316
319
  });
317
320
  }
318
321
  this._updateColor();
@@ -320,50 +323,50 @@ export class ColorPicker extends Container {
320
323
  }
321
324
  set color(clr) {
322
325
  this.m_baseColor = clr;
323
- this.m_baseHSV = Color.toHSV(this.m_baseColor);
326
+ this.m_baseHSV = color_1.Color.toHSV(this.m_baseColor);
324
327
  this._updateColor();
325
328
  }
326
329
  get color() {
327
330
  return this.m_baseColor;
328
331
  }
329
332
  _selChange(ev) {
330
- let pt = getMousePos(ev, true);
333
+ let pt = (0, tools_1.getMousePos)(ev, true);
331
334
  console.log(pt);
332
335
  let rc = this.m_colorSel.getBoundingRect();
333
336
  if (!this.m_props.hasAlpha) {
334
337
  this.m_baseHSV.a = 1;
335
338
  }
336
- this.m_baseHSV.s = clamp((pt.x - rc.left) / rc.width, 0, 1);
337
- this.m_baseHSV.v = 1 - clamp((pt.y - rc.top) / rc.height, 0, 1);
339
+ this.m_baseHSV.s = (0, tools_1.clamp)((pt.x - rc.left) / rc.width, 0, 1);
340
+ this.m_baseHSV.v = 1 - (0, tools_1.clamp)((pt.y - rc.top) / rc.height, 0, 1);
338
341
  this._updateColor();
339
342
  if (ev.type == 'mouseup' || ev.type == 'touchend') {
340
- Component.releaseCapture();
343
+ component_1.Component.releaseCapture();
341
344
  }
342
345
  }
343
346
  _hueChange(ev) {
344
- let pt = getMousePos(ev, true);
347
+ let pt = (0, tools_1.getMousePos)(ev, true);
345
348
  let rc = this.m_colorHue.getBoundingRect();
346
- this.m_baseHSV.h = clamp((pt.y - rc.top) / rc.height, 0, 1);
349
+ this.m_baseHSV.h = (0, tools_1.clamp)((pt.y - rc.top) / rc.height, 0, 1);
347
350
  this._updateColor();
348
351
  if (ev.type == 'mouseup' || ev.type == 'touchend') {
349
- Component.releaseCapture();
352
+ component_1.Component.releaseCapture();
350
353
  }
351
354
  }
352
355
  _alphaChange(ev) {
353
- let pt = getMousePos(ev, true);
356
+ let pt = (0, tools_1.getMousePos)(ev, true);
354
357
  let rc = this.m_colorAlpha.getBoundingRect();
355
- this.m_baseHSV.a = clamp((pt.x - rc.left) / rc.width, 0, 1);
358
+ this.m_baseHSV.a = (0, tools_1.clamp)((pt.x - rc.left) / rc.width, 0, 1);
356
359
  this._updateColor();
357
360
  if (ev.type == 'mouseup' || ev.type == 'touchend') {
358
- Component.releaseCapture();
361
+ component_1.Component.releaseCapture();
359
362
  }
360
363
  }
361
364
  _updateColor(edit = true) {
362
365
  let color;
363
366
  if (!this.m_palmode) {
364
- color = Color.fromHSV(this.m_baseHSV.h, 1, 1, 1);
367
+ color = color_1.Color.fromHSV(this.m_baseHSV.h, 1, 1, 1);
365
368
  this.m_colorSel.setStyleValue('backgroundColor', color.toString());
366
- color = Color.fromHSV(this.m_baseHSV.h, this.m_baseHSV.s, this.m_baseHSV.v, 1);
369
+ color = color_1.Color.fromHSV(this.m_baseHSV.h, this.m_baseHSV.s, this.m_baseHSV.v, 1);
367
370
  this.m_sample.setStyleValue('backgroundColor', color.toString());
368
371
  if (this.m_props.hasAlpha) {
369
372
  let gradient = `linear-gradient(to right, rgba(0,0,0,0) 0%, ${color.toString()} 100%)`;
@@ -388,7 +391,7 @@ export class ColorPicker extends Container {
388
391
  else {
389
392
  this.m_transpCk.check = this.m_baseHSV.a == 0;
390
393
  }
391
- color = Color.fromHSV(this.m_baseHSV.h, this.m_baseHSV.s, this.m_baseHSV.v, this.m_baseHSV.a);
394
+ color = color_1.Color.fromHSV(this.m_baseHSV.h, this.m_baseHSV.s, this.m_baseHSV.v, this.m_baseHSV.a);
392
395
  this.m_baseColor = color;
393
396
  if (edit) {
394
397
  this.m_colorEdit.value = color.alpha() == 1 ? color.toHex() : color.toString(); //color.toHex();
@@ -396,10 +399,11 @@ export class ColorPicker extends Container {
396
399
  this._change();
397
400
  }
398
401
  _change() {
399
- this.emit('change', EvChange(this.m_baseColor));
402
+ this.emit('change', (0, x4_events_1.EvChange)(this.m_baseColor));
400
403
  }
401
404
  }
402
- export class ColorPickerBox extends Dialog {
405
+ exports.ColorPicker = ColorPicker;
406
+ class ColorPickerBox extends dialog_1.Dialog {
403
407
  m_picker;
404
408
  constructor(props) {
405
409
  props.icon = undefined;
@@ -415,7 +419,7 @@ export class ColorPickerBox extends Dialog {
415
419
  });
416
420
  let customs = this._makeCustoms(props.cust_colors);
417
421
  this.form.updateContent([
418
- new VLayout({
422
+ new layout_1.VLayout({
419
423
  content: [
420
424
  this.m_picker,
421
425
  customs
@@ -424,7 +428,7 @@ export class ColorPickerBox extends Dialog {
424
428
  ], ['ok', 'cancel']);
425
429
  this.on('btnClick', (ev) => {
426
430
  if (ev.button == 'ok') {
427
- this.emit('change', EvChange(this.m_picker.color));
431
+ this.emit('change', (0, x4_events_1.EvChange)(this.m_picker.color));
428
432
  }
429
433
  });
430
434
  }
@@ -436,7 +440,7 @@ export class ColorPickerBox extends Dialog {
436
440
  let lne = [];
437
441
  for (let j = 0; j < 8; j++) {
438
442
  let idx = i + j, clr = cc[idx];
439
- lne.push(new Label({
443
+ lne.push(new label_1.Label({
440
444
  cls: 'cust-cc',
441
445
  text: '',
442
446
  flex: 1,
@@ -448,16 +452,16 @@ export class ColorPickerBox extends Dialog {
448
452
  click: () => {
449
453
  if (clr) {
450
454
  this.m_picker.color = clr;
451
- this.emit('change', EvChange(clr));
455
+ this.emit('change', (0, x4_events_1.EvChange)(clr));
452
456
  this.close();
453
457
  }
454
458
  }
455
459
  }
456
460
  }));
457
461
  }
458
- els.push(new HLayout({ cls: 'line', content: lne }));
462
+ els.push(new layout_1.HLayout({ cls: 'line', content: lne }));
459
463
  }
460
- custom = new VLayout({ cls: 'customs', content: els });
464
+ custom = new layout_1.VLayout({ cls: 'customs', content: els });
461
465
  }
462
466
  return custom;
463
467
  }
@@ -472,8 +476,8 @@ export class ColorPickerBox extends Dialog {
472
476
  */
473
477
  static show(props) {
474
478
  let msg;
475
- if (isString(props)) {
476
- msg = new ColorPickerBox({ color: new Color(props) });
479
+ if ((0, tools_1.isString)(props)) {
480
+ msg = new ColorPickerBox({ color: new color_1.Color(props) });
477
481
  }
478
482
  else {
479
483
  msg = new ColorPickerBox(props);
@@ -482,7 +486,8 @@ export class ColorPickerBox extends Dialog {
482
486
  return msg;
483
487
  }
484
488
  }
485
- export class ColorPickerEditor extends HLayout {
489
+ exports.ColorPickerBox = ColorPickerBox;
490
+ class ColorPickerEditor extends layout_1.HLayout {
486
491
  constructor(props) {
487
492
  super(props);
488
493
  this.mapPropEvents(props, 'change');
@@ -491,20 +496,20 @@ export class ColorPickerEditor extends HLayout {
491
496
  let color = props.color;
492
497
  let tcolor;
493
498
  if (this._isTransp(color)) {
494
- color = Color.NONE;
499
+ color = color_1.Color.NONE;
495
500
  tcolor = 'black';
496
501
  }
497
502
  else {
498
- tcolor = Color.contrastColor(color).toString();
503
+ tcolor = color_1.Color.contrastColor(color).toString();
499
504
  }
500
505
  this.setContent([
501
- props.label ? new Label({
506
+ props.label ? new label_1.Label({
502
507
  cls: 'label',
503
508
  text: props.label,
504
509
  flex: props.labelWidth < 0 ? -props.labelWidth : undefined,
505
510
  width: props.labelWidth >= 0 ? props.labelWidth : undefined,
506
511
  }) : null,
507
- new Label({
512
+ new label_1.Label({
508
513
  cls: 'value',
509
514
  flex: 1,
510
515
  text: color.toHex(),
@@ -546,12 +551,13 @@ export class ColorPickerEditor extends HLayout {
546
551
  dlg.displayAt(rc.left, rc.bottom, 'tl');
547
552
  }
548
553
  _change() {
549
- this.emit('change', EvChange(this.m_props.color));
554
+ this.emit('change', (0, x4_events_1.EvChange)(this.m_props.color));
550
555
  }
551
556
  _isTransp(color) {
552
557
  return !color.alpha();
553
558
  }
554
559
  }
560
+ exports.ColorPickerEditor = ColorPickerEditor;
555
561
  // :: Material colors scheme ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
556
562
  const materialColors = [
557
563
  {
package/lib/combobox.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * ___ ___ __
3
4
  * \ \/ / / _
@@ -22,22 +23,24 @@
22
23
  *
23
24
  * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
24
25
  **/
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.ComboBox = void 0;
25
28
  /**
26
29
  * TODO: replace custom combo list by listview or gridview
27
30
  */
28
- import { Component } from './component';
29
- import { EvChange, EvSelectionChange } from './x4_events';
30
- import { Input } from './input';
31
- import { Label } from './label';
32
- import { Button } from './button';
33
- import { HLayout } from './layout';
34
- import { PopupListView } from './listview';
35
- import { DataStore } from './datastore';
36
- import { isFunction } from './tools';
31
+ const component_1 = require("./component");
32
+ const x4_events_1 = require("./x4_events");
33
+ const input_1 = require("./input");
34
+ const label_1 = require("./label");
35
+ const button_1 = require("./button");
36
+ const layout_1 = require("./layout");
37
+ const listview_1 = require("./listview");
38
+ const datastore_1 = require("./datastore");
39
+ const tools_1 = require("./tools");
37
40
  /**
38
41
  * @review use textedit
39
42
  */
40
- export class ComboBox extends HLayout {
43
+ class ComboBox extends layout_1.HLayout {
41
44
  m_ui_input;
42
45
  m_ui_button;
43
46
  m_popup;
@@ -58,7 +61,7 @@ export class ComboBox extends HLayout {
58
61
  /** @ignore */
59
62
  render(props) {
60
63
  if (!props.renderer) {
61
- this.m_ui_input = new Input({
64
+ this.m_ui_input = new input_1.Input({
62
65
  flex: 1,
63
66
  readOnly: true,
64
67
  tabIndex: 0,
@@ -70,7 +73,7 @@ export class ComboBox extends HLayout {
70
73
  });
71
74
  }
72
75
  else {
73
- this.m_ui_input = new Component({
76
+ this.m_ui_input = new component_1.Component({
74
77
  flex: 1,
75
78
  cls: '@fake-input @hlayout',
76
79
  tabIndex: 1
@@ -86,18 +89,18 @@ export class ComboBox extends HLayout {
86
89
  }
87
90
  this.setContent([
88
91
  // todo: why 'label1' class name
89
- new Label({
92
+ new label_1.Label({
90
93
  cls: 'label1' + (props.label ? '' : ' @hidden'),
91
94
  text: props.label,
92
95
  width,
93
96
  flex,
94
97
  align: props.labelAlign
95
98
  }),
96
- new HLayout({
99
+ new layout_1.HLayout({
97
100
  flex: 1,
98
101
  content: [
99
102
  this.m_ui_input,
100
- this.m_ui_button = new Button({
103
+ this.m_ui_button = new button_1.Button({
101
104
  cls: 'gadget',
102
105
  icon: 'cls(far fa-angle-down)',
103
106
  tabIndex: false,
@@ -133,7 +136,7 @@ export class ComboBox extends HLayout {
133
136
  let fontFamily = cstyle.value('fontFamily');
134
137
  let fontSize = cstyle.value('fontSize');
135
138
  // prepare the combo listview
136
- this.m_popup = new PopupListView({
139
+ this.m_popup = new listview_1.PopupListView({
137
140
  cls: '@combo-popup',
138
141
  items: props.items,
139
142
  populate: props.populate,
@@ -167,8 +170,8 @@ export class ComboBox extends HLayout {
167
170
  id: item.id,
168
171
  text: item.text
169
172
  };
170
- this.emit('selectionChange', EvSelectionChange(item));
171
- this.emit('change', EvChange(item.id));
173
+ this.emit('selectionChange', (0, x4_events_1.EvSelectionChange)(item));
174
+ this.emit('change', (0, x4_events_1.EvChange)(item.id));
172
175
  this.m_ui_input.focus();
173
176
  this.m_popup.hide();
174
177
  }
@@ -178,7 +181,7 @@ export class ComboBox extends HLayout {
178
181
  _setInput(item, fireEv = false) {
179
182
  if (item) {
180
183
  if (this.m_ui_input) {
181
- if (this.m_ui_input instanceof Input) {
184
+ if (this.m_ui_input instanceof input_1.Input) {
182
185
  this.m_ui_input.value = item.text;
183
186
  // fires a change event
184
187
  if (fireEv) {
@@ -208,7 +211,7 @@ export class ComboBox extends HLayout {
208
211
  */
209
212
  set value(id) {
210
213
  let items = this.m_props.items;
211
- if (isFunction(items)) {
214
+ if ((0, tools_1.isFunction)(items)) {
212
215
  items = items();
213
216
  }
214
217
  items.some((v) => {
@@ -220,10 +223,10 @@ export class ComboBox extends HLayout {
220
223
  });
221
224
  }
222
225
  get input() {
223
- return this.m_ui_input instanceof Input ? this.m_ui_input : null;
226
+ return this.m_ui_input instanceof input_1.Input ? this.m_ui_input : null;
224
227
  }
225
228
  static storeProxy(props) {
226
- let view = props.store instanceof DataStore ? props.store.createView() : props.store;
229
+ let view = props.store instanceof datastore_1.DataStore ? props.store.createView() : props.store;
227
230
  return () => {
228
231
  let result = new Array(props.store.count);
229
232
  props.store.forEach((rec, index) => {
@@ -236,6 +239,7 @@ export class ComboBox extends HLayout {
236
239
  };
237
240
  }
238
241
  }
242
+ exports.ComboBox = ComboBox;
239
243
  /*
240
244
  export type CBComboBoxRenderer = ( rec: Record ) => string;
241
245
  export interface ComboBoxStore {