react-kggraph 0.0.28 → 0.0.30

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 (41) hide show
  1. package/lib/index.es11.js +1 -1
  2. package/lib/index.es14.js +60 -48
  3. package/lib/index.es16.js +24 -22
  4. package/lib/index.es23.js +33 -30
  5. package/lib/index.es24.js +32 -29
  6. package/lib/index.es25.js +271 -2
  7. package/lib/index.es26.js +1 -1
  8. package/lib/index.es27.js +2 -2
  9. package/lib/index.es28.js +1 -1
  10. package/lib/index.es29.js +1 -1
  11. package/lib/index.es3.js +176 -182
  12. package/lib/index.es30.js +1 -1
  13. package/lib/index.es31.js +1 -1
  14. package/lib/index.es32.js +1 -1
  15. package/lib/index.es33.js +1 -1
  16. package/lib/index.es34.js +1 -1
  17. package/lib/index.es35.js +1 -1
  18. package/lib/index.es36.js +2 -2
  19. package/lib/index.es37.js +4 -0
  20. package/lib/index.es39.js +62 -1045
  21. package/lib/index.es4.js +7 -6
  22. package/lib/index.es40.js +21 -0
  23. package/lib/index.es41.js +43 -0
  24. package/lib/index.es42.js +42 -0
  25. package/lib/index.es43.js +88 -18
  26. package/lib/index.es44.js +54 -39
  27. package/lib/index.es45.js +30 -39
  28. package/lib/index.es47.js +66 -52
  29. package/lib/index.es7.js +176 -169
  30. package/lib/index.es8.js +108 -108
  31. package/lib/index.es9.js +9 -14
  32. package/lib/src/components/Graph/components/GraphListData/index.d.ts +3 -0
  33. package/lib/src/components/Graph/components/NodeInfoDrawer/index.d.ts +4 -1
  34. package/lib/src/components/Graph/utils/layouts.d.ts +1 -1
  35. package/lib/src/components/Graph/utils/tools.d.ts +3 -3
  36. package/lib/style.css +1 -1
  37. package/package.json +1 -1
  38. package/lib/index.es38.js +0 -66
  39. package/lib/index.es46.js +0 -91
  40. package/lib/index.es48.js +0 -33
  41. package/lib/index.es50.js +0 -72
