@refinitiv-ui/efx-grid 6.0.1 → 6.0.2

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 (133) hide show
  1. package/lib/column-selection-dialog/lib/column-selection-dialog.js +80 -18
  2. package/lib/column-selection-dialog/themes/halo/dark/column-selection-dialog.js +1 -1
  3. package/lib/column-selection-dialog/themes/halo/dark/es5/all-elements.js +1 -1
  4. package/lib/column-selection-dialog/themes/halo/light/column-selection-dialog.js +1 -1
  5. package/lib/column-selection-dialog/themes/halo/light/es5/all-elements.js +1 -1
  6. package/lib/core/dist/core.css +1 -1
  7. package/lib/core/dist/core.js +12961 -10749
  8. package/lib/core/dist/core.min.js +1 -1
  9. package/lib/core/es6/data/DataView.d.ts +22 -7
  10. package/lib/core/es6/data/DataView.js +176 -49
  11. package/lib/core/es6/data/WrappedView.d.ts +289 -0
  12. package/lib/core/es6/data/WrappedView.js +1319 -0
  13. package/lib/core/es6/grid/Core.d.ts +13 -0
  14. package/lib/core/es6/grid/Core.js +393 -155
  15. package/lib/core/es6/grid/ILayoutGrid.d.ts +8 -0
  16. package/lib/core/es6/grid/ILayoutGrid.js +45 -2
  17. package/lib/core/es6/grid/LayoutGrid.d.ts +10 -1
  18. package/lib/core/es6/grid/LayoutGrid.js +257 -82
  19. package/lib/core/es6/grid/VirtualizedLayoutGrid.d.ts +10 -1
  20. package/lib/core/es6/grid/VirtualizedLayoutGrid.js +314 -27
  21. package/lib/core/es6/grid/components/Column.js +8 -2
  22. package/lib/core/es6/grid/components/HScrollbar.d.ts +4 -0
  23. package/lib/core/es6/grid/components/HScrollbar.js +20 -4
  24. package/lib/core/es6/grid/util/TrackLayout.d.ts +1 -1
  25. package/lib/core/es6/grid/util/TrackLayout.js +2 -3
  26. package/lib/core/es6/tr-grid-theme.js +1 -1
  27. package/lib/filter-dialog/lib/filter-dialog.js +8 -6
  28. package/lib/grid/lib/efx-grid.d.ts +14 -7
  29. package/lib/grid/lib/efx-grid.js +113 -114
  30. package/lib/grid/themes/base.less +4 -2
  31. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  32. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  33. package/lib/grid/themes/halo/efx-grid.less +69 -32
  34. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  35. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  36. package/lib/grid/themes/solar/charcoal/efx-grid.js +1 -1
  37. package/lib/grid/themes/solar/charcoal/es5/all-elements.js +1 -1
  38. package/lib/grid/themes/solar/pearl/efx-grid.js +1 -1
  39. package/lib/grid/themes/solar/pearl/es5/all-elements.js +1 -1
  40. package/lib/row-segmenting/es6/RowSegmenting.d.ts +1 -0
  41. package/lib/row-segmenting/es6/RowSegmenting.js +40 -11
  42. package/lib/rt-grid/dist/rt-grid.js +10290 -7864
  43. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  44. package/lib/rt-grid/es6/ColumnDefinition.d.ts +4 -1
  45. package/lib/rt-grid/es6/ColumnDefinition.js +3 -0
  46. package/lib/rt-grid/es6/Grid.d.ts +14 -7
  47. package/lib/rt-grid/es6/Grid.js +241 -74
  48. package/lib/rt-grid/es6/RowDefinition.d.ts +4 -1
  49. package/lib/rt-grid/es6/RowDefinition.js +52 -2
  50. package/lib/tr-grid-cell-selection/es6/CellSelection.d.ts +1 -1
  51. package/lib/tr-grid-cell-selection/es6/CellSelection.js +53 -40
  52. package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +2 -0
  53. package/lib/tr-grid-checkbox/es6/Checkbox.js +29 -14
  54. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +1 -0
  55. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +10 -0
  56. package/lib/tr-grid-column-selection/es6/ColumnSelection.d.ts +5 -1
  57. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +226 -4
  58. package/lib/tr-grid-column-stack/es6/ColumnStack.js +3 -0
  59. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +1 -0
  60. package/lib/tr-grid-filter-input/es6/FilterInput.d.ts +4 -2
  61. package/lib/tr-grid-filter-input/es6/FilterInput.js +73 -10
  62. package/lib/tr-grid-row-dragging/es6/RowDragging.js +102 -12
  63. package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +2 -0
  64. package/lib/tr-grid-row-filtering/es6/RowFiltering.js +88 -33
  65. package/lib/tr-grid-row-grouping/es6/RowGrouping.js +41 -31
  66. package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +5 -1
  67. package/lib/tr-grid-row-selection/es6/RowSelection.js +188 -7
  68. package/lib/tr-grid-rowcoloring/es6/RowColoring.d.ts +2 -0
  69. package/lib/tr-grid-rowcoloring/es6/RowColoring.js +36 -0
  70. package/lib/tr-grid-util/es6/CellPainter.d.ts +8 -8
  71. package/lib/tr-grid-util/es6/Conflator.d.ts +2 -2
  72. package/lib/tr-grid-util/es6/CoralItems.d.ts +1 -1
  73. package/lib/tr-grid-util/es6/DateTime.d.ts +4 -4
  74. package/lib/tr-grid-util/es6/Delay.d.ts +1 -1
  75. package/lib/tr-grid-util/es6/Dom.d.ts +4 -4
  76. package/lib/tr-grid-util/es6/ElementWrapper.d.ts +1 -1
  77. package/lib/tr-grid-util/es6/ElfDate.d.ts +3 -3
  78. package/lib/tr-grid-util/es6/ElfUtil.d.ts +4 -4
  79. package/lib/tr-grid-util/es6/EventDispatcher.d.ts +1 -1
  80. package/lib/tr-grid-util/es6/FieldFormatter.d.ts +1 -1
  81. package/lib/tr-grid-util/es6/FilterBuilder.d.ts +5 -5
  82. package/lib/tr-grid-util/es6/GridPlugin.d.ts +3 -3
  83. package/lib/tr-grid-util/es6/MouseDownTrait.d.ts +1 -1
  84. package/lib/tr-grid-util/es6/MultiTableManager.d.ts +2 -2
  85. package/lib/tr-grid-util/es6/PercentBar.d.ts +1 -1
  86. package/lib/tr-grid-util/es6/Perf.d.ts +4 -4
  87. package/lib/tr-grid-util/es6/Popup.d.ts +2 -2
  88. package/lib/tr-grid-util/es6/RequestQueue.d.ts +1 -1
  89. package/lib/tr-grid-util/es6/RowPainter.d.ts +3 -0
  90. package/lib/tr-grid-util/es6/RowPainter.js +66 -12
  91. package/lib/tr-grid-util/es6/SubTable.d.ts +9 -9
  92. package/lib/tr-grid-util/es6/Table.d.ts +13 -13
  93. package/lib/tr-grid-util/es6/TextHighlighter.d.ts +3 -3
  94. package/lib/tr-grid-util/es6/TickCodes.d.ts +2 -2
  95. package/lib/tr-grid-util/es6/TouchProxy.d.ts +1 -1
  96. package/lib/tr-grid-util/es6/Util.d.ts +6 -6
  97. package/lib/tr-grid-util/es6/formula/Engine.d.ts +5 -5
  98. package/lib/tr-grid-util/es6/formula/Formula.d.ts +3 -3
  99. package/lib/tr-grid-util/es6/formula/RealtimeService.d.ts +1 -1
  100. package/lib/tr-grid-util/es6/jet/CollectionDict.d.ts +2 -2
  101. package/lib/tr-grid-util/es6/jet/DataGenerator.d.ts +4 -4
  102. package/lib/tr-grid-util/es6/jet/MockArchive.d.ts +1 -1
  103. package/lib/tr-grid-util/es6/jet/MockJET.d.ts +4 -4
  104. package/lib/tr-grid-util/es6/jet/MockQuotes.d.ts +11 -11
  105. package/lib/tr-grid-util/es6/jet/MockQuotes2.d.ts +7 -7
  106. package/lib/tr-grid-util/es6/jet/MockRTK.d.ts +1 -1
  107. package/lib/tr-grid-util/es6/jet/mockDataAPI.d.ts +1 -1
  108. package/lib/types/es6/CellSelection.d.ts +1 -1
  109. package/lib/types/es6/Checkbox.d.ts +2 -0
  110. package/lib/types/es6/ColumnGrouping.d.ts +1 -0
  111. package/lib/types/es6/ColumnSelection.d.ts +5 -1
  112. package/lib/types/es6/Core/data/DataView.d.ts +22 -7
  113. package/lib/types/es6/Core/data/WrappedView.d.ts +289 -0
  114. package/lib/types/es6/Core/grid/Core.d.ts +13 -0
  115. package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +8 -0
  116. package/lib/types/es6/Core/grid/LayoutGrid.d.ts +10 -1
  117. package/lib/types/es6/Core/grid/VirtualizedLayoutGrid.d.ts +10 -1
  118. package/lib/types/es6/Core/grid/components/HScrollbar.d.ts +4 -0
  119. package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +1 -1
  120. package/lib/types/es6/FilterInput.d.ts +4 -2
  121. package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +4 -1
  122. package/lib/types/es6/RealtimeGrid/Grid.d.ts +15 -8
  123. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +4 -1
  124. package/lib/types/es6/RowColoring.d.ts +2 -0
  125. package/lib/types/es6/RowFiltering.d.ts +2 -0
  126. package/lib/types/es6/RowSegmenting.d.ts +1 -0
  127. package/lib/types/es6/RowSelection.d.ts +5 -1
  128. package/lib/types/es6/Zoom.d.ts +2 -1
  129. package/lib/types/es6/index.d.ts +2 -0
  130. package/lib/versions.json +17 -17
  131. package/lib/zoom/es6/Zoom.d.ts +2 -1
  132. package/lib/zoom/es6/Zoom.js +11 -4
  133. package/package.json +7 -7
