@glodon-aiot/dataset-annotation 3.23.0-alpha.4 → 3.24.0-alpha.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.
@@ -1,56 +1,61 @@
1
- var X = Object.defineProperty, Y = Object.defineProperties;
2
- var Z = Object.getOwnPropertyDescriptors;
3
- var j = Object.getOwnPropertySymbols;
4
- var ee = Object.prototype.hasOwnProperty, te = Object.prototype.propertyIsEnumerable;
5
- var M = (o, s, n) => s in o ? X(o, s, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[s] = n, x = (o, s) => {
1
+ var ie = Object.defineProperty, ne = Object.defineProperties;
2
+ var re = Object.getOwnPropertyDescriptors;
3
+ var H = Object.getOwnPropertySymbols;
4
+ var se = Object.prototype.hasOwnProperty, ae = Object.prototype.propertyIsEnumerable;
5
+ var J = (l, s, n) => s in l ? ie(l, s, { enumerable: !0, configurable: !0, writable: !0, value: n }) : l[s] = n, k = (l, s) => {
6
6
  for (var n in s || (s = {}))
7
- ee.call(s, n) && M(o, n, s[n]);
8
- if (j)
9
- for (var n of j(s))
10
- te.call(s, n) && M(o, n, s[n]);
11
- return o;
12
- }, A = (o, s) => Y(o, Z(s));
13
- var E = (o, s, n) => new Promise((m, h) => {
14
- var l = (c) => {
7
+ se.call(s, n) && J(l, n, s[n]);
8
+ if (H)
9
+ for (var n of H(s))
10
+ ae.call(s, n) && J(l, n, s[n]);
11
+ return l;
12
+ }, C = (l, s) => ne(l, re(s));
13
+ var O = (l, s, n) => new Promise((p, b) => {
14
+ var a = (d) => {
15
15
  try {
16
- a(n.next(c));
17
- } catch (p) {
18
- h(p);
16
+ m(n.next(d));
17
+ } catch (h) {
18
+ b(h);
19
19
  }
20
- }, f = (c) => {
20
+ }, y = (d) => {
21
21
  try {
22
- a(n.throw(c));
23
- } catch (p) {
24
- h(p);
22
+ m(n.throw(d));
23
+ } catch (h) {
24
+ b(h);
25
25
  }
26
- }, a = (c) => c.done ? m(c.value) : Promise.resolve(c.value).then(l, f);
27
- a((n = n.apply(o, s)).next());
26
+ }, m = (d) => d.done ? p(d.value) : Promise.resolve(d.value).then(a, y);
27
+ m((n = n.apply(l, s)).next());
28
28
  });
29
29
  import { jsxs as u, jsx as i } from "react/jsx-runtime";
30
- import { forwardRef as ie, useContext as ne, useState as b, useRef as re, useImperativeHandle as se, useEffect as q } from "react";
31
- import { Row as ae, Col as F, Input as P, Select as k, Space as T, Button as v, Table as le, Modal as ce, message as C } from "antd";
32
- import oe from "../../../../DatasetContext/index.mjs";
30
+ import { forwardRef as le, useContext as ce, useState as w, useRef as oe, useImperativeHandle as de, useEffect as R } from "react";
31
+ import { Row as ue, Col as K, Input as W, Select as D, Space as U, Button as N, Table as me, Modal as he, message as S } from "antd";
32
+ import fe from "../../../../DatasetContext/index.mjs";
33
33
  import "./style.less.mjs";
34
- import B from "../../../Iconfont/index.mjs";
35
- const de = ie((o, s) => {
34
+ import V from "../../../Iconfont/index.mjs";
35
+ const pe = le((l, s) => {
36
36
  const {
37
37
  datasetId: n,
38
- versionId: m,
39
- onAttributesChange: h,
40
- onLoadingChange: l
41
- } = o, {
38
+ versionId: p,
39
+ onAttributesChange: b,
40
+ onLoadingChange: a
41
+ } = l, {
42
42
  services: {
43
- cvforceDatahub: f
43
+ cvforceDatahub: y
44
+ },
45
+ featuresConfig: {
46
+ labelManager: m
47
+ } = {
48
+ labelManager: !1
44
49
  }
45
- } = ne(oe), [a, c] = b([]), [p, N] = b(!1), [D, g] = b(""), [w, O] = b(!1), [R, y] = b(null), I = re(""), S = (e) => {
46
- const t = [...e].sort((r, d) => r.id.localeCompare(d.id));
50
+ } = ce(fe), d = !!(m && m.add), h = !!(m && m.edit), A = !!(m && m.delete), $ = d || h || A, [c, v] = w([]), [_, x] = w(!1), [I, E] = w(""), [g, T] = w(!1), [j, f] = w(null), M = oe(""), B = (e) => {
51
+ const t = [...e].sort((r, o) => r.id.localeCompare(o.id));
47
52
  return JSON.stringify(t);
48
- }, U = () => S(a) !== I.current, z = () => new Promise((e) => {
49
- if (!U()) {
53
+ }, q = () => B(c) !== M.current, G = () => new Promise((e) => {
54
+ if (!q()) {
50
55
  e(!0);
51
56
  return;
52
57
  }
53
- ce.confirm({
58
+ he.confirm({
54
59
  title: "提示",
55
60
  content: "属性列表有未保存的更改,确定要离开吗?",
56
61
  okText: "确定",
@@ -63,90 +68,92 @@ const de = ie((o, s) => {
63
68
  }
64
69
  });
65
70
  });
66
- se(s, () => ({
67
- hasUnsavedChanges: U,
68
- checkDirtyAndConfirm: z
71
+ de(s, () => ({
72
+ hasUnsavedChanges: q,
73
+ checkDirtyAndConfirm: G
69
74
  }));
70
- const V = () => E(void 0, null, function* () {
71
- N(!0), l == null || l(!0);
75
+ const F = () => O(void 0, null, function* () {
76
+ x(!0), a == null || a(!0);
72
77
  try {
73
- if (n && m && f) {
74
- const t = (yield f.getDatasetsIdVersionsVidConfigs(n, m)) || [];
75
- return c(t), I.current = S(t), t;
78
+ if (n && p && y) {
79
+ const t = (yield y.getDatasetsIdVersionsVidConfigs(n, p)) || [];
80
+ return v(t), M.current = B(t), t;
76
81
  }
77
82
  } catch (e) {
78
83
  console.error("获取属性列表失败:", e);
79
84
  } finally {
80
- N(!1), l == null || l(!1);
85
+ x(!1), a == null || a(!1);
81
86
  }
82
87
  });
83
- q(() => {
84
- V();
85
- }, []), q(() => {
88
+ R(() => {
89
+ F();
90
+ }, []), R(() => {
91
+ h || (T(!1), f(null));
92
+ }, [h]), R(() => {
86
93
  const e = (t) => {
87
- if (S(a) !== I.current)
94
+ if (B(c) !== M.current)
88
95
  return t.preventDefault(), t.returnValue = "", "";
89
96
  };
90
97
  return window.addEventListener("beforeunload", e), () => {
91
98
  window.removeEventListener("beforeunload", e);
92
99
  };
93
- }, [a]);
94
- const _ = () => {
95
- if (!D.trim()) {
96
- C.error("属性名称不能为空");
100
+ }, [c]);
101
+ const P = () => {
102
+ if (!I.trim()) {
103
+ S.error("属性名称不能为空");
97
104
  return;
98
105
  }
99
106
  const e = {
100
107
  id: `attr-${Date.now()}`,
101
- name: D.trim(),
108
+ name: I.trim(),
102
109
  type: "text"
103
- }, t = [...a, e];
104
- c(t), g("");
105
- }, H = () => {
106
- g("");
107
- }, J = (e) => {
108
- const t = a.filter((r) => r.id !== e);
109
- c(t);
110
- }, K = () => {
111
- c([]), O(!1), y(null);
112
- }, W = () => {
113
- if (a.filter((t) => !t.name || !t.name.trim()).length > 0) {
114
- C.error("属性名称不能为空");
110
+ }, t = [...c, e];
111
+ v(t), E("");
112
+ }, L = () => {
113
+ E("");
114
+ }, Q = (e) => {
115
+ const t = c.filter((r) => r.id !== e);
116
+ v(t);
117
+ }, X = () => {
118
+ v([]), T(!1), f(null);
119
+ }, Y = () => {
120
+ if (c.filter((t) => !t.name || !t.name.trim()).length > 0) {
121
+ S.error("属性名称不能为空");
115
122
  return;
116
123
  }
117
- O(!w), y(null);
118
- }, $ = (e, t) => {
119
- const r = a.map((d) => d.id === e ? A(x({}, d), {
124
+ T(!g), f(null);
125
+ }, Z = (e, t) => {
126
+ const r = c.map((o) => o.id === e ? C(k({}, o), {
120
127
  name: t
121
- }) : d);
122
- c(r);
123
- }, G = (e, t) => {
124
- const r = a.map((d) => d.id === e ? A(x({}, d), {
128
+ }) : o);
129
+ v(r);
130
+ }, ee = (e, t) => {
131
+ const r = c.map((o) => o.id === e ? C(k({}, o), {
125
132
  type: t
126
- }) : d);
127
- c(r);
128
- }, L = () => E(void 0, null, function* () {
129
- if (!(!n || !m || !f)) {
130
- N(!0), l == null || l(!0);
133
+ }) : o);
134
+ v(r);
135
+ }, te = () => O(void 0, null, function* () {
136
+ if (!(!n || !p || !y)) {
137
+ x(!0), a == null || a(!0);
131
138
  try {
132
- const e = a.map((r) => {
133
- var d;
134
- return A(x({}, r), {
135
- id: (d = r.id) != null && d.startsWith("attr-") ? "" : r.id
139
+ const e = c.map((r) => {
140
+ var o;
141
+ return C(k({}, r), {
142
+ id: (o = r.id) != null && o.startsWith("attr-") ? "" : r.id
136
143
  });
137
144
  });
138
- console.log("attributes", a), yield f.saveVisionLabelConfigs(n, m, {
145
+ console.log("attributes", c), yield y.saveVisionLabelConfigs(n, p, {
139
146
  data: e
140
147
  });
141
- const t = yield V();
142
- C.success("保存成功"), h == null || h(t || a);
148
+ const t = yield F();
149
+ S.success("保存成功"), b == null || b(t || c);
143
150
  } catch (e) {
144
- throw console.error("保存属性列表失败:", e), C.error("保存失败"), e;
151
+ throw console.error("保存属性列表失败:", e), S.error("保存失败"), e;
145
152
  } finally {
146
- N(!1), l == null || l(!1);
153
+ x(!1), a == null || a(!1);
147
154
  }
148
155
  }
149
- }), Q = [{
156
+ }), z = [{
150
157
  title: "序号",
151
158
  key: "index",
152
159
  width: 80,
@@ -155,18 +162,18 @@ const de = ie((o, s) => {
155
162
  title: "属性名称",
156
163
  dataIndex: "name",
157
164
  key: "name",
158
- render: (e, t) => w ? /* @__PURE__ */ i(P, {
165
+ render: (e, t) => g ? /* @__PURE__ */ i(W, {
159
166
  value: e,
160
167
  showCount: !0,
161
168
  maxLength: 32,
162
169
  onChange: (r) => {
163
- $(t.id, r.target.value);
170
+ Z(t.id, r.target.value);
164
171
  },
165
172
  onBlur: () => {
166
- R === t.id && y(null);
173
+ j === t.id && f(null);
167
174
  },
168
175
  onFocus: () => {
169
- y(t.id);
176
+ f(t.id);
170
177
  }
171
178
  }) : /* @__PURE__ */ i("span", {
172
179
  children: e
@@ -175,39 +182,39 @@ const de = ie((o, s) => {
175
182
  title: "属性类型",
176
183
  dataIndex: "type",
177
184
  key: "type",
178
- render: (e, t) => w ? /* @__PURE__ */ i(k, {
185
+ render: (e, t) => g ? /* @__PURE__ */ i(D, {
179
186
  value: e || "text",
180
187
  onChange: (r) => {
181
- G(t.id, r);
188
+ ee(t.id, r);
182
189
  },
183
190
  style: {
184
191
  width: "100%"
185
192
  },
186
193
  onBlur: () => {
187
- R === t.id && y(null);
194
+ j === t.id && f(null);
188
195
  },
189
196
  onFocus: () => {
190
- y(t.id);
197
+ f(t.id);
191
198
  },
192
199
  disabled: !0,
193
- children: /* @__PURE__ */ i(k.Option, {
200
+ children: /* @__PURE__ */ i(D.Option, {
194
201
  value: "text",
195
202
  children: "文本"
196
203
  })
197
204
  }) : /* @__PURE__ */ i("span", {
198
205
  children: "文本"
199
206
  })
200
- }, {
207
+ }];
208
+ return A && z.push({
201
209
  title: "操作",
202
210
  key: "action",
203
211
  width: 100,
204
- render: (e, t) => /* @__PURE__ */ i(v, {
212
+ render: (e, t) => /* @__PURE__ */ i(N, {
205
213
  type: "link",
206
- onClick: () => J(t.id),
214
+ onClick: () => Q(t.id),
207
215
  children: "删除"
208
216
  })
209
- }];
210
- return /* @__PURE__ */ u("div", {
217
+ }), /* @__PURE__ */ u("div", {
211
218
  className: "attribute-detail",
212
219
  children: [/* @__PURE__ */ i("div", {
213
220
  className: "use-tips",
@@ -216,10 +223,10 @@ const de = ie((o, s) => {
216
223
  })
217
224
  }), /* @__PURE__ */ u("div", {
218
225
  className: "lists",
219
- children: [/* @__PURE__ */ u(ae, {
226
+ children: [/* @__PURE__ */ u(ue, {
220
227
  className: "lists-content",
221
228
  gutter: 48,
222
- children: [/* @__PURE__ */ i(F, {
229
+ children: [d && /* @__PURE__ */ i(K, {
223
230
  span: 12,
224
231
  children: /* @__PURE__ */ u("div", {
225
232
  className: "list-item",
@@ -236,47 +243,47 @@ const de = ie((o, s) => {
236
243
  children: [/* @__PURE__ */ i("div", {
237
244
  className: "form-label",
238
245
  children: "属性名称"
239
- }), /* @__PURE__ */ i(P, {
246
+ }), /* @__PURE__ */ i(W, {
240
247
  showCount: !0,
241
248
  maxLength: 32,
242
- value: D,
243
- onChange: (e) => g(e.target.value),
249
+ value: I,
250
+ onChange: (e) => E(e.target.value),
244
251
  placeholder: "请输入属性名称",
245
- onPressEnter: _
252
+ onPressEnter: P
246
253
  })]
247
254
  }), /* @__PURE__ */ u("div", {
248
255
  className: "form-item",
249
256
  children: [/* @__PURE__ */ i("div", {
250
257
  className: "form-label",
251
258
  children: "属性类型"
252
- }), /* @__PURE__ */ i(k, {
259
+ }), /* @__PURE__ */ i(D, {
253
260
  value: "text",
254
261
  disabled: !0,
255
262
  style: {
256
263
  width: "100%"
257
264
  },
258
- children: /* @__PURE__ */ i(k.Option, {
265
+ children: /* @__PURE__ */ i(D.Option, {
259
266
  value: "text",
260
267
  children: "文本"
261
268
  })
262
269
  })]
263
270
  }), /* @__PURE__ */ i("div", {
264
271
  className: "form-actions",
265
- children: /* @__PURE__ */ u(T, {
266
- children: [/* @__PURE__ */ i(v, {
272
+ children: /* @__PURE__ */ u(U, {
273
+ children: [/* @__PURE__ */ i(N, {
267
274
  type: "primary",
268
- onClick: _,
275
+ onClick: P,
269
276
  children: "添加属性"
270
- }), /* @__PURE__ */ i(v, {
271
- onClick: H,
277
+ }), /* @__PURE__ */ i(N, {
278
+ onClick: L,
272
279
  children: "取消"
273
280
  })]
274
281
  })
275
282
  })]
276
283
  })]
277
284
  })
278
- }), /* @__PURE__ */ i(F, {
279
- span: 12,
285
+ }), /* @__PURE__ */ i(K, {
286
+ span: d ? 12 : 24,
280
287
  children: /* @__PURE__ */ u("div", {
281
288
  className: "list-item",
282
289
  children: [/* @__PURE__ */ u("div", {
@@ -284,34 +291,34 @@ const de = ie((o, s) => {
284
291
  children: [/* @__PURE__ */ i("div", {
285
292
  className: "list-item-title",
286
293
  children: "属性列表"
287
- }), /* @__PURE__ */ u(T, {
294
+ }), (h || A) && /* @__PURE__ */ u(U, {
288
295
  style: {
289
296
  height: 32
290
297
  },
291
- children: [/* @__PURE__ */ i(v, {
298
+ children: [h && /* @__PURE__ */ i(N, {
292
299
  type: "text",
293
- icon: w ? /* @__PURE__ */ i(B, {
300
+ icon: g ? /* @__PURE__ */ i(V, {
294
301
  type: "icon-queding",
295
302
  className: "self-icon"
296
- }) : /* @__PURE__ */ i(B, {
303
+ }) : /* @__PURE__ */ i(V, {
297
304
  type: "icon-editing",
298
305
  className: "self-icon"
299
306
  }),
300
- onClick: W
301
- }), /* @__PURE__ */ i(v, {
307
+ onClick: Y
308
+ }), A && /* @__PURE__ */ i(N, {
302
309
  type: "text",
303
- icon: /* @__PURE__ */ i(B, {
310
+ icon: /* @__PURE__ */ i(V, {
304
311
  type: "icon-qingchujiyi",
305
312
  className: "self-icon"
306
313
  }),
307
- onClick: K
314
+ onClick: X
308
315
  })]
309
316
  })]
310
317
  }), /* @__PURE__ */ i("div", {
311
318
  className: "list-item-content table-wrapper",
312
- children: /* @__PURE__ */ i(le, {
313
- columns: Q,
314
- dataSource: a,
319
+ children: /* @__PURE__ */ i(me, {
320
+ columns: z,
321
+ dataSource: c,
315
322
  rowKey: "id",
316
323
  pagination: !1,
317
324
  size: "small",
@@ -322,14 +329,14 @@ const de = ie((o, s) => {
322
329
  })]
323
330
  })
324
331
  })]
325
- }), /* @__PURE__ */ i("div", {
332
+ }), $ && /* @__PURE__ */ i("div", {
326
333
  className: "attribute-detail-footer",
327
- children: /* @__PURE__ */ i(T, {
328
- children: /* @__PURE__ */ i(v, {
334
+ children: /* @__PURE__ */ i(U, {
335
+ children: /* @__PURE__ */ i(N, {
329
336
  type: "primary",
330
- loading: p,
331
- disabled: p,
332
- onClick: L,
337
+ loading: _,
338
+ disabled: _,
339
+ onClick: te,
333
340
  children: "保存"
334
341
  })
335
342
  })
@@ -337,7 +344,7 @@ const de = ie((o, s) => {
337
344
  })]
338
345
  });
339
346
  });
340
- de.displayName = "AttributeDetail";
347
+ pe.displayName = "AttributeDetail";
341
348
  export {
342
- de as default
349
+ pe as default
343
350
  };