@tekkare/auriga 0.1.168 → 0.1.170
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/argDropdownBtn.vue +1 -1
- package/dist/runtime/components/argDropdownSelect.vue +17 -5
- package/dist/runtime/components/argDropdownSelect.vue.d.ts +18 -0
- package/dist/runtime/components/argMapsFrDepartements.vue +198 -0
- package/dist/runtime/components/argMapsFrDepartements.vue.d.ts +57 -0
- package/dist/runtime/components/argMapsFrRegions.vue +216 -0
- package/dist/runtime/components/argMapsFrRegions.vue.d.ts +57 -0
- package/dist/runtime/components/argStyle.vue +1 -1
- package/dist/runtime/components/argTextHighlight.vue +266 -0
- package/dist/runtime/components/argTextHighlight.vue.d.ts +113 -0
- package/dist/runtime/components/mapsFr/departementsPath.json +407 -0
- package/dist/runtime/components/mapsFr/interfaces.d.ts +123 -0
- package/dist/runtime/components/mapsFr/interfaces.mjs +125 -0
- package/dist/runtime/components/mapsFr/regionsPath.json +164 -0
- package/dist/runtime/components/oneDepartementFr.vue +64 -0
- package/dist/runtime/components/oneDepartementFr.vue.d.ts +54 -0
- package/dist/runtime/components/oneRegionFr.vue +62 -0
- package/dist/runtime/components/oneRegionFr.vue.d.ts +54 -0
- package/package.json +3 -1
package/dist/module.json
CHANGED
|
@@ -57,5 +57,5 @@ export default defineComponent({
|
|
|
57
57
|
</script>
|
|
58
58
|
|
|
59
59
|
<style scoped>
|
|
60
|
-
.arg_select_dropdown_block{background:var(--demi-fond);border:1.5px solid var(--light);border-radius:12px;box-shadow:var(--overlay-shadow);display:flex;flex-direction:column;margin-top:15px;padding:16px;position:absolute;width:-moz-max-content;width:max-content;z-index:99!important}.arg_change_display{position:relative}.my-4{margin:4px 0}.full_width{width:100%}
|
|
60
|
+
.arg_select_dropdown_block{background:var(--demi-fond);border:1.5px solid var(--light);border-radius:12px;box-shadow:var(--overlay-shadow);display:flex;flex-direction:column;margin-top:15px;padding:16px;position:absolute;right:0;width:-moz-max-content;width:max-content;z-index:99!important}.arg_change_display{position:relative;width:-moz-fit-content;width:fit-content}.my-4{margin:4px 0}.full_width{width:100%}
|
|
61
61
|
</style>
|
|
@@ -130,6 +130,7 @@ import {
|
|
|
130
130
|
onUnmounted,
|
|
131
131
|
onUpdated
|
|
132
132
|
} from "vue";
|
|
133
|
+
import { useFuse } from "@vueuse/integrations/useFuse";
|
|
133
134
|
export default defineComponent({
|
|
134
135
|
name: "argDropdownSelect",
|
|
135
136
|
components: { argIcon, argTooltip, argSimpleLabel, argDataLoader },
|
|
@@ -159,7 +160,9 @@ export default defineComponent({
|
|
|
159
160
|
loader_text: { type: Array, default: null },
|
|
160
161
|
empty_content_msg: { type: String, default: null },
|
|
161
162
|
is_sort: { type: Boolean, default: false },
|
|
162
|
-
categories: { type: Array, default: null }
|
|
163
|
+
categories: { type: Array, default: null },
|
|
164
|
+
fuzzySearch: { type: Boolean, default: false },
|
|
165
|
+
fuzzyThreshold: { type: Number, default: 0.5 }
|
|
163
166
|
},
|
|
164
167
|
emits: ["changeElement", "update:Selection", "changeInputValue"],
|
|
165
168
|
setup(props, { emit }) {
|
|
@@ -298,23 +301,32 @@ export default defineComponent({
|
|
|
298
301
|
}
|
|
299
302
|
function checkIfContainsValue(element, searchArray) {
|
|
300
303
|
let hasValue = false;
|
|
301
|
-
|
|
304
|
+
searchArray = searchArray.filter((a) => a.length > 0);
|
|
305
|
+
if (searchArray.every(
|
|
306
|
+
(l) => props.fuzzySearch ? useFuse(l, table_values.value, options.value).results.value.map((a) => a.item).includes(element) : element.toLowerCase().includes(l)
|
|
307
|
+
)) {
|
|
302
308
|
hasValue = true;
|
|
303
309
|
}
|
|
304
310
|
return hasValue;
|
|
305
311
|
}
|
|
312
|
+
const options = computed(() => ({
|
|
313
|
+
fuseOptions: {
|
|
314
|
+
includeScore: true,
|
|
315
|
+
threshold: props.fuzzyThreshold
|
|
316
|
+
}
|
|
317
|
+
}));
|
|
306
318
|
const filterName = computed(() => {
|
|
307
|
-
if (searchName.value !== null) {
|
|
319
|
+
if (searchName.value !== null && searchName.value.length > 0) {
|
|
308
320
|
if (searchName.value.includes(" ")) {
|
|
309
321
|
return table_values.value.filter(
|
|
310
322
|
(element) => checkIfContainsValue(
|
|
311
|
-
element
|
|
323
|
+
element,
|
|
312
324
|
searchName.value.toLowerCase().split(" ")
|
|
313
325
|
)
|
|
314
326
|
);
|
|
315
327
|
} else
|
|
316
328
|
return table_values.value.filter(
|
|
317
|
-
(element) => element.toLowerCase().includes(searchName.value.toLowerCase())
|
|
329
|
+
(element) => props.fuzzySearch ? useFuse(searchName, table_values.value, options.value).results.value.map((a) => a.item).includes(element) : element.toLowerCase().includes(searchName.value.toLowerCase())
|
|
318
330
|
);
|
|
319
331
|
}
|
|
320
332
|
return table_values.value;
|
|
@@ -95,6 +95,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
95
95
|
type: ArrayConstructor;
|
|
96
96
|
default: null;
|
|
97
97
|
};
|
|
98
|
+
fuzzySearch: {
|
|
99
|
+
type: BooleanConstructor;
|
|
100
|
+
default: boolean;
|
|
101
|
+
};
|
|
102
|
+
fuzzyThreshold: {
|
|
103
|
+
type: NumberConstructor;
|
|
104
|
+
default: number;
|
|
105
|
+
};
|
|
98
106
|
}, {
|
|
99
107
|
isDisplay: import("vue").Ref<boolean>;
|
|
100
108
|
searchName: import("vue").Ref<string>;
|
|
@@ -211,6 +219,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
211
219
|
type: ArrayConstructor;
|
|
212
220
|
default: null;
|
|
213
221
|
};
|
|
222
|
+
fuzzySearch: {
|
|
223
|
+
type: BooleanConstructor;
|
|
224
|
+
default: boolean;
|
|
225
|
+
};
|
|
226
|
+
fuzzyThreshold: {
|
|
227
|
+
type: NumberConstructor;
|
|
228
|
+
default: number;
|
|
229
|
+
};
|
|
214
230
|
}>> & {
|
|
215
231
|
onChangeElement?: ((...args: any[]) => any) | undefined;
|
|
216
232
|
"onUpdate:Selection"?: ((...args: any[]) => any) | undefined;
|
|
@@ -231,5 +247,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
231
247
|
watch_default_change: boolean;
|
|
232
248
|
values_disabled: unknown[];
|
|
233
249
|
is_sort: boolean;
|
|
250
|
+
fuzzySearch: boolean;
|
|
251
|
+
fuzzyThreshold: number;
|
|
234
252
|
}, {}>;
|
|
235
253
|
export default _default;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :id="`container_map-${title}`" class="oip_table_card map_card-container">
|
|
3
|
+
<div class="p-24">
|
|
4
|
+
<div class="oip_subtitle">
|
|
5
|
+
{{ title ? title : "Your map title" }}
|
|
6
|
+
</div>
|
|
7
|
+
<ArgSourceContainer @click="openSource">
|
|
8
|
+
{{ source ? source : "Your source" }}
|
|
9
|
+
</ArgSourceContainer>
|
|
10
|
+
</div>
|
|
11
|
+
<div
|
|
12
|
+
v-if="hoveredDepartement !== null"
|
|
13
|
+
:id="`tooltip_map-${title}`"
|
|
14
|
+
class="tooltip_container"
|
|
15
|
+
:style="{
|
|
16
|
+
top: tooltipPosition.y + 'px',
|
|
17
|
+
left: tooltipPosition.x + 'px',
|
|
18
|
+
width: tooltipPosition.width + 'px',
|
|
19
|
+
}"
|
|
20
|
+
>
|
|
21
|
+
<div class="tooltip">
|
|
22
|
+
<p class="card_title">{{ hoveredDepartement }}</p>
|
|
23
|
+
<div class="card_text">
|
|
24
|
+
<slot
|
|
25
|
+
name="Tooltip"
|
|
26
|
+
v-bind:value="{
|
|
27
|
+
name: hoveredDepartement,
|
|
28
|
+
value: data.find((x) => x.name == hoveredDepartement)?.value,
|
|
29
|
+
}"
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="p24">
|
|
35
|
+
<svg
|
|
36
|
+
class="map"
|
|
37
|
+
width="auto"
|
|
38
|
+
height="500"
|
|
39
|
+
viewBox="0 0 1856 1502"
|
|
40
|
+
fill="none"
|
|
41
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
42
|
+
>
|
|
43
|
+
<oneDepartementFr
|
|
44
|
+
v-for="departement in Departements"
|
|
45
|
+
:key="departement"
|
|
46
|
+
:data="{
|
|
47
|
+
color: getColor(data.find((x) => x.name == departement)?.value),
|
|
48
|
+
value: data.find((x) => x.name == departement)?.value,
|
|
49
|
+
}"
|
|
50
|
+
:current-departement="departement"
|
|
51
|
+
:title="title"
|
|
52
|
+
:hoveredDepartement="hoveredDepartement"
|
|
53
|
+
@hover="handleHover(departement)"
|
|
54
|
+
@mouseleave="handleMouseLeave"
|
|
55
|
+
/>
|
|
56
|
+
</svg>
|
|
57
|
+
<div class="legend">
|
|
58
|
+
<div class="scale" />
|
|
59
|
+
<div class="legend-text">
|
|
60
|
+
<p v-for="value in scale" :key="value">
|
|
61
|
+
{{ Math.ceil(value) }}
|
|
62
|
+
</p>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
<slot name="Subcontent" />
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<script>
|
|
71
|
+
import { onMounted, ref, watch, nextTick, defineComponent } from "vue";
|
|
72
|
+
import { Departements } from "./mapsFr/interfaces";
|
|
73
|
+
import oneDepartementFr from "./oneDepartementFr.vue";
|
|
74
|
+
import ArgSourceContainer from "./argSourceContainer.vue";
|
|
75
|
+
export default defineComponent({
|
|
76
|
+
name: "argMapsFrDepartements",
|
|
77
|
+
components: { oneDepartementFr, ArgSourceContainer },
|
|
78
|
+
props: {
|
|
79
|
+
data: {
|
|
80
|
+
type: Array,
|
|
81
|
+
default: null,
|
|
82
|
+
required: true
|
|
83
|
+
},
|
|
84
|
+
title: {
|
|
85
|
+
type: [String, null],
|
|
86
|
+
default: null,
|
|
87
|
+
required: false
|
|
88
|
+
},
|
|
89
|
+
source: {
|
|
90
|
+
type: [String, null],
|
|
91
|
+
default: null
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
emits: ["openSource"],
|
|
95
|
+
setup(props, { emit }) {
|
|
96
|
+
const minimalValue = ref(null);
|
|
97
|
+
const maximalValue = ref(null);
|
|
98
|
+
const hoveredDepartement = ref(null);
|
|
99
|
+
const tooltipPosition = ref({ x: 0, y: 0, width: 0 });
|
|
100
|
+
const scale = ref([]);
|
|
101
|
+
function getColor(value) {
|
|
102
|
+
if (!value)
|
|
103
|
+
return "var(--lightest)";
|
|
104
|
+
if (value >= scale.value[9]) {
|
|
105
|
+
return "#3F1151";
|
|
106
|
+
} else if (value >= scale.value[8]) {
|
|
107
|
+
return "#432974";
|
|
108
|
+
} else if (value >= scale.value[7]) {
|
|
109
|
+
return "#404A85";
|
|
110
|
+
} else if (value >= scale.value[6]) {
|
|
111
|
+
return "#3F668A";
|
|
112
|
+
} else if (value >= scale.value[5]) {
|
|
113
|
+
return "#43808C";
|
|
114
|
+
} else if (value >= scale.value[4]) {
|
|
115
|
+
return "#4C9C8A";
|
|
116
|
+
} else if (value >= scale.value[3]) {
|
|
117
|
+
return "#5FB57E";
|
|
118
|
+
} else if (value >= scale.value[2]) {
|
|
119
|
+
return "#85CB68";
|
|
120
|
+
} else if (value >= scale.value[1]) {
|
|
121
|
+
return "#BDDD51";
|
|
122
|
+
} else if (value >= scale.value[0]) {
|
|
123
|
+
return "#F9E855";
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function handleHover(dept) {
|
|
127
|
+
hoveredDepartement.value = dept;
|
|
128
|
+
}
|
|
129
|
+
function handleMouseLeave() {
|
|
130
|
+
hoveredDepartement.value = null;
|
|
131
|
+
}
|
|
132
|
+
function setupScale() {
|
|
133
|
+
minimalValue.value = Math.floor(
|
|
134
|
+
Math.min(...props.data.map((x) => x.value))
|
|
135
|
+
);
|
|
136
|
+
maximalValue.value = Math.ceil(
|
|
137
|
+
Math.max(...props.data.map((x) => x.value))
|
|
138
|
+
);
|
|
139
|
+
const step = (maximalValue.value - minimalValue.value) / 10;
|
|
140
|
+
if (minimalValue.value !== null) {
|
|
141
|
+
scale.value = Array.from(
|
|
142
|
+
{ length: 10 },
|
|
143
|
+
(_, i) => (minimalValue.value !== null ? minimalValue.value : 0) + i * step
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function openSource() {
|
|
148
|
+
emit("openSource");
|
|
149
|
+
}
|
|
150
|
+
onMounted(() => {
|
|
151
|
+
setupScale();
|
|
152
|
+
});
|
|
153
|
+
watch(
|
|
154
|
+
() => props.data,
|
|
155
|
+
() => {
|
|
156
|
+
setupScale();
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
watch(
|
|
160
|
+
() => hoveredDepartement.value,
|
|
161
|
+
async () => {
|
|
162
|
+
if (hoveredDepartement.value) {
|
|
163
|
+
await nextTick();
|
|
164
|
+
const selectedRegion = document.getElementById(
|
|
165
|
+
`interactiveMap-${props.title}-${hoveredDepartement.value}`
|
|
166
|
+
)?.getBoundingClientRect();
|
|
167
|
+
const containerPosition = document.getElementById(`container_map-${props.title}`)?.getBoundingClientRect();
|
|
168
|
+
const tooltipElement = document.getElementById(
|
|
169
|
+
`tooltip_map-${props.title}`
|
|
170
|
+
);
|
|
171
|
+
const tooltipHeight = tooltipElement ? tooltipElement.getBoundingClientRect().height : 60;
|
|
172
|
+
if (!selectedRegion || !containerPosition)
|
|
173
|
+
return;
|
|
174
|
+
tooltipPosition.value = {
|
|
175
|
+
x: selectedRegion?.x - containerPosition?.x,
|
|
176
|
+
y: selectedRegion?.top - containerPosition?.top - tooltipHeight,
|
|
177
|
+
width: selectedRegion?.width
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
return {
|
|
183
|
+
getColor,
|
|
184
|
+
handleHover,
|
|
185
|
+
handleMouseLeave,
|
|
186
|
+
Departements,
|
|
187
|
+
hoveredDepartement,
|
|
188
|
+
tooltipPosition,
|
|
189
|
+
scale,
|
|
190
|
+
openSource
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
</script>
|
|
195
|
+
|
|
196
|
+
<style scoped>
|
|
197
|
+
.map{margin-top:24px}.p24{padding:24px}.p-24{padding:0 24px}.map path{stroke-width:2px;stroke:rgba(0,0,0,.2);max-height:400px;position:relative}.map path:hover{transition:all .2s}.map_card-container{display:flex;flex-direction:column;gap:8px;min-width:400px;position:relative;width:100%}.test{margin-bottom:200px}.tooltip_container{align-items:center;display:flex;flex-direction:column;justify-content:center;left:0;min-width:-moz-fit-content;min-width:fit-content;position:absolute;top:0;z-index:96}.tooltip{background:#fff;border:1px solid var(--light);border-radius:4px;box-shadow:var(--medium-shadow);color:var(--darkest);font-size:12px}.card_title{background-color:var(--light);border-radius:4px 4px 0 0;font-size:14px;font-weight:600;padding:2px 8px;width:calc(100% - 15px)}.card_text{color:var(--dark);font-size:12px;font-weight:400;line-height:160%;padding:8px;width:100%}.legend{display:flex;flex-direction:column;gap:8px;margin:auto;width:50%}.scale{background:linear-gradient(45deg,#3f1151,#432974,#404a85,#3f668a,#43808c,#4c9c8a,#5fb57e,#85cb68,#bddd51,#f9e855);height:10px;transform:rotate(180deg)}.legend-text{align-items:center;color:var(--dark);display:flex;font-size:12px;font-weight:400;justify-content:space-between;line-height:160%}
|
|
198
|
+
</style>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { PropType } from "vue";
|
|
2
|
+
import { Departements } from "./mapsFr/interfaces";
|
|
3
|
+
type Data = {
|
|
4
|
+
name: Departements;
|
|
5
|
+
value: number;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<{
|
|
8
|
+
data: {
|
|
9
|
+
type: PropType<Data[]>;
|
|
10
|
+
default: null;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
title: {
|
|
14
|
+
type: PropType<string | null>;
|
|
15
|
+
default: null;
|
|
16
|
+
required: false;
|
|
17
|
+
};
|
|
18
|
+
source: {
|
|
19
|
+
type: PropType<string | null>;
|
|
20
|
+
default: null;
|
|
21
|
+
};
|
|
22
|
+
}, {
|
|
23
|
+
getColor: (value?: number) => "var(--lightest)" | "#3F1151" | "#432974" | "#404A85" | "#3F668A" | "#43808C" | "#4C9C8A" | "#5FB57E" | "#85CB68" | "#BDDD51" | "#F9E855" | undefined;
|
|
24
|
+
handleHover: (dept: Departements) => void;
|
|
25
|
+
handleMouseLeave: () => void;
|
|
26
|
+
Departements: typeof Departements;
|
|
27
|
+
hoveredDepartement: import("vue").Ref<Departements | null>;
|
|
28
|
+
tooltipPosition: import("vue").Ref<{
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
width: number;
|
|
32
|
+
}>;
|
|
33
|
+
scale: import("vue").Ref<number[]>;
|
|
34
|
+
openSource: () => void;
|
|
35
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "openSource"[], "openSource", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
36
|
+
data: {
|
|
37
|
+
type: PropType<Data[]>;
|
|
38
|
+
default: null;
|
|
39
|
+
required: true;
|
|
40
|
+
};
|
|
41
|
+
title: {
|
|
42
|
+
type: PropType<string | null>;
|
|
43
|
+
default: null;
|
|
44
|
+
required: false;
|
|
45
|
+
};
|
|
46
|
+
source: {
|
|
47
|
+
type: PropType<string | null>;
|
|
48
|
+
default: null;
|
|
49
|
+
};
|
|
50
|
+
}>> & {
|
|
51
|
+
onOpenSource?: ((...args: any[]) => any) | undefined;
|
|
52
|
+
}, {
|
|
53
|
+
data: Data[];
|
|
54
|
+
title: string | null;
|
|
55
|
+
source: string | null;
|
|
56
|
+
}, {}>;
|
|
57
|
+
export default _default;
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="oip_table_card map_card-container" :id="`container_map-${title}`">
|
|
3
|
+
<div class="p-24">
|
|
4
|
+
<div class="oip_subtitle">
|
|
5
|
+
{{ title ? title : "Your map title" }}
|
|
6
|
+
</div>
|
|
7
|
+
<ArgSourceContainer @click="openSource">
|
|
8
|
+
{{ source ? source : "Your source" }}
|
|
9
|
+
</ArgSourceContainer>
|
|
10
|
+
</div>
|
|
11
|
+
<div
|
|
12
|
+
v-if="hoveredRegion !== null"
|
|
13
|
+
:id="`tooltip_map-${title}`"
|
|
14
|
+
class="tooltip_container"
|
|
15
|
+
:style="{
|
|
16
|
+
top: tooltipPosition.y + 'px',
|
|
17
|
+
left: tooltipPosition.x + 'px',
|
|
18
|
+
width: tooltipPosition.width + 'px',
|
|
19
|
+
}"
|
|
20
|
+
>
|
|
21
|
+
<div class="tooltip">
|
|
22
|
+
<p class="card_title">{{ hoveredRegion }}</p>
|
|
23
|
+
<div class="card_text">
|
|
24
|
+
<slot
|
|
25
|
+
name="Tooltip"
|
|
26
|
+
v-bind:value="{
|
|
27
|
+
name: hoveredRegion,
|
|
28
|
+
value: data.find((x) => x.name == hoveredRegion)?.value,
|
|
29
|
+
}"
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="p24">
|
|
35
|
+
<svg
|
|
36
|
+
class="map"
|
|
37
|
+
width="auto"
|
|
38
|
+
height="500"
|
|
39
|
+
viewBox="0 0 1856 1502"
|
|
40
|
+
fill="none"
|
|
41
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
42
|
+
>
|
|
43
|
+
<oneRegionFr
|
|
44
|
+
v-for="region in Regions"
|
|
45
|
+
:key="region"
|
|
46
|
+
:data="{
|
|
47
|
+
color: getColor(data.find((x) => x.name == region)?.value),
|
|
48
|
+
value: data.find((x) => x.name == region)?.value,
|
|
49
|
+
}"
|
|
50
|
+
:current-region="region"
|
|
51
|
+
:title="title"
|
|
52
|
+
:hoveredRegion="hoveredRegion"
|
|
53
|
+
@hover="handleHover(region)"
|
|
54
|
+
@mouseleave="handleMouseLeave"
|
|
55
|
+
/>
|
|
56
|
+
</svg>
|
|
57
|
+
<div class="legend">
|
|
58
|
+
<div class="scale" />
|
|
59
|
+
<div class="legend-text">
|
|
60
|
+
<p v-for="value in scale" :key="value">
|
|
61
|
+
{{ Math.ceil(value) }}
|
|
62
|
+
</p>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
<slot name="Subcontent" />
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<script>
|
|
71
|
+
import { onMounted, ref, watch, defineComponent, nextTick } from "vue";
|
|
72
|
+
import { Regions } from "./mapsFr/interfaces";
|
|
73
|
+
import oneRegionFr from "./oneRegionFr.vue";
|
|
74
|
+
import ArgSourceContainer from "./argSourceContainer.vue";
|
|
75
|
+
export default defineComponent({
|
|
76
|
+
name: "argMapsFrRegions",
|
|
77
|
+
components: { oneRegionFr, ArgSourceContainer },
|
|
78
|
+
props: {
|
|
79
|
+
data: {
|
|
80
|
+
type: Array,
|
|
81
|
+
default: null,
|
|
82
|
+
required: true
|
|
83
|
+
},
|
|
84
|
+
title: {
|
|
85
|
+
type: [String, null],
|
|
86
|
+
default: null,
|
|
87
|
+
required: false
|
|
88
|
+
},
|
|
89
|
+
source: {
|
|
90
|
+
type: [String, null],
|
|
91
|
+
default: null
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
emits: ["openSource"],
|
|
95
|
+
setup(props, { emit }) {
|
|
96
|
+
const minimalValue = ref(null);
|
|
97
|
+
const maximalValue = ref(null);
|
|
98
|
+
const hoveredRegion = ref(null);
|
|
99
|
+
const tooltipPosition = ref({ x: 0, y: 0, width: 0 });
|
|
100
|
+
const scale = ref([]);
|
|
101
|
+
function getColor(value) {
|
|
102
|
+
if (!value)
|
|
103
|
+
return "var(--lightest)";
|
|
104
|
+
if (value >= scale.value[9]) {
|
|
105
|
+
return "#3F1151";
|
|
106
|
+
} else if (value >= scale.value[8]) {
|
|
107
|
+
return "#432974";
|
|
108
|
+
} else if (value >= scale.value[7]) {
|
|
109
|
+
return "#404A85";
|
|
110
|
+
} else if (value >= scale.value[6]) {
|
|
111
|
+
return "#3F668A";
|
|
112
|
+
} else if (value >= scale.value[5]) {
|
|
113
|
+
return "#43808C";
|
|
114
|
+
} else if (value >= scale.value[4]) {
|
|
115
|
+
return "#4C9C8A";
|
|
116
|
+
} else if (value >= scale.value[3]) {
|
|
117
|
+
return "#5FB57E";
|
|
118
|
+
} else if (value >= scale.value[2]) {
|
|
119
|
+
return "#85CB68";
|
|
120
|
+
} else if (value >= scale.value[1]) {
|
|
121
|
+
return "#BDDD51";
|
|
122
|
+
} else if (value >= scale.value[0]) {
|
|
123
|
+
return "#F9E855";
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function handleHover(region) {
|
|
127
|
+
hoveredRegion.value = region;
|
|
128
|
+
}
|
|
129
|
+
function handleMouseLeave() {
|
|
130
|
+
hoveredRegion.value = null;
|
|
131
|
+
}
|
|
132
|
+
function openSource() {
|
|
133
|
+
emit("openSource");
|
|
134
|
+
}
|
|
135
|
+
function setupScale() {
|
|
136
|
+
minimalValue.value = Math.floor(
|
|
137
|
+
Math.min(...props.data.map((x) => x.value))
|
|
138
|
+
);
|
|
139
|
+
maximalValue.value = Math.ceil(
|
|
140
|
+
Math.max(...props.data.map((x) => x.value))
|
|
141
|
+
);
|
|
142
|
+
const step = (maximalValue.value - minimalValue.value) / 10;
|
|
143
|
+
if (minimalValue.value !== null) {
|
|
144
|
+
scale.value = Array.from(
|
|
145
|
+
{ length: 10 },
|
|
146
|
+
(_, i) => (minimalValue.value !== null ? minimalValue.value : 0) + i * step
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
onMounted(() => {
|
|
151
|
+
setupScale();
|
|
152
|
+
});
|
|
153
|
+
watch(
|
|
154
|
+
() => props.data,
|
|
155
|
+
() => {
|
|
156
|
+
setupScale();
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
watch(
|
|
160
|
+
() => hoveredRegion.value,
|
|
161
|
+
() => {
|
|
162
|
+
if (hoveredRegion.value) {
|
|
163
|
+
const selectedRegion = document.getElementById(
|
|
164
|
+
`interactiveMap-${props.title}-${hoveredRegion.value}`
|
|
165
|
+
)?.getBoundingClientRect();
|
|
166
|
+
const containerPosition = document.getElementById(`container_map-${props.title}`)?.getBoundingClientRect();
|
|
167
|
+
if (!selectedRegion || !containerPosition)
|
|
168
|
+
return;
|
|
169
|
+
tooltipPosition.value = {
|
|
170
|
+
x: selectedRegion?.x - containerPosition?.x,
|
|
171
|
+
y: selectedRegion?.top - containerPosition?.top - 60,
|
|
172
|
+
width: selectedRegion?.width
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
watch(
|
|
178
|
+
() => hoveredRegion.value,
|
|
179
|
+
async () => {
|
|
180
|
+
if (hoveredRegion.value) {
|
|
181
|
+
await nextTick();
|
|
182
|
+
const selectedRegion = document.getElementById(
|
|
183
|
+
`interactiveMap-${props.title}-${hoveredRegion.value}`
|
|
184
|
+
)?.getBoundingClientRect();
|
|
185
|
+
const containerPosition = document.getElementById(`container_map-${props.title}`)?.getBoundingClientRect();
|
|
186
|
+
const tooltipElement = document.getElementById(
|
|
187
|
+
`tooltip_map-${props.title}`
|
|
188
|
+
);
|
|
189
|
+
const tooltipHeight = tooltipElement ? tooltipElement.getBoundingClientRect().height : 60;
|
|
190
|
+
if (!selectedRegion || !containerPosition)
|
|
191
|
+
return;
|
|
192
|
+
tooltipPosition.value = {
|
|
193
|
+
x: selectedRegion?.x - containerPosition?.x,
|
|
194
|
+
y: selectedRegion?.top - containerPosition?.top - tooltipHeight,
|
|
195
|
+
width: selectedRegion?.width
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
return {
|
|
201
|
+
getColor,
|
|
202
|
+
handleHover,
|
|
203
|
+
handleMouseLeave,
|
|
204
|
+
Regions,
|
|
205
|
+
hoveredRegion,
|
|
206
|
+
tooltipPosition,
|
|
207
|
+
scale,
|
|
208
|
+
openSource
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
</script>
|
|
213
|
+
|
|
214
|
+
<style scoped>
|
|
215
|
+
.map{margin-top:24px}.p24{padding:24px}.map path{stroke-width:2px;stroke:rgba(0,0,0,.2);max-height:400px;position:relative}.map path:hover{transition:all .2s}.map_card-container{display:flex;flex-direction:column;gap:8px;min-width:400px;position:relative;width:100%}.test{margin-bottom:200px}.tooltip_container{align-items:center;display:flex;flex-direction:column;justify-content:center;left:0;min-width:-moz-fit-content;min-width:fit-content;position:absolute;top:0;z-index:96}.tooltip{background:#fff;border:1px solid var(--light);border-radius:4px;box-shadow:var(--medium-shadow);color:var(--darkest);font-size:12px}.card_title{background-color:var(--light);border-radius:4px 4px 0 0;font-size:14px;font-weight:600;padding:2px 8px;width:calc(100% - 15px)}.card_text{color:var(--dark);font-size:12px;font-weight:400;line-height:160%;padding:8px;width:100%}.legend{display:flex;flex-direction:column;gap:8px;margin:auto;width:50%}.scale{background:linear-gradient(45deg,#3f1151,#432974,#404a85,#3f668a,#43808c,#4c9c8a,#5fb57e,#85cb68,#bddd51,#f9e855);height:10px;transform:rotate(180deg)}.legend-text{align-items:center;color:var(--dark);display:flex;font-size:12px;font-weight:400;justify-content:space-between;line-height:160%}.p-24{padding:0 24px}
|
|
216
|
+
</style>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { PropType } from "vue";
|
|
2
|
+
import { Regions } from "./mapsFr/interfaces";
|
|
3
|
+
type dataRegion = {
|
|
4
|
+
name: Regions;
|
|
5
|
+
value: number;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<{
|
|
8
|
+
data: {
|
|
9
|
+
type: PropType<dataRegion[]>;
|
|
10
|
+
default: null;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
title: {
|
|
14
|
+
type: PropType<string | null>;
|
|
15
|
+
default: null;
|
|
16
|
+
required: false;
|
|
17
|
+
};
|
|
18
|
+
source: {
|
|
19
|
+
type: PropType<string | null>;
|
|
20
|
+
default: null;
|
|
21
|
+
};
|
|
22
|
+
}, {
|
|
23
|
+
getColor: (value?: number) => "var(--lightest)" | "#3F1151" | "#432974" | "#404A85" | "#3F668A" | "#43808C" | "#4C9C8A" | "#5FB57E" | "#85CB68" | "#BDDD51" | "#F9E855" | undefined;
|
|
24
|
+
handleHover: (region: Regions) => void;
|
|
25
|
+
handleMouseLeave: () => void;
|
|
26
|
+
Regions: typeof Regions;
|
|
27
|
+
hoveredRegion: import("vue").Ref<Regions | null>;
|
|
28
|
+
tooltipPosition: import("vue").Ref<{
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
width: number;
|
|
32
|
+
}>;
|
|
33
|
+
scale: import("vue").Ref<number[]>;
|
|
34
|
+
openSource: () => void;
|
|
35
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "openSource"[], "openSource", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
36
|
+
data: {
|
|
37
|
+
type: PropType<dataRegion[]>;
|
|
38
|
+
default: null;
|
|
39
|
+
required: true;
|
|
40
|
+
};
|
|
41
|
+
title: {
|
|
42
|
+
type: PropType<string | null>;
|
|
43
|
+
default: null;
|
|
44
|
+
required: false;
|
|
45
|
+
};
|
|
46
|
+
source: {
|
|
47
|
+
type: PropType<string | null>;
|
|
48
|
+
default: null;
|
|
49
|
+
};
|
|
50
|
+
}>> & {
|
|
51
|
+
onOpenSource?: ((...args: any[]) => any) | undefined;
|
|
52
|
+
}, {
|
|
53
|
+
data: dataRegion[];
|
|
54
|
+
title: string | null;
|
|
55
|
+
source: string | null;
|
|
56
|
+
}, {}>;
|
|
57
|
+
export default _default;
|