@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 +1 -1
- package/dist/runtime/components/list/atoms/ViewMenu.vue +18 -15
- package/dist/runtime/components/list/molecules/Filters.vue +1 -0
- package/dist/runtime/components/list/organisms/List.vue +7 -23
- package/dist/runtime/composables/useUtils.js +8 -3
- package/dist/runtime/stores/root.js +0 -1
- package/package.json +2 -2
package/dist/module.json
CHANGED
|
@@ -11,18 +11,13 @@
|
|
|
11
11
|
x-large
|
|
12
12
|
tile
|
|
13
13
|
flat
|
|
14
|
-
:icon="'mdi-' +
|
|
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
|
|
60
|
+
const store = computed(() => $stores[props.type])
|
|
67
61
|
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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="
|
|
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
|
|
73
|
-
text = text.replace(
|
|
74
|
-
return
|
|
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 {
|
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.
|
|
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.
|
|
11
|
+
"@paris-ias/trees": "^2.0.27"
|
|
12
12
|
},
|
|
13
13
|
"description": "Paris IAS List Module",
|
|
14
14
|
"peerDependencies": {
|