react-kggraph 0.0.17 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +197 -9
  2. package/lib/index.es.js +8 -6
  3. package/lib/index.es10.js +186 -69
  4. package/lib/index.es11.js +69 -28
  5. package/lib/index.es12.js +29 -69
  6. package/lib/index.es13.js +64 -224
  7. package/lib/index.es14.js +69 -4
  8. package/lib/index.es15.js +4 -35
  9. package/lib/index.es16.js +37 -0
  10. package/lib/index.es18.js +15462 -49
  11. package/lib/index.es19.js +50 -56
  12. package/lib/index.es20.js +57 -66
  13. package/lib/index.es21.js +68 -39
  14. package/lib/index.es22.js +40 -2
  15. package/lib/index.es23.js +1 -1
  16. package/lib/index.es24.js +2 -2
  17. package/lib/index.es25.js +1 -1
  18. package/lib/index.es26.js +1 -1
  19. package/lib/index.es27.js +1 -1
  20. package/lib/index.es28.js +1 -1
  21. package/lib/index.es29.js +1 -1
  22. package/lib/index.es3.js +201 -182
  23. package/lib/index.es30.js +1 -1
  24. package/lib/index.es31.js +1 -1
  25. package/lib/index.es32.js +2 -2
  26. package/lib/index.es33.js +4 -0
  27. package/lib/index.es35.js +4 -2
  28. package/lib/index.es36.js +4 -0
  29. package/lib/index.es4.js +17 -6
  30. package/lib/index.es5.js +6 -2
  31. package/lib/index.es6.js +2 -599
  32. package/lib/index.es7.js +578 -312
  33. package/lib/index.es8.js +294 -393
  34. package/lib/index.es9.js +408 -173
  35. package/lib/src/components/Graph/components/ActionBar/actionList.d.ts +10 -0
  36. package/lib/src/components/Graph/components/ActionBar/index.d.ts +15 -0
  37. package/lib/src/components/Graph/components/SettingCircle/index.d.ts +4 -2
  38. package/lib/src/components/Graph/types.d.ts +62 -1
  39. package/lib/src/components/Graph/utils/edge_node_styles.d.ts +5 -2
  40. package/lib/src/components/Graph/utils/menuItems.d.ts +12 -1
  41. package/lib/style.css +1 -1
  42. package/package.json +1 -1
  43. package/lib/index.es17.js +0 -15469
  44. package/lib/index.es34.js +0 -6
