@payloadcms/ui 3.70.0 → 3.71.0-canary.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/elements/EditUpload/index.d.ts.map +1 -1
  2. package/dist/elements/EditUpload/index.js +1 -7
  3. package/dist/elements/EditUpload/index.js.map +1 -1
  4. package/dist/elements/PreviewSizes/index.d.ts.map +1 -1
  5. package/dist/elements/PreviewSizes/index.js +6 -2
  6. package/dist/elements/PreviewSizes/index.js.map +1 -1
  7. package/dist/elements/Table/DefaultCell/fields/index.d.ts +5 -1
  8. package/dist/elements/Table/DefaultCell/fields/index.d.ts.map +1 -1
  9. package/dist/exports/client/index.js +12 -12
  10. package/dist/exports/client/index.js.map +3 -3
  11. package/dist/fields/Array/ArrayRow.d.ts +1 -0
  12. package/dist/fields/Array/ArrayRow.d.ts.map +1 -1
  13. package/dist/fields/Array/ArrayRow.js +18 -15
  14. package/dist/fields/Array/ArrayRow.js.map +1 -1
  15. package/dist/fields/Array/index.d.ts.map +1 -1
  16. package/dist/fields/Array/index.js +8 -5
  17. package/dist/fields/Array/index.js.map +1 -1
  18. package/dist/fields/Tabs/index.d.ts.map +1 -1
  19. package/dist/fields/Tabs/index.js +138 -201
  20. package/dist/fields/Tabs/index.js.map +1 -1
  21. package/dist/fields/Upload/RelationshipContent/index.js +1 -1
  22. package/dist/fields/Upload/RelationshipContent/index.js.map +1 -1
  23. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.d.ts +2 -2
  24. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.d.ts.map +1 -1
  25. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js +125 -103
  26. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js.map +1 -1
  27. package/dist/forms/fieldSchemasToFormState/iterateFields.d.ts +2 -2
  28. package/dist/forms/fieldSchemasToFormState/iterateFields.d.ts.map +1 -1
  29. package/dist/forms/fieldSchemasToFormState/iterateFields.js +1 -1
  30. package/dist/forms/fieldSchemasToFormState/iterateFields.js.map +1 -1
  31. package/dist/utilities/buildClientFieldSchemaMap/traverseFields.d.ts +2 -2
  32. package/dist/utilities/buildClientFieldSchemaMap/traverseFields.d.ts.map +1 -1
  33. package/dist/utilities/buildClientFieldSchemaMap/traverseFields.js +40 -36
  34. package/dist/utilities/buildClientFieldSchemaMap/traverseFields.js.map +1 -1
  35. package/dist/utilities/buildFieldSchemaMap/traverseFields.d.ts +2 -2
  36. package/dist/utilities/buildFieldSchemaMap/traverseFields.d.ts.map +1 -1
  37. package/dist/utilities/buildFieldSchemaMap/traverseFields.js +40 -38
  38. package/dist/utilities/buildFieldSchemaMap/traverseFields.js.map +1 -1
  39. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","getTranslation","formatFilesize","React","Button","useDocumentDrawer","Pill","ThumbnailComponent","useConfig","useTranslation","baseClass","RelationshipContent","props","$","id","allowEdit","allowRemove","alt","byteSize","className","collectionSlug","displayPreview","filename","mimeType","onRemove","reloadDoc","showCollectionSlug","t0","src","thumbnailSrc","withMeta","t1","x","y","undefined","config","i18n","collectionConfig","collections","find","collection","slug","t2","t3","DocumentDrawer","t4","openDrawer","t5","t6","doc","onSave","generateMetaText","mimeType_0","size","sections","push","join","metaText","previewAllowed","upload","t7","filter","Boolean","_jsxs","children","_jsx","fileSrc","labels","singular","href","target","buttonStyle","icon","iconStyle","onClick"],"sources":["../../../../src/fields/Upload/RelationshipContent/index.tsx"],"sourcesContent":["'use client'\n\nimport type { TypeWithID } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { formatFilesize } from 'payload/shared'\nimport React from 'react'\n\nimport type { ReloadDoc } from '../types.js'\n\nimport { Button } from '../../../elements/Button/index.js'\nimport { useDocumentDrawer } from '../../../elements/DocumentDrawer/index.js'\nimport { Pill } from '../../../elements/Pill/index.js'\nimport { ThumbnailComponent } from '../../../elements/Thumbnail/index.js'\nimport './index.scss'\nimport { useConfig } from '../../../providers/Config/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\n\nconst baseClass = 'upload-relationship-details'\n\ntype Props = {\n readonly allowEdit?: boolean\n readonly allowRemove?: boolean\n readonly alt: string\n readonly byteSize: number\n readonly className?: string\n readonly collectionSlug: string\n readonly displayPreview?: boolean\n readonly filename: string\n readonly id?: number | string\n readonly mimeType: string\n readonly onRemove: () => void\n readonly reloadDoc: ReloadDoc\n readonly showCollectionSlug?: boolean\n readonly src: string\n readonly thumbnailSrc: string\n readonly withMeta?: boolean\n readonly x?: number\n readonly y?: number\n}\nexport function RelationshipContent(props: Props) {\n const {\n id,\n allowEdit,\n allowRemove,\n alt,\n byteSize,\n className,\n collectionSlug,\n displayPreview,\n filename,\n mimeType,\n onRemove,\n reloadDoc,\n showCollectionSlug = false,\n src,\n thumbnailSrc,\n withMeta = true,\n x,\n y,\n } = props\n\n const { config } = useConfig()\n const { i18n } = useTranslation()\n const collectionConfig =\n 'collections' in config\n ? config.collections.find((collection) => collection.slug === collectionSlug)\n : undefined\n\n const [DocumentDrawer, _, { openDrawer }] = useDocumentDrawer({\n id: src ? id : undefined,\n collectionSlug,\n })\n\n const onSave = React.useCallback(\n async ({ doc }: { doc: TypeWithID }) => reloadDoc(doc.id, collectionSlug),\n [reloadDoc, collectionSlug],\n )\n\n function generateMetaText(mimeType: string, size: number): string {\n const sections: string[] = []\n if (size) {\n sections.push(formatFilesize(size))\n }\n\n if (x && y) {\n sections.push(`${x}x${y}`)\n }\n\n if (mimeType) {\n sections.push(mimeType)\n }\n\n return sections.join(' — ')\n }\n\n const metaText = withMeta ? generateMetaText(mimeType, byteSize) : ''\n const previewAllowed = displayPreview ?? collectionConfig?.upload?.displayPreview ?? true\n\n return (\n <div className={[baseClass, className].filter(Boolean).join(' ')}>\n <div className={`${baseClass}__imageAndDetails`}>\n {previewAllowed && (\n <ThumbnailComponent\n alt={alt}\n className={`${baseClass}__thumbnail`}\n filename={filename}\n fileSrc={thumbnailSrc}\n size=\"small\"\n />\n )}\n {showCollectionSlug && collectionConfig ? (\n <Pill size=\"small\">{getTranslation(collectionConfig.labels.singular, i18n)}</Pill>\n ) : null}\n <div className={`${baseClass}__details`}>\n <p className={`${baseClass}__filename`}>\n {src ? (\n <a href={src} target=\"_blank\">\n {filename}\n </a>\n ) : (\n filename\n )}\n </p>\n {withMeta ? <p className={`${baseClass}__meta`}>{metaText}</p> : null}\n </div>\n </div>\n\n {allowEdit !== false || allowRemove !== false ? (\n <div className={`${baseClass}__actions`}>\n {allowEdit !== false ? (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__edit`}\n icon=\"edit\"\n iconStyle=\"none\"\n onClick={openDrawer}\n />\n ) : null}\n {allowRemove !== false ? (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__remove`}\n icon=\"x\"\n iconStyle=\"none\"\n onClick={() => onRemove()}\n />\n ) : null}\n <DocumentDrawer onSave={onSave} />\n </div>\n ) : null}\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAIlB,SAASC,MAAM,QAAQ;AACvB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,IAAI,QAAQ;AACrB,SAASC,kBAAkB,QAAQ;AACnC,OAAO;AACP,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAE/B,MAAMC,SAAA,GAAY;AAsBlB,OAAO,SAAAC,oBAAAC,KAAA;EAAA,MAAAC,CAAA,GAAAb,EAAA;EACL;IAAAc,EAAA;IAAAC,SAAA;IAAAC,WAAA;IAAAC,GAAA;IAAAC,QAAA;IAAAC,SAAA;IAAAC,cAAA;IAAAC,cAAA;IAAAC,QAAA;IAAAC,QAAA;IAAAC,QAAA;IAAAC,SAAA;IAAAC,kBAAA,EAAAC,EAAA;IAAAC,GAAA;IAAAC,Y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
