react-kggraph 0.0.24 → 0.0.26

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/lib/index.es44.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.es49.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
  };