@tekkare/auriga 0.2.216 → 0.2.218

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
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.0.0"
6
6
  },
7
- "version": "0.2.216"
7
+ "version": "0.2.218"
8
8
  }
@@ -94,13 +94,13 @@
94
94
  width="auto"
95
95
  height="500"
96
96
  :style="{ top: mapPosition.y + 'px', left: mapPosition.x + 'px' }"
97
- viewBox="0 0 1856 1502"
97
+ :viewBox="hideDromTom ? '200 0 1700 1500' : '0 0 1856 1502'"
98
98
  fill="none"
99
99
  xmlns="http://www.w3.org/2000/svg"
100
100
  @click="handleSVGClick"
101
101
  >
102
102
  <oneRegionToDepartements
103
- v-for="region in Regions"
103
+ v-for="region in filteredRegions"
104
104
  :key="region"
105
105
  :data="{
106
106
  color:
@@ -128,6 +128,7 @@
128
128
  />
129
129
  </svg>
130
130
  <svg
131
+ v-if="!hideDromTom"
131
132
  :class="
132
133
  clickedRegion !== null
133
134
  ? clickedRegion === Regions.NouvelleAquitaine
@@ -824,6 +825,15 @@ export default defineComponent({
824
825
  validator: (value) => {
825
826
  return ["en", "fr"].includes(value);
826
827
  }
828
+ },
829
+ initialRegion: {
830
+ type: String,
831
+ default: null,
832
+ required: false
833
+ },
834
+ hideDromTom: {
835
+ type: Boolean,
836
+ default: false
827
837
  }
828
838
  },
829
839
  emits: ["openSource"],
@@ -857,6 +867,20 @@ export default defineComponent({
857
867
  setLang();
858
868
  }
859
869
  );
