x4js 2.0.20 → 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 (172) hide show
  1. package/lib/cjs/x4.css +1 -1
  2. package/lib/cjs/x4.js +2 -2
  3. package/lib/esm/x4.css +1 -1
  4. package/lib/esm/x4.mjs +2 -2
  5. package/lib/styles/x4.css +1 -1
  6. package/lib/types/x4js.d.ts +92 -77
  7. package/package.json +1 -1
  8. package/src/components/boxes/boxes.ts +33 -1
  9. package/src/components/combobox/combobox.module.scss +13 -0
  10. package/src/components/combobox/combobox.ts +7 -0
  11. package/src/components/form/form.ts +4 -4
  12. package/src/components/gridview/gridview.ts +12 -9
  13. package/src/components/header/header.module.scss +2 -1
  14. package/src/components/header/header.ts +17 -5
  15. package/src/components/icon/icon.module.scss +1 -0
  16. package/src/components/label/label.module.scss +6 -1
  17. package/src/components/listbox/listbox.module.scss +35 -31
  18. package/src/components/listbox/listbox.ts +50 -12
  19. package/src/components/messages/messages.ts +14 -0
  20. package/src/components/notification/notification.ts +1 -1
  21. package/src/components/popup/popup.ts +13 -2
  22. package/src/components/propgrid/propgrid.ts +4 -2
  23. package/src/components/sizers/sizer.ts +4 -4
  24. package/src/components/tabs/tabs.module.scss +2 -2
  25. package/src/components/tabs/tabs.ts +28 -4
  26. package/src/components/textedit/textedit.ts +1 -1
  27. package/src/components/treeview/treeview.module.scss +9 -1
  28. package/src/components/treeview/treeview.ts +52 -13
  29. package/src/core/component.ts +46 -9
  30. package/src/core/core_data.ts +8 -8
  31. package/src/core/core_state.ts +1 -1
  32. package/src/core/core_tools.ts +2 -0
  33. package/lib/src/components/base.scss +0 -25
  34. package/lib/src/components/boxes/boxes.module.scss +0 -54
  35. package/lib/src/components/boxes/boxes.ts +0 -370
  36. package/lib/src/components/breadcrumb/breadcrumb.scss +0 -56
  37. package/lib/src/components/breadcrumb/breadcrumb.ts +0 -93
  38. package/lib/src/components/breadcrumb/chevron-right.svg +0 -1
  39. package/lib/src/components/btngroup/btngroup.module.scss +0 -41
  40. package/lib/src/components/btngroup/btngroup.ts +0 -153
  41. package/lib/src/components/button/button.module.scss +0 -173
  42. package/lib/src/components/button/button.ts +0 -185
  43. package/lib/src/components/calendar/calendar-check-sharp-light.svg +0 -1
  44. package/lib/src/components/calendar/calendar.module.scss +0 -163
  45. package/lib/src/components/calendar/calendar.ts +0 -327
  46. package/lib/src/components/calendar/chevron-left-sharp-light.svg +0 -1
  47. package/lib/src/components/calendar/chevron-right-sharp-light.svg +0 -1
  48. package/lib/src/components/canvas/canvas.module.scss +0 -25
  49. package/lib/src/components/canvas/canvas.ts +0 -189
  50. package/lib/src/components/canvas/canvas_ex.ts +0 -276
  51. package/lib/src/components/checkbox/check.svg +0 -4
  52. package/lib/src/components/checkbox/checkbox.module.scss +0 -142
  53. package/lib/src/components/checkbox/checkbox.ts +0 -140
  54. package/lib/src/components/colorinput/colorinput.module.scss +0 -65
  55. package/lib/src/components/colorinput/colorinput.ts +0 -91
  56. package/lib/src/components/colorinput/crosshairs-simple-sharp-light.svg +0 -1
  57. package/lib/src/components/colorpicker/colorpicker.module.scss +0 -133
  58. package/lib/src/components/colorpicker/colorpicker.ts +0 -482
  59. package/lib/src/components/combobox/combobox.module.scss +0 -133
  60. package/lib/src/components/combobox/combobox.ts +0 -275
  61. package/lib/src/components/combobox/updown.svg +0 -4
  62. package/lib/src/components/components.ts +0 -42
  63. package/lib/src/components/dialog/dialog.module.scss +0 -104
  64. package/lib/src/components/dialog/dialog.ts +0 -229
  65. package/lib/src/components/dialog/xmark-sharp-light.svg +0 -1
  66. package/lib/src/components/filedrop/cloud-arrow-up.svg +0 -1
  67. package/lib/src/components/filedrop/filedrop.module.scss +0 -70
  68. package/lib/src/components/filedrop/filedrop.ts +0 -131
  69. package/lib/src/components/form/form.module.scss +0 -38
  70. package/lib/src/components/form/form.ts +0 -172
  71. package/lib/src/components/gridview/arrow-down-light.svg +0 -1
  72. package/lib/src/components/gridview/arrow-up-light.svg +0 -1
  73. package/lib/src/components/gridview/gridview.module.scss +0 -324
  74. package/lib/src/components/gridview/gridview.ts +0 -1175
  75. package/lib/src/components/header/header.module.scss +0 -40
  76. package/lib/src/components/header/header.ts +0 -130
  77. package/lib/src/components/icon/icon.module.scss +0 -31
  78. package/lib/src/components/icon/icon.ts +0 -137
  79. package/lib/src/components/image/image.module.scss +0 -28
  80. package/lib/src/components/image/image.ts +0 -168
  81. package/lib/src/components/input/input.module.scss +0 -74
  82. package/lib/src/components/input/input.ts +0 -422
  83. package/lib/src/components/keyboard/arrow-up.svg +0 -1
  84. package/lib/src/components/keyboard/delete-left.svg +0 -1
  85. package/lib/src/components/keyboard/eye-slash.svg +0 -1
  86. package/lib/src/components/keyboard/keyboard.module.scss +0 -134
  87. package/lib/src/components/keyboard/keyboard.ts +0 -526
  88. package/lib/src/components/label/label.module.scss +0 -76
  89. package/lib/src/components/label/label.ts +0 -97
  90. package/lib/src/components/link/link.ts +0 -81
  91. package/lib/src/components/listbox/listbox.module.scss +0 -161
  92. package/lib/src/components/listbox/listbox.ts +0 -539
  93. package/lib/src/components/menu/caret-right-solid.svg +0 -1
  94. package/lib/src/components/menu/menu.module.scss +0 -117
  95. package/lib/src/components/menu/menu.ts +0 -174
  96. package/lib/src/components/messages/circle-exclamation.svg +0 -1
  97. package/lib/src/components/messages/messages.module.scss +0 -92
  98. package/lib/src/components/messages/messages.ts +0 -215
  99. package/lib/src/components/messages/pen-field.svg +0 -1
  100. package/lib/src/components/normalize.scss +0 -391
  101. package/lib/src/components/notification/circle-check-solid.svg +0 -1
  102. package/lib/src/components/notification/circle-exclamation-solid.svg +0 -1
  103. package/lib/src/components/notification/circle-notch-light.svg +0 -1
  104. package/lib/src/components/notification/notification.module.scss +0 -84
  105. package/lib/src/components/notification/notification.ts +0 -107
  106. package/lib/src/components/notification/xmark-sharp-light.svg +0 -1
  107. package/lib/src/components/panel/panel.module.scss +0 -60
  108. package/lib/src/components/panel/panel.ts +0 -58
  109. package/lib/src/components/popup/popup.module.scss +0 -51
  110. package/lib/src/components/popup/popup.ts +0 -442
  111. package/lib/src/components/progress/progress.module.scss +0 -57
  112. package/lib/src/components/progress/progress.ts +0 -44
  113. package/lib/src/components/propgrid/folder-closed.svg +0 -1
  114. package/lib/src/components/propgrid/folder-open.svg +0 -1
  115. package/lib/src/components/propgrid/progrid.module.scss +0 -112
  116. package/lib/src/components/propgrid/propgrid.ts +0 -288
  117. package/lib/src/components/propgrid/updown.svg +0 -4
  118. package/lib/src/components/radio/radio.module.scss +0 -147
  119. package/lib/src/components/radio/radio.svg +0 -4
  120. package/lib/src/components/radio/radio.ts +0 -142
  121. package/lib/src/components/rating/rating.module.scss +0 -23
  122. package/lib/src/components/rating/rating.ts +0 -131
  123. package/lib/src/components/rating/star-sharp-light.svg +0 -1
  124. package/lib/src/components/rating/star-sharp-solid.svg +0 -1
  125. package/lib/src/components/select/select.module.scss +0 -9
  126. package/lib/src/components/select/select.ts +0 -134
  127. package/lib/src/components/shared.scss +0 -137
  128. package/lib/src/components/sizers/sizer.module.scss +0 -90
  129. package/lib/src/components/sizers/sizer.ts +0 -132
  130. package/lib/src/components/slider/slider.module.scss +0 -118
  131. package/lib/src/components/slider/slider.ts +0 -198
  132. package/lib/src/components/switch/switch.module.scss +0 -127
  133. package/lib/src/components/switch/switch.ts +0 -62
  134. package/lib/src/components/tabs/tabs.module.scss +0 -45
  135. package/lib/src/components/tabs/tabs.ts +0 -205
  136. package/lib/src/components/textarea/textarea.module.scss +0 -63
  137. package/lib/src/components/textarea/textarea.ts +0 -125
  138. package/lib/src/components/textedit/textedit.module.scss +0 -116
  139. package/lib/src/components/textedit/textedit.ts +0 -115
  140. package/lib/src/components/themes.scss +0 -88
  141. package/lib/src/components/tickline/tickline.module.scss +0 -26
  142. package/lib/src/components/tickline/tickline.ts +0 -82
  143. package/lib/src/components/tooltips/circle-info-sharp-light.svg +0 -1
  144. package/lib/src/components/tooltips/comments-question.svg +0 -1
  145. package/lib/src/components/tooltips/tooltips.scss +0 -72
  146. package/lib/src/components/tooltips/tooltips.ts +0 -109
  147. package/lib/src/components/treeview/chevron-down-light.svg +0 -1
  148. package/lib/src/components/treeview/treeview.module.scss +0 -185
  149. package/lib/src/components/treeview/treeview.ts +0 -445
  150. package/lib/src/components/viewport/viewport.module.scss +0 -32
  151. package/lib/src/components/viewport/viewport.ts +0 -41
  152. package/lib/src/core/component.ts +0 -1066
  153. package/lib/src/core/core_application.ts +0 -265
  154. package/lib/src/core/core_colors.ts +0 -250
  155. package/lib/src/core/core_data.ts +0 -1310
  156. package/lib/src/core/core_dom.ts +0 -471
  157. package/lib/src/core/core_dragdrop.ts +0 -201
  158. package/lib/src/core/core_element.ts +0 -115
  159. package/lib/src/core/core_events.ts +0 -177
  160. package/lib/src/core/core_i18n.ts +0 -393
  161. package/lib/src/core/core_react.ts +0 -79
  162. package/lib/src/core/core_router.ts +0 -237
  163. package/lib/src/core/core_state.ts +0 -62
  164. package/lib/src/core/core_styles.ts +0 -214
  165. package/lib/src/core/core_svg.ts +0 -712
  166. package/lib/src/core/core_tools.ts +0 -906
  167. package/lib/src/types/scss.d.ts +0 -4
  168. package/lib/src/types/svg.d.ts +0 -1
  169. package/lib/src/types/x4react.d.ts +0 -9
  170. package/lib/src/x4.scss +0 -19
  171. package/lib/src/x4.ts +0 -35
  172. package/lib/src/x4tsx.d.ts +0 -25
