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.
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import React__default, { useRef, useState, useEffect, useMemo } from "react";
3
3
  import { useFetchClient, useNotification } from "@strapi/strapi/admin";
4
- import { Box, Flex, Typography, Button, Combobox, ComboboxOption, Badge, SingleSelect, SingleSelectOption, TextInput, Checkbox, Alert, Table, Thead, Tr, Th, Tbody, Td, Loader, Textarea, Field } from "@strapi/design-system";
4
+ import { Box, Flex, Typography, Button, Combobox, ComboboxOption, Badge, SingleSelect, SingleSelectOption, TextInput, Alert, Checkbox, Table, Thead, Tr, Th, Tbody, Td, Loader, Textarea, Field } from "@strapi/design-system";
5
5
  import { ArrowClockwise, Download, Search, Upload, ChevronLeft, ChevronRight, Eye, Check, Cog, Play } from "@strapi/icons";
6
6
  import { i as isAbortError, V as ValidationRulesTab } from "./ValidationRulesTab-BtOCWK8E.mjs";
7
7
  function parseCsvRows(csvText) {
@@ -411,11 +411,14 @@ function buildEntriesQueryParams(options) {
411
411
  return params;
412
412
  }
413
413
  function buildCsvExportQueryParams(options) {
414
- const { limit, filter } = options;
414
+ const { limit, filter, exportMode } = options;
415
415
  const queryParams = new URLSearchParams();
416
416
  if (limit && limit > 0) {
417
417
  queryParams.set("limit", String(limit));
418
418
  }
419
+ if (exportMode) {
420
+ queryParams.set("exportMode", exportMode);
421
+ }
419
422
  if (filter.searchAttribute) {
420
423
  queryParams.set("searchAttribute", filter.searchAttribute);
421
424
  }
@@ -459,6 +462,7 @@ function CsvManagerTab() {
459
462
  const hasPendingFilterChanges = !areSearchFiltersEqual(draftFilter, appliedFilter);
460
463
  const [searchRelationOptions, setSearchRelationOptions] = useState([]);
461
464
  const [searchRelationOptionsLoading, setSearchRelationOptionsLoading] = useState(false);
465
+ const [exportMode, setExportMode] = useState("all");
462
466
  const [exportLimit, setExportLimit] = useState(0);
463
467
  const [exportLimitInput, setExportLimitInput] = useState("");
464
468
  const [exportingCollection, setExportingCollection] = useState(false);
@@ -732,7 +736,8 @@ function CsvManagerTab() {
732
736
  setExportingCollection(true);
733
737
  const queryParams = buildCsvExportQueryParams({
734
738
  limit: exportLimit,
735
- filter: appliedFilterRef.current
739
+ filter: appliedFilterRef.current,
740
+ exportMode
736
741
  });
737
742
  const res = await get(`/bulk-updater/csv/export/${selectedUid}?${queryParams.toString()}`);
738
743
  const csvStr = res.data?.csvContent || (typeof res.data === "string" ? res.data : "");
@@ -1376,6 +1381,22 @@ function CsvManagerTab() {
1376
1381
  );
1377
1382
  }) })
1378
1383
  ] }),
1384
+ /* @__PURE__ */ jsxs(Box, { style: { width: 220 }, children: [
1385
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", marginBottom: 1, display: "block", children: "Object Export Mode" }),
1386
+ /* @__PURE__ */ jsxs(
1387
+ SingleSelect,
1388
+ {
1389
+ value: exportMode,
1390
+ onChange: (val) => setExportMode(val === "metafields" || val === "topbarconfig" ? val : "all"),
1391
+ disabled: exportingCollection,
1392
+ children: [
1393
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "all", children: "All" }),
1394
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "metafields", children: "Metafields" }),
1395
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "topbarconfig", children: "Topbarconfig" })
1396
+ ]
1397
+ }
1398
+ )
1399
+ ] }),
1379
1400
  /* @__PURE__ */ jsx(
1380
1401
  Button,
1381
1402
  {
@@ -1412,7 +1433,8 @@ function CsvManagerTab() {
1412
1433
  }
1413
1434
  )
1414
1435
  ] })
