@refinitiv-ui/efx-grid 6.0.40 → 6.0.41
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/column-selection-dialog/lib/column-selection-dialog.d.ts +2 -1
- package/lib/column-selection-dialog/lib/column-selection-dialog.js +23 -7
- package/lib/core/dist/core.js +25 -26
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +25 -26
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +2083 -1753
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.js +55 -7
- package/lib/rt-grid/es6/RowDefinition.d.ts +2 -2
- package/lib/rt-grid/es6/RowDefinition.js +37 -18
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +26 -40
- package/lib/tr-grid-util/es6/CellPainter.d.ts +2 -1
- package/lib/tr-grid-util/es6/CellPainter.js +6 -4
- package/lib/tr-grid-util/es6/ExpressionParser.d.ts +10 -0
- package/lib/tr-grid-util/es6/ExpressionParser.js +366 -0
- package/lib/tr-grid-util/es6/FilterBuilder.d.ts +10 -6
- package/lib/tr-grid-util/es6/FilterBuilder.js +264 -234
- package/lib/tr-grid-util/es6/FilterOperators.d.ts +3 -1
- package/lib/tr-grid-util/es6/FilterOperators.js +51 -2
- package/lib/tr-grid-util/es6/Util.d.ts +0 -3
- package/lib/tr-grid-util/es6/Util.js +0 -53
- package/lib/tr-grid-util/es6/formula/Formula.js +3 -3
- package/lib/types/es6/ColumnDragging.d.ts +51 -0
- package/lib/types/es6/ExtensionOptions.d.ts +2 -0
- package/lib/types/es6/Extensions.d.ts +3 -1
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -2
- package/lib/types/es6/index.d.ts +1 -0
- package/lib/versions.json +3 -3
- package/package.json +1 -1
@@ -81,7 +81,7 @@
|
|
81
81
|
/******/
|
82
82
|
/******/
|
83
83
|
/******/ // Load entry module and return exports
|
84
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
84
|
+
/******/ return __webpack_require__(__webpack_require__.s = 0);
|
85
85
|
/******/ })
|
86
86
|
/************************************************************************/
|
87
87
|
/******/ ([
|
@@ -89,670 +89,614 @@
|
|
89
89
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
90
90
|
|
91
91
|
"use strict";
|
92
|
-
|
93
|
-
|
94
|
-
* @namespace
|
95
|
-
* @example
|
96
|
-
* var BaseClass = function() {};
|
97
|
-
* BaseClass.prototype.method = function() {};
|
98
|
-
* BaseClass.prototype._member = 1;
|
99
|
-
* var DerivedClass = function() {};
|
100
|
-
* Ext.inherits(DerivedClass, BaseClass); // Derived class will have methods and members of the base class
|
101
|
-
* // To call base class method
|
102
|
-
* DeriveClass["base"](this, "methodName", ...params);
|
103
|
-
*/
|
104
|
-
var Ext = {};
|
105
|
-
|
106
|
-
/** @public
|
107
|
-
* @function
|
108
|
-
* @param {Function} childCtor
|
109
|
-
* @param {Function} parentCtor
|
110
|
-
*/
|
111
|
-
Ext.inherits = function (childCtor, parentCtor) {
|
112
|
-
/** @constructor
|
113
|
-
* @ignore
|
114
|
-
*/
|
115
|
-
function tempCtor() { }
|
116
|
-
tempCtor.prototype = parentCtor.prototype;
|
117
|
-
childCtor.prototype = new tempCtor();
|
118
|
-
childCtor.prototype.constructor = childCtor;
|
119
|
-
|
120
|
-
/** Calls superclass constructor/method. <br>
|
121
|
-
* This function is only available if you use goog.inherits to <br>
|
122
|
-
* express inheritance relationships between classes. <br>
|
123
|
-
* NOTE: This is a replacement for goog.base and for superClass_ <br>
|
124
|
-
* property defined in childCtor.
|
125
|
-
* @param {!Object} me Should always be "this".
|
126
|
-
* @param {(string|null)=} methodName The method name to call. Calling superclass constructor can be done with the special string 'constructor'.
|
127
|
-
* @param {...*} var_args The arguments to pass to superclass <br>
|
128
|
-
* method/constructor.
|
129
|
-
* @return {*} The return value of the superclass method/constructor.
|
130
|
-
*/
|
131
|
-
childCtor["base"] = function(me, methodName, var_args) {
|
132
|
-
if(!methodName) { methodName = 'constructor'; }
|
133
|
-
// Copying using loop to avoid deop due to passing arguments object to function. This is faster in many JS engines as of late 2014.
|
134
|
-
var len = arguments.length;
|
135
|
-
var args = new Array(len); // http://jsperf.com/creating-an-array
|
136
|
-
for (var i = 2; i < len; i++) {
|
137
|
-
args[i - 2] = arguments[i];
|
138
|
-
}
|
139
|
-
return parentCtor.prototype[methodName].apply(me, args);
|
140
|
-
};
|
141
|
-
};
|
142
|
-
|
143
|
-
/* harmony default export */ __webpack_exports__["b"] = (Ext);
|
144
|
-
|
145
|
-
|
92
|
+
// ESM COMPAT FLAG
|
93
|
+
__webpack_require__.r(__webpack_exports__);
|
146
94
|
|
147
|
-
|
148
|
-
/*
|
149
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
95
|
+
// EXPORTS
|
96
|
+
__webpack_require__.d(__webpack_exports__, "Grid", function() { return /* reexport */ Grid; });
|
150
97
|
|
151
|
-
|
152
|
-
/* unused harmony export Util */
|
153
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return extendObject; });
|
154
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return cloneObject; });
|
155
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isEmptyObject; });
|
156
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return deepEqual; });
|
157
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return arrayToObject; });
|
158
|
-
/* unused harmony export extendProperty */
|
159
|
-
/* unused harmony export extendArrayProperty */
|
160
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return parseCondition; });
|
161
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return prettifyCss; });
|
162
|
-
/* unused harmony export getShadowRoot */
|
163
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return injectCss; });
|
164
|
-
/* unused harmony export isIE */
|
165
|
-
/* unused harmony export isMac */
|
166
|
-
/* unused harmony export isTouchDevice */
|
167
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return nestedObjectToArray; });
|
168
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return rgb2Hex; });
|
169
|
-
/* unused harmony export prepareTSVContent */
|
98
|
+
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/Dom.js
|
170
99
|
/** @namespace */
|
171
|
-
var
|
100
|
+
var Dom = {};
|
172
101
|
|
173
|
-
/**
|
174
|
-
* WARNING: fetch is not supported in IE (including IE11)
|
102
|
+
/** Shorthand for creating an element with class
|
175
103
|
* @public
|
176
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch}
|
177
104
|
* @function
|
178
|
-
* @param {string}
|
179
|
-
* @param {
|
180
|
-
* @return {!
|
105
|
+
* @param {string} tagName
|
106
|
+
* @param {string=} className
|
107
|
+
* @return {!Element}
|
181
108
|
*/
|
182
|
-
|
183
|
-
|
109
|
+
Dom.create = function(tagName, className) {
|
110
|
+
var elem = document.createElement(tagName);
|
111
|
+
if(className) {
|
112
|
+
elem.className = className;
|
113
|
+
}
|
114
|
+
return elem;
|
184
115
|
};
|
185
|
-
/**
|
186
|
-
* WARNING: fetch is not supported in IE (including IE11)
|
116
|
+
/** Shorthand for creating a div element with class
|
187
117
|
* @public
|
188
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch}
|
189
118
|
* @function
|
190
|
-
* @param {string}
|
191
|
-
* @
|
192
|
-
* @return {!Promise<Response>}
|
119
|
+
* @param {string=} className
|
120
|
+
* @return {!Element}
|
193
121
|
*/
|
194
|
-
|
195
|
-
return
|
122
|
+
Dom.div = function(className) {
|
123
|
+
return Dom.create("div", className);
|
196
124
|
};
|
197
|
-
/**
|
198
|
-
* WARNING: fetch is not supported in IE (including IE11)
|
125
|
+
/** Shorthand for creating a span element with textContent
|
199
126
|
* @public
|
200
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch}
|
201
127
|
* @function
|
202
|
-
* @param {string}
|
203
|
-
* @param {string}
|
204
|
-
* @return {!
|
128
|
+
* @param {string=} textContent
|
129
|
+
* @param {string=} className
|
130
|
+
* @return {!Element}
|
205
131
|
*/
|
206
|
-
|
207
|
-
|
132
|
+
Dom.text = function(textContent, className) {
|
133
|
+
var elem = Dom.create("span", className);
|
134
|
+
if(textContent || textContent === 0) {
|
135
|
+
elem.textContent = textContent;
|
136
|
+
}
|
137
|
+
return elem;
|
208
138
|
};
|
209
139
|
|
210
|
-
/**
|
140
|
+
/** Shorthand for appending multiple children
|
141
|
+
* @public
|
211
142
|
* @function
|
212
|
-
* @param {
|
213
|
-
* @
|
143
|
+
* @param {Element} parentElem
|
144
|
+
* @param {...Node|Array} children
|
145
|
+
* @return {Element} Parent element
|
214
146
|
*/
|
215
|
-
|
216
|
-
if(
|
217
|
-
return
|
147
|
+
Dom.appendChild = function(parentElem, children) {
|
148
|
+
if(!parentElem) {
|
149
|
+
return null;
|
218
150
|
}
|
219
|
-
|
151
|
+
var i, ary;
|
152
|
+
if(Array.isArray(arguments[1])) {
|
153
|
+
ary = arguments[1];
|
154
|
+
i = 0;
|
155
|
+
} else {
|
156
|
+
ary = arguments;
|
157
|
+
i = 1;
|
158
|
+
}
|
159
|
+
var len = ary.length;
|
160
|
+
while(i < len) {
|
161
|
+
parentElem.appendChild(ary[i]);
|
162
|
+
++i;
|
163
|
+
}
|
164
|
+
return parentElem;
|
220
165
|
};
|
221
|
-
/**
|
166
|
+
/** Shorthand for appending multiple children in a tree like manner
|
167
|
+
* @public
|
222
168
|
* @function
|
223
|
-
* @param {
|
224
|
-
* @
|
169
|
+
* @param {Element} parentElem
|
170
|
+
* @param {...Node|Array} children The first child from the given array will be treated as a parent of all subsequence items.
|
171
|
+
* @return {Element} Parent element
|
172
|
+
* @example
|
173
|
+
* Dom.buildTree(p1,
|
174
|
+
* ch1,
|
175
|
+
* ch2,
|
176
|
+
* [ch3_p1,
|
177
|
+
* ch3_ch1,
|
178
|
+
* ch3_ch2
|
179
|
+
* ]
|
180
|
+
* );
|
225
181
|
*/
|
226
|
-
|
227
|
-
if(
|
228
|
-
return
|
182
|
+
Dom.buildTree = function(parentElem, children) {
|
183
|
+
if(!parentElem) {
|
184
|
+
return null;
|
229
185
|
}
|
230
|
-
|
186
|
+
var args = arguments;
|
187
|
+
var len = args.length;
|
188
|
+
for(var i = 1; i < len; ++i) {
|
189
|
+
var child = args[i];
|
190
|
+
if(child) {
|
191
|
+
var childElem;
|
192
|
+
if(Array.isArray(child)) {
|
193
|
+
childElem = Dom.buildTree.apply(null, child);
|
194
|
+
} else if(child.nodeType === 1) {
|
195
|
+
childElem = /** @type{Element} */(child);
|
196
|
+
}
|
197
|
+
if(childElem) {
|
198
|
+
parentElem.appendChild(childElem);
|
199
|
+
}
|
200
|
+
}
|
201
|
+
}
|
202
|
+
return parentElem;
|
231
203
|
};
|
232
|
-
|
233
|
-
/** @private
|
234
|
-
* @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}
|
204
|
+
/** Put the given element out of the document
|
235
205
|
* @function
|
236
|
-
* @param {
|
237
|
-
* @return {
|
206
|
+
* @param {Node|Element} child
|
207
|
+
* @return {Element} Parent Element
|
238
208
|
*/
|
239
|
-
|
240
|
-
if(
|
241
|
-
|
242
|
-
|
209
|
+
Dom.removeParent = function (child) {
|
210
|
+
if(!child) { return null; }
|
211
|
+
var parent = child.parentNode;
|
212
|
+
if(parent) {
|
213
|
+
parent.removeChild(child);
|
243
214
|
}
|
244
|
-
return
|
215
|
+
return parent;
|
245
216
|
};
|
246
|
-
/**
|
217
|
+
/** Safely set parent for the specified child element
|
247
218
|
* @function
|
248
|
-
* @param {
|
249
|
-
* @param {
|
250
|
-
* @
|
251
|
-
* @return {!Promise<Response>}
|
219
|
+
* @param {Node|Element} child
|
220
|
+
* @param {Node|Element} parent
|
221
|
+
* @return {Element} Parent Element
|
252
222
|
*/
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
223
|
+
Dom.setParent = function (child, parent) {
|
224
|
+
if(!child) { return null; }
|
225
|
+
if(parent) {
|
226
|
+
parent.appendChild(child);
|
227
|
+
return parent;
|
228
|
+
} else {
|
229
|
+
return Dom.removeParent(child);
|
260
230
|
}
|
261
|
-
|
262
|
-
return fetch(url, options);
|
263
231
|
};
|
264
|
-
|
265
|
-
/** WARNING: Only one level of property tree is affected (i.e. no recursive or nested operation). <br>
|
266
|
-
* Property with undefined or null value will not have an impact on the object. <br>
|
267
|
-
* Existing properties will be overridden.
|
268
|
-
* @public
|
232
|
+
/** Remove all child nodes
|
269
233
|
* @function
|
270
|
-
* @param {
|
271
|
-
* @param {
|
272
|
-
* @param {Array.<string>=} limiters Specify property to be extended
|
273
|
-
* @return {Object}
|
234
|
+
* @param {Node|Element} elem
|
235
|
+
* @param {number=} count
|
274
236
|
*/
|
275
|
-
|
276
|
-
if(
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
return obj;
|
281
|
-
}
|
282
|
-
|
283
|
-
var key;
|
284
|
-
if(limiters) {
|
285
|
-
var len = limiters.length;
|
286
|
-
for(var i = 0; i < len; ++i) {
|
287
|
-
key = limiters[i];
|
288
|
-
if(key) {
|
289
|
-
extendProperty(obj, extender, key);
|
290
|
-
}
|
237
|
+
Dom.removeChildren = function (elem, count) {
|
238
|
+
if(elem) {
|
239
|
+
var childCount = elem.childNodes.length;
|
240
|
+
if(count == null || count > childCount) {
|
241
|
+
count = childCount;
|
291
242
|
}
|
292
|
-
|
293
|
-
|
294
|
-
extendProperty(obj, extender, key);
|
243
|
+
while(--count >= 0) {
|
244
|
+
elem.removeChild(elem.lastChild);
|
295
245
|
}
|
296
246
|
}
|
297
|
-
return obj;
|
298
|
-
};
|
299
|
-
/** WARNING: Only one level of property tree is affected (i.e. no recursive or nested operation). <br>
|
300
|
-
* Property with undefined or null value will not be cloned.
|
301
|
-
* @public
|
302
|
-
* @function
|
303
|
-
* @param {Object} obj
|
304
|
-
* @param {Array.<string>=} limiters
|
305
|
-
* @return {Object}
|
306
|
-
*/
|
307
|
-
var cloneObject = function (obj, limiters) {
|
308
|
-
return extendObject({}, obj, limiters);
|
309
247
|
};
|
310
|
-
|
311
|
-
/** Check empty object
|
248
|
+
/** Ensure that element will contain only the given nodes (all other existing nodes are removed).
|
312
249
|
* @public
|
313
250
|
* @function
|
314
|
-
* @param {
|
315
|
-
* @
|
251
|
+
* @param {Element} elem
|
252
|
+
* @param {*} val Element, Node, string, number, or everything else.
|
316
253
|
*/
|
317
|
-
|
318
|
-
|
319
|
-
|
254
|
+
Dom.setContent = function(elem, val) {
|
255
|
+
if(elem) {
|
256
|
+
if(val || val === 0) {
|
257
|
+
var nt = val.nodeType;
|
258
|
+
if(nt === 1 || nt === 3) {
|
259
|
+
if(val !== elem.lastChild) {
|
260
|
+
Dom.removeChildren(elem);
|
261
|
+
elem.appendChild(/** @type{Node} */(val));
|
262
|
+
}
|
263
|
+
} else if(Array.isArray(val)) {
|
264
|
+
Dom.removeChildren(elem); // Could be slow, if duplicates are given
|
265
|
+
Dom.appendChild(elem, val);
|
266
|
+
} else {
|
267
|
+
elem.textContent = val; // Implicit text conversion
|
268
|
+
}
|
269
|
+
} else {
|
270
|
+
Dom.removeChildren(elem);
|
271
|
+
}
|
320
272
|
}
|
321
|
-
return true;
|
322
273
|
};
|
323
274
|
|
324
|
-
/**
|
325
|
-
* @
|
326
|
-
* @param {
|
327
|
-
* @
|
275
|
+
/** A quick way to toggle attribute on and off.
|
276
|
+
* @function
|
277
|
+
* @param {Element} elem
|
278
|
+
* @param {string} attr Attribute name (e.g. disabled, readonly, style, class)
|
279
|
+
* @param {*=} bool Truthy or falsy value. If specified, this method is equivalent to setter method.
|
328
280
|
*/
|
329
|
-
|
330
|
-
if(
|
331
|
-
|
332
|
-
} else if(
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
var len = ary.length;
|
338
|
-
for(var i = 0; i < len; ++i) {
|
339
|
-
var field = fields[i];
|
340
|
-
// eslint-disable-next-line no-undefined
|
341
|
-
if(field && ary[i] !== undefined) {
|
342
|
-
data[field] = ary[i];
|
281
|
+
Dom.toggleAttribute = function (elem, attr, bool) {
|
282
|
+
if(bool) {
|
283
|
+
elem.setAttribute(attr, (typeof bool === "string") ? bool : "");
|
284
|
+
} else if(bool == null) {
|
285
|
+
if(elem.hasAttribute(attr)) {
|
286
|
+
elem.removeAttribute(attr);
|
287
|
+
} else {
|
288
|
+
elem.setAttribute(attr, "");
|
343
289
|
}
|
290
|
+
} else {
|
291
|
+
elem.removeAttribute(attr);
|
344
292
|
}
|
345
|
-
return data;
|
346
293
|
};
|
347
|
-
/**
|
348
|
-
* @
|
294
|
+
/** A quick way to toggle class on and off. Note that this is a replacement for classList.toggle() as IE10 doesn't support it.
|
295
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList}
|
349
296
|
* @function
|
350
|
-
* @param {
|
351
|
-
* @param {
|
352
|
-
* @param {
|
353
|
-
* @example
|
354
|
-
* extendProperty({a: 0}, {a: 1}, "a"); // {a: 1}
|
355
|
-
* extendProperty({a: 0}, {b: 1}, "b"); // {a: 0, b: 1}
|
356
|
-
* extendProperty({a: [0]}, {a: 1}, "a"); // {a: [0, 1]}
|
357
|
-
* extendProperty({a: [0]}, {a: [1, 2]}, "a"); // {a: [0, 1, 2]}
|
297
|
+
* @param {Element} elem
|
298
|
+
* @param {string} classStr Non space class name
|
299
|
+
* @param {*=} bool Truthy or falsy value. If specified, this method is equivalent to setter method.
|
358
300
|
*/
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
if(
|
364
|
-
|
365
|
-
} else if(Array.isArray(val) && objVal) {
|
366
|
-
obj[propName] = val.concat(objVal); // TODO: Preserve the order
|
301
|
+
Dom.toggleClass = function (elem, classStr, bool) {
|
302
|
+
if(bool) {
|
303
|
+
elem.classList.add(classStr);
|
304
|
+
} else if(bool == null) {
|
305
|
+
if(elem.classList.contains(classStr)) {
|
306
|
+
elem.classList.remove(classStr);
|
367
307
|
} else {
|
368
|
-
|
308
|
+
elem.classList.add(classStr);
|
369
309
|
}
|
310
|
+
} else {
|
311
|
+
elem.classList.remove(classStr);
|
370
312
|
}
|
371
313
|
};
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
* @
|
376
|
-
* @
|
377
|
-
* @param {*} obj2
|
378
|
-
* @return {boolean}
|
314
|
+
/** A quick way to add multiple classes without altering existing classes in the element. This does not necessarily mean that this method has high performance.
|
315
|
+
* @function
|
316
|
+
* @param {Element} elem
|
317
|
+
* @param {...string} classes CSS Class names without any space in the name. Array can be given as well
|
318
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList}
|
379
319
|
*/
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
}
|
389
|
-
|
390
|
-
if (typeof obj1 === "object") {
|
391
|
-
|
392
|
-
// We need to split array and object for performance reason
|
393
|
-
if(Array.isArray(obj1)) {
|
394
|
-
if(obj1.length !== obj2.length) {
|
395
|
-
return false;
|
396
|
-
}
|
397
|
-
|
398
|
-
for (var i = 0; i < obj1.length; i++) {
|
399
|
-
if (!deepEqual(obj1[i], obj2[i])) { // The array may not be a match if the elements are not sorted, so it will not be considered equal if there is a mismatch.
|
400
|
-
return false;
|
401
|
-
}
|
402
|
-
}
|
403
|
-
|
404
|
-
} else {
|
405
|
-
|
406
|
-
if (Object.keys(obj1).length !== Object.keys(obj2).length) {
|
407
|
-
return false;
|
408
|
-
}
|
409
|
-
|
410
|
-
for (var key in obj1) {
|
411
|
-
if (!deepEqual(obj1[key], obj2[key])) {
|
412
|
-
return false;
|
413
|
-
}
|
320
|
+
Dom.addClasses = function (elem, classes) {
|
321
|
+
if(elem) {
|
322
|
+
var ary = Array.isArray(classes) ? classes : arguments;
|
323
|
+
var len = ary.length;
|
324
|
+
for(var i = 0; i < len; ++i) {
|
325
|
+
var str = ary[i];
|
326
|
+
if(str && typeof str == "string") {
|
327
|
+
elem.classList.add(str);
|
414
328
|
}
|
415
329
|
}
|
416
|
-
|
417
|
-
|
418
|
-
return true;
|
419
330
|
}
|
420
|
-
|
421
|
-
return false;
|
422
|
-
|
423
331
|
};
|
424
|
-
/**
|
425
|
-
* This method excels in extending known array property in an object.
|
426
|
-
* @public
|
332
|
+
/** A quick way to remove multiple classes without altering unrelated classes in the element. This does not necessarily mean that this method has high performance.
|
427
333
|
* @function
|
428
|
-
* @param {
|
429
|
-
* @param {string}
|
430
|
-
* @
|
431
|
-
* @return {Array} Returns the result of the extended array
|
432
|
-
* @see {@link https://dev.to/uilicious/javascript-array-push-is-945x-faster-than-array-concat-1oki}
|
433
|
-
* @example
|
434
|
-
* var obj = {};
|
435
|
-
* extendArrayProperty(obj, "prop1", 1); // [1]
|
436
|
-
* extendArrayProperty(obj, "prop1", 2); // [1, 2]
|
437
|
-
* extendArrayProperty(obj, "prop1", [3, 4]); // [1, 2, 3, 4]
|
438
|
-
* obj.prop2 = 5;
|
439
|
-
* extendArrayProperty(obj, "prop2", 6); // [5, 6]
|
440
|
-
* extendArrayProperty(obj, "prop2", [7]); // [5, 6, 7]
|
441
|
-
* extendArrayProperty(obj, "prop2", null); // null
|
334
|
+
* @param {Element} elem
|
335
|
+
* @param {...string} classes CSS Class names without any space in the name. Array can be given as well
|
336
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList}
|
442
337
|
*/
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
var
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
objAry = obj[propName] = [objVal];
|
452
|
-
}
|
453
|
-
} else {
|
454
|
-
objAry = obj[propName] = [];
|
455
|
-
}
|
456
|
-
// objAry is guaranteed to be an array at this point
|
457
|
-
|
458
|
-
if(Array.isArray(ary)) {
|
459
|
-
if(ary.length) {
|
460
|
-
if(ary.length > 1) {
|
461
|
-
Array.prototype.push.apply(objAry, ary);
|
462
|
-
} else {
|
463
|
-
objAry.push(ary[0]);
|
464
|
-
}
|
338
|
+
Dom.removeClasses = function (elem, classes) {
|
339
|
+
if(elem) {
|
340
|
+
var ary = Array.isArray(classes) ? classes : arguments;
|
341
|
+
var len = ary.length;
|
342
|
+
for(var i = 0; i < len; ++i) {
|
343
|
+
var str = ary[i];
|
344
|
+
if(str && typeof str == "string") {
|
345
|
+
elem.classList.remove(str);
|
465
346
|
}
|
466
|
-
} else {
|
467
|
-
objAry.push(ary);
|
468
347
|
}
|
469
348
|
}
|
470
|
-
return objAry;
|
471
349
|
};
|
472
350
|
|
473
|
-
|
474
|
-
|
475
|
-
* @
|
476
|
-
* @private
|
477
|
-
* @const
|
351
|
+
/** @public
|
352
|
+
* @function
|
353
|
+
* @param {Event} e
|
478
354
|
*/
|
479
|
-
|
355
|
+
Dom.preventDefault = function(e) {
|
356
|
+
e.preventDefault();
|
357
|
+
e.stopPropagation();
|
358
|
+
};
|
480
359
|
/** @public
|
481
360
|
* @function
|
482
|
-
* @param {
|
483
|
-
* @return {Function}
|
484
|
-
* @example
|
485
|
-
* var fn = parseCondition("[CF_BID] >= 10 && [CF_BID] <= 100");
|
486
|
-
* window.console.log(fn(25));
|
361
|
+
* @param {Event} e
|
487
362
|
*/
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
}
|
492
|
-
if(typeof expression !== "string") {
|
493
|
-
return (typeof expression == "function") ? /** @type {Function} */(expression) : null;
|
494
|
-
}
|
495
|
-
|
496
|
-
var brackets = expression.match(_bracketExp); // Retrieving field tokens (anything in between brackets)
|
497
|
-
var map = {}; // For checking duplication
|
498
|
-
var fields = [];
|
499
|
-
var len = brackets ? brackets.length : 0;
|
500
|
-
for(var i = len; --i >= 0;) {
|
501
|
-
var field = brackets[i];
|
502
|
-
if(!map[field]) {
|
503
|
-
map[field] = "f[" + fields.length + "]"; // Create mapping of field token to array with index E.g. { "[CF_BID]": "f[0]" }
|
504
|
-
fields.push(field.substring(1, field.length - 1)); // Strip '[' and ']' of field token to get field name
|
505
|
-
}
|
506
|
-
}
|
363
|
+
Dom.stopPropagation = function(e) {
|
364
|
+
e.stopPropagation();
|
365
|
+
};
|
507
366
|
|
508
|
-
// Replace the field tokens with rowData of array with index E.g. [CF_BID] ==> rowData[f[0]]
|
509
|
-
expression = expression.replace(_bracketExp, function(match) {
|
510
|
-
return "rowData[" + map[match] + "]";
|
511
|
-
});
|
512
|
-
var finalExp = "(function(f, rowData) { return (" + expression + "); })";
|
513
367
|
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
368
|
+
/** Get client prosition from the given target. Supports only for modern browser (Gecko 1.9+, modern Webkit)
|
369
|
+
* @public
|
370
|
+
* @function
|
371
|
+
* @param {!Element|Event|MouseEvent} target
|
372
|
+
* @param {*=} retObj An object that stores returned values
|
373
|
+
* @return {!Object} Return object with property x and y
|
374
|
+
*/
|
375
|
+
Dom.getClientPosition = function(target, retObj) {
|
376
|
+
var pos = retObj || {"x": 0, "y": 0};
|
377
|
+
if(target["getBoundingClientRect"]){
|
378
|
+
var box = target["getBoundingClientRect"]();
|
379
|
+
pos["x"] = box.left;
|
380
|
+
pos["y"] = box.top;
|
381
|
+
} else { //Event
|
382
|
+
pos["x"] = target.clientX;
|
383
|
+
pos["y"] = target.clientY;
|
520
384
|
}
|
521
|
-
return (fn) ? fn : null;
|
522
|
-
};
|
523
385
|
|
524
|
-
|
525
|
-
/** @private
|
526
|
-
* @param {string|Array.<string>} item
|
527
|
-
* @return {string}
|
528
|
-
*/
|
529
|
-
var _encloseBracket = function(item) {
|
530
|
-
return Array.isArray(item) ? "{\n" + item.join("\n") + "\n}" : item;
|
531
|
-
};
|
532
|
-
/** @private
|
533
|
-
* @param {string} str
|
534
|
-
* @return {string}
|
535
|
-
*/
|
536
|
-
var _indentBracketContent = function(str){
|
537
|
-
return str.replace(/\n+/g, "\n\t").replace(/\n\t}$/, "\n}");
|
386
|
+
return /**@type {!Object} */(pos);
|
538
387
|
};
|
539
|
-
/**
|
540
|
-
*
|
541
|
-
*
|
388
|
+
/** Get position of A element that is relative to the B element. <br>
|
389
|
+
* Top-left of B is used as registration a point (0, 0) for x and y. <br>
|
390
|
+
* For example, if A is located to right of B, "x" will be positive, If A is located below B, "y" will be positive.
|
391
|
+
* @public
|
392
|
+
* @function
|
393
|
+
* @param {!Element|Event|MouseEvent} A HTMLElement, Browser's event, or mouse event object
|
394
|
+
* @param {!Element|Event|MouseEvent} B HTMLElement, Browser's event, or mouse event object
|
395
|
+
* @param {*=} retObj An object that stores returned values
|
396
|
+
* @return {!Object} an object with "x" and "y" values
|
542
397
|
* @example
|
543
|
-
*
|
544
|
-
* "color: red;",
|
545
|
-
* "padding: 20px;"
|
546
|
-
* ],
|
547
|
-
* ".class", [
|
548
|
-
* "margin: 0;"
|
549
|
-
* ]
|
550
|
-
* ]);
|
398
|
+
* Dom.getRelativePosition(popupA, document.body); // Get position of popupA that is relative to the document body
|
551
399
|
*/
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
if (Array.isArray(css)) {
|
556
|
-
var ary = css.map(_encloseBracket);
|
557
|
-
cssStr = ary.join("\n").replace(/{\s*{/g, "{").replace(/\s+{/g, " {");
|
558
|
-
} else {
|
559
|
-
cssStr = (typeof css === "string") ? css : css + "";
|
560
|
-
}
|
400
|
+
Dom.getRelativePosition = function(A, B, retObj) {
|
401
|
+
retObj = Dom.getClientPosition(A, retObj);
|
402
|
+
var bp = Dom.getClientPosition(B);
|
561
403
|
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
}
|
566
|
-
return "";
|
404
|
+
retObj["x"] -= bp["x"];
|
405
|
+
retObj["y"] -= bp["y"];
|
406
|
+
return /**@type {!Object} */(retObj);
|
567
407
|
};
|
568
|
-
/**
|
408
|
+
/** The method returns closest ancestor element or the element itself with specified class string. Otherwise, it returns null
|
569
409
|
* @public
|
570
|
-
* @
|
571
|
-
* @
|
410
|
+
* @function
|
411
|
+
* @param {Element|Node|undefined} elem
|
412
|
+
* @param {string} classStr The class string can only be one single class without spaces
|
413
|
+
* @return {Element}
|
572
414
|
*/
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
if(
|
577
|
-
|
578
|
-
|
579
|
-
rootNode = elem.getRootNode();
|
580
|
-
}
|
581
|
-
if(rootNode) { // getRootNode does not supported in IE. It should be implemented by the polyfills
|
582
|
-
if(rootNode !== document) { // element that is in the DOM and not in the shadow has document as its root node
|
583
|
-
if(rootNode !== elem) { // element that is NOT in the DOM and not in the shadow has itself as its root node
|
584
|
-
return rootNode;
|
585
|
-
}
|
415
|
+
Dom.closestElement = function(elem, classStr) {
|
416
|
+
var n = elem;
|
417
|
+
while (n) {
|
418
|
+
if(n.classList) { // DocumentFragment does not have classList property
|
419
|
+
if (n.classList.contains(classStr)) {
|
420
|
+
return /** @type{Element} */(n);
|
586
421
|
}
|
587
422
|
}
|
423
|
+
n = n.parentNode || n.host; // ShadowRoot has host, but not parentNode
|
588
424
|
}
|
589
425
|
return null;
|
590
426
|
};
|
591
|
-
/**
|
427
|
+
/** The method returns closest ancestor element or the element itself with the specified tagName. Otherwise, it returns null
|
592
428
|
* @public
|
593
|
-
* @
|
594
|
-
* @param {Element
|
595
|
-
* @
|
429
|
+
* @function
|
430
|
+
* @param {Element|Node|undefined} elem
|
431
|
+
* @param {string} tn Tag name in uppercase format (e.g. "DIV")
|
432
|
+
* @return {Element}
|
596
433
|
*/
|
597
|
-
|
598
|
-
|
599
|
-
|
434
|
+
Dom.closestTagName = function(elem, tn) {
|
435
|
+
var n = elem;
|
436
|
+
while(n) {
|
437
|
+
if(n.tagName) {
|
438
|
+
if(n.tagName == tn) {
|
439
|
+
return /** @type{Element} */(n);
|
440
|
+
}
|
441
|
+
}
|
442
|
+
n = n.parentNode || n.host; // ShadowRoot has host, but not parentNode
|
600
443
|
}
|
444
|
+
return null;
|
445
|
+
};
|
601
446
|
|
602
|
-
|
603
|
-
styleTag.textContent = "\n" + cssStr + "\n";
|
447
|
+
/* harmony default export */ var es6_Dom = (Dom);
|
604
448
|
|
605
|
-
var styleHost = getShadowRoot(targetContext);
|
606
|
-
var isInShadow = true;
|
607
|
-
if(!styleHost) {
|
608
|
-
isInShadow = false;
|
609
|
-
styleHost = document.head;
|
610
|
-
}
|
611
449
|
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
450
|
+
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/Conflator.js
|
451
|
+
/** Conflator is used to stop multiple executions of a function in the specified period of time by merging multiple calls into one single call. <br>
|
452
|
+
* Conflator guarantees that only one single call will be executed.
|
453
|
+
* @constructor
|
454
|
+
* @param {(Function|number)=} func Bound function that will use this conflator
|
455
|
+
* @param {(number|Function)=} ms The delay time in millisecond before executing the function
|
456
|
+
* @param {*=} thisObj "this" object to be bound with the given function. If the function is already bound, there is no need to provide thisObj parameter
|
457
|
+
* @example
|
458
|
+
* var c = new Conflator(function() { console.log("Executed"); }, 1000);
|
459
|
+
* for(var i = 10; --i >= 0;) {
|
460
|
+
* c.conflate(i); // Only one "Executed" text will be logged to console after one second
|
461
|
+
* }
|
462
|
+
*/
|
463
|
+
var Conflator = function (func, ms, thisObj) {
|
464
|
+
this._onConflated = this._onConflated.bind(this);
|
465
|
+
|
466
|
+
this._data = [];
|
467
|
+
|
468
|
+
if(typeof func == "function") {
|
469
|
+
this.setFunction(func, thisObj);
|
470
|
+
} else if (typeof ms == "function") { // Parameter can be swapped places
|
471
|
+
this.setFunction(ms, thisObj);
|
618
472
|
}
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
473
|
+
|
474
|
+
if(typeof ms == "number") {
|
475
|
+
this.setConflatingTime(ms);
|
476
|
+
} else if (typeof func == "number") { // Parameter can be swapped places
|
477
|
+
this.setConflatingTime(func);
|
623
478
|
}
|
624
|
-
return styleTag;
|
625
479
|
};
|
626
480
|
|
627
|
-
/**
|
628
|
-
* @
|
629
|
-
* @return {boolean}
|
481
|
+
/** @type {!Array}
|
482
|
+
* @private
|
630
483
|
*/
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
};
|
635
|
-
|
636
|
-
/** return true if device is mac
|
637
|
-
* @public
|
638
|
-
* @return {boolean}
|
484
|
+
Conflator.prototype._data; // Array to store all conflated data
|
485
|
+
/** @type {Function}
|
486
|
+
* @private
|
639
487
|
*/
|
640
|
-
|
641
|
-
|
642
|
-
|
488
|
+
Conflator.prototype._func = null;
|
489
|
+
/** @type {number}
|
490
|
+
* @private
|
491
|
+
*/
|
492
|
+
Conflator.prototype._delay = 0;
|
493
|
+
/** @type {number}
|
494
|
+
* @private
|
495
|
+
*/
|
496
|
+
Conflator.prototype._timerId = 0;
|
497
|
+
/** @type {boolean}
|
498
|
+
* @private
|
499
|
+
*/
|
500
|
+
Conflator.prototype._conflated = false;
|
501
|
+
/** @type {boolean}
|
502
|
+
* @private
|
503
|
+
*/
|
504
|
+
Conflator.prototype._disabled = false;
|
643
505
|
|
644
|
-
|
506
|
+
|
507
|
+
/** Any existing timer and stored data will be cleared.
|
645
508
|
* @public
|
646
|
-
* @return {
|
509
|
+
* @return {Array} All stored data. Return null if there is no data
|
647
510
|
*/
|
648
|
-
|
649
|
-
if
|
650
|
-
(
|
651
|
-
|
511
|
+
Conflator.prototype.reset = function () {
|
512
|
+
if(this._timerId) {
|
513
|
+
clearTimeout(this._timerId);
|
514
|
+
this._timerId = 0;
|
652
515
|
}
|
653
|
-
return false;
|
654
|
-
};
|
655
516
|
|
656
|
-
|
517
|
+
return this.popAllData();
|
518
|
+
};
|
519
|
+
/** All stored data will be cleared
|
657
520
|
* @public
|
658
|
-
* @
|
659
|
-
* @param {Array=} ary
|
660
|
-
* @return {Array}
|
521
|
+
* @return {Array} All stored data. Return null if there is no data
|
661
522
|
*/
|
662
|
-
|
663
|
-
if
|
664
|
-
|
523
|
+
Conflator.prototype.popAllData = function() {
|
524
|
+
if(this._data.length) {
|
525
|
+
var data = this._data;
|
526
|
+
this._data = [];
|
527
|
+
return data;
|
665
528
|
}
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
529
|
+
return null;
|
530
|
+
};
|
531
|
+
/** @public */
|
532
|
+
Conflator.prototype.dispose = function () {
|
533
|
+
if(this._timerId) {
|
534
|
+
clearTimeout(this._timerId);
|
535
|
+
this._timerId = 0;
|
673
536
|
}
|
674
|
-
|
537
|
+
if(this._data.length) {
|
538
|
+
this._data.length = 0;
|
539
|
+
}
|
540
|
+
this._func = null; // Release user bound function
|
675
541
|
};
|
676
542
|
|
677
|
-
/**
|
678
|
-
* @
|
679
|
-
* @
|
680
|
-
* @return {string}
|
681
|
-
* @example
|
682
|
-
* rgb2Hex("rgb(255, 255, 0)"); // "#FFFF00"
|
683
|
-
* rgb2Hex("rgba(255, 255, 0, 1)"); // "#FFFF00"
|
684
|
-
* rgb2Hex("255 255.0"); // "#FFFF00"
|
685
|
-
* rgb2Hex("#FFFF00"); // "#FFFF00"
|
686
|
-
* rgb2Hex("#1a1a1a"); // "#1a1a1a"
|
687
|
-
* rgb2Hex("2552550"); // "2552550"
|
688
|
-
* rgb2Hex("invalid"); // "invalid"
|
689
|
-
* rgb2Hex(null); // ""
|
543
|
+
/** @public
|
544
|
+
* @param {*=} obj Any data that is needed to be stored for later usage
|
545
|
+
* @return {boolean}
|
690
546
|
*/
|
691
|
-
|
692
|
-
if(
|
693
|
-
return
|
547
|
+
Conflator.prototype.conflate = function (obj) {
|
548
|
+
if(this._disabled) {
|
549
|
+
return false;
|
694
550
|
}
|
695
|
-
if(
|
696
|
-
|
551
|
+
if(obj != null) {
|
552
|
+
this._data.push(obj);
|
697
553
|
}
|
698
|
-
|
699
|
-
|
700
|
-
return rgbCode;
|
554
|
+
if(this._conflated) {
|
555
|
+
return false; // Conflating operation is already completed
|
701
556
|
}
|
702
|
-
|
703
|
-
|
704
|
-
for(var i = 0; i < 3; i++) {
|
705
|
-
var num = +rgb[i];
|
706
|
-
if(!(num >= 16)) { // Handle NaN case
|
707
|
-
hex += "0";
|
708
|
-
}
|
709
|
-
hex += (num) ? num.toString(16).toUpperCase() : "0";
|
557
|
+
if(!this._timerId) {
|
558
|
+
this._timerId = setTimeout(this._onConflated, this._delay);
|
710
559
|
}
|
711
|
-
return
|
560
|
+
return true;
|
712
561
|
};
|
713
|
-
|
714
|
-
|
715
|
-
* @public
|
716
|
-
* @param {*} data
|
717
|
-
* @return {string}
|
562
|
+
/** @public
|
563
|
+
* @return {boolean}
|
718
564
|
*/
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
}
|
723
|
-
|
724
|
-
var content = (typeof data === 'string') ? data : data.toString();
|
565
|
+
Conflator.prototype.isConflating = function () {
|
566
|
+
return (this._timerId > 0 && !this._conflated && !this._disabled);
|
567
|
+
};
|
725
568
|
|
726
|
-
|
569
|
+
/** @private */
|
570
|
+
Conflator.prototype._onConflated = function () {
|
571
|
+
this._conflated = true;
|
727
572
|
|
728
|
-
|
729
|
-
|
730
|
-
|
573
|
+
try {
|
574
|
+
this._func();
|
575
|
+
} catch (err) {
|
576
|
+
console.error(err.message || err);
|
731
577
|
}
|
732
578
|
|
733
|
-
|
734
|
-
|
735
|
-
|
579
|
+
this._timerId = 0;
|
580
|
+
this._data.length = 0;
|
581
|
+
this._conflated = false;
|
582
|
+
};
|
736
583
|
|
737
|
-
|
738
|
-
|
739
|
-
|
584
|
+
/** @public
|
585
|
+
* @return {!Array}
|
586
|
+
*/
|
587
|
+
Conflator.prototype.getData = function () {
|
588
|
+
return this._data;
|
589
|
+
};
|
590
|
+
/** @public
|
591
|
+
* @param {Function} func Bound function that will use this conflator
|
592
|
+
* @param {*=} thisObj "this" object to be bound with the given function. If the function is already bound, there is no need to provide thisObj parameter
|
593
|
+
*/
|
594
|
+
Conflator.prototype.setFunction = function (func, thisObj) {
|
595
|
+
this._func = func;
|
596
|
+
if(func) {
|
597
|
+
if(thisObj) {
|
598
|
+
this._func = func.bind(thisObj);
|
599
|
+
} else {
|
600
|
+
this._func = func;
|
601
|
+
}
|
602
|
+
} else {
|
603
|
+
this._func = null;
|
604
|
+
}
|
605
|
+
};
|
606
|
+
/** @public
|
607
|
+
* @param {number} ms The delay time in millisecond before executing the function
|
608
|
+
*/
|
609
|
+
Conflator.prototype.setConflatingTime = function (ms) {
|
610
|
+
this._delay = ms || 0;
|
611
|
+
if(this._delay < 0) {
|
612
|
+
this._delay = 0;
|
740
613
|
}
|
614
|
+
};
|
741
615
|
|
742
|
-
|
616
|
+
/** @public
|
617
|
+
* @return {number} milli second
|
618
|
+
*/
|
619
|
+
Conflator.prototype.getConflatingTime = function () {
|
620
|
+
return this._delay;
|
621
|
+
};
|
622
|
+
|
623
|
+
/** @public
|
624
|
+
* @param {boolean=} opt_disabled
|
625
|
+
*/
|
626
|
+
Conflator.prototype.disable = function (opt_disabled) {
|
627
|
+
this._disabled = opt_disabled !== false;
|
628
|
+
};
|
629
|
+
/** @public
|
630
|
+
* @return {boolean}
|
631
|
+
*/
|
632
|
+
Conflator.prototype.isEnabled = function () {
|
633
|
+
return !this._disabled;
|
634
|
+
};
|
635
|
+
/** @public
|
636
|
+
* @param {boolean=} opt_enabled
|
637
|
+
*/
|
638
|
+
Conflator.prototype.enable = function (opt_enabled) {
|
639
|
+
this._disabled = opt_enabled === false;
|
743
640
|
};
|
744
641
|
|
745
|
-
/*
|
642
|
+
/* harmony default export */ var es6_Conflator = (Conflator);
|
746
643
|
|
747
644
|
|
645
|
+
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/Ext.js
|
646
|
+
/** Provide ability for prototype based Class to inherits another class
|
647
|
+
* @namespace
|
648
|
+
* @example
|
649
|
+
* var BaseClass = function() {};
|
650
|
+
* BaseClass.prototype.method = function() {};
|
651
|
+
* BaseClass.prototype._member = 1;
|
652
|
+
* var DerivedClass = function() {};
|
653
|
+
* Ext.inherits(DerivedClass, BaseClass); // Derived class will have methods and members of the base class
|
654
|
+
* // To call base class method
|
655
|
+
* DeriveClass["base"](this, "methodName", ...params);
|
656
|
+
*/
|
657
|
+
var Ext = {};
|
748
658
|
|
749
|
-
|
750
|
-
|
751
|
-
|
659
|
+
/** @public
|
660
|
+
* @function
|
661
|
+
* @param {Function} childCtor
|
662
|
+
* @param {Function} parentCtor
|
663
|
+
*/
|
664
|
+
Ext.inherits = function (childCtor, parentCtor) {
|
665
|
+
/** @constructor
|
666
|
+
* @ignore
|
667
|
+
*/
|
668
|
+
function tempCtor() { }
|
669
|
+
tempCtor.prototype = parentCtor.prototype;
|
670
|
+
childCtor.prototype = new tempCtor();
|
671
|
+
childCtor.prototype.constructor = childCtor;
|
752
672
|
|
753
|
-
|
754
|
-
|
755
|
-
|
673
|
+
/** Calls superclass constructor/method. <br>
|
674
|
+
* This function is only available if you use goog.inherits to <br>
|
675
|
+
* express inheritance relationships between classes. <br>
|
676
|
+
* NOTE: This is a replacement for goog.base and for superClass_ <br>
|
677
|
+
* property defined in childCtor.
|
678
|
+
* @param {!Object} me Should always be "this".
|
679
|
+
* @param {(string|null)=} methodName The method name to call. Calling superclass constructor can be done with the special string 'constructor'.
|
680
|
+
* @param {...*} var_args The arguments to pass to superclass <br>
|
681
|
+
* method/constructor.
|
682
|
+
* @return {*} The return value of the superclass method/constructor.
|
683
|
+
*/
|
684
|
+
childCtor["base"] = function(me, methodName, var_args) {
|
685
|
+
if(!methodName) { methodName = 'constructor'; }
|
686
|
+
// Copying using loop to avoid deop due to passing arguments object to function. This is faster in many JS engines as of late 2014.
|
687
|
+
var len = arguments.length;
|
688
|
+
var args = new Array(len); // http://jsperf.com/creating-an-array
|
689
|
+
for (var i = 2; i < len; i++) {
|
690
|
+
args[i - 2] = arguments[i];
|
691
|
+
}
|
692
|
+
return parentCtor.prototype[methodName].apply(me, args);
|
693
|
+
};
|
694
|
+
};
|
695
|
+
|
696
|
+
/* harmony default export */ var es6_Ext = (Ext);
|
697
|
+
|
698
|
+
|
699
|
+
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/EventDispatcher.js
|
756
700
|
/** Abstract base class that provides event management methods for derived class
|
757
701
|
* @constructor
|
758
702
|
*/
|
@@ -912,42 +856,349 @@ var preventDefault = function(e) {
|
|
912
856
|
*/
|
913
857
|
EventDispatcher.preventDefault = preventDefault;
|
914
858
|
|
915
|
-
/* harmony default export */
|
859
|
+
/* harmony default export */ var es6_EventDispatcher = (EventDispatcher);
|
916
860
|
|
917
861
|
|
862
|
+
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/formula/VariableToken.js
|
918
863
|
|
919
|
-
|
920
|
-
|
921
|
-
|
864
|
+
/** @constructor
|
865
|
+
* @param {string} str
|
866
|
+
* @param {number=} index
|
867
|
+
*/
|
868
|
+
var VariableToken = function(str, index) {
|
869
|
+
str = str.replace(/^\s+|\s+$/gm, ""); // Trim white spaces -- equivalent to String.trim(), which is not support in IE8
|
922
870
|
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
/* harmony import */ var _VariableToken_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
|
927
|
-
/* harmony import */ var _EventDispatcher_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
|
871
|
+
if(this._inputConverter[str]) {
|
872
|
+
str = this._inputConverter[str];
|
873
|
+
}
|
928
874
|
|
875
|
+
this._input = str;
|
876
|
+
if(index != null) {
|
877
|
+
this._index = index;
|
878
|
+
}
|
929
879
|
|
880
|
+
if(this._constants[str] != null) {
|
881
|
+
this._value = this._constants[str];
|
882
|
+
this._type = typeof this._value;
|
883
|
+
return;
|
884
|
+
}
|
930
885
|
|
886
|
+
var firstChar = str.charAt(0);
|
887
|
+
var lastChar = (str.length > 1) ? str.charAt(str.length - 1) : "";
|
888
|
+
if(firstChar === '"' && lastChar === '"') {
|
889
|
+
this._value = str.substring(1, str.length - 1);
|
890
|
+
this._type = "string";
|
891
|
+
return;
|
892
|
+
}
|
893
|
+
if(firstChar === "'" && lastChar === "'") {
|
894
|
+
this._value = str.substring(1, str.length - 1);
|
895
|
+
this._type = "string";
|
896
|
+
return;
|
897
|
+
}
|
898
|
+
if(firstChar === "(" && lastChar === ")") {
|
899
|
+
this._resolveVariableGroup(str);
|
900
|
+
return;
|
901
|
+
}
|
902
|
+
if(firstChar === "[" && lastChar === "]") {
|
903
|
+
this._resolveArray(str); // Array has undefined value (this._value == null)
|
904
|
+
return;
|
905
|
+
}
|
931
906
|
|
932
|
-
|
933
|
-
|
934
|
-
|
907
|
+
var adc = str.match(/TR\.\w+\(/);
|
908
|
+
if(adc) { // ADC field with parameters
|
909
|
+
this._type = "dynamic"; // ADC field with params always a dynamic token field
|
910
|
+
return;
|
911
|
+
}
|
935
912
|
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
*/
|
941
|
-
var Formula = function(expression, context) {
|
942
|
-
this._input = expression || "";
|
943
|
-
if(context != null) {
|
944
|
-
this._context = context;
|
945
|
-
if (context["_DATA"]) { // _DATA is an internal context used for getting cached data
|
946
|
-
this["__D"] = context["_DATA"];
|
947
|
-
}
|
913
|
+
var funcs = str.match(/[\w._]+\(/g);
|
914
|
+
if(funcs && funcs.length === 1) { // There must be only one method in the given str
|
915
|
+
this._resolveFunction(str, funcs[0]); // Function has undefined value (this._value == null)
|
916
|
+
return;
|
948
917
|
}
|
949
|
-
|
950
|
-
|
918
|
+
|
919
|
+
var words = str.match(/[\w._♦]+/g);
|
920
|
+
if(words && words.length > 1) { // A group of expression without parentheses
|
921
|
+
this._resolveVariableGroup(str);
|
922
|
+
return;
|
923
|
+
}
|
924
|
+
|
925
|
+
if(firstChar === "♦") {
|
926
|
+
this._type = "token";
|
927
|
+
return;
|
928
|
+
}
|
929
|
+
|
930
|
+
var num = Number(str);
|
931
|
+
if(num === num) { // If not NaN
|
932
|
+
this._value = num;
|
933
|
+
this._type = "number";
|
934
|
+
return;
|
935
|
+
}
|
936
|
+
|
937
|
+
this._type = "dynamic";
|
938
|
+
};
|
939
|
+
|
940
|
+
/** @private
|
941
|
+
* @type {string}
|
942
|
+
*/
|
943
|
+
VariableToken.prototype._input = "";
|
944
|
+
/** @private
|
945
|
+
* @type {number}
|
946
|
+
*/
|
947
|
+
VariableToken.prototype._index = -1;
|
948
|
+
/** @private
|
949
|
+
* @type {string}
|
950
|
+
*/
|
951
|
+
VariableToken.prototype._type = "";
|
952
|
+
/** @private
|
953
|
+
* @type {Array.<VariableToken>}
|
954
|
+
*/
|
955
|
+
VariableToken.prototype._subVars = null;
|
956
|
+
/** @private
|
957
|
+
* @type {string}
|
958
|
+
*/
|
959
|
+
VariableToken.prototype._funcName = "";
|
960
|
+
|
961
|
+
/** @private
|
962
|
+
* @type {*}
|
963
|
+
*/
|
964
|
+
VariableToken.prototype._value;
|
965
|
+
|
966
|
+
/** @private
|
967
|
+
* @type {string}
|
968
|
+
*/
|
969
|
+
VariableToken.prototype._valueWithTokenField = "";
|
970
|
+
|
971
|
+
/** Static variables for input conversion
|
972
|
+
* @private
|
973
|
+
* @type {Object.<string, string>}
|
974
|
+
*/
|
975
|
+
VariableToken.prototype._inputConverter = {
|
976
|
+
"TRUE": "true",
|
977
|
+
"FALSE": "false",
|
978
|
+
"PI": "Math.PI",
|
979
|
+
"TRUE()": "true",
|
980
|
+
"FALSE()": "false",
|
981
|
+
"PI()": "Math.PI"
|
982
|
+
};
|
983
|
+
/** Static variables for defining constant
|
984
|
+
* @private
|
985
|
+
* @type {Object.<string, number>}
|
986
|
+
*/
|
987
|
+
VariableToken.prototype._constants = {
|
988
|
+
"true": true,
|
989
|
+
"false": false,
|
990
|
+
"null": null,
|
991
|
+
"NaN": NaN,
|
992
|
+
"Math.E": Math.E, // returns Euler's number
|
993
|
+
"Math.PI": Math.PI, // returns PI
|
994
|
+
"Math.SQRT2": Math.SQRT2, // returns the square root of 2
|
995
|
+
"Math.SQRT1_2": Math.SQRT1_2, // returns the square root of 1/2
|
996
|
+
"Math.LN2": Math.LN2, // returns the natural logarithm of 2
|
997
|
+
"Math.LN10": Math.LN10, // returns the natural logarithm of 10
|
998
|
+
"Math.LOG2E": Math.LOG2E, // returns base 2 logarithm of E
|
999
|
+
"Math.LOG10E": Math.LOG10E
|
1000
|
+
};
|
1001
|
+
|
1002
|
+
/** @public
|
1003
|
+
* @return {string}
|
1004
|
+
*/
|
1005
|
+
VariableToken.prototype.getExpression = function() {
|
1006
|
+
if(this._type === "dynamic") {
|
1007
|
+
return 'this.__D("' + this._input + '", __R)';
|
1008
|
+
}
|
1009
|
+
if(this._type === "group") {
|
1010
|
+
return /** @type{string} */(this._value);
|
1011
|
+
}
|
1012
|
+
if(this._type === "function") {
|
1013
|
+
if(this._subVars) {
|
1014
|
+
return "this.__F[" + this._index + "](" + this._subVars.join(", ") + ")";
|
1015
|
+
} else {
|
1016
|
+
return "this.__F[" + this._index + "]()";
|
1017
|
+
}
|
1018
|
+
}
|
1019
|
+
if(this._type === "array") {
|
1020
|
+
if(this._subVars) {
|
1021
|
+
return "[" + this._subVars.join(", ") + "]";
|
1022
|
+
} else {
|
1023
|
+
return "[]";
|
1024
|
+
}
|
1025
|
+
}
|
1026
|
+
return this._input;
|
1027
|
+
};
|
1028
|
+
|
1029
|
+
/** @public
|
1030
|
+
* @return {string}
|
1031
|
+
*/
|
1032
|
+
VariableToken.prototype.getInputWithTokenField = function() {
|
1033
|
+
if(this._type === "dynamic") {
|
1034
|
+
return '♠' + this._input + '♥';
|
1035
|
+
}
|
1036
|
+
if(this._type === "group") {
|
1037
|
+
return /** @type{string} */(this._valueWithTokenField);
|
1038
|
+
}
|
1039
|
+
if(this._type === "function") {
|
1040
|
+
return this._funcName + "(" + this.getChildInputWithToken() + ")";
|
1041
|
+
}
|
1042
|
+
if(this._type === "array") {
|
1043
|
+
return "[" + this.getChildInputWithToken() + "]";
|
1044
|
+
}
|
1045
|
+
return this._input;
|
1046
|
+
};
|
1047
|
+
|
1048
|
+
/** @public
|
1049
|
+
* @return {string}
|
1050
|
+
*/
|
1051
|
+
VariableToken.prototype.getChildInputWithToken = function() {
|
1052
|
+
var len = this._subVars ? this._subVars.length : 0;
|
1053
|
+
if(len <= 0) {
|
1054
|
+
return "";
|
1055
|
+
}
|
1056
|
+
var inputs = new Array(len);
|
1057
|
+
for(var i = 0; i < len; ++i) {
|
1058
|
+
inputs[i] = this._subVars[i].getInputWithTokenField();
|
1059
|
+
}
|
1060
|
+
return inputs.join(", ");
|
1061
|
+
};
|
1062
|
+
|
1063
|
+
/** @public
|
1064
|
+
* @function
|
1065
|
+
* @return {string}
|
1066
|
+
*/
|
1067
|
+
VariableToken.prototype.toString = VariableToken.prototype.getExpression;
|
1068
|
+
|
1069
|
+
/** @public
|
1070
|
+
* @return {*}
|
1071
|
+
*/
|
1072
|
+
VariableToken.prototype.getValue = function() { return this._value; };
|
1073
|
+
/** @public
|
1074
|
+
* @return {string}
|
1075
|
+
*/
|
1076
|
+
VariableToken.prototype.getInput = function() { return this._input; };
|
1077
|
+
/** @public
|
1078
|
+
* @return {number}
|
1079
|
+
*/
|
1080
|
+
VariableToken.prototype.getIndex = function() { return this._index; };
|
1081
|
+
/** @public
|
1082
|
+
* @param {number} num
|
1083
|
+
*/
|
1084
|
+
VariableToken.prototype.setIndex = function(num) { this._index = num; };
|
1085
|
+
|
1086
|
+
/** @public
|
1087
|
+
* @return {string}
|
1088
|
+
*/
|
1089
|
+
VariableToken.prototype.getFunctionName = function() { return this._funcName; };
|
1090
|
+
|
1091
|
+
/** @public
|
1092
|
+
* @param {Object=} opt_obj
|
1093
|
+
* @return {string}
|
1094
|
+
*/
|
1095
|
+
VariableToken.prototype.getFieldNames = function(opt_obj) {
|
1096
|
+
if(this._subVars) {
|
1097
|
+
if(opt_obj) {
|
1098
|
+
var len = this._subVars.length;
|
1099
|
+
for(var i = 0; i < len; ++i) {
|
1100
|
+
this._subVars[i].getFieldNames(opt_obj);
|
1101
|
+
}
|
1102
|
+
}
|
1103
|
+
return this._subVars[0].getFieldNames();
|
1104
|
+
} else if(this._type === "dynamic") {
|
1105
|
+
if(opt_obj) {
|
1106
|
+
opt_obj[this._input] = true;
|
1107
|
+
}
|
1108
|
+
return this._input;
|
1109
|
+
}
|
1110
|
+
|
1111
|
+
return "";
|
1112
|
+
};
|
1113
|
+
|
1114
|
+
/** @private
|
1115
|
+
* @param {string} str
|
1116
|
+
* @returns {string}
|
1117
|
+
*/
|
1118
|
+
VariableToken.prototype._resolveVariableGroup = function(str) {
|
1119
|
+
var i = this._subVars ? this._subVars.length : 0;
|
1120
|
+
this._type = "group";
|
1121
|
+
|
1122
|
+
this._value = str.replace(/[\w._♦]+/g, function(varStr) {
|
1123
|
+
if(!this._subVars) {
|
1124
|
+
this._subVars = [];
|
1125
|
+
}
|
1126
|
+
var varToken = new VariableToken(varStr, this._subVars.length);
|
1127
|
+
this._subVars.push(varToken);
|
1128
|
+
return varToken.getExpression();
|
1129
|
+
}.bind(this));
|
1130
|
+
|
1131
|
+
this._valueWithTokenField = str.replace(/[\w._♦]+/g, function(varStr) {
|
1132
|
+
return this._subVars[i++].getInputWithTokenField();
|
1133
|
+
}.bind(this));
|
1134
|
+
|
1135
|
+
return this._value;
|
1136
|
+
};
|
1137
|
+
|
1138
|
+
/** @private
|
1139
|
+
* @param {string} str
|
1140
|
+
* @param {string} matchedName
|
1141
|
+
*/
|
1142
|
+
VariableToken.prototype._resolveFunction = function(str, matchedName) {
|
1143
|
+
this._type = "function";
|
1144
|
+
this._funcName = matchedName.substr(0, matchedName.length - 1); // Extract function name
|
1145
|
+
|
1146
|
+
// str = str.replace(/ /g, ""); // Replace all white spaces
|
1147
|
+
str = str.replace(matchedName, ""); // Strip function name and "("
|
1148
|
+
str = str.substr(0, str.length - 1); // Strip ")"
|
1149
|
+
if(str) {
|
1150
|
+
this._subVars = [];
|
1151
|
+
var params = str.split(",");
|
1152
|
+
var len = params.length;
|
1153
|
+
for(var i = 0; i < len; ++i) {
|
1154
|
+
this._subVars[i] = new VariableToken(params[i], i);
|
1155
|
+
}
|
1156
|
+
}
|
1157
|
+
};
|
1158
|
+
/** @private
|
1159
|
+
* @param {string} str
|
1160
|
+
*/
|
1161
|
+
VariableToken.prototype._resolveArray = function(str) {
|
1162
|
+
this._type = "array";
|
1163
|
+
|
1164
|
+
str = str.substr(1, str.length - 1); // Strip "[" and "]"
|
1165
|
+
if(str) {
|
1166
|
+
this._subVars = [];
|
1167
|
+
var params = str.split(",");
|
1168
|
+
var len = params.length;
|
1169
|
+
for(var i = 0; i < len; ++i) {
|
1170
|
+
this._subVars[i] = new VariableToken(params[i], i);
|
1171
|
+
}
|
1172
|
+
}
|
1173
|
+
};
|
1174
|
+
|
1175
|
+
/* harmony default export */ var formula_VariableToken = (VariableToken);
|
1176
|
+
|
1177
|
+
|
1178
|
+
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/formula/Formula.js
|
1179
|
+
|
1180
|
+
|
1181
|
+
|
1182
|
+
|
1183
|
+
/** Trigger when data within the realtime formula has been changed
|
1184
|
+
* @event Formula#dataCacheChanged
|
1185
|
+
*/
|
1186
|
+
|
1187
|
+
/** @constructor
|
1188
|
+
* @extends {EventDispatcher}
|
1189
|
+
* @param {string=} expression
|
1190
|
+
* @param {Object=} context
|
1191
|
+
*/
|
1192
|
+
var Formula = function(expression, context) {
|
1193
|
+
this._input = expression || "";
|
1194
|
+
if(context != null) {
|
1195
|
+
this._context = context;
|
1196
|
+
if (context["_DATA"]) { // _DATA is an internal context used for getting cached data
|
1197
|
+
this["__D"] = context["_DATA"];
|
1198
|
+
}
|
1199
|
+
}
|
1200
|
+
this["__F"] = [];
|
1201
|
+
this._fnTokens = [];
|
951
1202
|
this._fields = [];
|
952
1203
|
this._fieldMap = {};
|
953
1204
|
this._dataCache = {};
|
@@ -961,7 +1212,7 @@ var Formula = function(expression, context) {
|
|
961
1212
|
|
962
1213
|
this._parse(this._input);
|
963
1214
|
};
|
964
|
-
|
1215
|
+
es6_Ext.inherits(Formula, es6_EventDispatcher);
|
965
1216
|
|
966
1217
|
/** @type {Object.<string, boolean>}
|
967
1218
|
* @const
|
@@ -1020,7 +1271,7 @@ Formula.prototype._alias = ""; // Alias name of formula
|
|
1020
1271
|
/** @private
|
1021
1272
|
* @type {Function}
|
1022
1273
|
*/
|
1023
|
-
Formula.prototype._main = null; // Function resulted from
|
1274
|
+
Formula.prototype._main = null; // Function resulted from resolving an expression
|
1024
1275
|
|
1025
1276
|
/** @private
|
1026
1277
|
* @type {Array.<Function>}
|
@@ -1128,7 +1379,7 @@ Formula.prototype.calculate = function(rowData) {
|
|
1128
1379
|
return null;
|
1129
1380
|
};
|
1130
1381
|
|
1131
|
-
/** Function resulted from
|
1382
|
+
/** Function resulted from resolving an expression
|
1132
1383
|
* @public
|
1133
1384
|
* @return {Function} Returns function that takes an JSON object as a parameter. Return null if function is not valid JavaScript codes.
|
1134
1385
|
*/
|
@@ -1320,7 +1571,7 @@ Formula.tokenizeQuotes = function(exp, tokens, calcHierarchy) {
|
|
1320
1571
|
exp = exp.replace(/(["'])(?:(?=(\\?))\2.)*?\1/g, function(str) { // eslint-disable-line
|
1321
1572
|
matched = true;
|
1322
1573
|
index = tokens.length;
|
1323
|
-
tokens.push(new
|
1574
|
+
tokens.push(new formula_VariableToken(str, index));
|
1324
1575
|
tokenIndices.push(index);
|
1325
1576
|
return "♦" + index + "♦";
|
1326
1577
|
});
|
@@ -1351,7 +1602,7 @@ Formula.tokenizeAdcWithParams = function(exp, tokens, calcHierarchy) {
|
|
1351
1602
|
exp = exp.replace(/TR\.\w+\([^\)]*\)+/g, function(str) { // eslint-disable-line
|
1352
1603
|
matched = true;
|
1353
1604
|
index = tokens.length;
|
1354
|
-
tokens.push(new
|
1605
|
+
tokens.push(new formula_VariableToken(str, index));
|
1355
1606
|
tokenIndices.push(index);
|
1356
1607
|
return "♦" + index + "♦";
|
1357
1608
|
});
|
@@ -1440,7 +1691,7 @@ Formula.prototype._tokenizeParentheses = function(exp, tokens, calcHierarchy) {
|
|
1440
1691
|
|
1441
1692
|
if (index == null) {
|
1442
1693
|
index = tokens.length;
|
1443
|
-
tokens.push(new
|
1694
|
+
tokens.push(new formula_VariableToken(fnStr, index));
|
1444
1695
|
fnStrToIndex[fnStr] = index;
|
1445
1696
|
}
|
1446
1697
|
|
@@ -1474,7 +1725,7 @@ Formula.prototype._tokenizeConstants = function(exp, tokens, calcHierarchy) {
|
|
1474
1725
|
return varStr;
|
1475
1726
|
}
|
1476
1727
|
var index = tokens.length;
|
1477
|
-
tokens.push(new
|
1728
|
+
tokens.push(new formula_VariableToken(varStr, index));
|
1478
1729
|
tokenIndices.push(index);
|
1479
1730
|
return "♦" + index + "♦";
|
1480
1731
|
});
|
@@ -1600,7 +1851,7 @@ Formula.prototype._parse = function(exp) {
|
|
1600
1851
|
Formula.prototype._createFunction = function (expression) {
|
1601
1852
|
var func = null;
|
1602
1853
|
try {
|
1603
|
-
func =
|
1854
|
+
func = new Function("__R", "return " + expression + ";");
|
1604
1855
|
func = func.bind(this);
|
1605
1856
|
func({}); // Try to execute the method once to check error
|
1606
1857
|
} catch(err) {
|
@@ -1813,1186 +2064,820 @@ Formula.prototype._onDataCacheChanged = function(e) {
|
|
1813
2064
|
|
1814
2065
|
Formula._proto = Formula.prototype;
|
1815
2066
|
|
1816
|
-
/* harmony default export */
|
2067
|
+
/* harmony default export */ var formula_Formula = (Formula);
|
1817
2068
|
|
1818
2069
|
|
1819
|
-
|
1820
|
-
|
1821
|
-
|
1822
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1823
|
-
|
1824
|
-
"use strict";
|
1825
|
-
/* unused harmony export VariableToken */
|
1826
|
-
|
1827
|
-
/** @constructor
|
1828
|
-
* @param {string} str
|
1829
|
-
* @param {number=} index
|
1830
|
-
*/
|
1831
|
-
var VariableToken = function(str, index) {
|
1832
|
-
str = str.replace(/^\s+|\s+$/gm, ""); // Trim white spaces -- equivalent to String.trim(), which is not support in IE8
|
1833
|
-
|
1834
|
-
if(this._inputConverter[str]) {
|
1835
|
-
str = this._inputConverter[str];
|
1836
|
-
}
|
1837
|
-
|
1838
|
-
this._input = str;
|
1839
|
-
if(index != null) {
|
1840
|
-
this._index = index;
|
1841
|
-
}
|
1842
|
-
|
1843
|
-
if(this._constants[str] != null) {
|
1844
|
-
this._value = this._constants[str];
|
1845
|
-
this._type = typeof this._value;
|
1846
|
-
return;
|
1847
|
-
}
|
1848
|
-
|
1849
|
-
var firstChar = str.charAt(0);
|
1850
|
-
var lastChar = (str.length > 1) ? str.charAt(str.length - 1) : "";
|
1851
|
-
if(firstChar === '"' && lastChar === '"') {
|
1852
|
-
this._value = str.substring(1, str.length - 1);
|
1853
|
-
this._type = "string";
|
1854
|
-
return;
|
1855
|
-
}
|
1856
|
-
if(firstChar === "'" && lastChar === "'") {
|
1857
|
-
this._value = str.substring(1, str.length - 1);
|
1858
|
-
this._type = "string";
|
1859
|
-
return;
|
1860
|
-
}
|
1861
|
-
if(firstChar === "(" && lastChar === ")") {
|
1862
|
-
this._resolveVariableGroup(str);
|
1863
|
-
return;
|
1864
|
-
}
|
1865
|
-
if(firstChar === "[" && lastChar === "]") {
|
1866
|
-
this._resolveArray(str); // Array has undefined value (this._value == null)
|
1867
|
-
return;
|
1868
|
-
}
|
1869
|
-
|
1870
|
-
var adc = str.match(/TR\.\w+\(/);
|
1871
|
-
if(adc) { // ADC field with parameters
|
1872
|
-
this._type = "dynamic"; // ADC field with params always a dynamic token field
|
1873
|
-
return;
|
1874
|
-
}
|
1875
|
-
|
1876
|
-
var funcs = str.match(/[\w._]+\(/g);
|
1877
|
-
if(funcs && funcs.length === 1) { // There must be only one method in the given str
|
1878
|
-
this._resolveFunction(str, funcs[0]); // Function has undefined value (this._value == null)
|
1879
|
-
return;
|
1880
|
-
}
|
1881
|
-
|
1882
|
-
var words = str.match(/[\w._♦]+/g);
|
1883
|
-
if(words && words.length > 1) { // A group of expression without parentheses
|
1884
|
-
this._resolveVariableGroup(str);
|
1885
|
-
return;
|
1886
|
-
}
|
1887
|
-
|
1888
|
-
if(firstChar === "♦") {
|
1889
|
-
this._type = "token";
|
1890
|
-
return;
|
1891
|
-
}
|
1892
|
-
|
1893
|
-
var num = Number(str);
|
1894
|
-
if(num === num) { // If not NaN
|
1895
|
-
this._value = num;
|
1896
|
-
this._type = "number";
|
1897
|
-
return;
|
1898
|
-
}
|
1899
|
-
|
1900
|
-
this._type = "dynamic";
|
1901
|
-
};
|
1902
|
-
|
1903
|
-
/** @private
|
1904
|
-
* @type {string}
|
1905
|
-
*/
|
1906
|
-
VariableToken.prototype._input = "";
|
1907
|
-
/** @private
|
1908
|
-
* @type {number}
|
1909
|
-
*/
|
1910
|
-
VariableToken.prototype._index = -1;
|
1911
|
-
/** @private
|
1912
|
-
* @type {string}
|
1913
|
-
*/
|
1914
|
-
VariableToken.prototype._type = "";
|
1915
|
-
/** @private
|
1916
|
-
* @type {Array.<VariableToken>}
|
1917
|
-
*/
|
1918
|
-
VariableToken.prototype._subVars = null;
|
1919
|
-
/** @private
|
1920
|
-
* @type {string}
|
1921
|
-
*/
|
1922
|
-
VariableToken.prototype._funcName = "";
|
1923
|
-
|
1924
|
-
/** @private
|
1925
|
-
* @type {*}
|
1926
|
-
*/
|
1927
|
-
VariableToken.prototype._value;
|
1928
|
-
|
1929
|
-
/** @private
|
1930
|
-
* @type {string}
|
1931
|
-
*/
|
1932
|
-
VariableToken.prototype._valueWithTokenField = "";
|
1933
|
-
|
1934
|
-
/** Static variables for input conversion
|
1935
|
-
* @private
|
1936
|
-
* @type {Object.<string, string>}
|
1937
|
-
*/
|
1938
|
-
VariableToken.prototype._inputConverter = {
|
1939
|
-
"TRUE": "true",
|
1940
|
-
"FALSE": "false",
|
1941
|
-
"PI": "Math.PI",
|
1942
|
-
"TRUE()": "true",
|
1943
|
-
"FALSE()": "false",
|
1944
|
-
"PI()": "Math.PI"
|
1945
|
-
};
|
1946
|
-
/** Static variables for defining constant
|
1947
|
-
* @private
|
1948
|
-
* @type {Object.<string, number>}
|
1949
|
-
*/
|
1950
|
-
VariableToken.prototype._constants = {
|
1951
|
-
"true": true,
|
1952
|
-
"false": false,
|
1953
|
-
"null": null,
|
1954
|
-
"NaN": NaN,
|
1955
|
-
"Math.E": Math.E, // returns Euler's number
|
1956
|
-
"Math.PI": Math.PI, // returns PI
|
1957
|
-
"Math.SQRT2": Math.SQRT2, // returns the square root of 2
|
1958
|
-
"Math.SQRT1_2": Math.SQRT1_2, // returns the square root of 1/2
|
1959
|
-
"Math.LN2": Math.LN2, // returns the natural logarithm of 2
|
1960
|
-
"Math.LN10": Math.LN10, // returns the natural logarithm of 10
|
1961
|
-
"Math.LOG2E": Math.LOG2E, // returns base 2 logarithm of E
|
1962
|
-
"Math.LOG10E": Math.LOG10E
|
1963
|
-
};
|
1964
|
-
|
1965
|
-
/** @public
|
1966
|
-
* @return {string}
|
1967
|
-
*/
|
1968
|
-
VariableToken.prototype.getExpression = function() {
|
1969
|
-
if(this._type === "dynamic") {
|
1970
|
-
return 'this.__D("' + this._input + '", __R)';
|
1971
|
-
}
|
1972
|
-
if(this._type === "group") {
|
1973
|
-
return /** @type{string} */(this._value);
|
1974
|
-
}
|
1975
|
-
if(this._type === "function") {
|
1976
|
-
if(this._subVars) {
|
1977
|
-
return "this.__F[" + this._index + "](" + this._subVars.join(", ") + ")";
|
1978
|
-
} else {
|
1979
|
-
return "this.__F[" + this._index + "]()";
|
1980
|
-
}
|
1981
|
-
}
|
1982
|
-
if(this._type === "array") {
|
1983
|
-
if(this._subVars) {
|
1984
|
-
return "[" + this._subVars.join(", ") + "]";
|
1985
|
-
} else {
|
1986
|
-
return "[]";
|
1987
|
-
}
|
1988
|
-
}
|
1989
|
-
return this._input;
|
1990
|
-
};
|
1991
|
-
|
1992
|
-
/** @public
|
1993
|
-
* @return {string}
|
1994
|
-
*/
|
1995
|
-
VariableToken.prototype.getInputWithTokenField = function() {
|
1996
|
-
if(this._type === "dynamic") {
|
1997
|
-
return '♠' + this._input + '♥';
|
1998
|
-
}
|
1999
|
-
if(this._type === "group") {
|
2000
|
-
return /** @type{string} */(this._valueWithTokenField);
|
2001
|
-
}
|
2002
|
-
if(this._type === "function") {
|
2003
|
-
return this._funcName + "(" + this.getChildInputWithToken() + ")";
|
2004
|
-
}
|
2005
|
-
if(this._type === "array") {
|
2006
|
-
return "[" + this.getChildInputWithToken() + "]";
|
2007
|
-
}
|
2008
|
-
return this._input;
|
2009
|
-
};
|
2010
|
-
|
2011
|
-
/** @public
|
2012
|
-
* @return {string}
|
2013
|
-
*/
|
2014
|
-
VariableToken.prototype.getChildInputWithToken = function() {
|
2015
|
-
var len = this._subVars ? this._subVars.length : 0;
|
2016
|
-
if(len <= 0) {
|
2017
|
-
return "";
|
2018
|
-
}
|
2019
|
-
var inputs = new Array(len);
|
2020
|
-
for(var i = 0; i < len; ++i) {
|
2021
|
-
inputs[i] = this._subVars[i].getInputWithTokenField();
|
2022
|
-
}
|
2023
|
-
return inputs.join(", ");
|
2024
|
-
};
|
2025
|
-
|
2026
|
-
/** @public
|
2027
|
-
* @function
|
2028
|
-
* @return {string}
|
2029
|
-
*/
|
2030
|
-
VariableToken.prototype.toString = VariableToken.prototype.getExpression;
|
2031
|
-
|
2032
|
-
/** @public
|
2033
|
-
* @return {*}
|
2034
|
-
*/
|
2035
|
-
VariableToken.prototype.getValue = function() { return this._value; };
|
2036
|
-
/** @public
|
2037
|
-
* @return {string}
|
2038
|
-
*/
|
2039
|
-
VariableToken.prototype.getInput = function() { return this._input; };
|
2040
|
-
/** @public
|
2041
|
-
* @return {number}
|
2042
|
-
*/
|
2043
|
-
VariableToken.prototype.getIndex = function() { return this._index; };
|
2044
|
-
/** @public
|
2045
|
-
* @param {number} num
|
2046
|
-
*/
|
2047
|
-
VariableToken.prototype.setIndex = function(num) { this._index = num; };
|
2048
|
-
|
2049
|
-
/** @public
|
2050
|
-
* @return {string}
|
2070
|
+
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/locale/translation-en.js
|
2071
|
+
/**
|
2072
|
+
* @namespace
|
2051
2073
|
*/
|
2052
|
-
|
2074
|
+
var translationEn = {
|
2075
|
+
"sun": "Sun",
|
2076
|
+
"mon": "Mon",
|
2077
|
+
"tue": "Tue",
|
2078
|
+
"wed": "Wed",
|
2079
|
+
"thu": "Thu",
|
2080
|
+
"fri": "Fri",
|
2081
|
+
"sat": "Sat",
|
2082
|
+
"Sunday": "Sunday",
|
2083
|
+
"Monday": "Monday",
|
2084
|
+
"Tuesday": "Tuesday",
|
2085
|
+
"Wednesday": "Wednesday",
|
2086
|
+
"Thursday": "Thursday",
|
2087
|
+
"Friday": "Friday",
|
2088
|
+
"Saturday": "Saturday",
|
2053
2089
|
|
2054
|
-
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
|
2059
|
-
|
2060
|
-
|
2061
|
-
|
2062
|
-
|
2063
|
-
|
2064
|
-
|
2065
|
-
|
2066
|
-
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2071
|
-
|
2072
|
-
|
2090
|
+
"jan": "Jan",
|
2091
|
+
"feb": "Feb",
|
2092
|
+
"mar": "Mar",
|
2093
|
+
"apr": "Apr",
|
2094
|
+
"may": "May",
|
2095
|
+
"jun": "Jun",
|
2096
|
+
"jul": "Jul",
|
2097
|
+
"aug": "Aug",
|
2098
|
+
"sep": "Sep",
|
2099
|
+
"oct": "Oct",
|
2100
|
+
"nov": "Nov",
|
2101
|
+
"dec": "Dec",
|
2102
|
+
"January": "January",
|
2103
|
+
"February": "February",
|
2104
|
+
"March": "March",
|
2105
|
+
"April": "April",
|
2106
|
+
"May": "May",
|
2107
|
+
"June": "June",
|
2108
|
+
"July": "July",
|
2109
|
+
"August": "August",
|
2110
|
+
"September": "September",
|
2111
|
+
"October": "October",
|
2112
|
+
"November": "November",
|
2113
|
+
"December": "December",
|
2073
2114
|
|
2074
|
-
|
2115
|
+
"am": "am",
|
2116
|
+
"AM": "AM",
|
2117
|
+
"pm": "pm",
|
2118
|
+
"PM": "PM"
|
2075
2119
|
};
|
2076
2120
|
|
2077
|
-
|
2078
|
-
* @param {string} str
|
2079
|
-
* @returns {string}
|
2080
|
-
*/
|
2081
|
-
VariableToken.prototype._resolveVariableGroup = function(str) {
|
2082
|
-
var i = this._subVars ? this._subVars.length : 0;
|
2083
|
-
this._type = "group";
|
2084
|
-
|
2085
|
-
this._value = str.replace(/[\w._♦]+/g, function(varStr) {
|
2086
|
-
if(!this._subVars) {
|
2087
|
-
this._subVars = [];
|
2088
|
-
}
|
2089
|
-
var varToken = new VariableToken(varStr, this._subVars.length);
|
2090
|
-
this._subVars.push(varToken);
|
2091
|
-
return varToken.getExpression();
|
2092
|
-
}.bind(this));
|
2093
|
-
|
2094
|
-
this._valueWithTokenField = str.replace(/[\w._♦]+/g, function(varStr) {
|
2095
|
-
return this._subVars[i++].getInputWithTokenField();
|
2096
|
-
}.bind(this));
|
2097
|
-
|
2098
|
-
return this._value;
|
2099
|
-
};
|
2121
|
+
/* harmony default export */ var translation_en = (translationEn);
|
2100
2122
|
|
2101
|
-
|
2102
|
-
|
2103
|
-
* @
|
2123
|
+
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/locale/translation-de.js
|
2124
|
+
/**
|
2125
|
+
* @namespace
|
2104
2126
|
*/
|
2105
|
-
|
2106
|
-
|
2107
|
-
|
2127
|
+
var translationDe = {
|
2128
|
+
"sun": "So",
|
2129
|
+
"mon": "Mo",
|
2130
|
+
"tue": "Di",
|
2131
|
+
"wed": "Mi",
|
2132
|
+
"thu": "Do",
|
2133
|
+
"fri": "Fr",
|
2134
|
+
"sat": "Sa",
|
2135
|
+
"Sunday": "Sonntag",
|
2136
|
+
"Monday": "Montag",
|
2137
|
+
"Tuesday": "Dienstag",
|
2138
|
+
"Wednesday": "Mittwoch",
|
2139
|
+
"Thursday": "Donnerstag",
|
2140
|
+
"Friday": "Freitag",
|
2141
|
+
"Saturday": "Samstag",
|
2108
2142
|
|
2109
|
-
|
2110
|
-
|
2111
|
-
|
2112
|
-
|
2113
|
-
|
2114
|
-
|
2115
|
-
|
2116
|
-
|
2117
|
-
|
2118
|
-
|
2119
|
-
|
2120
|
-
|
2121
|
-
|
2122
|
-
|
2123
|
-
|
2124
|
-
|
2125
|
-
|
2143
|
+
"jan": "Jan",
|
2144
|
+
"feb": "Feb",
|
2145
|
+
"mar": "Mrz",
|
2146
|
+
"apr": "Apr",
|
2147
|
+
"may": "Mai",
|
2148
|
+
"jun": "Jun",
|
2149
|
+
"jul": "Jul",
|
2150
|
+
"aug": "Aug",
|
2151
|
+
"sep": "Sep",
|
2152
|
+
"oct": "Okt",
|
2153
|
+
"nov": "Nov",
|
2154
|
+
"dec": "Dez",
|
2155
|
+
"January": "Januar",
|
2156
|
+
"February": "Februar",
|
2157
|
+
"March": "März",
|
2158
|
+
"April": "April",
|
2159
|
+
"May": "Mai",
|
2160
|
+
"June": "Juni",
|
2161
|
+
"July": "Juli",
|
2162
|
+
"August": "August",
|
2163
|
+
"September": "September",
|
2164
|
+
"October": "Oktober",
|
2165
|
+
"November": "November",
|
2166
|
+
"December": "Dezember",
|
2126
2167
|
|
2127
|
-
|
2128
|
-
|
2129
|
-
|
2130
|
-
|
2131
|
-
var len = params.length;
|
2132
|
-
for(var i = 0; i < len; ++i) {
|
2133
|
-
this._subVars[i] = new VariableToken(params[i], i);
|
2134
|
-
}
|
2135
|
-
}
|
2168
|
+
"am": "am",
|
2169
|
+
"AM": "AM",
|
2170
|
+
"pm": "pm",
|
2171
|
+
"PM": "PM"
|
2136
2172
|
};
|
2137
2173
|
|
2138
|
-
/* harmony default export */
|
2139
|
-
|
2140
|
-
|
2141
|
-
|
2142
|
-
/***/ }),
|
2143
|
-
/* 5 */
|
2144
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2145
|
-
|
2146
|
-
"use strict";
|
2147
|
-
// ESM COMPAT FLAG
|
2148
|
-
__webpack_require__.r(__webpack_exports__);
|
2149
|
-
|
2150
|
-
// EXPORTS
|
2151
|
-
__webpack_require__.d(__webpack_exports__, "Grid", function() { return /* reexport */ Grid; });
|
2152
|
-
|
2153
|
-
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/Dom.js
|
2154
|
-
/** @namespace */
|
2155
|
-
var Dom = {};
|
2156
|
-
|
2157
|
-
/** Shorthand for creating an element with class
|
2158
|
-
* @public
|
2159
|
-
* @function
|
2160
|
-
* @param {string} tagName
|
2161
|
-
* @param {string=} className
|
2162
|
-
* @return {!Element}
|
2163
|
-
*/
|
2164
|
-
Dom.create = function(tagName, className) {
|
2165
|
-
var elem = document.createElement(tagName);
|
2166
|
-
if(className) {
|
2167
|
-
elem.className = className;
|
2168
|
-
}
|
2169
|
-
return elem;
|
2170
|
-
};
|
2171
|
-
/** Shorthand for creating a div element with class
|
2172
|
-
* @public
|
2173
|
-
* @function
|
2174
|
-
* @param {string=} className
|
2175
|
-
* @return {!Element}
|
2176
|
-
*/
|
2177
|
-
Dom.div = function(className) {
|
2178
|
-
return Dom.create("div", className);
|
2179
|
-
};
|
2180
|
-
/** Shorthand for creating a span element with textContent
|
2181
|
-
* @public
|
2182
|
-
* @function
|
2183
|
-
* @param {string=} textContent
|
2184
|
-
* @param {string=} className
|
2185
|
-
* @return {!Element}
|
2186
|
-
*/
|
2187
|
-
Dom.text = function(textContent, className) {
|
2188
|
-
var elem = Dom.create("span", className);
|
2189
|
-
if(textContent || textContent === 0) {
|
2190
|
-
elem.textContent = textContent;
|
2191
|
-
}
|
2192
|
-
return elem;
|
2193
|
-
};
|
2174
|
+
/* harmony default export */ var translation_de = (translationDe);
|
2194
2175
|
|
2195
|
-
|
2196
|
-
|
2197
|
-
* @
|
2198
|
-
* @param {Element} parentElem
|
2199
|
-
* @param {...Node|Array} children
|
2200
|
-
* @return {Element} Parent element
|
2201
|
-
*/
|
2202
|
-
Dom.appendChild = function(parentElem, children) {
|
2203
|
-
if(!parentElem) {
|
2204
|
-
return null;
|
2205
|
-
}
|
2206
|
-
var i, ary;
|
2207
|
-
if(Array.isArray(arguments[1])) {
|
2208
|
-
ary = arguments[1];
|
2209
|
-
i = 0;
|
2210
|
-
} else {
|
2211
|
-
ary = arguments;
|
2212
|
-
i = 1;
|
2213
|
-
}
|
2214
|
-
var len = ary.length;
|
2215
|
-
while(i < len) {
|
2216
|
-
parentElem.appendChild(ary[i]);
|
2217
|
-
++i;
|
2218
|
-
}
|
2219
|
-
return parentElem;
|
2220
|
-
};
|
2221
|
-
/** Shorthand for appending multiple children in a tree like manner
|
2222
|
-
* @public
|
2223
|
-
* @function
|
2224
|
-
* @param {Element} parentElem
|
2225
|
-
* @param {...Node|Array} children The first child from the given array will be treated as a parent of all subsequence items.
|
2226
|
-
* @return {Element} Parent element
|
2227
|
-
* @example
|
2228
|
-
* Dom.buildTree(p1,
|
2229
|
-
* ch1,
|
2230
|
-
* ch2,
|
2231
|
-
* [ch3_p1,
|
2232
|
-
* ch3_ch1,
|
2233
|
-
* ch3_ch2
|
2234
|
-
* ]
|
2235
|
-
* );
|
2236
|
-
*/
|
2237
|
-
Dom.buildTree = function(parentElem, children) {
|
2238
|
-
if(!parentElem) {
|
2239
|
-
return null;
|
2240
|
-
}
|
2241
|
-
var args = arguments;
|
2242
|
-
var len = args.length;
|
2243
|
-
for(var i = 1; i < len; ++i) {
|
2244
|
-
var child = args[i];
|
2245
|
-
if(child) {
|
2246
|
-
var childElem;
|
2247
|
-
if(Array.isArray(child)) {
|
2248
|
-
childElem = Dom.buildTree.apply(null, child);
|
2249
|
-
} else if(child.nodeType === 1) {
|
2250
|
-
childElem = /** @type{Element} */(child);
|
2251
|
-
}
|
2252
|
-
if(childElem) {
|
2253
|
-
parentElem.appendChild(childElem);
|
2254
|
-
}
|
2255
|
-
}
|
2256
|
-
}
|
2257
|
-
return parentElem;
|
2258
|
-
};
|
2259
|
-
/** Put the given element out of the document
|
2260
|
-
* @function
|
2261
|
-
* @param {Node|Element} child
|
2262
|
-
* @return {Element} Parent Element
|
2263
|
-
*/
|
2264
|
-
Dom.removeParent = function (child) {
|
2265
|
-
if(!child) { return null; }
|
2266
|
-
var parent = child.parentNode;
|
2267
|
-
if(parent) {
|
2268
|
-
parent.removeChild(child);
|
2269
|
-
}
|
2270
|
-
return parent;
|
2271
|
-
};
|
2272
|
-
/** Safely set parent for the specified child element
|
2273
|
-
* @function
|
2274
|
-
* @param {Node|Element} child
|
2275
|
-
* @param {Node|Element} parent
|
2276
|
-
* @return {Element} Parent Element
|
2277
|
-
*/
|
2278
|
-
Dom.setParent = function (child, parent) {
|
2279
|
-
if(!child) { return null; }
|
2280
|
-
if(parent) {
|
2281
|
-
parent.appendChild(child);
|
2282
|
-
return parent;
|
2283
|
-
} else {
|
2284
|
-
return Dom.removeParent(child);
|
2285
|
-
}
|
2286
|
-
};
|
2287
|
-
/** Remove all child nodes
|
2288
|
-
* @function
|
2289
|
-
* @param {Node|Element} elem
|
2290
|
-
* @param {number=} count
|
2291
|
-
*/
|
2292
|
-
Dom.removeChildren = function (elem, count) {
|
2293
|
-
if(elem) {
|
2294
|
-
var childCount = elem.childNodes.length;
|
2295
|
-
if(count == null || count > childCount) {
|
2296
|
-
count = childCount;
|
2297
|
-
}
|
2298
|
-
while(--count >= 0) {
|
2299
|
-
elem.removeChild(elem.lastChild);
|
2300
|
-
}
|
2301
|
-
}
|
2302
|
-
};
|
2303
|
-
/** Ensure that element will contain only the given nodes (all other existing nodes are removed).
|
2304
|
-
* @public
|
2305
|
-
* @function
|
2306
|
-
* @param {Element} elem
|
2307
|
-
* @param {*} val Element, Node, string, number, or everything else.
|
2176
|
+
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/locale/translation-ja.js
|
2177
|
+
/**
|
2178
|
+
* @namespace
|
2308
2179
|
*/
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
|
2315
|
-
|
2316
|
-
|
2317
|
-
|
2318
|
-
|
2319
|
-
|
2320
|
-
|
2321
|
-
|
2322
|
-
|
2323
|
-
|
2324
|
-
} else {
|
2325
|
-
Dom.removeChildren(elem);
|
2326
|
-
}
|
2327
|
-
}
|
2328
|
-
};
|
2180
|
+
var translationJa = {
|
2181
|
+
'sun': '日',
|
2182
|
+
'mon': '月',
|
2183
|
+
'tue': '火',
|
2184
|
+
'wed': '水',
|
2185
|
+
'thu': '木',
|
2186
|
+
'fri': '金',
|
2187
|
+
'sat': '土',
|
2188
|
+
'Sunday': '日曜日',
|
2189
|
+
'Monday': '月曜日',
|
2190
|
+
'Tuesday': '火曜日',
|
2191
|
+
'Wednesday': '水曜日',
|
2192
|
+
'Thursday': '木曜日',
|
2193
|
+
'Friday': '金曜日',
|
2194
|
+
'Saturday': '土曜日',
|
2329
2195
|
|
2330
|
-
|
2331
|
-
|
2332
|
-
|
2333
|
-
|
2334
|
-
|
2335
|
-
|
2336
|
-
|
2337
|
-
|
2338
|
-
|
2339
|
-
|
2340
|
-
|
2341
|
-
|
2342
|
-
|
2343
|
-
|
2344
|
-
|
2345
|
-
|
2346
|
-
|
2347
|
-
|
2348
|
-
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
|
2353
|
-
|
2354
|
-
* @param {*=} bool Truthy or falsy value. If specified, this method is equivalent to setter method.
|
2355
|
-
*/
|
2356
|
-
Dom.toggleClass = function (elem, classStr, bool) {
|
2357
|
-
if(bool) {
|
2358
|
-
elem.classList.add(classStr);
|
2359
|
-
} else if(bool == null) {
|
2360
|
-
if(elem.classList.contains(classStr)) {
|
2361
|
-
elem.classList.remove(classStr);
|
2362
|
-
} else {
|
2363
|
-
elem.classList.add(classStr);
|
2364
|
-
}
|
2365
|
-
} else {
|
2366
|
-
elem.classList.remove(classStr);
|
2367
|
-
}
|
2368
|
-
};
|
2369
|
-
/** A quick way to add multiple classes without altering existing classes in the element. This does not necessarily mean that this method has high performance.
|
2370
|
-
* @function
|
2371
|
-
* @param {Element} elem
|
2372
|
-
* @param {...string} classes CSS Class names without any space in the name. Array can be given as well
|
2373
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList}
|
2374
|
-
*/
|
2375
|
-
Dom.addClasses = function (elem, classes) {
|
2376
|
-
if(elem) {
|
2377
|
-
var ary = Array.isArray(classes) ? classes : arguments;
|
2378
|
-
var len = ary.length;
|
2379
|
-
for(var i = 0; i < len; ++i) {
|
2380
|
-
var str = ary[i];
|
2381
|
-
if(str && typeof str == "string") {
|
2382
|
-
elem.classList.add(str);
|
2383
|
-
}
|
2384
|
-
}
|
2385
|
-
}
|
2386
|
-
};
|
2387
|
-
/** A quick way to remove multiple classes without altering unrelated classes in the element. This does not necessarily mean that this method has high performance.
|
2388
|
-
* @function
|
2389
|
-
* @param {Element} elem
|
2390
|
-
* @param {...string} classes CSS Class names without any space in the name. Array can be given as well
|
2391
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList}
|
2392
|
-
*/
|
2393
|
-
Dom.removeClasses = function (elem, classes) {
|
2394
|
-
if(elem) {
|
2395
|
-
var ary = Array.isArray(classes) ? classes : arguments;
|
2396
|
-
var len = ary.length;
|
2397
|
-
for(var i = 0; i < len; ++i) {
|
2398
|
-
var str = ary[i];
|
2399
|
-
if(str && typeof str == "string") {
|
2400
|
-
elem.classList.remove(str);
|
2401
|
-
}
|
2402
|
-
}
|
2403
|
-
}
|
2404
|
-
};
|
2196
|
+
'jan': '1月',
|
2197
|
+
'feb': '2月',
|
2198
|
+
'mar': '3月',
|
2199
|
+
'apr': '4月',
|
2200
|
+
'may': '5月',
|
2201
|
+
'jun': '6月',
|
2202
|
+
'jul': '7月',
|
2203
|
+
'aug': '8月',
|
2204
|
+
'sep': '9月',
|
2205
|
+
'oct': '10月',
|
2206
|
+
'nov': '11月',
|
2207
|
+
'dec': '12月',
|
2208
|
+
'January': '1月',
|
2209
|
+
'February': '2月',
|
2210
|
+
'March': '3月',
|
2211
|
+
'April': '4月',
|
2212
|
+
'May': '5月',
|
2213
|
+
'June': '6月',
|
2214
|
+
'July': '7月',
|
2215
|
+
'August': '8月',
|
2216
|
+
'September': '9月',
|
2217
|
+
'October': '10月',
|
2218
|
+
'November': '11月',
|
2219
|
+
'December': '12月',
|
2405
2220
|
|
2406
|
-
|
2407
|
-
|
2408
|
-
|
2409
|
-
|
2410
|
-
Dom.preventDefault = function(e) {
|
2411
|
-
e.preventDefault();
|
2412
|
-
e.stopPropagation();
|
2413
|
-
};
|
2414
|
-
/** @public
|
2415
|
-
* @function
|
2416
|
-
* @param {Event} e
|
2417
|
-
*/
|
2418
|
-
Dom.stopPropagation = function(e) {
|
2419
|
-
e.stopPropagation();
|
2221
|
+
'am': '午前',
|
2222
|
+
'AM': '午前',
|
2223
|
+
'pm': '午後',
|
2224
|
+
'PM': '午後'
|
2420
2225
|
};
|
2421
2226
|
|
2227
|
+
/* harmony default export */ var translation_ja = (translationJa);
|
2422
2228
|
|
2423
|
-
|
2424
|
-
|
2425
|
-
* @
|
2426
|
-
* @param {!Element|Event|MouseEvent} target
|
2427
|
-
* @param {*=} retObj An object that stores returned values
|
2428
|
-
* @return {!Object} Return object with property x and y
|
2229
|
+
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/locale/translation-zh.js
|
2230
|
+
/**
|
2231
|
+
* @namespace
|
2429
2232
|
*/
|
2430
|
-
|
2431
|
-
|
2432
|
-
|
2433
|
-
|
2434
|
-
|
2435
|
-
|
2436
|
-
|
2437
|
-
|
2438
|
-
|
2439
|
-
|
2233
|
+
var translationZh = {
|
2234
|
+
'sun': '周日',
|
2235
|
+
'mon': '周一',
|
2236
|
+
'tue': '周二',
|
2237
|
+
'wed': '周三',
|
2238
|
+
'thu': '周四',
|
2239
|
+
'fri': '周五',
|
2240
|
+
'sat': '周六',
|
2241
|
+
'Sunday': '星期日',
|
2242
|
+
'Monday': '星期一',
|
2243
|
+
'Tuesday': '星期二',
|
2244
|
+
'Wednesday': '星期三',
|
2245
|
+
'Thursday': '星期四',
|
2246
|
+
'Friday': '星期五',
|
2247
|
+
'Saturday': '星期六',
|
2440
2248
|
|
2441
|
-
|
2442
|
-
|
2443
|
-
|
2444
|
-
|
2445
|
-
|
2446
|
-
|
2447
|
-
|
2448
|
-
|
2449
|
-
|
2450
|
-
|
2451
|
-
|
2452
|
-
|
2453
|
-
|
2454
|
-
|
2455
|
-
|
2456
|
-
|
2457
|
-
|
2249
|
+
'jan': '1月',
|
2250
|
+
'feb': '2月',
|
2251
|
+
'mar': '3月',
|
2252
|
+
'apr': '4月',
|
2253
|
+
'may': '5月',
|
2254
|
+
'jun': '6月',
|
2255
|
+
'jul': '7月',
|
2256
|
+
'aug': '8月',
|
2257
|
+
'sep': '9月',
|
2258
|
+
'oct': '10月',
|
2259
|
+
'nov': '11月',
|
2260
|
+
'dec': '12月',
|
2261
|
+
'January': '一月',
|
2262
|
+
'February': '二月',
|
2263
|
+
'March': '三月',
|
2264
|
+
'April': '四月',
|
2265
|
+
'May': '五月',
|
2266
|
+
'June': '六月',
|
2267
|
+
'July': '七月',
|
2268
|
+
'August': '八月',
|
2269
|
+
'September': '九月',
|
2270
|
+
'October': '十月',
|
2271
|
+
'November': '十一月',
|
2272
|
+
'December': '十二月',
|
2458
2273
|
|
2459
|
-
|
2460
|
-
|
2461
|
-
|
2462
|
-
|
2463
|
-
/** The method returns closest ancestor element or the element itself with specified class string. Otherwise, it returns null
|
2464
|
-
* @public
|
2465
|
-
* @function
|
2466
|
-
* @param {Element|Node|undefined} elem
|
2467
|
-
* @param {string} classStr The class string can only be one single class without spaces
|
2468
|
-
* @return {Element}
|
2469
|
-
*/
|
2470
|
-
Dom.closestElement = function(elem, classStr) {
|
2471
|
-
var n = elem;
|
2472
|
-
while (n) {
|
2473
|
-
if(n.classList) { // DocumentFragment does not have classList property
|
2474
|
-
if (n.classList.contains(classStr)) {
|
2475
|
-
return /** @type{Element} */(n);
|
2476
|
-
}
|
2477
|
-
}
|
2478
|
-
n = n.parentNode || n.host; // ShadowRoot has host, but not parentNode
|
2479
|
-
}
|
2480
|
-
return null;
|
2481
|
-
};
|
2482
|
-
/** The method returns closest ancestor element or the element itself with the specified tagName. Otherwise, it returns null
|
2483
|
-
* @public
|
2484
|
-
* @function
|
2485
|
-
* @param {Element|Node|undefined} elem
|
2486
|
-
* @param {string} tn Tag name in uppercase format (e.g. "DIV")
|
2487
|
-
* @return {Element}
|
2488
|
-
*/
|
2489
|
-
Dom.closestTagName = function(elem, tn) {
|
2490
|
-
var n = elem;
|
2491
|
-
while(n) {
|
2492
|
-
if(n.tagName) {
|
2493
|
-
if(n.tagName == tn) {
|
2494
|
-
return /** @type{Element} */(n);
|
2495
|
-
}
|
2496
|
-
}
|
2497
|
-
n = n.parentNode || n.host; // ShadowRoot has host, but not parentNode
|
2498
|
-
}
|
2499
|
-
return null;
|
2274
|
+
'am': '上午',
|
2275
|
+
'AM': '上午',
|
2276
|
+
'pm': '下午',
|
2277
|
+
'PM': '下午'
|
2500
2278
|
};
|
2501
2279
|
|
2502
|
-
/* harmony default export */ var
|
2503
|
-
|
2280
|
+
/* harmony default export */ var translation_zh = (translationZh);
|
2504
2281
|
|
2505
|
-
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/
|
2506
|
-
/**
|
2507
|
-
*
|
2508
|
-
* @constructor
|
2509
|
-
* @param {(Function|number)=} func Bound function that will use this conflator
|
2510
|
-
* @param {(number|Function)=} ms The delay time in millisecond before executing the function
|
2511
|
-
* @param {*=} thisObj "this" object to be bound with the given function. If the function is already bound, there is no need to provide thisObj parameter
|
2512
|
-
* @example
|
2513
|
-
* var c = new Conflator(function() { console.log("Executed"); }, 1000);
|
2514
|
-
* for(var i = 10; --i >= 0;) {
|
2515
|
-
* c.conflate(i); // Only one "Executed" text will be logged to console after one second
|
2516
|
-
* }
|
2282
|
+
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/locale/translation-zh-hant.js
|
2283
|
+
/**
|
2284
|
+
* @namespace
|
2517
2285
|
*/
|
2518
|
-
var
|
2519
|
-
|
2520
|
-
|
2521
|
-
|
2522
|
-
|
2523
|
-
|
2524
|
-
|
2525
|
-
|
2526
|
-
|
2527
|
-
|
2286
|
+
var translationZhHant = {
|
2287
|
+
'sun': '週日',
|
2288
|
+
'mon': '週一',
|
2289
|
+
'tue': '週二',
|
2290
|
+
'wed': '週三',
|
2291
|
+
'thu': '週四',
|
2292
|
+
'fri': '週五',
|
2293
|
+
'sat': '週六',
|
2294
|
+
'Sunday': '星期日',
|
2295
|
+
'Monday': '星期一',
|
2296
|
+
'Tuesday': '星期二',
|
2297
|
+
'Wednesday': '星期三',
|
2298
|
+
'Thursday': '星期四',
|
2299
|
+
'Friday': '星期五',
|
2300
|
+
'Saturday': '星期六',
|
2528
2301
|
|
2529
|
-
|
2530
|
-
|
2531
|
-
|
2532
|
-
|
2533
|
-
|
2534
|
-
|
2302
|
+
'jan': '1月',
|
2303
|
+
'feb': '2月',
|
2304
|
+
'mar': '3月',
|
2305
|
+
'apr': '4月',
|
2306
|
+
'may': '5月',
|
2307
|
+
'jun': '6月',
|
2308
|
+
'jul': '7月',
|
2309
|
+
'aug': '8月',
|
2310
|
+
'sep': '9月',
|
2311
|
+
'oct': '10月',
|
2312
|
+
'nov': '11月',
|
2313
|
+
'dec': '12月',
|
2314
|
+
'January': '一月',
|
2315
|
+
'February': '二月',
|
2316
|
+
'March': '三月',
|
2317
|
+
'April': '四月',
|
2318
|
+
'May': '五月',
|
2319
|
+
'June': '六月',
|
2320
|
+
'July': '七月',
|
2321
|
+
'August': '八月',
|
2322
|
+
'September': '九月',
|
2323
|
+
'October': '十月',
|
2324
|
+
'November': '十一月',
|
2325
|
+
'December': '十二月',
|
2535
2326
|
|
2536
|
-
|
2537
|
-
|
2538
|
-
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
*/
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
2547
|
-
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2551
|
-
|
2552
|
-
|
2553
|
-
* @private
|
2554
|
-
*/
|
2555
|
-
Conflator.prototype._conflated = false;
|
2556
|
-
/** @type {boolean}
|
2557
|
-
* @private
|
2327
|
+
'am': '上午',
|
2328
|
+
'AM': '上午',
|
2329
|
+
'pm': '下午',
|
2330
|
+
'PM': '下午'
|
2331
|
+
};
|
2332
|
+
|
2333
|
+
/* harmony default export */ var translation_zh_hant = (translationZhHant);
|
2334
|
+
|
2335
|
+
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/locale/translation.js
|
2336
|
+
|
2337
|
+
|
2338
|
+
|
2339
|
+
|
2340
|
+
|
2341
|
+
|
2342
|
+
/**
|
2343
|
+
* @namespace
|
2558
2344
|
*/
|
2559
|
-
|
2345
|
+
var translation = {
|
2346
|
+
"en": translation_en,
|
2347
|
+
"de": translation_de,
|
2348
|
+
"ja": translation_ja,
|
2349
|
+
"zh": translation_zh,
|
2350
|
+
"zh-Hant": translation_zh_hant
|
2351
|
+
};
|
2560
2352
|
|
2353
|
+
/* harmony default export */ var locale_translation = (translation);
|
2561
2354
|
|
2562
|
-
|
2355
|
+
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/Util.js
|
2356
|
+
/** @namespace */
|
2357
|
+
var Util = {};
|
2358
|
+
|
2359
|
+
/** This is a shorthand for fetch() API by POST method and with json body <br>
|
2360
|
+
* WARNING: fetch is not supported in IE (including IE11)
|
2563
2361
|
* @public
|
2564
|
-
* @
|
2362
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch}
|
2363
|
+
* @function
|
2364
|
+
* @param {string} url
|
2365
|
+
* @param {Object|string} obj
|
2366
|
+
* @return {!Promise<Response>}
|
2565
2367
|
*/
|
2566
|
-
|
2567
|
-
|
2568
|
-
clearTimeout(this._timerId);
|
2569
|
-
this._timerId = 0;
|
2570
|
-
}
|
2571
|
-
|
2572
|
-
return this.popAllData();
|
2368
|
+
Util.post = function(url, obj) { // Not supported in IE
|
2369
|
+
return Util._post(url, obj).then(Util.toJSON);
|
2573
2370
|
};
|
2574
|
-
/**
|
2371
|
+
/** Request a server response from server as text by POST method <br>
|
2372
|
+
* WARNING: fetch is not supported in IE (including IE11)
|
2575
2373
|
* @public
|
2576
|
-
* @
|
2374
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch}
|
2375
|
+
* @function
|
2376
|
+
* @param {string} url
|
2377
|
+
* @param {Object|string} obj
|
2378
|
+
* @return {!Promise<Response>}
|
2577
2379
|
*/
|
2578
|
-
|
2579
|
-
|
2580
|
-
var data = this._data;
|
2581
|
-
this._data = [];
|
2582
|
-
return data;
|
2583
|
-
}
|
2584
|
-
return null;
|
2380
|
+
Util.requestText = function(url, obj) { // Not supported in IE
|
2381
|
+
return Util._post(url, obj, "text/plain").then(Util.toText);
|
2585
2382
|
};
|
2586
|
-
/**
|
2587
|
-
|
2588
|
-
|
2589
|
-
|
2590
|
-
|
2591
|
-
|
2592
|
-
|
2593
|
-
|
2594
|
-
|
2595
|
-
|
2383
|
+
/** Request a server response from server by POST method and with url-encoded body <br>
|
2384
|
+
* WARNING: fetch is not supported in IE (including IE11)
|
2385
|
+
* @public
|
2386
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch}
|
2387
|
+
* @function
|
2388
|
+
* @param {string} url
|
2389
|
+
* @param {string} obj
|
2390
|
+
* @return {!Promise<Response>}
|
2391
|
+
*/
|
2392
|
+
Util.requestByUrlEncoded = function(url, obj) { // Not supported in IE
|
2393
|
+
return Util._post(url, obj, "application/x-www-form-urlencoded").then(Util.toJSON);
|
2596
2394
|
};
|
2597
2395
|
|
2598
2396
|
/** @public
|
2599
|
-
* @
|
2600
|
-
* @
|
2397
|
+
* @function
|
2398
|
+
* @param {Response} resp
|
2399
|
+
* @return {!Promise<Object>}
|
2601
2400
|
*/
|
2602
|
-
|
2603
|
-
if(
|
2604
|
-
return
|
2605
|
-
}
|
2606
|
-
if(obj != null) {
|
2607
|
-
this._data.push(obj);
|
2608
|
-
}
|
2609
|
-
if(this._conflated) {
|
2610
|
-
return false; // Conflating operation is already completed
|
2611
|
-
}
|
2612
|
-
if(!this._timerId) {
|
2613
|
-
this._timerId = setTimeout(this._onConflated, this._delay);
|
2401
|
+
Util.toJSON = function (resp) {
|
2402
|
+
if(Util._logError(resp)) {
|
2403
|
+
return Promise.reject(resp);
|
2614
2404
|
}
|
2615
|
-
return
|
2405
|
+
return resp.json();
|
2616
2406
|
};
|
2617
2407
|
/** @public
|
2618
|
-
* @
|
2408
|
+
* @function
|
2409
|
+
* @param {Response} resp
|
2410
|
+
* @return {!Promise<string>}
|
2619
2411
|
*/
|
2620
|
-
|
2621
|
-
|
2412
|
+
Util.toText = function (resp) {
|
2413
|
+
if(Util._logError(resp)) {
|
2414
|
+
return Promise.reject(resp);
|
2415
|
+
}
|
2416
|
+
return resp.text();
|
2622
2417
|
};
|
2623
2418
|
|
2624
|
-
/** @private
|
2625
|
-
|
2626
|
-
|
2627
|
-
|
2628
|
-
|
2629
|
-
|
2630
|
-
|
2631
|
-
|
2419
|
+
/** @private
|
2420
|
+
* @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}
|
2421
|
+
* @function
|
2422
|
+
* @param {Response} resp
|
2423
|
+
* @return {boolean}
|
2424
|
+
*/
|
2425
|
+
Util._logError = function(resp) {
|
2426
|
+
if(resp && resp.status >= 300) {
|
2427
|
+
console.log("Response " + resp.status + ": " + resp.statusText);
|
2428
|
+
return true;
|
2632
2429
|
}
|
2633
|
-
|
2634
|
-
this._timerId = 0;
|
2635
|
-
this._data.length = 0;
|
2636
|
-
this._conflated = false;
|
2430
|
+
return false;
|
2637
2431
|
};
|
2638
|
-
|
2639
|
-
|
2640
|
-
* @
|
2432
|
+
/** @private
|
2433
|
+
* @function
|
2434
|
+
* @param {string} url
|
2435
|
+
* @param {Object|string} obj
|
2436
|
+
* @param {string=} contentType
|
2437
|
+
* @return {!Promise<Response>}
|
2641
2438
|
*/
|
2642
|
-
|
2643
|
-
|
2439
|
+
Util._post = function(url, obj, contentType) {
|
2440
|
+
var options = {
|
2441
|
+
method: obj ? "POST" : "GET",
|
2442
|
+
headers: { "Content-Type": contentType || "application/json" }
|
2443
|
+
};
|
2444
|
+
if(obj) {
|
2445
|
+
options.body = typeof obj === "string" ? obj : JSON.stringify(obj);
|
2446
|
+
}
|
2447
|
+
|
2448
|
+
return fetch(url, options);
|
2644
2449
|
};
|
2645
|
-
|
2646
|
-
|
2647
|
-
*
|
2450
|
+
|
2451
|
+
/** WARNING: Only one level of property tree is affected (i.e. no recursive or nested operation). <br>
|
2452
|
+
* Property with undefined or null value will not have an impact on the object. <br>
|
2453
|
+
* Existing properties will be overridden.
|
2454
|
+
* @public
|
2455
|
+
* @function
|
2456
|
+
* @param {Object} obj Object that is extended (new properties will be added to this object)
|
2457
|
+
* @param {Object=} extender Master object (no modification will be made on the extender)
|
2458
|
+
* @param {Array.<string>=} limiters Specify property to be extended
|
2459
|
+
* @return {Object}
|
2648
2460
|
*/
|
2649
|
-
|
2650
|
-
|
2651
|
-
|
2652
|
-
|
2653
|
-
|
2654
|
-
|
2655
|
-
|
2461
|
+
var extendObject = function (obj, extender, limiters) {
|
2462
|
+
if(!obj) { // null undefined NaN empty string and 0
|
2463
|
+
return null;
|
2464
|
+
}
|
2465
|
+
if(!extender || obj === extender) {
|
2466
|
+
return obj;
|
2467
|
+
}
|
2468
|
+
|
2469
|
+
var key;
|
2470
|
+
if(limiters) {
|
2471
|
+
var len = limiters.length;
|
2472
|
+
for(var i = 0; i < len; ++i) {
|
2473
|
+
key = limiters[i];
|
2474
|
+
if(key) {
|
2475
|
+
extendProperty(obj, extender, key);
|
2476
|
+
}
|
2656
2477
|
}
|
2657
2478
|
} else {
|
2658
|
-
|
2479
|
+
for(key in extender) {
|
2480
|
+
extendProperty(obj, extender, key);
|
2481
|
+
}
|
2659
2482
|
}
|
2483
|
+
return obj;
|
2660
2484
|
};
|
2661
|
-
/**
|
2662
|
-
*
|
2485
|
+
/** WARNING: Only one level of property tree is affected (i.e. no recursive or nested operation). <br>
|
2486
|
+
* Property with undefined or null value will not be cloned.
|
2487
|
+
* @public
|
2488
|
+
* @function
|
2489
|
+
* @param {Object} obj
|
2490
|
+
* @param {Array.<string>=} limiters
|
2491
|
+
* @return {Object}
|
2663
2492
|
*/
|
2664
|
-
|
2665
|
-
|
2666
|
-
if(this._delay < 0) {
|
2667
|
-
this._delay = 0;
|
2668
|
-
}
|
2493
|
+
var cloneObject = function (obj, limiters) {
|
2494
|
+
return extendObject({}, obj, limiters);
|
2669
2495
|
};
|
2670
2496
|
|
2671
|
-
/**
|
2672
|
-
* @
|
2497
|
+
/** Check empty object
|
2498
|
+
* @public
|
2499
|
+
* @function
|
2500
|
+
* @param {Object} obj
|
2501
|
+
* @return {boolean}=true, if the obj is empty
|
2673
2502
|
*/
|
2674
|
-
|
2675
|
-
|
2503
|
+
var isEmptyObject = function (obj) {
|
2504
|
+
for (var key in obj) {
|
2505
|
+
return false;
|
2506
|
+
}
|
2507
|
+
return true;
|
2676
2508
|
};
|
2677
2509
|
|
2678
2510
|
/** @public
|
2679
|
-
* @param {
|
2511
|
+
* @param {Array=} data
|
2512
|
+
* @param {Array.<string>=} fields In case of the given data is an array, this param will be used for mapping index to field
|
2513
|
+
* @return {Object|null}
|
2680
2514
|
*/
|
2681
|
-
|
2682
|
-
|
2515
|
+
var arrayToObject = function(data, fields) {
|
2516
|
+
if(!Array.isArray(data)) {
|
2517
|
+
return data;
|
2518
|
+
} else if(!fields) {
|
2519
|
+
return null;
|
2520
|
+
}
|
2521
|
+
var ary = data;
|
2522
|
+
data = {};
|
2523
|
+
var len = ary.length;
|
2524
|
+
for(var i = 0; i < len; ++i) {
|
2525
|
+
var field = fields[i];
|
2526
|
+
// eslint-disable-next-line no-undefined
|
2527
|
+
if(field && ary[i] !== undefined) {
|
2528
|
+
data[field] = ary[i];
|
2529
|
+
}
|
2530
|
+
}
|
2531
|
+
return data;
|
2683
2532
|
};
|
2684
|
-
/**
|
2685
|
-
* @
|
2533
|
+
/** Replace the specified property with the value from the extender. If the value is an array, the value will be added to the array instead of replacement
|
2534
|
+
* @public
|
2535
|
+
* @function
|
2536
|
+
* @param {Object} obj
|
2537
|
+
* @param {Object} extender
|
2538
|
+
* @param {string} propName
|
2539
|
+
* @example
|
2540
|
+
* extendProperty({a: 0}, {a: 1}, "a"); // {a: 1}
|
2541
|
+
* extendProperty({a: 0}, {b: 1}, "b"); // {a: 0, b: 1}
|
2542
|
+
* extendProperty({a: [0]}, {a: 1}, "a"); // {a: [0, 1]}
|
2543
|
+
* extendProperty({a: [0]}, {a: [1, 2]}, "a"); // {a: [0, 1, 2]}
|
2686
2544
|
*/
|
2687
|
-
|
2688
|
-
|
2545
|
+
var extendProperty = function (obj, extender, propName) {
|
2546
|
+
var val = extender[propName];
|
2547
|
+
if(val != null) {
|
2548
|
+
var objVal = obj[propName];
|
2549
|
+
if(Array.isArray(objVal)) {
|
2550
|
+
obj[propName] = objVal.concat(val);
|
2551
|
+
} else if(Array.isArray(val) && objVal) {
|
2552
|
+
obj[propName] = val.concat(objVal); // TODO: Preserve the order
|
2553
|
+
} else {
|
2554
|
+
obj[propName] = val; // WARNING: Overriding existing data
|
2555
|
+
}
|
2556
|
+
}
|
2689
2557
|
};
|
2690
|
-
|
2691
|
-
|
2558
|
+
|
2559
|
+
|
2560
|
+
/** Compare the values of obj1 and obj2. if they are the same object or have the same value, the result will be true. Otherwise, it will return false.
|
2561
|
+
* @public
|
2562
|
+
* @param {*} obj1
|
2563
|
+
* @param {*} obj2
|
2564
|
+
* @return {boolean}
|
2692
2565
|
*/
|
2693
|
-
|
2694
|
-
this._disabled = opt_enabled === false;
|
2695
|
-
};
|
2566
|
+
var deepEqual = function (obj1, obj2) {
|
2696
2567
|
|
2697
|
-
|
2568
|
+
if(obj1 === obj2) {
|
2569
|
+
return true;
|
2570
|
+
}
|
2698
2571
|
|
2572
|
+
if (typeof obj1 !== typeof obj2) {
|
2573
|
+
return false;
|
2574
|
+
}
|
2699
2575
|
|
2700
|
-
|
2701
|
-
var Ext = __webpack_require__(0);
|
2576
|
+
if (typeof obj1 === "object") {
|
2702
2577
|
|
2703
|
-
//
|
2704
|
-
|
2578
|
+
// We need to split array and object for performance reason
|
2579
|
+
if(Array.isArray(obj1)) {
|
2580
|
+
if(obj1.length !== obj2.length) {
|
2581
|
+
return false;
|
2582
|
+
}
|
2705
2583
|
|
2706
|
-
|
2707
|
-
|
2584
|
+
for (var i = 0; i < obj1.length; i++) {
|
2585
|
+
if (!deepEqual(obj1[i], obj2[i])) { // The array may not be a match if the elements are not sorted, so it will not be considered equal if there is a mismatch.
|
2586
|
+
return false;
|
2587
|
+
}
|
2588
|
+
}
|
2708
2589
|
|
2709
|
-
|
2710
|
-
/**
|
2711
|
-
* @namespace
|
2712
|
-
*/
|
2713
|
-
var translationEn = {
|
2714
|
-
"sun": "Sun",
|
2715
|
-
"mon": "Mon",
|
2716
|
-
"tue": "Tue",
|
2717
|
-
"wed": "Wed",
|
2718
|
-
"thu": "Thu",
|
2719
|
-
"fri": "Fri",
|
2720
|
-
"sat": "Sat",
|
2721
|
-
"Sunday": "Sunday",
|
2722
|
-
"Monday": "Monday",
|
2723
|
-
"Tuesday": "Tuesday",
|
2724
|
-
"Wednesday": "Wednesday",
|
2725
|
-
"Thursday": "Thursday",
|
2726
|
-
"Friday": "Friday",
|
2727
|
-
"Saturday": "Saturday",
|
2590
|
+
} else {
|
2728
2591
|
|
2729
|
-
|
2730
|
-
|
2731
|
-
|
2732
|
-
"apr": "Apr",
|
2733
|
-
"may": "May",
|
2734
|
-
"jun": "Jun",
|
2735
|
-
"jul": "Jul",
|
2736
|
-
"aug": "Aug",
|
2737
|
-
"sep": "Sep",
|
2738
|
-
"oct": "Oct",
|
2739
|
-
"nov": "Nov",
|
2740
|
-
"dec": "Dec",
|
2741
|
-
"January": "January",
|
2742
|
-
"February": "February",
|
2743
|
-
"March": "March",
|
2744
|
-
"April": "April",
|
2745
|
-
"May": "May",
|
2746
|
-
"June": "June",
|
2747
|
-
"July": "July",
|
2748
|
-
"August": "August",
|
2749
|
-
"September": "September",
|
2750
|
-
"October": "October",
|
2751
|
-
"November": "November",
|
2752
|
-
"December": "December",
|
2592
|
+
if (Object.keys(obj1).length !== Object.keys(obj2).length) {
|
2593
|
+
return false;
|
2594
|
+
}
|
2753
2595
|
|
2754
|
-
|
2755
|
-
|
2756
|
-
|
2757
|
-
|
2758
|
-
}
|
2596
|
+
for (var key in obj1) {
|
2597
|
+
if (!deepEqual(obj1[key], obj2[key])) {
|
2598
|
+
return false;
|
2599
|
+
}
|
2600
|
+
}
|
2601
|
+
}
|
2759
2602
|
|
2760
|
-
/* harmony default export */ var translation_en = (translationEn);
|
2761
2603
|
|
2762
|
-
|
2763
|
-
|
2764
|
-
|
2604
|
+
return true;
|
2605
|
+
}
|
2606
|
+
|
2607
|
+
return false;
|
2608
|
+
|
2609
|
+
};
|
2610
|
+
/** Array.push() is much faster than Array.concat(). The downside is the parameters must be an array, whereas concat() has no such requirement. <br>
|
2611
|
+
* This method excels in extending known array property in an object.
|
2612
|
+
* @public
|
2613
|
+
* @function
|
2614
|
+
* @param {Object} obj
|
2615
|
+
* @param {string} propName
|
2616
|
+
* @param {*} ary
|
2617
|
+
* @return {Array} Returns the result of the extended array
|
2618
|
+
* @see {@link https://dev.to/uilicious/javascript-array-push-is-945x-faster-than-array-concat-1oki}
|
2619
|
+
* @example
|
2620
|
+
* var obj = {};
|
2621
|
+
* extendArrayProperty(obj, "prop1", 1); // [1]
|
2622
|
+
* extendArrayProperty(obj, "prop1", 2); // [1, 2]
|
2623
|
+
* extendArrayProperty(obj, "prop1", [3, 4]); // [1, 2, 3, 4]
|
2624
|
+
* obj.prop2 = 5;
|
2625
|
+
* extendArrayProperty(obj, "prop2", 6); // [5, 6]
|
2626
|
+
* extendArrayProperty(obj, "prop2", [7]); // [5, 6, 7]
|
2627
|
+
* extendArrayProperty(obj, "prop2", null); // null
|
2765
2628
|
*/
|
2766
|
-
var
|
2767
|
-
|
2768
|
-
|
2769
|
-
|
2770
|
-
|
2771
|
-
|
2772
|
-
|
2773
|
-
|
2774
|
-
|
2775
|
-
|
2776
|
-
|
2777
|
-
|
2778
|
-
|
2779
|
-
|
2780
|
-
"Saturday": "Samstag",
|
2629
|
+
var extendArrayProperty = function (obj, propName, ary) {
|
2630
|
+
var objAry = null;
|
2631
|
+
if(ary) {
|
2632
|
+
var objVal = obj[propName];
|
2633
|
+
if(objVal) {
|
2634
|
+
if(Array.isArray(objVal)) {
|
2635
|
+
objAry = objVal;
|
2636
|
+
} else {
|
2637
|
+
objAry = obj[propName] = [objVal];
|
2638
|
+
}
|
2639
|
+
} else {
|
2640
|
+
objAry = obj[propName] = [];
|
2641
|
+
}
|
2642
|
+
// objAry is guaranteed to be an array at this point
|
2781
2643
|
|
2782
|
-
|
2783
|
-
|
2784
|
-
|
2785
|
-
|
2786
|
-
|
2787
|
-
|
2788
|
-
|
2789
|
-
|
2790
|
-
|
2791
|
-
|
2792
|
-
|
2793
|
-
|
2794
|
-
|
2795
|
-
|
2796
|
-
"March": "März",
|
2797
|
-
"April": "April",
|
2798
|
-
"May": "Mai",
|
2799
|
-
"June": "Juni",
|
2800
|
-
"July": "Juli",
|
2801
|
-
"August": "August",
|
2802
|
-
"September": "September",
|
2803
|
-
"October": "Oktober",
|
2804
|
-
"November": "November",
|
2805
|
-
"December": "Dezember",
|
2644
|
+
if(Array.isArray(ary)) {
|
2645
|
+
if(ary.length) {
|
2646
|
+
if(ary.length > 1) {
|
2647
|
+
Array.prototype.push.apply(objAry, ary);
|
2648
|
+
} else {
|
2649
|
+
objAry.push(ary[0]);
|
2650
|
+
}
|
2651
|
+
}
|
2652
|
+
} else {
|
2653
|
+
objAry.push(ary);
|
2654
|
+
}
|
2655
|
+
}
|
2656
|
+
return objAry;
|
2657
|
+
};
|
2806
2658
|
|
2807
|
-
|
2808
|
-
|
2809
|
-
|
2810
|
-
|
2659
|
+
/** @private
|
2660
|
+
* @param {string|Array.<string>} item
|
2661
|
+
* @return {string}
|
2662
|
+
*/
|
2663
|
+
var _encloseBracket = function(item) {
|
2664
|
+
return Array.isArray(item) ? "{\n" + item.join("\n") + "\n}" : item;
|
2665
|
+
};
|
2666
|
+
/** @private
|
2667
|
+
* @param {string} str
|
2668
|
+
* @return {string}
|
2669
|
+
*/
|
2670
|
+
var _indentBracketContent = function(str){
|
2671
|
+
return str.replace(/\n+/g, "\n\t").replace(/\n\t}$/, "\n}");
|
2672
|
+
};
|
2673
|
+
/** @public
|
2674
|
+
* @param {string|Array} css
|
2675
|
+
* @return {string} prettified CSS string
|
2676
|
+
* @example
|
2677
|
+
* prettifyCss(["div", [
|
2678
|
+
* "color: red;",
|
2679
|
+
* "padding: 20px;"
|
2680
|
+
* ],
|
2681
|
+
* ".class", [
|
2682
|
+
* "margin: 0;"
|
2683
|
+
* ]
|
2684
|
+
* ]);
|
2685
|
+
*/
|
2686
|
+
var prettifyCss = function(css) {
|
2687
|
+
if(css) {
|
2688
|
+
var cssStr = "";
|
2689
|
+
if (Array.isArray(css)) {
|
2690
|
+
var ary = css.map(_encloseBracket);
|
2691
|
+
cssStr = ary.join("\n").replace(/{\s*{/g, "{").replace(/\s+{/g, " {");
|
2692
|
+
} else {
|
2693
|
+
cssStr = (typeof css === "string") ? css : css + "";
|
2694
|
+
}
|
2695
|
+
|
2696
|
+
if(cssStr) {
|
2697
|
+
return cssStr.replace(/{[\w\W]*?}/g, _indentBracketContent);
|
2698
|
+
}
|
2699
|
+
}
|
2700
|
+
return "";
|
2701
|
+
};
|
2702
|
+
/** Get shadow root of the given element regardless of whether the element is in the DOM or not. The immediate shadow root parent is returned in case of nested shadow roots. Any other case return null.
|
2703
|
+
* @public
|
2704
|
+
* @param {Element} elem
|
2705
|
+
* @return {DocumentFragment}
|
2706
|
+
*/
|
2707
|
+
var getShadowRoot = function(elem) {
|
2708
|
+
if(elem) {
|
2709
|
+
var rootNode;
|
2710
|
+
if(elem.shadowRoot) {
|
2711
|
+
rootNode = elem.shadowRoot;
|
2712
|
+
} else if(elem.getRootNode) {
|
2713
|
+
rootNode = elem.getRootNode();
|
2714
|
+
}
|
2715
|
+
if(rootNode) { // getRootNode does not supported in IE. It should be implemented by the polyfills
|
2716
|
+
if(rootNode !== document) { // element that is in the DOM and not in the shadow has document as its root node
|
2717
|
+
if(rootNode !== elem) { // element that is NOT in the DOM and not in the shadow has itself as its root node
|
2718
|
+
return rootNode;
|
2719
|
+
}
|
2720
|
+
}
|
2721
|
+
}
|
2722
|
+
}
|
2723
|
+
return null;
|
2811
2724
|
};
|
2812
|
-
|
2813
|
-
|
2814
|
-
|
2815
|
-
|
2816
|
-
|
2817
|
-
* @namespace
|
2725
|
+
/** Attach style tag to the proper document (in case of element inside a shadow root)
|
2726
|
+
* @public
|
2727
|
+
* @param {string} cssStr Valid CSS string (e.g. "div {color: red;}")
|
2728
|
+
* @param {Element=} targetContext Element that needs the CSS
|
2729
|
+
* @return {Element} New style tag
|
2818
2730
|
*/
|
2819
|
-
var
|
2820
|
-
|
2821
|
-
|
2822
|
-
|
2823
|
-
'wed': '水',
|
2824
|
-
'thu': '木',
|
2825
|
-
'fri': '金',
|
2826
|
-
'sat': '土',
|
2827
|
-
'Sunday': '日曜日',
|
2828
|
-
'Monday': '月曜日',
|
2829
|
-
'Tuesday': '火曜日',
|
2830
|
-
'Wednesday': '水曜日',
|
2831
|
-
'Thursday': '木曜日',
|
2832
|
-
'Friday': '金曜日',
|
2833
|
-
'Saturday': '土曜日',
|
2731
|
+
var injectCss = function(cssStr, targetContext) {
|
2732
|
+
if(!cssStr) {
|
2733
|
+
return null;
|
2734
|
+
}
|
2834
2735
|
|
2835
|
-
|
2836
|
-
|
2837
|
-
'mar': '3月',
|
2838
|
-
'apr': '4月',
|
2839
|
-
'may': '5月',
|
2840
|
-
'jun': '6月',
|
2841
|
-
'jul': '7月',
|
2842
|
-
'aug': '8月',
|
2843
|
-
'sep': '9月',
|
2844
|
-
'oct': '10月',
|
2845
|
-
'nov': '11月',
|
2846
|
-
'dec': '12月',
|
2847
|
-
'January': '1月',
|
2848
|
-
'February': '2月',
|
2849
|
-
'March': '3月',
|
2850
|
-
'April': '4月',
|
2851
|
-
'May': '5月',
|
2852
|
-
'June': '6月',
|
2853
|
-
'July': '7月',
|
2854
|
-
'August': '8月',
|
2855
|
-
'September': '9月',
|
2856
|
-
'October': '10月',
|
2857
|
-
'November': '11月',
|
2858
|
-
'December': '12月',
|
2736
|
+
var styleTag = document.createElement("style");
|
2737
|
+
styleTag.textContent = "\n" + cssStr + "\n";
|
2859
2738
|
|
2860
|
-
|
2861
|
-
|
2862
|
-
|
2863
|
-
|
2864
|
-
|
2739
|
+
var styleHost = getShadowRoot(targetContext);
|
2740
|
+
var isInShadow = true;
|
2741
|
+
if(!styleHost) {
|
2742
|
+
isInShadow = false;
|
2743
|
+
styleHost = document.head;
|
2744
|
+
}
|
2865
2745
|
|
2866
|
-
|
2746
|
+
// Find a place to insert the style tag
|
2747
|
+
var beforeElem;
|
2748
|
+
if(isInShadow) {
|
2749
|
+
if(styleHost.children && styleHost.children.length) {
|
2750
|
+
beforeElem = styleHost.children[0];
|
2751
|
+
}
|
2752
|
+
}
|
2753
|
+
if(beforeElem) {
|
2754
|
+
styleHost.insertBefore(styleTag, beforeElem);
|
2755
|
+
} else {
|
2756
|
+
styleHost.appendChild(styleTag);
|
2757
|
+
}
|
2758
|
+
return styleTag;
|
2759
|
+
};
|
2867
2760
|
|
2868
|
-
|
2869
|
-
|
2870
|
-
* @
|
2761
|
+
/** return true if browser is IE or Edge
|
2762
|
+
* @public
|
2763
|
+
* @return {boolean}
|
2871
2764
|
*/
|
2872
|
-
var
|
2873
|
-
|
2874
|
-
'
|
2875
|
-
|
2876
|
-
'wed': '周三',
|
2877
|
-
'thu': '周四',
|
2878
|
-
'fri': '周五',
|
2879
|
-
'sat': '周六',
|
2880
|
-
'Sunday': '星期日',
|
2881
|
-
'Monday': '星期一',
|
2882
|
-
'Tuesday': '星期二',
|
2883
|
-
'Wednesday': '星期三',
|
2884
|
-
'Thursday': '星期四',
|
2885
|
-
'Friday': '星期五',
|
2886
|
-
'Saturday': '星期六',
|
2887
|
-
|
2888
|
-
'jan': '1月',
|
2889
|
-
'feb': '2月',
|
2890
|
-
'mar': '3月',
|
2891
|
-
'apr': '4月',
|
2892
|
-
'may': '5月',
|
2893
|
-
'jun': '6月',
|
2894
|
-
'jul': '7月',
|
2895
|
-
'aug': '8月',
|
2896
|
-
'sep': '9月',
|
2897
|
-
'oct': '10月',
|
2898
|
-
'nov': '11月',
|
2899
|
-
'dec': '12月',
|
2900
|
-
'January': '一月',
|
2901
|
-
'February': '二月',
|
2902
|
-
'March': '三月',
|
2903
|
-
'April': '四月',
|
2904
|
-
'May': '五月',
|
2905
|
-
'June': '六月',
|
2906
|
-
'July': '七月',
|
2907
|
-
'August': '八月',
|
2908
|
-
'September': '九月',
|
2909
|
-
'October': '十月',
|
2910
|
-
'November': '十一月',
|
2911
|
-
'December': '十二月',
|
2765
|
+
var isIE = function () {
|
2766
|
+
var ua = window.navigator.userAgent;
|
2767
|
+
return (ua.indexOf('MSIE ') > 0) || (ua.indexOf('Trident/') > 0) || (ua.indexOf('Edge/') > 0);
|
2768
|
+
};
|
2912
2769
|
|
2913
|
-
|
2914
|
-
|
2915
|
-
|
2916
|
-
|
2770
|
+
/** return true if device is mac
|
2771
|
+
* @public
|
2772
|
+
* @return {boolean}
|
2773
|
+
*/
|
2774
|
+
var isMac = function () {
|
2775
|
+
return /Mac/.test(navigator.platform);
|
2917
2776
|
};
|
2918
2777
|
|
2919
|
-
|
2778
|
+
/** Return true if device is mac
|
2779
|
+
* @public
|
2780
|
+
* @return {boolean}
|
2781
|
+
*/
|
2782
|
+
var isTouchDevice = function () {
|
2783
|
+
if ((navigator["maxTouchPoints"] && navigator["maxTouchPoints"] < 256) ||
|
2784
|
+
(navigator["msMaxTouchPoints"] && navigator["msMaxTouchPoints"] < 256)) {
|
2785
|
+
return true;
|
2786
|
+
}
|
2787
|
+
return false;
|
2788
|
+
};
|
2920
2789
|
|
2921
|
-
|
2922
|
-
|
2923
|
-
* @
|
2790
|
+
/** parse nested object in to array
|
2791
|
+
* @public
|
2792
|
+
* @param {Object} obj
|
2793
|
+
* @param {Array=} ary
|
2794
|
+
* @return {Array}
|
2924
2795
|
*/
|
2925
|
-
var
|
2926
|
-
|
2927
|
-
|
2928
|
-
|
2929
|
-
|
2930
|
-
|
2931
|
-
|
2932
|
-
|
2933
|
-
|
2934
|
-
|
2935
|
-
|
2936
|
-
|
2937
|
-
|
2938
|
-
|
2939
|
-
'Saturday': '星期六',
|
2796
|
+
var nestedObjectToArray = function (obj, ary) {
|
2797
|
+
if (!ary) {
|
2798
|
+
ary = [];
|
2799
|
+
}
|
2800
|
+
for (var key in obj) {
|
2801
|
+
var element = obj[key];
|
2802
|
+
if ('object' === typeof element) {
|
2803
|
+
nestedObjectToArray(element, ary);
|
2804
|
+
} else {
|
2805
|
+
ary.push(element);
|
2806
|
+
}
|
2807
|
+
}
|
2808
|
+
return ary;
|
2809
|
+
};
|
2940
2810
|
|
2941
|
-
|
2942
|
-
|
2943
|
-
|
2944
|
-
|
2945
|
-
|
2946
|
-
|
2947
|
-
|
2948
|
-
|
2949
|
-
|
2950
|
-
|
2951
|
-
|
2952
|
-
|
2953
|
-
|
2954
|
-
|
2955
|
-
|
2956
|
-
|
2957
|
-
|
2958
|
-
|
2959
|
-
|
2960
|
-
|
2961
|
-
|
2962
|
-
|
2963
|
-
|
2964
|
-
|
2811
|
+
/** Convert CSS rgb or rgba formats to CSS hex color string (# prefix)
|
2812
|
+
* @public
|
2813
|
+
* @param {string} rgbCode
|
2814
|
+
* @return {string}
|
2815
|
+
* @example
|
2816
|
+
* rgb2Hex("rgb(255, 255, 0)"); // "#FFFF00"
|
2817
|
+
* rgb2Hex("rgba(255, 255, 0, 1)"); // "#FFFF00"
|
2818
|
+
* rgb2Hex("255 255.0"); // "#FFFF00"
|
2819
|
+
* rgb2Hex("#FFFF00"); // "#FFFF00"
|
2820
|
+
* rgb2Hex("#1a1a1a"); // "#1a1a1a"
|
2821
|
+
* rgb2Hex("2552550"); // "2552550"
|
2822
|
+
* rgb2Hex("invalid"); // "invalid"
|
2823
|
+
* rgb2Hex(null); // ""
|
2824
|
+
*/
|
2825
|
+
var rgb2Hex = function (rgbCode) {
|
2826
|
+
if(!rgbCode || typeof rgbCode !== "string") {
|
2827
|
+
return "";
|
2828
|
+
}
|
2829
|
+
if(rgbCode.charAt(0) === "#") {
|
2830
|
+
return rgbCode;
|
2831
|
+
}
|
2832
|
+
var rgb = rgbCode.match(/\d+/g);
|
2833
|
+
if(!rgb || rgb.length < 3) {
|
2834
|
+
return rgbCode;
|
2835
|
+
}
|
2965
2836
|
|
2966
|
-
|
2967
|
-
|
2968
|
-
|
2969
|
-
|
2837
|
+
var hex = "#";
|
2838
|
+
for(var i = 0; i < 3; i++) {
|
2839
|
+
var num = +rgb[i];
|
2840
|
+
if(!(num >= 16)) { // Handle NaN case
|
2841
|
+
hex += "0";
|
2842
|
+
}
|
2843
|
+
hex += (num) ? num.toString(16).toUpperCase() : "0";
|
2844
|
+
}
|
2845
|
+
return hex;
|
2970
2846
|
};
|
2971
2847
|
|
2972
|
-
|
2973
|
-
|
2974
|
-
|
2848
|
+
/** transform data to tab seperated value
|
2849
|
+
* @public
|
2850
|
+
* @param {*} data
|
2851
|
+
* @return {string}
|
2852
|
+
*/
|
2853
|
+
var prepareTSVContent = function (data) {
|
2854
|
+
if (data == null) {
|
2855
|
+
return "";
|
2856
|
+
}
|
2975
2857
|
|
2858
|
+
var content = (typeof data === 'string') ? data : data.toString();
|
2976
2859
|
|
2860
|
+
if (!content.length) { return ""; }
|
2977
2861
|
|
2862
|
+
// Replace any new line and tab
|
2863
|
+
if (content.indexOf("\n") >= 0) {
|
2864
|
+
content = content.replace(/[\r\n]/g, " ");
|
2865
|
+
}
|
2978
2866
|
|
2867
|
+
if (content.indexOf("\t") >= 0) {
|
2868
|
+
content = content.replace(/\t/g, " ");
|
2869
|
+
}
|
2979
2870
|
|
2871
|
+
// Trim front and back spaces
|
2872
|
+
if (content.charAt(0) === " " || content.charAt(content.length - 1) === " ") {
|
2873
|
+
content = content.trim();
|
2874
|
+
}
|
2980
2875
|
|
2981
|
-
|
2982
|
-
* @namespace
|
2983
|
-
*/
|
2984
|
-
var translation = {
|
2985
|
-
"en": translation_en,
|
2986
|
-
"de": translation_de,
|
2987
|
-
"ja": translation_ja,
|
2988
|
-
"zh": translation_zh,
|
2989
|
-
"zh-Hant": translation_zh_hant
|
2876
|
+
return content;
|
2990
2877
|
};
|
2991
2878
|
|
2992
|
-
/* harmony default export */ var
|
2879
|
+
/* harmony default export */ var es6_Util = (Util);
|
2993
2880
|
|
2994
|
-
// EXTERNAL MODULE: ./node_modules/tr-grid-util/es6/Util.js
|
2995
|
-
var Util = __webpack_require__(1);
|
2996
2881
|
|
2997
2882
|
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/Deferred.js
|
2998
2883
|
/** Deferred promise should be used when asynchronous method does not return promise object (e.g. typical AJAX calls, or native setTimeout()). In other words, deferred promise is used to allow any non-promise logics to be worked in promise pattern.
|
@@ -3543,7 +3428,7 @@ ElfUtil.injectIcons = function (configObj, optElem) {
|
|
3543
3428
|
*/
|
3544
3429
|
ElfUtil.getIconList = function () {
|
3545
3430
|
var iconStruct = ElfUtil._icons[ElfUtil.getThemeName()];
|
3546
|
-
return iconStruct ?
|
3431
|
+
return iconStruct ? nestedObjectToArray(iconStruct) : [];
|
3547
3432
|
};
|
3548
3433
|
|
3549
3434
|
/** @private
|
@@ -3835,9 +3720,9 @@ ElfUtil._retrieveThemeColors = function(profileName) {
|
|
3835
3720
|
}
|
3836
3721
|
}
|
3837
3722
|
// WARNING: Computed styles return rgb/rgba color format instead of hex format
|
3838
|
-
colors["tableBg"] =
|
3839
|
-
colors["tableText"] =
|
3840
|
-
colors["tableBorder"] =
|
3723
|
+
colors["tableBg"] = rgb2Hex(colors["tableBg"]);
|
3724
|
+
colors["tableText"] = rgb2Hex(colors["tableText"]);
|
3725
|
+
colors["tableBorder"] = rgb2Hex(colors["tableBorder"]);
|
3841
3726
|
document.body.removeChild(tableElem);
|
3842
3727
|
|
3843
3728
|
// For CellPainter backward compatability
|
@@ -7297,7 +7182,7 @@ var Engine = function() {
|
|
7297
7182
|
// this.addEventListener("dataRequired");
|
7298
7183
|
// this.addEventListener("formulaChanged");
|
7299
7184
|
};
|
7300
|
-
|
7185
|
+
es6_Ext.inherits(Engine, es6_EventDispatcher);
|
7301
7186
|
/** @private
|
7302
7187
|
* @type {Object.<string, *>}
|
7303
7188
|
*/
|
@@ -7407,11 +7292,11 @@ Engine.prototype._defaultFormulaDataSetter = function(formula, result, rowData,
|
|
7407
7292
|
*/
|
7408
7293
|
Engine.prototype.addFormula = function(userInput) {
|
7409
7294
|
var f;
|
7410
|
-
if(userInput instanceof
|
7295
|
+
if(userInput instanceof formula_Formula){
|
7411
7296
|
f = userInput;
|
7412
7297
|
} else {
|
7413
7298
|
this._rowData = {}; // Formula will be tested in the initialization process. So we need to mock the cached data.
|
7414
|
-
f = new
|
7299
|
+
f = new formula_Formula(/** @type{string}*/(userInput), this._context);
|
7415
7300
|
this._rowData = null;
|
7416
7301
|
}
|
7417
7302
|
|
@@ -7428,10 +7313,10 @@ Engine.prototype.addFormula = function(userInput) {
|
|
7428
7313
|
*/
|
7429
7314
|
Engine.prototype.mockFormula = function(userInput) {
|
7430
7315
|
var f;
|
7431
|
-
if(userInput instanceof
|
7432
|
-
f = new
|
7316
|
+
if(userInput instanceof formula_Formula){
|
7317
|
+
f = new formula_Formula(userInput.getInput(), this._context);
|
7433
7318
|
} else {
|
7434
|
-
f = new
|
7319
|
+
f = new formula_Formula(/** @type{string}*/(userInput), this._context);
|
7435
7320
|
}
|
7436
7321
|
|
7437
7322
|
return f;
|
@@ -7441,7 +7326,7 @@ Engine.prototype.mockFormula = function(userInput) {
|
|
7441
7326
|
* @return {Formula}
|
7442
7327
|
*/
|
7443
7328
|
Engine.prototype.removeFormula = function(ref) {
|
7444
|
-
if(ref instanceof
|
7329
|
+
if(ref instanceof formula_Formula) { // Convert Formula to index
|
7445
7330
|
ref = this._formulas.indexOf(/** @type{Formula} */(ref));
|
7446
7331
|
}
|
7447
7332
|
|
@@ -7551,7 +7436,7 @@ Engine.prototype.addReference = function(src, ref) {
|
|
7551
7436
|
}
|
7552
7437
|
ref = this._generateUniqueReference(ref);
|
7553
7438
|
var colName = "";
|
7554
|
-
if (src instanceof
|
7439
|
+
if (src instanceof formula_Formula) {
|
7555
7440
|
var res = this._setFormulaReference(src, ref);
|
7556
7441
|
if (!res) {
|
7557
7442
|
return "";
|
@@ -8586,7 +8471,7 @@ var DataCache_DataCache = function () {
|
|
8586
8471
|
_t._addEvent("dataComposed");
|
8587
8472
|
_t._addEvent("dataChanged");
|
8588
8473
|
};
|
8589
|
-
|
8474
|
+
es6_Ext.inherits(DataCache_DataCache, event_EventDispatcher);
|
8590
8475
|
|
8591
8476
|
//#region Public
|
8592
8477
|
/**
|
@@ -9897,7 +9782,7 @@ var Segment = function(rid, sharedObj) {
|
|
9897
9782
|
this._children = {};
|
9898
9783
|
this._shared = sharedObj;
|
9899
9784
|
};
|
9900
|
-
|
9785
|
+
es6_Ext.inherits(Segment, es6_EventDispatcher);
|
9901
9786
|
|
9902
9787
|
/** @private
|
9903
9788
|
* @function
|
@@ -10671,7 +10556,7 @@ var SegmentCollection = function() {
|
|
10671
10556
|
dirtyCollapsingState: false
|
10672
10557
|
};
|
10673
10558
|
};
|
10674
|
-
|
10559
|
+
es6_Ext.inherits(SegmentCollection, es6_EventDispatcher);
|
10675
10560
|
|
10676
10561
|
|
10677
10562
|
/** @type {!Object.<string, Segment>}
|
@@ -11300,7 +11185,7 @@ var DataTable = function() {
|
|
11300
11185
|
|
11301
11186
|
this._addEvent("subSegmentChanged");
|
11302
11187
|
};
|
11303
|
-
|
11188
|
+
es6_Ext.inherits(DataTable, data_DataCache);
|
11304
11189
|
|
11305
11190
|
/** @private
|
11306
11191
|
* @type {Object.<string, Object.<string, *>>}
|
@@ -13431,8 +13316,9 @@ RowDefinition.prototype.initialize = function(rowOptions) {
|
|
13431
13316
|
}
|
13432
13317
|
|
13433
13318
|
val = rowOptions["collapsed"];
|
13434
|
-
|
13435
|
-
|
13319
|
+
var collapsed = extractedOptions["collapsed"];
|
13320
|
+
if(val != null || !collapsed){
|
13321
|
+
this._expanded = !collapsed;
|
13436
13322
|
}
|
13437
13323
|
val = rowOptions["keepModel"];
|
13438
13324
|
if(val) {
|
@@ -13441,7 +13327,7 @@ RowDefinition.prototype.initialize = function(rowOptions) {
|
|
13441
13327
|
|
13442
13328
|
var symbol = this._ric || this._chainRic;
|
13443
13329
|
if(symbol || this._permId){
|
13444
|
-
this.setContent(symbol,
|
13330
|
+
this.setContent(symbol, extractedOptions); // this._dataId is modified
|
13445
13331
|
}
|
13446
13332
|
|
13447
13333
|
val = rowOptions["values"];
|
@@ -13476,12 +13362,10 @@ RowDefinition.prototype._initializeAsConstituent = function(rowOptions) {
|
|
13476
13362
|
/** @public
|
13477
13363
|
* @ignore
|
13478
13364
|
* @param {string} userInput RIC
|
13479
|
-
* @param {
|
13480
|
-
* @param {boolean=} asChain
|
13481
|
-
* @param {boolean=} expanded
|
13365
|
+
* @param {Object} extractedOptions
|
13482
13366
|
* @return {boolean} True if there is any change otherwise false
|
13483
13367
|
*/
|
13484
|
-
RowDefinition.prototype.setContent = function(userInput,
|
13368
|
+
RowDefinition.prototype.setContent = function(userInput, extractedOptions) {
|
13485
13369
|
if(this._autoGenerated) { // AutoGenerated RowDefinition cannot be changed by user input
|
13486
13370
|
return false;
|
13487
13371
|
}
|
@@ -13493,6 +13377,7 @@ RowDefinition.prototype.setContent = function(userInput, permId, asChain, expand
|
|
13493
13377
|
}
|
13494
13378
|
|
13495
13379
|
var dirty = (this._userInput !== userInput);
|
13380
|
+
var permId = extractedOptions["permId"];
|
13496
13381
|
if(this._permId !== permId){
|
13497
13382
|
this._permId = permId || "";
|
13498
13383
|
dirty = true;
|
@@ -13510,15 +13395,17 @@ RowDefinition.prototype.setContent = function(userInput, permId, asChain, expand
|
|
13510
13395
|
if(this._userInput.charAt(0) === "'") { // This is a row header
|
13511
13396
|
this._ric = this._chainRic = ""; // No ric for realtime request
|
13512
13397
|
} else {
|
13398
|
+
var asChain = extractedOptions["asChain"];
|
13399
|
+
var expanded = !extractedOptions["collapsed"];
|
13400
|
+
var chainRic = extractedOptions["chainRic"];
|
13513
13401
|
if(asChain === true){
|
13514
13402
|
this._ric = expanded === false ? this._userInput : this._userInput.replace("0#", "");
|
13515
|
-
this._expanded = expanded;
|
13516
|
-
this._isChain = true; // Only chain can be expanded by 0#
|
13517
|
-
this._chainRic = this._userInput;
|
13403
|
+
this._expanded = expanded; // Only chain can be expanded by 0#
|
13518
13404
|
} else {
|
13519
13405
|
this._ric = this._userInput;
|
13520
|
-
this._isChain = asChain;
|
13521
13406
|
}
|
13407
|
+
this._isChain = asChain;
|
13408
|
+
this._chainRic = chainRic || "";
|
13522
13409
|
}
|
13523
13410
|
|
13524
13411
|
if(this._view) {
|
@@ -13744,7 +13631,7 @@ RowDefinition.prototype.setStaticRowData = function(data, opt_fields) {
|
|
13744
13631
|
this._clearStaticData();
|
13745
13632
|
|
13746
13633
|
if(Array.isArray(data)) { // Convert array to object
|
13747
|
-
data =
|
13634
|
+
data = arrayToObject(data, opt_fields);
|
13748
13635
|
}
|
13749
13636
|
|
13750
13637
|
this._staticValues = (typeof data === "object") ? data : null;
|
@@ -13757,7 +13644,7 @@ RowDefinition.prototype.setStaticRowData = function(data, opt_fields) {
|
|
13757
13644
|
* @return {Object.<string, *>}
|
13758
13645
|
*/
|
13759
13646
|
RowDefinition.prototype._getStaticRowData = function() {
|
13760
|
-
return this._staticValues ?
|
13647
|
+
return this._staticValues ? cloneObject(this._staticValues) : null;
|
13761
13648
|
};
|
13762
13649
|
/** @public
|
13763
13650
|
* @param {Object.<string, *>|Array} data
|
@@ -13765,7 +13652,7 @@ RowDefinition.prototype._getStaticRowData = function() {
|
|
13765
13652
|
*/
|
13766
13653
|
RowDefinition.prototype.updateRowData = function(data, opt_fields) {
|
13767
13654
|
if(Array.isArray(data)) { // Convert array to object
|
13768
|
-
data =
|
13655
|
+
data = arrayToObject(data, opt_fields);
|
13769
13656
|
}
|
13770
13657
|
|
13771
13658
|
if(data) {
|
@@ -13950,8 +13837,17 @@ RowDefinition.prototype.subscribeForUpdates = function() {
|
|
13950
13837
|
var prevRowData = this.unsubscribeForUpdates();
|
13951
13838
|
|
13952
13839
|
if(this.isChain()) {
|
13953
|
-
|
13954
|
-
|
13840
|
+
var symbol = this._chainRic;
|
13841
|
+
if(!symbol){
|
13842
|
+
symbol = this._ric;
|
13843
|
+
if(symbol.indexOf("0#") < 0){
|
13844
|
+
var count = (symbol.match(/\./g) || []).length;
|
13845
|
+
if(count < 2){
|
13846
|
+
symbol = "0#" + symbol;
|
13847
|
+
}
|
13848
|
+
}
|
13849
|
+
}
|
13850
|
+
this._subId = subs["addChain"](symbol, this._rowId); // Some chain require 0# symbol to populate its constituents
|
13955
13851
|
} else if(this._ric) {
|
13956
13852
|
this._subId = subs["addRic"](this._ric, this._rowId);
|
13957
13853
|
}
|
@@ -14028,7 +13924,7 @@ RowDefinition.prototype.resetUpdates = function() {
|
|
14028
13924
|
};
|
14029
13925
|
|
14030
13926
|
/** @public
|
14031
|
-
* @param {
|
13927
|
+
* @param {DataView} view
|
14032
13928
|
* @param {string=} rowId
|
14033
13929
|
*/
|
14034
13930
|
RowDefinition.prototype.registerToView = function(view, rowId) {
|
@@ -14145,11 +14041,17 @@ RowDefinition.prototype.addConstituent = function(ric) {
|
|
14145
14041
|
}
|
14146
14042
|
|
14147
14043
|
if(this._view) {
|
14148
|
-
// WARNING: ChildCount may not be enough to determine proper inserting position
|
14149
|
-
// TODO: Handle nested children
|
14150
14044
|
var rowId = this.getRowId();
|
14151
|
-
|
14152
|
-
childDef.
|
14045
|
+
// WARNING: insert position, we prioritize using CHILD_ORDER (From server) in dc first. If it does not exist, the last row of the segment will be pushed
|
14046
|
+
var childOrder = childDef.getData("CHILD_ORDER");
|
14047
|
+
var parentIndex = this._view.getRowIndex(rowId);
|
14048
|
+
var position = parentIndex + this.getChildCount(); // push the last position
|
14049
|
+
if(childOrder != null) {
|
14050
|
+
// Warning: We need to carry a value of 1 because the CHILD_ORDER starts with 0, and it will be added to the parentIndex. In case the parent rowIndex is not included.
|
14051
|
+
position = parentIndex + childOrder + 1; // insert between segment
|
14052
|
+
} // else {} it will be push in the last row of segment
|
14053
|
+
childDef.registerToView(this._view, this._view.getRowId(position));
|
14054
|
+
// TODO: Handle nested children
|
14153
14055
|
this._view.addSegmentChild(rowId, childDef.getRowId(), childDef.getDataId());
|
14154
14056
|
}
|
14155
14057
|
|
@@ -14400,6 +14302,7 @@ RowDefinition.toRowId = function(rowDef) {
|
|
14400
14302
|
*/
|
14401
14303
|
RowDefinition.extractRowOptions = function(rowOptions) {
|
14402
14304
|
var ric = rowOptions["ric"];
|
14305
|
+
var permId = rowOptions["permId"];
|
14403
14306
|
var chainRic = rowOptions["chainRic"];
|
14404
14307
|
var collapsed = rowOptions["collapsed"];
|
14405
14308
|
var asChain = rowOptions["asChain"];
|
@@ -14421,6 +14324,7 @@ RowDefinition.extractRowOptions = function(rowOptions) {
|
|
14421
14324
|
extractedOptions["collapsed"] = collapsed;
|
14422
14325
|
}
|
14423
14326
|
extractedOptions["ric"] = ric;
|
14327
|
+
extractedOptions["permId"] = permId;
|
14424
14328
|
extractedOptions["chainRic"] = chainRic;
|
14425
14329
|
extractedOptions["asChain"] = asChain;
|
14426
14330
|
return extractedOptions;
|
@@ -16040,7 +15944,7 @@ ColumnDefinition.prototype._setField = function(field, columnOption) {
|
|
16040
15944
|
var uppercasedF = field.toUpperCase(); // For comparison only
|
16041
15945
|
var predefinedF = formulaStr || js_PredefinedFormula.get(uppercasedF);
|
16042
15946
|
if(predefinedF || ColumnDefinition.isFormulaField(field)) {
|
16043
|
-
field =
|
15947
|
+
field = formula_Formula.toUpperCase(field);
|
16044
15948
|
this._formula = this._fnEngine.addFormula(predefinedF || field); // Always a success
|
16045
15949
|
if(predefinedF) {
|
16046
15950
|
this._formula.setAlias(field); // This field is used for retrieving data for dependent fields
|
@@ -16202,7 +16106,7 @@ var SnapshotFiller = function () {
|
|
16202
16106
|
productId: "001"
|
16203
16107
|
};
|
16204
16108
|
};
|
16205
|
-
Ext
|
16109
|
+
Ext.inherits(SnapshotFiller, EventDispatcher);
|
16206
16110
|
|
16207
16111
|
//#region Private Members
|
16208
16112
|
/** @type {number}
|
@@ -16507,7 +16411,7 @@ SnapshotFiller.prototype._onJETSuccess = function (fields, serverResult) {
|
|
16507
16411
|
var updatedData = {};
|
16508
16412
|
for (ric in ricMap) {
|
16509
16413
|
var obj = ricMap[ric];
|
16510
|
-
if (!
|
16414
|
+
if (!isEmptyObject(obj)) {
|
16511
16415
|
updatedData[ric] = obj;
|
16512
16416
|
}
|
16513
16417
|
}
|
@@ -16580,7 +16484,7 @@ SnapshotFiller.prototype._onRTKSuccess = function (fields, serverResult) {
|
|
16580
16484
|
var updatedData = {};
|
16581
16485
|
for (ric in ricMap) {
|
16582
16486
|
var obj = ricMap[ric];
|
16583
|
-
if (!
|
16487
|
+
if (!isEmptyObject(obj)) {
|
16584
16488
|
updatedData[ric] = obj;
|
16585
16489
|
}
|
16586
16490
|
}
|
@@ -16650,7 +16554,7 @@ SnapshotFiller.prototype._onRTKTimeSeriesSuccess = function (fields, serverResul
|
|
16650
16554
|
var dataMapping = {};
|
16651
16555
|
for (ric in ricMap) {
|
16652
16556
|
var obj = ricMap[ric];
|
16653
|
-
if (!
|
16557
|
+
if (!isEmptyObject(obj)) {
|
16654
16558
|
dataMapping[ric] = obj;
|
16655
16559
|
}
|
16656
16560
|
}
|
@@ -16758,7 +16662,7 @@ GroupDefinitions.getLeafDescendants = function (groupMap, groupId) {
|
|
16758
16662
|
* @return {Object}
|
16759
16663
|
*/
|
16760
16664
|
GroupDefinitions._cloneObject = function(obj) {
|
16761
|
-
var newObj =
|
16665
|
+
var newObj = cloneObject(obj);
|
16762
16666
|
if(Array.isArray(newObj.children)) {
|
16763
16667
|
newObj.children = newObj.children;
|
16764
16668
|
} else {
|
@@ -17300,7 +17204,7 @@ GroupDefinitions.prototype.setGroupName = function (groupId, groupName) {
|
|
17300
17204
|
var ElementWrapper = function (opt_element) {
|
17301
17205
|
this._element = opt_element ? opt_element : document.createElement("div");
|
17302
17206
|
};
|
17303
|
-
|
17207
|
+
es6_Ext.inherits(ElementWrapper, event_EventDispatcher);
|
17304
17208
|
|
17305
17209
|
/** @protected
|
17306
17210
|
* @ignore
|
@@ -18014,7 +17918,7 @@ var CellFloatingPanel = function () {
|
|
18014
17918
|
this._items = [];
|
18015
17919
|
this._element = null;
|
18016
17920
|
};
|
18017
|
-
|
17921
|
+
es6_Ext.inherits(CellFloatingPanel, components_ElementWrapper);
|
18018
17922
|
|
18019
17923
|
/** @public
|
18020
17924
|
* @type {Array.<Element>}
|
@@ -18156,7 +18060,7 @@ var Cell = function (opt_element, opt_section) {
|
|
18156
18060
|
this._section = opt_section;
|
18157
18061
|
}
|
18158
18062
|
};
|
18159
|
-
|
18063
|
+
es6_Ext.inherits(Cell, components_ElementWrapper);
|
18160
18064
|
|
18161
18065
|
/** Cell's aligner
|
18162
18066
|
* @private
|
@@ -20489,7 +20393,7 @@ var Column = function (section) {
|
|
20489
20393
|
this._cells = [];
|
20490
20394
|
this._section = section;
|
20491
20395
|
};
|
20492
|
-
|
20396
|
+
es6_Ext.inherits(Column, components_ElementWrapper);
|
20493
20397
|
|
20494
20398
|
/** @type {Column}
|
20495
20399
|
* @private
|
@@ -22590,7 +22494,7 @@ var Scrollbar = function () {
|
|
22590
22494
|
t.listen("thicknessChanged", t._updateEffectiveArea);
|
22591
22495
|
}
|
22592
22496
|
};
|
22593
|
-
|
22497
|
+
es6_Ext.inherits(Scrollbar, components_ElementWrapper);
|
22594
22498
|
|
22595
22499
|
/** @type {boolean}
|
22596
22500
|
* @protected
|
@@ -23969,7 +23873,7 @@ var HScrollbar = function () {
|
|
23969
23873
|
t.listen("activated", t._onActivated);
|
23970
23874
|
t.listen("deactivated", t._onDeactivated);
|
23971
23875
|
};
|
23972
|
-
|
23876
|
+
es6_Ext.inherits(HScrollbar, components_Scrollbar);
|
23973
23877
|
|
23974
23878
|
/** @type {number}
|
23975
23879
|
* @private
|
@@ -24261,7 +24165,7 @@ var LayoutGrid = function (options) {
|
|
24261
24165
|
_t._addEvent("rowAvailable");
|
24262
24166
|
};
|
24263
24167
|
|
24264
|
-
|
24168
|
+
es6_Ext.inherits(LayoutGrid, components_ElementWrapper);
|
24265
24169
|
|
24266
24170
|
/**
|
24267
24171
|
* @type {number}
|
@@ -27601,7 +27505,7 @@ var WrappedView = function(options) {
|
|
27601
27505
|
|
27602
27506
|
this._addEvents("dataChanged");
|
27603
27507
|
};
|
27604
|
-
|
27508
|
+
es6_Ext.inherits(WrappedView, event_EventDispatcher);
|
27605
27509
|
|
27606
27510
|
/** The configuration object for WrappedView
|
27607
27511
|
* @typedef {Object} WrappedView~Options
|
@@ -28979,7 +28883,7 @@ var DataView = function(source) {
|
|
28979
28883
|
|
28980
28884
|
t.setDataSource(source);
|
28981
28885
|
};
|
28982
|
-
|
28886
|
+
es6_Ext.inherits(DataView, event_EventDispatcher);
|
28983
28887
|
|
28984
28888
|
/** List of row Ids with filtering and sorting transformation
|
28985
28889
|
* @private
|
@@ -32968,7 +32872,7 @@ var SectionSettings = function (grid) {
|
|
32968
32872
|
_t._addEvent("dataChanged");
|
32969
32873
|
_t._addEvent("rowAvailable");
|
32970
32874
|
};
|
32971
|
-
|
32875
|
+
es6_Ext.inherits(SectionSettings, event_EventDispatcher); // Inherits() will replace prototype of the derived object
|
32972
32876
|
|
32973
32877
|
/** @type {number}
|
32974
32878
|
* @private
|
@@ -33631,7 +33535,7 @@ var Virtualizer = function (trackLayout) {
|
|
33631
33535
|
this._arg = {};
|
33632
33536
|
this._addEvent("indexChanged");
|
33633
33537
|
};
|
33634
|
-
|
33538
|
+
es6_Ext.inherits(Virtualizer, event_EventDispatcher); // Inherits() will replace prototype of the derived object
|
33635
33539
|
|
33636
33540
|
/** @private
|
33637
33541
|
* @type {!TrackLayout}
|
@@ -33988,7 +33892,7 @@ var VScrollbar = function () {
|
|
33988
33892
|
t.listen("scroll", t._onScroll); // For backward compatability
|
33989
33893
|
t._addEvent("contentScrolled");
|
33990
33894
|
};
|
33991
|
-
|
33895
|
+
es6_Ext.inherits(VScrollbar, components_Scrollbar);
|
33992
33896
|
|
33993
33897
|
|
33994
33898
|
/** For internal usage only
|
@@ -34161,7 +34065,7 @@ var VirtualizedLayoutGrid = function (options) {
|
|
34161
34065
|
_t._addEvent("rowHeightChanged");
|
34162
34066
|
_t._addEvent("rowAvailable");
|
34163
34067
|
};
|
34164
|
-
|
34068
|
+
es6_Ext.inherits(VirtualizedLayoutGrid, components_ElementWrapper);
|
34165
34069
|
|
34166
34070
|
|
34167
34071
|
/**
|
@@ -35455,6 +35359,7 @@ VirtualizedLayoutGrid._proto = VirtualizedLayoutGrid.prototype;
|
|
35455
35359
|
* @property {string} rowId
|
35456
35360
|
* @property {number} rowIndex
|
35457
35361
|
*/
|
35362
|
+
/** @event Core#beforeContentBinding */
|
35458
35363
|
/** @event Core#postSectionDataBinding */
|
35459
35364
|
/** @event Core#rowHighlighted */
|
35460
35365
|
|
@@ -35617,6 +35522,7 @@ var Core = function (opt_initializer) {
|
|
35617
35522
|
"postDataSourceChanged",
|
35618
35523
|
"preSectionRender",
|
35619
35524
|
"postSectionRender",
|
35525
|
+
"beforeContentBinding",
|
35620
35526
|
"preSectionDataBinding",
|
35621
35527
|
"postSectionDataBinding",
|
35622
35528
|
"rowExpansionBinding",
|
@@ -35677,7 +35583,7 @@ var Core = function (opt_initializer) {
|
|
35677
35583
|
}
|
35678
35584
|
});
|
35679
35585
|
};
|
35680
|
-
|
35586
|
+
es6_Ext.inherits(Core, components_ElementWrapper);
|
35681
35587
|
|
35682
35588
|
/** @typedef {number|string|ILayoutGrid|SectionSettings} Core~SectionReference
|
35683
35589
|
* @description A section in core grid can be refered by the following object <br>
|
@@ -35978,7 +35884,7 @@ Core.prototype._batches = null;
|
|
35978
35884
|
* @return {string}
|
35979
35885
|
*/
|
35980
35886
|
Core.getVersion = function () {
|
35981
|
-
return "5.1.
|
35887
|
+
return "5.1.59";
|
35982
35888
|
};
|
35983
35889
|
/** {@link ElementWrapper#dispose}
|
35984
35890
|
* @override
|
@@ -36780,6 +36686,7 @@ Core.prototype.getColumnCount = function () {
|
|
36780
36686
|
* @fires Core#columnAdded
|
36781
36687
|
* @fires Core#preSectionRender
|
36782
36688
|
* @fires Core#columnRender
|
36689
|
+
* @fires Core#beforeContentBinding
|
36783
36690
|
* @fires Core#preSectionDataBinding
|
36784
36691
|
* @fires Core#columnDataBinding
|
36785
36692
|
* @fires Core#postSectionDataBinding
|
@@ -36807,6 +36714,7 @@ Core.prototype.setColumnCount = function(num) {
|
|
36807
36714
|
* @fires Core#columnAdded
|
36808
36715
|
* @fires Core#preSectionRender
|
36809
36716
|
* @fires Core#columnRender
|
36717
|
+
* @fires Core#beforeContentBinding
|
36810
36718
|
* @fires Core#preSectionDataBinding
|
36811
36719
|
* @fires Core#columnDataBinding
|
36812
36720
|
* @fires Core#postSectionDataBinding
|
@@ -36923,16 +36831,12 @@ Core.prototype.removeColumnAt = function (index) {
|
|
36923
36831
|
|
36924
36832
|
if (this._hasListener("columnRemoved")) {
|
36925
36833
|
var e = {};
|
36926
|
-
var batches = this._batches;
|
36927
|
-
if(batches){
|
36928
|
-
e["batches"] = batches;
|
36929
|
-
}
|
36930
36834
|
e["atTheMiddle"] = true;
|
36931
36835
|
e["colIndex"] = index;
|
36932
36836
|
e["columns"] = "deprecated";
|
36933
36837
|
e["columnData"] = colDef["columnData"];
|
36934
36838
|
e["colId"] = colDef["id"] || "";
|
36935
|
-
this.
|
36839
|
+
this._dispatchColumnEvent("columnRemoved", e);
|
36936
36840
|
}
|
36937
36841
|
|
36938
36842
|
// Last index in view here might be different from before moving column if columns have different width.
|
@@ -37185,7 +37089,7 @@ Core.prototype._moveColumn = function (fromCol, destCol) {
|
|
37185
37089
|
e["fromColIndex"] = fromCol;
|
37186
37090
|
e["toColIndex"] = destCol;
|
37187
37091
|
e["colId"] = colId; // TODO: Id may not needed
|
37188
|
-
this.
|
37092
|
+
this._dispatchColumnEvent("columnMoved", e); // add remove move
|
37189
37093
|
}
|
37190
37094
|
|
37191
37095
|
// Last index in view here might be different from before moving column if columns have different width.
|
@@ -37255,6 +37159,9 @@ Core.prototype.reorderColumns = function (colRefs, destCol) {
|
|
37255
37159
|
destId = destCol;
|
37256
37160
|
}
|
37257
37161
|
|
37162
|
+
this.startBatch("move");
|
37163
|
+
|
37164
|
+
var dirty = 0;
|
37258
37165
|
if(Array.isArray(colRefs)) {
|
37259
37166
|
var srcLen = colRefs.length;
|
37260
37167
|
if(srcLen > 1) {
|
@@ -37297,7 +37204,6 @@ Core.prototype.reorderColumns = function (colRefs, destCol) {
|
|
37297
37204
|
}
|
37298
37205
|
}
|
37299
37206
|
|
37300
|
-
var dirty = 0;
|
37301
37207
|
for(i = srcLen; --i >= 0;) {
|
37302
37208
|
srcId = srcIds[i]; // Only valid source columns are left at this point
|
37303
37209
|
srcIdx = this.getColumnIndex(srcId);
|
@@ -37308,17 +37214,15 @@ Core.prototype.reorderColumns = function (colRefs, destCol) {
|
|
37308
37214
|
dirty |= this._moveColumnByIndex(srcIdx, destIdx);
|
37309
37215
|
destId = srcId;
|
37310
37216
|
}
|
37311
|
-
return dirty ? true : false;
|
37312
37217
|
} else {
|
37313
|
-
|
37218
|
+
dirty = this.moveColumnById(colRefs[0], destId);
|
37314
37219
|
}
|
37315
|
-
}
|
37316
|
-
|
37317
|
-
if(colRefs != null) {
|
37220
|
+
} else if(colRefs != null) {
|
37318
37221
|
// colRefs will be a number or string
|
37319
|
-
|
37222
|
+
dirty = this.moveColumnById(colRefs, destId);
|
37320
37223
|
}
|
37321
|
-
|
37224
|
+
this.stopBatch("move");
|
37225
|
+
return dirty ? true : false;
|
37322
37226
|
};
|
37323
37227
|
|
37324
37228
|
/** @public
|
@@ -37425,6 +37329,7 @@ Core.prototype._deserializeColumn = function (index, jsonObj) {
|
|
37425
37329
|
* @param {number=} opt_num Default is one row
|
37426
37330
|
* @fires Core#preSectionRender
|
37427
37331
|
* @fires Core#columnRender
|
37332
|
+
* @fires Core#beforeContentBinding
|
37428
37333
|
* @fires Core#preSectionDataBinding
|
37429
37334
|
* @fires Core#columnDataBinding
|
37430
37335
|
* @fires Core#postSectionDataBinding
|
@@ -39228,6 +39133,7 @@ Core.prototype.synchronizeHScrollbar = function (subGrid) {
|
|
39228
39133
|
* @param {number=} fromRowIndex INCLUSIVE If the value is undefined, the first row index will be used
|
39229
39134
|
* @param {number=} lastRowIndex INCLUSIVE If the value is undefined, the last row index will be used
|
39230
39135
|
* @param {Object=} userParam Addtional parameters to be fired with the event
|
39136
|
+
* @fires Core#beforeContentBinding
|
39231
39137
|
* @fires Core#preSectionDataBinding
|
39232
39138
|
* @fires Core#columnDataBinding
|
39233
39139
|
* @fires Core#postSectionDataBinding
|
@@ -39861,7 +39767,7 @@ Core.prototype.stopBatch = function (batchType) {
|
|
39861
39767
|
this._dispatch("afterBatchOperation", { batches: this._batches, batchType: batchType });
|
39862
39768
|
|
39863
39769
|
delete this._batches[batchType];
|
39864
|
-
if(
|
39770
|
+
if(isEmptyObject(this._batches)){
|
39865
39771
|
this._batches = null;
|
39866
39772
|
}
|
39867
39773
|
return true;
|
@@ -39870,6 +39776,17 @@ Core.prototype.stopBatch = function (batchType) {
|
|
39870
39776
|
|
39871
39777
|
//#region Private Methods
|
39872
39778
|
/** @private
|
39779
|
+
* @param {string} type
|
39780
|
+
* @param {!Object} eventArg
|
39781
|
+
*/
|
39782
|
+
Core.prototype._dispatchColumnEvent = function (type, eventArg) {
|
39783
|
+
var batches = this._batches;
|
39784
|
+
if(batches){
|
39785
|
+
eventArg["batches"] = batches;
|
39786
|
+
}
|
39787
|
+
this._dispatch(type, eventArg);
|
39788
|
+
};
|
39789
|
+
/** @private
|
39873
39790
|
*/
|
39874
39791
|
Core.prototype._dispatchColumnPositionChanged = function () {
|
39875
39792
|
if(this._columnPositionConflator.conflate()) {
|
@@ -40109,20 +40026,16 @@ Core.prototype._dispatchColumnAddedEvent = function (at, count, atTheMiddle, ctx
|
|
40109
40026
|
if (this._hasListener("columnAdded")) {
|
40110
40027
|
var e = {};
|
40111
40028
|
e["atTheMiddle"] = atTheMiddle;
|
40112
|
-
var batches = this._batches;
|
40113
|
-
if(batches){
|
40114
|
-
e["batches"] = batches;
|
40115
|
-
}
|
40116
40029
|
if(count === 1) {
|
40117
40030
|
e["colIndex"] = at;
|
40118
40031
|
e["context"] = ctx;
|
40119
|
-
this.
|
40032
|
+
this._dispatchColumnEvent("columnAdded", e);
|
40120
40033
|
} else {
|
40121
40034
|
var ary = Array.isArray(ctx) ? ctx : [];
|
40122
40035
|
for (var i = 0; i < count; ++i) {
|
40123
40036
|
e["colIndex"] = at + i;
|
40124
40037
|
e["context"] = ary[i];
|
40125
|
-
this.
|
40038
|
+
this._dispatchColumnEvent("columnAdded", e);
|
40126
40039
|
}
|
40127
40040
|
}
|
40128
40041
|
}
|
@@ -40264,15 +40177,11 @@ Core.prototype._removeColumn = function (num) { // TODO: change the logic to us
|
|
40264
40177
|
|
40265
40178
|
if (this._hasListener("columnRemoved")) {
|
40266
40179
|
var e = {};
|
40267
|
-
var batches = this._batches;
|
40268
|
-
if(batches){
|
40269
|
-
e["batches"] = batches;
|
40270
|
-
}
|
40271
40180
|
for (var c = colCount; --c >= newCount; ) {
|
40272
40181
|
var colDef = removedCols[c - newCount];
|
40273
40182
|
e["colIndex"] = c;
|
40274
40183
|
e["columnData"] = colDef ? colDef["columnData"] : null;
|
40275
|
-
this.
|
40184
|
+
this._dispatchColumnEvent("columnRemoved", e);
|
40276
40185
|
}
|
40277
40186
|
}
|
40278
40187
|
};
|
@@ -40305,6 +40214,9 @@ Core.prototype._onSectionDataChanged = function (e) {
|
|
40305
40214
|
rowDataCollection = dataView.getMultipleRowData(rids, fromR, toR);
|
40306
40215
|
e["dataRows"] = rowDataCollection;
|
40307
40216
|
}
|
40217
|
+
if(e["sectionType"] === "content"){
|
40218
|
+
this._dispatch("beforeContentBinding", e);
|
40219
|
+
}
|
40308
40220
|
this._dispatch("preSectionDataBinding", e);
|
40309
40221
|
|
40310
40222
|
var dataMap = this.getDataColumnMap();
|
@@ -41278,7 +41190,7 @@ StyleLoader.chainIcon = '';
|
|
41278
41190
|
/** @type {string}
|
41279
41191
|
* @public
|
41280
41192
|
*/
|
41281
|
-
StyleLoader.styles =
|
41193
|
+
StyleLoader.styles = prettifyCss([
|
41282
41194
|
".tr-grid .chain-icon", [
|
41283
41195
|
"cursor: pointer;"
|
41284
41196
|
],
|
@@ -41301,7 +41213,7 @@ StyleLoader.styles = Object(Util["i" /* prettifyCss */])([
|
|
41301
41213
|
StyleLoader.applyStyle = function (grid) {
|
41302
41214
|
if (grid && !grid._rowGroupingStyles) { // TODO: Support run-time theme loading
|
41303
41215
|
grid._rowGroupingStyles = true; // Prevent loading the same style twice
|
41304
|
-
|
41216
|
+
injectCss(StyleLoader.styles, grid.getElement());
|
41305
41217
|
}
|
41306
41218
|
};
|
41307
41219
|
|
@@ -41573,7 +41485,7 @@ var DataConnector = function () {
|
|
41573
41485
|
t._rics = new js_ReferenceCounter();
|
41574
41486
|
t._rowDefMap = {};
|
41575
41487
|
};
|
41576
|
-
Ext
|
41488
|
+
Ext.inherits(DataConnector, EventDispatcher);
|
41577
41489
|
|
41578
41490
|
|
41579
41491
|
//#region Private Members
|
@@ -41950,7 +41862,7 @@ RowDefSorter.prototype.addColumnContext = function(field, logic, rowSorting, ord
|
|
41950
41862
|
var sortPriority = this._sortParams.length;
|
41951
41863
|
var ctx = this._ctxCaches[sortPriority];
|
41952
41864
|
if(!ctx) {
|
41953
|
-
ctx = this._ctxCaches[sortPriority] =
|
41865
|
+
ctx = this._ctxCaches[sortPriority] = cloneObject(this._globalContext);
|
41954
41866
|
}
|
41955
41867
|
var orderNum = 0;
|
41956
41868
|
if(order === "a") {
|
@@ -42137,7 +42049,7 @@ var SortableTitlePlugin = function (options) { // TODO: Extract SortableTitlePlu
|
|
42137
42049
|
_t.config({ "sorting": options });
|
42138
42050
|
}
|
42139
42051
|
};
|
42140
|
-
|
42052
|
+
es6_Ext.inherits(SortableTitlePlugin, event_EventDispatcher);
|
42141
42053
|
|
42142
42054
|
/**
|
42143
42055
|
* @typedef {"a" | "ascending" | "d" | "descending" | "n" | null} SortableTitlePlugin~SortOrder
|
@@ -42608,7 +42520,7 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
|
|
42608
42520
|
extOptions["sortingSequence"] = sortingSeq.slice();
|
42609
42521
|
}
|
42610
42522
|
|
42611
|
-
if(
|
42523
|
+
if(isEmptyObject(obj["sorting"])) {
|
42612
42524
|
delete obj["sorting"];
|
42613
42525
|
}
|
42614
42526
|
|
@@ -44144,6 +44056,45 @@ var compareNumber = function(rowDefA, rowDefB, sortOrder, fieldName) { // edit n
|
|
44144
44056
|
return (rowDefA.getData(fieldName) - rowDefB.getData(fieldName)) * sortOrder; // for numeric comparison
|
44145
44057
|
};
|
44146
44058
|
|
44059
|
+
/**
|
44060
|
+
* @private
|
44061
|
+
* @param {string} rowDefA
|
44062
|
+
* @param {string} rowDefB
|
44063
|
+
* @param {string} sortOrder
|
44064
|
+
* @return {number} The outcome of the value comparison
|
44065
|
+
*/
|
44066
|
+
var _sortChildrenOfChain = function (rowDefA, rowDefB, sortOrder) {
|
44067
|
+
var parentA = rowDefA.getParent();
|
44068
|
+
|
44069
|
+
if (!parentA) {
|
44070
|
+
return 0;
|
44071
|
+
}
|
44072
|
+
|
44073
|
+
var parentB = rowDefB.getParent();
|
44074
|
+
|
44075
|
+
if (!parentB) {
|
44076
|
+
return 0;
|
44077
|
+
}
|
44078
|
+
|
44079
|
+
if (parentA !== parentB) {
|
44080
|
+
return 0;
|
44081
|
+
}
|
44082
|
+
|
44083
|
+
var a = rowDefA.getData('CHILD_ORDER');
|
44084
|
+
|
44085
|
+
if (a == null) {
|
44086
|
+
return 0;
|
44087
|
+
}
|
44088
|
+
|
44089
|
+
var b = rowDefB.getData('CHILD_ORDER');
|
44090
|
+
|
44091
|
+
if (b == null) {
|
44092
|
+
return 0;
|
44093
|
+
}
|
44094
|
+
|
44095
|
+
return ( a - b ) * sortOrder;
|
44096
|
+
};
|
44097
|
+
|
44147
44098
|
/** @private
|
44148
44099
|
* @param {ColumnDefinition} colDef
|
44149
44100
|
* @return {string}
|
@@ -44172,6 +44123,7 @@ var Grid = function(placeholder, config) {
|
|
44172
44123
|
var t = this; // This is to primarily reduce file size
|
44173
44124
|
|
44174
44125
|
t._onDataChanged = t._onDataChanged.bind(t);
|
44126
|
+
t._onQuote2PostUpdate = t._onQuote2PostUpdate.bind(t);
|
44175
44127
|
t._onDataComposed = t._onDataComposed.bind(t);
|
44176
44128
|
t._onSubSegmentChanged = t._onSubSegmentChanged.bind(t);
|
44177
44129
|
t._recalculateFormulas = t._recalculateFormulas.bind(t);
|
@@ -44294,7 +44246,7 @@ var Grid = function(placeholder, config) {
|
|
44294
44246
|
|
44295
44247
|
js_StyleLoader.applyStyle(t._grid);
|
44296
44248
|
};
|
44297
|
-
Ext
|
44249
|
+
Ext.inherits(Grid, EventDispatcher);
|
44298
44250
|
|
44299
44251
|
/** @private
|
44300
44252
|
* @type {Element}
|
@@ -44530,6 +44482,7 @@ Grid.prototype.initSubscription = function() {
|
|
44530
44482
|
this._subs = s;
|
44531
44483
|
this._subs["start"]();
|
44532
44484
|
this._dc.setSubscriptions(s);
|
44485
|
+
this._subs.addEventListener("postUpdate", this._onQuote2PostUpdate);
|
44533
44486
|
|
44534
44487
|
// TODO: Subscriptions should be registered per row.
|
44535
44488
|
// However, chain subscription cannot be integrated with DataConnector in this current implementation.
|
@@ -44913,9 +44866,9 @@ Grid.prototype.initialize = function(gridOption) {
|
|
44913
44866
|
var len = rows.length;
|
44914
44867
|
for(var n = 0; n < len; n++) {
|
44915
44868
|
if(rows[n]["values"]) { // merge row's values, values can be object or array
|
44916
|
-
values =
|
44917
|
-
data =
|
44918
|
-
rows[n]["values"] =
|
44869
|
+
values = arrayToObject(rows[n]["values"], fields);
|
44870
|
+
data = arrayToObject(ary[n], fields);
|
44871
|
+
rows[n]["values"] = extendObject(values, data);
|
44919
44872
|
} else {
|
44920
44873
|
rows[n]["values"] = ary[n];
|
44921
44874
|
}
|
@@ -45036,7 +44989,7 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
45036
44989
|
obj["autoLayoutUpdate"] = true;
|
45037
44990
|
}
|
45038
44991
|
|
45039
|
-
val =
|
44992
|
+
val = isEmptyObject(this._defaultColumnOptions);
|
45040
44993
|
if (!val) { // Currently, this variable is the object, we need to check empty array for default value
|
45041
44994
|
obj["defaultColumnOptions"] = this._defaultColumnOptions;
|
45042
44995
|
}
|
@@ -45244,7 +45197,7 @@ Grid.prototype.insertColumn = function (columnOption, idx) {
|
|
45244
45197
|
|
45245
45198
|
// no need to merge defaultColumn during initialize process
|
45246
45199
|
// because columnOption already mutate by initialize function
|
45247
|
-
var configObj = (this._initializing) ? {} :
|
45200
|
+
var configObj = (this._initializing) ? {} : cloneObject(this._defaultColumnOptions);
|
45248
45201
|
|
45249
45202
|
if (typeof columnOption === "string") {
|
45250
45203
|
configObj["field"] = columnOption;
|
@@ -45369,7 +45322,7 @@ Grid.prototype._cloneTimeSeriesColumn = function (parentColDef, childField, idx)
|
|
45369
45322
|
obj[key] = parentConfig[key];
|
45370
45323
|
}
|
45371
45324
|
}
|
45372
|
-
columnOption =
|
45325
|
+
columnOption = cloneObject(obj);
|
45373
45326
|
columnOption["field"] = childField.replace("TR.", ""); // We need to remove the 'TR' prefix from the field to avoid confusion with time series fields.
|
45374
45327
|
columnOption["name"] = childField.split("_")[1].split("T")[0]; // Currently, response server format utc date ex "2022-11-23T00:00:00"
|
45375
45328
|
columnOption["parent"] = parentColDef;
|
@@ -45584,7 +45537,7 @@ Grid.prototype.restoreColumns = function(columns) {
|
|
45584
45537
|
for (i = 0; i < preColLen; i++) {
|
45585
45538
|
found = false;
|
45586
45539
|
for (j = 0; j < newColLen; j++) {
|
45587
|
-
if (
|
45540
|
+
if (deepEqual(previousColumns[i], columns[j])) {
|
45588
45541
|
keepingColumns.push(previousColumns[i]);
|
45589
45542
|
found = true;
|
45590
45543
|
break;
|
@@ -45605,7 +45558,7 @@ Grid.prototype.restoreColumns = function(columns) {
|
|
45605
45558
|
for (i = 0; i < newColLen; i++) {
|
45606
45559
|
found = false;
|
45607
45560
|
for (j = 0; j < keepingLen; j++) { // loop only keeping column
|
45608
|
-
if (
|
45561
|
+
if (deepEqual(columns[i], keepingColumns[j])) {
|
45609
45562
|
found = true;
|
45610
45563
|
var colIndex = this.getColumnIndex(columns[i].field); // We cannot use 'i' (colIndex) in this case, as it will sort the columns. Instead, we need to obtain a new column index from the field.
|
45611
45564
|
columnOrdering.push(this.getColumnId(colIndex));
|
@@ -46522,13 +46475,7 @@ Grid.prototype.setRic = function(rowRef, str, options) {
|
|
46522
46475
|
options["ric"] = str;
|
46523
46476
|
var extractedOptions = RowDefinition.extractRowOptions(options);
|
46524
46477
|
var oldRic = rowDef.getSymbol();
|
46525
|
-
|
46526
|
-
var expanded = null;
|
46527
|
-
var collapsed = options["collapsed"];
|
46528
|
-
if(collapsed != null){
|
46529
|
-
expanded = !extractedOptions["collapsed"];
|
46530
|
-
}
|
46531
|
-
if(rowDef.setContent(str, permId, extractedOptions["asChain"], expanded)) { // The given string may not be a RIC
|
46478
|
+
if(rowDef.setContent(str, extractedOptions)) { // The given string may not be a RIC
|
46532
46479
|
this._connector.removeRic(rowDef, oldRic);
|
46533
46480
|
this._initDuplicateRicData(rowDef);
|
46534
46481
|
this._connector.addRic(rowDef);
|
@@ -47242,6 +47189,19 @@ Grid.prototype.clearSort = function() {
|
|
47242
47189
|
this._stp.clearSortState(); // WARNING: No event is dispatched
|
47243
47190
|
};
|
47244
47191
|
|
47192
|
+
/**
|
47193
|
+
* @private
|
47194
|
+
* @param {Object} e Event object from quote2
|
47195
|
+
*/
|
47196
|
+
Grid.prototype._onQuote2PostUpdate = function (e) {
|
47197
|
+
if(e.childOrderChange) { // For dynamic chain when CHILD_ORDER from the server change, it will be call sort children
|
47198
|
+
if(!this.isSorting()) {
|
47199
|
+
// Use rowDef for get CHILD_ORDER to sort
|
47200
|
+
this._dt.sortOnce("ROW_DEF", "a", _sortChildrenOfChain);
|
47201
|
+
}
|
47202
|
+
}
|
47203
|
+
};
|
47204
|
+
|
47245
47205
|
/** @private
|
47246
47206
|
* @param {!Object} e
|
47247
47207
|
*/
|
@@ -47801,7 +47761,7 @@ Grid.prototype.replaceRow = function(rowRef, rowOption) {
|
|
47801
47761
|
}
|
47802
47762
|
var configObj = rowDef.getConfigObject();
|
47803
47763
|
|
47804
|
-
if(
|
47764
|
+
if(deepEqual(configObj, rowOption)){
|
47805
47765
|
return null;
|
47806
47766
|
} else {
|
47807
47767
|
var insertedRow = this.insertRow(rowOption, rowId);
|
@@ -50695,11 +50655,380 @@ var TickFields = {
|
|
50695
50655
|
/* harmony default export */ var es6_TickCodes = (TickCodes);
|
50696
50656
|
|
50697
50657
|
|
50658
|
+
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/ExpressionParser.js
|
50659
|
+
/** @type {Object.<string, number>}
|
50660
|
+
* @private
|
50661
|
+
* @const
|
50662
|
+
*/
|
50663
|
+
var OperatorPrecedences = {
|
50664
|
+
"||": 1,
|
50665
|
+
"&&": 2,
|
50666
|
+
"<": 3,
|
50667
|
+
">": 3,
|
50668
|
+
"<=": 3,
|
50669
|
+
">=": 3,
|
50670
|
+
"!=": 3,
|
50671
|
+
"=": 3,
|
50672
|
+
"==": 3,
|
50673
|
+
"===": 3,
|
50674
|
+
"+": 4,
|
50675
|
+
"-": 4,
|
50676
|
+
"*": 5,
|
50677
|
+
"%": 6,
|
50678
|
+
"/": 6
|
50679
|
+
};
|
50680
|
+
/** @type {Object.<string, Function>}
|
50681
|
+
* @private
|
50682
|
+
* @const
|
50683
|
+
*/
|
50684
|
+
var OperatorFunctions = {
|
50685
|
+
"+": function(lhs, rhs){ return lhs + rhs; },
|
50686
|
+
"-": function(lhs, rhs){ return lhs - rhs; },
|
50687
|
+
"*": function(lhs, rhs){ return lhs * rhs; },
|
50688
|
+
"/": function(lhs, rhs){ return lhs / rhs; },
|
50689
|
+
"%": function(lhs, rhs){ return lhs % rhs; },
|
50690
|
+
"<": function(lhs, rhs){ return lhs < rhs; },
|
50691
|
+
">": function(lhs, rhs){ return lhs > rhs; },
|
50692
|
+
"<=": function(lhs, rhs){ return lhs <= rhs; },
|
50693
|
+
">=": function(lhs, rhs){ return lhs >= rhs; },
|
50694
|
+
"==": function(lhs, rhs){ return lhs == rhs; },
|
50695
|
+
"!=": function(lhs, rhs){ return lhs != rhs; },
|
50696
|
+
"&&": function(lhs, rhs){ return lhs && rhs; },
|
50697
|
+
"||": function(lhs, rhs){ return lhs || rhs; }
|
50698
|
+
};
|
50699
|
+
/** @type {Object.<string, Function>}
|
50700
|
+
* @private
|
50701
|
+
* @function
|
50702
|
+
* @param {Array.<Object>} ary
|
50703
|
+
* @param {string|number} value
|
50704
|
+
* @param {string} type
|
50705
|
+
* @param {string=} dataType
|
50706
|
+
* @return {number}
|
50707
|
+
*/
|
50708
|
+
var _addToken = function(ary, value, type, dataType) {
|
50709
|
+
var tok = {
|
50710
|
+
value: value,
|
50711
|
+
type: type
|
50712
|
+
};
|
50713
|
+
if(dataType) {
|
50714
|
+
tok.dataType = dataType;
|
50715
|
+
}
|
50716
|
+
if(type === "operator") {
|
50717
|
+
tok.precedence = OperatorPrecedences[value];
|
50718
|
+
}
|
50719
|
+
ary.push(tok);
|
50720
|
+
return ary.length - 1;
|
50721
|
+
};
|
50722
|
+
|
50723
|
+
/** @public
|
50724
|
+
* @namespace
|
50725
|
+
*/
|
50726
|
+
var ExpressionParser = {};
|
50727
|
+
/** @type {Array.<Object>}
|
50728
|
+
* @private
|
50729
|
+
* @const
|
50730
|
+
*/
|
50731
|
+
ExpressionParser._tokens = [];
|
50732
|
+
|
50733
|
+
|
50734
|
+
/** @private
|
50735
|
+
* @function
|
50736
|
+
* @param {string} str
|
50737
|
+
* @return {string}
|
50738
|
+
*/
|
50739
|
+
ExpressionParser._withString = function(str) {
|
50740
|
+
var tokId = _addToken(ExpressionParser._tokens,
|
50741
|
+
str.substring(1, str.length - 1),
|
50742
|
+
"literal",
|
50743
|
+
"string"
|
50744
|
+
);
|
50745
|
+
return " #" + tokId + "#";
|
50746
|
+
};
|
50747
|
+
/** @private
|
50748
|
+
* @function
|
50749
|
+
* @param {string} field
|
50750
|
+
* @return {string}
|
50751
|
+
*/
|
50752
|
+
ExpressionParser._withField = function(field) {
|
50753
|
+
var tokId = _addToken(ExpressionParser._tokens,
|
50754
|
+
field,
|
50755
|
+
"literal",
|
50756
|
+
"variable"
|
50757
|
+
);
|
50758
|
+
return " #" + tokId + "#";
|
50759
|
+
};
|
50760
|
+
/** @private
|
50761
|
+
* @function
|
50762
|
+
* @param {string} field
|
50763
|
+
* @return {string}
|
50764
|
+
*/
|
50765
|
+
ExpressionParser._withFieldInBrackets = function(field) {
|
50766
|
+
return ExpressionParser._withField(field.substring(1, field.length - 1));
|
50767
|
+
};
|
50768
|
+
/** @private
|
50769
|
+
* @function
|
50770
|
+
* @param {string} numStr
|
50771
|
+
* @return {string}
|
50772
|
+
*/
|
50773
|
+
ExpressionParser._withNegativeNumber = function(numStr) {
|
50774
|
+
var num = +numStr;
|
50775
|
+
if(num === num) {
|
50776
|
+
var tokId = _addToken(ExpressionParser._tokens,
|
50777
|
+
num,
|
50778
|
+
"literal",
|
50779
|
+
"number"
|
50780
|
+
);
|
50781
|
+
return " #" + tokId + "#";
|
50782
|
+
}
|
50783
|
+
return "";
|
50784
|
+
};
|
50785
|
+
/** @private
|
50786
|
+
* @function
|
50787
|
+
* @param {string} numStr
|
50788
|
+
* @return {string}
|
50789
|
+
*/
|
50790
|
+
ExpressionParser._withPositiveNumber = function(numStr) {
|
50791
|
+
if(numStr.charCodeAt(0) === 35) {
|
50792
|
+
return numStr; // skip token (string with leading #)
|
50793
|
+
}
|
50794
|
+
return ExpressionParser._withNegativeNumber(numStr);
|
50795
|
+
};
|
50796
|
+
/** @private
|
50797
|
+
* @function
|
50798
|
+
* @param {string} opStr
|
50799
|
+
* @return {string}
|
50800
|
+
*/
|
50801
|
+
ExpressionParser._withOperator = function(opStr) {
|
50802
|
+
if(OperatorPrecedences[opStr]) {
|
50803
|
+
if(opStr == "=" || opStr == "===") {
|
50804
|
+
opStr = "==";
|
50805
|
+
}
|
50806
|
+
var tokId = _addToken(ExpressionParser._tokens, opStr, "operator");
|
50807
|
+
return "#" + tokId + "#";
|
50808
|
+
}
|
50809
|
+
return "";
|
50810
|
+
};
|
50811
|
+
/** @private
|
50812
|
+
* @function
|
50813
|
+
* @param {string} paStr
|
50814
|
+
* @return {string}
|
50815
|
+
*/
|
50816
|
+
ExpressionParser._withParenthesis = function(paStr) {
|
50817
|
+
var tokId = _addToken(ExpressionParser._tokens, paStr, "parenthesis");
|
50818
|
+
return "#" + tokId + "#";
|
50819
|
+
};
|
50820
|
+
|
50821
|
+
|
50822
|
+
/** @private
|
50823
|
+
* @function
|
50824
|
+
* @param {Object} ctx
|
50825
|
+
* @return {boolean} Returns true if there is any error, otherwise returns false (everything is OK)
|
50826
|
+
*/
|
50827
|
+
ExpressionParser._tester = function(ctx) {
|
50828
|
+
var rpn = ctx._rpn;
|
50829
|
+
var inputCount = rpn.length;
|
50830
|
+
var operandCount = 0;
|
50831
|
+
var maxStack = 0;
|
50832
|
+
for(var i = 0; i < inputCount; ++i) {
|
50833
|
+
var tok = rpn[i];
|
50834
|
+
if(tok.type !== "literal") {
|
50835
|
+
if(operandCount >= 2) {
|
50836
|
+
operandCount -= 2;
|
50837
|
+
} else {
|
50838
|
+
console.warn("Cannot parse an expression with insufficient number of operands");
|
50839
|
+
return true;
|
50840
|
+
}
|
50841
|
+
}
|
50842
|
+
operandCount++;
|
50843
|
+
if(operandCount > maxStack) {
|
50844
|
+
maxStack = operandCount;
|
50845
|
+
}
|
50846
|
+
}
|
50847
|
+
|
50848
|
+
if(operandCount !== 1) {
|
50849
|
+
return true;
|
50850
|
+
}
|
50851
|
+
|
50852
|
+
ctx._stackSize = maxStack;
|
50853
|
+
return false;
|
50854
|
+
};
|
50855
|
+
/** @private
|
50856
|
+
* @function
|
50857
|
+
* @param {Object} ctx
|
50858
|
+
* @param {Object} rowData
|
50859
|
+
* @return {boolean}
|
50860
|
+
*/
|
50861
|
+
ExpressionParser._filter = function(ctx, rowData) {
|
50862
|
+
var rpn = ctx._rpn;
|
50863
|
+
var results = new Array(ctx._stackSize);
|
50864
|
+
var inputCount = rpn.length;
|
50865
|
+
var operandCount = 0;
|
50866
|
+
var curRes;
|
50867
|
+
for(var i = 0; i < inputCount; ++i) {
|
50868
|
+
var tok = rpn[i];
|
50869
|
+
var tokValue = tok.value;
|
50870
|
+
if(tok.type === "literal") {
|
50871
|
+
if(tok.dataType !== "variable") {
|
50872
|
+
curRes = tokValue;
|
50873
|
+
} else {
|
50874
|
+
curRes = rowData ? rowData[tokValue] : null;
|
50875
|
+
}
|
50876
|
+
} else { // operator
|
50877
|
+
curRes = OperatorFunctions[tokValue](
|
50878
|
+
results[operandCount - 2],
|
50879
|
+
results[operandCount - 1]
|
50880
|
+
);
|
50881
|
+
operandCount -= 2;
|
50882
|
+
}
|
50883
|
+
results[operandCount++] = curRes;
|
50884
|
+
}
|
50885
|
+
// return results[0];
|
50886
|
+
return results[0] ? true : false;
|
50887
|
+
};
|
50888
|
+
|
50889
|
+
/** Parse an expression into a filter function (returning boolean value)
|
50890
|
+
* @public
|
50891
|
+
* @param {string|Function} expression
|
50892
|
+
* @return {Function}
|
50893
|
+
* @example
|
50894
|
+
* func = ExpressionParser.parse("field1 >= 10");
|
50895
|
+
* func = ExpressionParser.parse("[field with space] != 'text'");
|
50896
|
+
* func = ExpressionParser.parse("(field1 + 1) / 2 < 10 && field2 - 10 > 3");
|
50897
|
+
*/
|
50898
|
+
ExpressionParser.parse = function(expression) {
|
50899
|
+
if(typeof expression === "function") {
|
50900
|
+
return expression;
|
50901
|
+
}
|
50902
|
+
if(!expression || typeof expression !== "string") {
|
50903
|
+
return null;
|
50904
|
+
}
|
50905
|
+
|
50906
|
+
var tokExp = expression.trim();
|
50907
|
+
if(!tokExp) {
|
50908
|
+
return null;
|
50909
|
+
}
|
50910
|
+
ExpressionParser._tokens.length = 0;
|
50911
|
+
|
50912
|
+
tokExp = tokExp.replace(/".+?"/g, ExpressionParser._withString); // double quote string
|
50913
|
+
tokExp = tokExp.replace(/'.+?'/g, ExpressionParser._withString); // single quote string
|
50914
|
+
tokExp = tokExp.replace(/\[.+?\]/g, ExpressionParser._withFieldInBrackets); // field in square brackets
|
50915
|
+
tokExp = tokExp.replace(/-[0-9.]+/g, ExpressionParser._withNegativeNumber);
|
50916
|
+
tokExp = tokExp.replace(/[0-9.#]+/g, ExpressionParser._withPositiveNumber);
|
50917
|
+
tokExp = tokExp.replace(/[a-zA-Z_]\w*/g, ExpressionParser._withField);
|
50918
|
+
tokExp = tokExp.replace(/[\-\/+*%!=<>&|]+/g, ExpressionParser._withOperator);
|
50919
|
+
tokExp = tokExp.replace(/[()]/g, ExpressionParser._withParenthesis); // round brackets
|
50920
|
+
|
50921
|
+
var tokens = ExpressionParser._tokens;
|
50922
|
+
var tokCount = tokens.length;
|
50923
|
+
if(!tokCount) {
|
50924
|
+
return null; // There is no recognizable character
|
50925
|
+
}
|
50926
|
+
|
50927
|
+
// Generate infix token list
|
50928
|
+
var infixTokens = [];
|
50929
|
+
var matches = tokExp.match(/#[0-9]+#/g);
|
50930
|
+
var i, tok, tokType;
|
50931
|
+
for(i = 0; i < tokCount; ++i) {
|
50932
|
+
var tokId = matches[i];
|
50933
|
+
var tokIdx = +(tokId.substring(1, tokId.length - 1));
|
50934
|
+
tok = tokens[tokIdx];
|
50935
|
+
tokType = tok.type;
|
50936
|
+
if(tokType === "literal") {
|
50937
|
+
var prevTok = infixTokens[infixTokens.length - 1];
|
50938
|
+
if(prevTok && prevTok.type === "literal") { // Incorrect infix notation detected
|
50939
|
+
if(tok.value < 0 && tok.dataType === "number") {
|
50940
|
+
_addToken(infixTokens, "-", "operator");
|
50941
|
+
tok.value *= -1;
|
50942
|
+
} else {
|
50943
|
+
console.warn("Cannot parse an expression with insufficient number of operators");
|
50944
|
+
return null;
|
50945
|
+
}
|
50946
|
+
}
|
50947
|
+
}
|
50948
|
+
infixTokens.push(tok);
|
50949
|
+
}
|
50950
|
+
// TODO: Handle the case where subtraction operator is in front of a variable
|
50951
|
+
ExpressionParser._tokens.length = 0;
|
50952
|
+
|
50953
|
+
// Convert Infix notation to Reverse Polish Notation (Postfix)
|
50954
|
+
// See https://en.wikipedia.org/wiki/Shunting_yard_algorithm#The_algorithm_in_detail
|
50955
|
+
tokCount = infixTokens.length;
|
50956
|
+
var rpn = [];
|
50957
|
+
var operators = [];
|
50958
|
+
var lastOp = null;
|
50959
|
+
var foundLeftPa = false;
|
50960
|
+
for(i = 0; i < tokCount; ++i) {
|
50961
|
+
tok = infixTokens[i];
|
50962
|
+
tokType = tok.type;
|
50963
|
+
|
50964
|
+
if(tokType === "literal") {
|
50965
|
+
rpn.push(tok);
|
50966
|
+
} else if(tokType === "parenthesis") {
|
50967
|
+
if(tok.value === "(") {
|
50968
|
+
operators.push(tok);
|
50969
|
+
} else { // When finding right parenthesis, pop all operators until left parenthesis
|
50970
|
+
foundLeftPa = false;
|
50971
|
+
while(operators.length) {
|
50972
|
+
lastOp = operators.pop();
|
50973
|
+
if(lastOp.value === "(" && lastOp.type === "parenthesis") {
|
50974
|
+
foundLeftPa = true;
|
50975
|
+
break;
|
50976
|
+
} else {
|
50977
|
+
rpn.push(lastOp);
|
50978
|
+
}
|
50979
|
+
}
|
50980
|
+
if(!foundLeftPa) {
|
50981
|
+
console.warn("No left parenthesis paired with the right one");
|
50982
|
+
}
|
50983
|
+
}
|
50984
|
+
} else { // operator
|
50985
|
+
lastOp = operators[operators.length - 1];
|
50986
|
+
var prevPrecedence = lastOp ? lastOp.precedence : null;
|
50987
|
+
if(prevPrecedence != null && tok.precedence <= prevPrecedence) {
|
50988
|
+
rpn.push(operators.pop());
|
50989
|
+
}
|
50990
|
+
operators.push(tok);
|
50991
|
+
}
|
50992
|
+
}
|
50993
|
+
|
50994
|
+
foundLeftPa = false;
|
50995
|
+
while(operators.length) {
|
50996
|
+
lastOp = operators.pop();
|
50997
|
+
if(lastOp.value === "(" && lastOp.type === "parenthesis") {
|
50998
|
+
foundLeftPa = true;
|
50999
|
+
} else {
|
51000
|
+
rpn.push(lastOp);
|
51001
|
+
}
|
51002
|
+
}
|
51003
|
+
if(foundLeftPa) {
|
51004
|
+
console.warn("No right parenthesis paired with the left one");
|
51005
|
+
}
|
51006
|
+
|
51007
|
+
var inputCount = rpn.length;
|
51008
|
+
if(!inputCount) {
|
51009
|
+
return null; // The expression contains nothing but parentheses
|
51010
|
+
}
|
51011
|
+
|
51012
|
+
var ctx = {
|
51013
|
+
_rpn: rpn
|
51014
|
+
};
|
51015
|
+
|
51016
|
+
if(ExpressionParser._tester(ctx)) {
|
51017
|
+
return null; // Insufficient number of operands
|
51018
|
+
}
|
51019
|
+
|
51020
|
+
return ExpressionParser._filter.bind(null, ctx);
|
51021
|
+
};
|
51022
|
+
|
51023
|
+
/* harmony default export */ var es6_ExpressionParser = (ExpressionParser);
|
51024
|
+
|
51025
|
+
|
50698
51026
|
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/CellPainter.js
|
50699
51027
|
|
50700
51028
|
|
50701
51029
|
|
50702
51030
|
|
51031
|
+
|
50703
51032
|
/** @typedef {Object} CellPainter~Expression
|
50704
51033
|
* @property {string=} name
|
50705
51034
|
* @property {string} text Text describes condition e.g. [FIELD] > 10
|
@@ -50829,7 +51158,8 @@ CellPainter.supportedStyles = CellPainter.bgStyles.concat(CellPainter.nonBgStyle
|
|
50829
51158
|
*/
|
50830
51159
|
CellPainter.themeReady = null;
|
50831
51160
|
|
50832
|
-
/**
|
51161
|
+
/** Deprecated in favor of ExpressionParser
|
51162
|
+
* @public
|
50833
51163
|
* @function
|
50834
51164
|
* @param {string|Function} expression
|
50835
51165
|
* @return {Function}
|
@@ -50837,7 +51167,7 @@ CellPainter.themeReady = null;
|
|
50837
51167
|
* var fn = CellPainter.parse("[CF_BID] >= 10 && [CF_BID] <= 100");
|
50838
51168
|
* window.console.log(fn(25));
|
50839
51169
|
*/
|
50840
|
-
CellPainter.parse =
|
51170
|
+
CellPainter.parse = ExpressionParser.parse;
|
50841
51171
|
|
50842
51172
|
|
50843
51173
|
/** @public */
|
@@ -51009,7 +51339,7 @@ CellPainter.prototype.getColumnStats = function() {
|
|
51009
51339
|
CellPainter.prototype._addCondition = function(condition) {
|
51010
51340
|
var exp = condition["expression"];
|
51011
51341
|
if(exp) {
|
51012
|
-
condition._fn =
|
51342
|
+
condition._fn = ExpressionParser.parse(exp["text"] || exp);
|
51013
51343
|
this._conditions.push(condition);
|
51014
51344
|
}
|
51015
51345
|
};
|
@@ -51477,7 +51807,7 @@ CellPainter.blackAndWhite = function (triplet) {
|
|
51477
51807
|
* @param {string} rgbCode
|
51478
51808
|
* @return {string} resultColor E.g. "#10FF0D"
|
51479
51809
|
*/
|
51480
|
-
CellPainter.rgb2Hex =
|
51810
|
+
CellPainter.rgb2Hex = rgb2Hex; // For backward compatability
|
51481
51811
|
|
51482
51812
|
/** @public
|
51483
51813
|
* @function
|