@simple-reporting/base 1.0.14 → 1.0.16

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.
Files changed (74) hide show
  1. package/dev/package.json +1 -1
  2. package/dev/src/App.vue +2 -7
  3. package/dev/src/components/{PageHeader.vue → Page/Header.vue} +1 -2
  4. package/dev/src/views/ArticleView.vue +2 -3
  5. package/livingdocs/040.Media/010.table/table/download.vue +494 -0
  6. package/livingdocs/040.Media/010.table/table/responsive.vue +104 -0
  7. package/livingdocs/040.Media/010.table/table.html +2 -2
  8. package/livingdocs/040.Media/010.table/table.vue +26 -0
  9. package/package.json +1 -1
  10. package/plugins/viteSrlPlugin.d.ts +2 -0
  11. package/plugins/viteSrlPlugin.js +19 -36
  12. package/scripts/build.js +17 -0
  13. package/scripts/ldd/mapLdd.js +2 -2
  14. package/scripts/vue/components.d.ts +1 -0
  15. package/scripts/vue/components.js +93 -0
  16. package/srl/components/Srl/Article/{DialogButton.vue → Dialog/Button.vue} +1 -1
  17. package/srl/components/Srl/{Note → Category}/Accordion/Content.vue +1 -1
  18. package/srl/components/Srl/Menu/Item/Content.vue +7 -14
  19. package/srl/components/Srl/Menu/Item.vue +12 -10
  20. package/srl/components/Srl/{Menu/List.vue → Menu.vue} +3 -4
  21. package/srl/components/Srl/Page/Dialog.vue +1 -1
  22. package/srl/composables/config.ts +13 -14
  23. package/srl/composables/cssStyles.ts +1 -1
  24. package/srl/composables/menu.ts +5 -1
  25. package/srl/composables/viewPort.ts +4 -3
  26. package/srl/plugins/asyncLdComponent.ts +2 -2
  27. package/srl/plugins/asyncSrlComponents.ts +2 -0
  28. package/srl/plugins/initProject.ts +1 -1
  29. package/srl/plugins/vueSrlPlugin.ts +3 -20
  30. package/srl/types/components.d.ts +3 -17
  31. package/srl/types/global.d.ts +7 -0
  32. package/srl/types/nswow.d.ts +14 -14
  33. package/srl/utils/html.ts +3 -3
  34. package/dev/src/components/SrlPage/KFCApplication/KFCApplication.vue +0 -715
  35. package/dev/src/components/SrlPage/KFCApplication/KFCDropdownCharts.vue +0 -112
  36. package/dev/src/components/SrlPage/KFCApplication/KFCDropdownPeriod.vue +0 -85
  37. package/dev/src/components/SrlPage/KFCApplication/KFCTable.vue +0 -63
  38. package/dev/src/components/SrlPage/KFCApplication/hooks/kfcData.ts +0 -9
  39. package/dev/src/components/SrlPage/KFCApplication/models/KFCApplication.ts +0 -183
  40. package/dev/src/components/SrlPage/KFCApplication/scss/_highcharts-basic.scss +0 -1136
  41. package/dev/src/components/SrlPage/KFCApplication/scss/_highcharts-custom.scss +0 -71
  42. package/dev/src/components/SrlPage/KFCApplication/scss/_highcharts-general.scss +0 -113
  43. package/dev/src/components/SrlPage/KFCApplication/scss/_iz-keyfigure-comparison-dropdown.scss +0 -189
  44. package/dev/src/components/SrlPage/KFCApplication/scss/_iz-keyfigure-comparison.scss +0 -151
  45. package/dev/src/components/SrlPage/KFCApplication/scss/_kfc-loading.scss +0 -40
  46. package/dev/src/components/SrlPage/KFCApplication/scss/_kfc-print.scss +0 -20
  47. package/dev/src/components/SrlPage/KFCApplication/scss/_srl-button-kfc.scss +0 -21
  48. package/dev/src/components/SrlPage/KFCApplication/scss/_variables.scss +0 -10
  49. package/dev/src/components/SrlPage/KFCApplication/services/xlsxParser.ts +0 -194
  50. package/dev/src/components/SrlPage/KFCApplication/theme/SvgColumnView.vue +0 -28
  51. package/dev/src/components/SrlPage/KFCApplication/theme/SvgDownloadChart.vue +0 -26
  52. package/dev/src/components/SrlPage/KFCApplication/theme/SvgDropdown.vue +0 -18
  53. package/dev/src/components/SrlPage/KFCApplication/theme/SvgIndexedValues.vue +0 -18
  54. package/dev/src/components/SrlPage/KFCApplication/theme/SvgLegendSwap.vue +0 -18
  55. package/dev/src/components/SrlPage/KFCApplication/theme/SvgLineView.vue +0 -28
  56. package/dev/src/components/SrlPage/KFCApplication/theme/SvgPDFChart.vue +0 -26
  57. package/dev/src/components/SrlPage/KFCApplication/theme/SvgPrintChart.vue +0 -33
  58. package/dev/src/components/SrlPage/KFCApplication/theme/SvgTableView.vue +0 -67
  59. package/dev/src/components/SrlPage/KFCApplication/utils/XDownloader.js +0 -455
  60. package/dev/src/components/SrlPage/KFCApplication/utils/XDownloaderStyle.js +0 -44
  61. package/dev/src/components/SrlPage/KFCApplication/utils/XTableNamer.js +0 -68
  62. /package/dev/src/components/{BypassLinks.vue → Page/BypassLinks.vue} +0 -0
  63. /package/dev/src/components/{PageFooter.vue → Page/Footer.vue} +0 -0
  64. /package/dev/src/components/{PageMain.vue → Page/Main.vue} +0 -0
  65. /package/dev/src/components/{MainNavigation.vue → Page/MainNavigation.vue} +0 -0
  66. /package/dev/src/components/{NavLanguages.vue → Page/NavLanguages.vue} +0 -0
  67. /package/dev/src/components/{PrevNext.vue → Page/PrevNext.vue} +0 -0
  68. /package/srl/{components/Srl/Page/App.vue → App.vue} +0 -0
  69. /package/srl/components/Srl/{Note → Category}/Accordion/Toggle.vue +0 -0
  70. /package/srl/components/Srl/{Note → Category}/Accordion.vue +0 -0
  71. /package/srl/components/Srl/Menu/Item/Content/{IconAfter.vue → Icon/After.vue} +0 -0
  72. /package/srl/components/Srl/Menu/Item/Content/{IconBefore.vue → Icon/Before.vue} +0 -0
  73. /package/srl/components/Srl/Menu/Item/Content/{ImageAfter.vue → Image/After.vue} +0 -0
  74. /package/srl/components/Srl/Menu/Item/Content/{ImageBefore.vue → Image/Before.vue} +0 -0
