strapi-plugin-bulk-updater 1.6.9 → 1.6.11
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-CKDhgvZ6.js → BulkUpdater-BSlEEUTV.js} +294 -116
- package/dist/_chunks/BulkUpdater-BSlEEUTV.js.map +1 -0
- package/dist/_chunks/{BulkUpdater-4E6M5K8J.mjs → BulkUpdater-CFStXO-q.mjs} +296 -118
- package/dist/_chunks/BulkUpdater-CFStXO-q.mjs.map +1 -0
- package/dist/_chunks/{ScopedQuotaSelectInput-BsBpmwun.js → ScopedQuotaSelectInput-BC2Ge-Iv.js} +9 -4
- package/dist/_chunks/ScopedQuotaSelectInput-BC2Ge-Iv.js.map +1 -0
- package/dist/_chunks/{ScopedQuotaSelectInput-YKdQgrPt.mjs → ScopedQuotaSelectInput-DPIIa3XO.mjs} +9 -4
- package/dist/_chunks/ScopedQuotaSelectInput-DPIIa3XO.mjs.map +1 -0
- package/dist/_chunks/{SettingsPage-Crh2syU4.js → SettingsPage-BgEO2BNP.js} +2 -2
- package/dist/_chunks/{SettingsPage-Crh2syU4.js.map → SettingsPage-BgEO2BNP.js.map} +1 -1
- package/dist/_chunks/{SettingsPage-BX9sCRmw.mjs → SettingsPage-BrfS4_qy.mjs} +2 -2
- package/dist/_chunks/{SettingsPage-BX9sCRmw.mjs.map → SettingsPage-BrfS4_qy.mjs.map} +1 -1
- package/dist/_chunks/{ValidationRulesTab-BqbENLpg.mjs → ValidationRulesTab-BslJyrBj.mjs} +146 -80
- package/dist/_chunks/ValidationRulesTab-BslJyrBj.mjs.map +1 -0
- package/dist/_chunks/{ValidationRulesTab-R1vlW2wY.js → ValidationRulesTab-Cs0YDlMx.js} +145 -79
- package/dist/_chunks/ValidationRulesTab-Cs0YDlMx.js.map +1 -0
- package/dist/_chunks/index-4eNIGyGu.mjs +229 -0
- package/dist/_chunks/index-4eNIGyGu.mjs.map +1 -0
- package/dist/_chunks/index-CjR6IZqM.js +230 -0
- package/dist/_chunks/index-CjR6IZqM.js.map +1 -0
- package/dist/admin/index.js +4 -196
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +4 -194
- package/dist/admin/index.mjs.map +1 -1
- package/dist/server/index.js +215 -21
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +215 -21
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/_chunks/BulkUpdater-4E6M5K8J.mjs.map +0 -1
- package/dist/_chunks/BulkUpdater-CKDhgvZ6.js.map +0 -1
- package/dist/_chunks/ScopedQuotaSelectInput-BsBpmwun.js.map +0 -1
- package/dist/_chunks/ScopedQuotaSelectInput-YKdQgrPt.mjs.map +0 -1
- package/dist/_chunks/ValidationRulesTab-BqbENLpg.mjs.map +0 -1
- package/dist/_chunks/ValidationRulesTab-R1vlW2wY.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import React__default, { useRef, useState, useEffect, useMemo } from "react";
|
|
2
|
+
import React__default, { useRef, useState, useEffect, useCallback, useMemo } from "react";
|
|
3
3
|
import { useFetchClient, useNotification } from "@strapi/strapi/admin";
|
|
4
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";
|
|
5
5
|
import { ArrowClockwise, Download, Search, Cog, Upload, ChevronLeft, ChevronRight, Eye, Check, Play } from "@strapi/icons";
|
|
6
|
-
import { u as useBulkUpdaterRBAC, i as isAbortError, V as ValidationRulesTab } from "./ValidationRulesTab-
|
|
6
|
+
import { u as useBulkUpdaterRBAC, i as isAbortError, V as ValidationRulesTab } from "./ValidationRulesTab-BslJyrBj.mjs";
|
|
7
7
|
function parseCsvRows(csvText) {
|
|
8
8
|
if (!csvText) return [];
|
|
9
9
|
let text = csvText;
|
|
@@ -533,6 +533,113 @@ function areClientValuesEqual(a, b) {
|
|
|
533
533
|
}
|
|
534
534
|
return String(na) === String(nb);
|
|
535
535
|
}
|
|
536
|
+
const relationLabelRegistry = /* @__PURE__ */ new Map();
|
|
537
|
+
function registerRelationLabel(key, label) {
|
|
538
|
+
if (key !== void 0 && key !== null && label && typeof label === "string" && label.trim()) {
|
|
539
|
+
relationLabelRegistry.set(String(key).trim(), label.trim());
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
function registerRelationOptions(options) {
|
|
543
|
+
if (Array.isArray(options)) {
|
|
544
|
+
for (const opt of options) {
|
|
545
|
+
if (opt && opt.label) {
|
|
546
|
+
if (opt.documentId) registerRelationLabel(opt.documentId, opt.label);
|
|
547
|
+
if (opt.id !== void 0 && opt.id !== null) registerRelationLabel(opt.id, opt.label);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
function getCachedRelationLabel(key) {
|
|
553
|
+
if (key === void 0 || key === null) return void 0;
|
|
554
|
+
return relationLabelRegistry.get(String(key).trim());
|
|
555
|
+
}
|
|
556
|
+
function resolveEntityLabel(item, options) {
|
|
557
|
+
if (item === void 0 || item === null) return "";
|
|
558
|
+
if (typeof item !== "object") {
|
|
559
|
+
const s = String(item).trim();
|
|
560
|
+
if (options && Array.isArray(options)) {
|
|
561
|
+
const match = options.find((o) => o.documentId === s || String(o.id) === s);
|
|
562
|
+
if (match?.label) return match.label.trim();
|
|
563
|
+
}
|
|
564
|
+
const cached = getCachedRelationLabel(s);
|
|
565
|
+
if (cached) return cached;
|
|
566
|
+
return s;
|
|
567
|
+
}
|
|
568
|
+
if (item.label && typeof item.label === "string" && item.label.trim()) {
|
|
569
|
+
return item.label.trim();
|
|
570
|
+
}
|
|
571
|
+
const candidateFields = [
|
|
572
|
+
"name",
|
|
573
|
+
"title",
|
|
574
|
+
"authorName",
|
|
575
|
+
"label",
|
|
576
|
+
"heading",
|
|
577
|
+
"subject",
|
|
578
|
+
"fullName",
|
|
579
|
+
"username",
|
|
580
|
+
"email",
|
|
581
|
+
"slug"
|
|
582
|
+
];
|
|
583
|
+
for (const field of candidateFields) {
|
|
584
|
+
if (item[field] !== void 0 && item[field] !== null && String(item[field]).trim() !== "") {
|
|
585
|
+
const resolved = String(item[field]).trim();
|
|
586
|
+
if (item.documentId) registerRelationLabel(item.documentId, resolved);
|
|
587
|
+
if (item.id !== void 0 && item.id !== null) registerRelationLabel(item.id, resolved);
|
|
588
|
+
return resolved;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
if (item.firstname || item.lastname) {
|
|
592
|
+
const fn = [item.firstname, item.lastname].filter(Boolean).join(" ").trim();
|
|
593
|
+
if (fn) {
|
|
594
|
+
if (item.documentId) registerRelationLabel(item.documentId, fn);
|
|
595
|
+
if (item.id !== void 0 && item.id !== null) registerRelationLabel(item.id, fn);
|
|
596
|
+
return fn;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
const systemKeys = /* @__PURE__ */ new Set([
|
|
600
|
+
"id",
|
|
601
|
+
"documentId",
|
|
602
|
+
"createdAt",
|
|
603
|
+
"updatedAt",
|
|
604
|
+
"publishedAt",
|
|
605
|
+
"locale",
|
|
606
|
+
"createdBy",
|
|
607
|
+
"updatedBy",
|
|
608
|
+
"__component",
|
|
609
|
+
"isRelation",
|
|
610
|
+
"relationType",
|
|
611
|
+
"targetUid",
|
|
612
|
+
"targetDisplayName",
|
|
613
|
+
"isMulti",
|
|
614
|
+
"mode",
|
|
615
|
+
"documentIds"
|
|
616
|
+
]);
|
|
617
|
+
for (const [k, v] of Object.entries(item)) {
|
|
618
|
+
if (!systemKeys.has(k) && typeof v === "string" && v.trim() !== "") {
|
|
619
|
+
const resolved = v.trim();
|
|
620
|
+
if (item.documentId) registerRelationLabel(item.documentId, resolved);
|
|
621
|
+
if (item.id !== void 0 && item.id !== null) registerRelationLabel(item.id, resolved);
|
|
622
|
+
return resolved;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
if (item.documentId) {
|
|
626
|
+
if (options && Array.isArray(options)) {
|
|
627
|
+
const match = options.find((o) => o.documentId === item.documentId);
|
|
628
|
+
if (match?.label) return match.label.trim();
|
|
629
|
+
}
|
|
630
|
+
const cached = getCachedRelationLabel(item.documentId);
|
|
631
|
+
if (cached) return cached;
|
|
632
|
+
}
|
|
633
|
+
if (item.id !== void 0 && item.id !== null) {
|
|
634
|
+
if (options && Array.isArray(options)) {
|
|
635
|
+
const match = options.find((o) => String(o.id) === String(item.id));
|
|
636
|
+
if (match?.label) return match.label.trim();
|
|
637
|
+
}
|
|
638
|
+
const cached = getCachedRelationLabel(item.id);
|
|
639
|
+
if (cached) return cached;
|
|
640
|
+
}
|
|
641
|
+
return item.documentId || (item.id !== void 0 && item.id !== null ? `Entry #${item.id}` : JSON.stringify(item));
|
|
642
|
+
}
|
|
536
643
|
function extractRelationEditCommand(rawVal, currentDisplayVal, isMulti = false) {
|
|
537
644
|
if (rawVal && typeof rawVal === "object" && !Array.isArray(rawVal) && rawVal.mode) {
|
|
538
645
|
return {
|
|
@@ -545,14 +652,14 @@ function extractRelationEditCommand(rawVal, currentDisplayVal, isMulti = false)
|
|
|
545
652
|
return {
|
|
546
653
|
mode: "set",
|
|
547
654
|
documentIds: rawVal.map((r) => r?.documentId).filter(Boolean),
|
|
548
|
-
label: rawVal.map((r) => r
|
|
655
|
+
label: rawVal.map((r) => resolveEntityLabel(r)).filter(Boolean).join(", ")
|
|
549
656
|
};
|
|
550
657
|
}
|
|
551
658
|
if (rawVal && typeof rawVal === "object" && rawVal.documentId) {
|
|
552
659
|
return {
|
|
553
660
|
mode: "set",
|
|
554
661
|
documentIds: [rawVal.documentId],
|
|
555
|
-
label: rawVal
|
|
662
|
+
label: resolveEntityLabel(rawVal)
|
|
556
663
|
};
|
|
557
664
|
}
|
|
558
665
|
if (typeof rawVal === "string") {
|
|
@@ -846,7 +953,10 @@ function getAllNestedValues(obj, path, availableAttributes) {
|
|
|
846
953
|
rootTarget.forEach((item, idx) => {
|
|
847
954
|
if (!item || typeof item !== "object") return;
|
|
848
955
|
if (parsed.targetIndex !== void 0 && idx !== parsed.targetIndex) return;
|
|
849
|
-
|
|
956
|
+
const itemComp = item.__component;
|
|
957
|
+
const targetComp = parsed.targetComponentUid;
|
|
958
|
+
const compMatches = !targetComp || itemComp === targetComp || itemComp && (itemComp.toLowerCase() === targetComp.toLowerCase() || itemComp.split(".")[1]?.toLowerCase() === targetComp.toLowerCase() || itemComp.toLowerCase().replace(/[-_]/g, "") === targetComp.toLowerCase().replace(/[-_]/g, ""));
|
|
959
|
+
if (!compMatches) return;
|
|
850
960
|
const subPath = tail.join(".");
|
|
851
961
|
const scopedPath = item.__component ? `${head}[${item.__component}].${subPath}` : "";
|
|
852
962
|
const isSupported = availableAttributes ? availableAttributes.includes(scopedPath) : false;
|
|
@@ -901,6 +1011,66 @@ function getAllNestedValues(obj, path, availableAttributes) {
|
|
|
901
1011
|
}
|
|
902
1012
|
return [];
|
|
903
1013
|
}
|
|
1014
|
+
function formatAttributeHeaderLabel(attr) {
|
|
1015
|
+
if (!attr) return "";
|
|
1016
|
+
if (attr === "updated_at" || attr === "updatedAt") return "Updated At";
|
|
1017
|
+
if (attr === "created_at" || attr === "createdAt") return "Created At";
|
|
1018
|
+
if (attr === "published_at" || attr === "publishedAt") return "Published At";
|
|
1019
|
+
const bracketMatch = attr.match(/^([^.[]+)\[([^\]]+)\](?:\.(.+))?$/);
|
|
1020
|
+
if (bracketMatch) {
|
|
1021
|
+
const root = bracketMatch[1].replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
|
|
1022
|
+
const comp = formatComponentName(bracketMatch[2]);
|
|
1023
|
+
const sub = bracketMatch[3] ? bracketMatch[3].split(".").map((s) => s.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase())).join(" > ") : "";
|
|
1024
|
+
return sub ? `${root} [${comp}] > ${sub}` : `${root} [${comp}]`;
|
|
1025
|
+
}
|
|
1026
|
+
if (attr.includes(".")) {
|
|
1027
|
+
return attr.split(".").map((s) => s.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase())).join(" > ");
|
|
1028
|
+
}
|
|
1029
|
+
return attr.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
|
|
1030
|
+
}
|
|
1031
|
+
function resolveEffectiveRelationMeta(attr, colRelations, globalRelationsMeta) {
|
|
1032
|
+
if (!attr) return void 0;
|
|
1033
|
+
const rels = colRelations;
|
|
1034
|
+
if (rels) {
|
|
1035
|
+
if (rels[attr]) return rels[attr];
|
|
1036
|
+
const norm = attr.toLowerCase().replace(/[-_ /]/g, "");
|
|
1037
|
+
for (const k of Object.keys(rels)) {
|
|
1038
|
+
if (k.toLowerCase().replace(/[-_ /]/g, "") === norm) return rels[k];
|
|
1039
|
+
}
|
|
1040
|
+
for (const k of Object.keys(rels)) {
|
|
1041
|
+
if (k.startsWith(`${attr}.`) || k.toLowerCase().startsWith(`${attr.toLowerCase()}.`)) {
|
|
1042
|
+
return rels[k];
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
const attrLeaf = attr.includes(".") ? attr.split(".").pop() : "";
|
|
1046
|
+
for (const [k, rel] of Object.entries(rels)) {
|
|
1047
|
+
const bracketMatch = k.match(/\[([^\]]+)\](?:\.(.+))?/);
|
|
1048
|
+
if (bracketMatch) {
|
|
1049
|
+
const compUid = bracketMatch[1];
|
|
1050
|
+
const compClean = compUid.includes(".") ? compUid.split(".")[1] : compUid;
|
|
1051
|
+
const normComp = compClean.toLowerCase().replace(/[-_ /]/g, "");
|
|
1052
|
+
const subPath = bracketMatch[2] || "";
|
|
1053
|
+
const normSub = subPath.toLowerCase().replace(/[-_ /]/g, "");
|
|
1054
|
+
if (normComp === norm || compUid.toLowerCase() === attr.toLowerCase() || compClean.toLowerCase() === attr.toLowerCase() || attrLeaf && normSub === attrLeaf.toLowerCase().replace(/[-_ /]/g, "") && (norm.includes(normComp) || attr.toLowerCase().includes(compUid.toLowerCase()))) {
|
|
1055
|
+
return rel;
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
for (const [k, rel] of Object.entries(rels)) {
|
|
1060
|
+
if (k.endsWith(`.${attr}`) || k.toLowerCase().endsWith(`.${attr.toLowerCase()}`)) {
|
|
1061
|
+
return rel;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
if (globalRelationsMeta) {
|
|
1066
|
+
if (globalRelationsMeta[attr]) return globalRelationsMeta[attr];
|
|
1067
|
+
const norm = attr.toLowerCase().replace(/[-_ /]/g, "");
|
|
1068
|
+
for (const k of Object.keys(globalRelationsMeta)) {
|
|
1069
|
+
if (k.toLowerCase().replace(/[-_ /]/g, "") === norm) return globalRelationsMeta[k];
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
return void 0;
|
|
1073
|
+
}
|
|
904
1074
|
function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribute) {
|
|
905
1075
|
const cols = [
|
|
906
1076
|
{
|
|
@@ -921,26 +1091,7 @@ function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribut
|
|
|
921
1091
|
if (attr === "name" || attr === "title" || attr === selectedAttribute || searchAttribute && attr === searchAttribute) {
|
|
922
1092
|
return;
|
|
923
1093
|
}
|
|
924
|
-
|
|
925
|
-
if (attr === "updated_at" || attr === "updatedAt") {
|
|
926
|
-
formattedLabel = "Updated At";
|
|
927
|
-
} else if (attr === "created_at" || attr === "createdAt") {
|
|
928
|
-
formattedLabel = "Created At";
|
|
929
|
-
} else if (attr === "published_at" || attr === "publishedAt") {
|
|
930
|
-
formattedLabel = "Published At";
|
|
931
|
-
} else {
|
|
932
|
-
const bracketMatch = attr.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
|
|
933
|
-
if (bracketMatch) {
|
|
934
|
-
const root = bracketMatch[1].charAt(0).toUpperCase() + bracketMatch[1].slice(1);
|
|
935
|
-
const comp = formatComponentName(bracketMatch[2]);
|
|
936
|
-
const sub = bracketMatch[3].split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
937
|
-
formattedLabel = `${root} [${comp}] > ${sub}`;
|
|
938
|
-
} else if (attr.includes(".")) {
|
|
939
|
-
formattedLabel = attr.split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
940
|
-
} else {
|
|
941
|
-
formattedLabel = attr.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
|
|
942
|
-
}
|
|
943
|
-
}
|
|
1094
|
+
const formattedLabel = formatAttributeHeaderLabel(attr);
|
|
944
1095
|
cols.push({
|
|
945
1096
|
key: `attr_${attr}`,
|
|
946
1097
|
label: formattedLabel,
|
|
@@ -976,16 +1127,7 @@ function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribut
|
|
|
976
1127
|
});
|
|
977
1128
|
}
|
|
978
1129
|
if (searchAttribute && searchAttribute !== selectedAttribute) {
|
|
979
|
-
|
|
980
|
-
const bracketMatch = searchAttribute.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
|
|
981
|
-
if (bracketMatch) {
|
|
982
|
-
const root = bracketMatch[1].charAt(0).toUpperCase() + bracketMatch[1].slice(1);
|
|
983
|
-
const comp = formatComponentName(bracketMatch[2]);
|
|
984
|
-
const sub = bracketMatch[3].split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
985
|
-
formattedSearchLabel = `${root} [${comp}] > ${sub}`;
|
|
986
|
-
} else if (searchAttribute.includes(".")) {
|
|
987
|
-
formattedSearchLabel = searchAttribute.split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
988
|
-
}
|
|
1130
|
+
const formattedSearchLabel = formatAttributeHeaderLabel(searchAttribute);
|
|
989
1131
|
cols.push({
|
|
990
1132
|
key: "search_attr",
|
|
991
1133
|
label: `Search: "${formattedSearchLabel}"`,
|
|
@@ -994,18 +1136,7 @@ function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribut
|
|
|
994
1136
|
});
|
|
995
1137
|
}
|
|
996
1138
|
if (selectedAttribute && selectedAttribute.trim()) {
|
|
997
|
-
|
|
998
|
-
const bracketMatch = selectedAttribute.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
|
|
999
|
-
if (bracketMatch) {
|
|
1000
|
-
const root = bracketMatch[1].charAt(0).toUpperCase() + bracketMatch[1].slice(1);
|
|
1001
|
-
const comp = formatComponentName(bracketMatch[2]);
|
|
1002
|
-
const sub = bracketMatch[3].split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
1003
|
-
formattedTargetLabel = `${root} [${comp}] > ${sub}`;
|
|
1004
|
-
} else if (selectedAttribute.includes(".")) {
|
|
1005
|
-
formattedTargetLabel = selectedAttribute.split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
1006
|
-
} else {
|
|
1007
|
-
formattedTargetLabel = selectedAttribute.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
|
|
1008
|
-
}
|
|
1139
|
+
const formattedTargetLabel = formatAttributeHeaderLabel(selectedAttribute);
|
|
1009
1140
|
cols.push({
|
|
1010
1141
|
key: "current_attr",
|
|
1011
1142
|
label: `Current Value: "${formattedTargetLabel}"`,
|
|
@@ -1121,18 +1252,21 @@ function formatFullTooltipValue(val) {
|
|
|
1121
1252
|
return isNaN(val.getTime()) ? "(invalid date)" : val.toISOString();
|
|
1122
1253
|
}
|
|
1123
1254
|
if (typeof val === "string") {
|
|
1255
|
+
const cached = getCachedRelationLabel(val);
|
|
1256
|
+
if (cached) return cached;
|
|
1124
1257
|
return val;
|
|
1125
1258
|
}
|
|
1126
1259
|
if (Array.isArray(val)) {
|
|
1127
1260
|
if (val.length === 0) return "(empty array)";
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
return String(val);
|
|
1132
|
-
}
|
|
1261
|
+
return val.map(
|
|
1262
|
+
(item) => typeof item === "object" && item !== null ? resolveEntityLabel(item) : getCachedRelationLabel(item) || String(item)
|
|
1263
|
+
).join(", ");
|
|
1133
1264
|
}
|
|
1134
1265
|
if (typeof val === "object") {
|
|
1135
1266
|
if (val.isRelation && val.display) return val.display;
|
|
1267
|
+
if (val.documentId || val.authorName || val.name || val.title) {
|
|
1268
|
+
return resolveEntityLabel(val);
|
|
1269
|
+
}
|
|
1136
1270
|
try {
|
|
1137
1271
|
return JSON.stringify(val, null, 2);
|
|
1138
1272
|
} catch {
|
|
@@ -1147,7 +1281,7 @@ function getCellTooltipText(colDef, entry, colAttributes, selectedAttribute, sea
|
|
|
1147
1281
|
case "select":
|
|
1148
1282
|
return void 0;
|
|
1149
1283
|
case "identifier": {
|
|
1150
|
-
const mainText = entry
|
|
1284
|
+
const mainText = resolveEntityLabel(entry) || `Entry #${entry.id || entry.documentId}`;
|
|
1151
1285
|
const parts = [String(mainText)];
|
|
1152
1286
|
if (entry.documentId) parts.push(`Document ID: ${entry.documentId}`);
|
|
1153
1287
|
if (entry.id && String(entry.id) !== String(entry.documentId)) parts.push(`ID: ${entry.id}`);
|
|
@@ -1484,19 +1618,28 @@ function CsvManagerTab() {
|
|
|
1484
1618
|
}
|
|
1485
1619
|
};
|
|
1486
1620
|
const getAttrDepth = (attr) => attributesMeta[attr]?.depth ?? (attr.includes(".") ? attr.split(".").length - 1 : 0);
|
|
1621
|
+
const getEffectiveRelMeta = useCallback(
|
|
1622
|
+
(attr) => {
|
|
1623
|
+
return resolveEffectiveRelationMeta(attr, selectedCol?.relations, relationsMeta);
|
|
1624
|
+
},
|
|
1625
|
+
[selectedCol, relationsMeta]
|
|
1626
|
+
);
|
|
1487
1627
|
useEffect(() => {
|
|
1488
|
-
|
|
1489
|
-
|
|
1628
|
+
const activeRel = getEffectiveRelMeta(searchAttribute);
|
|
1629
|
+
if (searchAttribute && activeRel) {
|
|
1630
|
+
fetchSearchRelationOptions(activeRel.targetUid);
|
|
1490
1631
|
} else {
|
|
1491
1632
|
setSearchRelationOptions([]);
|
|
1492
1633
|
}
|
|
1493
|
-
}, [searchAttribute,
|
|
1634
|
+
}, [searchAttribute, getEffectiveRelMeta]);
|
|
1494
1635
|
const fetchSearchRelationOptions = async (targetUid) => {
|
|
1495
1636
|
try {
|
|
1496
1637
|
setSearchRelationOptionsLoading(true);
|
|
1497
1638
|
const res = await get(`/bulk-updater/relation-options?targetUid=${encodeURIComponent(targetUid)}`);
|
|
1498
1639
|
if (res.data && res.data.success) {
|
|
1499
|
-
|
|
1640
|
+
const opts = res.data.options || [];
|
|
1641
|
+
setSearchRelationOptions(opts);
|
|
1642
|
+
registerRelationOptions(opts);
|
|
1500
1643
|
}
|
|
1501
1644
|
} catch {
|
|
1502
1645
|
setSearchRelationOptions([]);
|
|
@@ -2183,12 +2326,16 @@ function CsvManagerTab() {
|
|
|
2183
2326
|
}
|
|
2184
2327
|
},
|
|
2185
2328
|
children: (selectedCol?.attributes || []).map((attr) => {
|
|
2186
|
-
const rel =
|
|
2329
|
+
const rel = getEffectiveRelMeta(attr);
|
|
2187
2330
|
const depth = getAttrDepth(attr);
|
|
2331
|
+
const friendlyLabel = formatAttributeHeaderLabel(attr);
|
|
2188
2332
|
const badgeText = rel ? `relation ${rel.targetDisplayName}` : depth > 0 ? `L${depth} component` : "";
|
|
2189
|
-
const textValue =
|
|
2333
|
+
const textValue = `${attr} ${friendlyLabel} ${badgeText}`.trim();
|
|
2190
2334
|
return /* @__PURE__ */ jsx(ComboboxOption, { value: attr, textValue, children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
|
|
2191
|
-
/* @__PURE__ */
|
|
2335
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
2336
|
+
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: attr === searchAttribute ? "bold" : "regular", children: friendlyLabel !== attr ? friendlyLabel : attr }),
|
|
2337
|
+
friendlyLabel !== attr && /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral500", display: "block", children: attr })
|
|
2338
|
+
] }),
|
|
2192
2339
|
rel ? /* @__PURE__ */ jsxs(Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: [
|
|
2193
2340
|
"relation ➔ ",
|
|
2194
2341
|
rel.targetDisplayName
|
|
@@ -2224,11 +2371,11 @@ function CsvManagerTab() {
|
|
|
2224
2371
|
] }),
|
|
2225
2372
|
(filterOperator === "equals" || filterOperator === "contains" || filterOperator === "starts_with") && /* @__PURE__ */ jsxs(Box, { style: { flex: 1, minWidth: 200 }, children: [
|
|
2226
2373
|
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", marginBottom: 1, display: "block", children: searchAttribute ? `Value for "${searchAttribute}"` : "Value to match" }),
|
|
2227
|
-
searchAttribute &&
|
|
2374
|
+
searchAttribute && getEffectiveRelMeta(searchAttribute) ? /* @__PURE__ */ jsx(
|
|
2228
2375
|
Combobox,
|
|
2229
2376
|
{
|
|
2230
2377
|
autocomplete: { type: "list", filter: "contains" },
|
|
2231
|
-
placeholder: searchRelationOptionsLoading ? "Loading entities..." : `Search & pick ${
|
|
2378
|
+
placeholder: searchRelationOptionsLoading ? "Loading entities..." : `Search & pick ${getEffectiveRelMeta(searchAttribute).targetDisplayName} or type text...`,
|
|
2232
2379
|
value: filterQuery,
|
|
2233
2380
|
onClear: () => setFilterQuery(""),
|
|
2234
2381
|
onChange: (val) => {
|
|
@@ -5931,7 +6078,7 @@ function renderHeaderCell(colDef, col, currentSort, selectedAttribute, searchAtt
|
|
|
5931
6078
|
colDef.key
|
|
5932
6079
|
);
|
|
5933
6080
|
}
|
|
5934
|
-
function formatDisplayValue(val) {
|
|
6081
|
+
function formatDisplayValue(val, options) {
|
|
5935
6082
|
if (val === void 0 || val === null || val === "") {
|
|
5936
6083
|
return "(empty / not set)";
|
|
5937
6084
|
}
|
|
@@ -5947,16 +6094,16 @@ function formatDisplayValue(val) {
|
|
|
5947
6094
|
if (Array.isArray(val)) {
|
|
5948
6095
|
if (val.length === 0) return "(empty / unlinked)";
|
|
5949
6096
|
return val.map(
|
|
5950
|
-
(item) => typeof item === "object" && item !== null ? item
|
|
6097
|
+
(item) => typeof item === "object" && item !== null ? resolveEntityLabel(item, options) : resolveEntityLabel(item, options)
|
|
5951
6098
|
).join(", ");
|
|
5952
6099
|
}
|
|
5953
6100
|
if (typeof val === "object" && val !== null) {
|
|
5954
6101
|
if (val.isRelation && val.display) return val.display;
|
|
5955
|
-
return val
|
|
6102
|
+
return resolveEntityLabel(val, options);
|
|
5956
6103
|
}
|
|
5957
|
-
return
|
|
6104
|
+
return resolveEntityLabel(val, options);
|
|
5958
6105
|
}
|
|
5959
|
-
function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribute, isMatch, hasAttr, isSelected, onToggleSelect, pendingBatches = [], isDzExpanded = false, onToggleExpandDz, filterQuery = "", gridCtx, cellTooltip) {
|
|
6106
|
+
function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribute, isMatch, hasAttr, isSelected, onToggleSelect, pendingBatches = [], isDzExpanded = false, onToggleExpandDz, filterQuery = "", gridCtx, cellTooltip, searchRelOptions, relationOptions) {
|
|
5960
6107
|
switch (colDef.key) {
|
|
5961
6108
|
case "select":
|
|
5962
6109
|
return /* @__PURE__ */ jsx(
|
|
@@ -5967,7 +6114,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
5967
6114
|
}
|
|
5968
6115
|
);
|
|
5969
6116
|
case "identifier": {
|
|
5970
|
-
const mainText = entry.name || entry.title || `Entry #${entry.id || entry.documentId}`;
|
|
6117
|
+
const mainText = entry.name || entry.title || entry.authorName || resolveEntityLabel(entry, searchRelOptions) || `Entry #${entry.id || entry.documentId}`;
|
|
5971
6118
|
const dzField = Object.keys(entry).find(
|
|
5972
6119
|
(k) => Array.isArray(entry[k]) && entry[k].length > 0 && entry[k].some((item) => item && item.__component)
|
|
5973
6120
|
);
|
|
@@ -6003,7 +6150,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
6003
6150
|
return /* @__PURE__ */ jsx(Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "(empty / not set)" });
|
|
6004
6151
|
}
|
|
6005
6152
|
if (matches.length === 1 && !matches[0].componentUid) {
|
|
6006
|
-
const displayStr = formatDisplayValue(matches[0].value);
|
|
6153
|
+
const displayStr = formatDisplayValue(matches[0].value, searchRelOptions);
|
|
6007
6154
|
const isUnset = displayStr === "(empty / not set)" || displayStr === "(empty / unlinked)";
|
|
6008
6155
|
return /* @__PURE__ */ jsx(
|
|
6009
6156
|
Typography,
|
|
@@ -6025,7 +6172,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
6025
6172
|
}
|
|
6026
6173
|
const qLower = (filterQuery || "").trim().toLowerCase();
|
|
6027
6174
|
return /* @__PURE__ */ jsx(Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m) => {
|
|
6028
|
-
const displayStr = formatDisplayValue(m.value);
|
|
6175
|
+
const displayStr = formatDisplayValue(m.value, searchRelOptions);
|
|
6029
6176
|
const isMatchItem = qLower && displayStr.toLowerCase().includes(qLower);
|
|
6030
6177
|
const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
|
|
6031
6178
|
return /* @__PURE__ */ jsxs(
|
|
@@ -6077,8 +6224,9 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
6077
6224
|
if (matches.length === 0) {
|
|
6078
6225
|
return /* @__PURE__ */ jsx(Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "(empty / not set)" });
|
|
6079
6226
|
}
|
|
6227
|
+
const activeRelOpts = gridCtx?.relationOptions || relationOptions || searchRelOptions;
|
|
6080
6228
|
if (matches.length === 1 && !matches[0].componentUid && !matches[0].path.includes("[#")) {
|
|
6081
|
-
const displayStr = formatDisplayValue(matches[0].value);
|
|
6229
|
+
const displayStr = formatDisplayValue(matches[0].value, activeRelOpts);
|
|
6082
6230
|
const isUnset = displayStr === "(empty / not set)" || displayStr === "(empty / unlinked)";
|
|
6083
6231
|
return /* @__PURE__ */ jsx(
|
|
6084
6232
|
Typography,
|
|
@@ -6098,7 +6246,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
6098
6246
|
);
|
|
6099
6247
|
}
|
|
6100
6248
|
return /* @__PURE__ */ jsx(Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m) => {
|
|
6101
|
-
const displayStr = formatDisplayValue(m.value);
|
|
6249
|
+
const displayStr = formatDisplayValue(m.value, activeRelOpts);
|
|
6102
6250
|
const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
|
|
6103
6251
|
return /* @__PURE__ */ jsxs(
|
|
6104
6252
|
Flex,
|
|
@@ -6230,8 +6378,9 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
6230
6378
|
if (matches.length === 0) {
|
|
6231
6379
|
return /* @__PURE__ */ jsx(Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "(empty / not set)" });
|
|
6232
6380
|
}
|
|
6381
|
+
const targetRelOpts = gridCtx?.relationOptions || relationOptions || searchRelOptions;
|
|
6233
6382
|
if (matches.length === 1 && !matches[0].componentUid) {
|
|
6234
|
-
const displayStr = formatDisplayValue(matches[0].value);
|
|
6383
|
+
const displayStr = formatDisplayValue(matches[0].value, targetRelOpts);
|
|
6235
6384
|
const isUnset = displayStr === "(empty / not set)" || displayStr === "(empty / unlinked)";
|
|
6236
6385
|
return /* @__PURE__ */ jsx(
|
|
6237
6386
|
Typography,
|
|
@@ -6251,7 +6400,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
6251
6400
|
);
|
|
6252
6401
|
}
|
|
6253
6402
|
return /* @__PURE__ */ jsx(Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m) => {
|
|
6254
|
-
const displayStr = formatDisplayValue(m.value);
|
|
6403
|
+
const displayStr = formatDisplayValue(m.value, targetRelOpts);
|
|
6255
6404
|
const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
|
|
6256
6405
|
return /* @__PURE__ */ jsxs(
|
|
6257
6406
|
Flex,
|
|
@@ -6312,8 +6461,9 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
6312
6461
|
if (matches.length === 0) {
|
|
6313
6462
|
return /* @__PURE__ */ jsx(Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "-" });
|
|
6314
6463
|
}
|
|
6464
|
+
const attrRelOpts = attrName === searchAttribute ? searchRelOptions : attrName === selectedAttribute ? gridCtx?.relationOptions || relationOptions : searchRelOptions || relationOptions;
|
|
6315
6465
|
if (matches.length === 1 && !matches[0].componentUid && !matches[0].path.includes("[#")) {
|
|
6316
|
-
const displayStr = formatDisplayValue(matches[0].value);
|
|
6466
|
+
const displayStr = formatDisplayValue(matches[0].value, attrRelOpts);
|
|
6317
6467
|
return /* @__PURE__ */ jsx(
|
|
6318
6468
|
Typography,
|
|
6319
6469
|
{
|
|
@@ -6325,7 +6475,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
6325
6475
|
);
|
|
6326
6476
|
}
|
|
6327
6477
|
return /* @__PURE__ */ jsx(Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m, mIdx) => {
|
|
6328
|
-
const displayStr = formatDisplayValue(m.value);
|
|
6478
|
+
const displayStr = formatDisplayValue(m.value, attrRelOpts);
|
|
6329
6479
|
const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
|
|
6330
6480
|
return /* @__PURE__ */ jsxs(
|
|
6331
6481
|
Flex,
|
|
@@ -6466,7 +6616,9 @@ const BulkUpdater = () => {
|
|
|
6466
6616
|
setRelationOptionsLoading(true);
|
|
6467
6617
|
const res = await get(`/bulk-updater/relation-options?targetUid=${encodeURIComponent(targetUid)}`);
|
|
6468
6618
|
if (res.data && res.data.success) {
|
|
6469
|
-
|
|
6619
|
+
const opts = res.data.options || [];
|
|
6620
|
+
setRelationOptions(opts);
|
|
6621
|
+
registerRelationOptions(opts);
|
|
6470
6622
|
}
|
|
6471
6623
|
} catch {
|
|
6472
6624
|
setRelationOptions([]);
|
|
@@ -6503,7 +6655,9 @@ const BulkUpdater = () => {
|
|
|
6503
6655
|
setSearchRelationOptionsLoading(true);
|
|
6504
6656
|
const res = await get(`/bulk-updater/relation-options?targetUid=${encodeURIComponent(targetUid)}`);
|
|
6505
6657
|
if (res.data && res.data.success) {
|
|
6506
|
-
|
|
6658
|
+
const opts = res.data.options || [];
|
|
6659
|
+
setSearchRelationOptions(opts);
|
|
6660
|
+
registerRelationOptions(opts);
|
|
6507
6661
|
}
|
|
6508
6662
|
} catch {
|
|
6509
6663
|
setSearchRelationOptions([]);
|
|
@@ -6519,13 +6673,6 @@ const BulkUpdater = () => {
|
|
|
6519
6673
|
const [gridFilterModifiedOnly, setGridFilterModifiedOnly] = useState(false);
|
|
6520
6674
|
const [validationRules, setValidationRules] = useState([]);
|
|
6521
6675
|
const effectiveSearchAttribute = searchAttribute || selectedAttribute;
|
|
6522
|
-
useEffect(() => {
|
|
6523
|
-
if (effectiveSearchAttribute && relationsMeta[effectiveSearchAttribute]) {
|
|
6524
|
-
fetchSearchRelationOptions(relationsMeta[effectiveSearchAttribute].targetUid);
|
|
6525
|
-
} else {
|
|
6526
|
-
setSearchRelationOptions([]);
|
|
6527
|
-
}
|
|
6528
|
-
}, [effectiveSearchAttribute, relationsMeta]);
|
|
6529
6676
|
const [filterOperator, setFilterOperator] = useState("none");
|
|
6530
6677
|
const [filterQuery, setFilterQuery] = useState("");
|
|
6531
6678
|
const [entrySearch, setEntrySearch] = useState("");
|
|
@@ -6699,7 +6846,8 @@ const BulkUpdater = () => {
|
|
|
6699
6846
|
}
|
|
6700
6847
|
}
|
|
6701
6848
|
} catch (err) {
|
|
6702
|
-
|
|
6849
|
+
const is403 = err?.response?.status === 403 || err?.status === 403;
|
|
6850
|
+
if (!isAbortError(err) && !is403) {
|
|
6703
6851
|
toggleNotification({
|
|
6704
6852
|
type: "danger",
|
|
6705
6853
|
message: err?.message || "Failed to load collections data"
|
|
@@ -6935,10 +7083,24 @@ const BulkUpdater = () => {
|
|
|
6935
7083
|
if (!collections.length || !selectedCollectionUid) return null;
|
|
6936
7084
|
return collections.find((c) => c.uid === selectedCollectionUid) || null;
|
|
6937
7085
|
}, [collections, selectedCollectionUid]);
|
|
7086
|
+
const getEffectiveRelMeta = useCallback(
|
|
7087
|
+
(attr) => {
|
|
7088
|
+
return resolveEffectiveRelationMeta(attr, selectedCol?.relations, relationsMeta);
|
|
7089
|
+
},
|
|
7090
|
+
[selectedCol, relationsMeta]
|
|
7091
|
+
);
|
|
7092
|
+
useEffect(() => {
|
|
7093
|
+
const activeRel = getEffectiveRelMeta(effectiveSearchAttribute);
|
|
7094
|
+
if (effectiveSearchAttribute && activeRel) {
|
|
7095
|
+
fetchSearchRelationOptions(activeRel.targetUid);
|
|
7096
|
+
} else {
|
|
7097
|
+
setSearchRelationOptions([]);
|
|
7098
|
+
}
|
|
7099
|
+
}, [effectiveSearchAttribute, getEffectiveRelMeta]);
|
|
6938
7100
|
const activeAttrMeta = useMemo(() => {
|
|
6939
7101
|
if (!selectedAttribute) return void 0;
|
|
6940
7102
|
const base = selectedCol?.attributesMeta?.[selectedAttribute] || attributesMeta[selectedAttribute];
|
|
6941
|
-
const relMeta =
|
|
7103
|
+
const relMeta = getEffectiveRelMeta(selectedAttribute);
|
|
6942
7104
|
if (!base && !relMeta) return void 0;
|
|
6943
7105
|
if (relMeta && (!base || !base.isRelation)) {
|
|
6944
7106
|
return {
|
|
@@ -6949,7 +7111,7 @@ const BulkUpdater = () => {
|
|
|
6949
7111
|
};
|
|
6950
7112
|
}
|
|
6951
7113
|
return base;
|
|
6952
|
-
}, [selectedAttribute, selectedCol, attributesMeta,
|
|
7114
|
+
}, [selectedAttribute, selectedCol, attributesMeta, getEffectiveRelMeta]);
|
|
6953
7115
|
const totalDirtyRecordsCount = useMemo(() => Object.keys(gridEdits).length, [gridEdits]);
|
|
6954
7116
|
const totalDirtyCellsCount = useMemo(
|
|
6955
7117
|
() => Object.values(gridEdits).reduce(
|
|
@@ -6965,7 +7127,7 @@ const BulkUpdater = () => {
|
|
|
6965
7127
|
const handleGridCellCommit = React__default.useCallback(
|
|
6966
7128
|
(entry, colUid, occ, newValue, validationError) => {
|
|
6967
7129
|
const key = `${colUid}${KEY_SEP}${entry.documentId}`;
|
|
6968
|
-
const recordLabel = entry.name || entry.title || entry.email || `Entry #${entry.id || entry.documentId}`;
|
|
7130
|
+
const recordLabel = entry.name || entry.title || entry.authorName || entry.email || `Entry #${entry.id || entry.documentId}`;
|
|
6969
7131
|
setGridEdits((prev) => {
|
|
6970
7132
|
const existingRec = prev[key] || {
|
|
6971
7133
|
uid: colUid,
|
|
@@ -7144,8 +7306,9 @@ const BulkUpdater = () => {
|
|
|
7144
7306
|
}
|
|
7145
7307
|
setSelectedRelationDocId("");
|
|
7146
7308
|
setAttributeValue("");
|
|
7147
|
-
|
|
7148
|
-
|
|
7309
|
+
const relForNewAttr = getEffectiveRelMeta(newAttr);
|
|
7310
|
+
if (newAttr && relForNewAttr) {
|
|
7311
|
+
fetchRelationOptions(relForNewAttr.targetUid);
|
|
7149
7312
|
} else {
|
|
7150
7313
|
setRelationOptions([]);
|
|
7151
7314
|
}
|
|
@@ -7170,12 +7333,16 @@ const BulkUpdater = () => {
|
|
|
7170
7333
|
] }) });
|
|
7171
7334
|
}
|
|
7172
7335
|
return depthFilteredAttributes.map((attr) => {
|
|
7173
|
-
const rel =
|
|
7336
|
+
const rel = getEffectiveRelMeta(attr);
|
|
7174
7337
|
const depth = getAttrDepth(attr);
|
|
7338
|
+
const friendlyLabel = formatAttributeHeaderLabel(attr);
|
|
7175
7339
|
const badgeText = rel ? `relation ${rel.targetDisplayName}` : depth > 0 ? `L${depth} component` : "";
|
|
7176
|
-
const textValue =
|
|
7340
|
+
const textValue = `${attr} ${friendlyLabel} ${badgeText}`.trim();
|
|
7177
7341
|
return /* @__PURE__ */ jsx(ComboboxOption, { value: attr, textValue, children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
|
|
7178
|
-
/* @__PURE__ */
|
|
7342
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
7343
|
+
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: attr === selectedAttribute ? "bold" : "regular", children: friendlyLabel !== attr ? friendlyLabel : attr }),
|
|
7344
|
+
friendlyLabel !== attr && /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral500", display: "block", children: attr })
|
|
7345
|
+
] }),
|
|
7179
7346
|
rel ? /* @__PURE__ */ jsxs(Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: [
|
|
7180
7347
|
"relation ➔ ",
|
|
7181
7348
|
rel.targetDisplayName
|
|
@@ -7186,15 +7353,19 @@ const BulkUpdater = () => {
|
|
|
7186
7353
|
] }) : null
|
|
7187
7354
|
] }) }, attr);
|
|
7188
7355
|
});
|
|
7189
|
-
}, [depthFilteredAttributes,
|
|
7356
|
+
}, [depthFilteredAttributes, getEffectiveRelMeta, selectedAttribute, componentDepth, attributesMeta]);
|
|
7190
7357
|
const memoizedSearchComboboxOptions = useMemo(() => {
|
|
7191
7358
|
return /* @__PURE__ */ jsx(Fragment, { children: depthFilteredAttributes.map((attr) => {
|
|
7192
|
-
const rel =
|
|
7359
|
+
const rel = getEffectiveRelMeta(attr);
|
|
7193
7360
|
const depth = getAttrDepth(attr);
|
|
7361
|
+
const friendlyLabel = formatAttributeHeaderLabel(attr);
|
|
7194
7362
|
const badgeText = rel ? `relation ${rel.targetDisplayName}` : depth > 0 ? `L${depth} component` : "";
|
|
7195
|
-
const textValue =
|
|
7363
|
+
const textValue = `${attr} ${friendlyLabel} ${badgeText}`.trim();
|
|
7196
7364
|
return /* @__PURE__ */ jsx(ComboboxOption, { value: attr, textValue, children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
|
|
7197
|
-
/* @__PURE__ */
|
|
7365
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
7366
|
+
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: attr === searchAttribute ? "bold" : "regular", children: friendlyLabel !== attr ? friendlyLabel : attr }),
|
|
7367
|
+
friendlyLabel !== attr && /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral500", display: "block", children: attr })
|
|
7368
|
+
] }),
|
|
7198
7369
|
rel ? /* @__PURE__ */ jsxs(Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: [
|
|
7199
7370
|
"relation ➔ ",
|
|
7200
7371
|
rel.targetDisplayName
|
|
@@ -7205,7 +7376,7 @@ const BulkUpdater = () => {
|
|
|
7205
7376
|
] }) : null
|
|
7206
7377
|
] }) }, `search_${attr}`);
|
|
7207
7378
|
}) });
|
|
7208
|
-
}, [depthFilteredAttributes,
|
|
7379
|
+
}, [depthFilteredAttributes, getEffectiveRelMeta, searchAttribute, selectedAttribute, componentDepth, attributesMeta]);
|
|
7209
7380
|
const handleSearchAttributeChange = (newAttr) => {
|
|
7210
7381
|
const finalAttr = newAttr === "__default__" ? "" : newAttr;
|
|
7211
7382
|
setSearchAttribute(finalAttr);
|
|
@@ -7308,6 +7479,7 @@ const BulkUpdater = () => {
|
|
|
7308
7479
|
if (!obj || typeof obj !== "object") return false;
|
|
7309
7480
|
if (testString(obj.name)) return true;
|
|
7310
7481
|
if (testString(obj.title)) return true;
|
|
7482
|
+
if (testString(obj.authorName)) return true;
|
|
7311
7483
|
if (testString(obj.email)) return true;
|
|
7312
7484
|
if (testString(obj.username)) return true;
|
|
7313
7485
|
if (testString(obj.documentId)) return true;
|
|
@@ -8565,13 +8737,13 @@ const BulkUpdater = () => {
|
|
|
8565
8737
|
]
|
|
8566
8738
|
}
|
|
8567
8739
|
) }),
|
|
8568
|
-
(filterOperator === "equals" || filterOperator === "contains" || filterOperator === "starts_with") && /* @__PURE__ */ jsx(Box, { style: { flex: 1, minWidth: 200 }, children: effectiveSearchAttribute &&
|
|
8569
|
-
/* @__PURE__ */ jsx(Field.Label, { children: `Target ${
|
|
8740
|
+
(filterOperator === "equals" || filterOperator === "contains" || filterOperator === "starts_with") && /* @__PURE__ */ jsx(Box, { style: { flex: 1, minWidth: 200 }, children: effectiveSearchAttribute && getEffectiveRelMeta(effectiveSearchAttribute) ? /* @__PURE__ */ jsxs(Field.Root, { children: [
|
|
8741
|
+
/* @__PURE__ */ jsx(Field.Label, { children: `Target ${getEffectiveRelMeta(effectiveSearchAttribute).targetDisplayName} Relation` }),
|
|
8570
8742
|
/* @__PURE__ */ jsx(
|
|
8571
8743
|
Combobox,
|
|
8572
8744
|
{
|
|
8573
8745
|
autocomplete: { type: "list", filter: "contains" },
|
|
8574
|
-
placeholder: searchRelationOptionsLoading ? "Loading entities..." : `Search & pick ${
|
|
8746
|
+
placeholder: searchRelationOptionsLoading ? "Loading entities..." : `Search & pick ${getEffectiveRelMeta(effectiveSearchAttribute).targetDisplayName} or type text...`,
|
|
8575
8747
|
value: filterQuery,
|
|
8576
8748
|
onClear: () => setFilterQuery(""),
|
|
8577
8749
|
onChange: (val) => {
|
|
@@ -9214,7 +9386,7 @@ const BulkUpdater = () => {
|
|
|
9214
9386
|
recordEdits,
|
|
9215
9387
|
relationOptions,
|
|
9216
9388
|
relationOptionsLoading,
|
|
9217
|
-
relationIsMulti: Boolean(
|
|
9389
|
+
relationIsMulti: Boolean(getEffectiveRelMeta(selectedAttribute)?.isMulti),
|
|
9218
9390
|
validationRules,
|
|
9219
9391
|
onCommitEdit: handleGridCellCommit,
|
|
9220
9392
|
onResetEdit: handleGridCellReset
|
|
@@ -9252,7 +9424,9 @@ const BulkUpdater = () => {
|
|
|
9252
9424
|
onToggleExpandDz,
|
|
9253
9425
|
filterQuery,
|
|
9254
9426
|
gridCtx,
|
|
9255
|
-
cellTooltip
|
|
9427
|
+
cellTooltip,
|
|
9428
|
+
searchRelationOptions,
|
|
9429
|
+
relationOptions
|
|
9256
9430
|
) }, colDef.key);
|
|
9257
9431
|
})
|
|
9258
9432
|
}
|
|
@@ -9284,7 +9458,7 @@ const BulkUpdater = () => {
|
|
|
9284
9458
|
recordEdits,
|
|
9285
9459
|
relationOptions,
|
|
9286
9460
|
relationOptionsLoading,
|
|
9287
|
-
relationIsMulti: Boolean(
|
|
9461
|
+
relationIsMulti: Boolean(getEffectiveRelMeta(selectedAttribute)?.isMulti),
|
|
9288
9462
|
validationRules,
|
|
9289
9463
|
onToggleDzBlock: toggleDzBlock,
|
|
9290
9464
|
onCommitEdit: handleGridCellCommit,
|
|
@@ -9477,28 +9651,28 @@ const BulkUpdater = () => {
|
|
|
9477
9651
|
)
|
|
9478
9652
|
] })
|
|
9479
9653
|
}
|
|
9480
|
-
) :
|
|
9654
|
+
) : getEffectiveRelMeta(selectedAttribute) ? /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, style: { width: "100%" }, children: [
|
|
9481
9655
|
/* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", wrap: "wrap", children: [
|
|
9482
9656
|
/* @__PURE__ */ jsxs(Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral700", children: [
|
|
9483
9657
|
"Target ",
|
|
9484
|
-
|
|
9658
|
+
getEffectiveRelMeta(selectedAttribute).targetDisplayName,
|
|
9485
9659
|
" Relation:"
|
|
9486
9660
|
] }),
|
|
9487
9661
|
/* @__PURE__ */ jsxs(Badge, { backgroundColor: "secondary100", textColor: "secondary700", children: [
|
|
9488
|
-
|
|
9662
|
+
getEffectiveRelMeta(selectedAttribute).relationType,
|
|
9489
9663
|
" → ",
|
|
9490
|
-
|
|
9664
|
+
getEffectiveRelMeta(selectedAttribute).targetDisplayName
|
|
9491
9665
|
] }),
|
|
9492
|
-
|
|
9666
|
+
getEffectiveRelMeta(selectedAttribute).isMulti && /* @__PURE__ */ jsx(Badge, { backgroundColor: "primary100", textColor: "primary700", children: "Multi-Relation" })
|
|
9493
9667
|
] }),
|
|
9494
9668
|
/* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", style: { width: "100%" }, children: [
|
|
9495
9669
|
/* @__PURE__ */ jsx(Box, { style: { flex: 1, minWidth: 200 }, children: /* @__PURE__ */ jsxs(Field.Root, { children: [
|
|
9496
|
-
/* @__PURE__ */ jsx(Field.Label, { children: `Choose ${
|
|
9670
|
+
/* @__PURE__ */ jsx(Field.Label, { children: `Choose ${getEffectiveRelMeta(selectedAttribute).targetDisplayName}` }),
|
|
9497
9671
|
/* @__PURE__ */ jsxs(
|
|
9498
9672
|
Combobox,
|
|
9499
9673
|
{
|
|
9500
9674
|
autocomplete: { type: "list", filter: "contains" },
|
|
9501
|
-
placeholder: relationOptionsLoading ? "Loading entities..." : `Search & pick ${
|
|
9675
|
+
placeholder: relationOptionsLoading ? "Loading entities..." : `Search & pick ${getEffectiveRelMeta(selectedAttribute).targetDisplayName}...`,
|
|
9502
9676
|
value: selectedRelationDocId,
|
|
9503
9677
|
onChange: (val) => {
|
|
9504
9678
|
const docId = val ? String(val) : "";
|
|
@@ -9517,7 +9691,7 @@ const BulkUpdater = () => {
|
|
|
9517
9691
|
}
|
|
9518
9692
|
)
|
|
9519
9693
|
] }) }),
|
|
9520
|
-
|
|
9694
|
+
getEffectiveRelMeta(selectedAttribute).isMulti && /* @__PURE__ */ jsx(Box, { style: { width: 170 }, children: /* @__PURE__ */ jsxs(
|
|
9521
9695
|
SingleSelect,
|
|
9522
9696
|
{
|
|
9523
9697
|
label: "Action Mode",
|
|
@@ -10216,8 +10390,8 @@ const BulkUpdater = () => {
|
|
|
10216
10390
|
" heterogeneous edits across ",
|
|
10217
10391
|
gridSerialized.targets.length,
|
|
10218
10392
|
" records)"
|
|
10219
|
-
] }) :
|
|
10220
|
-
|
|
10393
|
+
] }) : getEffectiveRelMeta(selectedAttribute) ? /* @__PURE__ */ jsx("span", { children: selectedRelationDocId === "__clear__" ? /* @__PURE__ */ jsx(Badge, { backgroundColor: "danger100", textColor: "danger700", children: "Clear / Unlink Relation" }) : /* @__PURE__ */ jsxs(Badge, { backgroundColor: "secondary100", textColor: "secondary700", children: [
|
|
10394
|
+
getEffectiveRelMeta(selectedAttribute).isMulti ? `[${relationMode.toUpperCase()}] ` : "",
|
|
10221
10395
|
relationOptions.find((o) => o.documentId === selectedRelationDocId)?.label || selectedRelationDocId || "(none selected)"
|
|
10222
10396
|
] }) }) : useRegex ? /* @__PURE__ */ jsxs("span", { children: [
|
|
10223
10397
|
"Replace ",
|
|
@@ -10839,7 +11013,7 @@ const BulkUpdater = () => {
|
|
|
10839
11013
|
editMode: gridEditMode ? "grid" : "common",
|
|
10840
11014
|
publishOnApproval,
|
|
10841
11015
|
lifecycleStats: selectedLifecycleStats,
|
|
10842
|
-
targetValueDisplay: gridEditMode ? `Grid Editing (${gridSerialized.totalEditCount} edits across ${gridSerialized.targets.length} records)` :
|
|
11016
|
+
targetValueDisplay: gridEditMode ? `Grid Editing (${gridSerialized.totalEditCount} edits across ${gridSerialized.targets.length} records)` : getEffectiveRelMeta(selectedAttribute) ? selectedRelationDocId === "__clear__" ? "Clear / Unlink Relation" : relationOptions.find((o) => o.documentId === selectedRelationDocId)?.label || selectedRelationDocId || "(none)" : useRegex ? `Replace /${regexPattern}/g with "${attributeValue}"` : attributeValue
|
|
10843
11017
|
}
|
|
10844
11018
|
),
|
|
10845
11019
|
/* @__PURE__ */ jsx(
|
|
@@ -10870,6 +11044,7 @@ const BulkUpdater = () => {
|
|
|
10870
11044
|
};
|
|
10871
11045
|
export {
|
|
10872
11046
|
BulkUpdater as default,
|
|
11047
|
+
formatAttributeHeaderLabel,
|
|
10873
11048
|
formatComponentName,
|
|
10874
11049
|
formatDisplayValue,
|
|
10875
11050
|
formatFullTooltipValue,
|
|
@@ -10881,6 +11056,9 @@ export {
|
|
|
10881
11056
|
getNestedValue,
|
|
10882
11057
|
getPropertyValue,
|
|
10883
11058
|
getSortOptionsForCollection,
|
|
10884
|
-
parseDynamicZonePath
|
|
11059
|
+
parseDynamicZonePath,
|
|
11060
|
+
registerRelationOptions,
|
|
11061
|
+
resolveEffectiveRelationMeta,
|
|
11062
|
+
resolveEntityLabel
|
|
10885
11063
|
};
|
|
10886
|
-
//# sourceMappingURL=BulkUpdater-
|
|
11064
|
+
//# sourceMappingURL=BulkUpdater-CFStXO-q.mjs.map
|