@strapi/content-manager 0.0.0-experimental.9139e0ebf135e8f8ec2ea95468f0ac6fe6d9db9a → 0.0.0-experimental.930984cb14e431b8079ddfcaaae035bdb5cf5edb

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 (155) hide show
  1. package/dist/admin/components/Widgets.js +267 -9
  2. package/dist/admin/components/Widgets.js.map +1 -1
  3. package/dist/admin/components/Widgets.mjs +250 -12
  4. package/dist/admin/components/Widgets.mjs.map +1 -1
  5. package/dist/admin/hooks/useDocumentActions.js +0 -3
  6. package/dist/admin/hooks/useDocumentActions.js.map +1 -1
  7. package/dist/admin/hooks/useDocumentActions.mjs +1 -4
  8. package/dist/admin/hooks/useDocumentActions.mjs.map +1 -1
  9. package/dist/admin/index.js +47 -8
  10. package/dist/admin/index.js.map +1 -1
  11. package/dist/admin/index.mjs +47 -9
  12. package/dist/admin/index.mjs.map +1 -1
  13. package/dist/admin/layout.js +1 -27
  14. package/dist/admin/layout.js.map +1 -1
  15. package/dist/admin/layout.mjs +2 -9
  16. package/dist/admin/layout.mjs.map +1 -1
  17. package/dist/admin/pages/EditView/EditViewPage.js +13 -5
  18. package/dist/admin/pages/EditView/EditViewPage.js.map +1 -1
  19. package/dist/admin/pages/EditView/EditViewPage.mjs +15 -7
  20. package/dist/admin/pages/EditView/EditViewPage.mjs.map +1 -1
  21. package/dist/admin/pages/EditView/components/DocumentActions.js +42 -17
  22. package/dist/admin/pages/EditView/components/DocumentActions.js.map +1 -1
  23. package/dist/admin/pages/EditView/components/DocumentActions.mjs +43 -18
  24. package/dist/admin/pages/EditView/components/DocumentActions.mjs.map +1 -1
  25. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.js +1 -0
  26. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.js.map +1 -1
  27. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs +1 -0
  28. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs.map +1 -1
  29. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js +4 -1
  30. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js.map +1 -1
  31. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs +4 -1
  32. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs.map +1 -1
  33. package/dist/admin/pages/EditView/utils/data.js +7 -1
  34. package/dist/admin/pages/EditView/utils/data.js.map +1 -1
  35. package/dist/admin/pages/EditView/utils/data.mjs +7 -1
  36. package/dist/admin/pages/EditView/utils/data.mjs.map +1 -1
  37. package/dist/admin/pages/ListView/ListViewPage.js +221 -203
  38. package/dist/admin/pages/ListView/ListViewPage.js.map +1 -1
  39. package/dist/admin/pages/ListView/ListViewPage.mjs +222 -204
  40. package/dist/admin/pages/ListView/ListViewPage.mjs.map +1 -1
  41. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.js +12 -2
  42. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.js.map +1 -1
  43. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.mjs +12 -2
  44. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.mjs.map +1 -1
  45. package/dist/admin/pages/ListView/components/Filters.js +3 -1
  46. package/dist/admin/pages/ListView/components/Filters.js.map +1 -1
  47. package/dist/admin/pages/ListView/components/Filters.mjs +3 -1
  48. package/dist/admin/pages/ListView/components/Filters.mjs.map +1 -1
  49. package/dist/admin/preview/components/PreviewSidePanel.js +31 -4
  50. package/dist/admin/preview/components/PreviewSidePanel.js.map +1 -1
  51. package/dist/admin/preview/components/PreviewSidePanel.mjs +32 -5
  52. package/dist/admin/preview/components/PreviewSidePanel.mjs.map +1 -1
  53. package/dist/admin/preview/pages/Preview.js +136 -35
  54. package/dist/admin/preview/pages/Preview.js.map +1 -1
  55. package/dist/admin/preview/pages/Preview.mjs +137 -36
  56. package/dist/admin/preview/pages/Preview.mjs.map +1 -1
  57. package/dist/admin/preview/utils/constants.js +21 -0
  58. package/dist/admin/preview/utils/constants.js.map +1 -0
  59. package/dist/admin/preview/utils/constants.mjs +19 -0
  60. package/dist/admin/preview/utils/constants.mjs.map +1 -0
  61. package/dist/admin/preview/utils/previewScript.js +203 -0
  62. package/dist/admin/preview/utils/previewScript.js.map +1 -0
  63. package/dist/admin/preview/utils/previewScript.mjs +201 -0
  64. package/dist/admin/preview/utils/previewScript.mjs.map +1 -0
  65. package/dist/admin/services/api.js +4 -1
  66. package/dist/admin/services/api.js.map +1 -1
  67. package/dist/admin/services/api.mjs +4 -1
  68. package/dist/admin/services/api.mjs.map +1 -1
  69. package/dist/admin/services/documents.js +40 -14
  70. package/dist/admin/services/documents.js.map +1 -1
  71. package/dist/admin/services/documents.mjs +40 -14
  72. package/dist/admin/services/documents.mjs.map +1 -1
  73. package/dist/admin/src/components/Widgets.d.ts +2 -1
  74. package/dist/admin/src/exports.d.ts +1 -0
  75. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  76. package/dist/admin/src/preview/services/preview.d.ts +1 -1
  77. package/dist/admin/src/preview/utils/constants.d.ts +17 -0
  78. package/dist/admin/src/preview/utils/previewScript.d.ts +18 -0
  79. package/dist/admin/src/services/api.d.ts +1 -1
  80. package/dist/admin/src/services/components.d.ts +2 -2
  81. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  82. package/dist/admin/src/services/documents.d.ts +16 -16
  83. package/dist/admin/src/services/homepage.d.ts +1 -1
  84. package/dist/admin/src/services/init.d.ts +1 -1
  85. package/dist/admin/src/services/relations.d.ts +2 -2
  86. package/dist/admin/src/services/uid.d.ts +3 -3
  87. package/dist/admin/src/utils/api.d.ts +1 -1
  88. package/dist/admin/translations/en.json.js +6 -0
  89. package/dist/admin/translations/en.json.js.map +1 -1
  90. package/dist/admin/translations/en.json.mjs +6 -0
  91. package/dist/admin/translations/en.json.mjs.map +1 -1
  92. package/dist/admin/translations/es.json.js +5 -2
  93. package/dist/admin/translations/es.json.js.map +1 -1
  94. package/dist/admin/translations/es.json.mjs +5 -2
  95. package/dist/admin/translations/es.json.mjs.map +1 -1
  96. package/dist/admin/translations/fr.json.js +4 -1
  97. package/dist/admin/translations/fr.json.js.map +1 -1
  98. package/dist/admin/translations/fr.json.mjs +4 -1
  99. package/dist/admin/translations/fr.json.mjs.map +1 -1
  100. package/dist/admin/utils/api.js +1 -1
  101. package/dist/admin/utils/api.js.map +1 -1
  102. package/dist/admin/utils/api.mjs +1 -1
  103. package/dist/admin/utils/api.mjs.map +1 -1
  104. package/dist/admin/utils/validation.js +2 -1
  105. package/dist/admin/utils/validation.js.map +1 -1
  106. package/dist/admin/utils/validation.mjs +2 -1
  107. package/dist/admin/utils/validation.mjs.map +1 -1
  108. package/dist/server/history/services/lifecycles.js +20 -19
  109. package/dist/server/history/services/lifecycles.js.map +1 -1
  110. package/dist/server/history/services/lifecycles.mjs +20 -19
  111. package/dist/server/history/services/lifecycles.mjs.map +1 -1
  112. package/dist/server/homepage/controllers/homepage.js +5 -0
  113. package/dist/server/homepage/controllers/homepage.js.map +1 -1
  114. package/dist/server/homepage/controllers/homepage.mjs +5 -0
  115. package/dist/server/homepage/controllers/homepage.mjs.map +1 -1
  116. package/dist/server/homepage/routes/homepage.js +11 -0
  117. package/dist/server/homepage/routes/homepage.js.map +1 -1
  118. package/dist/server/homepage/routes/homepage.mjs +11 -0
  119. package/dist/server/homepage/routes/homepage.mjs.map +1 -1
  120. package/dist/server/homepage/services/homepage.js +86 -46
  121. package/dist/server/homepage/services/homepage.js.map +1 -1
  122. package/dist/server/homepage/services/homepage.mjs +86 -46
  123. package/dist/server/homepage/services/homepage.mjs.map +1 -1
  124. package/dist/server/preview/services/preview-config.js +5 -1
  125. package/dist/server/preview/services/preview-config.js.map +1 -1
  126. package/dist/server/preview/services/preview-config.mjs +5 -1
  127. package/dist/server/preview/services/preview-config.mjs.map +1 -1
  128. package/dist/server/preview/services/preview.js +4 -0
  129. package/dist/server/preview/services/preview.js.map +1 -1
  130. package/dist/server/preview/services/preview.mjs +4 -0
  131. package/dist/server/preview/services/preview.mjs.map +1 -1
  132. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  133. package/dist/server/src/homepage/controllers/homepage.d.ts +2 -1
  134. package/dist/server/src/homepage/controllers/homepage.d.ts.map +1 -1
  135. package/dist/server/src/homepage/index.d.ts +7 -0
  136. package/dist/server/src/homepage/index.d.ts.map +1 -1
  137. package/dist/server/src/homepage/routes/homepage.d.ts.map +1 -1
  138. package/dist/server/src/homepage/services/homepage.d.ts +4 -1
  139. package/dist/server/src/homepage/services/homepage.d.ts.map +1 -1
  140. package/dist/server/src/homepage/services/index.d.ts +7 -0
  141. package/dist/server/src/homepage/services/index.d.ts.map +1 -1
  142. package/dist/server/src/index.d.ts +7 -0
  143. package/dist/server/src/index.d.ts.map +1 -1
  144. package/dist/server/src/preview/services/index.d.ts +1 -0
  145. package/dist/server/src/preview/services/index.d.ts.map +1 -1
  146. package/dist/server/src/preview/services/preview-config.d.ts +1 -0
  147. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -1
  148. package/dist/server/src/preview/services/preview.d.ts.map +1 -1
  149. package/dist/server/src/preview/utils.d.ts +1 -0
  150. package/dist/server/src/preview/utils.d.ts.map +1 -1
  151. package/dist/server/src/services/index.d.ts +7 -0
  152. package/dist/server/src/services/index.d.ts.map +1 -1
  153. package/dist/shared/contracts/homepage.d.ts +13 -0
  154. package/dist/shared/contracts/homepage.d.ts.map +1 -1
  155. package/package.json +7 -8
