strapi-plugin-bulk-updater 1.6.1 → 1.6.3
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-xj4wH_iI.mjs → BulkUpdater-B7XefFd9.mjs} +282 -129
- package/dist/_chunks/BulkUpdater-B7XefFd9.mjs.map +1 -0
- package/dist/_chunks/{BulkUpdater-DTJLdJJy.js → BulkUpdater-DbCzwAQ7.js} +281 -128
- package/dist/_chunks/BulkUpdater-DbCzwAQ7.js.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +1288 -575
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +1288 -575
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/_chunks/BulkUpdater-DTJLdJJy.js.map +0 -1
- package/dist/_chunks/BulkUpdater-xj4wH_iI.mjs.map +0 -1
|
@@ -415,11 +415,14 @@ function buildEntriesQueryParams(options) {
|
|
|
415
415
|
return params;
|
|
416
416
|
}
|
|
417
417
|
function buildCsvExportQueryParams(options) {
|
|
418
|
-
const { limit, filter } = options;
|
|
418
|
+
const { limit, filter, exportMode } = options;
|
|
419
419
|
const queryParams = new URLSearchParams();
|
|
420
420
|
if (limit && limit > 0) {
|
|
421
421
|
queryParams.set("limit", String(limit));
|
|
422
422
|
}
|
|
423
|
+
if (exportMode) {
|
|
424
|
+
queryParams.set("exportMode", exportMode);
|
|
425
|
+
}
|
|
423
426
|
if (filter.searchAttribute) {
|
|
424
427
|
queryParams.set("searchAttribute", filter.searchAttribute);
|
|
425
428
|
}
|
|
@@ -463,6 +466,7 @@ function CsvManagerTab() {
|
|
|
463
466
|
const hasPendingFilterChanges = !areSearchFiltersEqual(draftFilter, appliedFilter);
|
|
464
467
|
const [searchRelationOptions, setSearchRelationOptions] = React.useState([]);
|
|
465
468
|
const [searchRelationOptionsLoading, setSearchRelationOptionsLoading] = React.useState(false);
|
|
469
|
+
const [exportMode, setExportMode] = React.useState("all");
|
|
466
470
|
const [exportLimit, setExportLimit] = React.useState(0);
|
|
467
471
|
const [exportLimitInput, setExportLimitInput] = React.useState("");
|
|
468
472
|
const [exportingCollection, setExportingCollection] = React.useState(false);
|
|
@@ -736,7 +740,8 @@ function CsvManagerTab() {
|
|
|
736
740
|
setExportingCollection(true);
|
|
737
741
|
const queryParams = buildCsvExportQueryParams({
|
|
738
742
|
limit: exportLimit,
|
|
739
|
-
filter: appliedFilterRef.current
|
|
743
|
+
filter: appliedFilterRef.current,
|
|
744
|
+
exportMode
|
|
740
745
|
});
|
|
741
746
|
const res = await get(`/bulk-updater/csv/export/${selectedUid}?${queryParams.toString()}`);
|
|
742
747
|
const csvStr = res.data?.csvContent || (typeof res.data === "string" ? res.data : "");
|
|
@@ -1380,6 +1385,22 @@ function CsvManagerTab() {
|
|
|
1380
1385
|
);
|
|
1381
1386
|
}) })
|
|
1382
1387
|
] }),
|
|
1388
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { width: 220 }, children: [
|
|
1389
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", marginBottom: 1, display: "block", children: "Object Export Mode" }),
|
|
1390
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1391
|
+
designSystem.SingleSelect,
|
|
1392
|
+
{
|
|
1393
|
+
value: exportMode,
|
|
1394
|
+
onChange: (val) => setExportMode(val === "metafields" || val === "topbarconfig" ? val : "all"),
|
|
1395
|
+
disabled: exportingCollection,
|
|
1396
|
+
children: [
|
|
1397
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "all", children: "All" }),
|
|
1398
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "metafields", children: "Metafields" }),
|
|
1399
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "topbarconfig", children: "Topbarconfig" })
|
|
1400
|
+
]
|
|
1401
|
+
}
|
|
1402
|
+
)
|
|
1403
|
+
] }),
|
|
1383
1404
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1384
1405
|
designSystem.Button,
|
|
1385
1406
|
{
|
|
@@ -1416,7 +1437,8 @@ function CsvManagerTab() {
|
|
|
1416
1437
|
}
|
|
1417
1438
|
)
|
|
1418
1439
|
] })
|
|
1419
|
-
] })
|
|
1440
|
+
] }),
|
|
1441
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 3, children: exportMode === "all" ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { closeLabel: "Close", variant: "warning", title: "Data Migration Export Mode", children: "All exports the complete collection data and is intended for data migration. Do not use this mode for routine updates. For targeted updates, select Metafields or Topbarconfig." }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 3, background: "primary100", hasRadius: true, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "primary700", children: exportMode === "metafields" ? "Exports metafields as individual first-level columns for targeted updates. Other fields retain their existing structure." : "Exports topbarconfig as individual first-level columns for targeted updates. Other fields retain their existing structure." }) }) })
|
|
1420
1442
|
] }),
|
|
1421
1443
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 5, background: "neutral100", hasRadius: true, children: [
|
|
1422
1444
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", tag: "h3", fontWeight: "bold", marginBottom: 2, children: "2. Import & Batch Override CSV" }),
|
|
@@ -1486,7 +1508,21 @@ function CsvManagerTab() {
|
|
|
1486
1508
|
const totalRows = allParsedRecords.length;
|
|
1487
1509
|
const missingDocIdCount = allParsedRecords.filter((row) => !extractDocId(row)).length;
|
|
1488
1510
|
const updateCount = totalRows - missingDocIdCount;
|
|
1489
|
-
const headers = Object.keys(allParsedRecords[0])
|
|
1511
|
+
const headers = Object.keys(allParsedRecords[0]).filter(
|
|
1512
|
+
(h) => h !== "__bulk_updater_metadata" && h !== "_bulk_updater_metadata"
|
|
1513
|
+
);
|
|
1514
|
+
let detectedPreviewMode = "legacy";
|
|
1515
|
+
try {
|
|
1516
|
+
const rawMetaCell = allParsedRecords[0]["__bulk_updater_metadata"] || allParsedRecords[0]["_bulk_updater_metadata"];
|
|
1517
|
+
if (rawMetaCell) {
|
|
1518
|
+
const parsedMeta = typeof rawMetaCell === "string" ? JSON.parse(rawMetaCell) : rawMetaCell;
|
|
1519
|
+
if (parsedMeta?.exportMode) {
|
|
1520
|
+
detectedPreviewMode = String(parsedMeta.exportMode);
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
} catch {
|
|
1524
|
+
}
|
|
1525
|
+
const modeDisplayLabel = detectedPreviewMode === "metafields" ? "Metafields (1-Level Targeted)" : detectedPreviewMode === "topbarconfig" ? "Topbarconfig (1-Level Targeted)" : detectedPreviewMode === "all" ? "All (Full Migration Export)" : "Legacy";
|
|
1490
1526
|
const totalPages = Math.ceil(totalRows / previewPageSize) || 1;
|
|
1491
1527
|
const safePage = Math.min(Math.max(1, previewPage), totalPages);
|
|
1492
1528
|
const startIndex = (safePage - 1) * previewPageSize;
|
|
@@ -1511,7 +1547,11 @@ function CsvManagerTab() {
|
|
|
1511
1547
|
missingDocIdCount > 0 ? `${missingDocIdCount.toLocaleString()} new entries (missing documentId)` : ""
|
|
1512
1548
|
] })
|
|
1513
1549
|
] }),
|
|
1514
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
1550
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", children: [
|
|
1551
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "neutral150", textColor: "neutral700", children: [
|
|
1552
|
+
"Mode: ",
|
|
1553
|
+
modeDisplayLabel
|
|
1554
|
+
] }),
|
|
1515
1555
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "primary100", textColor: "primary700", children: [
|
|
1516
1556
|
"🔄 ",
|
|
1517
1557
|
updateCount.toLocaleString(),
|
|
@@ -4164,6 +4204,144 @@ function serializeGridTargets(gridEdits, selectedEntries, collectionPages = {},
|
|
|
4164
4204
|
}
|
|
4165
4205
|
return { targets, totalEditCount, hasValidationErrors };
|
|
4166
4206
|
}
|
|
4207
|
+
function parseDynamicZonePath(path) {
|
|
4208
|
+
if (!path) return { cleanPath: "", rootKey: "", subPath: "" };
|
|
4209
|
+
const bracketMatch = path.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
|
|
4210
|
+
if (bracketMatch) {
|
|
4211
|
+
const rootKey = bracketMatch[1];
|
|
4212
|
+
const selector = bracketMatch[2];
|
|
4213
|
+
const subPath = bracketMatch[3];
|
|
4214
|
+
const cleanPath = `${rootKey}.${subPath}`;
|
|
4215
|
+
if (/^\d+$/.test(selector)) {
|
|
4216
|
+
return { cleanPath, rootKey, subPath, targetIndex: parseInt(selector, 10) };
|
|
4217
|
+
}
|
|
4218
|
+
return { cleanPath, rootKey, subPath, targetComponentUid: selector };
|
|
4219
|
+
}
|
|
4220
|
+
const parts = path.split(".");
|
|
4221
|
+
return {
|
|
4222
|
+
cleanPath: path,
|
|
4223
|
+
rootKey: parts[0] || "",
|
|
4224
|
+
subPath: parts.slice(1).join(".")
|
|
4225
|
+
};
|
|
4226
|
+
}
|
|
4227
|
+
function formatComponentName(compUid) {
|
|
4228
|
+
if (!compUid) return "Component";
|
|
4229
|
+
const name = compUid.includes(".") ? compUid.split(".")[1] : compUid;
|
|
4230
|
+
return name.split(/[-_]/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
4231
|
+
}
|
|
4232
|
+
function getPropertyValue(target, key) {
|
|
4233
|
+
if (!target || typeof target !== "object" || !key) return void 0;
|
|
4234
|
+
if (target[key] !== void 0 && target[key] !== null) return target[key];
|
|
4235
|
+
const camelKey = key.replace(/_([a-z0-9])/g, (_, letter) => letter.toUpperCase());
|
|
4236
|
+
if (target[camelKey] !== void 0 && target[camelKey] !== null) return target[camelKey];
|
|
4237
|
+
const snakeKey = key.replace(/([A-Z])/g, "_$1").toLowerCase();
|
|
4238
|
+
if (target[snakeKey] !== void 0 && target[snakeKey] !== null) return target[snakeKey];
|
|
4239
|
+
const lowerKey = key.toLowerCase();
|
|
4240
|
+
const lowerNoUnderscore = lowerKey.replace(/_/g, "");
|
|
4241
|
+
const matchedKey = Object.keys(target).find((k) => {
|
|
4242
|
+
const kLower = k.toLowerCase();
|
|
4243
|
+
return kLower === lowerKey || kLower.replace(/_/g, "") === lowerNoUnderscore;
|
|
4244
|
+
});
|
|
4245
|
+
if (matchedKey && target[matchedKey] !== void 0 && target[matchedKey] !== null) {
|
|
4246
|
+
return target[matchedKey];
|
|
4247
|
+
}
|
|
4248
|
+
if (key in target) return target[key];
|
|
4249
|
+
if (camelKey in target) return target[camelKey];
|
|
4250
|
+
if (snakeKey in target) return target[snakeKey];
|
|
4251
|
+
return void 0;
|
|
4252
|
+
}
|
|
4253
|
+
function getNestedValue(obj, path) {
|
|
4254
|
+
if (!obj || !path) return void 0;
|
|
4255
|
+
const parsed = parseDynamicZonePath(path);
|
|
4256
|
+
const parts = parsed.cleanPath.split(".");
|
|
4257
|
+
function extract(current, remainingParts) {
|
|
4258
|
+
if (current === void 0 || current === null) return void 0;
|
|
4259
|
+
if (remainingParts.length === 0) return current;
|
|
4260
|
+
const [head, ...tail] = remainingParts;
|
|
4261
|
+
if (Array.isArray(current)) {
|
|
4262
|
+
if (/^\d+$/.test(head)) {
|
|
4263
|
+
return extract(current[parseInt(head, 10)], tail);
|
|
4264
|
+
}
|
|
4265
|
+
for (let idx = 0; idx < current.length; idx++) {
|
|
4266
|
+
const item = current[idx];
|
|
4267
|
+
if (parsed.targetIndex !== void 0 && idx !== parsed.targetIndex) continue;
|
|
4268
|
+
if (parsed.targetComponentUid && item?.__component !== parsed.targetComponentUid) continue;
|
|
4269
|
+
const found = extract(getPropertyValue(item, head), tail);
|
|
4270
|
+
if (found !== void 0 && found !== null) return found;
|
|
4271
|
+
}
|
|
4272
|
+
return void 0;
|
|
4273
|
+
}
|
|
4274
|
+
return extract(getPropertyValue(current, head), tail);
|
|
4275
|
+
}
|
|
4276
|
+
return extract(obj, parts);
|
|
4277
|
+
}
|
|
4278
|
+
function getAllNestedValues(obj, path, availableAttributes) {
|
|
4279
|
+
if (!obj || !path) return [];
|
|
4280
|
+
const parsed = parseDynamicZonePath(path);
|
|
4281
|
+
const parts = parsed.cleanPath.split(".");
|
|
4282
|
+
const [head, ...tail] = parts;
|
|
4283
|
+
const rootTarget = getPropertyValue(obj, head);
|
|
4284
|
+
if (rootTarget === void 0 || rootTarget === null) return [];
|
|
4285
|
+
if (Array.isArray(rootTarget)) {
|
|
4286
|
+
const results = [];
|
|
4287
|
+
rootTarget.forEach((item, idx) => {
|
|
4288
|
+
if (!item || typeof item !== "object") return;
|
|
4289
|
+
if (parsed.targetIndex !== void 0 && idx !== parsed.targetIndex) return;
|
|
4290
|
+
if (parsed.targetComponentUid && item.__component !== parsed.targetComponentUid) return;
|
|
4291
|
+
const subPath = tail.join(".");
|
|
4292
|
+
const scopedPath = item.__component ? `${head}[${item.__component}].${subPath}` : "";
|
|
4293
|
+
const isSupported = availableAttributes ? availableAttributes.includes(scopedPath) : false;
|
|
4294
|
+
if (tail.length > 0) {
|
|
4295
|
+
const subMatches = getAllNestedValues(item, subPath, availableAttributes);
|
|
4296
|
+
if (subMatches.length > 0) {
|
|
4297
|
+
subMatches.forEach((sm) => {
|
|
4298
|
+
results.push({
|
|
4299
|
+
index: idx,
|
|
4300
|
+
componentUid: item.__component || sm.componentUid,
|
|
4301
|
+
componentName: item.__component ? formatComponentName(item.__component) : sm.componentName,
|
|
4302
|
+
componentId: item.id !== void 0 && item.id !== null ? item.id : sm.componentId,
|
|
4303
|
+
value: sm.value,
|
|
4304
|
+
path: `${head}[#${idx}${item.__component ? ` ${formatComponentName(item.__component)}` : ""}].${sm.path}`
|
|
4305
|
+
});
|
|
4306
|
+
});
|
|
4307
|
+
return;
|
|
4308
|
+
}
|
|
4309
|
+
}
|
|
4310
|
+
const subVal = tail.length > 0 ? getNestedValue(item, subPath) : item;
|
|
4311
|
+
if (subVal !== void 0 || isSupported) {
|
|
4312
|
+
results.push({
|
|
4313
|
+
index: idx,
|
|
4314
|
+
componentUid: item.__component,
|
|
4315
|
+
componentName: formatComponentName(item.__component),
|
|
4316
|
+
componentId: item.id !== void 0 && item.id !== null ? item.id : void 0,
|
|
4317
|
+
value: subVal !== void 0 ? subVal : null,
|
|
4318
|
+
path: `${head}[#${idx}${item.__component ? ` ${formatComponentName(item.__component)}` : ""}].${subPath}`
|
|
4319
|
+
});
|
|
4320
|
+
}
|
|
4321
|
+
});
|
|
4322
|
+
return results;
|
|
4323
|
+
}
|
|
4324
|
+
if (typeof rootTarget === "object" && tail.length > 0) {
|
|
4325
|
+
const subMatches = getAllNestedValues(rootTarget, tail.join("."), availableAttributes);
|
|
4326
|
+
if (subMatches.length > 0) {
|
|
4327
|
+
return subMatches.map((sm) => ({
|
|
4328
|
+
...sm,
|
|
4329
|
+
path: `${head}.${sm.path}`
|
|
4330
|
+
}));
|
|
4331
|
+
}
|
|
4332
|
+
}
|
|
4333
|
+
const singleVal = getNestedValue(obj, parsed.cleanPath);
|
|
4334
|
+
if (singleVal !== void 0) {
|
|
4335
|
+
return [
|
|
4336
|
+
{
|
|
4337
|
+
index: 0,
|
|
4338
|
+
value: singleVal,
|
|
4339
|
+
path: parsed.cleanPath
|
|
4340
|
+
}
|
|
4341
|
+
];
|
|
4342
|
+
}
|
|
4343
|
+
return [];
|
|
4344
|
+
}
|
|
4167
4345
|
const DEFAULT_HEADING_ITEMS = [
|
|
4168
4346
|
{ value: "h1", label: "H1 - Main Page Title", maxAllowed: 1 },
|
|
4169
4347
|
{ value: "h2", label: "H2 - Primary Section Heading", maxAllowed: 3 },
|
|
@@ -5040,117 +5218,6 @@ const ComponentOccurrencesDrawer = React__default.default.memo(
|
|
|
5040
5218
|
);
|
|
5041
5219
|
}
|
|
5042
5220
|
);
|
|
5043
|
-
function parseDynamicZonePath(path) {
|
|
5044
|
-
if (!path) return { cleanPath: "", rootKey: "", subPath: "" };
|
|
5045
|
-
const bracketMatch = path.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
|
|
5046
|
-
if (bracketMatch) {
|
|
5047
|
-
const rootKey = bracketMatch[1];
|
|
5048
|
-
const selector = bracketMatch[2];
|
|
5049
|
-
const subPath = bracketMatch[3];
|
|
5050
|
-
const cleanPath = `${rootKey}.${subPath}`;
|
|
5051
|
-
if (/^\d+$/.test(selector)) {
|
|
5052
|
-
return { cleanPath, rootKey, subPath, targetIndex: parseInt(selector, 10) };
|
|
5053
|
-
}
|
|
5054
|
-
return { cleanPath, rootKey, subPath, targetComponentUid: selector };
|
|
5055
|
-
}
|
|
5056
|
-
const parts = path.split(".");
|
|
5057
|
-
return {
|
|
5058
|
-
cleanPath: path,
|
|
5059
|
-
rootKey: parts[0] || "",
|
|
5060
|
-
subPath: parts.slice(1).join(".")
|
|
5061
|
-
};
|
|
5062
|
-
}
|
|
5063
|
-
function formatComponentName(compUid) {
|
|
5064
|
-
if (!compUid) return "Component";
|
|
5065
|
-
const name = compUid.includes(".") ? compUid.split(".")[1] : compUid;
|
|
5066
|
-
return name.split(/[-_]/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
5067
|
-
}
|
|
5068
|
-
function getAllNestedValues(obj, path, availableAttributes) {
|
|
5069
|
-
if (!obj || !path) return [];
|
|
5070
|
-
const parsed = parseDynamicZonePath(path);
|
|
5071
|
-
const parts = parsed.cleanPath.split(".");
|
|
5072
|
-
const [head, ...tail] = parts;
|
|
5073
|
-
const rootTarget = getPropertyValue(obj, head);
|
|
5074
|
-
if (Array.isArray(rootTarget)) {
|
|
5075
|
-
const results = [];
|
|
5076
|
-
rootTarget.forEach((item, idx) => {
|
|
5077
|
-
if (!item || typeof item !== "object") return;
|
|
5078
|
-
if (parsed.targetIndex !== void 0 && idx !== parsed.targetIndex) return;
|
|
5079
|
-
if (parsed.targetComponentUid && item.__component !== parsed.targetComponentUid) return;
|
|
5080
|
-
const subPath = tail.join(".");
|
|
5081
|
-
const scopedPath = item.__component ? `${head}[${item.__component}].${subPath}` : "";
|
|
5082
|
-
const isSupported = availableAttributes ? availableAttributes.includes(scopedPath) : false;
|
|
5083
|
-
const subVal = tail.length > 0 ? getNestedValue(item, subPath) : item;
|
|
5084
|
-
if (subVal !== void 0 || isSupported) {
|
|
5085
|
-
results.push({
|
|
5086
|
-
index: idx,
|
|
5087
|
-
componentUid: item.__component,
|
|
5088
|
-
componentName: formatComponentName(item.__component),
|
|
5089
|
-
value: subVal !== void 0 ? subVal : null,
|
|
5090
|
-
path: `${head}[#${idx}${item.__component ? ` ${formatComponentName(item.__component)}` : ""}].${subPath}`
|
|
5091
|
-
});
|
|
5092
|
-
}
|
|
5093
|
-
});
|
|
5094
|
-
return results;
|
|
5095
|
-
}
|
|
5096
|
-
const singleVal = getNestedValue(obj, parsed.cleanPath);
|
|
5097
|
-
if (singleVal !== void 0) {
|
|
5098
|
-
return [
|
|
5099
|
-
{
|
|
5100
|
-
index: 0,
|
|
5101
|
-
value: singleVal,
|
|
5102
|
-
path: parsed.cleanPath
|
|
5103
|
-
}
|
|
5104
|
-
];
|
|
5105
|
-
}
|
|
5106
|
-
return [];
|
|
5107
|
-
}
|
|
5108
|
-
function getPropertyValue(target, key) {
|
|
5109
|
-
if (!target || typeof target !== "object" || !key) return void 0;
|
|
5110
|
-
if (target[key] !== void 0 && target[key] !== null) return target[key];
|
|
5111
|
-
const camelKey = key.replace(/_([a-z0-9])/g, (_, letter) => letter.toUpperCase());
|
|
5112
|
-
if (target[camelKey] !== void 0 && target[camelKey] !== null) return target[camelKey];
|
|
5113
|
-
const snakeKey = key.replace(/([A-Z])/g, "_$1").toLowerCase();
|
|
5114
|
-
if (target[snakeKey] !== void 0 && target[snakeKey] !== null) return target[snakeKey];
|
|
5115
|
-
const lowerKey = key.toLowerCase();
|
|
5116
|
-
const lowerNoUnderscore = lowerKey.replace(/_/g, "");
|
|
5117
|
-
const matchedKey = Object.keys(target).find((k) => {
|
|
5118
|
-
const kLower = k.toLowerCase();
|
|
5119
|
-
return kLower === lowerKey || kLower.replace(/_/g, "") === lowerNoUnderscore;
|
|
5120
|
-
});
|
|
5121
|
-
if (matchedKey && target[matchedKey] !== void 0 && target[matchedKey] !== null) {
|
|
5122
|
-
return target[matchedKey];
|
|
5123
|
-
}
|
|
5124
|
-
if (key in target) return target[key];
|
|
5125
|
-
if (camelKey in target) return target[camelKey];
|
|
5126
|
-
if (snakeKey in target) return target[snakeKey];
|
|
5127
|
-
return void 0;
|
|
5128
|
-
}
|
|
5129
|
-
function getNestedValue(obj, path) {
|
|
5130
|
-
if (!obj || !path) return void 0;
|
|
5131
|
-
const parsed = parseDynamicZonePath(path);
|
|
5132
|
-
const parts = parsed.cleanPath.split(".");
|
|
5133
|
-
function extract(current, remainingParts) {
|
|
5134
|
-
if (current === void 0 || current === null) return void 0;
|
|
5135
|
-
if (remainingParts.length === 0) return current;
|
|
5136
|
-
const [head, ...tail] = remainingParts;
|
|
5137
|
-
if (Array.isArray(current)) {
|
|
5138
|
-
if (/^\d+$/.test(head)) {
|
|
5139
|
-
return extract(current[parseInt(head, 10)], tail);
|
|
5140
|
-
}
|
|
5141
|
-
for (let idx = 0; idx < current.length; idx++) {
|
|
5142
|
-
const item = current[idx];
|
|
5143
|
-
if (parsed.targetIndex !== void 0 && idx !== parsed.targetIndex) continue;
|
|
5144
|
-
if (parsed.targetComponentUid && item?.__component !== parsed.targetComponentUid) continue;
|
|
5145
|
-
const found = extract(getPropertyValue(item, head), tail);
|
|
5146
|
-
if (found !== void 0 && found !== null) return found;
|
|
5147
|
-
}
|
|
5148
|
-
return void 0;
|
|
5149
|
-
}
|
|
5150
|
-
return extract(getPropertyValue(current, head), tail);
|
|
5151
|
-
}
|
|
5152
|
-
return extract(obj, parts);
|
|
5153
|
-
}
|
|
5154
5221
|
function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribute) {
|
|
5155
5222
|
const cols = [
|
|
5156
5223
|
{
|
|
@@ -5718,16 +5785,63 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
5718
5785
|
}
|
|
5719
5786
|
default: {
|
|
5720
5787
|
const attrName = colDef.key.replace("attr_", "");
|
|
5721
|
-
const
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5788
|
+
const matches = getAllNestedValues(entry, attrName, col?.attributes);
|
|
5789
|
+
if (matches.length === 0) {
|
|
5790
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "-" });
|
|
5791
|
+
}
|
|
5792
|
+
if (matches.length === 1 && !matches[0].componentUid && !matches[0].path.includes("[#")) {
|
|
5793
|
+
const displayStr = formatDisplayValue(matches[0].value);
|
|
5794
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5795
|
+
designSystem.Typography,
|
|
5796
|
+
{
|
|
5797
|
+
textColor: "neutral700",
|
|
5798
|
+
style: { maxWidth: 200, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
|
5799
|
+
children: displayStr === "(empty / not set)" ? "-" : displayStr
|
|
5800
|
+
}
|
|
5801
|
+
);
|
|
5802
|
+
}
|
|
5803
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m, mIdx) => {
|
|
5804
|
+
const displayStr = formatDisplayValue(m.value);
|
|
5805
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5806
|
+
designSystem.Flex,
|
|
5807
|
+
{
|
|
5808
|
+
gap: 1,
|
|
5809
|
+
alignItems: "center",
|
|
5810
|
+
style: {
|
|
5811
|
+
backgroundColor: "rgba(0, 0, 0, 0.03)",
|
|
5812
|
+
padding: "2px 6px",
|
|
5813
|
+
borderRadius: 4
|
|
5814
|
+
},
|
|
5815
|
+
children: [
|
|
5816
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { size: "S", backgroundColor: "neutral200", textColor: "neutral800", children: [
|
|
5817
|
+
"#",
|
|
5818
|
+
m.index,
|
|
5819
|
+
" ",
|
|
5820
|
+
m.componentName || "Item"
|
|
5821
|
+
] }),
|
|
5822
|
+
m.componentId !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral500", style: { fontSize: "0.68rem" }, children: [
|
|
5823
|
+
"id:",
|
|
5824
|
+
m.componentId
|
|
5825
|
+
] }),
|
|
5826
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5827
|
+
designSystem.Typography,
|
|
5828
|
+
{
|
|
5829
|
+
variant: "pi",
|
|
5830
|
+
textColor: "neutral800",
|
|
5831
|
+
style: {
|
|
5832
|
+
maxWidth: 200,
|
|
5833
|
+
overflow: "hidden",
|
|
5834
|
+
textOverflow: "ellipsis",
|
|
5835
|
+
whiteSpace: "nowrap"
|
|
5836
|
+
},
|
|
5837
|
+
children: displayStr
|
|
5838
|
+
}
|
|
5839
|
+
)
|
|
5840
|
+
]
|
|
5841
|
+
},
|
|
5842
|
+
`${m.index}_${m.componentId ?? mIdx}_${m.componentUid ?? ""}`
|
|
5843
|
+
);
|
|
5844
|
+
}) });
|
|
5731
5845
|
}
|
|
5732
5846
|
}
|
|
5733
5847
|
}
|
|
@@ -7144,7 +7258,31 @@ const BulkUpdater = () => {
|
|
|
7144
7258
|
}
|
|
7145
7259
|
try {
|
|
7146
7260
|
setBulkExporting(true);
|
|
7147
|
-
const
|
|
7261
|
+
const targetUids = Array.from(new Set(targets.map((t) => t.uid)));
|
|
7262
|
+
let bulkSelectedCols;
|
|
7263
|
+
if (targetUids.length === 1 && selectedCol && selectedCol.uid === targetUids[0]) {
|
|
7264
|
+
const availCols = getAvailableColumnsForCollection(selectedCol, selectedAttribute, searchAttribute);
|
|
7265
|
+
const savedKeys = collectionColumnVisibility[selectedCol.uid];
|
|
7266
|
+
const activeCols = savedKeys ? availCols.filter((c) => c.isPermanent || savedKeys.includes(c.key)) : availCols.filter((c) => c.defaultVisible);
|
|
7267
|
+
const selectedDataAttrs = [];
|
|
7268
|
+
for (const c of activeCols) {
|
|
7269
|
+
if (c.key.startsWith("attr_")) {
|
|
7270
|
+
const attr = c.key.slice(5);
|
|
7271
|
+
if (!selectedDataAttrs.includes(attr)) selectedDataAttrs.push(attr);
|
|
7272
|
+
} else if (c.key === "target_attr" && selectedAttribute) {
|
|
7273
|
+
if (!selectedDataAttrs.includes(selectedAttribute)) selectedDataAttrs.push(selectedAttribute);
|
|
7274
|
+
} else if (c.key === "search_attr" && searchAttribute) {
|
|
7275
|
+
if (!selectedDataAttrs.includes(searchAttribute)) selectedDataAttrs.push(searchAttribute);
|
|
7276
|
+
}
|
|
7277
|
+
}
|
|
7278
|
+
if (selectedDataAttrs.length > 0) {
|
|
7279
|
+
bulkSelectedCols = selectedDataAttrs;
|
|
7280
|
+
}
|
|
7281
|
+
}
|
|
7282
|
+
const res = await post("/bulk-updater/csv/export-bulk", {
|
|
7283
|
+
selectedEntries: targets,
|
|
7284
|
+
selectedColumns: bulkSelectedCols
|
|
7285
|
+
});
|
|
7148
7286
|
const csvStr = res.data?.csvContent || (typeof res.data === "string" ? res.data : "");
|
|
7149
7287
|
if (!csvStr) {
|
|
7150
7288
|
toggleNotification({
|
|
@@ -8350,6 +8488,21 @@ const BulkUpdater = () => {
|
|
|
8350
8488
|
if (colSelectedDocIds.length > 0) {
|
|
8351
8489
|
params.set("documentIds", colSelectedDocIds.join(","));
|
|
8352
8490
|
}
|
|
8491
|
+
const selectedDataAttrs = [];
|
|
8492
|
+
for (const c of activeColumns) {
|
|
8493
|
+
if (c.key.startsWith("attr_")) {
|
|
8494
|
+
const attr = c.key.slice(5);
|
|
8495
|
+
if (!selectedDataAttrs.includes(attr)) selectedDataAttrs.push(attr);
|
|
8496
|
+
} else if (c.key === "target_attr" && selectedAttribute) {
|
|
8497
|
+
if (!selectedDataAttrs.includes(selectedAttribute)) selectedDataAttrs.push(selectedAttribute);
|
|
8498
|
+
} else if (c.key === "search_attr" && searchAttribute) {
|
|
8499
|
+
if (!selectedDataAttrs.includes(searchAttribute)) selectedDataAttrs.push(searchAttribute);
|
|
8500
|
+
}
|
|
8501
|
+
}
|
|
8502
|
+
if (selectedDataAttrs.length > 0) {
|
|
8503
|
+
params.set("selectedColumns", selectedDataAttrs.join(","));
|
|
8504
|
+
params.set("exportMode", "selective");
|
|
8505
|
+
}
|
|
8353
8506
|
const res = await get(`/bulk-updater/csv/export/${col.uid}?${params.toString()}`);
|
|
8354
8507
|
const csvStr = res.data?.csvContent || (typeof res.data === "string" ? res.data : "");
|
|
8355
8508
|
if (!csvStr) {
|
|
@@ -10128,4 +10281,4 @@ exports.getNestedValue = getNestedValue;
|
|
|
10128
10281
|
exports.getPropertyValue = getPropertyValue;
|
|
10129
10282
|
exports.getSortOptionsForCollection = getSortOptionsForCollection;
|
|
10130
10283
|
exports.parseDynamicZonePath = parseDynamicZonePath;
|
|
10131
|
-
//# sourceMappingURL=BulkUpdater-
|
|
10284
|
+
//# sourceMappingURL=BulkUpdater-DbCzwAQ7.js.map
|