@glodon-aiot/dataset-annotation 3.2.2-beta.3 → 3.2.10-beta.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 (137) hide show
  1. package/dist/dataset-annotation.js +12191 -12198
  2. package/dist/dataset-annotation.umd.cjs +135 -135
  3. package/dist/es/Common/Page/index.mjs +29 -0
  4. package/dist/es/Common/Page/style.less.mjs +4 -0
  5. package/dist/es/Common/PageContent/index.mjs +18 -0
  6. package/dist/es/Common/PageHeader/index.mjs +39 -0
  7. package/dist/es/Common/PageHeader/style.less.mjs +4 -0
  8. package/dist/es/DatasetContext/index.mjs +11 -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/utils/color.mjs +30 -0
  87. package/dist/es/utils/index.mjs +22 -0
  88. package/dist/es/utils/sign.mjs +33 -0
  89. package/dist/lib/index.js +3 -0
  90. package/dist/src/Common/Page/index.d.ts +1 -2
  91. package/dist/src/Common/PageHeader/index.d.ts +0 -1
  92. package/dist/src/DatasetContext/index.d.ts +3 -4
  93. package/dist/src/components/CompositionInput/index.d.ts +2 -2
  94. package/dist/src/components/DataEmpty/index.d.ts +1 -2
  95. package/dist/src/components/DetectionAnnotation/PreSamplesPage/index.d.ts +1 -2
  96. package/dist/src/components/DetectionAnnotation/components/DisabledTooltip/index.d.ts +2 -2
  97. package/dist/src/components/DetectionAnnotation/components/ImageDetail/index.d.ts +1 -2
  98. package/dist/src/components/DetectionAnnotation/components/LabelMaker/Drawable.d.ts +2 -2
  99. package/dist/src/components/DetectionAnnotation/components/LabelMaker/RectLabel.d.ts +6 -5
  100. package/dist/src/components/DetectionAnnotation/components/LabelMaker/index.d.ts +0 -1
  101. package/dist/src/components/DetectionAnnotation/components/Labels/index.d.ts +0 -1
  102. package/dist/src/components/DetectionAnnotation/components/TagItem/index.d.ts +1 -2
  103. package/dist/src/components/DetectionAnnotation/index.d.ts +1 -2
  104. package/dist/src/components/DetectionImageAnnotation/index.d.ts +0 -2
  105. package/dist/src/components/Iconfont/font_3140028_iptomfpgyu.d.ts +0 -0
  106. package/dist/src/components/Iconfont/font_3454453_gu5ijeufyng.d.ts +0 -0
  107. package/dist/src/components/Iconfont/font_4108228_3slzqhoow93.d.ts +0 -0
  108. package/dist/src/components/Iconfont/font_4439177_k3mjwv7kzfd.d.ts +0 -0
  109. package/dist/src/components/Iconfont/index.d.ts +1 -2
  110. package/dist/src/components/MarkDescriptions/index.d.ts +0 -1
  111. package/dist/src/components/OCRImageViewer/index.d.ts +1 -2
  112. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorInput.d.ts +2 -2
  113. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LabelEditorItem.d.ts +1 -2
  114. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/LableEditor.d.ts +0 -1
  115. package/dist/src/components/OcrAnnotation/MarkKVOCRModal/index.d.ts +0 -1
  116. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/ImageDetail/index.d.ts +1 -2
  117. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/LabelEditorInput.d.ts +2 -2
  118. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/LabelEditorItem.d.ts +0 -1
  119. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/LableEditor.d.ts +0 -1
  120. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/index.d.ts +0 -1
  121. package/dist/src/components/OcrAnnotation/MarkOCRBoxModal/index.d.ts +0 -1
  122. package/dist/src/components/OcrAnnotation/OcrModal/index.d.ts +1 -2
  123. package/dist/src/components/OcrAnnotation/PreLabelOCR/PreLabelModal.d.ts +1 -2
  124. package/dist/src/components/OcrAnnotation/PreLabelOCR/index.d.ts +1 -2
  125. package/dist/src/components/OcrAnnotation/index.d.ts +1 -2
  126. package/dist/src/components/OcrImageAnnotation/index.d.ts +0 -2
  127. package/dist/src/components/PageNav/index.d.ts +1 -2
  128. package/dist/src/components/PicZipImportModal/index.d.ts +1 -2
  129. package/dist/src/components/PreLabelOCR/PreLabelModal.d.ts +1 -2
  130. package/dist/src/components/PreLabelOCR/index.d.ts +1 -2
  131. package/dist/src/components/ScanTable/index.d.ts +1 -2
  132. package/dist/src/components/Thumbnail/index.d.ts +1 -2
  133. package/dist/src/components/hooks/Prompt.d.ts +0 -1
  134. package/dist/src/components/hooks/useBlocker.d.ts +1 -1
  135. package/dist/src/featuresConfig.d.ts +1 -1
  136. package/dist/src/utils/sign.d.ts +1 -1
  137. package/package.json +18 -8
