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.
@@ -4031,8 +4031,6 @@ const BulkUpdater = () => {
4031
4031
  const filteredCollections = React.useMemo(() => {
4032
4032
  return selectedCol ? [selectedCol] : [];
4033
4033
  }, [selectedCol]);
4034
- const [attributeSearch, setAttributeSearch] = React.useState("");
4035
- const [searchAttributeSearch, setSearchAttributeSearch] = React.useState("");
4036
4034
  const getAttrDepth = (attr) => attributesMeta[attr]?.depth ?? (attr.includes(".") ? attr.split(".").length - 1 : 0);
4037
4035
  const availableColAttributes = React.useMemo(() => {
4038
4036
  return selectedCol?.attributes || attributes || [];
@@ -4040,48 +4038,20 @@ const BulkUpdater = () => {
4040
4038
  const depthFilteredAttributes = React.useMemo(() => {
4041
4039
  return availableColAttributes.filter((attr) => getAttrDepth(attr) <= componentDepth);
4042
4040
  }, [availableColAttributes, componentDepth, attributesMeta]);
4043
- const filteredAttributes = React.useMemo(() => {
4044
- const q = attributeSearch.toLowerCase().trim();
4045
- if (!q || q === (selectedAttribute || "").toLowerCase().trim()) {
4046
- return depthFilteredAttributes;
4047
- }
4048
- const cleanQ = q.replace(/[^a-z0-9]/g, "");
4049
- return depthFilteredAttributes.filter((attr) => {
4050
- const lower = attr.toLowerCase();
4051
- const cleanLower = lower.replace(/[^a-z0-9]/g, "");
4052
- const rel = relationsMeta[attr];
4053
- const relTarget = (rel?.targetDisplayName || "").toLowerCase();
4054
- return lower.includes(q) || cleanLower.includes(cleanQ) || relTarget.includes(q);
4055
- });
4056
- }, [depthFilteredAttributes, attributeSearch, selectedAttribute, relationsMeta]);
4057
- const filteredSearchAttributes = React.useMemo(() => {
4058
- const q = searchAttributeSearch.toLowerCase().trim();
4059
- if (!q || q === (searchAttribute || "").toLowerCase().trim()) {
4060
- return depthFilteredAttributes;
4061
- }
4062
- const cleanQ = q.replace(/[^a-z0-9]/g, "");
4063
- return depthFilteredAttributes.filter((attr) => {
4064
- const lower = attr.toLowerCase();
4065
- const cleanLower = lower.replace(/[^a-z0-9]/g, "");
4066
- const rel = relationsMeta[attr];
4067
- const relTarget = (rel?.targetDisplayName || "").toLowerCase();
4068
- return lower.includes(q) || cleanLower.includes(cleanQ) || relTarget.includes(q);
4069
- });
4070
- }, [depthFilteredAttributes, searchAttributeSearch, searchAttribute, relationsMeta]);
4071
4041
  const memoizedComboboxOptions = React.useMemo(() => {
4072
- if (filteredAttributes.length === 0) {
4073
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: "__none__", disabled: true, textValue: "No matching attributes found", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: [
4074
- 'No matching attributes found for "',
4075
- attributeSearch,
4076
- '" (Depth L',
4042
+ if (depthFilteredAttributes.length === 0) {
4043
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: "__none__", disabled: true, textValue: "No attributes available", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: [
4044
+ "No attributes available for this collection type (Depth L",
4077
4045
  componentDepth,
4078
4046
  ")"
4079
4047
  ] }) });
4080
4048
  }
4081
- return filteredAttributes.map((attr) => {
4049
+ return depthFilteredAttributes.map((attr) => {
4082
4050
  const rel = relationsMeta[attr];
4083
4051
  const depth = getAttrDepth(attr);
4084
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: attr, textValue: attr, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
4052
+ const badgeText = rel ? `relation ${rel.targetDisplayName}` : depth > 0 ? `L${depth} component` : "";
4053
+ const textValue = badgeText ? `${attr} ${badgeText}` : attr;
4054
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: attr, textValue, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
4085
4055
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: attr === selectedAttribute ? "bold" : "regular", children: attr }),
4086
4056
  rel ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: [
4087
4057
  "relation ➔ ",
@@ -4093,14 +4063,14 @@ const BulkUpdater = () => {
4093
4063
  ] }) : null
4094
4064
  ] }) }, attr);
4095
4065
  });