@@ -1,455 +0,0 @@
1
- import XTableNamer from './XTableNamer.js'
2
- import * as Excel from 'exceljs/dist/exceljs.min.js'
3
- import { saveAs } from 'file-saver'
4
-
5
- /**
6
- * Exceldownload working with NSWOW2 Tables
7
- */
8
- class XDownloader {
9
- constructor(config = {}) {
10
- const {
11
- tableTitle,
12
- tableSelector,
13
- excludeTableSelector,
14
- downloadText, // Text for downloadbutton, can be empty if you want to use an icon
15
- styles, // cell Styles from classes
16
- numFmt, // numFmt overwrite for custom formatting
17
- mergeStrings, // Set mergeStrings for all Tables
18
- tableCellFormatter,
19
- footnoteFormatter
20
- } = config
21
-
22
- const env = this.getEnvironement()
23
-
24
- this.excludeTableSelector = excludeTableSelector || null
25
- this.tableSelector = tableSelector || '.ns-table-wrap'
26
- this.downloadText = downloadText || 'XLS' //Text on button, can be empty
27
- this.tableTitle = tableTitle || null
28
- this.styles =
29
- styles.map((item) => {
30
- if (!item.index) item.index = 0
31
- return item
32
- }) || {}
33
- this.numFmt = numFmt || function (cell) {}
34
- this.mergeStrings = mergeStrings || []
35
- this.tableCellFormatter = tableCellFormatter || this.htmlTableCellFormatter
36
- this.footnoteFormatter = footnoteFormatter || this.footnoteFormatter
37
-
38
- const tables = Array.prototype.slice
39
- .call(document.querySelectorAll(this.tableSelector))
40
- .filter((table) => {
41
- if (!this.excludeTableSelector) return true
42
-
43
- const finding = table.querySelector(this.excludeTableSelector)
44
-
45
- if (!!finding) return false
46
-
47
- return true
48
- })
49
-
50
- new XTableNamer()
51
-
52
- tables.forEach((table) => {
53
- if (this.checkTable(table)) {
54
- this.createWorkbook(table)
55
- }
56
- })
57
- }
58
-
59
- checkTable(table) {
60
- /*const TDs = Array.prototype.slice.call( table.querySelectorAll('tr:first-child > td') );
61
- let rt = true;
62
- TDs.forEach( td => {
63
- if(td.colSpan > 1) rt = false;
64
- } );*/
65
- return true
66
- }
67
-
68
- createWorkbook(table) {
69
- this.name = table.querySelector('[data-tableid]').dataset.tableid //if you have an error on this line replace data-tableid with data-table-id & tableid to tableId
70
- const workbook = new Excel.Workbook()
71
- this.worksheet = workbook.addWorksheet(this.name)
72
- this.fileName = this.tableTitle
73
- try {
74
- this.parseTable(table)
75
- this.parseFootnote(table)
76
- this.mergeCells(table)
77
- this.saveFile(this.fileName + '.xlsx', workbook)
78
- } catch (err) {
79
- alert(`Die Tabelle hat verbundene Zellen in der ersten Reihe, das wird nicht unterstützt vom XDownloader.
80
- Falls verbundene Zellen in der ersten Reihe benötigt werden bitte erste Zeile leer mit der Klasse .excel-download erfassen`)
81
- console.error(err)
82
- }
83
- }
84
-
85
- mergeCells(table) {
86
- this.mergeStrings = this.mergeStrings.filter((value, index) => {
87
- // console.log('merge string' + value, index, this.mergeStrings.indexOf(value))
88
- return this.mergeStrings.indexOf(value) === index
89
- })
90
- // console.log(this.mergeStrings);
91
-
92
- this.mergeStrings.forEach((s) => {
93
- try {
94
- this.worksheet.mergeCells(s.trim())
95
- } catch (error) {
96
- console.error(error)
97
- }
98
- })
99
- }
100
-
101
- /**
102
- * This one parses the footnotes and puts it after the table content in the worksheet
103
- * @param {*} table
104
- */
105
- parseFootnote(table) {
106
- const footnotes = document.querySelectorAll('.iz-keyfigure-comparison__footnote')
107
- this.worksheet.addRow([])
108
- footnotes.forEach((fn) => {
109
- let prettyFootnote = this.footnoteFormatter.call(this, fn)
110
- this.worksheet.addRow([prettyFootnote])
111
- })
112
- }
113
-
114
- footnoteFormatter(footnote) {
115
- return footnote.innerText.replace('\n', ' ')
116
- }
117
-
118
- getFileTitle(elem) {
119
- let name = elem.querySelector('[data-tableid]').dataset.tableid
120
- if (name) name = name.replaceAll(/\./g, '')
121
- return name
122
- }
123
-
124
- getTitle(elem) {
125
- return elem.closest(this.tableSelector).dataset.xTitle
126
- }
127
-
128
- htmlTableCellFormatter(td) {
129
- let cell = document.createElement('td')
130
- cell.innerHTML = td.innerHTML
131
- let superscript = cell.querySelector('.superscript')
132
- let superscriptContent = ''
133
- if (superscript) {
134
- superscriptContent = '(' + superscript.innerText + ')'
135
- superscript.parentNode.removeChild(superscript)
136
- }
137
- if (td.querySelector('.note__link')) {
138
- return this.correctNote(cell.innerText.trim() + ' ' + superscriptContent)
139
- } else {
140
- return this.correct(cell.innerText.trim() + ' ' + superscriptContent)
141
- }
142
- }
143
-
144
- /**
145
- * This one parses the table and puts it into the worksheet
146
- * @param {*} table
147
- */
148
- parseTable(table) {
149
- const t = table.querySelector('table')
150
- const rows = Array.prototype.slice.call(t.querySelectorAll('tr'))
151
- let row
152
- let content = []
153
-
154
- let counterR = 0
155
- let counterC = 0
156
-
157
- const title = this.getTitle(table)
158
-
159
- let styles = []
160
-
161
- this.setColumnWidhtByHeader(rows)
162
-
163
- rows.forEach((r) => {
164
- styles = []
165
- counterC = 0
166
- content = []
167
- counterR++ //counters to keep track where you are
168
-
169
- const tds = Array.prototype.slice.call(r.querySelectorAll('td'))
170
-
171
- tds.forEach((t) => {
172
- //second iteration for actual content
173
- counterC++
174
-
175
- styles[counterC] = this.getStyles(t) // get styles based on classes of the td
176
- let c = this.tableCellFormatter.call(this, t)
177
-
178
- if (isNaN(c)) {
179
- c = c
180
- } else {
181
- if (c == '\u00A0' || c.trim() == '') {
182
- //apparently this is still considered not NaN
183
- c = c
184
- } else {
185
- c = parseFloat(c)
186
- }
187
- }
188
- // console.log(c);
189
- content.push(c)
190
- const colspan = parseInt(styles[counterC].colspan)
191
- // console.log(t.innerText, colspan)
192
- if (colspan > 1) {
193
- for (let i = 1; i < colspan; i++) {
194
- content.push('')
195
- counterC++
196
- }
197
- }
198
- })
199
-
200
- this.worksheet.addRow(content)
201
- row = this.worksheet.lastRow
202
-
203
- for (let i = 1; i < styles.length; i++) {
204
- if (!!styles[i]) {
205
- if (!!styles[i].alignment) {
206
- row.getCell(i).alignment = styles[i].alignment
207
- }
208
- if (!!styles[i].border) {
209
- row.getCell(i).border = styles[i].border
210
- // console.log(styles[i].border)
211
- }
212
- if (!!styles[i].font) {
213
- row.getCell(i).font = styles[i].font
214
- }
215
- if (!!styles[i].fill) {
216
- row.getCell(i).fill = styles[i].fill
217
- // console.log(i, styles[i].fill.fgColor)
218
- }
219
- let colspan = parseInt(styles[i].colspan)
220
- // console.log(counterR, colspan)
221
-
222
- if (colspan > 1) {
223
- const mergeString =
224
- this.getLetter(i) +
225
- (counterR + (!this.tableTitle ? 1 : 4)) +
226
- ':' +
227
- this.getLetter(i + colspan - 1) +
228
- (counterR + (!this.tableTitle ? 1 : 4))
229
- this.mergeStrings.push(mergeString)
230
- }
231
- }
232
-
233
- if (!!this.numFmt) {
234
- this.numFmt.call(this, row.getCell(i), i, counterR)
235
- }
236
- }
237
- })
238
- }
239
-
240
- setColumnWidhtByHeader(rows) {
241
- const headerClasses = [
242
- 'excel_download',
243
- ...this.styles.filter((item) => item.head).map((item) => item.class)
244
- ]
245
- let isHeader = false
246
- let first = true
247
- let content = []
248
- let headerRow = null
249
- let exceldownload = rows.filter((row) => row.classList.contains('excel_download'))
250
-
251
- if (!!exceldownload[0]) {
252
- headerRow = exceldownload[0]
253
- } else {
254
- rows.forEach((r) => {
255
- if (first) {
256
- headerClasses.forEach((item) => {
257
- if (r.classList.contains(item)) isHeader = true
258
- headerRow = r
259
- })
260
- }
261
- })
262
- }
263
-
264
- if (headerRow) {
265
- first = false
266
-
267
- const tds = Array.prototype.slice.call(headerRow.querySelectorAll('td'))
268
-
269
- tds.forEach((t) => {
270
- //first iteration for header column without content to set widths of columns
271
- content.push({
272
- header: ' ',
273
- key: 'id',
274
- width: t.offsetWidth / 7
275
- })
276
- })
277
- this.worksheet.columns = content
278
-
279
- content = []
280
-
281
- let row = this.worksheet.lastRow
282
- row.height = 0.5
283
-
284
- if (this.tableTitle) {
285
- let title = ''
286
- if (typeof this.tableTitle == 'string') {
287
- title = this.tableTitle
288
- } else if (typeof this.tableTitle == 'function') {
289
- title = this.tableTitle.call(this, table)
290
- }
291
-
292
- this.worksheet.addRow([])
293
-
294
- this.worksheet.addRow([title])
295
- row = this.worksheet.lastRow
296
-
297
- row.getCell('A').font = {
298
- size: 16,
299
- bold: true
300
- }
301
-
302
- this.worksheet.addRow([])
303
- }
304
- } else {
305
- return
306
- }
307
- }
308
-
309
- /**
310
- * check for classes and return the right styles
311
- * can be extended
312
- * @param {*} t
313
- */
314
- getStyles(t) {
315
- let r = []
316
-
317
- const styles = this.styles
318
- .filter((style) => {
319
- return t.classList.contains(style.class)
320
- })
321
- .sort((a, b) => {
322
- // sort index of importance lowest first
323
- if (a.index < b.index) {
324
- return 1
325
- }
326
-
327
- if (a.index > b.index) {
328
- return -1
329
- }
330
-
331
- return 0
332
- })
333
-
334
- if (t.classList.contains('ns-horizontal-left')) {
335
- r.alignment = { horizontal: 'left', wrapText: true }
336
- }
337
- if (t.classList.contains('ns-horizontal-right')) {
338
- r.alignment = { horizontal: 'right', wrapText: true }
339
- }
340
- if (t.classList.contains('ns-horizontal-center')) {
341
- r.alignment = { horizontal: 'center', wrapText: true }
342
- }
343
-
344
- // merge all styles, most important style is applied last
345
- if (styles.length > 0) {
346
- styles.forEach((style) => {
347
- r = {
348
- ...r,
349
- ...style,
350
- class: undefined, // remove classes
351
- head: undefined,
352
- index: undefined
353
- }
354
- })
355
- }
356
-
357
- // if no border style set
358
- if ((!'border') in r) {
359
- // console.log(r)
360
- r.border = {}
361
- }
362
-
363
- // when no fill set, default to white to hide lines
364
- if (!!!r.fill || !!!r.fill.fgColor) {
365
- r.fill = {
366
- type: 'pattern',
367
- pattern: 'solid',
368
- fgColor: {
369
- argb: 'FFFFFFFF'
370
- }
371
- }
372
- }
373
-
374
- r.colspan = t.colSpan
375
-
376
- return r
377
- }
378
-
379
- /**
380
- * savefile doesnt need explanation as well
381
- * @param {*} fileName
382
- * @param {*} workbook
383
- */
384
- async saveFile(fileName, workbook) {
385
- const xls64 = await workbook.xlsx.writeBuffer({
386
- base64: true
387
- })
388
- saveAs(
389
- new Blob([xls64], {
390
- type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
391
- }),
392
- fileName
393
- )
394
- }
395
-
396
- /**
397
- * delete the thousand marks and replace false minus with right one
398
- */
399
- correct(text) {
400
- return text
401
- .replace(/'/g, '')
402
- .replace(/’/g, '')
403
- .replace(/–/g, '-')
404
- .replace(/,/g, '.')
405
- .replace(/–/g, '-')
406
- .replace(/,/g, '.')
407
- }
408
-
409
- correctNote(text) {
410
- return text.replace(/'/g, '').replace(/’/g, '').replace(/–/g, '-')
411
- }
412
-
413
- getLetter(number) {
414
- const letters = [
415
- 'A',
416
- 'B',
417
- 'C',
418
- 'D',
419
- 'E',
420
- 'F',
421
- 'G',
422
- 'H',
423
- 'I',
424
- 'J',
425
- 'K',
426
- 'L',
427
- 'M',
428
- 'N',
429
- 'O',
430
- 'P',
431
- 'Q',
432
- 'R',
433
- 'S',
434
- 'T',
435
- 'U',
436
- 'V',
437
- 'W',
438
- 'X',
439
- 'Y',
440
- 'Z'
441
- ]
442
- return letters[number - 1]
443
- }
444
-
445
- getEnvironement() {
446
- const body = document.querySelector('body')
447
- if (body.classList.contains('wp-production')) {
448
- return 'production'
449
- } else {
450
- return 'stage'
451
- }
452
- }
453
- }
454
-
455
- export default XDownloader
@@ -1,44 +0,0 @@
1
- const XDownloaderStyle = [
2
- {
3
- class: 'head',
4
- font: {
5
- bold: true,
6
- color: {
7
- argb: 'FF000000'
8
- }
9
- },
10
- border: {
11
- bottom: {
12
- style: 'thin',
13
- color: {
14
- argb: 'FF000000'
15
- }
16
- }
17
- },
18
- head: true,
19
- index: 10
20
- },
21
- {
22
- class: 'line',
23
- border: {
24
- bottom: {
25
- style: 'thin',
26
- color: {
27
- argb: 'FFE0E0E0'
28
- }
29
- }
30
- }
31
- },
32
- {
33
- class: 'ns-background-06',
34
- fill: {
35
- type: 'pattern',
36
- pattern: 'solid',
37
- fgColor: {
38
- argb: 'FFF5F2ED'
39
- }
40
- }
41
- }
42
- ]
43
-
44
- export default XDownloaderStyle
@@ -1,68 +0,0 @@
1
- /**
2
- * Exceldownload working with NSWOW2 Tables
3
- */
4
- class XTableNamer {
5
- constructor() {
6
- const elements = Array.prototype.slice.call(
7
- document.querySelectorAll(
8
- '.content .ns-table-wrap, .content .ns-title-h1, .content .ns-title-h2, .content .accordion-title'
9
- )
10
- )
11
- let h1
12
- let h2
13
- let c
14
- const pageTitle = document.querySelector('.header__top-title')
15
-
16
- elements.forEach((element) => {
17
- const className = element.classList[0]
18
-
19
- switch (className) {
20
- case 'ns-title-h1':
21
- const span = element
22
- if (!!span) {
23
- h1 = span.innerText
24
- }
25
- c = 0
26
- break
27
- case 'ns-title-h2':
28
- if (!!element.innerText.trim()) {
29
- h2 = element.innerText
30
- c = 0
31
- }
32
- break
33
- case 'accordion-title':
34
- const spanL = element.querySelector('span:last-child')
35
- if (!!spanL.innerText.trim()) {
36
- h2 = spanL.innerText
37
- c = 0
38
- }
39
- break
40
- case 'ns-table-wrap':
41
- let title = ''
42
- let fileTitle = ''
43
- if (!!pageTitle) {
44
- title += pageTitle.innerText + ' – '
45
- }
46
- if (!!h1) {
47
- title += h1.trim()
48
- }
49
- if (!!h2) {
50
- title += ' - ' + h2.trim()
51
- fileTitle += h2.trim().replace(/\s/g, '_')
52
- } else {
53
- fileTitle += h1.trim().replace(/\s/g, '_')
54
- }
55
- if (c > 0) {
56
- title += ' ' + (c + 1)
57
- fileTitle += '_' + (c + 1)
58
- }
59
- element.dataset.xTitle = title
60
- element.dataset.xFileTitle = fileTitle
61
- c++
62
- break
63
- }
64
- // ifelement.
65
- })
66
- }
67
- }
68
- export default XTableNamer
File without changes