@refinitiv-ui/efx-grid 6.0.43 → 6.0.45

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. package/lib/column-selection-dialog/lib/column-selection-dialog.d.ts +3 -1
  2. package/lib/column-selection-dialog/lib/column-selection-dialog.js +24 -3
  3. package/lib/column-selection-dialog/themes/base.less +23 -12
  4. package/lib/column-selection-dialog/themes/elemental/dark/column-selection-dialog.js +1 -1
  5. package/lib/column-selection-dialog/themes/elemental/dark/es5/all-elements.js +1 -1
  6. package/lib/column-selection-dialog/themes/elemental/light/column-selection-dialog.js +1 -1
  7. package/lib/column-selection-dialog/themes/elemental/light/es5/all-elements.js +1 -1
  8. package/lib/column-selection-dialog/themes/halo/dark/column-selection-dialog.js +1 -1
  9. package/lib/column-selection-dialog/themes/halo/dark/es5/all-elements.js +1 -1
  10. package/lib/column-selection-dialog/themes/halo/light/column-selection-dialog.js +1 -1
  11. package/lib/column-selection-dialog/themes/halo/light/es5/all-elements.js +1 -1
  12. package/lib/column-selection-dialog/themes/solar/charcoal/column-selection-dialog.js +1 -1
  13. package/lib/column-selection-dialog/themes/solar/charcoal/es5/all-elements.js +1 -1
  14. package/lib/column-selection-dialog/themes/solar/pearl/column-selection-dialog.js +1 -1
  15. package/lib/column-selection-dialog/themes/solar/pearl/es5/all-elements.js +1 -1
  16. package/lib/core/dist/core.js +204 -186
  17. package/lib/core/dist/core.min.js +1 -1
  18. package/lib/core/es6/data/DataView.d.ts +2 -0
  19. package/lib/core/es6/data/DataView.js +170 -81
  20. package/lib/core/es6/data/Segment.d.ts +2 -0
  21. package/lib/core/es6/data/Segment.js +6 -0
  22. package/lib/core/es6/grid/Core.d.ts +0 -4
  23. package/lib/core/es6/grid/Core.js +28 -105
  24. package/lib/grid/index.js +1 -1
  25. package/lib/index.d.ts +0 -4
  26. package/lib/index.js +0 -4
  27. package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +5 -0
  28. package/lib/tr-grid-row-filtering/es6/RowFiltering.js +30 -1
  29. package/lib/tr-grid-util/es6/CoralItems.js +2 -2
  30. package/lib/tr-grid-util/es6/ElfDate.js +1 -1
  31. package/lib/tr-grid-util/es6/ElfUtil.js +2 -2
  32. package/lib/tr-grid-util/es6/ExpanderIcon.js +1 -1
  33. package/lib/tr-grid-util/es6/GridPlugin.js +1 -1
  34. package/lib/tr-grid-util/es6/Icon.js +3 -3
  35. package/lib/tr-grid-util/es6/MultiTableManager.js +3 -3
  36. package/lib/tr-grid-util/es6/RowPainter.js +6 -2
  37. package/lib/tr-grid-util/es6/jet/Adc.d.ts +9 -0
  38. package/lib/tr-grid-util/es6/jet/Adc.js +268 -0
  39. package/lib/tr-grid-util/es6/jet/MockQuotes2.js +96 -7
  40. package/lib/tr-grid-util/es6/jet/MockUtil.d.ts +7 -0
  41. package/lib/tr-grid-util/es6/jet/MockUtil.js +25 -0
  42. package/lib/tr-grid-util/es6/jet/mockDataAPI.d.ts +2 -3
  43. package/lib/tr-grid-util/es6/jet/mockDataAPI.js +3 -288
  44. package/lib/types/es6/Core/data/DataView.d.ts +2 -0
  45. package/lib/types/es6/Core/data/Segment.d.ts +2 -0
  46. package/lib/types/es6/Core/grid/Core.d.ts +0 -4
  47. package/lib/types/es6/RealtimeGrid/Grid.d.ts +2 -1
  48. package/lib/utils/index.d.ts +5 -3
  49. package/lib/utils/index.js +5 -3
  50. package/lib/versions.json +3 -5
  51. package/lib/window-exporter.js +5 -0
  52. package/package.json +1 -1
  53. package/lib/tr-grid-printer/es6/CellWriter.d.ts +0 -49
  54. package/lib/tr-grid-printer/es6/CellWriter.js +0 -226
  55. package/lib/tr-grid-printer/es6/ColumnWriter.d.ts +0 -12
  56. package/lib/tr-grid-printer/es6/ColumnWriter.js +0 -21
  57. package/lib/tr-grid-printer/es6/GridPrinter.d.ts +0 -32
  58. package/lib/tr-grid-printer/es6/GridPrinter.js +0 -774
  59. package/lib/tr-grid-printer/es6/PrintTrait.d.ts +0 -38
  60. package/lib/tr-grid-printer/es6/PrintTrait.js +0 -481
  61. package/lib/tr-grid-printer/es6/SectionWriter.d.ts +0 -54
  62. package/lib/tr-grid-printer/es6/SectionWriter.js +0 -213
  63. package/lib/tr-grid-printer/es6/index.d.ts +0 -1
  64. package/lib/tr-grid-printer/es6/index.js +0 -1
