@paris-ias/list 1.0.159 → 1.0.162

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/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@paris-ias/list",
3
3
  "configKey": "list",
4
- "version": "1.0.159",
4
+ "version": "1.0.162",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
@@ -11,18 +11,13 @@
11
11
  x-large
12
12
  tile
13
13
  flat
14
- :icon="'mdi-' + (current?.icon || defaultView?.icon)"
14
+ :icon="'mdi-' + currentIcon"
15
15
  :class="{ 'mt-3': isXsDisplay }"
16
16
  v-bind="mergeProps(menu, tooltip)"
17
17
  />
18
18
  </template>
19
19
  </template>
20
- <div
21
- v-html="
22
- $t('list.view-mode') +
23
- $t('list.' + (current?.name || defaultView?.name))
24
- "
25
- />
20
+ <div v-html="$t('list.view-mode') + $t('list.' + currentName)" />
26
21
  </v-tooltip>
27
22
  </template>
28
23
  <v-list density="compact">
@@ -61,16 +56,24 @@ const props = defineProps({
61
56
  const { xs: isXsDisplay } = useDisplay()
62
57
 
63
58
  const rootStore = useRootStore()
64
- const items = ref($stores[props.type].views)
65
59
 
66
- const current = ref($stores[props.type].view)
60
+ const store = computed(() => $stores[props.type])
67
61
 
68
- const defaultView = ref(
69
- $stores[props.type].views[
70
- Object.keys($stores[props.type].views).find(
71
- (k) => $stores[props.type].views[k]?.default === true,
72
- )
73
- ] || { name: "list", icon: "view-list" },
62
+ const items = computed(() => store.value?.views ?? {})
63
+
64
+ const current = computed(() => store.value?.view ?? null)
65
+
66
+ const defaultView = computed(() => {
67
+ const views = store.value?.views ?? {}
68
+ const key = Object.keys(views).find((k) => views[k]?.default === true)
69
+ return key ? views[key] : { name: "list", icon: "view-list" }
70
+ })
71
+
72
+ const currentIcon = computed(
73
+ () => current.value?.icon ?? defaultView.value.icon,
74
+ )
75
+ const currentName = computed(
76
+ () => current.value?.name ?? defaultView.value.name,
74
77
  )
75
78
 
76
79
  const updateView = async (value) => {
@@ -66,6 +66,7 @@ const getItems = (name) => {
66
66
  }))
67
67
  }
68
68
  if (
69
+ !messages.value[locale.value].list.filters[props.type] ||
69
70
  messages.value[locale.value].list.filters[props.type][name] === undefined
70
71
  ) {
71
72
  console.log("name not found, no item for this filter: ", name)
@@ -1,21 +1,5 @@
1
1
  <template>
2
2
  <ListMoleculesHeader :type="type" />
3
- <!-- <component
4
- :is="view"
5
- :loading="$stores[type] && $stores[type].loading && pending"
6
- >
7
- <component
8
- :is="itemTemplate"
9
- v-for="(item, index) in items"
10
- :key="(item.name || item.lastname) + type + index"
11
- :item
12
- :index
13
- :loading="$stores[type] && $stores[type].loading && pending"
14
- :pathPrefix="
15
- localePath({ name: pathPrefix, params: { slug: item.slug } })
16
- "
17
- />
18
- </component> -->
19
3
 
20
4
  <component
21
5
  :is="view"
@@ -30,7 +14,7 @@
30
14
  params: { slug: JSON.parse(item.slug) },
31
15
  })
32
16
  "
33
- class="no-decoration"
17
+ class="text-decoration-none text-black"
34
18
  >
35
19
  <component
36
20
  :is="itemTemplate"
@@ -136,8 +120,8 @@ const variables = computed(() => {
136
120
  // Computed properties for dynamic components
137
121
  const view = computed(() =>
138
122
  resolveComponent(
139
- "ListViews" + capitalize($stores[props.type]?.view?.name || "list")
140
- )
123
+ "ListViews" + capitalize($stores[props.type]?.view?.name || "list"),
124
+ ),
141
125
  )
142
126
  const itemTemplate = computed(() =>
143
127
  resolveComponent(
@@ -145,8 +129,8 @@ const itemTemplate = computed(() =>
145
129
  capitalize(props.type) +
146
130
  capitalize($stores[props.type]?.view?.name || "list") +
147
131
  "Item"
148
- ).toString()
149
- )
132
+ ).toString(),
133
+ ),
150
134
  )
151
135
  console.log("Starting query for type: ", props.type)
152
136
  console.log("Using variables: ", variables.value)
@@ -158,7 +142,7 @@ const { data, pending, error, refresh } = await useAsyncQuery(
158
142
  {
159
143
  key: `list-${props.type}`, // Unique key for caching
160
144
  server: true, // Enable SSR
161
- }
145
+ },
162
146
  )
163
147
  if (error.value) {
164
148
  console.error("GraphQL query error: ", error.value)
@@ -188,7 +172,7 @@ watch(
188
172
  rootStore.setLoading(false, props.type)
189
173
  }
190
174
  },
191
- { deep: true }
175
+ { deep: true },
192
176
  )
193
177
 
194
178
  // Reactive items computed from the store (single source of truth)
@@ -69,9 +69,14 @@ export const highlightAndTruncate = (stop, text, query) => {
69
69
  text = text.slice(0, stop) + "...";
70
70
  }
71
71
  query.forEach((element) => {
72
- const check = new RegExp(element, "gi");
73
- text = text.replace(check, function(matchedText) {
74
- return '<strong style="color: white;background-color: black;">' + matchedText + "</strong>";
72
+ const regex = new RegExp(element, "gi");
73
+ text = text.replace(regex, (matchedText) => {
74
+ return `<span style="
75
+ text-decoration: underline;
76
+ text-decoration-color: black;
77
+ text-decoration-thickness: 2px;
78
+ text-underline-offset: 2px;
79
+ ">${matchedText}</span>`;
75
80
  });
76
81
  });
77
82
  } else {
@@ -129,7 +129,6 @@ export const useRootStore = defineStore("rootStore", {
129
129
  ...$stores[type].views[value],
130
130
  name: value
131
131
  };
132
- $stores[type].loading = true;
133
132
  }
134
133
  this.updateRouteQuery(type);
135
134
  },
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "license": "AGPL-3.0-only",
3
3
  "main": "./dist/module.mjs",
4
- "version": "1.0.159",
4
+ "version": "1.0.162",
5
5
  "name": "@paris-ias/list",
6
6
  "repository": {
7
7
  "url": "git+https://github.com/IEA-Paris/list.git",
8
8
  "type": "git"
9
9
  },
10
10
  "dependencies": {
11
- "@paris-ias/trees": "^2.0.17"
11
+ "@paris-ias/trees": "^2.0.27"
12
12
  },
13
13
  "description": "Paris IAS List Module",
14
14
  "peerDependencies": {