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
|
@@ -5,7 +5,7 @@ const React = require("react");
|
|
|
5
5
|
const admin = require("@strapi/strapi/admin");
|
|
6
6
|
const designSystem = require("@strapi/design-system");
|
|
7
7
|
const icons = require("@strapi/icons");
|
|
8
|
-
const ValidationRulesTab = require("./ValidationRulesTab-
|
|
8
|
+
const ValidationRulesTab = require("./ValidationRulesTab-Cs0YDlMx.js");
|
|
9
9
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
10
10
|
const React__default = /* @__PURE__ */ _interopDefault(React);
|
|
11
11
|
function parseCsvRows(csvText) {
|
|
@@ -537,6 +537,113 @@ function areClientValuesEqual(a, b) {
|
|
|
537
537
|
}
|
|
538
538
|
return String(na) === String(nb);
|
|
539
539
|
}
|
|
540
|
+
const relationLabelRegistry = /* @__PURE__ */ new Map();
|
|
541
|
+
function registerRelationLabel(key, label) {
|
|
542
|
+
if (key !== void 0 && key !== null && label && typeof label === "string" && label.trim()) {
|
|
543
|
+
relationLabelRegistry.set(String(key).trim(), label.trim());
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
function registerRelationOptions(options) {
|
|
547
|
+
if (Array.isArray(options)) {
|
|
548
|
+
for (const opt of options) {
|
|
549
|
+
if (opt && opt.label) {
|
|
550
|
+
if (opt.documentId) registerRelationLabel(opt.documentId, opt.label);
|
|
551
|
+
if (opt.id !== void 0 && opt.id !== null) registerRelationLabel(opt.id, opt.label);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
function getCachedRelationLabel(key) {
|
|
557
|
+
if (key === void 0 || key === null) return void 0;
|
|
558
|
+
return relationLabelRegistry.get(String(key).trim());
|
|
559
|
+
}
|
|
560
|
+
function resolveEntityLabel(item, options) {
|
|
561
|
+
if (item === void 0 || item === null) return "";
|
|
562
|
+
if (typeof item !== "object") {
|
|
563
|
+
const s = String(item).trim();
|
|
564
|
+
if (options && Array.isArray(options)) {
|
|
565
|
+
const match = options.find((o) => o.documentId === s || String(o.id) === s);
|
|
566
|
+
if (match?.label) return match.label.trim();
|
|
567
|
+
}
|
|
568
|
+
const cached = getCachedRelationLabel(s);
|
|
569
|
+
if (cached) return cached;
|
|
570
|
+
return s;
|
|
571
|
+
}
|
|
572
|
+
if (item.label && typeof item.label === "string" && item.label.trim()) {
|
|
573
|
+
return item.label.trim();
|
|
574
|
+
}
|
|
575
|
+
const candidateFields = [
|
|
576
|
+
"name",
|
|
577
|
+
"title",
|
|
578
|
+
"authorName",
|
|
579
|
+
"label",
|
|
580
|
+
"heading",
|
|
581
|
+
"subject",
|
|
582
|
+
"fullName",
|
|
583
|
+
"username",
|
|
584
|
+
"email",
|
|
585
|
+
"slug"
|
|
586
|
+
];
|
|
587
|
+
for (const field of candidateFields) {
|
|
588
|
+
if (item[field] !== void 0 && item[field] !== null && String(item[field]).trim() !== "") {
|
|
589
|
+
const resolved = String(item[field]).trim();
|
|
590
|
+
if (item.documentId) registerRelationLabel(item.documentId, resolved);
|
|
591
|
+
if (item.id !== void 0 && item.id !== null) registerRelationLabel(item.id, resolved);
|
|
592
|
+
return resolved;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
if (item.firstname || item.lastname) {
|
|
596
|
+
const fn = [item.firstname, item.lastname].filter(Boolean).join(" ").trim();
|
|
597
|
+
if (fn) {
|
|
598
|
+
if (item.documentId) registerRelationLabel(item.documentId, fn);
|
|
599
|
+
if (item.id !== void 0 && item.id !== null) registerRelationLabel(item.id, fn);
|
|
600
|
+
return fn;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
const systemKeys = /* @__PURE__ */ new Set([
|
|
604
|
+
"id",
|
|
605
|
+
"documentId",
|
|
606
|
+
"createdAt",
|
|
607
|
+
"updatedAt",
|
|
608
|
+
"publishedAt",
|
|
609
|
+
"locale",
|
|
610
|
+
"createdBy",
|
|
611
|
+
"updatedBy",
|
|
612
|
+
"__component",
|
|
613
|
+
"isRelation",
|
|
614
|
+
"relationType",
|
|
615
|
+
"targetUid",
|
|
616
|
+
"targetDisplayName",
|
|
617
|
+
"isMulti",
|
|
618
|
+
"mode",
|
|
619
|
+
"documentIds"
|
|
620
|
+
]);
|
|
621
|
+
for (const [k, v] of Object.entries(item)) {
|
|
622
|
+
if (!systemKeys.has(k) && typeof v === "string" && v.trim() !== "") {
|
|
623
|
+
const resolved = v.trim();
|
|
624
|
+
if (item.documentId) registerRelationLabel(item.documentId, resolved);
|
|
625
|
+
if (item.id !== void 0 && item.id !== null) registerRelationLabel(item.id, resolved);
|
|
626
|
+
return resolved;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
if (item.documentId) {
|
|
630
|
+
if (options && Array.isArray(options)) {
|
|
631
|
+
const match = options.find((o) => o.documentId === item.documentId);
|
|
632
|
+
if (match?.label) return match.label.trim();
|
|
633
|
+
}
|
|
634
|
+
const cached = getCachedRelationLabel(item.documentId);
|
|
635
|
+
if (cached) return cached;
|
|
636
|
+
}
|
|
637
|
+
if (item.id !== void 0 && item.id !== null) {
|
|
638
|
+
if (options && Array.isArray(options)) {
|
|
639
|
+
const match = options.find((o) => String(o.id) === String(item.id));
|
|
640
|
+
if (match?.label) return match.label.trim();
|
|
641
|
+
}
|
|
642
|
+
const cached = getCachedRelationLabel(item.id);
|
|
643
|
+
if (cached) return cached;
|
|
644
|
+
}
|
|
645
|
+
return item.documentId || (item.id !== void 0 && item.id !== null ? `Entry #${item.id}` : JSON.stringify(item));
|
|
646
|
+
}
|
|
540
647
|
function extractRelationEditCommand(rawVal, currentDisplayVal, isMulti = false) {
|
|
541
648
|
if (rawVal && typeof rawVal === "object" && !Array.isArray(rawVal) && rawVal.mode) {
|
|
542
649
|
return {
|
|
@@ -549,14 +656,14 @@ function extractRelationEditCommand(rawVal, currentDisplayVal, isMulti = false)
|
|
|
549
656
|
return {
|
|
550
657
|
mode: "set",
|
|
551
658
|
documentIds: rawVal.map((r) => r?.documentId).filter(Boolean),
|
|
552
|
-
label: rawVal.map((r) => r
|
|
659
|
+
label: rawVal.map((r) => resolveEntityLabel(r)).filter(Boolean).join(", ")
|
|
553
660
|
};
|
|
554
661
|
}
|
|
555
662
|
if (rawVal && typeof rawVal === "object" && rawVal.documentId) {
|
|
556
663
|
return {
|
|
557
664
|
mode: "set",
|
|
558
665
|
documentIds: [rawVal.documentId],
|
|
559
|
-
label: rawVal
|
|
666
|
+
label: resolveEntityLabel(rawVal)
|
|
560
667
|
};
|
|
561
668
|
}
|
|
562
669
|
if (typeof rawVal === "string") {
|
|
@@ -850,7 +957,10 @@ function getAllNestedValues(obj, path, availableAttributes) {
|
|
|
850
957
|
rootTarget.forEach((item, idx) => {
|
|
851
958
|
if (!item || typeof item !== "object") return;
|
|
852
959
|
if (parsed.targetIndex !== void 0 && idx !== parsed.targetIndex) return;
|
|
853
|
-
|
|
960
|
+
const itemComp = item.__component;
|
|
961
|
+
const targetComp = parsed.targetComponentUid;
|
|
962
|
+
const compMatches = !targetComp || itemComp === targetComp || itemComp && (itemComp.toLowerCase() === targetComp.toLowerCase() || itemComp.split(".")[1]?.toLowerCase() === targetComp.toLowerCase() || itemComp.toLowerCase().replace(/[-_]/g, "") === targetComp.toLowerCase().replace(/[-_]/g, ""));
|
|
963
|
+
if (!compMatches) return;
|
|
854
964
|
const subPath = tail.join(".");
|
|
855
965
|
const scopedPath = item.__component ? `${head}[${item.__component}].${subPath}` : "";
|
|
856
966
|
const isSupported = availableAttributes ? availableAttributes.includes(scopedPath) : false;
|
|
@@ -905,6 +1015,66 @@ function getAllNestedValues(obj, path, availableAttributes) {
|
|
|
905
1015
|
}
|
|
906
1016
|
return [];
|
|
907
1017
|
}
|
|
1018
|
+
function formatAttributeHeaderLabel(attr) {
|
|
1019
|
+
if (!attr) return "";
|
|
1020
|
+
if (attr === "updated_at" || attr === "updatedAt") return "Updated At";
|
|
1021
|
+
if (attr === "created_at" || attr === "createdAt") return "Created At";
|
|
1022
|
+
if (attr === "published_at" || attr === "publishedAt") return "Published At";
|
|
1023
|
+
const bracketMatch = attr.match(/^([^.[]+)\[([^\]]+)\](?:\.(.+))?$/);
|
|
1024
|
+
if (bracketMatch) {
|
|
1025
|
+
const root = bracketMatch[1].replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
|
|
1026
|
+
const comp = formatComponentName(bracketMatch[2]);
|
|
1027
|
+
const sub = bracketMatch[3] ? bracketMatch[3].split(".").map((s) => s.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase())).join(" > ") : "";
|
|
1028
|
+
return sub ? `${root} [${comp}] > ${sub}` : `${root} [${comp}]`;
|
|
1029
|
+
}
|
|
1030
|
+
if (attr.includes(".")) {
|
|
1031
|
+
return attr.split(".").map((s) => s.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase())).join(" > ");
|
|
1032
|
+
}
|
|
1033
|
+
return attr.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
|
|
1034
|
+
}
|
|
1035
|
+
function resolveEffectiveRelationMeta(attr, colRelations, globalRelationsMeta) {
|
|
1036
|
+
if (!attr) return void 0;
|
|
1037
|
+
const rels = colRelations;
|
|
1038
|
+
if (rels) {
|
|
1039
|
+
if (rels[attr]) return rels[attr];
|
|
1040
|
+
const norm = attr.toLowerCase().replace(/[-_ /]/g, "");
|
|
1041
|
+
for (const k of Object.keys(rels)) {
|
|
1042
|
+
if (k.toLowerCase().replace(/[-_ /]/g, "") === norm) return rels[k];
|
|
1043
|
+
}
|
|
1044
|
+
for (const k of Object.keys(rels)) {
|
|
1045
|
+
if (k.startsWith(`${attr}.`) || k.toLowerCase().startsWith(`${attr.toLowerCase()}.`)) {
|
|
1046
|
+
return rels[k];
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
const attrLeaf = attr.includes(".") ? attr.split(".").pop() : "";
|
|
1050
|
+
for (const [k, rel] of Object.entries(rels)) {
|
|
1051
|
+
const bracketMatch = k.match(/\[([^\]]+)\](?:\.(.+))?/);
|
|
1052
|
+
if (bracketMatch) {
|
|
1053
|
+
const compUid = bracketMatch[1];
|
|
1054
|
+
const compClean = compUid.includes(".") ? compUid.split(".")[1] : compUid;
|
|
1055
|
+
const normComp = compClean.toLowerCase().replace(/[-_ /]/g, "");
|
|
1056
|
+
const subPath = bracketMatch[2] || "";
|
|
1057
|
+
const normSub = subPath.toLowerCase().replace(/[-_ /]/g, "");
|
|
1058
|
+
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()))) {
|
|
1059
|
+
return rel;
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
for (const [k, rel] of Object.entries(rels)) {
|
|
1064
|
+
if (k.endsWith(`.${attr}`) || k.toLowerCase().endsWith(`.${attr.toLowerCase()}`)) {
|
|
1065
|
+
return rel;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
if (globalRelationsMeta) {
|
|
1070
|
+
if (globalRelationsMeta[attr]) return globalRelationsMeta[attr];
|
|
1071
|
+
const norm = attr.toLowerCase().replace(/[-_ /]/g, "");
|
|
1072
|
+
for (const k of Object.keys(globalRelationsMeta)) {
|
|
1073
|
+
if (k.toLowerCase().replace(/[-_ /]/g, "") === norm) return globalRelationsMeta[k];
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
return void 0;
|
|
1077
|
+
}
|
|
908
1078
|
function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribute) {
|
|
909
1079
|
const cols = [
|
|
910
1080
|
{
|
|
@@ -925,26 +1095,7 @@ function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribut
|
|
|
925
1095
|
if (attr === "name" || attr === "title" || attr === selectedAttribute || searchAttribute && attr === searchAttribute) {
|
|
926
1096
|
return;
|
|
927
1097
|
}
|
|
928
|
-
|
|
929
|
-
if (attr === "updated_at" || attr === "updatedAt") {
|
|
930
|
-
formattedLabel = "Updated At";
|
|
931
|
-
} else if (attr === "created_at" || attr === "createdAt") {
|
|
932
|
-
formattedLabel = "Created At";
|
|
933
|
-
} else if (attr === "published_at" || attr === "publishedAt") {
|
|
934
|
-
formattedLabel = "Published At";
|
|
935
|
-
} else {
|
|
936
|
-
const bracketMatch = attr.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
|
|
937
|
-
if (bracketMatch) {
|
|
938
|
-
const root = bracketMatch[1].charAt(0).toUpperCase() + bracketMatch[1].slice(1);
|
|
939
|
-
const comp = formatComponentName(bracketMatch[2]);
|
|
940
|
-
const sub = bracketMatch[3].split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
941
|
-
formattedLabel = `${root} [${comp}] > ${sub}`;
|
|
942
|
-
} else if (attr.includes(".")) {
|
|
943
|
-
formattedLabel = attr.split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
944
|
-
} else {
|
|
945
|
-
formattedLabel = attr.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
|
|
946
|
-
}
|
|
947
|
-
}
|
|
1098
|
+
const formattedLabel = formatAttributeHeaderLabel(attr);
|
|
948
1099
|
cols.push({
|
|
949
1100
|
key: `attr_${attr}`,
|
|
950
1101
|
label: formattedLabel,
|
|
@@ -980,16 +1131,7 @@ function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribut
|
|
|
980
1131
|
});
|
|
981
1132
|
}
|
|
982
1133
|
if (searchAttribute && searchAttribute !== selectedAttribute) {
|
|
983
|
-
|
|
984
|
-
const bracketMatch = searchAttribute.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
|
|
985
|
-
if (bracketMatch) {
|
|
986
|
-
const root = bracketMatch[1].charAt(0).toUpperCase() + bracketMatch[1].slice(1);
|
|
987
|
-
const comp = formatComponentName(bracketMatch[2]);
|
|
988
|
-
const sub = bracketMatch[3].split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
989
|
-
formattedSearchLabel = `${root} [${comp}] > ${sub}`;
|
|
990
|
-
} else if (searchAttribute.includes(".")) {
|
|
991
|
-
formattedSearchLabel = searchAttribute.split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
992
|
-
}
|
|
1134
|
+
const formattedSearchLabel = formatAttributeHeaderLabel(searchAttribute);
|
|
993
1135
|
cols.push({
|
|
994
1136
|
key: "search_attr",
|
|
995
1137
|
label: `Search: "${formattedSearchLabel}"`,
|
|
@@ -998,18 +1140,7 @@ function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribut
|
|
|
998
1140
|
});
|
|
999
1141
|
}
|
|
1000
1142
|
if (selectedAttribute && selectedAttribute.trim()) {
|
|
1001
|
-
|
|
1002
|
-
const bracketMatch = selectedAttribute.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
|
|
1003
|
-
if (bracketMatch) {
|
|
1004
|
-
const root = bracketMatch[1].charAt(0).toUpperCase() + bracketMatch[1].slice(1);
|
|
1005
|
-
const comp = formatComponentName(bracketMatch[2]);
|
|
1006
|
-
const sub = bracketMatch[3].split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
1007
|
-
formattedTargetLabel = `${root} [${comp}] > ${sub}`;
|
|
1008
|
-
} else if (selectedAttribute.includes(".")) {
|
|
1009
|
-
formattedTargetLabel = selectedAttribute.split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
1010
|
-
} else {
|
|
1011
|
-
formattedTargetLabel = selectedAttribute.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
|
|
1012
|
-
}
|
|
1143
|
+
const formattedTargetLabel = formatAttributeHeaderLabel(selectedAttribute);
|
|
1013
1144
|
cols.push({
|
|
1014
1145
|
key: "current_attr",
|
|
1015
1146
|
label: `Current Value: "${formattedTargetLabel}"`,
|
|
@@ -1125,18 +1256,21 @@ function formatFullTooltipValue(val) {
|
|
|
1125
1256
|
return isNaN(val.getTime()) ? "(invalid date)" : val.toISOString();
|
|
1126
1257
|
}
|
|
1127
1258
|
if (typeof val === "string") {
|
|
1259
|
+
const cached = getCachedRelationLabel(val);
|
|
1260
|
+
if (cached) return cached;
|
|
1128
1261
|
return val;
|
|
1129
1262
|
}
|
|
1130
1263
|
if (Array.isArray(val)) {
|
|
1131
1264
|
if (val.length === 0) return "(empty array)";
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
return String(val);
|
|
1136
|
-
}
|
|
1265
|
+
return val.map(
|
|
1266
|
+
(item) => typeof item === "object" && item !== null ? resolveEntityLabel(item) : getCachedRelationLabel(item) || String(item)
|
|
1267
|
+
).join(", ");
|
|
1137
1268
|
}
|
|
1138
1269
|
if (typeof val === "object") {
|
|
1139
1270
|
if (val.isRelation && val.display) return val.display;
|
|
1271
|
+
if (val.documentId || val.authorName || val.name || val.title) {
|
|
1272
|
+
return resolveEntityLabel(val);
|
|
1273
|
+
}
|
|
1140
1274
|
try {
|
|
1141
1275
|
return JSON.stringify(val, null, 2);
|
|
1142
1276
|
} catch {
|
|
@@ -1151,7 +1285,7 @@ function getCellTooltipText(colDef, entry, colAttributes, selectedAttribute, sea
|
|
|
1151
1285
|
case "select":
|
|
1152
1286
|
return void 0;
|
|
1153
1287
|
case "identifier": {
|
|
1154
|
-
const mainText = entry
|
|
1288
|
+
const mainText = resolveEntityLabel(entry) || `Entry #${entry.id || entry.documentId}`;
|
|
1155
1289
|
const parts = [String(mainText)];
|
|
1156
1290
|
if (entry.documentId) parts.push(`Document ID: ${entry.documentId}`);
|
|
1157
1291
|
if (entry.id && String(entry.id) !== String(entry.documentId)) parts.push(`ID: ${entry.id}`);
|
|
@@ -1488,19 +1622,28 @@ function CsvManagerTab() {
|
|
|
1488
1622
|
}
|
|
1489
1623
|
};
|
|
1490
1624
|
const getAttrDepth = (attr) => attributesMeta[attr]?.depth ?? (attr.includes(".") ? attr.split(".").length - 1 : 0);
|
|
1625
|
+
const getEffectiveRelMeta = React.useCallback(
|
|
1626
|
+
(attr) => {
|
|
1627
|
+
return resolveEffectiveRelationMeta(attr, selectedCol?.relations, relationsMeta);
|
|
1628
|
+
},
|
|
1629
|
+
[selectedCol, relationsMeta]
|
|
1630
|
+
);
|
|
1491
1631
|
React.useEffect(() => {
|
|
1492
|
-
|
|
1493
|
-
|
|
1632
|
+
const activeRel = getEffectiveRelMeta(searchAttribute);
|
|
1633
|
+
if (searchAttribute && activeRel) {
|
|
1634
|
+
fetchSearchRelationOptions(activeRel.targetUid);
|
|
1494
1635
|
} else {
|
|
1495
1636
|
setSearchRelationOptions([]);
|
|
1496
1637
|
}
|
|
1497
|
-
}, [searchAttribute,
|
|
1638
|
+
}, [searchAttribute, getEffectiveRelMeta]);
|
|
1498
1639
|
const fetchSearchRelationOptions = async (targetUid) => {
|
|
1499
1640
|
try {
|
|
1500
1641
|
setSearchRelationOptionsLoading(true);
|
|
1501
1642
|
const res = await get(`/bulk-updater/relation-options?targetUid=${encodeURIComponent(targetUid)}`);
|
|
1502
1643
|
if (res.data && res.data.success) {
|
|
1503
|
-
|
|
1644
|
+
const opts = res.data.options || [];
|
|
1645
|
+
setSearchRelationOptions(opts);
|
|
1646
|
+
registerRelationOptions(opts);
|
|
1504
1647
|
}
|
|
1505
1648
|
} catch {
|
|
1506
1649
|
setSearchRelationOptions([]);
|
|
@@ -2187,12 +2330,16 @@ function CsvManagerTab() {
|
|
|
2187
2330
|
}
|
|
2188
2331
|
},
|
|
2189
2332
|
children: (selectedCol?.attributes || []).map((attr) => {
|
|
2190
|
-
const rel =
|
|
2333
|
+
const rel = getEffectiveRelMeta(attr);
|
|
2191
2334
|
const depth = getAttrDepth(attr);
|
|
2335
|
+
const friendlyLabel = formatAttributeHeaderLabel(attr);
|
|
2192
2336
|
const badgeText = rel ? `relation ${rel.targetDisplayName}` : depth > 0 ? `L${depth} component` : "";
|
|
2193
|
-
const textValue =
|
|
2337
|
+
const textValue = `${attr} ${friendlyLabel} ${badgeText}`.trim();
|
|
2194
2338
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: attr, textValue, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
|
|
2195
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2339
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
2340
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: attr === searchAttribute ? "bold" : "regular", children: friendlyLabel !== attr ? friendlyLabel : attr }),
|
|
2341
|
+
friendlyLabel !== attr && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", display: "block", children: attr })
|
|
2342
|
+
] }),
|
|
2196
2343
|
rel ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: [
|
|
2197
2344
|
"relation ➔ ",
|
|
2198
2345
|
rel.targetDisplayName
|
|
@@ -2228,11 +2375,11 @@ function CsvManagerTab() {
|
|
|
2228
2375
|
] }),
|
|
2229
2376
|
(filterOperator === "equals" || filterOperator === "contains" || filterOperator === "starts_with") && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: 1, minWidth: 200 }, children: [
|
|
2230
2377
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", marginBottom: 1, display: "block", children: searchAttribute ? `Value for "${searchAttribute}"` : "Value to match" }),
|
|
2231
|
-
searchAttribute &&
|
|
2378
|
+
searchAttribute && getEffectiveRelMeta(searchAttribute) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2232
2379
|
designSystem.Combobox,
|
|
2233
2380
|
{
|
|
2234
2381
|
autocomplete: { type: "list", filter: "contains" },
|
|
2235
|
-
placeholder: searchRelationOptionsLoading ? "Loading entities..." : `Search & pick ${
|
|
2382
|
+
placeholder: searchRelationOptionsLoading ? "Loading entities..." : `Search & pick ${getEffectiveRelMeta(searchAttribute).targetDisplayName} or type text...`,
|
|
2236
2383
|
value: filterQuery,
|
|
2237
2384
|
onClear: () => setFilterQuery(""),
|
|
2238
2385
|
onChange: (val) => {
|
|
@@ -5935,7 +6082,7 @@ function renderHeaderCell(colDef, col, currentSort, selectedAttribute, searchAtt
|
|
|
5935
6082
|
colDef.key
|
|
5936
6083
|
);
|
|
5937
6084
|
}
|
|
5938
|
-
function formatDisplayValue(val) {
|
|
6085
|
+
function formatDisplayValue(val, options) {
|
|
5939
6086
|
if (val === void 0 || val === null || val === "") {
|
|
5940
6087
|
return "(empty / not set)";
|
|
5941
6088
|
}
|
|
@@ -5951,16 +6098,16 @@ function formatDisplayValue(val) {
|
|
|
5951
6098
|
if (Array.isArray(val)) {
|
|
5952
6099
|
if (val.length === 0) return "(empty / unlinked)";
|
|
5953
6100
|
return val.map(
|
|
5954
|
-
(item) => typeof item === "object" && item !== null ? item
|
|
6101
|
+
(item) => typeof item === "object" && item !== null ? resolveEntityLabel(item, options) : resolveEntityLabel(item, options)
|
|
5955
6102
|
).join(", ");
|
|
5956
6103
|
}
|
|
5957
6104
|
if (typeof val === "object" && val !== null) {
|
|
5958
6105
|
if (val.isRelation && val.display) return val.display;
|
|
5959
|
-
return val
|
|
6106
|
+
return resolveEntityLabel(val, options);
|
|
5960
6107
|
}
|
|
5961
|
-
return
|
|
6108
|
+
return resolveEntityLabel(val, options);
|
|
5962
6109
|
}
|
|
5963
|
-
function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribute, isMatch, hasAttr, isSelected, onToggleSelect, pendingBatches = [], isDzExpanded = false, onToggleExpandDz, filterQuery = "", gridCtx, cellTooltip) {
|
|
6110
|
+
function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribute, isMatch, hasAttr, isSelected, onToggleSelect, pendingBatches = [], isDzExpanded = false, onToggleExpandDz, filterQuery = "", gridCtx, cellTooltip, searchRelOptions, relationOptions) {
|
|
5964
6111
|
switch (colDef.key) {
|
|
5965
6112
|
case "select":
|
|
5966
6113
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5971,7 +6118,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
5971
6118
|
}
|
|
5972
6119
|
);
|
|
5973
6120
|
case "identifier": {
|
|
5974
|
-
const mainText = entry.name || entry.title || `Entry #${entry.id || entry.documentId}`;
|
|
6121
|
+
const mainText = entry.name || entry.title || entry.authorName || resolveEntityLabel(entry, searchRelOptions) || `Entry #${entry.id || entry.documentId}`;
|
|
5975
6122
|
const dzField = Object.keys(entry).find(
|
|
5976
6123
|
(k) => Array.isArray(entry[k]) && entry[k].length > 0 && entry[k].some((item) => item && item.__component)
|
|
5977
6124
|
);
|
|
@@ -6007,7 +6154,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
6007
6154
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "(empty / not set)" });
|
|
6008
6155
|
}
|
|
6009
6156
|
if (matches.length === 1 && !matches[0].componentUid) {
|
|
6010
|
-
const displayStr = formatDisplayValue(matches[0].value);
|
|
6157
|
+
const displayStr = formatDisplayValue(matches[0].value, searchRelOptions);
|
|
6011
6158
|
const isUnset = displayStr === "(empty / not set)" || displayStr === "(empty / unlinked)";
|
|
6012
6159
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6013
6160
|
designSystem.Typography,
|
|
@@ -6029,7 +6176,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
6029
6176
|
}
|
|
6030
6177
|
const qLower = (filterQuery || "").trim().toLowerCase();
|
|
6031
6178
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m) => {
|
|
6032
|
-
const displayStr = formatDisplayValue(m.value);
|
|
6179
|
+
const displayStr = formatDisplayValue(m.value, searchRelOptions);
|
|
6033
6180
|
const isMatchItem = qLower && displayStr.toLowerCase().includes(qLower);
|
|
6034
6181
|
const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
|
|
6035
6182
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -6081,8 +6228,9 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
6081
6228
|
if (matches.length === 0) {
|
|
6082
6229
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "(empty / not set)" });
|
|
6083
6230
|
}
|
|
6231
|
+
const activeRelOpts = gridCtx?.relationOptions || relationOptions || searchRelOptions;
|
|
6084
6232
|
if (matches.length === 1 && !matches[0].componentUid && !matches[0].path.includes("[#")) {
|
|
6085
|
-
const displayStr = formatDisplayValue(matches[0].value);
|
|
6233
|
+
const displayStr = formatDisplayValue(matches[0].value, activeRelOpts);
|
|
6086
6234
|
const isUnset = displayStr === "(empty / not set)" || displayStr === "(empty / unlinked)";
|
|
6087
6235
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6088
6236
|
designSystem.Typography,
|
|
@@ -6102,7 +6250,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
6102
6250
|
);
|
|
6103
6251
|
}
|
|
6104
6252
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m) => {
|
|
6105
|
-
const displayStr = formatDisplayValue(m.value);
|
|
6253
|
+
const displayStr = formatDisplayValue(m.value, activeRelOpts);
|
|
6106
6254
|
const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
|
|
6107
6255
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6108
6256
|
designSystem.Flex,
|
|
@@ -6234,8 +6382,9 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
6234
6382
|
if (matches.length === 0) {
|
|
6235
6383
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "(empty / not set)" });
|
|
6236
6384
|
}
|
|
6385
|
+
const targetRelOpts = gridCtx?.relationOptions || relationOptions || searchRelOptions;
|
|
6237
6386
|
if (matches.length === 1 && !matches[0].componentUid) {
|
|
6238
|
-
const displayStr = formatDisplayValue(matches[0].value);
|
|
6387
|
+
const displayStr = formatDisplayValue(matches[0].value, targetRelOpts);
|
|
6239
6388
|
const isUnset = displayStr === "(empty / not set)" || displayStr === "(empty / unlinked)";
|
|
6240
6389
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6241
6390
|
designSystem.Typography,
|
|
@@ -6255,7 +6404,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
6255
6404
|
);
|
|
6256
6405
|
}
|
|
6257
6406
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m) => {
|
|
6258
|
-
const displayStr = formatDisplayValue(m.value);
|
|
6407
|
+
const displayStr = formatDisplayValue(m.value, targetRelOpts);
|
|
6259
6408
|
const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
|
|
6260
6409
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6261
6410
|
designSystem.Flex,
|
|
@@ -6316,8 +6465,9 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
6316
6465
|
if (matches.length === 0) {
|
|
6317
6466
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "-" });
|
|
6318
6467
|
}
|
|
6468
|
+
const attrRelOpts = attrName === searchAttribute ? searchRelOptions : attrName === selectedAttribute ? gridCtx?.relationOptions || relationOptions : searchRelOptions || relationOptions;
|
|
6319
6469
|
if (matches.length === 1 && !matches[0].componentUid && !matches[0].path.includes("[#")) {
|
|
6320
|
-
const displayStr = formatDisplayValue(matches[0].value);
|
|
6470
|
+
const displayStr = formatDisplayValue(matches[0].value, attrRelOpts);
|
|
6321
6471
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6322
6472
|
designSystem.Typography,
|
|
6323
6473
|
{
|
|
@@ -6329,7 +6479,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
6329
6479
|
);
|
|
6330
6480
|
}
|
|
6331
6481
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m, mIdx) => {
|
|
6332
|
-
const displayStr = formatDisplayValue(m.value);
|
|
6482
|
+
const displayStr = formatDisplayValue(m.value, attrRelOpts);
|
|
6333
6483
|
const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
|
|
6334
6484
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6335
6485
|
designSystem.Flex,
|
|
@@ -6470,7 +6620,9 @@ const BulkUpdater = () => {
|
|
|
6470
6620
|
setRelationOptionsLoading(true);
|
|
6471
6621
|
const res = await get(`/bulk-updater/relation-options?targetUid=${encodeURIComponent(targetUid)}`);
|
|
6472
6622
|
if (res.data && res.data.success) {
|
|
6473
|
-
|
|
6623
|
+
const opts = res.data.options || [];
|
|
6624
|
+
setRelationOptions(opts);
|
|
6625
|
+
registerRelationOptions(opts);
|
|
6474
6626
|
}
|
|
6475
6627
|
} catch {
|
|
6476
6628
|
setRelationOptions([]);
|
|
@@ -6507,7 +6659,9 @@ const BulkUpdater = () => {
|
|
|
6507
6659
|
setSearchRelationOptionsLoading(true);
|
|
6508
6660
|
const res = await get(`/bulk-updater/relation-options?targetUid=${encodeURIComponent(targetUid)}`);
|
|
6509
6661
|
if (res.data && res.data.success) {
|
|
6510
|
-
|
|
6662
|
+
const opts = res.data.options || [];
|
|
6663
|
+
setSearchRelationOptions(opts);
|
|
6664
|
+
registerRelationOptions(opts);
|
|
6511
6665
|
}
|
|
6512
6666
|
} catch {
|
|
6513
6667
|
setSearchRelationOptions([]);
|
|
@@ -6523,13 +6677,6 @@ const BulkUpdater = () => {
|
|
|
6523
6677
|
const [gridFilterModifiedOnly, setGridFilterModifiedOnly] = React.useState(false);
|
|
6524
6678
|
const [validationRules, setValidationRules] = React.useState([]);
|
|
6525
6679
|
const effectiveSearchAttribute = searchAttribute || selectedAttribute;
|
|
6526
|
-
React.useEffect(() => {
|
|
6527
|
-
if (effectiveSearchAttribute && relationsMeta[effectiveSearchAttribute]) {
|
|
6528
|
-
fetchSearchRelationOptions(relationsMeta[effectiveSearchAttribute].targetUid);
|
|
6529
|
-
} else {
|
|
6530
|
-
setSearchRelationOptions([]);
|
|
6531
|
-
}
|
|
6532
|
-
}, [effectiveSearchAttribute, relationsMeta]);
|
|
6533
6680
|
const [filterOperator, setFilterOperator] = React.useState("none");
|
|
6534
6681
|
const [filterQuery, setFilterQuery] = React.useState("");
|
|
6535
6682
|
const [entrySearch, setEntrySearch] = React.useState("");
|
|
@@ -6703,7 +6850,8 @@ const BulkUpdater = () => {
|
|
|
6703
6850
|
}
|
|
6704
6851
|
}
|
|
6705
6852
|
} catch (err) {
|
|
6706
|
-
|
|
6853
|
+
const is403 = err?.response?.status === 403 || err?.status === 403;
|
|
6854
|
+
if (!ValidationRulesTab.isAbortError(err) && !is403) {
|
|
6707
6855
|
toggleNotification({
|
|
6708
6856
|
type: "danger",
|
|
6709
6857
|
message: err?.message || "Failed to load collections data"
|
|
@@ -6939,10 +7087,24 @@ const BulkUpdater = () => {
|
|
|
6939
7087
|
if (!collections.length || !selectedCollectionUid) return null;
|
|
6940
7088
|
return collections.find((c) => c.uid === selectedCollectionUid) || null;
|
|
6941
7089
|
}, [collections, selectedCollectionUid]);
|
|
7090
|
+
const getEffectiveRelMeta = React.useCallback(
|
|
7091
|
+
(attr) => {
|
|
7092
|
+
return resolveEffectiveRelationMeta(attr, selectedCol?.relations, relationsMeta);
|
|
7093
|
+
},
|
|
7094
|
+
[selectedCol, relationsMeta]
|
|
7095
|
+
);
|
|
7096
|
+
React.useEffect(() => {
|
|
7097
|
+
const activeRel = getEffectiveRelMeta(effectiveSearchAttribute);
|
|
7098
|
+
if (effectiveSearchAttribute && activeRel) {
|
|
7099
|
+
fetchSearchRelationOptions(activeRel.targetUid);
|
|
7100
|
+
} else {
|
|
7101
|
+
setSearchRelationOptions([]);
|
|
7102
|
+
}
|
|
7103
|
+
}, [effectiveSearchAttribute, getEffectiveRelMeta]);
|
|
6942
7104
|
const activeAttrMeta = React.useMemo(() => {
|
|
6943
7105
|
if (!selectedAttribute) return void 0;
|
|
6944
7106
|
const base = selectedCol?.attributesMeta?.[selectedAttribute] || attributesMeta[selectedAttribute];
|
|
6945
|
-
const relMeta =
|
|
7107
|
+
const relMeta = getEffectiveRelMeta(selectedAttribute);
|
|
6946
7108
|
if (!base && !relMeta) return void 0;
|
|
6947
7109
|
if (relMeta && (!base || !base.isRelation)) {
|
|
6948
7110
|
return {
|
|
@@ -6953,7 +7115,7 @@ const BulkUpdater = () => {
|
|
|
6953
7115
|
};
|
|
6954
7116
|
}
|
|
6955
7117
|
return base;
|
|
6956
|
-
}, [selectedAttribute, selectedCol, attributesMeta,
|
|
7118
|
+
}, [selectedAttribute, selectedCol, attributesMeta, getEffectiveRelMeta]);
|
|
6957
7119
|
const totalDirtyRecordsCount = React.useMemo(() => Object.keys(gridEdits).length, [gridEdits]);
|
|
6958
7120
|
const totalDirtyCellsCount = React.useMemo(
|
|
6959
7121
|
() => Object.values(gridEdits).reduce(
|
|
@@ -6969,7 +7131,7 @@ const BulkUpdater = () => {
|
|
|
6969
7131
|
const handleGridCellCommit = React__default.default.useCallback(
|
|
6970
7132
|
(entry, colUid, occ, newValue, validationError) => {
|
|
6971
7133
|
const key = `${colUid}${KEY_SEP}${entry.documentId}`;
|
|
6972
|
-
const recordLabel = entry.name || entry.title || entry.email || `Entry #${entry.id || entry.documentId}`;
|
|
7134
|
+
const recordLabel = entry.name || entry.title || entry.authorName || entry.email || `Entry #${entry.id || entry.documentId}`;
|
|
6973
7135
|
setGridEdits((prev) => {
|
|
6974
7136
|
const existingRec = prev[key] || {
|
|
6975
7137
|
uid: colUid,
|
|
@@ -7148,8 +7310,9 @@ const BulkUpdater = () => {
|
|
|
7148
7310
|
}
|
|
7149
7311
|
setSelectedRelationDocId("");
|
|
7150
7312
|
setAttributeValue("");
|
|
7151
|
-
|
|
7152
|
-
|
|
7313
|
+
const relForNewAttr = getEffectiveRelMeta(newAttr);
|
|
7314
|
+
if (newAttr && relForNewAttr) {
|
|
7315
|
+
fetchRelationOptions(relForNewAttr.targetUid);
|
|
7153
7316
|
} else {
|
|
7154
7317
|
setRelationOptions([]);
|
|
7155
7318
|
}
|
|
@@ -7174,12 +7337,16 @@ const BulkUpdater = () => {
|
|
|
7174
7337
|
] }) });
|
|
7175
7338
|
}
|
|
7176
7339
|
return depthFilteredAttributes.map((attr) => {
|
|
7177
|
-
const rel =
|
|
7340
|
+
const rel = getEffectiveRelMeta(attr);
|
|
7178
7341
|
const depth = getAttrDepth(attr);
|
|
7342
|
+
const friendlyLabel = formatAttributeHeaderLabel(attr);
|
|
7179
7343
|
const badgeText = rel ? `relation ${rel.targetDisplayName}` : depth > 0 ? `L${depth} component` : "";
|
|
7180
|
-
const textValue =
|
|
7344
|
+
const textValue = `${attr} ${friendlyLabel} ${badgeText}`.trim();
|
|
7181
7345
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: attr, textValue, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
|
|
7182
|
-
/* @__PURE__ */ jsxRuntime.
|
|
7346
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
7347
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: attr === selectedAttribute ? "bold" : "regular", children: friendlyLabel !== attr ? friendlyLabel : attr }),
|
|
7348
|
+
friendlyLabel !== attr && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", display: "block", children: attr })
|
|
7349
|
+
] }),
|
|
7183
7350
|
rel ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: [
|
|
7184
7351
|
"relation ➔ ",
|
|
7185
7352
|
rel.targetDisplayName
|
|
@@ -7190,15 +7357,19 @@ const BulkUpdater = () => {
|
|
|
7190
7357
|
] }) : null
|
|
7191
7358
|
] }) }, attr);
|
|
7192
7359
|
});
|
|
7193
|
-
}, [depthFilteredAttributes,
|
|
7360
|
+
}, [depthFilteredAttributes, getEffectiveRelMeta, selectedAttribute, componentDepth, attributesMeta]);
|
|
7194
7361
|
const memoizedSearchComboboxOptions = React.useMemo(() => {
|
|
7195
7362
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: depthFilteredAttributes.map((attr) => {
|
|
7196
|
-
const rel =
|
|
7363
|
+
const rel = getEffectiveRelMeta(attr);
|
|
7197
7364
|
const depth = getAttrDepth(attr);
|
|
7365
|
+
const friendlyLabel = formatAttributeHeaderLabel(attr);
|
|
7198
7366
|
const badgeText = rel ? `relation ${rel.targetDisplayName}` : depth > 0 ? `L${depth} component` : "";
|
|
7199
|
-
const textValue =
|
|
7367
|
+
const textValue = `${attr} ${friendlyLabel} ${badgeText}`.trim();
|
|
7200
7368
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: attr, textValue, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
|
|
7201
|
-
/* @__PURE__ */ jsxRuntime.
|
|
7369
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
7370
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: attr === searchAttribute ? "bold" : "regular", children: friendlyLabel !== attr ? friendlyLabel : attr }),
|
|
7371
|
+
friendlyLabel !== attr && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", display: "block", children: attr })
|
|
7372
|
+
] }),
|
|
7202
7373
|
rel ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: [
|
|
7203
7374
|
"relation ➔ ",
|
|
7204
7375
|
rel.targetDisplayName
|
|
@@ -7209,7 +7380,7 @@ const BulkUpdater = () => {
|
|
|
7209
7380
|
] }) : null
|
|
7210
7381
|
] }) }, `search_${attr}`);
|
|
7211
7382
|
}) });
|
|
7212
|
-
}, [depthFilteredAttributes,
|
|
7383
|
+
}, [depthFilteredAttributes, getEffectiveRelMeta, searchAttribute, selectedAttribute, componentDepth, attributesMeta]);
|
|
7213
7384
|
const handleSearchAttributeChange = (newAttr) => {
|
|
7214
7385
|
const finalAttr = newAttr === "__default__" ? "" : newAttr;
|
|
7215
7386
|
setSearchAttribute(finalAttr);
|
|
@@ -7312,6 +7483,7 @@ const BulkUpdater = () => {
|
|
|
7312
7483
|
if (!obj || typeof obj !== "object") return false;
|
|
7313
7484
|
if (testString(obj.name)) return true;
|
|
7314
7485
|
if (testString(obj.title)) return true;
|
|
7486
|
+
if (testString(obj.authorName)) return true;
|
|
7315
7487
|
if (testString(obj.email)) return true;
|
|
7316
7488
|
if (testString(obj.username)) return true;
|
|
7317
7489
|
if (testString(obj.documentId)) return true;
|
|
@@ -8569,13 +8741,13 @@ const BulkUpdater = () => {
|
|
|
8569
8741
|
]
|
|
8570
8742
|
}
|
|
8571
8743
|
) }),
|
|
8572
|
-
(filterOperator === "equals" || filterOperator === "contains" || filterOperator === "starts_with") && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1, minWidth: 200 }, children: effectiveSearchAttribute &&
|
|
8573
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: `Target ${
|
|
8744
|
+
(filterOperator === "equals" || filterOperator === "contains" || filterOperator === "starts_with") && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1, minWidth: 200 }, children: effectiveSearchAttribute && getEffectiveRelMeta(effectiveSearchAttribute) ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
|
|
8745
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: `Target ${getEffectiveRelMeta(effectiveSearchAttribute).targetDisplayName} Relation` }),
|
|
8574
8746
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8575
8747
|
designSystem.Combobox,
|
|
8576
8748
|
{
|
|
8577
8749
|
autocomplete: { type: "list", filter: "contains" },
|
|
8578
|
-
placeholder: searchRelationOptionsLoading ? "Loading entities..." : `Search & pick ${
|
|
8750
|
+
placeholder: searchRelationOptionsLoading ? "Loading entities..." : `Search & pick ${getEffectiveRelMeta(effectiveSearchAttribute).targetDisplayName} or type text...`,
|
|
8579
8751
|
value: filterQuery,
|
|
8580
8752
|
onClear: () => setFilterQuery(""),
|
|
8581
8753
|
onChange: (val) => {
|
|
@@ -9218,7 +9390,7 @@ const BulkUpdater = () => {
|
|
|
9218
9390
|
recordEdits,
|
|
9219
9391
|
relationOptions,
|
|
9220
9392
|
relationOptionsLoading,
|
|
9221
|
-
relationIsMulti: Boolean(
|
|
9393
|
+
relationIsMulti: Boolean(getEffectiveRelMeta(selectedAttribute)?.isMulti),
|
|
9222
9394
|
validationRules,
|
|
9223
9395
|
onCommitEdit: handleGridCellCommit,
|
|
9224
9396
|
onResetEdit: handleGridCellReset
|
|
@@ -9256,7 +9428,9 @@ const BulkUpdater = () => {
|
|
|
9256
9428
|
onToggleExpandDz,
|
|
9257
9429
|
filterQuery,
|
|
9258
9430
|
gridCtx,
|
|
9259
|
-
cellTooltip
|
|
9431
|
+
cellTooltip,
|
|
9432
|
+
searchRelationOptions,
|
|
9433
|
+
relationOptions
|
|
9260
9434
|
) }, colDef.key);
|
|
9261
9435
|
})
|
|
9262
9436
|
}
|
|
@@ -9288,7 +9462,7 @@ const BulkUpdater = () => {
|
|
|
9288
9462
|
recordEdits,
|
|
9289
9463
|
relationOptions,
|
|
9290
9464
|
relationOptionsLoading,
|
|
9291
|
-
relationIsMulti: Boolean(
|
|
9465
|
+
relationIsMulti: Boolean(getEffectiveRelMeta(selectedAttribute)?.isMulti),
|
|
9292
9466
|
validationRules,
|
|
9293
9467
|
onToggleDzBlock: toggleDzBlock,
|
|
9294
9468
|
onCommitEdit: handleGridCellCommit,
|
|
@@ -9481,28 +9655,28 @@ const BulkUpdater = () => {
|
|
|
9481
9655
|
)
|
|
9482
9656
|
] })
|
|
9483
9657
|
}
|
|
9484
|
-
) :
|
|
9658
|
+
) : getEffectiveRelMeta(selectedAttribute) ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, style: { width: "100%" }, children: [
|
|
9485
9659
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", wrap: "wrap", children: [
|
|
9486
9660
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral700", children: [
|
|
9487
9661
|
"Target ",
|
|
9488
|
-
|
|
9662
|
+
getEffectiveRelMeta(selectedAttribute).targetDisplayName,
|
|
9489
9663
|
" Relation:"
|
|
9490
9664
|
] }),
|
|
9491
9665
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "secondary100", textColor: "secondary700", children: [
|
|
9492
|
-
|
|
9666
|
+
getEffectiveRelMeta(selectedAttribute).relationType,
|
|
9493
9667
|
" → ",
|
|
9494
|
-
|
|
9668
|
+
getEffectiveRelMeta(selectedAttribute).targetDisplayName
|
|
9495
9669
|
] }),
|
|
9496
|
-
|
|
9670
|
+
getEffectiveRelMeta(selectedAttribute).isMulti && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "primary100", textColor: "primary700", children: "Multi-Relation" })
|
|
9497
9671
|
] }),
|
|
9498
9672
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", style: { width: "100%" }, children: [
|
|
9499
9673
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1, minWidth: 200 }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
|
|
9500
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: `Choose ${
|
|
9674
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: `Choose ${getEffectiveRelMeta(selectedAttribute).targetDisplayName}` }),
|
|
9501
9675
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
9502
9676
|
designSystem.Combobox,
|
|
9503
9677
|
{
|
|
9504
9678
|
autocomplete: { type: "list", filter: "contains" },
|
|
9505
|
-
placeholder: relationOptionsLoading ? "Loading entities..." : `Search & pick ${
|
|
9679
|
+
placeholder: relationOptionsLoading ? "Loading entities..." : `Search & pick ${getEffectiveRelMeta(selectedAttribute).targetDisplayName}...`,
|
|
9506
9680
|
value: selectedRelationDocId,
|
|
9507
9681
|
onChange: (val) => {
|
|
9508
9682
|
const docId = val ? String(val) : "";
|
|
@@ -9521,7 +9695,7 @@ const BulkUpdater = () => {
|
|
|
9521
9695
|
}
|
|
9522
9696
|
)
|
|
9523
9697
|
] }) }),
|
|
9524
|
-
|
|
9698
|
+
getEffectiveRelMeta(selectedAttribute).isMulti && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: 170 }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9525
9699
|
designSystem.SingleSelect,
|
|
9526
9700
|
{
|
|
9527
9701
|
label: "Action Mode",
|
|
@@ -10220,8 +10394,8 @@ const BulkUpdater = () => {
|
|
|
10220
10394
|
" heterogeneous edits across ",
|
|
10221
10395
|
gridSerialized.targets.length,
|
|
10222
10396
|
" records)"
|
|
10223
|
-
] }) :
|
|
10224
|
-
|
|
10397
|
+
] }) : getEffectiveRelMeta(selectedAttribute) ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: selectedRelationDocId === "__clear__" ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "danger100", textColor: "danger700", children: "Clear / Unlink Relation" }) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "secondary100", textColor: "secondary700", children: [
|
|
10398
|
+
getEffectiveRelMeta(selectedAttribute).isMulti ? `[${relationMode.toUpperCase()}] ` : "",
|
|
10225
10399
|
relationOptions.find((o) => o.documentId === selectedRelationDocId)?.label || selectedRelationDocId || "(none selected)"
|
|
10226
10400
|
] }) }) : useRegex ? /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
10227
10401
|
"Replace ",
|
|
@@ -10843,7 +11017,7 @@ const BulkUpdater = () => {
|
|
|
10843
11017
|
editMode: gridEditMode ? "grid" : "common",
|
|
10844
11018
|
publishOnApproval,
|
|
10845
11019
|
lifecycleStats: selectedLifecycleStats,
|
|
10846
|
-
targetValueDisplay: gridEditMode ? `Grid Editing (${gridSerialized.totalEditCount} edits across ${gridSerialized.targets.length} records)` :
|
|
11020
|
+
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
|
|
10847
11021
|
}
|
|
10848
11022
|
),
|
|
10849
11023
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10873,6 +11047,7 @@ const BulkUpdater = () => {
|
|
|
10873
11047
|
);
|
|
10874
11048
|
};
|
|
10875
11049
|
exports.default = BulkUpdater;
|
|
11050
|
+
exports.formatAttributeHeaderLabel = formatAttributeHeaderLabel;
|
|
10876
11051
|
exports.formatComponentName = formatComponentName;
|
|
10877
11052
|
exports.formatDisplayValue = formatDisplayValue;
|
|
10878
11053
|
exports.formatFullTooltipValue = formatFullTooltipValue;
|
|
@@ -10885,4 +11060,7 @@ exports.getNestedValue = getNestedValue;
|
|
|
10885
11060
|
exports.getPropertyValue = getPropertyValue;
|
|
10886
11061
|
exports.getSortOptionsForCollection = getSortOptionsForCollection;
|
|
10887
11062
|
exports.parseDynamicZonePath = parseDynamicZonePath;
|
|
10888
|
-
|
|
11063
|
+
exports.registerRelationOptions = registerRelationOptions;
|
|
11064
|
+
exports.resolveEffectiveRelationMeta = resolveEffectiveRelationMeta;
|
|
11065
|
+
exports.resolveEntityLabel = resolveEntityLabel;
|
|
11066
|
+
//# sourceMappingURL=BulkUpdater-BSlEEUTV.js.map
|