@refinitiv-ui/efx-grid 6.0.116 → 6.0.118

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. package/lib/core/dist/core.js +214 -42
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/grid/Core.js +9 -2
  4. package/lib/grid/index.js +1 -1
  5. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  6. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  7. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  8. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  9. package/lib/grid/themes/solar/charcoal/efx-grid.js +1 -1
  10. package/lib/grid/themes/solar/charcoal/es5/all-elements.js +1 -1
  11. package/lib/grid/themes/solar/pearl/efx-grid.js +1 -1
  12. package/lib/grid/themes/solar/pearl/es5/all-elements.js +1 -1
  13. package/lib/row-segmenting/es6/RowSegmenting.js +74 -29
  14. package/lib/rt-grid/dist/rt-grid.js +324 -141
  15. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  16. package/lib/rt-grid/es6/ColumnDefinition.js +5 -2
  17. package/lib/rt-grid/es6/DataConnector.d.ts +2 -0
  18. package/lib/rt-grid/es6/DataConnector.js +8 -0
  19. package/lib/rt-grid/es6/Grid.d.ts +4 -0
  20. package/lib/rt-grid/es6/Grid.js +39 -1
  21. package/lib/rt-grid/es6/ReferenceCounter.d.ts +2 -0
  22. package/lib/rt-grid/es6/ReferenceCounter.js +10 -0
  23. package/lib/rt-grid/es6/RowDefinition.js +28 -34
  24. package/lib/tr-grid-auto-tooltip/es6/AutoTooltip.d.ts +1 -0
  25. package/lib/tr-grid-auto-tooltip/es6/AutoTooltip.js +200 -26
  26. package/lib/tr-grid-contextmenu/es6/ContextMenu.js +11 -0
  27. package/lib/tr-grid-contextmenu/es6/MenuEventAPI.d.ts +1 -1
  28. package/lib/tr-grid-contextmenu/es6/MenuEventAPI.js +13 -8
  29. package/lib/tr-grid-contextmenu/es6/MenuItem.d.ts +3 -1
  30. package/lib/tr-grid-contextmenu/es6/MenuItem.js +75 -35
  31. package/lib/tr-grid-contextmenu/es6/PopupMenu.d.ts +5 -1
  32. package/lib/tr-grid-contextmenu/es6/PopupMenu.js +70 -59
  33. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +3 -0
  34. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +115 -28
  35. package/lib/tr-grid-util/es6/GroupDefinitions.js +1 -1
  36. package/lib/types/es6/InCellEditing.d.ts +3 -0
  37. package/lib/types/es6/MenuEventAPI.d.ts +1 -1
  38. package/lib/types/es6/MenuItem.d.ts +3 -1
  39. package/lib/types/es6/PopupMenu.d.ts +5 -1
  40. package/lib/types/es6/RealtimeGrid/DataConnector.d.ts +2 -0
  41. package/lib/types/es6/RealtimeGrid/Grid.d.ts +4 -0
  42. package/lib/types/es6/RealtimeGrid/ReferenceCounter.d.ts +2 -0
  43. package/lib/versions.json +5 -5
  44. package/package.json +2 -2
