@payloadcms/ui 3.0.0 → 3.0.1-canary.34c6cc0

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.
@@ -1,13 +1,16 @@
1
1
  import type { ImportMap, PayloadComponent } from 'payload';
2
2
  import React from 'react';
3
- /**
4
- * Can be used to render both MappedComponents and React Components.
5
- */
6
- export declare const RenderServerComponent: React.FC<{
3
+ type RenderServerComponentFn = (args: {
7
4
  readonly clientProps?: object;
8
5
  readonly Component?: PayloadComponent | PayloadComponent[] | React.ComponentType | React.ComponentType[];
9
6
  readonly Fallback?: React.ComponentType;
10
7
  readonly importMap: ImportMap;
8
+ readonly key?: string;
11
9
  readonly serverProps?: object;
12
- }>;
10
+ }) => React.ReactNode;
11
+ /**
12
+ * Can be used to render both MappedComponents and React Components.
13
+ */
14
+ export declare const RenderServerComponent: RenderServerComponentFn;
15
+ export {};
13
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/RenderServerComponent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAG1D,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC;IAC3C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,SAAS,CAAC,EACf,gBAAgB,GAChB,gBAAgB,EAAE,GAClB,KAAK,CAAC,aAAa,GACnB,KAAK,CAAC,aAAa,EAAE,CAAA;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IACvC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B,CAyDA,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/RenderServerComponent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAG1D,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,KAAK,uBAAuB,GAAG,CAAC,IAAI,EAAE;IACpC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,SAAS,CAAC,EACf,gBAAgB,GAChB,gBAAgB,EAAE,GAClB,KAAK,CAAC,aAAa,GACnB,KAAK,CAAC,aAAa,EAAE,CAAA;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IACvC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B,KAAK,KAAK,CAAC,SAAS,CAAA;AAErB;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,uBAiEnC,CAAA"}
@@ -10,15 +10,17 @@ export const RenderServerComponent = ({
10
10
  Component,
11
11
  Fallback,
12
12
  importMap,
13
+ key,
13
14
  serverProps
14
15
  }) => {
15
16
  if (Array.isArray(Component)) {
16
- return Component.map((c, index) => /*#__PURE__*/_jsx(RenderServerComponent, {
17
- clientProps: clientProps,
17
+ return Component.map((c, index) => RenderServerComponent({
18
+ clientProps,
18
19
  Component: c,
19
- importMap: importMap,
20
- serverProps: serverProps
21
- }, index));
20
+ importMap,
21
+ key: index,
22
+ serverProps
23
+ }));
22
24
  }
23
25
  if (typeof Component === 'function') {
24
26
  const isRSC = isReactServerComponentOrFunction(Component);
@@ -29,7 +31,7 @@ export const RenderServerComponent = ({
29
31
  });
30
32
  return /*#__PURE__*/_jsx(Component, {
31
33
  ...sanitizedProps
32
- });
34
+ }, key);
33
35
  }
34
36
  if (typeof Component === 'string' || isPlainObject(Component)) {
35
37
  const ResolvedComponent = getFromImportMap({
@@ -48,14 +50,15 @@ export const RenderServerComponent = ({
48
50
  });
49
51
  return /*#__PURE__*/_jsx(ResolvedComponent, {
50
52
  ...sanitizedProps
51
- });
53
+ }, key);
52
54
  }
53
55
  }
