x4js 1.4.9 → 1.4.10

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/calendar.js CHANGED
@@ -126,17 +126,20 @@ class Calendar extends layout_1.VLayout {
126
126
  if (dte.getMonth() != cmonth) {
127
127
  cls += ' out';
128
128
  }
129
- days.push(new layout_1.HLayout({
130
- cls,
131
- flex: 1,
132
- content: new component_1.Component({
133
- tag: 'span',
134
- content: (0, tools_1.formatIntlDate)(dte, 'd'),
135
- }),
136
- dom_events: {
137
- click: () => this.select(dte.clone())
138
- }
139
- }));
129
+ const mkItem = (dte) => {
130
+ return new layout_1.HLayout({
131
+ cls,
132
+ flex: 1,
133
+ content: new component_1.Component({
134
+ tag: 'span',
135
+ content: (0, tools_1.formatIntlDate)(dte, 'd'),
136
+ }),
137
+ dom_events: {
138
+ click: () => this.select(dte)
139
+ }
140
+ });
141
+ };
142
+ days.push(mkItem(dte.clone()));
140
143
  dte.setDate(dte.getDate() + 1);
141
144
  first = false;
142
145
  }
@@ -398,7 +398,7 @@ export declare class Component<P extends CProps<BaseComponentEventMap> = CProps<
398
398
  * @returns child or null
399
399
  */
400
400
  queryItem<T extends Component>(selector: string): T;
