x4js 2.0.18 → 2.0.21

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 (201) hide show
  1. package/README.md +1 -0
  2. package/lib/cjs/x4.css +1 -1
  3. package/lib/cjs/x4.js +2 -2
  4. package/lib/esm/x4.css +1 -1
  5. package/lib/esm/x4.mjs +2 -2
  6. package/lib/styles/x4.css +1 -1
  7. package/lib/types/x4js.d.ts +92 -77
  8. package/package.json +1 -1
  9. package/src/components/boxes/boxes.ts +35 -3
  10. package/src/components/breadcrumb/breadcrumb.ts +4 -4
  11. package/src/components/btngroup/btngroup.ts +4 -4
  12. package/src/components/button/button.ts +2 -2
  13. package/src/components/calendar/calendar.ts +1 -1
  14. package/src/components/canvas/canvas.ts +2 -2
  15. package/src/components/checkbox/checkbox.ts +4 -4
  16. package/src/components/colorinput/colorinput.ts +3 -3
  17. package/src/components/combobox/combobox.module.scss +13 -0
  18. package/src/components/combobox/combobox.ts +10 -3
  19. package/src/components/dialog/dialog.ts +7 -7
  20. package/src/components/form/form.ts +5 -5
  21. package/src/components/gridview/gridview.ts +12 -9
  22. package/src/components/header/header.module.scss +2 -1
  23. package/src/components/header/header.ts +22 -10
  24. package/src/components/icon/icon.module.scss +1 -0
  25. package/src/components/icon/icon.ts +1 -1
  26. package/src/components/image/image.ts +3 -3
  27. package/src/components/input/input.ts +2 -2
  28. package/src/components/keyboard/keyboard.ts +5 -5
  29. package/src/components/label/label.module.scss +6 -1
  30. package/src/components/label/label.ts +1 -1
  31. package/src/components/listbox/listbox.module.scss +35 -31
  32. package/src/components/listbox/listbox.ts +53 -15
  33. package/src/components/messages/messages.ts +15 -1
  34. package/src/components/notification/notification.ts +8 -8
  35. package/src/components/popup/popup.ts +14 -3
  36. package/src/components/progress/progress.ts +1 -1
  37. package/src/components/propgrid/propgrid.ts +5 -3
  38. package/src/components/radio/radio.ts +2 -2
  39. package/src/components/rating/rating.ts +6 -6
  40. package/src/components/select/select.ts +1 -1
  41. package/src/components/sizers/sizer.ts +5 -5
  42. package/src/components/slider/slider.ts +3 -3
  43. package/src/components/switch/switch.ts +3 -3
  44. package/src/components/tabs/tabs.module.scss +2 -2
  45. package/src/components/tabs/tabs.ts +29 -5
  46. package/src/components/textarea/textarea.ts +1 -1
  47. package/src/components/textedit/textedit.ts +2 -2
  48. package/src/components/tickline/tickline.ts +1 -1
  49. package/src/components/tooltips/tooltips.ts +2 -2
  50. package/src/components/treeview/treeview.module.scss +9 -1
  51. package/src/components/treeview/treeview.ts +53 -14
  52. package/src/components/viewport/viewport.ts +1 -1
  53. package/src/core/component.ts +46 -9
  54. package/src/core/core_application.ts +3 -3
  55. package/src/core/core_data.ts +12 -12
  56. package/src/core/core_element.ts +1 -1
  57. package/src/core/core_react.ts +2 -2
  58. package/src/core/core_router.ts +2 -2
  59. package/src/core/core_state.ts +1 -1
  60. package/src/core/core_styles.ts +1 -1
  61. package/src/core/core_tools.ts +2 -0
  62. package/lib/src/components/base.scss +0 -25
  63. package/lib/src/components/boxes/boxes.module.scss +0 -54
  64. package/lib/src/components/boxes/boxes.ts +0 -370
  65. package/lib/src/components/breadcrumb/breadcrumb.scss +0 -56
  66. package/lib/src/components/breadcrumb/breadcrumb.ts +0 -93
  67. package/lib/src/components/breadcrumb/chevron-right.svg +0 -1
  68. package/lib/src/components/btngroup/btngroup.module.scss +0 -41
  69. package/lib/src/components/btngroup/btngroup.ts +0 -153
  70. package/lib/src/components/button/button.module.scss +0 -173
  71. package/lib/src/components/button/button.ts +0 -185
  72. package/lib/src/components/calendar/calendar-check-sharp-light.svg +0 -1
  73. package/lib/src/components/calendar/calendar.module.scss +0 -163
  74. package/lib/src/components/calendar/calendar.ts +0 -327
  75. package/lib/src/components/calendar/chevron-left-sharp-light.svg +0 -1
  76. package/lib/src/components/calendar/chevron-right-sharp-light.svg +0 -1
  77. package/lib/src/components/canvas/canvas.module.scss +0 -25
  78. package/lib/src/components/canvas/canvas.ts +0 -189
  79. package/lib/src/components/canvas/canvas_ex.ts +0 -276
  80. package/lib/src/components/checkbox/check.svg +0 -4
  81. package/lib/src/components/checkbox/checkbox.module.scss +0 -142
  82. package/lib/src/components/checkbox/checkbox.ts +0 -140
  83. package/lib/src/components/colorinput/colorinput.module.scss +0 -65
  84. package/lib/src/components/colorinput/colorinput.ts +0 -91
  85. package/lib/src/components/colorinput/crosshairs-simple-sharp-light.svg +0 -1
  86. package/lib/src/components/colorpicker/colorpicker.module.scss +0 -133
  87. package/lib/src/components/colorpicker/colorpicker.ts +0 -482
  88. package/lib/src/components/combobox/combobox.module.scss +0 -133
  89. package/lib/src/components/combobox/combobox.ts +0 -275
  90. package/lib/src/components/combobox/updown.svg +0 -4
  91. package/lib/src/components/components.ts +0 -42
  92. package/lib/src/components/dialog/dialog.module.scss +0 -104
  93. package/lib/src/components/dialog/dialog.ts +0 -229
  94. package/lib/src/components/dialog/xmark-sharp-light.svg +0 -1
  95. package/lib/src/components/filedrop/cloud-arrow-up.svg +0 -1
  96. package/lib/src/components/filedrop/filedrop.module.scss +0 -70
  97. package/lib/src/components/filedrop/filedrop.ts +0 -131
  98. package/lib/src/components/form/form.module.scss +0 -38
  99. package/lib/src/components/form/form.ts +0 -172
  100. package/lib/src/components/gridview/arrow-down-light.svg +0 -1
  101. package/lib/src/components/gridview/arrow-up-light.svg +0 -1
  102. package/lib/src/components/gridview/gridview.module.scss +0 -324
  103. package/lib/src/components/gridview/gridview.ts +0 -1175
  104. package/lib/src/components/header/header.module.scss +0 -40
  105. package/lib/src/components/header/header.ts +0 -130
  106. package/lib/src/components/icon/icon.module.scss +0 -31
  107. package/lib/src/components/icon/icon.ts +0 -137
  108. package/lib/src/components/image/image.module.scss +0 -28
  109. package/lib/src/components/image/image.ts +0 -168
  110. package/lib/src/components/input/input.module.scss +0 -74
  111. package/lib/src/components/input/input.ts +0 -422
  112. package/lib/src/components/keyboard/arrow-up.svg +0 -1
  113. package/lib/src/components/keyboard/delete-left.svg +0 -1
  114. package/lib/src/components/keyboard/eye-slash.svg +0 -1
  115. package/lib/src/components/keyboard/keyboard.module.scss +0 -134
  116. package/lib/src/components/keyboard/keyboard.ts +0 -526
  117. package/lib/src/components/label/label.module.scss +0 -76
  118. package/lib/src/components/label/label.ts +0 -97
  119. package/lib/src/components/link/link.ts +0 -81
  120. package/lib/src/components/listbox/listbox.module.scss +0 -161
  121. package/lib/src/components/listbox/listbox.ts +0 -539
  122. package/lib/src/components/menu/caret-right-solid.svg +0 -1
  123. package/lib/src/components/menu/menu.module.scss +0 -117
  124. package/lib/src/components/menu/menu.ts +0 -174
  125. package/lib/src/components/messages/circle-exclamation.svg +0 -1
  126. package/lib/src/components/messages/messages.module.scss +0 -92
  127. package/lib/src/components/messages/messages.ts +0 -215
  128. package/lib/src/components/messages/pen-field.svg +0 -1
  129. package/lib/src/components/normalize.scss +0 -391
  130. package/lib/src/components/notification/circle-check-solid.svg +0 -1
  131. package/lib/src/components/notification/circle-exclamation-solid.svg +0 -1
  132. package/lib/src/components/notification/circle-notch-light.svg +0 -1
  133. package/lib/src/components/notification/notification.module.scss +0 -84
  134. package/lib/src/components/notification/notification.ts +0 -107
  135. package/lib/src/components/notification/xmark-sharp-light.svg +0 -1
  136. package/lib/src/components/panel/panel.module.scss +0 -60
  137. package/lib/src/components/panel/panel.ts +0 -58
  138. package/lib/src/components/popup/popup.module.scss +0 -51
  139. package/lib/src/components/popup/popup.ts +0 -442
  140. package/lib/src/components/progress/progress.module.scss +0 -57
  141. package/lib/src/components/progress/progress.ts +0 -44
  142. package/lib/src/components/propgrid/folder-closed.svg +0 -1
  143. package/lib/src/components/propgrid/folder-open.svg +0 -1
  144. package/lib/src/components/propgrid/progrid.module.scss +0 -112
  145. package/lib/src/components/propgrid/propgrid.ts +0 -288
  146. package/lib/src/components/propgrid/updown.svg +0 -4
  147. package/lib/src/components/radio/radio.module.scss +0 -147
  148. package/lib/src/components/radio/radio.svg +0 -4
  149. package/lib/src/components/radio/radio.ts +0 -142
  150. package/lib/src/components/rating/rating.module.scss +0 -23
  151. package/lib/src/components/rating/rating.ts +0 -131
  152. package/lib/src/components/rating/star-sharp-light.svg +0 -1
  153. package/lib/src/components/rating/star-sharp-solid.svg +0 -1
  154. package/lib/src/components/select/select.module.scss +0 -9
  155. package/lib/src/components/select/select.ts +0 -134
  156. package/lib/src/components/shared.scss +0 -137
  157. package/lib/src/components/sizers/sizer.module.scss +0 -90
  158. package/lib/src/components/sizers/sizer.ts +0 -132
  159. package/lib/src/components/slider/slider.module.scss +0 -118
  160. package/lib/src/components/slider/slider.ts +0 -198
  161. package/lib/src/components/switch/switch.module.scss +0 -127
  162. package/lib/src/components/switch/switch.ts +0 -62
  163. package/lib/src/components/tabs/tabs.module.scss +0 -45
  164. package/lib/src/components/tabs/tabs.ts +0 -205
  165. package/lib/src/components/textarea/textarea.module.scss +0 -63
  166. package/lib/src/components/textarea/textarea.ts +0 -125
  167. package/lib/src/components/textedit/textedit.module.scss +0 -116
  168. package/lib/src/components/textedit/textedit.ts +0 -115
  169. package/lib/src/components/themes.scss +0 -88
  170. package/lib/src/components/tickline/tickline.module.scss +0 -26
  171. package/lib/src/components/tickline/tickline.ts +0 -82
  172. package/lib/src/components/tooltips/circle-info-sharp-light.svg +0 -1
  173. package/lib/src/components/tooltips/comments-question.svg +0 -1
  174. package/lib/src/components/tooltips/tooltips.scss +0 -72
  175. package/lib/src/components/tooltips/tooltips.ts +0 -109
  176. package/lib/src/components/treeview/chevron-down-light.svg +0 -1
  177. package/lib/src/components/treeview/treeview.module.scss +0 -185
  178. package/lib/src/components/treeview/treeview.ts +0 -445
  179. package/lib/src/components/viewport/viewport.module.scss +0 -32
  180. package/lib/src/components/viewport/viewport.ts +0 -41
  181. package/lib/src/core/component.ts +0 -1066
  182. package/lib/src/core/core_application.ts +0 -265
  183. package/lib/src/core/core_colors.ts +0 -250
  184. package/lib/src/core/core_data.ts +0 -1310
  185. package/lib/src/core/core_dom.ts +0 -471
  186. package/lib/src/core/core_dragdrop.ts +0 -201
  187. package/lib/src/core/core_element.ts +0 -115
  188. package/lib/src/core/core_events.ts +0 -177
  189. package/lib/src/core/core_i18n.ts +0 -393
  190. package/lib/src/core/core_react.ts +0 -79
  191. package/lib/src/core/core_router.ts +0 -237
  192. package/lib/src/core/core_state.ts +0 -62
  193. package/lib/src/core/core_styles.ts +0 -214
  194. package/lib/src/core/core_svg.ts +0 -712
  195. package/lib/src/core/core_tools.ts +0 -906
  196. package/lib/src/types/scss.d.ts +0 -4
  197. package/lib/src/types/svg.d.ts +0 -1
  198. package/lib/src/types/x4react.d.ts +0 -9
  199. package/lib/src/x4.scss +0 -19
  200. package/lib/src/x4.ts +0 -35
  201. package/lib/src/x4tsx.d.ts +0 -25
