@paris-ias/list 1.0.160 → 1.0.163

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.160",
4
+ "version": "1.0.163",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
@@ -45,7 +45,9 @@
45
45
  </v-responsive>
46
46
  </v-expand-transition>
47
47
  <br />
48
+ <!-- TODO: cabler par la bonne url iea et l'injecter dynamiquement -->
48
49
  <v-btn
50
+ v-if="item.url && !item.url.startsWith('https://www.paris-iea.fr/fr')"
49
51
  variant="text"
50
52
  class="ml-n4"
51
53
  size="small"
@@ -75,6 +77,7 @@ const startDay = ref(
75
77
  const startTime = ref(detailedStart.hours)
76
78
  const detailedStop = getDetailedFormatedDate(props.item.stop, locale.value)
77
79
  const stopTime = ref(detailedStop.hours)
80
+ console.log("locale", props.item)
78
81
  </script>
79
82
 
80
83
  <style lang="scss" scoped></style>
@@ -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) => {
@@ -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)
@@ -12,11 +12,12 @@
12
12
  :key="type"
13
13
  :feminine="type === 'people'"
14
14
  :type
15
- :open="$rootStore.results[type]?.total > 0 || open[type]"
15
+ :open="$rootStore.results[type]?.total > 0 ?? open[type]"
16
16
  @toggle="open[$event] = !open[$event]"
17
17
  >
18
+ {{ $rootStore.results[type]?.total }}
18
19
  <v-expand-transition class="results-container">
19
- <div v-show="open[type]">
20
+ <div v-show="$rootStore.results[type]?.total > 0 || open[type]">
20
21
  <ListAtomsResultsList :type />
21
22
  </div>
22
23
  </v-expand-transition>
@@ -67,7 +68,7 @@ const sortedModules = computed(() => {
67
68
  // Computed property to filter and sort modules based on selected categories
68
69
  const filteredSortedModules = computed(() => {
69
70
  return sortedModules.value.filter((type) =>
70
- selectedCategories.value.includes(type)
71
+ selectedCategories.value.includes(type),
71
72
  )
72
73
  })
73
74
 
@@ -78,7 +79,7 @@ const { data, pending, error, refresh } = await useAsyncQuery(
78
79
  {
79
80
  key: `search-${$rootStore.search}`, // Unique key for caching
80
81
  server: true, // Enable SSR
81
- }
82
+ },
82
83
  )
83
84
  if (error.value) {
84
85
  console.error("GraphQL query error: ", error.value)
@@ -90,7 +91,14 @@ if (error.value) {
90
91
  if (data.value) {
91
92
  console.log("Applying data to store directly [first load scenario]")
92
93
  $rootStore.applyListResult("all", data.value)
94
+ // Initialize open state for types with results
95
+ appConfig.list.modules.forEach((type) => {
96
+ if ($rootStore.results[type]?.total > 0) {
97
+ open.value[type] = true
98
+ }
99
+ })
93
100
  }
101
+
94
102
  const updateSearch = async (newSearch) => {
95
103
  console.log("update search")
96
104
  if (newSearch !== $rootStore.search) {
@@ -98,6 +106,12 @@ const updateSearch = async (newSearch) => {
98
106
  if (data.value) {
99
107
  console.log("Applying data to store directly [first load scenario]")
100
108
  $rootStore.applyListResult("all", data.value)
109
+ // Initialize open state for types with results
110
+ appConfig.list.modules.forEach((type) => {
111
+ if ($rootStore.results[type]?.total > 0) {
112
+ open.value[type] = true
113
+ }
114
+ })
101
115
  }
102
116
  }
103
117
  }
@@ -16,6 +16,21 @@
16
16
  :key="network"
17
17
  :value="network"
18
18
  >
19
+ <!-- TODO: Injecter dynamiquement l'url -->
20
+ <SocialShare
21
+ :key="network"
22
+ class="text-black"
23
+ :network="network"
24
+ :title="$t('share-this-on', { item: item.name })"
25
+ :aria-label="$t('share-on', { network: network })"
26
+ :image="item.image"
27
+ :url="'https://www.paris-iea.fr/fr' + route.fullPath"
28
+ >
29
+ <template #label>
30
+ {{ network }}
31
+ </template>
32
+ </SocialShare>
33
+
19
34
  <!-- <SocialShare
20
35
  :key="network"
21
36
  class="text-black"
@@ -36,11 +51,11 @@
36
51
  </template>
37
52
 
38
53
  <script setup>
39
- import { mergeProps } from "vue";
40
- import { useRoute } from "#imports";
54
+ import { mergeProps } from "vue"
55
+ import { useRoute } from "#imports"
41
56
  /* import config from "~/static.config"; */
42
57
 
43
- const route = useRoute();
58
+ const route = useRoute()
44
59
 
45
60
  const props = defineProps({
46
61
  networks: {
@@ -60,7 +75,7 @@ const props = defineProps({
60
75
  type: Object,
61
76
  required: true,
62
77
  },
63
- });
78
+ })
64
79
 
65
80
  /* console.log("PRPOS", props.item) */
66
81
  </script>
@@ -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.160",
4
+ "version": "1.0.163",
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.22"
11
+ "@paris-ias/trees": "^2.0.31"
12
12
  },
13
13
  "description": "Paris IAS List Module",
14
14
  "peerDependencies": {