@simple-reporting/base 1.0.15 → 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 (55) 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/package.json +1 -1
  6. package/plugins/viteSrlPlugin.js +3 -2
  7. package/scripts/build.js +17 -0
  8. package/scripts/ldd/mapLdd.js +2 -2
  9. package/scripts/vue/components.js +14 -15
  10. package/srl/components/Srl/Menu/Item.vue +7 -3
  11. package/srl/components/Srl/Menu.vue +1 -1
  12. package/srl/composables/config.ts +13 -14
  13. package/srl/composables/cssStyles.ts +1 -1
  14. package/srl/composables/menu.ts +5 -1
  15. package/srl/composables/viewPort.ts +4 -3
  16. package/srl/plugins/initProject.ts +1 -1
  17. package/srl/utils/html.ts +3 -3
  18. package/dev/src/components/SrlPage/KFCApplication/KFCApplication.vue +0 -715
  19. package/dev/src/components/SrlPage/KFCApplication/KFCDropdownCharts.vue +0 -112
  20. package/dev/src/components/SrlPage/KFCApplication/KFCDropdownPeriod.vue +0 -85
  21. package/dev/src/components/SrlPage/KFCApplication/KFCTable.vue +0 -63
  22. package/dev/src/components/SrlPage/KFCApplication/hooks/kfcData.ts +0 -9
  23. package/dev/src/components/SrlPage/KFCApplication/models/KFCApplication.ts +0 -183
  24. package/dev/src/components/SrlPage/KFCApplication/scss/_highcharts-basic.scss +0 -1136
  25. package/dev/src/components/SrlPage/KFCApplication/scss/_highcharts-custom.scss +0 -71
  26. package/dev/src/components/SrlPage/KFCApplication/scss/_highcharts-general.scss +0 -113
  27. package/dev/src/components/SrlPage/KFCApplication/scss/_iz-keyfigure-comparison-dropdown.scss +0 -189
  28. package/dev/src/components/SrlPage/KFCApplication/scss/_iz-keyfigure-comparison.scss +0 -151
  29. package/dev/src/components/SrlPage/KFCApplication/scss/_kfc-loading.scss +0 -40
  30. package/dev/src/components/SrlPage/KFCApplication/scss/_kfc-print.scss +0 -20
  31. package/dev/src/components/SrlPage/KFCApplication/scss/_srl-button-kfc.scss +0 -21
  32. package/dev/src/components/SrlPage/KFCApplication/scss/_variables.scss +0 -10
  33. package/dev/src/components/SrlPage/KFCApplication/services/xlsxParser.ts +0 -194
  34. package/dev/src/components/SrlPage/KFCApplication/theme/SvgColumnView.vue +0 -28
  35. package/dev/src/components/SrlPage/KFCApplication/theme/SvgDownloadChart.vue +0 -26
  36. package/dev/src/components/SrlPage/KFCApplication/theme/SvgDropdown.vue +0 -18
  37. package/dev/src/components/SrlPage/KFCApplication/theme/SvgIndexedValues.vue +0 -18
  38. package/dev/src/components/SrlPage/KFCApplication/theme/SvgLegendSwap.vue +0 -18
  39. package/dev/src/components/SrlPage/KFCApplication/theme/SvgLineView.vue +0 -28
  40. package/dev/src/components/SrlPage/KFCApplication/theme/SvgPDFChart.vue +0 -26
  41. package/dev/src/components/SrlPage/KFCApplication/theme/SvgPrintChart.vue +0 -33
  42. package/dev/src/components/SrlPage/KFCApplication/theme/SvgTableView.vue +0 -67
  43. package/dev/src/components/SrlPage/KFCApplication/utils/XDownloader.js +0 -455
  44. package/dev/src/components/SrlPage/KFCApplication/utils/XDownloaderStyle.js +0 -44
  45. package/dev/src/components/SrlPage/KFCApplication/utils/XTableNamer.js +0 -68
  46. /package/dev/src/components/{BypassLinks.vue → Page/BypassLinks.vue} +0 -0
  47. /package/dev/src/components/{PageFooter.vue → Page/Footer.vue} +0 -0
  48. /package/dev/src/components/{PageMain.vue → Page/Main.vue} +0 -0
  49. /package/dev/src/components/{MainNavigation.vue → Page/MainNavigation.vue} +0 -0
  50. /package/dev/src/components/{NavLanguages.vue → Page/NavLanguages.vue} +0 -0
  51. /package/dev/src/components/{PrevNext.vue → Page/PrevNext.vue} +0 -0
  52. /package/srl/{components/App.vue → App.vue} +0 -0
  53. /package/srl/components/Srl/{Note → Category}/Accordion/Content.vue +0 -0
  54. /package/srl/components/Srl/{Note → Category}/Accordion/Toggle.vue +0 -0
  55. /package/srl/components/Srl/{Note → Category}/Accordion.vue +0 -0
