strapi-plugin-bulk-updater 1.5.2 → 1.5.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-BiSkkAHF.mjs → BulkUpdater-7YA96VJT.mjs} +118 -68
- package/dist/_chunks/BulkUpdater-7YA96VJT.mjs.map +1 -0
- package/dist/_chunks/{BulkUpdater-JZW74XM4.js → BulkUpdater-BTWJq8UX.js} +118 -68
- package/dist/_chunks/BulkUpdater-BTWJq8UX.js.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
|
}));
|
|
@@ -3989,7 +4036,6 @@ const BulkUpdater = () => {
|
|
|
3989
4036
|
}
|
|
3990
4037
|
setSelectedEntries({});
|
|
3991
4038
|
setSearchAttribute("");
|
|
3992
|
-
setSearchAttributeSearch("");
|
|
3993
4039
|
const targetCol = collections.find((c) => c.uid === newUid);
|
|
3994
4040
|
const colAttrs = targetCol?.attributes || [];
|
|
3995
4041
|
setAttributes(colAttrs);
|
|
@@ -4340,6 +4386,7 @@ const BulkUpdater = () => {
|
|
|
4340
4386
|
let modified = 0;
|
|
4341
4387
|
let draft = 0;
|
|
4342
4388
|
let pendingReview = 0;
|
|
4389
|
+
let unknown = 0;
|
|
4343
4390
|
Object.keys(selectedEntries).forEach((key) => {
|
|
4344
4391
|
if (!selectedEntries[key]) return;
|
|
4345
4392
|
const parts = key.split(KEY_SEP);
|
|
@@ -4355,18 +4402,20 @@ const BulkUpdater = () => {
|
|
|
4355
4402
|
else if (status === "modified") modified++;
|
|
4356
4403
|
else if (status === "draft") draft++;
|
|
4357
4404
|
else if (status === "pending_review") pendingReview++;
|
|
4405
|
+
else unknown++;
|
|
4358
4406
|
} else {
|
|
4359
4407
|
draft++;
|
|
4360
4408
|
}
|
|
4361
4409
|
});
|
|
4362
|
-
const unreviewedCount = draft + modified + pendingReview;
|
|
4410
|
+
const unreviewedCount = draft + modified + pendingReview + unknown;
|
|
4363
4411
|
return {
|
|
4364
4412
|
published,
|
|
4365
4413
|
modified,
|
|
4366
4414
|
draft,
|
|
4367
4415
|
pendingReview,
|
|
4416
|
+
unknown,
|
|
4368
4417
|
unreviewedCount,
|
|
4369
|
-
total: published + modified + draft + pendingReview
|
|
4418
|
+
total: published + modified + draft + pendingReview + unknown
|
|
4370
4419
|
};
|
|
4371
4420
|
}, [selectedEntries, collections, collectionPages, pendingBatches]);
|
|
4372
4421
|
const handleOpenConfirmModal = () => {
|
|
@@ -5373,7 +5422,8 @@ const BulkUpdater = () => {
|
|
|
5373
5422
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "pending_review", children: "Pending Review (Due)" }),
|
|
5374
5423
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "draft", children: "Draft" }),
|
|
5375
5424
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "published", children: "Published" }),
|
|
5376
|
-
/* @__PURE__ */ jsx(SingleSelectOption, { value: "modified", children: "Modified" })
|
|
5425
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "modified", children: "Modified" }),
|
|
5426
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "unknown", children: "Unknown" })
|
|
5377
5427
|
]
|
|
5378
5428
|
}
|
|
5379
5429
|
) }),
|
|
@@ -7465,4 +7515,4 @@ export {
|
|
|
7465
7515
|
getSortOptionsForCollection,
|
|
7466
7516
|
parseDynamicZonePath
|
|
7467
7517
|
};
|
|
7468
|
-
//# sourceMappingURL=BulkUpdater-
|
|
7518
|
+
//# sourceMappingURL=BulkUpdater-7YA96VJT.mjs.map
|