870
+ const dromTomRegions = [Regions.Reunion, Regions.Martinique, Regions.Guyane, Regions.Guadeloupe, Regions.Mayotte];
871
+ const filteredRegions = computed(() => {
872
+ const allRegions = Object.values(Regions);
873
+ if (props.hideDromTom) {
874
+ return allRegions.filter((r) => !dromTomRegions.includes(r));
875
+ }
876
+ return allRegions;
877
+ });
878
+ function resolveRegion(name) {
879
+ const normalize = (s) => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
880
+ return Object.values(Regions).find(
881
+ (r) => normalize(r) === normalize(name)
882
+ ) || null;
883
+ }
860
884
  const RegionsData = computed(() => {
861
885
  const base = [];
862
886
  for (const region in Regions) {
@@ -872,36 +896,46 @@ export default defineComponent({
872
896
  return base;
873
897
  });
874
898
  function getMapPosition() {
899
+ const h = props.hideDromTom;
875
900
  switch (clickedRegion.value) {
876
901
  case Regions.AuvergneRhoneAlpes:
877
- mapPosition.value = { x: -400, y: -200 };
902
+ mapPosition.value = h ? { x: -250, y: -200 } : { x: -400, y: -200 };
878
903
  break;
879
904
  case Regions.BourgogneFrancheComte:
880
- mapPosition.value = { x: -400, y: 100 };
905
+ mapPosition.value = h ? { x: -300, y: 100 } : { x: -400, y: 100 };
881
906
  break;
882
907
  case Regions.Bretagne:
883
- mapPosition.value = { x: 400, y: 200 };
908
+ mapPosition.value = h ? { x: 500, y: 200 } : { x: 400, y: 200 };
909
+ break;
910
+ case Regions.CentreValDeLoire:
911
+ mapPosition.value = h ? { x: 0, y: 150 } : { x: 0, y: 150 };
912
+ break;
913
+ case Regions.Corse:
914
+ mapPosition.value = h ? { x: -800, y: -650 } : { x: -800, y: -650 };
915
+ break;
916
+ case Regions.GrandEst:
917
+ mapPosition.value = h ? { x: -400, y: 350 } : { x: -400, y: 250 };
884
918
  break;
885
919
  case Regions.HautDeFrance:
886
- mapPosition.value = { x: -50, y: 500 };
920
+ mapPosition.value = h ? { x: -50, y: 500 } : { x: -50, y: 500 };
887
921
  break;
888
922
  case Regions.IleDeFrance:
889
- mapPosition.value = { x: -250, y: 550 };
923
+ mapPosition.value = h ? { x: -50, y: 500 } : { x: -250, y: 550 };
890
924
  break;
891
925
  case Regions.Normandie:
892
- mapPosition.value = { x: 200, y: 400 };
926
+ mapPosition.value = h ? { x: 200, y: 400 } : { x: 100, y: 400 };
893
927
  break;
894
928
  case Regions.NouvelleAquitaine:
895
- mapPosition.value = { x: 80, y: -180 };
929
+ mapPosition.value = h ? { x: 80, y: -180 } : { x: 80, y: -180 };
896
930
  break;
897
931
  case Regions.Occitanie:
898
- mapPosition.value = { x: -50, y: -450 };
932
+ mapPosition.value = h ? { x: 0, y: -450 } : { x: -50, y: -350 };
899
933
  break;
900
934
  case Regions.PaysDeLaLoire:
901
- mapPosition.value = { x: 200, y: 100 };
935
+ mapPosition.value = h ? { x: 300, y: 100 } : { x: 200, y: 100 };
902
936
  break;
903
937
  case Regions.ProvenceAlpesCoteDazur:
904
- mapPosition.value = { x: -500, y: -400 };
938
+ mapPosition.value = h ? { x: -400, y: -400 } : { x: -500, y: -400 };
905
939
  break;
906
940
  case Regions.Guyane:
907
941
  mapPosition.value = { x: 800, y: 0 };
@@ -918,15 +952,6 @@ export default defineComponent({
918
952
  case Regions.Reunion:
919
953
  mapPosition.value = { x: 800, y: 700 };
920
954
  break;
921
- case Regions.CentreValDeLoire:
922
- mapPosition.value = { x: 0, y: 150 };
923
- break;
924
- case Regions.Corse:
925
- mapPosition.value = { x: -800, y: -650 };
926
- break;
927
- case Regions.GrandEst:
928
- mapPosition.value = { x: -500, y: 350 };
929
- break;
930
955
  default:
931
956
  mapPosition.value = { x: 0, y: 0 };
932
957
  break;
@@ -1032,7 +1057,28 @@ export default defineComponent({
1032
1057
  onMounted(() => {
1033
1058
  setupScale();
1034
1059
  setUpDepartementScale();
1060
+ if (props.initialRegion) {
1061
+ const match = resolveRegion(props.initialRegion);
1062
+ if (match) {
1063
+ clickedRegion.value = match;
1064
+ componentKey.value += 1;
1065
+ }
1066
+ }
1035
1067
  });
1068
+ watch(
1069
+ () => props.initialRegion,
1070
+ (newVal) => {
1071
+ if (newVal) {
1072
+ const match = resolveRegion(newVal);
1073
+ if (match) {
1074
+ clickedRegion.value = match;
1075
+ componentKey.value += 1;
1076
+ }
1077
+ } else {
1078
+ clickedRegion.value = null;
1079
+ }
1080
+ }
1081
+ );
1036
1082
  watch(
1037
1083
  () => props.data,
1038
1084
  () => {
@@ -1140,6 +1186,7 @@ export default defineComponent({
1140
1186
  mapPosition,
1141
1187
  componentKey,
1142
1188
  Regions,
1189
+ filteredRegions,
1143
1190
  getColor,
1144
1191
  regionsPath,
1145
1192
  getReturnText,
@@ -34,6 +34,15 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
34
34
  required: false;
35
35
  validator: (value: string) => boolean;
36
36
  };
37
+ initialRegion: {
38
+ type: PropType<string | null>;
39
+ default: null;
40
+ required: false;
41
+ };
42
+ hideDromTom: {
43
+ type: BooleanConstructor;
44
+ default: boolean;
45
+ };
37
46
  }>, {
38
47
  dptScale: import("vue").Ref<number[], number[]>;
39
48
  scale: import("vue").Ref<number[], number[]>;
@@ -75,6 +84,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
75
84
  }>;
76
85
  componentKey: import("vue").Ref<number, number>;
77
86
  Regions: typeof Regions;
87
+ filteredRegions: import("vue").ComputedRef<Regions[]>;
78
88
  getColor: (value?: number) => "var(--lightest)" | "#3F1151" | "#432974" | "#404A85" | "#3F668A" | "#43808C" | "#4C9C8A" | "#5FB57E" | "#85CB68" | "#BDDD51" | "#F9E855" | undefined;
79
89
  regionsPath: any;
80
90
  getReturnText: import("vue").ComputedRef<any>;
@@ -109,6 +119,15 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
109
119
  required: false;
110
120
  validator: (value: string) => boolean;
111
121
  };
122
+ initialRegion: {
123
+ type: PropType<string | null>;
124
+ default: null;
125
+ required: false;
126
+ };
127
+ hideDromTom: {
128
+ type: BooleanConstructor;
129
+ default: boolean;
130
+ };
112
131
  }>> & Readonly<{
113
132
  onOpenSource?: ((...args: any[]) => any) | undefined;
114
133
  }>, {
@@ -117,7 +136,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
117
136
  source: string;
118
137
  title: string;
119
138
  haveCustomTitle: boolean;
139
+ hideDromTom: boolean;
120
140
  withDynamicTitle: boolean;
141
+ initialRegion: string | null;
121
142
  }, {}, {
122
143
  oneRegionToDepartements: any;
123
144
  ArgSourceContainer: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/auriga",
3
- "version": "0.2.216",
3
+ "version": "0.2.218",
4
4
  "description": "Aurgia is a UI kit developped by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",