401
- queryAll(selector: string, cb?: (el: Component) => void): NodeListOf<Element>;
401
+ queryAll(selector: string, cb?: (el: Component) => void): HTMLElement[];
402
402
  /**
403
403
  * find a child with the given ID
404
404
  * @param id id (without '#')
package/lib/component.js CHANGED
@@ -1177,7 +1177,7 @@ class Component extends base_component_1.BaseComponent {
1177
1177
  return result ? Component.getElement(result) : null;
1178
1178
  }
1179
1179
  queryAll(selector, cb) {
1180
- const elements = this.m_dom.querySelectorAll(selector);
1180
+ let elements = Array.from(this.m_dom.querySelectorAll(selector));
1181
1181
  if (cb) {
1182
1182
  elements.forEach((el) => {
1183
1183
  cb(flyWrap(el));
package/lib/datastore.js CHANGED
@@ -332,7 +332,7 @@ class Record {
332
332
  }
333
333
  let fld = fields[idx];
334
334
  if (fld.calc !== undefined) {
335
- return fld.calc.call(this);
335
+ return fld.calc(this);
336
336
  }
337
337
  return this[fld.name];
338
338
  }
package/lib/md5.d.ts CHANGED
@@ -51,7 +51,7 @@ export declare class Md5 {
51
51
  appendAsciiStr(str: string): this;
52
52
  appendByteArray(input: Uint8Array): this;
53
53
  getState(): {
54
- buffer: any;
54
+ buffer: string;
55
55
  buflen: number;
56
56
  length: number;
57
57
  state: number[];
package/lib/md5.js CHANGED
@@ -343,6 +343,7 @@ class Md5 {
343
343
  const self = this;
344
344
  const s = self._state;
345
345
  return {
346
+ //@ts-ignore
346
347
  buffer: String.fromCharCode.apply(null, self._buffer8),
347
348
  buflen: self._bufferLength,
348
349
  length: self._dataLength,
package/lib/popup.js CHANGED
@@ -110,13 +110,12 @@ class Popup extends component_1.Container {
110
110
  autofocus.focus();
111
111
  }
112
112
  else {
113
- let tabbable = this.queryItem('[tabindex]');
113
+ let tabbable = this.queryAll('[tabindex]');
114
114
  if (tabbable) {
115
- let tab_indexes = [].map.call(tabbable, (e) => { return e; });
116
115
  // remove hidden elements
117
- tab_indexes = tab_indexes.filter((el) => el.offsetParent !== null);
118
- if (tab_indexes.length) {
119
- tab_indexes[0].focus();
116
+ tabbable = tabbable.filter((el) => el.offsetParent !== null);
117
+ if (tabbable.length) {
118
+ tabbable[0].focus();
120
119
  }
121
120
  }
122
121
  }
@@ -343,8 +342,7 @@ function _nextTab(root, el, prev) {
343
342
  let comp = component_1.Component.getElement(el);
344
343
  // get a list of elements with tab index, this way we should abble to
345
344
  // cycle on them (not on browser address nor under dialog elements)
346
- let tabbable = root.querySelectorAll('[tabindex]');
347
- let tab_indexes = [].map.call(tabbable, (e) => { return e; });
345
+ let tab_indexes = Array.from(root.querySelectorAll('[tabindex]'));
348
346
  // remove hidden elements
349
347
  tab_indexes = tab_indexes.filter((el) => el.offsetParent !== null);
350
348
  if (!tab_indexes.length) {
package/lib/request.js CHANGED
@@ -78,7 +78,7 @@ function ajaxRequest(cfg) {
78
78
  }
79
79
  if (cfg.headers) {
80
80
  for (let h in cfg.headers) {
81
- this.xhr.setRequestHeader(h, cfg.headers[h]);
81
+ xhr.setRequestHeader(h, cfg.headers[h]);
82
82
  }
83
83
  }
84
84
  function progress(ev) {
package/lib/textedit.js CHANGED
@@ -114,7 +114,7 @@ class TextEdit extends component_1.Component {
114
114
  else if (props.type == 'date') {
115
115
  button = new button_1.Button({
116
116
  cls: 'gadget',
117
- icon: 'cls(far fa-calendar-days)',
117
+ icon: 'var( --x4-icon-calendar-days )',
118
118
  tabIndex: false,
119
119
  click: () => this._showDatePicker(button)
120
120
  });
package/lib/x4.css CHANGED
@@ -57,6 +57,102 @@
57
57
  --x4-icon-rectangle-times: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path d="M448 32C483.3 32 512 60.65 512 96V416C512 451.3 483.3 480 448 480H64C28.65 480 0 451.3 0 416V96C0 60.65 28.65 32 64 32H448zM175 208.1L222.1 255.1L175 303C165.7 312.4 165.7 327.6 175 336.1C184.4 346.3 199.6 346.3 208.1 336.1L255.1 289.9L303 336.1C312.4 346.3 327.6 346.3 336.1 336.1C346.3 327.6 346.3 312.4 336.1 303L289.9 255.1L336.1 208.1C346.3 199.6 346.3 184.4 336.1 175C327.6 165.7 312.4 165.7 303 175L255.1 222.1L208.1 175C199.6 165.7 184.4 165.7 175 175C165.7 184.4 165.7 199.6 175 208.1V208.1z"/></svg>';
58
58
  --x4-icon-xmark: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><path d="M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"/></svg>';
59
59
  --x4-icon-angle-down: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="currentColor"><path d="M192 384c-8.188 0-16.38-3.125-22.62-9.375l-160-160c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L192 306.8l137.4-137.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-160 160C208.4 380.9 200.2 384 192 384z"/></svg>';
60
+ --x4-icon-calendar-days: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><path d="M160 32V64H288V32C288 14.33 302.3 0 320 0C337.7 0 352 14.33 352 32V64H400C426.5 64 448 85.49 448 112V160H0V112C0 85.49 21.49 64 48 64H96V32C96 14.33 110.3 0 128 0C145.7 0 160 14.33 160 32zM0 192H448V464C448 490.5 426.5 512 400 512H48C21.49 512 0 490.5 0 464V192zM64 304C64 312.8 71.16 320 80 320H112C120.8 320 128 312.8 128 304V272C128 263.2 120.8 256 112 256H80C71.16 256 64 263.2 64 272V304zM192 304C192 312.8 199.2 320 208 320H240C248.8 320 256 312.8 256 304V272C256 263.2 248.8 256 240 256H208C199.2 256 192 263.2 192 272V304zM336 256C327.2 256 320 263.2 320 272V304C320 312.8 327.2 320 336 320H368C376.8 320 384 312.8 384 304V272C384 263.2 376.8 256 368 256H336zM64 432C64 440.8 71.16 448 80 448H112C120.8 448 128 440.8 128 432V400C128 391.2 120.8 384 112 384H80C71.16 384 64 391.2 64 400V432zM208 384C199.2 384 192 391.2 192 400V432C192 440.8 199.2 448 208 448H240C248.8 448 256 440.8 256 432V400C256 391.2 248.8 384 240 384H208zM320 432C320 440.8 327.2 448 336 448H368C376.8 448 384 440.8 384 432V400C384 391.2 376.8 384 368 384H336C327.2 384 320 391.2 320 400V432z"/></svg>';
61
+ }
62
+ /* source: https://tailwindcss.com/docs/customizing-colors/#default-color-palette */
63
+ :root {
64
+ --black: #000000;
65
+ --white: #ffffff;
66
+ --gray-100: #f7fafc;
67
+ --gray-200: #edf2f7;
68
+ --gray-300: #e2e8f0;
69
+ --gray-400: #cbd5e0;
70
+ --gray-500: #a0aec0;
71
+ --gray-600: #718096;
72
+ --gray-700: #4a5568;
73
+ --gray-800: #2d3748;
74
+ --gray-900: #1a202c;
75
+ --red-100: #fff5f5;
76
+ --red-200: #fed7d7;
77
+ --red-300: #feb2b2;
78
+ --red-400: #fc8181;
79
+ --red-500: #f56565;
80
+ --red-600: #e53e3e;
81
+ --red-700: #c53030;
82
+ --red-800: #9b2c2c;
83
+ --red-900: #742a2a;
84
+ --orange-100: #fffaf0;
85
+ --orange-200: #feebc8;
86
+ --orange-300: #fbd38d;
87
+ --orange-400: #f6ad55;
88
+ --orange-500: #ed8936;
89
+ --orange-600: #dd6b20;
90
+ --orange-700: #c05621;
91
+ --orange-800: #9c4221;
92
+ --orange-900: #7b341e;
93
+ --yellow-100: #fffff0;
94
+ --yellow-200: #fefcbf;
95
+ --yellow-300: #faf089;
96
+ --yellow-400: #f6e05e;
97
+ --yellow-500: #ecc94b;
98
+ --yellow-600: #d69e2e;
99
+ --yellow-700: #b7791f;
100
+ --yellow-800: #975a16;
101
+ --yellow-900: #744210;
102
+ --green-100: #f0fff4;
103
+ --green-200: #c6f6d5;
104
+ --green-300: #9ae6b4;
105
+ --green-400: #68d391;
106
+ --green-500: #48bb78;
107
+ --green-600: #38a169;
108
+ --green-700: #2f855a;
109
+ --green-800: #276749;
110
+ --green-900: #22543d;
111
+ --teal-100: #e6fffa;
112
+ --teal-200: #b2f5ea;
113
+ --teal-300: #81e6d9;
114
+ --teal-400: #4fd1c5;
115
+ --teal-500: #38b2ac;
116
+ --teal-600: #319795;
117
+ --teal-700: #2c7a7b;
118
+ --teal-800: #285e61;
119
+ --teal-900: #234e52;
120
+ --blue-100: #ebf8ff;
121
+ --blue-200: #bee3f8;
122
+ --blue-300: #90cdf4;
123
+ --blue-400: #63b3ed;
124
+ --blue-500: #4299e1;
125
+ --blue-600: #3182ce;
126
+ --blue-700: #2b6cb0;
127
+ --blue-800: #2c5282;
128
+ --blue-900: #2a4365;
129
+ --indigo-100: #ebf4ff;
130
+ --indigo-200: #c3dafe;
131
+ --indigo-300: #a3bffa;
132
+ --indigo-400: #7f9cf5;
133
+ --indigo-500: #667eea;
134
+ --indigo-600: #5a67d8;
135
+ --indigo-700: #4c51bf;
136
+ --indigo-800: #434190;
137
+ --indigo-900: #3c366b;
138
+ --purple-100: #faf5ff;
139
+ --purple-200: #e9d8fd;
140
+ --purple-300: #d6bcfa;
141
+ --purple-400: #b794f4;
142
+ --purple-500: #9f7aea;
143
+ --purple-600: #805ad5;
144
+ --purple-700: #6b46c1;
145
+ --purple-800: #553c9a;
146
+ --purple-900: #44337a;
147
+ --pink-100: #fff5f7;
148
+ --pink-200: #fed7e2;
149
+ --pink-300: #fbb6ce;
150
+ --pink-400: #f687b3;
151
+ --pink-500: #ed64a6;
152
+ --pink-600: #d53f8c;
153
+ --pink-700: #b83280;
154
+ --pink-800: #97266d;
155
+ --pink-900: #702459;
60
156
  }
