iobroker-ucl 1.4.8 → 1.4.9

Sign up to get free protection for your applications and to get access to all the features.
package/html.js CHANGED
@@ -1,417 +1,417 @@
1
- "use strict";
2
- /* export interface IColumn {
3
- getOnTopColumnName() : string; // Zeile über dem Header
4
- getOnTopColumnColSpan() : number; // Zeile über dem Header; wieviele Spalten umfasst dieser Header
5
- getOnTopBackgroundColor() : string; // Zeile über dem Header; Hintergrundfarbe
6
- getOnTopCellAlignment() : string; // Zeile über dem Header; Ausrichtung
7
- getColumnName() : string;
8
- getColumnHeaderBackgroundColor() : string;
9
- getValueAt(rowObject: Object, rowIndex: number) : string;
10
- getCellBackgroundColor(row: Object, rowIndex: number) : string;
11
- getCellForegroundColor(row: Object, rowIndex: number) : string;
12
- getCellAlignment(row: Object) : string;
13
- getColumnnWidth() : number;
14
- getColumnnFontSize() : number;
15
- }*/
16
- var __extends = (this && this.__extends) || (function () {
17
- var extendStatics = function (d, b) {
18
- extendStatics = Object.setPrototypeOf ||
19
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
20
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
21
- return extendStatics(d, b);
22
- };
23
- return function (d, b) {
24
- if (typeof b !== "function" && b !== null)
25
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
26
- extendStatics(d, b);
27
- function __() { this.constructor = d; }
28
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29
- };
30
- })();
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.AbstractStandardTextColumn = exports.StaticIconColumn = exports.HtmlCreator = exports.HtmlTable = exports.AbstractColumn = void 0;
33
- var AbstractColumn = /** @class */ (function () {
34
- function AbstractColumn(columnName) {
35
- this.columnName = columnName;
36
- }
37
- AbstractColumn.prototype.getColumnName = function () {
38
- return this.columnName;
39
- };
40
- return AbstractColumn;
41
- }());
42
- exports.AbstractColumn = AbstractColumn;
43
- var HtmlTable = /** @class */ (function () {
44
- function HtmlTable() {
45
- this.columns = [];
46
- }
47
- HtmlTable.prototype.isHeaderVisible = function () {
48
- return this.headerVisible;
49
- };
50
- HtmlTable.prototype.getTableTitle = function () {
51
- return this.tableTitle;
52
- };
53
- HtmlTable.prototype.setTableTitle = function (tableTitle) {
54
- this.tableTitle = tableTitle;
55
- };
56
- HtmlTable.prototype.getColumns = function () {
57
- return this.columns;
58
- };
59
- HtmlTable.prototype.getRows = function () {
60
- return this.rows;
61
- };
62
- HtmlTable.prototype.isDoubleHeaderVisible = function () {
63
- return this.doubleHeaderVisible;
64
- };
65
- HtmlTable.prototype.setHeaderVisible = function (headerVisible) {
66
- this.headerVisible = headerVisible;
67
- };
68
- HtmlTable.prototype.setDoubleHeaderVisible = function (doubleHeaderVisible) {
69
- this.doubleHeaderVisible = doubleHeaderVisible;
70
- };
71
- HtmlTable.prototype.setRows = function (rows) {
72
- this.rows = rows;
73
- };
74
- HtmlTable.prototype.addColumn = function (column) {
75
- this.columns.push(column);
76
- };
77
- return HtmlTable;
78
- }());
79
- exports.HtmlTable = HtmlTable;
80
- var HtmlCreator = /** @class */ (function () {
81
- function HtmlCreator(adapter) {
82
- this.adapter = adapter;
83
- this.tables = [];
84
- this.separatorRowAfterObjectThick = [];
85
- this.separatorRowAfterObjectThin = [];
86
- }
87
- HtmlCreator.prototype.addTable = function (table) {
88
- this.tables.push(table);
89
- };
90
- HtmlCreator.prototype.setBackgroundImage = function (backgroundImageUrl) {
91
- this.backgroundImageUrl = backgroundImageUrl;
92
- };
93
- HtmlCreator.prototype.setAdditionalHTMLaboveTable = function (additionalHTMLaboveTable) {
94
- this.additionalHTMLaboveTable = additionalHTMLaboveTable;
95
- };
96
- HtmlCreator.prototype.setAdditionalHTMLbelowTable = function (additionalHTMLbelowTable) {
97
- this.additionalHTMLbelowTable = additionalHTMLbelowTable;
98
- };
99
- HtmlCreator.prototype.addSeparatorAfterObjectThick = function (separator) {
100
- this.separatorRowAfterObjectThick.push(separator);
101
- };
102
- HtmlCreator.prototype.addSeparatorAfterObjectThin = function (separator) {
103
- this.separatorRowAfterObjectThin.push(separator);
104
- };
105
- HtmlCreator.prototype.setHtmlState = function (htmlState) {
106
- this.htmlState = htmlState;
107
- this.adapter.createState(htmlState, "", {
108
- name: htmlState,
109
- desc: htmlState,
110
- type: 'string',
111
- read: true,
112
- write: true
113
- });
114
- };
115
- HtmlCreator.prototype.createHTML = function () {
116
- var _this = this;
117
- var html = "";
118
- html += "<html> \n";
119
- html += " <head> \n";
120
- html += " <style> \n";
121
- html += " table.style1 { \n";
122
- html += " border: 1px solid #595959; \n";
123
- html += " border-collapse: collapse; \n";
124
- html += " vertical-align: middle; \n";
125
- if (this.backgroundImageUrl != null) {
126
- //html += "background: white url(\"" + this.backgroundImageUrl + "\") no-repeat; border-collapse: collapse; \n";
127
- }
128
- html += " } \n";
129
- html += " table.style2 { \n";
130
- html += " border: 0px solid #595959; \n";
131
- html += " border-collapse: collapse; \n";
132
- html += " vertical-align: middle; \n";
133
- html += " } \n";
134
- html += " th.style1 { \n";
135
- html += " border: 1px solid #595959; \n";
136
- html += " border-collapse: collapse; \n";
137
- html += " vertical-align: middle; \n";
138
- html += " } \n";
139
- html += " th.style2 { \n";
140
- html += " border: 0px solid #595959; \n";
141
- html += " border-collapse: collapse; \n";
142
- html += " vertical-align: middle; \n";
143
- html += " } \n";
144
- html += " td.style1 { \n";
145
- html += " border: 1px solid #595959; \n";
146
- html += " border-collapse: collapse; \n";
147
- html += " vertical-align: middle; \n";
148
- html += " } \n";
149
- html += " td.style2 { \n";
150
- html += " border: 0px solid #595959; \n";
151
- html += " border-collapse: collapse; \n";
152
- html += " vertical-align: middle; \n";
153
- html += " } \n";
154
- html += " td,th { \n";
155
- html += " padding-top: 4px; \n";
156
- html += " padding-bottom: 4px; \n";
157
- html += " padding-left: 4px; \n";
158
- html += " padding-right: 4px; \n";
159
- html += " } \n";
160
- html += " </style> \n";
161
- html += " </head> \n";
162
- html += " <body> \n";
163
- if (this.additionalHTMLaboveTable != null) {
164
- html += this.additionalHTMLaboveTable; // + "<p>";
165
- }
166
- if (this.backgroundImageUrl != null) {
167
- //html += "background: white url(\"" + this.backgroundImageUrl + "\") no-repeat; border-collapse: collapse; \n";
168
- html += " <table class=\"style1\" width=\"95%\" style=\"margin:5px\" background=\"" + this.backgroundImageUrl + "\"> \n";
169
- }
170
- else {
171
- html += " <table class=\"style1\" width=\"95%\" style=\"margin:5px\"> \n";
172
- }
173
- //<table border=1 background="bg-red.png">
174
- // Max. Columns ermitteln:
175
- var maxCols = 0;
176
- this.tables.forEach(function (table) {
177
- if (table.getColumns().length > maxCols) {
178
- maxCols = table.getColumns().length;
179
- }
180
- });
181
- var tableIndex = 0;
182
- this.tables.forEach(function (table) {
183
- if (tableIndex++ != 0) {
184
- html += " <tr class=\"style1\"><td class=\"style1\" colspan=\"" + maxCols + "\" style=\"padding: 6px; background-color:#212121\"></td></tr>";
185
- }
186
- if (table.isDoubleHeaderVisible() == true) {
187
- html += " <tr class=\"style1\"> \n";
188
- var skipColumns_1 = 0;
189
- table.getColumns().forEach(function (column) {
190
- if (skipColumns_1 == 0) {
191
- var colSpan = column.getOnTopColumnColSpan();
192
- if (colSpan == null) {
193
- colSpan = 1;
194
- }
195
- // Alignment:
196
- var userAlignemt = column.getOnTopCellAlignment();
197
- var cellAlignment = " text-align:left";
198
- if (userAlignemt != null) {
199
- cellAlignment = " text-align:" + userAlignemt;
200
- }
201
- // Background-Color:
202
- var userBackground = column.getOnTopBackgroundColor();
203
- var cellBackground = "";
204
- if (userBackground != null) {
205
- cellBackground = " background-color:" + userBackground + ";";
206
- }
207
- //html += " <th colspan=\"" + colSpan + "\" style=\"text-align:left " + cellBackground + "\"><font size=2px\">" + column.getOnTopColumnName() + "</th></font> \n";
208
- html += " <th class=\"style1\" colspan=\"" + colSpan + "\" + style=\" " + cellBackground + cellAlignment + "\">" + column.getOnTopColumnName() + "</th>";
209
- skipColumns_1 += colSpan - 1;
210
- }
211
- else {
212
- skipColumns_1--;
213
- }
214
- });
215
- html += " </tr> \n";
216
- }
217
- if (table.isHeaderVisible() == true) {
218
- html += " <tr class=\"style1\"> \n";
219
- table.getColumns().forEach(function (column) {
220
- // Background-Color:
221
- var userBackground = column.getColumnHeaderBackgroundColor();
222
- if (userBackground != null) {
223
- //html += " <th><font size=2px\">" + column.getColumnName() + "</th></font> \n";
224
- var cellBackground = " background-color:" + userBackground + ";";
225
- html += " <th class=\"style1\" style=\" " + cellBackground + "\">" + "<font size=2px\">" + column.getColumnName() + "</font></th>";
226
- }
227
- else {
228
- html += " <th class=\"style1\"><font size=2px\">" + column.getColumnName() + "</th></font> \n";
229
- }
230
- });
231
- html += " </tr> \n";
232
- }
233
- if (table.getTableTitle() != null) {
234
- //html += " <tr><td colspan=\"" + maxCols + "\" style=\"padding: 6px; background-color:#212121\"></td></tr>";
235
- html += " <tr class=\"style1\">\n";
236
- html += " <td class=\"style1\" colspan=\"" + maxCols + "\">" + table.getTableTitle() + "</td> \n";
237
- html += " </tr> \n";
238
- }
239
- var rowIndex = -1;
240
- table.getRows().forEach(function (row) {
241
- rowIndex++;
242
- html += " <tr class=\"style1\"> \n";
243
- table.getColumns().forEach(function (column) {
244
- var cellValue = column.getValueAt(row, rowIndex);
245
- // Alignment:
246
- var userAlignemt = column.getCellAlignment(row);
247
- var cellAlignment = "text-align:left";
248
- if (userAlignemt != null) {
249
- cellAlignment = "text-align:" + userAlignemt + ";";
250
- }
251
- // Width:
252
- var userWidth = column.getColumnnWidth();
253
- var cellWidth = "";
254
- if (userWidth != null && userWidth != -1) {
255
- cellWidth = "width=\"" + userWidth + "px\"; ";
256
- }
257
- // Background-Color:
258
- var userBackground = column.getCellBackgroundColor(row, rowIndex);
259
- var cellBackground = "";
260
- if (userBackground != null) {
261
- cellBackground = "background-color:" + userBackground + ";";
262
- }
263
- // Foreground-Color:
264
- var userForeground = column.getCellForegroundColor(row, rowIndex);
265
- var cellForegorund = "";
266
- if (userForeground != null) {
267
- cellForegorund = "color:" + userForeground + ";";
268
- }
269
- // Font size:
270
- if (column.getColumnnFontSize() == null) {
271
- html += " <td class=\"style1\"" + cellWidth + " style=\" " + cellForegorund + cellBackground + cellAlignment + " \">" + cellValue + "</td>";
272
- }
273
- else {
274
- html += " <td class=\"style1\"" + cellWidth + " style=\" " + cellForegorund + cellBackground + cellAlignment + " \">" + "<font size=\"" + column.getColumnnFontSize() + "\" >" + cellValue + "</font></td>";
275
- }
276
- });
277
- html += " </tr> \n";
278
- // Separator Thick:
279
- var found2 = false;
280
- for (var i = 0; i < _this.separatorRowAfterObjectThick.length; i++) {
281
- if (_this.separatorRowAfterObjectThick[i] == row) {
282
- found2 = true;
283
- break;
284
- }
285
- }
286
- if (found2) {
287
- html += " <tr class=\"style1\"> \n";
288
- html += " <td class=\"style1\" colspan=\"" + table.getColumns().length + "\" style=\"padding: 6px; background-color:#212121\"></td>";
289
- html += " </tr> \n";
290
- }
291
- // Separator Thin:
292
- var found3 = false;
293
- for (var i = 0; i < _this.separatorRowAfterObjectThin.length; i++) {
294
- if (_this.separatorRowAfterObjectThin[i] == row) {
295
- found3 = true;
296
- break;
297
- }
298
- }
299
- if (found3) {
300
- html += " <tr class=\"style1\"> \n";
301
- html += " <td class=\"style1\" colspan=\"" + table.getColumns().length + "\" style=\"padding: 2px; background-color:#AAAAAA\"></td>";
302
- html += " </tr> \n";
303
- }
304
- });
305
- });
306
- html += "</table>\n";
307
- if (this.additionalHTMLbelowTable != null) {
308
- html += this.additionalHTMLbelowTable + "<p>";
309
- }
310
- html += "</body>\n";
311
- html += "</html>\n";
312
- this.adapter.setState(this.htmlState, html);
313
- };
314
- return HtmlCreator;
315
- }());
316
- exports.HtmlCreator = HtmlCreator;
317
- // Icon Spalte die sich nie ändert
318
- var StaticIconColumn = /** @class */ (function (_super) {
319
- __extends(StaticIconColumn, _super);
320
- function StaticIconColumn(iconURL) {
321
- var _this = _super.call(this, iconURL) || this;
322
- _this.iconURL = iconURL;
323
- return _this;
324
- }
325
- StaticIconColumn.prototype.getOnTopBackgroundColor = function () {
326
- // @ts-ignore
327
- return null;
328
- };
329
- StaticIconColumn.prototype.getColumnHeaderBackgroundColor = function () {
330
- // @ts-ignore
331
- return null; // normaler Header-Hintergrundfarbe / null --> ohne, sonst "#FFFFFF"
332
- };
333
- StaticIconColumn.prototype.getCellBackgroundColor = function (row, rowIndex) {
334
- // @ts-ignore
335
- return null; //"#484848";
336
- };
337
- StaticIconColumn.prototype.getOnTopCellAlignment = function () {
338
- // @ts-ignore
339
- return null; //"center";
340
- };
341
- StaticIconColumn.prototype.getCellForegroundColor = function (row, rowIndex) {
342
- // @ts-ignore
343
- return null; // null (für Standard) oder z.B. "#485A64";
344
- };
345
- StaticIconColumn.prototype.getCellAlignment = function (row) {
346
- return "center"; // null (für Standard=left) oder left, right, center
347
- };
348
- StaticIconColumn.prototype.getColumnnWidth = function () {
349
- return 40; // null oder z.B. 50 für "50 Pixel"
350
- };
351
- StaticIconColumn.prototype.getColumnnFontSize = function () {
352
- // @ts-ignore
353
- return null; // null = Default
354
- };
355
- StaticIconColumn.prototype.getOnTopColumnName = function () {
356
- // @ts-ignore
357
- return null; // null wenn Doppelt Header ausgeschalten
358
- };
359
- ;
360
- StaticIconColumn.prototype.getOnTopColumnColSpan = function () {
361
- return 1;
362
- };
363
- StaticIconColumn.prototype.getValueAt = function (rowObject, rowIndex) {
364
- return "<img src=\"" + this.iconURL + "\" width=28px>";
365
- };
366
- return StaticIconColumn;
367
- }(AbstractColumn));
368
- exports.StaticIconColumn = StaticIconColumn;
369
- var AbstractStandardTextColumn = /** @class */ (function (_super) {
370
- __extends(AbstractStandardTextColumn, _super);
371
- function AbstractStandardTextColumn() {
372
- return _super.call(this, "") || this;
373
- }
374
- AbstractStandardTextColumn.prototype.getOnTopBackgroundColor = function () {
375
- // @ts-ignore
376
- return null;
377
- };
378
- AbstractStandardTextColumn.prototype.getColumnHeaderBackgroundColor = function () {
379
- // @ts-ignore
380
- return null; // normaler Header-Hintergrundfarbe / null --> ohne, sonst "#FFFFFF"
381
- };
382
- AbstractStandardTextColumn.prototype.getCellBackgroundColor = function (row, rowIndex) {
383
- // @ts-ignore
384
- return null; //"#484848";
385
- };
386
- AbstractStandardTextColumn.prototype.getOnTopCellAlignment = function () {
387
- // @ts-ignore
388
- return null; //"center";
389
- };
390
- AbstractStandardTextColumn.prototype.getCellForegroundColor = function (row, rowIndex) {
391
- // @ts-ignore
392
- return null; // null (für Standard) oder z.B. "#485A64";
393
- };
394
- AbstractStandardTextColumn.prototype.getCellAlignment = function (row) {
395
- // @ts-ignore
396
- return null; // null (für Standard=left) oder left, right, center
397
- };
398
- AbstractStandardTextColumn.prototype.getColumnnWidth = function () {
399
- // @ts-ignore
400
- return null; // null oder z.B. 50 für "50 Pixel"
401
- };
402
- AbstractStandardTextColumn.prototype.getColumnnFontSize = function () {
403
- // @ts-ignore
404
- return null; // null = Default
405
- };
406
- AbstractStandardTextColumn.prototype.getOnTopColumnName = function () {
407
- // @ts-ignore
408
- return null; // null wenn Doppelt Header ausgeschalten
409
- };
410
- ;
411
- AbstractStandardTextColumn.prototype.getOnTopColumnColSpan = function () {
412
- return 1;
413
- };
414
- return AbstractStandardTextColumn;
415
- }(AbstractColumn));
416
- exports.AbstractStandardTextColumn = AbstractStandardTextColumn;
417
- module.exports = { AbstractColumn: AbstractColumn, HtmlTable: HtmlTable, HtmlCreator: HtmlCreator, StaticIconColumn: StaticIconColumn, AbstractStandardTextColumn: AbstractStandardTextColumn };
1
+ "use strict";
2
+ /* export interface IColumn {
3
+ getOnTopColumnName() : string; // Zeile über dem Header
4
+ getOnTopColumnColSpan() : number; // Zeile über dem Header; wieviele Spalten umfasst dieser Header
5
+ getOnTopBackgroundColor() : string; // Zeile über dem Header; Hintergrundfarbe
6
+ getOnTopCellAlignment() : string; // Zeile über dem Header; Ausrichtung
7
+ getColumnName() : string;
8
+ getColumnHeaderBackgroundColor() : string;
9
+ getValueAt(rowObject: Object, rowIndex: number) : string;
10
+ getCellBackgroundColor(row: Object, rowIndex: number) : string;
11
+ getCellForegroundColor(row: Object, rowIndex: number) : string;
12
+ getCellAlignment(row: Object) : string;
13
+ getColumnnWidth() : number;
14
+ getColumnnFontSize() : number;
15
+ }*/
16
+ var __extends = (this && this.__extends) || (function () {
17
+ var extendStatics = function (d, b) {
18
+ extendStatics = Object.setPrototypeOf ||
19
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
20
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
21
+ return extendStatics(d, b);
22
+ };
23
+ return function (d, b) {
24
+ if (typeof b !== "function" && b !== null)
25
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
26
+ extendStatics(d, b);
27
+ function __() { this.constructor = d; }
28
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29
+ };
30
+ })();
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.AbstractStandardTextColumn = exports.StaticIconColumn = exports.HtmlCreator = exports.HtmlTable = exports.AbstractColumn = void 0;
33
+ var AbstractColumn = /** @class */ (function () {
34
+ function AbstractColumn(columnName) {
35
+ this.columnName = columnName;
36
+ }
37
+ AbstractColumn.prototype.getColumnName = function () {
38
+ return this.columnName;
39
+ };
40
+ return AbstractColumn;
41
+ }());
42
+ exports.AbstractColumn = AbstractColumn;
43
+ var HtmlTable = /** @class */ (function () {
44
+ function HtmlTable() {
45
+ this.columns = [];
46
+ }
47
+ HtmlTable.prototype.isHeaderVisible = function () {
48
+ return this.headerVisible;
49
+ };
50
+ HtmlTable.prototype.getTableTitle = function () {
51
+ return this.tableTitle;
52
+ };
53
+ HtmlTable.prototype.setTableTitle = function (tableTitle) {
54
+ this.tableTitle = tableTitle;
55
+ };
56
+ HtmlTable.prototype.getColumns = function () {
57
+ return this.columns;
58
+ };
59
+ HtmlTable.prototype.getRows = function () {
60
+ return this.rows;
61
+ };
62
+ HtmlTable.prototype.isDoubleHeaderVisible = function () {
63
+ return this.doubleHeaderVisible;
64
+ };
65
+ HtmlTable.prototype.setHeaderVisible = function (headerVisible) {
66
+ this.headerVisible = headerVisible;
67
+ };
68
+ HtmlTable.prototype.setDoubleHeaderVisible = function (doubleHeaderVisible) {
69
+ this.doubleHeaderVisible = doubleHeaderVisible;
70
+ };
71
+ HtmlTable.prototype.setRows = function (rows) {
72
+ this.rows = rows;
73
+ };
74
+ HtmlTable.prototype.addColumn = function (column) {
75
+ this.columns.push(column);
76
+ };
77
+ return HtmlTable;
78
+ }());
79
+ exports.HtmlTable = HtmlTable;
80
+ var HtmlCreator = /** @class */ (function () {
81
+ function HtmlCreator(adapter) {
82
+ this.adapter = adapter;
83
+ this.tables = [];
84
+ this.separatorRowAfterObjectThick = [];
85
+ this.separatorRowAfterObjectThin = [];
86
+ }
87
+ HtmlCreator.prototype.addTable = function (table) {
88
+ this.tables.push(table);
89
+ };
90
+ HtmlCreator.prototype.setBackgroundImage = function (backgroundImageUrl) {
91
+ this.backgroundImageUrl = backgroundImageUrl;
92
+ };
93
+ HtmlCreator.prototype.setAdditionalHTMLaboveTable = function (additionalHTMLaboveTable) {
94
+ this.additionalHTMLaboveTable = additionalHTMLaboveTable;
95
+ };
96
+ HtmlCreator.prototype.setAdditionalHTMLbelowTable = function (additionalHTMLbelowTable) {
97
+ this.additionalHTMLbelowTable = additionalHTMLbelowTable;
98
+ };
99
+ HtmlCreator.prototype.addSeparatorAfterObjectThick = function (separator) {
100
+ this.separatorRowAfterObjectThick.push(separator);
101
+ };
102
+ HtmlCreator.prototype.addSeparatorAfterObjectThin = function (separator) {
103
+ this.separatorRowAfterObjectThin.push(separator);
104
+ };
105
+ HtmlCreator.prototype.setHtmlState = function (htmlState) {
106
+ this.htmlState = htmlState;
107
+ this.adapter.createState(htmlState, "", {
108
+ name: htmlState,
109
+ desc: htmlState,
110
+ type: 'string',
111
+ read: true,
112
+ write: true
113
+ });
114
+ };
115
+ HtmlCreator.prototype.createHTML = function () {
116
+ var _this = this;
117
+ var html = "";
118
+ html += "<html> \n";
119
+ html += " <head> \n";
120
+ html += " <style> \n";
121
+ html += " table.style1 { \n";
122
+ html += " border: 1px solid #595959; \n";
123
+ html += " border-collapse: collapse; \n";
124
+ html += " vertical-align: middle; \n";
125
+ if (this.backgroundImageUrl != null) {
126
+ //html += "background: white url(\"" + this.backgroundImageUrl + "\") no-repeat; border-collapse: collapse; \n";
127
+ }
128
+ html += " } \n";
129
+ html += " table.style2 { \n";
130
+ html += " border: 0px solid #595959; \n";
131
+ html += " border-collapse: collapse; \n";
132
+ html += " vertical-align: middle; \n";
133
+ html += " } \n";
134
+ html += " th.style1 { \n";
135
+ html += " border: 1px solid #595959; \n";
136
+ html += " border-collapse: collapse; \n";
137
+ html += " vertical-align: middle; \n";
138
+ html += " } \n";
139
+ html += " th.style2 { \n";
140
+ html += " border: 0px solid #595959; \n";
141
+ html += " border-collapse: collapse; \n";
142
+ html += " vertical-align: middle; \n";
143
+ html += " } \n";
144
+ html += " td.style1 { \n";
145
+ html += " border: 1px solid #595959; \n";
146
+ html += " border-collapse: collapse; \n";
147
+ html += " vertical-align: middle; \n";
148
+ html += " } \n";
149
+ html += " td.style2 { \n";
150
+ html += " border: 0px solid #595959; \n";
151
+ html += " border-collapse: collapse; \n";
152
+ html += " vertical-align: middle; \n";
153
+ html += " } \n";
154
+ html += " td,th { \n";
155
+ html += " padding-top: 4px; \n";
156
+ html += " padding-bottom: 4px; \n";
157
+ html += " padding-left: 4px; \n";
158
+ html += " padding-right: 4px; \n";
159
+ html += " } \n";
160
+ html += " </style> \n";
161
+ html += " </head> \n";
162
+ html += " <body> \n";
163
+ if (this.additionalHTMLaboveTable != null) {
164
+ html += this.additionalHTMLaboveTable; // + "<p>";
165
+ }
166
+ if (this.backgroundImageUrl != null) {
167
+ //html += "background: white url(\"" + this.backgroundImageUrl + "\") no-repeat; border-collapse: collapse; \n";
168
+ html += " <table class=\"style1\" width=\"95%\" style=\"margin:5px\" background=\"" + this.backgroundImageUrl + "\"> \n";
169
+ }
170
+ else {
171
+ html += " <table class=\"style1\" width=\"95%\" style=\"margin:5px\"> \n";
172
+ }
173
+ //<table border=1 background="bg-red.png">
174
+ // Max. Columns ermitteln:
175
+ var maxCols = 0;
176
+ this.tables.forEach(function (table) {
177
+ if (table.getColumns().length > maxCols) {
178
+ maxCols = table.getColumns().length;
179
+ }
180
+ });
181
+ var tableIndex = 0;
182
+ this.tables.forEach(function (table) {
183
+ if (tableIndex++ != 0) {
184
+ html += " <tr class=\"style1\"><td class=\"style1\" colspan=\"" + maxCols + "\" style=\"padding: 6px; background-color:#212121\"></td></tr>";
185
+ }
186
+ if (table.isDoubleHeaderVisible() == true) {
187
+ html += " <tr class=\"style1\"> \n";
188
+ var skipColumns_1 = 0;
189
+ table.getColumns().forEach(function (column) {
190
+ if (skipColumns_1 == 0) {
191
+ var colSpan = column.getOnTopColumnColSpan();
192
+ if (colSpan == null) {
193
+ colSpan = 1;
194
+ }
195
+ // Alignment:
196
+ var userAlignemt = column.getOnTopCellAlignment();
197
+ var cellAlignment = " text-align:left";
198
+ if (userAlignemt != null) {
199
+ cellAlignment = " text-align:" + userAlignemt;
200
+ }
201
+ // Background-Color:
202
+ var userBackground = column.getOnTopBackgroundColor();
203
+ var cellBackground = "";
204
+ if (userBackground != null) {
205
+ cellBackground = " background-color:" + userBackground + ";";
206
+ }
207
+ //html += " <th colspan=\"" + colSpan + "\" style=\"text-align:left " + cellBackground + "\"><font size=2px\">" + column.getOnTopColumnName() + "</th></font> \n";
208
+ html += " <th class=\"style1\" colspan=\"" + colSpan + "\" + style=\" " + cellBackground + cellAlignment + "\">" + column.getOnTopColumnName() + "</th>";
209
+ skipColumns_1 += colSpan - 1;
210
+ }
211
+ else {
212
+ skipColumns_1--;
213
+ }
214
+ });
215
+ html += " </tr> \n";
216
+ }
217
+ if (table.isHeaderVisible() == true) {
218
+ html += " <tr class=\"style1\"> \n";
219
+ table.getColumns().forEach(function (column) {
220
+ // Background-Color:
221
+ var userBackground = column.getColumnHeaderBackgroundColor();
222
+ if (userBackground != null) {
223
+ //html += " <th><font size=2px\">" + column.getColumnName() + "</th></font> \n";
224
+ var cellBackground = " background-color:" + userBackground + ";";
225
+ html += " <th class=\"style1\" style=\" " + cellBackground + "\">" + "<font size=2px\">" + column.getColumnName() + "</font></th>";
226
+ }
227
+ else {
228
+ html += " <th class=\"style1\"><font size=2px\">" + column.getColumnName() + "</th></font> \n";
229
+ }
230
+ });
231
+ html += " </tr> \n";
232
+ }
233
+ if (table.getTableTitle() != null) {
234
+ //html += " <tr><td colspan=\"" + maxCols + "\" style=\"padding: 6px; background-color:#212121\"></td></tr>";
235
+ html += " <tr class=\"style1\">\n";
236
+ html += " <td class=\"style1\" colspan=\"" + maxCols + "\">" + table.getTableTitle() + "</td> \n";
237
+ html += " </tr> \n";
238
+ }
239
+ var rowIndex = -1;
240
+ table.getRows().forEach(function (row) {
241
+ rowIndex++;
242
+ html += " <tr class=\"style1\"> \n";
243
+ table.getColumns().forEach(function (column) {
244
+ var cellValue = column.getValueAt(row, rowIndex);
245
+ // Alignment:
246
+ var userAlignemt = column.getCellAlignment(row);
247
+ var cellAlignment = "text-align:left";
248
+ if (userAlignemt != null) {
249
+ cellAlignment = "text-align:" + userAlignemt + ";";
250
+ }
251
+ // Width:
252
+ var userWidth = column.getColumnnWidth();
253
+ var cellWidth = "";
254
+ if (userWidth != null && userWidth != -1) {
255
+ cellWidth = "width=\"" + userWidth + "px\"; ";
256
+ }
257
+ // Background-Color:
258
+ var userBackground = column.getCellBackgroundColor(row, rowIndex);
259
+ var cellBackground = "";
260
+ if (userBackground != null) {
261
+ cellBackground = "background-color:" + userBackground + ";";
262
+ }
263
+ // Foreground-Color:
264
+ var userForeground = column.getCellForegroundColor(row, rowIndex);
265
+ var cellForegorund = "";
266
+ if (userForeground != null) {
267
+ cellForegorund = "color:" + userForeground + ";";
268
+ }
269
+ // Font size:
270
+ if (column.getColumnnFontSize() == null) {
271
+ html += " <td class=\"style1\"" + cellWidth + " style=\" " + cellForegorund + cellBackground + cellAlignment + " \">" + cellValue + "</td>";
272
+ }
273
+ else {
274
+ html += " <td class=\"style1\"" + cellWidth + " style=\" " + cellForegorund + cellBackground + cellAlignment + " \">" + "<font size=\"" + column.getColumnnFontSize() + "\" >" + cellValue + "</font></td>";
275
+ }
276
+ });
277
+ html += " </tr> \n";
278
+ // Separator Thick:
279
+ var found2 = false;
280
+ for (var i = 0; i < _this.separatorRowAfterObjectThick.length; i++) {
281
+ if (_this.separatorRowAfterObjectThick[i] == row) {
282
+ found2 = true;
283
+ break;
284
+ }
285
+ }
286
+ if (found2) {
287
+ html += " <tr class=\"style1\"> \n";
288
+ html += " <td class=\"style1\" colspan=\"" + table.getColumns().length + "\" style=\"padding: 6px; background-color:#212121\"></td>";
289
+ html += " </tr> \n";
290
+ }
291
+ // Separator Thin:
292
+ var found3 = false;
293
+ for (var i = 0; i < _this.separatorRowAfterObjectThin.length; i++) {
294
+ if (_this.separatorRowAfterObjectThin[i] == row) {
295
+ found3 = true;
296
+ break;
297
+ }
298
+ }
299
+ if (found3) {
300
+ html += " <tr class=\"style1\"> \n";
301
+ html += " <td class=\"style1\" colspan=\"" + table.getColumns().length + "\" style=\"padding: 2px; background-color:#AAAAAA\"></td>";
302
+ html += " </tr> \n";
303
+ }
304
+ });
305
+ });
306
+ html += "</table>\n";
307
+ if (this.additionalHTMLbelowTable != null) {
308
+ html += this.additionalHTMLbelowTable + "<p>";
309
+ }
310
+ html += "</body>\n";
311
+ html += "</html>\n";
312
+ this.adapter.setState(this.htmlState, html);
313
+ };
314
+ return HtmlCreator;
315
+ }());
316
+ exports.HtmlCreator = HtmlCreator;
317
+ // Icon Spalte die sich nie ändert
318
+ var StaticIconColumn = /** @class */ (function (_super) {
319
+ __extends(StaticIconColumn, _super);
320
+ function StaticIconColumn(iconURL) {
321
+ var _this = _super.call(this, iconURL) || this;
322
+ _this.iconURL = iconURL;
323
+ return _this;
324
+ }
325
+ StaticIconColumn.prototype.getOnTopBackgroundColor = function () {
326
+ // @ts-ignore
327
+ return null;
328
+ };
329
+ StaticIconColumn.prototype.getColumnHeaderBackgroundColor = function () {
330
+ // @ts-ignore
331
+ return null; // normaler Header-Hintergrundfarbe / null --> ohne, sonst "#FFFFFF"
332
+ };
333
+ StaticIconColumn.prototype.getCellBackgroundColor = function (row, rowIndex) {
334
+ // @ts-ignore
335
+ return null; //"#484848";
336
+ };
337
+ StaticIconColumn.prototype.getOnTopCellAlignment = function () {
338
+ // @ts-ignore
339
+ return null; //"center";
340
+ };
341
+ StaticIconColumn.prototype.getCellForegroundColor = function (row, rowIndex) {
342
+ // @ts-ignore
343
+ return null; // null (für Standard) oder z.B. "#485A64";
344
+ };
345
+ StaticIconColumn.prototype.getCellAlignment = function (row) {
346
+ return "center"; // null (für Standard=left) oder left, right, center
347
+ };
348
+ StaticIconColumn.prototype.getColumnnWidth = function () {
349
+ return 40; // null oder z.B. 50 für "50 Pixel"
350
+ };
351
+ StaticIconColumn.prototype.getColumnnFontSize = function () {
352
+ // @ts-ignore
353
+ return null; // null = Default
354
+ };
355
+ StaticIconColumn.prototype.getOnTopColumnName = function () {
356
+ // @ts-ignore
357
+ return null; // null wenn Doppelt Header ausgeschalten
358
+ };
359
+ ;
360
+ StaticIconColumn.prototype.getOnTopColumnColSpan = function () {
361
+ return 1;
362
+ };
363
+ StaticIconColumn.prototype.getValueAt = function (rowObject, rowIndex) {
364
+ return "<img src=\"" + this.iconURL + "\" width=28px>";
365
+ };
366
+ return StaticIconColumn;
367
+ }(AbstractColumn));
368
+ exports.StaticIconColumn = StaticIconColumn;
369
+ var AbstractStandardTextColumn = /** @class */ (function (_super) {
370
+ __extends(AbstractStandardTextColumn, _super);
371
+ function AbstractStandardTextColumn() {
372
+ return _super.call(this, "") || this;
373
+ }
374
+ AbstractStandardTextColumn.prototype.getOnTopBackgroundColor = function () {
375
+ // @ts-ignore
376
+ return null;
377
+ };
378
+ AbstractStandardTextColumn.prototype.getColumnHeaderBackgroundColor = function () {
379
+ // @ts-ignore
380
+ return null; // normaler Header-Hintergrundfarbe / null --> ohne, sonst "#FFFFFF"
381
+ };
382
+ AbstractStandardTextColumn.prototype.getCellBackgroundColor = function (row, rowIndex) {
383
+ // @ts-ignore
384
+ return null; //"#484848";
385
+ };
386
+ AbstractStandardTextColumn.prototype.getOnTopCellAlignment = function () {
387
+ // @ts-ignore
388
+ return null; //"center";
389
+ };
390
+ AbstractStandardTextColumn.prototype.getCellForegroundColor = function (row, rowIndex) {
391
+ // @ts-ignore
392
+ return null; // null (für Standard) oder z.B. "#485A64";
393
+ };
394
+ AbstractStandardTextColumn.prototype.getCellAlignment = function (row) {
395
+ // @ts-ignore
396
+ return null; // null (für Standard=left) oder left, right, center
397
+ };
398
+ AbstractStandardTextColumn.prototype.getColumnnWidth = function () {
399
+ // @ts-ignore
400
+ return null; // null oder z.B. 50 für "50 Pixel"
401
+ };
402
+ AbstractStandardTextColumn.prototype.getColumnnFontSize = function () {
403
+ // @ts-ignore
404
+ return null; // null = Default
405
+ };
406
+ AbstractStandardTextColumn.prototype.getOnTopColumnName = function () {
407
+ // @ts-ignore
408
+ return null; // null wenn Doppelt Header ausgeschalten
409
+ };
410
+ ;
411
+ AbstractStandardTextColumn.prototype.getOnTopColumnColSpan = function () {
412
+ return 1;
413
+ };
414
+ return AbstractStandardTextColumn;
415
+ }(AbstractColumn));
416
+ exports.AbstractStandardTextColumn = AbstractStandardTextColumn;
417
+ module.exports = { AbstractColumn: AbstractColumn, HtmlTable: HtmlTable, HtmlCreator: HtmlCreator, StaticIconColumn: StaticIconColumn, AbstractStandardTextColumn: AbstractStandardTextColumn };