@datagouv/components-next 0.0.8 → 0.0.9
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 +34 -14
- package/assets/json/vector.json +2377 -0
- package/assets/main.css +3 -0
- package/assets/swagger-themes/newspaper.css +1669 -0
- package/assets/tailwind.config.js +1 -1
- package/dist/JsonPreview.client-BIz1_EiB.js +92 -0
- package/dist/MapContainer.client-ZDwr4Q_I.js +78276 -0
- package/dist/PdfPreview.client-BTTMM27i.js +112 -0
- package/dist/Pmtiles.client-4kOoUQcR.js +22377 -0
- package/dist/Swagger.client-Q7a5wb51.js +4 -0
- package/dist/XmlPreview.client-BYIIkDqf.js +84 -0
- package/dist/components-next.css +52 -1
- package/dist/components-next.js +42 -41
- package/dist/components.css +1 -1
- package/dist/main-CLUk9Jj7.js +105843 -0
- package/dist/pdf-vue3-BZh6kzke.js +273 -0
- package/dist/pdf.min-f72cfa08-DAetWL3M.js +9501 -0
- package/dist/{text-clamp.esm-DurZFOvT.js → text-clamp.esm-DP59tec5.js} +1 -1
- package/dist/vue3-json-viewer-DIQzFF6K.js +1089 -0
- package/dist/vue3-xml-viewer.common-BmKw6vER.js +5437 -0
- package/package.json +8 -8
- package/src/components/AvatarWithName.vue +6 -2
- package/src/components/BannerAction.vue +1 -1
- package/src/components/BrandedButton.vue +13 -8
- package/src/components/CopyButton.vue +7 -7
- package/src/components/DataserviceCard.vue +54 -23
- package/src/components/DatasetCard.vue +36 -24
- package/src/components/DatasetInformationPanel.vue +19 -18
- package/src/components/DatasetQuality.vue +21 -18
- package/src/components/DatasetQualityInline.vue +1 -1
- package/src/components/DatasetQualityItem.vue +3 -3
- package/src/components/DatasetQualityItemWarning.vue +2 -2
- package/src/components/DatasetQualityScore.vue +2 -2
- package/src/components/DatasetQualityTooltipContent.vue +29 -29
- package/src/components/DescriptionDetails.vue +2 -2
- package/src/components/ExtraAccordion.vue +10 -7
- package/src/components/OrganizationCard.vue +9 -4
- package/src/components/OrganizationNameWithCertificate.vue +25 -11
- package/src/components/Pagination.vue +26 -15
- package/src/components/ReadMore.vue +2 -2
- package/src/components/ResourceAccordion/DataStructure.vue +2 -2
- package/src/components/ResourceAccordion/EditButton.vue +10 -6
- package/src/components/ResourceAccordion/JsonPreview.client.vue +153 -0
- package/src/components/ResourceAccordion/MapContainer.client.vue +137 -0
- package/src/components/ResourceAccordion/Metadata.vue +33 -54
- package/src/components/ResourceAccordion/PdfPreview.client.vue +189 -0
- package/src/components/ResourceAccordion/Pmtiles.client.vue +166 -0
- package/src/components/ResourceAccordion/Preview.vue +39 -37
- package/src/components/ResourceAccordion/ResourceAccordion.vue +141 -63
- package/src/components/ResourceAccordion/ResourceIcon.vue +7 -1
- package/src/components/ResourceAccordion/SchemaBadge.vue +26 -26
- package/src/components/ResourceAccordion/{Swagger.vue → Swagger.client.vue} +1 -1
- package/src/components/ResourceAccordion/XmlPreview.client.vue +143 -0
- package/src/components/ReuseCard.vue +10 -7
- package/src/components/ReuseDetails.vue +3 -3
- package/src/components/SimpleBanner.vue +7 -4
- package/src/components/SmallChart.vue +23 -9
- package/src/components/StatBox.vue +92 -10
- package/src/config.ts +6 -2
- package/src/functions/api.ts +18 -18
- package/src/functions/dates.ts +81 -74
- package/src/functions/helpers.ts +5 -4
- package/src/functions/organizations.ts +5 -5
- package/src/functions/resources.ts +34 -5
- package/src/functions/schemas.ts +4 -3
- package/src/functions/tabularApi.ts +1 -1
- package/src/main.ts +10 -11
- package/src/types/badges.ts +3 -3
- package/src/types/contact_point.ts +5 -5
- package/src/types/dataservices.ts +16 -2
- package/src/types/datasets.ts +20 -2
- package/src/types/frequency.ts +5 -5
- package/src/types/granularity.ts +12 -4
- package/src/types/harvest.ts +2 -2
- package/src/types/licenses.ts +8 -8
- package/src/types/organizations.ts +6 -0
- package/src/types/resources.ts +3 -3
- package/src/types/reuses.ts +3 -1
- package/src/types/site.ts +8 -0
- package/src/types/ui.ts +2 -2
- package/src/types/users.ts +24 -8
- package/src/types/vue3-xml-viewer.d.ts +10 -0
- package/dist/Swagger-DjysB-OI.js +0 -67851
- package/dist/en-DCRve7vN.js +0 -613
- package/dist/fr-DCOnbL-p.js +0 -613
- package/dist/locales/de.js +0 -155
- package/dist/locales/en.js +0 -155
- package/dist/locales/es.js +0 -155
- package/dist/locales/fr.js +0 -155
- package/dist/locales/it.js +0 -155
- package/dist/locales/pt.js +0 -155
- package/dist/locales/sr.js +0 -155
- package/dist/main-CPW2vNLE.js +0 -32008
- package/src/components/DescriptionList/DescriptionDetails.stories.ts +0 -43
- package/src/components/DescriptionList/DescriptionList.stories.ts +0 -47
- package/src/components/DescriptionList/DescriptionTerm.stories.ts +0 -28
- package/src/locales/de.json +0 -154
- package/src/locales/en.json +0 -154
- package/src/locales/es.json +0 -154
- package/src/locales/fr.json +0 -154
- package/src/locales/it.json +0 -154
- package/src/locales/pt.json +0 -154
- package/src/locales/sr.json +0 -154
|
@@ -0,0 +1,1089 @@
|
|
|
1
|
+
import { d as T, D as ce, b as _, f as N, y as Y, g as P, E as S, h as pe, A as fe, t as O, q as de, r as k, G as z, c as A, w as J, e as I, H, I as g, n as ve } from "./main-CLUk9Jj7.js";
|
|
2
|
+
const ye = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/, G = T({
|
|
3
|
+
name: "JsonString",
|
|
4
|
+
props: {
|
|
5
|
+
/** The string value to display. */
|
|
6
|
+
jsonValue: {
|
|
7
|
+
type: String,
|
|
8
|
+
required: !0
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
/**
|
|
12
|
+
* Setup function for the JsonString component.
|
|
13
|
+
* @param props - The component's props.
|
|
14
|
+
*/
|
|
15
|
+
setup(e) {
|
|
16
|
+
const y = k(!0), c = k(!1), p = k(null), d = k(null);
|
|
17
|
+
I(() => {
|
|
18
|
+
p.value && d.value && p.value.offsetHeight > d.value.offsetHeight && (c.value = !0);
|
|
19
|
+
});
|
|
20
|
+
const i = () => {
|
|
21
|
+
y.value = !y.value;
|
|
22
|
+
};
|
|
23
|
+
return () => {
|
|
24
|
+
const n = e.jsonValue, t = ye.test(n);
|
|
25
|
+
let o;
|
|
26
|
+
!y.value && c.value ? o = g("span", {
|
|
27
|
+
class: { "jv-ellipsis": !0 },
|
|
28
|
+
onClick: i
|
|
29
|
+
}, "...") : t ? o = g("span", { class: { "jv-item": !0, "jv-string": !0 }, ref: p }, [
|
|
30
|
+
g("span", null, '"'),
|
|
31
|
+
// Opening quote
|
|
32
|
+
g("a", { href: n, target: "_blank", class: "jv-link" }, n),
|
|
33
|
+
g("span", null, '"')
|
|
34
|
+
// Closing quote
|
|
35
|
+
]) : o = g("span", {
|
|
36
|
+
class: { "jv-item": !0, "jv-string": !0 },
|
|
37
|
+
ref: p
|
|
38
|
+
// Assign ref for height calculation
|
|
39
|
+
}, `"${n}"`);
|
|
40
|
+
const a = [];
|
|
41
|
+
return c.value && a.push(g("span", {
|
|
42
|
+
class: {
|
|
43
|
+
"jv-toggle": !0,
|
|
44
|
+
// CSS class for the toggle button
|
|
45
|
+
open: y.value
|
|
46
|
+
// Class to indicate open/closed state
|
|
47
|
+
},
|
|
48
|
+
onClick: i
|
|
49
|
+
})), a.push(g("span", { class: { "jv-holder-node": !0 }, ref: d })), a.push(o), g("span", {}, a);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}), me = {
|
|
53
|
+
class: /* @__PURE__ */ S(["jv-item", "jv-undefined"])
|
|
54
|
+
}, he = /* @__PURE__ */ T({
|
|
55
|
+
__name: "json-undefined",
|
|
56
|
+
props: {
|
|
57
|
+
/**
|
|
58
|
+
* The value to display. Expected to be `null` or `undefined`.
|
|
59
|
+
* The `type` is set to `null` and `PropType` is used to allow `undefined` as well,
|
|
60
|
+
* with a default of `undefined`.
|
|
61
|
+
*/
|
|
62
|
+
jsonValue: {
|
|
63
|
+
type: null,
|
|
64
|
+
default: void 0
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
setup(e) {
|
|
68
|
+
const y = e, c = A(() => y.jsonValue === null ? "null" : "undefined");
|
|
69
|
+
return (p, d) => (N(), _("span", me, O(c.value), 1));
|
|
70
|
+
}
|
|
71
|
+
}), ge = /* @__PURE__ */ T({
|
|
72
|
+
__name: "json-number",
|
|
73
|
+
props: {
|
|
74
|
+
/** The number value to display. */
|
|
75
|
+
jsonValue: {
|
|
76
|
+
type: Number,
|
|
77
|
+
required: !0
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
setup(e) {
|
|
81
|
+
const y = e, c = A(() => Number.isInteger(y.jsonValue));
|
|
82
|
+
return (p, d) => (N(), _("span", {
|
|
83
|
+
class: S(["jv-item", "jv-number", c.value ? "jv-number-integer" : "jv-number-float"])
|
|
84
|
+
}, O(e.jsonValue.toString()), 3));
|
|
85
|
+
}
|
|
86
|
+
}), be = {
|
|
87
|
+
class: /* @__PURE__ */ S(["jv-item", "jv-boolean"])
|
|
88
|
+
}, je = /* @__PURE__ */ T({
|
|
89
|
+
__name: "json-boolean",
|
|
90
|
+
props: {
|
|
91
|
+
/** The boolean value to display. */
|
|
92
|
+
jsonValue: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
required: !0
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
setup(e) {
|
|
98
|
+
return (y, c) => (N(), _("span", be, O(e.jsonValue.toString()), 1));
|
|
99
|
+
}
|
|
100
|
+
}), xe = T({
|
|
101
|
+
name: "JsonObject",
|
|
102
|
+
props: {
|
|
103
|
+
/** The object value to render. */
|
|
104
|
+
jsonValue: {
|
|
105
|
+
type: Object,
|
|
106
|
+
required: !0
|
|
107
|
+
},
|
|
108
|
+
/** The key name of this object if it's a property of another object. */
|
|
109
|
+
keyName: {
|
|
110
|
+
type: String,
|
|
111
|
+
default: ""
|
|
112
|
+
},
|
|
113
|
+
/** Current nesting depth of this object. */
|
|
114
|
+
depth: {
|
|
115
|
+
type: Number,
|
|
116
|
+
default: 0
|
|
117
|
+
},
|
|
118
|
+
/** Whether this object should be rendered in an expanded state. */
|
|
119
|
+
expand: Boolean,
|
|
120
|
+
/** Whether to sort the keys of this object alphabetically. */
|
|
121
|
+
sort: Boolean,
|
|
122
|
+
/** Whether preview mode is enabled. */
|
|
123
|
+
previewMode: Boolean
|
|
124
|
+
},
|
|
125
|
+
emits: ["update:expand"],
|
|
126
|
+
/**
|
|
127
|
+
* Setup function for the JsonObject component.
|
|
128
|
+
* @param props - The component's props.
|
|
129
|
+
* @param context - The setup context, including `emit`.
|
|
130
|
+
*/
|
|
131
|
+
setup(e, { emit: y }) {
|
|
132
|
+
const c = k({});
|
|
133
|
+
let p = null;
|
|
134
|
+
const d = (o) => {
|
|
135
|
+
setTimeout(() => {
|
|
136
|
+
c.value = o;
|
|
137
|
+
}, 0);
|
|
138
|
+
};
|
|
139
|
+
J(() => e.jsonValue, (o) => {
|
|
140
|
+
d(o);
|
|
141
|
+
}, { immediate: !0, deep: !0 });
|
|
142
|
+
const i = A(() => {
|
|
143
|
+
if (!e.sort)
|
|
144
|
+
return c.value;
|
|
145
|
+
const o = Object.keys(c.value).sort(), a = {};
|
|
146
|
+
return o.forEach((f) => {
|
|
147
|
+
a[f] = c.value[f];
|
|
148
|
+
}), a;
|
|
149
|
+
}), n = () => {
|
|
150
|
+
if (p)
|
|
151
|
+
try {
|
|
152
|
+
p.dispatchEvent(new Event("resized"));
|
|
153
|
+
} catch {
|
|
154
|
+
const o = document.createEvent("Event");
|
|
155
|
+
o.initEvent("resized", !0, !1), p.dispatchEvent(o);
|
|
156
|
+
}
|
|
157
|
+
}, t = () => {
|
|
158
|
+
y("update:expand", !e.expand), n();
|
|
159
|
+
};
|
|
160
|
+
return () => {
|
|
161
|
+
const o = [];
|
|
162
|
+
if (o.push(g("span", { class: ["jv-item", "jv-object"] }, "{")), e.expand) {
|
|
163
|
+
for (const a in i.value)
|
|
164
|
+
if (i.value.hasOwnProperty(a)) {
|
|
165
|
+
const f = i.value[a];
|
|
166
|
+
o.push(g(F, {
|
|
167
|
+
key: a,
|
|
168
|
+
// style: { display: !props.expand ? 'none' : undefined }, // Redundant
|
|
169
|
+
sort: e.sort,
|
|
170
|
+
keyName: a,
|
|
171
|
+
depth: e.depth + 1,
|
|
172
|
+
value: f,
|
|
173
|
+
previewMode: e.previewMode
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return !e.expand && Object.keys(c.value).length > 0 && o.push(g("span", {
|
|
178
|
+
// style: { display: props.expand ? 'none' : undefined }, // Redundant
|
|
179
|
+
class: "jv-ellipsis",
|
|
180
|
+
onClick: t,
|
|
181
|
+
title: `click to reveal object content (keys: ${Object.keys(i.value).join(", ")})`
|
|
182
|
+
}, "...")), o.push(g("span", { class: ["jv-item", "jv-object"] }, "}")), g("span", { ref: (a) => {
|
|
183
|
+
p = a;
|
|
184
|
+
} }, o);
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}), Ee = T({
|
|
188
|
+
name: "JsonArray",
|
|
189
|
+
props: {
|
|
190
|
+
/** The array value to render. */
|
|
191
|
+
jsonValue: {
|
|
192
|
+
type: Array,
|
|
193
|
+
required: !0
|
|
194
|
+
},
|
|
195
|
+
/** The key name of this array if it's a property of an object. */
|
|
196
|
+
keyName: {
|
|
197
|
+
type: String,
|
|
198
|
+
default: ""
|
|
199
|
+
},
|
|
200
|
+
/** Current nesting depth of this array. */
|
|
201
|
+
depth: {
|
|
202
|
+
type: Number,
|
|
203
|
+
default: 0
|
|
204
|
+
},
|
|
205
|
+
/** Whether to sort array items (Note: arrays are typically not sorted by key). */
|
|
206
|
+
sort: Boolean,
|
|
207
|
+
// This prop might be less relevant for arrays vs objects
|
|
208
|
+
/** Whether this array should be rendered in an expanded state. */
|
|
209
|
+
expand: Boolean,
|
|
210
|
+
/** Whether preview mode is enabled (potentially showing a condensed view). */
|
|
211
|
+
previewMode: Boolean
|
|
212
|
+
},
|
|
213
|
+
emits: ["update:expand"],
|
|
214
|
+
/**
|
|
215
|
+
* Setup function for the JsonArray component.
|
|
216
|
+
* @param props - The component's props.
|
|
217
|
+
* @param context - The setup context, including `emit`.
|
|
218
|
+
*/
|
|
219
|
+
setup(e, { emit: y }) {
|
|
220
|
+
const c = k([]);
|
|
221
|
+
let p = null;
|
|
222
|
+
const d = (n, t = 0) => {
|
|
223
|
+
t === 0 && (c.value = []), setTimeout(() => {
|
|
224
|
+
n && n.length > t && (c.value.push(n[t]), d(n, t + 1));
|
|
225
|
+
}, 0);
|
|
226
|
+
};
|
|
227
|
+
J(() => e.jsonValue, (n) => {
|
|
228
|
+
d(n);
|
|
229
|
+
}, { immediate: !0, deep: !0 });
|
|
230
|
+
const i = () => {
|
|
231
|
+
if (y("update:expand", !e.expand), p)
|
|
232
|
+
try {
|
|
233
|
+
p.dispatchEvent(new Event("resized"));
|
|
234
|
+
} catch {
|
|
235
|
+
const n = document.createEvent("Event");
|
|
236
|
+
n.initEvent("resized", !0, !1), p.dispatchEvent(n);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
return () => {
|
|
240
|
+
const n = [];
|
|
241
|
+
return !e.previewMode && !e.keyName && n.push(g("span", {
|
|
242
|
+
class: {
|
|
243
|
+
"jv-toggle": !0,
|
|
244
|
+
open: !!e.expand
|
|
245
|
+
},
|
|
246
|
+
onClick: i
|
|
247
|
+
})), n.push(g("span", {
|
|
248
|
+
class: ["jv-item", "jv-array"]
|
|
249
|
+
}, "[")), e.expand && c.value.forEach((t, o) => {
|
|
250
|
+
n.push(g(F, {
|
|
251
|
+
// Cast JsonBox to Component
|
|
252
|
+
key: o,
|
|
253
|
+
// style: { display: props.expand ? undefined : 'none' }, // This style is redundant if items are not rendered
|
|
254
|
+
sort: e.sort,
|
|
255
|
+
depth: e.depth + 1,
|
|
256
|
+
value: t,
|
|
257
|
+
previewMode: e.previewMode
|
|
258
|
+
}));
|
|
259
|
+
}), !e.expand && c.value.length > 0 && n.push(g("span", {
|
|
260
|
+
class: "jv-ellipsis",
|
|
261
|
+
onClick: i,
|
|
262
|
+
title: `click to reveal ${c.value.length} hidden items`
|
|
263
|
+
}, "...")), n.push(g("span", {
|
|
264
|
+
class: ["jv-item", "jv-array"]
|
|
265
|
+
}, "]")), g("span", { ref: (t) => {
|
|
266
|
+
p = t;
|
|
267
|
+
} }, n);
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
}), we = ["title"], ke = /* @__PURE__ */ T({
|
|
271
|
+
__name: "json-function",
|
|
272
|
+
props: {
|
|
273
|
+
/** The Function object to represent. */
|
|
274
|
+
jsonValue: {
|
|
275
|
+
type: Function,
|
|
276
|
+
required: !0
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
setup(e) {
|
|
280
|
+
return (y, c) => (N(), _("span", {
|
|
281
|
+
class: S(["jv-item", "jv-function"]),
|
|
282
|
+
title: e.jsonValue.toString()
|
|
283
|
+
}, " <function> ", 8, we));
|
|
284
|
+
}
|
|
285
|
+
}), Se = {
|
|
286
|
+
class: /* @__PURE__ */ S(["jv-item", "jv-string"])
|
|
287
|
+
}, Te = /* @__PURE__ */ T({
|
|
288
|
+
__name: "json-date",
|
|
289
|
+
props: {
|
|
290
|
+
/** The Date object to display. */
|
|
291
|
+
jsonValue: {
|
|
292
|
+
type: Date,
|
|
293
|
+
required: !0
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
setup(e) {
|
|
297
|
+
const y = e, c = H("timeformat", (d) => d.toLocaleString()), p = A(() => c(y.jsonValue));
|
|
298
|
+
return (d, i) => (N(), _("span", Se, ' "' + O(p.value) + '" ', 1));
|
|
299
|
+
}
|
|
300
|
+
}), Ce = {
|
|
301
|
+
class: /* @__PURE__ */ S(["jv-item", "jv-regexp"])
|
|
302
|
+
}, _e = /* @__PURE__ */ T({
|
|
303
|
+
__name: "json-regexp",
|
|
304
|
+
props: {
|
|
305
|
+
/** The RegExp object to display. */
|
|
306
|
+
jsonValue: {
|
|
307
|
+
type: RegExp,
|
|
308
|
+
required: !0
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
setup(e) {
|
|
312
|
+
return (y, c) => (N(), _("span", Ce, O(e.jsonValue.toString()), 1));
|
|
313
|
+
}
|
|
314
|
+
}), F = T({
|
|
315
|
+
name: "JsonBox",
|
|
316
|
+
props: {
|
|
317
|
+
/** The JSON value to render. Can be any valid JSON type. */
|
|
318
|
+
value: {
|
|
319
|
+
type: [Object, Array, String, Number, Boolean, Function, Date],
|
|
320
|
+
default: null
|
|
321
|
+
},
|
|
322
|
+
/** The key name for this value, if it's part of an object. */
|
|
323
|
+
keyName: {
|
|
324
|
+
type: String,
|
|
325
|
+
default: ""
|
|
326
|
+
},
|
|
327
|
+
/** Whether to sort object keys alphabetically. Passed down from JsonViewer. */
|
|
328
|
+
sort: Boolean,
|
|
329
|
+
/** Current nesting depth of this component. */
|
|
330
|
+
depth: {
|
|
331
|
+
type: Number,
|
|
332
|
+
default: 0
|
|
333
|
+
},
|
|
334
|
+
/** Whether preview mode is enabled. Passed down from JsonViewer. */
|
|
335
|
+
previewMode: Boolean
|
|
336
|
+
},
|
|
337
|
+
/**
|
|
338
|
+
* Setup function for the JsonBox component.
|
|
339
|
+
* @param props - The component's props.
|
|
340
|
+
*/
|
|
341
|
+
setup(e) {
|
|
342
|
+
const y = H("expandDepth", 1 / 0), c = H("keyClick", () => {
|
|
343
|
+
}), p = k(!0);
|
|
344
|
+
let d = null;
|
|
345
|
+
I(() => {
|
|
346
|
+
p.value = e.previewMode || e.depth < y;
|
|
347
|
+
});
|
|
348
|
+
const i = () => {
|
|
349
|
+
if (p.value = !p.value, d)
|
|
350
|
+
try {
|
|
351
|
+
d.dispatchEvent(new Event("resized"));
|
|
352
|
+
} catch {
|
|
353
|
+
const n = document.createEvent("Event");
|
|
354
|
+
n.initEvent("resized", !0, !1), d.dispatchEvent(n);
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
return () => {
|
|
358
|
+
const n = [];
|
|
359
|
+
let t;
|
|
360
|
+
e.value === null || e.value === void 0 ? t = he : Array.isArray(e.value) ? t = Ee : e.value instanceof Date ? t = Te : e.value instanceof RegExp ? t = _e : typeof e.value == "object" ? t = xe : typeof e.value == "number" ? t = ge : typeof e.value == "string" ? t = G : typeof e.value == "boolean" ? t = je : typeof e.value == "function" ? t = ke : t = G;
|
|
361
|
+
const o = e.value && (Array.isArray(e.value) || typeof e.value == "object" && !(e.value instanceof Date) && // Exclude Date
|
|
362
|
+
!(e.value instanceof RegExp));
|
|
363
|
+
return !e.previewMode && o && !(e.value instanceof RegExp) && n.push(
|
|
364
|
+
g("span", {
|
|
365
|
+
class: {
|
|
366
|
+
"jv-toggle": !0,
|
|
367
|
+
open: !!p.value
|
|
368
|
+
// Double negation to ensure boolean
|
|
369
|
+
},
|
|
370
|
+
onClick: i
|
|
371
|
+
})
|
|
372
|
+
), e.keyName && n.push(
|
|
373
|
+
g("span", {
|
|
374
|
+
class: "jv-key",
|
|
375
|
+
// 'jv-key' is a string, not an object
|
|
376
|
+
onClick: () => {
|
|
377
|
+
c && c(e.keyName);
|
|
378
|
+
}
|
|
379
|
+
}, `${e.keyName}:`)
|
|
380
|
+
// Text content as children
|
|
381
|
+
), n.push(
|
|
382
|
+
g(t, {
|
|
383
|
+
class: "jv-push",
|
|
384
|
+
// 'jv-push' is a string
|
|
385
|
+
jsonValue: e.value,
|
|
386
|
+
keyName: e.keyName,
|
|
387
|
+
// Pass keyName for context if needed by child
|
|
388
|
+
sort: e.sort,
|
|
389
|
+
// Pass sort for objects/arrays
|
|
390
|
+
depth: e.depth,
|
|
391
|
+
// Pass current depth
|
|
392
|
+
expand: p.value,
|
|
393
|
+
// Pass current expand state
|
|
394
|
+
previewMode: e.previewMode,
|
|
395
|
+
// Listen for 'update:expand' events from child components (e.g., JsonArray, JsonObject)
|
|
396
|
+
// This allows children to request a change in their own expansion state.
|
|
397
|
+
"onUpdate:expand": (a) => {
|
|
398
|
+
p.value = a;
|
|
399
|
+
}
|
|
400
|
+
})
|
|
401
|
+
), g(
|
|
402
|
+
"div",
|
|
403
|
+
{
|
|
404
|
+
class: {
|
|
405
|
+
"jv-node": !0,
|
|
406
|
+
"jv-key-node": !!e.keyName && !o,
|
|
407
|
+
// Apply if keyName exists and not a complex type
|
|
408
|
+
toggle: !e.previewMode && o
|
|
409
|
+
// Apply if not preview and is complex for styling indent
|
|
410
|
+
},
|
|
411
|
+
ref: (a) => {
|
|
412
|
+
d = a;
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
n
|
|
416
|
+
);
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
function Ne(e) {
|
|
421
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
422
|
+
}
|
|
423
|
+
var $ = { exports: {} };
|
|
424
|
+
/*!
|
|
425
|
+
* clipboard.js v2.0.11
|
|
426
|
+
* https://clipboardjs.com/
|
|
427
|
+
*
|
|
428
|
+
* Licensed MIT © Zeno Rocha
|
|
429
|
+
*/
|
|
430
|
+
var Ae = $.exports, X;
|
|
431
|
+
function Oe() {
|
|
432
|
+
return X || (X = 1, function(e, y) {
|
|
433
|
+
(function(c, p) {
|
|
434
|
+
e.exports = p();
|
|
435
|
+
})(Ae, function() {
|
|
436
|
+
return (
|
|
437
|
+
/******/
|
|
438
|
+
function() {
|
|
439
|
+
var c = {
|
|
440
|
+
/***/
|
|
441
|
+
686: (
|
|
442
|
+
/***/
|
|
443
|
+
function(i, n, t) {
|
|
444
|
+
t.d(n, {
|
|
445
|
+
default: function() {
|
|
446
|
+
return (
|
|
447
|
+
/* binding */
|
|
448
|
+
ie
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
var o = t(279), a = /* @__PURE__ */ t.n(o), f = t(370), j = /* @__PURE__ */ t.n(f), b = t(817), w = /* @__PURE__ */ t.n(b);
|
|
453
|
+
function v(u) {
|
|
454
|
+
try {
|
|
455
|
+
return document.execCommand(u);
|
|
456
|
+
} catch {
|
|
457
|
+
return !1;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
var x = function(u) {
|
|
461
|
+
var r = w()(u);
|
|
462
|
+
return v("cut"), r;
|
|
463
|
+
}, h = x;
|
|
464
|
+
function C(u) {
|
|
465
|
+
var r = document.documentElement.getAttribute("dir") === "rtl", l = document.createElement("textarea");
|
|
466
|
+
l.style.fontSize = "12pt", l.style.border = "0", l.style.padding = "0", l.style.margin = "0", l.style.position = "absolute", l.style[r ? "right" : "left"] = "-9999px";
|
|
467
|
+
var s = window.pageYOffset || document.documentElement.scrollTop;
|
|
468
|
+
return l.style.top = "".concat(s, "px"), l.setAttribute("readonly", ""), l.value = u, l;
|
|
469
|
+
}
|
|
470
|
+
var K = function(u, r) {
|
|
471
|
+
var l = C(u);
|
|
472
|
+
r.container.appendChild(l);
|
|
473
|
+
var s = w()(l);
|
|
474
|
+
return v("copy"), l.remove(), s;
|
|
475
|
+
}, Q = function(u) {
|
|
476
|
+
var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
477
|
+
container: document.body
|
|
478
|
+
}, l = "";
|
|
479
|
+
return typeof u == "string" ? l = K(u, r) : u instanceof HTMLInputElement && !["text", "search", "url", "tel", "password"].includes(u == null ? void 0 : u.type) ? l = K(u.value, r) : (l = w()(u), v("copy")), l;
|
|
480
|
+
}, R = Q;
|
|
481
|
+
function V(u) {
|
|
482
|
+
"@babel/helpers - typeof";
|
|
483
|
+
return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? V = function(r) {
|
|
484
|
+
return typeof r;
|
|
485
|
+
} : V = function(r) {
|
|
486
|
+
return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
|
|
487
|
+
}, V(u);
|
|
488
|
+
}
|
|
489
|
+
var W = function() {
|
|
490
|
+
var u = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, r = u.action, l = r === void 0 ? "copy" : r, s = u.container, m = u.target, E = u.text;
|
|
491
|
+
if (l !== "copy" && l !== "cut")
|
|
492
|
+
throw new Error('Invalid "action" value, use either "copy" or "cut"');
|
|
493
|
+
if (m !== void 0)
|
|
494
|
+
if (m && V(m) === "object" && m.nodeType === 1) {
|
|
495
|
+
if (l === "copy" && m.hasAttribute("disabled"))
|
|
496
|
+
throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
|
|
497
|
+
if (l === "cut" && (m.hasAttribute("readonly") || m.hasAttribute("disabled")))
|
|
498
|
+
throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`);
|
|
499
|
+
} else
|
|
500
|
+
throw new Error('Invalid "target" value, use a valid Element');
|
|
501
|
+
if (E)
|
|
502
|
+
return R(E, {
|
|
503
|
+
container: s
|
|
504
|
+
});
|
|
505
|
+
if (m)
|
|
506
|
+
return l === "cut" ? h(m) : R(m, {
|
|
507
|
+
container: s
|
|
508
|
+
});
|
|
509
|
+
}, ee = W;
|
|
510
|
+
function M(u) {
|
|
511
|
+
"@babel/helpers - typeof";
|
|
512
|
+
return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? M = function(r) {
|
|
513
|
+
return typeof r;
|
|
514
|
+
} : M = function(r) {
|
|
515
|
+
return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
|
|
516
|
+
}, M(u);
|
|
517
|
+
}
|
|
518
|
+
function te(u, r) {
|
|
519
|
+
if (!(u instanceof r))
|
|
520
|
+
throw new TypeError("Cannot call a class as a function");
|
|
521
|
+
}
|
|
522
|
+
function U(u, r) {
|
|
523
|
+
for (var l = 0; l < r.length; l++) {
|
|
524
|
+
var s = r[l];
|
|
525
|
+
s.enumerable = s.enumerable || !1, s.configurable = !0, "value" in s && (s.writable = !0), Object.defineProperty(u, s.key, s);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
function ne(u, r, l) {
|
|
529
|
+
return r && U(u.prototype, r), l && U(u, l), u;
|
|
530
|
+
}
|
|
531
|
+
function oe(u, r) {
|
|
532
|
+
if (typeof r != "function" && r !== null)
|
|
533
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
534
|
+
u.prototype = Object.create(r && r.prototype, { constructor: { value: u, writable: !0, configurable: !0 } }), r && D(u, r);
|
|
535
|
+
}
|
|
536
|
+
function D(u, r) {
|
|
537
|
+
return D = Object.setPrototypeOf || function(l, s) {
|
|
538
|
+
return l.__proto__ = s, l;
|
|
539
|
+
}, D(u, r);
|
|
540
|
+
}
|
|
541
|
+
function re(u) {
|
|
542
|
+
var r = se();
|
|
543
|
+
return function() {
|
|
544
|
+
var l = B(u), s;
|
|
545
|
+
if (r) {
|
|
546
|
+
var m = B(this).constructor;
|
|
547
|
+
s = Reflect.construct(l, arguments, m);
|
|
548
|
+
} else
|
|
549
|
+
s = l.apply(this, arguments);
|
|
550
|
+
return ae(this, s);
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
function ae(u, r) {
|
|
554
|
+
return r && (M(r) === "object" || typeof r == "function") ? r : ue(u);
|
|
555
|
+
}
|
|
556
|
+
function ue(u) {
|
|
557
|
+
if (u === void 0)
|
|
558
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
559
|
+
return u;
|
|
560
|
+
}
|
|
561
|
+
function se() {
|
|
562
|
+
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
|
|
563
|
+
if (typeof Proxy == "function") return !0;
|
|
564
|
+
try {
|
|
565
|
+
return Date.prototype.toString.call(Reflect.construct(Date, [], function() {
|
|
566
|
+
})), !0;
|
|
567
|
+
} catch {
|
|
568
|
+
return !1;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
function B(u) {
|
|
572
|
+
return B = Object.setPrototypeOf ? Object.getPrototypeOf : function(r) {
|
|
573
|
+
return r.__proto__ || Object.getPrototypeOf(r);
|
|
574
|
+
}, B(u);
|
|
575
|
+
}
|
|
576
|
+
function q(u, r) {
|
|
577
|
+
var l = "data-clipboard-".concat(u);
|
|
578
|
+
if (r.hasAttribute(l))
|
|
579
|
+
return r.getAttribute(l);
|
|
580
|
+
}
|
|
581
|
+
var le = /* @__PURE__ */ function(u) {
|
|
582
|
+
oe(l, u);
|
|
583
|
+
var r = re(l);
|
|
584
|
+
function l(s, m) {
|
|
585
|
+
var E;
|
|
586
|
+
return te(this, l), E = r.call(this), E.resolveOptions(m), E.listenClick(s), E;
|
|
587
|
+
}
|
|
588
|
+
return ne(l, [{
|
|
589
|
+
key: "resolveOptions",
|
|
590
|
+
value: function() {
|
|
591
|
+
var s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
592
|
+
this.action = typeof s.action == "function" ? s.action : this.defaultAction, this.target = typeof s.target == "function" ? s.target : this.defaultTarget, this.text = typeof s.text == "function" ? s.text : this.defaultText, this.container = M(s.container) === "object" ? s.container : document.body;
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Adds a click event listener to the passed trigger.
|
|
596
|
+
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger
|
|
597
|
+
*/
|
|
598
|
+
}, {
|
|
599
|
+
key: "listenClick",
|
|
600
|
+
value: function(s) {
|
|
601
|
+
var m = this;
|
|
602
|
+
this.listener = j()(s, "click", function(E) {
|
|
603
|
+
return m.onClick(E);
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Defines a new `ClipboardAction` on each click event.
|
|
608
|
+
* @param {Event} e
|
|
609
|
+
*/
|
|
610
|
+
}, {
|
|
611
|
+
key: "onClick",
|
|
612
|
+
value: function(s) {
|
|
613
|
+
var m = s.delegateTarget || s.currentTarget, E = this.action(m) || "copy", L = ee({
|
|
614
|
+
action: E,
|
|
615
|
+
container: this.container,
|
|
616
|
+
target: this.target(m),
|
|
617
|
+
text: this.text(m)
|
|
618
|
+
});
|
|
619
|
+
this.emit(L ? "success" : "error", {
|
|
620
|
+
action: E,
|
|
621
|
+
text: L,
|
|
622
|
+
trigger: m,
|
|
623
|
+
clearSelection: function() {
|
|
624
|
+
m && m.focus(), window.getSelection().removeAllRanges();
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* Default `action` lookup function.
|
|
630
|
+
* @param {Element} trigger
|
|
631
|
+
*/
|
|
632
|
+
}, {
|
|
633
|
+
key: "defaultAction",
|
|
634
|
+
value: function(s) {
|
|
635
|
+
return q("action", s);
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Default `target` lookup function.
|
|
639
|
+
* @param {Element} trigger
|
|
640
|
+
*/
|
|
641
|
+
}, {
|
|
642
|
+
key: "defaultTarget",
|
|
643
|
+
value: function(s) {
|
|
644
|
+
var m = q("target", s);
|
|
645
|
+
if (m)
|
|
646
|
+
return document.querySelector(m);
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Allow fire programmatically a copy action
|
|
650
|
+
* @param {String|HTMLElement} target
|
|
651
|
+
* @param {Object} options
|
|
652
|
+
* @returns Text copied.
|
|
653
|
+
*/
|
|
654
|
+
}, {
|
|
655
|
+
key: "defaultText",
|
|
656
|
+
/**
|
|
657
|
+
* Default `text` lookup function.
|
|
658
|
+
* @param {Element} trigger
|
|
659
|
+
*/
|
|
660
|
+
value: function(s) {
|
|
661
|
+
return q("text", s);
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Destroy lifecycle.
|
|
665
|
+
*/
|
|
666
|
+
}, {
|
|
667
|
+
key: "destroy",
|
|
668
|
+
value: function() {
|
|
669
|
+
this.listener.destroy();
|
|
670
|
+
}
|
|
671
|
+
}], [{
|
|
672
|
+
key: "copy",
|
|
673
|
+
value: function(s) {
|
|
674
|
+
var m = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
675
|
+
container: document.body
|
|
676
|
+
};
|
|
677
|
+
return R(s, m);
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Allow fire programmatically a cut action
|
|
681
|
+
* @param {String|HTMLElement} target
|
|
682
|
+
* @returns Text cutted.
|
|
683
|
+
*/
|
|
684
|
+
}, {
|
|
685
|
+
key: "cut",
|
|
686
|
+
value: function(s) {
|
|
687
|
+
return h(s);
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Returns the support of the given action, or all actions if no action is
|
|
691
|
+
* given.
|
|
692
|
+
* @param {String} [action]
|
|
693
|
+
*/
|
|
694
|
+
}, {
|
|
695
|
+
key: "isSupported",
|
|
696
|
+
value: function() {
|
|
697
|
+
var s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ["copy", "cut"], m = typeof s == "string" ? [s] : s, E = !!document.queryCommandSupported;
|
|
698
|
+
return m.forEach(function(L) {
|
|
699
|
+
E = E && !!document.queryCommandSupported(L);
|
|
700
|
+
}), E;
|
|
701
|
+
}
|
|
702
|
+
}]), l;
|
|
703
|
+
}(a()), ie = le;
|
|
704
|
+
}
|
|
705
|
+
),
|
|
706
|
+
/***/
|
|
707
|
+
828: (
|
|
708
|
+
/***/
|
|
709
|
+
function(i) {
|
|
710
|
+
var n = 9;
|
|
711
|
+
if (typeof Element < "u" && !Element.prototype.matches) {
|
|
712
|
+
var t = Element.prototype;
|
|
713
|
+
t.matches = t.matchesSelector || t.mozMatchesSelector || t.msMatchesSelector || t.oMatchesSelector || t.webkitMatchesSelector;
|
|
714
|
+
}
|
|
715
|
+
function o(a, f) {
|
|
716
|
+
for (; a && a.nodeType !== n; ) {
|
|
717
|
+
if (typeof a.matches == "function" && a.matches(f))
|
|
718
|
+
return a;
|
|
719
|
+
a = a.parentNode;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
i.exports = o;
|
|
723
|
+
}
|
|
724
|
+
),
|
|
725
|
+
/***/
|
|
726
|
+
438: (
|
|
727
|
+
/***/
|
|
728
|
+
function(i, n, t) {
|
|
729
|
+
var o = t(828);
|
|
730
|
+
function a(b, w, v, x, h) {
|
|
731
|
+
var C = j.apply(this, arguments);
|
|
732
|
+
return b.addEventListener(v, C, h), {
|
|
733
|
+
destroy: function() {
|
|
734
|
+
b.removeEventListener(v, C, h);
|
|
735
|
+
}
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
function f(b, w, v, x, h) {
|
|
739
|
+
return typeof b.addEventListener == "function" ? a.apply(null, arguments) : typeof v == "function" ? a.bind(null, document).apply(null, arguments) : (typeof b == "string" && (b = document.querySelectorAll(b)), Array.prototype.map.call(b, function(C) {
|
|
740
|
+
return a(C, w, v, x, h);
|
|
741
|
+
}));
|
|
742
|
+
}
|
|
743
|
+
function j(b, w, v, x) {
|
|
744
|
+
return function(h) {
|
|
745
|
+
h.delegateTarget = o(h.target, w), h.delegateTarget && x.call(b, h);
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
i.exports = f;
|
|
749
|
+
}
|
|
750
|
+
),
|
|
751
|
+
/***/
|
|
752
|
+
879: (
|
|
753
|
+
/***/
|
|
754
|
+
function(i, n) {
|
|
755
|
+
n.node = function(t) {
|
|
756
|
+
return t !== void 0 && t instanceof HTMLElement && t.nodeType === 1;
|
|
757
|
+
}, n.nodeList = function(t) {
|
|
758
|
+
var o = Object.prototype.toString.call(t);
|
|
759
|
+
return t !== void 0 && (o === "[object NodeList]" || o === "[object HTMLCollection]") && "length" in t && (t.length === 0 || n.node(t[0]));
|
|
760
|
+
}, n.string = function(t) {
|
|
761
|
+
return typeof t == "string" || t instanceof String;
|
|
762
|
+
}, n.fn = function(t) {
|
|
763
|
+
var o = Object.prototype.toString.call(t);
|
|
764
|
+
return o === "[object Function]";
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
),
|
|
768
|
+
/***/
|
|
769
|
+
370: (
|
|
770
|
+
/***/
|
|
771
|
+
function(i, n, t) {
|
|
772
|
+
var o = t(879), a = t(438);
|
|
773
|
+
function f(v, x, h) {
|
|
774
|
+
if (!v && !x && !h)
|
|
775
|
+
throw new Error("Missing required arguments");
|
|
776
|
+
if (!o.string(x))
|
|
777
|
+
throw new TypeError("Second argument must be a String");
|
|
778
|
+
if (!o.fn(h))
|
|
779
|
+
throw new TypeError("Third argument must be a Function");
|
|
780
|
+
if (o.node(v))
|
|
781
|
+
return j(v, x, h);
|
|
782
|
+
if (o.nodeList(v))
|
|
783
|
+
return b(v, x, h);
|
|
784
|
+
if (o.string(v))
|
|
785
|
+
return w(v, x, h);
|
|
786
|
+
throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList");
|
|
787
|
+
}
|
|
788
|
+
function j(v, x, h) {
|
|
789
|
+
return v.addEventListener(x, h), {
|
|
790
|
+
destroy: function() {
|
|
791
|
+
v.removeEventListener(x, h);
|
|
792
|
+
}
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
function b(v, x, h) {
|
|
796
|
+
return Array.prototype.forEach.call(v, function(C) {
|
|
797
|
+
C.addEventListener(x, h);
|
|
798
|
+
}), {
|
|
799
|
+
destroy: function() {
|
|
800
|
+
Array.prototype.forEach.call(v, function(C) {
|
|
801
|
+
C.removeEventListener(x, h);
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
function w(v, x, h) {
|
|
807
|
+
return a(document.body, v, x, h);
|
|
808
|
+
}
|
|
809
|
+
i.exports = f;
|
|
810
|
+
}
|
|
811
|
+
),
|
|
812
|
+
/***/
|
|
813
|
+
817: (
|
|
814
|
+
/***/
|
|
815
|
+
function(i) {
|
|
816
|
+
function n(t) {
|
|
817
|
+
var o;
|
|
818
|
+
if (t.nodeName === "SELECT")
|
|
819
|
+
t.focus(), o = t.value;
|
|
820
|
+
else if (t.nodeName === "INPUT" || t.nodeName === "TEXTAREA") {
|
|
821
|
+
var a = t.hasAttribute("readonly");
|
|
822
|
+
a || t.setAttribute("readonly", ""), t.select(), t.setSelectionRange(0, t.value.length), a || t.removeAttribute("readonly"), o = t.value;
|
|
823
|
+
} else {
|
|
824
|
+
t.hasAttribute("contenteditable") && t.focus();
|
|
825
|
+
var f = window.getSelection(), j = document.createRange();
|
|
826
|
+
j.selectNodeContents(t), f.removeAllRanges(), f.addRange(j), o = f.toString();
|
|
827
|
+
}
|
|
828
|
+
return o;
|
|
829
|
+
}
|
|
830
|
+
i.exports = n;
|
|
831
|
+
}
|
|
832
|
+
),
|
|
833
|
+
/***/
|
|
834
|
+
279: (
|
|
835
|
+
/***/
|
|
836
|
+
function(i) {
|
|
837
|
+
function n() {
|
|
838
|
+
}
|
|
839
|
+
n.prototype = {
|
|
840
|
+
on: function(t, o, a) {
|
|
841
|
+
var f = this.e || (this.e = {});
|
|
842
|
+
return (f[t] || (f[t] = [])).push({
|
|
843
|
+
fn: o,
|
|
844
|
+
ctx: a
|
|
845
|
+
}), this;
|
|
846
|
+
},
|
|
847
|
+
once: function(t, o, a) {
|
|
848
|
+
var f = this;
|
|
849
|
+
function j() {
|
|
850
|
+
f.off(t, j), o.apply(a, arguments);
|
|
851
|
+
}
|
|
852
|
+
return j._ = o, this.on(t, j, a);
|
|
853
|
+
},
|
|
854
|
+
emit: function(t) {
|
|
855
|
+
var o = [].slice.call(arguments, 1), a = ((this.e || (this.e = {}))[t] || []).slice(), f = 0, j = a.length;
|
|
856
|
+
for (f; f < j; f++)
|
|
857
|
+
a[f].fn.apply(a[f].ctx, o);
|
|
858
|
+
return this;
|
|
859
|
+
},
|
|
860
|
+
off: function(t, o) {
|
|
861
|
+
var a = this.e || (this.e = {}), f = a[t], j = [];
|
|
862
|
+
if (f && o)
|
|
863
|
+
for (var b = 0, w = f.length; b < w; b++)
|
|
864
|
+
f[b].fn !== o && f[b].fn._ !== o && j.push(f[b]);
|
|
865
|
+
return j.length ? a[t] = j : delete a[t], this;
|
|
866
|
+
}
|
|
867
|
+
}, i.exports = n, i.exports.TinyEmitter = n;
|
|
868
|
+
}
|
|
869
|
+
)
|
|
870
|
+
/******/
|
|
871
|
+
}, p = {};
|
|
872
|
+
function d(i) {
|
|
873
|
+
if (p[i])
|
|
874
|
+
return p[i].exports;
|
|
875
|
+
var n = p[i] = {
|
|
876
|
+
/******/
|
|
877
|
+
// no module.id needed
|
|
878
|
+
/******/
|
|
879
|
+
// no module.loaded needed
|
|
880
|
+
/******/
|
|
881
|
+
exports: {}
|
|
882
|
+
/******/
|
|
883
|
+
};
|
|
884
|
+
return c[i](n, n.exports, d), n.exports;
|
|
885
|
+
}
|
|
886
|
+
return function() {
|
|
887
|
+
d.n = function(i) {
|
|
888
|
+
var n = i && i.__esModule ? (
|
|
889
|
+
/******/
|
|
890
|
+
function() {
|
|
891
|
+
return i.default;
|
|
892
|
+
}
|
|
893
|
+
) : (
|
|
894
|
+
/******/
|
|
895
|
+
function() {
|
|
896
|
+
return i;
|
|
897
|
+
}
|
|
898
|
+
);
|
|
899
|
+
return d.d(n, { a: n }), n;
|
|
900
|
+
};
|
|
901
|
+
}(), function() {
|
|
902
|
+
d.d = function(i, n) {
|
|
903
|
+
for (var t in n)
|
|
904
|
+
d.o(n, t) && !d.o(i, t) && Object.defineProperty(i, t, { enumerable: !0, get: n[t] });
|
|
905
|
+
};
|
|
906
|
+
}(), function() {
|
|
907
|
+
d.o = function(i, n) {
|
|
908
|
+
return Object.prototype.hasOwnProperty.call(i, n);
|
|
909
|
+
};
|
|
910
|
+
}(), d(686);
|
|
911
|
+
}().default
|
|
912
|
+
);
|
|
913
|
+
});
|
|
914
|
+
}($)), $.exports;
|
|
915
|
+
}
|
|
916
|
+
var Me = Oe();
|
|
917
|
+
const Ve = /* @__PURE__ */ Ne(Me), Be = function(e, y) {
|
|
918
|
+
let c = Date.now(), p;
|
|
919
|
+
return (...d) => {
|
|
920
|
+
Date.now() - c < y && p && clearTimeout(p), p = setTimeout(() => {
|
|
921
|
+
e(...d);
|
|
922
|
+
}, y), c = Date.now();
|
|
923
|
+
};
|
|
924
|
+
}, Le = T({
|
|
925
|
+
name: "JsonViewer",
|
|
926
|
+
components: {
|
|
927
|
+
JsonBox: F
|
|
928
|
+
},
|
|
929
|
+
props: {
|
|
930
|
+
value: {
|
|
931
|
+
type: [Object, Array, String, Number, Boolean, Function],
|
|
932
|
+
required: !0
|
|
933
|
+
},
|
|
934
|
+
expanded: {
|
|
935
|
+
type: Boolean,
|
|
936
|
+
default: !1
|
|
937
|
+
},
|
|
938
|
+
expandDepth: {
|
|
939
|
+
type: Number,
|
|
940
|
+
default: 1
|
|
941
|
+
},
|
|
942
|
+
copyable: {
|
|
943
|
+
type: [Boolean, Object],
|
|
944
|
+
default: !1
|
|
945
|
+
},
|
|
946
|
+
sort: {
|
|
947
|
+
type: Boolean,
|
|
948
|
+
default: !1
|
|
949
|
+
},
|
|
950
|
+
boxed: {
|
|
951
|
+
type: Boolean,
|
|
952
|
+
default: !1
|
|
953
|
+
},
|
|
954
|
+
theme: {
|
|
955
|
+
type: String,
|
|
956
|
+
default: "light"
|
|
957
|
+
},
|
|
958
|
+
timeformat: {
|
|
959
|
+
type: Function,
|
|
960
|
+
default: (e) => e.toLocaleString()
|
|
961
|
+
},
|
|
962
|
+
previewMode: {
|
|
963
|
+
type: Boolean,
|
|
964
|
+
default: !1
|
|
965
|
+
},
|
|
966
|
+
parse: {
|
|
967
|
+
type: Boolean,
|
|
968
|
+
default: !1
|
|
969
|
+
}
|
|
970
|
+
},
|
|
971
|
+
emits: ["onKeyClick", "copied"],
|
|
972
|
+
/**
|
|
973
|
+
* Setup function for the JsonViewer component.
|
|
974
|
+
* @param props - The component's props.
|
|
975
|
+
* @param context - The setup context, including `emit`.
|
|
976
|
+
*/
|
|
977
|
+
setup(e, { emit: y }) {
|
|
978
|
+
const c = k(!1), p = k(!1), d = k(e.expanded), i = k(null), n = k(null);
|
|
979
|
+
z("expandDepth", e.expandDepth), z("timeformat", e.timeformat), z("keyClick", (v) => {
|
|
980
|
+
y("onKeyClick", v);
|
|
981
|
+
});
|
|
982
|
+
const t = A(() => "jv-container jv-" + e.theme + (e.boxed ? " boxed" : "")), o = A(() => {
|
|
983
|
+
if (typeof e.copyable == "boolean" && !e.copyable)
|
|
984
|
+
return { copyText: "copy", copiedText: "copied!", timeout: 2e3, align: "right" };
|
|
985
|
+
const v = e.copyable;
|
|
986
|
+
return {
|
|
987
|
+
copyText: v.copyText || "copy",
|
|
988
|
+
copiedText: v.copiedText || "copied!",
|
|
989
|
+
timeout: v.timeout || 2e3,
|
|
990
|
+
align: v.align || "right"
|
|
991
|
+
};
|
|
992
|
+
}), a = A(() => {
|
|
993
|
+
if (!e.parse || typeof e.value != "string")
|
|
994
|
+
return e.value;
|
|
995
|
+
try {
|
|
996
|
+
return JSON.parse(e.value);
|
|
997
|
+
} catch {
|
|
998
|
+
return e.value;
|
|
999
|
+
}
|
|
1000
|
+
}), f = () => {
|
|
1001
|
+
j();
|
|
1002
|
+
}, j = Be(() => {
|
|
1003
|
+
ve(() => {
|
|
1004
|
+
n.value && (n.value.$el.clientHeight >= 250 ? p.value = !0 : p.value = !1);
|
|
1005
|
+
});
|
|
1006
|
+
}, 200), b = (v) => {
|
|
1007
|
+
c.value || (c.value = !0, setTimeout(() => {
|
|
1008
|
+
c.value = !1;
|
|
1009
|
+
}, o.value.timeout), y("copied", v));
|
|
1010
|
+
}, w = () => {
|
|
1011
|
+
d.value = !d.value;
|
|
1012
|
+
};
|
|
1013
|
+
return J(() => e.value, () => {
|
|
1014
|
+
f();
|
|
1015
|
+
}), I(() => {
|
|
1016
|
+
e.boxed && n.value && (f(), n.value.$el.addEventListener("resized", f, !0)), e.copyable && i.value && new Ve(i.value, {
|
|
1017
|
+
text: () => JSON.stringify(a.value, null, 2)
|
|
1018
|
+
// Use parseValue for copying
|
|
1019
|
+
}).on("success", b);
|
|
1020
|
+
}), {
|
|
1021
|
+
clip: i,
|
|
1022
|
+
jsonBox: n,
|
|
1023
|
+
copied: c,
|
|
1024
|
+
expandableCode: p,
|
|
1025
|
+
expandCode: d,
|
|
1026
|
+
jvClass: t,
|
|
1027
|
+
copyText: o,
|
|
1028
|
+
parseValue: a,
|
|
1029
|
+
toggleExpandCode: w
|
|
1030
|
+
// Methods are already bound or don't need explicit exposure if not used in template
|
|
1031
|
+
// onResized, // only called internally
|
|
1032
|
+
// debResized, // only called internally
|
|
1033
|
+
// onCopied, // only called internally
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
}), Re = (e, y) => {
|
|
1037
|
+
const c = e.__vccOpts || e;
|
|
1038
|
+
for (const [p, d] of y)
|
|
1039
|
+
c[p] = d;
|
|
1040
|
+
return c;
|
|
1041
|
+
};
|
|
1042
|
+
function De(e, y, c, p, d, i) {
|
|
1043
|
+
const n = ce("json-box");
|
|
1044
|
+
return N(), _("div", {
|
|
1045
|
+
class: S(e.jvClass)
|
|
1046
|
+
}, [
|
|
1047
|
+
e.copyable ? (N(), _("div", {
|
|
1048
|
+
key: 0,
|
|
1049
|
+
class: S(`jv-tooltip ${e.copyText.align || "right"}`)
|
|
1050
|
+
}, [
|
|
1051
|
+
P("span", {
|
|
1052
|
+
ref: "clip",
|
|
1053
|
+
class: S(["jv-button", { copied: e.copied }])
|
|
1054
|
+
}, [
|
|
1055
|
+
pe(e.$slots, "copy", { copied: e.copied }, () => [
|
|
1056
|
+
fe(O(e.copied ? e.copyText.copiedText : e.copyText.copyText), 1)
|
|
1057
|
+
])
|
|
1058
|
+
], 2)
|
|
1059
|
+
], 2)) : Y("", !0),
|
|
1060
|
+
P("div", {
|
|
1061
|
+
class: S(["jv-code", { open: e.expandCode, boxed: e.boxed }])
|
|
1062
|
+
}, [
|
|
1063
|
+
de(n, {
|
|
1064
|
+
ref: "jsonBox",
|
|
1065
|
+
value: e.parseValue,
|
|
1066
|
+
sort: e.sort,
|
|
1067
|
+
"preview-mode": e.previewMode
|
|
1068
|
+
}, null, 8, ["value", "sort", "preview-mode"])
|
|
1069
|
+
], 2),
|
|
1070
|
+
e.expandableCode && e.boxed ? (N(), _("div", {
|
|
1071
|
+
key: 1,
|
|
1072
|
+
class: "jv-more",
|
|
1073
|
+
onClick: y[0] || (y[0] = (...t) => e.toggleExpandCode && e.toggleExpandCode(...t))
|
|
1074
|
+
}, [
|
|
1075
|
+
P("span", {
|
|
1076
|
+
class: S(["jv-toggle", { open: !!e.expandCode }])
|
|
1077
|
+
}, null, 2)
|
|
1078
|
+
])) : Y("", !0)
|
|
1079
|
+
], 2);
|
|
1080
|
+
}
|
|
1081
|
+
const Z = /* @__PURE__ */ Re(Le, [["render", De]]), qe = (e) => {
|
|
1082
|
+
e.component(Z.name, Z);
|
|
1083
|
+
}, ze = {
|
|
1084
|
+
install: qe
|
|
1085
|
+
};
|
|
1086
|
+
export {
|
|
1087
|
+
Z as JsonViewer,
|
|
1088
|
+
ze as default
|
|
1089
|
+
};
|