@refinitiv-ui/efx-grid 6.0.91 → 6.0.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/column-dragging/es6/ColumnDragging.d.ts +1 -1
- package/lib/column-dragging/es6/ColumnDragging.js +144 -34
- package/lib/core/dist/core.js +2410 -2621
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/ColumnStats.js +14 -14
- package/lib/core/es6/data/DataCache.js +118 -118
- package/lib/core/es6/data/DataTable.d.ts +3 -1
- package/lib/core/es6/data/DataTable.js +208 -190
- package/lib/core/es6/data/DataView.d.ts +1 -1
- package/lib/core/es6/data/DataView.js +291 -291
- package/lib/core/es6/data/Segment.js +79 -79
- package/lib/core/es6/data/SegmentCollection.js +81 -81
- package/lib/core/es6/data/WrappedView.js +41 -41
- package/lib/core/es6/grid/Core.js +635 -635
- package/lib/core/es6/grid/ILayoutGrid.js +1 -1
- package/lib/core/es6/grid/LayoutGrid.js +183 -183
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +91 -91
- package/lib/core/es6/grid/components/Cell.js +29 -29
- package/lib/core/es6/grid/components/CellFloatingPanel.js +11 -11
- package/lib/core/es6/grid/components/CellSpan.js +7 -7
- package/lib/core/es6/grid/components/CellSpans.js +36 -34
- package/lib/core/es6/grid/components/Column.js +40 -40
- package/lib/core/es6/grid/components/ElementWrapper.js +17 -17
- package/lib/core/es6/grid/components/HScrollbar.js +31 -31
- package/lib/core/es6/grid/components/Scrollbar.js +77 -77
- package/lib/core/es6/grid/components/StretchedCells.js +49 -49
- package/lib/core/es6/grid/components/VScrollbar.js +11 -11
- package/lib/core/es6/grid/components/VirtualItems.js +3 -3
- package/lib/core/es6/grid/event/EventDispatcher.js +9 -9
- package/lib/core/es6/grid/event/EventListeners.js +4 -4
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +186 -186
- package/lib/core/es6/grid/util/Conflator.js +4 -4
- package/lib/core/es6/grid/util/Reverter.js +1 -1
- package/lib/core/es6/grid/util/SectionSettings.js +20 -20
- package/lib/core/es6/grid/util/SelectionList.js +23 -23
- package/lib/core/es6/grid/util/TrackLayout.js +74 -74
- package/lib/core/es6/grid/util/Virtualizer.js +15 -15
- package/lib/core/es6/grid/util/util.js +20 -20
- package/lib/core/es6/index.d.ts +0 -2
- package/lib/core/es6/index.js +0 -3
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +193 -70
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.js +46 -30
- package/lib/rt-grid/es6/RowDefinition.d.ts +2 -1
- package/lib/rt-grid/es6/RowDefinition.js +74 -16
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +56 -1
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -1
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +29 -1
- package/lib/tr-grid-util/es6/CellPainter.js +94 -93
- package/lib/tr-grid-util/es6/Conflator.js +4 -4
- package/lib/tr-grid-util/es6/CoralItems.js +6 -6
- package/lib/tr-grid-util/es6/DateTime.js +39 -39
- package/lib/tr-grid-util/es6/Deferred.js +5 -5
- package/lib/tr-grid-util/es6/Delay.js +1 -1
- package/lib/tr-grid-util/es6/Dom.js +26 -26
- package/lib/tr-grid-util/es6/DragUI.js +17 -17
- package/lib/tr-grid-util/es6/ElementObserver.js +12 -12
- package/lib/tr-grid-util/es6/ElementWrapper.js +2 -2
- package/lib/tr-grid-util/es6/ElfDate.js +4 -4
- package/lib/tr-grid-util/es6/ElfUtil.js +37 -37
- package/lib/tr-grid-util/es6/EventDispatcher.js +12 -12
- package/lib/tr-grid-util/es6/ExpanderIcon.js +6 -6
- package/lib/tr-grid-util/es6/ExpressionParser.js +43 -43
- package/lib/tr-grid-util/es6/Ext.js +6 -6
- package/lib/tr-grid-util/es6/FieldFormatter.js +17 -17
- package/lib/tr-grid-util/es6/FilterBuilder.js +57 -57
- package/lib/tr-grid-util/es6/FilterOperators.d.ts +12 -1
- package/lib/tr-grid-util/es6/FilterOperators.js +13 -2
- package/lib/tr-grid-util/es6/GridPlugin.js +86 -86
- package/lib/tr-grid-util/es6/GroupDefinitions.js +90 -90
- package/lib/tr-grid-util/es6/Icon.js +4 -4
- package/lib/tr-grid-util/es6/MouseDownTrait.js +6 -6
- package/lib/tr-grid-util/es6/MultiTableManager.js +68 -68
- package/lib/tr-grid-util/es6/NumberFormatter.js +22 -22
- package/lib/tr-grid-util/es6/PercentBar.js +17 -17
- package/lib/tr-grid-util/es6/Perf.js +5 -5
- package/lib/tr-grid-util/es6/Popup.js +42 -42
- package/lib/tr-grid-util/es6/RangeBar.js +5 -5
- package/lib/tr-grid-util/es6/RequestQueue.js +5 -5
- package/lib/tr-grid-util/es6/RowPainter.js +23 -23
- package/lib/tr-grid-util/es6/SubTable.js +94 -94
- package/lib/tr-grid-util/es6/Table.js +51 -51
- package/lib/tr-grid-util/es6/TextHighlighter.js +49 -49
- package/lib/tr-grid-util/es6/TickCodes.js +2 -2
- package/lib/tr-grid-util/es6/Timer.js +2 -2
- package/lib/tr-grid-util/es6/TouchProxy.js +7 -7
- package/lib/tr-grid-util/es6/Util.js +50 -50
- package/lib/tr-grid-util/es6/formula/ADCService.js +2 -2
- package/lib/tr-grid-util/es6/formula/ADCSubscription.js +19 -19
- package/lib/tr-grid-util/es6/formula/AdFinService.js +2 -2
- package/lib/tr-grid-util/es6/formula/AdFinSubscription.js +19 -19
- package/lib/tr-grid-util/es6/formula/Engine.js +56 -56
- package/lib/tr-grid-util/es6/formula/Formula.js +62 -62
- package/lib/tr-grid-util/es6/formula/IntervalSubscription.js +3 -3
- package/lib/tr-grid-util/es6/formula/Realtime.js +15 -15
- package/lib/tr-grid-util/es6/formula/RealtimeService.js +15 -15
- package/lib/tr-grid-util/es6/formula/TSIService.js +2 -2
- package/lib/tr-grid-util/es6/formula/TSISubscription.js +104 -104
- package/lib/tr-grid-util/es6/formula/VariableToken.js +20 -20
- package/lib/tr-grid-util/es6/formula/functions/AdFin.js +10 -10
- package/lib/tr-grid-util/es6/formula/functions/Excel.js +1 -1
- package/lib/tr-grid-util/es6/formula/functions/Info.js +2 -2
- package/lib/tr-grid-util/es6/formula/functions/Internal.js +5 -5
- package/lib/tr-grid-util/es6/formula/functions/Logic.js +5 -5
- package/lib/tr-grid-util/es6/formula/functions/Math.js +46 -46
- package/lib/tr-grid-util/es6/formula/functions/Statistics.js +27 -27
- package/lib/tr-grid-util/es6/formula/functions/Text.js +19 -19
- package/lib/tr-grid-util/es6/index.js +1 -1
- package/lib/tr-grid-util/es6/jet/Adc.js +36 -36
- package/lib/tr-grid-util/es6/jet/CollectionDict.js +11 -11
- package/lib/tr-grid-util/es6/jet/DataGenerator.js +95 -95
- package/lib/tr-grid-util/es6/jet/DataSet.js +1 -1
- package/lib/tr-grid-util/es6/jet/MockArchive.js +5 -5
- package/lib/tr-grid-util/es6/jet/MockJET.js +1 -1
- package/lib/tr-grid-util/es6/jet/MockQuotes.js +13 -13
- package/lib/tr-grid-util/es6/jet/MockQuotes2.js +100 -100
- package/lib/tr-grid-util/es6/jet/MockRTK.js +4 -4
- package/lib/tr-grid-util/es6/jet/MockUtil.js +2 -2
- package/lib/tr-grid-util/es6/jet/index.js +1 -1
- package/lib/tr-grid-util/es6/jet/mockDataAPI.js +15 -15
- package/lib/tr-grid-util/es6/locale/translation-de.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-en.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-ja.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-zh-hant.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-zh.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation.js +1 -1
- package/lib/types/es6/ColumnDragging.d.ts +1 -1
- package/lib/types/es6/ColumnGrouping.d.ts +3 -1
- package/lib/types/es6/Core/data/DataTable.d.ts +4 -0
- package/lib/types/es6/Core/data/DataView.d.ts +2 -0
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +2 -0
- package/lib/types/es6/Core/index.d.ts +0 -2
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -1
- package/lib/versions.json +4 -4
- package/package.json +1 -1
- package/lib/core/es6/grid/util/ElementFrameWork.d.ts +0 -18
- package/lib/core/es6/grid/util/ElementFrameWork.js +0 -227
- package/lib/core/es6/grid/util/HttpRequest.d.ts +0 -53
- package/lib/core/es6/grid/util/HttpRequest.js +0 -371
- package/lib/core/es6/grid/util/PercentBar.d.ts +0 -43
- package/lib/core/es6/grid/util/PercentBar.js +0 -390
- package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +0 -41
- package/lib/core/es6/grid/util/PercentBarRenderer.js +0 -316
- package/lib/core/es6/grid/util/RangeBar.d.ts +0 -25
- package/lib/core/es6/grid/util/RangeBar.js +0 -255
- package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +0 -18
- package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +0 -53
- package/lib/types/es6/Core/grid/util/PercentBar.d.ts +0 -43
- package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +0 -41
- package/lib/types/es6/Core/grid/util/RangeBar.d.ts +0 -25
|
@@ -35,7 +35,7 @@ const DEFAULT_DATE_TIME_FORMAT = "MM/DD/YYYY";
|
|
|
35
35
|
* @param {string} formatType
|
|
36
36
|
* @return {string}
|
|
37
37
|
*/
|
|
38
|
-
|
|
38
|
+
let toDateTimeType = function(formatType) {
|
|
39
39
|
if (formatType != null && DATE_TIME_TYPE[formatType.toUpperCase()]) {
|
|
40
40
|
return DATE_TIME;
|
|
41
41
|
}
|
|
@@ -45,11 +45,11 @@ var toDateTimeType = function(formatType) {
|
|
|
45
45
|
/** @constructor
|
|
46
46
|
* @param {FieldFormatter~Options=} options
|
|
47
47
|
* @example
|
|
48
|
-
*
|
|
48
|
+
* let ff = new FieldFormatter();
|
|
49
49
|
* ff.format(anyValue);
|
|
50
50
|
* ff.getOptions(); // For serialization
|
|
51
51
|
*/
|
|
52
|
-
|
|
52
|
+
let FieldFormatter = function(options) {
|
|
53
53
|
this["format"] = this.format = this.format.bind(this); // Always export bound format method
|
|
54
54
|
|
|
55
55
|
FieldFormatter._startMidnightInterval();
|
|
@@ -126,8 +126,8 @@ FieldFormatter._updateMidnight = function() {
|
|
|
126
126
|
FieldFormatter._startMidnightInterval = function() {
|
|
127
127
|
if(!FieldFormatter._lastMidnight) {
|
|
128
128
|
FieldFormatter._updateMidnight();
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
let currentMidnight = FieldFormatter._lastMidnight.valueOf();
|
|
130
|
+
let timeUntilNextUpdate = currentMidnight + 86405000 - (new Date().valueOf()); // delay to the next midnight + 5sec
|
|
131
131
|
setTimeout(FieldFormatter._setMidnightInterval, timeUntilNextUpdate);
|
|
132
132
|
}
|
|
133
133
|
};
|
|
@@ -148,15 +148,15 @@ FieldFormatter.prototype.init = function(options) { // deserialize
|
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
let val = options["field"];
|
|
152
152
|
if(val) {
|
|
153
153
|
// DateTime pairs come from the JET's user settings
|
|
154
154
|
// Datetime paired will have special column that suffix with "_COMBINED"
|
|
155
155
|
this.setField(val); // , (this._dateTimePairs[field]) ? field + "_COMBINED" : "");
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
let formatType = /** @type{string} */(options["formatType"] || options["type"]);
|
|
159
|
+
let fieldDataType = options["fieldDataType"]; // Keep backward compatibility
|
|
160
160
|
this._userFormatType = formatType || fieldDataType;
|
|
161
161
|
|
|
162
162
|
formatType = toDateTimeType(this._userFormatType);
|
|
@@ -165,8 +165,8 @@ FieldFormatter.prototype.init = function(options) { // deserialize
|
|
|
165
165
|
if(val) {
|
|
166
166
|
this.setFormatType(val);
|
|
167
167
|
}
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
let dtf = options["dateTimeFormat"];
|
|
169
|
+
let utc = options["useUTCTime"];
|
|
170
170
|
if(utc != null || dtf != null) {
|
|
171
171
|
this.setDateTimeMeta(
|
|
172
172
|
dtf,
|
|
@@ -211,7 +211,7 @@ FieldFormatter.prototype.getField = function() {
|
|
|
211
211
|
* @return {FieldFormatter}
|
|
212
212
|
*/
|
|
213
213
|
FieldFormatter.prototype.clone = function() {
|
|
214
|
-
|
|
214
|
+
let newFF = new FieldFormatter();
|
|
215
215
|
newFF._field = this._field;
|
|
216
216
|
newFF._formattedField = this._formattedField;
|
|
217
217
|
newFF._combinedField = this._combinedField;
|
|
@@ -279,7 +279,7 @@ FieldFormatter.prototype.setNumberFormatter = function(formatter) {
|
|
|
279
279
|
};
|
|
280
280
|
|
|
281
281
|
FieldFormatter.prototype.getProperties = function() {
|
|
282
|
-
|
|
282
|
+
let obj = {
|
|
283
283
|
"field": this._field,
|
|
284
284
|
"formattedField": this._formattedField,
|
|
285
285
|
"combinedField": this._combinedField,
|
|
@@ -350,7 +350,7 @@ FieldFormatter.prototype._format = function(val, rowData) {
|
|
|
350
350
|
|
|
351
351
|
if(this._nf) { // Number formatter will override any default field format
|
|
352
352
|
if(typeof val != "number") { // string
|
|
353
|
-
|
|
353
|
+
let num = (+val); // Only convertible value will be formatted by the number formatter
|
|
354
354
|
return (num === num) ? this._nf(num) : val + "";
|
|
355
355
|
}
|
|
356
356
|
|
|
@@ -375,19 +375,19 @@ FieldFormatter.prototype._format = function(val, rowData) {
|
|
|
375
375
|
FieldFormatter.prototype._formatDateTime = function(val, rowData) {
|
|
376
376
|
if(!this._df) { return ""; }
|
|
377
377
|
if(this._idnSource) { // IDN Source will send time in second instead of millisecond.
|
|
378
|
-
|
|
378
|
+
let sec = +val; // Date object can be converted to number
|
|
379
379
|
if(sec !== sec) { // NaN checking
|
|
380
380
|
return val; // WARNING: val could be number
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
-
|
|
383
|
+
let cmbValue = (rowData && this._combinedField) ? +rowData[this._combinedField] : NaN;
|
|
384
384
|
if(cmbValue === cmbValue) { // Combined value is not NaN
|
|
385
385
|
sec = cmbValue;
|
|
386
386
|
} else if(sec < 86400) { // No paired date and sec < 24 hours -> this is a time within this day
|
|
387
387
|
sec += FieldFormatter._lastMidnight.valueOf() / 1000;
|
|
388
388
|
} else { // No paired sec. Date need to add for timezone
|
|
389
389
|
if((this._field !== "NEWS_TIME") && (this._timeZone === "LOCAL")) {
|
|
390
|
-
|
|
390
|
+
let d = new Date(sec * 1000); // Need to know the timezone of given date
|
|
391
391
|
sec += d.getTimezoneOffset() * 60;
|
|
392
392
|
}
|
|
393
393
|
}
|
|
@@ -401,7 +401,7 @@ FieldFormatter.prototype._formatDateTime = function(val, rowData) {
|
|
|
401
401
|
* @return {string}
|
|
402
402
|
*/
|
|
403
403
|
FieldFormatter.prototype._formatNumber = function(val, rowData) {
|
|
404
|
-
|
|
404
|
+
let ff;
|
|
405
405
|
if(rowData) {
|
|
406
406
|
ff = rowData[this._formattedField];
|
|
407
407
|
if(!ff) { // null, undefined, empty string, zero, or NaN
|
|
@@ -25,7 +25,7 @@ import { ExpressionParser } from "./ExpressionParser.js";
|
|
|
25
25
|
* @type {Object.<string, number>}
|
|
26
26
|
* @const
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
let connectorMap = {
|
|
29
29
|
"or": 1,
|
|
30
30
|
"OR": 1,
|
|
31
31
|
"Or": 1,
|
|
@@ -38,7 +38,7 @@ var connectorMap = {
|
|
|
38
38
|
* @param {*} val
|
|
39
39
|
* @return {number}
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
let convertToNumber = function(val) {
|
|
42
42
|
if(typeof val === "number") {
|
|
43
43
|
return val;
|
|
44
44
|
}
|
|
@@ -56,17 +56,17 @@ var convertToNumber = function(val) {
|
|
|
56
56
|
/** @private
|
|
57
57
|
* @type {RegExp}
|
|
58
58
|
*/
|
|
59
|
-
|
|
59
|
+
let _dateStringRule = /^\w{3} \w{3}/;
|
|
60
60
|
/** Convert default string natively generated from a Date object to a Date object. For instance, string "Sun Sep 09 2001 08:46:40 GMT+0700 (Indochina Time)" can be converted, while string "2001-09-09" cannot be converted.
|
|
61
61
|
* @public
|
|
62
62
|
* @function
|
|
63
63
|
* @param {*} str
|
|
64
64
|
* @return {*} Return Date object for successful conversion, otherwise the same input string
|
|
65
65
|
*/
|
|
66
|
-
|
|
66
|
+
let stringToDateObject = function(str) {
|
|
67
67
|
if(typeof str === "string") {
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
let dateObj = new Date(str);
|
|
69
|
+
let t = dateObj.getTime();
|
|
70
70
|
if(t === t) {
|
|
71
71
|
if(_dateStringRule.test(str)) {
|
|
72
72
|
return dateObj;
|
|
@@ -80,7 +80,7 @@ var stringToDateObject = function(str) {
|
|
|
80
80
|
* @param {*} val
|
|
81
81
|
* @return {string}
|
|
82
82
|
*/
|
|
83
|
-
|
|
83
|
+
let convertToString = function(val) {
|
|
84
84
|
if(typeof val === "string") {
|
|
85
85
|
return val;
|
|
86
86
|
}
|
|
@@ -102,7 +102,7 @@ var convertToString = function(val) {
|
|
|
102
102
|
* @param {boolean=} useUTCTime
|
|
103
103
|
* @return {number}
|
|
104
104
|
*/
|
|
105
|
-
|
|
105
|
+
let convertToDateValue = function(dateObj, useUTCTime) {
|
|
106
106
|
if(dateObj && dateObj.getTime) {
|
|
107
107
|
if(useUTCTime) {
|
|
108
108
|
return dateObj.getUTCFullYear() * 10000 + dateObj.getUTCMonth() * 100 + dateObj.getUTCDate();
|
|
@@ -118,26 +118,26 @@ var convertToDateValue = function(dateObj, useUTCTime) {
|
|
|
118
118
|
* @param {Object} rowData
|
|
119
119
|
* @return {boolean}
|
|
120
120
|
*/
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
let _filterByConditions = function(ctx, rowData) {
|
|
122
|
+
let conds = ctx._conds;
|
|
123
|
+
let condCount = conds ? conds.length : 0;
|
|
124
124
|
|
|
125
125
|
if(!condCount) {
|
|
126
126
|
return true; // There is no filter condition
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
let fieldName = ctx._fieldName;
|
|
130
|
+
let fmtFieldName = ctx._formattedFieldName;
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
let val = rowData[fieldName];
|
|
133
133
|
if(ctx._rawDataAccessor) {
|
|
134
134
|
val = ctx._rawDataAccessor(val);
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
for(
|
|
140
|
-
|
|
136
|
+
let str, lowercasedStr, num, dateVal; // intentionally left undefined
|
|
137
|
+
let finalResult = false;
|
|
138
|
+
let result = false;
|
|
139
|
+
for(let i = 0; i < condCount; ++i) {
|
|
140
|
+
let orConnector = 0;
|
|
141
141
|
if(i > 0) {
|
|
142
142
|
orConnector = connectorMap[conds[i - 1].connector];
|
|
143
143
|
// TODO: AND operator has higher precedence than OR operator
|
|
@@ -150,13 +150,13 @@ var _filterByConditions = function(ctx, rowData) {
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
let cond = conds[i];
|
|
154
|
+
let opDef = FilterOperators[cond.operatorId];
|
|
155
155
|
result = false;
|
|
156
156
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
let opType = opDef.type;
|
|
158
|
+
let opId = opDef.id;
|
|
159
|
+
let opFunc = OperatorFunctions[opId];
|
|
160
160
|
if(opType === "blank") {
|
|
161
161
|
result = opFunc(val);
|
|
162
162
|
} else if(opType === "number") {
|
|
@@ -215,8 +215,8 @@ var _filterByConditions = function(ctx, rowData) {
|
|
|
215
215
|
* @param {Object} rowData
|
|
216
216
|
* @return {boolean}
|
|
217
217
|
*/
|
|
218
|
-
|
|
219
|
-
|
|
218
|
+
let _filterByObjectMap = function(ctx, rowData) {
|
|
219
|
+
let val = rowData[ctx._fieldName];
|
|
220
220
|
if(ctx._rawDataAccessor) {
|
|
221
221
|
val = ctx._rawDataAccessor(val);
|
|
222
222
|
}
|
|
@@ -229,7 +229,7 @@ var _filterByObjectMap = function(ctx, rowData) {
|
|
|
229
229
|
* @param {Object} cond Internal condition object
|
|
230
230
|
* @return {FilterBuilder~Condition}
|
|
231
231
|
*/
|
|
232
|
-
|
|
232
|
+
let conditionToArray = function(cond) {
|
|
233
233
|
return [
|
|
234
234
|
cond.operatorId,
|
|
235
235
|
cond.origValue,
|
|
@@ -241,7 +241,7 @@ var conditionToArray = function(cond) {
|
|
|
241
241
|
* @constructor
|
|
242
242
|
* @param {FilterBuilder~Options=} options
|
|
243
243
|
*/
|
|
244
|
-
|
|
244
|
+
let FilterBuilder = function (options) {
|
|
245
245
|
this._initStaticVariables();
|
|
246
246
|
|
|
247
247
|
this._conditions = [];
|
|
@@ -255,7 +255,7 @@ FilterBuilder.prototype._initStaticVariables = function() {
|
|
|
255
255
|
FilterBuilder._initStatic = true;
|
|
256
256
|
|
|
257
257
|
FilterBuilder._updateTimezoneOffset();
|
|
258
|
-
|
|
258
|
+
let timeUntilNextDay = 86400000 - (new Date() % 86400000);
|
|
259
259
|
setTimeout(FilterBuilder._setUpdateInterval, timeUntilNextDay);
|
|
260
260
|
}
|
|
261
261
|
};
|
|
@@ -328,20 +328,20 @@ FilterBuilder.prototype.init = function(options) {
|
|
|
328
328
|
if(!options) {
|
|
329
329
|
return;
|
|
330
330
|
}
|
|
331
|
-
|
|
331
|
+
let field = options["field"];
|
|
332
332
|
if(field) {
|
|
333
333
|
this.setFieldDefinition(field, options["formatter"], options["formattedField"]);
|
|
334
334
|
} else if(field != null) {
|
|
335
335
|
this.setFieldDefinition("");
|
|
336
336
|
}
|
|
337
337
|
|
|
338
|
-
|
|
338
|
+
let useUTCTime = options["useUTCTime"];
|
|
339
339
|
if(useUTCTime != null) {
|
|
340
340
|
this._useUTCTime = useUTCTime ? true : false;
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
-
|
|
344
|
-
|
|
343
|
+
let rawDataAccessor = options["rawDataAccessor"];
|
|
344
|
+
let formattedDataAccessor = options["formattedDataAccessor"];
|
|
345
345
|
if(rawDataAccessor != null || formattedDataAccessor != null) {
|
|
346
346
|
this.setDataAccessors(rawDataAccessor, formattedDataAccessor);
|
|
347
347
|
}
|
|
@@ -381,8 +381,8 @@ FilterBuilder.prototype.setDataAccessors = function(rawDataAccessor, formattedDa
|
|
|
381
381
|
* @return {boolean} Return true, if the new condition is added
|
|
382
382
|
*/
|
|
383
383
|
FilterBuilder.prototype.addCondition = function (oper, value, connector, useUTCTime) {
|
|
384
|
-
|
|
385
|
-
|
|
384
|
+
let opId = oper ? oper.toUpperCase() : "";
|
|
385
|
+
let opDef = FilterOperators[opId];
|
|
386
386
|
if (!opDef) {
|
|
387
387
|
return false; // Unknown operation
|
|
388
388
|
}
|
|
@@ -395,7 +395,7 @@ FilterBuilder.prototype.addCondition = function (oper, value, connector, useUTCT
|
|
|
395
395
|
return false; // Invalid comparer value ("", null, undefined, NaN)
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
|
-
|
|
398
|
+
let cond = {
|
|
399
399
|
operatorId: opId,
|
|
400
400
|
origValue: value,
|
|
401
401
|
connector: connector || ""
|
|
@@ -412,11 +412,11 @@ FilterBuilder.prototype.addCondition = function (oper, value, connector, useUTCT
|
|
|
412
412
|
* @return {number} Return number of conditions being added.
|
|
413
413
|
*/
|
|
414
414
|
FilterBuilder.prototype.addConditions = function (conditions) {
|
|
415
|
-
|
|
415
|
+
let count = 0;
|
|
416
416
|
if(Array.isArray(conditions)) {
|
|
417
|
-
|
|
418
|
-
for(
|
|
419
|
-
|
|
417
|
+
let len = conditions.length;
|
|
418
|
+
for(let i = 0; i < len; ++i) {
|
|
419
|
+
let condition = conditions[i];
|
|
420
420
|
if(Array.isArray(condition)) {
|
|
421
421
|
if(this.addCondition(condition[0], condition[1], condition[2], condition[3])) {
|
|
422
422
|
++count;
|
|
@@ -449,25 +449,25 @@ FilterBuilder.prototype.buildFilter = function() {
|
|
|
449
449
|
if (!this._fieldName) {
|
|
450
450
|
return null;
|
|
451
451
|
}
|
|
452
|
-
|
|
452
|
+
let condCount = this._conditions.length;
|
|
453
453
|
if(!condCount) {
|
|
454
454
|
return null;
|
|
455
455
|
}
|
|
456
456
|
|
|
457
457
|
// Prepare user value to be in ready to use form to boost performance
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
for(
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
458
|
+
let formatter = this._formatter;
|
|
459
|
+
let conds = this._conditions.slice();
|
|
460
|
+
for(let i = 0; i < condCount; ++i) {
|
|
461
|
+
let cond = conds[i];
|
|
462
|
+
let opDef = FilterOperators[cond.operatorId];
|
|
463
|
+
let opType = opDef.type;
|
|
464
|
+
let value = cond.origValue;
|
|
465
465
|
|
|
466
466
|
if(opType === "number") {
|
|
467
467
|
value = stringToDateObject(value);
|
|
468
468
|
value = convertToNumber(value);
|
|
469
469
|
} else if(opType === "date") {
|
|
470
|
-
|
|
470
|
+
let dateObj = null;
|
|
471
471
|
if(value instanceof Date) {
|
|
472
472
|
dateObj = value;
|
|
473
473
|
} else if(typeof value === "number" || typeof value === "string") {
|
|
@@ -487,7 +487,7 @@ FilterBuilder.prototype.buildFilter = function() {
|
|
|
487
487
|
cond.value = value;
|
|
488
488
|
}
|
|
489
489
|
|
|
490
|
-
|
|
490
|
+
let ctx = {
|
|
491
491
|
_conds: conds,
|
|
492
492
|
_fieldName: this._fieldName || "",
|
|
493
493
|
_formatter: formatter || null,
|
|
@@ -510,11 +510,11 @@ FilterBuilder.prototype.buildFilter = function() {
|
|
|
510
510
|
*/
|
|
511
511
|
FilterBuilder.prototype.buildMonitorFilter = function(filterStr, field, formatter, formattedField) {
|
|
512
512
|
this.setFieldDefinition(field, formatter, formattedField);
|
|
513
|
-
|
|
513
|
+
let needConvertValue = (field.lastIndexOf("_LOCAL") === field.length - 6); // _LOCAL field is special monitor field which convert time value to local timezone (idn)
|
|
514
514
|
|
|
515
|
-
|
|
516
|
-
for (
|
|
517
|
-
|
|
515
|
+
let conds = filterStr.split("♣");
|
|
516
|
+
for (let i = 0; i < conds.length; i++) {
|
|
517
|
+
let tokens = conds[i].split("♦");
|
|
518
518
|
if(needConvertValue) {
|
|
519
519
|
tokens[1] = ((tokens[1] - FilterBuilder._timezoneOffset) % 86400) + ""; // Convert to local timezone value for range filtering
|
|
520
520
|
}
|
|
@@ -530,11 +530,11 @@ FilterBuilder.prototype.buildMonitorFilter = function(filterStr, field, formatte
|
|
|
530
530
|
* @param {Function=} rawDataAccessor Raw data getter for custom data type
|
|
531
531
|
* @return {Function}
|
|
532
532
|
*/
|
|
533
|
-
|
|
533
|
+
let buildFilterFromObjectMap = function(obj, field, rawDataAccessor) {
|
|
534
534
|
if(!obj || !field) {
|
|
535
535
|
return null;
|
|
536
536
|
}
|
|
537
|
-
|
|
537
|
+
let ctx = {
|
|
538
538
|
_fieldName: field,
|
|
539
539
|
_itemMap: obj
|
|
540
540
|
};
|
|
@@ -555,7 +555,7 @@ var buildFilterFromObjectMap = function(obj, field, rawDataAccessor) {
|
|
|
555
555
|
* @return {Function} Filter function that takes rowData object
|
|
556
556
|
*/
|
|
557
557
|
FilterBuilder.prototype.parse = function(condition, field, formatter, formattedField, rawDataAccessor, formattedDataAccessor) {
|
|
558
|
-
|
|
558
|
+
let type = typeof(condition);
|
|
559
559
|
if(type === "string") {
|
|
560
560
|
if(condition.indexOf("♦") >= 0) {
|
|
561
561
|
return this.buildMonitorFilter(condition, field, formatter, formattedField);
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
declare namespace FilterOperators {
|
|
4
4
|
|
|
5
5
|
type Operator = {
|
|
6
|
+
id: string,
|
|
6
7
|
name: string,
|
|
7
8
|
type: string,
|
|
8
9
|
positive: number,
|
|
@@ -32,7 +33,17 @@ declare namespace FilterOperators {
|
|
|
32
33
|
DTB: FilterOperators.Operator,
|
|
33
34
|
TXTEQ: FilterOperators.Operator,
|
|
34
35
|
BLANK: FilterOperators.Operator,
|
|
35
|
-
NBLANK: FilterOperators.Operator
|
|
36
|
+
NBLANK: FilterOperators.Operator,
|
|
37
|
+
NEQ_BLANK: FilterOperators.Operator,
|
|
38
|
+
GREATER_THAN: FilterOperators.Operator,
|
|
39
|
+
GREATER_THAN_OR_EQUAL_TO: FilterOperators.Operator,
|
|
40
|
+
EQUAL_TO: FilterOperators.Operator,
|
|
41
|
+
LESS_THAN: FilterOperators.Operator,
|
|
42
|
+
LESS_THAN_OR_EQUAL_TO: FilterOperators.Operator,
|
|
43
|
+
TEXT_THAT_CONTAINS: FilterOperators.Operator,
|
|
44
|
+
TEXT_THAT_NOT_CONTAINS: FilterOperators.Operator,
|
|
45
|
+
TEXT_IS: FilterOperators.Operator,
|
|
46
|
+
NOT_BLANK: FilterOperators.Operator
|
|
36
47
|
};
|
|
37
48
|
|
|
38
49
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @typedef {Object} FilterOperators~Operator
|
|
2
|
+
* @property {string} id Short name of the operator
|
|
2
3
|
* @property {string} name Full name of the operator
|
|
3
4
|
* @property {string} type Data type of the parameters required by the operator (e.g., number, string)
|
|
4
5
|
* @property {number} positive The value indicates that the operator has positive connotation. The negative counterparts for EQ and BEGIN are NEQ and NBEGIN respectively.
|
|
@@ -29,13 +30,23 @@
|
|
|
29
30
|
* @property {!FilterOperators~Operator} TXTEQ Alias to EQ
|
|
30
31
|
* @property {!FilterOperators~Operator} BLANK Alias to EQ_BLANK
|
|
31
32
|
* @property {!FilterOperators~Operator} NBLANK Alias to EQ_NBLANK
|
|
33
|
+
* @property {!FilterOperators~Operator} NEQ_BLANK Alias to EQ_NBLANK
|
|
34
|
+
* @property {!FilterOperators~Operator} GREATER_THAN Alias to GT
|
|
35
|
+
* @property {!FilterOperators~Operator} GREATER_THAN_OR_EQUAL_TO Alias to GTE
|
|
36
|
+
* @property {!FilterOperators~Operator} EQUAL_TO Alias to EQ
|
|
37
|
+
* @property {!FilterOperators~Operator} LESS_THAN Alias to LT
|
|
38
|
+
* @property {!FilterOperators~Operator} LESS_THAN_OR_EQUAL_TO Alias to LTE
|
|
39
|
+
* @property {!FilterOperators~Operator} TEXT_THAT_CONTAINS Alias to CONT
|
|
40
|
+
* @property {!FilterOperators~Operator} TEXT_THAT_NOT_CONTAINS Alias to NCONT
|
|
41
|
+
* @property {!FilterOperators~Operator} TEXT_IS Alias to EQ
|
|
42
|
+
* @property {!FilterOperators~Operator} NOT_BLANK Alias to EQ_NBLANK
|
|
32
43
|
*/
|
|
33
44
|
|
|
34
45
|
/** @type {!FilterOperators~Operators}
|
|
35
46
|
* @public
|
|
36
47
|
* @const
|
|
37
48
|
*/
|
|
38
|
-
|
|
49
|
+
let FilterOperators = {
|
|
39
50
|
EQ: {
|
|
40
51
|
id: "EQ",
|
|
41
52
|
name: "Equal to",
|
|
@@ -214,7 +225,7 @@ FilterOperators.NOT_BLANK = FilterOperators.EQ_NBLANK;
|
|
|
214
225
|
* @public
|
|
215
226
|
* @const
|
|
216
227
|
*/
|
|
217
|
-
|
|
228
|
+
let OperatorFunctions = {
|
|
218
229
|
EQ: function(str, input) { return str == input; },
|
|
219
230
|
NEQ: function(str, input) { return str != input; },
|
|
220
231
|
NUMEQ: function(num, input) { return num == input; },
|