@datagouv/components-next 1.0.2-dev.4 → 1.0.2-dev.41

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.
Files changed (57) hide show
  1. package/dist/Datafair.client-BAokThtJ.js +30 -0
  2. package/dist/JsonPreview.client-DGiaDxVv.js +40 -0
  3. package/dist/{MapContainer.client-DjjvdKBp.js → MapContainer.client-BKGsAP0Y.js} +35 -38
  4. package/dist/{PdfPreview.client-CsvKU0Aq.js → PdfPreview.client-CGjP5ZYb.js} +822 -865
  5. package/dist/{Pmtiles.client-uqg1fwOl.js → Pmtiles.client-C1I7pwT5.js} +574 -579
  6. package/dist/PreviewWrapper.vue_vue_type_script_setup_true_lang-BlcvVwW8.js +61 -0
  7. package/dist/Swagger.client-U7ZDVUHL.js +4 -0
  8. package/dist/XmlPreview.client-CHUVVEH6.js +34 -0
  9. package/dist/components-next.css +3 -3
  10. package/dist/components-next.js +83 -86
  11. package/dist/components.css +1 -1
  12. package/dist/{index-PMeuFwWj.js → index-CzClB3i0.js} +1 -1
  13. package/dist/{main-ByqZlhiZ.js → main-CF7lWk6R.js} +31224 -30474
  14. package/dist/{vue3-xml-viewer.common-DFrGHXJC.js → vue3-xml-viewer.common-CAwAbUJl.js} +1 -1
  15. package/package.json +10 -8
  16. package/src/components/ActivityList/ActivityList.vue +0 -2
  17. package/src/components/Form/SearchableSelect.vue +2 -1
  18. package/src/components/Pagination.vue +8 -5
  19. package/src/components/ReadMore.vue +1 -1
  20. package/src/components/ResourceAccordion/Datafair.client.vue +4 -10
  21. package/src/components/ResourceAccordion/JsonPreview.client.vue +23 -121
  22. package/src/components/ResourceAccordion/MapContainer.client.vue +7 -11
  23. package/src/components/ResourceAccordion/Metadata.vue +1 -2
  24. package/src/components/ResourceAccordion/PdfPreview.client.vue +24 -103
  25. package/src/components/ResourceAccordion/Pmtiles.client.vue +5 -10
  26. package/src/components/ResourceAccordion/Preview.vue +6 -11
  27. package/src/components/ResourceAccordion/PreviewLoader.vue +1 -2
  28. package/src/components/ResourceAccordion/PreviewUnavailable.vue +22 -0
  29. package/src/components/ResourceAccordion/PreviewWrapper.vue +82 -0
  30. package/src/components/ResourceAccordion/ResourceAccordion.vue +1 -2
  31. package/src/components/ResourceAccordion/XmlPreview.client.vue +16 -115
  32. package/src/components/ResourceExplorer/ResourceExplorer.vue +21 -10
  33. package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +24 -3
  34. package/src/components/Search/GlobalSearch.vue +29 -4
  35. package/src/composables/useResourceCapabilities.ts +1 -1
  36. package/src/config.ts +2 -0
  37. package/src/functions/datasets.ts +0 -17
  38. package/src/functions/resources.ts +56 -1
  39. package/src/functions/tabularApi.ts +7 -84
  40. package/src/main.ts +3 -24
  41. package/src/types/dataservices.ts +2 -0
  42. package/src/types/organizations.ts +1 -1
  43. package/src/types/pages.ts +0 -5
  44. package/src/types/posts.ts +2 -2
  45. package/src/types/reports.ts +3 -0
  46. package/src/types/search.ts +26 -1
  47. package/src/types/site.ts +5 -3
  48. package/src/types/users.ts +0 -1
  49. package/dist/Datafair.client-c1cUKkQR.js +0 -35
  50. package/dist/JsonPreview.client-CAs9XTCX.js +0 -87
  51. package/dist/Swagger.client-BGrkka3l.js +0 -4
  52. package/dist/XmlPreview.client-BWbKzLte.js +0 -79
  53. package/src/components/Chart/ChartViewer.vue +0 -152
  54. package/src/components/Chart/ChartViewerWrapper.vue +0 -194
  55. package/src/functions/pagination.ts +0 -9
  56. package/src/types/visualizations.ts +0 -84
  57. /package/assets/illustrations/{_microscope.svg → microscope.svg} +0 -0
