@glodon-aiot/dataset-annotation 3.2.2-beta.2 → 3.2.2-beta.4

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 (138) hide show
  1. package/dist/es/Common/Page/index.mjs +29 -0
  2. package/dist/es/Common/Page/style.less.mjs +4 -0
  3. package/dist/es/Common/PageContent/index.mjs +18 -0
  4. package/dist/es/Common/PageHeader/index.mjs +39 -0
  5. package/dist/es/Common/PageHeader/style.less.mjs +4 -0
  6. package/dist/es/DatasetContext/index.mjs +11 -0
  7. package/dist/es/_virtual/_commonjsHelpers.mjs +4 -0
  8. package/dist/es/_virtual/minio.mjs +4 -0
  9. package/dist/es/access/images/data_empty.svg.mjs +4 -0
  10. package/dist/es/components/CompositionInput/index.mjs +53 -0
  11. package/dist/es/components/DataEmpty/index.mjs +51 -0
  12. package/dist/es/components/DataEmpty/style.less.mjs +4 -0
  13. package/dist/es/components/DetectionAnnotation/PreSamplesPage/index.mjs +292 -0
  14. package/dist/es/components/DetectionAnnotation/PreSamplesPage/style.less.mjs +4 -0
  15. package/dist/es/components/DetectionAnnotation/components/DisabledTooltip/index.mjs +23 -0
  16. package/dist/es/components/DetectionAnnotation/components/ImageDetail/index.mjs +166 -0
  17. package/dist/es/components/DetectionAnnotation/components/ImageDetail/style.less.mjs +4 -0
  18. package/dist/es/components/DetectionAnnotation/components/LabelMaker/Drawable.mjs +51 -0
  19. package/dist/es/components/DetectionAnnotation/components/LabelMaker/FabricCustomize.mjs +42 -0
  20. package/dist/es/components/DetectionAnnotation/components/LabelMaker/RectLabel.mjs +283 -0
  21. package/dist/es/components/DetectionAnnotation/components/LabelMaker/icons/delete-icon.svg.mjs +4 -0
  22. package/dist/es/components/DetectionAnnotation/components/LabelMaker/index.mjs +315 -0
  23. package/dist/es/components/DetectionAnnotation/components/LabelMaker/style.less.mjs +4 -0
  24. package/dist/es/components/DetectionAnnotation/components/Labels/index.mjs +201 -0
  25. package/dist/es/components/DetectionAnnotation/components/Labels/style.less.mjs +4 -0
  26. package/dist/es/components/DetectionAnnotation/components/TagItem/index.mjs +144 -0
  27. package/dist/es/components/DetectionAnnotation/components/TagItem/style.less.mjs +4 -0
  28. package/dist/es/components/DetectionAnnotation/icon_item_empty.svg.mjs +4 -0
  29. package/dist/es/components/DetectionAnnotation/index.mjs +713 -0
  30. package/dist/es/components/DetectionAnnotation/style.less.mjs +4 -0
  31. package/dist/es/components/DetectionImageAnnotation/index.mjs +62 -0
  32. package/dist/es/components/DetectionImageAnnotation/style.less.mjs +4 -0
  33. package/dist/es/components/Iconfont/index.mjs +16 -0
  34. package/dist/es/components/MarkDescriptions/index.mjs +66 -0
  35. package/dist/es/components/MarkDescriptions/style.less.mjs +4 -0
  36. package/dist/es/components/OCRImageViewer/index.mjs +213 -0
  37. package/dist/es/components/OCRImageViewer/style.less.mjs +4 -0
  38. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/CategoryDrawer.mjs +136 -0
  39. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorInput.mjs +57 -0
  40. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorItem.mjs +73 -0
  41. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LableEditor.mjs +55 -0
  42. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/index.mjs +366 -0
  43. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/style.less.mjs +4 -0
  44. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/index.mjs +255 -0
  45. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/style.less.mjs +4 -0
  46. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/ImageDetail/index.mjs +101 -0
  47. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/ImageDetail/style.less.mjs +4 -0
  48. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/images/delete.png.mjs +4 -0
  49. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/index.mjs +756 -0
  50. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/style.less.mjs +4 -0
  51. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/index.mjs +231 -0
  52. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/style.less.mjs +4 -0
  53. package/dist/es/components/OcrAnnotation/OcrModal/index.mjs +180 -0
  54. package/dist/es/components/OcrAnnotation/OcrModal/style.less.mjs +4 -0
  55. package/dist/es/components/OcrAnnotation/PreLabelOCR/PreLabelModal.mjs +281 -0
  56. package/dist/es/components/OcrAnnotation/PreLabelOCR/index.mjs +44 -0
  57. package/dist/es/components/OcrAnnotation/PreLabelOCR/style.less.mjs +4 -0
  58. package/dist/es/components/OcrAnnotation/constant.mjs +5 -0
  59. package/dist/es/components/OcrAnnotation/index.mjs +382 -0
  60. package/dist/es/components/OcrAnnotation/style.less.mjs +4 -0
  61. package/dist/es/components/OcrImageAnnotation/index.mjs +40 -0
  62. package/dist/es/components/OcrImageAnnotation/style.less.mjs +4 -0
  63. package/dist/es/components/PageNav/index.mjs +30 -0
  64. package/dist/es/components/PageNav/style.less.mjs +4 -0
  65. package/dist/es/components/PicZipImportModal/index.mjs +584 -0
  66. package/dist/es/components/PicZipImportModal/pic_zip.svg.mjs +4 -0
  67. package/dist/es/components/PicZipImportModal/pic_zip_json.svg.mjs +4 -0
  68. package/dist/es/components/PicZipImportModal/style.less.mjs +4 -0
  69. package/dist/es/components/PreLabelOCR/PreLabelModal.mjs +276 -0
  70. package/dist/es/components/PreLabelOCR/index.mjs +44 -0
  71. package/dist/es/components/PreLabelOCR/style.less.mjs +4 -0
  72. package/dist/es/components/ScanTable/index.mjs +97 -0
  73. package/dist/es/components/ScanTable/style.less.mjs +4 -0
  74. package/dist/es/components/Thumbnail/default.png.mjs +4 -0
  75. package/dist/es/components/Thumbnail/index.mjs +31 -0
  76. package/dist/es/components/Thumbnail/style.less.mjs +4 -0
  77. package/dist/es/components/hooks/Prompt.mjs +33 -0
  78. package/dist/es/constant.mjs +13 -0
  79. package/dist/es/createDatasetAnnotation/index.mjs +133 -0
  80. package/dist/es/createDetectionDatasetAnnotation/index.mjs +129 -0
  81. package/dist/es/createDetectionImageAnnotation/index.mjs +31 -0
  82. package/dist/es/createOcrDatasetAnnotation/index.mjs +129 -0
  83. package/dist/es/createOcrImageAnnotation/index.mjs +33 -0
  84. package/dist/es/featuresConfig.mjs +79 -0
  85. package/dist/es/index.mjs +13 -0
  86. package/dist/es/node_modules/@glodon-aiot/minio/dist/minio.mjs +28463 -0
  87. package/dist/es/utils/color.mjs +30 -0
  88. package/dist/es/utils/index.mjs +22 -0
  89. package/dist/es/utils/sign.mjs +33 -0
  90. package/dist/lib/index.js +130 -0
  91. package/dist/src/Common/Page/index.d.ts +1 -2
  92. package/dist/src/Common/PageHeader/index.d.ts +0 -1
  93. package/dist/src/DatasetContext/index.d.ts +3 -4
  94. package/dist/src/components/CompositionInput/index.d.ts +2 -2
  95. package/dist/src/components/DataEmpty/index.d.ts +1 -2
  96. package/dist/src/components/DetectionAnnotation/PreSamplesPage/index.d.ts +1 -2
  97. package/dist/src/components/DetectionAnnotation/components/DisabledTooltip/index.d.ts +2 -2
  98. package/dist/src/components/DetectionAnnotation/components/ImageDetail/index.d.ts +1 -2
  99. package/dist/src/components/DetectionAnnotation/components/LabelMaker/Drawable.d.ts +2 -2
  100. package/dist/src/components/DetectionAnnotation/components/LabelMaker/RectLabel.d.ts +6 -5
  101. package/dist/src/components/DetectionAnnotation/components/LabelMaker/index.d.ts +0 -1
  102. package/dist/src/components/DetectionAnnotation/components/Labels/index.d.ts +0 -1
  103. package/dist/src/components/DetectionAnnotation/components/TagItem/index.d.ts +1 -2
  104. package/dist/src/components/DetectionAnnotation/index.d.ts +1 -2
  105. package/dist/src/components/DetectionImageAnnotation/index.d.ts +0 -2
  106. package/dist/src/components/Iconfont/font_3140028_iptomfpgyu.d.ts +0 -0
  107. package/dist/src/components/Iconfont/font_3454453_gu5ijeufyng.d.ts +0 -0
  108. package/dist/src/components/Iconfont/font_4108228_3slzqhoow93.d.ts +0 -0
  109. package/dist/src/components/Iconfont/font_4439177_k3mjwv7kzfd.d.ts +0 -0
  110. package/dist/src/components/Iconfont/index.d.ts +1 -2
  111. package/dist/src/components/MarkDescriptions/index.d.ts +0 -1
  112. package/dist/src/components/OCRImageViewer/index.d.ts +1 -2
  113. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorInput.d.ts +2 -2
  114. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorItem.d.ts +1 -2
  115. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LableEditor.d.ts +0 -1
  116. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/index.d.ts +0 -1
  117. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/ImageDetail/index.d.ts +1 -2
  118. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/LabelEditorInput.d.ts +2 -2
  119. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/LabelEditorItem.d.ts +0 -1
  120. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/LableEditor.d.ts +0 -1
  121. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/index.d.ts +0 -1
  122. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/index.d.ts +0 -1
  123. package/dist/src/components/OcrAnnotation/OcrModal/index.d.ts +1 -2
  124. package/dist/src/components/OcrAnnotation/PreLabelOCR/PreLabelModal.d.ts +1 -2
  125. package/dist/src/components/OcrAnnotation/PreLabelOCR/index.d.ts +1 -2
  126. package/dist/src/components/OcrAnnotation/index.d.ts +1 -2
  127. package/dist/src/components/OcrImageAnnotation/index.d.ts +0 -2
  128. package/dist/src/components/PageNav/index.d.ts +1 -2
  129. package/dist/src/components/PicZipImportModal/index.d.ts +1 -2
  130. package/dist/src/components/PreLabelOCR/PreLabelModal.d.ts +1 -2
  131. package/dist/src/components/PreLabelOCR/index.d.ts +1 -2
  132. package/dist/src/components/ScanTable/index.d.ts +1 -2
  133. package/dist/src/components/Thumbnail/index.d.ts +1 -2
  134. package/dist/src/components/hooks/Prompt.d.ts +0 -1
  135. package/dist/src/components/hooks/useBlocker.d.ts +1 -1
  136. package/dist/src/featuresConfig.d.ts +1 -1
  137. package/dist/src/utils/sign.d.ts +1 -1
  138. package/package.json +15 -6