package/lib/index.es4.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
- import { AppstoreOutlined as t, TableOutlined as e, RobotOutlined as n, LineChartOutlined as l, SelectOutlined as o, SaveOutlined as c, BorderOuterOutlined as u, LineHeightOutlined as a, ClearOutlined as s, PlusCircleOutlined as r, MinusCircleOutlined as d, PlusSquareOutlined as y, MinusSquareOutlined as O } from "@ant-design/icons";
3
- const m = [
2
+ import { AppstoreOutlined as t, TableOutlined as e, RobotOutlined as n, LineChartOutlined as l, SelectOutlined as o, SaveOutlined as c, BorderOuterOutlined as u, LineHeightOutlined as a, ClearOutlined as s, PlusCircleOutlined as d, MinusCircleOutlined as r, PlusSquareOutlined as y, MinusSquareOutlined as O, UnorderedListOutlined as k } from "@ant-design/icons";
3
+ const b = [
4
4
  { key: "queryStatistics", title: "查询统计", icon: [/* @__PURE__ */ i(t, {}, "icon")] },
5
5
  { key: "layout", title: "布局", icon: [/* @__PURE__ */ i(e, {}, "icon")] },
6
6
  { key: "graphDisplaySettings", title: "图设置", icon: [/* @__PURE__ */ i(n, {}, "icon")] },
@@ -10,14 +10,15 @@ const m = [
10
10
  { key: "hideAttributes", title: "隐藏属性", icon: [/* @__PURE__ */ i(u, {}, "icon")] },
11
11
  { key: "textPosition", title: "文字位置", icon: [/* @__PURE__ */ i(a, {}, "icon")] },
12
12
  { key: "clearCanvas", title: "清空画布", icon: [/* @__PURE__ */ i(s, {}, "icon")] },
13
- { key: "nodeZoom", title: "节点缩放", icon: [/* @__PURE__ */ i(r, {}, "plus"), /* @__PURE__ */ i(d, {}, "minus")] },
14
- { key: "canvasZoom", title: "画布缩放", icon: [/* @__PURE__ */ i(y, {}, "plus"), /* @__PURE__ */ i(O, {}, "minus")] }
13
+ { key: "nodeZoom", title: "节点缩放", icon: [/* @__PURE__ */ i(d, {}, "plus"), /* @__PURE__ */ i(r, {}, "minus")] },
14
+ { key: "canvasZoom", title: "画布缩放", icon: [/* @__PURE__ */ i(y, {}, "plus"), /* @__PURE__ */ i(O, {}, "minus")] },
15
+ { key: "tablelist", title: "查看列表", icon: [/* @__PURE__ */ i(k, {})] }
15
16
  ], S = [{ label: "实体", key: "entity" }, {
16
17
  label: "关系",
17
18
  key: "relation"
18
19
  }];
19
20
  export {
20
- m as actionList,
21
- m as default,
21
+ b as actionList,
22
+ b as default,
22
23
  S as entityRelationList
23
24
  };
@@ -0,0 +1,21 @@
1
+ import { jsx as o, jsxs as r } from "react/jsx-runtime";
2
+ import { Row as i, Col as p } from "antd";
3
+ const d = ({ properties: t, excludedKeys: l = [] }) => {
4
+ const s = t.filter(
5
+ (e) => !l.includes(e.propertyKey)
6
+ );
7
+ return /* @__PURE__ */ o(i, { className: "property-section-wraper", children: s.map((e, a) => /* @__PURE__ */ r(p, { span: 24, className: "section-item", children: [
8
+ /* @__PURE__ */ r("div", { className: "detail-label", children: [
9
+ e.propertyKey,
10
+ ":"
11
+ ] }),
12
+ /* @__PURE__ */ r("div", { className: "detail-value", children: [
13
+ " ",
14
+ e.propertyValue,
15
+ " "
16
+ ] })
17
+ ] }, a)) });
18
+ };
19
+ export {
20
+ d as default
21
+ };
@@ -0,0 +1,43 @@
1
+ import { jsx as s, jsxs as o } from "react/jsx-runtime";
2
+ import { Space as d, Button as i } from "antd";
3
+ import { downloadFile as x } from "./index.es12.js";
4
+ const w = ({ documents: l, forceSingleColumn: c = !1, source: r }) => {
5
+ const a = (e) => e.toLowerCase().endsWith(".pdf") ? /* @__PURE__ */ s("span", { className: "w-24px h-30px i-custom-pdf-doc inline-block" }) : e.toLowerCase().endsWith(".docx") || e.toLowerCase().endsWith(".doc") ? /* @__PURE__ */ s("span", { className: "w-24px h-30px i-custom-doc-doc inline-block" }) : e.toLowerCase().endsWith(".pptx") || e.toLowerCase().endsWith(".ppt") ? /* @__PURE__ */ s("span", { className: "w-24px h-30px i-custom-ppt-doc inline-block" }) : e.toLowerCase().endsWith(".txt") ? /* @__PURE__ */ s("span", { className: "w-24px h-30px i-custom-txt-doc inline-block" }) : e.toLowerCase().endsWith(".csv") ? /* @__PURE__ */ s("span", { className: "w-24px h-30px i-custom-csv-doc inline-block" }) : e.toLowerCase().endsWith(".xls") || e.toLowerCase().endsWith(".xlsx") ? /* @__PURE__ */ s("span", { className: "w-24px h-30px i-custom-xls-doc inline-block" }) : /* @__PURE__ */ s("span", { className: "w-24px h-30px i-custom-else-doc inline-block" }), p = (e) => {
6
+ const n = e.split("/");
7
+ return n[n.length - 1];
8
+ };
9
+ return /* @__PURE__ */ s("div", { className: r === "qa-card" ? "grid grid-cols-1" : `grid ${c ? "grid-cols-1 gap-y-5" : "grid-cols-1 md:grid-cols-2 gap-x-100px gap-y-10px"}`, children: l.map((e, n) => {
10
+ const t = p(e.propertyValue);
11
+ return /* @__PURE__ */ o("div", { className: "flex items-center justify-between transition-all", children: [
12
+ /* @__PURE__ */ o("div", { className: "flex items-center min-w-0 flex-1", children: [
13
+ /* @__PURE__ */ s("div", { className: "mr-3 text-xl flex-shrink-0", children: a(t) }),
14
+ /* @__PURE__ */ s("div", { className: "min-w-0", children: /* @__PURE__ */ s("div", { className: "truncate", title: decodeURIComponent(t), children: decodeURIComponent(t) }) })
15
+ ] }),
16
+ /* @__PURE__ */ o(d, { className: "flex-shrink-0", children: [
17
+ /* @__PURE__ */ s(
18
+ i,
19
+ {
20
+ className: "px-0px",
21
+ type: "link",
22
+ onClick: () => window.open(e.propertyValue, "_blank"),
23
+ children: "查看"
24
+ }
25
+ ),
26
+ /* @__PURE__ */ s(
27
+ i,
28
+ {
29
+ type: "link",
30
+ className: "px-0px",
31
+ onClick: () => {
32
+ x(e.propertyValue, t);
33
+ },
34
+ children: "下载"
35
+ }
36
+ )
37
+ ] })
38
+ ] }, n);
39
+ }) });
40
+ };
41
+ export {
42
+ w as default
43
+ };
@@ -0,0 +1,42 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { useRef as s } from "react";
3
+ import { Image as t } from "antd";
4
+ const m = ({ images: o, forceSingleColumn: i = !1, source: d = "" }) => (s(0), /* @__PURE__ */ e("div", { className: d === "qa-card" ? "grid grid-cols-1" : `grid ${i ? "grid-cols-1 gap-y-3" : "grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-20px"}`, children: /* @__PURE__ */ e(
5
+ t.PreviewGroup,
6
+ {
7
+ preview: {
8
+ // onVisibleChange: (visible) => {
9
+ // if (visible) {
10
+ // handlePreviewOpen();
11
+ // } else {
12
+ // handlePreviewClose();
13
+ // }
14
+ // },
15
+ mask: !0,
16
+ zIndex: 9999,
17
+ getContainer: () => document.getElementById("root") || document.body
18
+ },
19
+ children: o.map((r, a) => /* @__PURE__ */ e("div", { className: "group rounded-lg overflow-hidden transition-shadow", children: /* @__PURE__ */ e("div", { className: "h-185px relative overflow-hidden", children: /* @__PURE__ */ e(
20
+ t,
21
+ {
22
+ src: r.propertyValue,
23
+ alt: r.propertyKey,
24
+ style: {
25
+ width: "100%",
26
+ height: "185px",
27
+ objectFit: "cover"
28
+ // cover 保证图片充满容器,可能会裁剪
29
+ // 或者使用 'contain' 保证图片完整显示,可能会有留白
30
+ // objectFit: 'contain',
31
+ },
32
+ className: "transition-transform duration-300 group-hover:scale-105 rounded-6px",
33
+ preview: {
34
+ cover: /* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "text-white text-14px", children: "点击查看" }) })
35
+ }
36
+ }
37
+ ) }) }, a))
38
+ }
39
+ ) }));
40
+ export {
41
+ m as default
42
+ };
package/lib/index.es43.js CHANGED
@@ -1,21 +1,91 @@
1
- import { jsx as o, jsxs as r } from "react/jsx-runtime";
2
- import { Row as i, Col as p } from "antd";
3
- const d = ({ properties: t, excludedKeys: l = [] }) => {
4
- const s = t.filter(
5
- (e) => !l.includes(e.propertyKey)
6
- );
7
- return /* @__PURE__ */ o(i, { className: "property-section-wraper", children: s.map((e, a) => /* @__PURE__ */ r(p, { span: 24, className: "section-item", children: [
8
- /* @__PURE__ */ r("div", { className: "detail-label", children: [
9
- e.propertyKey,
10
- ":"
11
- ] }),
12
- /* @__PURE__ */ r("div", { className: "detail-value", children: [
13
- " ",
14
- e.propertyValue,
15
- " "
16
- ] })
17
- ] }, a)) });
1
+ import { jsxs as m, Fragment as x, jsx as a } from "react/jsx-runtime";
2
+ import { useState as u, useRef as p, useEffect as f } from "react";
3
+ import { Modal as C } from "antd";
4
+ const R = ({ videos: c, forceSingleColumn: V = !1, source: j = "" }) => {
5
+ const [n, l] = u(null), [i, h] = u({}), v = p({}), s = p(null), g = () => {
6
+ s.current && (s.current.pause(), s.current.currentTime = 0), l(null);
7
+ };
8
+ f(() => {
9
+ n && s.current && s.current.play().catch(() => {
10
+ });
11
+ }, [n]);
12
+ const y = (t, r) => {
13
+ if (i[r]) return;
14
+ const e = document.createElement("video");
15
+ e.src = t, e.crossOrigin = "anonymous", e.muted = !0, e.preload = "metadata", e.onloadeddata = () => {
16
+ e.currentTime = 0.1;
17
+ }, e.onseeked = () => {
18
+ const o = document.createElement("canvas");
19
+ o.width = e.videoWidth, o.height = e.videoHeight;
20
+ const d = o.getContext("2d");
21
+ if (d) {
22
+ d.drawImage(e, 0, 0, o.width, o.height);
23
+ const w = o.toDataURL("image/jpeg", 0.8);
24
+ h((N) => ({ ...N, [r]: w }));
25
+ }
26
+ e.src = "";
27
+ }, e.onerror = () => {
28
+ e.src = "";
29
+ };
30
+ };
31
+ return f(() => {
32
+ c.forEach((t, r) => {
33
+ y(t.propertyValue, r);
34
+ });
35
+ }, [c]), /* @__PURE__ */ m(x, { children: [
36
+ /* @__PURE__ */ a("div", { className: "video-wraper", children: c.map((t, r) => {
37
+ t.propertyValue.split("/").pop();
38
+ const e = i[r];
39
+ return /* @__PURE__ */ a("div", { className: "rounded-lg overflow-hidden transition-shadow", children: /* @__PURE__ */ m("div", { className: "video-item", children: [
40
+ /* @__PURE__ */ a(
41
+ "video",
42
+ {
43
+ ref: (o) => {
44
+ v.current[r] = o;
45
+ },
46
+ src: t.propertyValue,
47
+ poster: e,
48
+ className: "video-item-video",
49
+ muted: !0,
50
+ playsInline: !0,
51
+ preload: "metadata",
52
+ onClick: () => l(t.propertyValue)
53
+ }
54
+ ),
55
+ !n && /* @__PURE__ */ a("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ a(
56
+ "div",
57
+ {
58
+ className: "w-8 h-8 rounded-full flex items-center justify-center cursor-pointer hover:scale-110 transition-transform",
59
+ onClick: () => l(t.propertyValue),
60
+ children: /* @__PURE__ */ a("span", { className: "w-24px h-24px i-custom-video-play inline-block" })
61
+ }
62
+ ) })
63
+ ] }) }, r);
64
+ }) }),
65
+ /* @__PURE__ */ a(
66
+ C,
67
+ {
68
+ open: !!n,
69
+ footer: null,
70
+ onCancel: g,
71
+ width: "auto",
72
+ centered: !0,
73
+ className: "video-modal",
74
+ wrapClassName: "modal-wrapClassName",
75
+ getContainer: () => document.getElementById("root"),
76
+ children: n && /* @__PURE__ */ a(
77
+ "video",
78
+ {
79
+ ref: s,
80
+ src: n,
81
+ controls: !0,
82
+ className: "max-w-[80vw] max-h-[80vh] mt-10px"
83
+ }
84
+ )
85
+ }
86
+ )
87
+ ] });
18
88
  };
19
89
  export {
20
- d as default
90
+ R as default
21
91
  };
package/lib/index.es44.js CHANGED
@@ -1,43 +1,58 @@
1
- import { jsx as s, jsxs as o } from "react/jsx-runtime";
2
- import { Space as d, Button as i } from "antd";
3
- import { downloadFile as x } from "./index.es12.js";
4
- const w = ({ documents: l, forceSingleColumn: c = !1, source: r }) => {
5
- const a = (e) => e.toLowerCase().endsWith(".pdf") ? /* @__PURE__ */ s("span", { className: "w-24px h-30px i-custom-pdf-doc inline-block" }) : e.toLowerCase().endsWith(".docx") || e.toLowerCase().endsWith(".doc") ? /* @__PURE__ */ s("span", { className: "w-24px h-30px i-custom-doc-doc inline-block" }) : e.toLowerCase().endsWith(".pptx") || e.toLowerCase().endsWith(".ppt") ? /* @__PURE__ */ s("span", { className: "w-24px h-30px i-custom-ppt-doc inline-block" }) : e.toLowerCase().endsWith(".txt") ? /* @__PURE__ */ s("span", { className: "w-24px h-30px i-custom-txt-doc inline-block" }) : e.toLowerCase().endsWith(".csv") ? /* @__PURE__ */ s("span", { className: "w-24px h-30px i-custom-csv-doc inline-block" }) : e.toLowerCase().endsWith(".xls") || e.toLowerCase().endsWith(".xlsx") ? /* @__PURE__ */ s("span", { className: "w-24px h-30px i-custom-xls-doc inline-block" }) : /* @__PURE__ */ s("span", { className: "w-24px h-30px i-custom-else-doc inline-block" }), p = (e) => {
6
- const n = e.split("/");
7
- return n[n.length - 1];
1
+ import { jsx as l, jsxs as o } from "react/jsx-runtime";
2
+ import { useState as g, useRef as y } from "react";
3
+ import { Row as d, Flex as h, Button as p } from "antd";
4
+ const j = ({ audios: m, forceSingleColumn: u = !1, source: f = "" }) => {
5
+ const [s, a] = g(null), n = y({}), x = (e) => {
6
+ var t, i;
7
+ if (s === e)
8
+ (t = n.current[e]) == null || t.pause(), a(null);
9
+ else {
10
+ if (s && ((i = n.current[s]) == null || i.pause()), a(e), !n.current[e]) {
11
+ const c = new Audio(e);
12
+ n.current[e] = c;
13
+ }
14
+ n.current[e].play(), n.current[e].onended = () => a(null);
15
+ }
8
16
  };
9
- return /* @__PURE__ */ s("div", { className: r === "qa-card" ? "grid grid-cols-1" : `grid ${c ? "grid-cols-1 gap-y-5" : "grid-cols-1 md:grid-cols-2 gap-x-100px gap-y-10px"}`, children: l.map((e, n) => {
10
- const t = p(e.propertyValue);
11
- return /* @__PURE__ */ o("div", { className: "flex items-center justify-between transition-all", children: [
12
- /* @__PURE__ */ o("div", { className: "flex items-center min-w-0 flex-1", children: [
13
- /* @__PURE__ */ s("div", { className: "mr-3 text-xl flex-shrink-0", children: a(t) }),
14
- /* @__PURE__ */ s("div", { className: "min-w-0", children: /* @__PURE__ */ s("div", { className: "truncate", title: decodeURIComponent(t), children: decodeURIComponent(t) }) })
15
- ] }),
16
- /* @__PURE__ */ o(d, { className: "flex-shrink-0", children: [
17
- /* @__PURE__ */ s(
18
- i,
19
- {
20
- className: "px-0px",
21
- type: "link",
22
- onClick: () => window.open(e.propertyValue, "_blank"),
23
- children: "查看"
24
- }
25
- ),
26
- /* @__PURE__ */ s(
27
- i,
28
- {
29
- type: "link",
30
- className: "px-0px",
31
- onClick: () => {
32
- x(e.propertyValue, t);
33
- },
34
- children: "下载"
35
- }
36
- )
37
- ] })
38
- ] }, n);
39
- }) });
17
+ return /* @__PURE__ */ l(
18
+ "div",
19
+ {
20
+ className: f === "qa-card" ? "grid grid-cols-1" : `grid ${u ? "grid-cols-1 gap-y-3" : "grid-cols-2 gap-x-100px gap-y-20px"}`,
21
+ children: m.map((e, t) => {
22
+ const i = e.propertyValue.split("/").pop() || "未命名音频", c = s === e.propertyValue;
23
+ return /* @__PURE__ */ o(d, { className: "flex items-center justify-between transition-all", justify: "space-between", align: "middle", children: [
24
+ /* @__PURE__ */ o(d, { className: "flex items-center min-w-0 flex-1", align: "middle", children: [
25
+ /* @__PURE__ */ l("div", { className: "mr-3 text-xl flex-shrink-0", children: /* @__PURE__ */ l("span", { className: "w-24px h-30px i-custom-audio inline-block" }) }),
26
+ /* @__PURE__ */ l("div", { className: "min-w-0", children: /* @__PURE__ */ l("div", { className: "truncate", title: i, children: i }) })
27
+ ] }),
28
+ /* @__PURE__ */ o(h, { className: "flex-shrink-0 ml-3", children: [
29
+ /* @__PURE__ */ l(
30
+ p,
31
+ {
32
+ className: "px-0",
33
+ type: "link",
34
+ onClick: () => x(e.propertyValue),
35
+ children: c ? "暂停" : "播放"
36
+ }
37
+ ),
38
+ /* @__PURE__ */ l(
39
+ p,
40
+ {
41
+ className: "px-0",
42
+ type: "link",
43
+ onClick: () => {
44
+ const r = document.createElement("a");
45
+ r.href = e.propertyValue, r.download = i, r.click();
46
+ },
47
+ children: "下载"
48
+ }
49
+ )
50
+ ] })
51
+ ] }, t);
52
+ })
53
+ }
54
+ );
40
55
  };
41
56
  export {
42
- w as default
57
+ j as default
43
58
  };
package/lib/index.es45.js CHANGED
@@ -1,42 +1,33 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { useRef as s } from "react";
3
- import { Image as t } from "antd";
4
- const m = ({ images: o, forceSingleColumn: i = !1, source: d = "" }) => (s(0), /* @__PURE__ */ e("div", { className: d === "qa-card" ? "grid grid-cols-1" : `grid ${i ? "grid-cols-1 gap-y-3" : "grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-20px"}`, children: /* @__PURE__ */ e(
5
- t.PreviewGroup,
6
- {
7
- preview: {
8
- // onVisibleChange: (visible) => {
9
- // if (visible) {
10
- // handlePreviewOpen();
11
- // } else {
12
- // handlePreviewClose();
13
- // }
14
- // },
15
- mask: !0,
16
- zIndex: 9999,
17
- getContainer: () => document.getElementById("root") || document.body
18
- },
19
- children: o.map((r, a) => /* @__PURE__ */ e("div", { className: "group rounded-lg overflow-hidden transition-shadow", children: /* @__PURE__ */ e("div", { className: "h-185px relative overflow-hidden", children: /* @__PURE__ */ e(
20
- t,
21
- {
22
- src: r.propertyValue,
23
- alt: r.propertyKey,
24
- style: {
25
- width: "100%",
26
- height: "185px",
27
- objectFit: "cover"
28
- // cover 保证图片充满容器,可能会裁剪
29
- // 或者使用 'contain' 保证图片完整显示,可能会有留白
30
- // objectFit: 'contain',
31
- },
32
- className: "transition-transform duration-300 group-hover:scale-105 rounded-6px",
33
- preview: {
34
- cover: /* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "text-white text-14px", children: "点击查看" }) })
35
- }
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { useState as m, useEffect as w } from "react";
3
+ import h from "./index.es47.js";
4
+ const k = ({ relations: t, kgIds: s, viewMode: a = "list", source: c = "" }) => {
5
+ const [d, l] = m(t);
6
+ w(() => {
7
+ t && t && l(p(t || []));
8
+ }, [t]);
9
+ const p = (e) => e.map((o) => {
10
+ var r;
11
+ const n = (r = o.content) == null ? void 0 : r.filter((f) => f.propertyKey !== "id");
12
+ return {
13
+ ...o,
14
+ showContent: n.slice(0, 8)
15
+ };
16
+ });
17
+ return /* @__PURE__ */ i("div", { className: "relation-section-wraper", children: d.map((e, u) => /* @__PURE__ */ i(
18
+ h,
19
+ {
20
+ entity: e,
21
+ viewMode: a,
22
+ className: "shadow-none",
23
+ source: c,
24
+ onViewDetails: (o) => {
25
+ const n = encodeURIComponent(e.uri);
26
+ window.open(`#/ai-search/fulltext-detail?uri=${n}&kgId=${s}&keyword=${o.showValue}`, "_blank");
36
27
  }
37
- ) }) }, a))
38
- }
39
- ) }));
28
+ }
29
+ )) });
30
+ };
40
31
  export {
41
- m as default
32
+ k as default
42
33
  };
package/lib/index.es47.js CHANGED
@@ -1,58 +1,72 @@
1
- import { jsx as l, jsxs as o } from "react/jsx-runtime";
2
- import { useState as g, useRef as y } from "react";
3
- import { Row as d, Flex as h, Button as p } from "antd";
4
- const j = ({ audios: m, forceSingleColumn: u = !1, source: f = "" }) => {
5
- const [s, a] = g(null), n = y({}), x = (e) => {
6
- var t, i;
7
- if (s === e)
8
- (t = n.current[e]) == null || t.pause(), a(null);
9
- else {
10
- if (s && ((i = n.current[s]) == null || i.pause()), a(e), !n.current[e]) {
11
- const c = new Audio(e);
12
- n.current[e] = c;
13
- }
14
- n.current[e].play(), n.current[e].onended = () => a(null);
15
- }
1
+ import { jsx as t, jsxs as o } from "react/jsx-runtime";
2
+ import w from "react";
3
+ import { Card as f, Row as n, Button as x, Col as g, Tooltip as C } from "antd";
4
+ const E = ({
5
+ entity: l,
6
+ viewMode: N,
7
+ keyword: d = "",
8
+ className: v = "",
9
+ contentClass: b = "",
10
+ onViewDetails: p,
11
+ source: k = ""
12
+ }) => {
13
+ const h = (e, a) => {
14
+ if (!a || !e) return e;
15
+ const i = new RegExp(`(${a.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})`, "gi");
16
+ return e.split(i).map(
17
+ (r, c) => i.test(r) ? /* @__PURE__ */ t("span", { style: { color: "#E1211C", fontWeight: "bold" }, children: r }, c) : r
18
+ );
19
+ }, m = w.useMemo(() => {
20
+ if (!l.showContent) return [];
21
+ const e = (s) => (s == null ? void 0 : s.includes("简介")) || s.startsWith("http://") || s.startsWith("https://"), a = l.showContent.filter((s) => e(s.propertyKey));
22
+ return [...l.showContent.filter((s) => !e(s.propertyKey)), ...a];
23
+ }, [l.showContent]), u = (e, a) => {
24
+ var c;
25
+ const i = ((c = e.propertyValue) == null ? void 0 : c.length) > 20, s = h(e.propertyValue, d), r = /* @__PURE__ */ t(g, { span: 24, className: "detail-item-list", children: /* @__PURE__ */ o(n, { children: [
26
+ /* @__PURE__ */ o("span", { className: "detail-label text-#676A6C flex-shrink-0 whitespace-nowrap font-size-14px max-w-[80%] overflow-hidden text-ellipsis whitespace-nowrap", children: [
27
+ e.propertyKey,
28
+ ":"
29
+ ] }),
30
+ /* @__PURE__ */ t("span", { className: "detail-value text-#676A6C truncate block overflow-hidden text-ellipsis whitespace-nowrap flex-1 min-w-0 font-size-14px", children: s })
31
+ ] }) }, a);
32
+ return i ? /* @__PURE__ */ t(
33
+ C,
34
+ {
35
+ title: e.propertyValue,
36
+ placement: "topLeft",
37
+ mouseEnterDelay: 0.3,
38
+ overlayClassName: "max-w-[500px] break-words",
39
+ children: r
40
+ },
41
+ a
42
+ ) : r;
16
43
  };
17
- return /* @__PURE__ */ l(
18
- "div",
44
+ return /* @__PURE__ */ t("div", { className: "relative group", children: /* @__PURE__ */ t(
45
+ f,
19
46
  {
20
- className: f === "qa-card" ? "grid grid-cols-1" : `grid ${u ? "grid-cols-1 gap-y-3" : "grid-cols-2 gap-x-100px gap-y-20px"}`,
21
- children: m.map((e, t) => {
22
- const i = e.propertyValue.split("/").pop() || "未命名音频", c = s === e.propertyValue;
23
- return /* @__PURE__ */ o(d, { className: "flex items-center justify-between transition-all", justify: "space-between", align: "middle", children: [
24
- /* @__PURE__ */ o(d, { className: "flex items-center min-w-0 flex-1", align: "middle", children: [
25
- /* @__PURE__ */ l("div", { className: "mr-3 text-xl flex-shrink-0", children: /* @__PURE__ */ l("span", { className: "w-24px h-30px i-custom-audio inline-block" }) }),
26
- /* @__PURE__ */ l("div", { className: "min-w-0", children: /* @__PURE__ */ l("div", { className: "truncate", title: i, children: i }) })
27
- ] }),
28
- /* @__PURE__ */ o(h, { className: "flex-shrink-0 ml-3", children: [
29
- /* @__PURE__ */ l(
30
- p,
31
- {
32
- className: "px-0",
33
- type: "link",
34
- onClick: () => x(e.propertyValue),
35
- children: c ? "暂停" : "播放"
36
- }
37
- ),
38
- /* @__PURE__ */ l(
39
- p,
40
- {
41
- className: "px-0",
42
- type: "link",
43
- onClick: () => {
44
- const r = document.createElement("a");
45
- r.href = e.propertyValue, r.download = i, r.click();
46
- },
47
- children: "下载"
48
- }
49
- )
50
- ] })
51
- ] }, t);
52
- })
47
+ className: "section-card",
48
+ bodyStyle: { padding: "20px 20px 4px 20px" },
49
+ onClick: () => p(l),
50
+ children: /* @__PURE__ */ o("div", { className: "flex flex-col h-full", children: [
51
+ /* @__PURE__ */ o(n, { className: "section-title", justify: "space-between", align: "middle", children: [
52
+ /* @__PURE__ */ t("div", { className: "entity-name-list", children: h(l.showValue, d) }),
53
+ /* @__PURE__ */ t(
54
+ x,
55
+ {
56
+ className: "view-details-btn",
57
+ children: "查看详情"
58
+ }
59
+ )
60
+ ] }),
61
+ /* @__PURE__ */ o(n, { className: "flex mb-18px", children: [
62
+ l.showType && /* @__PURE__ */ t(n, { className: "detail-item-tag", justify: "center", align: "middle", children: l.showType }),
63
+ l.kg && /* @__PURE__ */ t("div", { className: "detail-item-tag1", children: l.kg })
64
+ ] }),
65
+ /* @__PURE__ */ t(n, { wrap: !0, children: m.map((e, a) => u(e, a)) })
66
+ ] })
53
67
  }
54
- );
68
+ ) });
55
69
  };
56
70
  export {
57
- j as default
71
+ E as default
58
72
  };