antd-import-export 1.0.3 → 1.0.5
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/README.md +55 -14
- package/README_EN.md +71 -6
- package/dist/components/{ExcelExportButton.d.ts → ExportButton.d.ts} +3 -3
- package/dist/components/{ExcelImportButton.d.ts → ImportButton.d.ts} +3 -3
- package/dist/core/excel/exportFile.d.ts +16 -0
- package/dist/core/excel/runtime.d.ts +2 -0
- package/dist/core/httpError.d.ts +16 -1
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +522 -503
- package/package.json +1 -1
- package/dist/components/BatchExportButton.d.ts +0 -10
package/dist/index.mjs
CHANGED
|
@@ -4,33 +4,33 @@ import { saveAs as n } from "file-saver";
|
|
|
4
4
|
import r from "exceljs";
|
|
5
5
|
import { useCallback as i, useEffect as a, useMemo as o, useRef as s, useState as c, useSyncExternalStore as l } from "react";
|
|
6
6
|
import { DeleteOutlined as u, DownloadOutlined as d, FileOutlined as f, UploadOutlined as p } from "@ant-design/icons";
|
|
7
|
-
import { App as m, Button as h, Flex as g, Input as _, InputNumber as v, Modal as y, Popover as b, Progress as x, Select as S, Space as C, Table as ee, Tag as w, Tooltip as
|
|
8
|
-
import { Fragment as
|
|
7
|
+
import { App as m, Button as h, Flex as g, Input as _, InputNumber as v, Modal as y, Popover as b, Progress as x, Select as S, Space as C, Table as ee, Tag as w, Tooltip as T, Typography as E, theme as te } from "antd";
|
|
8
|
+
import { Fragment as ne, jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
9
9
|
// \0rolldown/runtime.js
|
|
10
|
-
var
|
|
11
|
-
if (t && typeof t == "object" || typeof t == "function") for (var i = M(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !
|
|
10
|
+
var k = Object.create, A = Object.defineProperty, j = Object.getOwnPropertyDescriptor, M = Object.getOwnPropertyNames, N = Object.getPrototypeOf, P = Object.prototype.hasOwnProperty, re = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), ie = (e, t, n, r) => {
|
|
11
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i = M(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !P.call(e, s) && s !== n && A(e, s, {
|
|
12
12
|
get: ((e) => t[e]).bind(null, s),
|
|
13
13
|
enumerable: !(r = j(t, s)) || r.enumerable
|
|
14
14
|
});
|
|
15
15
|
return e;
|
|
16
|
-
},
|
|
16
|
+
}, ae = (e, t, n) => (n = e == null ? {} : k(N(e)), ie(t || !e || !e.__esModule || !P.call(e, "default") ? A(n, "default", {
|
|
17
17
|
value: e,
|
|
18
18
|
enumerable: !0
|
|
19
19
|
}) : n, e));
|
|
20
20
|
// src/core/schema/index.ts
|
|
21
|
-
function
|
|
21
|
+
function oe(e) {
|
|
22
22
|
return e.filter((e) => e.importable !== !1);
|
|
23
23
|
}
|
|
24
24
|
// src/core/schema/multiValue.ts
|
|
25
|
-
var
|
|
26
|
-
function
|
|
25
|
+
var F = ";", se = /[;;]/;
|
|
26
|
+
function I(e) {
|
|
27
27
|
return e.map((e) => String(e)).join(";");
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
return e.split(
|
|
29
|
+
function L(e) {
|
|
30
|
+
return e.split(se).map((e) => e.trim()).filter(Boolean);
|
|
31
31
|
}
|
|
32
32
|
// src/core/schema/validate.ts
|
|
33
|
-
var
|
|
33
|
+
var ce = /* @__PURE__ */ ae((/* @__PURE__ */ re(((e, t, n) => {
|
|
34
34
|
(function(n, r) {
|
|
35
35
|
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs_plugin_customParseFormat = r();
|
|
36
36
|
})(n, (function() {
|
|
@@ -187,8 +187,8 @@ var de = /* @__PURE__ */ se((/* @__PURE__ */ oe(((e, t, n) => {
|
|
|
187
187
|
};
|
|
188
188
|
}));
|
|
189
189
|
})))(), 1);
|
|
190
|
-
e.extend(
|
|
191
|
-
function
|
|
190
|
+
e.extend(ce.default);
|
|
191
|
+
function R(e, t) {
|
|
192
192
|
return e.length > t.property.max_length ? {
|
|
193
193
|
validateSuccess: !1,
|
|
194
194
|
validateMessage: `长度不能超过 ${t.property.max_length}`
|
|
@@ -197,7 +197,7 @@ function fe(e, t) {
|
|
|
197
197
|
validateValue: e
|
|
198
198
|
};
|
|
199
199
|
}
|
|
200
|
-
function
|
|
200
|
+
function le(e, n) {
|
|
201
201
|
let r = Number(e);
|
|
202
202
|
if (!Number.isFinite(r)) return {
|
|
203
203
|
validateSuccess: !1,
|
|
@@ -235,7 +235,7 @@ function pe(e, n) {
|
|
|
235
235
|
validateValue: r
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function ue(e, t) {
|
|
239
239
|
return e === t.property.true_label ? {
|
|
240
240
|
validateSuccess: !0,
|
|
241
241
|
validateValue: !0
|
|
@@ -247,7 +247,7 @@ function me(e, t) {
|
|
|
247
247
|
validateMessage: `内容必须是 ${t.property.true_label}|${t.property.false_label}`
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
function de(t) {
|
|
251
251
|
let n = e(t, "YYYY-MM-DD", !0);
|
|
252
252
|
return n.isValid() ? {
|
|
253
253
|
validateSuccess: !0,
|
|
@@ -257,7 +257,7 @@ function I(t) {
|
|
|
257
257
|
validateMessage: "不是有效的日期格式 YYYY-MM-DD"
|
|
258
258
|
};
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function fe(e) {
|
|
261
261
|
let t = /^([01]?[0-9]|2[0-3]):([0-5][0-9])$/.exec(e);
|
|
262
262
|
return t ? {
|
|
263
263
|
validateSuccess: !0,
|
|
@@ -267,7 +267,7 @@ function L(e) {
|
|
|
267
267
|
validateMessage: "不是有效的日期格式 HH:mm"
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function pe(t) {
|
|
271
271
|
let n = e(t, "YYYY-MM-DD HH:mm", !0);
|
|
272
272
|
return n.isValid() ? {
|
|
273
273
|
validateSuccess: !0,
|
|
@@ -278,7 +278,7 @@ function R(t) {
|
|
|
278
278
|
};
|
|
279
279
|
}
|
|
280
280
|
function z(e, t) {
|
|
281
|
-
let n =
|
|
281
|
+
let n = L(e);
|
|
282
282
|
if (n.length > t.property.list_max_length) return {
|
|
283
283
|
validateSuccess: !1,
|
|
284
284
|
validateMessage: `列表长度不能超过 ${t.property.list_max_length}`
|
|
@@ -292,7 +292,7 @@ function z(e, t) {
|
|
|
292
292
|
validateValue: n
|
|
293
293
|
};
|
|
294
294
|
}
|
|
295
|
-
function
|
|
295
|
+
function me(e, t) {
|
|
296
296
|
return e in t.property.option_map ? {
|
|
297
297
|
validateSuccess: !0,
|
|
298
298
|
validateValue: t.property.option_map[e]
|
|
@@ -301,8 +301,8 @@ function B(e, t) {
|
|
|
301
301
|
validateMessage: `内容必须是 ${Object.keys(t.property.option_map).join("|")}`
|
|
302
302
|
};
|
|
303
303
|
}
|
|
304
|
-
function
|
|
305
|
-
let n =
|
|
304
|
+
function B(e, t) {
|
|
305
|
+
let n = L(e), r = t.property.option_map, i = [];
|
|
306
306
|
for (let e of n) {
|
|
307
307
|
if (!(e in r)) return {
|
|
308
308
|
validateSuccess: !1,
|
|
@@ -315,7 +315,7 @@ function V(e, t) {
|
|
|
315
315
|
validateValue: i
|
|
316
316
|
};
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function V(e, t) {
|
|
319
319
|
if (e === null) return t.property.required ? {
|
|
320
320
|
validateSuccess: !1,
|
|
321
321
|
validateMessage: "不能为空"
|
|
@@ -323,85 +323,85 @@ function H(e, t) {
|
|
|
323
323
|
validateSuccess: !0,
|
|
324
324
|
validateValue: t.property.default_value
|
|
325
325
|
};
|
|
326
|
-
if (t.type === "text") return
|
|
327
|
-
if (t.type === "number") return
|
|
328
|
-
if (t.type === "boolean") return
|
|
329
|
-
if (t.type === "date") return
|
|
330
|
-
if (t.type === "time") return
|
|
331
|
-
if (t.type === "datetime") return
|
|
326
|
+
if (t.type === "text") return R(e, t);
|
|
327
|
+
if (t.type === "number") return le(e, t);
|
|
328
|
+
if (t.type === "boolean") return ue(e, t);
|
|
329
|
+
if (t.type === "date") return de(e);
|
|
330
|
+
if (t.type === "time") return fe(e);
|
|
331
|
+
if (t.type === "datetime") return pe(e);
|
|
332
332
|
if (t.type === "list") return z(e, t);
|
|
333
|
-
if (t.type === "single_choice") return
|
|
334
|
-
if (t.type === "multiple_choice") return
|
|
333
|
+
if (t.type === "single_choice") return me(e, t);
|
|
334
|
+
if (t.type === "multiple_choice") return B(e, t);
|
|
335
335
|
throw Error("未知的字段类型");
|
|
336
336
|
}
|
|
337
337
|
// src/core/limits.ts
|
|
338
|
-
var
|
|
338
|
+
var he = 2e4, H = 2e4, ge = 20971520;
|
|
339
339
|
// src/core/excel/importEditor.ts
|
|
340
|
-
function
|
|
340
|
+
function U(e, t) {
|
|
341
341
|
if (t != null) {
|
|
342
342
|
if (e.type !== "single_choice" && e.type !== "multiple_choice") return String(t);
|
|
343
343
|
for (let [n, r] of Object.entries(e.property.option_map)) if (r === t) return n;
|
|
344
344
|
return String(t);
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
+
function _e(e, t) {
|
|
348
|
+
return e.type === "boolean" ? t === !0 ? e.property.true_label : t === !1 ? e.property.false_label : void 0 : e.type === "single_choice" ? U(e, t) : e.type === "multiple_choice" ? Array.isArray(t) ? t.map((t) => U(e, t)).filter(Boolean) : [] : e.type === "list" ? Array.isArray(t) ? I(t) : "" : e.type === "number" ? typeof t == "number" ? t : void 0 : t == null ? "" : String(t);
|
|
349
|
+
}
|
|
347
350
|
function ve(e, t) {
|
|
348
|
-
return
|
|
351
|
+
return t === null ? e.type === "multiple_choice" ? [] : "" : e.type === "multiple_choice" ? L(t) : t;
|
|
349
352
|
}
|
|
350
353
|
function ye(e, t) {
|
|
351
|
-
return t
|
|
352
|
-
}
|
|
353
|
-
function be(e, t) {
|
|
354
|
-
return t == null ? "" : e.type === "boolean" || e.type === "single_choice" ? String(t) : (e.type === "multiple_choice" || e.type === "list") && Array.isArray(t) ? P(t) : String(t);
|
|
354
|
+
return t == null ? "" : e.type === "boolean" || e.type === "single_choice" ? String(t) : (e.type === "multiple_choice" || e.type === "list") && Array.isArray(t) ? I(t) : String(t);
|
|
355
355
|
}
|
|
356
356
|
// src/core/excel/importRow.ts
|
|
357
|
-
function
|
|
357
|
+
function be(e, t, n) {
|
|
358
358
|
let r = {};
|
|
359
359
|
return t.forEach((t) => {
|
|
360
360
|
if (!n.includes(t.key)) return;
|
|
361
|
-
let i =
|
|
361
|
+
let i = ye(t, e.values[t.key]), a = V(i.trim() === "" ? null : i, t);
|
|
362
362
|
if (!a.validateSuccess) throw Error(a.validateMessage);
|
|
363
363
|
r[t.key] = a.validateValue ?? null;
|
|
364
364
|
}), r;
|
|
365
365
|
}
|
|
366
366
|
// src/core/excel/parseSheet.ts
|
|
367
|
-
function
|
|
367
|
+
function xe(e) {
|
|
368
368
|
return !Number.isFinite(e) || e < 1 || e >= 2958466 ? null : new Date(Math.round((e - 25569) * 24 * 3600 * 1e3));
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function Se(e, t = !1) {
|
|
371
371
|
let n = String(e.getUTCMonth() + 1).padStart(2, "0"), r = String(e.getUTCDate()).padStart(2, "0"), i = `${e.getUTCFullYear()}-${n}-${r}`;
|
|
372
372
|
return t ? `${i} ${String(e.getUTCHours()).padStart(2, "0")}:${String(e.getUTCMinutes()).padStart(2, "0")}` : i;
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function Ce(e, t) {
|
|
375
375
|
let n = (e) => e.trim() === "" ? null : e.trim(), i = t === "datetime", a = t === "date" || i;
|
|
376
376
|
if (e.type === r.ValueType.Null) return null;
|
|
377
|
-
if (e.type === r.ValueType.Date) return
|
|
377
|
+
if (e.type === r.ValueType.Date) return Se(e.value, i);
|
|
378
378
|
if (e.type === r.ValueType.Formula) {
|
|
379
379
|
if (e.result === null || e.result === void 0) return null;
|
|
380
|
-
if (e.result instanceof Date) return
|
|
380
|
+
if (e.result instanceof Date) return Se(e.result, i);
|
|
381
381
|
if (a && typeof e.result == "number") {
|
|
382
|
-
let t =
|
|
383
|
-
if (t) return
|
|
382
|
+
let t = xe(e.result);
|
|
383
|
+
if (t) return Se(t, i);
|
|
384
384
|
}
|
|
385
385
|
return n(String(e.result));
|
|
386
386
|
}
|
|
387
387
|
if (e.type === r.ValueType.Number) {
|
|
388
388
|
if (a && typeof e.value == "number") {
|
|
389
|
-
let t =
|
|
390
|
-
if (t) return
|
|
389
|
+
let t = xe(e.value);
|
|
390
|
+
if (t) return Se(t, i);
|
|
391
391
|
}
|
|
392
392
|
return n(String(e.value));
|
|
393
393
|
}
|
|
394
394
|
return n(e.text);
|
|
395
395
|
}
|
|
396
|
-
function
|
|
396
|
+
function we(e) {
|
|
397
397
|
let t = e.property.default_value;
|
|
398
398
|
if (t == null) return null;
|
|
399
399
|
if (e.type === "boolean") return t ? e.property.true_label : e.property.false_label;
|
|
400
|
-
if (Array.isArray(t)) return t.length > 0 ?
|
|
400
|
+
if (Array.isArray(t)) return t.length > 0 ? I(t) : null;
|
|
401
401
|
let n = String(t);
|
|
402
402
|
return n.trim() === "" ? null : n;
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function Te(e, t) {
|
|
405
405
|
let n = new Map(t.map((e) => [e.title, e])), r = [];
|
|
406
406
|
for (let t = 1; t <= e.columnCount; t++) {
|
|
407
407
|
let i = e.getRow(1).getCell(t).text.split("\n")[0].trim();
|
|
@@ -409,8 +409,8 @@ function Ee(e, t) {
|
|
|
409
409
|
}
|
|
410
410
|
return r;
|
|
411
411
|
}
|
|
412
|
-
function
|
|
413
|
-
let n = [], i = [], a = [], o = 0, s = !1, c =
|
|
412
|
+
function Ee(e, t) {
|
|
413
|
+
let n = [], i = [], a = [], o = 0, s = !1, c = Te(e, t), l = c.filter((e) => e !== null).map((e) => e.key), u = new Set(l);
|
|
414
414
|
if (t.forEach((e) => {
|
|
415
415
|
e.property.required && !u.has(e.key) && n.push(`缺少列: ${e.title}`);
|
|
416
416
|
}), n.length > 0) return {
|
|
@@ -424,14 +424,14 @@ function De(e, t) {
|
|
|
424
424
|
if (l === 1) return;
|
|
425
425
|
let f = {};
|
|
426
426
|
if (c.forEach((t, n) => {
|
|
427
|
-
t && (f[t.key] =
|
|
427
|
+
t && (f[t.key] = Ce(e.getCell(n + 1), t.type));
|
|
428
428
|
}), c.forEach((t, n) => {
|
|
429
429
|
if (!t) return;
|
|
430
430
|
let a = e.getCell(n + 1);
|
|
431
431
|
a.type === r.ValueType.Formula && (a.result === null || a.result === void 0) && (o += 1, i.length < 20 && i.push(`第 ${l} 行 [${t.title}] 是公式且没有保存计算结果, 请用 Excel 打开并保存后再导入`));
|
|
432
432
|
}), Object.values(f).every((e) => e === null)) return;
|
|
433
433
|
if (d += 1, d > 2e4) {
|
|
434
|
-
s ||= (n.push(`导入数据超出限制(${
|
|
434
|
+
s ||= (n.push(`导入数据超出限制(${he} 条), 请分批导入`), !0);
|
|
435
435
|
return;
|
|
436
436
|
}
|
|
437
437
|
let p = {
|
|
@@ -442,8 +442,8 @@ function De(e, t) {
|
|
|
442
442
|
};
|
|
443
443
|
t.forEach((e) => {
|
|
444
444
|
if (!u.has(e.key)) return;
|
|
445
|
-
let t =
|
|
446
|
-
t.validateSuccess ? p.values[e.key] =
|
|
445
|
+
let t = V(f[e.key] ?? we(e), e);
|
|
446
|
+
t.validateSuccess ? p.values[e.key] = _e(e, t.validateValue ?? null) : (p.values[e.key] = ve(e, f[e.key] ?? null), p.errors[e.key] = t.validateMessage);
|
|
447
447
|
}), a.push(p);
|
|
448
448
|
}), o > i.length && i.push(`还有 ${o - i.length} 个公式单元格没有保存计算结果`), {
|
|
449
449
|
headerMessages: n,
|
|
@@ -453,7 +453,7 @@ function De(e, t) {
|
|
|
453
453
|
};
|
|
454
454
|
}
|
|
455
455
|
// src/core/excel/worksheet.ts
|
|
456
|
-
function
|
|
456
|
+
function De(t, n) {
|
|
457
457
|
let r = n[t.key];
|
|
458
458
|
if (r == null || r === "") return null;
|
|
459
459
|
switch (t.type) {
|
|
@@ -465,23 +465,23 @@ function Oe(t, n) {
|
|
|
465
465
|
}
|
|
466
466
|
case "multiple_choice": {
|
|
467
467
|
let e = t.property.option_map;
|
|
468
|
-
return
|
|
468
|
+
return I((Array.isArray(r) ? r : [r]).map((t) => Object.keys(e).find((n) => e[n] === t) ?? String(t)));
|
|
469
469
|
}
|
|
470
470
|
case "list": {
|
|
471
471
|
let e = Array.isArray(r) ? r : [r], n = t.property.item_key;
|
|
472
|
-
return
|
|
472
|
+
return I(e.map((e) => String(n && typeof e == "object" && e ? e[n] ?? "" : e)));
|
|
473
473
|
}
|
|
474
474
|
default: return r;
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function Oe(e, t) {
|
|
478
478
|
t.forEach((t, n) => {
|
|
479
479
|
t.type === "text" && (e.getColumn(n + 1).numFmt = "@");
|
|
480
480
|
});
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function ke(e, t, n) {
|
|
483
483
|
let r = n.map((e) => e.importable === !1 ? `${e.title}\n(仅导出)` : e.title), i = e.addRow(r);
|
|
484
|
-
i.height = 20 + (Math.max(...r.map((e) => e.split("\n").length)) - 1) * 15, i.eachCell({ includeEmpty: !0 }, (e) => {
|
|
484
|
+
i.height = 20 + (Math.max(1, ...r.map((e) => e.split("\n").length)) - 1) * 15, i.eachCell({ includeEmpty: !0 }, (e) => {
|
|
485
485
|
e.font = {
|
|
486
486
|
bold: !0,
|
|
487
487
|
size: 14,
|
|
@@ -495,16 +495,16 @@ function Ae(e, t, n) {
|
|
|
495
495
|
wrapText: !0
|
|
496
496
|
};
|
|
497
497
|
}), t.forEach((t) => {
|
|
498
|
-
e.addRow(n.map((e) =>
|
|
498
|
+
e.addRow(n.map((e) => De(e, t))).eachCell({ includeEmpty: !0 }, (e) => {
|
|
499
499
|
e.alignment = {
|
|
500
500
|
...e.alignment,
|
|
501
501
|
wrapText: !0,
|
|
502
502
|
vertical: "top"
|
|
503
503
|
};
|
|
504
504
|
});
|
|
505
|
-
}),
|
|
505
|
+
}), Oe(e, n), Me(e);
|
|
506
506
|
}
|
|
507
|
-
function
|
|
507
|
+
function Ae(e) {
|
|
508
508
|
let t = [e.property.required ? "必填" : "可选"];
|
|
509
509
|
switch (e.type) {
|
|
510
510
|
case "text":
|
|
@@ -534,12 +534,12 @@ function je(e) {
|
|
|
534
534
|
case "multiple_choice": t.push(`可多选, 分号分隔(中英文均可): ${Object.keys(e.property.option_map).join(" / ")}`);
|
|
535
535
|
}
|
|
536
536
|
e.key.endsWith("_name") ? t.push("填对应记录的名称") : e.key.endsWith("_number") && t.push("填对应记录的编号");
|
|
537
|
-
let n =
|
|
537
|
+
let n = De(e, { [e.key]: e.property.default_value });
|
|
538
538
|
return t.push(`默认值: ${n == null || n === "" ? "空" : n}`), t.join("\n");
|
|
539
539
|
}
|
|
540
|
-
function
|
|
541
|
-
let n = t.map((e) => `${e.title}\n\n${
|
|
542
|
-
r.height = 20 + (Math.max(...n.map((e) => e.split("\n").length)) - 1) * 15, r.eachCell({ includeEmpty: !0 }, (e) => {
|
|
540
|
+
function je(e, t) {
|
|
541
|
+
let n = t.map((e) => `${e.title}\n\n${Ae(e)}`), r = e.addRow(n);
|
|
542
|
+
r.height = 20 + (Math.max(1, ...n.map((e) => e.split("\n").length)) - 1) * 15, r.eachCell({ includeEmpty: !0 }, (e) => {
|
|
543
543
|
e.font = {
|
|
544
544
|
bold: !0,
|
|
545
545
|
size: 14,
|
|
@@ -552,9 +552,9 @@ function Me(e, t) {
|
|
|
552
552
|
vertical: "top",
|
|
553
553
|
wrapText: !0
|
|
554
554
|
};
|
|
555
|
-
}),
|
|
555
|
+
}), Oe(e, t), Me(e);
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function Me(e, t = 20, n = 60) {
|
|
558
558
|
let r = [];
|
|
559
559
|
e.eachRow({ includeEmpty: !1 }, (e) => {
|
|
560
560
|
e.eachCell({ includeEmpty: !1 }, (e, t) => {
|
|
@@ -576,9 +576,15 @@ function Ne(e, t = 20, n = 60) {
|
|
|
576
576
|
});
|
|
577
577
|
}
|
|
578
578
|
// src/core/excel/runtime.ts
|
|
579
|
-
var
|
|
579
|
+
var Ne = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
580
|
+
function Pe(e, t) {
|
|
581
|
+
n(e, `${t}.xlsx`);
|
|
582
|
+
}
|
|
583
|
+
var Fe;
|
|
580
584
|
function Ie() {
|
|
581
|
-
return Fe ??= import("exceljs").then((e) => e.default ?? e
|
|
585
|
+
return Fe ??= import("exceljs").then((e) => e.default ?? e, (e) => {
|
|
586
|
+
throw Fe = void 0, e;
|
|
587
|
+
}), Fe;
|
|
582
588
|
}
|
|
583
589
|
function Le() {
|
|
584
590
|
return new Promise((e) => {
|
|
@@ -592,21 +598,21 @@ async function ze(e, t, n) {
|
|
|
592
598
|
let r = await Ie();
|
|
593
599
|
Re(n), await Le();
|
|
594
600
|
let i = new r.Workbook();
|
|
595
|
-
|
|
601
|
+
ke(i.addWorksheet("Sheet"), e, t);
|
|
596
602
|
let a = await i.xlsx.writeBuffer();
|
|
597
|
-
return Re(n), new Blob([a], { type:
|
|
603
|
+
return Re(n), new Blob([a], { type: Ne });
|
|
598
604
|
}
|
|
599
|
-
async function Be(e, t,
|
|
600
|
-
let
|
|
601
|
-
return
|
|
605
|
+
async function Be(e, t, n) {
|
|
606
|
+
let r = await ze(e, t);
|
|
607
|
+
return Pe(r, n), r;
|
|
602
608
|
}
|
|
603
609
|
async function Ve(e, t) {
|
|
604
|
-
let
|
|
610
|
+
let n = await Ie();
|
|
605
611
|
await Le();
|
|
606
|
-
let
|
|
607
|
-
|
|
608
|
-
let
|
|
609
|
-
|
|
612
|
+
let r = new n.Workbook();
|
|
613
|
+
je(r.addWorksheet("导入模板"), e);
|
|
614
|
+
let i = await r.xlsx.writeBuffer();
|
|
615
|
+
Pe(new Blob([i], { type: Ne }), t);
|
|
610
616
|
}
|
|
611
617
|
async function He(e, t) {
|
|
612
618
|
let n = await Ie(), r = await e.arrayBuffer();
|
|
@@ -619,7 +625,7 @@ async function He(e, t) {
|
|
|
619
625
|
includedKeys: []
|
|
620
626
|
};
|
|
621
627
|
let a = i.worksheets[0];
|
|
622
|
-
return a ?
|
|
628
|
+
return a ? Ee(a, t) : {
|
|
623
629
|
headerMessages: ["文件里没有工作表"],
|
|
624
630
|
formulaMessages: [],
|
|
625
631
|
rows: [],
|
|
@@ -638,32 +644,36 @@ function We(e) {
|
|
|
638
644
|
function Ge(e) {
|
|
639
645
|
return e?.response?.data;
|
|
640
646
|
}
|
|
647
|
+
function Ke(e) {
|
|
648
|
+
if (!Ue(e)) return;
|
|
649
|
+
let t = We(e);
|
|
650
|
+
return t === void 0 ? "network" : t === 401 ? "unauthorized" : t === 403 ? "forbidden" : t === 404 ? "notFound" : t === 400 ? "badRequest" : t >= 500 ? "server" : "unknown";
|
|
651
|
+
}
|
|
641
652
|
// src/core/taskManager.ts
|
|
642
653
|
var W = class extends Error {
|
|
643
654
|
constructor(e) {
|
|
644
655
|
super(e), this.name = "ImportPauseError";
|
|
645
656
|
}
|
|
646
|
-
},
|
|
647
|
-
function
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
G = { ...G }, Ye.forEach((e) => e());
|
|
654
|
-
}
|
|
655
|
-
function Qe(e) {
|
|
656
|
-
return Ye.add(e), () => {
|
|
657
|
-
Ye.delete(e);
|
|
658
|
-
};
|
|
657
|
+
}, qe = 100, Je = 300;
|
|
658
|
+
function Ye(e) {
|
|
659
|
+
return new Promise((t) => setTimeout(t, e));
|
|
660
|
+
}
|
|
661
|
+
var G = { tasks: [] }, Xe = /* @__PURE__ */ new Set(), Ze = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map();
|
|
662
|
+
function Qe() {
|
|
663
|
+
G = { ...G }, Xe.forEach((e) => e());
|
|
659
664
|
}
|
|
660
665
|
function $e(e) {
|
|
661
|
-
return
|
|
666
|
+
return Xe.add(e), () => {
|
|
667
|
+
Xe.delete(e);
|
|
668
|
+
};
|
|
662
669
|
}
|
|
663
|
-
function et() {
|
|
664
|
-
return
|
|
670
|
+
function et(e) {
|
|
671
|
+
return $e(e);
|
|
665
672
|
}
|
|
666
673
|
function tt() {
|
|
674
|
+
return G.tasks;
|
|
675
|
+
}
|
|
676
|
+
function nt() {
|
|
667
677
|
return `task-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
|
668
678
|
}
|
|
669
679
|
function J(e) {
|
|
@@ -677,29 +687,29 @@ function Y(e, t) {
|
|
|
677
687
|
n && (G = {
|
|
678
688
|
...G,
|
|
679
689
|
tasks: r
|
|
680
|
-
},
|
|
690
|
+
}, Qe());
|
|
681
691
|
}
|
|
682
|
-
function
|
|
692
|
+
function rt(e, t) {
|
|
683
693
|
let n = J(e), r = Date.now();
|
|
684
694
|
return [...n?.samples ?? [], {
|
|
685
695
|
time: r,
|
|
686
696
|
processed: t
|
|
687
697
|
}].filter((e) => r - e.time <= 15e3).slice(-20);
|
|
688
698
|
}
|
|
689
|
-
var
|
|
690
|
-
function
|
|
699
|
+
var it = 100, X = /* @__PURE__ */ new Set(), Z = null;
|
|
700
|
+
function at(e, t, n) {
|
|
691
701
|
let r = K.get(e);
|
|
692
702
|
r && (r.rowStates[t] = {
|
|
693
703
|
...r.rowStates[t],
|
|
694
704
|
...n
|
|
695
|
-
},
|
|
705
|
+
}, ot(e));
|
|
696
706
|
}
|
|
697
|
-
function
|
|
707
|
+
function ot(e) {
|
|
698
708
|
X.add(e), Z === null && (Z = setTimeout(() => {
|
|
699
709
|
Z = null;
|
|
700
710
|
let e = [...X];
|
|
701
|
-
X.clear(), e.forEach(
|
|
702
|
-
},
|
|
711
|
+
X.clear(), e.forEach(st);
|
|
712
|
+
}, it));
|
|
703
713
|
}
|
|
704
714
|
function Q(e) {
|
|
705
715
|
X.delete(e);
|
|
@@ -707,36 +717,36 @@ function Q(e) {
|
|
|
707
717
|
function $(e, t) {
|
|
708
718
|
return {
|
|
709
719
|
processed: t.processed,
|
|
710
|
-
total:
|
|
720
|
+
total: ct(t),
|
|
711
721
|
successCount: t.successCount,
|
|
712
722
|
failureCount: t.failures.length,
|
|
713
723
|
validationFailedCount: t.validationFailedCount,
|
|
714
724
|
failures: t.failures,
|
|
715
725
|
rowStates: t.rowStates,
|
|
716
|
-
samples:
|
|
726
|
+
samples: rt(e, t.processed)
|
|
717
727
|
};
|
|
718
728
|
}
|
|
719
|
-
function
|
|
729
|
+
function st(e) {
|
|
720
730
|
let t = K.get(e);
|
|
721
731
|
t && J(e) && Y(e, $(e, t));
|
|
722
732
|
}
|
|
723
|
-
function
|
|
733
|
+
function ct(e) {
|
|
724
734
|
return e.options.rows.length - e.deletedIndexes.size;
|
|
725
735
|
}
|
|
726
|
-
async function
|
|
727
|
-
let { options:
|
|
728
|
-
t.controller =
|
|
736
|
+
async function lt(e, t, n) {
|
|
737
|
+
let { options: r } = t;
|
|
738
|
+
t.controller = n, t.cancelRequested = !1;
|
|
729
739
|
try {
|
|
730
740
|
for (; !t.cancelRequested;) {
|
|
731
|
-
let
|
|
732
|
-
if (
|
|
741
|
+
let i = t.cursorId === void 0 ? {} : { cursor_id: t.cursorId }, a = await r.fetchPage(i, n.signal);
|
|
742
|
+
if (n.signal.aborted) throw new DOMException("任务已取消", "AbortError");
|
|
733
743
|
if (t.total = a.count, a.results.length === 0) break;
|
|
734
744
|
t.rows = t.rows.concat(a.results);
|
|
735
745
|
let o = t.rows.length;
|
|
736
746
|
Y(e, {
|
|
737
747
|
total: t.total,
|
|
738
748
|
processed: o,
|
|
739
|
-
samples:
|
|
749
|
+
samples: rt(e, o)
|
|
740
750
|
});
|
|
741
751
|
let s = a.results[a.results.length - 1]?.id;
|
|
742
752
|
if (typeof s != "number") throw Error("导出数据缺少 id");
|
|
@@ -752,25 +762,25 @@ async function ct(e, t, r) {
|
|
|
752
762
|
return;
|
|
753
763
|
}
|
|
754
764
|
if (t.rows.length === 0) throw Error("没有可导出的数据");
|
|
755
|
-
Y(e, { finalizing: !0 });
|
|
756
|
-
let
|
|
757
|
-
if (
|
|
765
|
+
Y(e, { finalizing: !0 }), await Ye(Je);
|
|
766
|
+
let i = await ze(t.rows, r.fieldSchemas, n.signal);
|
|
767
|
+
if (n.signal.aborted) throw new DOMException("任务已取消", "AbortError");
|
|
758
768
|
try {
|
|
759
|
-
|
|
769
|
+
Pe(i, r.fileName);
|
|
760
770
|
} catch (e) {
|
|
761
771
|
console.error(`自动下载失败: ${e}`);
|
|
762
772
|
}
|
|
763
|
-
|
|
773
|
+
Y(e, {
|
|
764
774
|
status: "completed",
|
|
765
775
|
pausing: !1,
|
|
766
776
|
finalizing: !1,
|
|
767
777
|
canceling: !1,
|
|
768
778
|
total: t.rows.length,
|
|
769
779
|
processed: t.rows.length,
|
|
770
|
-
blob:
|
|
780
|
+
blob: i
|
|
771
781
|
});
|
|
772
782
|
} catch (t) {
|
|
773
|
-
if (
|
|
783
|
+
if (n.signal.aborted) {
|
|
774
784
|
Y(e, {
|
|
775
785
|
status: "canceled",
|
|
776
786
|
pausing: !1,
|
|
@@ -784,23 +794,31 @@ async function ct(e, t, r) {
|
|
|
784
794
|
pausing: !1,
|
|
785
795
|
finalizing: !1,
|
|
786
796
|
canceling: !1,
|
|
787
|
-
errorMessage:
|
|
797
|
+
errorMessage: dt(t)
|
|
788
798
|
});
|
|
789
799
|
} finally {
|
|
790
800
|
t.controller = null;
|
|
791
801
|
}
|
|
792
802
|
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
803
|
+
var ut = {
|
|
804
|
+
network: "网络异常, 导出失败",
|
|
805
|
+
unauthorized: "登录已过期, 导出失败",
|
|
806
|
+
forbidden: "没有导出权限, 导出失败",
|
|
807
|
+
notFound: "导出接口不存在, 导出失败",
|
|
808
|
+
badRequest: "导出参数错误, 导出失败",
|
|
809
|
+
server: "服务器错误, 导出失败",
|
|
810
|
+
unknown: "导出失败"
|
|
811
|
+
};
|
|
812
|
+
function dt(e) {
|
|
813
|
+
let t = Ke(e);
|
|
814
|
+
return t === void 0 ? e instanceof Error ? e.message : "导出失败" : ut[t];
|
|
797
815
|
}
|
|
798
|
-
function
|
|
799
|
-
return
|
|
816
|
+
function ft(e) {
|
|
817
|
+
return `成功 ${e.successCount} 条, 失败 ${e.failures.length} 条, 可修正失败行后继续`;
|
|
800
818
|
}
|
|
801
|
-
async function
|
|
819
|
+
async function pt(e, t, n) {
|
|
802
820
|
let r = t.options.rows.length;
|
|
803
|
-
if (t.controller = n, t.pauseRequested = !1, t.cancelRequested = !1, t.
|
|
821
|
+
if (t.controller = n, t.pauseRequested = !1, t.cancelRequested = !1, t.runFailureCount = 0, r === 0) {
|
|
804
822
|
Y(e, {
|
|
805
823
|
status: "failed",
|
|
806
824
|
pausing: !1,
|
|
@@ -817,20 +835,20 @@ async function dt(e, t, n) {
|
|
|
817
835
|
}]
|
|
818
836
|
});
|
|
819
837
|
let i = Math.min(Math.max(t.options.batchSize ?? 20, 1), 200), a = Math.min(Math.max(t.options.concurrency ?? 3, 1), 5), o = () => {
|
|
820
|
-
let
|
|
821
|
-
for (;
|
|
822
|
-
let
|
|
823
|
-
if (t.nextIndex += 1,
|
|
824
|
-
t.deletedIndexes.has(
|
|
838
|
+
let e = [];
|
|
839
|
+
for (; e.length < i;) {
|
|
840
|
+
let n = t.nextIndex;
|
|
841
|
+
if (t.nextIndex += 1, n >= r) break;
|
|
842
|
+
t.deletedIndexes.has(n) || t.rowStates[n]?.status !== "completed" && (t.skippedIndexes.has(n) || e.push(n));
|
|
825
843
|
}
|
|
826
|
-
return
|
|
844
|
+
return e;
|
|
827
845
|
}, s = async () => {
|
|
828
846
|
for (;;) {
|
|
829
847
|
if (n.signal.aborted || t.pauseRequested || t.cancelRequested) return;
|
|
830
848
|
let r = o();
|
|
831
849
|
if (r.length === 0) return;
|
|
832
850
|
r.forEach((t) => {
|
|
833
|
-
|
|
851
|
+
at(e, t, {
|
|
834
852
|
status: "running",
|
|
835
853
|
message: void 0,
|
|
836
854
|
fieldErrors: void 0
|
|
@@ -842,7 +860,7 @@ async function dt(e, t, n) {
|
|
|
842
860
|
if (a.length !== r.length) throw new W("导入接口返回结果数量不正确, 任务已暂停");
|
|
843
861
|
a.forEach((n, i) => {
|
|
844
862
|
let a = r[i], o = t.options.rows[a];
|
|
845
|
-
n.success ? (t.successCount += 1,
|
|
863
|
+
n.success ? (t.successCount += 1, at(e, a, {
|
|
846
864
|
status: "completed",
|
|
847
865
|
fieldErrors: void 0
|
|
848
866
|
})) : (t.failures.push({
|
|
@@ -850,27 +868,27 @@ async function dt(e, t, n) {
|
|
|
850
868
|
rowNumber: o.rowNumber,
|
|
851
869
|
message: n.message ?? "导入失败",
|
|
852
870
|
fieldErrors: n.fieldErrors
|
|
853
|
-
}),
|
|
871
|
+
}), at(e, a, {
|
|
854
872
|
status: "failed",
|
|
855
873
|
message: n.message,
|
|
856
874
|
fieldErrors: n.fieldErrors
|
|
857
|
-
}), t.
|
|
875
|
+
}), t.runFailureCount += 1, t.runFailureCount > qe && (t.pauseRequested = !0));
|
|
858
876
|
});
|
|
859
877
|
} catch (i) {
|
|
860
878
|
if (n.signal.aborted) return;
|
|
861
|
-
let a = i instanceof W, o = i instanceof Error ? i.message : "导入失败"
|
|
879
|
+
let a = i instanceof W, o = `${i instanceof Error ? i.message : "导入失败"}(该批结果未知,重试可能重复)`;
|
|
862
880
|
r.forEach((n) => {
|
|
863
881
|
t.failures.push({
|
|
864
882
|
index: n,
|
|
865
883
|
rowNumber: t.options.rows[n].rowNumber,
|
|
866
884
|
message: o
|
|
867
|
-
}),
|
|
885
|
+
}), at(e, n, {
|
|
868
886
|
status: "failed",
|
|
869
887
|
message: o
|
|
870
|
-
}), t.
|
|
871
|
-
}), a ? (t.pauseRequested = !0, n.abort()) : t.
|
|
888
|
+
}), t.runFailureCount += 1;
|
|
889
|
+
}), a ? (t.pauseRequested = !0, n.abort()) : t.runFailureCount > qe && (t.pauseRequested = !0);
|
|
872
890
|
} finally {
|
|
873
|
-
t.processed += r.length,
|
|
891
|
+
t.processed += r.length, ot(e);
|
|
874
892
|
}
|
|
875
893
|
}
|
|
876
894
|
}, c = Math.min(a, Math.max(1, r));
|
|
@@ -919,7 +937,7 @@ async function dt(e, t, n) {
|
|
|
919
937
|
...$(e, t),
|
|
920
938
|
status: "paused",
|
|
921
939
|
pausing: !1,
|
|
922
|
-
errorMessage:
|
|
940
|
+
errorMessage: ft(t)
|
|
923
941
|
}), t.options.onFinished?.();
|
|
924
942
|
return;
|
|
925
943
|
}
|
|
@@ -935,20 +953,20 @@ async function dt(e, t, n) {
|
|
|
935
953
|
pausing: !1
|
|
936
954
|
}), t.options.onFinished?.());
|
|
937
955
|
}
|
|
938
|
-
function
|
|
956
|
+
function mt(e, t) {
|
|
939
957
|
let n = new AbortController();
|
|
940
|
-
q.set(e, n),
|
|
941
|
-
q.delete(e),
|
|
958
|
+
q.set(e, n), lt(e, t, n).finally(() => {
|
|
959
|
+
q.delete(e), Ze.delete(e);
|
|
942
960
|
});
|
|
943
961
|
}
|
|
944
|
-
function
|
|
962
|
+
function ht(e, t) {
|
|
945
963
|
let n = new AbortController();
|
|
946
|
-
q.set(e, n),
|
|
964
|
+
q.set(e, n), pt(e, t, n).finally(() => {
|
|
947
965
|
q.delete(e), X.delete(e), J(e)?.status !== "paused" && K.delete(e);
|
|
948
966
|
});
|
|
949
967
|
}
|
|
950
|
-
function
|
|
951
|
-
let t =
|
|
968
|
+
function gt(e) {
|
|
969
|
+
let t = nt(), n = {
|
|
952
970
|
id: t,
|
|
953
971
|
type: "export",
|
|
954
972
|
title: e.title,
|
|
@@ -969,10 +987,10 @@ function mt(e) {
|
|
|
969
987
|
cancelRequested: !1,
|
|
970
988
|
controller: null
|
|
971
989
|
};
|
|
972
|
-
return
|
|
990
|
+
return Ze.set(t, r), Qe(), mt(t, r), t;
|
|
973
991
|
}
|
|
974
|
-
function
|
|
975
|
-
let t =
|
|
992
|
+
function _t(e) {
|
|
993
|
+
let t = nt(), n = e.rows.map((e) => ({
|
|
976
994
|
status: "queued",
|
|
977
995
|
validationErrors: Object.keys(e.errors).length > 0 ? e.errors : void 0
|
|
978
996
|
})), r = new Set(e.rows.flatMap((e, t) => Object.keys(e.errors).length > 0 ? [t] : [])), i = r.size, a = {
|
|
@@ -1006,12 +1024,12 @@ function ht(e) {
|
|
|
1006
1024
|
cancelRequested: !1,
|
|
1007
1025
|
deletedIndexes: /* @__PURE__ */ new Set(),
|
|
1008
1026
|
skippedIndexes: r,
|
|
1009
|
-
|
|
1027
|
+
runFailureCount: 0,
|
|
1010
1028
|
controller: null
|
|
1011
1029
|
};
|
|
1012
|
-
return K.set(t, o),
|
|
1030
|
+
return K.set(t, o), Qe(), ht(t, o), t;
|
|
1013
1031
|
}
|
|
1014
|
-
function
|
|
1032
|
+
function vt(e) {
|
|
1015
1033
|
let t = J(e);
|
|
1016
1034
|
if (!t || t.type !== "import" || t.status !== "paused") return;
|
|
1017
1035
|
let n = K.get(e);
|
|
@@ -1020,7 +1038,7 @@ function gt(e) {
|
|
|
1020
1038
|
status: "queued",
|
|
1021
1039
|
validationErrors: e.validationErrors
|
|
1022
1040
|
}), a = i.filter((e) => e.validationErrors && Object.keys(e.validationErrors).length > 0).length;
|
|
1023
|
-
n.rowStates = i, n.validationFailedCount = a, n.nextIndex = 0, n.processed = r, n.successCount = r, n.failures = [], n.pauseRequested = !1, n.cancelRequested = !1, n.
|
|
1041
|
+
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, Y(e, {
|
|
1024
1042
|
status: "running",
|
|
1025
1043
|
pausing: !1,
|
|
1026
1044
|
canceling: !1,
|
|
@@ -1031,21 +1049,21 @@ function gt(e) {
|
|
|
1031
1049
|
failures: [],
|
|
1032
1050
|
rowStates: i,
|
|
1033
1051
|
errorMessage: void 0
|
|
1034
|
-
}),
|
|
1052
|
+
}), ht(e, n);
|
|
1035
1053
|
}
|
|
1036
|
-
function
|
|
1054
|
+
function yt(e) {
|
|
1037
1055
|
let t = J(e);
|
|
1038
1056
|
if (!t || t.type !== "import" || t.status !== "running" || t.canceling) return;
|
|
1039
1057
|
let n = K.get(e);
|
|
1040
1058
|
n && (n.pauseRequested = !0, Y(e, { pausing: !0 }));
|
|
1041
1059
|
}
|
|
1042
|
-
function
|
|
1060
|
+
function bt(e, t, n) {
|
|
1043
1061
|
let r = J(e), i = K.get(e);
|
|
1044
1062
|
if (!r || r.type !== "import" || r.status !== "paused" && r.status !== "failed" || !i) return;
|
|
1045
1063
|
let a = r.rowStates?.[t]?.status;
|
|
1046
1064
|
(a === "queued" || a === "failed") && (i.options.rows[t] = n);
|
|
1047
1065
|
}
|
|
1048
|
-
function
|
|
1066
|
+
function xt(e, t, n) {
|
|
1049
1067
|
let r = J(e), i = K.get(e);
|
|
1050
1068
|
if (!r || r.type !== "import" || !i || r.status !== "paused" && r.status !== "failed") return;
|
|
1051
1069
|
let a = Object.keys(n).length > 0, o = i.rowStates[t]?.validationErrors, s = !!(o && Object.keys(o).length > 0);
|
|
@@ -1060,7 +1078,7 @@ function yt(e, t, n) {
|
|
|
1060
1078
|
rowStates: i.rowStates
|
|
1061
1079
|
});
|
|
1062
1080
|
}
|
|
1063
|
-
function
|
|
1081
|
+
function St(e, t) {
|
|
1064
1082
|
let n = J(e), r = K.get(e);
|
|
1065
1083
|
n && n.type === "import" && n.status === "paused" && r && (t.forEach((e) => {
|
|
1066
1084
|
let t = r.rowStates[e];
|
|
@@ -1069,21 +1087,21 @@ function bt(e, t) {
|
|
|
1069
1087
|
fieldErrors: void 0
|
|
1070
1088
|
});
|
|
1071
1089
|
}), Y(e, {
|
|
1072
|
-
total:
|
|
1090
|
+
total: ct(r),
|
|
1073
1091
|
validationFailedCount: r.validationFailedCount,
|
|
1074
1092
|
rowStates: r.rowStates
|
|
1075
1093
|
}));
|
|
1076
1094
|
}
|
|
1077
|
-
function
|
|
1095
|
+
function Ct(e, t, n) {
|
|
1078
1096
|
let r = J(e)?.rowStates?.[t];
|
|
1079
1097
|
if (!r?.fieldErrors?.some((e) => n in e)) return;
|
|
1080
1098
|
let i = r.fieldErrors.filter((e) => !(n in e));
|
|
1081
|
-
|
|
1099
|
+
at(e, t, {
|
|
1082
1100
|
...r,
|
|
1083
1101
|
fieldErrors: i.length > 0 ? i : void 0
|
|
1084
1102
|
});
|
|
1085
1103
|
}
|
|
1086
|
-
function
|
|
1104
|
+
function wt(e) {
|
|
1087
1105
|
let t = J(e);
|
|
1088
1106
|
if (!t) return;
|
|
1089
1107
|
if (t.status === "paused") {
|
|
@@ -1097,8 +1115,8 @@ function St(e) {
|
|
|
1097
1115
|
}
|
|
1098
1116
|
if (t.status !== "running") return;
|
|
1099
1117
|
if (t.type === "export") {
|
|
1100
|
-
if (t.canceling) return;
|
|
1101
|
-
let n =
|
|
1118
|
+
if (t.canceling || t.finalizing) return;
|
|
1119
|
+
let n = Ze.get(e);
|
|
1102
1120
|
if (!n) return;
|
|
1103
1121
|
n.cancelRequested = !0, n.controller?.abort(), Y(e, { canceling: !0 });
|
|
1104
1122
|
return;
|
|
@@ -1107,28 +1125,28 @@ function St(e) {
|
|
|
1107
1125
|
let n = K.get(e);
|
|
1108
1126
|
n && (n.cancelRequested = !0, Y(e, { canceling: !0 }));
|
|
1109
1127
|
}
|
|
1110
|
-
function
|
|
1128
|
+
function Tt(e) {
|
|
1111
1129
|
let t = J(e);
|
|
1112
|
-
t && (t.status === "running" && q.get(e)?.abort(),
|
|
1130
|
+
t && (t.status === "running" && q.get(e)?.abort(), Ze.delete(e), K.delete(e), X.delete(e), G = {
|
|
1113
1131
|
...G,
|
|
1114
1132
|
tasks: G.tasks.filter((t) => t.id !== e)
|
|
1115
|
-
},
|
|
1133
|
+
}, Qe());
|
|
1116
1134
|
}
|
|
1117
|
-
function
|
|
1135
|
+
function Et(e, t) {
|
|
1118
1136
|
try {
|
|
1119
|
-
return
|
|
1137
|
+
return Pe(e, t), !0;
|
|
1120
1138
|
} catch (e) {
|
|
1121
1139
|
return console.error(`下载失败: ${e}`), !1;
|
|
1122
1140
|
}
|
|
1123
1141
|
}
|
|
1124
|
-
function
|
|
1142
|
+
function Dt(e) {
|
|
1125
1143
|
let t = J(e);
|
|
1126
|
-
return t?.type !== "export" || !t.blob || !t.fileName ? !1 :
|
|
1144
|
+
return t?.type !== "export" || !t.blob || !t.fileName ? !1 : Et(t.blob, t.fileName);
|
|
1127
1145
|
}
|
|
1128
|
-
function
|
|
1129
|
-
q.forEach((e) => e.abort()), q.clear(),
|
|
1146
|
+
function Ot() {
|
|
1147
|
+
q.forEach((e) => e.abort()), q.clear(), Ze.clear(), K.clear(), X.clear(), Z !== null && (clearTimeout(Z), Z = null), G = { tasks: [] }, Qe();
|
|
1130
1148
|
}
|
|
1131
|
-
function
|
|
1149
|
+
function kt(e) {
|
|
1132
1150
|
if (e.status !== "running" || e.total <= 0) return null;
|
|
1133
1151
|
let t = Math.max(0, e.total - (e.validationFailedCount ?? 0) - e.processed);
|
|
1134
1152
|
if (t === 0) return 0;
|
|
@@ -1136,59 +1154,32 @@ function Dt(e) {
|
|
|
1136
1154
|
let n = e.samples[0], r = e.samples[e.samples.length - 1], i = (r.time - n.time) / 1e3, a = r.processed - n.processed;
|
|
1137
1155
|
return i <= 0 || a <= 0 ? null : t / (a / i);
|
|
1138
1156
|
}
|
|
1139
|
-
function
|
|
1157
|
+
function At(e) {
|
|
1140
1158
|
return e.type === "import" ? e.successCount === void 0 ? e.rowStates?.filter((e) => e.status === "completed").length ?? e.processed : e.successCount : e.processed;
|
|
1141
1159
|
}
|
|
1142
|
-
function
|
|
1143
|
-
return e.total <= 0 ? 0 : Math.min(100,
|
|
1160
|
+
function jt(e) {
|
|
1161
|
+
return e.total <= 0 ? 0 : Math.min(100, At(e) / e.total * 100);
|
|
1144
1162
|
}
|
|
1145
|
-
function
|
|
1163
|
+
function Mt(e) {
|
|
1146
1164
|
if (e.finalizing) return 100;
|
|
1147
|
-
let t =
|
|
1165
|
+
let t = jt(e);
|
|
1148
1166
|
return t >= 100 ? 100 : Math.trunc(t * 10) / 10;
|
|
1149
1167
|
}
|
|
1150
|
-
function
|
|
1168
|
+
function Nt(e) {
|
|
1151
1169
|
return `${(Math.trunc(e * 10) / 10).toFixed(1)}%`;
|
|
1152
1170
|
}
|
|
1153
|
-
function
|
|
1171
|
+
function Pt(e) {
|
|
1154
1172
|
if (e === null) return "计算中...";
|
|
1155
1173
|
let t = Math.ceil(e);
|
|
1156
1174
|
return t < 60 ? `约 ${t} 秒` : `约 ${Math.floor(t / 60)} 分 ${t % 60} 秒`;
|
|
1157
1175
|
}
|
|
1158
1176
|
// src/react/useTaskDetail.ts
|
|
1159
|
-
function Nt(e) {
|
|
1160
|
-
let t = i(() => e ? et().find((t) => t.id === e) : void 0, [e]);
|
|
1161
|
-
return l($e, t);
|
|
1162
|
-
}
|
|
1163
|
-
// src/components/BatchExportButton.tsx
|
|
1164
|
-
var Pt = ({ title: t, fieldSchemas: n, selectedRows: r, disabled: i }) => {
|
|
1165
|
-
let [a, o] = c(!1);
|
|
1166
|
-
return /* @__PURE__ */ O(h, {
|
|
1167
|
-
type: "default",
|
|
1168
|
-
icon: /* @__PURE__ */ O(d, {}),
|
|
1169
|
-
loading: a,
|
|
1170
|
-
disabled: i ?? r.length === 0,
|
|
1171
|
-
onClick: async () => {
|
|
1172
|
-
if (r.length === 0) return;
|
|
1173
|
-
if (r.length > 2e4) {
|
|
1174
|
-
E.error(`导出数据 ${r.length.toLocaleString()} 条,超过上限 ${he} 条,请分批导出`);
|
|
1175
|
-
return;
|
|
1176
|
-
}
|
|
1177
|
-
let i = `${t}_${e().format("YYYYMMDDHHmmss")}`;
|
|
1178
|
-
o(!0);
|
|
1179
|
-
try {
|
|
1180
|
-
await Be(r, n, i), E.success("导出成功");
|
|
1181
|
-
} catch (e) {
|
|
1182
|
-
console.error(`导出失败: ${e}`), E.error("导出失败");
|
|
1183
|
-
} finally {
|
|
1184
|
-
o(!1);
|
|
1185
|
-
}
|
|
1186
|
-
},
|
|
1187
|
-
children: "批量导出"
|
|
1188
|
-
});
|
|
1189
|
-
};
|
|
1190
|
-
// src/components/ExportTaskModal.tsx
|
|
1191
1177
|
function Ft(e) {
|
|
1178
|
+
let t = i(() => e ? tt().find((t) => t.id === e) : void 0, [e]);
|
|
1179
|
+
return l(et, t);
|
|
1180
|
+
}
|
|
1181
|
+
// src/components/ExportTaskModal.tsx
|
|
1182
|
+
function It(e) {
|
|
1192
1183
|
if (e.canceling) return "正在取消";
|
|
1193
1184
|
if (e.finalizing) return "正在生成文件";
|
|
1194
1185
|
switch (e.status) {
|
|
@@ -1199,26 +1190,26 @@ function Ft(e) {
|
|
|
1199
1190
|
case "canceled": return "已取消";
|
|
1200
1191
|
}
|
|
1201
1192
|
}
|
|
1202
|
-
function
|
|
1193
|
+
function Lt(e) {
|
|
1203
1194
|
if (e.canceling) return "warning";
|
|
1204
1195
|
if (e.finalizing) return "processing";
|
|
1205
1196
|
}
|
|
1206
|
-
function
|
|
1197
|
+
function Rt(e) {
|
|
1207
1198
|
switch (e.status) {
|
|
1208
1199
|
case "failed": return "exception";
|
|
1209
1200
|
case "completed": return "success";
|
|
1210
1201
|
default: return "normal";
|
|
1211
1202
|
}
|
|
1212
1203
|
}
|
|
1213
|
-
var
|
|
1214
|
-
let n =
|
|
1204
|
+
var zt = ({ taskId: e, onClose: t }) => {
|
|
1205
|
+
let n = Ft(e), { message: r } = m.useApp();
|
|
1215
1206
|
if (!n) return null;
|
|
1216
|
-
let i = n.status === "completed" || n.status === "failed" || n.status === "canceled", a =
|
|
1217
|
-
|
|
1207
|
+
let i = n.status === "completed" || n.status === "failed" || n.status === "canceled", a = Mt(n), o = () => {
|
|
1208
|
+
Tt(n.id), t();
|
|
1218
1209
|
}, s = () => {
|
|
1219
|
-
|
|
1220
|
-
}, c =
|
|
1221
|
-
return /* @__PURE__ */
|
|
1210
|
+
Dt(n.id) || r.error("文件不存在");
|
|
1211
|
+
}, c = It(n);
|
|
1212
|
+
return /* @__PURE__ */ D(y, {
|
|
1222
1213
|
title: n.title,
|
|
1223
1214
|
open: !0,
|
|
1224
1215
|
maskClosable: !1,
|
|
@@ -1227,114 +1218,131 @@ var Rt = ({ taskId: e, onClose: t }) => {
|
|
|
1227
1218
|
onCancel: () => {
|
|
1228
1219
|
i && o();
|
|
1229
1220
|
},
|
|
1230
|
-
footer: i ? /* @__PURE__ */
|
|
1221
|
+
footer: i ? /* @__PURE__ */ O(g, {
|
|
1231
1222
|
justify: "flex-end",
|
|
1232
1223
|
gap: 8,
|
|
1233
|
-
children: [n.status === "completed" ? /* @__PURE__ */
|
|
1224
|
+
children: [n.status === "completed" ? /* @__PURE__ */ D(h, {
|
|
1234
1225
|
onClick: s,
|
|
1235
1226
|
children: "重新下载"
|
|
1236
|
-
}) : null, /* @__PURE__ */
|
|
1227
|
+
}) : null, /* @__PURE__ */ D(h, {
|
|
1237
1228
|
type: "primary",
|
|
1238
1229
|
onClick: o,
|
|
1239
1230
|
children: "关闭"
|
|
1240
1231
|
})]
|
|
1241
|
-
}) : /* @__PURE__ */
|
|
1232
|
+
}) : /* @__PURE__ */ D(g, {
|
|
1242
1233
|
justify: "flex-end",
|
|
1243
|
-
children: /* @__PURE__ */
|
|
1234
|
+
children: /* @__PURE__ */ D(h, {
|
|
1244
1235
|
danger: !0,
|
|
1245
1236
|
loading: n.canceling,
|
|
1246
1237
|
disabled: n.canceling || n.finalizing,
|
|
1247
|
-
onClick: () =>
|
|
1238
|
+
onClick: () => wt(n.id),
|
|
1248
1239
|
children: n.canceling ? "取消中" : "取消任务"
|
|
1249
1240
|
})
|
|
1250
1241
|
}),
|
|
1251
|
-
children: /* @__PURE__ */
|
|
1242
|
+
children: /* @__PURE__ */ O(g, {
|
|
1252
1243
|
vertical: !0,
|
|
1253
1244
|
gap: 12,
|
|
1254
1245
|
children: [
|
|
1255
|
-
/* @__PURE__ */
|
|
1246
|
+
/* @__PURE__ */ O(g, {
|
|
1256
1247
|
justify: "space-between",
|
|
1257
1248
|
align: "center",
|
|
1258
1249
|
gap: 12,
|
|
1259
|
-
children: [/* @__PURE__ */
|
|
1250
|
+
children: [/* @__PURE__ */ O(E.Text, {
|
|
1260
1251
|
type: "secondary",
|
|
1261
1252
|
children: [
|
|
1262
1253
|
"已导出 ",
|
|
1263
|
-
|
|
1254
|
+
At(n).toLocaleString(),
|
|
1264
1255
|
" / 总数 ",
|
|
1265
1256
|
n.total > 0 ? n.total.toLocaleString() : "--"
|
|
1266
1257
|
]
|
|
1267
|
-
}), /* @__PURE__ */
|
|
1268
|
-
color:
|
|
1258
|
+
}), /* @__PURE__ */ D(w, {
|
|
1259
|
+
color: Lt(n),
|
|
1269
1260
|
children: c
|
|
1270
1261
|
})]
|
|
1271
1262
|
}),
|
|
1272
|
-
/* @__PURE__ */
|
|
1263
|
+
/* @__PURE__ */ D(x, {
|
|
1273
1264
|
percent: a,
|
|
1274
|
-
format: () =>
|
|
1275
|
-
status:
|
|
1265
|
+
format: () => Nt(a),
|
|
1266
|
+
status: Rt(n),
|
|
1276
1267
|
size: "small"
|
|
1277
1268
|
}),
|
|
1278
|
-
n.finalizing ? /* @__PURE__ */
|
|
1269
|
+
n.finalizing ? /* @__PURE__ */ D(E.Text, {
|
|
1279
1270
|
type: "secondary",
|
|
1280
1271
|
children: "正在生成文件..."
|
|
1281
1272
|
}) : null,
|
|
1282
|
-
n.canceling ? /* @__PURE__ */
|
|
1273
|
+
n.canceling ? /* @__PURE__ */ D(E.Text, {
|
|
1283
1274
|
type: "secondary",
|
|
1284
1275
|
children: "正在取消..."
|
|
1285
1276
|
}) : null,
|
|
1286
|
-
n.errorMessage ? /* @__PURE__ */
|
|
1277
|
+
n.errorMessage ? /* @__PURE__ */ D(E.Text, {
|
|
1287
1278
|
type: "danger",
|
|
1288
1279
|
children: n.errorMessage
|
|
1289
1280
|
}) : null
|
|
1290
1281
|
]
|
|
1291
1282
|
})
|
|
1292
1283
|
});
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1284
|
+
};
|
|
1285
|
+
// src/core/excel/exportFile.ts
|
|
1286
|
+
function Bt(t) {
|
|
1287
|
+
return `${t}_${e().format("YYYYMMDDHHmmss")}`;
|
|
1288
|
+
}
|
|
1289
|
+
function Vt(e) {
|
|
1290
|
+
return e <= 2e4 ? null : `导出数据 ${e.toLocaleString()} 条,超过上限 ${H.toLocaleString()} 条,请分批导出`;
|
|
1291
|
+
}
|
|
1292
|
+
async function Ht(e) {
|
|
1293
|
+
let { title: t, fieldSchemas: n, rows: r } = e;
|
|
1294
|
+
if (r.length === 0) throw Error("没有可导出的数据");
|
|
1295
|
+
let i = Vt(r.length);
|
|
1296
|
+
if (i) throw Error(i);
|
|
1297
|
+
return Be(r, n, Bt(t));
|
|
1298
|
+
}
|
|
1299
|
+
// src/components/ExportButton.tsx
|
|
1300
|
+
var Ut = ({ title: e, buttonText: t = "导出", fieldSchemas: n, filters: r, totalCount: i, disabled: o, fetchPage: l }) => {
|
|
1301
|
+
let { message: u } = m.useApp(), [f, p] = c(), g = s(void 0);
|
|
1295
1302
|
return a(() => {
|
|
1296
|
-
|
|
1297
|
-
}, [
|
|
1298
|
-
|
|
1299
|
-
}, []), /* @__PURE__ */
|
|
1303
|
+
g.current = f;
|
|
1304
|
+
}, [f]), a(() => () => {
|
|
1305
|
+
g.current && Tt(g.current);
|
|
1306
|
+
}, []), /* @__PURE__ */ O(ne, { children: [/* @__PURE__ */ D(T, {
|
|
1300
1307
|
title: "导出 Excel",
|
|
1301
|
-
children: /* @__PURE__ */
|
|
1308
|
+
children: /* @__PURE__ */ D(h, {
|
|
1302
1309
|
type: "default",
|
|
1303
|
-
icon: /* @__PURE__ */
|
|
1304
|
-
disabled:
|
|
1310
|
+
icon: /* @__PURE__ */ D(d, {}),
|
|
1311
|
+
disabled: o,
|
|
1305
1312
|
onClick: () => {
|
|
1306
|
-
if (
|
|
1307
|
-
|
|
1313
|
+
if (i === 0) {
|
|
1314
|
+
u.error("没有可导出的数据");
|
|
1308
1315
|
return;
|
|
1309
1316
|
}
|
|
1310
|
-
|
|
1311
|
-
|
|
1317
|
+
let t = Vt(i);
|
|
1318
|
+
if (t) {
|
|
1319
|
+
u.error(t);
|
|
1312
1320
|
return;
|
|
1313
1321
|
}
|
|
1314
|
-
let
|
|
1315
|
-
|
|
1316
|
-
title: `${
|
|
1317
|
-
fileName:
|
|
1318
|
-
fieldSchemas:
|
|
1319
|
-
fetchPage: (e, t) =>
|
|
1320
|
-
...
|
|
1322
|
+
let a = Bt(e);
|
|
1323
|
+
p(gt({
|
|
1324
|
+
title: `${e}导出`,
|
|
1325
|
+
fileName: a,
|
|
1326
|
+
fieldSchemas: n,
|
|
1327
|
+
fetchPage: (e, t) => l({
|
|
1328
|
+
...r,
|
|
1321
1329
|
...e
|
|
1322
1330
|
}, t)
|
|
1323
1331
|
}));
|
|
1324
1332
|
},
|
|
1325
|
-
children:
|
|
1333
|
+
children: t
|
|
1326
1334
|
})
|
|
1327
|
-
}),
|
|
1328
|
-
taskId:
|
|
1329
|
-
onClose: () =>
|
|
1335
|
+
}), f ? /* @__PURE__ */ D(zt, {
|
|
1336
|
+
taskId: f,
|
|
1337
|
+
onClose: () => p(void 0)
|
|
1330
1338
|
}) : null] });
|
|
1331
|
-
}, { Text:
|
|
1339
|
+
}, { Text: Wt } = E, Gt = ({ missingTitles: e, headerMessages: t }) => /* @__PURE__ */ O(g, {
|
|
1332
1340
|
vertical: !0,
|
|
1333
1341
|
gap: 4,
|
|
1334
|
-
children: [e.length > 0 ? /* @__PURE__ */
|
|
1342
|
+
children: [e.length > 0 ? /* @__PURE__ */ D(Wt, { children: `缺少必填列: ${e.join(", ")}` }) : null, t.map((e, t) => /* @__PURE__ */ D(Wt, { children: e }, t))]
|
|
1335
1343
|
});
|
|
1336
1344
|
// src/react/useDebouncedValue.ts
|
|
1337
|
-
function
|
|
1345
|
+
function Kt(e, t) {
|
|
1338
1346
|
let [n, r] = c(e);
|
|
1339
1347
|
return a(() => {
|
|
1340
1348
|
let n = setTimeout(() => r(e), t);
|
|
@@ -1342,9 +1350,10 @@ function Ht(e, t) {
|
|
|
1342
1350
|
}, [e, t]), n;
|
|
1343
1351
|
}
|
|
1344
1352
|
// src/react/useThrottledValue.ts
|
|
1345
|
-
function
|
|
1353
|
+
function qt(e, t) {
|
|
1346
1354
|
let [n, r] = c(e), i = s(e), o = s(0), l = s(null);
|
|
1347
|
-
return
|
|
1355
|
+
return a(() => {
|
|
1356
|
+
i.current = e;
|
|
1348
1357
|
let n = Date.now() - o.current;
|
|
1349
1358
|
n >= t ? (o.current = Date.now(), r(e)) : l.current === null && (l.current = setTimeout(() => {
|
|
1350
1359
|
l.current = null, o.current = Date.now(), r(i.current);
|
|
@@ -1354,12 +1363,12 @@ function Ut(e, t) {
|
|
|
1354
1363
|
}, []), n;
|
|
1355
1364
|
}
|
|
1356
1365
|
// src/components/ImportPreviewModal.tsx
|
|
1357
|
-
function
|
|
1358
|
-
return e == null || e === "" ? "" : Array.isArray(e) ?
|
|
1366
|
+
function Jt(e) {
|
|
1367
|
+
return e == null || e === "" ? "" : Array.isArray(e) ? I(e) : String(e);
|
|
1359
1368
|
}
|
|
1360
|
-
var
|
|
1361
|
-
let { token: a } =
|
|
1362
|
-
if (o && !n) return e.type === "boolean" ? /* @__PURE__ */
|
|
1369
|
+
var Yt = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
|
|
1370
|
+
let { token: a } = te.useToken(), [o, s] = c(!1), [l, u] = c(!1), d = t.values[e.key];
|
|
1371
|
+
if (o && !n) return e.type === "boolean" ? /* @__PURE__ */ D(S, {
|
|
1363
1372
|
autoFocus: !0,
|
|
1364
1373
|
open: !0,
|
|
1365
1374
|
size: "small",
|
|
@@ -1376,7 +1385,7 @@ var Gt = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
|
|
|
1376
1385
|
r(e), i(e), s(!1);
|
|
1377
1386
|
},
|
|
1378
1387
|
onBlur: () => s(!1)
|
|
1379
|
-
}) : e.type === "single_choice" ? /* @__PURE__ */
|
|
1388
|
+
}) : e.type === "single_choice" ? /* @__PURE__ */ D(S, {
|
|
1380
1389
|
autoFocus: !0,
|
|
1381
1390
|
open: !0,
|
|
1382
1391
|
size: "small",
|
|
@@ -1390,7 +1399,7 @@ var Gt = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
|
|
|
1390
1399
|
r(e), i(e), s(!1);
|
|
1391
1400
|
},
|
|
1392
1401
|
onBlur: () => s(!1)
|
|
1393
|
-
}) : e.type === "multiple_choice" ? /* @__PURE__ */
|
|
1402
|
+
}) : e.type === "multiple_choice" ? /* @__PURE__ */ D(S, {
|
|
1394
1403
|
autoFocus: !0,
|
|
1395
1404
|
open: !0,
|
|
1396
1405
|
mode: "multiple",
|
|
@@ -1405,7 +1414,7 @@ var Gt = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
|
|
|
1405
1414
|
onBlur: () => {
|
|
1406
1415
|
s(!1), i(d);
|
|
1407
1416
|
}
|
|
1408
|
-
}) : e.type === "number" ? /* @__PURE__ */
|
|
1417
|
+
}) : e.type === "number" ? /* @__PURE__ */ D(v, {
|
|
1409
1418
|
autoFocus: !0,
|
|
1410
1419
|
size: "small",
|
|
1411
1420
|
style: { width: "100%" },
|
|
@@ -1417,7 +1426,7 @@ var Gt = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
|
|
|
1417
1426
|
onPressEnter: () => {
|
|
1418
1427
|
s(!1), i(d);
|
|
1419
1428
|
}
|
|
1420
|
-
}) : /* @__PURE__ */
|
|
1429
|
+
}) : /* @__PURE__ */ D(_, {
|
|
1421
1430
|
autoFocus: !0,
|
|
1422
1431
|
size: "small",
|
|
1423
1432
|
value: typeof d == "string" ? d : "",
|
|
@@ -1430,8 +1439,8 @@ var Gt = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
|
|
|
1430
1439
|
s(!1), i(d);
|
|
1431
1440
|
}
|
|
1432
1441
|
});
|
|
1433
|
-
let f =
|
|
1434
|
-
return /* @__PURE__ */
|
|
1442
|
+
let f = Jt(d);
|
|
1443
|
+
return /* @__PURE__ */ D("div", {
|
|
1435
1444
|
title: f || void 0,
|
|
1436
1445
|
style: {
|
|
1437
1446
|
height: 24,
|
|
@@ -1452,7 +1461,7 @@ var Gt = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
|
|
|
1452
1461
|
onClick: () => {
|
|
1453
1462
|
n || s(!0);
|
|
1454
1463
|
},
|
|
1455
|
-
children: /* @__PURE__ */
|
|
1464
|
+
children: /* @__PURE__ */ D("span", {
|
|
1456
1465
|
style: {
|
|
1457
1466
|
minWidth: 0,
|
|
1458
1467
|
overflow: "hidden",
|
|
@@ -1463,7 +1472,7 @@ var Gt = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
|
|
|
1463
1472
|
})
|
|
1464
1473
|
});
|
|
1465
1474
|
};
|
|
1466
|
-
function
|
|
1475
|
+
function Xt(e) {
|
|
1467
1476
|
if (e.canceling) return {
|
|
1468
1477
|
label: "正在取消",
|
|
1469
1478
|
color: "warning"
|
|
@@ -1491,21 +1500,21 @@ function Kt(e) {
|
|
|
1491
1500
|
};
|
|
1492
1501
|
}
|
|
1493
1502
|
}
|
|
1494
|
-
function
|
|
1503
|
+
function Zt(e, t) {
|
|
1495
1504
|
if (e.canceling) return "正在取消...";
|
|
1496
1505
|
switch (e.status) {
|
|
1497
|
-
case "running": return `预计剩余 ${
|
|
1506
|
+
case "running": return `预计剩余 ${Pt(t)}`;
|
|
1498
1507
|
default: return null;
|
|
1499
1508
|
}
|
|
1500
1509
|
}
|
|
1501
|
-
function
|
|
1510
|
+
function Qt(e) {
|
|
1502
1511
|
switch (e.status) {
|
|
1503
1512
|
case "failed": return "exception";
|
|
1504
1513
|
case "completed": return "success";
|
|
1505
1514
|
default: return "normal";
|
|
1506
1515
|
}
|
|
1507
1516
|
}
|
|
1508
|
-
var
|
|
1517
|
+
var $t = {
|
|
1509
1518
|
valid: {
|
|
1510
1519
|
label: "已校验",
|
|
1511
1520
|
color: "success"
|
|
@@ -1514,7 +1523,7 @@ var Yt = {
|
|
|
1514
1523
|
label: "校验失败",
|
|
1515
1524
|
color: "error"
|
|
1516
1525
|
}
|
|
1517
|
-
},
|
|
1526
|
+
}, en = {
|
|
1518
1527
|
pending: {
|
|
1519
1528
|
label: "待导入",
|
|
1520
1529
|
color: "default"
|
|
@@ -1536,10 +1545,10 @@ var Yt = {
|
|
|
1536
1545
|
color: "warning"
|
|
1537
1546
|
}
|
|
1538
1547
|
};
|
|
1539
|
-
function
|
|
1548
|
+
function tn(e) {
|
|
1540
1549
|
return Object.keys(e.errors).length > 0 ? "invalid" : "valid";
|
|
1541
1550
|
}
|
|
1542
|
-
function
|
|
1551
|
+
function nn(e, t, n) {
|
|
1543
1552
|
if (!t || e.taskIndex === void 0) return "pending";
|
|
1544
1553
|
switch (n?.rowStates?.[e.taskIndex]?.status) {
|
|
1545
1554
|
case "running": return "running";
|
|
@@ -1549,19 +1558,21 @@ function Qt(e, t, n) {
|
|
|
1549
1558
|
default: return "pending";
|
|
1550
1559
|
}
|
|
1551
1560
|
}
|
|
1552
|
-
var
|
|
1553
|
-
let [
|
|
1554
|
-
|
|
1555
|
-
},
|
|
1556
|
-
|
|
1557
|
-
|
|
1561
|
+
var rn = ({ open: e, title: t, fieldSchemas: n, rows: r, taskId: i, includedKeys: l, onChangeCell: d, onSaveCell: f, onDelete: p, onConfirm: m, onClose: v }) => {
|
|
1562
|
+
let [C, T] = c("all"), [te, k] = c("all"), [A, j] = c(""), M = Kt(A, 300), N = () => {
|
|
1563
|
+
T("all"), k("all"), j("");
|
|
1564
|
+
}, P = Ft(i), re = s(void 0);
|
|
1565
|
+
a(() => {
|
|
1566
|
+
P && (re.current = P);
|
|
1567
|
+
}, [P]);
|
|
1568
|
+
let ie = o(() => new Set(l), [l]), ae = n.filter((e) => ie.has(e.key)), oe = re.current, F = P ?? (oe?.id === i ? oe : void 0), se = F ? Xt(F) : void 0, I = !!(F && F.status !== "completed" && F.status !== "failed" && F.status !== "canceled"), L = qt(F?.status === "running" ? kt(F) : null, 1e3), ce = F ? Zt(F, L) : null, R = (e) => e.taskIndex === void 0 ? void 0 : F?.rowStates?.[e.taskIndex], le = !(!P || P.status !== "failed" && P.status !== "paused"), ue = (e) => {
|
|
1558
1569
|
if (!i) return !0;
|
|
1559
|
-
let t =
|
|
1560
|
-
return
|
|
1561
|
-
},
|
|
1570
|
+
let t = R(e)?.status;
|
|
1571
|
+
return le && (t === "queued" || t === "failed") ? !0 : le && e.taskIndex === void 0 && Object.keys(e.errors).length > 0;
|
|
1572
|
+
}, de = (e) => !i || P?.status === "paused" && R(e)?.status === "queued", fe = o(() => ["valid", "invalid"].map((e) => ({
|
|
1562
1573
|
value: e,
|
|
1563
|
-
label:
|
|
1564
|
-
})), []),
|
|
1574
|
+
label: $t[e].label
|
|
1575
|
+
})), []), pe = o(() => [
|
|
1565
1576
|
"pending",
|
|
1566
1577
|
"running",
|
|
1567
1578
|
"completed",
|
|
@@ -1569,33 +1580,33 @@ var $t = ({ open: e, title: t, fieldSchemas: n, rows: r, taskId: i, includedKeys
|
|
|
1569
1580
|
"canceled"
|
|
1570
1581
|
].map((e) => ({
|
|
1571
1582
|
value: e,
|
|
1572
|
-
label:
|
|
1573
|
-
})), []),
|
|
1574
|
-
if (!
|
|
1575
|
-
let e =
|
|
1576
|
-
return r.filter((t) =>
|
|
1583
|
+
label: en[e].label
|
|
1584
|
+
})), []), z = F?.status === "running", me = z ? "" : M, B = !z && C !== "all" && fe.some((e) => e.value === C) ? C : "all", V = !z && te !== "all" && pe.some((e) => e.value === te) ? te : "all", he = B !== "all" || me.trim() !== "", H = V !== "all", ge = he || H, U = o(() => {
|
|
1585
|
+
if (!he) return r;
|
|
1586
|
+
let e = me.trim().toLowerCase();
|
|
1587
|
+
return r.filter((t) => B !== "all" && tn(t) !== B ? !1 : !e || Object.values(t.values).some((t) => (Array.isArray(t) ? t.join(" ") : String(t ?? "")).toLowerCase().includes(e)));
|
|
1577
1588
|
}, [
|
|
1578
1589
|
r,
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
]),
|
|
1590
|
+
B,
|
|
1591
|
+
me,
|
|
1592
|
+
he
|
|
1593
|
+
]), _e = qt(F, 300), ve = H ? _e : void 0, ye = o(() => H ? U.filter((e) => nn(e, i, ve) === V) : i && F ? U.slice() : U, [
|
|
1583
1594
|
U,
|
|
1584
|
-
z,
|
|
1585
1595
|
V,
|
|
1586
|
-
|
|
1587
|
-
|
|
1596
|
+
H,
|
|
1597
|
+
ve,
|
|
1598
|
+
F,
|
|
1588
1599
|
i
|
|
1589
|
-
]),
|
|
1600
|
+
]), be = (e) => {
|
|
1590
1601
|
let t = Object.entries(e.errors);
|
|
1591
|
-
return /* @__PURE__ */
|
|
1602
|
+
return /* @__PURE__ */ D(g, {
|
|
1592
1603
|
vertical: !0,
|
|
1593
1604
|
gap: 4,
|
|
1594
1605
|
style: { maxWidth: 320 },
|
|
1595
1606
|
children: t.map(([e, t]) => {
|
|
1596
1607
|
let r = n.find((t) => t.key === e)?.title ?? e;
|
|
1597
|
-
return /* @__PURE__ */
|
|
1598
|
-
/* @__PURE__ */
|
|
1608
|
+
return /* @__PURE__ */ O(E.Text, { children: [
|
|
1609
|
+
/* @__PURE__ */ D(E.Text, {
|
|
1599
1610
|
strong: !0,
|
|
1600
1611
|
children: r
|
|
1601
1612
|
}),
|
|
@@ -1604,45 +1615,45 @@ var $t = ({ open: e, title: t, fieldSchemas: n, rows: r, taskId: i, includedKeys
|
|
|
1604
1615
|
] }, e);
|
|
1605
1616
|
})
|
|
1606
1617
|
});
|
|
1607
|
-
},
|
|
1608
|
-
let t =
|
|
1609
|
-
return t === "invalid" ? /* @__PURE__ */
|
|
1618
|
+
}, xe = (e) => {
|
|
1619
|
+
let t = tn(e), n = $t[t];
|
|
1620
|
+
return t === "invalid" ? /* @__PURE__ */ D(b, {
|
|
1610
1621
|
trigger: "hover",
|
|
1611
1622
|
placement: "topRight",
|
|
1612
1623
|
title: "错误信息",
|
|
1613
|
-
content:
|
|
1614
|
-
children: /* @__PURE__ */
|
|
1624
|
+
content: be(e),
|
|
1625
|
+
children: /* @__PURE__ */ D(w, {
|
|
1615
1626
|
color: n.color,
|
|
1616
1627
|
children: n.label
|
|
1617
1628
|
})
|
|
1618
|
-
}) : /* @__PURE__ */
|
|
1629
|
+
}) : /* @__PURE__ */ D(w, {
|
|
1619
1630
|
color: n.color,
|
|
1620
1631
|
children: n.label
|
|
1621
1632
|
});
|
|
1622
|
-
},
|
|
1623
|
-
let t =
|
|
1624
|
-
if (r.length === 0) return /* @__PURE__ */
|
|
1633
|
+
}, Se = (e) => {
|
|
1634
|
+
let t = R(e), r = t?.fieldErrors ?? [], i = t?.message;
|
|
1635
|
+
if (r.length === 0) return /* @__PURE__ */ D(E.Text, { children: i ?? "导入失败" });
|
|
1625
1636
|
let a = /* @__PURE__ */ new Map();
|
|
1626
1637
|
r.forEach((e) => {
|
|
1627
1638
|
let [t, r] = Object.entries(e)[0] ?? [], i = t === "detail" || t === "non_field_errors" ? "错误" : n.find((e) => e.key === t)?.title ?? "数据", o = a.get(i) ?? [];
|
|
1628
1639
|
o.push(r), a.set(i, o);
|
|
1629
1640
|
});
|
|
1630
1641
|
let o = [...a.entries()], s = o.slice(0, 3), c = o.length - s.length;
|
|
1631
|
-
return /* @__PURE__ */
|
|
1642
|
+
return /* @__PURE__ */ O(g, {
|
|
1632
1643
|
vertical: !0,
|
|
1633
1644
|
gap: 8,
|
|
1634
1645
|
style: { maxWidth: 360 },
|
|
1635
1646
|
children: [
|
|
1636
|
-
i ? /* @__PURE__ */
|
|
1637
|
-
s.map(([e, t]) => /* @__PURE__ */
|
|
1647
|
+
i ? /* @__PURE__ */ D(E.Text, { children: i }) : null,
|
|
1648
|
+
s.map(([e, t]) => /* @__PURE__ */ O(g, {
|
|
1638
1649
|
vertical: !0,
|
|
1639
1650
|
gap: 2,
|
|
1640
|
-
children: [/* @__PURE__ */
|
|
1651
|
+
children: [/* @__PURE__ */ D(E.Text, {
|
|
1641
1652
|
strong: !0,
|
|
1642
1653
|
children: e
|
|
1643
|
-
}), t.map((e, t) => /* @__PURE__ */
|
|
1654
|
+
}), t.map((e, t) => /* @__PURE__ */ O(E.Text, { children: ["• ", e] }, t))]
|
|
1644
1655
|
}, e)),
|
|
1645
|
-
c > 0 ? /* @__PURE__ */
|
|
1656
|
+
c > 0 ? /* @__PURE__ */ O(E.Text, {
|
|
1646
1657
|
type: "secondary",
|
|
1647
1658
|
children: [
|
|
1648
1659
|
"还有 ",
|
|
@@ -1652,36 +1663,36 @@ var $t = ({ open: e, title: t, fieldSchemas: n, rows: r, taskId: i, includedKeys
|
|
|
1652
1663
|
}) : null
|
|
1653
1664
|
]
|
|
1654
1665
|
});
|
|
1655
|
-
},
|
|
1656
|
-
let t =
|
|
1666
|
+
}, Ce = (e) => {
|
|
1667
|
+
let t = nn(e, i, F), n = en[t];
|
|
1657
1668
|
if (t === "failed") {
|
|
1658
|
-
let t =
|
|
1659
|
-
return /* @__PURE__ */
|
|
1669
|
+
let t = R(e), r = (t?.fieldErrors?.length ?? 0) + +!!t?.message, i = r > 0 ? `导入失败(${r})` : n.label;
|
|
1670
|
+
return /* @__PURE__ */ D(b, {
|
|
1660
1671
|
trigger: "hover",
|
|
1661
1672
|
placement: "topRight",
|
|
1662
1673
|
title: "错误信息",
|
|
1663
|
-
content:
|
|
1664
|
-
children: /* @__PURE__ */
|
|
1674
|
+
content: Se(e),
|
|
1675
|
+
children: /* @__PURE__ */ D(w, {
|
|
1665
1676
|
color: n.color,
|
|
1666
1677
|
children: i
|
|
1667
1678
|
})
|
|
1668
1679
|
});
|
|
1669
1680
|
}
|
|
1670
|
-
return /* @__PURE__ */
|
|
1681
|
+
return /* @__PURE__ */ D(w, {
|
|
1671
1682
|
color: n.color,
|
|
1672
1683
|
children: n.label
|
|
1673
1684
|
});
|
|
1674
|
-
},
|
|
1685
|
+
}, we = (e) => /* @__PURE__ */ D(h, {
|
|
1675
1686
|
type: "primary",
|
|
1676
1687
|
danger: !0,
|
|
1677
1688
|
size: "small",
|
|
1678
|
-
disabled: !
|
|
1679
|
-
icon: /* @__PURE__ */
|
|
1689
|
+
disabled: !de(e),
|
|
1690
|
+
icon: /* @__PURE__ */ D(u, {}),
|
|
1680
1691
|
onClick: () => {
|
|
1681
|
-
|
|
1692
|
+
p(e), P && e.taskIndex !== void 0 && St(P.id, [e.taskIndex]);
|
|
1682
1693
|
},
|
|
1683
1694
|
children: "删除"
|
|
1684
|
-
}),
|
|
1695
|
+
}), Te = [
|
|
1685
1696
|
{
|
|
1686
1697
|
key: "rowNumber",
|
|
1687
1698
|
title: "行号",
|
|
@@ -1689,17 +1700,17 @@ var $t = ({ open: e, title: t, fieldSchemas: n, rows: r, taskId: i, includedKeys
|
|
|
1689
1700
|
width: 60,
|
|
1690
1701
|
fixed: "left"
|
|
1691
1702
|
},
|
|
1692
|
-
...
|
|
1703
|
+
...ae.map((e) => ({
|
|
1693
1704
|
key: e.key,
|
|
1694
1705
|
title: e.title,
|
|
1695
1706
|
dataIndex: e.key,
|
|
1696
1707
|
width: 160,
|
|
1697
|
-
render: (t, n) => /* @__PURE__ */
|
|
1708
|
+
render: (t, n) => /* @__PURE__ */ D(Yt, {
|
|
1698
1709
|
field: e,
|
|
1699
1710
|
record: n,
|
|
1700
|
-
disabled: !
|
|
1701
|
-
onChange: (t) =>
|
|
1702
|
-
onSave: (t) =>
|
|
1711
|
+
disabled: !ue(n),
|
|
1712
|
+
onChange: (t) => d(n, e, t),
|
|
1713
|
+
onSave: (t) => f(n, e, t)
|
|
1703
1714
|
})
|
|
1704
1715
|
})),
|
|
1705
1716
|
{
|
|
@@ -1707,24 +1718,24 @@ var $t = ({ open: e, title: t, fieldSchemas: n, rows: r, taskId: i, includedKeys
|
|
|
1707
1718
|
title: "数据状态",
|
|
1708
1719
|
width: 100,
|
|
1709
1720
|
fixed: "right",
|
|
1710
|
-
render: (e, t) =>
|
|
1721
|
+
render: (e, t) => xe(t)
|
|
1711
1722
|
},
|
|
1712
1723
|
{
|
|
1713
1724
|
key: "importStatus",
|
|
1714
1725
|
title: "导入状态",
|
|
1715
1726
|
width: 110,
|
|
1716
1727
|
fixed: "right",
|
|
1717
|
-
render: (e, t) =>
|
|
1728
|
+
render: (e, t) => Ce(t)
|
|
1718
1729
|
},
|
|
1719
1730
|
{
|
|
1720
1731
|
key: "action",
|
|
1721
1732
|
title: "操作",
|
|
1722
1733
|
width: 80,
|
|
1723
1734
|
fixed: "right",
|
|
1724
|
-
render: (e, t) =>
|
|
1735
|
+
render: (e, t) => we(t)
|
|
1725
1736
|
}
|
|
1726
|
-
],
|
|
1727
|
-
return /* @__PURE__ */
|
|
1737
|
+
], Ee = Math.max(1200, 60 + ae.length * 160 + 100 + 110 + 80), De = F && F.total > 0 ? Mt(F) : 0, Oe = F?.failureCount ?? F?.failures?.length ?? 0, ke = F?.validationFailedCount ?? r.filter((e) => Object.keys(e.errors).length > 0).length, Ae = r.filter((e) => Object.keys(e.errors).length > 0).length, je = r.length > 0 && Ae === r.length;
|
|
1738
|
+
return /* @__PURE__ */ D(ne, { children: /* @__PURE__ */ O(y, {
|
|
1728
1739
|
title: i ? `${t}导入` : `${t}导入预览`,
|
|
1729
1740
|
open: e,
|
|
1730
1741
|
width: "min(1400px, 96vw)",
|
|
@@ -1732,251 +1743,259 @@ var $t = ({ open: e, title: t, fieldSchemas: n, rows: r, taskId: i, includedKeys
|
|
|
1732
1743
|
closable: !1,
|
|
1733
1744
|
keyboard: !1,
|
|
1734
1745
|
onCancel: () => {
|
|
1735
|
-
|
|
1746
|
+
I || v();
|
|
1736
1747
|
},
|
|
1737
1748
|
footer: (() => {
|
|
1738
|
-
if (!i) return /* @__PURE__ */
|
|
1749
|
+
if (!i) return /* @__PURE__ */ O(g, {
|
|
1739
1750
|
justify: "space-between",
|
|
1740
1751
|
align: "center",
|
|
1741
1752
|
gap: 8,
|
|
1742
1753
|
wrap: !0,
|
|
1743
|
-
children: [/* @__PURE__ */
|
|
1744
|
-
type:
|
|
1745
|
-
children:
|
|
1746
|
-
}) : null }), /* @__PURE__ */
|
|
1754
|
+
children: [/* @__PURE__ */ D("span", { children: r.length > 0 && Ae > 0 ? /* @__PURE__ */ D(E.Text, {
|
|
1755
|
+
type: je ? "danger" : "secondary",
|
|
1756
|
+
children: je ? "全部行校验失败, 请先修正后再导入" : `有 ${Ae} 行校验失败, 不会导入`
|
|
1757
|
+
}) : null }), /* @__PURE__ */ O(g, {
|
|
1747
1758
|
gap: 8,
|
|
1748
|
-
children: [/* @__PURE__ */
|
|
1749
|
-
onClick:
|
|
1759
|
+
children: [/* @__PURE__ */ D(h, {
|
|
1760
|
+
onClick: v,
|
|
1750
1761
|
children: "取消"
|
|
1751
|
-
}), /* @__PURE__ */
|
|
1762
|
+
}), /* @__PURE__ */ D(h, {
|
|
1752
1763
|
type: "primary",
|
|
1753
|
-
disabled: r.length === 0 ||
|
|
1764
|
+
disabled: r.length === 0 || je,
|
|
1754
1765
|
onClick: () => {
|
|
1755
|
-
|
|
1766
|
+
N(), m();
|
|
1756
1767
|
},
|
|
1757
1768
|
children: "开始导入"
|
|
1758
1769
|
})]
|
|
1759
1770
|
})]
|
|
1760
1771
|
});
|
|
1761
|
-
if (!
|
|
1772
|
+
if (!P || !F) return /* @__PURE__ */ D(g, {
|
|
1762
1773
|
justify: "flex-end",
|
|
1763
|
-
children: /* @__PURE__ */
|
|
1764
|
-
onClick:
|
|
1774
|
+
children: /* @__PURE__ */ D(h, {
|
|
1775
|
+
onClick: v,
|
|
1765
1776
|
children: "关闭"
|
|
1766
1777
|
})
|
|
1767
1778
|
});
|
|
1768
|
-
let e =
|
|
1769
|
-
return /* @__PURE__ */
|
|
1779
|
+
let e = F.status === "running", t = F.status === "paused";
|
|
1780
|
+
return /* @__PURE__ */ O(g, {
|
|
1770
1781
|
justify: "flex-end",
|
|
1771
1782
|
gap: 8,
|
|
1772
1783
|
children: [
|
|
1773
|
-
e ? /* @__PURE__ */
|
|
1784
|
+
e ? /* @__PURE__ */ O(ne, { children: [/* @__PURE__ */ D(h, {
|
|
1774
1785
|
danger: !0,
|
|
1775
|
-
loading:
|
|
1776
|
-
disabled:
|
|
1777
|
-
onClick: () =>
|
|
1778
|
-
children:
|
|
1779
|
-
}), /* @__PURE__ */
|
|
1780
|
-
loading:
|
|
1781
|
-
disabled:
|
|
1782
|
-
onClick: () =>
|
|
1786
|
+
loading: F.canceling,
|
|
1787
|
+
disabled: F.canceling,
|
|
1788
|
+
onClick: () => wt(F.id),
|
|
1789
|
+
children: F.canceling ? "取消中" : "取消任务"
|
|
1790
|
+
}), /* @__PURE__ */ D(h, {
|
|
1791
|
+
loading: F.pausing,
|
|
1792
|
+
disabled: F.canceling,
|
|
1793
|
+
onClick: () => yt(F.id),
|
|
1783
1794
|
children: "暂停"
|
|
1784
1795
|
})] }) : null,
|
|
1785
|
-
t ? /* @__PURE__ */
|
|
1796
|
+
t ? /* @__PURE__ */ O(ne, { children: [/* @__PURE__ */ D(h, {
|
|
1786
1797
|
danger: !0,
|
|
1787
|
-
onClick: () =>
|
|
1798
|
+
onClick: () => wt(F.id),
|
|
1788
1799
|
children: "取消任务"
|
|
1789
|
-
}), /* @__PURE__ */
|
|
1800
|
+
}), /* @__PURE__ */ D(h, {
|
|
1790
1801
|
type: "primary",
|
|
1791
1802
|
onClick: () => {
|
|
1792
|
-
|
|
1803
|
+
N(), vt(F.id);
|
|
1793
1804
|
},
|
|
1794
1805
|
children: "继续导入"
|
|
1795
1806
|
})] }) : null,
|
|
1796
|
-
!e && !t ? /* @__PURE__ */
|
|
1807
|
+
!e && !t ? /* @__PURE__ */ D(h, {
|
|
1797
1808
|
type: "primary",
|
|
1798
|
-
onClick:
|
|
1809
|
+
onClick: v,
|
|
1799
1810
|
children: "关闭"
|
|
1800
1811
|
}) : null
|
|
1801
1812
|
]
|
|
1802
1813
|
});
|
|
1803
1814
|
})(),
|
|
1804
1815
|
children: [
|
|
1805
|
-
|
|
1816
|
+
F && se ? /* @__PURE__ */ O(g, {
|
|
1806
1817
|
vertical: !0,
|
|
1807
1818
|
gap: 4,
|
|
1808
1819
|
style: { marginBottom: 12 },
|
|
1809
|
-
children: [/* @__PURE__ */
|
|
1820
|
+
children: [/* @__PURE__ */ O(g, {
|
|
1810
1821
|
justify: "space-between",
|
|
1811
1822
|
align: "center",
|
|
1812
|
-
children: [/* @__PURE__ */
|
|
1823
|
+
children: [/* @__PURE__ */ O(E.Text, {
|
|
1813
1824
|
type: "secondary",
|
|
1814
1825
|
children: [
|
|
1815
1826
|
"已导入 ",
|
|
1816
|
-
|
|
1827
|
+
At(F).toLocaleString(),
|
|
1817
1828
|
" / 总数 ",
|
|
1818
|
-
|
|
1829
|
+
F.total.toLocaleString()
|
|
1819
1830
|
]
|
|
1820
|
-
}), /* @__PURE__ */
|
|
1831
|
+
}), /* @__PURE__ */ O(g, {
|
|
1821
1832
|
align: "center",
|
|
1822
1833
|
gap: 8,
|
|
1823
1834
|
children: [
|
|
1824
|
-
|
|
1835
|
+
ce ? /* @__PURE__ */ D(E.Text, {
|
|
1825
1836
|
type: "secondary",
|
|
1826
|
-
children:
|
|
1837
|
+
children: ce
|
|
1827
1838
|
}) : null,
|
|
1828
|
-
|
|
1839
|
+
ke > 0 ? /* @__PURE__ */ O(w, {
|
|
1829
1840
|
color: "error",
|
|
1830
1841
|
children: [
|
|
1831
1842
|
"校验失败 ",
|
|
1832
|
-
|
|
1843
|
+
ke,
|
|
1833
1844
|
" 条"
|
|
1834
1845
|
]
|
|
1835
1846
|
}) : null,
|
|
1836
|
-
|
|
1847
|
+
Oe > 0 ? /* @__PURE__ */ O(w, {
|
|
1837
1848
|
color: "error",
|
|
1838
1849
|
children: [
|
|
1839
1850
|
"导入失败 ",
|
|
1840
|
-
|
|
1851
|
+
Oe,
|
|
1841
1852
|
" 条"
|
|
1842
1853
|
]
|
|
1843
1854
|
}) : null,
|
|
1844
|
-
/* @__PURE__ */
|
|
1855
|
+
/* @__PURE__ */ D(w, {
|
|
1845
1856
|
color: se.color,
|
|
1846
1857
|
children: se.label
|
|
1847
1858
|
})
|
|
1848
1859
|
]
|
|
1849
1860
|
})]
|
|
1850
|
-
}), /* @__PURE__ */
|
|
1851
|
-
percent:
|
|
1852
|
-
format: () =>
|
|
1853
|
-
status:
|
|
1861
|
+
}), /* @__PURE__ */ D(x, {
|
|
1862
|
+
percent: De,
|
|
1863
|
+
format: () => Nt(De),
|
|
1864
|
+
status: Qt(F),
|
|
1854
1865
|
size: "small"
|
|
1855
1866
|
})]
|
|
1856
|
-
}) : i ? null : /* @__PURE__ */
|
|
1867
|
+
}) : i ? null : /* @__PURE__ */ O(g, {
|
|
1857
1868
|
vertical: !0,
|
|
1858
1869
|
gap: 4,
|
|
1859
1870
|
style: { marginBottom: 12 },
|
|
1860
|
-
children: [/* @__PURE__ */
|
|
1871
|
+
children: [/* @__PURE__ */ O(g, {
|
|
1861
1872
|
justify: "space-between",
|
|
1862
1873
|
align: "center",
|
|
1863
|
-
children: [/* @__PURE__ */
|
|
1874
|
+
children: [/* @__PURE__ */ O(E.Text, {
|
|
1864
1875
|
type: "secondary",
|
|
1865
1876
|
children: ["总数 ", r.length.toLocaleString()]
|
|
1866
|
-
}), /* @__PURE__ */
|
|
1877
|
+
}), /* @__PURE__ */ O(g, {
|
|
1867
1878
|
align: "center",
|
|
1868
1879
|
gap: 8,
|
|
1869
|
-
children: [
|
|
1880
|
+
children: [ke > 0 ? /* @__PURE__ */ O(w, {
|
|
1870
1881
|
color: "error",
|
|
1871
1882
|
children: [
|
|
1872
1883
|
"校验失败 ",
|
|
1873
|
-
|
|
1884
|
+
ke,
|
|
1874
1885
|
" 条"
|
|
1875
1886
|
]
|
|
1876
|
-
}) : null, /* @__PURE__ */
|
|
1887
|
+
}) : null, /* @__PURE__ */ D(w, { children: "待导入" })]
|
|
1877
1888
|
})]
|
|
1878
|
-
}), /* @__PURE__ */
|
|
1889
|
+
}), /* @__PURE__ */ D(x, {
|
|
1879
1890
|
percent: 0,
|
|
1880
1891
|
format: () => "0.0%",
|
|
1881
1892
|
size: "small"
|
|
1882
1893
|
})]
|
|
1883
1894
|
}),
|
|
1884
|
-
/* @__PURE__ */
|
|
1895
|
+
/* @__PURE__ */ O(g, {
|
|
1885
1896
|
justify: "space-between",
|
|
1886
1897
|
align: "center",
|
|
1887
1898
|
gap: 8,
|
|
1888
1899
|
wrap: !0,
|
|
1889
1900
|
style: { marginBottom: 8 },
|
|
1890
|
-
children: [/* @__PURE__ */
|
|
1901
|
+
children: [/* @__PURE__ */ O(g, {
|
|
1891
1902
|
align: "center",
|
|
1892
1903
|
gap: 8,
|
|
1893
1904
|
wrap: !0,
|
|
1894
1905
|
children: [
|
|
1895
|
-
/* @__PURE__ */
|
|
1906
|
+
/* @__PURE__ */ D(_, {
|
|
1896
1907
|
allowClear: !0,
|
|
1897
|
-
disabled:
|
|
1908
|
+
disabled: z,
|
|
1898
1909
|
placeholder: "搜索所有字段",
|
|
1899
|
-
value:
|
|
1910
|
+
value: z ? "" : A,
|
|
1900
1911
|
style: { width: 260 },
|
|
1901
1912
|
onChange: (e) => {
|
|
1902
|
-
|
|
1913
|
+
j(e.target.value);
|
|
1903
1914
|
}
|
|
1904
1915
|
}),
|
|
1905
|
-
/* @__PURE__ */
|
|
1916
|
+
/* @__PURE__ */ D(S, {
|
|
1906
1917
|
allowClear: !0,
|
|
1907
|
-
disabled:
|
|
1918
|
+
disabled: z,
|
|
1908
1919
|
placeholder: "数据状态",
|
|
1909
|
-
value:
|
|
1910
|
-
options:
|
|
1920
|
+
value: B === "all" ? void 0 : B,
|
|
1921
|
+
options: fe,
|
|
1911
1922
|
style: { width: 140 },
|
|
1912
1923
|
onChange: (e) => {
|
|
1913
|
-
|
|
1924
|
+
T(e ?? "all");
|
|
1914
1925
|
}
|
|
1915
1926
|
}),
|
|
1916
|
-
/* @__PURE__ */
|
|
1927
|
+
/* @__PURE__ */ D(S, {
|
|
1917
1928
|
allowClear: !0,
|
|
1918
|
-
disabled:
|
|
1929
|
+
disabled: z,
|
|
1919
1930
|
placeholder: "导入状态",
|
|
1920
|
-
value:
|
|
1921
|
-
options:
|
|
1931
|
+
value: V === "all" ? void 0 : V,
|
|
1932
|
+
options: pe,
|
|
1922
1933
|
style: { width: 140 },
|
|
1923
1934
|
onChange: (e) => {
|
|
1924
|
-
|
|
1935
|
+
k(e ?? "all");
|
|
1925
1936
|
}
|
|
1926
1937
|
})
|
|
1927
1938
|
]
|
|
1928
|
-
}),
|
|
1939
|
+
}), ge ? /* @__PURE__ */ O(E.Text, {
|
|
1929
1940
|
type: "secondary",
|
|
1930
1941
|
children: [
|
|
1931
1942
|
"筛选出 ",
|
|
1932
|
-
|
|
1943
|
+
ye.length,
|
|
1933
1944
|
" 条"
|
|
1934
1945
|
]
|
|
1935
1946
|
}) : null]
|
|
1936
1947
|
}),
|
|
1937
|
-
/* @__PURE__ */
|
|
1948
|
+
/* @__PURE__ */ D(ee, {
|
|
1938
1949
|
rowKey: "key",
|
|
1939
1950
|
size: "middle",
|
|
1940
1951
|
tableLayout: "fixed",
|
|
1941
1952
|
virtual: !0,
|
|
1942
|
-
columns:
|
|
1943
|
-
dataSource:
|
|
1953
|
+
columns: Te,
|
|
1954
|
+
dataSource: ye,
|
|
1944
1955
|
pagination: !1,
|
|
1945
1956
|
scroll: {
|
|
1946
|
-
x:
|
|
1957
|
+
x: Ee,
|
|
1947
1958
|
y: 520
|
|
1948
1959
|
},
|
|
1949
|
-
locale: { emptyText:
|
|
1960
|
+
locale: { emptyText: ge ? "没有符合条件的行" : void 0 }
|
|
1950
1961
|
})
|
|
1951
1962
|
]
|
|
1952
1963
|
}) });
|
|
1953
|
-
},
|
|
1964
|
+
}, an = "缺少列: ", on = [
|
|
1954
1965
|
/期望为一个包含物件的列表/,
|
|
1955
1966
|
/expected a list/i,
|
|
1956
1967
|
/得到的类型是/,
|
|
1957
1968
|
/not a list/i
|
|
1958
1969
|
];
|
|
1959
|
-
function
|
|
1960
|
-
return
|
|
1970
|
+
function sn(e) {
|
|
1971
|
+
return on.some((t) => t.test(e)) ? "数据格式不正确, 请检查导入内容" : e;
|
|
1961
1972
|
}
|
|
1962
|
-
function
|
|
1973
|
+
function cn(e) {
|
|
1963
1974
|
if (Object.keys(e).length === 0) return { success: !0 };
|
|
1964
1975
|
let t = [], n;
|
|
1965
1976
|
return Object.entries(e).forEach(([e, r]) => {
|
|
1966
1977
|
let i = Array.isArray(r) ? r : [r];
|
|
1967
|
-
e === "detail" || e === "non_field_errors" ? n = i.map((e) =>
|
|
1978
|
+
e === "detail" || e === "non_field_errors" ? n = i.map((e) => sn(String(e))).join("; ") : i.forEach((n) => t.push({ [e]: sn(String(n)) }));
|
|
1968
1979
|
}), {
|
|
1969
1980
|
success: !1,
|
|
1970
1981
|
...n ? { message: n } : {},
|
|
1971
1982
|
...t.length > 0 ? { fieldErrors: t } : {}
|
|
1972
1983
|
};
|
|
1973
1984
|
}
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1985
|
+
var ln = {
|
|
1986
|
+
network: "网络异常, 任务已暂停",
|
|
1987
|
+
unauthorized: "登录已过期, 任务已暂停",
|
|
1988
|
+
forbidden: "没有导入权限, 任务已暂停",
|
|
1989
|
+
notFound: "导入接口不存在, 任务已暂停",
|
|
1990
|
+
badRequest: "请求参数错误, 任务已暂停",
|
|
1991
|
+
server: "服务器错误, 任务已暂停",
|
|
1992
|
+
unknown: "导入失败, 任务已暂停"
|
|
1993
|
+
};
|
|
1994
|
+
function un(e) {
|
|
1995
|
+
let t = Ke(e);
|
|
1996
|
+
return t === void 0 ? "导入失败, 任务已暂停" : ln[t];
|
|
1978
1997
|
}
|
|
1979
|
-
function
|
|
1998
|
+
function dn(e) {
|
|
1980
1999
|
let t = Ge(e);
|
|
1981
2000
|
if (t && typeof t == "object") {
|
|
1982
2001
|
let e = t;
|
|
@@ -1989,81 +2008,81 @@ function on(e) {
|
|
|
1989
2008
|
}
|
|
1990
2009
|
return "导入数据校验失败";
|
|
1991
2010
|
}
|
|
1992
|
-
var
|
|
1993
|
-
let [i, l] = c(!1), [u, d] = c([]), [g, _] = c(), [v, y] = c("empty"), [b, x] = c(!1), [S, ee] = c(!1), [w,
|
|
2011
|
+
var fn = ({ title: e, fieldSchemas: t, importRows: n, onImported: r }) => {
|
|
2012
|
+
let [i, l] = c(!1), [u, d] = c([]), [g, _] = c(), [v, y] = c("empty"), [b, x] = c(!1), [S, ee] = c(!1), [w, E] = c([]), { modal: te, message: k } = m.useApp(), A = s(null), j = s(void 0), M = o(() => oe(t), [t]);
|
|
1994
2013
|
a(() => {
|
|
1995
|
-
|
|
2014
|
+
j.current = g;
|
|
1996
2015
|
}, [g]), a(() => () => {
|
|
1997
|
-
|
|
2016
|
+
j.current && Tt(j.current);
|
|
1998
2017
|
}, []);
|
|
1999
|
-
let
|
|
2000
|
-
|
|
2018
|
+
let N = () => A.current?.click(), P = (e, t) => {
|
|
2019
|
+
te.warning({
|
|
2001
2020
|
title: t ?? (e.missingTitles.length > 0 ? "文件表头不完整" : "文件检查未通过"),
|
|
2002
2021
|
width: 480,
|
|
2003
|
-
content: /* @__PURE__ */
|
|
2022
|
+
content: /* @__PURE__ */ D(Gt, { ...e }),
|
|
2004
2023
|
okCancel: !0,
|
|
2005
2024
|
okText: "重新选择文件",
|
|
2006
2025
|
cancelText: "关闭",
|
|
2007
2026
|
closable: !0,
|
|
2008
|
-
onOk:
|
|
2027
|
+
onOk: N
|
|
2009
2028
|
});
|
|
2010
|
-
},
|
|
2011
|
-
if (e.size > 20971520)
|
|
2029
|
+
}, re = async (e) => {
|
|
2030
|
+
if (e.size > 20971520) k.error("文件大小超过 20MB, 请拆分后再导入");
|
|
2012
2031
|
else {
|
|
2013
|
-
_(void 0),
|
|
2032
|
+
_(void 0), E([]), x(!0);
|
|
2014
2033
|
try {
|
|
2015
|
-
let { headerMessages: t, formulaMessages: n, rows: r, includedKeys: i } = await He(e,
|
|
2034
|
+
let { headerMessages: t, formulaMessages: n, rows: r, includedKeys: i } = await He(e, M);
|
|
2016
2035
|
if (n.length > 0) {
|
|
2017
|
-
|
|
2036
|
+
P({
|
|
2018
2037
|
missingTitles: [],
|
|
2019
2038
|
headerMessages: n
|
|
2020
2039
|
}, "文件里的公式还没有计算结果");
|
|
2021
2040
|
return;
|
|
2022
2041
|
}
|
|
2023
2042
|
if (t.length > 0) {
|
|
2024
|
-
|
|
2025
|
-
missingTitles: t.filter((e) => e.startsWith(
|
|
2026
|
-
headerMessages: t.filter((e) => !e.startsWith(
|
|
2043
|
+
P({
|
|
2044
|
+
missingTitles: t.filter((e) => e.startsWith(an)).map((e) => e.slice(5)),
|
|
2045
|
+
headerMessages: t.filter((e) => !e.startsWith(an))
|
|
2027
2046
|
});
|
|
2028
2047
|
return;
|
|
2029
2048
|
}
|
|
2030
2049
|
if (r.length === 0) {
|
|
2031
|
-
|
|
2050
|
+
k.error("文件里没有数据行");
|
|
2032
2051
|
return;
|
|
2033
2052
|
}
|
|
2034
|
-
|
|
2053
|
+
E(i), y(`${e.name}-${Date.now()}`), d(r), l(!0);
|
|
2035
2054
|
} catch (e) {
|
|
2036
|
-
console.error(`导入文件解析失败: ${e}`),
|
|
2055
|
+
console.error(`导入文件解析失败: ${e}`), k.error("导入文件解析失败, 请确认上传的是 Excel 文件");
|
|
2037
2056
|
} finally {
|
|
2038
2057
|
x(!1);
|
|
2039
2058
|
}
|
|
2040
2059
|
}
|
|
2041
2060
|
};
|
|
2042
|
-
return /* @__PURE__ */
|
|
2043
|
-
/* @__PURE__ */
|
|
2061
|
+
return /* @__PURE__ */ O(ne, { children: [
|
|
2062
|
+
/* @__PURE__ */ O(C.Compact, {
|
|
2044
2063
|
block: !0,
|
|
2045
|
-
children: [/* @__PURE__ */
|
|
2064
|
+
children: [/* @__PURE__ */ D(T, {
|
|
2046
2065
|
title: "Excel 导入",
|
|
2047
|
-
children: /* @__PURE__ */
|
|
2066
|
+
children: /* @__PURE__ */ D(h, {
|
|
2048
2067
|
type: "default",
|
|
2049
|
-
icon: /* @__PURE__ */
|
|
2068
|
+
icon: /* @__PURE__ */ D(p, {}),
|
|
2050
2069
|
loading: b,
|
|
2051
2070
|
disabled: b,
|
|
2052
|
-
onClick:
|
|
2071
|
+
onClick: N,
|
|
2053
2072
|
children: "导入"
|
|
2054
2073
|
})
|
|
2055
|
-
}), /* @__PURE__ */
|
|
2074
|
+
}), /* @__PURE__ */ D(T, {
|
|
2056
2075
|
title: "Excel 导入模板",
|
|
2057
|
-
children: /* @__PURE__ */
|
|
2076
|
+
children: /* @__PURE__ */ D(h, {
|
|
2058
2077
|
type: "default",
|
|
2059
|
-
icon: /* @__PURE__ */
|
|
2078
|
+
icon: /* @__PURE__ */ D(f, {}),
|
|
2060
2079
|
loading: S,
|
|
2061
2080
|
onClick: async () => {
|
|
2062
2081
|
ee(!0);
|
|
2063
2082
|
try {
|
|
2064
|
-
await Ve(
|
|
2083
|
+
await Ve(M, `${e}导入模板`);
|
|
2065
2084
|
} catch (e) {
|
|
2066
|
-
console.error(`模板下载失败: ${e}`),
|
|
2085
|
+
console.error(`模板下载失败: ${e}`), k.error("模板下载失败");
|
|
2067
2086
|
} finally {
|
|
2068
2087
|
ee(!1);
|
|
2069
2088
|
}
|
|
@@ -2072,26 +2091,26 @@ var sn = ({ title: e, fieldSchemas: t, importRows: n, onImported: r }) => {
|
|
|
2072
2091
|
})
|
|
2073
2092
|
})]
|
|
2074
2093
|
}),
|
|
2075
|
-
/* @__PURE__ */
|
|
2076
|
-
ref:
|
|
2094
|
+
/* @__PURE__ */ D("input", {
|
|
2095
|
+
ref: A,
|
|
2077
2096
|
type: "file",
|
|
2078
2097
|
accept: ".xlsx",
|
|
2079
2098
|
style: { display: "none" },
|
|
2080
2099
|
onChange: (e) => {
|
|
2081
2100
|
let t = e.target.files?.[0];
|
|
2082
|
-
e.target.value = "", t &&
|
|
2101
|
+
e.target.value = "", t && re(t);
|
|
2083
2102
|
}
|
|
2084
2103
|
}),
|
|
2085
|
-
/* @__PURE__ */
|
|
2104
|
+
/* @__PURE__ */ D(rn, {
|
|
2086
2105
|
open: i,
|
|
2087
2106
|
title: e,
|
|
2088
|
-
fieldSchemas:
|
|
2107
|
+
fieldSchemas: M,
|
|
2089
2108
|
rows: u,
|
|
2090
2109
|
taskId: g,
|
|
2091
2110
|
includedKeys: w,
|
|
2092
2111
|
onChangeCell: (e, t, n) => {
|
|
2093
2112
|
if (!w.includes(t.key)) return;
|
|
2094
|
-
let r =
|
|
2113
|
+
let r = ye(t, n), i = V(r.trim() === "" ? null : r, t);
|
|
2095
2114
|
d((r) => r.map((r) => {
|
|
2096
2115
|
if (r.key !== e.key) return r;
|
|
2097
2116
|
let a = { ...r.errors };
|
|
@@ -2111,9 +2130,9 @@ var sn = ({ title: e, fieldSchemas: t, importRows: n, onImported: r }) => {
|
|
|
2111
2130
|
...e.values,
|
|
2112
2131
|
[t.key]: n
|
|
2113
2132
|
}, i = {};
|
|
2114
|
-
|
|
2133
|
+
M.forEach((e) => {
|
|
2115
2134
|
if (!w.includes(e.key)) return;
|
|
2116
|
-
let t =
|
|
2135
|
+
let t = ye(e, r[e.key]), n = V(t.trim() === "" ? null : t, e);
|
|
2117
2136
|
n.validateSuccess || (i[e.key] = n.validateMessage);
|
|
2118
2137
|
});
|
|
2119
2138
|
let a = {
|
|
@@ -2121,7 +2140,7 @@ var sn = ({ title: e, fieldSchemas: t, importRows: n, onImported: r }) => {
|
|
|
2121
2140
|
values: r,
|
|
2122
2141
|
errors: i
|
|
2123
2142
|
};
|
|
2124
|
-
d((t) => t.map((t) => t.key === e.key ? a : t)), g && e.taskIndex !== void 0 && (
|
|
2143
|
+
d((t) => t.map((t) => t.key === e.key ? a : t)), g && e.taskIndex !== void 0 && (Ct(g, e.taskIndex, t.key), xt(g, e.taskIndex, i), bt(g, e.taskIndex, a));
|
|
2125
2144
|
},
|
|
2126
2145
|
onDelete: (e) => {
|
|
2127
2146
|
d((t) => t.filter((t) => t.key !== e.key));
|
|
@@ -2129,11 +2148,11 @@ var sn = ({ title: e, fieldSchemas: t, importRows: n, onImported: r }) => {
|
|
|
2129
2148
|
onConfirm: () => {
|
|
2130
2149
|
let t = u;
|
|
2131
2150
|
if (t.length === 0) {
|
|
2132
|
-
|
|
2151
|
+
k.error("没有可导入的数据");
|
|
2133
2152
|
return;
|
|
2134
2153
|
}
|
|
2135
2154
|
if (t.every((e) => Object.keys(e.errors).length > 0)) {
|
|
2136
|
-
|
|
2155
|
+
k.error("所有行都有校验错误, 请先修正后再导入");
|
|
2137
2156
|
return;
|
|
2138
2157
|
}
|
|
2139
2158
|
let i = t.map((e, t) => ({
|
|
@@ -2141,18 +2160,18 @@ var sn = ({ title: e, fieldSchemas: t, importRows: n, onImported: r }) => {
|
|
|
2141
2160
|
taskIndex: t
|
|
2142
2161
|
}));
|
|
2143
2162
|
d(i);
|
|
2144
|
-
let a =
|
|
2163
|
+
let a = _t({
|
|
2145
2164
|
title: `${e}导入`,
|
|
2146
2165
|
rows: i,
|
|
2147
|
-
fieldSchemas:
|
|
2166
|
+
fieldSchemas: M,
|
|
2148
2167
|
includedKeys: w,
|
|
2149
2168
|
importRows: async (e, t) => {
|
|
2150
2169
|
try {
|
|
2151
|
-
let r = await n(e.map((e) =>
|
|
2170
|
+
let r = await n(e.map((e) => be(e, M, w)), t);
|
|
2152
2171
|
if (r.length !== e.length) throw new W("导入接口返回结果数量不正确, 任务已暂停");
|
|
2153
|
-
return r.map(
|
|
2172
|
+
return r.map(cn);
|
|
2154
2173
|
} catch (e) {
|
|
2155
|
-
throw t.aborted || e instanceof W ? e : We(e) === 422 ? Error(
|
|
2174
|
+
throw t.aborted || e instanceof W ? e : We(e) === 422 ? Error(dn(e)) : new W(un(e));
|
|
2156
2175
|
}
|
|
2157
2176
|
},
|
|
2158
2177
|
onFinished: r
|
|
@@ -2160,9 +2179,9 @@ var sn = ({ title: e, fieldSchemas: t, importRows: n, onImported: r }) => {
|
|
|
2160
2179
|
_(a);
|
|
2161
2180
|
},
|
|
2162
2181
|
onClose: () => {
|
|
2163
|
-
g &&
|
|
2182
|
+
g && Tt(g), l(!1), _(void 0), d([]), E([]);
|
|
2164
2183
|
}
|
|
2165
2184
|
}, v)
|
|
2166
2185
|
] });
|
|
2167
2186
|
};
|
|
2168
|
-
export {
|
|
2187
|
+
export { Ut as ExportButton, zt as ExportTaskModal, fn as ImportButton, W as ImportPauseError, H as MAX_EXPORT_ROWS, ge as MAX_IMPORT_FILE_SIZE, he as MAX_IMPORT_ROWS, F as MULTI_VALUE_SEPARATOR, Me as autoAdjustColumnWidths, ze as buildExportBlob, be as buildImportPayload, wt as cancelTask, Ct as clearImportRowFieldError, vt as continueTask, St as deleteImportRows, Tt as dismissTask, Ve as downloadImportTemplate, Dt as downloadTask, gt as enqueueExport, _t as enqueueImport, Be as exportExcel, Ht as exportRows, Vt as formatExportRowLimitMessage, Nt as formatTaskPercent, Pt as formatTaskRemainingSeconds, Mt as getTaskDisplayPercent, kt as getTaskRemainingSeconds, At as getTaskSuccessCount, tt as getTasksSnapshot, oe as importableFields, I as joinMultiValues, Bt as makeExportFileName, He as parseImportFile, yt as pauseTask, Ot as resetTasks, xt as setImportRowValidation, L as splitMultiValues, et as subscribeTasks, bt as updateImportRowData, Ft as useTaskDetail, ue as validateBooleanField, de as validateDateField, pe as validateDateTimeField, V as validateField, z as validateListField, B as validateMultipleChoiceField, le as validateNumberField, me as validateSingleChoiceField, R as validateTextField, fe as validateTimeField };
|