@refinitiv-ui/efx-grid 6.0.68 → 6.0.70

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.
@@ -447,5 +447,7 @@ declare function path(obj: ElementWrapper|Element|Event|MouseEvent, context?: an
447
447
 
448
448
  declare function cellElement(): ElementWrapper;
449
449
 
450
+ declare function toR(): void;
451
+
450
452
  export default Core;
451
453
  export { Core };
@@ -33,6 +33,8 @@ import VirtualizedLayoutGrid from "./VirtualizedLayoutGrid.js";
33
33
  */
34
34
  /** @event Core#beforeContentBinding */
35
35
  /** @event Core#postSectionDataBinding */
36
+ /** @event Core#firstRendered */
37
+ /** @event Core#afterContentBinding */
36
38
  /** @event Core#rowHighlighted */
37
39
 
38
40
  /** @event Core#rowAdded
@@ -203,6 +205,8 @@ var Core = function (opt_initializer) {
203
205
  "beforeContentBinding",
204
206
  "preSectionDataBinding",
205
207
  "postSectionDataBinding",
208
+ "firstRendered",
209
+ "afterContentBinding",
206
210
  "rowExpansionBinding",
207
211
  "rowHighlighted",
208
212
  "preForcedUpdate",
@@ -555,6 +559,10 @@ Core.prototype._groupDefs = null;
555
559
  * @private
556
560
  */
557
561
  Core.prototype._batches = null;
562
+ /** @type {boolean}
563
+ * @private
564
+ */
565
+ Core.prototype._firstRendered = false;
558
566
  //#region Public Methods
559
567
 
560
568
  /**
@@ -562,7 +570,7 @@ Core.prototype._batches = null;
562
570
  * @return {string}
563
571
  */
564
572
  Core.getVersion = function () {
565
- return "5.1.77";
573
+ return "5.1.78";
566
574
  };
567
575
  /** {@link ElementWrapper#dispose}
568
576
  * @override
@@ -1370,6 +1378,7 @@ Core.prototype.getColumnCount = function () {
1370
1378
  * @fires Core#preSectionDataBinding
1371
1379
  * @fires Core#columnDataBinding
1372
1380
  * @fires Core#postSectionDataBinding
1381
+ * @fires Core#afterContentBinding
1373
1382
  */
1374
1383
  Core.prototype.setColumnCount = function(num) {
1375
1384
  var colCount = this._layoutX.getLaneCount();
@@ -1398,6 +1407,7 @@ Core.prototype.setColumnCount = function(num) {
1398
1407
  * @fires Core#preSectionDataBinding
1399
1408
  * @fires Core#columnDataBinding
1400
1409
  * @fires Core#postSectionDataBinding
1410
+ * @fires Core#afterContentBinding
1401
1411
  */
1402
1412
  Core.prototype.insertColumn = function (index, jsonObj) {
1403
1413
  var prevCount = this.getColumnCount();
@@ -2013,6 +2023,7 @@ Core.prototype._deserializeColumn = function (index, jsonObj) {
2013
2023
  * @fires Core#preSectionDataBinding
2014
2024
  * @fires Core#columnDataBinding
2015
2025
  * @fires Core#postSectionDataBinding
2026
+ * @fires Core#afterContentBinding
2016
2027
  */
2017
2028
  Core.prototype.addRow = function (opt_num) {
2018
2029
  if (opt_num == null) { opt_num = 1; }
@@ -3817,6 +3828,7 @@ Core.prototype.synchronizeHScrollbar = function (subGrid) {
3817
3828
  * @fires Core#preSectionDataBinding
3818
3829
  * @fires Core#columnDataBinding
3819
3830
  * @fires Core#postSectionDataBinding
3831
+ * @fires Core#afterContentBinding
3820
3832
  */
3821
3833
  Core.prototype.updateRowData = function (sectionRef, fromRowIndex, lastRowIndex, userParam) {
3822
3834
  var ss = this.getSectionSettings(sectionRef || "content");
@@ -4951,7 +4963,9 @@ Core.prototype._onSectionDataChanged = function (e) {
4951
4963
  rowDataCollection = dataView.getMultipleRowData(rids, fromR, toR);
4952
4964
  e["dataRows"] = rowDataCollection;
4953
4965
  }
4954
- if(e["sectionType"] === "content"){
4966
+
4967
+ var isContentSection = e["sectionType"] === "content";
4968
+ if(isContentSection){
4955
4969
  this._dispatch("beforeContentBinding", e);
4956
4970
  }
4957
4971
  this._dispatch("preSectionDataBinding", e);
@@ -4985,10 +4999,24 @@ Core.prototype._onSectionDataChanged = function (e) {
4985
4999
  this._dispatch("postSectionDataBinding", e);
4986
5000
  this._dispatchRowExpansionBinding(e);
4987
5001
 
5002
+ if(isContentSection){
5003
+ if(!this._firstRendered) {
5004
+ this._dispatch("firstRendered", e);
5005
+ this._firstRendered = true;
5006
+ }
5007
+ this._dispatch("afterContentBinding", e);
5008
+ }
4988
5009
  section._startBindingSession(false);
4989
5010
  this._dispatchingDataChanged = false;
4990
5011
  };
4991
5012
 
5013
+ /** @public
5014
+ * @ignore
5015
+ */
5016
+ Core.prototype.resetInternalState = function() {
5017
+ this._firstRendered = false;
5018
+ };
5019
+
4992
5020
  /** @private
4993
5021
  * @param {VScrollbar|HScrollbar} scrollbar
4994
5022
  * @returns {boolean}
@@ -417,7 +417,9 @@ class FilterDialog extends BasicElement {
417
417
  if (changedProps.has("isShown")) {
418
418
  if (this.isShown) {
419
419
  this._updateUIState(); // should updateUIState everytime popup being show
420
- this._popup.show(); // Update position
420
+ if(this._popup.isHidden()) { // If popup is not already in doc, append it
421
+ this._popup.show(); // Popup position will also be modified
422
+ }
421
423
  setTimeout(this._afterDialogOpened, 0); //use setTimeout to make sure everything is rendered before focus
422
424
  } else { // This is to handle the case where isShown is directly modified from the dialog. We need to synchronize the states
423
425
  this._popup.hide();
@@ -429,14 +431,23 @@ class FilterDialog extends BasicElement {
429
431
  * @private
430
432
  */
431
433
  _afterDialogOpened() {
432
- if(this.isShown) {
433
- this._cancelBtn.focus(); // Keep focus on cancel button when open dialog
434
- this._updateDialogHeight(true);
435
- if(!this._firstRendered) {
436
- this._firstRendered = true;
437
- this._popup.show(); // Update position
434
+ if(!this.isShown) {
435
+ return;
436
+ }
437
+
438
+ this._cancelBtn.focus(); // Keep focus on cancel button when open dialog
439
+ var positionUpdated = this._updateDialogHeight(true);
440
+ if(!this._firstRendered) {
441
+ this._firstRendered = true;
442
+ if(!positionUpdated) {
443
+ this._popup.updatePosition();
438
444
  }
439
445
  }
446
+
447
+ var popupElem = this._popup.getElement();
448
+ if(popupElem) {// After all changes, ensure that visibility is reset back
449
+ popupElem.style.visibility = "";
450
+ }
440
451
  }
441
452
 
442
453
  /** Initialize dialog
@@ -451,8 +462,11 @@ class FilterDialog extends BasicElement {
451
462
  * @public
452
463
  */
453
464
  show() {
465
+ var popupElem = this._popup.getElement();
466
+ if(popupElem) {// To prevent blinking due to size and position change
467
+ popupElem.style.visibility = "hidden";
468
+ }
454
469
  this._popup.appendChild(this); // To force first time initialization, focus is already included in updated()
455
-
456
470
  this._popup.show();
457
471
  }
458
472
 
@@ -566,18 +580,39 @@ class FilterDialog extends BasicElement {
566
580
  this._updateDialogHeight(true);
567
581
  }
568
582
 
583
+ /**
584
+ * @private
585
+ * @param {string} oper
586
+ * @param {*} val
587
+ * @returns {boolean}
588
+ */
589
+ _isValidCondition(oper, val) {
590
+ if(oper) {
591
+ if(val || val === 0) {
592
+ return true;
593
+ }
594
+ }
595
+ return false;
596
+ }
569
597
  /**
570
598
  * @private
571
599
  * @param {object} e - event
572
600
  */
573
601
  _onDoneBtnClick(e) {
574
- let context;
602
+ let eventArg = {
603
+ bubbles: false,
604
+ detail: {
605
+ fieldDataType: this.fieldDataType
606
+ }
607
+ };
575
608
  if (this._isAdvancedFilterMode()) {
576
609
  // Retrieve filter conditions from UI;
577
610
  let oper1, oper2, val1, val2, connector;
578
611
  var dateTimeType = toDateTimeType(this.fieldDataType);
579
612
  var fdt = dateTimeType ? dateTimeType : this.fieldDataType.toLowerCase();
613
+ var useUTCTime = false;
580
614
  if (fdt === DATE_TIME) {
615
+ useUTCTime = this.useUTCTime;
581
616
  oper1 = this._dateTimeComboBoxes[0].value;
582
617
  val1 = this._dateTimePickers[0].value;
583
618
  if(val1) {
@@ -624,29 +659,32 @@ class FilterDialog extends BasicElement {
624
659
  }
625
660
  }
626
661
  }
662
+ var ary2D = [];
663
+
664
+ if(this._isValidCondition(oper1, val1)) {
665
+ ary2D.push([oper1, val1]);
666
+ }
627
667
 
628
- context = {
629
- bubbles: false,
630
- detail: {
631
- conditions: [
632
- [oper1, val1, connector, fdt == DATE_TIME ? this.useUTCTime : null],
633
- [oper2, val2, null, fdt == DATE_TIME ? this.useUTCTime : null]
634
- ],
635
- fieldDataType: this.fieldDataType
668
+ if(this._isValidCondition(oper2, val2)) {
669
+ if(ary2D.length) {
670
+ ary2D[0][2] = connector;
636
671
  }
637
- };
672
+ ary2D.push([oper2, val2]);
673
+ }
674
+
675
+ if(useUTCTime) {
676
+ ary2D.forEach(function(itm) {
677
+ item[3] = true;
678
+ });
679
+ }
680
+
681
+ eventArg.detail.conditions = ary2D;
638
682
  } else {
639
- context = {
640
- bubbles: false,
641
- detail: {
642
- value: this._dataSelector.getSelectedItems(),
643
- fieldDataType: this.fieldDataType
644
- }
645
- };
683
+ eventArg.detail.value = this._dataSelector.getSelectedItems();
646
684
  }
647
685
 
648
- this.dispatchEvent(new CustomEvent("filterChanged", context));
649
- this.dispatchEvent(new CustomEvent("confirm", context));
686
+ this.dispatchEvent(new CustomEvent("filterChanged", eventArg));
687
+ this.dispatchEvent(new CustomEvent("confirm", eventArg));
650
688
  this.hide();
651
689
  }
652
690
 
@@ -811,6 +849,7 @@ class FilterDialog extends BasicElement {
811
849
  /**
812
850
  * @private
813
851
  * @param {boolean=} afterOpened
852
+ * @returns {boolean}
814
853
  */
815
854
  _updateDialogHeight(afterOpened) {
816
855
  if(!afterOpened) {
@@ -826,22 +865,24 @@ class FilterDialog extends BasicElement {
826
865
  const windowHeight = window.innerHeight;
827
866
  const dialogCoverage = position.y + dialogHeight;
828
867
  const heightDiff = dialogCoverage - windowHeight;
829
- const isAdvancedFilter = this._isAdvancedFilterMode();
830
- const minHeight = isAdvancedFilter ? 262 : 216;
831
- const compactThreshold = 409;
832
868
 
833
- if( heightDiff > 0 ){
869
+ if(heightDiff > 0) {
870
+ const isAdvancedFilter = this._isAdvancedFilterMode();
871
+ const minHeight = isAdvancedFilter ? 262 : 216;
834
872
  let newHeight = dialogHeight - heightDiff;
835
873
  if(newHeight < minHeight || isAdvancedFilter){
836
874
  newHeight = minHeight;
837
875
  }
838
876
  this._rootContainer.style.height = newHeight + "px";
839
877
 
878
+ const compactThreshold = 409;
840
879
  if(newHeight < compactThreshold){
841
880
  this._rootContainer.classList.add("compact");
842
881
  }
882
+ this._popup.updatePosition();
883
+ return true;
843
884
  }
844
- this._popup.updatePosition();
885
+ return false;
845
886
  }
846
887
  /**
847
888
  * @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.68" };
3
+ window.EFX_GRID = { version: "6.0.70" };
@@ -35691,6 +35691,8 @@ VirtualizedLayoutGrid._proto = VirtualizedLayoutGrid.prototype;
35691
35691
  */
35692
35692
  /** @event Core#beforeContentBinding */
35693
35693
  /** @event Core#postSectionDataBinding */
35694
+ /** @event Core#firstRendered */
35695
+ /** @event Core#afterContentBinding */
35694
35696
  /** @event Core#rowHighlighted */
35695
35697
 
35696
35698
  /** @event Core#rowAdded
@@ -35861,6 +35863,8 @@ var Core = function (opt_initializer) {
35861
35863
  "beforeContentBinding",
35862
35864
  "preSectionDataBinding",
35863
35865
  "postSectionDataBinding",
35866
+ "firstRendered",
35867
+ "afterContentBinding",
35864
35868
  "rowExpansionBinding",
35865
35869
  "rowHighlighted",
35866
35870
  "preForcedUpdate",
@@ -36213,6 +36217,10 @@ Core.prototype._groupDefs = null;
36213
36217
  * @private
36214
36218
  */
36215
36219
  Core.prototype._batches = null;
36220
+ /** @type {boolean}
36221
+ * @private
36222
+ */
36223
+ Core.prototype._firstRendered = false;
36216
36224
  //#region Public Methods
36217
36225
 
36218
36226
  /**
@@ -36220,7 +36228,7 @@ Core.prototype._batches = null;
36220
36228
  * @return {string}
36221
36229
  */
36222
36230
  Core.getVersion = function () {
36223
- return "5.1.77";
36231
+ return "5.1.78";
36224
36232
  };
36225
36233
  /** {@link ElementWrapper#dispose}
36226
36234
  * @override
@@ -37028,6 +37036,7 @@ Core.prototype.getColumnCount = function () {
37028
37036
  * @fires Core#preSectionDataBinding
37029
37037
  * @fires Core#columnDataBinding
37030
37038
  * @fires Core#postSectionDataBinding
37039
+ * @fires Core#afterContentBinding
37031
37040
  */
37032
37041
  Core.prototype.setColumnCount = function(num) {
37033
37042
  var colCount = this._layoutX.getLaneCount();
@@ -37056,6 +37065,7 @@ Core.prototype.setColumnCount = function(num) {
37056
37065
  * @fires Core#preSectionDataBinding
37057
37066
  * @fires Core#columnDataBinding
37058
37067
  * @fires Core#postSectionDataBinding
37068
+ * @fires Core#afterContentBinding
37059
37069
  */
37060
37070
  Core.prototype.insertColumn = function (index, jsonObj) {
37061
37071
  var prevCount = this.getColumnCount();
@@ -37671,6 +37681,7 @@ Core.prototype._deserializeColumn = function (index, jsonObj) {
37671
37681
  * @fires Core#preSectionDataBinding
37672
37682
  * @fires Core#columnDataBinding
37673
37683
  * @fires Core#postSectionDataBinding
37684
+ * @fires Core#afterContentBinding
37674
37685
  */
37675
37686
  Core.prototype.addRow = function (opt_num) {
37676
37687
  if (opt_num == null) { opt_num = 1; }
@@ -39475,6 +39486,7 @@ Core.prototype.synchronizeHScrollbar = function (subGrid) {
39475
39486
  * @fires Core#preSectionDataBinding
39476
39487
  * @fires Core#columnDataBinding
39477
39488
  * @fires Core#postSectionDataBinding
39489
+ * @fires Core#afterContentBinding
39478
39490
  */
39479
39491
  Core.prototype.updateRowData = function (sectionRef, fromRowIndex, lastRowIndex, userParam) {
39480
39492
  var ss = this.getSectionSettings(sectionRef || "content");
@@ -40609,7 +40621,9 @@ Core.prototype._onSectionDataChanged = function (e) {
40609
40621
  rowDataCollection = dataView.getMultipleRowData(rids, fromR, toR);
40610
40622
  e["dataRows"] = rowDataCollection;
40611
40623
  }
40612
- if(e["sectionType"] === "content"){
40624
+
40625
+ var isContentSection = e["sectionType"] === "content";
40626
+ if(isContentSection){
40613
40627
  this._dispatch("beforeContentBinding", e);
40614
40628
  }
40615
40629
  this._dispatch("preSectionDataBinding", e);
@@ -40643,10 +40657,24 @@ Core.prototype._onSectionDataChanged = function (e) {
40643
40657
  this._dispatch("postSectionDataBinding", e);
40644
40658
  this._dispatchRowExpansionBinding(e);
40645
40659
 
40660
+ if(isContentSection){
40661
+ if(!this._firstRendered) {
40662
+ this._dispatch("firstRendered", e);
40663
+ this._firstRendered = true;
40664
+ }
40665
+ this._dispatch("afterContentBinding", e);
40666
+ }
40646
40667
  section._startBindingSession(false);
40647
40668
  this._dispatchingDataChanged = false;
40648
40669
  };
40649
40670
 
40671
+ /** @public
40672
+ * @ignore
40673
+ */
40674
+ Core.prototype.resetInternalState = function() {
40675
+ this._firstRendered = false;
40676
+ };
40677
+
40650
40678
  /** @private
40651
40679
  * @param {VScrollbar|HScrollbar} scrollbar
40652
40680
  * @returns {boolean}
@@ -44332,7 +44360,6 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
44332
44360
  * @property {number=} contentRightPadding=0 Padding that is added next to the right most column. The padding is still a part of scrollable content.
44333
44361
  * @property {number=} contentBottomPadding=0 Padding that is added below the last section. The padding is still a part of scrollable content.
44334
44362
  * @property {number=} dataConflationRate=0 set delay for data to avoid to much sorting operation when data changed
44335
- * @property {Function=} dataComposed Handler for dataComposed event
44336
44363
  * @property {boolean=} autoDateConversion=false If enabled, date-time field with numeric value will be automatically converted to native date object.
44337
44364
  * @property {boolean=} textSelect=false If enabled, user can select content text by using mouse drag.
44338
44365
  * @property {string=} lang laguage for config localization date time, if null the default language is "en"
@@ -44344,6 +44371,10 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
44344
44371
  * @property {string=} childDataField=CHILD_VALUES The given field will be used to store children's static data, such as row color assignment.
44345
44372
  * @property {boolean=} topSection=true If disabled, title section will not be rendered
44346
44373
  * @property {SortableTitlePlugin~Options=} sorting Options for sorting
44374
+ * @property {Function=} dataComposed Handler for dataComposed event
44375
+ * @property {Function=} beforeContentBinding Handler for beforeContentBinding event
44376
+ * @property {Function=} firstRendered Handler for firstRendered event
44377
+ * @property {Function=} afterContentBinding Handler for afterContentBinding event
44347
44378
  */
44348
44379
 
44349
44380
  /** @typedef {number|string|RowDefinition} Grid~RowReference
@@ -44414,6 +44445,16 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
44414
44445
  * @description Trigger before content binding.
44415
44446
  */
44416
44447
 
44448
+ /** @event Grid#firstRendered
44449
+ * @property {Object} e Event of firstRendered
44450
+ * @description This event is triggered when the content is rendered for the first time.
44451
+ */
44452
+
44453
+ /** @event Grid#afterContentBinding
44454
+ * @property {Object} e Event of afterContentBinding
44455
+ * @description Trigger after content binding.
44456
+ */
44457
+
44417
44458
  /** @event Grid#beforeRowRemoved
44418
44459
  * @description Fired only when a row will be removed through Grid's API and before occurring of the actual removal
44419
44460
  */
@@ -44568,7 +44609,6 @@ var Grid = function(placeholder, config) {
44568
44609
  t.updateColumnTitle = t.updateColumnTitle.bind(t);
44569
44610
  t._populateTimeSeriesChildren = t._populateTimeSeriesChildren.bind(t);
44570
44611
 
44571
- t._onBeforeContentBinding = t._onBeforeContentBinding.bind(t);
44572
44612
  t._onPostSectionDataBinding = t._onPostSectionDataBinding.bind(t);
44573
44613
  t._asyncClearDataUpdates = t._asyncClearDataUpdates.bind(t);
44574
44614
  t._clearDataUpdates = t._clearDataUpdates.bind(t);
@@ -44661,9 +44701,11 @@ var Grid = function(placeholder, config) {
44661
44701
  t._grid.loadPlugin(t._stp, config);
44662
44702
  }
44663
44703
 
44664
- t._grid.listen("beforeContentBinding", t._onBeforeContentBinding);
44704
+ t._grid.listen("beforeContentBinding", t._dispatch.bind(t, "beforeContentBinding"));
44665
44705
  t._grid.listen("preSectionRender", t._onColumnHeaderBinding);
44666
44706
  t._grid.listen("postSectionDataBinding", t._onPostSectionDataBinding);
44707
+ t._grid.listen("firstRendered", t._dispatch.bind(t, "firstRendered"));
44708
+ t._grid.listen("afterContentBinding", t._dispatch.bind(t, "afterContentBinding"));
44667
44709
 
44668
44710
  t._grid.enableRowHighlighting(true);
44669
44711
 
@@ -45071,6 +45113,7 @@ Grid.prototype.initialize = function(gridOption) {
45071
45113
  var t = this; // For minimizing file size
45072
45114
  t._initializing = true;
45073
45115
  var grid = t._grid; // core grid
45116
+ grid.resetInternalState();
45074
45117
  gridOption = grid.normalizeConfig(gridOption);
45075
45118
 
45076
45119
  var exts = gridOption["plugins"] || gridOption["extensions"];
@@ -45177,10 +45220,10 @@ Grid.prototype.initialize = function(gridOption) {
45177
45220
  t.listen("rowExpansionBinding", rowExpansionBinding);
45178
45221
  }
45179
45222
 
45180
- var dataComposedHandler = gridOption["dataComposed"];
45181
- if(typeof dataComposedHandler === "function") {
45182
- t.listen("dataComposed", dataComposedHandler);
45183
- }
45223
+ this.addListener(gridOption, "dataComposed");
45224
+ this.addListener(gridOption, "beforeContentBinding");
45225
+ this.addListener(gridOption, "firstRendered");
45226
+ this.addListener(gridOption, "afterContentBinding");
45184
45227
 
45185
45228
  if(gridOption["autoDateConversion"]) {
45186
45229
  t._autoDateConversion = true;
@@ -46836,7 +46879,6 @@ Grid.prototype.removeAllRows = function() {
46836
46879
 
46837
46880
  // TODO: This logic should also be in the core grid
46838
46881
  this._grid.getVScrollbar().setScrollTop(0);
46839
- this._grid.getHScrollbar().setScrollLeft(0);
46840
46882
  };
46841
46883
  /** WARNING: This does not remove data stored in the data cache
46842
46884
  * @private
@@ -47794,13 +47836,6 @@ Grid.prototype._mainSorter = function (rowDefA, rowDefB, order) {
47794
47836
  return this._columnSorter(rowDefA, rowDefB, order);
47795
47837
  };
47796
47838
 
47797
- /** @private
47798
- * @param {Object} e
47799
- */
47800
- Grid.prototype._onBeforeContentBinding = function(e) {
47801
- this._dispatch("beforeContentBinding", e);
47802
- };
47803
-
47804
47839
  /** @private
47805
47840
  * @param {Object} e
47806
47841
  */