x4js 2.0.7 → 2.0.9

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 (150) hide show
  1. package/lib/cjs/x4.js +1 -1
  2. package/lib/esm/x4.mjs +1 -1
  3. package/lib/output.d.ts +1472 -0
  4. package/lib/src/components/boxes/boxes.ts +1 -1
  5. package/lib/src/components/btngroup/btngroup.ts +7 -11
  6. package/lib/src/components/button/button.ts +3 -3
  7. package/lib/src/components/calendar/calendar.ts +6 -6
  8. package/lib/src/components/checkbox/checkbox.ts +3 -3
  9. package/lib/src/components/colorinput/colorinput.ts +3 -3
  10. package/lib/src/components/colorpicker/colorpicker.ts +3 -3
  11. package/lib/src/components/combobox/combobox.ts +1 -1
  12. package/lib/src/components/dialog/dialog.ts +3 -2
  13. package/lib/src/components/header/header.ts +1 -1
  14. package/lib/src/components/icon/icon.ts +1 -1
  15. package/lib/src/components/image/image.ts +1 -1
  16. package/lib/src/components/input/input.ts +2 -2
  17. package/lib/src/components/label/label.ts +2 -2
  18. package/lib/src/components/listbox/listbox.ts +1 -1
  19. package/lib/src/components/menu/menu.ts +3 -3
  20. package/lib/src/components/messages/messages.ts +2 -2
  21. package/lib/src/components/notification/notification.ts +2 -2
  22. package/lib/src/components/panel/panel.ts +2 -2
  23. package/lib/src/components/popup/popup.ts +2 -2
  24. package/lib/src/components/progress/progress.ts +1 -1
  25. package/lib/src/components/rating/rating.ts +2 -2
  26. package/lib/src/components/sizers/sizer.ts +2 -2
  27. package/lib/src/components/slider/slider.ts +2 -2
  28. package/lib/src/components/switch/switch.ts +1 -1
  29. package/lib/src/components/tabs/tabs.ts +2 -2
  30. package/lib/src/components/textarea/textarea.ts +1 -1
  31. package/lib/src/components/textedit/textedit.ts +2 -2
  32. package/lib/src/components/tooltips/tooltips.ts +2 -2
  33. package/lib/src/components/treeview/treeview.ts +1 -1
  34. package/lib/src/components/viewport/viewport.ts +1 -1
  35. package/lib/src/core/component.ts +1 -1
  36. package/lib/src/core/core_styles.ts +0 -1
  37. package/lib/src/types/svg.d.ts +1 -0
  38. package/lib/src/types/x4react.d.ts +9 -0
  39. package/lib/types/x4.d.ts +6144 -178
  40. package/package.json +6 -1
  41. package/build/x4.css +0 -1
  42. package/build/x4.js +0 -1
  43. package/scripts/build.mjs +0 -362
  44. package/scripts/prepack.mjs +0 -51
  45. package/src/components/base.scss +0 -26
  46. package/src/components/boxes/boxes.module.scss +0 -37
  47. package/src/components/boxes/boxes.ts +0 -125
  48. package/src/components/btngroup/btngroup.module.scss +0 -29
  49. package/src/components/btngroup/btngroup.ts +0 -106
  50. package/src/components/button/button.module.scss +0 -154
  51. package/src/components/button/button.ts +0 -117
  52. package/src/components/calendar/calendar-check-sharp-light.svg +0 -1
  53. package/src/components/calendar/calendar.module.scss +0 -163
  54. package/src/components/calendar/calendar.ts +0 -326
  55. package/src/components/calendar/chevron-left-sharp-light.svg +0 -1
  56. package/src/components/calendar/chevron-right-sharp-light.svg +0 -1
  57. package/src/components/checkbox/check.svg +0 -4
  58. package/src/components/checkbox/checkbox.module.scss +0 -142
  59. package/src/components/checkbox/checkbox.ts +0 -125
  60. package/src/components/colorinput/colorinput.module.scss +0 -65
  61. package/src/components/colorinput/colorinput.ts +0 -88
  62. package/src/components/colorinput/crosshairs-simple-sharp-light.svg +0 -1
  63. package/src/components/colorpicker/colorpicker.module.scss +0 -133
  64. package/src/components/colorpicker/colorpicker.ts +0 -477
  65. package/src/components/combobox/combobox.module.scss +0 -121
  66. package/src/components/combobox/combobox.ts +0 -190
  67. package/src/components/combobox/updown.svg +0 -4
  68. package/src/components/dialog/dialog.module.scss +0 -71
  69. package/src/components/dialog/dialog.ts +0 -91
  70. package/src/components/dialog/xmark-sharp-light.svg +0 -1
  71. package/src/components/form/form.module.scss +0 -34
  72. package/src/components/form/form.ts +0 -36
  73. package/src/components/header/header.module.scss +0 -40
  74. package/src/components/header/header.ts +0 -124
  75. package/src/components/icon/icon.module.scss +0 -30
  76. package/src/components/icon/icon.ts +0 -134
  77. package/src/components/image/image.module.scss +0 -21
  78. package/src/components/image/image.ts +0 -67
  79. package/src/components/input/input.module.scss +0 -69
  80. package/src/components/input/input.ts +0 -274
  81. package/src/components/label/label.module.scss +0 -52
  82. package/src/components/label/label.ts +0 -55
  83. package/src/components/listbox/listbox.module.scss +0 -103
  84. package/src/components/listbox/listbox.ts +0 -427
  85. package/src/components/menu/caret-right-solid.svg +0 -1
  86. package/src/components/menu/menu.module.scss +0 -108
  87. package/src/components/menu/menu.ts +0 -168
  88. package/src/components/messages/circle-exclamation.svg +0 -1
  89. package/src/components/messages/messages.module.scss +0 -47
  90. package/src/components/messages/messages.ts +0 -64
  91. package/src/components/normalize.scss +0 -386
  92. package/src/components/notification/circle-check-solid.svg +0 -1
  93. package/src/components/notification/circle-exclamation-solid.svg +0 -1
  94. package/src/components/notification/circle-notch-light.svg +0 -1
  95. package/src/components/notification/notification.module.scss +0 -82
  96. package/src/components/notification/notification.ts +0 -108
  97. package/src/components/notification/xmark-sharp-light.svg +0 -1
  98. package/src/components/panel/panel.module.scss +0 -48
  99. package/src/components/panel/panel.ts +0 -57
  100. package/src/components/popup/popup.module.scss +0 -43
  101. package/src/components/popup/popup.ts +0 -395
  102. package/src/components/progress/progress.module.scss +0 -57
  103. package/src/components/progress/progress.ts +0 -43
  104. package/src/components/rating/rating.module.scss +0 -23
  105. package/src/components/rating/rating.ts +0 -125
  106. package/src/components/rating/star-sharp-light.svg +0 -1
  107. package/src/components/rating/star-sharp-solid.svg +0 -1
  108. package/src/components/shared.scss +0 -76
  109. package/src/components/sizers/sizer.module.scss +0 -90
  110. package/src/components/sizers/sizer.ts +0 -120
  111. package/src/components/slider/slider.module.scss +0 -71
  112. package/src/components/slider/slider.ts +0 -143
  113. package/src/components/switch/switch.module.scss +0 -127
  114. package/src/components/switch/switch.ts +0 -56
  115. package/src/components/tabs/tabs.module.scss +0 -46
  116. package/src/components/tabs/tabs.ts +0 -157
  117. package/src/components/textarea/textarea.module.scss +0 -59
  118. package/src/components/textarea/textarea.ts +0 -54
  119. package/src/components/textedit/textedit.module.scss +0 -114
  120. package/src/components/textedit/textedit.ts +0 -82
  121. package/src/components/themes.scss +0 -77
  122. package/src/components/tooltips/circle-info-sharp-light.svg +0 -1
  123. package/src/components/tooltips/tooltips.scss +0 -51
  124. package/src/components/tooltips/tooltips.ts +0 -103
  125. package/src/components/treeview/chevron-down-light.svg +0 -1
  126. package/src/components/treeview/treeview.module.scss +0 -116
  127. package/src/components/treeview/treeview.ts +0 -403
  128. package/src/components/viewport/viewport.module.scss +0 -25
  129. package/src/components/viewport/viewport.ts +0 -38
  130. package/src/core/component.ts +0 -979
  131. package/src/core/core_colors.ts +0 -250
  132. package/src/core/core_dom.ts +0 -471
  133. package/src/core/core_dragdrop.ts +0 -201
  134. package/src/core/core_element.ts +0 -98
  135. package/src/core/core_events.ts +0 -149
  136. package/src/core/core_i18n.ts +0 -377
  137. package/src/core/core_router.ts +0 -221
  138. package/src/core/core_styles.ts +0 -215
  139. package/src/core/core_svg.ts +0 -550
  140. package/src/core/core_tools.ts +0 -673
  141. package/src/demo/assets/house-light.svg +0 -1
  142. package/src/demo/assets/radio.svg +0 -4
  143. package/src/demo/index.html +0 -12
  144. package/src/demo/main.scss +0 -21
  145. package/src/demo/main.tsx +0 -323
  146. package/src/x4.scss +0 -19
  147. package/tsconfig.json +0 -14
  148. package/types/svg.d.ts +0 -4
  149. package/types/x4react.d.ts +0 -9
  150. /package/{types → lib/src/types}/scss.d.ts +0 -0