@@ -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;
@@ -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
  }
@@ -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
 
@@ -20,7 +20,7 @@ import { Box, BoxProps } from '../boxes/boxes';
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 {
@@ -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;
@@ -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
 
@@ -46,7 +46,7 @@
46
46
  outline: none;
47
47
 
48
48
  &>.x4header {
49
- border-bottom: 1px solid var( --color-gray-3 );
49
+ border-bottom: 1px solid var( --border );
50
50
  }
51
51
 
52
52
  &>.body {
@@ -59,45 +59,45 @@
59
59
 
60
60
  &> .x4viewport {
61
61
  display: table;
62
+ }
63
+
64
+ .x4item {
65
+ @extend .flex;
62
66
 
63
- .x4item {
64
- @extend .flex;
65
-
66
- padding: 4px;
67
- background-color: transparent;
68
- color: var( --color-gray-9 );
67
+ padding: 4px;
68
+ background-color: transparent;
69
+ color: var( --text-primary );
69
70
 
70
- &> .x4label {
71
- color: inherit;
72
- padding: 2px 6px;
73
-
74
- #icon {
75
- color: var( --listbox-icon-color );
76
- fill: var( --listbox-icon-color );
77
- }
71
+ &> .x4label {
72
+ color: inherit;
73
+ padding: 2px 6px;
74
+
75
+ #icon {
76
+ color: var( --listbox-icon-color );
77
+ fill: var( --listbox-icon-color );
78
78
  }
79
+ }
79
80
 
80
- &:hover {
81
- background-color: var( --listbox-item-background-hover );
82
- }
81
+ &:hover {
82
+ background-color: var( --listbox-item-background-hover );
83
+ }
83
84
 
84
- &.selected {
85
- background-color: var( --listbox-item-background-sel );
86
- color: var( --listbox-item-color-sel );
85
+ &.selected {
86
+ background-color: var( --listbox-item-background-sel );
87
+ color: var( --listbox-item-color-sel );
87
88
 
88
- &> .x4label {
89
- #icon {
90
- color: var( --listbox-item-color-sel );
91
- fill: var( --listbox-item-color-sel );
92
- }
89
+ &> .x4label {
90
+ #icon {
91
+ color: var( --listbox-item-color-sel );
92
+ fill: var( --listbox-item-color-sel );
93
93
  }
94
94
  }
95
-
96
- //&:active{
97
- //background-color: var( --color-80 );
98
- //color: var(--color-0);
99
- //}
100
95
  }
96
+
97
+ //&:active{
98
+ //background-color: var( --color-80 );
99
+ //color: var(--color-0);
100
+ //}
101
101
  }
102
102
  }
103
103
 
@@ -138,6 +138,10 @@
138
138
  &:focus {
139
139
  background-color: var( --ol-button-background-hover );
140
140
  }
141
+
142
+ &:disabled {
143
+ color: var( --disabled-color-dark );
144
+ }
141
145
  }
