@refinitiv-ui/efx-grid 6.0.15 → 6.0.17
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +661 -84
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +10 -0
- package/lib/rt-grid/es6/ColumnDefinition.js +110 -1
- package/lib/rt-grid/es6/FieldDefinition.d.ts +6 -0
- package/lib/rt-grid/es6/FieldDefinition.js +43 -0
- package/lib/rt-grid/es6/Grid.js +184 -8
- package/lib/rt-grid/es6/SnapshotFiller.d.ts +1 -0
- package/lib/rt-grid/es6/SnapshotFiller.js +125 -17
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +4 -4
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +273 -143
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +7 -1
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +167 -146
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +44 -43
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +202 -497
- package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +30 -29
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +176 -98
- package/lib/tr-grid-row-grouping/es6/RowGrouping.d.ts +40 -40
- package/lib/tr-grid-rowcoloring/es6/RowColoring.d.ts +17 -15
- package/lib/tr-grid-rowcoloring/es6/RowColoring.js +89 -159
- package/lib/types/es6/ColumnStack.d.ts +7 -1
- package/lib/types/es6/Core/data/Segment.d.ts +3 -3
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +1 -1
- package/lib/types/es6/InCellEditing.d.ts +44 -43
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +10 -0
- package/lib/types/es6/RealtimeGrid/FieldDefinition.d.ts +6 -0
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +2 -0
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +4 -0
- package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +1 -0
- package/lib/types/es6/RowColoring.d.ts +17 -15
- package/lib/types/es6/RowFiltering.d.ts +30 -29
- package/lib/types/es6/RowGrouping.d.ts +40 -40
- package/lib/versions.json +7 -7
- package/package.json +1 -1
@@ -12,33 +12,34 @@ declare namespace RowFilteringPlugin {
|
|
12
12
|
|
13
13
|
type FilterExpression = {
|
14
14
|
field: string,
|
15
|
-
expression: RowFilteringPlugin.Expression,
|
15
|
+
expression: RowFilteringPlugin.Expression|null,
|
16
16
|
context: any
|
17
17
|
};
|
18
18
|
|
19
19
|
type ColumnOptions = {
|
20
|
-
filter?: RowFilteringPlugin.Expression,
|
20
|
+
filter?: RowFilteringPlugin.Expression|null,
|
21
21
|
filterState?: any,
|
22
|
-
filterIcon?: boolean
|
22
|
+
filterIcon?: boolean|null
|
23
23
|
};
|
24
24
|
|
25
25
|
type FilterDialogOptions = {
|
26
|
-
sortUI?: boolean,
|
27
|
-
filterUI?: boolean,
|
28
|
-
fieldDataType?: string,
|
29
|
-
lang?: string,
|
30
|
-
rawDataAccessor?: ((...params: any[]) => any),
|
31
|
-
formattedDataAccessor?: ((...params: any[]) => any),
|
32
|
-
sortLogic?: ((...params: any[]) => any)
|
26
|
+
sortUI?: boolean|null,
|
27
|
+
filterUI?: boolean|null,
|
28
|
+
fieldDataType?: string|null,
|
29
|
+
lang?: string|null,
|
30
|
+
rawDataAccessor?: ((...params: any[]) => any)|null,
|
31
|
+
formattedDataAccessor?: ((...params: any[]) => any)|null,
|
32
|
+
sortLogic?: ((...params: any[]) => any)|null
|
33
33
|
};
|
34
34
|
|
35
35
|
type Options = {
|
36
|
-
disabledUI?: boolean,
|
37
|
-
iconActivation?: string,
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
disabledUI?: boolean|null,
|
37
|
+
iconActivation?: string|null,
|
38
|
+
dialogOptions?: RowFilteringPlugin.FilterDialogOptions|null,
|
39
|
+
click?: ((...params: any[]) => any)|null,
|
40
|
+
clicked?: ((...params: any[]) => any)|null,
|
41
|
+
iconCreated?: ((...params: any[]) => any)|null,
|
42
|
+
filterChanged?: ((...params: any[]) => any)|null
|
42
43
|
};
|
43
44
|
|
44
45
|
}
|
@@ -57,17 +58,17 @@ declare class RowFilteringPlugin extends GridPlugin {
|
|
57
58
|
|
58
59
|
public getConfigObject(gridOptions?: any): any;
|
59
60
|
|
60
|
-
public disable(opt_disabled?: boolean, opt_id?: string): void;
|
61
|
+
public disable(opt_disabled?: boolean|null, opt_id?: string|null): void;
|
61
62
|
|
62
|
-
public addFilter(exp: RowFilteringPlugin.Expression, funcName?: string, ctx?: any): string;
|
63
|
+
public addFilter(exp: RowFilteringPlugin.Expression|null, funcName?: string|null, ctx?: any): string;
|
63
64
|
|
64
|
-
public addGridFilter(exp: RowFilteringPlugin.Expression, ctx?: any): string;
|
65
|
+
public addGridFilter(exp: RowFilteringPlugin.Expression|null, ctx?: any): string;
|
65
66
|
|
66
|
-
public addColumnFilter(colIndex: number, exp: RowFilteringPlugin.Expression, ctx?: (any|string)): boolean;
|
67
|
+
public addColumnFilter(colIndex: number, exp: RowFilteringPlugin.Expression|null, ctx?: (any|string)|null): boolean;
|
67
68
|
|
68
|
-
public setColumnFilter(colIndex: number, exp: RowFilteringPlugin.Expression, ctx?: (any|string)): boolean;
|
69
|
+
public setColumnFilter(colIndex: number, exp: RowFilteringPlugin.Expression|null, ctx?: (any|string)|null): boolean;
|
69
70
|
|
70
|
-
public removeFilter(funcRef: ((...params: any[]) => any)|string): boolean;
|
71
|
+
public removeFilter(funcRef: ((...params: any[]) => any)|string|null): boolean;
|
71
72
|
|
72
73
|
public removeColumnFilters(colIndex: number): boolean;
|
73
74
|
|
@@ -77,11 +78,11 @@ declare class RowFilteringPlugin extends GridPlugin {
|
|
77
78
|
|
78
79
|
public removeAllFilters(): void;
|
79
80
|
|
80
|
-
public setOverridingFilter(func: ((...params: any[]) => any)): void;
|
81
|
+
public setOverridingFilter(func: ((...params: any[]) => any)|null): void;
|
81
82
|
|
82
|
-
public setPreTransform(func: ((...params: any[]) => any)): void;
|
83
|
+
public setPreTransform(func: ((...params: any[]) => any)|null): void;
|
83
84
|
|
84
|
-
public setRowTransform(func: ((...params: any[]) => any)): void;
|
85
|
+
public setRowTransform(func: ((...params: any[]) => any)|null): void;
|
85
86
|
|
86
87
|
public getFilters(): (((...params: any[]) => any))[];
|
87
88
|
|
@@ -89,7 +90,7 @@ declare class RowFilteringPlugin extends GridPlugin {
|
|
89
90
|
|
90
91
|
public getFilterExpressions(): (RowFilteringPlugin.FilterExpression)[]|null;
|
91
92
|
|
92
|
-
public setFilterExpressions(filterExps: (RowFilteringPlugin.FilterExpression)[]): void;
|
93
|
+
public setFilterExpressions(filterExps: (RowFilteringPlugin.FilterExpression)[]|null): void;
|
93
94
|
|
94
95
|
public hasColumnFilter(): boolean;
|
95
96
|
|
@@ -109,13 +110,13 @@ declare class RowFilteringPlugin extends GridPlugin {
|
|
109
110
|
|
110
111
|
public getColumnFilterStates(): any[];
|
111
112
|
|
112
|
-
public getUniqueValues(field: string, formatter?: ((...params: any[]) => any), fmtField?: string, rawDataAccessor?: ((...params: any[]) => any), formattedDataAccessor?: ((...params: any[]) => any)): any;
|
113
|
+
public getUniqueValues(field: string, formatter?: ((...params: any[]) => any)|null, fmtField?: string|null, rawDataAccessor?: ((...params: any[]) => any)|null, formattedDataAccessor?: ((...params: any[]) => any)|null): any;
|
113
114
|
|
114
|
-
public openDialog(colIndex: number,
|
115
|
+
public openDialog(colIndex: number, runtimeDialogOptions?: RowFilteringPlugin.FilterDialogOptions|null): void;
|
115
116
|
|
116
117
|
}
|
117
118
|
|
118
|
-
declare function field(colIndex: number, exp: RowFilteringPlugin.Expression, ctx?: (any|string)): boolean;
|
119
|
+
declare function field(colIndex: number, exp: RowFilteringPlugin.Expression|null, ctx?: (any|string)|null): boolean;
|
119
120
|
|
120
121
|
export default RowFilteringPlugin;
|
121
122
|
export { RowFilteringPlugin, RowFilteringPlugin as RowFiltering, RowFilteringPlugin as RowFilteringExtension };
|
@@ -9,6 +9,20 @@ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
|
9
9
|
* @description click event is dispatched when a user clicks the column filter icon.
|
10
10
|
*/
|
11
11
|
|
12
|
+
/** @event RowFilteringPlugin#beforeDialogOpened
|
13
|
+
* @description Fired before the opening of filter dialog. This can be used to cancel the operation or set a dialog configuration at runtime.
|
14
|
+
* @property {number} colIndex Column index
|
15
|
+
* @property {string} field Field
|
16
|
+
* @property {Object} grid Core grid instance
|
17
|
+
* @example
|
18
|
+
* beforeDialogOpened: function(e) {
|
19
|
+
* e.cancel = true; // To cancel the operation
|
20
|
+
* },
|
21
|
+
* beforeDialogOpened: function(e) {
|
22
|
+
* e.dialogOptions = { sortLogic: func }; // To set a dialog configuration
|
23
|
+
* },
|
24
|
+
*/
|
25
|
+
|
12
26
|
/** @event RowFilteringPlugin#iconCreated
|
13
27
|
* @description iconCreated event is dispatched when a new column filter icon is created.
|
14
28
|
* @property {Element} icon Filter icon element
|
@@ -60,7 +74,7 @@ The expression can take various forms:<br>
|
|
60
74
|
*/
|
61
75
|
|
62
76
|
/** @typedef {Object} RowFilteringPlugin~FilterDialogOptions
|
63
|
-
* @description Options that
|
77
|
+
* @description Options that specify UIs of filter dialog
|
64
78
|
* @property {boolean=} sortUI show/hide sort UI
|
65
79
|
* @property {boolean=} filterUI show/hide filter UI
|
66
80
|
* @property {string=} fieldDataType data type of column
|
@@ -72,8 +86,9 @@ The expression can take various forms:<br>
|
|
72
86
|
|
73
87
|
/** @typedef {Object} RowFilteringPlugin~Options
|
74
88
|
* @description The options can be specified by `rowFiltering` property of the main grid's options
|
75
|
-
* @property {boolean=} disabledUI=false
|
89
|
+
* @property {boolean=} disabledUI=false Deprecated in favor of `iconActivation`. Set iconActivation to none instead.
|
76
90
|
* @property {string=} iconActivation=onActiveFilter Filter icon redering behavior, can be set to `always`,`onHover`,`onActiveFilter`,or `none`
|
91
|
+
* @property {RowFilteringPlugin~FilterDialogOptions=} dialogOptions=null Default configuration for Filter Dialog, applying to all columns.
|
77
92
|
* @property {Function=} click=null Event handler dispatched when a user clicks the column filter icon.
|
78
93
|
* @property {Function=} clicked=null Alias to `click` event handler
|
79
94
|
* @property {Function=} iconCreated=null Event handler dispatched when a new column filter icon is created.
|
@@ -105,7 +120,7 @@ var RowFilteringPlugin = function RowFilteringPlugin() {
|
|
105
120
|
t._onPreSectionRender = t._onPreSectionRender.bind(t);
|
106
121
|
t._onColumnAdded = t._onColumnAdded.bind(t);
|
107
122
|
t._onColumnRemoved = t._onColumnRemoved.bind(t);
|
108
|
-
t.
|
123
|
+
t._onIconClicked = t._onIconClicked.bind(t);
|
109
124
|
t._filterLogic = t._filterLogic.bind(t);
|
110
125
|
t._updateAllColumnIcons = t._updateAllColumnIcons.bind(t);
|
111
126
|
t.refresh = t.refresh.bind(t);
|
@@ -203,6 +218,11 @@ RowFilteringPlugin.prototype._rowTransform = null;
|
|
203
218
|
*/
|
204
219
|
|
205
220
|
RowFilteringPlugin.prototype._filterDialog = null;
|
221
|
+
/** @type {RowFilteringPlugin~FilterDialogOptions}
|
222
|
+
* @private
|
223
|
+
*/
|
224
|
+
|
225
|
+
RowFilteringPlugin.prototype._dialogOptions = null;
|
206
226
|
/** @type {FilterBuilder}
|
207
227
|
* @private
|
208
228
|
*/
|
@@ -308,11 +328,16 @@ RowFilteringPlugin.prototype.config = function (options) {
|
|
308
328
|
}
|
309
329
|
}
|
310
330
|
|
331
|
+
if (rowFiltering["dialogOptions"]) {
|
332
|
+
this._dialogOptions = rowFiltering["dialogOptions"];
|
333
|
+
}
|
334
|
+
|
311
335
|
if (rowFiltering["clicked"]) {
|
312
336
|
rowFiltering["click"] = rowFiltering["clicked"];
|
313
337
|
}
|
314
338
|
|
315
339
|
this.addListener(rowFiltering, "click");
|
340
|
+
this.addListener(rowFiltering, "beforeDialogOpened");
|
316
341
|
this.addListener(rowFiltering, "iconCreated");
|
317
342
|
this.addListener(rowFiltering, "filterChanged");
|
318
343
|
this.addListener(rowFiltering, "refreshed");
|
@@ -356,17 +381,17 @@ RowFilteringPlugin.prototype.getConfigObject = function (gridOptions) {
|
|
356
381
|
column = columns[i] = {};
|
357
382
|
}
|
358
383
|
|
359
|
-
var
|
384
|
+
var cfo = this._getColumnFilterOption(i);
|
360
385
|
|
361
|
-
if (
|
362
|
-
var exp =
|
386
|
+
if (cfo) {
|
387
|
+
var exp = cfo._expressions[0];
|
363
388
|
|
364
389
|
if (exp && typeof exp !== "function") {
|
365
390
|
// TODO: Accept function type
|
366
391
|
column.filter = exp; // This could be string, array, or object
|
367
392
|
}
|
368
393
|
|
369
|
-
var ctx =
|
394
|
+
var ctx = cfo._context[0];
|
370
395
|
|
371
396
|
if (ctx != null) {
|
372
397
|
if (_typeof(ctx) !== "object" || !ctx._autoGenerated) {
|
@@ -382,7 +407,14 @@ RowFilteringPlugin.prototype.getConfigObject = function (gridOptions) {
|
|
382
407
|
extOptions = obj.rowFiltering = {};
|
383
408
|
}
|
384
409
|
|
385
|
-
|
410
|
+
if (this._iconActivation !== "onActiveFilter") {
|
411
|
+
extOptions.iconActivation = this._iconActivation;
|
412
|
+
}
|
413
|
+
|
414
|
+
if (this._dialogOptions) {
|
415
|
+
extOptions.dialogOptions = this._dialogOptions; // TODO: dialogOptions should not contain any function
|
416
|
+
}
|
417
|
+
|
386
418
|
return obj;
|
387
419
|
};
|
388
420
|
/** All filter logics in DataView will be temporarily removed until re-enabling. This is useful when trying to insert an item at the specified index. After re-enabling, both logics and icons will be restored.
|
@@ -617,7 +649,8 @@ RowFilteringPlugin.prototype.setColumnFilter = function (colIndex, exp, ctx) {
|
|
617
649
|
|
618
650
|
return removed || added;
|
619
651
|
};
|
620
|
-
/**
|
652
|
+
/** Set data to colData["rowFiltering"]
|
653
|
+
* @private
|
621
654
|
* @param {number} colIndex
|
622
655
|
* @param {RowFilteringPlugin~ColumnOptions} columnOptions
|
623
656
|
* @example
|
@@ -658,7 +691,7 @@ RowFilteringPlugin.prototype._setColumnOptions = function (colIndex, columnOptio
|
|
658
691
|
};
|
659
692
|
/** @private
|
660
693
|
* @param {number} colIndex
|
661
|
-
* @return {Object
|
694
|
+
* @return {Object} colData["rowFiltering"]
|
662
695
|
*/
|
663
696
|
|
664
697
|
|
@@ -684,7 +717,7 @@ RowFilteringPlugin.prototype._newExtColumnOptions = function (colIndex) {
|
|
684
717
|
};
|
685
718
|
/** @private
|
686
719
|
* @param {number} colIndex
|
687
|
-
* @return {Object
|
720
|
+
* @return {Object} colData["rowFiltering"]["filterOption"]
|
688
721
|
*/
|
689
722
|
|
690
723
|
|
@@ -697,7 +730,8 @@ RowFilteringPlugin.prototype._getColumnFilterOption = function (colIndex) {
|
|
697
730
|
return null;
|
698
731
|
}
|
699
732
|
};
|
700
|
-
/**
|
733
|
+
/** Set data to colData["rowFiltering"]["filterOption"]
|
734
|
+
* @private
|
701
735
|
* @param {number} colIndex
|
702
736
|
* @param {Object} filterOption
|
703
737
|
*/
|
@@ -1098,15 +1132,14 @@ RowFilteringPlugin.prototype._onPreSectionRender = function (e) {
|
|
1098
1132
|
*/
|
1099
1133
|
|
1100
1134
|
|
1101
|
-
RowFilteringPlugin.prototype.
|
1135
|
+
RowFilteringPlugin.prototype._onIconClicked = function (e) {
|
1102
1136
|
var host = this._hosts[0];
|
1103
1137
|
|
1104
1138
|
if (!host) {
|
1105
1139
|
return;
|
1106
1140
|
}
|
1107
1141
|
|
1108
|
-
var pos = host.getRelativePosition(e);
|
1109
|
-
|
1142
|
+
var pos = host.getRelativePosition(e);
|
1110
1143
|
this.openDialog(pos.colIndex);
|
1111
1144
|
e.stopPropagation();
|
1112
1145
|
e.preventDefault();
|
@@ -1308,7 +1341,7 @@ RowFilteringPlugin.prototype._updateColumnIcon = function (colIndex) {
|
|
1308
1341
|
|
1309
1342
|
filterIcon.classList.add("title-filter-icon"); // Icon reference
|
1310
1343
|
|
1311
|
-
filterIcon.addEventListener("click", this.
|
1344
|
+
filterIcon.addEventListener("click", this._onIconClicked, false);
|
1312
1345
|
|
1313
1346
|
this._dispatch("iconCreated", {
|
1314
1347
|
"icon": filterIcon,
|
@@ -1552,11 +1585,11 @@ RowFilteringPlugin.prototype.getUniqueValues = function (field, formatter, fmtFi
|
|
1552
1585
|
};
|
1553
1586
|
/** @public
|
1554
1587
|
* @param {number} colIndex
|
1555
|
-
* @param {RowFilteringPlugin~FilterDialogOptions=}
|
1588
|
+
* @param {RowFilteringPlugin~FilterDialogOptions=} runtimeDialogOptions
|
1556
1589
|
*/
|
1557
1590
|
|
1558
1591
|
|
1559
|
-
RowFilteringPlugin.prototype.openDialog = function (colIndex,
|
1592
|
+
RowFilteringPlugin.prototype.openDialog = function (colIndex, runtimeDialogOptions) {
|
1560
1593
|
var stp = this._getPlugin("SortableTitlePlugin");
|
1561
1594
|
|
1562
1595
|
if (!this._filterDialog) {
|
@@ -1584,7 +1617,7 @@ RowFilteringPlugin.prototype.openDialog = function (colIndex, options) {
|
|
1584
1617
|
}
|
1585
1618
|
|
1586
1619
|
if (this._filterDialog.isShown) {
|
1587
|
-
this._filterDialog.hide(); // Hide previously
|
1620
|
+
this._filterDialog.hide(); // Hide previously opened dialog
|
1588
1621
|
|
1589
1622
|
|
1590
1623
|
if (this._filterDialog._colIndex === colIndex) {
|
@@ -1620,27 +1653,89 @@ RowFilteringPlugin.prototype.openDialog = function (colIndex, options) {
|
|
1620
1653
|
return; // The specified column has no field
|
1621
1654
|
}
|
1622
1655
|
|
1656
|
+
if (this.hasListener("beforeDialogOpened")) {
|
1657
|
+
var arg = {
|
1658
|
+
colIndex: colIndex,
|
1659
|
+
field: field,
|
1660
|
+
grid: host
|
1661
|
+
};
|
1662
|
+
|
1663
|
+
if (runtimeDialogOptions) {
|
1664
|
+
arg["dialogOptions"] = runtimeDialogOptions;
|
1665
|
+
}
|
1666
|
+
|
1667
|
+
this._dispatch("beforeDialogOpened", arg);
|
1668
|
+
|
1669
|
+
if (arg["cancel"]) {
|
1670
|
+
return;
|
1671
|
+
}
|
1672
|
+
|
1673
|
+
if (arg["dialogOptions"]) {
|
1674
|
+
runtimeDialogOptions = arg["dialogOptions"];
|
1675
|
+
}
|
1676
|
+
}
|
1677
|
+
|
1678
|
+
if (_typeof(runtimeDialogOptions) !== "object") {
|
1679
|
+
runtimeDialogOptions = null;
|
1680
|
+
}
|
1681
|
+
|
1623
1682
|
if (stp) {
|
1624
1683
|
this._filterDialog.setSortState(stp.getSortOrder(colIndex)); // This is for ELF v3
|
1625
1684
|
|
1626
|
-
} //
|
1685
|
+
} // Setting up dialog configuration
|
1686
|
+
// cfo is required for storing unique entries in the dialog, even though no filter is active
|
1627
1687
|
|
1628
1688
|
|
1629
|
-
var cfo = this._initColumnFilterOption(colIndex);
|
1689
|
+
var cfo = this._initColumnFilterOption(colIndex); // colData["rowFiltering"]["filterOption"]
|
1630
1690
|
|
1631
|
-
var rawDataAccessor = cfo._rawDataAccessor || null;
|
1632
|
-
var formattedDataAccessor = cfo._formattedDataAccessor || null;
|
1633
1691
|
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1692
|
+
var colOptions = this._getExtColumnOptions(colIndex); // colData["rowFiltering"]
|
1693
|
+
|
1694
|
+
|
1695
|
+
var colData = host.getColumnData(colIndex);
|
1696
|
+
var formatOptions = colData.formatOptions;
|
1697
|
+
var useUTCTime = false;
|
1698
|
+
|
1699
|
+
if (formatOptions) {
|
1700
|
+
if (formatOptions.formatType) {
|
1701
|
+
useUTCTime = true;
|
1702
|
+
|
1703
|
+
if (formatOptions.useUTCTime != null) {
|
1704
|
+
useUTCTime = formatOptions.useUTCTime;
|
1705
|
+
}
|
1637
1706
|
}
|
1707
|
+
}
|
1638
1708
|
|
1639
|
-
|
1640
|
-
|
1709
|
+
var dialogConfig = {
|
1710
|
+
// default config
|
1711
|
+
sortUI: true,
|
1712
|
+
filterUI: true,
|
1713
|
+
fieldDataType: "",
|
1714
|
+
lang: "",
|
1715
|
+
rawDataAccessor: null,
|
1716
|
+
formattedDataAccessor: null,
|
1717
|
+
sortLogic: null
|
1718
|
+
};
|
1719
|
+
var columnDialogOptions = null;
|
1720
|
+
|
1721
|
+
if (colOptions) {
|
1722
|
+
if (colOptions.fieldDataType) {
|
1723
|
+
// TODO: Use data type from Composite Grid (getColumnDataType) or Realtime Grid (getDataType) instead
|
1724
|
+
columnDialogOptions = {
|
1725
|
+
fieldDataType: colOptions.fieldDataType
|
1726
|
+
};
|
1641
1727
|
}
|
1642
|
-
}
|
1728
|
+
}
|
1729
|
+
|
1730
|
+
RowFilteringPlugin._overrideConfig(dialogConfig, this._dialogOptions);
|
1643
1731
|
|
1732
|
+
RowFilteringPlugin._overrideConfig(dialogConfig, columnDialogOptions);
|
1733
|
+
|
1734
|
+
RowFilteringPlugin._overrideConfig(dialogConfig, runtimeDialogOptions);
|
1735
|
+
|
1736
|
+
var rawDataAccessor = cfo._rawDataAccessor = dialogConfig.rawDataAccessor || null;
|
1737
|
+
var formattedDataAccessor = cfo._formattedDataAccessor = dialogConfig.formattedDataAccessor || null;
|
1738
|
+
var sortLogic = dialogConfig.sortLogic || null; // Populate data for filter dialog based on existing states
|
1644
1739
|
|
1645
1740
|
var customFilter = cfo._expressions[0] || "";
|
1646
1741
|
var ctx = cfo._context[0];
|
@@ -1655,8 +1750,7 @@ RowFilteringPlugin.prototype.openDialog = function (colIndex, options) {
|
|
1655
1750
|
var uniqueValues = cfo.uniqueValues = this.getUniqueValues(field, this._getFormatter(colIndex), "", rawDataAccessor, formattedDataAccessor);
|
1656
1751
|
var keys = Object.keys(uniqueValues);
|
1657
1752
|
|
1658
|
-
if (
|
1659
|
-
var sortLogic = options.sortLogic;
|
1753
|
+
if (sortLogic) {
|
1660
1754
|
keys.sort(function (a, b) {
|
1661
1755
|
var rawValueA = uniqueValues[a][0];
|
1662
1756
|
var rawValueB = uniqueValues[b][0];
|
@@ -1671,96 +1765,80 @@ RowFilteringPlugin.prototype.openDialog = function (colIndex, options) {
|
|
1671
1765
|
nodes: [],
|
1672
1766
|
checked: selectedItems[formattedVal] ? true : false
|
1673
1767
|
};
|
1674
|
-
}); //
|
1768
|
+
}); // Initialize dialog
|
1675
1769
|
|
1676
|
-
|
1770
|
+
if (this._filterDialog.init) {
|
1771
|
+
// TODO: support initiailization in v1
|
1772
|
+
this._filterDialog.init(dialogConfig);
|
1773
|
+
} // TODO: Move all settings to configuration object
|
1677
1774
|
|
1678
|
-
var fdt = "";
|
1679
|
-
var sui = true;
|
1680
|
-
var fui = true;
|
1681
|
-
var lang = "";
|
1682
1775
|
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1776
|
+
this._filterDialog.useUTCTime = useUTCTime;
|
1777
|
+
this._filterDialog.target = cell.getElement();
|
1778
|
+
this._filterDialog._colIndex = colIndex;
|
1779
|
+
this._filterDialog.data = items; // TODO: Move all settings to configuration object
|
1687
1780
|
|
1688
|
-
|
1689
|
-
|
1690
|
-
}
|
1781
|
+
this._filterDialog.filterMode = customFilter ? "advanced" : "";
|
1782
|
+
this._filterDialog.conditions = customFilter; // WARNING: This must be 2D Array
|
1691
1783
|
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1784
|
+
this._filterDialog.show();
|
1785
|
+
};
|
1786
|
+
/** @private
|
1787
|
+
* @function
|
1788
|
+
* @param {Object} config
|
1789
|
+
* @param {RowFilteringPlugin~FilterDialogOptions=} userConfig
|
1790
|
+
*/
|
1695
1791
|
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1792
|
+
|
1793
|
+
RowFilteringPlugin._overrideConfig = function (config, userConfig) {
|
1794
|
+
if (!userConfig) {
|
1795
|
+
return;
|
1699
1796
|
}
|
1700
1797
|
|
1701
|
-
var
|
1702
|
-
sortUI: sui,
|
1703
|
-
filterUI: fui,
|
1704
|
-
fieldDataType: fdt,
|
1705
|
-
lang: lang
|
1706
|
-
};
|
1798
|
+
var sortUI = userConfig["sortUI"];
|
1707
1799
|
|
1708
|
-
if (
|
1709
|
-
|
1710
|
-
|
1711
|
-
var filterUI = options["filterUI"];
|
1712
|
-
var optionLang = options["lang"];
|
1800
|
+
if (sortUI != null) {
|
1801
|
+
config.sortUI = sortUI;
|
1802
|
+
}
|
1713
1803
|
|
1714
|
-
|
1715
|
-
dialogConfig.sortUI = sortUI;
|
1716
|
-
colOptions.sortUI = sortUI;
|
1717
|
-
}
|
1804
|
+
var filterUI = userConfig["filterUI"];
|
1718
1805
|
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
}
|
1806
|
+
if (filterUI != null) {
|
1807
|
+
config.filterUI = filterUI;
|
1808
|
+
}
|
1723
1809
|
|
1724
|
-
|
1725
|
-
dialogConfig.fieldDataType = fieldDataType;
|
1726
|
-
colOptions.fieldDataType = fieldDataType;
|
1727
|
-
}
|
1810
|
+
var fieldDataType = userConfig["fieldDataType"];
|
1728
1811
|
|
1729
|
-
|
1730
|
-
|
1731
|
-
colOptions.lang = optionLang;
|
1732
|
-
}
|
1812
|
+
if (fieldDataType != null) {
|
1813
|
+
config.fieldDataType = fieldDataType;
|
1733
1814
|
}
|
1734
1815
|
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1816
|
+
var lang = userConfig["lang"];
|
1817
|
+
|
1818
|
+
if (lang != null) {
|
1819
|
+
config.lang = lang;
|
1738
1820
|
}
|
1739
1821
|
|
1740
|
-
var
|
1741
|
-
var formatOptions = colData.formatOptions;
|
1742
|
-
var useUTCTime = false;
|
1822
|
+
var rawDataAccessor = userConfig["rawDataAccessor"];
|
1743
1823
|
|
1744
|
-
if (
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1748
|
-
if (formatOptions.useUTCTime != null) {
|
1749
|
-
useUTCTime = formatOptions.useUTCTime;
|
1750
|
-
}
|
1751
|
-
}
|
1824
|
+
if (typeof rawDataAccessor === "function" || rawDataAccessor === null) {
|
1825
|
+
// Allow null value
|
1826
|
+
config.rawDataAccessor = rawDataAccessor;
|
1752
1827
|
}
|
1753
1828
|
|
1754
|
-
|
1755
|
-
this._filterDialog.target = cell.getElement();
|
1756
|
-
this._filterDialog._colIndex = colIndex;
|
1757
|
-
this._filterDialog.data = items; // TODO: Move all settings to configuration object
|
1829
|
+
var formattedDataAccessor = userConfig["formattedDataAccessor"];
|
1758
1830
|
|
1759
|
-
|
1831
|
+
if (typeof formattedDataAccessor === "function" || formattedDataAccessor === null) {
|
1832
|
+
// Allow null value
|
1833
|
+
config.formattedDataAccessor = formattedDataAccessor;
|
1834
|
+
}
|
1760
1835
|
|
1761
|
-
|
1836
|
+
var sortLogic = userConfig["sortLogic"];
|
1762
1837
|
|
1763
|
-
|
1838
|
+
if (typeof sortLogic === "function" || sortLogic === null) {
|
1839
|
+
// Allow null value
|
1840
|
+
config.sortLogic = sortLogic;
|
1841
|
+
}
|
1764
1842
|
};
|
1765
1843
|
/** @private
|
1766
1844
|
* @param {number} colIndex
|