@refinitiv-ui/efx-grid 6.0.42 → 6.0.43
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/column-format-dialog/lib/column-format-dialog.d.ts +1 -0
- package/lib/column-format-dialog/lib/column-format-dialog.js +3 -24
- package/lib/column-format-dialog/lib/preview-table.d.ts +1 -1
- package/lib/column-format-dialog/lib/preview-table.js +15 -27
- package/lib/core/dist/core.js +7 -1
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +1 -1
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +6 -0
- package/lib/formatters/es6/CoralButtonFormatter.d.ts +2 -2
- package/lib/formatters/es6/CoralCheckboxFormatter.d.ts +1 -1
- package/lib/formatters/es6/CoralComboBoxFormatter.d.ts +4 -4
- package/lib/formatters/es6/CoralIconFormatter.d.ts +3 -3
- package/lib/formatters/es6/CoralInputFormatter.d.ts +1 -1
- package/lib/formatters/es6/CoralRadioButtonFormatter.d.ts +2 -2
- package/lib/formatters/es6/CoralSelectFormatter.d.ts +4 -4
- package/lib/formatters/es6/CoralToggleFormatter.d.ts +1 -1
- package/lib/formatters/es6/DuplexEmeraldDateTimePickerFormatter.d.ts +1 -1
- package/lib/formatters/es6/EFButtonFormatter.d.ts +2 -2
- package/lib/formatters/es6/EFCheckboxFormatter.d.ts +1 -1
- package/lib/formatters/es6/EFComboBoxFormatter.d.ts +4 -4
- package/lib/formatters/es6/EFDateTimePickerFormatter.d.ts +1 -1
- package/lib/formatters/es6/EFIconFormatter.d.ts +3 -3
- package/lib/formatters/es6/EFNumberFieldFormatter.d.ts +1 -1
- package/lib/formatters/es6/EFRadioButtonFormatter.d.ts +2 -2
- package/lib/formatters/es6/EFSelectFormatter.d.ts +4 -4
- package/lib/formatters/es6/EFTextFieldFormatter.d.ts +1 -1
- package/lib/formatters/es6/EFToggleFormatter.d.ts +1 -1
- package/lib/formatters/es6/EmeraldDateTimePickerFormatter.d.ts +1 -1
- package/lib/formatters/es6/FormatterBuilder.d.ts +6 -2
- package/lib/formatters/es6/FormatterBuilder.js +328 -178
- package/lib/formatters/es6/NumericInputFormatter.d.ts +1 -1
- package/lib/formatters/es6/PercentBarFormatter.d.ts +6 -6
- package/lib/formatters/es6/SimpleImageFormatter.d.ts +3 -3
- package/lib/formatters/es6/SimpleInputFormatter.d.ts +1 -1
- package/lib/formatters/es6/SimpleLinkFormatter.d.ts +3 -3
- package/lib/formatters/es6/SimpleTickerFormatter.d.ts +3 -3
- package/lib/formatters/es6/SimpleToggleFormatter.d.ts +3 -3
- package/lib/formatters/es6/TextFormatter.d.ts +1 -1
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +1 -0
- package/lib/rt-grid/es6/Grid.d.ts +2 -1
- package/lib/rt-grid/es6/Grid.js +1 -0
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +35 -25
- package/lib/tr-grid-filter-input/es6/FilterInput.d.ts +17 -17
- package/lib/tr-grid-filter-input/es6/FilterInput.js +146 -33
- package/lib/types/es6/CoralButtonFormatter.d.ts +2 -2
- package/lib/types/es6/CoralCheckboxFormatter.d.ts +1 -1
- package/lib/types/es6/CoralComboBoxFormatter.d.ts +4 -4
- package/lib/types/es6/CoralIconFormatter.d.ts +3 -3
- package/lib/types/es6/CoralInputFormatter.d.ts +1 -1
- package/lib/types/es6/CoralRadioButtonFormatter.d.ts +2 -2
- package/lib/types/es6/CoralSelectFormatter.d.ts +4 -4
- package/lib/types/es6/CoralToggleFormatter.d.ts +1 -1
- package/lib/types/es6/DuplexEmeraldDateTimePickerFormatter.d.ts +1 -1
- package/lib/types/es6/EFButtonFormatter.d.ts +2 -2
- package/lib/types/es6/EFCheckboxFormatter.d.ts +1 -1
- package/lib/types/es6/EFComboBoxFormatter.d.ts +4 -4
- package/lib/types/es6/EFDateTimePickerFormatter.d.ts +1 -1
- package/lib/types/es6/EFIconFormatter.d.ts +3 -3
- package/lib/types/es6/EFNumberFieldFormatter.d.ts +1 -1
- package/lib/types/es6/EFRadioButtonFormatter.d.ts +2 -2
- package/lib/types/es6/EFSelectFormatter.d.ts +4 -4
- package/lib/types/es6/EFTextFieldFormatter.d.ts +1 -1
- package/lib/types/es6/EFToggleFormatter.d.ts +1 -1
- package/lib/types/es6/EmeraldDateTimePickerFormatter.d.ts +1 -1
- package/lib/types/es6/FilterInput.d.ts +17 -17
- package/lib/types/es6/FormatterBuilder.d.ts +6 -2
- package/lib/types/es6/NumericInputFormatter.d.ts +1 -1
- package/lib/types/es6/PercentBarFormatter.d.ts +6 -6
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +22 -0
- package/lib/types/es6/SimpleImageFormatter.d.ts +3 -3
- package/lib/types/es6/SimpleInputFormatter.d.ts +1 -1
- package/lib/types/es6/SimpleLinkFormatter.d.ts +3 -3
- package/lib/types/es6/SimpleTickerFormatter.d.ts +3 -3
- package/lib/types/es6/SimpleToggleFormatter.d.ts +3 -3
- package/lib/types/es6/TextFormatter.d.ts +1 -1
- package/lib/versions.json +4 -4
- package/package.json +1 -1
@@ -3,8 +3,8 @@ import FormatterBuilder from "./FormatterBuilder.js";
|
|
3
3
|
declare namespace SimpleLinkFormatter {
|
4
4
|
|
5
5
|
type Options = {
|
6
|
-
label?: string,
|
7
|
-
urlField?: string
|
6
|
+
label?: string|null,
|
7
|
+
urlField?: string|null
|
8
8
|
};
|
9
9
|
|
10
10
|
}
|
@@ -13,7 +13,7 @@ declare class SimpleLinkFormatter {
|
|
13
13
|
|
14
14
|
constructor(options?: any);
|
15
15
|
|
16
|
-
public static create(options?: (FormatterBuilder.Options|SimpleLinkFormatter.Options|any)): any;
|
16
|
+
public static create(options?: (FormatterBuilder.Options|SimpleLinkFormatter.Options|any)|null): any;
|
17
17
|
|
18
18
|
}
|
19
19
|
|
@@ -5,8 +5,8 @@ import ElfUtil from "../../tr-grid-util/es6/ElfUtil.js";
|
|
5
5
|
declare namespace SimpleTickerFormatter {
|
6
6
|
|
7
7
|
type Options = {
|
8
|
-
positiveColor?: string,
|
9
|
-
negativeColor?: string
|
8
|
+
positiveColor?: string|null,
|
9
|
+
negativeColor?: string|null
|
10
10
|
};
|
11
11
|
|
12
12
|
}
|
@@ -15,7 +15,7 @@ declare class SimpleTickerFormatter {
|
|
15
15
|
|
16
16
|
constructor(options?: any);
|
17
17
|
|
18
|
-
public static create(options?: (FormatterBuilder.Options|SimpleTickerFormatter.Options|any)): any;
|
18
|
+
public static create(options?: (FormatterBuilder.Options|SimpleTickerFormatter.Options|any)|null): any;
|
19
19
|
|
20
20
|
}
|
21
21
|
|
@@ -4,8 +4,8 @@ import ElfUtil from "../../tr-grid-util/es6/ElfUtil.js";
|
|
4
4
|
declare namespace SimpleToggleFormatter {
|
5
5
|
|
6
6
|
type Options = {
|
7
|
-
element1?: (string|Element),
|
8
|
-
element2?: (string|Element)
|
7
|
+
element1?: (string|Element)|null,
|
8
|
+
element2?: (string|Element)|null
|
9
9
|
};
|
10
10
|
|
11
11
|
}
|
@@ -14,7 +14,7 @@ declare class SimpleToggleFormatter {
|
|
14
14
|
|
15
15
|
constructor(options?: any);
|
16
16
|
|
17
|
-
public static create(options?: (FormatterBuilder.Options|SimpleToggleFormatter.Options|any)): any;
|
17
|
+
public static create(options?: (FormatterBuilder.Options|SimpleToggleFormatter.Options|any)|null): any;
|
18
18
|
|
19
19
|
}
|
20
20
|
|
package/lib/grid/index.js
CHANGED
@@ -43994,6 +43994,7 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
|
|
43994
43994
|
* @property {boolean=} timeSeriesExpansion=true If disabled, the time series field will be treated as a normal field and not expanded.
|
43995
43995
|
* @property {string=} childDataField=CHILD_VALUES The given field will be used to store children's static data, such as row color assignment.
|
43996
43996
|
* @property {boolean=} topSection=true If disabled, title section will not be rendered
|
43997
|
+
* @property {SortableTitlePlugin~Options=} sorting Options for sorting
|
43997
43998
|
*/
|
43998
43999
|
|
43999
44000
|
/** @typedef {number|string|RowDefinition} Grid~RowReference
|
@@ -83,7 +83,8 @@ declare namespace Grid {
|
|
83
83
|
fieldCaching?: boolean|null,
|
84
84
|
timeSeriesExpansion?: boolean|null,
|
85
85
|
childDataField?: string|null,
|
86
|
-
topSection?: boolean|null
|
86
|
+
topSection?: boolean|null,
|
87
|
+
sorting?: SortableTitlePlugin.Options|null
|
87
88
|
};
|
88
89
|
|
89
90
|
type RowReference = number|string|RowDefinition|null;
|
package/lib/rt-grid/es6/Grid.js
CHANGED
@@ -87,6 +87,7 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
|
|
87
87
|
* @property {boolean=} timeSeriesExpansion=true If disabled, the time series field will be treated as a normal field and not expanded.
|
88
88
|
* @property {string=} childDataField=CHILD_VALUES The given field will be used to store children's static data, such as row color assignment.
|
89
89
|
* @property {boolean=} topSection=true If disabled, title section will not be rendered
|
90
|
+
* @property {SortableTitlePlugin~Options=} sorting Options for sorting
|
90
91
|
*/
|
91
92
|
|
92
93
|
/** @typedef {number|string|RowDefinition} Grid~RowReference
|
@@ -50,13 +50,15 @@ import { preventDefault } from "../../tr-grid-util/es6/EventDispatcher.js";
|
|
50
50
|
/** @event ColumnStackPlugin#clicked
|
51
51
|
* @description Fired when user clicks on stack/expanding icon
|
52
52
|
* @type {Object}
|
53
|
-
* @property {number} colIndex
|
54
|
-
* @property {number} rowIndex
|
53
|
+
* @property {number} colIndex The column index that was clicked
|
54
|
+
* @property {number} rowIndex The row index that was clicked
|
55
55
|
* @property {Array.<Object>} menuData Data for populating context menu
|
56
|
-
* @property {number} activeIndex
|
57
|
-
* @property {Array.<number>} columnIndices
|
58
|
-
* @property {number} activeColIndex
|
56
|
+
* @property {number} activeIndex The index of the item in the menuData that corresponds to the active column
|
57
|
+
* @property {Array.<number>} columnIndices Members column index
|
58
|
+
* @property {number} activeColIndex The column index that is currently active
|
59
59
|
* @property {Event} event Native event argument from click event
|
60
|
+
* @property {boolean} spreading True if the column being clicked is a member of the collapsing group
|
61
|
+
* @property {boolean} collapsed True If the clicked group is collapsed
|
60
62
|
*/
|
61
63
|
|
62
64
|
/** @private
|
@@ -259,10 +261,14 @@ ColumnStackPlugin._styles = prettifyCss([
|
|
259
261
|
"margin: 0;",
|
260
262
|
"justify-content: center;"
|
261
263
|
],
|
262
|
-
".tr-grid .collapsed .cell.grouping .front-panel,
|
263
|
-
".tr-grid .collapsed .cell.grouping .floating-panel *:not(.stack-icon)"
|
264
|
+
".tr-grid .collapsed .cell.grouping .front-panel," +
|
265
|
+
".tr-grid .collapsed .cell.grouping .floating-panel *:not(.stack-icon)," +
|
266
|
+
".tr-grid .collapsed .cell.grouping .sort-symbol", [ // V3 Hide arrow sorting in collapse state in speading mode
|
264
267
|
"display: none;"
|
265
268
|
],
|
269
|
+
".floating-panel .stack-icon", [
|
270
|
+
"cursor: pointer;" // change the mouse cursor on the collapsed stack icon to allow for expansion but disallow sorting
|
271
|
+
],
|
266
272
|
".tr-grid .collapsed .cell.grouping .floating-panel .stack-icon", [
|
267
273
|
"margin-left: 0;"
|
268
274
|
],
|
@@ -1585,27 +1591,31 @@ ColumnStackPlugin.prototype._onStackButtonClicked = function(e) {
|
|
1585
1591
|
|
1586
1592
|
e.stopPropagation();
|
1587
1593
|
|
1588
|
-
if(colData.spreading) {
|
1589
|
-
this.collapseGroup(colIndex, !colData.collapsed);
|
1590
|
-
return;
|
1591
|
-
}
|
1592
|
-
|
1593
1594
|
var children = colData.children;
|
1594
|
-
var activeIndex = children.indexOf(colData.activeColumn);
|
1595
|
-
|
1596
|
-
var len = children.length;
|
1597
1595
|
var colIndices = this.getColumnIndices(children);
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1596
|
+
if(colData.spreading) {
|
1597
|
+
var collapsed = !colData.collapsed;
|
1598
|
+
this.collapseGroup(colIndex, collapsed);
|
1599
|
+
pos["menuData"] = null;
|
1600
|
+
pos["activeIndex"] = -1;
|
1601
|
+
pos["collapsed"] = collapsed;
|
1602
|
+
} else {
|
1603
|
+
var activeIndex = children.indexOf(colData.activeColumn);
|
1604
|
+
var len = children.length;
|
1605
|
+
var menuData = new Array(len);
|
1606
|
+
for(var i = len; --i >= 0;) {
|
1607
|
+
menuData[i] = {
|
1608
|
+
value: i,
|
1609
|
+
selected: i === activeIndex,
|
1610
|
+
label: this.getColumnName(colIndices[i]),
|
1611
|
+
field: this.getColumnField(colIndices[i])
|
1612
|
+
};
|
1613
|
+
}
|
1614
|
+
pos["menuData"] = menuData;
|
1615
|
+
pos["activeIndex"] = activeIndex;
|
1616
|
+
pos["collapsed"] = false;
|
1606
1617
|
}
|
1607
|
-
pos["
|
1608
|
-
pos["activeIndex"] = activeIndex;
|
1618
|
+
pos["spreading"] = colData.spreading;
|
1609
1619
|
pos["columnIndices"] = colIndices;
|
1610
1620
|
pos["activeColIndex"] = this.getColumnIndex(colData.activeColumn);
|
1611
1621
|
pos["event"] = e;
|
@@ -7,30 +7,30 @@ import { CoralItems } from '../../tr-grid-util/es6/CoralItems.js';
|
|
7
7
|
declare namespace FilterInputPlugin {
|
8
8
|
|
9
9
|
type GridColumn = {
|
10
|
-
filterInput?: FilterInputPlugin.ColumnOptions
|
10
|
+
filterInput?: FilterInputPlugin.ColumnOptions|null
|
11
11
|
};
|
12
12
|
|
13
13
|
type ColumnOptions = {
|
14
|
-
defaultLogic?: ((...params: any[]) => any),
|
15
|
-
filterLogic?: ((...params: any[]) => any),
|
16
|
-
disabled?: boolean,
|
17
|
-
placeholder?: string,
|
18
|
-
type?: string,
|
19
|
-
entries?: any[],
|
14
|
+
defaultLogic?: ((...params: any[]) => any)|null,
|
15
|
+
filterLogic?: ((...params: any[]) => any)|null,
|
16
|
+
disabled?: boolean|null,
|
17
|
+
placeholder?: string|null,
|
18
|
+
type?: string|null,
|
19
|
+
entries?: any[]|null,
|
20
20
|
defaultValue?: any,
|
21
|
-
trigger?: string
|
21
|
+
trigger?: string|null
|
22
22
|
};
|
23
23
|
|
24
24
|
type Options = {
|
25
|
-
inputCreated?: ((...params: any[]) => any),
|
26
|
-
trigger?: string
|
25
|
+
inputCreated?: ((...params: any[]) => any)|null,
|
26
|
+
trigger?: string|null
|
27
27
|
};
|
28
28
|
|
29
29
|
}
|
30
30
|
|
31
31
|
declare class FilterInputPlugin extends GridPlugin {
|
32
32
|
|
33
|
-
constructor(options?: FilterInputPlugin.Options);
|
33
|
+
constructor(options?: FilterInputPlugin.Options|null);
|
34
34
|
|
35
35
|
public getName(): string;
|
36
36
|
|
@@ -42,17 +42,17 @@ declare class FilterInputPlugin extends GridPlugin {
|
|
42
42
|
|
43
43
|
public getConfigObject(out_obj?: any): any;
|
44
44
|
|
45
|
-
public getColumnInput(colIndex: number): Element;
|
45
|
+
public getColumnInput(colIndex: number): Element|null;
|
46
46
|
|
47
|
-
public removeColumnFilters(colIndex?: (null|number)): void;
|
47
|
+
public removeColumnFilters(colIndex?: (null|number)|null): void;
|
48
48
|
|
49
|
-
public removeColumnFilter(colIndex?: (null|number)): void;
|
49
|
+
public removeColumnFilter(colIndex?: (null|number)|null): void;
|
50
50
|
|
51
|
-
public refresh(delayMs?: number): void;
|
51
|
+
public refresh(delayMs?: number|null): void;
|
52
52
|
|
53
|
-
public setFilterLogic(colIndex: number, func: ((...params: any[]) => any), ctx?: any): void;
|
53
|
+
public setFilterLogic(colIndex: number, func: ((...params: any[]) => any)|null, ctx?: any): void;
|
54
54
|
|
55
|
-
public filterColumn(colIndex: number, text: string): void;
|
55
|
+
public filterColumn(colIndex: number, text: string, textMap?: any): void;
|
56
56
|
|
57
57
|
}
|
58
58
|
|
@@ -14,7 +14,7 @@ import { CoralItems } from '../../tr-grid-util/es6/CoralItems.js';
|
|
14
14
|
* @property {Function=} filterLogic=null Alias to `defaultLogic`
|
15
15
|
* @property {boolean=} disabled=false Disable UI
|
16
16
|
* @property {string=} placeholder="" Placeholder text inside the input
|
17
|
-
* @property {string=} type="text" Type of UI. Available types are "number", "select", "dropdown", "date"
|
17
|
+
* @property {string=} type="text" Type of UI. Available types are "number", "multiselect" ,"select", "dropdown", "date"
|
18
18
|
* @property {Array=} entries Entries of dropdown filters when type is "select"
|
19
19
|
* @property {*=} defaultValue Default value of input filter
|
20
20
|
* @property {string=} trigger="keyup" Available types of trigger are `false | ""` (no trigger) , `"keyup"` (default) , `"enter"` (on enter key *only available for text type)
|
@@ -465,12 +465,20 @@ FilterInputPlugin.prototype._createColumnInputs = function (section, host) {
|
|
465
465
|
var defaultValue = colOpt.defaultValue;
|
466
466
|
|
467
467
|
if (defaultValue) {
|
468
|
-
|
468
|
+
var type = colOpt.type.toLowerCase();
|
469
|
+
|
470
|
+
if (type == "date") {
|
469
471
|
var dateObj = ElfDate.from(defaultValue);
|
470
472
|
defaultValue = dateObj ? dateObj.toDateString().substr(4) : "";
|
471
473
|
}
|
472
474
|
|
473
|
-
|
475
|
+
if (type == "multiselect") {
|
476
|
+
var textMap = FilterInputPlugin._createMapObject(defaultValue);
|
477
|
+
|
478
|
+
this.filterColumn(c, "", textMap);
|
479
|
+
} else {
|
480
|
+
this.filterColumn(c, defaultValue);
|
481
|
+
}
|
474
482
|
}
|
475
483
|
}
|
476
484
|
};
|
@@ -482,6 +490,7 @@ FilterInputPlugin.prototype._createColumnInputs = function (section, host) {
|
|
482
490
|
FilterInputPlugin._uiMap = {
|
483
491
|
number: "ef-input",
|
484
492
|
select: "ef-select",
|
493
|
+
multiselect: "ef-combo-box",
|
485
494
|
dropdown: "ef-select",
|
486
495
|
date: "ef-datetime-picker"
|
487
496
|
};
|
@@ -492,6 +501,11 @@ FilterInputPlugin._uiMap = {
|
|
492
501
|
|
493
502
|
FilterInputPlugin.prototype._createFilterUI = function (colOpt) {
|
494
503
|
var elemType = colOpt.type;
|
504
|
+
|
505
|
+
if (elemType) {
|
506
|
+
elemType = elemType.toLowerCase();
|
507
|
+
}
|
508
|
+
|
495
509
|
var defaultValue = colOpt.defaultValue;
|
496
510
|
var elemTrigger = colOpt.trigger != null ? colOpt.trigger : this._inputTrigger;
|
497
511
|
var uiTag = FilterInputPlugin._uiMap[elemType] || "input";
|
@@ -520,10 +534,6 @@ FilterInputPlugin.prototype._createFilterUI = function (colOpt) {
|
|
520
534
|
elem.addEventListener("keydown", FilterInputPlugin._stopPropagation, false);
|
521
535
|
elem.addEventListener("click", FilterInputPlugin._stopPropagation, false);
|
522
536
|
|
523
|
-
if (defaultValue) {
|
524
|
-
elem.value = colOpt.defaultValue;
|
525
|
-
}
|
526
|
-
|
527
537
|
switch (uiTag) {
|
528
538
|
case "ef-input":
|
529
539
|
elem.setAttribute("type", "number");
|
@@ -551,6 +561,17 @@ FilterInputPlugin.prototype._createFilterUI = function (colOpt) {
|
|
551
561
|
|
552
562
|
break;
|
553
563
|
|
564
|
+
case "ef-combo-box":
|
565
|
+
elem.multiple = true;
|
566
|
+
elem.data = CoralItems.create(colOpt.entries);
|
567
|
+
elem.addEventListener("opened-changed", this._onOpenedChanged, false);
|
568
|
+
|
569
|
+
if (elemTrigger != false && elemTrigger != "") {
|
570
|
+
elem.addEventListener("value-changed", this._onInputChanged, false);
|
571
|
+
}
|
572
|
+
|
573
|
+
break;
|
574
|
+
|
554
575
|
case "ef-datetime-picker":
|
555
576
|
if (elemTrigger != false && elemTrigger != "") {
|
556
577
|
elem.addEventListener("value-changed", this._onDateChanged, false);
|
@@ -593,6 +614,14 @@ FilterInputPlugin.prototype._createFilterUI = function (colOpt) {
|
|
593
614
|
break;
|
594
615
|
}
|
595
616
|
|
617
|
+
if (defaultValue) {
|
618
|
+
if (elemType === "multiselect") {
|
619
|
+
elem.values = defaultValue;
|
620
|
+
} else {
|
621
|
+
elem.value = defaultValue;
|
622
|
+
}
|
623
|
+
}
|
624
|
+
|
596
625
|
return elem;
|
597
626
|
};
|
598
627
|
/** @private
|
@@ -660,17 +689,25 @@ FilterInputPlugin.prototype._retrieveColumnOption = function (colIndex, colDef)
|
|
660
689
|
var type = filterOption["type"];
|
661
690
|
|
662
691
|
if (typeof type == "string") {
|
692
|
+
type = type.toLowerCase();
|
663
693
|
option["type"] = type;
|
694
|
+
|
695
|
+
if (type == "multiselect") {
|
696
|
+
option._comparingLogic = FilterInputPlugin._multiSelectionFilter;
|
697
|
+
}
|
664
698
|
}
|
665
699
|
|
666
700
|
var entries = filterOption["entries"];
|
667
701
|
|
668
702
|
if (Array.isArray(entries)) {
|
669
703
|
// Add Clear filter option
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
704
|
+
if (type === "select") {
|
705
|
+
entries.push({
|
706
|
+
label: 'No Filter',
|
707
|
+
value: 'No Filter'
|
708
|
+
});
|
709
|
+
}
|
710
|
+
|
674
711
|
option["entries"] = entries;
|
675
712
|
}
|
676
713
|
|
@@ -713,11 +750,12 @@ FilterInputPlugin.prototype.updateUI = function (colIndex, text) {
|
|
713
750
|
/** @private
|
714
751
|
* @param {number} colIndex
|
715
752
|
* @param {string} text
|
753
|
+
* @param {Object=} textMap
|
716
754
|
* @return {Object} Column option
|
717
755
|
*/
|
718
756
|
|
719
757
|
|
720
|
-
FilterInputPlugin.prototype._updateColumnOption = function (colIndex, text) {
|
758
|
+
FilterInputPlugin.prototype._updateColumnOption = function (colIndex, text, textMap) {
|
721
759
|
var option = this._getExtColumnOption(colIndex);
|
722
760
|
|
723
761
|
if (!option) {
|
@@ -736,6 +774,12 @@ FilterInputPlugin.prototype._updateColumnOption = function (colIndex, text) {
|
|
736
774
|
arg.inputText = option.inputText = inputText;
|
737
775
|
arg.lowerCasedText = inputText.toLowerCase();
|
738
776
|
arg.colIndex = colIndex;
|
777
|
+
|
778
|
+
if (textMap && !Object.keys(textMap).length) {
|
779
|
+
textMap = null;
|
780
|
+
}
|
781
|
+
|
782
|
+
arg.textMap = option.textMap = textMap;
|
739
783
|
}
|
740
784
|
|
741
785
|
return option;
|
@@ -830,6 +874,7 @@ FilterInputPlugin.prototype.setFilterLogic = function (colIndex, func, ctx) {
|
|
830
874
|
var option = this._newExtColumnOption(colIndex);
|
831
875
|
|
832
876
|
var inputText = option.inputText;
|
877
|
+
var textMap = option.textMap;
|
833
878
|
|
834
879
|
if (func) {
|
835
880
|
if (ctx != null) {
|
@@ -841,19 +886,20 @@ FilterInputPlugin.prototype.setFilterLogic = function (colIndex, func, ctx) {
|
|
841
886
|
|
842
887
|
option._comparingLogic = func;
|
843
888
|
|
844
|
-
if (inputText) {
|
845
|
-
this.filterColumn(colIndex, inputText);
|
889
|
+
if (inputText || textMap) {
|
890
|
+
this.filterColumn(colIndex, inputText, textMap);
|
846
891
|
}
|
847
892
|
};
|
848
893
|
/** Force filtering for a single column by changing filtering text
|
849
894
|
* @public
|
850
895
|
* @param {number} colIndex
|
851
896
|
* @param {string} text
|
897
|
+
* @param {Object=} textMap
|
852
898
|
*/
|
853
899
|
|
854
900
|
|
855
|
-
FilterInputPlugin.prototype.filterColumn = function (colIndex, text) {
|
856
|
-
var option = this._updateColumnOption(colIndex, text);
|
901
|
+
FilterInputPlugin.prototype.filterColumn = function (colIndex, text, textMap) {
|
902
|
+
var option = this._updateColumnOption(colIndex, text, textMap);
|
857
903
|
|
858
904
|
if (!option) {
|
859
905
|
return;
|
@@ -879,7 +925,9 @@ FilterInputPlugin.prototype._setColumnFilter = function (colIndex, filterOptions
|
|
879
925
|
proc.removeColumnFilters(colIndex); // TODO: this is slow
|
880
926
|
}
|
881
927
|
|
882
|
-
|
928
|
+
var hasFilterContent = filterOptions.inputText || filterOptions.textMap;
|
929
|
+
|
930
|
+
if (filterOptions._comparingLogic && hasFilterContent) {
|
883
931
|
var columnFilter = filterOptions._columnFilter;
|
884
932
|
|
885
933
|
if (!columnFilter) {
|
@@ -911,13 +959,17 @@ FilterInputPlugin.prototype._onInputChanged = function (e) {
|
|
911
959
|
var colIndex = pos.colIndex;
|
912
960
|
var input =
|
913
961
|
/** @type{Element} */
|
914
|
-
e.currentTarget;
|
915
|
-
|
916
|
-
|
917
|
-
|
962
|
+
e.currentTarget;
|
963
|
+
var filterValue = input.value;
|
964
|
+
var textMap; // If selected No Filter option - remove select filter
|
965
|
+
|
966
|
+
if (filterValue === "No Filter" && input.tagName.indexOf("SELECT") >= 0) {
|
967
|
+
filterValue = null;
|
968
|
+
} else if (input.tagName.indexOf("COMBO-BOX") >= 0) {
|
969
|
+
textMap = FilterInputPlugin._createMapObject(input.values);
|
918
970
|
}
|
919
971
|
|
920
|
-
this.filterColumn(colIndex,
|
972
|
+
this.filterColumn(colIndex, filterValue, textMap);
|
921
973
|
};
|
922
974
|
/** @private
|
923
975
|
* @param {Object=} e
|
@@ -969,6 +1021,49 @@ FilterInputPlugin._compareRow = function (filterOptions, rowData, rid) {
|
|
969
1021
|
FilterInputPlugin._rtCompareRow = function (filterOptions, rowData, rid) {
|
970
1022
|
return filterOptions._comparingLogic(filterOptions._filterArguments, rowData["ROW_DEF"].getRowData());
|
971
1023
|
};
|
1024
|
+
/** @private
|
1025
|
+
* @function
|
1026
|
+
* @param {Array<string>} ary
|
1027
|
+
* @return {Object}
|
1028
|
+
*/
|
1029
|
+
|
1030
|
+
|
1031
|
+
FilterInputPlugin._createMapObject = function (ary) {
|
1032
|
+
var textMap = {};
|
1033
|
+
|
1034
|
+
if (ary) {
|
1035
|
+
var count = ary.length;
|
1036
|
+
|
1037
|
+
for (var i = 0; i < count; i++) {
|
1038
|
+
var str = ary[i].toLowerCase();
|
1039
|
+
textMap[str] = true;
|
1040
|
+
}
|
1041
|
+
}
|
1042
|
+
|
1043
|
+
return textMap;
|
1044
|
+
};
|
1045
|
+
/** @private
|
1046
|
+
* @function
|
1047
|
+
* @param {Object} data
|
1048
|
+
* @return {string}
|
1049
|
+
*/
|
1050
|
+
|
1051
|
+
|
1052
|
+
FilterInputPlugin._transformToLowercaseString = function (data) {
|
1053
|
+
var dataStr = "";
|
1054
|
+
|
1055
|
+
if (typeof data != "string") {
|
1056
|
+
if (data instanceof Date) {
|
1057
|
+
dataStr = data.toDateString().toLowerCase();
|
1058
|
+
} else {
|
1059
|
+
dataStr = (data + "").toLocaleLowerCase;
|
1060
|
+
}
|
1061
|
+
} else if (data) {
|
1062
|
+
dataStr = data.toLowerCase();
|
1063
|
+
}
|
1064
|
+
|
1065
|
+
return dataStr;
|
1066
|
+
};
|
972
1067
|
/** Default Filter Logic
|
973
1068
|
* @private
|
974
1069
|
* @function
|
@@ -986,17 +1081,7 @@ FilterInputPlugin._containingFilter = function (e, rowData) {
|
|
986
1081
|
var data = rowData[e.field];
|
987
1082
|
|
988
1083
|
if (data != null) {
|
989
|
-
var dataStr;
|
990
|
-
|
991
|
-
if (typeof data != "string") {
|
992
|
-
if (data instanceof Date) {
|
993
|
-
dataStr = data.toDateString().toLowerCase();
|
994
|
-
} else {
|
995
|
-
dataStr = data + "";
|
996
|
-
}
|
997
|
-
} else if (data) {
|
998
|
-
dataStr = data.toLowerCase();
|
999
|
-
}
|
1084
|
+
var dataStr = FilterInputPlugin._transformToLowercaseString(data);
|
1000
1085
|
|
1001
1086
|
if (dataStr) {
|
1002
1087
|
if (eventType === "number") {
|
@@ -1014,6 +1099,34 @@ FilterInputPlugin._containingFilter = function (e, rowData) {
|
|
1014
1099
|
|
1015
1100
|
return true;
|
1016
1101
|
};
|
1102
|
+
/** Filter Logic for multi selection input
|
1103
|
+
* @private
|
1104
|
+
* @function
|
1105
|
+
* @param {Object} e Filter argument
|
1106
|
+
* @param {Object} rowData
|
1107
|
+
* @return {boolean}
|
1108
|
+
*/
|
1109
|
+
|
1110
|
+
|
1111
|
+
FilterInputPlugin._multiSelectionFilter = function (e, rowData) {
|
1112
|
+
var inputMap = e.textMap;
|
1113
|
+
|
1114
|
+
if (inputMap) {
|
1115
|
+
var data = rowData[e.field];
|
1116
|
+
|
1117
|
+
if (data != null) {
|
1118
|
+
var dataStr = FilterInputPlugin._transformToLowercaseString(data);
|
1119
|
+
|
1120
|
+
if (dataStr) {
|
1121
|
+
return inputMap[dataStr] ? true : false;
|
1122
|
+
}
|
1123
|
+
}
|
1124
|
+
|
1125
|
+
return false;
|
1126
|
+
}
|
1127
|
+
|
1128
|
+
return true;
|
1129
|
+
};
|
1017
1130
|
|
1018
1131
|
export default FilterInputPlugin;
|
1019
1132
|
export { FilterInputPlugin, FilterInputPlugin as FilterInput, FilterInputPlugin as FilterInputExtension };
|
@@ -3,7 +3,7 @@ import FormatterBuilder from "./FormatterBuilder.js";
|
|
3
3
|
declare namespace CoralButtonFormatter {
|
4
4
|
|
5
5
|
type Options = {
|
6
|
-
label?: string
|
6
|
+
label?: string|null
|
7
7
|
};
|
8
8
|
|
9
9
|
}
|
@@ -12,7 +12,7 @@ declare class CoralButtonFormatter {
|
|
12
12
|
|
13
13
|
constructor(options?: any);
|
14
14
|
|
15
|
-
public static create(options?: (FormatterBuilder.Options|CoralButtonFormatter.Options|any)): any;
|
15
|
+
public static create(options?: (FormatterBuilder.Options|CoralButtonFormatter.Options|any)|null): any;
|
16
16
|
|
17
17
|
}
|
18
18
|
|
@@ -4,9 +4,9 @@ import ElfUtil from "../../tr-grid-util/es6/ElfUtil.js";
|
|
4
4
|
declare namespace CoralComboBoxFormatter {
|
5
5
|
|
6
6
|
type Options = {
|
7
|
-
data?: any[],
|
8
|
-
entries?: any[],
|
9
|
-
items?: any[]
|
7
|
+
data?: any[]|null,
|
8
|
+
entries?: any[]|null,
|
9
|
+
items?: any[]|null
|
10
10
|
};
|
11
11
|
|
12
12
|
}
|
@@ -15,7 +15,7 @@ declare class CoralComboBoxFormatter {
|
|
15
15
|
|
16
16
|
constructor(options?: any);
|
17
17
|
|
18
|
-
public static create(options?: (FormatterBuilder.Options|CoralComboBoxFormatter.Options|any)): any;
|
18
|
+
public static create(options?: (FormatterBuilder.Options|CoralComboBoxFormatter.Options|any)|null): any;
|
19
19
|
|
20
20
|
}
|
21
21
|
|
@@ -3,8 +3,8 @@ import FormatterBuilder from "./FormatterBuilder.js";
|
|
3
3
|
declare namespace CoralIconFormatter {
|
4
4
|
|
5
5
|
type Options = {
|
6
|
-
icon?: (string|any),
|
7
|
-
size?: (number|string)
|
6
|
+
icon?: (string|any)|null,
|
7
|
+
size?: (number|string)|null
|
8
8
|
};
|
9
9
|
|
10
10
|
}
|
@@ -13,7 +13,7 @@ declare class CoralIconFormatter {
|
|
13
13
|
|
14
14
|
constructor(options?: any);
|
15
15
|
|
16
|
-
public static create(options?: (FormatterBuilder.Options|CoralIconFormatter.Options|any)): any;
|
16
|
+
public static create(options?: (FormatterBuilder.Options|CoralIconFormatter.Options|any)|null): any;
|
17
17
|
|
18
18
|
}
|
19
19
|
|