@glodon-aiot/dataset-annotation 3.25.1-alpha.3 → 3.25.1-alpha.5

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 (56) hide show
  1. package/dist/es/_virtual/_commonjsHelpers.mjs +8 -0
  2. package/dist/es/_virtual/dayjs.min.mjs +4 -0
  3. package/dist/es/components/OCRImageViewer/index.mjs +130 -117
  4. package/dist/es/components/VersionCompare/VersionCompareSelectModal/index.mjs +122 -0
  5. package/dist/es/components/VersionCompare/adapter.mjs +215 -0
  6. package/dist/es/components/VersionCompare/components/DataChangeStatsCard.mjs +68 -0
  7. package/dist/es/components/VersionCompare/components/DiffValue.mjs +31 -0
  8. package/dist/es/components/VersionCompare/components/LabelComparisonCard.mjs +130 -0
  9. package/dist/es/components/VersionCompare/components/ModifiedSampleCompareModal.mjs +207 -0
  10. package/dist/es/components/VersionCompare/components/SampleChangeDetailsCard.mjs +160 -0
  11. package/dist/es/components/VersionCompare/components/SingleSampleDetailModal.mjs +165 -0
  12. package/dist/es/components/VersionCompare/components/VersionCompareHeader.mjs +106 -0
  13. package/dist/es/components/VersionCompare/components/VersionOverviewCard.mjs +70 -0
  14. package/dist/es/components/VersionCompare/index.mjs +416 -0
  15. package/dist/es/components/VersionCompare/mock.mjs +571 -0
  16. package/dist/es/components/VersionCompare/style.less.mjs +4 -0
  17. package/dist/es/components/VersionCompare/utils/labelColors.mjs +45 -0
  18. package/dist/es/createDatasetVersionCompare/index.mjs +124 -0
  19. package/dist/es/index.mjs +21 -15
  20. package/dist/es/node_modules/dayjs/dayjs.min.mjs +324 -0
  21. package/dist/lib/index.js +37 -4
  22. package/dist/src/components/OCRImageViewer/index.d.ts +1 -0
  23. package/dist/src/components/VersionCompare/VersionCompareSelectModal/index.d.ts +16 -0
  24. package/dist/src/components/VersionCompare/adapter.d.ts +50 -0
  25. package/dist/src/components/VersionCompare/components/DataChangeStatsCard.d.ts +9 -0
  26. package/dist/src/components/VersionCompare/components/DiffValue.d.ts +23 -0
  27. package/dist/src/components/VersionCompare/components/LabelComparisonCard.d.ts +12 -0
  28. package/dist/src/components/VersionCompare/components/ModifiedSampleCompareModal.d.ts +48 -0
  29. package/dist/src/components/VersionCompare/components/SampleChangeDetailsCard.d.ts +21 -0
  30. package/dist/src/components/VersionCompare/components/SingleSampleDetailModal.d.ts +46 -0
  31. package/dist/src/components/VersionCompare/components/VersionCompareHeader.d.ts +13 -0
  32. package/dist/src/components/VersionCompare/components/VersionOverviewCard.d.ts +9 -0
  33. package/dist/src/components/VersionCompare/index.d.ts +34 -0
  34. package/dist/src/components/VersionCompare/mock.d.ts +25 -0
  35. package/dist/src/components/VersionCompare/types.d.ts +75 -0
  36. package/dist/src/components/VersionCompare/utils/labelColors.d.ts +13 -0
  37. package/dist/src/createDatasetVersionCompare/index.d.ts +26 -0
  38. package/dist/src/index.d.ts +6 -0
  39. package/package.json +2 -2
  40. package/dist/dataset-annotation.js +0 -123598
  41. package/dist/dataset-annotation.umd.cjs +0 -1017
  42. package/dist/example/DatasetAnnotationDemo.d.ts +0 -3
  43. package/dist/example/DemoTabs.d.ts +0 -3
  44. package/dist/example/DetectionDatasetDemo.d.ts +0 -5
  45. package/dist/example/DetectionImageDemo.d.ts +0 -5
  46. package/dist/example/OcrDatasetDemo.d.ts +0 -5
  47. package/dist/example/OcrImageDemo.d.ts +0 -5
  48. package/dist/example/OcrkvcDatasetDemo.d.ts +0 -5
  49. package/dist/example/constant.local.d.ts +0 -6
  50. package/dist/example/index.d.ts +0 -1
  51. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/ImageDetail/index.d.ts +0 -16
  52. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LabelEditorInput.d.ts +0 -12
  53. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LabelEditorItem.d.ts +0 -21
  54. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LableEditor.d.ts +0 -16
  55. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/index.d.ts +0 -19
  56. package/dist/src/utils/reactCompatibility.d.ts +0 -5
