antd-import-export 1.0.13 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3,35 +3,35 @@ import t from "file-saver";
3
3
  import { DeleteOutlined as n, DownloadOutlined as r, FileOutlined as i, UploadOutlined as a } from "@ant-design/icons";
4
4
  import { App as o, Button as s, Flex as c, Input as l, InputNumber as u, Modal as d, Popover as f, Progress as p, Select as m, Space as ee, Table as h, Tag as g, Tooltip as te, Typography as _, theme as ne } from "antd";
5
5
  import { useCallback as re, useEffect as v, useMemo as y, useRef as b, useState as x, useSyncExternalStore as S } from "react";
6
- import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
6
+ import { Fragment as ie, jsx as C, jsxs as w } from "react/jsx-runtime";
7
7
  // src/core/schema/index.ts
8
- function ie(e) {
8
+ function ae(e) {
9
9
  return e.filter((e) => e.importable !== !1);
10
10
  }
11
11
  // src/core/schema/multiValue.ts
12
- var ae = ";", E = /[;;]/;
13
- function D(e) {
12
+ var oe = ";", T = /[;;]/;
13
+ function E(e) {
14
14
  return e.map((e) => String(e)).join(";");
15
15
  }
16
- function O(e) {
17
- return e.split(E).map((e) => e.trim()).filter(Boolean);
16
+ function D(e) {
17
+ return e.split(T).map((e) => e.trim()).filter(Boolean);
18
18
  }
19
19
  // src/core/schema/optionMap.ts
20
- function k(e, t) {
20
+ function O(e, t) {
21
21
  if (typeof t == "string" && Object.prototype.hasOwnProperty.call(e, t)) return e[t];
22
22
  }
23
- function A(e, t) {
23
+ function k(e, t) {
24
24
  return Object.entries(e).find(([, e]) => e === t)?.[0];
25
25
  }
26
- function j(e) {
26
+ function A(e) {
27
27
  return Object.values(e);
28
28
  }
29
29
  // src/core/dateTime.ts
30
- var M = /^(\d{4})-(\d{2})-(\d{2})$/, oe = /^([01]?\d|2[0-3]):([0-5]\d)(?::([0-5]\d))?$/, N = /^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{1,2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/;
31
- function P(e) {
30
+ var j = /^(\d{4})-(\d{2})-(\d{2})$/, se = /^([01]?\d|2[0-3]):([0-5]\d)(?::([0-5]\d))?$/, ce = /^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{1,2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/;
31
+ function M(e) {
32
32
  return String(e).padStart(2, "0");
33
33
  }
34
- function se({ year: e, month: t, day: n }) {
34
+ function N({ year: e, month: t, day: n }) {
35
35
  return e < 1 || t < 1 || t > 12 || n < 1 ? !1 : n <= [
36
36
  31,
37
37
  e % 4 == 0 && (e % 100 != 0 || e % 400 == 0) ? 29 : 28,
@@ -47,54 +47,54 @@ function se({ year: e, month: t, day: n }) {
47
47
  31
48
48
  ][t - 1];
49
49
  }
50
- function ce(e) {
50
+ function P(e) {
51
51
  if (typeof e != "string") return null;
52
- let t = M.exec(e.trim());
52
+ let t = j.exec(e.trim());
53
53
  if (!t) return null;
54
54
  let n = {
55
55
  year: Number(t[1]),
56
56
  month: Number(t[2]),
57
57
  day: Number(t[3])
58
58
  };
59
- return se(n) ? n : null;
59
+ return N(n) ? n : null;
60
60
  }
61
61
  function F(e) {
62
62
  if (typeof e != "string") return null;
63
- let t = oe.exec(e.trim());
63
+ let t = se.exec(e.trim());
64
64
  return t ? {
65
65
  hour: Number(t[1]),
66
66
  minute: Number(t[2]),
67
67
  second: t[3] === void 0 ? 0 : Number(t[3])
68
68
  } : null;
69
69
  }
70
- function I(e) {
70
+ function le(e) {
71
71
  if (typeof e != "string") return null;
72
72
  let t = e.trim().split(/\s+/);
73
73
  if (t.length !== 2) return null;
74
- let n = ce(t[0]), r = F(t[1]);
74
+ let n = P(t[0]), r = F(t[1]);
75
75
  return n && r ? {
76
76
  date: n,
77
77
  time: r
78
78
  } : null;
79
79
  }
80
- function L({ year: e, month: t, day: n }) {
81
- return `${String(e).padStart(4, "0")}-${P(t)}-${P(n)}`;
80
+ function I({ year: e, month: t, day: n }) {
81
+ return `${String(e).padStart(4, "0")}-${M(t)}-${M(n)}`;
82
82
  }
83
- function R({ hour: e, minute: t, second: n }) {
84
- let r = `${P(e)}:${P(t)}`;
85
- return n === 0 ? r : `${r}:${P(n)}`;
83
+ function L({ hour: e, minute: t, second: n }) {
84
+ let r = `${M(e)}:${M(t)}`;
85
+ return n === 0 ? r : `${r}:${M(n)}`;
86
86
  }
87
- function le(e, t) {
88
- return `${L(e)} ${R(t)}`;
87
+ function R(e, t) {
88
+ return `${I(e)} ${L(t)}`;
89
89
  }
90
- function ue(e) {
90
+ function z(e) {
91
91
  return {
92
92
  year: e.getUTCFullYear(),
93
93
  month: e.getUTCMonth() + 1,
94
94
  day: e.getUTCDate()
95
95
  };
96
96
  }
97
- function z(e) {
97
+ function ue(e) {
98
98
  return {
99
99
  hour: e.getUTCHours(),
100
100
  minute: e.getUTCMinutes(),
@@ -102,26 +102,26 @@ function z(e) {
102
102
  };
103
103
  }
104
104
  function de(e) {
105
- return L(ue(e));
105
+ return I(z(e));
106
106
  }
107
107
  function fe(e) {
108
- return R(z(e));
108
+ return L(ue(e));
109
109
  }
110
- function pe(e) {
111
- return le(ue(e), z(e));
110
+ function B(e) {
111
+ return R(z(e), ue(e));
112
112
  }
113
- function me(e) {
113
+ function pe(e) {
114
114
  return !Number.isFinite(e) || e < 1 || e >= 2958466 ? null : new Date(Math.round((e - 25569) * 24 * 3600 * 1e3));
115
115
  }
116
- function he(e) {
117
- let t = N.exec(e);
116
+ function me(e) {
117
+ let t = ce.exec(e);
118
118
  if (!t) return null;
119
119
  let n = {
120
120
  year: Number(t[1]),
121
121
  month: Number(t[2]),
122
122
  day: Number(t[3])
123
123
  };
124
- if (!se(n)) return null;
124
+ if (!N(n)) return null;
125
125
  if (t[4] === void 0) return {
126
126
  date: n,
127
127
  time: null
@@ -132,39 +132,39 @@ function he(e) {
132
132
  time: r
133
133
  } : null;
134
134
  }
135
- function B(e) {
135
+ function he(e) {
136
136
  return !Number.isNaN(e.getTime());
137
137
  }
138
138
  function ge(e) {
139
- if (e instanceof Date) return B(e) ? de(e) : null;
139
+ if (e instanceof Date) return he(e) ? de(e) : null;
140
140
  if (typeof e != "string") return null;
141
- let t = e.trim(), n = ce(t);
142
- if (n) return L(n);
143
- let r = he(t);
144
- return r ? L(r.date) : null;
141
+ let t = e.trim(), n = P(t);
142
+ if (n) return I(n);
143
+ let r = me(t);
144
+ return r ? I(r.date) : null;
145
145
  }
146
- function V(e) {
147
- if (e instanceof Date) return B(e) ? fe(e) : null;
146
+ function _e(e) {
147
+ if (e instanceof Date) return he(e) ? fe(e) : null;
148
148
  if (typeof e != "string") return null;
149
149
  let t = F(e);
150
- if (t) return R(t);
151
- let n = he(e.trim());
152
- return n?.time ? R(n.time) : null;
150
+ if (t) return L(t);
151
+ let n = me(e.trim());
152
+ return n?.time ? L(n.time) : null;
153
153
  }
154
- function H(e) {
155
- if (e instanceof Date) return B(e) ? pe(e) : null;
154
+ function V(e) {
155
+ if (e instanceof Date) return he(e) ? B(e) : null;
156
156
  if (typeof e != "string") return null;
157
- let t = e.trim(), n = I(t);
158
- if (n) return le(n.date, n.time);
159
- let r = he(t);
160
- return r ? le(r.date, r.time ?? {
157
+ let t = e.trim(), n = le(t);
158
+ if (n) return R(n.date, n.time);
159
+ let r = me(t);
160
+ return r ? R(r.date, r.time ?? {
161
161
  hour: 0,
162
162
  minute: 0,
163
163
  second: 0
164
164
  }) : null;
165
165
  }
166
166
  // src/core/schema/defaultValue.ts
167
- function _e(e) {
167
+ function ve(e) {
168
168
  let t = e.property.default_value;
169
169
  if (t == null) return { text: null };
170
170
  if (e.type === "boolean") return typeof t == "boolean" ? { text: t ? e.property.true_label : e.property.false_label } : {
@@ -178,7 +178,7 @@ function _e(e) {
178
178
  };
179
179
  let n = t.trim();
180
180
  if (n === "") return { text: null };
181
- let r = k(e.property.option_map, n);
181
+ let r = O(e.property.option_map, n);
182
182
  return r ? { text: r } : {
183
183
  text: null,
184
184
  error: `默认值 ${JSON.stringify(t)} 不是有效的选项内部值`
@@ -192,14 +192,14 @@ function _e(e) {
192
192
  if (t.length === 0) return { text: null };
193
193
  let n = [];
194
194
  for (let r of t) {
195
- let t = String(r), i = k(e.property.option_map, t);
195
+ let t = String(r), i = O(e.property.option_map, t);
196
196
  if (!i) return {
197
197
  text: null,
198
198
  error: `默认值 ${JSON.stringify(r)} 不是有效的选项内部值`
199
199
  };
200
200
  n.push(i);
201
201
  }
202
- return { text: D(n) };
202
+ return { text: E(n) };
203
203
  }
204
204
  if (e.type === "list") {
205
205
  if (!Array.isArray(t)) return {
@@ -207,15 +207,15 @@ function _e(e) {
207
207
  error: "默认值必须是数组"
208
208
  };
209
209
  if (t.length === 0) return { text: null };
210
- let e = D(t);
210
+ let e = E(t);
211
211
  return { text: e.trim() === "" ? null : e };
212
212
  }
213
213
  let n = String(t);
214
214
  return { text: n.trim() === "" ? null : n };
215
215
  }
216
216
  // src/core/schema/validate.ts
217
- var ve = /^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/;
218
- function ye(e, t) {
217
+ var H = /^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/;
218
+ function U(e, t) {
219
219
  return [...e].length > t.property.max_length ? {
220
220
  validateSuccess: !1,
221
221
  validateMessage: `长度不能超过 ${t.property.max_length}`
@@ -224,8 +224,8 @@ function ye(e, t) {
224
224
  validateValue: e
225
225
  };
226
226
  }
227
- function U(t, n) {
228
- if (!ve.test(t)) return {
227
+ function ye(t, n) {
228
+ if (!H.test(t)) return {
229
229
  validateSuccess: !1,
230
230
  validateMessage: "不是有效数字"
231
231
  };
@@ -266,7 +266,7 @@ function U(t, n) {
266
266
  validateValue: r.toString()
267
267
  };
268
268
  }
269
- function be(e, t) {
269
+ function W(e, t) {
270
270
  return e === t.property.true_label ? {
271
271
  validateSuccess: !0,
272
272
  validateValue: !0
@@ -278,38 +278,38 @@ function be(e, t) {
278
278
  validateMessage: `内容必须是 ${t.property.true_label}|${t.property.false_label}`
279
279
  };
280
280
  }
281
- function xe(e) {
282
- let t = ce(e);
281
+ function be(e) {
282
+ let t = P(e);
283
283
  return t ? {
284
284
  validateSuccess: !0,
285
- validateValue: L(t)
285
+ validateValue: I(t)
286
286
  } : {
287
287
  validateSuccess: !1,
288
288
  validateMessage: "不是有效的日期格式 YYYY-MM-DD"
289
289
  };
290
290
  }
291
- function Se(e) {
291
+ function G(e) {
292
292
  let t = F(e);
293
293
  return t ? {
294
294
  validateSuccess: !0,
295
- validateValue: R(t)
295
+ validateValue: L(t)
296
296
  } : {
297
297
  validateSuccess: !1,
298
298
  validateMessage: "不是有效的时间格式 HH:mm 或 HH:mm:ss"
299
299
  };
300
300
  }
301
- function Ce(e) {
302
- let t = I(e);
301
+ function xe(e) {
302
+ let t = le(e);
303
303
  return t ? {
304
304
  validateSuccess: !0,
305
- validateValue: le(t.date, t.time)
305
+ validateValue: R(t.date, t.time)
306
306
  } : {
307
307
  validateSuccess: !1,
308
308
  validateMessage: "不是有效的日期时间格式 YYYY-MM-DD HH:mm 或 YYYY-MM-DD HH:mm:ss"
309
309
  };
310
310
  }
311
- function we(e, t) {
312
- let n = O(e);
311
+ function Se(e, t) {
312
+ let n = D(e);
313
313
  if (n.length === 0 && t.property.required) return {
314
314
  validateSuccess: !1,
315
315
  validateMessage: "不能为空"
@@ -327,27 +327,27 @@ function we(e, t) {
327
327
  validateValue: n
328
328
  };
329
329
  }
330
- function Te(e, t) {
331
- let n = t.property.option_map, r = A(n, e);
330
+ function Ce(e, t) {
331
+ let n = t.property.option_map, r = k(n, e);
332
332
  return r === void 0 ? {
333
333
  validateSuccess: !1,
334
- validateMessage: `内容必须是 ${j(n).join("|")}`
334
+ validateMessage: `内容必须是 ${A(n).join("|")}`
335
335
  } : {
336
336
  validateSuccess: !0,
337
337
  validateValue: r
338
338
  };
339
339
  }
340
- function Ee(e, t) {
341
- let n = O(e), r = t.property.option_map, i = [];
340
+ function we(e, t) {
341
+ let n = D(e), r = t.property.option_map, i = [];
342
342
  if (n.length === 0 && t.property.required) return {
343
343
  validateSuccess: !1,
344
344
  validateMessage: "不能为空"
345
345
  };
346
346
  for (let e of n) {
347
- let t = A(r, e);
347
+ let t = k(r, e);
348
348
  if (t === void 0) return {
349
349
  validateSuccess: !1,
350
- validateMessage: `内容必须是 ${j(r).join("|")}`
350
+ validateMessage: `内容必须是 ${A(r).join("|")}`
351
351
  };
352
352
  i.push(t);
353
353
  }
@@ -356,25 +356,25 @@ function Ee(e, t) {
356
356
  validateValue: i
357
357
  };
358
358
  }
359
- function De(e, t) {
360
- return e.trim() === "" ? !0 : t.type === "list" || t.type === "multiple_choice" ? O(e).length === 0 : !1;
361
- }
362
- function Oe(e, t) {
363
- if (t.type === "text") return ye(e, t);
364
- if (t.type === "number") return U(e, t);
365
- if (t.type === "boolean") return be(e, t);
366
- if (t.type === "date") return xe(e);
367
- if (t.type === "time") return Se(e);
368
- if (t.type === "datetime") return Ce(e);
369
- if (t.type === "list") return we(e, t);
370
- if (t.type === "single_choice") return Te(e, t);
371
- if (t.type === "multiple_choice") return Ee(e, t);
359
+ function Te(e, t) {
360
+ return e.trim() === "" ? !0 : t.type === "list" || t.type === "multiple_choice" ? D(e).length === 0 : !1;
361
+ }
362
+ function Ee(e, t) {
363
+ if (t.type === "text") return U(e, t);
364
+ if (t.type === "number") return ye(e, t);
365
+ if (t.type === "boolean") return W(e, t);
366
+ if (t.type === "date") return be(e);
367
+ if (t.type === "time") return G(e);
368
+ if (t.type === "datetime") return xe(e);
369
+ if (t.type === "list") return Se(e, t);
370
+ if (t.type === "single_choice") return Ce(e, t);
371
+ if (t.type === "multiple_choice") return we(e, t);
372
372
  throw Error("未知的字段类型");
373
373
  }
374
- function ke(e, t) {
375
- let n = e !== null && De(e, t) ? null : e;
374
+ function De(e, t) {
375
+ let n = e !== null && Te(e, t) ? null : e;
376
376
  if (n === null) {
377
- let { text: e, error: n } = _e(t);
377
+ let { text: e, error: n } = ve(t);
378
378
  return n ? {
379
379
  validateSuccess: !1,
380
380
  validateMessage: n
@@ -387,77 +387,77 @@ function ke(e, t) {
387
387
  } : {
388
388
  validateSuccess: !0,
389
389
  validateValue: t.property.default_value
390
- } : Oe(e, t);
390
+ } : Ee(e, t);
391
391
  }
392
- return Oe(n, t);
392
+ return Ee(n, t);
393
393
  }
394
394
  // src/core/limits.ts
395
- var Ae = 20971520;
395
+ var Oe = 20971520;
396
396
  // src/core/excel/importEditor.ts
397
- function je(e, t) {
398
- if (t != null) return e.type === "single_choice" || e.type === "multiple_choice" ? k(e.property.option_map, t) ?? String(t) : String(t);
397
+ function ke(e, t) {
398
+ if (t != null) return e.type === "single_choice" || e.type === "multiple_choice" ? O(e.property.option_map, t) ?? String(t) : String(t);
399
399
  }
400
- function Me(t, n) {
401
- return t.type === "boolean" ? n === !0 ? t.property.true_label : n === !1 ? t.property.false_label : void 0 : t.type === "single_choice" ? je(t, n) : t.type === "multiple_choice" ? Array.isArray(n) ? n.map((e) => je(t, e)).filter(Boolean) : [] : t.type === "list" ? Array.isArray(n) ? D(n) : "" : t.type === "number" ? typeof n == "number" || typeof n == "string" ? String(n) : e.isDecimal(n) ? n.toString() : void 0 : n == null ? "" : String(n);
400
+ function Ae(t, n) {
401
+ return t.type === "boolean" ? n === !0 ? t.property.true_label : n === !1 ? t.property.false_label : void 0 : t.type === "single_choice" ? ke(t, n) : t.type === "multiple_choice" ? Array.isArray(n) ? n.map((e) => ke(t, e)).filter(Boolean) : [] : t.type === "list" ? Array.isArray(n) ? E(n) : "" : t.type === "number" ? typeof n == "number" || typeof n == "string" ? String(n) : e.isDecimal(n) ? n.toString() : void 0 : n == null ? "" : String(n);
402
402
  }
403
- function W(e, t) {
404
- return t === null ? e.type === "multiple_choice" ? [] : "" : e.type === "multiple_choice" ? O(t) : t;
403
+ function je(e, t) {
404
+ return t === null ? e.type === "multiple_choice" ? [] : "" : e.type === "multiple_choice" ? D(t) : t;
405
405
  }
406
- function Ne(e, t) {
407
- return t == null ? "" : e.type === "boolean" || e.type === "single_choice" ? String(t) : (e.type === "multiple_choice" || e.type === "list") && Array.isArray(t) ? D(t) : String(t);
406
+ function Me(e, t) {
407
+ return t == null ? "" : e.type === "boolean" || e.type === "single_choice" ? String(t) : (e.type === "multiple_choice" || e.type === "list") && Array.isArray(t) ? E(t) : String(t);
408
408
  }
409
409
  // src/core/excel/importRow.ts
410
- function Pe(e, t, n, r) {
410
+ function K(e, t, n, r) {
411
411
  let i = new Set(n), a = {}, o = {};
412
412
  return t.forEach((t) => {
413
413
  if (!i.has(t.key)) return;
414
- let n = Ne(t, e[t.key]), s = ke(n.trim() === "" ? null : n, t);
415
- if (s.validateSuccess) a[t.key] = r === "payload" ? s.validateValue ?? null : Me(t, s.validateValue ?? null);
414
+ let n = Me(t, e[t.key]), s = De(n.trim() === "" ? null : n, t);
415
+ if (s.validateSuccess) a[t.key] = r === "payload" ? s.validateValue ?? null : Ae(t, s.validateValue ?? null);
416
416
  else {
417
417
  if (r === "payload") throw Error(s.validateMessage);
418
- a[t.key] = r === "parse" ? W(t, e[t.key]) : e[t.key], o[t.key] = s.validateMessage;
418
+ a[t.key] = r === "parse" ? je(t, e[t.key]) : e[t.key], o[t.key] = s.validateMessage;
419
419
  }
420
420
  }), {
421
421
  values: a,
422
422
  errors: o
423
423
  };
424
424
  }
425
- function Fe(e, t, n) {
426
- return Pe(e.values, t, n, "payload").values;
425
+ function Ne(e, t, n) {
426
+ return K(e.values, t, n, "payload").values;
427
427
  }
428
428
  // src/core/excel/parseSheet.ts
429
- function Ie(e) {
429
+ function Pe(e) {
430
430
  return typeof e == "object" && !!e && "error" in e;
431
431
  }
432
- function Le(e, t) {
433
- return e.type !== t.Formula || !Ie(e.result) ? null : `公式计算结果错误: ${String(e.result.error)}`;
432
+ function Fe(e, t) {
433
+ return e.type !== t.Formula || !Pe(e.result) ? null : `公式计算结果错误: ${String(e.result.error)}`;
434
434
  }
435
- function Re(e, t, n) {
435
+ function Ie(e, t, n) {
436
436
  return t === "text" && (e.type === n.Date || e.type === n.Formula && e.result instanceof Date) ? "text 字段不支持日期/时间格式的单元格, 请将单元格设为文本格式" : null;
437
437
  }
438
- function ze(e, t, n) {
439
- let r = (e) => e.trim() === "" ? null : e.trim(), i = t === "datetime", a = t === "time", o = t === "date" || i || a, s = (e) => a ? fe(e) : i ? pe(e) : de(e);
438
+ function Le(e, t, n) {
439
+ let r = (e) => e.trim() === "" ? null : e.trim(), i = t === "datetime", a = t === "time", o = t === "date" || i || a, s = (e) => a ? fe(e) : i ? B(e) : de(e);
440
440
  if (e.type === n.Merge || e.type === n.Null) return null;
441
441
  if (e.type === n.Date) return s(e.value);
442
442
  if (e.type === n.Formula) {
443
- if (e.result === null || e.result === void 0 || Ie(e.result)) return null;
443
+ if (e.result === null || e.result === void 0 || Pe(e.result)) return null;
444
444
  if (e.result instanceof Date) return s(e.result);
445
445
  if (o && typeof e.result == "number") {
446
- let t = me(e.result);
446
+ let t = pe(e.result);
447
447
  if (t) return s(t);
448
448
  }
449
449
  return r(String(e.result));
450
450
  }
451
451
  if (e.type === n.Number) {
452
452
  if (o && typeof e.value == "number") {
453
- let t = me(e.value);
453
+ let t = pe(e.value);
454
454
  if (t) return s(t);
455
455
  }
456
456
  return r(String(e.value));
457
457
  }
458
458
  return r(e.text);
459
459
  }
460
- function Be(e, t) {
460
+ function Re(e, t) {
461
461
  let n = new Map(t.map((e) => [e.title, e])), r = [], i = [], a = /* @__PURE__ */ new Map();
462
462
  for (let t = 1; t <= e.columnCount; t++) {
463
463
  let o = e.getRow(1).getCell(t).text.split("\n")[0].trim(), s = n.get(o) ?? null, c = s && s.importable === !1 ? null : s;
@@ -482,10 +482,10 @@ function Be(e, t) {
482
482
  duplicateHeaders: o
483
483
  };
484
484
  }
485
- function Ve(e) {
485
+ function ze(e) {
486
486
  return `文件表头重复:${e.slice(0, 3).map(({ title: e, columns: t }) => `${e}(${t.map((e) => `${e} 列`).join("、")})`).join(";")}${e.length > 3 ? ` 等 ${e.length} 组` : ""},请修改表头后重新导入`;
487
487
  }
488
- function He(e, t, n) {
488
+ function Be(e, t, n) {
489
489
  let r = [], i = [], a = [], o = [], s = 0;
490
490
  if (e.hasMerges) {
491
491
  let t = e.model.merges, n = t.slice(0, 3).join("、"), s = t.length > 3 ? ` 等 ${t.length} 处` : "";
@@ -498,25 +498,25 @@ function He(e, t, n) {
498
498
  includedKeys: []
499
499
  };
500
500
  }
501
- let { columns: c, unknownColumns: l, duplicateHeaders: u } = Be(e, t), d = c.filter((e) => e !== null).map((e) => e.key), f = new Set(d);
502
- return u.length > 0 && r.push(Ve(u)), t.forEach((e) => {
501
+ let { columns: c, unknownColumns: l, duplicateHeaders: u } = Re(e, t), d = c.filter((e) => e !== null).map((e) => e.key), f = new Set(d);
502
+ return u.length > 0 && r.push(ze(u)), t.forEach((e) => {
503
503
  e.importable !== !1 && e.property.required && !f.has(e.key) && i.push(e.title);
504
504
  }), u.length > 0 || i.length > 0 || (e.eachRow({ includeEmpty: !1 }, (e, r) => {
505
505
  if (r === 1) return;
506
506
  let i = {}, l = {};
507
507
  if (c.forEach((t, r) => {
508
508
  if (!t) return;
509
- let a = e.getCell(r + 1), o = Le(a, n), s = Re(a, t.type, n);
510
- o ? (i[t.key] = null, l[t.key] = o) : s ? (i[t.key] = null, l[t.key] = s) : i[t.key] = ze(a, t.type, n);
509
+ let a = e.getCell(r + 1), o = Fe(a, n), s = Ie(a, t.type, n);
510
+ o ? (i[t.key] = null, l[t.key] = o) : s ? (i[t.key] = null, l[t.key] = s) : i[t.key] = Le(a, t.type, n);
511
511
  }), c.forEach((t, i) => {
512
512
  if (!t) return;
513
513
  let o = e.getCell(i + 1);
514
514
  o.type === n.Formula && (o.result === null || o.result === void 0) && (s += 1, a.length < 20 && a.push(`第 ${r} 行 [${t.title}] 是公式且没有保存计算结果, 请用 Excel 打开并保存后再导入`));
515
515
  }), Object.values(i).every((e) => e === null) && Object.keys(l).length === 0) return;
516
- let u = Pe(i, t, d, "parse");
516
+ let u = K(i, t, d, "parse");
517
517
  t.forEach((e) => {
518
518
  let t = l[e.key];
519
- t && (u.values[e.key] = W(e, i[e.key] ?? null), u.errors[e.key] = t);
519
+ t && (u.values[e.key] = je(e, i[e.key] ?? null), u.errors[e.key] = t);
520
520
  }), o.push({
521
521
  key: String(o.length),
522
522
  rowNumber: r,
@@ -533,33 +533,33 @@ function He(e, t, n) {
533
533
  };
534
534
  }
535
535
  // src/core/excel/worksheet.ts
536
- function Ue(e, t) {
536
+ function Ve(e, t) {
537
537
  let n = t[e.key];
538
538
  if (n == null || n === "") return null;
539
539
  switch (e.type) {
540
540
  case "date": return ge(n) ?? String(n);
541
541
  case "number": return String(n);
542
- case "datetime": return H(n) ?? String(n);
543
- case "time": return V(n) ?? String(n);
542
+ case "datetime": return V(n) ?? String(n);
543
+ case "time": return _e(n) ?? String(n);
544
544
  case "boolean": return n ? e.property.true_label : e.property.false_label;
545
- case "single_choice": return k(e.property.option_map, n) ?? String(n);
545
+ case "single_choice": return O(e.property.option_map, n) ?? String(n);
546
546
  case "multiple_choice": {
547
547
  let t = e.property.option_map;
548
- return D((Array.isArray(n) ? n : [n]).map((e) => k(t, e) ?? String(e)));
548
+ return E((Array.isArray(n) ? n : [n]).map((e) => O(t, e) ?? String(e)));
549
549
  }
550
550
  case "list": {
551
551
  let t = Array.isArray(n) ? n : [n], r = e.property.item_key;
552
- return D(t.map((e) => String(r && typeof e == "object" && e ? e[r] ?? "" : e)));
552
+ return E(t.map((e) => String(r && typeof e == "object" && e ? e[r] ?? "" : e)));
553
553
  }
554
554
  default: return n;
555
555
  }
556
556
  }
557
- function We(e, t, n = !1) {
557
+ function He(e, t, n = !1) {
558
558
  t.forEach((t, r) => {
559
559
  (t.type === "text" || n && t.type === "number") && (e.getColumn(r + 1).numFmt = "@");
560
560
  });
561
561
  }
562
- function Ge(e, t, n) {
562
+ function Ue(e, t, n) {
563
563
  let r = n.map((e) => e.importable === !1 ? `${e.title}\n(仅导出)` : e.title), i = e.addRow(r);
564
564
  i.height = 20 + (Math.max(1, ...r.map((e) => e.split("\n").length)) - 1) * 15, i.eachCell({ includeEmpty: !0 }, (e) => {
565
565
  e.font = {
@@ -575,16 +575,16 @@ function Ge(e, t, n) {
575
575
  wrapText: !0
576
576
  };
577
577
  }), t.forEach((t) => {
578
- e.addRow(n.map((e) => Ue(e, t))).eachCell({ includeEmpty: !0 }, (e) => {
578
+ e.addRow(n.map((e) => Ve(e, t))).eachCell({ includeEmpty: !0 }, (e) => {
579
579
  e.alignment = {
580
580
  ...e.alignment,
581
581
  wrapText: !0,
582
582
  vertical: "top"
583
583
  };
584
584
  });
585
- }), We(e, n, !0), Je(e);
585
+ }), He(e, n, !0), Ke(e);
586
586
  }
587
- function Ke(e) {
587
+ function We(e) {
588
588
  let t = [e.property.required ? "必填" : "可选"];
589
589
  switch (e.type) {
590
590
  case "text":
@@ -609,15 +609,15 @@ function Ke(e) {
609
609
  t.push(`多个值用分号分隔(中英文均可), 最多 ${e.property.list_max_length} 个`);
610
610
  break;
611
611
  case "single_choice":
612
- t.push(`填其一: ${j(e.property.option_map).join(" / ")}`);
612
+ t.push(`填其一: ${A(e.property.option_map).join(" / ")}`);
613
613
  break;
614
- case "multiple_choice": t.push(`可多选, 分号分隔(中英文均可): ${j(e.property.option_map).join(" / ")}`);
614
+ case "multiple_choice": t.push(`可多选, 分号分隔(中英文均可): ${A(e.property.option_map).join(" / ")}`);
615
615
  }
616
- let n = Ue(e, { [e.key]: e.property.default_value });
616
+ let n = Ve(e, { [e.key]: e.property.default_value });
617
617
  return t.push(`默认值: ${n == null || n === "" ? "空" : n}`), t.join("\n");
618
618
  }
619
- function qe(e, t) {
620
- let n = t.map((e) => `${e.title}\n\n${Ke(e)}`), r = e.addRow(n);
619
+ function Ge(e, t) {
620
+ let n = t.map((e) => `${e.title}\n\n${We(e)}`), r = e.addRow(n);
621
621
  r.height = 20 + (Math.max(1, ...n.map((e) => e.split("\n").length)) - 1) * 15, r.eachCell({ includeEmpty: !0 }, (e) => {
622
622
  e.font = {
623
623
  bold: !0,
@@ -631,9 +631,9 @@ function qe(e, t) {
631
631
  vertical: "top",
632
632
  wrapText: !0
633
633
  };
634
- }), We(e, t, !0), Je(e);
634
+ }), He(e, t, !0), Ke(e);
635
635
  }
636
- function Je(e, t = 20, n = 60) {
636
+ function Ke(e, t = 20, n = 60) {
637
637
  let r = [], i = Math.min(e.rowCount, 201);
638
638
  for (let t = 1; t <= i; t++) e.getRow(t).eachCell({ includeEmpty: !1 }, (e, t) => {
639
639
  let n = t - 1, i = e.text, a = e.font?.size || 11, o = .8 + a / 11 * .4, s = i.split("\n"), c = 0;
@@ -654,52 +654,52 @@ function Je(e, t = 20, n = 60) {
654
654
  });
655
655
  }
656
656
  // src/core/excel/runtime.ts
657
- var Ye = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
658
- function Xe(e, n) {
657
+ var qe = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
658
+ function Je(e, n) {
659
659
  t.saveAs(e, `${n}.xlsx`);
660
660
  }
661
- var Ze;
662
- function Qe() {
663
- return Ze ??= import("exceljs").then((e) => e.default ?? e, (e) => {
664
- throw Ze = void 0, e;
665
- }), Ze;
661
+ var Ye;
662
+ function Xe() {
663
+ return Ye ??= import("exceljs").then((e) => e.default ?? e, (e) => {
664
+ throw Ye = void 0, e;
665
+ }), Ye;
666
666
  }
667
- var $e = 50;
668
- function et() {
667
+ var Ze = 50;
668
+ function Qe() {
669
669
  return new Promise((e) => {
670
670
  let t = !1, n = () => {
671
671
  t || (t = !0, clearTimeout(r), e());
672
- }, r = setTimeout(n, $e);
672
+ }, r = setTimeout(n, Ze);
673
673
  typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
674
674
  t || setTimeout(n, 0);
675
675
  });
676
676
  });
677
677
  }
678
- function tt(e) {
678
+ function $e(e) {
679
679
  if (e?.aborted) throw new DOMException("任务已取消", "AbortError");
680
680
  }
681
- async function nt(e, t, n) {
682
- let r = await Qe();
683
- tt(n), await et();
681
+ async function et(e, t, n) {
682
+ let r = await Xe();
683
+ $e(n), await Qe();
684
684
  let i = new r.Workbook();
685
- Ge(i.addWorksheet("Sheet"), e, t);
685
+ Ue(i.addWorksheet("Sheet"), e, t);
686
686
  let a = await i.xlsx.writeBuffer();
687
- return tt(n), new Blob([a], { type: Ye });
687
+ return $e(n), new Blob([a], { type: qe });
688
688
  }
689
- async function rt(e, t, n) {
690
- Xe(await nt(e, t), n);
689
+ async function tt(e, t, n) {
690
+ Je(await et(e, t), n);
691
691
  }
692
- async function it(e, t) {
693
- let n = await Qe();
694
- await et();
692
+ async function nt(e, t) {
693
+ let n = await Xe();
694
+ await Qe();
695
695
  let r = new n.Workbook();
696
- qe(r.addWorksheet("导入模板"), e);
696
+ Ge(r.addWorksheet("导入模板"), e);
697
697
  let i = await r.xlsx.writeBuffer();
698
- Xe(new Blob([i], { type: Ye }), t);
698
+ Je(new Blob([i], { type: qe }), t);
699
699
  }
700
- async function at(e, t) {
701
- let n = await Qe(), r = await e.arrayBuffer();
702
- await et();
700
+ async function rt(e, t) {
701
+ let n = await Xe(), r = await e.arrayBuffer();
702
+ await Qe();
703
703
  let i = new n.Workbook();
704
704
  if (await i.xlsx.load(r), i.worksheets.length > 1) return {
705
705
  headerMessages: ["文件包含多个工作表, 只支持单个工作表, 请删除其他工作表后再导入"],
@@ -710,7 +710,7 @@ async function at(e, t) {
710
710
  includedKeys: []
711
711
  };
712
712
  let a = i.worksheets[0];
713
- return a ? He(a, t, n.ValueType) : {
713
+ return a ? Be(a, t, n.ValueType) : {
714
714
  headerMessages: ["文件里没有工作表"],
715
715
  missingColumns: [],
716
716
  formulaMessages: [],
@@ -720,26 +720,26 @@ async function at(e, t) {
720
720
  };
721
721
  }
722
722
  // src/core/excel/exportFile.ts
723
- function ot(e) {
724
- return `${e.getFullYear()}${P(e.getMonth() + 1)}${P(e.getDate())}${P(e.getHours())}${P(e.getMinutes())}${P(e.getSeconds())}`;
723
+ function it(e) {
724
+ return `${e.getFullYear()}${M(e.getMonth() + 1)}${M(e.getDate())}${M(e.getHours())}${M(e.getMinutes())}${M(e.getSeconds())}`;
725
725
  }
726
- function st(e) {
727
- return `${e}_${ot(/* @__PURE__ */ new Date())}`;
726
+ function at(e) {
727
+ return `${e}_${it(/* @__PURE__ */ new Date())}`;
728
728
  }
729
- async function ct(e) {
729
+ async function ot(e) {
730
730
  let { title: t, fieldSchemas: n, rows: r } = e;
731
731
  if (r.length === 0) throw Error("没有可导出的数据");
732
- await rt(r, n, st(t));
732
+ await tt(r, n, at(t));
733
733
  }
734
734
  // src/core/task/stats.ts
735
- function lt(e, t) {
735
+ function st(e, t) {
736
736
  let n = Date.now();
737
737
  return [...e, {
738
738
  time: n,
739
739
  processed: t
740
740
  }].filter((e) => n - e.time <= 15e3).slice(-20);
741
741
  }
742
- function ut(e) {
742
+ function ct(e) {
743
743
  if (e.status !== "running" || e.total <= 0) return null;
744
744
  let t = Math.max(0, e.total - (e.validationFailedCount ?? 0) - e.processed);
745
745
  if (t === 0) return 0;
@@ -747,80 +747,80 @@ function ut(e) {
747
747
  let n = e.samples[0], r = e.samples[e.samples.length - 1], i = (r.time - n.time) / 1e3, a = r.processed - n.processed;
748
748
  return i <= 0 || a <= 0 ? null : t / (a / i);
749
749
  }
750
- function dt(e) {
750
+ function lt(e) {
751
751
  return e.type === "import" ? e.successCount === void 0 ? e.rowStates?.filter((e) => e.status === "completed").length ?? e.processed : e.successCount : e.processed;
752
752
  }
753
- function ft(e) {
754
- return e.total <= 0 ? 0 : Math.min(100, dt(e) / e.total * 100);
753
+ function ut(e) {
754
+ return e.total <= 0 ? 0 : Math.min(100, lt(e) / e.total * 100);
755
755
  }
756
- function pt(e) {
756
+ function dt(e) {
757
757
  if (e.finalizing) return 100;
758
- let t = ft(e);
758
+ let t = ut(e);
759
759
  return t >= 100 ? 100 : Math.trunc(t * 10) / 10;
760
760
  }
761
- function mt(e) {
761
+ function ft(e) {
762
762
  return `${(Math.trunc(e * 10) / 10).toFixed(1)}%`;
763
763
  }
764
- function ht(e) {
764
+ function pt(e) {
765
765
  if (e === null) return "计算中...";
766
766
  let t = Math.ceil(e);
767
767
  return t < 60 ? `约 ${t} 秒` : `约 ${Math.floor(t / 60)} 分 ${t % 60} 秒`;
768
768
  }
769
769
  // src/core/task/store.ts
770
- var G = { tasks: [] }, gt = /* @__PURE__ */ new Set(), K = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map();
771
- function _t() {
772
- G = { ...G }, gt.forEach((e) => e());
770
+ var q = { tasks: [] }, mt = /* @__PURE__ */ new Set(), ht = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new Map();
771
+ function gt() {
772
+ q = { ...q }, mt.forEach((e) => e());
773
773
  }
774
- function vt(e) {
775
- return gt.add(e), () => {
776
- gt.delete(e);
774
+ function _t(e) {
775
+ return mt.add(e), () => {
776
+ mt.delete(e);
777
777
  };
778
778
  }
779
- function yt(e) {
780
- return vt(e);
779
+ function vt(e) {
780
+ return _t(e);
781
781
  }
782
- function bt() {
783
- return G.tasks;
782
+ function yt() {
783
+ return q.tasks;
784
784
  }
785
- function xt() {
785
+ function bt() {
786
786
  return `task-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
787
787
  }
788
- function Y(e) {
789
- return G.tasks.find((t) => t.id === e);
788
+ function X(e) {
789
+ return q.tasks.find((t) => t.id === e);
790
790
  }
791
- function X(e, t) {
792
- let n = !1, r = G.tasks.map((r) => r.id === e ? (n = !0, {
791
+ function Z(e, t) {
792
+ let n = !1, r = q.tasks.map((r) => r.id === e ? (n = !0, {
793
793
  ...r,
794
794
  ...t
795
795
  }) : r);
796
- n && (G = {
797
- ...G,
796
+ n && (q = {
797
+ ...q,
798
798
  tasks: r
799
- }, _t());
799
+ }, gt());
800
800
  }
801
- function St(e) {
802
- G = {
803
- ...G,
804
- tasks: [...G.tasks, e]
805
- }, _t();
801
+ function xt(e) {
802
+ q = {
803
+ ...q,
804
+ tasks: [...q.tasks, e]
805
+ }, gt();
806
806
  }
807
- function Ct(e) {
808
- G = {
809
- ...G,
810
- tasks: G.tasks.filter((t) => t.id !== e)
811
- }, _t();
807
+ function St(e) {
808
+ q = {
809
+ ...q,
810
+ tasks: q.tasks.filter((t) => t.id !== e)
811
+ }, gt();
812
812
  }
813
- function wt() {
814
- J.forEach((e) => e.abort()), J.clear(), K.clear(), q.clear(), G = { tasks: [] }, _t();
813
+ function Ct() {
814
+ Y.forEach((e) => e.abort()), Y.clear(), ht.clear(), J.clear(), q = { tasks: [] }, gt();
815
815
  }
816
816
  // src/core/task/types.ts
817
- var Z = class extends Error {
817
+ var wt = class extends Error {
818
818
  constructor(e) {
819
819
  super(e), this.name = "ImportPauseError";
820
820
  }
821
821
  }, Tt = 100, Et = 20, Dt = 200, Ot = 3, kt = 100, Q = /* @__PURE__ */ new Set(), $ = null;
822
822
  function At(e, t, n) {
823
- let r = q.get(e);
823
+ let r = J.get(e);
824
824
  r && (r.rowStates[t] = {
825
825
  ...r.rowStates[t],
826
826
  ...n
@@ -848,18 +848,18 @@ function Pt(e, t) {
848
848
  validationFailedCount: t.validationFailedCount,
849
849
  failures: t.failures.slice(),
850
850
  rowStates: t.rowStates.slice(),
851
- samples: lt(Y(e)?.samples ?? [], t.processed)
851
+ samples: st(X(e)?.samples ?? [], t.processed)
852
852
  };
853
853
  }
854
854
  function Ft(e) {
855
- let t = q.get(e);
856
- t && Y(e) && X(e, Pt(e, t));
855
+ let t = J.get(e);
856
+ t && X(e) && Z(e, Pt(e, t));
857
857
  }
858
858
  function It(e) {
859
859
  return e.options.rows.length - e.deletedIndexes.size;
860
860
  }
861
861
  function Lt(e, t) {
862
- t.pauseRequested || (t.pauseRequested = !0, X(e, { pausing: !0 }));
862
+ t.pauseRequested || (t.pauseRequested = !0, Z(e, { pausing: !0 }));
863
863
  }
864
864
  function Rt(e) {
865
865
  return e.lastBatchErrorMessage ? `导入异常:${e.lastBatchErrorMessage};` : "";
@@ -875,14 +875,14 @@ function Bt(e) {
875
875
  async function Vt(e, t, n) {
876
876
  let r = t.options.rows.length;
877
877
  if (t.controller = n, t.pauseRequested = !1, t.cancelRequested = !1, t.runFailureCount = 0, t.lastBatchErrorMessage = void 0, r === 0) {
878
- X(e, {
878
+ Z(e, {
879
879
  status: "failed",
880
880
  pausing: !1,
881
881
  errorMessage: "没有可导入的数据"
882
882
  }), t.options.onFinished?.();
883
883
  return;
884
884
  }
885
- X(e, {
885
+ Z(e, {
886
886
  ...Pt(e, t),
887
887
  status: "running",
888
888
  samples: [{
@@ -913,7 +913,7 @@ async function Vt(e, t, n) {
913
913
  try {
914
914
  let i = r.map((e) => t.options.rows[e]), a = await t.options.importRows(i);
915
915
  if (n.signal.aborted) return;
916
- if (a.length !== r.length) throw new Z("导入接口返回结果数量不正确, 任务已暂停");
916
+ if (a.length !== r.length) throw new wt("导入接口返回结果数量不正确, 任务已暂停");
917
917
  a.forEach((n, i) => {
918
918
  let a = r[i], o = t.options.rows[a];
919
919
  n.success ? (t.successCount += 1, At(e, a, {
@@ -932,7 +932,7 @@ async function Vt(e, t, n) {
932
932
  });
933
933
  } catch (i) {
934
934
  if (n.signal.aborted) return;
935
- let a = i instanceof Z, o = i instanceof Error ? i.message : "导入失败";
935
+ let a = i instanceof wt, o = i instanceof Error ? i.message : "导入失败";
936
936
  t.lastBatchErrorMessage = o;
937
937
  let s = `${o}(该批结果未知,重试可能重复)`;
938
938
  r.forEach((n) => {
@@ -950,7 +950,7 @@ async function Vt(e, t, n) {
950
950
  }
951
951
  }
952
952
  }, s = Math.min(Ot, Math.max(1, r));
953
- await Promise.all(Array.from({ length: s }, () => o())), t.controller = null, Y(e) && Kt(e, t, n);
953
+ await Promise.all(Array.from({ length: s }, () => o())), t.controller = null, X(e) && Kt(e, t, n);
954
954
  }
955
955
  function Ht(e) {
956
956
  e.rowStates = e.rowStates.map((e) => e.status === "queued" || e.status === "running" ? { status: "canceled" } : e);
@@ -963,7 +963,7 @@ function Wt(e) {
963
963
  }
964
964
  function Gt(e, t, n) {
965
965
  let r = n.status === "paused" ? Wt(t) : void 0;
966
- X(e, {
966
+ Z(e, {
967
967
  ...Pt(e, t),
968
968
  pausing: !1,
969
969
  ...n,
@@ -1000,12 +1000,12 @@ function Kt(e, t, n) {
1000
1000
  }
1001
1001
  function qt(e, t) {
1002
1002
  let n = new AbortController(), r = t.runId + 1;
1003
- t.runId = r, J.set(e, n), Vt(e, t, n).finally(() => {
1004
- t.runId === r && (J.delete(e), Q.delete(e), Y(e)?.status !== "paused" && q.delete(e));
1003
+ t.runId = r, Y.set(e, n), Vt(e, t, n).finally(() => {
1004
+ t.runId === r && (Y.delete(e), Q.delete(e), X(e)?.status !== "paused" && J.delete(e));
1005
1005
  });
1006
1006
  }
1007
1007
  function Jt(e) {
1008
- let t = xt(), n = e.rows.map((e) => ({
1008
+ let t = bt(), n = e.rows.map((e) => ({
1009
1009
  status: "queued",
1010
1010
  validationErrors: Object.keys(e.errors).length > 0 ? e.errors : void 0
1011
1011
  })), r = new Set(e.rows.flatMap((e, t) => Object.keys(e.errors).length > 0 ? [t] : [])), i = r.size, a = {
@@ -1038,18 +1038,18 @@ function Jt(e) {
1038
1038
  runFailureCount: 0,
1039
1039
  controller: null
1040
1040
  };
1041
- return q.set(t, o), St(a), qt(t, o), t;
1041
+ return J.set(t, o), xt(a), qt(t, o), t;
1042
1042
  }
1043
1043
  function Yt(e) {
1044
- let t = Y(e);
1044
+ let t = X(e);
1045
1045
  if (!t || t.type !== "import" || t.status !== "paused") return;
1046
- let n = q.get(e);
1046
+ let n = J.get(e);
1047
1047
  if (!n) return;
1048
1048
  let r = n.rowStates.filter((e) => e.status === "completed").length, i = n.rowStates.map((e) => e.status === "completed" || e.status === "deleted" ? e : {
1049
1049
  status: "queued",
1050
1050
  validationErrors: e.validationErrors
1051
1051
  }), a = i.filter((e) => e.validationErrors && Object.keys(e.validationErrors).length > 0).length;
1052
- n.rowStates = i, n.validationFailedCount = a, n.nextIndex = 0, n.processed = r, n.successCount = r, n.failures = [], n.pauseRequested = !1, n.cancelRequested = !1, n.runFailureCount = 0, n.lastBatchErrorMessage = void 0, X(e, {
1052
+ n.rowStates = i, n.validationFailedCount = a, n.nextIndex = 0, n.processed = r, n.successCount = r, n.failures = [], n.pauseRequested = !1, n.cancelRequested = !1, n.runFailureCount = 0, n.lastBatchErrorMessage = void 0, Z(e, {
1053
1053
  status: "running",
1054
1054
  pausing: !1,
1055
1055
  canceling: !1,
@@ -1064,19 +1064,19 @@ function Yt(e) {
1064
1064
  }), qt(e, n);
1065
1065
  }
1066
1066
  function Xt(e) {
1067
- let t = Y(e);
1067
+ let t = X(e);
1068
1068
  if (!t || t.type !== "import" || t.status !== "running" || t.canceling || t.pausing) return;
1069
- let n = q.get(e);
1069
+ let n = J.get(e);
1070
1070
  n && Lt(e, n);
1071
1071
  }
1072
1072
  function Zt(e, t, n) {
1073
- let r = Y(e), i = q.get(e);
1073
+ let r = X(e), i = J.get(e);
1074
1074
  if (!r || r.type !== "import" || r.status !== "paused" && r.status !== "failed" || !i) return;
1075
1075
  let a = r.rowStates?.[t]?.status;
1076
1076
  (a === "queued" || a === "failed") && (i.options.rows[t] = n);
1077
1077
  }
1078
1078
  function Qt(e, t, n) {
1079
- let r = Y(e), i = q.get(e);
1079
+ let r = X(e), i = J.get(e);
1080
1080
  if (!r || r.type !== "import" || !i || r.status !== "paused" && r.status !== "failed") return;
1081
1081
  let a = Object.keys(n).length > 0, o = i.rowStates[t]?.validationErrors, s = !!(o && Object.keys(o).length > 0);
1082
1082
  a ? (i.skippedIndexes.add(t), s || (i.validationFailedCount += 1)) : (i.skippedIndexes.delete(t), s && --i.validationFailedCount), i.rowStates[t] = {
@@ -1085,20 +1085,20 @@ function Qt(e, t, n) {
1085
1085
  }, i.options.rows[t] = {
1086
1086
  ...i.options.rows[t],
1087
1087
  errors: n
1088
- }, X(e, {
1088
+ }, Z(e, {
1089
1089
  validationFailedCount: i.validationFailedCount,
1090
1090
  rowStates: i.rowStates.slice()
1091
1091
  });
1092
1092
  }
1093
1093
  function $t(e, t) {
1094
- let n = Y(e), r = q.get(e);
1094
+ let n = X(e), r = J.get(e);
1095
1095
  n && n.type === "import" && n.status === "paused" && r && (t.forEach((e) => {
1096
1096
  let t = r.rowStates[e];
1097
1097
  (t?.status === "queued" || t?.status === "failed") && (t.validationErrors && Object.keys(t.validationErrors).length > 0 && --r.validationFailedCount, t.status === "failed" && (r.failures = r.failures.filter((t) => t.index !== e)), r.deletedIndexes.add(e), r.rowStates[e] = {
1098
1098
  status: "deleted",
1099
1099
  fieldErrors: void 0
1100
1100
  });
1101
- }), X(e, {
1101
+ }), Z(e, {
1102
1102
  total: It(r),
1103
1103
  failureCount: r.failures.length,
1104
1104
  failures: r.failures.slice(),
@@ -1107,7 +1107,7 @@ function $t(e, t) {
1107
1107
  }));
1108
1108
  }
1109
1109
  function en(e, t, n) {
1110
- let r = Y(e)?.rowStates?.[t];
1110
+ let r = X(e)?.rowStates?.[t];
1111
1111
  if (!r?.fieldErrors?.some((e) => n in e)) return;
1112
1112
  let i = r.fieldErrors.filter((e) => !(n in e));
1113
1113
  At(e, t, {
@@ -1173,14 +1173,14 @@ async function ln(e, t, n) {
1173
1173
  }
1174
1174
  t.rows.push(...a.results);
1175
1175
  let u = t.rows.length;
1176
- X(e, {
1176
+ Z(e, {
1177
1177
  total: t.total,
1178
1178
  processed: u,
1179
- samples: lt(Y(e)?.samples ?? [], u)
1179
+ samples: st(X(e)?.samples ?? [], u)
1180
1180
  }), t.cursorId = l;
1181
1181
  }
1182
1182
  if (t.cancelRequested) {
1183
- X(e, {
1183
+ Z(e, {
1184
1184
  status: "canceled",
1185
1185
  pausing: !1,
1186
1186
  canceling: !1,
@@ -1189,15 +1189,15 @@ async function ln(e, t, n) {
1189
1189
  return;
1190
1190
  }
1191
1191
  if (t.rows.length === 0) throw Error("没有可导出的数据");
1192
- X(e, { finalizing: !0 }), await cn(sn);
1193
- let i = await nt(t.rows, r.fieldSchemas, n.signal);
1192
+ Z(e, { finalizing: !0 }), await cn(sn);
1193
+ let i = await et(t.rows, r.fieldSchemas, n.signal);
1194
1194
  if (n.signal.aborted) throw new DOMException("任务已取消", "AbortError");
1195
1195
  try {
1196
- Xe(i, r.fileName);
1196
+ Je(i, r.fileName);
1197
1197
  } catch (e) {
1198
1198
  console.error(`自动下载失败: ${e}`);
1199
1199
  }
1200
- X(e, {
1200
+ Z(e, {
1201
1201
  status: "completed",
1202
1202
  pausing: !1,
1203
1203
  finalizing: !1,
@@ -1208,7 +1208,7 @@ async function ln(e, t, n) {
1208
1208
  });
1209
1209
  } catch (t) {
1210
1210
  if (n.signal.aborted) {
1211
- X(e, {
1211
+ Z(e, {
1212
1212
  status: "canceled",
1213
1213
  pausing: !1,
1214
1214
  finalizing: !1,
@@ -1216,7 +1216,7 @@ async function ln(e, t, n) {
1216
1216
  });
1217
1217
  return;
1218
1218
  }
1219
- X(e, {
1219
+ Z(e, {
1220
1220
  status: "failed",
1221
1221
  pausing: !1,
1222
1222
  finalizing: !1,
@@ -1232,12 +1232,12 @@ function un(e) {
1232
1232
  }
1233
1233
  function dn(e, t) {
1234
1234
  let n = new AbortController();
1235
- J.set(e, n), ln(e, t, n).finally(() => {
1236
- J.delete(e), K.delete(e);
1235
+ Y.set(e, n), ln(e, t, n).finally(() => {
1236
+ Y.delete(e), ht.delete(e);
1237
1237
  });
1238
1238
  }
1239
1239
  function fn(e) {
1240
- let t = xt(), n = {
1240
+ let t = bt(), n = {
1241
1241
  id: t,
1242
1242
  type: "export",
1243
1243
  title: e.title,
@@ -1253,25 +1253,25 @@ function fn(e) {
1253
1253
  cancelRequested: !1,
1254
1254
  controller: null
1255
1255
  };
1256
- return K.set(t, r), St(n), dn(t, r), t;
1256
+ return ht.set(t, r), xt(n), dn(t, r), t;
1257
1257
  }
1258
1258
  function pn(e, t) {
1259
1259
  try {
1260
- return Xe(e, t), !0;
1260
+ return Je(e, t), !0;
1261
1261
  } catch (e) {
1262
1262
  return console.error(`下载失败: ${e}`), !1;
1263
1263
  }
1264
1264
  }
1265
1265
  function mn(e) {
1266
- let t = Y(e);
1266
+ let t = X(e);
1267
1267
  return t?.type !== "export" || !t.blob || !t.fileName ? !1 : pn(t.blob, t.fileName);
1268
1268
  }
1269
1269
  // src/core/task/index.ts
1270
1270
  function hn(e) {
1271
- let t = Y(e);
1271
+ let t = X(e);
1272
1272
  if (!t) return;
1273
1273
  if (t.status === "paused") {
1274
- X(e, {
1274
+ Z(e, {
1275
1275
  status: "canceled",
1276
1276
  pausing: !1,
1277
1277
  canceling: !1,
@@ -1279,33 +1279,33 @@ function hn(e) {
1279
1279
  errorMessage: void 0,
1280
1280
  pauseReason: void 0
1281
1281
  });
1282
- let n = q.get(e);
1283
- q.delete(e), Mt(e), n?.options.onFinished?.();
1282
+ let n = J.get(e);
1283
+ J.delete(e), Mt(e), n?.options.onFinished?.();
1284
1284
  return;
1285
1285
  }
1286
1286
  if (t.status !== "running") return;
1287
1287
  if (t.type === "export") {
1288
1288
  if (t.canceling || t.finalizing) return;
1289
- let n = K.get(e);
1289
+ let n = ht.get(e);
1290
1290
  if (!n) return;
1291
- n.cancelRequested = !0, n.controller?.abort(), X(e, { canceling: !0 });
1291
+ n.cancelRequested = !0, n.controller?.abort(), Z(e, { canceling: !0 });
1292
1292
  return;
1293
1293
  }
1294
1294
  if (t.canceling) return;
1295
- let n = q.get(e);
1296
- n && (n.cancelRequested = !0, X(e, { canceling: !0 }));
1295
+ let n = J.get(e);
1296
+ n && (n.cancelRequested = !0, Z(e, { canceling: !0 }));
1297
1297
  }
1298
1298
  function gn(e) {
1299
- let t = Y(e);
1300
- t && (t.status === "running" && J.get(e)?.abort(), K.delete(e), q.delete(e), Mt(e), Ct(e));
1299
+ let t = X(e);
1300
+ t && (t.status === "running" && Y.get(e)?.abort(), ht.delete(e), J.delete(e), Mt(e), St(e));
1301
1301
  }
1302
1302
  function _n() {
1303
- Nt(), wt();
1303
+ Nt(), Ct();
1304
1304
  }
1305
1305
  // src/react/useTaskDetail.ts
1306
1306
  function vn(e) {
1307
- let t = re(() => e ? bt().find((t) => t.id === e) : void 0, [e]);
1308
- return S(yt, t);
1307
+ let t = re(() => e ? yt().find((t) => t.id === e) : void 0, [e]);
1308
+ return S(vt, t);
1309
1309
  }
1310
1310
  // src/components/ExportTaskModal.tsx
1311
1311
  function yn(e) {
@@ -1322,6 +1322,13 @@ function yn(e) {
1322
1322
  function bn(e) {
1323
1323
  if (e.canceling) return "warning";
1324
1324
  if (e.finalizing) return "processing";
1325
+ switch (e.status) {
1326
+ case "running": return "processing";
1327
+ case "paused": return "warning";
1328
+ case "completed": return "success";
1329
+ case "failed": return "error";
1330
+ case "canceled": return "warning";
1331
+ }
1325
1332
  }
1326
1333
  function xn(e) {
1327
1334
  switch (e.status) {
@@ -1335,12 +1342,12 @@ var Sn = ({ taskId: e, onClose: t }) => {
1335
1342
  if (v(() => {
1336
1343
  n ? i.current = !1 : i.current || (i.current = !0, t());
1337
1344
  }, [n, t]), !n) return null;
1338
- let a = n.status === "completed" || n.status === "failed" || n.status === "canceled", l = pt(n), u = () => {
1345
+ let a = n.status === "completed" || n.status === "failed" || n.status === "canceled", l = dt(n), u = () => {
1339
1346
  gn(n.id), t();
1340
1347
  }, f = () => {
1341
1348
  mn(n.id) || r.error("文件不存在");
1342
1349
  }, m = yn(n);
1343
- return /* @__PURE__ */ w(d, {
1350
+ return /* @__PURE__ */ C(d, {
1344
1351
  title: n.title,
1345
1352
  open: !0,
1346
1353
  maskClosable: !1,
@@ -1349,20 +1356,20 @@ var Sn = ({ taskId: e, onClose: t }) => {
1349
1356
  onCancel: () => {
1350
1357
  a && u();
1351
1358
  },
1352
- footer: a ? /* @__PURE__ */ T(c, {
1359
+ footer: a ? /* @__PURE__ */ w(c, {
1353
1360
  justify: "flex-end",
1354
1361
  gap: 8,
1355
- children: [n.status === "completed" ? /* @__PURE__ */ w(s, {
1362
+ children: [n.status === "completed" ? /* @__PURE__ */ C(s, {
1356
1363
  onClick: f,
1357
1364
  children: "重新下载"
1358
- }) : null, /* @__PURE__ */ w(s, {
1365
+ }) : null, /* @__PURE__ */ C(s, {
1359
1366
  type: "primary",
1360
1367
  onClick: u,
1361
1368
  children: "关闭"
1362
1369
  })]
1363
- }) : /* @__PURE__ */ w(c, {
1370
+ }) : /* @__PURE__ */ C(c, {
1364
1371
  justify: "flex-end",
1365
- children: /* @__PURE__ */ w(s, {
1372
+ children: /* @__PURE__ */ C(s, {
1366
1373
  danger: !0,
1367
1374
  loading: n.canceling,
1368
1375
  disabled: n.canceling || n.finalizing,
@@ -1370,34 +1377,34 @@ var Sn = ({ taskId: e, onClose: t }) => {
1370
1377
  children: n.canceling ? "取消中" : "取消任务"
1371
1378
  })
1372
1379
  }),
1373
- children: /* @__PURE__ */ T(c, {
1380
+ children: /* @__PURE__ */ w(c, {
1374
1381
  vertical: !0,
1375
1382
  gap: 12,
1376
1383
  children: [
1377
- /* @__PURE__ */ T(c, {
1384
+ /* @__PURE__ */ w(c, {
1378
1385
  justify: "space-between",
1379
1386
  align: "center",
1380
1387
  gap: 12,
1381
- children: [/* @__PURE__ */ T(_.Text, {
1388
+ children: [/* @__PURE__ */ w(_.Text, {
1382
1389
  type: "secondary",
1383
1390
  children: [
1384
1391
  "已导出 ",
1385
- dt(n).toLocaleString(),
1392
+ lt(n).toLocaleString(),
1386
1393
  " / 总数 ",
1387
1394
  n.total > 0 ? n.total.toLocaleString() : "--"
1388
1395
  ]
1389
- }), /* @__PURE__ */ w(g, {
1396
+ }), /* @__PURE__ */ C(g, {
1390
1397
  color: bn(n),
1391
1398
  children: m
1392
1399
  })]
1393
1400
  }),
1394
- /* @__PURE__ */ w(p, {
1401
+ /* @__PURE__ */ C(p, {
1395
1402
  percent: l,
1396
- format: () => mt(l),
1403
+ format: () => ft(l),
1397
1404
  status: xn(n),
1398
1405
  size: "small"
1399
1406
  }),
1400
- n.errorMessage ? /* @__PURE__ */ w(_.Text, {
1407
+ n.errorMessage ? /* @__PURE__ */ C(_.Text, {
1401
1408
  type: "danger",
1402
1409
  children: n.errorMessage
1403
1410
  }) : null
@@ -1419,11 +1426,11 @@ var wn = ({ title: e, fieldSchemas: t, buttonText: n = "导出", disabled: i, ex
1419
1426
  let { message: d } = o.useApp(), [f, p] = Cn(), [m, ee] = x(!1), h = b(!1), g = b(!0);
1420
1427
  return v(() => (g.current = !0, () => {
1421
1428
  g.current = !1;
1422
- }), []), /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(te, {
1429
+ }), []), /* @__PURE__ */ w(ie, { children: [/* @__PURE__ */ C(te, {
1423
1430
  title: "导出 Excel",
1424
- children: /* @__PURE__ */ w(s, {
1431
+ children: /* @__PURE__ */ C(s, {
1425
1432
  type: "default",
1426
- icon: /* @__PURE__ */ w(r, {}),
1433
+ icon: /* @__PURE__ */ C(r, {}),
1427
1434
  loading: m,
1428
1435
  disabled: i || m || !!f,
1429
1436
  onClick: async () => {
@@ -1433,7 +1440,7 @@ var wn = ({ title: e, fieldSchemas: t, buttonText: n = "导出", disabled: i, ex
1433
1440
  if (await c?.(), !g.current) return;
1434
1441
  p(fn({
1435
1442
  title: `${e}导出`,
1436
- fileName: st(e),
1443
+ fileName: at(e),
1437
1444
  fieldSchemas: t,
1438
1445
  exportRows: a,
1439
1446
  onFinished: l
@@ -1447,24 +1454,24 @@ var wn = ({ title: e, fieldSchemas: t, buttonText: n = "导出", disabled: i, ex
1447
1454
  },
1448
1455
  children: n
1449
1456
  })
1450
- }), f ? /* @__PURE__ */ w(Sn, {
1457
+ }), f ? /* @__PURE__ */ C(Sn, {
1451
1458
  taskId: f,
1452
1459
  onClose: () => {
1453
1460
  p(void 0), u?.();
1454
1461
  }
1455
1462
  }) : null] });
1456
- }, { Text: Tn } = _, En = ({ missingTitles: e, headerMessages: t }) => /* @__PURE__ */ T(c, {
1463
+ }, { Text: Tn } = _, En = ({ missingTitles: e, headerMessages: t }) => /* @__PURE__ */ w(c, {
1457
1464
  vertical: !0,
1458
1465
  gap: 4,
1459
- children: [e.length > 0 ? /* @__PURE__ */ w(Tn, { children: `缺少必填列: ${e.join(", ")}` }) : null, t.map((e, t) => /* @__PURE__ */ w(Tn, { children: e }, t))]
1466
+ children: [e.length > 0 ? /* @__PURE__ */ C(Tn, { children: `缺少必填列: ${e.join(", ")}` }) : null, t.map((e, t) => /* @__PURE__ */ C(Tn, { children: e }, t))]
1460
1467
  });
1461
1468
  // src/components/EditableImportCell.tsx
1462
1469
  function Dn(e) {
1463
- return e == null || e === "" ? "" : Array.isArray(e) ? D(e) : String(e);
1470
+ return e == null || e === "" ? "" : Array.isArray(e) ? E(e) : String(e);
1464
1471
  }
1465
1472
  var On = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
1466
1473
  let { token: a } = ne.useToken(), [o, s] = x(!1), [c, d] = x(!1), f = t.values[e.key];
1467
- if (o && !n) return e.type === "boolean" ? /* @__PURE__ */ w(m, {
1474
+ if (o && !n) return e.type === "boolean" ? /* @__PURE__ */ C(m, {
1468
1475
  autoFocus: !0,
1469
1476
  open: !0,
1470
1477
  size: "small",
@@ -1481,13 +1488,13 @@ var On = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
1481
1488
  r(e), i(e), s(!1);
1482
1489
  },
1483
1490
  onBlur: () => s(!1)
1484
- }) : e.type === "single_choice" ? /* @__PURE__ */ w(m, {
1491
+ }) : e.type === "single_choice" ? /* @__PURE__ */ C(m, {
1485
1492
  autoFocus: !0,
1486
1493
  open: !0,
1487
1494
  size: "small",
1488
1495
  style: { width: "100%" },
1489
1496
  value: typeof f == "string" ? f : void 0,
1490
- options: j(e.property.option_map).map((e) => ({
1497
+ options: A(e.property.option_map).map((e) => ({
1491
1498
  value: e,
1492
1499
  label: e
1493
1500
  })),
@@ -1495,14 +1502,14 @@ var On = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
1495
1502
  r(e), i(e), s(!1);
1496
1503
  },
1497
1504
  onBlur: () => s(!1)
1498
- }) : e.type === "multiple_choice" ? /* @__PURE__ */ w(m, {
1505
+ }) : e.type === "multiple_choice" ? /* @__PURE__ */ C(m, {
1499
1506
  autoFocus: !0,
1500
1507
  open: !0,
1501
1508
  mode: "multiple",
1502
1509
  size: "small",
1503
1510
  style: { width: "100%" },
1504
1511
  value: Array.isArray(f) ? f : [],
1505
- options: j(e.property.option_map).map((e) => ({
1512
+ options: A(e.property.option_map).map((e) => ({
1506
1513
  value: e,
1507
1514
  label: e
1508
1515
  })),
@@ -1510,7 +1517,7 @@ var On = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
1510
1517
  onBlur: () => {
1511
1518
  s(!1), i(f);
1512
1519
  }
1513
- }) : e.type === "number" ? /* @__PURE__ */ w(u, {
1520
+ }) : e.type === "number" ? /* @__PURE__ */ C(u, {
1514
1521
  autoFocus: !0,
1515
1522
  stringMode: !0,
1516
1523
  size: "small",
@@ -1523,7 +1530,7 @@ var On = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
1523
1530
  onPressEnter: () => {
1524
1531
  s(!1), i(f);
1525
1532
  }
1526
- }) : /* @__PURE__ */ w(l, {
1533
+ }) : /* @__PURE__ */ C(l, {
1527
1534
  autoFocus: !0,
1528
1535
  size: "small",
1529
1536
  value: typeof f == "string" ? f : "",
@@ -1537,7 +1544,7 @@ var On = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
1537
1544
  }
1538
1545
  });
1539
1546
  let p = Dn(f);
1540
- return /* @__PURE__ */ w("div", {
1547
+ return /* @__PURE__ */ C("div", {
1541
1548
  title: p || void 0,
1542
1549
  style: {
1543
1550
  height: 24,
@@ -1558,7 +1565,7 @@ var On = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
1558
1565
  onClick: () => {
1559
1566
  n || s(!0);
1560
1567
  },
1561
- children: /* @__PURE__ */ w("span", {
1568
+ children: /* @__PURE__ */ C("span", {
1562
1569
  style: {
1563
1570
  minWidth: 0,
1564
1571
  overflow: "hidden",
@@ -1606,7 +1613,7 @@ function An(e, t) {
1606
1613
  if (e.canceling) return "正在取消...";
1607
1614
  if (e.pausing) return "正在暂停...";
1608
1615
  switch (e.status) {
1609
- case "running": return `预计剩余 ${ht(t)}`;
1616
+ case "running": return `预计剩余 ${pt(t)}`;
1610
1617
  default: return null;
1611
1618
  }
1612
1619
  }
@@ -1683,45 +1690,51 @@ function Ln(e, t) {
1683
1690
  }, []), n;
1684
1691
  }
1685
1692
  // src/components/ImportPreviewModal.tsx
1686
- var Rn = ({ open: e, title: t, fieldSchemas: r, rows: i, taskId: a, includedKeys: u, onChangeCell: ee, onSaveCell: te, onDelete: ne, onConfirm: re, onClose: S }) => {
1687
- let [ie, ae] = x("all"), [E, D] = x("all"), [O, k] = x(""), A = In(O, 300), j = () => {
1688
- ae("all"), D("all"), k("");
1689
- }, M = vn(a), { modal: oe } = o.useApp(), N = b(null);
1693
+ var Rn = 400, zn = ({ open: e, title: t, fieldSchemas: r, rows: i, taskId: a, includedKeys: u, onChangeCell: ee, onSaveCell: te, onDelete: ne, onConfirm: re, onClose: S }) => {
1694
+ let [ae, oe] = x("all"), [T, E] = x("all"), [D, O] = x(""), [k, A] = x(!1), j = b(null), se = In(D, 300), ce = () => {
1695
+ oe("all"), E("all"), O("");
1696
+ }, M = vn(a), { modal: N } = o.useApp();
1697
+ v(() => () => {
1698
+ j.current !== null && clearTimeout(j.current);
1699
+ }, []), v(() => {
1700
+ A(!1), j.current !== null && (clearTimeout(j.current), j.current = null);
1701
+ }, [a]);
1702
+ let P = b(null);
1690
1703
  v(() => {
1691
1704
  if (!M) return;
1692
1705
  if (M.status === "running") {
1693
- N.current = null;
1706
+ P.current = null;
1694
1707
  return;
1695
1708
  }
1696
1709
  if (M.status !== "paused" || M.pauseReason !== "batch-exception") return;
1697
1710
  let e = `${M.id}:${M.errorMessage}`;
1698
- N.current !== e && (N.current = e, oe.warning({
1711
+ P.current !== e && (P.current = e, N.warning({
1699
1712
  title: `${t}导入任务已暂停`,
1700
1713
  content: M.errorMessage,
1701
1714
  okText: "知道了"
1702
1715
  }));
1703
1716
  }, [
1704
1717
  M,
1705
- oe,
1718
+ N,
1706
1719
  t
1707
1720
  ]);
1708
- let P = b(void 0);
1721
+ let F = b(void 0);
1709
1722
  v(() => {
1710
- M && (P.current = M);
1723
+ M && (F.current = M);
1711
1724
  }, [M]);
1712
- let se = y(() => new Set(u), [u]), ce = r.filter((e) => se.has(e.key)), F = P.current, I = M ?? (F?.id === a ? F : void 0), L = I ? kn(I) : void 0, R = !!(I && I.status !== "completed" && I.status !== "failed" && I.status !== "canceled"), le = Ln(I?.status === "running" ? ut(I) : null, 1e3), ue = I ? An(I, le) : null, z = (e) => e.taskIndex === void 0 ? void 0 : I?.rowStates?.[e.taskIndex], de = !(!M || M.status !== "failed" && M.status !== "paused"), fe = (e) => {
1725
+ let le = y(() => new Set(u), [u]), I = r.filter((e) => le.has(e.key)), L = F.current, R = M ?? (L?.id === a ? L : void 0), z = R ? kn(R) : void 0, ue = !!(R && R.status !== "completed" && R.status !== "failed" && R.status !== "canceled"), de = Ln(R?.status === "running" ? ct(R) : null, 1e3), fe = R ? An(R, de) : null, B = (e) => e.taskIndex === void 0 ? void 0 : R?.rowStates?.[e.taskIndex], pe = !(!M || M.status !== "failed" && M.status !== "paused"), me = (e) => {
1713
1726
  if (!a) return !0;
1714
- let t = z(e)?.status;
1715
- return de && (t === "queued" || t === "failed") ? !0 : de && e.taskIndex === void 0 && Object.keys(e.errors).length > 0;
1716
- }, pe = (e) => {
1727
+ let t = B(e)?.status;
1728
+ return pe && (t === "queued" || t === "failed") ? !0 : pe && e.taskIndex === void 0 && Object.keys(e.errors).length > 0;
1729
+ }, he = (e) => {
1717
1730
  if (!a) return !0;
1718
1731
  if (M?.status !== "paused") return !1;
1719
- let t = z(e)?.status;
1732
+ let t = B(e)?.status;
1720
1733
  return t === "queued" || t === "failed";
1721
- }, me = y(() => ["valid", "invalid"].map((e) => ({
1734
+ }, ge = y(() => ["valid", "invalid"].map((e) => ({
1722
1735
  value: e,
1723
1736
  label: Mn[e].label
1724
- })), []), he = y(() => [
1737
+ })), []), _e = y(() => [
1725
1738
  "pending",
1726
1739
  "running",
1727
1740
  "completed",
@@ -1730,32 +1743,32 @@ var Rn = ({ open: e, title: t, fieldSchemas: r, rows: i, taskId: a, includedKeys
1730
1743
  ].map((e) => ({
1731
1744
  value: e,
1732
1745
  label: Nn[e].label
1733
- })), []), B = I?.status === "running", ge = B ? "" : A, V = !B && ie !== "all" && me.some((e) => e.value === ie) ? ie : "all", H = !B && E !== "all" && he.some((e) => e.value === E) ? E : "all", _e = V !== "all" || ge.trim() !== "", ve = H !== "all", ye = _e || ve, U = y(() => {
1734
- if (!_e) return i;
1735
- let e = ge.trim().toLowerCase();
1736
- return i.filter((t) => V !== "all" && Pn(t) !== V ? !1 : !e || Object.values(t.values).some((t) => (Array.isArray(t) ? t.join(" ") : String(t ?? "")).toLowerCase().includes(e)));
1746
+ })), []), V = R?.status === "running", ve = V ? "" : se, H = !V && ae !== "all" && ge.some((e) => e.value === ae) ? ae : "all", U = !V && T !== "all" && _e.some((e) => e.value === T) ? T : "all", ye = H !== "all" || ve.trim() !== "", W = U !== "all", be = ye || W, G = y(() => {
1747
+ if (!ye) return i;
1748
+ let e = ve.trim().toLowerCase();
1749
+ return i.filter((t) => H !== "all" && Pn(t) !== H ? !1 : !e || Object.values(t.values).some((t) => (Array.isArray(t) ? t.join(" ") : String(t ?? "")).toLowerCase().includes(e)));
1737
1750
  }, [
1738
1751
  i,
1739
- V,
1740
- ge,
1741
- _e
1742
- ]), be = Ln(I, 300), xe = ve ? be : void 0, Se = y(() => ve ? U.filter((e) => Fn(e, a, xe) === H) : a && I ? U.slice() : U, [
1743
- U,
1744
1752
  H,
1745
1753
  ve,
1746
- xe,
1747
- I,
1754
+ ye
1755
+ ]), xe = Ln(R, 300), Se = W ? xe : void 0, Ce = y(() => W ? G.filter((e) => Fn(e, a, Se) === U) : a && R ? G.slice() : G, [
1756
+ G,
1757
+ U,
1758
+ W,
1759
+ Se,
1760
+ R,
1748
1761
  a
1749
- ]), Ce = (e) => {
1762
+ ]), we = (e) => {
1750
1763
  let t = Object.entries(e.errors);
1751
- return /* @__PURE__ */ w(c, {
1764
+ return /* @__PURE__ */ C(c, {
1752
1765
  vertical: !0,
1753
1766
  gap: 4,
1754
1767
  style: { maxWidth: 320 },
1755
1768
  children: t.map(([e, t]) => {
1756
1769
  let n = r.find((t) => t.key === e)?.title ?? e;
1757
- return /* @__PURE__ */ T(_.Text, { children: [
1758
- /* @__PURE__ */ w(_.Text, {
1770
+ return /* @__PURE__ */ w(_.Text, { children: [
1771
+ /* @__PURE__ */ C(_.Text, {
1759
1772
  strong: !0,
1760
1773
  children: n
1761
1774
  }),
@@ -1764,27 +1777,27 @@ var Rn = ({ open: e, title: t, fieldSchemas: r, rows: i, taskId: a, includedKeys
1764
1777
  ] }, e);
1765
1778
  })
1766
1779
  });
1767
- }, we = (e) => {
1780
+ }, Te = (e) => {
1768
1781
  let t = Pn(e), n = Mn[t];
1769
- return t === "invalid" ? /* @__PURE__ */ w(f, {
1782
+ return t === "invalid" ? /* @__PURE__ */ C(f, {
1770
1783
  trigger: "hover",
1771
1784
  placement: "topRight",
1772
1785
  title: "错误信息",
1773
- content: Ce(e),
1774
- children: /* @__PURE__ */ w(g, {
1786
+ content: we(e),
1787
+ children: /* @__PURE__ */ C(g, {
1775
1788
  color: n.color,
1776
1789
  children: n.label
1777
1790
  })
1778
- }) : /* @__PURE__ */ w(g, {
1791
+ }) : /* @__PURE__ */ C(g, {
1779
1792
  color: n.color,
1780
1793
  children: n.label
1781
1794
  });
1782
- }, Te = (e) => {
1783
- let t = z(e), n = t?.fieldErrors ?? [], i = t?.message ? t.message.split("\n").filter(Boolean) : [];
1784
- if (n.length === 0) return i.length === 0 ? /* @__PURE__ */ w(_.Text, { children: "导入失败" }) : /* @__PURE__ */ w(c, {
1795
+ }, Ee = (e) => {
1796
+ let t = B(e), n = t?.fieldErrors ?? [], i = t?.message ? t.message.split("\n").filter(Boolean) : [];
1797
+ if (n.length === 0) return i.length === 0 ? /* @__PURE__ */ C(_.Text, { children: "导入失败" }) : /* @__PURE__ */ C(c, {
1785
1798
  vertical: !0,
1786
1799
  gap: 2,
1787
- children: i.map((e, t) => /* @__PURE__ */ w(_.Text, { children: e }, t))
1800
+ children: i.map((e, t) => /* @__PURE__ */ C(_.Text, { children: e }, t))
1788
1801
  });
1789
1802
  let a = /* @__PURE__ */ new Map();
1790
1803
  n.forEach((e) => {
@@ -1792,25 +1805,25 @@ var Rn = ({ open: e, title: t, fieldSchemas: r, rows: i, taskId: a, includedKeys
1792
1805
  o.push(n), a.set(i, o);
1793
1806
  });
1794
1807
  let o = [...a.entries()], s = o.slice(0, 3), l = o.length - s.length;
1795
- return /* @__PURE__ */ T(c, {
1808
+ return /* @__PURE__ */ w(c, {
1796
1809
  vertical: !0,
1797
1810
  gap: 8,
1798
1811
  style: { maxWidth: 360 },
1799
1812
  children: [
1800
- i.length > 0 ? /* @__PURE__ */ w(c, {
1813
+ i.length > 0 ? /* @__PURE__ */ C(c, {
1801
1814
  vertical: !0,
1802
1815
  gap: 2,
1803
- children: i.map((e, t) => /* @__PURE__ */ w(_.Text, { children: e }, t))
1816
+ children: i.map((e, t) => /* @__PURE__ */ C(_.Text, { children: e }, t))
1804
1817
  }) : null,
1805
- s.map(([e, t]) => /* @__PURE__ */ T(c, {
1818
+ s.map(([e, t]) => /* @__PURE__ */ w(c, {
1806
1819
  vertical: !0,
1807
1820
  gap: 2,
1808
- children: [/* @__PURE__ */ w(_.Text, {
1821
+ children: [/* @__PURE__ */ C(_.Text, {
1809
1822
  strong: !0,
1810
1823
  children: e
1811
- }), t.map((e, t) => /* @__PURE__ */ T(_.Text, { children: ["• ", e] }, t))]
1824
+ }), t.map((e, t) => /* @__PURE__ */ w(_.Text, { children: ["• ", e] }, t))]
1812
1825
  }, e)),
1813
- l > 0 ? /* @__PURE__ */ T(_.Text, {
1826
+ l > 0 ? /* @__PURE__ */ w(_.Text, {
1814
1827
  type: "secondary",
1815
1828
  children: [
1816
1829
  "还有 ",
@@ -1820,36 +1833,36 @@ var Rn = ({ open: e, title: t, fieldSchemas: r, rows: i, taskId: a, includedKeys
1820
1833
  }) : null
1821
1834
  ]
1822
1835
  });
1823
- }, Ee = (e) => {
1824
- let t = Fn(e, a, I), n = Nn[t];
1836
+ }, De = (e) => {
1837
+ let t = Fn(e, a, R), n = Nn[t];
1825
1838
  if (t === "failed") {
1826
- let t = z(e), r = t?.message ? t.message.split("\n").length : 0, i = (t?.fieldErrors?.length ?? 0) + r, a = i > 0 ? `导入失败(${i})` : n.label;
1827
- return /* @__PURE__ */ w(f, {
1839
+ let t = B(e), r = t?.message ? t.message.split("\n").length : 0, i = (t?.fieldErrors?.length ?? 0) + r, a = i > 0 ? `导入失败(${i})` : n.label;
1840
+ return /* @__PURE__ */ C(f, {
1828
1841
  trigger: "hover",
1829
1842
  placement: "topRight",
1830
1843
  title: "错误信息",
1831
- content: Te(e),
1832
- children: /* @__PURE__ */ w(g, {
1844
+ content: Ee(e),
1845
+ children: /* @__PURE__ */ C(g, {
1833
1846
  color: n.color,
1834
1847
  children: a
1835
1848
  })
1836
1849
  });
1837
1850
  }
1838
- return /* @__PURE__ */ w(g, {
1851
+ return /* @__PURE__ */ C(g, {
1839
1852
  color: n.color,
1840
1853
  children: n.label
1841
1854
  });
1842
- }, De = (e) => /* @__PURE__ */ w(s, {
1855
+ }, Oe = (e) => /* @__PURE__ */ C(s, {
1843
1856
  type: "primary",
1844
1857
  danger: !0,
1845
1858
  size: "small",
1846
- disabled: !pe(e),
1847
- icon: /* @__PURE__ */ w(n, {}),
1859
+ disabled: !he(e),
1860
+ icon: /* @__PURE__ */ C(n, {}),
1848
1861
  onClick: () => {
1849
1862
  ne(e), M && e.taskIndex !== void 0 && $t(M.id, [e.taskIndex]);
1850
1863
  },
1851
1864
  children: "删除"
1852
- }), Oe = [
1865
+ }), ke = [
1853
1866
  {
1854
1867
  key: "rowNumber",
1855
1868
  title: "行号",
@@ -1857,15 +1870,15 @@ var Rn = ({ open: e, title: t, fieldSchemas: r, rows: i, taskId: a, includedKeys
1857
1870
  width: 60,
1858
1871
  fixed: "left"
1859
1872
  },
1860
- ...ce.map((e) => ({
1873
+ ...I.map((e) => ({
1861
1874
  key: e.key,
1862
1875
  title: e.title,
1863
1876
  dataIndex: e.key,
1864
1877
  width: 160,
1865
- render: (t, n) => /* @__PURE__ */ w(On, {
1878
+ render: (t, n) => /* @__PURE__ */ C(On, {
1866
1879
  field: e,
1867
1880
  record: n,
1868
- disabled: !fe(n),
1881
+ disabled: !me(n),
1869
1882
  onChange: (t) => ee(n, e, t),
1870
1883
  onSave: (t) => te(n, e, t)
1871
1884
  })
@@ -1875,24 +1888,28 @@ var Rn = ({ open: e, title: t, fieldSchemas: r, rows: i, taskId: a, includedKeys
1875
1888
  title: "数据状态",
1876
1889
  width: 100,
1877
1890
  fixed: "right",
1878
- render: (e, t) => we(t)
1891
+ render: (e, t) => Te(t)
1879
1892
  },
1880
1893
  {
1881
1894
  key: "importStatus",
1882
1895
  title: "导入状态",
1883
1896
  width: 110,
1884
1897
  fixed: "right",
1885
- render: (e, t) => Ee(t)
1898
+ render: (e, t) => De(t)
1886
1899
  },
1887
1900
  {
1888
1901
  key: "action",
1889
1902
  title: "操作",
1890
1903
  width: 80,
1891
1904
  fixed: "right",
1892
- render: (e, t) => De(t)
1905
+ render: (e, t) => Oe(t)
1893
1906
  }
1894
- ], ke = Math.max(1200, 60 + ce.length * 160 + 100 + 110 + 80), Ae = I && I.total > 0 ? pt(I) : 0, je = I?.failureCount ?? I?.failures?.length ?? 0, Me = y(() => i.reduce((e, t) => e + +(Object.keys(t.errors).length > 0), 0), [i]), W = I?.validationFailedCount ?? Me, Ne = i.length > 0 && Me === i.length;
1895
- return /* @__PURE__ */ w(C, { children: /* @__PURE__ */ T(d, {
1907
+ ], Ae = Math.max(1200, 60 + I.length * 160 + 100 + 110 + 80), je = R && R.total > 0 ? dt(R) : 0, Me = R?.failureCount ?? R?.failures?.length ?? 0, K = y(() => i.reduce((e, t) => e + +(Object.keys(t.errors).length > 0), 0), [i]), Ne = R?.validationFailedCount ?? K, Pe = i.length > 0 && K === i.length, Fe = (e) => {
1908
+ A(!0), j.current !== null && clearTimeout(j.current), j.current = setTimeout(() => {
1909
+ j.current = null, A(!1);
1910
+ }, Rn), Xt(e);
1911
+ };
1912
+ return /* @__PURE__ */ C(ie, { children: /* @__PURE__ */ w(d, {
1896
1913
  title: a ? `${t}导入` : `${t}导入预览`,
1897
1914
  open: e,
1898
1915
  width: "min(1400px, 96vw)",
@@ -1900,68 +1917,82 @@ var Rn = ({ open: e, title: t, fieldSchemas: r, rows: i, taskId: a, includedKeys
1900
1917
  closable: !1,
1901
1918
  keyboard: !1,
1902
1919
  onCancel: () => {
1903
- R || S();
1920
+ ue || S();
1904
1921
  },
1905
1922
  footer: (() => {
1906
- if (!a) return /* @__PURE__ */ T(c, {
1923
+ if (!a) return /* @__PURE__ */ w(c, {
1907
1924
  justify: "space-between",
1908
1925
  align: "center",
1909
1926
  gap: 8,
1910
1927
  wrap: !0,
1911
- children: [/* @__PURE__ */ w("span", { children: i.length > 0 && Me > 0 ? /* @__PURE__ */ w(_.Text, {
1912
- type: Ne ? "danger" : "secondary",
1913
- children: Ne ? "全部行校验失败, 请先修正后再导入" : `有 ${Me} 行校验失败, 不会导入`
1914
- }) : null }), /* @__PURE__ */ T(c, {
1928
+ children: [/* @__PURE__ */ C("span", { children: i.length > 0 && K > 0 ? /* @__PURE__ */ C(_.Text, {
1929
+ type: Pe ? "danger" : "secondary",
1930
+ children: Pe ? "全部行校验失败, 请先修正后再导入" : `有 ${K} 行校验失败, 不会导入`
1931
+ }) : null }), /* @__PURE__ */ w(c, {
1915
1932
  gap: 8,
1916
- children: [/* @__PURE__ */ w(s, {
1933
+ children: [/* @__PURE__ */ C(s, {
1917
1934
  onClick: S,
1918
1935
  children: "取消"
1919
- }), /* @__PURE__ */ w(s, {
1936
+ }), /* @__PURE__ */ C(s, {
1920
1937
  type: "primary",
1921
- disabled: i.length === 0 || Ne,
1938
+ disabled: i.length === 0 || Pe,
1922
1939
  onClick: () => {
1923
- j(), re();
1940
+ ce(), re();
1924
1941
  },
1925
1942
  children: "开始导入"
1926
1943
  })]
1927
1944
  })]
1928
1945
  });
1929
- if (!M || !I) return /* @__PURE__ */ w(c, {
1946
+ if (!M || !R) return /* @__PURE__ */ C(c, {
1930
1947
  justify: "flex-end",
1931
- children: /* @__PURE__ */ w(s, {
1948
+ children: /* @__PURE__ */ C(s, {
1932
1949
  onClick: S,
1933
1950
  children: "关闭"
1934
1951
  })
1935
1952
  });
1936
- let e = I.status === "running", t = I.status === "paused";
1937
- return /* @__PURE__ */ T(c, {
1953
+ let e = R.status === "running", t = R.status === "paused";
1954
+ return k && (e || t) ? /* @__PURE__ */ w(c, {
1955
+ justify: "flex-end",
1956
+ gap: 8,
1957
+ children: [/* @__PURE__ */ C(s, {
1958
+ danger: !0,
1959
+ loading: R.canceling,
1960
+ disabled: R.canceling,
1961
+ onClick: () => hn(R.id),
1962
+ children: R.canceling ? "取消中" : "取消任务"
1963
+ }), /* @__PURE__ */ C(s, {
1964
+ loading: !0,
1965
+ disabled: !0,
1966
+ children: "暂停中"
1967
+ })]
1968
+ }) : /* @__PURE__ */ w(c, {
1938
1969
  justify: "flex-end",
1939
1970
  gap: 8,
1940
1971
  children: [
1941
- e ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(s, {
1972
+ e ? /* @__PURE__ */ w(ie, { children: [/* @__PURE__ */ C(s, {
1942
1973
  danger: !0,
1943
- loading: I.canceling,
1944
- disabled: I.canceling,
1945
- onClick: () => hn(I.id),
1946
- children: I.canceling ? "取消中" : "取消任务"
1947
- }), /* @__PURE__ */ w(s, {
1948
- loading: I.pausing,
1949
- disabled: I.canceling,
1950
- onClick: () => Xt(I.id),
1951
- children: I.pausing ? "暂停中" : "暂停"
1974
+ loading: R.canceling,
1975
+ disabled: R.canceling,
1976
+ onClick: () => hn(R.id),
1977
+ children: R.canceling ? "取消中" : "取消任务"
1978
+ }), /* @__PURE__ */ C(s, {
1979
+ loading: R.pausing,
1980
+ disabled: R.canceling,
1981
+ onClick: () => Fe(R.id),
1982
+ children: R.pausing ? "暂停中" : "暂停"
1952
1983
  })] }) : null,
1953
- t ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(s, {
1984
+ t ? /* @__PURE__ */ w(ie, { children: [/* @__PURE__ */ C(s, {
1954
1985
  danger: !0,
1955
- onClick: () => hn(I.id),
1986
+ onClick: () => hn(R.id),
1956
1987
  children: "取消任务"
1957
- }), /* @__PURE__ */ w(s, {
1988
+ }), /* @__PURE__ */ C(s, {
1958
1989
  type: "primary",
1959
1990
  onClick: () => {
1960
- j(), Yt(I.id);
1991
+ ce(), Yt(R.id);
1961
1992
  },
1962
1993
  children: "继续导入"
1963
1994
  })] }) : null,
1964
- !e && !t ? /* @__PURE__ */ w(s, {
1995
+ !e && !t ? /* @__PURE__ */ C(s, {
1965
1996
  type: "primary",
1966
1997
  onClick: S,
1967
1998
  children: "关闭"
@@ -1970,164 +2001,164 @@ var Rn = ({ open: e, title: t, fieldSchemas: r, rows: i, taskId: a, includedKeys
1970
2001
  });
1971
2002
  })(),
1972
2003
  children: [
1973
- I && L ? /* @__PURE__ */ T(c, {
2004
+ R && z ? /* @__PURE__ */ w(c, {
1974
2005
  vertical: !0,
1975
2006
  gap: 4,
1976
2007
  style: { marginBottom: 12 },
1977
2008
  children: [
1978
- /* @__PURE__ */ T(c, {
2009
+ /* @__PURE__ */ w(c, {
1979
2010
  justify: "space-between",
1980
2011
  align: "center",
1981
- children: [/* @__PURE__ */ T(_.Text, {
2012
+ children: [/* @__PURE__ */ w(_.Text, {
1982
2013
  type: "secondary",
1983
2014
  children: [
1984
2015
  "已导入 ",
1985
- dt(I).toLocaleString(),
2016
+ lt(R).toLocaleString(),
1986
2017
  " / 总数 ",
1987
- I.total.toLocaleString()
2018
+ R.total.toLocaleString()
1988
2019
  ]
1989
- }), /* @__PURE__ */ T(c, {
2020
+ }), /* @__PURE__ */ w(c, {
1990
2021
  align: "center",
1991
2022
  gap: 8,
1992
2023
  children: [
1993
- ue ? /* @__PURE__ */ w(_.Text, {
2024
+ fe ? /* @__PURE__ */ C(_.Text, {
1994
2025
  type: "secondary",
1995
- children: ue
2026
+ children: fe
1996
2027
  }) : null,
1997
- W > 0 ? /* @__PURE__ */ T(g, {
2028
+ Ne > 0 ? /* @__PURE__ */ w(g, {
1998
2029
  color: "error",
1999
2030
  children: [
2000
2031
  "校验失败 ",
2001
- W,
2032
+ Ne,
2002
2033
  " 条"
2003
2034
  ]
2004
2035
  }) : null,
2005
- je > 0 ? /* @__PURE__ */ T(g, {
2036
+ Me > 0 ? /* @__PURE__ */ w(g, {
2006
2037
  color: "error",
2007
2038
  children: [
2008
2039
  "导入失败 ",
2009
- je,
2040
+ Me,
2010
2041
  " 条"
2011
2042
  ]
2012
2043
  }) : null,
2013
- /* @__PURE__ */ w(g, {
2014
- color: L.color,
2015
- children: L.label
2044
+ /* @__PURE__ */ C(g, {
2045
+ color: z.color,
2046
+ children: z.label
2016
2047
  })
2017
2048
  ]
2018
2049
  })]
2019
2050
  }),
2020
- /* @__PURE__ */ w(p, {
2021
- percent: Ae,
2022
- format: () => mt(Ae),
2023
- status: jn(I),
2051
+ /* @__PURE__ */ C(p, {
2052
+ percent: je,
2053
+ format: () => ft(je),
2054
+ status: jn(R),
2024
2055
  size: "small"
2025
2056
  }),
2026
- M?.errorMessage ? /* @__PURE__ */ w(_.Text, {
2057
+ M?.errorMessage ? /* @__PURE__ */ C(_.Text, {
2027
2058
  type: "danger",
2028
2059
  children: M.errorMessage
2029
2060
  }) : null
2030
2061
  ]
2031
- }) : a ? null : /* @__PURE__ */ T(c, {
2062
+ }) : a ? null : /* @__PURE__ */ w(c, {
2032
2063
  vertical: !0,
2033
2064
  gap: 4,
2034
2065
  style: { marginBottom: 12 },
2035
- children: [/* @__PURE__ */ T(c, {
2066
+ children: [/* @__PURE__ */ w(c, {
2036
2067
  justify: "space-between",
2037
2068
  align: "center",
2038
- children: [/* @__PURE__ */ T(_.Text, {
2069
+ children: [/* @__PURE__ */ w(_.Text, {
2039
2070
  type: "secondary",
2040
2071
  children: ["总数 ", i.length.toLocaleString()]
2041
- }), /* @__PURE__ */ T(c, {
2072
+ }), /* @__PURE__ */ w(c, {
2042
2073
  align: "center",
2043
2074
  gap: 8,
2044
- children: [W > 0 ? /* @__PURE__ */ T(g, {
2075
+ children: [Ne > 0 ? /* @__PURE__ */ w(g, {
2045
2076
  color: "error",
2046
2077
  children: [
2047
2078
  "校验失败 ",
2048
- W,
2079
+ Ne,
2049
2080
  " 条"
2050
2081
  ]
2051
- }) : null, /* @__PURE__ */ w(g, { children: "待导入" })]
2082
+ }) : null, /* @__PURE__ */ C(g, { children: "待导入" })]
2052
2083
  })]
2053
- }), /* @__PURE__ */ w(p, {
2084
+ }), /* @__PURE__ */ C(p, {
2054
2085
  percent: 0,
2055
2086
  format: () => "0.0%",
2056
2087
  size: "small"
2057
2088
  })]
2058
2089
  }),
2059
- /* @__PURE__ */ T(c, {
2090
+ /* @__PURE__ */ w(c, {
2060
2091
  justify: "space-between",
2061
2092
  align: "center",
2062
2093
  gap: 8,
2063
2094
  wrap: !0,
2064
2095
  style: { marginBottom: 8 },
2065
- children: [/* @__PURE__ */ T(c, {
2096
+ children: [/* @__PURE__ */ w(c, {
2066
2097
  align: "center",
2067
2098
  gap: 8,
2068
2099
  wrap: !0,
2069
2100
  children: [
2070
- /* @__PURE__ */ w(l, {
2101
+ /* @__PURE__ */ C(l, {
2071
2102
  allowClear: !0,
2072
- disabled: B,
2103
+ disabled: V,
2073
2104
  placeholder: "搜索所有字段",
2074
- value: B ? "" : O,
2105
+ value: V ? "" : D,
2075
2106
  style: { width: 260 },
2076
2107
  onChange: (e) => {
2077
- k(e.target.value);
2108
+ O(e.target.value);
2078
2109
  }
2079
2110
  }),
2080
- /* @__PURE__ */ w(m, {
2111
+ /* @__PURE__ */ C(m, {
2081
2112
  allowClear: !0,
2082
- disabled: B,
2113
+ disabled: V,
2083
2114
  placeholder: "数据状态",
2084
- value: V === "all" ? void 0 : V,
2085
- options: me,
2115
+ value: H === "all" ? void 0 : H,
2116
+ options: ge,
2086
2117
  style: { width: 140 },
2087
2118
  onChange: (e) => {
2088
- ae(e ?? "all");
2119
+ oe(e ?? "all");
2089
2120
  }
2090
2121
  }),
2091
- /* @__PURE__ */ w(m, {
2122
+ /* @__PURE__ */ C(m, {
2092
2123
  allowClear: !0,
2093
- disabled: B,
2124
+ disabled: V,
2094
2125
  placeholder: "导入状态",
2095
- value: H === "all" ? void 0 : H,
2096
- options: he,
2126
+ value: U === "all" ? void 0 : U,
2127
+ options: _e,
2097
2128
  style: { width: 140 },
2098
2129
  onChange: (e) => {
2099
- D(e ?? "all");
2130
+ E(e ?? "all");
2100
2131
  }
2101
2132
  })
2102
2133
  ]
2103
- }), ye ? /* @__PURE__ */ T(_.Text, {
2134
+ }), be ? /* @__PURE__ */ w(_.Text, {
2104
2135
  type: "secondary",
2105
2136
  children: [
2106
2137
  "筛选出 ",
2107
- Se.length,
2138
+ Ce.length,
2108
2139
  " 条"
2109
2140
  ]
2110
2141
  }) : null]
2111
2142
  }),
2112
- /* @__PURE__ */ w(h, {
2143
+ /* @__PURE__ */ C(h, {
2113
2144
  rowKey: "key",
2114
2145
  size: "middle",
2115
2146
  tableLayout: "fixed",
2116
2147
  virtual: !0,
2117
- columns: Oe,
2118
- dataSource: Se,
2148
+ columns: ke,
2149
+ dataSource: Ce,
2119
2150
  pagination: !1,
2120
2151
  scroll: {
2121
- x: ke,
2152
+ x: Ae,
2122
2153
  y: 520
2123
2154
  },
2124
- locale: { emptyText: ye ? "没有符合条件的行" : void 0 }
2155
+ locale: { emptyText: be ? "没有符合条件的行" : void 0 }
2125
2156
  })
2126
2157
  ]
2127
2158
  }) });
2128
2159
  };
2129
2160
  // src/components/importBatchResult.ts
2130
- function zn(e, t) {
2161
+ function Bn(e, t) {
2131
2162
  if (Object.keys(e).length === 0) return { success: !0 };
2132
2163
  let n = [], r = [];
2133
2164
  return Object.entries(e).forEach(([e, i]) => {
@@ -2142,7 +2173,7 @@ function zn(e, t) {
2142
2173
  };
2143
2174
  }
2144
2175
  // src/components/ImportButton.tsx
2145
- function Bn(e) {
2176
+ function Vn(e) {
2146
2177
  let t = rn(e);
2147
2178
  if (t && typeof t == "object") {
2148
2179
  let e = t;
@@ -2155,116 +2186,116 @@ function Bn(e) {
2155
2186
  }
2156
2187
  return on(e, "导入", "任务已暂停") ?? (e instanceof Error && e.message ? e.message : "导入失败, 任务已暂停");
2157
2188
  }
2158
- var Vn = ({ title: e, fieldSchemas: t, buttonText: n = "导入", batchSize: r = 20, importRows: c, beforeImport: l, afterImport: u, onModalClose: d }) => {
2159
- let [f, p] = x(!1), [m, h] = x([]), [g, _] = Cn(), [ne, re] = x("empty"), [v, S] = x(!1), [ae, E] = x(!1), [D, O] = x([]), { modal: k, message: A } = o.useApp(), j = b(null), M = y(() => ie(t), [t]), oe = y(() => new Set(M.map((e) => e.key)), [M]), N = () => j.current?.click(), P = (e, t) => {
2160
- k.warning({
2189
+ var Hn = ({ title: e, fieldSchemas: t, buttonText: n = "导入", batchSize: r = 20, importRows: c, beforeImport: l, afterImport: u, onModalClose: d }) => {
2190
+ let [f, p] = x(!1), [m, h] = x([]), [g, _] = Cn(), [ne, re] = x("empty"), [v, S] = x(!1), [oe, T] = x(!1), [E, D] = x([]), { modal: O, message: k } = o.useApp(), A = b(null), j = y(() => ae(t), [t]), se = y(() => new Set(j.map((e) => e.key)), [j]), ce = () => A.current?.click(), M = (e, t) => {
2191
+ O.warning({
2161
2192
  title: t ?? (e.missingTitles.length > 0 ? "文件表头不完整" : "文件检查未通过"),
2162
2193
  width: 480,
2163
- content: /* @__PURE__ */ w(En, { ...e }),
2194
+ content: /* @__PURE__ */ C(En, { ...e }),
2164
2195
  okCancel: !0,
2165
2196
  okText: "重新选择文件",
2166
2197
  cancelText: "关闭",
2167
2198
  closable: !0,
2168
- onOk: N
2199
+ onOk: ce
2169
2200
  });
2170
- }, se = async (e) => {
2171
- if (e.size > 20971520) A.error("文件大小超过 20MB, 请拆分后再导入");
2201
+ }, N = async (e) => {
2202
+ if (e.size > 20971520) k.error("文件大小超过 20MB, 请拆分后再导入");
2172
2203
  else {
2173
- _(void 0), O([]), S(!0);
2204
+ _(void 0), D([]), S(!0);
2174
2205
  try {
2175
- let { headerMessages: n, missingColumns: r, formulaMessages: i, unknownColumns: a, rows: o, includedKeys: s } = await at(e, t);
2206
+ let { headerMessages: n, missingColumns: r, formulaMessages: i, unknownColumns: a, rows: o, includedKeys: s } = await rt(e, t);
2176
2207
  if (i.length > 0) {
2177
- P({
2208
+ M({
2178
2209
  missingTitles: [],
2179
2210
  headerMessages: i
2180
2211
  }, "文件里的公式还没有计算结果");
2181
2212
  return;
2182
2213
  }
2183
2214
  if (n.length > 0 || r.length > 0) {
2184
- P({
2215
+ M({
2185
2216
  missingTitles: r,
2186
2217
  headerMessages: n
2187
2218
  });
2188
2219
  return;
2189
2220
  }
2190
2221
  if (a.length > 0) {
2191
- P({
2222
+ M({
2192
2223
  missingTitles: [],
2193
2224
  headerMessages: ["文件包含未识别的列, 请删除或修正这些列后重新导入:", ...a.map(({ column: e, title: t }) => `${e} 列: ${t}`)]
2194
2225
  }, "文件包含未识别的列");
2195
2226
  return;
2196
2227
  }
2197
2228
  if (o.length === 0) {
2198
- A.error("文件里没有数据行");
2229
+ k.error("文件里没有数据行");
2199
2230
  return;
2200
2231
  }
2201
2232
  try {
2202
2233
  await l?.(o) !== void 0 && console.warn("beforeImport 的返回值已被忽略: 不支持通过返回值替换/过滤预览数据, 需要中止请抛错");
2203
2234
  } catch (e) {
2204
- A.error(e instanceof Error ? e.message : "导入已取消");
2235
+ k.error(e instanceof Error ? e.message : "导入已取消");
2205
2236
  return;
2206
2237
  }
2207
- O(s), re(`${e.name}-${Date.now()}`), h(o), p(!0);
2238
+ D(s), re(`${e.name}-${Date.now()}`), h(o), p(!0);
2208
2239
  } catch (e) {
2209
- console.error(`导入文件解析失败: ${e}`), A.error("导入文件解析失败, 请确认上传的是 Excel 文件");
2240
+ console.error(`导入文件解析失败: ${e}`), k.error("导入文件解析失败, 请确认上传的是 Excel 文件");
2210
2241
  } finally {
2211
2242
  S(!1);
2212
2243
  }
2213
2244
  }
2214
2245
  };
2215
- return /* @__PURE__ */ T(C, { children: [
2216
- /* @__PURE__ */ T(ee.Compact, {
2246
+ return /* @__PURE__ */ w(ie, { children: [
2247
+ /* @__PURE__ */ w(ee.Compact, {
2217
2248
  block: !0,
2218
- children: [/* @__PURE__ */ w(te, {
2249
+ children: [/* @__PURE__ */ C(te, {
2219
2250
  title: "Excel 导入",
2220
- children: /* @__PURE__ */ w(s, {
2251
+ children: /* @__PURE__ */ C(s, {
2221
2252
  type: "default",
2222
- icon: /* @__PURE__ */ w(a, {}),
2253
+ icon: /* @__PURE__ */ C(a, {}),
2223
2254
  loading: v,
2224
2255
  disabled: v,
2225
- onClick: N,
2256
+ onClick: ce,
2226
2257
  children: n
2227
2258
  })
2228
- }), /* @__PURE__ */ w(te, {
2259
+ }), /* @__PURE__ */ C(te, {
2229
2260
  title: "Excel 导入模板",
2230
- children: /* @__PURE__ */ w(s, {
2261
+ children: /* @__PURE__ */ C(s, {
2231
2262
  type: "default",
2232
- icon: /* @__PURE__ */ w(i, {}),
2233
- loading: ae,
2263
+ icon: /* @__PURE__ */ C(i, {}),
2264
+ loading: oe,
2234
2265
  onClick: async () => {
2235
- E(!0);
2266
+ T(!0);
2236
2267
  try {
2237
- await it(M, `${e}导入模板`);
2268
+ await nt(j, `${e}导入模板`);
2238
2269
  } catch (e) {
2239
- console.error(`模板下载失败: ${e}`), A.error("模板下载失败");
2270
+ console.error(`模板下载失败: ${e}`), k.error("模板下载失败");
2240
2271
  } finally {
2241
- E(!1);
2272
+ T(!1);
2242
2273
  }
2243
2274
  },
2244
2275
  children: "下载模板"
2245
2276
  })
2246
2277
  })]
2247
2278
  }),
2248
- /* @__PURE__ */ w("input", {
2249
- ref: j,
2279
+ /* @__PURE__ */ C("input", {
2280
+ ref: A,
2250
2281
  type: "file",
2251
2282
  accept: ".xlsx",
2252
2283
  style: { display: "none" },
2253
2284
  onChange: (e) => {
2254
2285
  let t = e.target.files?.[0];
2255
- e.target.value = "", t && se(t);
2286
+ e.target.value = "", t && N(t);
2256
2287
  }
2257
2288
  }),
2258
- /* @__PURE__ */ w(Rn, {
2289
+ /* @__PURE__ */ C(zn, {
2259
2290
  open: f,
2260
2291
  title: e,
2261
- fieldSchemas: M,
2292
+ fieldSchemas: j,
2262
2293
  rows: m,
2263
2294
  taskId: g,
2264
- includedKeys: D,
2295
+ includedKeys: E,
2265
2296
  onChangeCell: (e, t, n) => {
2266
- if (!D.includes(t.key)) return;
2267
- let r = Ne(t, n), i = ke(r.trim() === "" ? null : r, t);
2297
+ if (!E.includes(t.key)) return;
2298
+ let r = Me(t, n), i = De(r.trim() === "" ? null : r, t);
2268
2299
  h((r) => r.map((r) => {
2269
2300
  if (r.key !== e.key) return r;
2270
2301
  let a = { ...r.errors };
@@ -2279,11 +2310,11 @@ var Vn = ({ title: e, fieldSchemas: t, buttonText: n = "导入", batchSize: r =
2279
2310
  }));
2280
2311
  },
2281
2312
  onSaveCell: (e, t, n) => {
2282
- if (!D.includes(t.key)) return;
2283
- let r = Pe({
2313
+ if (!E.includes(t.key)) return;
2314
+ let r = K({
2284
2315
  ...e.values,
2285
2316
  [t.key]: n
2286
- }, M, D, "editor"), i = {
2317
+ }, j, E, "editor"), i = {
2287
2318
  ...e,
2288
2319
  values: {
2289
2320
  ...e.values,
@@ -2299,11 +2330,11 @@ var Vn = ({ title: e, fieldSchemas: t, buttonText: n = "导入", batchSize: r =
2299
2330
  onConfirm: async () => {
2300
2331
  let t = m;
2301
2332
  if (t.length === 0) {
2302
- A.error("没有可导入的数据");
2333
+ k.error("没有可导入的数据");
2303
2334
  return;
2304
2335
  }
2305
2336
  if (t.every((e) => Object.keys(e.errors).length > 0)) {
2306
- A.error("所有行都有校验错误, 请先修正后再导入");
2337
+ k.error("所有行都有校验错误, 请先修正后再导入");
2307
2338
  return;
2308
2339
  }
2309
2340
  let n = t.map((e, t) => ({
@@ -2314,16 +2345,16 @@ var Vn = ({ title: e, fieldSchemas: t, buttonText: n = "导入", batchSize: r =
2314
2345
  let i = Jt({
2315
2346
  title: `${e}导入`,
2316
2347
  rows: n,
2317
- fieldSchemas: M,
2318
- includedKeys: D,
2348
+ fieldSchemas: j,
2349
+ includedKeys: E,
2319
2350
  batchSize: r,
2320
2351
  importRows: async (e) => {
2321
2352
  try {
2322
- let t = await c(e.map((e) => Fe(e, M, D)));
2323
- if (t.length !== e.length) throw new Z("导入接口返回结果数量不正确, 任务已暂停");
2324
- return t.map((e) => zn(e, oe));
2353
+ let t = await c(e.map((e) => Ne(e, j, E)));
2354
+ if (t.length !== e.length) throw new wt("导入接口返回结果数量不正确, 任务已暂停");
2355
+ return t.map((e) => Bn(e, se));
2325
2356
  } catch (e) {
2326
- throw e instanceof Z ? e : new Z(Bn(e));
2357
+ throw e instanceof wt ? e : new wt(Vn(e));
2327
2358
  }
2328
2359
  },
2329
2360
  onFinished: u
@@ -2331,9 +2362,9 @@ var Vn = ({ title: e, fieldSchemas: t, buttonText: n = "导入", batchSize: r =
2331
2362
  _(i);
2332
2363
  },
2333
2364
  onClose: () => {
2334
- g && gn(g), p(!1), _(void 0), h([]), O([]), d?.();
2365
+ g && gn(g), p(!1), _(void 0), h([]), D([]), d?.();
2335
2366
  }
2336
2367
  }, ne)
2337
2368
  ] });
2338
2369
  };
2339
- export { wn as ExportButton, Vn as ImportButton, Ae as MAX_IMPORT_FILE_SIZE, ae as MULTI_VALUE_SEPARATOR, ct as exportRowsToFile, ie as importableFields, D as joinMultiValues, _n as resetTasks, O as splitMultiValues, be as validateBooleanField, xe as validateDateField, Ce as validateDateTimeField, ke as validateField, we as validateListField, Ee as validateMultipleChoiceField, U as validateNumberField, Te as validateSingleChoiceField, ye as validateTextField, Se as validateTimeField };
2370
+ export { wn as ExportButton, Hn as ImportButton, Oe as MAX_IMPORT_FILE_SIZE, oe as MULTI_VALUE_SEPARATOR, ot as exportRowsToFile, ae as importableFields, E as joinMultiValues, _n as resetTasks, D as splitMultiValues, W as validateBooleanField, be as validateDateField, xe as validateDateTimeField, De as validateField, Se as validateListField, we as validateMultipleChoiceField, ye as validateNumberField, Ce as validateSingleChoiceField, U as validateTextField, G as validateTimeField };