@@ -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 * 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 ?? initialValue;\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(\n (item, index) =>\n handleInvisibleAttributes(\n item,\n {\n schema: compSchema,\n initialValues: initialValue?.[index] ?? {},\n components,\n },\n [...path, `${attrName}[${index}]`],\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, index) => {\n const compUID = dzItem?.__component;\n const compSchema = components[compUID];\n\n const cleaned = handleInvisibleAttributes(\n dzItem,\n {\n schema: compSchema,\n initialValues: initialValue?.[index] ?? {},\n components,\n },\n [...path, `${attrName}[${index}]`],\n removedAttributes\n ).data;\n\n return {\n __component: compUID,\n ...cleaned,\n };\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","handleInvisibleAttributes","initialValues","path","removedAttributes","rulesEngine","createRulesEngine","result","attrName","attrDef","fullPath","join","condition","conditions","visible","isVisible","evaluate","push","userProvided","prototype","hasOwnProperty","call","currentValue","initialValue","compSchema","item","dzItem","compUID","cleaned"],"mappings":";;;;;AA0BA,MAAMA,yBAA4B,GAAA;AAAC,IAAA,aAAA;AAAe,IAAA;AAAe,CAAA;AAEjE;;;;;;;;;;AAUC,IACD,MAAMC,YAAAA,GACJ,CAACC,SAAAA,EAAsBC,YACvB,CAACC,MAAAA,EAAuBC,UAAmC,GAAA,EAAE,GAC7D,CAACC,IAAAA,GAAgB,EAAE,GAAA;YACjB,MAAMC,QAAAA,GAAW,CAACC,KAAgBC,EAAAA,UAAAA,GAAAA;gBAChC,OAAOC,MAAAA,CAAOC,OAAO,CAACH,KAAOI,CAAAA,CAAAA,MAAM,CAAU,CAACC,GAAAA,EAAK,CAACC,GAAAA,EAAKC,KAAM,CAAA,GAAA;oBAC7D,MAAM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IAAAA,QAAAA,KAAa,YAAc,EAAA;AAElD,gBAAA;AACF;YACAD,MAAM,CAACC,SAAS,GAAG,IAAA;AACrB;AACF;IAEA,OAAO;QACLtD,IAAMqD,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 * 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 ?? initialValue;\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(\n (item, index) =>\n handleInvisibleAttributes(\n item,\n {\n schema: compSchema,\n initialValues: initialValue?.[index] ?? {},\n components,\n },\n [...path, `${attrName}[${index}]`],\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, index) => {\n const compUID = dzItem?.__component;\n const compSchema = components[compUID];\n\n const cleaned = handleInvisibleAttributes(\n dzItem,\n {\n schema: compSchema,\n initialValues: initialValue?.[index] ?? {},\n components,\n },\n [...path, `${attrName}[${index}]`],\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","handleInvisibleAttributes","initialValues","path","removedAttributes","rulesEngine","createRulesEngine","result","attrName","attrDef","fullPath","join","condition","conditions","visible","isVisible","evaluate","push","userProvided","prototype","hasOwnProperty","call","currentValue","initialValue","compSchema","item","dzItem","compUID","cleaned","processedItem","id"],"mappings":";;;;;AA0BA,MAAMA,yBAA4B,GAAA;AAAC,IAAA,aAAA;AAAe,IAAA;AAAe,CAAA;AAEjE;;;;;;;;;;AAUC,IACD,MAAMC,YAAAA,GACJ,CAACC,SAAAA,EAAsBC,YACvB,CAACC,MAAAA,EAAuBC,UAAmC,GAAA,EAAE,GAC7D,CAACC,IAAAA,GAAgB,EAAE,GAAA;YACjB,MAAMC,QAAAA,GAAW,CAACC,KAAgBC,EAAAA,UAAAA,GAAAA;gBAChC,OAAOC,MAAAA,CAAOC,OAAO,CAACH,KAAOI,CAAAA,CAAAA,MAAM,CAAU,CAACC,GAAAA,EAAK,CAACC,GAAAA,EAAKC,KAAM,CAAA,GAAA;oBAC7D,MAAMC,SAAAA,GAAYP,UAAU,CAACK,GAAI,CAAA;AAEjC;;;YAIA,IAAId,0BAA0BiB,QAAQ,CAACH,QAAQC,KAAU,KAAA,IAAA,IAAQA,UAAUG,SAAW,EAAA;wBACpFL,GAAG,CAACC,IAAI,GAAGC,KAAAA;wBACX,OAAOF,GAAAA;AACT;oBAEA,IAAIG,SAAAA,CAAUG,IAAI,KAAK,WAAa,EAAA;wBAClC,IAAIH,SAAAA,CAAUI,UAAU,EAAE;AACxB,4BAAA,MAAMC,iBACJnB,SAAUc,CAAAA,SAAAA,EAAWD,KAASZ,CAAAA,GAAAA,SAAAA,CAAUY,OAAOC,SAAaD,CAAAA,GAAAA,KAAAA;AAE9DF,4BAAAA,GAAG,CAACC,GAAI,CAAA,GAAGO,cAAeC,CAAAA,GAAG,CAAC,CAACC,aAAAA,GAC7BhB,QAASgB,CAAAA,aAAAA,EAAelB,UAAU,CAACW,SAAAA,CAAUQ,SAAS,CAAC,EAAEf,cAAc,EAAC,CAAA,CAAA;yBAErE,MAAA;AACL,4BAAA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,MAAQwE,EAAAA,UAAAA;AACRtB,oBAAAA,aAAAA,EAAeqB,YAAc,GAACrC,KAAM,CAAA,IAAI,EAAC;AACzCjC,oBAAAA;iBAEF,EAAA;AAAIkD,oBAAAA,GAAAA,IAAAA;AAAM,oBAAA,CAAC,EAAEK,QAAS,CAAA,CAAC,EAAEtB,KAAAA,CAAM,CAAC;AAAE,iBAAA,EAClCkB,mBACAlD,IAAI;;gBAGN,MAAM2E,aAAAA,GACJH,OAAOI,EAAE,KAAKhE,aAAa4D,MAAOI,CAAAA,EAAE,KAAK,IACrC,GAAA;oBAAExD,WAAaqD,EAAAA,OAAAA;AAAS,oBAAA,GAAGC,OAAO;oBAAEE,EAAIhE,EAAAA;iBACxC,GAAA;oBAAEQ,WAAaqD,EAAAA,OAAAA;AAAS,oBAAA,GAAGC;AAAQ,iBAAA;gBAEzC,OAAOC,aAAAA;AACT,aAAA,CAAA;AAEA,YAAA;AACF;;AAGA,QAAA,IAAIP,iBAAiBxD,SAAW,EAAA;YAC9ByC,MAAM,CAACC,SAAS,GAAGc,YAAAA;SACd,MAAA,IAAIC,iBAAiBzD,SAAW,EAAA;YACrCyC,MAAM,CAACC,SAAS,GAAGe,YAAAA;SACd,MAAA;YACL,IAAIf,QAAAA,KAAa,IAAQA,IAAAA,QAAAA,KAAa,YAAc,EAAA;AAElD,gBAAA;AACF;YACAD,MAAM,CAACC,SAAS,GAAG,IAAA;AACrB;AACF;IAEA,OAAO;QACLtD,IAAMqD,EAAAA,MAAAA;AACNH,QAAAA;AACF,KAAA;AACF;;;;"}
@@ -195,234 +195,252 @@ const ListViewPage = ()=>{
195
195
  });
196
196
  };
197
197
  if (!isFetching && results.length === 0) {
198
- return /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Page.Main, {
198
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
199
199
  children: [
200
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Page.Title, {
201
- children: `${contentTypeTitle}`
200
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.tours.contentManager.Introduction, {
201
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {})
202
202
  }),
203
- /*#__PURE__*/ jsxRuntime.jsx(LayoutsHeaderCustom, {
204
- primaryAction: canCreate ? /*#__PURE__*/ jsxRuntime.jsx(CreateButton, {}) : null,
205
- subtitle: formatMessage({
206
- id: translations.getTranslation('pages.ListView.header-subtitle'),
207
- defaultMessage: '{number, plural, =0 {# entries} one {# entry} other {# entries}} found'
208
- }, {
209
- number: pagination?.total
210
- }),
211
- title: contentTypeTitle,
212
- navigationAction: /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.BackButton, {})
213
- }),
214
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Layouts.Action, {
215
- endActions: /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
216
- children: [
217
- /*#__PURE__*/ jsxRuntime.jsx(InjectionZone.InjectionZone, {
218
- area: "listView.actions"
219
- }),
220
- /*#__PURE__*/ jsxRuntime.jsx(ViewSettingsMenu.ViewSettingsMenu, {
221
- setHeaders: handleSetHeaders,
222
- resetHeaders: ()=>setDisplayedHeaders(list.layout),
223
- headers: displayedHeaders.map((header)=>header.name)
224
- })
225
- ]
226
- }),
227
- startActions: /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
228
- children: [
229
- list.settings.searchable && /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.SearchInput, {
230
- disabled: results.length === 0,
231
- label: formatMessage({
232
- id: 'app.component.search.label',
233
- defaultMessage: 'Search for {target}'
234
- }, {
235
- target: contentTypeTitle
236
- }),
237
- placeholder: formatMessage({
238
- id: 'global.search',
239
- defaultMessage: 'Search'
240
- }),
241
- trackedEvent: "didSearch"
242
- }),
243
- list.settings.filterable && schema ? /*#__PURE__*/ jsxRuntime.jsx(Filters.Filters, {
244
- disabled: results.length === 0,
245
- schema: schema
246
- }) : null
247
- ]
248
- })
249
- }),
250
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Layouts.Content, {
251
- children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
252
- background: "neutral0",
253
- shadow: "filterShadow",
254
- hasRadius: true,
255
- children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.EmptyStateLayout, {
256
- action: canCreate ? /*#__PURE__*/ jsxRuntime.jsx(CreateButton, {
257
- variant: "secondary"
203
+ /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Page.Main, {
204
+ children: [
205
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Page.Title, {
206
+ children: `${contentTypeTitle}`
207
+ }),
208
+ /*#__PURE__*/ jsxRuntime.jsx(LayoutsHeaderCustom, {
209
+ primaryAction: canCreate ? /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.tours.contentManager.CreateNewEntry, {
210
+ children: /*#__PURE__*/ jsxRuntime.jsx(CreateButton, {})
258
211
  }) : null,
259
- content: formatMessage({
260
- id: 'app.components.EmptyStateLayout.content-document',
261
- defaultMessage: 'No content found'
212
+ subtitle: formatMessage({
213
+ id: translations.getTranslation('pages.ListView.header-subtitle'),
214
+ defaultMessage: '{number, plural, =0 {# entries} one {# entry} other {# entries}} found'
215
+ }, {
216
+ number: pagination?.total
217
+ }),
218
+ title: contentTypeTitle,
219
+ navigationAction: /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.BackButton, {})
220
+ }),
221
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Layouts.Action, {
222
+ endActions: /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
223
+ children: [
224
+ /*#__PURE__*/ jsxRuntime.jsx(InjectionZone.InjectionZone, {
225
+ area: "listView.actions"
226
+ }),
227
+ /*#__PURE__*/ jsxRuntime.jsx(ViewSettingsMenu.ViewSettingsMenu, {
228
+ setHeaders: handleSetHeaders,
229
+ resetHeaders: ()=>setDisplayedHeaders(list.layout),
230
+ headers: displayedHeaders.map((header)=>header.name)
231
+ })
232
+ ]
262
233
  }),
263
- hasRadius: true,
264
- icon: /*#__PURE__*/ jsxRuntime.jsx(Symbols.EmptyDocuments, {
265
- width: "16rem"
234
+ startActions: /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
235
+ children: [
236
+ list.settings.searchable && /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.SearchInput, {
237
+ disabled: results.length === 0,
238
+ label: formatMessage({
239
+ id: 'app.component.search.label',
240
+ defaultMessage: 'Search for {target}'
241
+ }, {
242
+ target: contentTypeTitle
243
+ }),
244
+ placeholder: formatMessage({
245
+ id: 'global.search',
246
+ defaultMessage: 'Search'
247
+ }),
248
+ trackedEvent: "didSearch"
249
+ }),
250
+ list.settings.filterable && schema ? /*#__PURE__*/ jsxRuntime.jsx(Filters.Filters, {
251
+ disabled: results.length === 0,
252
+ schema: schema
253
+ }) : null
254
+ ]
255
+ })
256
+ }),
257
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Layouts.Content, {
258
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
259
+ background: "neutral0",
260
+ shadow: "filterShadow",
261
+ hasRadius: true,
262
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.EmptyStateLayout, {
263
+ action: canCreate ? /*#__PURE__*/ jsxRuntime.jsx(CreateButton, {
264
+ variant: "secondary"
265
+ }) : null,
266
+ content: formatMessage({
267
+ id: 'app.components.EmptyStateLayout.content-document',
268
+ defaultMessage: 'No content found'
269
+ }),
270
+ hasRadius: true,
271
+ icon: /*#__PURE__*/ jsxRuntime.jsx(Symbols.EmptyDocuments, {
272
+ width: "16rem"
273
+ })
274
+ })
266
275
  })
