x4js 1.5.40 → 1.6.1

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 (137) hide show
  1. package/README.md +1 -1
  2. package/lib/README.txt +1 -1
  3. package/lib/changelog.txt +3 -0
  4. package/lib/cjs/{index.js → x4js.js} +7 -7
  5. package/lib/cjs/x4js.js.map +7 -0
  6. package/lib/esm/{index.mjs → x4js.mjs} +18 -12
  7. package/lib/esm/x4js.mjs.map +7 -0
  8. package/lib/src/MIT-license.md +1 -1
  9. package/lib/src/action.ts +1 -1
  10. package/lib/src/app_sockets.ts +1 -1
  11. package/lib/src/application.ts +3 -3
  12. package/lib/src/autocomplete.ts +1 -1
  13. package/lib/src/base64.ts +1 -1
  14. package/lib/src/base_component.ts +1 -1
  15. package/lib/src/button.ts +1 -1
  16. package/lib/src/calendar.ts +2 -2
  17. package/lib/src/canvas.ts +9 -4
  18. package/lib/src/cardview.ts +9 -8
  19. package/lib/src/checkbox.ts +1 -1
  20. package/lib/src/color.ts +4 -4
  21. package/lib/src/colorpicker.ts +18 -8
  22. package/lib/src/combobox.ts +7 -7
  23. package/lib/src/component.ts +45 -41
  24. package/lib/src/copyright.txt +1 -1
  25. package/lib/src/datastore.ts +1 -1
  26. package/lib/src/dialog.ts +2 -2
  27. package/lib/src/dom_events.ts +1 -1
  28. package/lib/src/drag_manager.ts +4 -4
  29. package/lib/src/drawtext.ts +1 -1
  30. package/lib/src/fileupload.ts +4 -4
  31. package/lib/src/form.ts +2 -2
  32. package/lib/src/formatters.ts +1 -1
  33. package/lib/src/gridview.ts +1 -1
  34. package/lib/src/i18n.ts +1 -1
  35. package/lib/src/icon.ts +1 -1
  36. package/lib/src/image.ts +1 -1
  37. package/lib/src/index.ts +1 -1
  38. package/lib/src/input.ts +1 -1
  39. package/lib/src/label.ts +1 -1
  40. package/lib/src/layout.ts +1 -1
  41. package/lib/src/link.ts +1 -1
  42. package/lib/src/listview.ts +1 -1
  43. package/lib/src/md5.ts +1 -1
  44. package/lib/src/menu.ts +1 -1
  45. package/lib/src/messagebox.ts +1 -1
  46. package/lib/src/panel.ts +1 -1
  47. package/lib/src/popup.ts +1 -1
  48. package/lib/src/property_editor.ts +1 -1
  49. package/lib/src/radiobtn.ts +1 -1
  50. package/lib/src/rating.ts +1 -1
  51. package/lib/src/request.ts +1 -1
  52. package/lib/src/router.ts +1 -1
  53. package/lib/src/settings.ts +1 -1
  54. package/lib/src/sidebarview.ts +1 -1
  55. package/lib/src/spreadsheet.ts +1 -1
  56. package/lib/src/styles.ts +1 -1
  57. package/lib/src/svgcomponent.ts +13 -8
  58. package/lib/src/tabbar.ts +1 -1
  59. package/lib/src/tabview.ts +1 -1
  60. package/lib/src/textarea.ts +1 -1
  61. package/lib/src/textedit.ts +1 -1
  62. package/lib/src/toaster.ts +1 -1
  63. package/lib/src/tools.ts +1 -1
  64. package/lib/src/tooltips.ts +1 -1
  65. package/lib/src/treeview.ts +1 -1
  66. package/lib/src/version.ts +2 -2
  67. package/lib/src/x4.less +1 -1
  68. package/lib/src/x4dom.ts +1 -1
  69. package/lib/src/x4events.ts +10 -10
  70. package/lib/src/x4js.ts +89 -0
  71. package/lib/src/x4react.ts +1 -1
  72. package/lib/styles/x4.css +1 -1
  73. package/lib/styles/x4.less +1 -1
  74. package/lib/types/x4js.d.ts +6762 -0
  75. package/package.json +10 -8
  76. package/lib/cjs/index.js.map +0 -7
  77. package/lib/esm/index.js.map +0 -7
  78. package/lib/esm/index.mjs.map +0 -7
  79. package/lib/types/action.d.ts +0 -57
  80. package/lib/types/app_sockets.d.ts +0 -29
  81. package/lib/types/application.d.ts +0 -108
  82. package/lib/types/autocomplete.d.ts +0 -63
  83. package/lib/types/base_component.d.ts +0 -88
  84. package/lib/types/button.d.ts +0 -151
  85. package/lib/types/calendar.d.ts +0 -82
  86. package/lib/types/canvas.d.ts +0 -92
  87. package/lib/types/cardview.d.ts +0 -87
  88. package/lib/types/checkbox.d.ts +0 -77
  89. package/lib/types/color.d.ts +0 -148
  90. package/lib/types/colorpicker.d.ts +0 -107
  91. package/lib/types/combobox.d.ts +0 -111
  92. package/lib/types/component.d.ts +0 -603
  93. package/lib/types/datastore.d.ts +0 -396
  94. package/lib/types/dialog.d.ts +0 -175
  95. package/lib/types/dom_events.d.ts +0 -302
  96. package/lib/types/drag_manager.d.ts +0 -58
  97. package/lib/types/drawtext.d.ts +0 -48
  98. package/lib/types/fileupload.d.ts +0 -64
  99. package/lib/types/form.d.ts +0 -142
  100. package/lib/types/formatters.d.ts +0 -35
  101. package/lib/types/gridview.d.ts +0 -175
  102. package/lib/types/i18n.d.ts +0 -73
  103. package/lib/types/icon.d.ts +0 -71
  104. package/lib/types/image.d.ts +0 -56
  105. package/lib/types/index.d.ts +0 -84
  106. package/lib/types/input.d.ts +0 -97
  107. package/lib/types/label.d.ts +0 -67
  108. package/lib/types/layout.d.ts +0 -89
  109. package/lib/types/link.d.ts +0 -50
  110. package/lib/types/listview.d.ts +0 -178
  111. package/lib/types/md5.d.ts +0 -61
  112. package/lib/types/menu.d.ts +0 -130
  113. package/lib/types/messagebox.d.ts +0 -69
  114. package/lib/types/panel.d.ts +0 -47
  115. package/lib/types/popup.d.ts +0 -75
  116. package/lib/types/property_editor.d.ts +0 -71
  117. package/lib/types/radiobtn.d.ts +0 -73
  118. package/lib/types/rating.d.ts +0 -53
  119. package/lib/types/request.d.ts +0 -52
  120. package/lib/types/router.d.ts +0 -67
  121. package/lib/types/settings.d.ts +0 -37
  122. package/lib/types/sidebarview.d.ts +0 -51
  123. package/lib/types/spreadsheet.d.ts +0 -222
  124. package/lib/types/styles.d.ts +0 -85
  125. package/lib/types/svgcomponent.d.ts +0 -216
  126. package/lib/types/tabbar.d.ts +0 -58
  127. package/lib/types/tabview.d.ts +0 -49
  128. package/lib/types/textarea.d.ts +0 -77
  129. package/lib/types/textedit.d.ts +0 -126
  130. package/lib/types/toaster.d.ts +0 -42
  131. package/lib/types/tools.d.ts +0 -394
  132. package/lib/types/tooltips.d.ts +0 -46
  133. package/lib/types/treeview.d.ts +0 -144
  134. package/lib/types/version.d.ts +0 -29
  135. package/lib/types/x4dom.d.ts +0 -49
  136. package/lib/types/x4events.d.ts +0 -269
  137. package/lib/types/x4react.d.ts +0 -41
