@glodon-aiot/dataset-annotation 3.1.0-beta.15 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/dataset-annotation.js +123591 -0
  2. package/dist/dataset-annotation.umd.cjs +1017 -0
  3. package/dist/example/DatasetAnnotationDemo.d.ts +3 -0
  4. package/dist/example/DemoTabs.d.ts +3 -0
  5. package/dist/example/DetectionDatasetDemo.d.ts +5 -0
  6. package/dist/example/DetectionImageDemo.d.ts +5 -0
  7. package/dist/example/OcrDatasetDemo.d.ts +5 -0
  8. package/dist/example/OcrImageDemo.d.ts +5 -0
  9. package/dist/example/OcrkvcDatasetDemo.d.ts +5 -0
  10. package/dist/example/constant.local.d.ts +6 -0
  11. package/dist/example/index.d.ts +1 -0
  12. package/dist/src/Common/Page/index.d.ts +2 -1
  13. package/dist/src/Common/PageHeader/index.d.ts +1 -0
  14. package/dist/src/DatasetContext/index.d.ts +4 -3
  15. package/dist/src/components/CompositionInput/index.d.ts +2 -2
  16. package/dist/src/components/DataEmpty/index.d.ts +2 -1
  17. package/dist/src/components/DetectionAnnotation/PreSamplesPage/index.d.ts +2 -1
  18. package/dist/src/components/DetectionAnnotation/components/DisabledTooltip/index.d.ts +2 -2
  19. package/dist/src/components/DetectionAnnotation/components/ImageDetail/index.d.ts +2 -1
  20. package/dist/src/components/DetectionAnnotation/components/LabelMaker/Drawable.d.ts +2 -2
  21. package/dist/src/components/DetectionAnnotation/components/LabelMaker/RectLabel.d.ts +2 -2
  22. package/dist/src/components/DetectionAnnotation/components/LabelMaker/index.d.ts +1 -0
  23. package/dist/src/components/DetectionAnnotation/components/Labels/index.d.ts +1 -0
  24. package/dist/src/components/DetectionAnnotation/components/TagItem/index.d.ts +2 -1
  25. package/dist/src/components/DetectionAnnotation/index.d.ts +2 -1
  26. package/dist/src/components/DetectionImageAnnotation/index.d.ts +2 -0
  27. package/dist/src/components/Iconfont/index.d.ts +1 -1
  28. package/dist/src/components/MarkDescriptions/index.d.ts +1 -0
  29. package/dist/src/components/OCRImageViewer/index.d.ts +2 -1
  30. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorInput.d.ts +2 -2
  31. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorItem.d.ts +2 -1
  32. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LableEditor.d.ts +1 -0
  33. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/index.d.ts +1 -0
  34. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/ImageDetail/index.d.ts +2 -1
  35. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/LabelEditorInput.d.ts +2 -2
  36. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/LabelEditorItem.d.ts +1 -0
  37. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/LableEditor.d.ts +1 -0
  38. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/index.d.ts +1 -0
  39. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/index.d.ts +1 -0
  40. package/dist/src/components/OcrAnnotation/OcrModal/index.d.ts +2 -1
  41. package/dist/src/components/OcrAnnotation/PreLabelOCR/PreLabelModal.d.ts +2 -1
  42. package/dist/src/components/OcrAnnotation/PreLabelOCR/index.d.ts +2 -1
  43. package/dist/src/components/OcrAnnotation/index.d.ts +2 -1
  44. package/dist/src/components/OcrImageAnnotation/index.d.ts +2 -0
  45. package/dist/src/components/PageNav/index.d.ts +2 -1
  46. package/dist/src/components/PicZipImportModal/index.d.ts +2 -1
  47. package/dist/src/components/PreLabelOCR/PreLabelModal.d.ts +2 -1
  48. package/dist/src/components/PreLabelOCR/index.d.ts +2 -1
  49. package/dist/src/components/ScanTable/index.d.ts +2 -1
  50. package/dist/src/components/Thumbnail/index.d.ts +2 -1
  51. package/dist/src/components/hooks/useBlocker.d.ts +1 -1
  52. package/dist/src/featuresConfig.d.ts +1 -1
  53. package/package.json +15 -22
  54. package/dist/es/Common/Page/index.mjs +0 -28
  55. package/dist/es/Common/PageContent/index.mjs +0 -18
  56. package/dist/es/Common/PageHeader/index.mjs +0 -38
  57. package/dist/es/DatasetContext/index.mjs +0 -11
  58. package/dist/es/_virtual/_commonjsHelpers.mjs +0 -6
  59. package/dist/es/_virtual/index.mjs +0 -4
  60. package/dist/es/access/images/data_empty.svg.mjs +0 -4
  61. package/dist/es/components/CompositionInput/index.mjs +0 -53
  62. package/dist/es/components/DataEmpty/index.mjs +0 -50
  63. package/dist/es/components/DetectionAnnotation/PreSamplesPage/index.mjs +0 -291
  64. package/dist/es/components/DetectionAnnotation/components/DisabledTooltip/index.mjs +0 -23
  65. package/dist/es/components/DetectionAnnotation/components/ImageDetail/index.mjs +0 -165
  66. package/dist/es/components/DetectionAnnotation/components/LabelMaker/Drawable.mjs +0 -51
  67. package/dist/es/components/DetectionAnnotation/components/LabelMaker/FabricCustomize.mjs +0 -42
  68. package/dist/es/components/DetectionAnnotation/components/LabelMaker/RectLabel.mjs +0 -283
  69. package/dist/es/components/DetectionAnnotation/components/LabelMaker/icons/delete-icon.svg.mjs +0 -4
  70. package/dist/es/components/DetectionAnnotation/components/LabelMaker/index.mjs +0 -314
  71. package/dist/es/components/DetectionAnnotation/components/Labels/index.mjs +0 -200
  72. package/dist/es/components/DetectionAnnotation/components/TagItem/index.mjs +0 -143
  73. package/dist/es/components/DetectionAnnotation/icon_item_empty.svg.mjs +0 -4
  74. package/dist/es/components/DetectionAnnotation/index.mjs +0 -712
  75. package/dist/es/components/DetectionImageAnnotation/index.mjs +0 -61
  76. package/dist/es/components/Iconfont/index.mjs +0 -16
  77. package/dist/es/components/MarkDescriptions/index.mjs +0 -65
  78. package/dist/es/components/OCRImageViewer/index.mjs +0 -212
  79. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/CategoryDrawer.mjs +0 -136
  80. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorInput.mjs +0 -57
  81. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorItem.mjs +0 -72
  82. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LableEditor.mjs +0 -54
  83. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/index.mjs +0 -366
  84. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/index.mjs +0 -254
  85. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/ImageDetail/index.mjs +0 -100
  86. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/images/delete.png.mjs +0 -4
  87. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/index.mjs +0 -755
  88. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/index.mjs +0 -230
  89. package/dist/es/components/OcrAnnotation/OcrModal/index.mjs +0 -179
  90. package/dist/es/components/OcrAnnotation/PreLabelOCR/PreLabelModal.mjs +0 -280
  91. package/dist/es/components/OcrAnnotation/PreLabelOCR/index.mjs +0 -43
  92. package/dist/es/components/OcrAnnotation/constant.mjs +0 -5
  93. package/dist/es/components/OcrAnnotation/index.mjs +0 -381
  94. package/dist/es/components/OcrImageAnnotation/index.mjs +0 -39
  95. package/dist/es/components/PageNav/index.mjs +0 -29
  96. package/dist/es/components/PicZipImportModal/index.mjs +0 -583
  97. package/dist/es/components/PicZipImportModal/pic_zip.svg.mjs +0 -4
  98. package/dist/es/components/PicZipImportModal/pic_zip_json.svg.mjs +0 -4
  99. package/dist/es/components/PreLabelOCR/PreLabelModal.mjs +0 -275
  100. package/dist/es/components/PreLabelOCR/index.mjs +0 -43
  101. package/dist/es/components/ScanTable/index.mjs +0 -96
  102. package/dist/es/components/Thumbnail/default.png.mjs +0 -4
  103. package/dist/es/components/Thumbnail/index.mjs +0 -30
  104. package/dist/es/components/hooks/Prompt.mjs +0 -33
  105. package/dist/es/constant.mjs +0 -13
  106. package/dist/es/createDatasetAnnotation/index.mjs +0 -133
  107. package/dist/es/createDetectionDatasetAnnotation/index.mjs +0 -129
  108. package/dist/es/createDetectionImageAnnotation/index.mjs +0 -31
  109. package/dist/es/createOcrDatasetAnnotation/index.mjs +0 -129
  110. package/dist/es/createOcrImageAnnotation/index.mjs +0 -33
  111. package/dist/es/featuresConfig.mjs +0 -79
  112. package/dist/es/index.mjs +0 -35
  113. package/dist/es/node_modules/classnames/index.mjs +0 -42
  114. package/dist/es/utils/color.mjs +0 -30
  115. package/dist/es/utils/index.mjs +0 -22
  116. package/dist/es/utils/sign.mjs +0 -33
  117. package/dist/lib/index.js +0 -7
  118. package/dist/src/components/Iconfont/font_3140028_iptomfpgyu.d.ts +0 -0
  119. package/dist/src/components/Iconfont/font_3454453_gu5ijeufyng.d.ts +0 -0
  120. package/dist/src/components/Iconfont/font_4108228_3slzqhoow93.d.ts +0 -0
  121. package/dist/src/components/Iconfont/font_4439177_k3mjwv7kzfd.d.ts +0 -0
