@strapi/content-manager 5.39.0 → 5.40.0

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 (68) hide show
  1. package/dist/admin/hooks/useDocument.js +21 -5
  2. package/dist/admin/hooks/useDocument.js.map +1 -1
  3. package/dist/admin/hooks/useDocument.mjs +22 -6
  4. package/dist/admin/hooks/useDocument.mjs.map +1 -1
  5. package/dist/admin/pages/EditView/components/DocumentActions.js +1 -0
  6. package/dist/admin/pages/EditView/components/DocumentActions.js.map +1 -1
  7. package/dist/admin/pages/EditView/components/DocumentActions.mjs +3 -2
  8. package/dist/admin/pages/EditView/components/DocumentActions.mjs.map +1 -1
  9. package/dist/admin/pages/EditView/components/FormInputs/Component/Input.mjs +4 -4
  10. package/dist/admin/pages/EditView/components/FormInputs/Component/Input.mjs.map +1 -1
  11. package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.js +71 -44
  12. package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.js.map +1 -1
  13. package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.mjs +54 -46
  14. package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.mjs.map +1 -1
  15. package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.js +107 -88
  16. package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.js.map +1 -1
  17. package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.mjs +109 -90
  18. package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.mjs.map +1 -1
  19. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js +91 -106
  20. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js.map +1 -1
  21. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs +94 -109
  22. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs.map +1 -1
  23. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js +43 -23
  24. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js.map +1 -1
  25. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs +45 -25
  26. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs.map +1 -1
  27. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs +2 -2
  28. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js +30 -19
  29. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js.map +1 -1
  30. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs +34 -23
  31. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs.map +1 -1
  32. package/dist/admin/pages/EditView/components/FormInputs/UID.mjs +1 -1
  33. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.mjs +1 -1
  34. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.mjs +1 -1
  35. package/dist/admin/pages/EditView/components/FormLayout.js +23 -3
  36. package/dist/admin/pages/EditView/components/FormLayout.js.map +1 -1
  37. package/dist/admin/pages/EditView/components/FormLayout.mjs +4 -3
  38. package/dist/admin/pages/EditView/components/FormLayout.mjs.map +1 -1
  39. package/dist/admin/pages/EditView/components/Header.js +3 -0
  40. package/dist/admin/pages/EditView/components/Header.js.map +1 -1
  41. package/dist/admin/pages/EditView/components/Header.mjs +3 -0
  42. package/dist/admin/pages/EditView/components/Header.mjs.map +1 -1
  43. package/dist/admin/pages/EditView/components/InputRenderer.js +19 -7
  44. package/dist/admin/pages/EditView/components/InputRenderer.js.map +1 -1
  45. package/dist/admin/pages/EditView/components/InputRenderer.mjs +20 -8
  46. package/dist/admin/pages/EditView/components/InputRenderer.mjs.map +1 -1
  47. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.js +11 -15
  48. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.js.map +1 -1
  49. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.mjs +11 -16
  50. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.mjs.map +1 -1
  51. package/dist/admin/src/pages/EditView/components/FormInputs/Component/NonRepeatable.d.ts +3 -2
  52. package/dist/admin/src/pages/EditView/components/FormInputs/Component/Repeatable.d.ts +3 -2
  53. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.d.ts +3 -3
  54. package/dist/admin/src/pages/EditView/components/FormLayout.d.ts +1 -1
  55. package/dist/admin/src/pages/EditView/components/InputRenderer.d.ts +1 -1
  56. package/dist/admin/src/pages/ListView/components/BulkActions/PublishAction.d.ts +3 -0
  57. package/dist/admin/src/pages/ListView/components/Filters.d.ts +3 -0
  58. package/dist/server/services/utils/draft.js +8 -1
  59. package/dist/server/services/utils/draft.js.map +1 -1
  60. package/dist/server/services/utils/draft.mjs +8 -1
  61. package/dist/server/services/utils/draft.mjs.map +1 -1
  62. package/dist/server/services/utils/populate.js +16 -1
  63. package/dist/server/services/utils/populate.js.map +1 -1
  64. package/dist/server/services/utils/populate.mjs +16 -1
  65. package/dist/server/services/utils/populate.mjs.map +1 -1
  66. package/dist/server/src/services/utils/draft.d.ts.map +1 -1
  67. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  68. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"InputRenderer.js","sources":["../../../../../admin/src/pages/EditView/components/InputRenderer.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n useStrapiApp,\n useForm,\n InputRenderer as FormInputRenderer,\n useField,\n createRulesEngine,\n type JsonLogicCondition,\n} from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\n\nimport { SINGLE_TYPES } from '../../../constants/collections';\nimport { useDocumentRBAC } from '../../../features/DocumentRBAC';\nimport { type UseDocument } from '../../../hooks/useDocument';\nimport { useDocumentContext } from '../../../hooks/useDocumentContext';\nimport { useDocumentLayout } from '../../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../../hooks/useLazyComponents';\nimport { useHasInputPopoverParent } from '../../../preview/components/InputPopover';\nimport { usePreviewInputManager } from '../../../preview/hooks/usePreviewInputManager';\nimport {\n getConditionDependencyPaths,\n getConditionDependencySubscriptionValue,\n} from '../../../utils/conditionalFields';\nimport { getDirectParent } from '../utils/data';\n\nimport { BlocksInput } from './FormInputs/BlocksInput/BlocksInput';\nimport { ComponentInput } from './FormInputs/Component/Input';\nimport { DynamicZone, useDynamicZone } from './FormInputs/DynamicZone/Field';\nimport { NotAllowedInput } from './FormInputs/NotAllowed';\nimport { RelationsInput } from './FormInputs/Relations/Relations';\nimport { UIDInput } from './FormInputs/UID';\nimport { Wysiwyg } from './FormInputs/Wysiwyg/Field';\n\nimport type { EditFieldLayout } from '../../../hooks/useDocumentLayout';\nimport type { Schema } from '@strapi/types';\nimport type { DistributiveOmit } from 'react-redux';\n\ntype InputRendererProps = DistributiveOmit<EditFieldLayout, 'size'> & {\n document: ReturnType<UseDocument>;\n};\n\n/**\n * @internal\n *\n * @description An abstraction around the regular form input renderer designed\n * specifically to be used in the EditView of the content-manager this understands\n * the complete EditFieldLayout and will handle RBAC conditions and rendering CM specific\n * components such as Blocks / Relations.\n */\nconst BaseInputRenderer = ({\n visible,\n hint: providedHint,\n document,\n ...inputProps\n}: InputRendererProps) => {\n const localeKey = document?.document?.locale || 'default';\n const { currentDocumentMeta } = useDocumentContext('DynamicComponent');\n const {\n edit: { components },\n } = useDocumentLayout(currentDocumentMeta.model);\n\n const collectionType =\n document.schema?.kind === 'collectionType' ? 'collection-types' : 'single-types';\n\n const isInDynamicZone = useDynamicZone('isInDynamicZone', (state) => state.isInDynamicZone);\n const isInPreviewPopover = useHasInputPopoverParent();\n const shouldIgnorePermissions = isInDynamicZone || isInPreviewPopover;\n\n const isFormDisabled = useForm('InputRenderer', (state) => state.disabled);\n const canCreateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canCreateFields);\n const canReadFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canReadFields);\n const canUpdateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUpdateFields);\n const canUserAction = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUserAction);\n\n let idToCheck = document.document?.documentId;\n if (collectionType === SINGLE_TYPES) {\n idToCheck = document?.document?.documentId;\n }\n\n const editableFields = idToCheck ? canUpdateFields : canCreateFields;\n const readableFields = idToCheck ? canReadFields : canCreateFields;\n\n // Everything preview related\n const previewProps = usePreviewInputManager(inputProps.name, inputProps.attribute);\n const props = { ...inputProps, ...previewProps };\n\n /**\n * Component fields are always readable and editable,\n * however the fields within them may not be.\n */\n const canUserReadField = canUserAction(props.name, readableFields, props.type);\n const canUserEditField = canUserAction(props.name, editableFields, props.type);\n\n const fields = useStrapiApp('InputRenderer', (app) => app.fields);\n const { lazyComponentStore } = useLazyComponents(\n attributeHasCustomFieldProperty(props.attribute) ? [props.attribute.customField] : undefined\n );\n\n const hint = useFieldHint(providedHint, props.attribute);\n\n // We pass field in case of Custom Fields to keep backward compatibility\n const field = useField(props.name);\n\n if (!visible) {\n return null;\n }\n\n /**\n * If the user can't read the field then we don't want to ever render it.\n */\n if (!canUserReadField && !shouldIgnorePermissions) {\n return <NotAllowedInput hint={hint} {...props} />;\n }\n\n const fieldIsDisabled =\n (!canUserEditField && !shouldIgnorePermissions) || props.disabled || isFormDisabled;\n\n /**\n * Because a custom field has a unique prop but the type could be confused with either\n * the useField hook or the type of the field we need to handle it separately and first.\n */\n if (attributeHasCustomFieldProperty(props.attribute)) {\n const CustomInput = lazyComponentStore[props.attribute.customField];\n\n if (CustomInput) {\n return (\n <CustomInput\n {...props}\n {...field}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n return (\n <FormInputRenderer\n key={`input-${props.name}-${localeKey}`}\n {...props}\n {...previewProps}\n hint={hint}\n // @ts-expect-error – this workaround lets us display that the custom field is missing.\n type={props.attribute.customField}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * This is where we handle ONLY the fields from the `useLibrary` hook.\n */\n const addedInputTypes = Object.keys(fields);\n if (!attributeHasCustomFieldProperty(props.attribute) && addedInputTypes.includes(props.type)) {\n const CustomInput = fields[props.type];\n return (\n <CustomInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * These include the content-manager specific fields, failing that we fall back\n * to the more generic form input renderer.\n */\n switch (props.type) {\n case 'blocks':\n return (\n <BlocksInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n type={props.type}\n disabled={fieldIsDisabled}\n />\n );\n case 'component':\n return (\n <ComponentInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n layout={components[props.attribute.component].layout}\n disabled={fieldIsDisabled}\n >\n {(componentInputProps) => (\n <MemoizedInputRenderer\n key={`input-${componentInputProps.name}-${localeKey}`}\n {...componentInputProps}\n />\n )}\n </ComponentInput>\n );\n case 'dynamiczone':\n return (\n <DynamicZone\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n case 'relation':\n return (\n <RelationsInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n case 'richtext':\n return (\n <Wysiwyg\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n type={props.type}\n disabled={fieldIsDisabled}\n />\n );\n case 'uid':\n // These props are not needed for the generic form input renderer.\n const { unique: _uniqueUID, ...restUIDProps } = props;\n return (\n <UIDInput\n key={`input-${props.name}-${localeKey}`}\n {...restUIDProps}\n hint={hint}\n type={props.type}\n disabled={fieldIsDisabled}\n />\n );\n /**\n * Enumerations are a special case because they require options.\n */\n case 'enumeration':\n return (\n <FormInputRenderer\n key={`input-${props.name}-${localeKey}`}\n {...props}\n {...previewProps}\n hint={hint}\n options={props.attribute.enum.map((value) => ({ value }))}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n default:\n // These props are not needed for the generic form input renderer.\n const { unique: _unique, mainField: _mainField, ...restProps } = props;\n return (\n <FormInputRenderer\n key={`input-${props.name}-${localeKey}`}\n {...restProps}\n {...previewProps}\n hint={hint}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n }\n};\n\n// Reuse one rules engine instance instead of recreating it for every field render.\nconst rulesEngine = createRulesEngine();\n\n/**\n * A wrapper around BaseInputRenderer that conditionally renders it depending on the attribute's condition.\n */\nconst ConditionAwareInputRenderer = ({\n condition,\n ...props\n}: InputRendererProps & { condition: JsonLogicCondition }) => {\n // Extract only the field paths the visibility rule depends on so unrelated form changes\n // do not force this conditional field to re-render.\n const conditionDependencyPaths = React.useMemo(\n () => getConditionDependencyPaths(condition),\n [condition]\n );\n const getValues = useForm(\n 'ConditionalInputRenderer',\n (state) => (state as typeof state & { getValues: () => unknown }).getValues\n );\n const conditionSubscriptionValue = useForm('ConditionalInputRenderer', (state) => {\n // Subscribe to a small, comparable snapshot of the parent scope instead of all form values.\n return getConditionDependencySubscriptionValue(\n getDirectParent(state.values, props.name),\n conditionDependencyPaths\n );\n });\n\n // When dependencies are known, read the latest parent scope lazily via getValues() so the\n // rule still evaluates against fresh data without subscribing to every form change.\n const targetValues =\n conditionDependencyPaths === null\n ? conditionSubscriptionValue\n : getDirectParent(getValues(), props.name);\n\n const isVisible = rulesEngine.evaluate(condition, targetValues);\n\n if (!isVisible) {\n return null;\n }\n\n return <BaseInputRenderer {...props} />;\n};\n\nconst attributeHasCustomFieldProperty = (\n attribute: Schema.Attribute.AnyAttribute\n): attribute is Schema.Attribute.AnyAttribute & Schema.Attribute.CustomField<string> =>\n 'customField' in attribute && typeof attribute.customField === 'string';\n\nconst useFieldHint = (\n hint: React.ReactNode = undefined,\n attribute: Schema.Attribute.AnyAttribute\n) => {\n const { formatMessage } = useIntl();\n\n const { maximum, minimum } = getMinMax(attribute);\n\n if (!maximum && !minimum) {\n return hint;\n }\n\n const units = ['string', 'uid', 'richtext', 'email', 'password', 'text'].includes(attribute.type)\n ? formatMessage(\n {\n id: 'content-manager.form.Input.hint.character.unit',\n defaultMessage: '{maxValue, plural, one { character} other { characters}}',\n },\n {\n maxValue: Math.max(minimum || 0, maximum || 0),\n }\n )\n : null;\n\n const hasMinAndMax = typeof minimum === 'number' && typeof maximum === 'number';\n\n return formatMessage(\n {\n id: 'content-manager.form.Input.hint.text',\n defaultMessage:\n '{min, select, undefined {} other {min. {min}}}{divider}{max, select, undefined {} other {max. {max}}}{unit}{br}{description}',\n },\n {\n min: minimum,\n max: maximum,\n description: hint,\n unit: units,\n divider: hasMinAndMax\n ? formatMessage({\n id: 'content-manager.form.Input.hint.minMaxDivider',\n defaultMessage: ' / ',\n })\n : null,\n br: <br />,\n }\n );\n};\n\nconst getMinMax = (attribute: Schema.Attribute.AnyAttribute) => {\n if ('min' in attribute || 'max' in attribute) {\n return {\n maximum: !Number.isNaN(Number(attribute.max)) ? Number(attribute.max) : undefined,\n minimum: !Number.isNaN(Number(attribute.min)) ? Number(attribute.min) : undefined,\n };\n } else if ('maxLength' in attribute || 'minLength' in attribute) {\n return { maximum: attribute.maxLength, minimum: attribute.minLength };\n } else {\n return { maximum: undefined, minimum: undefined };\n }\n};\n\n/**\n * Conditionally routes the exported InputRender component towards ConditionalInputRenderer\n * (when there's a JSON logic condition on the attribute, or BaseInputRenderer otherwise.\n * We do this because rendering a conditional field requires access to the values of\n * other form fields, which causes many re-renders and performance issues on complex content\n * types. By splitting the component into two, we isolate the performance issue to\n * conditional fields only, not all edit view fields.\n */\nconst MemoizedInputRenderer = React.memo((props: InputRendererProps) => {\n const condition = props.attribute.conditions?.visible;\n if (condition) {\n return <ConditionAwareInputRenderer {...props} condition={condition} />;\n }\n\n return <BaseInputRenderer {...props} />;\n});\n\nexport type { InputRendererProps };\nexport { MemoizedInputRenderer as InputRenderer, useFieldHint };\n"],"names":["BaseInputRenderer","visible","hint","providedHint","document","inputProps","localeKey","locale","currentDocumentMeta","useDocumentContext","edit","components","useDocumentLayout","model","collectionType","schema","kind","isInDynamicZone","useDynamicZone","state","isInPreviewPopover","useHasInputPopoverParent","shouldIgnorePermissions","isFormDisabled","useForm","disabled","canCreateFields","useDocumentRBAC","rbac","canReadFields","canUpdateFields","canUserAction","idToCheck","documentId","SINGLE_TYPES","editableFields","readableFields","previewProps","usePreviewInputManager","name","attribute","props","canUserReadField","type","canUserEditField","fields","useStrapiApp","app","lazyComponentStore","useLazyComponents","attributeHasCustomFieldProperty","customField","undefined","useFieldHint","field","useField","_jsx","NotAllowedInput","fieldIsDisabled","CustomInput","FormInputRenderer","addedInputTypes","Object","keys","includes","BlocksInput","ComponentInput","layout","component","componentInputProps","MemoizedInputRenderer","DynamicZone","RelationsInput","Wysiwyg","unique","_uniqueUID","restUIDProps","UIDInput","options","enum","map","value","_unique","mainField","_mainField","restProps","rulesEngine","createRulesEngine","ConditionAwareInputRenderer","condition","conditionDependencyPaths","React","useMemo","getConditionDependencyPaths","getValues","conditionSubscriptionValue","getConditionDependencySubscriptionValue","getDirectParent","values","targetValues","isVisible","evaluate","formatMessage","useIntl","maximum","minimum","getMinMax","units","id","defaultMessage","maxValue","Math","max","hasMinAndMax","min","description","unit","divider","br","Number","isNaN","maxLength","minLength","memo","conditions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA;;;;;;;AAOC,IACD,MAAMA,iBAAAA,GAAoB,CAAC,EACzBC,OAAO,EACPC,IAAAA,EAAMC,YAAY,EAClBC,QAAQ,EACR,GAAGC,UAAAA,EACgB,GAAA;IACnB,MAAMC,SAAAA,GAAYF,QAAAA,EAAUA,QAAAA,EAAUG,MAAAA,IAAU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F,KAAAA,GAAAA;AACxC,IAAA,MAAMgD,SAAAA,GAAYhD,KAAAA,CAAMD,SAAS,CAACoF,UAAU,EAAE3H,OAAAA;AAC9C,IAAA,IAAIwF,SAAAA,EAAW;AACb,QAAA,qBAAOjC,cAAA,CAACgC,2BAAAA,EAAAA;AAA6B,YAAA,GAAG/C,KAAK;YAAEgD,SAAAA,EAAWA;;AAC5D,IAAA;AAEA,IAAA,qBAAOjC,cAAA,CAACxD,iBAAAA,EAAAA;AAAmB,QAAA,GAAGyC;;AAChC,CAAA;;;;;"}
