@payloadcms/ui 3.0.0-beta.80 → 3.0.0-beta.81
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/elements/Autosave/index.js +1 -1
- package/dist/elements/Autosave/index.js.map +1 -1
- package/dist/exports/client/index.js +2 -2
- package/dist/exports/client/index.js.map +2 -2
- package/dist/exports/shared/index.d.ts +0 -1
- package/dist/exports/shared/index.d.ts.map +1 -1
- package/dist/exports/shared/index.js +2 -2
- package/dist/exports/shared/index.js.map +4 -4
- package/dist/providers/Config/RenderComponent.d.ts.map +1 -1
- package/dist/providers/Config/RenderComponent.js +3 -0
- package/dist/providers/Config/RenderComponent.js.map +1 -1
- package/dist/providers/Config/createClientConfig/collections.d.ts.map +1 -1
- package/dist/providers/Config/createClientConfig/collections.js +2 -2
- package/dist/providers/Config/createClientConfig/collections.js.map +1 -1
- package/dist/providers/Config/createClientConfig/getComponent.d.ts +1 -1
- package/dist/providers/Config/createClientConfig/getComponent.d.ts.map +1 -1
- package/dist/providers/Config/createClientConfig/getComponent.js +3 -2
- package/dist/providers/Config/createClientConfig/getComponent.js.map +1 -1
- package/dist/providers/Config/createClientConfig/getCreateMappedComponent.d.ts.map +1 -1
- package/dist/providers/Config/createClientConfig/getCreateMappedComponent.js +7 -2
- package/dist/providers/Config/createClientConfig/getCreateMappedComponent.js.map +1 -1
- package/dist/providers/Config/createClientConfig/globals.d.ts.map +1 -1
- package/dist/providers/Config/createClientConfig/globals.js +1 -1
- package/dist/providers/Config/createClientConfig/globals.js.map +1 -1
- package/package.json +4 -4
|
@@ -14,5 +14,4 @@ export { getFormState } from '../../utilities/getFormState.js';
|
|
|
14
14
|
export { type EntityToGroup, EntityType, type Group, groupNavItems, } from '../../utilities/groupNavItems.js';
|
|
15
15
|
export { hasSavePermission } from '../../utilities/hasSavePermission.js';
|
|
16
16
|
export { isEditing } from '../../utilities/isEditing.js';
|
|
17
|
-
export declare const emptyComponent: () => any;
|
|
18
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exports/shared/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAA;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAA;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,2DAA2D,CAAA;AAExF,OAAO,EAAE,wBAAwB,EAAE,MAAM,uEAAuE,CAAA;AAChH,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EACL,KAAK,aAAa,EAClB,UAAU,EACV,KAAK,KAAK,EACV,aAAa,GACd,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exports/shared/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAA;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAA;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,2DAA2D,CAAA;AAExF,OAAO,EAAE,wBAAwB,EAAE,MAAM,uEAAuE,CAAA;AAChH,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EACL,KAAK,aAAa,EAClB,UAAU,EACV,KAAK,KAAK,EACV,aAAa,GACd,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{isReactServerComponentOrFunction as x}from"payload/shared";import h from"react";var b=({Component:o,serverOnlyProps:t,...e})=>o?h.createElement(r=>{let s={...r,...x(o)?t??{}:{}};return h.createElement(o,{...s})},{...e}):null;import{isReactServerComponentOrFunction as R,serverProps as L}from"payload/shared";import F from"react";function I({Component:o,sanitizeServerOnlyProps:t,toMergeIntoProps:e}){return t===void 0&&(t=!R(o)),r=>{let s=T(r,e);return t&&L.forEach(n=>{delete s[n]}),F.createElement(o,{...s})}}function T(o,t){return{...o,...t}}import
|
|
1
|
+
import{isReactServerComponentOrFunction as x}from"payload/shared";import h from"react";var b=({Component:o,serverOnlyProps:t,...e})=>o?h.createElement(r=>{let s={...r,...x(o)?t??{}:{}};return h.createElement(o,{...s})},{...e}):null;import{isReactServerComponentOrFunction as R,serverProps as L}from"payload/shared";import F from"react";function I({Component:o,sanitizeServerOnlyProps:t,toMergeIntoProps:e}){return t===void 0&&(t=!R(o)),r=>{let s=T(r,e);return t&&L.forEach(n=>{delete s[n]}),F.createElement(o,{...s})}}function T(o,t){return{...o,...t}}import C from"react";var w=({fill:o})=>{let t=o||"var(--theme-elevation-1000)";return C.createElement("svg",{className:"graphic-icon",height:"100%",viewBox:"0 0 25 25",width:"100%",xmlns:"http://www.w3.org/2000/svg"},C.createElement("path",{d:"M11.5293 0L23 6.90096V19.9978L14.3608 25V11.9032L2.88452 5.00777L11.5293 0Z",fill:t}),C.createElement("path",{d:"M10.6559 24.2727V14.0518L2 19.0651L10.6559 24.2727Z",fill:t}))};import d from"react";var D=`
|
|
2
2
|
.graphic-logo path {
|
|
3
3
|
fill: var(--theme-elevation-1000);
|
|
4
4
|
}
|
|
5
|
-
`,H=()=>d.createElement("svg",{className:"graphic-logo",fill:"none",height:"50",viewBox:"0 0 180 50",width:"180",xmlns:"http://www.w3.org/2000/svg"},d.createElement("style",null,D),d.createElement("path",{d:"M65.922 13.8685C71.1075 13.8685 77.0257 14.6014 77.0257 22.2185C77.0257 28.6587 71.8736 30.2243 66.0664 30.2243H62.2689V39.0961H57.2944V13.8685H65.922ZM62.2689 17.7659V26.3602H66.3773C69.4752 26.3602 71.9069 25.594 71.9069 22.2518C71.9069 18.1101 68.7424 17.7659 66.022 17.7659H62.2689Z"}),d.createElement("path",{d:"M84.3209 39.5514C80.7344 39.5514 77.5698 37.4639 77.5698 34.0884C77.5698 29.6358 82.5443 28.3145 89.8949 27.4706V27.1264C89.8949 24.2394 88.3626 23.2623 86.3084 23.2623C84.2542 23.2623 82.7219 24.2394 82.622 26.2936H78.1361C78.4803 22.6072 81.7226 19.8867 86.4861 19.8867C91.1163 19.8867 94.7028 21.7633 94.7028 28.1035C94.7028 28.692 94.6362 31.2014 94.6362 32.9114C94.6362 35.865 94.8472 37.5416 95.1914 39.1073H90.7721C90.6278 38.5188 90.4945 37.6083 90.4279 36.7089C89.0844 38.6853 87.1412 39.5514 84.3209 39.5514ZM90.0282 30.5463C84.6651 31.1015 82.511 31.7344 82.511 33.8219C82.511 35.1766 83.588 36.298 85.7532 36.298C88.7512 36.298 90.0393 34.5547 90.0393 31.4901V30.5463H90.0282Z"}),d.createElement("path",{d:"M97.2899 45.1921V41.5057H99.0998C100.699 41.5057 101.432 41.539 102.231 39.5514L102.442 39.0295L95.269 20.3753H100.521L104.763 33.8774L109.115 20.3753H113.99L107.139 38.541C104.951 44.3593 103.974 45.1921 99.3108 45.1921H97.2899Z"}),d.createElement("path",{d:"M120.263 39.1073H115.456V13.8685H120.263V39.1073Z"}),d.createElement("path",{d:"M122.406 29.7801C122.406 23.2067 126.826 19.9645 131.7 19.9645C136.575 19.9645 140.994 23.2067 140.994 29.7801C140.994 36.3535 136.575 39.5625 131.7 39.5625C126.826 39.5514 122.406 36.3535 122.406 29.7801ZM127.281 29.7801C127.281 33.6775 128.913 35.7984 131.7 35.7984C134.487 35.7984 136.119 33.6775 136.119 29.7801C136.119 25.8494 134.487 23.7286 131.7 23.7286C128.913 23.7286 127.281 25.8383 127.281 29.7801Z"}),d.createElement("path",{d:"M149.167 39.5514C145.58 39.5514 142.416 37.4639 142.416 34.0884C142.416 29.6358 147.39 28.3145 154.741 27.4706V27.1264C154.741 24.2394 153.208 23.2623 151.154 23.2623C149.1 23.2623 147.568 24.2394 147.468 26.2936H142.982C143.326 22.6072 146.568 19.8867 151.332 19.8867C155.962 19.8867 159.549 21.7633 159.549 28.1035C159.549 28.692 159.482 31.2014 159.482 32.9114C159.482 35.865 159.693 37.5416 160.037 39.1073H155.618C155.473 38.5188 155.34 37.6083 155.274 36.7089C153.941 38.6853 151.987 39.5514 149.167 39.5514ZM154.874 30.5463C149.511 31.1015 147.357 31.7344 147.357 33.8219C147.357 35.1766 148.434 36.298 150.599 36.298C153.597 36.298 154.885 34.5547 154.885 31.4901V30.5463H154.874Z"}),d.createElement("path",{d:"M175.06 39.1073V36.7422C173.872 38.7964 171.618 39.5625 169.664 39.5625C165.067 39.5625 161.625 35.7317 161.625 29.7468C161.625 23.8619 165 19.9645 169.664 19.9645C172.029 19.9645 174.05 21.0415 175.06 22.7848V13.8796H179.868V39.1073H175.06ZM175.238 29.7357C175.238 25.9716 173.494 23.6398 170.852 23.6398C168.242 23.6398 166.677 26.1159 166.677 29.7691C166.677 33.4222 168.242 35.865 170.852 35.865C173.494 35.865 175.238 33.5665 175.238 29.7357Z"}),d.createElement("path",{d:"M19.1531 0L42.049 13.8019V39.9956L24.8049 50V23.8064L1.89795 10.0155L19.1531 0Z"}),d.createElement("path",{d:"M17.4097 48.5454V28.1035L0.132324 38.1301L17.4097 48.5454Z"}));import{isReactServerComponentOrFunction as A}from"payload/shared";import f from"react";var
|
|
5
|
+
`,H=()=>d.createElement("svg",{className:"graphic-logo",fill:"none",height:"50",viewBox:"0 0 180 50",width:"180",xmlns:"http://www.w3.org/2000/svg"},d.createElement("style",null,D),d.createElement("path",{d:"M65.922 13.8685C71.1075 13.8685 77.0257 14.6014 77.0257 22.2185C77.0257 28.6587 71.8736 30.2243 66.0664 30.2243H62.2689V39.0961H57.2944V13.8685H65.922ZM62.2689 17.7659V26.3602H66.3773C69.4752 26.3602 71.9069 25.594 71.9069 22.2518C71.9069 18.1101 68.7424 17.7659 66.022 17.7659H62.2689Z"}),d.createElement("path",{d:"M84.3209 39.5514C80.7344 39.5514 77.5698 37.4639 77.5698 34.0884C77.5698 29.6358 82.5443 28.3145 89.8949 27.4706V27.1264C89.8949 24.2394 88.3626 23.2623 86.3084 23.2623C84.2542 23.2623 82.7219 24.2394 82.622 26.2936H78.1361C78.4803 22.6072 81.7226 19.8867 86.4861 19.8867C91.1163 19.8867 94.7028 21.7633 94.7028 28.1035C94.7028 28.692 94.6362 31.2014 94.6362 32.9114C94.6362 35.865 94.8472 37.5416 95.1914 39.1073H90.7721C90.6278 38.5188 90.4945 37.6083 90.4279 36.7089C89.0844 38.6853 87.1412 39.5514 84.3209 39.5514ZM90.0282 30.5463C84.6651 31.1015 82.511 31.7344 82.511 33.8219C82.511 35.1766 83.588 36.298 85.7532 36.298C88.7512 36.298 90.0393 34.5547 90.0393 31.4901V30.5463H90.0282Z"}),d.createElement("path",{d:"M97.2899 45.1921V41.5057H99.0998C100.699 41.5057 101.432 41.539 102.231 39.5514L102.442 39.0295L95.269 20.3753H100.521L104.763 33.8774L109.115 20.3753H113.99L107.139 38.541C104.951 44.3593 103.974 45.1921 99.3108 45.1921H97.2899Z"}),d.createElement("path",{d:"M120.263 39.1073H115.456V13.8685H120.263V39.1073Z"}),d.createElement("path",{d:"M122.406 29.7801C122.406 23.2067 126.826 19.9645 131.7 19.9645C136.575 19.9645 140.994 23.2067 140.994 29.7801C140.994 36.3535 136.575 39.5625 131.7 39.5625C126.826 39.5514 122.406 36.3535 122.406 29.7801ZM127.281 29.7801C127.281 33.6775 128.913 35.7984 131.7 35.7984C134.487 35.7984 136.119 33.6775 136.119 29.7801C136.119 25.8494 134.487 23.7286 131.7 23.7286C128.913 23.7286 127.281 25.8383 127.281 29.7801Z"}),d.createElement("path",{d:"M149.167 39.5514C145.58 39.5514 142.416 37.4639 142.416 34.0884C142.416 29.6358 147.39 28.3145 154.741 27.4706V27.1264C154.741 24.2394 153.208 23.2623 151.154 23.2623C149.1 23.2623 147.568 24.2394 147.468 26.2936H142.982C143.326 22.6072 146.568 19.8867 151.332 19.8867C155.962 19.8867 159.549 21.7633 159.549 28.1035C159.549 28.692 159.482 31.2014 159.482 32.9114C159.482 35.865 159.693 37.5416 160.037 39.1073H155.618C155.473 38.5188 155.34 37.6083 155.274 36.7089C153.941 38.6853 151.987 39.5514 149.167 39.5514ZM154.874 30.5463C149.511 31.1015 147.357 31.7344 147.357 33.8219C147.357 35.1766 148.434 36.298 150.599 36.298C153.597 36.298 154.885 34.5547 154.885 31.4901V30.5463H154.874Z"}),d.createElement("path",{d:"M175.06 39.1073V36.7422C173.872 38.7964 171.618 39.5625 169.664 39.5625C165.067 39.5625 161.625 35.7317 161.625 29.7468C161.625 23.8619 165 19.9645 169.664 19.9645C172.029 19.9645 174.05 21.0415 175.06 22.7848V13.8796H179.868V39.1073H175.06ZM175.238 29.7357C175.238 25.9716 173.494 23.6398 170.852 23.6398C168.242 23.6398 166.677 26.1159 166.677 29.7691C166.677 33.4222 168.242 35.865 170.852 35.865C173.494 35.865 175.238 33.5665 175.238 29.7357Z"}),d.createElement("path",{d:"M19.1531 0L42.049 13.8019V39.9956L24.8049 50V23.8064L1.89795 10.0155L19.1531 0Z"}),d.createElement("path",{d:"M17.4097 48.5454V28.1035L0.132324 38.1301L17.4097 48.5454Z"}));import{isReactServerComponentOrFunction as A}from"payload/shared";import f from"react";var u=({Component:o,clientProps:t={},mappedComponent:e,serverProps:i})=>{if(!e&&o){if(Array.isArray(o))return o.map((s,n)=>f.createElement(u,{Component:s,clientProps:t,key:n,serverProps:i}));let r=A(o)?{type:"server",Component:o,RenderedComponent:null}:{type:"client",Component:o};return f.createElement(u,{clientProps:t,mappedComponent:r,serverProps:i})}return e?Array.isArray(e)?e.map((r,s)=>f.createElement(u,{clientProps:t,key:s,mappedComponent:r,serverProps:i})):e.type==="empty"?null:e.RenderedComponent?e.RenderedComponent:e.Component?e.type==="server"?e.props?f.createElement(e.Component,{...e.props,...i,...t}):f.createElement(e.Component,{...i,...t}):e.props?f.createElement(e.Component,{...e.props,...t}):f.createElement(e.Component,{...t}):null:null};import{parsePayloadComponent as G}from"payload/shared";var c=({identifier:o,importMap:t,payloadComponent:e,silent:i})=>{if(!e)return{Component:void 0,clientProps:void 0,serverProps:void 0};let{exportName:r,path:s}=G(e),n=s+"#"+r,a=t[n];return!a&&!i&&console.error("getComponent: Component not found in importMap",{identifier:o,key:n,payloadComponent:e},"You may need to run the `payload generate:importmap` command to generate the importMap ahead of runtime."),{Component:a,clientProps:typeof e=="object"?e.clientProps:void 0,serverProps:typeof e=="object"?e.serverProps:void 0}};import{isReactServerComponentOrFunction as P}from"payload/shared";import S from"react";function V({importMap:o,serverProps:t}){let e=(r,s,n,a,p)=>{if(r==null){if(!a)return;if(P(a))return{type:"server",Component:null,RenderedComponent:S.createElement(a,{key:s,...t,...n})};{let m={type:"client",Component:a};return n&&(m.props=n),m}}if(r===!1)return{type:"empty"};let l=r&&typeof r=="object"&&"ReactComponent"in r?{Component:r.ReactComponent}:c({identifier:p,importMap:o,payloadComponent:r});if(l.Component||console.error("getCreateMappedComponent: Component not found in importMap",{identifier:p,key:s}),P(l.Component)){let m=l.Component;return{type:"server",Component:null,RenderedComponent:S.createElement(m,{key:s,...t,...l.serverProps,...n})}}else return l.Component?{type:"client",Component:l.Component,props:{...l.clientProps||{},...n}}:void 0};return(r,s,n,a)=>{if(!(r==null&&!n))if(r&&Array.isArray(r)){let p=[];for(let l=0;l<r.length;l++){let m=e(r[l],l,s,n,a);p.push(m)}return p}else return e(r,void 0,s,n,a)}}import*as v from"qs-esm";var $={delete:(o,t={headers:{}})=>{let e=t&&t.headers?{...t.headers}:{},i={...t,credentials:"include",headers:{...e},method:"delete"};return fetch(o,i)},get:(o,t={headers:{}})=>{let e="";return t.params&&(e=v.stringify(t.params,{addQueryPrefix:!0})),fetch(`${o}${e}`,{credentials:"include",...t})},patch:(o,t={headers:{}})=>{let e=t&&t.headers?{...t.headers}:{},i={...t,credentials:"include",headers:{...e},method:"PATCH"};return fetch(o,i)},post:(o,t={headers:{}})=>{let e=t&&t.headers?{...t.headers}:{},i={...t,credentials:"include",headers:{...e},method:"post"};return fetch(`${o}`,i)},put:(o,t={headers:{}})=>{let e=t&&t.headers?{...t.headers}:{},i={...t,credentials:"include",headers:{...e},method:"put"};return fetch(o,i)}};var Z=(o,t)=>!o?.locales||o.locales.length===0?null:o.locales.find(e=>e?.code===t);var q=o=>{let{adminRoute:t,basePath:e="",path:i,serverURL:r}=o;if(t)if(t==="/"){if(!i)return`${r||""}${e}${t}`}else return`${r||""}${e}${t}${i}`;return`${r||""}${e}${i}`};import{format as O,formatDistanceToNow as ce}from"date-fns";var g=({date:o,i18n:t,pattern:e})=>{let i=new Date(o);return O(i,e,{locale:t.dateFNS})};import{getTranslation as j}from"@payloadcms/translations";var E=({collectionConfig:o,data:t,dateFormat:e,fallback:i,globalConfig:r,i18n:s})=>{let n;if(o){let a=o?.admin?.useAsTitle;if(a&&(n=t?.[a]||n,n)){let p=o.fields.find(m=>"name"in m&&m.name===a);if(p?.type==="date"){let m="date"in p.admin&&p?.admin?.date?.displayFormat||e;n=g({date:n,i18n:s,pattern:m})||n}}}return r&&(n=j(r?.label,s)||r?.slug),n||(n=i||`[${s.t("general:untitled")}]`),n};var N=async o=>{let{apiRoute:t,body:e,onError:i,serverURL:r,signal:s,token:n}=o,a=await fetch(`${r}${t}/form-state`,{body:JSON.stringify(e),credentials:"include",headers:{"Content-Type":"application/json",...n?{Authorization:`JWT ${n}`}:{}},method:"POST",signal:s}),p=await a.json();return a.ok?p:(typeof i=="function"&&i(p),e?.formState)};import{getTranslation as y}from"@payloadcms/translations";var M=(e=>(e.collection="collections",e.global="globals",e))(M||{});function z(o,t,e){return o.reduce((r,s)=>{if(t?.[s.type.toLowerCase()]?.[s.entity.slug]?.read.permission){let n=y(s.entity.admin.group,e);if(s.entity.admin.group){let a=r.find(l=>y(l.label,e)===n),p=a;a||(p={entities:[],label:n},r.push(p)),p.entities.push(s)}else r.find(p=>y(p.label,e)===e.t(`general:${s.type}`)).entities.push(s)}return r},[{entities:[],label:e.t("general:collections")},{entities:[],label:e.t("general:globals")}]).filter(r=>r.entities.length>0)}var W=o=>{let{collectionSlug:t,docPermissions:e,globalSlug:i,isEditing:r}=o;return t?!!(r&&e?.update?.permission||!r&&e?.create?.permission):i?!!e?.update?.permission:!1};var U=({id:o,collectionSlug:t,globalSlug:e})=>!!(e||t&&o);export{M as EntityType,w as PayloadIcon,H as PayloadLogo,u as RenderComponent,b as WithServerSideProps,Z as findLocaleFromCode,q as formatAdminURL,g as formatDate,E as formatDocTitle,c as getComponent,V as getCreateMappedComponent,N as getFormState,z as groupNavItems,W as hasSavePermission,U as isEditing,$ as requests,I as withMergedProps};
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/elements/WithServerSideProps/index.tsx", "../../../src/elements/withMergedProps/index.tsx", "../../../src/graphics/Icon/index.tsx", "../../../src/graphics/Logo/index.tsx", "../../../src/providers/Config/RenderComponent.tsx", "../../../src/providers/Config/createClientConfig/getComponent.ts", "../../../src/providers/Config/createClientConfig/getCreateMappedComponent.tsx", "../../../src/utilities/api.ts", "../../../src/utilities/findLocaleFromCode.ts", "../../../src/utilities/formatAdminURL.ts", "../../../src/utilities/formatDate.ts", "../../../src/utilities/formatDocTitle.ts", "../../../src/utilities/getFormState.ts", "../../../src/utilities/groupNavItems.ts", "../../../src/utilities/hasSavePermission.ts", "../../../src/utilities/isEditing.ts"
|
|
4
|
-
"sourcesContent": ["import type { WithServerSidePropsComponent } from 'payload'\n\nimport { isReactServerComponentOrFunction } from 'payload/shared'\nimport React from 'react'\n\nexport const WithServerSideProps: WithServerSidePropsComponent = ({\n Component,\n serverOnlyProps,\n ...rest\n}) => {\n if (Component) {\n const WithServerSideProps: React.FC = (passedProps) => {\n const propsWithServerOnlyProps = {\n ...passedProps,\n ...(isReactServerComponentOrFunction(Component) ? serverOnlyProps ?? {} : {}),\n }\n\n return <Component {...propsWithServerOnlyProps} />\n }\n\n return <WithServerSideProps {...rest} />\n }\n\n return null\n}\n", "import { isReactServerComponentOrFunction, serverProps } from 'payload/shared'\nimport React from 'react'\n\n/**\n * Creates a higher-order component (HOC) that merges predefined properties (`toMergeIntoProps`)\n * with any properties passed to the resulting component.\n *\n * Use this when you want to pre-specify some props for a component, while also allowing users to\n * pass in their own props. The HOC ensures the passed props and predefined props are combined before\n * rendering the original component.\n *\n * @example\n * const PredefinedComponent = getMergedPropsComponent({\n * Component: OriginalComponent,\n * toMergeIntoProps: { someExtraValue: 5 }\n * });\n * // Using <PredefinedComponent customProp=\"value\" /> will result in\n * // <OriginalComponent customProp=\"value\" someExtraValue={5} />\n *\n * @returns A higher-order component with combined properties.\n *\n * @param Component - The original component to wrap.\n * @param sanitizeServerOnlyProps - If true, server-only props will be removed from the merged props. @default true if the component is not a server component, false otherwise.\n * @param toMergeIntoProps - The properties to merge into the passed props.\n */\nexport function withMergedProps<ToMergeIntoProps, CompleteReturnProps>({\n Component,\n sanitizeServerOnlyProps,\n toMergeIntoProps,\n}: {\n Component: React.FC<CompleteReturnProps>\n sanitizeServerOnlyProps?: boolean\n toMergeIntoProps: ToMergeIntoProps\n}): React.FC<CompleteReturnProps> {\n if (sanitizeServerOnlyProps === undefined) {\n sanitizeServerOnlyProps = !isReactServerComponentOrFunction(Component)\n }\n // A wrapper around the args.Component to inject the args.toMergeArgs as props, which are merged with the passed props\n const MergedPropsComponent: React.FC<CompleteReturnProps> = (passedProps) => {\n const mergedProps = simpleMergeProps(passedProps, toMergeIntoProps) as CompleteReturnProps\n\n if (sanitizeServerOnlyProps) {\n serverProps.forEach((prop) => {\n delete mergedProps[prop]\n })\n }\n\n return <Component {...mergedProps} />\n }\n\n return MergedPropsComponent\n}\n\nfunction simpleMergeProps(props, toMerge) {\n return { ...props, ...toMerge }\n}\n", "import React from 'react'\n\nexport const PayloadIcon: React.FC<{\n fill?: string\n}> = ({ fill: fillFromProps }) => {\n const fill = fillFromProps || 'var(--theme-elevation-1000)'\n\n return (\n <svg\n className=\"graphic-icon\"\n height=\"100%\"\n viewBox=\"0 0 25 25\"\n width=\"100%\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M11.5293 0L23 6.90096V19.9978L14.3608 25V11.9032L2.88452 5.00777L11.5293 0Z\"\n fill={fill}\n />\n <path d=\"M10.6559 24.2727V14.0518L2 19.0651L10.6559 24.2727Z\" fill={fill} />\n </svg>\n )\n}\n", "import React from 'react'\n\nconst css = `\n .graphic-logo path {\n fill: var(--theme-elevation-1000);\n }\n`\n\nexport const PayloadLogo: React.FC = () => (\n <svg\n className=\"graphic-logo\"\n fill=\"none\"\n height=\"50\"\n viewBox=\"0 0 180 50\"\n width=\"180\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <style>{css}</style>\n <path d=\"M65.922 13.8685C71.1075 13.8685 77.0257 14.6014 77.0257 22.2185C77.0257 28.6587 71.8736 30.2243 66.0664 30.2243H62.2689V39.0961H57.2944V13.8685H65.922ZM62.2689 17.7659V26.3602H66.3773C69.4752 26.3602 71.9069 25.594 71.9069 22.2518C71.9069 18.1101 68.7424 17.7659 66.022 17.7659H62.2689Z\" />\n <path d=\"M84.3209 39.5514C80.7344 39.5514 77.5698 37.4639 77.5698 34.0884C77.5698 29.6358 82.5443 28.3145 89.8949 27.4706V27.1264C89.8949 24.2394 88.3626 23.2623 86.3084 23.2623C84.2542 23.2623 82.7219 24.2394 82.622 26.2936H78.1361C78.4803 22.6072 81.7226 19.8867 86.4861 19.8867C91.1163 19.8867 94.7028 21.7633 94.7028 28.1035C94.7028 28.692 94.6362 31.2014 94.6362 32.9114C94.6362 35.865 94.8472 37.5416 95.1914 39.1073H90.7721C90.6278 38.5188 90.4945 37.6083 90.4279 36.7089C89.0844 38.6853 87.1412 39.5514 84.3209 39.5514ZM90.0282 30.5463C84.6651 31.1015 82.511 31.7344 82.511 33.8219C82.511 35.1766 83.588 36.298 85.7532 36.298C88.7512 36.298 90.0393 34.5547 90.0393 31.4901V30.5463H90.0282Z\" />\n <path d=\"M97.2899 45.1921V41.5057H99.0998C100.699 41.5057 101.432 41.539 102.231 39.5514L102.442 39.0295L95.269 20.3753H100.521L104.763 33.8774L109.115 20.3753H113.99L107.139 38.541C104.951 44.3593 103.974 45.1921 99.3108 45.1921H97.2899Z\" />\n <path d=\"M120.263 39.1073H115.456V13.8685H120.263V39.1073Z\" />\n <path d=\"M122.406 29.7801C122.406 23.2067 126.826 19.9645 131.7 19.9645C136.575 19.9645 140.994 23.2067 140.994 29.7801C140.994 36.3535 136.575 39.5625 131.7 39.5625C126.826 39.5514 122.406 36.3535 122.406 29.7801ZM127.281 29.7801C127.281 33.6775 128.913 35.7984 131.7 35.7984C134.487 35.7984 136.119 33.6775 136.119 29.7801C136.119 25.8494 134.487 23.7286 131.7 23.7286C128.913 23.7286 127.281 25.8383 127.281 29.7801Z\" />\n <path d=\"M149.167 39.5514C145.58 39.5514 142.416 37.4639 142.416 34.0884C142.416 29.6358 147.39 28.3145 154.741 27.4706V27.1264C154.741 24.2394 153.208 23.2623 151.154 23.2623C149.1 23.2623 147.568 24.2394 147.468 26.2936H142.982C143.326 22.6072 146.568 19.8867 151.332 19.8867C155.962 19.8867 159.549 21.7633 159.549 28.1035C159.549 28.692 159.482 31.2014 159.482 32.9114C159.482 35.865 159.693 37.5416 160.037 39.1073H155.618C155.473 38.5188 155.34 37.6083 155.274 36.7089C153.941 38.6853 151.987 39.5514 149.167 39.5514ZM154.874 30.5463C149.511 31.1015 147.357 31.7344 147.357 33.8219C147.357 35.1766 148.434 36.298 150.599 36.298C153.597 36.298 154.885 34.5547 154.885 31.4901V30.5463H154.874Z\" />\n <path d=\"M175.06 39.1073V36.7422C173.872 38.7964 171.618 39.5625 169.664 39.5625C165.067 39.5625 161.625 35.7317 161.625 29.7468C161.625 23.8619 165 19.9645 169.664 19.9645C172.029 19.9645 174.05 21.0415 175.06 22.7848V13.8796H179.868V39.1073H175.06ZM175.238 29.7357C175.238 25.9716 173.494 23.6398 170.852 23.6398C168.242 23.6398 166.677 26.1159 166.677 29.7691C166.677 33.4222 168.242 35.865 170.852 35.865C173.494 35.865 175.238 33.5665 175.238 29.7357Z\" />\n <path d=\"M19.1531 0L42.049 13.8019V39.9956L24.8049 50V23.8064L1.89795 10.0155L19.1531 0Z\" />\n <path d=\"M17.4097 48.5454V28.1035L0.132324 38.1301L17.4097 48.5454Z\" />\n </svg>\n)\n", "import type { MappedComponent } from 'payload'\n\nimport { isReactServerComponentOrFunction } from 'payload/shared'\nimport React from 'react'\n\n/**\n * Can be used to render both MappedComponents and React Components.\n */\nexport const RenderComponent: React.FC<{\n readonly Component?: React.ComponentType | React.ComponentType[]\n readonly clientProps?: object\n readonly mappedComponent?: MappedComponent | MappedComponent[]\n readonly serverProps?: object\n}> = ({ Component, clientProps = {}, mappedComponent, serverProps }) => {\n if (!mappedComponent && Component) {\n if (Array.isArray(Component)) {\n return Component.map((c, index) => (\n <RenderComponent\n Component={c}\n clientProps={clientProps}\n key={index}\n serverProps={serverProps}\n />\n ))\n }\n\n const mappedComponent: MappedComponent = isReactServerComponentOrFunction(Component)\n ? {\n type: 'server',\n Component,\n RenderedComponent: null,\n }\n : {\n type: 'client',\n Component,\n }\n\n return (\n <RenderComponent\n clientProps={clientProps}\n mappedComponent={mappedComponent}\n serverProps={serverProps}\n />\n )\n }\n if (!mappedComponent) {\n return null\n }\n\n if (Array.isArray(mappedComponent)) {\n return mappedComponent.map((c, index) => (\n <RenderComponent\n clientProps={clientProps}\n key={index}\n mappedComponent={c}\n serverProps={serverProps}\n />\n ))\n }\n\n if (mappedComponent.RenderedComponent) {\n return mappedComponent.RenderedComponent\n }\n\n if (!mappedComponent.Component) {\n return null\n }\n\n if (mappedComponent.type === 'server') {\n if (mappedComponent.props) {\n return (\n <mappedComponent.Component {...mappedComponent.props} {...serverProps} {...clientProps} />\n )\n }\n\n return <mappedComponent.Component {...serverProps} {...clientProps} />\n }\n\n if (mappedComponent.props) {\n return <mappedComponent.Component {...mappedComponent.props} {...clientProps} />\n }\n\n return <mappedComponent.Component {...clientProps} />\n}\n", "import type { ImportMap, PayloadComponent, ResolvedComponent } from 'payload'\n\nimport { parsePayloadComponent } from 'payload/shared'\n\n/**\n * Gets th resolved React component from `PayloadComponent` from the importMap\n */\nexport const getComponent = <\n TComponentServerProps extends object,\n TComponentClientProps extends object,\n>({\n identifier,\n importMap,\n payloadComponent,\n silent,\n}: {\n identifier?: string\n importMap: ImportMap\n payloadComponent:\n | PayloadComponent<TComponentServerProps, TComponentClientProps>\n | null\n | undefined\n silent?: boolean\n}): ResolvedComponent<TComponentServerProps, TComponentClientProps> => {\n if (!payloadComponent) {\n return {\n Component: undefined,\n clientProps: undefined,\n serverProps: undefined,\n }\n }\n\n const { exportName, path } = parsePayloadComponent(payloadComponent)\n\n const key = path + '#' + exportName\n\n const Component = importMap[key]\n\n if (!Component && !silent) {\n console.error(`getComponent: Component not found in importMap`, {\n identifier,\n key,\n payloadComponent,\n })\n }\n\n return {\n Component,\n clientProps:\n typeof payloadComponent === 'object'\n ? (payloadComponent.clientProps as TComponentClientProps)\n : undefined,\n serverProps:\n typeof payloadComponent === 'object'\n ? (payloadComponent.serverProps as TComponentServerProps)\n : undefined,\n }\n}\n", "import type { I18nClient } from '@payloadcms/translations'\nimport type {\n CreateMappedComponent,\n ImportMap,\n JsonObject,\n MappedComponent,\n Payload,\n PayloadComponent,\n} from 'payload'\n\nimport { isReactServerComponentOrFunction } from 'payload/shared'\nimport React from 'react'\n\nimport { getComponent } from './getComponent.js'\n\nexport function getCreateMappedComponent({\n importMap,\n serverProps,\n}: {\n importMap: ImportMap\n serverProps: {\n [key: string]: any\n i18n?: I18nClient\n payload?: Payload\n }\n}): CreateMappedComponent {\n const createSingleMappedComponent = (\n payloadComponent: { ReactComponent: React.FC<any> } | PayloadComponent,\n key: number | string,\n props: JsonObject,\n Fallback: React.FC<any>,\n identifier: string,\n ): MappedComponent => {\n if (!payloadComponent) {\n if (!Fallback) {\n return undefined\n }\n\n if (isReactServerComponentOrFunction(Fallback)) {\n return {\n type: 'server',\n Component: null,\n RenderedComponent: <Fallback key={key} {...serverProps} {...props} />,\n }\n } else {\n const toReturn: MappedComponent = {\n type: 'client',\n Component: Fallback,\n }\n\n // conditionally set props here to avoid bloating the HTML with `$undefined` props\n if (props) toReturn.props = props\n\n return toReturn\n }\n }\n\n const resolvedComponent =\n payloadComponent &&\n typeof payloadComponent === 'object' &&\n 'ReactComponent' in payloadComponent\n ? {\n Component: payloadComponent.ReactComponent,\n }\n : getComponent({\n identifier,\n importMap,\n payloadComponent: payloadComponent as any,\n })\n\n if (!resolvedComponent.Component) {\n console.error(`getCreateMappedComponent: Component not found in importMap`, {\n identifier,\n key,\n })\n }\n\n if (isReactServerComponentOrFunction(resolvedComponent.Component)) {\n const Component: React.FC<any> = resolvedComponent.Component\n\n return {\n type: 'server',\n Component: null,\n RenderedComponent: (\n <Component key={key} {...serverProps} {...resolvedComponent.serverProps} {...props} />\n ),\n }\n } else {\n if (!resolvedComponent.Component) {\n return undefined\n }\n\n return {\n type: 'client',\n Component: resolvedComponent.Component,\n props: {\n ...(resolvedComponent.clientProps || {}),\n ...props,\n },\n }\n }\n }\n\n const createMappedComponent: CreateMappedComponent = (\n payloadComponent,\n props,\n fallback,\n identifier,\n ) => {\n if (!payloadComponent && !fallback) {\n return undefined as any\n }\n\n if (payloadComponent && Array.isArray(payloadComponent)) {\n const mappedComponents: MappedComponent[] = []\n for (let i = 0; i < payloadComponent.length; i++) {\n const component = createSingleMappedComponent(\n payloadComponent[i],\n i,\n props,\n fallback,\n identifier,\n )\n mappedComponents.push(component)\n }\n return mappedComponents as any\n } else {\n return createSingleMappedComponent(\n payloadComponent,\n undefined,\n props,\n fallback,\n identifier,\n ) as any\n }\n }\n\n return createMappedComponent\n}\n", "import * as qs from 'qs-esm'\n\ntype GetOptions = {\n params?: Record<string, unknown>\n} & RequestInit\n\nexport const requests = {\n delete: (url: string, options: RequestInit = { headers: {} }): Promise<Response> => {\n const headers = options && options.headers ? { ...options.headers } : {}\n\n const formattedOptions: RequestInit = {\n ...options,\n credentials: 'include',\n headers: {\n ...headers,\n },\n method: 'delete',\n }\n\n return fetch(url, formattedOptions)\n },\n\n get: (url: string, options: GetOptions = { headers: {} }): Promise<Response> => {\n let query = ''\n if (options.params) {\n query = qs.stringify(options.params, { addQueryPrefix: true })\n }\n return fetch(`${url}${query}`, {\n credentials: 'include',\n ...options,\n })\n },\n\n patch: (url: string, options: RequestInit = { headers: {} }): Promise<Response> => {\n const headers = options && options.headers ? { ...options.headers } : {}\n\n const formattedOptions: RequestInit = {\n ...options,\n credentials: 'include',\n headers: {\n ...headers,\n },\n method: 'PATCH',\n }\n\n return fetch(url, formattedOptions)\n },\n\n post: (url: string, options: RequestInit = { headers: {} }): Promise<Response> => {\n const headers = options && options.headers ? { ...options.headers } : {}\n\n const formattedOptions: RequestInit = {\n ...options,\n credentials: 'include',\n headers: {\n ...headers,\n },\n method: 'post',\n }\n\n return fetch(`${url}`, formattedOptions)\n },\n\n put: (url: string, options: RequestInit = { headers: {} }): Promise<Response> => {\n const headers = options && options.headers ? { ...options.headers } : {}\n\n const formattedOptions: RequestInit = {\n ...options,\n credentials: 'include',\n headers: {\n ...headers,\n },\n method: 'put',\n }\n\n return fetch(url, formattedOptions)\n },\n}\n", "import type { Locale, SanitizedLocalizationConfig } from 'payload'\n/*\n return the Locale for given locale code, else return null\n*/\nexport const findLocaleFromCode = (\n localizationConfig: SanitizedLocalizationConfig,\n locale: string,\n): Locale | null => {\n if (!localizationConfig?.locales || localizationConfig.locales.length === 0) {\n return null\n }\n\n return localizationConfig.locales.find((el) => el?.code === locale)\n}\n", "import type { Config } from 'payload'\n\n/** Will read the `routes.admin` config and appropriately handle `\"/\"` admin paths */\nexport const formatAdminURL = (args: {\n adminRoute: Config['routes']['admin']\n basePath?: string\n path: string\n serverURL?: Config['serverURL']\n}): string => {\n const { adminRoute, basePath = '', path, serverURL } = args\n\n if (adminRoute) {\n if (adminRoute === '/') {\n if (!path) {\n return `${serverURL || ''}${basePath}${adminRoute}`\n }\n } else {\n return `${serverURL || ''}${basePath}${adminRoute}${path}`\n }\n }\n\n return `${serverURL || ''}${basePath}${path}`\n}\n", "import type { I18n } from '@payloadcms/translations'\n\nimport { format, formatDistanceToNow } from 'date-fns'\n\ntype FormatDateArgs = {\n date: Date | number | string | undefined\n i18n: I18n<any, any>\n pattern: string\n}\n\nexport const formatDate = ({ date, i18n, pattern }: FormatDateArgs): string => {\n const theDate = new Date(date)\n return format(theDate, pattern, { locale: i18n.dateFNS })\n}\n\ntype FormatTimeToNowArgs = {\n date: Date | number | string | undefined\n i18n: I18n<any, any>\n}\n\nexport const formatTimeToNow = ({ date, i18n }: FormatTimeToNowArgs): string => {\n const theDate = new Date(date)\n return formatDistanceToNow(theDate, { locale: i18n.dateFNS })\n}\n", "import type { I18n } from '@payloadcms/translations'\nimport type {\n ClientCollectionConfig,\n ClientGlobalConfig,\n SanitizedConfig,\n TypeWithID,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport { formatDate } from '../utilities/formatDate.js'\n\nexport const formatDocTitle = ({\n collectionConfig,\n data,\n dateFormat: dateFormatFromConfig,\n fallback,\n globalConfig,\n i18n,\n}: {\n collectionConfig?: ClientCollectionConfig\n data: TypeWithID\n dateFormat: SanitizedConfig['admin']['dateFormat']\n fallback?: string\n globalConfig?: ClientGlobalConfig\n i18n: I18n<any, any>\n}): string => {\n let title: string\n\n if (collectionConfig) {\n const useAsTitle = collectionConfig?.admin?.useAsTitle\n\n if (useAsTitle) {\n title = data?.[useAsTitle] || title\n\n if (title) {\n const fieldConfig = collectionConfig.fields.find(\n (f) => 'name' in f && f.name === useAsTitle,\n )\n\n const isDate = fieldConfig?.type === 'date'\n\n if (isDate) {\n const dateFormat =\n ('date' in fieldConfig.admin && fieldConfig?.admin?.date?.displayFormat) ||\n dateFormatFromConfig\n title = formatDate({ date: title, i18n, pattern: dateFormat }) || title\n }\n }\n }\n }\n\n if (globalConfig) {\n title = getTranslation(globalConfig?.label, i18n) || globalConfig?.slug\n }\n\n if (!title) {\n title = fallback || `[${i18n.t('general:untitled')}]`\n }\n\n return title\n}\n", "import type { FormState, SanitizedConfig } from 'payload'\n\nimport type { BuildFormStateArgs } from '../forms/buildStateFromSchema/index.js'\n\nexport const getFormState = async (args: {\n apiRoute: SanitizedConfig['routes']['api']\n body: BuildFormStateArgs\n onError?: (data?: any) => Promise<void> | void\n serverURL: SanitizedConfig['serverURL']\n signal?: AbortSignal\n token?: string\n}): Promise<FormState> => {\n const { apiRoute, body, onError, serverURL, signal, token } = args\n\n const res = await fetch(`${serverURL}${apiRoute}/form-state`, {\n body: JSON.stringify(body),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n ...(token ? { Authorization: `JWT ${token}` } : {}),\n },\n method: 'POST',\n signal,\n })\n\n const json = (await res.json()) as FormState\n\n if (res.ok) {\n return json\n } else {\n if (typeof onError === 'function') {\n void onError(json)\n }\n }\n\n return body?.formState\n}\n", "import type { I18nClient } from '@payloadcms/translations'\nimport type {\n ClientCollectionConfig,\n ClientGlobalConfig,\n Permissions,\n SanitizedCollectionConfig,\n SanitizedGlobalConfig,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nexport enum EntityType {\n collection = 'collections',\n global = 'globals',\n}\n\nexport type EntityToGroup =\n | {\n entity: ClientCollectionConfig | SanitizedCollectionConfig\n type: EntityType.collection\n }\n | {\n entity: ClientGlobalConfig | SanitizedGlobalConfig\n type: EntityType.global\n }\n\nexport type Group = {\n entities: EntityToGroup[]\n label: string\n}\n\nexport function groupNavItems(\n entities: EntityToGroup[],\n permissions: Permissions,\n i18n: I18nClient,\n): Group[] {\n const result = entities.reduce(\n (groups, entityToGroup) => {\n if (\n permissions?.[entityToGroup.type.toLowerCase()]?.[entityToGroup.entity.slug]?.read\n .permission\n ) {\n const translatedGroup = getTranslation(entityToGroup.entity.admin.group, i18n)\n if (entityToGroup.entity.admin.group) {\n const existingGroup = groups.find(\n (group) => getTranslation(group.label, i18n) === translatedGroup,\n ) as Group\n let matchedGroup: Group = existingGroup\n if (!existingGroup) {\n matchedGroup = { entities: [], label: translatedGroup }\n groups.push(matchedGroup)\n }\n\n matchedGroup.entities.push(entityToGroup)\n } else {\n const defaultGroup = groups.find((group) => {\n return getTranslation(group.label, i18n) === i18n.t(`general:${entityToGroup.type}`)\n }) as Group\n defaultGroup.entities.push(entityToGroup)\n }\n }\n\n return groups\n },\n [\n {\n entities: [],\n label: i18n.t('general:collections'),\n },\n {\n entities: [],\n label: i18n.t('general:globals'),\n },\n ],\n )\n\n return result.filter((group) => group.entities.length > 0)\n}\n", "import type { CollectionPermission, DocumentPermissions, GlobalPermission } from 'payload'\n\nexport const hasSavePermission = (args: {\n /*\n * Pass either `collectionSlug` or `globalSlug`\n */\n collectionSlug?: string\n docPermissions: DocumentPermissions\n /*\n * Pass either `collectionSlug` or `globalSlug`\n */\n globalSlug?: string\n isEditing: boolean\n}) => {\n const { collectionSlug, docPermissions, globalSlug, isEditing } = args\n\n if (collectionSlug) {\n return Boolean(\n (isEditing && docPermissions?.update?.permission) ||\n (!isEditing && (docPermissions as CollectionPermission)?.create?.permission),\n )\n }\n\n if (globalSlug) {\n return Boolean((docPermissions as GlobalPermission)?.update?.permission)\n }\n\n return false\n}\n", "export const isEditing = ({\n id,\n collectionSlug,\n globalSlug,\n}: {\n collectionSlug?: string\n globalSlug?: string\n id?: number | string\n}): boolean => Boolean(globalSlug || (collectionSlug && !!id))\n", "// IMPORTANT: the shared.ts file CANNOT contain any Server Components _that import client components_.\nexport { WithServerSideProps } from '../../elements/WithServerSideProps/index.js'\nexport { withMergedProps } from '../../elements/withMergedProps/index.js' // cannot be within a 'use client', thus we export this from shared\nexport { PayloadIcon } from '../../graphics/Icon/index.js'\nexport { PayloadLogo } from '../../graphics/Logo/index.js'\nexport { RenderComponent } from '../../providers/Config/RenderComponent.js'\nexport { getComponent } from '../../providers/Config/createClientConfig/getComponent.js'\n\nexport { getCreateMappedComponent } from '../../providers/Config/createClientConfig/getCreateMappedComponent.js'\nexport { requests } from '../../utilities/api.js'\nexport { findLocaleFromCode } from '../../utilities/findLocaleFromCode.js'\nexport { formatAdminURL } from '../../utilities/formatAdminURL.js'\nexport { formatDate } from '../../utilities/formatDate.js'\nexport { formatDocTitle } from '../../utilities/formatDocTitle.js'\nexport { getFormState } from '../../utilities/getFormState.js'\nexport {\n type EntityToGroup,\n EntityType,\n type Group,\n groupNavItems,\n} from '../../utilities/groupNavItems.js'\nexport { hasSavePermission } from '../../utilities/hasSavePermission.js'\nexport { isEditing } from '../../utilities/isEditing.js'\n\nexport const emptyComponent = () => null\n"],
|
|
5
|
-
"mappings": "AAEA,OAAS,oCAAAA,MAAwC,iBACjD,OAAOC,MAAW,QAEX,IAAMC,EAAoD,CAAC,CAChE,UAAAC,EACA,gBAAAC,EACA,GAAGC,CACL,IACMF,EAUKF,EAAA,cATgCK,GAAgB,CACrD,IAAMC,EAA2B,CAC/B,GAAGD,EACH,GAAIN,EAAiCG,CAAS,EAAIC,GAAmB,CAAC,EAAI,CAAC,CAC7E,EAEA,OAAOH,EAAA,cAACE,EAAA,CAAW,GAAGI,EAA0B,CAClD,EAEQ,CAAqB,GAAGF,EAAM,EAGjC,KCvBT,OAAS,oCAAAG,EAAkC,eAAAC,MAAmB,iBAC9D,OAAOC,MAAW,QAwBX,SAASC,EAAuD,CACrE,UAAAC,EACA,wBAAAC,EACA,iBAAAC,CACF,EAIkC,CAChC,OAAID,IAA4B,SAC9BA,EAA0B,CAACL,EAAiCI,CAAS,GAGVG,GAAgB,CAC3E,IAAMC,EAAcC,EAAiBF,EAAaD,CAAgB,EAElE,OAAID,GACFJ,EAAY,QAASS,GAAS,CAC5B,OAAOF,EAAYE,CAAI,CACzB,CAAC,EAGIR,EAAA,cAACE,EAAA,CAAW,GAAGI,EAAa,CACrC,CAGF,CAEA,SAASC,EAAiBE,EAAOC,EAAS,CACxC,MAAO,CAAE,GAAGD,EAAO,GAAGC,CAAQ,CAChC,CCvDA,OAAOC,MAAW,QAEX,IAAMC,EAER,CAAC,CAAE,KAAMC,CAAc,IAAM,CAChC,IAAMC,EAAOD,GAAiB,8BAE9B,OACEF,EAAA,cAAC,OACC,UAAU,eACV,OAAO,OACP,QAAQ,YACR,MAAM,OACN,MAAM,8BAENA,EAAA,cAAC,QACC,EAAE,8EACF,KAAMG,EACR,EACAH,EAAA,cAAC,QAAK,EAAE,sDAAsD,KAAMG,EA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YAAaE,EACb,IAAKI,EACL,gBAAiBD,EACjB,YAAaD,EACf,CACD,EAGCD,EAAgB,kBACXA,EAAgB,kBAGpBA,EAAgB,UAIjBA,EAAgB,OAAS,SACvBA,EAAgB,MAEhBJ,EAAA,cAACI,EAAgB,UAAhB,CAA2B,GAAGA,EAAgB,MAAQ,GAAGC,EAAc,GAAGF,EAAa,EAIrFH,EAAA,cAACI,EAAgB,UAAhB,CAA2B,GAAGC,EAAc,GAAGF,EAAa,EAGlEC,EAAgB,MACXJ,EAAA,cAACI,EAAgB,UAAhB,CAA2B,GAAGA,EAAgB,MAAQ,GAAGD,EAAa,EAGzEH,EAAA,cAACI,EAAgB,UAAhB,CAA2B,GAAGD,EAAa,EAjB1C,
|
|
6
|
-
"names": ["isReactServerComponentOrFunction", "React", "WithServerSideProps", "Component", "serverOnlyProps", "rest", "passedProps", "propsWithServerOnlyProps", "isReactServerComponentOrFunction", "serverProps", "React", "withMergedProps", "Component", "sanitizeServerOnlyProps", "toMergeIntoProps", "passedProps", "mergedProps", "simpleMergeProps", "prop", "props", "toMerge", "React", "PayloadIcon", "fillFromProps", "fill", "React", "css", "PayloadLogo", "isReactServerComponentOrFunction", "React", "RenderComponent", "Component", "clientProps", "mappedComponent", "serverProps", "c", "index", "parsePayloadComponent", "getComponent", "identifier", "importMap", "payloadComponent", "silent", "exportName", "path", "key", "Component", "isReactServerComponentOrFunction", "React", "getCreateMappedComponent", "importMap", "serverProps", "createSingleMappedComponent", "payloadComponent", "key", "props", "Fallback", "identifier", "isReactServerComponentOrFunction", "React", "toReturn", "resolvedComponent", "getComponent", "Component", "fallback", "mappedComponents", "i", "component", "qs", "requests", "url", "options", "headers", "formattedOptions", "query", "findLocaleFromCode", "localizationConfig", "locale", "el", "formatAdminURL", "args", "adminRoute", "basePath", "path", "serverURL", "format", "formatDistanceToNow", "formatDate", "date", "i18n", "pattern", "theDate", "getTranslation", "formatDocTitle", "collectionConfig", "data", "dateFormatFromConfig", "fallback", "globalConfig", "i18n", "title", "useAsTitle", "fieldConfig", "f", "dateFormat", "formatDate", "getTranslation", "getFormState", "args", "apiRoute", "body", "onError", "serverURL", "signal", "token", "res", "json", "getTranslation", "EntityType", "groupNavItems", "entities", "permissions", "i18n", "groups", "entityToGroup", "translatedGroup", "existingGroup", "group", "matchedGroup", "hasSavePermission", "args", "collectionSlug", "docPermissions", "globalSlug", "isEditing", "isEditing", "id", "collectionSlug", "globalSlug"
|
|
3
|
+
"sources": ["../../../src/elements/WithServerSideProps/index.tsx", "../../../src/elements/withMergedProps/index.tsx", "../../../src/graphics/Icon/index.tsx", "../../../src/graphics/Logo/index.tsx", "../../../src/providers/Config/RenderComponent.tsx", "../../../src/providers/Config/createClientConfig/getComponent.ts", "../../../src/providers/Config/createClientConfig/getCreateMappedComponent.tsx", "../../../src/utilities/api.ts", "../../../src/utilities/findLocaleFromCode.ts", "../../../src/utilities/formatAdminURL.ts", "../../../src/utilities/formatDate.ts", "../../../src/utilities/formatDocTitle.ts", "../../../src/utilities/getFormState.ts", "../../../src/utilities/groupNavItems.ts", "../../../src/utilities/hasSavePermission.ts", "../../../src/utilities/isEditing.ts"],
|
|
4
|
+
"sourcesContent": ["import type { WithServerSidePropsComponent } from 'payload'\n\nimport { isReactServerComponentOrFunction } from 'payload/shared'\nimport React from 'react'\n\nexport const WithServerSideProps: WithServerSidePropsComponent = ({\n Component,\n serverOnlyProps,\n ...rest\n}) => {\n if (Component) {\n const WithServerSideProps: React.FC = (passedProps) => {\n const propsWithServerOnlyProps = {\n ...passedProps,\n ...(isReactServerComponentOrFunction(Component) ? serverOnlyProps ?? {} : {}),\n }\n\n return <Component {...propsWithServerOnlyProps} />\n }\n\n return <WithServerSideProps {...rest} />\n }\n\n return null\n}\n", "import { isReactServerComponentOrFunction, serverProps } from 'payload/shared'\nimport React from 'react'\n\n/**\n * Creates a higher-order component (HOC) that merges predefined properties (`toMergeIntoProps`)\n * with any properties passed to the resulting component.\n *\n * Use this when you want to pre-specify some props for a component, while also allowing users to\n * pass in their own props. The HOC ensures the passed props and predefined props are combined before\n * rendering the original component.\n *\n * @example\n * const PredefinedComponent = getMergedPropsComponent({\n * Component: OriginalComponent,\n * toMergeIntoProps: { someExtraValue: 5 }\n * });\n * // Using <PredefinedComponent customProp=\"value\" /> will result in\n * // <OriginalComponent customProp=\"value\" someExtraValue={5} />\n *\n * @returns A higher-order component with combined properties.\n *\n * @param Component - The original component to wrap.\n * @param sanitizeServerOnlyProps - If true, server-only props will be removed from the merged props. @default true if the component is not a server component, false otherwise.\n * @param toMergeIntoProps - The properties to merge into the passed props.\n */\nexport function withMergedProps<ToMergeIntoProps, CompleteReturnProps>({\n Component,\n sanitizeServerOnlyProps,\n toMergeIntoProps,\n}: {\n Component: React.FC<CompleteReturnProps>\n sanitizeServerOnlyProps?: boolean\n toMergeIntoProps: ToMergeIntoProps\n}): React.FC<CompleteReturnProps> {\n if (sanitizeServerOnlyProps === undefined) {\n sanitizeServerOnlyProps = !isReactServerComponentOrFunction(Component)\n }\n // A wrapper around the args.Component to inject the args.toMergeArgs as props, which are merged with the passed props\n const MergedPropsComponent: React.FC<CompleteReturnProps> = (passedProps) => {\n const mergedProps = simpleMergeProps(passedProps, toMergeIntoProps) as CompleteReturnProps\n\n if (sanitizeServerOnlyProps) {\n serverProps.forEach((prop) => {\n delete mergedProps[prop]\n })\n }\n\n return <Component {...mergedProps} />\n }\n\n return MergedPropsComponent\n}\n\nfunction simpleMergeProps(props, toMerge) {\n return { ...props, ...toMerge }\n}\n", "import React from 'react'\n\nexport const PayloadIcon: React.FC<{\n fill?: string\n}> = ({ fill: fillFromProps }) => {\n const fill = fillFromProps || 'var(--theme-elevation-1000)'\n\n return (\n <svg\n className=\"graphic-icon\"\n height=\"100%\"\n viewBox=\"0 0 25 25\"\n width=\"100%\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M11.5293 0L23 6.90096V19.9978L14.3608 25V11.9032L2.88452 5.00777L11.5293 0Z\"\n fill={fill}\n />\n <path d=\"M10.6559 24.2727V14.0518L2 19.0651L10.6559 24.2727Z\" fill={fill} />\n </svg>\n )\n}\n", "import React from 'react'\n\nconst css = `\n .graphic-logo path {\n fill: var(--theme-elevation-1000);\n }\n`\n\nexport const PayloadLogo: React.FC = () => (\n <svg\n className=\"graphic-logo\"\n fill=\"none\"\n height=\"50\"\n viewBox=\"0 0 180 50\"\n width=\"180\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <style>{css}</style>\n <path d=\"M65.922 13.8685C71.1075 13.8685 77.0257 14.6014 77.0257 22.2185C77.0257 28.6587 71.8736 30.2243 66.0664 30.2243H62.2689V39.0961H57.2944V13.8685H65.922ZM62.2689 17.7659V26.3602H66.3773C69.4752 26.3602 71.9069 25.594 71.9069 22.2518C71.9069 18.1101 68.7424 17.7659 66.022 17.7659H62.2689Z\" />\n <path d=\"M84.3209 39.5514C80.7344 39.5514 77.5698 37.4639 77.5698 34.0884C77.5698 29.6358 82.5443 28.3145 89.8949 27.4706V27.1264C89.8949 24.2394 88.3626 23.2623 86.3084 23.2623C84.2542 23.2623 82.7219 24.2394 82.622 26.2936H78.1361C78.4803 22.6072 81.7226 19.8867 86.4861 19.8867C91.1163 19.8867 94.7028 21.7633 94.7028 28.1035C94.7028 28.692 94.6362 31.2014 94.6362 32.9114C94.6362 35.865 94.8472 37.5416 95.1914 39.1073H90.7721C90.6278 38.5188 90.4945 37.6083 90.4279 36.7089C89.0844 38.6853 87.1412 39.5514 84.3209 39.5514ZM90.0282 30.5463C84.6651 31.1015 82.511 31.7344 82.511 33.8219C82.511 35.1766 83.588 36.298 85.7532 36.298C88.7512 36.298 90.0393 34.5547 90.0393 31.4901V30.5463H90.0282Z\" />\n <path d=\"M97.2899 45.1921V41.5057H99.0998C100.699 41.5057 101.432 41.539 102.231 39.5514L102.442 39.0295L95.269 20.3753H100.521L104.763 33.8774L109.115 20.3753H113.99L107.139 38.541C104.951 44.3593 103.974 45.1921 99.3108 45.1921H97.2899Z\" />\n <path d=\"M120.263 39.1073H115.456V13.8685H120.263V39.1073Z\" />\n <path d=\"M122.406 29.7801C122.406 23.2067 126.826 19.9645 131.7 19.9645C136.575 19.9645 140.994 23.2067 140.994 29.7801C140.994 36.3535 136.575 39.5625 131.7 39.5625C126.826 39.5514 122.406 36.3535 122.406 29.7801ZM127.281 29.7801C127.281 33.6775 128.913 35.7984 131.7 35.7984C134.487 35.7984 136.119 33.6775 136.119 29.7801C136.119 25.8494 134.487 23.7286 131.7 23.7286C128.913 23.7286 127.281 25.8383 127.281 29.7801Z\" />\n <path d=\"M149.167 39.5514C145.58 39.5514 142.416 37.4639 142.416 34.0884C142.416 29.6358 147.39 28.3145 154.741 27.4706V27.1264C154.741 24.2394 153.208 23.2623 151.154 23.2623C149.1 23.2623 147.568 24.2394 147.468 26.2936H142.982C143.326 22.6072 146.568 19.8867 151.332 19.8867C155.962 19.8867 159.549 21.7633 159.549 28.1035C159.549 28.692 159.482 31.2014 159.482 32.9114C159.482 35.865 159.693 37.5416 160.037 39.1073H155.618C155.473 38.5188 155.34 37.6083 155.274 36.7089C153.941 38.6853 151.987 39.5514 149.167 39.5514ZM154.874 30.5463C149.511 31.1015 147.357 31.7344 147.357 33.8219C147.357 35.1766 148.434 36.298 150.599 36.298C153.597 36.298 154.885 34.5547 154.885 31.4901V30.5463H154.874Z\" />\n <path d=\"M175.06 39.1073V36.7422C173.872 38.7964 171.618 39.5625 169.664 39.5625C165.067 39.5625 161.625 35.7317 161.625 29.7468C161.625 23.8619 165 19.9645 169.664 19.9645C172.029 19.9645 174.05 21.0415 175.06 22.7848V13.8796H179.868V39.1073H175.06ZM175.238 29.7357C175.238 25.9716 173.494 23.6398 170.852 23.6398C168.242 23.6398 166.677 26.1159 166.677 29.7691C166.677 33.4222 168.242 35.865 170.852 35.865C173.494 35.865 175.238 33.5665 175.238 29.7357Z\" />\n <path d=\"M19.1531 0L42.049 13.8019V39.9956L24.8049 50V23.8064L1.89795 10.0155L19.1531 0Z\" />\n <path d=\"M17.4097 48.5454V28.1035L0.132324 38.1301L17.4097 48.5454Z\" />\n </svg>\n)\n", "import type { MappedComponent } from 'payload'\n\nimport { isReactServerComponentOrFunction } from 'payload/shared'\nimport React from 'react'\n\n/**\n * Can be used to render both MappedComponents and React Components.\n */\nexport const RenderComponent: React.FC<{\n readonly Component?: React.ComponentType | React.ComponentType[]\n readonly clientProps?: object\n readonly mappedComponent?: MappedComponent | MappedComponent[]\n readonly serverProps?: object\n}> = ({ Component, clientProps = {}, mappedComponent, serverProps }) => {\n if (!mappedComponent && Component) {\n if (Array.isArray(Component)) {\n return Component.map((c, index) => (\n <RenderComponent\n Component={c}\n clientProps={clientProps}\n key={index}\n serverProps={serverProps}\n />\n ))\n }\n\n const mappedComponent: MappedComponent = isReactServerComponentOrFunction(Component)\n ? {\n type: 'server',\n Component,\n RenderedComponent: null,\n }\n : {\n type: 'client',\n Component,\n }\n\n return (\n <RenderComponent\n clientProps={clientProps}\n mappedComponent={mappedComponent}\n serverProps={serverProps}\n />\n )\n }\n if (!mappedComponent) {\n return null\n }\n\n if (Array.isArray(mappedComponent)) {\n return mappedComponent.map((c, index) => (\n <RenderComponent\n clientProps={clientProps}\n key={index}\n mappedComponent={c}\n serverProps={serverProps}\n />\n ))\n }\n\n if (mappedComponent.type === 'empty') {\n return null\n }\n\n if (mappedComponent.RenderedComponent) {\n return mappedComponent.RenderedComponent\n }\n\n if (!mappedComponent.Component) {\n return null\n }\n\n if (mappedComponent.type === 'server') {\n if (mappedComponent.props) {\n return (\n <mappedComponent.Component {...mappedComponent.props} {...serverProps} {...clientProps} />\n )\n }\n\n return <mappedComponent.Component {...serverProps} {...clientProps} />\n }\n\n if (mappedComponent.props) {\n return <mappedComponent.Component {...mappedComponent.props} {...clientProps} />\n }\n\n return <mappedComponent.Component {...clientProps} />\n}\n", "import type { ImportMap, PayloadComponent, ResolvedComponent } from 'payload'\n\nimport { parsePayloadComponent } from 'payload/shared'\n\n/**\n * Gets the resolved React component from `PayloadComponent` from the importMap\n */\nexport const getComponent = <\n TComponentServerProps extends object,\n TComponentClientProps extends object,\n>({\n identifier,\n importMap,\n payloadComponent,\n silent,\n}: {\n identifier?: string\n importMap: ImportMap\n payloadComponent:\n | PayloadComponent<TComponentServerProps, TComponentClientProps>\n | null\n | undefined\n silent?: boolean\n}): ResolvedComponent<TComponentServerProps, TComponentClientProps> => {\n if (!payloadComponent) {\n // undefined, null or false\n return {\n Component: undefined,\n clientProps: undefined,\n serverProps: undefined,\n }\n }\n\n const { exportName, path } = parsePayloadComponent(payloadComponent)\n\n const key = path + '#' + exportName\n\n const Component = importMap[key]\n\n if (!Component && !silent) {\n console.error(\n `getComponent: Component not found in importMap`,\n {\n identifier,\n key,\n payloadComponent,\n },\n 'You may need to run the `payload generate:importmap` command to generate the importMap ahead of runtime.',\n )\n }\n\n return {\n Component,\n clientProps:\n typeof payloadComponent === 'object'\n ? (payloadComponent.clientProps as TComponentClientProps)\n : undefined,\n serverProps:\n typeof payloadComponent === 'object'\n ? (payloadComponent.serverProps as TComponentServerProps)\n : undefined,\n }\n}\n", "import type { I18nClient } from '@payloadcms/translations'\nimport type {\n CreateMappedComponent,\n ImportMap,\n JsonObject,\n MappedComponent,\n Payload,\n PayloadComponent,\n} from 'payload'\n\nimport { isReactServerComponentOrFunction } from 'payload/shared'\nimport React from 'react'\n\nimport { getComponent } from './getComponent.js'\n\nexport function getCreateMappedComponent({\n importMap,\n serverProps,\n}: {\n importMap: ImportMap\n serverProps: {\n [key: string]: any\n i18n?: I18nClient\n payload?: Payload\n }\n}): CreateMappedComponent {\n const createSingleMappedComponent = (\n payloadComponent: { ReactComponent: React.FC<any> } | PayloadComponent,\n key: number | string,\n props: JsonObject,\n Fallback: React.FC<any>,\n identifier: string,\n ): MappedComponent => {\n if (payloadComponent === undefined || payloadComponent === null) {\n if (!Fallback) {\n return undefined\n }\n\n if (isReactServerComponentOrFunction(Fallback)) {\n return {\n type: 'server',\n Component: null,\n RenderedComponent: <Fallback key={key} {...serverProps} {...props} />,\n }\n } else {\n const toReturn: MappedComponent = {\n type: 'client',\n Component: Fallback,\n }\n\n // conditionally set props here to avoid bloating the HTML with `$undefined` props\n if (props) toReturn.props = props\n\n return toReturn\n }\n }\n\n if (payloadComponent === false) {\n return {\n type: 'empty',\n }\n }\n\n const resolvedComponent =\n payloadComponent &&\n typeof payloadComponent === 'object' &&\n 'ReactComponent' in payloadComponent\n ? {\n Component: payloadComponent.ReactComponent,\n }\n : getComponent({\n identifier,\n importMap,\n payloadComponent: payloadComponent as any,\n })\n\n if (!resolvedComponent.Component) {\n console.error(`getCreateMappedComponent: Component not found in importMap`, {\n identifier,\n key,\n })\n }\n\n if (isReactServerComponentOrFunction(resolvedComponent.Component)) {\n const Component: React.FC<any> = resolvedComponent.Component\n\n return {\n type: 'server',\n Component: null,\n RenderedComponent: (\n <Component key={key} {...serverProps} {...resolvedComponent.serverProps} {...props} />\n ),\n }\n } else {\n if (!resolvedComponent.Component) {\n return undefined\n }\n\n return {\n type: 'client',\n Component: resolvedComponent.Component,\n props: {\n ...(resolvedComponent.clientProps || {}),\n ...props,\n },\n }\n }\n }\n\n const createMappedComponent: CreateMappedComponent = (\n payloadComponent,\n props,\n fallback,\n identifier,\n ) => {\n if ((payloadComponent === undefined || payloadComponent === null) && !fallback) {\n return undefined as any\n }\n\n if (payloadComponent && Array.isArray(payloadComponent)) {\n const mappedComponents: MappedComponent[] = []\n for (let i = 0; i < payloadComponent.length; i++) {\n const component = createSingleMappedComponent(\n payloadComponent[i],\n i,\n props,\n fallback,\n identifier,\n )\n mappedComponents.push(component)\n }\n return mappedComponents as any\n } else {\n return createSingleMappedComponent(\n payloadComponent,\n undefined,\n props,\n fallback,\n identifier,\n ) as any\n }\n }\n\n return createMappedComponent\n}\n", "import * as qs from 'qs-esm'\n\ntype GetOptions = {\n params?: Record<string, unknown>\n} & RequestInit\n\nexport const requests = {\n delete: (url: string, options: RequestInit = { headers: {} }): Promise<Response> => {\n const headers = options && options.headers ? { ...options.headers } : {}\n\n const formattedOptions: RequestInit = {\n ...options,\n credentials: 'include',\n headers: {\n ...headers,\n },\n method: 'delete',\n }\n\n return fetch(url, formattedOptions)\n },\n\n get: (url: string, options: GetOptions = { headers: {} }): Promise<Response> => {\n let query = ''\n if (options.params) {\n query = qs.stringify(options.params, { addQueryPrefix: true })\n }\n return fetch(`${url}${query}`, {\n credentials: 'include',\n ...options,\n })\n },\n\n patch: (url: string, options: RequestInit = { headers: {} }): Promise<Response> => {\n const headers = options && options.headers ? { ...options.headers } : {}\n\n const formattedOptions: RequestInit = {\n ...options,\n credentials: 'include',\n headers: {\n ...headers,\n },\n method: 'PATCH',\n }\n\n return fetch(url, formattedOptions)\n },\n\n post: (url: string, options: RequestInit = { headers: {} }): Promise<Response> => {\n const headers = options && options.headers ? { ...options.headers } : {}\n\n const formattedOptions: RequestInit = {\n ...options,\n credentials: 'include',\n headers: {\n ...headers,\n },\n method: 'post',\n }\n\n return fetch(`${url}`, formattedOptions)\n },\n\n put: (url: string, options: RequestInit = { headers: {} }): Promise<Response> => {\n const headers = options && options.headers ? { ...options.headers } : {}\n\n const formattedOptions: RequestInit = {\n ...options,\n credentials: 'include',\n headers: {\n ...headers,\n },\n method: 'put',\n }\n\n return fetch(url, formattedOptions)\n },\n}\n", "import type { Locale, SanitizedLocalizationConfig } from 'payload'\n/*\n return the Locale for given locale code, else return null\n*/\nexport const findLocaleFromCode = (\n localizationConfig: SanitizedLocalizationConfig,\n locale: string,\n): Locale | null => {\n if (!localizationConfig?.locales || localizationConfig.locales.length === 0) {\n return null\n }\n\n return localizationConfig.locales.find((el) => el?.code === locale)\n}\n", "import type { Config } from 'payload'\n\n/** Will read the `routes.admin` config and appropriately handle `\"/\"` admin paths */\nexport const formatAdminURL = (args: {\n adminRoute: Config['routes']['admin']\n basePath?: string\n path: string\n serverURL?: Config['serverURL']\n}): string => {\n const { adminRoute, basePath = '', path, serverURL } = args\n\n if (adminRoute) {\n if (adminRoute === '/') {\n if (!path) {\n return `${serverURL || ''}${basePath}${adminRoute}`\n }\n } else {\n return `${serverURL || ''}${basePath}${adminRoute}${path}`\n }\n }\n\n return `${serverURL || ''}${basePath}${path}`\n}\n", "import type { I18n } from '@payloadcms/translations'\n\nimport { format, formatDistanceToNow } from 'date-fns'\n\ntype FormatDateArgs = {\n date: Date | number | string | undefined\n i18n: I18n<any, any>\n pattern: string\n}\n\nexport const formatDate = ({ date, i18n, pattern }: FormatDateArgs): string => {\n const theDate = new Date(date)\n return format(theDate, pattern, { locale: i18n.dateFNS })\n}\n\ntype FormatTimeToNowArgs = {\n date: Date | number | string | undefined\n i18n: I18n<any, any>\n}\n\nexport const formatTimeToNow = ({ date, i18n }: FormatTimeToNowArgs): string => {\n const theDate = new Date(date)\n return formatDistanceToNow(theDate, { locale: i18n.dateFNS })\n}\n", "import type { I18n } from '@payloadcms/translations'\nimport type {\n ClientCollectionConfig,\n ClientGlobalConfig,\n SanitizedConfig,\n TypeWithID,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport { formatDate } from '../utilities/formatDate.js'\n\nexport const formatDocTitle = ({\n collectionConfig,\n data,\n dateFormat: dateFormatFromConfig,\n fallback,\n globalConfig,\n i18n,\n}: {\n collectionConfig?: ClientCollectionConfig\n data: TypeWithID\n dateFormat: SanitizedConfig['admin']['dateFormat']\n fallback?: string\n globalConfig?: ClientGlobalConfig\n i18n: I18n<any, any>\n}): string => {\n let title: string\n\n if (collectionConfig) {\n const useAsTitle = collectionConfig?.admin?.useAsTitle\n\n if (useAsTitle) {\n title = data?.[useAsTitle] || title\n\n if (title) {\n const fieldConfig = collectionConfig.fields.find(\n (f) => 'name' in f && f.name === useAsTitle,\n )\n\n const isDate = fieldConfig?.type === 'date'\n\n if (isDate) {\n const dateFormat =\n ('date' in fieldConfig.admin && fieldConfig?.admin?.date?.displayFormat) ||\n dateFormatFromConfig\n title = formatDate({ date: title, i18n, pattern: dateFormat }) || title\n }\n }\n }\n }\n\n if (globalConfig) {\n title = getTranslation(globalConfig?.label, i18n) || globalConfig?.slug\n }\n\n if (!title) {\n title = fallback || `[${i18n.t('general:untitled')}]`\n }\n\n return title\n}\n", "import type { FormState, SanitizedConfig } from 'payload'\n\nimport type { BuildFormStateArgs } from '../forms/buildStateFromSchema/index.js'\n\nexport const getFormState = async (args: {\n apiRoute: SanitizedConfig['routes']['api']\n body: BuildFormStateArgs\n onError?: (data?: any) => Promise<void> | void\n serverURL: SanitizedConfig['serverURL']\n signal?: AbortSignal\n token?: string\n}): Promise<FormState> => {\n const { apiRoute, body, onError, serverURL, signal, token } = args\n\n const res = await fetch(`${serverURL}${apiRoute}/form-state`, {\n body: JSON.stringify(body),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n ...(token ? { Authorization: `JWT ${token}` } : {}),\n },\n method: 'POST',\n signal,\n })\n\n const json = (await res.json()) as FormState\n\n if (res.ok) {\n return json\n } else {\n if (typeof onError === 'function') {\n void onError(json)\n }\n }\n\n return body?.formState\n}\n", "import type { I18nClient } from '@payloadcms/translations'\nimport type {\n ClientCollectionConfig,\n ClientGlobalConfig,\n Permissions,\n SanitizedCollectionConfig,\n SanitizedGlobalConfig,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nexport enum EntityType {\n collection = 'collections',\n global = 'globals',\n}\n\nexport type EntityToGroup =\n | {\n entity: ClientCollectionConfig | SanitizedCollectionConfig\n type: EntityType.collection\n }\n | {\n entity: ClientGlobalConfig | SanitizedGlobalConfig\n type: EntityType.global\n }\n\nexport type Group = {\n entities: EntityToGroup[]\n label: string\n}\n\nexport function groupNavItems(\n entities: EntityToGroup[],\n permissions: Permissions,\n i18n: I18nClient,\n): Group[] {\n const result = entities.reduce(\n (groups, entityToGroup) => {\n if (\n permissions?.[entityToGroup.type.toLowerCase()]?.[entityToGroup.entity.slug]?.read\n .permission\n ) {\n const translatedGroup = getTranslation(entityToGroup.entity.admin.group, i18n)\n if (entityToGroup.entity.admin.group) {\n const existingGroup = groups.find(\n (group) => getTranslation(group.label, i18n) === translatedGroup,\n ) as Group\n let matchedGroup: Group = existingGroup\n if (!existingGroup) {\n matchedGroup = { entities: [], label: translatedGroup }\n groups.push(matchedGroup)\n }\n\n matchedGroup.entities.push(entityToGroup)\n } else {\n const defaultGroup = groups.find((group) => {\n return getTranslation(group.label, i18n) === i18n.t(`general:${entityToGroup.type}`)\n }) as Group\n defaultGroup.entities.push(entityToGroup)\n }\n }\n\n return groups\n },\n [\n {\n entities: [],\n label: i18n.t('general:collections'),\n },\n {\n entities: [],\n label: i18n.t('general:globals'),\n },\n ],\n )\n\n return result.filter((group) => group.entities.length > 0)\n}\n", "import type { CollectionPermission, DocumentPermissions, GlobalPermission } from 'payload'\n\nexport const hasSavePermission = (args: {\n /*\n * Pass either `collectionSlug` or `globalSlug`\n */\n collectionSlug?: string\n docPermissions: DocumentPermissions\n /*\n * Pass either `collectionSlug` or `globalSlug`\n */\n globalSlug?: string\n isEditing: boolean\n}) => {\n const { collectionSlug, docPermissions, globalSlug, isEditing } = args\n\n if (collectionSlug) {\n return Boolean(\n (isEditing && docPermissions?.update?.permission) ||\n (!isEditing && (docPermissions as CollectionPermission)?.create?.permission),\n )\n }\n\n if (globalSlug) {\n return Boolean((docPermissions as GlobalPermission)?.update?.permission)\n }\n\n return false\n}\n", "export const isEditing = ({\n id,\n collectionSlug,\n globalSlug,\n}: {\n collectionSlug?: string\n globalSlug?: string\n id?: number | string\n}): boolean => Boolean(globalSlug || (collectionSlug && !!id))\n"],
|
|
5
|
+
"mappings": "AAEA,OAAS,oCAAAA,MAAwC,iBACjD,OAAOC,MAAW,QAEX,IAAMC,EAAoD,CAAC,CAChE,UAAAC,EACA,gBAAAC,EACA,GAAGC,CACL,IACMF,EAUKF,EAAA,cATgCK,GAAgB,CACrD,IAAMC,EAA2B,CAC/B,GAAGD,EACH,GAAIN,EAAiCG,CAAS,EAAIC,GAAmB,CAAC,EAAI,CAAC,CAC7E,EAEA,OAAOH,EAAA,cAACE,EAAA,CAAW,GAAGI,E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AAE,qBAAqB,CACrC,EACA,CACE,SAAU,CAAC,EACX,MAAOA,EAAK,EAAE,iBAAiB,CACjC,CACF,CACF,EAEc,OAAQK,GAAUA,EAAM,SAAS,OAAS,CAAC,CAC3D,CC3EO,IAAME,EAAqBC,GAW5B,CACJ,GAAM,CAAE,eAAAC,EAAgB,eAAAC,EAAgB,WAAAC,EAAY,UAAAC,CAAU,EAAIJ,EAElE,OAAIC,EACK,GACJG,GAAaF,GAAgB,QAAQ,YACnC,CAACE,GAAcF,GAAyC,QAAQ,YAInEC,EACK,EAASD,GAAqC,QAAQ,WAGxD,EACT,EC5BO,IAAMG,EAAY,CAAC,CACxB,GAAAC,EACA,eAAAC,EACA,WAAAC,CACF,IAIe,GAAQA,GAAeD,GAAoBD",
|
|
6
|
+
"names": ["isReactServerComponentOrFunction", "React", "WithServerSideProps", "Component", "serverOnlyProps", "rest", "passedProps", "propsWithServerOnlyProps", "isReactServerComponentOrFunction", "serverProps", "React", "withMergedProps", "Component", "sanitizeServerOnlyProps", "toMergeIntoProps", "passedProps", "mergedProps", "simpleMergeProps", "prop", "props", "toMerge", "React", "PayloadIcon", "fillFromProps", "fill", "React", "css", "PayloadLogo", "isReactServerComponentOrFunction", "React", "RenderComponent", "Component", "clientProps", "mappedComponent", "serverProps", "c", "index", "parsePayloadComponent", "getComponent", "identifier", "importMap", "payloadComponent", "silent", "exportName", "path", "key", "Component", "isReactServerComponentOrFunction", "React", "getCreateMappedComponent", "importMap", "serverProps", "createSingleMappedComponent", "payloadComponent", "key", "props", "Fallback", "identifier", "isReactServerComponentOrFunction", "React", "toReturn", "resolvedComponent", "getComponent", "Component", "fallback", "mappedComponents", "i", "component", "qs", "requests", "url", "options", "headers", "formattedOptions", "query", "findLocaleFromCode", "localizationConfig", "locale", "el", "formatAdminURL", "args", "adminRoute", "basePath", "path", "serverURL", "format", "formatDistanceToNow", "formatDate", "date", "i18n", "pattern", "theDate", "getTranslation", "formatDocTitle", "collectionConfig", "data", "dateFormatFromConfig", "fallback", "globalConfig", "i18n", "title", "useAsTitle", "fieldConfig", "f", "dateFormat", "formatDate", "getTranslation", "getFormState", "args", "apiRoute", "body", "onError", "serverURL", "signal", "token", "res", "json", "getTranslation", "EntityType", "groupNavItems", "entities", "permissions", "i18n", "groups", "entityToGroup", "translatedGroup", "existingGroup", "group", "matchedGroup", "hasSavePermission", "args", "collectionSlug", "docPermissions", "globalSlug", "isEditing", "isEditing", "id", "collectionSlug", "globalSlug"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderComponent.d.ts","sourceRoot":"","sources":["../../../src/providers/Config/RenderComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG9C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,EAAE,CAAA;IAChE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,eAAe,CAAC,EAAE,eAAe,GAAG,eAAe,EAAE,CAAA;IAC9D,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B,
|
|
1
|
+
{"version":3,"file":"RenderComponent.d.ts","sourceRoot":"","sources":["../../../src/providers/Config/RenderComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG9C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,EAAE,CAAA;IAChE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,eAAe,CAAC,EAAE,eAAe,GAAG,eAAe,EAAE,CAAA;IAC9D,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B,CA0EA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/providers/Config/RenderComponent.tsx"],"sourcesContent":["import type { MappedComponent } from 'payload'\n\nimport { isReactServerComponentOrFunction } from 'payload/shared'\nimport React from 'react'\n\n/**\n * Can be used to render both MappedComponents and React Components.\n */\nexport const RenderComponent: React.FC<{\n readonly Component?: React.ComponentType | React.ComponentType[]\n readonly clientProps?: object\n readonly mappedComponent?: MappedComponent | MappedComponent[]\n readonly serverProps?: object\n}> = ({ Component, clientProps = {}, mappedComponent, serverProps }) => {\n if (!mappedComponent && Component) {\n if (Array.isArray(Component)) {\n return Component.map((c, index) => (\n <RenderComponent\n Component={c}\n clientProps={clientProps}\n key={index}\n serverProps={serverProps}\n />\n ))\n }\n\n const mappedComponent: MappedComponent = isReactServerComponentOrFunction(Component)\n ? {\n type: 'server',\n Component,\n RenderedComponent: null,\n }\n : {\n type: 'client',\n Component,\n }\n\n return (\n <RenderComponent\n clientProps={clientProps}\n mappedComponent={mappedComponent}\n serverProps={serverProps}\n />\n )\n }\n if (!mappedComponent) {\n return null\n }\n\n if (Array.isArray(mappedComponent)) {\n return mappedComponent.map((c, index) => (\n <RenderComponent\n clientProps={clientProps}\n key={index}\n mappedComponent={c}\n serverProps={serverProps}\n />\n ))\n }\n\n if (mappedComponent.RenderedComponent) {\n return mappedComponent.RenderedComponent\n }\n\n if (!mappedComponent.Component) {\n return null\n }\n\n if (mappedComponent.type === 'server') {\n if (mappedComponent.props) {\n return (\n <mappedComponent.Component {...mappedComponent.props} {...serverProps} {...clientProps} />\n )\n }\n\n return <mappedComponent.Component {...serverProps} {...clientProps} />\n }\n\n if (mappedComponent.props) {\n return <mappedComponent.Component {...mappedComponent.props} {...clientProps} />\n }\n\n return <mappedComponent.Component {...clientProps} />\n}\n"],"names":["isReactServerComponentOrFunction","React","RenderComponent","Component","clientProps","mappedComponent","serverProps","Array","isArray","map","c","index","type","RenderedComponent","props"],"mappings":";AAEA,SAASA,gCAAgC,QAAQ,iBAAgB;AACjE,OAAOC,WAAW,QAAO;AAEzB;;CAEC,GACD,OAAO,MAAMC,kBAKR,CAAC,EAAEC,SAAS,EAAEC,cAAc,CAAC,CAAC,EAAEC,eAAe,EAAEC,WAAW,EAAE;IACjE,IAAI,CAACD,mBAAmBF,WAAW;QACjC,IAAII,MAAMC,OAAO,CAACL,YAAY;YAC5B,OAAOA,UAAUM,GAAG,CAAC,CAACC,GAAGC,sBACvB,KAACT;oBACCC,WAAWO;oBACXN,aAAaA;oBAEbE,aAAaA;mBADRK;QAIX;QAEA,MAAMN,kBAAmCL,iCAAiCG,aACtE;YACES,MAAM;YACNT;YACAU,mBAAmB;QACrB,IACA;YACED,MAAM;YACNT;QACF;QAEJ,qBACE,KAACD;YACCE,aAAaA;YACbC,iBAAiBA;YACjBC,aAAaA;;IAGnB;IACA,IAAI,CAACD,iBAAiB;QACpB,OAAO;IACT;IAEA,IAAIE,MAAMC,OAAO,CAACH,kBAAkB;QAClC,OAAOA,gBAAgBI,GAAG,CAAC,CAACC,GAAGC,sBAC7B,KAACT;gBACCE,aAAaA;gBAEbC,iBAAiBK;gBACjBJ,aAAaA;eAFRK;IAKX;IAEA,IAAIN,gBAAgBQ,iBAAiB,EAAE;QACrC,OAAOR,gBAAgBQ,iBAAiB;IAC1C;IAEA,IAAI,CAACR,gBAAgBF,SAAS,EAAE;QAC9B,OAAO;IACT;IAEA,IAAIE,gBAAgBO,IAAI,KAAK,UAAU;QACrC,IAAIP,gBAAgBS,KAAK,EAAE;YACzB,qBACE,KAACT,gBAAgBF,SAAS;gBAAE,GAAGE,gBAAgBS,KAAK;gBAAG,GAAGR,WAAW;gBAAG,GAAGF,WAAW;;QAE1F;QAEA,qBAAO,KAACC,gBAAgBF,SAAS;YAAE,GAAGG,WAAW;YAAG,GAAGF,WAAW;;IACpE;IAEA,IAAIC,gBAAgBS,KAAK,EAAE;QACzB,qBAAO,KAACT,gBAAgBF,SAAS;YAAE,GAAGE,gBAAgBS,KAAK;YAAG,GAAGV,WAAW;;IAC9E;IAEA,qBAAO,KAACC,gBAAgBF,SAAS;QAAE,GAAGC,WAAW;;AACnD,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/providers/Config/RenderComponent.tsx"],"sourcesContent":["import type { MappedComponent } from 'payload'\n\nimport { isReactServerComponentOrFunction } from 'payload/shared'\nimport React from 'react'\n\n/**\n * Can be used to render both MappedComponents and React Components.\n */\nexport const RenderComponent: React.FC<{\n readonly Component?: React.ComponentType | React.ComponentType[]\n readonly clientProps?: object\n readonly mappedComponent?: MappedComponent | MappedComponent[]\n readonly serverProps?: object\n}> = ({ Component, clientProps = {}, mappedComponent, serverProps }) => {\n if (!mappedComponent && Component) {\n if (Array.isArray(Component)) {\n return Component.map((c, index) => (\n <RenderComponent\n Component={c}\n clientProps={clientProps}\n key={index}\n serverProps={serverProps}\n />\n ))\n }\n\n const mappedComponent: MappedComponent = isReactServerComponentOrFunction(Component)\n ? {\n type: 'server',\n Component,\n RenderedComponent: null,\n }\n : {\n type: 'client',\n Component,\n }\n\n return (\n <RenderComponent\n clientProps={clientProps}\n mappedComponent={mappedComponent}\n serverProps={serverProps}\n />\n )\n }\n if (!mappedComponent) {\n return null\n }\n\n if (Array.isArray(mappedComponent)) {\n return mappedComponent.map((c, index) => (\n <RenderComponent\n clientProps={clientProps}\n key={index}\n mappedComponent={c}\n serverProps={serverProps}\n />\n ))\n }\n\n if (mappedComponent.type === 'empty') {\n return null\n }\n\n if (mappedComponent.RenderedComponent) {\n return mappedComponent.RenderedComponent\n }\n\n if (!mappedComponent.Component) {\n return null\n }\n\n if (mappedComponent.type === 'server') {\n if (mappedComponent.props) {\n return (\n <mappedComponent.Component {...mappedComponent.props} {...serverProps} {...clientProps} />\n )\n }\n\n return <mappedComponent.Component {...serverProps} {...clientProps} />\n }\n\n if (mappedComponent.props) {\n return <mappedComponent.Component {...mappedComponent.props} {...clientProps} />\n }\n\n return <mappedComponent.Component {...clientProps} />\n}\n"],"names":["isReactServerComponentOrFunction","React","RenderComponent","Component","clientProps","mappedComponent","serverProps","Array","isArray","map","c","index","type","RenderedComponent","props"],"mappings":";AAEA,SAASA,gCAAgC,QAAQ,iBAAgB;AACjE,OAAOC,WAAW,QAAO;AAEzB;;CAEC,GACD,OAAO,MAAMC,kBAKR,CAAC,EAAEC,SAAS,EAAEC,cAAc,CAAC,CAAC,EAAEC,eAAe,EAAEC,WAAW,EAAE;IACjE,IAAI,CAACD,mBAAmBF,WAAW;QACjC,IAAII,MAAMC,OAAO,CAACL,YAAY;YAC5B,OAAOA,UAAUM,GAAG,CAAC,CAACC,GAAGC,sBACvB,KAACT;oBACCC,WAAWO;oBACXN,aAAaA;oBAEbE,aAAaA;mBADRK;QAIX;QAEA,MAAMN,kBAAmCL,iCAAiCG,aACtE;YACES,MAAM;YACNT;YACAU,mBAAmB;QACrB,IACA;YACED,MAAM;YACNT;QACF;QAEJ,qBACE,KAACD;YACCE,aAAaA;YACbC,iBAAiBA;YACjBC,aAAaA;;IAGnB;IACA,IAAI,CAACD,iBAAiB;QACpB,OAAO;IACT;IAEA,IAAIE,MAAMC,OAAO,CAACH,kBAAkB;QAClC,OAAOA,gBAAgBI,GAAG,CAAC,CAACC,GAAGC,sBAC7B,KAACT;gBACCE,aAAaA;gBAEbC,iBAAiBK;gBACjBJ,aAAaA;eAFRK;IAKX;IAEA,IAAIN,gBAAgBO,IAAI,KAAK,SAAS;QACpC,OAAO;IACT;IAEA,IAAIP,gBAAgBQ,iBAAiB,EAAE;QACrC,OAAOR,gBAAgBQ,iBAAiB;IAC1C;IAEA,IAAI,CAACR,gBAAgBF,SAAS,EAAE;QAC9B,OAAO;IACT;IAEA,IAAIE,gBAAgBO,IAAI,KAAK,UAAU;QACrC,IAAIP,gBAAgBS,KAAK,EAAE;YACzB,qBACE,KAACT,gBAAgBF,SAAS;gBAAE,GAAGE,gBAAgBS,KAAK;gBAAG,GAAGR,WAAW;gBAAG,GAAGF,WAAW;;QAE1F;QAEA,qBAAO,KAACC,gBAAgBF,SAAS;YAAE,GAAGG,WAAW;YAAG,GAAGF,WAAW;;IACpE;IAEA,IAAIC,gBAAgBS,KAAK,EAAE;QACzB,qBAAO,KAACT,gBAAgBF,SAAS;YAAE,GAAGE,gBAAgBS,KAAK;YAAG,GAAGV,WAAW;;IAC9E;IAEA,qBAAO,KAACC,gBAAgBF,SAAS;QAAE,GAAGC,WAAW;;AACnD,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../../../src/providers/Config/createClientConfig/collections.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EAErB,aAAa,EACb,SAAS,EAET,OAAO,EACP,yBAAyB,EAG1B,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,eAAO,MAAM,4BAA4B,yHAStC;IACD,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,CAAA;IACxC,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,CAAA;IACzC,gBAAgB,EAAE,sBAAsB,CAAA;IACxC,UAAU,EAAE,yBAAyB,CAAA;IACrC,qBAAqB,EAAE,qBAAqB,CAAA;IAC5C,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;IACpB,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,
|
|
1
|
+
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../../../src/providers/Config/createClientConfig/collections.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EAErB,aAAa,EACb,SAAS,EAET,OAAO,EACP,yBAAyB,EAG1B,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,eAAO,MAAM,4BAA4B,yHAStC;IACD,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,CAAA;IACxC,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,CAAA;IACzC,gBAAgB,EAAE,sBAAsB,CAAA;IACxC,UAAU,EAAE,yBAAyB,CAAA;IACrC,qBAAqB,EAAE,qBAAqB,CAAA;IAC5C,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;IACpB,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,sBAyTH,CAAA;AAED,eAAO,MAAM,6BAA6B,2HASvC;IACD,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,CAAA;IACxC,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,CAAA;IACzC,iBAAiB,EAAE,sBAAsB,EAAE,CAAA;IAC3C,WAAW,EAAE,yBAAyB,EAAE,CAAA;IACxC,qBAAqB,EAAE,qBAAqB,CAAA;IAC5C,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;IACpB,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,sBAAsB,EAiBzB,CAAA"}
|
|
@@ -117,7 +117,7 @@ export const createClientCollectionConfig = ({ DefaultEditView, DefaultListView,
|
|
|
117
117
|
clientCollection.admin.components.views.edit = {};
|
|
118
118
|
}
|
|
119
119
|
clientCollection.admin.components.views.edit.default = {
|
|
120
|
-
Component: createMappedComponent(hasEditView && 'Component' in collection.admin.components.views.edit.default && collection.admin.components.views.edit.default.Component, {
|
|
120
|
+
Component: createMappedComponent(hasEditView && 'Component' in collection.admin.components.views.edit.default && collection.admin.components.views.edit.default.Component ? collection.admin.components.views.edit.default.Component : null, {
|
|
121
121
|
collectionSlug: collection.slug
|
|
122
122
|
}, DefaultEditView, 'collection.admin.components.views.edit.default')
|
|
123
123
|
};
|
|
@@ -141,7 +141,7 @@ export const createClientCollectionConfig = ({ DefaultEditView, DefaultListView,
|
|
|
141
141
|
if (!clientCollection.admin.components.views.list) {
|
|
142
142
|
clientCollection.admin.components.views.list = {};
|
|
143
143
|
}
|
|
144
|
-
clientCollection.admin.components.views.list.Component = createMappedComponent(hasListView && 'Component' in collection.admin.components.views.list && collection.admin.components.views.list.Component, {
|
|
144
|
+
clientCollection.admin.components.views.list.Component = createMappedComponent(hasListView && 'Component' in collection.admin.components.views.list && collection.admin.components.views.list.Component ? collection.admin.components.views.list.Component : null, {
|
|
145
145
|
collectionSlug: collection.slug
|
|
146
146
|
}, DefaultListView, 'collection.admin.components.views.list');
|
|
147
147
|
if (hasListView && 'actions' in collection.admin.components.views.list && collection.admin.components.views.list.actions) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/providers/Config/createClientConfig/collections.tsx"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type {\n AdminViewProps,\n ClientCollectionConfig,\n CreateMappedComponent,\n EditViewConfig,\n EditViewProps,\n ImportMap,\n MappedView,\n Payload,\n SanitizedCollectionConfig,\n ServerOnlyCollectionAdminProperties,\n ServerOnlyCollectionProperties,\n} from 'payload'\nimport type React from 'react'\n\nimport { deepCopyObjectSimple } from 'payload'\n\nimport { createClientFields } from './fields.js'\n\nexport const createClientCollectionConfig = ({\n DefaultEditView,\n DefaultListView,\n clientCollection,\n collection,\n createMappedComponent,\n i18n,\n importMap,\n payload,\n}: {\n DefaultEditView: React.FC<EditViewProps>\n DefaultListView: React.FC<AdminViewProps>\n clientCollection: ClientCollectionConfig\n collection: SanitizedCollectionConfig\n createMappedComponent: CreateMappedComponent\n i18n: I18nClient\n importMap: ImportMap\n payload: Payload\n}): ClientCollectionConfig => {\n clientCollection.fields = createClientFields({\n clientFields: clientCollection.fields,\n createMappedComponent,\n fields: collection.fields,\n i18n,\n importMap,\n payload,\n })\n\n const serverOnlyCollectionProperties: Partial<ServerOnlyCollectionProperties>[] = [\n 'hooks',\n 'access',\n 'endpoints',\n 'custom',\n // `upload`\n // `admin`\n // are all handled separately\n ]\n\n serverOnlyCollectionProperties.forEach((key) => {\n if (key in clientCollection) {\n delete clientCollection[key]\n }\n })\n\n if ('upload' in clientCollection && typeof clientCollection.upload === 'object') {\n delete clientCollection.upload.handlers\n delete clientCollection.upload.adminThumbnail\n delete clientCollection.upload.externalFileHeaderFilter\n delete clientCollection.upload.withMetadata\n\n if ('imageSizes' in clientCollection.upload && clientCollection.upload.imageSizes.length) {\n clientCollection.upload.imageSizes = clientCollection.upload.imageSizes.map((size) => {\n const sanitizedSize = { ...size }\n if ('generateImageName' in sanitizedSize) delete sanitizedSize.generateImageName\n return sanitizedSize\n })\n }\n }\n\n if ('auth' in clientCollection && typeof clientCollection.auth === 'object') {\n delete clientCollection.auth.strategies\n delete clientCollection.auth.forgotPassword\n delete clientCollection.auth.verify\n }\n\n if (collection.labels) {\n Object.entries(collection.labels).forEach(([labelType, collectionLabel]) => {\n if (typeof collectionLabel === 'function') {\n clientCollection.labels[labelType] = collectionLabel({ t: i18n.t })\n }\n })\n }\n\n const serverOnlyCollectionAdminProperties: Partial<ServerOnlyCollectionAdminProperties>[] = [\n 'hidden',\n 'preview',\n // `livePreview` is handled separately\n ]\n\n serverOnlyCollectionAdminProperties.forEach((key) => {\n if (key in clientCollection.admin) {\n delete clientCollection.admin[key]\n }\n })\n\n if (collection.admin.preview) {\n clientCollection._isPreviewEnabled = true\n }\n\n clientCollection.admin.components = {} as ClientCollectionConfig['admin']['components']\n\n if (collection?.admin?.components) {\n if (collection.admin.components?.edit) {\n clientCollection.admin.components.edit =\n {} as ClientCollectionConfig['admin']['components']['edit']\n\n if (collection.admin.components.edit?.PreviewButton) {\n clientCollection.admin.components.edit.PreviewButton = createMappedComponent(\n collection.admin.components.edit.PreviewButton,\n undefined,\n undefined,\n 'collection.admin.components.edit.PreviewButton',\n )\n }\n\n if (collection.admin.components.edit?.PublishButton) {\n clientCollection.admin.components.edit.PublishButton = createMappedComponent(\n collection.admin.components.edit.PublishButton,\n undefined,\n undefined,\n 'collection.admin.components.edit.PublishButton',\n )\n }\n\n if (collection.admin.components.edit?.SaveButton) {\n clientCollection.admin.components.edit.SaveButton = createMappedComponent(\n collection.admin.components.edit.SaveButton,\n undefined,\n undefined,\n 'collection.admin.components.edit.SaveButton',\n )\n }\n\n if (collection.admin.components.edit?.SaveDraftButton) {\n clientCollection.admin.components.edit.SaveDraftButton = createMappedComponent(\n collection.admin.components.edit.SaveDraftButton,\n undefined,\n undefined,\n 'collection.admin.components.edit.SaveDraftButton',\n )\n }\n\n if (collection.admin.components.edit?.Upload) {\n clientCollection.admin.components.edit.Upload = createMappedComponent(\n collection.admin.components.edit.Upload,\n undefined,\n undefined,\n 'collection.admin.components.edit.Upload',\n )\n }\n }\n\n if (collection.admin.components?.beforeList) {\n clientCollection.admin.components.beforeList = collection.admin.components.beforeList.map(\n (Component) =>\n createMappedComponent(\n Component,\n undefined,\n undefined,\n 'collection.admin.components.beforeList',\n ),\n )\n }\n\n if (collection.admin.components?.beforeListTable) {\n clientCollection.admin.components.beforeListTable =\n collection.admin.components.beforeListTable.map((Component) =>\n createMappedComponent(\n Component,\n undefined,\n undefined,\n 'collection.admin.components.beforeListTable',\n ),\n )\n }\n\n if (collection.admin.components?.afterList) {\n clientCollection.admin.components.afterList = collection.admin.components.afterList.map(\n (Component) =>\n createMappedComponent(\n Component,\n undefined,\n undefined,\n 'collection.admin.components.afterList',\n ),\n )\n }\n\n if (collection.admin.components?.afterListTable) {\n clientCollection.admin.components.afterListTable =\n collection.admin.components.afterListTable.map((Component) =>\n createMappedComponent(\n Component,\n undefined,\n undefined,\n 'collection.admin.components.afterListTable',\n ),\n )\n }\n }\n\n let description = undefined\n if (collection.admin?.description) {\n if (\n typeof collection.admin?.description === 'string' ||\n typeof collection.admin?.description === 'object'\n ) {\n description = collection.admin.description\n } else if (typeof collection.admin?.description === 'function') {\n description = collection.admin?.description({ t: i18n.t })\n }\n }\n clientCollection.admin.description = description\n\n if (collection.admin.components.edit?.Description) {\n clientCollection.admin.components.edit.Description = createMappedComponent(\n collection.admin.components.edit.Description,\n {\n description,\n },\n undefined,\n 'collection.admin.components.edit.Description',\n )\n }\n\n clientCollection.admin.description = description\n\n clientCollection.admin.components.views = (\n collection?.admin?.components?.views\n ? deepCopyObjectSimple(collection?.admin?.components?.views)\n : {}\n ) as ClientCollectionConfig['admin']['components']['views']\n\n const hasEditView =\n 'admin' in collection &&\n 'components' in collection.admin &&\n 'views' in collection.admin.components &&\n 'edit' in collection.admin.components.views &&\n 'default' in collection.admin.components.views.edit\n\n if (!clientCollection.admin.components.views.edit) {\n clientCollection.admin.components.views.edit =\n {} as ClientCollectionConfig['admin']['components']['views']['edit']\n }\n\n clientCollection.admin.components.views.edit.default = {\n Component: createMappedComponent(\n hasEditView &&\n 'Component' in collection.admin.components.views.edit.default &&\n collection.admin.components.views.edit.default.Component,\n {\n collectionSlug: collection.slug,\n },\n DefaultEditView,\n 'collection.admin.components.views.edit.default',\n ),\n }\n\n if (collection?.admin?.components?.views?.edit) {\n for (const key in collection.admin.components.views.edit) {\n const view: EditViewConfig = collection.admin.components.views.edit[key]\n\n if (!clientCollection.admin.components.views.edit[key]) {\n clientCollection.admin.components.views.edit[key] = {} as MappedView\n }\n\n if ('Component' in view && key !== 'default') {\n clientCollection.admin.components.views.edit[key].Component = createMappedComponent(\n view.Component,\n {\n collectionSlug: collection.slug,\n },\n undefined,\n 'collection.admin.components.views.edit.key.Component',\n )\n }\n\n if ('actions' in view && view.actions?.length) {\n clientCollection.admin.components.views.edit[key].actions = view.actions.map((Component) =>\n createMappedComponent(\n Component,\n undefined,\n undefined,\n 'collection.admin.components.views.key.admin',\n ),\n )\n }\n }\n }\n\n const hasListView =\n 'admin' in collection &&\n 'components' in collection.admin &&\n 'views' in collection.admin.components &&\n 'list' in collection.admin.components.views\n\n if (!clientCollection.admin.components.views.list) {\n clientCollection.admin.components.views.list =\n {} as ClientCollectionConfig['admin']['components']['views']['list']\n }\n\n clientCollection.admin.components.views.list.Component = createMappedComponent(\n hasListView &&\n 'Component' in collection.admin.components.views.list &&\n collection.admin.components.views.list.Component,\n {\n collectionSlug: collection.slug,\n },\n DefaultListView,\n 'collection.admin.components.views.list',\n )\n\n if (\n hasListView &&\n 'actions' in collection.admin.components.views.list &&\n collection.admin.components.views.list.actions\n ) {\n clientCollection.admin.components.views.list.actions =\n collection.admin.components.views.list.actions.map((Component) =>\n createMappedComponent(\n Component,\n undefined,\n undefined,\n 'collection.admin.components.views.list',\n ),\n )\n }\n\n if (\n 'livePreview' in clientCollection.admin &&\n clientCollection.admin.livePreview &&\n 'url' in clientCollection.admin.livePreview\n ) {\n delete clientCollection.admin.livePreview.url\n }\n\n return clientCollection\n}\n\nexport const createClientCollectionConfigs = ({\n DefaultEditView,\n DefaultListView,\n clientCollections,\n collections,\n createMappedComponent,\n i18n,\n importMap,\n payload,\n}: {\n DefaultEditView: React.FC<EditViewProps>\n DefaultListView: React.FC<AdminViewProps>\n clientCollections: ClientCollectionConfig[]\n collections: SanitizedCollectionConfig[]\n createMappedComponent: CreateMappedComponent\n i18n: I18nClient\n importMap: ImportMap\n payload: Payload\n}): ClientCollectionConfig[] => {\n for (let i = 0; i < collections.length; i++) {\n const collection = collections[i]\n const clientCollection = clientCollections[i]\n clientCollections[i] = createClientCollectionConfig({\n DefaultEditView,\n DefaultListView,\n clientCollection,\n collection,\n createMappedComponent,\n i18n,\n importMap,\n payload,\n })\n }\n\n return clientCollections\n}\n"],"names":["deepCopyObjectSimple","createClientFields","createClientCollectionConfig","DefaultEditView","DefaultListView","clientCollection","collection","createMappedComponent","i18n","importMap","payload","fields","clientFields","serverOnlyCollectionProperties","forEach","key","upload","handlers","adminThumbnail","externalFileHeaderFilter","withMetadata","imageSizes","length","map","size","sanitizedSize","generateImageName","auth","strategies","forgotPassword","verify","labels","Object","entries","labelType","collectionLabel","t","serverOnlyCollectionAdminProperties","admin","preview","_isPreviewEnabled","components","edit","PreviewButton","undefined","PublishButton","SaveButton","SaveDraftButton","Upload","beforeList","Component","beforeListTable","afterList","afterListTable","description","Description","views","hasEditView","default","collectionSlug","slug","view","actions","hasListView","list","livePreview","url","createClientCollectionConfigs","clientCollections","collections","i"],"mappings":"AAgBA,SAASA,oBAAoB,QAAQ,UAAS;AAE9C,SAASC,kBAAkB,QAAQ,cAAa;AAEhD,OAAO,MAAMC,+BAA+B,CAAC,EAC3CC,eAAe,EACfC,eAAe,EACfC,gBAAgB,EAChBC,UAAU,EACVC,qBAAqB,EACrBC,IAAI,EACJC,SAAS,EACTC,OAAO,EAUR;IACCL,iBAAiBM,MAAM,GAAGV,mBAAmB;QAC3CW,cAAcP,iBAAiBM,MAAM;QACrCJ;QACAI,QAAQL,WAAWK,MAAM;QACzBH;QACAC;QACAC;IACF;IAEA,MAAMG,iCAA4E;QAChF;QACA;QACA;QACA;KAID;IAEDA,+BAA+BC,OAAO,CAAC,CAACC;QACtC,IAAIA,OAAOV,kBAAkB;YAC3B,OAAOA,gBAAgB,CAACU,IAAI;QAC9B;IACF;IAEA,IAAI,YAAYV,oBAAoB,OAAOA,iBAAiBW,MAAM,KAAK,UAAU;QAC/E,OAAOX,iBAAiBW,MAAM,CAACC,QAAQ;QACvC,OAAOZ,iBAAiBW,MAAM,CAACE,cAAc;QAC7C,OAAOb,iBAAiBW,MAAM,CAACG,wBAAwB;QACvD,OAAOd,iBAAiBW,MAAM,CAACI,YAAY;QAE3C,IAAI,gBAAgBf,iBAAiBW,MAAM,IAAIX,iBAAiBW,MAAM,CAACK,UAAU,CAACC,MAAM,EAAE;YACxFjB,iBAAiBW,MAAM,CAACK,UAAU,GAAGhB,iBA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,CAACG,UAAU,CAACe,KAAK,CAACQ,IAAI,IACnD1D,WAAWgC,KAAK,CAACG,UAAU,CAACe,KAAK,CAACQ,IAAI,CAACF,OAAO,EAC9C;QACAzD,iBAAiBiC,KAAK,CAACG,UAAU,CAACe,KAAK,CAACQ,IAAI,CAACF,OAAO,GAClDxD,WAAWgC,KAAK,CAACG,UAAU,CAACe,KAAK,CAACQ,IAAI,CAACF,OAAO,CAACvC,GAAG,CAAC,CAAC2B,YAClD3C,sBACE2C,WACAN,WACAA,WACA;IAGR;IAEA,IACE,iBAAiBvC,iBAAiBiC,KAAK,IACvCjC,iBAAiBiC,KAAK,CAAC2B,WAAW,IAClC,SAAS5D,iBAAiBiC,KAAK,CAAC2B,WAAW,EAC3C;QACA,OAAO5D,iBAAiBiC,KAAK,CAAC2B,WAAW,CAACC,GAAG;IAC/C;IAEA,OAAO7D;AACT,EAAC;AAED,OAAO,MAAM8D,gCAAgC,CAAC,EAC5ChE,eAAe,EACfC,eAAe,EACfgE,iBAAiB,EACjBC,WAAW,EACX9D,qBAAqB,EACrBC,IAAI,EACJC,SAAS,EACTC,OAAO,EAUR;IACC,IAAK,IAAI4D,IAAI,GAAGA,IAAID,YAAY/C,MAAM,EAAEgD,IAAK;QAC3C,MAAMhE,aAAa+D,WAAW,CAACC,EAAE;QACjC,MAAMjE,mBAAmB+D,iBAAiB,CAACE,EAAE;QAC7CF,iBAAiB,CAACE,EAAE,GAAGpE,6BAA6B;YAClDC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;QACF;IACF;IAEA,OAAO0D;AACT,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/providers/Config/createClientConfig/collections.tsx"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type {\n AdminViewProps,\n ClientCollectionConfig,\n CreateMappedComponent,\n EditViewConfig,\n EditViewProps,\n ImportMap,\n MappedView,\n Payload,\n SanitizedCollectionConfig,\n ServerOnlyCollectionAdminProperties,\n ServerOnlyCollectionProperties,\n} from 'payload'\nimport type React from 'react'\n\nimport { deepCopyObjectSimple } from 'payload'\n\nimport { createClientFields } from './fields.js'\n\nexport const createClientCollectionConfig = ({\n DefaultEditView,\n DefaultListView,\n clientCollection,\n collection,\n createMappedComponent,\n i18n,\n importMap,\n payload,\n}: {\n DefaultEditView: React.FC<EditViewProps>\n DefaultListView: React.FC<AdminViewProps>\n clientCollection: ClientCollectionConfig\n collection: SanitizedCollectionConfig\n createMappedComponent: CreateMappedComponent\n i18n: I18nClient\n importMap: ImportMap\n payload: Payload\n}): ClientCollectionConfig => {\n clientCollection.fields = createClientFields({\n clientFields: clientCollection.fields,\n createMappedComponent,\n fields: collection.fields,\n i18n,\n importMap,\n payload,\n })\n\n const serverOnlyCollectionProperties: Partial<ServerOnlyCollectionProperties>[] = [\n 'hooks',\n 'access',\n 'endpoints',\n 'custom',\n // `upload`\n // `admin`\n // are all handled separately\n ]\n\n serverOnlyCollectionProperties.forEach((key) => {\n if (key in clientCollection) {\n delete clientCollection[key]\n }\n })\n\n if ('upload' in clientCollection && typeof clientCollection.upload === 'object') {\n delete clientCollection.upload.handlers\n delete clientCollection.upload.adminThumbnail\n delete clientCollection.upload.externalFileHeaderFilter\n delete clientCollection.upload.withMetadata\n\n if ('imageSizes' in clientCollection.upload && clientCollection.upload.imageSizes.length) {\n clientCollection.upload.imageSizes = clientCollection.upload.imageSizes.map((size) => {\n const sanitizedSize = { ...size }\n if ('generateImageName' in sanitizedSize) delete sanitizedSize.generateImageName\n return sanitizedSize\n })\n }\n }\n\n if ('auth' in clientCollection && typeof clientCollection.auth === 'object') {\n delete clientCollection.auth.strategies\n delete clientCollection.auth.forgotPassword\n delete clientCollection.auth.verify\n }\n\n if (collection.labels) {\n Object.entries(collection.labels).forEach(([labelType, collectionLabel]) => {\n if (typeof collectionLabel === 'function') {\n clientCollection.labels[labelType] = collectionLabel({ t: i18n.t })\n }\n })\n }\n\n const serverOnlyCollectionAdminProperties: Partial<ServerOnlyCollectionAdminProperties>[] = [\n 'hidden',\n 'preview',\n // `livePreview` is handled separately\n ]\n\n serverOnlyCollectionAdminProperties.forEach((key) => {\n if (key in clientCollection.admin) {\n delete clientCollection.admin[key]\n }\n })\n\n if (collection.admin.preview) {\n clientCollection._isPreviewEnabled = true\n }\n\n clientCollection.admin.components = {} as ClientCollectionConfig['admin']['components']\n\n if (collection?.admin?.components) {\n if (collection.admin.components?.edit) {\n clientCollection.admin.components.edit =\n {} as ClientCollectionConfig['admin']['components']['edit']\n\n if (collection.admin.components.edit?.PreviewButton) {\n clientCollection.admin.components.edit.PreviewButton = createMappedComponent(\n collection.admin.components.edit.PreviewButton,\n undefined,\n undefined,\n 'collection.admin.components.edit.PreviewButton',\n )\n }\n\n if (collection.admin.components.edit?.PublishButton) {\n clientCollection.admin.components.edit.PublishButton = createMappedComponent(\n collection.admin.components.edit.PublishButton,\n undefined,\n undefined,\n 'collection.admin.components.edit.PublishButton',\n )\n }\n\n if (collection.admin.components.edit?.SaveButton) {\n clientCollection.admin.components.edit.SaveButton = createMappedComponent(\n collection.admin.components.edit.SaveButton,\n undefined,\n undefined,\n 'collection.admin.components.edit.SaveButton',\n )\n }\n\n if (collection.admin.components.edit?.SaveDraftButton) {\n clientCollection.admin.components.edit.SaveDraftButton = createMappedComponent(\n collection.admin.components.edit.SaveDraftButton,\n undefined,\n undefined,\n 'collection.admin.components.edit.SaveDraftButton',\n )\n }\n\n if (collection.admin.components.edit?.Upload) {\n clientCollection.admin.components.edit.Upload = createMappedComponent(\n collection.admin.components.edit.Upload,\n undefined,\n undefined,\n 'collection.admin.components.edit.Upload',\n )\n }\n }\n\n if (collection.admin.components?.beforeList) {\n clientCollection.admin.components.beforeList = collection.admin.components.beforeList.map(\n (Component) =>\n createMappedComponent(\n Component,\n undefined,\n undefined,\n 'collection.admin.components.beforeList',\n ),\n )\n }\n\n if (collection.admin.components?.beforeListTable) {\n clientCollection.admin.components.beforeListTable =\n collection.admin.components.beforeListTable.map((Component) =>\n createMappedComponent(\n Component,\n undefined,\n undefined,\n 'collection.admin.components.beforeListTable',\n ),\n )\n }\n\n if (collection.admin.components?.afterList) {\n clientCollection.admin.components.afterList = collection.admin.components.afterList.map(\n (Component) =>\n createMappedComponent(\n Component,\n undefined,\n undefined,\n 'collection.admin.components.afterList',\n ),\n )\n }\n\n if (collection.admin.components?.afterListTable) {\n clientCollection.admin.components.afterListTable =\n collection.admin.components.afterListTable.map((Component) =>\n createMappedComponent(\n Component,\n undefined,\n undefined,\n 'collection.admin.components.afterListTable',\n ),\n )\n }\n }\n\n let description = undefined\n if (collection.admin?.description) {\n if (\n typeof collection.admin?.description === 'string' ||\n typeof collection.admin?.description === 'object'\n ) {\n description = collection.admin.description\n } else if (typeof collection.admin?.description === 'function') {\n description = collection.admin?.description({ t: i18n.t })\n }\n }\n clientCollection.admin.description = description\n\n if (collection.admin.components.edit?.Description) {\n clientCollection.admin.components.edit.Description = createMappedComponent(\n collection.admin.components.edit.Description,\n {\n description,\n },\n undefined,\n 'collection.admin.components.edit.Description',\n )\n }\n\n clientCollection.admin.description = description\n\n clientCollection.admin.components.views = (\n collection?.admin?.components?.views\n ? deepCopyObjectSimple(collection?.admin?.components?.views)\n : {}\n ) as ClientCollectionConfig['admin']['components']['views']\n\n const hasEditView =\n 'admin' in collection &&\n 'components' in collection.admin &&\n 'views' in collection.admin.components &&\n 'edit' in collection.admin.components.views &&\n 'default' in collection.admin.components.views.edit\n\n if (!clientCollection.admin.components.views.edit) {\n clientCollection.admin.components.views.edit =\n {} as ClientCollectionConfig['admin']['components']['views']['edit']\n }\n\n clientCollection.admin.components.views.edit.default = {\n Component: createMappedComponent(\n hasEditView &&\n 'Component' in collection.admin.components.views.edit.default &&\n collection.admin.components.views.edit.default.Component\n ? collection.admin.components.views.edit.default.Component\n : null,\n {\n collectionSlug: collection.slug,\n },\n DefaultEditView,\n 'collection.admin.components.views.edit.default',\n ),\n }\n\n if (collection?.admin?.components?.views?.edit) {\n for (const key in collection.admin.components.views.edit) {\n const view: EditViewConfig = collection.admin.components.views.edit[key]\n\n if (!clientCollection.admin.components.views.edit[key]) {\n clientCollection.admin.components.views.edit[key] = {} as MappedView\n }\n\n if ('Component' in view && key !== 'default') {\n clientCollection.admin.components.views.edit[key].Component = createMappedComponent(\n view.Component,\n {\n collectionSlug: collection.slug,\n },\n undefined,\n 'collection.admin.components.views.edit.key.Component',\n )\n }\n\n if ('actions' in view && view.actions?.length) {\n clientCollection.admin.components.views.edit[key].actions = view.actions.map((Component) =>\n createMappedComponent(\n Component,\n undefined,\n undefined,\n 'collection.admin.components.views.key.admin',\n ),\n )\n }\n }\n }\n\n const hasListView =\n 'admin' in collection &&\n 'components' in collection.admin &&\n 'views' in collection.admin.components &&\n 'list' in collection.admin.components.views\n\n if (!clientCollection.admin.components.views.list) {\n clientCollection.admin.components.views.list =\n {} as ClientCollectionConfig['admin']['components']['views']['list']\n }\n\n clientCollection.admin.components.views.list.Component = createMappedComponent(\n hasListView &&\n 'Component' in collection.admin.components.views.list &&\n collection.admin.components.views.list.Component\n ? collection.admin.components.views.list.Component\n : null,\n {\n collectionSlug: collection.slug,\n },\n DefaultListView,\n 'collection.admin.components.views.list',\n )\n\n if (\n hasListView &&\n 'actions' in collection.admin.components.views.list &&\n collection.admin.components.views.list.actions\n ) {\n clientCollection.admin.components.views.list.actions =\n collection.admin.components.views.list.actions.map((Component) =>\n createMappedComponent(\n Component,\n undefined,\n undefined,\n 'collection.admin.components.views.list',\n ),\n )\n }\n\n if (\n 'livePreview' in clientCollection.admin &&\n clientCollection.admin.livePreview &&\n 'url' in clientCollection.admin.livePreview\n ) {\n delete clientCollection.admin.livePreview.url\n }\n\n return clientCollection\n}\n\nexport const createClientCollectionConfigs = ({\n DefaultEditView,\n DefaultListView,\n clientCollections,\n collections,\n createMappedComponent,\n i18n,\n importMap,\n payload,\n}: {\n DefaultEditView: React.FC<EditViewProps>\n DefaultListView: React.FC<AdminViewProps>\n clientCollections: ClientCollectionConfig[]\n collections: SanitizedCollectionConfig[]\n createMappedComponent: CreateMappedComponent\n i18n: I18nClient\n importMap: ImportMap\n payload: Payload\n}): ClientCollectionConfig[] => {\n for (let i = 0; i < collections.length; i++) {\n const collection = collections[i]\n const clientCollection = clientCollections[i]\n clientCollections[i] = createClientCollectionConfig({\n DefaultEditView,\n DefaultListView,\n clientCollection,\n collection,\n createMappedComponent,\n i18n,\n importMap,\n payload,\n })\n }\n\n return clientCollections\n}\n"],"names":["deepCopyObjectSimple","createClientFields","createClientCollectionConfig","DefaultEditView","DefaultListView","clientCollection","collection","createMappedComponent","i18n","importMap","payload","fields","clientFields","serverOnlyCollectionProperties","forEach","key","upload","handlers","adminThumbnail","externalFileHeaderFilter","withMetadata","imageSizes","length","map","size","sanitizedSize","generateImageName","auth","strategies","forgotPassword","verify","labels","Object","entries","labelType","collectionLabel","t","serverOnlyCollectionAdminProperties","admin","preview","_isPreviewEnabled","components","edit","PreviewButton","undefined","PublishButton","SaveButton","SaveDraftButton","Upload","beforeList","Component","beforeListTable","afterList","afterListTable","description","Description","views","hasEditView","default","collectionSlug","slug","view","actions","hasListView","list","livePreview","url","createClientCollectionConfigs","clientCollections","collections","i"],"mappings":"AAgBA,SAASA,oBAAoB,QAAQ,UAAS;AAE9C,SAASC,kBAAkB,QAAQ,cAAa;AAEhD,OAAO,MAAMC,+BAA+B,CAAC,EAC3CC,eAAe,EACfC,eAAe,EACfC,gBAAgB,EAChBC,UAAU,EACVC,qBAAqB,EACrBC,IAAI,EACJC,SAAS,EACTC,OAAO,EAUR;IACCL,iBAAiBM,MAAM,GAAGV,mBAAmB;QAC3CW,cAAcP,iBAAiBM,MAAM;QACrCJ;QACAI,QAAQL,WAAWK,MAAM;QACzBH;QACAC;QACAC;IACF;IAEA,MAAMG,iCAA4E;QAChF;QACA;QACA;QACA;KAID;IAEDA,+BAA+BC,OAAO,CAAC,CAACC;QACtC,IAAIA,OAAOV,kBAAkB;YAC3B,OAAOA,gBAAgB,CAACU,IAAI;QAC9B;IACF;IAEA,IAA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IACC,IAAK,IAAI4D,IAAI,GAAGA,IAAID,YAAY/C,MAAM,EAAEgD,IAAK;QAC3C,MAAMhE,aAAa+D,WAAW,CAACC,EAAE;QACjC,MAAMjE,mBAAmB+D,iBAAiB,CAACE,EAAE;QAC7CF,iBAAiB,CAACE,EAAE,GAAGpE,6BAA6B;YAClDC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;QACF;IACF;IAEA,OAAO0D;AACT,EAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ImportMap, PayloadComponent, ResolvedComponent } from 'payload';
|
|
2
2
|
/**
|
|
3
|
-
* Gets
|
|
3
|
+
* Gets the resolved React component from `PayloadComponent` from the importMap
|
|
4
4
|
*/
|
|
5
5
|
export declare const getComponent: <TComponentServerProps extends object, TComponentClientProps extends object>({ identifier, importMap, payloadComponent, silent, }: {
|
|
6
6
|
identifier?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getComponent.d.ts","sourceRoot":"","sources":["../../../../src/providers/Config/createClientConfig/getComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAI7E;;GAEG;AACH,eAAO,MAAM,YAAY,GACvB,qBAAqB,SAAS,MAAM,EACpC,qBAAqB,SAAS,MAAM,wDAMnC;IACD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,SAAS,CAAA;IACpB,gBAAgB,EACZ,gBAAgB,CAAC,qBAAqB,EAAE,qBAAqB,CAAC,GAC9D,IAAI,GACJ,SAAS,CAAA;IACb,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,KAAG,iBAAiB,CAAC,qBAAqB,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"getComponent.d.ts","sourceRoot":"","sources":["../../../../src/providers/Config/createClientConfig/getComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAI7E;;GAEG;AACH,eAAO,MAAM,YAAY,GACvB,qBAAqB,SAAS,MAAM,EACpC,qBAAqB,SAAS,MAAM,wDAMnC;IACD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,SAAS,CAAA;IACpB,gBAAgB,EACZ,gBAAgB,CAAC,qBAAqB,EAAE,qBAAqB,CAAC,GAC9D,IAAI,GACJ,SAAS,CAAA;IACb,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,KAAG,iBAAiB,CAAC,qBAAqB,EAAE,qBAAqB,CAuCjE,CAAA"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { parsePayloadComponent } from 'payload/shared';
|
|
2
2
|
/**
|
|
3
|
-
* Gets
|
|
3
|
+
* Gets the resolved React component from `PayloadComponent` from the importMap
|
|
4
4
|
*/ export const getComponent = ({ identifier, importMap, payloadComponent, silent })=>{
|
|
5
5
|
if (!payloadComponent) {
|
|
6
|
+
// undefined, null or false
|
|
6
7
|
return {
|
|
7
8
|
Component: undefined,
|
|
8
9
|
clientProps: undefined,
|
|
@@ -17,7 +18,7 @@ import { parsePayloadComponent } from 'payload/shared';
|
|
|
17
18
|
identifier,
|
|
18
19
|
key,
|
|
19
20
|
payloadComponent
|
|
20
|
-
});
|
|
21
|
+
}, 'You may need to run the `payload generate:importmap` command to generate the importMap ahead of runtime.');
|
|
21
22
|
}
|
|
22
23
|
return {
|
|
23
24
|
Component,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/providers/Config/createClientConfig/getComponent.ts"],"sourcesContent":["import type { ImportMap, PayloadComponent, ResolvedComponent } from 'payload'\n\nimport { parsePayloadComponent } from 'payload/shared'\n\n/**\n * Gets
|
|
1
|
+
{"version":3,"sources":["../../../../src/providers/Config/createClientConfig/getComponent.ts"],"sourcesContent":["import type { ImportMap, PayloadComponent, ResolvedComponent } from 'payload'\n\nimport { parsePayloadComponent } from 'payload/shared'\n\n/**\n * Gets the resolved React component from `PayloadComponent` from the importMap\n */\nexport const getComponent = <\n TComponentServerProps extends object,\n TComponentClientProps extends object,\n>({\n identifier,\n importMap,\n payloadComponent,\n silent,\n}: {\n identifier?: string\n importMap: ImportMap\n payloadComponent:\n | PayloadComponent<TComponentServerProps, TComponentClientProps>\n | null\n | undefined\n silent?: boolean\n}): ResolvedComponent<TComponentServerProps, TComponentClientProps> => {\n if (!payloadComponent) {\n // undefined, null or false\n return {\n Component: undefined,\n clientProps: undefined,\n serverProps: undefined,\n }\n }\n\n const { exportName, path } = parsePayloadComponent(payloadComponent)\n\n const key = path + '#' + exportName\n\n const Component = importMap[key]\n\n if (!Component && !silent) {\n console.error(\n `getComponent: Component not found in importMap`,\n {\n identifier,\n key,\n payloadComponent,\n },\n 'You may need to run the `payload generate:importmap` command to generate the importMap ahead of runtime.',\n )\n }\n\n return {\n Component,\n clientProps:\n typeof payloadComponent === 'object'\n ? (payloadComponent.clientProps as TComponentClientProps)\n : undefined,\n serverProps:\n typeof payloadComponent === 'object'\n ? (payloadComponent.serverProps as TComponentServerProps)\n : undefined,\n }\n}\n"],"names":["parsePayloadComponent","getComponent","identifier","importMap","payloadComponent","silent","Component","undefined","clientProps","serverProps","exportName","path","key","console","error"],"mappings":"AAEA,SAASA,qBAAqB,QAAQ,iBAAgB;AAEtD;;CAEC,GACD,OAAO,MAAMC,eAAe,CAG1B,EACAC,UAAU,EACVC,SAAS,EACTC,gBAAgB,EAChBC,MAAM,EASP;IACC,IAAI,CAACD,kBAAkB;QACrB,2BAA2B;QAC3B,OAAO;YACLE,WAAWC;YACXC,aAAaD;YACbE,aAAaF;QACf;IACF;IAEA,MAAM,EAAEG,UAAU,EAAEC,IAAI,EAAE,GAAGX,sBAAsBI;IAEnD,MAAMQ,MAAMD,OAAO,MAAMD;IAEzB,MAAMJ,YAAYH,SAAS,CAACS,IAAI;IAEhC,IAAI,CAACN,aAAa,CAACD,QAAQ;QACzBQ,QAAQC,KAAK,CACX,CAAC,8CAA8C,CAAC,EAChD;YACEZ;YACAU;YACAR;QACF,GACA;IAEJ;IAEA,OAAO;QACLE;QACAE,aACE,OAAOJ,qBAAqB,WACvBA,iBAAiBI,WAAW,GAC7BD;QACNE,aACE,OAAOL,qBAAqB,WACvBA,iBAAiBK,WAAW,GAC7BF;IACR;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCreateMappedComponent.d.ts","sourceRoot":"","sources":["../../../../src/providers/Config/createClientConfig/getCreateMappedComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EACV,qBAAqB,EACrB,SAAS,EAGT,OAAO,EAER,MAAM,SAAS,CAAA;AAOhB,wBAAgB,wBAAwB,CAAC,EACvC,SAAS,EACT,WAAW,GACZ,EAAE;IACD,SAAS,EAAE,SAAS,CAAA;IACpB,WAAW,EAAE;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;QAClB,IAAI,CAAC,EAAE,UAAU,CAAA;QACjB,OAAO,CAAC,EAAE,OAAO,CAAA;KAClB,CAAA;CACF,GAAG,qBAAqB,
|
|
1
|
+
{"version":3,"file":"getCreateMappedComponent.d.ts","sourceRoot":"","sources":["../../../../src/providers/Config/createClientConfig/getCreateMappedComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EACV,qBAAqB,EACrB,SAAS,EAGT,OAAO,EAER,MAAM,SAAS,CAAA;AAOhB,wBAAgB,wBAAwB,CAAC,EACvC,SAAS,EACT,WAAW,GACZ,EAAE;IACD,SAAS,EAAE,SAAS,CAAA;IACpB,WAAW,EAAE;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;QAClB,IAAI,CAAC,EAAE,UAAU,CAAA;QACjB,OAAO,CAAC,EAAE,OAAO,CAAA;KAClB,CAAA;CACF,GAAG,qBAAqB,CAuHxB"}
|
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import { getComponent } from './getComponent.js';
|
|
5
5
|
export function getCreateMappedComponent({ importMap, serverProps }) {
|
|
6
6
|
const createSingleMappedComponent = (payloadComponent, key, props, Fallback, identifier)=>{
|
|
7
|
-
if (
|
|
7
|
+
if (payloadComponent === undefined || payloadComponent === null) {
|
|
8
8
|
if (!Fallback) {
|
|
9
9
|
return undefined;
|
|
10
10
|
}
|
|
@@ -27,6 +27,11 @@ export function getCreateMappedComponent({ importMap, serverProps }) {
|
|
|
27
27
|
return toReturn;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
+
if (payloadComponent === false) {
|
|
31
|
+
return {
|
|
32
|
+
type: 'empty'
|
|
33
|
+
};
|
|
34
|
+
}
|
|
30
35
|
const resolvedComponent = payloadComponent && typeof payloadComponent === 'object' && 'ReactComponent' in payloadComponent ? {
|
|
31
36
|
Component: payloadComponent.ReactComponent
|
|
32
37
|
} : getComponent({
|
|
@@ -66,7 +71,7 @@ export function getCreateMappedComponent({ importMap, serverProps }) {
|
|
|
66
71
|
}
|
|
67
72
|
};
|
|
68
73
|
const createMappedComponent = (payloadComponent, props, fallback, identifier)=>{
|
|
69
|
-
if (
|
|
74
|
+
if ((payloadComponent === undefined || payloadComponent === null) && !fallback) {
|
|
70
75
|
return undefined;
|
|
71
76
|
}
|
|
72
77
|
if (payloadComponent && Array.isArray(payloadComponent)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/providers/Config/createClientConfig/getCreateMappedComponent.tsx"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type {\n CreateMappedComponent,\n ImportMap,\n JsonObject,\n MappedComponent,\n Payload,\n PayloadComponent,\n} from 'payload'\n\nimport { isReactServerComponentOrFunction } from 'payload/shared'\nimport React from 'react'\n\nimport { getComponent } from './getComponent.js'\n\nexport function getCreateMappedComponent({\n importMap,\n serverProps,\n}: {\n importMap: ImportMap\n serverProps: {\n [key: string]: any\n i18n?: I18nClient\n payload?: Payload\n }\n}): CreateMappedComponent {\n const createSingleMappedComponent = (\n payloadComponent: { ReactComponent: React.FC<any> } | PayloadComponent,\n key: number | string,\n props: JsonObject,\n Fallback: React.FC<any>,\n identifier: string,\n ): MappedComponent => {\n if (
|
|
1
|
+
{"version":3,"sources":["../../../../src/providers/Config/createClientConfig/getCreateMappedComponent.tsx"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type {\n CreateMappedComponent,\n ImportMap,\n JsonObject,\n MappedComponent,\n Payload,\n PayloadComponent,\n} from 'payload'\n\nimport { isReactServerComponentOrFunction } from 'payload/shared'\nimport React from 'react'\n\nimport { getComponent } from './getComponent.js'\n\nexport function getCreateMappedComponent({\n importMap,\n serverProps,\n}: {\n importMap: ImportMap\n serverProps: {\n [key: string]: any\n i18n?: I18nClient\n payload?: Payload\n }\n}): CreateMappedComponent {\n const createSingleMappedComponent = (\n payloadComponent: { ReactComponent: React.FC<any> } | PayloadComponent,\n key: number | string,\n props: JsonObject,\n Fallback: React.FC<any>,\n identifier: string,\n ): MappedComponent => {\n if (payloadComponent === undefined || payloadComponent === null) {\n if (!Fallback) {\n return undefined\n }\n\n if (isReactServerComponentOrFunction(Fallback)) {\n return {\n type: 'server',\n Component: null,\n RenderedComponent: <Fallback key={key} {...serverProps} {...props} />,\n }\n } else {\n const toReturn: MappedComponent = {\n type: 'client',\n Component: Fallback,\n }\n\n // conditionally set props here to avoid bloating the HTML with `$undefined` props\n if (props) toReturn.props = props\n\n return toReturn\n }\n }\n\n if (payloadComponent === false) {\n return {\n type: 'empty',\n }\n }\n\n const resolvedComponent =\n payloadComponent &&\n typeof payloadComponent === 'object' &&\n 'ReactComponent' in payloadComponent\n ? {\n Component: payloadComponent.ReactComponent,\n }\n : getComponent({\n identifier,\n importMap,\n payloadComponent: payloadComponent as any,\n })\n\n if (!resolvedComponent.Component) {\n console.error(`getCreateMappedComponent: Component not found in importMap`, {\n identifier,\n key,\n })\n }\n\n if (isReactServerComponentOrFunction(resolvedComponent.Component)) {\n const Component: React.FC<any> = resolvedComponent.Component\n\n return {\n type: 'server',\n Component: null,\n RenderedComponent: (\n <Component key={key} {...serverProps} {...resolvedComponent.serverProps} {...props} />\n ),\n }\n } else {\n if (!resolvedComponent.Component) {\n return undefined\n }\n\n return {\n type: 'client',\n Component: resolvedComponent.Component,\n props: {\n ...(resolvedComponent.clientProps || {}),\n ...props,\n },\n }\n }\n }\n\n const createMappedComponent: CreateMappedComponent = (\n payloadComponent,\n props,\n fallback,\n identifier,\n ) => {\n if ((payloadComponent === undefined || payloadComponent === null) && !fallback) {\n return undefined as any\n }\n\n if (payloadComponent && Array.isArray(payloadComponent)) {\n const mappedComponents: MappedComponent[] = []\n for (let i = 0; i < payloadComponent.length; i++) {\n const component = createSingleMappedComponent(\n payloadComponent[i],\n i,\n props,\n fallback,\n identifier,\n )\n mappedComponents.push(component)\n }\n return mappedComponents as any\n } else {\n return createSingleMappedComponent(\n payloadComponent,\n undefined,\n props,\n fallback,\n identifier,\n ) as any\n }\n }\n\n return createMappedComponent\n}\n"],"names":["isReactServerComponentOrFunction","React","getComponent","getCreateMappedComponent","importMap","serverProps","createSingleMappedComponent","payloadComponent","key","props","Fallback","identifier","undefined","type","Component","RenderedComponent","toReturn","resolvedComponent","ReactComponent","console","error","clientProps","createMappedComponent","fallback","Array","isArray","mappedComponents","i","length","component","push"],"mappings":";AAUA,SAASA,gCAAgC,QAAQ,iBAAgB;AACjE,OAAOC,WAAW,QAAO;AAEzB,SAASC,YAAY,QAAQ,oBAAmB;AAEhD,OAAO,SAASC,yBAAyB,EACvCC,SAAS,EACTC,WAAW,EAQZ;IACC,MAAMC,8BAA8B,CAClCC,kBACAC,KACAC,OACAC,UACAC;QAEA,IAAIJ,qBAAqBK,aAAaL,qBAAqB,MAAM;YAC/D,IAAI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AAM,CAACgB,UAAU;YAC9E,OAAOX;QACT;QAEA,IAAIL,oBAAoBiB,MAAMC,OAAO,CAAClB,mBAAmB;YACvD,MAAMmB,mBAAsC,EAAE;YAC9C,IAAK,IAAIC,IAAI,GAAGA,IAAIpB,iBAAiBqB,MAAM,EAAED,IAAK;gBAChD,MAAME,YAAYvB,4BAChBC,gBAAgB,CAACoB,EAAE,EACnBA,GACAlB,OACAc,UACAZ;gBAEFe,iBAAiBI,IAAI,CAACD;YACxB;YACA,OAAOH;QACT,OAAO;YACL,OAAOpB,4BACLC,kBACAK,WACAH,OACAc,UACAZ;QAEJ;IACF;IAEA,OAAOW;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../../../src/providers/Config/createClientConfig/globals.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EAErB,aAAa,EACb,SAAS,EAET,OAAO,EACP,eAAe,EAGhB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,eAAO,MAAM,wBAAwB,gGAQlC;IACD,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,CAAA;IACxC,YAAY,EAAE,kBAAkB,CAAA;IAChC,qBAAqB,EAAE,qBAAqB,CAAA;IAC5C,MAAM,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;IACrC,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;IACpB,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,
|
|
1
|
+
{"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../../../src/providers/Config/createClientConfig/globals.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EAErB,aAAa,EACb,SAAS,EAET,OAAO,EACP,eAAe,EAGhB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,eAAO,MAAM,wBAAwB,gGAQlC;IACD,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,CAAA;IACxC,YAAY,EAAE,kBAAkB,CAAA;IAChC,qBAAqB,EAAE,qBAAqB,CAAA;IAC5C,MAAM,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;IACrC,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;IACpB,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,kBA6JH,CAAA;AAED,eAAO,MAAM,yBAAyB,kGAQnC;IACD,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,CAAA;IACxC,aAAa,EAAE,kBAAkB,EAAE,CAAA;IACnC,qBAAqB,EAAE,qBAAqB,CAAA;IAC5C,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAA;IACnC,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;IACpB,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,kBAAkB,EAerB,CAAA"}
|
|
@@ -57,7 +57,7 @@ export const createClientGlobalConfig = ({ DefaultEditView, clientGlobal, create
|
|
|
57
57
|
clientGlobal.admin.components.views.edit = {};
|
|
58
58
|
}
|
|
59
59
|
clientGlobal.admin.components.views.edit.default = {
|
|
60
|
-
Component: createMappedComponent(hasEditView && 'Component' in global.admin.components.views.edit.default && global.admin.components.views.edit.default.Component, {
|
|
60
|
+
Component: createMappedComponent(hasEditView && 'Component' in global.admin.components.views.edit.default && global.admin.components.views.edit.default.Component ? global.admin.components.views.edit.default.Component : null, {
|
|
61
61
|
globalSlug: global.slug
|
|
62
62
|
}, DefaultEditView, 'global.admin.components.views.edit.default')
|
|
63
63
|
};
|