@@ -1,30 +1,6 @@
1
+ import { Adc } from "./Adc.js";
1
2
  import { DataGenerator } from "./DataGenerator.js";
2
- import { DateTime } from "../DateTime.js";
3
-
4
- /**
5
- * @private
6
- * @type {object}
7
- */
8
- var _invalidFieldDict = {
9
- 'TR.NonExistField': true,
10
- 'TR.NotExistField': true,
11
- 'CF_IGNORE_FIELD': true
12
- };
13
-
14
- /** to mock invalid fields.
15
- * @public
16
- * @param {Array<string>|string} fields ex. TR.NonExistField, CF_IGNORE_FIELD
17
- */
18
- function setInvalidFields(fields) {
19
- if (fields && typeof fields === 'string') {
20
- _invalidFieldDict[fields] = true;
21
- } else if (Array.isArray(fields)) {
22
- for (var i = 0; i < fields.length; i++) {
23
- _invalidFieldDict[fields[i]] = true;
24
- }
25
- }
26
- }
27
-
3
+ import { invalidFieldDict, setInvalidFields } from "./MockUtil.js";
28
4
 
29
5
  var dataGen = new DataGenerator();
30
6
 
@@ -33,11 +9,6 @@ var dataGen = new DataGenerator();
33
9
  */
34
10
  var DataGrid = {};
35
11
 
