@refinitiv-ui/efx-grid 6.0.2 → 6.0.5

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.
Files changed (203) hide show
  1. package/lib/column-dragging/es6/ColumnDragging.d.ts +49 -0
  2. package/lib/column-dragging/es6/ColumnDragging.js +764 -0
  3. package/lib/column-dragging/es6/index.d.ts +1 -0
  4. package/lib/column-dragging/es6/index.js +1 -0
  5. package/lib/column-format-dialog/lib/column-format-dialog.d.ts +13 -1
  6. package/lib/column-selection-dialog/lib/column-selection-dialog.d.ts +15 -2
  7. package/lib/column-selection-dialog/lib/column-selection-dialog.js +146 -5
  8. package/lib/core/dist/core.css +1 -1
  9. package/lib/core/dist/core.js +468 -1092
  10. package/lib/core/dist/core.min.js +1 -1
  11. package/lib/core/es6/data/ColumnStats.d.ts +2 -2
  12. package/lib/core/es6/data/DataCache.d.ts +4 -4
  13. package/lib/core/es6/data/DataTable.d.ts +5 -5
  14. package/lib/core/es6/data/DataTable.js +33 -11
  15. package/lib/core/es6/data/DataView.d.ts +12 -18
  16. package/lib/core/es6/data/DataView.js +0 -4
  17. package/lib/core/es6/data/Segment.d.ts +2 -0
  18. package/lib/core/es6/data/Segment.js +7 -0
  19. package/lib/core/es6/data/SegmentCollection.d.ts +3 -3
  20. package/lib/core/es6/data/WrappedView.d.ts +13 -13
  21. package/lib/core/es6/data/WrappedView.js +6 -6
  22. package/lib/core/es6/grid/Core.d.ts +31 -27
  23. package/lib/core/es6/grid/Core.js +47 -11
  24. package/lib/core/es6/grid/ILayoutGrid.d.ts +15 -15
  25. package/lib/core/es6/grid/LayoutGrid.js +54 -26
  26. package/lib/core/es6/grid/VirtualizedLayoutGrid.js +71 -0
  27. package/lib/core/es6/grid/components/Cell.d.ts +4 -4
  28. package/lib/core/es6/grid/components/CellFloatingPanel.d.ts +1 -1
  29. package/lib/core/es6/grid/components/CellSpans.d.ts +8 -8
  30. package/lib/core/es6/grid/components/Column.d.ts +1 -1
  31. package/lib/core/es6/grid/components/ElementWrapper.d.ts +6 -6
  32. package/lib/core/es6/grid/components/Scrollbar.d.ts +3 -1
  33. package/lib/core/es6/grid/components/Scrollbar.js +13 -0
  34. package/lib/core/es6/grid/components/StretchedCells.js +2 -2
  35. package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +14 -6
  36. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +147 -81
  37. package/lib/core/es6/grid/util/Conflator.d.ts +2 -2
  38. package/lib/core/es6/grid/util/ElementFrameWork.d.ts +3 -3
  39. package/lib/core/es6/grid/util/HttpRequest.d.ts +2 -2
  40. package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +1 -1
  41. package/lib/core/es6/grid/util/RangeBar.d.ts +1 -1
  42. package/lib/core/es6/grid/util/SectionSettings.d.ts +5 -5
  43. package/lib/core/es6/grid/util/SectionSettings.js +5 -0
  44. package/lib/core/es6/grid/util/SelectionList.d.ts +2 -2
  45. package/lib/core/es6/grid/util/TrackLayout.d.ts +7 -3
  46. package/lib/core/es6/grid/util/TrackLayout.js +27 -0
  47. package/lib/core/es6/grid/util/util.d.ts +2 -2
  48. package/lib/core/es6/index.d.ts +1 -5
  49. package/lib/core/es6/index.js +1 -7
  50. package/lib/core/es6/tr-grid-theme.js +1 -1
  51. package/lib/filter-dialog/lib/checkbox-list.d.ts +13 -1
  52. package/lib/filter-dialog/lib/filter-dialog.d.ts +14 -1
  53. package/lib/filter-dialog/lib/filter-dialog.js +86 -26
  54. package/lib/filter-dialog/themes/base-checkbox.less +8 -1
  55. package/lib/filter-dialog/themes/base.less +69 -1
  56. package/lib/filter-dialog/themes/elemental/dark/checkbox-list.js +1 -1
  57. package/lib/filter-dialog/themes/elemental/dark/es5/all-elements.js +2 -2
  58. package/lib/filter-dialog/themes/elemental/dark/filter-dialog.js +1 -1
  59. package/lib/filter-dialog/themes/elemental/light/checkbox-list.js +1 -1
  60. package/lib/filter-dialog/themes/elemental/light/es5/all-elements.js +2 -2
  61. package/lib/filter-dialog/themes/elemental/light/filter-dialog.js +1 -1
  62. package/lib/filter-dialog/themes/halo/dark/checkbox-list.js +1 -1
  63. package/lib/filter-dialog/themes/halo/dark/es5/all-elements.js +2 -2
  64. package/lib/filter-dialog/themes/halo/dark/filter-dialog.js +1 -1
  65. package/lib/filter-dialog/themes/halo/light/checkbox-list.js +1 -1
  66. package/lib/filter-dialog/themes/halo/light/es5/all-elements.js +2 -2
  67. package/lib/filter-dialog/themes/halo/light/filter-dialog.js +1 -1
  68. package/lib/filter-dialog/themes/solar/charcoal/checkbox-list.js +1 -1
  69. package/lib/filter-dialog/themes/solar/charcoal/es5/all-elements.js +2 -2
  70. package/lib/filter-dialog/themes/solar/charcoal/filter-dialog.js +1 -1
  71. package/lib/filter-dialog/themes/solar/pearl/checkbox-list.js +1 -1
  72. package/lib/filter-dialog/themes/solar/pearl/es5/all-elements.js +2 -2
  73. package/lib/filter-dialog/themes/solar/pearl/filter-dialog.js +1 -1
  74. package/lib/grid/lib/efx-grid.d.ts +25 -10
  75. package/lib/grid/lib/efx-grid.js +22 -56
  76. package/lib/grid/themes/base.less +1 -1
  77. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  78. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  79. package/lib/grid/themes/halo/efx-grid.less +33 -39
  80. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  81. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  82. package/lib/grid/themes/solar/charcoal/efx-grid.js +1 -1
  83. package/lib/grid/themes/solar/charcoal/es5/all-elements.js +1 -1
  84. package/lib/grid/themes/solar/pearl/efx-grid.js +1 -1
  85. package/lib/grid/themes/solar/pearl/es5/all-elements.js +1 -1
  86. package/lib/index.d.ts +2 -0
  87. package/lib/index.js +2 -0
  88. package/lib/row-segmenting/es6/RowSegmenting.d.ts +7 -2
  89. package/lib/row-segmenting/es6/RowSegmenting.js +98 -11
  90. package/lib/rt-grid/dist/rt-grid.js +1244 -1249
  91. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  92. package/lib/rt-grid/es6/ColumnDefinition.d.ts +5 -3
  93. package/lib/rt-grid/es6/ColumnDefinition.js +17 -108
  94. package/lib/rt-grid/es6/DataConnector.d.ts +3 -3
  95. package/lib/rt-grid/es6/Grid.d.ts +24 -9
  96. package/lib/rt-grid/es6/Grid.js +285 -103
  97. package/lib/rt-grid/es6/RowDefSorter.d.ts +19 -0
  98. package/lib/rt-grid/es6/RowDefSorter.js +137 -0
  99. package/lib/rt-grid/es6/RowDefinition.d.ts +9 -7
  100. package/lib/rt-grid/es6/RowDefinition.js +6 -0
  101. package/lib/rt-grid/es6/SnapshotFiller.d.ts +6 -1
  102. package/lib/rt-grid/es6/SnapshotFiller.js +144 -15
  103. package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +4 -3
  104. package/lib/tr-grid-checkbox/es6/Checkbox.js +51 -21
  105. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +46 -9
  106. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +8 -4
  107. package/lib/tr-grid-column-stack/es6/ColumnStack.js +240 -125
  108. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +4 -3
  109. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +28 -13
  110. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +8 -5
  111. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +106 -3
  112. package/lib/tr-grid-percent-bar/es6/PercentBar.js +1 -1
  113. package/lib/tr-grid-printer/es6/CellWriter.d.ts +3 -3
  114. package/lib/tr-grid-printer/es6/GridPrinter.d.ts +1 -1
  115. package/lib/tr-grid-printer/es6/GridPrinter.js +26 -13
  116. package/lib/tr-grid-printer/es6/PrintTrait.d.ts +2 -2
  117. package/lib/tr-grid-printer/es6/SectionWriter.d.ts +3 -3
  118. package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +3 -4
  119. package/lib/tr-grid-row-dragging/es6/RowDragging.js +86 -195
  120. package/lib/tr-grid-row-grouping/es6/RowGrouping.d.ts +7 -2
  121. package/lib/tr-grid-row-grouping/es6/RowGrouping.js +97 -7
  122. package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +8 -8
  123. package/lib/tr-grid-row-selection/es6/RowSelection.js +55 -31
  124. package/lib/tr-grid-textformatting/es6/TextFormatting.d.ts +1 -1
  125. package/lib/tr-grid-textformatting/es6/TextFormatting.js +12 -0
  126. package/lib/tr-grid-util/es6/CellPainter.js +1 -1
  127. package/lib/tr-grid-util/es6/DragUI.d.ts +16 -0
  128. package/lib/tr-grid-util/es6/DragUI.js +214 -0
  129. package/lib/tr-grid-util/es6/ElementObserver.d.ts +2 -0
  130. package/lib/tr-grid-util/es6/ElementObserver.js +32 -2
  131. package/lib/tr-grid-util/es6/ElfUtil.d.ts +4 -1
  132. package/lib/tr-grid-util/es6/ElfUtil.js +131 -28
  133. package/lib/tr-grid-util/es6/ExpanderIcon.js +2 -2
  134. package/lib/tr-grid-util/es6/FieldFormatter.js +7 -5
  135. package/lib/tr-grid-util/es6/GridPlugin.js +8 -4
  136. package/lib/tr-grid-util/es6/MultiTableManager.d.ts +8 -0
  137. package/lib/tr-grid-util/es6/MultiTableManager.js +164 -57
  138. package/lib/tr-grid-util/es6/NumberFormatter.d.ts +2 -0
  139. package/lib/tr-grid-util/es6/NumberFormatter.js +64 -19
  140. package/lib/tr-grid-util/es6/RowPainter.js +57 -19
  141. package/lib/tr-grid-util/es6/formula/Formula.js +9 -1
  142. package/lib/tr-grid-util/es6/jsx.d.ts +223 -0
  143. package/lib/types/es6/Checkbox.d.ts +4 -3
  144. package/lib/types/es6/ColumnStack.d.ts +8 -4
  145. package/lib/types/es6/CompositeGrid/ColumnSelectionPlugin.d.ts +3 -2
  146. package/lib/types/es6/CompositeGrid/ColumnWidthAdjustingPlugin.d.ts +2 -1
  147. package/lib/types/es6/CompositeGrid/CompositeGrid.d.ts +20 -18
  148. package/lib/types/es6/CompositeGrid/DragAndDropTitlePlugin.d.ts +2 -1
  149. package/lib/types/es6/CompositeGrid/DraggableContentPlugin.d.ts +3 -2
  150. package/lib/types/es6/CompositeGrid/Plugin.d.ts +28 -0
  151. package/lib/types/es6/CompositeGrid/ResizableTitlePlugin.d.ts +2 -1
  152. package/lib/types/es6/CompositeGrid/RowSelectionPlugin.d.ts +5 -4
  153. package/lib/types/es6/CompositeGrid/TreeIndentingPlugin.d.ts +2 -1
  154. package/lib/types/es6/CompositeGrid/index.d.ts +9 -9
  155. package/lib/types/es6/ConditionalColoring.d.ts +4 -3
  156. package/lib/types/es6/Core/data/ColumnStats.d.ts +2 -2
  157. package/lib/types/es6/Core/data/DataCache.d.ts +4 -4
  158. package/lib/types/es6/Core/data/DataTable.d.ts +5 -5
  159. package/lib/types/es6/Core/data/DataView.d.ts +12 -18
  160. package/lib/types/es6/Core/data/Segment.d.ts +2 -0
  161. package/lib/types/es6/Core/data/SegmentCollection.d.ts +3 -3
  162. package/lib/types/es6/Core/data/WrappedView.d.ts +13 -13
  163. package/lib/types/es6/Core/grid/Core.d.ts +31 -27
  164. package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +15 -15
  165. package/lib/types/es6/Core/grid/components/Cell.d.ts +4 -4
  166. package/lib/types/es6/Core/grid/components/CellFloatingPanel.d.ts +1 -1
  167. package/lib/types/es6/Core/grid/components/CellSpans.d.ts +8 -8
  168. package/lib/types/es6/Core/grid/components/Column.d.ts +1 -1
  169. package/lib/types/es6/Core/grid/components/ElementWrapper.d.ts +6 -6
  170. package/lib/types/es6/Core/grid/components/Scrollbar.d.ts +3 -1
  171. package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +14 -6
  172. package/lib/types/es6/Core/grid/util/Conflator.d.ts +2 -2
  173. package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +3 -3
  174. package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +2 -2
  175. package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +1 -1
  176. package/lib/types/es6/Core/grid/util/RangeBar.d.ts +1 -1
  177. package/lib/types/es6/Core/grid/util/SectionSettings.d.ts +5 -5
  178. package/lib/types/es6/Core/grid/util/SelectionList.d.ts +2 -2
  179. package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +7 -3
  180. package/lib/types/es6/Core/grid/util/util.d.ts +2 -2
  181. package/lib/types/es6/Core/index.d.ts +1 -5
  182. package/lib/types/es6/ExtensionOptions.d.ts +2 -0
  183. package/lib/types/es6/InCellEditing.d.ts +8 -5
  184. package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +5 -3
  185. package/lib/types/es6/RealtimeGrid/DataConnector.d.ts +3 -3
  186. package/lib/types/es6/RealtimeGrid/Grid.d.ts +24 -9
  187. package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +19 -0
  188. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +9 -7
  189. package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +6 -1
  190. package/lib/types/es6/RowDragging.d.ts +3 -4
  191. package/lib/types/es6/RowGrouping.d.ts +7 -2
  192. package/lib/types/es6/RowSegmenting.d.ts +7 -2
  193. package/lib/types/es6/RowSelection.d.ts +8 -8
  194. package/lib/types/es6/TextFormatting.d.ts +1 -1
  195. package/lib/types/es6/index.d.ts +1 -0
  196. package/lib/versions.json +17 -16
  197. package/package.json +1 -1
  198. package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.d.ts +0 -24
  199. package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.js +0 -615
  200. package/lib/core/es6/grid/plugins/Plugin.d.ts +0 -28
  201. package/lib/core/es6/grid/plugins/Plugin.js +0 -272
  202. package/lib/types/es6/Core/grid/plugins/DragAndDropTitlePlugin.d.ts +0 -24
  203. package/lib/types/es6/Core/grid/plugins/Plugin.d.ts +0 -28
