@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.
- package/dev/package.json +1 -1
- package/dev/src/App.vue +2 -7
- package/dev/src/components/{PageHeader.vue → Page/Header.vue} +1 -2
- package/dev/src/views/ArticleView.vue +2 -3
- package/livingdocs/040.Media/010.table/table/download.vue +494 -0
- package/livingdocs/040.Media/010.table/table/responsive.vue +104 -0
- package/livingdocs/040.Media/010.table/table.html +2 -2
- package/livingdocs/040.Media/010.table/table.vue +26 -0
- package/package.json +1 -1
- package/plugins/viteSrlPlugin.d.ts +2 -0
- package/plugins/viteSrlPlugin.js +19 -36
- package/scripts/build.js +17 -0
- package/scripts/ldd/mapLdd.js +2 -2
- package/scripts/vue/components.d.ts +1 -0
- package/scripts/vue/components.js +93 -0
- package/srl/components/Srl/Article/{DialogButton.vue → Dialog/Button.vue} +1 -1
- package/srl/components/Srl/{Note → Category}/Accordion/Content.vue +1 -1
- package/srl/components/Srl/Menu/Item/Content.vue +7 -14
- package/srl/components/Srl/Menu/Item.vue +12 -10
- package/srl/components/Srl/{Menu/List.vue → Menu.vue} +3 -4
- package/srl/components/Srl/Page/Dialog.vue +1 -1
- package/srl/composables/config.ts +13 -14
- package/srl/composables/cssStyles.ts +1 -1
- package/srl/composables/menu.ts +5 -1
- package/srl/composables/viewPort.ts +4 -3
- package/srl/plugins/asyncLdComponent.ts +2 -2
- package/srl/plugins/asyncSrlComponents.ts +2 -0
- package/srl/plugins/initProject.ts +1 -1
- package/srl/plugins/vueSrlPlugin.ts +3 -20
- package/srl/types/components.d.ts +3 -17
- package/srl/types/global.d.ts +7 -0
- package/srl/types/nswow.d.ts +14 -14
- package/srl/utils/html.ts +3 -3
- package/dev/src/components/SrlPage/KFCApplication/KFCApplication.vue +0 -715
- package/dev/src/components/SrlPage/KFCApplication/KFCDropdownCharts.vue +0 -112
- package/dev/src/components/SrlPage/KFCApplication/KFCDropdownPeriod.vue +0 -85
- package/dev/src/components/SrlPage/KFCApplication/KFCTable.vue +0 -63
- package/dev/src/components/SrlPage/KFCApplication/hooks/kfcData.ts +0 -9
- package/dev/src/components/SrlPage/KFCApplication/models/KFCApplication.ts +0 -183
- package/dev/src/components/SrlPage/KFCApplication/scss/_highcharts-basic.scss +0 -1136
- package/dev/src/components/SrlPage/KFCApplication/scss/_highcharts-custom.scss +0 -71
- package/dev/src/components/SrlPage/KFCApplication/scss/_highcharts-general.scss +0 -113
- package/dev/src/components/SrlPage/KFCApplication/scss/_iz-keyfigure-comparison-dropdown.scss +0 -189
- package/dev/src/components/SrlPage/KFCApplication/scss/_iz-keyfigure-comparison.scss +0 -151
- package/dev/src/components/SrlPage/KFCApplication/scss/_kfc-loading.scss +0 -40
- package/dev/src/components/SrlPage/KFCApplication/scss/_kfc-print.scss +0 -20
- package/dev/src/components/SrlPage/KFCApplication/scss/_srl-button-kfc.scss +0 -21
- package/dev/src/components/SrlPage/KFCApplication/scss/_variables.scss +0 -10
- package/dev/src/components/SrlPage/KFCApplication/services/xlsxParser.ts +0 -194
- package/dev/src/components/SrlPage/KFCApplication/theme/SvgColumnView.vue +0 -28
- package/dev/src/components/SrlPage/KFCApplication/theme/SvgDownloadChart.vue +0 -26
- package/dev/src/components/SrlPage/KFCApplication/theme/SvgDropdown.vue +0 -18
- package/dev/src/components/SrlPage/KFCApplication/theme/SvgIndexedValues.vue +0 -18
- package/dev/src/components/SrlPage/KFCApplication/theme/SvgLegendSwap.vue +0 -18
- package/dev/src/components/SrlPage/KFCApplication/theme/SvgLineView.vue +0 -28
- package/dev/src/components/SrlPage/KFCApplication/theme/SvgPDFChart.vue +0 -26
- package/dev/src/components/SrlPage/KFCApplication/theme/SvgPrintChart.vue +0 -33
- package/dev/src/components/SrlPage/KFCApplication/theme/SvgTableView.vue +0 -67
- package/dev/src/components/SrlPage/KFCApplication/utils/XDownloader.js +0 -455
- package/dev/src/components/SrlPage/KFCApplication/utils/XDownloaderStyle.js +0 -44
- package/dev/src/components/SrlPage/KFCApplication/utils/XTableNamer.js +0 -68
- /package/dev/src/components/{BypassLinks.vue → Page/BypassLinks.vue} +0 -0
- /package/dev/src/components/{PageFooter.vue → Page/Footer.vue} +0 -0
- /package/dev/src/components/{PageMain.vue → Page/Main.vue} +0 -0
- /package/dev/src/components/{MainNavigation.vue → Page/MainNavigation.vue} +0 -0
- /package/dev/src/components/{NavLanguages.vue → Page/NavLanguages.vue} +0 -0
- /package/dev/src/components/{PrevNext.vue → Page/PrevNext.vue} +0 -0
- /package/srl/{components/Srl/Page/App.vue → App.vue} +0 -0
- /package/srl/components/Srl/{Note → Category}/Accordion/Toggle.vue +0 -0
- /package/srl/components/Srl/{Note → Category}/Accordion.vue +0 -0
- /package/srl/components/Srl/Menu/Item/Content/{IconAfter.vue → Icon/After.vue} +0 -0
- /package/srl/components/Srl/Menu/Item/Content/{IconBefore.vue → Icon/Before.vue} +0 -0
- /package/srl/components/Srl/Menu/Item/Content/{ImageAfter.vue → Image/After.vue} +0 -0
- /package/srl/components/Srl/Menu/Item/Content/{ImageBefore.vue → Image/Before.vue} +0 -0
package/package.json
CHANGED
package/plugins/viteSrlPlugin.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { existsSync, readFileSync, writeFileSync, readdirSync, statSync } from 'node:fs';
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
2
|
import { join, relative } from 'node:path/posix';
|
|
4
3
|
import { execSync } from 'node:child_process';
|
|
5
4
|
import folders from '../scripts/folders.js';
|
|
@@ -14,6 +13,7 @@ import {
|
|
|
14
13
|
mapScss,
|
|
15
14
|
} from '../scripts/build.js';
|
|
16
15
|
import chalk from 'chalk';
|
|
16
|
+
import { vueComponents } from '../scripts/vue/components.js';
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -36,10 +36,8 @@ function printPromptsMessage(messages) {
|
|
|
36
36
|
console.log('');
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
40
39
|
const data = {
|
|
41
|
-
version: null
|
|
42
|
-
components:{}
|
|
40
|
+
version: null
|
|
43
41
|
};
|
|
44
42
|
const srlConfig = readConfigJson();
|
|
45
43
|
|
|
@@ -95,39 +93,9 @@ function checkForUpdates() {
|
|
|
95
93
|
}
|
|
96
94
|
} catch (e) {}
|
|
97
95
|
}
|
|
98
|
-
|
|
99
|
-
function findVueFilesInSrl() {
|
|
100
|
-
const componentsPath = join(folders.srlSrc, 'components');
|
|
101
|
-
const baseDir = join(componentsPath, 'Srl');
|
|
102
|
-
const result = {};
|
|
103
|
-
|
|
104
|
-
function search(dir) {
|
|
105
|
-
for (const entry of readdirSync(dir)) {
|
|
106
|
-
const fullPath = join(dir, entry);
|
|
107
|
-
if (statSync(fullPath).isDirectory()) {
|
|
108
|
-
search(fullPath);
|
|
109
|
-
} else if (entry.endsWith('.vue')) {
|
|
110
|
-
const path = relative(componentsPath, fullPath);
|
|
111
|
-
const name = path.slice(0, -4)
|
|
112
|
-
.replaceAll('/', '')
|
|
113
|
-
.replaceAll('\\', '');
|
|
114
|
-
|
|
115
|
-
result[name] = `@/components/${path}`;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (existsSync(baseDir) && statSync(baseDir).isDirectory()) {
|
|
121
|
-
search(baseDir);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return result;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
96
|
async function startActions() {
|
|
128
97
|
data.version = getPackageVersion();
|
|
129
98
|
checkForUpdates();
|
|
130
|
-
data.components = findVueFilesInSrl();
|
|
131
99
|
if (!srlConfig || JSON.stringify(srlConfig) !== JSON.stringify(data)) {
|
|
132
100
|
writeConfigJson(data);
|
|
133
101
|
}
|
|
@@ -139,6 +107,7 @@ async function startActions() {
|
|
|
139
107
|
]);
|
|
140
108
|
}
|
|
141
109
|
|
|
110
|
+
await vueComponents();
|
|
142
111
|
await beaver(0);
|
|
143
112
|
await map();
|
|
144
113
|
await mapJs();
|
|
@@ -160,7 +129,6 @@ export default function viteSrlPlugin() {
|
|
|
160
129
|
return {
|
|
161
130
|
name: 'vite-srl-plugin',
|
|
162
131
|
config(config) {
|
|
163
|
-
|
|
164
132
|
startActions();
|
|
165
133
|
|
|
166
134
|
config.base = './';
|
|
@@ -169,6 +137,7 @@ export default function viteSrlPlugin() {
|
|
|
169
137
|
config.resolve.alias = config.resolve.alias || {};
|
|
170
138
|
config.resolve.alias['~'] = folders.root;
|
|
171
139
|
config.resolve.alias['@'] = folders.srlSrc;
|
|
140
|
+
config.resolve.alias['#srl'] = folders.srlRoot;
|
|
172
141
|
config.resolve.alias['#components'] = folders.srlComponents;
|
|
173
142
|
config.resolve.alias['#composables'] = folders.srlComposables;
|
|
174
143
|
config.resolve.alias['#plugins'] = folders.srlPlugins;
|
|
@@ -229,6 +198,13 @@ export default function viteSrlPlugin() {
|
|
|
229
198
|
) {
|
|
230
199
|
triggerAction(mapLdd);
|
|
231
200
|
}
|
|
201
|
+
|
|
202
|
+
if (
|
|
203
|
+
path.includes('src/components/') &&
|
|
204
|
+
path.endsWith('.vue')
|
|
205
|
+
) {
|
|
206
|
+
triggerAction(vueComponents);
|
|
207
|
+
}
|
|
232
208
|
});
|
|
233
209
|
|
|
234
210
|
server.watcher.on('unlink', (path) => {
|
|
@@ -264,6 +240,13 @@ export default function viteSrlPlugin() {
|
|
|
264
240
|
) {
|
|
265
241
|
triggerAction(mapLdd);
|
|
266
242
|
}
|
|
243
|
+
|
|
244
|
+
if (
|
|
245
|
+
path.includes('src/components/') &&
|
|
246
|
+
path.endsWith('.vue')
|
|
247
|
+
) {
|
|
248
|
+
triggerAction(vueComponents);
|
|
249
|
+
}
|
|
267
250
|
});
|
|
268
251
|
},
|
|
269
252
|
};
|
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', {
|
package/scripts/ldd/mapLdd.js
CHANGED
|
@@ -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++) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function vueComponents(): Promise<void>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import folders from '../folders.js';
|
|
2
|
+
import { join, relative } from 'node:path/posix';
|
|
3
|
+
import { existsSync, readdirSync, statSync, writeFileSync } from 'node:fs';
|
|
4
|
+
|
|
5
|
+
function toPascalAfterSlash(str) {
|
|
6
|
+
return str.replace(/\/(.)/g, (_, c) => c.toUpperCase());
|
|
7
|
+
}
|
|
8
|
+
function readVueDir(entryPath, prefix = '') {
|
|
9
|
+
const componentsPath = join(entryPath, 'components');
|
|
10
|
+
const result = {};
|
|
11
|
+
|
|
12
|
+
function search(dir) {
|
|
13
|
+
for (const entry of readdirSync(dir)) {
|
|
14
|
+
const fullPath = join(dir, entry);
|
|
15
|
+
if (statSync(fullPath).isDirectory()) {
|
|
16
|
+
search(fullPath);
|
|
17
|
+
} else if (entry.endsWith('.vue')) {
|
|
18
|
+
const path = relative(componentsPath, fullPath);
|
|
19
|
+
let name = path.slice(0, -4);
|
|
20
|
+
name = toPascalAfterSlash(name);
|
|
21
|
+
name = name.replaceAll('/', '');
|
|
22
|
+
|
|
23
|
+
result[name] = {
|
|
24
|
+
component: `${prefix}components/${path}`,
|
|
25
|
+
type: relative(folders.srlTypes, fullPath)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (existsSync(componentsPath) && statSync(componentsPath).isDirectory()) {
|
|
32
|
+
search(componentsPath);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export async function vueComponents() {
|
|
39
|
+
const appComponents = readVueDir(folders.srlSrc, '@/');
|
|
40
|
+
const srlComponents = readVueDir(folders.srlRoot, '#');
|
|
41
|
+
|
|
42
|
+
const components = []
|
|
43
|
+
const types = []
|
|
44
|
+
|
|
45
|
+
for (const [name, info] of Object.entries(appComponents)) {
|
|
46
|
+
components.push(
|
|
47
|
+
`app.component('${name}', defineAsyncComponent(() => import('${info.component}')));`,
|
|
48
|
+
)
|
|
49
|
+
types.push({
|
|
50
|
+
name: name,
|
|
51
|
+
type: ` type ${name} = typeof import('${info.type}')['default'];`,
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
|
|
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]) {
|
|
59
|
+
components.push(
|
|
60
|
+
`app.component('${name}', defineAsyncComponent(() => import('${componentPath}')));`,
|
|
61
|
+
)
|
|
62
|
+
types.push({
|
|
63
|
+
name: name,
|
|
64
|
+
type: ` type ${name} = typeof import('${typePath}')['default'];`,
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
writeFileSync(join(folders.srlPlugins, 'asyncSrlComponents.ts'),
|
|
70
|
+
`import { defineAsyncComponent, type App } from 'vue';
|
|
71
|
+
export default function asyncSrlComponents(app: App): void {
|
|
72
|
+
${components.join('\n ')}
|
|
73
|
+
}
|
|
74
|
+
`, 'utf8');
|
|
75
|
+
|
|
76
|
+
const componentsInterface = types.map(t => {
|
|
77
|
+
return ` ${t.name}: ${t.name};`
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
writeFileSync(join(folders.srlTypes, 'components.d.ts'),
|
|
81
|
+
`export {};
|
|
82
|
+
declare global {
|
|
83
|
+
${types.map(t=>t.type).join("\n")}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface _GlobalComponents {
|
|
87
|
+
${componentsInterface.join("\n")}
|
|
88
|
+
}
|
|
89
|
+
declare module '@vue/runtime-core' {
|
|
90
|
+
export interface GlobalComponents extends _GlobalComponents {}
|
|
91
|
+
}
|
|
92
|
+
`, 'utf8');
|
|
93
|
+
}
|
|
@@ -11,7 +11,7 @@ const config = useConfig();
|
|
|
11
11
|
const articles = useArticles();
|
|
12
12
|
const id = ref<string>(`srl-page__dialog-${useId()}`);
|
|
13
13
|
const content = ref<string>('');
|
|
14
|
-
const dialog = ref<
|
|
14
|
+
const dialog = ref<SrlPageDialog | null>(null);
|
|
15
15
|
async function loadContent() {
|
|
16
16
|
const article = articles.value.find((article) => article.uuid === props.uuid);
|
|
17
17
|
if (article) {
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import MenuItemContentText from './Content/Text.vue';
|
|
3
|
-
import MenuItemContentImage from './Content/Image.vue';
|
|
4
|
-
import MenuItemContentImageBefore from './Content/ImageBefore.vue';
|
|
5
|
-
import MenuItemContentImageAfter from './Content/ImageAfter.vue';
|
|
6
|
-
import MenuItemContentIcon from './Content/Icon.vue';
|
|
7
|
-
import MenuItemContentIconBefore from './Content/IconBefore.vue';
|
|
8
|
-
import MenuItemContentIconAfter from './Content/IconAfter.vue';
|
|
9
2
|
|
|
10
3
|
const props = defineProps<{
|
|
11
4
|
item: NsWowNavigationItem
|
|
@@ -15,43 +8,43 @@ const props = defineProps<{
|
|
|
15
8
|
</script>
|
|
16
9
|
|
|
17
10
|
<template>
|
|
18
|
-
<
|
|
11
|
+
<SrlMenuItemContentIcon
|
|
19
12
|
v-if="props.item.icon"
|
|
20
13
|
:item="props.item"
|
|
21
14
|
:depth="props.depth"
|
|
22
15
|
:disableClasses="props.disableClasses"
|
|
23
16
|
/>
|
|
24
|
-
<
|
|
17
|
+
<SrlMenuItemContentIconBefore
|
|
25
18
|
v-else-if="props.item.iconBefore"
|
|
26
19
|
:item="props.item"
|
|
27
20
|
:depth="props.depth"
|
|
28
21
|
:disableClasses="props.disableClasses"
|
|
29
22
|
/>
|
|
30
|
-
<
|
|
23
|
+
<SrlMenuItemContentIconAfter
|
|
31
24
|
v-else-if="props.item.iconAfter"
|
|
32
25
|
:item="props.item"
|
|
33
26
|
:depth="props.depth"
|
|
34
27
|
:disableClasses="props.disableClasses"
|
|
35
28
|
/>
|
|
36
|
-
<
|
|
29
|
+
<SrlMenuItemContentImage
|
|
37
30
|
v-else-if="props.item.img"
|
|
38
31
|
:item="props.item"
|
|
39
32
|
:depth="props.depth"
|
|
40
33
|
:disableClasses="props.disableClasses"
|
|
41
34
|
/>
|
|
42
|
-
<
|
|
35
|
+
<SrlMenuItemContentImageBefore
|
|
43
36
|
v-else-if="props.item.imgBefore"
|
|
44
37
|
:item="props.item"
|
|
45
38
|
:depth="props.depth"
|
|
46
39
|
:disableClasses="props.disableClasses"
|
|
47
40
|
/>
|
|
48
|
-
<
|
|
41
|
+
<SrlMenuItemContentImageAfter
|
|
49
42
|
v-else-if="props.item.imgAfter"
|
|
50
43
|
:item="props.item"
|
|
51
44
|
:depth="props.depth"
|
|
52
45
|
:disableClasses="props.disableClasses"
|
|
53
46
|
/>
|
|
54
|
-
<
|
|
47
|
+
<SrlMenuItemContentText
|
|
55
48
|
v-else
|
|
56
49
|
:item="props.item"
|
|
57
50
|
:depth="props.depth"
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, nextTick, ref, useId } from 'vue'
|
|
3
|
-
import MenuItemContent from './Item/Content.vue'
|
|
4
|
-
import MenuList from './List.vue'
|
|
5
3
|
import type { RouterLink } from 'vue-router'
|
|
6
4
|
import { isExternalPath } from '#utils/uri'
|
|
7
5
|
|
|
@@ -169,11 +167,12 @@ const classListItem = computed(() => {
|
|
|
169
167
|
</script>
|
|
170
168
|
|
|
171
169
|
<template>
|
|
172
|
-
<li v-if="!item.children && props.item.href" :class="classListLi">
|
|
170
|
+
<li v-if="!item.children && props.item.href" role="none" :class="classListLi">
|
|
173
171
|
<router-link
|
|
174
172
|
v-if="!external"
|
|
175
173
|
ref="$el"
|
|
176
174
|
tabindex="-1"
|
|
175
|
+
role="menuitem"
|
|
177
176
|
:to="props.item.href"
|
|
178
177
|
:class="classListItem"
|
|
179
178
|
:title="props.item.title ?? props.item.label"
|
|
@@ -187,7 +186,7 @@ const classListItem = computed(() => {
|
|
|
187
186
|
@keydown.shift.tab.exact="back"
|
|
188
187
|
@keydown.esc.stop.prevent="close"
|
|
189
188
|
>
|
|
190
|
-
<
|
|
189
|
+
<SrlMenuItemContent
|
|
191
190
|
:item="props.item"
|
|
192
191
|
:depth="props.depth"
|
|
193
192
|
:disableClasses="props.disableClasses"
|
|
@@ -197,6 +196,7 @@ const classListItem = computed(() => {
|
|
|
197
196
|
v-else
|
|
198
197
|
tabindex="-1"
|
|
199
198
|
ref="$el"
|
|
199
|
+
role="menuitem"
|
|
200
200
|
:href="props.item.href"
|
|
201
201
|
:title="props.item.title ?? props.item.label"
|
|
202
202
|
:class="classListItem"
|
|
@@ -212,18 +212,19 @@ const classListItem = computed(() => {
|
|
|
212
212
|
@keydown.shift.tab.exact="back"
|
|
213
213
|
@keydown.esc.stop.prevent="close"
|
|
214
214
|
>
|
|
215
|
-
<
|
|
215
|
+
<SrlMenuItemContent
|
|
216
216
|
:item="props.item"
|
|
217
217
|
:depth="props.depth"
|
|
218
218
|
:disableClasses="props.disableClasses"
|
|
219
219
|
/>
|
|
220
220
|
</a>
|
|
221
221
|
</li>
|
|
222
|
-
<li v-else-if="props.item.callback" :class="classListLi">
|
|
222
|
+
<li v-else-if="props.item.callback" role="none" :class="classListLi">
|
|
223
223
|
<button
|
|
224
224
|
type="button"
|
|
225
225
|
ref="$el"
|
|
226
226
|
tabindex="-1"
|
|
227
|
+
role="menuitem"
|
|
227
228
|
:class="classListItem"
|
|
228
229
|
:title="props.item.title ?? props.item.label"
|
|
229
230
|
:aria-label="props.item.icon ? props.item.title ?? props.item.label : undefined"
|
|
@@ -237,18 +238,19 @@ const classListItem = computed(() => {
|
|
|
237
238
|
@keydown.shift.tab.exact="back"
|
|
238
239
|
@keydown.esc.stop.prevent="close"
|
|
239
240
|
>
|
|
240
|
-
<
|
|
241
|
+
<SrlMenuItemContent
|
|
241
242
|
:item="props.item"
|
|
242
243
|
:depth="props.depth"
|
|
243
244
|
:disableClasses="props.disableClasses"
|
|
244
245
|
/>
|
|
245
246
|
</button>
|
|
246
247
|
</li>
|
|
247
|
-
<li v-else :class="classListLi">
|
|
248
|
+
<li v-else :class="classListLi" role="none">
|
|
248
249
|
<button
|
|
249
250
|
type="button"
|
|
250
251
|
ref="$el"
|
|
251
252
|
tabindex="-1"
|
|
253
|
+
role="menuitem"
|
|
252
254
|
:aria-haspopup="props.item.children ? 'true' : 'false'"
|
|
253
255
|
:aria-expanded="opened"
|
|
254
256
|
:aria-controls="`${props.name}-${id}`"
|
|
@@ -265,13 +267,13 @@ const classListItem = computed(() => {
|
|
|
265
267
|
@keydown.shift.tab.exact="back"
|
|
266
268
|
@keydown.esc.stop.prevent="close"
|
|
267
269
|
>
|
|
268
|
-
<
|
|
270
|
+
<SrlMenuItemContent
|
|
269
271
|
:item="props.item"
|
|
270
272
|
:depth="props.depth"
|
|
271
273
|
:disableClasses="props.disableClasses"
|
|
272
274
|
/>
|
|
273
275
|
</button>
|
|
274
|
-
<
|
|
276
|
+
<SrlMenu
|
|
275
277
|
v-if="props.item.children"
|
|
276
278
|
ref="menu"
|
|
277
279
|
:id="`${props.name}-${id}`"
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
* />
|
|
52
52
|
*/
|
|
53
53
|
import { computed, ref } from 'vue'
|
|
54
|
-
import MenuItem from './Item.vue'
|
|
55
54
|
|
|
56
55
|
type BackButtonItem = {
|
|
57
56
|
title?: string
|
|
@@ -108,7 +107,7 @@ const emit = defineEmits([
|
|
|
108
107
|
'tab',
|
|
109
108
|
'back',
|
|
110
109
|
])
|
|
111
|
-
const items = ref<
|
|
110
|
+
const items = ref<SrlMenuItem[]>([])
|
|
112
111
|
|
|
113
112
|
const opened = defineModel('opened', { type: Boolean, default: true })
|
|
114
113
|
|
|
@@ -168,7 +167,7 @@ function routerChange() {
|
|
|
168
167
|
}
|
|
169
168
|
|
|
170
169
|
function closeAll(keep?: number | string) {
|
|
171
|
-
items.value.forEach((item:
|
|
170
|
+
items.value.forEach((item: SrlMenuItem, index: number) => {
|
|
172
171
|
if (keep !== index) item.closeItem()
|
|
173
172
|
})
|
|
174
173
|
}
|
|
@@ -247,7 +246,7 @@ defineExpose({
|
|
|
247
246
|
@keydown.left.prevent.stop="focusClickable(menuItems.length - 1)"
|
|
248
247
|
>
|
|
249
248
|
<template v-for="(item, index) in menuItems" :key="index">
|
|
250
|
-
<
|
|
249
|
+
<SrlMenuItem
|
|
251
250
|
ref="items"
|
|
252
251
|
:item="item"
|
|
253
252
|
:name="props.name"
|
|
@@ -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
|
-
|
|
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
|
-
|
|
109
|
-
config.value.translations = data;
|
|
104
|
+
config.value.translations = await response.json() as NsWowTranslations;
|
|
110
105
|
} catch (e) {
|
|
111
|
-
|
|
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
|
-
|
|
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
|
-
|
|
133
|
-
config.value.downloads[locale] = data;
|
|
131
|
+
config.value.downloads[locale] = await response.json();
|
|
134
132
|
} catch (e) {
|
|
135
|
-
|
|
133
|
+
const o = e as Error;
|
|
134
|
+
errorLog(`"${file}" could not be loaded.`, o);
|
|
136
135
|
}
|
|
137
136
|
}
|
|
138
137
|
|
package/srl/composables/menu.ts
CHANGED
|
@@ -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:
|
|
58
|
+
breakPoints: bp,
|
|
58
59
|
innerWidth: window.innerWidth,
|
|
59
60
|
viewPort: null,
|
|
60
61
|
};
|
|
61
62
|
|
|
62
|
-
for (const key in
|
|
63
|
-
if (
|
|
63
|
+
for (const key in bp) {
|
|
64
|
+
if (bp[key] <= innerWidth.value) {
|
|
64
65
|
res.viewPort = key;
|
|
65
66
|
} else {
|
|
66
67
|
break;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { defineAsyncComponent } from 'vue'
|
|
2
|
-
export default function asyncLdComponent(app) {}
|
|
1
|
+
import { defineAsyncComponent } from 'vue'
|
|
2
|
+
export default function asyncLdComponent(app) {}
|
|
@@ -1,27 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import SrlAriaTabChain from '#components/Srl/Aria/TabChain.vue';
|
|
3
|
-
import SrlArticleAutoload from '#components/Srl/Article/Autoload.vue';
|
|
4
|
-
import SrlArticleRoot from '#components/Srl/Article/Root.vue';
|
|
5
|
-
import SrlArticleDialogButton from '#components/Srl/Article/DialogButton.vue';
|
|
6
|
-
import SrlMenu from '#components/Srl/Menu/List.vue';
|
|
7
|
-
import SrlPageDialog from '#components/Srl/Page/Dialog.vue';
|
|
8
|
-
|
|
1
|
+
import { type App } from 'vue'
|
|
9
2
|
import asyncLdComponent from './asyncLdComponent.ts';
|
|
3
|
+
import asyncSrlComponents from '#plugins/asyncSrlComponents.ts';
|
|
10
4
|
|
|
11
5
|
export default {
|
|
12
6
|
install(app: App) {
|
|
13
|
-
app
|
|
14
|
-
app.component('SrlArticleAutoload', defineComponent(SrlArticleAutoload));
|
|
15
|
-
app.component('SrlArticleRoot', defineComponent(SrlArticleRoot));
|
|
16
|
-
app.component(
|
|
17
|
-
'SrlArticleDialogButton',
|
|
18
|
-
defineComponent(SrlArticleDialogButton),
|
|
19
|
-
);
|
|
20
|
-
app.component('SrlPageDialog', defineComponent(SrlPageDialog));
|
|
21
|
-
app.component('SrlMenu', defineComponent(SrlMenu));
|
|
22
|
-
app.component('SrlNoteAccordion', defineAsyncComponent(() => import('#components/Srl/Note/Accordion.vue')));
|
|
23
|
-
app.component('SrlNoteAccordionToggle', defineAsyncComponent(() => import('#components/Srl/Note/Accordion/Toggle.vue')));
|
|
24
|
-
app.component('SrlNoteAccordionContent', defineAsyncComponent(() => import('#components/Srl/Note/Accordion/Content.vue')));
|
|
7
|
+
asyncSrlComponents(app)
|
|
25
8
|
asyncLdComponent(app);
|
|
26
9
|
},
|
|
27
10
|
};
|
|
@@ -1,20 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
interface
|
|
4
|
-
app: App;
|
|
5
|
-
}
|
|
6
|
-
interface _GlobalComponents {
|
|
7
|
-
SrlAriaTabChain: (typeof import('../components/Srl/Aria/TabChain.vue'))['default'];
|
|
8
|
-
SrlArticleAutoload: (typeof import('../components/Srl/Article/Autoload.vue'))['default'];
|
|
9
|
-
SrlArticleDialogButton: (typeof import('../components/Srl/Article/DialogButton.vue'))['default'];
|
|
10
|
-
SrlArticleRoot: (typeof import('../components/Srl/Article/Root.vue'))['default'];
|
|
11
|
-
SrlMenu: (typeof import('../components/Srl/Menu/List.vue'))['default'];
|
|
12
|
-
SrlPageDialog: (typeof import('../components/Srl/Page/Dialog.vue'))['default'];
|
|
13
|
-
SrlNoteAccordion: (typeof import('../components/Srl/Note/Accordion.vue'))['default'];
|
|
14
|
-
SrlNoteAccordionToggle: (typeof import('../components/Srl/Note/Accordion/Toggle.vue'))['default'];
|
|
15
|
-
SrlNoteAccordionContent: (typeof import('../components/Srl/Note/Accordion/Content.vue'))['default'];
|
|
16
|
-
}
|
|
17
|
-
|
|
1
|
+
export {}
|
|
2
|
+
declare global {}
|
|
3
|
+
interface _GlobalComponents {}
|
|
18
4
|
declare module '@vue/runtime-core' {
|
|
19
5
|
export interface GlobalComponents extends _GlobalComponents {}
|
|
20
6
|
}
|