61
157
  .x4-root-element {
62
158
  padding: 0;
@@ -326,7 +422,7 @@ textarea::selection {
326
422
  .x-text-edit > .x-label,
327
423
  .x-combo-box > .x-label {
328
424
  padding: 4px;
329
- color: rgba(0, 0, 0, 0.8);
425
+ color: var(--gray-900);
330
426
  margin-top: 1px;
331
427
  line-height: 1.3em;
332
428
  min-height: 2em;
@@ -344,8 +440,7 @@ textarea::selection {
344
440
  outline: none;
345
441
  border: none;
346
442
  padding: 4px;
347
- color: rgba(0, 0, 0, 0.9);
348
- background-color: rgba(255, 255, 255, 0.25);
443
+ color: var(--gray-900);
349
444
  border-bottom: 1px solid transparent;
350
445
  margin-top: 1px;
351
446
  line-height: 1.3em;
@@ -354,7 +449,7 @@ textarea::selection {
354
449
  .x-combo-box input::placeholder,
355
450
  .x-text-edit .x-fake-input::placeholder,
356
451
  .x-combo-box .x-fake-input::placeholder {
357
- color: rgba(255, 255, 255, 0.5);
452
+ color: var(--gray-800);
358
453
  }
359
454
  .x-text-edit input::selection,
360
455
  .x-combo-box input::selection,
@@ -377,13 +472,17 @@ textarea::selection {
377
472
  .x-combo-box .x-button.gadget {
378
473
  background-color: transparent;
379
474
  font-size: var(--x4-font-size);
380
- color: black;
475
+ color: var(--gray-900);
381
476
  border: none;
382
477
  margin: 0;
383
478
  padding: 0;
384
479
  height: 2em;
385
480
  margin-top: 1px;
386
481
  }
482
+ .x-text-edit .x-button.gadget:hover,
483
+ .x-combo-box .x-button.gadget:hover {
484
+ background-color: transparent;
485
+ }
387
486
  .x-text-edit .x-button.gadget:focus,
388
487
  .x-combo-box .x-button.gadget:focus {
389
488
  color: var(--x4-focus-color);
@@ -429,6 +528,10 @@ textarea::selection {
429
528
  border-bottom: none;
430
529
  border-left: 4px solid var(--x4-error-color);
431
530
  }
531
+ .x-text-edit .x-button.gadget {
532
+ margin-left: 1 px;
533
+ margin-right: 1 px;
534
+ }
432
535
  .x-combo-box > .x-label {
433
536
  border-top: 1px solid transparent;
434
537
  }
@@ -486,20 +589,24 @@ textarea::selection {
486
589
  .x-text-edit:focus .label1 {
487
590
  color: black;
488
591
  }
592
+ .x-radio-btn,
489
593
  .x-check-box {
490
594
  align-items: center;
491
- color: rgba(0, 0, 0, 0.8);
595
+ color: var(--gray-900);
492
596
  outline: none;
493
597
  padding: 4px 0;
494
598
  }
599
+ .x-radio-btn input,
495
600
  .x-check-box input {
496
601
  outline: none;
497
602
  margin: 4px;
498
603
  padding: 0;
499
604
  }
605
+ .x-radio-btn .x-label,
500
606
  .x-check-box .x-label {
501
607
  padding: 4px;
502
608
  }
609
+ .x-radio-btn:focus-within,
503
610
  .x-check-box:focus-within {
504
611
  text-decoration: underline;
505
612
  color: var(--x4-selection-color);
@@ -570,7 +677,7 @@ textarea::selection {
570
677
  align-items: center;
571
678
  outline: none;
572
679
  background-color: transparent;
573
- color: rgba(0, 0, 0, 0.8);
680
+ color: var(--gray-900);
574
681
  padding: 0px 8px;
575
682
  min-width: 120px;
576
683
  border: none;
@@ -578,17 +685,17 @@ textarea::selection {
578
685
  .x-menu-item .x-icon {
579
686
  width: 1em;
580
687
  margin-right: 8px;
581
- color: rgba(0, 0, 0, 0.3);
688
+ color: var(--gray-700);
582
689
  }
583
690
  .x-menu-item .x-label {
584
691
  padding: 4px;
585
692
  }
586
693
  .x-menu-item:hover {
587
694
  background-color: #c6d3d9;
588
- color: black;
695
+ color: var(--gray-900);
589
696
  }
590
697
  .x-menu-item:hover .x-icon {
591
- color: black;
698
+ color: var(--gray-900);
592
699
  }
593
700
  .x-menu-separator {
594
701
  margin-top: 4px;
@@ -702,7 +809,7 @@ textarea::selection {
702
809
  box-shadow: none;
703
810
  }
704
811
  .x-panel > .title > .x-button:focus {
705
- color: black;
812
+ color: var(--gray-900);
706
813
  }
707
814
  .x-panel > .body {
708
815
  padding: 8px;
@@ -961,7 +1068,7 @@ textarea::selection {
961
1068
  overflow: hidden;
962
1069
  padding: 4px;
963
1070
  white-space: nowrap;
964
- color: black;
1071
+ color: var(--gray-900);
965
1072
  height: 2em;
966
1073
  }
967
1074
  .x-spreadsheet .x-footer,
@@ -1177,7 +1284,7 @@ textarea::selection {
1177
1284
  max-height: 400px;
1178
1285
  border: 1px solid #00000073;
1179
1286
  overflow: auto;
1180
- color: black;
1287
+ color: var(--gray-900);
1181
1288
  }
1182
1289
  .x-popup-list-view .x-combo-popup .x-list-item {
1183
1290
  height: 2em;
@@ -1212,18 +1319,19 @@ textarea::selection {
1212
1319
  }
1213
1320
  .x-calendar .month-sel .x-button {
1214
1321
  height: auto;
1215
- color: black;
1322
+ color: var(--gray-900);
1216
1323
  }
1217
1324
  .x-calendar .week {
1218
1325
  align-items: center;
1326
+ border: 1px solid transparent;
1219
1327
  }
1220
1328
  .x-calendar .week:hover {
1221
- background-color: var(--x4-hover-color);
1329
+ border-color: var(--x4-hover-color);
1222
1330
  border-radius: 4px;
1223
1331
  }
1224
1332
  .x-calendar .week .cell {
1225
1333
  height: 100%;
1226
- color: rgba(0, 0, 0, 0.7);
1334
+ color: var(--gray-900);
1227
1335
  text-align: center;
1228
1336
  }
1229
1337
  .x-calendar .week .cell span {
@@ -1253,7 +1361,7 @@ textarea::selection {
1253
1361
  color: white;
1254
1362
  }
1255
1363
  .x-calendar .header .cell {
1256
- color: rgba(0, 0, 0, 0.5);
1364
+ color: var(--gray-800);
1257
1365
  height: 1.5em;
1258
1366
  }
1259
1367
  .x-calendar .header:hover {
@@ -1527,7 +1635,7 @@ textarea::selection {
1527
1635
  width: 100%;
1528
1636
  color: transparent;
1529
1637
  background-color: transparent;
1530
- caret-color: black;
1638
+ color: var(--gray-900);
1531
1639
  -moz-tab-size: 4;
1532
1640
  -o-tab-size: 4;
1533
1641
  tab-size: 4;
@@ -248,7 +248,8 @@ export declare class EventSource<Q extends EventMap, T extends EventTypes = MapE
248
248
  * @param eventName - event name
249
249
  * @param callback - callback to remove (must be the same as in on )
250
250
  */
251
- off(eventName: string, callback: EventCallback): void;
251
+ off<K extends keyof Q>(type: K, callback: (ev: Q[K]) => any): void;
252
+ _off(eventName: string, callback: EventCallback): void;
252
253
  /**
253
254
  * remove all listeners for an event
254
255
  * @param eventName - event name
package/lib/x4_events.js CHANGED
@@ -236,11 +236,12 @@ class EventSource {
236
236
  * the system may overflow
237
237
  */
238
238
  once(type, callback) {
239
+ //@ts-ignore
239
240
  this._once(type, callback);
240
241
  }
241
242
  _once(eventName, callback) {
242
243
  const newCallback = (ev) => {
243
- this.off(eventName, newCallback);
244
+ this._off(eventName, newCallback);
244
245
  callback(ev);
245
246
  };
246
247
  this._on(eventName, newCallback);
@@ -317,6 +318,7 @@ class EventSource {
317
318
  * @param capturing - if true, capture event before other registred event handlers
318
319
  */
319
320
  on(type, callback) {
321
+ //@ts-ignore
320
322
  return this._on(type, callback);
321
323
  }
322
324
  _on(eventName, callback, capturing = false) {
@@ -337,7 +339,7 @@ class EventSource {
337
339
  }
338
340
  }
339
341
  return {
340
- dispose: () => { this.off(eventName, callback); }
342
+ dispose: () => { this._off(eventName, callback); }
341
343
  };
342
344
  }
343
345
  /**
@@ -345,7 +347,11 @@ class EventSource {
345
347
  * @param eventName - event name
346
348
  * @param callback - callback to remove (must be the same as in on )
347
349
  */
348
- off(eventName, callback) {
350
+ off(type, callback) {
351
+ //@ts-ignore
352
+ return this._off(type, callback);
353
+ }
354
+ _off(eventName, callback) {
349
355
  if (!this.m_eventRegistry) {
350
356
  return;
351
357
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "1.4.9",
3
+ "version": "1.4.10",
4
4
  "description": "X4js core files",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/src/calendar.ts CHANGED
@@ -167,17 +167,21 @@ export class Calendar extends VLayout<CalendarProps, CalendarEventMap>
167
167
  cls += ' out';
168
168
  }
169
169
 
170
- days.push(new HLayout({
171
- cls,
172
- flex: 1,
173
- content: new Component({
174
- tag: 'span',
175
- content: formatIntlDate(dte, 'd'),
176
- }),
177
- dom_events: {
178
- click: () => this.select(dte.clone())
179
- }
180
- }));
170
+ const mkItem = ( dte ) => {
171
+ return new HLayout({
172
+ cls,
173
+ flex: 1,
174
+ content: new Component({
175
+ tag: 'span',
176
+ content: formatIntlDate(dte, 'd'),
177
+ }),
178
+ dom_events: {
179
+ click: () => this.select(dte)
180
+ }
181
+ })
182
+ }
183
+
184
+ days.push( mkItem( dte.clone() ) );
181
185
 
182
186
  dte.setDate(dte.getDate() + 1);
183
187
  first = false;
package/src/canvas.ts CHANGED
@@ -87,7 +87,7 @@ function mkPainter(c2d: CanvasRenderingContext2D, w: number, h: number): CanvasP
87
87
  return cp;
88
88
  }
89
89
 
90
- function smoothLine(points: any[], path: CanvasPath = null, move = true) {
90
+ function smoothLine( this: CanvasRenderingContext2D, points: any[], path: CanvasPath = null, move = true) {
91
91
  if (points.length < 2) {
92
92
  return;
93
93
  }
@@ -150,7 +150,7 @@ function smoothLine(points: any[], path: CanvasPath = null, move = true) {
150
150
  path.lineTo(p1.x, p1.y);
151
151
  }
152
152
 
153
- function smoothLineEx(_points: any[], tension: number = 0.5, numOfSeg: number = 10, path: CanvasPath = null, move = true, close = false) {
153
+ function smoothLineEx(this: CanvasRenderingContext2D, _points: any[], tension: number = 0.5, numOfSeg: number = 10, path: CanvasPath = null, move = true, close = false) {
154
154
 
155
155
  let points = [];
156
156
 
@@ -261,7 +261,7 @@ function smoothLineEx(_points: any[], tension: number = 0.5, numOfSeg: number =
261
261
  }
262
262
  }
263
263
 
264
- function line(x1: number, y1: number, x2: number, y2: number, color: string, lineWidth: number = 1) {
264
+ function line(this: CanvasRenderingContext2D, x1: number, y1: number, x2: number, y2: number, color: string, lineWidth: number = 1) {
265
265
  this.save();
266
266
  this.beginPath();
267
267
  this.moveTo(x1, y1);
@@ -272,7 +272,7 @@ function line(x1: number, y1: number, x2: number, y2: number, color: string, lin
272
272
  this.restore();
273
273
  }
274
274
 
275
- function roundRect(x: number, y: number, width: number, height: number, radius: number) {
275
+ function roundRect(this: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, radius: number) {
276
276
  //this.beginPath( );
277
277
  this.moveTo(x + radius, y);
278
278
  this.lineTo(x + width - radius, y);
@@ -286,7 +286,7 @@ function roundRect(x: number, y: number, width: number, height: number, radius:
286
286
  this.closePath();
287
287
  }
288
288
 
289
- function calcTextSize(text: string, rounded = false): { width: number, height: number } {
289
+ function calcTextSize( this: CanvasRenderingContext2D, text: string, rounded = false): { width: number, height: number } {
290
290
 
291
291
  let fh = this.measureText(text);
292
292
  let lh = fh.fontBoundingBoxAscent + fh.fontBoundingBoxDescent;
@@ -299,12 +299,12 @@ function calcTextSize(text: string, rounded = false): { width: number, height: n
299
299
  }
300
300
  }
301
301
 
302
- function setFontSize(fs: number) {
302
+ function setFontSize( this: CanvasRenderingContext2D, fs: number) {
303
303
  let fsize = Math.round(fs) + 'px';
304
304
  this.font = this.font.replace(/\d+px/, fsize);
305
305
  }
306
306
 
307
- function circle(x: number, y: number, radius: number) {
307
+ function circle( this: CanvasRenderingContext2D, x: number, y: number, radius: number) {
308
308
  this.moveTo(x + radius, y);
309
309
  this.arc(x, y, radius, 0, Math.PI * 2);
310
310
  }
package/src/component.ts CHANGED
@@ -1562,8 +1562,9 @@ export class Component<P extends CProps<BaseComponentEventMap> = CProps<BaseComp
1562
1562
  return result ? Component.getElement<T>(result) : null;
1563
1563
  }
1564
1564
 
1565
- public queryAll(selector: string, cb?: (el: Component) => void) {
1566
- const elements = this.m_dom.querySelectorAll(selector);
1565
+ public queryAll(selector: string, cb?: (el: Component) => void): HTMLElement[] {
1566
+ let elements:HTMLElement[] = Array.from( this.m_dom.querySelectorAll<HTMLElement>(selector) );
1567
+
1567
1568
  if( cb ) {
1568
1569
  elements.forEach((el) => {
1569
1570
  cb(flyWrap(el as HTMLElement));
package/src/datastore.ts CHANGED
@@ -442,7 +442,7 @@ export class Record {
442
442
 
443
443
  let fld = fields[idx];
444
444
  if( fld.calc!==undefined ) {
445
- return fld.calc.call( this );
445
+ return fld.calc( this );
446
446
  }
447
447
 
448
448
  return this[fld.name];
package/src/md5.ts CHANGED
@@ -363,6 +363,7 @@ export class Md5 {
363
363
  const s = self._state;
364
364
 
365
365
  return {
366
+ //@ts-ignore
366
367
  buffer: String.fromCharCode.apply(null, self._buffer8),
367
368
  buflen: self._bufferLength,
368
369
  length: self._dataLength,
package/src/popup.ts CHANGED
@@ -148,15 +148,13 @@ export class Popup<P extends PopupProps = PopupProps, E extends PopupEventMap =
148
148
  autofocus.focus( )
149
149
  }
150
150
  else {
151
- let tabbable = this.queryItem('[tabindex]');
151
+ let tabbable = this.queryAll('[tabindex]');
152
152
 
153
153
  if( tabbable ) {
154
- let tab_indexes: HTMLElement[] = [].map.call(tabbable, (e) => { return e; });
155
-
156
154
  // remove hidden elements
157
- tab_indexes = tab_indexes.filter((el) => el.offsetParent !== null);
158
- if (tab_indexes.length) {
159
- tab_indexes[0].focus( );
155
+ tabbable = tabbable.filter((el) => el.offsetParent !== null);
156
+ if (tabbable.length) {
157
+ tabbable[0].focus( );
160
158
  }
161
159
  }
162
160
  }
@@ -447,8 +445,7 @@ function _nextTab(root: HTMLElement, el: HTMLElement, prev: boolean) {
447
445
 
448
446
  // get a list of elements with tab index, this way we should abble to
449
447
  // cycle on them (not on browser address nor under dialog elements)
450
- let tabbable = root.querySelectorAll('[tabindex]');
451
- let tab_indexes: HTMLElement[] = [].map.call(tabbable, (e) => { return e; });
448
+ let tab_indexes:HTMLElement[] = Array.from( root.querySelectorAll<HTMLElement>('[tabindex]') );
452
449
 
453
450
  // remove hidden elements
454
451
  tab_indexes = tab_indexes.filter((el) => el.offsetParent !== null);
package/src/request.ts CHANGED
@@ -108,7 +108,7 @@ export function ajaxRequest( cfg: RequestProps ) : Function {
108
108
 
109
109
  if( cfg.headers ) {
110
110
  for( let h in cfg.headers) {
111
- this.xhr.setRequestHeader( h, cfg.headers[h] );
111
+ xhr.setRequestHeader( h, cfg.headers[h] );
112
112
  }
113
113
  }
114
114
 
package/src/textedit.ts CHANGED
@@ -171,7 +171,7 @@ export class TextEdit<T extends TextEditProps = TextEditProps> extends Component
171
171
 
172
172
  button = new Button({
173
173
  cls: 'gadget',
174
- icon: 'cls(far fa-calendar-days)', // todo: resolve that
174
+ icon: 'var( --x4-icon-calendar-days )',
175
175
  tabIndex: false,
176
176
  click: () => this._showDatePicker(button)
177
177
  });
@@ -461,7 +461,7 @@ export class TextEdit<T extends TextEditProps = TextEditProps> extends Component
461
461
  this.value = props.validator(value);
462
462
  }
463
463
  catch (err) {
464
- this.showError(err instanceof Error ? err.message : err);
464
+ this.showError(err instanceof Error ? err.message : err as string);
465
465
  return false;
466
466
  }
467
467
  }