@deephaven/iris-grid 0.22.3-beta.18 → 0.22.3-beta.21

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 (199) hide show
  1. package/dist/AdvancedFilterCreator.js +7 -65
  2. package/dist/AdvancedFilterCreator.js.map +1 -1
  3. package/dist/AdvancedFilterCreatorFilterItem.js +0 -23
  4. package/dist/AdvancedFilterCreatorFilterItem.js.map +1 -1
  5. package/dist/AdvancedFilterCreatorSelectValue.js +0 -52
  6. package/dist/AdvancedFilterCreatorSelectValue.js.map +1 -1
  7. package/dist/AdvancedFilterCreatorSelectValueList.js +2 -42
  8. package/dist/AdvancedFilterCreatorSelectValueList.js.map +1 -1
  9. package/dist/ColumnHeaderGroup.js +0 -11
  10. package/dist/ColumnHeaderGroup.js.map +1 -1
  11. package/dist/ColumnStatistics.js +1 -20
  12. package/dist/ColumnStatistics.js.map +1 -1
  13. package/dist/CrossColumnSearch.js +2 -23
  14. package/dist/CrossColumnSearch.js.map +1 -1
  15. package/dist/FilterInputField.js +2 -36
  16. package/dist/FilterInputField.js.map +1 -1
  17. package/dist/GotoRow.d.ts +1 -1
  18. package/dist/GotoRow.d.ts.map +1 -1
  19. package/dist/GotoRow.js +2 -7
  20. package/dist/GotoRow.js.map +1 -1
  21. package/dist/IrisGrid.d.ts +11 -5
  22. package/dist/IrisGrid.d.ts.map +1 -1
  23. package/dist/IrisGrid.js +77 -519
  24. package/dist/IrisGrid.js.map +1 -1
  25. package/dist/IrisGridBottomBar.d.ts +1 -1
  26. package/dist/IrisGridBottomBar.d.ts.map +1 -1
  27. package/dist/IrisGridBottomBar.js +2 -2
  28. package/dist/IrisGridBottomBar.js.map +1 -1
  29. package/dist/IrisGridCellOverflowModal.js +6 -21
  30. package/dist/IrisGridCellOverflowModal.js.map +1 -1
  31. package/dist/IrisGridCopyHandler.js +3 -50
  32. package/dist/IrisGridCopyHandler.js.map +1 -1
  33. package/dist/IrisGridMetricCalculator.js +2 -12
  34. package/dist/IrisGridMetricCalculator.js.map +1 -1
  35. package/dist/IrisGridModel.js +32 -58
  36. package/dist/IrisGridModel.js.map +1 -1
  37. package/dist/IrisGridModelFactory.js +0 -7
  38. package/dist/IrisGridModelFactory.js.map +1 -1
  39. package/dist/IrisGridModelUpdater.js +0 -4
  40. package/dist/IrisGridModelUpdater.js.map +1 -1
  41. package/dist/IrisGridPartitionSelector.js +0 -23
  42. package/dist/IrisGridPartitionSelector.js.map +1 -1
  43. package/dist/IrisGridProxyModel.js +9 -153
  44. package/dist/IrisGridProxyModel.js.map +1 -1
  45. package/dist/IrisGridRenderer.js +41 -183
  46. package/dist/IrisGridRenderer.js.map +1 -1
  47. package/dist/IrisGridShortcuts.js.map +1 -1
  48. package/dist/IrisGridTableModel.js +7 -86
  49. package/dist/IrisGridTableModel.js.map +1 -1
  50. package/dist/IrisGridTableModelTemplate.js +70 -461
  51. package/dist/IrisGridTableModelTemplate.js.map +1 -1
  52. package/dist/IrisGridTestUtils.js +0 -23
  53. package/dist/IrisGridTestUtils.js.map +1 -1
  54. package/dist/IrisGridTheme.js.map +1 -1
  55. package/dist/IrisGridTreeTableModel.js +3 -42
  56. package/dist/IrisGridTreeTableModel.js.map +1 -1
  57. package/dist/IrisGridUtils.d.ts +8 -2
  58. package/dist/IrisGridUtils.d.ts.map +1 -1
  59. package/dist/IrisGridUtils.js +97 -195
  60. package/dist/IrisGridUtils.js.map +1 -1
  61. package/dist/MissingKeyError.js +0 -7
  62. package/dist/MissingKeyError.js.map +1 -1
  63. package/dist/PartitionSelectorSearch.js +2 -48
  64. package/dist/PartitionSelectorSearch.js.map +1 -1
  65. package/dist/PendingDataBottomBar.d.ts +1 -1
  66. package/dist/PendingDataBottomBar.d.ts.map +1 -1
  67. package/dist/PendingDataBottomBar.js +2 -7
  68. package/dist/PendingDataBottomBar.js.map +1 -1
  69. package/dist/TableViewportUpdater.js +3 -29
  70. package/dist/TableViewportUpdater.js.map +1 -1
  71. package/dist/ToastBottomBar.d.ts +1 -1
  72. package/dist/ToastBottomBar.d.ts.map +1 -1
  73. package/dist/ToastBottomBar.js +2 -4
  74. package/dist/ToastBottomBar.js.map +1 -1
  75. package/dist/TreeTableViewportUpdater.js +0 -21
  76. package/dist/TreeTableViewportUpdater.js.map +1 -1
  77. package/dist/format-context-menus/CustomFormatAction.js +4 -25
  78. package/dist/format-context-menus/CustomFormatAction.js.map +1 -1
  79. package/dist/format-context-menus/DateTimeFormatContextMenu.js +0 -7
  80. package/dist/format-context-menus/DateTimeFormatContextMenu.js.map +1 -1
  81. package/dist/format-context-menus/DecimalFormatContextMenu.js +0 -9
  82. package/dist/format-context-menus/DecimalFormatContextMenu.js.map +1 -1
  83. package/dist/format-context-menus/FormatContextMenuUtils.js +3 -9
  84. package/dist/format-context-menus/FormatContextMenuUtils.js.map +1 -1
  85. package/dist/format-context-menus/IntegerFormatContextMenu.js +0 -8
  86. package/dist/format-context-menus/IntegerFormatContextMenu.js.map +1 -1
  87. package/dist/format-context-menus/index.js.map +1 -1
  88. package/dist/index.d.ts +3 -3
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +3 -3
  91. package/dist/index.js.map +1 -1
  92. package/dist/key-handlers/ClearFilterKeyHandler.js +0 -8
  93. package/dist/key-handlers/ClearFilterKeyHandler.js.map +1 -1
  94. package/dist/key-handlers/CopyKeyHandler.js +1 -10
  95. package/dist/key-handlers/CopyKeyHandler.js.map +1 -1
  96. package/dist/key-handlers/ReverseKeyHandler.js +0 -11
  97. package/dist/key-handlers/ReverseKeyHandler.js.map +1 -1
  98. package/dist/key-handlers/index.js.map +1 -1
  99. package/dist/mousehandlers/IrisGridCellOverflowMouseHandler.js +2 -32
  100. package/dist/mousehandlers/IrisGridCellOverflowMouseHandler.js.map +1 -1
  101. package/dist/mousehandlers/IrisGridColumnSelectMouseHandler.js +4 -34
  102. package/dist/mousehandlers/IrisGridColumnSelectMouseHandler.js.map +1 -1
  103. package/dist/mousehandlers/IrisGridColumnTooltipMouseHandler.js +0 -20
  104. package/dist/mousehandlers/IrisGridColumnTooltipMouseHandler.js.map +1 -1
  105. package/dist/mousehandlers/IrisGridContextMenuHandler.js +15 -105
  106. package/dist/mousehandlers/IrisGridContextMenuHandler.js.map +1 -1
  107. package/dist/mousehandlers/IrisGridDataSelectMouseHandler.js +0 -9
  108. package/dist/mousehandlers/IrisGridDataSelectMouseHandler.js.map +1 -1
  109. package/dist/mousehandlers/IrisGridFilterMouseHandler.js +0 -17
  110. package/dist/mousehandlers/IrisGridFilterMouseHandler.js.map +1 -1
  111. package/dist/mousehandlers/IrisGridSortMouseHandler.js +2 -15
  112. package/dist/mousehandlers/IrisGridSortMouseHandler.js.map +1 -1
  113. package/dist/mousehandlers/PendingMouseHandler.js +0 -6
  114. package/dist/mousehandlers/PendingMouseHandler.js.map +1 -1
  115. package/dist/mousehandlers/index.js.map +1 -1
  116. package/dist/sidebar/AdvancedSettings.js.map +1 -1
  117. package/dist/sidebar/AdvancedSettingsMenu.d.ts +4 -4
  118. package/dist/sidebar/AdvancedSettingsMenu.d.ts.map +1 -1
  119. package/dist/sidebar/AdvancedSettingsMenu.js +2 -6
  120. package/dist/sidebar/AdvancedSettingsMenu.js.map +1 -1
  121. package/dist/sidebar/AdvancedSettingsType.js +0 -2
  122. package/dist/sidebar/AdvancedSettingsType.js.map +1 -1
  123. package/dist/sidebar/ChartBuilder.js +2 -46
  124. package/dist/sidebar/ChartBuilder.js.map +1 -1
  125. package/dist/sidebar/CustomColumnBuilder.js +6 -58
  126. package/dist/sidebar/CustomColumnBuilder.js.map +1 -1
  127. package/dist/sidebar/CustomColumnInput.js +4 -15
  128. package/dist/sidebar/CustomColumnInput.js.map +1 -1
  129. package/dist/sidebar/InputEditor.js +5 -36
  130. package/dist/sidebar/InputEditor.js.map +1 -1
  131. package/dist/sidebar/OptionType.js +0 -2
  132. package/dist/sidebar/OptionType.js.map +1 -1
  133. package/dist/sidebar/RollupRows.js +9 -65
  134. package/dist/sidebar/RollupRows.js.map +1 -1
  135. package/dist/sidebar/SelectDistinctBuilder.js +0 -13
  136. package/dist/sidebar/SelectDistinctBuilder.js.map +1 -1
  137. package/dist/sidebar/TableCsvExporter.js +0 -52
  138. package/dist/sidebar/TableCsvExporter.js.map +1 -1
  139. package/dist/sidebar/TableSaver.js +10 -123
  140. package/dist/sidebar/TableSaver.js.map +1 -1
  141. package/dist/sidebar/VisibilityOrderingBuilder.js +37 -116
  142. package/dist/sidebar/VisibilityOrderingBuilder.js.map +1 -1
  143. package/dist/sidebar/aggregations/AggregationEdit.d.ts +1 -1
  144. package/dist/sidebar/aggregations/AggregationEdit.d.ts.map +1 -1
  145. package/dist/sidebar/aggregations/AggregationEdit.js +2 -14
  146. package/dist/sidebar/aggregations/AggregationEdit.js.map +1 -1
  147. package/dist/sidebar/aggregations/AggregationOperation.js +0 -2
  148. package/dist/sidebar/aggregations/AggregationOperation.js.map +1 -1
  149. package/dist/sidebar/aggregations/AggregationUtils.js +2 -5
  150. package/dist/sidebar/aggregations/AggregationUtils.js.map +1 -1
  151. package/dist/sidebar/aggregations/Aggregations.d.ts +1 -1
  152. package/dist/sidebar/aggregations/Aggregations.d.ts.map +1 -1
  153. package/dist/sidebar/aggregations/Aggregations.js +2 -12
  154. package/dist/sidebar/aggregations/Aggregations.js.map +1 -1
  155. package/dist/sidebar/conditional-formatting/ColumnFormatEditor.d.ts +1 -1
  156. package/dist/sidebar/conditional-formatting/ColumnFormatEditor.d.ts.map +1 -1
  157. package/dist/sidebar/conditional-formatting/ColumnFormatEditor.js +2 -16
  158. package/dist/sidebar/conditional-formatting/ColumnFormatEditor.js.map +1 -1
  159. package/dist/sidebar/conditional-formatting/ConditionEditor.d.ts +1 -1
  160. package/dist/sidebar/conditional-formatting/ConditionEditor.d.ts.map +1 -1
  161. package/dist/sidebar/conditional-formatting/ConditionEditor.js +2 -35
  162. package/dist/sidebar/conditional-formatting/ConditionEditor.js.map +1 -1
  163. package/dist/sidebar/conditional-formatting/ConditionalFormatEditor.d.ts +1 -1
  164. package/dist/sidebar/conditional-formatting/ConditionalFormatEditor.d.ts.map +1 -1
  165. package/dist/sidebar/conditional-formatting/ConditionalFormatEditor.js +2 -12
  166. package/dist/sidebar/conditional-formatting/ConditionalFormatEditor.js.map +1 -1
  167. package/dist/sidebar/conditional-formatting/ConditionalFormattingAPIUtils.js +0 -3
  168. package/dist/sidebar/conditional-formatting/ConditionalFormattingAPIUtils.js.map +1 -1
  169. package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.d.ts +1 -1
  170. package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.d.ts.map +1 -1
  171. package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.js +16 -26
  172. package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.js.map +1 -1
  173. package/dist/sidebar/conditional-formatting/ConditionalFormattingUtils.js +9 -172
  174. package/dist/sidebar/conditional-formatting/ConditionalFormattingUtils.js.map +1 -1
  175. package/dist/sidebar/conditional-formatting/RowFormatEditor.d.ts +1 -1
  176. package/dist/sidebar/conditional-formatting/RowFormatEditor.d.ts.map +1 -1
  177. package/dist/sidebar/conditional-formatting/RowFormatEditor.js +2 -16
  178. package/dist/sidebar/conditional-formatting/RowFormatEditor.js.map +1 -1
  179. package/dist/sidebar/conditional-formatting/StyleEditor.d.ts +1 -1
  180. package/dist/sidebar/conditional-formatting/StyleEditor.d.ts.map +1 -1
  181. package/dist/sidebar/conditional-formatting/StyleEditor.js +2 -12
  182. package/dist/sidebar/conditional-formatting/StyleEditor.js.map +1 -1
  183. package/dist/sidebar/icons/BarIcon.js +0 -3
  184. package/dist/sidebar/icons/BarIcon.js.map +1 -1
  185. package/dist/sidebar/icons/FormatColumnWhereIcon.js +2 -5
  186. package/dist/sidebar/icons/FormatColumnWhereIcon.js.map +1 -1
  187. package/dist/sidebar/icons/FormatRowWhereIcon.js +2 -5
  188. package/dist/sidebar/icons/FormatRowWhereIcon.js.map +1 -1
  189. package/dist/sidebar/icons/HistogramIcon.js +0 -3
  190. package/dist/sidebar/icons/HistogramIcon.js.map +1 -1
  191. package/dist/sidebar/icons/LineIcon.js +0 -3
  192. package/dist/sidebar/icons/LineIcon.js.map +1 -1
  193. package/dist/sidebar/icons/PieIcon.js +0 -3
  194. package/dist/sidebar/icons/PieIcon.js.map +1 -1
  195. package/dist/sidebar/icons/ScatterIcon.js +0 -3
  196. package/dist/sidebar/icons/ScatterIcon.js.map +1 -1
  197. package/dist/sidebar/icons/index.js.map +1 -1
  198. package/dist/sidebar/index.js.map +1 -1
  199. package/package.json +15 -15
