strapi-plugin-bulk-updater 1.6.2 → 1.6.4
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-Y09TGkcC.js → BulkUpdater-BEhLlXOK.js} +683 -314
- package/dist/_chunks/BulkUpdater-BEhLlXOK.js.map +1 -0
- package/dist/_chunks/{BulkUpdater-e7N4vMse.mjs → BulkUpdater-C670oEo7.mjs} +683 -314
- package/dist/_chunks/BulkUpdater-C670oEo7.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +6443 -6009
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +6443 -6009
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/_chunks/BulkUpdater-Y09TGkcC.js.map +0 -1
- package/dist/_chunks/BulkUpdater-e7N4vMse.mjs.map +0 -1
|
@@ -4204,6 +4204,401 @@ function serializeGridTargets(gridEdits, selectedEntries, collectionPages = {},
|
|
|
4204
4204
|
}
|
|
4205
4205
|
return { targets, totalEditCount, hasValidationErrors };
|
|
4206
4206
|
}
|
|
4207
|
+
function parseDynamicZonePath(path) {
|
|
4208
|
+
if (!path) return { cleanPath: "", rootKey: "", subPath: "" };
|
|
4209
|
+
const bracketMatch = path.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
|
|
4210
|
+
if (bracketMatch) {
|
|
4211
|
+
const rootKey = bracketMatch[1];
|
|
4212
|
+
const selector = bracketMatch[2];
|
|
4213
|
+
const subPath = bracketMatch[3];
|
|
4214
|
+
const cleanPath = `${rootKey}.${subPath}`;
|
|
4215
|
+
if (/^\d+$/.test(selector)) {
|
|
4216
|
+
return { cleanPath, rootKey, subPath, targetIndex: parseInt(selector, 10) };
|
|
4217
|
+
}
|
|
4218
|
+
return { cleanPath, rootKey, subPath, targetComponentUid: selector };
|
|
4219
|
+
}
|
|
4220
|
+
const parts = path.split(".");
|
|
4221
|
+
return {
|
|
4222
|
+
cleanPath: path,
|
|
4223
|
+
rootKey: parts[0] || "",
|
|
4224
|
+
subPath: parts.slice(1).join(".")
|
|
4225
|
+
};
|
|
4226
|
+
}
|
|
4227
|
+
function formatComponentName(compUid) {
|
|
4228
|
+
if (!compUid) return "Component";
|
|
4229
|
+
const name = compUid.includes(".") ? compUid.split(".")[1] : compUid;
|
|
4230
|
+
return name.split(/[-_]/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
4231
|
+
}
|
|
4232
|
+
function getPropertyValue(target, key) {
|
|
4233
|
+
if (!target || typeof target !== "object" || !key) return void 0;
|
|
4234
|
+
if (target[key] !== void 0 && target[key] !== null) return target[key];
|
|
4235
|
+
const camelKey = key.replace(/_([a-z0-9])/g, (_, letter) => letter.toUpperCase());
|
|
4236
|
+
if (target[camelKey] !== void 0 && target[camelKey] !== null) return target[camelKey];
|
|
4237
|
+
const snakeKey = key.replace(/([A-Z])/g, "_$1").toLowerCase();
|
|
4238
|
+
if (target[snakeKey] !== void 0 && target[snakeKey] !== null) return target[snakeKey];
|
|
4239
|
+
const lowerKey = key.toLowerCase();
|
|
4240
|
+
const lowerNoUnderscore = lowerKey.replace(/_/g, "");
|
|
4241
|
+
const matchedKey = Object.keys(target).find((k) => {
|
|
4242
|
+
const kLower = k.toLowerCase();
|
|
4243
|
+
return kLower === lowerKey || kLower.replace(/_/g, "") === lowerNoUnderscore;
|
|
4244
|
+
});
|
|
4245
|
+
if (matchedKey && target[matchedKey] !== void 0 && target[matchedKey] !== null) {
|
|
4246
|
+
return target[matchedKey];
|
|
4247
|
+
}
|
|
4248
|
+
if (key in target) return target[key];
|
|
4249
|
+
if (camelKey in target) return target[camelKey];
|
|
4250
|
+
if (snakeKey in target) return target[snakeKey];
|
|
4251
|
+
return void 0;
|
|
4252
|
+
}
|
|
4253
|
+
function getNestedValue(obj, path) {
|
|
4254
|
+
if (!obj || !path) return void 0;
|
|
4255
|
+
const parsed = parseDynamicZonePath(path);
|
|
4256
|
+
const parts = parsed.cleanPath.split(".");
|
|
4257
|
+
function extract(current, remainingParts) {
|
|
4258
|
+
if (current === void 0 || current === null) return void 0;
|
|
4259
|
+
if (remainingParts.length === 0) return current;
|
|
4260
|
+
const [head, ...tail] = remainingParts;
|
|
4261
|
+
if (Array.isArray(current)) {
|
|
4262
|
+
if (/^\d+$/.test(head)) {
|
|
4263
|
+
return extract(current[parseInt(head, 10)], tail);
|
|
4264
|
+
}
|
|
4265
|
+
for (let idx = 0; idx < current.length; idx++) {
|
|
4266
|
+
const item = current[idx];
|
|
4267
|
+
if (parsed.targetIndex !== void 0 && idx !== parsed.targetIndex) continue;
|
|
4268
|
+
if (parsed.targetComponentUid && item?.__component !== parsed.targetComponentUid) continue;
|
|
4269
|
+
const found = extract(getPropertyValue(item, head), tail);
|
|
4270
|
+
if (found !== void 0 && found !== null) return found;
|
|
4271
|
+
}
|
|
4272
|
+
return void 0;
|
|
4273
|
+
}
|
|
4274
|
+
return extract(getPropertyValue(current, head), tail);
|
|
4275
|
+
}
|
|
4276
|
+
return extract(obj, parts);
|
|
4277
|
+
}
|
|
4278
|
+
function getAllNestedValues(obj, path, availableAttributes) {
|
|
4279
|
+
if (!obj || !path) return [];
|
|
4280
|
+
const parsed = parseDynamicZonePath(path);
|
|
4281
|
+
const parts = parsed.cleanPath.split(".");
|
|
4282
|
+
const [head, ...tail] = parts;
|
|
4283
|
+
const rootTarget = getPropertyValue(obj, head);
|
|
4284
|
+
if (rootTarget === void 0 || rootTarget === null) return [];
|
|
4285
|
+
if (Array.isArray(rootTarget)) {
|
|
4286
|
+
const results = [];
|
|
4287
|
+
rootTarget.forEach((item, idx) => {
|
|
4288
|
+
if (!item || typeof item !== "object") return;
|
|
4289
|
+
if (parsed.targetIndex !== void 0 && idx !== parsed.targetIndex) return;
|
|
4290
|
+
if (parsed.targetComponentUid && item.__component !== parsed.targetComponentUid) return;
|
|
4291
|
+
const subPath = tail.join(".");
|
|
4292
|
+
const scopedPath = item.__component ? `${head}[${item.__component}].${subPath}` : "";
|
|
4293
|
+
const isSupported = availableAttributes ? availableAttributes.includes(scopedPath) : false;
|
|
4294
|
+
if (tail.length > 0) {
|
|
4295
|
+
const subMatches = getAllNestedValues(item, subPath, availableAttributes);
|
|
4296
|
+
if (subMatches.length > 0) {
|
|
4297
|
+
subMatches.forEach((sm) => {
|
|
4298
|
+
results.push({
|
|
4299
|
+
index: idx,
|
|
4300
|
+
componentUid: item.__component || sm.componentUid,
|
|
4301
|
+
componentName: item.__component ? formatComponentName(item.__component) : sm.componentName,
|
|
4302
|
+
componentId: item.id !== void 0 && item.id !== null ? item.id : sm.componentId,
|
|
4303
|
+
value: sm.value,
|
|
4304
|
+
path: `${head}[#${idx}${item.__component ? ` ${formatComponentName(item.__component)}` : ""}].${sm.path}`
|
|
4305
|
+
});
|
|
4306
|
+
});
|
|
4307
|
+
return;
|
|
4308
|
+
}
|
|
4309
|
+
}
|
|
4310
|
+
const subVal = tail.length > 0 ? getNestedValue(item, subPath) : item;
|
|
4311
|
+
if (subVal !== void 0 || isSupported) {
|
|
4312
|
+
results.push({
|
|
4313
|
+
index: idx,
|
|
4314
|
+
componentUid: item.__component,
|
|
4315
|
+
componentName: formatComponentName(item.__component),
|
|
4316
|
+
componentId: item.id !== void 0 && item.id !== null ? item.id : void 0,
|
|
4317
|
+
value: subVal !== void 0 ? subVal : null,
|
|
4318
|
+
path: `${head}[#${idx}${item.__component ? ` ${formatComponentName(item.__component)}` : ""}].${subPath}`
|
|
4319
|
+
});
|
|
4320
|
+
}
|
|
4321
|
+
});
|
|
4322
|
+
return results;
|
|
4323
|
+
}
|
|
4324
|
+
if (typeof rootTarget === "object" && tail.length > 0) {
|
|
4325
|
+
const subMatches = getAllNestedValues(rootTarget, tail.join("."), availableAttributes);
|
|
4326
|
+
if (subMatches.length > 0) {
|
|
4327
|
+
return subMatches.map((sm) => ({
|
|
4328
|
+
...sm,
|
|
4329
|
+
path: `${head}.${sm.path}`
|
|
4330
|
+
}));
|
|
4331
|
+
}
|
|
4332
|
+
}
|
|
4333
|
+
const singleVal = getNestedValue(obj, parsed.cleanPath);
|
|
4334
|
+
if (singleVal !== void 0) {
|
|
4335
|
+
return [
|
|
4336
|
+
{
|
|
4337
|
+
index: 0,
|
|
4338
|
+
value: singleVal,
|
|
4339
|
+
path: parsed.cleanPath
|
|
4340
|
+
}
|
|
4341
|
+
];
|
|
4342
|
+
}
|
|
4343
|
+
return [];
|
|
4344
|
+
}
|
|
4345
|
+
function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribute) {
|
|
4346
|
+
const cols = [
|
|
4347
|
+
{
|
|
4348
|
+
key: "select",
|
|
4349
|
+
label: "Select",
|
|
4350
|
+
isPermanent: true,
|
|
4351
|
+
defaultVisible: true
|
|
4352
|
+
},
|
|
4353
|
+
{
|
|
4354
|
+
key: "identifier",
|
|
4355
|
+
label: "Identifier",
|
|
4356
|
+
sortable: !col.isSingleType,
|
|
4357
|
+
defaultVisible: true
|
|
4358
|
+
}
|
|
4359
|
+
];
|
|
4360
|
+
const candidateAttrs = col.attributes || [];
|
|
4361
|
+
candidateAttrs.forEach((attr) => {
|
|
4362
|
+
if (attr === "name" || attr === "title" || attr === selectedAttribute || searchAttribute && attr === searchAttribute) {
|
|
4363
|
+
return;
|
|
4364
|
+
}
|
|
4365
|
+
let formattedLabel = attr;
|
|
4366
|
+
if (attr === "updated_at" || attr === "updatedAt") {
|
|
4367
|
+
formattedLabel = "Updated At";
|
|
4368
|
+
} else if (attr === "created_at" || attr === "createdAt") {
|
|
4369
|
+
formattedLabel = "Created At";
|
|
4370
|
+
} else if (attr === "published_at" || attr === "publishedAt") {
|
|
4371
|
+
formattedLabel = "Published At";
|
|
4372
|
+
} else {
|
|
4373
|
+
const bracketMatch = attr.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
|
|
4374
|
+
if (bracketMatch) {
|
|
4375
|
+
const root = bracketMatch[1].charAt(0).toUpperCase() + bracketMatch[1].slice(1);
|
|
4376
|
+
const comp = formatComponentName(bracketMatch[2]);
|
|
4377
|
+
const sub = bracketMatch[3].split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
4378
|
+
formattedLabel = `${root} [${comp}] > ${sub}`;
|
|
4379
|
+
} else if (attr.includes(".")) {
|
|
4380
|
+
formattedLabel = attr.split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
4381
|
+
} else {
|
|
4382
|
+
formattedLabel = attr.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
|
|
4383
|
+
}
|
|
4384
|
+
}
|
|
4385
|
+
cols.push({
|
|
4386
|
+
key: `attr_${attr}`,
|
|
4387
|
+
label: formattedLabel,
|
|
4388
|
+
sortable: !col.isSingleType,
|
|
4389
|
+
defaultVisible: ["department", "email", "location", "updated_at", "updatedAt"].includes(attr)
|
|
4390
|
+
});
|
|
4391
|
+
});
|
|
4392
|
+
const hasUpdatedAt = candidateAttrs.some((a) => a === "updatedAt" || a === "updated_at");
|
|
4393
|
+
const hasCreatedAt = candidateAttrs.some((a) => a === "createdAt" || a === "created_at");
|
|
4394
|
+
const hasPublishedAt = candidateAttrs.some((a) => a === "publishedAt" || a === "published_at");
|
|
4395
|
+
if (!hasUpdatedAt) {
|
|
4396
|
+
cols.push({
|
|
4397
|
+
key: "attr_updatedAt",
|
|
4398
|
+
label: "Updated At",
|
|
4399
|
+
sortable: !col.isSingleType,
|
|
4400
|
+
defaultVisible: false
|
|
4401
|
+
});
|
|
4402
|
+
}
|
|
4403
|
+
if (!hasCreatedAt) {
|
|
4404
|
+
cols.push({
|
|
4405
|
+
key: "attr_createdAt",
|
|
4406
|
+
label: "Created At",
|
|
4407
|
+
sortable: !col.isSingleType,
|
|
4408
|
+
defaultVisible: false
|
|
4409
|
+
});
|
|
4410
|
+
}
|
|
4411
|
+
if (!hasPublishedAt && col.draftAndPublish) {
|
|
4412
|
+
cols.push({
|
|
4413
|
+
key: "attr_publishedAt",
|
|
4414
|
+
label: "Published At",
|
|
4415
|
+
sortable: !col.isSingleType,
|
|
4416
|
+
defaultVisible: false
|
|
4417
|
+
});
|
|
4418
|
+
}
|
|
4419
|
+
if (searchAttribute && searchAttribute !== selectedAttribute) {
|
|
4420
|
+
let formattedSearchLabel = searchAttribute;
|
|
4421
|
+
const bracketMatch = searchAttribute.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
|
|
4422
|
+
if (bracketMatch) {
|
|
4423
|
+
const root = bracketMatch[1].charAt(0).toUpperCase() + bracketMatch[1].slice(1);
|
|
4424
|
+
const comp = formatComponentName(bracketMatch[2]);
|
|
4425
|
+
const sub = bracketMatch[3].split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
4426
|
+
formattedSearchLabel = `${root} [${comp}] > ${sub}`;
|
|
4427
|
+
} else if (searchAttribute.includes(".")) {
|
|
4428
|
+
formattedSearchLabel = searchAttribute.split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
4429
|
+
}
|
|
4430
|
+
cols.push({
|
|
4431
|
+
key: "search_attr",
|
|
4432
|
+
label: `Search: "${formattedSearchLabel}"`,
|
|
4433
|
+
sortable: !col.isSingleType && col.attributes.includes(searchAttribute),
|
|
4434
|
+
defaultVisible: true
|
|
4435
|
+
});
|
|
4436
|
+
}
|
|
4437
|
+
if (selectedAttribute && selectedAttribute.trim()) {
|
|
4438
|
+
let formattedTargetLabel = selectedAttribute;
|
|
4439
|
+
const bracketMatch = selectedAttribute.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
|
|
4440
|
+
if (bracketMatch) {
|
|
4441
|
+
const root = bracketMatch[1].charAt(0).toUpperCase() + bracketMatch[1].slice(1);
|
|
4442
|
+
const comp = formatComponentName(bracketMatch[2]);
|
|
4443
|
+
const sub = bracketMatch[3].split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
4444
|
+
formattedTargetLabel = `${root} [${comp}] > ${sub}`;
|
|
4445
|
+
} else if (selectedAttribute.includes(".")) {
|
|
4446
|
+
formattedTargetLabel = selectedAttribute.split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
4447
|
+
} else {
|
|
4448
|
+
formattedTargetLabel = selectedAttribute.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
|
|
4449
|
+
}
|
|
4450
|
+
cols.push({
|
|
4451
|
+
key: "current_attr",
|
|
4452
|
+
label: `Current Value: "${formattedTargetLabel}"`,
|
|
4453
|
+
sortable: !col.isSingleType && col.attributes.includes(selectedAttribute),
|
|
4454
|
+
defaultVisible: true
|
|
4455
|
+
});
|
|
4456
|
+
cols.push({
|
|
4457
|
+
key: "target_attr",
|
|
4458
|
+
label: `Target Updated Value: "${formattedTargetLabel}"`,
|
|
4459
|
+
sortable: !col.isSingleType && col.attributes.includes(selectedAttribute),
|
|
4460
|
+
defaultVisible: true
|
|
4461
|
+
});
|
|
4462
|
+
}
|
|
4463
|
+
cols.push({
|
|
4464
|
+
key: "status",
|
|
4465
|
+
label: "Status",
|
|
4466
|
+
sortable: false,
|
|
4467
|
+
defaultVisible: true
|
|
4468
|
+
});
|
|
4469
|
+
return cols;
|
|
4470
|
+
}
|
|
4471
|
+
function formatFullTooltipValue(val) {
|
|
4472
|
+
if (val === void 0 || val === null || val === "") {
|
|
4473
|
+
return "(empty / not set)";
|
|
4474
|
+
}
|
|
4475
|
+
if (typeof val === "boolean") {
|
|
4476
|
+
return String(val);
|
|
4477
|
+
}
|
|
4478
|
+
if (typeof val === "number") {
|
|
4479
|
+
return String(val);
|
|
4480
|
+
}
|
|
4481
|
+
if (val instanceof Date) {
|
|
4482
|
+
return isNaN(val.getTime()) ? "(invalid date)" : val.toISOString();
|
|
4483
|
+
}
|
|
4484
|
+
if (typeof val === "string") {
|
|
4485
|
+
return val;
|
|
4486
|
+
}
|
|
4487
|
+
if (Array.isArray(val)) {
|
|
4488
|
+
if (val.length === 0) return "(empty array)";
|
|
4489
|
+
try {
|
|
4490
|
+
return JSON.stringify(val, null, 2);
|
|
4491
|
+
} catch {
|
|
4492
|
+
return String(val);
|
|
4493
|
+
}
|
|
4494
|
+
}
|
|
4495
|
+
if (typeof val === "object") {
|
|
4496
|
+
if (val.isRelation && val.display) return val.display;
|
|
4497
|
+
try {
|
|
4498
|
+
return JSON.stringify(val, null, 2);
|
|
4499
|
+
} catch {
|
|
4500
|
+
return String(val);
|
|
4501
|
+
}
|
|
4502
|
+
}
|
|
4503
|
+
return String(val);
|
|
4504
|
+
}
|
|
4505
|
+
function getCellTooltipText(colDef, entry, colAttributes, selectedAttribute, searchAttribute, recordEdits) {
|
|
4506
|
+
if (!colDef || !entry) return void 0;
|
|
4507
|
+
switch (colDef.key) {
|
|
4508
|
+
case "select":
|
|
4509
|
+
return void 0;
|
|
4510
|
+
case "identifier": {
|
|
4511
|
+
const mainText = entry.name || entry.title || `Entry #${entry.id || entry.documentId}`;
|
|
4512
|
+
const parts = [String(mainText)];
|
|
4513
|
+
if (entry.documentId) parts.push(`Document ID: ${entry.documentId}`);
|
|
4514
|
+
if (entry.id && String(entry.id) !== String(entry.documentId)) parts.push(`ID: ${entry.id}`);
|
|
4515
|
+
if (entry.email) parts.push(`Email: ${entry.email}`);
|
|
4516
|
+
return parts.join("\n");
|
|
4517
|
+
}
|
|
4518
|
+
case "status": {
|
|
4519
|
+
if (selectedAttribute && colAttributes && !colAttributes.includes(selectedAttribute)) {
|
|
4520
|
+
return "Status: Ignored (absent in schema)";
|
|
4521
|
+
}
|
|
4522
|
+
return void 0;
|
|
4523
|
+
}
|
|
4524
|
+
case "current_attr": {
|
|
4525
|
+
if (!selectedAttribute) return void 0;
|
|
4526
|
+
const rootKey = selectedAttribute.split("[")[0].split(".")[0];
|
|
4527
|
+
const hasSchemaAttr = !colAttributes || colAttributes.includes(selectedAttribute) || colAttributes.includes(rootKey);
|
|
4528
|
+
if (!hasSchemaAttr) {
|
|
4529
|
+
return "Ignored (absent in schema)";
|
|
4530
|
+
}
|
|
4531
|
+
const matches = getAllNestedValues(entry, selectedAttribute, colAttributes);
|
|
4532
|
+
if (matches.length === 0) return "(empty / not set)";
|
|
4533
|
+
if (matches.length === 1 && !matches[0].componentUid && !matches[0].path.includes("[#")) {
|
|
4534
|
+
return formatFullTooltipValue(matches[0].value);
|
|
4535
|
+
}
|
|
4536
|
+
return matches.map((m) => {
|
|
4537
|
+
const compLabel = m.componentName ? `#${m.index} ${m.componentName}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}` : `#${m.index}`;
|
|
4538
|
+
const valStr = formatFullTooltipValue(m.value);
|
|
4539
|
+
return `${compLabel}: ${valStr}`;
|
|
4540
|
+
}).join("\n\n");
|
|
4541
|
+
}
|
|
4542
|
+
case "target_attr": {
|
|
4543
|
+
if (!selectedAttribute) return void 0;
|
|
4544
|
+
const rootKey = selectedAttribute.split("[")[0].split(".")[0];
|
|
4545
|
+
const hasSchemaAttr = !colAttributes || colAttributes.includes(selectedAttribute) || colAttributes.includes(rootKey);
|
|
4546
|
+
if (!hasSchemaAttr) {
|
|
4547
|
+
return "Ignored (absent in schema)";
|
|
4548
|
+
}
|
|
4549
|
+
if (recordEdits?.occurrences) {
|
|
4550
|
+
const occEntries = Object.entries(recordEdits.occurrences);
|
|
4551
|
+
if (occEntries.length > 0) {
|
|
4552
|
+
return occEntries.map(([occKey, editObj]) => {
|
|
4553
|
+
const valStr = formatFullTooltipValue(editObj?.value);
|
|
4554
|
+
return `Target [${occKey}]: ${valStr}${editObj?.validationError ? ` (Error: ${editObj.validationError})` : ""}`;
|
|
4555
|
+
}).join("\n\n");
|
|
4556
|
+
}
|
|
4557
|
+
}
|
|
4558
|
+
const matches = getAllNestedValues(entry, selectedAttribute, colAttributes);
|
|
4559
|
+
if (matches.length === 0) return "(empty / not set)";
|
|
4560
|
+
if (matches.length === 1 && !matches[0].componentUid && !matches[0].path.includes("[#")) {
|
|
4561
|
+
return formatFullTooltipValue(matches[0].value);
|
|
4562
|
+
}
|
|
4563
|
+
return matches.map((m) => {
|
|
4564
|
+
const compLabel = m.componentName ? `#${m.index} ${m.componentName}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}` : `#${m.index}`;
|
|
4565
|
+
const valStr = formatFullTooltipValue(m.value);
|
|
4566
|
+
return `${compLabel}: ${valStr}`;
|
|
4567
|
+
}).join("\n\n");
|
|
4568
|
+
}
|
|
4569
|
+
case "search_attr": {
|
|
4570
|
+
if (!searchAttribute) return void 0;
|
|
4571
|
+
const rootKey = searchAttribute.split("[")[0].split(".")[0];
|
|
4572
|
+
const hasSchemaAttr = !colAttributes || colAttributes.includes(searchAttribute) || colAttributes.includes(rootKey);
|
|
4573
|
+
if (!hasSchemaAttr) {
|
|
4574
|
+
return "Ignored (absent in schema)";
|
|
4575
|
+
}
|
|
4576
|
+
const matches = getAllNestedValues(entry, searchAttribute, colAttributes);
|
|
4577
|
+
if (matches.length === 0) return "(empty / not set)";
|
|
4578
|
+
if (matches.length === 1 && !matches[0].componentUid && !matches[0].path.includes("[#")) {
|
|
4579
|
+
return formatFullTooltipValue(matches[0].value);
|
|
4580
|
+
}
|
|
4581
|
+
return matches.map((m) => {
|
|
4582
|
+
const compLabel = m.componentName ? `#${m.index} ${m.componentName}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}` : `#${m.index}`;
|
|
4583
|
+
const valStr = formatFullTooltipValue(m.value);
|
|
4584
|
+
return `${compLabel}: ${valStr}`;
|
|
4585
|
+
}).join("\n\n");
|
|
4586
|
+
}
|
|
4587
|
+
default: {
|
|
4588
|
+
const attrName = colDef.key.replace("attr_", "");
|
|
4589
|
+
const matches = getAllNestedValues(entry, attrName, colAttributes);
|
|
4590
|
+
if (matches.length === 0) return "(empty / not set)";
|
|
4591
|
+
if (matches.length === 1 && !matches[0].componentUid && !matches[0].path.includes("[#")) {
|
|
4592
|
+
return formatFullTooltipValue(matches[0].value);
|
|
4593
|
+
}
|
|
4594
|
+
return matches.map((m) => {
|
|
4595
|
+
const compLabel = m.componentName ? `#${m.index} ${m.componentName}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}` : `#${m.index}`;
|
|
4596
|
+
const valStr = formatFullTooltipValue(m.value);
|
|
4597
|
+
return `${compLabel}: ${valStr}`;
|
|
4598
|
+
}).join("\n\n");
|
|
4599
|
+
}
|
|
4600
|
+
}
|
|
4601
|
+
}
|
|
4207
4602
|
const DEFAULT_HEADING_ITEMS = [
|
|
4208
4603
|
{ value: "h1", label: "H1 - Main Page Title", maxAllowed: 1 },
|
|
4209
4604
|
{ value: "h2", label: "H2 - Primary Section Heading", maxAllowed: 3 },
|
|
@@ -5028,288 +5423,58 @@ const ComponentOccurrencesDrawer = React__default.default.memo(
|
|
|
5028
5423
|
block?.id !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral500", style: { fontSize: "0.68rem" }, children: [
|
|
5029
5424
|
"id:",
|
|
5030
5425
|
block.id
|
|
5031
|
-
] })
|
|
5032
|
-
] }),
|
|
5033
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Td, { children: [
|
|
5034
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "neutral150", textColor: "neutral800", children: compLabel }),
|
|
5035
|
-
compUid && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", display: "block", style: { fontSize: "0.68rem", marginTop: 2 }, children: compUid })
|
|
5036
|
-
] }),
|
|
5037
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: !targetsThisRoot ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", children: selectedAttribute ? `(targets "${selectedAttribute}")` : "(select attribute to inspect)" }) : !hasTargetAttr ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "neutral100", textColor: "neutral500", children: "Does not contain attribute" }) : gridEditMode ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 2, alignItems: "flex-start", children: blockOccs.map((occ) => {
|
|
5038
|
-
const editObj = recordEdits?.occurrences?.[occ.occurrenceKey];
|
|
5039
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { width: "100%" }, children: [
|
|
5040
|
-
blockOccs.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", display: "block", style: { fontSize: "0.7rem", marginBottom: 2 }, children: occ.displayPath }),
|
|
5041
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5042
|
-
GridCellEditor,
|
|
5043
|
-
{
|
|
5044
|
-
entry,
|
|
5045
|
-
attribute: selectedAttribute,
|
|
5046
|
-
occurrence: occ,
|
|
5047
|
-
attrMeta,
|
|
5048
|
-
editedValue: editObj?.value,
|
|
5049
|
-
isDirty: Boolean(editObj),
|
|
5050
|
-
validationError: editObj?.validationError,
|
|
5051
|
-
relationOptions,
|
|
5052
|
-
relationOptionsLoading,
|
|
5053
|
-
relationIsMulti,
|
|
5054
|
-
validationRules,
|
|
5055
|
-
recordEdits,
|
|
5056
|
-
colAttributes,
|
|
5057
|
-
onCommit: (o, val, err) => onCommitEdit(entry, colUid, o, val, err),
|
|
5058
|
-
onReset: (k) => onResetEdit(colUid, entry.documentId, k)
|
|
5059
|
-
}
|
|
5060
|
-
)
|
|
5061
|
-
] }, occ.occurrenceKey);
|
|
5062
|
-
}) }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 1, alignItems: "flex-start", children: blockOccs.map((occ) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", textColor: "primary700", children: occ.value !== null && occ.value !== void 0 && occ.value !== "" ? typeof occ.value === "object" ? JSON.stringify(occ.value) : String(occ.value) : "(empty / not set)" }, occ.occurrenceKey)) }) }),
|
|
5063
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5064
|
-
designSystem.Typography,
|
|
5065
|
-
{
|
|
5066
|
-
variant: "pi",
|
|
5067
|
-
textColor: "neutral600",
|
|
5068
|
-
style: { maxWidth: 280, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
|
5069
|
-
children: blockSummaryText
|
|
5070
|
-
}
|
|
5071
|
-
) })
|
|
5072
|
-
]
|
|
5073
|
-
},
|
|
5074
|
-
block?.id ? `id_${block.id}_idx_${bIdx}` : `idx_${bIdx}`
|
|
5075
|
-
);
|
|
5076
|
-
}) })
|
|
5077
|
-
] })
|
|
5078
|
-
]
|
|
5079
|
-
}
|
|
5080
|
-
);
|
|
5081
|
-
}
|
|
5082
|
-
);
|
|
5083
|
-
function parseDynamicZonePath(path) {
|
|
5084
|
-
if (!path) return { cleanPath: "", rootKey: "", subPath: "" };
|
|
5085
|
-
const bracketMatch = path.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
|
|
5086
|
-
if (bracketMatch) {
|
|
5087
|
-
const rootKey = bracketMatch[1];
|
|
5088
|
-
const selector = bracketMatch[2];
|
|
5089
|
-
const subPath = bracketMatch[3];
|
|
5090
|
-
const cleanPath = `${rootKey}.${subPath}`;
|
|
5091
|
-
if (/^\d+$/.test(selector)) {
|
|
5092
|
-
return { cleanPath, rootKey, subPath, targetIndex: parseInt(selector, 10) };
|
|
5093
|
-
}
|
|
5094
|
-
return { cleanPath, rootKey, subPath, targetComponentUid: selector };
|
|
5095
|
-
}
|
|
5096
|
-
const parts = path.split(".");
|
|
5097
|
-
return {
|
|
5098
|
-
cleanPath: path,
|
|
5099
|
-
rootKey: parts[0] || "",
|
|
5100
|
-
subPath: parts.slice(1).join(".")
|
|
5101
|
-
};
|
|
5102
|
-
}
|
|
5103
|
-
function formatComponentName(compUid) {
|
|
5104
|
-
if (!compUid) return "Component";
|
|
5105
|
-
const name = compUid.includes(".") ? compUid.split(".")[1] : compUid;
|
|
5106
|
-
return name.split(/[-_]/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
5107
|
-
}
|
|
5108
|
-
function getAllNestedValues(obj, path, availableAttributes) {
|
|
5109
|
-
if (!obj || !path) return [];
|
|
5110
|
-
const parsed = parseDynamicZonePath(path);
|
|
5111
|
-
const parts = parsed.cleanPath.split(".");
|
|
5112
|
-
const [head, ...tail] = parts;
|
|
5113
|
-
const rootTarget = getPropertyValue(obj, head);
|
|
5114
|
-
if (Array.isArray(rootTarget)) {
|
|
5115
|
-
const results = [];
|
|
5116
|
-
rootTarget.forEach((item, idx) => {
|
|
5117
|
-
if (!item || typeof item !== "object") return;
|
|
5118
|
-
if (parsed.targetIndex !== void 0 && idx !== parsed.targetIndex) return;
|
|
5119
|
-
if (parsed.targetComponentUid && item.__component !== parsed.targetComponentUid) return;
|
|
5120
|
-
const subPath = tail.join(".");
|
|
5121
|
-
const scopedPath = item.__component ? `${head}[${item.__component}].${subPath}` : "";
|
|
5122
|
-
const isSupported = availableAttributes ? availableAttributes.includes(scopedPath) : false;
|
|
5123
|
-
const subVal = tail.length > 0 ? getNestedValue(item, subPath) : item;
|
|
5124
|
-
if (subVal !== void 0 || isSupported) {
|
|
5125
|
-
results.push({
|
|
5126
|
-
index: idx,
|
|
5127
|
-
componentUid: item.__component,
|
|
5128
|
-
componentName: formatComponentName(item.__component),
|
|
5129
|
-
value: subVal !== void 0 ? subVal : null,
|
|
5130
|
-
path: `${head}[#${idx}${item.__component ? ` ${formatComponentName(item.__component)}` : ""}].${subPath}`
|
|
5131
|
-
});
|
|
5132
|
-
}
|
|
5133
|
-
});
|
|
5134
|
-
return results;
|
|
5135
|
-
}
|
|
5136
|
-
const singleVal = getNestedValue(obj, parsed.cleanPath);
|
|
5137
|
-
if (singleVal !== void 0) {
|
|
5138
|
-
return [
|
|
5139
|
-
{
|
|
5140
|
-
index: 0,
|
|
5141
|
-
value: singleVal,
|
|
5142
|
-
path: parsed.cleanPath
|
|
5143
|
-
}
|
|
5144
|
-
];
|
|
5145
|
-
}
|
|
5146
|
-
return [];
|
|
5147
|
-
}
|
|
5148
|
-
function getPropertyValue(target, key) {
|
|
5149
|
-
if (!target || typeof target !== "object" || !key) return void 0;
|
|
5150
|
-
if (target[key] !== void 0 && target[key] !== null) return target[key];
|
|
5151
|
-
const camelKey = key.replace(/_([a-z0-9])/g, (_, letter) => letter.toUpperCase());
|
|
5152
|
-
if (target[camelKey] !== void 0 && target[camelKey] !== null) return target[camelKey];
|
|
5153
|
-
const snakeKey = key.replace(/([A-Z])/g, "_$1").toLowerCase();
|
|
5154
|
-
if (target[snakeKey] !== void 0 && target[snakeKey] !== null) return target[snakeKey];
|
|
5155
|
-
const lowerKey = key.toLowerCase();
|
|
5156
|
-
const lowerNoUnderscore = lowerKey.replace(/_/g, "");
|
|
5157
|
-
const matchedKey = Object.keys(target).find((k) => {
|
|
5158
|
-
const kLower = k.toLowerCase();
|
|
5159
|
-
return kLower === lowerKey || kLower.replace(/_/g, "") === lowerNoUnderscore;
|
|
5160
|
-
});
|
|
5161
|
-
if (matchedKey && target[matchedKey] !== void 0 && target[matchedKey] !== null) {
|
|
5162
|
-
return target[matchedKey];
|
|
5163
|
-
}
|
|
5164
|
-
if (key in target) return target[key];
|
|
5165
|
-
if (camelKey in target) return target[camelKey];
|
|
5166
|
-
if (snakeKey in target) return target[snakeKey];
|
|
5167
|
-
return void 0;
|
|
5168
|
-
}
|
|
5169
|
-
function getNestedValue(obj, path) {
|
|
5170
|
-
if (!obj || !path) return void 0;
|
|
5171
|
-
const parsed = parseDynamicZonePath(path);
|
|
5172
|
-
const parts = parsed.cleanPath.split(".");
|
|
5173
|
-
function extract(current, remainingParts) {
|
|
5174
|
-
if (current === void 0 || current === null) return void 0;
|
|
5175
|
-
if (remainingParts.length === 0) return current;
|
|
5176
|
-
const [head, ...tail] = remainingParts;
|
|
5177
|
-
if (Array.isArray(current)) {
|
|
5178
|
-
if (/^\d+$/.test(head)) {
|
|
5179
|
-
return extract(current[parseInt(head, 10)], tail);
|
|
5180
|
-
}
|
|
5181
|
-
for (let idx = 0; idx < current.length; idx++) {
|
|
5182
|
-
const item = current[idx];
|
|
5183
|
-
if (parsed.targetIndex !== void 0 && idx !== parsed.targetIndex) continue;
|
|
5184
|
-
if (parsed.targetComponentUid && item?.__component !== parsed.targetComponentUid) continue;
|
|
5185
|
-
const found = extract(getPropertyValue(item, head), tail);
|
|
5186
|
-
if (found !== void 0 && found !== null) return found;
|
|
5187
|
-
}
|
|
5188
|
-
return void 0;
|
|
5189
|
-
}
|
|
5190
|
-
return extract(getPropertyValue(current, head), tail);
|
|
5191
|
-
}
|
|
5192
|
-
return extract(obj, parts);
|
|
5193
|
-
}
|
|
5194
|
-
function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribute) {
|
|
5195
|
-
const cols = [
|
|
5196
|
-
{
|
|
5197
|
-
key: "select",
|
|
5198
|
-
label: "Select",
|
|
5199
|
-
isPermanent: true,
|
|
5200
|
-
defaultVisible: true
|
|
5201
|
-
},
|
|
5202
|
-
{
|
|
5203
|
-
key: "identifier",
|
|
5204
|
-
label: "Identifier",
|
|
5205
|
-
sortable: !col.isSingleType,
|
|
5206
|
-
defaultVisible: true
|
|
5207
|
-
}
|
|
5208
|
-
];
|
|
5209
|
-
const candidateAttrs = col.attributes || [];
|
|
5210
|
-
candidateAttrs.forEach((attr) => {
|
|
5211
|
-
if (attr === "name" || attr === "title" || attr === selectedAttribute || searchAttribute && attr === searchAttribute) {
|
|
5212
|
-
return;
|
|
5213
|
-
}
|
|
5214
|
-
let formattedLabel = attr;
|
|
5215
|
-
if (attr === "updated_at" || attr === "updatedAt") {
|
|
5216
|
-
formattedLabel = "Updated At";
|
|
5217
|
-
} else if (attr === "created_at" || attr === "createdAt") {
|
|
5218
|
-
formattedLabel = "Created At";
|
|
5219
|
-
} else if (attr === "published_at" || attr === "publishedAt") {
|
|
5220
|
-
formattedLabel = "Published At";
|
|
5221
|
-
} else {
|
|
5222
|
-
const bracketMatch = attr.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
|
|
5223
|
-
if (bracketMatch) {
|
|
5224
|
-
const root = bracketMatch[1].charAt(0).toUpperCase() + bracketMatch[1].slice(1);
|
|
5225
|
-
const comp = formatComponentName(bracketMatch[2]);
|
|
5226
|
-
const sub = bracketMatch[3].split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
5227
|
-
formattedLabel = `${root} [${comp}] > ${sub}`;
|
|
5228
|
-
} else if (attr.includes(".")) {
|
|
5229
|
-
formattedLabel = attr.split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
5230
|
-
} else {
|
|
5231
|
-
formattedLabel = attr.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
|
|
5426
|
+
] })
|
|
5427
|
+
] }),
|
|
5428
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Td, { children: [
|
|
5429
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "neutral150", textColor: "neutral800", children: compLabel }),
|
|
5430
|
+
compUid && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", display: "block", style: { fontSize: "0.68rem", marginTop: 2 }, children: compUid })
|
|
5431
|
+
] }),
|
|
5432
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: !targetsThisRoot ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", children: selectedAttribute ? `(targets "${selectedAttribute}")` : "(select attribute to inspect)" }) : !hasTargetAttr ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "neutral100", textColor: "neutral500", children: "Does not contain attribute" }) : gridEditMode ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 2, alignItems: "flex-start", children: blockOccs.map((occ) => {
|
|
5433
|
+
const editObj = recordEdits?.occurrences?.[occ.occurrenceKey];
|
|
5434
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { width: "100%" }, children: [
|
|
5435
|
+
blockOccs.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", display: "block", style: { fontSize: "0.7rem", marginBottom: 2 }, children: occ.displayPath }),
|
|
5436
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5437
|
+
GridCellEditor,
|
|
5438
|
+
{
|
|
5439
|
+
entry,
|
|
5440
|
+
attribute: selectedAttribute,
|
|
5441
|
+
occurrence: occ,
|
|
5442
|
+
attrMeta,
|
|
5443
|
+
editedValue: editObj?.value,
|
|
5444
|
+
isDirty: Boolean(editObj),
|
|
5445
|
+
validationError: editObj?.validationError,
|
|
5446
|
+
relationOptions,
|
|
5447
|
+
relationOptionsLoading,
|
|
5448
|
+
relationIsMulti,
|
|
5449
|
+
validationRules,
|
|
5450
|
+
recordEdits,
|
|
5451
|
+
colAttributes,
|
|
5452
|
+
onCommit: (o, val, err) => onCommitEdit(entry, colUid, o, val, err),
|
|
5453
|
+
onReset: (k) => onResetEdit(colUid, entry.documentId, k)
|
|
5454
|
+
}
|
|
5455
|
+
)
|
|
5456
|
+
] }, occ.occurrenceKey);
|
|
5457
|
+
}) }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 1, alignItems: "flex-start", children: blockOccs.map((occ) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", textColor: "primary700", children: occ.value !== null && occ.value !== void 0 && occ.value !== "" ? typeof occ.value === "object" ? JSON.stringify(occ.value) : String(occ.value) : "(empty / not set)" }, occ.occurrenceKey)) }) }),
|
|
5458
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5459
|
+
designSystem.Typography,
|
|
5460
|
+
{
|
|
5461
|
+
variant: "pi",
|
|
5462
|
+
textColor: "neutral600",
|
|
5463
|
+
style: { maxWidth: 280, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
|
5464
|
+
children: blockSummaryText
|
|
5465
|
+
}
|
|
5466
|
+
) })
|
|
5467
|
+
]
|
|
5468
|
+
},
|
|
5469
|
+
block?.id ? `id_${block.id}_idx_${bIdx}` : `idx_${bIdx}`
|
|
5470
|
+
);
|
|
5471
|
+
}) })
|
|
5472
|
+
] })
|
|
5473
|
+
]
|
|
5232
5474
|
}
|
|
5233
|
-
|
|
5234
|
-
cols.push({
|
|
5235
|
-
key: `attr_${attr}`,
|
|
5236
|
-
label: formattedLabel,
|
|
5237
|
-
sortable: !col.isSingleType,
|
|
5238
|
-
defaultVisible: ["department", "email", "location", "updated_at", "updatedAt"].includes(attr)
|
|
5239
|
-
});
|
|
5240
|
-
});
|
|
5241
|
-
const hasUpdatedAt = candidateAttrs.some((a) => a === "updatedAt" || a === "updated_at");
|
|
5242
|
-
const hasCreatedAt = candidateAttrs.some((a) => a === "createdAt" || a === "created_at");
|
|
5243
|
-
const hasPublishedAt = candidateAttrs.some((a) => a === "publishedAt" || a === "published_at");
|
|
5244
|
-
if (!hasUpdatedAt) {
|
|
5245
|
-
cols.push({
|
|
5246
|
-
key: "attr_updatedAt",
|
|
5247
|
-
label: "Updated At",
|
|
5248
|
-
sortable: !col.isSingleType,
|
|
5249
|
-
defaultVisible: false
|
|
5250
|
-
});
|
|
5251
|
-
}
|
|
5252
|
-
if (!hasCreatedAt) {
|
|
5253
|
-
cols.push({
|
|
5254
|
-
key: "attr_createdAt",
|
|
5255
|
-
label: "Created At",
|
|
5256
|
-
sortable: !col.isSingleType,
|
|
5257
|
-
defaultVisible: false
|
|
5258
|
-
});
|
|
5259
|
-
}
|
|
5260
|
-
if (!hasPublishedAt && col.draftAndPublish) {
|
|
5261
|
-
cols.push({
|
|
5262
|
-
key: "attr_publishedAt",
|
|
5263
|
-
label: "Published At",
|
|
5264
|
-
sortable: !col.isSingleType,
|
|
5265
|
-
defaultVisible: false
|
|
5266
|
-
});
|
|
5267
|
-
}
|
|
5268
|
-
if (searchAttribute && searchAttribute !== selectedAttribute) {
|
|
5269
|
-
let formattedSearchLabel = searchAttribute;
|
|
5270
|
-
const bracketMatch = searchAttribute.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
|
|
5271
|
-
if (bracketMatch) {
|
|
5272
|
-
const root = bracketMatch[1].charAt(0).toUpperCase() + bracketMatch[1].slice(1);
|
|
5273
|
-
const comp = formatComponentName(bracketMatch[2]);
|
|
5274
|
-
const sub = bracketMatch[3].split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
5275
|
-
formattedSearchLabel = `${root} [${comp}] > ${sub}`;
|
|
5276
|
-
} else if (searchAttribute.includes(".")) {
|
|
5277
|
-
formattedSearchLabel = searchAttribute.split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
5278
|
-
}
|
|
5279
|
-
cols.push({
|
|
5280
|
-
key: "search_attr",
|
|
5281
|
-
label: `Search: "${formattedSearchLabel}"`,
|
|
5282
|
-
sortable: !col.isSingleType && col.attributes.includes(searchAttribute),
|
|
5283
|
-
defaultVisible: true
|
|
5284
|
-
});
|
|
5285
|
-
}
|
|
5286
|
-
if (selectedAttribute && selectedAttribute.trim()) {
|
|
5287
|
-
let formattedTargetLabel = selectedAttribute;
|
|
5288
|
-
const bracketMatch = selectedAttribute.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
|
|
5289
|
-
if (bracketMatch) {
|
|
5290
|
-
const root = bracketMatch[1].charAt(0).toUpperCase() + bracketMatch[1].slice(1);
|
|
5291
|
-
const comp = formatComponentName(bracketMatch[2]);
|
|
5292
|
-
const sub = bracketMatch[3].split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
5293
|
-
formattedTargetLabel = `${root} [${comp}] > ${sub}`;
|
|
5294
|
-
} else if (selectedAttribute.includes(".")) {
|
|
5295
|
-
formattedTargetLabel = selectedAttribute.split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
|
|
5296
|
-
}
|
|
5297
|
-
const targetLabel = searchAttribute && searchAttribute !== selectedAttribute ? `Update Target: "${formattedTargetLabel}"` : `Current "${formattedTargetLabel}"`;
|
|
5298
|
-
cols.push({
|
|
5299
|
-
key: "target_attr",
|
|
5300
|
-
label: targetLabel,
|
|
5301
|
-
sortable: !col.isSingleType && col.attributes.includes(selectedAttribute),
|
|
5302
|
-
defaultVisible: true
|
|
5303
|
-
});
|
|
5475
|
+
);
|
|
5304
5476
|
}
|
|
5305
|
-
|
|
5306
|
-
key: "status",
|
|
5307
|
-
label: "Status",
|
|
5308
|
-
sortable: false,
|
|
5309
|
-
defaultVisible: true
|
|
5310
|
-
});
|
|
5311
|
-
return cols;
|
|
5312
|
-
}
|
|
5477
|
+
);
|
|
5313
5478
|
function getActiveSortLabel(currentSort, col) {
|
|
5314
5479
|
const f = currentSort.field;
|
|
5315
5480
|
const o = currentSort.order;
|
|
@@ -5439,7 +5604,7 @@ function renderHeaderCell(colDef, col, currentSort, selectedAttribute, searchAtt
|
|
|
5439
5604
|
if (colDef.key === "select") {
|
|
5440
5605
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { style: { width: 48 }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: "Select" }) }, "select");
|
|
5441
5606
|
}
|
|
5442
|
-
const isCurrentSorted = colDef.key === "identifier" && (currentSort.field === "name" || currentSort.field === "title" || currentSort.field === "id") || colDef.key === "search_attr" && currentSort.field === searchAttribute || colDef.key === "target_attr" && currentSort.field === selectedAttribute || colDef.key.startsWith("attr_") && (currentSort.field === colDef.key.replace("attr_", "") || currentSort.field === "updatedAt" && colDef.key === "attr_updated_at" || currentSort.field === "updated_at" && colDef.key === "attr_updatedAt" || currentSort.field === "createdAt" && colDef.key === "attr_created_at" || currentSort.field === "created_at" && colDef.key === "attr_createdAt" || currentSort.field === "publishedAt" && colDef.key === "attr_published_at" || currentSort.field === "published_at" && colDef.key === "attr_publishedAt");
|
|
5607
|
+
const isCurrentSorted = colDef.key === "identifier" && (currentSort.field === "name" || currentSort.field === "title" || currentSort.field === "id") || colDef.key === "search_attr" && currentSort.field === searchAttribute || (colDef.key === "target_attr" || colDef.key === "current_attr") && currentSort.field === selectedAttribute || colDef.key.startsWith("attr_") && (currentSort.field === colDef.key.replace("attr_", "") || currentSort.field === "updatedAt" && colDef.key === "attr_updated_at" || currentSort.field === "updated_at" && colDef.key === "attr_updatedAt" || currentSort.field === "createdAt" && colDef.key === "attr_created_at" || currentSort.field === "created_at" && colDef.key === "attr_createdAt" || currentSort.field === "publishedAt" && colDef.key === "attr_published_at" || currentSort.field === "published_at" && colDef.key === "attr_publishedAt");
|
|
5443
5608
|
const sortArrow = isCurrentSorted ? currentSort.order === "asc" ? "▲" : "▼" : "⇅";
|
|
5444
5609
|
const handleClick = () => {
|
|
5445
5610
|
if (!colDef.sortable) return;
|
|
@@ -5448,7 +5613,7 @@ function renderHeaderCell(colDef, col, currentSort, selectedAttribute, searchAtt
|
|
|
5448
5613
|
onSort(col.uid, field);
|
|
5449
5614
|
} else if (colDef.key === "search_attr") {
|
|
5450
5615
|
onSort(col.uid, searchAttribute);
|
|
5451
|
-
} else if (colDef.key === "target_attr") {
|
|
5616
|
+
} else if (colDef.key === "target_attr" || colDef.key === "current_attr") {
|
|
5452
5617
|
onSort(col.uid, selectedAttribute);
|
|
5453
5618
|
} else if (colDef.key.startsWith("attr_")) {
|
|
5454
5619
|
onSort(col.uid, colDef.key.replace("attr_", ""));
|
|
@@ -5492,7 +5657,7 @@ function formatDisplayValue(val) {
|
|
|
5492
5657
|
}
|
|
5493
5658
|
return String(val);
|
|
5494
5659
|
}
|
|
5495
|
-
function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribute, isMatch, hasAttr, isSelected, onToggleSelect, pendingBatches = [], isDzExpanded = false, onToggleExpandDz, filterQuery = "", gridCtx) {
|
|
5660
|
+
function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribute, isMatch, hasAttr, isSelected, onToggleSelect, pendingBatches = [], isDzExpanded = false, onToggleExpandDz, filterQuery = "", gridCtx, cellTooltip) {
|
|
5496
5661
|
switch (colDef.key) {
|
|
5497
5662
|
case "select":
|
|
5498
5663
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5544,6 +5709,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
5544
5709
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5545
5710
|
designSystem.Typography,
|
|
5546
5711
|
{
|
|
5712
|
+
title: cellTooltip || displayStr,
|
|
5547
5713
|
textColor: isUnset ? "neutral500" : "primary700",
|
|
5548
5714
|
fontWeight: "semiBold",
|
|
5549
5715
|
style: {
|
|
@@ -5562,9 +5728,11 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
5562
5728
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m) => {
|
|
5563
5729
|
const displayStr = formatDisplayValue(m.value);
|
|
5564
5730
|
const isMatchItem = qLower && displayStr.toLowerCase().includes(qLower);
|
|
5731
|
+
const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
|
|
5565
5732
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5566
5733
|
designSystem.Flex,
|
|
5567
5734
|
{
|
|
5735
|
+
title: occTooltip,
|
|
5568
5736
|
gap: 1,
|
|
5569
5737
|
alignItems: "center",
|
|
5570
5738
|
style: {
|
|
@@ -5584,6 +5752,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
5584
5752
|
designSystem.Typography,
|
|
5585
5753
|
{
|
|
5586
5754
|
variant: "pi",
|
|
5755
|
+
title: occTooltip,
|
|
5587
5756
|
fontWeight: isMatchItem ? "bold" : "normal",
|
|
5588
5757
|
textColor: isMatchItem ? "success700" : "neutral800",
|
|
5589
5758
|
style: {
|
|
@@ -5601,6 +5770,80 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
5601
5770
|
);
|
|
5602
5771
|
}) });
|
|
5603
5772
|
}
|
|
5773
|
+
case "current_attr": {
|
|
5774
|
+
if (selectedAttribute && !hasAttr) {
|
|
5775
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "neutral200", textColor: "neutral600", children: "Ignored (absent in schema)" });
|
|
5776
|
+
}
|
|
5777
|
+
const matches = getAllNestedValues(entry, selectedAttribute, col?.attributes);
|
|
5778
|
+
if (matches.length === 0) {
|
|
5779
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "(empty / not set)" });
|
|
5780
|
+
}
|
|
5781
|
+
if (matches.length === 1 && !matches[0].componentUid && !matches[0].path.includes("[#")) {
|
|
5782
|
+
const displayStr = formatDisplayValue(matches[0].value);
|
|
5783
|
+
const isUnset = displayStr === "(empty / not set)" || displayStr === "(empty / unlinked)";
|
|
5784
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5785
|
+
designSystem.Typography,
|
|
5786
|
+
{
|
|
5787
|
+
title: cellTooltip || displayStr,
|
|
5788
|
+
textColor: isUnset ? "neutral500" : "neutral800",
|
|
5789
|
+
style: {
|
|
5790
|
+
fontStyle: isUnset ? "italic" : "normal",
|
|
5791
|
+
display: "inline-block",
|
|
5792
|
+
maxWidth: 260,
|
|
5793
|
+
overflow: "hidden",
|
|
5794
|
+
textOverflow: "ellipsis",
|
|
5795
|
+
whiteSpace: "nowrap"
|
|
5796
|
+
},
|
|
5797
|
+
children: displayStr
|
|
5798
|
+
}
|
|
5799
|
+
);
|
|
5800
|
+
}
|
|
5801
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m) => {
|
|
5802
|
+
const displayStr = formatDisplayValue(m.value);
|
|
5803
|
+
const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
|
|
5804
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5805
|
+
designSystem.Flex,
|
|
5806
|
+
{
|
|
5807
|
+
title: occTooltip,
|
|
5808
|
+
gap: 1,
|
|
5809
|
+
alignItems: "center",
|
|
5810
|
+
style: {
|
|
5811
|
+
backgroundColor: "rgba(0, 0, 0, 0.03)",
|
|
5812
|
+
padding: "2px 6px",
|
|
5813
|
+
borderRadius: 4
|
|
5814
|
+
},
|
|
5815
|
+
children: [
|
|
5816
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { size: "S", backgroundColor: "neutral200", textColor: "neutral800", children: [
|
|
5817
|
+
"#",
|
|
5818
|
+
m.index,
|
|
5819
|
+
" ",
|
|
5820
|
+
m.componentName || "Item"
|
|
5821
|
+
] }),
|
|
5822
|
+
m.componentId !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral500", style: { fontSize: "0.68rem" }, children: [
|
|
5823
|
+
"id:",
|
|
5824
|
+
m.componentId
|
|
5825
|
+
] }),
|
|
5826
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5827
|
+
designSystem.Typography,
|
|
5828
|
+
{
|
|
5829
|
+
variant: "pi",
|
|
5830
|
+
title: occTooltip,
|
|
5831
|
+
textColor: "neutral800",
|
|
5832
|
+
style: {
|
|
5833
|
+
maxWidth: 200,
|
|
5834
|
+
overflow: "hidden",
|
|
5835
|
+
textOverflow: "ellipsis",
|
|
5836
|
+
whiteSpace: "nowrap"
|
|
5837
|
+
},
|
|
5838
|
+
children: displayStr
|
|
5839
|
+
}
|
|
5840
|
+
)
|
|
5841
|
+
]
|
|
5842
|
+
},
|
|
5843
|
+
m.index
|
|
5844
|
+
);
|
|
5845
|
+
}) });
|
|
5846
|
+
}
|
|
5604
5847
|
case "target_attr": {
|
|
5605
5848
|
if (gridCtx?.gridEditMode) {
|
|
5606
5849
|
if (selectedAttribute && !hasAttr) {
|
|
@@ -5694,6 +5937,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
5694
5937
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5695
5938
|
designSystem.Typography,
|
|
5696
5939
|
{
|
|
5940
|
+
title: cellTooltip || displayStr,
|
|
5697
5941
|
textColor: isUnset ? "neutral500" : "neutral800",
|
|
5698
5942
|
style: {
|
|
5699
5943
|
fontStyle: isUnset ? "italic" : "normal",
|
|
@@ -5709,9 +5953,11 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
5709
5953
|
}
|
|
5710
5954
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m) => {
|
|
5711
5955
|
const displayStr = formatDisplayValue(m.value);
|
|
5956
|
+
const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
|
|
5712
5957
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5713
5958
|
designSystem.Flex,
|
|
5714
5959
|
{
|
|
5960
|
+
title: occTooltip,
|
|
5715
5961
|
gap: 1,
|
|
5716
5962
|
alignItems: "center",
|
|
5717
5963
|
style: {
|
|
@@ -5724,12 +5970,17 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
5724
5970
|
"#",
|
|
5725
5971
|
m.index,
|
|
5726
5972
|
" ",
|
|
5727
|
-
m.componentName
|
|
5973
|
+
m.componentName || "Item"
|
|
5974
|
+
] }),
|
|
5975
|
+
m.componentId !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral500", style: { fontSize: "0.68rem" }, children: [
|
|
5976
|
+
"id:",
|
|
5977
|
+
m.componentId
|
|
5728
5978
|
] }),
|
|
5729
5979
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5730
5980
|
designSystem.Typography,
|
|
5731
5981
|
{
|
|
5732
5982
|
variant: "pi",
|
|
5983
|
+
title: occTooltip,
|
|
5733
5984
|
textColor: "neutral800",
|
|
5734
5985
|
style: {
|
|
5735
5986
|
maxWidth: 200,
|
|
@@ -5758,16 +6009,67 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
|
|
|
5758
6009
|
}
|
|
5759
6010
|
default: {
|
|
5760
6011
|
const attrName = colDef.key.replace("attr_", "");
|
|
5761
|
-
const
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
6012
|
+
const matches = getAllNestedValues(entry, attrName, col?.attributes);
|
|
6013
|
+
if (matches.length === 0) {
|
|
6014
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "-" });
|
|
6015
|
+
}
|
|
6016
|
+
if (matches.length === 1 && !matches[0].componentUid && !matches[0].path.includes("[#")) {
|
|
6017
|
+
const displayStr = formatDisplayValue(matches[0].value);
|
|
6018
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6019
|
+
designSystem.Typography,
|
|
6020
|
+
{
|
|
6021
|
+
title: cellTooltip || (displayStr === "(empty / not set)" ? void 0 : displayStr),
|
|
6022
|
+
textColor: "neutral700",
|
|
6023
|
+
style: { maxWidth: 200, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
|
6024
|
+
children: displayStr === "(empty / not set)" ? "-" : displayStr
|
|
6025
|
+
}
|
|
6026
|
+
);
|
|
6027
|
+
}
|
|
6028
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m, mIdx) => {
|
|
6029
|
+
const displayStr = formatDisplayValue(m.value);
|
|
6030
|
+
const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
|
|
6031
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6032
|
+
designSystem.Flex,
|
|
6033
|
+
{
|
|
6034
|
+
title: occTooltip,
|
|
6035
|
+
gap: 1,
|
|
6036
|
+
alignItems: "center",
|
|
6037
|
+
style: {
|
|
6038
|
+
backgroundColor: "rgba(0, 0, 0, 0.03)",
|
|
6039
|
+
padding: "2px 6px",
|
|
6040
|
+
borderRadius: 4
|
|
6041
|
+
},
|
|
6042
|
+
children: [
|
|
6043
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { size: "S", backgroundColor: "neutral200", textColor: "neutral800", children: [
|
|
6044
|
+
"#",
|
|
6045
|
+
m.index,
|
|
6046
|
+
" ",
|
|
6047
|
+
m.componentName || "Item"
|
|
6048
|
+
] }),
|
|
6049
|
+
m.componentId !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral500", style: { fontSize: "0.68rem" }, children: [
|
|
6050
|
+
"id:",
|
|
6051
|
+
m.componentId
|
|
6052
|
+
] }),
|
|
6053
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6054
|
+
designSystem.Typography,
|
|
6055
|
+
{
|
|
6056
|
+
variant: "pi",
|
|
6057
|
+
title: occTooltip,
|
|
6058
|
+
textColor: "neutral800",
|
|
6059
|
+
style: {
|
|
6060
|
+
maxWidth: 200,
|
|
6061
|
+
overflow: "hidden",
|
|
6062
|
+
textOverflow: "ellipsis",
|
|
6063
|
+
whiteSpace: "nowrap"
|
|
6064
|
+
},
|
|
6065
|
+
children: displayStr
|
|
6066
|
+
}
|
|
6067
|
+
)
|
|
6068
|
+
]
|
|
6069
|
+
},
|
|
6070
|
+
`${m.index}_${m.componentId ?? mIdx}_${m.componentUid ?? ""}`
|
|
6071
|
+
);
|
|
6072
|
+
}) });
|
|
5771
6073
|
}
|
|
5772
6074
|
}
|
|
5773
6075
|
}
|
|
@@ -6394,8 +6696,11 @@ const BulkUpdater = () => {
|
|
|
6394
6696
|
if (selectedCollectionUid) {
|
|
6395
6697
|
setCollectionColumnVisibility((prev) => {
|
|
6396
6698
|
const existing = prev[selectedCollectionUid];
|
|
6397
|
-
if (existing
|
|
6398
|
-
|
|
6699
|
+
if (existing) {
|
|
6700
|
+
const next = [...existing];
|
|
6701
|
+
if (!next.includes("current_attr")) next.push("current_attr");
|
|
6702
|
+
if (!next.includes("target_attr")) next.push("target_attr");
|
|
6703
|
+
return { ...prev, [selectedCollectionUid]: next };
|
|
6399
6704
|
}
|
|
6400
6705
|
return prev;
|
|
6401
6706
|
});
|
|
@@ -6477,6 +6782,18 @@ const BulkUpdater = () => {
|
|
|
6477
6782
|
}
|
|
6478
6783
|
setGridEdits({});
|
|
6479
6784
|
setSelectedAttribute(newAttr);
|
|
6785
|
+
if (newAttr && selectedCollectionUid) {
|
|
6786
|
+
setCollectionColumnVisibility((prev) => {
|
|
6787
|
+
const existing = prev[selectedCollectionUid];
|
|
6788
|
+
if (existing) {
|
|
6789
|
+
const next = [...existing];
|
|
6790
|
+
if (!next.includes("current_attr")) next.push("current_attr");
|
|
6791
|
+
if (!next.includes("target_attr")) next.push("target_attr");
|
|
6792
|
+
return { ...prev, [selectedCollectionUid]: next };
|
|
6793
|
+
}
|
|
6794
|
+
return prev;
|
|
6795
|
+
});
|
|
6796
|
+
}
|
|
6480
6797
|
try {
|
|
6481
6798
|
if (newAttr) {
|
|
6482
6799
|
localStorage.setItem(LAST_ATTR_KEY, newAttr);
|
|
@@ -7184,7 +7501,31 @@ const BulkUpdater = () => {
|
|
|
7184
7501
|
}
|
|
7185
7502
|
try {
|
|
7186
7503
|
setBulkExporting(true);
|
|
7187
|
-
const
|
|
7504
|
+
const targetUids = Array.from(new Set(targets.map((t) => t.uid)));
|
|
7505
|
+
let bulkSelectedCols;
|
|
7506
|
+
if (targetUids.length === 1 && selectedCol && selectedCol.uid === targetUids[0]) {
|
|
7507
|
+
const availCols = getAvailableColumnsForCollection(selectedCol, selectedAttribute, searchAttribute);
|
|
7508
|
+
const savedKeys = collectionColumnVisibility[selectedCol.uid];
|
|
7509
|
+
const activeCols = savedKeys ? availCols.filter((c) => c.isPermanent || savedKeys.includes(c.key)) : availCols.filter((c) => c.defaultVisible);
|
|
7510
|
+
const selectedDataAttrs = [];
|
|
7511
|
+
for (const c of activeCols) {
|
|
7512
|
+
if (c.key.startsWith("attr_")) {
|
|
7513
|
+
const attr = c.key.slice(5);
|
|
7514
|
+
if (!selectedDataAttrs.includes(attr)) selectedDataAttrs.push(attr);
|
|
7515
|
+
} else if ((c.key === "target_attr" || c.key === "current_attr") && selectedAttribute) {
|
|
7516
|
+
if (!selectedDataAttrs.includes(selectedAttribute)) selectedDataAttrs.push(selectedAttribute);
|
|
7517
|
+
} else if (c.key === "search_attr" && searchAttribute) {
|
|
7518
|
+
if (!selectedDataAttrs.includes(searchAttribute)) selectedDataAttrs.push(searchAttribute);
|
|
7519
|
+
}
|
|
7520
|
+
}
|
|
7521
|
+
if (selectedDataAttrs.length > 0) {
|
|
7522
|
+
bulkSelectedCols = selectedDataAttrs;
|
|
7523
|
+
}
|
|
7524
|
+
}
|
|
7525
|
+
const res = await post("/bulk-updater/csv/export-bulk", {
|
|
7526
|
+
selectedEntries: targets,
|
|
7527
|
+
selectedColumns: bulkSelectedCols
|
|
7528
|
+
});
|
|
7188
7529
|
const csvStr = res.data?.csvContent || (typeof res.data === "string" ? res.data : "");
|
|
7189
7530
|
if (!csvStr) {
|
|
7190
7531
|
toggleNotification({
|
|
@@ -8390,6 +8731,21 @@ const BulkUpdater = () => {
|
|
|
8390
8731
|
if (colSelectedDocIds.length > 0) {
|
|
8391
8732
|
params.set("documentIds", colSelectedDocIds.join(","));
|
|
8392
8733
|
}
|
|
8734
|
+
const selectedDataAttrs = [];
|
|
8735
|
+
for (const c of activeColumns) {
|
|
8736
|
+
if (c.key.startsWith("attr_")) {
|
|
8737
|
+
const attr = c.key.slice(5);
|
|
8738
|
+
if (!selectedDataAttrs.includes(attr)) selectedDataAttrs.push(attr);
|
|
8739
|
+
} else if ((c.key === "target_attr" || c.key === "current_attr") && selectedAttribute) {
|
|
8740
|
+
if (!selectedDataAttrs.includes(selectedAttribute)) selectedDataAttrs.push(selectedAttribute);
|
|
8741
|
+
} else if (c.key === "search_attr" && searchAttribute) {
|
|
8742
|
+
if (!selectedDataAttrs.includes(searchAttribute)) selectedDataAttrs.push(searchAttribute);
|
|
8743
|
+
}
|
|
8744
|
+
}
|
|
8745
|
+
if (selectedDataAttrs.length > 0) {
|
|
8746
|
+
params.set("selectedColumns", selectedDataAttrs.join(","));
|
|
8747
|
+
params.set("exportMode", "selective");
|
|
8748
|
+
}
|
|
8393
8749
|
const res = await get(`/bulk-updater/csv/export/${col.uid}?${params.toString()}`);
|
|
8394
8750
|
const csvStr = res.data?.csvContent || (typeof res.data === "string" ? res.data : "");
|
|
8395
8751
|
if (!csvStr) {
|
|
@@ -8531,22 +8887,33 @@ const BulkUpdater = () => {
|
|
|
8531
8887
|
backgroundColor: recordEdits ? "rgba(73, 69, 255, 0.10)" : isSelected ? "rgba(73, 69, 255, 0.14)" : isMatch ? "rgba(46, 213, 115, 0.08)" : void 0,
|
|
8532
8888
|
boxShadow: isSelected ? "inset 3px 0 0 0 #4945ff" : isMatch ? "inset 3px 0 0 0 #2ed573" : void 0
|
|
8533
8889
|
},
|
|
8534
|
-
children: activeColumns.map((colDef) =>
|
|
8535
|
-
|
|
8536
|
-
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8890
|
+
children: activeColumns.map((colDef) => {
|
|
8891
|
+
const cellTooltip = getCellTooltipText(
|
|
8892
|
+
colDef,
|
|
8893
|
+
entry,
|
|
8894
|
+
col?.attributes,
|
|
8895
|
+
selectedAttribute,
|
|
8896
|
+
searchAttribute,
|
|
8897
|
+
recordEdits
|
|
8898
|
+
);
|
|
8899
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { title: cellTooltip, children: renderCellContent(
|
|
8900
|
+
colDef,
|
|
8901
|
+
entry,
|
|
8902
|
+
col,
|
|
8903
|
+
selectedAttribute,
|
|
8904
|
+
searchAttribute,
|
|
8905
|
+
isMatch,
|
|
8906
|
+
hasAttr,
|
|
8907
|
+
isSelected,
|
|
8908
|
+
() => toggleEntry(col.uid, entry.documentId),
|
|
8909
|
+
pendingBatches,
|
|
8910
|
+
isDzExpanded,
|
|
8911
|
+
onToggleExpandDz,
|
|
8912
|
+
filterQuery,
|
|
8913
|
+
gridCtx,
|
|
8914
|
+
cellTooltip
|
|
8915
|
+
) }, colDef.key);
|
|
8916
|
+
})
|
|
8550
8917
|
}
|
|
8551
8918
|
),
|
|
8552
8919
|
isDzExpanded && expandableArrayFields.map((dzKey) => {
|
|
@@ -10160,12 +10527,14 @@ const BulkUpdater = () => {
|
|
|
10160
10527
|
exports.default = BulkUpdater;
|
|
10161
10528
|
exports.formatComponentName = formatComponentName;
|
|
10162
10529
|
exports.formatDisplayValue = formatDisplayValue;
|
|
10530
|
+
exports.formatFullTooltipValue = formatFullTooltipValue;
|
|
10163
10531
|
exports.getActiveSortLabel = getActiveSortLabel;
|
|
10164
10532
|
exports.getAllNestedValues = getAllNestedValues;
|
|
10165
10533
|
exports.getAvailableColumnsForCollection = getAvailableColumnsForCollection;
|
|
10534
|
+
exports.getCellTooltipText = getCellTooltipText;
|
|
10166
10535
|
exports.getEntryLifecycleStatus = getEntryLifecycleStatus;
|
|
10167
10536
|
exports.getNestedValue = getNestedValue;
|
|
10168
10537
|
exports.getPropertyValue = getPropertyValue;
|
|
10169
10538
|
exports.getSortOptionsForCollection = getSortOptionsForCollection;
|
|
10170
10539
|
exports.parseDynamicZonePath = parseDynamicZonePath;
|
|
10171
|
-
//# sourceMappingURL=BulkUpdater-
|
|
10540
|
+
//# sourceMappingURL=BulkUpdater-BEhLlXOK.js.map
|