54
- return Fallback ? /*#__PURE__*/_jsx(RenderServerComponent, {
55
- clientProps: clientProps,
56
+ return Fallback ? RenderServerComponent({
57
+ clientProps,
56
58
  Component: Fallback,
57
- importMap: importMap,
58
- serverProps: serverProps
59
+ importMap,
60
+ key,
61
+ serverProps
59
62
  }) : null;
60
63
  };
61
64
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["getFromImportMap","isPlainObject","isReactServerComponentOrFunction","React","removeUndefined","RenderServerComponent","clientProps","Component","Fallback","importMap","serverProps","Array","isArray","map","c","index","_jsx","isRSC","sanitizedProps","ResolvedComponent","PayloadComponent","schemaPath"],"sources":["../../../src/elements/RenderServerComponent/index.tsx"],"sourcesContent":["import type { ImportMap, PayloadComponent } from 'payload'\n\nimport { getFromImportMap, isPlainObject, isReactServerComponentOrFunction } from 'payload/shared'\nimport React from 'react'\n\nimport { removeUndefined } from '../../utilities/removeUndefined.js'\n\n/**\n * Can be used to render both MappedComponents and React Components.\n */\nexport const RenderServerComponent: React.FC<{\n readonly clientProps?: object\n readonly Component?:\n | PayloadComponent\n | PayloadComponent[]\n | React.ComponentType\n | React.ComponentType[]\n readonly Fallback?: React.ComponentType\n readonly importMap: ImportMap\n readonly serverProps?: object\n}> = ({ clientProps = {}, Component, Fallback, importMap, serverProps }) => {\n if (Array.isArray(Component)) {\n return Component.map((c, index) => (\n <RenderServerComponent\n clientProps={clientProps}\n Component={c}\n importMap={importMap}\n key={index}\n serverProps={serverProps}\n />\n ))\n }\n\n if (typeof Component === 'function') {\n const isRSC = isReactServerComponentOrFunction(Component)\n\n // prevent $undefined from being passed through the rsc requests\n const sanitizedProps = removeUndefined({\n ...clientProps,\n ...(isRSC ? serverProps : {}),\n })\n\n return <Component {...sanitizedProps} />\n }\n\n if (typeof Component === 'string' || isPlainObject(Component)) {\n const ResolvedComponent = getFromImportMap<React.ComponentType>({\n importMap,\n PayloadComponent: Component,\n schemaPath: '',\n })\n\n if (ResolvedComponent) {\n const isRSC = isReactServerComponentOrFunction(ResolvedComponent)\n\n // prevent $undefined from being passed through rsc requests\n const sanitizedProps = removeUndefined({\n ...clientProps,\n ...(isRSC ? serverProps : {}),\n ...(isRSC && typeof Component === 'object' && Component?.serverProps\n ? Component.serverProps\n : {}),\n ...(typeof Component === 'object' && Component?.clientProps ? Component.clientProps : {}),\n })\n\n return <ResolvedComponent {...sanitizedProps} />\n }\n }\n\n return Fallback ? (\n <RenderServerComponent\n clientProps={clientProps}\n Component={Fallback}\n importMap={importMap}\n serverProps={serverProps}\n />\n ) : null\n}\n"],"mappings":";AAEA,SAASA,gBAAgB,EAAEC,aAAa,EAAEC,gCAAgC,QAAQ;AAClF,OAAOC,KAAA,MAAW;AAElB,SAASC,eAAe,QAAQ;AAEhC;;;AAGA,OAAO,MAAMC,qBAAA,GAURA,CAAC;EAAEC,WAAA,GAAc,CAAC,CAAC;EAAEC,SAAS;EAAEC,QAAQ;EAAEC,SAAS;EAAEC;AAAW,CAAE;EACrE,IAAIC,KAAA,CAAMC,OAAO,CAACL,SAAA,GAAY;IAC5B,OAAOA,SAAA,CAAUM,GAAG,CAAC,CAACC,CAAA,EAAGC,KAAA,kBACvBC,IAAA,CAACX,qBAAA;MACCC,WAAA,EAAaA,WAAA;MACbC,SAAA,EAAWO,CAAA;MACXL,SAAA,EAAWA,SAAA;MAEXC,WAAA,EAAaA;OADRK,KAAA;EAIX;EAEA,IAAI,OAAOR,SAAA,KAAc,YAAY;IACnC,MAAMU,KAAA,GAAQf,gCAAA,CAAiCK,SAAA;IAE/C;IACA,MAAMW,cAAA,GAAiBd,eAAA,CAAgB;MACrC,GAAGE,WAAW;MACd,IAAIW,KAAA,GAAQP,WAAA,GAAc,CAAC,CAAC;IAC9B;IAEA,oBAAOM,IAAA,CAACT,SAAA;MAAW,GAAGW;;EACxB;EAEA,IAAI,OAAOX,SAAA,KAAc,YAAYN,aAAA,CAAcM,SAAA,GAAY;IAC7D,MAAMY,iBAAA,GAAoBnB,gBAAA,CAAsC;MAC9DS,SAAA;MACAW,gBAAA,EAAkBb,SAAA;MAClBc,UAAA,EAAY;IACd;IAEA,IAAIF,iBAAA,EAAmB;MACrB,MAAMF,KAAA,GAAQf,gCAAA,CAAiCiB,iBAAA;MAE/C;MACA,MAAMD,cAAA,GAAiBd,eAAA,CAAgB;QACrC,GAAGE,WAAW;QACd,IAAIW,KAAA,GAAQP,WAAA,GAAc,CAAC,CAAC;QAC5B,IAAIO,KAAA,IAAS,OAAOV,SAAA,KAAc,YAAYA,SAAA,EAAWG,WAAA,GACrDH,SAAA,CAAUG,WAAW,GACrB,CAAC,CAAC;QACN,IAAI,OAAOH,SAAA,KAAc,YAAYA,SAAA,EAAWD,WAAA,GAAcC,SAAA,CAAUD,WAAW,GAAG,CAAC,CAAC;MAC1F;MAEA,oBAAOU,IAAA,CAACG,iBAAA;QAAmB,GAAGD;;IAChC;EACF;EAEA,OAAOV,QAAA,gBACLQ,IAAA,CAACX,qBAAA;IACCC,WAAA,EAAaA,WAAA;IACbC,SAAA,EAAWC,QAAA;IACXC,SAAA,EAAWA,SAAA;IACXC,WAAA,EAAaA;OAEb;AACN","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["getFromImportMap","isPlainObject","isReactServerComponentOrFunction","React","removeUndefined","RenderServerComponent","clientProps","Component","Fallback","importMap","key","serverProps","Array","isArray","map","c","index","isRSC","sanitizedProps","_jsx","ResolvedComponent","PayloadComponent","schemaPath"],"sources":["../../../src/elements/RenderServerComponent/index.tsx"],"sourcesContent":["import type { ImportMap, PayloadComponent } from 'payload'\n\nimport { getFromImportMap, isPlainObject, isReactServerComponentOrFunction } from 'payload/shared'\nimport React from 'react'\n\nimport { removeUndefined } from '../../utilities/removeUndefined.js'\n\ntype RenderServerComponentFn = (args: {\n readonly clientProps?: object\n readonly Component?:\n | PayloadComponent\n | PayloadComponent[]\n | React.ComponentType\n | React.ComponentType[]\n readonly Fallback?: React.ComponentType\n readonly importMap: ImportMap\n readonly key?: string\n readonly serverProps?: object\n}) => React.ReactNode\n\n/**\n * Can be used to render both MappedComponents and React Components.\n */\nexport const RenderServerComponent: RenderServerComponentFn = ({\n clientProps = {},\n Component,\n Fallback,\n importMap,\n key,\n serverProps,\n}) => {\n if (Array.isArray(Component)) {\n return Component.map((c, index) =>\n RenderServerComponent({\n clientProps,\n Component: c,\n importMap,\n key: index,\n serverProps,\n }),\n )\n }\n\n if (typeof Component === 'function') {\n const isRSC = isReactServerComponentOrFunction(Component)\n\n // prevent $undefined from being passed through the rsc requests\n const sanitizedProps = removeUndefined({\n ...clientProps,\n ...(isRSC ? serverProps : {}),\n })\n\n return <Component key={key} {...sanitizedProps} />\n }\n\n if (typeof Component === 'string' || isPlainObject(Component)) {\n const ResolvedComponent = getFromImportMap<React.ComponentType>({\n importMap,\n PayloadComponent: Component,\n schemaPath: '',\n })\n\n if (ResolvedComponent) {\n const isRSC = isReactServerComponentOrFunction(ResolvedComponent)\n\n // prevent $undefined from being passed through rsc requests\n const sanitizedProps = removeUndefined({\n ...clientProps,\n ...(isRSC ? serverProps : {}),\n ...(isRSC && typeof Component === 'object' && Component?.serverProps\n ? Component.serverProps\n : {}),\n ...(typeof Component === 'object' && Component?.clientProps ? Component.clientProps : {}),\n })\n\n return <ResolvedComponent key={key} {...sanitizedProps} />\n }\n }\n\n return Fallback\n ? RenderServerComponent({\n clientProps,\n Component: Fallback,\n importMap,\n key,\n serverProps,\n })\n : null\n}\n"],"mappings":";AAEA,SAASA,gBAAgB,EAAEC,aAAa,EAAEC,gCAAgC,QAAQ;AAClF,OAAOC,KAAA,MAAW;AAElB,SAASC,eAAe,QAAQ;AAehC;;;AAGA,OAAO,MAAMC,qBAAA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Oa,IAAA,CAACC,iBAAA;QAA6B,GAAGF;SAATR,GAAA;IACjC;EACF;EAEA,OAAOF,QAAA,GACHH,qBAAA,CAAsB;IACpBC,WAAA;IACAC,SAAA,EAAWC,QAAA;IACXC,SAAA;IACAC,GAAA;IACAC;EACF,KACA;AACN","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"buildColumnState.d.ts","sourceRoot":"","sources":["../../../src/elements/TableColumns/buildColumnState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EACV,sBAAsB,EACtB,yBAAyB,EAEzB,KAAK,EACL,aAAa,EACb,OAAO,EAEP,yBAAyB,EAE1B,MAAM,SAAS,CAAA;AAMhB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAa/C,KAAK,IAAI,GAAG;IACV,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,gBAAgB,EAAE,sBAAsB,CAAA;IACxC,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,OAAO,CAAC,EAAE,iBAAiB,CAAA;IAC3B,eAAe,EAAE,yBAAyB,CAAC,iBAAiB,CAAC,CAAA;IAC7D,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC3B,mBAAmB,EAAE,OAAO,CAAA;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IAC1C,UAAU,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAA;CAC7D,CAAA;AAED,eAAO,MAAM,gBAAgB,SAAU,IAAI,KAAG,MAAM,EAyPnD,CAAA"}
1
+ {"version":3,"file":"buildColumnState.d.ts","sourceRoot":"","sources":["../../../src/elements/TableColumns/buildColumnState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EACV,sBAAsB,EACtB,yBAAyB,EAEzB,KAAK,EACL,aAAa,EACb,OAAO,EAEP,yBAAyB,EAE1B,MAAM,SAAS,CAAA;AAMhB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAa/C,KAAK,IAAI,GAAG;IACV,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,gBAAgB,EAAE,sBAAsB,CAAA;IACxC,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,OAAO,CAAC,EAAE,iBAAiB,CAAA;IAC3B,eAAe,EAAE,yBAAyB,CAAC,iBAAiB,CAAC,CAAA;IAC7D,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC3B,mBAAmB,EAAE,OAAO,CAAA;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IAC1C,UAAU,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAA;CAC7D,CAAA;AAED,eAAO,MAAM,gBAAgB,SAAU,IAAI,KAAG,MAAM,EAwPnD,CAAA"}
@@ -76,7 +76,7 @@ export const buildColumnState = args => {
76
76
  }
77
77
  const CustomLabelToRender = _field && 'admin' in _field && 'components' in _field.admin && 'Label' in _field.admin.components && _field.admin.components.Label !== undefined // let it return `null`
78
78
  ? _field.admin.components.Label : undefined;
79
- const CustomLabel = CustomLabelToRender ? /*#__PURE__*/_jsx(RenderServerComponent, {
79
+ const CustomLabel = CustomLabelToRender ? RenderServerComponent({
80
80
  Component: CustomLabelToRender,
81
81
  importMap: payload.importMap
82
82
  }) : undefined;
@@ -143,18 +143,18 @@ export const buildColumnState = args => {
143
143
  if (typeof CellComponent === 'object' && CellComponent.clientProps) {
144
144
  CellComponent.clientProps = deepCopyObjectSimple(CellComponent.clientProps);
145
145
  }
146
- CustomCell = /*#__PURE__*/_jsx(RenderServerComponent, {
146
+ CustomCell = RenderServerComponent({
147
147
  clientProps: cellClientProps,
148
148
  Component: CellComponent,
149
149
  importMap: payload.importMap,
150
- serverProps: serverProps
150
+ serverProps
151
151
  });
152
152
  } else {
153
- CustomCell = _field?.admin && 'components' in _field.admin && _field.admin.components?.Cell ? /*#__PURE__*/_jsx(RenderServerComponent, {
153
+ CustomCell = _field?.admin && 'components' in _field.admin && _field.admin.components?.Cell ? RenderServerComponent({
154
154
  clientProps: cellClientProps,
155
155
  Component: _field?.admin && 'components' in _field.admin && _field.admin.components?.Cell,
156
156
  importMap: payload.importMap,
157
- serverProps: serverProps
157
+ serverProps
158
158
  }) : undefined;
159
159
  }
160
160
  return /*#__PURE__*/_jsx(RenderCustomComponent, {
@@ -1 +1 @@
1
- {"version":3,"file":"buildColumnState.js","names":["MissingEditorProp","deepCopyObjectSimple","fieldIsPresentationalOnly","React","RenderCustomComponent","RenderDefaultCell","SelectAll","SelectRow","SortColumn","flattenFieldMap","RenderServerComponent","buildColumnState","args","beforeRows","collectionConfig","columnPreferences","columns","customCellProps","docs","enableRowSelections","fields","i18n","payload","sortColumnProps","useAsTitle","clientFields","sortedFieldMap","_sortedFieldMap","idFieldIndex","findIndex","field","name","idField","splice","unshift","useAsTitleFieldIndex","useAsTitleField","sortTo","sortFieldMap","fieldMap","sort","a","b","aIndex","column","accessor","bIndex","activeColumnsIndices","sorted","reduce","acc","index","_field","find","f","columnPreference","preference","active","Array","isArray","length","includes","push","CustomLabelToRender","admin","components","Label","undefined","CustomLabel","_jsx","Component","importMap","fieldAffectsDataSubFields","type","Heading","disable","label","baseCellClientProps","cellData","rowData","serverProps","renderedCells","map","doc","i","isLinkedColumn","cellClientProps","link","CustomCell","editor","Error","CellComponent","clientProps","Cell","CustomComponent","Fallback","columnIndex","_"],"sources":["../../../src/elements/TableColumns/buildColumnState.tsx"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type {\n ClientCollectionConfig,\n DefaultCellComponentProps,\n DefaultServerCellComponentProps,\n Field,\n PaginatedDocs,\n Payload,\n PayloadComponent,\n SanitizedCollectionConfig,\n StaticLabel,\n} from 'payload'\n\nimport { MissingEditorProp } from 'payload'\nimport { deepCopyObjectSimple, fieldIsPresentationalOnly } from 'payload/shared'\nimport React from 'react'\n\nimport type { ColumnPreferences } from '../../providers/ListQuery/index.js'\nimport type { SortColumnProps } from '../SortColumn/index.js'\nimport type { Column } from '../Table/index.js'\n\nimport {\n RenderCustomComponent,\n RenderDefaultCell,\n SelectAll,\n SelectRow,\n SortColumn,\n // eslint-disable-next-line payload/no-imports-from-exports-dir\n} from '../../exports/client/index.js'\nimport { flattenFieldMap } from '../../utilities/flattenFieldMap.js'\nimport { RenderServerComponent } from '../RenderServerComponent/index.js'\n\ntype Args = {\n beforeRows?: Column[]\n collectionConfig: ClientCollectionConfig\n columnPreferences: ColumnPreferences\n columns?: ColumnPreferences\n customCellProps: DefaultCellComponentProps['customCellProps']\n docs: PaginatedDocs['docs']\n enableRowSelections: boolean\n enableRowTypes?: boolean\n fields: Field[]\n i18n: I18nClient\n payload: Payload\n sortColumnProps?: Partial<SortColumnProps>\n useAsTitle: SanitizedCollectionConfig['admin']['useAsTitle']\n}\n\nexport const buildColumnState = (args: Args): Column[] => {\n const {\n beforeRows,\n collectionConfig,\n columnPreferences,\n columns,\n customCellProps,\n docs,\n enableRowSelections,\n fields,\n i18n,\n payload,\n sortColumnProps,\n useAsTitle,\n } = args\n\n const clientFields = collectionConfig.fields\n\n // clientFields contains the fake `id` column\n let sortedFieldMap = flattenFieldMap(clientFields)\n let _sortedFieldMap = flattenFieldMap(fields) // TODO: think of a way to avoid this additional flatten\n\n // place the `ID` field first, if it exists\n // do the same for the `useAsTitle` field with precedence over the `ID` field\n // then sort the rest of the fields based on the `defaultColumns` or `columnPreferences`\n const idFieldIndex = sortedFieldMap?.findIndex((field) => 'name' in field && field.name === 'id')\n\n if (idFieldIndex > -1) {\n const idField = sortedFieldMap.splice(idFieldIndex, 1)[0]\n sortedFieldMap.unshift(idField)\n }\n\n const useAsTitleFieldIndex = useAsTitle\n ? sortedFieldMap.findIndex((field) => 'name' in field && field.name === useAsTitle)\n : -1\n\n if (useAsTitleFieldIndex > -1) {\n const useAsTitleField = sortedFieldMap.splice(useAsTitleFieldIndex, 1)[0]\n sortedFieldMap.unshift(useAsTitleField)\n }\n\n const sortTo = columnPreferences || columns\n\n const sortFieldMap = (fieldMap, sortTo) =>\n fieldMap?.sort((a, b) => {\n const aIndex = sortTo.findIndex((column) => 'name' in a && column.accessor === a.name)\n const bIndex = sortTo.findIndex((column) => 'name' in b && column.accessor === b.name)\n\n if (aIndex === -1 && bIndex === -1) {\n return 0\n }\n\n if (aIndex === -1) {\n return 1\n }\n\n if (bIndex === -1) {\n return -1\n }\n\n return aIndex - bIndex\n })\n\n if (sortTo) {\n // sort the fields to the order of `defaultColumns` or `columnPreferences`\n sortedFieldMap = sortFieldMap(sortedFieldMap, sortTo)\n _sortedFieldMap = sortFieldMap(_sortedFieldMap, sortTo) // TODO: think of a way to avoid this additional sort\n }\n\n const activeColumnsIndices = []\n\n const sorted: Column[] = sortedFieldMap?.reduce((acc, field, index) => {\n const _field = _sortedFieldMap.find(\n (f) => 'name' in field && 'name' in f && f.name === field.name,\n )\n\n const columnPreference = columnPreferences?.find(\n (preference) => field && 'name' in field && preference.accessor === field.name,\n )\n\n let active = false\n\n if (columnPreference) {\n active = columnPreference.active\n } else if (columns && Array.isArray(columns) && columns.length > 0) {\n active = columns.find(\n (column) => field && 'name' in field && column.accessor === field.name,\n )?.active\n } else if (activeColumnsIndices.length < 4) {\n active = true\n }\n\n if (active && !activeColumnsIndices.includes(index)) {\n activeColumnsIndices.push(index)\n }\n\n const CustomLabelToRender =\n _field &&\n 'admin' in _field &&\n 'components' in _field.admin &&\n 'Label' in _field.admin.components &&\n _field.admin.components.Label !== undefined // let it return `null`\n ? _field.admin.components.Label\n : undefined\n\n const CustomLabel = CustomLabelToRender ? (\n <RenderServerComponent Component={CustomLabelToRender} importMap={payload.importMap} />\n ) : undefined\n\n const fieldAffectsDataSubFields =\n field &&\n field.type &&\n (field.type === 'array' || field.type === 'group' || field.type === 'blocks')\n\n const Heading = (\n <SortColumn\n disable={fieldAffectsDataSubFields || fieldIsPresentationalOnly(field) || undefined}\n Label={CustomLabel}\n label={field && 'label' in field ? (field.label as StaticLabel) : undefined}\n name={'name' in field ? field.name : undefined}\n {...(sortColumnProps || {})}\n />\n )\n\n const baseCellClientProps: DefaultCellComponentProps = {\n cellData: undefined,\n collectionConfig: deepCopyObjectSimple(collectionConfig),\n customCellProps,\n field,\n rowData: undefined,\n }\n\n const serverProps: Pick<DefaultServerCellComponentProps, 'field' | 'i18n' | 'payload'> = {\n field: _field,\n i18n,\n payload,\n }\n\n const column: Column = {\n accessor: 'name' in field ? field.name : undefined,\n active,\n CustomLabel,\n field,\n Heading,\n renderedCells: active\n ? docs.map((doc, i) => {\n const isLinkedColumn = index === activeColumnsIndices[0]\n\n const cellClientProps: DefaultCellComponentProps = {\n ...baseCellClientProps,\n cellData: 'name' in field ? doc[field.name] : undefined,\n link: isLinkedColumn,\n rowData: doc,\n }\n\n let CustomCell = null\n\n if (_field?.type === 'richText') {\n if (!_field?.editor) {\n throw new MissingEditorProp(_field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n\n if (typeof _field?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n if (!_field.admin) {\n _field.admin = {}\n }\n\n if (!_field.admin.components) {\n _field.admin.components = {}\n }\n\n /**\n * We have to deep copy all the props we send to the client (= CellComponent.clientProps).\n * That way, every editor's field / cell props we send to the client have their own object references.\n *\n * If we send the same object reference to the client twice (e.g. through some configurations where 2 or more fields\n * reference the same editor object, like the root editor), the admin panel may hang indefinitely. This has been happening since\n * a newer Next.js update that made it break when sending the same object reference to the client twice.\n *\n * We can use deepCopyObjectSimple as client props should be JSON-serializable.\n */\n const CellComponent: PayloadComponent = _field.editor.CellComponent\n if (typeof CellComponent === 'object' && CellComponent.clientProps) {\n CellComponent.clientProps = deepCopyObjectSimple(CellComponent.clientProps)\n }\n\n CustomCell = (\n <RenderServerComponent\n clientProps={cellClientProps}\n Component={CellComponent}\n importMap={payload.importMap}\n serverProps={serverProps}\n />\n )\n } else {\n CustomCell =\n _field?.admin && 'components' in _field.admin && _field.admin.components?.Cell ? (\n <RenderServerComponent\n clientProps={cellClientProps}\n Component={\n _field?.admin && 'components' in _field.admin && _field.admin.components?.Cell\n }\n importMap={payload.importMap}\n serverProps={serverProps}\n />\n ) : undefined\n }\n\n return (\n <RenderCustomComponent\n CustomComponent={CustomCell}\n Fallback={\n <RenderDefaultCell\n clientProps={cellClientProps}\n columnIndex={index}\n enableRowSelections={enableRowSelections}\n isLinkedColumn={isLinkedColumn}\n />\n }\n key={`${i}-${index}`}\n />\n )\n })\n : [],\n }\n\n acc.push(column)\n\n return acc\n }, [])\n\n if (enableRowSelections) {\n sorted?.unshift({\n accessor: '_select',\n active: true,\n field: null,\n Heading: <SelectAll />,\n renderedCells: docs.map((_, i) => <SelectRow key={i} rowData={docs[i]} />),\n })\n }\n\n if (beforeRows) {\n sorted.unshift(...beforeRows)\n }\n\n return sorted\n}\n"],"mappings":";AAaA,SAASA,iBAAiB,QAAQ;AAClC,SAASC,oBAAoB,EAAEC,yBAAy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WAGf,GAAGD,CAAA,IAAKjC,KAAA,EAAO;MAG1B,KACA;IACN;IAEAD,GAAA,CAAIY,IAAI,CAAClB,MAAA;IAET,OAAOM,GAAA;EACT,GAAG,EAAE;EAEL,IAAI/B,mBAAA,EAAqB;IACvB6B,MAAA,EAAQd,OAAA,CAAQ;MACdW,QAAA,EAAU;MACVY,MAAA,EAAQ;MACR3B,KAAA,EAAO;MACP4C,OAAA,eAASL,IAAA,CAAC/D,SAAA;MACV2E,aAAA,EAAe/D,IAAA,CAAKgE,GAAG,CAAC,CAACe,CAAA,EAAGb,CAAA,kBAAMf,IAAA,CAAC9D,SAAA;QAAkBwE,OAAA,EAAS7D,IAAI,CAACkE,CAAA;SAAjBA,CAAA;IACpD;EACF;EAEA,IAAIvE,UAAA,EAAY;IACdmC,MAAA,CAAOd,OAAO,IAAIrB,UAAA;EACpB;EAEA,OAAOmC,MAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"buildColumnState.js","names":["MissingEditorProp","deepCopyObjectSimple","fieldIsPresentationalOnly","React","RenderCustomComponent","RenderDefaultCell","SelectAll","SelectRow","SortColumn","flattenFieldMap","RenderServerComponent","buildColumnState","args","beforeRows","collectionConfig","columnPreferences","columns","customCellProps","docs","enableRowSelections","fields","i18n","payload","sortColumnProps","useAsTitle","clientFields","sortedFieldMap","_sortedFieldMap","idFieldIndex","findIndex","field","name","idField","splice","unshift","useAsTitleFieldIndex","useAsTitleField","sortTo","sortFieldMap","fieldMap","sort","a","b","aIndex","column","accessor","bIndex","activeColumnsIndices","sorted","reduce","acc","index","_field","find","f","columnPreference","preference","active","Array","isArray","length","includes","push","CustomLabelToRender","admin","components","Label","undefined","CustomLabel","Component","importMap","fieldAffectsDataSubFields","type","Heading","_jsx","disable","label","baseCellClientProps","cellData","rowData","serverProps","renderedCells","map","doc","i","isLinkedColumn","cellClientProps","link","CustomCell","editor","Error","CellComponent","clientProps","Cell","CustomComponent","Fallback","columnIndex","_"],"sources":["../../../src/elements/TableColumns/buildColumnState.tsx"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type {\n ClientCollectionConfig,\n DefaultCellComponentProps,\n DefaultServerCellComponentProps,\n Field,\n PaginatedDocs,\n Payload,\n PayloadComponent,\n SanitizedCollectionConfig,\n StaticLabel,\n} from 'payload'\n\nimport { MissingEditorProp } from 'payload'\nimport { deepCopyObjectSimple, fieldIsPresentationalOnly } from 'payload/shared'\nimport React from 'react'\n\nimport type { ColumnPreferences } from '../../providers/ListQuery/index.js'\nimport type { SortColumnProps } from '../SortColumn/index.js'\nimport type { Column } from '../Table/index.js'\n\nimport {\n RenderCustomComponent,\n RenderDefaultCell,\n SelectAll,\n SelectRow,\n SortColumn,\n // eslint-disable-next-line payload/no-imports-from-exports-dir\n} from '../../exports/client/index.js'\nimport { flattenFieldMap } from '../../utilities/flattenFieldMap.js'\nimport { RenderServerComponent } from '../RenderServerComponent/index.js'\n\ntype Args = {\n beforeRows?: Column[]\n collectionConfig: ClientCollectionConfig\n columnPreferences: ColumnPreferences\n columns?: ColumnPreferences\n customCellProps: DefaultCellComponentProps['customCellProps']\n docs: PaginatedDocs['docs']\n enableRowSelections: boolean\n enableRowTypes?: boolean\n fields: Field[]\n i18n: I18nClient\n payload: Payload\n sortColumnProps?: Partial<SortColumnProps>\n useAsTitle: SanitizedCollectionConfig['admin']['useAsTitle']\n}\n\nexport const buildColumnState = (args: Args): Column[] => {\n const {\n beforeRows,\n collectionConfig,\n columnPreferences,\n columns,\n customCellProps,\n docs,\n enableRowSelections,\n fields,\n i18n,\n payload,\n sortColumnProps,\n useAsTitle,\n } = args\n\n const clientFields = collectionConfig.fields\n\n // clientFields contains the fake `id` column\n let sortedFieldMap = flattenFieldMap(clientFields)\n let _sortedFieldMap = flattenFieldMap(fields) // TODO: think of a way to avoid this additional flatten\n\n // place the `ID` field first, if it exists\n // do the same for the `useAsTitle` field with precedence over the `ID` field\n // then sort the rest of the fields based on the `defaultColumns` or `columnPreferences`\n const idFieldIndex = sortedFieldMap?.findIndex((field) => 'name' in field && field.name === 'id')\n\n if (idFieldIndex > -1) {\n const idField = sortedFieldMap.splice(idFieldIndex, 1)[0]\n sortedFieldMap.unshift(idField)\n }\n\n const useAsTitleFieldIndex = useAsTitle\n ? sortedFieldMap.findIndex((field) => 'name' in field && field.name === useAsTitle)\n : -1\n\n if (useAsTitleFieldIndex > -1) {\n const useAsTitleField = sortedFieldMap.splice(useAsTitleFieldIndex, 1)[0]\n sortedFieldMap.unshift(useAsTitleField)\n }\n\n const sortTo = columnPreferences || columns\n\n const sortFieldMap = (fieldMap, sortTo) =>\n fieldMap?.sort((a, b) => {\n const aIndex = sortTo.findIndex((column) => 'name' in a && column.accessor === a.name)\n const bIndex = sortTo.findIndex((column) => 'name' in b && column.accessor === b.name)\n\n if (aIndex === -1 && bIndex === -1) {\n return 0\n }\n\n if (aIndex === -1) {\n return 1\n }\n\n if (bIndex === -1) {\n return -1\n }\n\n return aIndex - bIndex\n })\n\n if (sortTo) {\n // sort the fields to the order of `defaultColumns` or `columnPreferences`\n sortedFieldMap = sortFieldMap(sortedFieldMap, sortTo)\n _sortedFieldMap = sortFieldMap(_sortedFieldMap, sortTo) // TODO: think of a way to avoid this additional sort\n }\n\n const activeColumnsIndices = []\n\n const sorted: Column[] = sortedFieldMap?.reduce((acc, field, index) => {\n const _field = _sortedFieldMap.find(\n (f) => 'name' in field && 'name' in f && f.name === field.name,\n )\n\n const columnPreference = columnPreferences?.find(\n (preference) => field && 'name' in field && preference.accessor === field.name,\n )\n\n let active = false\n\n if (columnPreference) {\n active = columnPreference.active\n } else if (columns && Array.isArray(columns) && columns.length > 0) {\n active = columns.find(\n (column) => field && 'name' in field && column.accessor === field.name,\n )?.active\n } else if (activeColumnsIndices.length < 4) {\n active = true\n }\n\n if (active && !activeColumnsIndices.includes(index)) {\n activeColumnsIndices.push(index)\n }\n\n const CustomLabelToRender =\n _field &&\n 'admin' in _field &&\n 'components' in _field.admin &&\n 'Label' in _field.admin.components &&\n _field.admin.components.Label !== undefined // let it return `null`\n ? _field.admin.components.Label\n : undefined\n\n const CustomLabel = CustomLabelToRender\n ? RenderServerComponent({ Component: CustomLabelToRender, importMap: payload.importMap })\n : undefined\n\n const fieldAffectsDataSubFields =\n field &&\n field.type &&\n (field.type === 'array' || field.type === 'group' || field.type === 'blocks')\n\n const Heading = (\n <SortColumn\n disable={fieldAffectsDataSubFields || fieldIsPresentationalOnly(field) || undefined}\n Label={CustomLabel}\n label={field && 'label' in field ? (field.label as StaticLabel) : undefined}\n name={'name' in field ? field.name : undefined}\n {...(sortColumnProps || {})}\n />\n )\n\n const baseCellClientProps: DefaultCellComponentProps = {\n cellData: undefined,\n collectionConfig: deepCopyObjectSimple(collectionConfig),\n customCellProps,\n field,\n rowData: undefined,\n }\n\n const serverProps: Pick<DefaultServerCellComponentProps, 'field' | 'i18n' | 'payload'> = {\n field: _field,\n i18n,\n payload,\n }\n\n const column: Column = {\n accessor: 'name' in field ? field.name : undefined,\n active,\n CustomLabel,\n field,\n Heading,\n renderedCells: active\n ? docs.map((doc, i) => {\n const isLinkedColumn = index === activeColumnsIndices[0]\n\n const cellClientProps: DefaultCellComponentProps = {\n ...baseCellClientProps,\n cellData: 'name' in field ? doc[field.name] : undefined,\n link: isLinkedColumn,\n rowData: doc,\n }\n\n let CustomCell = null\n\n if (_field?.type === 'richText') {\n if (!_field?.editor) {\n throw new MissingEditorProp(_field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n\n if (typeof _field?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n if (!_field.admin) {\n _field.admin = {}\n }\n\n if (!_field.admin.components) {\n _field.admin.components = {}\n }\n\n /**\n * We have to deep copy all the props we send to the client (= CellComponent.clientProps).\n * That way, every editor's field / cell props we send to the client have their own object references.\n *\n * If we send the same object reference to the client twice (e.g. through some configurations where 2 or more fields\n * reference the same editor object, like the root editor), the admin panel may hang indefinitely. This has been happening since\n * a newer Next.js update that made it break when sending the same object reference to the client twice.\n *\n * We can use deepCopyObjectSimple as client props should be JSON-serializable.\n */\n const CellComponent: PayloadComponent = _field.editor.CellComponent\n if (typeof CellComponent === 'object' && CellComponent.clientProps) {\n CellComponent.clientProps = deepCopyObjectSimple(CellComponent.clientProps)\n }\n\n CustomCell = RenderServerComponent({\n clientProps: cellClientProps,\n Component: CellComponent,\n importMap: payload.importMap,\n serverProps,\n })\n } else {\n CustomCell =\n _field?.admin && 'components' in _field.admin && _field.admin.components?.Cell\n ? RenderServerComponent({\n clientProps: cellClientProps,\n Component:\n _field?.admin &&\n 'components' in _field.admin &&\n _field.admin.components?.Cell,\n importMap: payload.importMap,\n serverProps,\n })\n : undefined\n }\n\n return (\n <RenderCustomComponent\n CustomComponent={CustomCell}\n Fallback={\n <RenderDefaultCell\n clientProps={cellClientProps}\n columnIndex={index}\n enableRowSelections={enableRowSelections}\n isLinkedColumn={isLinkedColumn}\n />\n }\n key={`${i}-${index}`}\n />\n )\n })\n : [],\n }\n\n acc.push(column)\n\n return acc\n }, [])\n\n if (enableRowSelections) {\n sorted?.unshift({\n accessor: '_select',\n active: true,\n field: null,\n Heading: <SelectAll />,\n renderedCells: docs.map((_, i) => <SelectRow key={i} rowData={docs[i]} />),\n })\n }\n\n if (beforeRows) {\n sorted.unshift(...beforeRows)\n }\n\n return sorted\n}\n"],"mappings":";AAaA,SAASA,iBAAiB,QAAQ;AAClC,SAASC,oBAAoB,EAAEC,yBAAyB,QAAQ;AAChE,OAAOC,KAAA,MAAW;AAMlB,SACEC,qBAAqB,EACrBC,iBAAiB,EACjBC,SAAS,EACTC,SAAS,EACTC,UAAU,QAEL;AACP,SAASC,eAAe,QAAQ;AAChC,SAASC,qBAAqB,QAAQ;AAkBtC,OAAO,MAAMC,gBAAA,GAAoBC,IAAA;EAC/B,MAAM;IACJC,UAAU;IACVC,gBAAgB;IAChBC,iBAAiB;IACjBC,OAAO;IACPC,eAAe;IACfC,IAAI;IACJC,mBAAmB;IACnBC,MAAM;IACNC,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A,CAACnE,SAAA;QAAkBwE,OAAA,EAAS7D,IAAI,CAACkE,CAAA;SAAjBA,CAAA;IACpD;EACF;EAEA,IAAIvE,UAAA,EAAY;IACdmC,MAAA,CAAOd,OAAO,IAAIrB,UAAA;EACpB;EAEA,OAAOmC,MAAA;AACT","ignoreList":[]}
@@ -16,7 +16,7 @@ export const WithServerSideProps = ({
16
16
  ...propsWithServerOnlyProps
17
17
  });
18
18
  };
19
- return /*#__PURE__*/_jsx(WithServerSideProps, {
19
+ return WithServerSideProps({
20
20
  ...rest
21
21
  });
22
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["isReactServerComponentOrFunction","React","WithServerSideProps","Component","serverOnlyProps","rest","passedProps","propsWithServerOnlyProps","_jsx"],"sources":["../../../src/elements/WithServerSideProps/index.tsx"],"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"],"mappings":";AAEA,SAASA,gCAAgC,QAAQ;AACjD,OAAOC,KAAA,MAAW;AAElB,OAAO,MAAMC,mBAAA,GAAoDA,CAAC;EAChEC,SAAS;EACTC,eAAe;EACf,GAAGC;AAAA,CACJ;EACC,IAAIF,SAAA,EAAW;IACb,MAAMD,mBAAA,GAAiCI,WAAA;MACrC,MAAMC,wBAAA,GAA2B;QAC/B,GAAGD,WAAW;QACd,IAAIN,gCAAA,CAAiCG,SAAA,IAAcC,eAAA,IAAmB,CAAC,IAAK,CAAC,CAAC;MAChF;MAEA,oBAAOI,IAAA,CAACL,SAAA;QAAW,GAAGI;;IACxB;IAEA,oBAAOC,IAAA,CAACN,mBAAA;MAAqB,GAAGG;;EAClC;EAEA,OAAO;AACT","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["isReactServerComponentOrFunction","React","WithServerSideProps","Component","serverOnlyProps","rest","passedProps","propsWithServerOnlyProps","_jsx"],"sources":["../../../src/elements/WithServerSideProps/index.tsx"],"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"],"mappings":";AAEA,SAASA,gCAAgC,QAAQ;AACjD,OAAOC,KAAA,MAAW;AAElB,OAAO,MAAMC,mBAAA,GAAoDA,CAAC;EAChEC,SAAS;EACTC,eAAe;EACf,GAAGC;AAAA,CACJ;EACC,IAAIF,SAAA,EAAW;IACb,MAAMD,mBAAA,GAAiCI,WAAA;MACrC,MAAMC,wBAAA,GAA2B;QAC/B,GAAGD,WAAW;QACd,IAAIN,gCAAA,CAAiCG,SAAA,IAAcC,eAAA,IAAmB,CAAC,IAAK,CAAC,CAAC;MAChF;MAEA,oBAAOI,IAAA,CAACL,SAAA;QAAW,GAAGI;;IACxB;IAEA,OAAOL,mBAAA,CAAoB;MAAE,GAAGG;IAAK;EACvC;EAEA,OAAO;AACT","ignoreList":[]}
@@ -1,6 +1,6 @@
1
- var R=e=>{let t=o=>o.type!=="ui"&&o.admin?.disabled===!0||o?.admin?.disableListColumn===!0;return e?.reduce((o,n)=>{if(t(n))return o;let i=n.type==="tabs"&&"tabs"in n?{...n,tabs:n.tabs.map(s=>({...s,fields:s.fields.filter(a=>!t(a))}))}:n;return[...o,i]},[])};import{fieldAffectsData as b}from"payload/shared";var f=(e,t)=>e?.reduce((r,o)=>b(o)&&o.name===t?r:!b(o)&&"fields"in o?[...r,...f(o.fields,t)]:o.type==="tabs"&&"tabs"in o?[...r,...o.tabs.reduce((n,i)=>[...n,..."name"in i?[i.name]:f(i.fields,t)],[])]:[...r,o.name],[]),L=(e,t,r)=>{let o=[];if(Array.isArray(r)&&r.length>=1)o=r;else{t&&o.push(t);let n=f(e,t);o=o.concat(n),o=o.slice(0,4)}return o.map(n=>({accessor:n,active:!0}))};import*as m from"react";var x=({elements:e,translationString:t})=>{let r=/(<[^>]+>.*?<\/[^>]+>)/g,o=t.split(r);return m.createElement("span",null,o.map((n,i)=>{if(e&&n.startsWith("<")&&n.endsWith(">")){let s=n[1],a=e[s];if(a){let d=new RegExp(`<${s}>(.*?)</${s}>`,"g"),p=n.replace(d,(c,P)=>P);return m.createElement(a,{key:i},m.createElement(x,{translationString:p}))}}return n}))},T=({elements:e,i18nKey:t,t:r,variables:o})=>{let n=r(t,o||{});return e?m.createElement(x,{elements:e,translationString:n}):n};import{isReactServerComponentOrFunction as I,serverProps as M}from"payload/shared";import w from"react";function k({Component:e,sanitizeServerOnlyProps:t,toMergeIntoProps:r}){return t===void 0&&(t=!I(e)),n=>{let i=A(n,r);return t&&M.forEach(s=>{delete i[s]}),w.createElement(e,{...i})}}function A(e,t){return{...e,...t}}import{isReactServerComponentOrFunction as D}from"payload/shared";import v from"react";var z=({Component:e,serverOnlyProps:t,...r})=>e?v.createElement(n=>{let i={...n,...D(e)?t??{}:{}};return v.createElement(e,{...i})},{...r}):null;var O=e=>({...e?.admin?.style||{},...e?.admin?.width?{"--field-width":e.admin.width}:{flex:"1 1 auto"},...e?.admin?.style?.flex?{flex:e.admin.style.flex}:{}});import{deepCopyObjectComplex as Z}from"payload/shared";var N=["validate","customComponents"],$=e=>{let t=Z(e);return N.forEach(r=>{delete t[r]}),t},B=e=>Object.keys(e).reduce((t,r)=>(t[r]=$(e[r]),t),{});import h from"react";var E=({fill:e})=>{let t=e||"var(--theme-elevation-1000)";return h.createElement("svg",{className:"graphic-icon",height:"100%",viewBox:"0 0 25 25",width:"100%",xmlns:"http://www.w3.org/2000/svg"},h.createElement("path",{d:"M11.8673 21.2336L4.40922 16.9845C4.31871 16.9309 4.25837 16.8355 4.25837 16.7282V10.1609C4.25837 10.0477 4.38508 9.97616 4.48162 10.0298L13.1404 14.9642C13.2611 15.0358 13.412 14.9464 13.412 14.8093V11.6091C13.412 11.4839 13.3456 11.3647 13.2309 11.2992L2.81624 5.36353C2.72573 5.30989 2.60505 5.30989 2.51454 5.36353L1.15085 6.14422C1.06034 6.19786 1 6.29321 1 6.40048V18.5995C1 18.7068 1.06034 18.8021 1.15085 18.8558L11.8491 24.9583C11.9397 25.0119 12.0603 25.0119 12.1509 24.9583L21.1355 19.8331C21.2562 19.7616 21.2562 19.5948 21.1355 19.5232L18.3357 17.9261C18.2211 17.8605 18.0883 17.8605 17.9737 17.9261L12.175 21.2336C12.0845 21.2872 11.9638 21.2872 11.8733 21.2336H11.8673Z",fill:t}),h.createElement("path",{d:"M22.8491 6.13827L12.1508 0.0417218C12.0603 -0.0119135 11.9397 -0.0119135 11.8491 0.0417218L6.19528 3.2658C6.0746 3.33731 6.0746 3.50418 6.19528 3.57569L8.97092 5.16091C9.08557 5.22647 9.21832 5.22647 9.33296 5.16091L11.8672 3.71872C11.9578 3.66508 12.0784 3.66508 12.1689 3.71872L19.627 7.96782C19.7175 8.02146 19.7778 8.11681 19.7778 8.22408V14.8212C19.7778 14.9464 19.8442 15.0656 19.9589 15.1311L22.7345 16.7104C22.8552 16.7819 23.006 16.6925 23.006 16.5554V6.40048C23.006 6.29321 22.9457 6.19786 22.8552 6.14423L22.8491 6.13827Z",fill:t}))};import l from"react";var U=`
1
+ var P=e=>{let t=o=>o.type!=="ui"&&o.admin?.disabled===!0||o?.admin?.disableListColumn===!0;return e?.reduce((o,n)=>{if(t(n))return o;let i=n.type==="tabs"&&"tabs"in n?{...n,tabs:n.tabs.map(s=>({...s,fields:s.fields.filter(a=>!t(a))}))}:n;return[...o,i]},[])};import{fieldAffectsData as b}from"payload/shared";var f=(e,t)=>e?.reduce((r,o)=>b(o)&&o.name===t?r:!b(o)&&"fields"in o?[...r,...f(o.fields,t)]:o.type==="tabs"&&"tabs"in o?[...r,...o.tabs.reduce((n,i)=>[...n,..."name"in i?[i.name]:f(i.fields,t)],[])]:[...r,o.name],[]),R=(e,t,r)=>{let o=[];if(Array.isArray(r)&&r.length>=1)o=r;else{t&&o.push(t);let n=f(e,t);o=o.concat(n),o=o.slice(0,4)}return o.map(n=>({accessor:n,active:!0}))};import*as m from"react";var x=({elements:e,translationString:t})=>{let r=/(<[^>]+>.*?<\/[^>]+>)/g,o=t.split(r);return m.createElement("span",null,o.map((n,i)=>{if(e&&n.startsWith("<")&&n.endsWith(">")){let s=n[1],a=e[s];if(a){let d=new RegExp(`<${s}>(.*?)</${s}>`,"g"),p=n.replace(d,(c,F)=>F);return m.createElement(a,{key:i},m.createElement(x,{translationString:p}))}}return n}))},L=({elements:e,i18nKey:t,t:r,variables:o})=>{let n=r(t,o||{});return e?m.createElement(x,{elements:e,translationString:n}):n};import{isReactServerComponentOrFunction as T,serverProps as I}from"payload/shared";import M from"react";function w({Component:e,sanitizeServerOnlyProps:t,toMergeIntoProps:r}){return t===void 0&&(t=!T(e)),n=>{let i=k(n,r);return t&&I.forEach(s=>{delete i[s]}),M.createElement(e,{...i})}}function k(e,t){return{...e,...t}}import{isReactServerComponentOrFunction as A}from"payload/shared";import D from"react";var z=({Component:e,serverOnlyProps:t,...r})=>e?(n=>{let i={...n,...A(e)?t??{}:{}};return D.createElement(e,{...i})})({...r}):null;var O=e=>({...e?.admin?.style||{},...e?.admin?.width?{"--field-width":e.admin.width}:{flex:"1 1 auto"},...e?.admin?.style?.flex?{flex:e.admin.style.flex}:{}});import{deepCopyObjectComplex as Z}from"payload/shared";var N=["validate","customComponents"],$=e=>{let t=Z(e);return N.forEach(r=>{delete t[r]}),t},B=e=>Object.keys(e).reduce((t,r)=>(t[r]=$(e[r]),t),{});import h from"react";var E=({fill:e})=>{let t=e||"var(--theme-elevation-1000)";return h.createElement("svg",{className:"graphic-icon",height:"100%",viewBox:"0 0 25 25",width:"100%",xmlns:"http://www.w3.org/2000/svg"},h.createElement("path",{d:"M11.8673 21.2336L4.40922 16.9845C4.31871 16.9309 4.25837 16.8355 4.25837 16.7282V10.1609C4.25837 10.0477 4.38508 9.97616 4.48162 10.0298L13.1404 14.9642C13.2611 15.0358 13.412 14.9464 13.412 14.8093V11.6091C13.412 11.4839 13.3456 11.3647 13.2309 11.2992L2.81624 5.36353C2.72573 5.30989 2.60505 5.30989 2.51454 5.36353L1.15085 6.14422C1.06034 6.19786 1 6.29321 1 6.40048V18.5995C1 18.7068 1.06034 18.8021 1.15085 18.8558L11.8491 24.9583C11.9397 25.0119 12.0603 25.0119 12.1509 24.9583L21.1355 19.8331C21.2562 19.7616 21.2562 19.5948 21.1355 19.5232L18.3357 17.9261C18.2211 17.8605 18.0883 17.8605 17.9737 17.9261L12.175 21.2336C12.0845 21.2872 11.9638 21.2872 11.8733 21.2336H11.8673Z",fill:t}),h.createElement("path",{d:"M22.8491 6.13827L12.1508 0.0417218C12.0603 -0.0119135 11.9397 -0.0119135 11.8491 0.0417218L6.19528 3.2658C6.0746 3.33731 6.0746 3.50418 6.19528 3.57569L8.97092 5.16091C9.08557 5.22647 9.21832 5.22647 9.33296 5.16091L11.8672 3.71872C11.9578 3.66508 12.0784 3.66508 12.1689 3.71872L19.627 7.96782C19.7175 8.02146 19.7778 8.11681 19.7778 8.22408V14.8212C19.7778 14.9464 19.8442 15.0656 19.9589 15.1311L22.7345 16.7104C22.8552 16.7819 23.006 16.6925 23.006 16.5554V6.40048C23.006 6.29321 22.9457 6.19786 22.8552 6.14423L22.8491 6.13827Z",fill:t}))};import l from"react";var U=`
2
2
  .graphic-logo path {
3
3
  fill: var(--theme-elevation-1000);
4
4
  }
5
- `,q=()=>l.createElement("svg",{className:"graphic-logo",fill:"none",height:"43.5",id:"b",viewBox:"0 0 193.38 43.5",width:"193.38",xmlns:"http://www.w3.org/2000/svg"},l.createElement("style",null,U),l.createElement("g",{id:"c"},l.createElement("path",{d:"M18.01,35.63l-12.36-7.13c-.15-.09-.25-.25-.25-.43v-11.02c0-.19.21-.31.37-.22l14.35,8.28c.2.12.45-.03.45-.26v-5.37c0-.21-.11-.41-.3-.52L3.01,9c-.15-.09-.35-.09-.5,0l-2.26,1.31c-.15.09-.25.25-.25.43v20.47c0,.18.1.34.25.43l17.73,10.24c.15.09.35.09.5,0l14.89-8.6c.2-.12.2-.4,0-.52l-4.64-2.68c-.19-.11-.41-.11-.6,0l-9.61,5.55c-.15.09-.35.09-.5,0Z"}),l.createElement("path",{d:"M36.21,10.3L18.48.07c-.15-.09-.35-.09-.5,0l-9.37,5.41c-.2.12-.2.4,0,.52l4.6,2.66c.19.11.41.11.6,0l4.2-2.42c.15-.09.35-.09.5,0l12.36,7.13c.15.09.25.25.25.43v11.07c0,.21.11.41.3.52l4.6,2.65c.2.12.45-.03.45-.26V10.74c0-.18-.1-.34-.25-.43Z"}),l.createElement("g",{id:"d"},l.createElement("path",{d:"M193.38,9.47c0,1.94-1.48,3.32-3.3,3.32s-3.31-1.39-3.31-3.32,1.49-3.31,3.31-3.31,3.3,1.39,3.3,3.31ZM192.92,9.47c0-1.68-1.26-2.88-2.84-2.88s-2.84,1.2-2.84,2.88,1.26,2.89,2.84,2.89,2.84-1.2,2.84-2.89ZM188.69,11.17v-3.51h1.61c.85,0,1.35.39,1.35,1.15,0,.53-.3.86-.67,1.02l.79,1.35h-.89l-.72-1.22h-.64v1.22h-.82ZM190.18,9.31c.46,0,.64-.16.64-.5s-.19-.49-.64-.49h-.67v.99h.67Z"}),l.createElement("path",{d:"M54.72,24.84v10.93h-5.4V6.1h12.26c7.02,0,11.1,3.2,11.1,9.39s-4.07,9.35-11.06,9.35h-6.9,0ZM61.12,20.52c4.07,0,6.11-1.66,6.11-5.03s-2.04-5.03-6.11-5.03h-6.4v10.06h6.4Z"}),l.createElement("path",{d:"M85.94,32.45c-1,2.41-3.66,3.78-7.02,3.78-4.11,0-7.11-2.29-7.11-6.11,0-4.24,3.32-5.98,7.61-6.48l6.32-.71v-1c0-2.58-1.58-3.82-3.99-3.82s-3.74,1.29-3.91,3.24h-5.11c.46-4.53,3.99-7.19,9.18-7.19,5.74,0,9.02,2.7,9.02,8.19v8.15c0,1.95.08,3.58.42,5.28h-5.11c-.21-1.16-.29-2.29-.29-3.32h0ZM85.73,27.58v-1.29l-4.7.54c-2.24.29-3.95.79-3.95,2.99,0,1.66,1.16,2.7,3.28,2.7,2.74,0,5.36-1.62,5.36-4.95h0Z"}),l.createElement("path",{d:"M90.39,14.66h5.4l5.86,15.92h.08l5.57-15.92h5.28l-8.23,21.49c-2,5.28-4.45,7.32-8.89,7.36-.71,0-1.7-.08-2.45-.21v-4.03c.62.13.96.13,1.41.13,2.16,0,3.07-.75,4.2-3.66l-8.23-21.07h0Z"}),l.createElement("path",{d:"M113.46,35.77V6.1h5.32v29.67h-5.32Z"}),l.createElement("path",{d:"M130.79,36.27c-6.23,0-10.68-4.2-10.68-11.05s4.45-11.05,10.68-11.05,10.68,4.24,10.68,11.05-4.45,11.05-10.68,11.05ZM130.79,32.32c3.41,0,5.36-2.66,5.36-7.11s-1.95-7.11-5.36-7.11-5.36,2.7-5.36,7.11,1.91,7.11,5.36,7.11Z"}),l.createElement("path",{d:"M156.19,32.45c-1,2.41-3.66,3.78-7.02,3.78-4.11,0-7.11-2.29-7.11-6.11,0-4.24,3.32-5.98,7.61-6.48l6.32-.71v-1c0-2.58-1.58-3.82-3.99-3.82s-3.74,1.29-3.91,3.24h-5.11c.46-4.53,3.99-7.19,9.19-7.19,5.74,0,9.02,2.7,9.02,8.19v8.15c0,1.95.08,3.58.42,5.28h-5.11c-.21-1.16-.29-2.29-.29-3.32h0ZM155.98,27.58v-1.29l-4.7.54c-2.24.29-3.95.79-3.95,2.99,0,1.66,1.16,2.7,3.28,2.7,2.74,0,5.36-1.62,5.36-4.95h0Z"}),l.createElement("path",{d:"M178.5,32.41c-1.04,2.12-3.58,3.87-6.78,3.87-5.53,0-9.31-4.49-9.31-11.05s3.78-11.05,9.31-11.05c3.28,0,5.69,1.83,6.69,3.95V6.1h5.32v29.67h-5.24v-3.37h0ZM178.55,24.84c0-4.11-1.95-6.78-5.32-6.78s-5.45,2.83-5.45,7.15,2,7.15,5.45,7.15,5.32-2.66,5.32-6.78v-.75h0Z"}))));function j(e){if(e)try{e.abort()}catch{}}import*as S from"qs-esm";var V={delete:(e,t={headers:{}})=>{let r=t&&t.headers?{...t.headers}:{},o={...t,credentials:"include",headers:{...r},method:"delete"};return fetch(e,o)},get:(e,t={headers:{}})=>{let r="";return t.params&&(r=S.stringify(t.params,{addQueryPrefix:!0})),fetch(`${e}${r}`,{credentials:"include",...t})},patch:(e,t={headers:{}})=>{let r=t&&t.headers?{...t.headers}:{},o={...t,credentials:"include",headers:{...r},method:"PATCH"};return fetch(e,o)},post:(e,t={headers:{}})=>{let r=t&&t.headers?{...t.headers}:{},o={...t,credentials:"include",headers:{...r},method:"post"};return fetch(`${e}`,o)},put:(e,t={headers:{}})=>{let r=t&&t.headers?{...t.headers}:{},o={...t,credentials:"include",headers:{...r},method:"put"};return fetch(e,o)}};var K=(e,t)=>!e?.locales||e.locales.length===0?null:e.locales.find(r=>r?.code===t);var u=e=>{let{adminRoute:t,basePath:r="",path:o,serverURL:n}=e;if(t)if(t==="/"){if(!o)return`${n||""}${r}${t}`}else return`${n||""}${r}${t}${o}`;return`${n||""}${r}${o}`};import{format as G,formatDistanceToNow as Le}from"date-fns";var g=({date:e,i18n:t,pattern:r})=>{let o=new Date(e);return G(o,r,{locale:t.dateFNS})};import{getTranslation as W}from"@payloadcms/translations";var Q=({collectionConfig:e,data:t,dateFormat:r,fallback:o,globalConfig:n,i18n:i})=>{let s;if(e){let a=e?.admin?.useAsTitle;if(a&&(s=t?.[a]||s,s)){let d=e.fields.find(c=>"name"in c&&c.name===a);if(d?.type==="date"){let c="date"in d.admin&&d?.admin?.date?.displayFormat||r;s=g({date:s,i18n:i,pattern:c})||s}}}return n&&(s=W(n?.label,i)||n?.slug),s||(s=o||`[${i.t("general:untitled")}]`),s};import{getTranslation as y}from"@payloadcms/translations";var F=(r=>(r.collection="collections",r.global="globals",r))(F||{});function H(e,t,r){return e.reduce((n,i)=>{if(t?.[i.type.toLowerCase()]?.[i.entity.slug]?.read){let s=y(i.entity.admin.group,r);if(i.entity.admin.group){let a=n.find(p=>y(p.label,r)===s),d=a;a||(d={entities:[],label:s},n.push(d)),d.entities.push({slug:i.entity.slug,type:i.type,label:"labels"in i.entity?typeof i.entity.labels.plural=="function"?i.entity.labels.plural({t:r.t}):i.entity.labels.plural:i.entity.label})}else n.find(d=>y(d.label,r)===r.t(`general:${i.type}`)).entities.push({slug:i.entity.slug,type:i.type,label:"labels"in i.entity?typeof i.entity.labels.plural=="function"?i.entity.labels.plural({t:r.t}):i.entity.labels.plural:i.entity.label})}return n},[{entities:[],label:r.t("general:collections")},{entities:[],label:r.t("general:globals")}]).filter(n=>n.entities.length>0)}var _=({adminRoute:e,router:t})=>{let r=u({adminRoute:e,path:"/"});t.push(r)};var J=({adminRoute:e,collectionSlug:t,router:r})=>{let o=u({adminRoute:e,path:t?`/collections/${t}`:"/"});r.push(o)};var X=(e,t,r,o,n,i,s,a,d,p)=>{if(d)try{i(e,t??r,o),n||(a.current.hasShownLockedModal=!0),a.current={hasShownLockedModal:a.current?.hasShownLockedModal,isLocked:!0,user:o},s(o),n&&p&&p(!1)}catch(c){console.error("Error during document takeover:",c)}};var Y=e=>{let{collectionSlug:t,docPermissions:r,globalSlug:o,isEditing:n}=e;return t?!!(n&&r?.update||!n&&r?.create):o?!!r?.update:!1};var ee=e=>e&&typeof e=="object";var te=({id:e,collectionSlug:t,globalSlug:r})=>!!(r||t&&e);var C=e=>Object.keys(e).length===0,re=(e,t)=>C(t)?e:C(e)?t:("and"in e?e.and.push(t):"or"in e?e={and:[e,t]}:e={and:[e,t]},e),oe=({collectionConfig:e,search:t,where:r})=>{if(t){let o={...r||{}},n=(e.admin.listSearchableFields||[e.admin?.useAsTitle||"id"]).map(i=>({[i]:{like:t}}));n.length>0&&(o=re(o,{or:n})),C(o)||(r=o)}return r};export{F as EntityType,E as PayloadIcon,q as PayloadLogo,T as Translation,z as WithServerSideProps,j as abortAndIgnore,R as filterFields,K as findLocaleFromCode,u as formatAdminURL,g as formatDate,Q as formatDocTitle,L as getInitialColumns,H as groupNavItems,_ as handleBackToDashboard,J as handleGoBack,X as handleTakeOver,Y as hasSavePermission,ee as isClientUserObject,te as isEditing,O as mergeFieldStyles,oe as mergeListSearchAndWhere,B as reduceToSerializableFields,V as requests,k as withMergedProps};
5
+ `,q=()=>l.createElement("svg",{className:"graphic-logo",fill:"none",height:"43.5",id:"b",viewBox:"0 0 193.38 43.5",width:"193.38",xmlns:"http://www.w3.org/2000/svg"},l.createElement("style",null,U),l.createElement("g",{id:"c"},l.createElement("path",{d:"M18.01,35.63l-12.36-7.13c-.15-.09-.25-.25-.25-.43v-11.02c0-.19.21-.31.37-.22l14.35,8.28c.2.12.45-.03.45-.26v-5.37c0-.21-.11-.41-.3-.52L3.01,9c-.15-.09-.35-.09-.5,0l-2.26,1.31c-.15.09-.25.25-.25.43v20.47c0,.18.1.34.25.43l17.73,10.24c.15.09.35.09.5,0l14.89-8.6c.2-.12.2-.4,0-.52l-4.64-2.68c-.19-.11-.41-.11-.6,0l-9.61,5.55c-.15.09-.35.09-.5,0Z"}),l.createElement("path",{d:"M36.21,10.3L18.48.07c-.15-.09-.35-.09-.5,0l-9.37,5.41c-.2.12-.2.4,0,.52l4.6,2.66c.19.11.41.11.6,0l4.2-2.42c.15-.09.35-.09.5,0l12.36,7.13c.15.09.25.25.25.43v11.07c0,.21.11.41.3.52l4.6,2.65c.2.12.45-.03.45-.26V10.74c0-.18-.1-.34-.25-.43Z"}),l.createElement("g",{id:"d"},l.createElement("path",{d:"M193.38,9.47c0,1.94-1.48,3.32-3.3,3.32s-3.31-1.39-3.31-3.32,1.49-3.31,3.31-3.31,3.3,1.39,3.3,3.31ZM192.92,9.47c0-1.68-1.26-2.88-2.84-2.88s-2.84,1.2-2.84,2.88,1.26,2.89,2.84,2.89,2.84-1.2,2.84-2.89ZM188.69,11.17v-3.51h1.61c.85,0,1.35.39,1.35,1.15,0,.53-.3.86-.67,1.02l.79,1.35h-.89l-.72-1.22h-.64v1.22h-.82ZM190.18,9.31c.46,0,.64-.16.64-.5s-.19-.49-.64-.49h-.67v.99h.67Z"}),l.createElement("path",{d:"M54.72,24.84v10.93h-5.4V6.1h12.26c7.02,0,11.1,3.2,11.1,9.39s-4.07,9.35-11.06,9.35h-6.9,0ZM61.12,20.52c4.07,0,6.11-1.66,6.11-5.03s-2.04-5.03-6.11-5.03h-6.4v10.06h6.4Z"}),l.createElement("path",{d:"M85.94,32.45c-1,2.41-3.66,3.78-7.02,3.78-4.11,0-7.11-2.29-7.11-6.11,0-4.24,3.32-5.98,7.61-6.48l6.32-.71v-1c0-2.58-1.58-3.82-3.99-3.82s-3.74,1.29-3.91,3.24h-5.11c.46-4.53,3.99-7.19,9.18-7.19,5.74,0,9.02,2.7,9.02,8.19v8.15c0,1.95.08,3.58.42,5.28h-5.11c-.21-1.16-.29-2.29-.29-3.32h0ZM85.73,27.58v-1.29l-4.7.54c-2.24.29-3.95.79-3.95,2.99,0,1.66,1.16,2.7,3.28,2.7,2.74,0,5.36-1.62,5.36-4.95h0Z"}),l.createElement("path",{d:"M90.39,14.66h5.4l5.86,15.92h.08l5.57-15.92h5.28l-8.23,21.49c-2,5.28-4.45,7.32-8.89,7.36-.71,0-1.7-.08-2.45-.21v-4.03c.62.13.96.13,1.41.13,2.16,0,3.07-.75,4.2-3.66l-8.23-21.07h0Z"}),l.createElement("path",{d:"M113.46,35.77V6.1h5.32v29.67h-5.32Z"}),l.createElement("path",{d:"M130.79,36.27c-6.23,0-10.68-4.2-10.68-11.05s4.45-11.05,10.68-11.05,10.68,4.24,10.68,11.05-4.45,11.05-10.68,11.05ZM130.79,32.32c3.41,0,5.36-2.66,5.36-7.11s-1.95-7.11-5.36-7.11-5.36,2.7-5.36,7.11,1.91,7.11,5.36,7.11Z"}),l.createElement("path",{d:"M156.19,32.45c-1,2.41-3.66,3.78-7.02,3.78-4.11,0-7.11-2.29-7.11-6.11,0-4.24,3.32-5.98,7.61-6.48l6.32-.71v-1c0-2.58-1.58-3.82-3.99-3.82s-3.74,1.29-3.91,3.24h-5.11c.46-4.53,3.99-7.19,9.19-7.19,5.74,0,9.02,2.7,9.02,8.19v8.15c0,1.95.08,3.58.42,5.28h-5.11c-.21-1.16-.29-2.29-.29-3.32h0ZM155.98,27.58v-1.29l-4.7.54c-2.24.29-3.95.79-3.95,2.99,0,1.66,1.16,2.7,3.28,2.7,2.74,0,5.36-1.62,5.36-4.95h0Z"}),l.createElement("path",{d:"M178.5,32.41c-1.04,2.12-3.58,3.87-6.78,3.87-5.53,0-9.31-4.49-9.31-11.05s3.78-11.05,9.31-11.05c3.28,0,5.69,1.83,6.69,3.95V6.1h5.32v29.67h-5.24v-3.37h0ZM178.55,24.84c0-4.11-1.95-6.78-5.32-6.78s-5.45,2.83-5.45,7.15,2,7.15,5.45,7.15,5.32-2.66,5.32-6.78v-.75h0Z"}))));function j(e){if(e)try{e.abort()}catch{}}import*as v from"qs-esm";var V={delete:(e,t={headers:{}})=>{let r=t&&t.headers?{...t.headers}:{},o={...t,credentials:"include",headers:{...r},method:"delete"};return fetch(e,o)},get:(e,t={headers:{}})=>{let r="";return t.params&&(r=v.stringify(t.params,{addQueryPrefix:!0})),fetch(`${e}${r}`,{credentials:"include",...t})},patch:(e,t={headers:{}})=>{let r=t&&t.headers?{...t.headers}:{},o={...t,credentials:"include",headers:{...r},method:"PATCH"};return fetch(e,o)},post:(e,t={headers:{}})=>{let r=t&&t.headers?{...t.headers}:{},o={...t,credentials:"include",headers:{...r},method:"post"};return fetch(`${e}`,o)},put:(e,t={headers:{}})=>{let r=t&&t.headers?{...t.headers}:{},o={...t,credentials:"include",headers:{...r},method:"put"};return fetch(e,o)}};var K=(e,t)=>!e?.locales||e.locales.length===0?null:e.locales.find(r=>r?.code===t);var u=e=>{let{adminRoute:t,basePath:r="",path:o,serverURL:n}=e;if(t)if(t==="/"){if(!o)return`${n||""}${r}${t}`}else return`${n||""}${r}${t}${o}`;return`${n||""}${r}${o}`};import{format as G,formatDistanceToNow as Le}from"date-fns";var g=({date:e,i18n:t,pattern:r})=>{let o=new Date(e);return G(o,r,{locale:t.dateFNS})};import{getTranslation as W}from"@payloadcms/translations";var Q=({collectionConfig:e,data:t,dateFormat:r,fallback:o,globalConfig:n,i18n:i})=>{let s;if(e){let a=e?.admin?.useAsTitle;if(a&&(s=t?.[a]||s,s)){let d=e.fields.find(c=>"name"in c&&c.name===a);if(d?.type==="date"){let c="date"in d.admin&&d?.admin?.date?.displayFormat||r;s=g({date:s,i18n:i,pattern:c})||s}}}return n&&(s=W(n?.label,i)||n?.slug),s||(s=o||`[${i.t("general:untitled")}]`),s};import{getTranslation as y}from"@payloadcms/translations";var S=(r=>(r.collection="collections",r.global="globals",r))(S||{});function H(e,t,r){return e.reduce((n,i)=>{if(t?.[i.type.toLowerCase()]?.[i.entity.slug]?.read){let s=y(i.entity.admin.group,r);if(i.entity.admin.group){let a=n.find(p=>y(p.label,r)===s),d=a;a||(d={entities:[],label:s},n.push(d)),d.entities.push({slug:i.entity.slug,type:i.type,label:"labels"in i.entity?typeof i.entity.labels.plural=="function"?i.entity.labels.plural({t:r.t}):i.entity.labels.plural:i.entity.label})}else n.find(d=>y(d.label,r)===r.t(`general:${i.type}`)).entities.push({slug:i.entity.slug,type:i.type,label:"labels"in i.entity?typeof i.entity.labels.plural=="function"?i.entity.labels.plural({t:r.t}):i.entity.labels.plural:i.entity.label})}return n},[{entities:[],label:r.t("general:collections")},{entities:[],label:r.t("general:globals")}]).filter(n=>n.entities.length>0)}var _=({adminRoute:e,router:t})=>{let r=u({adminRoute:e,path:"/"});t.push(r)};var J=({adminRoute:e,collectionSlug:t,router:r})=>{let o=u({adminRoute:e,path:t?`/collections/${t}`:"/"});r.push(o)};var X=(e,t,r,o,n,i,s,a,d,p)=>{if(d)try{i(e,t??r,o),n||(a.current.hasShownLockedModal=!0),a.current={hasShownLockedModal:a.current?.hasShownLockedModal,isLocked:!0,user:o},s(o),n&&p&&p(!1)}catch(c){console.error("Error during document takeover:",c)}};var Y=e=>{let{collectionSlug:t,docPermissions:r,globalSlug:o,isEditing:n}=e;return t?!!(n&&r?.update||!n&&r?.create):o?!!r?.update:!1};var ee=e=>e&&typeof e=="object";var te=({id:e,collectionSlug:t,globalSlug:r})=>!!(r||t&&e);var C=e=>Object.keys(e).length===0,re=(e,t)=>C(t)?e:C(e)?t:("and"in e?e.and.push(t):"or"in e?e={and:[e,t]}:e={and:[e,t]},e),oe=({collectionConfig:e,search:t,where:r})=>{if(t){let o={...r||{}},n=(e.admin.listSearchableFields||[e.admin?.useAsTitle||"id"]).map(i=>({[i]:{like:t}}));n.length>0&&(o=re(o,{or:n})),C(o)||(r=o)}return r};export{S as EntityType,E as PayloadIcon,q as PayloadLogo,L as Translation,z as WithServerSideProps,j as abortAndIgnore,P as filterFields,K as findLocaleFromCode,u as formatAdminURL,g as formatDate,Q as formatDocTitle,R as getInitialColumns,H as groupNavItems,_ as handleBackToDashboard,J as handleGoBack,X as handleTakeOver,Y as hasSavePermission,ee as isClientUserObject,te as isEditing,O as mergeFieldStyles,oe as mergeListSearchAndWhere,B as reduceToSerializableFields,V as requests,w as withMergedProps};
6
6
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/elements/TableColumns/filterFields.tsx", "../../../src/elements/TableColumns/getInitialColumns.ts", "../../../src/elements/Translation/index.tsx", "../../../src/elements/withMergedProps/index.tsx", "../../../src/elements/WithServerSideProps/index.tsx", "../../../src/fields/mergeFieldStyles.ts", "../../../src/forms/Form/reduceToSerializableFields.ts", "../../../src/graphics/Icon/index.tsx", "../../../src/graphics/Logo/index.tsx", "../../../src/utilities/abortAndIgnore.ts", "../../../src/utilities/api.ts", "../../../src/utilities/findLocaleFromCode.ts", "../../../src/utilities/formatAdminURL.ts", "../../../src/utilities/formatDate.ts", "../../../src/utilities/formatDocTitle.ts", "../../../src/utilities/groupNavItems.ts", "../../../src/utilities/handleBackToDashboard.tsx", "../../../src/utilities/handleGoBack.tsx", "../../../src/utilities/handleTakeOver.tsx", "../../../src/utilities/hasSavePermission.ts", "../../../src/utilities/isClientUserObject.ts", "../../../src/utilities/isEditing.ts", "../../../src/utilities/mergeListSearchAndWhere.ts"],
4
- "sourcesContent": ["import type { ClientField, Field } from 'payload'\n\n// 1. Skips fields that are hidden, disabled, or presentational-only (i.e. `ui` fields)\n// 2. Maps through top-level `tabs` fields and filters out the same\nexport const filterFields = <T extends ClientField | Field>(incomingFields: T[]): T[] => {\n const shouldSkipField = (field: T): boolean =>\n (field.type !== 'ui' && field.admin?.disabled === true) ||\n field?.admin?.disableListColumn === true\n\n const fields: T[] = incomingFields?.reduce((formatted, field) => {\n if (shouldSkipField(field)) {\n return formatted\n }\n\n const formattedField: T =\n field.type === 'tabs' && 'tabs' in field\n ? {\n ...field,\n tabs: field.tabs.map((tab) => ({\n ...tab,\n fields: tab.fields.filter((tabField) => !shouldSkipField(tabField)),\n })),\n }\n : field\n\n return [...formatted, formattedField]\n }, [])\n\n return fields\n}\n", "import type { ClientField, Field } from 'payload'\n\nimport { fieldAffectsData } from 'payload/shared'\n\nimport type { ColumnPreferences } from '../../providers/ListQuery/index.js'\n\nconst getRemainingColumns = <T extends ClientField[] | Field[]>(\n fields: T,\n useAsTitle: string,\n): ColumnPreferences =>\n fields?.reduce((remaining, field) => {\n if (fieldAffectsData(field) && field.name === useAsTitle) {\n return remaining\n }\n\n if (!fieldAffectsData(field) && 'fields' in field) {\n return [...remaining, ...getRemainingColumns(field.fields, useAsTitle)]\n }\n\n if (field.type === 'tabs' && 'tabs' in field) {\n return [\n ...remaining,\n ...field.tabs.reduce(\n (tabFieldColumns, tab) => [\n ...tabFieldColumns,\n ...('name' in tab ? [tab.name] : getRemainingColumns(tab.fields, useAsTitle)),\n ],\n [],\n ),\n ]\n }\n\n return [...remaining, field.name]\n }, [])\n\nexport const getInitialColumns = <T extends ClientField[] | Field[]>(\n fields: T,\n useAsTitle: string,\n defaultColumns: string[],\n): ColumnPreferences => {\n let initialColumns = []\n\n if (Array.isArray(defaultColumns) && defaultColumns.length >= 1) {\n initialColumns = defaultColumns\n } else {\n if (useAsTitle) {\n initialColumns.push(useAsTitle)\n }\n\n const remainingColumns = getRemainingColumns(fields, useAsTitle)\n\n initialColumns = initialColumns.concat(remainingColumns)\n initialColumns = initialColumns.slice(0, 4)\n }\n\n return initialColumns.map((column) => ({\n accessor: column,\n active: true,\n }))\n}\n", "import type { ClientTranslationKeys, TFunction } from '@payloadcms/translations'\n\nimport * as React from 'react'\n\nconst RecursiveTranslation: React.FC<{\n elements?: Record<string, React.FC<{ children: React.ReactNode }>>\n translationString: string\n}> = ({ elements, translationString }) => {\n const regex = /(<[^>]+>.*?<\\/[^>]+>)/g\n const sections = translationString.split(regex)\n\n return (\n <span>\n {sections.map((section, index) => {\n if (elements && section.startsWith('<') && section.endsWith('>')) {\n const elementKey = section[1]\n const Element = elements[elementKey]\n\n if (Element) {\n const regex = new RegExp(`<${elementKey}>(.*?)<\\/${elementKey}>`, 'g')\n const children = section.replace(regex, (_, group) => group)\n\n return (\n <Element key={index}>\n <RecursiveTranslation translationString={children} />\n </Element>\n )\n }\n }\n\n return section\n })}\n </span>\n )\n}\n\nexport type TranslationProps = {\n elements?: Record<string, React.FC<{ children: React.ReactNode }>>\n i18nKey: ClientTranslationKeys\n t: TFunction\n variables?: Record<string, unknown>\n}\n\nexport const Translation: React.FC<TranslationProps> = ({ elements, i18nKey, t, variables }) => {\n const stringWithVariables = t(i18nKey, variables || {})\n\n if (!elements) {\n return stringWithVariables\n }\n\n return <RecursiveTranslation elements={elements} translationString={stringWithVariables} />\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 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 type { ClientField } from 'payload'\n\nexport const mergeFieldStyles = (\n field: ClientField | Omit<ClientField, 'type'>,\n): React.CSSProperties => ({\n ...(field?.admin?.style || {}),\n ...(field?.admin?.width\n ? {\n '--field-width': field.admin.width,\n }\n : {\n flex: '1 1 auto',\n }),\n // allow flex overrides to still take precedence over the fallback\n ...(field?.admin?.style?.flex\n ? {\n flex: field.admin.style.flex,\n }\n : {}),\n})\n", "import { type FormField, type FormState } from 'payload'\nimport { deepCopyObjectComplex } from 'payload/shared'\n\ntype BlacklistedKeys = 'customComponents' | 'validate'\nconst blacklistedKeys: BlacklistedKeys[] = ['validate', 'customComponents']\n\nconst sanitizeField = (incomingField: FormField): FormField => {\n const field = deepCopyObjectComplex(incomingField)\n\n blacklistedKeys.forEach((key) => {\n delete field[key]\n })\n\n return field\n}\n\n/* \n Takes in FormState and removes fields that are not serializable.\n Returns FormState without blacklisted keys.\n**/\nexport const reduceToSerializableFields = (\n fields: FormState,\n): {\n [key: string]: Omit<FormField, BlacklistedKeys>\n} => {\n return Object.keys(fields).reduce(\n (acc, key) => {\n acc[key] = sanitizeField(fields[key])\n return acc\n },\n {} as {\n [key: string]: Omit<FormField, BlacklistedKeys>\n },\n )\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.8673 21.2336L4.40922 16.9845C4.31871 16.9309 4.25837 16.8355 4.25837 16.7282V10.1609C4.25837 10.0477 4.38508 9.97616 4.48162 10.0298L13.1404 14.9642C13.2611 15.0358 13.412 14.9464 13.412 14.8093V11.6091C13.412 11.4839 13.3456 11.3647 13.2309 11.2992L2.81624 5.36353C2.72573 5.30989 2.60505 5.30989 2.51454 5.36353L1.15085 6.14422C1.06034 6.19786 1 6.29321 1 6.40048V18.5995C1 18.7068 1.06034 18.8021 1.15085 18.8558L11.8491 24.9583C11.9397 25.0119 12.0603 25.0119 12.1509 24.9583L21.1355 19.8331C21.2562 19.7616 21.2562 19.5948 21.1355 19.5232L18.3357 17.9261C18.2211 17.8605 18.0883 17.8605 17.9737 17.9261L12.175 21.2336C12.0845 21.2872 11.9638 21.2872 11.8733 21.2336H11.8673Z\"\n fill={fill}\n />\n <path\n d=\"M22.8491 6.13827L12.1508 0.0417218C12.0603 -0.0119135 11.9397 -0.0119135 11.8491 0.0417218L6.19528 3.2658C6.0746 3.33731 6.0746 3.50418 6.19528 3.57569L8.97092 5.16091C9.08557 5.22647 9.21832 5.22647 9.33296 5.16091L11.8672 3.71872C11.9578 3.66508 12.0784 3.66508 12.1689 3.71872L19.627 7.96782C19.7175 8.02146 19.7778 8.11681 19.7778 8.22408V14.8212C19.7778 14.9464 19.8442 15.0656 19.9589 15.1311L22.7345 16.7104C22.8552 16.7819 23.006 16.6925 23.006 16.5554V6.40048C23.006 6.29321 22.9457 6.19786 22.8552 6.14423L22.8491 6.13827Z\"\n fill={fill}\n />\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=\"43.5\"\n id=\"b\"\n viewBox=\"0 0 193.38 43.5\"\n width=\"193.38\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <style>{css}</style>\n <g id=\"c\">\n <path d=\"M18.01,35.63l-12.36-7.13c-.15-.09-.25-.25-.25-.43v-11.02c0-.19.21-.31.37-.22l14.35,8.28c.2.12.45-.03.45-.26v-5.37c0-.21-.11-.41-.3-.52L3.01,9c-.15-.09-.35-.09-.5,0l-2.26,1.31c-.15.09-.25.25-.25.43v20.47c0,.18.1.34.25.43l17.73,10.24c.15.09.35.09.5,0l14.89-8.6c.2-.12.2-.4,0-.52l-4.64-2.68c-.19-.11-.41-.11-.6,0l-9.61,5.55c-.15.09-.35.09-.5,0Z\" />\n <path d=\"M36.21,10.3L18.48.07c-.15-.09-.35-.09-.5,0l-9.37,5.41c-.2.12-.2.4,0,.52l4.6,2.66c.19.11.41.11.6,0l4.2-2.42c.15-.09.35-.09.5,0l12.36,7.13c.15.09.25.25.25.43v11.07c0,.21.11.41.3.52l4.6,2.65c.2.12.45-.03.45-.26V10.74c0-.18-.1-.34-.25-.43Z\" />\n <g id=\"d\">\n <path d=\"M193.38,9.47c0,1.94-1.48,3.32-3.3,3.32s-3.31-1.39-3.31-3.32,1.49-3.31,3.31-3.31,3.3,1.39,3.3,3.31ZM192.92,9.47c0-1.68-1.26-2.88-2.84-2.88s-2.84,1.2-2.84,2.88,1.26,2.89,2.84,2.89,2.84-1.2,2.84-2.89ZM188.69,11.17v-3.51h1.61c.85,0,1.35.39,1.35,1.15,0,.53-.3.86-.67,1.02l.79,1.35h-.89l-.72-1.22h-.64v1.22h-.82ZM190.18,9.31c.46,0,.64-.16.64-.5s-.19-.49-.64-.49h-.67v.99h.67Z\" />\n <path d=\"M54.72,24.84v10.93h-5.4V6.1h12.26c7.02,0,11.1,3.2,11.1,9.39s-4.07,9.35-11.06,9.35h-6.9,0ZM61.12,20.52c4.07,0,6.11-1.66,6.11-5.03s-2.04-5.03-6.11-5.03h-6.4v10.06h6.4Z\" />\n <path d=\"M85.94,32.45c-1,2.41-3.66,3.78-7.02,3.78-4.11,0-7.11-2.29-7.11-6.11,0-4.24,3.32-5.98,7.61-6.48l6.32-.71v-1c0-2.58-1.58-3.82-3.99-3.82s-3.74,1.29-3.91,3.24h-5.11c.46-4.53,3.99-7.19,9.18-7.19,5.74,0,9.02,2.7,9.02,8.19v8.15c0,1.95.08,3.58.42,5.28h-5.11c-.21-1.16-.29-2.29-.29-3.32h0ZM85.73,27.58v-1.29l-4.7.54c-2.24.29-3.95.79-3.95,2.99,0,1.66,1.16,2.7,3.28,2.7,2.74,0,5.36-1.62,5.36-4.95h0Z\" />\n <path d=\"M90.39,14.66h5.4l5.86,15.92h.08l5.57-15.92h5.28l-8.23,21.49c-2,5.28-4.45,7.32-8.89,7.36-.71,0-1.7-.08-2.45-.21v-4.03c.62.13.96.13,1.41.13,2.16,0,3.07-.75,4.2-3.66l-8.23-21.07h0Z\" />\n <path d=\"M113.46,35.77V6.1h5.32v29.67h-5.32Z\" />\n <path d=\"M130.79,36.27c-6.23,0-10.68-4.2-10.68-11.05s4.45-11.05,10.68-11.05,10.68,4.24,10.68,11.05-4.45,11.05-10.68,11.05ZM130.79,32.32c3.41,0,5.36-2.66,5.36-7.11s-1.95-7.11-5.36-7.11-5.36,2.7-5.36,7.11,1.91,7.11,5.36,7.11Z\" />\n <path d=\"M156.19,32.45c-1,2.41-3.66,3.78-7.02,3.78-4.11,0-7.11-2.29-7.11-6.11,0-4.24,3.32-5.98,7.61-6.48l6.32-.71v-1c0-2.58-1.58-3.82-3.99-3.82s-3.74,1.29-3.91,3.24h-5.11c.46-4.53,3.99-7.19,9.19-7.19,5.74,0,9.02,2.7,9.02,8.19v8.15c0,1.95.08,3.58.42,5.28h-5.11c-.21-1.16-.29-2.29-.29-3.32h0ZM155.98,27.58v-1.29l-4.7.54c-2.24.29-3.95.79-3.95,2.99,0,1.66,1.16,2.7,3.28,2.7,2.74,0,5.36-1.62,5.36-4.95h0Z\" />\n <path d=\"M178.5,32.41c-1.04,2.12-3.58,3.87-6.78,3.87-5.53,0-9.31-4.49-9.31-11.05s3.78-11.05,9.31-11.05c3.28,0,5.69,1.83,6.69,3.95V6.1h5.32v29.67h-5.24v-3.37h0ZM178.55,24.84c0-4.11-1.95-6.78-5.32-6.78s-5.45,2.83-5.45,7.15,2,7.15,5.45,7.15,5.32-2.66,5.32-6.78v-.75h0Z\" />\n </g>\n </g>\n </svg>\n)\n", "export function abortAndIgnore(controller: AbortController) {\n if (controller) {\n try {\n controller.abort()\n } catch (_err) {\n // swallow error\n }\n }\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 { I18nClient } from '@payloadcms/translations'\nimport type {\n SanitizedCollectionConfig,\n SanitizedGlobalConfig,\n SanitizedPermissions,\n StaticLabel,\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: SanitizedCollectionConfig\n type: EntityType.collection\n }\n | {\n entity: SanitizedGlobalConfig\n type: EntityType.global\n }\n\nexport type NavGroupType = {\n entities: {\n label: StaticLabel\n slug: string\n type: EntityType\n }[]\n label: string\n}\n\nexport function groupNavItems(\n entities: EntityToGroup[],\n permissions: SanitizedPermissions,\n i18n: I18nClient,\n): NavGroupType[] {\n const result = entities.reduce(\n (groups, entityToGroup) => {\n if (permissions?.[entityToGroup.type.toLowerCase()]?.[entityToGroup.entity.slug]?.read) {\n const translatedGroup = getTranslation(entityToGroup.entity.admin.group, i18n)\n\n if (entityToGroup.entity.admin.group) {\n const existingGroup = groups.find(\n (group) => getTranslation(group.label, i18n) === translatedGroup,\n ) as NavGroupType\n\n let matchedGroup: NavGroupType = existingGroup\n\n if (!existingGroup) {\n matchedGroup = { entities: [], label: translatedGroup }\n groups.push(matchedGroup)\n }\n\n matchedGroup.entities.push({\n slug: entityToGroup.entity.slug,\n type: entityToGroup.type,\n label:\n 'labels' in entityToGroup.entity\n ? typeof entityToGroup.entity.labels.plural === 'function'\n ? entityToGroup.entity.labels.plural({ t: i18n.t })\n : entityToGroup.entity.labels.plural\n : entityToGroup.entity.label,\n })\n } else {\n const defaultGroup = groups.find((group) => {\n return getTranslation(group.label, i18n) === i18n.t(`general:${entityToGroup.type}`)\n }) as NavGroupType\n defaultGroup.entities.push({\n slug: entityToGroup.entity.slug,\n type: entityToGroup.type,\n label:\n 'labels' in entityToGroup.entity\n ? typeof entityToGroup.entity.labels.plural === 'function'\n ? entityToGroup.entity.labels.plural({ t: i18n.t })\n : entityToGroup.entity.labels.plural\n : entityToGroup.entity.label,\n })\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 { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime.js'\n\nimport { formatAdminURL } from './formatAdminURL.js'\n\ntype BackToDashboardProps = {\n adminRoute: string\n router: AppRouterInstance\n}\n\nexport const handleBackToDashboard = ({ adminRoute, router }: BackToDashboardProps) => {\n const redirectRoute = formatAdminURL({\n adminRoute,\n path: '/',\n })\n router.push(redirectRoute)\n}\n", "import type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime.js'\n\nimport { formatAdminURL } from './formatAdminURL.js'\n\ntype GoBackProps = {\n adminRoute: string\n collectionSlug: string\n router: AppRouterInstance\n}\n\nexport const handleGoBack = ({ adminRoute, collectionSlug, router }: GoBackProps) => {\n const redirectRoute = formatAdminURL({\n adminRoute,\n path: collectionSlug ? `/collections/${collectionSlug}` : '/',\n })\n router.push(redirectRoute)\n}\n", "import type { ClientUser } from 'payload'\n\nexport const handleTakeOver = (\n id: number | string,\n collectionSlug: string,\n globalSlug: string,\n user: ClientUser | number | string,\n isWithinDoc: boolean,\n updateDocumentEditor: (\n docId: number | string,\n slug: string,\n user: ClientUser | number | string,\n ) => Promise<void>,\n setCurrentEditor: (value: React.SetStateAction<ClientUser | number | string>) => void,\n documentLockStateRef: React.RefObject<{\n hasShownLockedModal: boolean\n isLocked: boolean\n user: ClientUser | number | string\n }>,\n isLockingEnabled: boolean,\n setIsReadOnlyForIncomingUser?: (value: React.SetStateAction<boolean>) => void,\n): void => {\n if (!isLockingEnabled) {\n return\n }\n\n try {\n // Call updateDocumentEditor to update the document's owner to the current user\n void updateDocumentEditor(id, collectionSlug ?? globalSlug, user)\n\n if (!isWithinDoc) {\n documentLockStateRef.current.hasShownLockedModal = true\n }\n\n // Update the locked state to reflect the current user as the owner\n documentLockStateRef.current = {\n hasShownLockedModal: documentLockStateRef.current?.hasShownLockedModal,\n isLocked: true,\n user,\n }\n setCurrentEditor(user)\n\n // If this is a takeover within the document, ensure the document is editable\n if (isWithinDoc && setIsReadOnlyForIncomingUser) {\n setIsReadOnlyForIncomingUser(false)\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error during document takeover:', error)\n }\n}\n", "import type {\n SanitizedCollectionPermission,\n SanitizedDocumentPermissions,\n SanitizedGlobalPermission,\n} from 'payload'\n\nexport const hasSavePermission = (args: {\n /*\n * Pass either `collectionSlug` or `globalSlug`\n */\n collectionSlug?: string\n docPermissions: SanitizedDocumentPermissions\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) ||\n (!isEditing && (docPermissions as SanitizedCollectionPermission)?.create),\n )\n }\n\n if (globalSlug) {\n return Boolean((docPermissions as SanitizedGlobalPermission)?.update)\n }\n\n return false\n}\n", "import type { ClientUser } from 'payload'\n\nexport const isClientUserObject = (user): user is ClientUser => {\n return user && typeof user === 'object'\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", "import type { ClientCollectionConfig, SanitizedCollectionConfig, Where } from 'payload'\n\nconst isEmptyObject = (obj: object) => Object.keys(obj).length === 0\n\nexport const hoistQueryParamsToAnd = (currentWhere: Where, incomingWhere: Where) => {\n if (isEmptyObject(incomingWhere)) {\n return currentWhere\n }\n\n if (isEmptyObject(currentWhere)) {\n return incomingWhere\n }\n\n if ('and' in currentWhere) {\n currentWhere.and.push(incomingWhere)\n } else if ('or' in currentWhere) {\n currentWhere = {\n and: [currentWhere, incomingWhere],\n }\n } else {\n currentWhere = {\n and: [currentWhere, incomingWhere],\n }\n }\n\n return currentWhere\n}\n\ntype Args = {\n collectionConfig: ClientCollectionConfig | SanitizedCollectionConfig\n search: string\n where: Where\n}\n\nexport const mergeListSearchAndWhere = ({ collectionConfig, search, where }: Args): Where => {\n if (search) {\n let copyOfWhere = { ...(where || {}) }\n\n const searchAsConditions = (\n collectionConfig.admin.listSearchableFields || [collectionConfig.admin?.useAsTitle || 'id']\n ).map((fieldName) => ({\n [fieldName]: {\n like: search,\n },\n }))\n\n if (searchAsConditions.length > 0) {\n copyOfWhere = hoistQueryParamsToAnd(copyOfWhere, {\n or: searchAsConditions,\n })\n }\n\n if (!isEmptyObject(copyOfWhere)) {\n where = copyOfWhere\n }\n }\n\n return where\n}\n"],
5
- "mappings": "AAIO,IAAMA,EAA+CC,GAA6B,CACvF,IAAMC,EAAmBC,GACtBA,EAAM,OAAS,MAAQA,EAAM,OAAO,WAAa,IAClDA,GAAO,OAAO,oBAAsB,GAqBtC,OAnBoBF,GAAgB,OAAO,CAACG,EAAWD,IAAU,CAC/D,GAAID,EAAgBC,CAAK,EACvB,OAAOC,EA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AO,KAAKA,CAAG,EAAE,SAAW,EAEtDC,GAAwB,CAACC,EAAqBC,IACrDJ,EAAcI,CAAa,EACtBD,EAGLH,EAAcG,CAAY,EACrBC,GAGL,QAASD,EACXA,EAAa,IAAI,KAAKC,CAAa,EAC1B,OAAQD,EACjBA,EAAe,CACb,IAAK,CAACA,EAAcC,CAAa,CACnC,EAEAD,EAAe,CACb,IAAK,CAACA,EAAcC,CAAa,CACnC,EAGKD,GASIE,GAA0B,CAAC,CAAE,iBAAAC,EAAkB,OAAAC,EAAQ,MAAAC,CAAM,IAAmB,CAC3F,GAAID,EAAQ,CACV,IAAIE,EAAc,CAAE,GAAID,GAAS,CAAC,CAAG,EAE/BE,GACJJ,EAAiB,MAAM,sBAAwB,CAACA,EAAiB,OAAO,YAAc,IAAI,GAC1F,IAAKK,IAAe,CACpB,CAACA,CAAS,EAAG,CACX,KAAMJ,CACR,CACF,EAAE,EAEEG,EAAmB,OAAS,IAC9BD,EAAcP,GAAsBO,EAAa,CAC/C,GAAIC,CACN,CAAC,GAGEV,EAAcS,CAAW,IAC5BD,EAAQC,EAEZ,CAEA,OAAOD,CACT",
4
+ "sourcesContent": ["import type { ClientField, Field } from 'payload'\n\n// 1. Skips fields that are hidden, disabled, or presentational-only (i.e. `ui` fields)\n// 2. Maps through top-level `tabs` fields and filters out the same\nexport const filterFields = <T extends ClientField | Field>(incomingFields: T[]): T[] => {\n const shouldSkipField = (field: T): boolean =>\n (field.type !== 'ui' && field.admin?.disabled === true) ||\n field?.admin?.disableListColumn === true\n\n const fields: T[] = incomingFields?.reduce((formatted, field) => {\n if (shouldSkipField(field)) {\n return formatted\n }\n\n const formattedField: T =\n field.type === 'tabs' && 'tabs' in field\n ? {\n ...field,\n tabs: field.tabs.map((tab) => ({\n ...tab,\n fields: tab.fields.filter((tabField) => !shouldSkipField(tabField)),\n })),\n }\n : field\n\n return [...formatted, formattedField]\n }, [])\n\n return fields\n}\n", "import type { ClientField, Field } from 'payload'\n\nimport { fieldAffectsData } from 'payload/shared'\n\nimport type { ColumnPreferences } from '../../providers/ListQuery/index.js'\n\nconst getRemainingColumns = <T extends ClientField[] | Field[]>(\n fields: T,\n useAsTitle: string,\n): ColumnPreferences =>\n fields?.reduce((remaining, field) => {\n if (fieldAffectsData(field) && field.name === useAsTitle) {\n return remaining\n }\n\n if (!fieldAffectsData(field) && 'fields' in field) {\n return [...remaining, ...getRemainingColumns(field.fields, useAsTitle)]\n }\n\n if (field.type === 'tabs' && 'tabs' in field) {\n return [\n ...remaining,\n ...field.tabs.reduce(\n (tabFieldColumns, tab) => [\n ...tabFieldColumns,\n ...('name' in tab ? [tab.name] : getRemainingColumns(tab.fields, useAsTitle)),\n ],\n [],\n ),\n ]\n }\n\n return [...remaining, field.name]\n }, [])\n\nexport const getInitialColumns = <T extends ClientField[] | Field[]>(\n fields: T,\n useAsTitle: string,\n defaultColumns: string[],\n): ColumnPreferences => {\n let initialColumns = []\n\n if (Array.isArray(defaultColumns) && defaultColumns.length >= 1) {\n initialColumns = defaultColumns\n } else {\n if (useAsTitle) {\n initialColumns.push(useAsTitle)\n }\n\n const remainingColumns = getRemainingColumns(fields, useAsTitle)\n\n initialColumns = initialColumns.concat(remainingColumns)\n initialColumns = initialColumns.slice(0, 4)\n }\n\n return initialColumns.map((column) => ({\n accessor: column,\n active: true,\n }))\n}\n", "import type { ClientTranslationKeys, TFunction } from '@payloadcms/translations'\n\nimport * as React from 'react'\n\nconst RecursiveTranslation: React.FC<{\n elements?: Record<string, React.FC<{ children: React.ReactNode }>>\n translationString: string\n}> = ({ elements, translationString }) => {\n const regex = /(<[^>]+>.*?<\\/[^>]+>)/g\n const sections = translationString.split(regex)\n\n return (\n <span>\n {sections.map((section, index) => {\n if (elements && section.startsWith('<') && section.endsWith('>')) {\n const elementKey = section[1]\n const Element = elements[elementKey]\n\n if (Element) {\n const regex = new RegExp(`<${elementKey}>(.*?)<\\/${elementKey}>`, 'g')\n const children = section.replace(regex, (_, group) => group)\n\n return (\n <Element key={index}>\n <RecursiveTranslation translationString={children} />\n </Element>\n )\n }\n }\n\n return section\n })}\n </span>\n )\n}\n\nexport type TranslationProps = {\n elements?: Record<string, React.FC<{ children: React.ReactNode }>>\n i18nKey: ClientTranslationKeys\n t: TFunction\n variables?: Record<string, unknown>\n}\n\nexport const Translation: React.FC<TranslationProps> = ({ elements, i18nKey, t, variables }) => {\n const stringWithVariables = t(i18nKey, variables || {})\n\n if (!elements) {\n return stringWithVariables\n }\n\n return <RecursiveTranslation elements={elements} translationString={stringWithVariables} />\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 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 type { ClientField } from 'payload'\n\nexport const mergeFieldStyles = (\n field: ClientField | Omit<ClientField, 'type'>,\n): React.CSSProperties => ({\n ...(field?.admin?.style || {}),\n ...(field?.admin?.width\n ? {\n '--field-width': field.admin.width,\n }\n : {\n flex: '1 1 auto',\n }),\n // allow flex overrides to still take precedence over the fallback\n ...(field?.admin?.style?.flex\n ? {\n flex: field.admin.style.flex,\n }\n : {}),\n})\n", "import { type FormField, type FormState } from 'payload'\nimport { deepCopyObjectComplex } from 'payload/shared'\n\ntype BlacklistedKeys = 'customComponents' | 'validate'\nconst blacklistedKeys: BlacklistedKeys[] = ['validate', 'customComponents']\n\nconst sanitizeField = (incomingField: FormField): FormField => {\n const field = deepCopyObjectComplex(incomingField)\n\n blacklistedKeys.forEach((key) => {\n delete field[key]\n })\n\n return field\n}\n\n/* \n Takes in FormState and removes fields that are not serializable.\n Returns FormState without blacklisted keys.\n**/\nexport const reduceToSerializableFields = (\n fields: FormState,\n): {\n [key: string]: Omit<FormField, BlacklistedKeys>\n} => {\n return Object.keys(fields).reduce(\n (acc, key) => {\n acc[key] = sanitizeField(fields[key])\n return acc\n },\n {} as {\n [key: string]: Omit<FormField, BlacklistedKeys>\n },\n )\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.8673 21.2336L4.40922 16.9845C4.31871 16.9309 4.25837 16.8355 4.25837 16.7282V10.1609C4.25837 10.0477 4.38508 9.97616 4.48162 10.0298L13.1404 14.9642C13.2611 15.0358 13.412 14.9464 13.412 14.8093V11.6091C13.412 11.4839 13.3456 11.3647 13.2309 11.2992L2.81624 5.36353C2.72573 5.30989 2.60505 5.30989 2.51454 5.36353L1.15085 6.14422C1.06034 6.19786 1 6.29321 1 6.40048V18.5995C1 18.7068 1.06034 18.8021 1.15085 18.8558L11.8491 24.9583C11.9397 25.0119 12.0603 25.0119 12.1509 24.9583L21.1355 19.8331C21.2562 19.7616 21.2562 19.5948 21.1355 19.5232L18.3357 17.9261C18.2211 17.8605 18.0883 17.8605 17.9737 17.9261L12.175 21.2336C12.0845 21.2872 11.9638 21.2872 11.8733 21.2336H11.8673Z\"\n fill={fill}\n />\n <path\n d=\"M22.8491 6.13827L12.1508 0.0417218C12.0603 -0.0119135 11.9397 -0.0119135 11.8491 0.0417218L6.19528 3.2658C6.0746 3.33731 6.0746 3.50418 6.19528 3.57569L8.97092 5.16091C9.08557 5.22647 9.21832 5.22647 9.33296 5.16091L11.8672 3.71872C11.9578 3.66508 12.0784 3.66508 12.1689 3.71872L19.627 7.96782C19.7175 8.02146 19.7778 8.11681 19.7778 8.22408V14.8212C19.7778 14.9464 19.8442 15.0656 19.9589 15.1311L22.7345 16.7104C22.8552 16.7819 23.006 16.6925 23.006 16.5554V6.40048C23.006 6.29321 22.9457 6.19786 22.8552 6.14423L22.8491 6.13827Z\"\n fill={fill}\n />\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=\"43.5\"\n id=\"b\"\n viewBox=\"0 0 193.38 43.5\"\n width=\"193.38\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <style>{css}</style>\n <g id=\"c\">\n <path d=\"M18.01,35.63l-12.36-7.13c-.15-.09-.25-.25-.25-.43v-11.02c0-.19.21-.31.37-.22l14.35,8.28c.2.12.45-.03.45-.26v-5.37c0-.21-.11-.41-.3-.52L3.01,9c-.15-.09-.35-.09-.5,0l-2.26,1.31c-.15.09-.25.25-.25.43v20.47c0,.18.1.34.25.43l17.73,10.24c.15.09.35.09.5,0l14.89-8.6c.2-.12.2-.4,0-.52l-4.64-2.68c-.19-.11-.41-.11-.6,0l-9.61,5.55c-.15.09-.35.09-.5,0Z\" />\n <path d=\"M36.21,10.3L18.48.07c-.15-.09-.35-.09-.5,0l-9.37,5.41c-.2.12-.2.4,0,.52l4.6,2.66c.19.11.41.11.6,0l4.2-2.42c.15-.09.35-.09.5,0l12.36,7.13c.15.09.25.25.25.43v11.07c0,.21.11.41.3.52l4.6,2.65c.2.12.45-.03.45-.26V10.74c0-.18-.1-.34-.25-.43Z\" />\n <g id=\"d\">\n <path d=\"M193.38,9.47c0,1.94-1.48,3.32-3.3,3.32s-3.31-1.39-3.31-3.32,1.49-3.31,3.31-3.31,3.3,1.39,3.3,3.31ZM192.92,9.47c0-1.68-1.26-2.88-2.84-2.88s-2.84,1.2-2.84,2.88,1.26,2.89,2.84,2.89,2.84-1.2,2.84-2.89ZM188.69,11.17v-3.51h1.61c.85,0,1.35.39,1.35,1.15,0,.53-.3.86-.67,1.02l.79,1.35h-.89l-.72-1.22h-.64v1.22h-.82ZM190.18,9.31c.46,0,.64-.16.64-.5s-.19-.49-.64-.49h-.67v.99h.67Z\" />\n <path d=\"M54.72,24.84v10.93h-5.4V6.1h12.26c7.02,0,11.1,3.2,11.1,9.39s-4.07,9.35-11.06,9.35h-6.9,0ZM61.12,20.52c4.07,0,6.11-1.66,6.11-5.03s-2.04-5.03-6.11-5.03h-6.4v10.06h6.4Z\" />\n <path d=\"M85.94,32.45c-1,2.41-3.66,3.78-7.02,3.78-4.11,0-7.11-2.29-7.11-6.11,0-4.24,3.32-5.98,7.61-6.48l6.32-.71v-1c0-2.58-1.58-3.82-3.99-3.82s-3.74,1.29-3.91,3.24h-5.11c.46-4.53,3.99-7.19,9.18-7.19,5.74,0,9.02,2.7,9.02,8.19v8.15c0,1.95.08,3.58.42,5.28h-5.11c-.21-1.16-.29-2.29-.29-3.32h0ZM85.73,27.58v-1.29l-4.7.54c-2.24.29-3.95.79-3.95,2.99,0,1.66,1.16,2.7,3.28,2.7,2.74,0,5.36-1.62,5.36-4.95h0Z\" />\n <path d=\"M90.39,14.66h5.4l5.86,15.92h.08l5.57-15.92h5.28l-8.23,21.49c-2,5.28-4.45,7.32-8.89,7.36-.71,0-1.7-.08-2.45-.21v-4.03c.62.13.96.13,1.41.13,2.16,0,3.07-.75,4.2-3.66l-8.23-21.07h0Z\" />\n <path d=\"M113.46,35.77V6.1h5.32v29.67h-5.32Z\" />\n <path d=\"M130.79,36.27c-6.23,0-10.68-4.2-10.68-11.05s4.45-11.05,10.68-11.05,10.68,4.24,10.68,11.05-4.45,11.05-10.68,11.05ZM130.79,32.32c3.41,0,5.36-2.66,5.36-7.11s-1.95-7.11-5.36-7.11-5.36,2.7-5.36,7.11,1.91,7.11,5.36,7.11Z\" />\n <path d=\"M156.19,32.45c-1,2.41-3.66,3.78-7.02,3.78-4.11,0-7.11-2.29-7.11-6.11,0-4.24,3.32-5.98,7.61-6.48l6.32-.71v-1c0-2.58-1.58-3.82-3.99-3.82s-3.74,1.29-3.91,3.24h-5.11c.46-4.53,3.99-7.19,9.19-7.19,5.74,0,9.02,2.7,9.02,8.19v8.15c0,1.95.08,3.58.42,5.28h-5.11c-.21-1.16-.29-2.29-.29-3.32h0ZM155.98,27.58v-1.29l-4.7.54c-2.24.29-3.95.79-3.95,2.99,0,1.66,1.16,2.7,3.28,2.7,2.74,0,5.36-1.62,5.36-4.95h0Z\" />\n <path d=\"M178.5,32.41c-1.04,2.12-3.58,3.87-6.78,3.87-5.53,0-9.31-4.49-9.31-11.05s3.78-11.05,9.31-11.05c3.28,0,5.69,1.83,6.69,3.95V6.1h5.32v29.67h-5.24v-3.37h0ZM178.55,24.84c0-4.11-1.95-6.78-5.32-6.78s-5.45,2.83-5.45,7.15,2,7.15,5.45,7.15,5.32-2.66,5.32-6.78v-.75h0Z\" />\n </g>\n </g>\n </svg>\n)\n", "export function abortAndIgnore(controller: AbortController) {\n if (controller) {\n try {\n controller.abort()\n } catch (_err) {\n // swallow error\n }\n }\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 { I18nClient } from '@payloadcms/translations'\nimport type {\n SanitizedCollectionConfig,\n SanitizedGlobalConfig,\n SanitizedPermissions,\n StaticLabel,\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: SanitizedCollectionConfig\n type: EntityType.collection\n }\n | {\n entity: SanitizedGlobalConfig\n type: EntityType.global\n }\n\nexport type NavGroupType = {\n entities: {\n label: StaticLabel\n slug: string\n type: EntityType\n }[]\n label: string\n}\n\nexport function groupNavItems(\n entities: EntityToGroup[],\n permissions: SanitizedPermissions,\n i18n: I18nClient,\n): NavGroupType[] {\n const result = entities.reduce(\n (groups, entityToGroup) => {\n if (permissions?.[entityToGroup.type.toLowerCase()]?.[entityToGroup.entity.slug]?.read) {\n const translatedGroup = getTranslation(entityToGroup.entity.admin.group, i18n)\n\n if (entityToGroup.entity.admin.group) {\n const existingGroup = groups.find(\n (group) => getTranslation(group.label, i18n) === translatedGroup,\n ) as NavGroupType\n\n let matchedGroup: NavGroupType = existingGroup\n\n if (!existingGroup) {\n matchedGroup = { entities: [], label: translatedGroup }\n groups.push(matchedGroup)\n }\n\n matchedGroup.entities.push({\n slug: entityToGroup.entity.slug,\n type: entityToGroup.type,\n label:\n 'labels' in entityToGroup.entity\n ? typeof entityToGroup.entity.labels.plural === 'function'\n ? entityToGroup.entity.labels.plural({ t: i18n.t })\n : entityToGroup.entity.labels.plural\n : entityToGroup.entity.label,\n })\n } else {\n const defaultGroup = groups.find((group) => {\n return getTranslation(group.label, i18n) === i18n.t(`general:${entityToGroup.type}`)\n }) as NavGroupType\n defaultGroup.entities.push({\n slug: entityToGroup.entity.slug,\n type: entityToGroup.type,\n label:\n 'labels' in entityToGroup.entity\n ? typeof entityToGroup.entity.labels.plural === 'function'\n ? entityToGroup.entity.labels.plural({ t: i18n.t })\n : entityToGroup.entity.labels.plural\n : entityToGroup.entity.label,\n })\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 { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime.js'\n\nimport { formatAdminURL } from './formatAdminURL.js'\n\ntype BackToDashboardProps = {\n adminRoute: string\n router: AppRouterInstance\n}\n\nexport const handleBackToDashboard = ({ adminRoute, router }: BackToDashboardProps) => {\n const redirectRoute = formatAdminURL({\n adminRoute,\n path: '/',\n })\n router.push(redirectRoute)\n}\n", "import type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime.js'\n\nimport { formatAdminURL } from './formatAdminURL.js'\n\ntype GoBackProps = {\n adminRoute: string\n collectionSlug: string\n router: AppRouterInstance\n}\n\nexport const handleGoBack = ({ adminRoute, collectionSlug, router }: GoBackProps) => {\n const redirectRoute = formatAdminURL({\n adminRoute,\n path: collectionSlug ? `/collections/${collectionSlug}` : '/',\n })\n router.push(redirectRoute)\n}\n", "import type { ClientUser } from 'payload'\n\nexport const handleTakeOver = (\n id: number | string,\n collectionSlug: string,\n globalSlug: string,\n user: ClientUser | number | string,\n isWithinDoc: boolean,\n updateDocumentEditor: (\n docId: number | string,\n slug: string,\n user: ClientUser | number | string,\n ) => Promise<void>,\n setCurrentEditor: (value: React.SetStateAction<ClientUser | number | string>) => void,\n documentLockStateRef: React.RefObject<{\n hasShownLockedModal: boolean\n isLocked: boolean\n user: ClientUser | number | string\n }>,\n isLockingEnabled: boolean,\n setIsReadOnlyForIncomingUser?: (value: React.SetStateAction<boolean>) => void,\n): void => {\n if (!isLockingEnabled) {\n return\n }\n\n try {\n // Call updateDocumentEditor to update the document's owner to the current user\n void updateDocumentEditor(id, collectionSlug ?? globalSlug, user)\n\n if (!isWithinDoc) {\n documentLockStateRef.current.hasShownLockedModal = true\n }\n\n // Update the locked state to reflect the current user as the owner\n documentLockStateRef.current = {\n hasShownLockedModal: documentLockStateRef.current?.hasShownLockedModal,\n isLocked: true,\n user,\n }\n setCurrentEditor(user)\n\n // If this is a takeover within the document, ensure the document is editable\n if (isWithinDoc && setIsReadOnlyForIncomingUser) {\n setIsReadOnlyForIncomingUser(false)\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error during document takeover:', error)\n }\n}\n", "import type {\n SanitizedCollectionPermission,\n SanitizedDocumentPermissions,\n SanitizedGlobalPermission,\n} from 'payload'\n\nexport const hasSavePermission = (args: {\n /*\n * Pass either `collectionSlug` or `globalSlug`\n */\n collectionSlug?: string\n docPermissions: SanitizedDocumentPermissions\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) ||\n (!isEditing && (docPermissions as SanitizedCollectionPermission)?.create),\n )\n }\n\n if (globalSlug) {\n return Boolean((docPermissions as SanitizedGlobalPermission)?.update)\n }\n\n return false\n}\n", "import type { ClientUser } from 'payload'\n\nexport const isClientUserObject = (user): user is ClientUser => {\n return user && typeof user === 'object'\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", "import type { ClientCollectionConfig, SanitizedCollectionConfig, Where } from 'payload'\n\nconst isEmptyObject = (obj: object) => Object.keys(obj).length === 0\n\nexport const hoistQueryParamsToAnd = (currentWhere: Where, incomingWhere: Where) => {\n if (isEmptyObject(incomingWhere)) {\n return currentWhere\n }\n\n if (isEmptyObject(currentWhere)) {\n return incomingWhere\n }\n\n if ('and' in currentWhere) {\n currentWhere.and.push(incomingWhere)\n } else if ('or' in currentWhere) {\n currentWhere = {\n and: [currentWhere, incomingWhere],\n }\n } else {\n currentWhere = {\n and: [currentWhere, incomingWhere],\n }\n }\n\n return currentWhere\n}\n\ntype Args = {\n collectionConfig: ClientCollectionConfig | SanitizedCollectionConfig\n search: string\n where: Where\n}\n\nexport const mergeListSearchAndWhere = ({ collectionConfig, search, where }: Args): Where => {\n if (search) {\n let copyOfWhere = { ...(where || {}) }\n\n const searchAsConditions = (\n collectionConfig.admin.listSearchableFields || [collectionConfig.admin?.useAsTitle || 'id']\n ).map((fieldName) => ({\n [fieldName]: {\n like: search,\n },\n }))\n\n if (searchAsConditions.length > 0) {\n copyOfWhere = hoistQueryParamsToAnd(copyOfWhere, {\n or: searchAsConditions,\n })\n }\n\n if (!isEmptyObject(copyOfWhere)) {\n where = copyOfWhere\n }\n }\n\n return where\n}\n"],
5
+ "mappings": "AAIO,IAAMA,EAA+CC,GAA6B,CACv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,IAAMG,GAAsBC,GAC1BA,GAAQ,OAAOA,GAAS,SCH1B,IAAMC,GAAY,CAAC,CACxB,GAAAC,EACA,eAAAC,EACA,WAAAC,CACF,IAIe,GAAQA,GAAeD,GAAoBD,GCN1D,IAAMG,EAAiBC,GAAgB,OAAO,KAAKA,CAAG,EAAE,SAAW,EAEtDC,GAAwB,CAACC,EAAqBC,IACrDJ,EAAcI,CAAa,EACtBD,EAGLH,EAAcG,CAAY,EACrBC,GAGL,QAASD,EACXA,EAAa,IAAI,KAAKC,CAAa,EAC1B,OAAQD,EACjBA,EAAe,CACb,IAAK,CAACA,EAAcC,CAAa,CACnC,EAEAD,EAAe,CACb,IAAK,CAACA,EAAcC,CAAa,CACnC,EAGKD,GASIE,GAA0B,CAAC,CAAE,iBAAAC,EAAkB,OAAAC,EAAQ,MAAAC,CAAM,IAAmB,CAC3F,GAAID,EAAQ,CACV,IAAIE,EAAc,CAAE,GAAID,GAAS,CAAC,CAAG,EAE/BE,GACJJ,EAAiB,MAAM,sBAAwB,CAACA,EAAiB,OAAO,YAAc,IAAI,GAC1F,IAAKK,IAAe,CACpB,CAACA,CAAS,EAAG,CACX,KAAMJ,CACR,CACF,EAAE,EAEEG,EAAmB,OAAS,IAC9BD,EAAcP,GAAsBO,EAAa,CAC/C,GAAIC,CACN,CAAC,GAGEV,EAAcS,CAAW,IAC5BD,EAAQC,EAEZ,CAEA,OAAOD,CACT",
6
6
  "names": ["filterFields", "incomingFields", "shouldSkipField", "field", "formatted", "formattedField", "tab", "tabField", "fieldAffectsData", "getRemainingColumns", "fields", "useAsTitle", "remaining", "field", "tabFieldColumns", "tab", "getInitialColumns", "defaultColumns", "initialColumns", "remainingColumns", "column", "React", "RecursiveTranslation", "elements", "translationString", "regex", "sections", "section", "index", "elementKey", "Element", "children", "_", "group", "Translation", "i18nKey", "t", "variables", "stringWithVariables", "isReactServerComponentOrFunction", "serverProps", "React", "withMergedProps", "Component", "sanitizeServerOnlyProps", "toMergeIntoProps", "passedProps", "mergedProps", "simpleMergeProps", "prop", "props", "toMerge", "isReactServerComponentOrFunction", "React", "WithServerSideProps", "Component", "serverOnlyProps", "rest", "passedProps", "propsWithServerOnlyProps", "mergeFieldStyles", "field", "deepCopyObjectComplex", "blacklistedKeys", "sanitizeField", "incomingField", "field", "key", "reduceToSerializableFields", "fields", "acc", "React", "PayloadIcon", "fillFromProps", "fill", "React", "css", "PayloadLogo", "abortAndIgnore", "controller", "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", "getTranslation", "EntityType", "groupNavItems", "entities", "permissions", "i18n", "groups", "entityToGroup", "translatedGroup", "existingGroup", "group", "matchedGroup", "handleBackToDashboard", "adminRoute", "router", "redirectRoute", "formatAdminURL", "handleGoBack", "adminRoute", "collectionSlug", "router", "redirectRoute", "formatAdminURL", "handleTakeOver", "id", "collectionSlug", "globalSlug", "user", "isWithinDoc", "updateDocumentEditor", "setCurrentEditor", "documentLockStateRef", "isLockingEnabled", "setIsReadOnlyForIncomingUser", "error", "hasSavePermission", "args", "collectionSlug", "docPermissions", "globalSlug", "isEditing", "isClientUserObject", "user", "isEditing", "id", "collectionSlug", "globalSlug", "isEmptyObject", "obj", "hoistQueryParamsToAnd", "currentWhere", "incomingWhere", "mergeListSearchAndWhere", "collectionConfig", "search", "where", "copyOfWhere", "searchAsConditions", "fieldName"]
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"renderField.d.ts","sourceRoot":"","sources":["../../../src/forms/fieldSchemasToFormState/renderField.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAanD,eAAO,MAAM,WAAW,EAAE,iBAyQzB,CAAA"}
1
+ {"version":3,"file":"renderField.d.ts","sourceRoot":"","sources":["../../../src/forms/fieldSchemasToFormState/renderField.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAanD,eAAO,MAAM,WAAW,EAAE,iBAsPzB,CAAA"}
@@ -80,8 +80,8 @@ export const renderField = ({
80
80
  if (!fieldState.customComponents.RowLabels) {
81
81
  fieldState.customComponents.RowLabels = [];
82
82
  }
83
- fieldState.customComponents.RowLabels[rowIndex] = /*#__PURE__*/_jsx(RenderServerComponent, {
84
- clientProps: clientProps,
83
+ fieldState.customComponents.RowLabels[rowIndex] = RenderServerComponent({
84
+ clientProps,
85
85
  Component: fieldConfig.admin.components.RowLabel,
86
86
  importMap: req.payload.importMap,
87
87
  serverProps: {
@@ -121,14 +121,13 @@ export const renderField = ({
121
121
  */
122
122
  const FieldComponent = fieldConfig.editor.FieldComponent;
123
123
  if (typeof FieldComponent === 'object' && FieldComponent.clientProps) {
124
- FieldComponent.clientProps = deepCopyObjectSimple(FieldComponent.clientProps);
124
+ // FieldComponent.clientProps = deepCopyObjectSimple(FieldComponent.clientProps)
125
125
  }
126
- fieldState.customComponents.Field = /*#__PURE__*/_jsx(RenderServerComponent, {
127
- clientProps: clientProps,
126
+ fieldState.customComponents.Field = RenderServerComponent({
127
+ clientProps,
128
128
  Component: FieldComponent,
129
- Fallback: undefined,
130
129
  importMap: req.payload.importMap,
131
- serverProps: serverProps
130
+ serverProps
132
131
  });
133
132
  break;
134
133
  }
@@ -141,12 +140,13 @@ export const renderField = ({
141
140
  continue;
142
141
  }
143
142
  const Component = fieldConfig.admin.components[key];
144
- fieldState.customComponents[key] = /*#__PURE__*/_jsx(RenderServerComponent, {
145
- clientProps: clientProps,
146
- Component: Component,
143
+ fieldState.customComponents[key] = RenderServerComponent({
144
+ clientProps,
145
+ Component,
147
146
  importMap: req.payload.importMap,
148
- serverProps: serverProps
149
- }, `field.admin.components.${key}`);
147
+ key: `field.admin.components.${key}`,
148
+ serverProps
149
+ });
150
150
  }
151
151
  }
152
152
  break;
@@ -169,52 +169,58 @@ export const renderField = ({
169
169
  }
170
170
  if (fieldConfig.admin?.components) {
171
171
  if ('afterInput' in fieldConfig.admin.components) {
172
- fieldState.customComponents.AfterInput = /*#__PURE__*/_jsx(RenderServerComponent, {
173
- clientProps: clientProps,
172
+ fieldState.customComponents.AfterInput = RenderServerComponent({
173
+ clientProps,
174
174
  Component: fieldConfig.admin.components.afterInput,
175
175
  importMap: req.payload.importMap,
176
- serverProps: serverProps
177
- }, "field.admin.components.afterInput");
176
+ key: 'field.admin.components.afterInput',
177
+ serverProps
178
+ });
178
179
  }
179
180
  if ('beforeInput' in fieldConfig.admin.components) {
180
- fieldState.customComponents.BeforeInput = /*#__PURE__*/_jsx(RenderServerComponent, {
181
- clientProps: clientProps,
181
+ fieldState.customComponents.BeforeInput = RenderServerComponent({
182
+ clientProps,
182
183
  Component: fieldConfig.admin.components.beforeInput,
183
184
  importMap: req.payload.importMap,
184
- serverProps: serverProps
185
- }, "field.admin.components.beforeInput");
185
+ key: 'field.admin.components.beforeInput',
186
+ serverProps
187
+ });
186
188
  }
187
189
  if ('Description' in fieldConfig.admin.components) {
188
- fieldState.customComponents.Description = /*#__PURE__*/_jsx(RenderServerComponent, {
189
- clientProps: clientProps,
190
+ fieldState.customComponents.Description = RenderServerComponent({
191
+ clientProps,
190
192
  Component: fieldConfig.admin.components.Description,
191
193
  importMap: req.payload.importMap,
192
- serverProps: serverProps
193
- }, "field.admin.components.Description");
194
+ key: 'field.admin.components.Description',
195
+ serverProps
196
+ });
194
197
  }
195
198
  if ('Error' in fieldConfig.admin.components) {
196
- fieldState.customComponents.Error = /*#__PURE__*/_jsx(RenderServerComponent, {
197
- clientProps: clientProps,
199
+ fieldState.customComponents.Error = RenderServerComponent({
200
+ clientProps,
198
201
  Component: fieldConfig.admin.components.Error,
199
202
  importMap: req.payload.importMap,
200
- serverProps: serverProps
201
- }, "field.admin.components.Error");
203
+ key: 'field.admin.components.Error',
204
+ serverProps
205
+ });
202
206
  }
203
207
  if ('Label' in fieldConfig.admin.components) {
204
- fieldState.customComponents.Label = /*#__PURE__*/_jsx(RenderServerComponent, {
205
- clientProps: clientProps,
208
+ fieldState.customComponents.Label = RenderServerComponent({
209
+ clientProps,
206
210
  Component: fieldConfig.admin.components.Label,
207
211
  importMap: req.payload.importMap,
208
- serverProps: serverProps
209
- }, "field.admin.components.Label");
212
+ key: 'field.admin.components.Label',
213
+ serverProps
214
+ });
210
215
  }
211
216
  if ('Field' in fieldConfig.admin.components) {
212
- fieldState.customComponents.Field = /*#__PURE__*/_jsx(RenderServerComponent, {
213
- clientProps: clientProps,
217
+ fieldState.customComponents.Field = RenderServerComponent({
218
+ clientProps,
214
219
  Component: fieldConfig.admin.components.Field,
215
220
  importMap: req.payload.importMap,
216
- serverProps: serverProps
217
- }, "field.admin.components.Field");
221
+ key: 'field.admin.components.Field',
222
+ serverProps
223
+ });
218
224
  }
219
225
  }
220
226
  }
@@ -1 +1 @@
1
- {"version":3,"file":"renderField.js","names":["getTranslation","createClientField","deepCopyObjectSimple","MissingEditorProp","fieldAffectsData","RenderServerComponent","FieldDescription","defaultUIFieldComponentKeys","renderField","id","collectionSlug","data","fieldConfig","fieldSchemaMap","fieldState","formState","indexPath","operation","parentPath","parentSchemaPath","path","permissions","incomingPermissions","preferences","req","schemaPath","siblingData","clientField","defaultIDType","payload","config","db","field","i18n","importMap","name","clientProps","customComponents","readOnly","includes","type","serverProps","user","rows","forEach","row","rowIndex","admin","components","RowLabels","_jsx","Component","RowLabel","rowLabel","labels","singular","String","padStart","rowNumber","editor","Error","FieldComponent","Field","Fallback","undefined","key","description","Description","t","AfterInput","afterInput","BeforeInput","beforeInput","Label"],"sources":["../../../src/forms/fieldSchemasToFormState/renderField.tsx"],"sourcesContent":["import type {\n ClientComponentProps,\n ClientField,\n FieldPaths,\n PayloadComponent,\n SanitizedFieldPermissions,\n ServerComponentProps,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { createClientField, deepCopyObjectSimple, MissingEditorProp } from 'payload'\nimport { fieldAffectsData } from 'payload/shared'\n\nimport type { RenderFieldMethod } from './types.js'\n\nimport { RenderServerComponent } from '../../elements/RenderServerComponent/index.js'\n// eslint-disable-next-line payload/no-imports-from-exports-dir -- need this to reference already existing bundle. Otherwise, bundle size increases., payload/no-imports-from-exports-dir\nimport { FieldDescription } from '../../exports/client/index.js'\n\nconst defaultUIFieldComponentKeys: Array<'Cell' | 'Description' | 'Field' | 'Filter'> = [\n 'Cell',\n 'Description',\n 'Field',\n 'Filter',\n]\n\nexport const renderField: RenderFieldMethod = ({\n id,\n collectionSlug,\n data,\n fieldConfig,\n fieldSchemaMap,\n fieldState,\n formState,\n indexPath,\n operation,\n parentPath,\n parentSchemaPath,\n path,\n permissions: incomingPermissions,\n preferences,\n req,\n schemaPath,\n siblingData,\n}) => {\n // TODO (ALESSIO): why are we passing the fieldConfig twice?\n // and especially, why are we deepCopyObject -here- instead of inside the createClientField func,\n // so no one screws this up in the future?\n const clientField = createClientField({\n clientField: deepCopyObjectSimple(fieldConfig) as ClientField,\n defaultIDType: req.payload.config.db.defaultIDType,\n field: fieldConfig,\n i18n: req.i18n,\n importMap: req.payload.importMap,\n })\n\n const permissions =\n incomingPermissions === true\n ? true\n : fieldAffectsData(fieldConfig)\n ? incomingPermissions?.[fieldConfig.name]\n : ({} as SanitizedFieldPermissions)\n\n const clientProps: ClientComponentProps & Partial<FieldPaths> = {\n customComponents: fieldState?.customComponents || {},\n field: clientField,\n path,\n readOnly: permissions !== true && !permissions?.[operation],\n schemaPath,\n }\n\n // fields with subfields\n if (['array', 'blocks', 'collapsible', 'group', 'row', 'tabs'].includes(fieldConfig.type)) {\n clientProps.indexPath = indexPath\n clientProps.parentPath = parentPath\n clientProps.parentSchemaPath = parentSchemaPath\n }\n\n const serverProps: ServerComponentProps = {\n id,\n clientField,\n data,\n field: fieldConfig,\n fieldSchemaMap,\n permissions,\n // TODO: Should we pass explicit values? initialValue, value, valid\n // value and initialValue should be typed\n collectionSlug,\n formState,\n i18n: req.i18n,\n operation,\n payload: req.payload,\n preferences,\n req,\n siblingData,\n user: req.user,\n }\n\n if (!fieldState?.customComponents) {\n fieldState.customComponents = {}\n }\n\n switch (fieldConfig.type) {\n // TODO: handle block row labels as well in a similar fashion\n case 'array': {\n fieldState?.rows?.forEach((row, rowIndex) => {\n if (fieldConfig.admin?.components && 'RowLabel' in fieldConfig.admin.components) {\n if (!fieldState.customComponents.RowLabels) {\n fieldState.customComponents.RowLabels = []\n }\n\n fieldState.customComponents.RowLabels[rowIndex] = (\n <RenderServerComponent\n clientProps={clientProps}\n Component={fieldConfig.admin.components.RowLabel}\n importMap={req.payload.importMap}\n serverProps={{\n ...serverProps,\n rowLabel: `${getTranslation(fieldConfig.labels.singular, req.i18n)} ${String(\n rowIndex + 1,\n ).padStart(2, '0')}`,\n rowNumber: rowIndex + 1,\n }}\n />\n )\n }\n })\n\n break\n }\n\n case 'richText': {\n if (!fieldConfig?.editor) {\n throw new MissingEditorProp(fieldConfig) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n\n if (typeof fieldConfig?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n if (!fieldConfig.admin) {\n fieldConfig.admin = {}\n }\n\n if (!fieldConfig.admin.components) {\n fieldConfig.admin.components = {}\n }\n\n /**\n * We have to deep copy all the props we send to the client (= FieldComponent.clientProps).\n * That way, every editor's field / cell props we send to the client have their own object references.\n *\n * If we send the same object reference to the client twice (e.g. through some configurations where 2 or more fields\n * reference the same editor object, like the root editor), the admin panel may hang indefinitely. This has been happening since\n * a newer Next.js update that made it break when sending the same object reference to the client twice.\n *\n * We can use deepCopyObjectSimple as client props should be JSON-serializable.\n */\n const FieldComponent: PayloadComponent = fieldConfig.editor.FieldComponent\n if (typeof FieldComponent === 'object' && FieldComponent.clientProps) {\n FieldComponent.clientProps = deepCopyObjectSimple(FieldComponent.clientProps)\n }\n\n fieldState.customComponents.Field = (\n <RenderServerComponent\n clientProps={clientProps}\n Component={FieldComponent}\n Fallback={undefined}\n importMap={req.payload.importMap}\n serverProps={serverProps}\n />\n )\n\n break\n }\n\n case 'ui': {\n if (fieldConfig?.admin?.components) {\n // Render any extra, untyped components\n for (const key in fieldConfig.admin.components) {\n if (key in defaultUIFieldComponentKeys) {\n continue\n }\n const Component = fieldConfig.admin.components[key]\n fieldState.customComponents[key] = (\n <RenderServerComponent\n clientProps={clientProps}\n Component={Component}\n importMap={req.payload.importMap}\n key={`field.admin.components.${key}`}\n serverProps={serverProps}\n />\n )\n }\n }\n break\n }\n\n default: {\n break\n }\n }\n\n if (fieldConfig.admin) {\n if ('description' in fieldConfig.admin) {\n if (typeof fieldConfig.admin?.description === 'function') {\n fieldState.customComponents.Description = (\n <FieldDescription\n description={fieldConfig.admin?.description({\n t: req.i18n.t,\n })}\n path={path}\n />\n )\n }\n }\n\n if (fieldConfig.admin?.components) {\n if ('afterInput' in fieldConfig.admin.components) {\n fieldState.customComponents.AfterInput = (\n <RenderServerComponent\n clientProps={clientProps}\n Component={fieldConfig.admin.components.afterInput}\n importMap={req.payload.importMap}\n key=\"field.admin.components.afterInput\"\n serverProps={serverProps}\n />\n )\n }\n\n if ('beforeInput' in fieldConfig.admin.components) {\n fieldState.customComponents.BeforeInput = (\n <RenderServerComponent\n clientProps={clientProps}\n Component={fieldConfig.admin.components.beforeInput}\n importMap={req.payload.importMap}\n key=\"field.admin.components.beforeInput\"\n serverProps={serverProps}\n />\n )\n }\n\n if ('Description' in fieldConfig.admin.components) {\n fieldState.customComponents.Description = (\n <RenderServerComponent\n clientProps={clientProps}\n Component={fieldConfig.admin.components.Description}\n importMap={req.payload.importMap}\n key=\"field.admin.components.Description\"\n serverProps={serverProps}\n />\n )\n }\n\n if ('Error' in fieldConfig.admin.components) {\n fieldState.customComponents.Error = (\n <RenderServerComponent\n clientProps={clientProps}\n Component={fieldConfig.admin.components.Error}\n importMap={req.payload.importMap}\n key=\"field.admin.components.Error\"\n serverProps={serverProps}\n />\n )\n }\n\n if ('Label' in fieldConfig.admin.components) {\n fieldState.customComponents.Label = (\n <RenderServerComponent\n clientProps={clientProps}\n Component={fieldConfig.admin.components.Label}\n importMap={req.payload.importMap}\n key=\"field.admin.components.Label\"\n serverProps={serverProps}\n />\n )\n }\n\n if ('Field' in fieldConfig.admin.components) {\n fieldState.customComponents.Field = (\n <RenderServerComponent\n clientProps={clientProps}\n Component={fieldConfig.admin.components.Field}\n importMap={req.payload.importMap}\n key=\"field.admin.components.Field\"\n serverProps={serverProps}\n />\n )\n }\n }\n }\n}\n"],"mappings":";AASA,SAASA,cAAc,QAAQ;AAC/B,SAASC,iBAAiB,EAAEC,oBAAoB,EAAEC,iBAAiB,QAAQ;AAC3E,SAASC,gBAAgB,QAAQ;AAIjC,SAASC,qBAAqB,QAAQ;AACtC;AACA,SAASC,gBAAgB,QAAQ;AAEjC,MAAMC,2BAAA,GAAkF,CACtF,QACA,eACA,SACA,SACD;AAED,OAAO,MAAMC,WAAA,GAAiCA,CAAC;EAC7CC,EAAE;EACFC,cAAc;EACdC,IAAI;EACJC,WAAW;EACXC,cAAc;EACdC,UAAU;EACVC,SAAS;EACTC,SAAS;EACTC,SAAS;EACTC,UAAU;EACVC,gBAAgB;EAChBC,IAAI;EACJC,WAAA,EAAaC,mBAAmB;EAChCC,WAAW;EACXC,GAAG;EACHC,UAAU;EACVC;AAAW,CACZ;EACC;EACA;EACA;EACA,MAAMC,WAAA,GAAc1B,iBAAA,CAAkB;IACpC0B,WAAA,EAAazB,oBAAA,CAAqBU,WAAA;IAClCgB,aAAA,EAAeJ,GAAA,CAAIK,OAAO,CAACC,MAAM,CAACC,EAAE,CAACH,aAAa;IAClDI,KAAA,EAAOpB,WAAA;IACPqB,IAAA,EAAMT,GAAA,CAAIS,IAAI;IACdC,SAAA,EAAWV,GAAA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WvC,WAAA,CAAYmC,KAAK,CAACC,UAAU,CAACY,KAAK;UAC7C1B,SAAA,EAAWV,GAAA,CAAIK,OAAO,CAACK,SAAS;UAEhCO,WAAA,EAAaA;WADT;MAIV;MAEA,IAAI,WAAW7B,WAAA,CAAYmC,KAAK,CAACC,UAAU,EAAE;QAC3ClC,UAAA,CAAWuB,gBAAgB,CAACoC,KAAK,gBAC/BvB,IAAA,CAAC7C,qBAAA;UACC+B,WAAA,EAAaA,WAAA;UACbe,SAAA,EAAWvC,WAAA,CAAYmC,KAAK,CAACC,UAAU,CAACyB,KAAK;UAC7CvC,SAAA,EAAWV,GAAA,CAAIK,OAAO,CAACK,SAAS;UAEhCO,WAAA,EAAaA;WADT;MAIV;MAEA,IAAI,WAAW7B,WAAA,CAAYmC,KAAK,CAACC,UAAU,EAAE;QAC3ClC,UAAA,CAAWuB,gBAAgB,CAACyB,KAAK,gBAC/BZ,IAAA,CAAC7C,qBAAA;UACC+B,WAAA,EAAaA,WAAA;UACbe,SAAA,EAAWvC,WAAA,CAAYmC,KAAK,CAACC,UAAU,CAACc,KAAK;UAC7C5B,SAAA,EAAWV,GAAA,CAAIK,OAAO,CAACK,SAAS;UAEhCO,WAAA,EAAaA;WADT;MAIV;IACF;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"renderField.js","names":["getTranslation","createClientField","deepCopyObjectSimple","MissingEditorProp","fieldAffectsData","RenderServerComponent","FieldDescription","defaultUIFieldComponentKeys","renderField","id","collectionSlug","data","fieldConfig","fieldSchemaMap","fieldState","formState","indexPath","operation","parentPath","parentSchemaPath","path","permissions","incomingPermissions","preferences","req","schemaPath","siblingData","clientField","defaultIDType","payload","config","db","field","i18n","importMap","name","clientProps","customComponents","readOnly","includes","type","serverProps","user","rows","forEach","row","rowIndex","admin","components","RowLabels","Component","RowLabel","rowLabel","labels","singular","String","padStart","rowNumber","editor","Error","FieldComponent","Field","key","description","Description","_jsx","t","AfterInput","afterInput","BeforeInput","beforeInput","Label"],"sources":["../../../src/forms/fieldSchemasToFormState/renderField.tsx"],"sourcesContent":["import type {\n ClientComponentProps,\n ClientField,\n FieldPaths,\n PayloadComponent,\n SanitizedFieldPermissions,\n ServerComponentProps,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { createClientField, deepCopyObjectSimple, MissingEditorProp } from 'payload'\nimport { fieldAffectsData } from 'payload/shared'\n\nimport type { RenderFieldMethod } from './types.js'\n\nimport { RenderServerComponent } from '../../elements/RenderServerComponent/index.js'\n// eslint-disable-next-line payload/no-imports-from-exports-dir -- need this to reference already existing bundle. Otherwise, bundle size increases., payload/no-imports-from-exports-dir\nimport { FieldDescription } from '../../exports/client/index.js'\n\nconst defaultUIFieldComponentKeys: Array<'Cell' | 'Description' | 'Field' | 'Filter'> = [\n 'Cell',\n 'Description',\n 'Field',\n 'Filter',\n]\n\nexport const renderField: RenderFieldMethod = ({\n id,\n collectionSlug,\n data,\n fieldConfig,\n fieldSchemaMap,\n fieldState,\n formState,\n indexPath,\n operation,\n parentPath,\n parentSchemaPath,\n path,\n permissions: incomingPermissions,\n preferences,\n req,\n schemaPath,\n siblingData,\n}) => {\n // TODO (ALESSIO): why are we passing the fieldConfig twice?\n // and especially, why are we deepCopyObject -here- instead of inside the createClientField func,\n // so no one screws this up in the future?\n const clientField = createClientField({\n clientField: deepCopyObjectSimple(fieldConfig) as ClientField,\n defaultIDType: req.payload.config.db.defaultIDType,\n field: fieldConfig,\n i18n: req.i18n,\n importMap: req.payload.importMap,\n })\n\n const permissions =\n incomingPermissions === true\n ? true\n : fieldAffectsData(fieldConfig)\n ? incomingPermissions?.[fieldConfig.name]\n : ({} as SanitizedFieldPermissions)\n\n const clientProps: ClientComponentProps & Partial<FieldPaths> = {\n customComponents: fieldState?.customComponents || {},\n field: clientField,\n path,\n readOnly: permissions !== true && !permissions?.[operation],\n schemaPath,\n }\n\n // fields with subfields\n if (['array', 'blocks', 'collapsible', 'group', 'row', 'tabs'].includes(fieldConfig.type)) {\n clientProps.indexPath = indexPath\n clientProps.parentPath = parentPath\n clientProps.parentSchemaPath = parentSchemaPath\n }\n\n const serverProps: ServerComponentProps = {\n id,\n clientField,\n data,\n field: fieldConfig,\n fieldSchemaMap,\n permissions,\n // TODO: Should we pass explicit values? initialValue, value, valid\n // value and initialValue should be typed\n collectionSlug,\n formState,\n i18n: req.i18n,\n operation,\n payload: req.payload,\n preferences,\n req,\n siblingData,\n user: req.user,\n }\n\n if (!fieldState?.customComponents) {\n fieldState.customComponents = {}\n }\n\n switch (fieldConfig.type) {\n // TODO: handle block row labels as well in a similar fashion\n case 'array': {\n fieldState?.rows?.forEach((row, rowIndex) => {\n if (fieldConfig.admin?.components && 'RowLabel' in fieldConfig.admin.components) {\n if (!fieldState.customComponents.RowLabels) {\n fieldState.customComponents.RowLabels = []\n }\n\n fieldState.customComponents.RowLabels[rowIndex] = RenderServerComponent({\n clientProps,\n Component: fieldConfig.admin.components.RowLabel,\n importMap: req.payload.importMap,\n serverProps: {\n ...serverProps,\n rowLabel: `${getTranslation(fieldConfig.labels.singular, req.i18n)} ${String(\n rowIndex + 1,\n ).padStart(2, '0')}`,\n rowNumber: rowIndex + 1,\n },\n })\n }\n })\n\n break\n }\n\n case 'richText': {\n if (!fieldConfig?.editor) {\n throw new MissingEditorProp(fieldConfig) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n\n if (typeof fieldConfig?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n if (!fieldConfig.admin) {\n fieldConfig.admin = {}\n }\n\n if (!fieldConfig.admin.components) {\n fieldConfig.admin.components = {}\n }\n\n /**\n * We have to deep copy all the props we send to the client (= FieldComponent.clientProps).\n * That way, every editor's field / cell props we send to the client have their own object references.\n *\n * If we send the same object reference to the client twice (e.g. through some configurations where 2 or more fields\n * reference the same editor object, like the root editor), the admin panel may hang indefinitely. This has been happening since\n * a newer Next.js update that made it break when sending the same object reference to the client twice.\n *\n * We can use deepCopyObjectSimple as client props should be JSON-serializable.\n */\n const FieldComponent: PayloadComponent = fieldConfig.editor.FieldComponent\n if (typeof FieldComponent === 'object' && FieldComponent.clientProps) {\n // FieldComponent.clientProps = deepCopyObjectSimple(FieldComponent.clientProps)\n }\n\n fieldState.customComponents.Field = RenderServerComponent({\n clientProps,\n Component: FieldComponent,\n importMap: req.payload.importMap,\n serverProps,\n })\n\n break\n }\n\n case 'ui': {\n if (fieldConfig?.admin?.components) {\n // Render any extra, untyped components\n for (const key in fieldConfig.admin.components) {\n if (key in defaultUIFieldComponentKeys) {\n continue\n }\n const Component = fieldConfig.admin.components[key]\n fieldState.customComponents[key] = RenderServerComponent({\n clientProps,\n Component,\n importMap: req.payload.importMap,\n key: `field.admin.components.${key}`,\n serverProps,\n })\n }\n }\n break\n }\n\n default: {\n break\n }\n }\n\n if (fieldConfig.admin) {\n if ('description' in fieldConfig.admin) {\n if (typeof fieldConfig.admin?.description === 'function') {\n fieldState.customComponents.Description = (\n <FieldDescription\n description={fieldConfig.admin?.description({\n t: req.i18n.t,\n })}\n path={path}\n />\n )\n }\n }\n\n if (fieldConfig.admin?.components) {\n if ('afterInput' in fieldConfig.admin.components) {\n fieldState.customComponents.AfterInput = RenderServerComponent({\n clientProps,\n Component: fieldConfig.admin.components.afterInput,\n importMap: req.payload.importMap,\n key: 'field.admin.components.afterInput',\n serverProps,\n })\n }\n\n if ('beforeInput' in fieldConfig.admin.components) {\n fieldState.customComponents.BeforeInput = RenderServerComponent({\n clientProps,\n Component: fieldConfig.admin.components.beforeInput,\n importMap: req.payload.importMap,\n key: 'field.admin.components.beforeInput',\n serverProps,\n })\n }\n\n if ('Description' in fieldConfig.admin.components) {\n fieldState.customComponents.Description = RenderServerComponent({\n clientProps,\n Component: fieldConfig.admin.components.Description,\n importMap: req.payload.importMap,\n key: 'field.admin.components.Description',\n serverProps,\n })\n }\n\n if ('Error' in fieldConfig.admin.components) {\n fieldState.customComponents.Error = RenderServerComponent({\n clientProps,\n Component: fieldConfig.admin.components.Error,\n importMap: req.payload.importMap,\n key: 'field.admin.components.Error',\n serverProps,\n })\n }\n\n if ('Label' in fieldConfig.admin.components) {\n fieldState.customComponents.Label = RenderServerComponent({\n clientProps,\n Component: fieldConfig.admin.components.Label,\n importMap: req.payload.importMap,\n key: 'field.admin.components.Label',\n serverProps,\n })\n }\n\n if ('Field' in fieldConfig.admin.components) {\n fieldState.customComponents.Field = RenderServerComponent({\n clientProps,\n Component: fieldConfig.admin.components.Field,\n importMap: req.payload.importMap,\n key: 'field.admin.components.Field',\n serverProps,\n })\n }\n }\n }\n}\n"],"mappings":";AASA,SAASA,cAAc,QAAQ;AAC/B,SAASC,iBAAiB,EAAEC,oBAAoB,EAAEC,iBAAiB,QAAQ;AAC3E,SAASC,gBAAgB,QAAQ;AAIjC,SAASC,qBAAqB,QAAQ;AACtC;AACA,SAASC,gBAAgB,QAAQ;AAEjC,MAAMC,2BAAA,GAAkF,CACtF,QACA,eACA,SACA,SACD;AAED,OAAO,MAAMC,WAAA,GAAiCA,CAAC;EAC7CC,EAAE;EACFC,cAAc;EACdC,IAAI;EACJC,WAAW;EACXC,cAAc;EACdC,UAAU;EACVC,SAAS;EACTC,SAAS;EACTC,SAAS;EACTC,UAAU;EACVC,gBAAgB;EAChBC,IAAI;EACJC,WAAA,EAAaC,mBAAmB;EAChCC,WAAW;EACXC,GAAG;EACHC,UAAU;EACVC;AAAW,CACZ;EACC;EACA;EACA;EACA,MAAMC,WAAA,GAAc1B,iBAAA,CAAkB;IACpC0B,WAAA,EAAazB,oBAAA,CAAqBU,WAAA;IAClCgB,aAAA,EAAeJ,GAAA,CAAIK,OAAO,CAACC,MAAM,CAACC,EAAE,CAACH,aAAa;IAClDI,KAAA,EAAOpB,WAAA;IACPqB,IAAA,EAAMT,GAAA,CAAIS,IAAI;IACdC,SAAA,EAAWV,GAAA,CAAIK,OAAO,CAACK;EACzB;EAEA,MAAMb,WAAA,GACJC,mBAAA,KAAwB,OACpB,OACAlB,gBAAA,CAAiBQ,W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KAAK;UAC7CrC,SAAA,EAAWV,GAAA,CAAIK,OAAO,CAACK,SAAS;UAChC4B,GAAA,EAAK;UACLrB;QACF;MACF;MAEA,IAAI,WAAW7B,WAAA,CAAYmC,KAAK,CAACC,UAAU,EAAE;QAC3ClC,UAAA,CAAWuB,gBAAgB,CAACwB,KAAK,GAAGxD,qBAAA,CAAsB;UACxD+B,WAAA;UACAc,SAAA,EAAWtC,WAAA,CAAYmC,KAAK,CAACC,UAAU,CAACa,KAAK;UAC7C3B,SAAA,EAAWV,GAAA,CAAIK,OAAO,CAACK,SAAS;UAChC4B,GAAA,EAAK;UACLrB;QACF;MACF;IACF;EACF;AACF","ignoreList":[]}
@@ -8,9 +8,9 @@ import { getInitialColumns } from '../elements/TableColumns/getInitialColumns.js
8
8
  import { Pill, Table } from '../exports/client/index.js';
9
9
  export const renderFilters = (fields, importMap) => fields.reduce((acc, field) => {
10
10
  if ('name' in field && field.admin?.components?.Filter) {
11
- acc.set(field.name, /*#__PURE__*/_jsx(RenderServerComponent, {
11
+ acc.set(field.name, RenderServerComponent({
12
12
  Component: field.admin.components?.Filter,
13
- importMap: importMap
13
+ importMap
14
14
  }));
15
15
  }
16
16
  return acc;
@@ -1 +1 @@
1
- {"version":3,"file":"renderTable.js","names":["getTranslation","RenderServerComponent","buildColumnState","filterFields","getInitialColumns","Pill","Table","renderFilters","fields","importMap","reduce","acc","field","admin","components","Filter","set","name","_jsx","Component","Map","renderTable","collectionConfig","columnPreferences","columns","columnsFromArgs","customCellProps","docs","enableRowSelections","i18n","payload","renderRowTypes","tableAppearance","useAsTitle","defaultColumns","columnState","beforeRows","accessor","active","Heading","t","renderedCells","map","_","i","labels","singular","undefined","appearance","data"],"sources":["../../src/utilities/renderTable.tsx"],"sourcesContent":["import type {\n ClientCollectionConfig,\n CollectionConfig,\n Field,\n ImportMap,\n PaginatedDocs,\n Payload,\n} from 'payload'\n\nimport { getTranslation, type I18nClient } from '@payloadcms/translations'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport type { Column } from '../exports/client/index.js'\nimport type { ColumnPreferences } from '../providers/ListQuery/index.js'\n\nimport { RenderServerComponent } from '../elements/RenderServerComponent/index.js'\nimport { buildColumnState } from '../elements/TableColumns/buildColumnState.js'\nimport { filterFields } from '../elements/TableColumns/filterFields.js'\nimport { getInitialColumns } from '../elements/TableColumns/getInitialColumns.js'\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { Pill, Table } from '../exports/client/index.js'\n\nexport const renderFilters = (\n fields: Field[],\n importMap: ImportMap,\n): Map<string, React.ReactNode> =>\n fields.reduce(\n (acc, field) => {\n if ('name' in field && field.admin?.components?.Filter) {\n acc.set(\n field.name,\n <RenderServerComponent\n Component={field.admin.components?.Filter}\n importMap={importMap}\n />,\n )\n }\n\n return acc\n },\n new Map() as Map<string, React.ReactNode>,\n )\n\nexport const renderTable = ({\n collectionConfig,\n columnPreferences,\n columns: columnsFromArgs,\n customCellProps,\n docs,\n enableRowSelections,\n fields,\n i18n,\n payload,\n renderRowTypes,\n tableAppearance,\n useAsTitle,\n}: {\n collectionConfig: ClientCollectionConfig\n columnPreferences: ColumnPreferences\n columns?: ColumnPreferences\n customCellProps?: Record<string, any>\n docs: PaginatedDocs['docs']\n drawerSlug?: string\n enableRowSelections: boolean\n fields: Field[]\n i18n: I18nClient\n payload: Payload\n renderRowTypes?: boolean\n tableAppearance?: 'condensed' | 'default'\n useAsTitle: CollectionConfig['admin']['useAsTitle']\n}): {\n columnState: Column[]\n Table: React.ReactNode\n} => {\n const columns =\n columnsFromArgs ||\n getInitialColumns(filterFields(fields), useAsTitle, collectionConfig?.admin?.defaultColumns)\n\n const columnState = buildColumnState({\n beforeRows: renderRowTypes\n ? [\n {\n accessor: 'collection',\n active: true,\n field: null,\n Heading: i18n.t('version:type'),\n renderedCells: docs.map((_, i) => (\n <Pill key={i}>{getTranslation(collectionConfig.labels.singular, i18n)}</Pill>\n )),\n },\n ]\n : undefined,\n collectionConfig,\n columnPreferences,\n columns,\n enableRowSelections,\n fields,\n i18n,\n // sortColumnProps,\n customCellProps,\n docs,\n payload,\n useAsTitle,\n })\n\n return {\n columnState,\n Table: <Table appearance={tableAppearance} columns={columnState} data={docs} />,\n }\n}\n"],"mappings":";AASA,SAASA,cAAc,QAAyB;AAMhD,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,YAAY,QAAQ;AAC7B,SAASC,iBAAiB,QAAQ;AAClC;AACA,SAASC,IAAI,EAAEC,KAAK,QAAQ;AAE5B,OAAO,MAAMC,aAAA,GAAgBA,CAC3BC,MAAA,EACAC,SAAA,KAEAD,MAAA,CAAOE,MAAM,CACX,CAACC,GAAA,EAAKC,KAAA;EACJ,IAAI,UAAUA,KAAA,IAASA,KAAA,CAAMC,KAAK,EAAEC,UAAA,EAAYC,MAAA,EAAQ;IACtDJ,GAAA,CAAIK,GAAG,CACLJ,KAAA,CAAMK,IAAI,eACVC,IAAA,CAACjB,qBAAA;MACCkB,SAAA,EAAWP,KAAA,CAAMC,KAAK,CAACC,UAAU,EAAEC,MAAA;MACnCN,SAAA,EAAWA;;EAGjB;EAEA,OAAOE,GAAA;AACT,GACA,IAAIS,GAAA;AAGR,OAAO,MAAMC,WAAA,GAAcA,CAAC;EAC1BC,gBAAgB;EAChBC,iBAAiB;EACjBC,OAAA,EAASC,eAAe;EACxBC,eAAe;EACfC,IAAI;EACJC,mBAAmB;EACnBpB,MAAM;EACNqB,IAAI;EACJC,OAAO;EACPC,cAAc;EACdC,eAAe;EACfC;AAAU,CAeX;EAIC,MAAMT,OAAA,GACJC,eAAA,IACArB,iBAAA,CAAkBD,YAAA,CAAaK,MAAA,GAASyB,UAAA,EAAYX,gBAAA,EAAkBT,KAAA,EAAOqB,cAAA;EAE/E,MAAMC,WAAA,GAAcjC,gBAAA,CAAiB;IACnCkC,UAAA,EAAYL,cAAA,GACR,CACE;MACEM,QAAA,EAAU;MACVC,MAAA,EAAQ;MACR1B,KAAA,EAAO;MACP2B,OAAA,EAASV,IAAA,CAAKW,CAAC,CAAC;MAChBC,aAAA,EAAed,IAAA,CAAKe,GAAG,CAAC,CAACC,CAAA,EAAGC,CAAA,kBAC1B1B,IAAA,CAACb,IAAA;kBAAcL,cAAA,CAAesB,gBAAA,CAAiBuB,MAAM,CAACC,QAAQ,EAAEjB,IAAA;SAArDe,CAAA;IAEf,EACD,GACDG,SAAA;IACJzB,gBAAA;IACAC,iBAAA;IACAC,OAAA;IACAI,mBAAA;IACApB,MAAA;IACAqB,IAAA;IACA;IACAH,eAAA;IACAC,IAAA;IACAG,OAAA;IACAG;EACF;EAEA,OAAO;IACLE,WAAA;IACA7B,KAAA,eAAOY,IAAA,CAACZ,KAAA;MAAM0C,UAAA,EAAYhB,eAAA;MAAiBR,OAAA,EAASW,WAAA;MAAac,IAAA,EAAMtB;;EACzE;AACF","ignoreList":[]}
1
+ {"version":3,"file":"renderTable.js","names":["getTranslation","RenderServerComponent","buildColumnState","filterFields","getInitialColumns","Pill","Table","renderFilters","fields","importMap","reduce","acc","field","admin","components","Filter","set","name","Component","Map","renderTable","collectionConfig","columnPreferences","columns","columnsFromArgs","customCellProps","docs","enableRowSelections","i18n","payload","renderRowTypes","tableAppearance","useAsTitle","defaultColumns","columnState","beforeRows","accessor","active","Heading","t","renderedCells","map","_","i","_jsx","labels","singular","undefined","appearance","data"],"sources":["../../src/utilities/renderTable.tsx"],"sourcesContent":["import type {\n ClientCollectionConfig,\n CollectionConfig,\n Field,\n ImportMap,\n PaginatedDocs,\n Payload,\n} from 'payload'\n\nimport { getTranslation, type I18nClient } from '@payloadcms/translations'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport type { Column } from '../exports/client/index.js'\nimport type { ColumnPreferences } from '../providers/ListQuery/index.js'\n\nimport { RenderServerComponent } from '../elements/RenderServerComponent/index.js'\nimport { buildColumnState } from '../elements/TableColumns/buildColumnState.js'\nimport { filterFields } from '../elements/TableColumns/filterFields.js'\nimport { getInitialColumns } from '../elements/TableColumns/getInitialColumns.js'\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { Pill, Table } from '../exports/client/index.js'\n\nexport const renderFilters = (\n fields: Field[],\n importMap: ImportMap,\n): Map<string, React.ReactNode> =>\n fields.reduce(\n (acc, field) => {\n if ('name' in field && field.admin?.components?.Filter) {\n acc.set(\n field.name,\n RenderServerComponent({\n Component: field.admin.components?.Filter,\n importMap,\n }),\n )\n }\n\n return acc\n },\n new Map() as Map<string, React.ReactNode>,\n )\n\nexport const renderTable = ({\n collectionConfig,\n columnPreferences,\n columns: columnsFromArgs,\n customCellProps,\n docs,\n enableRowSelections,\n fields,\n i18n,\n payload,\n renderRowTypes,\n tableAppearance,\n useAsTitle,\n}: {\n collectionConfig: ClientCollectionConfig\n columnPreferences: ColumnPreferences\n columns?: ColumnPreferences\n customCellProps?: Record<string, any>\n docs: PaginatedDocs['docs']\n drawerSlug?: string\n enableRowSelections: boolean\n fields: Field[]\n i18n: I18nClient\n payload: Payload\n renderRowTypes?: boolean\n tableAppearance?: 'condensed' | 'default'\n useAsTitle: CollectionConfig['admin']['useAsTitle']\n}): {\n columnState: Column[]\n Table: React.ReactNode\n} => {\n const columns =\n columnsFromArgs ||\n getInitialColumns(filterFields(fields), useAsTitle, collectionConfig?.admin?.defaultColumns)\n\n const columnState = buildColumnState({\n beforeRows: renderRowTypes\n ? [\n {\n accessor: 'collection',\n active: true,\n field: null,\n Heading: i18n.t('version:type'),\n renderedCells: docs.map((_, i) => (\n <Pill key={i}>{getTranslation(collectionConfig.labels.singular, i18n)}</Pill>\n )),\n },\n ]\n : undefined,\n collectionConfig,\n columnPreferences,\n columns,\n enableRowSelections,\n fields,\n i18n,\n // sortColumnProps,\n customCellProps,\n docs,\n payload,\n useAsTitle,\n })\n\n return {\n columnState,\n Table: <Table appearance={tableAppearance} columns={columnState} data={docs} />,\n }\n}\n"],"mappings":";AASA,SAASA,cAAc,QAAyB;AAMhD,SAASC,qBAAqB,QAAQ;AACtC,SAASC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IAEf,EACD,GACDI,SAAA;IACJ1B,gBAAA;IACAC,iBAAA;IACAC,OAAA;IACAI,mBAAA;IACAnB,MAAA;IACAoB,IAAA;IACA;IACAH,eAAA;IACAC,IAAA;IACAG,OAAA;IACAG;EACF;EAEA,OAAO;IACLE,WAAA;IACA5B,KAAA,eAAOsC,IAAA,CAACtC,KAAA;MAAM0C,UAAA,EAAYjB,eAAA;MAAiBR,OAAA,EAASW,WAAA;MAAae,IAAA,EAAMvB;;EACzE;AACF","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/ui",
3
- "version": "3.0.0",
3
+ "version": "3.0.1-canary.34c6cc0",
4
4
  "homepage": "https://payloadcms.com",
5
5
  "repository": {
6
6
  "type": "git",
@@ -133,7 +133,7 @@
133
133
  "ts-essentials": "10.0.3",
134
134
  "use-context-selector": "2.0.0",
135
135
  "uuid": "10.0.0",
136
- "@payloadcms/translations": "3.0.0"
136
+ "@payloadcms/translations": "3.0.1-canary.34c6cc0"
137
137
  },
138
138
  "devDependencies": {
139
139
  "@babel/cli": "^7.24.5",
@@ -151,14 +151,14 @@
151
151
  "esbuild": "0.23.1",
152
152
  "esbuild-sass-plugin": "3.3.1",
153
153
  "eslint-plugin-react-compiler": "19.0.0-beta-a7bf2bd-20241110",
154
- "payload": "3.0.0",
155
- "@payloadcms/eslint-config": "3.0.0-beta.112"
154
+ "@payloadcms/eslint-config": "3.0.0-beta.112",
155
+ "payload": "3.0.1-canary.34c6cc0"
156
156
  },
157
157
  "peerDependencies": {
158
158
  "next": "^15.0.0",
159
159
  "react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
160
160
  "react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
161
- "payload": "3.0.0"
161
+ "payload": "3.0.1-canary.34c6cc0"
162
162
  },
163
163
  "engines": {
164
164
  "node": "^18.20.2 || >=20.9.0"