@simple-reporting/base 1.0.5 → 1.0.7

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 CHANGED
@@ -19,7 +19,7 @@
19
19
  "postinstall": "srl prepare"
20
20
  },
21
21
  "dependencies": {
22
- "@simple-reporting/base": "^1.0.5",
22
+ "@simple-reporting/base": "^1.0.7",
23
23
  "axios": "^1.9.0",
24
24
  "chalk": "^5.4.1",
25
25
  "exceljs": "^4.4.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simple-reporting/base",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Manage srl templates, build and publish",
5
5
  "bin": {
6
6
  "srl": "cli.js"
@@ -152,7 +152,13 @@ async function mapComponents(lddJson) {
152
152
  );
153
153
  const componentHtml = readFileSync(htmlPath, { encoding: 'utf-8' });
154
154
 
155
- lddComponents.push({ ...componentDeclaration, html: componentHtml });
155
+ lddComponents.push({
156
+ ...componentDeclaration,
157
+ html: componentHtml
158
+ .replaceAll(/>\s+/g, ">")
159
+ .replaceAll(/\s+</g, "<")
160
+ .trim()
161
+ });
156
162
  }
157
163
  } catch (error) {}
158
164
 
@@ -161,10 +167,11 @@ async function mapComponents(lddJson) {
161
167
  const vueFiles = globSync(join(groupPath, component, '*.vue'));
162
168
  if (vueFiles.length) {
163
169
  vueFiles.forEach( c => {
164
- const vueName = c.split('/').pop().substring(0, -4);
170
+ const vueFile = c.split('/').pop();
171
+ const vueName = toUpperCamelCase(vueFile.substring(0, vueFile.length - 4));
165
172
  vueComponents.push({
166
- name: `SrlLd${toUpperCamelCase(vueName)}`,
167
- path: join('#ld', group, component, `${vueName}.vue`),
173
+ name: `SrlLd${vueName}`,
174
+ path: join('#ld', group, component, vueFile),
168
175
  });
169
176
  })
170
177
  }
@@ -5,6 +5,25 @@ import MenuList from './List.vue';
5
5
  import type { RouterLink } from 'vue-router';
6
6
  import { isExternalPath } from '#utils/uri';
7
7
 
8
+ type BackButtonItem = {
9
+ title?: string;
10
+ img?: {
11
+ src: string;
12
+ alt?: string;
13
+ };
14
+ imgBefore?: {
15
+ src: string;
16
+ alt?: string;
17
+ };
18
+ imgAfter?: {
19
+ src: string;
20
+ alt?: string;
21
+ };
22
+ attributes?: {
23
+ [key: string]: string;
24
+ };
25
+ };
26
+
8
27
  const props = defineProps<{
9
28
  name: string;
10
29
  item: NsWowNavigationItem;
@@ -13,6 +32,9 @@ const props = defineProps<{
13
32
  disableTabIndex: boolean;
14
33
  initOpen: number;
15
34
  depth: number;
35
+ backButonEnabled?: boolean;
36
+ backButtonLabel?: string;
37
+ backButtonItem: BackButtonItem
16
38
  }>();
17
39
 
18
40
  const emit = defineEmits([
@@ -198,6 +220,9 @@ const dynamicAttributes = computed(() => {
198
220
  :disableTab="props.disableTab"
199
221
  :initOpen="props.initOpen"
200
222
  :depth="props.depth + 1"
223
+ :backButonEnabled="props.backButonEnabled"
224
+ :backButtonLabel="props.backButonEnabled ? props.item.label : undefined"
225
+ :backButtonItem="props.backButtonItem"
201
226
  v-model:opened="opened"
202
227
  @link="link"
203
228
  @routerChange="emit('routerChange')"
@@ -50,18 +50,41 @@
50
50
  * @link="handleNavigation"
51
51
  * />
52
52
  */
53
- import { ref } from 'vue';
53
+ import { computed, ref } from 'vue'
54
54
  import MenuItem from './Item.vue';
55
55
 
56
+ type BackButtonItem = {
57
+ title?: string;
58
+ img?: {
59
+ src: string;
60
+ alt?: string;
61
+ };
62
+ imgBefore?: {
63
+ src: string;
64
+ alt?: string;
65
+ };
66
+ imgAfter?: {
67
+ src: string;
68
+ alt?: string;
69
+ };
70
+ attributes?: {
71
+ [key: string]: string;
72
+ };
73
+ };
74
+
56
75
  const props = withDefaults(
57
76
  defineProps<{
58
77
  name: string;
59
78
  menu: NsWowNavigationItem[];
79
+ id?: string;
60
80
  disableTab?: boolean;
61
81
  disableTabIndex?: boolean;
62
82
  initOpen?: number;
63
83
  singleOpen?: boolean;
64
84
  depth?: number;
85
+ backButonEnabled?: boolean;
86
+ backButtonItem?: BackButtonItem;
87
+ backButtonLabel?: string;
65
88
  }>(),
66
89
  {
67
90
  disableTab: false,
@@ -69,6 +92,7 @@ const props = withDefaults(
69
92
  initOpen: 0,
70
93
  singleOpen: true,
71
94
  depth: 0,
95
+ backButtonItem: {}
72
96
  },
73
97
  );
74
98
 
@@ -149,6 +173,34 @@ function closeAll(keep?: number | string) {
149
173
 
150
174
  const $el = ref<HTMLUListElement>();
151
175
 
176
+ const menuItems = computed<NsWowNavigationItem[]>(() => {
177
+ return props.backButonEnabled && props.depth ? [
178
+ {
179
+ label: props.backButtonLabel,
180
+ title: props.backButtonItem.title,
181
+ img: props.backButtonItem.img,
182
+ imgBefore: props.backButtonItem.imgBefore,
183
+ imgAfter: props.backButtonItem.imgAfter,
184
+ attributes: props.backButtonItem.attributes ?
185
+ Object.assign(props.backButtonItem.attributes,
186
+ {
187
+ 'aria-controls': props.id,
188
+ 'aria-expanded': opened.value
189
+ }
190
+ ):
191
+ {
192
+ 'aria-controls': props.id,
193
+ 'aria-expanded': opened.value
194
+ },
195
+ callback: () => {
196
+ opened.value = false
197
+ emit('back')
198
+ },
199
+ },
200
+ ...props.menu,
201
+ ] : props.menu
202
+ });
203
+
152
204
  defineExpose({
153
205
  closeAll,
154
206
  $el,
@@ -157,8 +209,8 @@ defineExpose({
157
209
  </script>
158
210
 
159
211
  <template>
160
- <ul ref="$el" :hidden="!opened">
161
- <template v-for="(item, index) in props.menu" :key="index">
212
+ <ul ref="$el" :id="props.id" :hidden="!opened">
213
+ <template v-for="(item, index) in menuItems" :key="index">
162
214
  <MenuItem
163
215
  ref="items"
164
216
  :item="item"
@@ -168,6 +220,9 @@ defineExpose({
168
220
  :disableTabIndex="props.disableTabIndex"
169
221
  :initOpen="props.initOpen"
170
222
  :depth="props.depth"
223
+ :backButonEnabled="props.backButonEnabled"
224
+ :backButtonLabel="props.backButtonLabel"
225
+ :backButtonItem="props.backButtonItem"
171
226
  @open="open"
172
227
  @close="close"
173
228
  @next="next"