@payloadcms/ui 3.0.0-beta.0 → 3.0.0-beta.10

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 (72) hide show
  1. package/dist/elements/HydrateClientUser/index.d.ts +3 -2
  2. package/dist/elements/HydrateClientUser/index.d.ts.map +1 -1
  3. package/dist/elements/HydrateClientUser/index.js.map +1 -1
  4. package/dist/elements/Publish/index.js +1 -1
  5. package/dist/elements/Publish/index.js.map +1 -1
  6. package/dist/elements/withMergedProps/index.d.ts +2 -1
  7. package/dist/elements/withMergedProps/index.d.ts.map +1 -1
  8. package/dist/elements/withMergedProps/index.js +7 -1
  9. package/dist/elements/withMergedProps/index.js.map +1 -1
  10. package/dist/fields/Array/index.d.ts.map +1 -1
  11. package/dist/fields/Array/index.js +3 -2
  12. package/dist/fields/Array/index.js.map +1 -1
  13. package/dist/fields/Blocks/index.d.ts.map +1 -1
  14. package/dist/fields/Blocks/index.js +3 -2
  15. package/dist/fields/Blocks/index.js.map +1 -1
  16. package/dist/fields/Collapsible/index.d.ts.map +1 -1
  17. package/dist/fields/Collapsible/index.js +27 -21
  18. package/dist/fields/Collapsible/index.js.map +1 -1
  19. package/dist/fields/HiddenInput/index.d.ts +1 -1
  20. package/dist/fields/HiddenInput/index.d.ts.map +1 -1
  21. package/dist/fields/HiddenInput/index.js.map +1 -1
  22. package/dist/fields/Tabs/index.d.ts.map +1 -1
  23. package/dist/fields/Tabs/index.js +27 -23
  24. package/dist/fields/Tabs/index.js.map +1 -1
  25. package/dist/providers/ComponentMap/buildComponentMap/WithServerSideProps.d.ts +3 -0
  26. package/dist/providers/ComponentMap/buildComponentMap/WithServerSideProps.d.ts.map +1 -0
  27. package/dist/providers/ComponentMap/buildComponentMap/WithServerSideProps.js +19 -0
  28. package/dist/providers/ComponentMap/buildComponentMap/WithServerSideProps.js.map +1 -0
  29. package/dist/providers/ComponentMap/buildComponentMap/actions.d.ts +2 -1
  30. package/dist/providers/ComponentMap/buildComponentMap/actions.d.ts.map +1 -1
  31. package/dist/providers/ComponentMap/buildComponentMap/actions.js +7 -3
  32. package/dist/providers/ComponentMap/buildComponentMap/actions.js.map +1 -1
  33. package/dist/providers/ComponentMap/buildComponentMap/collections.d.ts +3 -2
  34. package/dist/providers/ComponentMap/buildComponentMap/collections.d.ts.map +1 -1
  35. package/dist/providers/ComponentMap/buildComponentMap/collections.js +35 -14
  36. package/dist/providers/ComponentMap/buildComponentMap/collections.js.map +1 -1
  37. package/dist/providers/ComponentMap/buildComponentMap/fields.d.ts +2 -1
  38. package/dist/providers/ComponentMap/buildComponentMap/fields.d.ts.map +1 -1
  39. package/dist/providers/ComponentMap/buildComponentMap/fields.js +42 -12
  40. package/dist/providers/ComponentMap/buildComponentMap/fields.js.map +1 -1
  41. package/dist/providers/ComponentMap/buildComponentMap/globals.d.ts +3 -2
  42. package/dist/providers/ComponentMap/buildComponentMap/globals.d.ts.map +1 -1
  43. package/dist/providers/ComponentMap/buildComponentMap/globals.js +19 -6
  44. package/dist/providers/ComponentMap/buildComponentMap/globals.js.map +1 -1
  45. package/dist/providers/ComponentMap/buildComponentMap/index.d.ts +2 -1
  46. package/dist/providers/ComponentMap/buildComponentMap/index.d.ts.map +1 -1
  47. package/dist/providers/ComponentMap/buildComponentMap/index.js +20 -4
  48. package/dist/providers/ComponentMap/buildComponentMap/index.js.map +1 -1
  49. package/dist/providers/ComponentMap/index.d.ts +1 -0
  50. package/dist/providers/ComponentMap/index.d.ts.map +1 -1
  51. package/dist/providers/ComponentMap/index.js +1 -0
  52. package/dist/providers/ComponentMap/index.js.map +1 -1
  53. package/dist/scss/app.scss +2 -3
  54. package/dist/scss/vars.scss +0 -7
  55. package/package.json +9 -9
  56. package/dist/assets/fonts/SuisseIntl-Bold.woff +0 -0
  57. package/dist/assets/fonts/SuisseIntl-Bold.woff2 +0 -0
  58. package/dist/assets/fonts/SuisseIntl-Medium.woff +0 -0
  59. package/dist/assets/fonts/SuisseIntl-Medium.woff2 +0 -0
  60. package/dist/assets/fonts/SuisseIntl-SemiBold.woff +0 -0
  61. package/dist/assets/fonts/SuisseIntl-SemiBold.woff2 +0 -0
  62. package/dist/assets/fonts/SuisseIntl.woff +0 -0
  63. package/dist/assets/fonts/SuisseIntl.woff2 +0 -0
  64. package/dist/assets/fonts/merriweather-v30-latin-900.woff +0 -0
  65. package/dist/assets/fonts/merriweather-v30-latin-900.woff2 +0 -0
  66. package/dist/assets/fonts/merriweather-v30-latin-900italic.woff +0 -0
  67. package/dist/assets/fonts/merriweather-v30-latin-900italic.woff2 +0 -0
  68. package/dist/assets/fonts/merriweather-v30-latin-italic.woff +0 -0
  69. package/dist/assets/fonts/merriweather-v30-latin-italic.woff2 +0 -0
  70. package/dist/assets/fonts/merriweather-v30-latin-regular.woff +0 -0
  71. package/dist/assets/fonts/merriweather-v30-latin-regular.woff2 +0 -0
  72. package/dist/scss/fonts.scss +0 -75
