@code0-tech/pictor 0.10.4 → 0.10.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/components/json-view/JsonView.style.css +1 -0
- package/dist/components/breadcrumb/Breadcrumb.js +2 -2
- package/dist/components/button/Button.js +11 -11
- package/dist/components/command/Command.js +19 -22
- package/dist/components/data-table/DataTable.js +15 -15
- package/dist/components/data-table/DataTableFilterSuggestionMenu.js +15 -15
- package/dist/components/editor/Editor.js +13 -13
- package/dist/components/form/CheckboxInput.js +4 -4
- package/dist/components/form/EditorInput.js +69 -64
- package/dist/components/form/EmailInput.js +9 -9
- package/dist/components/form/InputContentEditable.hook.js +11 -11
- package/dist/components/form/InputWrapper.js +15 -15
- package/dist/components/form/NumberInput.js +9 -9
- package/dist/components/form/PasswordInput.js +4 -4
- package/dist/components/form/SwitchInput.js +7 -7
- package/dist/components/form/TextAreaInput.js +6 -6
- package/dist/components/form/TextInput.js +6 -6
- package/dist/components/form/useForm.js +2 -2
- package/dist/components/fullscreen/FullScreen.js +2 -2
- package/dist/components/gantt/Gantt.js +67 -54
- package/dist/components/gantt/GanttGroup.js +117 -98
- package/dist/components/gantt/GanttHeader.js +45 -36
- package/dist/components/json-view/JsonView.d.ts +19 -0
- package/dist/components/json-view/JsonView.js +107 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +102 -100
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.js +59 -0
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js +34 -0
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/index.js +47 -0
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/utils.js +12 -0
- package/dist/node_modules/framer-motion/dist/es/utils/use-composed-ref.js +28 -0
- package/dist/node_modules/react/cjs/react-compiler-runtime.development.js +2 -2
- package/dist/node_modules/react/cjs/react-compiler-runtime.production.js +8 -8
- package/dist/utils/reactiveArrayService.js +4 -4
- package/package.json +9 -7
- package/dist/components/gantt/GanttFooter.d.ts +0 -2
- package/dist/components/gantt/GanttFooter.js +0 -38
|
@@ -1,143 +1,162 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { c as
|
|
3
|
-
import
|
|
1
|
+
import { jsxs as F, jsx as W, Fragment as it } from "react/jsx-runtime";
|
|
2
|
+
import { c as rt } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import D from "react";
|
|
4
4
|
import "../../utils/contextStore.js";
|
|
5
5
|
import "merge-props";
|
|
6
|
-
import { withAlpha as
|
|
7
|
-
import { GanttItem as
|
|
8
|
-
import { GanttHeader as
|
|
9
|
-
const
|
|
10
|
-
const
|
|
6
|
+
import { withAlpha as U, hashToColor as X } from "../../utils/color.js";
|
|
7
|
+
import { GanttItem as at } from "./GanttItem.js";
|
|
8
|
+
import { GanttHeader as ot } from "./GanttHeader.js";
|
|
9
|
+
const H = (e, t, a, G, g, R) => {
|
|
10
|
+
const L = Math.max(0, e - a), I = Math.min(g, t - a), V = L / g * R, x = (I - L) / g * R;
|
|
11
11
|
return {
|
|
12
|
-
left:
|
|
13
|
-
width:
|
|
12
|
+
left: V,
|
|
13
|
+
width: x
|
|
14
14
|
};
|
|
15
|
-
},
|
|
16
|
-
const t =
|
|
17
|
-
items:
|
|
18
|
-
stepWidth:
|
|
19
|
-
rowHeight:
|
|
20
|
-
step:
|
|
21
|
-
start:
|
|
22
|
-
end:
|
|
23
|
-
hideScaling:
|
|
24
|
-
children:
|
|
25
|
-
} = e,
|
|
26
|
-
let
|
|
27
|
-
t
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
15
|
+
}, st = (e) => {
|
|
16
|
+
const t = rt.c(58), {
|
|
17
|
+
items: a,
|
|
18
|
+
stepWidth: G,
|
|
19
|
+
rowHeight: g,
|
|
20
|
+
step: R,
|
|
21
|
+
start: L,
|
|
22
|
+
end: I,
|
|
23
|
+
hideScaling: V,
|
|
24
|
+
children: x
|
|
25
|
+
} = e, c = G === void 0 ? "50px" : G, $ = g === void 0 ? "50px" : g, i = R === void 0 ? 1 : R, r = L === void 0 ? 1 : L, o = I === void 0 ? 999999999 : I, h = V === void 0 ? !1 : V, q = D.useRef(null), [Y, Z] = D.useState(0), [k, _] = D.useState(void 0), b = parseInt(c), p = o - r, K = Math.ceil(p / i), f = K * b;
|
|
26
|
+
let B;
|
|
27
|
+
t: {
|
|
28
|
+
if (!a || a.length === 0) {
|
|
29
|
+
let s;
|
|
30
|
+
t[0] !== o || t[1] !== r || t[2] !== i ? (s = {
|
|
31
|
+
avgDuration: i,
|
|
32
|
+
itemMinStart: r,
|
|
33
|
+
itemMaxEnd: o
|
|
34
|
+
}, t[0] = o, t[1] = r, t[2] = i, t[3] = s) : s = t[3], B = s;
|
|
35
|
+
break t;
|
|
36
|
+
}
|
|
37
|
+
let d = 0, u = 0, m = 1 / 0, E = -1 / 0;
|
|
38
|
+
for (let s = 0; s < a.length; s++) {
|
|
39
|
+
const l = a[s];
|
|
40
|
+
l.start < m && (m = l.start), l.end > E && (E = l.end), l.type !== "group" && (d = d + (l.end - l.start), u++);
|
|
41
|
+
}
|
|
42
|
+
const M = u === 0 ? i : d / u;
|
|
43
|
+
let S;
|
|
44
|
+
t[4] !== E || t[5] !== m || t[6] !== M ? (S = {
|
|
45
|
+
avgDuration: M,
|
|
46
|
+
itemMinStart: m,
|
|
47
|
+
itemMaxEnd: E
|
|
48
|
+
}, t[4] = E, t[5] = m, t[6] = M, t[7] = S) : S = t[7], B = S;
|
|
49
|
+
}
|
|
50
|
+
const {
|
|
51
|
+
avgDuration: z,
|
|
52
|
+
itemMinStart: y,
|
|
53
|
+
itemMaxEnd: v
|
|
54
|
+
} = B, tt = a && a.length > 0 ? Math.ceil((v - r) / i) : K, et = Math.ceil(Y / b), w = Math.max(et, tt + 2);
|
|
55
|
+
let A, N;
|
|
56
|
+
t[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (A = () => {
|
|
57
|
+
const d = () => {
|
|
58
|
+
Z(q.current?.offsetWidth ?? 0);
|
|
36
59
|
};
|
|
37
|
-
|
|
38
|
-
|
|
60
|
+
d();
|
|
61
|
+
const u = q.current;
|
|
62
|
+
return u?.addEventListener("resize", d), window.addEventListener("resize", d), () => {
|
|
63
|
+
window.removeEventListener("resize", d), u?.removeEventListener("resize", d);
|
|
39
64
|
};
|
|
40
|
-
}, t[
|
|
41
|
-
let
|
|
42
|
-
if (t[
|
|
43
|
-
const
|
|
44
|
-
let
|
|
45
|
-
t[
|
|
65
|
+
}, N = [], t[8] = A, t[9] = N) : (A = t[8], N = t[9]), D.useEffect(A, N);
|
|
66
|
+
let P;
|
|
67
|
+
if (t[10] !== k || t[11] !== z || t[12] !== x || t[13] !== w || t[14] !== o || t[15] !== h || t[16] !== v || t[17] !== y || t[18] !== a || t[19] !== e.id || t[20] !== $ || t[21] !== r || t[22] !== i || t[23] !== c || t[24] !== b || t[25] !== p || t[26] !== f) {
|
|
68
|
+
const d = a?.length ? a.sort(dt).reduce(lt, []) : [], u = `repeat(${w}, ${c})`;
|
|
69
|
+
let m;
|
|
70
|
+
t[28] !== u ? (m = {
|
|
46
71
|
display: "grid",
|
|
47
|
-
gridTemplateColumns:
|
|
72
|
+
gridTemplateColumns: u,
|
|
48
73
|
minWidth: "100%",
|
|
49
74
|
gridColumn: "1 / -1"
|
|
50
|
-
}, t[
|
|
51
|
-
const
|
|
52
|
-
let
|
|
53
|
-
t[
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
75
|
+
}, t[28] = u, t[29] = m) : m = t[29];
|
|
76
|
+
const E = m;
|
|
77
|
+
let M;
|
|
78
|
+
t[30] !== $ ? (M = {
|
|
79
|
+
gridColumn: "1 / -1",
|
|
80
|
+
minHeight: $,
|
|
81
|
+
position: "relative",
|
|
82
|
+
backgroundColor: "transparent"
|
|
83
|
+
}, t[30] = $, t[31] = M) : M = t[31];
|
|
84
|
+
const S = M;
|
|
85
|
+
let s;
|
|
86
|
+
t[32] !== w ? (s = Array.from({
|
|
87
|
+
length: Math.max(0, w - 1)
|
|
88
|
+
}), t[32] = w, t[33] = s) : s = t[33];
|
|
89
|
+
const l = s;
|
|
90
|
+
let T;
|
|
91
|
+
t[34] !== z || t[35] !== w || t[36] !== h || t[37] !== r || t[38] !== i || t[39] !== c ? (T = !h && /* @__PURE__ */ W(ot, { columnCount: w, start: r, step: i, avgDuration: z, stepWidth: c }), t[34] = z, t[35] = w, t[36] = h, t[37] = r, t[38] = i, t[39] = c, t[40] = T) : T = t[40];
|
|
92
|
+
let j;
|
|
93
|
+
t[41] !== k || t[42] !== x || t[43] !== o || t[44] !== l || t[45] !== h || t[46] !== v || t[47] !== y || t[48] !== e.id || t[49] !== $ || t[50] !== S || t[51] !== r || t[52] !== i || t[53] !== c || t[54] !== b || t[55] !== p || t[56] !== f ? (j = (O, Q) => /* @__PURE__ */ F(D.Fragment, { children: [
|
|
94
|
+
/* @__PURE__ */ F("div", { style: S, children: [
|
|
95
|
+
l.map((n, C) => /* @__PURE__ */ W("div", { style: {
|
|
65
96
|
position: "absolute",
|
|
66
|
-
left: (
|
|
97
|
+
left: (C + 1) * b,
|
|
67
98
|
top: 0,
|
|
68
99
|
bottom: 0,
|
|
69
100
|
width: "0px",
|
|
70
|
-
borderLeft: `1px dashed rgba(255, 255, 255, ${
|
|
71
|
-
} }, `grid-${
|
|
72
|
-
|
|
73
|
-
/* @__PURE__ */
|
|
101
|
+
borderLeft: `1px dashed rgba(255, 255, 255, ${h ? 0.05 : 0.1})`
|
|
102
|
+
} }, `grid-${C}`)),
|
|
103
|
+
h && /* @__PURE__ */ F(it, { children: [
|
|
104
|
+
/* @__PURE__ */ W("div", { className: "gantt__group-wrapper", style: {
|
|
74
105
|
backgroundImage: `
|
|
75
106
|
linear-gradient(to right, transparent, #070514),
|
|
76
107
|
repeating-linear-gradient(
|
|
77
108
|
45deg,
|
|
78
109
|
transparent,
|
|
79
110
|
transparent 2px,
|
|
80
|
-
${
|
|
111
|
+
${U(X(e.id.replace("target", "source")), 0.5)} 4px
|
|
81
112
|
)
|
|
82
113
|
`,
|
|
83
|
-
left: `${
|
|
84
|
-
width: `${
|
|
114
|
+
left: `${H(y, y + i, r, o, p, f).left}px`,
|
|
115
|
+
width: `${H(y, y + i, r, o, p, f).width}px`
|
|
85
116
|
} }),
|
|
86
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ W("div", { className: "gantt__group-wrapper", style: {
|
|
87
118
|
backgroundImage: `
|
|
88
119
|
linear-gradient(to left, transparent, #070514),
|
|
89
120
|
repeating-linear-gradient(
|
|
90
121
|
45deg,
|
|
91
122
|
transparent,
|
|
92
123
|
transparent 2px,
|
|
93
|
-
${
|
|
124
|
+
${U(X(e.id.replace("target", "source")), 0.5)} 4px
|
|
94
125
|
)
|
|
95
126
|
`,
|
|
96
|
-
left: `${
|
|
97
|
-
width: `${
|
|
127
|
+
left: `${H(v - i, v, r, o, p, f).left}px`,
|
|
128
|
+
width: `${H(v - i, v, r, o, p, f).width}px`
|
|
98
129
|
} })
|
|
99
130
|
] }),
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
return
|
|
103
|
-
|
|
104
|
-
}, children:
|
|
131
|
+
O.map((n, C) => {
|
|
132
|
+
const J = H(n.start, n.end, r, o, p, f);
|
|
133
|
+
return J.width > 0 && /* @__PURE__ */ W(at, { id: n.id, w: `${J.width}px`, left: `${J.left}px`, onClick: () => {
|
|
134
|
+
n.type == "group" && _((nt) => n.id === nt ? void 0 : n.id);
|
|
135
|
+
}, children: x?.(n, C) }, n.id);
|
|
105
136
|
})
|
|
106
|
-
] }, `row-${
|
|
107
|
-
|
|
108
|
-
] }), t[
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
] }), t[
|
|
137
|
+
] }, `row-${Q}`),
|
|
138
|
+
O.map((n, C) => n.type === "group" && k === n.id && /* @__PURE__ */ W(st, { children: x, id: `group-target-${C}`, start: Math.min(...n.data.items.map(ct)) - Math.min(...n.data.items.map(pt)) / (n.data.firstGroupStep * n.data.step) * (n.data.groupStep * n.data.step), step: n.data.groupStep * n.data.step, stepWidth: c, rowHeight: $, items: n.data.items }, `group-target-${C}`))
|
|
139
|
+
] }, `row-frag-${Q}`), t[41] = k, t[42] = x, t[43] = o, t[44] = l, t[45] = h, t[46] = v, t[47] = y, t[48] = e.id, t[49] = $, t[50] = S, t[51] = r, t[52] = i, t[53] = c, t[54] = b, t[55] = p, t[56] = f, t[57] = j) : j = t[57], P = /* @__PURE__ */ F("div", { "data-gantt-id": e.id, id: e.id, ref: q, style: E, children: [
|
|
140
|
+
T,
|
|
141
|
+
d.map(j)
|
|
142
|
+
] }), t[10] = k, t[11] = z, t[12] = x, t[13] = w, t[14] = o, t[15] = h, t[16] = v, t[17] = y, t[18] = a, t[19] = e.id, t[20] = $, t[21] = r, t[22] = i, t[23] = c, t[24] = b, t[25] = p, t[26] = f, t[27] = P;
|
|
112
143
|
} else
|
|
113
|
-
|
|
114
|
-
return
|
|
144
|
+
P = t[27];
|
|
145
|
+
return P;
|
|
115
146
|
};
|
|
116
|
-
function
|
|
117
|
-
return e.type !== "group";
|
|
118
|
-
}
|
|
119
|
-
function ot(e, t) {
|
|
120
|
-
return e + (t.end - t.start);
|
|
121
|
-
}
|
|
122
|
-
function st(e) {
|
|
123
|
-
return e.start;
|
|
124
|
-
}
|
|
125
|
-
function dt(e) {
|
|
126
|
-
return e.end;
|
|
127
|
-
}
|
|
128
|
-
function ct(e, t) {
|
|
147
|
+
function dt(e, t) {
|
|
129
148
|
return e.start - t.start;
|
|
130
149
|
}
|
|
131
150
|
function lt(e, t) {
|
|
132
|
-
const
|
|
133
|
-
return
|
|
151
|
+
const a = e.find((G) => !G.some((g) => !(t.end <= g.start || t.start >= g.end)));
|
|
152
|
+
return a ? (a.push(t), e) : [...e, [t]];
|
|
134
153
|
}
|
|
135
|
-
function
|
|
154
|
+
function ct(e) {
|
|
136
155
|
return e.start;
|
|
137
156
|
}
|
|
138
|
-
function
|
|
157
|
+
function pt(e) {
|
|
139
158
|
return e.start;
|
|
140
159
|
}
|
|
141
160
|
export {
|
|
142
|
-
|
|
161
|
+
st as GanttGroup
|
|
143
162
|
};
|
|
@@ -1,53 +1,62 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as g, jsxs as N } from "react/jsx-runtime";
|
|
2
2
|
import { c as W } from "../../_virtual/compiler-runtime.js";
|
|
3
3
|
import "../../utils/contextStore.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import { mergeComponentProps as j } from "../../utils/component.js";
|
|
6
6
|
import "js-md5";
|
|
7
|
-
import { Text as
|
|
8
|
-
const x = (
|
|
9
|
-
const
|
|
10
|
-
let
|
|
11
|
-
if (
|
|
7
|
+
import { Text as $ } from "../text/Text.js";
|
|
8
|
+
const x = (t) => {
|
|
9
|
+
const e = W.c(22);
|
|
10
|
+
let i, s, a, n, r, o, m;
|
|
11
|
+
if (e[0] !== t) {
|
|
12
12
|
const {
|
|
13
|
-
columnCount:
|
|
13
|
+
columnCount: f,
|
|
14
14
|
start: l,
|
|
15
|
-
step:
|
|
16
|
-
avgDuration:
|
|
17
|
-
stepWidth:
|
|
18
|
-
...
|
|
19
|
-
} =
|
|
20
|
-
|
|
15
|
+
step: _,
|
|
16
|
+
avgDuration: c,
|
|
17
|
+
stepWidth: v,
|
|
18
|
+
...b
|
|
19
|
+
} = t;
|
|
20
|
+
a = l, n = _, r = v, o = parseInt(r);
|
|
21
|
+
let u;
|
|
22
|
+
e[8] !== c ? (u = y(c), e[8] = c, e[9] = u) : u = e[9], s = u;
|
|
23
|
+
let d;
|
|
24
|
+
e[10] !== f ? (d = Array.from({
|
|
25
|
+
length: f
|
|
26
|
+
}), e[10] = f, e[11] = d) : d = e[11], i = d, m = j("gantt__header", b), e[0] = t, e[1] = i, e[2] = s, e[3] = a, e[4] = n, e[5] = r, e[6] = o, e[7] = m;
|
|
21
27
|
} else
|
|
22
|
-
|
|
23
|
-
let c;
|
|
24
|
-
t[8] !== s ? (c = Array.from({
|
|
25
|
-
length: s
|
|
26
|
-
}), t[8] = s, t[9] = c) : c = t[9];
|
|
28
|
+
i = e[1], s = e[2], a = e[3], n = e[4], r = e[5], o = e[6], m = e[7];
|
|
27
29
|
let h;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
e[12] !== i || e[13] !== s || e[14] !== a || e[15] !== n || e[16] !== r || e[17] !== o ? (h = i.map((f, l) => {
|
|
31
|
+
if (l === 0)
|
|
32
|
+
return /* @__PURE__ */ g("div", { className: "gantt__header-label-column", children: /* @__PURE__ */ N($, { className: "gantt__header-label", children: [
|
|
33
|
+
"Range in ",
|
|
34
|
+
s.unit
|
|
35
|
+
] }) }, `header-${l}`);
|
|
36
|
+
const _ = l % 4 === 0;
|
|
37
|
+
let c = "";
|
|
38
|
+
if (_) {
|
|
39
|
+
const v = a + l * n, {
|
|
40
|
+
value: b,
|
|
41
|
+
unit: u
|
|
42
|
+
} = y(v);
|
|
43
|
+
c = `${Math.round(b * 10) / 10}${u}`;
|
|
44
|
+
}
|
|
45
|
+
return /* @__PURE__ */ g("div", { className: "gantt__header-column", style: {
|
|
34
46
|
left: l * o,
|
|
35
47
|
width: r
|
|
36
|
-
}, children: /* @__PURE__ */
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return t[17] !== m || t[18] !== h ? (u = /* @__PURE__ */ p("div", { ...m, children: h }), t[17] = m, t[18] = h, t[19] = u) : u = t[19], u;
|
|
43
|
-
}, $ = (e) => e > 5e5 ? {
|
|
44
|
-
value: e / 1e6,
|
|
48
|
+
}, children: /* @__PURE__ */ g($, { children: c }) }, `header-${l}`);
|
|
49
|
+
}), e[12] = i, e[13] = s, e[14] = a, e[15] = n, e[16] = r, e[17] = o, e[18] = h) : h = e[18];
|
|
50
|
+
let p;
|
|
51
|
+
return e[19] !== m || e[20] !== h ? (p = /* @__PURE__ */ g("div", { ...m, children: h }), e[19] = m, e[20] = h, e[21] = p) : p = e[21], p;
|
|
52
|
+
}, y = (t) => t > 5e5 ? {
|
|
53
|
+
value: t / 1e6,
|
|
45
54
|
unit: "s"
|
|
46
|
-
} :
|
|
47
|
-
value:
|
|
55
|
+
} : t > 500 ? {
|
|
56
|
+
value: t / 1e3,
|
|
48
57
|
unit: "ms"
|
|
49
58
|
} : {
|
|
50
|
-
value:
|
|
59
|
+
value: t,
|
|
51
60
|
unit: "μs"
|
|
52
61
|
};
|
|
53
62
|
export {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { JsonViewProps as ReactJsonViewProps } from '@uiw/react-json-view';
|
|
3
|
+
import { Component } from '../../utils';
|
|
4
|
+
export interface JsonViewProps<T extends object = object> extends Omit<Component<HTMLDivElement>, 'value'> {
|
|
5
|
+
value?: T;
|
|
6
|
+
keyName?: string | number;
|
|
7
|
+
collapsed?: boolean | number;
|
|
8
|
+
displayObjectSize?: boolean;
|
|
9
|
+
displayDataTypes?: boolean;
|
|
10
|
+
enableClipboard?: boolean;
|
|
11
|
+
indentWidth?: number;
|
|
12
|
+
shortenTextAfterLength?: number;
|
|
13
|
+
highlightUpdates?: boolean;
|
|
14
|
+
objectSortKeys?: ReactJsonViewProps<T>['objectSortKeys'];
|
|
15
|
+
shouldExpandNodeInitially?: ReactJsonViewProps<T>['shouldExpandNodeInitially'];
|
|
16
|
+
onCopied?: ReactJsonViewProps<T>['onCopied'];
|
|
17
|
+
onExpand?: ReactJsonViewProps<T>['onExpand'];
|
|
18
|
+
}
|
|
19
|
+
export declare const JsonView: <T extends object = object>(props: JsonViewProps<T>) => React.JSX.Element;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx as l, jsxs as N } from "react/jsx-runtime";
|
|
2
|
+
import { c as k } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import b from "@uiw/react-json-view";
|
|
4
|
+
import { IconChevronRight as T, IconCheck as z, IconCopy as I } from "@tabler/icons-react";
|
|
5
|
+
import "../../utils/contextStore.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import { mergeComponentProps as E } from "../../utils/component.js";
|
|
8
|
+
import { hashToColor as r } from "../../utils/color.js";
|
|
9
|
+
import '../../assets/components/json-view/JsonView.style.css';/* empty css */
|
|
10
|
+
import { AnimatePresence as S } from "../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.js";
|
|
11
|
+
import { motion as V } from "../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
|
|
12
|
+
const q = {
|
|
13
|
+
"--w-rjv-font-family": '"Inter", sans-serif',
|
|
14
|
+
"--w-rjv-font-size": "0.8rem",
|
|
15
|
+
"--w-rjv-color": "rgba(255, 255, 255, 0.75)",
|
|
16
|
+
"--w-rjv-key-string": "rgba(255, 255, 255, 0.75)",
|
|
17
|
+
"--w-rjv-background-color": "transparent",
|
|
18
|
+
"--w-rjv-line-color": "rgba(191, 191, 191, 0.1)",
|
|
19
|
+
"--w-rjv-arrow-color": "rgba(255, 255, 255, 0.5)",
|
|
20
|
+
"--w-rjv-edit-color": "rgba(255, 255, 255, 0.75)",
|
|
21
|
+
"--w-rjv-info-color": "rgba(255, 255, 255, 0.5)",
|
|
22
|
+
"--w-rjv-update-color": "#ebcb8b",
|
|
23
|
+
"--w-rjv-copied-color": "rgba(255, 255, 255, 0.75)",
|
|
24
|
+
"--w-rjv-copied-success-color": "#29BF12",
|
|
25
|
+
"--w-rjv-curlybraces-color": r("bracket"),
|
|
26
|
+
"--w-rjv-brackets-color": r("squareBracket"),
|
|
27
|
+
"--w-rjv-quotes-color": "rgba(255, 255, 255, 0.75)",
|
|
28
|
+
"--w-rjv-quotes-string-color": r("Text"),
|
|
29
|
+
"--w-rjv-type-string-color": r("Text"),
|
|
30
|
+
"--w-rjv-type-int-color": r("Number"),
|
|
31
|
+
"--w-rjv-type-float-color": r("Number"),
|
|
32
|
+
"--w-rjv-type-bigint-color": r("Number"),
|
|
33
|
+
"--w-rjv-type-boolean-color": r("Boolean"),
|
|
34
|
+
"--w-rjv-type-date-color": r("Text"),
|
|
35
|
+
"--w-rjv-type-url-color": r("Text"),
|
|
36
|
+
"--w-rjv-type-null-color": r("Null"),
|
|
37
|
+
"--w-rjv-type-nan-color": r("Number"),
|
|
38
|
+
"--w-rjv-type-undefined-color": r("Null")
|
|
39
|
+
}, K = (a) => {
|
|
40
|
+
const e = k.c(23);
|
|
41
|
+
let o, i, n, c, m, t;
|
|
42
|
+
if (e[0] !== a) {
|
|
43
|
+
const {
|
|
44
|
+
displayObjectSize: u,
|
|
45
|
+
displayDataTypes: g,
|
|
46
|
+
enableClipboard: h,
|
|
47
|
+
indentWidth: x,
|
|
48
|
+
value: _,
|
|
49
|
+
...C
|
|
50
|
+
} = a;
|
|
51
|
+
t = _, i = u === void 0 ? !1 : u, o = g === void 0 ? !1 : g, n = h === void 0 ? !0 : h, c = x === void 0 ? 12.8 : x, m = E("json-view", C), e[0] = a, e[1] = o, e[2] = i, e[3] = n, e[4] = c, e[5] = m, e[6] = t;
|
|
52
|
+
} else
|
|
53
|
+
o = e[1], i = e[2], n = e[3], c = e[4], m = e[5], t = e[6];
|
|
54
|
+
const s = m;
|
|
55
|
+
let v;
|
|
56
|
+
e[7] !== t ? (v = t == null || typeof t != "object" ? [t] : t, e[7] = t, e[8] = v) : v = e[8];
|
|
57
|
+
const y = v;
|
|
58
|
+
let p;
|
|
59
|
+
e[9] !== s.style ? (p = s.style ?? {}, e[9] = s.style, e[10] = p) : p = e[10];
|
|
60
|
+
let d;
|
|
61
|
+
e[11] !== p ? (d = {
|
|
62
|
+
...q,
|
|
63
|
+
...p
|
|
64
|
+
}, e[11] = p, e[12] = d) : d = e[12];
|
|
65
|
+
let w, j;
|
|
66
|
+
e[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ l(b.Arrow, { render: B }), j = /* @__PURE__ */ l(b.Copied, { render: J }), e[13] = w, e[14] = j) : (w = e[13], j = e[14]);
|
|
67
|
+
let f;
|
|
68
|
+
return e[15] !== o || e[16] !== i || e[17] !== n || e[18] !== c || e[19] !== s || e[20] !== y || e[21] !== d ? (f = /* @__PURE__ */ N(b, { displayObjectSize: i, displayDataTypes: o, enableClipboard: n, indentWidth: c, ...s, value: y, style: d, children: [
|
|
69
|
+
w,
|
|
70
|
+
j
|
|
71
|
+
] }), e[15] = o, e[16] = i, e[17] = n, e[18] = c, e[19] = s, e[20] = y, e[21] = d, e[22] = f) : f = e[22], f;
|
|
72
|
+
};
|
|
73
|
+
function B(a) {
|
|
74
|
+
const {
|
|
75
|
+
"data-expanded": e,
|
|
76
|
+
...o
|
|
77
|
+
} = a;
|
|
78
|
+
return /* @__PURE__ */ l("span", { ...o, className: "json-view__arrow", "data-expanded": e, children: /* @__PURE__ */ l(T, { size: 13 }) });
|
|
79
|
+
}
|
|
80
|
+
function J(a) {
|
|
81
|
+
const {
|
|
82
|
+
"data-copied": e,
|
|
83
|
+
onClick: o,
|
|
84
|
+
...i
|
|
85
|
+
} = a;
|
|
86
|
+
return /* @__PURE__ */ l("span", { ...i, onClick: o, className: "json-view__copy", "data-copied": e, children: /* @__PURE__ */ l(S, { mode: "wait", initial: !1, children: /* @__PURE__ */ l(V.span, { initial: {
|
|
87
|
+
opacity: 0,
|
|
88
|
+
scale: 0.5,
|
|
89
|
+
filter: "blur(0.35rem)"
|
|
90
|
+
}, animate: {
|
|
91
|
+
opacity: 1,
|
|
92
|
+
scale: 1,
|
|
93
|
+
filter: "blur(0px)"
|
|
94
|
+
}, exit: {
|
|
95
|
+
opacity: 0,
|
|
96
|
+
scale: 0.5,
|
|
97
|
+
filter: "blur(0.35rem)"
|
|
98
|
+
}, transition: {
|
|
99
|
+
duration: 0.05,
|
|
100
|
+
ease: "easeIn"
|
|
101
|
+
}, style: {
|
|
102
|
+
display: "inline-flex"
|
|
103
|
+
}, children: e ? /* @__PURE__ */ l(z, { size: 13 }) : /* @__PURE__ */ l(I, { size: 13 }) }, e ? "check" : "copy") }) });
|
|
104
|
+
}
|
|
105
|
+
export {
|
|
106
|
+
K as JsonView
|
|
107
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from './components/file-tabs/index';
|
|
|
17
17
|
export * from './components/flex/Flex';
|
|
18
18
|
export * from './components/flex/Flex';
|
|
19
19
|
export * from './components/form/index';
|
|
20
|
+
export * from './components/json-view/JsonView';
|
|
20
21
|
export * from './components/fullscreen/FullScreen';
|
|
21
22
|
export * from './components/gantt/Gantt';
|
|
22
23
|
export * from './components/layout/Layout';
|