@strapi/content-manager 5.31.0 → 5.31.1

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.
Files changed (44) hide show
  1. package/dist/admin/components/ConfigurationForm/EditFieldForm.js +2 -1
  2. package/dist/admin/components/ConfigurationForm/EditFieldForm.js.map +1 -1
  3. package/dist/admin/components/ConfigurationForm/EditFieldForm.mjs +2 -1
  4. package/dist/admin/components/ConfigurationForm/EditFieldForm.mjs.map +1 -1
  5. package/dist/admin/pages/EditView/utils/data.js +128 -45
  6. package/dist/admin/pages/EditView/utils/data.js.map +1 -1
  7. package/dist/admin/pages/EditView/utils/data.mjs +128 -45
  8. package/dist/admin/pages/EditView/utils/data.mjs.map +1 -1
  9. package/dist/admin/pages/ListView/components/BulkActions/Actions.js +6 -16
  10. package/dist/admin/pages/ListView/components/BulkActions/Actions.js.map +1 -1
  11. package/dist/admin/pages/ListView/components/BulkActions/Actions.mjs +6 -16
  12. package/dist/admin/pages/ListView/components/BulkActions/Actions.mjs.map +1 -1
  13. package/dist/admin/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.js +18 -31
  14. package/dist/admin/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.js.map +1 -1
  15. package/dist/admin/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.mjs +19 -32
  16. package/dist/admin/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.mjs.map +1 -1
  17. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.js +1 -1
  18. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.js.map +1 -1
  19. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.mjs +1 -1
  20. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.mjs.map +1 -1
  21. package/dist/admin/pages/ListView/components/TableCells/CellContent.js +1 -1
  22. package/dist/admin/pages/ListView/components/TableCells/CellContent.js.map +1 -1
  23. package/dist/admin/pages/ListView/components/TableCells/CellContent.mjs +1 -1
  24. package/dist/admin/pages/ListView/components/TableCells/CellContent.mjs.map +1 -1
  25. package/dist/admin/pages/ListView/components/TableCells/Media.js +1 -1
  26. package/dist/admin/pages/ListView/components/TableCells/Media.js.map +1 -1
  27. package/dist/admin/pages/ListView/components/TableCells/Media.mjs +1 -1
  28. package/dist/admin/pages/ListView/components/TableCells/Media.mjs.map +1 -1
  29. package/dist/admin/pages/ListView/components/TableCells/Relations.js +8 -4
  30. package/dist/admin/pages/ListView/components/TableCells/Relations.js.map +1 -1
  31. package/dist/admin/pages/ListView/components/TableCells/Relations.mjs +8 -4
  32. package/dist/admin/pages/ListView/components/TableCells/Relations.mjs.map +1 -1
  33. package/dist/admin/src/pages/EditView/utils/data.d.ts +4 -4
  34. package/dist/admin/src/pages/ListView/components/TableCells/Relations.d.ts +0 -3
  35. package/dist/server/controllers/validation/model-configuration.js +2 -2
  36. package/dist/server/controllers/validation/model-configuration.js.map +1 -1
  37. package/dist/server/controllers/validation/model-configuration.mjs +2 -2
  38. package/dist/server/controllers/validation/model-configuration.mjs.map +1 -1
  39. package/dist/server/homepage/services/homepage.js +2 -1
  40. package/dist/server/homepage/services/homepage.js.map +1 -1
  41. package/dist/server/homepage/services/homepage.mjs +2 -1
  42. package/dist/server/homepage/services/homepage.mjs.map +1 -1
  43. package/dist/server/src/homepage/services/homepage.d.ts.map +1 -1
  44. package/package.json +5 -5
@@ -141,37 +141,115 @@ const BLOCK_LIST_ATTRIBUTE_KEYS = [
141
141
  return {};
142
142
  };