@@ -27,12 +27,14 @@ const TabsField = (props)=>{
27
27
  const [activeTabIndex, setActiveTabIndex] = useState(0);
28
28
  const tabsPrefKey = `tabs-${indexPath}`;
29
29
  useEffect(()=>{
30
- const getInitialPref = async ()=>{
31
- const existingPreferences = await getPreference(preferencesKey);
32
- const initialIndex = path ? existingPreferences?.fields?.[path]?.tabIndex : existingPreferences?.fields?.[tabsPrefKey]?.tabIndex;
33
- setActiveTabIndex(initialIndex || 0);
34
- };
35
- void getInitialPref();
30
+ if (preferencesKey) {
31
+ const getInitialPref = async ()=>{
32
+ const existingPreferences = await getPreference(preferencesKey);
33
+ const initialIndex = path ? existingPreferences?.fields?.[path]?.tabIndex : existingPreferences?.fields?.[tabsPrefKey]?.tabIndex;
34
+ setActiveTabIndex(initialIndex || 0);
35
+ };
36
+ void getInitialPref();
37
+ }
36
38
  }, [
37
39
  path,
38
40
  getPreference,
@@ -42,26 +44,28 @@ const TabsField = (props)=>{
42
44
  const handleTabChange = useCallback(async (incomingTabIndex)=>{
43
45
  setActiveTabIndex(incomingTabIndex);
44
46
  const existingPreferences = await getPreference(preferencesKey);
45
- void setPreference(preferencesKey, {
46
- ...existingPreferences,
47
- ...path ? {
48
- fields: {
49
- ...existingPreferences?.fields || {},
50
- [path]: {
51
- ...existingPreferences?.fields?.[path],
52
- tabIndex: incomingTabIndex
47
+ if (preferencesKey) {
48
+ void setPreference(preferencesKey, {
49
+ ...existingPreferences,
50
+ ...path ? {
51
+ fields: {
52
+ ...existingPreferences?.fields || {},
53
+ [path]: {
54
+ ...existingPreferences?.fields?.[path],
55
+ tabIndex: incomingTabIndex
56
+ }
53
57
  }
54
- }
55
- } : {
56
- fields: {
57
- ...existingPreferences?.fields,
58
- [tabsPrefKey]: {
59
- ...existingPreferences?.fields?.[tabsPrefKey],
60
- tabIndex: incomingTabIndex
58
+ } : {
59
+ fields: {
60
+ ...existingPreferences?.fields,
61
+ [tabsPrefKey]: {
62
+ ...existingPreferences?.fields?.[tabsPrefKey],
63
+ tabIndex: incomingTabIndex
64
+ }
61
65
  }
62
66
  }
63
- }
64
- });
67
+ });
68
+ }
65
69
  }, [
66
70
  preferencesKey,
67
71
  getPreference,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/Tabs/index.tsx"],"sourcesContent":["'use client'\nimport type { FieldPermissions } from 'payload/auth'\nimport type { DocumentPreferences } from 'payload/types'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { FieldDescription } from '@payloadcms/ui/forms/FieldDescription'\nimport { toKebabCase } from 'payload/utilities'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { MappedTab } from '../../providers/ComponentMap/buildComponentMap/types.js'\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { useCollapsible } from '../../elements/Collapsible/provider.js'\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { RenderFields } from '../../forms/RenderFields/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { usePreferences } from '../../providers/Preferences/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { TabComponent } from './Tab/index.js'\nimport './index.scss'\nimport { TabsProvider } from './provider.js'\n\nconst baseClass = 'tabs-field'\n\nexport { TabsProvider }\n\nexport type TabsFieldProps = FormFieldBase & {\n forceRender?: boolean\n name?: string\n path?: string\n permissions: FieldPermissions\n tabs?: MappedTab[]\n width?: string\n}\n\nconst TabsField: React.FC<TabsFieldProps> = (props) => {\n const {\n name,\n CustomDescription,\n className,\n descriptionProps,\n forceRender = false,\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n tabs = [],\n } = props\n\n const {\n indexPath,\n path: pathFromContext,\n permissions,\n readOnly: readOnlyFromContext,\n schemaPath,\n } = useFieldProps()\n const readOnly = readOnlyFromProps || readOnlyFromContext\n const path = pathFromContext || pathFromProps || name\n const { getPreference, setPreference } = usePreferences()\n const { preferencesKey } = useDocumentInfo()\n const { i18n } = useTranslation()\n const { isWithinCollapsible } = useCollapsible()\n const [activeTabIndex, setActiveTabIndex] = useState<number>(0)\n const tabsPrefKey = `tabs-${indexPath}`\n\n useEffect(() => {\n const getInitialPref = async () => {\n const existingPreferences: DocumentPreferences = await getPreference(preferencesKey)\n const initialIndex = path\n ? existingPreferences?.fields?.[path]?.tabIndex\n : existingPreferences?.fields?.[tabsPrefKey]?.tabIndex\n setActiveTabIndex(initialIndex || 0)\n }\n void getInitialPref()\n }, [path, getPreference, preferencesKey, tabsPrefKey])\n\n const handleTabChange = useCallback(\n async (incomingTabIndex: number) => {\n setActiveTabIndex(incomingTabIndex)\n\n const existingPreferences: DocumentPreferences = await getPreference(preferencesKey)\n\n void setPreference(preferencesKey, {\n ...existingPreferences,\n ...(path\n ? {\n fields: {\n ...(existingPreferences?.fields || {}),\n [path]: {\n ...existingPreferences?.fields?.[path],\n tabIndex: incomingTabIndex,\n },\n },\n }\n : {\n fields: {\n ...existingPreferences?.fields,\n [tabsPrefKey]: {\n ...existingPreferences?.fields?.[tabsPrefKey],\n tabIndex: incomingTabIndex,\n },\n },\n }),\n })\n },\n [preferencesKey, getPreference, setPreference, path, tabsPrefKey],\n )\n\n const activeTabConfig = tabs[activeTabIndex]\n\n return (\n <div\n className={[\n fieldBaseClass,\n className,\n baseClass,\n isWithinCollapsible && `${baseClass}--within-collapsible`,\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <TabsProvider>\n <div className={`${baseClass}__tabs-wrap`}>\n <div className={`${baseClass}__tabs`}>\n {tabs.map((tab, tabIndex) => {\n return (\n <TabComponent\n isActive={activeTabIndex === tabIndex}\n key={tabIndex}\n parentPath={path}\n setIsActive={() => handleTabChange(tabIndex)}\n tab={tab}\n />\n )\n })}\n </div>\n </div>\n <div className={`${baseClass}__content-wrap`}>\n {activeTabConfig && (\n <React.Fragment>\n <div\n className={[\n `${baseClass}__tab`,\n activeTabConfig.label &&\n `${baseClass}__tabConfigLabel-${toKebabCase(\n getTranslation(activeTabConfig.label, i18n),\n )}`,\n ]\n .filter(Boolean)\n .join(' ')}\n >\n {CustomDescription ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n <RenderFields\n fieldMap={activeTabConfig.fieldMap}\n forceRender={forceRender}\n key={\n activeTabConfig.label\n ? getTranslation(activeTabConfig.label, i18n)\n : activeTabConfig['name']\n }\n margins=\"small\"\n path={`${path ? `${path}.` : ''}${activeTabConfig.name ? `${activeTabConfig.name}` : ''}`}\n permissions={\n 'name' in activeTabConfig && permissions?.fields?.[activeTabConfig.name]?.fields\n ? permissions?.fields?.[activeTabConfig.name]?.fields\n : permissions?.fields\n }\n readOnly={readOnly}\n schemaPath={`${schemaPath ? `${schemaPath}` : ''}${activeTabConfig.name ? `.${activeTabConfig.name}` : ''}`}\n />\n </div>\n </React.Fragment>\n )}\n </div>\n </TabsProvider>\n </div>\n )\n}\n\nexport const Tabs = withCondition(TabsField)\n"],"names":["getTranslation","FieldDescription","toKebabCase","React","useCallback","useEffect","useState","useCollapsible","useFieldProps","RenderFields","withCondition","useDocumentInfo","usePreferences","useTranslation","fieldBaseClass","TabComponent","TabsProvider","baseClass","TabsField","props","name","CustomDescription","className","descriptionProps","forceRender","path","pathFromProps","readOnly","readOnlyFromProps","tabs","indexPath","pathFromContext","permissions","readOnlyFromContext","schemaPath","getPreference","setPreference","preferencesKey","i18n","isWithinCollapsible","activeTabIndex","setActiveTabIndex","tabsPrefKey","getInitialPref","existingPreferences","initialIndex","fields","tabIndex","handleTabChange","incomingTabIndex","activeTabConfig","div","filter","Boolean","join","map","tab","isActive","key","parentPath","setIsActive","Fragment","label","fieldMap","margins","Tabs"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SAASC,gBAAgB,QAAQ,wCAAuC;AACxE,SAASC,WAAW,QAAQ,oBAAmB;AAC/C,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAK/D,SAASC,cAAc,QAAQ,yCAAwC;AACvE,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,YAAY,QAAQ,oCAAmC;AAChE,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,YAAY,QAAQ,iBAAgB;AAE7C,SAASC,YAAY,QAAQ,gBAAe;AAE5C,MAAMC,YAAY;AAElB,SAASD,YAAY,GAAE;AAWvB,MAAME,YAAsC,CAACC;IAC3C,MAAM,EACJC,IAAI,EACJC,iBAAiB,EACjBC,SAAS,EACTC,gBAAgB,EAChBC,cAAc,KAAK,EACnBC,MAAMC,aAAa,EACnB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AAgB9B,IAAI,GAAG,CAAC,EAAE8B,gBAAgB9B,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;QACzFY,aACE,UAAUkB,mBAAmBlB,aAAac,QAAQ,CAACI,gBAAgB9B,IAAI,CAAC,EAAE0B,SACtEd,aAAac,QAAQ,CAACI,gBAAgB9B,IAAI,CAAC,EAAE0B,SAC7Cd,aAAac;QAEnBnB,UAAUA;QACVO,YAAY,CAAC,EAAEA,aAAa,CAAC,EAAEA,WAAW,CAAC,GAAG,GAAG,EAAEgB,gBAAgB9B,IAAI,GAAG,CAAC,CAAC,EAAE8B,gBAAgB9B,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;;AAS7H;AAEA,OAAO,MAAM6C,OAAOvD,cAAcQ,WAAU"}
1
+ {"version":3,"sources":["../../../src/fields/Tabs/index.tsx"],"sourcesContent":["'use client'\nimport type { FieldPermissions } from 'payload/auth'\nimport type { DocumentPreferences } from 'payload/types'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { FieldDescription } from '@payloadcms/ui/forms/FieldDescription'\nimport { toKebabCase } from 'payload/utilities'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { MappedTab } from '../../providers/ComponentMap/buildComponentMap/types.js'\nimport type { FormFieldBase } from '../shared/index.js'\n\nimport { useCollapsible } from '../../elements/Collapsible/provider.js'\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { RenderFields } from '../../forms/RenderFields/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { usePreferences } from '../../providers/Preferences/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { TabComponent } from './Tab/index.js'\nimport './index.scss'\nimport { TabsProvider } from './provider.js'\n\nconst baseClass = 'tabs-field'\n\nexport { TabsProvider }\n\nexport type TabsFieldProps = FormFieldBase & {\n forceRender?: boolean\n name?: string\n path?: string\n permissions: FieldPermissions\n tabs?: MappedTab[]\n width?: string\n}\n\nconst TabsField: React.FC<TabsFieldProps> = (props) => {\n const {\n name,\n CustomDescription,\n className,\n descriptionProps,\n forceRender = false,\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n tabs = [],\n } = props\n\n const {\n indexPath,\n path: pathFromContext,\n permissions,\n readOnly: readOnlyFromContext,\n schemaPath,\n } = useFieldProps()\n const readOnly = readOnlyFromProps || readOnlyFromContext\n const path = pathFromContext || pathFromProps || name\n const { getPreference, setPreference } = usePreferences()\n const { preferencesKey } = useDocumentInfo()\n const { i18n } = useTranslation()\n const { isWithinCollapsible } = useCollapsible()\n const [activeTabIndex, setActiveTabIndex] = useState<number>(0)\n const tabsPrefKey = `tabs-${indexPath}`\n\n useEffect(() => {\n if (preferencesKey) {\n const getInitialPref = async () => {\n const existingPreferences: DocumentPreferences = await getPreference(preferencesKey)\n const initialIndex = path\n ? existingPreferences?.fields?.[path]?.tabIndex\n : existingPreferences?.fields?.[tabsPrefKey]?.tabIndex\n setActiveTabIndex(initialIndex || 0)\n }\n void getInitialPref()\n }\n }, [path, getPreference, preferencesKey, tabsPrefKey])\n\n const handleTabChange = useCallback(\n async (incomingTabIndex: number) => {\n setActiveTabIndex(incomingTabIndex)\n\n const existingPreferences: DocumentPreferences = await getPreference(preferencesKey)\n\n if (preferencesKey) {\n void setPreference(preferencesKey, {\n ...existingPreferences,\n ...(path\n ? {\n fields: {\n ...(existingPreferences?.fields || {}),\n [path]: {\n ...existingPreferences?.fields?.[path],\n tabIndex: incomingTabIndex,\n },\n },\n }\n : {\n fields: {\n ...existingPreferences?.fields,\n [tabsPrefKey]: {\n ...existingPreferences?.fields?.[tabsPrefKey],\n tabIndex: incomingTabIndex,\n },\n },\n }),\n })\n }\n },\n [preferencesKey, getPreference, setPreference, path, tabsPrefKey],\n )\n\n const activeTabConfig = tabs[activeTabIndex]\n\n return (\n <div\n className={[\n fieldBaseClass,\n className,\n baseClass,\n isWithinCollapsible && `${baseClass}--within-collapsible`,\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <TabsProvider>\n <div className={`${baseClass}__tabs-wrap`}>\n <div className={`${baseClass}__tabs`}>\n {tabs.map((tab, tabIndex) => {\n return (\n <TabComponent\n isActive={activeTabIndex === tabIndex}\n key={tabIndex}\n parentPath={path}\n setIsActive={() => handleTabChange(tabIndex)}\n tab={tab}\n />\n )\n })}\n </div>\n </div>\n <div className={`${baseClass}__content-wrap`}>\n {activeTabConfig && (\n <React.Fragment>\n <div\n className={[\n `${baseClass}__tab`,\n activeTabConfig.label &&\n `${baseClass}__tabConfigLabel-${toKebabCase(\n getTranslation(activeTabConfig.label, i18n),\n )}`,\n ]\n .filter(Boolean)\n .join(' ')}\n >\n {CustomDescription ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n <RenderFields\n fieldMap={activeTabConfig.fieldMap}\n forceRender={forceRender}\n key={\n activeTabConfig.label\n ? getTranslation(activeTabConfig.label, i18n)\n : activeTabConfig['name']\n }\n margins=\"small\"\n path={`${path ? `${path}.` : ''}${activeTabConfig.name ? `${activeTabConfig.name}` : ''}`}\n permissions={\n 'name' in activeTabConfig && permissions?.fields?.[activeTabConfig.name]?.fields\n ? permissions?.fields?.[activeTabConfig.name]?.fields\n : permissions?.fields\n }\n readOnly={readOnly}\n schemaPath={`${schemaPath ? `${schemaPath}` : ''}${activeTabConfig.name ? `.${activeTabConfig.name}` : ''}`}\n />\n </div>\n </React.Fragment>\n )}\n </div>\n </TabsProvider>\n </div>\n )\n}\n\nexport const Tabs = withCondition(TabsField)\n"],"names":["getTranslation","FieldDescription","toKebabCase","React","useCallback","useEffect","useState","useCollapsible","useFieldProps","RenderFields","withCondition","useDocumentInfo","usePreferences","useTranslation","fieldBaseClass","TabComponent","TabsProvider","baseClass","TabsField","props","name","CustomDescription","className","descriptionProps","forceRender","path","pathFromProps","readOnly","readOnlyFromProps","tabs","indexPath","pathFromContext","permissions","readOnlyFromContext","schemaPath","getPreference","setPreference","preferencesKey","i18n","isWithinCollapsible","activeTabIndex","setActiveTabIndex","tabsPrefKey","getInitialPref","existingPreferences","initialIndex","fields","tabIndex","handleTabChange","incomingTabIndex","activeTabConfig","div","filter","Boolean","join","map","tab","isActive","key","parentPath","setIsActive","Fragment","label","fieldMap","margins","Tabs"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SAASC,gBAAgB,QAAQ,wCAAuC;AACxE,SAASC,WAAW,QAAQ,oBAAmB;AAC/C,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAK/D,SAASC,cAAc,QAAQ,yCAAwC;AACvE,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,YAAY,QAAQ,oCAAmC;AAChE,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,YAAY,QAAQ,iBAAgB;AAE7C,SAASC,YAAY,QAAQ,gBAAe;AAE5C,MAAMC,YAAY;AAElB,SAASD,YAAY,GAAE;AAWvB,MAAME,YAAsC,CAACC;IAC3C,MAAM,EACJC,IAAI,EACJC,iBAAiB,EACjBC,SAAS,EACTC,gBAAgB,EAChBC,cAAc,KAAK,EACnBC,MAAMC,aAAa,EACnBC,UAAUC,iBAAiB,EAC3BC,OAAO,EAAE,EACV,GAAGV;IAEJ,MAAM,EACJW,SAAS,EACTL,MAAMM,eAAe,EACrBC,WAAW,EACXL,UAAUM,mBAAmB,EAC7BC,UAAU,EACX,GAAG1B;IACJ,MAAMmB,WAAWC,qB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AAQ,CAACI,gBAAgB9B,IAAI,CAAC,EAAE0B,SACtEd,aAAac,QAAQ,CAACI,gBAAgB9B,IAAI,CAAC,EAAE0B,SAC7Cd,aAAac;QAEnBnB,UAAUA;QACVO,YAAY,CAAC,EAAEA,aAAa,CAAC,EAAEA,WAAW,CAAC,GAAG,GAAG,EAAEgB,gBAAgB9B,IAAI,GAAG,CAAC,CAAC,EAAE8B,gBAAgB9B,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;;AAS7H;AAEA,OAAO,MAAM6C,OAAOvD,cAAcQ,WAAU"}
@@ -0,0 +1,3 @@
1
+ import type { WithServerSideProps as WithServerSidePropsType } from 'payload/types';
2
+ export declare const WithServerSideProps: WithServerSidePropsType;
3
+ //# sourceMappingURL=WithServerSideProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WithServerSideProps.d.ts","sourceRoot":"","sources":["../../../../src/providers/ComponentMap/buildComponentMap/WithServerSideProps.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,IAAI,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAKnF,eAAO,MAAM,mBAAmB,EAAE,uBAejC,CAAA"}
@@ -0,0 +1,19 @@
1
+ import { isReactServerComponent } from 'payload/utilities';
2
+ import React from 'react';
3
+ export const WithServerSideProps = ({ Component, payload, ...rest })=>{
4
+ if (Component) {
5
+ const WithServerSideProps = (passedProps)=>{
6
+ const propsWithPayload = {
7
+ ...passedProps,
8
+ ...isReactServerComponent(Component) ? {
9
+ payload
10
+ } : {}
11
+ };
12
+ return /*#__PURE__*/ React.createElement(Component, propsWithPayload);
13
+ };
14
+ return /*#__PURE__*/ React.createElement(WithServerSideProps, rest);
15
+ }
16
+ return null;
17
+ };
18
+
19
+ //# sourceMappingURL=WithServerSideProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/providers/ComponentMap/buildComponentMap/WithServerSideProps.tsx"],"sourcesContent":["import type { WithServerSideProps as WithServerSidePropsType } from 'payload/types'\n\nimport { isReactServerComponent } from 'payload/utilities'\nimport React from 'react'\n\nexport const WithServerSideProps: WithServerSidePropsType = ({ Component, payload, ...rest }) => {\n if (Component) {\n const WithServerSideProps: React.FC<any> = (passedProps) => {\n const propsWithPayload = {\n ...passedProps,\n ...(isReactServerComponent(Component) ? { payload } : {}),\n }\n\n return <Component {...propsWithPayload} />\n }\n\n return <WithServerSideProps {...rest} />\n }\n\n return null\n}\n"],"names":["isReactServerComponent","React","WithServerSideProps","Component","payload","rest","passedProps","propsWithPayload"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,sBAAsB,QAAQ,oBAAmB;AAC1D,OAAOC,WAAW,QAAO;AAEzB,OAAO,MAAMC,sBAA+C,CAAC,EAAEC,SAAS,EAAEC,OAAO,EAAE,GAAGC,MAAM;IAC1F,IAAIF,WAAW;QACb,MAAMD,sBAAqC,CAACI;YAC1C,MAAMC,mBAAmB;gBACvB,GAAGD,WAAW;gBACd,GAAIN,uBAAuBG,aAAa;oBAAEC;gBAAQ,IAAI,CAAC,CAAC;YAC1D;YAEA,qBAAO,oBAACD,WAAcI;QACxB;QAEA,qBAAO,oBAACL,qBAAwBG;IAClC;IAEA,OAAO;AACT,EAAC"}
@@ -1,6 +1,7 @@
1
- import type { SanitizedCollectionConfig, SanitizedGlobalConfig } from 'payload/types';
1
+ import type { SanitizedCollectionConfig, SanitizedGlobalConfig, WithServerSideProps as WithServerSidePropsType } from 'payload/types';
2
2
  import type { ActionMap } from './types.js';
3
3
  export declare const mapActions: (args: {
4
+ WithServerSideProps: WithServerSidePropsType;
4
5
  collectionConfig?: SanitizedCollectionConfig;
5
6
  globalConfig?: SanitizedGlobalConfig;
6
7
  }) => ActionMap;
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../../src/providers/ComponentMap/buildComponentMap/actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAIrF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,eAAO,MAAM,UAAU,SAAU;IAC/B,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C,YAAY,CAAC,EAAE,qBAAqB,CAAA;CACrC,KAAG,SAuCH,CAAA"}
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../../src/providers/ComponentMap/buildComponentMap/actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,IAAI,uBAAuB,EAC/C,MAAM,eAAe,CAAA;AAItB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,eAAO,MAAM,UAAU,SAAU;IAC/B,mBAAmB,EAAE,uBAAuB,CAAA;IAC5C,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C,YAAY,CAAC,EAAE,qBAAqB,CAAA;CACrC,KAAG,SAuCH,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  export const mapActions = (args)=>{
3
- const { collectionConfig, globalConfig } = args;
3
+ const { WithServerSideProps, collectionConfig, globalConfig } = args;
4
4
  const editViews = (collectionConfig || globalConfig)?.admin?.components?.views?.Edit;
5
5
  const listActions = typeof collectionConfig?.admin?.components?.views?.List === 'object' ? collectionConfig?.admin?.components?.views?.List?.actions : undefined;
6
6
  const result = {
@@ -15,7 +15,9 @@ export const mapActions = (args)=>{
15
15
  if (typeof Action === 'function') {
16
16
  result.Edit[key] = [
17
17
  ...result[key] || [],
18
- /*#__PURE__*/ React.createElement(Action, null)
18
+ /*#__PURE__*/ React.createElement(WithServerSideProps, {
19
+ Component: Action
20
+ })
19
21
  ];
20
22
  }
21
23
  });
@@ -29,7 +31,9 @@ export const mapActions = (args)=>{
29
31
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
30
32
  result.List = [
31
33
  ...result.List,
32
- /*#__PURE__*/ React.createElement(Action, null)
34
+ /*#__PURE__*/ React.createElement(WithServerSideProps, {
35
+ Component: Action
36
+ })
33
37
  ];
34
38
  }
35
39
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/providers/ComponentMap/buildComponentMap/actions.tsx"],"sourcesContent":["import type { SanitizedCollectionConfig, SanitizedGlobalConfig } from 'payload/types'\n\nimport React from 'react'\n\nimport type { ActionMap } from './types.js'\n\nexport const mapActions = (args: {\n collectionConfig?: SanitizedCollectionConfig\n globalConfig?: SanitizedGlobalConfig\n}): ActionMap => {\n const { collectionConfig, globalConfig } = args\n\n const editViews = (collectionConfig || globalConfig)?.admin?.components?.views?.Edit\n\n const listActions =\n typeof collectionConfig?.admin?.components?.views?.List === 'object'\n ? collectionConfig?.admin?.components?.views?.List?.actions\n : undefined\n\n const result: ActionMap = {\n Edit: {},\n List: [],\n }\n\n if (editViews) {\n Object.entries(editViews).forEach(([key, view]) => {\n if (typeof view === 'object' && 'actions' in view) {\n view.actions.forEach((action) => {\n const Action = action\n if (typeof Action === 'function') {\n result.Edit[key] = [...(result[key] || []), <Action />]\n }\n })\n }\n })\n }\n\n if (listActions) {\n listActions.forEach((action) => {\n const Action = action\n if (typeof Action === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n result.List = [...result.List, <Action />]\n }\n })\n }\n\n return result\n}\n"],"names":["React","mapActions","args","collectionConfig","globalConfig","editViews","admin","components","views","Edit","listActions","List","actions","undefined","result","Object","entries","forEach","key","view","action","Action"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAOA,WAAW,QAAO;AAIzB,OAAO,MAAMC,aAAa,CAACC;IAIzB,MAAM,EAAEC,gBAAgB,EAAEC,YAAY,EAAE,GAAGF;IAE3C,MAAMG,YAAaF,CAAAA,oBAAoBC,YAAW,GAAIE,OAAOC,YAAYC,OAAOC;IAEhF,MAAMC,cACJ,OAAOP,kBAAkBG,OAAOC,YAAYC,OAAOG,SAAS,WACxDR,kBAAkBG,OAAOC,YAAYC,OAAOG,MAAMC,UAClDC;IAEN,MAAMC,SAAoB;QACxBL,MAAM,CAAC;QACPE,MAAM,EAAE;IACV;IAEA,IAAIN,WAAW;QACbU,OAAOC,OAAO,CAACX,WAAWY,OAAO,CAAC,CAAC,CAACC,KAAKC,KAAK;YAC5C,IAAI,OAAOA,SAAS,YAAY,aAAaA,MAAM;gBACjDA,KAAKP,OAAO,CAACK,OAAO,CAAC,CAACG;oBACpB,MAAMC,SAASD;oBACf,IAAI,OAAOC,WAAW,YAAY;wBAChCP,OAAOL,IAAI,CAACS,IAAI,GAAG;+BAAKJ,MAAM,CAACI,IAAI,IAAI,EAAE;0CAAG,oBAACG;yBAAU;oBACzD;gBACF;YACF;QACF;IACF;IAEA,IAAIX,aAAa;QACfA,YAAYO,OAAO,CAAC,CAACG;YACnB,MAAMC,SAASD;YACf,IAAI,OAAOC,WAAW,YAAY;gBAChC,mEAAmE;gBACnEP,OAAOH,IAAI,GAAG;uBAAIG,OAAOH,IAAI;kCAAE,oBAACU;iBAAU;YAC5C;QACF;IACF;IAEA,OAAOP;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../../src/providers/ComponentMap/buildComponentMap/actions.tsx"],"sourcesContent":["import type {\n SanitizedCollectionConfig,\n SanitizedGlobalConfig,\n WithServerSideProps as WithServerSidePropsType,\n} from 'payload/types'\n\nimport React from 'react'\n\nimport type { ActionMap } from './types.js'\n\nexport const mapActions = (args: {\n WithServerSideProps: WithServerSidePropsType\n collectionConfig?: SanitizedCollectionConfig\n globalConfig?: SanitizedGlobalConfig\n}): ActionMap => {\n const { WithServerSideProps, collectionConfig, globalConfig } = args\n\n const editViews = (collectionConfig || globalConfig)?.admin?.components?.views?.Edit\n\n const listActions =\n typeof collectionConfig?.admin?.components?.views?.List === 'object'\n ? collectionConfig?.admin?.components?.views?.List?.actions\n : undefined\n\n const result: ActionMap = {\n Edit: {},\n List: [],\n }\n\n if (editViews) {\n Object.entries(editViews).forEach(([key, view]) => {\n if (typeof view === 'object' && 'actions' in view) {\n view.actions.forEach((action) => {\n const Action = action\n if (typeof Action === 'function') {\n result.Edit[key] = [...(result[key] || []), <WithServerSideProps Component={Action} />]\n }\n })\n }\n })\n }\n\n if (listActions) {\n listActions.forEach((action) => {\n const Action = action\n if (typeof Action === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n result.List = [...result.List, <WithServerSideProps Component={Action} />]\n }\n })\n }\n\n return result\n}\n"],"names":["React","mapActions","args","WithServerSideProps","collectionConfig","globalConfig","editViews","admin","components","views","Edit","listActions","List","actions","undefined","result","Object","entries","forEach","key","view","action","Action","Component"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAMA,OAAOA,WAAW,QAAO;AAIzB,OAAO,MAAMC,aAAa,CAACC;IAKzB,MAAM,EAAEC,mBAAmB,EAAEC,gBAAgB,EAAEC,YAAY,EAAE,GAAGH;IAEhE,MAAMI,YAAaF,CAAAA,oBAAoBC,YAAW,GAAIE,OAAOC,YAAYC,OAAOC;IAEhF,MAAMC,cACJ,OAAOP,kBAAkBG,OAAOC,YAAYC,OAAOG,SAAS,WACxDR,kBAAkBG,OAAOC,YAAYC,OAAOG,MAAMC,UAClDC;IAEN,MAAMC,SAAoB;QACxBL,MAAM,CAAC;QACPE,MAAM,EAAE;IACV;IAEA,IAAIN,WAAW;QACbU,OAAOC,OAAO,CAACX,WAAWY,OAAO,CAAC,CAAC,CAACC,KAAKC,KAAK;YAC5C,IAAI,OAAOA,SAAS,YAAY,aAAaA,MAAM;gBACjDA,KAAKP,OAAO,CAACK,OAAO,CAAC,CAACG;oBACpB,MAAMC,SAASD;oBACf,IAAI,OAAOC,WAAW,YAAY;wBAChCP,OAAOL,IAAI,CAACS,IAAI,GAAG;+BAAKJ,MAAM,CAACI,IAAI,IAAI,EAAE;0CAAG,oBAAChB;gCAAoBoB,WAAWD;;yBAAW;oBACzF;gBACF;YACF;QACF;IACF;IAEA,IAAIX,aAAa;QACfA,YAAYO,OAAO,CAAC,CAACG;YACnB,MAAMC,SAASD;YACf,IAAI,OAAOC,WAAW,YAAY;gBAChC,mEAAmE;gBACnEP,OAAOH,IAAI,GAAG;uBAAIG,OAAOH,IAAI;kCAAE,oBAACT;wBAAoBoB,WAAWD;;iBAAW;YAC5E;QACF;IACF;IAEA,OAAOP;AACT,EAAC"}
@@ -1,10 +1,11 @@
1
1
  import type { I18n } from '@payloadcms/translations';
2
- import type { AdminViewProps, EditViewProps, SanitizedCollectionConfig, SanitizedConfig } from 'payload/types';
2
+ import type { AdminViewProps, EditViewProps, SanitizedCollectionConfig, SanitizedConfig, WithServerSideProps as WithServerSidePropsType } from 'payload/types';
3
3
  import React from 'react';
4
4
  import type { CollectionComponentMap } from './types.js';
5
- export declare const mapCollections: ({ DefaultEditView, DefaultListView, collections, config, i18n, readOnly: readOnlyOverride, }: {
5
+ export declare const mapCollections: ({ DefaultEditView, DefaultListView, WithServerSideProps, collections, config, i18n, readOnly: readOnlyOverride, }: {
6
6
  DefaultEditView: React.FC<EditViewProps>;
7
7
  DefaultListView: React.FC<AdminViewProps>;
8
+ WithServerSideProps: WithServerSidePropsType;
8
9
  collections: SanitizedCollectionConfig[];
9
10
  config: SanitizedConfig;
10
11
  i18n: I18n;
@@ -1 +1 @@
1
- {"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../../../src/providers/ComponentMap/buildComponentMap/collections.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAEpD,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EAGb,yBAAyB,EACzB,eAAe,EAChB,MAAM,eAAe,CAAA;AAItB,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAKxD,eAAO,MAAM,cAAc,iGAOxB;IACD,eAAe,EAAE,MAAM,EAAE,CAAC,aAAa,CAAC,CAAA;IACxC,eAAe,EAAE,MAAM,EAAE,CAAC,cAAc,CAAC,CAAA;IACzC,WAAW,EAAE,yBAAyB,EAAE,CAAA;IACxC,MAAM,EAAE,eAAe,CAAA;IACvB,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,KAAG;IACF,CAAC,GAAG,EAAE,yBAAyB,CAAC,MAAM,CAAC,GAAG,sBAAsB,CAAA;CAoI1D,CAAA"}
1
+ {"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../../../src/providers/ComponentMap/buildComponentMap/collections.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAEpD,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EAGb,yBAAyB,EACzB,eAAe,EACf,mBAAmB,IAAI,uBAAuB,EAC/C,MAAM,eAAe,CAAA;AAItB,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAKxD,eAAO,MAAM,cAAc,sHAQxB;IACD,eAAe,EAAE,MAAM,EAAE,CAAC,aAAa,CAAC,CAAA;IACxC,eAAe,EAAE,MAAM,EAAE,CAAC,cAAc,CAAC,CAAA;IACzC,mBAAmB,EAAE,uBAAuB,CAAA;IAC5C,WAAW,EAAE,yBAAyB,EAAE,CAAA;IACxC,MAAM,EAAE,eAAe,CAAA;IACvB,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,KAAG;IACF,CAAC,GAAG,EAAE,yBAAyB,CAAC,MAAM,CAAC,GAAG,sBAAsB,CAAA;CAsJ1D,CAAA"}
@@ -3,7 +3,7 @@ import { isPlainFunction, isReactComponent } from 'payload/utilities';
3
3
  import React from 'react';
4
4
  import { mapActions } from './actions.js';
5
5
  import { mapFields } from './fields.js';
6
- export const mapCollections = ({ DefaultEditView, DefaultListView, collections, config, i18n, readOnly: readOnlyOverride })=>collections.reduce((acc, collectionConfig)=>{
6
+ export const mapCollections = ({ DefaultEditView, DefaultListView, WithServerSideProps, collections, config, i18n, readOnly: readOnlyOverride })=>collections.reduce((acc, collectionConfig)=>{
7
7
  const { slug, fields } = collectionConfig;
8
8
  const internalCollections = [
9
9
  'payload-preferences',
@@ -18,27 +18,46 @@ export const mapCollections = ({ DefaultEditView, DefaultListView, collections,
18
18
  const CustomListView = typeof listViewFromConfig === 'function' ? listViewFromConfig : typeof listViewFromConfig === 'object' && typeof listViewFromConfig.Component === 'function' ? listViewFromConfig.Component : undefined;
19
19
  const Edit = CustomEditView || DefaultEditView;
20
20
  const List = CustomListView || DefaultListView;
21
- const beforeList = collectionConfig?.admin?.components?.BeforeList;
22
- const beforeListTable = collectionConfig?.admin?.components?.BeforeListTable;
23
- const afterList = collectionConfig?.admin?.components?.AfterList;
24
- const afterListTable = collectionConfig?.admin?.components?.AfterListTable;
25
21
  const SaveButtonComponent = collectionConfig?.admin?.components?.edit?.SaveButton;
26
- const SaveButton = SaveButtonComponent ? /*#__PURE__*/ React.createElement(SaveButtonComponent, null) : undefined;
22
+ const SaveButton = SaveButtonComponent ? /*#__PURE__*/ React.createElement(WithServerSideProps, {
23
+ Component: SaveButtonComponent
24
+ }) : undefined;
27
25
  const SaveDraftButtonComponent = collectionConfig?.admin?.components?.edit?.SaveDraftButton;
28
- const SaveDraftButton = SaveDraftButtonComponent ? /*#__PURE__*/ React.createElement(SaveDraftButtonComponent, null) : undefined;
26
+ const SaveDraftButton = SaveDraftButtonComponent ? /*#__PURE__*/ React.createElement(WithServerSideProps, {
27
+ Component: SaveDraftButtonComponent
28
+ }) : undefined;
29
29
  const PreviewButtonComponent = collectionConfig?.admin?.components?.edit?.PreviewButton;
30
- const PreviewButton = PreviewButtonComponent ? /*#__PURE__*/ React.createElement(PreviewButtonComponent, null) : undefined;
30
+ const PreviewButton = PreviewButtonComponent ? /*#__PURE__*/ React.createElement(WithServerSideProps, {
31
+ Component: PreviewButtonComponent
32
+ }) : undefined;
31
33
  const PublishButtonComponent = collectionConfig?.admin?.components?.edit?.PublishButton;
32
- const PublishButton = PublishButtonComponent ? /*#__PURE__*/ React.createElement(PublishButtonComponent, null) : undefined;
33
- const BeforeList = beforeList && Array.isArray(beforeList) && beforeList?.map((Component)=>/*#__PURE__*/ React.createElement(Component, null)) || null;
34
- const BeforeListTable = beforeListTable && Array.isArray(beforeListTable) && beforeListTable?.map((Component)=>/*#__PURE__*/ React.createElement(Component, null)) || null;
35
- const AfterList = afterList && Array.isArray(afterList) && afterList?.map((Component)=>/*#__PURE__*/ React.createElement(Component, null)) || null;
36
- const AfterListTable = afterListTable && Array.isArray(afterListTable) && afterListTable?.map((Component)=>/*#__PURE__*/ React.createElement(Component, null)) || null;
34
+ const PublishButton = PublishButtonComponent ? /*#__PURE__*/ React.createElement(WithServerSideProps, {
35
+ Component: PublishButtonComponent
36
+ }) : undefined;
37
+ const beforeList = collectionConfig?.admin?.components?.BeforeList;
38
+ const BeforeList = beforeList && Array.isArray(beforeList) && beforeList?.map((Component)=>/*#__PURE__*/ React.createElement(WithServerSideProps, {
39
+ Component: Component
40
+ })) || null;
41
+ const beforeListTable = collectionConfig?.admin?.components?.BeforeListTable;
42
+ const BeforeListTable = beforeListTable && Array.isArray(beforeListTable) && beforeListTable?.map((Component)=>/*#__PURE__*/ React.createElement(WithServerSideProps, {
43
+ Component: Component
44
+ })) || null;
45
+ const afterList = collectionConfig?.admin?.components?.AfterList;
46
+ const AfterList = afterList && Array.isArray(afterList) && afterList?.map((Component)=>/*#__PURE__*/ React.createElement(WithServerSideProps, {
47
+ Component: Component
48
+ })) || null;
49
+ const afterListTable = collectionConfig?.admin?.components?.AfterListTable;
50
+ const AfterListTable = afterListTable && Array.isArray(afterListTable) && afterListTable?.map((Component)=>/*#__PURE__*/ React.createElement(WithServerSideProps, {
51
+ Component: Component
52
+ })) || null;
37
53
  const descriptionProps = {
38
54
  description: collectionConfig.admin && 'description' in collectionConfig.admin && ((typeof collectionConfig.admin?.description === 'string' || typeof collectionConfig.admin?.description === 'object') && collectionConfig.admin.description || typeof collectionConfig.admin?.description === 'function' && isPlainFunction(collectionConfig.admin?.description) && collectionConfig.admin?.description()) || undefined
39
55
  };
40
56
  const DescriptionComponent = collectionConfig.admin && 'description' in collectionConfig.admin && (isReactComponent(collectionConfig.admin.description) && collectionConfig.admin.description || collectionConfig.admin.description && ViewDescription) || undefined;
41
- const Description = DescriptionComponent !== undefined ? /*#__PURE__*/ React.createElement(DescriptionComponent, descriptionProps || {}) : undefined;
57
+ const Description = DescriptionComponent !== undefined ? /*#__PURE__*/ React.createElement(WithServerSideProps, {
58
+ Component: DescriptionComponent,
59
+ ...descriptionProps || {}
60
+ }) : undefined;
42
61
  const componentMap = {
43
62
  AfterList,
44
63
  AfterListTable,
@@ -56,9 +75,11 @@ export const mapCollections = ({ DefaultEditView, DefaultListView, collections,
56
75
  SaveButton,
57
76
  SaveDraftButton,
58
77
  actionsMap: mapActions({
78
+ WithServerSideProps,
59
79
  collectionConfig
60
80
  }),
61
81
  fieldMap: mapFields({
82
+ WithServerSideProps,
62
83
  config,
63
84
  fieldSchema: fields,
64
85
  i18n,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/providers/ComponentMap/buildComponentMap/collections.tsx"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { ViewDescriptionProps } from '@payloadcms/ui/elements/ViewDescription'\nimport type {\n AdminViewProps,\n EditViewProps,\n EntityDescriptionComponent,\n EntityDescriptionFunction,\n SanitizedCollectionConfig,\n SanitizedConfig,\n} from 'payload/types'\n\nimport { ViewDescription } from '@payloadcms/ui/elements/ViewDescription'\nimport { isPlainFunction, isReactComponent } from 'payload/utilities'\nimport React from 'react'\n\nimport type { CollectionComponentMap } from './types.js'\n\nimport { mapActions } from './actions.js'\nimport { mapFields } from './fields.js'\n\nexport const mapCollections = ({\n DefaultEditView,\n DefaultListView,\n collections,\n config,\n i18n,\n readOnly: readOnlyOverride,\n}: {\n DefaultEditView: React.FC<EditViewProps>\n DefaultListView: React.FC<AdminViewProps>\n collections: SanitizedCollectionConfig[]\n config: SanitizedConfig\n i18n: I18n\n readOnly?: boolean\n}): {\n [key: SanitizedCollectionConfig['slug']]: CollectionComponentMap\n} =>\n collections.reduce((acc, collectionConfig) => {\n const { slug, fields } = collectionConfig\n\n const internalCollections = ['payload-preferences', 'payload-migrations']\n\n if (internalCollections.includes(slug)) {\n return acc\n }\n\n const editViewFromConfig = collectionConfig?.admin?.components?.views?.Edit\n\n const listViewFromConfig = collectionConfig?.admin?.components?.views?.List\n\n const CustomEditView =\n typeof editViewFromConfig === 'function'\n ? editViewFromConfig\n : typeof editViewFromConfig === 'object' && typeof editViewFromConfig.Default === 'function'\n ? editViewFromConfig.Default\n : typeof editViewFromConfig?.Default === 'object' &&\n 'Component' in editViewFromConfig.Default &&\n typeof editViewFromConfig.Default.Component === 'function'\n ? (editViewFromConfig.Default.Component as React.FC<EditViewProps>)\n : undefined\n\n const CustomListView =\n typeof listViewFromConfig === 'function'\n ? listViewFromConfig\n : typeof listViewFromConfig === 'object' &&\n typeof listViewFromConfig.Component === 'function'\n ? listViewFromConfig.Component\n : undefined\n\n const Edit = (CustomEditView as React.FC<EditViewProps>) || DefaultEditView\n\n const List = CustomListView || DefaultListView\n\n const beforeList = collectionConfig?.admin?.components?.BeforeList\n\n const beforeListTable = collectionConfig?.admin?.components?.BeforeListTable\n\n const afterList = collectionConfig?.admin?.components?.AfterList\n\n const afterListTable = collectionConfig?.admin?.components?.AfterListTable\n\n const SaveButtonComponent = collectionConfig?.admin?.components?.edit?.SaveButton\n const SaveButton = SaveButtonComponent ? <SaveButtonComponent /> : undefined\n\n const SaveDraftButtonComponent = collectionConfig?.admin?.components?.edit?.SaveDraftButton\n const SaveDraftButton = SaveDraftButtonComponent ? <SaveDraftButtonComponent /> : undefined\n\n const PreviewButtonComponent = collectionConfig?.admin?.components?.edit?.PreviewButton\n const PreviewButton = PreviewButtonComponent ? <PreviewButtonComponent /> : undefined\n\n const PublishButtonComponent = collectionConfig?.admin?.components?.edit?.PublishButton\n const PublishButton = PublishButtonComponent ? <PublishButtonComponent /> : undefined\n\n const BeforeList =\n (beforeList && Array.isArray(beforeList) && beforeList?.map((Component) => <Component />)) ||\n null\n\n const BeforeListTable =\n (beforeListTable &&\n Array.isArray(beforeListTable) &&\n beforeListTable?.map((Component) => <Component />)) ||\n null\n\n const AfterList =\n (afterList && Array.isArray(afterList) && afterList?.map((Component) => <Component />)) ||\n null\n\n const AfterListTable =\n (afterListTable &&\n Array.isArray(afterListTable) &&\n afterListTable?.map((Component) => <Component />)) ||\n null\n\n const descriptionProps: ViewDescriptionProps = {\n description:\n (collectionConfig.admin &&\n 'description' in collectionConfig.admin &&\n (((typeof collectionConfig.admin?.description === 'string' ||\n typeof collectionConfig.admin?.description === 'object') &&\n collectionConfig.admin.description) ||\n (typeof collectionConfig.admin?.description === 'function' &&\n isPlainFunction<EntityDescriptionFunction>(collectionConfig.admin?.description) &&\n collectionConfig.admin?.description()))) ||\n undefined,\n }\n\n const DescriptionComponent =\n (collectionConfig.admin &&\n 'description' in collectionConfig.admin &&\n ((isReactComponent<EntityDescriptionComponent>(collectionConfig.admin.description) &&\n collectionConfig.admin.description) ||\n (collectionConfig.admin.description && ViewDescription))) ||\n undefined\n\n const Description =\n DescriptionComponent !== undefined ? (\n <DescriptionComponent {...(descriptionProps || {})} />\n ) : undefined\n\n const componentMap: CollectionComponentMap = {\n AfterList,\n AfterListTable,\n BeforeList,\n BeforeListTable,\n Description,\n Edit: <Edit collectionSlug={collectionConfig.slug} />,\n List: <List collectionSlug={collectionConfig.slug} />,\n PreviewButton,\n PublishButton,\n SaveButton,\n SaveDraftButton,\n actionsMap: mapActions({\n collectionConfig,\n }),\n fieldMap: mapFields({\n config,\n fieldSchema: fields,\n i18n,\n readOnly: readOnlyOverride,\n }),\n isPreviewEnabled: !!collectionConfig?.admin?.preview,\n }\n\n return {\n ...acc,\n [slug]: componentMap,\n }\n }, {})\n"],"names":["ViewDescription","isPlainFunction","isReactComponent","React","mapActions","mapFields","mapCollections","DefaultEditView","DefaultListView","collections","config","i18n","readOnly","readOnlyOverride","reduce","acc","collectionConfig","slug","fields","internalCollections","includes","editViewFromConfig","admin","components","views","Edit","listViewFromConfig","List","CustomEditView","Default","Component","undefined","CustomListView","beforeList","BeforeList","beforeListTable","BeforeListTable","afterList","AfterList","afterListTable","AfterListTable","SaveButtonComponent","edit","SaveButton","SaveDraftButtonComponent","SaveDraftButton","PreviewButtonComponent","PreviewButton","PublishButtonComponent","PublishButton","Array","isArray","map","descriptionProps","description","DescriptionComponent","Description","componentMap","collectionSlug","actionsMap","fieldMap","fieldSchema","isPreviewEnabled","preview"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAWA,SAASA,eAAe,QAAQ,0CAAyC;AACzE,SAASC,eAAe,EAAEC,gBAAgB,QAAQ,oBAAmB;AACrE,OAAOC,WAAW,QAAO;AAIzB,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,SAAS,QAAQ,cAAa;AAEvC,OAAO,MAAMC,iBAAiB,CAAC,EAC7BC,eAAe,EACfC,eAAe,EACfC,WAAW,EACXC,MAAM,EACNC,IAAI,EACJC,UAAUC,gBAAgB,EAQ3B,GAGCJ,YAAYK,MAAM,CAAC,CAACC,KAAKC;QACvB,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAE,GAAGF;QAEzB,MAAMG,sBAAsB;YAAC;YAAuB;SAAqB;QAEzE,IAAIA,oBAAoBC,QAAQ,CAACH,OAAO;YACtC,OAAOF;QACT;QAEA,MAAMM,qBAAqBL,kBAAkBM,OAAOC,YAAYC,OAAOC;QAEvE,MAAMC,qBAAqBV,kBAAkBM,OAAOC,YAAYC,OAAOG;QAEvE,MAAMC,iBACJ,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;gBAClBK;gBACAmD,aAAa3C;gBACbP;gBACAC,UAAUC;YACZ;YACAiD,kBAAkB,CAAC,CAAC9C,kBAAkBM,OAAOyC;QAC/C;QAEA,OAAO;YACL,GAAGhD,GAAG;YACN,CAACE,KAAK,EAAEwC;QACV;IACF,GAAG,CAAC,GAAE"}
1
+ {"version":3,"sources":["../../../../src/providers/ComponentMap/buildComponentMap/collections.tsx"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { ViewDescriptionProps } from '@payloadcms/ui/elements/ViewDescription'\nimport type {\n AdminViewProps,\n EditViewProps,\n EntityDescriptionComponent,\n EntityDescriptionFunction,\n SanitizedCollectionConfig,\n SanitizedConfig,\n WithServerSideProps as WithServerSidePropsType,\n} from 'payload/types'\n\nimport { ViewDescription } from '@payloadcms/ui/elements/ViewDescription'\nimport { isPlainFunction, isReactComponent } from 'payload/utilities'\nimport React from 'react'\n\nimport type { CollectionComponentMap } from './types.js'\n\nimport { mapActions } from './actions.js'\nimport { mapFields } from './fields.js'\n\nexport const mapCollections = ({\n DefaultEditView,\n DefaultListView,\n WithServerSideProps,\n collections,\n config,\n i18n,\n readOnly: readOnlyOverride,\n}: {\n DefaultEditView: React.FC<EditViewProps>\n DefaultListView: React.FC<AdminViewProps>\n WithServerSideProps: WithServerSidePropsType\n collections: SanitizedCollectionConfig[]\n config: SanitizedConfig\n i18n: I18n\n readOnly?: boolean\n}): {\n [key: SanitizedCollectionConfig['slug']]: CollectionComponentMap\n} =>\n collections.reduce((acc, collectionConfig) => {\n const { slug, fields } = collectionConfig\n\n const internalCollections = ['payload-preferences', 'payload-migrations']\n\n if (internalCollections.includes(slug)) {\n return acc\n }\n\n const editViewFromConfig = collectionConfig?.admin?.components?.views?.Edit\n\n const listViewFromConfig = collectionConfig?.admin?.components?.views?.List\n\n const CustomEditView =\n typeof editViewFromConfig === 'function'\n ? editViewFromConfig\n : typeof editViewFromConfig === 'object' && typeof editViewFromConfig.Default === 'function'\n ? editViewFromConfig.Default\n : typeof editViewFromConfig?.Default === 'object' &&\n 'Component' in editViewFromConfig.Default &&\n typeof editViewFromConfig.Default.Component === 'function'\n ? (editViewFromConfig.Default.Component as React.FC<EditViewProps>)\n : undefined\n\n const CustomListView =\n typeof listViewFromConfig === 'function'\n ? listViewFromConfig\n : typeof listViewFromConfig === 'object' &&\n typeof listViewFromConfig.Component === 'function'\n ? listViewFromConfig.Component\n : undefined\n\n const Edit = (CustomEditView as React.FC<EditViewProps>) || DefaultEditView\n\n const List = CustomListView || DefaultListView\n\n const SaveButtonComponent = collectionConfig?.admin?.components?.edit?.SaveButton\n\n const SaveButton = SaveButtonComponent ? (\n <WithServerSideProps Component={SaveButtonComponent} />\n ) : undefined\n\n const SaveDraftButtonComponent = collectionConfig?.admin?.components?.edit?.SaveDraftButton\n\n const SaveDraftButton = SaveDraftButtonComponent ? (\n <WithServerSideProps Component={SaveDraftButtonComponent} />\n ) : undefined\n\n const PreviewButtonComponent = collectionConfig?.admin?.components?.edit?.PreviewButton\n\n const PreviewButton = PreviewButtonComponent ? (\n <WithServerSideProps Component={PreviewButtonComponent} />\n ) : undefined\n\n const PublishButtonComponent = collectionConfig?.admin?.components?.edit?.PublishButton\n\n const PublishButton = PublishButtonComponent ? (\n <WithServerSideProps Component={PublishButtonComponent} />\n ) : undefined\n\n const beforeList = collectionConfig?.admin?.components?.BeforeList\n\n const BeforeList =\n (beforeList &&\n Array.isArray(beforeList) &&\n beforeList?.map((Component) => <WithServerSideProps Component={Component} />)) ||\n null\n\n const beforeListTable = collectionConfig?.admin?.components?.BeforeListTable\n\n const BeforeListTable =\n (beforeListTable &&\n Array.isArray(beforeListTable) &&\n beforeListTable?.map((Component) => <WithServerSideProps Component={Component} />)) ||\n null\n\n const afterList = collectionConfig?.admin?.components?.AfterList\n\n const AfterList =\n (afterList &&\n Array.isArray(afterList) &&\n afterList?.map((Component) => <WithServerSideProps Component={Component} />)) ||\n null\n\n const afterListTable = collectionConfig?.admin?.components?.AfterListTable\n\n const AfterListTable =\n (afterListTable &&\n Array.isArray(afterListTable) &&\n afterListTable?.map((Component) => <WithServerSideProps Component={Component} />)) ||\n null\n\n const descriptionProps: ViewDescriptionProps = {\n description:\n (collectionConfig.admin &&\n 'description' in collectionConfig.admin &&\n (((typeof collectionConfig.admin?.description === 'string' ||\n typeof collectionConfig.admin?.description === 'object') &&\n collectionConfig.admin.description) ||\n (typeof collectionConfig.admin?.description === 'function' &&\n isPlainFunction<EntityDescriptionFunction>(collectionConfig.admin?.description) &&\n collectionConfig.admin?.description()))) ||\n undefined,\n }\n\n const DescriptionComponent =\n (collectionConfig.admin &&\n 'description' in collectionConfig.admin &&\n ((isReactComponent<EntityDescriptionComponent>(collectionConfig.admin.description) &&\n collectionConfig.admin.description) ||\n (collectionConfig.admin.description && ViewDescription))) ||\n undefined\n\n const Description =\n DescriptionComponent !== undefined ? (\n <WithServerSideProps Component={DescriptionComponent} {...(descriptionProps || {})} />\n ) : undefined\n\n const componentMap: CollectionComponentMap = {\n AfterList,\n AfterListTable,\n BeforeList,\n BeforeListTable,\n Description,\n Edit: <Edit collectionSlug={collectionConfig.slug} />,\n List: <List collectionSlug={collectionConfig.slug} />,\n PreviewButton,\n PublishButton,\n SaveButton,\n SaveDraftButton,\n actionsMap: mapActions({\n WithServerSideProps,\n collectionConfig,\n }),\n fieldMap: mapFields({\n WithServerSideProps,\n config,\n fieldSchema: fields,\n i18n,\n readOnly: readOnlyOverride,\n }),\n isPreviewEnabled: !!collectionConfig?.admin?.preview,\n }\n\n return {\n ...acc,\n [slug]: componentMap,\n }\n }, {})\n"],"names":["ViewDescription","isPlainFunction","isReactComponent","React","mapActions","mapFields","mapCollections","DefaultEditView","DefaultListView","WithServerSideProps","collections","config","i18n","readOnly","readOnlyOverride","reduce","acc","collectionConfig","slug","fields","internalCollections","includes","editViewFromConfig","admin","components","views","Edit","listViewFromConfig","List","CustomEditView","Default","Component","undefined","CustomListView","SaveButtonComponent","edit","SaveButton","SaveDraftButtonComponent","SaveDraftButton","PreviewButtonComponent","PreviewButton","PublishButtonComponent","PublishButton","beforeList","BeforeList","Array","isArray","map","beforeListTable","BeforeListTable","afterList","AfterList","afterListTable","AfterListTable","descriptionProps","description","DescriptionComponent","Description","componentMap","collectionSlug","actionsMap","fieldMap","fieldSchema","isPreviewEnabled","preview"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAYA,SAASA,eAAe,QAAQ,0CAAyC;AACzE,SAASC,eAAe,EAAEC,gBAAgB,QAAQ,oBAAmB;AACrE,OAAOC,WAAW,QAAO;AAIzB,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,SAAS,QAAQ,cAAa;AAEvC,OAAO,MAAMC,iBAAiB,CAAC,EAC7BC,eAAe,EACfC,eAAe,EACfC,mBAAmB,EACnBC,WAAW,EACXC,MAAM,EACNC,IAAI,EACJC,UAAUC,gBAAgB,EAS3B,GAGCJ,YAAYK,MAAM,CAAC,CAACC,KAAKC;QACvB,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAE,GAAGF;QAEzB,MAAMG,sBAAsB;YAAC;YAAuB;SAAqB;QAEzE,IAAIA,oBAAoBC,QAAQ,CAACH,OAAO;YACtC,OAAOF;QACT;QAEA,MAAMM,qBAAqBL,kBAAkBM,OAAOC,YAAYC,OAAOC;QAEvE,MAAMC,qBAAqBV,kBAAkBM,OAAOC,YAAYC,OAAOG;QAEvE,MAAMC,iBACJ,OAAOP,uBAAuB,aAC1BA,qBACA,OAAOA,uBAAuB,YAAY,OAAOA,mBAAmBQ,OAAO,KAAK,aAC9ER,mBAAmBQ,OAAO,GAC1B,OAAOR,oBAAoBQ,YAAY,YACrC,eAAeR,mBAAmBQ,OAAO,IACzC,OAAOR,mBAAmBQ,OAAO,CAACC,SAAS,KAAK,aAC/CT,mBAAmBQ,OAAO,CAACC,SAAS,GACrCC;QAEV,MAA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OAAOyC;QAC/C;QAEA,OAAO;YACL,GAAGhD,GAAG;YACN,CAACE,KAAK,EAAEwC;QACV;IACF,GAAG,CAAC,GAAE"}
@@ -1,7 +1,8 @@
1
1
  import type { I18n } from '@payloadcms/translations';
2
- import type { Field, FieldWithPath, SanitizedConfig } from 'payload/types';
2
+ import type { Field, FieldWithPath, SanitizedConfig, WithServerSideProps as WithServerSidePropsType } from 'payload/types';
3
3
  import type { FieldMap } from './types.js';
4
4
  export declare const mapFields: (args: {
5
+ WithServerSideProps: WithServerSidePropsType;
5
6
  config: SanitizedConfig;
6
7
  /**
7
8
  * If mapFields is used outside of collections, you might not want it to add an id field
@@ -1 +1 @@
1
- {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../src/providers/ComponentMap/buildComponentMap/fields.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAIV,KAAK,EAGL,aAAa,EAIb,eAAe,EAChB,MAAM,eAAe,CAAA;AA4BtB,OAAO,KAAK,EAEV,QAAQ,EAIT,MAAM,YAAY,CAAA;AAInB,eAAO,MAAM,SAAS,SAAU;IAC9B,MAAM,EAAE,eAAe,CAAA;IACvB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,WAAW,EAAE,aAAa,EAAE,CAAA;IAC5B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAA;IAClC,IAAI,EAAE,IAAI,CAAA;IACV,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,aA2sBA,CAAA"}
1
+ {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../src/providers/ComponentMap/buildComponentMap/fields.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAEpD,OAAO,KAAK,EAIV,KAAK,EAGL,aAAa,EAIb,eAAe,EACf,mBAAmB,IAAI,uBAAuB,EAC/C,MAAM,eAAe,CAAA;AAiCtB,OAAO,KAAK,EAEV,QAAQ,EAIT,MAAM,YAAY,CAAA;AAInB,eAAO,MAAM,SAAS,SAAU;IAC9B,mBAAmB,EAAE,uBAAuB,CAAA;IAC5C,MAAM,EAAE,eAAe,CAAA;IACvB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,WAAW,EAAE,aAAa,EAAE,CAAA;IAC5B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAA;IAClC,IAAI,EAAE,IAAI,CAAA;IACV,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,aA6tBA,CAAA"}
@@ -4,7 +4,7 @@ import { isPlainFunction, isReactComponent } from 'payload/utilities';
4
4
  import React, { Fragment } from 'react';
5
5
  import { HiddenInput } from '../../../fields/HiddenInput/index.js';
6
6
  export const mapFields = (args)=>{
7
- const { config, disableAddingID, fieldSchema, filter, i18n, i18n: { t }, parentPath, readOnly: readOnlyOverride } = args;
7
+ const { WithServerSideProps, config, disableAddingID, fieldSchema, filter, i18n, i18n: { t }, parentPath, readOnly: readOnlyOverride } = args;
8
8
  const result = fieldSchema.reduce((acc, field)=>{
9
9
  const fieldIsPresentational = fieldIsPresentationalOnly(field);
10
10
  let CustomFieldComponent = field.admin?.components?.Field;
@@ -19,30 +19,41 @@ export const mapFields = (args)=>{
19
19
  }
20
20
  const isFieldAffectingData = fieldAffectsData(field);
21
21
  const path = `${parentPath ? `${parentPath}.` : ''}${field.path || (isFieldAffectingData && 'name' in field ? field.name : '')}`;
22
- const AfterInput = 'admin' in field && 'components' in field.admin && 'afterInput' in field.admin.components && Array.isArray(field.admin?.components?.afterInput) && /*#__PURE__*/ React.createElement(Fragment, null, field.admin.components.afterInput.map((Component, i)=>/*#__PURE__*/ React.createElement(Component, {
22
+ const AfterInput = 'admin' in field && 'components' in field.admin && 'afterInput' in field.admin.components && Array.isArray(field.admin?.components?.afterInput) && /*#__PURE__*/ React.createElement(Fragment, null, field.admin.components.afterInput.map((Component, i)=>/*#__PURE__*/ React.createElement(WithServerSideProps, {
23
+ Component: Component,
23
24
  key: i
24
25
  }))) || null;
25
- const BeforeInput = 'admin' in field && field.admin?.components && 'beforeInput' in field.admin.components && Array.isArray(field.admin.components.beforeInput) && /*#__PURE__*/ React.createElement(Fragment, null, field.admin.components.beforeInput.map((Component, i)=>/*#__PURE__*/ React.createElement(Component, {
26
+ const BeforeInput = 'admin' in field && field.admin?.components && 'beforeInput' in field.admin.components && Array.isArray(field.admin.components.beforeInput) && /*#__PURE__*/ React.createElement(Fragment, null, field.admin.components.beforeInput.map((Component, i)=>/*#__PURE__*/ React.createElement(WithServerSideProps, {
27
+ Component: Component,
26
28
  key: i
27
29
  }))) || null;
28
30
  const labelProps = {
29
31
  label: 'label' in field && !isPlainFunction(field.label) && !isReactComponent(field.label) ? field.label : undefined,
30
32
  required: 'required' in field ? field.required : undefined
31
33
  };
32
- const CustomLabelComponent = 'admin' in field && field.admin?.components && 'Label' in field.admin.components && field.admin?.components?.Label || undefined;
33
- const CustomLabel = CustomLabelComponent !== undefined ? /*#__PURE__*/ React.createElement(CustomLabelComponent, labelProps || {}) : undefined;
34
+ const CustomLabelComponent = 'admin' in field && field.admin?.components && 'Label' in field.admin.components && field.admin.components?.Label || undefined;
35
+ const CustomLabel = CustomLabelComponent !== undefined ? /*#__PURE__*/ React.createElement(WithServerSideProps, {
36
+ Component: CustomLabelComponent,
37
+ ...labelProps || {}
38
+ }) : undefined;
34
39
  const descriptionProps = {
35
40
  description: field.admin && 'description' in field.admin && ((typeof field.admin?.description === 'string' || typeof field.admin?.description === 'object') && field.admin.description || typeof field.admin?.description === 'function' && isPlainFunction(field.admin?.description) && field.admin?.description({
36
41
  t
37
42
  })) || undefined
38
43
  };
39
44
  const CustomDescriptionComponent = field.admin && 'description' in field.admin && (isReactComponent(field.admin.description) && field.admin.description || field.admin.description && FieldDescription) || undefined;
40
- const CustomDescription = CustomDescriptionComponent !== undefined ? /*#__PURE__*/ React.createElement(CustomDescriptionComponent, descriptionProps || {}) : undefined;
45
+ const CustomDescription = CustomDescriptionComponent !== undefined ? /*#__PURE__*/ React.createElement(WithServerSideProps, {
46
+ Component: CustomDescriptionComponent,
47
+ ...descriptionProps || {}
48
+ }) : undefined;
41
49
  const errorProps = {
42
50
  path
43
51
  };
44
52
  const CustomErrorComponent = 'admin' in field && field.admin?.components && 'Error' in field.admin.components && field.admin?.components?.Error || undefined;
45
- const CustomError = CustomErrorComponent !== undefined ? /*#__PURE__*/ React.createElement(CustomErrorComponent, errorProps || {}) : undefined;
53
+ const CustomError = CustomErrorComponent !== undefined ? /*#__PURE__*/ React.createElement(WithServerSideProps, {
54
+ Component: CustomErrorComponent,
55
+ ...errorProps || {}
56
+ }) : undefined;
46
57
  const baseFieldProps = {
47
58
  AfterInput,
48
59
  BeforeInput,
@@ -86,7 +97,9 @@ export const mapFields = (args)=>{
86
97
  let CustomRowLabel;
87
98
  if ('admin' in field && field.admin.components && 'RowLabel' in field.admin.components && field.admin.components.RowLabel && isReactComponent(field.admin.components.RowLabel)) {
88
99
  const CustomRowLabelComponent = field.admin.components.RowLabel;
89
- CustomRowLabel = /*#__PURE__*/ React.createElement(CustomRowLabelComponent, null);
100
+ CustomRowLabel = /*#__PURE__*/ React.createElement(WithServerSideProps, {
101
+ Component: CustomRowLabelComponent
102
+ });
90
103
  }
91
104
  const arrayFieldProps = {
92
105
  ...baseFieldProps,
@@ -95,6 +108,7 @@ export const mapFields = (args)=>{
95
108
  className: field.admin?.className,
96
109
  disabled: field.admin?.disabled,
97
110
  fieldMap: mapFields({
111
+ WithServerSideProps,
98
112
  config,
99
113
  fieldSchema: field.fields,
100
114
  filter,
@@ -118,6 +132,7 @@ export const mapFields = (args)=>{
118
132
  {
119
133
  const blocks = field.blocks.map((block)=>{
120
134
  const blockFieldMap = mapFields({
135
+ WithServerSideProps,
121
136
  config,
122
137
  fieldSchema: block.fields,
123
138
  filter,
@@ -195,7 +210,9 @@ export const mapFields = (args)=>{
195
210
  let CustomCollapsibleLabel;
196
211
  if (isReactComponent(field.label) || isPlainFunction(field.label)) {
197
212
  const CustomCollapsibleLabelComponent = field.label;
198
- CustomCollapsibleLabel = /*#__PURE__*/ React.createElement(CustomCollapsibleLabelComponent, null);
213
+ CustomCollapsibleLabel = /*#__PURE__*/ React.createElement(WithServerSideProps, {
214
+ Component: CustomCollapsibleLabelComponent
215
+ });
199
216
  }
200
217
  const collapsibleField = {
201
218
  ...baseFieldProps,
@@ -203,6 +220,7 @@ export const mapFields = (args)=>{
203
220
  className: field.admin?.className,
204
221
  disabled: field.admin?.disabled,
205
222
  fieldMap: mapFields({
223
+ WithServerSideProps,
206
224
  config,
207
225
  disableAddingID: true,
208
226
  fieldSchema: field.fields,
@@ -266,6 +284,7 @@ export const mapFields = (args)=>{
266
284
  className: field.admin?.className,
267
285
  disabled: field.admin?.disabled,
268
286
  fieldMap: mapFields({
287
+ WithServerSideProps,
269
288
  config,
270
289
  disableAddingID: true,
271
290
  fieldSchema: field.fields,
@@ -392,6 +411,7 @@ export const mapFields = (args)=>{
392
411
  const RichTextCellComponent = field.editor.CellComponent;
393
412
  if (typeof field.editor.generateComponentMap === 'function') {
394
413
  const result = field.editor.generateComponentMap({
414
+ WithServerSideProps,
395
415
  config,
396
416
  i18n,
397
417
  schemaPath: path
@@ -403,7 +423,9 @@ export const mapFields = (args)=>{
403
423
  CustomFieldComponent = RichTextFieldComponent;
404
424
  }
405
425
  if (RichTextCellComponent) {
406
- cellComponentProps.CellComponentOverride = /*#__PURE__*/ React.createElement(RichTextCellComponent, null);
426
+ cellComponentProps.CellComponentOverride = /*#__PURE__*/ React.createElement(WithServerSideProps, {
427
+ Component: RichTextCellComponent
428
+ });
407
429
  }
408
430
  fieldComponentProps = richTextField;
409
431
  break;
@@ -415,6 +437,7 @@ export const mapFields = (args)=>{
415
437
  className: field.admin?.className,
416
438
  disabled: field.admin?.disabled,
417
439
  fieldMap: mapFields({
440
+ WithServerSideProps,
418
441
  config,
419
442
  disableAddingID: true,
420
443
  fieldSchema: field.fields,
@@ -436,6 +459,7 @@ export const mapFields = (args)=>{
436
459
  // `tabs` fields require a field map of each of its tab's nested fields
437
460
  const tabs = field.tabs.map((tab)=>{
438
461
  const tabFieldMap = mapFields({
462
+ WithServerSideProps,
439
463
  config,
440
464
  disableAddingID: true,
441
465
  fieldSchema: tab.fields,
@@ -557,8 +581,14 @@ export const mapFields = (args)=>{
557
581
  const reducedField = {
558
582
  name: 'name' in field ? field.name : undefined,
559
583
  type: field.type,
560
- CustomCell: CustomCellComponent ? /*#__PURE__*/ React.createElement(CustomCellComponent, cellComponentProps) : undefined,
561
- CustomField: CustomFieldComponent ? /*#__PURE__*/ React.createElement(CustomFieldComponent, fieldComponentProps) : undefined,
584
+ CustomCell: CustomCellComponent ? /*#__PURE__*/ React.createElement(WithServerSideProps, {
585
+ Component: CustomCellComponent,
586
+ ...cellComponentProps
587
+ }) : undefined,
588
+ CustomField: CustomFieldComponent ? /*#__PURE__*/ React.createElement(WithServerSideProps, {
589
+ Component: CustomFieldComponent,
590
+ ...fieldComponentProps
591
+ }) : undefined,
562
592
  cellComponentProps,
563
593
  disableBulkEdit: 'admin' in field && 'disableBulkEdit' in field.admin && field.admin.disableBulkEdit,
564
594
  fieldComponentProps,