@@ -1,121 +0,0 @@
1
- /**
2
- * ___ ___ __
3
- * \ \/ / / _
4
- * \ / /_| |_
5
- * / \____ _|
6
- * /__/\__\ |_|
7
- *
8
- * @file combobox.module.scss
9
- * @author Etienne Cochard
10
- *
11
- * @copyright (c) 2024 R-libre ingenierie
12
- *
13
- * Use of this source code is governed by an MIT-style license
14
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
- **/
16
-
17
- @use "../shared.scss";
18
-
19
- :root {
20
- --dropdown-border: var( --border-hover );
21
- --dropdown-background: var( --background-primary );
22
-
23
- --combobox-border: var( --border );
24
- --combobox-border-focus: var( --border-focus );
25
-
26
- --combobox-btn-background: inherit;
27
- --combobox-btn-color: var( --text-secondary );
28
- --combobox-btn-color-hover: var( --text-primary );
29
- }
30
-
31
- .x4dropdown {
32
- @extend .shadow-xl;
33
- @extend .hbox;
34
-
35
- max-height: 250px;
36
- position: absolute;
37
- background-color: var( --dropdown-background );
38
- border: 1px solid var( --dropdown-border );
39
-
40
- .x4listbox {
41
- @extend .flex;
42
-
43
- border: none;
44
- margin: 0;
45
- width: 100%;
46
- height: 200px;
47
- }
48
- }
49
-
50
- .x4combobox {
51
- @extend .hbox;
52
- margin: 5px;
53
-
54
- &> #label {
55
- padding: 0 6px;
56
- border-bottom: 1px solid transparent;
57
-
58
- &> .x4label {
59
- height: 100%;
60
- padding: 0;
61
- font-weight: 500;
62
- gap: 0;
63
- }
64
-
65
- &::after {
66
- content: ":"
67
- }
68
- }
69
-
70
- &>#edit {
71
- @extend .flex;
72
- border-bottom: 1px solid var( --combobox-border );
73
-
74
- .x4input {
75
- @extend .flex;
76
-
77
- &[readonly] {
78
- cursor: pointer;
79
- }
80
- }
81
-
82
- .x4button {
83
- margin: 0;
84
- padding: 0;
85
- outline: none;
86
- background-color: var( --combobox-btn-background );
87
- color: var( --combobox-btn-color );
88
-
89
- #icon {
90
- color: var( --combobox-btn-color );
91
- }
92
-
93
- &:hover, &:hover #icon {
94
- color: var( --combobox-btn-color-hover );
95
- }
96
-
97
- &:focus {
98
- //background-color: var( --color-30 );
99
- //color: var( --color-10 );
100
- }
101
- }
102
- }
103
-
104
- &[disabled] {
105
- &, * {
106
- cursor: not-allowed;
107
- }
108
-
109
- #label .x4label {
110
- color: var( --disabled-color-dark );
111
- pointer-events: none;
112
- }
113
- }
114
-
115
- &[required] {
116
- .x4label::before {
117
- content: "*";
118
- color: var( --color-90 )
119
- }
120
- }
121
- }
@@ -1,190 +0,0 @@
1
- /**
2
- * ___ ___ __
3
- * \ \/ / / _
4
- * \ / /_| |_
5
- * / \____ _|
6
- * /__/\__\ |_|
7
- *
8
- * @file combobox.ts
9
- * @author Etienne Cochard
10
- *
11
- * @copyright (c) 2024 R-libre ingenierie
12
- *
13
- * Use of this source code is governed by an MIT-style license
14
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
- **/
16
-
17
- import { Component, ComponentEvent, ComponentProps, EvChange, EvSelectionChange, makeUniqueComponentId } from '@core/component';
18
- import { Listbox, ListboxID, ListItem, kbNav } from '../listbox/listbox';
19
- import { Popup, PopupEvents, PopupProps } from '../popup/popup.js';
20
- import { Label } from '../label/label';
21
- import { Input } from '../input/input';
22
- import { Button } from '../button/button';
23
- import { HBox } from '../boxes/boxes';
24
-
25
- import "./combobox.module.scss";
26
- import icon from "./updown.svg";
27
-
28
-
29
-
30
- interface DropdownEvents extends PopupEvents {
31
- selectionChange: EvSelectionChange;
32
- }
33
-
34
-
35
- interface DropdownProps extends Omit<PopupProps,"content"> {
36
- items: ListItem[];
37
- }
38
-
39
- class Dropdown extends Popup<DropdownProps,DropdownEvents> {
40
-
41
- private _list: Listbox;
42
-
43
- constructor( props: DropdownProps, content?: ListItem[] ) {
44
- super( props );
45
-
46
- this._list = new Listbox( { items: props.items } );
47
- this.setContent( this._list );
48
-
49
- this.addDOMEvent( "mousedown", ( ev: Event ) => {
50
- console.log( "trap" );
51
- ev.stopImmediatePropagation( );
52
- ev.stopPropagation( );
53
- ev.preventDefault( );
54
- }, true );
55
-
56
- this._list.on( "selectionChange", ( ev ) => {
57
- this.fire( "selectionChange", ev );
58
- })
59
- }
60
-
61
- getList( ) {
62
- return this._list;
63
- }
64
- }
65
-
66
-
67
- /**
68
- *
69
- */
70
-
71
- interface ComboboxProps extends Omit<ComponentProps,"content"> {
72
- label?: string;
73
- labelWidth?: number | string;
74
- readonly?: boolean;
75
- items: ListItem[];
76
- }
77
-
78
-
79
- export class Combobox extends Component<ComboboxProps> {
80
-
81
- private _dropdown: Dropdown;
82
- private _label: Label;
83
- private _input: Input;
84
- private _button: Button;
85
- private _prevent_close = false;
86
- private _edit: HBox;
87
-
88
- constructor( props: ComboboxProps ) {
89
- super( props );
90
-
91
- const id = makeUniqueComponentId( );
92
-
93
- this.setContent( [
94
- new HBox( { id: "label", content: new Label( { tag: "label", text: props.label, labelFor: id, width: props.labelWidth } ) } ),
95
- this._edit = new HBox( { id: "edit", content: [
96
- this._input = new Input( { type: "text", value: "", readonly: props.readonly }),
97
- this._button = new Button( { icon: icon } )
98
- ]} ),
99
- ])
100
-
101
- this._dropdown = new Dropdown( { items: props.items } );
102
-
103
- this._dropdown.on( "selectionChange", ( ev ) => {
104
- const sel = ev.selection as ListItem;
105
- this._input.setValue( sel ? sel.text : "" );
106
-
107
- if( !this._prevent_close ) {
108
- this._dropdown.show( false );
109
- }
110
- });
111
-
112
- this._button.addDOMEvent( "click", ( ) => this._on_click( ) );
113
- this._input.addDOMEvent( "input", ( ) => this._on_input( ) );
114
- this._input.addDOMEvent( "keydown", ( ev ) => this._on_key( ev ) );
115
-
116
- this.setDOMEvents( {
117
- focusout: ( ) => this._on_focusout( ),
118
- click: ( ) => this._on_click( ),
119
- })
120
- }
121
-
122
- private _on_key( ev: KeyboardEvent ) {
123
- switch( ev.key ) {
124
- case "Enter":
125
- case "Escape": {
126
- this._dropdown.show( false );
127
- break;
128
- }
129
-
130
- case "ArrowUp":
131
- this._prevent_close = true;
132
- if( !this._dropdown.isOpen( ) ) {
133
- this.showDropDown( );
134
- }
135
- else {
136
- this._dropdown.getList().navigate( kbNav.prev );
137
- }
138
-
139
- this._prevent_close = false;
140
- break;
141
-
142
- case "ArrowDown":
143
- this._prevent_close = true;
144
- if( !this._dropdown.isOpen( ) ) {
145
- this.showDropDown( );
146
- }
147
- else {
148
- this._dropdown.getList().navigate( kbNav.next );
149
- }
150
-
151
- this._prevent_close = false;
152
- break;
153
-
154
- default: {
155
- return;
156
- }
157
- }
158
-
159
- ev.preventDefault( );
160
- ev.stopPropagation( );
161
- }
162
-
163
- private _on_input( ) {
164
- if( !this._dropdown.isOpen( ) ) {
165
- this.showDropDown( );
166
- }
167
-
168
- this._dropdown.getList().filter( this._input.getValue( ) );
169
- }
170
-
171
- private _on_focusout( ) {
172
- this._dropdown.show( false );
173
- }
174
-
175
- private _on_click( ) {
176
- this.showDropDown( );
177
- }
178
-
179
- showDropDown( ) {
180
- if( this.isDisabled() ) {
181
- return;
182
- }
183
-
184
- const rc = this._edit.getBoundingRect( );
185
- this._dropdown.setStyleValue( "width", rc.width+"px" );
186
- this._dropdown.displayNear( rc, "top left", "bottom left", {x:0,y:6} );
187
- }
188
- }
189
-
190
-
@@ -1,4 +0,0 @@
1
- <svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd">
3
- </path>
4
- </svg>
@@ -1,71 +0,0 @@
1
- /**
2
- * ___ ___ __
3
- * \ \/ / / _
4
- * \ / /_| |_
5
- * / \____ _|
6
- * /__/\__\ |_|
7
- *
8
- * @file dialog.scss
9
- * @author Etienne Cochard
10
- *
11
- * @copyright (c) 2024 R-libre ingenierie
12
- *
13
- * Use of this source code is governed by an MIT-style license
14
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
- **/
16
-
17
- @import "../shared.scss";
18
-
19
- :root {
20
- --color-dialog-caption: var( --color-primary-a80 );
21
- --color-dialog-caption-text: var( --color-primary-a0 );
22
- }
23
-
24
- .x4dialog {
25
- @extend .shadow-xl, .vbox;
26
-
27
- position: absolute;
28
- background-color: white;
29
- border: 1px solid var( --border-dark );
30
- min-width: min-content;
31
- min-height: min-content;
32
-
33
- &> .caption {
34
- padding: 8px;
35
- background-color: var(--color-dialog-caption);
36
-
37
- & > #title {
38
- @extend .flex;
39
- color: var(--color-dialog-caption-text);
40
- font-weight: bold;
41
- }
42
-
43
- & > #closebox {
44
- margin: 0;
45
- padding: 4px;
46
- }
47
- }
48
-
49
- &> .form {
50
- min-height: 128px;
51
- min-width: 450px;
52
- }
53
-
54
- &> #btnbar {
55
- border-top: 1px solid var( --color-separation );
56
- padding: 6px 16px;
57
-
58
- justify-content: end;
59
- gap: 8px;
60
-
61
- &> .x4button {
62
- min-width: 80px;
63
-
64
- .x-simple-label {
65
- text-align: center;
66
- }
67
-
68
- }
69
- }
70
- }
71
-
@@ -1,91 +0,0 @@
1
- /**
2
- * ___ ___ __
3
- * \ \/ / / _
4
- * \ / /_| |_
5
- * / \____ _|
6
- * /__/\__\ |_|
7
- *
8
- * @file dialog.ts
9
- * @author Etienne Cochard
10
- *
11
- * @copyright (c) 2024 R-libre ingenierie
12
- *
13
- * Use of this source code is governed by an MIT-style license
14
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
- **/
16
-
17
- import { Form } from "../form/form.js"
18
- import { PopupEvents, PopupProps, Popup } from '../popup/popup.js';
19
- import { BtnGroup, BtnGroupItem } from "../btngroup/btngroup"
20
- import { HBox } from '../boxes/boxes.js';
21
- import { Label } from '../label/label.js';
22
- import { ComponentContent, ComponentEvent } from '@core/component.js';
23
- import { Button } from '../button/button.js';
24
-
25
- import "./dialog.module.scss"
26
- import close_icon from "./xmark-sharp-light.svg";
27
-
28
- export interface DialogProps extends PopupProps {
29
- icon?: string;
30
- title: string;
31
- form: Form;
32
- buttons: BtnGroupItem[];
33
- closable?: boolean;
34
- }
35
-
36
-
37
- export interface EvBtnClick extends Event {
38
- button: string;
39
- }
40
-
41
- interface DialogEvents extends PopupEvents {
42
- btnclick: EvBtnClick;
43
- close: ComponentEvent;
44
- }
45
-
46
- /**
47
- *
48
- */
49
-
50
- export class Dialog<P extends DialogProps = DialogProps, E extends DialogEvents = DialogEvents> extends Popup<P,E> {
51
-
52
- constructor( props: P ) {
53
- super( props );
54
-
55
- this.appendContent( [
56
- new HBox( {
57
- cls: "caption",
58
- content: [
59
- new Label( {
60
- id: "title",
61
- cls: "caption-element",
62
- icon: props.icon,
63
- text: props.title
64
- } ),
65
- props.closable ? new Button( {
66
- id: "closebox",
67
- icon: close_icon,
68
- click: ( ) => { this.close() }
69
- } ) : null,
70
- ]
71
- }),
72
- props.form,
73
- new BtnGroup( {
74
- id: "btnbar",
75
- reverse: true,
76
- items: props.buttons,
77
- btnclick: ( ev ) => { this.fire( "btnclick", ev ) }
78
- })
79
- ])
80
- }
81
-
82
- display( ) {
83
- super.displayCenter( );
84
- }
85
-
86
- override close( ) {
87
- this.fire( "close", {} );
88
- super.close( );
89
- }
90
- }
91
-
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="currentColor"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M192 233.4L59.5 100.9 36.9 123.5 169.4 256 36.9 388.5l22.6 22.6L192 278.6 324.5 411.1l22.6-22.6L214.6 256 347.1 123.5l-22.6-22.6L192 233.4z"/></svg>
@@ -1,34 +0,0 @@
1
- /**
2
- * ___ ___ __
3
- * \ \/ / / _
4
- * \ / /_| |_
5
- * / \____ _|
6
- * /__/\__\ |_|
7
- *
8
- * @file form.module.scss
9
- * @author Etienne Cochard
10
- *
11
- * @copyright (c) 2024 R-libre ingenierie
12
- *
13
- * Use of this source code is governed by an MIT-style license
14
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
- **/
16
-
17
- @use "../shared.scss";
18
-
19
- :root {
20
- --form--background: var( --background-primary );
21
- }
22
-
23
- .x4form {
24
- @extend .vbox;
25
- @extend .flex;
26
-
27
- padding: 16px;
28
- background-color: var( --color-form );
29
-
30
- &>.xcontainer {
31
-
32
- }
33
- }
34
-
@@ -1,36 +0,0 @@
1
- /**
2
- * ___ ___ __
3
- * \ \/ / / _
4
- * \ / /_| |_
5
- * / \____ _|
6
- * /__/\__\ |_|
7
- *
8
- * @file form.ts
9
- * @author Etienne Cochard
10
- *
11
- * @copyright (c) 2024 R-libre ingenierie
12
- *
13
- * Use of this source code is governed by an MIT-style license
14
- * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
- **/
16
-
17
- import { Box } from '../boxes/boxes.js';
18
-
19
- import "./form.module.scss"
20
-
21
- type FormValue = string | number | boolean;
22
- type FormValues = Record<string,FormValue>;
23
-
24
- export class Form extends Box {
25
-
26
- setValues( values: FormValues ) {
27
- const items = this.queryAll( "input[name]" );
28
- console.log( items );
29
- }
30
-
31
- getValues( ): FormValues {
32
- const result: FormValues = {};
33
- return result;
34
- }
35
- }
36
-
@@ -1,40 +0,0 @@
1
- @use "../shared.scss";
2
-
3
- :root {
4
- --header-background-hover: rgba(100,100,100,0.1);
5
- --header-sizer-hover: var( --border-hover );
6
- }
7
-
8
- .x4header {
9
- @extend .flex;
10
- width: 100%;
11
-
12
- overflow: hidden;
13
- min-height: 2em;
14
- border-bottom: 1px solid var( --border );
15
-
16
-
17
- .cell {
18
- border-bottom: 1px solid transparent;
19
- overflow: hidden;
20
- min-width: 3rem;
21
-
22
- transition: border-color 0.5s ease;
23
- padding: 4px;
24
-
25
- span {
26
- white-space: nowrap;
27
- text-overflow: ellipsis;
28
- overflow: hidden;
29
- }
30
-
31
- &:hover {
32
- background-color: var( --header-background-hover );
33
- }
34
-
35
- .x4csizer:hover {
36
- border-right: 1px solid var( --header-sizer-hover );
37
- }
38
- }
39
-
40
- }
@@ -1,124 +0,0 @@
1
- import { Component, ComponentProps } from '@core/component.js';
2
- import { HBox } from '../boxes/boxes.js';
3
- import { Label } from '../label/label.js';
4
- import { CSizer } from '../sizers/sizer.js';
5
-
6
- import "./header.module.scss"
7
-
8
- interface HeaderItem {
9
- name: string;
10
- title: string;
11
- iconId?: string;
12
- width?: number; // <0 for flex
13
- }
14
-
15
- interface HeaderProps extends Omit<ComponentProps,"content"> {
16
- items: HeaderItem[]
17
- }
18
-
19
- export class Header extends HBox<HeaderProps> {
20
-
21
- private _els: Component[];
22
- private _vwp: Component;
23
-
24
- constructor( props: HeaderProps ) {
25
- super( props );
26
-
27
- this._els = props.items?.map( x => {
28
- const cell = new Label( { cls: "cell", text: x.title, icon: x.iconId } );
29
- const sizer = new CSizer( "right" );
30
-
31
- if( x.width>0 ) {
32
- cell.setStyleValue( "width", x.width+'px' );
33
- cell.setInternalData( "width", x.width );
34
- }
35
- else if( x.width<0 ) {
36
- cell.setInternalData( "flex", -x.width );
37
- }
38
- else {
39
- cell.setInternalData( "width", 0 );
40
- }
41
-
42
- sizer.addDOMEvent( "dblclick", ( e: MouseEvent ) => {
43
- cell.setInternalData( "flex", 1 );
44
- this._calc_sizes( );
45
- })
46
-
47
- sizer.on( "resize", ( ev ) => {
48
- //cell.setStyleValue( "flexGrow", "0" );
49
- cell.setInternalData("flex",0);
50
- cell.setInternalData("width",ev.size);
51
- this._calc_sizes( );
52
- });
53
-
54
- cell.appendContent( sizer );
55
- cell.setInternalData( "data", x );
56
-
57
- return cell;
58
- });
59
-
60
- this.addDOMEvent( "resized", ( ) => this._on_resize() );
61
- this.addDOMEvent( "created", ( ) => this._calc_sizes( ) );
62
-
63
- this._vwp = new HBox( { content: this._els } );
64
- this.setContent( this._vwp );
65
- }
66
-
67
- private _calc_sizes( ) {
68
-
69
- let count = 0;
70
- let filled = 0;
71
-
72
- this._els.forEach( c => {
73
- const flex = c.getInternalData( "flex" );
74
- if( flex ) {
75
- count += flex;
76
- }
77
- else {
78
- let width = c.getInternalData( "width" );
79
- if( width==0 ) {
80
- const rc = c.getBoundingRect( );
81
- width = Math.ceil( rc.width )+2;
82
- c.setInternalData( "width", width );
83
- }
84
-
85
- filled += width;
86
- }
87
- } );
88
-
89
- const rc = this.getBoundingRect( );
90
-
91
- let rest = (rc.width-filled);
92
- const unit = Math.ceil( rest/count );
93
-
94
- console.log( "filled", filled );
95
- console.log( "count", count );
96
- console.log( "rest", rest );
97
- console.log( "unit", unit );
98
-
99
- let fullw = 0;
100
- this._els.forEach( c => {
101
- let width = 0;
102
-
103
- const flex = c.getInternalData( "flex" );
104
- if( flex ) {
105
- width = Math.min( unit*flex, rest );
106
- rest -= width;
107
- }
108
- else {
109
- width = c.getInternalData( "width" );
110
- }
111
-
112
- c.setWidth( width );
113
- fullw += width;
114
- } );
115
-
116
- this._vwp.setWidth( fullw );
117
- }
118
-
119
- private _on_resize( ) {
120
- this._calc_sizes( );
121
- }
122
-
123
-
124
- }