@@ -0,0 +1,215 @@
1
+ var h = (e, o, t) => new Promise((s, i) => {
2
+ var u = (a) => {
3
+ try {
4
+ r(t.next(a));
5
+ } catch (l) {
6
+ i(l);
7
+ }
8
+ }, c = (a) => {
9
+ try {
10
+ r(t.throw(a));
11
+ } catch (l) {
12
+ i(l);
13
+ }
14
+ }, r = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(u, c);
15
+ r((t = t.apply(e, o)).next());
16
+ });
17
+ import U from "../../node_modules/dayjs/dayjs.min.mjs";
18
+ import { buildCompareLabelColorMap as $, injectSampleLabelColors as X } from "./utils/labelColors.mjs";
19
+ import { getMockVersionCompareSummary as Z, getMockVersionCompareSamples as _ } from "./mock.mjs";
20
+ import { tagColors as g } from "../../utils/index.mjs";
21
+ const ee = (e) => {
22
+ if (!e)
23
+ return "-";
24
+ if (typeof e == "string") {
25
+ const t = U(e);
26
+ return t.isValid() ? t.format("YYYY-MM-DD HH:mm:ss") : e;
27
+ }
28
+ const o = e < 1e12 ? e * 1e3 : e;
29
+ return U(o).format("YYYY-MM-DD HH:mm:ss");
30
+ }, k = (e, o = []) => {
31
+ var b, n, m, p, f, V, d, S, I, N, T, x, D, M, v, B, L, Y, z, E, R, H, O, A, F;
32
+ const t = (n = (b = e == null ? void 0 : e.overview) == null ? void 0 : b.baseVersion) != null ? n : {
33
+ totalSampleCount: 0,
34
+ labeledSampleCount: 0,
35
+ totalBoxCount: 0
36
+ }, s = (p = (m = e == null ? void 0 : e.overview) == null ? void 0 : m.targetVersion) != null ? p : {
37
+ totalSampleCount: 0,
38
+ labeledSampleCount: 0,
39
+ totalBoxCount: 0
40
+ }, i = [{
41
+ key: "totalSampleCount",
42
+ metricLabel: "数据总量",
43
+ baseValue: (f = t.totalSampleCount) != null ? f : 0,
44
+ targetValue: (V = s.totalSampleCount) != null ? V : 0,
45
+ diff: ((d = s.totalSampleCount) != null ? d : 0) - ((S = t.totalSampleCount) != null ? S : 0)
46
+ }, {
47
+ key: "labeledSampleCount",
48
+ metricLabel: "已标注数据量",
49
+ baseValue: (I = t.labeledSampleCount) != null ? I : 0,
50
+ targetValue: (N = s.labeledSampleCount) != null ? N : 0,
51
+ diff: ((T = s.labeledSampleCount) != null ? T : 0) - ((x = t.labeledSampleCount) != null ? x : 0)
52
+ }, {
53
+ key: "totalBoxCount",
54
+ metricLabel: "标注框总数",
55
+ baseValue: (D = t.totalBoxCount) != null ? D : 0,
56
+ targetValue: (M = s.totalBoxCount) != null ? M : 0,
57
+ diff: ((v = s.totalBoxCount) != null ? v : 0) - ((B = t.totalBoxCount) != null ? B : 0)
58
+ }], u = (L = e == null ? void 0 : e.labelComparisons) != null ? L : [], c = [...u.map((C) => C.label), ...o], r = $(c), a = u.map((C, w) => {
59
+ var q, G, J, Q;
60
+ const K = (q = C.baseBoxCount) != null ? q : 0, j = (G = C.baseSampleCount) != null ? G : 0, P = (J = C.targetBoxCount) != null ? J : 0, W = (Q = C.targetSampleCount) != null ? Q : 0;
61
+ return {
62
+ label: C.label,
63
+ color: r.get(C.label) || g[w % g.length],
64
+ baseBoxCount: K,
65
+ baseSampleCount: j,
66
+ targetBoxCount: P,
67
+ targetSampleCount: W,
68
+ boxDiff: P - K,
69
+ sampleDiff: W - j
70
+ };
71
+ }), l = (e == null ? void 0 : e.markType) === "ocr" && (!(e != null && e.ocrMarkTmpl) || e.ocrMarkTmpl === "DetectionOCR");
72
+ return {
73
+ datasetId: e.datasetId,
74
+ datasetName: e.datasetName || "",
75
+ markType: e.markType || "detection",
76
+ ocrMarkTmpl: e.ocrMarkTmpl,
77
+ isOcrDetection: l,
78
+ baseVersionId: e.baseVersionId,
79
+ baseVersionNo: e.baseVersionNo || e.baseVersionId,
80
+ targetVersionId: e.targetVersionId,
81
+ targetVersionNo: e.targetVersionNo || e.targetVersionId,
82
+ compareTime: e.compareTime,
83
+ formattedCompareTime: ee(e.compareTime),
84
+ overview: {
85
+ baseVersion: t,
86
+ targetVersion: s
87
+ },
88
+ overviewRows: i,
89
+ changeStats: {
90
+ addedCount: (z = (Y = e == null ? void 0 : e.changeStats) == null ? void 0 : Y.addedCount) != null ? z : 0,
91
+ deletedCount: (R = (E = e == null ? void 0 : e.changeStats) == null ? void 0 : E.deletedCount) != null ? R : 0,
92
+ modifiedCount: (O = (H = e == null ? void 0 : e.changeStats) == null ? void 0 : H.modifiedCount) != null ? O : 0,
93
+ unchangedCount: (F = (A = e == null ? void 0 : e.changeStats) == null ? void 0 : A.unchangedCount) != null ? F : 0
94
+ },
95
+ labelComparisons: a,
96
+ labelColorMap: r,
97
+ taskId: e.taskId,
98
+ taskStatus: e.taskStatus,
99
+ progress: e.progress
100
+ };
101
+ }, te = (e, o) => {
102
+ var i, u, c, r, a, l, b, n, m, p;
103
+ const t = o != null ? o : $([], [e.sample, (i = e.baseSample) != null ? i : void 0]);
104
+ [e.baseSample, e.sample].forEach((f) => {
105
+ var V;
106
+ (V = f == null ? void 0 : f.labels) == null || V.forEach((d) => {
107
+ const S = (d.label || d.id || "").trim();
108
+ S && !t.has(S) && t.set(S, g[t.size % g.length]);
109
+ });
110
+ });
111
+ const s = ((c = (u = e.sample) == null ? void 0 : u.sampleFileName) == null ? void 0 : c.name) || ((r = e.sample) == null ? void 0 : r.fileName) || ((l = (a = e.sample) == null ? void 0 : a.metadata) == null ? void 0 : l.fileName) || ((n = (b = e.baseSample) == null ? void 0 : b.sampleFileName) == null ? void 0 : n.name) || ((m = e.baseSample) == null ? void 0 : m.fileName) || e.fileKey || "未命名图片";
112
+ return {
113
+ fileKey: e.fileKey,
114
+ changeType: e.changeType,
115
+ sample: e.sample,
116
+ baseSample: (p = e.baseSample) != null ? p : null,
117
+ displayFileName: s,
118
+ targetColorLabels: X(e.sample, t),
119
+ baseColorLabels: X(e.baseSample, t)
120
+ };
121
+ }, y = (e, o) => {
122
+ var s, i, u, c, r, a;
123
+ const t = (i = (s = e == null ? void 0 : e.recordList) != null ? s : e == null ? void 0 : e.items) != null ? i : [];
124
+ return {
125
+ items: t.map((l) => te(l, o)),
126
+ total: (c = (u = e == null ? void 0 : e.totalResults) != null ? u : e == null ? void 0 : e.total) != null ? c : t.length,
127
+ pageNo: (r = e == null ? void 0 : e.pageNo) != null ? r : 1,
128
+ pageSize: (a = e == null ? void 0 : e.pageSize) != null ? a : 20
129
+ };
130
+ }, re = (s, i, ...u) => h(void 0, [s, i, ...u], function* (e, o, t = {}) {
131
+ const {
132
+ cvforceDatahub: c,
133
+ useMock: r = !1,
134
+ fallbackToMockOnError: a = !1,
135
+ mockScene: l,
136
+ mockDatasetName: b
137
+ } = t;
138
+ if (r) {
139
+ const n = Z({
140
+ datasetId: e,
141
+ baseVersionId: o.baseVersionId,
142
+ targetVersionId: o.targetVersionId,
143
+ scene: l,
144
+ datasetName: b
145
+ });
146
+ return k(n);
147
+ }
148
+ if (!c)
149
+ throw new Error("版本对比缺少数据接口客户端");
150
+ try {
151
+ const n = yield c.getDatasetVersionCompareSummary(e, o);
152
+ return k(n);
153
+ } catch (n) {
154
+ if ((n == null ? void 0 : n.name) === "AbortError")
155
+ throw n;
156
+ if (a) {
157
+ const m = Z({
158
+ datasetId: e,
159
+ baseVersionId: o.baseVersionId,
160
+ targetVersionId: o.targetVersionId,
161
+ scene: l,
162
+ datasetName: b
163
+ });
164
+ return k(m);
165
+ }
166
+ throw n;
167
+ }
168
+ }), me = (i, u, c, ...r) => h(void 0, [i, u, c, ...r], function* (e, o, t, s = {}) {
169
+ const {
170
+ cvforceDatahub: a,
171
+ useMock: l = !1,
172
+ fallbackToMockOnError: b = !1,
173
+ mockScene: n
174
+ } = s;
175
+ if (l) {
176
+ const m = _({
177
+ datasetId: e,
178
+ baseVersionId: o.baseVersionId,
179
+ targetVersionId: o.targetVersionId,
180
+ changeType: o.changeType,
181
+ pageNo: o.pageNo,
182
+ pageSize: o.pageSize,
183
+ scene: n
184
+ });
185
+ return y(m, t);
186
+ }
187
+ if (!a)
188
+ throw new Error("版本对比缺少数据接口客户端");
189
+ try {
190
+ const m = yield a.getDatasetVersionCompareSamples(e, o);
191
+ return y(m, t);
192
+ } catch (m) {
193
+ if (b) {
194
+ const p = _({
195
+ datasetId: e,
196
+ baseVersionId: o.baseVersionId,
197
+ targetVersionId: o.targetVersionId,
198
+ changeType: o.changeType,
199
+ pageNo: o.pageNo,
200
+ pageSize: o.pageSize,
201
+ scene: n
202
+ });
203
+ return y(p, t);
204
+ }
205
+ throw m;
206
+ }
207
+ });
208
+ export {
209
+ te as adaptVersionCompareSampleItem,
210
+ y as adaptVersionCompareSamples,
211
+ k as adaptVersionCompareSummary,
212
+ me as fetchVersionCompareSamplesWithAdapter,
213
+ re as fetchVersionCompareSummaryWithAdapter,
214
+ ee as formatCompareTimestamp
215
+ };
@@ -0,0 +1,68 @@
1
+ import { jsxs as d, jsx as l } from "react/jsx-runtime";
2
+ import { Tooltip as m } from "antd";
3
+ import { InfoCircleOutlined as u } from "@ant-design/icons";
4
+ const b = (r) => {
5
+ var s, i, c, t;
6
+ const {
7
+ baseVersionNo: o,
8
+ targetVersionNo: v,
9
+ changeStats: e
10
+ } = r, n = [{
11
+ key: "added",
12
+ label: "新增图片数",
13
+ value: (s = e == null ? void 0 : e.addedCount) != null ? s : 0,
14
+ valueClassName: "is-added"
15
+ }, {
16
+ key: "deleted",
17
+ label: "删除图片数",
18
+ value: (i = e == null ? void 0 : e.deletedCount) != null ? i : 0,
19
+ valueClassName: "is-deleted"
20
+ }, {
21
+ key: "modified",
22
+ label: "修改图片数",
23
+ value: (c = e == null ? void 0 : e.modifiedCount) != null ? c : 0,
24
+ valueClassName: "is-modified"
25
+ }, {
26
+ key: "unchanged",
27
+ label: "无变动图片数",
28
+ value: (t = e == null ? void 0 : e.unchangedCount) != null ? t : 0,
29
+ valueClassName: "is-unchanged",
30
+ tooltip: "图片标注信息无变动"
31
+ }];
32
+ return /* @__PURE__ */ d("div", {
33
+ className: "vc-card vc-stats-card",
34
+ children: [/* @__PURE__ */ d("div", {
35
+ className: "vc-card-header",
36
+ children: [/* @__PURE__ */ l("h3", {
37
+ className: "vc-card-title",
38
+ children: "数据变动统计"
39
+ }), /* @__PURE__ */ d("span", {
40
+ className: "vc-card-subtitle",
41
+ children: ["(", o || "-", " → ", v || "-", ")"]
42
+ })]
43
+ }), /* @__PURE__ */ l("div", {
44
+ className: "vc-stats-grid",
45
+ children: n.map((a) => /* @__PURE__ */ d("div", {
46
+ className: "vc-stat-item-card",
47
+ children: [/* @__PURE__ */ d("div", {
48
+ className: "vc-stat-item-label",
49
+ children: [/* @__PURE__ */ l("span", {
50
+ children: a.label
51
+ }), a.tooltip && /* @__PURE__ */ l(m, {
52
+ title: a.tooltip,
53
+ children: /* @__PURE__ */ l(u, {
54
+ className: "vc-stat-info-icon",
55
+ "aria-label": "无变动说明"
56
+ })
57
+ })]
58
+ }), /* @__PURE__ */ l("div", {
59
+ className: `vc-stat-item-value ${a.valueClassName}`,
60
+ children: a.value
61
+ })]
62
+ }, a.key))
63
+ })]
64
+ });
65
+ };
66
+ export {
67
+ b as default
68
+ };
@@ -0,0 +1,31 @@
1
+ import { jsxs as p, jsx as t } from "react/jsx-runtime";
2
+ import o from "classnames";
3
+ const N = (d) => {
4
+ const {
5
+ value: a,
6
+ diff: i,
7
+ baseValue: f,
8
+ targetValue: e,
9
+ gap: l = 8,
10
+ className: n
11
+ } = d, c = a != null ? a : e, s = i !== void 0 ? i : e !== void 0 && f !== void 0 ? e - f : 0, r = s !== 0 && !Number.isNaN(s), m = s > 0 ? `+${s}` : `${s}`;
12
+ return /* @__PURE__ */ p("span", {
13
+ className: o("vc-diff-value-wrapper", n),
14
+ style: {
15
+ gap: l
16
+ },
17
+ children: [c !== void 0 && /* @__PURE__ */ t("span", {
18
+ className: "vc-diff-main-value",
19
+ children: c
20
+ }), r && /* @__PURE__ */ t("span", {
21
+ className: o("vc-diff-badge", {
22
+ "is-positive": s > 0,
23
+ "is-negative": s < 0
24
+ }),
25
+ children: m
26
+ })]
27
+ });
28
+ };
29
+ export {
30
+ N as default
31
+ };
@@ -0,0 +1,130 @@
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import r from "./DiffValue.mjs";
3
+ const p = (d) => {
4
+ const {
5
+ markType: t,
6
+ ocrMarkTmpl: s,
7
+ isOcrDetection: c,
8
+ baseVersionNo: i,
9
+ targetVersionNo: h,
10
+ labelComparisons: n
11
+ } = d;
12
+ return (c != null ? c : t === "ocr" && (!s || s === "DetectionOCR")) || t !== "detection" ? null : /* @__PURE__ */ a("div", {
13
+ className: "vc-card vc-label-compare-card",
14
+ children: [/* @__PURE__ */ e("div", {
15
+ className: "vc-card-header",
16
+ children: /* @__PURE__ */ e("h3", {
17
+ className: "vc-card-title",
18
+ children: "标签明细对比"
19
+ })
20
+ }), /* @__PURE__ */ e("div", {
21
+ className: "vc-table-container",
22
+ children: /* @__PURE__ */ a("table", {
23
+ className: "vc-standard-table",
24
+ children: [/* @__PURE__ */ a("thead", {
25
+ children: [/* @__PURE__ */ a("tr", {
26
+ children: [/* @__PURE__ */ e("th", {
27
+ rowSpan: 2,
28
+ style: {
29
+ width: "20%"
30
+ },
31
+ children: "标签名称"
32
+ }), /* @__PURE__ */ e("th", {
33
+ colSpan: 2,
34
+ className: "vc-th-center",
35
+ style: {
36
+ width: "40%"
37
+ },
38
+ children: /* @__PURE__ */ a("span", {
39
+ className: "vc-th-version-title",
40
+ children: [/* @__PURE__ */ e("span", {
41
+ className: "vc-th-version-no",
42
+ children: i || "-"
43
+ }), /* @__PURE__ */ e("span", {
44
+ className: "vc-th-version-desc",
45
+ children: "(基准版本)"
46
+ })]
47
+ })
48
+ }), /* @__PURE__ */ e("th", {
49
+ colSpan: 2,
50
+ className: "vc-th-center",
51
+ style: {
52
+ width: "40%"
53
+ },
54
+ children: /* @__PURE__ */ a("span", {
55
+ className: "vc-th-version-title",
56
+ children: [/* @__PURE__ */ e("span", {
57
+ className: "vc-th-version-no",
58
+ children: h || "-"
59
+ }), /* @__PURE__ */ e("span", {
60
+ className: "vc-th-version-desc",
61
+ children: "(目标版本)"
62
+ })]
63
+ })
64
+ })]
65
+ }), /* @__PURE__ */ a("tr", {
66
+ children: [/* @__PURE__ */ e("th", {
67
+ className: "vc-th-sub",
68
+ style: {
69
+ width: "20%"
70
+ },
71
+ children: "标注框数"
72
+ }), /* @__PURE__ */ e("th", {
73
+ className: "vc-th-sub",
74
+ style: {
75
+ width: "20%"
76
+ },
77
+ children: "图片数"
78
+ }), /* @__PURE__ */ e("th", {
79
+ className: "vc-th-sub",
80
+ style: {
81
+ width: "20%"
82
+ },
83
+ children: "标注框数"
84
+ }), /* @__PURE__ */ e("th", {
85
+ className: "vc-th-sub",
86
+ style: {
87
+ width: "20%"
88
+ },
89
+ children: "图片数"
90
+ })]
91
+ })]
92
+ }), /* @__PURE__ */ e("tbody", {
93
+ children: n.length > 0 ? n.map((l) => /* @__PURE__ */ a("tr", {
94
+ children: [/* @__PURE__ */ e("td", {
95
+ children: l.label
96
+ }), /* @__PURE__ */ e("td", {
97
+ children: l.baseBoxCount
98
+ }), /* @__PURE__ */ e("td", {
99
+ children: l.baseSampleCount
100
+ }), /* @__PURE__ */ e("td", {
101
+ children: /* @__PURE__ */ e(r, {
102
+ value: l.targetBoxCount,
103
+ diff: l.boxDiff,
104
+ gap: 16
105
+ })
106
+ }), /* @__PURE__ */ e("td", {
107
+ children: /* @__PURE__ */ e(r, {
108
+ value: l.targetSampleCount,
109
+ diff: l.sampleDiff,
110
+ gap: 16
111
+ })
112
+ })]
113
+ }, l.label)) : /* @__PURE__ */ e("tr", {
114
+ children: /* @__PURE__ */ e("td", {
115
+ colSpan: 5,
116
+ style: {
117
+ textAlign: "center",
118
+ color: "rgba(0, 0, 0, 0.45)"
119
+ },
120
+ children: "暂无标签对比数据"
121
+ })
122
+ })
123
+ })]
124
+ })
125
+ })]
126
+ });
127
+ };
128
+ export {
129
+ p as default
130
+ };
@@ -0,0 +1,207 @@
1
+ import { jsx as l, jsxs as d } from "react/jsx-runtime";
2
+ import { useState as b, useRef as fl, useEffect as E, useMemo as y } from "react";
3
+ import { Modal as hl, Tag as Nl, Button as w, Spin as D } from "antd";
4
+ import { useKeyPress as T } from "ahooks";
5
+ import S from "../../Iconfont/index.mjs";
6
+ import ll from "../../DetectionStatus/index.mjs";
7
+ import el from "../../DetectionAnnotation/components/LabelMaker/index.mjs";
8
+ import sl from "../../OCRImageViewer/index.mjs";
9
+ import { injectSampleLabelColors as I } from "../utils/labelColors.mjs";
10
+ const El = ({
11
+ open: t,
12
+ onCancel: al,
13
+ item: e,
14
+ isOcrDetection: u,
15
+ datasetId: L,
16
+ baseVersionId: z,
17
+ baseVersionNo: nl,
18
+ targetVersionId: k,
19
+ targetVersionNo: ol,
20
+ labelColorMap: v,
21
+ canPrev: bl,
22
+ canNext: Ll,
23
+ switching: P = !1,
24
+ onPrev: M,
25
+ onNext: A,
26
+ onImageReadyChange: g,
27
+ cvforceDatahub: m,
28
+ useMock: V = !1
29
+ }) => {
30
+ var J, Q, W, X, Y, Z;
31
+ const [U, q] = b(null), [x, B] = b(null), [j, F] = b(!1), [dl, h] = b(), [cl, N] = b(), C = fl(0);
32
+ E(() => {
33
+ t || (h(void 0), N(void 0));
34
+ }, [t]);
35
+ const n = (e == null ? void 0 : e.baseSample) || void 0, o = (e == null ? void 0 : e.sample) || void 0;
36
+ E(() => {
37
+ if (q(null), B(null), !t || !e) {
38
+ F(!1);
39
+ return;
40
+ }
41
+ const i = !V && !!(m != null && m.getDatasetsIdVersionsVidSsamplesSid) && !!L, _ = i && !!z && !!(n != null && n.id) && (!(n != null && n.fileUrl) || !Array.isArray(n == null ? void 0 : n.labels)), $ = i && !!k && !!(o != null && o.id) && (!(o != null && o.fileUrl) || !Array.isArray(o == null ? void 0 : o.labels));
42
+ if (!_ && !$) {
43
+ F(!1);
44
+ return;
45
+ }
46
+ const R = ++C.current;
47
+ F(!0), Promise.all([_ && (n != null && n.id) ? m.getDatasetsIdVersionsVidSsamplesSid(L, z, n.id).catch(() => null) : Promise.resolve(null), $ && (o != null && o.id) ? m.getDatasetsIdVersionsVidSsamplesSid(L, k, o.id).catch(() => null) : Promise.resolve(null)]).then(([p, O]) => {
48
+ R === C.current && (p && q(p), O && B(O));
49
+ }).finally(() => {
50
+ R === C.current && F(!1);
51
+ });
52
+ }, [t, e, n, o, V, m, L, z, k]);
53
+ const s = U || n, a = x || o, rl = y(() => {
54
+ var i;
55
+ return U ? I(U, v) : (i = e == null ? void 0 : e.baseColorLabels) != null && i.length ? e.baseColorLabels : I(s, v);
56
+ }, [U, e, s, v]), tl = y(() => {
57
+ var i;
58
+ return x ? I(x, v) : (i = e == null ? void 0 : e.targetColorLabels) != null && i.length ? e.targetColorLabels : I(a, v);
59
+ }, [x, e, a, v]), K = (e == null ? void 0 : e.displayFileName) || ((J = a == null ? void 0 : a.sampleFileName) == null ? void 0 : J.name) || (a == null ? void 0 : a.fileName) || ((Q = s == null ? void 0 : s.sampleFileName) == null ? void 0 : Q.name) || (s == null ? void 0 : s.fileName) || "-", c = (s == null ? void 0 : s.fileUrl) || (s == null ? void 0 : s.thumbnailUrl) || "", r = (a == null ? void 0 : a.fileUrl) || (a == null ? void 0 : a.thumbnailUrl) || "", il = (X = (W = s == null ? void 0 : s.labels) == null ? void 0 : W.length) != null ? X : 0, ul = (Z = (Y = a == null ? void 0 : a.labels) == null ? void 0 : Y.length) != null ? Z : 0, G = !!c && dl !== c, H = !!r && cl !== r, f = P || j || (G || H), vl = P || j || u && G, ml = P || j || u && H;
60
+ return E(() => {
61
+ g == null || g(t && !f && !!(c || r));
62
+ }, [t, f, c, r, g]), T("leftarrow", () => {
63
+ !t || f || M();
64
+ }), T("rightarrow", () => {
65
+ !t || f || A();
66
+ }), /* @__PURE__ */ l(hl, {
67
+ open: t,
68
+ onCancel: al,
69
+ footer: null,
70
+ centered: !0,
71
+ width: 1920,
72
+ destroyOnClose: !0,
73
+ wrapClassName: "vc-dual-detail-modal-wrap",
74
+ className: "vc-dual-detail-modal",
75
+ title: /* @__PURE__ */ d("div", {
76
+ className: "vc-detail-modal-header",
77
+ children: [/* @__PURE__ */ d("div", {
78
+ className: "vc-detail-modal-header-left",
79
+ children: [/* @__PURE__ */ l("span", {
80
+ className: "vc-detail-modal-title",
81
+ children: "图片详情"
82
+ }), /* @__PURE__ */ l(Nl, {
83
+ className: "vc-detail-change-tag is-modified",
84
+ children: "修改"
85
+ })]
86
+ }), /* @__PURE__ */ l("span", {
87
+ className: "vc-detail-modal-filename",
88
+ title: K,
89
+ children: K
90
+ })]
91
+ }),
92
+ children: /* @__PURE__ */ d("div", {
93
+ className: "vc-dual-detail-body",
94
+ children: [/* @__PURE__ */ l(w, {
95
+ className: "vc-detail-nav-btn select-prev",
96
+ icon: /* @__PURE__ */ l(S, {
97
+ type: "icon-zuojiantou"
98
+ }),
99
+ type: "text",
100
+ disabled: f,
101
+ onClick: M
102
+ }), /* @__PURE__ */ d("div", {
103
+ className: "vc-dual-detail-panels",
104
+ children: [/* @__PURE__ */ d("div", {
105
+ className: "vc-dual-version-panel",
106
+ children: [/* @__PURE__ */ d("div", {
107
+ className: "vc-dual-panel-header",
108
+ children: [/* @__PURE__ */ d("div", {
109
+ className: "vc-dual-panel-version-info",
110
+ children: [/* @__PURE__ */ l("span", {
111
+ className: "vc-dual-panel-version-no",
112
+ children: nl
113
+ }), /* @__PURE__ */ l("span", {
114
+ className: "vc-dual-panel-version-role",
115
+ children: "(基准版本)"
116
+ })]
117
+ }), u && /* @__PURE__ */ d("span", {
118
+ className: "vc-dual-panel-box-count",
119
+ children: ["标注框数量:", il]
120
+ })]
121
+ }), /* @__PURE__ */ d("div", {
122
+ className: "vc-dual-panel-canvas",
123
+ children: [s && /* @__PURE__ */ l("div", {
124
+ className: "vc-modal-detection-status",
125
+ children: /* @__PURE__ */ l(ll, {
126
+ sample: s
127
+ })
128
+ }), s && (u ? /* @__PURE__ */ l(sl, {
129
+ zoomMin: 0.1,
130
+ zoomMax: 10,
131
+ zoomStep: 0.1,
132
+ url: c,
133
+ labels: s.labels || [],
134
+ onImageLoad: () => h(c),
135
+ onImageError: () => h(c)
136
+ }, "vc-dual-ocr-base") : /* @__PURE__ */ l(el, {
137
+ disabled: !0,
138
+ isPreLabel: !0,
139
+ imageUrl: c,
140
+ labels: rl,
141
+ onImageLoad: () => h(c),
142
+ onImageError: () => h(c)
143
+ }, "vc-dual-det-base")), vl && /* @__PURE__ */ l("div", {
144
+ className: "vc-detail-loading-mask",
145
+ children: /* @__PURE__ */ l(D, {})
146
+ })]
147
+ })]
148
+ }), /* @__PURE__ */ d("div", {
149
+ className: "vc-dual-version-panel",
150
+ children: [/* @__PURE__ */ d("div", {
151
+ className: "vc-dual-panel-header",
152
+ children: [/* @__PURE__ */ d("div", {
153
+ className: "vc-dual-panel-version-info",
154
+ children: [/* @__PURE__ */ l("span", {
155
+ className: "vc-dual-panel-version-no",
156
+ children: ol
157
+ }), /* @__PURE__ */ l("span", {
158
+ className: "vc-dual-panel-version-role",
159
+ children: "(目标版本)"
160
+ })]
161
+ }), u && /* @__PURE__ */ d("span", {
162
+ className: "vc-dual-panel-box-count",
163
+ children: ["标注框数量:", ul]
164
+ })]
165
+ }), /* @__PURE__ */ d("div", {
166
+ className: "vc-dual-panel-canvas",
167
+ children: [a && /* @__PURE__ */ l("div", {
168
+ className: "vc-modal-detection-status",
169
+ children: /* @__PURE__ */ l(ll, {
170
+ sample: a
171
+ })
172
+ }), a && (u ? /* @__PURE__ */ l(sl, {
173
+ zoomMin: 0.1,
174
+ zoomMax: 10,
175
+ zoomStep: 0.1,
176
+ url: r,
177
+ labels: a.labels || [],
178
+ onImageLoad: () => N(r),
179
+ onImageError: () => N(r)
180
+ }, "vc-dual-ocr-target") : /* @__PURE__ */ l(el, {
181
+ disabled: !0,
182
+ isPreLabel: !0,
183
+ imageUrl: r,
184
+ labels: tl,
185
+ onImageLoad: () => N(r),
186
+ onImageError: () => N(r)
187
+ }, "vc-dual-det-target")), ml && /* @__PURE__ */ l("div", {
188
+ className: "vc-detail-loading-mask",
189
+ children: /* @__PURE__ */ l(D, {})
190
+ })]
191
+ })]
192
+ })]
193
+ }), /* @__PURE__ */ l(w, {
194
+ className: "vc-detail-nav-btn select-next",
195
+ icon: /* @__PURE__ */ l(S, {
196
+ type: "icon-youjiantou"
197
+ }),
198
+ type: "text",
199
+ disabled: f,
200
+ onClick: A
201
+ })]
202
+ })
203
+ });
204
+ };
205
+ export {
206
+ El as default
207
+ };