@@ -14,11 +14,11 @@
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
15
  **/
16
16
 
17
- import { asap, class_ns, isArray, isNumber, isString } from '@core/core_tools.js';
17
+ import { asap, class_ns, isArray, isNumber, isString } from '../../core/core_tools';
18
18
  import { Component, ComponentContent, ComponentEvents, ComponentProps, EvSelectionChange } from "../../core/component"
19
19
 
20
20
  import "./boxes.module.scss";
21
- import { EventCallback } from '@core/core_events.js';
21
+ import { EventCallback } from '../../core/core_events';
22
22
 
23
23
  export interface BoxProps extends ComponentProps {
24
24
  tag?: string;
@@ -122,6 +122,18 @@ export class StackBox<P extends StackBoxProps = StackBoxProps, E extends StackeB
122
122
  });
123
123
  }
124
124
 
125
+ removeItem( name: string ) {
126
+ const index = this._items.findIndex( x => x.name==name );
127
+ if( index>=0 ) {
128
+ const pg = this._items[index];
129
+ if( pg?.page ) {
130
+ this.removeChild( pg.page );
131
+ }
132
+
133
+ this._items.splice( index, 1 );
134
+ }
135
+ }
136
+
125
137
  select( name: string ) {
126
138
  let sel = this.query( `:scope > .selected` );
127
139
  if( sel ) {
@@ -143,7 +155,7 @@ export class StackBox<P extends StackBoxProps = StackBoxProps, E extends StackeB
143
155
  sel.setClass( "selected", true );
144
156
  }
145
157
 
146
- asap( ( ) => this.fire( "pageChange", { selection: pg.name, empty: !sel } ) );
158
+ asap( ( ) => this.fire( "pageChange", { selection: [pg.name], empty: !sel } ) );
147
159
  }
