@glodon-aiot/dataset-annotation 3.17.0-beta.6 → 3.18.0-alpha.10
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.
- package/dist/es/components/ClassificationAnnotation/components/ClassificationImageModal/index.mjs +129 -0
- package/dist/es/components/ClassificationAnnotation/components/ClassificationImageModal/style.less.mjs +4 -0
- package/dist/es/components/ClassificationAnnotation/index.mjs +559 -0
- package/dist/es/components/ClassificationAnnotation/style.less.mjs +4 -0
- package/dist/es/components/ClassificationImageAnnotation/components/ClassificationImageDetail/index.mjs +273 -0
- package/dist/es/components/ClassificationImageAnnotation/components/ClassificationImageDetail/style.less.mjs +4 -0
- package/dist/es/components/ClassificationImageAnnotation/components/ClassificationLabelList/index.mjs +91 -0
- package/dist/es/components/ClassificationImageAnnotation/components/ClassificationLabelList/style.less.mjs +4 -0
- package/dist/es/components/ClassificationImageAnnotation/index.mjs +70 -0
- package/dist/es/components/ClassificationImageAnnotation/style.less.mjs +4 -0
- package/dist/es/components/PicZipImportModal/config.mjs +29 -18
- package/dist/es/components/PicZipImportModal/index.mjs +229 -226
- package/dist/es/components/VLMAnnotationDetail/VLMDetail/index.mjs +273 -264
- package/dist/es/createClassificationDatasetAnnotation/index.mjs +129 -0
- package/dist/es/createClassificationImageAnnotation/index.mjs +29 -0
- package/dist/es/index.mjs +17 -13
- package/dist/lib/index.js +4 -4
- package/dist/src/components/AnnotationCommon/Labels/index.d.ts +1 -0
- package/dist/src/components/AnnotationCommon/SampleStatus/index.d.ts +1 -0
- package/dist/src/components/ClassificationAnnotation/components/ClassificationImageModal/index.d.ts +34 -0
- package/dist/src/components/ClassificationAnnotation/index.d.ts +6 -0
- package/dist/src/components/ClassificationImageAnnotation/components/ClassificationImageDetail/index.d.ts +31 -0
- package/dist/src/components/ClassificationImageAnnotation/components/ClassificationLabelList/index.d.ts +23 -0
- package/dist/src/components/ClassificationImageAnnotation/index.d.ts +23 -0
- package/dist/src/components/ClassificationImageAnnotation/types.d.ts +6 -0
- package/dist/src/components/PicZipImportModal/config.d.ts +2 -1
- package/dist/src/createClassificationDatasetAnnotation/index.d.ts +16 -0
- package/dist/src/createClassificationImageAnnotation/index.d.ts +15 -0
- package/dist/src/index.d.ts +3 -0
- package/package.json +2 -2
package/dist/es/components/ClassificationAnnotation/components/ClassificationImageModal/index.mjs
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { jsxs as d, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as B } from "react";
|
|
3
|
+
import { Modal as H, Tabs as O, Space as R, Button as o } from "antd";
|
|
4
|
+
import { useKeyPress as y } from "ahooks";
|
|
5
|
+
import T from "../../../ClassificationImageAnnotation/components/ClassificationImageDetail/index.mjs";
|
|
6
|
+
import "./style.less.mjs";
|
|
7
|
+
import q from "../../../DataEmpty/index.mjs";
|
|
8
|
+
const X = (I) => {
|
|
9
|
+
const {
|
|
10
|
+
datasetId: u,
|
|
11
|
+
setIsImageDetailVisible: m,
|
|
12
|
+
isImageDetailVisible: f = !0,
|
|
13
|
+
currentSample: e,
|
|
14
|
+
onNextClick: a,
|
|
15
|
+
onPrevClick: t,
|
|
16
|
+
onSave: r,
|
|
17
|
+
onDeleteSample: h,
|
|
18
|
+
labels: w = [],
|
|
19
|
+
onRefresh: L,
|
|
20
|
+
onChange: v,
|
|
21
|
+
isPreLabel: C,
|
|
22
|
+
settingHide: D,
|
|
23
|
+
imgCount: N,
|
|
24
|
+
showLabelList: M = !0,
|
|
25
|
+
renderLabelItem: E,
|
|
26
|
+
onEnterEdit: g,
|
|
27
|
+
filterItems: b,
|
|
28
|
+
filterMode: j,
|
|
29
|
+
onFilterChange: n,
|
|
30
|
+
previewMode: s = !0,
|
|
31
|
+
canLabel: c = !1,
|
|
32
|
+
canDelete: p = !1
|
|
33
|
+
} = I, [l, K] = B(!1);
|
|
34
|
+
return y("rightarrow", () => {
|
|
35
|
+
s || a == null || a(e == null ? void 0 : e.confirmStatus);
|
|
36
|
+
}), y("leftarrow", () => {
|
|
37
|
+
s || t == null || t(e == null ? void 0 : e.confirmStatus);
|
|
38
|
+
}), /* @__PURE__ */ d(H, {
|
|
39
|
+
title: /* @__PURE__ */ i("div", {
|
|
40
|
+
className: "detection-sample-detail-title",
|
|
41
|
+
children: /* @__PURE__ */ i("span", {
|
|
42
|
+
children: s ? "详情" : "标注"
|
|
43
|
+
})
|
|
44
|
+
}),
|
|
45
|
+
width: "100%",
|
|
46
|
+
open: f,
|
|
47
|
+
onCancel: () => m(!1),
|
|
48
|
+
footer: null,
|
|
49
|
+
centered: !0,
|
|
50
|
+
wrapClassName: "detection-modal-wrap classification-modal-wrap",
|
|
51
|
+
className: "detection-modal classification-modal",
|
|
52
|
+
bodyStyle: {
|
|
53
|
+
padding: 0
|
|
54
|
+
},
|
|
55
|
+
destroyOnClose: !1,
|
|
56
|
+
children: [/* @__PURE__ */ i("div", {
|
|
57
|
+
className: "detail-tabs",
|
|
58
|
+
children: !s && b && /* @__PURE__ */ i(O, {
|
|
59
|
+
activeKey: j,
|
|
60
|
+
items: b,
|
|
61
|
+
onChange: (V) => n == null ? void 0 : n(V)
|
|
62
|
+
})
|
|
63
|
+
}), e ? /* @__PURE__ */ i(T, {
|
|
64
|
+
datasetId: u,
|
|
65
|
+
isImageDetailVisible: f,
|
|
66
|
+
setIsImageDetailVisible: m,
|
|
67
|
+
currentSample: e,
|
|
68
|
+
onNextClick: s ? () => a == null ? void 0 : a(e == null ? void 0 : e.confirmStatus) : void 0,
|
|
69
|
+
onPrevClick: s ? () => t == null ? void 0 : t(e == null ? void 0 : e.confirmStatus) : void 0,
|
|
70
|
+
labels: w,
|
|
71
|
+
onRefresh: L,
|
|
72
|
+
onChange: v,
|
|
73
|
+
isPreLabel: C,
|
|
74
|
+
settingHide: D,
|
|
75
|
+
imgCount: N,
|
|
76
|
+
readonly: s || !c,
|
|
77
|
+
showLabelList: s ? !1 : M,
|
|
78
|
+
renderLabelItem: E,
|
|
79
|
+
onLoadingChange: K
|
|
80
|
+
}) : /* @__PURE__ */ i(q, {}), e && /* @__PURE__ */ i("div", {
|
|
81
|
+
className: "detail-footer",
|
|
82
|
+
children: s ? /* @__PURE__ */ d(R, {
|
|
83
|
+
children: [g && c && /* @__PURE__ */ i("div", {
|
|
84
|
+
className: "detail-actions",
|
|
85
|
+
children: /* @__PURE__ */ i(o, {
|
|
86
|
+
type: "primary",
|
|
87
|
+
onClick: g,
|
|
88
|
+
children: "标注"
|
|
89
|
+
})
|
|
90
|
+
}), p && /* @__PURE__ */ i(o, {
|
|
91
|
+
danger: !0,
|
|
92
|
+
onClick: h,
|
|
93
|
+
children: "删除数据"
|
|
94
|
+
})]
|
|
95
|
+
}) : /* @__PURE__ */ d("div", {
|
|
96
|
+
className: "footer-bar",
|
|
97
|
+
children: [/* @__PURE__ */ i("div", {
|
|
98
|
+
className: "footer-left"
|
|
99
|
+
}), /* @__PURE__ */ d("div", {
|
|
100
|
+
className: "footer-center",
|
|
101
|
+
children: [/* @__PURE__ */ i(o, {
|
|
102
|
+
onClick: () => t == null ? void 0 : t(e == null ? void 0 : e.confirmStatus),
|
|
103
|
+
disabled: l,
|
|
104
|
+
children: "上一张"
|
|
105
|
+
}), /* @__PURE__ */ i(o, {
|
|
106
|
+
onClick: () => a == null ? void 0 : a(e == null ? void 0 : e.confirmStatus),
|
|
107
|
+
disabled: l,
|
|
108
|
+
children: "下一张"
|
|
109
|
+
})]
|
|
110
|
+
}), /* @__PURE__ */ d("div", {
|
|
111
|
+
className: "footer-right",
|
|
112
|
+
children: [c && /* @__PURE__ */ i(o, {
|
|
113
|
+
type: "primary",
|
|
114
|
+
onClick: () => r == null ? void 0 : r(),
|
|
115
|
+
disabled: l,
|
|
116
|
+
children: "保存标注"
|
|
117
|
+
}), p && /* @__PURE__ */ i(o, {
|
|
118
|
+
onClick: h,
|
|
119
|
+
disabled: l,
|
|
120
|
+
children: "删除数据"
|
|
121
|
+
})]
|
|
122
|
+
})]
|
|
123
|
+
})
|
|
124
|
+
})]
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
export {
|
|
128
|
+
X as default
|
|
129
|
+
};
|
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
var tt = Object.defineProperty, ot = Object.defineProperties;
|
|
2
|
+
var lt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var Ne = Object.getOwnPropertySymbols;
|
|
4
|
+
var it = Object.prototype.hasOwnProperty, nt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var ke = (V, c, i) => c in V ? tt(V, c, { enumerable: !0, configurable: !0, writable: !0, value: i }) : V[c] = i, u = (V, c) => {
|
|
6
|
+
for (var i in c || (c = {}))
|
|
7
|
+
it.call(c, i) && ke(V, i, c[i]);
|
|
8
|
+
if (Ne)
|
|
9
|
+
for (var i of Ne(c))
|
|
10
|
+
nt.call(c, i) && ke(V, i, c[i]);
|
|
11
|
+
return V;
|
|
12
|
+
}, h = (V, c) => ot(V, lt(c));
|
|
13
|
+
import { jsx as n, jsxs as E } from "react/jsx-runtime";
|
|
14
|
+
import { useRef as se, useState as a, useEffect as D } from "react";
|
|
15
|
+
import { message as j, ConfigProvider as rt, Space as ce, Select as st, Button as Te, Tabs as ct, Col as at, Tooltip as dt, Empty as we, Spin as Ee, Modal as ft } from "antd";
|
|
16
|
+
import ut from "rc-virtual-list";
|
|
17
|
+
import { UploadZipsStatus as Y } from "@glodon-aiot/apis";
|
|
18
|
+
import ht from "antd/es/locale/zh_CN";
|
|
19
|
+
import mt from "../../DatasetContext/index.mjs";
|
|
20
|
+
import bt from "../DetectionAnnotation/icon_item_empty.svg.mjs";
|
|
21
|
+
import "./style.less.mjs";
|
|
22
|
+
import { tagColors as Me } from "../../utils/index.mjs";
|
|
23
|
+
import { useKeyPress as gt } from "ahooks";
|
|
24
|
+
import { SearchOutlined as vt } from "@ant-design/icons";
|
|
25
|
+
import pt from "../../Common/Page/index.mjs";
|
|
26
|
+
import Ct from "../PageNav/index.mjs";
|
|
27
|
+
import It from "../Thumbnail/index.mjs";
|
|
28
|
+
import xt from "../CompositionInput/index.mjs";
|
|
29
|
+
import St from "lodash/merge";
|
|
30
|
+
import { DEFAULT_FILTER_SWITCH as yt } from "../../constant.mjs";
|
|
31
|
+
import Lt from "../DetectionStatus/index.mjs";
|
|
32
|
+
import Dt from "./components/ClassificationImageModal/index.mjs";
|
|
33
|
+
import Vt from "../DetectionAnnotation/components/Labels/index.mjs";
|
|
34
|
+
import Nt from "../PicZipImportModal/index.mjs";
|
|
35
|
+
import { Prompt as kt } from "../hooks/Prompt.mjs";
|
|
36
|
+
const Yt = (V) => {
|
|
37
|
+
var Le, De;
|
|
38
|
+
const {
|
|
39
|
+
services: c,
|
|
40
|
+
datasetId: i,
|
|
41
|
+
versionId: ee,
|
|
42
|
+
backTo: Re,
|
|
43
|
+
labelManager: ae = !1,
|
|
44
|
+
datasetManager: T = !1,
|
|
45
|
+
annotation: Ae,
|
|
46
|
+
header: m = {
|
|
47
|
+
versionSelect: !1
|
|
48
|
+
}
|
|
49
|
+
} = V, q = St(u({}, yt), V.filterSwitch), _ = se(null), te = se(null), [C, ze] = a(), [l, G] = a(), [oe, Fe] = a([]), [de, fe] = a(!1), [H, Pe] = a(0), [J, Be] = a(0), [d, le] = a(""), [A, He] = a(0), [w, ue] = a([]), [b, ie] = a([]), [he, K] = a(!1), [U, z] = a(!1), [M, v] = a(-1), [I, p] = a(), [x, y] = a(), [S, N] = a({
|
|
50
|
+
current: 0,
|
|
51
|
+
pageSize: 100
|
|
52
|
+
}), [O, ne] = a([]), [Z, Ke] = a(""), [Ue, Oe] = a(), F = se({}), [Ze, We] = a(), [me, be] = a(!1), [ge, $e] = a(!1), [ve, je] = a(!0), [qe, _e] = a(!1), [W, Ge] = a(""), pe = () => {
|
|
53
|
+
p(void 0), y(void 0), v(-1), K(!1), Q(), setTimeout(() => {
|
|
54
|
+
N((e) => h(u({}, e), {
|
|
55
|
+
current: 1,
|
|
56
|
+
type: void 0
|
|
57
|
+
}));
|
|
58
|
+
}, 10);
|
|
59
|
+
};
|
|
60
|
+
gt("Esc", pe), D(() => {
|
|
61
|
+
i && c.cvforceDatahub.getS3Iam(i).then((e) => {
|
|
62
|
+
We(e);
|
|
63
|
+
});
|
|
64
|
+
}, [i, c.cvforceDatahub]), D(() => {
|
|
65
|
+
c.cvforceDatahub && c.cvforceDatahub.getOptionsImgproxy().then((e) => Oe(e));
|
|
66
|
+
}, [c.cvforceDatahub]), D(() => {
|
|
67
|
+
i && (fe(!0), Promise.all([c.cvforceDatahub.getDatasetsId(i).then(ze), c.cvforceDatahub.getDatasetsIdVersions(i, 1, 1e3).then((e) => {
|
|
68
|
+
Fe(e.recordList), G(ee ? e.recordList.find((t) => t.id === ee) : e.recordList[0]);
|
|
69
|
+
})]).finally(() => fe(!1)));
|
|
70
|
+
}, [i, ee]), D(() => {
|
|
71
|
+
k();
|
|
72
|
+
}, [l == null ? void 0 : l.id, Z]), D(() => {
|
|
73
|
+
Q();
|
|
74
|
+
}, [l, d]), D(() => {
|
|
75
|
+
!l || !C || $(h(u({}, S), {
|
|
76
|
+
current: 1
|
|
77
|
+
}));
|
|
78
|
+
}, [C == null ? void 0 : C.id, l == null ? void 0 : l.id, O, Z]), D(() => {
|
|
79
|
+
$().then(() => {
|
|
80
|
+
}), k();
|
|
81
|
+
}, [S.current]), D(() => {
|
|
82
|
+
U || (p(void 0), y(void 0), K(!1), v(-1), Q(), k());
|
|
83
|
+
}, [U]), D(() => {
|
|
84
|
+
!l || !C || $(h(u({}, S), {
|
|
85
|
+
current: 1,
|
|
86
|
+
total: void 0
|
|
87
|
+
})).then((e) => {
|
|
88
|
+
if (!(!e || !Array.isArray(e)) && !(!I && !U))
|
|
89
|
+
if (e.length > 0) {
|
|
90
|
+
const t = F.current[d], o = t !== void 0 && t >= 0 && t < e.length ? t : 0;
|
|
91
|
+
v(o), p(e[o]), y(void 0);
|
|
92
|
+
} else
|
|
93
|
+
p(void 0), y(void 0), v(-1), N((t) => h(u({}, t), {
|
|
94
|
+
current: 1
|
|
95
|
+
}));
|
|
96
|
+
});
|
|
97
|
+
}, [d]), D(() => {
|
|
98
|
+
N(d === "nocode" ? (e) => h(u({}, e), {
|
|
99
|
+
total: H
|
|
100
|
+
}) : d === "" ? (e) => h(u({}, e), {
|
|
101
|
+
total: A
|
|
102
|
+
}) : d === "pending" ? (e) => h(u({}, e), {
|
|
103
|
+
total: J
|
|
104
|
+
}) : (e) => h(u({}, e), {
|
|
105
|
+
total: A - H - J
|
|
106
|
+
}));
|
|
107
|
+
}, [H, A, J]);
|
|
108
|
+
const Ce = () => {
|
|
109
|
+
var e, t;
|
|
110
|
+
(t = (e = _.current) == null ? void 0 : e.getElementsByClassName("rc-virtual-list-holder")[0]) == null || t.scrollTo({
|
|
111
|
+
top: 0
|
|
112
|
+
});
|
|
113
|
+
}, Ie = () => {
|
|
114
|
+
!i || !l || c.cvforceDatahub.getDatasetsIdVersionsVid(i, l.id).then((e) => {
|
|
115
|
+
var t, o;
|
|
116
|
+
G(e), Ge((o = (t = e.versionAsyncTask) == null ? void 0 : t.state) != null ? o : "");
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
D(() => {
|
|
120
|
+
W !== Y.Pending && W !== Y.Started || j.warning("文件导入中,请刷新页面再试");
|
|
121
|
+
}, [W]), D(() => {
|
|
122
|
+
_e(!ve && ge);
|
|
123
|
+
}, [ve, ge]), D(() => {
|
|
124
|
+
i && (l != null && l.id) && Ie();
|
|
125
|
+
}, [i, l == null ? void 0 : l.id]);
|
|
126
|
+
const k = () => {
|
|
127
|
+
!i || !l || c.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(i, l.id, {
|
|
128
|
+
label: "allcode",
|
|
129
|
+
searchName: Z
|
|
130
|
+
}).then((e) => {
|
|
131
|
+
var s, g, L;
|
|
132
|
+
const t = e == null ? void 0 : e.find((f) => f.id === "allcodeid"), o = e == null ? void 0 : e.find((f) => f.id === "nocodeid"), r = e == null ? void 0 : e.find((f) => f.id === "pendingid");
|
|
133
|
+
He((s = t == null ? void 0 : t.count) != null ? s : 0), Pe((g = o == null ? void 0 : o.count) != null ? g : 0), Be((L = r == null ? void 0 : r.count) != null ? L : 0);
|
|
134
|
+
});
|
|
135
|
+
}, Q = () => {
|
|
136
|
+
if (!(!i || !(l != null && l.id)))
|
|
137
|
+
return c.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(i, l.id, {}).then((e) => {
|
|
138
|
+
const o = (e || []).filter((r) => r.label !== "nocode").map((r, s) => ({
|
|
139
|
+
label: r.label,
|
|
140
|
+
count: r.count,
|
|
141
|
+
id: r.id,
|
|
142
|
+
color: Me[s % 40]
|
|
143
|
+
}));
|
|
144
|
+
return ue(o), e;
|
|
145
|
+
});
|
|
146
|
+
}, $ = (e, t) => {
|
|
147
|
+
const o = (e == null ? void 0 : e.current) || S.current, r = (e == null ? void 0 : e.pageSize) || S.pageSize;
|
|
148
|
+
if (!i || !l || !o)
|
|
149
|
+
return Promise.resolve(!1);
|
|
150
|
+
const s = O.map((L) => L.label), g = () => {
|
|
151
|
+
switch (d) {
|
|
152
|
+
case "nocode":
|
|
153
|
+
return "nocode";
|
|
154
|
+
case "hascode":
|
|
155
|
+
return s.length ? s : "hascode";
|
|
156
|
+
default:
|
|
157
|
+
return s.length ? s : void 0;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
return o === 1 && Ce(), N((L) => h(u({}, L), {
|
|
161
|
+
current: o,
|
|
162
|
+
pageSize: r
|
|
163
|
+
})), c.cvforceDatahub.getDatasetsIdVersionsVidSamples(i, l.id, {
|
|
164
|
+
pageNo: o,
|
|
165
|
+
pageSize: r,
|
|
166
|
+
labels: g(),
|
|
167
|
+
searchName: Z
|
|
168
|
+
}).then((L) => {
|
|
169
|
+
const f = L.recordList || [], R = o === 1 ? f : [...t || b, ...f];
|
|
170
|
+
return ie(R), N((X) => h(u({}, X), {
|
|
171
|
+
current: o,
|
|
172
|
+
pageSize: r,
|
|
173
|
+
total: L.totalResults
|
|
174
|
+
})), (e == null ? void 0 : e.type) === "next" && f.length && (v(0), p(f[0])), (e == null ? void 0 : e.type) === "prev" && f.length && (v(r - 1), p(f[f.length - 1])), he && M < 0 && f.length && (v(0), p(f[0]), z(!0)), R;
|
|
175
|
+
}).catch(() => !1);
|
|
176
|
+
}, Je = (e) => {
|
|
177
|
+
b && (K(!1), v(e), p(b[e]), y(void 0), z(!0), d !== void 0 && (F.current[d] = e));
|
|
178
|
+
};
|
|
179
|
+
D(() => {
|
|
180
|
+
var t, o, r;
|
|
181
|
+
if (!x)
|
|
182
|
+
return;
|
|
183
|
+
const e = [];
|
|
184
|
+
(t = x.labels) == null || t.forEach((s) => {
|
|
185
|
+
w != null && w.find((g) => g.id === s.id) && e.push(s);
|
|
186
|
+
}), e.length !== ((r = (o = x.labels) == null ? void 0 : o.length) != null ? r : 0) && y(h(u({}, x), {
|
|
187
|
+
labels: e
|
|
188
|
+
}));
|
|
189
|
+
}, [w]);
|
|
190
|
+
const re = () => {
|
|
191
|
+
if (!l)
|
|
192
|
+
return Promise.resolve(!1);
|
|
193
|
+
const e = x != null ? x : I;
|
|
194
|
+
if (!e || !x)
|
|
195
|
+
return Promise.resolve(!0);
|
|
196
|
+
const t = (I == null ? void 0 : I.labels) || [], o = (x.labels || []).filter((s) => !!s.id);
|
|
197
|
+
if (t.length === o.length && o.every((s, g) => {
|
|
198
|
+
var L;
|
|
199
|
+
return ((L = t[g]) == null ? void 0 : L.id) === s.id;
|
|
200
|
+
}))
|
|
201
|
+
return Promise.resolve(!0);
|
|
202
|
+
const r = h(u({}, e), {
|
|
203
|
+
labels: o.map((s) => {
|
|
204
|
+
var g;
|
|
205
|
+
return h(u({}, s), {
|
|
206
|
+
box: (g = s.box) != null ? g : []
|
|
207
|
+
});
|
|
208
|
+
}),
|
|
209
|
+
isLabeled: o.length > 0
|
|
210
|
+
});
|
|
211
|
+
return c.cvforceDatahub.updateSamples(i, l.id, [r]).then(() => {
|
|
212
|
+
var g, L;
|
|
213
|
+
j.success({
|
|
214
|
+
content: "保存成功"
|
|
215
|
+
});
|
|
216
|
+
const s = d === "nocode" && ((g = r.labels) == null ? void 0 : g.length) || d === "hascode" && !((L = r.labels) != null && L.length);
|
|
217
|
+
return ie((f) => {
|
|
218
|
+
const R = f.findIndex((P) => P.id === r.id);
|
|
219
|
+
if (R === -1)
|
|
220
|
+
return f;
|
|
221
|
+
if (s) {
|
|
222
|
+
const P = f.slice(0, R).concat(f.slice(R + 1));
|
|
223
|
+
if (N((B) => h(u({}, B), {
|
|
224
|
+
total: B.total != null ? Math.max(0, B.total - 1) : void 0
|
|
225
|
+
})), P.length === 0)
|
|
226
|
+
p(void 0), y(void 0), v(-1), z(!1);
|
|
227
|
+
else {
|
|
228
|
+
const B = Math.min(M, P.length - 1), Ve = P[B];
|
|
229
|
+
Ve != null && (p(Ve), v(B), y(void 0));
|
|
230
|
+
}
|
|
231
|
+
return P;
|
|
232
|
+
}
|
|
233
|
+
const X = [...f];
|
|
234
|
+
return X[R] = r, X;
|
|
235
|
+
}), s || (p(r), y(r)), !0;
|
|
236
|
+
}).catch(() => !1);
|
|
237
|
+
}, xe = () => {
|
|
238
|
+
b && re().then((e) => {
|
|
239
|
+
if (!e)
|
|
240
|
+
return;
|
|
241
|
+
k();
|
|
242
|
+
const t = M + 1;
|
|
243
|
+
t >= b.length ? S.total != null && t >= S.total ? j.error("已经是最后一个了") : $({
|
|
244
|
+
current: S.current + 1,
|
|
245
|
+
pageSize: S.pageSize,
|
|
246
|
+
type: "next"
|
|
247
|
+
}, b).then((o) => {
|
|
248
|
+
Array.isArray(o) && (v(t), p(o[t]), y(void 0), d !== void 0 && (F.current[d] = t));
|
|
249
|
+
}) : setTimeout(() => {
|
|
250
|
+
v(t), p(b[t]), y(void 0), d !== void 0 && (F.current[d] = t);
|
|
251
|
+
}, 200);
|
|
252
|
+
});
|
|
253
|
+
}, Qe = () => {
|
|
254
|
+
b && re().then((e) => {
|
|
255
|
+
if (!e)
|
|
256
|
+
return;
|
|
257
|
+
k();
|
|
258
|
+
const t = M - 1;
|
|
259
|
+
t < 0 ? j.error("已经是第一个了") : setTimeout(() => {
|
|
260
|
+
v(t), p(b[t]), y(void 0), d !== void 0 && (F.current[d] = t);
|
|
261
|
+
}, 200);
|
|
262
|
+
});
|
|
263
|
+
}, Xe = () => {
|
|
264
|
+
var e;
|
|
265
|
+
if ((e = x == null ? void 0 : x.labels) != null && e.some((t) => !t.id))
|
|
266
|
+
return j.error("请选择标签"), Promise.resolve(!1);
|
|
267
|
+
xe();
|
|
268
|
+
}, Ye = () => {
|
|
269
|
+
ft.confirm({
|
|
270
|
+
title: "确认要删除当前数据吗?",
|
|
271
|
+
content: "数据包含当前标注的内容和图片,删除后无法恢复,请确认是否删除!",
|
|
272
|
+
onOk: () => {
|
|
273
|
+
!I || !l || c.cvforceDatahub.delDatasetsIdVersionsVidSamplesId(i, l.id, I.id).then(() => {
|
|
274
|
+
const e = b.findIndex((o) => o.id === I.id), t = [...b];
|
|
275
|
+
if (t.splice(e, 1), ie(t), N((o) => h(u({}, o), {
|
|
276
|
+
total: o.total != null ? o.total - 1 : 0
|
|
277
|
+
})), t.length > 0) {
|
|
278
|
+
const o = e < t.length ? e : e - 1;
|
|
279
|
+
p(t[o]), v(o);
|
|
280
|
+
} else
|
|
281
|
+
p(void 0), y(void 0), v(-1), z(!1), N((o) => h(u({}, o), {
|
|
282
|
+
current: 1
|
|
283
|
+
}));
|
|
284
|
+
y(void 0), k();
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}, Se = (e) => {
|
|
289
|
+
M >= 0 && d !== void 0 && d !== null && (F.current[d] = M), x ? re().then((t) => {
|
|
290
|
+
t && (le(e), k());
|
|
291
|
+
}) : (N((t) => h(u({}, t), {
|
|
292
|
+
current: 1,
|
|
293
|
+
total: void 0
|
|
294
|
+
})), le(e)), e === "nocode" && ne([]);
|
|
295
|
+
}, ye = [{
|
|
296
|
+
key: "",
|
|
297
|
+
label: `全部(${A})`,
|
|
298
|
+
children: null
|
|
299
|
+
}, {
|
|
300
|
+
key: "nocode",
|
|
301
|
+
label: `未标注(${H})`,
|
|
302
|
+
children: null
|
|
303
|
+
}, {
|
|
304
|
+
key: "hascode",
|
|
305
|
+
label: `已标注(${A - H - J})`,
|
|
306
|
+
children: null
|
|
307
|
+
}], et = (e) => {
|
|
308
|
+
var o;
|
|
309
|
+
const t = e.currentTarget;
|
|
310
|
+
(S.total == null || S.total > b.length) && t.scrollHeight - t.scrollTop === ((o = _.current) == null ? void 0 : o.clientHeight) && N((r) => h(u({}, r), {
|
|
311
|
+
current: r.current + 1
|
|
312
|
+
}));
|
|
313
|
+
};
|
|
314
|
+
return /* @__PURE__ */ n(rt, {
|
|
315
|
+
locale: ht,
|
|
316
|
+
children: /* @__PURE__ */ n(mt.Provider, {
|
|
317
|
+
value: {
|
|
318
|
+
datasetId: i,
|
|
319
|
+
versionId: (l == null ? void 0 : l.id) || "",
|
|
320
|
+
no: (l == null ? void 0 : l.no) || "",
|
|
321
|
+
loading: de,
|
|
322
|
+
version: l,
|
|
323
|
+
versions: oe,
|
|
324
|
+
samples: b,
|
|
325
|
+
pagination: S,
|
|
326
|
+
services: c,
|
|
327
|
+
featuresConfig: {
|
|
328
|
+
labelManager: ae,
|
|
329
|
+
datasetManager: T,
|
|
330
|
+
annotation: Ae,
|
|
331
|
+
filterSwitch: q,
|
|
332
|
+
header: m,
|
|
333
|
+
exampleSrcRoot: V.exampleSrcRoot
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
children: C ? C.markType === "classification" ? /* @__PURE__ */ n("div", {
|
|
337
|
+
className: "classification-version-detail",
|
|
338
|
+
children: /* @__PURE__ */ E(pt, {
|
|
339
|
+
className: "product-details-page",
|
|
340
|
+
header: m !== !1 ? /* @__PURE__ */ n(Ct, {
|
|
341
|
+
backTo: Re,
|
|
342
|
+
onBackClick: m != null && m.onBackClick ? () => {
|
|
343
|
+
var e;
|
|
344
|
+
I && pe(), (e = m == null ? void 0 : m.onBackClick) == null || e.call(m);
|
|
345
|
+
} : void 0,
|
|
346
|
+
left: !de && /* @__PURE__ */ E(ce, {
|
|
347
|
+
children: [/* @__PURE__ */ n("span", {
|
|
348
|
+
style: {
|
|
349
|
+
fontWeight: "bold"
|
|
350
|
+
},
|
|
351
|
+
children: C == null ? void 0 : C.name
|
|
352
|
+
}), /* @__PURE__ */ n(st, {
|
|
353
|
+
disabled: (m == null ? void 0 : m.versionSelect) === !1,
|
|
354
|
+
value: l == null ? void 0 : l.id,
|
|
355
|
+
style: {
|
|
356
|
+
width: 70
|
|
357
|
+
},
|
|
358
|
+
options: oe.map((e) => ({
|
|
359
|
+
label: e.no,
|
|
360
|
+
value: e.id
|
|
361
|
+
})),
|
|
362
|
+
onChange: (e) => {
|
|
363
|
+
var o;
|
|
364
|
+
const t = oe.find((r) => r.id === e);
|
|
365
|
+
t && (G(t), (o = m == null ? void 0 : m.onVersionChange) == null || o.call(m, t));
|
|
366
|
+
}
|
|
367
|
+
})]
|
|
368
|
+
}),
|
|
369
|
+
right: /* @__PURE__ */ E(ce, {
|
|
370
|
+
children: [!I && T && T.add && /* @__PURE__ */ n(Te, {
|
|
371
|
+
type: "default",
|
|
372
|
+
onClick: () => be(!0),
|
|
373
|
+
disabled: W === Y.Pending || W === Y.Started,
|
|
374
|
+
children: "导入数据"
|
|
375
|
+
}), !I && T && T.label && /* @__PURE__ */ n(Te, {
|
|
376
|
+
type: "primary",
|
|
377
|
+
onClick: () => {
|
|
378
|
+
I || le("nocode"), K(!0), v(-1), d === "nocode" && (b != null && b.length) && (v(0), p(b[0])), z(!0);
|
|
379
|
+
},
|
|
380
|
+
children: "开始标注"
|
|
381
|
+
}), /* @__PURE__ */ n(kt, {
|
|
382
|
+
when: qe,
|
|
383
|
+
content: "确认要离开此页面吗?",
|
|
384
|
+
subContent: "离开此页面后,将结束导入,放弃未上传的文件,请谨慎操作!"
|
|
385
|
+
}), me && /* @__PURE__ */ n(Nt, {
|
|
386
|
+
datasetIam: Ze,
|
|
387
|
+
datasetId: i,
|
|
388
|
+
currentVersion: l,
|
|
389
|
+
tenCode: C == null ? void 0 : C.tenantCode,
|
|
390
|
+
isVisible: me,
|
|
391
|
+
setIsVisible: be,
|
|
392
|
+
getVersionListRequest: k,
|
|
393
|
+
setIsConfirm: je,
|
|
394
|
+
onUploadStatusChange: (e) => {
|
|
395
|
+
$e(e);
|
|
396
|
+
},
|
|
397
|
+
tableReload: () => {
|
|
398
|
+
var e;
|
|
399
|
+
l != null && l.id && (Ce(), $(h(u({}, S), {
|
|
400
|
+
current: 1
|
|
401
|
+
})), (e = te.current) == null || e.fetchLabels());
|
|
402
|
+
},
|
|
403
|
+
loadVersionData: Ie,
|
|
404
|
+
markType: C == null ? void 0 : C.markType
|
|
405
|
+
})]
|
|
406
|
+
})
|
|
407
|
+
}) : void 0,
|
|
408
|
+
children: [/* @__PURE__ */ n("div", {
|
|
409
|
+
className: "detection-header",
|
|
410
|
+
children: /* @__PURE__ */ E(ce, {
|
|
411
|
+
children: [q.tabs && /* @__PURE__ */ n(ct, {
|
|
412
|
+
className: "header-tab",
|
|
413
|
+
activeKey: d,
|
|
414
|
+
items: ye,
|
|
415
|
+
onChange: Se
|
|
416
|
+
}), !I && q.search && /* @__PURE__ */ n(xt, {
|
|
417
|
+
placeholder: "请输入图片名称搜索",
|
|
418
|
+
suffix: /* @__PURE__ */ n(vt, {}),
|
|
419
|
+
value: Z,
|
|
420
|
+
onChange: Ke,
|
|
421
|
+
allowClear: !0
|
|
422
|
+
})]
|
|
423
|
+
})
|
|
424
|
+
}), /* @__PURE__ */ E("div", {
|
|
425
|
+
className: "d-row",
|
|
426
|
+
children: [/* @__PURE__ */ E("div", {
|
|
427
|
+
className: "d-right",
|
|
428
|
+
ref: _,
|
|
429
|
+
children: [U && /* @__PURE__ */ n(Dt, {
|
|
430
|
+
datasetId: i,
|
|
431
|
+
isImageDetailVisible: U,
|
|
432
|
+
setIsImageDetailVisible: z,
|
|
433
|
+
currentSample: x != null ? x : I,
|
|
434
|
+
labels: w,
|
|
435
|
+
previewMode: !he,
|
|
436
|
+
filterItems: ye,
|
|
437
|
+
filterMode: d,
|
|
438
|
+
onFilterChange: Se,
|
|
439
|
+
onChange: y,
|
|
440
|
+
onNextClick: xe,
|
|
441
|
+
onPrevClick: Qe,
|
|
442
|
+
onSave: Xe,
|
|
443
|
+
onEnterEdit: () => K(!0),
|
|
444
|
+
onDeleteSample: Ye,
|
|
445
|
+
onRefresh: () => {
|
|
446
|
+
var e, t;
|
|
447
|
+
(e = Q()) == null || e.then(() => k()), (t = te.current) == null || t.fetchLabels();
|
|
448
|
+
},
|
|
449
|
+
isPreLabel: !1,
|
|
450
|
+
imgCount: {
|
|
451
|
+
total: A,
|
|
452
|
+
index: M + 1
|
|
453
|
+
},
|
|
454
|
+
settingHide: !ae,
|
|
455
|
+
canLabel: !!(T && T.label),
|
|
456
|
+
canDelete: !!(T && T.delete)
|
|
457
|
+
}), I ? /* @__PURE__ */ n("div", {}) : S.total !== void 0 && S.total > 0 ? /* @__PURE__ */ n(ut, {
|
|
458
|
+
innerProps: {
|
|
459
|
+
className: "d-right-row"
|
|
460
|
+
},
|
|
461
|
+
data: b,
|
|
462
|
+
itemKey: "id",
|
|
463
|
+
height: (De = (Le = _.current) == null ? void 0 : Le.clientHeight) != null ? De : 600,
|
|
464
|
+
onScroll: et,
|
|
465
|
+
children: (e, t) => {
|
|
466
|
+
var o;
|
|
467
|
+
return /* @__PURE__ */ n(at, {
|
|
468
|
+
className: "d-right-col",
|
|
469
|
+
onClick: () => Je(t),
|
|
470
|
+
children: /* @__PURE__ */ E("div", {
|
|
471
|
+
className: "right-col-wrapper",
|
|
472
|
+
children: [/* @__PURE__ */ n("div", {
|
|
473
|
+
className: "detection-status-wrapper",
|
|
474
|
+
children: /* @__PURE__ */ n(Lt, {
|
|
475
|
+
sample: e
|
|
476
|
+
})
|
|
477
|
+
}), /* @__PURE__ */ n("div", {
|
|
478
|
+
className: "right-col-img",
|
|
479
|
+
children: /* @__PURE__ */ n(It, {
|
|
480
|
+
fileKey: e.fileKey,
|
|
481
|
+
width: 124,
|
|
482
|
+
imgProxy: Ue
|
|
483
|
+
})
|
|
484
|
+
}), /* @__PURE__ */ E("div", {
|
|
485
|
+
className: "right-col-text",
|
|
486
|
+
children: [(o = e.labels) != null && o.length ? /* @__PURE__ */ n(dt, {
|
|
487
|
+
placement: "top",
|
|
488
|
+
title: e.labels[0].label,
|
|
489
|
+
children: /* @__PURE__ */ n("span", {
|
|
490
|
+
style: {
|
|
491
|
+
display: "inline-block",
|
|
492
|
+
maxWidth: "calc(100% - 25px)",
|
|
493
|
+
overflow: "hidden",
|
|
494
|
+
textOverflow: "ellipsis",
|
|
495
|
+
whiteSpace: "nowrap"
|
|
496
|
+
},
|
|
497
|
+
children: e.labels[0].label
|
|
498
|
+
})
|
|
499
|
+
}) : /* @__PURE__ */ n("span", {
|
|
500
|
+
style: {
|
|
501
|
+
color: "rgba(0,0,0,0.45)",
|
|
502
|
+
width: "100%"
|
|
503
|
+
},
|
|
504
|
+
children: "无标签"
|
|
505
|
+
}), /* @__PURE__ */ n("div", {
|
|
506
|
+
children: t + 1
|
|
507
|
+
})]
|
|
508
|
+
})]
|
|
509
|
+
})
|
|
510
|
+
}, e.id);
|
|
511
|
+
}
|
|
512
|
+
}) : /* @__PURE__ */ n("div", {
|
|
513
|
+
className: "empty",
|
|
514
|
+
children: S.total === 0 ? /* @__PURE__ */ n(we, {
|
|
515
|
+
image: bt,
|
|
516
|
+
description: "暂无数据"
|
|
517
|
+
}) : /* @__PURE__ */ n(Ee, {})
|
|
518
|
+
})]
|
|
519
|
+
}), d !== "nocode" && !I && q.labels && /* @__PURE__ */ n("div", {
|
|
520
|
+
className: "d-sider",
|
|
521
|
+
children: /* @__PURE__ */ n(Vt, {
|
|
522
|
+
ref: te,
|
|
523
|
+
datasetId: i,
|
|
524
|
+
data: w || [],
|
|
525
|
+
selected: O,
|
|
526
|
+
onSelectedChange: (e) => {
|
|
527
|
+
ne((w == null ? void 0 : w.filter((t) => e.find((o) => o.label === t.label))) || []);
|
|
528
|
+
},
|
|
529
|
+
onListChange: () => {
|
|
530
|
+
l && (c.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(i, l.id, {}).then((e) => {
|
|
531
|
+
const o = (e || []).filter((s) => s.label !== "nocode").map((s, g) => ({
|
|
532
|
+
label: s.label,
|
|
533
|
+
count: s.count,
|
|
534
|
+
id: s.id,
|
|
535
|
+
color: Me[g % 40]
|
|
536
|
+
})), r = O.filter((s) => o.some((g) => g.id === s.id));
|
|
537
|
+
ue(o), O.length !== r.length && ne(r);
|
|
538
|
+
}), k());
|
|
539
|
+
},
|
|
540
|
+
isPreLabel: !1
|
|
541
|
+
})
|
|
542
|
+
})]
|
|
543
|
+
})]
|
|
544
|
+
})
|
|
545
|
+
}) : /* @__PURE__ */ n("div", {
|
|
546
|
+
className: "empty",
|
|
547
|
+
children: /* @__PURE__ */ n(we, {
|
|
548
|
+
description: "当前数据集不是 classification(图像分类) 类型"
|
|
549
|
+
})
|
|
550
|
+
}) : /* @__PURE__ */ n("div", {
|
|
551
|
+
className: "empty",
|
|
552
|
+
children: /* @__PURE__ */ n(Ee, {})
|
|
553
|
+
})
|
|
554
|
+
})
|
|
555
|
+
});
|
|
556
|
+
};
|
|
557
|
+
export {
|
|
558
|
+
Yt as default
|
|
559
|
+
};
|