@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.
- package/lib/column-selection-dialog/lib/column-selection-dialog.js +80 -18
- package/lib/column-selection-dialog/themes/halo/dark/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/halo/dark/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/halo/light/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/core/dist/core.css +1 -1
- package/lib/core/dist/core.js +12961 -10749
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataView.d.ts +22 -7
- package/lib/core/es6/data/DataView.js +176 -49
- package/lib/core/es6/data/WrappedView.d.ts +289 -0
- package/lib/core/es6/data/WrappedView.js +1319 -0
- package/lib/core/es6/grid/Core.d.ts +13 -0
- package/lib/core/es6/grid/Core.js +393 -155
- package/lib/core/es6/grid/ILayoutGrid.d.ts +8 -0
- package/lib/core/es6/grid/ILayoutGrid.js +45 -2
- package/lib/core/es6/grid/LayoutGrid.d.ts +10 -1
- package/lib/core/es6/grid/LayoutGrid.js +257 -82
- package/lib/core/es6/grid/VirtualizedLayoutGrid.d.ts +10 -1
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +314 -27
- package/lib/core/es6/grid/components/Column.js +8 -2
- package/lib/core/es6/grid/components/HScrollbar.d.ts +4 -0
- package/lib/core/es6/grid/components/HScrollbar.js +20 -4
- package/lib/core/es6/grid/util/TrackLayout.d.ts +1 -1
- package/lib/core/es6/grid/util/TrackLayout.js +2 -3
- package/lib/core/es6/tr-grid-theme.js +1 -1
- package/lib/filter-dialog/lib/filter-dialog.js +8 -6
- package/lib/grid/lib/efx-grid.d.ts +14 -7
- package/lib/grid/lib/efx-grid.js +113 -114
- package/lib/grid/themes/base.less +4 -2
- package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
- package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
- package/lib/grid/themes/halo/efx-grid.less +69 -32
- package/lib/grid/themes/halo/light/efx-grid.js +1 -1
- package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/grid/themes/solar/charcoal/efx-grid.js +1 -1
- package/lib/grid/themes/solar/charcoal/es5/all-elements.js +1 -1
- package/lib/grid/themes/solar/pearl/efx-grid.js +1 -1
- package/lib/grid/themes/solar/pearl/es5/all-elements.js +1 -1
- package/lib/row-segmenting/es6/RowSegmenting.d.ts +1 -0
- package/lib/row-segmenting/es6/RowSegmenting.js +40 -11
- package/lib/rt-grid/dist/rt-grid.js +10290 -7864
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +4 -1
- package/lib/rt-grid/es6/ColumnDefinition.js +3 -0
- package/lib/rt-grid/es6/Grid.d.ts +14 -7
- package/lib/rt-grid/es6/Grid.js +241 -74
- package/lib/rt-grid/es6/RowDefinition.d.ts +4 -1
- package/lib/rt-grid/es6/RowDefinition.js +52 -2
- package/lib/tr-grid-cell-selection/es6/CellSelection.d.ts +1 -1
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +53 -40
- package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +2 -0
- package/lib/tr-grid-checkbox/es6/Checkbox.js +29 -14
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +1 -0
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +10 -0
- package/lib/tr-grid-column-selection/es6/ColumnSelection.d.ts +5 -1
- package/lib/tr-grid-column-selection/es6/ColumnSelection.js +226 -4
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +3 -0
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +1 -0
- package/lib/tr-grid-filter-input/es6/FilterInput.d.ts +4 -2
- package/lib/tr-grid-filter-input/es6/FilterInput.js +73 -10
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +102 -12
- package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +2 -0
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +88 -33
- package/lib/tr-grid-row-grouping/es6/RowGrouping.js +41 -31
- package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +5 -1
- package/lib/tr-grid-row-selection/es6/RowSelection.js +188 -7
- package/lib/tr-grid-rowcoloring/es6/RowColoring.d.ts +2 -0
- package/lib/tr-grid-rowcoloring/es6/RowColoring.js +36 -0
- package/lib/tr-grid-util/es6/CellPainter.d.ts +8 -8
- package/lib/tr-grid-util/es6/Conflator.d.ts +2 -2
- package/lib/tr-grid-util/es6/CoralItems.d.ts +1 -1
- package/lib/tr-grid-util/es6/DateTime.d.ts +4 -4
- package/lib/tr-grid-util/es6/Delay.d.ts +1 -1
- package/lib/tr-grid-util/es6/Dom.d.ts +4 -4
- package/lib/tr-grid-util/es6/ElementWrapper.d.ts +1 -1
- package/lib/tr-grid-util/es6/ElfDate.d.ts +3 -3
- package/lib/tr-grid-util/es6/ElfUtil.d.ts +4 -4
- package/lib/tr-grid-util/es6/EventDispatcher.d.ts +1 -1
- package/lib/tr-grid-util/es6/FieldFormatter.d.ts +1 -1
- package/lib/tr-grid-util/es6/FilterBuilder.d.ts +5 -5
- package/lib/tr-grid-util/es6/GridPlugin.d.ts +3 -3
- package/lib/tr-grid-util/es6/MouseDownTrait.d.ts +1 -1
- package/lib/tr-grid-util/es6/MultiTableManager.d.ts +2 -2
- package/lib/tr-grid-util/es6/PercentBar.d.ts +1 -1
- package/lib/tr-grid-util/es6/Perf.d.ts +4 -4
- package/lib/tr-grid-util/es6/Popup.d.ts +2 -2
- package/lib/tr-grid-util/es6/RequestQueue.d.ts +1 -1
- package/lib/tr-grid-util/es6/RowPainter.d.ts +3 -0
- package/lib/tr-grid-util/es6/RowPainter.js +66 -12
- package/lib/tr-grid-util/es6/SubTable.d.ts +9 -9
- package/lib/tr-grid-util/es6/Table.d.ts +13 -13
- package/lib/tr-grid-util/es6/TextHighlighter.d.ts +3 -3
- package/lib/tr-grid-util/es6/TickCodes.d.ts +2 -2
- package/lib/tr-grid-util/es6/TouchProxy.d.ts +1 -1
- package/lib/tr-grid-util/es6/Util.d.ts +6 -6
- package/lib/tr-grid-util/es6/formula/Engine.d.ts +5 -5
- package/lib/tr-grid-util/es6/formula/Formula.d.ts +3 -3
- package/lib/tr-grid-util/es6/formula/RealtimeService.d.ts +1 -1
- package/lib/tr-grid-util/es6/jet/CollectionDict.d.ts +2 -2
- package/lib/tr-grid-util/es6/jet/DataGenerator.d.ts +4 -4
- package/lib/tr-grid-util/es6/jet/MockArchive.d.ts +1 -1
- package/lib/tr-grid-util/es6/jet/MockJET.d.ts +4 -4
- package/lib/tr-grid-util/es6/jet/MockQuotes.d.ts +11 -11
- package/lib/tr-grid-util/es6/jet/MockQuotes2.d.ts +7 -7
- package/lib/tr-grid-util/es6/jet/MockRTK.d.ts +1 -1
- package/lib/tr-grid-util/es6/jet/mockDataAPI.d.ts +1 -1
- package/lib/types/es6/CellSelection.d.ts +1 -1
- package/lib/types/es6/Checkbox.d.ts +2 -0
- package/lib/types/es6/ColumnGrouping.d.ts +1 -0
- package/lib/types/es6/ColumnSelection.d.ts +5 -1
- package/lib/types/es6/Core/data/DataView.d.ts +22 -7
- package/lib/types/es6/Core/data/WrappedView.d.ts +289 -0
- package/lib/types/es6/Core/grid/Core.d.ts +13 -0
- package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +8 -0
- package/lib/types/es6/Core/grid/LayoutGrid.d.ts +10 -1
- package/lib/types/es6/Core/grid/VirtualizedLayoutGrid.d.ts +10 -1
- package/lib/types/es6/Core/grid/components/HScrollbar.d.ts +4 -0
- package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +1 -1
- package/lib/types/es6/FilterInput.d.ts +4 -2
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +4 -1
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +15 -8
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +4 -1
- package/lib/types/es6/RowColoring.d.ts +2 -0
- package/lib/types/es6/RowFiltering.d.ts +2 -0
- package/lib/types/es6/RowSegmenting.d.ts +1 -0
- package/lib/types/es6/RowSelection.d.ts +5 -1
- package/lib/types/es6/Zoom.d.ts +2 -1
- package/lib/types/es6/index.d.ts +2 -0
- package/lib/versions.json +17 -17
- package/lib/zoom/es6/Zoom.d.ts +2 -1
- package/lib/zoom/es6/Zoom.js +11 -4
- package/package.json +7 -7
@@ -1,11 +1,18 @@
|
|
1
1
|
import Ext from "../../../tr-grid-util/es6/Ext.js";
|
2
2
|
import DataCache from "./DataCache.js";
|
3
3
|
import DataTable from "./DataTable.js";
|
4
|
+
import WrappedView from "./WrappedView.js"; // eslint-disable-line
|
4
5
|
import ColumnStats from "./ColumnStats.js";
|
5
6
|
import EventDispatcher from "../grid/event/EventDispatcher.js";
|
6
7
|
import Util from "../grid/util/util.js";
|
7
8
|
import { Conflator } from "../../../tr-grid-util/es6/Conflator.js";
|
8
9
|
|
10
|
+
declare namespace DataView {
|
11
|
+
|
12
|
+
type IDataView = DataTable|WrappedView|DataView;
|
13
|
+
|
14
|
+
}
|
15
|
+
|
9
16
|
declare class DataView extends EventDispatcher {
|
10
17
|
|
11
18
|
constructor(source?: DataTable|DataView);
|
@@ -22,7 +29,9 @@ declare class DataView extends EventDispatcher {
|
|
22
29
|
|
23
30
|
public getAllRowIds(shallowCopy?: boolean, inclNonDataRow?: boolean): (string)[];
|
24
31
|
|
25
|
-
public
|
32
|
+
public getVisibleRowIds(shallowCopy?: boolean): (string)[];
|
33
|
+
|
34
|
+
public getSortedRowIds(shallowCopy?: boolean): (string)[];
|
26
35
|
|
27
36
|
public getRowIndex(rid: string): number;
|
28
37
|
|
@@ -52,9 +61,9 @@ declare class DataView extends EventDispatcher {
|
|
52
61
|
|
53
62
|
public removeRow(rowRef: number|string): void;
|
54
63
|
|
55
|
-
public removeRows(
|
64
|
+
public removeRows(rowRefs: (number|string)[]): void;
|
56
65
|
|
57
|
-
public moveRow(
|
66
|
+
public moveRow(fromRef: (number|string)[]|number|string, toRef: number|string): (string)[]|string;
|
58
67
|
|
59
68
|
public swapRow(fromIndex: number, toIndex: number): void;
|
60
69
|
|
@@ -62,7 +71,7 @@ declare class DataView extends EventDispatcher {
|
|
62
71
|
|
63
72
|
public getDataSource(): DataTable|DataView;
|
64
73
|
|
65
|
-
public setDataSource(source?: DataTable|DataView): void;
|
74
|
+
public setDataSource(source?: (DataTable|DataView)): void;
|
66
75
|
|
67
76
|
public setConflationRate(milliSecond: number): void;
|
68
77
|
|
@@ -172,6 +181,8 @@ declare class DataView extends EventDispatcher {
|
|
172
181
|
|
173
182
|
public isHidden(): boolean;
|
174
183
|
|
184
|
+
public isHiddenRow(rowId: string): boolean;
|
185
|
+
|
175
186
|
public collapse(opt_collapsed?: boolean): void;
|
176
187
|
|
177
188
|
public collapseAllGroups(opt_collapsed?: boolean): void;
|
@@ -182,8 +193,6 @@ declare class DataView extends EventDispatcher {
|
|
182
193
|
|
183
194
|
public enableContentAsHeader(bool?: boolean): void;
|
184
195
|
|
185
|
-
public getVisibleRowIds(opt_shallowCopy?: boolean): (string)[];
|
186
|
-
|
187
196
|
public getVisibleRowCount(): number;
|
188
197
|
|
189
198
|
public isRowDataInGroup(rowData: any, groupID?: string): boolean;
|
@@ -260,6 +269,12 @@ declare class DataView extends EventDispatcher {
|
|
260
269
|
|
261
270
|
public sortSegments(compare: ((...params: any[]) => any)): void;
|
262
271
|
|
272
|
+
public getWrapSize(): number;
|
273
|
+
|
274
|
+
public getWrappedViews(): (WrappedView)[];
|
275
|
+
|
276
|
+
public wrapView(wrapSize?: number): void;
|
277
|
+
|
263
278
|
public dump(opt_options?: any): (any)[];
|
264
279
|
|
265
280
|
public log(opt_options?: any): void;
|
@@ -268,7 +283,7 @@ declare class DataView extends EventDispatcher {
|
|
268
283
|
|
269
284
|
}
|
270
285
|
|
271
|
-
declare function
|
286
|
+
declare function fromRids(fromIndex: number, toIndex: number): void;
|
272
287
|
|
273
288
|
declare function criteria(value: any|any[]): void;
|
274
289
|
|
@@ -1,11 +1,16 @@
|
|
1
1
|
import Ext from "../../../tr-grid-util/es6/Ext.js";
|
2
2
|
import DataCache from "./DataCache.js";
|
3
3
|
import DataTable from "./DataTable.js";
|
4
|
+
import WrappedView from "./WrappedView.js"; // eslint-disable-line
|
4
5
|
import ColumnStats from "./ColumnStats.js";
|
5
6
|
import EventDispatcher from "../grid/event/EventDispatcher.js";
|
6
7
|
import Util from "../grid/util/util.js";
|
7
8
|
import { Conflator } from "../../../tr-grid-util/es6/Conflator.js";
|
8
9
|
|
10
|
+
/** @typedef {DataTable|WrappedView|DataView} DataView~IDataView
|
11
|
+
* @description DataView like classes
|
12
|
+
*/
|
13
|
+
|
9
14
|
/** @event DataView#dataChanged
|
10
15
|
* @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.
|
11
16
|
* @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.
|
@@ -40,6 +45,14 @@ import { Conflator } from "../../../tr-grid-util/es6/Conflator.js";
|
|
40
45
|
* @description Fired once before actual row filtering (before multiple execution of filter logic). This allow optimization by preparing data needed for the filtering
|
41
46
|
* @type {Object}
|
42
47
|
*/
|
48
|
+
/** @event DataView#wrapCountChanged
|
49
|
+
* @property {number} prevCount
|
50
|
+
* @property {number} newCount
|
51
|
+
*/
|
52
|
+
/** @event DataView#wrapSizeChanged
|
53
|
+
* @property {number} wrapSize
|
54
|
+
* @property {Array.<string>} rids
|
55
|
+
*/
|
43
56
|
|
44
57
|
/** DataView doesn't hold the actual data. It is just a transform view (by applying filtering or sorting) of the data from the {@link DataTable}
|
45
58
|
* @constructor
|
@@ -56,6 +69,7 @@ var DataView = function(source) {
|
|
56
69
|
t._onGroupAdded = t._onGroupAdded.bind(t);
|
57
70
|
t._onBeforeGroupAdded = t._onBeforeGroupAdded.bind(t);
|
58
71
|
t._onRefreshTimeout = t._onRefreshTimeout.bind(t);
|
72
|
+
t._updateWrapCount = t._updateWrapCount.bind(t);
|
59
73
|
|
60
74
|
t._rids = [];
|
61
75
|
t._sortingDefs = [];
|
@@ -72,7 +86,9 @@ var DataView = function(source) {
|
|
72
86
|
"groupAdded",
|
73
87
|
"beforeGroupAdded",
|
74
88
|
"groupCriteriaChanged",
|
75
|
-
"beforeFiltering"
|
89
|
+
"beforeFiltering",
|
90
|
+
"wrapCountChanged",
|
91
|
+
"wrapSizeChanged"
|
76
92
|
);
|
77
93
|
|
78
94
|
t.setDataSource(source);
|
@@ -251,9 +267,21 @@ DataView.prototype._showOnlyFirstMember = false;
|
|
251
267
|
*/
|
252
268
|
DataView.prototype._beingAdded = false;
|
253
269
|
/** @private
|
254
|
-
* @type {Conflator
|
270
|
+
* @type {Conflator}
|
255
271
|
*/
|
256
272
|
DataView.prototype._conflator = null;
|
273
|
+
/** @private
|
274
|
+
* @type {Array.<WrappedView>}
|
275
|
+
*/
|
276
|
+
DataView.prototype._wrappedViews = null;
|
277
|
+
/** @private
|
278
|
+
* @type {number}
|
279
|
+
*/
|
280
|
+
DataView.prototype._wrapSize = 0;
|
281
|
+
/** @private
|
282
|
+
* @type {number}
|
283
|
+
*/
|
284
|
+
DataView.prototype._wrapTimerId = 0;
|
257
285
|
|
258
286
|
/** @public
|
259
287
|
* @fires DataView#preDisposed
|
@@ -262,6 +290,8 @@ DataView.prototype.dispose = function() {
|
|
262
290
|
this._dispatch("preDisposed", {});
|
263
291
|
|
264
292
|
this.unlistenAll();
|
293
|
+
this.wrapView(0);
|
294
|
+
|
265
295
|
this.setDataSource(null); // Remove this._dt and this._parent. WARNING: an event is fired
|
266
296
|
this.groupBy(null); // Remove this._groupCriteria, this._groupRows and all of its children. WARNING: an event is fired
|
267
297
|
|
@@ -271,6 +301,10 @@ DataView.prototype.dispose = function() {
|
|
271
301
|
|
272
302
|
this._userFilter = this._groupSortingLogic = null;
|
273
303
|
|
304
|
+
if(this._wrapTimerId) {
|
305
|
+
clearTimeout(this._wrapTimerId);
|
306
|
+
this._wrapTimerId = 0;
|
307
|
+
}
|
274
308
|
if(this._refreshTimerId) {
|
275
309
|
clearTimeout(this._refreshTimerId);
|
276
310
|
this._refreshTimerId = 0;
|
@@ -344,7 +378,7 @@ DataView.prototype._toRowId = function(rowRef) {
|
|
344
378
|
};
|
345
379
|
/** @private
|
346
380
|
* @param {Array.<number|string>} rowRefs
|
347
|
-
* @return {Array.<string>}
|
381
|
+
* @return {!Array.<string>}
|
348
382
|
*/
|
349
383
|
DataView.prototype._toRowIds = function(rowRefs) {
|
350
384
|
var rowCount = Array.isArray(rowRefs) ? rowRefs.length : 0;
|
@@ -361,14 +395,15 @@ DataView.prototype._toRowIds = function(rowRefs) {
|
|
361
395
|
}
|
362
396
|
return ary;
|
363
397
|
};
|
364
|
-
/** Return all row ids with row data, excluding the group header rows (auto generated rows)
|
365
|
-
* Do use getAllRowData to retrieve all data
|
398
|
+
/** Return all row ids with row data, excluding the group header rows (auto generated rows).
|
366
399
|
* @public
|
367
|
-
* @param {boolean=} shallowCopy
|
368
|
-
* @param {boolean=} inclNonDataRow=false If enabled, group header rows are included
|
400
|
+
* @param {boolean=} shallowCopy=false If enabled, no new copy of Array is created (better for performance).
|
401
|
+
* @param {boolean=} inclNonDataRow=false If enabled, group header rows are included. In pagination mode, this flag will always be true.
|
369
402
|
* @return {!Array.<string>}
|
370
403
|
* @see {@link DataView#getAllRowData}
|
371
404
|
* @see {@link DataView#getMultipleRowData}
|
405
|
+
* @see {@link DataView#getSortedRowIds}
|
406
|
+
* @see {@link DataView#getVisibleRowIds}
|
372
407
|
*/
|
373
408
|
DataView.prototype.getAllRowIds = function(shallowCopy, inclNonDataRow) {
|
374
409
|
this._rebuildRowIdsFromChildren();
|
@@ -378,17 +413,26 @@ DataView.prototype.getAllRowIds = function(shallowCopy, inclNonDataRow) {
|
|
378
413
|
|
379
414
|
return (shallowCopy) ? rids : rids.slice(0); // Fastest way to clone an array is Array.slice()
|
380
415
|
};
|
416
|
+
/** 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.
|
417
|
+
* @public
|
418
|
+
* @param {boolean=} shallowCopy=false If enabled, no new copy of Array is created (better for performance).
|
419
|
+
* @return {!Array.<string>}
|
420
|
+
* @see {@link DataView#getAllRowData}
|
421
|
+
*/
|
422
|
+
DataView.prototype.getVisibleRowIds = function(shallowCopy) {
|
423
|
+
this._rebuildRowIdsFromChildren();
|
424
|
+
var rids = this._getRids();
|
425
|
+
return shallowCopy ? rids : rids.slice(0); // Fastest way to clone an array
|
426
|
+
};
|
381
427
|
/** Return all data rows that is filtered and sorted, excluding header rows or paging. This method ignores pagination.
|
382
428
|
* @public
|
383
|
-
* @param {boolean=}
|
429
|
+
* @param {boolean=} shallowCopy=false If enabled, no new copy of Array is created (better for performance).
|
384
430
|
* @return {!Array.<string>}
|
431
|
+
* @see {@link DataView#getAllRowData}
|
385
432
|
*/
|
386
|
-
DataView.prototype.getSortedRowIds = function(
|
433
|
+
DataView.prototype.getSortedRowIds = function(shallowCopy) {
|
387
434
|
this._rebuildRowIdsFromChildren();
|
388
|
-
|
389
|
-
return this._rids;
|
390
|
-
}
|
391
|
-
return this._rids.slice(0); // Fastest way to clone an array
|
435
|
+
return shallowCopy ? this._rids : this._rids.slice(0); // Fastest way to clone an array
|
392
436
|
};
|
393
437
|
/** This method is quite slow
|
394
438
|
* @public
|
@@ -532,7 +576,7 @@ DataView.prototype.insertRow = function(rowRef, opt_values, opt_rid) { // Data c
|
|
532
576
|
return "";
|
533
577
|
};
|
534
578
|
|
535
|
-
/** Permanently remove the specified row by row id or DataView's row index. If you want to temporarily remove the row, use {@link DataView
|
579
|
+
/** Permanently remove the specified row by row id or DataView's row index. If you want to temporarily remove the row, use {@link DataView#hideRows} instead
|
536
580
|
* @public
|
537
581
|
* @param {number|string} rowRef
|
538
582
|
* @fires DataView#dataChanged
|
@@ -542,42 +586,30 @@ DataView.prototype.removeRow = function(rowRef) {
|
|
542
586
|
this._dt.removeRow(this._toRowId(rowRef)); // Trigger dataChanged
|
543
587
|
}
|
544
588
|
};
|
545
|
-
/** Permanently remove the specified rows by row id or DataView's row index. If you want to temporarily remove the rows, use {@link DataView
|
589
|
+
/** Permanently remove the specified rows by row id or DataView's row index. If you want to temporarily remove the rows, use {@link DataView#hideRows} instead
|
546
590
|
* @public
|
547
|
-
* @param {Array.<number|string>}
|
591
|
+
* @param {Array.<number|string>} rowRefs
|
548
592
|
*/
|
549
|
-
DataView.prototype.removeRows = function(
|
550
|
-
if(
|
551
|
-
|
552
|
-
var rowRef = refs[i];
|
553
|
-
if(typeof rowRef === "number") {
|
554
|
-
refs[i] = this.getRowId(rowRef);
|
555
|
-
}
|
593
|
+
DataView.prototype.removeRows = function(rowRefs) {
|
594
|
+
if(this._dt) {
|
595
|
+
this._dt.removeRows(this._toRowIds(rowRefs)); // Trigger dataChanged
|
556
596
|
}
|
557
|
-
this._dt.removeRows(refs); // Trigger dataChanged
|
558
597
|
};
|
559
|
-
/** Move a single row or multiple rows to the position BEFORE the specified
|
598
|
+
/** Move a single row or multiple rows to the position BEFORE the specified target row.
|
560
599
|
* @public
|
561
|
-
* @param {Array.<number>|number}
|
562
|
-
* @param {number}
|
600
|
+
* @param {Array.<number|string>|number|string} fromRef The value could be row index, row id, or array of row indices or row ids.
|
601
|
+
* @param {number|string} toRef Destination target could be row index or row id
|
563
602
|
* @return {Array.<string>|string} rid rowId or array of the rowId of the moved row(s)
|
564
603
|
* @example
|
565
604
|
* ary = [0, 1, 2];
|
566
605
|
* move(ary, 0, 1); // [0, 1, 2] Move index 0 to the position before index 1 (nothing is changed)
|
567
606
|
* move(ary, 1, 0); // [1, 0, 2] Move index 1 to the position before index 0
|
568
607
|
*/
|
569
|
-
DataView.prototype.moveRow = function(
|
570
|
-
this.
|
571
|
-
var rids = this._getRids();
|
608
|
+
DataView.prototype.moveRow = function(fromRef, toRef) {
|
609
|
+
var toRid = this._toRowId(toRef);
|
572
610
|
|
573
|
-
var
|
574
|
-
|
575
|
-
var fromIndices = /** @type{Array.<number>} */(Array.isArray(fromIndex) ? fromIndex : [fromIndex]);
|
576
|
-
var len = fromIndices.length;
|
577
|
-
var fromRids = new Array(len);
|
578
|
-
for(var i = 0; i < len; ++i) {
|
579
|
-
fromRids[i] = rids[fromIndices[i]];
|
580
|
-
}
|
611
|
+
var fromIndices = /** @type{!Array.<number|string>} */(Array.isArray(fromRef) ? fromRef : [fromRef]);
|
612
|
+
var fromRids = this._toRowIds(fromIndices);
|
581
613
|
|
582
614
|
if(this._dt.hasSegmentation()) {
|
583
615
|
this.synchronizeRowOrder();
|
@@ -611,7 +643,7 @@ DataView.prototype.getDataSource = function() {
|
|
611
643
|
return this._parent;
|
612
644
|
};
|
613
645
|
/** @public
|
614
|
-
* @param {DataTable|DataView=} source
|
646
|
+
* @param {(DataTable|DataView)=} source
|
615
647
|
* @fires DataView#dataChanged
|
616
648
|
*/
|
617
649
|
DataView.prototype.setDataSource = function(source) {
|
@@ -1095,7 +1127,7 @@ DataView.prototype.setPageSize = function (pageSize) {
|
|
1095
1127
|
this._dispatchGlobalChange();
|
1096
1128
|
};
|
1097
1129
|
|
1098
|
-
/**
|
1130
|
+
/** 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.
|
1099
1131
|
* @public
|
1100
1132
|
* @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)
|
1101
1133
|
* @param {Array=} opt_predefinedGroups
|
@@ -1606,6 +1638,17 @@ DataView.prototype.hide = function(opt_hidden) {
|
|
1606
1638
|
DataView.prototype.isHidden = function() {
|
1607
1639
|
return this._hidden;
|
1608
1640
|
};
|
1641
|
+
/** @public
|
1642
|
+
* @param {string} rowId
|
1643
|
+
* @return {boolean} Returns true when this row is hidden
|
1644
|
+
*/
|
1645
|
+
DataView.prototype.isHiddenRow = function(rowId) {
|
1646
|
+
if(this._hiddenRids) {
|
1647
|
+
return this._hiddenRids[rowId] === true;
|
1648
|
+
}
|
1649
|
+
return false;
|
1650
|
+
};
|
1651
|
+
|
1609
1652
|
/** @private
|
1610
1653
|
* @return {boolean}
|
1611
1654
|
*/
|
@@ -1714,14 +1757,7 @@ DataView.prototype._getFirstHiddenRids = function() {
|
|
1714
1757
|
}
|
1715
1758
|
return null;
|
1716
1759
|
};
|
1717
|
-
|
1718
|
-
* @public
|
1719
|
-
* @param {boolean=} opt_shallowCopy Default value is false. Set to true for speed
|
1720
|
-
* @return {!Array.<string>}
|
1721
|
-
*/
|
1722
|
-
DataView.prototype.getVisibleRowIds = function(opt_shallowCopy) {
|
1723
|
-
return this.getAllRowIds(opt_shallowCopy, true);
|
1724
|
-
};
|
1760
|
+
|
1725
1761
|
/** This will not include collapsed group and rows
|
1726
1762
|
* @public
|
1727
1763
|
* @return {number}
|
@@ -2454,6 +2490,95 @@ DataView.prototype.sortSegments = function (compare) {
|
|
2454
2490
|
this._dt.sortSegments(compare);
|
2455
2491
|
};
|
2456
2492
|
|
2493
|
+
/** @public
|
2494
|
+
* @ignore
|
2495
|
+
* @return {Object}
|
2496
|
+
*/
|
2497
|
+
DataView.prototype._getSharedObject = function () {
|
2498
|
+
return this._shared;
|
2499
|
+
};
|
2500
|
+
/** Return 0, if there is no wrapping
|
2501
|
+
* @public
|
2502
|
+
* @return {number}
|
2503
|
+
*/
|
2504
|
+
DataView.prototype.getWrapSize = function () {
|
2505
|
+
return this._wrapSize;
|
2506
|
+
};
|
2507
|
+
/** Return null, if there is no wrapping
|
2508
|
+
* @public
|
2509
|
+
* @return {Array.<WrappedView>}
|
2510
|
+
*/
|
2511
|
+
DataView.prototype.getWrappedViews = function () {
|
2512
|
+
return this._wrappedViews;
|
2513
|
+
};
|
2514
|
+
/**
|
2515
|
+
* @public
|
2516
|
+
* @param {number=} wrapSize
|
2517
|
+
* @fires DataView#wrapCountChanged
|
2518
|
+
*/
|
2519
|
+
DataView.prototype.wrapView = function (wrapSize) {
|
2520
|
+
if(wrapSize != null) {
|
2521
|
+
if(!wrapSize || wrapSize < 0) {
|
2522
|
+
wrapSize = 0;
|
2523
|
+
}
|
2524
|
+
if(this._wrapSize !== wrapSize) {
|
2525
|
+
this._wrapSize = wrapSize;
|
2526
|
+
this._dispatch("wrapSizeChanged", {
|
2527
|
+
"wrapSize": wrapSize,
|
2528
|
+
"rids": this.getVisibleRowIds(true)
|
2529
|
+
});
|
2530
|
+
}
|
2531
|
+
}
|
2532
|
+
this._updateWrapCount();
|
2533
|
+
};
|
2534
|
+
|
2535
|
+
/** @private
|
2536
|
+
* @fires DataView#wrapCountChanged
|
2537
|
+
*/
|
2538
|
+
DataView.prototype._updateWrapCount = function () {
|
2539
|
+
this._wrapTimerId = 0;
|
2540
|
+
var wrapSize = this._wrapSize;
|
2541
|
+
|
2542
|
+
var i;
|
2543
|
+
var views = this._wrappedViews;
|
2544
|
+
var viewCount = views ? views.length : 0;
|
2545
|
+
var targetCount = 0;
|
2546
|
+
if(wrapSize) {
|
2547
|
+
var rids = this.getVisibleRowIds(true);
|
2548
|
+
var rowCount = rids.length;
|
2549
|
+
targetCount = Math.ceil(rowCount / wrapSize);
|
2550
|
+
if(viewCount < targetCount) {
|
2551
|
+
if(!views) {
|
2552
|
+
views = this._wrappedViews = [];
|
2553
|
+
}
|
2554
|
+
for(i = viewCount; i < targetCount; ++i) {
|
2555
|
+
this._wrappedViews[i] = new WrappedView({
|
2556
|
+
"dataView": this,
|
2557
|
+
"wrapIndex": i,
|
2558
|
+
"rids": rids
|
2559
|
+
});
|
2560
|
+
}
|
2561
|
+
}
|
2562
|
+
}
|
2563
|
+
|
2564
|
+
if(targetCount < viewCount) {
|
2565
|
+
for(i = viewCount; --i >= targetCount;) {
|
2566
|
+
this._wrappedViews[i].dispose();
|
2567
|
+
}
|
2568
|
+
this._wrappedViews.length = targetCount;
|
2569
|
+
}
|
2570
|
+
if(!wrapSize) {
|
2571
|
+
this._wrappedViews = null;
|
2572
|
+
}
|
2573
|
+
|
2574
|
+
if(viewCount !== targetCount) {
|
2575
|
+
this._dispatch("wrapCountChanged", {
|
2576
|
+
"prevCount": viewCount,
|
2577
|
+
"newCount": targetCount
|
2578
|
+
});
|
2579
|
+
}
|
2580
|
+
};
|
2581
|
+
|
2457
2582
|
/** Construct a JSON object that is compatible with console.table()
|
2458
2583
|
* @public
|
2459
2584
|
* @param {Object=} opt_options {@link DataCache#dump}
|
@@ -3291,6 +3416,9 @@ DataView.prototype._dispatchGlobalChange = function() {
|
|
3291
3416
|
*/
|
3292
3417
|
DataView.prototype._dispatchDataChange = function(evtArgument) {
|
3293
3418
|
this._dispatch("dataChanged", evtArgument);
|
3419
|
+
if(this._wrapSize && !this._wrapTimerId) {
|
3420
|
+
this._wrapTimerId = setTimeout(this._updateWrapCount);
|
3421
|
+
}
|
3294
3422
|
};
|
3295
3423
|
|
3296
3424
|
/** @private
|
@@ -3648,7 +3776,6 @@ DataView._defaultGroupSortingLogic = function(strA, strB) {
|
|
3648
3776
|
return (strA < strB) ? -1 : 1;
|
3649
3777
|
};
|
3650
3778
|
|
3651
|
-
DataView._proto = DataView.prototype;
|
3652
3779
|
|
3653
3780
|
export default DataView;
|
3654
3781
|
export { DataView };
|