@refinitiv-ui/efx-grid 6.0.91 → 6.0.93
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/filter-dialog/lib/filter-dialog.js +1 -0
- 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-checkbox/es6/Checkbox.js +268 -268
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -2
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +60 -32
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +279 -279
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +227 -207
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +11 -11
- package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +1 -2
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +120 -121
- package/lib/tr-grid-util/es6/CellPainter.js +94 -104
- 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 +41 -41
- package/lib/tr-grid-util/es6/Deferred.js +5 -5
- package/lib/tr-grid-util/es6/Delay.d.ts +3 -3
- package/lib/tr-grid-util/es6/Delay.js +14 -3
- 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 -58
- 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 -87
- 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 +71 -80
- package/lib/tr-grid-util/es6/NumberFormatter.js +23 -23
- 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 +52 -52
- 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/types/es6/RowDragging.d.ts +1 -2
- package/lib/versions.json +12 -12
- 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
|
@@ -5,67 +5,67 @@ import ElfUtil from './ElfUtil.js';
|
|
|
5
5
|
* @public
|
|
6
6
|
* @constant
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
const INVALID_DATE = new Date(NaN); // eslint-disable-line
|
|
9
9
|
/** JavaScript date starts at Jan 01 1970, while Excel date starts at Jan 01 1900 (before JavaScript date). This value is the difference in days between the two values.
|
|
10
10
|
* @type {number}
|
|
11
11
|
* @private
|
|
12
12
|
* @constant
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
const _DIFF_DAYS = 25567 + 2; // Start 1 on 1 Jan 1900 + 1 for error on 29 Feb 1900 (Not existing date but existing in window)
|
|
15
15
|
/** Starting date (1 Jan 1900) of Excel date in milliseconds counting from JavaScript date
|
|
16
16
|
* @type {number}
|
|
17
17
|
* @private
|
|
18
18
|
* @constant
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
const _1_JAN_1900 = Date.UTC(1900, 0, 1); // -2208988800000
|
|
21
21
|
/** @type {number}
|
|
22
22
|
* @private
|
|
23
23
|
* @constant
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
const _1_MAR_1900 = Date.UTC(1900, 2, 1); // -2203891200000
|
|
26
26
|
/** @type {number}
|
|
27
27
|
* @public
|
|
28
28
|
* @constant
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
const MILLISECONDS_IN_DAY = 24 * 60 * 60 * 1000; // 86400000
|
|
31
31
|
/** 86400 seconds in a day
|
|
32
32
|
* @type {number}
|
|
33
33
|
* @public
|
|
34
34
|
* @constant
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
const SECONDS_IN_DAY = 24 * 60 * 60; // eslint-disable-line
|
|
37
37
|
/** 3600 seconds in a day
|
|
38
38
|
* @type {number}
|
|
39
39
|
* @public
|
|
40
40
|
* @constant
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
const SECONDS_IN_HOUR = 60 * 60; // eslint-disable-line
|
|
43
43
|
/** @type {number}
|
|
44
44
|
* @public
|
|
45
45
|
* @constant
|
|
46
46
|
*/
|
|
47
|
-
|
|
47
|
+
const SECONDS_IN_MINUTE = 60; // eslint-disable-line
|
|
48
48
|
|
|
49
49
|
/** @type {Array.<string>}
|
|
50
50
|
* @public
|
|
51
51
|
* @constant
|
|
52
52
|
*/
|
|
53
|
-
|
|
53
|
+
const SHORT_DAYS = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
|
|
54
54
|
/** @type {Array.<string>}
|
|
55
55
|
* @public
|
|
56
56
|
* @constant
|
|
57
57
|
*/
|
|
58
|
-
|
|
58
|
+
const FULL_DAYS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
|
59
59
|
/** @type {Array.<string>}
|
|
60
60
|
* @public
|
|
61
61
|
* @constant
|
|
62
62
|
*/
|
|
63
|
-
|
|
63
|
+
const SHORT_MONTHS = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
|
|
64
64
|
/** @type {Array.<string>}
|
|
65
65
|
* @public
|
|
66
66
|
* @constant
|
|
67
67
|
*/
|
|
68
|
-
|
|
68
|
+
const FULL_MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
69
69
|
|
|
70
70
|
/** Add zero prefix to the number. WARNING: Does not support negative number
|
|
71
71
|
* @ignore
|
|
@@ -73,7 +73,7 @@ var FULL_MONTHS = ["January", "February", "March", "April", "May", "June", "July
|
|
|
73
73
|
* @param {number} num
|
|
74
74
|
* @return {string}
|
|
75
75
|
*/
|
|
76
|
-
|
|
76
|
+
let prefixZero = function(num) {
|
|
77
77
|
return (num > 9) ? "" + num : "0" + num;
|
|
78
78
|
};
|
|
79
79
|
|
|
@@ -83,7 +83,7 @@ var prefixZero = function(num) {
|
|
|
83
83
|
* @param {number} num
|
|
84
84
|
* @return {string}
|
|
85
85
|
*/
|
|
86
|
-
|
|
86
|
+
let prefixDoubleZero = function(num) {
|
|
87
87
|
if (num > 99) {
|
|
88
88
|
return "" + num;
|
|
89
89
|
} else if (num > 9) {
|
|
@@ -97,7 +97,7 @@ var prefixDoubleZero = function(num) {
|
|
|
97
97
|
* @ignore
|
|
98
98
|
* @description Map of date pattern convertion
|
|
99
99
|
*/
|
|
100
|
-
|
|
100
|
+
let Parsers = {
|
|
101
101
|
// Interday time
|
|
102
102
|
"D": function(date, locale) { return "" + date.getDate(); },
|
|
103
103
|
"DD": function(date, locale) { return prefixZero(date.getDate()); },
|
|
@@ -107,17 +107,17 @@ var Parsers = {
|
|
|
107
107
|
"MM": function(date, locale) { return prefixZero(date.getMonth() + 1); },
|
|
108
108
|
"MMM": function(date, locale) { return locale[ SHORT_MONTHS[date.getMonth()] ]; },
|
|
109
109
|
"M_": function(date, locale) { return locale[ FULL_MONTHS[date.getMonth()] ]; },
|
|
110
|
-
"YY": function(date, locale) { return ("" + date.getFullYear()).
|
|
110
|
+
"YY": function(date, locale) { return ("" + date.getFullYear()).slice(-2); },
|
|
111
111
|
"Y_": function(date, locale) { return "" + date.getFullYear(); },
|
|
112
112
|
// Intraday time
|
|
113
113
|
"H": function(date, locale) { return "" + date.getHours(); },
|
|
114
114
|
"H_": function(date, locale) { return prefixZero(date.getHours()); },
|
|
115
115
|
"h": function(date, locale) {
|
|
116
|
-
|
|
116
|
+
let temp = date.getHours() % 12;
|
|
117
117
|
return (temp === 0) ? "12" : "" + temp;
|
|
118
118
|
},
|
|
119
119
|
"h_": function(date, locale) {
|
|
120
|
-
|
|
120
|
+
let temp = date.getHours() % 12;
|
|
121
121
|
temp = (temp === 0) ? 12 : temp;
|
|
122
122
|
return prefixZero(temp);
|
|
123
123
|
},
|
|
@@ -135,7 +135,7 @@ var Parsers = {
|
|
|
135
135
|
|
|
136
136
|
/** @namespace
|
|
137
137
|
*/
|
|
138
|
-
|
|
138
|
+
let DateTime = {};
|
|
139
139
|
|
|
140
140
|
/**
|
|
141
141
|
* @type {string}
|
|
@@ -173,7 +173,7 @@ DateTime.setDateTimePattern = function(format) {
|
|
|
173
173
|
* @param {string=} lang
|
|
174
174
|
*/
|
|
175
175
|
DateTime.setLocale = function(lang) {
|
|
176
|
-
|
|
176
|
+
let mainLang = ElfUtil.toLangString(lang);
|
|
177
177
|
DateTime._localeSetting = translation[mainLang] ? mainLang : "en";
|
|
178
178
|
};
|
|
179
179
|
|
|
@@ -215,9 +215,9 @@ DateTime.setLocale = function(lang) {
|
|
|
215
215
|
* ---------------------------------------------------------------------
|
|
216
216
|
*/
|
|
217
217
|
DateTime.format = function(dateTimeNumber, dateTimeFormat, timezone) {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
218
|
+
let date = null;
|
|
219
|
+
let dtTxt = ""; // new Date() is on par with Date.parse in term of performance.
|
|
220
|
+
let localTime = !!(timezone && timezone.toUpperCase() === "LOCAL");
|
|
221
221
|
if(typeof dateTimeNumber === "number") {
|
|
222
222
|
if(dateTimeNumber > 1e8) { // Maximum date is 100 millions and any number greater than that is assumed to be millisecond
|
|
223
223
|
date = new Date(dateTimeNumber); // convert milisecond
|
|
@@ -233,7 +233,7 @@ DateTime.format = function(dateTimeNumber, dateTimeFormat, timezone) {
|
|
|
233
233
|
} else {
|
|
234
234
|
// Pass the value with string format, expected to be ISO8601 format (YYYY-MM-DDTHH:mm:ss)
|
|
235
235
|
dtTxt = dateTimeNumber + "";
|
|
236
|
-
|
|
236
|
+
let isISO8601 = dtTxt.match(/^\d{4}(-\d{2}(-\d{2}(T\d{2}\:\d{2}\:\d{2})?)?)?$/);
|
|
237
237
|
dtTxt = dtTxt.replace(/\-/g, "\/"); // Convert to YYYY/MM/DD HH:mm:ss (common for all browsers)
|
|
238
238
|
if(isISO8601) {
|
|
239
239
|
dtTxt = dtTxt.replace(/T/g, " "); // Convert to YYYY/MM/DD HH:mm:ss (common for all browsers)
|
|
@@ -272,7 +272,7 @@ DateTime.formatDateObject = function(date, dateTimeFormat) {
|
|
|
272
272
|
DateTime._activeInput = date;
|
|
273
273
|
DateTime._activeLocaleMap = translation[DateTime._localeSetting] || DateTimeLocale["en"];
|
|
274
274
|
|
|
275
|
-
|
|
275
|
+
let result = dateTimeFormat.replace(/D+|M+|Y+|H+|S+|A+|d+|m+|y+|h+|s+|a+|\[[^\]]*\]+/g, DateTime._parseDatePattern);
|
|
276
276
|
DateTime._activeInput = null;
|
|
277
277
|
|
|
278
278
|
return result;
|
|
@@ -292,14 +292,14 @@ DateTime._lowerCaseDatePatterns = {
|
|
|
292
292
|
* @return {string}
|
|
293
293
|
*/
|
|
294
294
|
DateTime._parseDatePattern = function(match) {
|
|
295
|
-
|
|
295
|
+
let fchar = (match) ? match.charAt(0) : "";
|
|
296
296
|
if(fchar === "[") { // Static text
|
|
297
297
|
return match.substring(1, match.length - 1);
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
-
|
|
300
|
+
let parser = Parsers[match];
|
|
301
301
|
if(!parser) {
|
|
302
|
-
|
|
302
|
+
let mod = match;
|
|
303
303
|
if(DateTime._lowerCaseDatePatterns[fchar]) {
|
|
304
304
|
mod = match.toUpperCase();
|
|
305
305
|
fchar = fchar.toUpperCase();
|
|
@@ -325,7 +325,7 @@ DateTime._parseDatePattern = function(match) {
|
|
|
325
325
|
DateTime.isValidDate = function(dateObj) {
|
|
326
326
|
if(dateObj) {
|
|
327
327
|
if(dateObj.getTime) {
|
|
328
|
-
|
|
328
|
+
let t = dateObj.getTime();
|
|
329
329
|
return t === t;
|
|
330
330
|
}
|
|
331
331
|
}
|
|
@@ -340,7 +340,7 @@ DateTime.isValidDate = function(dateObj) {
|
|
|
340
340
|
DateTime.isInvalidDate = function(dateObj) {
|
|
341
341
|
if(dateObj) {
|
|
342
342
|
if(dateObj.getTime) {
|
|
343
|
-
|
|
343
|
+
let t = dateObj.getTime();
|
|
344
344
|
return t !== t;
|
|
345
345
|
}
|
|
346
346
|
}
|
|
@@ -356,9 +356,9 @@ DateTime.isInvalidDate = function(dateObj) {
|
|
|
356
356
|
* @see {@link DateTime#timeNumberToMs}
|
|
357
357
|
*/
|
|
358
358
|
DateTime.fromDateNumber = function(dateNumber) {
|
|
359
|
-
|
|
359
|
+
let datePart = DateTime.dateNumberToMs(dateNumber);
|
|
360
360
|
if(datePart === datePart) {
|
|
361
|
-
|
|
361
|
+
let timePart = DateTime.timeNumberToMs(dateNumber);
|
|
362
362
|
return new Date(datePart + timePart);
|
|
363
363
|
}
|
|
364
364
|
return new Date(NaN);
|
|
@@ -377,7 +377,7 @@ DateTime.dateNumberToMs = function(dateNumber) {
|
|
|
377
377
|
return NaN;
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
-
|
|
380
|
+
let num = dateNumber - _DIFF_DAYS;
|
|
381
381
|
if(dateNumber < 60) {
|
|
382
382
|
num++; // +1 Before 1 Mar 1900 because there is not existing 29 Feb 1900 but existing in Window.
|
|
383
383
|
}
|
|
@@ -395,7 +395,7 @@ DateTime.timeNumberToMs = function(dateNumber) {
|
|
|
395
395
|
if(typeof dateNumber !== "number") {
|
|
396
396
|
dateNumber = (+dateNumber);
|
|
397
397
|
}
|
|
398
|
-
|
|
398
|
+
let timeNumber = dateNumber - Math.floor(dateNumber);
|
|
399
399
|
if(!timeNumber) { // NaN or 0
|
|
400
400
|
return 0;
|
|
401
401
|
}
|
|
@@ -403,7 +403,7 @@ DateTime.timeNumberToMs = function(dateNumber) {
|
|
|
403
403
|
timeNumber = -timeNumber;
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
-
|
|
406
|
+
let secondFromMidnight = Math.round(timeNumber * SECONDS_IN_DAY);
|
|
407
407
|
return secondFromMidnight * 1000;
|
|
408
408
|
};
|
|
409
409
|
|
|
@@ -413,7 +413,7 @@ DateTime.timeNumberToMs = function(dateNumber) {
|
|
|
413
413
|
* @return {Object}
|
|
414
414
|
*/
|
|
415
415
|
DateTime.toDateObject = function(dateInput) {
|
|
416
|
-
|
|
416
|
+
let date = null;
|
|
417
417
|
if(dateInput instanceof Date) {
|
|
418
418
|
date = dateInput;
|
|
419
419
|
} else if(typeof dateInput === "number") {
|
|
@@ -432,8 +432,8 @@ DateTime.toDateObject = function(dateInput) {
|
|
|
432
432
|
date = new Date(NaN);
|
|
433
433
|
} else {
|
|
434
434
|
// Pass the value with string format, expected to be ISO8601 format (YYYY-MM-DDTHH:mm:ss)
|
|
435
|
-
|
|
436
|
-
|
|
435
|
+
let dtTxt = dateInput + "";
|
|
436
|
+
let isISO8601 = dtTxt.match(/^\d{4}(-\d{2}(-\d{2}(T\d{2}\:\d{2}\:\d{2})?)?)?$/);
|
|
437
437
|
dtTxt = dtTxt.replace(/\-/g, "\/"); // Convert to YYYY/MM/DD HH:mm:ss (common for all browsers)
|
|
438
438
|
if(isISO8601) {
|
|
439
439
|
dtTxt = dtTxt.replace(/T/g, " "); // Convert to YYYY/MM/DD HH:mm:ss (common for all browsers)
|
|
@@ -481,7 +481,7 @@ DateTime._millisecondToDateNumber = function(millisecond) {
|
|
|
481
481
|
if(millisecond !== millisecond || millisecond < _1_JAN_1900) { // Invalid input
|
|
482
482
|
return NaN;
|
|
483
483
|
} else {
|
|
484
|
-
|
|
484
|
+
let calDate = (millisecond / MILLISECONDS_IN_DAY) + _DIFF_DAYS;
|
|
485
485
|
if(millisecond < _1_MAR_1900) {
|
|
486
486
|
calDate--; // -1 before 1 Mar 1900 because there is not existing 29 Feb 1900 but existing in Window.
|
|
487
487
|
}
|
|
@@ -496,9 +496,9 @@ DateTime._millisecondToDateNumber = function(millisecond) {
|
|
|
496
496
|
* @return {string}
|
|
497
497
|
*/
|
|
498
498
|
DateTime.toYYYYMMDD = function(dateObj) {
|
|
499
|
-
|
|
499
|
+
let str = dateObj ? dateObj.toJSON() : "";
|
|
500
500
|
if(str) {
|
|
501
|
-
return str.
|
|
501
|
+
return str.slice(0, 10);
|
|
502
502
|
}
|
|
503
503
|
return "";
|
|
504
504
|
};
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* @param {Function=} rejectHandler
|
|
5
5
|
* @param {*=} ctx Context object that will be provided as the second parameter of the given handlers
|
|
6
6
|
* @example
|
|
7
|
-
*
|
|
7
|
+
* let def = new Deferred(handler);
|
|
8
8
|
* setTimeout(def.resolve, 2000);
|
|
9
|
-
*
|
|
9
|
+
* let def2 = new Deferred();
|
|
10
10
|
* setTimeout(function() {
|
|
11
11
|
* def2.resolve();
|
|
12
12
|
* }, 4000);
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
let Deferred = function(resolveHandler, rejectHandler, ctx) {
|
|
15
15
|
this.resolve = this.resolve.bind(this);
|
|
16
16
|
this.reject = this.reject.bind(this);
|
|
17
17
|
|
|
@@ -65,7 +65,7 @@ Deferred.prototype._fulfilled = false;
|
|
|
65
65
|
Deferred.prototype.resolve = function(result) {
|
|
66
66
|
if(this._resolve) { // Promise can be resolved only once
|
|
67
67
|
if(this._resolveHandler) {
|
|
68
|
-
|
|
68
|
+
let handlerRes = this._resolveHandler(result, this._ctx || this);
|
|
69
69
|
if(handlerRes != null) {
|
|
70
70
|
result = handlerRes;
|
|
71
71
|
}
|
|
@@ -80,7 +80,7 @@ Deferred.prototype.resolve = function(result) {
|
|
|
80
80
|
Deferred.prototype.reject = function(result) {
|
|
81
81
|
if(this._reject) { // Promise can be resolved only once
|
|
82
82
|
if(this._rejectHandler) {
|
|
83
|
-
|
|
83
|
+
let handlerRes = this._rejectHandler(result, this._ctx || this);
|
|
84
84
|
if(handlerRes != null) {
|
|
85
85
|
result = handlerRes;
|
|
86
86
|
}
|
|
@@ -4,8 +4,6 @@ declare class Delay {
|
|
|
4
4
|
|
|
5
5
|
constructor(ms?: number|null, ctx?: any);
|
|
6
6
|
|
|
7
|
-
public static readonly promise: Promise<any>;
|
|
8
|
-
|
|
9
7
|
public static for(ms?: number|null, ctx?: any): Delay|null;
|
|
10
8
|
|
|
11
9
|
public resolve(): void;
|
|
@@ -16,5 +14,7 @@ declare class Delay {
|
|
|
16
14
|
|
|
17
15
|
}
|
|
18
16
|
|
|
17
|
+
declare function promiseDelay(ms?: number|null, ctx?: any): Promise<any>|null;
|
|
18
|
+
|
|
19
19
|
export default Delay;
|
|
20
|
-
export {Delay};
|
|
20
|
+
export {Delay, promiseDelay};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @param {number=} ms
|
|
4
4
|
* @param {*=} ctx Context object that will passed to resolve func as the first parameter
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
let Delay = function(ms, ctx){
|
|
7
7
|
this.promise = new Promise(this._executor.bind(this));
|
|
8
8
|
if(ctx != null) {
|
|
9
9
|
this._ctx = ctx;
|
|
@@ -25,7 +25,7 @@ Delay.for = function(ms, ctx) {
|
|
|
25
25
|
/** @type {Promise<*>}
|
|
26
26
|
* @public
|
|
27
27
|
*/
|
|
28
|
-
Delay.promise = null;
|
|
28
|
+
Delay.prototype.promise = null;
|
|
29
29
|
/** @type {Function}
|
|
30
30
|
* @private
|
|
31
31
|
*/
|
|
@@ -81,5 +81,16 @@ Delay.prototype._onTimeout = function() {
|
|
|
81
81
|
this._ctx = null;
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
+
/** Create a promise of a Delay
|
|
85
|
+
* @public
|
|
86
|
+
* @function
|
|
87
|
+
* @param {number=} ms
|
|
88
|
+
* @param {*=} ctx
|
|
89
|
+
* @return {Promise}
|
|
90
|
+
*/
|
|
91
|
+
let promiseDelay = function(ms, ctx) {
|
|
92
|
+
return Delay.for(ms, ctx).promise;
|
|
93
|
+
};
|
|
94
|
+
|
|
84
95
|
export default Delay;
|
|
85
|
-
export {Delay};
|
|
96
|
+
export {Delay, promiseDelay};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @namespace */
|
|
2
|
-
|
|
2
|
+
let Dom = {};
|
|
3
3
|
|
|
4
4
|
/** Shorthand for creating an element with class
|
|
5
5
|
* @public
|
|
@@ -9,7 +9,7 @@ var Dom = {};
|
|
|
9
9
|
* @return {!Element}
|
|
10
10
|
*/
|
|
11
11
|
Dom.create = function(tagName, className) {
|
|
12
|
-
|
|
12
|
+
let elem = document.createElement(tagName);
|
|
13
13
|
if(className) {
|
|
14
14
|
elem.className = className;
|
|
15
15
|
}
|
|
@@ -32,7 +32,7 @@ Dom.div = function(className) {
|
|
|
32
32
|
* @return {!Element}
|
|
33
33
|
*/
|
|
34
34
|
Dom.text = function(textContent, className) {
|
|
35
|
-
|
|
35
|
+
let elem = Dom.create("span", className);
|
|
36
36
|
if(textContent || textContent === 0) {
|
|
37
37
|
elem.textContent = textContent;
|
|
38
38
|
}
|
|
@@ -50,7 +50,7 @@ Dom.appendChild = function(parentElem, children) {
|
|
|
50
50
|
if(!parentElem) {
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
let i, ary;
|
|
54
54
|
if(Array.isArray(arguments[1])) {
|
|
55
55
|
ary = arguments[1];
|
|
56
56
|
i = 0;
|
|
@@ -58,7 +58,7 @@ Dom.appendChild = function(parentElem, children) {
|
|
|
58
58
|
ary = arguments;
|
|
59
59
|
i = 1;
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
let len = ary.length;
|
|
62
62
|
while(i < len) {
|
|
63
63
|
parentElem.appendChild(ary[i]);
|
|
64
64
|
++i;
|
|
@@ -85,12 +85,12 @@ Dom.buildTree = function(parentElem, children) {
|
|
|
85
85
|
if(!parentElem) {
|
|
86
86
|
return null;
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
for(
|
|
91
|
-
|
|
88
|
+
let args = arguments;
|
|
89
|
+
let len = args.length;
|
|
90
|
+
for(let i = 1; i < len; ++i) {
|
|
91
|
+
let child = args[i];
|
|
92
92
|
if(child) {
|
|
93
|
-
|
|
93
|
+
let childElem;
|
|
94
94
|
if(Array.isArray(child)) {
|
|
95
95
|
childElem = Dom.buildTree.apply(null, child);
|
|
96
96
|
} else if(child.nodeType === 1) {
|
|
@@ -110,7 +110,7 @@ Dom.buildTree = function(parentElem, children) {
|
|
|
110
110
|
*/
|
|
111
111
|
Dom.removeParent = function (child) {
|
|
112
112
|
if(!child) { return null; }
|
|
113
|
-
|
|
113
|
+
let parent = child.parentNode;
|
|
114
114
|
if(parent) {
|
|
115
115
|
parent.removeChild(child);
|
|
116
116
|
}
|
|
@@ -138,7 +138,7 @@ Dom.setParent = function (child, parent) {
|
|
|
138
138
|
*/
|
|
139
139
|
Dom.removeChildren = function (elem, count) {
|
|
140
140
|
if(elem) {
|
|
141
|
-
|
|
141
|
+
let childCount = elem.childNodes.length;
|
|
142
142
|
if(count == null || count > childCount) {
|
|
143
143
|
count = childCount;
|
|
144
144
|
}
|
|
@@ -156,7 +156,7 @@ Dom.removeChildren = function (elem, count) {
|
|
|
156
156
|
Dom.setContent = function(elem, val) {
|
|
157
157
|
if(elem) {
|
|
158
158
|
if(val || val === 0) {
|
|
159
|
-
|
|
159
|
+
let nt = val.nodeType;
|
|
160
160
|
if(nt === 1 || nt === 3) {
|
|
161
161
|
if(val !== elem.lastChild) {
|
|
162
162
|
Dom.removeChildren(elem);
|
|
@@ -221,10 +221,10 @@ Dom.toggleClass = function (elem, classStr, bool) {
|
|
|
221
221
|
*/
|
|
222
222
|
Dom.addClasses = function (elem, classes) {
|
|
223
223
|
if(elem) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
for(
|
|
227
|
-
|
|
224
|
+
let ary = Array.isArray(classes) ? classes : arguments;
|
|
225
|
+
let len = ary.length;
|
|
226
|
+
for(let i = 0; i < len; ++i) {
|
|
227
|
+
let str = ary[i];
|
|
228
228
|
if(str && typeof str == "string") {
|
|
229
229
|
elem.classList.add(str);
|
|
230
230
|
}
|
|
@@ -239,10 +239,10 @@ Dom.addClasses = function (elem, classes) {
|
|
|
239
239
|
*/
|
|
240
240
|
Dom.removeClasses = function (elem, classes) {
|
|
241
241
|
if(elem) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
for(
|
|
245
|
-
|
|
242
|
+
let ary = Array.isArray(classes) ? classes : arguments;
|
|
243
|
+
let len = ary.length;
|
|
244
|
+
for(let i = 0; i < len; ++i) {
|
|
245
|
+
let str = ary[i];
|
|
246
246
|
if(str && typeof str == "string") {
|
|
247
247
|
elem.classList.remove(str);
|
|
248
248
|
}
|
|
@@ -275,9 +275,9 @@ Dom.stopPropagation = function(e) {
|
|
|
275
275
|
* @return {!Object} Return object with property x and y
|
|
276
276
|
*/
|
|
277
277
|
Dom.getClientPosition = function(target, retObj) {
|
|
278
|
-
|
|
278
|
+
let pos = retObj || {"x": 0, "y": 0};
|
|
279
279
|
if(target["getBoundingClientRect"]){
|
|
280
|
-
|
|
280
|
+
let box = target["getBoundingClientRect"]();
|
|
281
281
|
pos["x"] = box.left;
|
|
282
282
|
pos["y"] = box.top;
|
|
283
283
|
} else { //Event
|
|
@@ -301,7 +301,7 @@ Dom.getClientPosition = function(target, retObj) {
|
|
|
301
301
|
*/
|
|
302
302
|
Dom.getRelativePosition = function(A, B, retObj) {
|
|
303
303
|
retObj = Dom.getClientPosition(A, retObj);
|
|
304
|
-
|
|
304
|
+
let bp = Dom.getClientPosition(B);
|
|
305
305
|
|
|
306
306
|
retObj["x"] -= bp["x"];
|
|
307
307
|
retObj["y"] -= bp["y"];
|
|
@@ -315,7 +315,7 @@ Dom.getRelativePosition = function(A, B, retObj) {
|
|
|
315
315
|
* @return {Element}
|
|
316
316
|
*/
|
|
317
317
|
Dom.closestElement = function(elem, classStr) {
|
|
318
|
-
|
|
318
|
+
let n = elem;
|
|
319
319
|
while (n) {
|
|
320
320
|
if(n.classList) { // DocumentFragment does not have classList property
|
|
321
321
|
if (n.classList.contains(classStr)) {
|
|
@@ -334,7 +334,7 @@ Dom.closestElement = function(elem, classStr) {
|
|
|
334
334
|
* @return {Element}
|
|
335
335
|
*/
|
|
336
336
|
Dom.closestTagName = function(elem, tn) {
|
|
337
|
-
|
|
337
|
+
let n = elem;
|
|
338
338
|
while(n) {
|
|
339
339
|
if(n.tagName) {
|
|
340
340
|
if(n.tagName == tn) {
|
|
@@ -6,7 +6,7 @@ import ElfUtil from "./ElfUtil.js";
|
|
|
6
6
|
* @constructor
|
|
7
7
|
* @param {Object} options
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
let DragUI = function(options) {
|
|
10
10
|
this._dragBox = options.dragBox;
|
|
11
11
|
this._dragBoxIcon = options.dragBoxIcon;
|
|
12
12
|
this._dragBoxContent = document.createElement("div");
|
|
@@ -62,12 +62,12 @@ DragUI.applyThemeColor = function(grid) {
|
|
|
62
62
|
*/
|
|
63
63
|
DragUI.prototype.onThemeLoaded = function(colors) {
|
|
64
64
|
if(!DragUI._styles) {
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
let ElfVersion = ElfUtil.getElfVersion();
|
|
66
|
+
let cursor = "grabbing";
|
|
67
67
|
if (ElfVersion < 3) {
|
|
68
68
|
cursor = "move";
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
let styles = [ // Main Styles without theme
|
|
71
71
|
".tr-row-guideline", [ // Backward compatability of row dragging
|
|
72
72
|
"position: absolute;",
|
|
73
73
|
"left: 0;",
|
|
@@ -145,7 +145,7 @@ DragUI.prototype.onThemeLoaded = function(colors) {
|
|
|
145
145
|
],
|
|
146
146
|
".tr-grid .column .cell.drag-indicator", [ // --grid-drag-indicator defualt is "none"
|
|
147
147
|
"border-top: var(--grid-drag-indicator) !important;",
|
|
148
|
-
"border-right: var(--grid-drag-indicator);",
|
|
148
|
+
"border-right: var(--grid-drag-indicator) !important;", // need to set !important to overwrite the priority set by the last column which has the none border
|
|
149
149
|
"border-bottom: var(--grid-drag-indicator);",
|
|
150
150
|
"border-left: var(--grid-drag-indicator);"
|
|
151
151
|
],
|
|
@@ -157,7 +157,7 @@ DragUI.prototype.onThemeLoaded = function(colors) {
|
|
|
157
157
|
"background-color: unset;" // v3 fallback
|
|
158
158
|
]
|
|
159
159
|
];
|
|
160
|
-
|
|
160
|
+
let guidelineColor = "#ff9933";
|
|
161
161
|
if(colors.primary) {
|
|
162
162
|
guidelineColor = colors.primary;
|
|
163
163
|
}
|
|
@@ -189,22 +189,22 @@ DragUI.prototype.renderDragBox = function (e, grid) {
|
|
|
189
189
|
return false;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
let gridElem = grid.getElement();
|
|
193
|
+
let dragBoxHost = gridElem;
|
|
194
|
+
let gridParent = grid.getParent().parentNode;
|
|
195
195
|
if (gridParent.nodeType === 11) {
|
|
196
196
|
dragBoxHost = gridParent;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
|
|
199
|
+
let parent = this._dragBox.parentNode;
|
|
200
200
|
if(!parent) {
|
|
201
201
|
dragBoxHost.appendChild(this._dragBox);
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
|
|
204
|
+
let dragBoxIcon = e.dragBoxIcon || this._dragBox.dragBoxIcon; // The user-supplied icon
|
|
205
205
|
this._dragBoxIcon.style.visibility = "visible";
|
|
206
206
|
parent = this._dragBoxIcon.parentNode;
|
|
207
|
-
|
|
207
|
+
let drop = true;
|
|
208
208
|
if(dragBoxIcon === "insertion") {
|
|
209
209
|
drop = false;
|
|
210
210
|
this._dragBoxIcon.icon = "add";
|
|
@@ -221,10 +221,10 @@ DragUI.prototype.renderDragBox = function (e, grid) {
|
|
|
221
221
|
Dom.removeParent(this._dragBoxIcon);
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
|
|
224
|
+
let gridRect = gridElem.getBoundingClientRect();
|
|
225
225
|
|
|
226
|
-
|
|
227
|
-
|
|
226
|
+
let x = e.clientX - gridRect.left;
|
|
227
|
+
let y = e.pageY - gridRect.top;
|
|
228
228
|
|
|
229
229
|
// space for mouse cursor
|
|
230
230
|
this._dragBox.style.left = x - 5 + "px";
|
|
@@ -240,8 +240,8 @@ DragUI.prototype.setContent = function(content) {
|
|
|
240
240
|
content = content["getElement"]();
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
let dragBoxContent = this._dragBoxContent;
|
|
244
|
+
let currentContent = dragBoxContent._content;
|
|
245
245
|
if (content !== currentContent) {
|
|
246
246
|
dragBoxContent._content = content;
|
|
247
247
|
Dom.setContent(dragBoxContent, content);
|