@refinitiv-ui/efx-grid 6.0.45 → 6.0.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -112,6 +112,8 @@ declare class DataTable extends DataCache {
112
112
 
113
113
  public getSegmentChildIds(segmentId: string): (string)[]|null;
114
114
 
115
+ public sortSeparators(sortLogics: ((...params: any[]) => any)|(((...params: any[]) => any))[]|null, sortOrders: (number)[]|null, cids: (string)[]|null): boolean;
116
+
115
117
  public sortSegments(compare: ((...params: any[]) => any)|null): boolean;
116
118
 
117
119
  public setClassificationSource(dc: DataCache|null): void;
@@ -76,6 +76,14 @@ DataTable.prototype._removedRows = null;
76
76
  */
77
77
  DataTable.prototype._userSegmentComparer = null;
78
78
  /** @private
79
+ * @type {number}
80
+ */
81
+ DataTable.prototype._segmentSortOrder = 0;
82
+ /** @private
83
+ * @type {*}
84
+ */
85
+ DataTable.prototype._segmentSortContext = null;
86
+ /** @private
79
87
  * @type {Object.<string, Object>}
80
88
  */
81
89
  DataTable.prototype._clsSource = null;
@@ -1248,6 +1256,51 @@ DataTable.prototype.getSegmentChildIds = function(segmentId) {
1248
1256
  }
1249
1257
  return null;
1250
1258
  };
1259
+ /** Sort all of existing segments by multiple sort logics
1260
+ * @public
1261
+ * @param {Function|Array.<Function>} sortLogics
1262
+ * @param {Array.<number>} sortOrders
1263
+ * @param {Array.<string>} cids
1264
+ * @return {boolean}
1265
+ */
1266
+ DataTable.prototype.sortSeparators = function (sortLogics, sortOrders, cids) {
1267
+ var dirty = false;
1268
+ if(!this._segments){
1269
+ return false;
1270
+ }
1271
+ if(typeof sortLogics === "function"){
1272
+ return this.sortSegments(sortLogics);
1273
+ }
1274
+ var sortingDefs = DataTable._buildSortContext(
1275
+ [],
1276
+ cids,
1277
+ sortOrders,
1278
+ sortLogics
1279
+ );
1280
+ var defCount = sortingDefs ? sortingDefs.length : 0;
1281
+ if(!defCount){
1282
+ return dirty;
1283
+ }
1284
+
1285
+ var sortOrder = 0;
1286
+ var sortLogic, sortContext;
1287
+ if(defCount > 1) {
1288
+ sortLogic = DataTable._multiColumnSeparatorCompareLogic;
1289
+ sortContext = sortingDefs;
1290
+ sortOrder = 1; // sortOrder is not used by _multiColumnSeparatorCompareLogic
1291
+ } else { // Single level sorting
1292
+ sortLogic = DataTable._singleColumnSeparatorCompareLogic;
1293
+ sortContext = sortingDefs[0];
1294
+ sortOrder = /** @type{number} */(sortContext[3]);
1295
+ }
1296
+ this._segmentSortOrder = sortOrder;
1297
+ this._segmentSortContext = sortContext;
1298
+ dirty = this.sortSegments(sortLogic);
1299
+ this._segmentSortOrder = 0;
1300
+ this._segmentSortContext = null;
1301
+
1302
+ return dirty;
1303
+ };
1251
1304
  /** Sort all of existing segments by given compare function
1252
1305
  * @public
1253
1306
  * @param {Function} compare
@@ -1316,7 +1369,9 @@ DataTable.prototype.sortSegments = function (compare) {
1316
1369
  DataTable.prototype._bySegmentSeparator = function (segmentA, segmentB) {
1317
1370
  return /** @type{number} */(this._userSegmentComparer(
1318
1371
  this.getRowData(segmentA.getId()),
1319
- this.getRowData(segmentB.getId())
1372
+ this.getRowData(segmentB.getId()),
1373
+ this._segmentSortOrder,
1374
+ this._segmentSortContext
1320
1375
  ));
1321
1376
  };
1322
1377
 
@@ -1657,6 +1712,47 @@ DataTable._singleColumnCompareLogic = function(a, b, order, sortingDef) {
1657
1712
  sortingDef[4] // Context object
1658
1713
  ));
1659
1714
  };
