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