1415
- ] })
1436
+ ] }),
1437
+ /* @__PURE__ */ jsx(Box, { marginTop: 3, children: exportMode === "all" ? /* @__PURE__ */ jsx(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__ */ jsx(Box, { padding: 3, background: "primary100", hasRadius: true, children: /* @__PURE__ */ jsx(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." }) }) })
1416
1438
  ] }),
1417
1439
  /* @__PURE__ */ jsxs(Box, { padding: 5, background: "neutral100", hasRadius: true, children: [
1418
1440
  /* @__PURE__ */ jsx(Typography, { variant: "delta", tag: "h3", fontWeight: "bold", marginBottom: 2, children: "2. Import & Batch Override CSV" }),
@@ -1482,7 +1504,21 @@ function CsvManagerTab() {
1482
1504
  const totalRows = allParsedRecords.length;
1483
1505
  const missingDocIdCount = allParsedRecords.filter((row) => !extractDocId(row)).length;
1484
1506
  const updateCount = totalRows - missingDocIdCount;
1485
- const headers = Object.keys(allParsedRecords[0]);
1507
+ const headers = Object.keys(allParsedRecords[0]).filter(
1508
+ (h) => h !== "__bulk_updater_metadata" && h !== "_bulk_updater_metadata"
1509
+ );
1510
+ let detectedPreviewMode = "legacy";
1511
+ try {
1512
+ const rawMetaCell = allParsedRecords[0]["__bulk_updater_metadata"] || allParsedRecords[0]["_bulk_updater_metadata"];
1513
+ if (rawMetaCell) {
1514
+ const parsedMeta = typeof rawMetaCell === "string" ? JSON.parse(rawMetaCell) : rawMetaCell;
1515
+ if (parsedMeta?.exportMode) {
1516
+ detectedPreviewMode = String(parsedMeta.exportMode);
1517
+ }
1518
+ }
1519
+ } catch {
1520
+ }
1521
+ const modeDisplayLabel = detectedPreviewMode === "metafields" ? "Metafields (1-Level Targeted)" : detectedPreviewMode === "topbarconfig" ? "Topbarconfig (1-Level Targeted)" : detectedPreviewMode === "all" ? "All (Full Migration Export)" : "Legacy";
1486
1522
  const totalPages = Math.ceil(totalRows / previewPageSize) || 1;
1487
1523
  const safePage = Math.min(Math.max(1, previewPage), totalPages);
1488
1524
  const startIndex = (safePage - 1) * previewPageSize;
@@ -1507,7 +1543,11 @@ function CsvManagerTab() {
1507
1543
  missingDocIdCount > 0 ? `${missingDocIdCount.toLocaleString()} new entries (missing documentId)` : ""
1508
1544
  ] })
1509
1545
  ] }),
1510
- /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
1546
+ /* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", children: [
1547
+ /* @__PURE__ */ jsxs(Badge, { backgroundColor: "neutral150", textColor: "neutral700", children: [
1548
+ "Mode: ",
1549
+ modeDisplayLabel
1550
+ ] }),
1511
1551
  /* @__PURE__ */ jsxs(Badge, { backgroundColor: "primary100", textColor: "primary700", children: [
1512
1552
  "🔄 ",
1513
1553
  updateCount.toLocaleString(),
@@ -4160,6 +4200,144 @@ function serializeGridTargets(gridEdits, selectedEntries, collectionPages = {},
4160
4200
  }
4161
4201
  return { targets, totalEditCount, hasValidationErrors };
4162
4202
  }
4203
+ function parseDynamicZonePath(path) {
4204
+ if (!path) return { cleanPath: "", rootKey: "", subPath: "" };
4205
+ const bracketMatch = path.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
4206
+ if (bracketMatch) {
4207
+ const rootKey = bracketMatch[1];
4208
+ const selector = bracketMatch[2];
4209
+ const subPath = bracketMatch[3];
4210
+ const cleanPath = `${rootKey}.${subPath}`;
4211
+ if (/^\d+$/.test(selector)) {
4212
+ return { cleanPath, rootKey, subPath, targetIndex: parseInt(selector, 10) };
4213
+ }
4214
+ return { cleanPath, rootKey, subPath, targetComponentUid: selector };
4215
+ }
4216
+ const parts = path.split(".");
4217
+ return {
4218
+ cleanPath: path,
4219
+ rootKey: parts[0] || "",
4220
+ subPath: parts.slice(1).join(".")
4221
+ };
4222
+ }
4223
+ function formatComponentName(compUid) {
4224
+ if (!compUid) return "Component";
4225
+ const name = compUid.includes(".") ? compUid.split(".")[1] : compUid;
4226
+ return name.split(/[-_]/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
4227
+ }
4228
+ function getPropertyValue(target, key) {
4229
+ if (!target || typeof target !== "object" || !key) return void 0;
4230
+ if (target[key] !== void 0 && target[key] !== null) return target[key];
4231
+ const camelKey = key.replace(/_([a-z0-9])/g, (_, letter) => letter.toUpperCase());
4232
+ if (target[camelKey] !== void 0 && target[camelKey] !== null) return target[camelKey];
4233
+ const snakeKey = key.replace(/([A-Z])/g, "_$1").toLowerCase();
4234
+ if (target[snakeKey] !== void 0 && target[snakeKey] !== null) return target[snakeKey];
4235
+ const lowerKey = key.toLowerCase();
4236
+ const lowerNoUnderscore = lowerKey.replace(/_/g, "");
4237
+ const matchedKey = Object.keys(target).find((k) => {
4238
+ const kLower = k.toLowerCase();
4239
+ return kLower === lowerKey || kLower.replace(/_/g, "") === lowerNoUnderscore;
4240
+ });
4241
+ if (matchedKey && target[matchedKey] !== void 0 && target[matchedKey] !== null) {
4242
+ return target[matchedKey];
4243
+ }
4244
+ if (key in target) return target[key];
4245
+ if (camelKey in target) return target[camelKey];
4246
+ if (snakeKey in target) return target[snakeKey];
4247
+ return void 0;
4248
+ }
4249
+ function getNestedValue(obj, path) {
4250
+ if (!obj || !path) return void 0;
4251
+ const parsed = parseDynamicZonePath(path);
4252
+ const parts = parsed.cleanPath.split(".");
4253
+ function extract(current, remainingParts) {
4254
+ if (current === void 0 || current === null) return void 0;
4255
+ if (remainingParts.length === 0) return current;
4256
+ const [head, ...tail] = remainingParts;
4257
+ if (Array.isArray(current)) {
4258
+ if (/^\d+$/.test(head)) {
4259
+ return extract(current[parseInt(head, 10)], tail);
4260
+ }
4261
+ for (let idx = 0; idx < current.length; idx++) {
4262
+ const item = current[idx];
4263
+ if (parsed.targetIndex !== void 0 && idx !== parsed.targetIndex) continue;
4264
+ if (parsed.targetComponentUid && item?.__component !== parsed.targetComponentUid) continue;
4265
+ const found = extract(getPropertyValue(item, head), tail);
4266
+ if (found !== void 0 && found !== null) return found;
4267
+ }
4268
+ return void 0;
4269
+ }
4270
+ return extract(getPropertyValue(current, head), tail);
4271
+ }
4272
+ return extract(obj, parts);
4273
+ }
4274
+ function getAllNestedValues(obj, path, availableAttributes) {
4275
+ if (!obj || !path) return [];
4276
+ const parsed = parseDynamicZonePath(path);
4277
+ const parts = parsed.cleanPath.split(".");
4278
+ const [head, ...tail] = parts;
4279
+ const rootTarget = getPropertyValue(obj, head);
4280
+ if (rootTarget === void 0 || rootTarget === null) return [];
4281
+ if (Array.isArray(rootTarget)) {
4282
+ const results = [];
4283
+ rootTarget.forEach((item, idx) => {
4284
+ if (!item || typeof item !== "object") return;
4285
+ if (parsed.targetIndex !== void 0 && idx !== parsed.targetIndex) return;
4286
+ if (parsed.targetComponentUid && item.__component !== parsed.targetComponentUid) return;
4287
+ const subPath = tail.join(".");
4288
+ const scopedPath = item.__component ? `${head}[${item.__component}].${subPath}` : "";
4289
+ const isSupported = availableAttributes ? availableAttributes.includes(scopedPath) : false;
4290
+ if (tail.length > 0) {
4291
+ const subMatches = getAllNestedValues(item, subPath, availableAttributes);
4292
+ if (subMatches.length > 0) {
4293
+ subMatches.forEach((sm) => {
4294
+ results.push({
4295
+ index: idx,
4296
+ componentUid: item.__component || sm.componentUid,
4297
+ componentName: item.__component ? formatComponentName(item.__component) : sm.componentName,
4298
+ componentId: item.id !== void 0 && item.id !== null ? item.id : sm.componentId,
4299
+ value: sm.value,
4300
+ path: `${head}[#${idx}${item.__component ? ` ${formatComponentName(item.__component)}` : ""}].${sm.path}`
4301
+ });
4302
+ });
4303
+ return;
4304
+ }
4305
+ }
4306
+ const subVal = tail.length > 0 ? getNestedValue(item, subPath) : item;
4307
+ if (subVal !== void 0 || isSupported) {
4308
+ results.push({
4309
+ index: idx,
4310
+ componentUid: item.__component,
4311
+ componentName: formatComponentName(item.__component),
4312
+ componentId: item.id !== void 0 && item.id !== null ? item.id : void 0,
4313
+ value: subVal !== void 0 ? subVal : null,
4314
+ path: `${head}[#${idx}${item.__component ? ` ${formatComponentName(item.__component)}` : ""}].${subPath}`
4315
+ });
4316
+ }
4317
+ });
4318
+ return results;
4319
+ }
4320
+ if (typeof rootTarget === "object" && tail.length > 0) {
4321
+ const subMatches = getAllNestedValues(rootTarget, tail.join("."), availableAttributes);
4322
+ if (subMatches.length > 0) {
4323
+ return subMatches.map((sm) => ({
4324
+ ...sm,
4325
+ path: `${head}.${sm.path}`
4326
+ }));
4327
+ }
4328
+ }
4329
+ const singleVal = getNestedValue(obj, parsed.cleanPath);
4330
+ if (singleVal !== void 0) {
4331
+ return [
4332
+ {
4333
+ index: 0,
4334
+ value: singleVal,
4335
+ path: parsed.cleanPath
4336
+ }
4337
+ ];
4338
+ }
4339
+ return [];
4340
+ }
4163
4341
  const DEFAULT_HEADING_ITEMS = [
4164
4342
  { value: "h1", label: "H1 - Main Page Title", maxAllowed: 1 },
4165
4343
  { value: "h2", label: "H2 - Primary Section Heading", maxAllowed: 3 },
@@ -5036,117 +5214,6 @@ const ComponentOccurrencesDrawer = React__default.memo(
5036
5214
  );
5037
5215
  }
5038
5216
  );
5039
- function parseDynamicZonePath(path) {
5040
- if (!path) return { cleanPath: "", rootKey: "", subPath: "" };
5041
- const bracketMatch = path.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
5042
- if (bracketMatch) {
5043
- const rootKey = bracketMatch[1];
5044
- const selector = bracketMatch[2];
5045
- const subPath = bracketMatch[3];
5046
- const cleanPath = `${rootKey}.${subPath}`;
5047
- if (/^\d+$/.test(selector)) {
5048
- return { cleanPath, rootKey, subPath, targetIndex: parseInt(selector, 10) };
5049
- }
5050
- return { cleanPath, rootKey, subPath, targetComponentUid: selector };
5051
- }
5052
- const parts = path.split(".");
5053
- return {
5054
- cleanPath: path,
5055
- rootKey: parts[0] || "",
5056
- subPath: parts.slice(1).join(".")
5057
- };
5058
- }
5059
- function formatComponentName(compUid) {
5060
- if (!compUid) return "Component";
5061
- const name = compUid.includes(".") ? compUid.split(".")[1] : compUid;
5062
- return name.split(/[-_]/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
5063
- }
5064
- function getAllNestedValues(obj, path, availableAttributes) {
5065
- if (!obj || !path) return [];
5066
- const parsed = parseDynamicZonePath(path);
5067
- const parts = parsed.cleanPath.split(".");
5068
- const [head, ...tail] = parts;
5069
- const rootTarget = getPropertyValue(obj, head);
5070
- if (Array.isArray(rootTarget)) {
5071
- const results = [];
5072
- rootTarget.forEach((item, idx) => {
5073
- if (!item || typeof item !== "object") return;
5074
- if (parsed.targetIndex !== void 0 && idx !== parsed.targetIndex) return;
5075
- if (parsed.targetComponentUid && item.__component !== parsed.targetComponentUid) return;
5076
- const subPath = tail.join(".");
5077
- const scopedPath = item.__component ? `${head}[${item.__component}].${subPath}` : "";
5078
- const isSupported = availableAttributes ? availableAttributes.includes(scopedPath) : false;
5079
- const subVal = tail.length > 0 ? getNestedValue(item, subPath) : item;
5080
- if (subVal !== void 0 || isSupported) {
5081
- results.push({
5082
- index: idx,
5083
- componentUid: item.__component,
5084
- componentName: formatComponentName(item.__component),
5085
- value: subVal !== void 0 ? subVal : null,
5086
- path: `${head}[#${idx}${item.__component ? ` ${formatComponentName(item.__component)}` : ""}].${subPath}`
5087
- });
5088
- }
5089
- });
5090
- return results;
5091
- }
5092
- const singleVal = getNestedValue(obj, parsed.cleanPath);
5093
- if (singleVal !== void 0) {
5094
- return [
5095
- {
5096
- index: 0,
5097
- value: singleVal,
5098
- path: parsed.cleanPath
5099
- }
5100
- ];
5101
- }
5102
- return [];
5103
- }
5104
- function getPropertyValue(target, key) {
5105
- if (!target || typeof target !== "object" || !key) return void 0;
5106
- if (target[key] !== void 0 && target[key] !== null) return target[key];
5107
- const camelKey = key.replace(/_([a-z0-9])/g, (_, letter) => letter.toUpperCase());
5108
- if (target[camelKey] !== void 0 && target[camelKey] !== null) return target[camelKey];
5109
- const snakeKey = key.replace(/([A-Z])/g, "_$1").toLowerCase();
5110
- if (target[snakeKey] !== void 0 && target[snakeKey] !== null) return target[snakeKey];
5111
- const lowerKey = key.toLowerCase();
5112
- const lowerNoUnderscore = lowerKey.replace(/_/g, "");
5113
- const matchedKey = Object.keys(target).find((k) => {
5114
- const kLower = k.toLowerCase();
5115
- return kLower === lowerKey || kLower.replace(/_/g, "") === lowerNoUnderscore;
5116
- });
5117
- if (matchedKey && target[matchedKey] !== void 0 && target[matchedKey] !== null) {
5118
- return target[matchedKey];
5119
- }
5120
- if (key in target) return target[key];
5121
- if (camelKey in target) return target[camelKey];
5122
- if (snakeKey in target) return target[snakeKey];
5123
- return void 0;
5124
- }
5125
- function getNestedValue(obj, path) {
5126
- if (!obj || !path) return void 0;
5127
- const parsed = parseDynamicZonePath(path);
5128
- const parts = parsed.cleanPath.split(".");
5129
- function extract(current, remainingParts) {
5130
- if (current === void 0 || current === null) return void 0;
5131
- if (remainingParts.length === 0) return current;
5132
- const [head, ...tail] = remainingParts;
5133
- if (Array.isArray(current)) {
5134
- if (/^\d+$/.test(head)) {
5135
- return extract(current[parseInt(head, 10)], tail);
5136
- }
5137
- for (let idx = 0; idx < current.length; idx++) {
5138
- const item = current[idx];
5139
- if (parsed.targetIndex !== void 0 && idx !== parsed.targetIndex) continue;
5140
- if (parsed.targetComponentUid && item?.__component !== parsed.targetComponentUid) continue;
5141
- const found = extract(getPropertyValue(item, head), tail);
5142
- if (found !== void 0 && found !== null) return found;
5143
- }
5144
- return void 0;
5145
- }
5146
- return extract(getPropertyValue(current, head), tail);
5147
- }
5148
- return extract(obj, parts);
5149
- }
5150
5217
  function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribute) {
5151
5218
  const cols = [
5152
5219
  {
@@ -5714,16 +5781,63 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
5714
5781
  }
5715
5782
  default: {
5716
5783
  const attrName = colDef.key.replace("attr_", "");
5717
- const rawVal = getNestedValue(entry, attrName);
5718
- const displayStr = formatDisplayValue(rawVal);
5719
- return /* @__PURE__ */ jsx(
5720
- Typography,
5721
- {
5722
- textColor: "neutral700",
5723
- style: { maxWidth: 200, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
5724
- children: displayStr === "(empty / not set)" ? "-" : displayStr
5725
- }
5726
- );
5784
+ const matches = getAllNestedValues(entry, attrName, col?.attributes);
5785
+ if (matches.length === 0) {
5786
+ return /* @__PURE__ */ jsx(Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "-" });
5787
+ }
5788
+ if (matches.length === 1 && !matches[0].componentUid && !matches[0].path.includes("[#")) {
5789
+ const displayStr = formatDisplayValue(matches[0].value);
5790
+ return /* @__PURE__ */ jsx(
5791
+ Typography,
5792
+ {
5793
+ textColor: "neutral700",
5794
+ style: { maxWidth: 200, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
5795
+ children: displayStr === "(empty / not set)" ? "-" : displayStr
5796
+ }
5797
+ );
5798
+ }
5799
+ return /* @__PURE__ */ jsx(Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m, mIdx) => {
5800
+ const displayStr = formatDisplayValue(m.value);
5801
+ return /* @__PURE__ */ jsxs(
5802
+ Flex,
5803
+ {
5804
+ gap: 1,
5805
+ alignItems: "center",
5806
+ style: {
5807
+ backgroundColor: "rgba(0, 0, 0, 0.03)",
5808
+ padding: "2px 6px",
5809
+ borderRadius: 4
5810
+ },
5811
+ children: [
5812
+ /* @__PURE__ */ jsxs(Badge, { size: "S", backgroundColor: "neutral200", textColor: "neutral800", children: [
5813
+ "#",
5814
+ m.index,
5815
+ " ",
5816
+ m.componentName || "Item"
5817
+ ] }),
5818
+ m.componentId !== void 0 && /* @__PURE__ */ jsxs(Typography, { variant: "pi", textColor: "neutral500", style: { fontSize: "0.68rem" }, children: [
5819
+ "id:",
5820
+ m.componentId
5821
+ ] }),
5822
+ /* @__PURE__ */ jsx(
5823
+ Typography,
5824
+ {
5825
+ variant: "pi",
5826
+ textColor: "neutral800",
5827
+ style: {
5828
+ maxWidth: 200,
5829
+ overflow: "hidden",
5830
+ textOverflow: "ellipsis",
5831
+ whiteSpace: "nowrap"
5832
+ },
5833
+ children: displayStr
5834
+ }
5835
+ )
5836
+ ]
5837
+ },
5838
+ `${m.index}_${m.componentId ?? mIdx}_${m.componentUid ?? ""}`
5839
+ );
5840
+ }) });
5727
5841
  }
5728
5842
  }
5729
5843
  }
@@ -7140,7 +7254,31 @@ const BulkUpdater = () => {
7140
7254
  }
7141
7255
  try {
7142
7256
  setBulkExporting(true);
7143
- const res = await post("/bulk-updater/csv/export-bulk", { selectedEntries: targets });
7257
+ const targetUids = Array.from(new Set(targets.map((t) => t.uid)));
7258
+ let bulkSelectedCols;
7259
+ if (targetUids.length === 1 && selectedCol && selectedCol.uid === targetUids[0]) {
7260
+ const availCols = getAvailableColumnsForCollection(selectedCol, selectedAttribute, searchAttribute);
7261
+ const savedKeys = collectionColumnVisibility[selectedCol.uid];
7262
+ const activeCols = savedKeys ? availCols.filter((c) => c.isPermanent || savedKeys.includes(c.key)) : availCols.filter((c) => c.defaultVisible);
7263
+ const selectedDataAttrs = [];
7264
+ for (const c of activeCols) {
7265
+ if (c.key.startsWith("attr_")) {
7266
+ const attr = c.key.slice(5);
7267
+ if (!selectedDataAttrs.includes(attr)) selectedDataAttrs.push(attr);
7268
+ } else if (c.key === "target_attr" && selectedAttribute) {
7269
+ if (!selectedDataAttrs.includes(selectedAttribute)) selectedDataAttrs.push(selectedAttribute);
7270
+ } else if (c.key === "search_attr" && searchAttribute) {
7271
+ if (!selectedDataAttrs.includes(searchAttribute)) selectedDataAttrs.push(searchAttribute);
7272
+ }
7273
+ }
7274
+ if (selectedDataAttrs.length > 0) {
7275
+ bulkSelectedCols = selectedDataAttrs;
7276
+ }
7277
+ }
7278
+ const res = await post("/bulk-updater/csv/export-bulk", {
7279
+ selectedEntries: targets,
7280
+ selectedColumns: bulkSelectedCols
7281
+ });
7144
7282
  const csvStr = res.data?.csvContent || (typeof res.data === "string" ? res.data : "");
7145
7283
  if (!csvStr) {
7146
7284
  toggleNotification({
@@ -8346,6 +8484,21 @@ const BulkUpdater = () => {
8346
8484
  if (colSelectedDocIds.length > 0) {
8347
8485
  params.set("documentIds", colSelectedDocIds.join(","));
8348
8486
  }
8487
+ const selectedDataAttrs = [];
8488
+ for (const c of activeColumns) {
8489
+ if (c.key.startsWith("attr_")) {
8490
+ const attr = c.key.slice(5);
8491
+ if (!selectedDataAttrs.includes(attr)) selectedDataAttrs.push(attr);
8492
+ } else if (c.key === "target_attr" && selectedAttribute) {
8493
+ if (!selectedDataAttrs.includes(selectedAttribute)) selectedDataAttrs.push(selectedAttribute);
8494
+ } else if (c.key === "search_attr" && searchAttribute) {
8495
+ if (!selectedDataAttrs.includes(searchAttribute)) selectedDataAttrs.push(searchAttribute);
8496
+ }
8497
+ }
8498
+ if (selectedDataAttrs.length > 0) {
8499
+ params.set("selectedColumns", selectedDataAttrs.join(","));
8500
+ params.set("exportMode", "selective");
8501
+ }
8349
8502
  const res = await get(`/bulk-updater/csv/export/${col.uid}?${params.toString()}`);
8350
8503
  const csvStr = res.data?.csvContent || (typeof res.data === "string" ? res.data : "");
8351
8504
  if (!csvStr) {
@@ -10126,4 +10279,4 @@ export {
10126
10279
  getSortOptionsForCollection,
10127
10280
  parseDynamicZonePath
10128
10281
  };
10129
- //# sourceMappingURL=BulkUpdater-xj4wH_iI.mjs.map
10282
+ //# sourceMappingURL=BulkUpdater-B7XefFd9.mjs.map