package/lib/index.es12.js CHANGED
@@ -1,72 +1,32 @@
1
- import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
- import { useMemo as b } from "react";
3
- /* empty css */
4
- const L = ({
5
- items: h = [
6
- // { label: '知识卡片' },
7
- // { label: '选中关联' },
8
- // { label: '路径分析' },
9
- // { label: '展收实体' },
10
- // { label: '展收属性' },
11
- // { label: '节点配置' },
12
- ],
13
- centerImage: f,
14
- size: c = 200,
15
- onClick: $
16
- }) => {
17
- const t = c / 2, a = c / 2 - 10, s = 30, o = 360 / h.length, p = b(() => h.map((n, r) => {
18
- const l = (r * o - 90) * (Math.PI / 180), i = ((r + 1) * o - 90) * (Math.PI / 180), m = ((r + 0.5) * o - 90) * (Math.PI / 180), y = t + a * Math.cos(l), v = t + a * Math.sin(l), w = t + a * Math.cos(i), A = t + a * Math.sin(i), N = t + s * Math.cos(i), k = t + s * Math.sin(i), u = t + s * Math.cos(l), x = t + s * Math.sin(l), g = o > 180 ? 1 : 0, I = `M ${u} ${x} L ${y} ${v} A ${a} ${a} 0 ${g} 1 ${w} ${A} L ${N} ${k} A ${s} ${s} 0 ${g} 0 ${u} ${x}`, M = (a + s) / 2 + 5, P = t + M * Math.cos(m), R = t + M * Math.sin(m);
19
- return {
20
- ...n,
21
- path: I,
22
- textX: P,
23
- textY: R,
24
- rotation: (r + 0.5) * o - 90
25
- };
26
- }), [h, o, t, a, s]);
27
- return /* @__PURE__ */ d("div", { className: "radial-menu", style: { width: c, height: c }, children: [
28
- /* @__PURE__ */ d("svg", { width: c, height: c, className: "radial-svg", children: [
29
- /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ e("filter", { id: "shadow", x: "-20%", y: "-20%", width: "140%", height: "140%", children: /* @__PURE__ */ e("feDropShadow", { dx: "0", dy: "2", stdDeviation: "3", floodOpacity: "0.3" }) }) }),
30
- /* @__PURE__ */ e("circle", { cx: t, cy: t, r: a, fill: "#f5f5f5", stroke: "#ddd", strokeWidth: "1" }),
31
- p.map((n, r) => /* @__PURE__ */ d("g", { onClick: () => $(n), className: "sector-group", children: [
32
- /* @__PURE__ */ e(
33
- "path",
34
- {
35
- d: n.path,
36
- fill: "#333",
37
- stroke: "rgb(185, 185, 185)",
38
- strokeWidth: "1",
39
- filter: "url(#shadow)",
40
- className: "sector-path"
41
- }
42
- ),
43
- /* @__PURE__ */ e(
44
- "text",
45
- {
46
- x: n.textX,
47
- y: n.textY,
48
- textAnchor: "middle",
49
- dominantBaseline: "middle",
50
- fill: "#fff",
51
- fontSize: "12",
52
- fontWeight: "500",
53
- className: "sector-label",
54
- children: n.label
55
- }
56
- )
57
- ] }, r)),
58
- /* @__PURE__ */ e("circle", { cx: t, cy: t, r: s + 2, fill: "#fff" })
59
- ] }),
60
- /* @__PURE__ */ e(
61
- "div",
62
- {
63
- className: "center-avatar",
64
- style: { width: s * 2, height: s * 2 },
65
- children: f ? /* @__PURE__ */ e("img", { src: f, alt: "avatar" }) : /* @__PURE__ */ e("span", { className: "center-text", children: "菜单" })
66
- }
67
- )
68
- ] });
1
+ const t = (r) => {
2
+ if (n(r) || Array.isArray(r))
3
+ try {
4
+ return JSON.stringify(r);
5
+ } catch (e) {
6
+ console.log("JSON.stringify", e);
7
+ }
8
+ else
9
+ return r;
10
+ }, c = (r) => {
11
+ if (n(r) || Array.isArray(r))
12
+ try {
13
+ return JSON.parse(JSON.stringify(r));
14
+ } catch (e) {
15
+ console.log("JSON.stringify-JSON.parse", e);
16
+ }
17
+ else
18
+ return r;
19
+ };
20
+ function n(r) {
21
+ return r !== null && typeof r == "object" && !Array.isArray(r);
22
+ }
23
+ const i = (r, e) => {
24
+ const o = document.createElement("a");
25
+ o.href = r, o.download = e, document.body.appendChild(o), o.click(), document.body.removeChild(o);
69
26
  };
70
27
  export {
71
- L as default
28
+ i as downloadFile,
29
+ n as isObject,
30
+ t as jsonStringify,
31
+ c as jsonStringifyParse
72
32
  };
