@strapi/content-manager 0.0.0-next.e50ef5e2ea57ecf3da5bcf308508b51ee3c0deca → 0.0.0-next.e5d4b412da0d932b61b2fa5012d16513fda6de04

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 (150) 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 +45 -8
  10. package/dist/admin/index.js.map +1 -1
  11. package/dist/admin/index.mjs +46 -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 +11 -5
  18. package/dist/admin/pages/EditView/EditViewPage.js.map +1 -1
  19. package/dist/admin/pages/EditView/EditViewPage.mjs +13 -7
  20. package/dist/admin/pages/EditView/EditViewPage.mjs.map +1 -1
  21. package/dist/admin/pages/EditView/components/DocumentActions.js +18 -3
  22. package/dist/admin/pages/EditView/components/DocumentActions.js.map +1 -1
  23. package/dist/admin/pages/EditView/components/DocumentActions.mjs +19 -4
  24. package/dist/admin/pages/EditView/components/DocumentActions.mjs.map +1 -1
  25. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js +4 -1
  26. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js.map +1 -1
  27. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs +4 -1
  28. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs.map +1 -1
  29. package/dist/admin/pages/EditView/utils/data.js +7 -1
  30. package/dist/admin/pages/EditView/utils/data.js.map +1 -1
  31. package/dist/admin/pages/EditView/utils/data.mjs +7 -1
  32. package/dist/admin/pages/EditView/utils/data.mjs.map +1 -1
  33. package/dist/admin/pages/ListView/ListViewPage.js +152 -143
  34. package/dist/admin/pages/ListView/ListViewPage.js.map +1 -1
  35. package/dist/admin/pages/ListView/ListViewPage.mjs +153 -144
  36. package/dist/admin/pages/ListView/ListViewPage.mjs.map +1 -1
  37. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.js +12 -2
  38. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.js.map +1 -1
  39. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.mjs +12 -2
  40. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.mjs.map +1 -1
  41. package/dist/admin/pages/ListView/components/Filters.js +3 -1
  42. package/dist/admin/pages/ListView/components/Filters.js.map +1 -1
  43. package/dist/admin/pages/ListView/components/Filters.mjs +3 -1
  44. package/dist/admin/pages/ListView/components/Filters.mjs.map +1 -1
  45. package/dist/admin/preview/components/PreviewSidePanel.js +31 -4
  46. package/dist/admin/preview/components/PreviewSidePanel.js.map +1 -1
  47. package/dist/admin/preview/components/PreviewSidePanel.mjs +32 -5
  48. package/dist/admin/preview/components/PreviewSidePanel.mjs.map +1 -1
  49. package/dist/admin/preview/pages/Preview.js +136 -35
  50. package/dist/admin/preview/pages/Preview.js.map +1 -1
  51. package/dist/admin/preview/pages/Preview.mjs +137 -36
  52. package/dist/admin/preview/pages/Preview.mjs.map +1 -1
  53. package/dist/admin/preview/utils/constants.js +21 -0
  54. package/dist/admin/preview/utils/constants.js.map +1 -0
  55. package/dist/admin/preview/utils/constants.mjs +19 -0
  56. package/dist/admin/preview/utils/constants.mjs.map +1 -0
  57. package/dist/admin/preview/utils/previewScript.js +203 -0
  58. package/dist/admin/preview/utils/previewScript.js.map +1 -0
  59. package/dist/admin/preview/utils/previewScript.mjs +201 -0
  60. package/dist/admin/preview/utils/previewScript.mjs.map +1 -0
  61. package/dist/admin/services/api.js +3 -1
  62. package/dist/admin/services/api.js.map +1 -1
  63. package/dist/admin/services/api.mjs +3 -1
  64. package/dist/admin/services/api.mjs.map +1 -1
  65. package/dist/admin/services/documents.js +40 -14
  66. package/dist/admin/services/documents.js.map +1 -1
  67. package/dist/admin/services/documents.mjs +40 -14
  68. package/dist/admin/services/documents.mjs.map +1 -1
  69. package/dist/admin/src/components/Widgets.d.ts +2 -1
  70. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  71. package/dist/admin/src/preview/services/preview.d.ts +1 -1
  72. package/dist/admin/src/preview/utils/constants.d.ts +17 -0
  73. package/dist/admin/src/preview/utils/previewScript.d.ts +18 -0
  74. package/dist/admin/src/services/api.d.ts +1 -1
  75. package/dist/admin/src/services/components.d.ts +2 -2
  76. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  77. package/dist/admin/src/services/documents.d.ts +16 -16
  78. package/dist/admin/src/services/homepage.d.ts +1 -1
  79. package/dist/admin/src/services/init.d.ts +1 -1
  80. package/dist/admin/src/services/relations.d.ts +2 -2
  81. package/dist/admin/src/services/uid.d.ts +3 -3
  82. package/dist/admin/src/utils/api.d.ts +1 -1
  83. package/dist/admin/translations/en.json.js +6 -0
  84. package/dist/admin/translations/en.json.js.map +1 -1
  85. package/dist/admin/translations/en.json.mjs +6 -0
  86. package/dist/admin/translations/en.json.mjs.map +1 -1
  87. package/dist/admin/translations/es.json.js +5 -2
  88. package/dist/admin/translations/es.json.js.map +1 -1
  89. package/dist/admin/translations/es.json.mjs +5 -2
  90. package/dist/admin/translations/es.json.mjs.map +1 -1
  91. package/dist/admin/translations/fr.json.js +4 -1
  92. package/dist/admin/translations/fr.json.js.map +1 -1
  93. package/dist/admin/translations/fr.json.mjs +4 -1
  94. package/dist/admin/translations/fr.json.mjs.map +1 -1
  95. package/dist/admin/utils/api.js +1 -1
  96. package/dist/admin/utils/api.js.map +1 -1
  97. package/dist/admin/utils/api.mjs +1 -1
  98. package/dist/admin/utils/api.mjs.map +1 -1
  99. package/dist/admin/utils/validation.js +2 -1
  100. package/dist/admin/utils/validation.js.map +1 -1
  101. package/dist/admin/utils/validation.mjs +2 -1
  102. package/dist/admin/utils/validation.mjs.map +1 -1
  103. package/dist/server/history/services/lifecycles.js +20 -19
  104. package/dist/server/history/services/lifecycles.js.map +1 -1
  105. package/dist/server/history/services/lifecycles.mjs +20 -19
  106. package/dist/server/history/services/lifecycles.mjs.map +1 -1
  107. package/dist/server/homepage/controllers/homepage.js +5 -0
  108. package/dist/server/homepage/controllers/homepage.js.map +1 -1
  109. package/dist/server/homepage/controllers/homepage.mjs +5 -0
  110. package/dist/server/homepage/controllers/homepage.mjs.map +1 -1
  111. package/dist/server/homepage/routes/homepage.js +11 -0
  112. package/dist/server/homepage/routes/homepage.js.map +1 -1
  113. package/dist/server/homepage/routes/homepage.mjs +11 -0
  114. package/dist/server/homepage/routes/homepage.mjs.map +1 -1
  115. package/dist/server/homepage/services/homepage.js +31 -0
  116. package/dist/server/homepage/services/homepage.js.map +1 -1
  117. package/dist/server/homepage/services/homepage.mjs +31 -0
  118. package/dist/server/homepage/services/homepage.mjs.map +1 -1
  119. package/dist/server/preview/services/preview-config.js +5 -1
  120. package/dist/server/preview/services/preview-config.js.map +1 -1
  121. package/dist/server/preview/services/preview-config.mjs +5 -1
  122. package/dist/server/preview/services/preview-config.mjs.map +1 -1
  123. package/dist/server/preview/services/preview.js +4 -0
  124. package/dist/server/preview/services/preview.js.map +1 -1
  125. package/dist/server/preview/services/preview.mjs +4 -0
  126. package/dist/server/preview/services/preview.mjs.map +1 -1
  127. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  128. package/dist/server/src/homepage/controllers/homepage.d.ts +2 -1
  129. package/dist/server/src/homepage/controllers/homepage.d.ts.map +1 -1
  130. package/dist/server/src/homepage/index.d.ts +5 -0
  131. package/dist/server/src/homepage/index.d.ts.map +1 -1
  132. package/dist/server/src/homepage/routes/homepage.d.ts.map +1 -1
  133. package/dist/server/src/homepage/services/homepage.d.ts +2 -1
  134. package/dist/server/src/homepage/services/homepage.d.ts.map +1 -1
  135. package/dist/server/src/homepage/services/index.d.ts +5 -0
  136. package/dist/server/src/homepage/services/index.d.ts.map +1 -1
  137. package/dist/server/src/index.d.ts +5 -0
  138. package/dist/server/src/index.d.ts.map +1 -1
  139. package/dist/server/src/preview/services/index.d.ts +1 -0
  140. package/dist/server/src/preview/services/index.d.ts.map +1 -1
  141. package/dist/server/src/preview/services/preview-config.d.ts +1 -0
  142. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -1
  143. package/dist/server/src/preview/services/preview.d.ts.map +1 -1
  144. package/dist/server/src/preview/utils.d.ts +1 -0
  145. package/dist/server/src/preview/utils.d.ts.map +1 -1
  146. package/dist/server/src/services/index.d.ts +5 -0
  147. package/dist/server/src/services/index.d.ts.map +1 -1
  148. package/dist/shared/contracts/homepage.d.ts +13 -0
  149. package/dist/shared/contracts/homepage.d.ts.map +1 -1
  150. 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,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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A,IAAI,CAACc,KAAAA,CAAMC,OAAO,CAACwC,YAAe,CAAA,EAAA;gBAChCf,MAAM,CAACC,QAAS,CAAA,GAAG,EAAE;AACrB,gBAAA;AACF;AAEAD,YAAAA,MAAM,CAACC,QAAS,CAAA,GAAGc,aAAapD,GAAG,CAAC,CAACwD,MAAQxC,EAAAA,KAAAA,GAAAA;AAC3C,gBAAA,MAAMyC,UAAUD,MAAQpD,EAAAA,WAAAA;gBACxB,MAAMkD,UAAAA,GAAavE,UAAU,CAAC0E,OAAQ,CAAA;gBAEtC,MAAMC,OAAAA,GAAU3B,0BACdyB,MACA,EAAA;oBACE1E,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;gBAEN,OAAO;oBACLoB,WAAaqD,EAAAA,OAAAA;AACb,oBAAA,GAAGC;AACL,iBAAA;AACF,aAAA,CAAA;AAEA,YAAA;AACF;;AAGA,QAAA,IAAIN,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;;;;"}
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,YAA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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;;;;"}
@@ -197,10 +197,8 @@ const ListViewPage = ()=>{
197
197
  if (!isFetching && results.length === 0) {
198
198
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
199
199
  children: [
200
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.unstable_tours.contentManager.Introduction, {
201
- children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
202
- paddingTop: 5
203
- })
200
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.tours.contentManager.Introduction, {
201
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {})
204
202
  }),
