@refinitiv-ui/efx-grid 6.0.25 → 6.0.26
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.css +1 -1
- package/lib/core/dist/core.js +1 -1
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/util/ElementFrameWork.js +1 -1
- package/lib/core/es6/tr-grid-theme.js +1 -1
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +61 -2
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.d.ts +3 -1
- package/lib/rt-grid/es6/Grid.js +8 -1
- package/lib/rt-grid/es6/RowDefinition.d.ts +14 -1
- package/lib/rt-grid/es6/RowDefinition.js +54 -2
- package/lib/tr-grid-column-selection/es6/ColumnSelection.d.ts +13 -11
- package/lib/tr-grid-column-selection/es6/ColumnSelection.js +233 -81
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +5 -3
- package/lib/tr-grid-range-bar/es6/RangeBar.d.ts +18 -9
- package/lib/tr-grid-range-bar/es6/RangeBar.js +318 -139
- package/lib/types/es6/ColumnSelection.d.ts +13 -11
- package/lib/types/es6/ColumnStack.d.ts +3 -3
- package/lib/types/es6/Core/grid/Core.d.ts +1 -1
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +3 -1
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +14 -1
- package/lib/types/es6/index.d.ts +1 -1
- package/lib/versions.json +3 -3
- package/package.json +1 -1
@@ -224,6 +224,8 @@ declare class Grid extends EventDispatcher {
|
|
224
224
|
|
225
225
|
public getColumnDefinitionsById(colIds: (string)[]|null): ColumnDefinition|null;
|
226
226
|
|
227
|
+
public getRowType(rowRef: number|string|null): string;
|
228
|
+
|
227
229
|
public getRowDefinition(rowRef: number|string|null): RowDefinition|null;
|
228
230
|
|
229
231
|
public getRowDefinitions(): (RowDefinition)[];
|
@@ -312,7 +314,7 @@ declare class Grid extends EventDispatcher {
|
|
312
314
|
|
313
315
|
declare function borders(gridOptions?: any): any;
|
314
316
|
|
315
|
-
declare function colCount(rowRef: number|string|null):
|
317
|
+
declare function colCount(rowRef: number|string|null): string;
|
316
318
|
|
317
319
|
export { Grid };
|
318
320
|
export default Grid;
|
package/lib/rt-grid/es6/Grid.js
CHANGED
@@ -2788,7 +2788,14 @@ Grid.prototype._getColumnDefinition = function(colRef) {
|
|
2788
2788
|
}
|
2789
2789
|
return null;
|
2790
2790
|
};
|
2791
|
-
|
2791
|
+
/** @public
|
2792
|
+
* @param {number|string} rowRef Row index as shown in the view or row id (string)
|
2793
|
+
* @return {string}
|
2794
|
+
*/
|
2795
|
+
Grid.prototype.getRowType = function(rowRef) {
|
2796
|
+
var rowDef = this.getRowDefinition(rowRef);
|
2797
|
+
return rowDef ? rowDef.getType() : "";
|
2798
|
+
};
|
2792
2799
|
/** @public
|
2793
2800
|
* @param {number|string} rowRef Row index as shown in the view or row id (string)
|
2794
2801
|
* @return {RowDefinition}
|
@@ -15,6 +15,15 @@ declare namespace RowDefinition {
|
|
15
15
|
hidden?: boolean|null
|
16
16
|
};
|
17
17
|
|
18
|
+
type RowTypes = {
|
19
|
+
CONTENT: string,
|
20
|
+
CHAIN: string,
|
21
|
+
CONSTITUENT: string,
|
22
|
+
GROUP_HEADER: string,
|
23
|
+
SUBGROUP_HEADER: string,
|
24
|
+
GROUP_MEMBER: string
|
25
|
+
};
|
26
|
+
|
18
27
|
}
|
19
28
|
|
20
29
|
declare class RowDefinition {
|
@@ -35,6 +44,8 @@ declare class RowDefinition {
|
|
35
44
|
|
36
45
|
public getDataId(): string;
|
37
46
|
|
47
|
+
public getType(): string;
|
48
|
+
|
38
49
|
public setDataSource(dataSource: DataCache|null): void;
|
39
50
|
|
40
51
|
public getDataSource(): DataCache|null;
|
@@ -125,7 +136,9 @@ declare class RowDefinition {
|
|
125
136
|
|
126
137
|
declare const ROW_DEF: string;
|
127
138
|
|
139
|
+
declare const ROW_TYPES: RowDefinition.RowTypes|null;
|
140
|
+
|
128
141
|
declare function rowData(userInput: string): boolean;
|
129
142
|
|
130
|
-
export {RowDefinition, ROW_DEF};
|
143
|
+
export {RowDefinition, ROW_DEF, ROW_TYPES};
|
131
144
|
export default RowDefinition;
|
@@ -16,12 +16,34 @@ import { DataTable } from "../../core/es6/data/DataTable.js";
|
|
16
16
|
* @property {boolean=} hidden=true When this row is hidden
|
17
17
|
*/
|
18
18
|
|
19
|
+
/** @typedef {Object} RowDefinition~RowTypes
|
20
|
+
* @property {string} CONTENT="CONTENT"
|
21
|
+
* @property {string} CHAIN="CHAIN"
|
22
|
+
* @property {string} CONSTITUENT="CONSTITUENT"
|
23
|
+
* @property {string} GROUP_HEADER="GROUP_HEADER"
|
24
|
+
* @property {string} SUBGROUP_HEADER="SUBGROUP_HEADER"
|
25
|
+
* @property {string} GROUP_MEMBER="GROUP_MEMBER"
|
26
|
+
*/
|
27
|
+
|
19
28
|
/** @type {string}
|
20
29
|
* @public
|
21
30
|
* @const
|
22
31
|
*/
|
23
32
|
var ROW_DEF = "ROW_DEF";
|
24
33
|
|
34
|
+
/** @type {RowDefinition~RowTypes}
|
35
|
+
* @public
|
36
|
+
* @const
|
37
|
+
*/
|
38
|
+
var ROW_TYPES = {
|
39
|
+
CONTENT: "CONTENT",
|
40
|
+
CHAIN: "CHAIN",
|
41
|
+
CONSTITUENT: "CONSTITUENT",
|
42
|
+
GROUP_HEADER: "GROUP_HEADER",
|
43
|
+
SUBGROUP_HEADER: "SUBGROUP_HEADER",
|
44
|
+
GROUP_MEMBER: "GROUP_MEMBER"
|
45
|
+
};
|
46
|
+
|
25
47
|
/** @constructor
|
26
48
|
* @param {RowDefinition~Options=} rowOptions
|
27
49
|
*/
|
@@ -394,7 +416,37 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
|
|
394
416
|
RowDefinition.prototype.getDataId = function() {
|
395
417
|
return this._dataId;
|
396
418
|
};
|
397
|
-
|
419
|
+
/** @public
|
420
|
+
* @return {string}
|
421
|
+
*/
|
422
|
+
RowDefinition.prototype.getType = function() {
|
423
|
+
if(this._isChain) {
|
424
|
+
return ROW_TYPES.CHAIN;
|
425
|
+
} else if(this._parent) {
|
426
|
+
return ROW_TYPES.CONSTITUENT;
|
427
|
+
} else {
|
428
|
+
var dv = this._view;
|
429
|
+
if(dv) {
|
430
|
+
var rid = this.getRowId();
|
431
|
+
var separator = dv.isSegmentSeparator(rid);
|
432
|
+
var level = dv.getSegmentLevel(rid);
|
433
|
+
if(separator) {
|
434
|
+
if(level === 1) {
|
435
|
+
return ROW_TYPES.GROUP_HEADER;
|
436
|
+
} else {
|
437
|
+
return ROW_TYPES.SUBGROUP_HEADER;
|
438
|
+
}
|
439
|
+
} else {
|
440
|
+
if(dv.getSegmentParentRowId(rid)) {
|
441
|
+
return ROW_TYPES.GROUP_MEMBER;
|
442
|
+
}
|
443
|
+
}
|
444
|
+
} else {
|
445
|
+
return "";
|
446
|
+
}
|
447
|
+
}
|
448
|
+
return ROW_TYPES.CONTENT;
|
449
|
+
};
|
398
450
|
/** This method should always be called right after the initialization
|
399
451
|
* @public
|
400
452
|
* @param {DataCache} dataSource
|
@@ -1079,5 +1131,5 @@ RowDefinition.dispose = function(rowDef) {
|
|
1079
1131
|
rowDef.dispose();
|
1080
1132
|
};
|
1081
1133
|
|
1082
|
-
export {RowDefinition, ROW_DEF};
|
1134
|
+
export {RowDefinition, ROW_DEF, ROW_TYPES};
|
1083
1135
|
export default RowDefinition;
|
@@ -7,22 +7,22 @@ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
|
7
7
|
declare namespace ColumnSelectionPlugin {
|
8
8
|
|
9
9
|
type Options = {
|
10
|
-
singleSelection?: boolean,
|
11
|
-
clickToggle?: boolean,
|
12
|
-
selectionChanged?: ((...params: any[]) => any),
|
13
|
-
menuClicked?: ((...params: any[]) => any),
|
14
|
-
menuPosition?: string
|
10
|
+
singleSelection?: boolean|null,
|
11
|
+
clickToggle?: boolean|null,
|
12
|
+
selectionChanged?: ((...params: any[]) => any)|null,
|
13
|
+
menuClicked?: ((...params: any[]) => any)|null,
|
14
|
+
menuPosition?: string|null
|
15
15
|
};
|
16
16
|
|
17
17
|
type ColumnOptions = {
|
18
|
-
unselectable?: boolean
|
18
|
+
unselectable?: boolean|null
|
19
19
|
};
|
20
20
|
|
21
21
|
}
|
22
22
|
|
23
23
|
declare class ColumnSelectionPlugin extends GridPlugin {
|
24
24
|
|
25
|
-
constructor(options?: ColumnSelectionPlugin.Options);
|
25
|
+
constructor(options?: ColumnSelectionPlugin.Options|null);
|
26
26
|
|
27
27
|
public getName(): string;
|
28
28
|
|
@@ -34,7 +34,7 @@ declare class ColumnSelectionPlugin extends GridPlugin {
|
|
34
34
|
|
35
35
|
public getConfigObject(gridOptions?: any): any;
|
36
36
|
|
37
|
-
public disable(opt_bool?: boolean): void;
|
37
|
+
public disable(opt_bool?: boolean|null): void;
|
38
38
|
|
39
39
|
public isEnabled(): boolean;
|
40
40
|
|
@@ -46,9 +46,11 @@ declare class ColumnSelectionPlugin extends GridPlugin {
|
|
46
46
|
|
47
47
|
public getLastSelectedColumn(): number;
|
48
48
|
|
49
|
-
public setSelectedColumn(colIndex: number, opt_select?: boolean, opt_grid?: any): boolean;
|
49
|
+
public setSelectedColumn(colIndex: number, opt_select?: boolean|null, opt_grid?: any): boolean;
|
50
50
|
|
51
|
-
public selectSingleColumn(opt_colIndex?: (number|null), opt_grid?: any): void;
|
51
|
+
public selectSingleColumn(opt_colIndex?: (number|null)|null, opt_grid?: any): void;
|
52
|
+
|
53
|
+
public selectSingleGroup(groupId: string, opt_grid?: any): void;
|
52
54
|
|
53
55
|
public selectRange(anchorIndex: number, len: number, opt_grid?: any): void;
|
54
56
|
|
@@ -58,7 +60,7 @@ declare class ColumnSelectionPlugin extends GridPlugin {
|
|
58
60
|
|
59
61
|
public clearSelectedColumns(): void;
|
60
62
|
|
61
|
-
public clearSelection(cols?: (number|(number)[])): void;
|
63
|
+
public clearSelection(cols?: (number|(number)[])|null): void;
|
62
64
|
|
63
65
|
public selectAll(): void;
|
64
66
|
|
@@ -115,6 +115,12 @@ ColumnSelectionPlugin.prototype._menuButton = null;
|
|
115
115
|
*/
|
116
116
|
|
117
117
|
ColumnSelectionPlugin.prototype._menuPosition = "outside";
|
118
|
+
/** @type {Object}
|
119
|
+
* @private
|
120
|
+
*/
|
121
|
+
|
122
|
+
ColumnSelectionPlugin.prototype._cgp = null; // Column grouping extension
|
123
|
+
|
118
124
|
/** @public
|
119
125
|
* @return {string}
|
120
126
|
*/
|
@@ -152,15 +158,12 @@ ColumnSelectionPlugin.prototype.initialize = function (host, options) {
|
|
152
158
|
host.listen("columnPositionChanged", this._onColumnPositionChanged);
|
153
159
|
this.config(options);
|
154
160
|
|
155
|
-
if (
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
} else {
|
160
|
-
ColumnSelectionPlugin._stylePromise = ElfUtil.getThemeColors();
|
161
|
+
if (ColumnSelectionPlugin._stylePromise) {
|
162
|
+
ColumnSelectionPlugin._applyThemeColor(host);
|
163
|
+
} else {
|
164
|
+
ColumnSelectionPlugin._stylePromise = ElfUtil.getThemeColors();
|
161
165
|
|
162
|
-
|
163
|
-
}
|
166
|
+
ColumnSelectionPlugin._stylePromise.then(this._onThemeLoaded)["catch"](this._onThemeLoaded);
|
164
167
|
}
|
165
168
|
};
|
166
169
|
/** @private
|
@@ -170,7 +173,7 @@ ColumnSelectionPlugin.prototype.initialize = function (host, options) {
|
|
170
173
|
ColumnSelectionPlugin.prototype._onThemeLoaded = function () {
|
171
174
|
if (!ColumnSelectionPlugin._styles) {
|
172
175
|
var styles = [".column-selection-menu", ["position: absolute;", "background-color: var(--grid-column-menu-icon-bgcolor);", "color: var(--grid-column-menu-icon-color);", "z-index: 1;", "cursor: pointer;", "text-align: center;", "width: 16px;", "height: 16px;", "padding: 6px;"], ".column-selection-menu:hover", ["background-color: var(--grid-column-menu-icon-hover-bgcolor);"], ".column-selection-menu-inside", ["padding: 4px;" // if not outside icon, move to inside
|
173
|
-
]];
|
176
|
+
], ".selected-column .cell.selected-group", ["background-color: var(--grid-selection-bgcolor);"]];
|
174
177
|
ColumnSelectionPlugin._styles = prettifyCss(styles);
|
175
178
|
}
|
176
179
|
|
@@ -194,6 +197,15 @@ ColumnSelectionPlugin._applyThemeColor = function (grid) {
|
|
194
197
|
injectCss(ColumnSelectionPlugin._styles, grid.getParent());
|
195
198
|
}
|
196
199
|
};
|
200
|
+
/**
|
201
|
+
* @protected
|
202
|
+
* @ignore
|
203
|
+
*/
|
204
|
+
|
205
|
+
|
206
|
+
ColumnSelectionPlugin.prototype._afterInit = function () {
|
207
|
+
this._cgp = this._getPlugin("ColumnGroupingPlugin");
|
208
|
+
};
|
197
209
|
/** @public
|
198
210
|
* @param {Object=} host core grid object
|
199
211
|
*/
|
@@ -436,48 +448,13 @@ ColumnSelectionPlugin.prototype.getLastSelectedColumn = function () {
|
|
436
448
|
|
437
449
|
|
438
450
|
ColumnSelectionPlugin.prototype.setSelectedColumn = function (colIndex, opt_select, opt_grid) {
|
439
|
-
|
440
|
-
return false;
|
441
|
-
}
|
442
|
-
|
443
|
-
if (opt_grid) {
|
444
|
-
if (opt_grid !== this._activeGrid) {
|
445
|
-
this._activeGrid = opt_grid; // TODO: Check if the grid is one of the hosts
|
446
|
-
}
|
447
|
-
}
|
448
|
-
|
449
|
-
if (!this._activeGrid) {
|
450
|
-
this._activeGrid = this._hosts[0]; // Select the first grid
|
451
|
-
|
452
|
-
if (!this._activeGrid) {
|
453
|
-
return false;
|
454
|
-
}
|
455
|
-
}
|
456
|
-
|
457
|
-
if (colIndex >= this.getColumnCount()) {
|
458
|
-
return false;
|
459
|
-
}
|
460
|
-
|
461
|
-
var selection = opt_select ? true : false;
|
462
|
-
|
463
|
-
if (selection && this._getColumnOption(colIndex, "unselectable")) {
|
464
|
-
return false;
|
465
|
-
}
|
466
|
-
|
467
|
-
this._hasSelection = selection ? true : null;
|
468
|
-
this._pendingSelectionOnAdded = -1; // New selection happens before resolving the pending selection
|
451
|
+
var dirty = this._setSelectedColumn(colIndex, opt_select, opt_grid);
|
469
452
|
|
470
|
-
|
471
|
-
|
472
|
-
var len = this._hosts.length;
|
473
|
-
|
474
|
-
for (var i = 0; i < len; ++i) {
|
475
|
-
this._hosts[i].selectColumn(colIndex, selection);
|
453
|
+
if (dirty) {
|
454
|
+
this._updateGroupSelection();
|
476
455
|
}
|
477
456
|
|
478
|
-
|
479
|
-
|
480
|
-
return true;
|
457
|
+
return dirty;
|
481
458
|
};
|
482
459
|
/** Select the specified column on an active grid, and clear all other column selections
|
483
460
|
* @public
|
@@ -499,9 +476,42 @@ ColumnSelectionPlugin.prototype.selectSingleColumn = function (opt_colIndex, opt
|
|
499
476
|
var activeGrid = opt_grid || this._activeGrid;
|
500
477
|
this.clearAllSelections();
|
501
478
|
|
502
|
-
if (this.
|
479
|
+
if (this._setSelectedColumn(opt_colIndex, true, activeGrid)) {
|
503
480
|
this._anchorCol = opt_colIndex; // Update the anchor
|
504
481
|
}
|
482
|
+
|
483
|
+
this._updateGroupSelection();
|
484
|
+
};
|
485
|
+
/**
|
486
|
+
* Select the columns in a group on an active grid, and clear all other column selections
|
487
|
+
* This does not working with single selection mode
|
488
|
+
* @public
|
489
|
+
* @param {string} groupId
|
490
|
+
* @param {Object=} opt_grid core grid object
|
491
|
+
*/
|
492
|
+
|
493
|
+
|
494
|
+
ColumnSelectionPlugin.prototype.selectSingleGroup = function (groupId, opt_grid) {
|
495
|
+
var activeGrid = opt_grid || this._activeGrid;
|
496
|
+
var cgp = this._cgp;
|
497
|
+
|
498
|
+
if (!cgp || !groupId) {
|
499
|
+
return;
|
500
|
+
}
|
501
|
+
|
502
|
+
var childIndices = cgp.getChildColumnIndices(groupId);
|
503
|
+
var dirty = false;
|
504
|
+
this.clearAllSelections();
|
505
|
+
|
506
|
+
for (var i = 0; i <= childIndices.length; i++) {
|
507
|
+
dirty |= this._setSelectedColumn(childIndices[i], true, activeGrid);
|
508
|
+
}
|
509
|
+
|
510
|
+
if (dirty) {
|
511
|
+
this._anchorCol = childIndices[0];
|
512
|
+
}
|
513
|
+
|
514
|
+
this._updateGroupSelection();
|
505
515
|
};
|
506
516
|
/** Select from the anchorIndex to the target by length
|
507
517
|
* @public
|
@@ -724,6 +734,116 @@ ColumnSelectionPlugin.prototype.isSelectedColumn = function (colIndex) {
|
|
724
734
|
ColumnSelectionPlugin.prototype.getActiveGrid = function () {
|
725
735
|
return this._activeGrid;
|
726
736
|
};
|
737
|
+
/** Select or deselect a column on the active grid
|
738
|
+
* @private
|
739
|
+
* @param {number} colIndex
|
740
|
+
* @param {boolean=} opt_select=false Null or undefined value will be treated as false value
|
741
|
+
* @param {Object=} opt_grid core grid object
|
742
|
+
* @return {boolean} Return true for successful selection, otherwise false
|
743
|
+
*/
|
744
|
+
|
745
|
+
|
746
|
+
ColumnSelectionPlugin.prototype._setSelectedColumn = function (colIndex, opt_select, opt_grid) {
|
747
|
+
if (!(colIndex >= 0)) {
|
748
|
+
return false;
|
749
|
+
}
|
750
|
+
|
751
|
+
if (opt_grid) {
|
752
|
+
if (opt_grid !== this._activeGrid) {
|
753
|
+
this._activeGrid = opt_grid; // TODO: Check if the grid is one of the hosts
|
754
|
+
}
|
755
|
+
}
|
756
|
+
|
757
|
+
if (!this._activeGrid) {
|
758
|
+
this._activeGrid = this._hosts[0]; // Select the first grid
|
759
|
+
|
760
|
+
if (!this._activeGrid) {
|
761
|
+
return false;
|
762
|
+
}
|
763
|
+
}
|
764
|
+
|
765
|
+
if (colIndex >= this.getColumnCount()) {
|
766
|
+
return false;
|
767
|
+
}
|
768
|
+
|
769
|
+
var selection = opt_select ? true : false;
|
770
|
+
|
771
|
+
if (selection && this._getColumnOption(colIndex, "unselectable")) {
|
772
|
+
return false;
|
773
|
+
}
|
774
|
+
|
775
|
+
this._hasSelection = selection ? true : null;
|
776
|
+
this._pendingSelectionOnAdded = -1; // New selection happens before resolving the pending selection
|
777
|
+
|
778
|
+
this._pendingSelectionOnRemoved = -1; // New selection happens before resolving the pending selection
|
779
|
+
|
780
|
+
var len = this._hosts.length;
|
781
|
+
|
782
|
+
for (var i = 0; i < len; ++i) {
|
783
|
+
this._hosts[i].selectColumn(colIndex, selection);
|
784
|
+
}
|
785
|
+
|
786
|
+
this._updateMenuIcon();
|
787
|
+
|
788
|
+
return true;
|
789
|
+
};
|
790
|
+
/**
|
791
|
+
* @private
|
792
|
+
* @param {Array<number>} colIndices
|
793
|
+
* @return {boolean}
|
794
|
+
*/
|
795
|
+
|
796
|
+
|
797
|
+
ColumnSelectionPlugin.prototype._isSelectedColumns = function (colIndices) {
|
798
|
+
var isAllSelected = false;
|
799
|
+
var count = colIndices.length;
|
800
|
+
|
801
|
+
if (this._activeGrid) {
|
802
|
+
for (var i = 0; i < count; i++) {
|
803
|
+
var colIndex = colIndices[i];
|
804
|
+
isAllSelected = this._activeGrid.isSelectedColumn(colIndex);
|
805
|
+
|
806
|
+
if (!isAllSelected) {
|
807
|
+
break;
|
808
|
+
}
|
809
|
+
}
|
810
|
+
}
|
811
|
+
|
812
|
+
return isAllSelected;
|
813
|
+
};
|
814
|
+
/**
|
815
|
+
* @private
|
816
|
+
* @param {Array<number>} colIndices
|
817
|
+
*/
|
818
|
+
|
819
|
+
|
820
|
+
ColumnSelectionPlugin.prototype._updateGroupSelection = function () {
|
821
|
+
var cgp = this._cgp;
|
822
|
+
var grid = this._activeGrid;
|
823
|
+
|
824
|
+
if (!cgp || !grid) {
|
825
|
+
return;
|
826
|
+
}
|
827
|
+
|
828
|
+
var section = grid.getSection("title");
|
829
|
+
var groupDefs = cgp.getGroupDefinitions();
|
830
|
+
var count = groupDefs.length;
|
831
|
+
|
832
|
+
for (var i = 0; i < count; i++) {
|
833
|
+
var groupDef = groupDefs[i];
|
834
|
+
var groupId = groupDef["id"];
|
835
|
+
var childIndices = cgp.getChildColumnIndices(groupId);
|
836
|
+
var rowIndex = cgp.getGroupLevel(groupId);
|
837
|
+
var colIndex = childIndices[0];
|
838
|
+
var cell = section.getCell(colIndex, rowIndex);
|
839
|
+
|
840
|
+
if (this._isSelectedColumns(childIndices)) {
|
841
|
+
cell.addClass("selected-group");
|
842
|
+
} else {
|
843
|
+
cell.removeClass("selected-group");
|
844
|
+
}
|
845
|
+
}
|
846
|
+
};
|
727
847
|
/** Left click on title causes selection change. <br>
|
728
848
|
* Ctrl/Shift left click on title causes multi selection. <br>
|
729
849
|
* Left click anywhere, not title, causes deselection.
|
@@ -743,7 +863,8 @@ ColumnSelectionPlugin.prototype._onClick = function (e) {
|
|
743
863
|
return;
|
744
864
|
}
|
745
865
|
|
746
|
-
var
|
866
|
+
var cgp = this._cgp;
|
867
|
+
var info = cgp ? cgp.getCellInfo(e) : host.getRelativePosition(e);
|
747
868
|
|
748
869
|
if (!info["hit"] || info["sectionType"] !== "title") {
|
749
870
|
return;
|
@@ -763,43 +884,72 @@ ColumnSelectionPlugin.prototype._onClick = function (e) {
|
|
763
884
|
}
|
764
885
|
|
765
886
|
var cIndex = info["colIndex"];
|
766
|
-
var
|
887
|
+
var isNewGridClicked = !this._activeGrid || this._activeGrid !== host;
|
888
|
+
var groupId = info["groupId"];
|
889
|
+
var childIndices, childCount;
|
890
|
+
|
891
|
+
if (groupId) {
|
892
|
+
childIndices = cgp.getChildColumnIndices(groupId);
|
893
|
+
childCount = childIndices.length;
|
894
|
+
}
|
767
895
|
|
768
|
-
if (
|
896
|
+
if (isNewGridClicked) {
|
769
897
|
this.clearAllSelections();
|
770
898
|
this._activeGrid = host;
|
771
|
-
this.
|
772
|
-
|
773
|
-
} else {
|
774
|
-
// The same active grid case
|
775
|
-
if (e.ctrlKey) {
|
776
|
-
var newState = !this.isSelectedColumn(cIndex); // toggle
|
899
|
+
this._anchorCol = -1;
|
900
|
+
}
|
777
901
|
|
778
|
-
|
902
|
+
if (e.ctrlKey || e.metaKey) {
|
903
|
+
if (!groupId && (!this._singleSelMode || this.isSelectedColumn(cIndex))) {
|
904
|
+
this.setSelectedColumn(cIndex, !this.isSelectedColumn(cIndex));
|
905
|
+
this._anchorCol = this.isSelectedColumn(cIndex) ? cIndex : this.getFirstSelectedColumn();
|
906
|
+
} else {
|
907
|
+
var newState = !this._isSelectedColumns(childIndices);
|
779
908
|
|
780
|
-
|
781
|
-
this.
|
782
|
-
} else if (this._anchorCol === cIndex) {
|
783
|
-
this._anchorCol = this.getFirstSelectedColumn();
|
909
|
+
for (var i = 0; i < childCount; i++) {
|
910
|
+
this.setSelectedColumn(childIndices[i], newState, host);
|
784
911
|
}
|
912
|
+
|
913
|
+
this._anchorCol = newState ? childIndices[0] : this.getFirstSelectedColumn();
|
914
|
+
}
|
915
|
+
} else if (e.shiftKey && !this._singleSelMode) {
|
916
|
+
if (groupId) {
|
917
|
+
var firstGroupCol = childIndices[0];
|
918
|
+
var lastGroupCol = childIndices[childCount - 1];
|
919
|
+
|
920
|
+
if (this._anchorCol >= firstGroupCol && this._anchorCol <= lastGroupCol) {
|
921
|
+
this._anchorCol = firstGroupCol;
|
922
|
+
cIndex = lastGroupCol;
|
923
|
+
} else if (this._anchorCol > firstGroupCol) {
|
924
|
+
cIndex = firstGroupCol;
|
925
|
+
} else if (this._anchorCol < lastGroupCol) {
|
926
|
+
cIndex = lastGroupCol;
|
927
|
+
}
|
928
|
+
}
|
929
|
+
|
930
|
+
this._selectFromAnchorToTarget(cIndex);
|
931
|
+
} else if (this._clickToggleMode) {
|
932
|
+
var cols = this.getSelectedColumns();
|
933
|
+
|
934
|
+
if (cols.length === 1 && cols[0] === cIndex) {
|
935
|
+
this.setSelectedColumn(cIndex, false); // toggle
|
936
|
+
|
937
|
+
this._anchorCol = -1;
|
938
|
+
} else if (childIndices && cols.length == childCount && this._isSelectedColumns(childIndices)) {
|
939
|
+
this.clearAllSelections();
|
940
|
+
this._anchorCol = -1;
|
785
941
|
} else {
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
if (cols.length === 1 && cols[0] === cIndex) {
|
793
|
-
this.setSelectedColumn(cIndex, false); // toggle
|
794
|
-
|
795
|
-
this._anchorCol = -1;
|
796
|
-
} else {
|
797
|
-
this.selectSingleColumn(cIndex);
|
798
|
-
}
|
799
|
-
} else {
|
800
|
-
this.selectSingleColumn(cIndex);
|
801
|
-
}
|
942
|
+
groupId ? this.selectSingleGroup(groupId) : this.selectSingleColumn(cIndex);
|
943
|
+
}
|
944
|
+
} else {
|
945
|
+
if (this._singleSelMode) {
|
946
|
+
if (groupId) {
|
947
|
+
return;
|
802
948
|
}
|
949
|
+
|
950
|
+
this.selectSingleColumn(cIndex);
|
951
|
+
} else {
|
952
|
+
groupId ? this.selectSingleGroup(groupId) : this.selectSingleColumn(cIndex);
|
803
953
|
}
|
804
954
|
}
|
805
955
|
|
@@ -1139,13 +1289,15 @@ ColumnSelectionPlugin.prototype._selectFromAnchorToTarget = function (targetInde
|
|
1139
1289
|
|
1140
1290
|
if (targetIndex <= this._anchorCol) {
|
1141
1291
|
for (i = targetIndex; i <= this._anchorCol; ++i) {
|
1142
|
-
this.
|
1292
|
+
this._setSelectedColumn(i, true, grid);
|
1143
1293
|
}
|
1144
1294
|
} else {
|
1145
1295
|
for (i = this._anchorCol; i <= targetIndex; ++i) {
|
1146
|
-
this.
|
1296
|
+
this._setSelectedColumn(i, true, grid);
|
1147
1297
|
}
|
1148
1298
|
}
|
1299
|
+
|
1300
|
+
this._updateGroupSelection();
|
1149
1301
|
};
|
1150
1302
|
/** @private
|
1151
1303
|
* @param {Event} e
|
@@ -433,17 +433,19 @@ ColumnStackPlugin.prototype._transformStackConfig = function(stackConfig) {
|
|
433
433
|
var colIndex = this.getColumnIndex(children[j]);
|
434
434
|
if(colIndex !== -1){
|
435
435
|
field = this._getField(colIndex);
|
436
|
-
|
436
|
+
if(field) {
|
437
|
+
stackConfig.colRefs.push(field);
|
438
|
+
}
|
437
439
|
}
|
438
440
|
}
|
439
441
|
} else if(fields) {
|
440
442
|
stackConfig.colRefs = fields;
|
441
443
|
}
|
442
444
|
var activeColumn = stackConfig.activeColumn;
|
443
|
-
if(activeColumn && !this._autoStacking){
|
445
|
+
if(activeColumn != null && !this._autoStacking){
|
444
446
|
var activeColIndex = this.getColumnIndex(activeColumn);
|
445
447
|
if(activeColIndex !== -1){
|
446
|
-
field = this._getField(
|
448
|
+
field = this._getField(activeColIndex);
|
447
449
|
if(field){
|
448
450
|
stackConfig.activeColumn = field;
|
449
451
|
}
|
@@ -1,22 +1,25 @@
|
|
1
1
|
import {Ext} from '../../tr-grid-util/es6/Ext.js';
|
2
2
|
import {GridPlugin} from '../../tr-grid-util/es6/GridPlugin.js';
|
3
|
-
import {RangeBar} from '../../tr-grid-util/es6/RangeBar.js';
|
4
|
-
import {Dom} from '../../tr-grid-util/es6/Dom.js';
|
5
3
|
import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
|
4
|
+
import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
6
5
|
|
7
6
|
declare namespace RangeBarPlugin {
|
8
7
|
|
9
8
|
type ColumnOptions = {
|
10
|
-
rangeBar?: RangeBarPlugin.RangeDefinition
|
9
|
+
rangeBar?: RangeBarPlugin.RangeDefinition|null
|
11
10
|
};
|
12
11
|
|
13
12
|
type RangeDefinition = {
|
14
|
-
field?: string,
|
15
|
-
start?: number,
|
16
|
-
end?: number,
|
17
|
-
low?: string,
|
18
|
-
high?: string,
|
19
|
-
last?: string
|
13
|
+
field?: string|null,
|
14
|
+
start?: number|null,
|
15
|
+
end?: number|null,
|
16
|
+
low?: string|null,
|
17
|
+
high?: string|null,
|
18
|
+
last?: string|null
|
19
|
+
};
|
20
|
+
|
21
|
+
type Options = {
|
22
|
+
tooltip?: boolean|null
|
20
23
|
};
|
21
24
|
|
22
25
|
}
|
@@ -33,6 +36,12 @@ declare class RangeBarPlugin extends GridPlugin {
|
|
33
36
|
|
34
37
|
public getConfigObject(out_obj?: any): any;
|
35
38
|
|
39
|
+
public getColumnConfigObject(colIndex: number, out_obj?: any): any;
|
40
|
+
|
41
|
+
public getValue(colRef: number|string|null, rowRef: number|string|null): any;
|
42
|
+
|
43
|
+
public getTooltipText(colRef: number|string|null, rowRef: number|string|null): string;
|
44
|
+
|
36
45
|
}
|
37
46
|
|
38
47
|
export default RangeBarPlugin;
|