1715
+ /** Performance is extremely vital in this method
1716
+ * @public
1717
+ * @ignore
1718
+ * @function
1719
+ * @param {*} a
1720
+ * @param {*} b
1721
+ * @param {number} order Not used by in this method
1722
+ * @param {Array.<Array>} sortingDefs
1723
+ * @return {number}
1724
+ */
1725
+ DataTable._multiColumnSeparatorCompareLogic = function(a, b, order, sortingDefs) {
1726
+ var count = sortingDefs.length;
1727
+ var result = 0;
1728
+ for(var c = 0; c < count; ++c) {
1729
+ var sortingDef = sortingDefs[c];
1730
+ result = DataTable._singleColumnSeparatorCompareLogic(a, b, sortingDef[3], sortingDef);
1731
+ if(result) {
1732
+ return result;
1733
+ }
1734
+ }
1735
+ return result;
1736
+ };
1737
+ /** Performance is extremely vital in this method
1738
+ * @public
1739
+ * @ignore
1740
+ * @function
1741
+ * @param {*} a
1742
+ * @param {*} b
1743
+ * @param {number} order
1744
+ * @param {Array} sortingDef
1745
+ * @return {number}
1746
+ */
1747
+ DataTable._singleColumnSeparatorCompareLogic = function(a, b, order, sortingDef) {
1748
+ var key = /** @type{string} */(sortingDef[0]);
1749
+ return /** @type{number} */(sortingDef[2](
1750
+ a[key], // Value1
1751
+ b[key], // Value2
1752
+ order, // Sort order (3)
1753
+ sortingDef[4] // Context object
1754
+ ));
1755
+ };
1660
1756
  /** @public
1661
1757
  * @function
1662
1758
  * @ignore
@@ -272,6 +272,8 @@ declare class DataView extends EventDispatcher {
272
272
 
273
273
  public getSegmentChildIds(segmentRef: string|number|null): (string)[]|null;
274
274
 
275
+ public sortSeparators(sortLogics: (((...params: any[]) => any))[]|null, sortOrders: (number)[]|null, cids: (string)[]|null): void;
276
+
275
277
  public sortSegments(compare: ((...params: any[]) => any)|null): void;
276
278
 
277
279
  public enableEmptySegmentFiltering(enabled?: boolean|null): void;
@@ -2548,6 +2548,15 @@ DataView.prototype.getSegmentIds = function() {
2548
2548
  DataView.prototype.getSegmentChildIds = function(segmentRef) {
2549
2549
  return this._dt.getSegmentChildIds(this._toRowId(segmentRef));
2550
2550
  };
2551
+ /** Sort all of existing segments by multiple sort logics
2552
+ * @public
2553
+ * @param {Array.<Function>} sortLogics
2554
+ * @param {Array.<number>} sortOrders
2555
+ * @param {Array.<string>} cids
2556
+ */
2557
+ DataView.prototype.sortSeparators = function (sortLogics, sortOrders, cids) {
2558
+ this._dt.sortSeparators(sortLogics, sortOrders, cids);
2559
+ };
2551
2560
  /** Sort all of existing segments by given compare function
2552
2561
  * @public
2553
2562
  * @param {Function} compare
@@ -554,7 +554,7 @@ Core.prototype._batches = null;
554
554
  * @return {string}
555
555
  */
556
556
  Core.getVersion = function () {
557
- return "5.1.65";
557
+ return "5.1.66";
558
558
  };