@@ -6,92 +6,15 @@ export type SortConfig = {
6
6
  type: string
7
7
  } | null
8
8
 
9
- export type TabularDataResponse = {
10
- data: Array<Record<string, unknown>>
11
- meta: { total: number }
12
- }
13
-
14
- export type TabularAggregateType = 'avg' | 'sum' | 'count' | 'min' | 'max'
15
-
16
- export type FetchTabularDataOptions = {
17
- resourceId: string
18
- page?: number
19
- pageSize?: number
20
- columns?: Array<string> | undefined
21
- sort?: SortConfig
22
- groupBy?: string | undefined
23
- aggregation?: {
24
- column: string
25
- type: TabularAggregateType
26
- } | undefined
27
- }
28
-
29
- export type TabularProfileResponse = {
30
- profile: {
31
- header: Array<string>
32
- columns: Record<string, {
33
- score: number
34
- format: string
35
- python_type: string
36
- }>
37
- formats: Record<string, Array<string>>
38
- profile: Record<string, {
39
- tops: Array<{ count: number, value: string }>
40
- nb_distinct: number
41
- nb_missing_values: number
42
- min?: number
43
- max?: number
44
- std?: number
45
- mean?: number
46
- }>
47
- encoding: string
48
- separator: string
49
- categorical: Array<string>
50
- total_lines: number
51
- nb_duplicates: number
52
- columns_fields: Record<string, {
53
- score: number
54
- format: string
55
- python_type: string
56
- }>
57
- columns_labels: Record<string, {
58
- score: number
59
- format: string
60
- python_type: string
61
- }>
62
- header_row_idx: number
63
- heading_columns: number
64
- trailing_columns: number
65
- }
66
- deleted_at: string | null
67
- dataset_id: string
68
- indexes: null
69
- }
70
-
71
- /**
72
- * Call Tabular-api to get table content with options object
73
- */
74
- export async function fetchTabularData(config: PluginConfig, options: FetchTabularDataOptions): Promise<TabularDataResponse> {
75
- const page = options.page ?? 1
76
- const pageSize = options.pageSize ?? config.tabularApiPageSize ?? 15
77
- let url = `${config.tabularApiUrl}/api/resources/${options.resourceId}/data/?page=${page}&page_size=${pageSize}`
78
- if (options.columns) {
79
- url += `&columns=${options.columns.join(',')}`
80
- }
81
- if (options.sort) {
82
- url += `&${options.sort.column}__sort=${options.sort.type}`
83
- }
84
- if (options.groupBy && options.aggregation?.type) {
85
- url += `&${options.groupBy}__groupby&${options.aggregation.column}__${options.aggregation.type}`
86
- }
87
- return await ofetch<TabularDataResponse>(url)
88
- }
89
-
90
9
  /**
91
10
  * Call Tabular-api to get table content
92
11
  */
