x4js 1.4.37 → 1.4.38

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/lib/dialog.js CHANGED
@@ -149,6 +149,7 @@ class Dialog extends popup_1.Popup {
149
149
  this.setStyleValue('height', this.m_props.dlgHeight + '%');
150
150
  }
151
151
  this.addClass('@resized');
152
+ this.m_el_title.setStyleValue("width", "auto");
152
153
  if (this.m_props.maximized) {
153
154
  this._maximize();
154
155
  this.emit('size', (0, component_1.EvSize)(null));
package/lib/gridview.js CHANGED
@@ -642,6 +642,10 @@ class GridView extends layout_1.VLayout {
642
642
  return;
643
643
  }
644
644
  const update = () => {
645
+ // element destroyed between updateScroll and now
646
+ if (!this.dom) {
647
+ return;
648
+ }
645
649
  let newTop = Math.floor(this.m_view_el.dom.scrollTop / (this.m_itemHeight || 1));
646
650
  if (newTop != this.m_topIndex || forceUpdate) {
647
651
  this.m_topIndex = newTop;
@@ -753,6 +753,7 @@ class Spreadsheet extends layout_1.VLayout {
753
753
  case 'Enter': {
754
754
  this.editCurCell();
755
755
  event.stopPropagation();
756
+ event.preventDefault();
756
757
  break;
757
758
  }
758
759
  case 'Delete': {
@@ -931,10 +932,15 @@ class Spreadsheet extends layout_1.VLayout {
931
932
  this.killEditor(true);
932
933
  });
933
934
  input.setDomEvent('keydown', (e) => {
935
+ // prevented by edit...
936
+ if (e.defaultPrevented) {
937
+ return;
938
+ }
934
939
  switch (e.key) {
935
940
  case 'Escape': {
936
941
  this.killEditor(false);
937
942
  e.stopPropagation();
943
+ e.preventDefault();
938
944
  break;
939
945
  }
940
946
  case 'Enter':
@@ -945,18 +951,21 @@ class Spreadsheet extends layout_1.VLayout {
945
951
  }
946
952
  movesel(0, sens);
947
953
  e.stopPropagation();
954
+ e.preventDefault();
948
955
  break;
949
956
  }
950
957
  case 'ArrowUp':
951
958
  case 'Up': {
952
959
  movesel(-1, 0);
953
960
  e.stopPropagation();
961
+ e.preventDefault();
954
962
  break;
955
963
  }
956
964
  case 'ArrowDown':
957
965
  case 'Down': {
958
966
  movesel(1, 0);
959
967
  e.stopPropagation();
968
+ e.preventDefault();
960
969
  break;
961
970
  }
962
971
  }
@@ -972,6 +981,7 @@ class Spreadsheet extends layout_1.VLayout {
972
981
  case 'Escape': {
973
982
  this.killEditor(false);
974
983
  e.stopPropagation();
984
+ e.preventDefault();
975
985
  break;
976
986
  }
977
987
  case 'Enter':
@@ -982,6 +992,7 @@ class Spreadsheet extends layout_1.VLayout {
982
992
  }
983
993
  movesel(0, sens);
984
994
  e.stopPropagation();
995
+ e.preventDefault();
985
996
  break;
986
997
  }
987
998
  }
@@ -62,7 +62,7 @@ declare abstract class SVGItem {
62
62
  * @returns this
63
63
  */
64
64
  attr(name: string, value: string): this;
65
- style(name: string, value: string): this;
65
+ style(name: string, value: string | number): this;
66
66
  /**
67
67
  * add a class
68
68
  * @param name class name to add
@@ -114,13 +114,14 @@ class SVGItem {
114
114
  return this;
115
115
  }
116
116
  style(name, value) {
117
- if (value === undefined) {
118
- value = null;
117
+ if (value === undefined || value === '' || value === undefined) {
118
+ this.m_style.delete(name);
119
+ return;
119
120
  }
120
- else if (!component_1._x4_unitless[name] && ((0, tools_1.isNumber)(value) || reNumber.test(value))) {
121
+ if (!component_1._x4_unitless[name] && ((0, tools_1.isNumber)(value) || reNumber.test(value))) {
121
122
  value = value + 'px';
122
123
  }
123
- this.m_style.set(name, value);
124
+ this.m_style.set(name, '' + value);
124
125
  return this;
125
126
  }
126
127
  /**
package/lib/x4.css CHANGED
@@ -840,6 +840,7 @@ textarea::selection {
840
840
  display: flex;
841
841
  align-items: center;
842
842
  background-color: var(--x4-selection-color);
843
+ width: 0;
843
844
  }
844
845
  .x-dialog > .title .x-icon {
845
846
  width: 2em;
@@ -858,6 +859,9 @@ textarea::selection {
858
859
  .x-dialog > .title .x-label {
859
860
  border-bottom: none;
860
861
  padding: 0;
862
+ overflow: hidden;
863
+ text-overflow: ellipsis;
864
+ white-space: nowrap;
861
865
  }
862
866
  .x-dialog > .title .res-btn {
863
867
  display: none;
@@ -1213,10 +1217,16 @@ textarea::selection {
1213
1217
  .x-spreadsheet .x-editor {
1214
1218
  position: absolute;
1215
1219
  min-height: 0;
1220
+ height: calc(100% - 1px);
1221
+ margin: 0;
1216
1222
  }
1217
1223
  .x-spreadsheet .x-editor input {
1218
1224
  margin: 0;
1219
1225
  min-height: 0;
1226
+ height: 100%;
1227
+ }
1228
+ .x-form .x-spreadsheet .x-editor {
1229
+ background-color: white;
1220
1230
  }
1221
1231
  .x-side-bar {
1222
1232
  min-width: 44px;
@@ -1293,9 +1303,13 @@ textarea::selection {
1293
1303
  background-color: white;
1294
1304
  padding: 2px 0;
1295
1305
  }
1296
- .x-popup-table tr:hover,
1297
1306
  .x-popup-table tr.x-selected {
1298
- background-color: #c8ffff;
1307
+ background-color: var(--x4-selection-color);
1308
+ color: var(--x4-selection-text);
1309
+ }
1310
+ .x-popup-table tr:hover {
1311
+ background-color: var(--x4-hover-color);
1312
+ color: var(--x4-hover-text);
1299
1313
  }
1300
1314
  .x-popup-table td {
1301
1315
  padding: 3px 8px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "1.4.37",
3
+ "version": "1.4.38",
4
4
  "description": "X4js core files",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/src/dialog.ts CHANGED
@@ -233,6 +233,7 @@ export class Dialog<P extends DialogProps = DialogProps, E extends DialogBoxEven
233
233
  }
234
234
 
235
235
  this.addClass('@resized');
236
+ this.m_el_title.setStyleValue( "width", "auto" );
236
237
 
237
238
  if (this.m_props.maximized) {
238
239
  this._maximize();
package/src/gridview.ts CHANGED
@@ -855,6 +855,12 @@ export class GridView extends VLayout<GridViewProps, GridViewEventMap> {
855
855
  }
856
856
 
857
857
  const update = () => {
858
+
859
+ // element destroyed between updateScroll and now
860
+ if( !this.dom ) {
861
+ return;
862
+ }
863
+
858
864
  let newTop = Math.floor(this.m_view_el.dom.scrollTop / (this.m_itemHeight || 1));
859
865
 
860
866
  if (newTop != this.m_topIndex || forceUpdate) {
@@ -1015,6 +1015,7 @@ export class Spreadsheet extends VLayout<SpreadsheetProps, SpreadsheetEventSet>
1015
1015
  case 'Enter': {
1016
1016
  this.editCurCell();
1017
1017
  event.stopPropagation( );
1018
+ event.preventDefault( );
1018
1019
  break;
1019
1020
  }
1020
1021
 
@@ -1247,11 +1248,16 @@ export class Spreadsheet extends VLayout<SpreadsheetProps, SpreadsheetEventSet>
1247
1248
  } );
1248
1249
 
1249
1250
  input.setDomEvent( 'keydown', (e: KeyboardEvent) => {
1250
-
1251
+ // prevented by edit...
1252
+ if( e.defaultPrevented ) {
1253
+ return;
1254
+ }
1255
+
1251
1256
  switch (e.key) {
1252
1257
  case 'Escape': {
1253
1258
  this.killEditor(false);
1254
1259
  e.stopPropagation();
1260
+ e.preventDefault( );
1255
1261
  break;
1256
1262
  }
1257
1263
 
@@ -1264,6 +1270,7 @@ export class Spreadsheet extends VLayout<SpreadsheetProps, SpreadsheetEventSet>
1264
1270
 
1265
1271
  movesel(0, sens);
1266
1272
  e.stopPropagation();
1273
+ e.preventDefault( );
1267
1274
  break;
1268
1275
  }
1269
1276
 
@@ -1271,6 +1278,7 @@ export class Spreadsheet extends VLayout<SpreadsheetProps, SpreadsheetEventSet>
1271
1278
  case 'Up': {
1272
1279
  movesel(-1, 0);
1273
1280
  e.stopPropagation();
1281
+ e.preventDefault( );
1274
1282
  break;
1275
1283
  }
1276
1284
 
@@ -1278,6 +1286,7 @@ export class Spreadsheet extends VLayout<SpreadsheetProps, SpreadsheetEventSet>
1278
1286
  case 'Down': {
1279
1287
  movesel(1, 0);
1280
1288
  e.stopPropagation();
1289
+ e.preventDefault( );
1281
1290
  break;
1282
1291
  }
1283
1292
  }
@@ -1296,6 +1305,7 @@ export class Spreadsheet extends VLayout<SpreadsheetProps, SpreadsheetEventSet>
1296
1305
  case 'Escape': {
1297
1306
  this.killEditor(false);
1298
1307
  e.stopPropagation();
1308
+ e.preventDefault( );
1299
1309
  break;
1300
1310
  }
1301
1311
 
@@ -1308,6 +1318,7 @@ export class Spreadsheet extends VLayout<SpreadsheetProps, SpreadsheetEventSet>
1308
1318
 
1309
1319
  movesel(0, sens);
1310
1320
  e.stopPropagation();
1321
+ e.preventDefault( );
1311
1322
  break;
1312
1323
  }
1313
1324
  }
@@ -131,16 +131,18 @@ abstract class SVGItem {
131
131
  return this;
132
132
  }
133
133
 
134
- style( name: string, value: string ) : this {
134
+ style( name: string, value: string | number ) : this {
135
135
 
136
- if (value === undefined) {
137
- value = null;
136
+ if (value === undefined || value==='' || value===undefined ) {
137
+ this.m_style.delete( name );
138
+ return;
138
139
  }
139
- else if (!_x4_unitless[name] && (isNumber(value) || reNumber.test(value))) {
140
+
141
+ if (!_x4_unitless[name] && (isNumber(value) || reNumber.test(value))) {
140
142
  value = value + 'px';
141
143
  }
142
144
 
143
- this.m_style.set( name, value );
145
+ this.m_style.set( name, ''+value );
144
146
  return this;
145
147
  }
146
148
 
package/src/x4.less CHANGED
@@ -1052,6 +1052,7 @@ textarea {
1052
1052
  display: flex;
1053
1053
  align-items: center;
1054
1054
  background-color: var( --x4-selection-color );
1055
+ width: 0; // to avoid title changing dialog size when long
1055
1056
 
1056
1057
  .x-icon {
1057
1058
  width: 2em;
@@ -1074,6 +1075,9 @@ textarea {
1074
1075
  .x-label {
1075
1076
  border-bottom: none;
1076
1077
  padding: 0;
1078
+ overflow: hidden;
1079
+ text-overflow: ellipsis;
1080
+ white-space: nowrap;
1077
1081
  }
1078
1082
 
1079
1083
  .res-btn {
@@ -1482,14 +1486,21 @@ textarea {
1482
1486
  .x-editor {
1483
1487
  position: absolute;
1484
1488
  min-height: 0;
1489
+ height: calc( 100% - 1px );
1490
+ margin: 0;
1485
1491
 
1486
1492
  input {
1487
1493
  margin: 0;
1488
1494
  min-height: 0;
1495
+ height: 100%;
1489
1496
  }
1490
1497
  }
1491
1498
  }
1492
1499
 
1500
+ .x-form .x-spreadsheet .x-editor {
1501
+ background-color: white;
1502
+ }
1503
+
1493
1504
  .x-side-bar {
1494
1505
  min-width: 44px;
1495
1506
 
@@ -1594,9 +1605,15 @@ textarea {
1594
1605
  background-color: white;
1595
1606
  padding: 2px 0;
1596
1607
 
1597
- tr:hover,
1598
1608
  tr.x-selected {
1599
- background-color: rgba(200,255,255,1);
1609
+ //background-color: rgba(200,255,255,1);
1610
+ background-color: var(--x4-selection-color);
1611
+ color: var( --x4-selection-text);
1612
+ }
1613
+
1614
+ tr:hover {
1615
+ background-color: var(--x4-hover-color);
1616
+ color: var( --x4-hover-text);
1600
1617
  }
1601
1618
 
1602
1619
  td {