143
143
  /**
144
- * Removes values from the data object if their corresponding attribute has a
145
- * visibility condition that evaluates to false.
144
+ * @internal
145
+ * @description Collects paths of attributes that should be removed based on visibility conditions.
146
+ * This function only evaluates conditions.visible (JSON Logic), not the visible boolean property.
146
147
  *
147
- * @param {object} schema - The content type schema (with attributes).
148
- * @param {object} data - The data object to filter based on visibility.
149
- * @returns {object} A new data object with only visible fields retained.
150
- */ const handleInvisibleAttributes = (data, { schema, initialValues = {}, components = {} }, path = [], removedAttributes = [])=>{
151
- if (!schema?.attributes) return {
152
- data,
153
- removedAttributes
154
- };
148
+ * @param data - The data object to evaluate
149
+ * @param schema - The content type schema
150
+ * @param components - Dictionary of component schemas
151
+ * @param path - Current path in the data structure (for nested components/dynamiczones)
152
+ * @returns Array of field paths that should be removed
153
+ */ const collectInvisibleAttributes = (data, schema, components, path = [])=>{
154
+ if (!schema?.attributes) return [];
155
155
  const rulesEngine = createRulesEngine();
156
- const result = {};
156
+ const removedPaths = [];
157
+ const evaluatedData = {};
157
158
  for (const [attrName, attrDef] of Object.entries(schema.attributes)){
158
159
  const fullPath = [
159
160
  ...path,
160
161
  attrName
161
162
  ].join('.');
163
+ // Skip fields with visible: false - they're managed by backend
164
+ if ('visible' in attrDef && attrDef.visible === false) {
165
+ continue;
166
+ }
162
167
  const condition = attrDef?.conditions?.visible;
163
168
  const isVisible = condition ? rulesEngine.evaluate(condition, {
164
169
  ...data,
165
- ...result
170
+ ...evaluatedData
166
171
  }) : true;
167
172
  if (!isVisible) {
168
- removedAttributes.push(fullPath);
173
+ removedPaths.push(fullPath);
169
174
  continue;
170
175
  }
171
- const userProvided = Object.prototype.hasOwnProperty.call(data, attrName);
176
+ // Track this field for future condition evaluations
177
+ if (attrName in data) {
178
+ evaluatedData[attrName] = data[attrName];
179
+ }
180
+ // Recursively process components
181
+ if (attrDef.type === 'component') {
182
+ const compSchema = components[attrDef.component];
183
+ const value = data[attrName];
184
+ if (attrDef.repeatable && Array.isArray(value)) {
185
+ value.forEach((item)=>{
186
+ const nestedPaths = collectInvisibleAttributes(item, compSchema, components, [
187
+ ...path,
188
+ `${attrName}[${item.__temp_key__}]`
189
+ ]);
190
+ removedPaths.push(...nestedPaths);
191
+ });
192
+ } else if (value && typeof value === 'object') {
193
+ const nestedPaths = collectInvisibleAttributes(value, compSchema, components, [
194
+ ...path,
195
+ attrName
196
+ ]);
197
+ removedPaths.push(...nestedPaths);
198
+ }
199
+ }
200
+ // Recursively process dynamic zones
201
+ if (attrDef.type === 'dynamiczone' && Array.isArray(data[attrName])) {
202
+ data[attrName].forEach((dzItem)=>{
203
+ const compUID = dzItem?.__component;
204
+ const compSchema = components[compUID];
205
+ const nestedPaths = collectInvisibleAttributes(dzItem, compSchema, components, [
206
+ ...path,
207
+ `${attrName}[${dzItem.__temp_key__}]`
208
+ ]);
209
+ removedPaths.push(...nestedPaths);
210
+ });
211
+ }
212
+ }
213
+ return removedPaths;
214
+ };
215
+ /**
216
+ * @internal
217
+ * @description Removes attributes from data based on the list of paths to remove.
218
+ * Preserves fields with visible: false from data or initialValues.
219
+ *
220
+ * @param data - The data object to filter
221
+ * @param initialValues - Initial values to fall back to
222
+ * @param schema - The content type schema
223
+ * @param components - Dictionary of component schemas
224
+ * @param removedPaths - Array of field paths to remove
225
+ * @param currentPath - Current path in the data structure
226
+ * @returns Filtered data object
227
+ */ const filterDataByRemovedPaths = (data, initialValues, schema, components, removedPaths, currentPath = [])=>{
228
+ if (!schema?.attributes) return data;
229
+ const result = {};
230
+ for (const [attrName, attrDef] of Object.entries(schema.attributes)){
231
+ const fullPath = [
232
+ ...currentPath,
233
+ attrName
234
+ ].join('.');
235
+ // Check if this field should be removed
236
+ if (removedPaths.includes(fullPath)) {
237
+ continue;
238
+ }
239
+ // Handle fields with visible: false - preserve from data or initialValues
240
+ if ('visible' in attrDef && attrDef.visible === false) {
241
+ const userProvided = Object.hasOwn(data, attrName);
242
+ if (userProvided) {
243
+ result[attrName] = data[attrName];
244
+ } else if (attrName in initialValues) {
245
+ result[attrName] = initialValues[attrName];
246
+ }
247
+ continue;
248
+ }
249
+ const userProvided = Object.hasOwn(data, attrName);
172
250
  const currentValue = userProvided ? data[attrName] : undefined;
173
251
  const initialValue = initialValues?.[attrName];
174
- // 🔹 Handle components
252
+ // Handle components
175
253
  if (attrDef.type === 'component') {
176
254
  const compSchema = components[attrDef.component];
177
255
  const value = currentValue === undefined ? initialValue : currentValue;
@@ -182,28 +260,20 @@ const BLOCK_LIST_ATTRIBUTE_KEYS = [
182
260
  if (attrDef.repeatable && Array.isArray(value)) {
183
261
  result[attrName] = value.map((item)=>{
184
262
  const componentInitialValue = getItemInitialValue(initialValue, item);
185
- return handleInvisibleAttributes(item, {
186
- schema: compSchema,
187
- initialValues: componentInitialValue,
188
- components
189
- }, [
190
- ...path,
263
+ return filterDataByRemovedPaths(item, componentInitialValue, compSchema, components, removedPaths, [
264
+ ...currentPath,
191
265
  `${attrName}[${item.__temp_key__}]`
192
- ], removedAttributes).data;
266
+ ]);
193
267
  });
194
268
  } else {
195
- result[attrName] = handleInvisibleAttributes(value, {
196
- schema: compSchema,
197
- initialValues: initialValue ?? {},
198
- components
199
- }, [
200
- ...path,
269
+ result[attrName] = filterDataByRemovedPaths(value, initialValue ?? {}, compSchema, components, removedPaths, [
270
+ ...currentPath,
201
271
  attrName
202
- ], removedAttributes).data;
272
+ ]);
203
273
  }
204
274
  continue;
205
275
  }
206
- // 🔸 Handle dynamic zones
276
+ // Handle dynamic zones
207
277
  if (attrDef.type === 'dynamiczone') {
208
278
  if (!Array.isArray(currentValue)) {
209
279
  result[attrName] = [];
@@ -213,15 +283,11 @@ const BLOCK_LIST_ATTRIBUTE_KEYS = [
213
283
  const compUID = dzItem?.__component;
214
284
  const compSchema = components[compUID];
215
285
  const componentInitialValue = getItemInitialValue(initialValue, dzItem);
216
- const cleaned = handleInvisibleAttributes(dzItem, {
217
- schema: compSchema,
218
- initialValues: componentInitialValue,
219
- components
220
- }, [
221
- ...path,
286
+ const cleaned = filterDataByRemovedPaths(dzItem, componentInitialValue, compSchema, components, removedPaths, [
287
+ ...currentPath,
222
288
  `${attrName}[${dzItem.__temp_key__}]`
223
- ], removedAttributes).data;
224
- // For newly created components, we want to be sure that the id is undefined (in case of reordering items)
289
+ ]);
290
+ // For newly created components, ensure id is undefined (in case of reordering)
225
291
  const processedItem = dzItem.id === undefined || dzItem.id === null ? {
226
292
  __component: compUID,
227
293
  ...cleaned,
@@ -234,20 +300,37 @@ const BLOCK_LIST_ATTRIBUTE_KEYS = [
234
300
  });
235
301
  continue;
236
302
  }
237
- // 🟡 Handle scalar/primitive
303
+ // Regular fields - preserve from data or initialValues
238
304
  if (currentValue !== undefined) {
239
305
  result[attrName] = currentValue;
240
306
  } else if (initialValue !== undefined) {
241
307
  result[attrName] = initialValue;
242
- } else {
243
- if (attrName === 'id' || attrName === 'documentId') {
244
- continue;
245
- }
246
- result[attrName] = null;
247
308
  }
248
309
  }
310
+ // Pass through any fields from data that aren't in the schema
311
+ for (const [key, value] of Object.entries(data)){
312
+ if (!(key in result) && !(key in (schema?.attributes || {}))) {
313
+ result[key] = value;
314
+ }
315
+ }
316
+ return result;
317
+ };
318
+ /**
319
+ * Removes values from the data object if their corresponding attribute has a
320
+ * visibility condition that evaluates to false.
321
+ *
322
+ * @param data - The data object to filter based on visibility
323
+ * @param options - Schema, initialValues, and components
324
+ * @returns Object with filtered data and list of removed attribute paths
325
+ */ const handleInvisibleAttributes = (data, { schema, initialValues = {}, components = {} })=>{
326
+ if (!schema?.attributes) return {
327
+ data,
328
+ removedAttributes: []
329
+ };
330
+ const removedAttributes = collectInvisibleAttributes(data, schema, components);
331
+ const filteredData = filterDataByRemovedPaths(data, initialValues, schema, components, removedAttributes);
249
332
  return {
250
- data: result,
333
+ data: filteredData,
251
334
  removedAttributes
252
335
  };
253
336
  };
@@ -1 +1 @@
1
- {"version":3,"file":"data.mjs","sources":["../../../../../admin/src/pages/EditView/utils/data.ts"],"sourcesContent":["import { createRulesEngine } from '@strapi/admin/strapi-admin';\nimport { generateNKeysBetween } from 'fractional-indexing';\nimport pipe from 'lodash/fp/pipe';\n\nimport { DOCUMENT_META_FIELDS } from '../../../constants/attributes';\n\nimport type { ComponentsDictionary, Document } from '../../../hooks/useDocument';\nimport type { Schema, UID } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * traverseData\n * -----------------------------------------------------------------------------------------------*/\n\n// Make only attributes required since it's the only one Content History has\ntype PartialSchema = Partial<Schema.Schema> & Pick<Schema.Schema, 'attributes'>;\n\ntype Predicate = <TAttribute extends Schema.Attribute.AnyAttribute>(\n attribute: TAttribute,\n value: Schema.Attribute.Value<TAttribute>\n) => boolean;\ntype Transform = <TAttribute extends Schema.Attribute.AnyAttribute>(\n value: any,\n attribute: TAttribute\n) => any;\ntype AnyData = Omit<Document, 'id'>;\n\nconst BLOCK_LIST_ATTRIBUTE_KEYS = ['__component', '__temp_key__'];\n\n/**\n * @internal This function is used to traverse the data and transform the values.\n * Given a predicate function, it will transform the value (using the given transform function)\n * if the predicate returns true. If it finds that the attribute is a component or dynamiczone,\n * it will recursively traverse those data structures as well.\n *\n * It is possible to break the ContentManager by using this function incorrectly, for example,\n * if you transform a number into a string but the attribute type is a number, the ContentManager\n * will not be able to save the data and the Form will likely crash because the component it's\n * passing the data too won't succesfully be able to handle the value.\n */\nconst traverseData =\n (predicate: Predicate, transform: Transform) =>\n (schema: PartialSchema, components: ComponentsDictionary = {}) =>\n (data: AnyData = {}) => {\n const traverse = (datum: AnyData, attributes: Schema.Schema['attributes']) => {\n return Object.entries(datum).reduce<AnyData>((acc, [key, value]) => {\n const attribute = attributes[key];\n\n /**\n * If the attribute is a block list attribute, we don't want to transform it.\n * We also don't want to transform null or undefined values.\n */\n if (BLOCK_LIST_ATTRIBUTE_KEYS.includes(key) || value === null || value === undefined) {\n acc[key] = value;\n return acc;\n }\n\n if (attribute.type === 'component') {\n if (attribute.repeatable) {\n const componentValue = (\n predicate(attribute, value) ? transform(value, attribute) : value\n ) as Schema.Attribute.Value<Schema.Attribute.Component<UID.Component, true>>;\n acc[key] = componentValue.map((componentData) =>\n traverse(componentData, components[attribute.component]?.attributes ?? {})\n );\n } else {\n const componentValue = (\n predicate(attribute, value) ? transform(value, attribute) : value\n ) as Schema.Attribute.Value<Schema.Attribute.Component<UID.Component, false>>;\n\n acc[key] = traverse(componentValue, components[attribute.component]?.attributes ?? {});\n }\n } else if (attribute.type === 'dynamiczone') {\n const dynamicZoneValue = (\n predicate(attribute, value) ? transform(value, attribute) : value\n ) as Schema.Attribute.Value<Schema.Attribute.DynamicZone>;\n\n acc[key] = dynamicZoneValue.map((componentData) =>\n traverse(componentData, components[componentData.__component]?.attributes ?? {})\n );\n } else if (predicate(attribute, value)) {\n acc[key] = transform(value, attribute);\n } else {\n acc[key] = value;\n }\n\n return acc;\n }, {});\n };\n\n return traverse(data, schema.attributes);\n };\n\n/* -------------------------------------------------------------------------------------------------\n * removeProhibitedFields\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal Removes all the fields that are not allowed.\n */\nconst removeProhibitedFields = (prohibitedFields: Schema.Attribute.Kind[]) =>\n traverseData(\n (attribute) => prohibitedFields.includes(attribute.type),\n () => ''\n );\n\n/* -------------------------------------------------------------------------------------------------\n * prepareRelations\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description Sets all relation values to an empty array.\n */\nconst prepareRelations = traverseData(\n (attribute) => attribute.type === 'relation',\n () => ({\n connect: [],\n disconnect: [],\n })\n);\n\n/* -------------------------------------------------------------------------------------------------\n * prepareTempKeys\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description Adds a `__temp_key__` to each component and dynamiczone item. This gives us\n * a stable identifier regardless of its ids etc. that we can then use for drag and drop.\n */\nconst prepareTempKeys = traverseData(\n (attribute) =>\n (attribute.type === 'component' && attribute.repeatable) || attribute.type === 'dynamiczone',\n (data) => {\n if (Array.isArray(data) && data.length > 0) {\n const keys = generateNKeysBetween(undefined, undefined, data.length);\n\n return data.map((datum, index) => ({\n ...datum,\n __temp_key__: keys[index],\n }));\n }\n\n return data;\n }\n);\n\n/* -------------------------------------------------------------------------------------------------\n * removeFieldsThatDontExistOnSchema\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description Fields that don't exist in the schema like createdAt etc. are only on the first level (not nested),\n * as such we don't need to traverse the components to remove them.\n */\nconst removeFieldsThatDontExistOnSchema = (schema: PartialSchema) => (data: AnyData) => {\n const schemaKeys = Object.keys(schema.attributes);\n const dataKeys = Object.keys(data);\n\n const keysToRemove = dataKeys.filter((key) => !schemaKeys.includes(key));\n\n const revisedData = [...keysToRemove, ...DOCUMENT_META_FIELDS].reduce((acc, key) => {\n delete acc[key];\n\n return acc;\n }, structuredClone(data));\n\n return revisedData;\n};\n\n/**\n * @internal\n * @description We need to remove null fields from the data-structure because it will pass it\n * to the specific inputs breaking them as most would prefer empty strings or `undefined` if\n * they're controlled / uncontrolled.\n */\nconst removeNullValues = (data: AnyData) => {\n return Object.entries(data).reduce<AnyData>((acc, [key, value]) => {\n if (value === null) {\n return acc;\n }\n\n acc[key] = value;\n\n return acc;\n }, {});\n};\n\n/* -------------------------------------------------------------------------------------------------\n * transformDocuments\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description Takes a document data structure (this could be from the API or a default form structure)\n * and applies consistent data transformations to it. This is also used when we add new components to the\n * form to ensure the data is correctly prepared from their default state e.g. relations are set to an empty array.\n */\nconst transformDocument =\n (schema: PartialSchema, components: ComponentsDictionary = {}) =>\n (document: AnyData) => {\n const transformations = pipe(\n removeFieldsThatDontExistOnSchema(schema),\n removeProhibitedFields(['password'])(schema, components),\n removeNullValues,\n prepareRelations(schema, components),\n prepareTempKeys(schema, components)\n );\n\n return transformations(document);\n };\n\ntype HandleOptions = {\n schema?: Schema.ContentType | Schema.Component;\n initialValues?: AnyData;\n components?: Record<string, Schema.Component>;\n};\n\ntype RemovedFieldPath = string;\n\n/**\n * @internal\n * @description Finds the initial value for a component or dynamic zone item (based on its __temp_key__ and not its index).\n * @param initialValue - The initial values object.\n * @param item - The item to find the initial value for.\n * @returns The initial value for the item.\n */\nconst getItemInitialValue = (initialValue: AnyData, item: AnyData) => {\n if (initialValue && Array.isArray(initialValue)) {\n const matchingInitialItem = initialValue.find(\n (initialItem) => initialItem.__temp_key__ === item.__temp_key__\n );\n if (matchingInitialItem) {\n return matchingInitialItem;\n }\n }\n return {};\n};\n\n/**\n * Removes values from the data object if their corresponding attribute has a\n * visibility condition that evaluates to false.\n *\n * @param {object} schema - The content type schema (with attributes).\n * @param {object} data - The data object to filter based on visibility.\n * @returns {object} A new data object with only visible fields retained.\n */\nconst handleInvisibleAttributes = (\n data: AnyData,\n { schema, initialValues = {}, components = {} }: HandleOptions,\n path: string[] = [],\n removedAttributes: RemovedFieldPath[] = []\n): {\n data: AnyData;\n removedAttributes: RemovedFieldPath[];\n} => {\n if (!schema?.attributes) return { data, removedAttributes };\n\n const rulesEngine = createRulesEngine();\n const result: AnyData = {};\n\n for (const [attrName, attrDef] of Object.entries(schema.attributes)) {\n const fullPath = [...path, attrName].join('.');\n const condition = attrDef?.conditions?.visible;\n const isVisible = condition ? rulesEngine.evaluate(condition, { ...data, ...result }) : true;\n\n if (!isVisible) {\n removedAttributes.push(fullPath);\n continue;\n }\n\n const userProvided = Object.prototype.hasOwnProperty.call(data, attrName);\n const currentValue = userProvided ? data[attrName] : undefined;\n const initialValue = initialValues?.[attrName];\n\n // 🔹 Handle components\n if (attrDef.type === 'component') {\n const compSchema = components[attrDef.component];\n const value = currentValue === undefined ? initialValue : currentValue;\n\n if (!value) {\n result[attrName] = attrDef.repeatable ? [] : null;\n continue;\n }\n\n if (attrDef.repeatable && Array.isArray(value)) {\n result[attrName] = value.map((item) => {\n const componentInitialValue = getItemInitialValue(initialValue, item);\n\n return handleInvisibleAttributes(\n item,\n {\n schema: compSchema,\n initialValues: componentInitialValue,\n components,\n },\n [...path, `${attrName}[${item.__temp_key__}]`],\n removedAttributes\n ).data;\n });\n } else {\n result[attrName] = handleInvisibleAttributes(\n value,\n {\n schema: compSchema,\n initialValues: initialValue ?? {},\n components,\n },\n [...path, attrName],\n removedAttributes\n ).data;\n }\n\n continue;\n }\n\n // 🔸 Handle dynamic zones\n if (attrDef.type === 'dynamiczone') {\n if (!Array.isArray(currentValue)) {\n result[attrName] = [];\n continue;\n }\n\n result[attrName] = currentValue.map((dzItem) => {\n const compUID = dzItem?.__component;\n const compSchema = components[compUID];\n\n const componentInitialValue = getItemInitialValue(initialValue, dzItem);\n\n const cleaned = handleInvisibleAttributes(\n dzItem,\n {\n schema: compSchema,\n initialValues: componentInitialValue,\n components,\n },\n [...path, `${attrName}[${dzItem.__temp_key__}]`],\n removedAttributes\n ).data;\n\n // For newly created components, we want to be sure that the id is undefined (in case of reordering items)\n const processedItem =\n dzItem.id === undefined || dzItem.id === null\n ? { __component: compUID, ...cleaned, id: undefined }\n : { __component: compUID, ...cleaned };\n\n return processedItem;\n });\n\n continue;\n }\n\n // 🟡 Handle scalar/primitive\n if (currentValue !== undefined) {\n result[attrName] = currentValue;\n } else if (initialValue !== undefined) {\n result[attrName] = initialValue;\n } else {\n if (attrName === 'id' || attrName === 'documentId') {\n // If the attribute is 'id', we don't want to set it to null, as it should not be removed.\n continue;\n }\n result[attrName] = null;\n }\n }\n\n return {\n data: result,\n removedAttributes,\n };\n};\n\nexport {\n removeProhibitedFields,\n prepareRelations,\n prepareTempKeys,\n removeFieldsThatDontExistOnSchema,\n transformDocument,\n handleInvisibleAttributes,\n};\nexport type { AnyData };\n"],"names":["BLOCK_LIST_ATTRIBUTE_KEYS","traverseData","predicate","transform","schema","components","data","traverse","datum","attributes","Object","entries","reduce","acc","key","value","attribute","includes","undefined","type","repeatable","componentValue","map","componentData","component","dynamicZoneValue","__component","removeProhibitedFields","prohibitedFields","prepareRelations","connect","disconnect","prepareTempKeys","Array","isArray","length","keys","generateNKeysBetween","index","__temp_key__","removeFieldsThatDontExistOnSchema","schemaKeys","dataKeys","keysToRemove","filter","revisedData","DOCUMENT_META_FIELDS","structuredClone","removeNullValues","transformDocument","document","transformations","pipe","getItemInitialValue","initialValue","item","matchingInitialItem","find","initialItem","handleInvisibleAttributes","initialValues","path","removedAttributes","rulesEngine","createRulesEngine","result","attrName","attrDef","fullPath","join","condition","conditions","visible","isVisible","evaluate","push","userProvided","prototype","hasOwnProperty","call","currentValue","compSchema","componentInitialValue","dzItem","compUID","cleaned","processedItem","id"],"mappings":";;;;;AA0BA,MAAMA,y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B;AACF;IAEA,OAAO;QACL5D,IAAM2D,EAAAA,MAAAA;AACNH,QAAAA;AACF,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"data.mjs","sources":["../../../../../admin/src/pages/EditView/utils/data.ts"],"sourcesContent":["import { createRulesEngine } from '@strapi/admin/strapi-admin';\nimport { generateNKeysBetween } from 'fractional-indexing';\nimport pipe from 'lodash/fp/pipe';\n\nimport { DOCUMENT_META_FIELDS } from '../../../constants/attributes';\n\nimport type { ComponentsDictionary, Document } from '../../../hooks/useDocument';\nimport type { Schema, UID } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * traverseData\n * -----------------------------------------------------------------------------------------------*/\n\n// Make only attributes required since it's the only one Content History has\ntype PartialSchema = Partial<Schema.Schema> & Pick<Schema.Schema, 'attributes'>;\n\ntype Predicate = <TAttribute extends Schema.Attribute.AnyAttribute>(\n attribute: TAttribute,\n value: Schema.Attribute.Value<TAttribute>\n) => boolean;\ntype Transform = <TAttribute extends Schema.Attribute.AnyAttribute>(\n value: any,\n attribute: TAttribute\n) => any;\ntype AnyData = Omit<Document, 'id'>;\n\nconst BLOCK_LIST_ATTRIBUTE_KEYS = ['__component', '__temp_key__'];\n\n/**\n * @internal This function is used to traverse the data and transform the values.\n * Given a predicate function, it will transform the value (using the given transform function)\n * if the predicate returns true. If it finds that the attribute is a component or dynamiczone,\n * it will recursively traverse those data structures as well.\n *\n * It is possible to break the ContentManager by using this function incorrectly, for example,\n * if you transform a number into a string but the attribute type is a number, the ContentManager\n * will not be able to save the data and the Form will likely crash because the component it's\n * passing the data too won't succesfully be able to handle the value.\n */\nconst traverseData =\n (predicate: Predicate, transform: Transform) =>\n (schema: PartialSchema, components: ComponentsDictionary = {}) =>\n (data: AnyData = {}) => {\n const traverse = (datum: AnyData, attributes: Schema.Schema['attributes']) => {\n return Object.entries(datum).reduce<AnyData>((acc, [key, value]) => {\n const attribute = attributes[key];\n\n /**\n * If the attribute is a block list attribute, we don't want to transform it.\n * We also don't want to transform null or undefined values.\n */\n if (BLOCK_LIST_ATTRIBUTE_KEYS.includes(key) || value === null || value === undefined) {\n acc[key] = value;\n return acc;\n }\n\n if (attribute.type === 'component') {\n if (attribute.repeatable) {\n const componentValue = (\n predicate(attribute, value) ? transform(value, attribute) : value\n ) as Schema.Attribute.Value<Schema.Attribute.Component<UID.Component, true>>;\n acc[key] = componentValue.map((componentData) =>\n traverse(componentData, components[attribute.component]?.attributes ?? {})\n );\n } else {\n const componentValue = (\n predicate(attribute, value) ? transform(value, attribute) : value\n ) as Schema.Attribute.Value<Schema.Attribute.Component<UID.Component, false>>;\n\n acc[key] = traverse(componentValue, components[attribute.component]?.attributes ?? {});\n }\n } else if (attribute.type === 'dynamiczone') {\n const dynamicZoneValue = (\n predicate(attribute, value) ? transform(value, attribute) : value\n ) as Schema.Attribute.Value<Schema.Attribute.DynamicZone>;\n\n acc[key] = dynamicZoneValue.map((componentData) =>\n traverse(componentData, components[componentData.__component]?.attributes ?? {})\n );\n } else if (predicate(attribute, value)) {\n acc[key] = transform(value, attribute);\n } else {\n acc[key] = value;\n }\n\n return acc;\n }, {});\n };\n\n return traverse(data, schema.attributes);\n };\n\n/* -------------------------------------------------------------------------------------------------\n * removeProhibitedFields\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal Removes all the fields that are not allowed.\n */\nconst removeProhibitedFields = (prohibitedFields: Schema.Attribute.Kind[]) =>\n traverseData(\n (attribute) => prohibitedFields.includes(attribute.type),\n () => ''\n );\n\n/* -------------------------------------------------------------------------------------------------\n * prepareRelations\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description Sets all relation values to an empty array.\n */\nconst prepareRelations = traverseData(\n (attribute) => attribute.type === 'relation',\n () => ({\n connect: [],\n disconnect: [],\n })\n);\n\n/* -------------------------------------------------------------------------------------------------\n * prepareTempKeys\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description Adds a `__temp_key__` to each component and dynamiczone item. This gives us\n * a stable identifier regardless of its ids etc. that we can then use for drag and drop.\n */\nconst prepareTempKeys = traverseData(\n (attribute) =>\n (attribute.type === 'component' && attribute.repeatable) || attribute.type === 'dynamiczone',\n (data) => {\n if (Array.isArray(data) && data.length > 0) {\n const keys = generateNKeysBetween(undefined, undefined, data.length);\n\n return data.map((datum, index) => ({\n ...datum,\n __temp_key__: keys[index],\n }));\n }\n\n return data;\n }\n);\n\n/* -------------------------------------------------------------------------------------------------\n * removeFieldsThatDontExistOnSchema\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description Fields that don't exist in the schema like createdAt etc. are only on the first level (not nested),\n * as such we don't need to traverse the components to remove them.\n */\nconst removeFieldsThatDontExistOnSchema = (schema: PartialSchema) => (data: AnyData) => {\n const schemaKeys = Object.keys(schema.attributes);\n const dataKeys = Object.keys(data);\n\n const keysToRemove = dataKeys.filter((key) => !schemaKeys.includes(key));\n\n const revisedData = [...keysToRemove, ...DOCUMENT_META_FIELDS].reduce((acc, key) => {\n delete acc[key];\n\n return acc;\n }, structuredClone(data));\n\n return revisedData;\n};\n\n/**\n * @internal\n * @description We need to remove null fields from the data-structure because it will pass it\n * to the specific inputs breaking them as most would prefer empty strings or `undefined` if\n * they're controlled / uncontrolled.\n */\nconst removeNullValues = (data: AnyData) => {\n return Object.entries(data).reduce<AnyData>((acc, [key, value]) => {\n if (value === null) {\n return acc;\n }\n\n acc[key] = value;\n\n return acc;\n }, {});\n};\n\n/* -------------------------------------------------------------------------------------------------\n * transformDocuments\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description Takes a document data structure (this could be from the API or a default form structure)\n * and applies consistent data transformations to it. This is also used when we add new components to the\n * form to ensure the data is correctly prepared from their default state e.g. relations are set to an empty array.\n */\nconst transformDocument =\n (schema: PartialSchema, components: ComponentsDictionary = {}) =>\n (document: AnyData) => {\n const transformations = pipe(\n removeFieldsThatDontExistOnSchema(schema),\n removeProhibitedFields(['password'])(schema, components),\n removeNullValues,\n prepareRelations(schema, components),\n prepareTempKeys(schema, components)\n );\n\n return transformations(document);\n };\n\ntype HandleOptions = {\n schema?: Schema.ContentType | Schema.Component;\n initialValues?: AnyData;\n components?: Record<string, Schema.Component>;\n};\n\ntype RemovedFieldPath = string;\n\n/**\n * @internal\n * @description Finds the initial value for a component or dynamic zone item (based on its __temp_key__ and not its index).\n * @param initialValue - The initial values object.\n * @param item - The item to find the initial value for.\n * @returns The initial value for the item.\n */\nconst getItemInitialValue = (initialValue: AnyData, item: AnyData) => {\n if (initialValue && Array.isArray(initialValue)) {\n const matchingInitialItem = initialValue.find(\n (initialItem) => initialItem.__temp_key__ === item.__temp_key__\n );\n if (matchingInitialItem) {\n return matchingInitialItem;\n }\n }\n return {};\n};\n\n/**\n * @internal\n * @description Collects paths of attributes that should be removed based on visibility conditions.\n * This function only evaluates conditions.visible (JSON Logic), not the visible boolean property.\n *\n * @param data - The data object to evaluate\n * @param schema - The content type schema\n * @param components - Dictionary of component schemas\n * @param path - Current path in the data structure (for nested components/dynamiczones)\n * @returns Array of field paths that should be removed\n */\nconst collectInvisibleAttributes = (\n data: AnyData,\n schema: Schema.ContentType | Schema.Component | undefined,\n components: Record<string, Schema.Component>,\n path: string[] = []\n): RemovedFieldPath[] => {\n if (!schema?.attributes) return [];\n\n const rulesEngine = createRulesEngine();\n const removedPaths: RemovedFieldPath[] = [];\n const evaluatedData: AnyData = {};\n\n for (const [attrName, attrDef] of Object.entries(schema.attributes)) {\n const fullPath = [...path, attrName].join('.');\n\n // Skip fields with visible: false - they're managed by backend\n if ('visible' in attrDef && attrDef.visible === false) {\n continue;\n }\n\n const condition = attrDef?.conditions?.visible;\n const isVisible = condition\n ? rulesEngine.evaluate(condition, { ...data, ...evaluatedData })\n : true;\n\n if (!isVisible) {\n removedPaths.push(fullPath);\n continue;\n }\n\n // Track this field for future condition evaluations\n if (attrName in data) {\n evaluatedData[attrName] = data[attrName];\n }\n\n // Recursively process components\n if (attrDef.type === 'component') {\n const compSchema = components[attrDef.component];\n const value = data[attrName];\n\n if (attrDef.repeatable && Array.isArray(value)) {\n value.forEach((item) => {\n const nestedPaths = collectInvisibleAttributes(item, compSchema, components, [\n ...path,\n `${attrName}[${item.__temp_key__}]`,\n ]);\n removedPaths.push(...nestedPaths);\n });\n } else if (value && typeof value === 'object') {\n const nestedPaths = collectInvisibleAttributes(value, compSchema, components, [\n ...path,\n attrName,\n ]);\n removedPaths.push(...nestedPaths);\n }\n }\n\n // Recursively process dynamic zones\n if (attrDef.type === 'dynamiczone' && Array.isArray(data[attrName])) {\n data[attrName].forEach((dzItem: AnyData) => {\n const compUID = dzItem?.__component;\n const compSchema = components[compUID];\n const nestedPaths = collectInvisibleAttributes(dzItem, compSchema, components, [\n ...path,\n `${attrName}[${dzItem.__temp_key__}]`,\n ]);\n removedPaths.push(...nestedPaths);\n });\n }\n }\n\n return removedPaths;\n};\n\n/**\n * @internal\n * @description Removes attributes from data based on the list of paths to remove.\n * Preserves fields with visible: false from data or initialValues.\n *\n * @param data - The data object to filter\n * @param initialValues - Initial values to fall back to\n * @param schema - The content type schema\n * @param components - Dictionary of component schemas\n * @param removedPaths - Array of field paths to remove\n * @param currentPath - Current path in the data structure\n * @returns Filtered data object\n */\nconst filterDataByRemovedPaths = (\n data: AnyData,\n initialValues: AnyData,\n schema: Schema.ContentType | Schema.Component | undefined,\n components: Record<string, Schema.Component>,\n removedPaths: RemovedFieldPath[],\n currentPath: string[] = []\n): AnyData => {\n if (!schema?.attributes) return data;\n\n const result: AnyData = {};\n\n for (const [attrName, attrDef] of Object.entries(schema.attributes)) {\n const fullPath = [...currentPath, attrName].join('.');\n\n // Check if this field should be removed\n if (removedPaths.includes(fullPath)) {\n continue;\n }\n\n // Handle fields with visible: false - preserve from data or initialValues\n if ('visible' in attrDef && attrDef.visible === false) {\n const userProvided = Object.hasOwn(data, attrName);\n if (userProvided) {\n result[attrName] = data[attrName];\n } else if (attrName in initialValues) {\n result[attrName] = initialValues[attrName];\n }\n continue;\n }\n\n const userProvided = Object.hasOwn(data, attrName);\n const currentValue = userProvided ? data[attrName] : undefined;\n const initialValue = initialValues?.[attrName];\n\n // Handle components\n if (attrDef.type === 'component') {\n const compSchema = components[attrDef.component];\n const value = currentValue === undefined ? initialValue : currentValue;\n\n if (!value) {\n result[attrName] = attrDef.repeatable ? [] : null;\n continue;\n }\n\n if (attrDef.repeatable && Array.isArray(value)) {\n result[attrName] = value.map((item) => {\n const componentInitialValue = getItemInitialValue(initialValue, item);\n return filterDataByRemovedPaths(\n item,\n componentInitialValue,\n compSchema,\n components,\n removedPaths,\n [...currentPath, `${attrName}[${item.__temp_key__}]`]\n );\n });\n } else {\n result[attrName] = filterDataByRemovedPaths(\n value,\n initialValue ?? {},\n compSchema,\n components,\n removedPaths,\n [...currentPath, attrName]\n );\n }\n\n continue;\n }\n\n // Handle dynamic zones\n if (attrDef.type === 'dynamiczone') {\n if (!Array.isArray(currentValue)) {\n result[attrName] = [];\n continue;\n }\n\n result[attrName] = currentValue.map((dzItem) => {\n const compUID = dzItem?.__component;\n const compSchema = components[compUID];\n const componentInitialValue = getItemInitialValue(initialValue, dzItem);\n\n const cleaned = filterDataByRemovedPaths(\n dzItem,\n componentInitialValue,\n compSchema,\n components,\n removedPaths,\n [...currentPath, `${attrName}[${dzItem.__temp_key__}]`]\n );\n\n // For newly created components, ensure id is undefined (in case of reordering)\n const processedItem =\n dzItem.id === undefined || dzItem.id === null\n ? { __component: compUID, ...cleaned, id: undefined }\n : { __component: compUID, ...cleaned };\n\n return processedItem;\n });\n\n continue;\n }\n\n // Regular fields - preserve from data or initialValues\n if (currentValue !== undefined) {\n result[attrName] = currentValue;\n } else if (initialValue !== undefined) {\n result[attrName] = initialValue;\n }\n }\n\n // Pass through any fields from data that aren't in the schema\n for (const [key, value] of Object.entries(data)) {\n if (!(key in result) && !(key in (schema?.attributes || {}))) {\n result[key] = value;\n }\n }\n\n return result;\n};\n\n/**\n * Removes values from the data object if their corresponding attribute has a\n * visibility condition that evaluates to false.\n *\n * @param data - The data object to filter based on visibility\n * @param options - Schema, initialValues, and components\n * @returns Object with filtered data and list of removed attribute paths\n */\nconst handleInvisibleAttributes = (\n data: AnyData,\n { schema, initialValues = {}, components = {} }: HandleOptions\n): {\n data: AnyData;\n removedAttributes: RemovedFieldPath[];\n} => {\n if (!schema?.attributes) return { data, removedAttributes: [] };\n\n const removedAttributes = collectInvisibleAttributes(data, schema, components);\n\n const filteredData = filterDataByRemovedPaths(\n data,\n initialValues,\n schema,\n components,\n removedAttributes\n );\n\n return {\n data: filteredData,\n removedAttributes,\n };\n};\n\nexport {\n removeProhibitedFields,\n prepareRelations,\n prepareTempKeys,\n removeFieldsThatDontExistOnSchema,\n transformDocument,\n handleInvisibleAttributes,\n};\nexport type { AnyData };\n"],"names":["BLOCK_LIST_ATTRIBUTE_KEYS","traverseData","predicate","transform","schema","components","data","traverse","datum","attributes","Object","entries","reduce","acc","key","value","attribute","includes","undefined","type","repeatable","componentValue","map","componentData","component","dynamicZoneValue","__component","removeProhibitedFields","prohibitedFields","prepareRelations","connect","disconnect","prepareTempKeys","Array","isArray","length","keys","generateNKeysBetween","index","__temp_key__","removeFieldsThatDontExistOnSchema","schemaKeys","dataKeys","keysToRemove","filter","revisedData","DOCUMENT_META_FIELDS","structuredClone","removeNullValues","transformDocument","document","transformations","pipe","getItemInitialValue","initialValue","item","matchingInitialItem","find","initialItem","collectInvisibleAttributes","path","rulesEngine","createRulesEngine","removedPaths","evaluatedData","attrName","attrDef","fullPath","join","visible","condition","conditions","isVisible","evaluate","push","compSchema","forEach","nestedPaths","dzItem","compUID","filterDataByRemovedPaths","initialValues","currentPath","result","userProvided","hasOwn","currentValue","componentInitialValue","cleaned","processedItem","id","handleInvisibleAttributes","removedAttributes","filteredData"],"mappings":";;;;;AA0BA,MAAMA,yBAA4B,GAAA;AAAC,IAAA,aAAA;AAAe,IAAA;AAAe,CAAA;AAEjE;;;;;;;;;;AAUC,IACD,MAAMC,YAAAA,GACJ,CAACC,SAAAA,EAAsBC,Y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OqE,IAAAA,MAAK,KAAM,EAAErE,GAAQV,KAAAA,MAAQK,EAAAA,UAAAA,IAAc,EAAC,CAAC,CAAI,EAAA;YAC5D0E,MAAM,CAACrE,IAAI,GAAGC,KAAAA;AAChB;AACF;IAEA,OAAOoE,MAAAA;AACT,CAAA;AAEA;;;;;;;AAOC,IACKQ,MAAAA,yBAAAA,GAA4B,CAChCrF,IAAAA,EACA,EAAEF,MAAM,EAAE6E,aAAgB,GAAA,EAAE,EAAE5E,UAAa,GAAA,EAAE,EAAiB,GAAA;IAK9D,IAAI,CAACD,MAAQK,EAAAA,UAAAA,EAAY,OAAO;AAAEH,QAAAA,IAAAA;AAAMsF,QAAAA,iBAAAA,EAAmB;AAAG,KAAA;IAE9D,MAAMA,iBAAAA,GAAoBjC,0BAA2BrD,CAAAA,IAAAA,EAAMF,MAAQC,EAAAA,UAAAA,CAAAA;AAEnE,IAAA,MAAMwF,YAAeb,GAAAA,wBAAAA,CACnB1E,IACA2E,EAAAA,aAAAA,EACA7E,QACAC,UACAuF,EAAAA,iBAAAA,CAAAA;IAGF,OAAO;QACLtF,IAAMuF,EAAAA,YAAAA;AACND,QAAAA;AACF,KAAA;AACF;;;;"}
@@ -9,6 +9,7 @@ var reactIntl = require('react-intl');
9
9
  var DocumentRBAC = require('../../../../features/DocumentRBAC.js');
10
10
  var useDocument = require('../../../../hooks/useDocument.js');
11
11
  var useDocumentActions = require('../../../../hooks/useDocumentActions.js');
12
+ var useDocumentLayout = require('../../../../hooks/useDocumentLayout.js');
12
13
  var api = require('../../../../utils/api.js');
13
14
  var translations = require('../../../../utils/translations.js');
14
15
  var DocumentActions = require('../../../EditView/components/DocumentActions.js');
@@ -38,6 +39,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
38
39
  * -----------------------------------------------------------------------------------------------*/ const BulkActionsRenderer = ()=>{
39
40
  const plugins = strapiAdmin.useStrapiApp('BulkActionsRenderer', (state)=>state.plugins);
40
41
  const { model, collectionType } = useDocument.useDoc();
42
+ const { list } = useDocumentLayout.useDocumentLayout(model);
41
43
  const { selectedRows } = strapiAdmin.useTable('BulkActionsRenderer', (state)=>state);
42
44
  return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
43
45
  gap: 2,
@@ -48,9 +50,11 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
48
50
  documents: selectedRows
49
51
  },
50
52
  descriptions: plugins['content-manager'].apis.getBulkActions(),
51
- children: (actions)=>actions.map((action)=>/*#__PURE__*/ jsxRuntime.jsx(DocumentActions.DocumentActionButton, {
53
+ children: (actions)=>actions.map((action)=>{
54
+ return list.settings.bulkable && /*#__PURE__*/ jsxRuntime.jsx(DocumentActions.DocumentActionButton, {
52
55
  ...action
53
- }, action.id))
56
+ }, action.id);
57
+ })
54
58
  })
55
59
  });
56
60
  };
