@refinitiv-ui/efx-grid 6.0.3 → 6.0.4
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-dragging/es6/ColumnDragging.d.ts +49 -0
- package/lib/column-dragging/es6/ColumnDragging.js +764 -0
- package/lib/column-dragging/es6/index.d.ts +1 -0
- package/lib/column-dragging/es6/index.js +1 -0
- package/lib/core/dist/core.css +1 -1
- package/lib/core/dist/core.js +389 -1070
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/ColumnStats.d.ts +2 -2
- package/lib/core/es6/data/DataCache.d.ts +4 -4
- package/lib/core/es6/data/DataTable.d.ts +5 -5
- package/lib/core/es6/data/DataTable.js +1 -1
- package/lib/core/es6/data/DataView.d.ts +12 -12
- package/lib/core/es6/data/SegmentCollection.d.ts +3 -3
- package/lib/core/es6/data/WrappedView.d.ts +13 -13
- package/lib/core/es6/grid/Core.d.ts +29 -27
- package/lib/core/es6/grid/Core.js +26 -4
- package/lib/core/es6/grid/ILayoutGrid.d.ts +15 -15
- package/lib/core/es6/grid/LayoutGrid.js +54 -26
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +66 -0
- package/lib/core/es6/grid/components/Cell.d.ts +4 -4
- package/lib/core/es6/grid/components/CellFloatingPanel.d.ts +1 -1
- package/lib/core/es6/grid/components/CellSpans.d.ts +8 -8
- package/lib/core/es6/grid/components/Column.d.ts +1 -1
- package/lib/core/es6/grid/components/ElementWrapper.d.ts +6 -6
- package/lib/core/es6/grid/components/Scrollbar.d.ts +1 -1
- package/lib/core/es6/grid/components/StretchedCells.js +2 -2
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +14 -6
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +147 -81
- package/lib/core/es6/grid/util/Conflator.d.ts +2 -2
- package/lib/core/es6/grid/util/ElementFrameWork.d.ts +3 -3
- package/lib/core/es6/grid/util/HttpRequest.d.ts +2 -2
- package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +1 -1
- package/lib/core/es6/grid/util/RangeBar.d.ts +1 -1
- package/lib/core/es6/grid/util/SectionSettings.d.ts +5 -5
- package/lib/core/es6/grid/util/SectionSettings.js +5 -0
- package/lib/core/es6/grid/util/SelectionList.d.ts +2 -2
- package/lib/core/es6/grid/util/TrackLayout.d.ts +7 -3
- package/lib/core/es6/grid/util/TrackLayout.js +27 -0
- package/lib/core/es6/grid/util/util.d.ts +2 -2
- package/lib/core/es6/index.d.ts +1 -5
- package/lib/core/es6/index.js +1 -7
- package/lib/core/es6/tr-grid-theme.js +1 -1
- package/lib/filter-dialog/lib/filter-dialog.d.ts +1 -0
- package/lib/filter-dialog/lib/filter-dialog.js +73 -26
- package/lib/filter-dialog/themes/base-checkbox.less +8 -1
- package/lib/filter-dialog/themes/base.less +69 -1
- package/lib/filter-dialog/themes/elemental/dark/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/elemental/dark/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/elemental/dark/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/elemental/light/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/elemental/light/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/elemental/light/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/halo/dark/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/halo/dark/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/halo/dark/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/halo/light/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/halo/light/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/halo/light/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/solar/charcoal/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/solar/charcoal/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/solar/charcoal/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/solar/pearl/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/solar/pearl/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/solar/pearl/filter-dialog.js +1 -1
- package/lib/grid/lib/efx-grid.d.ts +8 -5
- package/lib/grid/lib/efx-grid.js +10 -4
- 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 +33 -39
- 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/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/row-segmenting/es6/RowSegmenting.d.ts +7 -2
- package/lib/row-segmenting/es6/RowSegmenting.js +94 -9
- package/lib/rt-grid/dist/rt-grid.js +567 -1171
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +5 -3
- package/lib/rt-grid/es6/ColumnDefinition.js +17 -108
- package/lib/rt-grid/es6/DataConnector.d.ts +3 -3
- package/lib/rt-grid/es6/Grid.d.ts +17 -9
- package/lib/rt-grid/es6/Grid.js +201 -101
- package/lib/rt-grid/es6/RowDefSorter.d.ts +19 -0
- package/lib/rt-grid/es6/RowDefSorter.js +137 -0
- package/lib/rt-grid/es6/RowDefinition.d.ts +9 -7
- package/lib/rt-grid/es6/RowDefinition.js +6 -0
- package/lib/rt-grid/es6/SnapshotFiller.d.ts +3 -1
- package/lib/rt-grid/es6/SnapshotFiller.js +23 -0
- package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +2 -2
- package/lib/tr-grid-checkbox/es6/Checkbox.js +38 -20
- package/lib/tr-grid-column-selection/es6/ColumnSelection.js +46 -9
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +8 -4
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +240 -125
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +1 -1
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +18 -12
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +7 -4
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +93 -2
- package/lib/tr-grid-printer/es6/CellWriter.d.ts +3 -3
- package/lib/tr-grid-printer/es6/GridPrinter.d.ts +1 -1
- package/lib/tr-grid-printer/es6/GridPrinter.js +26 -13
- package/lib/tr-grid-printer/es6/PrintTrait.d.ts +2 -2
- package/lib/tr-grid-printer/es6/SectionWriter.d.ts +3 -3
- package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +2 -1
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +29 -143
- package/lib/tr-grid-row-grouping/es6/RowGrouping.d.ts +7 -2
- package/lib/tr-grid-row-grouping/es6/RowGrouping.js +97 -7
- package/lib/tr-grid-row-selection/es6/RowSelection.js +10 -0
- package/lib/tr-grid-textformatting/es6/TextFormatting.d.ts +1 -1
- package/lib/tr-grid-textformatting/es6/TextFormatting.js +12 -0
- package/lib/tr-grid-util/es6/DragUI.d.ts +16 -0
- package/lib/tr-grid-util/es6/DragUI.js +214 -0
- package/lib/tr-grid-util/es6/ElementObserver.d.ts +2 -0
- package/lib/tr-grid-util/es6/ElementObserver.js +28 -1
- package/lib/tr-grid-util/es6/ElfUtil.js +1 -1
- package/lib/tr-grid-util/es6/FieldFormatter.js +7 -5
- package/lib/tr-grid-util/es6/GridPlugin.js +8 -4
- package/lib/tr-grid-util/es6/NumberFormatter.d.ts +2 -0
- package/lib/tr-grid-util/es6/NumberFormatter.js +64 -19
- package/lib/tr-grid-util/es6/RowPainter.js +41 -11
- package/lib/tr-grid-util/es6/formula/Formula.js +9 -1
- package/lib/types/es6/Checkbox.d.ts +2 -2
- package/lib/types/es6/ColumnStack.d.ts +8 -4
- package/lib/types/es6/CompositeGrid/ColumnSelectionPlugin.d.ts +3 -2
- package/lib/types/es6/CompositeGrid/ColumnWidthAdjustingPlugin.d.ts +2 -1
- package/lib/types/es6/CompositeGrid/CompositeGrid.d.ts +20 -18
- package/lib/types/es6/CompositeGrid/DragAndDropTitlePlugin.d.ts +2 -1
- package/lib/types/es6/CompositeGrid/DraggableContentPlugin.d.ts +3 -2
- package/lib/types/es6/CompositeGrid/Plugin.d.ts +28 -0
- package/lib/types/es6/CompositeGrid/ResizableTitlePlugin.d.ts +2 -1
- package/lib/types/es6/CompositeGrid/RowSelectionPlugin.d.ts +5 -4
- package/lib/types/es6/CompositeGrid/TreeIndentingPlugin.d.ts +2 -1
- package/lib/types/es6/CompositeGrid/index.d.ts +9 -9
- package/lib/types/es6/ConditionalColoring.d.ts +1 -1
- package/lib/types/es6/Core/data/ColumnStats.d.ts +2 -2
- package/lib/types/es6/Core/data/DataCache.d.ts +4 -4
- package/lib/types/es6/Core/data/DataTable.d.ts +5 -5
- package/lib/types/es6/Core/data/DataView.d.ts +12 -12
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +3 -3
- package/lib/types/es6/Core/data/WrappedView.d.ts +13 -13
- package/lib/types/es6/Core/grid/Core.d.ts +29 -27
- package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +15 -15
- package/lib/types/es6/Core/grid/components/Cell.d.ts +4 -4
- package/lib/types/es6/Core/grid/components/CellFloatingPanel.d.ts +1 -1
- package/lib/types/es6/Core/grid/components/CellSpans.d.ts +8 -8
- package/lib/types/es6/Core/grid/components/Column.d.ts +1 -1
- package/lib/types/es6/Core/grid/components/ElementWrapper.d.ts +6 -6
- package/lib/types/es6/Core/grid/components/Scrollbar.d.ts +1 -1
- package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +14 -6
- package/lib/types/es6/Core/grid/util/Conflator.d.ts +2 -2
- package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +3 -3
- package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +2 -2
- package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +1 -1
- package/lib/types/es6/Core/grid/util/RangeBar.d.ts +1 -1
- package/lib/types/es6/Core/grid/util/SectionSettings.d.ts +5 -5
- package/lib/types/es6/Core/grid/util/SelectionList.d.ts +2 -2
- package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +7 -3
- package/lib/types/es6/Core/grid/util/util.d.ts +2 -2
- package/lib/types/es6/Core/index.d.ts +1 -5
- package/lib/types/es6/ExtensionOptions.d.ts +2 -0
- package/lib/types/es6/InCellEditing.d.ts +7 -4
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +5 -3
- package/lib/types/es6/RealtimeGrid/DataConnector.d.ts +3 -3
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +17 -9
- package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +19 -0
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +9 -7
- package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +3 -1
- package/lib/types/es6/RowDragging.d.ts +2 -1
- package/lib/types/es6/RowGrouping.d.ts +7 -2
- package/lib/types/es6/RowSegmenting.d.ts +7 -2
- package/lib/types/es6/TextFormatting.d.ts +1 -1
- package/lib/versions.json +14 -13
- package/package.json +1 -1
- package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.d.ts +0 -24
- package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.js +0 -615
- package/lib/core/es6/grid/plugins/Plugin.d.ts +0 -28
- package/lib/core/es6/grid/plugins/Plugin.js +0 -272
- package/lib/types/es6/Core/grid/plugins/DragAndDropTitlePlugin.d.ts +0 -24
- package/lib/types/es6/Core/grid/plugins/Plugin.d.ts +0 -28
@@ -3095,7 +3095,7 @@ ElfUtil._icons = {
|
|
3095
3095
|
"sortable": "sort-up-down"
|
3096
3096
|
},
|
3097
3097
|
"columnStack": {
|
3098
|
-
"stack": "
|
3098
|
+
"stack": "map-layers",
|
3099
3099
|
"expand": "right",
|
3100
3100
|
"collapse": "left"
|
3101
3101
|
}
|
@@ -9698,6 +9698,13 @@ Segment.prototype.removeAllChildren = function(objMap) {
|
|
9698
9698
|
Segment.prototype.getChildIds = function() {
|
9699
9699
|
return this._childCount ? Object.keys(this._children) : [];
|
9700
9700
|
};
|
9701
|
+
/** @public
|
9702
|
+
* @return {number}
|
9703
|
+
*/
|
9704
|
+
Segment.prototype.getChildCount = function() {
|
9705
|
+
return this._childCount;
|
9706
|
+
};
|
9707
|
+
|
9701
9708
|
|
9702
9709
|
|
9703
9710
|
/** @public
|
@@ -11036,7 +11043,7 @@ DataTable.prototype.setColumnSortingLogic = function(cid, func) {
|
|
11036
11043
|
* @example
|
11037
11044
|
* var prevState = dt.freeze();
|
11038
11045
|
* for(var i = 0; i < 100; ++i) {
|
11039
|
-
* dt.insertRow(
|
11046
|
+
* dt.insertRow(); // no event is fired
|
11040
11047
|
* }
|
11041
11048
|
* dt.freeze(prevState); // Restore previous freeze states
|
11042
11049
|
*/
|
@@ -11073,6 +11080,7 @@ DataTable.prototype.isFrozen = function() {
|
|
11073
11080
|
*/
|
11074
11081
|
DataTable.prototype.setSegmentSeparator = function(rid, enabled) {
|
11075
11082
|
var change = false;
|
11083
|
+
var memberCount = 0;
|
11076
11084
|
if(typeof rid === "string") {
|
11077
11085
|
if(enabled !== false) {
|
11078
11086
|
if(!this._segments) {
|
@@ -11082,16 +11090,20 @@ DataTable.prototype.setSegmentSeparator = function(rid, enabled) {
|
|
11082
11090
|
change = true;
|
11083
11091
|
}
|
11084
11092
|
} else if(this._segments) {
|
11085
|
-
|
11086
|
-
|
11087
|
-
|
11088
|
-
|
11093
|
+
var segment = this._segments.getSegment(rid);
|
11094
|
+
if(segment) {
|
11095
|
+
memberCount = segment.getChildCount();
|
11096
|
+
if(this._segments.removeSegment(rid)) {
|
11097
|
+
change = true;
|
11098
|
+
if(!this._segments.getSegmentCount()) {
|
11099
|
+
this._segments = null;
|
11100
|
+
}
|
11089
11101
|
}
|
11090
11102
|
}
|
11091
11103
|
}
|
11092
11104
|
}
|
11093
11105
|
if(change && this._needFiring()) {
|
11094
|
-
if(this._autoFillSegments()) {
|
11106
|
+
if(this._autoFillSegments() || memberCount) {
|
11095
11107
|
this.dispatchGlobalChange();
|
11096
11108
|
} else {
|
11097
11109
|
var rowData = this._rows[rid] || null;
|
@@ -11203,13 +11215,14 @@ DataTable.prototype._autoFillSegments = function() {
|
|
11203
11215
|
}
|
11204
11216
|
return false;
|
11205
11217
|
};
|
11206
|
-
/** Remove existing segment children and fill the segments with all
|
11218
|
+
/** Remove existing segment children and fill the segments with all content rows before the next segment separator
|
11207
11219
|
* @public
|
11208
11220
|
* @param {string} segmentId Row id
|
11209
11221
|
*/
|
11210
11222
|
DataTable.prototype.fillSegment = function(segmentId) {
|
11211
11223
|
if(this._segments) {
|
11212
11224
|
this._segments.fillSegment(segmentId, this._rids);
|
11225
|
+
this.dispatchGlobalChange();
|
11213
11226
|
}
|
11214
11227
|
};
|
11215
11228
|
/** Remove all existing segment children in each segment and fill the segments with all contnet rows before the next segment separator
|
@@ -11218,7 +11231,11 @@ DataTable.prototype.fillSegment = function(segmentId) {
|
|
11218
11231
|
*/
|
11219
11232
|
DataTable.prototype.fillSegments = function() {
|
11220
11233
|
if(this._segments) {
|
11221
|
-
|
11234
|
+
var dirty = this._segments.fillSegments(this._rids);
|
11235
|
+
if(dirty) {
|
11236
|
+
this.dispatchGlobalChange();
|
11237
|
+
}
|
11238
|
+
return dirty;
|
11222
11239
|
}
|
11223
11240
|
return false;
|
11224
11241
|
};
|
@@ -11263,7 +11280,11 @@ DataTable.prototype.addSegmentChildren = function(segmentId, rids) {
|
|
11263
11280
|
*/
|
11264
11281
|
DataTable.prototype.removeSegmentChild = function(segmentId, rid) {
|
11265
11282
|
if(this._segments) {
|
11266
|
-
|
11283
|
+
var dirty = this._segments.removeSegmentChild(segmentId, rid);
|
11284
|
+
if(dirty) {
|
11285
|
+
this.dispatchGlobalChange();
|
11286
|
+
}
|
11287
|
+
return dirty;
|
11267
11288
|
}
|
11268
11289
|
return false;
|
11269
11290
|
};
|
@@ -11274,7 +11295,11 @@ DataTable.prototype.removeSegmentChild = function(segmentId, rid) {
|
|
11274
11295
|
*/
|
11275
11296
|
DataTable.prototype.removeSegmentChildren = function(segmentId, rids) {
|
11276
11297
|
if(this._segments) {
|
11277
|
-
|
11298
|
+
var dirty = this._segments.removeSegmentChildren(segmentId, rids);
|
11299
|
+
if(dirty) {
|
11300
|
+
this.dispatchGlobalChange();
|
11301
|
+
}
|
11302
|
+
return dirty;
|
11278
11303
|
}
|
11279
11304
|
return false;
|
11280
11305
|
};
|
@@ -11283,7 +11308,11 @@ DataTable.prototype.removeSegmentChildren = function(segmentId, rids) {
|
|
11283
11308
|
*/
|
11284
11309
|
DataTable.prototype.removeAllSegmentChildren = function() {
|
11285
11310
|
if(this._segments) {
|
11286
|
-
|
11311
|
+
var dirty = this._segments.removeAllSegmentChildren();
|
11312
|
+
if (dirty) {
|
11313
|
+
this.dispatchGlobalChange();
|
11314
|
+
}
|
11315
|
+
return dirty;
|
11287
11316
|
}
|
11288
11317
|
return false;
|
11289
11318
|
};
|
@@ -12215,6 +12244,12 @@ RowDefinition.prototype.setDataSource = function(dataSource) {
|
|
12215
12244
|
// This will work for runtime row insertion, but not for first initilization.
|
12216
12245
|
this.subscribeForUpdates();
|
12217
12246
|
};
|
12247
|
+
/** @public
|
12248
|
+
* @return {DataCache} dataSource
|
12249
|
+
*/
|
12250
|
+
RowDefinition.prototype.getDataSource = function() {
|
12251
|
+
return this._dc;
|
12252
|
+
};
|
12218
12253
|
|
12219
12254
|
/** @public
|
12220
12255
|
* @return {Object} rowData
|
@@ -13337,16 +13372,12 @@ var _toAlignment = function(str) {
|
|
13337
13372
|
var ColumnDefinition = function(columnOption, hostGrid) {
|
13338
13373
|
this._defaultRenderer = this._defaultRenderer.bind(this);
|
13339
13374
|
this._customRenderer = this._customRenderer.bind(this);
|
13340
|
-
this._defaultSorter = this._defaultSorter.bind(this);
|
13341
|
-
this._dataSorter = this._dataSorter.bind(this);
|
13342
|
-
this._rowDefSorter = this._rowDefSorter.bind(this);
|
13343
13375
|
|
13344
13376
|
this._id = "" + ColumnDefinition._runningId++;
|
13345
13377
|
this._internalRenderer = this._defaultRenderer;
|
13346
13378
|
this._internalSorter = this._defaultSorter;
|
13347
13379
|
|
13348
13380
|
this._eventArg = {"colDef": this}; // WARNING: Circular reference
|
13349
|
-
this._sortContext = {"colDef": this};
|
13350
13381
|
if(hostGrid) {
|
13351
13382
|
this._updateContext("grid", hostGrid);
|
13352
13383
|
this._updateContext("core", hostGrid["getCoreGrid"]()); // TODO: Handle multiple core grids
|
@@ -13415,15 +13446,6 @@ ColumnDefinition.prototype._activatedRenderer = null;
|
|
13415
13446
|
* @private
|
13416
13447
|
*/
|
13417
13448
|
ColumnDefinition.prototype._rendererMap = null;
|
13418
|
-
/** @type {!Function}
|
13419
|
-
* @private
|
13420
|
-
*/
|
13421
|
-
ColumnDefinition.prototype._internalSorter;
|
13422
|
-
/** Workaround to provide user a context during the sorting process
|
13423
|
-
* @type {Object}
|
13424
|
-
* @private
|
13425
|
-
*/
|
13426
|
-
ColumnDefinition.prototype._sortContext = null;
|
13427
13449
|
/** @type {Function}
|
13428
13450
|
* @private
|
13429
13451
|
*/
|
@@ -13669,25 +13691,6 @@ ColumnDefinition.prototype.getRenderer = function() {
|
|
13669
13691
|
ColumnDefinition.prototype.getHeaderRenderer = function() {
|
13670
13692
|
return this._headerRenderer;
|
13671
13693
|
};
|
13672
|
-
/** @public
|
13673
|
-
* @return {!Function}
|
13674
|
-
*/
|
13675
|
-
ColumnDefinition.prototype.getSorter = function() {
|
13676
|
-
return this._internalSorter;
|
13677
|
-
};
|
13678
|
-
/** Internal method for preparing sort context
|
13679
|
-
* @public
|
13680
|
-
* @ignore
|
13681
|
-
* @param {number} colIndex
|
13682
|
-
* @return {!Function}
|
13683
|
-
*/
|
13684
|
-
ColumnDefinition.prototype._prepareSortContext = function(colIndex) {
|
13685
|
-
// TODO: Context does not get updated when column is moved or removed
|
13686
|
-
this._sortContext["colIndex"] = colIndex;
|
13687
|
-
this._sortContext["field"] = this._field;
|
13688
|
-
|
13689
|
-
return this._internalSorter;
|
13690
|
-
};
|
13691
13694
|
|
13692
13695
|
/** @public
|
13693
13696
|
* @return {string}
|
@@ -14085,21 +14088,27 @@ ColumnDefinition.prototype.activateRenderer = function(id, func) {
|
|
14085
14088
|
this.setRenderer(renderer);
|
14086
14089
|
return this._activatedRenderer ? true : false;
|
14087
14090
|
};
|
14091
|
+
|
14092
|
+
/** @public
|
14093
|
+
* @return {Function}
|
14094
|
+
*/
|
14095
|
+
ColumnDefinition.prototype.getSorter = function() {
|
14096
|
+
return this._userSorter;
|
14097
|
+
};
|
14088
14098
|
/** @public
|
14089
14099
|
* @param {ColumnDefinition~SortLogic=} func
|
14090
14100
|
*/
|
14091
14101
|
ColumnDefinition.prototype.setSorter = function(func) {
|
14092
|
-
|
14093
|
-
|
14094
|
-
|
14095
|
-
|
14096
|
-
|
14097
|
-
|
14098
|
-
|
14099
|
-
|
14100
|
-
this._userSorter = null;
|
14101
|
-
this._internalSorter = this._defaultSorter;
|
14102
|
+
this._userSorter = (typeof func === "function") ? func : null;
|
14103
|
+
};
|
14104
|
+
/** @public
|
14105
|
+
* @return {boolean}
|
14106
|
+
*/
|
14107
|
+
ColumnDefinition.prototype.isRowSorting = function() {
|
14108
|
+
if(this._rowSorting == null) {
|
14109
|
+
return !this._realTimeField;
|
14102
14110
|
}
|
14111
|
+
return this._rowSorting ? true : false;
|
14103
14112
|
};
|
14104
14113
|
|
14105
14114
|
/** To allow user change column name in run-time (language change or localization)
|
@@ -14218,78 +14227,13 @@ ColumnDefinition.prototype._customRenderer = function(e) {
|
|
14218
14227
|
}
|
14219
14228
|
}
|
14220
14229
|
};
|
14221
|
-
/** @private
|
14222
|
-
* @param {RowDefinition} rowDefA
|
14223
|
-
* @param {RowDefinition} rowDefB
|
14224
|
-
* @param {number} order
|
14225
|
-
* @return {number}
|
14226
|
-
*/
|
14227
|
-
ColumnDefinition.prototype._defaultSorter = function(rowDefA, rowDefB, order) {
|
14228
|
-
var orderA = rowDefA.getGroupOrder();
|
14229
|
-
var orderB = rowDefB.getGroupOrder();
|
14230
|
-
if(orderA !== orderB) {
|
14231
|
-
return orderA - orderB; // Regardless of sort order
|
14232
|
-
}
|
14233
|
-
|
14234
|
-
var a = rowDefA.getData(this._field);
|
14235
|
-
var b = rowDefB.getData(this._field);
|
14236
|
-
|
14237
|
-
if(a == null || a !== a) {
|
14238
|
-
if(b == null || b !== b) {
|
14239
|
-
return 0;
|
14240
|
-
}
|
14241
|
-
return 1;
|
14242
|
-
}
|
14243
|
-
if(b == null || b !== b) {
|
14244
|
-
return -1;
|
14245
|
-
}
|
14246
14230
|
|
14247
|
-
if(a < b) {
|
14248
|
-
return -order;
|
14249
|
-
}
|
14250
|
-
if(b < a) {
|
14251
|
-
return order;
|
14252
|
-
}
|
14253
|
-
return 0;
|
14254
|
-
};
|
14255
|
-
/** @private
|
14256
|
-
* @param {RowDefinition} rowDefA
|
14257
|
-
* @param {RowDefinition} rowDefB
|
14258
|
-
* @param {number} order
|
14259
|
-
* @return {number}
|
14260
|
-
*/
|
14261
|
-
ColumnDefinition.prototype._dataSorter = function(rowDefA, rowDefB, order) {
|
14262
|
-
var orderA = rowDefA.getGroupOrder();
|
14263
|
-
var orderB = rowDefB.getGroupOrder();
|
14264
|
-
if(orderA !== orderB) {
|
14265
|
-
return orderA - orderB; // Regardless of sort order
|
14266
|
-
}
|
14267
|
-
|
14268
|
-
var a = rowDefA.getData(this._field);
|
14269
|
-
var b = rowDefB.getData(this._field);
|
14270
|
-
return this._userSorter(a, b, order, this._sortContext);
|
14271
|
-
};
|
14272
|
-
/** @private
|
14273
|
-
* @param {RowDefinition} rowDefA
|
14274
|
-
* @param {RowDefinition} rowDefB
|
14275
|
-
* @param {number} order
|
14276
|
-
* @return {number}
|
14277
|
-
*/
|
14278
|
-
ColumnDefinition.prototype._rowDefSorter = function(rowDefA, rowDefB, order) {
|
14279
|
-
var orderA = rowDefA.getGroupOrder();
|
14280
|
-
var orderB = rowDefB.getGroupOrder();
|
14281
|
-
if(orderA !== orderB) {
|
14282
|
-
return orderA - orderB; // Regardless of sort order
|
14283
|
-
}
|
14284
|
-
|
14285
|
-
return this._userSorter(rowDefA, rowDefB, order, this._sortContext);
|
14286
|
-
};
|
14287
14231
|
/** @private
|
14288
14232
|
* @param {string} propName
|
14289
14233
|
* @param {*} val
|
14290
14234
|
*/
|
14291
14235
|
ColumnDefinition.prototype._updateContext = function(propName, val) {
|
14292
|
-
this._eventArg[propName] =
|
14236
|
+
this._eventArg[propName] = val;
|
14293
14237
|
};
|
14294
14238
|
|
14295
14239
|
/** @public
|
@@ -14379,6 +14323,26 @@ SnapshotFiller.prototype.addRic = function (ric) {
|
|
14379
14323
|
}
|
14380
14324
|
};
|
14381
14325
|
/** @public
|
14326
|
+
* @param {Array.<string>} rics
|
14327
|
+
* @return {boolean}
|
14328
|
+
*/
|
14329
|
+
SnapshotFiller.prototype.addRics = function (rics) {
|
14330
|
+
var len = rics ? rics.length : 0;
|
14331
|
+
var dirty = false;
|
14332
|
+
for(var i = 0; i < len; ++i) {
|
14333
|
+
var ric = rics[i];
|
14334
|
+
if (ric && !this._rics[ric]) {
|
14335
|
+
this._rics[ric] = 1;
|
14336
|
+
dirty = true;
|
14337
|
+
}
|
14338
|
+
}
|
14339
|
+
if(dirty) {
|
14340
|
+
this._request();
|
14341
|
+
return true;
|
14342
|
+
}
|
14343
|
+
return false;
|
14344
|
+
};
|
14345
|
+
/** @public
|
14382
14346
|
* @param {string} str
|
14383
14347
|
*/
|
14384
14348
|
SnapshotFiller.prototype.addField = function (str) {
|
@@ -14388,6 +14352,7 @@ SnapshotFiller.prototype.addField = function (str) {
|
|
14388
14352
|
};
|
14389
14353
|
/** @public
|
14390
14354
|
* @param {Array.<string>} fields
|
14355
|
+
* @return {boolean}
|
14391
14356
|
*/
|
14392
14357
|
SnapshotFiller.prototype.addFields = function (fields) {
|
14393
14358
|
var len = fields.length;
|
@@ -14397,7 +14362,9 @@ SnapshotFiller.prototype.addFields = function (fields) {
|
|
14397
14362
|
}
|
14398
14363
|
if(dirty) {
|
14399
14364
|
this._request();
|
14365
|
+
return true;
|
14400
14366
|
}
|
14367
|
+
return false;
|
14401
14368
|
};
|
14402
14369
|
|
14403
14370
|
/** @private
|
@@ -17880,10 +17847,16 @@ Column.prototype.show = function (opt_shown) {
|
|
17880
17847
|
*/
|
17881
17848
|
Column.prototype.setWidth = function (val) {
|
17882
17849
|
this._element.style.width = val + "px";
|
17883
|
-
var magnitude =
|
17884
|
-
if(
|
17850
|
+
var magnitude = 0;
|
17851
|
+
if(val > 0 && val <= 24){
|
17885
17852
|
magnitude = 3;
|
17886
17853
|
}
|
17854
|
+
else if(val > 24 && val <= 40){
|
17855
|
+
magnitude = 2;
|
17856
|
+
}
|
17857
|
+
else if(val > 40 && val < 60){
|
17858
|
+
magnitude = 1;
|
17859
|
+
}
|
17887
17860
|
|
17888
17861
|
var i;
|
17889
17862
|
var sc = this._sizeClasses;
|
@@ -25431,7 +25404,7 @@ WrappedView.prototype.addRowExpansion = function(rid, count) {
|
|
25431
25404
|
* @param {string} rid Row Id
|
25432
25405
|
*/
|
25433
25406
|
WrappedView.prototype.removeRowExpansion = function(rid) {
|
25434
|
-
this._dv.removeRowExpansion(rid
|
25407
|
+
this._dv.removeRowExpansion(rid);
|
25435
25408
|
};
|
25436
25409
|
/**
|
25437
25410
|
* @public
|
@@ -25638,7 +25611,7 @@ WrappedView.prototype.setSegmentCollapsingLogic = function() {};
|
|
25638
25611
|
*/
|
25639
25612
|
WrappedView.prototype.isSegmentCollapsed = function(rowRef) {
|
25640
25613
|
var rid = this._toRowId(rowRef);
|
25641
|
-
return this._dv.isSegmentCollapsed(rid
|
25614
|
+
return this._dv.isSegmentCollapsed(rid);
|
25642
25615
|
};
|
25643
25616
|
/** Remove existing segment children and fill the segments with all contnet rows before the next segment separator
|
25644
25617
|
* @public
|
@@ -25671,8 +25644,8 @@ WrappedView.prototype.addSegmentChild = function(segmentRef, rowRef) {
|
|
25671
25644
|
*/
|
25672
25645
|
WrappedView.prototype.addSegmentChildren = function(segmentRef, rowRefs) {
|
25673
25646
|
var segmentId = this._toRowId(segmentRef);
|
25674
|
-
var
|
25675
|
-
return this._dv.addSegmentChildren(segmentId,
|
25647
|
+
var rowIds = this._toRowIds(rowRefs);
|
25648
|
+
return this._dv.addSegmentChildren(segmentId, rowIds);
|
25676
25649
|
};
|
25677
25650
|
/** @public
|
25678
25651
|
* @param {string|number} segmentRef Row id or row index
|
@@ -25691,8 +25664,8 @@ WrappedView.prototype.removeSegmentChild = function(segmentRef, rowRef) {
|
|
25691
25664
|
*/
|
25692
25665
|
WrappedView.prototype.removeSegmentChildren = function(segmentRef, rowRefs) {
|
25693
25666
|
var segmentId = this._toRowId(segmentRef);
|
25694
|
-
var
|
25695
|
-
return this._dv.removeSegmentChildren(segmentId,
|
25667
|
+
var rowIds = this._toRowIds(rowRefs);
|
25668
|
+
return this._dv.removeSegmentChildren(segmentId, rowIds);
|
25696
25669
|
};
|
25697
25670
|
/** @public
|
25698
25671
|
* @return {boolean} Return true if there is any change
|
@@ -25801,10 +25774,6 @@ WrappedView.prototype.isRowFiltered = function(rid, rowData) {
|
|
25801
25774
|
|
25802
25775
|
|
25803
25776
|
|
25804
|
-
/** @typedef {DataTable|WrappedView|DataView} DataView~IDataView
|
25805
|
-
* @description DataView like classes
|
25806
|
-
*/
|
25807
|
-
|
25808
25777
|
/** @event DataView#dataChanged
|
25809
25778
|
* @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.
|
25810
25779
|
* @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.
|
@@ -30996,6 +30965,11 @@ Ext["b" /* default */].inherits(VirtualizedLayoutGrid, components_ElementWrapper
|
|
30996
30965
|
*/
|
30997
30966
|
VirtualizedLayoutGrid.prototype._index = -1;
|
30998
30967
|
|
30968
|
+
/** Number of rows offsetting from the first section
|
30969
|
+
* @private
|
30970
|
+
* @type {number}
|
30971
|
+
*/
|
30972
|
+
VirtualizedLayoutGrid.prototype._rowOffset = 0;
|
30999
30973
|
/** For virtualization in Y-Axis
|
31000
30974
|
* @private
|
31001
30975
|
* @type {number}
|
@@ -32640,7 +32614,7 @@ Core.prototype._preserveGridSize = false;
|
|
32640
32614
|
* @return {string}
|
32641
32615
|
*/
|
32642
32616
|
Core.getVersion = function () {
|
32643
|
-
return "5.0.
|
32617
|
+
return "5.0.55";
|
32644
32618
|
};
|
32645
32619
|
/** {@link ElementWrapper#dispose}
|
32646
32620
|
* @override
|
@@ -32959,6 +32933,10 @@ Core.prototype.addSectionAt = function (at, opt_type, opt_sectionName) {
|
|
32959
32933
|
}
|
32960
32934
|
|
32961
32935
|
this._updateSectionIndices(at);
|
32936
|
+
if (this._autoSetDataSource) {
|
32937
|
+
// This could trigger data binding and column virtualization
|
32938
|
+
sectionSettings.setDataSource(this._dataSource);
|
32939
|
+
}
|
32962
32940
|
|
32963
32941
|
sectType = sectionSettings.getType();
|
32964
32942
|
if (sectType === "footer") {
|
@@ -36181,9 +36159,6 @@ Core.prototype._newSection = function (opt_type, sectionName) {
|
|
36181
36159
|
section.listen("rowCountChanged", this._onRowCountChanged);
|
36182
36160
|
section.listen("rowHeightChanged", this._onRowHeightChanged);
|
36183
36161
|
|
36184
|
-
if (this._autoSetDataSource) {
|
36185
|
-
sectionSettings.setDataSource(this._dataSource);
|
36186
|
-
}
|
36187
36162
|
return sectionSettings;
|
36188
36163
|
};
|
36189
36164
|
|
@@ -36474,7 +36449,12 @@ Core.prototype._removeColumn = function (num) { // TODO: change the logic to us
|
|
36474
36449
|
*/
|
36475
36450
|
Core.prototype._onSectionDataChanged = function (e) {
|
36476
36451
|
if(this._dispatchingDataChanged) { return; } // Prevent infinite loop
|
36477
|
-
|
36452
|
+
|
36453
|
+
var colCount = this._layoutX.getLaneCount();
|
36454
|
+
this._dispatchingDataChanged = colCount ? true : false;
|
36455
|
+
if(!colCount) {
|
36456
|
+
return;
|
36457
|
+
}
|
36478
36458
|
|
36479
36459
|
var fromR = /** @type{number} */(e["fromRowIndex"]);
|
36480
36460
|
var toR = /** @type{number} */(e["toRowIndex"]);
|
@@ -36489,7 +36469,6 @@ Core.prototype._onSectionDataChanged = function (e) {
|
|
36489
36469
|
}
|
36490
36470
|
this._dispatch("preSectionDataBinding", e);
|
36491
36471
|
|
36492
|
-
var colCount = this._layoutX.getLaneCount();
|
36493
36472
|
var dataMap = this.getDataColumnMap();
|
36494
36473
|
for (var c = 0; c < colCount; ++c) {
|
36495
36474
|
if(section["isColumnActive"](c) && (this.isColumnVisible(c) || this._isAlwaysRenderColumn(c))) {
|
@@ -36595,6 +36574,9 @@ Core.prototype._onRowInViewChanged = function (e) { // Triggered from virtualize
|
|
36595
36574
|
* @param {Object} e
|
36596
36575
|
*/
|
36597
36576
|
Core.prototype._onColInViewChanged = function (e) {
|
36577
|
+
if(!this.getColumnCount()) {
|
36578
|
+
return; // No column for activation and no cell to be rendered
|
36579
|
+
}
|
36598
36580
|
var pfi = e["prevFirstIndex"];
|
36599
36581
|
var pli = e["prevLastIndex"]; // INCLUSIVE
|
36600
36582
|
var fi = e["firstIndex"];
|
@@ -36910,7 +36892,7 @@ Core.prototype._onColumnCountChanged = function () {
|
|
36910
36892
|
// TODO: Optimize these methods during initialization
|
36911
36893
|
var pinnedLeft = this._countPinnedLeftColumns();
|
36912
36894
|
var pinnedRight = this._countPinnedRightColumns();
|
36913
|
-
|
36895
|
+
|
36914
36896
|
this._updateColumnBounds();
|
36915
36897
|
|
36916
36898
|
if (this._hScrollbarEnabled && pinnedLeft + pinnedRight < this.getColumnCount()) {
|
@@ -37850,279 +37832,144 @@ DataConnector.prototype.reset = function () {
|
|
37850
37832
|
|
37851
37833
|
/* harmony default export */ var js_DataConnector = (DataConnector);
|
37852
37834
|
|
37853
|
-
// CONCATENATED MODULE: ./
|
37854
|
-
|
37855
|
-
|
37856
|
-
|
37835
|
+
// CONCATENATED MODULE: ./src/js/RowDefSorter.js
|
37836
|
+
/** @constructor
|
37837
|
+
*/
|
37838
|
+
var RowDefSorter = function() {
|
37839
|
+
this._defaultSorter = this._defaultSorter.bind(this);
|
37840
|
+
this._dataSorter = this._dataSorter.bind(this);
|
37841
|
+
this._rowDefSorter = this._rowDefSorter.bind(this);
|
37857
37842
|
|
37858
|
-
|
37843
|
+
this._sortContext = {};
|
37844
|
+
};
|
37859
37845
|
|
37860
37846
|
|
37861
|
-
/**
|
37862
|
-
* @
|
37863
|
-
* @extends {EventDispatcher}
|
37847
|
+
/** @type {string}
|
37848
|
+
* @private
|
37864
37849
|
*/
|
37865
|
-
|
37866
|
-
|
37867
|
-
|
37868
|
-
Ext["b" /* default */].inherits(Plugin, event_EventDispatcher); // Inherits() will replace prototype of the derived object
|
37869
|
-
|
37870
|
-
//#region Public Methods
|
37871
|
-
/**The name must be readonly and unique among all other plugins
|
37872
|
-
* @public
|
37873
|
-
* @return {string}
|
37850
|
+
RowDefSorter.prototype._field = "";
|
37851
|
+
/** @type {!Object}
|
37852
|
+
* @private
|
37874
37853
|
*/
|
37875
|
-
|
37876
|
-
|
37877
|
-
|
37854
|
+
RowDefSorter.prototype._sortContext;
|
37855
|
+
/** @type {Function}
|
37856
|
+
* @private
|
37857
|
+
*/
|
37858
|
+
RowDefSorter.prototype._sortLogic = null;
|
37859
|
+
|
37878
37860
|
|
37879
37861
|
/** @public
|
37880
|
-
* @param {!Core} owner
|
37881
|
-
*/
|
37882
|
-
Plugin.prototype.initialize = function (owner) {
|
37883
|
-
this._host = owner;
|
37884
|
-
};
|
37885
|
-
/**For disposing any resource
|
37886
|
-
* @public
|
37887
|
-
* @param {!Core} owner
|
37888
37862
|
*/
|
37889
|
-
|
37890
|
-
this.
|
37891
|
-
this.
|
37863
|
+
RowDefSorter.prototype.dispose = function() {
|
37864
|
+
this._sortLogic = null;
|
37865
|
+
this._sortContext = {}; // Clear any existing reference
|
37892
37866
|
};
|
37893
37867
|
|
37894
37868
|
/** @public
|
37895
|
-
* @param {
|
37896
|
-
* @return {
|
37869
|
+
* @param {boolean=} rowSorting=false
|
37870
|
+
* @return {Function}
|
37897
37871
|
*/
|
37898
|
-
|
37899
|
-
|
37900
|
-
|
37901
|
-
|
37902
|
-
|
37903
|
-
if(gridAPI && gridAPI["getCoreGrid"]) {
|
37904
|
-
return /** @type{Core} */(gridAPI["getCoreGrid"]());
|
37905
|
-
}
|
37906
|
-
} else if(e["getElement"]) { // The Given object is implementing ElementWrapper
|
37907
|
-
targetEl = e["getElement"]();
|
37908
|
-
} else if(util.isElement(e)){ // The Given object is just an element
|
37909
|
-
targetEl = /** @type{Element} */(e);
|
37910
|
-
}
|
37911
|
-
|
37912
|
-
var gridEl = (targetEl) ? util.closestElement(targetEl, "tr-grid") : null;
|
37913
|
-
if(gridEl) {
|
37914
|
-
if(this._host) {
|
37915
|
-
if(this._host.getElement() === gridEl) {
|
37916
|
-
return this._host;
|
37917
|
-
}
|
37918
|
-
} else {
|
37919
|
-
var hostLength = this._hosts ? this._hosts.length : 0;
|
37920
|
-
for (var i = 0; i < hostLength; i++) {
|
37921
|
-
var host = this._hosts[i];
|
37922
|
-
if (host.getElement() === gridEl) {
|
37923
|
-
return host;
|
37924
|
-
}
|
37925
|
-
}
|
37926
|
-
}
|
37872
|
+
RowDefSorter.prototype.getSorter = function(rowSorting) {
|
37873
|
+
if(this._sortLogic) {
|
37874
|
+
return rowSorting ? this._rowDefSorter : this._dataSorter;
|
37875
|
+
} else {
|
37876
|
+
return this._defaultSorter;
|
37927
37877
|
}
|
37928
|
-
|
37929
|
-
return null;
|
37930
37878
|
};
|
37931
|
-
/**
|
37932
|
-
* @
|
37933
|
-
* @param {number} x
|
37934
|
-
* @param {number} y
|
37935
|
-
* @return {Element}
|
37879
|
+
/** @public
|
37880
|
+
* @param {Function=} func
|
37936
37881
|
*/
|
37937
|
-
|
37938
|
-
|
37939
|
-
var grid = util.closestElement(elem, "tr-grid");
|
37940
|
-
|
37941
|
-
// Some elements are over grid element, hide them all by setting the visibility to hidden
|
37942
|
-
var skipElem = [];
|
37943
|
-
var skipVisibility = [];
|
37944
|
-
while (!grid && elem && elem.tagName != "HTML") {
|
37945
|
-
skipElem.push(elem);
|
37946
|
-
skipVisibility.push(elem.style.visibility);
|
37947
|
-
elem.style.visibility = "hidden";
|
37948
|
-
elem = document.elementFromPoint(x, y);
|
37949
|
-
|
37950
|
-
grid = util.closestElement(elem, "tr-grid");
|
37951
|
-
}
|
37952
|
-
for (var i = 0; i < skipElem.length; i++) {
|
37953
|
-
skipElem[i].style.visibility = skipVisibility[i];
|
37954
|
-
}
|
37955
|
-
return grid;
|
37882
|
+
RowDefSorter.prototype.setSortLogic = function(func) {
|
37883
|
+
this._sortLogic = (typeof func === "function") ? func : null;
|
37956
37884
|
};
|
37957
37885
|
|
37958
|
-
//#endregion Public Methods
|
37959
37886
|
|
37960
|
-
|
37961
|
-
|
37962
|
-
* @ignore
|
37963
|
-
* @return {Array.<string>}
|
37887
|
+
/** @public
|
37888
|
+
* @param {string} field
|
37964
37889
|
*/
|
37965
|
-
|
37966
|
-
if
|
37967
|
-
|
37968
|
-
if (this._host) {
|
37969
|
-
return this._host.getDataColumnMap();
|
37970
|
-
}
|
37971
|
-
if (this._hosts && this._hosts[0]) {
|
37972
|
-
return this._hosts[0].getDataColumnMap();
|
37890
|
+
RowDefSorter.prototype.setField = function(field) {
|
37891
|
+
if(!field) {
|
37892
|
+
field = "";
|
37973
37893
|
}
|
37974
|
-
|
37894
|
+
this._sortContext["field"] = this._field = field;
|
37895
|
+
this._sortContext["formattedField"] = field + "_FORMATTED";
|
37975
37896
|
};
|
37976
|
-
/** @
|
37977
|
-
|
37978
|
-
|
37979
|
-
|
37980
|
-
|
37981
|
-
|
37982
|
-
var dataMap = this._getDataColumnMap();
|
37983
|
-
if(dataMap){
|
37984
|
-
return dataMap[colIndex] || "";
|
37985
|
-
}
|
37986
|
-
return "";
|
37897
|
+
/** @public
|
37898
|
+
* @param {string} key
|
37899
|
+
* @param {*} value
|
37900
|
+
*/
|
37901
|
+
RowDefSorter.prototype.setContext = function(key, value) {
|
37902
|
+
this._sortContext[key] = value;
|
37987
37903
|
};
|
37988
37904
|
|
37989
|
-
/** @
|
37990
|
-
* @
|
37991
|
-
* @param {
|
37992
|
-
* @
|
37905
|
+
/** @private
|
37906
|
+
* @param {RowDefinition} rowDefA
|
37907
|
+
* @param {RowDefinition} rowDefB
|
37908
|
+
* @param {number} order
|
37909
|
+
* @return {number}
|
37993
37910
|
*/
|
37994
|
-
|
37995
|
-
|
37996
|
-
|
37911
|
+
RowDefSorter.prototype._defaultSorter = function(rowDefA, rowDefB, order) {
|
37912
|
+
var orderA = rowDefA.getGroupOrder();
|
37913
|
+
var orderB = rowDefB.getGroupOrder();
|
37914
|
+
if(orderA !== orderB) {
|
37915
|
+
return orderA - orderB; // Regardless of sort order
|
37997
37916
|
}
|
37998
|
-
|
37999
|
-
|
38000
|
-
|
38001
|
-
|
38002
|
-
|
38003
|
-
|
38004
|
-
|
38005
|
-
|
38006
|
-
return;
|
37917
|
+
|
37918
|
+
var a = rowDefA.getData(this._field);
|
37919
|
+
var b = rowDefB.getData(this._field);
|
37920
|
+
|
37921
|
+
if(a == null || a !== a) {
|
37922
|
+
if(b == null || b !== b) {
|
37923
|
+
return 0;
|
37924
|
+
}
|
37925
|
+
return 1;
|
38007
37926
|
}
|
38008
|
-
if
|
38009
|
-
|
38010
|
-
util.insertArrayItem(this._colData, colIndex, null);
|
38011
|
-
util.insertArrayItem(this._dataMap, colIndex, null);
|
38012
|
-
};
|
38013
|
-
/** @protected
|
38014
|
-
* @ignore
|
38015
|
-
* @param {Object} e
|
38016
|
-
*/
|
38017
|
-
Plugin.prototype._onColumnMoved = function (e) {
|
38018
|
-
if (this._isNotFirstHost(e)) {
|
38019
|
-
return;
|
37927
|
+
if(b == null || b !== b) {
|
37928
|
+
return -1;
|
38020
37929
|
}
|
38021
|
-
var from = /** @type{number} */(e["fromColIndex"]);
|
38022
|
-
var to = /** @type{number} */(e["toColIndex"]);
|
38023
37930
|
|
38024
|
-
|
38025
|
-
|
38026
|
-
};
|
38027
|
-
/** @protected
|
38028
|
-
* @ignore
|
38029
|
-
* @param {Object} e
|
38030
|
-
*/
|
38031
|
-
Plugin.prototype._onColumnRemoved = function (e) {
|
38032
|
-
if (this._isNotFirstHost(e)) {
|
38033
|
-
return;
|
38034
|
-
}
|
38035
|
-
if (!e["atTheMiddle"]) { return; }
|
38036
|
-
var colIndex = /** @type{number} */(e["colIndex"]);
|
38037
|
-
if(this._colData) {
|
38038
|
-
this._colData.splice(colIndex, 1);
|
37931
|
+
if(a < b) {
|
37932
|
+
return -order;
|
38039
37933
|
}
|
38040
|
-
if(
|
38041
|
-
|
37934
|
+
if(b < a) {
|
37935
|
+
return order;
|
38042
37936
|
}
|
37937
|
+
return 0;
|
38043
37938
|
};
|
38044
|
-
|
38045
|
-
|
38046
|
-
|
38047
|
-
* @
|
37939
|
+
/** @private
|
37940
|
+
* @param {RowDefinition} rowDefA
|
37941
|
+
* @param {RowDefinition} rowDefB
|
37942
|
+
* @param {number} order
|
38048
37943
|
* @return {number}
|
38049
|
-
*/
|
38050
|
-
Plugin.prototype._getColumnCount = function() {
|
38051
|
-
var host = this._host || this._hosts[0];
|
38052
|
-
return (host) ? host.getColumnCount() : 0;
|
38053
|
-
};
|
38054
|
-
/** @protected
|
38055
|
-
* @ignore
|
38056
|
-
* @param {string} pluginName
|
38057
|
-
* @return {*|null}
|
38058
|
-
*/
|
38059
|
-
Plugin.prototype._getPlugin = function(pluginName) {
|
38060
|
-
var host = this._host || this._hosts[0];
|
38061
|
-
return (host) ? host.getPlugin(pluginName) : null;
|
38062
|
-
};
|
38063
|
-
|
38064
|
-
/** @protected
|
38065
|
-
* @ignore
|
38066
|
-
* @param {number} scrollVal
|
38067
|
-
*/
|
38068
|
-
Plugin.prototype._scrollDown = function (scrollVal) {
|
38069
|
-
var host = this._host || this._hosts[0];
|
38070
|
-
host.scrollDown(scrollVal);
|
38071
|
-
};
|
38072
|
-
/** @protected
|
38073
|
-
* @ignore
|
38074
|
-
* @param {number} rowIndex
|
38075
37944
|
*/
|
38076
|
-
|
38077
|
-
var
|
38078
|
-
|
38079
|
-
|
38080
|
-
|
38081
|
-
* @ignore
|
38082
|
-
* @param {number} scrollVal
|
38083
|
-
*/
|
38084
|
-
Plugin.prototype._scrollRight = function (scrollVal) {
|
38085
|
-
if(this._host) {
|
38086
|
-
this._host.scrollRight(scrollVal);
|
38087
|
-
} else if(this._hosts) {
|
38088
|
-
var len = this._hosts.length;
|
38089
|
-
for(var i = 0; i < len; ++i) {
|
38090
|
-
var host = this._hosts[i];
|
38091
|
-
host.scrollRight(scrollVal);
|
38092
|
-
}
|
37945
|
+
RowDefSorter.prototype._dataSorter = function(rowDefA, rowDefB, order) {
|
37946
|
+
var orderA = rowDefA.getGroupOrder();
|
37947
|
+
var orderB = rowDefB.getGroupOrder();
|
37948
|
+
if(orderA !== orderB) {
|
37949
|
+
return orderA - orderB; // Regardless of sort order
|
38093
37950
|
}
|
38094
|
-
};
|
38095
|
-
|
38096
|
-
//#endregion Protected Methods
|
38097
|
-
|
38098
|
-
//#region Protected Fields
|
38099
|
-
/** @protected
|
38100
|
-
* @ignore
|
38101
|
-
* @type {Core}
|
38102
|
-
*/
|
38103
|
-
Plugin.prototype._host = null;
|
38104
|
-
/** @protected
|
38105
|
-
* @ignore
|
38106
|
-
* @type {Array.<Core>}
|
38107
|
-
*/
|
38108
|
-
Plugin.prototype._hosts = null; // For a plug-in that support multi-table
|
38109
37951
|
|
38110
|
-
|
38111
|
-
|
38112
|
-
|
38113
|
-
|
38114
|
-
|
38115
|
-
|
38116
|
-
* @
|
38117
|
-
* @
|
37952
|
+
var a = rowDefA.getData(this._field);
|
37953
|
+
var b = rowDefB.getData(this._field);
|
37954
|
+
return this._sortLogic(a, b, order, this._sortContext);
|
37955
|
+
};
|
37956
|
+
/** @private
|
37957
|
+
* @param {RowDefinition} rowDefA
|
37958
|
+
* @param {RowDefinition} rowDefB
|
37959
|
+
* @param {number} order
|
37960
|
+
* @return {number}
|
38118
37961
|
*/
|
38119
|
-
|
38120
|
-
|
38121
|
-
|
38122
|
-
|
37962
|
+
RowDefSorter.prototype._rowDefSorter = function(rowDefA, rowDefB, order) {
|
37963
|
+
var orderA = rowDefA.getGroupOrder();
|
37964
|
+
var orderB = rowDefB.getGroupOrder();
|
37965
|
+
if(orderA !== orderB) {
|
37966
|
+
return orderA - orderB; // Regardless of sort order
|
37967
|
+
}
|
38123
37968
|
|
38124
|
-
|
37969
|
+
return this._sortLogic(rowDefA, rowDefB, order, this._sortContext);
|
37970
|
+
};
|
38125
37971
|
|
37972
|
+
/* harmony default export */ var js_RowDefSorter = (RowDefSorter);
|
38126
37973
|
|
38127
37974
|
// CONCATENATED MODULE: ./node_modules/@grid/core/es6/grid/plugins/SortableTitlePlugin.js
|
38128
37975
|
/* eslint-disable */
|
@@ -38167,7 +38014,7 @@ Plugin._proto = Plugin.prototype;
|
|
38167
38014
|
*/
|
38168
38015
|
|
38169
38016
|
/** @constructor
|
38170
|
-
* @extends {
|
38017
|
+
* @extends {EventDispatcher}
|
38171
38018
|
* @param {SortableTitlePlugin.Options=} options
|
38172
38019
|
*/
|
38173
38020
|
var SortableTitlePlugin = function (options) { // TODO: Extract SortableTitlePlugin to grid extension.
|
@@ -38199,7 +38046,7 @@ var SortableTitlePlugin = function (options) { // TODO: Extract SortableTitlePlu
|
|
38199
38046
|
_t.config({ "sorting": options });
|
38200
38047
|
}
|
38201
38048
|
};
|
38202
|
-
Ext["b" /* default */].inherits(SortableTitlePlugin,
|
38049
|
+
Ext["b" /* default */].inherits(SortableTitlePlugin, event_EventDispatcher);
|
38203
38050
|
|
38204
38051
|
/**
|
38205
38052
|
* @typedef {"a" | "ascending" | "d" | "descending" | "n" | null} SortableTitlePlugin~SortOrder
|
@@ -38245,6 +38092,12 @@ SortableTitlePlugin.ColumnOptions;
|
|
38245
38092
|
*/
|
38246
38093
|
SortableTitlePlugin.Options;
|
38247
38094
|
|
38095
|
+
|
38096
|
+
/** @type {Array.<Core>}
|
38097
|
+
* @private
|
38098
|
+
*/
|
38099
|
+
SortableTitlePlugin.prototype._hosts = null; // For a plug-in that support multi-table
|
38100
|
+
|
38248
38101
|
/** Order of item indicates sort priorities used in DataView. <br>
|
38249
38102
|
* Each state contains column name{string}, sort order {string}, and rendering cell {ElementWrapper}
|
38250
38103
|
* @private
|
@@ -38349,13 +38202,17 @@ var CODE_DOWN = "\u25BC";
|
|
38349
38202
|
*/
|
38350
38203
|
var CODE_DIAMOND = "\u25CA";
|
38351
38204
|
|
38352
|
-
/**
|
38205
|
+
/** The name must be readonly and unique among all other plugins
|
38206
|
+
* @public
|
38207
|
+
* @return {string}
|
38208
|
+
*/
|
38353
38209
|
SortableTitlePlugin.prototype.getName = function () {
|
38354
38210
|
return "SortableTitlePlugin"; // Read Only
|
38355
38211
|
};
|
38356
38212
|
|
38357
|
-
/**
|
38358
|
-
* @
|
38213
|
+
/** @public
|
38214
|
+
* @param {!Core} host
|
38215
|
+
* @param {Object=} options
|
38359
38216
|
* @description Suppress google compiler for argument options because Internal Plugin doesn't support.
|
38360
38217
|
* @suppress {checkTypes}
|
38361
38218
|
*/
|
@@ -38374,7 +38231,10 @@ SortableTitlePlugin.prototype.initialize = function (host, options) {
|
|
38374
38231
|
this.config(options);
|
38375
38232
|
};
|
38376
38233
|
|
38377
|
-
/**
|
38234
|
+
/**For disposing any resource
|
38235
|
+
* @public
|
38236
|
+
* @param {!Core} host
|
38237
|
+
*/
|
38378
38238
|
SortableTitlePlugin.prototype.unload = function (host) {
|
38379
38239
|
var at = this._hosts.indexOf(host);
|
38380
38240
|
if (at < 0) { return; }
|
@@ -38765,31 +38625,18 @@ SortableTitlePlugin.prototype.getSortOrder = function (colIndex) {
|
|
38765
38625
|
* @return {number} Return negative value if there is no sorted column
|
38766
38626
|
*/
|
38767
38627
|
SortableTitlePlugin.prototype.getSortedColumnIndex = function (priority) {
|
38768
|
-
|
38769
|
-
if (state) {
|
38770
|
-
var host = this._hosts[0];
|
38771
|
-
var colCount = host ? host.getColumnCount() : 0;
|
38772
|
-
for (var c = 0; c < colCount; ++c) {
|
38773
|
-
var sortOptions = this._getSortOptions(c);
|
38774
|
-
if (sortOptions === state) {
|
38775
|
-
return c;
|
38776
|
-
}
|
38777
|
-
}
|
38778
|
-
}
|
38779
|
-
return -1;
|
38628
|
+
return this._getColumnIndexByOptions(this._sortStates[priority || 0]);
|
38780
38629
|
};
|
38781
|
-
/**
|
38630
|
+
/** Start with 0 (the first column that is being sorted). The highest number will be sorted last. Negative value means the specified column is not sorted
|
38631
|
+
* @public
|
38782
38632
|
* @param {number} colIndex
|
38783
|
-
* @return {number}
|
38633
|
+
* @return {number}
|
38784
38634
|
*/
|
38785
38635
|
SortableTitlePlugin.prototype.getSortPriority = function (colIndex) {
|
38786
|
-
var
|
38787
|
-
|
38788
|
-
|
38789
|
-
|
38790
|
-
if (this._sortStates[i] === sortOptions) {
|
38791
|
-
return i;
|
38792
|
-
}
|
38636
|
+
var len = this._sortStates.length;
|
38637
|
+
for (var i = 0; i < len; ++i) {
|
38638
|
+
if (this._sortStates[i] === this._getSortOptions(colIndex)) {
|
38639
|
+
return i;
|
38793
38640
|
}
|
38794
38641
|
}
|
38795
38642
|
return -1;
|
@@ -38802,7 +38649,7 @@ SortableTitlePlugin.prototype.isColumnSorted = function (colIndex) {
|
|
38802
38649
|
return this.getSortPriority(colIndex) >= 0;
|
38803
38650
|
};
|
38804
38651
|
/** @public
|
38805
|
-
* @return {Array.<Object>
|
38652
|
+
* @return {Array.<Object>} Array of object with "colIndex" and "sortOrder"
|
38806
38653
|
*/
|
38807
38654
|
SortableTitlePlugin.prototype.getSortedColumns = function () {
|
38808
38655
|
var len = this._sortStates.length;
|
@@ -38811,28 +38658,33 @@ SortableTitlePlugin.prototype.getSortedColumns = function () {
|
|
38811
38658
|
var arr = new Array(len);
|
38812
38659
|
for (var i = 0; i < len; ++i) {
|
38813
38660
|
var colIndex = this.getSortedColumnIndex(i);
|
38661
|
+
var state = this._sortStates[i];
|
38814
38662
|
arr[i] = {
|
38815
38663
|
"colIndex": colIndex,
|
38816
|
-
"
|
38664
|
+
"field": state["field"] || "",
|
38665
|
+
"sortOrder": state["sortOrder"] || "n"
|
38817
38666
|
};
|
38818
38667
|
}
|
38819
38668
|
return arr;
|
38820
38669
|
};
|
38670
|
+
/** @public
|
38671
|
+
* @return {boolean}
|
38672
|
+
*/
|
38673
|
+
SortableTitlePlugin.prototype.isSorting = function () {
|
38674
|
+
return this._sortStates.length ? true : false;
|
38675
|
+
};
|
38821
38676
|
|
38822
38677
|
/** @public
|
38823
|
-
* @param {number}
|
38678
|
+
* @param {number|string} colRef Column index or field
|
38824
38679
|
* @param {string=} sortOrder "a" for ascending, "d" for descending, and "n" for no sorting
|
38825
38680
|
* @param {Object=} opt_arg Event argument to be sent with preDataSorting event
|
38826
38681
|
* @fires SortableTitlePlugin#preDataSorting
|
38827
38682
|
* @fires SortableTitlePlugin#columnSorted
|
38828
38683
|
*/
|
38829
|
-
SortableTitlePlugin.prototype.sortColumn = function (
|
38830
|
-
|
38831
|
-
|
38832
|
-
|
38833
|
-
if (state) {
|
38834
|
-
this._sortColumn([state], opt_arg);
|
38835
|
-
}
|
38684
|
+
SortableTitlePlugin.prototype.sortColumn = function (colRef, sortOrder, opt_arg) {
|
38685
|
+
var state = this._prepareSorting(colRef, sortOrder);
|
38686
|
+
if (state) {
|
38687
|
+
this._sortColumn([state], opt_arg);
|
38836
38688
|
}
|
38837
38689
|
};
|
38838
38690
|
|
@@ -38848,7 +38700,14 @@ SortableTitlePlugin.prototype.sortColumns = function (sortOptions, opt_arg) {
|
|
38848
38700
|
var states = [];
|
38849
38701
|
for (var i = 0; i < sortOptions.length; i++) {
|
38850
38702
|
var opt = sortOptions[i];
|
38851
|
-
var
|
38703
|
+
var colRef = opt["colIndex"];
|
38704
|
+
if(colRef < 0 || colRef == null) {
|
38705
|
+
colRef = opt["field"];
|
38706
|
+
}
|
38707
|
+
var state = this._prepareSorting(
|
38708
|
+
colRef,
|
38709
|
+
opt["sortOrder"] || opt["order"]
|
38710
|
+
);
|
38852
38711
|
if (state) {
|
38853
38712
|
states[i] = state;
|
38854
38713
|
}
|
@@ -38877,7 +38736,6 @@ SortableTitlePlugin.prototype.refresh = function () {
|
|
38877
38736
|
|
38878
38737
|
/** @description Perform sorting with the same parameter. Alias to {@link SortableTitlePlugin#refresh}
|
38879
38738
|
* @public
|
38880
|
-
* @override
|
38881
38739
|
* @function
|
38882
38740
|
*/
|
38883
38741
|
SortableTitlePlugin.prototype.restoreUserActions = SortableTitlePlugin.prototype.refresh;
|
@@ -38945,20 +38803,24 @@ SortableTitlePlugin.prototype.setDataColumnNames = SortableTitlePlugin.prototype
|
|
38945
38803
|
* @return {string} field A field used for sorting
|
38946
38804
|
*/
|
38947
38805
|
SortableTitlePlugin.prototype.getColumnSortingField = function (colIndex) {
|
38948
|
-
var
|
38806
|
+
var sortOptions = this._getSortOptions(colIndex);
|
38949
38807
|
// options["field"] is already consolidated from field, sortBy, and sortable properties.
|
38950
|
-
var field = (
|
38808
|
+
var field = (sortOptions) ? sortOptions["field"] : null;
|
38951
38809
|
|
38952
|
-
if (field == null && !this._rowDefMode) { // Old CompositeGrid may
|
38810
|
+
if (field == null && !this._rowDefMode) { // Old CompositeGrid may store sorting field in DataColumnName
|
38953
38811
|
var host = this._hosts[0];
|
38954
38812
|
if (host) {
|
38955
38813
|
field = host.getDataColumnName(colIndex);
|
38814
|
+
if(field && sortOptions) {
|
38815
|
+
sortOptions["field"] = field; // Cache for later use
|
38816
|
+
}
|
38956
38817
|
}
|
38957
38818
|
}
|
38958
38819
|
|
38959
38820
|
return field || "";
|
38960
38821
|
};
|
38961
|
-
/**
|
38822
|
+
/** This is equivalent to setting sortBy in the configuration object.
|
38823
|
+
* @public
|
38962
38824
|
* @param {number} colIndex
|
38963
38825
|
* @param {string|null} field A field used for sorting
|
38964
38826
|
* @param {Function=} sortLogic
|
@@ -38979,21 +38841,26 @@ SortableTitlePlugin.prototype.setColumnSortingField = function (colIndex, field,
|
|
38979
38841
|
}
|
38980
38842
|
}
|
38981
38843
|
};
|
38982
|
-
/**
|
38844
|
+
/** Return array of the fields from the currently sorted columns
|
38845
|
+
* @public
|
38983
38846
|
* @return {!Array.<string>} fields of each sorting states
|
38984
38847
|
*/
|
38985
38848
|
SortableTitlePlugin.prototype.getColumnSortingFields = function () {
|
38986
|
-
var
|
38849
|
+
var len = this._sortStates.length;
|
38850
|
+
var ary = new Array(len);
|
38987
38851
|
var host = this._hosts[0];
|
38988
|
-
|
38989
|
-
for
|
38990
|
-
var sortOptions = this.
|
38991
|
-
|
38992
|
-
|
38993
|
-
|
38994
|
-
|
38852
|
+
|
38853
|
+
for(var i = 0; i < len; ++i) {
|
38854
|
+
var sortOptions = this._sortStates[i];
|
38855
|
+
var field = sortOptions["field"];
|
38856
|
+
if(!field && !this._rowDefMode) {
|
38857
|
+
var colIndex = this._getColumnIndexByOptions(sortOptions); // Slow
|
38858
|
+
field = host.getDataColumnName(colIndex);
|
38859
|
+
if(field) {
|
38860
|
+
sortOptions["field"] = field; // Cache for later use
|
38995
38861
|
}
|
38996
38862
|
}
|
38863
|
+
ary[i] = field || "";
|
38997
38864
|
}
|
38998
38865
|
return ary;
|
38999
38866
|
};
|
@@ -39237,7 +39104,7 @@ SortableTitlePlugin.prototype._proceedSorting = function (hitObj) {
|
|
39237
39104
|
if (this._canClickToSort(hitObj)) {
|
39238
39105
|
var colIndex = hitObj["colIndex"];
|
39239
39106
|
// _proceedSorting() method is always produced by user clicking at the header // Thus, this operation is guaranteed to be a user action
|
39240
|
-
var state = this.
|
39107
|
+
var state = this._prepareSorting(colIndex);
|
39241
39108
|
if (state) {
|
39242
39109
|
this._sortColumn([state], { "isUserAction": true });
|
39243
39110
|
}
|
@@ -39261,6 +39128,14 @@ SortableTitlePlugin.prototype._onMouseDown = function (e) {
|
|
39261
39128
|
}
|
39262
39129
|
};
|
39263
39130
|
/** @private
|
39131
|
+
* @param {string} pluginName
|
39132
|
+
* @return {*|null}
|
39133
|
+
*/
|
39134
|
+
SortableTitlePlugin.prototype._getPlugin = function(pluginName) {
|
39135
|
+
var host = this._hosts[0];
|
39136
|
+
return (host) ? host.getPlugin(pluginName) : null;
|
39137
|
+
};
|
39138
|
+
/** @private
|
39264
39139
|
* @param {Core} grid
|
39265
39140
|
* @param {MouseEvent} e
|
39266
39141
|
*/
|
@@ -39415,23 +39290,36 @@ SortableTitlePlugin.prototype.clearAllColumnSortingSequences = function () {
|
|
39415
39290
|
|
39416
39291
|
|
39417
39292
|
/** @private
|
39418
|
-
* @param {number}
|
39293
|
+
* @param {number|string} colRef Column index or field
|
39419
39294
|
* @param {string=} sortOrder "a" for ascending, "d" for descending, and "n" for no sorting
|
39420
39295
|
* @returns {Object} state Returns null, if nothing is changed
|
39421
39296
|
*/
|
39422
|
-
SortableTitlePlugin.prototype.
|
39423
|
-
if (!this._maxCount) {
|
39297
|
+
SortableTitlePlugin.prototype._prepareSorting = function (colRef, sortOrder) {
|
39298
|
+
if (!this._maxCount) {
|
39299
|
+
return null;
|
39300
|
+
}
|
39424
39301
|
|
39425
|
-
var
|
39426
|
-
var
|
39302
|
+
var colIndex = -1;
|
39303
|
+
var field = "";
|
39304
|
+
var priority = -1;
|
39305
|
+
if(typeof colRef === "number") {
|
39306
|
+
colIndex = colRef;
|
39307
|
+
field = this.getColumnSortingField(colIndex);
|
39308
|
+
priority = this.getSortPriority(colIndex);
|
39309
|
+
} else if(typeof colRef === "string") {
|
39310
|
+
field = colRef;
|
39311
|
+
colIndex = this._getColumnIndexByField(field);
|
39312
|
+
var fields = this.getColumnSortingFields();
|
39313
|
+
priority = fields.indexOf(field);
|
39314
|
+
}
|
39427
39315
|
|
39316
|
+
var curState = (priority >= 0) ? this._sortStates[priority] : null;
|
39428
39317
|
var curOrder = curState ? curState["sortOrder"] : "n";
|
39429
39318
|
|
39430
39319
|
// Getting next sort order
|
39431
39320
|
var nextOrder = "n";
|
39432
|
-
var sortingField = this.getColumnSortingField(colIndex);
|
39433
39321
|
if (sortOrder == null) { // Auto order switch
|
39434
|
-
var sortingSequence = this.getSortingSequence(
|
39322
|
+
var sortingSequence = this.getSortingSequence(field);
|
39435
39323
|
|
39436
39324
|
var sequenceIndex = sortingSequence.indexOf(curOrder);
|
39437
39325
|
if (sequenceIndex < 0) {
|
@@ -39456,10 +39344,16 @@ SortableTitlePlugin.prototype._preSortColumn = function (colIndex, sortOrder) {
|
|
39456
39344
|
}
|
39457
39345
|
|
39458
39346
|
if (nextOrder === "a" || nextOrder === "d") { // Reorder sort states
|
39347
|
+
if(colIndex < 0 && !field) {
|
39348
|
+
return null;
|
39349
|
+
}
|
39459
39350
|
if (!curState) {
|
39460
39351
|
// TODO: Sort state object should not be sortOptions
|
39461
39352
|
curState = this._newSortOptions(colIndex); // This may come with sortLogic
|
39462
39353
|
}
|
39354
|
+
if(colIndex < 0) {
|
39355
|
+
curState["field"] = field;
|
39356
|
+
}
|
39463
39357
|
|
39464
39358
|
this._sortStates.push(curState); // Latest sorting have lowest priority (multiColumn sorting)
|
39465
39359
|
}
|
@@ -39486,7 +39380,7 @@ SortableTitlePlugin.prototype._preSortColumn = function (colIndex, sortOrder) {
|
|
39486
39380
|
|
39487
39381
|
return { // TODO: Refactor this code as it is only used by "columnSorted" event (unnecessarily complex).
|
39488
39382
|
"colIndex": colIndex,
|
39489
|
-
"sortedField":
|
39383
|
+
"sortedField": field,
|
39490
39384
|
"sortOrder": nextOrder || "n",
|
39491
39385
|
"prevOrder": curOrder,
|
39492
39386
|
"clearedSortColIndexes": clearedSortColIndexes
|
@@ -39494,7 +39388,7 @@ SortableTitlePlugin.prototype._preSortColumn = function (colIndex, sortOrder) {
|
|
39494
39388
|
};
|
39495
39389
|
|
39496
39390
|
/** @private
|
39497
|
-
* @param {Array.<Object>} states States from
|
39391
|
+
* @param {Array.<Object>} states States from _prepareSorting for dispatching columnSorted event.
|
39498
39392
|
* @param {Object=} opt_arg Event argument to be sent with preDataSorting event
|
39499
39393
|
* @fires SortableTitlePlugin#preDataSorting
|
39500
39394
|
* @fires SortableTitlePlugin#columnSorted
|
@@ -39521,8 +39415,8 @@ SortableTitlePlugin.prototype._sortColumn = function (states, opt_arg) {
|
|
39521
39415
|
this._dispatch("columnSorted", res);
|
39522
39416
|
};
|
39523
39417
|
|
39524
|
-
/** @
|
39525
|
-
* @
|
39418
|
+
/** @private
|
39419
|
+
* @param {Object} e
|
39526
39420
|
*/
|
39527
39421
|
SortableTitlePlugin.prototype._onColumnAdded = function (e) {
|
39528
39422
|
var t = this;
|
@@ -39544,8 +39438,8 @@ SortableTitlePlugin.prototype._onColumnAdded = function (e) {
|
|
39544
39438
|
}
|
39545
39439
|
};
|
39546
39440
|
|
39547
|
-
/** @
|
39548
|
-
* @
|
39441
|
+
/** @private
|
39442
|
+
* @param {Object} e
|
39549
39443
|
* @fires SortableTitlePlugin#preDataSorting
|
39550
39444
|
* @fires SortableTitlePlugin#columnSorted
|
39551
39445
|
*/
|
@@ -39597,7 +39491,7 @@ SortableTitlePlugin.prototype._sortDataView = function (opt_action) {
|
|
39597
39491
|
sortLogics = new Array(sortCount);
|
39598
39492
|
for (var i = 0; i < sortCount; ++i) {
|
39599
39493
|
orders[i] = this._sortStates[i]["sortOrder"];
|
39600
|
-
sortLogics[i] = this._sortStates[i]["sortLogic"];
|
39494
|
+
sortLogics[i] = this._sortStates[i]["sortLogic"]; // sortLogic can be null
|
39601
39495
|
}
|
39602
39496
|
if(this._rowDefMode) { // DataView in real-time grid has only ROW_DEF column
|
39603
39497
|
c_ref = this._sortStates.map(SortableTitlePlugin._toRowDefField);
|
@@ -39679,7 +39573,7 @@ SortableTitlePlugin.prototype._updateSortableIndicator = function (hostIndex) {
|
|
39679
39573
|
|
39680
39574
|
cell["addClass"]("sortable");
|
39681
39575
|
|
39682
|
-
var priority = t.
|
39576
|
+
var priority = t.getSortPriority(col);
|
39683
39577
|
var state = t._sortStates[priority];
|
39684
39578
|
|
39685
39579
|
var isSorting = state && state["sortOrder"] !== "n";
|
@@ -39750,18 +39644,40 @@ SortableTitlePlugin.prototype._createIconElem = function (icon, fallback) {
|
|
39750
39644
|
};
|
39751
39645
|
|
39752
39646
|
/** @private
|
39753
|
-
|
39754
|
-
* @return {number}
|
39647
|
+
* @param {Object} sortOptions
|
39648
|
+
* @return {number}
|
39755
39649
|
*/
|
39756
|
-
SortableTitlePlugin.prototype.
|
39757
|
-
|
39758
|
-
|
39759
|
-
var
|
39760
|
-
|
39650
|
+
SortableTitlePlugin.prototype._getColumnIndexByOptions = function (sortOptions) {
|
39651
|
+
if(sortOptions) {
|
39652
|
+
var host = this._hosts[0];
|
39653
|
+
var colCount = host ? host.getColumnCount() : 0;
|
39654
|
+
for (var c = 0; c < colCount; ++c) {
|
39655
|
+
var colData = host.getColumnData(c); // Equivalent to _getSortOptions() method
|
39656
|
+
if (colData) {
|
39657
|
+
if(sortOptions === colData["sortableTitle"]) {
|
39658
|
+
return c;
|
39659
|
+
}
|
39660
|
+
}
|
39661
|
+
}
|
39662
|
+
}
|
39663
|
+
return -1;
|
39664
|
+
};
|
39665
|
+
/** @private
|
39666
|
+
* @param {string} field
|
39667
|
+
* @return {number}
|
39668
|
+
*/
|
39669
|
+
SortableTitlePlugin.prototype._getColumnIndexByField = function (field) {
|
39670
|
+
if(field) {
|
39671
|
+
var host = this._hosts[0];
|
39672
|
+
var colCount = host ? host.getColumnCount() : 0;
|
39673
|
+
for (var c = 0; c < colCount; ++c) {
|
39674
|
+
if(field === this.getColumnSortingField(c)) {
|
39675
|
+
return c;
|
39676
|
+
}
|
39677
|
+
}
|
39761
39678
|
}
|
39762
39679
|
return -1;
|
39763
39680
|
};
|
39764
|
-
|
39765
39681
|
/** @private
|
39766
39682
|
* @param {number} colIndex
|
39767
39683
|
* @return {Object}
|
@@ -39784,10 +39700,7 @@ SortableTitlePlugin.prototype._newSortOptions = function (colIndex) {
|
|
39784
39700
|
var host = this._hosts[0];
|
39785
39701
|
var sortOptions = null;
|
39786
39702
|
if (host && colIndex >= 0) {
|
39787
|
-
var colData = host.getColumnData(colIndex);
|
39788
|
-
if (!colData) {
|
39789
|
-
colData = host.setColumnData(colIndex, {});
|
39790
|
-
}
|
39703
|
+
var colData = host.getColumnData(colIndex); // colData is guaranteed to exist
|
39791
39704
|
sortOptions = colData["sortableTitle"];
|
39792
39705
|
if (!sortOptions) {
|
39793
39706
|
sortOptions = colData["sortableTitle"] = {};
|
@@ -39833,623 +39746,6 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
|
|
39833
39746
|
/* harmony default export */ var plugins_SortableTitlePlugin = (SortableTitlePlugin);
|
39834
39747
|
|
39835
39748
|
|
39836
|
-
// CONCATENATED MODULE: ./node_modules/@grid/core/es6/grid/plugins/DragAndDropTitlePlugin.js
|
39837
|
-
/* eslint-disable */
|
39838
|
-
|
39839
|
-
|
39840
|
-
|
39841
|
-
|
39842
|
-
|
39843
|
-
/* eslint-enable */
|
39844
|
-
|
39845
|
-
/** Event
|
39846
|
-
* @event DragAndDropTitlePlugin#dragged
|
39847
|
-
* @type {MouseEvent}
|
39848
|
-
* @property {*} * Depends on the browser's mouse event arguments
|
39849
|
-
*/
|
39850
|
-
/** Event
|
39851
|
-
* @event DragAndDropTitlePlugin#columnMoved
|
39852
|
-
* @property {number} startColumnIndex
|
39853
|
-
* @property {number} destColumnIndex
|
39854
|
-
*/
|
39855
|
-
|
39856
|
-
/** @constructor
|
39857
|
-
* @extends {Plugin}
|
39858
|
-
*/
|
39859
|
-
var DragAndDropTitlePlugin = function () {
|
39860
|
-
var _t = this;
|
39861
|
-
|
39862
|
-
_t._onColumnAdded = _t._onColumnAdded.bind(_t);
|
39863
|
-
_t._onColumnMoved = _t._onColumnMoved.bind(_t);
|
39864
|
-
_t._onColumnRemoved = _t._onColumnRemoved.bind(_t);
|
39865
|
-
|
39866
|
-
_t._onMouseUp = _t._onMouseUp.bind(_t);
|
39867
|
-
_t._onMouseDown = _t._onMouseDown.bind(_t);
|
39868
|
-
|
39869
|
-
_t._onDrag = _t._onDrag.bind(_t);
|
39870
|
-
_t._onDragStart = _t._onDragStart.bind(_t);
|
39871
|
-
_t._onDragEnd = _t._onDragEnd.bind(_t);
|
39872
|
-
_t._onDragPulse = _t._onDragPulse.bind(_t);
|
39873
|
-
|
39874
|
-
_t._hosts = [];
|
39875
|
-
|
39876
|
-
_t._guideline = document.createElement("svg");
|
39877
|
-
_t._guideline.className = "tr-guideline";
|
39878
|
-
_t._dragbox = document.createElement("svg");
|
39879
|
-
_t._dragbox.className = "tr-dragbox";
|
39880
|
-
|
39881
|
-
_t._addEvent("dragged"); // drag
|
39882
|
-
_t._addEvent("dragStart");
|
39883
|
-
_t._addEvent("dragInterval");
|
39884
|
-
_t._addEvent("preColumnMoved");
|
39885
|
-
_t._addEvent("columnMoved");
|
39886
|
-
|
39887
|
-
};
|
39888
|
-
Ext["b" /* default */].inherits(DragAndDropTitlePlugin, plugins_Plugin);
|
39889
|
-
|
39890
|
-
|
39891
|
-
/** @private
|
39892
|
-
* @type {Core}
|
39893
|
-
*/
|
39894
|
-
DragAndDropTitlePlugin.prototype._clickedGrid;
|
39895
|
-
/** @private
|
39896
|
-
* @type {ILayoutGrid}
|
39897
|
-
*/
|
39898
|
-
DragAndDropTitlePlugin.prototype._clickedSection = null;
|
39899
|
-
/** @private
|
39900
|
-
* @type {number}
|
39901
|
-
*/
|
39902
|
-
DragAndDropTitlePlugin.prototype._clickedRow = -1;
|
39903
|
-
/** @private
|
39904
|
-
* @type {!Element}
|
39905
|
-
*/
|
39906
|
-
DragAndDropTitlePlugin.prototype._guideline;
|
39907
|
-
/** @private
|
39908
|
-
* @type {!Element}
|
39909
|
-
*/
|
39910
|
-
DragAndDropTitlePlugin.prototype._dragbox;
|
39911
|
-
/** @private
|
39912
|
-
* @type {number}
|
39913
|
-
*/
|
39914
|
-
DragAndDropTitlePlugin.prototype._timerId = 0;
|
39915
|
-
/** @private
|
39916
|
-
* @type {number}
|
39917
|
-
*/
|
39918
|
-
DragAndDropTitlePlugin.prototype._dragPulseId = 0;
|
39919
|
-
/** @private
|
39920
|
-
* @type {Object}
|
39921
|
-
*/
|
39922
|
-
DragAndDropTitlePlugin.prototype._pos = null; // Cache of current mouse position
|
39923
|
-
/** @private
|
39924
|
-
* @type {number}
|
39925
|
-
*/
|
39926
|
-
DragAndDropTitlePlugin.prototype._cacheLeft = 0;
|
39927
|
-
/** @private
|
39928
|
-
* @type {number}
|
39929
|
-
*/
|
39930
|
-
DragAndDropTitlePlugin.prototype._cacheWidth = 0;
|
39931
|
-
|
39932
|
-
/** @private
|
39933
|
-
* @type {number}
|
39934
|
-
*/
|
39935
|
-
DragAndDropTitlePlugin.prototype._startColumn = -1;
|
39936
|
-
/** @private
|
39937
|
-
* @type {number}
|
39938
|
-
*/
|
39939
|
-
DragAndDropTitlePlugin.prototype._endColumn = -1;
|
39940
|
-
/** @private
|
39941
|
-
* @type {number}
|
39942
|
-
*/
|
39943
|
-
DragAndDropTitlePlugin.prototype._destColumn = -1;
|
39944
|
-
/** @private
|
39945
|
-
* @type {number}
|
39946
|
-
*/
|
39947
|
-
DragAndDropTitlePlugin.prototype._leftMovableBorder = -1;
|
39948
|
-
/** @private
|
39949
|
-
* @type {number}
|
39950
|
-
*/
|
39951
|
-
DragAndDropTitlePlugin.prototype._rightMovableBorder = -1;
|
39952
|
-
/** @private
|
39953
|
-
* @type {boolean}
|
39954
|
-
*/
|
39955
|
-
DragAndDropTitlePlugin.prototype._isDragging = false;
|
39956
|
-
/** @private
|
39957
|
-
* @type {boolean}
|
39958
|
-
*/
|
39959
|
-
DragAndDropTitlePlugin.prototype._lockFrozen = false;
|
39960
|
-
/** @private
|
39961
|
-
* @type {boolean}
|
39962
|
-
*/
|
39963
|
-
DragAndDropTitlePlugin.prototype._disabled = false;
|
39964
|
-
/** @private
|
39965
|
-
* @type {boolean}
|
39966
|
-
*/
|
39967
|
-
DragAndDropTitlePlugin.prototype._noColumnMoving = false;
|
39968
|
-
/** @private
|
39969
|
-
* @type {boolean}
|
39970
|
-
*/
|
39971
|
-
DragAndDropTitlePlugin.prototype._noDragBox = false;
|
39972
|
-
|
39973
|
-
|
39974
|
-
/** @override */
|
39975
|
-
DragAndDropTitlePlugin.prototype.getName = function () {
|
39976
|
-
return "DragAndDropTitlePlugin"; // Read Only
|
39977
|
-
};
|
39978
|
-
/** @override */
|
39979
|
-
DragAndDropTitlePlugin.prototype.initialize = function (host) {
|
39980
|
-
if(this._hosts.indexOf(host) >= 0) { return; }
|
39981
|
-
|
39982
|
-
this._hosts.push(host);
|
39983
|
-
host.listen("mousedown", this._onMouseDown);
|
39984
|
-
host.listen("columnAdded", this._onColumnAdded);
|
39985
|
-
host.listen("columnMoved", this._onColumnMoved);
|
39986
|
-
host.listen("columnRemoved", this._onColumnRemoved);
|
39987
|
-
|
39988
|
-
host.listen("dragstart", util._preventDefault);
|
39989
|
-
};
|
39990
|
-
|
39991
|
-
/** @override */
|
39992
|
-
DragAndDropTitlePlugin.prototype.unload = function (host) {
|
39993
|
-
var at = this._hosts.indexOf(host);
|
39994
|
-
if(at < 0) { return; }
|
39995
|
-
|
39996
|
-
this._hosts.splice(at, 1);
|
39997
|
-
host.unlisten("mousedown", this._onMouseDown);
|
39998
|
-
host.unlisten("columnAdded", this._onColumnAdded);
|
39999
|
-
host.unlisten("columnMoved", this._onColumnMoved);
|
40000
|
-
host.unlisten("columnRemoved", this._onColumnRemoved);
|
40001
|
-
};
|
40002
|
-
|
40003
|
-
/** Specify column to be processed by this plugin
|
40004
|
-
* @public
|
40005
|
-
* @return {null}
|
40006
|
-
*/
|
40007
|
-
DragAndDropTitlePlugin.prototype.getMarker = function () {
|
40008
|
-
return null;
|
40009
|
-
};
|
40010
|
-
|
40011
|
-
/**
|
40012
|
-
* Lock moving of frozen column. If true is spsecified, dragging is disabled for frozen column.
|
40013
|
-
* @public
|
40014
|
-
* @param {boolean} lock
|
40015
|
-
*/
|
40016
|
-
DragAndDropTitlePlugin.prototype.lockFrozenColumn = function(lock) {
|
40017
|
-
this._lockFrozen = lock;
|
40018
|
-
};
|
40019
|
-
|
40020
|
-
/** Disable this plugin entirely
|
40021
|
-
* @public
|
40022
|
-
* @param {boolean=} opt_disabled
|
40023
|
-
*/
|
40024
|
-
DragAndDropTitlePlugin.prototype.disable = function(opt_disabled) {
|
40025
|
-
this._disabled = opt_disabled !== false;
|
40026
|
-
};
|
40027
|
-
/** Disable column moving. Only cursor is showing and events are fired. No real column moving.
|
40028
|
-
* @public
|
40029
|
-
* @param {boolean=} opt_disabled
|
40030
|
-
*/
|
40031
|
-
DragAndDropTitlePlugin.prototype.disableMoving = function(opt_disabled) {
|
40032
|
-
this._noColumnMoving = opt_disabled !== false;
|
40033
|
-
};
|
40034
|
-
/** Disable column moving. Only cursor is showing and events are fired. No real column moving.
|
40035
|
-
* @public
|
40036
|
-
* @param {boolean=} opt_disabled
|
40037
|
-
*/
|
40038
|
-
DragAndDropTitlePlugin.prototype.disableDragBox = function(opt_disabled) {
|
40039
|
-
this._noDragBox = opt_disabled !== false;
|
40040
|
-
};
|
40041
|
-
|
40042
|
-
/** @private
|
40043
|
-
* @param {number} colIndex
|
40044
|
-
* @return {boolean}
|
40045
|
-
*/
|
40046
|
-
DragAndDropTitlePlugin.prototype._isAllowed = function(colIndex) {
|
40047
|
-
var host = this._clickedGrid || this._hosts[0];
|
40048
|
-
if (host) {
|
40049
|
-
var stationaryIndex = host.getStationaryColumnIndex();
|
40050
|
-
if (stationaryIndex < 0) {
|
40051
|
-
return true;
|
40052
|
-
}
|
40053
|
-
if (colIndex <= stationaryIndex) {
|
40054
|
-
return false;
|
40055
|
-
}
|
40056
|
-
}
|
40057
|
-
return true;
|
40058
|
-
};
|
40059
|
-
/** @private
|
40060
|
-
* @param {Event} e
|
40061
|
-
*/
|
40062
|
-
DragAndDropTitlePlugin.prototype._onMouseDown = function (e) {
|
40063
|
-
if(this._disabled) {
|
40064
|
-
return;
|
40065
|
-
}
|
40066
|
-
if(e.shiftKey || e.ctrlKey || e.altKey) {
|
40067
|
-
return; // Ignore mousedown event, if modifier key is detected
|
40068
|
-
}
|
40069
|
-
if(e.button) {
|
40070
|
-
return; // We don't allow drag with middle click (button == 1), or right click (button == 2)
|
40071
|
-
}
|
40072
|
-
if(this._timerId) {
|
40073
|
-
return; // Drag timer is already start
|
40074
|
-
}
|
40075
|
-
|
40076
|
-
var host = this.getRelativeGrid(e);
|
40077
|
-
if(!host) {
|
40078
|
-
return; // Given event should be within grid element
|
40079
|
-
}
|
40080
|
-
|
40081
|
-
this._pos = host.getRelativePosition(e);
|
40082
|
-
if (this._pos["hit"] === false) {
|
40083
|
-
return; // Only start dragging when mouse is down on the grid
|
40084
|
-
}
|
40085
|
-
|
40086
|
-
var section = /** @type{ILayoutGrid} */(this._pos["section"]);
|
40087
|
-
if(!section) {
|
40088
|
-
return; // The section that is not in the target section list cannot be dragged
|
40089
|
-
} else if(this._pos["sectionType"] !== "title") {
|
40090
|
-
return; // Sections other than title section cannot be dragged by default
|
40091
|
-
}
|
40092
|
-
|
40093
|
-
var colIndex = this._pos["colIndex"];
|
40094
|
-
if(!this._isAllowed(colIndex)) {
|
40095
|
-
return; // The column cannot be dragged
|
40096
|
-
}
|
40097
|
-
if(this._lockFrozen && host.isPinnedColumn(colIndex)) {
|
40098
|
-
return; // If the lock frag is on, frozen columns cannot be dragged
|
40099
|
-
}
|
40100
|
-
|
40101
|
-
var rowIndex = this._pos["rowIndex"]; // rowIndex may not exist
|
40102
|
-
var movableBorder = this._findMoveableBorder(colIndex, rowIndex - 1, section);
|
40103
|
-
var movingColumns = this._getSpan(colIndex, rowIndex, section);
|
40104
|
-
|
40105
|
-
this._clickedGrid = host;
|
40106
|
-
this._clickedSection = section;
|
40107
|
-
this._clickedRow = rowIndex;
|
40108
|
-
|
40109
|
-
this._startColumn = movingColumns["left"];
|
40110
|
-
this._endColumn = movingColumns["right"];
|
40111
|
-
this._leftMovableBorder = movableBorder["left"];
|
40112
|
-
this._rightMovableBorder = movableBorder["right"];
|
40113
|
-
this._destColumn = this._startColumn;
|
40114
|
-
|
40115
|
-
this._timerId = setTimeout(this._onDragStart, 300);
|
40116
|
-
window.addEventListener("mouseup", this._onMouseUp, false);
|
40117
|
-
};
|
40118
|
-
/** @private
|
40119
|
-
* @param {Object} e
|
40120
|
-
*/
|
40121
|
-
DragAndDropTitlePlugin.prototype._onMouseUp = function (e) {
|
40122
|
-
if(this._timerId) {
|
40123
|
-
window.clearTimeout(this._timerId);
|
40124
|
-
window.removeEventListener("mouseup", this._onMouseUp, false);
|
40125
|
-
this._timerId = 0;
|
40126
|
-
this._clearCache();
|
40127
|
-
}
|
40128
|
-
};
|
40129
|
-
|
40130
|
-
/** @private
|
40131
|
-
*/
|
40132
|
-
DragAndDropTitlePlugin.prototype._onDragStart = function () {
|
40133
|
-
if(this._disabled || this._isDragging) { return; }
|
40134
|
-
|
40135
|
-
if (this._hasListener("dragStart")) {
|
40136
|
-
this._dispatch("dragStart", /** @type{!Object} */(this._pos));
|
40137
|
-
}
|
40138
|
-
|
40139
|
-
if (this._pos["cancel"]) {
|
40140
|
-
return;
|
40141
|
-
}
|
40142
|
-
|
40143
|
-
this._timerId = 0;
|
40144
|
-
window.removeEventListener("mouseup", this._onMouseUp, false);
|
40145
|
-
|
40146
|
-
if(!this._clickedGrid) {
|
40147
|
-
return;
|
40148
|
-
}
|
40149
|
-
|
40150
|
-
this._isDragging = true;
|
40151
|
-
document.body.classList.add("tr-dragging"); // Prevent text selection
|
40152
|
-
// document.body.classList.add("tr-move-cursor");
|
40153
|
-
|
40154
|
-
window.addEventListener("mousemove", this._onDrag, false);
|
40155
|
-
window.addEventListener("mouseup", this._onDragEnd, true);
|
40156
|
-
|
40157
|
-
var host = this._clickedGrid;
|
40158
|
-
var height = host.getHeight();
|
40159
|
-
var sectionBound = this._clickedSection.getBoundingClientRect();
|
40160
|
-
var clickedCellBound = this._clickedSection.getCell(this._startColumn, this._clickedRow).getBoundingClientRect();
|
40161
|
-
|
40162
|
-
var gridElem = host.getElement();
|
40163
|
-
this._guideline.style.top = (clickedCellBound.top - sectionBound.top) + "px";
|
40164
|
-
this._guideline.style.height = (height - 1) + "px";
|
40165
|
-
this._dragbox.style.height = (height - 33) + "px"; // WARNING: Height could be long
|
40166
|
-
this._dragbox.style.width = this._clickedSection.getColumnWidth(this._startColumn) + "px";
|
40167
|
-
|
40168
|
-
// TODO: guideline and drag box should be outside of grid area
|
40169
|
-
gridElem.appendChild(this._guideline);
|
40170
|
-
|
40171
|
-
this._dimCol(true);
|
40172
|
-
this._renderGuideline();
|
40173
|
-
|
40174
|
-
// For step scrolling // TODO: Merge this logic with DraggableContentPlugin
|
40175
|
-
this._scrollStep = Math.floor(host.getScrollWidth() / 25); // Update the scrollbar first
|
40176
|
-
if(this._scrollStep < 40) {
|
40177
|
-
this._scrollStep = 40;
|
40178
|
-
} else if(this._scrollStep > 400) {
|
40179
|
-
this._scrollStep = 400;
|
40180
|
-
}
|
40181
|
-
var scrollbar = host.getHScrollbar();
|
40182
|
-
this._cacheLeft = scrollbar.getLeft() + 20;
|
40183
|
-
this._cacheWidth = scrollbar.getLeft() + scrollbar.getWidth() - 20;
|
40184
|
-
|
40185
|
-
this._dragPulseId = window.setInterval(this._onDragPulse, 150); // Start pulse
|
40186
|
-
};
|
40187
|
-
/** @private
|
40188
|
-
* @param {Event} e
|
40189
|
-
*/
|
40190
|
-
DragAndDropTitlePlugin.prototype._onDrag = function (e) {
|
40191
|
-
if(!this._isDragging) { return; }
|
40192
|
-
|
40193
|
-
util._preventDefault(e);
|
40194
|
-
this._pos = this._clickedGrid.getRelativePosition(e); // Relative to the clicked grid
|
40195
|
-
|
40196
|
-
var host = this.getRelativeGrid(e);
|
40197
|
-
if (!host || host !== this._clickedGrid) { return; }
|
40198
|
-
|
40199
|
-
var colIndex = this._pos["colIndex"];
|
40200
|
-
if ((colIndex >= this._leftMovableBorder) &&
|
40201
|
-
(colIndex <= this._rightMovableBorder) &&
|
40202
|
-
this._isAllowed(colIndex) &&
|
40203
|
-
!(this._lockFrozen && host.isPinnedColumn(colIndex))) {
|
40204
|
-
this._renderGuideline();
|
40205
|
-
this._dispatch("dragged", /** @type{!Object} */(e));
|
40206
|
-
}
|
40207
|
-
this._renderDragBox(e);
|
40208
|
-
};
|
40209
|
-
/** @private
|
40210
|
-
* @param {Event} e
|
40211
|
-
*/
|
40212
|
-
DragAndDropTitlePlugin.prototype._onDragEnd = function (e) {
|
40213
|
-
if(!this._isDragging) {
|
40214
|
-
return;
|
40215
|
-
}
|
40216
|
-
|
40217
|
-
this._isDragging = false;
|
40218
|
-
document.body.classList.remove("tr-dragging");
|
40219
|
-
// document.body.classList.remove("tr-move-cursor");
|
40220
|
-
this._dimCol(false);
|
40221
|
-
|
40222
|
-
var pn = this._guideline.parentNode;
|
40223
|
-
if(pn) {
|
40224
|
-
pn.removeChild(this._guideline);
|
40225
|
-
}
|
40226
|
-
|
40227
|
-
pn = this._dragbox.parentNode;
|
40228
|
-
if(pn) {
|
40229
|
-
pn.removeChild(this._dragbox);
|
40230
|
-
}
|
40231
|
-
|
40232
|
-
window.removeEventListener("mousemove", this._onDrag, false);
|
40233
|
-
window.removeEventListener("mouseup", this._onDragEnd, true);
|
40234
|
-
|
40235
|
-
if(this._dragPulseId) {
|
40236
|
-
window.clearInterval(this._dragPulseId);
|
40237
|
-
this._dragPulseId = 0;
|
40238
|
-
}
|
40239
|
-
this._pos = null;
|
40240
|
-
|
40241
|
-
util._preventDefault(e);
|
40242
|
-
|
40243
|
-
//When move to the right, the first position is the current one.
|
40244
|
-
if (this._destColumn > this._startColumn) {
|
40245
|
-
--this._destColumn;
|
40246
|
-
}
|
40247
|
-
//Cancel moving if the destination column is the current column or not allowed column
|
40248
|
-
if ((!this._destColumn && this._destColumn !== 0) || // undefined, NaN, null
|
40249
|
-
this._destColumn < 0 ||
|
40250
|
-
!this._isAllowed(this._destColumn) ||
|
40251
|
-
(this._destColumn >= this._startColumn && this._destColumn <= this._endColumn)) {
|
40252
|
-
this._clearCache();
|
40253
|
-
return;
|
40254
|
-
}
|
40255
|
-
|
40256
|
-
var arg = {
|
40257
|
-
"startColumnIndex": this._startColumn,
|
40258
|
-
"destColumnIndex": this._destColumn
|
40259
|
-
};
|
40260
|
-
|
40261
|
-
if (this._hasListener("preColumnMoved")) {
|
40262
|
-
this._dispatch("preColumnMoved", arg);
|
40263
|
-
}
|
40264
|
-
|
40265
|
-
if (arg["cancel"]) {
|
40266
|
-
return;
|
40267
|
-
}
|
40268
|
-
|
40269
|
-
if (!this._noColumnMoving) {
|
40270
|
-
var shiftStart = -1;
|
40271
|
-
var shiftEnd = -1;
|
40272
|
-
var moveSize = -1;
|
40273
|
-
if (this._startColumn > this._destColumn) { //Move backward
|
40274
|
-
shiftStart = this._destColumn;
|
40275
|
-
shiftEnd = this._startColumn - 1;
|
40276
|
-
moveSize = -1 * (this._startColumn - this._destColumn); //Move to the left
|
40277
|
-
} else
|
40278
|
-
if (this._startColumn < this._destColumn) { //Move foward
|
40279
|
-
shiftStart = this._endColumn + 1;
|
40280
|
-
shiftEnd = this._destColumn;
|
40281
|
-
moveSize = ((shiftEnd - shiftStart) + 1); //Move to the right
|
40282
|
-
}
|
40283
|
-
|
40284
|
-
//Perform moving all columns in the range
|
40285
|
-
for(var j = this._hosts.length; --j >= 0;) {
|
40286
|
-
var host = this._hosts[j];
|
40287
|
-
var i;
|
40288
|
-
if (moveSize > 0) { //Move forward
|
40289
|
-
for (i = this._startColumn; i <= this._endColumn; i++) {
|
40290
|
-
host.moveColumn(this._startColumn, this._destColumn);
|
40291
|
-
}
|
40292
|
-
} else { //Move backward
|
40293
|
-
for (i = this._startColumn; i <= this._endColumn; i++) {
|
40294
|
-
host.moveColumn(this._startColumn + (i - this._startColumn), this._destColumn + (i - this._startColumn));
|
40295
|
-
}
|
40296
|
-
}
|
40297
|
-
}
|
40298
|
-
}
|
40299
|
-
|
40300
|
-
if (this._hasListener("columnMoved")) {
|
40301
|
-
this._dispatch("columnMoved", {
|
40302
|
-
"startColumnIndex": this._startColumn,
|
40303
|
-
"endColumnIndex": this._endColumn,
|
40304
|
-
"destColumnIndex": this._destColumn,
|
40305
|
-
"clickedRow": this._clickedRow
|
40306
|
-
});
|
40307
|
-
}
|
40308
|
-
this._clearCache();
|
40309
|
-
};
|
40310
|
-
|
40311
|
-
/** @private
|
40312
|
-
*/
|
40313
|
-
DragAndDropTitlePlugin.prototype._onDragPulse = function() {
|
40314
|
-
if(!this._isDragging || !this._pos) { return; }
|
40315
|
-
|
40316
|
-
this._dispatch("dragInterval", /** @type{!Object} */(this._pos));
|
40317
|
-
|
40318
|
-
var host = this._clickedGrid;
|
40319
|
-
if(!host || !host.getHScrollbar().isActive()) { return; }
|
40320
|
-
|
40321
|
-
var x = this._pos["x"];
|
40322
|
-
var scrollVal = 0;
|
40323
|
-
if(x < this._cacheLeft) {
|
40324
|
-
scrollVal = -Math.floor(this._scrollStep * (0.8 + Math.random()));
|
40325
|
-
|
40326
|
-
} else if(x > this._cacheWidth) {
|
40327
|
-
scrollVal = Math.floor(this._scrollStep * (0.8 + Math.random()));
|
40328
|
-
}
|
40329
|
-
|
40330
|
-
this._scrollRight(scrollVal);
|
40331
|
-
};
|
40332
|
-
/** @private
|
40333
|
-
*/
|
40334
|
-
DragAndDropTitlePlugin.prototype._clearCache = function() {
|
40335
|
-
this._startColumn = this._endColumn = this._destColumn = -1;
|
40336
|
-
|
40337
|
-
this._leftMovableBorder = this._rightMovableBorder = -1;
|
40338
|
-
|
40339
|
-
this._clickedRow = -1;
|
40340
|
-
this._clickedSection = this._clickedGrid = null;
|
40341
|
-
};
|
40342
|
-
|
40343
|
-
/** @private
|
40344
|
-
* @param {number} colIndex
|
40345
|
-
* @param {number} row
|
40346
|
-
* @param {ILayoutGrid} section
|
40347
|
-
* @return {!Object}
|
40348
|
-
*/
|
40349
|
-
DragAndDropTitlePlugin.prototype._getSpan = function(colIndex, row, section) {
|
40350
|
-
var cellSpan = section.getCellColSpan(colIndex, row);
|
40351
|
-
|
40352
|
-
if (cellSpan <= 0) { // The specified cell is being occupied
|
40353
|
-
colIndex += cellSpan; // Convert the given negative index to the spanning cell
|
40354
|
-
cellSpan = section.getCellColSpan(colIndex, row);
|
40355
|
-
}
|
40356
|
-
|
40357
|
-
return { "left": colIndex, "right": (colIndex + cellSpan - 1) };
|
40358
|
-
};
|
40359
|
-
/** @private
|
40360
|
-
* @param {number} col
|
40361
|
-
* @param {number} row
|
40362
|
-
* @param {ILayoutGrid} section
|
40363
|
-
* @return {!Object}
|
40364
|
-
*/
|
40365
|
-
DragAndDropTitlePlugin.prototype._findMoveableBorder = function(col, row, section) {
|
40366
|
-
if (row < 0 || (!row && row !== 0)) { // Guaranteed to get out of infinite loop by checking undefined, NaN, null
|
40367
|
-
return { "left": 0, "right": (section.getColumnCount() - 1) };
|
40368
|
-
}
|
40369
|
-
var span = this._getSpan(col, row, section);
|
40370
|
-
if (span["right"] >= span["left"]) {
|
40371
|
-
return span;
|
40372
|
-
} else {
|
40373
|
-
return this._findMoveableBorder(col, row - 1, section);
|
40374
|
-
}
|
40375
|
-
};
|
40376
|
-
/**
|
40377
|
-
* @private
|
40378
|
-
*/
|
40379
|
-
DragAndDropTitlePlugin.prototype._renderGuideline = function() {
|
40380
|
-
var colIndex = this._pos["colIndex"];
|
40381
|
-
if(colIndex == null || colIndex < 0) { // undefined, null or negative number
|
40382
|
-
return;
|
40383
|
-
}
|
40384
|
-
|
40385
|
-
var currentSpan = this._getSpan(colIndex, this._clickedRow, this._clickedSection);
|
40386
|
-
var colStart = currentSpan["left"]; // This can be different from colIndex
|
40387
|
-
var colEnd = currentSpan["right"];
|
40388
|
-
var colLeft = this._clickedGrid.getColumnLeft(colStart);
|
40389
|
-
var colWidth = 0;
|
40390
|
-
for(var i = colStart; i <= colEnd; ++i) {
|
40391
|
-
colWidth += this._clickedGrid.getColumnWidth(i);
|
40392
|
-
}
|
40393
|
-
|
40394
|
-
var rightHand = this._pos["x"] > colLeft + colWidth / 2;
|
40395
|
-
var destColumn = (rightHand) ? colEnd + 1 : colStart;
|
40396
|
-
|
40397
|
-
colLeft = this._clickedGrid.getColumnLeft(this._destColumn);
|
40398
|
-
// If destination exceeds the specified bounds
|
40399
|
-
if (destColumn < this._leftMovableBorder) {
|
40400
|
-
destColumn = this._leftMovableBorder;
|
40401
|
-
} else if (destColumn > this._rightMovableBorder) {
|
40402
|
-
destColumn = this._rightMovableBorder + 1;
|
40403
|
-
if(rightHand) {
|
40404
|
-
colLeft -= 4; // Shift guideline to the left if this is the rightmost column
|
40405
|
-
}
|
40406
|
-
}
|
40407
|
-
|
40408
|
-
this._destColumn = destColumn;
|
40409
|
-
this._guideline.style.left = colLeft + "px";
|
40410
|
-
};
|
40411
|
-
/** @private
|
40412
|
-
* @param {!Element|Event|MouseEvent} e
|
40413
|
-
*/
|
40414
|
-
DragAndDropTitlePlugin.prototype._renderDragBox = function(e) {
|
40415
|
-
if(this._noDragBox) {
|
40416
|
-
return;
|
40417
|
-
}
|
40418
|
-
|
40419
|
-
var gridElem = this._clickedGrid.getElement();
|
40420
|
-
var pn = this._dragbox.parentNode;
|
40421
|
-
if(!pn) {
|
40422
|
-
gridElem.appendChild(this._dragbox);
|
40423
|
-
}
|
40424
|
-
|
40425
|
-
var gridRect = gridElem.getBoundingClientRect();
|
40426
|
-
var zoomFactor = this._clickedGrid["zoomFactor"]; // TODO: Remove zoom factor
|
40427
|
-
var contentWidth = gridRect.width;
|
40428
|
-
|
40429
|
-
var x = e.clientX - gridRect.left;
|
40430
|
-
var y = ((e.pageY - gridRect.top) / zoomFactor) - window.scrollY;
|
40431
|
-
var midFactor = parseFloat((x / contentWidth).toFixed(2));
|
40432
|
-
var dragboxLeft = (gridRect.width * midFactor) / zoomFactor - this._dragbox.offsetWidth * midFactor;
|
40433
|
-
|
40434
|
-
this._dragbox.style.left = dragboxLeft + "px";
|
40435
|
-
this._dragbox.style.top = (y + 10) + "px";
|
40436
|
-
};
|
40437
|
-
|
40438
|
-
/**
|
40439
|
-
* @private
|
40440
|
-
* @param {boolean} inOut
|
40441
|
-
*/
|
40442
|
-
DragAndDropTitlePlugin.prototype._dimCol = function(inOut) {
|
40443
|
-
for (var i = this._startColumn; i <= this._endColumn; i++) {
|
40444
|
-
this._clickedGrid.enableColumnClass(i, "drag-fadeout", inOut);
|
40445
|
-
}
|
40446
|
-
};
|
40447
|
-
|
40448
|
-
DragAndDropTitlePlugin._proto = DragAndDropTitlePlugin.prototype;
|
40449
|
-
|
40450
|
-
/* harmony default export */ var plugins_DragAndDropTitlePlugin = (DragAndDropTitlePlugin);
|
40451
|
-
|
40452
|
-
|
40453
39749
|
// CONCATENATED MODULE: ./src/js/Grid.js
|
40454
39750
|
/* eslint-disable */
|
40455
39751
|
|
@@ -40524,9 +39820,11 @@ DragAndDropTitlePlugin._proto = DragAndDropTitlePlugin.prototype;
|
|
40524
39820
|
* @property {number=} dataConflationRate=0 set delay for data to avoid to much sorting operation when data changed
|
40525
39821
|
* @property {Function=} dataComposed Handler for dataComposed event
|
40526
39822
|
* @property {boolean=} autoDateConversion=false If enabled, date-time field with numeric value will be automatically converted to native date object.
|
40527
|
-
* @property {boolean=} textSelect=false If enabled, user can select text
|
39823
|
+
* @property {boolean=} textSelect=false If enabled, user can select content text by using mouse drag.
|
40528
39824
|
* @property {string=} lang laguage for config localization date time, if null the default language is "en"
|
40529
39825
|
* @property {Element=} scrollbarParent=null Element to be attached by grid's scrollbars, allowing them to move outside and avoid overlapping with the content.
|
39826
|
+
* @property {boolean=} formulaEngine=false If enabled, field with leading equal sign will be treated as a formula and rows will be filled with the calculated values.
|
39827
|
+
* @property {number=} adcPollingInterval=0 Length of polling interval for refreshing ADC data in milliseconds. The default value (0) means no polling.
|
40530
39828
|
*/
|
40531
39829
|
|
40532
39830
|
/** @typedef {number|string|RowDefinition} Grid~RowReference
|
@@ -40712,6 +40010,7 @@ var Grid = function(placeholder, config) {
|
|
40712
40010
|
t._onFieldLoadedError = t._onFieldLoadedError.bind(t);
|
40713
40011
|
|
40714
40012
|
t._snapshotFillerDataChanged = t._snapshotFillerDataChanged.bind(t);
|
40013
|
+
t._onPollingInterval = t._onPollingInterval.bind(t);
|
40715
40014
|
|
40716
40015
|
t._streamingConflator = new Conflator(50, t._updateStreamingData);
|
40717
40016
|
t._formulaConflator = new Conflator(300, t._onFormulaDataChanged);
|
@@ -40725,6 +40024,12 @@ var Grid = function(placeholder, config) {
|
|
40725
40024
|
t._grid = new Core();
|
40726
40025
|
t._grid._wrapper = this; // For back referencing
|
40727
40026
|
|
40027
|
+
t._sorter = new js_RowDefSorter();
|
40028
|
+
t._sorter.setContext("grid", this);
|
40029
|
+
t._sorter.setContext("core", t._grid); // TODO: Handle multiple core grids
|
40030
|
+
|
40031
|
+
t._dateTimeUtil = DateTime;
|
40032
|
+
|
40728
40033
|
t._grid.listen("columnAdded", t._onColumnAdded); // Columns could be added by some plugins
|
40729
40034
|
|
40730
40035
|
if(config) {
|
@@ -40736,20 +40041,15 @@ var Grid = function(placeholder, config) {
|
|
40736
40041
|
|
40737
40042
|
var core = t._mainGrid.getCoreGrid();
|
40738
40043
|
t._stp = core.getPlugin("SortableTitlePlugin");
|
40739
|
-
t._dtp = core.getPlugin("DragAndDropTitlePlugin");
|
40740
40044
|
}
|
40741
40045
|
if(config["SortableTitle"]) { // Exception for built-in plugin
|
40742
40046
|
t._stp = config["SortableTitle"];
|
40743
40047
|
}
|
40744
|
-
if(config["DragAndDropTitle"]) { // Exception for built-in plugin
|
40745
|
-
t._dtp = config["DragAndDropTitle"];
|
40746
|
-
}
|
40747
40048
|
}
|
40748
40049
|
if(!t._sharedDataSource) {
|
40749
40050
|
t._dc = new DataCache_DataCache();
|
40750
40051
|
t._dc.listen("dataChanged", t._onDataChanged);
|
40751
40052
|
t._dc.listen("dataComposed", t._onDataComposed);
|
40752
|
-
t._dc.listen("dataComposed", t._recalculateFormulas); // This will be called after _onDataComposed
|
40753
40053
|
|
40754
40054
|
t._dt = new DataTable();
|
40755
40055
|
t._dt.setSortingLogic(/** @type{Function} */(t._mainSorter));
|
@@ -40760,7 +40060,7 @@ var Grid = function(placeholder, config) {
|
|
40760
40060
|
t._grid.setDataSource(t._dv); // Avoid triggering sorting
|
40761
40061
|
|
40762
40062
|
if(t._stp) {
|
40763
|
-
|
40063
|
+
t._sharedSorter = true;
|
40764
40064
|
t._stp.listen("preDataSorting", t._onPreDataSorting);
|
40765
40065
|
t._grid.loadPlugin(t._stp); // The plugin instance is shared and don't need to be reconfigured.
|
40766
40066
|
} else { // Create built-in plugin
|
@@ -40777,10 +40077,6 @@ var Grid = function(placeholder, config) {
|
|
40777
40077
|
// beforeInit is not called.
|
40778
40078
|
t._grid.loadPlugin(t._stp, config);
|
40779
40079
|
}
|
40780
|
-
if(!t._dtp) { // Create built-in plugin
|
40781
|
-
t._dtp = new DragAndDropTitlePlugin();
|
40782
|
-
}
|
40783
|
-
t._grid.loadPlugin(t._dtp);
|
40784
40080
|
|
40785
40081
|
t._grid.listen("preSectionRender", t._onColumnHeaderBinding);
|
40786
40082
|
t._grid.listen("postSectionDataBinding", t._onPostSectionDataBinding);
|
@@ -40800,10 +40096,6 @@ var Grid = function(placeholder, config) {
|
|
40800
40096
|
t._connector.addEventListener("fieldAdded", t._onFieldAdded.bind(t));
|
40801
40097
|
t._connector.addEventListener("fieldRemoved", t._onFieldRemoved.bind(t));
|
40802
40098
|
|
40803
|
-
t._fnEngine = new Engine();
|
40804
|
-
t._fnEngine.addEventListener("dataChanged", t._onFormulaDataChanged);
|
40805
|
-
t._fnEngine.addEventListener("dataRequired", t._onFormulaDataRequired);
|
40806
|
-
|
40807
40099
|
t.initialize(config);
|
40808
40100
|
t.initSubscription();
|
40809
40101
|
|
@@ -40857,10 +40149,6 @@ Grid.prototype._subs = null;
|
|
40857
40149
|
* @private
|
40858
40150
|
*/
|
40859
40151
|
Grid.prototype._stp = null;
|
40860
|
-
/** @type {DragAndDropTitlePlugin}
|
40861
|
-
* @private
|
40862
|
-
*/
|
40863
|
-
Grid.prototype._dtp = null;
|
40864
40152
|
/** @type {Function}
|
40865
40153
|
* @private
|
40866
40154
|
*/
|
@@ -40878,6 +40166,10 @@ Grid.prototype._snapshot = null;
|
|
40878
40166
|
* @type {DataConnector}
|
40879
40167
|
*/
|
40880
40168
|
Grid.prototype._connector = null;
|
40169
|
+
/** @private
|
40170
|
+
* @type {RowDefSorter}
|
40171
|
+
*/
|
40172
|
+
Grid.prototype._sorter = null;
|
40881
40173
|
|
40882
40174
|
/** @private
|
40883
40175
|
* @type {Engine}
|
@@ -40897,10 +40189,6 @@ Grid.prototype._chainMembers = null;
|
|
40897
40189
|
*/
|
40898
40190
|
Grid.prototype._chainConflator = null;
|
40899
40191
|
/** @private
|
40900
|
-
* @type {boolean}
|
40901
|
-
*/
|
40902
|
-
Grid.prototype._hasGroup = false;
|
40903
|
-
/** @private
|
40904
40192
|
* @type {number}
|
40905
40193
|
*/
|
40906
40194
|
Grid.prototype._clientWidth = NaN;
|
@@ -40929,15 +40217,34 @@ Grid.prototype._autoDateConversion = false;
|
|
40929
40217
|
* @type {boolean}
|
40930
40218
|
*/
|
40931
40219
|
Grid.prototype._textSelect = false;
|
40932
|
-
/** @
|
40933
|
-
* @
|
40220
|
+
/** @type {string}
|
40221
|
+
* @private
|
40934
40222
|
*/
|
40935
40223
|
Grid.prototype._lang = null;
|
40936
|
-
/**
|
40224
|
+
/** @type {Object}
|
40225
|
+
* @private
|
40226
|
+
*/
|
40227
|
+
Grid.prototype._dateTimeUtil = null;
|
40228
|
+
/** @type {boolean}
|
40937
40229
|
* @private
|
40938
|
-
* @type {boolean}
|
40939
40230
|
*/
|
40940
40231
|
Grid.prototype._initializing = false;
|
40232
|
+
/** @type {number}
|
40233
|
+
* @private
|
40234
|
+
*/
|
40235
|
+
Grid.prototype._pollingInterval = 0;
|
40236
|
+
/** @type {number}
|
40237
|
+
* @private
|
40238
|
+
*/
|
40239
|
+
Grid.prototype._pollingTimerId = 0;
|
40240
|
+
/** @type {number}
|
40241
|
+
* @private
|
40242
|
+
*/
|
40243
|
+
Grid.prototype._lastPollingRequest = 0;
|
40244
|
+
/** @type {boolean}
|
40245
|
+
* @private
|
40246
|
+
*/
|
40247
|
+
Grid.prototype._pollingEnabled = true;
|
40941
40248
|
|
40942
40249
|
|
40943
40250
|
/** @public
|
@@ -40948,8 +40255,13 @@ Grid.prototype.dispose = function() {
|
|
40948
40255
|
clearInterval(this._autoLayoutTimer);
|
40949
40256
|
this._autoLayoutTimer = 0;
|
40950
40257
|
}
|
40258
|
+
if(this._pollingTimerId) {
|
40259
|
+
clearTimeout(this._pollingTimerId);
|
40260
|
+
this._pollingTimerId = 0;
|
40261
|
+
}
|
40951
40262
|
this.removeAllColumns(); // Some conflators are reset
|
40952
40263
|
this.removeAllRows(); // Some conflators are reset
|
40264
|
+
this._sorter.dispose();
|
40953
40265
|
this._grid.dispose();
|
40954
40266
|
this._connector.reset();
|
40955
40267
|
|
@@ -41175,6 +40487,12 @@ Grid.prototype.initialize = function(gridOption) {
|
|
41175
40487
|
js_StyleLoader.chainIcon = gridOption["icons"]["rowGrouping"]["expander"];
|
41176
40488
|
}
|
41177
40489
|
|
40490
|
+
if(gridOption["formulaEngine"]) {
|
40491
|
+
t._fnEngine = new Engine();
|
40492
|
+
t._fnEngine.addEventListener("dataChanged", t._onFormulaDataChanged);
|
40493
|
+
t._fnEngine.addEventListener("dataRequired", t._onFormulaDataRequired);
|
40494
|
+
}
|
40495
|
+
|
41178
40496
|
var borders = gridOption["borders"];
|
41179
40497
|
if (borders != null) {
|
41180
40498
|
grid.toggleBorders(borders);
|
@@ -41205,14 +40523,6 @@ Grid.prototype.initialize = function(gridOption) {
|
|
41205
40523
|
grid.getSection("title").setDefaultRowHeight(hRowHeight);
|
41206
40524
|
}
|
41207
40525
|
|
41208
|
-
var noColumnDragging = gridOption["noColumnDragging"];
|
41209
|
-
if (noColumnDragging == null && gridOption["columnReorder"] != null) {
|
41210
|
-
noColumnDragging = !gridOption["columnReorder"];
|
41211
|
-
}
|
41212
|
-
if (noColumnDragging) {
|
41213
|
-
t._dtp.disable();
|
41214
|
-
}
|
41215
|
-
|
41216
40526
|
var val = gridOption["autoLayoutUpdate"];
|
41217
40527
|
if(!t._autoLayoutTimer && val) {
|
41218
40528
|
if(val !== "0" && val !== "false") { // HACK: Temporarily support incorrect data type
|
@@ -41252,6 +40562,10 @@ Grid.prototype.initialize = function(gridOption) {
|
|
41252
40562
|
if(gridOption["scrollbarParent"] != null) {
|
41253
40563
|
t._setScrollbarParent(gridOption["scrollbarParent"]);
|
41254
40564
|
}
|
40565
|
+
var pollingInterval = gridOption["adcPollingInterval"];
|
40566
|
+
if(pollingInterval != null) {
|
40567
|
+
t._pollingInterval = pollingInterval ? +pollingInterval : 0;
|
40568
|
+
}
|
41255
40569
|
|
41256
40570
|
// Column operations
|
41257
40571
|
t.setColumns(cols);
|
@@ -41326,7 +40640,7 @@ Grid.prototype.initialize = function(gridOption) {
|
|
41326
40640
|
var lang = gridOption["lang"];
|
41327
40641
|
if(lang != null) {
|
41328
40642
|
t._lang = lang;
|
41329
|
-
|
40643
|
+
t._dateTimeUtil.setLocale(lang);
|
41330
40644
|
}
|
41331
40645
|
|
41332
40646
|
// Row operations
|
@@ -41466,13 +40780,19 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
41466
40780
|
obj["autoDateConversion"] = true;
|
41467
40781
|
}
|
41468
40782
|
|
41469
|
-
if
|
40783
|
+
if(this._textSelect) {
|
41470
40784
|
obj["textSelect"] = true;
|
41471
40785
|
}
|
41472
40786
|
|
41473
|
-
if
|
40787
|
+
if(this._lang) {
|
41474
40788
|
obj["lang"] = this._lang;
|
41475
40789
|
}
|
40790
|
+
if(this._fnEngine) {
|
40791
|
+
obj["formulaEngine"] = true;
|
40792
|
+
}
|
40793
|
+
if(this._pollingInterval) {
|
40794
|
+
obj["adcPollingInterval"] = this._pollingInterval;
|
40795
|
+
}
|
41476
40796
|
|
41477
40797
|
// get all rows config
|
41478
40798
|
var rowDefs = this.getAllRowDefinitions();
|
@@ -41508,7 +40828,6 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
41508
40828
|
}
|
41509
40829
|
|
41510
40830
|
// TODO: The following states need to be retrieved
|
41511
|
-
// noColumnDragging
|
41512
40831
|
// rowHighlighting
|
41513
40832
|
// columnVirtualization
|
41514
40833
|
// topFreezingCount, bottomFreezingCount
|
@@ -41519,6 +40838,27 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
41519
40838
|
return obj;
|
41520
40839
|
};
|
41521
40840
|
|
40841
|
+
/** @public
|
40842
|
+
* @ignore
|
40843
|
+
* @param {Object} dateTimeUtil
|
40844
|
+
*/
|
40845
|
+
Grid.prototype.setDateTimeUtil = function(dateTimeUtil) {
|
40846
|
+
if(this._dateTimeUtil !== dateTimeUtil) {
|
40847
|
+
this._dateTimeUtil = dateTimeUtil;
|
40848
|
+
this._dateTimeUtil.setLocale(this._lang);
|
40849
|
+
}
|
40850
|
+
};
|
40851
|
+
/** @public
|
40852
|
+
* @param {string} lang
|
40853
|
+
*/
|
40854
|
+
Grid.prototype.setLocale = function(lang) {
|
40855
|
+
if(lang && this._lang !== lang) {
|
40856
|
+
this._lang = lang;
|
40857
|
+
this._dateTimeUtil.setLocale(lang);
|
40858
|
+
this._grid.requestRowRefresh();
|
40859
|
+
}
|
40860
|
+
};
|
40861
|
+
|
41522
40862
|
/** @private
|
41523
40863
|
* @param {Object} defaultCol
|
41524
40864
|
* @param {Array.<Object>} userColumns
|
@@ -41624,10 +40964,6 @@ Grid.prototype._onFieldRemoved = function(e) {
|
|
41624
40964
|
* @param {number=} idx
|
41625
40965
|
*/
|
41626
40966
|
Grid.prototype.insertColumn = function (columnOption, idx) {
|
41627
|
-
if (typeof columnOption === "string") {
|
41628
|
-
columnOption = { field: columnOption };
|
41629
|
-
}
|
41630
|
-
|
41631
40967
|
var colCount = this.getColumnCount();
|
41632
40968
|
if(idx == null || idx > colCount) {
|
41633
40969
|
idx = colCount;
|
@@ -41635,16 +40971,26 @@ Grid.prototype.insertColumn = function (columnOption, idx) {
|
|
41635
40971
|
|
41636
40972
|
// no need to merge defaultColumn during initialize process
|
41637
40973
|
// because columnOption already mutate by initialize function
|
41638
|
-
var
|
41639
|
-
Grid._objectAssign(userOptions, columnOption);
|
41640
|
-
userOptions["formulaEngine"] = this._fnEngine; // Adding extra option
|
40974
|
+
var configObj = (this._initializing) ? {} : Object(Util["b" /* cloneObject */])(this._defaultColumnOptions);
|
41641
40975
|
|
41642
|
-
|
41643
|
-
|
40976
|
+
if (typeof columnOption === "string") {
|
40977
|
+
configObj["field"] = columnOption;
|
40978
|
+
} else { // columnOption is assumed to be an object
|
40979
|
+
for (var key in columnOption) {
|
40980
|
+
configObj[key] = columnOption[key];
|
40981
|
+
}
|
40982
|
+
}
|
40983
|
+
|
40984
|
+
if(this._fnEngine) {
|
40985
|
+
configObj["formulaEngine"] = this._fnEngine; // Adding extra option
|
40986
|
+
}
|
40987
|
+
|
40988
|
+
var colDef = new ColumnDefinition(configObj, this);
|
40989
|
+
configObj[COL_DEF] = colDef;
|
41644
40990
|
|
41645
40991
|
// WARNING: width is processed twice by tr-grid and rt-grid
|
41646
40992
|
// Inserting column also initializes prefined formatter
|
41647
|
-
this._grid.insertColumn(idx,
|
40993
|
+
this._grid.insertColumn(idx, configObj); // columnAdded is fired
|
41648
40994
|
};
|
41649
40995
|
|
41650
40996
|
|
@@ -42112,6 +41458,11 @@ Grid.prototype.removeDataFields = function(fieldRef, referrer) {
|
|
42112
41458
|
* @param {string=} opt_order This can be "ascending", "descending", "none", "noOrder", or "originalOrder"
|
42113
41459
|
*/
|
42114
41460
|
Grid.prototype.sortColumn = function(colRef, opt_order) {
|
41461
|
+
if(typeof colRef === "string") {
|
41462
|
+
this._stp.sortColumn(colRef, opt_order); // Allow sorting by field
|
41463
|
+
return;
|
41464
|
+
}
|
41465
|
+
|
42115
41466
|
var colIndex = this.getColumnIndex(colRef);
|
42116
41467
|
if(colIndex < 0) {
|
42117
41468
|
this._stp.sortColumn(this.getSortedColumnIndex(), "n"); // reset current sorting
|
@@ -42212,9 +41563,9 @@ Grid.prototype.setColumnSorter = function(colRef, func) {
|
|
42212
41563
|
if(colDef) {
|
42213
41564
|
colDef.setSorter(func);
|
42214
41565
|
|
42215
|
-
var sortedColumn = this.getSortedColumnIndex();
|
41566
|
+
var sortedColumn = this.getSortedColumnIndex(); // TODO: Support multi-column sorting
|
42216
41567
|
if(sortedColumn === colIndex) {
|
42217
|
-
this.
|
41568
|
+
this._stp.refresh();
|
42218
41569
|
}
|
42219
41570
|
}
|
42220
41571
|
};
|
@@ -42256,9 +41607,6 @@ Grid.prototype.insertRow = function(rowOption, rowRef) {
|
|
42256
41607
|
var rowDef = new RowDefinition(rowOption);
|
42257
41608
|
rowDef.setDataSource(this._dc); // This could also subscribe chain index/ric to JET/RTK
|
42258
41609
|
this._initDuplicateRicData(rowDef);
|
42259
|
-
if(rowDef.isFixedPosition()) {
|
42260
|
-
this._hasGroup = true; // HACK: This is temporary solution
|
42261
|
-
}
|
42262
41610
|
|
42263
41611
|
rowDef.registerToView(this._dv, this._getRowId(rowRef));
|
42264
41612
|
if(rowOption && rowOption["hidden"]) {
|
@@ -42303,7 +41651,6 @@ Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
|
|
42303
41651
|
}
|
42304
41652
|
this.insertRow(rowOption, rowId); // Note that data view is being frozen, so only using row id will work properly
|
42305
41653
|
}
|
42306
|
-
this._updateGroupOrder(); // TODO: Update group order for all scenarios
|
42307
41654
|
this._dt.freeze(prevState);
|
42308
41655
|
};
|
42309
41656
|
/** Add multiple rows without `ric` property in {@link RowDefinition}
|
@@ -43076,7 +42423,7 @@ Grid.prototype.updateColumnTitle = function() {
|
|
43076
42423
|
* @return {boolean}
|
43077
42424
|
*/
|
43078
42425
|
Grid.prototype.isSorting = function() {
|
43079
|
-
return this.
|
42426
|
+
return this._stp.isSorting();
|
43080
42427
|
};
|
43081
42428
|
/** @public
|
43082
42429
|
* @return {number}
|
@@ -43093,7 +42440,7 @@ Grid.prototype.getSortOrder = function() {
|
|
43093
42440
|
/** @public
|
43094
42441
|
*/
|
43095
42442
|
Grid.prototype.clearSort = function() {
|
43096
|
-
this._stp.clearSortState();
|
42443
|
+
this._stp.clearSortState(); // WARNING: No event is dispatched
|
43097
42444
|
};
|
43098
42445
|
|
43099
42446
|
/** @private
|
@@ -43191,43 +42538,38 @@ Grid.prototype._updateStreamingData = function() {
|
|
43191
42538
|
this._dt.dispatchGlobalChange();
|
43192
42539
|
}
|
43193
42540
|
};
|
42541
|
+
|
43194
42542
|
/** @private
|
42543
|
+
* @param {Object} e
|
43195
42544
|
*/
|
43196
|
-
Grid.prototype.
|
43197
|
-
|
43198
|
-
|
43199
|
-
|
43200
|
-
|
43201
|
-
//
|
43202
|
-
var
|
43203
|
-
|
43204
|
-
|
43205
|
-
|
43206
|
-
|
43207
|
-
|
43208
|
-
|
43209
|
-
|
43210
|
-
|
43211
|
-
if(
|
43212
|
-
|
42545
|
+
Grid.prototype._onPreDataSorting = function (e) {
|
42546
|
+
var field = "";
|
42547
|
+
var rowSorting = false;
|
42548
|
+
var sortLogic = null;
|
42549
|
+
|
42550
|
+
var states = this._stp.getSortingStates(); // WARNING: Use of deprecated function
|
42551
|
+
var state = states ? states[0] : null; // TODO: Support multi-column sorting
|
42552
|
+
|
42553
|
+
if(state) {
|
42554
|
+
field = state["field"] || "";
|
42555
|
+
var colIndex = this._stp.getSortedColumnIndex(0);
|
42556
|
+
var colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
|
42557
|
+
this._sorter.setContext("colIndex", colIndex);
|
42558
|
+
this._sorter.setContext("colDef", colDef);
|
42559
|
+
|
42560
|
+
if(colDef) {
|
42561
|
+
field = colDef.getField(); // WARNING: Field and logic could be out of sync
|
42562
|
+
sortLogic = colDef.getSorter();
|
42563
|
+
rowSorting = colDef.isRowSorting();
|
43213
42564
|
}
|
43214
|
-
prevParent = curParent;
|
43215
|
-
prevFixedState = curFixedState;
|
43216
|
-
dirty |= rowDef.setGroupOrder(groupOrder);
|
43217
42565
|
}
|
43218
|
-
if(
|
43219
|
-
|
42566
|
+
if(!sortLogic && field) {
|
42567
|
+
sortLogic = state["sortLogic"];
|
43220
42568
|
}
|
43221
|
-
};
|
43222
42569
|
|
43223
|
-
|
43224
|
-
|
43225
|
-
|
43226
|
-
Grid.prototype._onPreDataSorting = function (e) {
|
43227
|
-
// TODO: Support multi-column sorting
|
43228
|
-
var colIndex = this._stp.getSortedColumnIndex();
|
43229
|
-
var colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
|
43230
|
-
this._columnSorter = (colDef) ? colDef._prepareSortContext(colIndex) : null;
|
42570
|
+
this._sorter.setField(field);
|
42571
|
+
this._sorter.setSortLogic(sortLogic);
|
42572
|
+
this._columnSorter = this._sorter.getSorter(rowSorting);
|
43231
42573
|
};
|
43232
42574
|
/** @private
|
43233
42575
|
* @param {RowDefinition} rowDefA
|
@@ -43387,6 +42729,9 @@ Grid.prototype._onDataComposed = function(e) {
|
|
43387
42729
|
if(!rowDef) {
|
43388
42730
|
return;
|
43389
42731
|
}
|
42732
|
+
if(!rowDef.getDataSource()) {
|
42733
|
+
return; // Somehow, rowDef is invalid and doesn't have data source
|
42734
|
+
}
|
43390
42735
|
|
43391
42736
|
if(this._autoDateConversion) { // auto data conversion
|
43392
42737
|
var field, value, dataType, colDef;
|
@@ -43412,13 +42757,17 @@ Grid.prototype._onDataComposed = function(e) {
|
|
43412
42757
|
e["rowDef"] = rowDef;
|
43413
42758
|
this._dispatch("dataComposed", e);
|
43414
42759
|
}
|
42760
|
+
|
42761
|
+
this._recalculateFormulas(e);
|
43415
42762
|
};
|
43416
42763
|
|
43417
42764
|
/** @private
|
43418
42765
|
* @param {Object=} e
|
43419
42766
|
*/
|
43420
42767
|
Grid.prototype._recalculateFormulas = function(e) {
|
43421
|
-
if(this._fnEngine.getFormulaCount() <= 0) {
|
42768
|
+
if(!this._fnEngine || this._fnEngine.getFormulaCount() <= 0) {
|
42769
|
+
return;
|
42770
|
+
}
|
43422
42771
|
|
43423
42772
|
if(e && e["rid"]) {
|
43424
42773
|
this._fnEngine.calculate(/** @type{Object.<string, *>} */ (e["rowData"]), /** @type{Object.<string, *>} */ (e["changes"]));
|
@@ -43442,6 +42791,64 @@ Grid.prototype._snapshotFillerDataChanged = function (e) {
|
|
43442
42791
|
for (var ric in data) {
|
43443
42792
|
this.setRicData(ric, data[ric]);
|
43444
42793
|
}
|
42794
|
+
if(!this._lastPollingRequest) { // This is the first time we receive successful ADC response
|
42795
|
+
this._lastPollingRequest = 1; // Allow polling to be started
|
42796
|
+
}
|
42797
|
+
this._startPolling();
|
42798
|
+
};
|
42799
|
+
/** @private
|
42800
|
+
*/
|
42801
|
+
Grid.prototype._startPolling = function () {
|
42802
|
+
if(this._pollingEnabled && this._pollingInterval) {
|
42803
|
+
if(this._lastPollingRequest && !this._pollingTimerId) {
|
42804
|
+
var now = new Date();
|
42805
|
+
this._lastPollingRequest = now.getTime();
|
42806
|
+
this._pollingTimerId = setTimeout(this._onPollingInterval, this._pollingInterval);
|
42807
|
+
}
|
42808
|
+
}
|
42809
|
+
};
|
42810
|
+
/** @private
|
42811
|
+
*/
|
42812
|
+
Grid.prototype._onPollingInterval = function () {
|
42813
|
+
this._pollingTimerId = 0;
|
42814
|
+
if(this._pollingEnabled && this._pollingInterval) {
|
42815
|
+
this.refreshADCData();
|
42816
|
+
this._startPolling();
|
42817
|
+
}
|
42818
|
+
};
|
42819
|
+
/** @public
|
42820
|
+
* @param {boolean=} activated=true
|
42821
|
+
*/
|
42822
|
+
Grid.prototype.activateADCPolling = function (activated) {
|
42823
|
+
if(activated !== false) {
|
42824
|
+
this._pollingEnabled = true;
|
42825
|
+
// Make immediate request after re-activation if it has been a long time
|
42826
|
+
var now = new Date();
|
42827
|
+
if(this._lastPollingRequest) {
|
42828
|
+
var diff = now.getTime() - this._lastPollingRequest;
|
42829
|
+
if(diff > this._pollingInterval) {
|
42830
|
+
this.refreshADCData();
|
42831
|
+
}
|
42832
|
+
}
|
42833
|
+
this._startPolling();
|
42834
|
+
} else {
|
42835
|
+
this._pollingEnabled = false;
|
42836
|
+
}
|
42837
|
+
};
|
42838
|
+
/** Force re-requesting ADC data to immediately update the data
|
42839
|
+
* @public
|
42840
|
+
* @return {boolean} Return true, if a request has been made
|
42841
|
+
*/
|
42842
|
+
Grid.prototype.refreshADCData = function () {
|
42843
|
+
var dirty = this._snapshot.addFields(this._connector.getAllFields());
|
42844
|
+
if(dirty) {
|
42845
|
+
dirty = this._snapshot.addRics(this._connector.getAllRics());
|
42846
|
+
if(dirty) {
|
42847
|
+
return true;
|
42848
|
+
}
|
42849
|
+
}
|
42850
|
+
this._lastPollingRequest = 0; // No ADC field or RIC detected. Prevent polling from continuing
|
42851
|
+
return false;
|
43445
42852
|
};
|
43446
42853
|
|
43447
42854
|
/** @private
|
@@ -43500,17 +42907,6 @@ Grid.prototype._logData = function(rowDefs, options) {
|
|
43500
42907
|
console.table(tbl); // eslint-disable-line
|
43501
42908
|
};
|
43502
42909
|
|
43503
|
-
/** @private
|
43504
|
-
* @function
|
43505
|
-
* @param {Object} to
|
43506
|
-
* @param {Object} from
|
43507
|
-
*/
|
43508
|
-
Grid._objectAssign = function (to, from) {
|
43509
|
-
for (var key in from) {
|
43510
|
-
to[key] = from[key];
|
43511
|
-
}
|
43512
|
-
};
|
43513
|
-
|
43514
42910
|
|
43515
42911
|
/* harmony default export */ var js_Grid = (Grid);
|
43516
42912
|
|