@@ -6,6 +6,7 @@ import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
6
6
  import { isTouchDevice, injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
7
7
  import { ElfDate } from "../../tr-grid-util/es6/ElfDate.js";
8
8
  import { CoralItems } from "../../tr-grid-util/es6/CoralItems.js";
9
+ import { Conflator } from "../../tr-grid-util/es6/Conflator.js";
9
10
 
10
11
  /** @typedef {Object} InCellEditingPlugin~Options
11
12
  * @description InCellEditingPlugin options that can be specified from `inCellEditing` property of the main grid's options
@@ -193,6 +194,12 @@ let InCellEditingPlugin = function (options) {
193
194
  t._onAutoSuggestItemSelected = t._onAutoSuggestItemSelected.bind(t);
194
195
  t._firstRendered = t._firstRendered.bind(t);
195
196
  t._onGridKeyDown = t._onGridKeyDown.bind(t);
197
+ t._onRicAdded = t._onRicAdded.bind(t);
198
+ t._onRicRemoved = t._onRicRemoved.bind(t);
199
+ t._onColumnChanged = t._onColumnChanged.bind(t);
200
+ t._onRowCountChanged = t._onRowCountChanged.bind(t);
201
+ t._requestUpdateStarterText = t._requestUpdateStarterText.bind(t);
202
+ t._updateStarterTextConflator = new Conflator(100, this._requestUpdateStarterText);
196
203
  t._hosts = [];
197
204
 
198
205
  if(options) {
@@ -581,6 +588,37 @@ InCellEditingPlugin.prototype._onColumnAdded = function(e) {
581
588
  }
582
589
  };
583
590
 
591
+ /** @private
592
+ * @param {Event} e
593
+ */
594
+ InCellEditingPlugin.prototype._onRicAdded = function(e) {
595
+ this._requestUpdateStarterText(false);
596
+ };
597
+
598
+ /** @private
599
+ * @param {Event} e
600
+ */
601
+ InCellEditingPlugin.prototype._onRicRemoved = function(e) {
602
+ if(this._realTimeGrid && !this._realTimeGrid.hasRic()) {
603
+ this._requestUpdateStarterText();
604
+ }
605
+ };
606
+
607
+ /** @private
608
+ * @param {Event} e
609
+ */
610
+ InCellEditingPlugin.prototype._onColumnChanged = function(e) {
611
+ this._requestUpdateStarterText();
612
+ };
613
+
614
+
615
+ /** @private
616
+ * @param {Event} e
617
+ */
618
+ InCellEditingPlugin.prototype._onRowCountChanged = function(e) {
619
+ this._requestUpdateStarterText();
620
+ };
621
+
584
622
  /** Called by grid system when initial plugins.
585
623
  * @public
586
624
  * @param {Object} host core grid object
@@ -596,6 +634,10 @@ InCellEditingPlugin.prototype.initialize = function (host, options) {
596
634
  host.listen("columnAdded", this._onColumnAdded);
597
635
  host.listen("firstRendered", this._firstRendered);
598
636
  host.listen("keydown", this._onGridKeyDown);
637
+ host.listen("columnAdded", this._onColumnChanged);
638
+ host.listen("columnRemoved", this._onColumnChanged);
639
+ host.listen("rowAdded", this._onRowCountChanged);
640
+ host.listen("rowRemoved", this._onRowCountChanged);
599
641
 
600
642
  host.getVScrollbar().listen("scroll", this._onScroll);
601
643
  host.getHScrollbar().listen("scroll", this._onScroll);
@@ -658,13 +700,17 @@ InCellEditingPlugin.prototype.beforeProcessOption = function (optionName, option
658
700
  */
659
701
  InCellEditingPlugin.prototype._afterInit = function () {
660
702
  this._elfVersion = ElfUtil.getElfVersion();
703
+ if(this._realTimeGrid) {
704
+ this._realTimeGrid.listen("ricAdded", this._onRicAdded);
705
+ this._realTimeGrid.listen("ricRemoved", this._onRicRemoved);
706
+ }
661
707
  };
662
708
 
663
709
  /** @private
664
710
  */
665
711
  InCellEditingPlugin.prototype._firstRendered = function () {
666
712
  if(!this._readonly && this._starterText) {
667
- this.showStarterText();
713
+ this._requestUpdateStarterText();
668
714
  }
669
715
  };
670
716
 
@@ -897,6 +943,12 @@ InCellEditingPlugin.prototype.unload = function (host) {
897
943
  this._hosts.splice(at, 1);
898
944
 
899
945
  host.unlisten("columnAdded", this._onColumnAdded);
946
+ host.unlisten("firstRendered", this._firstRendered);
947
+ host.unlisten("keydown", this._onGridKeyDown);
948
+ host.unlisten("columnAdded", this._onColumnChanged);
949
+ host.unlisten("columnRemoved", this._onColumnChanged);
950
+ host.unlisten("rowAdded", this._onRowCountChanged);
951
+ host.unlisten("rowRemoved", this._onRowCountChanged);
900
952
  host.getVScrollbar().unlisten("scroll", this._onScroll);
901
953
  host.getHScrollbar().unlisten("scroll", this._onScroll);
902
954
 
@@ -916,6 +968,11 @@ InCellEditingPlugin.prototype.unload = function (host) {
916
968
  if(this._starterTextPopup) {
917
969
  this._starterTextPopup.dispose();
918
970
  }
971
+ if(this._realTimeGrid && this._starterText) {
972
+ this._realTimeGrid.removeEventListener("ricAdded", this._onRicAdded);
973
+ this._realTimeGrid.removeEventListener("ricRemoved", this._onRicRemoved);
974
+ }
975
+ this._updateStarterTextConflator.reset();
919
976
  }
920
977
  if(this.isEditing()) {
921
978
  this.closeRowEditor(false);
@@ -1061,60 +1118,85 @@ InCellEditingPlugin.prototype._onGridKeyDown = function (e) {
1061
1118
  * @param {boolean=} bool
1062
1119
  */
1063
1120
  InCellEditingPlugin.prototype.showStarterText = function (bool) {
1064
- setTimeout(this._showStarterText.bind(this, bool), 0); // Need to delay to wait scrollbar or editor closed
1121
+ this._requestUpdateStarterText();
1065
1122
  };
1066
1123
 
1067
-
1068
1124
  /**
1069
- * @private
1070
- * @param {boolean=} bool
1125
+ * @description Request to show starter text
1126
+ * @public
1071
1127
  */
1072
- InCellEditingPlugin.prototype._showStarterText = function (bool) {
1128
+ InCellEditingPlugin.prototype._requestUpdateStarterText = function () {
1073
1129
  if(!this._realTimeGrid || !this._starterText) {
1074
1130
  return;
1075
1131
  }
1076
- let allRics = this._realTimeGrid.getAllRics();
1077
- if(allRics.length > 0) {
1132
+ if(this._updateStarterTextConflator.conflate()){
1133
+ return;
1134
+ }
1135
+ this._updateStaterText();
1136
+ };
1137
+
1138
+ /**
1139
+ * @private
1140
+ * @param {boolean=} force
1141
+ */
1142
+ InCellEditingPlugin.prototype._updateStaterText = function (force) {
1143
+ if(!this._realTimeGrid || !this._starterText) {
1078
1144
  return;
1079
1145
  }
1080
- let popupElem;
1146
+ // TODO: handled grid have ric but no one rows.
1147
+ let popup;
1081
1148
  if(!this._starterTextPopup) {
1082
- popupElem = this._starterTextPopup = this._createStaterTextElement();
1149
+ popup = this._starterTextPopup = this._createStaterTextElement();
1083
1150
  } else {
1084
- popupElem = this._starterTextPopup;
1151
+ popup = this._starterTextPopup;
1085
1152
  }
1086
- if(bool === false) {
1087
- popupElem.hide();
1153
+ if(force === false || this._realTimeGrid.hasRic()) {
1154
+ popup.hide();
1088
1155
  return;
1089
1156
  }
1090
1157
  let grid = this._hosts[0];
1091
1158
 
1159
+ let contentSection = grid.getSection("content");
1160
+ if(!contentSection || contentSection.getRowCount() <= 0) { // WARNING: Core grid is include title section but realtime grid not include
1161
+ popup.hide();
1162
+ return;
1163
+ }
1164
+
1092
1165
  let editableColIndex = this._getFirstEditableColumnIndex();
1093
1166
  if(editableColIndex < 0) { // not editable
1167
+ popup.hide();
1094
1168
  return;
1095
1169
  }
1096
- grid.scrollToRow("content", 0, true);
1097
- let editableCell = grid.getCell("content", editableColIndex, 0);
1098
- popupElem.attachTo(editableCell.getElement());
1099
- popupElem.show(bool, grid.getElement().parentElement);
1170
+ if(grid.getScrollTop()) {
1171
+ grid.setScrollTop(0);
1172
+ }
1173
+
1174
+ let editableCell = contentSection.getCell(editableColIndex, 0);
1175
+ let pos = grid.getRelativePosition(editableCell);
1176
+ if(pos) {
1177
+ let popupElem = popup.getElement();
1178
+ popupElem.style.top = pos.y + "px";
1179
+ popupElem.style.left = pos.x + "px";
1180
+ }
1181
+ popup.show(force, grid.getParent());
1100
1182
  };
1101
1183
 
1102
1184
  /** @private
1103
1185
  * @return {number}
1104
1186
  */
1105
1187
  InCellEditingPlugin.prototype._getFirstEditableColumnIndex = function () {
1106
- if(this._readonly || !this._editableContent) {
1188
+ if(this._readonly) {
1107
1189
  return -1;
1108
1190
  }
1109
-
1110
1191
  let colCount = this.getColumnCount();
1192
+ let editableCol = -1;
1111
1193
  for (let i = 0; i < colCount; i++) {
1112
- let editableCol = this.isColumnEditable(i);
1113
- if(editableCol) {
1114
- return i;
1194
+ if(this.isColumnEditable(i)) { // this._editableContent already check in this method
1195
+ editableCol = i;
1196
+ break;
1115
1197
  }
1116
1198
  }
1117
- return -1;
1199
+ return editableCol;
1118
1200
  };
1119
1201
 
1120
1202
  /** @private
@@ -1124,9 +1206,14 @@ InCellEditingPlugin.prototype._createStaterTextElement = function () {
1124
1206
  let container = document.createElement("div");
1125
1207
  container.textContent = this._starterText;
1126
1208
  container.className = "starter-text";
1127
- let popup = new Popup(container, { positioning: "over"});
1128
- popup.disableAutoHiding(true);
1129
- popup.disableHideOnScroll(true);
1209
+ let popup = window.popup = new Popup(container, {
1210
+ positioning: "custom",
1211
+ autoHiding: false,
1212
+ autoRepositioning: false,
1213
+ hideOnScroll: false
1214
+ });
1215
+ let popupElement = popup.getElement();
1216
+ popupElement.style.position = "absolute";
1130
1217
  return popup;
1131
1218
  };
1132
1219
 
@@ -1550,7 +1637,7 @@ InCellEditingPlugin.prototype._openEditor = function (e, host, arg) {
1550
1637
 
1551
1638
  // Dispatch an event for user to setup stuff
1552
1639
  t._dispatch("editorOpened", arg); // User may modify the editor
1553
- t.showStarterText(false);
1640
+ t._updateStaterText(false); // Currently Starter text open doesn't have the ric, it needs to be forcefully hide
1554
1641
 
1555
1642
  inputElement.focus();
1556
1643
  if(typeof inputElement.select === "function") {
@@ -2078,7 +2165,7 @@ InCellEditingPlugin.prototype._commitText = function (committed, suggestionDetai
2078
2165
  Dom.removeParent(t._customElement);
2079
2166
 
2080
2167
  let grid = arg["grid"];
2081
- this.showStarterText();
2168
+ this._requestUpdateStarterText(); // Need to updaate starter text when text commit
2082
2169
  if(grid) {
2083
2170
  t._freezeScrolling(grid, false);
2084
2171
  grid.focus();
@@ -116,7 +116,7 @@ GroupDefinitions._toGroupDefinition = function(obj, groupId) {
116
116
  groupDef = GroupDefinitions._cloneObject(obj);
117
117
  }
118
118
  if(groupId) {
119
- if(!groupDef.id) {
119
+ if(!groupDef.name) {
120
120
  groupDef.name = groupId;
121
121
  }
122
122
  groupDef.id = groupId;
@@ -6,6 +6,7 @@ import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
6
6
  import { isTouchDevice, injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
7
7
  import { ElfDate } from "../../tr-grid-util/es6/ElfDate.js";
8
8
  import { CoralItems } from "../../tr-grid-util/es6/CoralItems.js";
9
+ import { Conflator } from "../../tr-grid-util/es6/Conflator.js";
9
10
 
10
11
  declare namespace InCellEditingPlugin {
11
12
 
@@ -85,6 +86,8 @@ declare class InCellEditingPlugin extends GridPlugin {
85
86
 
86
87
  public showStarterText(bool?: boolean|null): void;
87
88
 
89
+ public _requestUpdateStarterText(): void;
90
+
88
91
  public isEditing(): boolean;
89
92
 
90
93
  public getTextBox(columnIndex?: number|null, grid?: any): Element|null;
@@ -14,7 +14,7 @@ declare class MenuEventAPI {
14
14
 
15
15
  public getMenuItems(): any[]|null;
16
16
 
17
- public findItem(id: number): (string)[] | any|null;
17
+ public findItem(id: number): any[]|null;
18
18
 
19
19
  }
20
20
 
@@ -3,7 +3,7 @@ import Ext from "../../tr-grid-util/es6/Ext.js";
3
3
 
4
4
  declare class MenuItem extends EventDispatcher {
5
5
 
6
- constructor(options: any);
6
+ constructor(options?: any);
7
7
 
8
8
  public dispose(): void;
9
9
 
@@ -33,6 +33,8 @@ declare class MenuItem extends EventDispatcher {
33
33
 
34
34
  public getElement(): Element|null;
35
35
 
36
+ public getOptions(): any;
37
+
36
38
  }
37
39
 
38
40
  export default MenuItem;
@@ -21,7 +21,11 @@ declare class PopupMenu extends EventDispatcher {
21
21
 
22
22
  public addPopupChild(element: Element|null, popupMenu: PopupMenu|null): void;
23
23
 
24
- public setMenu(menuItems: (any)[]|null): void;
24
+ public setMenu(menuOptions: (any)[]|null): void;
25
+
26
+ public getMenuItems(): (MenuItem)[]|null;
27
+
28
+ public getChildPopups(): (PopupMenu)[]|null;
25
29
 
26
30
  }
27
31
 
@@ -11,6 +11,8 @@ declare class DataConnector extends EventDispatcher {
11
11
 
12
12
  public getAllRics(): (string)[]|null;
13
13
 
14
+ public hasRic(): boolean;
15
+
14
16
  public getAllRowDefs(): (RowDefinition)[]|null;
15
17
 
16
18
  public getAllFields(): (string)[];
@@ -293,6 +293,8 @@ declare class Grid extends EventDispatcher {
293
293
 
294
294
  public getAllRics(): (string)[]|null;
295
295
 
296
+ public hasRic(): boolean;
297
+
296
298
  public setRowData(rowRef: Grid.RowReference|null, values: any): void;
297
299
 
298
300
  public setStaticRowData(rowRef: Grid.RowReference|null, values: any): void;
@@ -333,6 +335,8 @@ declare class Grid extends EventDispatcher {
333
335
 
334
336
  public clearSort(): void;
335
337
 
338
+ public getSortingStates(): (any)[];
339
+
336
340
  public getDataView(): DataView|null;
337
341
 
338
342
  public setPage(pageIndex: number): boolean;
@@ -10,6 +10,8 @@ declare class ReferenceCounter {
10
10
 
11
11
  public getAllReferences(): (string)[];
12
12
 
13
+ public hasReference(): boolean;
14
+
13
15
  public getAllReferers(): (string)[];
14
16
 
15
17
  public getAllReferrers(): (string)[];
package/lib/versions.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
- "tr-grid-util": "1.3.155",
2
+ "tr-grid-util": "1.3.156",
3
3
  "tr-grid-printer": "1.0.18",
4
4
  "@grid/column-dragging": "1.0.20",
5
- "@grid/row-segmenting": "1.0.31",
5
+ "@grid/row-segmenting": "1.0.33",
6
6
  "@grid/statistics-row": "1.0.17",
7
7
  "@grid/zoom": "1.0.11",
8
- "tr-grid-auto-tooltip": "1.1.6",
8
+ "tr-grid-auto-tooltip": "1.1.7",
9
9
  "tr-grid-cell-selection": "1.0.38",
10
10
  "tr-grid-checkbox": "1.0.67",
11
11
  "tr-grid-column-fitter": "1.0.41",
@@ -16,10 +16,10 @@
16
16
  "tr-grid-column-stack": "1.0.75",
17
17
  "tr-grid-conditional-coloring": "1.0.70",
18
18
  "tr-grid-content-wrap": "1.0.20",
19
- "tr-grid-contextmenu": "1.0.42",
19
+ "tr-grid-contextmenu": "1.0.44",
20
20
  "tr-grid-filter-input": "0.9.41",
21
21
  "tr-grid-heat-map": "1.0.29",
22
- "tr-grid-in-cell-editing": "1.0.87",
22
+ "tr-grid-in-cell-editing": "1.0.89",
23
23
  "tr-grid-pagination": "1.0.24",
24
24
  "tr-grid-percent-bar": "1.0.24",
25
25
  "tr-grid-range-bar": "2.0.8",
package/package.json CHANGED
@@ -64,10 +64,10 @@
64
64
  },
65
65
  "peerDependencies": {
66
66
  "@refinitiv-ui/core": "^6.2.0 || ^7.0.0",
67
- "@refinitiv-ui/elements": "^6.5.0 || ^7.0.0"
67
+ "@refinitiv-ui/elements": "^6.15.0 || ^7.0.0"
68
68
  },
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "version": "6.0.116"
72
+ "version": "6.0.118"
73
73
  }