@@ -0,0 +1,66 @@
1
+ import { jsxs as o, jsx as a, Fragment as h } from "react/jsx-runtime";
2
+ import { useState as n, useEffect as l } from "react";
3
+ import k from "lodash/groupBy";
4
+ import "./style.less.mjs";
5
+ const v = ({
6
+ labels: i = [],
7
+ catagory: t
8
+ }) => {
9
+ const [r, m] = n([]), [c, d] = n([]);
10
+ return l(() => {
11
+ const s = k(i, (e) => e.type);
12
+ m(s.key), d(s.value);
13
+ }, [i]), /* @__PURE__ */ o("div", {
14
+ className: "mark-description-wrap",
15
+ children: [/* @__PURE__ */ a("div", {
16
+ className: "mark-description-name",
17
+ children: t.name
18
+ }), /* @__PURE__ */ a("div", {
19
+ className: "mark-description-keys",
20
+ children: r == null ? void 0 : r.map((s) => /* @__PURE__ */ a("div", {
21
+ children: s.words
22
+ }))
23
+ }), /* @__PURE__ */ a("div", {
24
+ className: "mark-description-values",
25
+ children: c == null ? void 0 : c.map((s) => /* @__PURE__ */ a("div", {
26
+ children: s.words
27
+ }))
28
+ })]
29
+ });
30
+ }, w = ({
31
+ labels: i = [],
32
+ catagories: t = []
33
+ }) => {
34
+ var s;
35
+ const [r, m] = n({}), [c, d] = n({});
36
+ return l(() => {
37
+ m(k(i, (e) => e.catagoryId));
38
+ }, [i]), l(() => {
39
+ const e = {};
40
+ t.forEach((p) => e[p.id] = p.name), d(e);
41
+ }, [t]), r ? /* @__PURE__ */ o("div", {
42
+ className: "mark-descriptions-wrap",
43
+ children: [/* @__PURE__ */ o("div", {
44
+ className: "mark-description-wrap mark-descriptions-header",
45
+ children: [/* @__PURE__ */ a("div", {
46
+ className: "mark-description-name",
47
+ children: "字段名称"
48
+ }), /* @__PURE__ */ a("div", {
49
+ className: "mark-description-keys",
50
+ children: "Key"
51
+ }), /* @__PURE__ */ a("div", {
52
+ className: "mark-description-values",
53
+ children: "Value"
54
+ })]
55
+ }), (s = Object.keys(r)) == null ? void 0 : s.map((e) => /* @__PURE__ */ a(v, {
56
+ labels: r[e],
57
+ catagory: {
58
+ id: e,
59
+ name: c[e]
60
+ }
61
+ }))]
62
+ }) : /* @__PURE__ */ a(h, {});
63
+ };
64
+ export {
65
+ w as default
66
+ };
@@ -0,0 +1,4 @@
1
+ const t = "";
2
+ export {
3
+ t as default
4
+ };
@@ -0,0 +1,213 @@
1
+ import { jsxs as E, jsx as s } from "react/jsx-runtime";
2
+ import { forwardRef as pt, useRef as _, useState as i, useEffect as vt, useImperativeHandle as It } from "react";
3
+ import "./style.less.mjs";
4
+ import Mt from "classnames";
5
+ import { Space as wt, Tooltip as k, Button as L } from "antd";
6
+ import { ZoomInOutlined as xt, ZoomOutOutlined as yt, DragOutlined as St } from "@ant-design/icons";
7
+ import { useKeyPress as tt } from "ahooks";
8
+ const Dt = pt((O, et) => {
9
+ var Q;
10
+ const {
11
+ url: R,
12
+ offsetEdge: ot = [50, 50, 50, 50],
13
+ zoomable: b = !0,
14
+ zoomStep: p = 0.02,
15
+ zoomMax: v = 2,
16
+ zoomMin: I = 0,
17
+ onImageLoad: X,
18
+ labels: N
19
+ } = O, M = _({}), w = _({}), [j, nt] = i(0), [B, st] = i(0), [l, P] = i(1), [u, f] = i(0), [g, d] = i(0), [r, z] = i(0), [c, D] = i(0), [it, U] = i(!1), [Z, x] = i(!1), [$, rt] = i(), [y, S] = i({
20
+ x: 0,
21
+ y: 0
22
+ }), [q, K, V, A] = ot, [a, T] = i((Q = O.draggable) != null ? Q : !0);
23
+ tt("ctrl", () => {
24
+ T(!0);
25
+ }, {
26
+ events: ["keydown"]
27
+ }), tt("ctrl", () => {
28
+ T(!1);
29
+ }, {
30
+ events: ["keyup"]
31
+ }), vt(() => {
32
+ U(!1);
33
+ }, [R]);
34
+ const F = () => {
35
+ if (!w.current)
36
+ return;
37
+ const t = w.current.clientWidth, e = w.current.clientHeight, o = M.current.naturalWidth, n = M.current.naturalHeight, m = t / o, H = e / n, h = m < H ? m : H, mt = (t - o * h) / 2, ft = (e - n * h) / 2, dt = o * h, ht = n * h;
38
+ nt(t), st(e), P(h), f(mt), d(ft), z(dt), D(ht), U(!0), X && X(M.current);
39
+ }, C = () => {
40
+ if (!b || l >= v)
41
+ return;
42
+ let t = l * (1 + p), e = p;
43
+ t >= v && (t = v, e = v / l - 1), f(u - r * (e / 2)), d(g - c * (e / 2)), z(r + r * e), D(c + c * e), P(t), Y();
44
+ }, W = () => {
45
+ if (!b || l <= I)
46
+ return;
47
+ let t = l * (1 - p), e = p;
48
+ t <= I && (t = I, e = 1 - I / l), f(u - r * (-e / 2)), d(g - c * (-e / 2)), z(r + r * -e), D(c + c * -e), P(t), Y();
49
+ };
50
+ It(et, () => ({
51
+ zoomIn: C,
52
+ zoomOut: W,
53
+ onImageLoad: X
54
+ }));
55
+ const ct = (t) => (t.deltaY < 0 ? C() : W(), !1), at = (t) => {
56
+ x(!0);
57
+ const {
58
+ pageX: e,
59
+ pageY: o
60
+ } = t;
61
+ S({
62
+ x: e,
63
+ y: o
64
+ });
65
+ }, lt = (t) => {
66
+ if (!Z)
67
+ return !1;
68
+ const {
69
+ pageX: e,
70
+ pageY: o
71
+ } = t, n = e - y.x, m = o - y.y;
72
+ S({
73
+ x: e,
74
+ y: o
75
+ }), f(u + n), d(g + m), Y();
76
+ }, G = () => {
77
+ x(!1);
78
+ };
79
+ window.onmouseup = () => {
80
+ x(!1);
81
+ }, window.onresize = F;
82
+ const Y = () => {
83
+ u < -r + A && f(-r + A), g < -c + q && d(-c + q), u > j - K && f(j - K), g > B - V && d(B - V);
84
+ }, ut = (t) => {
85
+ const {
86
+ touches: e
87
+ } = t;
88
+ if (x(!0), e.length < 2) {
89
+ const {
90
+ clientX: o,
91
+ clientY: n
92
+ } = e[0];
93
+ S({
94
+ x: o,
95
+ y: n
96
+ });
97
+ } else
98
+ rt(e);
99
+ }, gt = (t) => {
100
+ if (!Z || !t.touches)
101
+ return !1;
102
+ const {
103
+ clientX: e,
104
+ clientY: o
105
+ } = t.touches[0];
106
+ if (t.touches.length < 2) {
107
+ const n = e - y.x, m = o - y.y;
108
+ S({
109
+ x: e,
110
+ y: o
111
+ }), f(u + n), d(g + m), Y();
112
+ } else {
113
+ const n = t.touches, m = J(n[0], n[1]), H = J($[0], $[1]);
114
+ m > H ? C() : W();
115
+ }
116
+ }, J = (t, e) => {
117
+ const o = e.pageX - t.pageX, n = e.pageY - t.pageY;
118
+ return Math.sqrt(o * o + n * n);
119
+ };
120
+ return /* @__PURE__ */ E("div", {
121
+ className: "ocr-image-viewer",
122
+ children: [/* @__PURE__ */ s("div", {
123
+ className: "marker-toolbar",
124
+ children: /* @__PURE__ */ s("div", {
125
+ className: "create-mode-select",
126
+ children: /* @__PURE__ */ E(wt, {
127
+ direction: "vertical",
128
+ size: 16,
129
+ children: [/* @__PURE__ */ s(k, {
130
+ title: "放大-鼠标滚轮前滑",
131
+ placement: "right",
132
+ children: /* @__PURE__ */ s(L, {
133
+ icon: /* @__PURE__ */ s(xt, {}),
134
+ onClick: () => {
135
+ C();
136
+ }
137
+ })
138
+ }), /* @__PURE__ */ s(k, {
139
+ title: "缩小-鼠标滚轮后滑",
140
+ placement: "right",
141
+ children: /* @__PURE__ */ s(L, {
142
+ icon: /* @__PURE__ */ s(yt, {}),
143
+ onClick: () => {
144
+ W();
145
+ }
146
+ })
147
+ }), /* @__PURE__ */ s(k, {
148
+ title: "拖动-按住ctrl",
149
+ placement: "right",
150
+ children: /* @__PURE__ */ s(L, {
151
+ icon: /* @__PURE__ */ s(St, {}),
152
+ className: a ? "active" : "",
153
+ onClick: () => {
154
+ T(!a);
155
+ }
156
+ })
157
+ })]
158
+ })
159
+ })
160
+ }), /* @__PURE__ */ E("div", {
161
+ className: Mt({
162
+ "image-map": !0,
163
+ draggable: a
164
+ }),
165
+ ref: w,
166
+ onMouseDown: a ? at : void 0,
167
+ onMouseMove: a ? lt : void 0,
168
+ onMouseUp: a ? G : void 0,
169
+ onWheel: ct,
170
+ onTouchStart: a ? ut : void 0,
171
+ onTouchMove: a ? gt : void 0,
172
+ onTouchEnd: a ? G : void 0,
173
+ onContextMenu: (t) => {
174
+ t.preventDefault();
175
+ },
176
+ children: [/* @__PURE__ */ s("img", {
177
+ draggable: "false",
178
+ className: "img",
179
+ style: {
180
+ position: "absolute",
181
+ left: u,
182
+ top: g,
183
+ width: r,
184
+ height: c
185
+ },
186
+ ref: M,
187
+ onLoad: F,
188
+ src: R,
189
+ alt: ""
190
+ }), it ? /* @__PURE__ */ s("svg", {
191
+ style: {
192
+ position: "absolute",
193
+ left: u,
194
+ top: g,
195
+ width: r,
196
+ height: c
197
+ },
198
+ children: N == null ? void 0 : N.map((t, e) => {
199
+ var o;
200
+ return /* @__PURE__ */ s("g", {
201
+ children: /* @__PURE__ */ s("polygon", {
202
+ className: "label-box",
203
+ points: (o = t == null ? void 0 : t.box) == null ? void 0 : o.map((n) => `${n[0] * l} ${n[1] * l}`).join(",")
204
+ }, t.id)
205
+ }, e);
206
+ })
207
+ }) : ""]
208
+ })]
209
+ });
210
+ });
211
+ export {
212
+ Dt as default
213
+ };
@@ -0,0 +1,4 @@
1
+ const t = "";
2
+ export {
3
+ t as default
4
+ };
@@ -0,0 +1,136 @@
1
+ var O = Object.defineProperty;
2
+ var g = Object.getOwnPropertySymbols;
3
+ var V = Object.prototype.hasOwnProperty, q = Object.prototype.propertyIsEnumerable;
4
+ var x = (i, e, n) => e in i ? O(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n, u = (i, e) => {
5
+ for (var n in e || (e = {}))
6
+ V.call(e, n) && x(i, n, e[n]);
7
+ if (g)
8
+ for (var n of g(e))
9
+ q.call(e, n) && x(i, n, e[n]);
10
+ return i;
11
+ };
12
+ import { jsxs as p, jsx as s } from "react/jsx-runtime";
13
+ import { Form as h, Drawer as A, Space as y, Button as B, Table as E, Modal as F, Input as T } from "antd";
14
+ import { useState as C, useContext as U, useEffect as k } from "react";
15
+ import Z from "../../../DatasetContext/index.mjs";
16
+ const N = (i) => {
17
+ const {
18
+ datasetId: e,
19
+ visible: n,
20
+ onClose: S
21
+ } = i, [w, c] = C(!1), [I, M] = C([]), [o, a] = C(null), [r] = h.useForm(), {
22
+ services: {
23
+ cvforceDatahub: l
24
+ },
25
+ featuresConfig: {
26
+ labelManager: $
27
+ } = {
28
+ labelManager: !1
29
+ }
30
+ } = U(Z), _ = (t) => {
31
+ F.confirm({
32
+ title: "确认要删除吗?",
33
+ content: "删除后不可恢复,请谨慎操做!",
34
+ onOk: () => l == null ? void 0 : l.deleteCategory(e, t).then(() => {
35
+ m(), c(!0);
36
+ })
37
+ });
38
+ }, j = [{
39
+ title: "字段名称",
40
+ dataIndex: "name",
41
+ key: "name"
42
+ }, {
43
+ title: /* @__PURE__ */ s("div", {
44
+ style: {
45
+ padding: "0px 7px"
46
+ },
47
+ children: "操作"
48
+ }),
49
+ dataIndex: "id",
50
+ key: "action",
51
+ width: 100,
52
+ render: (t, d) => /* @__PURE__ */ p(y, {
53
+ children: [/* @__PURE__ */ s("a", {
54
+ onClick: () => a(d),
55
+ children: "编辑"
56
+ }), /* @__PURE__ */ s("a", {
57
+ onClick: () => _(t),
58
+ children: "删除"
59
+ })]
60
+ })
61
+ }], z = (t) => {
62
+ function d() {
63
+ m(), a(null);
64
+ }
65
+ t.id ? l == null || l.updateCategory(e, t.id, t.name).then(d).then(() => {
66
+ c(!0);
67
+ }) : l == null || l.postCategory(e, t.name).then(d).then(() => {
68
+ c(!0);
69
+ });
70
+ }, m = () => l == null ? void 0 : l.listCategory(e).then((t) => M(t));
71
+ k(() => {
72
+ m();
73
+ }, []), k(() => {
74
+ o ? r.setFieldsValue(o) : r.resetFields();
75
+ }, [o]);
76
+ const f = () => {
77
+ r.validateFields().then((t) => {
78
+ r.resetFields(), z(u(u({}, o), t));
79
+ }).catch((t) => {
80
+ console.log("Validate Failed:", t);
81
+ });
82
+ };
83
+ return /* @__PURE__ */ p(A, {
84
+ title: "字段管理",
85
+ open: n,
86
+ width: "33.33%",
87
+ onClose: () => {
88
+ S(w);
89
+ },
90
+ children: [/* @__PURE__ */ p(y, {
91
+ direction: "vertical",
92
+ size: 16,
93
+ style: {
94
+ width: "100%"
95
+ },
96
+ children: [/* @__PURE__ */ s(B, {
97
+ type: "primary",
98
+ onClick: () => a({}),
99
+ children: "+ 添加字段"
100
+ }), /* @__PURE__ */ s(E, {
101
+ columns: j,
102
+ dataSource: I
103
+ })]
104
+ }), /* @__PURE__ */ s(F, {
105
+ title: o != null && o.id ? "编辑字段" : "添加字段",
106
+ open: !!o,
107
+ onCancel: () => a(null),
108
+ onOk: f,
109
+ children: /* @__PURE__ */ s(h, {
110
+ form: r,
111
+ onFinish: f,
112
+ children: /* @__PURE__ */ s(h.Item, {
113
+ label: "字段名称",
114
+ name: "name",
115
+ rules: [{
116
+ required: !0
117
+ }, {
118
+ type: "string",
119
+ max: 256,
120
+ message: "长度不超过256字符"
121
+ }, {
122
+ pattern: /^[\u4e00-\u9fa50-9a-zA-Z\-_]*$/,
123
+ message: "仅支持中英文、数字、“-”、“_”"
124
+ }],
125
+ children: /* @__PURE__ */ s(T, {
126
+ placeholder: "仅支持中英文、数字、“-”、“_”,长度不超过256字符",
127
+ autoFocus: !0
128
+ })
129
+ })
130
+ })
131
+ })]
132
+ });
133
+ };
134
+ export {
135
+ N as default
136
+ };
@@ -0,0 +1,57 @@
1
+ var m = Object.defineProperty, w = Object.defineProperties;
2
+ var x = Object.getOwnPropertyDescriptors;
3
+ var f = Object.getOwnPropertySymbols;
4
+ var h = Object.prototype.hasOwnProperty, L = Object.prototype.propertyIsEnumerable;
5
+ var l = (r, o, e) => o in r ? m(r, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[o] = e, n = (r, o) => {
6
+ for (var e in o || (o = {}))
7
+ h.call(o, e) && l(r, e, o[e]);
8
+ if (f)
9
+ for (var e of f(o))
10
+ L.call(o, e) && l(r, e, o[e]);
11
+ return r;
12
+ }, d = (r, o) => w(r, x(o));
13
+ import { jsx as C } from "react/jsx-runtime";
14
+ import { Input as E } from "antd";
15
+ import { useState as b, useEffect as H } from "react";
16
+ const B = (r) => {
17
+ const {
18
+ value: o,
19
+ holdingLabel: e,
20
+ clearHoldingLabel: i,
21
+ onChange: s,
22
+ onSelect: c,
23
+ selected: I
24
+ } = r, [g, u] = b(o == null ? void 0 : o.words), [p, a] = b(!1);
25
+ return H(() => {
26
+ u(o == null ? void 0 : o.words);
27
+ }, [o == null ? void 0 : o.words]), /* @__PURE__ */ C(E, {
28
+ placeholder: o != null && o.box ? "请输入" : "在图中框选内容后,点击此处进行填写",
29
+ value: g,
30
+ onChange: (t) => {
31
+ u(t.target.value);
32
+ },
33
+ disabled: !(o != null && o.box || e && p),
34
+ onBlur: (t) => {
35
+ s && s(d(n({}, o), {
36
+ words: t.target.value
37
+ }));
38
+ },
39
+ onClick: (t) => {
40
+ e && e && (s && s(d(n({}, o), {
41
+ uuid: e.uuid,
42
+ box: e.box,
43
+ words: e.words || ""
44
+ })), i && i());
45
+ },
46
+ onMouseOver: () => a(!0),
47
+ onMouseLeave: (t) => {
48
+ a(!1), t.currentTarget.blur();
49
+ },
50
+ onFocus: () => {
51
+ c && c(o);
52
+ }
53
+ });
54
+ };
55
+ export {
56
+ B as default
57
+ };
@@ -0,0 +1,73 @@
1
+ import { jsxs as r, jsx as o } from "react/jsx-runtime";
2
+ import { useState as w, useEffect as y } from "react";
3
+ import { Button as u } from "antd";
4
+ import "./style.less.mjs";
5
+ import { DeleteOutlined as I, PlusCircleOutlined as N } from "@ant-design/icons";
6
+ import E from "./LabelEditorInput.mjs";
7
+ const B = (h) => {
8
+ const {
9
+ name: c,
10
+ catagoryId: p,
11
+ values: l,
12
+ selectedLabel: n,
13
+ holdingLabel: f,
14
+ onChange: g,
15
+ onRemove: b,
16
+ clearHoldingLabel: C,
17
+ onSelect: d
18
+ } = h, s = {
19
+ words: "",
20
+ type: c.toLowerCase(),
21
+ catagoryId: p
22
+ }, [e, a] = w(l.length ? l : [s]);
23
+ y(() => {
24
+ a(l.length ? l : [s]);
25
+ }, [l]);
26
+ const v = (t) => {
27
+ b(e[t]), e.length === 1 ? a([s]) : (e.splice(t, 1), a([...e]));
28
+ }, x = () => {
29
+ a([...l, s]);
30
+ };
31
+ return /* @__PURE__ */ r("div", {
32
+ className: "label-editor-item",
33
+ children: [/* @__PURE__ */ o("div", {
34
+ className: "label-editor-item-name",
35
+ children: c.toLowerCase()
36
+ }), /* @__PURE__ */ o("div", {
37
+ className: "label-editor-item-values",
38
+ children: e == null ? void 0 : e.map((t, i) => {
39
+ var m;
40
+ return /* @__PURE__ */ r("div", {
41
+ children: [/* @__PURE__ */ o(E, {
42
+ value: t,
43
+ selected: n ? (n == null ? void 0 : n.uuid) === t.uuid : !1,
44
+ holdingLabel: f,
45
+ clearHoldingLabel: C,
46
+ onChange: (L) => {
47
+ e[i] = L, a([...e]), g([...e]);
48
+ },
49
+ onSelect: () => {
50
+ d && d(t);
51
+ }
52
+ }), /* @__PURE__ */ r("div", {
53
+ className: "actions",
54
+ children: [((m = t.box) == null ? void 0 : m.length) && t.words && /* @__PURE__ */ o(u, {
55
+ size: "small",
56
+ type: "text",
57
+ icon: /* @__PURE__ */ o(I, {}),
58
+ onClick: () => v(i)
59
+ }), i === l.length - 1 && /* @__PURE__ */ o(u, {
60
+ size: "small",
61
+ type: "text",
62
+ icon: /* @__PURE__ */ o(N, {}),
63
+ onClick: () => x()
64
+ })]
65
+ })]
66
+ }, i);
67
+ })
68
+ })]
69
+ });
70
+ };
71
+ export {
72
+ B as default
73
+ };
@@ -0,0 +1,55 @@
1
+ import { jsxs as v, jsx as n } from "react/jsx-runtime";
2
+ import { useState as h, useEffect as y } from "react";
3
+ import "./style.less.mjs";
4
+ import f from "./LabelEditorItem.mjs";
5
+ const E = (p) => {
6
+ const {
7
+ category: t,
8
+ type: a = [],
9
+ value: o = [],
10
+ selectedLabel: r,
11
+ holdingLabel: l,
12
+ clearHoldingLabel: s,
13
+ onChange: i,
14
+ onRemove: d,
15
+ onSelect: c
16
+ } = p, [m, g] = h(a || []), [b, u] = h(o || []);
17
+ return y(() => {
18
+ g(a);
19
+ }, [a]), y(() => {
20
+ u(o);
21
+ }, [o]), /* @__PURE__ */ v("div", {
22
+ className: `label-editor ${l ? "holding-label" : ""}`,
23
+ children: [/* @__PURE__ */ n("div", {
24
+ className: "label-editor-title",
25
+ children: t.name
26
+ }), /* @__PURE__ */ n(f, {
27
+ catagoryId: t.id,
28
+ name: "key",
29
+ values: m,
30
+ selectedLabel: r,
31
+ holdingLabel: l,
32
+ clearHoldingLabel: s,
33
+ onRemove: d,
34
+ onChange: (e) => {
35
+ g(e), i(e, b);
36
+ },
37
+ onSelect: c
38
+ }), /* @__PURE__ */ n(f, {
39
+ catagoryId: t.id,
40
+ name: "value",
41
+ values: b,
42
+ selectedLabel: r,
43
+ holdingLabel: l,
44
+ clearHoldingLabel: s,
45
+ onRemove: d,
46
+ onChange: (e) => {
47
+ u(e), i(m, e);
48
+ },
49
+ onSelect: c
50
+ })]
51
+ });
52
+ };
53
+ export {
54
+ E as default
55
+ };