strapi-plugin-bulk-updater 1.3.3 → 1.3.6
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/_chunks/{BulkUpdater-C2lw4D0D.js → BulkUpdater-CXDs0Dws.js} +181 -142
- package/dist/_chunks/BulkUpdater-CXDs0Dws.js.map +1 -0
- package/dist/_chunks/{BulkUpdater-CgsqzdyX.mjs → BulkUpdater-D812YfOE.mjs} +182 -143
- package/dist/_chunks/BulkUpdater-D812YfOE.mjs.map +1 -0
- package/dist/admin/index.js +43 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +42 -2
- package/dist/admin/index.mjs.map +1 -1
- package/dist/server/index.js +405 -62
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +405 -62
- package/dist/server/index.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/_chunks/BulkUpdater-C2lw4D0D.js.map +0 -1
- package/dist/_chunks/BulkUpdater-CgsqzdyX.mjs.map +0 -1
|
@@ -1,9 +1,96 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React__default, { useState, useEffect, useMemo, useRef } from "react";
|
|
3
3
|
import { useFetchClient, useNotification } from "@strapi/strapi/admin";
|
|
4
|
-
import { Box, Flex, Typography, Button, SingleSelect, SingleSelectOption,
|
|
4
|
+
import { Box, Flex, Typography, Button, SingleSelect, SingleSelectOption, Badge, Checkbox, Alert, Table, Thead, Tr, Th, Tbody, Td, Loader, TextInput, ComboboxOption, Field, Combobox } from "@strapi/design-system";
|
|
5
5
|
import { ArrowClockwise, Download, Upload, Check, Eye, Play, Cog } from "@strapi/icons";
|
|
6
6
|
import { V as ValidationRulesTab } from "./ValidationRulesTab-Dt53h-Ke.mjs";
|
|
7
|
+
function parseCsvRows(csvText) {
|
|
8
|
+
if (!csvText) return [];
|
|
9
|
+
let text = csvText;
|
|
10
|
+
if (text.charCodeAt(0) === 65279) {
|
|
11
|
+
text = text.slice(1);
|
|
12
|
+
}
|
|
13
|
+
const rows = [];
|
|
14
|
+
let currentRow = [];
|
|
15
|
+
let currentCell = "";
|
|
16
|
+
let inQuotes = false;
|
|
17
|
+
let cellIsQuoted = false;
|
|
18
|
+
for (let i = 0; i < text.length; i++) {
|
|
19
|
+
const char = text[i];
|
|
20
|
+
const nextChar = text[i + 1];
|
|
21
|
+
if (inQuotes) {
|
|
22
|
+
if (char === '"') {
|
|
23
|
+
if (nextChar === '"') {
|
|
24
|
+
currentCell += '"';
|
|
25
|
+
i++;
|
|
26
|
+
} else {
|
|
27
|
+
inQuotes = false;
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
currentCell += char;
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
if (char === '"' && !cellIsQuoted && currentCell.trim() === "") {
|
|
34
|
+
inQuotes = true;
|
|
35
|
+
cellIsQuoted = true;
|
|
36
|
+
currentCell = "";
|
|
37
|
+
} else if (char === ",") {
|
|
38
|
+
currentRow.push(cellIsQuoted ? currentCell : currentCell.trim());
|
|
39
|
+
currentCell = "";
|
|
40
|
+
cellIsQuoted = false;
|
|
41
|
+
} else if (char === "\r") {
|
|
42
|
+
if (nextChar === "\n") {
|
|
43
|
+
i++;
|
|
44
|
+
}
|
|
45
|
+
currentRow.push(cellIsQuoted ? currentCell : currentCell.trim());
|
|
46
|
+
if (currentRow.length > 1 || currentRow.length === 1 && currentRow[0] !== "") {
|
|
47
|
+
rows.push(currentRow);
|
|
48
|
+
}
|
|
49
|
+
currentRow = [];
|
|
50
|
+
currentCell = "";
|
|
51
|
+
cellIsQuoted = false;
|
|
52
|
+
} else if (char === "\n") {
|
|
53
|
+
currentRow.push(cellIsQuoted ? currentCell : currentCell.trim());
|
|
54
|
+
if (currentRow.length > 1 || currentRow.length === 1 && currentRow[0] !== "") {
|
|
55
|
+
rows.push(currentRow);
|
|
56
|
+
}
|
|
57
|
+
currentRow = [];
|
|
58
|
+
currentCell = "";
|
|
59
|
+
cellIsQuoted = false;
|
|
60
|
+
} else {
|
|
61
|
+
if (!(cellIsQuoted && !inQuotes && (char === " " || char === " "))) {
|
|
62
|
+
currentCell += char;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (currentCell !== "" || cellIsQuoted || currentRow.length > 0) {
|
|
68
|
+
currentRow.push(cellIsQuoted ? currentCell : currentCell.trim());
|
|
69
|
+
if (currentRow.length > 1 || currentRow.length === 1 && currentRow[0] !== "") {
|
|
70
|
+
rows.push(currentRow);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return rows;
|
|
74
|
+
}
|
|
75
|
+
function parseCsv(csvText) {
|
|
76
|
+
const rows = parseCsvRows(csvText);
|
|
77
|
+
if (rows.length < 2) return [];
|
|
78
|
+
const headers = rows[0].map((h) => h.trim());
|
|
79
|
+
const records = [];
|
|
80
|
+
for (let i = 1; i < rows.length; i++) {
|
|
81
|
+
const row = rows[i];
|
|
82
|
+
const record = {};
|
|
83
|
+
headers.forEach((h, idx) => {
|
|
84
|
+
let val = row[idx] !== void 0 ? row[idx] : "";
|
|
85
|
+
if (typeof val === "string" && /^'[=+@-]/.test(val)) {
|
|
86
|
+
val = val.substring(1);
|
|
87
|
+
}
|
|
88
|
+
record[h] = val;
|
|
89
|
+
});
|
|
90
|
+
records.push(record);
|
|
91
|
+
}
|
|
92
|
+
return records;
|
|
93
|
+
}
|
|
7
94
|
function CsvManagerTab() {
|
|
8
95
|
const { get, post } = useFetchClient();
|
|
9
96
|
const { toggleNotification } = useNotification();
|
|
@@ -135,20 +222,8 @@ function CsvManagerTab() {
|
|
|
135
222
|
const text = event.target?.result;
|
|
136
223
|
setCsvRawText(text);
|
|
137
224
|
try {
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
const headers = lines[0].split(",").map((h) => h.replace(/^"|"$/g, "").trim());
|
|
141
|
-
const previewRows = [];
|
|
142
|
-
for (let i = 1; i < Math.min(lines.length, 6); i++) {
|
|
143
|
-
const vals = lines[i].split(",").map((v) => v.replace(/^"|"$/g, "").trim());
|
|
144
|
-
const row = {};
|
|
145
|
-
headers.forEach((h, idx) => {
|
|
146
|
-
row[h] = vals[idx] || "";
|
|
147
|
-
});
|
|
148
|
-
previewRows.push(row);
|
|
149
|
-
}
|
|
150
|
-
setParsedPreview(previewRows);
|
|
151
|
-
}
|
|
225
|
+
const records = parseCsv(text);
|
|
226
|
+
setParsedPreview(records.slice(0, 10));
|
|
152
227
|
} catch (err) {
|
|
153
228
|
setParsedPreview([]);
|
|
154
229
|
}
|
|
@@ -278,53 +353,20 @@ function CsvManagerTab() {
|
|
|
278
353
|
/* @__PURE__ */ jsxs(Box, { padding: 5, background: "neutral100", hasRadius: true, children: [
|
|
279
354
|
/* @__PURE__ */ jsx(Typography, { variant: "delta", tag: "h3", fontWeight: "bold", marginBottom: 2, children: "2. Import & Batch Override CSV" }),
|
|
280
355
|
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", marginBottom: 4, children: "Upload an updated CSV file to bulk update existing records or insert new records." }),
|
|
281
|
-
/* @__PURE__ */ jsxs(Flex, {
|
|
356
|
+
/* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", marginBottom: 4, wrap: "wrap", gap: 4, children: [
|
|
282
357
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
283
|
-
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", marginBottom:
|
|
284
|
-
/* @__PURE__ */ jsxs(Flex, { gap:
|
|
285
|
-
/* @__PURE__ */
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
name: "importMode",
|
|
291
|
-
value: "auto",
|
|
292
|
-
checked: importMode === "auto",
|
|
293
|
-
onChange: () => setImportMode("auto")
|
|
294
|
-
}
|
|
295
|
-
),
|
|
296
|
-
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: importMode === "auto" ? "bold" : "normal", children: "Smart Auto-Detect (Auto-updates matching documentId, creates new if missing)" })
|
|
297
|
-
] }),
|
|
298
|
-
/* @__PURE__ */ jsxs("label", { style: { display: "flex", alignItems: "center", gap: 6, cursor: "pointer" }, children: [
|
|
299
|
-
/* @__PURE__ */ jsx(
|
|
300
|
-
"input",
|
|
301
|
-
{
|
|
302
|
-
type: "radio",
|
|
303
|
-
name: "importMode",
|
|
304
|
-
value: "update",
|
|
305
|
-
checked: importMode === "update",
|
|
306
|
-
onChange: () => setImportMode("update")
|
|
307
|
-
}
|
|
308
|
-
),
|
|
309
|
-
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: importMode === "update" ? "bold" : "normal", children: "Update Existing Only (Requires documentId)" })
|
|
310
|
-
] }),
|
|
311
|
-
/* @__PURE__ */ jsxs("label", { style: { display: "flex", alignItems: "center", gap: 6, cursor: "pointer" }, children: [
|
|
312
|
-
/* @__PURE__ */ jsx(
|
|
313
|
-
"input",
|
|
314
|
-
{
|
|
315
|
-
type: "radio",
|
|
316
|
-
name: "importMode",
|
|
317
|
-
value: "create_or_override",
|
|
318
|
-
checked: importMode === "create_or_override",
|
|
319
|
-
onChange: () => setImportMode("create_or_override")
|
|
320
|
-
}
|
|
321
|
-
),
|
|
322
|
-
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: importMode === "create_or_override" ? "bold" : "normal", children: "Add / Override (Inserts new or replaces existing)" })
|
|
358
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", marginBottom: 1, display: "block", children: "Operation Mode" }),
|
|
359
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", wrap: "wrap", children: [
|
|
360
|
+
/* @__PURE__ */ jsx(Badge, { backgroundColor: "primary100", textColor: "primary700", children: "⚡ Smart Auto-Detect" }),
|
|
361
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "pi", textColor: "neutral600", children: [
|
|
362
|
+
"Automatically updates matching records by ",
|
|
363
|
+
/* @__PURE__ */ jsx("code", { children: "documentId" }),
|
|
364
|
+
" and creates new entries when ID is omitted."
|
|
323
365
|
] })
|
|
324
366
|
] })
|
|
325
367
|
] }),
|
|
326
|
-
/* @__PURE__ */ jsxs(Box, {
|
|
327
|
-
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", marginBottom:
|
|
368
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
369
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", marginBottom: 1, display: "block", children: "Publish Options" }),
|
|
328
370
|
/* @__PURE__ */ jsx(
|
|
329
371
|
Checkbox,
|
|
330
372
|
{
|
|
@@ -392,8 +434,8 @@ function CsvManagerTab() {
|
|
|
392
434
|
missingDocIdCount > 0 && /* @__PURE__ */ jsx(Box, { marginBottom: 3, children: /* @__PURE__ */ jsx(
|
|
393
435
|
Alert,
|
|
394
436
|
{
|
|
395
|
-
variant:
|
|
396
|
-
title:
|
|
437
|
+
variant: "default",
|
|
438
|
+
title: "Smart Auto-Detect Active",
|
|
397
439
|
children: /* @__PURE__ */ jsxs(Typography, { variant: "omega", children: [
|
|
398
440
|
missingDocIdCount,
|
|
399
441
|
" row",
|
|
@@ -402,23 +444,40 @@ function CsvManagerTab() {
|
|
|
402
444
|
/* @__PURE__ */ jsx("code", { children: "documentId" }),
|
|
403
445
|
".",
|
|
404
446
|
" ",
|
|
405
|
-
|
|
447
|
+
"Because no documentId is provided, the engine will automatically treat them as new entries and generate new database IDs for them."
|
|
406
448
|
] })
|
|
407
449
|
}
|
|
408
450
|
) }),
|
|
409
|
-
/* @__PURE__ */ jsxs(Table, { colCount: headers.length + 1, rowCount: parsedPreview.length + 1, children: [
|
|
451
|
+
/* @__PURE__ */ jsx(Box, { style: { overflowX: "auto", maxWidth: "100%", border: "1px solid #e0e0e0", borderRadius: 4 }, children: /* @__PURE__ */ jsxs(Table, { colCount: headers.length + 1, rowCount: parsedPreview.length + 1, children: [
|
|
410
452
|
/* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
|
|
411
|
-
/* @__PURE__ */ jsx(Th, { style: { width:
|
|
412
|
-
headers.map((h) => /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: h }) }, h))
|
|
453
|
+
/* @__PURE__ */ jsx(Th, { style: { width: 150, minWidth: 150 }, children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Detected Action" }) }),
|
|
454
|
+
headers.map((h) => /* @__PURE__ */ jsx(Th, { style: { minWidth: 160 }, children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: h }) }, h))
|
|
413
455
|
] }) }),
|
|
414
456
|
/* @__PURE__ */ jsx(Tbody, { children: parsedPreview.map((row, rIdx) => {
|
|
415
457
|
const hasDocId = !!(row.documentId || row.id || "").trim();
|
|
416
458
|
return /* @__PURE__ */ jsxs(Tr, { children: [
|
|
417
459
|
/* @__PURE__ */ jsx(Td, { children: hasDocId ? /* @__PURE__ */ jsx(Badge, { backgroundColor: "primary100", textColor: "primary700", children: "🔄 Match / Update" }) : /* @__PURE__ */ jsx(Badge, { backgroundColor: "warning100", textColor: "warning700", children: "➕ New Entry" }) }),
|
|
418
|
-
headers.map((h) => /* @__PURE__ */ jsx(Td, { children: (h === "documentId" || h === "id") && !row[h]?.trim() ? /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "warning700", fontWeight: "bold", children: "(Auto-generate ID)" }) : /* @__PURE__ */ jsx(
|
|
460
|
+
headers.map((h) => /* @__PURE__ */ jsx(Td, { style: { verticalAlign: "top", maxWidth: 300 }, children: (h === "documentId" || h === "id") && !row[h]?.trim() ? /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "warning700", fontWeight: "bold", children: "(Auto-generate ID)" }) : /* @__PURE__ */ jsx(
|
|
461
|
+
Typography,
|
|
462
|
+
{
|
|
463
|
+
variant: "omega",
|
|
464
|
+
style: {
|
|
465
|
+
display: "-webkit-box",
|
|
466
|
+
WebkitLineClamp: 3,
|
|
467
|
+
WebkitBoxOrient: "vertical",
|
|
468
|
+
overflow: "hidden",
|
|
469
|
+
textOverflow: "ellipsis",
|
|
470
|
+
whiteSpace: "pre-wrap",
|
|
471
|
+
wordBreak: "break-word",
|
|
472
|
+
maxHeight: 65
|
|
473
|
+
},
|
|
474
|
+
title: row[h] || "",
|
|
475
|
+
children: row[h] || "-"
|
|
476
|
+
}
|
|
477
|
+
) }, h))
|
|
419
478
|
] }, rIdx);
|
|
420
479
|
}) })
|
|
421
|
-
] }),
|
|
480
|
+
] }) }),
|
|
422
481
|
/* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", marginTop: 4, children: /* @__PURE__ */ jsx(
|
|
423
482
|
Button,
|
|
424
483
|
{
|
|
@@ -427,7 +486,7 @@ function CsvManagerTab() {
|
|
|
427
486
|
startIcon: /* @__PURE__ */ jsx(Check, {}),
|
|
428
487
|
onClick: handleExecuteImport,
|
|
429
488
|
loading: importing,
|
|
430
|
-
children:
|
|
489
|
+
children: "Execute Smart Import (Auto-Detect)"
|
|
431
490
|
}
|
|
432
491
|
) })
|
|
433
492
|
] });
|
|
@@ -3128,42 +3187,19 @@ const BulkUpdater = () => {
|
|
|
3128
3187
|
] })
|
|
3129
3188
|
}
|
|
3130
3189
|
) : activeTab === "editor" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3131
|
-
/* @__PURE__ */
|
|
3190
|
+
/* @__PURE__ */ jsx(
|
|
3132
3191
|
Box,
|
|
3133
3192
|
{
|
|
3134
|
-
padding:
|
|
3193
|
+
padding: 4,
|
|
3135
3194
|
background: "neutral0",
|
|
3136
3195
|
shadow: "filterShadow",
|
|
3137
3196
|
hasRadius: true,
|
|
3138
|
-
marginBottom:
|
|
3197
|
+
marginBottom: 5,
|
|
3139
3198
|
style: { width: "100%", maxWidth: "100%", minWidth: 0, boxSizing: "border-box" },
|
|
3140
|
-
children: [
|
|
3141
|
-
/* @__PURE__ */ jsxs(Flex, {
|
|
3142
|
-
/* @__PURE__ */
|
|
3143
|
-
/* @__PURE__ */ jsx(
|
|
3144
|
-
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: "Select the target attribute to update across collections." })
|
|
3145
|
-
] }),
|
|
3146
|
-
/* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", wrap: "wrap", children: [
|
|
3147
|
-
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral700", fontWeight: "bold", children: "Component Nesting Depth:" }),
|
|
3148
|
-
[1, 2, 3, 4, 5].map((lvl) => /* @__PURE__ */ jsxs(
|
|
3149
|
-
Button,
|
|
3150
|
-
{
|
|
3151
|
-
variant: componentDepth === lvl ? "default" : "tertiary",
|
|
3152
|
-
size: "S",
|
|
3153
|
-
onClick: () => handleComponentDepthChange(lvl),
|
|
3154
|
-
title: `Discover nested component attributes up to Level ${lvl}`,
|
|
3155
|
-
children: [
|
|
3156
|
-
"Level ",
|
|
3157
|
-
lvl
|
|
3158
|
-
]
|
|
3159
|
-
},
|
|
3160
|
-
`depth_cfg_${lvl}`
|
|
3161
|
-
))
|
|
3162
|
-
] })
|
|
3163
|
-
] }),
|
|
3164
|
-
/* @__PURE__ */ jsxs(Flex, { gap: 3, alignItems: "flex-end", wrap: "wrap", children: [
|
|
3165
|
-
/* @__PURE__ */ jsx(Box, { style: { width: 280, minWidth: 230 }, children: /* @__PURE__ */ jsxs(Field.Root, { children: [
|
|
3166
|
-
/* @__PURE__ */ jsx(Field.Label, { children: "Collection Type" }),
|
|
3199
|
+
children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", wrap: "wrap", gap: 3, children: [
|
|
3200
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 3, alignItems: "center", wrap: "wrap", style: { flex: 1, minWidth: 280 }, children: [
|
|
3201
|
+
/* @__PURE__ */ jsx(Box, { style: { width: 340, minWidth: 260 }, children: /* @__PURE__ */ jsxs(Field.Root, { children: [
|
|
3202
|
+
/* @__PURE__ */ jsx(Field.Label, { children: "Target Collection Type" }),
|
|
3167
3203
|
/* @__PURE__ */ jsx(
|
|
3168
3204
|
Combobox,
|
|
3169
3205
|
{
|
|
@@ -3177,12 +3213,52 @@ const BulkUpdater = () => {
|
|
|
3177
3213
|
},
|
|
3178
3214
|
children: collections.map((col) => /* @__PURE__ */ jsx(ComboboxOption, { value: col.uid, textValue: `${col.displayName} (${col.uid})`, children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", style: { width: "100%" }, children: [
|
|
3179
3215
|
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", children: col.displayName }),
|
|
3180
|
-
/* @__PURE__ */ jsx(Flex, { gap: 1, alignItems: "center", children: col.isSingleType ? /* @__PURE__ */ jsx(Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: "Single" }) : /* @__PURE__ */ jsx(Badge, { backgroundColor: "neutral150", textColor: "neutral700", size: "S", children: col.totalEntries !== void 0 ? `${col.totalEntries}` : "" }) })
|
|
3216
|
+
/* @__PURE__ */ jsx(Flex, { gap: 1, alignItems: "center", children: col.isSingleType ? /* @__PURE__ */ jsx(Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: "Single" }) : /* @__PURE__ */ jsx(Badge, { backgroundColor: "neutral150", textColor: "neutral700", size: "S", children: col.totalEntries !== void 0 ? `${col.totalEntries} entries` : "" }) })
|
|
3181
3217
|
] }) }, col.uid))
|
|
3182
3218
|
},
|
|
3183
|
-
`
|
|
3219
|
+
`top-col-${selectedCollectionUid}`
|
|
3184
3220
|
)
|
|
3185
3221
|
] }) }),
|
|
3222
|
+
selectedCol && /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", wrap: "wrap", style: { paddingTop: 20 }, children: [
|
|
3223
|
+
/* @__PURE__ */ jsx(Badge, { backgroundColor: "primary100", textColor: "primary700", children: selectedCol.isSingleType ? "SINGLE TYPE" : "COLLECTION" }),
|
|
3224
|
+
/* @__PURE__ */ jsx(Badge, { backgroundColor: "neutral150", textColor: "neutral700", children: selectedCol.isSingleType ? "1 single entry" : `${collectionPages[selectedCol.uid]?.total ?? selectedCol.totalEntries ?? selectedCol.entries?.length ?? 0} records` })
|
|
3225
|
+
] })
|
|
3226
|
+
] }),
|
|
3227
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", wrap: "wrap", children: [
|
|
3228
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral700", fontWeight: "bold", children: "Component Nesting Depth:" }),
|
|
3229
|
+
[1, 2, 3, 4, 5].map((lvl) => /* @__PURE__ */ jsxs(
|
|
3230
|
+
Button,
|
|
3231
|
+
{
|
|
3232
|
+
variant: componentDepth === lvl ? "default" : "tertiary",
|
|
3233
|
+
size: "S",
|
|
3234
|
+
onClick: () => handleComponentDepthChange(lvl),
|
|
3235
|
+
title: `Discover nested component attributes up to Level ${lvl}`,
|
|
3236
|
+
children: [
|
|
3237
|
+
"Level ",
|
|
3238
|
+
lvl
|
|
3239
|
+
]
|
|
3240
|
+
},
|
|
3241
|
+
`depth_cfg_${lvl}`
|
|
3242
|
+
))
|
|
3243
|
+
] })
|
|
3244
|
+
] })
|
|
3245
|
+
}
|
|
3246
|
+
),
|
|
3247
|
+
/* @__PURE__ */ jsxs(
|
|
3248
|
+
Box,
|
|
3249
|
+
{
|
|
3250
|
+
padding: 6,
|
|
3251
|
+
background: "neutral0",
|
|
3252
|
+
shadow: "filterShadow",
|
|
3253
|
+
hasRadius: true,
|
|
3254
|
+
marginBottom: 6,
|
|
3255
|
+
style: { width: "100%", maxWidth: "100%", minWidth: 0, boxSizing: "border-box" },
|
|
3256
|
+
children: [
|
|
3257
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "space-between", alignItems: "center", marginBottom: 4, wrap: "wrap", gap: 3, children: /* @__PURE__ */ jsxs(Box, { children: [
|
|
3258
|
+
/* @__PURE__ */ jsx(Typography, { variant: "delta", tag: "h2", fontWeight: "semiBold", children: "1. Configure Attribute Update" }),
|
|
3259
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: "Select the target attribute to update and configure the replacement value." })
|
|
3260
|
+
] }) }),
|
|
3261
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 3, alignItems: "flex-end", wrap: "wrap", children: [
|
|
3186
3262
|
/* @__PURE__ */ jsx(Box, { style: { width: 280, minWidth: 230 }, children: /* @__PURE__ */ jsxs(Field.Root, { children: [
|
|
3187
3263
|
/* @__PURE__ */ jsx(Field.Label, { children: "Attribute to Update" }),
|
|
3188
3264
|
/* @__PURE__ */ jsx(
|
|
@@ -3417,7 +3493,11 @@ const BulkUpdater = () => {
|
|
|
3417
3493
|
/* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", marginBottom: 4, wrap: "wrap", gap: 3, children: [
|
|
3418
3494
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
3419
3495
|
/* @__PURE__ */ jsx(Typography, { variant: "delta", tag: "h2", fontWeight: "semiBold", children: "2. Select Targets" }),
|
|
3420
|
-
/* @__PURE__ */
|
|
3496
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "pi", textColor: "neutral600", children: [
|
|
3497
|
+
"Search and select entries to apply the update to within ",
|
|
3498
|
+
selectedCol ? selectedCol.displayName : "the selected collection",
|
|
3499
|
+
"."
|
|
3500
|
+
] })
|
|
3421
3501
|
] }),
|
|
3422
3502
|
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
3423
3503
|
/* @__PURE__ */ jsx(Button, { variant: "secondary", size: "S", onClick: selectAll, children: "Select All" }),
|
|
@@ -3449,50 +3529,9 @@ const BulkUpdater = () => {
|
|
|
3449
3529
|
selectedAttribute
|
|
3450
3530
|
] })
|
|
3451
3531
|
] }),
|
|
3452
|
-
/* @__PURE__ */
|
|
3453
|
-
/* @__PURE__ */ jsxs(Flex, { gap: 1, alignItems: "center", children: [
|
|
3454
|
-
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: "Depth:" }),
|
|
3455
|
-
[1, 2, 3, 4, 5].map((lvl) => /* @__PURE__ */ jsxs(
|
|
3456
|
-
Button,
|
|
3457
|
-
{
|
|
3458
|
-
variant: componentDepth === lvl ? "default" : "tertiary",
|
|
3459
|
-
size: "S",
|
|
3460
|
-
onClick: () => handleComponentDepthChange(lvl),
|
|
3461
|
-
title: `Show component attributes up to Level ${lvl}`,
|
|
3462
|
-
style: { minWidth: 26, padding: "2px 6px" },
|
|
3463
|
-
children: [
|
|
3464
|
-
"L",
|
|
3465
|
-
lvl
|
|
3466
|
-
]
|
|
3467
|
-
},
|
|
3468
|
-
`s2_depth_${lvl}`
|
|
3469
|
-
))
|
|
3470
|
-
] }),
|
|
3471
|
-
isFilterActive && /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "S", onClick: clearFilter, children: "Clear Search & Filter" })
|
|
3472
|
-
] })
|
|
3532
|
+
isFilterActive && /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "S", onClick: clearFilter, children: "Clear Search & Filter" })
|
|
3473
3533
|
] }),
|
|
3474
3534
|
/* @__PURE__ */ jsxs(Flex, { gap: 3, alignItems: "flex-end", wrap: "wrap", children: [
|
|
3475
|
-
/* @__PURE__ */ jsx(Box, { style: { width: 260, minWidth: 200 }, children: /* @__PURE__ */ jsxs(Field.Root, { children: [
|
|
3476
|
-
/* @__PURE__ */ jsx(Field.Label, { children: "Collection Type" }),
|
|
3477
|
-
/* @__PURE__ */ jsx(
|
|
3478
|
-
Combobox,
|
|
3479
|
-
{
|
|
3480
|
-
autocomplete: "none",
|
|
3481
|
-
placeholder: "Select Collection Type...",
|
|
3482
|
-
value: selectedCollectionUid || void 0,
|
|
3483
|
-
onChange: (val) => {
|
|
3484
|
-
if (val && typeof val === "string") {
|
|
3485
|
-
handleCollectionChange(val);
|
|
3486
|
-
}
|
|
3487
|
-
},
|
|
3488
|
-
children: collections.map((col) => /* @__PURE__ */ jsx(ComboboxOption, { value: col.uid, textValue: `${col.displayName} (${col.uid})`, children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", style: { width: "100%" }, children: [
|
|
3489
|
-
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", children: col.displayName }),
|
|
3490
|
-
col.isSingleType ? /* @__PURE__ */ jsx(Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: "Single" }) : null
|
|
3491
|
-
] }) }, col.uid))
|
|
3492
|
-
},
|
|
3493
|
-
`search-col-${selectedCollectionUid}`
|
|
3494
|
-
)
|
|
3495
|
-
] }) }),
|
|
3496
3535
|
/* @__PURE__ */ jsx(Box, { style: { width: 280, minWidth: 230 }, children: /* @__PURE__ */ jsxs(Field.Root, { children: [
|
|
3497
3536
|
/* @__PURE__ */ jsx(Field.Label, { children: "Search Attribute" }),
|
|
3498
3537
|
/* @__PURE__ */ jsx(
|
|
@@ -4933,4 +4972,4 @@ export {
|
|
|
4933
4972
|
getAvailableColumnsForCollection,
|
|
4934
4973
|
getNestedValue
|
|
4935
4974
|
};
|
|
4936
|
-
//# sourceMappingURL=BulkUpdater-
|
|
4975
|
+
//# sourceMappingURL=BulkUpdater-D812YfOE.mjs.map
|