package/dev/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "postinstall": "srl prepare"
20
20
  },
21
21
  "dependencies": {
22
- "@simple-reporting/base": "^1.0.15",
22
+ "@simple-reporting/base": "^1.0.16",
23
23
  "axios": "^1.12.2",
24
24
  "chalk": "^5.6.2",
25
25
  "exceljs": "^4.4.0",
package/dev/src/App.vue CHANGED
@@ -1,9 +1,4 @@
1
1
  <script setup lang="ts">
2
- import PageHeader from '@/components/PageHeader.vue'
3
- import PageMain from '@/components/PageMain.vue'
4
- import PageFooter from '@/components/PageFooter.vue'
5
- import MainNavigation from '@/components/MainNavigation.vue'
6
- import BypassLinks from '@/components/BypassLinks.vue'
7
2
  import { useMenu } from '#composables'
8
3
 
9
4
  const mainNavigation = useMenu('menuMain')
@@ -11,9 +6,9 @@ const mainNavigation = useMenu('menuMain')
11
6
 
12
7
  <template>
13
8
  <div class="srl-page__wrap">
14
- <BypassLinks />
9
+ <PageBypassLinks />
15
10
  <PageHeader />
16
- <MainNavigation :mainNavigation="mainNavigation" />
11
+ <PageMainNavigation :mainNavigation="mainNavigation" />
17
12
  <PageMain :mainNavigation="mainNavigation" />
18
13
  <PageFooter />
19
14
  </div>
@@ -1,5 +1,4 @@
1
1
  <script lang="ts" setup>
2
- import NavLanguages from '@/components/NavLanguages.vue'
3
2
  import { useLocale } from '#composables'
4
3
 
5
4
  const locale = useLocale()
@@ -12,7 +11,7 @@ const locale = useLocale()
12
11
  <img class="srl-logo__img" src="@/assets/images/mms-logo-white.svg" alt="MMS Solutions" />
13
12
  </router-link>
14
13
  </div>
15
- <NavLanguages />
14
+ <PageNavLanguages />
16
15
  </header>
17
16
  </template>
18
17
 
@@ -1,12 +1,11 @@
1
1
  <script setup lang="ts">
2
- import PrevNext from '@/components/PrevNext.vue'
3
2
  const props = defineProps<{
4
3
  mainNavigation: NsWowNavigationItem[]
5
4
  }>()
6
5
  </script>
7
6
 
8
7
  <template>
9
- <PrevNext :mainNavigation="props.mainNavigation">
8
+ <PagePrevNext :mainNavigation="props.mainNavigation">
10
9
  <SrlArticleRoot />
11
- </PrevNext>
10
+ </PagePrevNext>
12
11
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simple-reporting/base",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "Manage srl templates, build and publish",
5
5
  "bin": {
6
6
  "srl": "cli.js"
@@ -137,6 +137,7 @@ export default function viteSrlPlugin() {
137
137
  config.resolve.alias = config.resolve.alias || {};
138
138
  config.resolve.alias['~'] = folders.root;
139
139
  config.resolve.alias['@'] = folders.srlSrc;
140
+ config.resolve.alias['#srl'] = folders.srlRoot;
140
141
  config.resolve.alias['#components'] = folders.srlComponents;
141
142
  config.resolve.alias['#composables'] = folders.srlComposables;
142
143
  config.resolve.alias['#plugins'] = folders.srlPlugins;
@@ -199,7 +200,7 @@ export default function viteSrlPlugin() {
199
200
  }
200
201
 
201
202
  if (
202
- path.includes('src/components/Srl') &&
203
+ path.includes('src/components/') &&
203
204
  path.endsWith('.vue')
204
205
  ) {
205
206
  triggerAction(vueComponents);
@@ -241,7 +242,7 @@ export default function viteSrlPlugin() {
241
242
  }
242
243
 
243
244
  if (
244
- path.includes('src/components/Srl') &&
245
+ path.includes('src/components/') &&
245
246
  path.endsWith('.vue')
246
247
  ) {
247
248
  triggerAction(vueComponents);
package/scripts/build.js CHANGED
@@ -243,6 +243,23 @@ async function zipApp() {
243
243
  async function zipLdd() {
244
244
  console.log("\n\nCreate zip file for LDD");
245
245
  await checkFolders();
246
+
247
+ const lddPdfDir = join(folders.srlOutput, 'ldd', 'pdf');
248
+
249
+ try {
250
+ const pdfDir = join(folders.srlOutput, 'pdf');
251
+ statSync(pdfDir);
252
+ await cpSync(pdfDir, lddPdfDir, { recursive: true });
253
+ console.log('PDF folder has been copied to ' + lddPdfDir);
254
+ } catch (e) {}
255
+
256
+ try {
257
+ const customerDir = join(folders.root, 'pdf', 'customer');
258
+ statSync(customerDir);
259
+ await cpSync(customerDir, lddPdfDir, { recursive: true });
260
+ console.log('Contents of pdf/customer have been copied to ' + lddPdfDir);
261
+ } catch (e) {}
262
+
246
263
  const archiver = require('archiver');
247
264
  const output = createWriteStream(join(outputPath, 'design.zip'));
248
265
  const archive = archiver('zip', {
@@ -184,8 +184,8 @@ async function mapComponents(lddJson) {
184
184
 
185
185
  // write async components
186
186
  const asyncComponents = [
187
- `import { defineAsyncComponent } from 'vue'`,
188
- `export default function asyncLdComponent(app) {`,
187
+ `import { defineAsyncComponent, type App } from 'vue'`,
188
+ `export default function asyncLdComponent(app: App): void {`,
189
189
  ];
190
190
 
191
191
  for (let i = 0; i < vueComponents.length; i++) {
@@ -7,7 +7,6 @@ function toPascalAfterSlash(str) {
7
7
  }
8
8
  function readVueDir(entryPath, prefix = '') {
9
9
  const componentsPath = join(entryPath, 'components');
10
- const baseDir = join(componentsPath, 'Srl');
11
10
  const result = {};
12
11
 
13
12
  function search(dir) {
@@ -29,47 +28,47 @@ function readVueDir(entryPath, prefix = '') {
29
28
  }
30
29
  }
31
30
 
32
- if (existsSync(baseDir) && statSync(baseDir).isDirectory()) {
33
- search(baseDir);
31
+ if (existsSync(componentsPath) && statSync(componentsPath).isDirectory()) {
32
+ search(componentsPath);
34
33
  }
35
34
 
36
35
  return result;
37
36
  }
38
37
 
39
38
  export async function vueComponents() {
40
- const srlComponents = readVueDir(folders.srlRoot, '#');
41
39
  const appComponents = readVueDir(folders.srlSrc, '@/');
40
+ const srlComponents = readVueDir(folders.srlRoot, '#');
42
41
 
43
42
  const components = []
44
43
  const types = []
45
44
 
46
- for (const [name, info] of Object.entries(srlComponents)) {
47
- const componentPath = appComponents[name] ? appComponents[name].component : info.component
48
- const typePath = appComponents[name] ? appComponents[name].type : info.type
45
+ for (const [name, info] of Object.entries(appComponents)) {
49
46
  components.push(
50
- `app.component('${name}', defineAsyncComponent(() => import('${componentPath}')));`,
47
+ `app.component('${name}', defineAsyncComponent(() => import('${info.component}')));`,
51
48
  )
52
49
  types.push({
53
50
  name: name,
54
- type: ` type ${name} = typeof import('${typePath}')['default'];`,
51
+ type: ` type ${name} = typeof import('${info.type}')['default'];`,
55
52
  })
56
53
  }
57
54
 
58
- for (const [name, info] of Object.entries(appComponents)) {
59
- if (!srlComponents[name]) {
55
+ for (const [name, info] of Object.entries(srlComponents)) {
56
+ const componentPath = appComponents[name] ? appComponents[name].component : info.component
57
+ const typePath = appComponents[name] ? appComponents[name].type : info.type
58
+ if (!appComponents[name]) {
60
59
  components.push(
61
- `app.component('${name}', defineAsyncComponent(() => import('${info.component}')));`,
60
+ `app.component('${name}', defineAsyncComponent(() => import('${componentPath}')));`,
62
61
  )
63
62
  types.push({
64
63
  name: name,
65
- type: ` type ${name} = typeof import('${info.type}')['default'];`,
64
+ type: ` type ${name} = typeof import('${typePath}')['default'];`,
66
65
  })
67
66
  }
68
67
  }
69
68
 
70
69
  writeFileSync(join(folders.srlPlugins, 'asyncSrlComponents.ts'),
71
- `import { defineAsyncComponent } from 'vue';
72
- export default function asyncSrlComponents(app) {
70
+ `import { defineAsyncComponent, type App } from 'vue';
71
+ export default function asyncSrlComponents(app: App): void {
73
72
  ${components.join('\n ')}
74
73
  }
75
74
  `, 'utf8');
@@ -167,11 +167,12 @@ const classListItem = computed(() => {
167
167
  </script>
168
168
 
169
169
  <template>
170
- <li v-if="!item.children && props.item.href" :class="classListLi">
170
+ <li v-if="!item.children && props.item.href" role="none" :class="classListLi">
171
171
  <router-link
172
172
  v-if="!external"
173
173
  ref="$el"
174
174
  tabindex="-1"
175
+ role="menuitem"
175
176
  :to="props.item.href"
176
177
  :class="classListItem"
177
178
  :title="props.item.title ?? props.item.label"
@@ -195,6 +196,7 @@ const classListItem = computed(() => {
195
196
  v-else
196
197
  tabindex="-1"
197
198
  ref="$el"
199
+ role="menuitem"
198
200
  :href="props.item.href"
199
201
  :title="props.item.title ?? props.item.label"
200
202
  :class="classListItem"
@@ -217,11 +219,12 @@ const classListItem = computed(() => {
217
219
  />
218
220
  </a>
219
221
  </li>
220
- <li v-else-if="props.item.callback" :class="classListLi">
222
+ <li v-else-if="props.item.callback" role="none" :class="classListLi">
221
223
  <button
222
224
  type="button"
223
225
  ref="$el"
224
226
  tabindex="-1"
227
+ role="menuitem"
225
228
  :class="classListItem"
226
229
  :title="props.item.title ?? props.item.label"
227
230
  :aria-label="props.item.icon ? props.item.title ?? props.item.label : undefined"
@@ -242,11 +245,12 @@ const classListItem = computed(() => {
242
245
  />
243
246
  </button>
244
247
  </li>
245
- <li v-else :class="classListLi">
248
+ <li v-else :class="classListLi" role="none">
246
249
  <button
247
250
  type="button"
248
251
  ref="$el"
249
252
  tabindex="-1"
253
+ role="menuitem"
250
254
  :aria-haspopup="props.item.children ? 'true' : 'false'"
251
255
  :aria-expanded="opened"
252
256
  :aria-controls="`${props.name}-${id}`"
@@ -167,7 +167,7 @@ function routerChange() {
167
167
  }
168
168
 
169
169
  function closeAll(keep?: number | string) {
170
- items.value.forEach((item: typeof MenuItem, index: number) => {
170
+ items.value.forEach((item: SrlMenuItem, index: number) => {
171
171
  if (keep !== index) item.closeItem()
172
172
  })
173
173
  }
@@ -61,11 +61,6 @@ async function setConfig(): Promise<Ref<NsWowConfig>> {
61
61
  await loadSettings();
62
62
  await loadTranslations();
63
63
 
64
- const defaultMessages = import.meta.glob('@/locales/*.json', {
65
- eager: true,
66
- import: 'default',
67
- });
68
-
69
64
  for (const locale of config.value.settings.languages) {
70
65
  await loadRouting(locale);
71
66
  await loadDownloads(locale);
@@ -97,7 +92,8 @@ async function loadSettings() {
97
92
  config.value.locale = data.defaultLanguage;
98
93
  document.documentElement.lang = data.defaultLanguage;
99
94
  } catch (e) {
100
- errorLog(`"${file}" could not be loaded.`, e);
95
+ const o = e as Error;
96
+ errorLog(`"${file}" could not be loaded.`, o);
101
97
  }
102
98
  }
103
99
 
@@ -105,10 +101,10 @@ async function loadTranslations() {
105
101
  const file = `./json/translations_hosting.json`;
106
102
  try {
107
103
  const response: Response = await fetch(file);
108
- const data: NsWowTranslations = await response.json();
109
- config.value.translations = data;
104
+ config.value.translations = await response.json() as NsWowTranslations;
110
105
  } catch (e) {
111
- errorLog(`"${file}" could not be loaded.`, e);
106
+ const o = e as Error;
107
+ errorLog(`"${file}" could not be loaded.`, o);
112
108
  }
113
109
  }
114
110
 
@@ -120,19 +116,22 @@ async function loadRouting(locale: string) {
120
116
  config.value.articles[locale] = routing.pages;
121
117
  config.value.menus[locale] = routing.menu;
122
118
  } catch (e) {
123
- errorLog(`"${file}" could not be loaded.`, e);
119
+ const o = e as Error;
120
+ errorLog(`"${file}" could not be loaded.`, o);
124
121
  }
125
122
  }
126
123
 
127
124
  async function loadDownloads(locale: string) {
128
- config.value.downloads[locale] = {};
125
+ config.value.downloads[locale] = {
126
+ structure: [],
127
+ };
129
128
  const file: string = `./downloads/downloads_${locale}.json`;
130
129
  try {
131
130
  const response: Response = await fetch(file);
132
- const data = await response.json();
133
- config.value.downloads[locale] = data;
131
+ config.value.downloads[locale] = await response.json();
134
132
  } catch (e) {
135
- errorLog(`"${file}" could not be loaded.`, e);
133
+ const o = e as Error;
134
+ errorLog(`"${file}" could not be loaded.`, o);
136
135
  }
137
136
  }
138
137
 
@@ -6,7 +6,7 @@ export function addCssStyles(cssString: string): void {
6
6
  cssStyles.value.includes(cssString) || cssStyles.value.push(cssString);
7
7
  }
8
8
 
9
- export function useCssStyles(): string[] {
9
+ export function useCssStyles(): typeof cssStyles {
10
10
  return cssStyles;
11
11
  }
12
12
 
@@ -35,8 +35,12 @@ import {
35
35
  import { isRouterPath } from '#utils/uri';
36
36
  import useConfig from './config';
37
37
 
38
+ type Menus = {
39
+ [key: string]: ComputedRef<NsWowNavigationItem[]>;
40
+ }
41
+
38
42
  const config = useConfig();
39
- const menus = {};
43
+ const menus: Menus = {};
40
44
 
41
45
  function buildNav(
42
46
  item: NsWowMenu,
@@ -50,17 +50,18 @@ type ViewPorts = {
50
50
  };
51
51
 
52
52
  const { breakpoints } = grid;
53
+ const bp = breakpoints as Breakpoints;
53
54
  const innerWidth = ref<number>(window.innerWidth);
54
55
 
55
56
  const viewPorts = computed<ViewPorts>(() => {
56
57
  const res: ViewPorts = {
57
- breakPoints: breakpoints,
58
+ breakPoints: bp,
58
59
  innerWidth: window.innerWidth,
59
60
  viewPort: null,
60
61
  };
61
62
 
62
- for (const key in breakpoints) {
63
- if (breakpoints[key] <= innerWidth.value) {
63
+ for (const key in bp) {
64
+ if (bp[key] <= innerWidth.value) {
64
65
  res.viewPort = key;
65
66
  } else {
66
67
  break;
@@ -5,7 +5,7 @@ import srlVuePlugin from '#plugins/vueSrlPlugin';
5
5
 
6
6
  import '#imports/app.scss';
7
7
 
8
- import SrlPageApp from '#components/App.vue';
8
+ import SrlPageApp from '../App.vue';
9
9
  import router from '@/router';
10
10
 
11
11
  export default async function initProject() {
package/srl/utils/html.ts CHANGED
@@ -36,7 +36,7 @@ function replaceAccordionContainer(text: string): string {
36
36
  const innerContent = replaceAccordionContainer(text.slice(openTagRegex.lastIndex, end - 6));
37
37
 
38
38
  result += text.slice(lastIndex, start);
39
- result += `<srl-note-accordion v-slot="{ accordion }"${attrs}>${innerContent}</srl-note-accordion>`;
39
+ result += `<srl-category-accordion v-slot="{ accordion }"${attrs}>${innerContent}</srl-category-accordion>`;
40
40
  lastIndex = end;
41
41
  openTagRegex.lastIndex = end;
42
42
  }
@@ -61,7 +61,7 @@ function replaceAccordionToggle(text: string): string {
61
61
  const innerContent = text.slice(contentStart, end);
62
62
 
63
63
  result += text.slice(lastIndex, start);
64
- result += `<srl-note-accordion-toggle :accordion="accordion"${attrs}>${innerContent}</srl-note-accordion-toggle>`;
64
+ result += `<srl-category-accordion-toggle :accordion="accordion"${attrs}>${innerContent}</srl-category-accordion-toggle>`;
65
65
  lastIndex = end + closeTag.length;
66
66
  openTagRegex.lastIndex = lastIndex;
67
67
  }
@@ -97,7 +97,7 @@ function replaceAccordionContent(text: string): string {
97
97
  const innerContent = replaceAccordionContent(text.slice(openTagRegex.lastIndex, end - 6));
98
98
 
99
99
  result += text.slice(lastIndex, start);
100
- result += `<srl-note-accordion-content :accordion="accordion"${attrs}>${innerContent}</srl-note-accordion-content>`;
100
+ result += `<srl-category-accordion-content :accordion="accordion"${attrs}>${innerContent}</srl-category-accordion-content>`;
101
101
  lastIndex = end;
102
102
  openTagRegex.lastIndex = end;
103
103
  }