package/lib/index.es13.js CHANGED
@@ -1,226 +1,66 @@
1
- import { jsx as e, jsxs as r } from "react/jsx-runtime";
2
- import { forwardRef as h, useState as s, useImperativeHandle as b } from "react";
3
- import { Drawer as x } from "antd";
4
- const N = h((y, d) => {
5
- const [c, t] = s(!1), [a, o] = s({ style: {}, data: {} });
6
- b(d, () => ({
7
- open: (n) => {
8
- t(!0), o(n);
9
- },
10
- close: () => t(!1)
11
- }));
12
- const i = () => {
13
- t(!1);
14
- }, l = (n) => {
15
- const { name: p, value: m } = n.target;
16
- o((u) => ({ ...u, [p]: m }));
17
- };
18
- return /* @__PURE__ */ e(
19
- x,
20
- {
21
- title: "节点配置",
22
- closable: { "aria-label": "Close Button" },
23
- onClose: i,
24
- open: c,
25
- getContainer: !1,
26
- children: /* @__PURE__ */ e("div", { className: "h-full overflow-y-auto z-50", children: /* @__PURE__ */ r("div", { className: "space-y-4", children: [
27
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
28
- /* @__PURE__ */ e("label", { className: "w-40", children: "名称" }),
29
- /* @__PURE__ */ e(
30
- "input",
31
- {
32
- name: "name",
33
- value: a.data.name,
34
- onChange: l,
35
- readOnly: !0,
36
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-blue-500"
37
- }
38
- )
39
- ] }),
40
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
41
- /* @__PURE__ */ e("label", { className: "w-40", children: "类型" }),
42
- /* @__PURE__ */ r(
43
- "select",
44
- {
45
- name: "type",
46
- value: a.type,
47
- disabled: !0,
48
- onChange: l,
49
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded bg-white",
50
- children: [
51
- /* @__PURE__ */ e("option", { value: "圆形", children: "圆形" }),
52
- /* @__PURE__ */ e("option", { value: "矩形", children: "矩形" })
53
- ]
54
- }
55
- )
56
- ] }),
57
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
58
- /* @__PURE__ */ e("label", { className: "w-40", children: "颜色" }),
59
- /* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 items-center", children: [
60
- /* @__PURE__ */ e(
61
- "input",
62
- {
63
- name: "color",
64
- readOnly: !0,
65
- value: a.style.color,
66
- onChange: l,
67
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded h-30px"
68
- }
69
- ),
70
- /* @__PURE__ */ e(
71
- "input",
72
- {
73
- type: "color",
74
- readOnly: !0,
75
- value: a.style.color,
76
- onChange: (n) => o({ ...a, color: n.target.value }),
77
- className: "h-20px w-20px rounded cursor-pointer border"
78
- }
79
- )
80
- ] })
81
- ] }),
82
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
83
- /* @__PURE__ */ e("label", { className: "w-40", children: "大小" }),
84
- /* @__PURE__ */ e(
85
- "input",
86
- {
87
- type: "number",
88
- name: "size",
89
- readOnly: !0,
90
- value: parseInt(a.style.height),
91
- onChange: l,
92
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded "
93
- }
94
- )
95
- ] }),
96
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
97
- /* @__PURE__ */ e("label", { className: "w-40", children: "边框宽度" }),
98
- /* @__PURE__ */ e(
99
- "input",
100
- {
101
- type: "number",
102
- name: "borderWidth",
103
- readOnly: !0,
104
- value: parseInt(a.style.borderWidth),
105
- onChange: l,
106
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded "
107
- }
108
- )
109
- ] }),
110
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
111
- /* @__PURE__ */ e("label", { className: "w-40", children: "边框虚线" }),
112
- /* @__PURE__ */ r(
113
- "select",
114
- {
115
- name: "borderDash",
116
- value: a.style.borderDash,
117
- disabled: !0,
118
- onChange: l,
119
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded bg-white",
120
- children: [
121
- /* @__PURE__ */ e("option", { value: "否", children: "否" }),
122
- /* @__PURE__ */ e("option", { value: "是", children: "是" })
123
- ]
124
- }
125
- )
126
- ] }),
127
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
128
- /* @__PURE__ */ e("label", { className: "w-40", children: "边框颜色" }),
129
- /* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 items-center", children: [
130
- /* @__PURE__ */ e(
131
- "input",
132
- {
133
- name: "borderColor",
134
- value: a.style.borderColor,
135
- readOnly: !0,
136
- onChange: l,
137
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded h-30px"
138
- }
139
- ),
140
- /* @__PURE__ */ e(
141
- "input",
142
- {
143
- type: "color",
144
- value: a.borderColor,
145
- readOnly: !0,
146
- onChange: (n) => o({ ...a, borderColor: n.target.value }),
147
- className: "h-20px w-20px rounded cursor-pointer border"
148
- }
149
- )
150
- ] })
151
- ] }),
152
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
153
- /* @__PURE__ */ e("label", { className: "w-40", children: "字体位置" }),
154
- /* @__PURE__ */ r(
155
- "select",
156
- {
157
- name: "fontPosition",
158
- value: a.style.textValign,
159
- disabled: !0,
160
- onChange: l,
161
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded bg-white",
162
- children: [
163
- /* @__PURE__ */ e("option", { value: "center", children: "居中" }),
164
- /* @__PURE__ */ e("option", { value: "bottom", children: "底部" }),
165
- /* @__PURE__ */ e("option", { value: "top", children: "顶部" })
166
- ]
167
- }
168
- )
169
- ] }),
170
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
171
- /* @__PURE__ */ e("label", { className: "w-40", children: "字体样式" }),
172
- /* @__PURE__ */ e(
173
- "input",
174
- {
175
- name: "fontStyle",
176
- value: a.style.fontStyle,
177
- readOnly: !0,
178
- onChange: l,
179
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded "
180
- }
181
- )
182
- ] }),
183
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
184
- /* @__PURE__ */ e("label", { className: "w-40", children: "字体颜色" }),
185
- /* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 items-center", children: [
186
- /* @__PURE__ */ e(
187
- "input",
188
- {
189
- name: "fontColor",
190
- readOnly: !0,
191
- value: a.style.textBorderColor,
192
- onChange: l,
193
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded h-30px"
194
- }
195
- ),
196
- /* @__PURE__ */ e(
197
- "input",
198
- {
199
- type: "color",
200
- readOnly: !0,
201
- value: a.style["font-color"],
202
- onChange: (n) => o({ ...a, fontColor: n.target.value }),
203
- className: "h-20px w-20px rounded cursor-pointer border"
204
- }
205
- )
206
- ] })
207
- ] }),
208
- /* @__PURE__ */ r("div", { className: "flex items-center gap-4 !mb-20px", children: [
209
- /* @__PURE__ */ e("label", { className: "w-40", children: "字体背色" }),
210
- /* @__PURE__ */ e(
211
- "input",
212
- {
213
- type: "text",
214
- readOnly: !0,
215
- value: a.style.textBackgroundColor,
216
- className: "flex-1 px-3 py-1.5 border border-gray-300 rounded bg-gray-50 text-gray-400 cursor-not-allowed"
217
- }
218
- )
219
- ] })
220
- ] }) })
221
- }
222
- );
223
- });
1
+ import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
+ import { useMemo as C } from "react";
3
+ /* empty css */
4
+ const S = ({
5
+ items: h = [],
6
+ centerImage: f,
7
+ size: c = 200,
8
+ onClick: $,
9
+ targetNode: p
10
+ }) => {
11
+ const t = c / 2, a = c / 2 - 10, s = 30, o = 360 / h.length, y = C(() => h.map((n, r) => {
12
+ const l = (r * o - 90) * (Math.PI / 180), i = ((r + 1) * o - 90) * (Math.PI / 180), m = ((r + 0.5) * o - 90) * (Math.PI / 180), v = t + a * Math.cos(l), w = t + a * Math.sin(l), A = t + a * Math.cos(i), N = t + a * Math.sin(i), k = t + s * Math.cos(i), I = t + s * Math.sin(i), u = t + s * Math.cos(l), x = t + s * Math.sin(l), g = o > 180 ? 1 : 0, P = `M ${u} ${x} L ${v} ${w} A ${a} ${a} 0 ${g} 1 ${A} ${N} L ${k} ${I} A ${s} ${s} 0 ${g} 0 ${u} ${x}`, M = (a + s) / 2 + 5, R = t + M * Math.cos(m), b = t + M * Math.sin(m);
13
+ return {
14
+ ...n,
15
+ path: P,
16
+ textX: R,
17
+ textY: b,
18
+ rotation: (r + 0.5) * o - 90
19
+ };
20
+ }), [h, o, t, a, s]);
21
+ return /* @__PURE__ */ d("div", { className: "radial-menu", style: { width: c, height: c }, children: [
22
+ /* @__PURE__ */ d("svg", { width: c, height: c, className: "radial-svg", children: [
23
+ /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ e("filter", { id: "shadow", x: "-20%", y: "-20%", width: "140%", height: "140%", children: /* @__PURE__ */ e("feDropShadow", { dx: "0", dy: "2", stdDeviation: "3", floodOpacity: "0.3" }) }) }),
24
+ /* @__PURE__ */ e("circle", { cx: t, cy: t, r: a, fill: "#f5f5f5", stroke: "#ddd", strokeWidth: "1" }),
25
+ y.map((n, r) => /* @__PURE__ */ d("g", { onClick: () => $(n, p), className: "sector-group", children: [
26
+ /* @__PURE__ */ e(
27
+ "path",
28
+ {
29
+ d: n.path,
30
+ fill: "#333",
31
+ stroke: "rgb(185, 185, 185)",
32
+ strokeWidth: "1",
33
+ filter: "url(#shadow)",
34
+ className: "sector-path"
35
+ }
36
+ ),
37
+ /* @__PURE__ */ e(
38
+ "text",
39
+ {
40
+ x: n.textX,
41
+ y: n.textY,
42
+ textAnchor: "middle",
43
+ dominantBaseline: "middle",
44
+ fill: "#fff",
45
+ fontSize: "12",
46
+ fontWeight: "500",
47
+ className: "sector-label",
48
+ children: n.label
49
+ }
50
+ )
51
+ ] }, r)),
52
+ /* @__PURE__ */ e("circle", { cx: t, cy: t, r: s + 2, fill: "#fff" })
53
+ ] }),
54
+ /* @__PURE__ */ e(
55
+ "div",
56
+ {
57
+ className: "center-avatar",
58
+ style: { width: s * 2, height: s * 2 },
59
+ children: f ? /* @__PURE__ */ e("img", { src: f, alt: "avatar" }) : /* @__PURE__ */ e("span", { className: "center-text", children: "菜单" })
60
+ }
61
+ )
62
+ ] });
63
+ };
224
64
  export {
225
- N as default
65
+ S as default
226
66
  };
