@payloadcms/ui 3.28.0-internal.b3cf0a3 → 3.28.0-internal.c4e1bed
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/elements/DocumentControls/index.d.ts.map +1 -1
- package/dist/elements/DocumentControls/index.js +2 -1
- package/dist/elements/DocumentControls/index.js.map +1 -1
- package/dist/elements/FileDetails/StaticFileDetails/index.d.ts.map +1 -1
- package/dist/elements/FileDetails/StaticFileDetails/index.js +2 -1
- package/dist/elements/FileDetails/StaticFileDetails/index.js.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/File/index.d.ts.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/File/index.js +26 -17
- package/dist/elements/Table/DefaultCell/fields/File/index.js.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/Relationship/index.js +2 -2
- package/dist/elements/Table/DefaultCell/fields/Relationship/index.js.map +1 -1
- package/dist/elements/ThumbnailCard/index.scss +2 -1
- package/dist/elements/Toasts/fieldErrors.d.ts.map +1 -1
- package/dist/elements/Toasts/fieldErrors.js +2 -1
- package/dist/elements/Toasts/fieldErrors.js.map +1 -1
- package/dist/exports/client/index.js +23 -23
- package/dist/exports/client/index.js.map +4 -4
- package/dist/fields/Blocks/BlocksDrawer/index.js +5 -5
- package/dist/fields/Blocks/BlocksDrawer/index.js.map +1 -1
- package/dist/fields/Blocks/BlocksDrawer/index.scss +11 -2
- package/dist/fields/Collapsible/index.d.ts.map +1 -1
- package/dist/fields/Collapsible/index.js +2 -1
- package/dist/fields/Collapsible/index.js.map +1 -1
- package/dist/fields/Row/index.d.ts.map +1 -1
- package/dist/fields/Row/index.js +3 -1
- package/dist/fields/Row/index.js.map +1 -1
- package/dist/fields/Row/index.scss +7 -0
- package/dist/fields/Tabs/Tab/index.d.ts.map +1 -1
- package/dist/fields/Tabs/Tab/index.js +35 -61
- package/dist/fields/Tabs/Tab/index.js.map +1 -1
- package/dist/fields/Upload/HasMany/index.d.ts +1 -0
- package/dist/fields/Upload/HasMany/index.d.ts.map +1 -1
- package/dist/fields/Upload/HasMany/index.js +28 -24
- package/dist/fields/Upload/HasMany/index.js.map +1 -1
- package/dist/fields/Upload/HasOne/index.d.ts +1 -0
- package/dist/fields/Upload/HasOne/index.d.ts.map +1 -1
- package/dist/fields/Upload/HasOne/index.js +2 -0
- package/dist/fields/Upload/HasOne/index.js.map +1 -1
- package/dist/fields/Upload/Input.d.ts +1 -0
- package/dist/fields/Upload/Input.d.ts.map +1 -1
- package/dist/fields/Upload/Input.js +34 -30
- package/dist/fields/Upload/Input.js.map +1 -1
- package/dist/fields/Upload/RelationshipContent/index.d.ts +1 -0
- package/dist/fields/Upload/RelationshipContent/index.d.ts.map +1 -1
- package/dist/fields/Upload/RelationshipContent/index.js +102 -77
- package/dist/fields/Upload/RelationshipContent/index.js.map +1 -1
- package/dist/fields/Upload/index.d.ts.map +1 -1
- package/dist/fields/Upload/index.js +2 -0
- package/dist/fields/Upload/index.js.map +1 -1
- package/dist/forms/Form/mergeServerFormState.d.ts.map +1 -1
- package/dist/forms/Form/mergeServerFormState.js +1 -1
- package/dist/forms/Form/mergeServerFormState.js.map +1 -1
- package/dist/forms/WatchChildErrors/buildPathSegments.d.ts +1 -1
- package/dist/forms/WatchChildErrors/buildPathSegments.d.ts.map +1 -1
- package/dist/forms/WatchChildErrors/buildPathSegments.js +8 -11
- package/dist/forms/WatchChildErrors/buildPathSegments.js.map +1 -1
- package/dist/forms/WatchChildErrors/index.d.ts +6 -0
- package/dist/forms/WatchChildErrors/index.d.ts.map +1 -1
- package/dist/forms/WatchChildErrors/index.js +29 -17
- package/dist/forms/WatchChildErrors/index.js.map +1 -1
- package/dist/graphics/DefaultBlockImage/index.d.ts.map +1 -1
- package/dist/graphics/DefaultBlockImage/index.js +54 -24
- package/dist/graphics/DefaultBlockImage/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +4 -4
- package/dist/forms/WatchChildErrors/getFieldStateFromPaths.d.ts +0 -9
- package/dist/forms/WatchChildErrors/getFieldStateFromPaths.d.ts.map +0 -1
- package/dist/forms/WatchChildErrors/getFieldStateFromPaths.js +0 -29
- package/dist/forms/WatchChildErrors/getFieldStateFromPaths.js.map +0 -1
- package/dist/forms/WatchChildErrors/getNestedFieldState.d.ts +0 -12
- package/dist/forms/WatchChildErrors/getNestedFieldState.d.ts.map +0 -1
- package/dist/forms/WatchChildErrors/getNestedFieldState.js +0 -24
- package/dist/forms/WatchChildErrors/getNestedFieldState.js.map +0 -1
|
@@ -113,12 +113,12 @@ export const BlocksDrawer = props => {
|
|
|
113
113
|
void addRow(addRowIndex, slug);
|
|
114
114
|
closeModal(drawerSlug);
|
|
115
115
|
},
|
|
116
|
-
thumbnail:
|
|
117
|
-
alt: imageAltText,
|
|
118
|
-
src: imageURL
|
|
119
|
-
}) : /*#__PURE__*/_jsx("div", {
|
|
116
|
+
thumbnail: /*#__PURE__*/_jsx("div", {
|
|
120
117
|
className: `${baseClass}__default-image`,
|
|
121
|
-
children: /*#__PURE__*/_jsx(
|
|
118
|
+
children: imageURL ? /*#__PURE__*/_jsx("img", {
|
|
119
|
+
alt: imageAltText,
|
|
120
|
+
src: imageURL
|
|
121
|
+
}) : /*#__PURE__*/_jsx(DefaultBlockImage, {})
|
|
122
122
|
})
|
|
123
123
|
})
|
|
124
124
|
}, index);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useModal","getTranslation","React","useEffect","useMemo","useState","Drawer","ThumbnailCard","DefaultBlockImage","useConfig","useTranslation","BlockSearch","baseClass","getBlockLabel","block","i18n","labels","singular","toLowerCase","BlocksDrawer","props","addRow","addRowIndex","blocks","drawerSlug","searchTerm","setSearchTerm","filteredBlocks","setFilteredBlocks","closeModal","isModalOpen","t","config","blockGroups","groups","_none","forEach","admin","group","label","Object","hasOwn","push","searchTermToUse","matchingBlocks","reduce","matchedBlocks","_block","blocksMap","blockLabel","includes","_jsxs","slug","title","_jsx","className","entries","map","groupLabel","groupBlocks","length","filter","Boolean","join","index","imageAltText","imageURL","blockLabels","alignLabel","onClick","thumbnail","alt","src"],"sources":["../../../../src/fields/Blocks/BlocksDrawer/index.tsx"],"sourcesContent":["'use client'\nimport type { I18nClient } from '@payloadcms/translations'\nimport type { ClientBlock, Labels } from 'payload'\n\nimport { useModal } from '@faceless-ui/modal'\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useEffect, useMemo, useState } from 'react'\n\nimport { Drawer } from '../../../elements/Drawer/index.js'\nimport { ThumbnailCard } from '../../../elements/ThumbnailCard/index.js'\nimport { DefaultBlockImage } from '../../../graphics/DefaultBlockImage/index.js'\nimport { useConfig } from '../../../providers/Config/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\nimport './index.scss'\nimport { BlockSearch } from './BlockSearch/index.js'\n\nexport type Props = {\n readonly addRow: (index: number, blockType?: string) => Promise<void> | void\n readonly addRowIndex: number\n readonly blocks: (ClientBlock | string)[]\n readonly drawerSlug: string\n readonly labels: Labels\n}\n\nconst baseClass = 'blocks-drawer'\n\nconst getBlockLabel = (block: ClientBlock, i18n: I18nClient) => {\n if (typeof block.labels.singular === 'string') {\n return block.labels.singular.toLowerCase()\n }\n if (typeof block.labels.singular === 'object') {\n return getTranslation(block.labels.singular, i18n).toLowerCase()\n }\n return ''\n}\n\nexport const BlocksDrawer: React.FC<Props> = (props) => {\n const { addRow, addRowIndex, blocks, drawerSlug, labels } = props\n\n const [searchTerm, setSearchTerm] = useState('')\n const [filteredBlocks, setFilteredBlocks] = useState(blocks)\n const { closeModal, isModalOpen } = useModal()\n const { i18n, t } = useTranslation()\n const { config } = useConfig()\n\n const blockGroups = useMemo(() => {\n const groups: Record<string, (ClientBlock | string)[]> = {\n _none: [],\n }\n filteredBlocks.forEach((block) => {\n if (typeof block === 'object' && block.admin?.group) {\n const group = block.admin.group\n const label = typeof group === 'string' ? group : getTranslation(group, i18n)\n\n if (Object.hasOwn(groups, label)) {\n groups[label].push(block)\n } else {\n groups[label] = [block]\n }\n } else {\n groups._none.push(block)\n }\n })\n return groups\n }, [filteredBlocks, i18n])\n\n useEffect(() => {\n if (!isModalOpen(drawerSlug)) {\n setSearchTerm('')\n }\n }, [isModalOpen, drawerSlug])\n\n useEffect(() => {\n const searchTermToUse = searchTerm.toLowerCase()\n\n const matchingBlocks = blocks?.reduce((matchedBlocks, _block) => {\n const block = typeof _block === 'string' ? config.blocksMap[_block] : _block\n const blockLabel = getBlockLabel(block, i18n)\n if (blockLabel.includes(searchTermToUse)) {\n matchedBlocks.push(block)\n }\n return matchedBlocks\n }, [])\n\n setFilteredBlocks(matchingBlocks)\n }, [searchTerm, blocks, i18n, config.blocksMap])\n\n return (\n <Drawer\n slug={drawerSlug}\n title={t('fields:addLabel', { label: getTranslation(labels.singular, i18n) })}\n >\n <BlockSearch setSearchTerm={setSearchTerm} />\n <div className={`${baseClass}__blocks-wrapper`}>\n <ul className={`${baseClass}__block-groups`}>\n {Object.entries(blockGroups).map(([groupLabel, groupBlocks]) =>\n !groupBlocks.length ? null : (\n <li\n className={[\n `${baseClass}__block-group`,\n groupLabel === '_none' && `${baseClass}__block-group-none`,\n ]\n .filter(Boolean)\n .join(' ')}\n key={groupLabel}\n >\n {groupLabel !== '_none' && (\n <h3 className={`${baseClass}__block-group-label`}>{groupLabel}</h3>\n )}\n <ul className={`${baseClass}__blocks`}>\n {groupBlocks.map((_block, index) => {\n const block = typeof _block === 'string' ? config.blocksMap[_block] : _block\n\n const { slug, imageAltText, imageURL, labels: blockLabels } = block\n\n return (\n <li className={`${baseClass}__block`} key={index}>\n <ThumbnailCard\n alignLabel=\"center\"\n label={getTranslation(blockLabels?.singular, i18n)}\n onClick={() => {\n void addRow(addRowIndex, slug)\n closeModal(drawerSlug)\n }}\n thumbnail={\n imageURL ? (\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["useModal","getTranslation","React","useEffect","useMemo","useState","Drawer","ThumbnailCard","DefaultBlockImage","useConfig","useTranslation","BlockSearch","baseClass","getBlockLabel","block","i18n","labels","singular","toLowerCase","BlocksDrawer","props","addRow","addRowIndex","blocks","drawerSlug","searchTerm","setSearchTerm","filteredBlocks","setFilteredBlocks","closeModal","isModalOpen","t","config","blockGroups","groups","_none","forEach","admin","group","label","Object","hasOwn","push","searchTermToUse","matchingBlocks","reduce","matchedBlocks","_block","blocksMap","blockLabel","includes","_jsxs","slug","title","_jsx","className","entries","map","groupLabel","groupBlocks","length","filter","Boolean","join","index","imageAltText","imageURL","blockLabels","alignLabel","onClick","thumbnail","alt","src"],"sources":["../../../../src/fields/Blocks/BlocksDrawer/index.tsx"],"sourcesContent":["'use client'\nimport type { I18nClient } from '@payloadcms/translations'\nimport type { ClientBlock, Labels } from 'payload'\n\nimport { useModal } from '@faceless-ui/modal'\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useEffect, useMemo, useState } from 'react'\n\nimport { Drawer } from '../../../elements/Drawer/index.js'\nimport { ThumbnailCard } from '../../../elements/ThumbnailCard/index.js'\nimport { DefaultBlockImage } from '../../../graphics/DefaultBlockImage/index.js'\nimport { useConfig } from '../../../providers/Config/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\nimport './index.scss'\nimport { BlockSearch } from './BlockSearch/index.js'\n\nexport type Props = {\n readonly addRow: (index: number, blockType?: string) => Promise<void> | void\n readonly addRowIndex: number\n readonly blocks: (ClientBlock | string)[]\n readonly drawerSlug: string\n readonly labels: Labels\n}\n\nconst baseClass = 'blocks-drawer'\n\nconst getBlockLabel = (block: ClientBlock, i18n: I18nClient) => {\n if (typeof block.labels.singular === 'string') {\n return block.labels.singular.toLowerCase()\n }\n if (typeof block.labels.singular === 'object') {\n return getTranslation(block.labels.singular, i18n).toLowerCase()\n }\n return ''\n}\n\nexport const BlocksDrawer: React.FC<Props> = (props) => {\n const { addRow, addRowIndex, blocks, drawerSlug, labels } = props\n\n const [searchTerm, setSearchTerm] = useState('')\n const [filteredBlocks, setFilteredBlocks] = useState(blocks)\n const { closeModal, isModalOpen } = useModal()\n const { i18n, t } = useTranslation()\n const { config } = useConfig()\n\n const blockGroups = useMemo(() => {\n const groups: Record<string, (ClientBlock | string)[]> = {\n _none: [],\n }\n filteredBlocks.forEach((block) => {\n if (typeof block === 'object' && block.admin?.group) {\n const group = block.admin.group\n const label = typeof group === 'string' ? group : getTranslation(group, i18n)\n\n if (Object.hasOwn(groups, label)) {\n groups[label].push(block)\n } else {\n groups[label] = [block]\n }\n } else {\n groups._none.push(block)\n }\n })\n return groups\n }, [filteredBlocks, i18n])\n\n useEffect(() => {\n if (!isModalOpen(drawerSlug)) {\n setSearchTerm('')\n }\n }, [isModalOpen, drawerSlug])\n\n useEffect(() => {\n const searchTermToUse = searchTerm.toLowerCase()\n\n const matchingBlocks = blocks?.reduce((matchedBlocks, _block) => {\n const block = typeof _block === 'string' ? config.blocksMap[_block] : _block\n const blockLabel = getBlockLabel(block, i18n)\n if (blockLabel.includes(searchTermToUse)) {\n matchedBlocks.push(block)\n }\n return matchedBlocks\n }, [])\n\n setFilteredBlocks(matchingBlocks)\n }, [searchTerm, blocks, i18n, config.blocksMap])\n\n return (\n <Drawer\n slug={drawerSlug}\n title={t('fields:addLabel', { label: getTranslation(labels.singular, i18n) })}\n >\n <BlockSearch setSearchTerm={setSearchTerm} />\n <div className={`${baseClass}__blocks-wrapper`}>\n <ul className={`${baseClass}__block-groups`}>\n {Object.entries(blockGroups).map(([groupLabel, groupBlocks]) =>\n !groupBlocks.length ? null : (\n <li\n className={[\n `${baseClass}__block-group`,\n groupLabel === '_none' && `${baseClass}__block-group-none`,\n ]\n .filter(Boolean)\n .join(' ')}\n key={groupLabel}\n >\n {groupLabel !== '_none' && (\n <h3 className={`${baseClass}__block-group-label`}>{groupLabel}</h3>\n )}\n <ul className={`${baseClass}__blocks`}>\n {groupBlocks.map((_block, index) => {\n const block = typeof _block === 'string' ? config.blocksMap[_block] : _block\n\n const { slug, imageAltText, imageURL, labels: blockLabels } = block\n\n return (\n <li className={`${baseClass}__block`} key={index}>\n <ThumbnailCard\n alignLabel=\"center\"\n label={getTranslation(blockLabels?.singular, i18n)}\n onClick={() => {\n void addRow(addRowIndex, slug)\n closeModal(drawerSlug)\n }}\n thumbnail={\n <div className={`${baseClass}__default-image`}>\n {imageURL ? (\n <img alt={imageAltText} src={imageURL} />\n ) : (\n <DefaultBlockImage />\n )}\n </div>\n }\n />\n </li>\n )\n })}\n </ul>\n </li>\n ),\n )}\n </ul>\n </div>\n </Drawer>\n )\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,QAAQ,QAAQ;AACzB,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ;AAEpD,SAASC,MAAM,QAAQ;AACvB,SAASC,aAAa,QAAQ;AAC9B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAC/B,OAAO;AACP,SAASC,WAAW,QAAQ;AAU5B,MAAMC,SAAA,GAAY;AAElB,MAAMC,aAAA,GAAgBA,CAACC,KAAA,EAAoBC,IAAA;EACzC,IAAI,OAAOD,KAAA,CAAME,MAAM,CAACC,QAAQ,KAAK,UAAU;IAC7C,OAAOH,KAAA,CAAME,MAAM,CAACC,QAAQ,CAACC,WAAW;EAC1C;EACA,IAAI,OAAOJ,KAAA,CAAME,MAAM,CAACC,QAAQ,KAAK,UAAU;IAC7C,OAAOhB,cAAA,CAAea,KAAA,CAAME,MAAM,CAACC,QAAQ,EAAEF,IAAA,EAAMG,WAAW;EAChE;EACA,OAAO;AACT;AAEA,OAAO,MAAMC,YAAA,GAAiCC,KAAA;EAC5C,MAAM;IAAEC,MAAM;IAAEC,WAAW;IAAEC,MAAM;IAAEC,UAAU;IAAER;EAAM,CAAE,GAAGI,KAAA;EAE5D,MAAM,CAACK,UAAA,EAAYC,aAAA,CAAc,GAAGrB,QAAA,CAAS;EAC7C,MAAM,CAACsB,cAAA,EAAgBC,iBAAA,CAAkB,GAA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G,CAAC,CAACV,QAAA,EAAQiB,KAAA;cACxB,MAAMlD,OAAA,GAAQ,OAAOiC,QAAA,KAAW,WAAWf,MAAA,CAAOgB,SAAS,CAACD,QAAA,CAAO,GAAGA,QAAA;cAEtE,MAAM;gBAAEK,IAAI;gBAAEa,YAAY;gBAAEC,QAAQ;gBAAElD,MAAA,EAAQmD;cAAW,CAAE,GAAGrD,OAAA;cAE9D,oBACEwC,IAAA,CAAC;gBAAGC,SAAA,EAAW,GAAG3C,SAAA,SAAkB;0BAClC,aAAA0C,IAAA,CAAC/C,aAAA;kBACC6D,UAAA,EAAW;kBACX7B,KAAA,EAAOtC,cAAA,CAAekE,WAAA,EAAalD,QAAA,EAAUF,IAAA;kBAC7CsD,OAAA,EAASA,CAAA;oBACP,KAAKhD,MAAA,CAAOC,WAAA,EAAa8B,IAAA;oBACzBvB,UAAA,CAAWL,UAAA;kBACb;kBACA8C,SAAA,eACEhB,IAAA,CAAC;oBAAIC,SAAA,EAAW,GAAG3C,SAAA,iBAA0B;8BAC1CsD,QAAA,gBACCZ,IAAA,CAAC;sBAAIiB,GAAA,EAAKN,YAAA;sBAAcO,GAAA,EAAKN;sCAE7BZ,IAAA,CAAC9C,iBAAA;;;iBAbgCwD,KAAA;YAoB/C;;WAhCGN,UAAA;;;;AAyCrB","ignoreList":[]}
|
|
@@ -16,9 +16,19 @@
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
&__default-image {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
19
22
|
width: 100%;
|
|
23
|
+
aspect-ratio: 3 / 2;
|
|
20
24
|
overflow: hidden;
|
|
21
|
-
|
|
25
|
+
|
|
26
|
+
img,
|
|
27
|
+
svg {
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
object-fit: cover;
|
|
31
|
+
}
|
|
22
32
|
}
|
|
23
33
|
|
|
24
34
|
&__block-groups {
|
|
@@ -60,7 +70,6 @@
|
|
|
60
70
|
|
|
61
71
|
&__blocks {
|
|
62
72
|
grid-template-columns: repeat(3, 1fr);
|
|
63
|
-
gap: base(0.5);
|
|
64
73
|
}
|
|
65
74
|
|
|
66
75
|
&__block-groups {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Collapsible/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8D,MAAM,OAAO,CAAA;AAelF,OAAO,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Collapsible/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8D,MAAM,OAAO,CAAA;AAelF,OAAO,cAAc,CAAA;AA6IrB,eAAO,MAAM,gBAAgB;;+EAA2C,CAAA"}
|
|
@@ -110,7 +110,8 @@ const CollapsibleFieldComponent = props => {
|
|
|
110
110
|
return /*#__PURE__*/_jsxs(Fragment, {
|
|
111
111
|
children: [/*#__PURE__*/_jsx(WatchChildErrors, {
|
|
112
112
|
fields: fields,
|
|
113
|
-
path
|
|
113
|
+
// removes the 'collapsible' path segment, i.e. `_index-0`
|
|
114
|
+
path: path.split('.').slice(0, -1),
|
|
114
115
|
setErrorCount: setErrorCount
|
|
115
116
|
}), /*#__PURE__*/_jsxs("div", {
|
|
116
117
|
className: [fieldBaseClass, baseClass, className, fieldHasErrors ? `${baseClass}--has-error` : `${baseClass}--has-no-error`].filter(Boolean).join(' '),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getTranslation","React","Fragment","useCallback","useEffect","useMemo","useState","Collapsible","CollapsibleElement","ErrorPill","RenderCustomComponent","FieldDescription","RenderFields","RowLabel","useField","WatchChildErrors","withCondition","useDocumentInfo","usePreferences","useTranslation","mergeFieldStyles","fieldBaseClass","baseClass","CollapsibleFieldComponent","props","field","admin","className","description","initCollapsed","fields","label","indexPath","parentPath","parentSchemaPath","path","permissions","readOnly","i18n","getPreference","setPreference","preferencesKey","collapsedOnMount","setCollapsedOnMount","fieldPreferencesKey","replace","errorCount","setErrorCount","fieldHasErrors","customComponents","AfterInput","BeforeInput","Description","Label","onToggle","newCollapsedState","existingPreferences","collapsed","fetchInitialState","preferences","specificPreference","undefined","Boolean","styles","_jsxs","_jsx","split","filter","join","id","style","collapsibleStyle","header","CustomComponent","count","withMessage","margins","parentIndexPath","Fallback","CollapsibleField"],"sources":["../../../src/fields/Collapsible/index.tsx"],"sourcesContent":["'use client'\nimport type { CollapsibleFieldClientComponent, DocumentPreferences } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { Fragment, useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { Collapsible as CollapsibleElement } from '../../elements/Collapsible/index.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { RenderFields } from '../../forms/RenderFields/index.js'\nimport { RowLabel } from '../../forms/RowLabel/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { WatchChildErrors } from '../../forms/WatchChildErrors/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { usePreferences } from '../../providers/Preferences/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { mergeFieldStyles } from '../mergeFieldStyles.js'\nimport './index.scss'\nimport { fieldBaseClass } from '../shared/index.js'\n\nconst baseClass = 'collapsible-field'\n\nconst CollapsibleFieldComponent: CollapsibleFieldClientComponent = (props) => {\n const {\n field,\n field: { admin: { className, description, initCollapsed = false } = {}, fields, label } = {},\n indexPath,\n parentPath,\n parentSchemaPath,\n path,\n permissions,\n readOnly,\n } = props\n\n const { i18n } = useTranslation()\n const { getPreference, setPreference } = usePreferences()\n const { preferencesKey } = useDocumentInfo()\n const [collapsedOnMount, setCollapsedOnMount] = useState<boolean>()\n const fieldPreferencesKey = `collapsible-${path?.replace(/\\./g, '__')}`\n const [errorCount, setErrorCount] = useState(0)\n const fieldHasErrors = errorCount > 0\n\n const { customComponents: { AfterInput, BeforeInput, Description, Label } = {} } = useField({\n path,\n })\n\n const onToggle = useCallback(\n async (newCollapsedState: boolean): Promise<void> => {\n const existingPreferences: DocumentPreferences = await getPreference(preferencesKey)\n\n if (preferencesKey) {\n void setPreference(preferencesKey, {\n ...existingPreferences,\n ...(path\n ? {\n fields: {\n ...(existingPreferences?.fields || {}),\n [path]: {\n ...existingPreferences?.fields?.[path],\n collapsed: newCollapsedState,\n },\n },\n }\n : {\n fields: {\n ...(existingPreferences?.fields || {}),\n [fieldPreferencesKey]: {\n ...existingPreferences?.fields?.[fieldPreferencesKey],\n collapsed: newCollapsedState,\n },\n },\n }),\n })\n }\n },\n [preferencesKey, fieldPreferencesKey, getPreference, setPreference, path],\n )\n\n useEffect(() => {\n const fetchInitialState = async () => {\n if (preferencesKey) {\n const preferences = await getPreference(preferencesKey)\n const specificPreference = path\n ? preferences?.fields?.[path]?.collapsed\n : preferences?.fields?.[fieldPreferencesKey]?.collapsed\n\n if (specificPreference !== undefined) {\n setCollapsedOnMount(Boolean(specificPreference))\n } else {\n setCollapsedOnMount(typeof initCollapsed === 'boolean' ? initCollapsed : false)\n }\n } else {\n setCollapsedOnMount(typeof initCollapsed === 'boolean' ? initCollapsed : false)\n }\n }\n\n void fetchInitialState()\n }, [getPreference, preferencesKey, fieldPreferencesKey, initCollapsed, path])\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n if (typeof collapsedOnMount !== 'boolean') {\n return null\n }\n\n return (\n <Fragment>\n <WatchChildErrors fields={fields} path={path.split('.')} setErrorCount={setErrorCount} />\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n fieldHasErrors ? `${baseClass}--has-error` : `${baseClass}--has-no-error`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${fieldPreferencesKey}`}\n style={styles}\n >\n {BeforeInput}\n <CollapsibleElement\n className={`${baseClass}__collapsible`}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n <div className={`${baseClass}__row-label-wrap`}>\n <RowLabel CustomComponent={Label} label={getTranslation(label, i18n)} path={path} />\n {fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}\n </div>\n }\n initCollapsed={collapsedOnMount}\n onToggle={onToggle}\n >\n <RenderFields\n fields={fields}\n margins=\"small\"\n parentIndexPath={indexPath}\n parentPath={parentPath}\n parentSchemaPath={parentSchemaPath}\n permissions={permissions}\n readOnly={readOnly}\n />\n </CollapsibleElement>\n {AfterInput}\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </Fragment>\n )\n}\n\nexport const CollapsibleField = withCondition(CollapsibleFieldComponent)\n"],"mappings":"AAAA;;;AAGA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ;AAE3E,SAASC,WAAA,IAAeC,kBAAkB,QAAQ;AAClD,SAASC,SAAS,QAAQ;AAC1B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,YAAY,QAAQ;AAC7B,SAASC,QAAQ,QAAQ;AACzB,SAASC,QAAQ,QAAQ;AACzB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,aAAa,QAAQ;AAC9B,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,gBAAgB,QAAQ;AACjC,OAAO;AACP,SAASC,cAAc,QAAQ;AAE/B,MAAMC,SAAA,GAAY;AAElB,MAAMC,yBAAA,GAA8DC,KAAA;EAClE,MAAM;IACJC,KAAK;IACLA,KAAA,EAAO;MAAEC,KAAA,EAAO;QAAEC,SAAS;QAAEC,WAAW;QAAEC,aAAA,GA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React","Fragment","useCallback","useEffect","useMemo","useState","Collapsible","CollapsibleElement","ErrorPill","RenderCustomComponent","FieldDescription","RenderFields","RowLabel","useField","WatchChildErrors","withCondition","useDocumentInfo","usePreferences","useTranslation","mergeFieldStyles","fieldBaseClass","baseClass","CollapsibleFieldComponent","props","field","admin","className","description","initCollapsed","fields","label","indexPath","parentPath","parentSchemaPath","path","permissions","readOnly","i18n","getPreference","setPreference","preferencesKey","collapsedOnMount","setCollapsedOnMount","fieldPreferencesKey","replace","errorCount","setErrorCount","fieldHasErrors","customComponents","AfterInput","BeforeInput","Description","Label","onToggle","newCollapsedState","existingPreferences","collapsed","fetchInitialState","preferences","specificPreference","undefined","Boolean","styles","_jsxs","_jsx","split","slice","filter","join","id","style","collapsibleStyle","header","CustomComponent","count","withMessage","margins","parentIndexPath","Fallback","CollapsibleField"],"sources":["../../../src/fields/Collapsible/index.tsx"],"sourcesContent":["'use client'\nimport type { CollapsibleFieldClientComponent, DocumentPreferences } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { Fragment, useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { Collapsible as CollapsibleElement } from '../../elements/Collapsible/index.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { RenderFields } from '../../forms/RenderFields/index.js'\nimport { RowLabel } from '../../forms/RowLabel/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { WatchChildErrors } from '../../forms/WatchChildErrors/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { usePreferences } from '../../providers/Preferences/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { mergeFieldStyles } from '../mergeFieldStyles.js'\nimport './index.scss'\nimport { fieldBaseClass } from '../shared/index.js'\n\nconst baseClass = 'collapsible-field'\n\nconst CollapsibleFieldComponent: CollapsibleFieldClientComponent = (props) => {\n const {\n field,\n field: { admin: { className, description, initCollapsed = false } = {}, fields, label } = {},\n indexPath,\n parentPath,\n parentSchemaPath,\n path,\n permissions,\n readOnly,\n } = props\n\n const { i18n } = useTranslation()\n const { getPreference, setPreference } = usePreferences()\n const { preferencesKey } = useDocumentInfo()\n const [collapsedOnMount, setCollapsedOnMount] = useState<boolean>()\n const fieldPreferencesKey = `collapsible-${path?.replace(/\\./g, '__')}`\n const [errorCount, setErrorCount] = useState(0)\n const fieldHasErrors = errorCount > 0\n\n const { customComponents: { AfterInput, BeforeInput, Description, Label } = {} } = useField({\n path,\n })\n\n const onToggle = useCallback(\n async (newCollapsedState: boolean): Promise<void> => {\n const existingPreferences: DocumentPreferences = await getPreference(preferencesKey)\n\n if (preferencesKey) {\n void setPreference(preferencesKey, {\n ...existingPreferences,\n ...(path\n ? {\n fields: {\n ...(existingPreferences?.fields || {}),\n [path]: {\n ...existingPreferences?.fields?.[path],\n collapsed: newCollapsedState,\n },\n },\n }\n : {\n fields: {\n ...(existingPreferences?.fields || {}),\n [fieldPreferencesKey]: {\n ...existingPreferences?.fields?.[fieldPreferencesKey],\n collapsed: newCollapsedState,\n },\n },\n }),\n })\n }\n },\n [preferencesKey, fieldPreferencesKey, getPreference, setPreference, path],\n )\n\n useEffect(() => {\n const fetchInitialState = async () => {\n if (preferencesKey) {\n const preferences = await getPreference(preferencesKey)\n const specificPreference = path\n ? preferences?.fields?.[path]?.collapsed\n : preferences?.fields?.[fieldPreferencesKey]?.collapsed\n\n if (specificPreference !== undefined) {\n setCollapsedOnMount(Boolean(specificPreference))\n } else {\n setCollapsedOnMount(typeof initCollapsed === 'boolean' ? initCollapsed : false)\n }\n } else {\n setCollapsedOnMount(typeof initCollapsed === 'boolean' ? initCollapsed : false)\n }\n }\n\n void fetchInitialState()\n }, [getPreference, preferencesKey, fieldPreferencesKey, initCollapsed, path])\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n if (typeof collapsedOnMount !== 'boolean') {\n return null\n }\n\n return (\n <Fragment>\n <WatchChildErrors\n fields={fields}\n // removes the 'collapsible' path segment, i.e. `_index-0`\n path={path.split('.').slice(0, -1)}\n setErrorCount={setErrorCount}\n />\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n fieldHasErrors ? `${baseClass}--has-error` : `${baseClass}--has-no-error`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${fieldPreferencesKey}`}\n style={styles}\n >\n {BeforeInput}\n <CollapsibleElement\n className={`${baseClass}__collapsible`}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n <div className={`${baseClass}__row-label-wrap`}>\n <RowLabel CustomComponent={Label} label={getTranslation(label, i18n)} path={path} />\n {fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}\n </div>\n }\n initCollapsed={collapsedOnMount}\n onToggle={onToggle}\n >\n <RenderFields\n fields={fields}\n margins=\"small\"\n parentIndexPath={indexPath}\n parentPath={parentPath}\n parentSchemaPath={parentSchemaPath}\n permissions={permissions}\n readOnly={readOnly}\n />\n </CollapsibleElement>\n {AfterInput}\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </Fragment>\n )\n}\n\nexport const CollapsibleField = withCondition(CollapsibleFieldComponent)\n"],"mappings":"AAAA;;;AAGA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ;AAE3E,SAASC,WAAA,IAAeC,kBAAkB,QAAQ;AAClD,SAASC,SAAS,QAAQ;AAC1B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,YAAY,QAAQ;AAC7B,SAASC,QAAQ,QAAQ;AACzB,SAASC,QAAQ,QAAQ;AACzB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,aAAa,QAAQ;AAC9B,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BAAA;UAClBE,WAAA,EAAaA,WAAA;UACbC,QAAA,EAAUA;;UAGba,UAAA,E,aACDe,IAAA,CAACvD,qBAAA;QACCgE,eAAA,EAAiBtB,WAAA;QACjB2B,QAAA,eAAUd,IAAA,CAACtD,gBAAA;UAAiBiB,WAAA,EAAaA,WAAA;UAAaO,IAAA,EAAMA;;;;;AAKtE;AAEA,OAAO,MAAM6C,gBAAA,GAAmBhE,aAAA,CAAcO,yBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Row/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Row/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,cAAc,CAAA;AAsCrB,eAAO,MAAM,QAAQ;;;;+EAAmC,CAAA"}
|
package/dist/fields/Row/index.js
CHANGED
|
@@ -12,7 +12,8 @@ const RowFieldComponent = props => {
|
|
|
12
12
|
const {
|
|
13
13
|
field: {
|
|
14
14
|
admin: {
|
|
15
|
-
className
|
|
15
|
+
className,
|
|
16
|
+
style
|
|
16
17
|
} = {},
|
|
17
18
|
fields
|
|
18
19
|
},
|
|
@@ -26,6 +27,7 @@ const RowFieldComponent = props => {
|
|
|
26
27
|
return /*#__PURE__*/_jsx(RowProvider, {
|
|
27
28
|
children: /*#__PURE__*/_jsx("div", {
|
|
28
29
|
className: [fieldBaseClass, baseClass, className].filter(Boolean).join(' '),
|
|
30
|
+
style: style || undefined,
|
|
29
31
|
children: /*#__PURE__*/_jsx(RenderFields, {
|
|
30
32
|
className: `${baseClass}__fields`,
|
|
31
33
|
fields: fields,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","RenderFields","withCondition","fieldBaseClass","RowProvider","baseClass","RowFieldComponent","props","field","admin","className","fields","forceRender","indexPath","parentPath","parentSchemaPath","permissions","readOnly","_jsx","filter","Boolean","join","margins","parentIndexPath","RowField"],"sources":["../../../src/fields/Row/index.tsx"],"sourcesContent":["'use client'\nimport type { RowFieldClientComponent } from 'payload'\n\nimport React from 'react'\n\nimport { RenderFields } from '../../forms/RenderFields/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\nimport { RowProvider } from './provider.js'\n\nconst baseClass = 'row'\n\nconst RowFieldComponent: RowFieldClientComponent = (props) => {\n const {\n field: { admin: { className } = {}, fields },\n forceRender = false,\n indexPath = '',\n parentPath = '',\n parentSchemaPath = '',\n permissions,\n readOnly,\n } = props\n\n return (\n <RowProvider>\n <div
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","RenderFields","withCondition","fieldBaseClass","RowProvider","baseClass","RowFieldComponent","props","field","admin","className","style","fields","forceRender","indexPath","parentPath","parentSchemaPath","permissions","readOnly","_jsx","filter","Boolean","join","undefined","margins","parentIndexPath","RowField"],"sources":["../../../src/fields/Row/index.tsx"],"sourcesContent":["'use client'\nimport type { RowFieldClientComponent } from 'payload'\n\nimport React from 'react'\n\nimport { RenderFields } from '../../forms/RenderFields/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\nimport { RowProvider } from './provider.js'\n\nconst baseClass = 'row'\n\nconst RowFieldComponent: RowFieldClientComponent = (props) => {\n const {\n field: { admin: { className, style } = {}, fields },\n forceRender = false,\n indexPath = '',\n parentPath = '',\n parentSchemaPath = '',\n permissions,\n readOnly,\n } = props\n\n return (\n <RowProvider>\n <div\n className={[fieldBaseClass, baseClass, className].filter(Boolean).join(' ')}\n style={style || undefined}\n >\n <RenderFields\n className={`${baseClass}__fields`}\n fields={fields}\n forceRender={forceRender}\n margins={false}\n parentIndexPath={indexPath}\n parentPath={parentPath}\n parentSchemaPath={parentSchemaPath}\n permissions={permissions}\n readOnly={readOnly}\n />\n </div>\n </RowProvider>\n )\n}\n\nexport const RowField = withCondition(RowFieldComponent)\n"],"mappings":"AAAA;;;AAGA,OAAOA,KAAA,MAAW;AAElB,SAASC,YAAY,QAAQ;AAC7B,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,OAAO;AACP,SAASC,WAAW,QAAQ;AAE5B,MAAMC,SAAA,GAAY;AAElB,MAAMC,iBAAA,GAA8CC,KAAA;EAClD,MAAM;IACJC,KAAA,EAAO;MAAEC,KAAA,EAAO;QAAEC,SAAS;QAAEC;MAAK,CAAE,GAAG,CAAC,CAAC;MAAEC;IAAM,CAAE;IACnDC,WAAA,GAAc,KAAK;IACnBC,SAAA,GAAY,EAAE;IACdC,UAAA,GAAa,EAAE;IACfC,gBAAA,GAAmB,EAAE;IACrBC,WAAW;IACXC;EAAQ,CACT,GAAGX,KAAA;EAEJ,oBACEY,IAAA,CAACf,WAAA;cACC,aAAAe,IAAA,CAAC;MACCT,SAAA,EAAW,CAACP,cAAA,EAAgBE,SAAA,EAAWK,SAAA,CAAU,CAACU,MAAM,CAACC,OAAA,EAASC,IAAI,CAAC;MACvEX,KAAA,EAAOA,KAAA,IAASY,SAAA;gBAEhB,aAAAJ,IAAA,CAAClB,YAAA;QACCS,SAAA,EAAW,GAAGL,SAAA,UAAmB;QACjCO,MAAA,EAAQA,MAAA;QACRC,WAAA,EAAaA,WAAA;QACbW,OAAA,EAAS;QACTC,eAAA,EAAiBX,SAAA;QACjBC,UAAA,EAAYA,UAAA;QACZC,gBAAA,EAAkBA,gBAAA;QAClBC,WAAA,EAAaA,WAAA;QACbC,QAAA,EAAUA;;;;AAKpB;AAEA,OAAO,MAAMQ,QAAA,GAAWxB,aAAA,CAAcI,iBAAA","ignoreList":[]}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
@layer payload-default {
|
|
4
4
|
.field-type.row {
|
|
5
|
+
margin-bottom: 0;
|
|
6
|
+
|
|
5
7
|
.row__fields {
|
|
6
8
|
display: flex;
|
|
7
9
|
flex-wrap: wrap;
|
|
@@ -14,6 +16,11 @@
|
|
|
14
16
|
justify-content: flex-start;
|
|
15
17
|
}
|
|
16
18
|
|
|
19
|
+
// add margin if the row has children
|
|
20
|
+
&:has(> *:nth-child(1)) {
|
|
21
|
+
margin-bottom: var(--base);
|
|
22
|
+
}
|
|
23
|
+
|
|
17
24
|
// If there is more than one child, add inline-margins to space them out.
|
|
18
25
|
&:has(> *:nth-child(2)) {
|
|
19
26
|
margin-inline: calc(var(--base) / -4); // add negative margin to counteract the gap.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fields/Tabs/Tab/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAIxC,OAAO,KAAmB,MAAM,OAAO,CAAA;AAKvC,OAAO,cAAc,CAAA;AAIrB,KAAK,QAAQ,GAAG;IACd,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,IAAI,CAAA;IAChC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fields/Tabs/Tab/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAIxC,OAAO,KAAmB,MAAM,OAAO,CAAA;AAKvC,OAAO,cAAc,CAAA;AAIrB,KAAK,QAAQ,GAAG;IACd,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,IAAI,CAAA;IAChC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CA+B3C,CAAA"}
|
|
@@ -11,7 +11,7 @@ import { useTranslation } from '../../../providers/Translation/index.js';
|
|
|
11
11
|
import './index.scss';
|
|
12
12
|
const baseClass = 'tabs-field__tab-button';
|
|
13
13
|
export const TabComponent = t0 => {
|
|
14
|
-
const $ = _c(
|
|
14
|
+
const $ = _c(13);
|
|
15
15
|
const {
|
|
16
16
|
isActive,
|
|
17
17
|
parentPath,
|
|
@@ -23,81 +23,55 @@ export const TabComponent = t0 => {
|
|
|
23
23
|
} = useTranslation();
|
|
24
24
|
const [errorCount, setErrorCount] = useState(undefined);
|
|
25
25
|
let t1;
|
|
26
|
-
if ($[0] !== parentPath) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} else {
|
|
31
|
-
t1 = $[1];
|
|
32
|
-
}
|
|
33
|
-
let t2;
|
|
34
|
-
if ($[2] !== tab) {
|
|
35
|
-
t2 = tabHasName(tab) ? [tab.name] : [];
|
|
36
|
-
$[2] = tab;
|
|
37
|
-
$[3] = t2;
|
|
38
|
-
} else {
|
|
39
|
-
t2 = $[3];
|
|
40
|
-
}
|
|
41
|
-
let t3;
|
|
42
|
-
if ($[4] !== t1 || $[5] !== t2) {
|
|
43
|
-
t3 = [...t1, ...t2];
|
|
44
|
-
$[4] = t1;
|
|
45
|
-
$[5] = t2;
|
|
46
|
-
$[6] = t3;
|
|
47
|
-
} else {
|
|
48
|
-
t3 = $[6];
|
|
49
|
-
}
|
|
50
|
-
const path = t3.join(".");
|
|
51
|
-
const fieldHasErrors = errorCount > 0;
|
|
52
|
-
let t4;
|
|
53
|
-
if ($[7] !== errorCount || $[8] !== fieldHasErrors || $[9] !== i18n || $[10] !== isActive || $[11] !== path || $[12] !== setIsActive || $[13] !== tab) {
|
|
54
|
-
const t5 = _jsx(WatchChildErrors, {
|
|
26
|
+
if ($[0] !== errorCount || $[1] !== i18n || $[2] !== isActive || $[3] !== parentPath || $[4] !== setIsActive || $[5] !== tab) {
|
|
27
|
+
const path = [...(parentPath ? parentPath.split(".").slice(0, -1) : []), ...(tabHasName(tab) ? [tab.name] : [])];
|
|
28
|
+
const fieldHasErrors = errorCount > 0;
|
|
29
|
+
const t2 = _jsx(WatchChildErrors, {
|
|
55
30
|
fields: tab.fields,
|
|
56
|
-
path
|
|
31
|
+
path,
|
|
57
32
|
setErrorCount
|
|
58
33
|
});
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
let
|
|
62
|
-
if ($[
|
|
63
|
-
|
|
64
|
-
$[
|
|
65
|
-
$[
|
|
66
|
-
$[
|
|
34
|
+
const t3 = fieldHasErrors && `${baseClass}--has-error`;
|
|
35
|
+
const t4 = isActive && `${baseClass}--active`;
|
|
36
|
+
let t5;
|
|
37
|
+
if ($[7] !== t3 || $[8] !== t4) {
|
|
38
|
+
t5 = [baseClass, t3, t4].filter(Boolean);
|
|
39
|
+
$[7] = t3;
|
|
40
|
+
$[8] = t4;
|
|
41
|
+
$[9] = t5;
|
|
67
42
|
} else {
|
|
68
|
-
|
|
43
|
+
t5 = $[9];
|
|
69
44
|
}
|
|
70
|
-
let
|
|
71
|
-
if ($[
|
|
72
|
-
|
|
73
|
-
$[
|
|
74
|
-
$[
|
|
75
|
-
$[
|
|
45
|
+
let t6;
|
|
46
|
+
if ($[10] !== i18n || $[11] !== tab) {
|
|
47
|
+
t6 = tab.label ? getTranslation(tab.label, i18n) : tabHasName(tab) ? tab.name : "";
|
|
48
|
+
$[10] = i18n;
|
|
49
|
+
$[11] = tab;
|
|
50
|
+
$[12] = t6;
|
|
76
51
|
} else {
|
|
77
|
-
|
|
52
|
+
t6 = $[12];
|
|
78
53
|
}
|
|
79
|
-
|
|
80
|
-
children: [
|
|
81
|
-
className:
|
|
54
|
+
t1 = _jsxs(React.Fragment, {
|
|
55
|
+
children: [t2, _jsxs("button", {
|
|
56
|
+
className: t5.join(" "),
|
|
82
57
|
onClick: setIsActive,
|
|
83
58
|
type: "button",
|
|
84
|
-
children: [
|
|
59
|
+
children: [t6, fieldHasErrors && _jsx(ErrorPill, {
|
|
85
60
|
count: errorCount,
|
|
86
61
|
i18n
|
|
87
62
|
})]
|
|
88
63
|
})]
|
|
89
64
|
});
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
$[
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
97
|
-
$[14] = t4;
|
|
65
|
+
$[0] = errorCount;
|
|
66
|
+
$[1] = i18n;
|
|
67
|
+
$[2] = isActive;
|
|
68
|
+
$[3] = parentPath;
|
|
69
|
+
$[4] = setIsActive;
|
|
70
|
+
$[5] = tab;
|
|
71
|
+
$[6] = t1;
|
|
98
72
|
} else {
|
|
99
|
-
|
|
73
|
+
t1 = $[6];
|
|
100
74
|
}
|
|
101
|
-
return
|
|
75
|
+
return t1;
|
|
102
76
|
};
|
|
103
77
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","getTranslation","tabHasName","React","useState","ErrorPill","WatchChildErrors","useTranslation","baseClass","TabComponent","t0","$","isActive","parentPath","setIsActive","tab","i18n","errorCount","setErrorCount","undefined","t1","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","getTranslation","tabHasName","React","useState","ErrorPill","WatchChildErrors","useTranslation","baseClass","TabComponent","t0","$","isActive","parentPath","setIsActive","tab","i18n","errorCount","setErrorCount","undefined","t1","path","split","slice","name","fieldHasErrors","t2","_jsx","fields","t3","t4","t5","filter","Boolean","t6","label","_jsxs","Fragment","children","className","join","onClick","type","count"],"sources":["../../../../src/fields/Tabs/Tab/index.tsx"],"sourcesContent":["'use client'\n\nimport type { ClientTab } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { tabHasName } from 'payload/shared'\nimport React, { useState } from 'react'\n\nimport { ErrorPill } from '../../../elements/ErrorPill/index.js'\nimport { WatchChildErrors } from '../../../forms/WatchChildErrors/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\nimport './index.scss'\n\nconst baseClass = 'tabs-field__tab-button'\n\ntype TabProps = {\n readonly isActive?: boolean\n readonly parentPath: string\n readonly setIsActive: () => void\n readonly tab: ClientTab\n}\n\nexport const TabComponent: React.FC<TabProps> = ({ isActive, parentPath, setIsActive, tab }) => {\n const { i18n } = useTranslation()\n const [errorCount, setErrorCount] = useState(undefined)\n\n const path = [\n // removes parent 'tabs' path segment, i.e. `_index-0`\n ...(parentPath ? parentPath.split('.').slice(0, -1) : []),\n ...(tabHasName(tab) ? [tab.name] : []),\n ]\n\n const fieldHasErrors = errorCount > 0\n\n return (\n <React.Fragment>\n <WatchChildErrors fields={tab.fields} path={path} setErrorCount={setErrorCount} />\n <button\n className={[\n baseClass,\n fieldHasErrors && `${baseClass}--has-error`,\n isActive && `${baseClass}--active`,\n ]\n .filter(Boolean)\n .join(' ')}\n onClick={setIsActive}\n type=\"button\"\n >\n {tab.label ? getTranslation(tab.label, i18n) : tabHasName(tab) ? tab.name : ''}\n {fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} />}\n </button>\n </React.Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,cAAc,QAAQ;AAC/B,SAASC,UAAU,QAAQ;AAC3B,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAEhC,SAASC,SAAS,QAAQ;AAC1B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAC/B,OAAO;AAEP,MAAMC,SAAA,GAAY;AASlB,OAAO,MAAMC,YAAA,GAAmCC,EAAA;EAAA,MAAAC,CAAA,GAAAX,EAAA;EAA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pC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fields/Upload/HasMany/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC,OAAO,KAAK,MAAM,OAAO,CAAA;AAUzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,cAAc,CAAA;AAErB,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAA;IACjC,QAAQ,CAAC,QAAQ,EAAE;QACjB,UAAU,EAAE,MAAM,CAAA;QAClB,KAAK,EAAE,UAAU,CAAA;KAClB,EAAE,CAAA;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,KAAA,KAAK,IAAI,CAAA;IACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,KAAA,KAAK,IAAI,CAAA;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK,qBAyHlD"}
|
|
@@ -11,9 +11,10 @@ import { UploadCard } from '../UploadCard/index.js';
|
|
|
11
11
|
const baseClass = 'upload upload--has-many';
|
|
12
12
|
import './index.scss';
|
|
13
13
|
export function UploadComponentHasMany(props) {
|
|
14
|
-
const $ = _c(
|
|
14
|
+
const $ = _c(27);
|
|
15
15
|
const {
|
|
16
16
|
className,
|
|
17
|
+
displayPreview,
|
|
17
18
|
fileDocs,
|
|
18
19
|
isSortable,
|
|
19
20
|
onRemove,
|
|
@@ -64,9 +65,9 @@ export function UploadComponentHasMany(props) {
|
|
|
64
65
|
}
|
|
65
66
|
const t3 = t2.join(" ");
|
|
66
67
|
let t4;
|
|
67
|
-
if ($[8] !==
|
|
68
|
+
if ($[8] !== displayPreview || $[9] !== fileDocs || $[10] !== isSortable || $[11] !== moveRow || $[12] !== readonly || $[13] !== reloadDoc || $[14] !== removeItem || $[15] !== serverURL || $[16] !== t3) {
|
|
68
69
|
let t5;
|
|
69
|
-
if ($[
|
|
70
|
+
if ($[18] !== moveRow) {
|
|
70
71
|
t5 = t6 => {
|
|
71
72
|
const {
|
|
72
73
|
moveFromIndex: moveFromIndex_0,
|
|
@@ -74,13 +75,13 @@ export function UploadComponentHasMany(props) {
|
|
|
74
75
|
} = t6;
|
|
75
76
|
return moveRow(moveFromIndex_0, moveToIndex_0);
|
|
76
77
|
};
|
|
77
|
-
$[
|
|
78
|
-
$[
|
|
78
|
+
$[18] = moveRow;
|
|
79
|
+
$[19] = t5;
|
|
79
80
|
} else {
|
|
80
|
-
t5 = $[
|
|
81
|
+
t5 = $[19];
|
|
81
82
|
}
|
|
82
83
|
let t6;
|
|
83
|
-
if ($[
|
|
84
|
+
if ($[20] !== displayPreview || $[21] !== isSortable || $[22] !== readonly || $[23] !== reloadDoc || $[24] !== removeItem || $[25] !== serverURL) {
|
|
84
85
|
t6 = (t7, index_0) => {
|
|
85
86
|
const {
|
|
86
87
|
relationTo,
|
|
@@ -127,6 +128,7 @@ export function UploadComponentHasMany(props) {
|
|
|
127
128
|
alt: value_0?.alt || value_0?.filename,
|
|
128
129
|
byteSize: value_0.filesize,
|
|
129
130
|
collectionSlug: relationTo,
|
|
131
|
+
displayPreview,
|
|
130
132
|
filename: value_0.filename,
|
|
131
133
|
id,
|
|
132
134
|
mimeType: value_0?.mimeType,
|
|
@@ -142,14 +144,15 @@ export function UploadComponentHasMany(props) {
|
|
|
142
144
|
})
|
|
143
145
|
}, id);
|
|
144
146
|
};
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
147
|
+
$[20] = displayPreview;
|
|
148
|
+
$[21] = isSortable;
|
|
149
|
+
$[22] = readonly;
|
|
150
|
+
$[23] = reloadDoc;
|
|
151
|
+
$[24] = removeItem;
|
|
152
|
+
$[25] = serverURL;
|
|
153
|
+
$[26] = t6;
|
|
151
154
|
} else {
|
|
152
|
-
t6 = $[
|
|
155
|
+
t6 = $[26];
|
|
153
156
|
}
|
|
154
157
|
t4 = _jsx("div", {
|
|
155
158
|
className: t3,
|
|
@@ -160,17 +163,18 @@ export function UploadComponentHasMany(props) {
|
|
|
160
163
|
children: fileDocs.map(t6)
|
|
161
164
|
})
|
|
162
165
|
});
|
|
163
|
-
$[8] =
|
|
164
|
-
$[9] =
|
|
165
|
-
$[10] =
|
|
166
|
-
$[11] =
|
|
167
|
-
$[12] =
|
|
168
|
-
$[13] =
|
|
169
|
-
$[14] =
|
|
170
|
-
$[15] =
|
|
171
|
-
$[16] =
|
|
166
|
+
$[8] = displayPreview;
|
|
167
|
+
$[9] = fileDocs;
|
|
168
|
+
$[10] = isSortable;
|
|
169
|
+
$[11] = moveRow;
|
|
170
|
+
$[12] = readonly;
|
|
171
|
+
$[13] = reloadDoc;
|
|
172
|
+
$[14] = removeItem;
|
|
173
|
+
$[15] = serverURL;
|
|
174
|
+
$[16] = t3;
|
|
175
|
+
$[17] = t4;
|
|
172
176
|
} else {
|
|
173
|
-
t4 = $[
|
|
177
|
+
t4 = $[17];
|
|
174
178
|
}
|
|
175
179
|
return t4;
|
|
176
180
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","React","DraggableSortableItem","DraggableSortable","DragHandleIcon","RelationshipContent","UploadCard","baseClass","UploadComponentHasMany","props","$","className","fileDocs","isSortable","onRemove","onReorder","readonly","reloadDoc","serverURL","t0","moveFromIndex","moveToIndex","updatedArray","item","splice","moveRow","t1","index","updatedArray_0","length","removeItem","t2","filter","Boolean","t3","join","t4","t5","t6","moveFromIndex_0","moveToIndex_0","t7","index_0","relationTo","value","value_0","id","String","src","thumbnailSrc","url","toString","thumbnailURL","_jsx","disabled","children","draggableSortableItemProps","ref","setNodeRef","style","transform","transition","zIndex","isDragging","undefined","_jsxs","size","attributes","listeners","allowEdit","allowRemove","alt","filename","byteSize","filesize","collectionSlug","mimeType","withMeta","x","width","y","height","ids","map","_temp","onDragEnd"],"sources":["../../../../src/fields/Upload/HasMany/index.tsx"],"sourcesContent":["'use client'\nimport type { JsonObject } from 'payload'\n\nimport React from 'react'\n\nimport { DraggableSortableItem } from '../../../elements/DraggableSortable/DraggableSortableItem/index.js'\nimport { DraggableSortable } from '../../../elements/DraggableSortable/index.js'\nimport { DragHandleIcon } from '../../../icons/DragHandle/index.js'\nimport { RelationshipContent } from '../RelationshipContent/index.js'\nimport { UploadCard } from '../UploadCard/index.js'\n\nconst baseClass = 'upload upload--has-many'\n\nimport type { ReloadDoc } from '../types.js'\n\nimport './index.scss'\n\ntype Props = {\n readonly className?: string\n readonly fileDocs: {\n relationTo: string\n value: JsonObject\n }[]\n readonly isSortable?: boolean\n readonly onRemove?: (value) => void\n readonly onReorder?: (value) => void\n readonly readonly?: boolean\n readonly reloadDoc: ReloadDoc\n readonly serverURL: string\n}\n\nexport function UploadComponentHasMany(props: Props) {\n const { className, fileDocs, isSortable, onRemove, onReorder, readonly, reloadDoc, serverURL } =\n props\n\n const moveRow = React.useCallback(\n (moveFromIndex: number, moveToIndex: number) => {\n if (moveFromIndex === moveToIndex) {\n return\n }\n\n const updatedArray = [...fileDocs]\n const [item] = updatedArray.splice(moveFromIndex, 1)\n\n updatedArray.splice(moveToIndex, 0, item)\n\n onReorder(updatedArray)\n },\n [fileDocs, onReorder],\n )\n\n const removeItem = React.useCallback(\n (index: number) => {\n const updatedArray = [...(fileDocs || [])]\n updatedArray.splice(index, 1)\n onRemove(updatedArray.length === 0 ? [] : updatedArray)\n },\n [fileDocs, onRemove],\n )\n\n return (\n <div className={[baseClass, className].filter(Boolean).join(' ')}>\n <DraggableSortable\n className={`${baseClass}__draggable-rows`}\n ids={fileDocs?.map(({ value }) => String(value.id))}\n onDragEnd={({ moveFromIndex, moveToIndex }) => moveRow(moveFromIndex, moveToIndex)}\n >\n {fileDocs.map(({ relationTo, value }, index) => {\n const id = String(value.id)\n let src: string\n let thumbnailSrc: string\n\n if (value.url) {\n try {\n src = new URL(value.url, serverURL).toString()\n } catch {\n src = `${serverURL}${value.url}`\n }\n }\n\n if (value.thumbnailURL) {\n try {\n thumbnailSrc = new URL(value.thumbnailURL, serverURL).toString()\n } catch {\n thumbnailSrc = `${serverURL}${value.thumbnailURL}`\n }\n }\n\n return (\n <DraggableSortableItem disabled={!isSortable || readonly} id={id} key={id}>\n {(draggableSortableItemProps) => (\n <div\n className={[\n `${baseClass}__dragItem`,\n draggableSortableItemProps && isSortable && `${baseClass}--has-drag-handle`,\n ]\n .filter(Boolean)\n .join(' ')}\n ref={draggableSortableItemProps.setNodeRef}\n style={{\n transform: draggableSortableItemProps.transform,\n transition: draggableSortableItemProps.transition,\n zIndex: draggableSortableItemProps.isDragging ? 1 : undefined,\n }}\n >\n <UploadCard size=\"small\">\n {draggableSortableItemProps && (\n <div\n className={`${baseClass}__drag`}\n {...draggableSortableItemProps.attributes}\n {...draggableSortableItemProps.listeners}\n >\n <DragHandleIcon />\n </div>\n )}\n\n <RelationshipContent\n allowEdit={!readonly}\n allowRemove={!readonly}\n alt={(value?.alt || value?.filename) as string}\n byteSize={value.filesize as number}\n collectionSlug={relationTo}\n filename={value.filename as string}\n id={id}\n mimeType={value?.mimeType as string}\n onRemove={() => removeItem(index)}\n reloadDoc={reloadDoc}\n src={src}\n thumbnailSrc={thumbnailSrc || src}\n withMeta={false}\n x={value?.width as number}\n y={value?.height as number}\n />\n </UploadCard>\n </div>\n )}\n </DraggableSortableItem>\n )\n })}\n </DraggableSortable>\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,OAAOC,KAAA,MAAW;AAElB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,cAAc,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAE3B,MAAMC,SAAA,GAAY;AAIlB,OAAO;AAgBP,OAAO,SAAAC,uBAAAC,KAAA;EAAA,MAAAC,CAAA,GAAAV,EAAA;EACL;IAAAW,SAAA;IAAAC,QAAA;IAAAC,UAAA;IAAAC,QAAA;IAAAC,SAAA;IAAAC,QAAA;IAAAC,SAAA;IAAAC;EAAA,IACET,KAAA;EAAA,IAAAU,EAAA;EAAA,IAAAT,CAAA,QAAAE,QAAA,IAAAF,CAAA,QAAAK,SAAA;IAGAI,EAAA,GAAAA,CAAAC,aAAA,EAAAC,WAAA;MAAA,IACMD,aAAA,KAAkBC,WAAA;QAAA;MAAA;MAItB,MAAAC,YAAA,OAAyBV,QAAA;MACzB,OAAAW,IAAA,IAAeD,YAAA,CAAAE,MAAA,CAAoBJ,aAAA,GAAe;MAElDE,YAAA,CAAAE,MAAA,CAAoBH,WAAA,KAAgBE,IAAA;MAEpCR,SAAA,CAAUO,YAAA;IAAA;IACZZ,CAAA,MAAAE,QAAA;IAAAF,CAAA,MAAAK,SAAA;IAAAL,CAAA,MAAAS,EAAA;EAAA;IAAAA,EAAA,GAAAT,CAAA;EAAA;EAZF,MAAAe,OAAA,GAAgBN,EAaO;EAAA,IAAAO,EAAA;EAAA,IAAAhB,CAAA,QAAAE,QAAA,IAAAF,CAAA,QAAAI,QAAA;IAIrBY,EAAA,GAAAC,KAAA;MACE,MAAAC,cA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ACa,GAAAJ,SAAA,kBAA8B;QAAA2E,GAAA,EACpCtE,QAAA,EAAAuE,GAAA,CAAAC,KAAA;QAAAC,SAAA,EACMhD,EAA2D;QAAAkB,QAAA,EAErE3C,QAAA,CAAAuE,GAAA,CAAa7C,EAuEd;MAAA,C;;;;;;;;;;;;;;SA7EJF,E;;AA9BG,SAAAgD,MAAAjE,EAAA;EAiCqB;IAAAyB;EAAA,IAAAzB,EAAS;EAAA,OAAK4B,MAAA,CAAOH,KAAA,CAAAE,EAAQ;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","React","DraggableSortableItem","DraggableSortable","DragHandleIcon","RelationshipContent","UploadCard","baseClass","UploadComponentHasMany","props","$","className","displayPreview","fileDocs","isSortable","onRemove","onReorder","readonly","reloadDoc","serverURL","t0","moveFromIndex","moveToIndex","updatedArray","item","splice","moveRow","t1","index","updatedArray_0","length","removeItem","t2","filter","Boolean","t3","join","t4","t5","t6","moveFromIndex_0","moveToIndex_0","t7","index_0","relationTo","value","value_0","id","String","src","thumbnailSrc","url","toString","thumbnailURL","_jsx","disabled","children","draggableSortableItemProps","ref","setNodeRef","style","transform","transition","zIndex","isDragging","undefined","_jsxs","size","attributes","listeners","allowEdit","allowRemove","alt","filename","byteSize","filesize","collectionSlug","mimeType","withMeta","x","width","y","height","ids","map","_temp","onDragEnd"],"sources":["../../../../src/fields/Upload/HasMany/index.tsx"],"sourcesContent":["'use client'\nimport type { JsonObject } from 'payload'\n\nimport React from 'react'\n\nimport { DraggableSortableItem } from '../../../elements/DraggableSortable/DraggableSortableItem/index.js'\nimport { DraggableSortable } from '../../../elements/DraggableSortable/index.js'\nimport { DragHandleIcon } from '../../../icons/DragHandle/index.js'\nimport { RelationshipContent } from '../RelationshipContent/index.js'\nimport { UploadCard } from '../UploadCard/index.js'\n\nconst baseClass = 'upload upload--has-many'\n\nimport type { ReloadDoc } from '../types.js'\n\nimport './index.scss'\n\ntype Props = {\n readonly className?: string\n readonly displayPreview?: boolean\n readonly fileDocs: {\n relationTo: string\n value: JsonObject\n }[]\n readonly isSortable?: boolean\n readonly onRemove?: (value) => void\n readonly onReorder?: (value) => void\n readonly readonly?: boolean\n readonly reloadDoc: ReloadDoc\n readonly serverURL: string\n}\n\nexport function UploadComponentHasMany(props: Props) {\n const {\n className,\n displayPreview,\n fileDocs,\n isSortable,\n onRemove,\n onReorder,\n readonly,\n reloadDoc,\n serverURL,\n } = props\n\n const moveRow = React.useCallback(\n (moveFromIndex: number, moveToIndex: number) => {\n if (moveFromIndex === moveToIndex) {\n return\n }\n\n const updatedArray = [...fileDocs]\n const [item] = updatedArray.splice(moveFromIndex, 1)\n\n updatedArray.splice(moveToIndex, 0, item)\n\n onReorder(updatedArray)\n },\n [fileDocs, onReorder],\n )\n\n const removeItem = React.useCallback(\n (index: number) => {\n const updatedArray = [...(fileDocs || [])]\n updatedArray.splice(index, 1)\n onRemove(updatedArray.length === 0 ? [] : updatedArray)\n },\n [fileDocs, onRemove],\n )\n\n return (\n <div className={[baseClass, className].filter(Boolean).join(' ')}>\n <DraggableSortable\n className={`${baseClass}__draggable-rows`}\n ids={fileDocs?.map(({ value }) => String(value.id))}\n onDragEnd={({ moveFromIndex, moveToIndex }) => moveRow(moveFromIndex, moveToIndex)}\n >\n {fileDocs.map(({ relationTo, value }, index) => {\n const id = String(value.id)\n let src: string\n let thumbnailSrc: string\n\n if (value.url) {\n try {\n src = new URL(value.url, serverURL).toString()\n } catch {\n src = `${serverURL}${value.url}`\n }\n }\n\n if (value.thumbnailURL) {\n try {\n thumbnailSrc = new URL(value.thumbnailURL, serverURL).toString()\n } catch {\n thumbnailSrc = `${serverURL}${value.thumbnailURL}`\n }\n }\n\n return (\n <DraggableSortableItem disabled={!isSortable || readonly} id={id} key={id}>\n {(draggableSortableItemProps) => (\n <div\n className={[\n `${baseClass}__dragItem`,\n draggableSortableItemProps && isSortable && `${baseClass}--has-drag-handle`,\n ]\n .filter(Boolean)\n .join(' ')}\n ref={draggableSortableItemProps.setNodeRef}\n style={{\n transform: draggableSortableItemProps.transform,\n transition: draggableSortableItemProps.transition,\n zIndex: draggableSortableItemProps.isDragging ? 1 : undefined,\n }}\n >\n <UploadCard size=\"small\">\n {draggableSortableItemProps && (\n <div\n className={`${baseClass}__drag`}\n {...draggableSortableItemProps.attributes}\n {...draggableSortableItemProps.listeners}\n >\n <DragHandleIcon />\n </div>\n )}\n\n <RelationshipContent\n allowEdit={!readonly}\n allowRemove={!readonly}\n alt={(value?.alt || value?.filename) as string}\n byteSize={value.filesize as number}\n collectionSlug={relationTo}\n displayPreview={displayPreview}\n filename={value.filename as string}\n id={id}\n mimeType={value?.mimeType as string}\n onRemove={() => removeItem(index)}\n reloadDoc={reloadDoc}\n src={src}\n thumbnailSrc={thumbnailSrc || src}\n withMeta={false}\n x={value?.width as number}\n y={value?.height as number}\n />\n </UploadCard>\n </div>\n )}\n </DraggableSortableItem>\n )\n })}\n </DraggableSortable>\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,OAAOC,KAAA,MAAW;AAElB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,cAAc,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAE3B,MAAMC,SAAA,GAAY;AAIlB,OAAO;AAiBP,OAAO,SAAAC,uBAAAC,KAAA;EAAA,MAAAC,CAAA,GAAAV,EAAA;EACL;IAAAW,SAAA;IAAAC,cAAA;IAAAC,QAAA;IAAAC,UAAA;IAAAC,QAAA;IAAAC,SAAA;IAAAC,QAAA;IAAAC,SAAA;IAAAC;EAAA,IAUIV,KAAA;EAAA,IAAAW,EAAA;EAAA,IAAAV,CAAA,QAAAG,QAAA,IAAAH,CAAA,QAAAM,SAAA;IAGFI,EAAA,GAAAA,CAAAC,aAAA,EAAAC,WAAA;MAAA,IACMD,aAAA,KAAkBC,WAAA;QAAA;MAAA;M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AAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE;QAChB,UAAU,EAAE,MAAM,CAAA;QAClB,KAAK,EAAE,UAAU,CAAA;KAClB,CAAA;IACD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fields/Upload/HasOne/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAI5C,OAAO,cAAc,CAAA;AAIrB,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE;QAChB,UAAU,EAAE,MAAM,CAAA;QAClB,KAAK,EAAE,UAAU,CAAA;KAClB,CAAA;IACD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,qBA6CjD"}
|
|
@@ -9,6 +9,7 @@ const baseClass = 'upload upload--has-one';
|
|
|
9
9
|
export function UploadComponentHasOne(props) {
|
|
10
10
|
const {
|
|
11
11
|
className,
|
|
12
|
+
displayPreview,
|
|
12
13
|
fileDoc,
|
|
13
14
|
onRemove,
|
|
14
15
|
readonly,
|
|
@@ -44,6 +45,7 @@ export function UploadComponentHasOne(props) {
|
|
|
44
45
|
alt: value?.alt || value?.filename,
|
|
45
46
|
byteSize: value.filesize,
|
|
46
47
|
collectionSlug: relationTo,
|
|
48
|
+
displayPreview: displayPreview,
|
|
47
49
|
filename: value.filename,
|
|
48
50
|
id: id,
|
|
49
51
|
mimeType: value?.mimeType,
|