205
203
  /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Page.Main, {
206
204
  children: [
@@ -208,7 +206,9 @@ const ListViewPage = ()=>{
208
206
  children: `${contentTypeTitle}`
209
207
  }),
210
208
  /*#__PURE__*/ jsxRuntime.jsx(LayoutsHeaderCustom, {
211
- primaryAction: canCreate ? /*#__PURE__*/ jsxRuntime.jsx(CreateButton, {}) : null,
209
+ primaryAction: canCreate ? /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.tours.contentManager.CreateNewEntry, {
210
+ children: /*#__PURE__*/ jsxRuntime.jsx(CreateButton, {})
211
+ }) : null,
212
212
  subtitle: formatMessage({
213
213
  id: translations.getTranslation('pages.ListView.header-subtitle'),
214
214
  defaultMessage: '{number, plural, =0 {# entries} one {# entry} other {# entries}} found'
@@ -279,159 +279,168 @@ const ListViewPage = ()=>{
279
279
  ]
280
280
  });
281
281
  }
282
- return /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Page.Main, {
282
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
283
283
  children: [
284
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Page.Title, {
285
- children: `${contentTypeTitle}`
286
- }),
287
- /*#__PURE__*/ jsxRuntime.jsx(LayoutsHeaderCustom, {
288
- primaryAction: canCreate ? /*#__PURE__*/ jsxRuntime.jsx(CreateButton, {}) : null,
289
- subtitle: formatMessage({
290
- id: translations.getTranslation('pages.ListView.header-subtitle'),
291
- defaultMessage: '{number, plural, =0 {# entries} one {# entry} other {# entries}} found'
292
- }, {
293
- number: pagination?.total
294
- }),
295
- title: contentTypeTitle,
296
- navigationAction: /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.BackButton, {})
284
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.tours.contentManager.Introduction, {
285
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {})
297
286
  }),
298
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Layouts.Action, {
299
- endActions: /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
300
- children: [
301
- /*#__PURE__*/ jsxRuntime.jsx(InjectionZone.InjectionZone, {
302
- 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
303
301
  }),
304
- /*#__PURE__*/ jsxRuntime.jsx(ViewSettingsMenu.ViewSettingsMenu, {
305
- setHeaders: handleSetHeaders,
306
- resetHeaders: ()=>setDisplayedHeaders(list.layout),
307
- headers: displayedHeaders.map((header)=>header.name)
308
- })
309
- ]
310
- }),
311
- startActions: /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
312
- children: [
313
- list.settings.searchable && /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.SearchInput, {
314
- disabled: results.length === 0,
315
- label: formatMessage({
316
- id: 'app.component.search.label',
317
- defaultMessage: 'Search for {target}'
318
- }, {
319
- target: contentTypeTitle
320
- }),
321
- placeholder: formatMessage({
322
- id: 'global.search',
323
- defaultMessage: 'Search'
324
- }),
325
- 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
+ ]
326
317
  }),