559
559
  /** {@link ElementWrapper#dispose}
560
560
  * @override
@@ -135,6 +135,8 @@ declare class SortableTitlePlugin extends EventDispatcher {
135
135
 
136
136
  public clearAllColumnSortingSequences(): void;
137
137
 
138
+ public sortSeparators(comparer: ((...params: any[]) => any)|null): void;
139
+
138
140
  }
139
141
 
140
142
  declare function len(disabled?: boolean|null): void;
@@ -1358,6 +1358,28 @@ SortableTitlePlugin.prototype.setSortingSequence = function (sequence, colRef) {
1358
1358
  SortableTitlePlugin.prototype.clearAllColumnSortingSequences = function () {
1359
1359
  this._sortingSequenceMap = null;
1360
1360
  };
1361
+ /** @public
1362
+ * @description Sorting all separators according to compare function. If compare function is not specified, separators will will be sort by current sorting states.
1363
+ * @param {Function} comparer Compare function
1364
+ */
1365
+ SortableTitlePlugin.prototype.sortSeparators = function (comparer) {
1366
+ var host = this._hosts[0];
1367
+ var dv = host.getDataSource();
1368
+ if(comparer){
1369
+ dv.sortSeparators(comparer);
1370
+ } else {
1371
+ var sortLogics = dv.getSortingLogics();
1372
+ var sortOrders = [];
1373
+ var sortFields = [];
1374
+ var sortStateCount = this._sortStates.length;
1375
+ for(var i = 0; i < sortStateCount; i++){
1376
+ var sortState = this._sortStates[i];
1377
+ sortOrders.push(sortState["sortOrder"]);
1378
+ sortFields.push(sortState["field"]);
1379
+ }
1380
+ dv.sortSeparators(sortLogics, sortOrders, sortFields);
1381
+ }
1382
+ };
1361
1383
 
1362
1384
 