@@ -3,6 +3,7 @@ import { GridPlugin } from '../../tr-grid-util/es6/GridPlugin.js';
3
3
  import { extendObject } from '../../tr-grid-util/es6/Util.js';
4
4
  import {CellPainter} from '../../tr-grid-util/es6/CellPainter.js';
5
5
  import {FilterBuilder} from '../../tr-grid-util/es6/FilterBuilder.js';
6
+ import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
6
7
 
7
8
  /** @typedef {Object} ConditionalColoringPlugin~ColumnOptions
8
9
  * @description Extension column options that can be specified on each individual grid's column option:
@@ -97,6 +98,10 @@ ConditionalColoringPlugin.prototype.initialize = function (host, options) {
97
98
  if (!CellPainter.themeReady) {
98
99
  CellPainter.loadThemeColors().then(this._onThemeLoaded);
99
100
  }
101
+
102
+ // Register callback for movement-color-profile attribute changed event
103
+ ElfUtil.getThemeColors(this._onThemeLoaded);
104
+
100
105
  // In case of lazy loading
101
106
  // DO something
102
107
  };
@@ -320,17 +325,21 @@ ConditionalColoringPlugin.prototype._cacheColumnPreviousValue = function(colInde
320
325
  };
321
326
 
322
327
  /** @public
328
+ * @description To define coloring for columns, conditions or colorText or tickColor need to be specified.
329
+ * To enable cell blinking the blinking option need to be defined. Coloring options and blinking options
330
+ * can be applied to a column at the same time. The blinking or coloring abilities will be removed if the correspondent options
331
+ * are not given. If columnOptions is undefined or null, coloring and blinking will be removed.
323
332
  * @param {number} colIndex
324
- * @param {ConditionalColoringPlugin~ColumnOptions} columnOptions
333
+ * @param {(ConditionalColoringPlugin~ColumnOptions|null)=} columnOptions
325
334
  * @example
326
- * var colDef = {
335
+ * var columnOptions1 = {
327
336
  * "conditions": [{ // Array.<Object> Condition Object Properties
328
337
  * "expression": "[column0] > 0", // string
329
338
  * "backgroundColor": "", // Optional string e.g. #ffffff, black
330
339
  * "color": "" // Optional string e.g. #000000, white
331
340
  * }]
332
341
  * };
333
- * var colDef2 = {
342
+ * var columnOptions2 = {
334
343
  * "field": "string",
335
344
  * "colorText": true // string as Field or boolean for text coloring mode
336
345
  * };
@@ -338,19 +347,21 @@ ConditionalColoringPlugin.prototype._cacheColumnPreviousValue = function(colInde
338
347
  ConditionalColoringPlugin.prototype.setColumnColoring = function (colIndex, columnOptions) {
339
348
  // Save column config state
340
349
  var colData = this._newColumnData(colIndex);
350
+ var blinkingOptions, field;
341
351
  if(columnOptions) {
342
- colData['conditions'] = columnOptions['conditions'];
343
- colData['colorText'] = columnOptions['colorText'];
344
- colData['tickColor'] = columnOptions['tickColor'];
345
- colData['blinking'] = columnOptions['blinking'];
352
+ colData["conditions"] = columnOptions["conditions"];
353
+ colData["colorText"] = columnOptions["colorText"];
354
+ colData["tickColor"] = columnOptions["tickColor"];
355
+ colData["blinking"] = blinkingOptions = columnOptions["blinking"];
356
+ field = columnOptions["field"];
346
357
  } else {
347
- colData['conditions'] = null;
348
- colData['colorText'] = null;
349
- colData['tickColor'] = null;
350
- colData['blinking'] = null;
358
+ colData["conditions"] = null;
359
+ colData["colorText"] = null;
360
+ colData["tickColor"] = null;
361
+ colData["blinking"] = null;
351
362
  }
352
363
 
353
- this.setColumnBlinking(colIndex, columnOptions["blinking"], columnOptions["field"]);
364
+ this.setColumnBlinking(colIndex, blinkingOptions, field);
354
365
 
355
366
  var painter = colData["painter"];
356
367
  var prevColoring = colData["coloring"];
@@ -704,10 +715,14 @@ ConditionalColoringPlugin.prototype.applyColor = function (colIndex, cell, rowDa
704
715
  * @param {Object} e
705
716
  */
