@paris-ias/list 1.0.172 → 1.0.173

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.172",
4
+ "version": "1.0.173",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
@@ -37,7 +37,7 @@
37
37
  :key="key"
38
38
  :disabled="$stores[type].loading || key === currentSort"
39
39
  :active="key === currentSort"
40
- active-class="bg-black text-white"
40
+ active-class="list-item-active"
41
41
  @click="
42
42
  rootStore.updateSort({
43
43
  type: type,
@@ -71,11 +71,15 @@ const props = defineProps({
71
71
  type: { type: String, default: "articles", required: true },
72
72
  })
73
73
 
74
- const currentSort = computed(() =>
75
- $stores[props.type]?.currentSort
76
- ? $stores[props.type]?.currentSort
77
- : Object.keys($stores[props.type]?.sort).find(
78
- (k) => $stores[props.type].sort[k]?.default,
79
- ),
74
+ const currentSort = computed(
75
+ () =>
76
+ rootStore?.sort ||
77
+ Object.keys($stores[props.type]?.sort).find(
78
+ (k) => $stores[props.type].sort[k]?.default,
79
+ ),
80
80
  )
81
81
  </script>
82
+
83
+ <style>
84
+ .list-item-active{background-color:#000!important;color:#fff!important}.list-item-active .v-list-item__overlay{opacity:0!important}
85
+ </style>
@@ -11,22 +11,24 @@
11
11
  x-large
12
12
  tile
13
13
  flat
14
- :icon="'mdi-' + currentIcon"
14
+ :icon="'mdi-' + currentView.icon"
15
15
  :class="{ 'mt-3': isXsDisplay }"
16
16
  v-bind="mergeProps(menu, tooltip)"
17
17
  />
18
18
  </template>
19
19
  </template>
20
- <div v-html="$t('list.view-mode') + $t('list.' + currentName)" />
20
+ <div v-html="$t('list.view-mode') + $t('list.' + currentView.name)" />
21
21
  </v-tooltip>
22
22
  </template>
23
23
  <v-list density="compact">
24
24
  <v-list-item
25
25
  v-for="(value, key, index) in items"
26
26
  :key="index"
27
- :disabled="$stores[type].loading || (value.name || key) === currentName"
28
- :active="(value.name || key) === currentName"
29
- active-class="bg-black text-white"
27
+ :disabled="
28
+ $stores[type].loading || (value.name || key) === currentView.name
29
+ "
30
+ :active="(value.name || key) === currentView.name"
31
+ active-class="list-item-active"
30
32
  @click="updateView(value.name || key)"
31
33
  >
32
34
  <template #prepend>
@@ -44,9 +46,12 @@
44
46
  import { mergeProps } from "vue"
45
47
  import { useDisplay } from "vuetify"
46
48
  import { useRootStore } from "../../../stores/root"
47
- import { useNuxtApp, ref, useI18n, computed } from "#imports"
49
+ import { useNuxtApp, useI18n, computed } from "#imports"
50
+
48
51
  const { locale } = useI18n()
49
52
  const { $stores } = useNuxtApp()
53
+ const rootStore = useRootStore()
54
+ const { xs: isXsDisplay } = useDisplay()
50
55
 
51
56
  const props = defineProps({
52
57
  type: {
@@ -55,33 +60,30 @@ const props = defineProps({
55
60
  required: true,
56
61
  },
57
62
  })
58
- const { xs: isXsDisplay } = useDisplay()
59
-
60
- const rootStore = useRootStore()
61
63
 
62
- const store = computed(() => $stores[props.type])
64
+ const items = computed(() => $stores[props.type]?.views ?? {})
63
65
 
64
- const items = computed(() => store.value?.views ?? {})
66
+ const currentView = computed(() => {
67
+ const store = $stores[props.type]
68
+ if (store?.view) return store.view
65
69
 
66
- const current = computed(() => store.value?.view ?? null)
67
-
68
- console.log("current", current.value)
69
- const defaultView = computed(() => {
70
- const views = store.value?.views ?? {}
71
- const key = Object.keys(views).find((k) => views[k]?.default === true)
72
- return key ? views[key] : { name: "list", icon: "view-list" }
70
+ const views = store?.views ?? {}
71
+ const defaultKey = Object.keys(views).find((k) => views[k]?.default)
72
+ return defaultKey ? views[defaultKey] : { name: "list", icon: "view-list" }
73
73
  })
74
74
 
75
- const currentIcon = computed(
76
- () => current.value?.icon ?? defaultView.value.icon,
77
- )
78
- const currentName = computed(
79
- () => current.value?.name ?? defaultView.value.name,
80
- )
81
-
82
- const updateView = async (value) => {
75
+ const updateView = (value) => {
83
76
  rootStore.updateView({ value, type: props.type, lang: locale.value })
84
77
  }
85
78
  </script>
86
79
 
87
- <style lang="scss"></style>
80
+ <style>
81
+ .list-item-active {
82
+ background-color: black !important;
83
+ color: white !important;
84
+ }
85
+
86
+ .list-item-active .v-list-item__overlay {
87
+ opacity: 0 !important;
88
+ }
89
+ </style>
@@ -162,7 +162,6 @@ watch(
162
162
  async (newVars, oldVars) => {
163
163
  if (newVars && JSON.stringify(newVars) !== JSON.stringify(oldVars)) {
164
164
  console.log("Variables changed, refreshing query, newVars: ", newVars)
165
- console.log("start local loading from computed")
166
165
  rootStore.setLoading(true, props.type)
167
166
  await refresh()
168
167
  if (data.value) {
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.172",
4
+ "version": "1.0.173",
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.38"
11
+ "@paris-ias/trees": "^2.0.39"
12
12
  },
13
13
  "description": "Paris IAS List Module",
14
14
  "peerDependencies": {