@glodon-aiot/dataset-annotation 3.2.2-beta.2 → 3.2.2-beta.4

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 (138) hide show
  1. package/dist/es/Common/Page/index.mjs +29 -0
  2. package/dist/es/Common/Page/style.less.mjs +4 -0
  3. package/dist/es/Common/PageContent/index.mjs +18 -0
  4. package/dist/es/Common/PageHeader/index.mjs +39 -0
  5. package/dist/es/Common/PageHeader/style.less.mjs +4 -0
  6. package/dist/es/DatasetContext/index.mjs +11 -0
  7. package/dist/es/_virtual/_commonjsHelpers.mjs +4 -0
  8. package/dist/es/_virtual/minio.mjs +4 -0
  9. package/dist/es/access/images/data_empty.svg.mjs +4 -0
  10. package/dist/es/components/CompositionInput/index.mjs +53 -0
  11. package/dist/es/components/DataEmpty/index.mjs +51 -0
  12. package/dist/es/components/DataEmpty/style.less.mjs +4 -0
  13. package/dist/es/components/DetectionAnnotation/PreSamplesPage/index.mjs +292 -0
  14. package/dist/es/components/DetectionAnnotation/PreSamplesPage/style.less.mjs +4 -0
  15. package/dist/es/components/DetectionAnnotation/components/DisabledTooltip/index.mjs +23 -0
  16. package/dist/es/components/DetectionAnnotation/components/ImageDetail/index.mjs +166 -0
  17. package/dist/es/components/DetectionAnnotation/components/ImageDetail/style.less.mjs +4 -0
  18. package/dist/es/components/DetectionAnnotation/components/LabelMaker/Drawable.mjs +51 -0
  19. package/dist/es/components/DetectionAnnotation/components/LabelMaker/FabricCustomize.mjs +42 -0
  20. package/dist/es/components/DetectionAnnotation/components/LabelMaker/RectLabel.mjs +283 -0
  21. package/dist/es/components/DetectionAnnotation/components/LabelMaker/icons/delete-icon.svg.mjs +4 -0
  22. package/dist/es/components/DetectionAnnotation/components/LabelMaker/index.mjs +315 -0
  23. package/dist/es/components/DetectionAnnotation/components/LabelMaker/style.less.mjs +4 -0
  24. package/dist/es/components/DetectionAnnotation/components/Labels/index.mjs +201 -0
  25. package/dist/es/components/DetectionAnnotation/components/Labels/style.less.mjs +4 -0
  26. package/dist/es/components/DetectionAnnotation/components/TagItem/index.mjs +144 -0
  27. package/dist/es/components/DetectionAnnotation/components/TagItem/style.less.mjs +4 -0
  28. package/dist/es/components/DetectionAnnotation/icon_item_empty.svg.mjs +4 -0
  29. package/dist/es/components/DetectionAnnotation/index.mjs +713 -0
  30. package/dist/es/components/DetectionAnnotation/style.less.mjs +4 -0
  31. package/dist/es/components/DetectionImageAnnotation/index.mjs +62 -0
  32. package/dist/es/components/DetectionImageAnnotation/style.less.mjs +4 -0
  33. package/dist/es/components/Iconfont/index.mjs +16 -0
  34. package/dist/es/components/MarkDescriptions/index.mjs +66 -0
  35. package/dist/es/components/MarkDescriptions/style.less.mjs +4 -0
  36. package/dist/es/components/OCRImageViewer/index.mjs +213 -0
  37. package/dist/es/components/OCRImageViewer/style.less.mjs +4 -0
  38. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/CategoryDrawer.mjs +136 -0
  39. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorInput.mjs +57 -0
  40. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorItem.mjs +73 -0
  41. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LableEditor.mjs +55 -0
  42. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/index.mjs +366 -0
  43. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/style.less.mjs +4 -0
  44. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/index.mjs +255 -0
  45. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/style.less.mjs +4 -0
  46. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/ImageDetail/index.mjs +101 -0
  47. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/ImageDetail/style.less.mjs +4 -0
  48. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/images/delete.png.mjs +4 -0
  49. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/index.mjs +756 -0
  50. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/style.less.mjs +4 -0
  51. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/index.mjs +231 -0
  52. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/style.less.mjs +4 -0
  53. package/dist/es/components/OcrAnnotation/OcrModal/index.mjs +180 -0
  54. package/dist/es/components/OcrAnnotation/OcrModal/style.less.mjs +4 -0
  55. package/dist/es/components/OcrAnnotation/PreLabelOCR/PreLabelModal.mjs +281 -0
  56. package/dist/es/components/OcrAnnotation/PreLabelOCR/index.mjs +44 -0
  57. package/dist/es/components/OcrAnnotation/PreLabelOCR/style.less.mjs +4 -0
  58. package/dist/es/components/OcrAnnotation/constant.mjs +5 -0
  59. package/dist/es/components/OcrAnnotation/index.mjs +382 -0
  60. package/dist/es/components/OcrAnnotation/style.less.mjs +4 -0
  61. package/dist/es/components/OcrImageAnnotation/index.mjs +40 -0
  62. package/dist/es/components/OcrImageAnnotation/style.less.mjs +4 -0
  63. package/dist/es/components/PageNav/index.mjs +30 -0
  64. package/dist/es/components/PageNav/style.less.mjs +4 -0
  65. package/dist/es/components/PicZipImportModal/index.mjs +584 -0
  66. package/dist/es/components/PicZipImportModal/pic_zip.svg.mjs +4 -0
  67. package/dist/es/components/PicZipImportModal/pic_zip_json.svg.mjs +4 -0
  68. package/dist/es/components/PicZipImportModal/style.less.mjs +4 -0
  69. package/dist/es/components/PreLabelOCR/PreLabelModal.mjs +276 -0
  70. package/dist/es/components/PreLabelOCR/index.mjs +44 -0
  71. package/dist/es/components/PreLabelOCR/style.less.mjs +4 -0
  72. package/dist/es/components/ScanTable/index.mjs +97 -0
  73. package/dist/es/components/ScanTable/style.less.mjs +4 -0
  74. package/dist/es/components/Thumbnail/default.png.mjs +4 -0
  75. package/dist/es/components/Thumbnail/index.mjs +31 -0
  76. package/dist/es/components/Thumbnail/style.less.mjs +4 -0
  77. package/dist/es/components/hooks/Prompt.mjs +33 -0
  78. package/dist/es/constant.mjs +13 -0
  79. package/dist/es/createDatasetAnnotation/index.mjs +133 -0
  80. package/dist/es/createDetectionDatasetAnnotation/index.mjs +129 -0
  81. package/dist/es/createDetectionImageAnnotation/index.mjs +31 -0
  82. package/dist/es/createOcrDatasetAnnotation/index.mjs +129 -0
  83. package/dist/es/createOcrImageAnnotation/index.mjs +33 -0
  84. package/dist/es/featuresConfig.mjs +79 -0
  85. package/dist/es/index.mjs +13 -0
  86. package/dist/es/node_modules/@glodon-aiot/minio/dist/minio.mjs +28463 -0
  87. package/dist/es/utils/color.mjs +30 -0
  88. package/dist/es/utils/index.mjs +22 -0
  89. package/dist/es/utils/sign.mjs +33 -0
  90. package/dist/lib/index.js +130 -0
  91. package/dist/src/Common/Page/index.d.ts +1 -2
  92. package/dist/src/Common/PageHeader/index.d.ts +0 -1
  93. package/dist/src/DatasetContext/index.d.ts +3 -4
  94. package/dist/src/components/CompositionInput/index.d.ts +2 -2
  95. package/dist/src/components/DataEmpty/index.d.ts +1 -2
  96. package/dist/src/components/DetectionAnnotation/PreSamplesPage/index.d.ts +1 -2
  97. package/dist/src/components/DetectionAnnotation/components/DisabledTooltip/index.d.ts +2 -2
  98. package/dist/src/components/DetectionAnnotation/components/ImageDetail/index.d.ts +1 -2
  99. package/dist/src/components/DetectionAnnotation/components/LabelMaker/Drawable.d.ts +2 -2
  100. package/dist/src/components/DetectionAnnotation/components/LabelMaker/RectLabel.d.ts +6 -5
  101. package/dist/src/components/DetectionAnnotation/components/LabelMaker/index.d.ts +0 -1
  102. package/dist/src/components/DetectionAnnotation/components/Labels/index.d.ts +0 -1
  103. package/dist/src/components/DetectionAnnotation/components/TagItem/index.d.ts +1 -2
  104. package/dist/src/components/DetectionAnnotation/index.d.ts +1 -2
  105. package/dist/src/components/DetectionImageAnnotation/index.d.ts +0 -2
  106. package/dist/src/components/Iconfont/font_3140028_iptomfpgyu.d.ts +0 -0
  107. package/dist/src/components/Iconfont/font_3454453_gu5ijeufyng.d.ts +0 -0
  108. package/dist/src/components/Iconfont/font_4108228_3slzqhoow93.d.ts +0 -0
  109. package/dist/src/components/Iconfont/font_4439177_k3mjwv7kzfd.d.ts +0 -0
  110. package/dist/src/components/Iconfont/index.d.ts +1 -2
  111. package/dist/src/components/MarkDescriptions/index.d.ts +0 -1
  112. package/dist/src/components/OCRImageViewer/index.d.ts +1 -2
  113. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorInput.d.ts +2 -2
  114. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorItem.d.ts +1 -2
  115. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LableEditor.d.ts +0 -1
  116. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/index.d.ts +0 -1
  117. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/ImageDetail/index.d.ts +1 -2
  118. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/LabelEditorInput.d.ts +2 -2
  119. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/LabelEditorItem.d.ts +0 -1
  120. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/LableEditor.d.ts +0 -1
  121. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/index.d.ts +0 -1
  122. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/index.d.ts +0 -1
  123. package/dist/src/components/OcrAnnotation/OcrModal/index.d.ts +1 -2
  124. package/dist/src/components/OcrAnnotation/PreLabelOCR/PreLabelModal.d.ts +1 -2
  125. package/dist/src/components/OcrAnnotation/PreLabelOCR/index.d.ts +1 -2
  126. package/dist/src/components/OcrAnnotation/index.d.ts +1 -2
  127. package/dist/src/components/OcrImageAnnotation/index.d.ts +0 -2
  128. package/dist/src/components/PageNav/index.d.ts +1 -2
  129. package/dist/src/components/PicZipImportModal/index.d.ts +1 -2
  130. package/dist/src/components/PreLabelOCR/PreLabelModal.d.ts +1 -2
  131. package/dist/src/components/PreLabelOCR/index.d.ts +1 -2
  132. package/dist/src/components/ScanTable/index.d.ts +1 -2
  133. package/dist/src/components/Thumbnail/index.d.ts +1 -2
  134. package/dist/src/components/hooks/Prompt.d.ts +0 -1
  135. package/dist/src/components/hooks/useBlocker.d.ts +1 -1
  136. package/dist/src/featuresConfig.d.ts +1 -1
  137. package/dist/src/utils/sign.d.ts +1 -1
  138. package/package.json +15 -6