package/lib/index.es14.js CHANGED
@@ -1,6 +1,71 @@
1
- import { createContext as r } from "react";
2
- const o = r({}), e = o.Provider;
1
+ import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
+ import { forwardRef as w, useState as C, useImperativeHandle as D } from "react";
3
+ import { Select as a, Form as l, Drawer as F, Input as r } from "antd";
4
+ const { Option: o } = a, z = w((S, g) => {
5
+ const [v, d] = C(!1), [B, x] = C({ style: {}, data: {} }), [s] = l.useForm();
6
+ return D(g, () => ({
7
+ open: (t) => {
8
+ var c, h, i, m, b, y, p, u, f, I;
9
+ d(!0), x(t), s.setFieldsValue({
10
+ name: (c = t.data) == null ? void 0 : c.name,
11
+ type: t.type || "圆形",
12
+ color: (h = t.style) == null ? void 0 : h.color,
13
+ size: parseInt((i = t.style) == null ? void 0 : i.height) || 30,
14
+ borderWidth: parseInt((m = t.style) == null ? void 0 : m.borderWidth) || 2,
15
+ borderDash: ((b = t.style) == null ? void 0 : b.borderDash) === [5, 5] ? "是" : "否",
16
+ borderColor: (y = t.style) == null ? void 0 : y.borderColor,
17
+ textValign: ((p = t.style) == null ? void 0 : p.textValign) || "center",
18
+ fontStyle: ((u = t.style) == null ? void 0 : u.fontStyle) || "normal",
19
+ fontColor: ((f = t.style) == null ? void 0 : f["font-color"]) || "#000000",
20
+ textBackgroundColor: ((I = t.style) == null ? void 0 : I.textBackgroundColor) || "transparent"
21
+ });
22
+ },
23
+ close: () => d(!1)
24
+ })), /* @__PURE__ */ e(
25
+ F,
26
+ {
27
+ title: "节点配置",
28
+ closable: { "aria-label": "Close Button" },
29
+ onClose: () => {
30
+ d(!1), s.resetFields();
31
+ },
32
+ open: v,
33
+ getContainer: !1,
34
+ width: 360,
35
+ children: /* @__PURE__ */ n(
36
+ l,
37
+ {
38
+ form: s,
39
+ layout: "vertical",
40
+ disabled: !0,
41
+ children: [
42
+ /* @__PURE__ */ e(l.Item, { label: "名称", name: "name", children: /* @__PURE__ */ e(r, {}) }),
43
+ /* @__PURE__ */ e(l.Item, { label: "类型", name: "type", children: /* @__PURE__ */ n(a, { children: [
44
+ /* @__PURE__ */ e(o, { value: "圆形", children: "圆形" }),
45
+ /* @__PURE__ */ e(o, { value: "矩形", children: "矩形" })
46
+ ] }) }),
47
+ /* @__PURE__ */ e(l.Item, { label: "颜色", name: "color", children: /* @__PURE__ */ e(r, { type: "color", style: { width: "100%", height: 32 } }) }),
48
+ /* @__PURE__ */ e(l.Item, { label: "大小", name: "size", children: /* @__PURE__ */ e(r, { type: "number" }) }),
49
+ /* @__PURE__ */ e(l.Item, { label: "边框宽度", name: "borderWidth", children: /* @__PURE__ */ e(r, { type: "number" }) }),
50
+ /* @__PURE__ */ e(l.Item, { label: "边框虚线", name: "borderDash", children: /* @__PURE__ */ n(a, { children: [
51
+ /* @__PURE__ */ e(o, { value: "否", children: "否" }),
52
+ /* @__PURE__ */ e(o, { value: "是", children: "是" })
53
+ ] }) }),
54
+ /* @__PURE__ */ e(l.Item, { label: "边框颜色", name: "borderColor", children: /* @__PURE__ */ e(r, { type: "color", style: { width: "100%", height: 32 } }) }),
55
+ /* @__PURE__ */ e(l.Item, { label: "字体位置", name: "textValign", children: /* @__PURE__ */ n(a, { children: [
56
+ /* @__PURE__ */ e(o, { value: "center", children: "居中" }),
57
+ /* @__PURE__ */ e(o, { value: "bottom", children: "底部" }),
58
+ /* @__PURE__ */ e(o, { value: "top", children: "顶部" })
59
+ ] }) }),
60
+ /* @__PURE__ */ e(l.Item, { label: "字体样式", name: "fontStyle", children: /* @__PURE__ */ e(r, {}) }),
61
+ /* @__PURE__ */ e(l.Item, { label: "字体颜色", name: "fontColor", children: /* @__PURE__ */ e(r, { type: "color", style: { width: "100%", height: 32 } }) }),
62
+ /* @__PURE__ */ e(l.Item, { label: "字体背色", name: "textBackgroundColor", children: /* @__PURE__ */ e(r, {}) })
63
+ ]
64
+ }
65
+ )
66
+ }
67
+ );
68
+ });
3
69
  export {
4
- o as GraphContext,
5
- e as GraphProvider
70
+ z as default
6
71
  };
