@refinitiv-ui/efx-grid 6.0.136 → 6.0.138

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.
@@ -621,7 +621,7 @@ Core.prototype._hasPendingRowChange = false;
621
621
  * @return {string}
622
622
  */
623
623
  Core.getVersion = function () {
624
- return "5.1.130";
624
+ return "5.1.133";
625
625
  };
626
626
  /** {@link ElementWrapper#dispose}
627
627
  * @override
@@ -2068,7 +2068,7 @@ Core.prototype._deserializeColumn = function (index, jsonObj) {
2068
2068
  this.setColumnData(index, value);
2069
2069
  }
2070
2070
 
2071
- let formatter = jsonObj["formatter"] || jsonObj["binding"]; // support both composite and real-time grid
2071
+ let formatter = jsonObj["binding"] || jsonObj["formatter"]; // support both composite and real-time grid, binding have piority first
2072
2072
  if(Array.isArray(formatter)) {
2073
2073
  formatter = formatter[0]; // Support only one formatter in the array
2074
2074
  }
@@ -262,10 +262,6 @@ LayoutGrid.prototype._colBounds = null;
262
262
  * @private
263
263
  */
264
264
  LayoutGrid.prototype._colBoundCache = null;
265
- /** @type {boolean}
266
- * @private
267
- */
268
- LayoutGrid.prototype._colSelDirty = false;
269
265
  /** @type {HScrollbar}
270
266
  * @private
271
267
  */
