Files
pole-book/server/node_modules/@strapi/content-manager/dist/admin/hooks/useDocumentLayout.mjs.map

1 line
24 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"version":3,"file":"useDocumentLayout.mjs","sources":["../../../admin/src/hooks/useDocumentLayout.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { SerializedError } from '@reduxjs/toolkit';\nimport {\n useNotification,\n useStrapiApp,\n useAPIErrorHandler,\n useQueryParams,\n} from '@strapi/admin/strapi-admin';\n\nimport { HOOKS } from '../constants/hooks';\nimport { useGetContentTypeConfigurationQuery } from '../services/contentTypes';\nimport { BaseQueryError } from '../utils/api';\nimport { getMainField } from '../utils/attributes';\n\nimport { useContentTypeSchema } from './useContentTypeSchema';\nimport {\n type ComponentsDictionary,\n type Document,\n type Schema,\n useDoc,\n useDocument,\n} from './useDocument';\n\nimport type { ComponentConfiguration } from '../../../shared/contracts/components';\nimport type {\n Metadatas,\n FindContentTypeConfiguration,\n Settings,\n} from '../../../shared/contracts/content-types';\nimport type { Filters, InputProps, Table } from '@strapi/admin/strapi-admin';\nimport type { Schema as SchemaUtils } from '@strapi/types';\n\ntype LayoutOptions = Schema['options'] & Schema['pluginOptions'] & object;\n\ninterface LayoutSettings extends Settings {\n displayName?: string;\n icon?: never;\n}\n\ninterface ListFieldLayout\n extends Table.Header<Document, ListFieldLayout>,\n Pick<Filters.Filter, 'mainField'> {\n attribute: SchemaUtils.Attribute.AnyAttribute | { type: 'custom' };\n}\n\ninterface ListLayout {\n layout: ListFieldLayout[];\n components?: never;\n metadatas: {\n [K in keyof Metadatas]: Metadatas[K]['list'];\n };\n options: LayoutOptions;\n settings: LayoutSettings;\n}\ninterface EditFieldSharedProps\n extends Omit<InputProps, 'hint' | 'label' | 'type'>,\n Pick<Filters.Filter, 'mainField'> {\n hint?: string;\n label: string;\n size: number;\n unique?: boolean;\n visible?: boolean;\n}\n\n/**\n * Map over all the types in Attribute Types and use that to create a union of new types where the attribute type\n * is under the property attribute and the type is under the property type.\n */\ntype EditFieldLayout = {\n [K in SchemaUtils.Attribute.Kind]: EditFieldSharedProps & {\n attribute: Extract<SchemaUtils.Attribute.AnyAttribute, { type: K }>;\n type: K;\n };\n}[SchemaUtils.Attribute.Kind];\n\ninterface EditLayout {\n layout: Array<Array<EditFieldLayout[]>>;\n components: {\n [uid: string]: {\n layout: Array<EditFieldLayout[]>;\n settings: ComponentConfiguration['settings'] & {\n displayName?: string;\n icon?: string;\n };\n };\n };\n metadatas: {\n [K in keyof Metadatas]: Metadatas[K]['edit'];\n };\n options: LayoutOptions;\n settings: LayoutSettings;\n}\n\ntype UseDocumentLayout = (model: string) => {\n error?: BaseQueryError | SerializedError;\n isLoading: boolean;\n /**\n * This is the layout for the edit view,\n */\n edit: EditLayout;\n list: ListLayout;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * useDocumentLayout\n * -----------------------------------------------------------------------------------------------*/\n\nconst DEFAULT_SETTINGS = {\n bulkable: false,\n filterable: false,\n searchable: false,\n pagination: false,\n defaultSortBy: '',\n defaultSortOrder: 'asc',\n mainField: 'id',\n pageSize: 10,\n};\n\n/**\n * @alpha\n * @description This hook is used to get the layouts for either the edit view or list view of a specific content-type\n * including the layouts for the components used in the content-type. It also runs the mutation hook waterfall so the data\n * is consistent wherever it is used. It's a light wrapper around the `useDocument` hook, but provides the `skip` option a document\n * is not fetched, however, it does fetch the schemas & components if they do not already exist in the cache.\n *\n * If the fetch fails, it will display a notification to the user.\n *\n * @example\n * ```tsx\n * const { model } = useParams<{ model: string }>();\n * const { edit: { schema: layout } } = useDocumentLayout(model);\n *\n * return layout.map(panel => panel.map(row => row.map(field => <Field.Root {...field} />)))\n * ```\n *\n */\nconst useDocumentLayout: UseDocumentLayout = (model) => {\n const { schema, components } = useDocument({ model, collectionType: '' }, { skip: true });\n const [{ query }] = useQueryParams();\n const runHookWaterfall = useStrapiApp('useDocumentLayout', (state) => state.runHookWaterfall);\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();\n\n const {\n data,\n isLoading: isLoadingConfigs,\n error,\n isFetching: isFetchingConfigs,\n } = useGetContentTypeConfigurationQuery(model);\n\n const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n const editLayout = React.useMemo(\n () =>\n data && !isLoading\n ? formatEditLayout(data, { schemas, schema, components })\n : ({\n layout: [],\n components: {},\n metadatas: {},\n options: {},\n settings: DEFAULT_SETTINGS,\n } as EditLayout),\n [data, isLoading, schemas, schema, components]\n );\n\n const listLayout = React.useMemo(() => {\n return data && !isLoading\n ? formatListLayout(data, { schemas, schema, components })\n : ({\n layout: [],\n metadatas: {},\n options: {},\n settings: DEFAULT_SETTINGS,\n } as ListLayout);\n }, [data, isLoading, schemas, schema, components]);\n\n const { layout: edit } = React.useMemo(\n () =>\n runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {\n layout: editLayout,\n query,\n }),\n [editLayout, query, runHookWaterfall]\n );\n\n return {\n error,\n isLoading,\n edit,\n list: listLayout,\n } satisfies ReturnType<UseDocumentLayout>;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * useDocLayout\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal this hook uses the internal useDoc hook, as such it shouldn't be used outside of the\n * content-manager because it won't work as intended.\n */\nconst useDocLayout = () => {\n const { model } = useDoc();\n return useDocumentLayout(model);\n};\n\n/* -------------------------------------------------------------------------------------------------\n * formatEditLayout\n * -----------------------------------------------------------------------------------------------*/\ntype LayoutData = FindContentTypeConfiguration.Response['data'];\n\n/**\n * @internal\n * @description takes the configuration data, the schema & the components used in the schema and formats the edit view\n * versions of the schema & components. This is then used to render the edit view of the content-type.\n */\nconst formatEditLayout = (\n data: LayoutData,\n {\n schemas,\n schema,\n components,\n }: { schemas: Schema[]; schema?: Schema; components: ComponentsDictionary }\n): EditLayout => {\n let currentPanelIndex = 0;\n /**\n * The fields arranged by the panels, new panels are made for dynamic zones only.\n */\n const panelledEditAttributes = convertEditLayoutToFieldLayouts(\n data.contentType.layouts.edit,\n schema?.attributes,\n data.contentType.metadatas,\n { configurations: data.components, schemas: components },\n schemas\n ).reduce<Array<EditFieldLayout[][]>>((panels, row) => {\n if (row.some((field) => field.type === 'dynamiczone')) {\n panels.push([row]);\n currentPanelIndex += 2;\n } else {\n if (!panels[currentPanelIndex]) {\n panels.push([row]);\n } else {\n panels[currentPanelIndex].push(row);\n }\n }\n\n return panels;\n }, []);\n\n const componentEditAttributes = Object.entries(data.components).reduce<EditLayout['components']>(\n (acc, [uid, configuration]) => {\n acc[uid] = {\n layout: convertEditLayoutToFieldLayouts(\n configuration.layouts.edit,\n components[uid].attributes,\n configuration.metadatas,\n { configurations: data.components, schemas: components }\n ),\n settings: {\n ...configuration.settings,\n icon: components[uid].info.icon,\n displayName: components[uid].info.displayName,\n },\n };\n return acc;\n },\n {}\n );\n\n const editMetadatas = Object.entries(data.contentType.metadatas).reduce<EditLayout['metadatas']>(\n (acc, [attribute, metadata]) => {\n return {\n ...acc,\n [attribute]: metadata.edit,\n };\n },\n {}\n );\n\n return {\n layout: panelledEditAttributes,\n components: componentEditAttributes,\n metadatas: editMetadatas,\n settings: {\n ...data.contentType.settings,\n displayName: schema?.info.displayName,\n },\n options: {\n ...schema?.options,\n ...schema?.pluginOptions,\n ...data.contentType.options,\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * convertEditLayoutToFieldLayouts\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description takes the edit layout from either a content-type or a component\n * and formats it into a generic object that can be used to correctly render\n * the form fields.\n */\nconst convertEditLayoutToFieldLayouts = (\n rows: LayoutData['contentType']['layouts']['edit'],\n attributes: Schema['attributes'] = {},\n metadatas: Metadatas,\n components?: {\n configurations: Record<string, ComponentConfiguration>;\n schemas: ComponentsDictionary;\n },\n schemas: Schema[] = []\n) => {\n return rows.map((row) =>\n row\n .map((field) => {\n const attribute = attributes[field.name];\n\n if (!attribute) {\n return null;\n }\n\n const { edit: metadata } = metadatas[field.name];\n\n const settings: Partial<Settings> =\n attribute.type === 'component' && components\n ? components.configurations[attribute.component].settings\n : {};\n\n return {\n attribute,\n disabled: !metadata.editable,\n hint: metadata.description,\n label: metadata.label ?? '',\n name: field.name,\n // @ts-expect-error mainField does exist on the metadata for a relation.\n mainField: getMainField(attribute, metadata.mainField || settings.mainField, {\n schemas,\n components: components?.schemas ?? {},\n }),\n placeholder: metadata.placeholder ?? '',\n required: attribute.required ?? false,\n size: field.size,\n unique: 'unique' in attribute ? attribute.unique : false,\n visible: metadata.visible ?? true,\n type: attribute.type,\n };\n })\n .filter((field) => field !== null)\n ) as EditFieldLayout[][];\n};\n\n/* -------------------------------------------------------------------------------------------------\n * formatListLayout\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description takes the complete configuration data, the schema & the components used in the schema and\n * formats a list view layout for the content-type. This is much simpler than the edit view layout as there\n * are less options to consider.\n */\nconst formatListLayout = (\n data: LayoutData,\n {\n schemas,\n schema,\n components,\n }: { schemas: Schema[]; schema?: Schema; components: ComponentsDictionary }\n): ListLayout => {\n const listMetadatas = Object.entries(data.contentType.metadatas).reduce<ListLayout['metadatas']>(\n (acc, [attribute, metadata]) => {\n return {\n ...acc,\n [attribute]: metadata.list,\n };\n },\n {}\n );\n /**\n * The fields arranged by the panels, new panels are made for dynamic zones only.\n */\n const listAttributes = convertListLayoutToFieldLayouts(\n data.contentType.layouts.list,\n schema?.attributes,\n listMetadatas,\n { configurations: data.components, schemas: components },\n schemas\n );\n\n return {\n layout: listAttributes,\n settings: { ...data.contentType.settings, displayName: schema?.info.displayName },\n metadatas: listMetadatas,\n options: {\n ...schema?.options,\n ...schema?.pluginOptions,\n ...data.contentType.options,\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * convertListLayoutToFieldLayouts\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n * @description takes the columns from the list view configuration and formats them into a generic object\n * combinining metadata and attribute data.\n *\n * @note We do use this to reformat the list of strings when updating the displayed headers for the list view.\n */\nconst convertListLayoutToFieldLayouts = (\n columns: LayoutData['contentType']['layouts']['list'],\n attributes: Schema['attributes'] = {},\n metadatas: ListLayout['metadatas'],\n components?: {\n configurations: Record<string, ComponentConfiguration>;\n schemas: ComponentsDictionary;\n },\n schemas: Schema[] = []\n) => {\n return columns\n .map((name) => {\n const attribute = attributes[name];\n\n if (!attribute) {\n return null;\n }\n\n const metadata = metadatas[name];\n\n const settings: Partial<Settings> =\n attribute.type === 'component' && components\n ? components.configurations[attribute.component].settings\n : {};\n\n return {\n attribute,\n label: metadata.label ?? '',\n mainField: getMainField(attribute, metadata.mainField || settings.mainField, {\n schemas,\n components: components?.schemas ?? {},\n }),\n name: name,\n searchable: metadata.searchable ?? true,\n sortable: metadata.sortable ?? true,\n } satisfies ListFieldLayout;\n })\n .filter((field) => field !== null) as ListFieldLayout[];\n};\n\nexport {\n useDocLayout,\n useDocumentLayout,\n convertListLayoutToFieldLayouts,\n convertEditLayoutToFieldLayouts,\n DEFAULT_SETTINGS,\n};\nexport type { EditLayout, EditFieldLayout, ListLayout, ListFieldLayout, UseDocumentLayout };\n"],"names":["DEFAULT_SETTINGS","bulkable","filterable","searchable","pagination","defaultSortBy","defaultSortOrder","mainField","pageSize","useDocumentLayout","model","schema","components","useDocument","collectionType","skip","query","useQueryParams","runHookWaterfall","useStrapiApp","state","toggleNotification","useNotification","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","isLoading","isLoadingSchemas","schemas","useContentTypeSchema","data","isLoadingConfigs","error","isFetching","isFetchingConfigs","useGetContentTypeConfigurationQuery","React","useEffect","type","message","editLayout","useMemo","formatEditLayout","layout","metadatas","options","settings","listLayout","formatListLayout","edit","HOOKS","MUTATE_EDIT_VIEW_LAYOUT","list","useDocLayout","useDoc","currentPanelIndex","panelledEditAttributes","convertEditLayoutToFieldLayouts","contentType","layouts","attributes","configurations","reduce","panels","row","some","field","push","componentEditAttributes","Object","entries","acc","uid","configuration","icon","info","displayName","editMetadatas","attribute","metadata","pluginOptions","rows","map","name","component","disabled","editable","hint","description","label","getMainField","placeholder","required","size","unique","visible","filter","listMetadatas","listAttributes","convertListLayoutToFieldLayouts","columns","sortable"],"mappings":";;;;;;;;AAwGA;;AAEkG,2GAE5FA,gBAAmB,GAAA;IACvBC,QAAU,EAAA,KAAA;IACVC,UAAY,EAAA,KAAA;IACZC,UAAY,EAAA,KAAA;IACZC,UAAY,EAAA,KAAA;IACZC,aAAe,EAAA,EAAA;IACfC,gBAAkB,EAAA,KAAA;IAClBC,SAAW,EAAA,IAAA;IACXC,QAAU,EAAA;AACZ;AAEA;;;;;;;;;;;;;;;;;IAkBA,MAAMC,oBAAuC,CAACC,KAAAA,GAAAA;AAC5C,IAAA,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAE,GAAGC,WAAY,CAAA;AAAEH,QAAAA,KAAAA;QAAOI,cAAgB,EAAA;KAAM,EAAA;QAAEC,IAAM,EAAA;AAAK,KAAA,CAAA;AACvF,IAAA,MAAM,CAAC,EAAEC,KAAK,EAAE,CAAC,GAAGC,cAAAA,EAAAA;AACpB,IAAA,MAAMC,mBAAmBC,YAAa,CAAA,mBAAA,EAAqB,CAACC,KAAAA,GAAUA,MAAMF,gBAAgB,CAAA;IAC5F,MAAM,EAAEG,kBAAkB,EAAE,GAAGC,eAAAA,EAAAA;AAC/B,IAAA,MAAM,EAAEC,uBAAAA,EAAyBC,cAAc,EAAE,GAAGC,kBAAAA,EAAAA;AACpD,IAAA,MAAM,EAAEC,SAAWC,EAAAA,gBAAgB,EAAEC,OAAO,EAAE,GAAGC,oBAAAA,EAAAA;AAEjD,IAAA,M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