@woodylab/payload 0.0.131 → 0.0.132
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.
- package/dist/LayoutRenderer-B1IoWb16.js +2 -0
- package/dist/LayoutRenderer-B1IoWb16.js.map +1 -0
- package/dist/LayoutRenderer-Ba6ITI7O.js +2 -0
- package/dist/LayoutRenderer-Ba6ITI7O.js.map +1 -0
- package/dist/config/blocks/blockCard.d.ts +2 -0
- package/dist/config/blocks/blockCard.js +101 -0
- package/dist/config/blocks/blockReference.d.ts +2 -0
- package/dist/config/blocks/blockReference.js +11 -0
- package/dist/config/{blockView.js → blocks/blockView.js} +35 -91
- package/dist/config/collections/collectionBlocks.d.ts +2 -0
- package/dist/config/collections/collectionBlocks.js +35 -0
- package/dist/config/{collectionComponentDefinitions.d.ts → collections/collectionComponentDefinitions.d.ts} +1 -1
- package/dist/config/collections/collectionComponentDefinitions.js +40 -0
- package/dist/config/collections/collectionMenus.d.ts +2 -0
- package/dist/config/{collectionMenus.js → collections/collectionMenus.js} +18 -16
- package/dist/config/collections/collectionStyles.d.ts +2 -0
- package/dist/config/collections/collectionStyles.js +25 -0
- package/dist/config/{collectionViewModes.d.ts → collections/collectionViewModes.d.ts} +1 -1
- package/dist/config/collections/collectionViewModes.js +106 -0
- package/dist/config/{fieldCss.js → fields/fieldCss.js} +3 -10
- package/dist/config/fields/fieldRoles.d.ts +2 -0
- package/dist/{fields/utils → config/fields}/fieldRoles.js +7 -11
- package/dist/config/fields/tailwindFieldSelectors.d.ts +2 -1
- package/dist/config/fields/tailwindFieldSelectors.js +1547 -1
- package/dist/config/fields/tailwindSelectorVariants.js +45 -45
- package/dist/config/{configFooter.js → globals/configFooter.js} +11 -9
- package/dist/config/{configHeader.js → globals/configHeader.js} +11 -10
- package/dist/config/{configSettings.js → globals/configSettings.js} +48 -26
- package/dist/{hooks → config/hooks}/fields/populateSiblingClassName.js +0 -2
- package/dist/{hooks → config/hooks}/fields/populateSiblingClassNameAfterChange.js +0 -1
- package/dist/config/hooks/fields/resolveComponentFromRef.d.ts +2 -0
- package/dist/config/hooks/fields/resolveComponentFromRef.js +30 -0
- package/dist/config/hooks/fields/resolveStyleFromRef.d.ts +2 -0
- package/dist/config/hooks/fields/resolveStyleFromRef.js +35 -0
- package/dist/config/hooks/fields/resolveViewModeFromRef.d.ts +2 -0
- package/dist/config/hooks/fields/resolveViewModeFromRef.js +23 -0
- package/dist/config/index.cjs.js +1 -1
- package/dist/config/index.cjs.js.map +1 -1
- package/dist/config/index.d.ts +15 -9
- package/dist/config/index.esm.js +1 -1
- package/dist/config/index.esm.js.map +1 -1
- package/dist/config/index.js +15 -9
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +2 -0
- package/dist/react/ComponentRenderer.js +1 -1
- package/dist/react/LayoutRenderer.d.ts +5 -0
- package/dist/react/LayoutRenderer.js +19 -0
- package/dist/react/componentRegistry.js +7 -0
- package/dist/react/components/Card.d.ts +19 -0
- package/dist/react/components/Card.js +6 -0
- package/dist/react/components/Container.d.ts +5 -0
- package/dist/react/components/Container.js +4 -0
- package/dist/react/components/View.d.ts +1 -0
- package/dist/react/components/View.js +9 -0
- package/dist/react/index.cjs.js +1 -1
- package/dist/react/index.d.ts +5 -5
- package/dist/react/index.esm.js +1 -1
- package/dist/react/index.js +5 -5
- package/dist/resolveLayout-DlRnQBn8.js +2 -0
- package/dist/resolveLayout-DlRnQBn8.js.map +1 -0
- package/dist/resolveLayout-DryOXHEy.js +2 -0
- package/dist/resolveLayout-DryOXHEy.js.map +1 -0
- package/dist/seeders/UIMSSeeder.d.ts +7 -0
- package/dist/seeders/UIMSSeeder.js +14 -0
- package/dist/seeders/clearCollection.d.ts +2 -0
- package/dist/seeders/clearCollection.js +18 -0
- package/dist/seeders/components.d.ts +1 -0
- package/dist/seeders/components.js +3 -0
- package/dist/seeders/generateTailwindStyles.d.ts +6 -0
- package/dist/seeders/generateTailwindStyles.js +18 -0
- package/dist/seeders/index.cjs.js +2 -0
- package/dist/seeders/index.cjs.js.map +1 -0
- package/dist/seeders/index.d.ts +2 -0
- package/dist/seeders/index.esm.js +2 -0
- package/dist/seeders/index.esm.js.map +1 -0
- package/dist/seeders/index.js +2 -0
- package/dist/seeders/styles.d.ts +1 -0
- package/dist/seeders/styles.js +27 -0
- package/dist/seeders/viewModes.d.ts +1 -0
- package/dist/seeders/viewModes.js +3 -0
- package/dist/tailwind/index.cjs.js +2 -0
- package/dist/tailwind/index.cjs.js.map +1 -0
- package/dist/tailwind/index.d.ts +2 -94
- package/dist/tailwind/index.esm.js +2 -0
- package/dist/tailwind/index.esm.js.map +1 -0
- package/dist/tailwind/index.js +2 -2692
- package/dist/tailwind/tailwindFieldSelectors.d.ts +181 -0
- package/dist/tailwind/tailwindFieldSelectors.js +1184 -0
- package/dist/tailwind/tailwindSelectorVariants.d.ts +4 -0
- package/dist/tailwind/tailwindSelectorVariants.js +69 -0
- package/dist/uims/index.cjs.js +2 -0
- package/dist/uims/index.cjs.js.map +1 -0
- package/dist/uims/index.d.ts +6 -0
- package/dist/uims/index.esm.js +2 -0
- package/dist/uims/index.esm.js.map +1 -0
- package/dist/uims/index.js +9 -0
- package/dist/uims/mapper/applyStylesToProps.d.ts +4 -0
- package/dist/uims/mapper/applyStylesToProps.js +18 -0
- package/dist/uims/mapper/getValueByPath.d.ts +1 -0
- package/dist/uims/mapper/getValueByPath.js +3 -0
- package/dist/uims/mapper/mapDataToProps.d.ts +6 -0
- package/dist/uims/mapper/mapDataToProps.js +26 -0
- package/dist/uims/mapper/mapInlineBlockToProps.d.ts +6 -0
- package/dist/uims/mapper/mapInlineBlockToProps.js +16 -0
- package/dist/uims/registry/componentRegistry.d.ts +4 -0
- package/dist/uims/registry/componentRegistry.js +20 -0
- package/dist/uims/registry/styleRegistry.d.ts +4 -0
- package/dist/uims/registry/styleRegistry.js +20 -0
- package/dist/uims/registry/viewModeRegistry.d.ts +4 -0
- package/dist/uims/registry/viewModeRegistry.js +20 -0
- package/dist/uims/resolver/createUIMSContext.d.ts +3 -0
- package/dist/uims/resolver/createUIMSContext.js +13 -0
- package/dist/uims/resolver/resolveInlineBlock.d.ts +8 -0
- package/dist/uims/resolver/resolveInlineBlock.js +22 -0
- package/dist/uims/resolver/resolveInlineStylesBySlot.d.ts +1 -0
- package/dist/uims/resolver/resolveInlineStylesBySlot.js +15 -0
- package/dist/uims/resolver/resolveLayout.d.ts +5 -0
- package/dist/uims/resolver/resolveLayout.js +24 -0
- package/dist/uims/resolver/resolveStylesBySlot.d.ts +11 -0
- package/dist/uims/resolver/resolveStylesBySlot.js +12 -0
- package/dist/uims/resolver/resolveViewBlock.d.ts +12 -0
- package/dist/uims/resolver/resolveViewBlock.js +26 -0
- package/dist/{utils → uims/resolver}/resolveViewData.d.ts +3 -1
- package/dist/uims/resolver/resolveViewData.js +56 -0
- package/dist/uims/types/UIMSContext.d.ts +18 -0
- package/dist/uims/types/UIMSContext.js +1 -0
- package/dist/utils/getPropsKeys.d.ts +1 -0
- package/dist/utils/getPropsKeys.js +3 -0
- package/dist/utils/index.cjs.js +1 -1
- package/dist/utils/index.cjs.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.esm.js +1 -1
- package/dist/utils/index.esm.js.map +1 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/normalizeStyles.d.ts +1 -0
- package/dist/utils/normalizeStyles.js +12 -0
- package/dist/utils/pickProps.d.ts +1 -0
- package/dist/utils/pickProps.js +9 -0
- package/package.json +12 -4
- package/dist/PageRenderer-BiZflIhY.js +0 -2
- package/dist/PageRenderer-BiZflIhY.js.map +0 -1
- package/dist/PageRenderer-DX3iEA8n.js +0 -2
- package/dist/PageRenderer-DX3iEA8n.js.map +0 -1
- package/dist/config/blockComponentInstance.d.ts +0 -2
- package/dist/config/blockComponentInstance.js +0 -84
- package/dist/config/blocks/blockCarousel.d.ts +0 -3
- package/dist/config/blocks/blockCarousel.js +0 -102
- package/dist/config/blocks/blockDisclosureList.d.ts +0 -3
- package/dist/config/blocks/blockDisclosureList.js +0 -58
- package/dist/config/blocks/blockGrid.d.ts +0 -6
- package/dist/config/blocks/blockGrid.js +0 -161
- package/dist/config/blocks/blockGridContent.d.ts +0 -6
- package/dist/config/blocks/blockGridContent.js +0 -195
- package/dist/config/blocks/blockHtmlElement.d.ts +0 -6
- package/dist/config/blocks/blockHtmlElement.js +0 -13
- package/dist/config/blocks/blockImage.d.ts +0 -3
- package/dist/config/blocks/blockImage.js +0 -15
- package/dist/config/blocks/blockParallax.d.ts +0 -3
- package/dist/config/blocks/blockParallax.js +0 -76
- package/dist/config/blocks/blockTabs.d.ts +0 -3
- package/dist/config/blocks/blockTabs.js +0 -24
- package/dist/config/collectionComponentDefinitions.js +0 -33
- package/dist/config/collectionMenus.d.ts +0 -6
- package/dist/config/collectionViewModes.js +0 -20
- package/dist/config/utils/resolveInlineComponent.d.ts +0 -4
- package/dist/config/utils/resolveInlineComponent.js +0 -35
- package/dist/config/utils/resolveViewRow.d.ts +0 -4
- package/dist/config/utils/resolveViewRow.js +0 -15
- package/dist/fields/fieldArray.d.ts +0 -4
- package/dist/fields/fieldArray.js +0 -9
- package/dist/fields/fieldBlocks.d.ts +0 -4
- package/dist/fields/fieldBlocks.js +0 -9
- package/dist/fields/fieldCheckbox.d.ts +0 -4
- package/dist/fields/fieldCheckbox.js +0 -11
- package/dist/fields/fieldCode.d.ts +0 -4
- package/dist/fields/fieldCode.js +0 -8
- package/dist/fields/fieldDate.d.ts +0 -4
- package/dist/fields/fieldDate.js +0 -15
- package/dist/fields/fieldEmail.d.ts +0 -4
- package/dist/fields/fieldEmail.js +0 -8
- package/dist/fields/fieldJoin.d.ts +0 -4
- package/dist/fields/fieldJoin.js +0 -9
- package/dist/fields/fieldNumber.d.ts +0 -4
- package/dist/fields/fieldNumber.js +0 -8
- package/dist/fields/fieldPoint.d.ts +0 -4
- package/dist/fields/fieldPoint.js +0 -8
- package/dist/fields/fieldRadioGroup.d.ts +0 -4
- package/dist/fields/fieldRadioGroup.js +0 -18
- package/dist/fields/fieldRelationship.d.ts +0 -4
- package/dist/fields/fieldRelationship.js +0 -9
- package/dist/fields/fieldRichText.d.ts +0 -4
- package/dist/fields/fieldRichText.js +0 -12
- package/dist/fields/fieldSelect.d.ts +0 -4
- package/dist/fields/fieldSelect.js +0 -9
- package/dist/fields/fieldText.d.ts +0 -4
- package/dist/fields/fieldText.js +0 -8
- package/dist/fields/fieldTextArea.d.ts +0 -4
- package/dist/fields/fieldTextArea.js +0 -8
- package/dist/fields/fieldUpload.d.ts +0 -4
- package/dist/fields/fieldUpload.js +0 -9
- package/dist/fields/index.cjs.js +0 -2
- package/dist/fields/index.cjs.js.map +0 -1
- package/dist/fields/index.d.ts +0 -31
- package/dist/fields/index.esm.js +0 -2
- package/dist/fields/index.esm.js.map +0 -1
- package/dist/fields/index.js +0 -37
- package/dist/fields/layout/fieldContainerProps.d.ts +0 -3
- package/dist/fields/layout/fieldContainerProps.js +0 -74
- package/dist/fields/section/fieldAction.d.ts +0 -6
- package/dist/fields/section/fieldAction.js +0 -236
- package/dist/fields/section/fieldConfigProps.d.ts +0 -3
- package/dist/fields/section/fieldConfigProps.js +0 -11
- package/dist/fields/section/fieldContentProps.d.ts +0 -3
- package/dist/fields/section/fieldContentProps.js +0 -11
- package/dist/fields/section/fieldSectionProps.d.ts +0 -3
- package/dist/fields/section/fieldSectionProps.js +0 -15
- package/dist/fields/section/fieldSectionTabs.d.ts +0 -13
- package/dist/fields/section/fieldSectionTabs.js +0 -40
- package/dist/fields/style/fieldColor.d.ts +0 -4
- package/dist/fields/style/fieldColor.js +0 -21
- package/dist/fields/style/fieldContainerWidths.d.ts +0 -7
- package/dist/fields/style/fieldContainerWidths.js +0 -17
- package/dist/fields/style/fieldCss.d.ts +0 -3
- package/dist/fields/style/fieldCss.js +0 -65
- package/dist/fields/style/fieldFontSizes.d.ts +0 -3
- package/dist/fields/style/fieldFontSizes.js +0 -14
- package/dist/fields/style/fieldHeights.d.ts +0 -7
- package/dist/fields/style/fieldHeights.js +0 -23
- package/dist/fields/style/fieldMargins.d.ts +0 -7
- package/dist/fields/style/fieldMargins.js +0 -138
- package/dist/fields/style/fieldPaddings.d.ts +0 -7
- package/dist/fields/style/fieldPaddings.js +0 -114
- package/dist/fields/style/fieldViewportHeights.d.ts +0 -7
- package/dist/fields/style/fieldViewportHeights.js +0 -22
- package/dist/fields/utils/fieldRoles.d.ts +0 -4
- package/dist/react/Card.d.ts +0 -6
- package/dist/react/Card.js +0 -4
- package/dist/react/PageRenderer.d.ts +0 -4
- package/dist/react/PageRenderer.js +0 -34
- package/dist/react/ViewBlock.d.ts +0 -1
- package/dist/react/ViewBlock.js +0 -62
- package/dist/react/registry.js +0 -5
- package/dist/userRoles-BqQg1D6Q.js +0 -2
- package/dist/userRoles-BqQg1D6Q.js.map +0 -1
- package/dist/userRoles-CL8SQUFs.js +0 -2
- package/dist/userRoles-CL8SQUFs.js.map +0 -1
- package/dist/utils/resolveViewData.js +0 -26
- /package/dist/{acl → config/acl}/hasRoles.d.ts +0 -0
- /package/dist/{acl → config/acl}/hasRoles.js +0 -0
- /package/dist/{acl → config/acl}/index.d.ts +0 -0
- /package/dist/{acl → config/acl}/index.js +0 -0
- /package/dist/config/{blockView.d.ts → blocks/blockView.d.ts} +0 -0
- /package/dist/{enums → config/enums}/index.d.ts +0 -0
- /package/dist/{enums → config/enums}/index.js +0 -0
- /package/dist/{enums → config/enums}/userRoles.d.ts +0 -0
- /package/dist/{enums → config/enums}/userRoles.js +0 -0
- /package/dist/config/{fieldCss.d.ts → fields/fieldCss.d.ts} +0 -0
- /package/dist/config/{configFooter.d.ts → globals/configFooter.d.ts} +0 -0
- /package/dist/config/{configHeader.d.ts → globals/configHeader.d.ts} +0 -0
- /package/dist/config/{configSettings.d.ts → globals/configSettings.d.ts} +0 -0
- /package/dist/{hooks → config/hooks}/fields/getNumberValueFromClassNameString.d.ts +0 -0
- /package/dist/{hooks → config/hooks}/fields/getNumberValueFromClassNameString.js +0 -0
- /package/dist/{hooks → config/hooks}/fields/populateSiblingClassName.d.ts +0 -0
- /package/dist/{hooks → config/hooks}/fields/populateSiblingClassNameAfterChange.d.ts +0 -0
- /package/dist/{hooks → config/hooks}/fields/updateClassNameAfterRead.d.ts +0 -0
- /package/dist/{hooks → config/hooks}/fields/updateClassNameAfterRead.js +0 -0
- /package/dist/{hooks → config/hooks}/index.d.ts +0 -0
- /package/dist/{hooks → config/hooks}/index.js +0 -0
- /package/dist/react/{registry.d.ts → componentRegistry.d.ts} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var n=require("react/jsx-runtime"),e=require("./resolveLayout-DlRnQBn8.js");function t({className:t="",rows:o=[],viewMode:a,rowViewMode:r}){const i=e.componentRegistry[a?.component]??"div",s=e.componentRegistry[r?.component]??"div";return n.jsx(i,{className:t,children:o.map((e,t)=>n.jsx(s,{...e},t))})}let o=null;async function a(n){if(o)return o;const e=await n.find({collection:"styles",depth:4,pagination:!1}),t={};for(const n of e.docs??[])n.name&&(t[n.name]=n);return o={byName:t},o}let r=null;async function i(n){if(r)return r;const e=await n.find({collection:"view-modes",depth:4,pagination:!1}),t={};for(const n of e.docs??[])n.name&&(t[n.name]=n);return r={byName:t},r}let s=null;async function c(n){if(s)return s;const e=await n.find({collection:"component-definitions",depth:4,pagination:!1}),t={};for(const n of e.docs??[])n.name&&(t[n.name]=n);return s={byName:t},s}exports.LayoutRenderer=async function({layout:o,payload:r}){const s=await async function(n){return{payload:n,registries:{styles:await a(n),viewMode:await i(n),component:await c(n)}}}(r),u=await e.resolveLayout({layout:o,context:s});return n.jsx(n.Fragment,{children:u.map((e,o)=>{if(!e)return null;if(e.rows)return n.jsx(t,{...e},o);const{Component:a,props:r}=e;return n.jsx(a,{...r},o)})})},exports.View=t;
|
|
2
|
+
//# sourceMappingURL=LayoutRenderer-B1IoWb16.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LayoutRenderer-B1IoWb16.js","sources":["../src/react/components/View.tsx","../src/uims/registry/styleRegistry.ts","../src/uims/registry/viewModeRegistry.ts","../src/uims/registry/componentRegistry.ts","../src/react/LayoutRenderer.tsx","../src/uims/resolver/createUIMSContext.ts"],"sourcesContent":["import { componentRegistry } from '../componentRegistry'\n\nexport function View({ className = '', rows = [], viewMode, rowViewMode }: any) {\n const ContainerComponent = componentRegistry[viewMode?.component] ?? 'div'\n const RowComponent = componentRegistry[rowViewMode?.component] ?? 'div'\n\n return (\n <ContainerComponent className={className}>\n {rows.map((rowProps: any, i: number) => {\n return <RowComponent key={i} {...rowProps} />\n })}\n </ContainerComponent>\n )\n}\n","import { BasePayload } from 'payload'\n\nlet cache: {\n byName: Record<string, any>\n} | null = null\n\n//# TODO sarebbe sensato cancellare la cache o forzare un nuovo caricamento quando viene fatta una modifica a uno degli elementi della collection\nexport async function getStyleRegistry(payload: BasePayload) {\n if (cache) {\n return cache\n }\n\n const result = await payload.find({\n collection: 'styles',\n depth: 4,\n pagination: false,\n })\n\n const byName: Record<string, any> = {}\n\n for (const vm of result.docs ?? []) {\n if (vm.name) {\n byName[vm.name] = vm\n }\n }\n\n cache = { byName }\n return cache\n}\n","import { BasePayload } from 'payload'\n\nlet cache: {\n byName: Record<string, any>\n} | null = null\n\n//# TODO sarebbe sensato cancellare la cache o forzare un nuovo caricamento quando viene fatta una modifica a uno degli elementi della collection\nexport async function getViewModeRegistry(payload: BasePayload) {\n if (cache) {\n return cache\n }\n\n const result = await payload.find({\n collection: 'view-modes',\n depth: 4,\n pagination: false,\n })\n\n const byName: Record<string, any> = {}\n\n for (const vm of result.docs ?? []) {\n if (vm.name) {\n byName[vm.name] = vm\n }\n }\n\n cache = { byName }\n return cache\n}\n","import { BasePayload } from 'payload'\n\nlet cache: {\n byName: Record<string, any>\n} | null = null\n\n//# TODO sarebbe sensato cancellare la cache o forzare un nuovo caricamento quando viene fatta una modifica a uno degli elementi della collection\nexport async function getComponentRegistry(payload: BasePayload) {\n if (cache) {\n return cache\n }\n\n const result = await payload.find({\n collection: 'component-definitions',\n depth: 4,\n pagination: false,\n })\n\n const byName: Record<string, any> = {}\n\n for (const vm of result.docs ?? []) {\n if (vm.name) {\n byName[vm.name] = vm\n }\n }\n\n cache = { byName }\n return cache\n}\n","import { BasePayload } from 'payload'\nimport { View } from './components/View'\nimport { resolveLayout } from '../uims'\nimport { createUIMSContext } from '../uims/resolver/createUIMSContext'\n\n//#TODO Ricordarsi di introdurre il concetto di PageRenderer, sarebbe carino se riuscissimo a delegarle la stampa anche dei meta dati e info accessorie oltre al layout.\nexport async function LayoutRenderer({ layout, payload }: { layout: any[]; payload: BasePayload }) {\n const uims = await createUIMSContext(payload)\n const resolvedLayout = await resolveLayout({ layout, context: uims })\n return (\n <>\n {resolvedLayout.map((block: any, i: any) => {\n if (!block) return null\n if (block.rows) {\n return <View key={i} {...block} />\n }\n\n const { Component, props } = block\n return <Component key={i} {...props} />\n\n return null\n })}\n </>\n )\n}\n","import { BasePayload } from 'payload'\nimport { UIMSContext } from '../types/UIMSContext'\nimport { getStyleRegistry } from '../registry/styleRegistry'\nimport { getViewModeRegistry } from '../registry/viewModeRegistry'\nimport { getComponentRegistry } from '../registry/componentRegistry'\n\nexport async function createUIMSContext(payload: BasePayload): Promise<UIMSContext> {\n return {\n payload,\n registries: {\n styles: await getStyleRegistry(payload),\n viewMode: await getViewModeRegistry(payload),\n component: await getComponentRegistry(payload),\n },\n }\n}\n"],"names":["View","className","rows","viewMode","rowViewMode","ContainerComponent","componentRegistry","component","RowComponent","_jsx","children","map","rowProps","i","cache","async","getStyleRegistry","payload","result","find","collection","depth","pagination","byName","vm","docs","name","getViewModeRegistry","getComponentRegistry","layout","uims","registries","styles","createUIMSContext","resolvedLayout","resolveLayout","context","_Fragment","block","Component","props"],"mappings":"yFAEM,SAAUA,GAAKC,UAAEA,EAAY,GAAEC,KAAEA,EAAO,GAAEC,SAAEA,EAAQC,YAAEA,IAC1D,MAAMC,EAAqBC,EAAAA,kBAAkBH,GAAUI,YAAc,MAC/DC,EAAeF,EAAAA,kBAAkBF,GAAaG,YAAc,MAElE,OACEE,MAACJ,EAAkB,CAACJ,UAAWA,EAASS,SACrCR,EAAKS,IAAI,CAACC,EAAeC,IACjBJ,EAAAA,IAACD,EAAY,IAAaI,GAAPC,KAIlC,CCXA,IAAIC,EAEO,KAGJC,eAAeC,EAAiBC,GACrC,GAAIH,EACF,OAAOA,EAGT,MAAMI,QAAeD,EAAQE,KAAK,CAChCC,WAAY,SACZC,MAAO,EACPC,YAAY,IAGRC,EAA8B,CAAA,EAEpC,IAAK,MAAMC,KAAMN,EAAOO,MAAQ,GAC1BD,EAAGE,OACLH,EAAOC,EAAGE,MAAQF,GAKtB,OADAV,EAAQ,CAAES,UACHT,CACT,CC1BA,IAAIA,EAEO,KAGJC,eAAeY,EAAoBV,GACxC,GAAIH,EACF,OAAOA,EAGT,MAAMI,QAAeD,EAAQE,KAAK,CAChCC,WAAY,aACZC,MAAO,EACPC,YAAY,IAGRC,EAA8B,CAAA,EAEpC,IAAK,MAAMC,KAAMN,EAAOO,MAAQ,GAC1BD,EAAGE,OACLH,EAAOC,EAAGE,MAAQF,GAKtB,OADAV,EAAQ,CAAES,UACHT,CACT,CC1BA,IAAIA,EAEO,KAGJC,eAAea,EAAqBX,GACzC,GAAIH,EACF,OAAOA,EAGT,MAAMI,QAAeD,EAAQE,KAAK,CAChCC,WAAY,wBACZC,MAAO,EACPC,YAAY,IAGRC,EAA8B,CAAA,EAEpC,IAAK,MAAMC,KAAMN,EAAOO,MAAQ,GAC1BD,EAAGE,OACLH,EAAOC,EAAGE,MAAQF,GAKtB,OADAV,EAAQ,CAAES,UACHT,CACT,wBCtBOC,gBAA8Bc,OAAEA,EAAMZ,QAAEA,IAC7C,MAAMa,QCDDf,eAAiCE,GACtC,MAAO,CACLA,UACAc,WAAY,CACVC,aAAchB,EAAiBC,GAC/Bd,eAAgBwB,EAAoBV,GACpCV,gBAAiBqB,EAAqBX,IAG5C,CDRqBgB,CAAkBhB,GAC/BiB,QAAuBC,EAAAA,cAAc,CAAEN,SAAQO,QAASN,IAC9D,OACErB,EAAAA,IAAA4B,EAAAA,SAAA,CAAA3B,SACGwB,EAAevB,IAAI,CAAC2B,EAAYzB,KAC/B,IAAKyB,EAAO,OAAO,KACnB,GAAIA,EAAMpC,KACR,OAAOO,EAAAA,IAACT,EAAI,IAAasC,GAAPzB,GAGpB,MAAM0B,UAAEA,EAASC,MAAEA,GAAUF,EAC7B,OAAO7B,EAAAA,IAAC8B,EAAS,IAAaC,GAAP3B,MAM/B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as n,Fragment as t}from"react/jsx-runtime";import{d as o,a as e}from"./resolveLayout-DryOXHEy.js";function a({className:t="",rows:e=[],viewMode:a,rowViewMode:i}){const r=o[a?.component]??"div",c=o[i?.component]??"div";return n(r,{className:t,children:e.map((t,o)=>n(c,{...t},o))})}let i=null;async function r(n){if(i)return i;const t=await n.find({collection:"styles",depth:4,pagination:!1}),o={};for(const n of t.docs??[])n.name&&(o[n.name]=n);return i={byName:o},i}let c=null;async function s(n){if(c)return c;const t=await n.find({collection:"view-modes",depth:4,pagination:!1}),o={};for(const n of t.docs??[])n.name&&(o[n.name]=n);return c={byName:o},c}let l=null;async function u(n){if(l)return l;const t=await n.find({collection:"component-definitions",depth:4,pagination:!1}),o={};for(const n of t.docs??[])n.name&&(o[n.name]=n);return l={byName:o},l}async function m({layout:o,payload:i}){const c=await async function(n){return{payload:n,registries:{styles:await r(n),viewMode:await s(n),component:await u(n)}}}(i),l=await e({layout:o,context:c});return n(t,{children:l.map((t,o)=>{if(!t)return null;if(t.rows)return n(a,{...t},o);const{Component:e,props:i}=t;return n(e,{...i},o)})})}export{m as L,a as V};
|
|
2
|
+
//# sourceMappingURL=LayoutRenderer-Ba6ITI7O.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LayoutRenderer-Ba6ITI7O.js","sources":["../src/react/components/View.tsx","../src/uims/registry/styleRegistry.ts","../src/uims/registry/viewModeRegistry.ts","../src/uims/registry/componentRegistry.ts","../src/react/LayoutRenderer.tsx","../src/uims/resolver/createUIMSContext.ts"],"sourcesContent":["import { componentRegistry } from '../componentRegistry'\n\nexport function View({ className = '', rows = [], viewMode, rowViewMode }: any) {\n const ContainerComponent = componentRegistry[viewMode?.component] ?? 'div'\n const RowComponent = componentRegistry[rowViewMode?.component] ?? 'div'\n\n return (\n <ContainerComponent className={className}>\n {rows.map((rowProps: any, i: number) => {\n return <RowComponent key={i} {...rowProps} />\n })}\n </ContainerComponent>\n )\n}\n","import { BasePayload } from 'payload'\n\nlet cache: {\n byName: Record<string, any>\n} | null = null\n\n//# TODO sarebbe sensato cancellare la cache o forzare un nuovo caricamento quando viene fatta una modifica a uno degli elementi della collection\nexport async function getStyleRegistry(payload: BasePayload) {\n if (cache) {\n return cache\n }\n\n const result = await payload.find({\n collection: 'styles',\n depth: 4,\n pagination: false,\n })\n\n const byName: Record<string, any> = {}\n\n for (const vm of result.docs ?? []) {\n if (vm.name) {\n byName[vm.name] = vm\n }\n }\n\n cache = { byName }\n return cache\n}\n","import { BasePayload } from 'payload'\n\nlet cache: {\n byName: Record<string, any>\n} | null = null\n\n//# TODO sarebbe sensato cancellare la cache o forzare un nuovo caricamento quando viene fatta una modifica a uno degli elementi della collection\nexport async function getViewModeRegistry(payload: BasePayload) {\n if (cache) {\n return cache\n }\n\n const result = await payload.find({\n collection: 'view-modes',\n depth: 4,\n pagination: false,\n })\n\n const byName: Record<string, any> = {}\n\n for (const vm of result.docs ?? []) {\n if (vm.name) {\n byName[vm.name] = vm\n }\n }\n\n cache = { byName }\n return cache\n}\n","import { BasePayload } from 'payload'\n\nlet cache: {\n byName: Record<string, any>\n} | null = null\n\n//# TODO sarebbe sensato cancellare la cache o forzare un nuovo caricamento quando viene fatta una modifica a uno degli elementi della collection\nexport async function getComponentRegistry(payload: BasePayload) {\n if (cache) {\n return cache\n }\n\n const result = await payload.find({\n collection: 'component-definitions',\n depth: 4,\n pagination: false,\n })\n\n const byName: Record<string, any> = {}\n\n for (const vm of result.docs ?? []) {\n if (vm.name) {\n byName[vm.name] = vm\n }\n }\n\n cache = { byName }\n return cache\n}\n","import { BasePayload } from 'payload'\nimport { View } from './components/View'\nimport { resolveLayout } from '../uims'\nimport { createUIMSContext } from '../uims/resolver/createUIMSContext'\n\n//#TODO Ricordarsi di introdurre il concetto di PageRenderer, sarebbe carino se riuscissimo a delegarle la stampa anche dei meta dati e info accessorie oltre al layout.\nexport async function LayoutRenderer({ layout, payload }: { layout: any[]; payload: BasePayload }) {\n const uims = await createUIMSContext(payload)\n const resolvedLayout = await resolveLayout({ layout, context: uims })\n return (\n <>\n {resolvedLayout.map((block: any, i: any) => {\n if (!block) return null\n if (block.rows) {\n return <View key={i} {...block} />\n }\n\n const { Component, props } = block\n return <Component key={i} {...props} />\n\n return null\n })}\n </>\n )\n}\n","import { BasePayload } from 'payload'\nimport { UIMSContext } from '../types/UIMSContext'\nimport { getStyleRegistry } from '../registry/styleRegistry'\nimport { getViewModeRegistry } from '../registry/viewModeRegistry'\nimport { getComponentRegistry } from '../registry/componentRegistry'\n\nexport async function createUIMSContext(payload: BasePayload): Promise<UIMSContext> {\n return {\n payload,\n registries: {\n styles: await getStyleRegistry(payload),\n viewMode: await getViewModeRegistry(payload),\n component: await getComponentRegistry(payload),\n },\n }\n}\n"],"names":["View","className","rows","viewMode","rowViewMode","ContainerComponent","componentRegistry","component","RowComponent","_jsx","children","map","rowProps","i","cache","async","getStyleRegistry","payload","result","find","collection","depth","pagination","byName","vm","docs","name","getViewModeRegistry","getComponentRegistry","LayoutRenderer","layout","uims","registries","styles","createUIMSContext","resolvedLayout","resolveLayout","context","_Fragment","block","Component","props"],"mappings":"6GAEM,SAAUA,GAAKC,UAAEA,EAAY,GAAEC,KAAEA,EAAO,GAAEC,SAAEA,EAAQC,YAAEA,IAC1D,MAAMC,EAAqBC,EAAkBH,GAAUI,YAAc,MAC/DC,EAAeF,EAAkBF,GAAaG,YAAc,MAElE,OACEE,EAACJ,EAAkB,CAACJ,UAAWA,EAASS,SACrCR,EAAKS,IAAI,CAACC,EAAeC,IACjBJ,EAACD,EAAY,IAAaI,GAAPC,KAIlC,CCXA,IAAIC,EAEO,KAGJC,eAAeC,EAAiBC,GACrC,GAAIH,EACF,OAAOA,EAGT,MAAMI,QAAeD,EAAQE,KAAK,CAChCC,WAAY,SACZC,MAAO,EACPC,YAAY,IAGRC,EAA8B,CAAA,EAEpC,IAAK,MAAMC,KAAMN,EAAOO,MAAQ,GAC1BD,EAAGE,OACLH,EAAOC,EAAGE,MAAQF,GAKtB,OADAV,EAAQ,CAAES,UACHT,CACT,CC1BA,IAAIA,EAEO,KAGJC,eAAeY,EAAoBV,GACxC,GAAIH,EACF,OAAOA,EAGT,MAAMI,QAAeD,EAAQE,KAAK,CAChCC,WAAY,aACZC,MAAO,EACPC,YAAY,IAGRC,EAA8B,CAAA,EAEpC,IAAK,MAAMC,KAAMN,EAAOO,MAAQ,GAC1BD,EAAGE,OACLH,EAAOC,EAAGE,MAAQF,GAKtB,OADAV,EAAQ,CAAES,UACHT,CACT,CC1BA,IAAIA,EAEO,KAGJC,eAAea,EAAqBX,GACzC,GAAIH,EACF,OAAOA,EAGT,MAAMI,QAAeD,EAAQE,KAAK,CAChCC,WAAY,wBACZC,MAAO,EACPC,YAAY,IAGRC,EAA8B,CAAA,EAEpC,IAAK,MAAMC,KAAMN,EAAOO,MAAQ,GAC1BD,EAAGE,OACLH,EAAOC,EAAGE,MAAQF,GAKtB,OADAV,EAAQ,CAAES,UACHT,CACT,CCtBOC,eAAec,GAAeC,OAAEA,EAAMb,QAAEA,IAC7C,MAAMc,QCDDhB,eAAiCE,GACtC,MAAO,CACLA,UACAe,WAAY,CACVC,aAAcjB,EAAiBC,GAC/Bd,eAAgBwB,EAAoBV,GACpCV,gBAAiBqB,EAAqBX,IAG5C,CDRqBiB,CAAkBjB,GAC/BkB,QAAuBC,EAAc,CAAEN,SAAQO,QAASN,IAC9D,OACEtB,EAAA6B,EAAA,CAAA5B,SACGyB,EAAexB,IAAI,CAAC4B,EAAY1B,KAC/B,IAAK0B,EAAO,OAAO,KACnB,GAAIA,EAAMrC,KACR,OAAOO,EAACT,EAAI,IAAauC,GAAP1B,GAGpB,MAAM2B,UAAEA,EAASC,MAAEA,GAAUF,EAC7B,OAAO9B,EAAC+B,EAAS,IAAaC,GAAP5B,MAM/B"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { resolveViewModeFromRef } from '../hooks/fields/resolveViewModeFromRef';
|
|
2
|
+
export const blockCard = {
|
|
3
|
+
slug: 'card',
|
|
4
|
+
fields: [
|
|
5
|
+
{
|
|
6
|
+
type: 'row',
|
|
7
|
+
fields: [
|
|
8
|
+
{
|
|
9
|
+
name: 'viewMode',
|
|
10
|
+
type: 'text',
|
|
11
|
+
defaultValue: '',
|
|
12
|
+
admin: {
|
|
13
|
+
width: '50%',
|
|
14
|
+
},
|
|
15
|
+
hooks: {
|
|
16
|
+
beforeChange: [resolveViewModeFromRef('viewModeRef')],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'viewModeRef',
|
|
21
|
+
type: 'relationship',
|
|
22
|
+
virtual: true,
|
|
23
|
+
relationTo: ['view-modes'],
|
|
24
|
+
admin: {
|
|
25
|
+
width: '50%',
|
|
26
|
+
description: 'campo helper per la sola visualizzazione o selezione di un viewMode, viene usato il valore inserito nel campo precedente per determinare la struttura del layout',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'titleProps',
|
|
33
|
+
type: 'group',
|
|
34
|
+
fields: [
|
|
35
|
+
{
|
|
36
|
+
name: 'text',
|
|
37
|
+
type: 'text',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'descriptionProps',
|
|
43
|
+
type: 'group',
|
|
44
|
+
fields: [
|
|
45
|
+
{
|
|
46
|
+
name: 'text',
|
|
47
|
+
type: 'text',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'imageProps',
|
|
53
|
+
type: 'group',
|
|
54
|
+
fields: [
|
|
55
|
+
{
|
|
56
|
+
name: 'text',
|
|
57
|
+
type: 'text',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
type: 'relationship',
|
|
61
|
+
name: 'image',
|
|
62
|
+
relationTo: ['media'],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'altText',
|
|
66
|
+
type: 'text',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'actionProps',
|
|
72
|
+
type: 'group',
|
|
73
|
+
fields: [
|
|
74
|
+
{
|
|
75
|
+
name: 'text',
|
|
76
|
+
type: 'text',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'target',
|
|
80
|
+
type: 'text',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'actionType',
|
|
84
|
+
type: 'select',
|
|
85
|
+
options: [
|
|
86
|
+
{ label: 'Navigate', value: 'navigate' },
|
|
87
|
+
{ label: 'Scroll', value: 'scroll' },
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'actionTarget',
|
|
92
|
+
type: 'select',
|
|
93
|
+
options: [
|
|
94
|
+
{ label: 'URL', value: 'url' },
|
|
95
|
+
{ label: 'ID', value: 'id' },
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { resolveViewModeFromRef } from '../hooks/fields/resolveViewModeFromRef';
|
|
1
2
|
export const blockView = {
|
|
2
|
-
slug: 'view',
|
|
3
|
+
slug: 'view',
|
|
3
4
|
labels: {
|
|
4
5
|
singular: 'View',
|
|
5
6
|
plural: 'Views',
|
|
@@ -8,9 +9,6 @@ export const blockView = {
|
|
|
8
9
|
{
|
|
9
10
|
type: 'tabs',
|
|
10
11
|
tabs: [
|
|
11
|
-
// ======================================================
|
|
12
|
-
// TAB 1 — DATA SOURCE
|
|
13
|
-
// ======================================================
|
|
14
12
|
{
|
|
15
13
|
label: 'Data Source',
|
|
16
14
|
fields: [
|
|
@@ -23,7 +21,6 @@ export const blockView = {
|
|
|
23
21
|
readOnly: true,
|
|
24
22
|
},
|
|
25
23
|
},
|
|
26
|
-
// ---------------- INTERNAL SOURCE ----------------
|
|
27
24
|
{
|
|
28
25
|
type: 'row',
|
|
29
26
|
fields: [
|
|
@@ -36,7 +33,7 @@ export const blockView = {
|
|
|
36
33
|
condition: (_, siblingData) => siblingData?.useInternalSource === true,
|
|
37
34
|
},
|
|
38
35
|
options: [
|
|
39
|
-
|
|
36
|
+
//#TODO popolare dinamicamente con collection esistenti via hook.
|
|
40
37
|
{ label: 'Articles', value: 'articles' },
|
|
41
38
|
{ label: 'Users', value: 'users' },
|
|
42
39
|
{ label: 'Categories', value: 'categories' },
|
|
@@ -73,7 +70,6 @@ export const blockView = {
|
|
|
73
70
|
condition: (_, siblingData) => siblingData?.useInternalSource === true,
|
|
74
71
|
},
|
|
75
72
|
},
|
|
76
|
-
// ---------------- EXTERNAL SOURCE ----------------
|
|
77
73
|
{
|
|
78
74
|
type: 'row',
|
|
79
75
|
fields: [
|
|
@@ -113,9 +109,6 @@ export const blockView = {
|
|
|
113
109
|
},
|
|
114
110
|
],
|
|
115
111
|
},
|
|
116
|
-
// ======================================================
|
|
117
|
-
// TAB 2 — VIEW CONTAINER (INVARIATO)
|
|
118
|
-
// ======================================================
|
|
119
112
|
{
|
|
120
113
|
label: 'View Container',
|
|
121
114
|
fields: [
|
|
@@ -123,21 +116,25 @@ export const blockView = {
|
|
|
123
116
|
type: 'row',
|
|
124
117
|
fields: [
|
|
125
118
|
{
|
|
126
|
-
name: '
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
119
|
+
name: 'viewMode',
|
|
120
|
+
type: 'text',
|
|
121
|
+
defaultValue: '',
|
|
122
|
+
admin: {
|
|
123
|
+
width: '50%',
|
|
124
|
+
},
|
|
125
|
+
hooks: {
|
|
126
|
+
beforeChange: [resolveViewModeFromRef('viewModeRef')],
|
|
127
|
+
},
|
|
132
128
|
},
|
|
133
129
|
{
|
|
134
|
-
name: '
|
|
135
|
-
label: 'View Style',
|
|
130
|
+
name: 'viewModeRef',
|
|
136
131
|
type: 'relationship',
|
|
137
|
-
|
|
138
|
-
relationTo: 'view-modes',
|
|
139
|
-
|
|
140
|
-
|
|
132
|
+
virtual: true,
|
|
133
|
+
relationTo: ['view-modes'],
|
|
134
|
+
admin: {
|
|
135
|
+
width: '50%',
|
|
136
|
+
description: 'campo helper per la sola visualizzazione o selezione di un viewMode, viene usato il valore inserito nel campo precedente per determinare la struttura del layout',
|
|
137
|
+
},
|
|
141
138
|
},
|
|
142
139
|
],
|
|
143
140
|
},
|
|
@@ -148,9 +145,6 @@ export const blockView = {
|
|
|
148
145
|
},
|
|
149
146
|
],
|
|
150
147
|
},
|
|
151
|
-
// ======================================================
|
|
152
|
-
// TAB 3 — ROW (INVARIATO)
|
|
153
|
-
// ======================================================
|
|
154
148
|
{
|
|
155
149
|
label: 'Row Items',
|
|
156
150
|
fields: [
|
|
@@ -158,20 +152,25 @@ export const blockView = {
|
|
|
158
152
|
type: 'row',
|
|
159
153
|
fields: [
|
|
160
154
|
{
|
|
161
|
-
name: '
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
155
|
+
name: 'rowViewMode',
|
|
156
|
+
type: 'text',
|
|
157
|
+
defaultValue: '',
|
|
158
|
+
admin: {
|
|
159
|
+
width: '50%',
|
|
160
|
+
},
|
|
161
|
+
hooks: {
|
|
162
|
+
beforeChange: [resolveViewModeFromRef('rowViewModeRef')],
|
|
163
|
+
},
|
|
168
164
|
},
|
|
169
165
|
{
|
|
170
|
-
name: '
|
|
171
|
-
label: 'Row Style',
|
|
166
|
+
name: 'rowViewModeRef',
|
|
172
167
|
type: 'relationship',
|
|
173
|
-
|
|
174
|
-
|
|
168
|
+
virtual: true,
|
|
169
|
+
relationTo: ['view-modes'],
|
|
170
|
+
admin: {
|
|
171
|
+
width: '50%',
|
|
172
|
+
description: 'campo helper per la sola visualizzazione o selezione di un viewMode, viene usato il valore inserito nel campo precedente per determinare la struttura del layout',
|
|
173
|
+
},
|
|
175
174
|
},
|
|
176
175
|
],
|
|
177
176
|
},
|
|
@@ -180,61 +179,6 @@ export const blockView = {
|
|
|
180
179
|
type: 'json',
|
|
181
180
|
label: 'Mapping verso Row Props',
|
|
182
181
|
},
|
|
183
|
-
{
|
|
184
|
-
name: 'rowChildren',
|
|
185
|
-
type: 'array',
|
|
186
|
-
label: 'Row Children',
|
|
187
|
-
admin: {
|
|
188
|
-
description: 'Definisci i componenti figli da renderizzare per ogni item della view. Usa props statiche o propsBinding per mappare campi della singola item.',
|
|
189
|
-
},
|
|
190
|
-
fields: [
|
|
191
|
-
{
|
|
192
|
-
type: 'row',
|
|
193
|
-
fields: [
|
|
194
|
-
{
|
|
195
|
-
name: 'definition',
|
|
196
|
-
label: 'Child Definition',
|
|
197
|
-
type: 'relationship',
|
|
198
|
-
//@ts-ignore
|
|
199
|
-
relationTo: 'component-definitions',
|
|
200
|
-
required: true,
|
|
201
|
-
admin: {
|
|
202
|
-
width: '50%',
|
|
203
|
-
},
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
name: 'viewMode',
|
|
207
|
-
label: 'Child ViewMode',
|
|
208
|
-
type: 'relationship',
|
|
209
|
-
//@ts-ignore
|
|
210
|
-
relationTo: 'view-modes',
|
|
211
|
-
hasMany: true,
|
|
212
|
-
required: false,
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
name: 'staticProps',
|
|
216
|
-
type: 'json',
|
|
217
|
-
required: false,
|
|
218
|
-
label: 'Binding da JSON statico',
|
|
219
|
-
admin: {
|
|
220
|
-
width: '50%',
|
|
221
|
-
description: 'Valori statici da passare al child (usati così come sono).',
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
name: 'sourceProps',
|
|
226
|
-
type: 'json',
|
|
227
|
-
required: false,
|
|
228
|
-
label: 'Binding dinamico da sorgente dati',
|
|
229
|
-
admin: {
|
|
230
|
-
width: '50%',
|
|
231
|
-
description: 'Valori dinamici da passare al child (usati così come sono).',
|
|
232
|
-
},
|
|
233
|
-
},
|
|
234
|
-
],
|
|
235
|
-
},
|
|
236
|
-
],
|
|
237
|
-
},
|
|
238
182
|
],
|
|
239
183
|
},
|
|
240
184
|
],
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { blockCard } from '../blocks/blockCard';
|
|
2
|
+
import { blockView } from '../blocks/blockView';
|
|
3
|
+
export const collectionBlocks = {
|
|
4
|
+
slug: 'blocks',
|
|
5
|
+
access: {
|
|
6
|
+
read: ({ req }) => {
|
|
7
|
+
// Qui puoi modificare l'accesso in base ai tuoi requisiti
|
|
8
|
+
// Ad esempio, tutti possono leggere:
|
|
9
|
+
return true;
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
labels: {
|
|
13
|
+
singular: 'Block',
|
|
14
|
+
plural: 'Blocks',
|
|
15
|
+
},
|
|
16
|
+
admin: {
|
|
17
|
+
defaultColumns: ['title', 'updatedAt'],
|
|
18
|
+
useAsTitle: 'title',
|
|
19
|
+
},
|
|
20
|
+
fields: [
|
|
21
|
+
{
|
|
22
|
+
name: 'title',
|
|
23
|
+
type: 'text',
|
|
24
|
+
label: 'Title',
|
|
25
|
+
required: true,
|
|
26
|
+
localized: false,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'layout',
|
|
30
|
+
type: 'blocks',
|
|
31
|
+
blocks: [blockCard, blockView],
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
timestamps: true,
|
|
35
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CollectionConfig } from 'payload';
|
|
2
2
|
export declare const collectionComponentDefinitions: CollectionConfig;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const collectionComponentDefinitions = {
|
|
2
|
+
slug: 'component-definitions',
|
|
3
|
+
admin: {
|
|
4
|
+
useAsTitle: 'name',
|
|
5
|
+
description: "Questa collection rappresenta l'insieme dei componenti react presenti nella codebase. La definizione di un componente trasmette al sistema come un componente è composto e soprattutto come si chiama.",
|
|
6
|
+
},
|
|
7
|
+
fields: [
|
|
8
|
+
{
|
|
9
|
+
type: 'row',
|
|
10
|
+
fields: [
|
|
11
|
+
{
|
|
12
|
+
name: 'name',
|
|
13
|
+
type: 'text',
|
|
14
|
+
required: true,
|
|
15
|
+
unique: true,
|
|
16
|
+
admin: {
|
|
17
|
+
width: '50%',
|
|
18
|
+
description: 'Nome del componente usato in area admin',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'componentName',
|
|
23
|
+
type: 'text',
|
|
24
|
+
required: true,
|
|
25
|
+
admin: {
|
|
26
|
+
width: '50%',
|
|
27
|
+
description: 'Nome del componente in codebase. ATTENZIONE!!! usare stesso nome componente React',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'propsSchema',
|
|
34
|
+
type: 'json',
|
|
35
|
+
admin: {
|
|
36
|
+
description: 'Riporta a sistema la struttura e gli argomenti del componente, non usato in fase di build, ma consultabile in fase di definizione di View Mode o mapping di View Block. Sì potenzialmente inutile, ma comoda',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
};
|
|
@@ -1,40 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
export const collectionMenus = ({ relationToOptions = ['pages'], }) => {
|
|
1
|
+
export const collectionMenus = () => {
|
|
3
2
|
return {
|
|
4
3
|
slug: 'menus',
|
|
5
4
|
admin: {
|
|
6
5
|
useAsTitle: 'name',
|
|
7
6
|
},
|
|
8
7
|
fields: [
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
{ type: 'text', name: 'name' },
|
|
9
|
+
{
|
|
10
|
+
type: 'array',
|
|
11
11
|
name: 'menuItems',
|
|
12
12
|
label: 'Menu items',
|
|
13
|
-
type: 'array',
|
|
14
13
|
fields: [
|
|
15
|
-
|
|
14
|
+
{
|
|
15
|
+
type: 'checkbox',
|
|
16
16
|
name: 'is-external',
|
|
17
17
|
label: 'open in new tab',
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
},
|
|
19
|
+
{ type: 'text', name: 'label', label: 'label' },
|
|
20
|
+
{ type: 'relationship', name: 'relationship', relationTo: ['pages'] },
|
|
21
|
+
{
|
|
22
|
+
type: 'array',
|
|
22
23
|
name: 'sub-menu',
|
|
23
24
|
label: 'Sub menu',
|
|
24
25
|
admin: {
|
|
25
26
|
description: "Aggiungere voci figlio a una voce di menù ne disabilita il click di navigazione per permettere l'apertura del dropdown",
|
|
26
27
|
},
|
|
27
28
|
fields: [
|
|
28
|
-
|
|
29
|
+
{
|
|
30
|
+
type: 'checkbox',
|
|
29
31
|
name: 'is-external',
|
|
30
32
|
label: 'open in new tab',
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
},
|
|
34
|
+
{ type: 'text', name: 'label', label: 'label' },
|
|
35
|
+
{ type: 'relationship', name: 'relationship', relationTo: ['pages'] },
|
|
34
36
|
],
|
|
35
|
-
}
|
|
37
|
+
},
|
|
36
38
|
],
|
|
37
|
-
}
|
|
39
|
+
},
|
|
38
40
|
],
|
|
39
41
|
};
|
|
40
42
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { fieldCss } from '../fields/fieldCss';
|
|
2
|
+
export const collectionStyles = {
|
|
3
|
+
slug: 'styles',
|
|
4
|
+
labels: {
|
|
5
|
+
plural: 'Styles',
|
|
6
|
+
singular: 'Style',
|
|
7
|
+
},
|
|
8
|
+
admin: {
|
|
9
|
+
useAsTitle: 'name',
|
|
10
|
+
description: 'Uno stile è 1 o più regole CSS che definiscono una regola coerente col design system di questo progetto. Oltre a quelli che puoi aggiungere a sistema cerca gli helper tailwind per applicare stili. Un helper è nella forma di "t:regola-tailwind"',
|
|
11
|
+
},
|
|
12
|
+
fields: [
|
|
13
|
+
{
|
|
14
|
+
name: 'name',
|
|
15
|
+
type: 'text',
|
|
16
|
+
required: true,
|
|
17
|
+
unique: true,
|
|
18
|
+
admin: {
|
|
19
|
+
width: '50%',
|
|
20
|
+
description: 'Nome usato da admin UI per costruire i View Mode e stili dei componenti',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
fieldCss(false),
|
|
24
|
+
],
|
|
25
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CollectionConfig } from 'payload';
|
|
2
2
|
export declare const collectionViewModes: CollectionConfig;
|