1363
1385
  /** @private
package/lib/grid/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import {Grid} from "./lib/efx-grid.js";
2
2
  export {Grid}
3
- window.EFX_GRID = { version: "6.0.45" };
3
+ window.EFX_GRID = { version: "6.0.47" };
@@ -0,0 +1,49 @@
1
+ import { Ext } from "../../tr-grid-util/es6/Ext.js";
2
+ import { ElementWrapper } from "../../tr-grid-util/es6/ElementWrapper.js"; // ElementWrapper doesnot have setStyle and etc.
3
+ import { Dom } from "../../tr-grid-util/es6/Dom.js";
4
+
5
+ declare class CellWriter extends ElementWrapper {
6
+
7
+ constructor();
8
+
9
+ public getContent(): Node|null|null;
10
+
11
+ public setContent(content: any, opt_tooltip?: boolean): Element|null;
12
+
13
+ public setTooltip(str: string): void;
14
+
15
+ public setTextContent(str: string): void;
16
+
17
+ public addContent(n: any): Element|null;
18
+
19
+ public setStyle(str: string, val: any): void;
20
+
21
+ public removeIcon(n: any): void;
22
+
23
+ public updateIcon(elem: Element): void;
24
+
25
+ public unlisten(): void;
26
+
27
+ public listen(): void;
28
+
29
+ public setTooltip(): void;
30
+
31
+ public addClass(str: string): void;
32
+
33
+ public hasClass(str: string): void;
34
+
35
+ public removeClass(str: string): void;
36
+
37
+ public enableClass(str: string, bool: boolean): void;
38
+
39
+ public insertFloatingIcon(elem: Element, order: number): void;
40
+
41
+ public removeFloatingIcon(elemRef: string|Element, order: number): void;
42
+
43
+ public getSection(): null;
44
+
45
+ public cloak(elem: Element): void;
46
+
47
+ }
48
+
49
+ export { CellWriter };
@@ -0,0 +1,226 @@
1
+ import { Ext } from "../../tr-grid-util/es6/Ext.js";
2
+ import { ElementWrapper } from "../../tr-grid-util/es6/ElementWrapper.js"; // ElementWrapper doesnot have setStyle and etc.
3
+ import { Dom } from "../../tr-grid-util/es6/Dom.js";
4
+
5
+ /**
6
+ * @constructor
7
+ * @extends {ElementWrapper}
8
+ */
9
+ var CellWriter = function () {
10
+ };
11
+ Ext.inherits(CellWriter, ElementWrapper);
12
+
13
+ /** @type
14
+ * @private
15
+ */
16
+ CellWriter.prototype._flexRow = null;
17
+ /** @type
18
+ * @private
19
+ */
20
+ CellWriter.prototype._floatingPanel = null;
21
+ /** @type
22
+ * @private
23
+ */
24
+ CellWriter.prototype._frontPanel = null;
25
+
26
+
27
+ /** @public
28
+ * @return {Node|null} content
29
+ */
30
+ CellWriter.prototype.getContent = function () {
31
+ return this._elem.children[0] || null;
32
+ };
33
+ /** @public
34
+ * @param {*} content
35
+ * @param {boolean=} opt_tooltip
36
+ * @return {Element}
37
+ */
38
+ CellWriter.prototype.setContent = function (content, opt_tooltip) {
39
+ if(content == null) {
40
+ return null;
41
+ }
42
+ if(content["getElement"]) {
43
+ content = /** @type{Element} */(content["getElement"]());
44
+ } else if(content.nodeType !== 1) {
45
+ content = this._createTextContent(content);
46
+ }
47
+ Dom.removeChildren(this._elem);
48
+ this._elem.appendChild(/** @type{Node} */(content));
49
+ return /** @type{Element} */(content);
50
+ };
51
+
52
+ /**
53
+ * Set value to title. If value is absent then a title will be removed
54
+ * @public
55
+ * @param {string} str
56
+ */
57
+ CellWriter.prototype.setTooltip = function (str) {
58
+ if(str) {
59
+ this._elem.setAttribute("title", str);
60
+ } else {
61
+ this._elem.removeAttribute("title");
62
+ }
63
+ };
64
+
65
+ /** @public
66
+ * @param {string} str
67
+ */
68
+ CellWriter.prototype.setTextContent = function (str) {
69
+ Dom.removeChildren(this._elem);
70
+ this._elem.appendChild(this._createTextContent(str));
71
+ };
72
+ /** @public
73
+ * @param {*} n
74
+ * @return {Element}
75
+ */
76
+ CellWriter.prototype.addContent = function (n) {
77
+ this._elem.appendChild(/** @type{Node} */(n));
78
+ return /** @type{Element} */(n);
79
+ };
80
+ /** @private
81
+ * @param {string} str
82
+ * @return {Element}
83
+ */
84
+ CellWriter.prototype._createTextContent = function (str) {
85
+ var div = Dom.div("text");
86
+ if(str != null) {
87
+ div.textContent = str;
88
+ this["percentText"] = str; // HACK
89
+ }
90
+ return div;
91
+ };
92
+
93
+ /** @public
94
+ * @param {string} str
95
+ * @param {*} val
96
+ */
97
+ CellWriter.prototype.setStyle = function (str, val) {
98
+ this._elem.style[str] = val;
99
+ };
100
+ /** @public
101
+ * @param {*} n
102
+ */
103
+ CellWriter.prototype.removeIcon = function (n) {};
104
+ /** @public
105
+ * @param {Element} elem
106
+ */
107
+ CellWriter.prototype.updateIcon = function (elem) {
108
+ if(elem && elem.nodeType === 1) {
109
+ var fp = this._frontPanel;
110
+ if(!fp) {
111
+ this._flexRow = document.createElement("div");
112
+ this._flexRow.className = "tr-printing-flex-row";
113
+
114
+ fp = this._floatingPanel = document.createElement("div");
115
+ fp.className = "tr-printing-float-right";
116
+ this._flexRow.appendChild(fp);
117
+ var chdr = this._elem.children;
118
+ var childCount = chdr.length;
119
+ if(childCount) {
120
+ var ary = new Array(childCount);
121
+ for(var i = 0; i < childCount; ++i) {
122
+ ary[i] = chdr[i];
123
+ }
124
+ Dom.appendChild(this._flexRow, ary);
125
+ }
126
+ this._elem.appendChild(this._flexRow);
127
+ }
128
+ fp.appendChild(elem.cloneNode(true));
129
+ }
130
+ };
131
+ /** @public
132
+ */
133
+ CellWriter.prototype.unlisten = function () {};
134
+ /** @public
135
+ */
136
+ CellWriter.prototype.listen = function () {};
137
+
138
+ /** @public
139
+ */
140
+ CellWriter.prototype.setTooltip = function () {};
141
+
142
+ /** @public
143
+ * @param {string} str
144
+ */
145
+ CellWriter.prototype.addClass = function (str) {
146
+ this._elem.classList.add(str);
147
+ };
148
+ /** @public
149
+ * @param {string} str
150
+ */
151
+ CellWriter.prototype.hasClass = function (str) {
152
+ this._elem.classList.contains(str);
153
+ };
154
+ /** @public
155
+ * @param {string} str
156
+ */
157
+ CellWriter.prototype.removeClass = function (str) {
158
+ this._elem.classList.remove(str);
159
+ };
160
+ /** @public
161
+ * @param {string} str
162
+ * @param {boolean} bool
163
+ */
164
+ CellWriter.prototype.enableClass = function (str, bool) {
165
+ if(bool || bool == null) {
166
+ this.addClass(str);
167
+ } else {
168
+ this.removeClass(str);
169
+ }
170
+ };
171
+
172
+ /** @public
173
+ * @param {Element} elem
174
+ * @param {number} order
175
+ */
176
+ CellWriter.prototype.insertFloatingIcon = function (elem, order) {
177
+ if(elem && elem.nodeType === 1) {
178
+ var fp = this._floatingPanel;
179
+ if(!fp) {
180
+ this._flexRow = document.createElement("div");
181
+ this._flexRow.className = "tr-printing-flex-row";
182
+
183
+ var chdr = this._elem.children;
184
+ var childCount = chdr.length;
185
+ if(childCount) {
186
+ var ary = new Array(childCount);
187
+ for(var i = 0; i < childCount; ++i) {
188
+ ary[i] = chdr[i];
189
+ }
190
+ Dom.appendChild(this._flexRow, ary);
191
+ }
192
+ fp = this._floatingPanel = document.createElement("div");
193
+ fp.className = "tr-printing-float-right";
194
+ this._flexRow.appendChild(fp);
195
+ this._elem.appendChild(this._flexRow);
196
+ }
197
+ fp.appendChild(elem.cloneNode(true));
198
+ }
199
+ };
200
+ /** @public
201
+ * @param {string|Element} elemRef
202
+ * @param {number} order
203
+ */
204
+ CellWriter.prototype.removeFloatingIcon = function (elemRef, order) {};
205
+ /** @public
206
+ * @return {null}
207
+ */
208
+ CellWriter.prototype.getSection = function () {
209
+ return null;
210
+ };
211
+
212
+ /**
213
+ * @public
214
+ * @param {Element} elem
215
+ */
216
+ CellWriter.prototype.cloak = function (elem) {
217
+ delete this.percentText;
218
+ delete this._flexRow;
219
+ delete this._floatingPanel;
220
+ delete this._frontPanel;
221
+ elem.className = "cell";
222
+ this._elem = elem;
223
+ };
224
+
225
+
226
+ export { CellWriter };
@@ -0,0 +1,12 @@
1
+ import { Ext } from "../../tr-grid-util/es6/Ext.js";
2
+ import { ElementWrapper } from "../../tr-grid-util/es6/ElementWrapper.js";
3
+
4
+ declare class ColumnWriter extends ElementWrapper {
5
+
6
+ constructor();
7
+
8
+ public isActive(): number;
9
+
10
+ }
11
+
12
+ export { ColumnWriter };
@@ -0,0 +1,21 @@
1
+ import { Ext } from "../../tr-grid-util/es6/Ext.js";
2
+ import { ElementWrapper } from "../../tr-grid-util/es6/ElementWrapper.js";
3
+
4
+ /**
5
+ * @constructor
6
+ * @extends {ElementWrapper}
7
+ */
8
+ var ColumnWriter = function () {
9
+ };
10
+ Ext.inherits(ColumnWriter, ElementWrapper);
11
+
12
+
13
+ /** @public
14
+ * @return {number}
15
+ */
16
+ ColumnWriter.prototype.isActive = function () {
17
+ return true;
18
+ };
19
+
20
+
21
+ export { ColumnWriter };
@@ -0,0 +1,32 @@
1
+ import { Dom } from "../../tr-grid-util/es6/Dom.js";
2
+ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
3
+ import { Table } from "../../tr-grid-util/es6/Table.js";
4
+
5
+ import { PrintTrait } from "./PrintTrait.js";
6
+ import { SectionWriter } from "./SectionWriter.js";
7
+
8
+ declare namespace GridPrinter {
9
+
10
+ function setPrintOptions(options: GridPrinter.Options): void;
11
+
12
+ function observe(iFrameElement?: HTMLIFrameElement): void;
13
+
14
+ function unobserve(): void;
15
+
16
+ function enableDebugMode(bool?: boolean): void;
17
+
18
+ function getPreFlightInfo(grid: any, options?: any): any;
19
+
20
+ function createPrintElement(grid: any, options?: any): Element|null;
21
+
22
+ function print(grid: any): void;
23
+
24
+ type Options = {
25
+ pageWidth?: number,
26
+ pageHeight?: number,
27
+ primaryColumn?: number
28
+ };
29
+
30
+ }
31
+
32
+ export { GridPrinter };