@glodon-aiot/dataset-annotation 3.11.1-shapshot.1765331459 → 3.13.0-alpha.28

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 (118) hide show
  1. package/dist/es/DatasetContext/index.mjs +6 -3
  2. package/dist/es/components/DetectionAnnotation/components/ImageDetail/index.mjs +94 -91
  3. package/dist/es/components/DetectionAnnotation/components/ImageModal/index.mjs +129 -0
  4. package/dist/es/components/DetectionAnnotation/components/ImageModal/style.less.mjs +4 -0
  5. package/dist/es/components/DetectionAnnotation/components/LabelMaker/Drawable.mjs +37 -28
  6. package/dist/es/components/DetectionAnnotation/components/LabelMaker/RectLabel.mjs +136 -108
  7. package/dist/es/components/DetectionAnnotation/components/LabelMaker/index.mjs +197 -162
  8. package/dist/es/components/DetectionAnnotation/index.mjs +424 -395
  9. package/dist/es/components/Iconfont/index.mjs +2 -2
  10. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/index.mjs +1 -1
  11. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/index.mjs +1 -1
  12. package/dist/es/components/OcrAnnotation/OcrModal/index.mjs +43 -45
  13. package/dist/es/components/PicZipImportModal/config.mjs +47 -0
  14. package/dist/es/components/PicZipImportModal/index.mjs +308 -293
  15. package/dist/es/components/PicZipImportModal/pic_vlm_json_zip.svg.mjs +4 -0
  16. package/dist/es/components/PicZipImportModal/pic_vlm_zip.svg.mjs +4 -0
  17. package/dist/es/components/PreLabelOCR/index.mjs +1 -1
  18. package/dist/es/components/VLMAnnotation/RegionItem.mjs +94 -0
  19. package/dist/es/components/VLMAnnotation/TextAnnotationPanel.mjs +83 -0
  20. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.mjs +116 -0
  21. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.mjs +115 -0
  22. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.mjs +42 -0
  23. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.mjs +55 -0
  24. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.mjs +51 -0
  25. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.mjs +47 -0
  26. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.mjs +248 -0
  27. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.mjs +106 -0
  28. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.mjs +68 -0
  29. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.mjs +38 -0
  30. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.mjs +141 -0
  31. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.mjs +72 -0
  32. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.mjs +113 -0
  33. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.mjs +103 -0
  34. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.mjs +156 -0
  35. package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/del.png.mjs +4 -0
  36. package/dist/es/components/VLMAnnotation/VLMLabelMaker/index.mjs +526 -0
  37. package/dist/es/components/VLMAnnotation/VLMLabelMaker/style.less.mjs +4 -0
  38. package/dist/es/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.mjs +33 -0
  39. package/dist/es/components/VLMAnnotation/components/DragButton.mjs +18 -0
  40. package/dist/es/components/VLMAnnotation/components/FitToScreenButton.mjs +16 -0
  41. package/dist/es/components/VLMAnnotation/components/RectangleButton.mjs +30 -0
  42. package/dist/es/components/VLMAnnotation/components/Toolbar.mjs +40 -0
  43. package/dist/es/components/VLMAnnotation/components/ZoomControls.mjs +44 -0
  44. package/dist/es/components/VLMAnnotation/constants.mjs +50 -0
  45. package/dist/es/components/VLMAnnotation/index.mjs +242 -0
  46. package/dist/es/components/VLMAnnotation/style.less.mjs +4 -0
  47. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.mjs +343 -0
  48. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/style.less.mjs +4 -0
  49. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.mjs +240 -0
  50. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.mjs +201 -0
  51. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/style.less.mjs +4 -0
  52. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/index.mjs +455 -0
  53. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/style.less.mjs +4 -0
  54. package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +149 -0
  55. package/dist/es/components/VLMAnnotationDetail/VlmModal/style.less.mjs +4 -0
  56. package/dist/es/components/VLMAnnotationDetail/index.mjs +449 -0
  57. package/dist/es/components/VLMAnnotationDetail/style.less.mjs +4 -0
  58. package/dist/es/constant.mjs +3 -3
  59. package/dist/es/createVlmtasetAnnotation/index.mjs +131 -0
  60. package/dist/es/featuresConfig.mjs +13 -9
  61. package/dist/es/index.mjs +11 -7
  62. package/dist/lib/index.js +4 -3
  63. package/dist/src/DatasetContext/index.d.ts +2 -0
  64. package/dist/src/components/DetectionAnnotation/components/ImageDetail/index.d.ts +1 -0
  65. package/dist/src/components/DetectionAnnotation/components/ImageModal/index.d.ts +34 -0
  66. package/dist/src/components/Iconfont/font_4439177_tgvowh6bmlb.d.ts +0 -0
  67. package/dist/src/components/PicZipImportModal/config.d.ts +23 -0
  68. package/dist/src/components/VLMAnnotation/ImageAnnotationDebugger.d.ts +4 -0
  69. package/dist/src/components/VLMAnnotation/RegionItem.d.ts +4 -0
  70. package/dist/src/components/VLMAnnotation/TextAnnotationPanel.d.ts +4 -0
  71. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.d.ts +13 -0
  72. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.d.ts +38 -0
  73. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.d.ts +18 -0
  74. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.d.ts +7 -0
  75. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.d.ts +13 -0
  76. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.d.ts +21 -0
  77. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.d.ts +32 -0
  78. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.d.ts +11 -0
  79. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.d.ts +28 -0
  80. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.d.ts +13 -0
  81. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.d.ts +37 -0
  82. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.d.ts +12 -0
  83. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.d.ts +15 -0
  84. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.d.ts +32 -0
  85. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.d.ts +25 -0
  86. package/dist/src/components/VLMAnnotation/VLMLabelMaker/index.d.ts +4 -0
  87. package/dist/src/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.d.ts +32 -0
  88. package/dist/src/components/VLMAnnotation/components/DragButton.d.ts +7 -0
  89. package/dist/src/components/VLMAnnotation/components/FitToScreenButton.d.ts +6 -0
  90. package/dist/src/components/VLMAnnotation/components/RectangleButton.d.ts +7 -0
  91. package/dist/src/components/VLMAnnotation/components/Toolbar.d.ts +4 -0
  92. package/dist/src/components/VLMAnnotation/components/ZoomControls.d.ts +4 -0
  93. package/dist/src/components/VLMAnnotation/constants.d.ts +97 -0
  94. package/dist/src/components/VLMAnnotation/index.d.ts +6 -0
  95. package/dist/src/components/VLMAnnotation/types.d.ts +172 -0
  96. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.d.ts +14 -0
  97. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.d.ts +12 -0
  98. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.d.ts +12 -0
  99. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/index.d.ts +12 -0
  100. package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +17 -0
  101. package/dist/src/components/VLMAnnotationDetail/index.d.ts +6 -0
  102. package/dist/src/constant.d.ts +1 -1
  103. package/dist/src/createVlmtasetAnnotation/index.d.ts +16 -0
  104. package/dist/src/featuresConfig.d.ts +4 -0
  105. package/dist/src/index.d.ts +3 -0
  106. package/package.json +2 -2
  107. package/dist/dataset-annotation.js +0 -123598
  108. package/dist/dataset-annotation.umd.cjs +0 -1017
  109. package/dist/example/DatasetAnnotationDemo.d.ts +0 -3
  110. package/dist/example/DemoTabs.d.ts +0 -3
  111. package/dist/example/DetectionDatasetDemo.d.ts +0 -5
  112. package/dist/example/DetectionImageDemo.d.ts +0 -5
  113. package/dist/example/OcrDatasetDemo.d.ts +0 -5
  114. package/dist/example/OcrImageDemo.d.ts +0 -5
  115. package/dist/example/OcrkvcDatasetDemo.d.ts +0 -5
  116. package/dist/example/constant.local.d.ts +0 -6
  117. package/dist/example/index.d.ts +0 -1
  118. package/dist/src/utils/reactCompatibility.d.ts +0 -5