148
160
 
149
161
  return pg?.page;
@@ -177,6 +189,26 @@ export class StackBox<P extends StackBoxProps = StackBoxProps, E extends StackeB
177
189
  return pg ? pg.content : null;
178
190
  }
179
191
 
192
+ /**
193
+ *
194
+ */
195
+
196
+ getPageCount( ) {
197
+ return this._items.length;
198
+ }
199
+
200
+ /**
201
+ *
202
+ */
203
+
204
+ enumPageNames( ) {
205
+ return this._items.map( x => x.name );
206
+ }
207
+
208
+ /**
209
+ *
210
+ */
211
+
180
212
  getItem( name: string ) {
181
213
  const pg = this._items.find( x => x.name==name );
182
214
  return pg;
@@ -14,12 +14,12 @@
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
15
  **/
16
16
 
17
- import { class_ns } from '@core/core_tools.js';
18
- import { parseRoute, Router } from '@core/core_router.js';
17
+ import { class_ns } from '../../core/core_tools';
18
+ import { parseRoute, Router } from '../../core/core_router';
19
19
 
20
20
  import { BoxProps, Button, HBox, Icon } from '../components';
21
- import { Component, ComponentEvents, EvClick } from '@core/component.js';
22
- import { EventCallback } from '@core/core_events.js';
21
+ import { Component, ComponentEvents, EvClick } from '../../core/component';
22
+ import { EventCallback } from '../../core/core_events';
23
23
 
24
24
  import "./breadcrumb.scss"
25
25
 
@@ -20,12 +20,12 @@ import { class_ns, isString } from '../../core/core_tools';
20
20
  import { _tr } from '../../core/core_i18n'
21
21
 
22
22
  import { Button } from '../button/button';
23
- import { Box } from '../boxes/boxes.js';
24
- import { Label } from '../label/label.js';
25
- import { EvBtnClick } from '../dialog/dialog.js';
23
+ import { Box } from '../boxes/boxes';
24
+ import { Label } from '../label/label';
25
+ import { EvBtnClick } from '../dialog/dialog';
26
26
 
27
27
  import "./btngroup.module.scss"
28
- import { Input } from '../components.js';
28
+ import { Input } from '../components';
29
29
 
30
30
  /**
31
31
  * accept "ok" or "ok.<classname>"
@@ -15,8 +15,8 @@
15
15
  **/
16
16
 
17
17
  import { Component, ComponentEvents, ComponentProps, EvClick } from "../../core/component"
18
- import { EventCallback } from '../../core/core_events.js';
19
- import { class_ns, UnsafeHtml } from '../../core/core_tools.js';
18
+ import { EventCallback } from '../../core/core_events';
19
+ import { class_ns, UnsafeHtml } from '../../core/core_tools';
20
20
 
21
21
  import { Icon } from "../icon/icon"
22
22
 
@@ -17,7 +17,7 @@
17
17
  import { Component, ComponentEvents, ComponentProps, EvChange, Flex } from '../../core/component'
18
18
  import { class_ns, date_clone, date_hash, formatIntlDate, Point, unsafeHtml } from "../../core/core_tools"
19
19
  import { _tr } from '../../core/core_i18n';
20
- import { EventCallback } from '../../core/core_events.js';
20
+ import { EventCallback } from '../../core/core_events';
21
21
 
22
22
  import { Button } from '../button/button';
23
23
  import { Label } from '../label/label';
@@ -14,10 +14,10 @@
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
15
  **/
16
16
 
17
- import { class_ns } from '@core/core_tools.js';
17
+ import { class_ns } from '../../core/core_tools';
18
18
  import { Component, ComponentEvent, ComponentEvents, ComponentProps } from '../../core/component';
19
19
  import { EventCallback } from "../../core/core_events"
20
- import { CanvasEx, createPainter } from './canvas_ex.js';
20
+ import { CanvasEx, createPainter } from './canvas_ex';
21
21
 
22
22
  import './canvas.module.scss'
23
23
 
@@ -1,14 +1,14 @@
1
- import { Component, ComponentEvents, ComponentProps, EvChange, makeUniqueComponentId } from '../../core/component.js';
2
- import { EventCallback } from '../../core/core_events.js';
1
+ import { Component, ComponentEvents, ComponentProps, EvChange, makeUniqueComponentId } from '../../core/component';
2
+ import { EventCallback } from '../../core/core_events';
3
3
 
4
4
  import { Input } from '../input/input';
5
5
  import { Label } from '../label/label';
6
6
 
7
- import { svgLoader } from '../icon/icon.js';
7
+ import { svgLoader } from '../icon/icon';
8
8
 
9
9
  import "./checkbox.module.scss"
10
10
  import icon from "./check.svg";
11
- import { class_ns } from '@core/core_tools.js';
11
+ import { class_ns } from '../../core/core_tools';
12
12
 
13
13
  /**
14
14
  * Checkbox events
@@ -15,12 +15,12 @@
15
15
  **/
16
16
 
17
17
  import { Component } from '../../core/component';
18
- import { isFeatureAvailable, class_ns } from '../../core/core_tools.js';
18
+ import { isFeatureAvailable, class_ns } from '../../core/core_tools';
19
19
  import { Color } from '../../core/core_colors';
20
20
 
21
21
  import { BoxProps, HBox } from '../boxes/boxes';
22
- import { Input } from '../input/input.js';
23
- import { Button } from '../button/button.js';
22
+ import { Input } from '../input/input';
23
+ import { Button } from '../button/button';
24
24
 
25
25
 
26
26
  import "./colorinput.module.scss"
@@ -26,6 +26,8 @@
26
26
  --combobox-btn-background: inherit;
27
27
  --combobox-btn-color: var( --text-secondary );
28
28
  --combobox-btn-color-hover: var( --text-primary );
29
+
30
+ --combo-tree-indent: 1em;
29
31
  }