package/lib/index.es15.js CHANGED
@@ -1,37 +1,6 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { forwardRef as g, useContext as m, useState as o, useRef as w, useEffect as C, useImperativeHandle as h } from "react";
3
- import { Drawer as x } from "antd";
4
- import { GraphContext as y } from "./index.es14.js";
5
- const F = g((I, l) => {
6
- const { graphInfo: d, knowledgeCardApi: f } = m(y), [t, a] = o(!1), [k, r] = o(!1), [D, c] = o(!1), [v, p] = o({ style: {}, data: {} }), s = w(null);
7
- C(() => {
8
- t && s.current && (s.current.scrollTop = 0);
9
- }, [t]), h(l, () => ({
10
- open: (e) => {
11
- a(!0), p(e), i(e);
12
- },
13
- close: () => a(!1)
14
- }));
15
- const i = async (e) => {
16
- r(!0);
17
- const u = await f({ kgId: d.kgId, uri: e.id });
18
- console.log(44, e), c(u.data), r(!1);
19
- };
20
- return /* @__PURE__ */ n(
21
- x,
22
- {
23
- title: "知识卡片",
24
- onClose: () => {
25
- a(!1);
26
- },
27
- open: t,
28
- getContainer: !1,
29
- className: "knowledge-card-drawer",
30
- styles: { body: { padding: "0 20px", overflow: "auto" } },
31
- children: /* @__PURE__ */ n("div", { ref: s, style: { height: "100%" } })
32
- }
33
- );
34
- });
1
+ import { createContext as r } from "react";
2
+ const o = r({}), e = o.Provider;
35
3
  export {
36
- F as default
4
+ o as GraphContext,
5
+ e as GraphProvider
37
6
  };
