@glodon-aiot/dataset-annotation 3.1.0-beta.16 → 3.2.1

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 (121) hide show
  1. package/dist/dataset-annotation.js +123591 -0
  2. package/dist/dataset-annotation.umd.cjs +1017 -0
  3. package/dist/example/DatasetAnnotationDemo.d.ts +3 -0
  4. package/dist/example/DemoTabs.d.ts +3 -0
  5. package/dist/example/DetectionDatasetDemo.d.ts +5 -0
  6. package/dist/example/DetectionImageDemo.d.ts +5 -0
  7. package/dist/example/OcrDatasetDemo.d.ts +5 -0
  8. package/dist/example/OcrImageDemo.d.ts +5 -0
  9. package/dist/example/OcrkvcDatasetDemo.d.ts +5 -0
  10. package/dist/example/constant.local.d.ts +6 -0
  11. package/dist/example/index.d.ts +1 -0
  12. package/dist/src/Common/Page/index.d.ts +2 -1
  13. package/dist/src/Common/PageHeader/index.d.ts +1 -0
  14. package/dist/src/DatasetContext/index.d.ts +4 -3
  15. package/dist/src/components/CompositionInput/index.d.ts +2 -2
  16. package/dist/src/components/DataEmpty/index.d.ts +2 -1
  17. package/dist/src/components/DetectionAnnotation/PreSamplesPage/index.d.ts +2 -1
  18. package/dist/src/components/DetectionAnnotation/components/DisabledTooltip/index.d.ts +2 -2
  19. package/dist/src/components/DetectionAnnotation/components/ImageDetail/index.d.ts +2 -1
  20. package/dist/src/components/DetectionAnnotation/components/LabelMaker/Drawable.d.ts +2 -2
  21. package/dist/src/components/DetectionAnnotation/components/LabelMaker/RectLabel.d.ts +2 -2
  22. package/dist/src/components/DetectionAnnotation/components/LabelMaker/index.d.ts +1 -0
  23. package/dist/src/components/DetectionAnnotation/components/Labels/index.d.ts +1 -0
  24. package/dist/src/components/DetectionAnnotation/components/TagItem/index.d.ts +2 -1
  25. package/dist/src/components/DetectionAnnotation/index.d.ts +2 -1
  26. package/dist/src/components/DetectionImageAnnotation/index.d.ts +2 -0
  27. package/dist/src/components/Iconfont/index.d.ts +1 -1
  28. package/dist/src/components/MarkDescriptions/index.d.ts +1 -0
  29. package/dist/src/components/OCRImageViewer/index.d.ts +2 -1
  30. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorInput.d.ts +2 -2
  31. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorItem.d.ts +2 -1
  32. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LableEditor.d.ts +1 -0
  33. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/index.d.ts +1 -0
  34. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/ImageDetail/index.d.ts +2 -1
  35. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/LabelEditorInput.d.ts +2 -2
  36. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/LabelEditorItem.d.ts +1 -0
  37. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/LableEditor.d.ts +1 -0
  38. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/index.d.ts +1 -0
  39. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/index.d.ts +1 -0
  40. package/dist/src/components/OcrAnnotation/OcrModal/index.d.ts +2 -1
  41. package/dist/src/components/OcrAnnotation/PreLabelOCR/PreLabelModal.d.ts +2 -1
  42. package/dist/src/components/OcrAnnotation/PreLabelOCR/index.d.ts +2 -1
  43. package/dist/src/components/OcrAnnotation/index.d.ts +2 -1
  44. package/dist/src/components/OcrImageAnnotation/index.d.ts +2 -0
  45. package/dist/src/components/PageNav/index.d.ts +2 -1
  46. package/dist/src/components/PicZipImportModal/index.d.ts +2 -1
  47. package/dist/src/components/PreLabelOCR/PreLabelModal.d.ts +2 -1
  48. package/dist/src/components/PreLabelOCR/index.d.ts +2 -1
  49. package/dist/src/components/ScanTable/index.d.ts +2 -1
  50. package/dist/src/components/Thumbnail/index.d.ts +2 -1
  51. package/dist/src/components/hooks/useBlocker.d.ts +1 -1
  52. package/dist/src/featuresConfig.d.ts +1 -1
  53. package/package.json +15 -22
  54. package/dist/es/Common/Page/index.mjs +0 -28
  55. package/dist/es/Common/PageContent/index.mjs +0 -18
  56. package/dist/es/Common/PageHeader/index.mjs +0 -38
  57. package/dist/es/DatasetContext/index.mjs +0 -11
  58. package/dist/es/_virtual/_commonjsHelpers.mjs +0 -6
  59. package/dist/es/_virtual/index.mjs +0 -4
  60. package/dist/es/access/images/data_empty.svg.mjs +0 -4
  61. package/dist/es/components/CompositionInput/index.mjs +0 -53
  62. package/dist/es/components/DataEmpty/index.mjs +0 -50
  63. package/dist/es/components/DetectionAnnotation/PreSamplesPage/index.mjs +0 -291
  64. package/dist/es/components/DetectionAnnotation/components/DisabledTooltip/index.mjs +0 -23
  65. package/dist/es/components/DetectionAnnotation/components/ImageDetail/index.mjs +0 -165
  66. package/dist/es/components/DetectionAnnotation/components/LabelMaker/Drawable.mjs +0 -51
  67. package/dist/es/components/DetectionAnnotation/components/LabelMaker/FabricCustomize.mjs +0 -42
  68. package/dist/es/components/DetectionAnnotation/components/LabelMaker/RectLabel.mjs +0 -283
  69. package/dist/es/components/DetectionAnnotation/components/LabelMaker/icons/delete-icon.svg.mjs +0 -4
  70. package/dist/es/components/DetectionAnnotation/components/LabelMaker/index.mjs +0 -314
  71. package/dist/es/components/DetectionAnnotation/components/Labels/index.mjs +0 -200
  72. package/dist/es/components/DetectionAnnotation/components/TagItem/index.mjs +0 -143
  73. package/dist/es/components/DetectionAnnotation/icon_item_empty.svg.mjs +0 -4
  74. package/dist/es/components/DetectionAnnotation/index.mjs +0 -712
  75. package/dist/es/components/DetectionImageAnnotation/index.mjs +0 -61
  76. package/dist/es/components/Iconfont/index.mjs +0 -16
  77. package/dist/es/components/MarkDescriptions/index.mjs +0 -65
  78. package/dist/es/components/OCRImageViewer/index.mjs +0 -212
  79. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/CategoryDrawer.mjs +0 -136
  80. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorInput.mjs +0 -57
  81. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorItem.mjs +0 -72
  82. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LableEditor.mjs +0 -54
  83. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/index.mjs +0 -366
  84. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/index.mjs +0 -254
  85. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/ImageDetail/index.mjs +0 -100
  86. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/images/delete.png.mjs +0 -4
  87. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/index.mjs +0 -755
  88. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/index.mjs +0 -230
  89. package/dist/es/components/OcrAnnotation/OcrModal/index.mjs +0 -179
  90. package/dist/es/components/OcrAnnotation/PreLabelOCR/PreLabelModal.mjs +0 -280
  91. package/dist/es/components/OcrAnnotation/PreLabelOCR/index.mjs +0 -43
  92. package/dist/es/components/OcrAnnotation/constant.mjs +0 -5
  93. package/dist/es/components/OcrAnnotation/index.mjs +0 -381
  94. package/dist/es/components/OcrImageAnnotation/index.mjs +0 -39
  95. package/dist/es/components/PageNav/index.mjs +0 -29
  96. package/dist/es/components/PicZipImportModal/index.mjs +0 -583
  97. package/dist/es/components/PicZipImportModal/pic_zip.svg.mjs +0 -4
  98. package/dist/es/components/PicZipImportModal/pic_zip_json.svg.mjs +0 -4
  99. package/dist/es/components/PreLabelOCR/PreLabelModal.mjs +0 -275
  100. package/dist/es/components/PreLabelOCR/index.mjs +0 -43
  101. package/dist/es/components/ScanTable/index.mjs +0 -96
  102. package/dist/es/components/Thumbnail/default.png.mjs +0 -4
  103. package/dist/es/components/Thumbnail/index.mjs +0 -30
  104. package/dist/es/components/hooks/Prompt.mjs +0 -33
  105. package/dist/es/constant.mjs +0 -13
  106. package/dist/es/createDatasetAnnotation/index.mjs +0 -133
  107. package/dist/es/createDetectionDatasetAnnotation/index.mjs +0 -129
  108. package/dist/es/createDetectionImageAnnotation/index.mjs +0 -31
  109. package/dist/es/createOcrDatasetAnnotation/index.mjs +0 -129
  110. package/dist/es/createOcrImageAnnotation/index.mjs +0 -33
  111. package/dist/es/featuresConfig.mjs +0 -79
  112. package/dist/es/index.mjs +0 -35
  113. package/dist/es/node_modules/classnames/index.mjs +0 -42
  114. package/dist/es/utils/color.mjs +0 -30
  115. package/dist/es/utils/index.mjs +0 -22
  116. package/dist/es/utils/sign.mjs +0 -33
  117. package/dist/lib/index.js +0 -7
  118. package/dist/src/components/Iconfont/font_3140028_iptomfpgyu.d.ts +0 -0
  119. package/dist/src/components/Iconfont/font_3454453_gu5ijeufyng.d.ts +0 -0
  120. package/dist/src/components/Iconfont/font_4108228_3slzqhoow93.d.ts +0 -0
  121. package/dist/src/components/Iconfont/font_4439177_k3mjwv7kzfd.d.ts +0 -0