@@ -0,0 +1,1319 @@
1
+ import Ext from "../../../tr-grid-util/es6/Ext.js";
2
+ import EventDispatcher from "../grid/event/EventDispatcher.js";
3
+ import DataView from "./DataView.js"; // eslint-disable-line
4
+ import DataTable from "./DataTable.js"; // eslint-disable-line
5
+ import ColumnStats from "./ColumnStats.js"; // eslint-disable-line
6
+
7
+ /** @event WrappedView#dataChanged
8
+ * @description Trigger when data within the data view has been changed. Not only actual change in data, but also position change will trigger this event.
9
+ * @property {boolean} globalChange Indicates a big change. User should expect all data has been change. With active sorting or filtering, this flag will always be true due to multiple changes in row position.
10
+ * @property {string} type Type of changes. Possible values are "inserted", "removed", "updated", and undefined
11
+ * @property {string} rid Row Id
12
+ * @property {Object.<string, *>} rowData Column values of the changed row in JSON object format
13
+ */
14
+
15
+ /** WrappedView doesn't hold the actual data. It is just a transform view (by applying wrap operation) of the data from the {@link DataView}
16
+ * @constructor
17
+ * @extends {EventDispatcher}
18
+ * @param {WrappedView~Options} options
19
+ */
20
+ var WrappedView = function(options) {
21
+ this._onDataChanged = this._onDataChanged.bind(this);
22
+ this._onWrapSizeChanged = this._onWrapSizeChanged.bind(this);
23
+
24
+ this._dv = options["dataView"];
25
+ this._dt = this._dv.getDataTable();
26
+
27
+ this._dv.listen("dataChanged", this._onDataChanged);
28
+ this._dv.listen("wrapSizeChanged", this._onWrapSizeChanged);
29
+
30
+ this._wrapIndex = options["wrapIndex"];
31
+
32
+ this._refreshRids(options["rids"]);
33
+
34
+ this._addEvents("dataChanged");
35
+ };
36
+ Ext.inherits(WrappedView, EventDispatcher);
37
+
38
+ /** The configuration object for WrappedView
39
+ * @typedef {Object} WrappedView~Options
40
+ * @property {DataView} dataView
41
+ * @property {number} wrapIndex
42
+ * @property {Array.<string> rids
43
+ */
44
+ WrappedView.Options;
45
+
46
+ /** @private
47
+ * @type {DataView}
48
+ */
49
+ WrappedView.prototype._dv = null;
50
+ /** @private
51
+ * @type {DataTable}
52
+ */
53
+ WrappedView.prototype._dt = null;
54
+ /** @private
55
+ * @type {number}
56
+ */
57
+ WrappedView.prototype._wrapIndex = 0;
58
+ /** List of row Ids
59
+ * @private
60
+ * @type {!Array.<string>}
61
+ */
62
+ WrappedView.prototype._rids;
63
+ /** @private
64
+ * @type {Conflator}
65
+ */
66
+ WrappedView.prototype._dataConflator = null;
67
+
68
+
69
+ /** @private
70
+ * @param {Object} e
71
+ */
72
+ WrappedView.prototype._onDataChanged = function(e) {
73
+ if(this._dv) {
74
+ var rids = this._dv.getVisibleRowIds(true);
75
+ if(this._refreshRids(rids)) {
76
+ if(!e["globalChange"]) {
77
+ e["globalChange"] = true; // TODO: Optimize how we to dispatch globalChange
78
+ }
79
+ this._dispatch("dataChanged", e);
80
+ }
81
+ }
82
+ };
83
+ /** @private
84
+ * @param {Object} e
85
+ */
86
+ WrappedView.prototype._onWrapSizeChanged = function(e) {
87
+ if(this._refreshRids(e["rids"])) {
88
+ this._dispatch("dataChanged", DataTable._globalChangeArg);
89
+ }
90
+ };
91
+
92
+ /** @private
93
+ * @param {Array.<string>} rids
94
+ * @return {boolean} Returns true if there is any change
95
+ */
96
+ WrappedView.prototype._refreshRids = function(rids) {
97
+ var dirty = false;
98
+ if(this._dv && Array.isArray(rids)) {
99
+ var wrapSize = this.getWrapSize();
100
+ if(wrapSize > 0) {
101
+ var startIndex = wrapSize * this._wrapIndex;
102
+
103
+ if(startIndex < rids.length) {
104
+ dirty = true;
105
+ this._rids = rids.slice(startIndex, startIndex + wrapSize);
106
+ } else if(this._rids.length) {
107
+ dirty = true;
108
+ this._rids.length = 0;
109
+ }
110
+ }
111
+ }
112
+ return dirty;
113
+ };
114
+ /** @public
115
+ */
116
+ WrappedView.prototype.dispose = function() {
117
+ if(this._dv) {
118
+ this.unlistenAll();
119
+ this._dv.unlisten("dataChanged", this._onDataChanged);
120
+ this._dv.unlisten("wrapSizeChanged", this._onWrapSizeChanged);
121
+ this._dt = this._dv = null;
122
+ }
123
+ };
124
+
125
+ /** Get data by row id and column id (field)
126
+ * @public
127
+ * @param {string} rid
128
+ * @param {string} cid
129
+ * @returns {Object.<string, *>}
130
+ */
131
+ WrappedView.prototype.getData = function(rid, cid) {
132
+ return this._dt.getData(rid, cid);
133
+ };
134
+ /** Get entire row data by row id
135
+ * @public
136
+ * @param {string} rid
137
+ * @return {Object.<string, *>}
138
+ */
139
+ WrappedView.prototype.getRowData = function(rid) {
140
+ return this._dt.getRowData(rid);
141
+ };
142
+ /** @public
143
+ * @param {string} cid
144
+ * @param {boolean=} inclNonDataRow=false If enabled, group header rows are included
145
+ * @return {!Array}
146
+ */
147
+ WrappedView.prototype.getColumnData = function(cid, inclNonDataRow) {
148
+ var rids = this.getAllRowIds(true, inclNonDataRow);
149
+
150
+ var rows = [];
151
+ var len = rids.length;
152
+ for(var r = 0; r < len; ++r) {
153
+ var rowData = this._dt.getRowData(rids[r]);
154
+ if(rowData) {
155
+ rows.push(rowData[cid]);
156
+ } else if(inclNonDataRow) {
157
+ rows.push(null);
158
+ }
159
+ }
160
+ return rows;
161
+ };
162
+ /** @public
163
+ * @param {number} rowIndex
164
+ * @return {string}
165
+ * @see {@link WrappedView#getRowIndex}
166
+ */
167
+ WrappedView.prototype.getRowId = function(rowIndex) {
168
+ return this._rids[rowIndex] || "";
169
+ };
170
+ /** @private
171
+ * @param {number|string} rowRef
172
+ * @return {string}
173
+ */
174
+ WrappedView.prototype._toRowId = function(rowRef) {
175
+ if(typeof rowRef === "number") {
176
+ return this._rids[rowRef] || "";
177
+ }
178
+ return /** @type{string} */(rowRef || "");
179
+ };
180
+ /** @private
181
+ * @param {Array.<number|string>} rowRefs
182
+ * @return {!Array.<string>}
183
+ */
184
+ WrappedView.prototype._toRowIds = function(rowRefs) {
185
+ var rowCount = Array.isArray(rowRefs) ? rowRefs.length : 0;
186
+ var ary = new Array(rowCount);
187
+ var rids = this._rids;
188
+ for(var r = 0; r < rowCount; ++r) {
189
+ var rowRef = rowRefs[r];
190
+ if(typeof rowRef === "number") {
191
+ ary[r] = rids[rowRef] || "";
192
+ } else {
193
+ ary[r] = rowRef || "";
194
+ }
195
+ }
196
+ return ary;
197
+ };
198
+ /** Return all row ids with row data, excluding the group header rows (auto generated rows).
199
+ * @public
200
+ * @param {boolean=} shallowCopy=false If enabled, no new copy of Array is created (better for performance).
201
+ * @param {boolean=} inclNonDataRow=false If enabled, group header rows are included. In pagination mode, this flag will always be true.
202
+ * @return {!Array.<string>}
203
+ * @see {@link WrappedView#getAllRowData}
204
+ * @see {@link WrappedView#getMultipleRowData}
205
+ * @see {@link WrappedView#getSortedRowIds}
206
+ * @see {@link WrappedView#getVisibleRowIds}
207
+ */
208
+ WrappedView.prototype.getAllRowIds = function(shallowCopy, inclNonDataRow) {
209
+ return (shallowCopy) ? this._rids : this._rids.slice(0); // Fastest way to clone an array is Array.slice()
210
+ };
211
+ /** This method returns current visible rows (i.e. Rows in other pages or in collapsed groups are excluded). Group header rows may be included in the results.
212
+ * @public
213
+ * @param {boolean=} shallowCopy=false If enabled, no new copy of Array is created (better for performance).
214
+ * @return {!Array.<string>}
215
+ * @see {@link WrappedView#getAllRowData}
216
+ */
217
+ WrappedView.prototype.getVisibleRowIds = function(shallowCopy) {
218
+ return (shallowCopy) ? this._rids : this._rids.slice(0); // Fastest way to clone an array is Array.slice()
219
+ };
220
+ /** Return all data rows that is filtered and sorted, excluding header rows or paging. This method ignores pagination.
221
+ * @public
222
+ * @param {boolean=} shallowCopy=false If enabled, no new copy of Array is created (better for performance).
223
+ * @return {!Array.<string>}
224
+ * @see {@link WrappedView#getAllRowData}
225
+ */
226
+ WrappedView.prototype.getSortedRowIds = function(shallowCopy) {
227
+ return (shallowCopy) ? this._rids : this._rids.slice(0); // Fastest way to clone an array is Array.slice()
228
+ };
229
+ /** This method is quite slow
230
+ * @public
231
+ * @param {string} rid
232
+ * @return {number}
233
+ * @see {@link WrappedView#getRowId}
234
+ */
235
+ WrappedView.prototype.getRowIndex = function(rid) {
236
+ return this._rids.indexOf(rid);
237
+ };
238
+ /** @public
239
+ * @return {number}
240
+ */
241
+ WrappedView.prototype.getRowCount = function() {
242
+ return this._rids.length;
243
+ };
244
+ /** @public
245
+ * @param {number} rowIndex
246
+ * @param {string} cid
247
+ * @returns {Object.<string, *>}
248
+ */
249
+ WrappedView.prototype.getDataAt = function(rowIndex, cid) {
250
+ return this._dt.getData(this.getRowId(rowIndex), cid);
251
+ };
252
+ /** This method is slow. When working with huge amount of rows, use getRowData in combination with getAllRowIds(true) instead of calling getRowDataAt multiple times.
253
+ * @public
254
+ * @param {number} rowIndex
255
+ * @return {Object.<string, *>}
256
+ */
257
+ WrappedView.prototype.getRowDataAt = function(rowIndex) {
258
+ return this._dt.getRowData(this.getRowId(rowIndex));
259
+ };
260
+ /** @public
261
+ * @param {string} rid
262
+ * @param {string} cid
263
+ * @returns {Object.<string, *>}
264
+ */
265
+ WrappedView.prototype.getPreviousData = function(rid, cid) {
266
+ return this._dt.getPreviousData(rid, cid);
267
+ };
268
+ /** @public
269
+ * @param {Array.<string>} rids
270
+ * @param {number=} opt_from
271
+ * @param {number=} opt_to EXCLUSIVE
272
+ * @return {!Array.<Object>}
273
+ */
274
+ WrappedView.prototype.getMultipleRowData = function(rids, opt_from, opt_to) {
275
+ return this._dt.getMultipleRowData(rids, opt_from, opt_to);
276
+ };
277
+ /** Return all rows with row data, excluding the group header rows (auto generated rows)
278
+ * @public
279
+ * @return {!Array.<Object>}
280
+ */
281
+ WrappedView.prototype.getAllRowData = function() {
282
+ return this.getMultipleRowData(this.getAllRowIds(true));
283
+ };
284
+
285
+ /** @public
286
+ * @param {string} rid
287
+ * @param {string} cid
288
+ * @param {*} value
289
+ * @return {boolean} Return true if there is any change, and false otherwise
290
+ */
291
+ WrappedView.prototype.setData = function(rid, cid, value) {
292
+ if(this._dt) {
293
+ return this._dt.setData(rid, cid, value);
294
+ }
295
+ return false;
296
+ };
297
+ /** @public
298
+ * @param {string} rid
299
+ * @param {Object.<string, *>=} values
300
+ * @param {Object=} opt_eventArg
301
+ * @return {boolean} Return true if there is any change, and false otherwise
302
+ */
303
+ WrappedView.prototype.setRowData = function(rid, values, opt_eventArg) {
304
+ return this._dv.setRowData(rid, values, opt_eventArg);
305
+ };
306
+ /** Set data in a column manner. This is faster than repeatedly calling {@link DataTable#setData}
307
+ * @public
308
+ * @param {string} cid
309
+ * @param {Array} valueList
310
+ * @param {Array.<string>=} opt_ridList Specify row id to be set corresponding to the data item
311
+ */
312
+ WrappedView.prototype.setColumnData = function(cid, valueList, opt_ridList) {
313
+ // Note: This function should filter out row expansion before calling dt.setColumnData
314
+ if(this._dt) {
315
+ this._dt.setColumnData(cid, valueList, opt_ridList);
316
+ }
317
+ };
318
+ /** This method is slow. When working with huge amount of rows, use setData in combination with getAllRowIds(true) instead of calling setDataAt multiple times.
319
+ * @public
320
+ * @param {number} rowIndex
321
+ * @param {string} cid
322
+ * @param {*} value
323
+ * @return {boolean} Return true if there is any change, and false otherwise
324
+ */
325
+ WrappedView.prototype.setDataAt = function(rowIndex, cid, value) {
326
+ var rid = this.getRowId(rowIndex);
327
+ if(rid && this._dt) {
328
+ return this._dt.setData(rid, cid, value);
329
+ }
330
+ return false;
331
+ };
332
+ /** This method is slow. When working with huge amount of rows, use setRowData in combination with getAllRowIds(true) instead of calling setRowDataAt multiple times.
333
+ * @public
334
+ * @param {number} rowIndex
335
+ * @param {Object.<string, *>=} values
336
+ * @param {Object=} opt_eventArg
337
+ * @return {boolean} Return true if there is any change, and false otherwise
338
+ */
339
+ WrappedView.prototype.setRowDataAt = function(rowIndex, values, opt_eventArg) {
340
+ var rid = this.getRowId(rowIndex);
341
+ return this.setRowData(rid, values, opt_eventArg);
342
+ };
343
+
344
+ /** @public
345
+ * @param {string|number} rowRef The position of the new row
346
+ * @param {Object.<string, *>=} opt_values
347
+ * @param {string|null=} opt_rid If the given row Id already exists, data is updated and no new row is added. Leave blank or null to let DataTable generate unique row Id
348
+ * @return {string} Return Row id that has been inserted or changed
349
+ */
350
+ WrappedView.prototype.insertRow = function(rowRef, opt_values, opt_rid) { // Data changed event may be dispatched
351
+ var rowId = this._toRowId(rowRef);
352
+ return this._dv.insertRow(rowId, opt_values, opt_rid);
353
+ };
354
+
355
+ /** Permanently remove the specified row by row id or WrappedView's row index. If you want to temporarily remove the row, use {@link WrappedView#hideRows} instead
356
+ * @public
357
+ * @param {number|string} rowRef
358
+ */
359
+ WrappedView.prototype.removeRow = function(rowRef) {
360
+ if(this._dt) {
361
+ this._dt.removeRow(this._toRowId(rowRef)); // Trigger dataChanged
362
+ }
363
+ };
364
+ /** Permanently remove the specified rows by row id or WrappedView's row index. If you want to temporarily remove the rows, use {@link WrappedView#hideRows} instead
365
+ * @public
366
+ * @param {Array.<number|string>} rowRefs
367
+ */
368
+ WrappedView.prototype.removeRows = function(rowRefs) {
369
+ if(this._dt) {
370
+ this._dt.removeRows(this._toRowIds(rowRefs)); // Trigger dataChanged
371
+ }
372
+ };
373
+ /** Move a single row or multiple rows to the position BEFORE the specified target row.
374
+ * @public
375
+ * @param {Array.<number|string>|number|string} fromRef The value could be row index, row id, or array of row indices or row ids.
376
+ * @param {number|string} toRef Destination target could be row index or row id
377
+ * @return {Array.<string>|string} rid rowId or array of the rowId of the moved row(s)
378
+ * @example
379
+ * ary = [0, 1, 2];
380
+ * move(ary, 0, 1); // [0, 1, 2] Move index 0 to the position before index 1 (nothing is changed)
381
+ * move(ary, 1, 0); // [1, 0, 2] Move index 1 to the position before index 0
382
+ */
383
+ WrappedView.prototype.moveRow = function(fromRef, toRef) {
384
+ var toRid = this._toRowId(toRef);
385
+ var fromIndices = /** @type{!Array.<number>} */(Array.isArray(fromRef) ? fromRef : [fromRef]);
386
+ var fromRids = this._toRowIds(fromIndices);
387
+
388
+ // if(this._dt.hasSegmentation()) {
389
+ // this.synchronizeRowOrder();
390
+ // }
391
+
392
+ return this._dv.moveRow(fromRids, toRid);
393
+ };
394
+
395
+ /** Returns the root data source (DataTable) of all data views
396
+ * @public
397
+ * @return {DataTable}
398
+ * @see {@link WrappedView#getDataSource}
399
+ */
400
+ WrappedView.prototype.getDataTable = function() {
401
+ return this._dt;
402
+ };
403
+ /** Return source for this data view which could be another data view or a data table.
404
+ * @public
405
+ * @return {DataView}
406
+ * @see {@link WrappedView#getDataTable}
407
+ */
408
+ WrappedView.prototype.getDataSource = function() {
409
+ return this._dv;
410
+ };
411
+ /** @public
412
+ * @param {DataView=} source
413
+ */
414
+ WrappedView.prototype.setDataSource = function(source) {
415
+
416
+ };
417
+
418
+ /** @public
419
+ * @param {number} milliSecond
420
+ */
421
+ WrappedView.prototype.setConflationRate = function (milliSecond) {
422
+ this._dv.setConflationRate(milliSecond);
423
+ };
424
+
425
+ /** @public
426
+ * @return {number}
427
+ */
428
+ WrappedView.prototype.getConflationRate = function () {
429
+ return this._dv.getConflationRate();
430
+ };
431
+
432
+ /**
433
+ * @public
434
+ * @ignore
435
+ * @return {Object.<string, DataTable.SortLogic>}
436
+ */
437
+ WrappedView.prototype.getSortingLogics = function() {
438
+ return this._dt ? this._dt.getSortingLogics() : null;
439
+ };
440
+ /** @public
441
+ * @param {string|Array.<string>} cid
442
+ * @param {string|number|Array.<string|number>=} opt_sortOrder
443
+ * @param {Function|Array.<Function>=} sortLogics
444
+ * @param {boolean=} noOptimization=false Force to sort without optimization to refresh all rowIds again.
445
+ */
446
+ WrappedView.prototype.sort = function (cid, opt_sortOrder, sortLogics, noOptimization) {
447
+ this._dv.sort(cid, opt_sortOrder, sortLogics, noOptimization);
448
+ };
449
+ /** @public
450
+ * @param {string|Array.<string>} cid
451
+ * @param {string|number|Array.<string|number>=} opt_sortOrder
452
+ */
453
+ WrappedView.prototype.sortOnce = function(cid, opt_sortOrder) {
454
+ this._dv.sortOnce(cid, opt_sortOrder);
455
+ };
456
+ /** @public
457
+ * @param {DataTable.SortLogic} func
458
+ * @example
459
+ * customLogic = function(a, b, sortOrder) {
460
+ * return (a - b) * sortOrder; // for numeric comparison
461
+ * };
462
+ * var dt = new DataTable();
463
+ * var dv = new DataView(dt);
464
+ * dv.setSortingLogic(customLogic);
465
+ * dv.sort("Column id", "ascending");
466
+ */
467
+ WrappedView.prototype.setSortingLogic = function(func) {
468
+ if(this._dt) {
469
+ this._dt.setSortingLogic(func);
470
+ }
471
+ };
472
+ /** Specified sorting logic for the column with the given column id. This will override logic set by {@link WrappedView#setSortingLogic}, when the column is sorted
473
+ * @public
474
+ * @param {string} cid
475
+ * @param {DataTable.SortLogic} func Use null to remove current sorting logic
476
+ */
477
+ WrappedView.prototype.setColumnSortingLogic = function(cid, func) {
478
+ if(this._dt) {
479
+ this._dt.setColumnSortingLogic(cid, func);
480
+ }
481
+ };
482
+ /** Check if this view is in sorting mode
483
+ * @public
484
+ * @return {boolean}
485
+ */
486
+ WrappedView.prototype.isSorting = function() {
487
+ return this._dv.isSorting();
488
+ };
489
+
490
+ /** Hide rows in the data view
491
+ * @param {string|number} rId Row id to hide. If the rId is a number, it will be treated as a row index
492
+ * @param {boolean=} opt_show show if false
493
+ * @public
494
+ */
495
+ WrappedView.prototype.hideRow = function(rId, opt_show) {
496
+ this.showRows([rId], opt_show === false);
497
+ };
498
+ /** Hide rows in the data view
499
+ * @param {Array.<string|number>} rowRefs Array of row ids or indices to hide
500
+ * @param {boolean=} opt_show show if false
501
+ * @public
502
+ */
503
+ WrappedView.prototype.hideRows = function(rowRefs, opt_show) {
504
+ this.showRows(rowRefs, opt_show === false);
505
+ };
506
+ /**
507
+ * Show/hide rows in the data view
508
+ * @param {Array.<string|number>} rowRefs Array of row ids or indices to hide
509
+ * @param {boolean=} opt_show hide instead show if false
510
+ * @public
511
+ */
512
+ WrappedView.prototype.showRows = function(rowRefs, opt_show) {
513
+ var rids = this._toRowIds(rowRefs);
514
+ this._dv.showRows(rids, opt_show);
515
+ };
516
+ /** Unhide all rows
517
+ * @public
518
+ */
519
+ WrappedView.prototype.unhideAllRows = function(){
520
+ this._dv.unhideAllRows();
521
+ };
522
+ /** Check if there is any hidden row
523
+ * @public
524
+ * @return {boolean}
525
+ */
526
+ WrappedView.prototype.hasHiddenRow = function(){
527
+ return this._dv.hasHiddenRow();
528
+ };
529
+
530
+ /** @public
531
+ * @param {string|function(string, Object.<string, *>):boolean} cid Use string to identify column name. Use function for custom filter logic. Function will take rowId and column values as parameters, and return boolean value
532
+ * @param {*=} value
533
+ * @param {boolean=} opt_filteringOut
534
+ * @return {boolean} Return true if there is any change. Otherwise, return false.
535
+ * @example
536
+ * dv.filterIn("FIELD", "Some value");
537
+ * dv.filterIn(function(rowId, rowData)) { // This is equivalent with the above statement
538
+ * return rowData["FIELD"] === "Some value";
539
+ * });
540
+ */
541
+ WrappedView.prototype.filterIn = function(cid, value, opt_filteringOut) {
542
+ return this._dv.filterIn(cid, value, opt_filteringOut);
543
+ };
544
+ /** @public
545
+ * @param {string|function(string, Object.<string, *>):boolean} cid Use string to identify column name. Use function for custom filter logic. Function will take rowId and column values as parameters, and return boolean value
546
+ * @param {*=} value
547
+ * @return {boolean} Return true if there is any change. Otherwise, return false.
548
+ * @example
549
+ * dv.filterIn("FIELD", "Some value");
550
+ * dv.filterOut(function(rowId, rowData)) { // This is equivalent with the above statement
551
+ * return rowData["FIELD"] !== "Some value";
552
+ * });
553
+ */
554
+ WrappedView.prototype.filterOut = function(cid, value) {
555
+ return this.filterIn(cid, value, true);
556
+ };
557
+ /** @public
558
+ * @param {string|Function} cid Use string to identify column name. Use function for custom filter logic. Function will take rowId and column values as parameters, and return boolean value
559
+ * @param {*=} value
560
+ * @param {boolean=} opt_filteringOut
561
+ */
562
+ WrappedView.prototype.filterInOnce = function(cid, value, opt_filteringOut) {
563
+ this._dv.filterInOnce(cid, value, opt_filteringOut);
564
+ };
565
+ /** @public
566
+ * @suppress {checkTypes}
567
+ * @param {string|function(string, Object.<string, *>):boolean} cid Use string to identify column name. Use function for custom filter logic. Function will take rowId and column values as parameters, and return boolean value
568
+ * @param {*=} value
569
+ */
570
+ WrappedView.prototype.filterOutOnce = function(cid, value) {
571
+ this.filterInOnce(cid, value, true);
572
+ };
573
+ /** @public
574
+ */
575
+ WrappedView.prototype.clearFilter = function() {
576
+ this._dv.clearFilter();
577
+ };
578
+
579
+ /** Disable the page index correction
580
+ * @public
581
+ * @param {boolean=} opt_disable
582
+ */
583
+ WrappedView.prototype.disablePageCorrection = function(opt_disable) {
584
+ };
585
+ /** Goes to the specified page
586
+ * @public
587
+ * @param {number} pageIndex
588
+ * @return {boolean} True if there is any change, otherwise false
589
+ */
590
+ WrappedView.prototype.setPage = function (pageIndex) { return false; };
591
+ /** {@link WrappedView#setPage}
592
+ * @public
593
+ * @function
594
+ */
595
+ WrappedView.prototype.gotoPage = WrappedView.prototype.setPage;
596
+ /** Goes to the next page. If current page is already the last page, nothing is performed
597
+ * @public
598
+ * @return {boolean} True if there is any change, otherwise false
599
+ */
600
+ WrappedView.prototype.nextPage = function () {
601
+ return false;
602
+ };
603
+ /** Goes back to the previous page. If current page is already the first page, nothing is performed
604
+ * @public
605
+ * @return {boolean} True if there is any change, otherwise false
606
+ */
607
+ WrappedView.prototype.previousPage = function () {
608
+ return false;
609
+ };
610
+ /** {@link WrappedView#previousPage}
611
+ * @public
612
+ * @function
613
+ */
614
+ WrappedView.prototype.prevPage = WrappedView.prototype.previousPage;
615
+ /** Goes to the last page
616
+ * @public
617
+ * @return {boolean} True if there is any change, otherwise false
618
+ */
619
+ WrappedView.prototype.lastPage = function () {
620
+ return false;
621
+ };
622
+ /** Goes to the first page
623
+ * @public
624
+ * @return {boolean} True if there is any change, otherwise false
625
+ */
626
+ WrappedView.prototype.firstPage = function () {
627
+ return false;
628
+ };
629
+
630
+ /**
631
+ * @public
632
+ * @return {number}
633
+ */
634
+ WrappedView.prototype.getCurrentPage = function () {
635
+ return 1;
636
+ };
637
+ /** {@link WrappedView#getCurrentPage}
638
+ * @public
639
+ * @function
640
+ */
641
+ WrappedView.prototype.getPageIndex = WrappedView.prototype.getCurrentPage;
642
+ /** Verifies that current page is the last page
643
+ * @public
644
+ * @return {boolean}
645
+ */
646
+ WrappedView.prototype.isOnLastPage = function () {
647
+ return true;
648
+ };
649
+ /** Verifies that current page is the first page
650
+ * @public
651
+ * @return {boolean}
652
+ */
653
+ WrappedView.prototype.isOnFirstPage = function () {
654
+ return true;
655
+ };
656
+
657
+ /** Get total number of rows in a single page
658
+ * @public
659
+ * @return {number}
660
+ */
661
+ WrappedView.prototype.getPageSize = function () {
662
+ return 0;
663
+ };
664
+ /** Get total number of pages
665
+ * @public
666
+ * @return {number}
667
+ */
668
+ WrappedView.prototype.getPageCount = function () {
669
+ return 1;
670
+ };
671
+ /** {@link WrappedView#getTotalPages}
672
+ * @public
673
+ * @function
674
+ */
675
+ WrappedView.prototype.getTotalPages = WrappedView.prototype.getPageCount;
676
+ /** Shrink current view to the specified size. Set it 0 to reset to original size
677
+ * @public
678
+ * @param {number} pageSize
679
+ */
680
+ WrappedView.prototype.setPageSize = function (pageSize) {};
681
+
682
+ /** Group all rows by the specified criteria. The criteria can be field name (field value will be used as a group id) or a function that takes row data and returns group id.
683
+ * @public
684
+ * @param {string|Function|Array.<string|Function>} cid Column id or grouper method that take one parameter for row data in JSON format, and returns groupId (string)
685
+ * @param {Array=} opt_predefinedGroups
686
+ */
687
+ WrappedView.prototype.groupBy = function (cid, opt_predefinedGroups) {
688
+ this._dv.groupBy(cid, opt_predefinedGroups);
689
+ };
690
+ /** addGroup is used to add a single predefined group or multiple predefined groups.
691
+ * @public
692
+ * @param {*|Array} value
693
+ */
694
+ WrappedView.prototype.addGroup = function (value) {
695
+ this._dv.addGroup(value);
696
+ };
697
+ /** Sort all of its descendants based on given compare function
698
+ * @public
699
+ * @param {Function=} compare Default is sorting by text. If null or false value is given, no sorting is performed
700
+ */
701
+ WrappedView.prototype.sortGroups = function (compare) {
702
+ this._dv.sortGroups(compare);
703
+ };
704
+ /** Move the specified group within its group
705
+ * @public
706
+ * @param {number|string} groupRef
707
+ * @param {number} destIndex
708
+ */
709
+ WrappedView.prototype.moveGroup = function (groupRef, destIndex) {
710
+ this._dv.moveGroup(groupRef, destIndex);
711
+ };
712
+ /** WARNING: This could be very slow to perform
713
+ * @public
714
+ * @param {Array} predefinedGroups Use two dimensional array to define groups for multi-level grouping. The first item is for the top level groups. The second item is for the second level groups, and so on. If one dimentional array is given, it is treated as the first item in the two-dimentionsal array.
715
+ * @example
716
+ * dv.setPredefinedGroups(["a", "b", "c"]); // Create empty three empty groups
717
+ * dv.setPredefinedGroups([ // Create two empty groups, and each group has 3 sub-groups
718
+ * ["Main Group 1", "Main 2"],
719
+ * ["Sub 1", "Sub 2", "Sub 3"]
720
+ * ]);
721
+ */
722
+ WrappedView.prototype.setPredefinedGroups = function (predefinedGroups) {
723
+ this._dv.setPredefinedGroups(predefinedGroups);
724
+ };
725
+
726
+ /** Add a footer to current group
727
+ * @public
728
+ * @param {number=} opt_num Number of footer to be added. If not specified, the number is one.
729
+ */
730
+ WrappedView.prototype.addFooter = function (opt_num) {
731
+ this._dv.addFooter(opt_num);
732
+ };
733
+ /** Remove all footers in the gurrent view
734
+ * @public
735
+ */
736
+ WrappedView.prototype.removeFooter = function () {
737
+ this._dv.removeFooter();
738
+ };
739
+
740
+ /** Enable/Disable multi-group row mode
741
+ * @public
742
+ * @ignore
743
+ * @param {boolean=} enabled
744
+ */
745
+ WrappedView.prototype.enableMultiGroup = function(enabled) {
746
+ this._dv.enableMultiGroup(enabled);
747
+ };
748
+
749
+ /** Get a group DataView by group row id. If content row id is given, null is returned (unlike getGroup method).<br>
750
+ * Nested groups and other groups outside of this group branch will be searched.
751
+ * @public
752
+ * @param {string} rowId Group Id, row Id or group index (for immediate child groups)
753
+ * @return {DataView}
754
+ * @see {@link WrappedView#getGroup}
755
+ */
756
+ WrappedView.prototype.getGroupByRowId = function (rowId) {
757
+ return this._dv.getGroupByRowId(rowId);
758
+ };
759
+ /** Get a corresponding DataView by the given group Id, row Id or group index. If row Id of content row is given, a parent group will be returned. <br>
760
+ * Nested groups and other groups outside of this group branch will be searched.
761
+ * @public
762
+ * @param {number|string} groupRef Group Id, row Id or group index (for immediate child groups)
763
+ * @return {DataView}
764
+ * @see {@link WrappedView#getGroupByRowId}
765
+ */
766
+ WrappedView.prototype.getGroup = function (groupRef) {
767
+ return this._dv.getGroup(groupRef);
768
+ };
769
+ /** Get all group descendants
770
+ * @public
771
+ * @param {Array=} out_ary
772
+ * @return {!Array.<DataView>}
773
+ */
774
+ WrappedView.prototype.getAllGroups = function (out_ary) {
775
+ return this._dv.getAllGroups(out_ary);
776
+ };
777
+ /** Get immediate group members row ids in array list
778
+ * @public
779
+ * @return {Array.<string>}
780
+ */
781
+ WrappedView.prototype.getGroupList = function () {
782
+ return this._dv.getGroupList();
783
+ };
784
+ /** Get group id (string) of this data view. Only exists if this data view is a child data view
785
+ * @public
786
+ * @return {string}
787
+ */
788
+ WrappedView.prototype.getGroupId = function () {
789
+ return this._dv.getGroupId();
790
+ };
791
+ /** Get group value (any data type) of this data view. Only exists if this data view is a child data view
792
+ * @public
793
+ * @return {*}
794
+ */
795
+ WrappedView.prototype.getGroupValue = function () {
796
+ return this._dv.getGroupValue();
797
+ };
798
+ /** Row id used by parent data view as a header row for referencing
799
+ * @public
800
+ * @return {string}
801
+ */
802
+ WrappedView.prototype.getGroupRowId = function () {
803
+ return this._dv.getGroupRowId();
804
+ };
805
+ /**
806
+ * @public
807
+ * @ignore
808
+ * @param {number} rid
809
+ * @return {number}
810
+ */
811
+ WrappedView.prototype.getFooterRowIndex = function (rid) {
812
+ return this._dv.getFooterRowIndex(rid);
813
+ };
814
+ /** A List of the footer row ids. Footer row is placed at the bottom of all other rows in this view
815
+ * @public
816
+ * @ignore
817
+ * @return {Array.<string>} Null if there is no footer row
818
+ */
819
+ WrappedView.prototype.getFooterRowIds = function () {
820
+ return this._dv.getFooterRowIds();
821
+ };
822
+ /**
823
+ * @public
824
+ * @return {boolean}
825
+ */
826
+ WrappedView.prototype.hasGroup = function () {
827
+ return this._dv.hasGroup();
828
+ };
829
+ /** Deprecated in favor of getGroupByRowId
830
+ * @public
831
+ * @return {null}
832
+ * @see {@link WrappedView#getGroupByRowId}
833
+ */
834
+ WrappedView.prototype.getGroupRows = function () {
835
+ return null;
836
+ };
837
+ /** Get group level of the corresponding row. If the given index is not specified, header row (the view itself) is used instead. Group level 0 means it is the root data view.
838
+ * @public
839
+ * @param {(number|string)=} rowRef
840
+ * @return {number}
841
+ */
842
+ WrappedView.prototype.getGroupLevel = function (rowRef) {
843
+ var rowId = this._toRowId(rowRef);
844
+ return this._dv.getGroupLevel(rowId);
845
+ };
846
+
847
+ /** Statistics (e.g. Sum, Avg, Max, and Min) of the specified column will be collected on every update. WARNING: CPU usage is intensive. Do disable, if the column is no longer used.
848
+ * @public
849
+ * @param {string} cid
850
+ * @param {boolean=} opt_enabled
851
+ * @param {string=} opt_refId
852
+ * @return {ColumnStats} ColumnStats Object
853
+ */
854
+ WrappedView.prototype.enableColumnStats = function(cid, opt_enabled, opt_refId) {
855
+ return this._dv.enableColumnStats(cid, opt_enabled, opt_refId);
856
+ };
857
+ /** @public
858
+ * @param {string} cid
859
+ * @return {ColumnStats} ColumnStats. Return null if the column has not been enabled
860
+ */
861
+ WrappedView.prototype.getColumnStats = function(cid) {
862
+ return this._dv.getColumnStats(cid);
863
+ };
864
+
865
+ /** This method temporarily remove all rows from the view, which can improve performance as further updates and operations will be ignored
866
+ * @public
867
+ * @param {boolean=} opt_hidden
868
+ * @returns {boolean}
869
+ */
870
+ WrappedView.prototype.hide = function(opt_hidden) {
871
+ return this._dv.hide(opt_hidden);
872
+ };
873
+ /** @public
874
+ * @return {boolean}
875
+ */
876
+ WrappedView.prototype.isHidden = function() {
877
+ return this._dv.isHidden();
878
+ };
879
+ /** @public
880
+ * @param {string} rowId
881
+ * @return {boolean} Returns true when this row is hidden
882
+ */
883
+ WrappedView.prototype.isHiddenRow = function(rowId) {
884
+ return this._dv.isHiddenRow(rowId);
885
+ };
886
+
887
+ /** Collapse current view. This works only if the view is generated as a child view
888
+ * @public
889
+ * @param {boolean=} opt_collapsed
890
+ */
891
+ WrappedView.prototype.collapse = function(opt_collapsed) {
892
+ this._dv.collapse(opt_collapsed);
893
+ };
894
+ /** Collapse all children and descendants, excluding itself and its parent
895
+ * @public
896
+ * @param {boolean=} opt_collapsed
897
+ */
898
+ WrappedView.prototype.collapseAllGroups = function(opt_collapsed) {
899
+ this._dv.collapseAllGroups(opt_collapsed);
900
+ };
901
+ /** @public
902
+ */
903
+ WrappedView.prototype.toggleCollapsedState = function() {
904
+ this.collapse(!this.isCollapsed());
905
+ };
906
+ /** @public
907
+ * @return {boolean}
908
+ */
909
+ WrappedView.prototype.isCollapsed = function() {
910
+ return this._dv.isCollapsed();
911
+ };
912
+ /** Content as header mode indicates that the group headers cannot be collapsed and the first row in the group will always be shown.
913
+ * @public
914
+ * @param {boolean=} bool
915
+ */
916
+ WrappedView.prototype.enableContentAsHeader = function(bool) {
917
+ this._dv.enableContentAsHeader(bool);
918
+ };
919
+
920
+ /** This will not include collapsed group and rows
921
+ * @public
922
+ * @return {number}
923
+ */
924
+ WrappedView.prototype.getVisibleRowCount = function() {
925
+ return this._rids.length;
926
+ };
927
+
928
+ /** @public
929
+ * @description check weather row object is in group
930
+ * @param {Object} rowData
931
+ * @param {string=} groupID Default group id is the group id of the DataView that is being called.
932
+ * @return {boolean}
933
+ */
934
+ WrappedView.prototype.isRowDataInGroup = function (rowData, groupID) {
935
+ return this._dv.isRowDataInGroup(rowData, groupID);
936
+ };
937
+
938
+ /** @public
939
+ * @description check weather row ID is in group
940
+ * @param {string} rowId
941
+ * @param {string=} groupID Default group id is the group id of the DataView that is being called.
942
+ * @return {boolean}
943
+ */
944
+ WrappedView.prototype.isRowIdInGroup = function (rowId, groupID) {
945
+ return this._dv.isRowIdInGroup(rowId, groupID);
946
+ };
947
+
948
+ /** The row expansion will be directly below the specified row, even if this data view is sorted.
949
+ * @public
950
+ * @param {string} rid Row Id
951
+ * @param {number=} count=1
952
+ */
953
+ WrappedView.prototype.addRowExpansion = function(rid, count) {
954
+ this._dv.addRowExpansion(rid, count);
955
+ };
956
+ /**
957
+ * @public
958
+ * @param {string} rid Row Id
959
+ */
960
+ WrappedView.prototype.removeRowExpansion = function(rid) {
961
+ this._dv.removeRowExpansion(rid, count);
962
+ };
963
+ /**
964
+ * @public
965
+ * @param {string|number} rowRef Row Id or index
966
+ * @param {boolean=} force
967
+ * @param {number=} count=1
968
+ */
969
+ WrappedView.prototype.toggleRowExpansion = function(rowRef, force, count) {
970
+ var rid = this._toRowId(rowRef);
971
+ this._dv.toggleRowExpansion(rid, force, count);
972
+ };
973
+ /** @public
974
+ */
975
+ WrappedView.prototype.removeAllRowExpansions = function() {
976
+ this._dv.removeAllRowExpansions();
977
+ };
978
+ /** Deprecated. Use {@link WrappedView#getExpansionParents} instead. Get all rows with expansion (not row expansion itself) will contains row id, otherwise undefined.
979
+ * @public
980
+ * @ignore
981
+ * @param {number=} from
982
+ * @param {number=} to EXCLUSIVE
983
+ * @return {!Array.<string|undefined>}
984
+ */
985
+ WrappedView.prototype.getRowsWithExpansion = function(from, to) {
986
+ return this._dv.getRowsWithExpansion(from, to); // TODO: Convert row index to row id
987
+ };
988
+ /** Get row expansion states from the specified range. The returned value will be row id for row expansion, otherwise empty string for other types of row (e.g. normal row, or group header row)
989
+ * @public
990
+ * @param {number=} from
991
+ * @param {number=} to EXCLUSIVE
992
+ * @return {Array.<string>} object mapping of rowIndex and parentRowId
993
+ */
994
+ WrappedView.prototype.getExpansionParents = function (from, to) {
995
+ return this._dv.getExpansionParents(from, to); // TODO: Convert row index to row id
996
+ };
997
+
998
+ /** Check if the specified row is itself a row expansion.
999
+ * @public
1000
+ * @param {string} rid rowId
1001
+ * @return {boolean}
1002
+ */
1003
+ WrappedView.prototype.isRowExpansion = function(rid) {
1004
+ return this._dv.isRowExpansion(rid);
1005
+ };
1006
+ /** Check if the specified row has row expansion (not row expansion itself).
1007
+ * @public
1008
+ * @param {string} rid rowId
1009
+ * @return {boolean}
1010
+ */
1011
+ WrappedView.prototype.hasRowExpansion = function(rid) {
1012
+ return this._dv.hasRowExpansion(rid);
1013
+ };
1014
+ /** Get row Id of the row expansion by providing the row Id of the row with row expansion (not row expansion itself). This is NOT recommended for normal usage, since the row expansion contains no data in the DataView
1015
+ * @public
1016
+ * @param {string} rid rowId
1017
+ * @param {number=} idx=0
1018
+ * @return {string} Empty string is returned if the provided row does not contains a row expansion.
1019
+ */
1020
+ WrappedView.prototype.getRowExpansionId = function(rid, idx) {
1021
+ return this._dv.getRowExpansionId(rid, idx);
1022
+ };
1023
+
1024
+ /** Get index from the row expansion id. Any row other than row expansion will yield negative value (-1)
1025
+ * @public
1026
+ * @param {string} rid Row expansion id
1027
+ * @return {number}
1028
+ */
1029
+ WrappedView.prototype.getRowExpansionIndex = function(rid) {
1030
+ return this._dv.getRowExpansionIndex(rid);
1031
+ };
1032
+ /**
1033
+ * @public
1034
+ * @param {function(Object):boolean} searchLogic Function that takes row data object and return boolean value
1035
+ * @param {Array.<string>=} opt_out Array for containing row ids
1036
+ * @return {!Array.<string>} List of row ids
1037
+ */
1038
+ WrappedView.prototype.searchAll = function(searchLogic, opt_out) {
1039
+ return this._dv.searchAll(searchLogic, opt_out);
1040
+ };
1041
+ /**
1042
+ * @public
1043
+ * @param {number|string} rowRef
1044
+ * @param {function(Object):boolean} searchLogic Function that takes row data object and return boolean value
1045
+ * @return {number} Row index
1046
+ */
1047
+ WrappedView.prototype.searchPrev = function(rowRef, searchLogic) {
1048
+ var rid = this._toRowId(rowRef);
1049
+ return this._dv.searchPrev(rid, searchLogic);
1050
+ };
1051
+ /**
1052
+ * @public
1053
+ * @param {number|string} rowRef
1054
+ * @param {function(Object):boolean} searchLogic Function that takes row data object and return boolean value
1055
+ * @return {number} Row index
1056
+ */
1057
+ WrappedView.prototype.searchNext = function(rowRef, searchLogic) {
1058
+ var rid = this._toRowId(rowRef);
1059
+ return this._dv.searchNext(rid, searchLogic);
1060
+ };
1061
+
1062
+ /** Blocks all row insertion and removal, but keep updating the data
1063
+ * @public
1064
+ * @param {boolean=} opt_bool
1065
+ * @return {boolean} True if there is any change
1066
+ */
1067
+ WrappedView.prototype.stall = function(opt_bool) {
1068
+ return this._dv.stall(opt_bool);
1069
+ };
1070
+ /** Automatically and asyncronuosly remove group that has no member or no content. Predefined groups will not be removed in this way.
1071
+ * @public
1072
+ * @param {boolean=} opt_bool
1073
+ * @return {boolean} True if there is any change
1074
+ */
1075
+ WrappedView.prototype.enableAutoGroupRemoval = function(opt_bool) {
1076
+ return this._dv.enableAutoGroupRemoval(opt_bool);
1077
+ };
1078
+ /** Automatically hide null or undefined group header, while keeping the group's items intact.
1079
+ * @public
1080
+ * @param {boolean=} opt_bool
1081
+ * @return {boolean} True if there is any change
1082
+ */
1083
+ WrappedView.prototype.enableAutoGroupHiding = function(opt_bool) {
1084
+ return this._dv.enableAutoGroupHiding(opt_bool);
1085
+ };
1086
+
1087
+ /** Copy row order in data view to its data table
1088
+ * @public
1089
+ */
1090
+ WrappedView.prototype.synchronizeRowOrder = function() {
1091
+ this._dv.synchronizeRowOrder();
1092
+ };
1093
+ /** Set visible row as segment separator (hidden or filtered rows cannot be a segment separator)
1094
+ * @public
1095
+ * @param {string|number} rowRef Row id or row index
1096
+ * @param {boolean=} enabled
1097
+ * @return {boolean} Return true if there is any change
1098
+ */
1099
+ WrappedView.prototype.setSegmentSeparator = function(rowRef, enabled) {
1100
+ var rowId = this._toRowId(rowRef);
1101
+ return this._dv.setSegmentSeparator(rowId, enabled);
1102
+ };
1103
+ /**
1104
+ * @public
1105
+ * @return {boolean} Return true if there is any change
1106
+ */
1107
+ WrappedView.prototype.unsetAllSegmentSeparators = function() {
1108
+ return this._dt.unsetAllSegmentSeparators();
1109
+ };
1110
+ /**
1111
+ * @public
1112
+ * @return {boolean}
1113
+ */
1114
+ WrappedView.prototype.hasSegmentation = function() {
1115
+ return this._dt.hasSegmentation();
1116
+ };
1117
+ /**
1118
+ * @public
1119
+ * @param {string} rid
1120
+ * @return {boolean}
1121
+ */
1122
+ WrappedView.prototype.isSegmentSeparator = function(rid) {
1123
+ return this._dt.isSegmentSeparator(rid);
1124
+ };
1125
+
1126
+ /**
1127
+ * @public
1128
+ * @param {string} rid
1129
+ * @return {string} parent row id of this segmentation. If the parent row id for this segmentation cannot be found, return ""
1130
+ */
1131
+ WrappedView.prototype.getSegmentParentRowId = function(rid) {
1132
+ return this._dt.getSegmentParentRowId(rid);
1133
+ };
1134
+ /** @public
1135
+ * @param {string|number} rowRef Row id or row index
1136
+ * @param {boolean=} collapsed
1137
+ * @return {boolean} Return true if there is any change
1138
+ */
1139
+ WrappedView.prototype.collapseSegment = function(rowRef, collapsed) {
1140
+ var rid = this._toRowId(rowRef);
1141
+ return this._dv.collapseSegment(rid, collapsed);
1142
+ };
1143
+ /** @public
1144
+ * @param {string|number} rowRef Row id or row index
1145
+ * @param {boolean=} expanded
1146
+ * @return {boolean} Return true if there is any change
1147
+ */
1148
+ WrappedView.prototype.expandSegment = function(rowRef, expanded) {
1149
+ return this.collapseSegment(rowRef, expanded === false);
1150
+ };
1151
+ /** @public
1152
+ * @return {boolean} Return true if there is any change
1153
+ */
1154
+ WrappedView.prototype.expandAllSegments = function() {
1155
+ return this._dv.expandAllSegments();
1156
+ };
1157
+ /** Deprecated.
1158
+ * @public
1159
+ * @ignore
1160
+ */
1161
+ WrappedView.prototype.setSegmentCollapsingLogic = function() {};
1162
+ /** @public
1163
+ * @param {string|number} rowRef Row id or row index
1164
+ * @return {boolean} Return true if only the given row is a collapsed segment separator
1165
+ */
1166
+ WrappedView.prototype.isSegmentCollapsed = function(rowRef) {
1167
+ var rid = this._toRowId(rowRef);
1168
+ return this._dv.isSegmentCollapsed(rid, collapsed);
1169
+ };
1170
+ /** Remove existing segment children and fill the segments with all contnet rows before the next segment separator
1171
+ * @public
1172
+ * @param {string|number} segmentRef Row id or row index
1173
+ */
1174
+ WrappedView.prototype.fillSegment = function(segmentRef) {
1175
+ var rid = this._toRowId(segmentRef);
1176
+ this._dv.fillSegment(rid);
1177
+ };
1178
+ /** Remove all existing segment children in each segment and fill the segments with all contnet rows before the next segment separator
1179
+ * @public
1180
+ */
1181
+ WrappedView.prototype.fillSegments = function() {
1182
+ this._dv.fillSegments();
1183
+ };
1184
+ /** @public
1185
+ * @param {string|number} segmentRef Row id or row index
1186
+ * @param {string|number} rowRef Row id, row index
1187
+ * @return {boolean} Return true if there is any change
1188
+ */
1189
+ WrappedView.prototype.addSegmentChild = function(segmentRef, rowRef) {
1190
+ var segmentId = this._toRowId(segmentRef);
1191
+ var rowId = this._toRowId(rowRef);
1192
+ return this._dv.addSegmentChild(segmentId, rowId);
1193
+ };
1194
+ /** @public
1195
+ * @param {string|number} segmentRef Row id or row index
1196
+ * @param {Array.<string|number>} rowRefs Array of row ids or row indices
1197
+ * @return {boolean} Return true if there is any change
1198
+ */
1199
+ WrappedView.prototype.addSegmentChildren = function(segmentRef, rowRefs) {
1200
+ var segmentId = this._toRowId(segmentRef);
1201
+ var rowId = this._toRowId(rowRef);
1202
+ return this._dv.addSegmentChildren(segmentId, rowId);
1203
+ };
1204
+ /** @public
1205
+ * @param {string|number} segmentRef Row id or row index
1206
+ * @param {string|number} rowRef Row id, row index
1207
+ * @return {boolean} Return true if there is any change
1208
+ */
1209
+ WrappedView.prototype.removeSegmentChild = function(segmentRef, rowRef) {
1210
+ var segmentId = this._toRowId(segmentRef);
1211
+ var rowId = this._toRowId(rowRef);
1212
+ return this._dv.removeSegmentChild(segmentId, rowId);
1213
+ };
1214
+ /** @public
1215
+ * @param {string|number} segmentRef Row id or row index
1216
+ * @param {Array.<string|number>} rowRefs Array of row ids or row indices. If null is given, no child will be removed.
1217
+ * @return {boolean} Return true if there is any change
1218
+ */
1219
+ WrappedView.prototype.removeSegmentChildren = function(segmentRef, rowRefs) {
1220
+ var segmentId = this._toRowId(segmentRef);
1221
+ var rowId = this._toRowId(rowRef);
1222
+ return this._dv.removeSegmentChildren(segmentId, rowId);
1223
+ };
1224
+ /** @public
1225
+ * @return {boolean} Return true if there is any change
1226
+ */
1227
+ WrappedView.prototype.removeAllSegmentChildren = function() {
1228
+ return this._dt.removeAllSegmentChildren();
1229
+ };
1230
+ /** Get row ids of all segment separator
1231
+ * @public
1232
+ * @return {Array.<string>} Return null if there is no segment separator
1233
+ */
1234
+ WrappedView.prototype.getSegmentIds = function() {
1235
+ return this._dt.getSegmentIds();
1236
+ };
1237
+ /** Get row ids of all children from the specified segment
1238
+ * @public
1239
+ * @param {string|number} segmentRef Row id or row index
1240
+ * @return {Array.<string>} Returns array of row ids. Returns null if there is no child or no segment separator found
1241
+ */
1242
+ WrappedView.prototype.getSegmentChildIds = function(segmentRef) {
1243
+ return this._dt.getSegmentChildIds(this._toRowId(segmentRef));
1244
+ };
1245
+ /** Sort all of existing segments by given compare function
1246
+ * @public
1247
+ * @param {Function} compare
1248
+ */
1249
+ WrappedView.prototype.sortSegments = function (compare) {
1250
+ this._dt.sortSegments(compare);
1251
+ };
1252
+
1253
+ /** Return 0, if there is no wrapping
1254
+ * @public
1255
+ * @return {number}
1256
+ */
1257
+ WrappedView.prototype.getWrapSize = function () {
1258
+ return this._dv.getWrapSize();
1259
+ };
1260
+ /** Return null, if there is no wrapping
1261
+ * @public
1262
+ * @return {Array.<WrappedView>}
1263
+ */
1264
+ WrappedView.prototype.getWrappedViews = function () {
1265
+ return this._dv.getWrappedViews();
1266
+ };
1267
+ /**
1268
+ * @public
1269
+ * @param {number=} wrapSize
1270
+ * @fires DataView#wrapCountChanged
1271
+ */
1272
+ WrappedView.prototype.wrapView = function (wrapSize) {
1273
+ this._dv.wrapView(wrapSize);
1274
+ };
1275
+
1276
+ /** Construct a JSON object that is compatible with console.table()
1277
+ * @public
1278
+ * @param {Object=} opt_options {@link DataCache#dump}
1279
+ * @return {!Array.<Object>} Return a JSON object that is compatible with console.table()
1280
+ * @see {@link DataCache#dump}
1281
+ */
1282
+ WrappedView.prototype.dump = function(opt_options) {
1283
+ return DataCache.constructTable(this.getMultipleRowData(this._rids), opt_options, this._rids);
1284
+ };
1285
+ /** Print current data and structure to console panel
1286
+ * @public
1287
+ * @param {Object=} opt_options
1288
+ * @example
1289
+ // Options have the following format:
1290
+ // {
1291
+ // "colNames": Array.<string>,
1292
+ // "rowCount": number,
1293
+ // "startIndex": number,
1294
+ // "getter": function(Object, string):*,
1295
+ // "withRowIds": boolean
1296
+ //}
1297
+ dv.log({"rowCount": 10}); // Showing 10 records
1298
+ dv.log({"getter": function(rowData, colName){
1299
+ var complexData = rowData[colName];
1300
+ return complextData.someProperty;
1301
+ }});
1302
+ */
1303
+ WrappedView.prototype.log = function(opt_options) {
1304
+ console.table(this.dump(opt_options));
1305
+ };
1306
+
1307
+
1308
+ /** Check if the row should be filtered out
1309
+ * @public
1310
+ * @param {string} rid
1311
+ * @param {Object} rowData
1312
+ * @return {boolean}
1313
+ */
1314
+ WrappedView.prototype.isRowFiltered = function(rid, rowData) {
1315
+ return this._dv.isRowFiltered(rid, rowData);
1316
+ };
1317
+
1318
+ export default WrappedView;
1319
+ export { WrappedView };