@glodon-aiot/dataset-annotation 3.20.2-alpha.0 → 3.20.2

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.
@@ -9,9 +9,9 @@ var S = (o, a, c) => a in o ? re(o, a, { enumerable: !0, configurable: !0, writa
9
9
  for (var c of _(a))
10
10
  ue.call(a, c) && S(o, c, a[c]);
11
11
  return o;
12
- }, Y = (o, a) => de(o, fe(a));
12
+ }, V = (o, a) => de(o, fe(a));
13
13
  import { jsxs as j, jsx as e } from "react/jsx-runtime";
14
- import { useRef as w, useState as v, useCallback as K, useEffect as f } from "react";
14
+ import { useRef as w, useState as v, useCallback as Y, useEffect as f } from "react";
15
15
  import { Button as g, Space as he, Tooltip as p } from "antd";
16
16
  import { useKeyPress as M } from "ahooks";
17
17
  import { ZoomInOutlined as ge, ZoomOutOutlined as ve, DragOutlined as be, ExpandOutlined as xe, ClearOutlined as ye } from "@ant-design/icons";
@@ -38,26 +38,26 @@ const Be = (o) => {
38
38
  readonly: u,
39
39
  showLabelList: ie = !0,
40
40
  onLoadingChange: N
41
- } = o, P = w(null), L = w(null), [n, Z] = v(), [ne, De] = v(!1), [C, $] = v(!1), [B, F] = v(1), [k, D] = v({
41
+ } = o, K = w(null), L = w(null), [n, Z] = v(), [ne, De] = v(!1), [C, P] = v(!1), [$, B] = v(1), [k, D] = v({
42
42
  x: 0,
43
43
  y: 0
44
44
  }), [y, I] = v(() => !!u), h = w(null), X = w(k);
45
45
  X.current = k;
46
- const q = 1.15, se = 0.2, le = 10, H = w(B);
47
- H.current = B;
48
- const E = K((i, s, l) => {
49
- const r = i > 0 ? 1 / q : q, d = Math.min(le, Math.max(se, H.current * r)), O = d !== H.current;
50
- F(d), O && s != null && l != null && D((Q) => ({
46
+ const q = 1.15, se = 0.2, le = 10, F = w($);
47
+ F.current = $;
48
+ const R = Y((i, s, l) => {
49
+ const r = i > 0 ? 1 / q : q, d = Math.min(le, Math.max(se, F.current * r)), O = d !== F.current;
50
+ B(d), O && s != null && l != null && D((Q) => ({
51
51
  x: s - (s - Q.x) * r,
52
52
  y: l - (l - Q.y) * r
53
53
  }));
54
- }, []), ae = K((i) => {
54
+ }, []), ae = Y((i) => {
55
55
  if (i.preventDefault(), !L.current)
56
56
  return;
57
57
  const s = L.current.getBoundingClientRect(), l = i.clientX - s.left - s.width / 2, r = i.clientY - s.top - s.height / 2;
58
- E(i.deltaY, l, r);
59
- }, [E]), oe = K(() => {
60
- F(1), D({
58
+ R(i.deltaY, l, r);
59
+ }, [R]), oe = Y(() => {
60
+ B(1), D({
61
61
  x: 0,
62
62
  y: 0
63
63
  });
@@ -90,7 +90,7 @@ const Be = (o) => {
90
90
  i.removeEventListener("mousedown", s), window.removeEventListener("mousemove", l), window.removeEventListener("mouseup", r);
91
91
  };
92
92
  }, [y]);
93
- const R = n != null ? n : t, T = (G = R == null ? void 0 : R.labels) != null && G.length ? R.labels[0] : void 0;
93
+ const E = n != null ? n : t, H = (G = E == null ? void 0 : E.labels) != null && G.length ? E.labels[0] : void 0;
94
94
  M("rightarrow", () => {
95
95
  b == null || b();
96
96
  }), M("leftarrow", () => {
@@ -106,28 +106,28 @@ const Be = (o) => {
106
106
  }, []), f(() => {
107
107
  (t == null ? void 0 : t.id) !== (n == null ? void 0 : n.id) && Z(void 0);
108
108
  }, [t == null ? void 0 : t.id, n == null ? void 0 : n.id]), f(() => {
109
- t != null && t.fileUrl && (F(1), D({
109
+ t != null && t.fileUrl && (B(1), D({
110
110
  x: 0,
111
111
  y: 0
112
112
  }));
113
113
  }, [t == null ? void 0 : t.fileUrl]), f(() => {
114
114
  u && I(!0);
115
115
  }, [u]), f(() => {
116
- t != null && t.fileUrl && $(!0);
116
+ t != null && t.fileUrl && P(!0);
117
117
  }, [t == null ? void 0 : t.fileUrl]), f(() => {
118
118
  N == null || N(C);
119
119
  }, [C, N]), f(() => {
120
120
  var i;
121
121
  if ((i = n == null ? void 0 : n.labels) != null && i.length) {
122
122
  const s = n.labels[0].id, l = m.find((r) => r.id === s);
123
- l && (n.labels = [Y(U({}, n.labels[0]), {
123
+ l && (n.labels = [V(U({}, n.labels[0]), {
124
124
  id: l.id,
125
125
  label: l.label
126
126
  })], Z(U({}, n)));
127
127
  }
128
128
  }, [m]);
129
129
  const ce = () => {
130
- P.current && $(!1);
130
+ K.current && P(!1);
131
131
  }, A = (i) => {
132
132
  if (!t || u)
133
133
  return;
@@ -135,11 +135,11 @@ const Be = (o) => {
135
135
  id: i.id,
136
136
  label: i.label,
137
137
  box: []
138
- }] : [], l = Y(U({}, t), {
138
+ }] : [], l = V(U({}, t), {
139
139
  labels: s
140
140
  });
141
141
  Z(l), W == null || W(l);
142
- }, V = T ? m.find((i) => i.id === T.id) : void 0;
142
+ }, T = H ? m.find((i) => i.id === H.id) : void 0;
143
143
  return /* @__PURE__ */ j("div", {
144
144
  className: "classification-image-detail",
145
145
  children: [/* @__PURE__ */ e("div", {
@@ -167,14 +167,14 @@ const Be = (o) => {
167
167
  placement: "right",
168
168
  children: /* @__PURE__ */ e(g, {
169
169
  icon: /* @__PURE__ */ e(ge, {}),
170
- onClick: () => E(-100)
170
+ onClick: () => R(-100)
171
171
  })
172
172
  }), /* @__PURE__ */ e(p, {
173
173
  title: "缩小",
174
174
  placement: "right",
175
175
  children: /* @__PURE__ */ e(g, {
176
176
  icon: /* @__PURE__ */ e(ve, {}),
177
- onClick: () => E(100)
177
+ onClick: () => R(100)
178
178
  })
179
179
  }), /* @__PURE__ */ e(p, {
180
180
  title: "拖动-按住ctrl",
@@ -196,7 +196,7 @@ const Be = (o) => {
196
196
  placement: "right",
197
197
  children: /* @__PURE__ */ e(g, {
198
198
  icon: /* @__PURE__ */ e(ye, {}),
199
- disabled: !T,
199
+ disabled: !H,
200
200
  onClick: () => A(null)
201
201
  })
202
202
  })]
@@ -225,17 +225,16 @@ const Be = (o) => {
225
225
  children: /* @__PURE__ */ e("div", {
226
226
  className: "classification-image-transform",
227
227
  style: {
228
- transform: `translate(${k.x}px, ${k.y}px) scale(${B})`,
228
+ transform: `translate(${k.x}px, ${k.y}px) scale(${$})`,
229
229
  transformOrigin: "center center"
230
230
  },
231
231
  children: /* @__PURE__ */ e("img", {
232
- ref: P,
232
+ ref: K,
233
233
  src: (t == null ? void 0 : t.fileUrl) || "",
234
234
  alt: "",
235
235
  draggable: !1,
236
236
  onDragStart: (i) => i.preventDefault(),
237
237
  onLoad: ce,
238
- onError: () => $(!1),
239
238
  style: {
240
239
  maxWidth: "100%",
241
240
  maxHeight: "100%",
@@ -260,7 +259,7 @@ const Be = (o) => {
260
259
  children: /* @__PURE__ */ e(pe, {
261
260
  title: "标签列表",
262
261
  data: m,
263
- selected: V != null ? V : null,
262
+ selected: T != null ? T : null,
264
263
  onSelectedChange: A,
265
264
  showSearch: !0,
266
265
  searchPlaceholder: "请输入标签名称搜索",
@@ -9,7 +9,7 @@ var A = (n, l, o) => l in n ? _(n, l, { enumerable: !0, configurable: !0, writab
9
9
  for (var o of M(l))
10
10
  ee.call(l, o) && A(n, o, l[o]);
11
11
  return n;
12
- }, I = (n, l) => $(n, V(l));
12
+ }, u = (n, l) => $(n, V(l));
13
13
  import { jsxs as b, jsx as d } from "react/jsx-runtime";
14
14
  import { useRef as B, useState as h, useEffect as g } from "react";
15
15
  import { Button as H } from "antd";
@@ -20,7 +20,7 @@ import se from "../LabelMaker/index.mjs";
20
20
  import O from "../../../Iconfont/index.mjs";
21
21
  import te from "../../../DetectionStatus/index.mjs";
22
22
  const he = (n) => {
23
- var P, z, F;
23
+ var z, E, F;
24
24
  const {
25
25
  datasetId: l,
26
26
  isImageDetailVisible: o = !0,
@@ -38,7 +38,7 @@ const he = (n) => {
38
38
  showLabelList: D = !0,
39
39
  renderLabelItem: J,
40
40
  onLoadingChange: w
41
- } = n, Q = B(null), T = B({}), [E, W] = h({}), [y, p] = h(), [a, R] = h(), [X, Y] = h(!1), [x, u] = h(!1);
41
+ } = n, Q = B(null), T = B({}), [P, W] = h({}), [I, p] = h(), [a, y] = h(), [X, Y] = h(!1), [x, R] = h(!1);
42
42
  K("rightarrow", () => {
43
43
  v && v();
44
44
  }), K("leftarrow", () => {
@@ -47,12 +47,12 @@ const he = (n) => {
47
47
  X && N && N();
48
48
  }, []), g(() => {
49
49
  var s, t;
50
- if (p(void 0), (e == null ? void 0 : e.id) !== (a == null ? void 0 : a.id) && R(void 0), !o || !((s = e == null ? void 0 : e.labels) != null && s.length))
50
+ if (p(void 0), (e == null ? void 0 : e.id) !== (a == null ? void 0 : a.id) && y(void 0), !o || !((s = e == null ? void 0 : e.labels) != null && s.length))
51
51
  return;
52
52
  const i = (t = a || e) == null ? void 0 : t.labels.reduce((f, j) => (f[j.id] ? ++f[j.id] : f[j.id] = 1, f), {});
53
53
  W(i || {});
54
54
  }, [o, e, a]), g(() => {
55
- e != null && e.fileUrl && u(!0);
55
+ e != null && e.fileUrl && R(!0);
56
56
  }, [e == null ? void 0 : e.fileUrl]), g(() => {
57
57
  w && w(x);
58
58
  }, [x, w]), g(() => {
@@ -60,14 +60,14 @@ const he = (n) => {
60
60
  const i = [];
61
61
  a.labels.forEach((s) => {
62
62
  const t = r.find((f) => f.id === s.id);
63
- t && i.push(I(m({}, s), {
63
+ t && i.push(u(m({}, s), {
64
64
  label: t.label
65
65
  }));
66
- }), a.labels = i, R(m({}, a));
66
+ }), a.labels = i, y(m({}, a));
67
67
  }
68
68
  }, [r]);
69
69
  const Z = () => {
70
- Q.current && u(!1);
70
+ Q.current && R(!1);
71
71
  };
72
72
  return window.onresize = Z, /* @__PURE__ */ b("div", {
73
73
  className: "detection-image-detail",
@@ -93,7 +93,7 @@ const he = (n) => {
93
93
  }), /* @__PURE__ */ b("div", {
94
94
  className: "select-main",
95
95
  ref: T,
96
- children: [((P = e == null ? void 0 : e.sampleFileName) == null ? void 0 : P.name) && /* @__PURE__ */ d("div", {
96
+ children: [((z = e == null ? void 0 : e.sampleFileName) == null ? void 0 : z.name) && /* @__PURE__ */ d("div", {
97
97
  className: "img-detail-name-overlay",
98
98
  children: e.sampleFileName.name
99
99
  }), /* @__PURE__ */ d("div", {
@@ -104,26 +104,25 @@ const he = (n) => {
104
104
  }), /* @__PURE__ */ d(se, {
105
105
  disabled: G,
106
106
  imageUrl: (e == null ? void 0 : e.fileUrl) || "",
107
- pen: y,
108
- labels: ((z = a ? a.labels : e == null ? void 0 : e.labels) == null ? void 0 : z.map((i) => {
107
+ pen: I,
108
+ labels: ((E = a ? a.labels : e == null ? void 0 : e.labels) == null ? void 0 : E.map((i) => {
109
109
  var s;
110
- return I(m({}, i), {
110
+ return u(m({}, i), {
111
111
  color: ((s = r.find((t) => t.id === i.id)) == null ? void 0 : s.color) || ""
112
112
  });
113
113
  })) || [],
114
- onImageLoad: () => u(!1),
115
- onImageError: () => u(!1),
114
+ onImageLoad: () => R(!1),
116
115
  onChange: (i) => {
117
116
  if (p(void 0), !e)
118
117
  return;
119
- const s = I(m({}, e), {
118
+ const s = u(m({}, e), {
120
119
  labels: i.map((t) => ({
121
120
  id: t.id,
122
121
  label: t.label,
123
122
  box: t.box
124
123
  }))
125
124
  });
126
- R(s), k && k(s);
125
+ y(s), k && k(s);
127
126
  },
128
127
  isPreLabel: C,
129
128
  renderLabelItem: J
@@ -143,13 +142,13 @@ const he = (n) => {
143
142
  children: /* @__PURE__ */ d(ie, {
144
143
  datasetId: l,
145
144
  selectMode: "single",
146
- data: ((F = Object.keys(E)) == null ? void 0 : F.map((i) => {
145
+ data: ((F = Object.keys(P)) == null ? void 0 : F.map((i) => {
147
146
  const s = r.find((t) => t.id === i);
148
147
  if (s)
149
- return s.count = E[i], s;
148
+ return s.count = P[i], s;
150
149
  }).filter((i) => !!i)) || [],
151
150
  shortcut: !0,
152
- selected: y ? [y] : [],
151
+ selected: I ? [I] : [],
153
152
  onSelectedChange: (i) => {
154
153
  if (i.length > 2) {
155
154
  console.warn("不支持选中多个标签");