fec-dev-designer 1.0.0 → 1.0.1
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/es/node_modules/vue3-json-viewer/dist/vue3-json-viewer.css.js +4 -0
- package/es/node_modules/vue3-json-viewer/dist/vue3-json-viewer.js +1086 -0
- package/es/src/components/JsonDataDrawer.vue.js +12 -11
- package/es/src/packages/dataSource/dataSource.vue.js +7 -6
- package/es/style.css +1 -1
- package/package.json +3 -2
- package/es/_virtual/clipboard.js +0 -4
- package/es/_virtual/vue-json-viewer.js +0 -4
- package/es/node_modules/clipboard/dist/clipboard.js +0 -499
- package/es/node_modules/vue-json-viewer/vue-json-viewer.js +0 -727
|
@@ -0,0 +1,1086 @@
|
|
|
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, nextTick as se, resolveComponent as ce, createElementVNode as z, renderSlot as pe, createTextVNode as de, createCommentVNode as Y, createVNode as fe } from "vue";
|
|
2
|
+
const ve = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/, X = 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), f = k(null);
|
|
17
|
+
J(() => {
|
|
18
|
+
p.value && f.value && p.value.offsetHeight > f.value.offsetHeight && (c.value = !0);
|
|
19
|
+
});
|
|
20
|
+
const s = () => {
|
|
21
|
+
y.value = !y.value;
|
|
22
|
+
};
|
|
23
|
+
return () => {
|
|
24
|
+
const n = e.jsonValue, t = ve.test(n);
|
|
25
|
+
let o;
|
|
26
|
+
!y.value && c.value ? o = g("span", {
|
|
27
|
+
class: { "jv-ellipsis": !0 },
|
|
28
|
+
onClick: s
|
|
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: s
|
|
49
|
+
})), a.push(g("span", { class: { "jv-holder-node": !0 }, ref: f })), a.push(o), g("span", {}, a);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}), ye = {
|
|
53
|
+
class: /* @__PURE__ */ S(["jv-item", "jv-undefined"])
|
|
54
|
+
}, me = /* @__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 = O(() => y.jsonValue === null ? "null" : "undefined");
|
|
69
|
+
return (p, f) => (_(), N("span", ye, A(c.value), 1));
|
|
70
|
+
}
|
|
71
|
+
}), he = /* @__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 = O(() => Number.isInteger(y.jsonValue));
|
|
82
|
+
return (p, f) => (_(), N("span", {
|
|
83
|
+
class: S(["jv-item", "jv-number", c.value ? "jv-number-integer" : "jv-number-float"])
|
|
84
|
+
}, A(e.jsonValue.toString()), 3));
|
|
85
|
+
}
|
|
86
|
+
}), ge = {
|
|
87
|
+
class: /* @__PURE__ */ S(["jv-item", "jv-boolean"])
|
|
88
|
+
}, be = /* @__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", ge, A(e.jsonValue.toString()), 1));
|
|
99
|
+
}
|
|
100
|
+
}), je = 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 f = (o) => {
|
|
135
|
+
setTimeout(() => {
|
|
136
|
+
c.value = o;
|
|
137
|
+
}, 0);
|
|
138
|
+
};
|
|
139
|
+
F(() => e.jsonValue, (o) => {
|
|
140
|
+
f(o);
|
|
141
|
+
}, { immediate: !0, deep: !0 });
|
|
142
|
+
const s = O(() => {
|
|
143
|
+
if (!e.sort)
|
|
144
|
+
return c.value;
|
|
145
|
+
const o = Object.keys(c.value).sort(), a = {};
|
|
146
|
+
return o.forEach((d) => {
|
|
147
|
+
a[d] = c.value[d];
|
|
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 s.value)
|
|
164
|
+
if (s.value.hasOwnProperty(a)) {
|
|
165
|
+
const d = s.value[a];
|
|
166
|
+
o.push(g(I, {
|
|
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: d,
|
|
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(s.value).join(", ")})`
|
|
182
|
+
}, "...")), o.push(g("span", { class: ["jv-item", "jv-object"] }, "}")), g("span", { ref: (a) => {
|
|
183
|
+
p = a;
|
|
184
|
+
} }, o);
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}), xe = 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 f = (n, t = 0) => {
|
|
223
|
+
t === 0 && (c.value = []), setTimeout(() => {
|
|
224
|
+
n && n.length > t && (c.value.push(n[t]), f(n, t + 1));
|
|
225
|
+
}, 0);
|
|
226
|
+
};
|
|
227
|
+
F(() => e.jsonValue, (n) => {
|
|
228
|
+
f(n);
|
|
229
|
+
}, { immediate: !0, deep: !0 });
|
|
230
|
+
const s = () => {
|
|
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: s
|
|
247
|
+
})), n.push(g("span", {
|
|
248
|
+
class: ["jv-item", "jv-array"]
|
|
249
|
+
}, "[")), e.expand && c.value.forEach((t, o) => {
|
|
250
|
+
n.push(g(I, {
|
|
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: s,
|
|
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
|
+
}), Ee = ["title"], we = /* @__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, Ee));
|
|
284
|
+
}
|
|
285
|
+
}), ke = {
|
|
286
|
+
class: /* @__PURE__ */ S(["jv-item", "jv-string"])
|
|
287
|
+
}, Se = /* @__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 = $("timeformat", (f) => f.toLocaleString()), p = O(() => c(y.jsonValue));
|
|
298
|
+
return (f, s) => (_(), N("span", ke, ' "' + A(p.value) + '" ', 1));
|
|
299
|
+
}
|
|
300
|
+
}), Te = {
|
|
301
|
+
class: /* @__PURE__ */ S(["jv-item", "jv-regexp"])
|
|
302
|
+
}, Ce = /* @__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", Te, A(e.jsonValue.toString()), 1));
|
|
313
|
+
}
|
|
314
|
+
}), I = 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 = $("expandDepth", 1 / 0), c = $("keyClick", () => {
|
|
343
|
+
}), p = k(!0);
|
|
344
|
+
let f = null;
|
|
345
|
+
J(() => {
|
|
346
|
+
p.value = e.previewMode || e.depth < y;
|
|
347
|
+
});
|
|
348
|
+
const s = () => {
|
|
349
|
+
if (p.value = !p.value, f)
|
|
350
|
+
try {
|
|
351
|
+
f.dispatchEvent(new Event("resized"));
|
|
352
|
+
} catch {
|
|
353
|
+
const n = document.createEvent("Event");
|
|
354
|
+
n.initEvent("resized", !0, !1), f.dispatchEvent(n);
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
return () => {
|
|
358
|
+
const n = [];
|
|
359
|
+
let t;
|
|
360
|
+
e.value === null || e.value === void 0 ? t = me : Array.isArray(e.value) ? t = xe : e.value instanceof Date ? t = Se : e.value instanceof RegExp ? t = Ce : typeof e.value == "object" ? t = je : typeof e.value == "number" ? t = he : typeof e.value == "string" ? t = X : typeof e.value == "boolean" ? t = be : typeof e.value == "function" ? t = we : t = X;
|
|
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: s
|
|
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
|
+
f = a;
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
n
|
|
416
|
+
);
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
function _e(e) {
|
|
421
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
422
|
+
}
|
|
423
|
+
var H = { exports: {} };
|
|
424
|
+
/*!
|
|
425
|
+
* clipboard.js v2.0.11
|
|
426
|
+
* https://clipboardjs.com/
|
|
427
|
+
*
|
|
428
|
+
* Licensed MIT © Zeno Rocha
|
|
429
|
+
*/
|
|
430
|
+
var Ne = H.exports, Z;
|
|
431
|
+
function Oe() {
|
|
432
|
+
return Z || (Z = 1, function(e, y) {
|
|
433
|
+
(function(c, p) {
|
|
434
|
+
e.exports = p();
|
|
435
|
+
})(Ne, function() {
|
|
436
|
+
return (
|
|
437
|
+
/******/
|
|
438
|
+
function() {
|
|
439
|
+
var c = {
|
|
440
|
+
/***/
|
|
441
|
+
686: (
|
|
442
|
+
/***/
|
|
443
|
+
function(s, n, t) {
|
|
444
|
+
t.d(n, {
|
|
445
|
+
default: function() {
|
|
446
|
+
return (
|
|
447
|
+
/* binding */
|
|
448
|
+
le
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
var o = t(279), a = /* @__PURE__ */ t.n(o), d = t(370), j = /* @__PURE__ */ t.n(d), 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 i = window.pageYOffset || document.documentElement.scrollTop;
|
|
468
|
+
return l.style.top = "".concat(i, "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 i = w()(l);
|
|
474
|
+
return v("copy"), l.remove(), i;
|
|
475
|
+
}, G = 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 = G;
|
|
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 Q = function() {
|
|
490
|
+
var u = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, r = u.action, l = r === void 0 ? "copy" : r, i = 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: i
|
|
504
|
+
});
|
|
505
|
+
if (m)
|
|
506
|
+
return l === "cut" ? h(m) : R(m, {
|
|
507
|
+
container: i
|
|
508
|
+
});
|
|
509
|
+
}, W = Q;
|
|
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 ee(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 i = r[l];
|
|
525
|
+
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(u, i.key, i);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
function te(u, r, l) {
|
|
529
|
+
return r && U(u.prototype, r), l && U(u, l), u;
|
|
530
|
+
}
|
|
531
|
+
function ne(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, i) {
|
|
538
|
+
return l.__proto__ = i, l;
|
|
539
|
+
}, D(u, r);
|
|
540
|
+
}
|
|
541
|
+
function oe(u) {
|
|
542
|
+
var r = ue();
|
|
543
|
+
return function() {
|
|
544
|
+
var l = B(u), i;
|
|
545
|
+
if (r) {
|
|
546
|
+
var m = B(this).constructor;
|
|
547
|
+
i = Reflect.construct(l, arguments, m);
|
|
548
|
+
} else
|
|
549
|
+
i = l.apply(this, arguments);
|
|
550
|
+
return re(this, i);
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
function re(u, r) {
|
|
554
|
+
return r && (M(r) === "object" || typeof r == "function") ? r : ae(u);
|
|
555
|
+
}
|
|
556
|
+
function ae(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 ue() {
|
|
562
|
+
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
|
|
563
|
+
return !1;
|
|
564
|
+
if (typeof Proxy == "function")
|
|
565
|
+
return !0;
|
|
566
|
+
try {
|
|
567
|
+
return Date.prototype.toString.call(Reflect.construct(Date, [], function() {
|
|
568
|
+
})), !0;
|
|
569
|
+
} catch {
|
|
570
|
+
return !1;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
function B(u) {
|
|
574
|
+
return B = Object.setPrototypeOf ? Object.getPrototypeOf : function(r) {
|
|
575
|
+
return r.__proto__ || Object.getPrototypeOf(r);
|
|
576
|
+
}, B(u);
|
|
577
|
+
}
|
|
578
|
+
function P(u, r) {
|
|
579
|
+
var l = "data-clipboard-".concat(u);
|
|
580
|
+
if (r.hasAttribute(l))
|
|
581
|
+
return r.getAttribute(l);
|
|
582
|
+
}
|
|
583
|
+
var ie = /* @__PURE__ */ function(u) {
|
|
584
|
+
ne(l, u);
|
|
585
|
+
var r = oe(l);
|
|
586
|
+
function l(i, m) {
|
|
587
|
+
var E;
|
|
588
|
+
return ee(this, l), E = r.call(this), E.resolveOptions(m), E.listenClick(i), E;
|
|
589
|
+
}
|
|
590
|
+
return te(l, [{
|
|
591
|
+
key: "resolveOptions",
|
|
592
|
+
value: function() {
|
|
593
|
+
var i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
594
|
+
this.action = typeof i.action == "function" ? i.action : this.defaultAction, this.target = typeof i.target == "function" ? i.target : this.defaultTarget, this.text = typeof i.text == "function" ? i.text : this.defaultText, this.container = M(i.container) === "object" ? i.container : document.body;
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Adds a click event listener to the passed trigger.
|
|
598
|
+
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger
|
|
599
|
+
*/
|
|
600
|
+
}, {
|
|
601
|
+
key: "listenClick",
|
|
602
|
+
value: function(i) {
|
|
603
|
+
var m = this;
|
|
604
|
+
this.listener = j()(i, "click", function(E) {
|
|
605
|
+
return m.onClick(E);
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Defines a new `ClipboardAction` on each click event.
|
|
610
|
+
* @param {Event} e
|
|
611
|
+
*/
|
|
612
|
+
}, {
|
|
613
|
+
key: "onClick",
|
|
614
|
+
value: function(i) {
|
|
615
|
+
var m = i.delegateTarget || i.currentTarget, E = this.action(m) || "copy", L = W({
|
|
616
|
+
action: E,
|
|
617
|
+
container: this.container,
|
|
618
|
+
target: this.target(m),
|
|
619
|
+
text: this.text(m)
|
|
620
|
+
});
|
|
621
|
+
this.emit(L ? "success" : "error", {
|
|
622
|
+
action: E,
|
|
623
|
+
text: L,
|
|
624
|
+
trigger: m,
|
|
625
|
+
clearSelection: function() {
|
|
626
|
+
m && m.focus(), window.getSelection().removeAllRanges();
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Default `action` lookup function.
|
|
632
|
+
* @param {Element} trigger
|
|
633
|
+
*/
|
|
634
|
+
}, {
|
|
635
|
+
key: "defaultAction",
|
|
636
|
+
value: function(i) {
|
|
637
|
+
return P("action", i);
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Default `target` lookup function.
|
|
641
|
+
* @param {Element} trigger
|
|
642
|
+
*/
|
|
643
|
+
}, {
|
|
644
|
+
key: "defaultTarget",
|
|
645
|
+
value: function(i) {
|
|
646
|
+
var m = P("target", i);
|
|
647
|
+
if (m)
|
|
648
|
+
return document.querySelector(m);
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Allow fire programmatically a copy action
|
|
652
|
+
* @param {String|HTMLElement} target
|
|
653
|
+
* @param {Object} options
|
|
654
|
+
* @returns Text copied.
|
|
655
|
+
*/
|
|
656
|
+
}, {
|
|
657
|
+
key: "defaultText",
|
|
658
|
+
/**
|
|
659
|
+
* Default `text` lookup function.
|
|
660
|
+
* @param {Element} trigger
|
|
661
|
+
*/
|
|
662
|
+
value: function(i) {
|
|
663
|
+
return P("text", i);
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Destroy lifecycle.
|
|
667
|
+
*/
|
|
668
|
+
}, {
|
|
669
|
+
key: "destroy",
|
|
670
|
+
value: function() {
|
|
671
|
+
this.listener.destroy();
|
|
672
|
+
}
|
|
673
|
+
}], [{
|
|
674
|
+
key: "copy",
|
|
675
|
+
value: function(i) {
|
|
676
|
+
var m = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
677
|
+
container: document.body
|
|
678
|
+
};
|
|
679
|
+
return R(i, m);
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Allow fire programmatically a cut action
|
|
683
|
+
* @param {String|HTMLElement} target
|
|
684
|
+
* @returns Text cutted.
|
|
685
|
+
*/
|
|
686
|
+
}, {
|
|
687
|
+
key: "cut",
|
|
688
|
+
value: function(i) {
|
|
689
|
+
return h(i);
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Returns the support of the given action, or all actions if no action is
|
|
693
|
+
* given.
|
|
694
|
+
* @param {String} [action]
|
|
695
|
+
*/
|
|
696
|
+
}, {
|
|
697
|
+
key: "isSupported",
|
|
698
|
+
value: function() {
|
|
699
|
+
var i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ["copy", "cut"], m = typeof i == "string" ? [i] : i, E = !!document.queryCommandSupported;
|
|
700
|
+
return m.forEach(function(L) {
|
|
701
|
+
E = E && !!document.queryCommandSupported(L);
|
|
702
|
+
}), E;
|
|
703
|
+
}
|
|
704
|
+
}]), l;
|
|
705
|
+
}(a()), le = ie;
|
|
706
|
+
}
|
|
707
|
+
),
|
|
708
|
+
/***/
|
|
709
|
+
828: (
|
|
710
|
+
/***/
|
|
711
|
+
function(s) {
|
|
712
|
+
var n = 9;
|
|
713
|
+
if (typeof Element < "u" && !Element.prototype.matches) {
|
|
714
|
+
var t = Element.prototype;
|
|
715
|
+
t.matches = t.matchesSelector || t.mozMatchesSelector || t.msMatchesSelector || t.oMatchesSelector || t.webkitMatchesSelector;
|
|
716
|
+
}
|
|
717
|
+
function o(a, d) {
|
|
718
|
+
for (; a && a.nodeType !== n; ) {
|
|
719
|
+
if (typeof a.matches == "function" && a.matches(d))
|
|
720
|
+
return a;
|
|
721
|
+
a = a.parentNode;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
s.exports = o;
|
|
725
|
+
}
|
|
726
|
+
),
|
|
727
|
+
/***/
|
|
728
|
+
438: (
|
|
729
|
+
/***/
|
|
730
|
+
function(s, n, t) {
|
|
731
|
+
var o = t(828);
|
|
732
|
+
function a(b, w, v, x, h) {
|
|
733
|
+
var C = j.apply(this, arguments);
|
|
734
|
+
return b.addEventListener(v, C, h), {
|
|
735
|
+
destroy: function() {
|
|
736
|
+
b.removeEventListener(v, C, h);
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
function d(b, w, v, x, h) {
|
|
741
|
+
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) {
|
|
742
|
+
return a(C, w, v, x, h);
|
|
743
|
+
}));
|
|
744
|
+
}
|
|
745
|
+
function j(b, w, v, x) {
|
|
746
|
+
return function(h) {
|
|
747
|
+
h.delegateTarget = o(h.target, w), h.delegateTarget && x.call(b, h);
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
s.exports = d;
|
|
751
|
+
}
|
|
752
|
+
),
|
|
753
|
+
/***/
|
|
754
|
+
879: (
|
|
755
|
+
/***/
|
|
756
|
+
function(s, n) {
|
|
757
|
+
n.node = function(t) {
|
|
758
|
+
return t !== void 0 && t instanceof HTMLElement && t.nodeType === 1;
|
|
759
|
+
}, n.nodeList = function(t) {
|
|
760
|
+
var o = Object.prototype.toString.call(t);
|
|
761
|
+
return t !== void 0 && (o === "[object NodeList]" || o === "[object HTMLCollection]") && "length" in t && (t.length === 0 || n.node(t[0]));
|
|
762
|
+
}, n.string = function(t) {
|
|
763
|
+
return typeof t == "string" || t instanceof String;
|
|
764
|
+
}, n.fn = function(t) {
|
|
765
|
+
var o = Object.prototype.toString.call(t);
|
|
766
|
+
return o === "[object Function]";
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
),
|
|
770
|
+
/***/
|
|
771
|
+
370: (
|
|
772
|
+
/***/
|
|
773
|
+
function(s, n, t) {
|
|
774
|
+
var o = t(879), a = t(438);
|
|
775
|
+
function d(v, x, h) {
|
|
776
|
+
if (!v && !x && !h)
|
|
777
|
+
throw new Error("Missing required arguments");
|
|
778
|
+
if (!o.string(x))
|
|
779
|
+
throw new TypeError("Second argument must be a String");
|
|
780
|
+
if (!o.fn(h))
|
|
781
|
+
throw new TypeError("Third argument must be a Function");
|
|
782
|
+
if (o.node(v))
|
|
783
|
+
return j(v, x, h);
|
|
784
|
+
if (o.nodeList(v))
|
|
785
|
+
return b(v, x, h);
|
|
786
|
+
if (o.string(v))
|
|
787
|
+
return w(v, x, h);
|
|
788
|
+
throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList");
|
|
789
|
+
}
|
|
790
|
+
function j(v, x, h) {
|
|
791
|
+
return v.addEventListener(x, h), {
|
|
792
|
+
destroy: function() {
|
|
793
|
+
v.removeEventListener(x, h);
|
|
794
|
+
}
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
function b(v, x, h) {
|
|
798
|
+
return Array.prototype.forEach.call(v, function(C) {
|
|
799
|
+
C.addEventListener(x, h);
|
|
800
|
+
}), {
|
|
801
|
+
destroy: function() {
|
|
802
|
+
Array.prototype.forEach.call(v, function(C) {
|
|
803
|
+
C.removeEventListener(x, h);
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
}
|
|
808
|
+
function w(v, x, h) {
|
|
809
|
+
return a(document.body, v, x, h);
|
|
810
|
+
}
|
|
811
|
+
s.exports = d;
|
|
812
|
+
}
|
|
813
|
+
),
|
|
814
|
+
/***/
|
|
815
|
+
817: (
|
|
816
|
+
/***/
|
|
817
|
+
function(s) {
|
|
818
|
+
function n(t) {
|
|
819
|
+
var o;
|
|
820
|
+
if (t.nodeName === "SELECT")
|
|
821
|
+
t.focus(), o = t.value;
|
|
822
|
+
else if (t.nodeName === "INPUT" || t.nodeName === "TEXTAREA") {
|
|
823
|
+
var a = t.hasAttribute("readonly");
|
|
824
|
+
a || t.setAttribute("readonly", ""), t.select(), t.setSelectionRange(0, t.value.length), a || t.removeAttribute("readonly"), o = t.value;
|
|
825
|
+
} else {
|
|
826
|
+
t.hasAttribute("contenteditable") && t.focus();
|
|
827
|
+
var d = window.getSelection(), j = document.createRange();
|
|
828
|
+
j.selectNodeContents(t), d.removeAllRanges(), d.addRange(j), o = d.toString();
|
|
829
|
+
}
|
|
830
|
+
return o;
|
|
831
|
+
}
|
|
832
|
+
s.exports = n;
|
|
833
|
+
}
|
|
834
|
+
),
|
|
835
|
+
/***/
|
|
836
|
+
279: (
|
|
837
|
+
/***/
|
|
838
|
+
function(s) {
|
|
839
|
+
function n() {
|
|
840
|
+
}
|
|
841
|
+
n.prototype = {
|
|
842
|
+
on: function(t, o, a) {
|
|
843
|
+
var d = this.e || (this.e = {});
|
|
844
|
+
return (d[t] || (d[t] = [])).push({
|
|
845
|
+
fn: o,
|
|
846
|
+
ctx: a
|
|
847
|
+
}), this;
|
|
848
|
+
},
|
|
849
|
+
once: function(t, o, a) {
|
|
850
|
+
var d = this;
|
|
851
|
+
function j() {
|
|
852
|
+
d.off(t, j), o.apply(a, arguments);
|
|
853
|
+
}
|
|
854
|
+
return j._ = o, this.on(t, j, a);
|
|
855
|
+
},
|
|
856
|
+
emit: function(t) {
|
|
857
|
+
var o = [].slice.call(arguments, 1), a = ((this.e || (this.e = {}))[t] || []).slice(), d = 0, j = a.length;
|
|
858
|
+
for (d; d < j; d++)
|
|
859
|
+
a[d].fn.apply(a[d].ctx, o);
|
|
860
|
+
return this;
|
|
861
|
+
},
|
|
862
|
+
off: function(t, o) {
|
|
863
|
+
var a = this.e || (this.e = {}), d = a[t], j = [];
|
|
864
|
+
if (d && o)
|
|
865
|
+
for (var b = 0, w = d.length; b < w; b++)
|
|
866
|
+
d[b].fn !== o && d[b].fn._ !== o && j.push(d[b]);
|
|
867
|
+
return j.length ? a[t] = j : delete a[t], this;
|
|
868
|
+
}
|
|
869
|
+
}, s.exports = n, s.exports.TinyEmitter = n;
|
|
870
|
+
}
|
|
871
|
+
)
|
|
872
|
+
/******/
|
|
873
|
+
}, p = {};
|
|
874
|
+
function f(s) {
|
|
875
|
+
if (p[s])
|
|
876
|
+
return p[s].exports;
|
|
877
|
+
var n = p[s] = {
|
|
878
|
+
/******/
|
|
879
|
+
// no module.id needed
|
|
880
|
+
/******/
|
|
881
|
+
// no module.loaded needed
|
|
882
|
+
/******/
|
|
883
|
+
exports: {}
|
|
884
|
+
/******/
|
|
885
|
+
};
|
|
886
|
+
return c[s](n, n.exports, f), n.exports;
|
|
887
|
+
}
|
|
888
|
+
return function() {
|
|
889
|
+
f.n = function(s) {
|
|
890
|
+
var n = s && s.__esModule ? (
|
|
891
|
+
/******/
|
|
892
|
+
function() {
|
|
893
|
+
return s.default;
|
|
894
|
+
}
|
|
895
|
+
) : (
|
|
896
|
+
/******/
|
|
897
|
+
function() {
|
|
898
|
+
return s;
|
|
899
|
+
}
|
|
900
|
+
);
|
|
901
|
+
return f.d(n, { a: n }), n;
|
|
902
|
+
};
|
|
903
|
+
}(), function() {
|
|
904
|
+
f.d = function(s, n) {
|
|
905
|
+
for (var t in n)
|
|
906
|
+
f.o(n, t) && !f.o(s, t) && Object.defineProperty(s, t, { enumerable: !0, get: n[t] });
|
|
907
|
+
};
|
|
908
|
+
}(), function() {
|
|
909
|
+
f.o = function(s, n) {
|
|
910
|
+
return Object.prototype.hasOwnProperty.call(s, n);
|
|
911
|
+
};
|
|
912
|
+
}(), f(686);
|
|
913
|
+
}().default
|
|
914
|
+
);
|
|
915
|
+
});
|
|
916
|
+
}(H)), H.exports;
|
|
917
|
+
}
|
|
918
|
+
var Ae = Oe();
|
|
919
|
+
const Me = /* @__PURE__ */ _e(Ae), Ve = function(e, y) {
|
|
920
|
+
let c = Date.now(), p;
|
|
921
|
+
return (...f) => {
|
|
922
|
+
Date.now() - c < y && p && clearTimeout(p), p = setTimeout(() => {
|
|
923
|
+
e(...f);
|
|
924
|
+
}, y), c = Date.now();
|
|
925
|
+
};
|
|
926
|
+
}, Be = T({
|
|
927
|
+
name: "JsonViewer",
|
|
928
|
+
components: {
|
|
929
|
+
JsonBox: I
|
|
930
|
+
},
|
|
931
|
+
props: {
|
|
932
|
+
value: {
|
|
933
|
+
type: [Object, Array, String, Number, Boolean, Function],
|
|
934
|
+
required: !0
|
|
935
|
+
},
|
|
936
|
+
expanded: {
|
|
937
|
+
type: Boolean,
|
|
938
|
+
default: !1
|
|
939
|
+
},
|
|
940
|
+
expandDepth: {
|
|
941
|
+
type: Number,
|
|
942
|
+
default: 1
|
|
943
|
+
},
|
|
944
|
+
copyable: {
|
|
945
|
+
type: [Boolean, Object],
|
|
946
|
+
default: !1
|
|
947
|
+
},
|
|
948
|
+
sort: {
|
|
949
|
+
type: Boolean,
|
|
950
|
+
default: !1
|
|
951
|
+
},
|
|
952
|
+
boxed: {
|
|
953
|
+
type: Boolean,
|
|
954
|
+
default: !1
|
|
955
|
+
},
|
|
956
|
+
theme: {
|
|
957
|
+
type: String,
|
|
958
|
+
default: "light"
|
|
959
|
+
},
|
|
960
|
+
timeformat: {
|
|
961
|
+
type: Function,
|
|
962
|
+
default: (e) => e.toLocaleString()
|
|
963
|
+
},
|
|
964
|
+
previewMode: {
|
|
965
|
+
type: Boolean,
|
|
966
|
+
default: !1
|
|
967
|
+
},
|
|
968
|
+
parse: {
|
|
969
|
+
type: Boolean,
|
|
970
|
+
default: !1
|
|
971
|
+
}
|
|
972
|
+
},
|
|
973
|
+
emits: ["onKeyClick", "copied"],
|
|
974
|
+
/**
|
|
975
|
+
* Setup function for the JsonViewer component.
|
|
976
|
+
* @param props - The component's props.
|
|
977
|
+
* @param context - The setup context, including `emit`.
|
|
978
|
+
*/
|
|
979
|
+
setup(e, { emit: y }) {
|
|
980
|
+
const c = k(!1), p = k(!1), f = k(e.expanded), s = k(null), n = k(null);
|
|
981
|
+
q("expandDepth", e.expandDepth), q("timeformat", e.timeformat), q("keyClick", (v) => {
|
|
982
|
+
y("onKeyClick", v);
|
|
983
|
+
});
|
|
984
|
+
const t = O(() => "jv-container jv-" + e.theme + (e.boxed ? " boxed" : "")), o = O(() => {
|
|
985
|
+
if (typeof e.copyable == "boolean" && !e.copyable)
|
|
986
|
+
return { copyText: "copy", copiedText: "copied!", timeout: 2e3, align: "right" };
|
|
987
|
+
const v = e.copyable;
|
|
988
|
+
return {
|
|
989
|
+
copyText: v.copyText || "copy",
|
|
990
|
+
copiedText: v.copiedText || "copied!",
|
|
991
|
+
timeout: v.timeout || 2e3,
|
|
992
|
+
align: v.align || "right"
|
|
993
|
+
};
|
|
994
|
+
}), a = O(() => {
|
|
995
|
+
if (!e.parse || typeof e.value != "string")
|
|
996
|
+
return e.value;
|
|
997
|
+
try {
|
|
998
|
+
return JSON.parse(e.value);
|
|
999
|
+
} catch {
|
|
1000
|
+
return e.value;
|
|
1001
|
+
}
|
|
1002
|
+
}), d = () => {
|
|
1003
|
+
j();
|
|
1004
|
+
}, j = Ve(() => {
|
|
1005
|
+
se(() => {
|
|
1006
|
+
n.value && (n.value.$el.clientHeight >= 250 ? p.value = !0 : p.value = !1);
|
|
1007
|
+
});
|
|
1008
|
+
}, 200), b = (v) => {
|
|
1009
|
+
c.value || (c.value = !0, setTimeout(() => {
|
|
1010
|
+
c.value = !1;
|
|
1011
|
+
}, o.value.timeout), y("copied", v));
|
|
1012
|
+
}, w = () => {
|
|
1013
|
+
f.value = !f.value;
|
|
1014
|
+
};
|
|
1015
|
+
return F(() => e.value, () => {
|
|
1016
|
+
d();
|
|
1017
|
+
}), J(() => {
|
|
1018
|
+
e.boxed && n.value && (d(), n.value.$el.addEventListener("resized", d, !0)), e.copyable && s.value && new Me(s.value, {
|
|
1019
|
+
text: () => JSON.stringify(a.value, null, 2)
|
|
1020
|
+
// Use parseValue for copying
|
|
1021
|
+
}).on("success", b);
|
|
1022
|
+
}), {
|
|
1023
|
+
clip: s,
|
|
1024
|
+
jsonBox: n,
|
|
1025
|
+
copied: c,
|
|
1026
|
+
expandableCode: p,
|
|
1027
|
+
expandCode: f,
|
|
1028
|
+
jvClass: t,
|
|
1029
|
+
copyText: o,
|
|
1030
|
+
parseValue: a,
|
|
1031
|
+
toggleExpandCode: w
|
|
1032
|
+
// Methods are already bound or don't need explicit exposure if not used in template
|
|
1033
|
+
// onResized, // only called internally
|
|
1034
|
+
// debResized, // only called internally
|
|
1035
|
+
// onCopied, // only called internally
|
|
1036
|
+
};
|
|
1037
|
+
}
|
|
1038
|
+
}), Le = (e, y) => {
|
|
1039
|
+
const c = e.__vccOpts || e;
|
|
1040
|
+
for (const [p, f] of y)
|
|
1041
|
+
c[p] = f;
|
|
1042
|
+
return c;
|
|
1043
|
+
};
|
|
1044
|
+
function Re(e, y, c, p, f, s) {
|
|
1045
|
+
const n = ce("json-box");
|
|
1046
|
+
return _(), N("div", {
|
|
1047
|
+
class: S(e.jvClass)
|
|
1048
|
+
}, [
|
|
1049
|
+
e.copyable ? (_(), N("div", {
|
|
1050
|
+
key: 0,
|
|
1051
|
+
class: S(`jv-tooltip ${e.copyText.align || "right"}`)
|
|
1052
|
+
}, [
|
|
1053
|
+
z("span", {
|
|
1054
|
+
ref: "clip",
|
|
1055
|
+
class: S(["jv-button", { copied: e.copied }])
|
|
1056
|
+
}, [
|
|
1057
|
+
pe(e.$slots, "copy", { copied: e.copied }, () => [
|
|
1058
|
+
de(A(e.copied ? e.copyText.copiedText : e.copyText.copyText), 1)
|
|
1059
|
+
])
|
|
1060
|
+
], 2)
|
|
1061
|
+
], 2)) : Y("", !0),
|
|
1062
|
+
z("div", {
|
|
1063
|
+
class: S(["jv-code", { open: e.expandCode, boxed: e.boxed }])
|
|
1064
|
+
}, [
|
|
1065
|
+
fe(n, {
|
|
1066
|
+
ref: "jsonBox",
|
|
1067
|
+
value: e.parseValue,
|
|
1068
|
+
sort: e.sort,
|
|
1069
|
+
"preview-mode": e.previewMode
|
|
1070
|
+
}, null, 8, ["value", "sort", "preview-mode"])
|
|
1071
|
+
], 2),
|
|
1072
|
+
e.expandableCode && e.boxed ? (_(), N("div", {
|
|
1073
|
+
key: 1,
|
|
1074
|
+
class: "jv-more",
|
|
1075
|
+
onClick: y[0] || (y[0] = (...t) => e.toggleExpandCode && e.toggleExpandCode(...t))
|
|
1076
|
+
}, [
|
|
1077
|
+
z("span", {
|
|
1078
|
+
class: S(["jv-toggle", { open: !!e.expandCode }])
|
|
1079
|
+
}, null, 2)
|
|
1080
|
+
])) : Y("", !0)
|
|
1081
|
+
], 2);
|
|
1082
|
+
}
|
|
1083
|
+
const Pe = /* @__PURE__ */ Le(Be, [["render", Re]]);
|
|
1084
|
+
export {
|
|
1085
|
+
Pe as JsonViewer
|
|
1086
|
+
};
|