706
717
  ConditionalColoringPlugin.prototype._onSectionBinding = function (e) {
718
+ var dataRows = /** @type{Array.<Object>} */(e["dataRows"]);
719
+ if(!dataRows) {
720
+ return; // dataRows could be empty in case of no column is presented
721
+ }
722
+
707
723
  var c, r, cell, painter, changedCols, rowDef, rid, changedRow, changedRows;
708
724
  var dataRow, insertedId, colData, blinking, bgBlinking, cachedValues, updatePrev;
709
725
  var section = e["section"];
710
- var dataRows = /** @type{Array.<Object>} */(e["dataRows"]);
711
726
  var colCount = section.getColumnCount();
712
727
  var fromR = /** @type{number} */(e["fromRowIndex"]);
713
728
  var toR = /** @type{number} */(e["toRowIndex"]);
@@ -3,7 +3,7 @@ import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
3
3
  import { Dom } from "../../tr-grid-util/es6/Dom.js";
4
4
  import { Popup } from "../../tr-grid-util/es6/Popup.js";
5
5
  import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
6
- import { isTouchDevice } from "../../tr-grid-util/es6/Util.js";
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
9
 
@@ -28,7 +28,8 @@ declare namespace InCellEditingPlugin {
28
28
  keyUp?: ((...params: any[]) => any),
29
29
  beforeRowCommit?: ((...params: any[]) => any),
30
30
  rowEditorClosed?: ((...params: any[]) => any),
31
- uiBlocking?: boolean
31
+ uiBlocking?: boolean,
32
+ autoSuggest?: Element
32
33
  };
33
34
 
34
35
  type Cache = {
@@ -79,7 +80,7 @@ declare class InCellEditingPlugin extends GridPlugin {
79
80
 
80
81
  public isEditing(): boolean;
81
82
 
82
- public getTextBox(columnIndex?: number, grid?: any): Element;
83
+ public getTextBox(columnIndex?: number, grid?: any): Element|null;
83
84
 
84
85
  public getInitialText(): string;
85
86
 
@@ -87,7 +88,7 @@ declare class InCellEditingPlugin extends GridPlugin {
87
88
 
88
89
  public _getRowId(rowIndex: number): string;
89
90
 
90
- public getActiveGrid(): any|null;
91
+ public getActiveGrid(): any|null|null;
91
92
 
92
93
  public getActiveColIndex(): number;
93
94
 
@@ -119,7 +120,9 @@ declare class InCellEditingPlugin extends GridPlugin {
119
120
 
120
121
  public commitText(word?: string): void;
121
122
 
122
- public getBalloonPopup(): Popup|null;
123
+ public getBalloonPopup(): Popup|null|null;
124
+
125
+ public getAutoSuggest(): Element|null;
123
126
 
124
127
  public setDisablingScroll(disabled?: boolean): boolean;
125
128
 
@@ -3,7 +3,7 @@ import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
3
3
  import { Dom } from "../../tr-grid-util/es6/Dom.js";
4
4
  import { Popup } from "../../tr-grid-util/es6/Popup.js";
5
5
  import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
6
- import { isTouchDevice } from "../../tr-grid-util/es6/Util.js";
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
9
  /** @typedef {Object} InCellEditingPlugin~Options
@@ -27,6 +27,7 @@ import { CoralItems } from "../../tr-grid-util/es6/CoralItems.js";
27
27
  * @property {Function=} beforeRowCommit=null Handler before all editor in row commit
28
28
  * @property {Function=} rowEditorClosed=null Handler after all editors closed
29
29
  * @property {boolean=} uiBlocking=false append transparent overlay to block ui interaction
30
+ * @property {Element=} autoSuggest=null Element of ef-autosuggest for handled with input cell
30
31
  */
31
32
 
32
33
  /** @typedef {Object} InCellEditingPlugin~Cache
@@ -66,6 +67,7 @@ import { CoralItems } from "../../tr-grid-util/es6/CoralItems.js";
66
67
  * @property {number} rowIndex
67
68
  * @property {string} field
68
69
  * @property {Element} inputElement
70
+ * @property {Element} autoSuggest
69
71
  * @example
70
72
  * var cep = new InCellEditingPlugin();
71
73
  * cep.listen("editorOpened", function(e) {
@@ -157,6 +159,8 @@ var InCellEditingPlugin = function InCellEditingPlugin(options) {
157
159
  t._createTitleEditor = t._createTitleEditor.bind(t);
158
160
  t._onColumnAdded = t._onColumnAdded.bind(t);
159
161
  t._onValueChanged = t._onValueChanged.bind(t);
162
+ t._onAutoSuggestItemSelected = t._onAutoSuggestItemSelected.bind(t);
163
+ t._onAutoSuggestTapStart = t._onAutoSuggestTapStart.bind(t);
160
164
  t._hosts = [];
161
165
 
162
166
  if (options) {
@@ -316,6 +320,11 @@ InCellEditingPlugin.prototype._disablingScroll = false;
316
320
  */
317
321
 
318
322
  InCellEditingPlugin.prototype._uiBlocking = false;
323
+ /** @type {Element}
324
+ * @private
325
+ */
326
+
327
+ InCellEditingPlugin.prototype._autoSuggest = null;
319
328
  /** @type {string}
320
329
  * @private
321
330
  */
@@ -337,6 +346,11 @@ InCellEditingPlugin.prototype._elfVersion = 0;
337
346
  */
338
347
 
339
348
  InCellEditingPlugin._primaryColor = "";
349
+ /** @type {string}
350
+ * @private
351
+ */
352
+
353
+ InCellEditingPlugin._styles = prettifyCss([":host .cell.editing input[type=text]", ["border-style: solid;"]]);
340
354
  /** @private
341
355
  * @param {Object} colors
342
356
  */
@@ -380,6 +394,13 @@ InCellEditingPlugin.prototype._createInputElement = function (tag) {
380
394
  elem.setAttribute("type", "text");
381
395
  }
382
396
 
397
+ if (this._autoSuggest) {
398
+ this._autoSuggest.addEventListener("tapstart", t._onAutoSuggestTapStart); // TODO: remove this function after elf fixed item-select doesn't fire click events
399
+
400
+
401
+ this._autoSuggest.addEventListener("item-select", t._onAutoSuggestItemSelected);
402
+ }
403
+
383
404
  elem.addEventListener("keydown", t._onTextKeyDown, false);
384
405
  elem.addEventListener("keyup", t._onTextKeyUp, false);
385
406
  elem.addEventListener("mousedown", t._stopPropagation, false);
@@ -532,6 +553,13 @@ InCellEditingPlugin.prototype.initialize = function (host, options) {
532
553
  InCellEditingPlugin._uiElementTypesMap["number"] = "ef-input";
533
554
  }
534
555
 
556
+ if (ElfUtil.isHaloTheme()) {
557
+ if (!host._inCellEditingStyles) {
558
+ host._inCellEditingStyles = true;
559
+ injectCss(InCellEditingPlugin._styles, host.getElement());
560
+ }
561
+ }
562
+
535
563
  this.config(options);
536
564
 
537
565
  if (!InCellEditingPlugin._primaryColor) {
@@ -611,6 +639,10 @@ InCellEditingPlugin.prototype.config = function (options) {
611
639
 
612
640
  if (pluginOption["uiBlocking"]) {
613
641
  t._uiBlocking = true;
642
+ }
643
+
644
+ if (pluginOption["autoSuggest"]) {
645
+ t._autoSuggest = pluginOption["autoSuggest"];
614
646
  } // event callback
615
647
 
616
648
 
@@ -1193,6 +1225,18 @@ InCellEditingPlugin.prototype._openEditor = function (e, host, arg) {
1193
1225
 
1194
1226
  if (t._disablingScroll) {
1195
1227
  t._freezeScrolling(host, true);
1228
+ }
1229
+
1230
+ arg["autoSuggest"] = t._autoSuggest;
1231
+
1232
+ if (t._autoSuggest) {
1233
+ if (t._autoSuggest.parentNode !== host.getElement()) {
1234
+ // if we appendChild all time when open editor, events won't work
1235
+ host.getElement().appendChild(t._autoSuggest);
1236
+ }
1237
+
1238
+ t._autoSuggest.attach = inputElement;
1239
+ t._autoSuggest.positionTarget = inputElement; // for re-position of autosuggest
1196
1240
  } // Dispatch an event for user to setup stuff
1197
1241
 
1198
1242
 
@@ -1496,6 +1540,42 @@ InCellEditingPlugin.prototype._onPopupHide = function (e) {
1496
1540
  this.closeRowEditor(false);
1497
1541
  };
1498
1542
  /** @private
1543
+ * @param {Object} event
1544
+ */
1545
+
1546
+
1547
+ InCellEditingPlugin.prototype._onAutoSuggestTapStart = function (event) {
1548
+ // TODO: Remove this function and use _onAutoSuggestItemSelected instead of this function
1549
+ // This WORKAROUND by use "tapstart" event instead of "item-select" event in ef-autosugest
1550
+ var target = event.target;
1551
+
1552
+ if (target.value) {
1553
+ this.setText(target.value);
1554
+
1555
+ this._commitText(true);
1556
+ }
1557
+ };
1558
+ /** @private
1559
+ * @param {Object} event
1560
+ */
1561
+
1562
+
1563
+ InCellEditingPlugin.prototype._onAutoSuggestItemSelected = function (event) {
1564
+ // TODO: Replace This function instead of _onAutoSuggestTapStart when elf fixed item-select.
1565
+ // Currently, we use tapstart instead of item-select, so it's not support other method of item-select
1566
+ // Currently, this function doesn't execute until item-select event fired from auto-suggest
1567
+ var method = event.detail.method;
1568
+ var value = event.detail.target.value;
1569
+
1570
+ if (method === 'enter' || method === 'click') {
1571
+ if (value) {
1572
+ this.setText(value);
1573
+
1574
+ this._commitText(true);
1575
+ }
1576
+ }
1577
+ };
1578
+ /** @private
1499
1579
  * @param {Object} e
1500
1580
  */
1501
1581
 
@@ -1528,6 +1608,12 @@ InCellEditingPlugin.prototype._onTextKeyDown = function (e) {
1528
1608
 
1529
1609
 
1530
1610
  if (e.keyCode === 9) {
1611
+ // For check press tab key when user tab on auto suggest list
1612
+ // When user tab on auto suggest, the focus should be in input and data doesn't commit
1613
+ if (this._autoSuggest && this._autoSuggest.suggestions.length > 0) {
1614
+ this._activeInCellCache.inputElement.focus();
1615
+ }
1616
+
1531
1617
  e.preventDefault(); // stop losing focus
1532
1618
  }
1533
1619
  };
@@ -1558,9 +1644,17 @@ InCellEditingPlugin.prototype._onTextKeyUp = function (e) {
1558
1644
  var cellInfo = this._activePos;
1559
1645
 
1560
1646
  if (this._initialText !== text) {
1561
- this._commitText(true);
1562
-
1563
1647
  e.preventDefault(); // TODO: Check if this is needed
1648
+ // Clear auto suggest and doesn't commit when user tab on auto suggest item
1649
+
1650
+ if (this._autoSuggest && this._autoSuggest.suggestions.length > 0) {
1651
+ this._activeInCellCache.inputElement.focus();
1652
+
1653
+ this._autoSuggest.suggestions = [];
1654
+ return; // when use tabToMove with auto suggest, it shouldn't be effect when doesn't commit text
1655
+ } else {
1656
+ this._commitText(true);
1657
+ }
1564
1658
  } else {
1565
1659
  this._commitText(false);
1566
1660
  }
@@ -1946,6 +2040,15 @@ InCellEditingPlugin.prototype.getBalloonPopup = function () {
1946
2040
  // we should receive column index to return balloonPopup in specific column
1947
2041
  return this._activeInCellCache ? this._activeInCellCache["balloonPopup"] : null;
1948
2042
  };
2043
+ /** Get ef-autosuggest
2044
+ * @public
2045
+ * @return {Element}
2046
+ */
2047
+
2048
+
2049
+ InCellEditingPlugin.prototype.getAutoSuggest = function () {
2050
+ return this._autoSuggest;
2051
+ };
1949
2052
  /**
1950
2053
  * @public
1951
2054
  * @param {boolean=} disabled
@@ -130,7 +130,7 @@ PercentBarPlugin.prototype.initialize = function (host, options) {
130
130
 
131
131
  if (!PercentBarPlugin._themeLoaded && !this._themeLoading) {
132
132
  this._themeLoading = true;
133
- ElfUtil.getThemeColors().then(this._onThemeLoaded);
133
+ ElfUtil.getThemeColors(this._onThemeLoaded).then(this._onThemeLoaded);
134
134
  }
135
135
  };
136
136
  /** @override */
@@ -6,15 +6,15 @@ declare class CellWriter extends ElementWrapper {
6
6
 
7
7
  constructor();
8
8
 
9
- public getContent(): Node|null;
9
+ public getContent(): Node|null|null;
10
10
 
11
- public setContent(content: any, opt_tooltip?: boolean): Element;
11
+ public setContent(content: any, opt_tooltip?: boolean): Element|null;
12
12
 
13
13
  public setTooltip(str: string): void;
14
14
 
15
15
  public setTextContent(str: string): void;
16
16
 
17
- public addContent(n: any): Element;
17
+ public addContent(n: any): Element|null;
18
18
 
19
19
  public setStyle(str: string, val: any): void;
20
20
 
@@ -17,7 +17,7 @@ declare namespace GridPrinter {
17
17
 
18
18
  function getPreFlightInfo(grid: any, options?: any): any;
19
19
 
20
- function createPrintElement(grid: any, options?: any): Element;
20
+ function createPrintElement(grid: any, options?: any): Element|null;
21
21
 
22
22
  function print(grid: any): void;
23
23
 
@@ -113,6 +113,27 @@ var _setColumnAlignment = function (tbl, colIndex, alignment) {
113
113
  }
114
114
  };
115
115
 
116
+ /** @private
117
+ * @param {*} grid grid element, currently supports atlas-blotter, ef-grid, tr.CompositeGrid, rt.Grid and Core
118
+ * @return {Object} core grid
119
+ */
120
+ var _getCoreGrid = function (grid) {
121
+ var core = null;
122
+ try {
123
+ if (grid.api) { // ef-grid or atlas-blotter
124
+ core = grid.api.getCoreGrid();
125
+ } else if (grid.getCoreGrid) { // tr.CompositeGrid or rt.Grid
126
+ core = grid.getCoreGrid();
127
+ } else if (grid.getPlugin) { // coreGrid
128
+ core = grid;
129
+ }
130
+ // TODO: support react/angular wrapper
131
+ } catch (err) {
132
+ console.log("Cannot print the given object");
133
+ }
134
+ return core;
135
+ };
136
+
116
137
  /** @namespaces
117
138
  */
118
139
  var GridPrinter = {};
@@ -331,13 +352,15 @@ GridPrinter.getPreFlightInfo = function (grid, options) {
331
352
  };
332
353
 
333
354
  /** @public
334
- * @param {tr.Grid} grid
355
+ * @param {*} grid grid element, currently supports atlas-blotter, ef-grid, tr.CompositeGrid, rt.Grid and Core
335
356
  * @param {Object=} options
336
357
  * @return {Element}
337
358
  */
338
359
  GridPrinter.createPrintElement = function (grid, options) {
339
360
  if (!grid) {
340
361
  grid = GridPrinter._grid;
362
+ } else {
363
+ grid = _getCoreGrid(grid);
341
364
  }
342
365
 
343
366
  if (!grid) {
@@ -624,23 +647,13 @@ GridPrinter._applyCss = function () {
624
647
  };
625
648
 
626
649
  /** @public
627
- * @param {tr.Grid} grid
650
+ * @param {*} grid grid element, currently supports atlas-blotter, ef-grid, tr.CompositeGrid, rt.Grid and Core
628
651
  */
629
652
  GridPrinter.print = function (grid) {
630
653
  var core = null;
631
654
  if (grid) {
632
655
  GridPrinter._applyCss();
633
- try {
634
- if (grid.api) { // ef-grid or atlas-blotter
635
- core = grid.api.getCoreGrid();
636
- } else if (grid.getCoreGrid) { // tr.CompositeGrid or rt.Grid
637
- core = grid.getCoreGrid();
638
- } else if (grid instanceof tr.Grid) {
639
- core = grid;
640
- }
641
- } catch (err) {
642
- console.log("Cannot print the given object");
643
- }
656
+ core = _getCoreGrid(grid);
644
657
  }
645
658
 
646
659
  if (core) {
@@ -29,9 +29,9 @@ declare class PrintTrait {
29
29
 
30
30
  public fixPaperSize(enabled: boolean): void;
31
31
 
32
- public getDocumentElement(): Element|null;
32
+ public getDocumentElement(): Element|null|null;
33
33
 
34
- public getBodyElement(): Element|null;
34
+ public getBodyElement(): Element|null|null;
35
35
 
36
36
  }
37
37
 
@@ -21,9 +21,9 @@ declare class SectionWriter extends ElementWrapper {
21
21
 
22
22
  public setRowCount(val: number): void;
23
23
 
24
- public getCell(colIndex: number, rowIndex: number): CellWriter;
24
+ public getCell(colIndex: number, rowIndex: number): CellWriter|null;
25
25
 
26
- public getCellContent(colIndex: number, rowIndex: number): Element|Node|NodeList;
26
+ public getCellContent(colIndex: number, rowIndex: number): Element|Node|NodeList|null;
27
27
 
28
28
  public setCellContent(colIndex: number, rowIndex: number, data: string|Element|any|any): void;
29
29
 
@@ -47,7 +47,7 @@ declare class SectionWriter extends ElementWrapper {
47
47
 
48
48
  public isColumnActive(colIndex: number): boolean;
49
49
 
50
- public getCellElement(colIndex: number, rowIndex: number): Element;
50
+ public getCellElement(colIndex: number, rowIndex: number): Element|null;
51
51
 
52
52
  }
53
53
 
@@ -1,8 +1,9 @@
1
1
  import { Ext } from "../../tr-grid-util/es6/Ext.js";
2
- import { cloneObject, injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
2
+ import { cloneObject } from "../../tr-grid-util/es6/Util.js";
3
3
  import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
4
4
  import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
5
5
  import Dom from "../../tr-grid-util/es6/Dom.js";
6
+ import { DragUI } from "../../tr-grid-util/es6/DragUI.js";
6
7
 
7
8
  declare namespace RowDraggingPlugin {
8
9
 
@@ -25,8 +26,6 @@ declare class RowDraggingPlugin extends GridPlugin {
25
26
 
26
27
  constructor(options?: RowDraggingPlugin.Options);
27
28
 
28
- public beforeProcessOption(optionName: string, optionValue: any): any;
29
-
30
29
  public hasMultiTableSupport(): boolean;
31
30
 
32
31
  public getName(): string;
@@ -45,7 +44,7 @@ declare class RowDraggingPlugin extends GridPlugin {
45
44
 
46
45
  public cancelDrag(): void;
47
46
 
48
- public getGuideline(): Element;
47
+ public getGuideline(): Element|null;
49
48
 
50
49
  }
51
50