4096
- }, [filteredAttributes, relationsMeta, selectedAttribute, attributeSearch, componentDepth, attributesMeta]);
4066
+ }, [depthFilteredAttributes, relationsMeta, selectedAttribute, componentDepth, attributesMeta]);
4097
4067
  const memoizedSearchComboboxOptions = React.useMemo(() => {
4098
4068
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4099
4069
  /* @__PURE__ */ jsxRuntime.jsx(
4100
4070
  designSystem.ComboboxOption,
4101
4071
  {
4102
4072
  value: "__default__",
4103
- textValue: `Same as Update Attribute (${selectedAttribute || "None"})`,
4073
+ textValue: `Same as Update Attribute (${selectedAttribute || "None"}) default`,
4104
4074
  children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
4105
4075
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "omega", fontStyle: "italic", textColor: "neutral600", children: [
4106
4076
  "-- Same as Update Attribute (",
@@ -4111,10 +4081,12 @@ const BulkUpdater = () => {
4111
4081
  ] })
4112
4082
  }
4113
4083
  ),
4114
- filteredSearchAttributes.map((attr) => {
4084
+ depthFilteredAttributes.map((attr) => {
4115
4085
  const rel = relationsMeta[attr];
4116
4086
  const depth = getAttrDepth(attr);
4117
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: attr, textValue: attr, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
4087
+ const badgeText = rel ? `relation ${rel.targetDisplayName}` : depth > 0 ? `L${depth} component` : "";
4088
+ const textValue = badgeText ? `${attr} ${badgeText}` : attr;
4089
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: attr, textValue, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
4118
4090
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: attr === searchAttribute ? "bold" : "regular", children: attr }),
4119
4091
  rel ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: [
4120
4092
  "relation ➔ ",
@@ -4127,7 +4099,7 @@ const BulkUpdater = () => {
4127
4099
  ] }) }, `search_${attr}`);
4128
4100
  })
4129
4101
  ] });
4130
- }, [filteredSearchAttributes, relationsMeta, searchAttribute, selectedAttribute, componentDepth, attributesMeta]);
4102
+ }, [depthFilteredAttributes, relationsMeta, searchAttribute, selectedAttribute, componentDepth, attributesMeta]);
4131
4103
  const handleSearchAttributeChange = (newAttr) => {
4132
4104
  const finalAttr = newAttr === "__default__" ? "" : newAttr;
4133
4105
  setSearchAttribute(finalAttr);
@@ -4302,7 +4274,6 @@ const BulkUpdater = () => {
4302
4274
  };
4303
4275
  const clearFilter = () => {
4304
4276
  setSearchAttribute("");
4305
- setSearchAttributeSearch("");
4306
4277
  setFilterOperator("none");
4307
4278
  setFilterQuery("");
4308
4279
  setEntrySearch("");
@@ -5327,25 +5298,13 @@ const BulkUpdater = () => {
5327
5298
  placeholder: searchAttribute || `Same as Update (${selectedAttribute || "None"})`,
5328
5299
  value: searchAttribute || "__default__",
5329
5300
  clearLabel: "Reset search attribute",
5330
- onClear: () => {
5331
- handleSearchAttributeChange("");
5332
- setSearchAttributeSearch("");
5333
- },
5301
+ onClear: () => handleSearchAttributeChange(""),
5334
5302
  onFocus: (e) => {
5335
5303
  e.target.select();
5336
5304
  },
5337
- onInputChange: (e) => {
5338
- setSearchAttributeSearch(e.target.value);
5339
- },
5340
- onOpenChange: (isOpen) => {
5341
- if (!isOpen) {
5342
- setSearchAttributeSearch("");
5343
- }
5344
- },
5345
5305
  onChange: (val) => {
5346
5306
  if (val && typeof val === "string" && val !== "__none__") {
5347
5307
  handleSearchAttributeChange(val);
5348
- setSearchAttributeSearch("");
5349
5308
  }
5350
5309
  },
5351
5310
  children: memoizedSearchComboboxOptions
@@ -6127,27 +6086,15 @@ const BulkUpdater = () => {
6127
6086
  placeholder: "Search attribute by name or relation...",
6128
6087
  value: selectedAttribute || void 0,
6129
6088
  clearLabel: "Clear attribute selection",
6130
- onClear: () => {
6131
- handleAttributeChange("");
6132
- setAttributeSearch("");
6133
- },
6089
+ onClear: () => handleAttributeChange(""),
6134
6090
  onFocus: (e) => {
6135
6091
  e.target.select();
6136
6092
  },
6137
- onInputChange: (e) => {
6138
- setAttributeSearch(e.target.value);
6139
- },
6140
- onOpenChange: (isOpen) => {
6141
- if (!isOpen) {
6142
- setAttributeSearch("");
6143
- }
6144
- },
6145
6093
  loading: loading && attributes.length === 0,
6146
6094
  loadingMessage: "Discovering schema attributes...",
6147
6095
  onChange: (val) => {
6148
6096
  if (val && typeof val === "string" && val !== "__none__") {
6149
6097
  handleAttributeChange(val);
6150
- setAttributeSearch("");
6151
6098
  }
6152
6099
  },
6153
6100
  children: memoizedComboboxOptions
@@ -7520,4 +7467,4 @@ exports.getNestedValue = getNestedValue;
7520
7467
  exports.getPropertyValue = getPropertyValue;
7521
7468
  exports.getSortOptionsForCollection = getSortOptionsForCollection;
7522
7469
  exports.parseDynamicZonePath = parseDynamicZonePath;
7523
- //# sourceMappingURL=BulkUpdater-CSmtXjbM.js.map
7470
+ //# sourceMappingURL=BulkUpdater-JZW74XM4.js.map