x4js 2.0.26 → 2.0.30

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 (73) hide show
  1. package/.vscode/launch.json +14 -0
  2. package/.vscode/settings.json +2 -0
  3. package/ai-comments.txt +97 -0
  4. package/demo/assets/house-light.svg +1 -0
  5. package/demo/assets/radio.svg +4 -0
  6. package/demo/index.html +12 -0
  7. package/demo/main.scss +23 -0
  8. package/demo/main.ts +324 -0
  9. package/demo/package.json +26 -0
  10. package/demo/scss.d.ts +4 -0
  11. package/demo/svg.d.ts +1 -0
  12. package/demo/tsconfig.json +14 -0
  13. package/lib/types/x4js.d.ts +0 -2374
  14. package/package.json +23 -47
  15. package/prepack.mjs +3 -0
  16. package/scripts/prepack.mjs +342 -0
  17. package/src/colors.scss +246 -0
  18. package/src/components/boxes/boxes.module.scss +1 -1
  19. package/src/components/boxes/boxes.ts +139 -28
  20. package/src/components/button/button.ts +80 -33
  21. package/src/components/combobox/combobox.ts +1 -1
  22. package/src/components/dialog/dialog.ts +4 -0
  23. package/src/components/gauge/gauge.module.scss +3 -0
  24. package/src/components/gauge/gauge.ts +1 -1
  25. package/src/components/gridview/gridview.ts +106 -8
  26. package/src/components/icon/icon.ts +42 -14
  27. package/src/components/input/input.ts +155 -76
  28. package/src/components/keyboard/keyboard.module.scss +1 -1
  29. package/src/components/keyboard/keyboard.ts +31 -9
  30. package/src/components/label/label.module.scss +9 -0
  31. package/src/components/label/label.ts +10 -6
  32. package/src/components/link/link.module.scss +44 -0
  33. package/src/components/link/link.ts +7 -1
  34. package/src/components/listbox/listbox.module.scss +18 -4
  35. package/src/components/listbox/listbox.ts +34 -15
  36. package/src/components/menu/menu.module.scss +14 -2
  37. package/src/components/menu/menu.ts +1 -1
  38. package/src/components/messages/messages.ts +13 -5
  39. package/src/components/panel/panel.module.scss +7 -0
  40. package/src/components/popup/popup.ts +14 -10
  41. package/src/components/propgrid/propgrid.ts +13 -3
  42. package/src/components/shared.scss +4 -0
  43. package/src/components/spreadsheet/spreadsheet.module.scss +308 -0
  44. package/src/components/spreadsheet/spreadsheet.ts +1223 -0
  45. package/src/components/tabs/tabs.module.scss +1 -0
  46. package/src/components/textarea/textarea.ts +8 -2
  47. package/src/components/textedit/textedit.ts +7 -0
  48. package/src/components/themes.scss +2 -0
  49. package/src/components/tooltips/tooltips.ts +15 -3
  50. package/src/core/component.ts +358 -162
  51. package/src/core/core_application.ts +129 -32
  52. package/src/core/core_colors.ts +382 -119
  53. package/src/core/core_data.ts +73 -86
  54. package/src/core/core_dom.ts +10 -0
  55. package/src/core/core_dragdrop.ts +32 -7
  56. package/src/core/core_element.ts +111 -4
  57. package/src/core/core_events.ts +48 -11
  58. package/src/core/core_i18n.ts +2 -0
  59. package/src/core/core_pdf.ts +454 -0
  60. package/src/core/core_router.ts +64 -5
  61. package/src/core/core_state.ts +1 -0
  62. package/src/core/core_styles.ts +11 -12
  63. package/src/core/core_svg.ts +348 -51
  64. package/src/core/core_tools.ts +105 -17
  65. package/src/x4.ts +1 -0
  66. package/src/x4tsx.d.ts +2 -1
  67. package/tsconfig.json +11 -0
  68. package/lib/README.txt +0 -20
  69. package/lib/cjs/x4.css +0 -1
  70. package/lib/cjs/x4.js +0 -2
  71. package/lib/esm/x4.css +0 -1
  72. package/lib/esm/x4.mjs +0 -2
  73. package/lib/styles/x4.css +0 -1
@@ -40,6 +40,7 @@
40
40
  &> .body {
41
41
  padding: 8px;
42
42
  border: 1px solid var( --border );
43
+ min-height: 0;
43
44
  }
44
45
  }
45
46
 
