@tekkare/auriga 0.2.50 → 0.2.51

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.50"
7
+ "version": "0.2.51"
8
8
  }
@@ -2,7 +2,15 @@
2
2
  <div>
3
3
  <!-- Simple select -->
4
4
  <div class="oip_select_display">
5
- <p class="oip_filter_label">{{ dropdown_label }}</p>
5
+ <p
6
+ class="oip_filter_label"
7
+ :class="labelInfo ? 'oip_row v-center gap-4' : ''"
8
+ >
9
+ {{ dropdown_label }}
10
+ <span v-if="labelInfo" @click="openInfo" class="open-info">
11
+ <arg-icon name="Info" size="14" color="var(--medium)"
12
+ /></span>
13
+ </p>
6
14
  <arg-simple-label
7
15
  :disabled="disabled"
8
16
  @click="changeDisplay()"
@@ -174,9 +182,10 @@ export default defineComponent({
174
182
  categories: { type: Array, default: null },
175
183
  fuzzySearch: { type: Boolean, default: false },
176
184
  fuzzyThreshold: { type: Number, default: 0.5 },
177
- filterSearch: { type: Boolean, default: true }
185
+ filterSearch: { type: Boolean, default: true },
186
+ labelInfo: { type: Boolean, default: false }
178
187
  },
179
- emits: ["changeElement", "update:Selection", "changeInputValue"],
188
+ emits: ["changeElement", "update:Selection", "changeInputValue", "openInfo"],
180
189
  setup(props, { emit }) {
181
190
  const isDisplay = ref(false);
182
191
  const searchName = ref("");
@@ -205,6 +214,9 @@ export default defineComponent({
205
214
  setLang();
206
215
  }
207
216
  );
217
+ function openInfo() {
218
+ emit("openInfo");
219
+ }
208
220
  onMounted(() => {
209
221
  table_values.value = props.element_table;
210
222
  selected_item.value = props.default_select !== null ? props.element_table[props.default_select] : null;
@@ -410,7 +422,8 @@ export default defineComponent({
410
422
  getLoaderText,
411
423
  getPlaceholder,
412
424
  getEmptyContentMsg,
413
- getSepPositions
425
+ getSepPositions,
426
+ openInfo
414
427
  };
415
428
  }
416
429
  });
@@ -107,6 +107,10 @@ declare const _default: import("vue").DefineComponent<{
107
107
  type: BooleanConstructor;
108
108
  default: boolean;
109
109
  };
110
+ labelInfo: {
111
+ type: BooleanConstructor;
112
+ default: boolean;
113
+ };
110
114
  }, {
111
115
  isDisplay: import("vue").Ref<boolean>;
112
116
  searchName: import("vue").Ref<string>;
@@ -126,7 +130,8 @@ declare const _default: import("vue").DefineComponent<{
126
130
  getPlaceholder: import("vue").ComputedRef<any>;
127
131
  getEmptyContentMsg: import("vue").ComputedRef<any>;
128
132
  getSepPositions: import("vue").Ref<any>;
129
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("changeElement" | "update:Selection" | "changeInputValue")[], "changeElement" | "update:Selection" | "changeInputValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
133
+ openInfo: () => void;
134
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("changeElement" | "update:Selection" | "openInfo" | "changeInputValue")[], "changeElement" | "update:Selection" | "openInfo" | "changeInputValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
130
135
  element_table: {
131
136
  type: {
132
137
  (arrayLength: number): string[];
@@ -235,9 +240,14 @@ declare const _default: import("vue").DefineComponent<{
235
240
  type: BooleanConstructor;
236
241
  default: boolean;
237
242
  };
243
+ labelInfo: {
244
+ type: BooleanConstructor;
245
+ default: boolean;
246
+ };
238
247
  }>> & {
239
248
  onChangeElement?: ((...args: any[]) => any) | undefined;
240
249
  "onUpdate:Selection"?: ((...args: any[]) => any) | undefined;
250
+ onOpenInfo?: ((...args: any[]) => any) | undefined;
241
251
  onChangeInputValue?: ((...args: any[]) => any) | undefined;
242
252
  }, {
243
253
  lang: string;
@@ -252,6 +262,7 @@ declare const _default: import("vue").DefineComponent<{
252
262
  empty_content_msg: string;
253
263
  fuzzySearch: boolean;
254
264
  filterSearch: boolean;
265
+ labelInfo: boolean;
255
266
  filter_placeholder: string;
256
267
  close_on_click: boolean;
257
268
  default_select: number;
@@ -15,14 +15,14 @@
15
15
  <arg-tags class="source_tag">
16
16
  <div class="oip_row v-center gap-4">
17
17
  <arg-flag
18
- :slug="getCountryName.toLowerCase()"
18
+ :slug="getCountryName(sourceContent?.country?.toLowerCase())"
19
19
  emoji
20
20
  height="10"
21
21
  />
22
- <p>{{ sourceCountry }}</p>
22
+ <p>{{ sourceContent?.country }}</p>
23
23
  </div>
24
24
  </arg-tags>
25
- <p class="source_title">{{ sourceTitle }}</p>
25
+ <p class="source_title">{{ sourceContent?.title }}</p>
26
26
  </div>
27
27
  </div>
28
28
  <div class="copy_action" @click.stop="copy()">
@@ -41,12 +41,34 @@
41
41
  <div class="oip_row v-start gap-16">
42
42
  <div class="tag_display">
43
43
  <p class="toolbar_tag_title">{{ langData?.sector }}</p>
44
- <arg-tags>{{ sourceSector }}</arg-tags>
44
+ <arg-tags>Public</arg-tags>
45
45
  </div>
46
46
  </div>
47
- <span class="oip_body">
48
- <slot />
49
- </span>
47
+ <div class="oip_body">
48
+ <div v-if="directusToken !== null" class="oip_list v-start gap-24">
49
+ <div
50
+ v-if="sourceContent?.providerDescr"
51
+ class="oip_list v-start gap-8"
52
+ >
53
+ <p class="bold">About the provider :</p>
54
+ <div class="oip_list v-start gap-4">
55
+ <div v-html="sourceContent?.providerDescr" />
56
+ <slot name="moreProvider" />
57
+ </div>
58
+ </div>
59
+ <div class="oip_list v-start gap-8">
60
+ <p class="bold">About the source :</p>
61
+ <div
62
+ v-if="sourceContent?.sourceDescr"
63
+ class="oip_list v-start gap-4"
64
+ >
65
+ <div v-html="sourceContent?.sourceDescr" />
66
+ <slot name="moreSource" />
67
+ </div>
68
+ </div>
69
+ </div>
70
+ <slot v-else />
71
+ </div>
50
72
  </div>
51
73
  </div>
52
74
  </template>
@@ -69,15 +91,15 @@ export default defineComponent({
69
91
  props: {
70
92
  sourceTitle: {
71
93
  type: String,
72
- required: true
94
+ default: null
73
95
  },
74
96
  sourceCountry: {
75
97
  type: String,
76
- default: "France"
98
+ default: null
77
99
  },
78
100
  sourceSector: {
79
101
  type: String,
80
- default: "Public"
102
+ default: null
81
103
  },
82
104
  defaultOpen: {
83
105
  type: Boolean,
@@ -89,12 +111,25 @@ export default defineComponent({
89
111
  validator: (value) => {
90
112
  return ["en", "fr", "es", "jp"].includes(value);
91
113
  }
114
+ },
115
+ directusToken: {
116
+ type: String,
117
+ default: null
118
+ },
119
+ providerId: {
120
+ type: String,
121
+ default: null
122
+ },
123
+ sourceId: {
124
+ type: String,
125
+ default: null
92
126
  }
93
127
  },
94
128
  emits: ["copyTitle"],
95
129
  setup(props, { emit }) {
96
130
  const sourceOpen = ref(false);
97
131
  const langData = ref(null);
132
+ const sourceData = ref(null);
98
133
  async function setLang() {
99
134
  const jsonFiles = import.meta.glob("./locales/*.json");
100
135
  for (const path in jsonFiles) {
@@ -104,8 +139,179 @@ export default defineComponent({
104
139
  }
105
140
  }
106
141
  }
142
+ async function fetchAll() {
143
+ const graphqlQuery = `
144
+ {
145
+ DataProvider(
146
+ limit: -1
147
+ ) {
148
+ provider_uuid
149
+ provider_country
150
+ sources {
151
+ source_uuid
152
+ translations {
153
+ source_name
154
+ source_description
155
+ languages_code {
156
+ code
157
+ name
158
+ }
159
+ }
160
+ datasets {
161
+ id
162
+ Dataset_id {
163
+ id
164
+ table_name
165
+ schema_name
166
+ status
167
+ }
168
+ }
169
+ }
170
+ translations {
171
+ provider_name
172
+ provider_description
173
+ languages_code {
174
+ code
175
+ name
176
+ }
177
+ }
178
+ }
179
+ }
180
+ `;
181
+ const headers = {
182
+ Authorization: `Bearer ${props.directusToken}`,
183
+ "Content-Type": "application/json"
184
+ };
185
+ const payload = {
186
+ query: graphqlQuery
187
+ };
188
+ try {
189
+ const response = await fetch(
190
+ "https://metadata.rcd.lensuscloud.com/graphql",
191
+ {
192
+ method: "POST",
193
+ headers,
194
+ body: JSON.stringify(payload)
195
+ }
196
+ );
197
+ if (response.ok) {
198
+ const responseData = await response.json();
199
+ console.log("zebi", responseData);
200
+ } else {
201
+ const errorText = await response.text();
202
+ console.log(`Error: ${response.status}. ${errorText}`);
203
+ }
204
+ } catch (err) {
205
+ console.log(`Request failed: ${err.message}`);
206
+ }
207
+ }
208
+ async function fetchData() {
209
+ const graphqlQuery = `
210
+ query {
211
+ DataProvider(
212
+ filter: {
213
+ provider_uuid: { _eq: "${props.providerId}" },
214
+ }
215
+ ) {
216
+ provider_uuid
217
+ provider_country
218
+ sources {
219
+ source_uuid
220
+ translations {
221
+ source_name
222
+ source_description
223
+ languages_code {
224
+ code
225
+ name
226
+ }
227
+ }
228
+ datasets {
229
+ id
230
+ Dataset_id {
231
+ id
232
+ table_name
233
+ schema_name
234
+ status
235
+ }
236
+ }
237
+ }
238
+ translations {
239
+ provider_name
240
+ provider_description
241
+ languages_code {
242
+ code
243
+ name
244
+ }
245
+ }
246
+ }
247
+ }
248
+ `;
249
+ const headers = {
250
+ Authorization: `Bearer ${props.directusToken}`,
251
+ "Content-Type": "application/json"
252
+ };
253
+ const payload = {
254
+ query: graphqlQuery
255
+ };
256
+ try {
257
+ const response = await fetch(
258
+ "https://metadata.rcd.lensuscloud.com/graphql",
259
+ {
260
+ method: "POST",
261
+ headers,
262
+ body: JSON.stringify(payload)
263
+ }
264
+ );
265
+ if (response.ok) {
266
+ const responseData = await response.json();
267
+ sourceData.value = responseData;
268
+ } else {
269
+ const errorText = await response.text();
270
+ console.log(`Error: ${response.status}. ${errorText}`);
271
+ }
272
+ } catch (err) {
273
+ console.log(`Request failed: ${err.message}`);
274
+ }
275
+ }
276
+ function getCountryName(name) {
277
+ if (name === "united states") {
278
+ return "usa";
279
+ } else if (name === "united kingdom") {
280
+ return "uk";
281
+ } else if (name === "poland") {
282
+ return "republic-of-poland";
283
+ } else
284
+ return name;
285
+ }
286
+ const sourceContent = computed(() => {
287
+ if (sourceData.value !== null) {
288
+ const sourceObject = sourceData.value.data.DataProvider[0]?.sources.find((source) => source.source_uuid === props.sourceId).translations.find(
289
+ (a) => a.languages_code.code.includes(props.lang)
290
+ );
291
+ const providerObject = sourceData.value.data.DataProvider[0]?.translations.find(
292
+ (a) => a.languages_code.code.includes(props.lang)
293
+ );
294
+ return {
295
+ title: `${providerObject?.provider_name} - ${sourceObject?.source_name}`,
296
+ country: sourceData.value.data.DataProvider[0]?.provider_country,
297
+ providerDescr: providerObject?.provider_description,
298
+ sourceDescr: sourceObject?.source_description,
299
+ sector: "Public"
300
+ };
301
+ } else {
302
+ return {
303
+ title: props.sourceTitle,
304
+ country: props.sourceCountry,
305
+ sector: props.sourceSector
306
+ };
307
+ }
308
+ });
107
309
  onBeforeMount(async () => {
108
310
  setLang();
311
+ if (props.directusToken !== null) {
312
+ await fetchData();
313
+ await fetchAll();
314
+ }
109
315
  });
110
316
  watch(
111
317
  () => props.lang,
@@ -116,16 +322,6 @@ export default defineComponent({
116
322
  function closeSource() {
117
323
  sourceOpen.value = false;
118
324
  }
119
- const getCountryName = computed(() => {
120
- if (props.sourceCountry === "United States") {
121
- return "usa";
122
- } else if (props.sourceCountry === "United Kingdom") {
123
- return "uk";
124
- } else if (props.sourceCountry === "Poland") {
125
- return "republic-of-poland";
126
- } else
127
- return props.sourceCountry;
128
- });
129
325
  onMounted(() => {
130
326
  sourceOpen.value = props.defaultOpen;
131
327
  });
@@ -158,11 +354,18 @@ export default defineComponent({
158
354
  navigator.clipboard.writeText(props.sourceTitle);
159
355
  emit("copyTitle");
160
356
  }
161
- return { closeSource, sourceOpen, copy, getCountryName, langData };
357
+ return {
358
+ closeSource,
359
+ sourceOpen,
360
+ copy,
361
+ getCountryName,
362
+ langData,
363
+ sourceContent
364
+ };
162
365
  }
163
366
  });
164
367
  </script>
165
368
 
166
369
  <style scoped>
167
- .oip_source_card_collapse{align-self:stretch;border:1px solid var(--light,#dbdef0);border-radius:8px;cursor:pointer;display:flex;flex-direction:column;overflow:hidden;padding:8px 8px 8px 16px;transition:gap .3s linear,max-height .3s linear,background-color .3s linear,padding .3s linear}.oip_source_card_collapse:hover .header>svg{color:var(--primary)!important}.oip_source_card_collapse.close{background-color:var(--white,#fff);gap:0;max-height:110px}.oip_source_card_collapse.open{background-color:var(--demi-fond);gap:16px;max-height:800px;padding:8px 8px 16px 16px}.icon_open{transition:transform .3s}.icon_rotate{transform:rotateX(180deg)}.source_card_header{align-items:center;align-self:stretch;display:flex;flex-direction:row;gap:8px;justify-content:space-between}.source_title{font-family:Figtree;font-size:14px;font-style:normal;font-weight:700;line-height:160%}.source_content{display:flex;flex-direction:column;gap:16px;margin-right:-6px;padding-right:4px;transition:max-height .3s linear,opacity .3s linear}.hide_content{max-height:0;opacity:0}.show_content{max-height:100%;opacity:1;overflow-y:scroll}.show_content::-webkit-scrollbar{height:5px;width:5px}.show_content::-webkit-scrollbar-thumb{background:var(--medium);border-radius:12px!important}.show_content::-webkit-scrollbar-thumb:hover{background:var(--medium)!important}.source_tag{align-self:stretch;display:flex}.toolbar_source_update,.toolbar_tag_title{color:var(--dark);font-size:12px;font-style:normal;font-weight:400;line-height:normal}.tag_display{align-items:flex-start;display:flex;flex-direction:column;gap:var(--s,8px);justify-content:center}.copy_action{align-items:center;background:var(--white);border:1px solid var(--light);border-radius:6px;box-shadow:0 1px 2px 0 rgba(30,41,59,.1);color:var(--dark);cursor:pointer;display:flex;flex-direction:row;font-size:12px;font-style:normal;font-weight:500;gap:4px;line-height:normal;padding:4px 8px 4px 6px;white-space:nowrap}.copy_action:hover,.copy_action:hover svg{color:var(--primary)!important}.title_container{display:flex;flex-direction:column;gap:4px}
370
+ .oip_source_card_collapse{align-self:stretch;border:1px solid var(--light,#dbdef0);border-radius:8px;cursor:pointer;display:flex;flex-direction:column;overflow:hidden;padding:8px 8px 8px 16px;transition:gap .3s linear,max-height .3s linear,background-color .3s linear,padding .3s linear}.bold{font-weight:700}.oip_source_card_collapse:hover .header>svg{color:var(--primary)!important}.oip_source_card_collapse.close{background-color:var(--white,#fff);gap:0;max-height:110px}.oip_source_card_collapse.open{background-color:var(--demi-fond);gap:16px;max-height:800px;padding:8px 8px 16px 16px}.icon_open{transition:transform .3s}.icon_rotate{transform:rotateX(180deg)}.source_card_header{align-items:center;align-self:stretch;display:flex;flex-direction:row;gap:8px;justify-content:space-between}.source_title{font-family:Figtree;font-size:14px;font-style:normal;font-weight:700;line-height:160%}.source_content{display:flex;flex-direction:column;gap:16px;margin-right:-6px;padding-right:4px;transition:max-height .3s linear,opacity .3s linear}.hide_content{max-height:0;opacity:0}.show_content{max-height:100%;opacity:1;overflow-y:scroll}.show_content::-webkit-scrollbar{height:5px;width:5px}.show_content::-webkit-scrollbar-thumb{background:var(--medium);border-radius:12px!important}.show_content::-webkit-scrollbar-thumb:hover{background:var(--medium)!important}.source_tag{align-self:stretch;display:flex}.toolbar_source_update,.toolbar_tag_title{color:var(--dark);font-size:12px;font-style:normal;font-weight:400;line-height:normal}.tag_display{align-items:flex-start;display:flex;flex-direction:column;gap:var(--s,8px);justify-content:center}.copy_action{align-items:center;background:var(--white);border:1px solid var(--light);border-radius:6px;box-shadow:0 1px 2px 0 rgba(30,41,59,.1);color:var(--dark);cursor:pointer;display:flex;flex-direction:row;font-size:12px;font-style:normal;font-weight:500;gap:4px;line-height:normal;padding:4px 8px 4px 6px;white-space:nowrap}.copy_action:hover,.copy_action:hover svg{color:var(--primary)!important}.title_container{display:flex;flex-direction:column;gap:4px}
168
371
  </style>
@@ -1,15 +1,15 @@
1
1
  declare const _default: import("vue").DefineComponent<{
2
2
  sourceTitle: {
3
3
  type: StringConstructor;
4
- required: true;
4
+ default: null;
5
5
  };
6
6
  sourceCountry: {
7
7
  type: StringConstructor;
8
- default: string;
8
+ default: null;
9
9
  };
10
10
  sourceSector: {
11
11
  type: StringConstructor;
12
- default: string;
12
+ default: null;
13
13
  };
14
14
  defaultOpen: {
15
15
  type: BooleanConstructor;
@@ -20,24 +20,49 @@ declare const _default: import("vue").DefineComponent<{
20
20
  default: string;
21
21
  validator: (value: string) => boolean;
22
22
  };
23
+ directusToken: {
24
+ type: StringConstructor;
25
+ default: null;
26
+ };
27
+ providerId: {
28
+ type: StringConstructor;
29
+ default: null;
30
+ };
31
+ sourceId: {
32
+ type: StringConstructor;
33
+ default: null;
34
+ };
23
35
  }, {
24
36
  closeSource: () => void;
25
37
  sourceOpen: import("vue").Ref<boolean>;
26
38
  copy: () => void;
27
- getCountryName: import("vue").ComputedRef<string>;
39
+ getCountryName: (name: string) => string;
28
40
  langData: import("vue").Ref<any>;
41
+ sourceContent: import("vue").ComputedRef<{
42
+ title: string;
43
+ country: any;
44
+ providerDescr: any;
45
+ sourceDescr: any;
46
+ sector: string;
47
+ } | {
48
+ title: string;
49
+ country: string;
50
+ sector: string;
51
+ providerDescr?: undefined;
52
+ sourceDescr?: undefined;
53
+ }>;
29
54
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "copyTitle"[], "copyTitle", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
30
55
  sourceTitle: {
31
56
  type: StringConstructor;
32
- required: true;
57
+ default: null;
33
58
  };
34
59
  sourceCountry: {
35
60
  type: StringConstructor;
36
- default: string;
61
+ default: null;
37
62
  };
38
63
  sourceSector: {
39
64
  type: StringConstructor;
40
- default: string;
65
+ default: null;
41
66
  };
42
67
  defaultOpen: {
43
68
  type: BooleanConstructor;
@@ -48,12 +73,28 @@ declare const _default: import("vue").DefineComponent<{
48
73
  default: string;
49
74
  validator: (value: string) => boolean;
50
75
  };
76
+ directusToken: {
77
+ type: StringConstructor;
78
+ default: null;
79
+ };
80
+ providerId: {
81
+ type: StringConstructor;
82
+ default: null;
83
+ };
84
+ sourceId: {
85
+ type: StringConstructor;
86
+ default: null;
87
+ };
51
88
  }>> & {
52
89
  onCopyTitle?: ((...args: any[]) => any) | undefined;
53
90
  }, {
54
91
  lang: string;
92
+ sourceTitle: string;
55
93
  sourceCountry: string;
56
94
  sourceSector: string;
57
95
  defaultOpen: boolean;
96
+ directusToken: string;
97
+ providerId: string;
98
+ sourceId: string;
58
99
  }, {}>;
59
100
  export default _default;
@@ -81,7 +81,9 @@
81
81
  },
82
82
  "sourceCollapse": {
83
83
  "copySource": "Copy",
84
- "sector": "Sector"
84
+ "sector": "Sector",
85
+ "aboutProvider": "About the provider :",
86
+ "aboutSource": "About the source :"
85
87
  },
86
88
 
87
89
  "backOIP": "Back to OIP",
@@ -81,7 +81,9 @@
81
81
  },
82
82
  "sourceCollapse": {
83
83
  "copySource": "Copiar",
84
- "sector": "Sector"
84
+ "sector": "Sector",
85
+ "aboutProvider": "Sobre el proveedor :",
86
+ "aboutSource": "Sobre la fuente :"
85
87
  },
86
88
  "backOIP": "Volver a OIP",
87
89
  "footer": {
@@ -81,7 +81,9 @@
81
81
  },
82
82
  "sourceCollapse": {
83
83
  "copySource": "Copier",
84
- "sector": "Secteur"
84
+ "sector": "Secteur",
85
+ "aboutProvider": "À propos du provider :",
86
+ "aboutSource": "À propos de la source :"
85
87
  },
86
88
  "backOIP": "Retour OIP",
87
89
  "footer": {
@@ -81,7 +81,9 @@
81
81
  },
82
82
  "sourceCollapse": {
83
83
  "copySource": "コピー",
84
- "sector": "セクター"
84
+ "sector": "セクター",
85
+ "aboutProvider": "Sプロバイダーについて :",
86
+ "aboutSource": "ソースについて :"
85
87
  },
86
88
  "backOIP": "OIPに戻る",
87
89
  "footer": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/auriga",
3
- "version": "0.2.50",
3
+ "version": "0.2.51",
4
4
  "description": "Aurgia is a UI kit developped by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",