@datagouv/components-next 1.0.2-dev.16 → 1.0.2-dev.161
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/README.md +7 -6
- package/assets/main.css +4 -0
- package/dist/{Control-DuZJdKV_.js → Control-B9WQxlpJ.js} +1 -1
- package/dist/{Datafair.client-BtQqFBTQ.js → Datafair.client-Bz1l4SLK.js} +4 -4
- package/dist/{Event--kp8kMdJ.js → Event-iXDrp-fy.js} +31 -31
- package/dist/{Image-34hvypZI.js → Image-mNMBOofs.js} +9 -9
- package/dist/ImagePreview.client-CogDiX0n.js +36 -0
- package/dist/JsonPreview.client-XwLb74J8.js +40 -0
- package/dist/{Map-BjUnLyj8.js → Map-BfqKMw0S.js} +1739 -1599
- package/dist/{MapContainer.client-DB6p6KF8.js → MapContainer.client-DJm7fYDx.js} +38 -39
- package/dist/{OSM-s40W6sQ2.js → OSM-CcrUhItr.js} +15 -23
- package/dist/{PdfPreview.client-Dr4VcIur.js → PdfPreview.client-CoLz0aZp.js} +823 -855
- package/dist/Pmtiles.client-bKmHL2Qg.js +26324 -0
- package/dist/PreviewWrapper.vue_vue_type_script_setup_true_lang-CxXJ7rC5.js +58 -0
- package/dist/{ScaleLine-KW-nXqp3.js → ScaleLine-VGQ7nkMS.js} +2 -2
- package/dist/{Tile-DbNFNPfU.js → Tile-CSpn0Ca8.js} +160 -163
- package/dist/{TileImage-BsXBxMtq.js → TileImage-CpbaEFwd.js} +143 -131
- package/dist/{View-BR92hTWP.js → View-BYBpt-AU.js} +483 -422
- package/dist/XmlPreview.client-Baetgqam.js +34 -0
- package/dist/{common-PJfpC179.js → common-BoeTUnDZ.js} +52 -52
- package/dist/components-next.css +1 -52
- package/dist/components-next.js +182 -146
- package/dist/components.css +2 -2
- package/dist/{index-D3rieddI.js → index-Crp28Eov.js} +21834 -15810
- package/dist/{leaflet-src-7m1mB8LI.js → leaflet-src-CRXb3b2x.js} +185 -187
- package/dist/main-Cmq8fQdM.js +73989 -0
- package/dist/{proj-DsetBcW7.js → proj-DxGbobp7.js} +662 -626
- package/dist/{text-clamp.esm-B5kW_XMt.js → text-clamp.esm-DVseBqZZ.js} +4 -4
- package/dist/{tilecoord-Db24Px13.js → tilecoord-DvX7WWiA.js} +273 -264
- package/dist/{vue3-json-viewer-BXwup7nO.js → vue3-json-viewer-CJLQFzXZ.js} +10 -16
- package/dist/{vue3-xml-viewer.common-CJXShyPB.js → vue3-xml-viewer.common-H2czi46-.js} +16 -16
- package/package.json +50 -37
- package/src/chart.ts +5 -0
- package/src/components/ActivityList/ActivityList.vue +3 -2
- package/src/components/Chart/ChartViewer.vue +320 -0
- package/src/components/Chart/ChartViewerWrapper.vue +182 -0
- package/src/components/DataserviceCard.vue +9 -0
- package/src/components/DataserviceQuality.vue +82 -0
- package/src/components/DataserviceQualityInline.vue +31 -0
- package/src/components/DataserviceQualityTooltipContent.vue +79 -0
- package/src/components/DatasetCard.vue +9 -4
- package/src/components/DatasetQuality.vue +11 -11
- package/src/components/DatasetQualityInline.vue +2 -2
- package/src/components/DatasetQualityTooltipContent.vue +1 -1
- package/src/components/Form/Listbox.vue +101 -0
- package/src/components/Form/SearchableSelect.vue +2 -1
- package/src/components/InfiniteLoader.vue +53 -0
- package/src/components/ObjectCardHeader.vue +11 -4
- package/src/components/OpenApiViewer/ContentTypeSelect.vue +48 -0
- package/src/components/OpenApiViewer/EndpointRequest.vue +164 -0
- package/src/components/OpenApiViewer/EndpointResponses.vue +149 -0
- package/src/components/OpenApiViewer/OpenApiViewer.vue +308 -0
- package/src/components/OpenApiViewer/SchemaPanel.vue +53 -0
- package/src/components/OpenApiViewer/SchemaTree.vue +77 -0
- package/src/components/OpenApiViewer/openapi.ts +150 -0
- package/src/components/OrganizationNameWithCertificate.vue +3 -2
- package/src/components/Pagination.vue +8 -5
- package/src/components/RadioInput.vue +7 -2
- package/src/components/ResourceAccordion/DataStructure.vue +11 -33
- package/src/components/ResourceAccordion/Downloads.vue +160 -0
- package/src/components/ResourceAccordion/ImagePreview.client.vue +48 -0
- package/src/components/ResourceAccordion/JsonPreview.client.vue +23 -104
- package/src/components/ResourceAccordion/MapContainer.client.vue +1 -3
- package/src/components/ResourceAccordion/Metadata.vue +1 -2
- package/src/components/ResourceAccordion/PdfPreview.client.vue +24 -87
- package/src/components/ResourceAccordion/Pmtiles.client.vue +3 -1
- package/src/components/ResourceAccordion/Preview.vue +11 -11
- package/src/components/ResourceAccordion/PreviewWrapper.vue +82 -0
- package/src/components/ResourceAccordion/ResourceAccordion.vue +19 -113
- package/src/components/ResourceAccordion/XmlPreview.client.vue +16 -98
- package/src/components/ResourceExplorer/ResourceExplorer.vue +22 -19
- package/src/components/ResourceExplorer/ResourceExplorerSidebar.vue +2 -2
- package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +64 -148
- package/src/components/ResourceExplorer/ResourceSelector.vue +113 -0
- package/src/components/ReuseCard.vue +14 -6
- package/src/components/ReuseDetails.vue +2 -2
- package/src/components/ReuseHorizontalCard.vue +2 -2
- package/src/components/Search/GlobalSearch.vue +219 -117
- package/src/components/Search/SearchInput.vue +5 -4
- package/src/components/TabularExplorer/TabularCell.vue +51 -0
- package/src/components/TabularExplorer/TabularCellPopover.vue +170 -0
- package/src/components/TabularExplorer/TabularExplorer.vue +1132 -0
- package/src/components/TabularExplorer/TabularFilterContent.vue +353 -0
- package/src/components/TabularExplorer/TabularFilterPopover.vue +106 -0
- package/src/components/TabularExplorer/types.ts +86 -0
- package/src/composables/useHasTabularData.ts +15 -1
- package/src/composables/useMetrics.ts +1 -1
- package/src/composables/useResourceCapabilities.ts +28 -15
- package/src/composables/useSearchFilter.ts +120 -0
- package/src/composables/useStableQueryParams.ts +38 -6
- package/src/composables/useTabularProfile.ts +70 -0
- package/src/config.ts +21 -3
- package/src/functions/activities.ts +3 -3
- package/src/functions/api.ts +20 -42
- package/src/functions/api.types.ts +1 -0
- package/src/functions/charts.ts +95 -0
- package/src/functions/datasets.ts +0 -17
- package/src/functions/dates.ts +3 -2
- package/src/functions/metrics.ts +6 -4
- package/src/functions/resources.ts +117 -1
- package/src/functions/tabular.ts +171 -0
- package/src/functions/tabularApi.ts +96 -11
- package/src/main.ts +107 -14
- package/src/types/dataservices.ts +17 -0
- package/src/types/organizations.ts +10 -0
- package/src/types/pages.ts +0 -5
- package/src/types/posts.ts +2 -2
- package/src/types/reports.ts +5 -1
- package/src/types/resources.ts +0 -1
- package/src/types/reuses.ts +12 -1
- package/src/types/search.ts +63 -1
- package/src/types/site.ts +5 -3
- package/src/types/ui.ts +2 -0
- package/src/types/users.ts +2 -1
- package/src/types/visualizations.ts +93 -0
- package/assets/swagger-themes/newspaper.css +0 -1670
- package/dist/JsonPreview.client-DojrmGyU.js +0 -72
- package/dist/Pmtiles.client-DbMjfK00.js +0 -25185
- package/dist/Swagger.client-Db_xYKJv.js +0 -4
- package/dist/XmlPreview.client-CHxSFhd7.js +0 -64
- package/dist/main-D70Xt4a7.js +0 -105854
- package/src/components/ResourceAccordion/Swagger.client.vue +0 -48
- package/src/functions/pagination.ts +0 -9
- /package/src/components/{DatasetQualityItem.vue → QualityItem.vue} +0 -0
- /package/src/components/{DatasetQualityItemWarning.vue → QualityItemWarning.vue} +0 -0
- /package/src/components/{DatasetQualityScore.vue → QualityScore.vue} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as T, ref as k, onMounted as J, h as g, watch as F, computed as O, inject as $, provide as q,
|
|
1
|
+
import { defineComponent as T, ref as k, onMounted as J, h as g, watch as F, computed as O, inject as $, provide as q, openBlock as _, createElementBlock as N, toDisplayString as A, normalizeClass as S, resolveComponent as ie, createElementVNode as z, renderSlot as ce, createTextVNode as pe, createCommentVNode as Y, createVNode as fe, nextTick as de } from "vue";
|
|
2
2
|
const ve = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/, X = T({
|
|
3
3
|
name: "JsonString",
|
|
4
4
|
props: {
|
|
@@ -66,7 +66,7 @@ const ve = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)
|
|
|
66
66
|
},
|
|
67
67
|
setup(e) {
|
|
68
68
|
const y = e, c = O(() => y.jsonValue === null ? "null" : "undefined");
|
|
69
|
-
return (p, d) => (
|
|
69
|
+
return (p, d) => (_(), N("span", ye, A(c.value), 1));
|
|
70
70
|
}
|
|
71
71
|
}), he = /* @__PURE__ */ T({
|
|
72
72
|
__name: "json-number",
|
|
@@ -79,7 +79,7 @@ const ve = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)
|
|
|
79
79
|
},
|
|
80
80
|
setup(e) {
|
|
81
81
|
const y = e, c = O(() => Number.isInteger(y.jsonValue));
|
|
82
|
-
return (p, d) => (
|
|
82
|
+
return (p, d) => (_(), N("span", {
|
|
83
83
|
class: S(["jv-item", "jv-number", c.value ? "jv-number-integer" : "jv-number-float"])
|
|
84
84
|
}, A(e.jsonValue.toString()), 3));
|
|
85
85
|
}
|
|
@@ -95,7 +95,7 @@ const ve = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)
|
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
setup(e) {
|
|
98
|
-
return (y, c) => (
|
|
98
|
+
return (y, c) => (_(), N("span", ge, A(e.jsonValue.toString()), 1));
|
|
99
99
|
}
|
|
100
100
|
}), je = T({
|
|
101
101
|
name: "JsonObject",
|
|
@@ -277,7 +277,7 @@ const ve = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)
|
|
|
277
277
|
}
|
|
278
278
|
},
|
|
279
279
|
setup(e) {
|
|
280
|
-
return (y, c) => (
|
|
280
|
+
return (y, c) => (_(), N("span", {
|
|
281
281
|
class: S(["jv-item", "jv-function"]),
|
|
282
282
|
title: e.jsonValue.toString()
|
|
283
283
|
}, " <function> ", 8, Ee));
|
|
@@ -295,7 +295,7 @@ const ve = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)
|
|
|
295
295
|
},
|
|
296
296
|
setup(e) {
|
|
297
297
|
const y = e, c = $("timeformat", (d) => d.toLocaleString()), p = O(() => c(y.jsonValue));
|
|
298
|
-
return (d, i) => (
|
|
298
|
+
return (d, i) => (_(), N("span", ke, ' "' + A(p.value) + '" ', 1));
|
|
299
299
|
}
|
|
300
300
|
}), Te = {
|
|
301
301
|
class: /* @__PURE__ */ S(["jv-item", "jv-regexp"])
|
|
@@ -309,7 +309,7 @@ const ve = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)
|
|
|
309
309
|
}
|
|
310
310
|
},
|
|
311
311
|
setup(e) {
|
|
312
|
-
return (y, c) => (
|
|
312
|
+
return (y, c) => (_(), N("span", Te, A(e.jsonValue.toString()), 1));
|
|
313
313
|
}
|
|
314
314
|
}), I = T({
|
|
315
315
|
name: "JsonBox",
|
|
@@ -421,12 +421,6 @@ function _e(e) {
|
|
|
421
421
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
422
422
|
}
|
|
423
423
|
var H = { exports: {} };
|
|
424
|
-
/*!
|
|
425
|
-
* clipboard.js v2.0.11
|
|
426
|
-
* https://clipboardjs.com/
|
|
427
|
-
*
|
|
428
|
-
* Licensed MIT © Zeno Rocha
|
|
429
|
-
*/
|
|
430
424
|
var Ne = H.exports, Z;
|
|
431
425
|
function Oe() {
|
|
432
426
|
return Z || (Z = 1, (function(e, y) {
|
|
@@ -1041,10 +1035,10 @@ const Me = /* @__PURE__ */ _e(Ae), Ve = function(e, y) {
|
|
|
1041
1035
|
};
|
|
1042
1036
|
function Re(e, y, c, p, d, i) {
|
|
1043
1037
|
const n = ie("json-box");
|
|
1044
|
-
return
|
|
1038
|
+
return _(), N("div", {
|
|
1045
1039
|
class: S(e.jvClass)
|
|
1046
1040
|
}, [
|
|
1047
|
-
e.copyable ? (
|
|
1041
|
+
e.copyable ? (_(), N("div", {
|
|
1048
1042
|
key: 0,
|
|
1049
1043
|
class: S(`jv-tooltip ${e.copyText.align || "right"}`)
|
|
1050
1044
|
}, [
|
|
@@ -1067,7 +1061,7 @@ function Re(e, y, c, p, d, i) {
|
|
|
1067
1061
|
"preview-mode": e.previewMode
|
|
1068
1062
|
}, null, 8, ["value", "sort", "preview-mode"])
|
|
1069
1063
|
], 2),
|
|
1070
|
-
e.expandableCode && e.boxed ? (
|
|
1064
|
+
e.expandableCode && e.boxed ? (_(), N("div", {
|
|
1071
1065
|
key: 1,
|
|
1072
1066
|
class: "jv-more",
|
|
1073
1067
|
onClick: y[0] || (y[0] = (...t) => e.toggleExpandCode && e.toggleExpandCode(...t))
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as Ke } from "./main-Cmq8fQdM.js";
|
|
2
2
|
import We from "vue";
|
|
3
|
-
function Fe(
|
|
3
|
+
function Fe($, K) {
|
|
4
4
|
for (var V = 0; V < K.length; V++) {
|
|
5
5
|
const p = K[V];
|
|
6
6
|
if (typeof p != "string" && !Array.isArray(p)) {
|
|
7
7
|
for (const X in p)
|
|
8
|
-
if (X !== "default" && !(X in
|
|
8
|
+
if (X !== "default" && !(X in $)) {
|
|
9
9
|
const _ = Object.getOwnPropertyDescriptor(p, X);
|
|
10
|
-
_ && Object.defineProperty(
|
|
10
|
+
_ && Object.defineProperty($, X, _.get ? _ : {
|
|
11
11
|
enumerable: !0,
|
|
12
12
|
get: () => p[X]
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
return Object.freeze(Object.defineProperty(
|
|
17
|
+
return Object.freeze(Object.defineProperty($, Symbol.toStringTag, { value: "Module" }));
|
|
18
18
|
}
|
|
19
19
|
var Y = { exports: {} }, ee;
|
|
20
20
|
function ze() {
|
|
21
|
-
return ee || (ee = 1, (function(
|
|
21
|
+
return ee || (ee = 1, (function($) {
|
|
22
22
|
(function() {
|
|
23
23
|
var K = {
|
|
24
24
|
/***/
|
|
@@ -426,7 +426,7 @@ function ze() {
|
|
|
426
426
|
default: function() {
|
|
427
427
|
return (
|
|
428
428
|
/* binding */
|
|
429
|
-
|
|
429
|
+
$e
|
|
430
430
|
);
|
|
431
431
|
}
|
|
432
432
|
}), typeof window < "u") {
|
|
@@ -466,7 +466,7 @@ function ze() {
|
|
|
466
466
|
class: "bracket"
|
|
467
467
|
}, ">", -1));
|
|
468
468
|
function G(o, v, g, E, h, b) {
|
|
469
|
-
const y = (0, e.resolveComponent)("CaretDown"), S = (0, e.resolveComponent)("CaretRight"),
|
|
469
|
+
const y = (0, e.resolveComponent)("CaretDown"), S = (0, e.resolveComponent)("CaretRight"), I = (0, e.resolveComponent)("XmlElementName"), Q = (0, e.resolveComponent)("XmlAttributeLine"), q = (0, e.resolveComponent)("XmlElement", !0), B = (0, e.resolveComponent)("XmlElementContent"), je = (0, e.resolveComponent)("XmlCDataSection"), Ue = (0, e.resolveComponent)("XmlRemark");
|
|
470
470
|
return (0, e.openBlock)(), (0, e.createElementBlock)("div", r, [(0, e.createElementVNode)("div", null, [o.selfClosing ? (0, e.createCommentVNode)("", !0) : ((0, e.openBlock)(), (0, e.createElementBlock)(e.Fragment, {
|
|
471
471
|
key: 0
|
|
472
472
|
}, [o.collapsed ? ((0, e.openBlock)(), (0, e.createBlock)(S, {
|
|
@@ -477,7 +477,7 @@ function ze() {
|
|
|
477
477
|
key: 0,
|
|
478
478
|
class: "caret",
|
|
479
479
|
onClick: o.toggleCollapsed
|
|
480
|
-
}, null, 8, ["onClick"]))], 64)), u, (0, e.createVNode)(
|
|
480
|
+
}, null, 8, ["onClick"]))], 64)), u, (0, e.createVNode)(I, {
|
|
481
481
|
class: "clickable",
|
|
482
482
|
name: o.name,
|
|
483
483
|
onClick: o.toggleCollapsed
|
|
@@ -496,7 +496,7 @@ function ze() {
|
|
|
496
496
|
}, null, 8, ["cdataSection"]))), 128)), ((0, e.openBlock)(!0), (0, e.createElementBlock)(e.Fragment, null, (0, e.renderList)(o.remarks, (L, N) => ((0, e.openBlock)(), (0, e.createBlock)(Ue, {
|
|
497
497
|
key: `r${N}`,
|
|
498
498
|
remark: L
|
|
499
|
-
}, null, 8, ["remark"]))), 128))])])), !o.selfClosing && !o.collapsed ? ((0, e.openBlock)(), (0, e.createElementBlock)("div", w, [O, (0, e.createVNode)(
|
|
499
|
+
}, null, 8, ["remark"]))), 128))])])), !o.selfClosing && !o.collapsed ? ((0, e.openBlock)(), (0, e.createElementBlock)("div", w, [O, (0, e.createVNode)(I, {
|
|
500
500
|
name: o.name,
|
|
501
501
|
closing: !0
|
|
502
502
|
}, null, 8, ["name"]), f])) : (0, e.createCommentVNode)("", !0)]);
|
|
@@ -549,8 +549,8 @@ function ze() {
|
|
|
549
549
|
var c = /* @__PURE__ */ (0, M.A)(d, [["render", m], ["__scopeId", "data-v-75f773a5"]]);
|
|
550
550
|
function D(o, v, g, E, h, b) {
|
|
551
551
|
const y = (0, e.resolveComponent)("XmlAttribute");
|
|
552
|
-
return (0, e.openBlock)(), (0, e.createElementBlock)("span", null, [((0, e.openBlock)(!0), (0, e.createElementBlock)(e.Fragment, null, (0, e.renderList)(o.attributes, (S,
|
|
553
|
-
key:
|
|
552
|
+
return (0, e.openBlock)(), (0, e.createElementBlock)("span", null, [((0, e.openBlock)(!0), (0, e.createElementBlock)(e.Fragment, null, (0, e.renderList)(o.attributes, (S, I) => ((0, e.openBlock)(), (0, e.createBlock)(y, {
|
|
553
|
+
key: I,
|
|
554
554
|
attribute: S
|
|
555
555
|
}, null, 8, ["attribute"]))), 128))]);
|
|
556
556
|
}
|
|
@@ -705,12 +705,12 @@ function ze() {
|
|
|
705
705
|
node: Element
|
|
706
706
|
},
|
|
707
707
|
setup(o) {
|
|
708
|
-
const v = (0, e.ref)(!1), g = (0, e.computed)(() => o.node.nodeName), E = (0, e.computed)(() => Array.from(o.node.childNodes)), h = (0, e.computed)(() => E.value && E.value.filter((B) => B.nodeType === 1)), b = (0, e.computed)(() => E.value && E.value.filter((B) => B.nodeType === 3)), y = (0, e.computed)(() => E.value && E.value.filter((B) => B.nodeType === 4)), S = (0, e.computed)(() => E.value && E.value.filter((B) => B.nodeType === 8)),
|
|
708
|
+
const v = (0, e.ref)(!1), g = (0, e.computed)(() => o.node.nodeName), E = (0, e.computed)(() => Array.from(o.node.childNodes)), h = (0, e.computed)(() => E.value && E.value.filter((B) => B.nodeType === 1)), b = (0, e.computed)(() => E.value && E.value.filter((B) => B.nodeType === 3)), y = (0, e.computed)(() => E.value && E.value.filter((B) => B.nodeType === 4)), S = (0, e.computed)(() => E.value && E.value.filter((B) => B.nodeType === 8)), I = (0, e.computed)(() => o.node.attributes && Array.from(o.node.attributes) || []), Q = !h.value.length && !b.value.length && !y.value.length && !S.value.length;
|
|
709
709
|
return {
|
|
710
710
|
name: g,
|
|
711
711
|
childElements: h,
|
|
712
712
|
childContents: b,
|
|
713
|
-
attributes:
|
|
713
|
+
attributes: I,
|
|
714
714
|
cdataSections: y,
|
|
715
715
|
remarks: S,
|
|
716
716
|
selfClosing: Q,
|
|
@@ -744,8 +744,8 @@ function ze() {
|
|
|
744
744
|
rootNode: g
|
|
745
745
|
};
|
|
746
746
|
}
|
|
747
|
-
}), Ve = /* @__PURE__ */ (0, M.A)(Ne, [["render", t]]),
|
|
748
|
-
})(),
|
|
747
|
+
}), Ve = /* @__PURE__ */ (0, M.A)(Ne, [["render", t]]), Ie = Ve, $e = Ie;
|
|
748
|
+
})(), $.exports = X;
|
|
749
749
|
})();
|
|
750
750
|
})(Y)), Y.exports;
|
|
751
751
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagouv/components-next",
|
|
3
|
-
"version": "1.0.2-dev.
|
|
3
|
+
"version": "1.0.2-dev.161",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -10,29 +10,37 @@
|
|
|
10
10
|
"yarn": "use-pnpm-instead"
|
|
11
11
|
},
|
|
12
12
|
"main": "./src/main.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": "./src/main.ts",
|
|
15
|
+
"./chart": "./src/chart.ts",
|
|
16
|
+
"./assets/*": "./assets/*",
|
|
17
|
+
"./dist/*": "./dist/*"
|
|
18
|
+
},
|
|
19
|
+
"sideEffects": false,
|
|
13
20
|
"files": [
|
|
14
21
|
"assets",
|
|
15
22
|
"dist",
|
|
16
23
|
"src"
|
|
17
24
|
],
|
|
18
25
|
"dependencies": {
|
|
19
|
-
"@floating-ui/vue": "^
|
|
20
|
-
"@types/leaflet": "^1.9.17",
|
|
26
|
+
"@floating-ui/vue": "^2.0.1",
|
|
21
27
|
"@headlessui/vue": "^1.7.23",
|
|
22
|
-
"@remixicon/vue": "^4.
|
|
28
|
+
"@remixicon/vue": "^4.9.0",
|
|
23
29
|
"@types/hast": "^3.0.4",
|
|
24
|
-
"@
|
|
25
|
-
"@vueuse/
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
30
|
+
"@types/leaflet": "^1.9.21",
|
|
31
|
+
"@vueuse/core": "^14.3.0",
|
|
32
|
+
"@vueuse/router": "^14.3.0",
|
|
33
|
+
"chart.js": "^4.5.1",
|
|
34
|
+
"dompurify": "^3.4.11",
|
|
35
|
+
"echarts": "^6.1.0",
|
|
36
|
+
"geopf-extensions-openlayers": "1.0.0-beta.11",
|
|
29
37
|
"leaflet": "^1.9.4",
|
|
30
|
-
"maplibre-gl": "^5.
|
|
31
|
-
"ofetch": "^1.
|
|
32
|
-
"ol": "^10.
|
|
38
|
+
"maplibre-gl": "^5.24.0",
|
|
39
|
+
"ofetch": "^1.5.1",
|
|
40
|
+
"ol": "^10.9.0",
|
|
33
41
|
"pdfjs-dist": "^4.10.38",
|
|
34
|
-
"pmtiles": "^4.
|
|
35
|
-
"popmotion": "^11.0",
|
|
42
|
+
"pmtiles": "^4.4.1",
|
|
43
|
+
"popmotion": "^11.0.5",
|
|
36
44
|
"rehype-highlight": "^7.0.2",
|
|
37
45
|
"rehype-raw": "^7.0.0",
|
|
38
46
|
"rehype-sanitize": "^6.0.0",
|
|
@@ -45,38 +53,43 @@
|
|
|
45
53
|
"remark-rehype": "^11.1.2",
|
|
46
54
|
"strip-markdown": "^6.0.0",
|
|
47
55
|
"stylefire": "^7.0.3",
|
|
48
|
-
"swagger-ui-dist": "^5.27.1",
|
|
49
56
|
"unified": "^11.0.5",
|
|
50
|
-
"unist-util-visit": "^5.
|
|
51
|
-
"vue": "^3.5.13",
|
|
57
|
+
"unist-util-visit": "^5.1.0",
|
|
52
58
|
"vue-content-loader": "^2.0.1",
|
|
53
|
-
"vue-router": "^4.5.0",
|
|
54
59
|
"vue-sonner": "^2.0.9",
|
|
55
60
|
"vue3-json-viewer": "^2.4.1",
|
|
56
61
|
"vue3-text-clamp": "^0.1.2",
|
|
57
|
-
"vue3-xml-viewer": "^0.0.14"
|
|
62
|
+
"vue3-xml-viewer": "^0.0.14",
|
|
63
|
+
"yaml": "^2.9.0"
|
|
58
64
|
},
|
|
59
65
|
"devDependencies": {
|
|
60
|
-
"@
|
|
61
|
-
"@tailwindcss/
|
|
62
|
-
"@
|
|
63
|
-
"@tsconfig/node22": "^22.0.0",
|
|
66
|
+
"@tailwindcss/cli": "^4.3.0",
|
|
67
|
+
"@tailwindcss/typography": "^0.5.19",
|
|
68
|
+
"@tsconfig/node22": "^22.0.5",
|
|
64
69
|
"@types/geojson": "^7946.0.16",
|
|
65
|
-
"@types/node": "^22.
|
|
66
|
-
"@vitejs/plugin-vue": "^6.0",
|
|
70
|
+
"@types/node": "^22.19.19",
|
|
71
|
+
"@vitejs/plugin-vue": "^6.0.7",
|
|
67
72
|
"@vue/eslint-config-prettier": "^10.2.0",
|
|
68
|
-
"@vue/eslint-config-typescript": "^14.
|
|
69
|
-
"@vue/tsconfig": "^0.8.
|
|
70
|
-
"eslint": "^9.
|
|
71
|
-
"eslint-plugin-vue": "^10.
|
|
72
|
-
"jiti": "^2.
|
|
73
|
-
"npm-run-all2": "^8.0",
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"vite
|
|
79
|
-
"vue-
|
|
73
|
+
"@vue/eslint-config-typescript": "^14.7.0",
|
|
74
|
+
"@vue/tsconfig": "^0.8.1",
|
|
75
|
+
"eslint": "^9.39.4",
|
|
76
|
+
"eslint-plugin-vue": "^10.9.1",
|
|
77
|
+
"jiti": "^2.7.0",
|
|
78
|
+
"npm-run-all2": "^8.0.4",
|
|
79
|
+
"openapi-types": "^12.1.3",
|
|
80
|
+
"prettier": "^3.8.3",
|
|
81
|
+
"tailwindcss": "^4.3.0",
|
|
82
|
+
"typescript": "^5.9.3",
|
|
83
|
+
"vite": "^7.3.3",
|
|
84
|
+
"vite-plugin-vue-devtools": "^8.1.2",
|
|
85
|
+
"vue": "^3.5.40",
|
|
86
|
+
"vue-router": "^5.0.7",
|
|
87
|
+
"vue-tsc": "^3.3.2"
|
|
88
|
+
},
|
|
89
|
+
"peerDependencies": {
|
|
90
|
+
"vue": "^3.5.13",
|
|
91
|
+
"vue-router": "^4.5.0 || ^5.0.0",
|
|
92
|
+
"echarts": "^6.0.0"
|
|
80
93
|
},
|
|
81
94
|
"scarfSettings": {
|
|
82
95
|
"enabled": false
|
package/src/chart.ts
ADDED
|
@@ -77,6 +77,9 @@
|
|
|
77
77
|
v-bind="{ class: '', activity }"
|
|
78
78
|
>
|
|
79
79
|
{{ getActivityTranslation(activity) }}
|
|
80
|
+
<template v-if="'resource_id' in activity.extras">
|
|
81
|
+
{{ activity.extras.resource_id }}
|
|
82
|
+
</template>
|
|
80
83
|
</slot>
|
|
81
84
|
</p>
|
|
82
85
|
<p class="m-0 flex-none text-xs text-gray-medium">
|
|
@@ -90,7 +93,6 @@
|
|
|
90
93
|
:total-results="activities.total"
|
|
91
94
|
:page-size="activities.page_size"
|
|
92
95
|
:page="activities.page"
|
|
93
|
-
:link="getLink"
|
|
94
96
|
@change="(newPage: number) => page = newPage"
|
|
95
97
|
/>
|
|
96
98
|
</template>
|
|
@@ -117,7 +119,6 @@ import { useTranslation } from '../../composables/useTranslation'
|
|
|
117
119
|
import { getActivityTranslation } from '../../functions/activities'
|
|
118
120
|
import { useFetch } from '../../functions/api'
|
|
119
121
|
import { useFormatDate } from '../../functions/dates'
|
|
120
|
-
import { getLink } from '../../functions/pagination'
|
|
121
122
|
import type { PaginatedArray } from '../../types/api'
|
|
122
123
|
import type { Activity } from '../../types/activity'
|
|
123
124
|
import Avatar from '../Avatar.vue'
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="chartContainer"
|
|
4
|
+
class="w-full min-h-96"
|
|
5
|
+
/>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import { format, use, type ComposeOption } from 'echarts/core'
|
|
10
|
+
import { CanvasRenderer } from 'echarts/renderers'
|
|
11
|
+
import { LineChart, BarChart, type BarSeriesOption, type LineSeriesOption } from 'echarts/charts'
|
|
12
|
+
import { TitleComponent, TooltipComponent, LegendComponent, GridComponent, DatasetComponent } from 'echarts/components'
|
|
13
|
+
import { init, type ECharts as EChartsType } from 'echarts'
|
|
14
|
+
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
|
|
15
|
+
import { summarize } from '../../functions/helpers'
|
|
16
|
+
import { useFormatDate } from '../../functions/dates'
|
|
17
|
+
import type { Chart, ColumnDefinition, ColumnsDefinition, XAxis, YAxis, XAxisForm, ChartForApi } from '../../types/visualizations'
|
|
18
|
+
import { useTranslation } from '../../composables/useTranslation'
|
|
19
|
+
|
|
20
|
+
use([CanvasRenderer, LineChart, BarChart, TitleComponent, TooltipComponent, LegendComponent, GridComponent, DatasetComponent])
|
|
21
|
+
|
|
22
|
+
const props = defineProps<{
|
|
23
|
+
chart: Chart | ChartForApi
|
|
24
|
+
series: {
|
|
25
|
+
data: Record<string, Array<Record<string, unknown>>>
|
|
26
|
+
columns: ColumnsDefinition
|
|
27
|
+
}
|
|
28
|
+
}>()
|
|
29
|
+
|
|
30
|
+
const { locale } = useTranslation()
|
|
31
|
+
const { formatDate } = useFormatDate()
|
|
32
|
+
const chartContainer = ref<HTMLElement | null>(null)
|
|
33
|
+
let echartsInstance: EChartsType | null = null
|
|
34
|
+
|
|
35
|
+
function capture(): string | null {
|
|
36
|
+
return echartsInstance?.getDataURL() ?? null
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
defineExpose({ capture })
|
|
40
|
+
|
|
41
|
+
// ECharts has a dedicated 'time' axis type for continuous date values.
|
|
42
|
+
function mapXAxisType(xAxis: XAxis | XAxisForm): 'category' | 'value' | 'time' {
|
|
43
|
+
if (!xAxis) return 'category'
|
|
44
|
+
if (xAxis.type !== 'continuous') return 'category'
|
|
45
|
+
return isDateAxis.value ? 'time' : 'value'
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function buildYAxisFormatter(yAxis: YAxis): ((value: number) => string) | undefined {
|
|
49
|
+
return (value: number) => {
|
|
50
|
+
const v = summarize(value)
|
|
51
|
+
if (!yAxis.unit) return v
|
|
52
|
+
if (yAxis.unit_position === 'prefix') return `${yAxis.unit} ${v}`
|
|
53
|
+
return `${v} ${yAxis.unit}`
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function buildXAxisFormatter(column: ColumnDefinition | null, options?: Intl.DateTimeFormatOptions): ((value: string | number | Date) => string) | undefined {
|
|
58
|
+
if (column?.type !== 'date') return undefined
|
|
59
|
+
return (value: string | number | Date) => {
|
|
60
|
+
if (value === null || value === undefined) return ''
|
|
61
|
+
const date = value instanceof Date ? value : new Date(value)
|
|
62
|
+
if (Number.isNaN(date.getTime())) return String(value)
|
|
63
|
+
return formatDate(date, options ?? { dateStyle: 'short' })
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function parseXValueAsDate(row: Record<string, unknown>, xColumn: string): Record<string, unknown> {
|
|
68
|
+
const value = row[xColumn]
|
|
69
|
+
if (value === null || value === undefined || value instanceof Date) return row
|
|
70
|
+
if (typeof value === 'string') {
|
|
71
|
+
const date = new Date(value)
|
|
72
|
+
if (!Number.isNaN(date.getTime())) {
|
|
73
|
+
return { ...row, [xColumn]: date }
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return row
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const xAxisColumn = computed(() => {
|
|
80
|
+
const columnName = props.chart.x_axis.column_x
|
|
81
|
+
if (!columnName) return null
|
|
82
|
+
for (const columns of Object.values(props.series.columns)) {
|
|
83
|
+
const column = columns.find(c => c.name === columnName)
|
|
84
|
+
if (column) return column
|
|
85
|
+
}
|
|
86
|
+
return null
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
const isDateAxis = computed(() => xAxisColumn.value?.type === 'date')
|
|
90
|
+
|
|
91
|
+
const xAxisBounds = computed(() => {
|
|
92
|
+
const columnName = props.chart.x_axis.column_x
|
|
93
|
+
if (!columnName) return { min: undefined, max: undefined }
|
|
94
|
+
|
|
95
|
+
let min: number | undefined
|
|
96
|
+
let max: number | undefined
|
|
97
|
+
|
|
98
|
+
for (const s of props.chart.series) {
|
|
99
|
+
const xColumn = s.column_x_name_override ?? columnName
|
|
100
|
+
const data = props.series.data[s.resource_id]
|
|
101
|
+
if (!data) continue
|
|
102
|
+
|
|
103
|
+
for (const row of data) {
|
|
104
|
+
const value = row[xColumn]
|
|
105
|
+
if (value === null || value === undefined) continue
|
|
106
|
+
|
|
107
|
+
let numericValue: number | undefined
|
|
108
|
+
if (value instanceof Date) {
|
|
109
|
+
numericValue = value.getTime()
|
|
110
|
+
}
|
|
111
|
+
else if (isDateAxis.value && typeof value === 'string') {
|
|
112
|
+
numericValue = new Date(value).getTime()
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
numericValue = Number(value)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (numericValue === undefined || Number.isNaN(numericValue)) continue
|
|
119
|
+
|
|
120
|
+
if (min === undefined || numericValue < min) min = numericValue
|
|
121
|
+
if (max === undefined || numericValue > max) max = numericValue
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return { min, max }
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
const echartsOption = computed(() => {
|
|
129
|
+
const seriesCount = props.chart.series.length
|
|
130
|
+
if (!props.chart.series || seriesCount === 0) return
|
|
131
|
+
|
|
132
|
+
const seriesArray = props.chart.series.map((s) => {
|
|
133
|
+
const xColumn = s.column_x_name_override ?? props.chart.x_axis.column_x
|
|
134
|
+
const yColumn = s.aggregate_y ? `${s.column_y}__${s.aggregate_y}` : s.column_y
|
|
135
|
+
const resourceId = s.resource_id
|
|
136
|
+
|
|
137
|
+
const resourceColumns = props.series.columns[resourceId]
|
|
138
|
+
if (!xColumn || !yColumn || !resourceId || !s.type || !props.series.data[resourceId] || !resourceColumns) {
|
|
139
|
+
return null
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const rawData = props.series.data[resourceId]
|
|
143
|
+
const sortedData = isDateAxis.value
|
|
144
|
+
? rawData.map(row => parseXValueAsDate(row, xColumn))
|
|
145
|
+
: [...rawData]
|
|
146
|
+
const sortBy = props.chart.x_axis.sort_x_by ?? (isDateAxis.value ? 'axis_x' : null)
|
|
147
|
+
const sortDirection = props.chart.x_axis.sort_x_direction ?? 'asc'
|
|
148
|
+
|
|
149
|
+
if (sortBy && sortDirection && props.chart.x_axis.column_x) {
|
|
150
|
+
const sortKey = sortBy === 'axis_y' ? yColumn : xColumn
|
|
151
|
+
sortedData.sort((a, b) => {
|
|
152
|
+
const valA = a[sortKey]
|
|
153
|
+
const valB = b[sortKey]
|
|
154
|
+
|
|
155
|
+
const aNullish = valA === null || valA === undefined
|
|
156
|
+
const bNullish = valB === null || valB === undefined
|
|
157
|
+
if (aNullish && bNullish) return 0
|
|
158
|
+
if (aNullish) return sortDirection === 'asc' ? -1 : 1
|
|
159
|
+
if (bNullish) return sortDirection === 'asc' ? 1 : -1
|
|
160
|
+
|
|
161
|
+
if (valA instanceof Date && valB instanceof Date) {
|
|
162
|
+
const timeA = valA.getTime()
|
|
163
|
+
const timeB = valB.getTime()
|
|
164
|
+
if (timeA < timeB) return sortDirection === 'asc' ? -1 : 1
|
|
165
|
+
if (timeA > timeB) return sortDirection === 'asc' ? 1 : -1
|
|
166
|
+
return 0
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (typeof valA === 'boolean' && typeof valB === 'boolean') {
|
|
170
|
+
if (valA === valB) return 0
|
|
171
|
+
// false comes before true in ascending order
|
|
172
|
+
if (valB) return sortDirection === 'asc' ? -1 : 1
|
|
173
|
+
return sortDirection === 'asc' ? 1 : -1
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const numA = Number(valA)
|
|
177
|
+
const numB = Number(valB)
|
|
178
|
+
const bothNumeric = !isNaN(numA) && !isNaN(numB)
|
|
179
|
+
|
|
180
|
+
if (bothNumeric) {
|
|
181
|
+
if (numA < numB) return sortDirection === 'asc' ? -1 : 1
|
|
182
|
+
if (numA > numB) return sortDirection === 'asc' ? 1 : -1
|
|
183
|
+
return 0
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const strA = String(valA)
|
|
187
|
+
const strB = String(valB)
|
|
188
|
+
return strA.localeCompare(strB, locale, {
|
|
189
|
+
sensitivity: 'base',
|
|
190
|
+
numeric: true,
|
|
191
|
+
}) * (sortDirection === 'asc' ? 1 : -1)
|
|
192
|
+
})
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return {
|
|
196
|
+
series: {
|
|
197
|
+
type: s.type === 'histogram' ? 'bar' : 'line',
|
|
198
|
+
dimensions: s.aggregate_y ? [xColumn, yColumn] : resourceColumns.map(c => c.name),
|
|
199
|
+
name: yColumn,
|
|
200
|
+
encode: {
|
|
201
|
+
x: xColumn,
|
|
202
|
+
y: yColumn,
|
|
203
|
+
},
|
|
204
|
+
} as LineSeriesOption | BarSeriesOption,
|
|
205
|
+
data: {
|
|
206
|
+
source: sortedData,
|
|
207
|
+
dimensions: s.aggregate_y ? [xColumn, yColumn] : resourceColumns.map(c => c.name),
|
|
208
|
+
},
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
const seriesData = {
|
|
213
|
+
series: [] as Array<LineSeriesOption | BarSeriesOption>,
|
|
214
|
+
data: [] as Array<Record<string, unknown>>,
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
for (const curr of seriesArray) {
|
|
218
|
+
if (!curr) continue
|
|
219
|
+
seriesData.series.push(curr.series)
|
|
220
|
+
seriesData.data.push(curr.data)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const xAxisType = mapXAxisType(props.chart.x_axis)
|
|
224
|
+
|
|
225
|
+
return {
|
|
226
|
+
dataset: [...seriesData.data],
|
|
227
|
+
textStyle: {
|
|
228
|
+
fontFamily: 'Marianne, arial, sans-serif',
|
|
229
|
+
},
|
|
230
|
+
color: '#000091',
|
|
231
|
+
tooltip: {
|
|
232
|
+
trigger: 'axis' as const,
|
|
233
|
+
formatter: (params: Array<{ value: Record<string, unknown>, axisValueLabel: string, seriesName: string }>) => {
|
|
234
|
+
let tooltip = ''
|
|
235
|
+
const valueFormatter = new Intl.NumberFormat(locale)
|
|
236
|
+
const xAxisFormatter = buildXAxisFormatter(xAxisColumn.value, { dateStyle: 'medium' })
|
|
237
|
+
for (const param of params) {
|
|
238
|
+
const seriesName = param.seriesName
|
|
239
|
+
const axisLabel = xAxisFormatter ? xAxisFormatter(param.axisValueLabel) : param.axisValueLabel
|
|
240
|
+
tooltip += `${format.encodeHTML(String(axisLabel))}: <strong>${valueFormatter.format(Number(param.value[seriesName]))}</strong><br>`
|
|
241
|
+
}
|
|
242
|
+
return tooltip
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
legend: {
|
|
246
|
+
show: false,
|
|
247
|
+
bottom: 0,
|
|
248
|
+
},
|
|
249
|
+
grid: {
|
|
250
|
+
top: 60,
|
|
251
|
+
bottom: 40,
|
|
252
|
+
left: 20,
|
|
253
|
+
right: 20,
|
|
254
|
+
containLabel: true,
|
|
255
|
+
},
|
|
256
|
+
xAxis: {
|
|
257
|
+
type: xAxisType,
|
|
258
|
+
name: (props.chart.x_axis as XAxis).column_x,
|
|
259
|
+
min: xAxisType !== 'category' ? xAxisColumn.value?.min ?? xAxisBounds.value.min ?? undefined : undefined,
|
|
260
|
+
max: xAxisType !== 'category' ? xAxisColumn.value?.max ?? xAxisBounds.value.max ?? undefined : undefined,
|
|
261
|
+
axisLabel: xAxisType === 'time'
|
|
262
|
+
? { formatter: buildXAxisFormatter(xAxisColumn.value) }
|
|
263
|
+
: undefined,
|
|
264
|
+
},
|
|
265
|
+
yAxis: {
|
|
266
|
+
type: 'value' as const,
|
|
267
|
+
name: props.chart.y_axis.label ?? undefined,
|
|
268
|
+
min: props.chart.y_axis.min ?? undefined,
|
|
269
|
+
max: props.chart.y_axis.max ?? undefined,
|
|
270
|
+
axisLabel: {
|
|
271
|
+
formatter: buildYAxisFormatter(props.chart.y_axis),
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
series: seriesData.series,
|
|
275
|
+
} satisfies ComposeOption<
|
|
276
|
+
| BarSeriesOption
|
|
277
|
+
| LineSeriesOption
|
|
278
|
+
>
|
|
279
|
+
})
|
|
280
|
+
|
|
281
|
+
onMounted(() => {
|
|
282
|
+
if (chartContainer.value) {
|
|
283
|
+
echartsInstance = init(chartContainer.value)
|
|
284
|
+
updateChart()
|
|
285
|
+
}
|
|
286
|
+
})
|
|
287
|
+
|
|
288
|
+
onUnmounted(() => {
|
|
289
|
+
if (echartsInstance) {
|
|
290
|
+
echartsInstance.dispose()
|
|
291
|
+
echartsInstance = null
|
|
292
|
+
}
|
|
293
|
+
})
|
|
294
|
+
|
|
295
|
+
watch(() => props.chart, updateChart, { deep: true })
|
|
296
|
+
|
|
297
|
+
watch(() => props.series, updateChart, { deep: true })
|
|
298
|
+
|
|
299
|
+
function updateChart() {
|
|
300
|
+
if (!echartsInstance) return
|
|
301
|
+
const option = echartsOption.value
|
|
302
|
+
if (option) {
|
|
303
|
+
echartsInstance.setOption(option, { notMerge: true })
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const handleResize = () => {
|
|
308
|
+
if (echartsInstance) {
|
|
309
|
+
echartsInstance.resize()
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
onMounted(() => {
|
|
314
|
+
window.addEventListener('resize', handleResize)
|
|
315
|
+
})
|
|
316
|
+
|
|
317
|
+
onUnmounted(() => {
|
|
318
|
+
window.removeEventListener('resize', handleResize)
|
|
319
|
+
})
|
|
320
|
+
</script>
|