strapi-plugin-bulk-updater 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{BulkUpdater-JZW74XM4.js → BulkUpdater-DMkx6dLf.js} +118 -67
- package/dist/_chunks/BulkUpdater-DMkx6dLf.js.map +1 -0
- package/dist/_chunks/{BulkUpdater-BiSkkAHF.mjs → BulkUpdater-DUfv52ng.mjs} +118 -67
- package/dist/_chunks/BulkUpdater-DUfv52ng.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +133 -5
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +133 -5
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/_chunks/BulkUpdater-BiSkkAHF.mjs.map +0 -1
- package/dist/_chunks/BulkUpdater-JZW74XM4.js.map +0 -1
|
@@ -2853,6 +2853,91 @@ const CheckerReviewModal = ({
|
|
|
2853
2853
|
}
|
|
2854
2854
|
);
|
|
2855
2855
|
};
|
|
2856
|
+
function getEntryLifecycleStatus(entry, col, pendingBatches = []) {
|
|
2857
|
+
const isPendingApproval = pendingBatches.some((b) => {
|
|
2858
|
+
if (b.status !== "pending_approval") return false;
|
|
2859
|
+
const targets = b.payload?.selectedEntries || [];
|
|
2860
|
+
return targets.some((t) => entry.documentId && t.documentId === entry.documentId || String(t.documentId) === String(entry.id));
|
|
2861
|
+
});
|
|
2862
|
+
if (isPendingApproval) {
|
|
2863
|
+
return {
|
|
2864
|
+
status: "pending_review",
|
|
2865
|
+
label: "Pending Review",
|
|
2866
|
+
badgeColor: "warning100",
|
|
2867
|
+
textColor: "warning700"
|
|
2868
|
+
};
|
|
2869
|
+
}
|
|
2870
|
+
if (col && col.draftAndPublish === false) {
|
|
2871
|
+
return {
|
|
2872
|
+
status: "published",
|
|
2873
|
+
label: "Published",
|
|
2874
|
+
badgeColor: "success100",
|
|
2875
|
+
textColor: "success700"
|
|
2876
|
+
};
|
|
2877
|
+
}
|
|
2878
|
+
if (entry.status === "modified") {
|
|
2879
|
+
return {
|
|
2880
|
+
status: "modified",
|
|
2881
|
+
label: "Modified",
|
|
2882
|
+
badgeColor: "primary100",
|
|
2883
|
+
textColor: "primary700"
|
|
2884
|
+
};
|
|
2885
|
+
}
|
|
2886
|
+
if (entry.status === "draft") {
|
|
2887
|
+
return {
|
|
2888
|
+
status: "draft",
|
|
2889
|
+
label: "Draft",
|
|
2890
|
+
badgeColor: "neutral150",
|
|
2891
|
+
textColor: "neutral700"
|
|
2892
|
+
};
|
|
2893
|
+
}
|
|
2894
|
+
if (entry.status === "published") {
|
|
2895
|
+
return {
|
|
2896
|
+
status: "published",
|
|
2897
|
+
label: "Published",
|
|
2898
|
+
badgeColor: "success100",
|
|
2899
|
+
textColor: "success700"
|
|
2900
|
+
};
|
|
2901
|
+
}
|
|
2902
|
+
if (entry.status === "unknown") {
|
|
2903
|
+
return {
|
|
2904
|
+
status: "unknown",
|
|
2905
|
+
label: "Unknown",
|
|
2906
|
+
badgeColor: "neutral200",
|
|
2907
|
+
textColor: "neutral600"
|
|
2908
|
+
};
|
|
2909
|
+
}
|
|
2910
|
+
if (!entry.documentId && !entry.id && !entry.slug) {
|
|
2911
|
+
return {
|
|
2912
|
+
status: "unknown",
|
|
2913
|
+
label: "Unknown",
|
|
2914
|
+
badgeColor: "neutral200",
|
|
2915
|
+
textColor: "neutral600"
|
|
2916
|
+
};
|
|
2917
|
+
}
|
|
2918
|
+
if (entry.publishedAt) {
|
|
2919
|
+
if (entry.updatedAt && new Date(entry.updatedAt).getTime() > new Date(entry.publishedAt).getTime()) {
|
|
2920
|
+
return {
|
|
2921
|
+
status: "modified",
|
|
2922
|
+
label: "Modified",
|
|
2923
|
+
badgeColor: "primary100",
|
|
2924
|
+
textColor: "primary700"
|
|
2925
|
+
};
|
|
2926
|
+
}
|
|
2927
|
+
return {
|
|
2928
|
+
status: "published",
|
|
2929
|
+
label: "Published",
|
|
2930
|
+
badgeColor: "success100",
|
|
2931
|
+
textColor: "success700"
|
|
2932
|
+
};
|
|
2933
|
+
}
|
|
2934
|
+
return {
|
|
2935
|
+
status: "draft",
|
|
2936
|
+
label: "Draft",
|
|
2937
|
+
badgeColor: "neutral150",
|
|
2938
|
+
textColor: "neutral700"
|
|
2939
|
+
};
|
|
2940
|
+
}
|
|
2856
2941
|
function parseDynamicZonePath(path) {
|
|
2857
2942
|
if (!path) return { cleanPath: "", rootKey: "", subPath: "" };
|
|
2858
2943
|
const bracketMatch = path.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
|
|
@@ -3265,67 +3350,6 @@ function formatDisplayValue(val) {
|
|
|
3265
3350
|
}
|
|
3266
3351
|
return String(val);
|
|
3267
3352
|
}
|
|
3268
|
-
function getEntryLifecycleStatus(entry, col, pendingBatches = []) {
|
|
3269
|
-
const isPendingApproval = pendingBatches.some((b) => {
|
|
3270
|
-
if (b.status !== "pending_approval") return false;
|
|
3271
|
-
const targets = b.payload?.selectedEntries || [];
|
|
3272
|
-
return targets.some((t) => t.documentId === entry.documentId || String(t.documentId) === String(entry.id));
|
|
3273
|
-
});
|
|
3274
|
-
if (isPendingApproval) {
|
|
3275
|
-
return {
|
|
3276
|
-
status: "pending_review",
|
|
3277
|
-
label: "Pending Review",
|
|
3278
|
-
badgeColor: "warning100",
|
|
3279
|
-
textColor: "warning700"
|
|
3280
|
-
};
|
|
3281
|
-
}
|
|
3282
|
-
if (entry.status === "modified") {
|
|
3283
|
-
return {
|
|
3284
|
-
status: "modified",
|
|
3285
|
-
label: "Modified",
|
|
3286
|
-
badgeColor: "primary100",
|
|
3287
|
-
textColor: "primary700"
|
|
3288
|
-
};
|
|
3289
|
-
}
|
|
3290
|
-
if (entry.status === "draft") {
|
|
3291
|
-
return {
|
|
3292
|
-
status: "draft",
|
|
3293
|
-
label: "Draft",
|
|
3294
|
-
badgeColor: "neutral150",
|
|
3295
|
-
textColor: "neutral700"
|
|
3296
|
-
};
|
|
3297
|
-
}
|
|
3298
|
-
if (entry.status === "published") {
|
|
3299
|
-
return {
|
|
3300
|
-
status: "published",
|
|
3301
|
-
label: "Published",
|
|
3302
|
-
badgeColor: "success100",
|
|
3303
|
-
textColor: "success700"
|
|
3304
|
-
};
|
|
3305
|
-
}
|
|
3306
|
-
if (col && col.draftAndPublish === false) {
|
|
3307
|
-
return {
|
|
3308
|
-
status: "published",
|
|
3309
|
-
label: "Published",
|
|
3310
|
-
badgeColor: "success100",
|
|
3311
|
-
textColor: "success700"
|
|
3312
|
-
};
|
|
3313
|
-
}
|
|
3314
|
-
if (entry.publishedAt) {
|
|
3315
|
-
return {
|
|
3316
|
-
status: "published",
|
|
3317
|
-
label: "Published",
|
|
3318
|
-
badgeColor: "success100",
|
|
3319
|
-
textColor: "success700"
|
|
3320
|
-
};
|
|
3321
|
-
}
|
|
3322
|
-
return {
|
|
3323
|
-
status: "draft",
|
|
3324
|
-
label: "Draft",
|
|
3325
|
-
badgeColor: "neutral150",
|
|
3326
|
-
textColor: "neutral700"
|
|
3327
|
-
};
|
|
3328
|
-
}
|
|
3329
3353
|
function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribute, isMatch, hasAttr, isSelected, onToggleSelect, pendingBatches = [], isDzExpanded = false, onToggleExpandDz, filterQuery = "") {
|
|
3330
3354
|
switch (colDef.key) {
|
|
3331
3355
|
case "select":
|
|
@@ -3732,12 +3756,23 @@ const BulkUpdater = () => {
|
|
|
3732
3756
|
cols.forEach((col) => {
|
|
3733
3757
|
const total = col.totalEntries !== void 0 ? col.totalEntries : col.entries ? col.entries.length : 0;
|
|
3734
3758
|
const initialPageSize = col.isSingleType ? 1 : 10;
|
|
3759
|
+
const previewSlice = (col.entries || []).slice(0, initialPageSize).map((entry) => {
|
|
3760
|
+
if (!entry.status) {
|
|
3761
|
+
const lifecycle = getEntryLifecycleStatus(entry, col, pendingBatches);
|
|
3762
|
+
return {
|
|
3763
|
+
...entry,
|
|
3764
|
+
status: lifecycle.status,
|
|
3765
|
+
publishedAt: entry.publishedAt ?? (lifecycle.status === "published" ? entry.updatedAt || null : null)
|
|
3766
|
+
};
|
|
3767
|
+
}
|
|
3768
|
+
return entry;
|
|
3769
|
+
});
|
|
3735
3770
|
pages[col.uid] = {
|
|
3736
3771
|
page: 1,
|
|
3737
3772
|
pageSize: initialPageSize,
|
|
3738
3773
|
total,
|
|
3739
3774
|
pageCount: col.isSingleType ? 1 : Math.ceil(total / initialPageSize) || 1,
|
|
3740
|
-
entries:
|
|
3775
|
+
entries: previewSlice,
|
|
3741
3776
|
loading: false
|
|
3742
3777
|
};
|
|
3743
3778
|
initialVisibility[col.uid] = true;
|
|
@@ -3859,6 +3894,18 @@ const BulkUpdater = () => {
|
|
|
3859
3894
|
const pageSizeNum = res.data.pagination?.pageSize ?? size ?? defaultPageSize;
|
|
3860
3895
|
const totalNum = res.data.pagination?.total !== void 0 ? res.data.pagination.total : fetchedEntries.length;
|
|
3861
3896
|
const pageCountNum = res.data.pagination?.pageCount ?? Math.max(1, Math.ceil(totalNum / pageSizeNum));
|
|
3897
|
+
const col = collections.find((c) => c.uid === colUid) || null;
|
|
3898
|
+
const enrichedEntries = fetchedEntries.map((entry) => {
|
|
3899
|
+
if (!entry.status) {
|
|
3900
|
+
const lifecycle = getEntryLifecycleStatus(entry, col, pendingBatches);
|
|
3901
|
+
return {
|
|
3902
|
+
...entry,
|
|
3903
|
+
status: lifecycle.status,
|
|
3904
|
+
publishedAt: entry.publishedAt ?? (lifecycle.status === "published" ? entry.updatedAt || null : null)
|
|
3905
|
+
};
|
|
3906
|
+
}
|
|
3907
|
+
return entry;
|
|
3908
|
+
});
|
|
3862
3909
|
setCollectionPages((prev) => ({
|
|
3863
3910
|
...prev,
|
|
3864
3911
|
[colUid]: {
|
|
@@ -3866,7 +3913,7 @@ const BulkUpdater = () => {
|
|
|
3866
3913
|
pageSize: pageSizeNum,
|
|
3867
3914
|
total: totalNum,
|
|
3868
3915
|
pageCount: pageCountNum,
|
|
3869
|
-
entries:
|
|
3916
|
+
entries: enrichedEntries,
|
|
3870
3917
|
loading: false
|
|
3871
3918
|
}
|
|
3872
3919
|
}));
|
|
@@ -4340,6 +4387,7 @@ const BulkUpdater = () => {
|
|
|
4340
4387
|
let modified = 0;
|
|
4341
4388
|
let draft = 0;
|
|
4342
4389
|
let pendingReview = 0;
|
|
4390
|
+
let unknown = 0;
|
|
4343
4391
|
Object.keys(selectedEntries).forEach((key) => {
|
|
4344
4392
|
if (!selectedEntries[key]) return;
|
|
4345
4393
|
const parts = key.split(KEY_SEP);
|
|
@@ -4355,18 +4403,20 @@ const BulkUpdater = () => {
|
|
|
4355
4403
|
else if (status === "modified") modified++;
|
|
4356
4404
|
else if (status === "draft") draft++;
|
|
4357
4405
|
else if (status === "pending_review") pendingReview++;
|
|
4406
|
+
else unknown++;
|
|
4358
4407
|
} else {
|
|
4359
4408
|
draft++;
|
|
4360
4409
|
}
|
|
4361
4410
|
});
|
|
4362
|
-
const unreviewedCount = draft + modified + pendingReview;
|
|
4411
|
+
const unreviewedCount = draft + modified + pendingReview + unknown;
|
|
4363
4412
|
return {
|
|
4364
4413
|
published,
|
|
4365
4414
|
modified,
|
|
4366
4415
|
draft,
|
|
4367
4416
|
pendingReview,
|
|
4417
|
+
unknown,
|
|
4368
4418
|
unreviewedCount,
|
|
4369
|
-
total: published + modified + draft + pendingReview
|
|
4419
|
+
total: published + modified + draft + pendingReview + unknown
|
|
4370
4420
|
};
|
|
4371
4421
|
}, [selectedEntries, collections, collectionPages, pendingBatches]);
|
|
4372
4422
|
const handleOpenConfirmModal = () => {
|
|
@@ -5373,7 +5423,8 @@ const BulkUpdater = () => {
|
|
|
5373
5423
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "pending_review", children: "Pending Review (Due)" }),
|
|
5374
5424
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "draft", children: "Draft" }),
|
|
5375
5425
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "published", children: "Published" }),
|
|
5376
|
-
/* @__PURE__ */ jsx(SingleSelectOption, { value: "modified", children: "Modified" })
|
|
5426
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "modified", children: "Modified" }),
|
|
5427
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "unknown", children: "Unknown" })
|
|
5377
5428
|
]
|
|
5378
5429
|
}
|
|
5379
5430
|
) }),
|
|
@@ -7465,4 +7516,4 @@ export {
|
|
|
7465
7516
|
getSortOptionsForCollection,
|
|
7466
7517
|
parseDynamicZonePath
|
|
7467
7518
|
};
|
|
7468
|
-
//# sourceMappingURL=BulkUpdater-
|
|
7519
|
+
//# sourceMappingURL=BulkUpdater-DUfv52ng.mjs.map
|