@@ -300,7 +296,6 @@ LayoutGrid.prototype.dispose = function () {
300
296
 
301
297
  this._colCount = this._rowCount = this._activeRowEnd = this._availableRowCount = 0;
302
298
  this._colBounds = this._colBoundCache = null;
303
- this._colSelDirty = false;
304
299
 
305
300
  this._highlightedCells.length = 0;
306
301
  this._ctx = null;
@@ -2011,7 +2006,7 @@ LayoutGrid.prototype._calculateViewSize = function (forceRecal) {
2011
2006
  if(!stretchSize && ctx) {
2012
2007
  if(ctx["getWidth"]) {
2013
2008
  let contentWidth = this.getContentWidth();
2014
- stretchSize = ctx["getWidth"]();
2009
+ stretchSize = ctx["getWidth"]() - this._rightSpaceSize;
2015
2010
  if(stretchSize) { // Grid may not be in the document
2016
2011
  if(contentWidth < stretchSize) { // If view width is larger than actual content
2017
2012
  stretchSize = contentWidth;
@@ -2247,8 +2242,6 @@ LayoutGrid.prototype.selectColumn = function (colIndex, selected) {
2247
2242
  this.enableColumnClass(colIndex, "selected-column", selected);
2248
2243
 
2249
2244
  if(selected) {
2250
- this._colSelDirty = true;
2251
-
2252
2245
  let boundLayer = this._boundLayer;
2253
2246
  if(!boundLayer) {
2254
2247
  this._initBoundLayer();
@@ -2376,10 +2369,6 @@ LayoutGrid.prototype.calculateColumnBounds = function (lftIdx, rgtIdx, outPositi
2376
2369
  * @param {number=} topPx Top position of bound
2377
2370
  */
2378
2371
  LayoutGrid.prototype.updateColumnBounds = function (posAry, noBorderAry, topPx) {
2379
- if(!this._colSelDirty) {
2380
- return;
2381
- }
2382
-
2383
2372
  let cbs = this._colBounds;
2384
2373
  let cbc = this._colBoundCache;
2385
2374
  if(!cbs) {
@@ -2406,7 +2395,6 @@ LayoutGrid.prototype.updateColumnBounds = function (posAry, noBorderAry, topPx)
2406
2395
  cbs.length = activeCount = rangeCount;
2407
2396
 
2408
2397
  if(!rangeCount) {
2409
- this._colSelDirty = false;
2410
2398
  return;
2411
2399
  }
2412
2400
 
@@ -2493,7 +2481,7 @@ LayoutGrid.prototype.updateColumnSeparators = function () {
2493
2481
  let colWidth = this._trackX.getLaneEnd(colCount - 1) - this._trackX.getLaneStart(colCount - pinnedRightCount);
2494
2482
  let viewSize = this._getViewSize();
2495
2483
 
2496
- colSeparator.style.left = (viewSize - colWidth - this._rightSpaceSize) + "px";
2484
+ colSeparator.style.left = (viewSize - colWidth) + "px";
2497
2485
  colSeparator.style.height = this._trackY.getTrackSize() + "px";
2498
2486
  } else {
2499
2487
  if (colSeparator && colSeparator.parentNode) {
@@ -2891,6 +2879,20 @@ LayoutGrid.prototype._onMouseOut = function (e) {
2891
2879
  this.setRowHighlight(-1);
2892
2880
  };
2893
2881
 
2882
+
2883
+ /** @public
2884
+ * @ignore
2885
+ * @return {!Object}
2886
+ */
2887
+ LayoutGrid.prototype._getEventHandlers = function () {
2888
+ return {
2889
+ "mouseout": this._onMouseOut,
2890
+ "mousemove": this._onMouseMove
2891
+ };
2892
+ };
2893
+
2894
+
2895
+
2894
2896
  /**
2895
2897
  * @private
2896
2898
  * @param {number} rowIndex
@@ -29,6 +29,7 @@ declare namespace FilterDialog {
29
29
  filterUI?: boolean|null,
30
30
  advancedFilter?: boolean|null,
31
31
  compactMode?: boolean|null,
32
+ dateTimeFormat?: string|null,
32
33
  blankValues?: (string|boolean)|null,
33
34
  filterChanged?: ((...params: any[]) => any)|null,
34
35
  confirm?: ((...params: any[]) => any)|null,
@@ -23,11 +23,12 @@ import "./checkbox-list.js";
23
23
  * @typedef {Object} FilterDialog~Config
24
24
  * @property {Object} data Column data
25
25
  * @property {string=} sortState "a" for ascending or "d" for descending
26
- * @property {boolean=} sortUI Show Sort area
27
- * @property {boolean=} filterUI Show Filter area
28
- * @property {boolean=} advancedFilter Show advanced tab
29
- * @property {boolean=} compactMode Force compact mode in dialog
30
- * @property {(string|boolean)=} blankValues Display a Blanks item in the filter dialog to represent an empty value. If a string is passed, it will be used as the label for the blank item
26
+ * @property {boolean=} sortUI=true Show Sort area
27
+ * @property {boolean=} filterUI=true Show Filter area
28
+ * @property {boolean=} advancedFilter=true Show advanced tab
29
+ * @property {boolean=} compactMode=false Force compact mode in dialog
30
+ * @property {string=} dateTimeFormat="dd-MM-yy" Specifies the string format for the date time picker in the filter dialog based on date-fns format, follow https://date-fns.org/v3.6.0/docs/format.
31
+ * @property {(string|boolean)=} blankValues=false Display a Blanks item in the filter dialog to represent an empty value. If a string is passed, it will be used as the label for the blank item
31
32
  * @property {Function=} filterChanged Filter changed handler
32
33
  * @property {Function=} confirm Alias of filterChanged
33
34
  * @property {Function=} cancel Alias of dialog cancel
@@ -77,6 +78,14 @@ const BLANK_FILTERS = [
77
78
  ["EQ_BLANK", "Equal To Blank Value"],
78
79
  ["NEQ_BLANK", "Does Not Equal To Blank Value"]
79
80
  ];
81
+ /** @type {Object.<string, boolean>}
82
+ * @private
83
+ * @constant
84
+ */
85
+ const BLANK_VALUES = {
86
+ "EQ_BLANK": true,
87
+ "NEQ_BLANK": true
88
+ };
80
89
  /** @type {Array.<Array>}
81
90
  * @private
82
91
  * @constant
@@ -179,6 +188,7 @@ class FilterDialog extends BasicElement {
179
188
  this._blankValuesChecked = false;
180
189
  this._compactMode = false;
181
190
  this.useUTCTime = true;
191
+ this._dateTimeFormat = "dd-MM-yy";
182
192
  this._popup = new Popup({
183
193
  "shown": this._onPopupShown.bind(this),
184
194
  "hidden": this._onPopupHidden.bind(this),
@@ -222,6 +232,10 @@ class FilterDialog extends BasicElement {
222
232
  this.hiddenFilterUI = options.filterUI === false;
223
233
  }
224
234
 
235
+ if (options.dateTimeFormat != null) {
236
+ this._dateTimeFormat = options.dateTimeFormat;
237
+ }
238
+
225
239
  if(options.advancedFilter != null) {
226
240
  this.hiddenAdvancedFilter = options.advancedFilter === false;
227
241
  }
@@ -294,6 +308,7 @@ class FilterDialog extends BasicElement {
294
308
  render() {
295
309
  let lang = this._translation[this._lang] ? this._lang : "en";
296
310
  let t = this._translation[lang];
311
+ let dateTimeFormat = this._dateTimeFormat;
297
312
  return html`
298
313
  <ef-panel id="root_panel" spacing with-shadow with-border>
299
314
  <div id="filterDialogContent" class="filter-dialog dialog-theme-wrapper">
@@ -336,14 +351,14 @@ class FilterDialog extends BasicElement {
336
351
  </div>
337
352
  <div class="input-group hide" id="datetime_conditon">
338
353
  <ef-combo-box placeholder="${t["Show rows where"]}:" lang="${lang}"></ef-combo-box>
339
- <ef-datetime-picker placeholder="DD-MM-YY" format="dd-MM-yy" lang="${lang}"></ef-datetime-picker>
354
+ <ef-datetime-picker placeholder="${dateTimeFormat}" format="${dateTimeFormat}" lang="${lang}"></ef-datetime-picker>
340
355
 
341
356
  <div class="radio-group">
342
357
  <ef-radio-button name="filterRadio" value="AND" checked>${t["And"]}</ef-radio-button>
343
358
  <ef-radio-button name="filterRadio" value="OR" >${t["Or"]}</ef-radio-button>
344
359
  </div>
345
360
  <ef-combo-box placeholder="${t["Show rows where"]}:" lang="${lang}"></ef-combo-box>
346
- <ef-datetime-picker placeholder="DD-MM-YY" format="dd-MM-yy" lang="${lang}"></ef-datetime-picker>
361
+ <ef-datetime-picker placeholder="${dateTimeFormat}" format="${dateTimeFormat}" lang="${lang}"></ef-datetime-picker>
347
362
  </div>
348
363
  </div>
349
364
  </div>
@@ -871,7 +886,6 @@ class FilterDialog extends BasicElement {
871
886
  * @private
872
887
  */
873
888
  _updateAdvanceFilterUI() {
874
- // Reset Advance Filter UIs
875
889
  this._clearAdvanceFilterUI();
876
890
 
877
891
  let userConditions = this.conditions || null;
@@ -883,66 +897,66 @@ class FilterDialog extends BasicElement {
883
897
  }
884
898
  }
885
899
 
886
- if (!Array.isArray(userConditions)) {
900
+ if (!Array.isArray(userConditions)) { // Expect 2D array
887
901
  return;
888
902
  }
889
903
 
890
- const con1 = userConditions[0];
891
- let validCon1 = false;
892
- let conOp1 = "";
893
- let conVal1 = "";
894
- let connector = "";
895
- if(Array.isArray(con1)) {
896
- conOp1 = con1[0];
897
- if(con1.length && con1[0]) {
898
- conVal1 = con1[1];
899
- if(conVal1 || conVal1 === 0 || conVal1 === false || conOp1 === BLANK_FILTERS[0][0] || conOp1 === BLANK_FILTERS[1][0]) {
900
- validCon1 = true;
901
- connector = con1[2] || "";
902
- } else {
903
- conVal1 = "";
904
- }
905
- }
904
+ const isDateType = toDateTimeType(this.fieldDataType);
905
+ const con1 = this._toConditionObject(userConditions[0], isDateType);
906
+ const con2 = con1 ? this._toConditionObject(userConditions[1], isDateType) : null;
907
+
908
+ let conSel1 = this._generalComboBoxes[0];
909
+ let valInput1 = this._generalComboBoxes[1];
910
+ let conSel2 = this._generalComboBoxes[2];
911
+ let valInput2 = this._generalComboBoxes[3];
912
+ let connectors = this._generalRadioBtns;
913
+
914
+ if (isDateType) {
915
+ conSel1 = this._dateTimeComboBoxes[0];
916
+ valInput1 = this._dateTimePickers[0];
917
+ conSel2 = this._dateTimeComboBoxes[1];
918
+ valInput2 = this._dateTimePickers[1];
919
+ connectors = this._dateTimeRadioBtns;
906
920
  }
907
-
908
- const con2 = userConditions[1];
909
- let validCon2 = false;
910
- let conOp2 = "";
911
- let conVal2 = "";
912
- if(validCon1 && Array.isArray(con2)) {
913
- conOp2 = con2[0];
914
- if(con2.length && conOp2) {
915
- conVal2 = con2[1];
916
- if(conVal2 || conVal2 === 0 || conVal2 === false || conOp2 === BLANK_FILTERS[0][0] || conOp2 === BLANK_FILTERS[1][0]) {
917
- validCon2 = true;
918
- } else {
919
- conVal2 = "";
920
- }
921
- }
921
+ if (con1) {
922
+ this._updateConditionUIs(conSel1, valInput1, con1.operator, con1.value);
922
923
  }
923
-
924
- let firstRadioState = true;
925
- if(validCon1 && validCon2) {
926
- firstRadioState = connector !== "OR";
924
+ if (con2) {
925
+ this._updateConditionUIs(conSel2, valInput2, con2.operator, con2.value);
927
926
  }
928
927
 
929
- if (toDateTimeType(this.fieldDataType)) {
930
- if (validCon1) {
931
- this._updateConditionUIs(this._dateTimeComboBoxes[0], this._dateTimePickers[0], conOp1, this._getDateString(conVal1));
932
- }
933
- if (validCon2) {
934
- this._updateConditionUIs(this._dateTimeComboBoxes[1], this._dateTimePickers[1], conOp2, this._getDateString(conVal2));
935
- }
936
- this._updateConnectorUIs(this._dateTimeRadioBtns, firstRadioState);
937
- } else {
938
- if (validCon1) {
939
- this._updateConditionUIs(this._generalComboBoxes[0], this._generalComboBoxes[1], conOp1, conVal1);
940
- }
941
- if (validCon2) {
942
- this._updateConditionUIs(this._generalComboBoxes[2], this._generalComboBoxes[3], conOp2, conVal2);
928
+ let andRadioBtn = (con1 && con2) ? (con1.connector !== "OR") : true;
929
+ connectors[0].checked = andRadioBtn; // AND radio button
930
+ connectors[1].checked = !andRadioBtn; // OR radio button
931
+ }
932
+ /**
933
+ * @private
934
+ * @param {Array} ary Condition in array format with length of three (e.g., ["LT", 5, "OR"])
935
+ * @param {boolean} isDateType
936
+ * @return {string}
937
+ */
938
+ _toConditionObject(ary, isDateType) {
939
+ if(Array.isArray(ary) && ary.length) {
940
+ let op = ary[0];
941
+ if(op) {
942
+ let val = ary[1];
943
+ if(val || val === 0 || val === false || BLANK_VALUES[op]) {
944
+ if(isDateType) {
945
+ let date = (ary.rawValue != null) ? ary.rawValue : val;
946
+ if(!(date instanceof Date)){
947
+ date = new Date(date);
948
+ }
949
+ val = DateTime.format(date.getTime(), "yyyy-MM-dd", this.useUTCTime ? "GMT" : "LOCAL");
950
+ }
951
+ return {
952
+ operator: op,
953
+ value: val,
954
+ connector: ary[2] || ""
955
+ };
956
+ }
943
957
  }
944
- this._updateConnectorUIs(this._generalRadioBtns, firstRadioState);
945
958
  }
959
+ return null;
946
960
  }
947
961
  /** @private
948
962
  * @param {Element} opCombobox
@@ -954,14 +968,7 @@ class FilterDialog extends BasicElement {
954
968
  opCombobox.value = opValue;
955
969
  valuePicker.value = value;
956
970
  }
957
- /** @private
958
- * @param {Array.<Element>} connectors
959
- * @param {boolean} connectorValue
960
- */
961
- _updateConnectorUIs(connectors, connectorValue) {
962
- connectors[0].checked = connectorValue;
963
- connectors[1].checked = !connectorValue;
964
- }
971
+
965
972
  /** @private
966
973
  * @returns {boolean}
967
974
  */
@@ -1076,19 +1083,6 @@ class FilterDialog extends BasicElement {
1076
1083
  };
1077
1084
  }
1078
1085
 
1079
- /**
1080
- * Return date string in format yyyy-MM-dd
1081
- * @private
1082
- * @param {Object|string} date
1083
- * @return {string}
1084
- */
1085
- _getDateString(date) {
1086
- if(!(date instanceof Date)){
1087
- date = new Date(date);
1088
- }
1089
- return DateTime.format(date.getTime(), "yyyy-MM-dd", this.useUTCTime ? "GMT" : "LOCAL");
1090
- }
1091
-
1092
1086
  /**
1093
1087
  * Return date object
1094
1088
  * @private
package/lib/grid/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import {Grid} from "./lib/efx-grid.js";
2
2
  export {Grid}
3
- window.EFX_GRID = { version: "6.0.136" };
3
+ window.EFX_GRID = { version: "6.0.138" };
@@ -13320,8 +13320,7 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
13320
13320
  obj["collapsed"] = val;
13321
13321
  }
13322
13322
 
13323
- // check row hidden
13324
- val = this._view.isHiddenRow(this._rowId);
13323
+ val = this._view ? this._view.isHiddenRow(this._rowId) : false;
13325
13324
  if(val) {
13326
13325
  obj["hidden"] = val;
13327
13326
  }
@@ -13895,19 +13894,6 @@ RowDefinition.deregisterFromView = function(rowIds, rowDef) {
13895
13894
  rowDef._deregisterFromView(rowIds);
13896
13895
  return rowIds;
13897
13896
  };
13898
- /** @private
13899
- * @param {string} ric
13900
- * @return {Object}
13901
- */
13902
- RowDefinition.prototype._getChildStaticRowData = function(ric) {
13903
- if(this._staticValues) {
13904
- let childValues = this._staticValues[RowDefinition._childDataField];
13905
- if(childValues) {
13906
- return childValues[ric] || null;
13907
- }
13908
- }
13909
- return null;
13910
- };
13911
13897
 
13912
13898
  /** @public
13913
13899
  * @ignore
@@ -13962,9 +13948,16 @@ RowDefinition.prototype.addConstituent = function(ric) {
13962
13948
  "parent": this
13963
13949
  };
13964
13950
 
13965
- let staticData = this._getChildStaticRowData(ric); // TODO: Remove the child's static data from parent
13966
- if(staticData) {
13967
- rowOptions["values"] = staticData;
13951
+ // Get child static values stored in this row
13952
+ if(this._staticValues) {
13953
+ let children = this._staticValues[RowDefinition._childDataField];
13954
+ if(children) {
13955
+ let childValues = children[ric];
13956
+ if(childValues) {
13957
+ rowOptions["values"] = childValues;
13958
+ children[ric] = null;
13959
+ }
13960
+ }
13968
13961
  }
13969
13962
 
13970
13963
  return new RowDefinition(rowOptions); // childDef is added to this._children in the constructor