@@ -1,15 +1,9 @@
1
1
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2
-
3
2
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4
-
5
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
-
7
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
-
9
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
-
11
6
  /* eslint-disable no-underscore-dangle */
12
-
13
7
  /* eslint class-methods-use-this: "off" */
14
8
  import memoize from 'memoize-one';
15
9
  import throttle from 'lodash.throttle';
@@ -29,6 +23,7 @@ var APPLY_VIEWPORT_THROTTLE = 0;
29
23
  export function isIrisGridTableModelTemplate(model) {
30
24
  return model.table !== undefined;
31
25
  }
26
+
32
27
  /**
33
28
  * Template model for a grid
34
29
  */
@@ -37,56 +32,44 @@ class IrisGridTableModelTemplate extends IrisGridModel {
37
32
  export() {
38
33
  throw new Error('Method not implemented.');
39
34
  }
40
-
41
35
  columnStatistics(column) {
42
36
  throw new Error('Method not implemented.');
43
37
  }
44
-
45
38
  get customColumns() {
46
39
  return [];
47
40
  }
48
-
49
41
  set customColumns(customColumns) {
50
42
  throw new Error('Method not implemented.');
51
43
  }
52
-
53
44
  get formatColumns() {
54
45
  return [];
55
46
  }
56
-
57
47
  set formatColumns(formatColumns) {
58
48
  throw new Error('Method not implemented.');
59
49
  }
60
-
61
50
  updateFrozenColumns(columns) {
62
51
  throw new Error('Method not implemented.');
63
52
  }
64
-
65
53
  get rollupConfig() {
66
54
  throw new Error('Method not implemented.');
67
55
  }
68
-
69
56
  set rollupConfig(rollupConfig) {
70
57
  throw new Error('Method not implemented.');
71
58
  }
72
-
73
59
  get selectDistinctColumns() {
74
60
  throw new Error('Method not implemented.');
75
61
  }
76
-
77
62
  set selectDistinctColumns(names) {
78
63
  throw new Error('Method not implemented.');
79
64
  }
65
+
80
66
  /**
81
67
  * Returns an array of the columns in the model
82
68
  * The order of model columns should never change once established
83
69
  */
84
-
85
-
86
70
  get columns() {
87
71
  return this.table.columns;
88
72
  }
89
-
90
73
  /**
91
74
  * @param table Iris data table to be used in the model
92
75
  * @param formatter The formatter to use when getting formats
@@ -94,56 +77,33 @@ class IrisGridTableModelTemplate extends IrisGridModel {
94
77
  */
95
78
  constructor(table) {
96
79
  var _formatter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Formatter();
97
-
98
80
  var inputTable = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
99
81
  super();
100
-
101
82
  _defineProperty(this, "irisFormatter", void 0);
102
-
103
83
  _defineProperty(this, "inputTable", void 0);
104
-
105
84
  _defineProperty(this, "subscription", void 0);
106
-
107
85
  _defineProperty(this, "table", void 0);
108
-
109
86
  _defineProperty(this, "viewport", void 0);
110
-
111
87
  _defineProperty(this, "viewportData", void 0);
112
-
113
88
  _defineProperty(this, "formattedStringData", void 0);
114
-
115
89
  _defineProperty(this, "pendingStringData", void 0);
116
-
117
90
  _defineProperty(this, "isSaveInProgress", void 0);
118
-
119
91
  _defineProperty(this, "totalsTable", void 0);
120
-
121
92
  _defineProperty(this, "totalsTablePromise", void 0);
122
-
123
93
  _defineProperty(this, "totals", void 0);
124
-
125
94
  _defineProperty(this, "totalsDataMap", void 0);
126
-
127
95
  _defineProperty(this, "pendingNewDataMap", void 0);
128
-
129
96
  _defineProperty(this, "pendingNewRowCount", 0);
130
-
131
97
  _defineProperty(this, "pendingNewDataErrors", void 0);
132
-
133
98
  _defineProperty(this, "columnHeaderGroupMap", new Map());
134
-
135
99
  _defineProperty(this, "columnHeaderParentMap", new Map());
136
-
137
100
  _defineProperty(this, "_columnHeaderMaxDepth", null);
138
-
139
101
  _defineProperty(this, "_columnHeaderGroups", []);
140
-
141
102
  _defineProperty(this, "getMemoizedColumnMap", memoize(tableColumns => {
142
103
  var columnMap = new Map();
143
104
  tableColumns.forEach(col => columnMap.set(col.name, col));
144
105
  return columnMap;
145
106
  }));
146
-
147
107
  _defineProperty(this, "getColumnIndicesByNameMap", memoize(columns => {
148
108
  var indices = new Map();
149
109
  columns.forEach((_ref, i) => {
@@ -154,22 +114,18 @@ class IrisGridTableModelTemplate extends IrisGridModel {
154
114
  });
155
115
  return indices;
156
116
  }));
157
-
158
117
  _defineProperty(this, "setViewport", throttle((top, bottom, columns) => {
159
118
  if (bottom < top) {
160
119
  log.error('Invalid viewport', top, bottom);
161
120
  return;
162
121
  }
163
-
164
122
  var {
165
123
  viewport
166
124
  } = this;
167
-
168
125
  if (viewport != null && viewport.top === top && viewport.bottom === bottom && viewport.columns === columns) {
169
126
  log.debug2('Ignoring duplicate viewport', viewport);
170
127
  return;
171
128
  }
172
-
173
129
  this.viewport = {
174
130
  top,
175
131
  bottom,
@@ -178,12 +134,10 @@ class IrisGridTableModelTemplate extends IrisGridModel {
178
134
  log.debug2('setViewport', this.viewport);
179
135
  this.applyViewport();
180
136
  }, SET_VIEWPORT_THROTTLE));
181
-
182
137
  _defineProperty(this, "applyViewport", throttle(() => {
183
138
  if (!this.viewport) {
184
139
  return;
185
140
  }
186
-
187
141
  log.debug2('applyViewport', this.viewport);
188
142
  var {
189
143
  top,
@@ -195,44 +149,36 @@ class IrisGridTableModelTemplate extends IrisGridModel {
195
149
  }, APPLY_VIEWPORT_THROTTLE, {
196
150
  leading: false
197
151
  }));
198
-
199
152
  _defineProperty(this, "getCachedFormattedString", memoizeClear((formatter, value, columnType, columnName, formatOverride) => formatter.getFormattedString(value, columnType, columnName, formatOverride), {
200
153
  max: 10000
201
154
  }));
202
-
203
155
  _defineProperty(this, "getCachedCustomColumnFormatFlag", memoizeClear(FormatterUtils.isCustomColumnFormatDefined, {
204
156
  max: 10000
205
157
  }));
206
-
207
158
  _defineProperty(this, "getCachedViewportRowRange", memoize((top, bottom) => {
208
159
  var viewHeight = bottom - top;
209
160
  var viewportTop = Math.max(0, top - viewHeight * IrisGridTableModelTemplate.ROW_BUFFER_PAGES);
210
161
  var viewportBottom = bottom + viewHeight * IrisGridTableModelTemplate.ROW_BUFFER_PAGES;
211
162
  return [viewportTop, viewportBottom];
212
163
  }));
213
-
214
164
  _defineProperty(this, "getCachedPendingErrors", memoize((pendingDataMap, columns, keyColumnCount) => {
215
165
  var map = new Map();
216
166
  pendingDataMap.forEach((row, rowIndex) => {
217
167
  var {
218
168
  data: rowData
219
169
  } = row;
220
-
221
170
  for (var i = 0; i < keyColumnCount; i += 1) {
222
171
  if (!rowData.has(i)) {
223
172
  var _map$get;
224
-
225
173
  if (!map.has(rowIndex)) {
226
174
  map.set(rowIndex, []);
227
175
  }
228
-
229
176
  (_map$get = map.get(rowIndex)) === null || _map$get === void 0 ? void 0 : _map$get.push(new MissingKeyError(rowIndex, columns[i].name));
230
177
  }
231
178
  }
232
179
  });
233
180
  return map;
234
181
  }));
235
-
236
182
  this.handleTableDisconnect = this.handleTableDisconnect.bind(this);
237
183
  this.handleTableReconnect = this.handleTableReconnect.bind(this);
238
184
  this.handleTableUpdate = this.handleTableUpdate.bind(this);
@@ -251,27 +197,24 @@ class IrisGridTableModelTemplate extends IrisGridModel {
251
197
  this.totalsTable = null;
252
198
  this.totalsTablePromise = null;
253
199
  this.totals = null;
254
- this.totalsDataMap = null; // Map from new row index to their values. Only for input tables that can have new rows added.
200
+ this.totalsDataMap = null;
201
+
202
+ // Map from new row index to their values. Only for input tables that can have new rows added.
255
203
  // The index of these rows start at 0, and they are appended at the end of the regular table data.
256
204
  // These rows can be sparse, so using a map instead of an array.
257
-
258
205
  this.pendingNewDataMap = new Map();
259
206
  this.pendingNewDataErrors = null;
260
207
  this.pendingNewRowCount = 0;
261
208
  }
262
-
263
209
  close() {
264
210
  this.table.close();
265
-
266
211
  if (this.totalsTable !== null) {
267
212
  this.totalsTable.close();
268
213
  }
269
-
270
214
  if (this.totalsTablePromise !== null) {
271
215
  this.totalsTablePromise.cancel();
272
216
  }
273
217
  }
274
-
275
218
  startListening() {
276
219
  super.startListening();
277
220
  this.table.addEventListener(dh.Table.EVENT_DISCONNECT, this.handleTableDisconnect);
@@ -279,14 +222,11 @@ class IrisGridTableModelTemplate extends IrisGridModel {
279
222
  this.table.addEventListener(dh.Table.EVENT_UPDATED, this.handleTableUpdate);
280
223
  this.table.addEventListener(dh.Client.EVENT_REQUEST_FAILED, this.handleRequestFailed);
281
224
  this.table.addEventListener(dh.Table.EVENT_CUSTOMCOLUMNSCHANGED, this.handleCustomColumnsChanged);
282
-
283
225
  if (this.totalsTable != null) {
284
226
  this.addTotalsListeners(this.totalsTable);
285
227
  }
286
-
287
228
  this.applyViewport();
288
229
  }
289
-
290
230
  stopListening() {
291
231
  super.stopListening();
292
232
  this.table.removeEventListener(dh.Table.EVENT_DISCONNECT, this.handleTableDisconnect);
@@ -294,78 +234,61 @@ class IrisGridTableModelTemplate extends IrisGridModel {
294
234
  this.table.removeEventListener(dh.Table.EVENT_UPDATED, this.handleTableUpdate);
295
235
  this.table.removeEventListener(dh.Client.EVENT_REQUEST_FAILED, this.handleRequestFailed);
296
236
  this.table.removeEventListener(dh.Table.EVENT_CUSTOMCOLUMNSCHANGED, this.handleCustomColumnsChanged);
297
-
298
237
  if (this.totalsTable != null) {
299
238
  this.removeTotalsListeners(this.totalsTable);
300
239
  }
301
-
302
240
  this.closeSubscription();
303
241
  }
304
-
305
242
  addTotalsListeners(totalsTable) {
306
- totalsTable.addEventListener(dh.Table.EVENT_UPDATED, this.handleTotalsUpdate); // Totals table only has one row of data
243
+ totalsTable.addEventListener(dh.Table.EVENT_UPDATED, this.handleTotalsUpdate);
307
244
 
245
+ // Totals table only has one row of data
308
246
  totalsTable.setViewport(0, 0);
309
247
  }
310
-
311
248
  removeTotalsListeners(totalsTable) {
312
249
  totalsTable.removeEventListener(dh.Table.EVENT_UPDATED, this.handleTotalsUpdate);
313
250
  }
314
-
315
251
  handleTableDisconnect() {
316
252
  this.dispatchEvent(new EventShimCustomEvent(IrisGridModel.EVENT.DISCONNECT));
317
253
  }
318
-
319
254
  handleTableReconnect() {
320
255
  this.dispatchEvent(new EventShimCustomEvent(IrisGridModel.EVENT.RECONNECT));
321
256
  }
322
-
323
257
  handleTableUpdate(event) {
324
258
  this.copyViewportData(event.detail);
325
259
  this.dispatchEvent(new EventShimCustomEvent(IrisGridModel.EVENT.UPDATED));
326
260
  }
327
-
328
261
  handleTotalsUpdate(event) {
329
262
  this.copyTotalsData(event.detail);
330
263
  this.dispatchEvent(new EventShimCustomEvent(IrisGridModel.EVENT.UPDATED));
331
264
  }
332
-
333
265
  handleRequestFailed(event) {
334
266
  this.dispatchEvent(new EventShimCustomEvent(IrisGridModel.EVENT.REQUEST_FAILED, event));
335
267
  }
336
-
337
268
  handleCustomColumnsChanged() {
338
269
  this.dispatchEvent(new EventShimCustomEvent(IrisGridModel.EVENT.COLUMNS_CHANGED, {
339
270
  detail: this.columns
340
271
  }));
341
272
  }
342
-
343
273
  get rowCount() {
344
274
  var _this$totals$operatio, _this$totals, _this$totals$operatio2;
345
-
346
275
  return this.table.size + this.pendingNewRowCount + ((_this$totals$operatio = (_this$totals = this.totals) === null || _this$totals === void 0 ? void 0 : (_this$totals$operatio2 = _this$totals.operationOrder) === null || _this$totals$operatio2 === void 0 ? void 0 : _this$totals$operatio2.length) !== null && _this$totals$operatio !== void 0 ? _this$totals$operatio : 0);
347
276
  }
348
-
349
277
  get pendingDataErrors() {
350
278
  var _this$inputTable$keyC, _this$inputTable;
351
-
352
279
  return this.getCachedPendingErrors(this.pendingNewDataMap, this.columns, (_this$inputTable$keyC = (_this$inputTable = this.inputTable) === null || _this$inputTable === void 0 ? void 0 : _this$inputTable.keyColumns.length) !== null && _this$inputTable$keyC !== void 0 ? _this$inputTable$keyC : 0);
353
280
  }
354
-
355
281
  get pendingDataMap() {
356
282
  return this.pendingNewDataMap;
357
283
  }
358
-
359
284
  set pendingDataMap(map) {
360
285
  if (map === this.pendingNewDataMap) {
361
286
  return;
362
287
  }
363
-
364
288
  map.forEach((row, rowIndex) => {
365
289
  if (!IrisGridUtils.isValidIndex(rowIndex)) {
366
290
  throw new Error("Invalid rowIndex ".concat(rowIndex));
367
291
  }
368
-
369
292
  var {
370
293
  data
371
294
  } = row;
@@ -380,188 +303,143 @@ class IrisGridTableModelTemplate extends IrisGridModel {
380
303
  this.formattedStringData = [];
381
304
  this.dispatchEvent(new EventShimCustomEvent(IrisGridModel.EVENT.PENDING_DATA_UPDATED));
382
305
  }
383
-
384
306
  get pendingRowCount() {
385
307
  return this.pendingNewRowCount;
386
308
  }
387
-
388
309
  set pendingRowCount(count) {
389
310
  if (count === this.pendingNewRowCount) {
390
311
  return;
391
312
  }
392
-
393
313
  this.pendingNewRowCount = Math.max(0, count, this.maxPendingDataRow);
394
314
  this.dispatchEvent(new EventShimCustomEvent(IrisGridModel.EVENT.UPDATED));
395
315
  }
396
-
397
316
  get maxPendingDataRow() {
398
317
  return this.pendingNewDataMap.size > 0 ? Math.max(...this.pendingNewDataMap.keys()) + 1 : 0;
399
318
  }
400
-
401
319
  get columnCount() {
402
320
  return this.columns.length;
403
321
  }
404
-
405
322
  get floatingBottomRowCount() {
406
323
  var _this$totals$operatio3, _this$totals2, _this$totals2$operati;
407
-
408
324
  return this.totals != null && this.totals.showOnTop ? 0 : (_this$totals$operatio3 = (_this$totals2 = this.totals) === null || _this$totals2 === void 0 ? void 0 : (_this$totals2$operati = _this$totals2.operationOrder) === null || _this$totals2$operati === void 0 ? void 0 : _this$totals2$operati.length) !== null && _this$totals$operatio3 !== void 0 ? _this$totals$operatio3 : 0;
409
325
  }
410
-
411
326
  get floatingTopRowCount() {
412
327
  var _this$totals$operatio4, _this$totals3, _this$totals3$operati;
413
-
414
328
  return this.totals != null && this.totals.showOnTop ? (_this$totals$operatio4 = (_this$totals3 = this.totals) === null || _this$totals3 === void 0 ? void 0 : (_this$totals3$operati = _this$totals3.operationOrder) === null || _this$totals3$operati === void 0 ? void 0 : _this$totals3$operati.length) !== null && _this$totals$operatio4 !== void 0 ? _this$totals$operatio4 : 0 : 0;
415
329
  }
416
-
417
330
  get isChartBuilderAvailable() {
418
331
  return true;
419
332
  }
420
-
421
333
  get isTotalsAvailable() {
422
334
  return this.table.getTotalsTable != null;
423
335
  }
424
-
425
336
  get isEditable() {
426
337
  return !this.isSaveInProgress && this.inputTable != null;
427
338
  }
428
-
429
339
  cacheFormattedValue(x, y, text) {
430
340
  if (this.formattedStringData[x] == null) {
431
341
  this.formattedStringData[x] = [];
432
342
  }
433
-
434
343
  this.formattedStringData[x][y] = text;
435
344
  }
436
-
437
345
  cachePendingValue(x, y, text) {
438
346
  if (this.pendingStringData[x] == null) {
439
347
  this.pendingStringData[x] = [];
440
348
  }
441
-
442
349
  this.pendingStringData[x][y] = text;
443
350
  }
444
-
445
351
  clearPendingValue(x, y) {
446
352
  var column = this.pendingStringData[x];
447
-
448
353
  if (column != null) {
449
354
  delete column[y];
450
355
  }
451
356
  }
452
-
453
357
  textValueForCell(x, y) {
454
358
  var _this$pendingStringDa, _this$formattedString;
455
-
456
359
  // First check if there's any pending values we should read from
457
360
  if (((_this$pendingStringDa = this.pendingStringData[x]) === null || _this$pendingStringDa === void 0 ? void 0 : _this$pendingStringDa[y]) !== undefined) {
458
361
  return this.pendingStringData[x][y];
459
- } // Use a separate cache from memoization just for the strings that are currently displayed
460
-
362
+ }
461
363
 
364
+ // Use a separate cache from memoization just for the strings that are currently displayed
462
365
  if (((_this$formattedString = this.formattedStringData[x]) === null || _this$formattedString === void 0 ? void 0 : _this$formattedString[y]) === undefined) {
463
366
  var _this$totalsColumn;
464
-
465
367
  var _value = this.valueForCell(x, y);
466
-
467
368
  if (_value == null) {
468
369
  return null;
469
370
  }
470
-
471
371
  var _column = (_this$totalsColumn = this.totalsColumn(x, y)) !== null && _this$totalsColumn !== void 0 ? _this$totalsColumn : this.columns[x];
472
-
473
372
  var hasCustomColumnFormat = this.getCachedCustomColumnFormatFlag(this.formatter, _column.name, _column.type);
474
373
  var formatOverride;
475
-
476
374
  if (!hasCustomColumnFormat) {
477
375
  var formatForCell = this.formatForCell(x, y);
478
-
479
376
  if ((formatForCell === null || formatForCell === void 0 ? void 0 : formatForCell.formatString) != null) {
480
377
  formatOverride = formatForCell;
481
378
  }
482
379
  }
483
-
484
380
  var text = this.displayString(_value, _column.type, _column.name, formatOverride);
485
381
  this.cacheFormattedValue(x, y, text);
486
382
  }
487
-
488
383
  return this.formattedStringData[x][y];
489
384
  }
490
-
491
385
  textForCell(x, y) {
492
386
  var text = this.textValueForCell(x, y);
493
-
494
387
  if (text == null && this.isKeyColumn(x)) {
495
388
  var pendingRow = this.pendingRow(y);
496
-
497
389
  if (pendingRow != null && this.pendingDataMap.has(pendingRow)) {
498
390
  // Asterisk to show a value is required for a key column on a row that has some data entered
499
391
  return '*';
500
392
  }
501
393
  }
502
-
503
394
  return text !== null && text !== void 0 ? text : '';
504
395
  }
505
-
506
396
  truncationCharForCell(x) {
507
397
  var column = this.columns[x];
508
398
  var {
509
399
  type
510
400
  } = column;
511
-
512
401
  if (TableUtils.isNumberType(type) && this.formatter.truncateNumbersWithPound) {
513
402
  return '#';
514
403
  }
515
-
516
404
  return undefined;
517
405
  }
518
-
519
406
  colorForCell(x, y, theme) {
520
407
  var data = this.dataForCell(x, y);
521
-
522
408
  if (data) {
523
409
  var {
524
410
  format,
525
411
  value: _value2
526
412
  } = data;
527
-
528
413
  if (_value2 == null || _value2 === '') {
529
414
  assertNotNull(theme.nullStringColor);
530
415
  return theme.nullStringColor;
531
416
  }
532
-
533
417
  if (format && format.color) {
534
418
  return format.color;
535
419
  }
536
-
537
420
  if (this.isPendingRow(y)) {
538
421
  // Data entered in a pending row
539
422
  assertNotNull(theme.pendingTextColor);
540
423
  return theme.pendingTextColor;
541
- } // Fallback to formatting based on the value/type of the cell
542
-
424
+ }
543
425
 
426
+ // Fallback to formatting based on the value/type of the cell
544
427
  if (_value2 != null) {
545
428
  var _this$totalsColumn2;
546
-
547
429
  var _column2 = (_this$totalsColumn2 = this.totalsColumn(x, y)) !== null && _this$totalsColumn2 !== void 0 ? _this$totalsColumn2 : this.columns[x];
548
-
549
430
  if (TableUtils.isDateType(_column2.type) || _column2.name === 'Date') {
550
431
  assertNotNull(theme.dateColor);
551
432
  return theme.dateColor;
552
433
  }
553
-
554
434
  if (TableUtils.isNumberType(_column2.type)) {
555
435
  if (_value2 > 0) {
556
436
  assertNotNull(theme.positiveNumberColor);
557
437
  return theme.positiveNumberColor;
558
438
  }
559
-
560
439
  if (_value2 < 0) {
561
440
  assertNotNull(theme.negativeNumberColor);
562
441
  return theme.negativeNumberColor;
563
442
  }
564
-
565
443
  assertNotNull(theme.zeroNumberColor);
566
444
  return theme.zeroNumberColor;
567
445
  }
@@ -570,145 +448,104 @@ class IrisGridTableModelTemplate extends IrisGridModel {
570
448
  assertNotNull(theme.errorTextColor);
571
449
  return theme.errorTextColor;
572
450
  }
573
-
574
451
  return theme.textColor;
575
452
  }
576
-
577
453
  backgroundColorForCell(x, y) {
578
454
  var _this$formatForCell$b, _this$formatForCell;
579
-
580
455
  return (_this$formatForCell$b = (_this$formatForCell = this.formatForCell(x, y)) === null || _this$formatForCell === void 0 ? void 0 : _this$formatForCell.backgroundColor) !== null && _this$formatForCell$b !== void 0 ? _this$formatForCell$b : null;
581
456
  }
582
-
583
457
  textAlignForCell(x) {
584
458
  var column = this.columns[x];
585
459
  var {
586
460
  type
587
461
  } = column;
588
-
589
462
  if (TableUtils.isNumberType(type)) {
590
463
  return 'right';
591
464
  }
592
-
593
465
  if (TableUtils.isDateType(type) || column.name === 'Date') {
594
466
  return 'center';
595
467
  }
596
-
597
468
  return 'left';
598
469
  }
599
-
600
470
  textForColumnHeader(x) {
601
471
  var _this$columnAtDepth$n, _this$columnAtDepth;
602
-
603
472
  var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
604
473
  return (_this$columnAtDepth$n = (_this$columnAtDepth = this.columnAtDepth(x, depth)) === null || _this$columnAtDepth === void 0 ? void 0 : _this$columnAtDepth.name) !== null && _this$columnAtDepth$n !== void 0 ? _this$columnAtDepth$n : undefined;
605
474
  }
606
-
607
475
  colorForColumnHeader(x) {
608
476
  var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
609
477
  var column = this.columnAtDepth(x, depth);
610
-
611
478
  if (isColumnHeaderGroup(column)) {
612
479
  var _column$color;
613
-
614
480
  return (_column$color = column.color) !== null && _column$color !== void 0 ? _column$color : null;
615
481
  }
616
-
617
482
  return null;
618
483
  }
619
-
620
484
  getColumnHeaderGroup(modelIndex, depth) {
621
485
  var group = this.columnAtDepth(modelIndex, depth);
622
-
623
486
  if (isColumnHeaderGroup(group)) {
624
487
  return group;
625
488
  }
626
-
627
489
  return undefined;
628
490
  }
629
-
630
491
  getColumnHeaderParentGroup(modelIndex, depth) {
631
492
  var _this$columnAtDepth$n2, _this$columnAtDepth2;
632
-
633
493
  return this.columnHeaderParentMap.get((_this$columnAtDepth$n2 = (_this$columnAtDepth2 = this.columnAtDepth(modelIndex, depth)) === null || _this$columnAtDepth2 === void 0 ? void 0 : _this$columnAtDepth2.name) !== null && _this$columnAtDepth$n2 !== void 0 ? _this$columnAtDepth$n2 : '');
634
494
  }
635
-
636
495
  columnAtDepth(x) {
637
496
  var _this$columns$x;
638
-
639
497
  var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
640
-
641
498
  if (depth === 0) {
642
499
  return this.columns[x];
643
500
  }
644
-
645
501
  var columnName = (_this$columns$x = this.columns[x]) === null || _this$columns$x === void 0 ? void 0 : _this$columns$x.name;
646
502
  var group = this.columnHeaderParentMap.get(columnName);
647
-
648
503
  if (!group) {
649
504
  return undefined;
650
505
  }
651
-
652
506
  var currentDepth = group.depth;
653
-
654
507
  while (currentDepth < depth) {
655
508
  group = this.columnHeaderParentMap.get(group.name);
656
-
657
509
  if (!group) {
658
510
  return undefined;
659
511
  }
660
-
661
512
  currentDepth = group.depth;
662
513
  }
663
-
664
514
  if (group.depth === depth) {
665
515
  return group;
666
516
  }
667
-
668
517
  return undefined;
669
518
  }
670
-
671
519
  textForRowFooter(y) {
672
520
  var totalsRow = this.totalsRow(y);
673
-
674
521
  if (totalsRow != null && this.totals) {
675
522
  return this.totals.operationOrder[totalsRow];
676
523
  }
677
-
678
524
  return '';
679
525
  }
526
+
680
527
  /**
681
528
  * Used to get the initial moved columns based on layout hints
682
529
  */
683
-
684
-
685
530
  get movedColumns() {
686
531
  var _this$layoutHints;
687
-
688
532
  var movedColumns = [];
689
-
690
533
  var moveColumn = (name, toIndex) => {
691
534
  var modelIndex = this.getColumnIndexByName(name);
692
-
693
535
  if (modelIndex == null) {
694
536
  throw new Error("Unknown layout hint column: ".concat(name));
695
537
  }
696
-
697
538
  var visibleIndex = GridUtils.getVisibleIndex(modelIndex, movedColumns);
698
539
  movedColumns = GridUtils.moveItem(visibleIndex, toIndex, movedColumns);
699
540
  };
700
-
701
541
  var moveGroup = (name, toIndex) => {
702
542
  var group = this.columnHeaderGroupMap.get(name);
703
-
704
543
  if (!group) {
705
544
  throw new Error("Unknown layout hint group: ".concat(name));
706
545
  }
707
-
708
546
  var visibleRange = group.getVisibleRange(movedColumns);
709
547
  movedColumns = GridUtils.moveRange(visibleRange, toIndex, movedColumns);
710
548
  };
711
-
712
549
  if (this.frontColumns.length || this.backColumns.length || this.frozenColumns.length) {
713
550
  var usedColumns = new Set();
714
551
  var frontIndex = 0;
@@ -716,7 +553,6 @@ class IrisGridTableModelTemplate extends IrisGridModel {
716
553
  if (usedColumns.has(name)) {
717
554
  throw new Error("Column specified in multiple layout hints: ".concat(name));
718
555
  }
719
-
720
556
  moveColumn(name, frontIndex);
721
557
  frontIndex += 1;
722
558
  });
@@ -724,7 +560,6 @@ class IrisGridTableModelTemplate extends IrisGridModel {
724
560
  if (usedColumns.has(name)) {
725
561
  throw new Error("Column specified in multiple layout hints: ".concat(name));
726
562
  }
727
-
728
563
  moveColumn(name, frontIndex);
729
564
  frontIndex += 1;
730
565
  });
@@ -733,14 +568,11 @@ class IrisGridTableModelTemplate extends IrisGridModel {
733
568
  if (usedColumns.has(name)) {
734
569
  throw new Error("Column specified in multiple layout hints: ".concat(name));
735
570
  }
736
-
737
571
  moveColumn(name, backIndex);
738
572
  backIndex -= 1;
739
573
  });
740
574
  }
741
-
742
575
  var layoutHintColumnGroups = (_this$layoutHints = this.layoutHints) === null || _this$layoutHints === void 0 ? void 0 : _this$layoutHints.columnGroups;
743
-
744
576
  if (layoutHintColumnGroups) {
745
577
  this.setColumnHeaderGroups(layoutHintColumnGroups);
746
578
  var columnGroups = [...this.columnHeaderGroupMap.values()];
@@ -749,26 +581,21 @@ class IrisGridTableModelTemplate extends IrisGridModel {
749
581
  var firstChildName = group.children[0];
750
582
  var rightModelIndex = this.getColumnIndexByName(firstChildName);
751
583
  var rightVisibleIndex;
752
-
753
584
  if (rightModelIndex != null) {
754
585
  rightVisibleIndex = GridUtils.getVisibleIndex(rightModelIndex, movedColumns);
755
586
  } else {
756
587
  var firstChildGroup = this.columnHeaderGroupMap.get(firstChildName);
757
-
758
588
  if (!firstChildGroup) {
759
589
  throw new Error("Unknown column ".concat(firstChildName, " in group ").concat(group.name));
760
590
  }
761
-
762
- var visibleRange = firstChildGroup.getVisibleRange(movedColumns); // Columns will be moved to start at the end of the first child group
763
-
591
+ var visibleRange = firstChildGroup.getVisibleRange(movedColumns);
592
+ // Columns will be moved to start at the end of the first child group
764
593
  [, rightVisibleIndex] = visibleRange;
765
594
  }
766
-
767
595
  for (var i = 1; i < group.children.length; i += 1) {
768
596
  var childName = group.children[i];
769
597
  var childGroup = this.columnHeaderGroupMap.get(childName);
770
598
  var childColumn = this.getColumnIndexByName(childName);
771
-
772
599
  if (childGroup) {
773
600
  // All columns in the group will be before or after the start index
774
601
  // Lower level groups are re-arranged first, so they will be contiguous
@@ -778,82 +605,62 @@ class IrisGridTableModelTemplate extends IrisGridModel {
778
605
  rightVisibleIndex = moveToIndex + childGroup.childIndexes.length - 1;
779
606
  } else if (childColumn != null) {
780
607
  var _isBeforeGroup = GridUtils.getVisibleIndex(childColumn, movedColumns) < rightVisibleIndex;
781
-
782
608
  var _moveToIndex = _isBeforeGroup ? rightVisibleIndex : rightVisibleIndex + 1;
783
-
784
609
  moveColumn(childName, _moveToIndex);
785
610
  rightVisibleIndex = _moveToIndex;
786
611
  }
787
612
  }
788
613
  });
789
614
  }
790
-
791
615
  return movedColumns;
792
616
  }
793
-
794
617
  get columnMap() {
795
618
  return this.getMemoizedColumnMap(this.table.columns);
796
619
  }
797
-
798
620
  get columnHeaderMaxDepth() {
799
621
  var _this$_columnHeaderMa;
800
-
801
622
  if (this._columnHeaderMaxDepth == null) {
802
623
  var _this$layoutHints2;
803
-
804
624
  this.setColumnHeaderGroups((_this$layoutHints2 = this.layoutHints) === null || _this$layoutHints2 === void 0 ? void 0 : _this$layoutHints2.columnGroups);
805
625
  }
806
-
807
626
  return (_this$_columnHeaderMa = this._columnHeaderMaxDepth) !== null && _this$_columnHeaderMa !== void 0 ? _this$_columnHeaderMa : 1;
808
627
  }
809
-
810
628
  set columnHeaderMaxDepth(depth) {
811
629
  this._columnHeaderMaxDepth = depth;
812
630
  }
813
-
814
631
  setColumnHeaderGroups(groups) {
815
632
  if (groups === this._columnHeaderGroups) {
816
633
  return;
817
634
  }
818
-
819
635
  this._columnHeaderGroups = groups !== null && groups !== void 0 ? groups : [];
820
636
  this.columnHeaderMaxDepth = 1;
821
637
  this.columnHeaderParentMap = new Map();
822
638
  this.columnHeaderGroupMap = new Map();
823
-
824
639
  if (!groups || groups.length === 0) {
825
640
  return;
826
641
  }
827
-
828
642
  var originalGroupMap = new Map(groups.map(group => [group.name, group]));
829
643
  var seenChildren = new Set();
830
-
831
644
  var addGroup = group => {
832
645
  var {
833
646
  name
834
647
  } = group;
835
-
836
648
  if (this.getColumnIndexByName(name) != null) {
837
649
  throw new Error("Column header group has same name as column: ".concat(name));
838
650
  }
839
-
840
651
  var existingGroup = this.columnHeaderGroupMap.get(name);
841
-
842
652
  if (existingGroup) {
843
653
  return existingGroup;
844
654
  }
845
-
846
655
  var childIndexes = [];
847
656
  var depth = 1;
848
657
  group.children.forEach(childName => {
849
658
  if (seenChildren.has(childName)) {
850
659
  throw new Error("Column group child ".concat(childName, " specified in multiple groups"));
851
660
  }
852
-
853
661
  seenChildren.add(childName);
854
662
  var childGroup = originalGroupMap.get(childName);
855
663
  var childIndex = this.getColumnIndexByName(childName);
856
-
857
664
  if (childGroup) {
858
665
  // Adding another column header group
859
666
  var addedGroup = addGroup(childGroup);
@@ -876,242 +683,195 @@ class IrisGridTableModelTemplate extends IrisGridModel {
876
683
  this.columnHeaderMaxDepth = Math.max(this.columnHeaderMaxDepth, columnHeaderGroup.depth + 1);
877
684
  return columnHeaderGroup;
878
685
  };
879
-
880
686
  var groupNames = new Set();
881
687
  groups.forEach(group => {
882
688
  var {
883
689
  name
884
690
  } = group;
885
-
886
691
  if (groupNames.has(name)) {
887
692
  throw new Error("Duplicate column group name: ".concat(name));
888
693
  }
889
-
890
694
  groupNames.add(name);
891
695
  addGroup(group);
892
696
  });
893
697
  }
894
-
895
698
  get groupedColumns() {
896
699
  return [];
897
700
  }
898
-
899
701
  row(y) {
900
702
  var _this$totals$operatio5, _this$totals4, _this$totals4$operati, _this$totals$showOnTo, _this$totals5, _this$viewportData$of, _this$viewportData, _this$viewportData$ro, _this$viewportData2, _this$viewportData2$r;
901
-
902
703
  var totalsRowCount = (_this$totals$operatio5 = (_this$totals4 = this.totals) === null || _this$totals4 === void 0 ? void 0 : (_this$totals4$operati = _this$totals4.operationOrder) === null || _this$totals4$operati === void 0 ? void 0 : _this$totals4$operati.length) !== null && _this$totals$operatio5 !== void 0 ? _this$totals$operatio5 : 0;
903
704
  var showOnTop = (_this$totals$showOnTo = (_this$totals5 = this.totals) === null || _this$totals5 === void 0 ? void 0 : _this$totals5.showOnTop) !== null && _this$totals$showOnTo !== void 0 ? _this$totals$showOnTo : false;
904
705
  var totalsRow = this.totalsRow(y);
905
-
906
706
  if (totalsRow != null) {
907
707
  var _this$totals6, _this$totalsDataMap$g, _this$totalsDataMap;
908
-
909
708
  var operation = (_this$totals6 = this.totals) === null || _this$totals6 === void 0 ? void 0 : _this$totals6.operationOrder[totalsRow];
910
709
  assertNotNull(operation);
911
710
  return (_this$totalsDataMap$g = (_this$totalsDataMap = this.totalsDataMap) === null || _this$totalsDataMap === void 0 ? void 0 : _this$totalsDataMap.get(operation)) !== null && _this$totalsDataMap$g !== void 0 ? _this$totalsDataMap$g : null;
912
711
  }
913
-
914
712
  var pendingRow = this.pendingRow(y);
915
-
916
713
  if (pendingRow != null) {
917
714
  var _this$pendingNewDataM;
918
-
919
715
  return (_this$pendingNewDataM = this.pendingNewDataMap.get(pendingRow)) !== null && _this$pendingNewDataM !== void 0 ? _this$pendingNewDataM : null;
920
716
  }
921
-
922
717
  var offset = (_this$viewportData$of = (_this$viewportData = this.viewportData) === null || _this$viewportData === void 0 ? void 0 : _this$viewportData.offset) !== null && _this$viewportData$of !== void 0 ? _this$viewportData$of : 0;
923
718
  var viewportY = (showOnTop ? y - totalsRowCount : y) - offset;
924
719
  return (_this$viewportData$ro = (_this$viewportData2 = this.viewportData) === null || _this$viewportData2 === void 0 ? void 0 : (_this$viewportData2$r = _this$viewportData2.rows) === null || _this$viewportData2$r === void 0 ? void 0 : _this$viewportData2$r[viewportY]) !== null && _this$viewportData$ro !== void 0 ? _this$viewportData$ro : null;
925
720
  }
721
+
926
722
  /**
927
723
  * Retrieve the totals column if this is a totals row, or null otherwise
928
724
  * @param x Column index to get the totals column from
929
725
  * @param y Row index to get the totals column from
930
726
  */
931
-
932
-
933
727
  totalsColumn(x, y) {
934
728
  var _this$totals7, _this$totals$defaultO, _this$totals8, _this$totalsTable;
935
-
936
729
  var totalsRow = this.totalsRow(y);
937
730
  if (totalsRow == null) return null;
938
731
  var operation = (_this$totals7 = this.totals) === null || _this$totals7 === void 0 ? void 0 : _this$totals7.operationOrder[totalsRow];
939
732
  var defaultOperation = (_this$totals$defaultO = (_this$totals8 = this.totals) === null || _this$totals8 === void 0 ? void 0 : _this$totals8.defaultOperation) !== null && _this$totals$defaultO !== void 0 ? _this$totals$defaultO : AggregationOperation.SUM;
940
- var tableColumn = this.columns[x]; // Find the matching totals table column for the operation
733
+ var tableColumn = this.columns[x];
734
+
735
+ // Find the matching totals table column for the operation
941
736
  // When there are multiple aggregations, the column name will be the original name of the column with the operation appended afterward
942
737
  // When the the operation is the default operation OR there is only one operation, then the totals column name is just the original column name
943
-
944
738
  return (_this$totalsTable = this.totalsTable) === null || _this$totalsTable === void 0 ? void 0 : _this$totalsTable.columns.find(column => {
945
739
  var _this$totals9;
946
-
947
740
  return column.name === "".concat(tableColumn.name, "__").concat(operation) || (operation === defaultOperation || ((_this$totals9 = this.totals) === null || _this$totals9 === void 0 ? void 0 : _this$totals9.operationOrder.length) === 1) && column.name === tableColumn.name;
948
741
  });
949
742
  }
743
+
950
744
  /**
951
745
  * Translate from the row in the model to a row in the totals table.
952
746
  * If the row is not a totals row, return null
953
747
  * @param y The row in the model to get the totals row for
954
748
  * @returns The row within the totals table if it's a totals row, null otherwise
955
749
  */
956
-
957
-
958
750
  totalsRow(y) {
959
751
  var _this$totals$operatio6, _this$totals10, _this$totals10$operat, _this$totals$showOnTo2, _this$totals11;
960
-
961
752
  var totalsRowCount = (_this$totals$operatio6 = (_this$totals10 = this.totals) === null || _this$totals10 === void 0 ? void 0 : (_this$totals10$operat = _this$totals10.operationOrder) === null || _this$totals10$operat === void 0 ? void 0 : _this$totals10$operat.length) !== null && _this$totals$operatio6 !== void 0 ? _this$totals$operatio6 : 0;
962
753
  var showOnTop = (_this$totals$showOnTo2 = (_this$totals11 = this.totals) === null || _this$totals11 === void 0 ? void 0 : _this$totals11.showOnTop) !== null && _this$totals$showOnTo2 !== void 0 ? _this$totals$showOnTo2 : false;
963
754
  var totalsRow = showOnTop ? y : y - this.table.size;
964
-
965
755
  if (totalsRow >= 0 && totalsRow < totalsRowCount) {
966
756
  return totalsRow;
967
757
  }
968
-
969
758
  return null;
970
759
  }
760
+
971
761
  /**
972
762
  * Translate from the row in the model to a pending input row.
973
763
  * If the row is not a pending input row, return null
974
764
  * @param y The row in the model to get the pending row for
975
765
  * @returns The row within the pending input rows if it's a pending row, null otherwise
976
766
  */
977
-
978
-
979
767
  pendingRow(y) {
980
768
  var pendingRow = y - this.floatingTopRowCount - this.table.size;
981
-
982
769
  if (pendingRow >= 0 && pendingRow < this.pendingNewRowCount) {
983
770
  return pendingRow;
984
771
  }
985
-
986
772
  return null;
987
773
  }
774
+
988
775
  /**
989
776
  * Check if a row is a totals table row
990
777
  * @param y The row in the model to check if it's a totals table row
991
778
  * @returns True if the row is a totals row, false if not
992
779
  */
993
-
994
-
995
780
  isTotalsRow(y) {
996
781
  return this.totalsRow(y) != null;
997
782
  }
783
+
998
784
  /**
999
785
  * Check if a row is a pending input row
1000
786
  * @param y The row in the model to check if it's a pending new row
1001
787
  * @returns True if the row is a pending new row, false if not
1002
788
  */
1003
-
1004
-
1005
789
  isPendingRow(y) {
1006
790
  return this.pendingRow(y) != null;
1007
791
  }
1008
-
1009
792
  dataForCell(x, y) {
1010
793
  var _this$row;
1011
-
1012
794
  return (_this$row = this.row(y)) === null || _this$row === void 0 ? void 0 : _this$row.data.get(x);
1013
795
  }
1014
-
1015
796
  formatForCell(x, y) {
1016
797
  var _this$dataForCell;
1017
-
1018
798
  return (_this$dataForCell = this.dataForCell(x, y)) === null || _this$dataForCell === void 0 ? void 0 : _this$dataForCell.format;
1019
799
  }
1020
-
1021
800
  valueForCell(x, y) {
1022
801
  var data = this.dataForCell(x, y);
802
+
1023
803
  /* JS API current sets null values as undefined in some instances. This means
1024
804
  we need to nullish coaelesce so all undefined values from the API return null
1025
805
  since the data has been fetched. undefined is used to indicate the API has not
1026
806
  fetched data yet */
1027
-
1028
807
  if (data) {
1029
808
  var _data$value;
1030
-
1031
809
  return (_data$value = data.value) !== null && _data$value !== void 0 ? _data$value : null;
1032
810
  }
1033
-
1034
811
  return undefined;
1035
812
  }
1036
-
1037
813
  copyViewportData(data) {
1038
814
  if (data == null) {
1039
815
  log.warn('invalid data!');
1040
816
  return;
1041
817
  }
1042
-
1043
818
  this.viewportData = this.extractViewportData(data);
1044
819
  this.formattedStringData = [];
1045
820
  }
1046
-
1047
821
  copyTotalsData(totalsData) {
1048
822
  var _this$totals$defaultO2,
1049
- _this$totals12,
1050
- _this$totals13,
1051
- _this = this;
1052
-
823
+ _this$totals12,
824
+ _this$totals13,
825
+ _this = this;
1053
826
  if (totalsData == null) {
1054
827
  log.warn('invalid data!');
1055
828
  return;
1056
829
  }
1057
-
1058
830
  var {
1059
831
  columns,
1060
832
  rows
1061
833
  } = totalsData;
1062
-
1063
834
  if (rows.length !== 1) {
1064
835
  log.error('Unexpected number of rows received for totals table, ignoring update');
1065
836
  return;
1066
837
  }
1067
-
1068
838
  var dataMap = new Map();
1069
839
  var row = rows[0];
1070
840
  var defaultOperation = (_this$totals$defaultO2 = (_this$totals12 = this.totals) === null || _this$totals12 === void 0 ? void 0 : _this$totals12.defaultOperation) !== null && _this$totals$defaultO2 !== void 0 ? _this$totals$defaultO2 : AggregationOperation.SUM;
1071
841
  var operationMap = (_this$totals13 = this.totals) === null || _this$totals13 === void 0 ? void 0 : _this$totals13.operationMap;
1072
-
1073
842
  var _loop = function _loop(c) {
1074
843
  var _operationMap$name$, _operationMap$name;
1075
-
1076
844
  var column = columns[c];
1077
845
  var [name, operation = (_operationMap$name$ = operationMap === null || operationMap === void 0 ? void 0 : (_operationMap$name = operationMap[name]) === null || _operationMap$name === void 0 ? void 0 : _operationMap$name[0]) !== null && _operationMap$name$ !== void 0 ? _operationMap$name$ : defaultOperation] = column.name.split('__');
1078
-
1079
846
  if (!dataMap.has(operation)) {
1080
847
  dataMap.set(operation, {
1081
848
  data: new Map()
1082
849
  });
1083
850
  }
1084
-
1085
851
  var {
1086
852
  data: rowData
1087
853
  } = dataMap.get(operation);
1088
-
1089
854
  var columnIndex = _this.columns.findIndex(col => col.name === name);
1090
-
1091
855
  rowData.set(columnIndex, {
1092
856
  value: row.get(column),
1093
857
  format: row.getFormat(column)
1094
858
  });
1095
859
  };
1096
-
1097
860
  for (var c = 0; c < columns.length; c += 1) {
1098
861
  _loop(c);
1099
862
  }
1100
-
1101
863
  log.debug2('copyTotalsData', dataMap);
1102
864
  this.totalsDataMap = dataMap;
1103
865
  this.formattedStringData = [];
1104
866
  }
867
+
1105
868
  /**
1106
869
  * Use this as the canonical column index since things like layoutHints could have
1107
870
  * changed the column order.
1108
871
  */
1109
-
1110
-
1111
872
  getColumnIndexByName(name) {
1112
873
  return this.getColumnIndicesByNameMap(this.columns).get(name);
1113
874
  }
1114
-
1115
875
  /**
1116
876
  * Copies all the viewport data into an object that we can reference later.
1117
877
  * @param data The data to copy from
@@ -1124,19 +884,15 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1124
884
  var {
1125
885
  columns
1126
886
  } = data;
1127
-
1128
887
  for (var r = 0; r < data.rows.length; r += 1) {
1129
888
  var _row = data.rows[r];
1130
889
  var newRow = this.extractViewportRow(_row, columns);
1131
890
  newData.rows.push(newRow);
1132
891
  }
1133
-
1134
892
  return newData;
1135
893
  }
1136
-
1137
894
  extractViewportRow(row, columns) {
1138
895
  var data = new Map();
1139
-
1140
896
  for (var c = 0; c < columns.length; c += 1) {
1141
897
  var _column3 = columns[c];
1142
898
  var index = this.getColumnIndexByName(_column3.name);
@@ -1146,82 +902,64 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1146
902
  format: row.getFormat(_column3)
1147
903
  });
1148
904
  }
1149
-
1150
905
  return {
1151
906
  data
1152
907
  };
1153
908
  }
1154
-
1155
909
  closeSubscription() {
1156
910
  log.debug2('closeSubscription', this.subscription);
1157
-
1158
911
  if (this.subscription) {
1159
912
  this.subscription.close();
1160
913
  this.subscription = null;
1161
914
  }
1162
-
1163
915
  this.setViewport.cancel();
1164
916
  this.applyViewport.cancel();
1165
917
  }
1166
-
1167
918
  get filter() {
1168
919
  return this.table.filter;
1169
920
  }
1170
-
1171
921
  set filter(filter) {
1172
922
  this.closeSubscription();
1173
923
  this.table.applyFilter(filter);
1174
924
  this.applyViewport();
1175
925
  }
1176
-
1177
926
  get formatter() {
1178
927
  return this.irisFormatter;
1179
928
  }
1180
-
1181
929
  set formatter(formatter) {
1182
930
  this.irisFormatter = formatter;
1183
931
  this.formattedStringData = [];
1184
932
  this.dispatchEvent(new EventShimCustomEvent(IrisGridModel.EVENT.FORMATTER_UPDATED));
1185
933
  }
1186
-
1187
934
  displayString(value, columnType) {
1188
935
  var columnName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
1189
936
  var formatOverride = arguments.length > 3 ? arguments[3] : undefined;
1190
937
  return this.getCachedFormattedString(this.formatter, value, columnType, columnName, formatOverride);
1191
938
  }
1192
-
1193
939
  get sort() {
1194
940
  return this.table.sort;
1195
941
  }
1196
-
1197
942
  set sort(sort) {
1198
943
  this.closeSubscription();
1199
944
  this.table.applySort(sort);
1200
945
  this.applyViewport();
1201
946
  }
1202
-
1203
947
  set totalsConfig(totalsConfig) {
1204
948
  log.debug('set totalsConfig', totalsConfig);
1205
-
1206
949
  if (totalsConfig === this.totals) {
1207
950
  // Totals already set, or it will be set when the next model actually gets set
1208
951
  return;
1209
952
  }
1210
-
1211
953
  this.totals = totalsConfig;
1212
954
  this.formattedStringData = [];
1213
-
1214
955
  if (this.totalsTablePromise != null) {
1215
956
  this.totalsTablePromise.cancel();
1216
957
  }
1217
-
1218
958
  this.setTotalsTable(null);
1219
-
1220
959
  if (totalsConfig == null) {
1221
960
  this.dispatchEvent(new EventShimCustomEvent(IrisGridModel.EVENT.UPDATED));
1222
961
  return;
1223
962
  }
1224
-
1225
963
  this.totalsTablePromise = PromiseUtils.makeCancelable(this.table.getTotalsTable(totalsConfig), table => table.close());
1226
964
  this.totalsTablePromise.then(totalsTable => {
1227
965
  this.totalsTablePromise = null;
@@ -1230,7 +968,6 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1230
968
  if (PromiseUtils.isCanceled(err)) {
1231
969
  return;
1232
970
  }
1233
-
1234
971
  log.error('Unable to set next totalsTable', err);
1235
972
  this.totalsTablePromise = null;
1236
973
  this.dispatchEvent(new EventShimCustomEvent(IrisGridModel.EVENT.REQUEST_FAILED, {
@@ -1238,29 +975,22 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1238
975
  }));
1239
976
  });
1240
977
  }
1241
-
1242
978
  setTotalsTable(totalsTable) {
1243
979
  log.debug('setTotalsTable', totalsTable);
1244
-
1245
980
  if (this.totalsTable !== null) {
1246
981
  if (this.listenerCount > 0) {
1247
982
  this.removeTotalsListeners(this.totalsTable);
1248
983
  }
1249
-
1250
984
  this.totalsTable.close();
1251
985
  }
1252
-
1253
986
  this.totalsTable = totalsTable;
1254
987
  this.totalsDataMap = null;
1255
-
1256
988
  if (this.listenerCount > 0 && this.totalsTable != null) {
1257
989
  this.addTotalsListeners(this.totalsTable);
1258
990
  }
1259
991
  }
1260
-
1261
992
  applyBufferedViewport(viewportTop, viewportBottom, columns) {
1262
993
  log.debug2('applyBufferedViewport', viewportTop, viewportBottom, columns);
1263
-
1264
994
  if (this.subscription == null) {
1265
995
  log.debug2('applyBufferedViewport creating new subscription');
1266
996
  this.subscription = this.table.setViewport(viewportTop, viewportBottom, columns);
@@ -1269,111 +999,89 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1269
999
  this.subscription.setViewport(viewportTop, viewportBottom, columns);
1270
1000
  }
1271
1001
  }
1272
-
1273
1002
  snapshot(ranges) {
1274
1003
  var _arguments = arguments,
1275
- _this2 = this;
1276
-
1004
+ _this2 = this;
1277
1005
  return _asyncToGenerator(function* () {
1278
1006
  var includeHeaders = _arguments.length > 1 && _arguments[1] !== undefined ? _arguments[1] : false;
1279
1007
  var formatValue = _arguments.length > 2 && _arguments[2] !== undefined ? _arguments[2] : value => value;
1280
1008
  var consolidateRanges = _arguments.length > 3 && _arguments[3] !== undefined ? _arguments[3] : true;
1281
-
1282
1009
  if (_this2.subscription == null) {
1283
1010
  throw new Error('No subscription available');
1284
1011
  }
1285
-
1286
1012
  var consolidated = consolidateRanges ? GridRange.consolidate(ranges) : ranges;
1287
-
1288
1013
  if (!IrisGridUtils.isValidSnapshotRanges(consolidated)) {
1289
1014
  throw new Error("Invalid snapshot ranges ".concat(ranges));
1290
- } // Need to separate out the floating ranges as they're from a different source
1291
-
1015
+ }
1292
1016
 
1017
+ // Need to separate out the floating ranges as they're from a different source
1293
1018
  var topFloatingRowsSet = new Set();
1294
1019
  var tableRanges = [];
1295
1020
  var bottomFloatingRowsSet = new Set();
1296
-
1297
1021
  for (var i = 0; i < consolidated.length; i += 1) {
1298
1022
  var range = consolidated[i];
1299
1023
  assertNotNull(range.endRow);
1300
- assertNotNull(range.startRow); // Get the rows that are in the top aggregations section
1301
-
1024
+ assertNotNull(range.startRow);
1025
+ // Get the rows that are in the top aggregations section
1302
1026
  for (var r = range.startRow; r <= range.endRow && r < _this2.floatingTopRowCount; r += 1) {
1303
1027
  topFloatingRowsSet.add(r);
1304
- } // Separate out the range that is part of the actual table (ie. not the floating ranges, not aggregations)
1305
-
1028
+ }
1306
1029
 
1030
+ // Separate out the range that is part of the actual table (ie. not the floating ranges, not aggregations)
1307
1031
  if (range.endRow >= _this2.floatingTopRowCount && range.startRow <= _this2.floatingTopRowCount + _this2.table.size) {
1308
1032
  tableRanges.push(new GridRange(range.startColumn, Math.min(Math.max(0, range.startRow - _this2.floatingTopRowCount)), range.endColumn, Math.min(Math.max(0, range.endRow - _this2.floatingTopRowCount), _this2.table.size - _this2.floatingTopRowCount)));
1309
- } // Get the rows that are in the bottom aggregations section
1310
-
1311
-
1033
+ }
1034
+ // Get the rows that are in the bottom aggregations section
1312
1035
  for (var _r = Math.max(range.startRow, _this2.floatingTopRowCount + _this2.table.size); _r <= range.endRow && _r < _this2.floatingTopRowCount + _this2.table.size + _this2.floatingBottomRowCount; _r += 1) {
1313
1036
  bottomFloatingRowsSet.add(_r);
1314
1037
  }
1315
1038
  }
1316
-
1317
1039
  var columns = IrisGridUtils.columnsFromRanges(consolidated, _this2.columns);
1318
1040
  var result = [];
1319
-
1320
1041
  if (includeHeaders) {
1321
1042
  result.push(columns.map(c => c.name));
1322
1043
  }
1323
-
1324
1044
  var topFloatingRows = [...topFloatingRowsSet].sort();
1325
-
1326
1045
  var _loop2 = function _loop2(_i) {
1327
1046
  var row = topFloatingRows[_i];
1328
1047
  var rowData = columns.map(column => {
1329
1048
  var index = _this2.getColumnIndexByName(column.name);
1330
-
1331
1049
  assertNotNull(index);
1332
1050
  return formatValue(_this2.valueForCell(index, row), column);
1333
1051
  });
1334
-
1335
1052
  if (includeHeaders) {
1336
1053
  rowData.push(_this2.textForRowFooter(row));
1337
1054
  }
1338
-
1339
1055
  result.push(rowData);
1340
1056
  };
1341
-
1342
1057
  for (var _i = 0; _i < topFloatingRows.length; _i += 1) {
1343
1058
  _loop2(_i);
1344
1059
  }
1345
-
1346
1060
  if (tableRanges.length > 0) {
1347
1061
  var rangeSet = IrisGridUtils.rangeSetFromRanges(tableRanges);
1348
1062
  var snapshot = yield _this2.subscription.snapshot(rangeSet, columns);
1349
1063
  result.push(...snapshot.rows.map(rowData => columns.map(column => formatValue(rowData.get(column), column))));
1350
1064
  }
1351
-
1352
1065
  var bottomFloatingRows = [...bottomFloatingRowsSet].sort();
1353
-
1354
1066
  var _loop3 = function _loop3(_i2) {
1355
1067
  var row = bottomFloatingRows[_i2];
1356
1068
  var rowData = columns.map(column => {
1357
1069
  var index = _this2.getColumnIndexByName(column.name);
1358
-
1359
1070
  assertNotNull(index);
1360
1071
  return formatValue(_this2.valueForCell(index, row), column);
1361
1072
  });
1362
-
1363
1073
  if (includeHeaders) {
1364
1074
  rowData.push(_this2.textForRowFooter(row));
1365
1075
  }
1366
-
1367
1076
  result.push(rowData);
1368
1077
  };
1369
-
1370
1078
  for (var _i2 = 0; _i2 < bottomFloatingRows.length; _i2 += 1) {
1371
1079
  _loop3(_i2);
1372
1080
  }
1373
-
1374
1081
  return result;
1375
1082
  })();
1376
1083
  }
1084
+
1377
1085
  /**
1378
1086
  * Get a text snapshot of the provided ranges
1379
1087
  * @param ranges The ranges to get the snapshot for
@@ -1381,12 +1089,9 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1381
1089
  * @param formatValue Function for formatting the raw value into a string
1382
1090
  * @returns A formatted string of all the data, columns separated by `\t` and rows separated by `\n`
1383
1091
  */
1384
-
1385
-
1386
1092
  textSnapshot(ranges) {
1387
1093
  var _arguments2 = arguments,
1388
- _this3 = this;
1389
-
1094
+ _this3 = this;
1390
1095
  return _asyncToGenerator(function* () {
1391
1096
  var includeHeaders = _arguments2.length > 1 && _arguments2[1] !== undefined ? _arguments2[1] : false;
1392
1097
  var formatValue = _arguments2.length > 2 && _arguments2[2] !== undefined ? _arguments2[2] : value => "".concat(value);
@@ -1395,13 +1100,10 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1395
1100
  return data.map(row => row.join('\t')).join('\n');
1396
1101
  })();
1397
1102
  }
1398
-
1399
1103
  valuesTable(column) {
1400
1104
  var _this4 = this;
1401
-
1402
1105
  return _asyncToGenerator(function* () {
1403
1106
  var table = null;
1404
-
1405
1107
  try {
1406
1108
  table = yield _this4.table.copy();
1407
1109
  table.applyFilter([]);
@@ -1414,67 +1116,55 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1414
1116
  }
1415
1117
  })();
1416
1118
  }
1417
-
1418
1119
  isColumnMovable(modelIndex, depth) {
1419
1120
  if (modelIndex < 0 || modelIndex >= this.columnCount) {
1420
1121
  return false;
1421
- } // All groups are movable
1422
-
1122
+ }
1423
1123
 
1124
+ // All groups are movable
1424
1125
  if (depth > 0) {
1425
1126
  return true;
1426
1127
  }
1427
-
1428
1128
  var columnName = this.columns[modelIndex].name;
1429
-
1430
1129
  if (this.frontColumns.includes(columnName) || this.backColumns.includes(columnName) || this.frozenColumns.includes(columnName) || !columnName) {
1431
1130
  return false;
1432
1131
  }
1433
-
1434
1132
  return !this.isKeyColumn(modelIndex);
1435
1133
  }
1436
-
1437
1134
  isKeyColumn(x) {
1438
1135
  var _this$inputTable$keyC2, _this$inputTable2;
1439
-
1440
1136
  return x < ((_this$inputTable$keyC2 = (_this$inputTable2 = this.inputTable) === null || _this$inputTable2 === void 0 ? void 0 : _this$inputTable2.keyColumns.length) !== null && _this$inputTable$keyC2 !== void 0 ? _this$inputTable$keyC2 : 0);
1441
1137
  }
1442
-
1443
1138
  isRowMovable() {
1444
1139
  return false;
1445
1140
  }
1446
-
1447
1141
  isEditableRange(range) {
1448
1142
  return this.inputTable != null && GridRange.isBounded(range) && (this.isPendingRow(range.startRow) && this.isPendingRow(range.endRow) || range.startColumn >= this.inputTable.keyColumns.length && range.endColumn >= this.inputTable.keyColumns.length) && range.startRow >= this.floatingTopRowCount && range.startRow < this.floatingTopRowCount + this.table.size + this.pendingRowCount && range.endRow < this.floatingTopRowCount + this.table.size + this.pendingRowCount;
1449
1143
  }
1450
-
1451
1144
  isDeletableRange(range) {
1452
1145
  return this.inputTable != null && range.startRow != null && range.endRow != null && range.startRow >= this.floatingTopRowCount && range.startRow < this.floatingTopRowCount + this.table.size + this.pendingRowCount && range.endRow < this.floatingTopRowCount + this.table.size + this.pendingRowCount;
1453
1146
  }
1454
-
1455
1147
  isEditableRanges(ranges) {
1456
1148
  return ranges.every(range => this.isEditableRange(range));
1457
1149
  }
1458
-
1459
1150
  isDeletableRanges(ranges) {
1460
1151
  return ranges.every(range => this.isDeletableRange(range));
1461
1152
  }
1153
+
1462
1154
  /**
1463
1155
  * @returns A range corresponding to the underlying table
1464
1156
  */
1465
-
1466
-
1467
1157
  getTableAreaRange() {
1468
1158
  return new GridRange(null, this.floatingTopRowCount, null, this.floatingTopRowCount + this.table.size - 1);
1469
1159
  }
1160
+
1470
1161
  /**
1471
1162
  * @returns A range corresponding to the pending new rows
1472
1163
  */
1473
-
1474
-
1475
1164
  getPendingAreaRange() {
1476
1165
  return new GridRange(null, this.floatingTopRowCount + this.table.size, null, this.floatingTopRowCount + this.table.size + this.pendingNewRowCount - 1);
1477
1166
  }
1167
+
1478
1168
  /**
1479
1169
  * Set value in an editable table
1480
1170
  * @param x The column to set
@@ -1482,58 +1172,49 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1482
1172
  * @param value The value to set
1483
1173
  * @returns A promise that resolves successfully when the operation is complete, or rejects if there's an error
1484
1174
  */
1485
-
1486
-
1487
1175
  setValueForCell(x, y, text) {
1488
1176
  var _this5 = this;
1489
-
1490
1177
  return _asyncToGenerator(function* () {
1491
1178
  // Cache the value in our pending string cache so that it stays displayed until our edit has been completed
1492
1179
  return _this5.setValueForRanges([new GridRange(x, y, x, y)], text);
1493
1180
  })();
1494
1181
  }
1182
+
1495
1183
  /**
1496
1184
  * Set value in an editable table
1497
1185
  * @param ranges The ranges to set
1498
1186
  * @param value The values to set
1499
1187
  * @returns A promise that resolves successfully when the operation is complete, or rejects if there's an error
1500
1188
  */
1501
-
1502
-
1503
1189
  setValueForRanges(ranges, text) {
1504
1190
  var _this6 = this;
1505
-
1506
1191
  return _asyncToGenerator(function* () {
1507
1192
  if (!_this6.isEditableRanges(ranges)) {
1508
1193
  throw new Error("Uneditable ranges ".concat(ranges));
1509
1194
  }
1510
-
1511
1195
  try {
1512
1196
  // Cache the value in our pending string cache so that it stays displayed until our edit has been completed
1513
- var columnSet = new Set(); // Formatted text for each column
1514
- // Since there could be different formatting for each column, but the value will be the same across rows
1197
+ var columnSet = new Set();
1515
1198
 
1199
+ // Formatted text for each column
1200
+ // Since there could be different formatting for each column, but the value will be the same across rows
1516
1201
  var formattedText = [];
1517
1202
  GridRange.forEachCell(ranges, (x, y) => {
1518
1203
  var column = _this6.columns[x];
1519
1204
  columnSet.add(column);
1520
-
1521
1205
  if (formattedText[x] === undefined) {
1522
1206
  var _value3 = TableUtils.makeValue(column.type, text, _this6.formatter.timeZone);
1523
-
1524
1207
  formattedText[x] = _value3 != null ? _this6.displayString(_value3, column.type, column.name) : null;
1525
1208
  }
1526
-
1527
1209
  _this6.cachePendingValue(x, y, formattedText[x]);
1528
- }); // Take care of updates to the pending new area first, as they can be updated synchronously
1210
+ });
1529
1211
 
1212
+ // Take care of updates to the pending new area first, as they can be updated synchronously
1530
1213
  var pendingAreaRange = _this6.getPendingAreaRange();
1531
-
1532
1214
  var pendingRanges = ranges.map(range => GridRange.intersection(pendingAreaRange, range)).filter(range => range != null).map(range => {
1533
1215
  assertNotNull(range);
1534
1216
  return GridRange.offset(range, 0, -(_this6.floatingTopRowCount + _this6.table.size));
1535
1217
  });
1536
-
1537
1218
  if (pendingRanges.length > 0) {
1538
1219
  var newDataMap = new Map(_this6.pendingNewDataMap);
1539
1220
  GridRange.forEachCell(pendingRanges, (columnIndex, rowIndex) => {
@@ -1542,7 +1223,6 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1542
1223
  data: new Map()
1543
1224
  });
1544
1225
  }
1545
-
1546
1226
  var column = _this6.columns[columnIndex];
1547
1227
  var row = newDataMap.get(rowIndex);
1548
1228
  assertNotNull(row);
@@ -1551,7 +1231,6 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1551
1231
  } = row;
1552
1232
  var newRowData = new Map(rowData);
1553
1233
  var value = TableUtils.makeValue(column.type, text, _this6.formatter.timeZone);
1554
-
1555
1234
  if (value != null) {
1556
1235
  newRowData.set(columnIndex, {
1557
1236
  value
@@ -1559,7 +1238,6 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1559
1238
  } else {
1560
1239
  newRowData.delete(columnIndex);
1561
1240
  }
1562
-
1563
1241
  if (newRowData.size > 0) {
1564
1242
  newDataMap.set(rowIndex, _objectSpread(_objectSpread({}, row), {}, {
1565
1243
  data: newRowData
@@ -1570,29 +1248,21 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1570
1248
  });
1571
1249
  _this6.pendingDataMap = newDataMap;
1572
1250
  }
1573
-
1574
1251
  _this6.dispatchEvent(new EventShimCustomEvent(IrisGridModel.EVENT.UPDATED));
1575
-
1576
1252
  var tableAreaRange = _this6.getTableAreaRange();
1577
-
1578
1253
  var tableRanges = ranges.map(range => GridRange.intersection(tableAreaRange, range)).filter(range => range != null);
1579
-
1580
1254
  if (tableRanges.length > 0) {
1581
1255
  var _this6$inputTable;
1582
-
1583
1256
  // Get a snapshot of the full rows, as we need to write a full row when editing
1584
1257
  var data = yield _this6.snapshot(tableRanges.map(range => {
1585
1258
  var _range$startRow, _range$endRow;
1586
-
1587
1259
  return new GridRange(null, (_range$startRow = range === null || range === void 0 ? void 0 : range.startRow) !== null && _range$startRow !== void 0 ? _range$startRow : null, null, (_range$endRow = range === null || range === void 0 ? void 0 : range.endRow) !== null && _range$endRow !== void 0 ? _range$endRow : null);
1588
1260
  }));
1589
1261
  var newRows = data.map(row => {
1590
1262
  var newRow = {};
1591
-
1592
1263
  for (var c = 0; c < _this6.columns.length; c += 1) {
1593
1264
  newRow[_this6.columns[c].name] = row[c];
1594
1265
  }
1595
-
1596
1266
  columnSet.forEach(column => {
1597
1267
  newRow[column.name] = TableUtils.makeValue(column.type, text, _this6.formatter.timeZone);
1598
1268
  });
@@ -1600,15 +1270,14 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1600
1270
  });
1601
1271
  var result = yield (_this6$inputTable = _this6.inputTable) === null || _this6$inputTable === void 0 ? void 0 : _this6$inputTable.addRows(newRows);
1602
1272
  log.debug('setValueForRanges(', ranges, ',', text, ') set tableRanges', tableRanges, 'result', result);
1603
- } // Add the changes to the formatted cache so it's still displayed until the update event is received
1273
+ }
1274
+
1275
+ // Add the changes to the formatted cache so it's still displayed until the update event is received
1604
1276
  // The update event could be received on the next tick, after the input rows have been committed,
1605
1277
  // so make sure we don't display stale data
1606
-
1607
-
1608
1278
  GridRange.forEachCell(ranges, (x, y) => {
1609
1279
  var cellText = formattedText[x];
1610
1280
  assertNotNull(cellText);
1611
-
1612
1281
  _this6.cacheFormattedValue(x, y, cellText);
1613
1282
  });
1614
1283
  } catch (err) {
@@ -1620,29 +1289,24 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1620
1289
  }
1621
1290
  })();
1622
1291
  }
1623
-
1624
1292
  setValues() {
1625
1293
  var _arguments3 = arguments,
1626
- _this7 = this;
1627
-
1294
+ _this7 = this;
1628
1295
  return _asyncToGenerator(function* () {
1629
1296
  var edits = _arguments3.length > 0 && _arguments3[0] !== undefined ? _arguments3[0] : [];
1630
1297
  log.debug('setValues(', edits, ')');
1631
-
1632
1298
  if (!edits.every(edit => {
1633
1299
  var _edit$column, _edit$row;
1634
-
1635
1300
  return _this7.isEditableRange(GridRange.makeCell((_edit$column = edit.column) !== null && _edit$column !== void 0 ? _edit$column : edit.x, (_edit$row = edit.row) !== null && _edit$row !== void 0 ? _edit$row : edit.y));
1636
1301
  })) {
1637
1302
  throw new Error("Uneditable ranges ".concat(edits));
1638
1303
  }
1639
-
1640
1304
  try {
1641
- var newDataMap = new Map(_this7.pendingNewDataMap); // Cache the display values
1305
+ var newDataMap = new Map(_this7.pendingNewDataMap);
1642
1306
 
1307
+ // Cache the display values
1643
1308
  edits.forEach(edit => {
1644
1309
  var _edit$column2, _edit$row2;
1645
-
1646
1310
  var {
1647
1311
  text
1648
1312
  } = edit;
@@ -1651,27 +1315,22 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1651
1315
  var column = _this7.columns[x];
1652
1316
  var value = TableUtils.makeValue(column.type, text, _this7.formatter.timeZone);
1653
1317
  var formattedText = value != null ? _this7.displayString(value, column.type, column.name) : null;
1318
+ _this7.cachePendingValue(x, y, formattedText);
1654
1319
 
1655
- _this7.cachePendingValue(x, y, formattedText); // Take care of updates to the pending new area as well, as that can be updated synchronously
1656
-
1657
-
1320
+ // Take care of updates to the pending new area as well, as that can be updated synchronously
1658
1321
  var pendingRow = _this7.pendingRow(y);
1659
-
1660
1322
  if (pendingRow != null) {
1661
1323
  if (!newDataMap.has(pendingRow)) {
1662
1324
  newDataMap.set(pendingRow, {
1663
1325
  data: new Map()
1664
1326
  });
1665
1327
  }
1666
-
1667
1328
  var _row2 = newDataMap.get(pendingRow);
1668
-
1669
1329
  assertNotNull(_row2);
1670
1330
  var {
1671
1331
  data: rowData
1672
1332
  } = _row2;
1673
1333
  var newRowData = new Map(rowData);
1674
-
1675
1334
  if (value != null) {
1676
1335
  newRowData.set(x, {
1677
1336
  value
@@ -1679,7 +1338,6 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1679
1338
  } else {
1680
1339
  newRowData.delete(x);
1681
1340
  }
1682
-
1683
1341
  if (newRowData.size > 0) {
1684
1342
  newDataMap.set(pendingRow, _objectSpread(_objectSpread({}, _row2), {}, {
1685
1343
  data: newRowData
@@ -1689,36 +1347,29 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1689
1347
  }
1690
1348
  }
1691
1349
  });
1692
- _this7.pendingDataMap = newDataMap; // Send an update right after setting the pending map so the values are displayed immediately
1693
-
1694
- _this7.dispatchEvent(new EventShimCustomEvent(IrisGridModel.EVENT.UPDATED)); // Need to group by row...
1350
+ _this7.pendingDataMap = newDataMap;
1695
1351
 
1352
+ // Send an update right after setting the pending map so the values are displayed immediately
1353
+ _this7.dispatchEvent(new EventShimCustomEvent(IrisGridModel.EVENT.UPDATED));
1696
1354
 
1355
+ // Need to group by row...
1697
1356
  var rowEditMap = edits.reduce((rowMap, edit) => {
1698
1357
  var _edit$row3, _rowMap$get;
1699
-
1700
1358
  var y = (_edit$row3 = edit.row) !== null && _edit$row3 !== void 0 ? _edit$row3 : edit.y;
1701
-
1702
1359
  if (!rowMap.has(y)) {
1703
1360
  rowMap.set(y, []);
1704
1361
  }
1705
-
1706
1362
  (_rowMap$get = rowMap.get(y)) === null || _rowMap$get === void 0 ? void 0 : _rowMap$get.push(edit);
1707
1363
  return rowMap;
1708
1364
  }, new Map());
1709
1365
  var ranges = GridRange.consolidate(edits.map(edit => {
1710
1366
  var _edit$column3, _edit$row4;
1711
-
1712
1367
  return GridRange.makeCell((_edit$column3 = edit.column) !== null && _edit$column3 !== void 0 ? _edit$column3 : edit.x, (_edit$row4 = edit.row) !== null && _edit$row4 !== void 0 ? _edit$row4 : edit.y);
1713
1368
  }));
1714
-
1715
1369
  var tableAreaRange = _this7.getTableAreaRange();
1716
-
1717
1370
  var tableRanges = ranges.map(range => GridRange.intersection(tableAreaRange, range)).filter(range => range != null);
1718
-
1719
1371
  if (tableRanges.length > 0) {
1720
1372
  var _this7$inputTable;
1721
-
1722
1373
  // Get a snapshot of the full rows, as we need to write a full row when editing
1723
1374
  var data = yield _this7.snapshot(tableRanges.map(range => {
1724
1375
  assertNotNull(range);
@@ -1727,53 +1378,43 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1727
1378
  var newRows = data.map((row, dataIndex) => {
1728
1379
  var rowIndex = null;
1729
1380
  var r = dataIndex;
1730
-
1731
1381
  for (var i = 0; i < tableRanges.length; i += 1) {
1732
1382
  var range = tableRanges[i];
1733
1383
  assertNotNull(range);
1734
1384
  var rangeRowCount = GridRange.rowCount([range]);
1735
-
1736
1385
  if (r < rangeRowCount) {
1737
1386
  assertNotNull(range.startRow);
1738
1387
  rowIndex = range.startRow + r;
1739
1388
  break;
1740
1389
  }
1741
-
1742
1390
  r -= rangeRowCount;
1743
1391
  }
1744
-
1745
1392
  var newRow = {};
1746
-
1747
1393
  for (var c = 0; c < _this7.columns.length; c += 1) {
1748
1394
  newRow[_this7.columns[c].name] = row[c];
1749
1395
  }
1750
-
1751
1396
  assertNotNull(rowIndex);
1752
1397
  var rowEdits = rowEditMap.get(rowIndex);
1753
-
1754
1398
  if (rowEdits != null) {
1755
1399
  rowEdits.forEach(edit => {
1756
1400
  var _edit$column4;
1757
-
1758
1401
  var column = _this7.columns[(_edit$column4 = edit.column) !== null && _edit$column4 !== void 0 ? _edit$column4 : edit.x];
1759
1402
  newRow[column.name] = TableUtils.makeValue(column.type, edit.text, _this7.formatter.timeZone);
1760
1403
  });
1761
1404
  }
1762
-
1763
1405
  return newRow;
1764
1406
  });
1765
1407
  log.info('setValues setting tableRanges', tableRanges);
1766
1408
  var result = yield (_this7$inputTable = _this7.inputTable) === null || _this7$inputTable === void 0 ? void 0 : _this7$inputTable.addRows(newRows);
1767
1409
  log.info('setValues set tableRanges', tableRanges, 'SUCCESS', result);
1768
- } // We've sent the changes to the server, but have not yet got an update with those changes committed
1410
+ }
1411
+
1412
+ // We've sent the changes to the server, but have not yet got an update with those changes committed
1769
1413
  // Add the changes to the formatted cache so it's still displayed until the update event is received
1770
1414
  // The update event could be received on the next tick, after the input rows have been committed,
1771
1415
  // so make sure we don't display stale data
1772
-
1773
-
1774
1416
  edits.forEach(edit => {
1775
1417
  var _edit$column5, _edit$row5;
1776
-
1777
1418
  var {
1778
1419
  text
1779
1420
  } = edit;
@@ -1782,7 +1423,6 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1782
1423
  var column = _this7.columns[x];
1783
1424
  var value = TableUtils.makeValue(column.type, text, _this7.formatter.timeZone);
1784
1425
  var formattedText = value != null ? _this7.displayString(value, column.type, column.name) : null;
1785
-
1786
1426
  _this7.cacheFormattedValue(x, y, formattedText);
1787
1427
  });
1788
1428
  } finally {
@@ -1792,21 +1432,16 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1792
1432
  }
1793
1433
  })();
1794
1434
  }
1795
-
1796
1435
  commitPending() {
1797
1436
  var _this8 = this;
1798
-
1799
1437
  return _asyncToGenerator(function* () {
1800
1438
  if (_this8.pendingNewDataMap.size <= 0) {
1801
1439
  throw new Error('No pending changes to commit');
1802
1440
  }
1803
-
1804
1441
  try {
1805
1442
  var _this8$inputTable, _this8$viewport$botto, _this8$viewport;
1806
-
1807
1443
  _this8.isSaveInProgress = true;
1808
1444
  var newRows = [];
1809
-
1810
1445
  _this8.pendingNewDataMap.forEach(row => {
1811
1446
  var newRow = {};
1812
1447
  row.data.forEach((_ref2, columnIndex) => {
@@ -1818,114 +1453,91 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1818
1453
  });
1819
1454
  newRows.push(newRow);
1820
1455
  });
1821
-
1822
1456
  var result = yield (_this8$inputTable = _this8.inputTable) === null || _this8$inputTable === void 0 ? void 0 : _this8$inputTable.addRows(newRows);
1823
1457
  log.debug('commitPending()', _this8.pendingNewDataMap, 'result', result);
1824
1458
  _this8.pendingNewDataMap = new Map();
1825
1459
  _this8.pendingNewDataErrors = new Map();
1826
1460
  _this8.pendingNewRowCount = Math.max(0, ((_this8$viewport$botto = (_this8$viewport = _this8.viewport) === null || _this8$viewport === void 0 ? void 0 : _this8$viewport.bottom) !== null && _this8$viewport$botto !== void 0 ? _this8$viewport$botto : 0) - _this8.table.size);
1827
1461
  _this8.formattedStringData = [];
1828
-
1829
1462
  _this8.dispatchEvent(new EventShimCustomEvent(IrisGridModel.EVENT.PENDING_DATA_UPDATED));
1830
1463
  } finally {
1831
1464
  _this8.isSaveInProgress = false;
1832
1465
  }
1833
1466
  })();
1834
1467
  }
1835
-
1836
1468
  editValueForCell(x, y) {
1837
1469
  return this.textValueForCell(x, y);
1838
1470
  }
1839
-
1840
1471
  delete(ranges) {
1841
1472
  var _this9 = this;
1842
-
1843
1473
  return _asyncToGenerator(function* () {
1844
1474
  if (!_this9.isDeletableRanges(ranges)) {
1845
1475
  throw new Error("Undeletable ranges ".concat(ranges));
1846
1476
  }
1847
-
1848
1477
  assertNotNull(_this9.inputTable);
1849
1478
  var {
1850
1479
  keyColumns
1851
1480
  } = _this9.inputTable;
1852
-
1853
1481
  if (keyColumns.length === 0) {
1854
1482
  throw new Error('No key columns to allow deletion');
1855
1483
  }
1856
-
1857
1484
  var pendingAreaRange = _this9.getPendingAreaRange();
1858
-
1859
1485
  var pendingRanges = ranges.map(range => GridRange.intersection(pendingAreaRange, range)).filter(range => range != null).map(range => {
1860
1486
  assertNotNull(range);
1861
1487
  return GridRange.offset(range, 0, -(_this9.floatingTopRowCount + _this9.table.size));
1862
1488
  });
1863
-
1864
1489
  if (pendingRanges.length > 0) {
1865
1490
  var newDataMap = new Map(_this9.pendingNewDataMap);
1866
-
1867
1491
  for (var i = 0; i < pendingRanges.length; i += 1) {
1868
1492
  var pendingRange = pendingRanges[i];
1869
1493
  assertNotNull(pendingRange.startRow);
1870
1494
  assertNotNull(pendingRange.endRow);
1871
-
1872
1495
  for (var r = pendingRange.startRow; r <= pendingRange.endRow; r += 1) {
1873
1496
  newDataMap.delete(r);
1874
1497
  }
1875
1498
  }
1876
-
1877
1499
  _this9.pendingNewDataMap = newDataMap;
1878
1500
  _this9.formattedStringData = [];
1879
-
1880
1501
  _this9.dispatchEvent(new EventShimCustomEvent(IrisGridModel.EVENT.PENDING_DATA_UPDATED));
1881
-
1882
1502
  _this9.dispatchEvent(new EventShimCustomEvent(IrisGridModel.EVENT.UPDATED));
1883
1503
  }
1884
-
1885
1504
  var tableAreaRange = _this9.getTableAreaRange();
1886
-
1887
1505
  var tableRanges = ranges.map(range => GridRange.intersection(tableAreaRange, range)).filter(range => range != null);
1888
-
1889
1506
  if (tableRanges.length <= 0) {
1890
1507
  return;
1891
1508
  }
1892
-
1893
- var [data, deleteTable] = yield Promise.all([// Need to get the key values of each row
1509
+ var [data, deleteTable] = yield Promise.all([
1510
+ // Need to get the key values of each row
1894
1511
  _this9.snapshot(tableRanges.map(range => {
1895
1512
  assertNotNull(range);
1896
1513
  return new GridRange(0, range.startRow, keyColumns.length - 1, range.endRow);
1897
- })), _this9.table.copy()]); // Now copy the existing table and filter it on the values in the snapshot for the key columns in the input table
1514
+ })), _this9.table.copy()]);
1898
1515
 
1516
+ // Now copy the existing table and filter it on the values in the snapshot for the key columns in the input table
1899
1517
  var filters = data.map(row => {
1900
1518
  var columnFilters = [];
1901
-
1902
1519
  for (var c = 0; c < keyColumns.length; c += 1) {
1903
1520
  var _column4 = keyColumns[c];
1904
1521
  var _value4 = row[c];
1905
1522
  var filterValue = TableUtils.makeFilterRawValue(_column4.type, _value4);
1906
-
1907
1523
  var _filter = _column4.filter().eq(filterValue);
1908
-
1909
1524
  columnFilters.push(_filter);
1910
1525
  }
1911
-
1912
1526
  return columnFilters.reduce((agg, curr) => {
1913
1527
  var _agg$and;
1914
-
1915
1528
  return (_agg$and = agg === null || agg === void 0 ? void 0 : agg.and(curr)) !== null && _agg$and !== void 0 ? _agg$and : curr;
1916
1529
  });
1917
1530
  });
1918
1531
  var filter = filters.reduce((agg, curr) => {
1919
1532
  var _agg$or;
1920
-
1921
1533
  return (_agg$or = agg === null || agg === void 0 ? void 0 : agg.or(curr)) !== null && _agg$or !== void 0 ? _agg$or : curr;
1922
1534
  });
1923
- deleteTable.applyFilter([filter]); // await this.inputTable?.deleteTable(deleteTable);
1535
+ deleteTable.applyFilter([filter]);
1924
1536
 
1537
+ // await this.inputTable?.deleteTable(deleteTable);
1925
1538
  deleteTable.close();
1926
1539
  })();
1927
1540
  }
1928
-
1929
1541
  isValidForCell(x, y, value) {
1930
1542
  try {
1931
1543
  var _column5 = this.columns[x];
@@ -1935,10 +1547,7 @@ class IrisGridTableModelTemplate extends IrisGridModel {
1935
1547
  return false;
1936
1548
  }
1937
1549
  }
1938
-
1939
1550
  }
1940
-
1941
1551
  _defineProperty(IrisGridTableModelTemplate, "ROW_BUFFER_PAGES", 1);
1942
-
1943
1552
  export default IrisGridTableModelTemplate;
1944
1553
  //# sourceMappingURL=IrisGridTableModelTemplate.js.map