@@ -0,0 +1,315 @@
1
+ var J = Math.pow;
2
+ import { jsx as l, jsxs as Q } from "react/jsx-runtime";
3
+ import { useRef as se, useState as b, useEffect as g } from "react";
4
+ import { fabric as R } from "fabric";
5
+ import { useKeyPress as P } from "ahooks";
6
+ import "./style.less.mjs";
7
+ import le from "react-dom";
8
+ import { Spin as ce, Space as fe, Tooltip as X, Button as Z } from "antd";
9
+ import _ from "./RectLabel.mjs";
10
+ import { drawable as de } from "./Drawable.mjs";
11
+ import { ZoomInOutlined as ue, ZoomOutOutlined as me, DragOutlined as ge } from "@ant-design/icons";
12
+ import he from "classnames";
13
+ import { approxeq as L } from "../../../../utils/index.mjs";
14
+ const $ = (r) => {
15
+ r.off("mouse:down"), r.off("mouse:up");
16
+ }, k = (r) => {
17
+ var a, w, f;
18
+ let s = [];
19
+ (a = r.object) != null && a.aCoords && (s = [r.object.aCoords.tl, r.object.aCoords.tr, r.object.aCoords.br, r.object.aCoords.bl]);
20
+ const c = {
21
+ x: 0,
22
+ y: 0
23
+ }, d = {
24
+ width: 0,
25
+ height: 0
26
+ };
27
+ return r.canvas.backgroundImage && typeof r.canvas.backgroundImage != "string" && (c.x = ((w = r.canvas.backgroundImage.aCoords) == null ? void 0 : w.tl.x) || 0, c.y = ((f = r.canvas.backgroundImage.aCoords) == null ? void 0 : f.tl.y) || 0, d.width = r.canvas.backgroundImage.width || 0, d.height = r.canvas.backgroundImage.height || 0), {
28
+ id: r.config.id,
29
+ label: r.config.name,
30
+ color: r.config.color,
31
+ box: (s == null ? void 0 : s.map((u) => [L(u.x - c.x, 0) ? 0 : L(u.x - c.x, d.width) ? d.width : u.x - c.x, L(u.y - c.y, 0) ? 0 : L(u.y - c.y, d.height) ? d.height : u.y - c.y])) || []
32
+ };
33
+ }, Ne = (r) => {
34
+ const s = se(null), {
35
+ labels: c,
36
+ imageUrl: d,
37
+ pen: a,
38
+ onImageLoad: w,
39
+ onChange: f,
40
+ isPreLabel: u,
41
+ disabled: x,
42
+ renderLabelItem: O
43
+ } = r, [N, B] = b(!0), [e, T] = b(), [pe, V] = b({}), [y, U] = b(), [H, ee] = b({
44
+ left: 0,
45
+ top: 0
46
+ }), [te, S] = b([1, 1]), [j, K] = b(), [h, v] = b([]), [p, E] = b(x || !1), A = (t, o) => {
47
+ if (!e)
48
+ return;
49
+ o || (o = {
50
+ x: e.getCenter().left,
51
+ y: e.getCenter().top
52
+ });
53
+ let n = e.getZoom();
54
+ n *= J(0.999, t), n > 20 && (n = 20), n < 0.01 && (n = 0.01), e.zoomToPoint(
55
+ o,
56
+ n
57
+ // 传入修改后的缩放级别
58
+ ), S([n, n]);
59
+ };
60
+ g(() => {
61
+ h.forEach((t) => {
62
+ t.renderLabel();
63
+ });
64
+ }, [te, h, e]);
65
+ const W = (t) => {
66
+ var n;
67
+ if (((n = t.target) == null ? void 0 : n.tagName) === "INPUT" || !e)
68
+ return;
69
+ const o = e == null ? void 0 : e.getActiveObject();
70
+ o && v((i) => {
71
+ const I = i.findIndex((z) => z.object === o);
72
+ return i[I] && (i[I].destroy(), i.splice(I, 1)), f && f(i.map(k)), [...i];
73
+ });
74
+ };
75
+ P("Delete", W), P("Backspace", W), P("ctrl", () => {
76
+ E(!0);
77
+ }, {
78
+ events: ["keydown"]
79
+ }), P("ctrl", () => {
80
+ x || E(!1);
81
+ }, {
82
+ events: ["keyup"]
83
+ }), g(() => {
84
+ E(x || !1);
85
+ }, [x]);
86
+ const q = (t) => {
87
+ e && $(e), v((o) => {
88
+ const n = o.findIndex((i) => i === t);
89
+ return n > -1 && (o.splice(n, 1), f && f(o.map(k)), Y()), [...o];
90
+ });
91
+ }, F = (t) => {
92
+ v((o) => {
93
+ const n = o.findIndex((i) => i === t);
94
+ return n > -1 && (o[n] = t, f && f(o.map(k))), [...o];
95
+ });
96
+ };
97
+ g(() => {
98
+ if (!e)
99
+ return;
100
+ const t = [];
101
+ return c.filter((o) => o.color).forEach((o) => {
102
+ t.push(new _({
103
+ id: o.id,
104
+ name: o.label,
105
+ color: o.color,
106
+ points: o.box.map((n) => [n[0] + H.left, n[1] + H.top]),
107
+ hideDelete: u
108
+ }, e, {
109
+ onChange: F,
110
+ onDelete: q,
111
+ renderLabelItem: O ? (n) => O ? O(o) : n.name : void 0
112
+ }));
113
+ }), v(t), t.forEach((o) => {
114
+ o.render(e);
115
+ }), () => {
116
+ t.forEach((o) => {
117
+ o.canvas !== e && o.destroy();
118
+ });
119
+ };
120
+ }, [e, d]);
121
+ const Y = () => {
122
+ e && de(e, (t) => {
123
+ const o = new _({
124
+ id: (a == null ? void 0 : a.id) || t.id,
125
+ name: (a == null ? void 0 : a.label) || t.label,
126
+ color: (a == null ? void 0 : a.color) || t.color,
127
+ points: t.box.map((n) => [n[0], n[1]]),
128
+ hideDelete: u
129
+ }, e, {
130
+ onChange: F,
131
+ onDelete: q
132
+ });
133
+ o.active = !0, h.push(o), f && f(h.map(k)), v([...h]);
134
+ }, u);
135
+ }, oe = () => {
136
+ let t = !1;
137
+ e && (e.on("mouse:down", (o) => {
138
+ t = !0, e.selection = !1;
139
+ }), e.on("mouse:move", (o) => {
140
+ if (t && o && o.e) {
141
+ const n = new R.Point(o.e.movementX, o.e.movementY);
142
+ e.relativePan(n);
143
+ }
144
+ }), e.on("mouse:up", (o) => {
145
+ t = !1, e.selection = !0;
146
+ }));
147
+ }, ne = () => {
148
+ e && (e.off("mouse:down"), e.off("mouse:move"), e.off("mouse:up"));
149
+ };
150
+ g(() => {
151
+ if (e)
152
+ return p ? (oe(), e.defaultCursor = "grab", e.on("mouse:down:before", () => {
153
+ e.setCursor("grabbing");
154
+ }), e.on("mouse:up", () => {
155
+ e.defaultCursor = "grab";
156
+ }), e.getObjects(), v((t) => (t.forEach((o) => {
157
+ var n;
158
+ return (n = o.object) == null ? void 0 : n.set("evented", !1);
159
+ }), t))) : (e.defaultCursor = "default", e.off("mouse:down:before"), e.off("mouse:up"), e.setCursor("default"), v((t) => (t.forEach((o) => {
160
+ var n;
161
+ return (n = o.object) == null ? void 0 : n.set("evented", !0);
162
+ }), t)), Y()), () => {
163
+ ne();
164
+ };
165
+ }, [e, p]), g(() => {
166
+ if (e == null || e.on("mouse:wheel", (t) => {
167
+ const o = t.e.deltaY;
168
+ A(o, {
169
+ x: t.e.offsetX,
170
+ y: t.e.offsetY
171
+ }), h.forEach((n) => {
172
+ n.renderLabel();
173
+ });
174
+ }), !p)
175
+ return Y(), () => {
176
+ e && ($(e), e.off("mouse:wheel"));
177
+ };
178
+ }, [e, a, h, p]);
179
+ const re = () => {
180
+ V({}), U(void 0), S([1, 1]), e == null || e.dispose(), T(void 0);
181
+ };
182
+ return g(() => {
183
+ B(!0), re(), !(!s.current || !d) && R.Image.fromURL(d, (t) => {
184
+ t.set({
185
+ originX: "center",
186
+ originY: "center"
187
+ }), U(t), B(!1);
188
+ }, {
189
+ crossOrigin: "anonymous"
190
+ });
191
+ }, [d]), g(() => {
192
+ if (!y && e) {
193
+ try {
194
+ e.clear();
195
+ } catch (M) {
196
+ }
197
+ return;
198
+ }
199
+ if (!s.current || !s.current.parentElement)
200
+ return;
201
+ const t = y == null ? void 0 : y.getElement();
202
+ if (!(t != null && t.width) || !(t != null && t.height))
203
+ return;
204
+ const o = t.width / t.height, n = s.current.parentElement.offsetWidth, i = s.current.parentElement.offsetHeight, I = n / t.width, z = i / t.height;
205
+ let C = [n, i];
206
+ I > z ? C = [i * o, i] : C = [n, n / o];
207
+ const ae = C[0] / t.width, ie = C[1] / t.height, D = Math.min(ae, ie);
208
+ S([D, D]);
209
+ const m = new R.Canvas(s.current, {
210
+ containerClass: "marking-canvas",
211
+ width: n,
212
+ height: i
213
+ });
214
+ if (m == null || m.setZoom(D), m == null || m.renderAll(), m && y) {
215
+ const M = (n - C[0]) / D / 2, G = (i - C[1]) / D / 2;
216
+ m.setBackgroundImage(
217
+ y,
218
+ () => {
219
+ m.renderAll(), ee({
220
+ left: M,
221
+ top: G
222
+ }), T(m), w && w();
223
+ },
224
+ // 刷新画布
225
+ {
226
+ originX: "left",
227
+ originY: "top",
228
+ left: M,
229
+ top: G
230
+ }
231
+ );
232
+ }
233
+ }, [y]), g(() => {
234
+ h.length > c.length && h.forEach((t) => {
235
+ c.find((o) => o.id === t.config.id) || t.destroy();
236
+ });
237
+ }, [c.length]), g(() => {
238
+ e && (p || v((t) => {
239
+ const o = e == null ? void 0 : e.getActiveObject(), n = t.find((i) => i.object === o);
240
+ return n && a && (n.labelConfig = {
241
+ id: a.id,
242
+ name: a.label,
243
+ color: a.color
244
+ }, f && f(t.map(k))), e && (a ? e.defaultCursor = "copy" : e.defaultCursor = "default"), [...t];
245
+ }));
246
+ }, [a, e, p]), g(() => {
247
+ var t;
248
+ if (N && s.current && !j) {
249
+ const o = document.createElement("div");
250
+ o.setAttribute("style", "width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; position: absolute;top: 0;"), (t = s.current.parentElement) == null || t.appendChild(o), le.render(/* @__PURE__ */ l(ce, {}), o), K(o);
251
+ } else
252
+ !N && j && (j.remove(), K(null));
253
+ }, [N, s.current, j]), /* @__PURE__ */ Q("div", {
254
+ style: {
255
+ width: "100%",
256
+ height: "100%",
257
+ display: "flex"
258
+ },
259
+ children: [/* @__PURE__ */ l("div", {
260
+ className: "marker-toolbar",
261
+ children: /* @__PURE__ */ l("div", {
262
+ className: "create-mode-select",
263
+ children: /* @__PURE__ */ Q(fe, {
264
+ direction: "vertical",
265
+ size: 16,
266
+ children: [/* @__PURE__ */ l(X, {
267
+ title: "放大-鼠标滚轮前滑",
268
+ placement: "right",
269
+ children: /* @__PURE__ */ l(Z, {
270
+ icon: /* @__PURE__ */ l(ue, {}),
271
+ onClick: () => {
272
+ A(-100);
273
+ }
274
+ })
275
+ }), /* @__PURE__ */ l(X, {
276
+ title: "缩小-鼠标滚轮后滑",
277
+ placement: "right",
278
+ children: /* @__PURE__ */ l(Z, {
279
+ icon: /* @__PURE__ */ l(me, {}),
280
+ onClick: () => {
281
+ A(100);
282
+ }
283
+ })
284
+ }), !x && /* @__PURE__ */ l(X, {
285
+ title: "拖动-按住ctrl",
286
+ placement: "right",
287
+ children: /* @__PURE__ */ l(Z, {
288
+ disabled: x,
289
+ icon: /* @__PURE__ */ l(ge, {}),
290
+ className: p ? "active" : "",
291
+ onClick: () => {
292
+ E(!p);
293
+ }
294
+ })
295
+ })]
296
+ })
297
+ })
298
+ }), /* @__PURE__ */ l("div", {
299
+ className: he({
300
+ "label-maker-wrap": !0,
301
+ draggable: p
302
+ }),
303
+ onContextMenu: (t) => {
304
+ t.preventDefault();
305
+ },
306
+ children: /* @__PURE__ */ l("canvas", {
307
+ className: "label-maker-canvas",
308
+ ref: s
309
+ })
310
+ })]
311
+ });
312
+ };
313
+ export {
314
+ Ne as default
315
+ };
@@ -0,0 +1,4 @@
1
+ const t = "";
2
+ export {
3
+ t as default
4
+ };
@@ -0,0 +1,201 @@
1
+ var _ = Object.defineProperty, $ = Object.defineProperties;
2
+ var H = Object.getOwnPropertyDescriptors;
3
+ var P = Object.getOwnPropertySymbols;
4
+ var I = Object.prototype.hasOwnProperty, L = Object.prototype.propertyIsEnumerable;
5
+ var R = (i, o, s) => o in i ? _(i, o, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[o] = s, g = (i, o) => {
6
+ for (var s in o || (o = {}))
7
+ I.call(o, s) && R(i, s, o[s]);
8
+ if (P)
9
+ for (var s of P(o))
10
+ L.call(o, s) && R(i, s, o[s]);
11
+ return i;
12
+ }, N = (i, o) => $(i, H(o));
13
+ import { jsxs as h, jsx as a } from "react/jsx-runtime";
14
+ import { Row as B, Button as U, Input as ee, Space as te, Empty as ie, Modal as le } from "antd";
15
+ import { useState as m, useContext as re, useEffect as w } from "react";
16
+ import Z from "../TagItem/index.mjs";
17
+ import "./style.less.mjs";
18
+ import { PlusOutlined as oe } from "@ant-design/icons";
19
+ import q from "../DisabledTooltip/index.mjs";
20
+ import ne from "../../../../DatasetContext/index.mjs";
21
+ import { tagColors as k } from "../../../../utils/index.mjs";
22
+ import se from "../../../Iconfont/index.mjs";
23
+ const Ae = ({
24
+ datasetId: i,
25
+ data: o,
26
+ selected: s = [],
27
+ showZero: ce = !0,
28
+ shortcut: F = !1,
29
+ selectMode: G = "multiple",
30
+ onItemClick: y,
31
+ onSelectedChange: M,
32
+ onListChange: u,
33
+ isPreLabel: v = !1,
34
+ settingHide: C = !1
35
+ }) => {
36
+ const [n, A] = m([]), [ae, T] = m(!1), [r, p] = m([]), [j, z] = m(""), [x, S] = m(null), [D, J] = m(!1), {
37
+ services: {
38
+ cvforceDatahub: d
39
+ },
40
+ featuresConfig: {
41
+ labelManager: f
42
+ } = {
43
+ labelManager: !1
44
+ }
45
+ } = re(ne);
46
+ w(() => {
47
+ r.length && A(s.map((e) => r.find((t) => t.id === e.id)));
48
+ }, [s, r]), w(() => {
49
+ i && E();
50
+ }, [i]), w(() => {
51
+ !i && o && p(o.map((e) => N(g({}, e), {
52
+ createdAt: 0,
53
+ updatedAt: 0
54
+ })));
55
+ }, [i, o]);
56
+ const E = () => {
57
+ !i || !d || (T(!0), d.listLabels(i, {
58
+ pageNo: 1,
59
+ pageSize: 1e4
60
+ }).then((e) => {
61
+ p(e.recordList.sort((t, l) => t.createdAt - l.createdAt > 0 ? -1 : t.createdAt - l.createdAt < 0 ? 1 : 0).map((t, l) => N(g({}, t), {
62
+ color: k[l % 40]
63
+ })));
64
+ }).finally(() => T(!1)));
65
+ }, K = (e) => !i || !d ? Promise.resolve(!1) : d.postLabels(i, {
66
+ labels: [{
67
+ label: e
68
+ }]
69
+ }).then((t) => {
70
+ p([...r, {
71
+ label: e,
72
+ id: t[0],
73
+ color: k[r.length % 40],
74
+ createdAt: Date.now(),
75
+ updatedAt: Date.now()
76
+ }]), S(null), u && u([...r]);
77
+ }).then(() => !0).catch(() => !1), Q = (e) => {
78
+ let t = [];
79
+ G === "multiple" ? n != null && n.some((l) => l.id === e.id) ? t = n == null ? void 0 : n.filter((l) => l.id !== e.id) : t = [...n, e] : n != null && n.some((l) => l.id === e.id) ? t = [] : t = [e], A(t), M && M(t);
80
+ }, V = (e) => {
81
+ z(e);
82
+ }, W = (e) => {
83
+ if (!i || !d)
84
+ return Promise.resolve(!1);
85
+ const t = r.findIndex((l) => l.id === e.id);
86
+ return d.patchLabel(i, e.id, e).then(() => (t < 0 || (r[t] = e, p([...r]), u && u([...r])), !0)).catch(() => !1);
87
+ }, X = (e) => {
88
+ le.confirm({
89
+ title: "确认要删除当前标签吗?",
90
+ content: "删除后,将会删除当前数据集中所有与当前标签关联的数据,删除后无法恢复,请确认是否删除!",
91
+ onOk: () => {
92
+ if (!i || !d)
93
+ return;
94
+ const t = r.findIndex((c) => c.id === e), l = n.findIndex((c) => c.id === e);
95
+ return d.deleteLabel(i, e).then(() => {
96
+ l > -1 && (n.splice(l, 1), A([...n])), r.splice(t, 1), p([...r]), u && u([...r]), E();
97
+ });
98
+ }
99
+ });
100
+ }, b = (r == null ? void 0 : r.filter((e) => !j || e.label.includes(j))) || [];
101
+ return /* @__PURE__ */ h("div", {
102
+ className: "label-list-wrap",
103
+ children: [/* @__PURE__ */ h(B, {
104
+ justify: "space-between",
105
+ className: "label-list-title",
106
+ children: [/* @__PURE__ */ a("span", {
107
+ className: "label-list-title",
108
+ children: "标签列表"
109
+ }), /* @__PURE__ */ a("span", {
110
+ className: "label-list-icon",
111
+ children: !C && f && f.visible && /* @__PURE__ */ a(q, {
112
+ isPreLabel: v,
113
+ placement: "topRight",
114
+ children: /* @__PURE__ */ a(U, {
115
+ type: D ? "link" : "text",
116
+ size: "small",
117
+ onClick: () => J(!D),
118
+ icon: /* @__PURE__ */ a(se, {
119
+ type: "icon-shezhi"
120
+ }),
121
+ disabled: v
122
+ })
123
+ })
124
+ })]
125
+ }), /* @__PURE__ */ h(B, {
126
+ className: "label-list-opration",
127
+ children: [!C && f && f.add && /* @__PURE__ */ a(q, {
128
+ isPreLabel: v,
129
+ children: /* @__PURE__ */ a(U, {
130
+ className: "label-list-create",
131
+ type: "default",
132
+ icon: /* @__PURE__ */ a(oe, {}),
133
+ disabled: x !== null || v,
134
+ onClick: () => {
135
+ S({
136
+ color: k[r.length % 40],
137
+ label: ""
138
+ });
139
+ }
140
+ })
141
+ }), /* @__PURE__ */ a("span", {
142
+ className: "label-list-search",
143
+ children: /* @__PURE__ */ a(ee.Search, {
144
+ placeholder: "请输入标签名称搜索",
145
+ onSearch: V,
146
+ onChange: (e) => {
147
+ z(e.target.value);
148
+ }
149
+ })
150
+ })]
151
+ }), /* @__PURE__ */ h(te, {
152
+ direction: "vertical",
153
+ className: "label-list",
154
+ children: [x && /* @__PURE__ */ a(Z, {
155
+ onSave: K,
156
+ onCancel: () => {
157
+ S(null);
158
+ },
159
+ label: x.label || "",
160
+ color: x.color || "",
161
+ editMode: !0,
162
+ isActive: !1,
163
+ onCheckDuplication: (e) => {
164
+ const t = b.findIndex((l) => l.label === e);
165
+ return Promise.resolve(t > -1);
166
+ }
167
+ }), b.length ? b.reverse().map((e, t) => {
168
+ var l;
169
+ return /* @__PURE__ */ a(Z, {
170
+ isActive: n.some((c) => (c == null ? void 0 : c.id) === e.id),
171
+ editable: D,
172
+ shortcut: t < 10 ? t.toString() : void 0,
173
+ extra: F ? t < 10 ? /* @__PURE__ */ h("span", {
174
+ className: "shortcut",
175
+ children: ["快捷键", t]
176
+ }) : null : ((l = o.find((c) => c.label === e.label)) == null ? void 0 : l.count) || 0,
177
+ label: e.label,
178
+ color: e.color,
179
+ onClick: () => {
180
+ Q(e), y && y(e);
181
+ },
182
+ onSave: f && f.edit ? (c) => W(N(g({}, e), {
183
+ label: c
184
+ })) : void 0,
185
+ onDelete: f && f.delete ? () => X(e.id) : void 0,
186
+ onCheckDuplication: (c) => {
187
+ const Y = b.findIndex((O) => O.label === c && e.id !== O.id);
188
+ return Promise.resolve(Y > -1);
189
+ }
190
+ }, e.id);
191
+ }) : /* @__PURE__ */ a(ie, {
192
+ className: "label-list-empty",
193
+ image: !1,
194
+ description: "请先添加标签,然后在图中框选标注"
195
+ })]
196
+ })]
197
+ });
198
+ };
199
+ export {
200
+ Ae as default
201
+ };
@@ -0,0 +1,4 @@
1
+ const t = "";
2
+ export {
3
+ t as default
4
+ };
@@ -0,0 +1,144 @@
1
+ import { jsxs as d, jsx as t } from "react/jsx-runtime";
2
+ import { useState as h, useRef as K, useEffect as O } from "react";
3
+ import E from "classnames";
4
+ import "./style.less.mjs";
5
+ import { Tooltip as S, Input as R, Space as I, Button as p } from "antd";
6
+ import { CheckOutlined as U, CloseOutlined as W } from "@ant-design/icons";
7
+ import { useKeyPress as P } from "ahooks";
8
+ import _ from "../../../Iconfont/index.mjs";
9
+ const H = (j) => {
10
+ const {
11
+ label: o,
12
+ color: g,
13
+ isActive: C = !1,
14
+ extra: A,
15
+ editMode: T = !1,
16
+ editable: $ = !1,
17
+ shortcut: f,
18
+ onClick: l,
19
+ onSave: a,
20
+ onCancel: k,
21
+ onDelete: u,
22
+ onCheckDuplication: N
23
+ } = j, [y, r] = h(T), [e, x] = h(o), [c, i] = h(""), m = K(null), b = (n) => {
24
+ var s;
25
+ ((s = n.target) == null ? void 0 : s.tagName) === "INPUT" || f === void 0 || l && l();
26
+ };
27
+ P(f || "", b), P(`Numpad${f}` || "", b);
28
+ const z = () => {
29
+ if (!(e != null && e.length)) {
30
+ i("标签名称不能为空");
31
+ return;
32
+ }
33
+ if ((e == null ? void 0 : e.length) > 256) {
34
+ i("标签名称不能超过256字符");
35
+ return;
36
+ }
37
+ if (!/^[\u4e00-\u9fa5A-Za-z0-9_]+$/.test(e)) {
38
+ i("标签名称不能含特殊符号");
39
+ return;
40
+ }
41
+ N ? N(e).then((s) => {
42
+ s ? i("标签名称已存在") : a && a(e).then((D) => {
43
+ r(!D);
44
+ });
45
+ }) : a && a(e).then((s) => {
46
+ r(!s);
47
+ });
48
+ }, v = () => {
49
+ r(!1), x(o), k && k();
50
+ };
51
+ return O(() => {
52
+ if (!e)
53
+ return;
54
+ const n = /^[\u4e00-\u9fa5A-Za-z0-9_]+$/;
55
+ (e == null ? void 0 : e.length) > 256 ? i("标签名称不能超过256字符") : n.test(e) ? i("") : i("标签名称不能含特殊符号");
56
+ }, [e]), /* @__PURE__ */ d("div", {
57
+ className: E({
58
+ "tag-item": !0,
59
+ "tag-item__active": C
60
+ }),
61
+ style: {
62
+ backgroundColor: g + (C ? "60" : "14")
63
+ // 底色透明度
64
+ },
65
+ onClick: () => {
66
+ l && l();
67
+ },
68
+ children: [/* @__PURE__ */ t("span", {
69
+ className: "tag-item-decorate-line",
70
+ style: {
71
+ borderColor: g
72
+ }
73
+ }), y ? /* @__PURE__ */ d("div", {
74
+ className: "editing",
75
+ onClick: (n) => n.stopPropagation(),
76
+ children: [/* @__PURE__ */ t(S, {
77
+ open: !!c,
78
+ title: c,
79
+ children: /* @__PURE__ */ t(R, {
80
+ value: e,
81
+ autoFocus: !0,
82
+ onChange: (n) => {
83
+ x(n.target.value);
84
+ },
85
+ className: E({
86
+ error: c
87
+ }),
88
+ onKeyUp: (n) => {
89
+ n.key === "Enter" ? z() : n.key === "Escape" && v();
90
+ }
91
+ })
92
+ }), /* @__PURE__ */ d(I, {
93
+ size: 4,
94
+ className: "editing-operation",
95
+ children: [/* @__PURE__ */ t(p, {
96
+ className: "save-btn",
97
+ type: "text",
98
+ size: "small",
99
+ disabled: !!c || !e,
100
+ icon: /* @__PURE__ */ t(U, {}),
101
+ onClick: z
102
+ }), /* @__PURE__ */ t(p, {
103
+ className: "cancel-btn",
104
+ type: "text",
105
+ size: "small",
106
+ icon: /* @__PURE__ */ t(W, {}),
107
+ onClick: v
108
+ })]
109
+ })]
110
+ }) : /* @__PURE__ */ t(S, {
111
+ title: o === "nocode" ? "无标签" : o,
112
+ open: m.current && m.current.scrollWidth > m.current.clientWidth ? void 0 : !1,
113
+ children: /* @__PURE__ */ t("span", {
114
+ className: "tag-item-name",
115
+ ref: m,
116
+ children: o === "nocode" ? "无标签" : o
117
+ })
118
+ }), !y && /* @__PURE__ */ t("span", {
119
+ className: "tag-item-extra",
120
+ children: $ ? /* @__PURE__ */ d(I, {
121
+ className: "item-operations",
122
+ onClick: (n) => n.stopPropagation(),
123
+ children: [a && /* @__PURE__ */ t(p, {
124
+ type: "link",
125
+ size: "small",
126
+ icon: /* @__PURE__ */ t(_, {
127
+ type: "icon-bianji2"
128
+ }),
129
+ onClick: () => r(!0)
130
+ }), u && /* @__PURE__ */ t(p, {
131
+ type: "link",
132
+ size: "small",
133
+ icon: /* @__PURE__ */ t(_, {
134
+ type: "icon-del"
135
+ }),
136
+ onClick: () => u && u()
137
+ })]
138
+ }) : A
139
+ })]
140
+ });
141
+ };
142
+ export {
143
+ H as default
144
+ };
@@ -0,0 +1,4 @@
1
+ const t = "";
2
+ export {
3
+ t as default
4
+ };
@@ -0,0 +1,4 @@
1
+ const M = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODIiIGhlaWdodD0iOTAiIHZpZXdCb3g9IjAgMCA4MiA5MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yOS4xMiA2MC4zMTAxQzI5LjA0IDYwLjg2MDEgMjkgNjEuNDMgMjkgNjJDMjkgNjguNjMgMzQuMzcgNzQgNDEgNzRDNDcuNjMgNzQgNTMgNjguNjMgNTMgNjJD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