@refinitiv-ui/efx-grid 6.0.60 → 6.0.62
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-selection-dialog/lib/column-selection-dialog.d.ts +1 -1
- package/lib/column-selection-dialog/lib/column-selection-dialog.js +1 -41
- package/lib/column-selection-dialog/themes/base.less +32 -0
- package/lib/column-selection-dialog/themes/elemental/dark/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/elemental/dark/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/elemental/light/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/elemental/light/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/halo/dark/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/halo/dark/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/halo/light/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/solar/charcoal/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/solar/charcoal/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/solar/pearl/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/solar/pearl/es5/all-elements.js +1 -1
- package/lib/core/dist/core.js +2 -6
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +2 -6
- package/lib/grid/index.js +1 -1
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +1 -0
- package/lib/tr-grid-range-bar/es6/RangeBar.js +11 -0
- package/lib/tr-grid-util/es6/ElementObserver.js +2 -1
- package/lib/tr-grid-util/es6/ExpressionParser.js +55 -13
- package/lib/tr-grid-util/es6/FilterBuilder.js +13 -7
- package/lib/tr-grid-util/es6/FilterOperators.d.ts +25 -23
- package/lib/tr-grid-util/es6/FilterOperators.js +26 -25
- package/lib/tr-grid-util/es6/jet/DataGenerator.d.ts +35 -13
- package/lib/tr-grid-util/es6/jet/DataGenerator.js +42 -17
- package/lib/utils/index.d.ts +2 -1
- package/lib/utils/index.js +2 -1
- package/lib/versions.json +5 -5
- package/package.json +1 -1
@@ -562,7 +562,7 @@ Core.prototype._batches = null;
|
|
562
562
|
* @return {string}
|
563
563
|
*/
|
564
564
|
Core.getVersion = function () {
|
565
|
-
return "5.1.
|
565
|
+
return "5.1.75";
|
566
566
|
};
|
567
567
|
/** {@link ElementWrapper#dispose}
|
568
568
|
* @override
|
@@ -5071,14 +5071,10 @@ Core.prototype._onColInViewChanged = function (e) {
|
|
5071
5071
|
var last = pli > li ? pli : li; // INCLUSIVE
|
5072
5072
|
|
5073
5073
|
this._activateColumns(fi, li, first, last);
|
5074
|
-
|
5075
|
-
var rfi = this._rowVirtualizer.getFirstIndexInView();
|
5076
|
-
var rli = this._rowVirtualizer.getLastIndexInView();
|
5077
5074
|
var sectionCount = this.getSectionCount();
|
5078
5075
|
for (var s = 0; s < sectionCount; ++s) { // For each section
|
5079
5076
|
var sectionSettings = this._settings[s];
|
5080
|
-
|
5081
|
-
this.updateRowData(sectionSettings, rfi - rowIndexOffset, rli - rowIndexOffset);
|
5077
|
+
this.updateRowData(sectionSettings); // It will be render all rows in view
|
5082
5078
|
}
|
5083
5079
|
};
|
5084
5080
|
/** @private
|
package/lib/grid/index.js
CHANGED
@@ -1800,6 +1800,7 @@ ColumnStackPlugin.prototype.addColumnToStack = function(colRef, stackId) {
|
|
1800
1800
|
|
1801
1801
|
// If an unpinned column is added to a pinned stack, the pinning position should be updated
|
1802
1802
|
if(stack.leftPinned || stack.rightPinned) {
|
1803
|
+
var colCount = this.getColumnCount();
|
1803
1804
|
if(stack.leftPinned && colIndex > leftPinnedIndex) {
|
1804
1805
|
leftPinnedIndex++;
|
1805
1806
|
this._freezeColumn(leftPinnedIndex, rightPinnedCount);
|
@@ -90,6 +90,10 @@ var RangeBarPlugin = function RangeBarPlugin() {
|
|
90
90
|
};
|
91
91
|
Ext.inherits(RangeBarPlugin, GridPlugin);
|
92
92
|
|
93
|
+
/** @type {boolean}
|
94
|
+
* @private
|
95
|
+
*/
|
96
|
+
RangeBarPlugin._LEDGuage = true;
|
93
97
|
/** @type {boolean}
|
94
98
|
* @private
|
95
99
|
*/
|
@@ -144,6 +148,10 @@ RangeBarPlugin.prototype.initialize = function (host, options) {
|
|
144
148
|
* @ignore
|
145
149
|
*/
|
146
150
|
RangeBarPlugin.prototype._afterInit = function () {
|
151
|
+
if (!ElfUtil.hasComponent("ef-led-gauge")) {
|
152
|
+
console.log("The LED Gauge component is required for the range bar extension. Please make sure to import both the LED Gauge component and its theme.");
|
153
|
+
RangeBarPlugin._LEDGuage = false;
|
154
|
+
}
|
147
155
|
var colCount = this.getColumnCount();
|
148
156
|
for (var i = 0; i < colCount; ++i) {
|
149
157
|
this._setColumnRenderer(i);
|
@@ -449,6 +457,9 @@ RangeBarPlugin.prototype._onThemeLoaded = function () {
|
|
449
457
|
* @param {Object} e
|
450
458
|
*/
|
451
459
|
RangeBarPlugin.prototype._onPostSectionBinding = function (e) {
|
460
|
+
if (!RangeBarPlugin._LEDGuage) {
|
461
|
+
return;
|
462
|
+
}
|
452
463
|
var section = e["section"];
|
453
464
|
var dataRows = /** @type{Array.<Object>} */e["dataRows"];
|
454
465
|
var colCount = section.getColumnCount();
|
@@ -91,7 +91,8 @@ ElementObserver._addListener = function(elem, fn) {
|
|
91
91
|
}
|
92
92
|
};
|
93
93
|
|
94
|
-
/**
|
94
|
+
/** Add a listener to a html lang attribute
|
95
|
+
* @public
|
95
96
|
* @param {Element} element An element within the DOM tree to watch for changes
|
96
97
|
*/
|
97
98
|
ElementObserver.addLanguageListener = function(element) {
|
@@ -17,7 +17,9 @@ var OperatorPrecedences = {
|
|
17
17
|
"-": 4,
|
18
18
|
"*": 5,
|
19
19
|
"%": 6,
|
20
|
-
"/": 6
|
20
|
+
"/": 6,
|
21
|
+
"!": 7,
|
22
|
+
"!!": 7
|
21
23
|
};
|
22
24
|
/** @type {Object.<string, Function>}
|
23
25
|
* @private
|
@@ -36,10 +38,32 @@ var OperatorFunctions = {
|
|
36
38
|
"==": function(lhs, rhs){ return lhs == rhs; },
|
37
39
|
"!=": function(lhs, rhs){ return lhs != rhs; },
|
38
40
|
"&&": function(lhs, rhs){ return lhs && rhs; },
|
39
|
-
"||": function(lhs, rhs){ return lhs || rhs; }
|
41
|
+
"||": function(lhs, rhs){ return lhs || rhs; },
|
42
|
+
"!": function(lhs, rhs){ return !lhs; },
|
43
|
+
"!!": function(lhs, rhs){ return !!lhs; }
|
40
44
|
};
|
41
45
|
/** @type {Object.<string, Function>}
|
42
46
|
* @private
|
47
|
+
* @const
|
48
|
+
*/
|
49
|
+
var OperandRequirements = {
|
50
|
+
"+": 2,
|
51
|
+
"-": 2,
|
52
|
+
"*": 2,
|
53
|
+
"/": 2,
|
54
|
+
"%": 2,
|
55
|
+
"<": 2,
|
56
|
+
">": 2,
|
57
|
+
"<=": 2,
|
58
|
+
">=": 2,
|
59
|
+
"==": 2,
|
60
|
+
"!=": 2,
|
61
|
+
"&&": 2,
|
62
|
+
"||": 2,
|
63
|
+
"!": 1,
|
64
|
+
"!!": 1
|
65
|
+
};
|
66
|
+
/** @private
|
43
67
|
* @function
|
44
68
|
* @param {Array.<Object>} ary
|
45
69
|
* @param {string|number} value
|
@@ -57,10 +81,20 @@ var _addToken = function(ary, value, type, dataType) {
|
|
57
81
|
}
|
58
82
|
if(type === "operator") {
|
59
83
|
tok.precedence = OperatorPrecedences[value];
|
84
|
+
} else if(type === "parenthesis") {
|
85
|
+
tok.precedence = 0;
|
60
86
|
}
|
61
87
|
ary.push(tok);
|
62
88
|
return ary.length - 1;
|
63
89
|
};
|
90
|
+
/** @private
|
91
|
+
* @function
|
92
|
+
* @param {Object} obj
|
93
|
+
* @returns {*}
|
94
|
+
*/
|
95
|
+
var _toValue = function(obj) { // eslint-disable-line
|
96
|
+
return obj.value;
|
97
|
+
};
|
64
98
|
|
65
99
|
/** @public
|
66
100
|
* @namespace
|
@@ -174,8 +208,9 @@ ExpressionParser._tester = function(ctx) {
|
|
174
208
|
for(var i = 0; i < inputCount; ++i) {
|
175
209
|
var tok = rpn[i];
|
176
210
|
if(tok.type !== "literal") {
|
177
|
-
|
178
|
-
|
211
|
+
var requiredCount = OperandRequirements[tok.value];
|
212
|
+
if(operandCount >= requiredCount) {
|
213
|
+
operandCount -= requiredCount;
|
179
214
|
} else {
|
180
215
|
console.warn("Cannot parse an expression with insufficient number of operands");
|
181
216
|
return true;
|
@@ -216,11 +251,18 @@ ExpressionParser._filter = function(ctx, rowData) {
|
|
216
251
|
curRes = rowData ? rowData[tokValue] : null;
|
217
252
|
}
|
218
253
|
} else { // operator
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
254
|
+
if(OperandRequirements[tokValue] === 1) {
|
255
|
+
curRes = OperatorFunctions[tokValue](
|
256
|
+
results[operandCount - 1]
|
257
|
+
);
|
258
|
+
operandCount -= 1;
|
259
|
+
} else { // 2
|
260
|
+
curRes = OperatorFunctions[tokValue](
|
261
|
+
results[operandCount - 2],
|
262
|
+
results[operandCount - 1]
|
263
|
+
);
|
264
|
+
operandCount -= 2;
|
265
|
+
}
|
224
266
|
}
|
225
267
|
results[operandCount++] = curRes;
|
226
268
|
}
|
@@ -289,7 +331,6 @@ ExpressionParser.parse = function(expression) {
|
|
289
331
|
}
|
290
332
|
infixTokens.push(tok);
|
291
333
|
}
|
292
|
-
// TODO: Handle the case where subtraction operator is in front of a variable
|
293
334
|
ExpressionParser._tokens.length = 0;
|
294
335
|
|
295
336
|
// Convert Infix notation to Reverse Polish Notation (Postfix)
|
@@ -324,9 +365,10 @@ ExpressionParser.parse = function(expression) {
|
|
324
365
|
}
|
325
366
|
}
|
326
367
|
} else { // operator
|
327
|
-
|
328
|
-
|
329
|
-
|
368
|
+
while(operators.length) {
|
369
|
+
if(tok.precedence > operators[operators.length - 1].precedence) {
|
370
|
+
break;
|
371
|
+
}
|
330
372
|
rpn.push(operators.pop());
|
331
373
|
}
|
332
374
|
operators.push(tok);
|
@@ -110,7 +110,7 @@ var _filterByConditions = function(ctx, rowData) {
|
|
110
110
|
if(ctx._rawDataAccessor) {
|
111
111
|
val = ctx._rawDataAccessor(val);
|
112
112
|
}
|
113
|
-
var str, num, dateVal; // intentionally left undefined
|
113
|
+
var str, lowercasedStr, num, dateVal; // intentionally left undefined
|
114
114
|
var finalResult = false;
|
115
115
|
var result = false;
|
116
116
|
for(var i = 0; i < condCount; ++i) {
|
@@ -163,12 +163,16 @@ var _filterByConditions = function(ctx, rowData) {
|
|
163
163
|
str = val;
|
164
164
|
}
|
165
165
|
str = convertToString(str);
|
166
|
-
if(!opDef.caseSensitive) {
|
167
|
-
str = str.toLowerCase();
|
168
|
-
}
|
169
166
|
}
|
170
167
|
|
171
|
-
|
168
|
+
if(opDef.caseSensitive) {
|
169
|
+
result = opFunc(str, cond.value);
|
170
|
+
} else {
|
171
|
+
if(lowercasedStr == null) {
|
172
|
+
lowercasedStr = str.toLowerCase();
|
173
|
+
}
|
174
|
+
result = opFunc(lowercasedStr, cond.value);
|
175
|
+
}
|
172
176
|
}
|
173
177
|
if(i > 0) {
|
174
178
|
if(orConnector) {
|
@@ -428,6 +432,8 @@ FilterBuilder.prototype.buildFilter = function() {
|
|
428
432
|
}
|
429
433
|
|
430
434
|
// Prepare user value to be in ready to use form to boost performance
|
435
|
+
var fieldName = this._fieldName;
|
436
|
+
var fmtFieldName = this._formattedFieldName;
|
431
437
|
var formatter = this._formatter;
|
432
438
|
var conds = this._conditions.slice();
|
433
439
|
for(var i = 0; i < condCount; ++i) {
|
@@ -452,8 +458,8 @@ FilterBuilder.prototype.buildFilter = function() {
|
|
452
458
|
} else if(opType === "string") {
|
453
459
|
if(formatter) { // WARNING: This is not in sync when _formattedDataAccessor exists
|
454
460
|
var dummyRow = {};
|
455
|
-
dummyRow[fieldName] =
|
456
|
-
dummyRow[fmtFieldName] =
|
461
|
+
dummyRow[fieldName] = value;
|
462
|
+
dummyRow[fmtFieldName] = value;
|
457
463
|
value = formatter(dummyRow); // WARNING: dummyRow may not provide enough data for formatting correctly
|
458
464
|
}
|
459
465
|
value = convertToString(value);
|
@@ -11,33 +11,35 @@ declare namespace FilterOperators {
|
|
11
11
|
};
|
12
12
|
|
13
13
|
type Operators = {
|
14
|
-
EQ: FilterOperators.Operator
|
15
|
-
NEQ: FilterOperators.Operator
|
16
|
-
NUMEQ: FilterOperators.Operator
|
17
|
-
NUMNEQ: FilterOperators.Operator
|
18
|
-
GT: FilterOperators.Operator
|
19
|
-
GTE: FilterOperators.Operator
|
20
|
-
LT: FilterOperators.Operator
|
21
|
-
LTE: FilterOperators.Operator
|
22
|
-
BEGIN: FilterOperators.Operator
|
23
|
-
NBEGIN: FilterOperators.Operator
|
24
|
-
END: FilterOperators.Operator
|
25
|
-
NEND: FilterOperators.Operator
|
26
|
-
CONT: FilterOperators.Operator
|
27
|
-
NCONT: FilterOperators.Operator
|
28
|
-
EQ_BLANK: FilterOperators.Operator
|
29
|
-
EQ_NBLANK: FilterOperators.Operator
|
30
|
-
DT: FilterOperators.Operator
|
31
|
-
DTA: FilterOperators.Operator
|
32
|
-
DTB: FilterOperators.Operator
|
33
|
-
TXTEQ: FilterOperators.Operator
|
34
|
-
BLANK: FilterOperators.Operator
|
35
|
-
NBLANK: FilterOperators.Operator
|
14
|
+
EQ: FilterOperators.Operator,
|
15
|
+
NEQ: FilterOperators.Operator,
|
16
|
+
NUMEQ: FilterOperators.Operator,
|
17
|
+
NUMNEQ: FilterOperators.Operator,
|
18
|
+
GT: FilterOperators.Operator,
|
19
|
+
GTE: FilterOperators.Operator,
|
20
|
+
LT: FilterOperators.Operator,
|
21
|
+
LTE: FilterOperators.Operator,
|
22
|
+
BEGIN: FilterOperators.Operator,
|
23
|
+
NBEGIN: FilterOperators.Operator,
|
24
|
+
END: FilterOperators.Operator,
|
25
|
+
NEND: FilterOperators.Operator,
|
26
|
+
CONT: FilterOperators.Operator,
|
27
|
+
NCONT: FilterOperators.Operator,
|
28
|
+
EQ_BLANK: FilterOperators.Operator,
|
29
|
+
EQ_NBLANK: FilterOperators.Operator,
|
30
|
+
DT: FilterOperators.Operator,
|
31
|
+
DTA: FilterOperators.Operator,
|
32
|
+
DTB: FilterOperators.Operator,
|
33
|
+
TXTEQ: FilterOperators.Operator,
|
34
|
+
BLANK: FilterOperators.Operator,
|
35
|
+
NBLANK: FilterOperators.Operator
|
36
36
|
};
|
37
37
|
|
38
38
|
}
|
39
39
|
|
40
|
-
declare const
|
40
|
+
declare const FilterOperators: FilterOperators.Operators;
|
41
|
+
|
42
|
+
declare const OperatorFunctions: { [key: string]: ((...params: any[]) => any) };
|
41
43
|
|
42
44
|
export default FilterOperators;
|
43
45
|
export { FilterOperators, OperatorFunctions };
|
@@ -6,33 +6,34 @@
|
|
6
6
|
* @property {string} formula Formula expression used by the operator
|
7
7
|
*/
|
8
8
|
|
9
|
-
/** @typedef {Object.<string, FilterOperators~
|
10
|
-
* @property {FilterOperators~Operator} EQ Equal
|
11
|
-
* @property {FilterOperators~Operator} NEQ Not equal
|
12
|
-
* @property {FilterOperators~Operator} NUMEQ Number equal to
|
13
|
-
* @property {FilterOperators~Operator} NUMNEQ Number not equal to
|
14
|
-
* @property {FilterOperators~Operator} GT Greater than
|
15
|
-
* @property {FilterOperators~Operator} GTE Greater than or equal
|
16
|
-
* @property {FilterOperators~Operator} LT Less than
|
17
|
-
* @property {FilterOperators~Operator} LTE Less than or equal
|
18
|
-
* @property {FilterOperators~Operator} BEGIN Begin
|
19
|
-
* @property {FilterOperators~Operator} NBEGIN Not begin
|
20
|
-
* @property {FilterOperators~Operator} END End
|
21
|
-
* @property {FilterOperators~Operator} NEND Not end
|
22
|
-
* @property {FilterOperators~Operator} CONT Contain
|
23
|
-
* @property {FilterOperators~Operator} NCONT Not contain
|
24
|
-
* @property {FilterOperators~Operator} EQ_BLANK Equal to blank value
|
25
|
-
* @property {FilterOperators~Operator} EQ_NBLANK Equal to non blank value
|
26
|
-
* @property {FilterOperators~Operator} DT Date is
|
27
|
-
* @property {FilterOperators~Operator} DTA Date is after
|
28
|
-
* @property {FilterOperators~Operator} DTB Date is before
|
29
|
-
* @property {FilterOperators~Operator} TXTEQ Alias to EQ
|
30
|
-
* @property {FilterOperators~Operator} BLANK Alias to EQ_BLANK
|
31
|
-
* @property {FilterOperators~Operator} NBLANK Alias to EQ_NBLANK
|
9
|
+
/** @typedef {Object.<string, FilterOperators~Operator>} FilterOperators~Operators
|
10
|
+
* @property {!FilterOperators~Operator} EQ Equal
|
11
|
+
* @property {!FilterOperators~Operator} NEQ Not equal
|
12
|
+
* @property {!FilterOperators~Operator} NUMEQ Number equal to
|
13
|
+
* @property {!FilterOperators~Operator} NUMNEQ Number not equal to
|
14
|
+
* @property {!FilterOperators~Operator} GT Greater than
|
15
|
+
* @property {!FilterOperators~Operator} GTE Greater than or equal
|
16
|
+
* @property {!FilterOperators~Operator} LT Less than
|
17
|
+
* @property {!FilterOperators~Operator} LTE Less than or equal
|
18
|
+
* @property {!FilterOperators~Operator} BEGIN Begin
|
19
|
+
* @property {!FilterOperators~Operator} NBEGIN Not begin
|
20
|
+
* @property {!FilterOperators~Operator} END End
|
21
|
+
* @property {!FilterOperators~Operator} NEND Not end
|
22
|
+
* @property {!FilterOperators~Operator} CONT Contain
|
23
|
+
* @property {!FilterOperators~Operator} NCONT Not contain
|
24
|
+
* @property {!FilterOperators~Operator} EQ_BLANK Equal to blank value
|
25
|
+
* @property {!FilterOperators~Operator} EQ_NBLANK Equal to non blank value
|
26
|
+
* @property {!FilterOperators~Operator} DT Date is
|
27
|
+
* @property {!FilterOperators~Operator} DTA Date is after
|
28
|
+
* @property {!FilterOperators~Operator} DTB Date is before
|
29
|
+
* @property {!FilterOperators~Operator} TXTEQ Alias to EQ
|
30
|
+
* @property {!FilterOperators~Operator} BLANK Alias to EQ_BLANK
|
31
|
+
* @property {!FilterOperators~Operator} NBLANK Alias to EQ_NBLANK
|
32
32
|
*/
|
33
33
|
|
34
|
-
/** @
|
34
|
+
/** @type {!FilterOperators~Operators}
|
35
35
|
* @public
|
36
|
+
* @const
|
36
37
|
*/
|
37
38
|
var FilterOperators = {
|
38
39
|
EQ: {
|
@@ -196,7 +197,7 @@ FilterOperators.BLANK = FilterOperators.EQ_BLANK;
|
|
196
197
|
FilterOperators.NBLANK = FilterOperators.EQ_NBLANK;
|
197
198
|
|
198
199
|
|
199
|
-
/** @type {Object.<string, Function>}
|
200
|
+
/** @type {!Object.<string, Function>}
|
200
201
|
* @public
|
201
202
|
* @const
|
202
203
|
*/
|
@@ -1,16 +1,36 @@
|
|
1
1
|
import DataSet from "./DataSet.js";
|
2
2
|
|
3
|
+
declare namespace DataGenerator {
|
4
|
+
|
5
|
+
type DataOptions = {
|
6
|
+
seed?: number|null,
|
7
|
+
numRows?: number|null,
|
8
|
+
rowCount?: number|null
|
9
|
+
};
|
10
|
+
|
11
|
+
type FieldInformation = {
|
12
|
+
type?: string|null,
|
13
|
+
prefix?: string|null,
|
14
|
+
suffix?: string|null,
|
15
|
+
min?: number|null,
|
16
|
+
max?: number|null,
|
17
|
+
prec?: string|null,
|
18
|
+
fixedValue?: string|null,
|
19
|
+
members?: any[]|null,
|
20
|
+
generate?: ((...params: any[]) => any)|null
|
21
|
+
};
|
22
|
+
|
23
|
+
}
|
24
|
+
|
3
25
|
declare class DataGenerator {
|
4
26
|
|
5
27
|
constructor(seed?: number|null);
|
6
28
|
|
7
|
-
public
|
8
|
-
|
9
|
-
public generate(fields: string|(string)[]|null, options?: (number|any)|null): (any[])[];
|
29
|
+
public generate(fields: string|(string)[]|null, options?: (number|DataGenerator.DataOptions)|null): (any[])[];
|
10
30
|
|
11
31
|
public generateRecords(fields: string|(string)[]|null, options?: (number|any)|null): (any)[];
|
12
32
|
|
13
|
-
public generateQuoteData(field: string, options?:
|
33
|
+
public generateQuoteData(field: string, options?: DataGenerator.DataOptions|null): any;
|
14
34
|
|
15
35
|
public getSeed(): number|null;
|
16
36
|
|
@@ -32,13 +52,13 @@ declare class DataGenerator {
|
|
32
52
|
|
33
53
|
public randString(min?: number|null, max?: number|null): string;
|
34
54
|
|
35
|
-
public static generate(fields: string|(string)[]|null, options?:
|
55
|
+
public static generate(fields: string|(string)[]|null, options?: DataGenerator.DataOptions|null): (any[])[];
|
36
56
|
|
37
|
-
public static generateRecord(fields: string|(string)[]|null, options?:
|
57
|
+
public static generateRecord(fields: string|(string)[]|null, options?: DataGenerator.DataOptions|null): any;
|
38
58
|
|
39
|
-
public static generateRecords(fields: string|(string)[]|null, options?: (number|
|
59
|
+
public static generateRecords(fields: string|(string)[]|null, options?: (number|DataGenerator.DataOptions)|null): (any)[];
|
40
60
|
|
41
|
-
public static addFieldInfo(field: string, options:
|
61
|
+
public static addFieldInfo(field: string, options: DataGenerator.FieldInformation|((...params: any[]) => any)|null): void;
|
42
62
|
|
43
63
|
public static randNumber(min?: number|null, max?: number|null, prec?: (number|null)|null, seed?: number|null): number;
|
44
64
|
|
@@ -56,11 +76,13 @@ declare class DataGenerator {
|
|
56
76
|
|
57
77
|
public static randString(min?: number|null, max?: number|null, subType?: string|null, seed?: number|null): string;
|
58
78
|
|
79
|
+
public static toRecords(data2D: (any[])[]|null, fields?: (string)[]|null): (any)[]|null;
|
80
|
+
|
59
81
|
}
|
60
82
|
|
61
83
|
declare function getFieldInfo(field: string): any;
|
62
84
|
|
63
|
-
declare function addFieldInfo(field: string, options:
|
85
|
+
declare function addFieldInfo(field: string, options: DataGenerator.FieldInformation|((...params: any[]) => any)|null): void;
|
64
86
|
|
65
87
|
declare function pseudoRandNumber(seed: number): number;
|
66
88
|
|
@@ -84,13 +106,13 @@ declare function toRecords(data2D: (any[])[]|null, fields?: (string)[]|null): (a
|
|
84
106
|
|
85
107
|
declare function getSeed(): number;
|
86
108
|
|
87
|
-
declare function generate(fields: string|(string)[]|null, options?:
|
109
|
+
declare function generate(fields: string|(string)[]|null, options?: DataGenerator.DataOptions|null): (any[])[];
|
88
110
|
|
89
|
-
declare function generateRecord(fields: string|(string)[]|null, options?: (number|
|
111
|
+
declare function generateRecord(fields: string|(string)[]|null, options?: (number|DataGenerator.DataOptions)|null, seed?: number|null): any;
|
90
112
|
|
91
|
-
declare function generateRecords(fields: string|(string)[]|null, options?: (number|
|
113
|
+
declare function generateRecords(fields: string|(string)[]|null, options?: (number|DataGenerator.DataOptions)|null): (any)[];
|
92
114
|
|
93
|
-
declare function generateQuoteData(field: string, options?:
|
115
|
+
declare function generateQuoteData(field: string, options?: DataGenerator.DataOptions|null, seed?: number|null): any;
|
94
116
|
|
95
117
|
export default DataGenerator;
|
96
118
|
export {
|
@@ -1,5 +1,25 @@
|
|
1
1
|
import DataSet from "./DataSet.js";
|
2
2
|
|
3
|
+
/** @typedef {Object} DataGenerator~DataOptions
|
4
|
+
* @description Options for generating data
|
5
|
+
* @property {number=} seed Seed for randomization. If seed is not specified (default), new set of data will be generated every time. Otherwise, the same set of data will be generated.
|
6
|
+
* @property {number=} numRows Number of rows to be generated
|
7
|
+
* @property {number=} rowCount Alias to numRows
|
8
|
+
*/
|
9
|
+
|
10
|
+
/** @typedef {Object} DataGenerator~FieldInformation
|
11
|
+
* @description Information object for defining how data are generated for a specific field
|
12
|
+
* @property {string=} type Available types are number, float, boolean, set, function, and isoDate
|
13
|
+
* @property {string=} prefix Add a text prefix to the data
|
14
|
+
* @property {string=} suffix Add a text suffix to the data
|
15
|
+
* @property {number=} min Minimum value of the numeric data
|
16
|
+
* @property {number=} max Maximum value of the numeric data. This is exclusive (not included in the result).
|
17
|
+
* @property {string=} prec Precision (place number after the decimal point) of the numeric data.
|
18
|
+
* @property {string=} fixedValue Single/static/constant value
|
19
|
+
* @property {Array=} members List of possible data when the type is "set"
|
20
|
+
* @property {Function=} generate Function for generating data when the type is "function"
|
21
|
+
*/
|
22
|
+
|
3
23
|
/** @private
|
4
24
|
* @param {Object} fInfo
|
5
25
|
* @param {number=} seed
|
@@ -26,8 +46,7 @@ var _generateDate1 = function(fInfo, seed) {
|
|
26
46
|
|
27
47
|
var POW10 = [1, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10];
|
28
48
|
|
29
|
-
/**
|
30
|
-
* @type {Object}
|
49
|
+
/** @type {Object.<string, DataGenerator~DataOptions>}
|
31
50
|
* @private
|
32
51
|
*/
|
33
52
|
var _fieldInfo = {
|
@@ -100,7 +119,7 @@ var getFieldInfo = function(field) {
|
|
100
119
|
|
101
120
|
/** @public
|
102
121
|
* @param {string} field
|
103
|
-
* @param {
|
122
|
+
* @param {DataGenerator~FieldInformation|Function} options
|
104
123
|
*/
|
105
124
|
var addFieldInfo = function(field, options) {
|
106
125
|
if(field) {
|
@@ -299,9 +318,10 @@ var getSeed = function() {
|
|
299
318
|
return DataGenerator.seed;
|
300
319
|
};
|
301
320
|
|
302
|
-
/**
|
321
|
+
/** Generate 2 dimensional array of data from the specified field and options. Note that 2D array data structure is not recommended for usage due to the position of fields/columns can be changed at runtime.
|
322
|
+
* @public
|
303
323
|
* @param {string|Array.<string>} fields
|
304
|
-
* @param {
|
324
|
+
* @param {DataGenerator~DataOptions=} options
|
305
325
|
* @return {!Array.<Array>} 2D Array of data
|
306
326
|
*/
|
307
327
|
var generate = function(fields, options) {
|
@@ -314,7 +334,7 @@ var generate = function(fields, options) {
|
|
314
334
|
/** WARNING: This method does not modify global seed
|
315
335
|
* @public
|
316
336
|
* @param {string|Array.<string>} fields
|
317
|
-
* @param {(number|
|
337
|
+
* @param {(number|DataGenerator~DataOptions)=} options Configuration object or seed number
|
318
338
|
* @param {number=} seed
|
319
339
|
* @return {!Object} Object with the given fields as its keys
|
320
340
|
*/
|
@@ -342,7 +362,7 @@ var generateRecord = function(fields, options, seed) {
|
|
342
362
|
|
343
363
|
/** @public
|
344
364
|
* @param {string|Array.<string>} fields
|
345
|
-
* @param {(number|
|
365
|
+
* @param {(number|DataGenerator~DataOptions)=} options Configuration object or number of rows
|
346
366
|
* @return {!Array.<Object>} Array of object with the given fields as its keys
|
347
367
|
*/
|
348
368
|
var generateRecords = function(fields, options) {
|
@@ -366,7 +386,7 @@ var generateRecords = function(fields, options) {
|
|
366
386
|
/** WARNING: This method does not modify global seed
|
367
387
|
* @public
|
368
388
|
* @param {string} field
|
369
|
-
* @param {
|
389
|
+
* @param {DataGenerator~DataOptions=} options
|
370
390
|
* @param {number=} seed
|
371
391
|
* @return {!Object} Object with value, formattedValue and other properties
|
372
392
|
*/
|
@@ -462,7 +482,7 @@ var _hash = function(str) {
|
|
462
482
|
};
|
463
483
|
/** @private
|
464
484
|
* @param {string} field
|
465
|
-
* @param {
|
485
|
+
* @param {DataGenerator~DataOptions=} options
|
466
486
|
* @param {number=} seed
|
467
487
|
* @return {!Object} Object with value and other properties
|
468
488
|
*/
|
@@ -533,9 +553,10 @@ var DataGenerator = function(seed) {
|
|
533
553
|
*/
|
534
554
|
DataGenerator.prototype._seed = null;
|
535
555
|
|
536
|
-
/**
|
556
|
+
/** Generate 2 dimensional array of data from the specified field and options. Note that 2D array data structure is not recommended for usage due to the position of fields/columns can be changed at runtime.
|
557
|
+
* @public
|
537
558
|
* @param {string|Array.<string>} fields
|
538
|
-
* @param {(number|
|
559
|
+
* @param {(number|DataGenerator~DataOptions)=} options
|
539
560
|
* @return {!Array.<Array>} 2D Array of data
|
540
561
|
*/
|
541
562
|
DataGenerator.prototype.generate = function(fields, options) {
|
@@ -570,7 +591,7 @@ DataGenerator.prototype.generateRecords = function(fields, options) {
|
|
570
591
|
|
571
592
|
/** @public
|
572
593
|
* @param {string} field
|
573
|
-
* @param {
|
594
|
+
* @param {DataGenerator~DataOptions=} options
|
574
595
|
* @return {!Object} Object with value, formattedValue and other properties
|
575
596
|
*/
|
576
597
|
DataGenerator.prototype.generateQuoteData = function(field, options) {
|
@@ -700,33 +721,35 @@ DataGenerator.prototype.randString = function(min, max) {
|
|
700
721
|
|
701
722
|
/** @type {?number}
|
702
723
|
* @public
|
724
|
+
* @ignore
|
703
725
|
*/
|
704
726
|
DataGenerator.seed = null;
|
705
|
-
/**
|
727
|
+
/** Generate 2 dimensional array of data from the specified field and options. Note that 2D array data structure is not recommended for usage due to the position of fields/columns can be changed at runtime.
|
728
|
+
* @public
|
706
729
|
* @function
|
707
730
|
* @param {string|Array.<string>} fields
|
708
|
-
* @param {
|
731
|
+
* @param {DataGenerator~DataOptions=} options
|
709
732
|
* @return {!Array.<Array>} 2D Array of data
|
710
733
|
*/
|
711
734
|
DataGenerator.generate = generate;
|
712
735
|
/** @public
|
713
736
|
* @function
|
714
737
|
* @param {string|Array.<string>} fields
|
715
|
-
* @param {
|
738
|
+
* @param {DataGenerator~DataOptions=} options
|
716
739
|
* @return {Object} Object with the given fields as its keys
|
717
740
|
*/
|
718
741
|
DataGenerator.generateRecord = generateRecord;
|
719
742
|
/** @public
|
720
743
|
* @function
|
721
744
|
* @param {string|Array.<string>} fields
|
722
|
-
* @param {(number|
|
745
|
+
* @param {(number|DataGenerator~DataOptions)=} options Configuration object or number of rows
|
723
746
|
* @return {!Array.<Object>} Array of object with the given fields as its keys
|
724
747
|
*/
|
725
748
|
DataGenerator.generateRecords = generateRecords;
|
726
749
|
/** @public
|
727
750
|
* @function
|
728
751
|
* @param {string} field
|
729
|
-
* @param {
|
752
|
+
* @param {DataGenerator~FieldInformation|Function} options
|
730
753
|
*/
|
731
754
|
DataGenerator.addFieldInfo = addFieldInfo;
|
732
755
|
/** Return a floating-point random number in the range min - max (inclusive of min, but not max) with prec digits of precision.
|
@@ -801,6 +824,8 @@ DataGenerator.randDate = randDate;
|
|
801
824
|
DataGenerator.randString = randString;
|
802
825
|
|
803
826
|
/** Convert 2D Array to Array of records
|
827
|
+
* @public
|
828
|
+
* @function
|
804
829
|
* @param {Array.<Array>} data2D Array of values
|
805
830
|
* @param {Array.<string>=} fields Keys to be mapped on the output records.
|
806
831
|
* @return {Array.<Object>} records
|
package/lib/utils/index.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import { GridPrinter } from "../tr-grid-printer/es6/GridPrinter.js";
|
2
2
|
import { Table } from "../tr-grid-util/es6/Table.js";
|
3
3
|
import { MultiTableManager } from "../tr-grid-util/es6/MultiTableManager.js";
|
4
|
+
import { FilterOperators, OperatorFunctions } from "../tr-grid-util/es6/FilterOperators.js";
|
4
5
|
import { DataGenerator } from "../tr-grid-util/es6/jet/DataGenerator.js";
|
5
6
|
import { MockRTK } from "../tr-grid-util/es6/jet/MockRTK.js";
|
6
|
-
export { GridPrinter, Table, MultiTableManager, DataGenerator, MockRTK };
|
7
|
+
export { GridPrinter, Table, MultiTableManager, DataGenerator, MockRTK, FilterOperators, OperatorFunctions };
|
package/lib/utils/index.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import { GridPrinter } from "../tr-grid-printer/es6/GridPrinter.js";
|
2
2
|
import { Table } from "../tr-grid-util/es6/Table.js";
|
3
3
|
import { MultiTableManager } from "../tr-grid-util/es6/MultiTableManager.js";
|
4
|
+
import { FilterOperators, OperatorFunctions } from "../tr-grid-util/es6/FilterOperators.js";
|
4
5
|
import { DataGenerator } from "../tr-grid-util/es6/jet/DataGenerator.js";
|
5
6
|
import { MockRTK } from "../tr-grid-util/es6/jet/MockRTK.js";
|
6
|
-
export { GridPrinter, Table, MultiTableManager, DataGenerator, MockRTK };
|
7
|
+
export { GridPrinter, Table, MultiTableManager, DataGenerator, MockRTK, FilterOperators, OperatorFunctions };
|