1
+ {"version":3,"file":"InputRenderer.js","sources":["../../../../../admin/src/pages/EditView/components/InputRenderer.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n useStrapiApp,\n useForm,\n InputRenderer as FormInputRenderer,\n useField,\n createRulesEngine,\n type JsonLogicCondition,\n} from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\n\nimport { SINGLE_TYPES } from '../../../constants/collections';\nimport { useDocumentRBAC } from '../../../features/DocumentRBAC';\nimport { type UseDocument } from '../../../hooks/useDocument';\nimport { useDocumentContext } from '../../../hooks/useDocumentContext';\nimport { useDocumentLayout } from '../../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../../hooks/useLazyComponents';\nimport { useHasInputPopoverParent } from '../../../preview/components/InputPopover';\nimport { usePreviewInputManager } from '../../../preview/hooks/usePreviewInputManager';\nimport {\n getConditionDependencyPaths,\n getConditionDependencySubscriptionValue,\n} from '../../../utils/conditionalFields';\nimport { getDirectParent } from '../utils/data';\n\nimport { BlocksInput } from './FormInputs/BlocksInput/BlocksInput';\nimport { ComponentInput } from './FormInputs/Component/Input';\nimport { DynamicZone, useDynamicZone } from './FormInputs/DynamicZone/Field';\nimport { NotAllowedInput } from './FormInputs/NotAllowed';\nimport { RelationsInput } from './FormInputs/Relations/Relations';\nimport { UIDInput } from './FormInputs/UID';\nimport { Wysiwyg } from './FormInputs/Wysiwyg/Field';\n\nimport type { EditFieldLayout } from '../../../hooks/useDocumentLayout';\nimport type { Schema } from '@strapi/types';\nimport type { DistributiveOmit } from 'react-redux';\n\ntype InputRendererProps = DistributiveOmit<EditFieldLayout, 'size'> & {\n document?: ReturnType<UseDocument>;\n};\n\n/**\n * @internal\n *\n * @description An abstraction around the regular form input renderer designed\n * specifically to be used in the EditView of the content-manager this understands\n * the complete EditFieldLayout and will handle RBAC conditions and rendering CM specific\n * components such as Blocks / Relations.\n */\nconst BaseInputRenderer = ({\n visible,\n hint: providedHint,\n document: providedDocument,\n ...inputProps\n}: InputRendererProps) => {\n const { currentDocument, currentDocumentMeta } = useDocumentContext('DynamicComponent');\n // Most edit-view fields can read the document from context, which avoids threading a\n // frequently-changing `document` prop through nested component/DZ trees and reduces churn.\n // Keep `providedDocument` as an explicit override for callers outside that default flow.\n const document = providedDocument ?? currentDocument;\n const localeKey = document?.document?.locale || 'default';\n const {\n edit: { components },\n } = useDocumentLayout(currentDocumentMeta.model);\n\n const collectionType =\n document.schema?.kind === 'collectionType' ? 'collection-types' : 'single-types';\n\n const isInDynamicZone = useDynamicZone('isInDynamicZone', (state) => state.isInDynamicZone);\n const isInPreviewPopover = useHasInputPopoverParent();\n const shouldIgnorePermissions = isInDynamicZone || isInPreviewPopover;\n\n const isFormDisabled = useForm('InputRenderer', (state) => state.disabled);\n const canCreateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canCreateFields);\n const canReadFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canReadFields);\n const canUpdateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUpdateFields);\n const canUserAction = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUserAction);\n\n let idToCheck = document.document?.documentId;\n if (collectionType === SINGLE_TYPES) {\n idToCheck = document?.document?.documentId;\n }\n\n const editableFields = idToCheck ? canUpdateFields : canCreateFields;\n const readableFields = idToCheck ? canReadFields : canCreateFields;\n\n // Everything preview related\n const previewProps = usePreviewInputManager(inputProps.name, inputProps.attribute);\n const props = { ...inputProps, ...previewProps };\n\n /**\n * Component fields are always readable and editable,\n * however the fields within them may not be.\n */\n const canUserReadField = canUserAction(props.name, readableFields, props.type);\n const canUserEditField = canUserAction(props.name, editableFields, props.type);\n\n const fields = useStrapiApp('InputRenderer', (app) => app.fields);\n const { lazyComponentStore } = useLazyComponents(\n attributeHasCustomFieldProperty(props.attribute) ? [props.attribute.customField] : undefined\n );\n\n const hint = useFieldHint(providedHint, props.attribute);\n const renderComponentInput = React.useCallback(\n (componentInputProps: InputRendererProps) => (\n <MemoizedInputRenderer\n key={`input-${componentInputProps.name}-${localeKey}`}\n {...componentInputProps}\n />\n ),\n [localeKey]\n );\n\n // We pass field in case of Custom Fields to keep backward compatibility\n const field = useField(props.name);\n\n if (!visible) {\n return null;\n }\n\n /**\n * If the user can't read the field then we don't want to ever render it.\n */\n if (!canUserReadField && !shouldIgnorePermissions) {\n return <NotAllowedInput hint={hint} {...props} />;\n }\n\n const fieldIsDisabled =\n (!canUserEditField && !shouldIgnorePermissions) || props.disabled || isFormDisabled;\n\n /**\n * Because a custom field has a unique prop but the type could be confused with either\n * the useField hook or the type of the field we need to handle it separately and first.\n */\n if (attributeHasCustomFieldProperty(props.attribute)) {\n const CustomInput = lazyComponentStore[props.attribute.customField];\n\n if (CustomInput) {\n return (\n <CustomInput\n {...props}\n {...field}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n return (\n <FormInputRenderer\n key={`input-${props.name}-${localeKey}`}\n {...props}\n {...previewProps}\n hint={hint}\n // @ts-expect-error – this workaround lets us display that the custom field is missing.\n type={props.attribute.customField}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * This is where we handle ONLY the fields from the `useLibrary` hook.\n */\n const addedInputTypes = Object.keys(fields);\n if (!attributeHasCustomFieldProperty(props.attribute) && addedInputTypes.includes(props.type)) {\n const CustomInput = fields[props.type];\n return (\n <CustomInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * These include the content-manager specific fields, failing that we fall back\n * to the more generic form input renderer.\n */\n switch (props.type) {\n case 'blocks':\n return (\n <BlocksInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n type={props.type}\n disabled={fieldIsDisabled}\n />\n );\n case 'component':\n // Preview focus/blur handlers are not used for data-structure roots (component/dynamic zone).\n // Dropping them avoids unstable function props cascading through memoized component trees.\n const { onBlur: _onComponentBlur, onFocus: _onComponentFocus, ...componentProps } = props;\n\n return (\n <ComponentInput\n key={`input-${props.name}-${localeKey}`}\n {...componentProps}\n hint={hint}\n layout={components[props.attribute.component].layout}\n disabled={fieldIsDisabled}\n >\n {renderComponentInput}\n </ComponentInput>\n );\n case 'dynamiczone':\n // Same rationale as `component` above: keep data-structure root props stable.\n const { onBlur: _onDzBlur, onFocus: _onDzFocus, ...dynamicZoneProps } = props;\n\n return (\n <DynamicZone\n key={`input-${props.name}-${localeKey}`}\n {...dynamicZoneProps}\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n case 'relation':\n return (\n <RelationsInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n case 'richtext':\n return (\n <Wysiwyg\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n type={props.type}\n disabled={fieldIsDisabled}\n />\n );\n case 'uid':\n // These props are not needed for the generic form input renderer.\n const { unique: _uniqueUID, ...restUIDProps } = props;\n return (\n <UIDInput\n key={`input-${props.name}-${localeKey}`}\n {...restUIDProps}\n hint={hint}\n type={props.type}\n disabled={fieldIsDisabled}\n />\n );\n /**\n * Enumerations are a special case because they require options.\n */\n case 'enumeration':\n return (\n <FormInputRenderer\n key={`input-${props.name}-${localeKey}`}\n {...props}\n {...previewProps}\n hint={hint}\n options={props.attribute.enum.map((value) => ({ value }))}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n default:\n // These props are not needed for the generic form input renderer.\n const { unique: _unique, mainField: _mainField, ...restProps } = props;\n return (\n <FormInputRenderer\n key={`input-${props.name}-${localeKey}`}\n {...restProps}\n {...previewProps}\n hint={hint}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n }\n};\n\n// Reuse one rules engine instance instead of recreating it for every field render.\nconst rulesEngine = createRulesEngine();\n\n/**\n * A wrapper around BaseInputRenderer that conditionally renders it depending on the attribute's condition.\n */\nconst ConditionAwareInputRenderer = ({\n condition,\n ...props\n}: InputRendererProps & { condition: JsonLogicCondition }) => {\n // Extract only the field paths the visibility rule depends on so unrelated form changes\n // do not force this conditional field to re-render.\n const conditionDependencyPaths = React.useMemo(\n () => getConditionDependencyPaths(condition),\n [condition]\n );\n const getValues = useForm(\n 'ConditionalInputRenderer',\n (state) => (state as typeof state & { getValues: () => unknown }).getValues\n );\n const conditionSubscriptionValue = useForm('ConditionalInputRenderer', (state) => {\n // Subscribe to a small, comparable snapshot of the parent scope instead of all form values.\n return getConditionDependencySubscriptionValue(\n getDirectParent(state.values, props.name),\n conditionDependencyPaths\n );\n });\n\n // When dependencies are known, read the latest parent scope lazily via getValues() so the\n // rule still evaluates against fresh data without subscribing to every form change.\n const targetValues =\n conditionDependencyPaths === null\n ? conditionSubscriptionValue\n : getDirectParent(getValues(), props.name);\n\n const isVisible = rulesEngine.evaluate(condition, targetValues);\n\n if (!isVisible) {\n return null;\n }\n\n return <BaseInputRenderer {...props} />;\n};\n\nconst attributeHasCustomFieldProperty = (\n attribute: Schema.Attribute.AnyAttribute\n): attribute is Schema.Attribute.AnyAttribute & Schema.Attribute.CustomField<string> =>\n 'customField' in attribute && typeof attribute.customField === 'string';\n\nconst useFieldHint = (\n hint: React.ReactNode = undefined,\n attribute: Schema.Attribute.AnyAttribute\n) => {\n const { formatMessage } = useIntl();\n\n const { maximum, minimum } = getMinMax(attribute);\n\n if (!maximum && !minimum) {\n return hint;\n }\n\n const units = ['string', 'uid', 'richtext', 'email', 'password', 'text'].includes(attribute.type)\n ? formatMessage(\n {\n id: 'content-manager.form.Input.hint.character.unit',\n defaultMessage: '{maxValue, plural, one { character} other { characters}}',\n },\n {\n maxValue: Math.max(minimum || 0, maximum || 0),\n }\n )\n : null;\n\n const hasMinAndMax = typeof minimum === 'number' && typeof maximum === 'number';\n\n return formatMessage(\n {\n id: 'content-manager.form.Input.hint.text',\n defaultMessage:\n '{min, select, undefined {} other {min. {min}}}{divider}{max, select, undefined {} other {max. {max}}}{unit}{br}{description}',\n },\n {\n min: minimum,\n max: maximum,\n description: hint,\n unit: units,\n divider: hasMinAndMax\n ? formatMessage({\n id: 'content-manager.form.Input.hint.minMaxDivider',\n defaultMessage: ' / ',\n })\n : null,\n br: <br />,\n }\n );\n};\n\nconst getMinMax = (attribute: Schema.Attribute.AnyAttribute) => {\n if ('min' in attribute || 'max' in attribute) {\n return {\n maximum: !Number.isNaN(Number(attribute.max)) ? Number(attribute.max) : undefined,\n minimum: !Number.isNaN(Number(attribute.min)) ? Number(attribute.min) : undefined,\n };\n } else if ('maxLength' in attribute || 'minLength' in attribute) {\n return { maximum: attribute.maxLength, minimum: attribute.minLength };\n } else {\n return { maximum: undefined, minimum: undefined };\n }\n};\n\n/**\n * Conditionally routes the exported InputRender component towards ConditionalInputRenderer\n * (when there's a JSON logic condition on the attribute, or BaseInputRenderer otherwise.\n * We do this because rendering a conditional field requires access to the values of\n * other form fields, which causes many re-renders and performance issues on complex content\n * types. By splitting the component into two, we isolate the performance issue to\n * conditional fields only, not all edit view fields.\n */\nconst MemoizedInputRenderer = React.memo((props: InputRendererProps) => {\n const condition = props.attribute.conditions?.visible;\n if (condition) {\n return <ConditionAwareInputRenderer {...props} condition={condition} />;\n }\n\n return <BaseInputRenderer {...props} />;\n});\n\nexport type { InputRendererProps };\nexport { MemoizedInputRenderer as InputRenderer, useFieldHint };\n"],"names":["BaseInputRenderer","visible","hint","providedHint","document","providedDocument","inputProps","currentDocument","currentDocumentMeta","useDocumentContext","localeKey","locale","edit","components","useDocumentLayout","model","collectionType","schema","kind","isInDynamicZone","useDynamicZone","state","isInPreviewPopover","useHasInputPopoverParent","shouldIgnorePermissions","isFormDisabled","useForm","disabled","canCreateFields","useDocumentRBAC","rbac","canReadFields","canUpdateFields","canUserAction","idToCheck","documentId","SINGLE_TYPES","editableFields","readableFields","previewProps","usePreviewInputManager","name","attribute","props","canUserReadField","type","canUserEditField","fields","useStrapiApp","app","lazyComponentStore","useLazyComponents","attributeHasCustomFieldProperty","customField","undefined","useFieldHint","renderComponentInput","React","useCallback","componentInputProps","_jsx","MemoizedInputRenderer","field","useField","NotAllowedInput","fieldIsDisabled","CustomInput","FormInputRenderer","addedInputTypes","Object","keys","includes","BlocksInput","onBlur","_onComponentBlur","onFocus","_onComponentFocus","componentProps","ComponentInput","layout","component","_onDzBlur","_onDzFocus","dynamicZoneProps","DynamicZone","RelationsInput","Wysiwyg","unique","_uniqueUID","restUIDProps","UIDInput","options","enum","map","value","_unique","mainField","_mainField","restProps","rulesEngine","createRulesEngine","ConditionAwareInputRenderer","condition","conditionDependencyPaths","useMemo","getConditionDependencyPaths","getValues","conditionSubscriptionValue","getConditionDependencySubscriptionValue","getDirectParent","values","targetValues","isVisible","evaluate","formatMessage","useIntl","maximum","minimum","getMinMax","units","id","defaultMessage","maxValue","Math","max","hasMinAndMax","min","description","unit","divider","br","Number","isNaN","maxLength","minLength","memo","conditions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA;;;;;;;AAOC,IACD,MAAMA,iBAAAA,GAAoB,CAAC,EACzBC,OAAO,EACPC,IAAAA,EAAMC,YAAY,EAClBC,QAAAA,EAAUC,gBAAgB,EAC1B,GAAGC,UAAAA,EACgB,GAAA;AACn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A,CAAUoF,GAAG,CAAA,GAAIxE;AAC1E,SAAA;AACF,IAAA,CAAA,MAAO,IAAI,WAAA,IAAeZ,SAAAA,IAAa,WAAA,IAAeA,SAAAA,EAAW;QAC/D,OAAO;AAAE0E,YAAAA,OAAAA,EAAS1E,UAAU2F,SAAS;AAAEhB,YAAAA,OAAAA,EAAS3E,UAAU4F;AAAU,SAAA;IACtE,CAAA,MAAO;QACL,OAAO;YAAElB,OAAAA,EAAS9D,SAAAA;YAAW+D,OAAAA,EAAS/D;AAAU,SAAA;AAClD,IAAA;AACF,CAAA;AAEA;;;;;;;AAOC,IACD,MAAMO,qBAAAA,iBAAwBJ,gBAAAA,CAAM8E,IAAI,CAAC,CAAC5F,KAAAA,GAAAA;AACxC,IAAA,MAAM2D,SAAAA,GAAY3D,KAAAA,CAAMD,SAAS,CAAC8F,UAAU,EAAEvI,OAAAA;AAC9C,IAAA,IAAIqG,SAAAA,EAAW;AACb,QAAA,qBAAO1C,cAAA,CAACyC,2BAAAA,EAAAA;AAA6B,YAAA,GAAG1D,KAAK;YAAE2D,SAAAA,EAAWA;;AAC5D,IAAA;AAEA,IAAA,qBAAO1C,cAAA,CAAC5D,iBAAAA,EAAAA;AAAmB,QAAA,GAAG2C;;AAChC,CAAA;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import { createRulesEngine, useForm, useStrapiApp, useField, InputRenderer } from '@strapi/admin/strapi-admin';
3
+ import { useForm, useStrapiApp, useField, InputRenderer, createRulesEngine } from '@strapi/admin/strapi-admin';
4
4
  import { useIntl } from 'react-intl';
5
5
  import { SINGLE_TYPES } from '../../../constants/collections.mjs';
6
6
  import { useDocumentRBAC } from '../../../features/DocumentRBAC.mjs';
@@ -26,9 +26,13 @@ import { Wysiwyg as MemoizedWysiwyg } from './FormInputs/Wysiwyg/Field.mjs';
26
26
  * specifically to be used in the EditView of the content-manager this understands
27
27
  * the complete EditFieldLayout and will handle RBAC conditions and rendering CM specific
28
28
  * components such as Blocks / Relations.
29
- */ const BaseInputRenderer = ({ visible, hint: providedHint, document, ...inputProps })=>{
29
+ */ const BaseInputRenderer = ({ visible, hint: providedHint, document: providedDocument, ...inputProps })=>{
30
+ const { currentDocument, currentDocumentMeta } = useDocumentContext('DynamicComponent');
31
+ // Most edit-view fields can read the document from context, which avoids threading a
32
+ // frequently-changing `document` prop through nested component/DZ trees and reduces churn.
33
+ // Keep `providedDocument` as an explicit override for callers outside that default flow.
34
+ const document = providedDocument ?? currentDocument;
30
35
  const localeKey = document?.document?.locale || 'default';
31
- const { currentDocumentMeta } = useDocumentContext('DynamicComponent');
32
36
  const { edit: { components } } = useDocumentLayout(currentDocumentMeta.model);
33
37
  const collectionType = document.schema?.kind === 'collectionType' ? 'collection-types' : 'single-types';
34
38
  const isInDynamicZone = useDynamicZone('isInDynamicZone', (state)=>state.isInDynamicZone);
@@ -61,6 +65,11 @@ import { Wysiwyg as MemoizedWysiwyg } from './FormInputs/Wysiwyg/Field.mjs';
61
65
  props.attribute.customField
62
66
  ] : undefined);
63
67
  const hint = useFieldHint(providedHint, props.attribute);
68
+ const renderComponentInput = React.useCallback((componentInputProps)=>/*#__PURE__*/ jsx(MemoizedInputRenderer, {
69
+ ...componentInputProps
70
+ }, `input-${componentInputProps.name}-${localeKey}`), [
71
+ localeKey
72
+ ]);
64
73
  // We pass field in case of Custom Fields to keep backward compatibility
65
74
  const field = useField(props.name);
66
75
  if (!visible) {
@@ -122,18 +131,21 @@ import { Wysiwyg as MemoizedWysiwyg } from './FormInputs/Wysiwyg/Field.mjs';
122
131
  disabled: fieldIsDisabled
123
132
  }, `input-${props.name}-${localeKey}`);
124
133
  case 'component':
134
+ // Preview focus/blur handlers are not used for data-structure roots (component/dynamic zone).
135
+ // Dropping them avoids unstable function props cascading through memoized component trees.
136
+ const { onBlur: _onComponentBlur, onFocus: _onComponentFocus, ...componentProps } = props;
125
137
  return /*#__PURE__*/ jsx(MemoizedComponentInput, {
126
- ...props,
138
+ ...componentProps,
127
139
  hint: hint,
128
140
  layout: components[props.attribute.component].layout,
129
141
  disabled: fieldIsDisabled,
130
- children: (componentInputProps)=>/*#__PURE__*/ jsx(MemoizedInputRenderer, {
131
- ...componentInputProps
132
- }, `input-${componentInputProps.name}-${localeKey}`)
142
+ children: renderComponentInput
133
143
  }, `input-${props.name}-${localeKey}`);
134
144
  case 'dynamiczone':
145
+ // Same rationale as `component` above: keep data-structure root props stable.
146
+ const { onBlur: _onDzBlur, onFocus: _onDzFocus, ...dynamicZoneProps } = props;
135
147
  return /*#__PURE__*/ jsx(DynamicZone, {
136
- ...props,
148
+ ...dynamicZoneProps,
137
149
  hint: hint,
138
150
  disabled: fieldIsDisabled
139
151
  }, `input-${props.name}-${localeKey}`);
@@ -1 +1 @@
1
- {"version":3,"file":"InputRenderer.mjs","sources":["../../../../../admin/src/pages/EditView/components/InputRenderer.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n useStrapiApp,\n useForm,\n InputRenderer as FormInputRenderer,\n useField,\n createRulesEngine,\n type JsonLogicCondition,\n} from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\n\nimport { SINGLE_TYPES } from '../../../constants/collections';\nimport { useDocumentRBAC } from '../../../features/DocumentRBAC';\nimport { type UseDocument } from '../../../hooks/useDocument';\nimport { useDocumentContext } from '../../../hooks/useDocumentContext';\nimport { useDocumentLayout } from '../../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../../hooks/useLazyComponents';\nimport { useHasInputPopoverParent } from '../../../preview/components/InputPopover';\nimport { usePreviewInputManager } from '../../../preview/hooks/usePreviewInputManager';\nimport {\n getConditionDependencyPaths,\n getConditionDependencySubscriptionValue,\n} from '../../../utils/conditionalFields';\nimport { getDirectParent } from '../utils/data';\n\nimport { BlocksInput } from './FormInputs/BlocksInput/BlocksInput';\nimport { ComponentInput } from './FormInputs/Component/Input';\nimport { DynamicZone, useDynamicZone } from './FormInputs/DynamicZone/Field';\nimport { NotAllowedInput } from './FormInputs/NotAllowed';\nimport { RelationsInput } from './FormInputs/Relations/Relations';\nimport { UIDInput } from './FormInputs/UID';\nimport { Wysiwyg } from './FormInputs/Wysiwyg/Field';\n\nimport type { EditFieldLayout } from '../../../hooks/useDocumentLayout';\nimport type { Schema } from '@strapi/types';\nimport type { DistributiveOmit } from 'react-redux';\n\ntype InputRendererProps = DistributiveOmit<EditFieldLayout, 'size'> & {\n document: ReturnType<UseDocument>;\n};\n\n/**\n * @internal\n *\n * @description An abstraction around the regular form input renderer designed\n * specifically to be used in the EditView of the content-manager this understands\n * the complete EditFieldLayout and will handle RBAC conditions and rendering CM specific\n * components such as Blocks / Relations.\n */\nconst BaseInputRenderer = ({\n visible,\n hint: providedHint,\n document,\n ...inputProps\n}: InputRendererProps) => {\n const localeKey = document?.document?.locale || 'default';\n const { currentDocumentMeta } = useDocumentContext('DynamicComponent');\n const {\n edit: { components },\n } = useDocumentLayout(currentDocumentMeta.model);\n\n const collectionType =\n document.schema?.kind === 'collectionType' ? 'collection-types' : 'single-types';\n\n const isInDynamicZone = useDynamicZone('isInDynamicZone', (state) => state.isInDynamicZone);\n const isInPreviewPopover = useHasInputPopoverParent();\n const shouldIgnorePermissions = isInDynamicZone || isInPreviewPopover;\n\n const isFormDisabled = useForm('InputRenderer', (state) => state.disabled);\n const canCreateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canCreateFields);\n const canReadFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canReadFields);\n const canUpdateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUpdateFields);\n const canUserAction = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUserAction);\n\n let idToCheck = document.document?.documentId;\n if (collectionType === SINGLE_TYPES) {\n idToCheck = document?.document?.documentId;\n }\n\n const editableFields = idToCheck ? canUpdateFields : canCreateFields;\n const readableFields = idToCheck ? canReadFields : canCreateFields;\n\n // Everything preview related\n const previewProps = usePreviewInputManager(inputProps.name, inputProps.attribute);\n const props = { ...inputProps, ...previewProps };\n\n /**\n * Component fields are always readable and editable,\n * however the fields within them may not be.\n */\n const canUserReadField = canUserAction(props.name, readableFields, props.type);\n const canUserEditField = canUserAction(props.name, editableFields, props.type);\n\n const fields = useStrapiApp('InputRenderer', (app) => app.fields);\n const { lazyComponentStore } = useLazyComponents(\n attributeHasCustomFieldProperty(props.attribute) ? [props.attribute.customField] : undefined\n );\n\n const hint = useFieldHint(providedHint, props.attribute);\n\n // We pass field in case of Custom Fields to keep backward compatibility\n const field = useField(props.name);\n\n if (!visible) {\n return null;\n }\n\n /**\n * If the user can't read the field then we don't want to ever render it.\n */\n if (!canUserReadField && !shouldIgnorePermissions) {\n return <NotAllowedInput hint={hint} {...props} />;\n }\n\n const fieldIsDisabled =\n (!canUserEditField && !shouldIgnorePermissions) || props.disabled || isFormDisabled;\n\n /**\n * Because a custom field has a unique prop but the type could be confused with either\n * the useField hook or the type of the field we need to handle it separately and first.\n */\n if (attributeHasCustomFieldProperty(props.attribute)) {\n const CustomInput = lazyComponentStore[props.attribute.customField];\n\n if (CustomInput) {\n return (\n <CustomInput\n {...props}\n {...field}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n return (\n <FormInputRenderer\n key={`input-${props.name}-${localeKey}`}\n {...props}\n {...previewProps}\n hint={hint}\n // @ts-expect-error – this workaround lets us display that the custom field is missing.\n type={props.attribute.customField}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * This is where we handle ONLY the fields from the `useLibrary` hook.\n */\n const addedInputTypes = Object.keys(fields);\n if (!attributeHasCustomFieldProperty(props.attribute) && addedInputTypes.includes(props.type)) {\n const CustomInput = fields[props.type];\n return (\n <CustomInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * These include the content-manager specific fields, failing that we fall back\n * to the more generic form input renderer.\n */\n switch (props.type) {\n case 'blocks':\n return (\n <BlocksInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n type={props.type}\n disabled={fieldIsDisabled}\n />\n );\n case 'component':\n return (\n <ComponentInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n layout={components[props.attribute.component].layout}\n disabled={fieldIsDisabled}\n >\n {(componentInputProps) => (\n <MemoizedInputRenderer\n key={`input-${componentInputProps.name}-${localeKey}`}\n {...componentInputProps}\n />\n )}\n </ComponentInput>\n );\n case 'dynamiczone':\n return (\n <DynamicZone\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n case 'relation':\n return (\n <RelationsInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n case 'richtext':\n return (\n <Wysiwyg\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n type={props.type}\n disabled={fieldIsDisabled}\n />\n );\n case 'uid':\n // These props are not needed for the generic form input renderer.\n const { unique: _uniqueUID, ...restUIDProps } = props;\n return (\n <UIDInput\n key={`input-${props.name}-${localeKey}`}\n {...restUIDProps}\n hint={hint}\n type={props.type}\n disabled={fieldIsDisabled}\n />\n );\n /**\n * Enumerations are a special case because they require options.\n */\n case 'enumeration':\n return (\n <FormInputRenderer\n key={`input-${props.name}-${localeKey}`}\n {...props}\n {...previewProps}\n hint={hint}\n options={props.attribute.enum.map((value) => ({ value }))}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n default:\n // These props are not needed for the generic form input renderer.\n const { unique: _unique, mainField: _mainField, ...restProps } = props;\n return (\n <FormInputRenderer\n key={`input-${props.name}-${localeKey}`}\n {...restProps}\n {...previewProps}\n hint={hint}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n }\n};\n\n// Reuse one rules engine instance instead of recreating it for every field render.\nconst rulesEngine = createRulesEngine();\n\n/**\n * A wrapper around BaseInputRenderer that conditionally renders it depending on the attribute's condition.\n */\nconst ConditionAwareInputRenderer = ({\n condition,\n ...props\n}: InputRendererProps & { condition: JsonLogicCondition }) => {\n // Extract only the field paths the visibility rule depends on so unrelated form changes\n // do not force this conditional field to re-render.\n const conditionDependencyPaths = React.useMemo(\n () => getConditionDependencyPaths(condition),\n [condition]\n );\n const getValues = useForm(\n 'ConditionalInputRenderer',\n (state) => (state as typeof state & { getValues: () => unknown }).getValues\n );\n const conditionSubscriptionValue = useForm('ConditionalInputRenderer', (state) => {\n // Subscribe to a small, comparable snapshot of the parent scope instead of all form values.\n return getConditionDependencySubscriptionValue(\n getDirectParent(state.values, props.name),\n conditionDependencyPaths\n );\n });\n\n // When dependencies are known, read the latest parent scope lazily via getValues() so the\n // rule still evaluates against fresh data without subscribing to every form change.\n const targetValues =\n conditionDependencyPaths === null\n ? conditionSubscriptionValue\n : getDirectParent(getValues(), props.name);\n\n const isVisible = rulesEngine.evaluate(condition, targetValues);\n\n if (!isVisible) {\n return null;\n }\n\n return <BaseInputRenderer {...props} />;\n};\n\nconst attributeHasCustomFieldProperty = (\n attribute: Schema.Attribute.AnyAttribute\n): attribute is Schema.Attribute.AnyAttribute & Schema.Attribute.CustomField<string> =>\n 'customField' in attribute && typeof attribute.customField === 'string';\n\nconst useFieldHint = (\n hint: React.ReactNode = undefined,\n attribute: Schema.Attribute.AnyAttribute\n) => {\n const { formatMessage } = useIntl();\n\n const { maximum, minimum } = getMinMax(attribute);\n\n if (!maximum && !minimum) {\n return hint;\n }\n\n const units = ['string', 'uid', 'richtext', 'email', 'password', 'text'].includes(attribute.type)\n ? formatMessage(\n {\n id: 'content-manager.form.Input.hint.character.unit',\n defaultMessage: '{maxValue, plural, one { character} other { characters}}',\n },\n {\n maxValue: Math.max(minimum || 0, maximum || 0),\n }\n )\n : null;\n\n const hasMinAndMax = typeof minimum === 'number' && typeof maximum === 'number';\n\n return formatMessage(\n {\n id: 'content-manager.form.Input.hint.text',\n defaultMessage:\n '{min, select, undefined {} other {min. {min}}}{divider}{max, select, undefined {} other {max. {max}}}{unit}{br}{description}',\n },\n {\n min: minimum,\n max: maximum,\n description: hint,\n unit: units,\n divider: hasMinAndMax\n ? formatMessage({\n id: 'content-manager.form.Input.hint.minMaxDivider',\n defaultMessage: ' / ',\n })\n : null,\n br: <br />,\n }\n );\n};\n\nconst getMinMax = (attribute: Schema.Attribute.AnyAttribute) => {\n if ('min' in attribute || 'max' in attribute) {\n return {\n maximum: !Number.isNaN(Number(attribute.max)) ? Number(attribute.max) : undefined,\n minimum: !Number.isNaN(Number(attribute.min)) ? Number(attribute.min) : undefined,\n };\n } else if ('maxLength' in attribute || 'minLength' in attribute) {\n return { maximum: attribute.maxLength, minimum: attribute.minLength };\n } else {\n return { maximum: undefined, minimum: undefined };\n }\n};\n\n/**\n * Conditionally routes the exported InputRender component towards ConditionalInputRenderer\n * (when there's a JSON logic condition on the attribute, or BaseInputRenderer otherwise.\n * We do this because rendering a conditional field requires access to the values of\n * other form fields, which causes many re-renders and performance issues on complex content\n * types. By splitting the component into two, we isolate the performance issue to\n * conditional fields only, not all edit view fields.\n */\nconst MemoizedInputRenderer = React.memo((props: InputRendererProps) => {\n const condition = props.attribute.conditions?.visible;\n if (condition) {\n return <ConditionAwareInputRenderer {...props} condition={condition} />;\n }\n\n return <BaseInputRenderer {...props} />;\n});\n\nexport type { InputRendererProps };\nexport { MemoizedInputRenderer as InputRenderer, useFieldHint };\n"],"names":["BaseInputRenderer","visible","hint","providedHint","document","inputProps","localeKey","locale","currentDocumentMeta","useDocumentContext","edit","components","useDocumentLayout","model","collectionType","schema","kind","isInDynamicZone","useDynamicZone","state","isInPreviewPopover","useHasInputPopoverParent","shouldIgnorePermissions","isFormDisabled","useForm","disabled","canCreateFields","useDocumentRBAC","rbac","canReadFields","canUpdateFields","canUserAction","idToCheck","documentId","SINGLE_TYPES","editableFields","readableFields","previewProps","usePreviewInputManager","name","attribute","props","canUserReadField","type","canUserEditField","fields","useStrapiApp","app","lazyComponentStore","useLazyComponents","attributeHasCustomFieldProperty","customField","undefined","useFieldHint","field","useField","_jsx","NotAllowedInput","fieldIsDisabled","CustomInput","FormInputRenderer","addedInputTypes","Object","keys","includes","BlocksInput","ComponentInput","layout","component","componentInputProps","MemoizedInputRenderer","DynamicZone","RelationsInput","Wysiwyg","unique","_uniqueUID","restUIDProps","UIDInput","options","enum","map","value","_unique","mainField","_mainField","restProps","rulesEngine","createRulesEngine","ConditionAwareInputRenderer","condition","conditionDependencyPaths","React","useMemo","getConditionDependencyPaths","getValues","conditionSubscriptionValue","getConditionDependencySubscriptionValue","getDirectParent","values","targetValues","isVisible","evaluate","formatMessage","useIntl","maximum","minimum","getMinMax","units","id","defaultMessage","maxValue","Math","max","hasMinAndMax","min","description","unit","divider","br","Number","isNaN","maxLength","minLength","memo","conditions"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0CA;;;;;;;AAOC,IACD,MAAMA,iBAAAA,GAAoB,CAAC,EACzBC,OAAO,EACPC,IAAAA,EAAMC,YAAY,EAClBC,QAAQ,EACR,GAAGC,UAAAA,EACgB,GAAA;IACnB,MAAMC,SAAAA,GAAYF,QAAAA,EAAUA,QAAAA,EAAUG,MAAAA,IAAU,SAAA;AAChD,IAAA,MAAM,EAAEC,mBAAmB,EAAE,GAAGC,kBAAAA,CAAmB,kBAAA,CAAA;IACnD,MAAM,EACJC,MAAM,EAAEC,UAAU,EAAE,EACrB,GAAGC,iBAAAA,CAAkBJ,mBAAAA,CAAoBK,KAAK,CAAA;AAE/C,IAAA,MAAMC,iBACJV,QAAAA,CAASW,MAAM,EAAEC,IAAAA,KAAS,mBAAmB,kBAAA,GAAqB,cAAA;AAEpE,IAAA,MAAMC,kBAAkBC,cAAAA,CAAe,iBAAA,EAAmB,CAACC,KA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","sources":["../../../../../admin/src/pages/EditView/components/InputRenderer.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n useStrapiApp,\n useForm,\n InputRenderer as FormInputRenderer,\n useField,\n createRulesEngine,\n type JsonLogicCondition,\n} from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\n\nimport { SINGLE_TYPES } from '../../../constants/collections';\nimport { useDocumentRBAC } from '../../../features/DocumentRBAC';\nimport { type UseDocument } from '../../../hooks/useDocument';\nimport { useDocumentContext } from '../../../hooks/useDocumentContext';\nimport { useDocumentLayout } from '../../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../../hooks/useLazyComponents';\nimport { useHasInputPopoverParent } from '../../../preview/components/InputPopover';\nimport { usePreviewInputManager } from '../../../preview/hooks/usePreviewInputManager';\nimport {\n getConditionDependencyPaths,\n getConditionDependencySubscriptionValue,\n} from '../../../utils/conditionalFields';\nimport { getDirectParent } from '../utils/data';\n\nimport { BlocksInput } from './FormInputs/BlocksInput/BlocksInput';\nimport { ComponentInput } from './FormInputs/Component/Input';\nimport { DynamicZone, useDynamicZone } from './FormInputs/DynamicZone/Field';\nimport { NotAllowedInput } from './FormInputs/NotAllowed';\nimport { RelationsInput } from './FormInputs/Relations/Relations';\nimport { UIDInput } from './FormInputs/UID';\nimport { Wysiwyg } from './FormInputs/Wysiwyg/Field';\n\nimport type { EditFieldLayout } from '../../../hooks/useDocumentLayout';\nimport type { Schema } from '@strapi/types';\nimport type { DistributiveOmit } from 'react-redux';\n\ntype InputRendererProps = DistributiveOmit<EditFieldLayout, 'size'> & {\n document?: ReturnType<UseDocument>;\n};\n\n/**\n * @internal\n *\n * @description An abstraction around the regular form input renderer designed\n * specifically to be used in the EditView of the content-manager this understands\n * the complete EditFieldLayout and will handle RBAC conditions and rendering CM specific\n * components such as Blocks / Relations.\n */\nconst BaseInputRenderer = ({\n visible,\n hint: providedHint,\n document: providedDocument,\n ...inputProps\n}: InputRendererProps) => {\n const { currentDocument, currentDocumentMeta } = useDocumentContext('DynamicComponent');\n // Most edit-view fields can read the document from context, which avoids threading a\n // frequently-changing `document` prop through nested component/DZ trees and reduces churn.\n // Keep `providedDocument` as an explicit override for callers outside that default flow.\n const document = providedDocument ?? currentDocument;\n const localeKey = document?.document?.locale || 'default';\n const {\n edit: { components },\n } = useDocumentLayout(currentDocumentMeta.model);\n\n const collectionType =\n document.schema?.kind === 'collectionType' ? 'collection-types' : 'single-types';\n\n const isInDynamicZone = useDynamicZone('isInDynamicZone', (state) => state.isInDynamicZone);\n const isInPreviewPopover = useHasInputPopoverParent();\n const shouldIgnorePermissions = isInDynamicZone || isInPreviewPopover;\n\n const isFormDisabled = useForm('InputRenderer', (state) => state.disabled);\n const canCreateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canCreateFields);\n const canReadFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canReadFields);\n const canUpdateFields = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUpdateFields);\n const canUserAction = useDocumentRBAC('InputRenderer', (rbac) => rbac.canUserAction);\n\n let idToCheck = document.document?.documentId;\n if (collectionType === SINGLE_TYPES) {\n idToCheck = document?.document?.documentId;\n }\n\n const editableFields = idToCheck ? canUpdateFields : canCreateFields;\n const readableFields = idToCheck ? canReadFields : canCreateFields;\n\n // Everything preview related\n const previewProps = usePreviewInputManager(inputProps.name, inputProps.attribute);\n const props = { ...inputProps, ...previewProps };\n\n /**\n * Component fields are always readable and editable,\n * however the fields within them may not be.\n */\n const canUserReadField = canUserAction(props.name, readableFields, props.type);\n const canUserEditField = canUserAction(props.name, editableFields, props.type);\n\n const fields = useStrapiApp('InputRenderer', (app) => app.fields);\n const { lazyComponentStore } = useLazyComponents(\n attributeHasCustomFieldProperty(props.attribute) ? [props.attribute.customField] : undefined\n );\n\n const hint = useFieldHint(providedHint, props.attribute);\n const renderComponentInput = React.useCallback(\n (componentInputProps: InputRendererProps) => (\n <MemoizedInputRenderer\n key={`input-${componentInputProps.name}-${localeKey}`}\n {...componentInputProps}\n />\n ),\n [localeKey]\n );\n\n // We pass field in case of Custom Fields to keep backward compatibility\n const field = useField(props.name);\n\n if (!visible) {\n return null;\n }\n\n /**\n * If the user can't read the field then we don't want to ever render it.\n */\n if (!canUserReadField && !shouldIgnorePermissions) {\n return <NotAllowedInput hint={hint} {...props} />;\n }\n\n const fieldIsDisabled =\n (!canUserEditField && !shouldIgnorePermissions) || props.disabled || isFormDisabled;\n\n /**\n * Because a custom field has a unique prop but the type could be confused with either\n * the useField hook or the type of the field we need to handle it separately and first.\n */\n if (attributeHasCustomFieldProperty(props.attribute)) {\n const CustomInput = lazyComponentStore[props.attribute.customField];\n\n if (CustomInput) {\n return (\n <CustomInput\n {...props}\n {...field}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n return (\n <FormInputRenderer\n key={`input-${props.name}-${localeKey}`}\n {...props}\n {...previewProps}\n hint={hint}\n // @ts-expect-error – this workaround lets us display that the custom field is missing.\n type={props.attribute.customField}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * This is where we handle ONLY the fields from the `useLibrary` hook.\n */\n const addedInputTypes = Object.keys(fields);\n if (!attributeHasCustomFieldProperty(props.attribute) && addedInputTypes.includes(props.type)) {\n const CustomInput = fields[props.type];\n return (\n <CustomInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n }\n\n /**\n * These include the content-manager specific fields, failing that we fall back\n * to the more generic form input renderer.\n */\n switch (props.type) {\n case 'blocks':\n return (\n <BlocksInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n type={props.type}\n disabled={fieldIsDisabled}\n />\n );\n case 'component':\n // Preview focus/blur handlers are not used for data-structure roots (component/dynamic zone).\n // Dropping them avoids unstable function props cascading through memoized component trees.\n const { onBlur: _onComponentBlur, onFocus: _onComponentFocus, ...componentProps } = props;\n\n return (\n <ComponentInput\n key={`input-${props.name}-${localeKey}`}\n {...componentProps}\n hint={hint}\n layout={components[props.attribute.component].layout}\n disabled={fieldIsDisabled}\n >\n {renderComponentInput}\n </ComponentInput>\n );\n case 'dynamiczone':\n // Same rationale as `component` above: keep data-structure root props stable.\n const { onBlur: _onDzBlur, onFocus: _onDzFocus, ...dynamicZoneProps } = props;\n\n return (\n <DynamicZone\n key={`input-${props.name}-${localeKey}`}\n {...dynamicZoneProps}\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n case 'relation':\n return (\n <RelationsInput\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n disabled={fieldIsDisabled}\n />\n );\n case 'richtext':\n return (\n <Wysiwyg\n key={`input-${props.name}-${localeKey}`}\n {...props}\n hint={hint}\n type={props.type}\n disabled={fieldIsDisabled}\n />\n );\n case 'uid':\n // These props are not needed for the generic form input renderer.\n const { unique: _uniqueUID, ...restUIDProps } = props;\n return (\n <UIDInput\n key={`input-${props.name}-${localeKey}`}\n {...restUIDProps}\n hint={hint}\n type={props.type}\n disabled={fieldIsDisabled}\n />\n );\n /**\n * Enumerations are a special case because they require options.\n */\n case 'enumeration':\n return (\n <FormInputRenderer\n key={`input-${props.name}-${localeKey}`}\n {...props}\n {...previewProps}\n hint={hint}\n options={props.attribute.enum.map((value) => ({ value }))}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n default:\n // These props are not needed for the generic form input renderer.\n const { unique: _unique, mainField: _mainField, ...restProps } = props;\n return (\n <FormInputRenderer\n key={`input-${props.name}-${localeKey}`}\n {...restProps}\n {...previewProps}\n hint={hint}\n // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!\n type={props.customField ? 'custom-field' : props.type}\n disabled={fieldIsDisabled}\n />\n );\n }\n};\n\n// Reuse one rules engine instance instead of recreating it for every field render.\nconst rulesEngine = createRulesEngine();\n\n/**\n * A wrapper around BaseInputRenderer that conditionally renders it depending on the attribute's condition.\n */\nconst ConditionAwareInputRenderer = ({\n condition,\n ...props\n}: InputRendererProps & { condition: JsonLogicCondition }) => {\n // Extract only the field paths the visibility rule depends on so unrelated form changes\n // do not force this conditional field to re-render.\n const conditionDependencyPaths = React.useMemo(\n () => getConditionDependencyPaths(condition),\n [condition]\n );\n const getValues = useForm(\n 'ConditionalInputRenderer',\n (state) => (state as typeof state & { getValues: () => unknown }).getValues\n );\n const conditionSubscriptionValue = useForm('ConditionalInputRenderer', (state) => {\n // Subscribe to a small, comparable snapshot of the parent scope instead of all form values.\n return getConditionDependencySubscriptionValue(\n getDirectParent(state.values, props.name),\n conditionDependencyPaths\n );\n });\n\n // When dependencies are known, read the latest parent scope lazily via getValues() so the\n // rule still evaluates against fresh data without subscribing to every form change.\n const targetValues =\n conditionDependencyPaths === null\n ? conditionSubscriptionValue\n : getDirectParent(getValues(), props.name);\n\n const isVisible = rulesEngine.evaluate(condition, targetValues);\n\n if (!isVisible) {\n return null;\n }\n\n return <BaseInputRenderer {...props} />;\n};\n\nconst attributeHasCustomFieldProperty = (\n attribute: Schema.Attribute.AnyAttribute\n): attribute is Schema.Attribute.AnyAttribute & Schema.Attribute.CustomField<string> =>\n 'customField' in attribute && typeof attribute.customField === 'string';\n\nconst useFieldHint = (\n hint: React.ReactNode = undefined,\n attribute: Schema.Attribute.AnyAttribute\n) => {\n const { formatMessage } = useIntl();\n\n const { maximum, minimum } = getMinMax(attribute);\n\n if (!maximum && !minimum) {\n return hint;\n }\n\n const units = ['string', 'uid', 'richtext', 'email', 'password', 'text'].includes(attribute.type)\n ? formatMessage(\n {\n id: 'content-manager.form.Input.hint.character.unit',\n defaultMessage: '{maxValue, plural, one { character} other { characters}}',\n },\n {\n maxValue: Math.max(minimum || 0, maximum || 0),\n }\n )\n : null;\n\n const hasMinAndMax = typeof minimum === 'number' && typeof maximum === 'number';\n\n return formatMessage(\n {\n id: 'content-manager.form.Input.hint.text',\n defaultMessage:\n '{min, select, undefined {} other {min. {min}}}{divider}{max, select, undefined {} other {max. {max}}}{unit}{br}{description}',\n },\n {\n min: minimum,\n max: maximum,\n description: hint,\n unit: units,\n divider: hasMinAndMax\n ? formatMessage({\n id: 'content-manager.form.Input.hint.minMaxDivider',\n defaultMessage: ' / ',\n })\n : null,\n br: <br />,\n }\n );\n};\n\nconst getMinMax = (attribute: Schema.Attribute.AnyAttribute) => {\n if ('min' in attribute || 'max' in attribute) {\n return {\n maximum: !Number.isNaN(Number(attribute.max)) ? Number(attribute.max) : undefined,\n minimum: !Number.isNaN(Number(attribute.min)) ? Number(attribute.min) : undefined,\n };\n } else if ('maxLength' in attribute || 'minLength' in attribute) {\n return { maximum: attribute.maxLength, minimum: attribute.minLength };\n } else {\n return { maximum: undefined, minimum: undefined };\n }\n};\n\n/**\n * Conditionally routes the exported InputRender component towards ConditionalInputRenderer\n * (when there's a JSON logic condition on the attribute, or BaseInputRenderer otherwise.\n * We do this because rendering a conditional field requires access to the values of\n * other form fields, which causes many re-renders and performance issues on complex content\n * types. By splitting the component into two, we isolate the performance issue to\n * conditional fields only, not all edit view fields.\n */\nconst MemoizedInputRenderer = React.memo((props: InputRendererProps) => {\n const condition = props.attribute.conditions?.visible;\n if (condition) {\n return <ConditionAwareInputRenderer {...props} condition={condition} />;\n }\n\n return <BaseInputRenderer {...props} />;\n});\n\nexport type { InputRendererProps };\nexport { MemoizedInputRenderer as InputRenderer, useFieldHint };\n"],"names":["BaseInputRenderer","visible","hint","providedHint","document","providedDocument","inputProps","currentDocument","currentDocumentMeta","useDocumentContext","localeKey","locale","edit","components","useDocumentLayout","model","collectionType","schema","kind","isInDynamicZone","useDynamicZone","state","isInPreviewPopover","useHasInputPopoverParent","shouldIgnorePermissions","isFormDisabled","useForm","disabled","canCreateFields","useDocumentRBAC","rbac","canReadFields","canUpdateFields","canUserAction","idToCheck","documentId","SINGLE_TYPES","editableFields","readableFields","previewProps","usePreviewInputManager","name","attribute","props","canUserReadField","type","canUserEditField","fields","useStrapiApp","app","lazyComponentStore","useLazyComponents","attributeHasCustomFieldProperty","customField","undefined","useFieldHint","renderComponentInput","React","useCallback","componentInputProps","_jsx","MemoizedInputRenderer","field","useField","NotAllowedInput","fieldIsDisabled","CustomInput","FormInputRenderer","addedInputTypes","Object","keys","includes","BlocksInput","onBlur","_onComponentBlur","onFocus","_onComponentFocus","componentProps","ComponentInput","layout","component","_onDzBlur","_onDzFocus","dynamicZoneProps","DynamicZone","RelationsInput","Wysiwyg","unique","_uniqueUID","restUIDProps","UIDInput","options","enum","map","value","_unique","mainField","_mainField","restProps","rulesEngine","createRulesEngine","ConditionAwareInputRenderer","condition","conditionDependencyPaths","useMemo","getConditionDependencyPaths","getValues","conditionSubscriptionValue","getConditionDependencySubscriptionValue","getDirectParent","values","targetValues","isVisible","evaluate","formatMessage","useIntl","maximum","minimum","getMinMax","units","id","defaultMessage","maxValue","Math","max","hasMinAndMax","min","description","unit","divider","br","Number","isNaN","maxLength","minLength","memo","conditions"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0CA;;;;;;;AAOC,IACD,MAAMA,iBAAAA,GAAoB,CAAC,EACzBC,OAAO,EACPC,IAAAA,EAAMC,YAAY,EAClBC,QAAAA,EAAUC,gBAAgB,EAC1B,GAAGC,UAAAA,EACgB,GAAA;AACnB,IAAA,MAAM,EAAEC,eAAe,EAAEC,mBAAmB,EAAE,GAAGC,kBAAAA,CAAmB,kBAAA,CAAA;;;;AAIpE,IAAA,MAAML,WAAWC,gBAAAA,IAAoBE,eAAAA;IACrC,MAAMG,SAAAA,GAAYN,QAAAA,EAAUA,QAAAA,EAAUO,MAAAA,IAAU,SAAA;IAChD,MAAM,EACJC,MAAM,EAAEC,UAAU,EAAE,EACrB,GAAGC,iBAAAA,CAAkBN,mBAAAA,CAAoBO,KAAK,CAAA;AAE/C,IAAA,MAAMC,iBACJZ,QAAAA,CAASa,MAAM,EAAEC,IAAAA,KAAS,mBAAmB,kB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,IAAI,CAAC,CAAC5F,KAAAA,GAAAA;AACxC,IAAA,MAAM2D,SAAAA,GAAY3D,KAAAA,CAAMD,SAAS,CAAC8F,UAAU,EAAEvI,OAAAA;AAC9C,IAAA,IAAIqG,SAAAA,EAAW;AACb,QAAA,qBAAO1C,GAAA,CAACyC,2BAAAA,EAAAA;AAA6B,YAAA,GAAG1D,KAAK;YAAE2D,SAAAA,EAAWA;;AAC5D,IAAA;AAEA,IAAA,qBAAO1C,GAAA,CAAC5D,iBAAAA,EAAAA;AAAmB,QAAA,GAAG2C;;AAChC,CAAA;;;;"}
@@ -56,28 +56,23 @@ const TableComponent = styledComponents.styled(designSystem.RawTable)`
56
56
  /* -------------------------------------------------------------------------------------------------
57
57
  * EntryValidationText
58
58
  * -----------------------------------------------------------------------------------------------*/ const formatErrorMessages = (errors, parentKey, formatMessage)=>{
59
+ if (!errors) return [];
59
60
  const messages = [];
60
61
  Object.entries(errors).forEach(([key, value])=>{
61
62
  const currentKey = parentKey ? `${parentKey}.${key}` : key;
62
- if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
63
- if ('id' in value && 'defaultMessage' in value) {
64
- messages.push(formatMessage({
65
- id: `${value.id}.withField`,
66
- defaultMessage: value.defaultMessage
67
- }, {
68
- field: currentKey
69
- }));
70
- } else {
71
- messages.push(...formatErrorMessages(// @ts-expect-error TODO: check why value is not compatible with FormErrors
72
- value, currentKey, formatMessage));
73
- }
74
- } else {
63
+ if (!value) return;
64
+ const isErrorMessageDescriptor = typeof value === 'object' && 'id' in value && 'defaultMessage' in value;
65
+ if (isErrorMessageDescriptor || typeof value === 'string') {
66
+ const id = isErrorMessageDescriptor ? value.id : value;
67
+ const defaultMessage = isErrorMessageDescriptor ? value.defaultMessage : value;
75
68
  messages.push(formatMessage({
76
- id: `${value}.withField`,
77
- defaultMessage: value
69
+ id: `${id}.withField`,
70
+ defaultMessage
78
71
  }, {
79
72
  field: currentKey
80
73
  }));
74
+ } else {
75
+ messages.push(...formatErrorMessages(value, currentKey, formatMessage));
81
76
  }
82
77
  });
83
78
  return messages;
@@ -575,4 +570,5 @@ const SelectedEntriesModalContent = ({ listViewSelectedEntries, toggleModal, set
575
570
 
576
571
  exports.PublishAction = PublishAction;
577
572
  exports.SelectedEntriesModalContent = SelectedEntriesModalContent;
573
+ exports.formatErrorMessages = formatErrorMessages;
578
574
  //# sourceMappingURL=PublishAction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PublishAction.js","sources":["../../../../../../admin/src/pages/ListView/components/BulkActions/PublishAction.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n FormErrors,\n getYupValidationErrors,\n Table,\n useQueryParams,\n useTable,\n} from '@strapi/admin/strapi-admin';\nimport {\n Box,\n Button,\n Flex,\n IconButton,\n Loader,\n Modal,\n Tooltip,\n Typography,\n TypographyComponent,\n RawTable,\n Tr,\n Td,\n Tbody,\n} from '@strapi/design-system';\nimport { ArrowsCounterClockwise, CheckCircle, CrossCircle, Pencil } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { Link, useLocation } from 'react-router-dom';\nimport { styled } from 'styled-components';\nimport { ValidationError } from 'yup';\n\nimport { useDocumentRBAC } from '../../../../features/DocumentRBAC';\nimport { useContentTypeSchema } from '../../../../hooks/useContentTypeSchema';\nimport { useDocumentActions } from '../../../../hooks/useDocumentActions';\nimport { useDocLayout } from '../../../../hooks/useDocumentLayout';\nimport { contentManagerApi } from '../../../../services/api';\nimport {\n useGetAllDocumentsQuery,\n usePublishManyDocumentsMutation,\n} from '../../../../services/documents';\nimport { buildValidParams } from '../../../../utils/api';\nimport { getTranslation } from '../../../../utils/translations';\nimport { createYupSchema } from '../../../../utils/validation';\nimport { DocumentStatus } from '../../../EditView/components/DocumentStatus';\n\nimport { ConfirmDialogPublishAll, ConfirmDialogPublishAllProps } from './ConfirmBulkActionDialog';\n\nimport type { BulkActionComponent } from '../../../../content-manager';\nimport type { Document } from '../../../../hooks/useDocument';\n\nconst TypographyMaxWidth = styled<TypographyComponent>(Typography)`\n max-width: 300px;\n`;\n\nconst TableComponent = styled(RawTable)`\n width: 100%;\n table-layout: fixed;\n td:first-child {\n border-right: 1px solid ${({ theme }) => theme.colors.neutral150};\n }\n td:first-of-type {\n padding: ${({ theme }) => theme.spaces[4]};\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * EntryValidationText\n * -----------------------------------------------------------------------------------------------*/\n\nconst formatErrorMessages = (errors: FormErrors, parentKey: string, formatMessage: any) => {\n const messages: string[] = [];\n\n Object.entries(errors).forEach(([key, value]) => {\n const currentKey = parentKey ? `${parentKey}.${key}` : key;\n\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n if ('id' in value && 'defaultMessage' in value) {\n messages.push(\n formatMessage(\n {\n id: `${value.id}.withField`,\n defaultMessage: value.defaultMessage,\n },\n { field: currentKey }\n )\n );\n } else {\n messages.push(\n ...formatErrorMessages(\n // @ts-expect-error TODO: check why value is not compatible with FormErrors\n value,\n currentKey,\n formatMessage\n )\n );\n }\n } else {\n messages.push(\n formatMessage(\n {\n id: `${value}.withField`,\n defaultMessage: value,\n },\n { field: currentKey }\n )\n );\n }\n });\n\n return messages;\n};\n\ninterface EntryValidationTextProps {\n validationErrors?: FormErrors;\n status: string;\n}\n\nconst EntryValidationText = ({ validationErrors, status }: EntryValidationTextProps) => {\n const { formatMessage } = useIntl();\n\n if (validationErrors) {\n const validationErrorsMessages = formatErrorMessages(validationErrors, '', formatMessage).join(\n ' '\n );\n\n return (\n <Flex gap={2}>\n <CrossCircle fill=\"danger600\" />\n <Tooltip label={validationErrorsMessages}>\n <TypographyMaxWidth textColor=\"danger600\" variant=\"omega\" fontWeight=\"bold\" ellipsis>\n {validationErrorsMessages}\n </TypographyMaxWidth>\n </Tooltip>\n </Flex>\n );\n }\n\n if (status === 'published') {\n return (\n <Flex gap={2}>\n <CheckCircle fill=\"success600\" />\n <Typography textColor=\"success600\" fontWeight=\"bold\">\n {formatMessage({\n id: 'content-manager.bulk-publish.already-published',\n defaultMessage: 'Already Published',\n })}\n </Typography>\n </Flex>\n );\n }\n\n if (status === 'modified') {\n return (\n <Flex gap={2}>\n <ArrowsCounterClockwise fill=\"alternative600\" />\n <Typography textColor=\"alternative600\" fontWeight=\"bold\">\n {formatMessage({\n id: 'content-manager.bulk-publish.modified',\n defaultMessage: 'Ready to publish changes',\n })}\n </Typography>\n </Flex>\n );\n }\n\n return (\n <Flex gap={2}>\n <CheckCircle fill=\"success600\" />\n <Typography textColor=\"success600\" fontWeight=\"bold\">\n {formatMessage({\n id: 'app.utils.ready-to-publish',\n defaultMessage: 'Ready to publish',\n })}\n </Typography>\n </Flex>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * SelectedEntriesTableContent\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SelectedEntriesTableContentProps {\n isPublishing?: boolean;\n rowsToDisplay?: TableRow[];\n entriesToPublish?: TableRow['documentId'][];\n validationErrors: Record<string, EntryValidationTextProps['validationErrors']>;\n}\n\nconst TABLE_HEADERS = [\n { name: 'id', label: 'id' },\n { name: 'name', label: 'name' },\n { name: 'status', label: 'status' },\n { name: 'publicationStatus', label: 'Publication status' },\n];\n\nconst SelectedEntriesTableContent = ({\n isPublishing,\n rowsToDisplay = [],\n entriesToPublish = [],\n validationErrors = {},\n}: SelectedEntriesTableContentProps) => {\n const { pathname } = useLocation();\n const { formatMessage } = useIntl();\n\n const {\n list: {\n settings: { mainField },\n },\n } = useDocLayout();\n\n const shouldDisplayMainField = mainField != null && mainField !== 'id';\n\n return (\n <Table.Content>\n <Table.Head>\n <Table.HeaderCheckboxCell />\n {TABLE_HEADERS.filter((head) => head.name !== 'name' || shouldDisplayMainField).map(\n (head) => (\n <Table.HeaderCell key={head.name} {...head} />\n )\n )}\n </Table.Head>\n <Table.Loading />\n <Table.Body>\n {rowsToDisplay.map((row) => (\n <Table.Row key={row.id}>\n <Table.CheckboxCell id={row.id} />\n <Table.Cell>\n <Typography>{row.id}</Typography>\n </Table.Cell>\n {shouldDisplayMainField && (\n <Table.Cell>\n <Typography>{row[mainField as keyof TableRow]}</Typography>\n </Table.Cell>\n )}\n <Table.Cell>\n <DocumentStatus status={row.status} maxWidth={'min-content'} />\n </Table.Cell>\n <Table.Cell>\n {isPublishing && entriesToPublish.includes(row.documentId) ? (\n <Flex gap={2}>\n <Typography>\n {formatMessage({\n id: 'content-manager.success.record.publishing',\n defaultMessage: 'Publishing...',\n })}\n </Typography>\n <Loader small />\n </Flex>\n ) : (\n <EntryValidationText\n validationErrors={validationErrors[row.documentId]}\n status={row.status}\n />\n )}\n </Table.Cell>\n <Table.Cell>\n <Flex>\n <IconButton\n tag={Link}\n to={{\n pathname: `${pathname}/${row.documentId}`,\n search: row.locale && `?plugins[i18n][locale]=${row.locale}`,\n }}\n state={{ from: pathname }}\n label={formatMessage({\n id: 'content-manager.bulk-publish.edit',\n defaultMessage: 'Edit',\n })}\n target=\"_blank\"\n marginLeft=\"auto\"\n variant=\"ghost\"\n >\n <Pencil width={'1.6rem'} height={'1.6rem'} />\n </IconButton>\n </Flex>\n </Table.Cell>\n </Table.Row>\n ))}\n </Table.Body>\n </Table.Content>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PublicationStatusSummary\n * -----------------------------------------------------------------------------------------------*/\n\ninterface PublicationStatusSummaryProps {\n count: number;\n icon: React.ReactNode;\n message: string;\n textColor: string;\n}\n\nconst PublicationStatusSummary = ({\n count,\n icon,\n message,\n textColor,\n}: PublicationStatusSummaryProps) => {\n return (\n <Flex justifyContent=\"space-between\" flex={1} gap={3}>\n <Flex gap={2}>\n {icon}\n <Typography textColor={textColor} fontWeight=\"bold\">\n {message}\n </Typography>\n </Flex>\n <Typography fontWeight=\"bold\">{count}</Typography>\n </Flex>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PublicationStatusGrid\n * -----------------------------------------------------------------------------------------------*/\n\ninterface PublicationStatusGridProps {\n entriesReadyToPublishCount: number;\n entriesModifiedCount: number;\n entriesPublishedCount: number;\n entriesWithErrorsCount: number;\n}\n\nconst PublicationStatusGrid = ({\n entriesReadyToPublishCount,\n entriesPublishedCount,\n entriesModifiedCount,\n entriesWithErrorsCount,\n}: PublicationStatusGridProps) => {\n const { formatMessage } = useIntl();\n\n return (\n <Box hasRadius borderColor=\"neutral150\">\n <TableComponent colCount={2} rowCount={2}>\n <Tbody>\n <Tr>\n <Td>\n <PublicationStatusSummary\n textColor=\"success600\"\n count={entriesReadyToPublishCount}\n icon={<CheckCircle fill=\"success600\" />}\n message={formatMessage({\n id: 'app.utils.ready-to-publish',\n defaultMessage: 'Ready to publish',\n })}\n />\n </Td>\n <Td>\n <PublicationStatusSummary\n textColor=\"success600\"\n count={entriesPublishedCount}\n icon={<CheckCircle fill=\"success600\" />}\n message={formatMessage({\n id: 'app.utils.already-published',\n defaultMessage: 'Already published',\n })}\n />\n </Td>\n </Tr>\n <Tr>\n <Td>\n <PublicationStatusSummary\n textColor=\"alternative600\"\n count={entriesModifiedCount}\n icon={<ArrowsCounterClockwise fill=\"alternative600\" />}\n message={formatMessage({\n id: 'content-manager.bulk-publish.modified',\n defaultMessage: 'Ready to publish changes',\n })}\n />\n </Td>\n <Td>\n <PublicationStatusSummary\n textColor=\"danger600\"\n count={entriesWithErrorsCount}\n icon={<CrossCircle fill=\"danger600\" />}\n message={formatMessage({\n id: 'content-manager.bulk-publish.waiting-for-action',\n defaultMessage: 'Waiting for action',\n })}\n />\n </Td>\n </Tr>\n </Tbody>\n </TableComponent>\n </Box>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * SelectedEntriesModalContent\n * -----------------------------------------------------------------------------------------------*/\n\ninterface TableRow extends Document {}\n\ninterface SelectedEntriesModalContentProps {\n listViewSelectedEntries: TableRow[];\n toggleModal: ConfirmDialogPublishAllProps['onToggleDialog'];\n setListViewSelectedDocuments: (documents: TableRow[]) => void;\n model: string;\n}\n\nconst SelectedEntriesModalContent = ({\n listViewSelectedEntries,\n toggleModal,\n setListViewSelectedDocuments,\n model,\n}: SelectedEntriesModalContentProps) => {\n const { formatMessage } = useIntl();\n const { schema, components } = useContentTypeSchema(model);\n const documentIds = listViewSelectedEntries.map(({ documentId }) => documentId);\n\n // We want to keep the selected entries order same as the list view\n const [{ query }] = useQueryParams<{ sort?: string; plugins?: Record<string, any> }>();\n const params = React.useMemo(() => buildValidParams(query), [query]);\n\n // Fetch the documents based on the selected entries and update the modal table\n const { data, isLoading, isFetching, refetch } = useGetAllDocumentsQuery(\n {\n model,\n params: {\n page: '1',\n pageSize: documentIds.length.toString(),\n sort: query.sort,\n filters: {\n documentId: {\n $in: documentIds,\n },\n },\n locale: query.plugins?.i18n?.locale,\n },\n },\n {\n selectFromResult: ({ data, ...restRes }) => ({ data: data?.results ?? [], ...restRes }),\n }\n );\n\n // Validate the entries based on the schema to show errors if any\n const { rows, validationErrors } = React.useMemo(() => {\n if (data.length > 0 && schema) {\n const validate = createYupSchema(\n schema.attributes,\n components,\n // Since this is the \"Publish\" action, the validation\n // schema must enforce the rules for published entities\n { status: 'published' }\n );\n const validationErrors: Record<TableRow['documentId'], FormErrors> = {};\n const rows = data.map((entry: Document) => {\n try {\n validate.validateSync(entry, { abortEarly: false });\n\n return entry;\n } catch (e) {\n if (e instanceof ValidationError) {\n validationErrors[entry.documentId] = getYupValidationErrors(e);\n }\n\n return entry;\n }\n });\n\n return { rows, validationErrors };\n }\n\n return {\n rows: [],\n validationErrors: {},\n };\n }, [components, data, schema]);\n\n const [isDialogOpen, setIsDialogOpen] = React.useState(false);\n\n const { publishMany: bulkPublishAction, isLoading: isPublishing } = useDocumentActions();\n const [, { isLoading: isSubmittingForm }] = usePublishManyDocumentsMutation();\n\n const selectedRows = useTable('publishAction', (state) => state.selectedRows);\n\n // Filter selected entries from the updated modal table rows\n const selectedEntries = rows.filter((entry) =>\n selectedRows.some((selectedEntry) => selectedEntry.documentId === entry.documentId)\n );\n\n const entriesToPublish = selectedEntries\n .filter((entry) => !validationErrors[entry.documentId])\n .map((entry) => entry.documentId);\n\n const selectedEntriesWithErrorsCount = selectedEntries.filter(\n ({ documentId }) => validationErrors[documentId]\n ).length;\n const selectedEntriesPublishedCount = selectedEntries.filter(\n ({ status }) => status === 'published'\n ).length;\n const selectedEntriesModifiedCount = selectedEntries.filter(\n ({ status, documentId }) => status === 'modified' && !validationErrors[documentId]\n ).length;\n const selectedEntriesWithNoErrorsCount =\n selectedEntries.length - selectedEntriesWithErrorsCount - selectedEntriesPublishedCount;\n\n const toggleDialog = () => setIsDialogOpen((prev) => !prev);\n\n const handleConfirmBulkPublish = async () => {\n toggleDialog();\n\n const res = await bulkPublishAction({ model: model, documentIds: entriesToPublish, params });\n if (!('error' in res)) {\n const unpublishedEntries = rows.filter((row) => {\n return !entriesToPublish.includes(row.documentId);\n });\n // Keep selection of the entries in list view that were not published\n setListViewSelectedDocuments(unpublishedEntries);\n }\n };\n\n return (\n <>\n <Modal.Body>\n <PublicationStatusGrid\n entriesReadyToPublishCount={\n selectedEntriesWithNoErrorsCount - selectedEntriesModifiedCount\n }\n entriesPublishedCount={selectedEntriesPublishedCount}\n entriesModifiedCount={selectedEntriesModifiedCount}\n entriesWithErrorsCount={selectedEntriesWithErrorsCount}\n />\n <Box marginTop={7}>\n <SelectedEntriesTableContent\n isPublishing={isSubmittingForm}\n rowsToDisplay={rows}\n entriesToPublish={entriesToPublish}\n validationErrors={validationErrors}\n />\n </Box>\n </Modal.Body>\n <Modal.Footer>\n <Button onClick={toggleModal} variant=\"tertiary\">\n {formatMessage({\n id: 'app.components.Button.cancel',\n defaultMessage: 'Cancel',\n })}\n </Button>\n <Flex gap={2}>\n <Button onClick={refetch} variant=\"tertiary\" loading={isFetching}>\n {formatMessage({ id: 'app.utils.refresh', defaultMessage: 'Refresh' })}\n </Button>\n <Button\n onClick={toggleDialog}\n disabled={\n selectedEntries.length === 0 ||\n selectedEntries.length === selectedEntriesWithErrorsCount ||\n selectedEntriesPublishedCount === selectedEntries.length ||\n isLoading\n }\n loading={isPublishing || isSubmittingForm}\n >\n {formatMessage({ id: 'app.utils.publish', defaultMessage: 'Publish' })}\n </Button>\n </Flex>\n </Modal.Footer>\n <ConfirmDialogPublishAll\n isOpen={isDialogOpen}\n onToggleDialog={toggleDialog}\n isConfirmButtonLoading={isPublishing || isSubmittingForm}\n onConfirm={handleConfirmBulkPublish}\n />\n </>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PublishAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst PublishAction: BulkActionComponent = ({ documents, model }) => {\n const { formatMessage } = useIntl();\n // Publish button visibility\n const hasPublishPermission = useDocumentRBAC('unpublishAction', (state) => state.canPublish);\n const showPublishButton =\n hasPublishPermission && documents.some(({ status }) => status !== 'published');\n\n const setListViewSelectedDocuments = useTable('publishAction', (state) => state.selectRow);\n\n const refetchList = () => {\n contentManagerApi.util.invalidateTags([{ type: 'Document', id: `${model}_LIST` }]);\n };\n\n if (!showPublishButton) return null;\n\n return {\n actionType: 'publish',\n variant: 'tertiary',\n label: formatMessage({ id: 'app.utils.publish', defaultMessage: 'Publish' }),\n dialog: {\n type: 'modal',\n title: formatMessage({\n id: getTranslation('containers.ListPage.selectedEntriesModal.title'),\n defaultMessage: 'Publish entries',\n }),\n content: ({ onClose }) => {\n return (\n <Table.Root rows={documents} defaultSelectedRows={documents} headers={TABLE_HEADERS}>\n <SelectedEntriesModalContent\n listViewSelectedEntries={documents}\n toggleModal={() => {\n onClose();\n refetchList();\n }}\n setListViewSelectedDocuments={setListViewSelectedDocuments}\n model={model}\n />\n </Table.Root>\n );\n },\n onClose: () => {\n refetchList();\n },\n },\n };\n};\n\nexport { PublishAction, SelectedEntriesModalContent };\n"],"names":["TypographyMaxWidth","styled","Typography","TableComponent","RawTable","theme","colors","neutral150","spaces","formatErrorMessages","errors","parentKey","formatMessage","messages","Object","entries","forEach","key","value","currentKey","Array","isArray","push","id","defaultMessage","field","EntryValidationText","validationErrors","status","useIntl","validationErrorsMessages","join","_jsxs","Flex","gap","_jsx","CrossCircle","fill","Tooltip","label","textColor","variant","fontWeight","ellipsis","CheckCircle","ArrowsCounterClockwise","TABLE_HEADERS","name","SelectedEntriesTableContent","isPublishing","rowsToDisplay","entriesToPublish","pathname","useLocation","list","settings","mainField","useDocLayout","shouldDisplayMainField","Table","Content","Head","HeaderCheckboxCell","filter","head","map","HeaderCell","Loading","Body","row","Row","CheckboxCell","Cell","DocumentStatus","maxWidth","includes","documentId","Loader","small","IconButton","tag","Link","to","search","locale","state","from","target","marginLeft","Pencil","width","height","PublicationStatusSummary","count","icon","message","justifyContent","flex","PublicationStatusGrid","entriesReadyToPublishCount","entriesPublishedCount","entriesModifiedCount","entriesWithErrorsCount","Box","hasRadius","borderColor","colCount","rowCount","Tbody","Tr","Td","SelectedEntriesModalContent","listViewSelectedEntries","toggleModal","setListViewSelectedDocuments","model","schema","components","useContentTypeSchema","documentIds","query","useQueryParams","params","React","useMemo","buildValidParams","data","isLoading","isFetching","refetch","useGetAllDocumentsQuery","page","pageSize","length","toString","sort","filters","$in","plugins","i18n","selectFromResult","restRes","results","rows","validate","createYupSchema","attributes","entry","validateSync","abortEarly","e","ValidationError","getYupValidationErrors","isDialogOpen","setIsDialogOpen","useState","publishMany","bulkPublishAction","useDocumentActions","isSubmittingForm","usePublishManyDocumentsMutation","selectedRows","useTable","selectedEntries","some","selectedEntry","selectedEntriesWithErrorsCount","selectedEntriesPublishedCount","selectedEntriesModifiedCount","selectedEntriesWithNoErrorsCount","toggleDialog","prev","handleConfirmBulkPublish","res","unpublishedEntries","_Fragment","Modal","marginTop","Footer","Button","onClick","loading","disabled","ConfirmDialogPublishAll","isOpen","onToggleDialog","isConfirmButtonLoading","onConfirm","PublishAction","documents","hasPublishPermission","useDocumentRBAC","canPublish","showPublishButton","selectRow","refetchList","contentManagerApi","util","invalidateTags","type","actionType","dialog","title","getTranslation","content","onClose","Root","defaultSelectedRows","headers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,MAAMA,kBAAAA,GA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,cAAAA,EAAgB;AAClB,aAAA,CAAA;YACAoL,OAAAA,EAAS,CAAC,EAAEC,OAAO,EAAE,GAAA;gBACnB,qBACE1K,cAAA,CAACwB,kBAAMmJ,IAAI,EAAA;oBAAC/D,IAAAA,EAAM8C,SAAAA;oBAAWkB,mBAAAA,EAAqBlB,SAAAA;oBAAWmB,OAAAA,EAASlK,aAAAA;AACpE,oBAAA,QAAA,gBAAAX,cAAA,CAAC4E,2BAAAA,EAAAA;wBACCC,uBAAAA,EAAyB6E,SAAAA;wBACzB5E,WAAAA,EAAa,IAAA;AACX4F,4BAAAA,OAAAA,EAAAA;AACAV,4BAAAA,WAAAA,EAAAA;AACF,wBAAA,CAAA;wBACAjF,4BAAAA,EAA8BA,4BAAAA;wBAC9BC,KAAAA,EAAOA;;;AAIf,YAAA,CAAA;YACA0F,OAAAA,EAAS,IAAA;AACPV,gBAAAA,WAAAA,EAAAA;AACF,YAAA;AACF;AACF,KAAA;AACF;;;;;"}
1
+ {"version":3,"file":"PublishAction.js","sources":["../../../../../../admin/src/pages/ListView/components/BulkActions/PublishAction.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n FormErrors,\n getYupValidationErrors,\n Table,\n useQueryParams,\n useTable,\n} from '@strapi/admin/strapi-admin';\nimport {\n Box,\n Button,\n Flex,\n IconButton,\n Loader,\n Modal,\n Tooltip,\n Typography,\n TypographyComponent,\n RawTable,\n Tr,\n Td,\n Tbody,\n} from '@strapi/design-system';\nimport { ArrowsCounterClockwise, CheckCircle, CrossCircle, Pencil } from '@strapi/icons';\nimport { useIntl, type IntlShape } from 'react-intl';\nimport { Link, useLocation } from 'react-router-dom';\nimport { styled } from 'styled-components';\nimport { ValidationError } from 'yup';\n\nimport { useDocumentRBAC } from '../../../../features/DocumentRBAC';\nimport { useContentTypeSchema } from '../../../../hooks/useContentTypeSchema';\nimport { useDocumentActions } from '../../../../hooks/useDocumentActions';\nimport { useDocLayout } from '../../../../hooks/useDocumentLayout';\nimport { contentManagerApi } from '../../../../services/api';\nimport {\n useGetAllDocumentsQuery,\n usePublishManyDocumentsMutation,\n} from '../../../../services/documents';\nimport { buildValidParams } from '../../../../utils/api';\nimport { getTranslation } from '../../../../utils/translations';\nimport { createYupSchema } from '../../../../utils/validation';\nimport { DocumentStatus } from '../../../EditView/components/DocumentStatus';\n\nimport { ConfirmDialogPublishAll, ConfirmDialogPublishAllProps } from './ConfirmBulkActionDialog';\n\nimport type { BulkActionComponent } from '../../../../content-manager';\nimport type { Document } from '../../../../hooks/useDocument';\n\nconst TypographyMaxWidth = styled<TypographyComponent>(Typography)`\n max-width: 300px;\n`;\n\nconst TableComponent = styled(RawTable)`\n width: 100%;\n table-layout: fixed;\n td:first-child {\n border-right: 1px solid ${({ theme }) => theme.colors.neutral150};\n }\n td:first-of-type {\n padding: ${({ theme }) => theme.spaces[4]};\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * EntryValidationText\n * -----------------------------------------------------------------------------------------------*/\n\nexport const formatErrorMessages = (\n errors: FormErrors,\n parentKey: string,\n formatMessage: IntlShape['formatMessage']\n) => {\n if (!errors) return [];\n\n const messages: string[] = [];\n\n Object.entries(errors).forEach(([key, value]) => {\n const currentKey = parentKey ? `${parentKey}.${key}` : key;\n\n if (!value) return;\n const isErrorMessageDescriptor =\n typeof value === 'object' && 'id' in value && 'defaultMessage' in value;\n if (isErrorMessageDescriptor || typeof value === 'string') {\n const id = isErrorMessageDescriptor ? value.id : value;\n const defaultMessage = isErrorMessageDescriptor\n ? (value.defaultMessage as string)\n : (value as string);\n messages.push(\n formatMessage(\n {\n id: `${id}.withField`,\n defaultMessage,\n },\n { field: currentKey }\n )\n );\n } else {\n messages.push(\n ...formatErrorMessages(value as unknown as FormErrors, currentKey, formatMessage)\n );\n }\n });\n\n return messages;\n};\n\ninterface EntryValidationTextProps {\n validationErrors?: FormErrors;\n status: string;\n}\n\nconst EntryValidationText = ({ validationErrors, status }: EntryValidationTextProps) => {\n const { formatMessage } = useIntl();\n\n if (validationErrors) {\n const validationErrorsMessages = formatErrorMessages(validationErrors, '', formatMessage).join(\n ' '\n );\n\n return (\n <Flex gap={2}>\n <CrossCircle fill=\"danger600\" />\n <Tooltip label={validationErrorsMessages}>\n <TypographyMaxWidth textColor=\"danger600\" variant=\"omega\" fontWeight=\"bold\" ellipsis>\n {validationErrorsMessages}\n </TypographyMaxWidth>\n </Tooltip>\n </Flex>\n );\n }\n\n if (status === 'published') {\n return (\n <Flex gap={2}>\n <CheckCircle fill=\"success600\" />\n <Typography textColor=\"success600\" fontWeight=\"bold\">\n {formatMessage({\n id: 'content-manager.bulk-publish.already-published',\n defaultMessage: 'Already Published',\n })}\n </Typography>\n </Flex>\n );\n }\n\n if (status === 'modified') {\n return (\n <Flex gap={2}>\n <ArrowsCounterClockwise fill=\"alternative600\" />\n <Typography textColor=\"alternative600\" fontWeight=\"bold\">\n {formatMessage({\n id: 'content-manager.bulk-publish.modified',\n defaultMessage: 'Ready to publish changes',\n })}\n </Typography>\n </Flex>\n );\n }\n\n return (\n <Flex gap={2}>\n <CheckCircle fill=\"success600\" />\n <Typography textColor=\"success600\" fontWeight=\"bold\">\n {formatMessage({\n id: 'app.utils.ready-to-publish',\n defaultMessage: 'Ready to publish',\n })}\n </Typography>\n </Flex>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * SelectedEntriesTableContent\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SelectedEntriesTableContentProps {\n isPublishing?: boolean;\n rowsToDisplay?: TableRow[];\n entriesToPublish?: TableRow['documentId'][];\n validationErrors: Record<string, EntryValidationTextProps['validationErrors']>;\n}\n\nconst TABLE_HEADERS = [\n { name: 'id', label: 'id' },\n { name: 'name', label: 'name' },\n { name: 'status', label: 'status' },\n { name: 'publicationStatus', label: 'Publication status' },\n];\n\nconst SelectedEntriesTableContent = ({\n isPublishing,\n rowsToDisplay = [],\n entriesToPublish = [],\n validationErrors = {},\n}: SelectedEntriesTableContentProps) => {\n const { pathname } = useLocation();\n const { formatMessage } = useIntl();\n\n const {\n list: {\n settings: { mainField },\n },\n } = useDocLayout();\n\n const shouldDisplayMainField = mainField != null && mainField !== 'id';\n\n return (\n <Table.Content>\n <Table.Head>\n <Table.HeaderCheckboxCell />\n {TABLE_HEADERS.filter((head) => head.name !== 'name' || shouldDisplayMainField).map(\n (head) => (\n <Table.HeaderCell key={head.name} {...head} />\n )\n )}\n </Table.Head>\n <Table.Loading />\n <Table.Body>\n {rowsToDisplay.map((row) => (\n <Table.Row key={row.id}>\n <Table.CheckboxCell id={row.id} />\n <Table.Cell>\n <Typography>{row.id}</Typography>\n </Table.Cell>\n {shouldDisplayMainField && (\n <Table.Cell>\n <Typography>{row[mainField as keyof TableRow]}</Typography>\n </Table.Cell>\n )}\n <Table.Cell>\n <DocumentStatus status={row.status} maxWidth={'min-content'} />\n </Table.Cell>\n <Table.Cell>\n {isPublishing && entriesToPublish.includes(row.documentId) ? (\n <Flex gap={2}>\n <Typography>\n {formatMessage({\n id: 'content-manager.success.record.publishing',\n defaultMessage: 'Publishing...',\n })}\n </Typography>\n <Loader small />\n </Flex>\n ) : (\n <EntryValidationText\n validationErrors={validationErrors[row.documentId]}\n status={row.status}\n />\n )}\n </Table.Cell>\n <Table.Cell>\n <Flex>\n <IconButton\n tag={Link}\n to={{\n pathname: `${pathname}/${row.documentId}`,\n search: row.locale && `?plugins[i18n][locale]=${row.locale}`,\n }}\n state={{ from: pathname }}\n label={formatMessage({\n id: 'content-manager.bulk-publish.edit',\n defaultMessage: 'Edit',\n })}\n target=\"_blank\"\n marginLeft=\"auto\"\n variant=\"ghost\"\n >\n <Pencil width={'1.6rem'} height={'1.6rem'} />\n </IconButton>\n </Flex>\n </Table.Cell>\n </Table.Row>\n ))}\n </Table.Body>\n </Table.Content>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PublicationStatusSummary\n * -----------------------------------------------------------------------------------------------*/\n\ninterface PublicationStatusSummaryProps {\n count: number;\n icon: React.ReactNode;\n message: string;\n textColor: string;\n}\n\nconst PublicationStatusSummary = ({\n count,\n icon,\n message,\n textColor,\n}: PublicationStatusSummaryProps) => {\n return (\n <Flex justifyContent=\"space-between\" flex={1} gap={3}>\n <Flex gap={2}>\n {icon}\n <Typography textColor={textColor} fontWeight=\"bold\">\n {message}\n </Typography>\n </Flex>\n <Typography fontWeight=\"bold\">{count}</Typography>\n </Flex>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PublicationStatusGrid\n * -----------------------------------------------------------------------------------------------*/\n\ninterface PublicationStatusGridProps {\n entriesReadyToPublishCount: number;\n entriesModifiedCount: number;\n entriesPublishedCount: number;\n entriesWithErrorsCount: number;\n}\n\nconst PublicationStatusGrid = ({\n entriesReadyToPublishCount,\n entriesPublishedCount,\n entriesModifiedCount,\n entriesWithErrorsCount,\n}: PublicationStatusGridProps) => {\n const { formatMessage } = useIntl();\n\n return (\n <Box hasRadius borderColor=\"neutral150\">\n <TableComponent colCount={2} rowCount={2}>\n <Tbody>\n <Tr>\n <Td>\n <PublicationStatusSummary\n textColor=\"success600\"\n count={entriesReadyToPublishCount}\n icon={<CheckCircle fill=\"success600\" />}\n message={formatMessage({\n id: 'app.utils.ready-to-publish',\n defaultMessage: 'Ready to publish',\n })}\n />\n </Td>\n <Td>\n <PublicationStatusSummary\n textColor=\"success600\"\n count={entriesPublishedCount}\n icon={<CheckCircle fill=\"success600\" />}\n message={formatMessage({\n id: 'app.utils.already-published',\n defaultMessage: 'Already published',\n })}\n />\n </Td>\n </Tr>\n <Tr>\n <Td>\n <PublicationStatusSummary\n textColor=\"alternative600\"\n count={entriesModifiedCount}\n icon={<ArrowsCounterClockwise fill=\"alternative600\" />}\n message={formatMessage({\n id: 'content-manager.bulk-publish.modified',\n defaultMessage: 'Ready to publish changes',\n })}\n />\n </Td>\n <Td>\n <PublicationStatusSummary\n textColor=\"danger600\"\n count={entriesWithErrorsCount}\n icon={<CrossCircle fill=\"danger600\" />}\n message={formatMessage({\n id: 'content-manager.bulk-publish.waiting-for-action',\n defaultMessage: 'Waiting for action',\n })}\n />\n </Td>\n </Tr>\n </Tbody>\n </TableComponent>\n </Box>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * SelectedEntriesModalContent\n * -----------------------------------------------------------------------------------------------*/\n\ninterface TableRow extends Document {}\n\ninterface SelectedEntriesModalContentProps {\n listViewSelectedEntries: TableRow[];\n toggleModal: ConfirmDialogPublishAllProps['onToggleDialog'];\n setListViewSelectedDocuments: (documents: TableRow[]) => void;\n model: string;\n}\n\nconst SelectedEntriesModalContent = ({\n listViewSelectedEntries,\n toggleModal,\n setListViewSelectedDocuments,\n model,\n}: SelectedEntriesModalContentProps) => {\n const { formatMessage } = useIntl();\n const { schema, components } = useContentTypeSchema(model);\n const documentIds = listViewSelectedEntries.map(({ documentId }) => documentId);\n\n // We want to keep the selected entries order same as the list view\n const [{ query }] = useQueryParams<{ sort?: string; plugins?: Record<string, any> }>();\n const params = React.useMemo(() => buildValidParams(query), [query]);\n\n // Fetch the documents based on the selected entries and update the modal table\n const { data, isLoading, isFetching, refetch } = useGetAllDocumentsQuery(\n {\n model,\n params: {\n page: '1',\n pageSize: documentIds.length.toString(),\n sort: query.sort,\n filters: {\n documentId: {\n $in: documentIds,\n },\n },\n locale: query.plugins?.i18n?.locale,\n },\n },\n {\n selectFromResult: ({ data, ...restRes }) => ({ data: data?.results ?? [], ...restRes }),\n }\n );\n\n // Validate the entries based on the schema to show errors if any\n const { rows, validationErrors } = React.useMemo(() => {\n if (data.length > 0 && schema) {\n const validate = createYupSchema(\n schema.attributes,\n components,\n // Since this is the \"Publish\" action, the validation\n // schema must enforce the rules for published entities\n { status: 'published' }\n );\n const validationErrors: Record<TableRow['documentId'], FormErrors> = {};\n const rows = data.map((entry: Document) => {\n try {\n validate.validateSync(entry, { abortEarly: false });\n\n return entry;\n } catch (e) {\n if (e instanceof ValidationError) {\n validationErrors[entry.documentId] = getYupValidationErrors(e);\n }\n\n return entry;\n }\n });\n\n return { rows, validationErrors };\n }\n\n return {\n rows: [],\n validationErrors: {},\n };\n }, [components, data, schema]);\n\n const [isDialogOpen, setIsDialogOpen] = React.useState(false);\n\n const { publishMany: bulkPublishAction, isLoading: isPublishing } = useDocumentActions();\n const [, { isLoading: isSubmittingForm }] = usePublishManyDocumentsMutation();\n\n const selectedRows = useTable('publishAction', (state) => state.selectedRows);\n\n // Filter selected entries from the updated modal table rows\n const selectedEntries = rows.filter((entry) =>\n selectedRows.some((selectedEntry) => selectedEntry.documentId === entry.documentId)\n );\n\n const entriesToPublish = selectedEntries\n .filter((entry) => !validationErrors[entry.documentId])\n .map((entry) => entry.documentId);\n\n const selectedEntriesWithErrorsCount = selectedEntries.filter(\n ({ documentId }) => validationErrors[documentId]\n ).length;\n const selectedEntriesPublishedCount = selectedEntries.filter(\n ({ status }) => status === 'published'\n ).length;\n const selectedEntriesModifiedCount = selectedEntries.filter(\n ({ status, documentId }) => status === 'modified' && !validationErrors[documentId]\n ).length;\n const selectedEntriesWithNoErrorsCount =\n selectedEntries.length - selectedEntriesWithErrorsCount - selectedEntriesPublishedCount;\n\n const toggleDialog = () => setIsDialogOpen((prev) => !prev);\n\n const handleConfirmBulkPublish = async () => {\n toggleDialog();\n\n const res = await bulkPublishAction({ model: model, documentIds: entriesToPublish, params });\n if (!('error' in res)) {\n const unpublishedEntries = rows.filter((row) => {\n return !entriesToPublish.includes(row.documentId);\n });\n // Keep selection of the entries in list view that were not published\n setListViewSelectedDocuments(unpublishedEntries);\n }\n };\n\n return (\n <>\n <Modal.Body>\n <PublicationStatusGrid\n entriesReadyToPublishCount={\n selectedEntriesWithNoErrorsCount - selectedEntriesModifiedCount\n }\n entriesPublishedCount={selectedEntriesPublishedCount}\n entriesModifiedCount={selectedEntriesModifiedCount}\n entriesWithErrorsCount={selectedEntriesWithErrorsCount}\n />\n <Box marginTop={7}>\n <SelectedEntriesTableContent\n isPublishing={isSubmittingForm}\n rowsToDisplay={rows}\n entriesToPublish={entriesToPublish}\n validationErrors={validationErrors}\n />\n </Box>\n </Modal.Body>\n <Modal.Footer>\n <Button onClick={toggleModal} variant=\"tertiary\">\n {formatMessage({\n id: 'app.components.Button.cancel',\n defaultMessage: 'Cancel',\n })}\n </Button>\n <Flex gap={2}>\n <Button onClick={refetch} variant=\"tertiary\" loading={isFetching}>\n {formatMessage({ id: 'app.utils.refresh', defaultMessage: 'Refresh' })}\n </Button>\n <Button\n onClick={toggleDialog}\n disabled={\n selectedEntries.length === 0 ||\n selectedEntries.length === selectedEntriesWithErrorsCount ||\n selectedEntriesPublishedCount === selectedEntries.length ||\n isLoading\n }\n loading={isPublishing || isSubmittingForm}\n >\n {formatMessage({ id: 'app.utils.publish', defaultMessage: 'Publish' })}\n </Button>\n </Flex>\n </Modal.Footer>\n <ConfirmDialogPublishAll\n isOpen={isDialogOpen}\n onToggleDialog={toggleDialog}\n isConfirmButtonLoading={isPublishing || isSubmittingForm}\n onConfirm={handleConfirmBulkPublish}\n />\n </>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PublishAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst PublishAction: BulkActionComponent = ({ documents, model }) => {\n const { formatMessage } = useIntl();\n // Publish button visibility\n const hasPublishPermission = useDocumentRBAC('unpublishAction', (state) => state.canPublish);\n const showPublishButton =\n hasPublishPermission && documents.some(({ status }) => status !== 'published');\n\n const setListViewSelectedDocuments = useTable('publishAction', (state) => state.selectRow);\n\n const refetchList = () => {\n contentManagerApi.util.invalidateTags([{ type: 'Document', id: `${model}_LIST` }]);\n };\n\n if (!showPublishButton) return null;\n\n return {\n actionType: 'publish',\n variant: 'tertiary',\n label: formatMessage({ id: 'app.utils.publish', defaultMessage: 'Publish' }),\n dialog: {\n type: 'modal',\n title: formatMessage({\n id: getTranslation('containers.ListPage.selectedEntriesModal.title'),\n defaultMessage: 'Publish entries',\n }),\n content: ({ onClose }) => {\n return (\n <Table.Root rows={documents} defaultSelectedRows={documents} headers={TABLE_HEADERS}>\n <SelectedEntriesModalContent\n listViewSelectedEntries={documents}\n toggleModal={() => {\n onClose();\n refetchList();\n }}\n setListViewSelectedDocuments={setListViewSelectedDocuments}\n model={model}\n />\n </Table.Root>\n );\n },\n onClose: () => {\n refetchList();\n },\n },\n };\n};\n\nexport { PublishAction, SelectedEntriesModalContent };\n"],"names":["TypographyMaxWidth","styled","Typography","TableComponent","RawTable","theme","colors","neutral150","spaces","formatErrorMessages","errors","parentKey","formatMessage","messages","Object","entries","forEach","key","value","currentKey","isErrorMessageDescriptor","id","defaultMessage","push","field","EntryValidationText","validationErrors","status","useIntl","validationErrorsMessages","join","_jsxs","Flex","gap","_jsx","CrossCircle","fill","Tooltip","label","textColor","variant","fontWeight","ellipsis","CheckCircle","ArrowsCounterClockwise","TABLE_HEADERS","name","SelectedEntriesTableContent","isPublishing","rowsToDisplay","entriesToPublish","pathname","useLocation","list","settings","mainField","useDocLayout","shouldDisplayMainField","Table","Content","Head","HeaderCheckboxCell","filter","head","map","HeaderCell","Loading","Body","row","Row","CheckboxCell","Cell","DocumentStatus","maxWidth","includes","documentId","Loader","small","IconButton","tag","Link","to","search","locale","state","from","target","marginLeft","Pencil","width","height","PublicationStatusSummary","count","icon","message","justifyContent","flex","PublicationStatusGrid","entriesReadyToPublishCount","entriesPublishedCount","entriesModifiedCount","entriesWithErrorsCount","Box","hasRadius","borderColor","colCount","rowCount","Tbody","Tr","Td","SelectedEntriesModalContent","listViewSelectedEntries","toggleModal","setListViewSelectedDocuments","model","schema","components","useContentTypeSchema","documentIds","query","useQueryParams","params","React","useMemo","buildValidParams","data","isLoading","isFetching","refetch","useGetAllDocumentsQuery","page","pageSize","length","toString","sort","filters","$in","plugins","i18n","selectFromResult","restRes","results","rows","validate","createYupSchema","attributes","entry","validateSync","abortEarly","e","ValidationError","getYupValidationErrors","isDialogOpen","setIsDialogOpen","useState","publishMany","bulkPublishAction","useDocumentActions","isSubmittingForm","usePublishManyDocumentsMutation","selectedRows","useTable","selectedEntries","some","selectedEntry","selectedEntriesWithErrorsCount","selectedEntriesPublishedCount","selectedEntriesModifiedCount","selectedEntriesWithNoErrorsCount","toggleDialog","prev","handleConfirmBulkPublish","res","unpublishedEntries","_Fragment","Modal","marginTop","Footer","Button","onClick","loading","disabled","ConfirmDialogPublishAll","isOpen","onToggleDialog","isConfirmButtonLoading","onConfirm","PublishAction","documents","hasPublishPermission","useDocumentRBAC","canPublish","showPublishButton","selectRow","refetchList","contentManagerApi","util","invalidateTags","type","actionType","dialog","title","getTranslation","content","onClose","Root","defaultSelectedRows","headers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,MAAMA,kBAAAA,GAAqBC,uBAAAA,CAA4BC,uBAAAA,CAAW;;AAElE,CAAC;AAED,MAAMC,cAAAA,GAAiBF,uBAAAA,CAAOG,qBAAAA,CAAS;;;;4BAIX,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAACC,UAAU,CAAC;;;aAGxD,EAAE,CAAC,EAAEF,KAAK,EAAE,GAAKA,KAAAA,CAAMG,MAAM,CAAC,CAAA,CAAE,CAAC;;AAE9C,CAAC;AAED;;AAEkG,qGAE3F,MAAMC,mBAAAA,GAAsB,CACjCC,QACAC,SAAAA,EACAC,aAAAA,GAAAA;IAEA,IAAI,CAACF,MAAAA,EAAQ,OAAO,EAAE;AAEtB,IAAA,MAAMG,WAAqB,EAAE;IAE7BC,MAAAA,CAAOC,OAAO,CAACL,MAAAA,CAAAA,CAAQM,OAAO,CAAC,CAAC,CAACC,KAAKC,KAAAA,CAAM,GAAA;AAC1C,QAAA,MAAMC,aAAaR,SAAAA,GAAY,CAAA,EAAGA,UAAU,CAAC,EAAEM,KAAK,GAAGA,GAAAA;AAEvD,QAAA,IAAI,CAACC,KAAAA,EAAO;AACZ,QAAA,MAAME,2BACJ,OAAOF,KAAAA,KAAU,QAAA,IAAY,IAAA,IAAQA,SAAS,gBAAA,IAAoBA,KAAAA;QACpE,IAAIE,wBAAAA,IAA4B,OAAO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