30
32
 
31
33
  .x4dropdownlist {
@@ -33,6 +35,8 @@
33
35
  @extend .hbox;
34
36
 
35
37
  max-height: 250px;
38
+ max-width: 50vw;
39
+
36
40
  position: absolute;
37
41
  background-color: var( --dropdown-background );
38
42
  border: 1px solid var( --dropdown-border );
@@ -47,6 +51,15 @@
47
51
 
48
52
  .x4item {
49
53
  white-space: nowrap;
54
+
55
+ &.level-1 { padding-left: calc(var(--combo-tree-indent) * 1 ); }
56
+ &.level-2 { padding-left: calc(var(--combo-tree-indent) * 2 ); }
57
+ &.level-3 { padding-left: calc(var(--combo-tree-indent) * 3 ); }
58
+ &.level-4 { padding-left: calc(var(--combo-tree-indent) * 4 ); }
59
+ &.level-5 { padding-left: calc(var(--combo-tree-indent) * 5 ); }
60
+ &.level-6 { padding-left: calc(var(--combo-tree-indent) * 6 ); }
61
+ &.level-7 { padding-left: calc(var(--combo-tree-indent) * 7 ); }
62
+ &.level-8 { padding-left: calc(var(--combo-tree-indent) * 8 ); }
50
63
  }
51
64
  }