@@ -32,6 +32,7 @@ interface TextAreaProps extends BaseProps {
32
32
  value?: string;
33
33
  resize?: boolean;
34
34
  readonly?: boolean;
35
+ trim?: boolean;
35
36
  }
36
37
 
37
38
 
@@ -39,7 +40,7 @@ interface TextAreaProps extends BaseProps {
39
40
  *
40
41
  */
41
42
 
42
- class SimpleTextArea extends Component {
43
+ class SimpleTextArea extends Component<TextAreaProps> {
43
44
 
44
45
  constructor( props: TextAreaProps ) {
45
46
  super( { ...props, tag: "textarea" } );
@@ -61,7 +62,12 @@ class SimpleTextArea extends Component {
61
62
  }
62
63
 
63
64
  getText( ) {
64
- return (this.dom as HTMLTextAreaElement).value;
65
+ let text = (this.dom as HTMLTextAreaElement).value;
66
+ if( this.props.trim!==false ) {
67
+ text = text.trim();
68
+ }
69
+
70
+ return text;
65
71
  }
66
72
 
67
73
  queryInterface<T>(name: string): T {
@@ -88,7 +88,14 @@ export class TextEdit extends HBox {
88
88
  }
89
89
 
90
90
  const gadgets = props.inputGadgets ?? [];
91
+ gadgets.forEach( g => {
92
+ g.addClass( "gadget" );
93
+ })
94
+
95
+
91
96
  const iprops: InputProps = { ...props, id: props.inputId, attrs: props.inputAttrs, width: props.inputWidth };
97
+ // no propagation...
98
+ delete iprops.cls;
92
99
 
93
100
  this.setContent( [
94
101
  props.label ? new HBox( { id: "label", width: props.labelWidth, content: [
@@ -33,6 +33,7 @@ $color--interval: 8.4%;
33
33
  --color-primary-a90: #{darken($color--base, $color--interval * 4)};
34
34
  --color-primary-a100: #000000;
35
35
 
36
+ --color-danger-a30: #{lighten(#c01010,30%)};
36
37
  --color-danger-a50: #c01010;
37
38
  --color-danger-a60: #{darken(#c01010,10%)};
38
39
 
@@ -46,6 +47,7 @@ $color--interval: 8.4%;
46
47
  // Backgrounds
47
48
  --background-primary: var(--color-primary-a0); // Fond principal
48
49
  --background-secondary: var(--color-primary-a10); // Fond secondaire
50
+ --background-ternary: #f4f4f4; // Fond secondaire
49
51
 
50
52
  // Texts
51
53
  --text-primary: var(--color-primary-a100); // Texte principal
@@ -28,6 +28,7 @@ import icon from "./comments-question.svg"
28
28
 
29
29
  let last_hit: HTMLElement = null;
30
30
  let tooltip: Tooltip = null;
31
+ let mouse_pos: Point = {x:0, y:0 };
31
32
 
32
33
  const timer = new Timer( );
33
34
 
@@ -53,15 +54,20 @@ export function initTooltips( ) {
53
54
 
54
55
  }, true );
55
56
 
56
- document.addEventListener( "mouseleave", ( ev: Event ) => {
57
+ document.addEventListener( "mouseleave", ( ev: MouseEvent ) => {
57
58
  //console.log( "leave", ev.target );
58
-
59
59
  if( last_hit && ev.target==last_hit ) {
60
60
  last_hit = null;
61
61
  closeTT( );
62
62
  }
63
63
 
64
64
  }, true );
65
+
66
+ document.addEventListener( "mousemove", ( ev: MouseEvent ) => {
67
+ if( last_hit ) {
68
+ mouse_pos = { x:ev.pageX, y:ev.pageY }
69
+ }
70
+ });
65
71
  }
66
72
 
67
73
  function showTT( text: string, rc: Rect, pt: Point ) {
@@ -71,8 +77,14 @@ function showTT( text: string, rc: Rect, pt: Point ) {
71
77
 
72
78
  timer.setTimeout( null, 300, ( ) => {
73
79
  tooltip.setText( unsafeHtml(text) );
80
+
81
+ let y = mouse_pos.y;
82
+ if( rc.contains(mouse_pos) ) {
83
+ y = rc.bottom;
84
+ }
85
+
74
86
  //tooltip.displayNear( rc, "top left", "bottom left", {x:0,y:4} );
75
- tooltip.displayAt( pt.x+17, pt.y+17 );
87
+ tooltip.displayAt( mouse_pos.x+17, y+5 );
76
88
  } );
77
89
  }
78
90