@@ -0,0 +1,455 @@
1
+ var Ge = Object.defineProperty, $e = Object.defineProperties;
2
+ var Pe = Object.getOwnPropertyDescriptors;
3
+ var Ie = Object.getOwnPropertySymbols;
4
+ var je = Object.prototype.hasOwnProperty, Be = Object.prototype.propertyIsEnumerable;
5
+ var be = (w, u, o) => u in w ? Ge(w, u, { enumerable: !0, configurable: !0, writable: !0, value: o }) : w[u] = o, U = (w, u) => {
6
+ for (var o in u || (u = {}))
7
+ je.call(u, o) && be(w, o, u[o]);
8
+ if (Ie)
9
+ for (var o of Ie(u))
10
+ Be.call(u, o) && be(w, o, u[o]);
11
+ return w;
12
+ }, P = (w, u) => $e(w, Pe(u));
13
+ var z = (w, u, o) => new Promise((x, g) => {
14
+ var J = (q) => {
15
+ try {
16
+ r(o.next(q));
17
+ } catch (E) {
18
+ g(E);
19
+ }
20
+ }, R = (q) => {
21
+ try {
22
+ r(o.throw(q));
23
+ } catch (E) {
24
+ g(E);
25
+ }
26
+ }, r = (q) => q.done ? x(q.value) : Promise.resolve(q.value).then(J, R);
27
+ r((o = o.apply(w, u)).next());
28
+ });
29
+ import { jsx as l, jsxs as B, Fragment as Ee } from "react/jsx-runtime";
30
+ import { Modal as ke, Space as Ae, Button as te, message as N, Tabs as de, Spin as Fe } from "antd";
31
+ import { useContext as Qe, useRef as j, useState as m, useEffect as W } from "react";
32
+ import "./style.less.mjs";
33
+ import Ke from "../../DataEmpty/index.mjs";
34
+ import Oe from "../../../DatasetContext/index.mjs";
35
+ import He from "./AttributeDetail/index.mjs";
36
+ import We from "./QADetail/index.mjs";
37
+ import Je from "../../VLMAnnotation/index.mjs";
38
+ import Xe from "axios";
39
+ const {
40
+ TabPane: K
41
+ } = de, lt = (w) => {
42
+ const {
43
+ visible: u,
44
+ selectSampleId: o,
45
+ datasetId: x,
46
+ versionId: g,
47
+ // vmlMarkTmpl,
48
+ onClose: J,
49
+ onSave: R
50
+ } = w, {
51
+ services: {
52
+ cvforceDatahub: r
53
+ },
54
+ token: q,
55
+ apiUrl: E
56
+ } = Qe(Oe), F = j(null);
57
+ j(null), j({});
58
+ const [i, I] = m(), C = j(void 0), [Ye, fe] = m(0), [y, G] = m([]), [ne, M] = m(-1), [f, T] = m({
59
+ current: 1,
60
+ pageSize: 100
61
+ // 与主列表保持一致
62
+ }), [ue, ge] = m(0), [he, pe] = m(0), [b, ie] = m(() => o ? "" : "nocode"), [me, O] = m(), [oe, xe] = m([]), [h, X] = m("textAnnotation"), [Y, Q] = m(), [Z, L] = m(!1), _ = j(0), re = j(0), [se, De] = m(!1), [ye, ee] = m(!1), [ae, ce] = m(!1), [Se, Ce] = m(!1), $ = j(null), D = j(null), [Ve, Le] = m(() => Date.now()), [ze, Ne] = m(() => Date.now());
63
+ W(() => {
64
+ u && (!x || !g || r == null || r.getDatasetsIdVersionsVidConfigs(x, g).then((e) => {
65
+ xe(e || []), (e == null ? void 0 : e.length) > 0 ? X("textAnnotation") : X("attributeDefinition");
66
+ }));
67
+ }, [u]), W(() => {
68
+ const e = f.current || 1, t = f.pageSize || 100, n = f.type;
69
+ if (!x || !g)
70
+ return;
71
+ const a = ++_.current;
72
+ ce(!0);
73
+ const p = y || [], s = o || me;
74
+ r == null || r.getDatasetsIdVersionsVidSamples(x, g, {
75
+ labels: b ? [b] : void 0,
76
+ pageNo: e,
77
+ pageSize: t
78
+ }).then((k) => {
79
+ if (a !== _.current)
80
+ return;
81
+ const d = k.recordList || [], c = e === 1 && !n ? d : n === "prev" ? [...d, ...p] : n === "next" ? [...p, ...d] : d;
82
+ G(c), T(P(U({}, f), {
83
+ current: e,
84
+ pageSize: t,
85
+ total: k.totalResults,
86
+ type: void 0
87
+ }));
88
+ let v = 0, S = c[0];
89
+ if (n === "next" && d.length)
90
+ v = p.length, S = d[0];
91
+ else if (n === "prev" && d.length)
92
+ v = d.length - 1, S = d[d.length - 1];
93
+ else if (s) {
94
+ const A = c.findIndex((H) => H.id === s);
95
+ if (A !== -1)
96
+ v = A, S = c[A];
97
+ else {
98
+ r == null || r.getDatasetsIdVersionsVidSsamplesSid(x, g, s).then((H) => {
99
+ a === _.current && H && (G([H, ...c]), I(H), M(0), fe(c.length + 1), O(void 0));
100
+ });
101
+ return;
102
+ }
103
+ }
104
+ S && (I(S), M(v), fe(c.length), me && O(void 0));
105
+ }).finally(() => {
106
+ a === _.current && ce(!1);
107
+ }), V();
108
+ }, [f.current, b, x, g]);
109
+ const V = () => {
110
+ !x || !g || r == null || r.getDatasetsIdVersionsVidLabelcount(x, g).then((e) => {
111
+ const t = e.find((a) => a.id === "allcodeid"), n = e.find((a) => a.id === "nocodeid");
112
+ ge(t ? t.count : 0), pe(n ? n.count : 0);
113
+ });
114
+ }, le = () => {
115
+ y && G((e) => {
116
+ var k, d, c, v;
117
+ const t = C.current || i, n = [...e];
118
+ let a;
119
+ if (t) {
120
+ const S = n.findIndex((A) => A.id === t.id);
121
+ S > -1 && n.splice(S, 1, t);
122
+ }
123
+ const p = !t || (k = t.labels) != null && k.length && b === "hascode" || !((d = t.labels) != null && d.length) && b === "nocode" || b === "" ? ne + 1 : ne;
124
+ if (t && ((c = t.labels) != null && c.length && b === "nocode" || !((v = t.labels) != null && v.length) && b === "hascode")) {
125
+ const S = n.findIndex((A) => A.id === t.id);
126
+ S > -1 && (n.splice(S, 1), a = [...n], T((A) => P(U({}, A), {
127
+ total: A.total ? A.total - 1 : A.total
128
+ })));
129
+ }
130
+ const s = a || n;
131
+ if (p >= s.length) {
132
+ const S = (f.current - 1) * f.pageSize + p;
133
+ f.total && S >= f.total ? N.error("已经是最后一个了") : T({
134
+ current: f.current + 1,
135
+ pageSize: f.pageSize,
136
+ type: "next"
137
+ });
138
+ } else
139
+ setTimeout(() => {
140
+ M(p);
141
+ const S = s[p];
142
+ I(S);
143
+ }, 0);
144
+ return s;
145
+ });
146
+ }, ve = () => {
147
+ var s, k;
148
+ if (!y)
149
+ return;
150
+ const e = C.current || i, t = [...y];
151
+ let n;
152
+ if (e && y) {
153
+ const d = t.findIndex((c) => c.id === e.id);
154
+ if (d > -1 && t.splice(d, 1, e), (s = e.labels) != null && s.length && b === "nocode" || !((k = e.labels) != null && k.length) && b === "hascode") {
155
+ const c = t.findIndex((v) => v.id === e.id);
156
+ c > -1 && (t.splice(c, 1), n = [...t], T((v) => P(U({}, v), {
157
+ total: v.total ? v.total - 1 : v.total
158
+ })));
159
+ }
160
+ }
161
+ const a = n || t, p = ne - 1;
162
+ if (p < 0)
163
+ (f.current - 1) * f.pageSize + p < 0 ? N.error("已经是第一个了") : T({
164
+ current: f.current - 1,
165
+ pageSize: f.pageSize,
166
+ type: "prev"
167
+ });
168
+ else {
169
+ M(p);
170
+ const d = a[p];
171
+ I(d);
172
+ }
173
+ n && G(n);
174
+ };
175
+ W(() => {
176
+ if (!u || !x || !g || !i)
177
+ return;
178
+ const e = ++re.current;
179
+ Ce(!0), r == null || r.getDatasetsIdVersionsVidSsamplesSid(x, g, i.id).then((t) => {
180
+ e === re.current && I(t);
181
+ }).finally(() => {
182
+ e === re.current && Ce(!1);
183
+ });
184
+ }, [u, i == null ? void 0 : i.id]);
185
+ const Re = () => z(void 0, null, function* () {
186
+ h === "attributeDefinition" && $.current && !(yield $.current.checkDirtyAndConfirm()) || h === "qaGeneration" && D.current && !(yield D.current.checkDirtyAndConfirm()) || J();
187
+ });
188
+ W(() => {
189
+ F.current && (F.current.width = F.current.offsetWidth, F.current.height = F.current.offsetHeight);
190
+ }, [F.current]);
191
+ const qe = () => z(void 0, null, function* () {
192
+ if (Z)
193
+ return;
194
+ if (L(!0), h === "qaGeneration" && D.current && !(yield D.current.checkDirtyAndConfirm())) {
195
+ L(!1);
196
+ return;
197
+ }
198
+ const e = C.current || i;
199
+ if (!e) {
200
+ L(!1);
201
+ return;
202
+ }
203
+ console.log("onPrevClick sampleToUse", e), h === "textAnnotation" && Y ? (ee(!0), R(e).then((t) => {
204
+ t ? (Q(void 0), ve(), V()) : N.error("保存失败");
205
+ }).finally(() => {
206
+ ee(!1), L(!1);
207
+ })) : (ve(), L(!1));
208
+ }), Me = () => z(void 0, null, function* () {
209
+ if (Z)
210
+ return;
211
+ if (L(!0), h === "qaGeneration" && D.current && !(yield D.current.checkDirtyAndConfirm())) {
212
+ L(!1);
213
+ return;
214
+ }
215
+ const e = C.current || i;
216
+ if (!e) {
217
+ L(!1);
218
+ return;
219
+ }
220
+ console.log("onNextClick sampleToUse", e), h === "textAnnotation" && Y ? (ee(!0), R(e).then((t) => {
221
+ t ? (Q(void 0), le(), V()) : N.error("保存失败");
222
+ }).finally(() => {
223
+ ee(!1), L(!1);
224
+ })) : (le(), L(!1));
225
+ });
226
+ W(() => {
227
+ C.current = i;
228
+ }, [i]);
229
+ const Te = (e) => (console.log("ocrRecognize apiUrl", E), Xe.post(`${E}/aishop/v2/infer?serviceId=Actpkb4pi3vxg`, {
230
+ pages: [{
231
+ image: e,
232
+ no: 0
233
+ }]
234
+ }, {
235
+ headers: {
236
+ Authorization: `Bearer ${q}`
237
+ }
238
+ }).then((t) => (console.log("ocrRecognize res", t.data.data), t.data.data.pages[0].layout.filter((a) => a.content))).catch((t) => {
239
+ console.error("ocrRecognize error", t);
240
+ })), Ue = () => z(void 0, null, function* () {
241
+ const e = C.current || i;
242
+ !e || !x || !g || ke.confirm({
243
+ title: "确认要删除此数据吗?",
244
+ content: "删除后不可恢复,请慎重操作",
245
+ onOk: () => z(void 0, null, function* () {
246
+ console.log("handleDeleteClick currentSample", e);
247
+ try {
248
+ yield r == null ? void 0 : r.delDatasetsIdVersionsVidSamplesId(x, g, e.id), N.success("删除成功"), o ? J() : G((t) => {
249
+ var d;
250
+ const n = t.findIndex((c) => c.id === e.id);
251
+ if (n === -1)
252
+ return t;
253
+ const a = [...t.slice(0, n), ...t.slice(n + 1)], p = f.pageSize || 1, s = Math.max(((d = f.total) != null ? d : t.length) - 1, 0), k = a.length === 0 && s > f.current * p;
254
+ if (T((c) => U(P(U({}, c), {
255
+ total: s
256
+ }), k ? {
257
+ current: c.current + 1,
258
+ pageSize: p,
259
+ type: "next"
260
+ } : {
261
+ type: k ? "next" : void 0
262
+ })), a.length) {
263
+ const c = Math.min(n, a.length - 1);
264
+ M(c), I(a[c]);
265
+ } else
266
+ M(-1), I(void 0);
267
+ return a;
268
+ }), V();
269
+ } catch (t) {
270
+ N.error("删除失败");
271
+ }
272
+ })
273
+ });
274
+ }), we = () => z(void 0, null, function* () {
275
+ if (!x || !g || !(i != null && i.id))
276
+ return;
277
+ const e = yield r == null ? void 0 : r.getDatasetsIdVersionsVidSsamplesSid(x, g, i.id);
278
+ e && (I(e), C.current = e);
279
+ });
280
+ return /* @__PURE__ */ l(ke, {
281
+ title: "标注",
282
+ width: "100%",
283
+ wrapClassName: "vlm-modal-wrap",
284
+ className: "vlm-modal",
285
+ open: u,
286
+ destroyOnClose: !0,
287
+ onCancel: () => Re(),
288
+ maskClosable: !1,
289
+ keyboard: !1,
290
+ centered: !0,
291
+ footer: h !== "attributeDefinition" ? /* @__PURE__ */ B("div", {
292
+ style: {
293
+ display: "flex",
294
+ justifyContent: "space-between",
295
+ alignItems: "center"
296
+ },
297
+ children: [/* @__PURE__ */ l("div", {
298
+ style: {
299
+ flex: 1
300
+ }
301
+ }), /* @__PURE__ */ B(Ae, {
302
+ size: 24,
303
+ children: [!o && (y == null ? void 0 : y.length) > 0 && /* @__PURE__ */ l(te, {
304
+ type: "default",
305
+ disabled: Se || ae || ye || Z,
306
+ onClick: qe,
307
+ children: "上一张"
308
+ }, "prev"), !o && (y == null ? void 0 : y.length) > 0 && /* @__PURE__ */ l(te, {
309
+ type: "default",
310
+ disabled: Se || ae || ye || Z,
311
+ onClick: Me,
312
+ children: "下一张"
313
+ }, "next")]
314
+ }), /* @__PURE__ */ l("div", {
315
+ style: {
316
+ flex: 1,
317
+ display: "flex",
318
+ justifyContent: "flex-end"
319
+ },
320
+ children: /* @__PURE__ */ l(Ae, {
321
+ children: h === "textAnnotation" && (y == null ? void 0 : y.length) > 0 ? /* @__PURE__ */ B(Ee, {
322
+ children: [/* @__PURE__ */ l(te, {
323
+ disabled: !i,
324
+ type: "primary",
325
+ onClick: () => {
326
+ const e = C.current || i;
327
+ e && (console.log("save currentSample", e), R(e).then((t) => z(void 0, null, function* () {
328
+ t ? (N.success("保存成功"), Q(void 0), o ? yield we() : le(), V()) : N.error("保存失败");
329
+ })));
330
+ },
331
+ children: "保存标注"
332
+ }, "save"), /* @__PURE__ */ l(te, {
333
+ type: "default",
334
+ onClick: Ue,
335
+ children: "删除数据"
336
+ })]
337
+ }) : null
338
+ })
339
+ })]
340
+ }) : null,
341
+ children: /* @__PURE__ */ B("div", {
342
+ className: "vlm-records-content",
343
+ children: [/* @__PURE__ */ l("div", {
344
+ className: "records-content-tabs-container",
345
+ children: !o && /* @__PURE__ */ B(de, {
346
+ className: "records-content-tabs",
347
+ activeKey: b,
348
+ onChange: (e) => z(void 0, null, function* () {
349
+ var n, a, p;
350
+ let t = !1;
351
+ if (!(h === "attributeDefinition" && $.current && (t = !!((a = (n = $.current).hasUnsavedChanges) != null && a.call(n)), !(yield $.current.checkDirtyAndConfirm()))) && !(h === "qaGeneration" && D.current && !(yield D.current.checkDirtyAndConfirm()))) {
352
+ if (h === "textAnnotation" && Y) {
353
+ const s = C.current || i;
354
+ if (s && R) {
355
+ if (!(yield R(s))) {
356
+ N.error("保存失败,已阻止切换筛选");
357
+ return;
358
+ }
359
+ I(s), C.current = s, Q(void 0), V == null || V(), !o && b === "nocode" && ((p = s == null ? void 0 : s.labels) != null && p.length) && (G([]), I(s), M(-1), O(s.id), T(P(U({}, f), {
360
+ current: 1,
361
+ total: void 0,
362
+ type: void 0
363
+ })), ie("hascode"));
364
+ }
365
+ }
366
+ t && Le(Date.now()), Ne(Date.now()), h !== "attributeDefinition" && (ce(!0), G([]), I(void 0), M(-1), O(void 0)), T(P(U({}, f), {
367
+ current: 1,
368
+ total: void 0,
369
+ type: void 0
370
+ })), ie(e);
371
+ }
372
+ }),
373
+ children: [/* @__PURE__ */ l(K, {
374
+ tab: `全部(${ue})`
375
+ }, ""), /* @__PURE__ */ l(K, {
376
+ tab: `未标注(${he})`
377
+ }, "nocode"), /* @__PURE__ */ l(K, {
378
+ tab: `已标注(${ue - he})`
379
+ }, "hascode")]
380
+ })
381
+ }), y != null && y.length ? /* @__PURE__ */ B("div", {
382
+ className: "sample-detail",
383
+ children: [/* @__PURE__ */ l("div", {
384
+ className: "content-mode-buttons",
385
+ children: /* @__PURE__ */ B(de, {
386
+ activeKey: h,
387
+ onChange: (e) => z(void 0, null, function* () {
388
+ var t;
389
+ if (!(h === "attributeDefinition" && $.current && !(yield $.current.checkDirtyAndConfirm())) && !(h === "qaGeneration" && D.current && !(yield D.current.checkDirtyAndConfirm()))) {
390
+ if (h === "textAnnotation" && R && Y && (C.current || i)) {
391
+ const n = C.current || i;
392
+ if (!(yield R(n))) {
393
+ N.error("保存失败,已阻止切换页签");
394
+ return;
395
+ }
396
+ I(n), C.current = n, Q(void 0), V == null || V(), !o && b === "nocode" && ((t = n == null ? void 0 : n.labels) != null && t.length) && (G([]), I(n), M(-1), O(n.id), T(P(U({}, f), {
397
+ current: 1,
398
+ total: void 0,
399
+ type: void 0
400
+ })), ie("hascode"));
401
+ }
402
+ e === "textAnnotation" && (i != null && i.id) && (yield we()), X(e);
403
+ }
404
+ }),
405
+ children: [/* @__PURE__ */ l(K, {
406
+ tab: "属性定义",
407
+ disabled: se
408
+ }, "attributeDefinition"), /* @__PURE__ */ l(K, {
409
+ tab: "文本标注",
410
+ disabled: se
411
+ }, "textAnnotation"), /* @__PURE__ */ l(K, {
412
+ tab: "QA生成",
413
+ disabled: se
414
+ }, "qaGeneration")]
415
+ })
416
+ }), h === "textAnnotation" && i && /* @__PURE__ */ l("div", {
417
+ className: "container",
418
+ children: /* @__PURE__ */ l(Je, {
419
+ sample: i,
420
+ labelDefinitions: oe,
421
+ onChange: (e) => {
422
+ console.log("VLMAnnotation onChange", e), C.current = e, Q(e);
423
+ },
424
+ ocrRecognize: Te
425
+ })
426
+ }), h === "attributeDefinition" && /* @__PURE__ */ l(He, {
427
+ ref: $,
428
+ datasetId: x,
429
+ versionId: g,
430
+ onAttributesChange: (e) => {
431
+ xe(e), e.length > 0 && oe.length === 0 && X("textAnnotation");
432
+ },
433
+ onLoadingChange: (e) => {
434
+ De(e);
435
+ }
436
+ }, `attribute-${Ve}`), h === "qaGeneration" && /* @__PURE__ */ l(We, {
437
+ ref: D,
438
+ sample: i,
439
+ labels: oe,
440
+ datasetId: x,
441
+ visionId: g
442
+ }, `qa-${ze}`)]
443
+ }) : ae ? /* @__PURE__ */ l("div", {
444
+ style: {
445
+ padding: "48px 0",
446
+ textAlign: "center"
447
+ },
448
+ children: /* @__PURE__ */ l(Fe, {})
449
+ }) : /* @__PURE__ */ l(Ke, {})]
450
+ })
451
+ });
452
+ };
453
+ export {
454
+ lt as default
455
+ };
@@ -0,0 +1,4 @@
1
+ const t = "";
2
+ export {
3
+ t as default
4
+ };
@@ -0,0 +1,149 @@
1
+ var N = (p, i, l) => new Promise((o, r) => {
2
+ var u = (e) => {
3
+ try {
4
+ s(l.next(e));
5
+ } catch (d) {
6
+ r(d);
7
+ }
8
+ }, h = (e) => {
9
+ try {
10
+ s(l.throw(e));
11
+ } catch (d) {
12
+ r(d);
13
+ }
14
+ }, s = (e) => e.done ? o(e.value) : Promise.resolve(e.value).then(u, h);
15
+ s((l = l.apply(p, i)).next());
16
+ });
17
+ import { jsxs as C, jsx as t } from "react/jsx-runtime";
18
+ import { useRef as x, useState as m, useContext as D, useEffect as A } from "react";
19
+ import { Modal as M, Button as f, Space as B, message as V } from "antd";
20
+ import "./style.less.mjs";
21
+ import { useKeyPress as I } from "ahooks";
22
+ import E from "../../../DatasetContext/index.mjs";
23
+ import K from "../../VLMAnnotation/index.mjs";
24
+ import S from "../../Iconfont/index.mjs";
25
+ const X = (p) => {
26
+ const {
27
+ isVlmModalVisible: i,
28
+ setIsVlmModalVisible: l,
29
+ record: o,
30
+ onNextClick: r,
31
+ onPrevClick: u,
32
+ listLoading: h = !1,
33
+ datasetId: s,
34
+ versionId: e,
35
+ ocrMarkTmpl: d,
36
+ handleMarkClick: w,
37
+ updateSampleList: L
38
+ } = p;
39
+ x(null);
40
+ const j = x({});
41
+ m("annotation");
42
+ const [a, R] = m();
43
+ m();
44
+ const [b, g] = m(!1), {
45
+ services: {
46
+ cvforceDatahub: n
47
+ },
48
+ featuresConfig: {
49
+ datasetManager: k
50
+ } = {
51
+ datasetManager: !1
52
+ }
53
+ } = D(E), c = !(b || h), v = () => {
54
+ c && u();
55
+ }, y = () => {
56
+ c && r();
57
+ };
58
+ I("rightarrow", () => {
59
+ y();
60
+ }), I("leftarrow", () => {
61
+ v();
62
+ }), A(() => {
63
+ i && s && e && (g(!0), n == null || n.getDatasetsIdVersionsVidSsamplesSid(s, e, o.id).then((z) => {
64
+ R(z);
65
+ }).finally(() => g(!1)));
66
+ }, [i, o]);
67
+ const O = () => {
68
+ l(!1);
69
+ }, P = () => {
70
+ M.confirm({
71
+ title: "确认要删除此数据吗?",
72
+ content: "删除后不可恢复,请慎重操作",
73
+ onOk: () => {
74
+ !s || !e || !(a != null && a.id) || n == null || n.delDatasetsIdVersionsVidSamplesId(s, e, a.id).then(() => {
75
+ V.success("删除成功"), l(!1), L();
76
+ }).catch(() => V.error("删除失败"));
77
+ }
78
+ });
79
+ };
80
+ return /* @__PURE__ */ C(M, {
81
+ title: /* @__PURE__ */ t("div", {
82
+ className: "vlm-sample-detail-title",
83
+ children: /* @__PURE__ */ t("span", {
84
+ children: "详情"
85
+ })
86
+ }),
87
+ width: "100%",
88
+ wrapClassName: "vlm-modal-wrap",
89
+ className: "vlm-modal",
90
+ open: i,
91
+ destroyOnClose: !0,
92
+ onCancel: () => O(),
93
+ maskClosable: !1,
94
+ centered: !0,
95
+ footer: null,
96
+ children: [/* @__PURE__ */ t("div", {
97
+ className: "vlm-detail",
98
+ children: /* @__PURE__ */ C("div", {
99
+ className: "detail-content",
100
+ children: [/* @__PURE__ */ t(f, {
101
+ className: "select-prev",
102
+ icon: /* @__PURE__ */ t(S, {
103
+ type: "icon-zuojiantou"
104
+ }),
105
+ type: "text",
106
+ disabled: !c,
107
+ onClick: () => v()
108
+ }), /* @__PURE__ */ t("div", {
109
+ className: "select-main",
110
+ ref: j,
111
+ children: a && /* @__PURE__ */ t(K, {
112
+ sample: a,
113
+ labelDefinitions: [],
114
+ hideRightSide: !0,
115
+ readOnly: !0,
116
+ ocrRecognize: () => N(void 0, null, function* () {
117
+ return [];
118
+ })
119
+ })
120
+ }), /* @__PURE__ */ t(f, {
121
+ className: "select-next",
122
+ icon: /* @__PURE__ */ t(S, {
123
+ type: "icon-youjiantou"
124
+ }),
125
+ type: "text",
126
+ disabled: !c,
127
+ onClick: () => y()
128
+ })]
129
+ })
130
+ }), /* @__PURE__ */ t("div", {
131
+ className: "vlm-mark-action",
132
+ children: /* @__PURE__ */ C(B, {
133
+ children: [/* @__PURE__ */ t(f, {
134
+ type: "primary",
135
+ onClick: () => w(a == null ? void 0 : a.id),
136
+ children: "标注"
137
+ }), k && k.delete && /* @__PURE__ */ t(f, {
138
+ danger: !0,
139
+ type: "ghost",
140
+ onClick: P,
141
+ children: "删除数据"
142
+ })]
143
+ })
144
+ })]
145
+ });
146
+ };
147
+ export {
148
+ X as default
149
+ };
@@ -0,0 +1,4 @@
1
+ const t = "";
2
+ export {
3
+ t as default
4
+ };