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