@@ -1,6 +1,6 @@
1
1
  # MIT LICENSE #
2
2
 
3
- **Copyright (c) 2019-2022 R-libre ingenierie**
3
+ **Copyright (c) 2019-2023 R-libre ingenierie**
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
6
6
  in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
package/lib/src/action.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * @file action.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
11
+ * Copyright (c) 2019-2023 R-libre ingenierie
12
12
  *
13
13
  * Permission is hereby granted, free of charge, to any person obtaining a copy
14
14
  * of this software and associated documentation files (the "Software"), to deal
@@ -8,7 +8,7 @@
8
8
  * @file app_sockets.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
11
+ * Copyright (c) 2019-2023 R-libre ingenierie
12
12
  *
13
13
  * Permission is hereby granted, free of charge, to any person obtaining a copy
14
14
  * of this software and associated documentation files (the "Software"), to deal
@@ -8,7 +8,7 @@
8
8
  * @file application.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
11
+ * Copyright (c) 2019-2023 R-libre ingenierie
12
12
  *
13
13
  * Permission is hereby granted, free of charge, to any person obtaining a copy
14
14
  * of this software and associated documentation files (the "Software"), to deal
@@ -160,7 +160,7 @@ export class Application<P extends ApplicationProps = ApplicationProps, E extend
160
160
  return this.m_user_data;
