@glodon-aiot/dataset-annotation 3.10.0-alpha.24 → 3.10.0-alpha.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.
@@ -1,86 +1,85 @@
1
- import { jsxs as x, jsx as i } from "react/jsx-runtime";
2
- import { useRef as w, useState as k, useEffect as v } from "react";
3
- import { Input as I } from "antd";
1
+ import { jsxs as x, jsx as c } from "react/jsx-runtime";
2
+ import { useRef as w, useState as I, useEffect as v } from "react";
3
+ import { Input as T } from "antd";
4
4
  import { UpOutlined as j } from "@ant-design/icons";
5
5
  const M = ({
6
6
  name: h,
7
- labelDefinitions: l,
8
- region: T,
7
+ labelDefinitions: m,
8
+ region: $,
9
9
  isSelected: p,
10
- isActive: n,
11
- activeLabelId: c,
12
- onChange: f,
13
- onFocus: a,
10
+ isActive: s,
11
+ activeLabelId: i,
12
+ onChange: a,
13
+ onFocus: f,
14
14
  onBlur: d,
15
15
  readOnly: N
16
16
  }) => {
17
- const s = w(null), u = w(/* @__PURE__ */ new Map()), [m, g] = k(!1);
17
+ const n = w(null), u = w(/* @__PURE__ */ new Map()), [l, g] = I(!1);
18
18
  return v(() => {
19
- p && s.current && (g(!1), setTimeout(() => {
20
- s.current && s.current.scrollIntoView({
19
+ p && n.current && (g(!1), setTimeout(() => {
20
+ n.current && n.current.scrollIntoView({
21
21
  behavior: "smooth",
22
22
  block: "nearest",
23
23
  inline: "nearest"
24
24
  });
25
25
  }, 200));
26
26
  }, [p]), v(() => {
27
- n && s.current && (g(!1), setTimeout(() => {
28
- s.current && s.current.scrollIntoView({
27
+ s && n.current && (g(!1), setTimeout(() => {
28
+ n.current && n.current.scrollIntoView({
29
29
  behavior: "smooth",
30
30
  block: "nearest",
31
31
  inline: "nearest"
32
32
  });
33
33
  }, 200));
34
- }, [n]), v(() => {
35
- if (n && c) {
36
- const t = u.current.get(c);
37
- t != null && t.input ? setTimeout(() => {
38
- t.input && t.input.focus();
39
- }, 0) : setTimeout(() => {
40
- const o = u.current.get(c);
34
+ }, [s]), v(() => {
35
+ if (s && i) {
36
+ const t = u.current.get(i);
37
+ t != null && t.input ? t.input.focus() : setTimeout(() => {
38
+ const o = u.current.get(i);
41
39
  o != null && o.input && o.input.focus();
42
40
  }, 100);
43
41
  }
44
- }, [n, c]), /* @__PURE__ */ x("div", {
45
- ref: s,
46
- className: `vlm-text-region ${p || n ? "vlm-text-region-selected" : ""} ${m ? "vlm-text-region-collapsed" : ""}`,
42
+ }, [s, i]), /* @__PURE__ */ x("div", {
43
+ ref: n,
44
+ className: `vlm-text-region ${p || s ? "vlm-text-region-selected" : ""} ${l ? "vlm-text-region-collapsed" : ""}`,
47
45
  children: [/* @__PURE__ */ x("div", {
48
46
  className: "vlm-text-region-header",
49
- onClick: () => g(!m),
50
- children: [/* @__PURE__ */ i("span", {
51
- className: `vlm-text-region-collapse-icon ${m ? "vlm-text-region-collapse-icon-collapsed" : ""}`,
52
- children: /* @__PURE__ */ i(j, {})
53
- }), /* @__PURE__ */ i("span", {
47
+ onClick: () => g(!l),
48
+ children: [/* @__PURE__ */ c("span", {
49
+ className: `vlm-text-region-collapse-icon ${l ? "vlm-text-region-collapse-icon-collapsed" : ""}`,
50
+ children: /* @__PURE__ */ c(j, {})
51
+ }), /* @__PURE__ */ c("span", {
54
52
  className: "vlm-text-region-name",
55
53
  children: h
56
54
  })]
57
- }), /* @__PURE__ */ i("div", {
58
- className: `vlm-text-region-content ${m ? "vlm-text-region-content-collapsed" : ""}`,
59
- children: l == null ? void 0 : l.map((t) => {
60
- const o = n && c === t.id;
55
+ }), /* @__PURE__ */ c("div", {
56
+ className: `vlm-text-region-content ${l ? "vlm-text-region-content-collapsed" : ""}`,
57
+ children: m == null ? void 0 : m.map((t) => {
58
+ const o = s && i === t.id;
61
59
  return /* @__PURE__ */ x("div", {
62
60
  className: "vlm-text-label",
63
- children: [t.name, /* @__PURE__ */ i("br", {}), /* @__PURE__ */ i(I, {
64
- ref: (r) => {
65
- r ? u.current.set(t.id, r) : u.current.delete(t.id);
61
+ children: [t.name, /* @__PURE__ */ c("br", {}), /* @__PURE__ */ c(T, {
62
+ ref: (e) => {
63
+ e ? u.current.set(t.id, e) : u.current.delete(t.id);
66
64
  },
67
- value: T.content[t.id],
68
- onFocus: (r) => {
69
- a == null || a(t.id, r.target.value || ""), setTimeout(() => {
70
- const e = u.current.get(t.id);
71
- e != null && e.input && e.input.focus();
65
+ value: $.content[t.id],
66
+ onFocus: (e) => {
67
+ f == null || f(t.id, e.target.value || ""), setTimeout(() => {
68
+ const r = u.current.get(t.id);
69
+ r != null && r.input && r.input.focus();
72
70
  }, 0);
73
71
  },
74
- onBlur: (r) => {
75
- const e = r.relatedTarget, $ = (e == null ? void 0 : e.tagName) === "INPUT" || (e == null ? void 0 : e.closest("input")) !== null;
76
- if (o && !$) {
77
- r.target.focus();
72
+ onBlur: (e) => {
73
+ console.log("onBlur", e);
74
+ const r = e.relatedTarget, k = (r == null ? void 0 : r.tagName) === "INPUT" || (r == null ? void 0 : r.closest("input")) !== null;
75
+ if (o && !k) {
76
+ e.target.focus();
78
77
  return;
79
78
  }
80
- d == null || d(t.id, r.target.value || "");
79
+ d == null || d(t.id, e.target.value || "");
81
80
  },
82
- onChange: (r) => {
83
- f == null || f(t.id, r.target.value || "");
81
+ onChange: (e) => {
82
+ a == null || a(t.id, e.target.value || "");
84
83
  },
85
84
  allowClear: !N,
86
85
  readOnly: N
@@ -1,136 +1,143 @@
1
- var k = (f, o, l) => new Promise((c, r) => {
2
- var m = (a) => {
1
+ var N = (p, i, l) => new Promise((o, r) => {
2
+ var u = (e) => {
3
3
  try {
4
- s(l.next(a));
4
+ s(l.next(e));
5
5
  } catch (d) {
6
6
  r(d);
7
7
  }
8
- }, i = (a) => {
8
+ }, h = (e) => {
9
9
  try {
10
- s(l.throw(a));
10
+ s(l.throw(e));
11
11
  } catch (d) {
12
12
  r(d);
13
13
  }
14
- }, s = (a) => a.done ? c(a.value) : Promise.resolve(a.value).then(m, i);
15
- s((l = l.apply(f, o)).next());
14
+ }, s = (e) => e.done ? o(e.value) : Promise.resolve(e.value).then(u, h);
15
+ s((l = l.apply(p, i)).next());
16
16
  });
17
- import { jsxs as u, jsx as e } from "react/jsx-runtime";
18
- import { useRef as y, useState as h, useContext as R, useEffect as O } from "react";
19
- import { Modal as v, Button as p, Space as z, message as g } from "antd";
17
+ import { jsxs as C, jsx as t } from "react/jsx-runtime";
18
+ import { useRef as x, useState as m, useContext as D, useEffect as A } from "react";
19
+ import { Modal as M, Button as f, Space as B, message as V } from "antd";
20
20
  import "./style.less.mjs";
21
- import { useKeyPress as M } from "ahooks";
22
- import D from "../../../DatasetContext/index.mjs";
23
- import L from "../../VLMAnnotation/index.mjs";
24
- import N from "../../Iconfont/index.mjs";
25
- const G = (f) => {
21
+ import { useKeyPress as I } from "ahooks";
22
+ import E from "../../../DatasetContext/index.mjs";
23
+ import K from "../../VLMAnnotation/index.mjs";
24
+ import S from "../../Iconfont/index.mjs";
25
+ const X = (p) => {
26
26
  const {
27
- isVlmModalVisible: o,
27
+ isVlmModalVisible: i,
28
28
  setIsVlmModalVisible: l,
29
- record: c,
29
+ record: o,
30
30
  onNextClick: r,
31
- onPrevClick: m,
32
- datasetId: i,
33
- versionId: s,
34
- ocrMarkTmpl: a,
35
- handleMarkClick: d,
36
- updateSampleList: V
37
- } = f;
38
- y(null);
39
- const x = y({});
40
- h("annotation");
41
- const [t, I] = h();
42
- h();
43
- const {
31
+ onPrevClick: u,
32
+ listLoading: h = !1,
33
+ datasetId: s,
34
+ versionId: e,
35
+ ocrMarkTmpl: d,
36
+ handleMarkClick: w,
37
+ updateSampleList: L
38
+ } = p;
39
+ x(null);
40
+ const j = x({});
41
+ m("annotation");
42
+ const [a, R] = m();
43
+ m();
44
+ const [b, g] = m(!1), {
44
45
  services: {
45
46
  cvforceDatahub: n
46
47
  },
47
48
  featuresConfig: {
48
- datasetManager: C
49
+ datasetManager: k
49
50
  } = {
50
51
  datasetManager: !1
51
52
  }
52
- } = R(D);
53
- M("rightarrow", () => {
54
- r();
55
- }), M("leftarrow", () => {
56
- m();
57
- }), O(() => {
58
- o && i && s && (n == null || n.getDatasetsIdVersionsVidSsamplesSid(i, s, c.id).then((j) => {
59
- I(j);
60
- }));
61
- }, [o, c]);
62
- const w = () => {
53
+ } = D(E), c = !(b || h), v = () => {
54
+ c && u();
55
+ }, y = () => {
56
+ c && r();
57
+ };
58
+ I("rightarrow", () => {
59
+ y();
60
+ }), I("leftarrow", () => {
61
+ v();
62
+ }), A(() => {
63
+ i && s && e && (g(!0), n == null || n.getDatasetsIdVersionsVidSsamplesSid(s, e, o.id).then((z) => {
64
+ R(z);
65
+ }).finally(() => g(!1)));
66
+ }, [i, o]);
67
+ const O = () => {
63
68
  l(!1);
64
- }, S = () => {
65
- v.confirm({
69
+ }, P = () => {
70
+ M.confirm({
66
71
  title: "确认要删除此数据吗?",
67
72
  content: "删除后不可恢复,请慎重操作",
68
73
  onOk: () => {
69
- !i || !s || !(t != null && t.id) || n == null || n.delDatasetsIdVersionsVidSamplesId(i, s, t.id).then(() => {
70
- g.success("删除成功"), l(!1), V();
71
- }).catch(() => g.error("删除失败"));
74
+ !s || !e || !(a != null && a.id) || n == null || n.delDatasetsIdVersionsVidSamplesId(s, e, a.id).then(() => {
75
+ V.success("删除成功"), l(!1), L();
76
+ }).catch(() => V.error("删除失败"));
72
77
  }
73
78
  });
74
79
  };
75
- return /* @__PURE__ */ u(v, {
76
- title: /* @__PURE__ */ e("div", {
80
+ return /* @__PURE__ */ C(M, {
81
+ title: /* @__PURE__ */ t("div", {
77
82
  className: "vlm-sample-detail-title",
78
- children: /* @__PURE__ */ e("span", {
83
+ children: /* @__PURE__ */ t("span", {
79
84
  children: "详情"
80
85
  })
81
86
  }),
82
87
  width: "100%",
83
88
  wrapClassName: "vlm-modal-wrap",
84
89
  className: "vlm-modal",
85
- open: o,
90
+ open: i,
86
91
  destroyOnClose: !0,
87
- onCancel: () => w(),
92
+ onCancel: () => O(),
88
93
  maskClosable: !1,
89
94
  centered: !0,
90
95
  footer: null,
91
- children: [/* @__PURE__ */ e("div", {
96
+ children: [/* @__PURE__ */ t("div", {
92
97
  className: "vlm-detail",
93
- children: /* @__PURE__ */ u("div", {
98
+ children: /* @__PURE__ */ C("div", {
94
99
  className: "detail-content",
95
- children: [/* @__PURE__ */ e(p, {
100
+ children: [/* @__PURE__ */ t(f, {
96
101
  className: "select-prev",
97
- icon: /* @__PURE__ */ e(N, {
102
+ icon: /* @__PURE__ */ t(S, {
98
103
  type: "icon-zuojiantou"
99
104
  }),
100
105
  type: "text",
101
- onClick: () => m()
102
- }), /* @__PURE__ */ e("div", {
106
+ disabled: !c,
107
+ onClick: () => v()
108
+ }), /* @__PURE__ */ t("div", {
103
109
  className: "select-main",
104
- ref: x,
105
- children: t && /* @__PURE__ */ e(L, {
106
- sample: t,
110
+ ref: j,
111
+ children: a && /* @__PURE__ */ t(K, {
112
+ sample: a,
107
113
  labelDefinitions: [],
108
114
  hideRightSide: !0,
109
115
  readOnly: !0,
110
- ocrRecognize: () => k(void 0, null, function* () {
116
+ ocrRecognize: () => N(void 0, null, function* () {
111
117
  return [];
112
118
  })
113
119
  })
114
- }), /* @__PURE__ */ e(p, {
120
+ }), /* @__PURE__ */ t(f, {
115
121
  className: "select-next",
116
- icon: /* @__PURE__ */ e(N, {
122
+ icon: /* @__PURE__ */ t(S, {
117
123
  type: "icon-youjiantou"
118
124
  }),
119
125
  type: "text",
120
- onClick: () => r()
126
+ disabled: !c,
127
+ onClick: () => y()
121
128
  })]
122
129
  })
123
- }), /* @__PURE__ */ e("div", {
130
+ }), /* @__PURE__ */ t("div", {
124
131
  className: "vlm-mark-action",
125
- children: /* @__PURE__ */ u(z, {
126
- children: [/* @__PURE__ */ e(p, {
132
+ children: /* @__PURE__ */ C(B, {
133
+ children: [/* @__PURE__ */ t(f, {
127
134
  type: "primary",
128
- onClick: () => d(t == null ? void 0 : t.id),
135
+ onClick: () => w(a == null ? void 0 : a.id),
129
136
  children: "标注"
130
- }), C && C.delete && /* @__PURE__ */ e(p, {
137
+ }), k && k.delete && /* @__PURE__ */ t(f, {
131
138
  danger: !0,
132
139
  type: "ghost",
133
- onClick: S,
140
+ onClick: P,
134
141
  children: "删除数据"
135
142
  })]
136
143
  })
@@ -138,5 +145,5 @@ const G = (f) => {
138
145
  });
139
146
  };
140
147
  export {
141
- G as default
148
+ X as default
142
149
  };