@paris-ias/list 1.0.157 → 1.0.158
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
|
@@ -45,7 +45,7 @@ const props = defineProps(["type", "expanded"])
|
|
|
45
45
|
|
|
46
46
|
const ComponentName = (name) => {
|
|
47
47
|
return resolveComponent(
|
|
48
|
-
"ListInputs" + capitalize($stores[props.type].filters[name].type)
|
|
48
|
+
"ListInputs" + capitalize($stores[props.type].filters[name].type)
|
|
49
49
|
)
|
|
50
50
|
}
|
|
51
51
|
const getItems = (name) => {
|
|
@@ -60,7 +60,7 @@ const getItems = (name) => {
|
|
|
60
60
|
title: i18n.t(
|
|
61
61
|
props.type === "people" && name === "vintage"
|
|
62
62
|
? item
|
|
63
|
-
: `list.filters.${props.type}.${name}.${item}
|
|
63
|
+
: `list.filters.${props.type}.${name}.${item}`
|
|
64
64
|
),
|
|
65
65
|
value: item,
|
|
66
66
|
}))
|
|
@@ -73,7 +73,7 @@ const getItems = (name) => {
|
|
|
73
73
|
}
|
|
74
74
|
// TODO replace with package based values
|
|
75
75
|
return Object.keys(
|
|
76
|
-
messages.value[locale.value].list.filters[props.type][name]
|
|
76
|
+
messages.value[locale.value].list.filters[props.type][name]
|
|
77
77
|
)
|
|
78
78
|
.filter((key) => key !== "label")
|
|
79
79
|
.map((item) => ({
|
|
@@ -82,24 +82,52 @@ const getItems = (name) => {
|
|
|
82
82
|
}))
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
const computeVisibility = (filterItem) => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
85
|
+
// const computeVisibility = (filterItem) => {
|
|
86
|
+
// return (
|
|
87
|
+
// // if anything is set in the visibility key
|
|
88
|
+
// !$stores[props.type].filters[filterItem].visibility ||
|
|
89
|
+
// $stores[props.type].filters[filterItem].visibility?.default ||
|
|
90
|
+
// $stores[props.type].filters[filterItem].visibility?.switchIf.find(
|
|
91
|
+
// // for each of the rules set in the switchIf key
|
|
92
|
+
// (rule) => {
|
|
93
|
+
// // we check if each of the condition are fulfilled
|
|
94
|
+
// return Object.keys(rule).find((value, _index, _obj) => {
|
|
95
|
+
// return $stores[props.type].filters[value].multiple
|
|
96
|
+
// ? $stores[props.type].filters[value]?.value &&
|
|
97
|
+
// $stores[props.type].filters[value]?.value.includes(rule[value])
|
|
98
|
+
// : $stores[props.type].filters[value]?.value === rule[value]
|
|
99
|
+
// })
|
|
100
|
+
// },
|
|
101
|
+
// )
|
|
102
|
+
// )
|
|
103
|
+
// }
|
|
104
|
+
|
|
105
|
+
const computeVisibility = (filterKey) => {
|
|
106
|
+
const filters = $stores[props.type].filters
|
|
107
|
+
const show = filters?.[filterKey]?.show
|
|
108
|
+
|
|
109
|
+
if (!show) return true
|
|
110
|
+
if (show.default) return true
|
|
111
|
+
if (!Array.isArray(show.switchIf)) return false
|
|
112
|
+
|
|
113
|
+
const checkRule = (rule) =>
|
|
114
|
+
Object.entries(rule).every(([depKey, expected]) => {
|
|
115
|
+
const dep = filters?.[depKey]
|
|
116
|
+
if (!dep) return false
|
|
117
|
+
const cur = dep.value
|
|
118
|
+
|
|
119
|
+
if (dep.multiple) {
|
|
120
|
+
if (!Array.isArray(cur)) return false
|
|
121
|
+
return Array.isArray(expected)
|
|
122
|
+
? expected.some((e) => cur.includes(e))
|
|
123
|
+
: cur.includes(expected)
|
|
124
|
+
}
|
|
125
|
+
return Array.isArray(expected) ? expected.includes(cur) : cur === expected
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
return show.disjonctive !== false
|
|
129
|
+
? show.switchIf.some(checkRule)
|
|
130
|
+
: show.switchIf.every(checkRule)
|
|
103
131
|
}
|
|
104
132
|
</script>
|
|
105
133
|
|
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.158",
|
|
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.17"
|
|
12
12
|
},
|
|
13
13
|
"description": "Paris IAS List Module",
|
|
14
14
|
"peerDependencies": {
|