@@ -1,230 +0,0 @@
1
- var ne = Object.defineProperty, oe = Object.defineProperties;
2
- var re = Object.getOwnPropertyDescriptors;
3
- var D = Object.getOwnPropertySymbols;
4
- var se = Object.prototype.hasOwnProperty, ie = Object.prototype.propertyIsEnumerable;
5
- var G = (f, c, r) => c in f ? ne(f, c, { enumerable: !0, configurable: !0, writable: !0, value: r }) : f[c] = r, w = (f, c) => {
6
- for (var r in c || (c = {}))
7
- se.call(c, r) && G(f, r, c[r]);
8
- if (D)
9
- for (var r of D(c))
10
- ie.call(c, r) && G(f, r, c[r]);
11
- return f;
12
- }, T = (f, c) => oe(f, re(c));
13
- import { jsx as C, jsxs as L } from "react/jsx-runtime";
14
- import { Modal as le, Space as ce, Button as P, message as b, Tabs as J } from "antd";
15
- import { useContext as ae, useRef as R, useState as h, useEffect as N } from "react";
16
- /* empty css */import de from "../../DataEmpty/index.mjs";
17
- import fe from "../../../DatasetContext/index.mjs";
18
- import ue from "./ImageDetail/index.mjs";
19
- const {
20
- TabPane: $
21
- } = J, ze = (f) => {
22
- var W;
23
- const {
24
- visible: c,
25
- selectSampleId: r,
26
- datasetId: u,
27
- versionId: x,
28
- ocrMarkTmpl: pe,
29
- onClose: Q,
30
- onSave: V
31
- } = f, {
32
- services: {
33
- cvforceDatahub: a
34
- }
35
- } = ae(fe), I = R(null);
36
- R(null), R({});
37
- const [n, d] = h(), [ge, j] = h(0), [g, z] = h([]), [M, S] = h(-1), [t, k] = h({
38
- current: 1,
39
- pageSize: 50
40
- }), [B, E] = h(0), [O, A] = h(0), [p, U] = h(() => r ? "" : "nocode");
41
- h(!1);
42
- const [X, Y] = h([]);
43
- N(() => {
44
- const e = t.current || 1, l = t.pageSize || 50;
45
- !u || !x || (a == null || a.getDatasetsIdVersionsVidSamples(u, x, {
46
- labels: p ? [p] : void 0,
47
- pageNo: e,
48
- pageSize: l
49
- }).then((s) => {
50
- const o = s.recordList || [];
51
- if (z(o), k(T(w({}, t), {
52
- current: e,
53
- pageSize: l,
54
- total: s.totalResults
55
- })), o.find((i) => i.id === r)) {
56
- if (d(r ? o.find((i) => i.id === r) : o[0]), S(0), j(o.length), t.type === "next" && o.length) {
57
- S(0);
58
- const i = s.recordList[0];
59
- d(i);
60
- }
61
- if (t.type === "prev" && o.length) {
62
- S(t.pageSize - 1);
63
- const i = s.recordList[t.pageSize - 1];
64
- d(i);
65
- }
66
- } else if (r)
67
- a.getDatasetsIdVersionsVidSsamplesSid(u, x, r).then((i) => {
68
- d(i);
69
- });
70
- else {
71
- if (d(o[0]), S(0), j(o.length), t.type === "next" && o.length) {
72
- S(0);
73
- const i = s.recordList[0];
74
- d(i);
75
- }
76
- if (t.type === "prev" && o.length) {
77
- S(t.pageSize - 1);
78
- const i = s.recordList[t.pageSize - 1];
79
- d(i);
80
- }
81
- }
82
- }), v());
83
- }, [t.current, p, u, x]);
84
- const v = () => {
85
- !u || !x || a == null || a.getDatasetsIdVersionsVidLabelcount(u, x).then((e) => {
86
- const l = e.find((o) => o.id === "allcodeid"), s = e.find((o) => o.id === "nocodeid");
87
- E(l ? l.count : 0), A(s ? s.count : 0);
88
- });
89
- }, Z = () => {
90
- u && (a == null || a.listCategory(u).then((e) => Y(e || [])));
91
- };
92
- N(() => {
93
- Z();
94
- }, [u]);
95
- const F = () => {
96
- g && z((e) => {
97
- var o, m, i, q;
98
- let l;
99
- const s = !n || (o = n.labels) != null && o.length && p === "hascode" || !((m = n.labels) != null && m.length) && p === "nocode" || p === "" ? M + 1 : M;
100
- if (n && ((i = n.labels) != null && i.length && p === "nocode" || !((q = n.labels) != null && q.length) && p === "hascode")) {
101
- const y = e.findIndex((te) => te.id === n.id);
102
- y > -1 && (e.splice(y, 1), l = [...e], t.total && (t.total = t.total - 1));
103
- }
104
- if (s >= e.length) {
105
- const y = (t.current - 1) * t.pageSize + s;
106
- t.total && y >= t.total ? b.error("已经是最后一个了") : k({
107
- current: t.current + 1,
108
- pageSize: t.pageSize,
109
- type: "next"
110
- });
111
- } else
112
- setTimeout(() => {
113
- S(s);
114
- const y = e[s];
115
- d(y);
116
- }, 200);
117
- return l || e;
118
- });
119
- }, _ = () => {
120
- var s, o;
121
- if (!g)
122
- return;
123
- let e;
124
- if (n && g && ((s = n.labels) != null && s.length && p === "nocode" || !((o = n.labels) != null && o.length) && p === "hascode")) {
125
- const m = g.findIndex((i) => i.id === n.id);
126
- m > -1 && (g.splice(m, 1), e = [...g], t.total && (t.total = t.total - 1));
127
- }
128
- const l = M - 1;
129
- if (l < 0)
130
- (t.current - 1) * t.pageSize + l < 0 ? b.error("已经是第一个了") : k({
131
- current: t.current - 1,
132
- pageSize: t.pageSize,
133
- type: "prev"
134
- });
135
- else {
136
- S(l);
137
- const m = g[l];
138
- d(m);
139
- }
140
- e && z(e);
141
- };
142
- N(() => {
143
- c && u && x && n && (a == null || a.getDatasetsIdVersionsVidSsamplesSid(u, x, n.id).then((e) => {
144
- d(e);
145
- }));
146
- }, [c, n == null ? void 0 : n.id]);
147
- const ee = () => {
148
- Q();
149
- };
150
- N(() => {
151
- I.current && (I.current.width = I.current.offsetWidth, I.current.height = I.current.offsetHeight);
152
- }, [I.current]);
153
- const H = () => {
154
- n && V(n).then((e) => {
155
- e ? (_(), v()) : b.error("保存失败");
156
- });
157
- }, K = () => {
158
- n && V(n).then((e) => {
159
- e ? (F(), v()) : b.error("保存失败");
160
- });
161
- };
162
- return /* @__PURE__ */ C(le, {
163
- title: "标注",
164
- width: "100%",
165
- wrapClassName: "ocr-modal-wrap",
166
- className: "ocr-modal",
167
- open: c,
168
- destroyOnClose: !0,
169
- onCancel: () => ee(),
170
- maskClosable: !1,
171
- keyboard: !1,
172
- centered: !0,
173
- footer: /* @__PURE__ */ L(ce, {
174
- children: [/* @__PURE__ */ L("span", {
175
- className: "ocr-modal-label-count",
176
- children: ["当前图片标注框数量:", ((W = n == null ? void 0 : n.labels) == null ? void 0 : W.length) || 0]
177
- }), /* @__PURE__ */ C(P, {
178
- disabled: !n,
179
- type: "primary",
180
- onClick: () => {
181
- n && V(n).then((e) => {
182
- e ? (b.success("保存成功"), r || F(), v()) : b.error("保存失败");
183
- });
184
- },
185
- children: "保存标注"
186
- }, "save"), !r && /* @__PURE__ */ C(P, {
187
- type: "default",
188
- onClick: H,
189
- children: "上一张"
190
- }, "prev"), !r && /* @__PURE__ */ C(P, {
191
- type: "default",
192
- onClick: K,
193
- children: "下一张"
194
- }, "next")]
195
- }),
196
- children: /* @__PURE__ */ L("div", {
197
- className: "records-content",
198
- children: [!r && /* @__PURE__ */ L(J, {
199
- className: "records-content-tabs",
200
- defaultActiveKey: p,
201
- onChange: (e) => {
202
- k(T(w({}, t), {
203
- current: 1
204
- })), U(e);
205
- },
206
- children: [/* @__PURE__ */ C($, {
207
- tab: `全部(${B})`
208
- }, ""), /* @__PURE__ */ C($, {
209
- tab: `未标注(${O})`
210
- }, "nocode"), /* @__PURE__ */ C($, {
211
- tab: `已标注(${B - O})`
212
- }, "hascode")]
213
- }), g != null && g.length ? /* @__PURE__ */ C(ue, {
214
- currentSample: n,
215
- categories: X,
216
- onChange: (e) => {
217
- d(e), z((l) => {
218
- const s = l.findIndex((o) => o.id === e.id);
219
- return l[s] = e, [...l];
220
- });
221
- },
222
- onNextClick: K,
223
- onPrevClick: H
224
- }) : /* @__PURE__ */ C(de, {})]
225
- })
226
- });
227
- };
228
- export {
229
- ze as default
230
- };
@@ -1,179 +0,0 @@
1
- import { jsxs as a, jsx as s, Fragment as G } from "react/jsx-runtime";
2
- import { useRef as N, useState as n, useContext as H, useEffect as k } from "react";
3
- import { Modal as u, Button as d, Tabs as I, Tooltip as Q, Space as X, message as v } from "antd";
4
- /* empty css */import Y from "react-json-view";
5
- import { useKeyPress as R } from "ahooks";
6
- import Z from "../../MarkDescriptions/index.mjs";
7
- import T from "../../Iconfont/index.mjs";
8
- import _ from "../../../DatasetContext/index.mjs";
9
- import $ from "../../OCRImageViewer/index.mjs";
10
- import S from "../../ScanTable/index.mjs";
11
- const {
12
- TabPane: x
13
- } = I, me = (V) => {
14
- var O, M;
15
- const {
16
- isOcrModalVisible: c,
17
- setIsOcrModalVisible: C,
18
- record: h,
19
- onNextClick: p,
20
- onPrevClick: b,
21
- datasetId: i,
22
- versionId: r,
23
- ocrMarkTmpl: l,
24
- handleMarkClick: j,
25
- updateSampleList: w,
26
- isPreLabel: m
27
- } = V, z = N(null), D = N({}), [f, K] = n("annotation"), [e, P] = n(), [J, L] = n(), [E, q] = n([]), [A, g] = n(!1), {
28
- services: {
29
- cvforceDatahub: t
30
- },
31
- featuresConfig: {
32
- datasetManager: y
33
- } = {
34
- datasetManager: !1
35
- }
36
- } = H(_);
37
- R("rightarrow", () => {
38
- p();
39
- }), R("leftarrow", () => {
40
- b();
41
- }), k(() => {
42
- i && (t == null || t.listCategory(i).then((o) => q(o || [])));
43
- }, [i]), k(() => {
44
- c && i && r && (t == null || t.getDatasetsIdVersionsVidSsamplesSid(i, r, h.id).then((o) => {
45
- P(o);
46
- }));
47
- }, [c, h]);
48
- const B = () => {
49
- C(!1);
50
- }, F = (o) => {
51
- K(o);
52
- }, U = (o) => {
53
- L(o);
54
- }, W = () => {
55
- u.confirm({
56
- title: "确认要删除此数据吗?",
57
- content: "删除后不可恢复,请慎重操作",
58
- onOk: () => {
59
- !i || !r || !(e != null && e.id) || t == null || t.delDatasetsIdVersionsVidSamplesId(i, r, e.id).then(() => {
60
- v.success("删除成功"), C(!1), w();
61
- }).catch(() => v.error("删除失败"));
62
- }
63
- });
64
- };
65
- return /* @__PURE__ */ a(u, {
66
- title: /* @__PURE__ */ a("div", {
67
- children: ["详情", /* @__PURE__ */ a("span", {
68
- className: "ocr-modal-label-count",
69
- children: ["标注框数量:", (O = e == null ? void 0 : e.labels) == null ? void 0 : O.length]
70
- })]
71
- }),
72
- width: "100%",
73
- wrapClassName: "ocr-modal-wrap",
74
- className: "ocr-modal",
75
- open: c,
76
- destroyOnClose: !0,
77
- onCancel: () => B(),
78
- maskClosable: !1,
79
- centered: !0,
80
- footer: null,
81
- children: [/* @__PURE__ */ a("div", {
82
- className: "ocr-detail",
83
- children: [/* @__PURE__ */ a("div", {
84
- className: "detail-content",
85
- children: [/* @__PURE__ */ s(d, {
86
- className: "select-prev",
87
- icon: /* @__PURE__ */ s(T, {
88
- type: "icon-zuojiantou"
89
- }),
90
- type: "text",
91
- onClick: () => b()
92
- }), /* @__PURE__ */ s("div", {
93
- className: "select-main",
94
- ref: D,
95
- children: /* @__PURE__ */ s($, {
96
- zoomMin: 0.1,
97
- zoomMax: 10,
98
- zoomStep: 0.1,
99
- url: (e == null ? void 0 : e.fileUrl) || "",
100
- ref: z,
101
- labels: e == null ? void 0 : e.labels
102
- })
103
- }), /* @__PURE__ */ s(d, {
104
- className: "select-next",
105
- icon: /* @__PURE__ */ s(T, {
106
- type: "icon-youjiantou"
107
- }),
108
- type: "text",
109
- onClick: () => p()
110
- })]
111
- }), l !== "DetectionOCR" && /* @__PURE__ */ a("div", {
112
- className: "detail-slide",
113
- children: [/* @__PURE__ */ s("div", {
114
- className: "slide-header",
115
- children: /* @__PURE__ */ a(I, {
116
- className: "header-tab",
117
- onChange: F,
118
- activeKey: f,
119
- children: [/* @__PURE__ */ s(x, {
120
- tab: "标注信息"
121
- }, "annotation"), /* @__PURE__ */ s(x, {
122
- tab: "JSON"
123
- }, "json")]
124
- })
125
- }), /* @__PURE__ */ a("div", {
126
- className: "slide-main",
127
- children: [f === "annotation" && /* @__PURE__ */ s(G, {
128
- children: l === "TableOCR" ? /* @__PURE__ */ s(S, {
129
- currentInfer: e == null ? void 0 : e.labels,
130
- onCellSelect: (o) => U(o),
131
- currentCell: J
132
- }) : (M = e == null ? void 0 : e.labels) != null && M.length ? /* @__PURE__ */ s(Z, {
133
- labels: e == null ? void 0 : e.labels,
134
- catagories: E
135
- }) : "暂无标注信息"
136
- }), f === "json" && // eslint-disable-next-line @typescript-eslint/ban-ts-comment
137
- // @ts-ignore
138
- /* @__PURE__ */ s(Y, {
139
- name: !1,
140
- iconStyle: "square",
141
- indentWidth: 2,
142
- displayDataTypes: !1,
143
- displayObjectSize: !1,
144
- enableClipboard: !1,
145
- src: l === "TableOCR" ? e == null ? void 0 : e.labels : (e == null ? void 0 : e.ocrJson) || {}
146
- })]
147
- })]
148
- })]
149
- }), /* @__PURE__ */ s("div", {
150
- className: "ocr-mark-action",
151
- style: l === "DetectionOCR" ? {
152
- width: "100%"
153
- } : void 0,
154
- children: /* @__PURE__ */ s(Q, {
155
- title: "预标注进行中,请任务完成后再试",
156
- open: A,
157
- children: /* @__PURE__ */ a(X, {
158
- onMouseEnter: () => m && g(!0),
159
- onMouseLeave: () => g(!1),
160
- children: [/* @__PURE__ */ s(d, {
161
- type: "primary",
162
- disabled: l !== "StructKVCOCR" && l !== "DetectionOCR" || m,
163
- onClick: () => j(e == null ? void 0 : e.id),
164
- children: "标注"
165
- }), y && y.delete && /* @__PURE__ */ s(d, {
166
- danger: !0,
167
- type: "ghost",
168
- onClick: W,
169
- disabled: m,
170
- children: "删除数据"
171
- })]
172
- })
173
- })
174
- })]
175
- });
176
- };
177
- export {
178
- me as default
179
- };
@@ -1,280 +0,0 @@
1
- var x = (I, c, i) => new Promise((V, y) => {
2
- var T = (d) => {
3
- try {
4
- m(i.next(d));
5
- } catch (N) {
6
- y(N);
7
- }
8
- }, t = (d) => {
9
- try {
10
- m(i.throw(d));
11
- } catch (N) {
12
- y(N);
13
- }
14
- }, m = (d) => d.done ? V(d.value) : Promise.resolve(d.value).then(T, t);
15
- m((i = i.apply(I, c)).next());
16
- });
17
- import { jsx as a, jsxs as v } from "react/jsx-runtime";
18
- import { useState as f, useContext as Y, useEffect as O } from "react";
19
- import { Form as h, Modal as Z, Button as C, Select as E, Tooltip as G, Tag as ee, InputNumber as te, Space as z, Spin as ae } from "antd";
20
- import { LoadingOutlined as ne } from "@ant-design/icons";
21
- /* empty css */import { detectionPreService as le, ocrPreService as se } from "../constant.mjs";
22
- import { PreLabelTaskStatus as p } from "@glodon-aiot/apis";
23
- import ie from "../../../DatasetContext/index.mjs";
24
- const re = [{
25
- index: 0,
26
- key: "PENDING",
27
- color: "#0F64FF",
28
- name: "待确认"
29
- }, {
30
- index: 1,
31
- key: "STARTED",
32
- color: "#0F64FF",
33
- name: "进行中"
34
- }, {
35
- index: 2,
36
- key: "SUCCESS",
37
- color: "#2DC159",
38
- name: "已完成"
39
- }], ve = (I) => {
40
- var j;
41
- const {
42
- datasetId: c,
43
- versionId: i,
44
- isVisible: V,
45
- onClose: y,
46
- setIsTaskChange: T,
47
- record: t,
48
- datasetType: m
49
- } = I, [d, N] = f([]), [A, M] = f([]), [S] = h.useForm(), [l, L] = f(), [F, q] = f(), [b, R] = f(""), k = h.useWatch("service", S), [B, _] = f(!1), {
50
- services: {
51
- cvforceDatahub: r,
52
- cvforceModelService: g
53
- },
54
- featuresConfig: {
55
- labelManager: oe
56
- } = {
57
- labelManager: !1
58
- }
59
- } = Y(ie), J = m === "detection" ? le : se, P = () => {
60
- y();
61
- };
62
- O(() => {
63
- $(), H();
64
- }, []), O(() => {
65
- t && L(t), t != null && t.lastTaskResult && q(JSON.parse(t == null ? void 0 : t.lastTaskResult));
66
- }, [t]), O(() => {
67
- var e, n, s, o, u;
68
- S.setFieldsValue({
69
- service: {
70
- value: (e = l == null ? void 0 : l.params) == null ? void 0 : e.serviceId,
71
- label: (n = l == null ? void 0 : l.params) == null ? void 0 : n.serviceName
72
- },
73
- data: (s = l == null ? void 0 : l.params) == null ? void 0 : s.data,
74
- confidence: (u = (o = l == null ? void 0 : l.params) == null ? void 0 : o.confidence) != null ? u : 0.6
75
- }), R((l == null ? void 0 : l.state) || "PENDING");
76
- }, [l]), O(() => {
77
- !k || !k.value || m !== "ocr" && Promise.all([U(), W(k.value)]).then(([e, n]) => {
78
- if (!e)
79
- return;
80
- const s = e.filter((o) => {
81
- if (!(n != null && n.find((u) => u === o)))
82
- return o;
83
- });
84
- _(!!s.length), S.validateFields(["service"]);
85
- });
86
- }, [k]);
87
- const U = () => {
88
- if (!(!c || !i))
89
- return r == null ? void 0 : r.getDatasetsIdVersionsVidLabelcount(c, i).then((e) => e.filter((s) => s.label !== "nocode").map((s) => s.label));
90
- }, W = (e) => g == null ? void 0 : g.getModelServiceById(e).then((n) => {
91
- const s = n.deployOptions.confidence;
92
- return s == null ? void 0 : s.map((u) => u.label);
93
- }), $ = () => {
94
- g == null || g.openModelServices({
95
- signName: J,
96
- state: "Running"
97
- }).then((e) => {
98
- const s = (e || []).map((o) => {
99
- var u;
100
- return {
101
- label: o.name,
102
- value: o.id,
103
- confidence: ((u = o.deployOptions.confidence) == null ? void 0 : u.map((X) => X.label)) || []
104
- };
105
- });
106
- N(s);
107
- });
108
- }, H = () => {
109
- !c || !i || r == null || r.getDatasetsIdVersionsVidSamples(c, i, {
110
- labels: "nocode",
111
- pageNo: 1,
112
- pageSize: 1
113
- }).then((e) => {
114
- const n = e.recordList || [];
115
- M([{
116
- label: "未标注",
117
- value: "nolabel",
118
- disabled: !n.length
119
- }]);
120
- });
121
- }, w = () => {
122
- !c || !i || !(l != null && l.taskId) || r == null || r.delPreLabelTask(c, i, l.taskId).then((e) => {
123
- T((n) => !n), R("PENDING");
124
- });
125
- }, K = () => {
126
- w();
127
- }, Q = () => {
128
- w(), S.resetFields(), L(void 0);
129
- }, D = (e) => {
130
- if (!c || !i || !e.service)
131
- return;
132
- const n = {
133
- serviceId: e.service.value,
134
- serviceName: e.service.label,
135
- data: "nolabel",
136
- confidence: e.confidence
137
- };
138
- r == null || r.postPreLabelTask(c, i, n).then((s) => {
139
- T((o) => !o);
140
- });
141
- };
142
- return /* @__PURE__ */ a(Z, {
143
- title: "批量预标注",
144
- wrapClassName: "batch-ocr-modal-wrap",
145
- className: "batch-ocr-modal",
146
- open: V,
147
- destroyOnClose: !0,
148
- onCancel: P,
149
- maskClosable: !1,
150
- centered: !0,
151
- footer: b === p.Pending ? [/* @__PURE__ */ a(C, {
152
- onClick: P,
153
- children: "取消"
154
- }, "cancel"), /* @__PURE__ */ a(C, {
155
- type: "primary",
156
- htmlType: "submit",
157
- form: "preLabelForm",
158
- onClick: D,
159
- children: "确定"
160
- }, "confirm")] : (t == null ? void 0 : t.state) === p.Started ? [/* @__PURE__ */ a(C, {
161
- onClick: K,
162
- children: "终止"
163
- }, "abort"), /* @__PURE__ */ a(C, {
164
- onClick: P,
165
- children: "返回"
166
- }, "cancel")] : [/* @__PURE__ */ a(C, {
167
- onClick: Q,
168
- children: "新建任务"
169
- }, "abort"), /* @__PURE__ */ a(C, {
170
- onClick: P,
171
- children: "返回"
172
- }, "cancel")],
173
- children: /* @__PURE__ */ v(h, {
174
- onFinish: D,
175
- name: "preLabelForm",
176
- labelAlign: "right",
177
- labelCol: {
178
- style: {
179
- width: 80
180
- }
181
- },
182
- form: S,
183
- children: [/* @__PURE__ */ a(h.Item, {
184
- label: "选择服务",
185
- name: "service",
186
- rules: [{
187
- required: !0
188
- }, {
189
- validator: (e, n) => x(void 0, null, function* () {
190
- const s = S.getFieldValue("service");
191
- if (!s.value || !s.label)
192
- return Promise.reject(new Error("请选择服务"));
193
- })
194
- }, {
195
- validator: (e, n) => x(void 0, null, function* () {
196
- if (B && m === "detection")
197
- return Promise.reject(new Error("所选服务与当前数据集标签不符"));
198
- })
199
- }],
200
- children: /* @__PURE__ */ a(E, {
201
- labelInValue: !0,
202
- disabled: (t == null ? void 0 : t.state) === p.Started,
203
- children: d.map((e) => /* @__PURE__ */ a(E.Option, {
204
- value: e.value,
205
- disabled: e.disabled,
206
- children: /* @__PURE__ */ a(G, {
207
- title: e.confidence.length ? e.confidence.map((n) => /* @__PURE__ */ a(ee, {
208
- children: n
209
- }, n)) : null,
210
- overlayClassName: "service-tag-tooltip",
211
- children: e.label
212
- })
213
- }, e.value))
214
- })
215
- }), m === "detection" && /* @__PURE__ */ a(h.Item, {
216
- label: "置信度",
217
- name: "confidence",
218
- initialValue: 0.6,
219
- children: /* @__PURE__ */ a(te, {
220
- max: 1,
221
- min: 0,
222
- precision: 2,
223
- step: 0.01,
224
- disabled: (t == null ? void 0 : t.state) === p.Started
225
- })
226
- }), /* @__PURE__ */ a(h.Item, {
227
- label: "选择数据",
228
- name: "data",
229
- rules: [{
230
- required: !0,
231
- message: "请选择数据"
232
- }],
233
- initialValue: "nolabel",
234
- children: /* @__PURE__ */ a(E, {
235
- disabled: (t == null ? void 0 : t.state) === p.Started,
236
- children: A.map((e) => /* @__PURE__ */ a(E.Option, {
237
- value: e.value,
238
- disabled: e.disabled,
239
- children: /* @__PURE__ */ a(G, {
240
- title: e.disabled ? "该数据集下不存在未标注的数据" : "当前数据集版本下所有未标注的数据",
241
- children: e.label
242
- })
243
- }, e.value))
244
- })
245
- }), /* @__PURE__ */ a(h.Item, {
246
- label: "标注状态",
247
- children: /* @__PURE__ */ v(z, {
248
- className: "mark-status",
249
- children: [b === p.Started ? /* @__PURE__ */ a(ae, {
250
- indicator: /* @__PURE__ */ a(ne, {
251
- style: {
252
- fontSize: 12
253
- },
254
- spin: !0
255
- })
256
- }) : /* @__PURE__ */ a("span", {
257
- className: `status-tip status-tip-${b || "PENDING"}`
258
- }), /* @__PURE__ */ a("span", {
259
- children: ((j = re.find((e) => e.key == b)) == null ? void 0 : j.name) || "待确认"
260
- }), (b === p.Started || b === p.Success) && /* @__PURE__ */ v(z, {
261
- style: {
262
- marginLeft: 14
263
- },
264
- size: 14,
265
- children: [/* @__PURE__ */ v("span", {
266
- children: [F.successCount || 0, "/", F.allCount || 0]
267
- }), /* @__PURE__ */ v("span", {
268
- children: ["已标注数据:", F.successCount || 0, " 张"]
269
- })]
270
- }), b === p.Success && /* @__PURE__ */ v("span", {
271
- children: [",失败:", F.failCount || 0, " 张"]
272
- })]
273
- })
274
- })]
275
- })
276
- });
277
- };
278
- export {
279
- ve as default
280
- };