327
- list.settings.filterable && schema ? /*#__PURE__*/ jsxRuntime.jsx(Filters.Filters, {
328
- disabled: results.length === 0,
329
- schema: schema
330
- }) : null
331
- ]
332
- })
333
- }),
334
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Layouts.Content, {
335
- children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
336
- gap: 4,
337
- direction: "column",
338
- alignItems: "stretch",
339
- children: [
340
- /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Table.Root, {
341
- rows: results,
342
- headers: tableHeaders,
343
- isLoading: isFetching,
318
+ startActions: /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
344
319
  children: [
345
- /*#__PURE__*/ jsxRuntime.jsx(TableActionsBar, {}),
346
- /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Table.Content, {
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",
346
+ children: [
347
+ /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Table.Root, {
348
+ rows: results,
349
+ headers: tableHeaders,
350
+ isLoading: isFetching,
347
351
  children: [
348
- /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Table.Head, {
352
+ /*#__PURE__*/ jsxRuntime.jsx(TableActionsBar, {}),
353
+ /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Table.Content, {
349
354
  children: [
350
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.HeaderCheckboxCell, {}),
351
- tableHeaders.map((header)=>/*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.HeaderCell, {
352
- ...header
353
- }, header.name))
354
- ]
355
- }),
356
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Loading, {}),
357
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Empty, {
358
- action: canCreate ? /*#__PURE__*/ jsxRuntime.jsx(CreateButton, {
359
- variant: "secondary"
360
- }) : null
361
- }),
362
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Body, {
363
- children: results.map((row)=>{
364
- return /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Table.Row, {
365
- cursor: "pointer",
366
- onClick: handleRowClick(row.documentId),
355
+ /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Table.Head, {
367
356
  children: [
368
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.CheckboxCell, {
369
- id: row.id
370
- }),
371
- tableHeaders.map(({ cellFormatter, ...header })=>{
372
- if (header.name === 'status') {
373
- const { status } = row;
374
- return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Cell, {
375
- children: /*#__PURE__*/ jsxRuntime.jsx(DocumentStatus.DocumentStatus, {
376
- status: status,
377
- maxWidth: 'min-content'
378
- })
379
- }, header.name);
380
- }
381
- if ([
382
- 'createdBy',
383
- 'updatedBy'
384
- ].includes(header.name.split('.')[0])) {
385
- // Display the users full name
386
- // Some entries doesn't have a user assigned as creator/updater (ex: entries created through content API)
387
- // In this case, we display a dash
388
- return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Cell, {
389
- children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
390
- textColor: "neutral800",
391
- children: row[header.name.split('.')[0]] ? users.getDisplayName(row[header.name.split('.')[0]]) : '-'
392
- })
393
- }, header.name);
394
- }
395
- if (typeof cellFormatter === 'function') {
396
- return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Cell, {
397
- children: cellFormatter(row, header, {
398
- collectionType,
399
- 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
400
422
  })
401
- }, header.name);
402
- }
403
- return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Cell, {
404
- children: /*#__PURE__*/ jsxRuntime.jsx(CellContent.CellContent, {
405
- content: row[header.name.split('.')[0]],
406
- rowId: row.documentId,
407
- ...header
408
423
  })
409
- }, header.name);
410
- }),
411
- /*#__PURE__*/ jsxRuntime.jsx(ActionsCell, {
412
- onClick: (e)=>e.stopPropagation(),
413
- children: /*#__PURE__*/ jsxRuntime.jsx(TableActions.TableActions, {
414
- document: row
415
- })
416
- })
417
- ]
418
- }, row.id);
419
- })
424
+ ]
425
+ }, row.id);
426
+ })
427
+ })
428
+ ]
420
429
  })
421
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
+ ]
422
439
  })
423
440
  ]
424
- }),
425
- /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Pagination.Root, {
426
- ...pagination,
427
- onPageSizeChange: ()=>trackUsage('willChangeNumberOfEntriesPerPage'),
428
- children: [
429
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, {}),
430
- /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
431
- ]
432
441
  })
433
- ]
434
- })
442
+ })
443
+ ]
435
444
  })
436
445
  ]
437
446
  });