x4js 2.2.66 → 2.2.68

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "2.2.66",
3
+ "version": "2.2.68",
4
4
  "type": "module",
5
5
  "main": "src/x4.ts",
6
6
  "module": "src/x4.ts",
@@ -17,7 +17,7 @@
17
17
  .cell {
18
18
  border-bottom: 1px solid transparent;
19
19
  overflow: hidden;
20
- min-width: 3rem;
20
+ //min-width: 3rem;
21
21
 
22
22
  transition: border-color 0.5s ease;
23
23
  padding: 4px;
@@ -18,6 +18,8 @@ interface HeaderProps extends Omit<ComponentProps,"content"> {
18
18
  target?: Component; // target element to set header col variable width var( --{name}-width ) parent element if not set
19
19
  }
20
20
 
21
+ const CELL_MW = 8;
22
+
21
23
  /**
22
24
  * by default when a header item is resized, the 'target' style '--{name}-width' is updated
23
25
  *
@@ -63,10 +65,19 @@ export class Header extends HBox<HeaderProps> {
63
65
  this._calc_sizes( );
64
66
  })
65
67
 
68
+ sizer.on( "start", ( ) => {
69
+ //todo: remove flex on all cols
70
+ } );
71
+
72
+ sizer.on( "stop", ( ) => {
73
+ //todo: restore flex
74
+ } );
75
+
66
76
  sizer.on( "resize", ( ev ) => {
67
77
  //cell.setStyleValue( "flexGrow", "0" );
78
+ const sze = ev.size<CELL_MW ? CELL_MW : ev.size;
68
79
  cell.setInternalData("flex",0);
69
- cell.setInternalData("width",ev.size);
80
+ cell.setInternalData("width",sze);
70
81
  this._calc_sizes( );
71
82
  });
72
83
 
@@ -129,6 +140,10 @@ export class Header extends HBox<HeaderProps> {
129
140
  width = c.getInternalData( "width" );
130
141
  }
131
142
 
143
+ if( width<CELL_MW ) {
144
+ width = CELL_MW;
145
+ }
146
+
132
147
  c.setWidth( width );
133
148
 
134
149
  const item = c.getInternalData<HeaderItem>( 'data' );
@@ -137,7 +152,7 @@ export class Header extends HBox<HeaderProps> {
137
152
  this.parentElement().setStyleVariable( `--${item.name}-width`, width + "px");
138
153
  }
139
154
  else {
140
- this.props.target?.setStyleVariable( `--${item.name}-width`, width + "px");
155
+ this.props.target?.setStyleVariable( `--${item.name}-width`, width + "px");
141
156
  }
142
157
 
143
158
  fullw += width;
@@ -270,6 +270,12 @@ export namespace data {
270
270
 
271
271
  export class DataModel<T = any> {
272
272
 
273
+ constructor( fields?: FieldInfo[] ) {
274
+ if( fields ) {
275
+ this.addField( ...fields );
276
+ }
277
+ }
278
+
273
279
  /**
274
280
  * dynamic DataModel
275
281
  */