@glodon-aiot/dataset-annotation 3.16.0-alpha.37 → 3.16.0-alpha.39

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,178 +1,211 @@
1
- import { jsxs as a, jsx as s, Fragment as H } from "react/jsx-runtime";
2
- import { useRef as N, useState as n, useContext as Q, useEffect as k } from "react";
3
- import { Modal as u, Button as d, Tabs as V, Tooltip as X, Space as Y, message as R } from "antd";
1
+ import { jsx as t, jsxs as a, Fragment as k } from "react/jsx-runtime";
2
+ import { useRef as u, useState as r, useContext as oe, useEffect as R } from "react";
3
+ import { Modal as I, Button as c, Tabs as z, Tooltip as se, Space as ie, message as w } from "antd";
4
4
  import "./style.less.mjs";
5
- import v from "react-json-view";
6
- import { useKeyPress as T } from "ahooks";
7
- import Z from "../../MarkDescriptions/index.mjs";
8
- import x from "../../Iconfont/index.mjs";
9
- import _ from "../../../DatasetContext/index.mjs";
10
- import $ from "../../OCRImageViewer/index.mjs";
11
- import S from "../../ScanTable/index.mjs";
12
- const ee = v.default || v, {
13
- TabPane: I
14
- } = V, fe = (j) => {
15
- var O, M;
5
+ import T from "react-json-view";
6
+ import { useKeyPress as j } from "ahooks";
7
+ import ne from "../../MarkDescriptions/index.mjs";
8
+ import P from "../../Iconfont/index.mjs";
9
+ import le from "../../../DatasetContext/index.mjs";
10
+ import re from "../../OCRImageViewer/index.mjs";
11
+ import de from "../../ScanTable/index.mjs";
12
+ import ce from "../OCRBoxDetail/index.mjs";
13
+ const me = T.default || T, {
14
+ TabPane: V
15
+ } = z, ke = (D) => {
16
+ var x, M, O;
16
17
  const {
17
- isOcrModalVisible: c,
18
- setIsOcrModalVisible: C,
19
- record: h,
20
- onNextClick: p,
18
+ mode: m = "preview",
19
+ visible: d,
20
+ onClose: C,
21
+ record: f,
22
+ onNextClick: g,
21
23
  onPrevClick: b,
22
24
  datasetId: i,
23
- versionId: r,
24
- ocrMarkTmpl: l,
25
- handleMarkClick: w,
26
- updateSampleList: z,
27
- isPreLabel: m
28
- } = j, D = N(null), J = N({}), [f, K] = n("annotation"), [e, P] = n(), [L, E] = n(), [q, A] = n([]), [B, g] = n(!1), {
25
+ versionId: l,
26
+ ocrMarkTmpl: n,
27
+ handleMarkClick: F,
28
+ updateSampleList: J,
29
+ isPreLabel: p,
30
+ selectSampleId: K,
31
+ onSave: L,
32
+ filterMode: B,
33
+ pagination: E,
34
+ currentIndex: q,
35
+ onFilterModeChange: A,
36
+ onPaginationChange: U,
37
+ samples: W
38
+ } = D, G = u(null), H = u({}), [h, Q] = r("annotation"), [e, X] = r(), [Y, Z] = r(), [y, _] = r([]), [$, v] = r(!1), {
29
39
  services: {
30
- cvforceDatahub: t
40
+ cvforceDatahub: o
31
41
  },
32
42
  featuresConfig: {
33
- datasetManager: y
43
+ datasetManager: N
34
44
  } = {
35
45
  datasetManager: !1
36
46
  }
37
- } = Q(_);
38
- T("rightarrow", () => {
39
- p();
40
- }), T("leftarrow", () => {
47
+ } = oe(le);
48
+ j("rightarrow", () => {
49
+ g();
50
+ }), j("leftarrow", () => {
41
51
  b();
42
- }), k(() => {
43
- i && (t == null || t.listCategory(i).then((o) => A(o || [])));
44
- }, [i]), k(() => {
45
- c && i && r && (t == null || t.getDatasetsIdVersionsVidSsamplesSid(i, r, h.id).then((o) => {
46
- P(o);
52
+ }), R(() => {
53
+ i && (o == null || o.listCategory(i).then((s) => _(s || [])));
54
+ }, [i]), R(() => {
55
+ d && i && l && f && m === "preview" && (o == null || o.getDatasetsIdVersionsVidSsamplesSid(i, l, f.id).then((s) => {
56
+ X(s);
47
57
  }));
48
- }, [c, h]);
49
- const F = () => {
50
- C(!1);
51
- }, U = (o) => {
52
- K(o);
53
- }, W = (o) => {
54
- E(o);
55
- }, G = () => {
56
- u.confirm({
58
+ }, [d, f]);
59
+ const S = () => {
60
+ C();
61
+ }, ee = (s) => {
62
+ Q(s);
63
+ }, te = (s) => {
64
+ Z(s);
65
+ }, ae = () => {
66
+ I.confirm({
57
67
  title: "确认要删除此数据吗?",
58
68
  content: "删除后不可恢复,请慎重操作",
59
69
  onOk: () => {
60
- !i || !r || !(e != null && e.id) || t == null || t.delDatasetsIdVersionsVidSamplesId(i, r, e.id).then(() => {
61
- R.success("删除成功"), C(!1), z();
62
- }).catch(() => R.error("删除失败"));
70
+ !i || !l || !(e != null && e.id) || o == null || o.delDatasetsIdVersionsVidSamplesId(i, l, e.id).then(() => {
71
+ w.success("删除成功"), C(), J();
72
+ }).catch(() => w.error("删除失败"));
63
73
  }
64
74
  });
65
75
  };
66
- return /* @__PURE__ */ a(u, {
67
- title: /* @__PURE__ */ a("div", {
76
+ return /* @__PURE__ */ t(I, {
77
+ title: m === "preview" ? /* @__PURE__ */ a("div", {
68
78
  children: ["详情", /* @__PURE__ */ a("span", {
69
79
  className: "ocr-modal-label-count",
70
- children: ["标注框数量:", (O = e == null ? void 0 : e.labels) == null ? void 0 : O.length]
80
+ children: ["标注框数量:", (x = e == null ? void 0 : e.labels) == null ? void 0 : x.length]
71
81
  })]
72
- }),
82
+ }) : "标注",
73
83
  width: "100%",
74
84
  wrapClassName: "ocr-modal-wrap",
75
85
  className: "ocr-modal",
76
- open: c,
86
+ style: {
87
+ padding: 12
88
+ },
89
+ open: d,
77
90
  destroyOnClose: !0,
78
- onCancel: () => F(),
91
+ onCancel: () => S(),
79
92
  maskClosable: !1,
80
93
  centered: !0,
81
94
  footer: null,
82
- children: [/* @__PURE__ */ a("div", {
83
- className: "ocr-detail",
95
+ children: m === "preview" ? /* @__PURE__ */ a(k, {
84
96
  children: [/* @__PURE__ */ a("div", {
85
- className: "detail-content",
86
- children: [/* @__PURE__ */ s(d, {
87
- className: "select-prev",
88
- icon: /* @__PURE__ */ s(x, {
89
- type: "icon-zuojiantou"
90
- }),
91
- type: "text",
92
- onClick: () => b()
93
- }), /* @__PURE__ */ s("div", {
94
- className: "select-main",
95
- ref: J,
96
- children: /* @__PURE__ */ s($, {
97
- zoomMin: 0.1,
98
- zoomMax: 10,
99
- zoomStep: 0.1,
100
- url: (e == null ? void 0 : e.fileUrl) || "",
101
- ref: D,
102
- labels: e == null ? void 0 : e.labels
103
- })
104
- }), /* @__PURE__ */ s(d, {
105
- className: "select-next",
106
- icon: /* @__PURE__ */ s(x, {
107
- type: "icon-youjiantou"
108
- }),
109
- type: "text",
110
- onClick: () => p()
111
- })]
112
- }), l !== "DetectionOCR" && /* @__PURE__ */ a("div", {
113
- className: "detail-slide",
114
- children: [/* @__PURE__ */ s("div", {
115
- className: "slide-header",
116
- children: /* @__PURE__ */ a(V, {
117
- className: "header-tab",
118
- onChange: U,
119
- activeKey: f,
120
- children: [/* @__PURE__ */ s(I, {
121
- tab: "标注信息"
122
- }, "annotation"), /* @__PURE__ */ s(I, {
123
- tab: "JSON"
124
- }, "json")]
125
- })
126
- }), /* @__PURE__ */ a("div", {
127
- className: "slide-main",
128
- children: [f === "annotation" && /* @__PURE__ */ s(H, {
129
- children: l === "TableOCR" ? /* @__PURE__ */ s(S, {
130
- currentInfer: e == null ? void 0 : e.labels,
131
- onCellSelect: (o) => W(o),
132
- currentCell: L
133
- }) : (M = e == null ? void 0 : e.labels) != null && M.length ? /* @__PURE__ */ s(Z, {
134
- labels: e == null ? void 0 : e.labels,
135
- catagories: q
136
- }) : "暂无标注信息"
137
- }), f === "json" && /* @__PURE__ */ s(ee, {
138
- name: !1,
139
- iconStyle: "square",
140
- indentWidth: 2,
141
- displayDataTypes: !1,
142
- displayObjectSize: !1,
143
- enableClipboard: !1,
144
- src: l === "TableOCR" ? e == null ? void 0 : e.labels : (e == null ? void 0 : e.ocrJson) || {}
97
+ className: "ocr-detail",
98
+ children: [/* @__PURE__ */ a("div", {
99
+ className: "detail-content",
100
+ children: [/* @__PURE__ */ t(c, {
101
+ className: "select-prev",
102
+ icon: /* @__PURE__ */ t(P, {
103
+ type: "icon-zuojiantou"
104
+ }),
105
+ type: "text",
106
+ onClick: () => b()
107
+ }), /* @__PURE__ */ a("div", {
108
+ className: "select-main",
109
+ ref: H,
110
+ children: [((M = e == null ? void 0 : e.sampleFileName) == null ? void 0 : M.name) && /* @__PURE__ */ t("div", {
111
+ className: "img-detail-name-overlay",
112
+ children: e.sampleFileName.name
113
+ }), /* @__PURE__ */ t(re, {
114
+ zoomMin: 0.1,
115
+ zoomMax: 10,
116
+ zoomStep: 0.1,
117
+ url: (e == null ? void 0 : e.fileUrl) || "",
118
+ ref: G,
119
+ labels: e == null ? void 0 : e.labels
120
+ })]
121
+ }), /* @__PURE__ */ t(c, {
122
+ className: "select-next",
123
+ icon: /* @__PURE__ */ t(P, {
124
+ type: "icon-youjiantou"
125
+ }),
126
+ type: "text",
127
+ onClick: () => g()
145
128
  })]
146
- })]
147
- })]
148
- }), /* @__PURE__ */ s("div", {
149
- className: "ocr-mark-action",
150
- style: l === "DetectionOCR" ? {
151
- width: "100%"
152
- } : void 0,
153
- children: /* @__PURE__ */ s(X, {
154
- title: "预标注进行中,请任务完成后再试",
155
- open: B,
156
- children: /* @__PURE__ */ a(Y, {
157
- onMouseEnter: () => m && g(!0),
158
- onMouseLeave: () => g(!1),
159
- children: [/* @__PURE__ */ s(d, {
160
- type: "primary",
161
- disabled: l !== "StructKVCOCR" && l !== "DetectionOCR" || m,
162
- onClick: () => w(e == null ? void 0 : e.id),
163
- children: "标注"
164
- }), y && y.delete && /* @__PURE__ */ s(d, {
165
- danger: !0,
166
- type: "ghost",
167
- onClick: G,
168
- disabled: m,
169
- children: "删除数据"
129
+ }), n !== "DetectionOCR" && /* @__PURE__ */ a("div", {
130
+ className: "detail-slide",
131
+ children: [/* @__PURE__ */ t("div", {
132
+ className: "slide-header",
133
+ children: /* @__PURE__ */ a(z, {
134
+ className: "header-tab",
135
+ onChange: ee,
136
+ activeKey: h,
137
+ children: [/* @__PURE__ */ t(V, {
138
+ tab: "标注信息"
139
+ }, "annotation"), /* @__PURE__ */ t(V, {
140
+ tab: "JSON"
141
+ }, "json")]
142
+ })
143
+ }), /* @__PURE__ */ a("div", {
144
+ className: "slide-main",
145
+ children: [h === "annotation" && /* @__PURE__ */ t(k, {
146
+ children: n === "TableOCR" ? /* @__PURE__ */ t(de, {
147
+ currentInfer: e == null ? void 0 : e.labels,
148
+ onCellSelect: (s) => te(s),
149
+ currentCell: Y
150
+ }) : (O = e == null ? void 0 : e.labels) != null && O.length ? /* @__PURE__ */ t(ne, {
151
+ labels: e == null ? void 0 : e.labels,
152
+ catagories: y
153
+ }) : "暂无标注信息"
154
+ }), h === "json" && /* @__PURE__ */ t(me, {
155
+ name: !1,
156
+ iconStyle: "square",
157
+ indentWidth: 2,
158
+ displayDataTypes: !1,
159
+ displayObjectSize: !1,
160
+ enableClipboard: !1,
161
+ src: n === "TableOCR" ? e == null ? void 0 : e.labels : (e == null ? void 0 : e.ocrJson) || {}
162
+ })]
170
163
  })]
164
+ })]
165
+ }), /* @__PURE__ */ t("div", {
166
+ className: "ocr-mark-action",
167
+ style: n === "DetectionOCR" ? {
168
+ width: "100%"
169
+ } : void 0,
170
+ children: /* @__PURE__ */ t(se, {
171
+ title: "预标注进行中,请任务完成后再试",
172
+ open: $,
173
+ children: /* @__PURE__ */ a(ie, {
174
+ onMouseEnter: () => p && v(!0),
175
+ onMouseLeave: () => v(!1),
176
+ children: [/* @__PURE__ */ t(c, {
177
+ type: "primary",
178
+ disabled: n !== "StructKVCOCR" && n !== "DetectionOCR" || p,
179
+ onClick: () => F(e == null ? void 0 : e.id),
180
+ children: "标注"
181
+ }), N && N.delete && /* @__PURE__ */ t(c, {
182
+ danger: !0,
183
+ type: "ghost",
184
+ onClick: ae,
185
+ disabled: p,
186
+ children: "删除数据"
187
+ })]
188
+ })
171
189
  })
172
- })
173
- })]
190
+ })]
191
+ }) : /* @__PURE__ */ t(ce, {
192
+ visible: d,
193
+ selectSampleId: K,
194
+ ocrMarkTmpl: n,
195
+ datasetId: i,
196
+ versionId: l,
197
+ onClose: C,
198
+ onSave: L,
199
+ categories: y,
200
+ externalFilterMode: B,
201
+ onFilterModeChange: A,
202
+ onPaginationChange: U,
203
+ externalSamples: W,
204
+ externalPagination: E,
205
+ externalCurrentIndex: q
206
+ })
174
207
  });
175
208
  };
176
209
  export {
177
- fe as default
210
+ ke as default
178
211
  };