36
- /** @private
37
- * @namespace
38
- */
39
- var Adc = {};
40
-
41
12
  /** @private
42
13
  * @function
43
14
  * @param {Object} payload
@@ -55,7 +26,7 @@ DataGrid.request = function (payload, mockResponse) {
55
26
 
56
27
  // _invalidFieldDict is a dictionary of non exist field
57
28
  // so we must remove invalid field to make "mocking api" return result more like a "real api".
58
- var invalidDict = _invalidFieldDict;
29
+ var invalidDict = invalidFieldDict;
59
30
  fields = [];
60
31
  for (i = 0; i < payload.fields.length; i++) {
61
32
  f = payload.fields[i];
@@ -116,262 +87,6 @@ DataGrid.request = function (payload, mockResponse) {
116
87
  }));
117
88
  };
118
89
 
119
- /** @private
120
- * @function
121
- * @param {Object} payload
122
- * @param {Object=} mockResponse
123
- * @return {Promise}
124
- */
125
- Adc.request = function (payload, mockResponse) {
126
- if (mockResponse) {
127
- return Promise.resolve(JSON.stringify(mockResponse));
128
- }
129
-
130
- // build row header
131
- var rows = [];
132
- var i, f, len, row, j;
133
- var identifiers, formula, fields, invalidDict;
134
- if(payload.output === "Col,date|,Row,In|,va,T,NoEmptyTickers") {
135
-
136
- identifiers = payload.identifiers;
137
- formula = payload.formula.trim().split(/(?=,TR.)/);// TODO: check each field with another way, this doesn't work when user use some comma (,) formula
138
- fields = [];
139
-
140
- // _invalidFieldDict is a dictionary of non exist field
141
- // so we must remove invalid field to make "mocking api" return result more like a "real api".
142
- invalidDict = _invalidFieldDict;
143
- for (i = 0; i < formula.length; i++) {
144
- f = formula[i];
145
- if (!invalidDict[f]) {
146
- fields.push(f);
147
- }
148
- }
149
-
150
- var fieldCount = fields.length;
151
- // formula = payload.formula.trim().split(",TR"); // TODO: split wit
152
-
153
- rows.push([
154
- {
155
- "h": true,
156
- "i": "instrument",
157
- "v": "Instrument"
158
- },
159
- {
160
- "h": true,
161
- "i": "date",
162
- "v": "Date"
163
- }
164
- ]);
165
-
166
- for (var index = 0; index < fieldCount; index++) {
167
- var timeSeriesField = fields[index];
168
-
169
- var regex = /TR.(.*)(?=\()/;
170
- var result = timeSeriesField.match(regex);
171
- var field = result[0].replace("TR.", "");
172
- var phrase = timeSeriesField.toLowerCase();
173
- var startDateRegex = /sdate=(.*)[,]/;
174
- var endDateRegex = /edate=(.*)[)]/;
175
- var startDateMatch = phrase.match(startDateRegex);
176
- var endDateMatch = phrase.match(endDateRegex);
177
-
178
- var startDate = startDateMatch ? startDateMatch[1] : DateTime.format(new Date(), "YYYY-MM-DD");
179
- var endDate = endDateMatch[1];
180
-
181
- var swapDateTmp;
182
- if(startDate > endDate) {
183
- swapDateTmp = startDate;
184
- startDate = endDate;
185
- endDate = swapDateTmp;
186
- }
187
-
188
- var msBetweenDate = (+new Date(endDate)) - (+new Date(startDate));
189
-
190
- var msInDay = 1000 * 60 * 60 * 24;
191
- var betweenDay = msBetweenDate / msInDay;
192
- // var betweenDay = Math.floor(Math.random() * 10); // For random length
193
-
194
-
195
- for (i = 0; i <= betweenDay; i++) {
196
- var date = new Date(new Date(startDate).setDate(new Date(startDate).getDate() + i));
197
- var fieldValue = {
198
- "h": true,
199
- "v": DateTime.format(date, "YYYY-MM-DDT00:00:00")
200
- };
201
- if(index === 0) { // add header 1 time
202
- rows[0].push(fieldValue);
203
- }
204
- }
205
-
206
- var rics = identifiers;
207
- for (i = 0; i < rics.length; i++) {
208
-
209
- var ric = rics[i];
210
- var rowValue = [
211
- ric,
212
- field
213
- ];
214
- for (j = 1; j <= betweenDay + 1; j++) {
215
- var generatedValue = DataGenerator.generateRecord(field);
216
- rowValue.push(generatedValue[field]);
217
-
218
- }
219
- rows.push(rowValue);
220
- }
221
- // The example rows should be look like
222
- /*
223
- [
224
- [
225
- {
226
- "h": true,
227
- "i": "instrument",
228
- "v": "Instrument"
229
- },
230
- {
231
- "h": true,
232
- "i": "date",
233
- "v": "Date"
234
- },
235
- {
236
- "h": true,
237
- "v": "2011-08-11T00:00:00"
238
- },
239
- {
240
- "h": true,
241
- "v": "2011-08-12T00:00:00"
242
- },
243
- {
244
- "h": true,
245
- "v": "2011-08-15T00:00:00"
246
- }
247
- ],
248
- [
249
- "IBM",
250
- "Price Close", // NOTE: this cannot be detech we join it with space Ex. PriceClose
251
- 159.25449372,
252
- 160.6585848,
253
- 165.23382036
254
- ],
255
- [
256
- "GOOGL.O",
257
- "Price Close",
258
- 14.066881653,
259
- 14.107921423,
260
- 13.944262828
261
- ]
262
- ]
263
- */
264
- }
265
-
266
- } else {
267
-
268
- identifiers = payload.identifiers;
269
- formula = Adc.splitFields(payload.formula);
270
- fields = [];
271
-
272
- // _invalidFieldDict is a dictionary of non exist field
273
- // so we must remove invalid field to make "mocking api" return result more like a "real api".
274
- invalidDict = _invalidFieldDict;
275
- for (i = 0; i < formula.length; i++) {
276
- f = formula[i];
277
- if (!invalidDict[f]) {
278
- fields.push(f);
279
- }
280
- }
281
-
282
- rows[0] = [{
283
- "h": true,
284
- "i": "instrument",
285
- "v": "Instrument"
286
- }];
287
- for (i = 0; i < fields.length; i++) {
288
- f = fields[i];
289
- rows[0].push({
290
- "h": true,
291
- "r": f.toUpperCase().trim()
292
- // "v": "Price Close", // Doesn't use
293
- // "p": "I_TRP_PH_PriceClose" // Doesn't use this property
294
- });
295
- }
296
-
297
- // build data
298
- var rowMap = {};
299
-
300
- len = identifiers.length;
301
- var rowData = dataGen.generate(fields, len);
302
- for (i = 0; i < len; ++i) {
303
- var inst = identifiers[i];
304
- row = rowMap[inst];
305
- if (!row) {
306
- row = rowMap[inst] = rowData[i];
307
- row.unshift(inst); // prepend instrument on each row
308
- }
309
- rows.push(row);
310
- }
311
-
312
- // There is a chance that rtk will return multiple row data per instrument
313
- // so we must create mock up for this case
314
- if (rows.length > 0) {
315
- var chance = dataGen.randInt(1, 10);
316
- if (chance <= 3) { // chance 30%
317
- var pos = dataGen.randInt(0, rows.length - 1); // random row pos
318
- row = rows[pos];
319
- len = row.length;
320
- var mockupRow = new Array(len);
321
- mockupRow[0] = row[0]; // 1st index is for instrument
322
- for (i = 1; i < len; i++) {
323
- mockupRow[i] = ''; // real case will return null or empty string
324
- }
325
- rows.splice(pos + 1, 0, mockupRow);
326
- }
327
- }
328
- }
329
-
330
-
331
- /*
332
- response type is :
333
- {
334
- cols: number,
335
- faults: Array<obj>,
336
- rows: Array<obj>,
337
- status: string
338
- }
339
- Currently, we use only the rows property for cache ADC data
340
- */
341
- return Promise.resolve(JSON.stringify({
342
- rows: rows
343
- // TODO : supports faults property
344
- }));
345
- };
346
-
347
- /**
348
- * Splits a string of comma-separated fields into an array of individual field names with optional parentheses and contents.
349
- *
350
- * @param {string} strFields - The string of comma-separated fields to split.
351
- * @returns {Array<string>} - An array of individual field names with optional parentheses and contents.
352
- */
353
- Adc.splitFields = function(strFields) {
354
- if(!strFields) {
355
- return [];
356
- }
357
-
358
- // Split the input string using the regular expression
359
- // regex is match commas that are not inside parentheses
360
- /*
361
- , - matches a comma
362
- (?![^()]*\) - negative lookahead assertion that matches if the comma is not followed by:
363
- [^()]* - any characters that are not opening or closing parentheses
364
- \) - a closing parenthesis
365
- ) - ending delimiter of the regular expression
366
- */
367
- var fields = strFields.split(/,(?![^()]*\))/);
368
- fields = fields.map(function(field) {
369
- return field.trim();
370
- });
371
-
372
- return fields;
373
- };
374
-
375
90
  /** @public
376
91
  * @function
377
92
  * @param {string} dataType
@@ -274,6 +274,8 @@ declare class DataView extends EventDispatcher {
274
274
 
275
275
  public sortSegments(compare: ((...params: any[]) => any)|null): void;
276
276
 
277
+ public enableEmptySegmentFiltering(enabled?: boolean|null): void;
278
+
277
279
  public setSegmentClassification(segmentRef: string|number|null, fields: string|(string)[]|null): boolean;
278
280
 
279
281
  public getWrapSize(): number;
@@ -27,6 +27,8 @@ declare class Segment extends EventDispatcher {
27
27
 
28
28
  public getChildIds(): (string)[];
29
29
 
30
+ public getChildren(): any;
31
+
30
32
  public getChildCount(): number;
31
33
 
32
34
  public getClassification(): (string)[]|null;
@@ -405,10 +405,6 @@ declare class Core extends ElementWrapper {
405
405
 
406
406
  public getColumnGroupChildIds(groupId: string): (string)[]|null;
407
407
 
408
- public getValidColumnList(colIds: (string)[]|null, columnMap?: any): (string)[];
409
-
410
- public createColumnMap(colIds?: (string)[]|null): any;
411
-
412
408
  public startBatch(batchType: string): boolean;
413
409
 
414
410
  public stopBatch(batchType: string): boolean;
@@ -85,7 +85,8 @@ declare namespace Grid {
85
85
  fieldCaching?: boolean|null,
86
86
  timeSeriesExpansion?: boolean|null,
87
87
  childDataField?: string|null,
88
- topSection?: boolean|null
88
+ topSection?: boolean|null,
89
+ sorting?: SortableTitlePlugin.Options|null
89
90
  };
90
91
 
91
92
  type RowReference = number|string|RowDefinition|null;
@@ -1,3 +1,5 @@
1
- import {DataGenerator} from "../tr-grid-util/es6/jet/DataGenerator.js"
2
- import {MockRTK} from "../tr-grid-util/es6/jet/MockRTK.js"
3
- export {DataGenerator, MockRTK}
1
+ import { GridPrinter } from "../tr-grid-printer/es6/GridPrinter.js";
2
+ import { MultiTableManager } from "../tr-grid-util/es6/MultiTableManager.js";
3
+ import { DataGenerator } from "../tr-grid-util/es6/jet/DataGenerator.js";
4
+ import { MockRTK } from "../tr-grid-util/es6/jet/MockRTK.js";
5
+ export { GridPrinter, MultiTableManager, DataGenerator, MockRTK };
@@ -1,3 +1,5 @@
1
- import {DataGenerator} from "../tr-grid-util/es6/jet/DataGenerator.js"
2
- import {MockRTK} from "../tr-grid-util/es6/jet/MockRTK.js"
3
- export {DataGenerator, MockRTK}
1
+ import { GridPrinter } from "../tr-grid-printer/es6/GridPrinter.js";
2
+ import { MultiTableManager } from "../tr-grid-util/es6/MultiTableManager.js";
3
+ import { DataGenerator } from "../tr-grid-util/es6/jet/DataGenerator.js";
4
+ import { MockRTK } from "../tr-grid-util/es6/jet/MockRTK.js";
5
+ export { GridPrinter, MultiTableManager, DataGenerator, MockRTK };
package/lib/versions.json CHANGED
@@ -1,5 +1,4 @@
1
1
  {
2
- "tr-grid-util": "1.3.111",
3
2
  "@grid/column-dragging": "1.0.14",
4
3
  "@grid/row-segmenting": "1.0.24",
5
4
  "@grid/statistics-row": "1.0.14",
@@ -21,17 +20,16 @@
21
20
  "tr-grid-in-cell-editing": "1.0.78",
22
21
  "tr-grid-pagination": "1.0.24",
23
22
  "tr-grid-percent-bar": "1.0.22",
24
- "tr-grid-printer": "1.0.16",
25
23
  "tr-grid-range-bar": "2.0.4",
26
24
  "tr-grid-row-dragging": "1.0.29",
27
- "tr-grid-row-filtering": "1.0.56",
28
- "tr-grid-row-grouping": "1.0.80",
25
+ "tr-grid-row-filtering": "1.0.57",
26
+ "tr-grid-row-grouping": "1.0.81",
29
27
  "tr-grid-row-selection": "1.0.23",
30
28
  "tr-grid-rowcoloring": "1.0.23",
31
29
  "tr-grid-textformatting": "1.0.45",
32
30
  "tr-grid-titlewrap": "1.0.19",
33
31
  "@grid/formatters": "1.0.50",
34
- "@grid/column-selection-dialog": "4.0.48",
32
+ "@grid/column-selection-dialog": "4.0.49",
35
33
  "@grid/filter-dialog": "4.0.57",
36
34
  "@grid/column-format-dialog": "4.0.44"
37
35
  }
@@ -1,4 +1,5 @@
1
1
  import * as allComponents from './index.js';
2
+ import * as utils from './utils/index.js';
2
3
  import { MockJET } from './tr-grid-util/es6/jet/MockJET.js';
3
4
  import { MockRTK } from './tr-grid-util/es6/jet/MockRTK.js';
4
5
  import { MockQuotes2 } from './tr-grid-util/es6/jet/MockQuotes2.js';
@@ -11,3 +12,7 @@ window.MockQuotes2 = MockQuotes2;
11
12
  for (const component in allComponents) {
12
13
  window[component] = allComponents[component];
13
14
  }
15
+
16
+ for (const util in utils) {
17
+ window[util] = utils[util];
18
+ }
package/package.json CHANGED
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "version": "6.0.43"
69
+ "version": "6.0.45"
70
70
  }
@@ -1,49 +0,0 @@
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 };
@@ -1,226 +0,0 @@
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 };