267
276
  })
268
- })
277
+ ]
269
278
  })
270
279
  ]
271
280
  });
272
281
  }
273
- return /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Page.Main, {
282
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
274
283
  children: [
275
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Page.Title, {
276
- children: `${contentTypeTitle}`
277
- }),
278
- /*#__PURE__*/ jsxRuntime.jsx(LayoutsHeaderCustom, {
279
- primaryAction: canCreate ? /*#__PURE__*/ jsxRuntime.jsx(CreateButton, {}) : null,
280
- subtitle: formatMessage({
281
- id: translations.getTranslation('pages.ListView.header-subtitle'),
282
- defaultMessage: '{number, plural, =0 {# entries} one {# entry} other {# entries}} found'
283
- }, {
284
- number: pagination?.total
285
- }),
286
- title: contentTypeTitle,
287
- navigationAction: /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.BackButton, {})
284
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.tours.contentManager.Introduction, {
285
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {})
288
286
  }),
289
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Layouts.Action, {
290
- endActions: /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
291
- children: [
292
- /*#__PURE__*/ jsxRuntime.jsx(InjectionZone.InjectionZone, {
293
- area: "listView.actions"
287
+ /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Page.Main, {
288
+ children: [
289
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Page.Title, {
290
+ children: `${contentTypeTitle}`
291
+ }),
292
+ /*#__PURE__*/ jsxRuntime.jsx(LayoutsHeaderCustom, {
293
+ primaryAction: canCreate ? /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.tours.contentManager.CreateNewEntry, {
294
+ children: /*#__PURE__*/ jsxRuntime.jsx(CreateButton, {})
295
+ }) : null,
296
+ subtitle: formatMessage({
297
+ id: translations.getTranslation('pages.ListView.header-subtitle'),
298
+ defaultMessage: '{number, plural, =0 {# entries} one {# entry} other {# entries}} found'
299
+ }, {
300
+ number: pagination?.total
294
301
  }),
295
- /*#__PURE__*/ jsxRuntime.jsx(ViewSettingsMenu.ViewSettingsMenu, {
296
- setHeaders: handleSetHeaders,
297
- resetHeaders: ()=>setDisplayedHeaders(list.layout),
298
- headers: displayedHeaders.map((header)=>header.name)
299
- })
300
- ]
301
- }),
302
- startActions: /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
303
- children: [
304
- list.settings.searchable && /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.SearchInput, {
305
- disabled: results.length === 0,
306
- label: formatMessage({
307
- id: 'app.component.search.label',
308
- defaultMessage: 'Search for {target}'
309
- }, {
310
- target: contentTypeTitle
311
- }),
312
- placeholder: formatMessage({
313
- id: 'global.search',
314
- defaultMessage: 'Search'
315
- }),
316
- trackedEvent: "didSearch"
302
+ title: contentTypeTitle,
303
+ navigationAction: /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.BackButton, {})
304
+ }),
305
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Layouts.Action, {
306
+ endActions: /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
307
+ children: [
308
+ /*#__PURE__*/ jsxRuntime.jsx(InjectionZone.InjectionZone, {
309
+ area: "listView.actions"
310
+ }),
311
+ /*#__PURE__*/ jsxRuntime.jsx(ViewSettingsMenu.ViewSettingsMenu, {
312
+ setHeaders: handleSetHeaders,
313
+ resetHeaders: ()=>setDisplayedHeaders(list.layout),
314
+ headers: displayedHeaders.map((header)=>header.name)
315
+ })
316
+ ]
317
317
  }),
318
- list.settings.filterable && schema ? /*#__PURE__*/ jsxRuntime.jsx(Filters.Filters, {
319
- disabled: results.length === 0,
320
- schema: schema
321
- }) : null
322
- ]
323
- })
324
- }),
325
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Layouts.Content, {
326
- children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
327
- gap: 4,
328
- direction: "column",
329
- alignItems: "stretch",
330
- children: [
331
- /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Table.Root, {
332
- rows: results,
333
- headers: tableHeaders,
334
- isLoading: isFetching,
318
+ startActions: /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
319
+ children: [
320
+ list.settings.searchable && /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.SearchInput, {
321
+ disabled: results.length === 0,
322
+ label: formatMessage({
323
+ id: 'app.component.search.label',
324
+ defaultMessage: 'Search for {target}'
325
+ }, {
326
+ target: contentTypeTitle
327
+ }),
328
+ placeholder: formatMessage({
329
+ id: 'global.search',
330
+ defaultMessage: 'Search'
331
+ }),
332
+ trackedEvent: "didSearch"
333
+ }),
334
+ list.settings.filterable && schema ? /*#__PURE__*/ jsxRuntime.jsx(Filters.Filters, {
335
+ disabled: results.length === 0,
336
+ schema: schema
337
+ }) : null
338
+ ]
339
+ })
340
+ }),
341
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Layouts.Content, {
342
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
343
+ gap: 4,
344
+ direction: "column",
345
+ alignItems: "stretch",
335
346
  children: [
336
- /*#__PURE__*/ jsxRuntime.jsx(TableActionsBar, {}),
337
- /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Table.Content, {
347
+ /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Table.Root, {
348
+ rows: results,
349
+ headers: tableHeaders,
350
+ isLoading: isFetching,
338
351
  children: [
339
- /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Table.Head, {
352
+ /*#__PURE__*/ jsxRuntime.jsx(TableActionsBar, {}),
353
+ /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Table.Content, {
340
354
  children: [
341
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.HeaderCheckboxCell, {}),
342
- tableHeaders.map((header)=>/*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.HeaderCell, {
343
- ...header
344
- }, header.name))
345
- ]
346
- }),
347
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Loading, {}),
348
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Empty, {
349
- action: canCreate ? /*#__PURE__*/ jsxRuntime.jsx(CreateButton, {
350
- variant: "secondary"
351
- }) : null
352
- }),
353
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Body, {
354
- children: results.map((row)=>{
355
- return /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Table.Row, {
356
- cursor: "pointer",
357
- onClick: handleRowClick(row.documentId),
355
+ /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Table.Head, {
358
356
  children: [
359
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.CheckboxCell, {
360
- id: row.id
361
- }),
362
- tableHeaders.map(({ cellFormatter, ...header })=>{
363
- if (header.name === 'status') {
364
- const { status } = row;
365
- return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Cell, {
366
- children: /*#__PURE__*/ jsxRuntime.jsx(DocumentStatus.DocumentStatus, {
367
- status: status,
368
- maxWidth: 'min-content'
369
- })
370
- }, header.name);
371
- }
372
- if ([
373
- 'createdBy',
374
- 'updatedBy'
375
- ].includes(header.name.split('.')[0])) {
376
- // Display the users full name
377
- // Some entries doesn't have a user assigned as creator/updater (ex: entries created through content API)
378
- // In this case, we display a dash
379
- return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Cell, {
380
- children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
381
- textColor: "neutral800",
382
- children: row[header.name.split('.')[0]] ? users.getDisplayName(row[header.name.split('.')[0]]) : '-'
383
- })
384
- }, header.name);
385
- }
386
- if (typeof cellFormatter === 'function') {
387
- return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Cell, {
388
- children: cellFormatter(row, header, {
389
- collectionType,
390
- model
357
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.HeaderCheckboxCell, {}),
358
+ tableHeaders.map((header)=>/*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.HeaderCell, {
359
+ ...header
360
+ }, header.name))
361
+ ]
362
+ }),
363
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Loading, {}),
364
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Empty, {
365
+ action: canCreate ? /*#__PURE__*/ jsxRuntime.jsx(CreateButton, {
366
+ variant: "secondary"
367
+ }) : null
368
+ }),
369
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Body, {
370
+ children: results.map((row)=>{
371
+ return /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Table.Row, {
372
+ cursor: "pointer",
373
+ onClick: handleRowClick(row.documentId),
374
+ children: [
375
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.CheckboxCell, {
376
+ id: row.id
377
+ }),
378
+ tableHeaders.map(({ cellFormatter, ...header })=>{
379
+ if (header.name === 'status') {
380
+ const { status } = row;
381
+ return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Cell, {
382
+ children: /*#__PURE__*/ jsxRuntime.jsx(DocumentStatus.DocumentStatus, {
383
+ status: status,
384
+ maxWidth: 'min-content'
385
+ })
386
+ }, header.name);
387
+ }
388
+ if ([
389
+ 'createdBy',
390
+ 'updatedBy'
391
+ ].includes(header.name.split('.')[0])) {
392
+ // Display the users full name
393
+ // Some entries doesn't have a user assigned as creator/updater (ex: entries created through content API)
394
+ // In this case, we display a dash
395
+ return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Cell, {
396
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
397
+ textColor: "neutral800",
398
+ children: row[header.name.split('.')[0]] ? users.getDisplayName(row[header.name.split('.')[0]]) : '-'
399
+ })
400
+ }, header.name);
401
+ }
402
+ if (typeof cellFormatter === 'function') {
403
+ return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Cell, {
404
+ children: cellFormatter(row, header, {
405
+ collectionType,
406
+ model
407
+ })
408
+ }, header.name);
409
+ }
410
+ return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Cell, {
411
+ children: /*#__PURE__*/ jsxRuntime.jsx(CellContent.CellContent, {
412
+ content: row[header.name.split('.')[0]],
413
+ rowId: row.documentId,
414
+ ...header
415
+ })
416
+ }, header.name);
417
+ }),
418
+ /*#__PURE__*/ jsxRuntime.jsx(ActionsCell, {
419
+ onClick: (e)=>e.stopPropagation(),
420
+ children: /*#__PURE__*/ jsxRuntime.jsx(TableActions.TableActions, {
421
+ document: row
391
422
  })
392
- }, header.name);
393
- }
394
- return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Cell, {
395
- children: /*#__PURE__*/ jsxRuntime.jsx(CellContent.CellContent, {
396
- content: row[header.name.split('.')[0]],
397
- rowId: row.documentId,
398
- ...header
399
423
  })
400
- }, header.name);
401
- }),
402
- /*#__PURE__*/ jsxRuntime.jsx(ActionsCell, {
403
- onClick: (e)=>e.stopPropagation(),
404
- children: /*#__PURE__*/ jsxRuntime.jsx(TableActions.TableActions, {
405
- document: row
406
- })
407
- })
408
- ]
409
- }, row.id);
410
- })
424
+ ]
425
+ }, row.id);
426
+ })
427
+ })
428
+ ]
411
429
  })
412
430
  ]
431
+ }),
432
+ /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Pagination.Root, {
433
+ ...pagination,
434
+ onPageSizeChange: ()=>trackUsage('willChangeNumberOfEntriesPerPage'),
435
+ children: [
436
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, {}),
437
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
438
+ ]
413
439
  })
414
440
  ]
415
- }),
416
- /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Pagination.Root, {
417
- ...pagination,
418
- onPageSizeChange: ()=>trackUsage('willChangeNumberOfEntriesPerPage'),
419
- children: [
420
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, {}),
421
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
422
- ]
423
441
  })
424
- ]
425
- })
442
+ })
443
+ ]
426
444
  })
427
445
  ]
428
446
  });