93
- export function getData(config: PluginConfig, id: string, page: number, sortConfig?: SortConfig) {
94
- return fetchTabularData(config, { resourceId: id, page, sort: sortConfig })
12
+ export async function getData(config: PluginConfig, id: string, page: number, sortConfig?: SortConfig) {
13
+ let url = `${config.tabularApiUrl}/api/resources/${id}/data/?page=${page}&page_size=${config.tabularApiPageSize || 15}`
14
+ if (sortConfig) {
15
+ url = url + `&${sortConfig.column}__sort=${sortConfig.type}`
16
+ }
17
+ return await ofetch(url)
95
18
  }
96
19
 
97
20
  /**
@@ -99,5 +22,5 @@ export function getData(config: PluginConfig, id: string, page: number, sortConf
99
22
  */
100
23
  export function useGetProfile() {
101
24
  const config = useComponentsConfig()
102
- return (id: string) => ofetch<TabularProfileResponse>(`${config.tabularApiUrl}/api/resources/${id}/profile/`)
25
+ return (id: string) => ofetch(`${config.tabularApiUrl}/api/resources/${id}/profile/`)
103
26
  }
package/src/main.ts CHANGED
@@ -13,7 +13,7 @@ import type { License } from './types/licenses'
13
13
  import type { Member, MemberRole, NewOrganization, Organization, OrganizationOrSuggest, OrganizationReference, OrganizationSuggest } from './types/organizations'
14
14
  import type { Owned, OwnedWithFullObject, OwnedWithId } from './types/owned'
15
15
  import type { Comment, Thread } from './types/discussions'
16
- import type { Page, PageBloc, ContentBloc, BlocWithTitle, DatasetsListBloc, DataservicesListBloc, ReusesListBloc, LinkInBloc, LinksListBloc, MarkdownBloc, AccordionItemBloc, AccordionListBloc, HeroBloc } from './types/pages'
16
+ import type { PageBloc, ContentBloc, BlocWithTitle, DatasetsListBloc, DataservicesListBloc, ReusesListBloc, LinkInBloc, LinksListBloc, MarkdownBloc, AccordionItemBloc, AccordionListBloc, HeroBloc } from './types/pages'
17
17
  import type { Post } from './types/posts'
18
18
  import type { ReuseReference, NewReuse, Reuse, ReuseTopic, ReuseType } from './types/reuses'
19
19
  import type { RegisteredSchema, Schema, SchemaDetails, SchemaField, SchemaPath, SchemaPublicationMode, SchemaResponseData, SchemaVersion, ValidataError } from './types/schemas'
@@ -23,9 +23,8 @@ import type { Site } from './types/site'
23
23
  import type { Weight, WellType } from './types/ui'
24
24
  import type { User, UserReference } from './types/users'
25
25
  import type { Report, ReportSubject, ReportReason } from './types/reports'
26
- import type { Chart, ChartForm, ChartForApi, FilterCondition, Filter, AndFilters, GenericFilter, XAxisType, XAxisSortBy, SortDirection, XAxis, XAxisForm, UnitPosition, YAxis, DataSeriesType, DataSeries, DataSeriesForm } from './types/visualizations'
27
26
  import type { GlobalSearchConfig, SearchType, SortOption } from './types/search'
28
- import { getDefaultDatasetConfig, getDefaultDataserviceConfig, getDefaultReuseConfig, getDefaultOrganizationConfig, getDefaultGlobalSearchConfig, defaultDatasetSortOptions, defaultDataserviceSortOptions, defaultReuseSortOptions, defaultOrganizationSortOptions } from './types/search'
27
+ import { getDefaultDatasetConfig, getDefaultDataserviceConfig, getDefaultReuseConfig, getDefaultOrganizationConfig, getDefaultTopicConfig, getDefaultGlobalSearchConfig, defaultDatasetSortOptions, defaultDataserviceSortOptions, defaultReuseSortOptions, defaultOrganizationSortOptions } from './types/search'
29
28
 
30
29
  import ActivityList from './components/ActivityList/ActivityList.vue'
31
30
  import UserActivityList from './components/ActivityList/UserActivityList.vue'
@@ -101,7 +100,6 @@ import { configKey, useComponentsConfig, type PluginConfig } from './config.js'
101
100
  export { Toaster, toast } from 'vue-sonner'
102
101
 
103
102
  export * from './composables/useActiveDescendant'
104
- export * from './composables/useDebouncedRef'
105
103
  export * from './composables/useMetrics'
106
104
  export * from './composables/useReuseType'
107
105
  export * from './composables/useTranslation'
@@ -118,12 +116,10 @@ export * from './functions/metrics'
118
116
  export * from './functions/never'
119
117
  export * from './functions/organizations'
120
118
  export * from './functions/owned'
121
- export * from './functions/pagination'
122
119
  export * from './functions/resources'
123
120
  export * from './functions/reuses'
124
121
  export * from './functions/schemas'
125
122
  export * from './functions/users'
126
- export * from './functions/tabularApi'
127
123
  export * from './types/access_types'
128
124
 
129
125
  export type {
@@ -171,7 +167,6 @@ export type {
171
167
  Owned,
172
168
  OwnedWithFullObject,
173
169
  OwnedWithId,
174
- Page,
175
170
  PageBloc,
176
171
  ContentBloc,
177
172
  BlocWithTitle,
@@ -221,23 +216,6 @@ export type {
221
216
  ValidataError,
222
217
  Weight,
223
218
  WellType,
224
- Chart,
225
- ChartForm,
226
- ChartForApi,
227
- FilterCondition,
228
- Filter,
229
- AndFilters,
230
- GenericFilter,
231
- XAxisType,
232
- XAxisSortBy,
233
- SortDirection,
234
- XAxis,
235
- XAxisForm,
236
- UnitPosition,
237
- YAxis,
238
- DataSeriesType,
239
- DataSeries,
240
- DataSeriesForm,
241
219
  }
242
220
 
243
221
  export {
@@ -245,6 +223,7 @@ export {
245
223
  getDefaultDataserviceConfig,
246
224
  getDefaultReuseConfig,
247
225
  getDefaultOrganizationConfig,
226
+ getDefaultTopicConfig,
248
227
  getDefaultGlobalSearchConfig,
249
228
  defaultDatasetSortOptions,
250
229
  defaultDataserviceSortOptions,
@@ -24,6 +24,7 @@ export type BaseDataservice = Owned & WithAccessType & {
24
24
  license: string | null
25
25
  private: boolean
26
26
  rate_limiting: string
27
+ rate_limiting_url: string | null
27
28
  title: DataserviceReference['title']
28
29
  contact_points: Array<ContactPoint>
29
30
  }
@@ -65,6 +66,7 @@ export type Dataservice = Owned & WithAccessType & {
65
66
  permissions: { edit: boolean, delete: boolean }
66
67
  private: boolean
67
68
  rate_limiting: string
69
+ rate_limiting_url: string | null
68
70
  self_api_url: DataserviceReference['self_api_url']
69
71
  self_web_url: DataserviceReference['self_web_url']
70
72
  slug: string
@@ -1,7 +1,7 @@
1
1
  import type { User } from './users'
2
2
  import type { Badges } from './badges'
3
3
 
4
- export type MemberRole = 'admin' | 'editor'
4
+ export type MemberRole = 'admin' | 'editor' | 'partial_editor'
5
5
 
6
6
  export type Member = {
7
7
  role: MemberRole
@@ -2,11 +2,6 @@ import type { DatasetV2 } from './datasets'
2
2
  import type { Dataservice } from './dataservices'
3
3
  import type { Reuse } from './reuses'
4
4
 
5
- export type Page = {
6
- id: string
7
- blocs: Array<PageBloc>
8
- }
9
-
10
5
  export type BlocWithTitle = {
11
6
  title: string
12
7
  subtitle: string | null
@@ -1,12 +1,12 @@
1
1
  import type { Dataset } from './datasets'
2
- import type { Page } from './pages'
2
+ import type { PageBloc } from './pages'
3
3
  import type { Reuse } from './reuses'
4
4
  import type { User } from './users'
5
5
 
6
6
  export type Post = {
7
7
  body_type: 'markdown' | 'html' | 'blocs'
8
+ blocs: Array<PageBloc>
8
9
  content: string
9
- content_as_page: Page | null
10
10
  created_at: string
11
11
  credit_to: string
12
12
  credit_url: string
@@ -16,11 +16,14 @@ export type Report = {
16
16
  id: string
17
17
  by: User | null
18
18
  subject: ReportSubject | null
19
+ subject_embed_id: string | null
19
20
  reason: ReportReasonValue
20
21
  message: string
21
22
  reported_at: string
22
23
  self_api_url: string
23
24
  subject_deleted_at: string | null
25
+ subject_deleted_by: User | null
26
+ subject_label: string | null
24
27
  dismissed_at: string | null
25
28
  dismissed_by: User | null
26
29
  }
@@ -325,7 +325,16 @@ export type OrganizationSearchConfig = {
325
325
  sortOptions?: SortOption<OrganizationSearchSort>[]
326
326
  }
327
327
 
328
- export type SearchTypeConfig = DatasetSearchConfig | DataserviceSearchConfig | ReuseSearchConfig | OrganizationSearchConfig
328
+ export type TopicSearchConfig = {
329
+ class: 'topics'
330
+ name?: string
331
+ hiddenFilters?: HiddenFilter<TopicSearchFilters>[]
332
+ basicFilters?: (keyof TopicSearchFilters)[]
333
+ advancedFilters?: (keyof TopicSearchFilters)[]
334
+ sortOptions?: SortOption<TopicSearchSort>[]
335
+ }
336
+
337
+ export type SearchTypeConfig = DatasetSearchConfig | DataserviceSearchConfig | ReuseSearchConfig | OrganizationSearchConfig | TopicSearchConfig
329
338
 
330
339
  export type SearchType = SearchTypeConfig['class']
331
340
 
@@ -397,11 +406,27 @@ export function getDefaultOrganizationConfig(overrides?: Partial<Omit<Organizati
397
406
  }
398
407
  }
399
408
 
409
+ export const defaultTopicSortOptions: SortOption<TopicSearchSort>[] = [
410
+ { value: '-created', label: 'Date de création' },
411
+ { value: '-last_modified', label: 'Dernière mise à jour' },
412
+ ]
413
+
414
+ export function getDefaultTopicConfig(overrides?: Partial<Omit<TopicSearchConfig, 'class'>>): TopicSearchConfig {
415
+ return {
416
+ class: 'topics',
417
+ basicFilters: ['last_update_range', 'producer_type'],
418
+ advancedFilters: ['organization', 'tag'],
419
+ sortOptions: defaultTopicSortOptions,
420
+ ...overrides,
421
+ }
422
+ }
423
+
400
424
  export function getDefaultGlobalSearchConfig(): GlobalSearchConfig {
401
425
  return [
402
426
  getDefaultDatasetConfig(),
403
427
  getDefaultDataserviceConfig(),
404
428
  getDefaultReuseConfig(),
405
429
  getDefaultOrganizationConfig(),
430
+ getDefaultTopicConfig(),
406
431
  ]
407
432
  }
package/src/types/site.ts CHANGED
@@ -1,9 +1,11 @@
1
+ import type { PageBloc } from './pages'
2
+
1
3
  export type Site = {
2
4
  id: string
3
5
  title: string
4
- datasets_page: string | null
5
- reuses_page: string | null
6
- dataservices_page: string | null
6
+ datasets_blocs: Array<PageBloc>
7
+ reuses_blocs: Array<PageBloc>
8
+ dataservices_blocs: Array<PageBloc>
7
9
  version: string
8
10
  metrics: {
9
11
  'dataservices': number
@@ -21,7 +21,6 @@ export type User = {
21
21
  page: UserReference['page']
22
22
  avatar: UserReference['avatar']
23
23
  avatar_thumbnail: UserReference['avatar_thumbnail']
24
- apikey?: string
25
24
  email?: string
26
25
  about: string
27
26
  website?: string
@@ -1,35 +0,0 @@
1
- import { defineComponent as f, computed as a, createElementBlock as o, openBlock as t, createBlock as p, createElementVNode as i, withCtx as m, createVNode as _, unref as c, toDisplayString as x } from "vue";
2
- import { a as h, _ as v, F as g } from "./main-ByqZlhiZ.js";
3
- const k = { class: "fr-text--xs" }, b = { key: 0 }, y = ["src"], B = /* @__PURE__ */ f({
4
- __name: "Datafair.client",
5
- props: {
6
- resource: {},
7
- dataset: {}
8
- },
9
- setup(d) {
10
- const e = d, { t: l } = h(), r = a(() => e.resource.extras.datafairOrigin || e.dataset.extras.datafairOrigin), s = a(() => e.resource.extras.datafairDatasetId || e.dataset.extras.datafairDatasetId), u = a(() => e.resource.extras.datafairEmbed), n = a(() => !r.value || !s.value ? null : `${r.value}/embed/dataset/${s.value}/${u.value}`);
11
- return (D, E) => (t(), o("div", k, [
12
- n.value ? (t(), o("div", b, [
13
- i("iframe", {
14
- src: n.value,
15
- width: "100%",
16
- height: "500px",
17
- style: { "background-color": "transparent", border: "none" }
18
- }, null, 8, y)
19
- ])) : (t(), p(v, {
20
- key: 1,
21
- type: "warning",
22
- class: "flex items-center space-x-2"
23
- }, {
24
- default: m(() => [
25
- _(c(g), { class: "shrink-0 size-6" }),
26
- i("span", null, x(c(l)("Erreur lors de l'affichage de l'aperçu.")), 1)
27
- ]),
28
- _: 1
29
- }))
30
- ]));
31
- }
32
- });
33
- export {
34
- B as default
35
- };
@@ -1,87 +0,0 @@
1
- import { defineComponent as S, defineAsyncComponent as b, ref as o, computed as w, onMounted as N, createElementBlock as p, openBlock as r, createBlock as f, createCommentVNode as T, createVNode as u, unref as t, toDisplayString as i, withCtx as d, createElementVNode as h } from "vue";
2
- import { u as P, a as E, g as q, _ as m, F as v } from "./main-ByqZlhiZ.js";
3
- const B = { class: "fr-text--xs" }, O = { key: 0 }, V = {
4
- key: 1,
5
- class: "text-gray-medium"
6
- }, L = /* @__PURE__ */ S({
7
- __name: "JsonPreview.client",
8
- props: {
9
- resource: {}
10
- },
11
- setup(k) {
12
- const z = b(
13
- () => import("./vue3-json-viewer-BXwup7nO.js").then((e) => (Promise.resolve({ }), e.JsonViewer))
14
- ), g = k, x = P(), { t: s } = E(), l = o(null), c = o(!1), n = o(null), _ = o(!1), y = w(() => q(g.resource)), J = w(() => {
15
- const e = y.value;
16
- if (!e || !x.maxJsonPreviewCharSize)
17
- return !1;
18
- const a = x.maxJsonPreviewCharSize;
19
- return e <= a;
20
- }), C = async () => {
21
- if (!J.value) {
22
- _.value = !0;
23
- return;
24
- }
25
- c.value = !0, n.value = null;
26
- try {
27
- const e = await fetch(g.resource.url);
28
- if (!e.ok)
29
- throw new Error(`HTTP error! status: ${e.status}`);
30
- const a = await e.json();
31
- l.value = a;
32
- } catch (e) {
33
- console.error("Error loading JSON:", e), e instanceof TypeError ? n.value = "network" : n.value = "generic", l.value = null;
34
- } finally {
35
- c.value = !1;
36
- }
37
- };
38
- return N(() => {
39
- C();
40
- }), (e, a) => (r(), p("div", B, [
41
- l.value ? (r(), p("div", O, [
42
- u(t(z), {
43
- value: l.value,
44
- boxed: "",
45
- sort: "",
46
- theme: "light",
47
- "max-depth": 3,
48
- "expand-depth": 2,
49
- "indent-width": 2
50
- }, null, 8, ["value"])
51
- ])) : c.value ? (r(), p("div", V, i(t(s)("Chargement de l'aperçu JSON...")), 1)) : _.value ? (r(), f(m, {
52
- key: 2,
53
- type: "warning",
54
- class: "flex items-center space-x-2"
55
- }, {
56
- default: d(() => [
57
- u(t(v), { class: "shrink-0 size-6" }),
58
- h("span", null, i(y.value ? t(s)("Fichier JSON trop volumineux pour l'aperçu. Pour consulter le fichier complet, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.") : t(s)("L'aperçu n'est pas disponible car la taille du fichier est inconnue. Pour consulter le fichier complet, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.")), 1)
59
- ]),
60
- _: 1
61
- })) : n.value === "network" ? (r(), f(m, {
62
- key: 3,
63
- type: "warning",
64
- class: "flex items-center space-x-2"
65
- }, {
66
- default: d(() => [
67
- u(t(v), { class: "shrink-0 size-6" }),
68
- h("span", null, i(t(s)("Ce fichier JSON ne peut pas être prévisualisé, peut-être parce qu'il est hébergé sur un autre site qui ne l'autorise pas. Pour le consulter, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.")), 1)
69
- ]),
70
- _: 1
71
- })) : n.value ? (r(), f(m, {
72
- key: 4,
73
- type: "warning",
74
- class: "flex items-center space-x-2"
75
- }, {
76
- default: d(() => [
77
- u(t(v), { class: "shrink-0 size-6" }),
78
- h("span", null, i(t(s)("Erreur lors du chargement de l'aperçu JSON.")), 1)
79
- ]),
80
- _: 1
81
- })) : T("", !0)
82
- ]));
83
- }
84
- });
85
- export {
86
- L as default
87
- };
@@ -1,4 +0,0 @@
1
- import { i as f } from "./main-ByqZlhiZ.js";
2
- export {
3
- f as default
4
- };
@@ -1,79 +0,0 @@
1
- import { defineComponent as b, defineAsyncComponent as L, ref as o, computed as w, onMounted as T, createElementBlock as p, openBlock as r, createBlock as m, createCommentVNode as P, createVNode as u, unref as t, toDisplayString as i, withCtx as f, createElementVNode as d } from "vue";
2
- import { u as E, a as M, g as q, _ as h, F as v } from "./main-ByqZlhiZ.js";
3
- const B = { class: "fr-text--xs" }, S = { key: 0 }, V = {
4
- key: 1,
5
- class: "text-gray-medium"
6
- }, N = /* @__PURE__ */ b({
7
- __name: "XmlPreview.client",
8
- props: {
9
- resource: {}
10
- },
11
- setup(k) {
12
- const z = L(
13
- () => import("./vue3-xml-viewer.common-DFrGHXJC.js").then((e) => e.v).then((e) => e.default || e.XmlViewer)
14
- ), g = k, x = E(), { t: l } = M(), n = o(null), c = o(!1), s = o(null), _ = o(!1), y = w(() => q(g.resource)), X = w(() => {
15
- const e = y.value;
16
- if (!e || !x.maxXmlPreviewCharSize)
17
- return !1;
18
- const a = x.maxXmlPreviewCharSize;
19
- return e <= a;
20
- }), C = async () => {
21
- if (!X.value) {
22
- _.value = !0;
23
- return;
24
- }
25
- c.value = !0, s.value = null;
26
- try {
27
- const e = await fetch(g.resource.url);
28
- if (!e.ok)
29
- throw new Error(`HTTP error! status: ${e.status}`);
30
- const a = await e.text();
31
- n.value = a;
32
- } catch (e) {
33
- console.error("Error loading XML:", e), e instanceof TypeError ? s.value = "network" : s.value = "generic", n.value = null;
34
- } finally {
35
- c.value = !1;
36
- }
37
- };
38
- return T(() => {
39
- C();
40
- }), (e, a) => (r(), p("div", B, [
41
- n.value ? (r(), p("div", S, [
42
- u(t(z), { xml: n.value }, null, 8, ["xml"])
43
- ])) : c.value ? (r(), p("div", V, i(t(l)("Chargement de l'aperçu XML...")), 1)) : _.value ? (r(), m(h, {
44
- key: 2,
45
- type: "warning",
46
- class: "flex items-center space-x-2"
47
- }, {
48
- default: f(() => [
49
- u(t(v), { class: "shrink-0 size-6" }),
50
- d("span", null, i(y.value ? t(l)("Fichier XML trop volumineux pour l'aperçu. Pour consulter le fichier complet, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.") : t(l)("L'aperçu n'est pas disponible car la taille du fichier est inconnue. Pour consulter le fichier complet, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.")), 1)
51
- ]),
52
- _: 1
53
- })) : s.value === "network" ? (r(), m(h, {
54
- key: 3,
55
- type: "warning",
56
- class: "flex items-center space-x-2"
57
- }, {
58
- default: f(() => [
59
- u(t(v), { class: "shrink-0 size-6" }),
60
- d("span", null, i(t(l)("Ce fichier XML ne peut pas être prévisualisé, peut-être parce qu'il est hébergé sur un autre site qui ne l'autorise pas. Pour le consulter, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.")), 1)
61
- ]),
62
- _: 1
63
- })) : s.value ? (r(), m(h, {
64
- key: 4,
65
- type: "warning",
66
- class: "flex items-center space-x-2"
67
- }, {
68
- default: f(() => [
69
- u(t(v), { class: "shrink-0 size-6" }),
70
- d("span", null, i(t(l)("Erreur lors du chargement de l'aperçu XML.")), 1)
71
- ]),
72
- _: 1
73
- })) : P("", !0)
74
- ]));
75
- }
76
- });
77
- export {
78
- N as default
79
- };