@@ -0,0 +1,37 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { forwardRef as g, useContext as m, useState as o, useRef as w, useEffect as C, useImperativeHandle as h } from "react";
3
+ import { Drawer as x } from "antd";
4
+ import { GraphContext as y } from "./index.es15.js";
5
+ const F = g((I, l) => {
6
+ const { graphInfo: d, knowledgeCardApi: f } = m(y), [t, a] = o(!1), [k, r] = o(!1), [D, c] = o(!1), [v, p] = o({ style: {}, data: {} }), s = w(null);
7
+ C(() => {
8
+ t && s.current && (s.current.scrollTop = 0);
9
+ }, [t]), h(l, () => ({
10
+ open: (e) => {
11
+ a(!0), p(e), i(e);
12
+ },
13
+ close: () => a(!1)
14
+ }));
15
+ const i = async (e) => {
16
+ r(!0);
17
+ const u = await f({ kgId: d.kgId, uri: e.id });
18
+ console.log(44, e), c(u.data), r(!1);
19
+ };
20
+ return /* @__PURE__ */ n(
21
+ x,
22
+ {
23
+ title: "知识卡片",
24
+ onClose: () => {
25
+ a(!1);
26
+ },
27
+ open: t,
28
+ getContainer: !1,
29
+ className: "knowledge-card-drawer",
30
+ styles: { body: { padding: "0 20px", overflow: "auto" } },
31
+ children: /* @__PURE__ */ n("div", { ref: s, style: { height: "100%" } })
32
+ }
33
+ );
34
+ });
35
+ export {
36
+ F as default
37
+ };