161
161
  }
162
162
 
163
- public get history( ) {
163
+ public get history( ): null {
164
164
  //if( !this.m_history ) {
165
165
  // this.m_history = new NavigationHistory( );
166
166
  //}
@@ -247,7 +247,7 @@ export class Application<P extends ApplicationProps = ApplicationProps, E extend
247
247
  const tch = ev.touches[0];
248
248
  let fake: any = {type: "dblclick" };
249
249
  for( const n in tch ) {
250
- fake[n] = tch[n];
250
+ fake[n] = (tch as any)[n];
251
251
  }
252
252
 
253
253
  // ignore -> private: dirty x2
@@ -8,7 +8,7 @@
8
8
  * @file autocomplete.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
11
+ * Copyright (c) 2019-2023 R-libre ingenierie
12
12
  *
13
13
  * Permission is hereby granted, free of charge, to any person obtaining a copy
14
14
  * of this software and associated documentation files (the "Software"), to deal
package/lib/src/base64.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * @file base64.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
11
+ * Copyright (c) 2019-2023 R-libre ingenierie
12
12
  *
13
13
  * Permission is hereby granted, free of charge, to any person obtaining a copy
14
14
  * of this software and associated documentation files (the "Software"), to deal
@@ -8,7 +8,7 @@
8
8
  * @file base_component.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
11
+ * Copyright (c) 2019-2023 R-libre ingenierie
12
12
  *
13
13
  * Permission is hereby granted, free of charge, to any person obtaining a copy
14
14
  * of this software and associated documentation files (the "Software"), to deal
package/lib/src/button.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * @file button.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
11
+ * Copyright (c) 2019-2023 R-libre ingenierie
12
12
  *
13
13
  * Permission is hereby granted, free of charge, to any person obtaining a copy
14
14
  * of this software and associated documentation files (the "Software"), to deal
@@ -8,7 +8,7 @@
8
8
  * @file calendar.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
11
+ * Copyright (c) 2019-2023 R-libre ingenierie
12
12
  *
13
13
  * Permission is hereby granted, free of charge, to any person obtaining a copy
14
14
  * of this software and associated documentation files (the "Software"), to deal
@@ -170,7 +170,7 @@ export class Calendar extends VLayout<CalendarProps, CalendarEventMap>
170
170
  cls += ' out';
171
171
  }
172
172
 
173
- const mkItem = ( dte ) => {
173
+ const mkItem = ( dte: Date ) => {
174
174
  return new HLayout({
175
175
  cls,
176
176
  flex: 1,
package/lib/src/canvas.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * @file canvas.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
11
+ * Copyright (c) 2019-2023 R-libre ingenierie
12
12
  *
13
13
  * Permission is hereby granted, free of charge, to any person obtaining a copy
14
14
  * of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,11 @@
30
30
  import { Component, CProps, CEventMap, html } from './component'
31
31
  import { BasicEvent, EventCallback } from './x4events'
32
32
 
33
+ interface IPoint {
34
+ x: number;
35
+ y: number;
36
+ }
37
+
33
38
  interface EvPaint extends BasicEvent {
34
39
  ctx: CanvasPainter;
35
40
  }
@@ -108,14 +113,14 @@ function smoothLine( this: CanvasRenderingContext2D, points: any[], path: Canvas
108
113
  return;
109
114
  }
110
115
 
111
- function midPointBtw(p1, p2) {
116
+ function midPointBtw(p1: IPoint, p2: IPoint ) {
112
117
  return {
113
118
  x: p1.x + (p2.x - p1.x) / 2,
114
119
  y: p1.y + (p2.y - p1.y) / 2
115
120
  };
116
121
  }
117
122
 
118
- function getQuadraticXY(t, sx, sy, cp1x, cp1y, ex, ey) {
123
+ function getQuadraticXY(t: number, sx: number, sy: number, cp1x: number, cp1y: number, ex: number, ey: number) : IPoint {
119
124
  return {
120
125
  x: (1 - t) * (1 - t) * sx + 2 * (1 - t) * t * cp1x + t * t * ex,
121
126
  y: (1 - t) * (1 - t) * sy + 2 * (1 - t) * t * cp1y + t * t * ey
@@ -212,7 +217,7 @@ function smoothLineEx(this: CanvasRenderingContext2D, _points: any[], tension: n
212
217
  parse(pts, cache, 4);
213
218
  }
214
219
 
215
- function parse(pts, cache, l) {
220
+ function parse(pts: number[], cache: Float32Array, l: number) {
216
221
 
217
222
  for (var i = 2, t; i < l; i += 2) {
218
223
 
@@ -8,7 +8,7 @@
8
8
  * @file cardview.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
11
+ * Copyright (c) 2019-2023 R-libre ingenierie
12
12
  *
13
13
  * Permission is hereby granted, free of charge, to any person obtaining a copy
14
14
  * of this software and associated documentation files (the "Software"), to deal
@@ -85,7 +85,7 @@ export class CardView<P extends CardViewProps = CardViewProps, E extends CardVie
85
85
  /** @ignore */
86
86
  render() {
87
87
 
88
- let pages = [];
88
+ let pages: any[] = [];
89
89
  this.m_cards.forEach((p) => {
90
90
  if (p.page) {
91
91
  pages.push(p.page);
@@ -171,7 +171,7 @@ export class CardView<P extends CardViewProps = CardViewProps, E extends CardVie
171
171
  *
172
172
  */
173
173
 
174
- private _initTabs(pages): any {
174
+ private _initTabs(pages: ICardViewItem[] ): any {
175
175
 
176
176
  if (!pages) {
177
177
  return;
@@ -185,10 +185,11 @@ export class CardView<P extends CardViewProps = CardViewProps, E extends CardVie
185
185
  return;
186
186
  }
187
187
 
188
- let card: ICardItemEx = { ...p };
189
-
190
- card.selector = this._prepareSelector(p);
191
- card.active = false;
188
+ let card: ICardItemEx = {
189
+ ...p,
190
+ selector: this._prepareSelector(p),
191
+ active: false
192
+ }
192
193
 
193
194
  this.m_cards.push(card);
194
195
 
@@ -196,7 +197,7 @@ export class CardView<P extends CardViewProps = CardViewProps, E extends CardVie
196
197
  active = p.name;
197
198
  }
198
199
 
199
- if (p.active) {
200
+ if (card.active) {
200
201
  active = p.name;
201
202
  }
202
203
  });
@@ -8,7 +8,7 @@
8
8
  * @file checkbox.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
11
+ * Copyright (c) 2019-2023 R-libre ingenierie
12
12
  *
13
13
  * Permission is hereby granted, free of charge, to any person obtaining a copy
14
14
  * of this software and associated documentation files (the "Software"), to deal
package/lib/src/color.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * @file color.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
11
+ * Copyright (c) 2019-2023 R-libre ingenierie
12
12
  *
13
13
  * Permission is hereby granted, free of charge, to any person obtaining a copy
14
14
  * of this software and associated documentation files (the "Software"), to deal
@@ -30,7 +30,7 @@
30
30
  import { Stylesheet } from './styles'
31
31
 
32
32
 
33
- const colorValues = {
33
+ const colorValues: any = {
34
34
  'lightsalmon': 0xFFFFA07A,
35
35
  'lightseagreen': 0xFF20B2AA,
36
36
  'lightskyblue': 0xFF87CEFA,
@@ -180,7 +180,7 @@ const colorValues = {
180
180
  export class Color
181
181
  {
182
182
  private m_value:number;
183
- private static custom: Color[] = []
183
+ private static custom: Record<string,Color> = {};
184
184
 
185
185
  /**
186
186
  * @example
@@ -451,7 +451,7 @@ export class Color
451
451
  r = g = b = l; // achromatic
452
452
  }
453
453
  else{
454
- function hue2rgb(p, q, t){
454
+ function hue2rgb(p: number, q: number, t: number){
455
455
  if(t < 0) t += 1.0;
456
456
  if(t > 1) t -= 1.0;
457
457
  if(t < 1/6) return p + (q - p) * 6 * t;
@@ -8,7 +8,7 @@
8
8
  * @file colorpicker.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
11
+ * Copyright (c) 2019-2023 R-libre ingenierie
12
12
  *
13
13
  * Permission is hereby granted, free of charge, to any person obtaining a copy
14
14
  * of this software and associated documentation files (the "Software"), to deal
@@ -123,11 +123,11 @@ export class ColorPicker extends Container<ColorPickerProps, ColorPickerEventMap
123
123
 
124
124
  this.addClass("pal-mode");
125
125
 
126
- let selector = null;
127
- let cur = null;
126
+ let selector: VLayout = null;
127
+ let cur: Component = null;
128
128
 
129
- let main_sel = [];
130
- let sub_sel = [];
129
+ let main_sel: Component[] = [];
130
+ let sub_sel: Component[] = [];
131
131
 
132
132
  const ccolor = this.m_baseColor.value();
133
133
 
@@ -158,7 +158,7 @@ export class ColorPicker extends Container<ColorPickerProps, ColorPickerEventMap
158
158
  main_sel.push(el);
159
159
  });
160
160
 
161
- function fillSubs( colors ) {
161
+ function fillSubs( colors: Variation[] ) {
162
162
  sub_sel = [];
163
163
  colors.forEach(mc => {
164
164
  let clr = new Color(mc.hex);
@@ -550,7 +550,7 @@ export class ColorPickerBox extends Dialog<ColorPickerBoxProps, ColorPickerBoxEv
550
550
  });
551
551
  }
552
552
 
553
- private _makeCustoms(cc) {
553
+ private _makeCustoms(cc: Color[] ) {
554
554
 
555
555
  let custom = null;
556
556
 
@@ -735,7 +735,17 @@ export class ColorPickerEditor extends HLayout<ColorPickerEditorProps, ColorPick
735
735
 
736
736
  // :: Material colors scheme ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
737
737
 
738
- const materialColors = [
738
+ interface Variation {
739
+ weight: number;
740
+ hex: number;
741
+ }
742
+
743
+ interface Variations {
744
+ color: string;
745
+ variations: Variation[];
746
+ };
747
+
748
+ const materialColors: Variations[] = [
739
749
  {
740
750
  color: "Red",
741
751
  variations: [
@@ -8,7 +8,7 @@
8
8
  * @file combobox.ts
9
9
  * @author Etienne Cochard
10
10
  *
11
- * Copyright (c) 2019-2022 R-libre ingenierie
11
+ * Copyright (c) 2019-2023 R-libre ingenierie
12
12
  *
13
13
  * Permission is hereby granted, free of charge, to any person obtaining a copy
14
14
  * of this software and associated documentation files (the "Software"), to deal
@@ -87,10 +87,10 @@ export interface ComboBoxProps extends CProps<ComboBoxEventMap> {
87
87
  }
88
88
 
89
89
  abstract class InputLike extends Component {
90
- abstract setValue( text: string );
90
+ abstract setValue( text: string ): void;
91
91
  abstract getValue( ): string;
92
- abstract showError( text: string );
93
- abstract clearError( );
92
+ abstract showError( text: string ): void;
93
+ abstract clearError( ): void;
94
94
  }
95
95
 
96
96
 
@@ -131,7 +131,7 @@ export class ComboBox extends HLayout<ComboBoxProps,ComboBoxEventMap> {
131
131
  this.m_lockchg = false;
132
132
  }
133
133
 
134
- _onKey(e) {
134
+ _onKey(e: KeyboardEvent ) {
135
135
  if (this.m_popvis) {
136
136
  if (e.key == "ArrowUp" || e.key == "ArrowDown") {
137
137
  this.m_lockpop = true;
@@ -379,12 +379,12 @@ export class ComboBox extends HLayout<ComboBoxProps,ComboBoxEventMap> {
379
379
  *
380
380
  */
381
381
 
382
- private _setInput( item, fireEv = false ) {
382
+ private _setInput( item: ListViewItem, fireEv = false ) {
383
383
 
384
384
  if( item ) {
385
385
  if( this.m_ui_input ) {
386
386
  if( this.m_ui_input instanceof Input ) {
387
- this.m_ui_input.value = item.text;
387
+ this.m_ui_input.value = item.text as string;
388
388
  // fires a change event
389
389
  if( fireEv ) {
390
390
  this.m_ui_input.dom.dispatchEvent( new Event('input') );