x4js 2.2.66 → 2.2.69

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.69",
4
4
  "type": "module",
5
5
  "main": "src/x4.ts",
6
6
  "module": "src/x4.ts",
@@ -989,7 +989,7 @@ export class Gridview<P extends GridviewProps = GridviewProps, E extends Gridvie
989
989
 
990
990
  this._viewport = new Viewport({ content: this._body });
991
991
 
992
- if (!this._has_footer) {
992
+ if (!this.props.footer) {
993
993
  this.setStyleVariable("--footer-height", "0");
994
994
  }
995
995
 
@@ -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;
@@ -56,7 +56,7 @@
56
56
  }
57
57
  }
58
58
 
59
- .x4label:has(.empty) {
59
+ .x4label#text:has(.empty) {
60
60
  display: none;
61
61
  }
62
62
 
@@ -49,7 +49,9 @@ export class SimpleTextArea extends Component<TextAreaProps> {
49
49
  super( { ...props, tag: "textarea" } );
50
50
 
51
51
  this.setAttribute( "name", props.name );
52
- this.setAttribute( "value", props.value+'' );
52
+ if( props.value ) {
53
+ this.setAttribute( "value", props.value+'' );
54
+ }
53
55
 
54
56
  if( props.resize!==undefined ) {
55
57
  this.setStyleValue( "resize", props.resize===false ? "none" : props.resize as string );
@@ -112,9 +114,12 @@ export class TextArea extends VBox {
112
114
  constructor( props: TextAreaProps ) {
113
115
  super( props );
114
116
 
117
+
118
+ const { label, value, resize, readonly, trim, name } = props;
119
+
115
120
  this.setContent( [
116
121
  new Label( { text: props.label }),
117
- this._input = new SimpleTextArea( props )
122
+ this._input = new SimpleTextArea( { label,value,resize,readonly,trim } )
118
123
  ])
119
124
  }
120
125
 
@@ -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
  */
@@ -1077,7 +1083,7 @@ export class DataStore<T = any> extends EventSource<DataStoreEventMap> {
1077
1083
  } );
1078
1084
  }
1079
1085
 
1080
- return result>=0 ? this.getByIndex(result) : null;
1086
+ return result>=0 ? this.m_records[result] : null;
1081
1087
  }
1082
1088
 
1083
1089
  export( ) {