142
146
  }
143
147
  }
@@ -16,9 +16,11 @@
16
16
 
17
17
  import { Component, ComponentEvent, ComponentEvents, componentFromDOM, ComponentProps, EvChange, EvClick, EvContextMenu, EvDblClick, EvSelectionChange } from '../../core/component';
18
18
  import { EventCallback } from '../../core/core_events';
19
- import { kbNav, class_ns, isArray, UnsafeHtml } from '../../core/core_tools';
19
+ import { kbNav, class_ns, isArray, UnsafeHtml, asap } from '../../core/core_tools';
20
20
 
21
21
  import { ScrollView, Viewport } from '../viewport/viewport';
22
+ import { Header } from '../header/header';
23
+
22
24
  import { HBox } from '../boxes/boxes';
23
25
  import { Label } from '../label/label';
24
26
 
@@ -55,7 +57,7 @@ interface ListboxEvents extends ComponentEvents {
55
57
  interface ListboxProps extends Omit<ComponentProps,'content'> {
56
58
  items?: ListItem[];
57
59
  renderer?: ( item: ListItem ) => Component;
58
- //header?: Header;
60
+ header?: Header;
59
61
  footer?: Component,
60
62
  checkable?: true,
61
63
  multisel?: true,
@@ -98,8 +100,12 @@ export class Listbox extends Component<ListboxProps,ListboxEvents> {
98
100
  props.footer.setAttribute( "id", "footer" );
99
101
  }
100
102
 
103
+ if( props.header ) {
104
+ props.header.setAttribute( "id", "header" );
105
+ }
106
+
101
107
  this.setContent( [
102
- //props.header ? props.header : null,
108
+ props.header ? props.header : null,
103
109
  scroller,
104
110
  props.footer,
105
111
  ] );
@@ -342,7 +348,12 @@ export class Listbox extends Component<ListboxProps,ListboxEvents> {
342
348
 
343
349
  if( !ids.length ) {
344
350
  if( this._multisel.size ) {
345
- this.clearSelection( );
351
+ if( notify ) {
352
+ this.clearSelection( );
353
+ }
354
+ else {
355
+ this._clearSelection( );
356
+ }
346
357
  }
347
358
 
348
359
  return;
@@ -361,7 +372,9 @@ export class Listbox extends Component<ListboxProps,ListboxEvents> {
361
372
  }
362
373
  });
363
374
 
364
- this.fire( "selectionChange", { selection: this.getSelection(), empty: this._multisel.size==0 } );
375
+ if( notify ) {
376
+ this.fire( "selectionChange", { selection: this.getSelection(), empty: this._multisel.size==0 } );
377
+ }
365
378
  }
366
379
  }