@@ -138,7 +142,6 @@ const UnpublishAction = ({ documents, model })=>{
138
142
  const { schema } = useDocument.useDoc();
139
143
  const selectRow = strapiAdmin.useTable('UnpublishAction', (state)=>state.selectRow);
140
144
  const hasPublishPermission = DocumentRBAC.useDocumentRBAC('unpublishAction', (state)=>state.canPublish);
141
- const hasI18nEnabled = Boolean(schema?.pluginOptions?.i18n);
142
145
  const hasDraftAndPublishEnabled = Boolean(schema?.options?.draftAndPublish);
143
146
  const { unpublishMany: bulkUnpublishAction, isLoading } = useDocumentActions.useDocumentActions();
144
147
  const documentIds = documents.map(({ documentId })=>documentId);
@@ -191,19 +194,6 @@ const UnpublishAction = ({ documents, model })=>{
191
194
  id: 'popUpWarning.bodyMessage.contentType.unpublish.all',
192
195
  defaultMessage: 'Are you sure you want to unpublish these entries?'
193
196
  })
194
- }),
195
- hasI18nEnabled && /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
196
- textAlign: "center",
197
- padding: 3,
198
- children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
199
- textColor: "danger500",
200
- children: formatMessage({
201
- id: translations.getTranslation('Settings.list.actions.unpublishAdditionalInfos'),
202
- defaultMessage: 'This will unpublish the active locale versions <em>(from Internationalization)</em>'
203
- }, {
204
- em: Emphasis
205
- })
206
- })
207
197
  })