@@ -1,53 +0,0 @@
1
- var V = Object.defineProperty, b = Object.defineProperties;
2
- var j = Object.getOwnPropertyDescriptors;
3
- var n = Object.getOwnPropertySymbols;
4
- var c = Object.prototype.hasOwnProperty, l = Object.prototype.propertyIsEnumerable;
5
- var p = (o, e, t) => e in o ? V(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t, f = (o, e) => {
6
- for (var t in e || (e = {}))
7
- c.call(e, t) && p(o, t, e[t]);
8
- if (n)
9
- for (var t of n(e))
10
- l.call(e, t) && p(o, t, e[t]);
11
- return o;
12
- }, C = (o, e) => b(o, j(e));
13
- var d = (o, e) => {
14
- var t = {};
15
- for (var s in o)
16
- c.call(o, s) && e.indexOf(s) < 0 && (t[s] = o[s]);
17
- if (o != null && n)
18
- for (var s of n(o))
19
- e.indexOf(s) < 0 && l.call(o, s) && (t[s] = o[s]);
20
- return t;
21
- };
22
- import { jsx as w } from "react/jsx-runtime";
23
- import { Input as A } from "antd";
24
- import K, { useState as g, useEffect as O } from "react";
25
- const P = (o) => {
26
- const u = o, {
27
- value: e,
28
- onChange: t
29
- } = u, s = d(u, [
30
- "value",
31
- "onChange"
32
- ]), [v, r] = g(e), [h, a] = g(!1), x = navigator.userAgent.indexOf("WebKit") > -1;
33
- O(() => {
34
- r(e);
35
- }, [e]);
36
- const E = () => {
37
- a(!0);
38
- }, I = (i) => {
39
- a(!1), x && (t == null || t(i.currentTarget.value));
40
- }, S = (i) => {
41
- const m = i.target.value;
42
- r(m), h || t == null || t(m);
43
- };
44
- return /* @__PURE__ */ w(A, C(f({}, s), {
45
- value: v,
46
- onChange: S,
47
- onCompositionStart: E,
48
- onCompositionEnd: I
49
- }));
50
- }, k = K.memo(P);
51
- export {
52
- k as default
53
- };
@@ -1,50 +0,0 @@
1
- var y = Object.defineProperty;
2
- var a = Object.getOwnPropertySymbols;
3
- var h = Object.prototype.hasOwnProperty, N = Object.prototype.propertyIsEnumerable;
4
- var c = (s, t, e) => t in s ? y(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, m = (s, t) => {
5
- for (var e in t || (t = {}))
6
- h.call(t, e) && c(s, e, t[e]);
7
- if (a)
8
- for (var e of a(t))
9
- N.call(t, e) && c(s, e, t[e]);
10
- return s;
11
- };
12
- import { jsx as i, jsxs as x } from "react/jsx-runtime";
13
- import { Empty as f, Button as u } from "antd";
14
- import k from "../../access/images/data_empty.svg.mjs";
15
- /* empty css */const b = (s) => {
16
- const {
17
- emptyClassName: t,
18
- emptyStyle: e,
19
- image: n,
20
- description: l,
21
- showBtn: o,
22
- btnText: r,
23
- children: p,
24
- handleClick: d
25
- } = s;
26
- return /* @__PURE__ */ i(f, {
27
- className: `unit-empty ${t || ""}`,
28
- style: m({}, e),
29
- image: n || k,
30
- description: /* @__PURE__ */ x("div", {
31
- className: "descriptions",
32
- children: [/* @__PURE__ */ i("span", {
33
- className: "desc",
34
- children: l || "暂无数据"
35
- }), o && /* @__PURE__ */ i(u, {
36
- className: "action",
37
- type: "link",
38
- onClick: d,
39
- children: /* @__PURE__ */ i("span", {
40
- className: "action-text",
41
- children: r
42
- })
43
- })]
44
- }),
45
- children: p || ""
46
- });
47
- };
48
- export {
49
- b as default
50
- };
@@ -1,291 +0,0 @@
1
- var Y = Object.defineProperty, Z = Object.defineProperties;
2
- var _ = Object.getOwnPropertyDescriptors;
3
- var B = Object.getOwnPropertySymbols;
4
- var $ = Object.prototype.hasOwnProperty, ee = Object.prototype.propertyIsEnumerable;
5
- var H = (h, s, a) => s in h ? Y(h, s, { enumerable: !0, configurable: !0, writable: !0, value: a }) : h[s] = a, y = (h, s) => {
6
- for (var a in s || (s = {}))
7
- $.call(s, a) && H(h, a, s[a]);
8
- if (B)
9
- for (var a of B(s))
10
- ee.call(s, a) && H(h, a, s[a]);
11
- return h;
12
- }, D = (h, s) => Z(h, _(s));
13
- import { jsxs as E, jsx as m } from "react/jsx-runtime";
14
- import { useContext as te, useRef as re, useState as b, useEffect as k } from "react";
15
- import { Button as V, Space as ne, message as L, Modal as K } from "antd";
16
- /* empty css */import { useKeyPress as ie } from "ahooks";
17
- import le from "../components/ImageDetail/index.mjs";
18
- import se from "../../../DatasetContext/index.mjs";
19
- import { tagColors as oe } from "../../../utils/index.mjs";
20
- import ce from "../../../Common/Page/index.mjs";
21
- const be = (h) => {
22
- const {
23
- datasetId: s,
24
- versionId: a,
25
- onClose: S,
26
- samples: M,
27
- labels: q,
28
- fetchLength: F
29
- } = h, {
30
- services: {
31
- cvforceDatahub: p
32
- },
33
- featuresConfig: {
34
- datasetManager: R
35
- } = {
36
- datasetManager: !1
37
- }
38
- } = te(se), G = re(null), [N, J] = b(!1), [Q, j] = b(!1), [C, v] = b(0), [d, g] = b(), [f, x] = b(), [c, P] = b({
39
- current: 1,
40
- pageSize: 1e4
41
- }), [u, z] = b([]), A = (t) => {
42
- if (!p)
43
- return Promise.resolve(!1);
44
- const e = (t == null ? void 0 : t.current) || c.current, r = (t == null ? void 0 : t.pageSize) || c.pageSize;
45
- return !s || !a || !e ? Promise.resolve(!1) : (P(D(y({}, c), {
46
- current: e,
47
- pageSize: r
48
- })), p.getDatasetsIdVersionsVidSamples(s, a, {
49
- pageNo: e,
50
- pageSize: r,
51
- confirmStatus: 1
52
- }).then((l) => {
53
- const o = l.recordList || [];
54
- if (o.length === 0)
55
- return S(), !1;
56
- const n = e === 1 ? o : [...M, ...o];
57
- if (z(n), P(D(y({}, c), {
58
- current: e,
59
- pageSize: r,
60
- total: l.totalResults
61
- })), c.type === "next" && o.length) {
62
- v(0);
63
- const i = l.recordList[0];
64
- g(i);
65
- }
66
- if (c.type === "prev" && o.length) {
67
- v(c.pageSize - 1);
68
- const i = l.recordList[c.pageSize - 1];
69
- g(i);
70
- }
71
- return N && C < 0 && (v(0), g(o[0]), j(!0)), n;
72
- }).catch(() => !1));
73
- };
74
- k(() => {
75
- !d && !C && g(u[0]);
76
- }, [u]), ie("Esc", S), k(() => {
77
- A(c).then((t) => {
78
- });
79
- }, [c.current]), k(() => {
80
- !N && d && J(!0);
81
- }, [d]);
82
- const U = () => {
83
- if (!(!s || !a) && p)
84
- return p.getDatasetsIdVersionsVidLabelcount(s, a).then((t) => ((t || []).filter((r) => r.label !== "nocode").map((r, l) => ({
85
- label: r.label,
86
- count: r.count,
87
- id: r.id,
88
- color: oe[l % 40]
89
- })), t));
90
- };
91
- k(() => {
92
- c.type || A();
93
- }, [c.type]);
94
- const O = (t) => {
95
- if (u)
96
- return T(t).then((e) => (e && z((r) => {
97
- var o;
98
- let l;
99
- if (Array.isArray(r)) {
100
- if (!r.length)
101
- return S(), r;
102
- const n = t ? C + 1 : C;
103
- if (f || d) {
104
- const i = f || d;
105
- if (i && ((o = i.labels) != null && o.length) && t === 0) {
106
- const I = r.findIndex((w) => w.id === i.id);
107
- I > -1 && (r.splice(I, 1), l = [...r]);
108
- }
109
- }
110
- n >= r.length ? n === u.length ? L.error("已经是最后一个了") : A({
111
- current: c.current,
112
- pageSize: c.pageSize,
113
- type: "next"
114
- }).then((i) => {
115
- if (Array.isArray(i)) {
116
- v(n >= i.length ? n - 1 : n);
117
- const I = i[n >= i.length ? n - 1 : n];
118
- g(I), x(void 0);
119
- }
120
- }) : setTimeout(() => {
121
- v(n);
122
- const i = r[n];
123
- g(i), x(void 0);
124
- }, 200);
125
- }
126
- return l || r;
127
- }), e));
128
- }, W = (t) => {
129
- if (M)
130
- return T(t).then((e) => {
131
- e && z((r) => {
132
- var o;
133
- let l;
134
- if (Array.isArray(r)) {
135
- if (!r.length)
136
- return S(), r;
137
- const n = C - 1;
138
- if (n < 0)
139
- (c.current - 1) * c.pageSize + n < 0 ? L.error("已经是第一个了") : P({
140
- current: c.current - 1,
141
- pageSize: c.pageSize,
142
- type: "prev"
143
- });
144
- else {
145
- if (f || d) {
146
- const i = f || d;
147
- if (i && ((o = i.labels) != null && o.length) && t === 0) {
148
- const I = r.findIndex((w) => w.id === i.id);
149
- I > -1 && (r.splice(I, 1), l = [...r]);
150
- }
151
- }
152
- setTimeout(() => {
153
- v(n);
154
- const i = r[n];
155
- g(i), x(void 0);
156
- }, 200);
157
- }
158
- }
159
- return l || r;
160
- });
161
- });
162
- }, T = (t) => {
163
- var r;
164
- if (!p)
165
- return Promise.resolve(!1);
166
- const e = f || (t === 0 ? d : void 0);
167
- if (e) {
168
- if (e.labels)
169
- e.labels = e.labels.filter((l) => !!l.id);
170
- else if (t === 0)
171
- return L.error("图片没有标注信息,无法保存"), Promise.resolve(!1);
172
- return delete e.confirmStatus, p.updateSamples(s, a, [e], (r = e.labels) != null && r.length ? t : 1).then(() => (L.success({
173
- content: "保存成功"
174
- }), z((l) => {
175
- if (l.length === 0)
176
- return S(), [];
177
- {
178
- const o = l.findIndex((n) => n.id === (e == null ? void 0 : e.id));
179
- return o > -1 && (l[o] = e), [...l];
180
- }
181
- }), !0)).catch(() => !1);
182
- } else
183
- return Promise.resolve(!0);
184
- }, X = () => {
185
- if (!p)
186
- return Promise.resolve(!1);
187
- K.confirm({
188
- title: "确认要删除当前数据吗?",
189
- content: "数据包含当前标注的内容和图片,删除后无法恢复,请确认是否删除!",
190
- onOk: () => {
191
- d && p.delDatasetsIdVersionsVidSamplesId(s, a, d.id).then(() => {
192
- const t = u.findIndex((e) => e.id === d.id);
193
- u.splice(t, 1), z([...u]), u.length || S(), t <= u.length - 1 ? g(u[t]) : (g(u[t - 1]), v(t - 1)), x(void 0), F();
194
- });
195
- }
196
- });
197
- };
198
- return /* @__PURE__ */ E(ce, {
199
- className: "preLabels-details-page",
200
- header: /* @__PURE__ */ E("div", {
201
- className: "preLabels-page-header",
202
- children: [/* @__PURE__ */ m("div", {
203
- className: "header-title",
204
- children: "待确认标注"
205
- }), /* @__PURE__ */ m(V, {
206
- onClick: S,
207
- children: "退出"
208
- })]
209
- }),
210
- children: [/* @__PURE__ */ m("div", {
211
- className: "preLabels-action",
212
- children: /* @__PURE__ */ E(ne, {
213
- children: [/* @__PURE__ */ m(V, {
214
- type: "primary",
215
- onClick: () => {
216
- if (f && f.labels.some((t) => !t.id))
217
- return L.error("所有标注需设置标签"), Promise.resolve(!1);
218
- x(d), O(0);
219
- },
220
- children: "保存当前标注"
221
- }), /* @__PURE__ */ m(V, {
222
- onClick: () => {
223
- if (!p)
224
- return Promise.resolve(!1);
225
- K.confirm({
226
- title: "一键保存所有标注?",
227
- content: "待确认的所有带预标注信息的图片将保存至已标注页签下",
228
- onOk: () => {
229
- p.getAllConfirmSamples(s, a).then((t) => {
230
- L.success("保存成功"), A(D(y({}, c), {
231
- current: 1,
232
- type: "next"
233
- })).then((e) => {
234
- Array.isArray(e) && e.length && (v(0), g(e[0]));
235
- });
236
- });
237
- }
238
- });
239
- },
240
- children: "一键保存所有标注"
241
- }), R && R.delete && /* @__PURE__ */ m(V, {
242
- onClick: X,
243
- children: "删除数据"
244
- })]
245
- })
246
- }), /* @__PURE__ */ m("div", {
247
- className: "d-row",
248
- children: !!u.length && /* @__PURE__ */ m("div", {
249
- className: "d-right",
250
- ref: G,
251
- children: d && /* @__PURE__ */ m(le, {
252
- datasetId: s,
253
- isImageDetailVisible: Q,
254
- setIsImageDetailVisible: j,
255
- currentSample: f != null ? f : d,
256
- labels: q,
257
- editing: N,
258
- onChange: x,
259
- onNextClick: () => O(1),
260
- onPrevClick: () => W(1),
261
- onRefresh: () => {
262
- var t;
263
- (t = U()) == null || t.then((e) => {
264
- var r, l;
265
- if (f) {
266
- const o = [];
267
- (r = f.labels) == null || r.forEach((n) => {
268
- e != null && e.find((i) => i.id === n.id) && o.push(n);
269
- }), f.labels = o, x(y({}, f));
270
- }
271
- if (d) {
272
- const o = [];
273
- (l = d.labels) == null || l.forEach((n) => {
274
- e != null && e.find((i) => i.id === n.id) && o.push(n);
275
- }), d.labels = o, g(y({}, d));
276
- }
277
- });
278
- },
279
- settingHide: !0,
280
- imgCount: {
281
- total: u.length,
282
- index: C + 1
283
- }
284
- })
285
- })
286
- })]
287
- });
288
- };
289
- export {
290
- be as default
291
- };
@@ -1,23 +0,0 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { useState as p } from "react";
3
- import { Tooltip as r } from "antd";
4
- const f = (t) => {
5
- const {
6
- isPreLabel: s,
7
- placement: i,
8
- children: l
9
- } = t, [n, e] = p(!1);
10
- return /* @__PURE__ */ o(r, {
11
- title: "预标注进行中,请任务完成后再试",
12
- open: n,
13
- placement: i || "top",
14
- children: /* @__PURE__ */ o("div", {
15
- onMouseEnter: () => s && e(!0),
16
- onMouseLeave: () => e(!1),
17
- children: l
18
- })
19
- });
20
- };
21
- export {
22
- f as default
23
- };
@@ -1,165 +0,0 @@
1
- var Z = Object.defineProperty, _ = Object.defineProperties;
2
- var $ = Object.getOwnPropertyDescriptors;
3
- var E = Object.getOwnPropertySymbols;
4
- var V = Object.prototype.hasOwnProperty, S = Object.prototype.propertyIsEnumerable;
5
- var F = (n, t, a) => t in n ? Z(n, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[t] = a, m = (n, t) => {
6
- for (var a in t || (t = {}))
7
- V.call(t, a) && F(n, a, t[a]);
8
- if (E)
9
- for (var a of E(t))
10
- S.call(t, a) && F(n, a, t[a]);
11
- return n;
12
- }, N = (n, t) => _(n, $(t));
13
- import { jsxs as p, jsx as r } from "react/jsx-runtime";
14
- import { useRef as M, useState as b, useEffect as x } from "react";
15
- import { Button as A } from "antd";
16
- import { useKeyPress as B } from "ahooks";
17
- /* empty css */import ee from "../Labels/index.mjs";
18
- import ie from "../LabelMaker/index.mjs";
19
- import H from "../../../Iconfont/index.mjs";
20
- const fe = (n) => {
21
- var P, z, D;
22
- const {
23
- datasetId: t,
24
- isImageDetailVisible: a = !0,
25
- currentSample: e,
26
- onNextClick: h,
27
- onPrevClick: g,
28
- labels: d = [],
29
- editing: K,
30
- onRefresh: v,
31
- onChange: R,
32
- isPreLabel: j,
33
- settingHide: k,
34
- imgCount: c,
35
- readonly: O,
36
- showLabelList: q = !0,
37
- renderLabelItem: G
38
- } = n, J = M(null), Q = M({}), [C, T] = b({}), [u, L] = b(), [o, I] = b(), [W, X] = b(!1), [U, w] = b(!1);
39
- B("rightarrow", () => {
40
- h && h();
41
- }), B("leftarrow", () => {
42
- g && g();
43
- }), x(() => () => {
44
- W && v && v();
45
- }, []), x(() => {
46
- var l, s;
47
- if (L(void 0), I(void 0), !a || !((l = e == null ? void 0 : e.labels) != null && l.length))
48
- return;
49
- const i = (s = o || e) == null ? void 0 : s.labels.reduce((f, y) => (f[y.id] ? ++f[y.id] : f[y.id] = 1, f), {});
50
- T(i || {});
51
- }, [a, e, o]), x(() => {
52
- e != null && e.fileUrl && w(!0);
53
- }, [e == null ? void 0 : e.fileUrl]), x(() => {
54
- if (o != null && o.labels) {
55
- const i = [];
56
- o.labels.forEach((l) => {
57
- const s = d.find((f) => f.id === l.id);
58
- s && i.push(N(m({}, l), {
59
- label: s.label
60
- }));
61
- }), o.labels = i, I(m({}, o));
62
- }
63
- }, [d]);
64
- const Y = () => {
65
- J.current && w(!1);
66
- };
67
- return window.onresize = Y, /* @__PURE__ */ p("div", {
68
- className: "detection-image-detail",
69
- children: [/* @__PURE__ */ p("div", {
70
- className: "detail-image",
71
- children: [k ? /* @__PURE__ */ p("div", {
72
- className: "img-detail-info",
73
- children: ["第 ", c == null ? void 0 : c.index, " 张 / 共 ", c == null ? void 0 : c.total, " 张"]
74
- }) : /* @__PURE__ */ r("div", {
75
- className: "img-detail-info",
76
- children: c == null ? void 0 : c.index
77
- }), /* @__PURE__ */ p("div", {
78
- className: "detail-content",
79
- children: [g && /* @__PURE__ */ r(A, {
80
- className: "select-prev",
81
- icon: /* @__PURE__ */ r(H, {
82
- type: "icon-zuojiantou"
83
- }),
84
- type: "text",
85
- disabled: U,
86
- onClick: () => g(),
87
- tabIndex: 0
88
- }), /* @__PURE__ */ r("div", {
89
- className: "select-main",
90
- ref: Q,
91
- children: /* @__PURE__ */ r(ie, {
92
- disabled: O,
93
- imageUrl: (e == null ? void 0 : e.fileUrl) || "",
94
- pen: u,
95
- labels: ((P = o ? o.labels : e == null ? void 0 : e.labels) == null ? void 0 : P.map((i) => {
96
- var l;
97
- return N(m({}, i), {
98
- color: ((l = d.find((s) => s.id === i.id)) == null ? void 0 : l.color) || ""
99
- });
100
- })) || [],
101
- onImageLoad: () => w(!1),
102
- onChange: (i) => {
103
- if (L(void 0), !e)
104
- return;
105
- const l = N(m({}, e), {
106
- labels: i.map((s) => ({
107
- id: s.id,
108
- label: s.label,
109
- box: s.box
110
- }))
111
- });
112
- I(l), R && R(l);
113
- },
114
- isPreLabel: j,
115
- renderLabelItem: G
116
- })
117
- }), h && /* @__PURE__ */ r(A, {
118
- className: "select-next",
119
- icon: /* @__PURE__ */ r(H, {
120
- type: "icon-youjiantou"
121
- }),
122
- type: "text",
123
- disabled: U,
124
- onClick: () => h()
125
- })]
126
- }), ((z = e == null ? void 0 : e.sampleFileName) == null ? void 0 : z.name) && /* @__PURE__ */ r("div", {
127
- className: "img-detail-info",
128
- children: e.sampleFileName.name
129
- })]
130
- }), (!!(d != null && d.length) || K) && q && /* @__PURE__ */ r("div", {
131
- className: "detail-slide",
132
- children: /* @__PURE__ */ r(ee, {
133
- datasetId: t,
134
- selectMode: "single",
135
- data: ((D = Object.keys(C)) == null ? void 0 : D.map((i) => {
136
- const l = d.find((s) => s.id === i);
137
- if (l)
138
- return l.count = C[i], l;
139
- }).filter((i) => !!i)) || [],
140
- shortcut: !0,
141
- selected: u ? [u] : [],
142
- onSelectedChange: (i) => {
143
- if (i.length > 2) {
144
- console.warn("不支持选中多个标签");
145
- return;
146
- }
147
- if (!i.length) {
148
- L(void 0);
149
- return;
150
- }
151
- const l = d == null ? void 0 : d.find((s) => i[0].label === s.label);
152
- L(l);
153
- },
154
- onListChange: () => {
155
- X(!0), v && v();
156
- },
157
- isPreLabel: j,
158
- settingHide: k
159
- })
160
- })]
161
- });
162
- };
163
- export {
164
- fe as default
165
- };
@@ -1,51 +0,0 @@
1
- function k(e, p) {
2
- I(e);
3
- let i = -1, h = -1, u = 0, n = 0;
4
- e.on("mouse:down", (s) => {
5
- if (e.getActiveObject())
6
- return;
7
- i = -1, h = -1, u = 0, n = 0;
8
- const l = e.getZoom();
9
- h = s.e.offsetX / l, i = s.e.offsetY / l;
10
- }), e.on("mouse:up", (s) => {
11
- if (e.getActiveObject()) {
12
- i = -1, h = -1, u = 0, n = 0;
13
- return;
14
- }
15
- if (h === -1 && i === -1)
16
- return;
17
- const l = e.getZoom(), m = s.e.offsetX > e.getWidth() ? e.getWidth() / l : s.e.offsetX / l, w = s.e.offsetY > e.getHeight() ? e.getHeight() / l : s.e.offsetY / l;
18
- if (u = Math.abs(m - h), n = Math.abs(w - i), u === 0 || n === 0)
19
- return;
20
- const y = e.viewportTransform ? e.viewportTransform[4] / l : 0, T = e.viewportTransform ? e.viewportTransform[5] / l : 0;
21
- let f = i > w ? w : i, r = h > m ? m : h, d = u, g = n;
22
- f = f - T, r = r - y;
23
- const X = () => {
24
- var o, b;
25
- const t = e.backgroundImage;
26
- t && typeof t != "string" && ((o = t.aCoords) != null && o.tl.x, (b = t.aCoords) != null && b.tl.y), t && typeof t != "string" && t.top !== void 0 && t.height !== void 0 && t.left !== void 0 && t.width !== void 0 && (f < t.top && (g = g - (t.top - f), f = t.top), f + g > t.top + t.height && (g = t.top + t.height - f + g - g, f = t.height + t.top - g), r < t.left && (d = d - (t.left - r), r = t.left), r + d > t.left + t.width && (d = t.left + t.width - r + d - d, r = t.width + t.left - d));
27
- }, Y = (t) => {
28
- const o = e.backgroundImage;
29
- return !(o && typeof o != "string" && o.top !== void 0 && o.height !== void 0 && o.left !== void 0 && o.width !== void 0 && (t[0] < o.left || t[1] < o.top || t[0] > o.left + o.width || t[1] > o.top + o.height));
30
- };
31
- X();
32
- const c = [[r, f], [r + d, f], [r + d, f + g], [r, f + g]];
33
- p && c.every((t) => Y(t)) && p({
34
- id: "",
35
- color: "#cccccc",
36
- label: "未知",
37
- box: c
38
- }), e.skipTargetFind = !1;
39
- });
40
- }
41
- const I = (e) => {
42
- e.off("mouse:down"), e.off("mouse:up");
43
- };
44
- function x(e, p, i) {
45
- if (!i)
46
- return k(e, p), e;
47
- }
48
- export {
49
- x as drawable,
50
- I as stopDraw
51
- };
@@ -1,42 +0,0 @@
1
- import d from "./icons/delete-icon.svg.mjs";
2
- function y(t) {
3
- t.Object.prototype.cornerColor = "blue", c(t);
4
- }
5
- function z(t) {
6
- return !(!t.complete || typeof t.naturalWidth != "undefined" && t.naturalWidth == 0);
7
- }
8
- function c(t) {
9
- const s = document.createElement("img");
10
- s.src = d;
11
- function f(r) {
12
- return function(e, i, l, o, n) {
13
- const a = () => {
14
- e.save(), e.translate(i, l), e.rotate(t.util.degreesToRadians(n.angle)), e.lineJoin = "round", e.fillStyle = "#fff", e.lineWidth = 4, e.strokeStyle = "#fff", e.strokeRect(-12, -12, 24, 24), e.fillRect(-12, -12, 24, 24), e.drawImage(r, -10, -10, 20, 20), e.restore();
15
- };
16
- z(r) ? a() : r.onload = () => {
17
- a();
18
- };
19
- };
20
- }
21
- function u(r, e, i, l) {
22
- var o = e.target, n = o.canvas;
23
- if (!n)
24
- return !1;
25
- n.remove(o);
26
- }
27
- t.Object.prototype.controls.deleteControl = new t.Control({
28
- actionName: "del",
29
- x: 0.5,
30
- y: -0.5,
31
- offsetY: -24 + 8,
32
- offsetX: -24 + 8,
33
- cursorStyle: "pointer",
34
- mouseUpHandler: u,
35
- render: f(s),
36
- sizeX: 24,
37
- sizeY: 24
38
- });
39
- }
40
- export {
41
- y as default
42
- };