52
65
  }
@@ -15,11 +15,11 @@
15
15
  **/
16
16
 
17
17
  import { Component, ComponentEvents, ComponentProps, EvSelectionChange, makeUniqueComponentId } from '../../core/component';
18
- import { class_ns, IComponentInterface, IFormElement, kbNav } from '@core/core_tools';
19
- import { EventCallback } from '@core/core_events';
18
+ import { class_ns, IComponentInterface, IFormElement, kbNav } from '../../core/core_tools';
19
+ import { EventCallback } from '../../core/core_events';
20
20
 
21
21
  import { Listbox, ListboxID, ListItem } from '../listbox/listbox';
22
- import { Popup, PopupEvents, PopupProps } from '../popup/popup.js';
22
+ import { Popup, PopupEvents, PopupProps } from '../popup/popup';
23
23
  import { Label } from '../label/label';
24
24
  import { Input } from '../input/input';
25
25
  import { Button } from '../button/button';
@@ -128,6 +128,9 @@ export class Combobox extends Component<ComboboxProps,ComboboxEvents> {
128
128
 
129
129
  const _select = ( sel: ListboxID ) => {
130
130
  const itm = list.getItem(sel);
131
+ if( itm ) {
132
+ list.select( sel, false );
133
+ }
131
134
 
132
135
  //TODO: unsafehtml
133
136
  //@ts-ignore
@@ -270,6 +273,10 @@ export class Combobox extends Component<ComboboxProps,ComboboxEvents> {
270
273
 
271
274
  return super.queryInterface( name );
272
275
  }
276
+
277
+ getInput( ) {
278
+ return this._input;
279
+ }
273
280
  }
274
281
 
275
282
 
@@ -15,14 +15,14 @@
15
15
  **/
16
16
 
17
17
  import { Form } from "../form/form.js"
18
- import { PopupEvents, PopupProps, Popup } from '../popup/popup.js';
18
+ import { PopupEvents, PopupProps, Popup } from '../popup/popup';
19
19
  import { BtnGroup, BtnGroupItem } from "../btngroup/btngroup"
20
- import { HBox } from '../boxes/boxes.js';
21
- import { Label } from '../label/label.js';
22
- import { CoreEvent, EventCallback } from '@core/core_events.js';
23
- import { class_ns, getFocusableElements, IComponentInterface, isString, ITabHandler } from '@core/core_tools.js';
24
- import { ComponentEvent } from '../../core/component.js';
25
- import { Button } from '../button/button.js';
20
+ import { HBox } from '../boxes/boxes';
21
+ import { Label } from '../label/label';
22
+ import { CoreEvent, EventCallback } from '../../core/core_events';
23
+ import { class_ns, getFocusableElements, IComponentInterface, isString, ITabHandler } from '../../core/core_tools';
24
+ import { ComponentEvent } from '../../core/component';
25
+ import { Button } from '../button/button';
26
26
 
27
27
  import "./dialog.module.scss"
28
28
  import close_icon from "./xmark-sharp-light.svg";
@@ -14,13 +14,13 @@
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
15
  **/
16
16
 
17
- import { class_ns, IFormElement } from '@core/core_tools.js';
17
+ import { class_ns, IFormElement } from '../../core/core_tools';
18
18
  import { Box, BoxProps } from '../boxes/boxes';
19
19
 
20
20
  import "./form.module.scss"
21
21
 
22
22
  //type FormValue = string | number | boolean;
23
- export type FormValues = Record<string,string>;
23
+ export type FormValues = Record<string,any>;
24
24
 
25
25
  export interface FormProps extends BoxProps {
26
26
  autoComplete?: boolean;
@@ -81,8 +81,8 @@ export class Form<P extends FormProps = FormProps> extends Box<P> {
81
81
  *
82
82
  */
83
83
 
84
- getValues( ): FormValues {
85
- const result: FormValues = {}
84
+ getValues<T extends FormValues = FormValues>( ): T {
85
+ const result: any = {}
86
86
  const items = this._get_inputs( );
87
87
 
88
88
  items.forEach( x => {
@@ -94,7 +94,7 @@ export class Form<P extends FormProps = FormProps> extends Box<P> {
94
94
  }
95
95
  });
96
96
 
97
- return result;
97
+ return result as T;
98
98
  }
99
99
 
100
100
  /**
@@ -17,7 +17,7 @@
17
17
 
18
18
  import { Component, ComponentContent, ComponentEvents, ComponentProps, EvClick, EvContextMenu, EvDblClick, EvSelectionChange, componentFromDOM } from '../../core/component';
19
19
  import { class_ns, isNumber, isString, setWaitCursor } from '../../core/core_tools';
20
- import { DataModel, DataStore, DataView, DataRecord, DataFieldValue, EvViewChange } from '../../core/core_data';
20
+ import { DataModel, DataStore, DataView, DataRecord, EvViewChange } from '../../core/core_data';
21
21
  import { EventCallback } from '../../core/core_events';
22
22
  import { kbNav } from '../../core/core_tools';
23
23
 
@@ -43,7 +43,7 @@ const SCROLL_LIMIT = 200;
43
43
  *
44
44
  */
45
45
 
46
- interface GridColumn {
46
+ export interface GridColumn {
47
47
  id: any;
48
48
  title: string;
49
49
  width: number;
@@ -499,14 +499,15 @@ export class Gridview<P extends GridviewProps = GridviewProps, E extends Gridvie
499
499
 
500
500
  private _sortCol(col: number, ascending?: boolean ) {
501
501
 
502
- setWaitCursor(true);
503
-
504
502
  // to allow cursor
505
503
  this.setTimeout("sort", 50, () => {
506
504
  let asc = true;
507
505
 
508
506
  // already sorted ?
509
- const scol = this.query(`.col-header [data-col="${col}"`);
507
+ const scol = this.query(`.col-header .cell[data-col="${col}"]`);
508
+ if( !scol ) {
509
+ return;
510
+ }
510
511
 
511
512
  if( ascending===undefined ) {
512
513
  if (scol.hasClass("sorted")) {
@@ -541,6 +542,8 @@ export class Gridview<P extends GridviewProps = GridviewProps, E extends Gridvie
541
542
  }
542
543
  }
543
544
 
545
+ setWaitCursor(true);
546
+
544
547
  this._dataview.sort([{
545
548
  field: cdata.id,
546
549
  ascending: asc,
@@ -828,7 +831,7 @@ export class Gridview<P extends GridviewProps = GridviewProps, E extends Gridvie
828
831
  }
829
832
  }
830
833
 
831
- const maxr = this._dataview.getCount();
834
+ const maxr = this._dataview ? this._dataview.getCount() : 0;
832
835
  let maxh = maxr;
833
836
 
834
837
  if (maxr < SCROLL_LIMIT) {
@@ -874,7 +877,7 @@ export class Gridview<P extends GridviewProps = GridviewProps, E extends Gridvie
874
877
 
875
878
  // WHEEL
876
879
  this.addDOMEvent("wheel", (ev: WheelEvent) => {
877
- if (ev.deltaY && this._dataview.getCount() >= SCROLL_LIMIT) {
880
+ if (ev.deltaY && this._dataview && this._dataview.getCount() >= SCROLL_LIMIT) {
878
881
  this._viewport.dom.scrollBy(0, ev.deltaY < 0 ? -1 : 1);
879
882
  ev.stopPropagation();
880
883
  ev.preventDefault();
@@ -1032,7 +1035,7 @@ export class Gridview<P extends GridviewProps = GridviewProps, E extends Gridvie
1032
1035
  const rc = this.getBoundingRect();
1033
1036
 
1034
1037
  // rows
1035
- const rowc = this._dataview.getCount();
1038
+ const rowc = this._dataview ? this._dataview.getCount() : 0;
1036
1039
  const mul = rowc < SCROLL_LIMIT ? this._row_height : 1;
1037
1040
 
1038
1041
  const start = Math.floor(this._top / mul);
@@ -1132,7 +1135,7 @@ export class Gridview<P extends GridviewProps = GridviewProps, E extends Gridvie
1132
1135
  });
1133
1136
 
1134
1137
  const rec = this._dataview.getByIndex( rowid );
1135
- this.fire("selectionChange", { selection: rec, empty: false } );
1138
+ this.fire("selectionChange", { selection: [rec], empty: false } );
1136
1139
  }
1137
1140
 
1138
1141
  /**
@@ -3,10 +3,10 @@
3
3
  :root {
4
4
  --header-background-hover: rgba(100,100,100,0.1);
5
5
  --header-sizer-hover: var( --border-hover );
6
+ --header-color: var( --text-primary );
6
7
  }
7
8
 
8
9
  .x4header {
9
- @extend .flex;
10
10
  width: 100%;
11
11
 
12
12
  overflow: hidden;
@@ -26,6 +26,7 @@
26
26
  white-space: nowrap;
27
27
  text-overflow: ellipsis;
28
28
  overflow: hidden;
29
+ color: var( --header-color );
29
30
  }
30
31
 
31
32
  &:hover {
@@ -1,8 +1,8 @@
1
- import { class_ns } from '@core/core_tools.js';
2
- import { Component, ComponentProps } from '../../core/component.js';
3
- import { HBox } from '../boxes/boxes.js';
4
- import { Label } from '../label/label.js';
5
- import { CSizer } from '../sizers/sizer.js';
1
+ import { class_ns } from '../../core/core_tools';
2
+ import { Component, ComponentProps } from '../../core/component';
3
+ import { HBox } from '../boxes/boxes';
4
+ import { Label } from '../label/label';
5
+ import { CSizer } from '../sizers/sizer';
6
6
 
7
7
  import "./header.module.scss"
8
8
 
@@ -15,10 +15,18 @@ interface HeaderItem {
15
15
 
16
16
  interface HeaderProps extends Omit<ComponentProps,"content"> {
17
17
  items: HeaderItem[]
18
+ target?: Component; // target element to set header col variable width var( --hdr-item-{name}-width )
18
19
  }
19
20
 
20
21
  /**
22
+ * by default when a header item is resized, the 'target' style '--{name}-width' is updated
23
+ * if you listbox has a header and 3 cols named A, B, C then in your css, use
21
24
  *
25
+ * .my-listbox {
26
+ * --A-width: 10px;
27
+ * --B-width: 50px;
28
+ * --C-width: 100px;
29
+ * }
22
30
  */
23
31
 
24
32
  @class_ns( "x4" )
@@ -94,13 +102,13 @@ export class Header extends HBox<HeaderProps> {
94
102
 
95
103
  const rc = this.getBoundingRect( );
96
104
 
97
- let rest = (rc.width-filled);
105
+ let rest = (rc.width-filled-10);
98
106
  const unit = Math.ceil( rest/count );
99
107
 
100
- console.log( "filled", filled );
101
- console.log( "count", count );
102
- console.log( "rest", rest );
103
- console.log( "unit", unit );
108
+ //console.log( "filled", filled );
109
+ //console.log( "count", count );
110
+ //console.log( "rest", rest );
111
+ //console.log( "unit", unit );
104
112
 
105
113
  let fullw = 0;
106
114
  this._els.forEach( c => {
@@ -116,6 +124,10 @@ export class Header extends HBox<HeaderProps> {
116
124
  }
117
125
 
118
126
  c.setWidth( width );
127
+
128
+ const item = c.getInternalData<HeaderItem>( 'data' );
129
+ this.props.target?.setStyleVariable( `--${item.name}-width`, width + "px");
130
+
119
131
  fullw += width;
120
132
  } );
121
133
 
@@ -19,6 +19,7 @@
19
19
  .x4icon {
20
20
  @extend .hbox;
21
21
 
22
+ flex-shrink: 0;
22
23
  min-width: 10px;
23
24
  height: 10px;
24
25
  overflow: hidden;
@@ -14,7 +14,7 @@
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
15
  **/
16
16
 
17
- import { class_ns } from '@core/core_tools.js';
17
+ import { class_ns } from '../../core/core_tools';
18
18
  import { Component, ComponentProps } from '../../core/component';
19
19
 
20
20
  import "./icon.module.scss"
@@ -16,8 +16,8 @@
16
16
 
17
17
  import { class_ns } from '../../core/core_tools';
18
18
  import { Component, ComponentEvents, ComponentProps } from '../../core/component';
19
- import { EventCallback, CoreEvent } from '../../core/core_events.js';
20
- import { dragManager } from '../../core/core_dragdrop.js';
19
+ import { EventCallback, CoreEvent } from '../../core/core_events';
20
+ import { dragManager } from '../../core/core_dragdrop';
21
21
 
22
22
  import { EvDropChange, FileDialog } from '../filedrop/filedrop';
23
23
  import { Menu } from '../menu/menu';
@@ -25,7 +25,7 @@ import { Menu } from '../menu/menu';
25
25
 
26
26
 
27
27
  import "./image.module.scss"
28
- import { _tr } from '@core/core_i18n.js';
28
+ import { _tr } from '../../core/core_i18n';
29
29
 
30
30
 
31
31
  interface ImageEvents extends ComponentEvents {
@@ -14,9 +14,9 @@
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
15
  **/
16
16
 
17
- import { EventCallback } from '@core/core_events.js';
17
+ import { EventCallback } from '../../core/core_events';
18
18
  import { Component, ComponentEvent, ComponentProps, EvChange, EvFocus } from '../../core/component';
19
- import { class_ns, formatIntlDate, IComponentInterface, IFormElement, isString } from '../../core/core_tools.js';
19
+ import { class_ns, formatIntlDate, IComponentInterface, IFormElement, isString } from '../../core/core_tools';
20
20
 
21
21
  import "./input.module.scss"
22
22
 
@@ -14,13 +14,13 @@
14
14
  * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
15
  **/
16
16
 
17
- import { Component, ComponentProps, Flex } from '@core/component.js';
18
- import { Box, BoxProps, Button, HBox, VBox } from '../components.js';
19
- import { _tr } from '@core/core_i18n.js';
17
+ import { Component, ComponentProps, Flex } from '../../core/component';
18
+ import { Box, BoxProps, Button, HBox, VBox } from '../components';
19
+ import { _tr } from '../../core/core_i18n';
20
20
 
21
21
  import "./keyboard.module.scss"
22
- import { class_ns } from '@core/core_tools.js';
23
- import { Application } from '@core/core_application.js';
22
+ import { class_ns } from '../../core/core_tools';
23
+ import { Application } from '../../core/core_application';
24
24
 
25
25
  import icon_bksp from "./delete-left.svg";
26
26
  import icon_shift from "./arrow-up.svg";
@@ -20,6 +20,7 @@
20
20
  --label-background: transparent;
21
21
  --label-color: var( --text-ternary );
22
22
  --label-icon-color: rgb(0 0 0 / 44%);
23
+ --label-color-disa: var( --disabled-color-dark );
23
24
  }
24
25
 
25
26
  .x4label {
@@ -66,11 +67,15 @@
66
67
  }
67
68
  }
68
69
 
69
-
70
70
  .x4simpletext {
71
71
  text-align: left;
72
72
  &.al-center { text-align: center; }
73
73
  &.al-right { text-align: right; }
74
74
  }
75
75
 
76
+ [disabled] .x4label,
77
+ [disabled] .x4simpletext {
78
+ color: var(--label-color-disa);
79
+ }
80
+
76
81
 
@@ -18,7 +18,7 @@ import { Component, ComponentProps } from "../../core/component"
18
18
  import { Icon } from "../icon/icon"
19
19
 
20
20
  import "./label.module.scss";
21
- import { class_ns, UnsafeHtml } from '../../core/core_tools.js';
21
+ import { class_ns, UnsafeHtml } from '../../core/core_tools';
22
22
 
23
23
  export interface LabelProps extends ComponentProps {
24
24
  text?: string | UnsafeHtml;