1
+ {"version":3,"file":"index.js","names":["c","_c","getTranslation","formatFilesize","React","Button","useDocumentDrawer","Pill","ThumbnailComponent","useConfig","useTranslation","baseClass","RelationshipContent","props","$","id","allowEdit","allowRemove","alt","byteSize","className","collectionSlug","displayPreview","filename","mimeType","onRemove","reloadDoc","showCollectionSlug","t0","src","thumbnailSrc","withMeta","t1","x","y","undefined","config","i18n","collectionConfig","collections","find","collection","slug","t2","t3","DocumentDrawer","t4","openDrawer","t5","t6","doc","onSave","generateMetaText","mimeType_0","size","sections","push","join","metaText","previewAllowed","upload","t7","filter","Boolean","_jsxs","children","_jsx","fileSrc","labels","singular","href","target","buttonStyle","icon","iconStyle","onClick"],"sources":["../../../../src/fields/Upload/RelationshipContent/index.tsx"],"sourcesContent":["'use client'\n\nimport type { TypeWithID } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { formatFilesize } from 'payload/shared'\nimport React from 'react'\n\nimport type { ReloadDoc } from '../types.js'\n\nimport { Button } from '../../../elements/Button/index.js'\nimport { useDocumentDrawer } from '../../../elements/DocumentDrawer/index.js'\nimport { Pill } from '../../../elements/Pill/index.js'\nimport { ThumbnailComponent } from '../../../elements/Thumbnail/index.js'\nimport './index.scss'\nimport { useConfig } from '../../../providers/Config/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\n\nconst baseClass = 'upload-relationship-details'\n\ntype Props = {\n readonly allowEdit?: boolean\n readonly allowRemove?: boolean\n readonly alt: string\n readonly byteSize: number\n readonly className?: string\n readonly collectionSlug: string\n readonly displayPreview?: boolean\n readonly filename: string\n readonly id?: number | string\n readonly mimeType: string\n readonly onRemove: () => void\n readonly reloadDoc: ReloadDoc\n readonly showCollectionSlug?: boolean\n readonly src: string\n readonly thumbnailSrc: string\n readonly withMeta?: boolean\n readonly x?: number\n readonly y?: number\n}\nexport function RelationshipContent(props: Props) {\n const {\n id,\n allowEdit,\n allowRemove,\n alt,\n byteSize,\n className,\n collectionSlug,\n displayPreview,\n filename,\n mimeType,\n onRemove,\n reloadDoc,\n showCollectionSlug = false,\n src,\n thumbnailSrc,\n withMeta = true,\n x,\n y,\n } = props\n\n const { config } = useConfig()\n const { i18n } = useTranslation()\n const collectionConfig =\n 'collections' in config\n ? config.collections.find((collection) => collection.slug === collectionSlug)\n : undefined\n\n const [DocumentDrawer, _, { openDrawer }] = useDocumentDrawer({\n id: id ?? undefined,\n collectionSlug,\n })\n\n const onSave = React.useCallback(\n async ({ doc }: { doc: TypeWithID }) => reloadDoc(doc.id, collectionSlug),\n [reloadDoc, collectionSlug],\n )\n\n function generateMetaText(mimeType: string, size: number): string {\n const sections: string[] = []\n if (size) {\n sections.push(formatFilesize(size))\n }\n\n if (x && y) {\n sections.push(`${x}x${y}`)\n }\n\n if (mimeType) {\n sections.push(mimeType)\n }\n\n return sections.join(' — ')\n }\n\n const metaText = withMeta ? generateMetaText(mimeType, byteSize) : ''\n const previewAllowed = displayPreview ?? collectionConfig?.upload?.displayPreview ?? true\n\n return (\n <div className={[baseClass, className].filter(Boolean).join(' ')}>\n <div className={`${baseClass}__imageAndDetails`}>\n {previewAllowed && (\n <ThumbnailComponent\n alt={alt}\n className={`${baseClass}__thumbnail`}\n filename={filename}\n fileSrc={thumbnailSrc}\n size=\"small\"\n />\n )}\n {showCollectionSlug && collectionConfig ? (\n <Pill size=\"small\">{getTranslation(collectionConfig.labels.singular, i18n)}</Pill>\n ) : null}\n <div className={`${baseClass}__details`}>\n <p className={`${baseClass}__filename`}>\n {src ? (\n <a href={src} target=\"_blank\">\n {filename}\n </a>\n ) : (\n filename\n )}\n </p>\n {withMeta ? <p className={`${baseClass}__meta`}>{metaText}</p> : null}\n </div>\n </div>\n\n {allowEdit !== false || allowRemove !== false ? (\n <div className={`${baseClass}__actions`}>\n {allowEdit !== false ? (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__edit`}\n icon=\"edit\"\n iconStyle=\"none\"\n onClick={openDrawer}\n />\n ) : null}\n {allowRemove !== false ? (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__remove`}\n icon=\"x\"\n iconStyle=\"none\"\n onClick={() => onRemove()}\n />\n ) : null}\n <DocumentDrawer onSave={onSave} />\n </div>\n ) : null}\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAIlB,SAASC,MAAM,QAAQ;AACvB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,IAAI,QAAQ;AACrB,SAASC,kBAAkB,QAAQ;AACnC,OAAO;AACP,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAE/B,MAAMC,SAAA,GAAY;AAsBlB,OAAO,SAAAC,oBAAAC,KAAA;EAAA,MAAAC,CAAA,GAAAb,EAAA;EACL;IAAAc,EAAA;IAAAC,SAAA;IAAAC,WAAA;IAAAC,GAAA;IAAAC,QAAA;IAAAC,SAAA;IAAAC,cAAA;IAAAC,cAAA;IAAAC,QAAA;IAAAC,QAAA;IAAAC,QAAA;IAAAC,SAAA;IAAAC,kBAAA,EAAAC,EAAA;IAAAC,GAAA;IAAAC,YAAA;IAAAC,QAAA,EAAAC,EAAA;IAAAC,CAAA;IAAAC;EAAA,IAmBIrB,KAAA;EANF,MAAAc,kBAAA,GAAAC,EAA0B,KAAAO,SAAA,WAA1BP,EAA0B;EAG1B,MAAAG,QAAA,GAAAC,EAAe,KAAAG,SAAA,UAAfH,EAAe;EAKjB;IAAAI;EAAA,IAAmB3B,SAAA;EACnB;IAAA4B;EAAA,IAAiB3B,cAAA;EACjB,MAAA4B,gBAAA,GACE,iBAAiBF,MAAA,GACbA,MAAA,CAAAG,WAAA,CAAAC,IAAA,CAAAC,UAAA,IAAwCA,UAAA,CAAAC,IAAA,KAAoBrB,cAAA,IAAAc,SAC5D;EAGA,MAAAQ,EAAA,GAAA5B,EAAA,IAAAoB,SAAM;EAAA,IAAAS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,EAAY;YAAAN,QAAA,EAClB1C;UAAA,C,IAGHA;QAAA,C,GAGHQ,QAAA,GAAWmC,IAAA,CAAC;UAAA9C,SAAA,EAAa,GAAAT,SAAA,QAAoB;UAAAsD,QAAA,EAAGP;QAAA,C,QAAgB;MAAA,C;QAIpE1C,SAAA,UAAc,IAASC,WAAA,UAAgB,GACtC+C,KAAA,CAAC;MAAA5C,SAAA,EAAe,GAAAT,SAAA,WAAuB;MAAAsD,QAAA,GACpCjD,SAAA,UAAc,GACbkD,IAAA,CAAA7D,MAAA;QAAAmE,WAAA,EACc;QAAApD,SAAA,EACD,GAAAT,SAAA,QAAoB;QAAA8D,IAAA,EAC1B;QAAAC,SAAA,EACK;QAAAC,OAAA,EACD5B;MAAA,C,QAET,EACH9B,WAAA,UAAgB,GACfiD,IAAA,CAAA7D,MAAA;QAAAmE,WAAA,EACc;QAAApD,SAAA,EACD,GAAAT,SAAA,UAAsB;QAAA8D,IAAA,EAC5B;QAAAC,SAAA,EACK;QAAAC,OAAA,EAAAA,CAAA,KACKlD,QAAA;MAAA,C,QAEf,EACJyC,IAAA,CAACrB,cAAA;QAAAM;MAAA,C;aAED;EAAA,C","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { BuildFormStateArgs, ClientFieldSchemaMap, Data, DocumentPreferences, Field, FieldSchemaMap, FormState, FormStateWithoutComponents, PayloadRequest, SanitizedFieldsPermissions, SelectMode, SelectType } from 'payload';
1
+ import type { BuildFormStateArgs, ClientFieldSchemaMap, Data, DocumentPreferences, Field, FieldSchemaMap, FormState, FormStateWithoutComponents, PayloadRequest, SanitizedFieldsPermissions, SelectMode, SelectType, TabAsField } from 'payload';
2
2
  import type { RenderFieldMethod } from './types.js';
3
3
  export type AddFieldStatePromiseArgs = {
4
4
  addErrorPathToParent: (fieldPath: string) => void;
@@ -13,7 +13,7 @@ export type AddFieldStatePromiseArgs = {
13
13
  clientFieldSchemaMap?: ClientFieldSchemaMap;
14
14
  collectionSlug?: string;
15
15
  data: Data;
16
- field: Field;
16
+ field: Field | TabAsField;
17
17
  fieldIndex: number;
18
18
  fieldSchemaMap: FieldSchemaMap;
19
19
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"addFieldStatePromise.d.ts","sourceRoot":"","sources":["../../../src/forms/fieldSchemasToFormState/addFieldStatePromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,IAAI,EACJ,mBAAmB,EACnB,KAAK,EACL,cAAc,EAGd,SAAS,EACT,0BAA0B,EAC1B,cAAc,EAGd,0BAA0B,EAC1B,UAAU,EACV,UAAU,EAGX,MAAM,SAAS,CAAA;AAehB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAQnD,MAAM,MAAM,wBAAwB,GAAG;IACrC,oBAAoB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;IACjD;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;OAEG;IACH,SAAS,EAAE,IAAI,GAAG,SAAS,CAAA;IAC3B,oBAAoB,CAAC,EAAE,oBAAoB,CAAA;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,IAAI,EAAE,IAAI,CAAA;IACV,KAAK,EAAE,KAAK,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,cAAc,CAAA;IAC9B;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,wBAAwB,KAAK,OAAO,CAAA;IACpD;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,EAAE,IAAI,CAAA;IACd,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAA;IACzC;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC9B,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,iBAAiB,EAAE,0BAA0B,CAAA;IAC7C,gBAAgB,EAAE,MAAM,CAAA;IACxB,eAAe,EAAE,OAAO,CAAA;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,mBAAmB,CAAA;IAChC,iBAAiB,EAAE,SAAS,CAAA;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,eAAe,EAAE,OAAO,CAAA;IACxB,aAAa,EAAE,iBAAiB,CAAA;IAChC;;;OAGG;IACH,GAAG,EAAE,cAAc,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,KAAK,EAAE,0BAA0B,CAAA;CAClC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,SAAgB,wBAAwB,KAAG,OAAO,CAAC,IAAI,CAy4BvF,CAAA"}
1
+ {"version":3,"file":"addFieldStatePromise.d.ts","sourceRoot":"","sources":["../../../src/forms/fieldSchemasToFormState/addFieldStatePromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,IAAI,EACJ,mBAAmB,EACnB,KAAK,EACL,cAAc,EAGd,SAAS,EACT,0BAA0B,EAC1B,cAAc,EAGd,0BAA0B,EAC1B,UAAU,EACV,UAAU,EACV,UAAU,EAEX,MAAM,SAAS,CAAA;AAchB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAQnD,MAAM,MAAM,wBAAwB,GAAG;IACrC,oBAAoB,EAAE,CA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C,EAAE,UAAU,CAAA;IACnB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,KAAK,EAAE,0BAA0B,CAAA;CAClC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,SAAgB,wBAAwB,KAAG,OAAO,CAAC,IAAI,CA25BvF,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import ObjectIdImport from 'bson-objectid';
2
2
  import { getBlockSelect, stripUnselectedFields, validateBlocksFilterOptions } from 'payload';
3
- import { deepCopyObjectSimple, fieldAffectsData, fieldHasSubFields, fieldIsHiddenOrDisabled, fieldIsID, fieldIsLocalized, getFieldPaths, tabHasName } from 'payload/shared';
3
+ import { deepCopyObjectSimple, fieldAffectsData, fieldHasSubFields, fieldIsHiddenOrDisabled, fieldIsID, fieldIsLocalized, tabHasName } from 'payload/shared';
4
4
  import { resolveFilterOptions } from '../../utilities/resolveFilterOptions.js';
5
5
  import { isRowCollapsed } from './isRowCollapsed.js';
6
6
  import { iterateFields } from './iterateFields.js';
@@ -71,7 +71,7 @@ export const addFieldStatePromise = async args => {
71
71
  if (includeSchema) {
72
72
  fieldState.fieldSchema = field;
73
73
  }
74
- if (fieldAffectsData(field) && !fieldIsHiddenOrDisabled(field)) {
74
+ if (fieldAffectsData(field) && !fieldIsHiddenOrDisabled(field) && field.type !== 'tab') {
75
75
  fieldPermissions = parentPermissions === true ? parentPermissions : deepCopyObjectSimple(parentPermissions?.[field.name]);
76
76
  let hasPermission = fieldPermissions === true || deepCopyObjectSimple(fieldPermissions?.read);
77
77
  if (typeof field?.access?.read === 'function') {
@@ -88,7 +88,7 @@ export const addFieldStatePromise = async args => {
88
88
  if (!hasPermission) {
89
89
  return;
90
90
  }
91
- const validate = field.validate;
91
+ const validate = 'validate' in field ? field.validate : undefined;
92
92
  let validationResult = true;
93
93
  if (typeof validate === 'function' && !skipValidation && passesCondition) {
94
94
  let jsonError;
@@ -154,11 +154,11 @@ export const addFieldStatePromise = async args => {
154
154
  const {
155
155
  promises,
156
156
  rows
157
- } = arrayValue.reduce((acc, row, i) => {
158
- const parentPath = path + '.' + i;
157
+ } = arrayValue.reduce((acc, row, rowIndex) => {
158
+ const rowPath = path + '.' + rowIndex;
159
159
  row.id = row?.id || new ObjectId().toHexString();
160
160
  if (!omitParents && (!filter || filter(args))) {
161
- const idKey = parentPath + '.id';
161
+ const idKey = rowPath + '.id';
162
162
  state[idKey] = {
163
163
  initialValue: row.id,
164
164
  value: row.id
@@ -186,7 +186,7 @@ export const addFieldStatePromise = async args => {
186
186
  operation,
187
187
  parentIndexPath: '',
188
188
  parentPassesCondition: passesCondition,
189
- parentPath,
189
+ parentPath: rowPath,
190
190
  parentSchemaPath: schemaPath,
191
191
  permissions: fieldPermissions === true ? fieldPermissions : fieldPermissions?.fields || {},
192
192
  preferences,
@@ -284,12 +284,12 @@ export const addFieldStatePromise = async args => {
284
284
  select: select?.[field.name],
285
285
  selectMode
286
286
  });
287
- const parentPath = path + '.' + i;
287
+ const rowPath = path + '.' + i;
288
288
  if (block) {
289
289
  row.id = row?.id || new ObjectId().toHexString();
290
290
  if (!omitParents && (!filter || filter(args))) {
291
291
  // Handle block `id` field
292
- const idKey = parentPath + '.id';
292
+ const idKey = rowPath + '.id';
293
293
  state[idKey] = {
294
294
  initialValue: row.id,
295
295
  value: row.id
@@ -311,7 +311,7 @@ export const addFieldStatePromise = async args => {
311
311
  state[idKey].fieldSchema = includeSchema ? block.fields.find(blockField => fieldIsID(blockField)) : undefined;
312
312
  }
313
313
  // Handle `blockType` field
314
- const fieldKey = parentPath + '.blockType';
314
+ const fieldKey = rowPath + '.blockType';
315
315
  state[fieldKey] = {
316
316
  initialValue: row.blockType,
317
317
  value: row.blockType
@@ -323,7 +323,7 @@ export const addFieldStatePromise = async args => {
323
323
  state[fieldKey].fieldSchema = block.fields.find(blockField => 'name' in blockField && blockField.name === 'blockType');
324
324
  }
325
325
  // Handle `blockName` field
326
- const blockNameKey = parentPath + '.blockName';
326
+ const blockNameKey = rowPath + '.blockName';
327
327
  state[blockNameKey] = {};
328
328
  if (row.blockName) {
329
329
  state[blockNameKey].initialValue = row.blockName;
@@ -352,7 +352,7 @@ export const addFieldStatePromise = async args => {
352
352
  operation,
353
353
  parentIndexPath: '',
354
354
  parentPassesCondition: passesCondition,
355
- parentPath,
355
+ parentPath: rowPath,
356
356
  parentSchemaPath: schemaPath + '.' + block.slug,
357
357
  permissions: fieldPermissions === true ? fieldPermissions : parentPermissions?.[field.name]?.blocks?.[block.slug] === true ? true : parentPermissions?.[field.name]?.blocks?.[block.slug]?.fields || {},
358
358
  preferences,
@@ -583,8 +583,8 @@ export const addFieldStatePromise = async args => {
583
583
  operation,
584
584
  parentIndexPath: indexPath,
585
585
  parentPassesCondition: passesCondition,
586
- parentPath,
587
- parentSchemaPath,
586
+ parentPath: path,
587
+ parentSchemaPath: schemaPath,
588
588
  permissions: parentPermissions,
589
589
  preferences,
590
590
  previousFormState,
@@ -596,106 +596,128 @@ export const addFieldStatePromise = async args => {
596
596
  skipValidation,
597
597
  state
598
598
  });
599
- } else if (field.type === 'tabs') {
600
- const promises = field.tabs.map((tab, tabIndex) => {
601
- const isNamedTab = tabHasName(tab);
602
- let tabSelect;
603
- const tabField = {
604
- ...tab,
605
- type: 'tab'
606
- };
607
- const {
608
- indexPath: tabIndexPath,
609
- path: tabPath,
610
- schemaPath: tabSchemaPath
611
- } = getFieldPaths({
599
+ } else if (field.type === 'tab') {
600
+ const isNamedTab = tabHasName(field);
601
+ let tabSelect;
602
+ const tabField = {
603
+ ...field,
604
+ type: 'tab'
605
+ };
606
+ let childPermissions = undefined;
607
+ if (isNamedTab) {
608
+ const shouldContinue = stripUnselectedFields({
612
609
  field: tabField,
613
- index: tabIndex,
614
- parentIndexPath: indexPath,
615
- parentPath,
616
- parentSchemaPath
610
+ select,
611
+ selectMode,
612
+ siblingDoc: data?.[field.name] || {}
617
613
  });
618
- let childPermissions = undefined;
619
- if (isNamedTab) {
620
- const shouldContinue = stripUnselectedFields({
621
- field: tabField,
622
- select,
623
- selectMode,
624
- siblingDoc: data?.[tab.name] || {}
625
- });
626
- if (!shouldContinue) {
627
- return;
628
- }
629
- if (parentPermissions === true) {
614
+ if (!shouldContinue) {
615
+ return;
616
+ }
617
+ if (parentPermissions === true) {
618
+ childPermissions = true;
619
+ } else {
620
+ const tabPermissions = parentPermissions?.[field.name];
621
+ if (tabPermissions === true) {
630
622
  childPermissions = true;
631
623
  } else {
632
- const tabPermissions = parentPermissions?.[tab.name];
633
- if (tabPermissions === true) {
634
- childPermissions = true;
635
- } else {
636
- childPermissions = tabPermissions?.fields;
637
- }
638
- }
639
- if (typeof select?.[tab.name] === 'object') {
640
- tabSelect = select?.[tab.name];
624
+ childPermissions = tabPermissions?.fields;
641
625
  }
642
- } else {
643
- childPermissions = parentPermissions;
644
- tabSelect = select;
645
626
  }
646
- const pathSegments = path ? path.split('.') : [];
647
- // If passesCondition is false then this should always result to false
648
- // If the tab has no admin.condition provided then fallback to passesCondition and let that decide the result
649
- let tabPassesCondition = passesCondition;
650
- if (passesCondition && typeof tab.admin?.condition === 'function') {
651
- tabPassesCondition = tab.admin.condition(fullData, data, {
652
- blockData,
653
- operation,
654
- path: pathSegments,
655
- user: req.user
656
- });
627
+ if (typeof select?.[field.name] === 'object') {
628
+ tabSelect = select?.[field.name];
657
629
  }
658
- if (tab?.id) {
659
- state[tab.id] = {
660
- passesCondition: tabPassesCondition
661
- };
662
- }
663
- return iterateFields({
664
- id,
665
- addErrorPathToParent: addErrorPathToParentArg,
666
- anyParentLocalized: tab.localized || anyParentLocalized,
630
+ } else {
631
+ childPermissions = parentPermissions;
632
+ tabSelect = select;
633
+ }
634
+ const pathSegments = path ? path.split('.') : [];
635
+ // If passesCondition is false then this should always result to false
636
+ // If the tab has no admin.condition provided then fallback to passesCondition and let that decide the result
637
+ let tabPassesCondition = passesCondition;
638
+ if (passesCondition && typeof field.admin?.condition === 'function') {
639
+ tabPassesCondition = field.admin.condition(fullData, data, {
667
640
  blockData,
668
- clientFieldSchemaMap,
669
- collectionSlug,
670
- data: isNamedTab ? data?.[tab.name] || {} : data,
671
- fields: tab.fields,
672
- fieldSchemaMap,
673
- filter,
674
- forceFullValue,
675
- fullData,
676
- includeSchema,
677
- mockRSCs,
678
- omitParents,
679
641
  operation,
680
- parentIndexPath: isNamedTab ? '' : tabIndexPath,
681
- parentPassesCondition: tabPassesCondition,
682
- parentPath: isNamedTab ? tabPath : parentPath,
683
- parentSchemaPath: isNamedTab ? tabSchemaPath : parentSchemaPath,
684
- permissions: childPermissions,
685
- preferences,
686
- previousFormState,
687
- readOnly,
688
- renderAllFields,
689
- renderFieldFn,
690
- req,
691
- select: tabSelect,
692
- selectMode,
693
- skipConditionChecks,
694
- skipValidation,
695
- state
642
+ path: pathSegments,
643
+ user: req.user
696
644
  });
645
+ }
646
+ if (field?.id) {
647
+ state[field.id] = {
648
+ passesCondition: tabPassesCondition
649
+ };
650
+ }
651
+ return iterateFields({
652
+ id,
653
+ addErrorPathToParent: addErrorPathToParentArg,
654
+ anyParentLocalized: field.localized || anyParentLocalized,
655
+ blockData,
656
+ clientFieldSchemaMap,
657
+ collectionSlug,
658
+ data: isNamedTab ? data?.[field.name] || {} : data,
659
+ fields: field.fields,
660
+ fieldSchemaMap,
661
+ filter,
662
+ forceFullValue,
663
+ fullData,
664
+ includeSchema,
665
+ mockRSCs,
666
+ omitParents,
667
+ operation,
668
+ parentIndexPath: indexPath,
669
+ parentPassesCondition: tabPassesCondition,
670
+ parentPath: path,
671
+ parentSchemaPath: schemaPath,
672
+ permissions: childPermissions,
673
+ preferences,
674
+ previousFormState,
675
+ readOnly,
676
+ renderAllFields,
677
+ renderFieldFn,
678
+ req,
679
+ select: tabSelect,
680
+ selectMode,
681
+ skipConditionChecks,
682
+ skipValidation,
683
+ state
684
+ });
685
+ } else if (field.type === 'tabs') {
686
+ return iterateFields({
687
+ id,
688
+ addErrorPathToParent: addErrorPathToParentArg,
689
+ anyParentLocalized: fieldIsLocalized(field) || anyParentLocalized,
690
+ blockData,
691
+ clientFieldSchemaMap,
692
+ collectionSlug,
693
+ data,
694
+ fields: field.tabs.map(tab => ({
695
+ ...tab,
696
+ type: 'tab'
697
+ })),
698
+ fieldSchemaMap,
699
+ filter,
700
+ forceFullValue,
701
+ fullData,
702
+ includeSchema,
703
+ omitParents,
704
+ operation,
705
+ parentIndexPath: indexPath,
706
+ parentPassesCondition: passesCondition,
707
+ parentPath: path,
708
+ parentSchemaPath: schemaPath,
709
+ permissions: parentPermissions,
710
+ preferences,
711
+ previousFormState,
712
+ renderAllFields,
713
+ renderFieldFn,
714
+ req,
715
+ select,
716
+ selectMode,
717
+ skipConditionChecks,
718
+ skipValidation,
719
+ state
697
720
  });
698
- await Promise.all(promises);
699
721
  } else if (field.type === 'ui') {
700
722
  if (!filter || filter(args)) {
701
723
  state[path] = fieldState;