208
198
  ]
209
199
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.js","sources":["../../../../../../admin/src/pages/ListView/components/BulkActions/Actions.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n useStrapiApp,\n DescriptionComponentRenderer,\n useTable,\n useQueryParams,\n} from '@strapi/admin/strapi-admin';\nimport { Box, ButtonProps, Flex, Typography } from '@strapi/design-system';\nimport { WarningCircle } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\n\nimport { useDocumentRBAC } from '../../../../features/DocumentRBAC';\nimport { useDoc } from '../../../../hooks/useDocument';\nimport { useDocumentActions } from '../../../../hooks/useDocumentActions';\nimport { buildValidParams } from '../../../../utils/api';\nimport { getTranslation } from '../../../../utils/translations';\nimport {\n DialogOptions,\n DocumentActionButton,\n ModalOptions,\n NotificationOptions,\n} from '../../../EditView/components/DocumentActions';\n\nimport { PublishAction } from './PublishAction';\n\nimport type { BulkActionComponent, ContentManagerPlugin } from '../../../../content-manager';\n\ninterface BulkActionDescription {\n dialog?: DialogOptions | NotificationOptions | ModalOptions;\n disabled?: boolean;\n icon?: React.ReactNode;\n label: string;\n onClick?: (event: React.SyntheticEvent) => void;\n /**\n * @default 'default'\n */\n type?: 'icon' | 'default';\n /**\n * @default 'secondary'\n */\n variant?: ButtonProps['variant'];\n}\n\n/* -------------------------------------------------------------------------------------------------\n * BulkActionsRenderer\n * -----------------------------------------------------------------------------------------------*/\n\nconst BulkActionsRenderer = () => {\n const plugins = useStrapiApp('BulkActionsRenderer', (state) => state.plugins);\n\n const { model, collectionType } = useDoc();\n const { selectedRows } = useTable('BulkActionsRenderer', (state) => state);\n\n return (\n <Flex gap={2}>\n <DescriptionComponentRenderer\n props={{\n model,\n collectionType,\n documents: selectedRows,\n }}\n descriptions={(\n plugins['content-manager'].apis as ContentManagerPlugin['config']['apis']\n ).getBulkActions()}\n >\n {(actions) => actions.map((action) => <DocumentActionButton key={action.id} {...action} />)}\n </DescriptionComponentRenderer>\n </Flex>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DefaultBulkActions\n * -----------------------------------------------------------------------------------------------*/\n\nconst DeleteAction: BulkActionComponent = ({ documents, model }) => {\n const { formatMessage } = useIntl();\n const { schema: contentType } = useDoc();\n const selectRow = useTable('DeleteAction', (state) => state.selectRow);\n const hasI18nEnabled = Boolean(contentType?.pluginOptions?.i18n);\n const [{ query }] = useQueryParams<{ plugins?: { i18n?: { locale?: string } } }>();\n const params = React.useMemo(() => buildValidParams(query), [query]);\n const hasDeletePermission = useDocumentRBAC('deleteAction', (state) => state.canDelete);\n const { deleteMany: bulkDeleteAction, isLoading } = useDocumentActions();\n const documentIds = documents.map(({ documentId }) => documentId);\n\n const handleConfirmBulkDelete = async () => {\n const res = await bulkDeleteAction({\n documentIds,\n model,\n params,\n });\n if (!('error' in res)) {\n selectRow([]);\n }\n };\n\n if (!hasDeletePermission) return null;\n\n return {\n variant: 'danger-light',\n label: formatMessage({ id: 'global.delete', defaultMessage: 'Delete' }),\n dialog: {\n type: 'dialog',\n title: formatMessage({\n id: 'app.components.ConfirmDialog.title',\n defaultMessage: 'Confirmation',\n }),\n loading: isLoading,\n content: (\n <Flex direction=\"column\" alignItems=\"stretch\" gap={2}>\n <Flex justifyContent=\"center\">\n <WarningCircle width=\"24px\" height=\"24px\" fill=\"danger600\" />\n </Flex>\n <Typography id=\"confirm-description\" textAlign=\"center\">\n {formatMessage({\n id: 'popUpWarning.bodyMessage.contentType.delete.all',\n defaultMessage: 'Are you sure you want to delete these entries?',\n })}\n </Typography>\n {hasI18nEnabled && (\n <Box textAlign=\"center\" padding={3}>\n <Typography textColor=\"danger500\">\n {formatMessage(\n {\n id: getTranslation('Settings.list.actions.deleteAdditionalInfos'),\n defaultMessage:\n 'This will delete the active locale versions <em>(from Internationalization)</em>',\n },\n {\n em: Emphasis,\n }\n )}\n </Typography>\n </Box>\n )}\n </Flex>\n ),\n onConfirm: handleConfirmBulkDelete,\n },\n };\n};\n\nDeleteAction.type = 'delete';\n\nconst UnpublishAction: BulkActionComponent = ({ documents, model }) => {\n const { formatMessage } = useIntl();\n const { schema } = useDoc();\n const selectRow = useTable('UnpublishAction', (state) => state.selectRow);\n const hasPublishPermission = useDocumentRBAC('unpublishAction', (state) => state.canPublish);\n const hasI18nEnabled = Boolean(schema?.pluginOptions?.i18n);\n const hasDraftAndPublishEnabled = Boolean(schema?.options?.draftAndPublish);\n const { unpublishMany: bulkUnpublishAction, isLoading } = useDocumentActions();\n const documentIds = documents.map(({ documentId }) => documentId);\n const [{ query }] = useQueryParams();\n const params = React.useMemo(() => buildValidParams(query), [query]);\n\n const handleConfirmBulkUnpublish = async () => {\n const data = await bulkUnpublishAction({ documentIds, model, params });\n if (!('error' in data)) {\n selectRow([]);\n }\n };\n\n const showUnpublishButton =\n hasDraftAndPublishEnabled &&\n hasPublishPermission &&\n documents.some((entry) => entry.status === 'published' || entry.status === 'modified');\n\n if (!showUnpublishButton) return null;\n\n return {\n variant: 'tertiary',\n label: formatMessage({ id: 'app.utils.unpublish', defaultMessage: 'Unpublish' }),\n dialog: {\n type: 'dialog',\n title: formatMessage({\n id: 'app.components.ConfirmDialog.title',\n defaultMessage: 'Confirmation',\n }),\n loading: isLoading,\n content: (\n <Flex direction=\"column\" alignItems=\"stretch\" gap={2}>\n <Flex justifyContent=\"center\">\n <WarningCircle width=\"24px\" height=\"24px\" fill=\"danger600\" />\n </Flex>\n <Typography id=\"confirm-description\" textAlign=\"center\">\n {formatMessage({\n id: 'popUpWarning.bodyMessage.contentType.unpublish.all',\n defaultMessage: 'Are you sure you want to unpublish these entries?',\n })}\n </Typography>\n {hasI18nEnabled && (\n <Box textAlign=\"center\" padding={3}>\n <Typography textColor=\"danger500\">\n {formatMessage(\n {\n id: getTranslation('Settings.list.actions.unpublishAdditionalInfos'),\n defaultMessage:\n 'This will unpublish the active locale versions <em>(from Internationalization)</em>',\n },\n {\n em: Emphasis,\n }\n )}\n </Typography>\n </Box>\n )}\n </Flex>\n ),\n confirmButton: formatMessage({\n id: 'app.utils.unpublish',\n defaultMessage: 'Unpublish',\n }),\n onConfirm: handleConfirmBulkUnpublish,\n },\n };\n};\n\nUnpublishAction.type = 'unpublish';\n\nconst Emphasis = (chunks: React.ReactNode) => (\n <Typography fontWeight=\"semiBold\" textColor=\"danger500\">\n {chunks}\n </Typography>\n);\n\nconst DEFAULT_BULK_ACTIONS: BulkActionComponent[] = [PublishAction, UnpublishAction, DeleteAction];\n\nexport { DEFAULT_BULK_ACTIONS, BulkActionsRenderer, Emphasis };\nexport type { BulkActionDescription };\n"],"names":["BulkActionsRenderer","plugins","useStrapiApp","state","model","collectionType","useDoc","selectedRows","useTable","_jsx","Flex","gap","DescriptionComponentRenderer","props","documents","descriptions","apis","getBulkActions","actions","map","action","DocumentActionButton","id","DeleteAction","formatMessage","useIntl","schema","contentType","selectRow","hasI18nEnabled","Boolean","pluginOptions","i18n","query","useQueryParams","params","React","useMemo","buildValidParams","hasDeletePermission","useDocumentRBAC","canDelete","deleteMany","bulkDeleteAction","isLoading","useDocumentActions","documentIds","documentId","handleConfirmBulkDelete","res","variant","label","defaultMessage","dialog","type","title","loading","content","_jsxs","direction","alignItems","justifyContent","WarningCircle","width","height","fill","Typography","textAlign","Box","padding","textColor","getTranslation","em","Emphasis","onConfirm","UnpublishAction","hasPublishPermission","canPublish","hasDraftAndPublishEnabled","options","draftAndPublish","unpublishMany","bulkUnpublishAction","handleConfirmBulkUnpublish","data","showUnpublishButton","some","entry","status","confirmButton","chunks","fontWeight","DEFAULT_BULK_ACTIONS","PublishAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA;;AAEkG,2GAE5FA,mBAAsB,GAAA,IAAA;AAC1B,IAAA,MAAMC,UAAUC,wBAAa,CAAA,qBAAA,EAAuB,CAACC,KAAAA,GAAUA,MAAMF,OA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U,EAAA,WAAA;AACzCoB,QAAAA,QAAAA,EAAAA;;AAIL,MAAME,oBAA8C,GAAA;AAACC,IAAAA,2BAAAA;AAAelB,IAAAA,eAAAA;AAAiBpD,IAAAA;AAAa;;;;;;"}
1
+ {"version":3,"file":"Actions.js","sources":["../../../../../../admin/src/pages/ListView/components/BulkActions/Actions.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n useStrapiApp,\n DescriptionComponentRenderer,\n useTable,\n useQueryParams,\n} from '@strapi/admin/strapi-admin';\nimport { Box, ButtonProps, Flex, Typography } from '@strapi/design-system';\nimport { WarningCircle } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\n\nimport { useDocumentRBAC } from '../../../../features/DocumentRBAC';\nimport { useDoc } from '../../../../hooks/useDocument';\nimport { useDocumentActions } from '../../../../hooks/useDocumentActions';\nimport { useDocumentLayout } from '../../../../hooks/useDocumentLayout';\nimport { buildValidParams } from '../../../../utils/api';\nimport { getTranslation } from '../../../../utils/translations';\nimport {\n DialogOptions,\n DocumentActionButton,\n ModalOptions,\n NotificationOptions,\n} from '../../../EditView/components/DocumentActions';\n\nimport { PublishAction } from './PublishAction';\n\nimport type { BulkActionComponent, ContentManagerPlugin } from '../../../../content-manager';\n\ninterface BulkActionDescription {\n dialog?: DialogOptions | NotificationOptions | ModalOptions;\n disabled?: boolean;\n icon?: React.ReactNode;\n label: string;\n onClick?: (event: React.SyntheticEvent) => void;\n /**\n * @default 'default'\n */\n type?: 'icon' | 'default';\n /**\n * @default 'secondary'\n */\n variant?: ButtonProps['variant'];\n}\n\n/* -------------------------------------------------------------------------------------------------\n * BulkActionsRenderer\n * -----------------------------------------------------------------------------------------------*/\n\nconst BulkActionsRenderer = () => {\n const plugins = useStrapiApp('BulkActionsRenderer', (state) => state.plugins);\n\n const { model, collectionType } = useDoc();\n const { list } = useDocumentLayout(model);\n const { selectedRows } = useTable('BulkActionsRenderer', (state) => state);\n\n return (\n <Flex gap={2}>\n <DescriptionComponentRenderer\n props={{\n model,\n collectionType,\n documents: selectedRows,\n }}\n descriptions={(\n plugins['content-manager'].apis as ContentManagerPlugin['config']['apis']\n ).getBulkActions()}\n >\n {(actions) =>\n actions.map((action) => {\n return list.settings.bulkable && <DocumentActionButton key={action.id} {...action} />;\n })\n }\n </DescriptionComponentRenderer>\n </Flex>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DefaultBulkActions\n * -----------------------------------------------------------------------------------------------*/\n\nconst DeleteAction: BulkActionComponent = ({ documents, model }) => {\n const { formatMessage } = useIntl();\n const { schema: contentType } = useDoc();\n const selectRow = useTable('DeleteAction', (state) => state.selectRow);\n const hasI18nEnabled = Boolean(contentType?.pluginOptions?.i18n);\n const [{ query }] = useQueryParams<{ plugins?: { i18n?: { locale?: string } } }>();\n const params = React.useMemo(() => buildValidParams(query), [query]);\n const hasDeletePermission = useDocumentRBAC('deleteAction', (state) => state.canDelete);\n const { deleteMany: bulkDeleteAction, isLoading } = useDocumentActions();\n const documentIds = documents.map(({ documentId }) => documentId);\n\n const handleConfirmBulkDelete = async () => {\n const res = await bulkDeleteAction({\n documentIds,\n model,\n params,\n });\n if (!('error' in res)) {\n selectRow([]);\n }\n };\n\n if (!hasDeletePermission) return null;\n\n return {\n variant: 'danger-light',\n label: formatMessage({ id: 'global.delete', defaultMessage: 'Delete' }),\n dialog: {\n type: 'dialog',\n title: formatMessage({\n id: 'app.components.ConfirmDialog.title',\n defaultMessage: 'Confirmation',\n }),\n loading: isLoading,\n content: (\n <Flex direction=\"column\" alignItems=\"stretch\" gap={2}>\n <Flex justifyContent=\"center\">\n <WarningCircle width=\"24px\" height=\"24px\" fill=\"danger600\" />\n </Flex>\n <Typography id=\"confirm-description\" textAlign=\"center\">\n {formatMessage({\n id: 'popUpWarning.bodyMessage.contentType.delete.all',\n defaultMessage: 'Are you sure you want to delete these entries?',\n })}\n </Typography>\n {hasI18nEnabled && (\n <Box textAlign=\"center\" padding={3}>\n <Typography textColor=\"danger500\">\n {formatMessage(\n {\n id: getTranslation('Settings.list.actions.deleteAdditionalInfos'),\n defaultMessage:\n 'This will delete the active locale versions <em>(from Internationalization)</em>',\n },\n {\n em: Emphasis,\n }\n )}\n </Typography>\n </Box>\n )}\n </Flex>\n ),\n onConfirm: handleConfirmBulkDelete,\n },\n };\n};\n\nDeleteAction.type = 'delete';\n\nconst UnpublishAction: BulkActionComponent = ({ documents, model }) => {\n const { formatMessage } = useIntl();\n const { schema } = useDoc();\n const selectRow = useTable('UnpublishAction', (state) => state.selectRow);\n const hasPublishPermission = useDocumentRBAC('unpublishAction', (state) => state.canPublish);\n const hasDraftAndPublishEnabled = Boolean(schema?.options?.draftAndPublish);\n const { unpublishMany: bulkUnpublishAction, isLoading } = useDocumentActions();\n const documentIds = documents.map(({ documentId }) => documentId);\n const [{ query }] = useQueryParams();\n const params = React.useMemo(() => buildValidParams(query), [query]);\n\n const handleConfirmBulkUnpublish = async () => {\n const data = await bulkUnpublishAction({ documentIds, model, params });\n if (!('error' in data)) {\n selectRow([]);\n }\n };\n\n const showUnpublishButton =\n hasDraftAndPublishEnabled &&\n hasPublishPermission &&\n documents.some((entry) => entry.status === 'published' || entry.status === 'modified');\n\n if (!showUnpublishButton) return null;\n\n return {\n variant: 'tertiary',\n label: formatMessage({ id: 'app.utils.unpublish', defaultMessage: 'Unpublish' }),\n dialog: {\n type: 'dialog',\n title: formatMessage({\n id: 'app.components.ConfirmDialog.title',\n defaultMessage: 'Confirmation',\n }),\n loading: isLoading,\n content: (\n <Flex direction=\"column\" alignItems=\"stretch\" gap={2}>\n <Flex justifyContent=\"center\">\n <WarningCircle width=\"24px\" height=\"24px\" fill=\"danger600\" />\n </Flex>\n <Typography id=\"confirm-description\" textAlign=\"center\">\n {formatMessage({\n id: 'popUpWarning.bodyMessage.contentType.unpublish.all',\n defaultMessage: 'Are you sure you want to unpublish these entries?',\n })}\n </Typography>\n </Flex>\n ),\n confirmButton: formatMessage({\n id: 'app.utils.unpublish',\n defaultMessage: 'Unpublish',\n }),\n onConfirm: handleConfirmBulkUnpublish,\n },\n };\n};\n\nUnpublishAction.type = 'unpublish';\n\nconst Emphasis = (chunks: React.ReactNode) => (\n <Typography fontWeight=\"semiBold\" textColor=\"danger500\">\n {chunks}\n </Typography>\n);\n\nconst DEFAULT_BULK_ACTIONS: BulkActionComponent[] = [PublishAction, UnpublishAction, DeleteAction];\n\nexport { DEFAULT_BULK_ACTIONS, BulkActionsRenderer, Emphasis };\nexport type { BulkActionDescription };\n"],"names":["BulkActionsRenderer","plugins","useStrapiApp","state","model","collectionType","useDoc","list","useDocumentLayout","selectedRows","useTable","_jsx","Flex","gap","DescriptionComponentRenderer","props","documents","descriptions","apis","getBulkActions","actions","map","action","settings","bulkable","DocumentActionButton","id","DeleteAction","formatMessage","useIntl","schema","contentType","selectRow","hasI18nEnabled","Boolean","pluginOptions","i18n","query","useQueryParams","params","React","useMemo","buildValidParams","hasDeletePermission","useDocumentRBAC","canDelete","deleteMany","bulkDeleteAction","isLoading","useDocumentActions","documentIds","documentId","handleConfirmBulkDelete","res","variant","label","defaultMessage","dialog","type","title","loading","content","_jsxs","direction","alignItems","justifyContent","WarningCircle","width","height","fill","Typography","textAlign","Box","padding","textColor","getTranslation","em","Emphasis","onConfirm","UnpublishAction","hasPublishPermission","canPublish","hasDraftAndPublishEnabled","options","draftAndPublish","unpublishMany","bulkUnpublishAction","handleConfirmBulkUnpublish","data","showUnpublishButton","some","entry","status","confirmButton","chunks","fontWeight","DEFAULT_BULK_ACTIONS","PublishAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA;;AAEkG,2GAE5FA,mBAAsB,GAAA,IAAA;AAC1B,IAAA,MAAMC,UAAUC,wBAAa,CAAA,qBAAA,EAAuB,CAACC,KAAAA,GAAUA,MAAMF,OAAO,CAAA;AAE5E,IAAA,MAAM,EAAEG,KAAK,EAAEC,cAAc,EAAE,GAAGC,kBAAAA,EAAAA;AAClC,IAAA,MAAM,EAAEC,IAAI,EAAE,G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AAA,OAAAA,gBACEC,eAAClD,CAAAA,iBAAAA,EAAAA;gBAAKmD,SAAU,EAAA,QAAA;gBAASC,UAAW,EAAA,SAAA;gBAAUnD,GAAK,EAAA,CAAA;;kCACjDF,cAACC,CAAAA,iBAAAA,EAAAA;wBAAKqD,cAAe,EAAA,QAAA;AACnB,wBAAA,QAAA,gBAAAtD,cAACuD,CAAAA,mBAAAA,EAAAA;4BAAcC,KAAM,EAAA,MAAA;4BAAOC,MAAO,EAAA,MAAA;4BAAOC,IAAK,EAAA;;;kCAEjD1D,cAAC2D,CAAAA,uBAAAA,EAAAA;wBAAW5C,EAAG,EAAA,qBAAA;wBAAsB6C,SAAU,EAAA,QAAA;kCAC5C3C,aAAc,CAAA;4BACbF,EAAI,EAAA,oDAAA;4BACJ8B,cAAgB,EAAA;AAClB,yBAAA;;;;AAINqC,YAAAA,aAAAA,EAAejE,aAAc,CAAA;gBAC3BF,EAAI,EAAA,qBAAA;gBACJ8B,cAAgB,EAAA;AAClB,aAAA,CAAA;YACAsB,SAAWS,EAAAA;AACb;AACF,KAAA;AACF,CAAA;AAEAR,eAAAA,CAAgBrB,IAAI,GAAG,WAAA;AAEjBmB,MAAAA,QAAAA,GAAW,CAACiB,MAAAA,iBAChBnF,cAAC2D,CAAAA,uBAAAA,EAAAA;QAAWyB,UAAW,EAAA,UAAA;QAAWrB,SAAU,EAAA,WAAA;AACzCoB,QAAAA,QAAAA,EAAAA;;AAIL,MAAME,oBAA8C,GAAA;AAACC,IAAAA,2BAAAA;AAAelB,IAAAA,eAAAA;AAAiBpD,IAAAA;AAAa;;;;;;"}
@@ -7,6 +7,7 @@ import { useIntl } from 'react-intl';
7
7
  import { useDocumentRBAC } from '../../../../features/DocumentRBAC.mjs';
8
8
  import { useDoc } from '../../../../hooks/useDocument.mjs';
9
9
  import { useDocumentActions } from '../../../../hooks/useDocumentActions.mjs';
10
+ import { useDocumentLayout } from '../../../../hooks/useDocumentLayout.mjs';
10
11
  import { buildValidParams } from '../../../../utils/api.mjs';
11
12
  import { getTranslation } from '../../../../utils/translations.mjs';
12
13
  import { DocumentActionButton } from '../../../EditView/components/DocumentActions.mjs';
@@ -17,6 +18,7 @@ import { PublishAction } from './PublishAction.mjs';
17
18
  * -----------------------------------------------------------------------------------------------*/ const BulkActionsRenderer = ()=>{
18
19
  const plugins = useStrapiApp('BulkActionsRenderer', (state)=>state.plugins);
19
20
  const { model, collectionType } = useDoc();
21
+ const { list } = useDocumentLayout(model);
20
22
  const { selectedRows } = useTable('BulkActionsRenderer', (state)=>state);
21
23
  return /*#__PURE__*/ jsx(Flex, {
22
24
  gap: 2,
@@ -27,9 +29,11 @@ import { PublishAction } from './PublishAction.mjs';
27
29
  documents: selectedRows
28
30
  },
29
31
  descriptions: plugins['content-manager'].apis.getBulkActions(),
30
- children: (actions)=>actions.map((action)=>/*#__PURE__*/ jsx(DocumentActionButton, {
32
+ children: (actions)=>actions.map((action)=>{
33
+ return list.settings.bulkable && /*#__PURE__*/ jsx(DocumentActionButton, {
31
34
  ...action
32
- }, action.id))
35
+ }, action.id);
36
+ })
33
37
  })
34
38
  });
35
39
  };
@@ -117,7 +121,6 @@ const UnpublishAction = ({ documents, model })=>{
117
121
  const { schema } = useDoc();
118
122
  const selectRow = useTable('UnpublishAction', (state)=>state.selectRow);
119
123
  const hasPublishPermission = useDocumentRBAC('unpublishAction', (state)=>state.canPublish);
120
- const hasI18nEnabled = Boolean(schema?.pluginOptions?.i18n);
121
124
  const hasDraftAndPublishEnabled = Boolean(schema?.options?.draftAndPublish);
122
125
  const { unpublishMany: bulkUnpublishAction, isLoading } = useDocumentActions();
123
126
  const documentIds = documents.map(({ documentId })=>documentId);
@@ -170,19 +173,6 @@ const UnpublishAction = ({ documents, model })=>{
170
173
  id: 'popUpWarning.bodyMessage.contentType.unpublish.all',
171
174
  defaultMessage: 'Are you sure you want to unpublish these entries?'
172
175
  })
173
- }),
174
- hasI18nEnabled && /*#__PURE__*/ jsx(Box, {
175
- textAlign: "center",
176
- padding: 3,
177
- children: /*#__PURE__*/ jsx(Typography, {
178
- textColor: "danger500",
179
- children: formatMessage({
180
- id: getTranslation('Settings.list.actions.unpublishAdditionalInfos'),
181
- defaultMessage: 'This will unpublish the active locale versions <em>(from Internationalization)</em>'
182
- }, {
183
- em: Emphasis
184
- })
185
- })
186
176
  })
187
177
  ]
188
178
  }),