strapi-plugin-bulk-updater 1.5.0 → 1.5.2
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-By9Dd_YF.mjs → BulkUpdater-BiSkkAHF.mjs} +17 -70
- package/dist/_chunks/BulkUpdater-BiSkkAHF.mjs.map +1 -0
- package/dist/_chunks/{BulkUpdater-CSmtXjbM.js → BulkUpdater-JZW74XM4.js} +17 -70
- package/dist/_chunks/BulkUpdater-JZW74XM4.js.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +68 -35
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +68 -35
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/_chunks/BulkUpdater-By9Dd_YF.mjs.map +0 -1
- package/dist/_chunks/BulkUpdater-CSmtXjbM.js.map +0 -1
|
@@ -4027,8 +4027,6 @@ const BulkUpdater = () => {
|
|
|
4027
4027
|
const filteredCollections = useMemo(() => {
|
|
4028
4028
|
return selectedCol ? [selectedCol] : [];
|
|
4029
4029
|
}, [selectedCol]);
|
|
4030
|
-
const [attributeSearch, setAttributeSearch] = useState("");
|
|
4031
|
-
const [searchAttributeSearch, setSearchAttributeSearch] = useState("");
|
|
4032
4030
|
const getAttrDepth = (attr) => attributesMeta[attr]?.depth ?? (attr.includes(".") ? attr.split(".").length - 1 : 0);
|
|
4033
4031
|
const availableColAttributes = useMemo(() => {
|
|
4034
4032
|
return selectedCol?.attributes || attributes || [];
|
|
@@ -4036,48 +4034,20 @@ const BulkUpdater = () => {
|
|
|
4036
4034
|
const depthFilteredAttributes = useMemo(() => {
|
|
4037
4035
|
return availableColAttributes.filter((attr) => getAttrDepth(attr) <= componentDepth);
|
|
4038
4036
|
}, [availableColAttributes, componentDepth, attributesMeta]);
|
|
4039
|
-
const filteredAttributes = useMemo(() => {
|
|
4040
|
-
const q = attributeSearch.toLowerCase().trim();
|
|
4041
|
-
if (!q || q === (selectedAttribute || "").toLowerCase().trim()) {
|
|
4042
|
-
return depthFilteredAttributes;
|
|
4043
|
-
}
|
|
4044
|
-
const cleanQ = q.replace(/[^a-z0-9]/g, "");
|
|
4045
|
-
return depthFilteredAttributes.filter((attr) => {
|
|
4046
|
-
const lower = attr.toLowerCase();
|
|
4047
|
-
const cleanLower = lower.replace(/[^a-z0-9]/g, "");
|
|
4048
|
-
const rel = relationsMeta[attr];
|
|
4049
|
-
const relTarget = (rel?.targetDisplayName || "").toLowerCase();
|
|
4050
|
-
return lower.includes(q) || cleanLower.includes(cleanQ) || relTarget.includes(q);
|
|
4051
|
-
});
|
|
4052
|
-
}, [depthFilteredAttributes, attributeSearch, selectedAttribute, relationsMeta]);
|
|
4053
|
-
const filteredSearchAttributes = useMemo(() => {
|
|
4054
|
-
const q = searchAttributeSearch.toLowerCase().trim();
|
|
4055
|
-
if (!q || q === (searchAttribute || "").toLowerCase().trim()) {
|
|
4056
|
-
return depthFilteredAttributes;
|
|
4057
|
-
}
|
|
4058
|
-
const cleanQ = q.replace(/[^a-z0-9]/g, "");
|
|
4059
|
-
return depthFilteredAttributes.filter((attr) => {
|
|
4060
|
-
const lower = attr.toLowerCase();
|
|
4061
|
-
const cleanLower = lower.replace(/[^a-z0-9]/g, "");
|
|
4062
|
-
const rel = relationsMeta[attr];
|
|
4063
|
-
const relTarget = (rel?.targetDisplayName || "").toLowerCase();
|
|
4064
|
-
return lower.includes(q) || cleanLower.includes(cleanQ) || relTarget.includes(q);
|
|
4065
|
-
});
|
|
4066
|
-
}, [depthFilteredAttributes, searchAttributeSearch, searchAttribute, relationsMeta]);
|
|
4067
4037
|
const memoizedComboboxOptions = useMemo(() => {
|
|
4068
|
-
if (
|
|
4069
|
-
return /* @__PURE__ */ jsx(ComboboxOption, { value: "__none__", disabled: true, textValue: "No
|
|
4070
|
-
|
|
4071
|
-
attributeSearch,
|
|
4072
|
-
'" (Depth L',
|
|
4038
|
+
if (depthFilteredAttributes.length === 0) {
|
|
4039
|
+
return /* @__PURE__ */ jsx(ComboboxOption, { value: "__none__", disabled: true, textValue: "No attributes available", children: /* @__PURE__ */ jsxs(Typography, { variant: "pi", textColor: "neutral600", children: [
|
|
4040
|
+
"No attributes available for this collection type (Depth L",
|
|
4073
4041
|
componentDepth,
|
|
4074
4042
|
")"
|
|
4075
4043
|
] }) });
|
|
4076
4044
|
}
|
|
4077
|
-
return
|
|
4045
|
+
return depthFilteredAttributes.map((attr) => {
|
|
4078
4046
|
const rel = relationsMeta[attr];
|
|
4079
4047
|
const depth = getAttrDepth(attr);
|
|
4080
|
-
|
|
4048
|
+
const badgeText = rel ? `relation ${rel.targetDisplayName}` : depth > 0 ? `L${depth} component` : "";
|
|
4049
|
+
const textValue = badgeText ? `${attr} ${badgeText}` : attr;
|
|
4050
|
+
return /* @__PURE__ */ jsx(ComboboxOption, { value: attr, textValue, children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
|
|
4081
4051
|
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: attr === selectedAttribute ? "bold" : "regular", children: attr }),
|
|
4082
4052
|
rel ? /* @__PURE__ */ jsxs(Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: [
|
|
4083
4053
|
"relation ➔ ",
|
|
@@ -4089,14 +4059,14 @@ const BulkUpdater = () => {
|
|
|
4089
4059
|
] }) : null
|
|
4090
4060
|
] }) }, attr);
|
|
4091
4061
|
});
|
|
4092
|
-
}, [
|
|
4062
|
+
}, [depthFilteredAttributes, relationsMeta, selectedAttribute, componentDepth, attributesMeta]);
|
|
4093
4063
|
const memoizedSearchComboboxOptions = useMemo(() => {
|
|
4094
4064
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4095
4065
|
/* @__PURE__ */ jsx(
|
|
4096
4066
|
ComboboxOption,
|
|
4097
4067
|
{
|
|
4098
4068
|
value: "__default__",
|
|
4099
|
-
textValue: `Same as Update Attribute (${selectedAttribute || "None"})`,
|
|
4069
|
+
textValue: `Same as Update Attribute (${selectedAttribute || "None"}) default`,
|
|
4100
4070
|
children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
|
|
4101
4071
|
/* @__PURE__ */ jsxs(Typography, { variant: "omega", fontStyle: "italic", textColor: "neutral600", children: [
|
|
4102
4072
|
"-- Same as Update Attribute (",
|
|
@@ -4107,10 +4077,12 @@ const BulkUpdater = () => {
|
|
|
4107
4077
|
] })
|
|
4108
4078
|
}
|
|
4109
4079
|
),
|
|
4110
|
-
|
|
4080
|
+
depthFilteredAttributes.map((attr) => {
|
|
4111
4081
|
const rel = relationsMeta[attr];
|
|
4112
4082
|
const depth = getAttrDepth(attr);
|
|
4113
|
-
|
|
4083
|
+
const badgeText = rel ? `relation ${rel.targetDisplayName}` : depth > 0 ? `L${depth} component` : "";
|
|
4084
|
+
const textValue = badgeText ? `${attr} ${badgeText}` : attr;
|
|
4085
|
+
return /* @__PURE__ */ jsx(ComboboxOption, { value: attr, textValue, children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
|
|
4114
4086
|
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: attr === searchAttribute ? "bold" : "regular", children: attr }),
|
|
4115
4087
|
rel ? /* @__PURE__ */ jsxs(Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: [
|
|
4116
4088
|
"relation ➔ ",
|
|
@@ -4123,7 +4095,7 @@ const BulkUpdater = () => {
|
|
|
4123
4095
|
] }) }, `search_${attr}`);
|
|
4124
4096
|
})
|
|
4125
4097
|
] });
|
|
4126
|
-
}, [
|
|
4098
|
+
}, [depthFilteredAttributes, relationsMeta, searchAttribute, selectedAttribute, componentDepth, attributesMeta]);
|
|
4127
4099
|
const handleSearchAttributeChange = (newAttr) => {
|
|
4128
4100
|
const finalAttr = newAttr === "__default__" ? "" : newAttr;
|
|
4129
4101
|
setSearchAttribute(finalAttr);
|
|
@@ -4298,7 +4270,6 @@ const BulkUpdater = () => {
|
|
|
4298
4270
|
};
|
|
4299
4271
|
const clearFilter = () => {
|
|
4300
4272
|
setSearchAttribute("");
|
|
4301
|
-
setSearchAttributeSearch("");
|
|
4302
4273
|
setFilterOperator("none");
|
|
4303
4274
|
setFilterQuery("");
|
|
4304
4275
|
setEntrySearch("");
|
|
@@ -5323,25 +5294,13 @@ const BulkUpdater = () => {
|
|
|
5323
5294
|
placeholder: searchAttribute || `Same as Update (${selectedAttribute || "None"})`,
|
|
5324
5295
|
value: searchAttribute || "__default__",
|
|
5325
5296
|
clearLabel: "Reset search attribute",
|
|
5326
|
-
onClear: () =>
|
|
5327
|
-
handleSearchAttributeChange("");
|
|
5328
|
-
setSearchAttributeSearch("");
|
|
5329
|
-
},
|
|
5297
|
+
onClear: () => handleSearchAttributeChange(""),
|
|
5330
5298
|
onFocus: (e) => {
|
|
5331
5299
|
e.target.select();
|
|
5332
5300
|
},
|
|
5333
|
-
onInputChange: (e) => {
|
|
5334
|
-
setSearchAttributeSearch(e.target.value);
|
|
5335
|
-
},
|
|
5336
|
-
onOpenChange: (isOpen) => {
|
|
5337
|
-
if (!isOpen) {
|
|
5338
|
-
setSearchAttributeSearch("");
|
|
5339
|
-
}
|
|
5340
|
-
},
|
|
5341
5301
|
onChange: (val) => {
|
|
5342
5302
|
if (val && typeof val === "string" && val !== "__none__") {
|
|
5343
5303
|
handleSearchAttributeChange(val);
|
|
5344
|
-
setSearchAttributeSearch("");
|
|
5345
5304
|
}
|
|
5346
5305
|
},
|
|
5347
5306
|
children: memoizedSearchComboboxOptions
|
|
@@ -6123,27 +6082,15 @@ const BulkUpdater = () => {
|
|
|
6123
6082
|
placeholder: "Search attribute by name or relation...",
|
|
6124
6083
|
value: selectedAttribute || void 0,
|
|
6125
6084
|
clearLabel: "Clear attribute selection",
|
|
6126
|
-
onClear: () =>
|
|
6127
|
-
handleAttributeChange("");
|
|
6128
|
-
setAttributeSearch("");
|
|
6129
|
-
},
|
|
6085
|
+
onClear: () => handleAttributeChange(""),
|
|
6130
6086
|
onFocus: (e) => {
|
|
6131
6087
|
e.target.select();
|
|
6132
6088
|
},
|
|
6133
|
-
onInputChange: (e) => {
|
|
6134
|
-
setAttributeSearch(e.target.value);
|
|
6135
|
-
},
|
|
6136
|
-
onOpenChange: (isOpen) => {
|
|
6137
|
-
if (!isOpen) {
|
|
6138
|
-
setAttributeSearch("");
|
|
6139
|
-
}
|
|
6140
|
-
},
|
|
6141
6089
|
loading: loading && attributes.length === 0,
|
|
6142
6090
|
loadingMessage: "Discovering schema attributes...",
|
|
6143
6091
|
onChange: (val) => {
|
|
6144
6092
|
if (val && typeof val === "string" && val !== "__none__") {
|
|
6145
6093
|
handleAttributeChange(val);
|
|
6146
|
-
setAttributeSearch("");
|
|
6147
6094
|
}
|
|
6148
6095
|
},
|
|
6149
6096
|
children: memoizedComboboxOptions
|
|
@@ -7518,4 +7465,4 @@ export {
|
|
|
7518
7465
|
getSortOptionsForCollection,
|
|
7519
7466
|
parseDynamicZonePath
|
|
7520
7467
|
};
|
|
7521
|
-
//# sourceMappingURL=BulkUpdater-
|
|
7468
|
+
//# sourceMappingURL=BulkUpdater-BiSkkAHF.mjs.map
|