@@ -0,0 +1,713 @@
1
+ var ft = Object.defineProperty, ht = Object.defineProperties;
2
+ var ut = Object.getOwnPropertyDescriptors;
3
+ var we = Object.getOwnPropertySymbols;
4
+ var mt = Object.prototype.hasOwnProperty, pt = Object.prototype.propertyIsEnumerable;
5
+ var ze = (x, f, r) => f in x ? ft(x, f, { enumerable: !0, configurable: !0, writable: !0, value: r }) : x[f] = r, b = (x, f) => {
6
+ for (var r in f || (f = {}))
7
+ mt.call(f, r) && ze(x, r, f[r]);
8
+ if (we)
9
+ for (var r of we(f))
10
+ pt.call(f, r) && ze(x, r, f[r]);
11
+ return x;
12
+ }, y = (x, f) => ht(x, ut(f));
13
+ import { jsx as o, jsxs as v, Fragment as he } from "react/jsx-runtime";
14
+ import { useRef as gt, useState as d, useEffect as h } from "react";
15
+ import { message as K, ConfigProvider as bt, Space as ee, Select as vt, Button as M, Tabs as St, Col as Ct, Tooltip as It, Empty as yt, Spin as Lt, Modal as kt } from "antd";
16
+ import Dt from "rc-virtual-list";
17
+ import { UploadZipsStatus as U, PreLabelTaskStatus as xt } from "@glodon-aiot/apis";
18
+ import Tt from "antd/es/locale/zh_CN";
19
+ import Vt from "../../DatasetContext/index.mjs";
20
+ import Nt from "./icon_item_empty.svg.mjs";
21
+ import "./style.less.mjs";
22
+ import { tagColors as Ee } from "../../utils/index.mjs";
23
+ import Pt from "./components/ImageDetail/index.mjs";
24
+ import wt from "./components/Labels/index.mjs";
25
+ import { useKeyPress as zt } from "ahooks";
26
+ import Ae from "./components/DisabledTooltip/index.mjs";
27
+ import Et from "./PreSamplesPage/index.mjs";
28
+ import { SearchOutlined as At } from "@ant-design/icons";
29
+ import Mt from "../../Common/Page/index.mjs";
30
+ import Rt from "../PicZipImportModal/index.mjs";
31
+ import Bt from "../PageNav/index.mjs";
32
+ import Ot from "../Thumbnail/index.mjs";
33
+ import Ht from "../CompositionInput/index.mjs";
34
+ import { Prompt as Ft } from "../hooks/Prompt.mjs";
35
+ import Kt from "../PreLabelOCR/index.mjs";
36
+ import Ut from "lodash/merge";
37
+ import { DEFAULT_FILTER_SWITCH as jt } from "../../constant.mjs";
38
+ const gi = (x) => {
39
+ var Ne;
40
+ const {
41
+ services: f,
42
+ datasetId: r,
43
+ versionId: G,
44
+ backTo: Me,
45
+ labelManager: ue = !1,
46
+ datasetManager: m = !1,
47
+ annotation: Re,
48
+ header: L = {
49
+ versionSelect: !1
50
+ },
51
+ exampleSrcRoot: Be
52
+ } = x, j = b({}, jt);
53
+ Ut(j, x.filterSwitch);
54
+ const Z = gt(null), [S, me] = d(), [i, $] = d(), [J, Oe] = d([]), [pe, ge] = d(!1), [B, be] = d(0), [I, te] = d(""), [O, ve] = d(0), [He, Fe] = d(), [Se, ie] = d(!1), [Ce, Ke] = d(!1), [Ie, Ue] = d(!0), [je, Ze] = d(!1), [P, ye] = d([]), [g, H] = d([]), [w, Q] = d(!1), [ne, le] = d(!1), [W, T] = d(-1), [p, k] = d(), [c, z] = d(), [n, N] = d({
55
+ current: 0,
56
+ pageSize: 100
57
+ }), [F, re] = d([]), [R, $e] = d(""), [We, qe] = d(!1), [Le, ke] = d(), [X, oe] = d(null), [V, De] = d(!1), [_e, xe] = d(!1), [Ge, Je] = d(0), [Qe, se] = d(""), [q, Xe] = d(""), [Ye, et] = d(), E = () => {
58
+ k(void 0), z(void 0), T(-1), Q(!1), Y(), setTimeout(() => {
59
+ N((e) => y(b({}, e), {
60
+ current: 1,
61
+ type: void 0
62
+ }));
63
+ }, 10);
64
+ };
65
+ zt("Esc", E), h(() => {
66
+ r && f.cvforceDatahub.getS3Iam(r).then((e) => {
67
+ Fe(e);
68
+ });
69
+ }, [r]), h(() => {
70
+ f.cvforceDatahub && f.cvforceDatahub.getOptionsImgproxy().then((e) => et(e));
71
+ }, [f.cvforceDatahub]), h(() => {
72
+ D();
73
+ }, [i == null ? void 0 : i.id]), h(() => {
74
+ r && (ge(!0), Promise.all([
75
+ // 数据集
76
+ f.cvforceDatahub.getDatasetsId(r).then((e) => {
77
+ me(e);
78
+ }),
79
+ // 版本列表
80
+ f.cvforceDatahub.getDatasetsIdVersions(r, 1, 1e3).then((e) => {
81
+ Oe(e.recordList), $(G ? e.recordList.find((t) => t.id === G) : e.recordList[0]);
82
+ })
83
+ ]).finally(() => ge(!1)));
84
+ }, [r, G]);
85
+ const Te = () => {
86
+ !r || !i || f.cvforceDatahub.getDatasetsIdVersionsVid(r, i.id).then((e) => {
87
+ $(e), $e(e.versionAsyncTask.state);
88
+ });
89
+ };
90
+ h(() => {
91
+ R !== U.Pending && R !== U.Started || K.warning("文件导入中,请刷新页面再试");
92
+ }, [R]), h(() => {
93
+ $(void 0), N(y(b({}, n), {
94
+ current: 1
95
+ })), H([]), Te();
96
+ }, [r, G]), h(() => {
97
+ r && f.cvforceDatahub.getDatasetsId(r).then((e) => {
98
+ me(e);
99
+ });
100
+ }, [r]), h(() => {
101
+ Y();
102
+ }, [F, i]), h(() => {
103
+ !i || !S || A(y(b({}, n), {
104
+ current: 1
105
+ })).then((e) => {
106
+ });
107
+ }, [S == null ? void 0 : S.id, i == null ? void 0 : i.id, F]), h(() => {
108
+ A().then((e) => {
109
+ }), D();
110
+ }, [n.current]), h(() => {
111
+ V && D();
112
+ }, [Le]), h(() => {
113
+ A(y(b({}, n), {
114
+ current: 1,
115
+ total: void 0
116
+ })).then((e) => {
117
+ e && p && (Array.isArray(e) && e.length ? (T(0), k(e[0]), z(void 0)) : E());
118
+ });
119
+ }, [I]), h(() => {
120
+ ne || k(void 0);
121
+ }, [ne]), h(() => {
122
+ !w && p && Q(!0);
123
+ }, [p]), h(() => {
124
+ !g.length && w && E();
125
+ }, [g.length, w]), h(() => {
126
+ Ze(!Ie && Ce);
127
+ }, [Ie, Ce]), h(() => {
128
+ if (!r) {
129
+ X && (clearTimeout(X), oe(null)), ke(void 0);
130
+ return;
131
+ }
132
+ ae();
133
+ }, [r, i == null ? void 0 : i.id]), h(() => {
134
+ ae();
135
+ }, [We]), h(() => {
136
+ ce();
137
+ }, [V, r, i]), h(() => {
138
+ A(y(b({}, n), {
139
+ current: 1
140
+ })), D();
141
+ }, [q]), h(() => {
142
+ se("");
143
+ }, [p]);
144
+ const ce = () => {
145
+ i && f.cvforceDatahub.getDatasetsIdVersionsVidSamples(r, i.id, {
146
+ pageNo: 1,
147
+ pageSize: 1e3,
148
+ confirmStatus: 1
149
+ }).then((e) => {
150
+ Je(e.recordList.length);
151
+ });
152
+ }, ae = () => {
153
+ !r || !i || f.cvforceDatahub.getPreLabelTask(r, i.id).then((e) => {
154
+ const t = e[0];
155
+ if (ke(t), X && (clearTimeout(X), oe(null)), !(t != null && t.state) || t.state !== xt.Started) {
156
+ De(!1), D();
157
+ return;
158
+ } else
159
+ De(!0);
160
+ oe(setTimeout(() => {
161
+ ae();
162
+ }, 1e4));
163
+ });
164
+ };
165
+ h(() => {
166
+ S && S.markType !== "detection" && console.error("当前数据集不是detection(物体检测)类型,请检查数据集类型。");
167
+ }, [S]);
168
+ const A = (e, t) => {
169
+ const s = (e == null ? void 0 : e.current) || n.current, l = (e == null ? void 0 : e.pageSize) || n.pageSize;
170
+ if (!r || !i || !s)
171
+ return Promise.resolve(!1);
172
+ const a = F.map((C) => C.label), u = () => {
173
+ switch (I) {
174
+ case "nocode":
175
+ return "nocode";
176
+ case "hascode":
177
+ return a.length ? a : "hascode";
178
+ default:
179
+ return a.length ? a : void 0;
180
+ }
181
+ };
182
+ return s === 1 && ct(), N(y(b({}, n), {
183
+ current: s,
184
+ pageSize: l
185
+ })), f.cvforceDatahub.getDatasetsIdVersionsVidSamples(r, i.id, {
186
+ pageNo: s,
187
+ pageSize: l,
188
+ labels: u(),
189
+ searchName: q
190
+ }).then((C) => {
191
+ const _ = C.recordList || [], Pe = s === 1 ? _ : [...t || g, ..._];
192
+ if (H(Pe), N(y(b({}, n), {
193
+ current: s,
194
+ pageSize: l,
195
+ total: C.totalResults
196
+ })), n.type === "next" && _.length) {
197
+ T(0);
198
+ const fe = C.recordList[0];
199
+ k(fe);
200
+ }
201
+ if (n.type === "prev" && _.length) {
202
+ T(n.pageSize - 1);
203
+ const fe = C.recordList[n.pageSize - 1];
204
+ k(fe);
205
+ }
206
+ return w && W < 0 && (T(0), k(_[0]), le(!0)), Pe;
207
+ }).catch(() => !1);
208
+ };
209
+ h(() => {
210
+ N(I === "nocode" ? y(b({}, n), {
211
+ total: B
212
+ }) : I === "" ? y(b({}, n), {
213
+ total: O
214
+ }) : y(b({}, n), {
215
+ total: O - B
216
+ }));
217
+ }, [B, O]);
218
+ const D = () => {
219
+ !r || !i || f.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(r, i.id, {
220
+ label: "allcode",
221
+ searchName: q
222
+ }).then((e) => {
223
+ const t = e.find((l) => l.id === "allcodeid"), s = e.find((l) => l.id === "nocodeid");
224
+ ve(t ? t.count : 0), be(s ? s.count : 0);
225
+ });
226
+ }, Y = () => {
227
+ if (!(!r || !(i != null && i.id)))
228
+ return f.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(r, i.id).then((e) => {
229
+ const s = (e || []).filter((l) => l.label !== "nocode").map((l, a) => ({
230
+ label: l.label,
231
+ count: l.count,
232
+ id: l.id,
233
+ color: Ee[a % 40]
234
+ }));
235
+ return ye(s), e;
236
+ });
237
+ }, tt = (e) => {
238
+ if (!g)
239
+ return;
240
+ T(e);
241
+ const t = g[e];
242
+ k(t), le(!0);
243
+ };
244
+ h(() => {
245
+ n.type || A();
246
+ }, [n.type]), h(() => {
247
+ if (!c)
248
+ return;
249
+ const e = [];
250
+ c == null || c.labels.forEach((t) => {
251
+ P != null && P.find((s) => s.id === t.id) && e.push(t);
252
+ }), c.labels = e, z(c);
253
+ }, [P]);
254
+ const Ve = () => {
255
+ if (g)
256
+ return de().then((e) => (e && (D(), H((t) => {
257
+ let s;
258
+ if (Array.isArray(t)) {
259
+ if (!t.length)
260
+ return E(), t;
261
+ const l = !c || c.labels.length && I === "hascode" || !c.labels.length && I === "nocode" || I === "" ? W + 1 : W;
262
+ if (c && (c.labels.length && I === "nocode" || !c.labels.length && I === "hascode")) {
263
+ const a = t.findIndex((u) => u.id === c.id);
264
+ a > -1 && (t.splice(a, 1), s = [...t], n.total && (n.total = n.total - 1));
265
+ }
266
+ if (l >= t.length) {
267
+ const a = (n.current - 1) * n.pageSize + l;
268
+ n.total && a >= n.total ? K.error("已经是最后一个了") : A({
269
+ current: n.current + 1,
270
+ pageSize: n.pageSize,
271
+ type: "next"
272
+ }, t).then((u) => {
273
+ T(l);
274
+ const C = u[l];
275
+ k(C), z(void 0);
276
+ });
277
+ } else
278
+ setTimeout(() => {
279
+ T(l);
280
+ const a = t[l];
281
+ k(a), z(void 0);
282
+ }, 200);
283
+ }
284
+ return s || t;
285
+ })), e));
286
+ }, it = () => {
287
+ g && de().then((e) => {
288
+ e && (D(), H((t) => {
289
+ let s;
290
+ if (Array.isArray(t)) {
291
+ if (!t.length)
292
+ return E(), t;
293
+ const l = W - 1;
294
+ if (l < 0)
295
+ (n.current - 1) * n.pageSize + l < 0 ? K.error("已经是第一个了") : N({
296
+ current: n.current - 1,
297
+ pageSize: n.pageSize,
298
+ type: "prev"
299
+ });
300
+ else {
301
+ if (c && (c.labels.length && I === "nocode" || !c.labels.length && I === "hascode")) {
302
+ const a = t.findIndex((u) => u.id === c.id);
303
+ a > -1 && (t.splice(a, 1), s = [...t], n.total && (n.total = n.total - 1));
304
+ }
305
+ setTimeout(() => {
306
+ T(l);
307
+ const a = t[l];
308
+ k(a), z(void 0);
309
+ }, 200);
310
+ }
311
+ }
312
+ return s || t;
313
+ }));
314
+ });
315
+ }, nt = (e) => {
316
+ const t = Object.keys(e.labels.reduce((s, l) => (s[l.label] ? ++s[l.label] : s[l.label] = 1, s), {})).length;
317
+ return t >= 2 ? `+${t - 1}` : null;
318
+ }, lt = (e) => {
319
+ var t;
320
+ (!n.total || n.total > g.length) && e.currentTarget.scrollHeight - e.currentTarget.scrollTop === ((t = Z.current) == null ? void 0 : t.clientHeight) && N(y(b({}, n), {
321
+ current: n.current + 1
322
+ }));
323
+ }, de = () => i ? c && !V ? (c.labels && (c.labels = c.labels.filter((e) => !!e.id)), f.cvforceDatahub.updateSamples(r, i.id, [c], 0).then(() => (K.success({
324
+ content: "保存成功"
325
+ }), H((e) => {
326
+ const t = e.findIndex((s) => s.id === (c == null ? void 0 : c.id));
327
+ return t > -1 && (e[t] = c), [...e];
328
+ }), !0)).catch(() => !1)) : Promise.resolve(!0) : Promise.resolve(!1), rt = () => {
329
+ if (c && c.labels.some((e) => !e.id))
330
+ return K.error("所有标注需设置标签"), Promise.resolve(!1);
331
+ Ve();
332
+ }, ot = () => {
333
+ kt.confirm({
334
+ title: "确认要删除当前数据吗?",
335
+ content: "数据包含当前标注的内容和图片,删除后无法恢复,请确认是否删除!",
336
+ onOk: () => {
337
+ !p || !i || f.cvforceDatahub.delDatasetsIdVersionsVidSamplesId(r, i.id, p.id).then(() => {
338
+ const e = g.findIndex((t) => t.id === p.id);
339
+ g.splice(e, 1), H([...g]), N(y(b({}, n), {
340
+ total: n.total ? n.total - 1 : 0
341
+ })), e <= g.length - 1 ? k(g[e]) : (k(g[e - 1]), T(e - 1)), D(), z(void 0), n.total && n.total - 1 === 0 && E();
342
+ });
343
+ }
344
+ });
345
+ }, st = [{
346
+ key: "",
347
+ label: `全部(${O})`,
348
+ children: null
349
+ }, {
350
+ key: "nocode",
351
+ label: `未标注(${B})`,
352
+ children: null
353
+ }, {
354
+ key: "hascode",
355
+ label: `已标注(${O - B})`,
356
+ children: null
357
+ }], ct = () => {
358
+ var e, t;
359
+ (t = (e = Z.current) == null ? void 0 : e.getElementsByClassName("rc-virtual-list-holder")[0]) == null || t.scrollTo({
360
+ top: 0
361
+ });
362
+ }, at = () => {
363
+ xe(!0);
364
+ }, dt = (e) => {
365
+ Xe(e);
366
+ };
367
+ return /* @__PURE__ */ o(bt, {
368
+ locale: Tt,
369
+ children: /* @__PURE__ */ o(Vt.Provider, {
370
+ value: {
371
+ datasetId: r,
372
+ versionId: (i == null ? void 0 : i.id) || "",
373
+ no: (i == null ? void 0 : i.no) || "",
374
+ loading: pe,
375
+ version: i,
376
+ versions: J,
377
+ samples: g,
378
+ pagination: n,
379
+ services: f,
380
+ featuresConfig: {
381
+ labelManager: ue,
382
+ datasetManager: m,
383
+ annotation: Re,
384
+ filterSwitch: j,
385
+ header: L,
386
+ exampleSrcRoot: Be
387
+ }
388
+ },
389
+ children: S ? S.markType === "detection" ? /* @__PURE__ */ o("div", {
390
+ className: "detection-version-detail",
391
+ children: _e ? i != null && i.id && m && m.preLabel ? /* @__PURE__ */ o(Et, {
392
+ datasetId: r,
393
+ versionId: i.id,
394
+ onClose: () => {
395
+ xe(!1), ce(), Y(), D(), A();
396
+ },
397
+ samples: g,
398
+ labels: P,
399
+ fetchLength: ce
400
+ }) : null : /* @__PURE__ */ v(Mt, {
401
+ className: "product-details-page",
402
+ header: L === !1 ? void 0 : /* @__PURE__ */ o(Bt, {
403
+ backTo: Me,
404
+ onBackClick: L != null && L.onBackClick ? () => {
405
+ p && E(), L.onBackClick && L.onBackClick();
406
+ } : void 0,
407
+ left: !pe && /* @__PURE__ */ v(ee, {
408
+ children: [/* @__PURE__ */ o("span", {
409
+ style: {
410
+ fontWeight: "bold"
411
+ },
412
+ children: S == null ? void 0 : S.name
413
+ }), /* @__PURE__ */ o(vt, {
414
+ disabled: w || (L == null ? void 0 : L.versionSelect) === !1,
415
+ value: i == null ? void 0 : i.id,
416
+ style: {
417
+ width: 70
418
+ },
419
+ options: J.map((e) => ({
420
+ label: e.no,
421
+ value: e.id
422
+ })),
423
+ onChange: (e) => {
424
+ const t = J.find((l) => l.id === e);
425
+ if (!S || !t)
426
+ return;
427
+ const s = J.find((l) => l.id === t.id);
428
+ $(s), L != null && L.onVersionChange && L.onVersionChange(s);
429
+ }
430
+ })]
431
+ }),
432
+ right: /* @__PURE__ */ v(ee, {
433
+ children: [!p && m && m.add && /* @__PURE__ */ o(Ae, {
434
+ isPreLabel: V,
435
+ placement: "bottom",
436
+ children: /* @__PURE__ */ o(M, {
437
+ type: "default",
438
+ onClick: () => ie(!0),
439
+ disabled: R === U.Pending || R === U.Started || V,
440
+ children: "导入数据"
441
+ }, "del")
442
+ }), !p && m && m.preLabel && (i != null && i.id) ? /* @__PURE__ */ v(he, {
443
+ children: [/* @__PURE__ */ o(Kt, {
444
+ datasetId: r,
445
+ versionId: i.id,
446
+ disabled: !g.length,
447
+ setIsTaskChange: qe,
448
+ datasetType: "detection",
449
+ preLabelTask: Le
450
+ }), /* @__PURE__ */ o(M, {
451
+ disabled: V || !Ge,
452
+ onClick: at,
453
+ children: "待确认标注"
454
+ })]
455
+ }) : null, /* @__PURE__ */ o(Ft, {
456
+ when: je,
457
+ content: "确认要离开此页面吗?",
458
+ subContent: "离开此页面后,将结束导入,放弃未上传的文件,请谨慎操作!"
459
+ }), Se && /* @__PURE__ */ o(Rt, {
460
+ datasetIam: He,
461
+ datasetId: r,
462
+ currentVersion: i,
463
+ tenCode: S == null ? void 0 : S.tenantCode,
464
+ isVisible: Se,
465
+ setIsVisible: ie,
466
+ getVersionListRequest: D,
467
+ setIsConfirm: Ue,
468
+ onUploadStatusChange: (e) => {
469
+ Ke(e);
470
+ },
471
+ tableReload: () => {
472
+ var e, t;
473
+ i != null && i.id && ((t = (e = Z.current) == null ? void 0 : e.getElementsByClassName("rc-virtual-list-holder")[0]) == null || t.scrollTo({
474
+ top: 0
475
+ }), A(y(b({}, n), {
476
+ current: 1
477
+ })));
478
+ },
479
+ loadVersionData: Te
480
+ })]
481
+ })
482
+ }),
483
+ children: [/* @__PURE__ */ v("div", {
484
+ className: "detection-header",
485
+ children: [/* @__PURE__ */ v(ee, {
486
+ children: [j.tabs && /* @__PURE__ */ o(St, {
487
+ className: "header-tab",
488
+ activeKey: I,
489
+ items: st,
490
+ onChange: (e) => {
491
+ c ? (de().then((t) => {
492
+ t ? (te(e), D()) : K.error("保存失败");
493
+ }), Q(!1)) : (N(y(b({}, n), {
494
+ current: 1,
495
+ total: void 0
496
+ })), te(e)), e === "nocode" && re([]);
497
+ }
498
+ }), !w && !p && j.search && /* @__PURE__ */ o(Ht, {
499
+ placeholder: "请输入图片名称搜索",
500
+ suffix: /* @__PURE__ */ o(At, {}),
501
+ value: q,
502
+ onChange: dt,
503
+ allowClear: !0
504
+ })]
505
+ }), /* @__PURE__ */ o(Ae, {
506
+ isPreLabel: V,
507
+ children: /* @__PURE__ */ v(ee, {
508
+ children: [w ? /* @__PURE__ */ v(he, {
509
+ children: [m && m.label ? /* @__PURE__ */ o(M, {
510
+ type: "primary",
511
+ onClick: () => rt(),
512
+ disabled: V,
513
+ children: "保存"
514
+ }) : null, /* @__PURE__ */ o(M, {
515
+ onClick: E,
516
+ children: "退出"
517
+ })]
518
+ }) : m && m.label && /* @__PURE__ */ o(M, {
519
+ type: "primary",
520
+ disabled: !B || V,
521
+ onClick: () => {
522
+ p || te("nocode"), Q(!0), T(-1), I === "nocode" && (T(0), k(g[0]));
523
+ },
524
+ children: "单张标注"
525
+ }), w && m && m.delete && /* @__PURE__ */ o(M, {
526
+ onClick: ot,
527
+ disabled: V,
528
+ children: "删除数据"
529
+ })]
530
+ })
531
+ })]
532
+ }), /* @__PURE__ */ v("div", {
533
+ className: "d-row",
534
+ children: [/* @__PURE__ */ v("div", {
535
+ className: "d-right",
536
+ ref: Z,
537
+ children: [p && /* @__PURE__ */ o(Pt, {
538
+ datasetId: r,
539
+ isImageDetailVisible: ne,
540
+ setIsImageDetailVisible: le,
541
+ currentSample: c != null ? c : p,
542
+ labels: P,
543
+ editing: w,
544
+ onChange: z,
545
+ onNextClick: () => Ve(),
546
+ onPrevClick: () => it(),
547
+ onRefresh: () => {
548
+ var e;
549
+ (e = Y()) == null || e.then((t) => {
550
+ var s, l;
551
+ if (c) {
552
+ const a = [];
553
+ (s = c.labels) == null || s.forEach((u) => {
554
+ t != null && t.find((C) => C.id === u.id) && a.push(u);
555
+ }), c.labels = a, z(b({}, c));
556
+ }
557
+ if (p) {
558
+ const a = [];
559
+ (l = p.labels) == null || l.forEach((u) => {
560
+ t != null && t.find((C) => C.id === u.id) && a.push(u);
561
+ }), p.labels = a, k(b({}, p));
562
+ }
563
+ }), D();
564
+ },
565
+ isPreLabel: V,
566
+ imgCount: {
567
+ total: O,
568
+ index: W + 1
569
+ },
570
+ settingHide: !ue,
571
+ readonly: m === !1 || m && m.label === !1
572
+ }), p ? /* @__PURE__ */ o("div", {}) : n.total !== void 0 && n.total > 0 ? /* @__PURE__ */ o(he, {
573
+ children: /* @__PURE__ */ o(Dt, {
574
+ innerProps: {
575
+ className: "d-right-row"
576
+ },
577
+ data: g,
578
+ itemKey: "id",
579
+ height: (Ne = Z.current) == null ? void 0 : Ne.clientHeight,
580
+ onScroll: lt,
581
+ children: (e, t) => {
582
+ var s;
583
+ return /* @__PURE__ */ o(Ct, {
584
+ className: "d-right-col",
585
+ children: /* @__PURE__ */ v("div", {
586
+ className: "right-col-wrapper",
587
+ onMouseEnter: () => se(e.id),
588
+ onMouseLeave: () => se(""),
589
+ children: [/* @__PURE__ */ v("div", {
590
+ className: "right-col-img",
591
+ children: [/* @__PURE__ */ o(Ot, {
592
+ fileKey: e.fileKey,
593
+ width: 124,
594
+ imgProxy: Ye
595
+ }), Qe === e.id && /* @__PURE__ */ v("div", {
596
+ className: "img-mask",
597
+ children: [/* @__PURE__ */ o("div", {
598
+ className: "img-file-name",
599
+ children: e.sampleFileName.name
600
+ }), /* @__PURE__ */ o(M, {
601
+ type: "default",
602
+ onClick: () => tt(t),
603
+ children: m && m.label ? "标注" : "查看"
604
+ })]
605
+ })]
606
+ }), /* @__PURE__ */ v("div", {
607
+ className: "right-col-text",
608
+ children: [(s = e.labels) != null && s.length ? /* @__PURE__ */ o(It, {
609
+ placement: "top",
610
+ title: /* @__PURE__ */ o("div", {
611
+ children: Object.keys(e.labels.reduce((l, a) => (l[a.label] ? ++l[a.label] : l[a.label] = 1, l), {})).map((l) => /* @__PURE__ */ o("div", {
612
+ children: l
613
+ }, l))
614
+ }),
615
+ children: /* @__PURE__ */ v("div", {
616
+ style: {
617
+ width: "100%",
618
+ display: "flex"
619
+ },
620
+ children: [/* @__PURE__ */ o("span", {
621
+ style: {
622
+ display: "inline-block",
623
+ maxWidth: "calc(100% - 25px)",
624
+ overflow: "hidden",
625
+ textOverflow: "ellipsis",
626
+ whiteSpace: "nowrap"
627
+ },
628
+ children: e.labels[0].label
629
+ }), e.labels.length > 1 ? /* @__PURE__ */ o("span", {
630
+ style: {
631
+ color: "rgba(0,0,0,0.45)",
632
+ marginLeft: 5
633
+ },
634
+ children: nt(e)
635
+ }) : null]
636
+ })
637
+ }) : /* @__PURE__ */ o("span", {
638
+ style: {
639
+ color: "rgba(0,0,0,0.45)",
640
+ width: "100%"
641
+ },
642
+ children: "无标签"
643
+ }), /* @__PURE__ */ o("div", {
644
+ children: t + 1
645
+ })]
646
+ })]
647
+ })
648
+ }, e.id);
649
+ }
650
+ })
651
+ }) : /* @__PURE__ */ o("div", {
652
+ className: "empty",
653
+ children: n.total === 0 ? /* @__PURE__ */ o(yt, {
654
+ image: Nt,
655
+ description: /* @__PURE__ */ v("span", {
656
+ children: ["暂无数据", I !== "hascode" && !q && /* @__PURE__ */ o("span", {
657
+ children: m && m.add && /* @__PURE__ */ v(M, {
658
+ type: "link",
659
+ size: "small",
660
+ style: {
661
+ padding: 0
662
+ },
663
+ onClick: () => ie(!0),
664
+ disabled: R === U.Pending || R === U.Started,
665
+ children: [/* @__PURE__ */ o("span", {
666
+ style: {
667
+ color: "black"
668
+ },
669
+ children: ","
670
+ }), " ", "立即导入 >"]
671
+ })
672
+ })]
673
+ })
674
+ }) : /* @__PURE__ */ o(Lt, {})
675
+ })]
676
+ }), I !== "nocode" && !p && j.labels && /* @__PURE__ */ o("div", {
677
+ className: "d-sider",
678
+ children: /* @__PURE__ */ o(wt, {
679
+ datasetId: r,
680
+ data: P || [],
681
+ selected: F,
682
+ onSelectedChange: (e) => {
683
+ re((P == null ? void 0 : P.filter((t) => e.find((s) => s.label === t.label))) || []);
684
+ },
685
+ onListChange: (e) => {
686
+ i && (f.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(r, i.id).then((t) => {
687
+ const l = (t || []).filter((u) => u.label !== "nocode").map((u, C) => ({
688
+ label: u.label,
689
+ count: u.count,
690
+ id: u.id,
691
+ color: Ee[C % 40]
692
+ })), a = F.filter((u) => l.some((C) => C.id === u.id));
693
+ ye(l), F.length !== a.length && re(a);
694
+ }), D());
695
+ },
696
+ isPreLabel: V
697
+ })
698
+ })]
699
+ })]
700
+ })
701
+ }) : /* @__PURE__ */ o("div", {
702
+ style: {
703
+ color: "red",
704
+ textAlign: "center"
705
+ },
706
+ children: "当前数据集不是detection(物体检测)类型,请检查数据集类型。"
707
+ }) : null
708
+ })
709
+ });
710
+ };
711
+ export {
712
+ gi as default
713
+ };