367
380
 
@@ -411,15 +424,29 @@ export class Listbox extends Component<ListboxProps,ListboxEvents> {
411
424
 
412
425
  this.clearSelection( );
413
426
  this._view.clearContent( );
414
- this._items = items;
427
+ this._items = items ?? [];
415
428
 
416
- if( items ) {
429
+ let upsel = false;
430
+
431
+ if( this._items.length ) {
417
432
  const content = items.map( x => this.renderItem(x) );
418
433
  this._view.setContent( content );
419
434
 
420
435
  if( keepSel ) {
421
436
  this.select( oldSel );
422
437
  }
438
+ else {
439
+ upsel = true;
440
+ }
441
+ }
442
+ else {
443
+ upsel = true;
444
+ }
445
+
446
+ if( upsel ) {
447
+ this.setTimeout( "sel", 100, ( ) => {
448
+ this.fire( "selectionChange", { selection: [], empty: true } );
449
+ } );
423
450
  }
424
451
  }
425
452
 
@@ -452,7 +479,7 @@ export class Listbox extends Component<ListboxProps,ListboxEvents> {
452
479
  *
453
480
  */
454
481
 
455
- filter( filter: string ) {
482
+ filter( filter: string | RegExp ) {
456
483
  const childs = this._view.enumChildComponents( false );
457
484
 
458
485
  if( !filter ) {
@@ -460,13 +487,24 @@ export class Listbox extends Component<ListboxProps,ListboxEvents> {
460
487
  }
461
488
  else {
462
489
  // get list of visible items
463
- const filtred = this._items
464
- .filter( x => x.text.includes(filter) )
465
- .map( x => x.id+'' );
490
+ let filtred: Set<ListboxID>;
491
+
492
+ if( filter instanceof RegExp ) {
493
+ const f = filter as RegExp;
494
+ filtred = new Set( this._items
495
+ .filter( x => f.test(x.text as string) )
496
+ .map( x => x.id ) );
497
+ }
498
+ else {
499
+ const f = filter.toUpperCase( );
500
+ filtred = new Set( this._items
501
+ .filter( x => x.text.toUpperCase().includes(f) )
502
+ .map( x => x.id ) );
503
+ }
466
504
 
467
505
  // now hide all elements not in list
468
506
  childs.forEach( x => {
469
- x.show( filtred.includes( x.getInternalData( "id" ) ) );
507
+ x.show( filtred.has( x.getInternalData( "id" ) ) );
470
508
  });
471
509
  }
472
510
  }
@@ -209,7 +209,21 @@ export class PromptBox extends Dialog<DialogProps>
209
209
 
210
210
  box.show();
211
211
  } );
212
+ }
213
+
214
+ static show( msg: string | UnsafeHtml, editor: Component, title: string, callback: ( btn: string ) => boolean | Promise<boolean> | Promise<void> ) {
212
215
 
216
+ const box = this._create( msg, editor, title );
217
+
218
+ box.on( "btnclick", ( ev ) => {
219
+ asap( async ( ) => {
220
+ if( await callback( ev.button )!==false ) {
221
+ box.close()
222
+ }
223
+ });
224
+ });
225
+
226
+ box.show();
213
227
  }
214
228
  }
