@refinitiv-ui/efx-grid 6.0.150 → 6.0.152
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/formatters/es6/EFRadioButtonFormatter.js +66 -24
- package/lib/grid/index.js +1 -1
- package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +6 -1
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +78 -15
- package/lib/types/es6/RowFiltering.d.ts +6 -1
- package/lib/versions.json +2 -2
- package/package.json +1 -1
@@ -5,21 +5,76 @@ import FormatterBuilder from "./FormatterBuilder.js";
|
|
5
5
|
* @property {number=} initialIndex
|
6
6
|
*/
|
7
7
|
|
8
|
+
/** @private
|
9
|
+
* @function
|
10
|
+
* @param {number|string} rowRef
|
11
|
+
* @param {boolean=} checked
|
12
|
+
* @returns {boolean} Returns true if there is a change
|
13
|
+
*/
|
14
|
+
let _selectRadio = function (rowRef, checked) {
|
15
|
+
if(!this.grid) {
|
16
|
+
return false;
|
17
|
+
}
|
18
|
+
let dv = this.grid.getDataSource();
|
19
|
+
if(!dv) {
|
20
|
+
return false;
|
21
|
+
}
|
22
|
+
|
23
|
+
let rowIndex = -1;
|
24
|
+
let rid = "";
|
25
|
+
if(typeof rowRef == "string") {
|
26
|
+
rid = rowRef;
|
27
|
+
rowIndex = dv.getRowIndex(rid);
|
28
|
+
} else {
|
29
|
+
rowIndex = rowRef;
|
30
|
+
rid = dv.getRowId(rowIndex);
|
31
|
+
}
|
32
|
+
if(!(rowIndex >= 0) || !rid) {
|
33
|
+
return false;
|
34
|
+
}
|
35
|
+
|
36
|
+
let dirty = false;
|
37
|
+
if (checked !== false) {
|
38
|
+
if (this.previousId && this.previousId !== rid) {
|
39
|
+
this.rowIndex = dv.getRowIndex(this.previousId);
|
40
|
+
this.setData(this.field, false);
|
41
|
+
}
|
42
|
+
this.rowIndex = rowIndex;
|
43
|
+
this.previousId = rid;
|
44
|
+
this.setData(this.field, true);
|
45
|
+
this.value = checked;
|
46
|
+
dirty = true;
|
47
|
+
} else if(this.previousId == rid) {
|
48
|
+
this.rowIndex = rowIndex;
|
49
|
+
this.previousId = "";
|
50
|
+
this.setData(this.field, false);
|
51
|
+
this.value = false;
|
52
|
+
dirty = true;
|
53
|
+
}
|
54
|
+
return dirty;
|
55
|
+
};
|
56
|
+
|
8
57
|
/** @private
|
9
58
|
* @function
|
10
59
|
* @param {Element} element
|
11
60
|
* @param {Object} ctx
|
12
61
|
*/
|
13
62
|
let onElementCreated = function (element, ctx) {
|
14
|
-
let
|
15
|
-
let rid =
|
16
|
-
|
17
|
-
|
63
|
+
let checked = false;
|
64
|
+
let rid = "";
|
65
|
+
if(ctx.initialIndex >= 0) {
|
66
|
+
let dv = ctx.grid.getDataSource();
|
67
|
+
rid = dv.getRowId(ctx.rowIndex);
|
68
|
+
if(!ctx.initialRid) {
|
69
|
+
ctx.initialRid = dv.getRowId(ctx.initialIndex);
|
70
|
+
}
|
71
|
+
checked = (rid === ctx.initialRid);
|
72
|
+
}
|
18
73
|
if (checked) {
|
19
74
|
ctx.previousId = rid;
|
20
75
|
ctx.setData(ctx.field, checked);
|
76
|
+
ctx.value = checked;
|
21
77
|
}
|
22
|
-
ctx.value = checked;
|
23
78
|
};
|
24
79
|
|
25
80
|
/** @private
|
@@ -28,9 +83,10 @@ let onElementCreated = function (element, ctx) {
|
|
28
83
|
* @param {Object} ctx
|
29
84
|
*/
|
30
85
|
let onElementUpdated = function (element, ctx) {
|
31
|
-
let
|
32
|
-
|
33
|
-
|
86
|
+
let checked = ctx.value ? true : false;
|
87
|
+
if(checked) {
|
88
|
+
checked = (ctx.grid.getDataSource().getRowId(ctx.rowIndex) === ctx.previousId);
|
89
|
+
}
|
34
90
|
element.checked = checked;
|
35
91
|
};
|
36
92
|
|
@@ -40,22 +96,7 @@ let onElementUpdated = function (element, ctx) {
|
|
40
96
|
* @param {*} ctx
|
41
97
|
*/
|
42
98
|
let _changeHandler = function (e, ctx) {
|
43
|
-
ctx.
|
44
|
-
ctx.setData(ctx.field, ctx.value);
|
45
|
-
|
46
|
-
let dv = ctx.grid.getDataSource();
|
47
|
-
let rid = dv.getRowId(ctx.rowIndex);
|
48
|
-
if (ctx.previousId && ctx.previousId !== rid) {
|
49
|
-
let row = dv.getRowData(ctx.previousId);
|
50
|
-
if (row) {
|
51
|
-
if (row["ROW_DEF"]) {
|
52
|
-
row["ROW_DEF"].setData(ctx.field, false);
|
53
|
-
} else {
|
54
|
-
dv.setData(ctx.previousId, ctx.field, false);
|
55
|
-
}
|
56
|
-
}
|
57
|
-
}
|
58
|
-
ctx.previousId = dv.getRowId(ctx.rowIndex);
|
99
|
+
ctx.selectRadio(ctx.rowIndex, true);
|
59
100
|
};
|
60
101
|
|
61
102
|
/** @constructor
|
@@ -76,6 +117,7 @@ EFRadioButtonFormatter.create = function (options) {
|
|
76
117
|
styles: {
|
77
118
|
margin: 0
|
78
119
|
},
|
120
|
+
selectRadio: _selectRadio,
|
79
121
|
onElementCreated: onElementCreated,
|
80
122
|
onElementUpdated: onElementUpdated,
|
81
123
|
changeHook: "checked-changed",
|
package/lib/grid/index.js
CHANGED
@@ -61,7 +61,8 @@ declare namespace RowFilteringPlugin {
|
|
61
61
|
filterChanged?: ((...params: any[]) => any)|null,
|
62
62
|
beforeDialogOpened?: ((...params: any[]) => any)|null,
|
63
63
|
dialogCommitted?: ((...params: any[]) => any)|null,
|
64
|
-
refreshed?: ((...params: any[]) => any)|null
|
64
|
+
refreshed?: ((...params: any[]) => any)|null,
|
65
|
+
activeIconState?: boolean|null
|
65
66
|
};
|
66
67
|
|
67
68
|
}
|
@@ -120,6 +121,10 @@ declare class RowFilteringPlugin extends GridPlugin {
|
|
120
121
|
|
121
122
|
public getColumnFilterIcons(colIndex: number): (Element)[]|null;
|
122
123
|
|
124
|
+
public setColumnFilterIconState(colIndex: number, active: boolean): void;
|
125
|
+
|
126
|
+
public getColumnFilterIconState(colIndex: number): boolean;
|
127
|
+
|
123
128
|
public updateAllColumnIcons(): void;
|
124
129
|
|
125
130
|
public addDataView(dv: any): void;
|
@@ -118,6 +118,7 @@ The expression can take various forms:<br>
|
|
118
118
|
* @property {Function=} beforeDialogOpened=null Event handler dispatched before dialog opening.
|
119
119
|
* @property {Function=} dialogCommitted=null Event handler dispatched whenever the new settings from dialog are applied.
|
120
120
|
* @property {Function=} refreshed=null Event handler dispatched after new filter is applied to grid's data view.
|
121
|
+
* @property {boolean=} activeIconState=true If disabled, filter icon won't be automatically changed its state when filter in a column is changed.
|
121
122
|
*/
|
122
123
|
|
123
124
|
/** @private
|
@@ -336,12 +337,15 @@ RowFilteringPlugin._filterBuilder = null;
|
|
336
337
|
* @private
|
337
338
|
*/
|
338
339
|
RowFilteringPlugin._dialogTagName; // intentionally left undefined
|
339
|
-
|
340
340
|
/** Array of DataView objects
|
341
341
|
* @type {!Array.<Object>}
|
342
342
|
* @private
|
343
343
|
*/
|
344
344
|
RowFilteringPlugin.prototype._dvs;
|
345
|
+
/** @type {boolean}
|
346
|
+
* @private
|
347
|
+
*/
|
348
|
+
RowFilteringPlugin.prototype._activeIconState = true;
|
345
349
|
|
346
350
|
|
347
351
|
/** @public
|
@@ -552,6 +556,9 @@ RowFilteringPlugin.prototype.config = function (options) {
|
|
552
556
|
if(rowFiltering["dialogOptions"]){
|
553
557
|
this._dialogOptions = rowFiltering["dialogOptions"];
|
554
558
|
}
|
559
|
+
if(rowFiltering["activeIconState"] != null){
|
560
|
+
this._activeIconState = !!rowFiltering["activeIconState"];
|
561
|
+
}
|
555
562
|
if(rowFiltering["clicked"]) {
|
556
563
|
rowFiltering["click"] = rowFiltering["clicked"];
|
557
564
|
}
|
@@ -635,6 +642,10 @@ RowFilteringPlugin.prototype.getConfigObject = function (gridOptions) {
|
|
635
642
|
extOptions.dialogOptions = this._dialogOptions; // TODO: dialogOptions should not contain any function
|
636
643
|
dirty = true;
|
637
644
|
}
|
645
|
+
if(!this._activeIconState) {
|
646
|
+
extOptions.activeIconState = false;
|
647
|
+
dirty = true;
|
648
|
+
}
|
638
649
|
// TODO: get emptySegmentFiltering setting from DataView
|
639
650
|
// TODO: get separatorFiltering setting from DataView
|
640
651
|
if(dirty) {
|
@@ -1211,26 +1222,74 @@ RowFilteringPlugin.prototype.setFilterExpressions = function(filterExps) {
|
|
1211
1222
|
RowFilteringPlugin.prototype.hasColumnFilter = function() {
|
1212
1223
|
return (this._columnFilters.length > 0);
|
1213
1224
|
};
|
1214
|
-
|
1225
|
+
|
1226
|
+
/** @private
|
1215
1227
|
* @param {number} colIndex
|
1216
|
-
* @return {Array.<Element>}
|
1228
|
+
* @return {Array.<Element>} Bottom cells from title section of all grids
|
1217
1229
|
*/
|
1218
|
-
RowFilteringPlugin.prototype.
|
1219
|
-
|
1230
|
+
RowFilteringPlugin.prototype._getBottomTitleCells = function(colIndex) {
|
1231
|
+
var cells = [];
|
1220
1232
|
for(let i = this._hosts.length; --i >= 0;) {
|
1221
1233
|
let host = this._hosts[i];
|
1222
1234
|
let tsect = host.getSection("title");
|
1223
|
-
if(
|
1224
|
-
|
1235
|
+
if(tsect) {
|
1236
|
+
let rowCount = tsect.getRowCount();
|
1237
|
+
let cell = tsect.getCell(colIndex, rowCount - 1, true); // Get bottom cell
|
1238
|
+
if(cell) {
|
1239
|
+
cells.push(cell);
|
1240
|
+
}
|
1225
1241
|
}
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1242
|
+
}
|
1243
|
+
return cells;
|
1244
|
+
};
|
1245
|
+
/** @public
|
1246
|
+
* @param {number} colIndex
|
1247
|
+
* @return {Array.<Element>} icons
|
1248
|
+
*/
|
1249
|
+
RowFilteringPlugin.prototype.getColumnFilterIcons = function(colIndex) {
|
1250
|
+
let icons = [];
|
1251
|
+
let cells = this._getBottomTitleCells(colIndex);
|
1252
|
+
let len = cells.length;
|
1253
|
+
for(let i = 0; i < len; ++i) {
|
1254
|
+
let cell = cells[i];
|
1255
|
+
if(cell._filterIcon) {
|
1229
1256
|
icons.push(cell._filterIcon);
|
1230
1257
|
}
|
1231
1258
|
}
|
1232
1259
|
return icons;
|
1233
1260
|
};
|
1261
|
+
/** Change specified filter icon state regardless of existing filter in the column. This method does NOT change the visibility of the icon.
|
1262
|
+
* @public
|
1263
|
+
* @param {number} colIndex
|
1264
|
+
* @param {boolean} active
|
1265
|
+
*/
|
1266
|
+
RowFilteringPlugin.prototype.setColumnFilterIconState = function(colIndex, active) {
|
1267
|
+
let cells = this._getBottomTitleCells(colIndex);
|
1268
|
+
let len = cells.length;
|
1269
|
+
for(let i = 0; i < len; ++i) {
|
1270
|
+
let cell = cells[i];
|
1271
|
+
if(cell._filterIcon) {
|
1272
|
+
cell.enableClass("active-filter", active);
|
1273
|
+
}
|
1274
|
+
}
|
1275
|
+
};
|
1276
|
+
/** @public
|
1277
|
+
* @param {number} colIndex
|
1278
|
+
* @returns {boolean} active
|
1279
|
+
*/
|
1280
|
+
RowFilteringPlugin.prototype.getColumnFilterIconState = function(colIndex) {
|
1281
|
+
let cells = this._getBottomTitleCells(colIndex);
|
1282
|
+
let len = cells.length;
|
1283
|
+
for(let i = 0; i < len; ++i) {
|
1284
|
+
let cell = cells[i];
|
1285
|
+
if(cell._filterIcon) {
|
1286
|
+
if(cell.hasClass("active-filter")) {
|
1287
|
+
return true;
|
1288
|
+
}
|
1289
|
+
}
|
1290
|
+
}
|
1291
|
+
return false;
|
1292
|
+
};
|
1234
1293
|
/** @public */
|
1235
1294
|
RowFilteringPlugin.prototype.updateAllColumnIcons = function() {
|
1236
1295
|
if(this._uiTimerId) {
|
@@ -1451,16 +1510,20 @@ RowFilteringPlugin.prototype._updateColumnIcon = function(colIndex) {
|
|
1451
1510
|
cell.insertFloatingIcon(filterIcon, 10);
|
1452
1511
|
cell._filterIcon = filterIcon;
|
1453
1512
|
}
|
1454
|
-
if(
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1513
|
+
if(this._activeIconState) {
|
1514
|
+
if(hasFilter){
|
1515
|
+
cell.enableClass("active-filter", true);
|
1516
|
+
}else{
|
1517
|
+
cell.enableClass("active-filter", false);
|
1518
|
+
}
|
1458
1519
|
}
|
1459
1520
|
} else {
|
1460
1521
|
if(cell._filterIcon) {
|
1461
1522
|
cell.removeFloatingIcon(cell._filterIcon);
|
1462
1523
|
cell._filterIcon = null;
|
1463
|
-
|
1524
|
+
if(this._activeIconState) {
|
1525
|
+
cell.enableClass("active-filter", false);
|
1526
|
+
}
|
1464
1527
|
}
|
1465
1528
|
}
|
1466
1529
|
}
|
@@ -61,7 +61,8 @@ declare namespace RowFilteringPlugin {
|
|
61
61
|
filterChanged?: ((...params: any[]) => any)|null,
|
62
62
|
beforeDialogOpened?: ((...params: any[]) => any)|null,
|
63
63
|
dialogCommitted?: ((...params: any[]) => any)|null,
|
64
|
-
refreshed?: ((...params: any[]) => any)|null
|
64
|
+
refreshed?: ((...params: any[]) => any)|null,
|
65
|
+
activeIconState?: boolean|null
|
65
66
|
};
|
66
67
|
|
67
68
|
}
|
@@ -120,6 +121,10 @@ declare class RowFilteringPlugin extends GridPlugin {
|
|
120
121
|
|
121
122
|
public getColumnFilterIcons(colIndex: number): (Element)[]|null;
|
122
123
|
|
124
|
+
public setColumnFilterIconState(colIndex: number, active: boolean): void;
|
125
|
+
|
126
|
+
public getColumnFilterIconState(colIndex: number): boolean;
|
127
|
+
|
123
128
|
public updateAllColumnIcons(): void;
|
124
129
|
|
125
130
|
public addDataView(dv: any): void;
|
package/lib/versions.json
CHANGED
@@ -24,13 +24,13 @@
|
|
24
24
|
"tr-grid-percent-bar": "1.0.24",
|
25
25
|
"tr-grid-range-bar": "2.0.9",
|
26
26
|
"tr-grid-row-dragging": "1.0.39",
|
27
|
-
"tr-grid-row-filtering": "1.0.
|
27
|
+
"tr-grid-row-filtering": "1.0.90",
|
28
28
|
"tr-grid-row-grouping": "1.0.88",
|
29
29
|
"tr-grid-row-selection": "1.0.33",
|
30
30
|
"tr-grid-rowcoloring": "1.0.26",
|
31
31
|
"tr-grid-textformatting": "1.0.49",
|
32
32
|
"tr-grid-titlewrap": "1.0.22",
|
33
|
-
"@grid/formatters": "1.0.
|
33
|
+
"@grid/formatters": "1.0.56",
|
34
34
|
"@grid/column-selection-dialog": "4.0.59",
|
35
35
|
"@grid/filter-dialog": "4.0.79",
|
36
36
|
"@grid/column-format-dialog": "4.0.45"
|
package/package.json
CHANGED