215
229
 
@@ -72,7 +72,7 @@ export class Notification extends Popup {
72
72
  const _icon = new Icon( { iconId: icon } );
73
73
  if( props.loading ) {
74
74
  _icon.addClass( "rotate" );
75
- this.props.modal = true;
75
+ //this.props.modal = true;
76
76
  }
77
77
 
78
78
  this.setContent( new HBox( {
@@ -178,8 +178,19 @@ export class Popup<P extends PopupProps = PopupProps, E extends PopupEvents = Po
178
178
  this.__remove( );
179
179
 
180
180
  if( this._ismodal ) {
181
- modal_stack.pop( );
182
- this._hideModalMask( );
181
+ // modal1.show()
182
+ // modal2.show()
183
+ // modal1.hide()
184
+ if( modal_stack[modal_stack.length-1]!=this ) {
185
+ const idx = modal_stack.findIndex( x => x===this );
186
+ if( idx>=0 ) {
187
+ modal_stack.splice( idx, 1 );
188
+ }
189
+ }
190
+ else {
191
+ modal_stack.pop( );
192
+ this._hideModalMask( );
193
+ }
183
194
  }
184
195
 
185
196
  // remove from popup list
@@ -81,7 +81,7 @@ export class PropertyGrid extends VBox {
81
81
 
82
82
  setItems( _grps: PropertyGroup[] ) {
83
83
 
84
- this.groups = _grps;
84
+ this.groups = _grps.filter( x => !!x );
85
85
  //this.groups.sort( (a,b) => {return a.title>b.title ? 1 : 0} );
86
86
 
87
87
  let items: Component[] = [];
@@ -89,7 +89,9 @@ export class PropertyGrid extends VBox {
89
89
  for( const g of this.groups ) {
90
90
  items.push( this.makeGroupHeader(g) );
91
91
  g.items.forEach( i => {
92
- items.push( this.makePropertyRow(i) );
92
+ if( i ) {
93
+ items.push( this.makePropertyRow(i) );
94
+ }
93
95
  });
94
96
  }
95
97
 
@@ -23,7 +23,7 @@ import "./sizer.module.scss"
23
23
  *
24
24
  */
25
25
 
26
- interface EvSizeChange extends ComponentEvent {
26
+ export interface EvSizeChange extends ComponentEvent {
27
27
  size: number;
28
28
  }
29
29
 
@@ -33,7 +33,7 @@ interface CSizerEvent extends ComponentEvents {
33
33
  stop: ComponentEvent;
34
34
  }
35
35
 
36
- type SizerType = "left" | "top" | "right" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
36
+ type SizerType = "left" | "top" | "right" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right" ;
37
37
 
38
38
  /**
39
39
  *
@@ -117,11 +117,11 @@ export class CSizer extends Component<ComponentProps,CSizerEvent> {
117
117
  }
118
118
 
119
119
  if( this._type.includes("right") ) {
120
- //nr.left = rc.left;
121
120
  nr.width = (pt.x-rc.left);
122
- }
121
+ }
123
122
 
124
123
  this._ref.setStyle( nr );
124
+ //this._ref.setStyleValue( "flexGrow", 0 );
125
125
 
126
126
  const nrc = this._ref.getBoundingRect( );
127
127
  this.fire( "resize", { size: horz ? nrc.width : nrc.height })
@@ -30,9 +30,9 @@
30
30
  border-bottom-color: var( --tab-border-hover );
31
31
  }
32
32
 
33
- &:focus {
33
+ //&:focus {
34
34
  //color: var( --color-60 );
35
- }
35
+ //}
36
36
  }
37
37
 
38
38
  }