@payloadcms/ui 3.0.0-beta.42 → 3.0.0-beta.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/elements/Autosave/index.d.ts.map +1 -1
- package/dist/elements/Autosave/index.js +99 -32
- package/dist/elements/Autosave/index.js.map +1 -1
- package/dist/elements/DeleteDocument/index.d.ts.map +1 -1
- package/dist/elements/DeleteDocument/index.js +1 -2
- package/dist/elements/DeleteDocument/index.js.map +1 -1
- package/dist/elements/DeleteMany/index.d.ts.map +1 -1
- package/dist/elements/DeleteMany/index.js +1 -2
- package/dist/elements/DeleteMany/index.js.map +1 -1
- package/dist/elements/DocumentControls/index.d.ts.map +1 -1
- package/dist/elements/DocumentControls/index.js +3 -2
- package/dist/elements/DocumentControls/index.js.map +1 -1
- package/dist/elements/DocumentDrawer/DrawerContent.d.ts.map +1 -1
- package/dist/elements/DocumentDrawer/DrawerContent.js +1 -2
- package/dist/elements/DocumentDrawer/DrawerContent.js.map +1 -1
- package/dist/elements/DocumentDrawer/index.d.ts.map +1 -1
- package/dist/elements/DocumentDrawer/index.js +1 -2
- package/dist/elements/DocumentDrawer/index.js.map +1 -1
- package/dist/elements/Drawer/index.d.ts.map +1 -1
- package/dist/elements/Drawer/index.js +1 -3
- package/dist/elements/Drawer/index.js.map +1 -1
- package/dist/elements/DuplicateDocument/index.d.ts.map +1 -1
- package/dist/elements/DuplicateDocument/index.js +1 -2
- package/dist/elements/DuplicateDocument/index.js.map +1 -1
- package/dist/elements/EditMany/index.d.ts.map +1 -1
- package/dist/elements/EditMany/index.js +1 -2
- package/dist/elements/EditMany/index.js.map +1 -1
- package/dist/elements/EditUpload/index.d.ts.map +1 -1
- package/dist/elements/EditUpload/index.js +1 -5
- package/dist/elements/EditUpload/index.js.map +1 -1
- package/dist/elements/GenerateConfirmation/index.d.ts.map +1 -1
- package/dist/elements/GenerateConfirmation/index.js +1 -2
- package/dist/elements/GenerateConfirmation/index.js.map +1 -1
- package/dist/elements/ListControls/index.d.ts.map +1 -1
- package/dist/elements/ListControls/index.js +1 -2
- package/dist/elements/ListControls/index.js.map +1 -1
- package/dist/elements/ListDrawer/DrawerContent.d.ts.map +1 -1
- package/dist/elements/ListDrawer/DrawerContent.js +1 -2
- package/dist/elements/ListDrawer/DrawerContent.js.map +1 -1
- package/dist/elements/ListDrawer/index.d.ts.map +1 -1
- package/dist/elements/ListDrawer/index.js +1 -2
- package/dist/elements/ListDrawer/index.js.map +1 -1
- package/dist/elements/Modal/index.d.ts +1 -7
- package/dist/elements/Modal/index.d.ts.map +1 -1
- package/dist/elements/Modal/index.js +1 -7
- package/dist/elements/Modal/index.js.map +1 -1
- package/dist/elements/Nav/NavToggler/index.d.ts.map +1 -1
- package/dist/elements/Nav/NavToggler/index.js +1 -2
- package/dist/elements/Nav/NavToggler/index.js.map +1 -1
- package/dist/elements/Nav/context.d.ts.map +1 -1
- package/dist/elements/Nav/context.js +1 -2
- package/dist/elements/Nav/context.js.map +1 -1
- package/dist/elements/Popup/index.d.ts.map +1 -1
- package/dist/elements/Popup/index.js +1 -2
- package/dist/elements/Popup/index.js.map +1 -1
- package/dist/elements/PublishMany/index.d.ts.map +1 -1
- package/dist/elements/PublishMany/index.js +1 -2
- package/dist/elements/PublishMany/index.js.map +1 -1
- package/dist/elements/Status/index.d.ts.map +1 -1
- package/dist/elements/Status/index.js +1 -2
- package/dist/elements/Status/index.js.map +1 -1
- package/dist/elements/StayLoggedIn/index.d.ts.map +1 -1
- package/dist/elements/StayLoggedIn/index.js +1 -2
- package/dist/elements/StayLoggedIn/index.js.map +1 -1
- package/dist/elements/TableColumns/buildColumnState.d.ts.map +1 -1
- package/dist/elements/TableColumns/buildColumnState.js +2 -1
- package/dist/elements/TableColumns/buildColumnState.js.map +1 -1
- package/dist/elements/UnpublishMany/index.d.ts.map +1 -1
- package/dist/elements/UnpublishMany/index.js +1 -2
- package/dist/elements/UnpublishMany/index.js.map +1 -1
- package/dist/elements/WindowInfo/index.d.ts +1 -3
- package/dist/elements/WindowInfo/index.d.ts.map +1 -1
- package/dist/elements/WindowInfo/index.js +1 -7
- package/dist/elements/WindowInfo/index.js.map +1 -1
- package/dist/exports/elements.d.ts +1 -6
- package/dist/exports/elements.d.ts.map +1 -1
- package/dist/exports/elements.js +1 -4
- package/dist/exports/elements.js.map +1 -1
- package/dist/fields/Blocks/BlocksDrawer/index.d.ts.map +1 -1
- package/dist/fields/Blocks/BlocksDrawer/index.js +1 -2
- package/dist/fields/Blocks/BlocksDrawer/index.js.map +1 -1
- package/dist/fields/Blocks/RowActions.d.ts.map +1 -1
- package/dist/fields/Blocks/RowActions.js +1 -2
- package/dist/fields/Blocks/RowActions.js.map +1 -1
- package/dist/fields/Checkbox/Input.d.ts.map +1 -1
- package/dist/fields/Checkbox/Input.js +1 -0
- package/dist/fields/Checkbox/Input.js.map +1 -1
- package/dist/fields/Tabs/index.d.ts.map +1 -1
- package/dist/fields/Tabs/index.js +10 -1
- package/dist/fields/Tabs/index.js.map +1 -1
- package/dist/hooks/useHotkey.d.ts.map +1 -1
- package/dist/hooks/useHotkey.js +1 -2
- package/dist/hooks/useHotkey.js.map +1 -1
- package/dist/hooks/useIntersect.d.ts +5 -1
- package/dist/hooks/useIntersect.d.ts.map +1 -1
- package/dist/hooks/useIntersect.js +2 -1
- package/dist/hooks/useIntersect.js.map +1 -1
- package/dist/hooks/useResize.d.ts +1 -2
- package/dist/hooks/useResize.d.ts.map +1 -1
- package/dist/hooks/useResize.js +5 -6
- package/dist/hooks/useResize.js.map +1 -1
- package/dist/providers/Auth/index.d.ts.map +1 -1
- package/dist/providers/Auth/index.js +1 -2
- package/dist/providers/Auth/index.js.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/fields.d.ts.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/fields.js +5 -0
- package/dist/providers/ComponentMap/buildComponentMap/fields.js.map +1 -1
- package/dist/providers/Root/index.d.ts.map +1 -1
- package/dist/providers/Root/index.js +3 -13
- package/dist/providers/Root/index.js.map +1 -1
- package/dist/utilities/buildFieldSchemaMap/traverseFields.d.ts.map +1 -1
- package/dist/utilities/buildFieldSchemaMap/traverseFields.js +5 -0
- package/dist/utilities/buildFieldSchemaMap/traverseFields.js.map +1 -1
- package/dist/utilities/reduceFieldsToValuesWithValidation.d.ts +15 -0
- package/dist/utilities/reduceFieldsToValuesWithValidation.d.ts.map +1 -0
- package/dist/utilities/reduceFieldsToValuesWithValidation.js +29 -0
- package/dist/utilities/reduceFieldsToValuesWithValidation.js.map +1 -0
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/elements/Status/index.tsx"],"sourcesContent":["'use client'\nimport * as facelessUIImport from '@faceless-ui/modal'\nimport React, { useCallback, useState } from 'react'\nimport { toast } from 'react-toastify'\n\nimport { useForm } from '../../forms/Form/context.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { MinimalTemplate } from '../../templates/Minimal/index.js'\nimport { requests } from '../../utilities/api.js'\nimport { Button } from '../Button/index.js'\nimport './index.scss'\n\nconst baseClass = 'status'\n\nexport const Status: React.FC = () => {\n const { Modal, useModal } = facelessUIImport\n\n const {\n id,\n collectionSlug,\n docPermissions,\n getVersions,\n globalSlug,\n publishedDoc,\n unpublishedVersions,\n } = useDocumentInfo()\n const { toggleModal } = useModal()\n const {\n routes: { api },\n serverURL,\n } = useConfig()\n const [processing, setProcessing] = useState(false)\n const { reset: resetForm } = useForm()\n const { code: locale } = useLocale()\n const { i18n, t } = useTranslation()\n\n const unPublishModalSlug = `confirm-un-publish-${id}`\n const revertModalSlug = `confirm-revert-${id}`\n\n let statusToRender: 'changed' | 'draft' | 'published'\n\n if (unpublishedVersions?.docs?.length > 0 && publishedDoc) {\n statusToRender = 'changed'\n } else if (!publishedDoc) {\n statusToRender = 'draft'\n } else if (publishedDoc && unpublishedVersions?.docs?.length <= 1) {\n statusToRender = 'published'\n }\n\n const performAction = useCallback(\n async (action: 'revert' | 'unpublish') => {\n let url\n let method\n let body\n\n setProcessing(true)\n\n if (action === 'unpublish') {\n body = {\n _status: 'draft',\n }\n }\n\n if (action === 'revert') {\n body = publishedDoc\n }\n\n if (collectionSlug) {\n url = `${serverURL}${api}/${collectionSlug}/${id}?locale=${locale}&fallback-locale=null`\n method = 'patch'\n }\n if (globalSlug) {\n url = `${serverURL}${api}/globals/${globalSlug}?locale=${locale}&fallback-locale=null`\n method = 'post'\n }\n\n const res = await requests[method](url, {\n body: JSON.stringify(body),\n headers: {\n 'Accept-Language': i18n.language,\n 'Content-Type': 'application/json',\n },\n })\n\n if (res.status === 200) {\n let data\n const json = await res.json()\n\n if (globalSlug) {\n data = json.result\n } else if (collectionSlug) {\n data = json.doc\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n resetForm(data)\n toast.success(json.message)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n getVersions()\n } else {\n toast.error(t('error:unPublishingDocument'))\n }\n\n setProcessing(false)\n if (action === 'revert') {\n toggleModal(revertModalSlug)\n }\n\n if (action === 'unpublish') {\n toggleModal(unPublishModalSlug)\n }\n },\n [\n api,\n collectionSlug,\n getVersions,\n globalSlug,\n i18n.language,\n id,\n locale,\n publishedDoc,\n resetForm,\n revertModalSlug,\n serverURL,\n t,\n toggleModal,\n unPublishModalSlug,\n ],\n )\n\n const canUpdate = docPermissions?.update?.permission\n\n if (statusToRender) {\n return (\n <div\n className={baseClass}\n title={`${t('version:status')}: ${t(`version:${statusToRender}`)}`}\n >\n <div className={`${baseClass}__value-wrap`}>\n <span className={`${baseClass}__label`}>{t('version:status')}: </span>\n <span className={`${baseClass}__value`}>{t(`version:${statusToRender}`)}</span>\n {canUpdate && statusToRender === 'published' && (\n <React.Fragment>\n — \n <Button\n buttonStyle=\"none\"\n className={`${baseClass}__action`}\n onClick={() => toggleModal(unPublishModalSlug)}\n >\n {t('version:unpublish')}\n </Button>\n <Modal className={`${baseClass}__modal`} slug={unPublishModalSlug}>\n <MinimalTemplate className={`${baseClass}__modal-template`}>\n <h1>{t('version:confirmUnpublish')}</h1>\n <p>{t('version:aboutToUnpublish')}</p>\n <Button\n buttonStyle=\"secondary\"\n onClick={processing ? undefined : () => toggleModal(unPublishModalSlug)}\n type=\"button\"\n >\n {t('general:cancel')}\n </Button>\n <Button onClick={processing ? undefined : () => performAction('unpublish')}>\n {t(processing ? 'version:unpublishing' : 'general:confirm')}\n </Button>\n </MinimalTemplate>\n </Modal>\n </React.Fragment>\n )}\n {canUpdate && statusToRender === 'changed' && (\n <React.Fragment>\n — \n <Button\n buttonStyle=\"none\"\n className={`${baseClass}__action`}\n id=\"action-revert-to-published\"\n onClick={() => toggleModal(revertModalSlug)}\n >\n {t('version:revertToPublished')}\n </Button>\n <Modal className={`${baseClass}__modal`} slug={revertModalSlug}>\n <MinimalTemplate className={`${baseClass}__modal-template`}>\n <h1>{t('version:confirmRevertToSaved')}</h1>\n <p>{t('version:aboutToRevertToPublished')}</p>\n <Button\n buttonStyle=\"secondary\"\n onClick={processing ? undefined : () => toggleModal(revertModalSlug)}\n type=\"button\"\n >\n {t('general:cancel')}\n </Button>\n <Button\n id=\"action-revert-to-published-confirm\"\n onClick={processing ? undefined : () => performAction('revert')}\n >\n {t(processing ? 'version:reverting' : 'general:confirm')}\n </Button>\n </MinimalTemplate>\n </Modal>\n </React.Fragment>\n )}\n </div>\n </div>\n )\n }\n\n return null\n}\n"],"names":["facelessUIImport","React","useCallback","useState","toast","useForm","useConfig","useDocumentInfo","useLocale","useTranslation","MinimalTemplate","requests","Button","baseClass","Status","Modal","useModal","id","collectionSlug","docPermissions","getVersions","globalSlug","publishedDoc","unpublishedVersions","toggleModal","routes","api","serverURL","processing","setProcessing","reset","resetForm","code","locale","i18n","t","unPublishModalSlug","revertModalSlug","statusToRender","docs","length","performAction","action","url","method","body","_status","res","JSON","stringify","headers","language","status","data","json","result","doc","success","message","error","canUpdate","update","permission","div","className","title","span","Fragment","buttonStyle","onClick","slug","h1","p","undefined","type"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AACA,YAAYA,sBAAsB,qBAAoB;AACtD,OAAOC,SAASC,WAAW,EAAEC,QAAQ,QAAQ,QAAO;AACpD,SAASC,KAAK,QAAQ,iBAAgB;AAEtC,SAASC,OAAO,QAAQ,8BAA6B;AACrD,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,mCAAkC;AAClE,SAASC,QAAQ,QAAQ,yBAAwB;AACjD,SAASC,MAAM,QAAQ,qBAAoB;AAG3C,MAAMC,YAAY;AAElB,OAAO,MAAMC,SAAmB;IAC9B,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGhB;IAE5B,MAAM,EACJiB,EAAE,EACFC,cAAc,EACdC,cAAc,EACdC,WAAW,EACXC,UAAU,EACVC,YAAY,EACZC,mBAAmB,EACpB,GAAGhB;IACJ,MAAM,EAAEiB,WAAW,EAAE,GAAGR;IACxB,MAAM,EACJS,QAAQ,EAAEC,GAAG,EAAE,EACfC,SAAS,EACV,GAAGrB;IACJ,MAAM,CAACsB,YAAYC,cAAc,GAAG1B,SAAS;IAC7C,MAAM,EAAE2B,OAAOC,SAAS,EAAE,GAAG1B;IAC7B,MAAM,EAAE2B,MAAMC,MAAM,EAAE,GAAGzB;IACz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IpC,EAAE;;sDACP,KAACqC;sDAAGrC,EAAE;;sDACN,KAACvB;4CACCwD,aAAY;4CACZC,SAASzC,aAAa6C,YAAY,IAAMjD,YAAYY;4CACpDsC,MAAK;sDAEJvC,EAAE;;sDAEL,KAACvB;4CAAOyD,SAASzC,aAAa6C,YAAY,IAAMhC,cAAc;sDAC3DN,EAAEP,aAAa,yBAAyB;;;;;;;oBAMlDgC,aAAatB,mBAAmB,2BAC/B,MAACrC,MAAMkE,QAAQ;;4BAAC;0CAEd,KAACvD;gCACCwD,aAAY;gCACZJ,WAAW,CAAC,EAAEnD,UAAU,QAAQ,CAAC;gCACjCI,IAAG;gCACHoD,SAAS,IAAM7C,YAAYa;0CAE1BF,EAAE;;0CAEL,KAACpB;gCAAMiD,WAAW,CAAC,EAAEnD,UAAU,OAAO,CAAC;gCAAEyD,MAAMjC;0CAC7C,cAAA,MAAC3B;oCAAgBsD,WAAW,CAAC,EAAEnD,UAAU,gBAAgB,CAAC;;sDACxD,KAAC0D;sDAAIpC,EAAE;;sDACP,KAACqC;sDAAGrC,EAAE;;sDACN,KAACvB;4CACCwD,aAAY;4CACZC,SAASzC,aAAa6C,YAAY,IAAMjD,YAAYa;4CACpDqC,MAAK;sDAEJvC,EAAE;;sDAEL,KAACvB;4CACCK,IAAG;4CACHoD,SAASzC,aAAa6C,YAAY,IAAMhC,cAAc;sDAErDN,EAAEP,aAAa,sBAAsB;;;;;;;;;;IASxD;IAEA,OAAO;AACT,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/elements/Status/index.tsx"],"sourcesContent":["'use client'\nimport { Modal, useModal } from '@faceless-ui/modal'\nimport React, { useCallback, useState } from 'react'\nimport { toast } from 'react-toastify'\n\nimport { useForm } from '../../forms/Form/context.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { MinimalTemplate } from '../../templates/Minimal/index.js'\nimport { requests } from '../../utilities/api.js'\nimport { Button } from '../Button/index.js'\nimport './index.scss'\n\nconst baseClass = 'status'\n\nexport const Status: React.FC = () => {\n const {\n id,\n collectionSlug,\n docPermissions,\n getVersions,\n globalSlug,\n publishedDoc,\n unpublishedVersions,\n } = useDocumentInfo()\n const { toggleModal } = useModal()\n const {\n routes: { api },\n serverURL,\n } = useConfig()\n const [processing, setProcessing] = useState(false)\n const { reset: resetForm } = useForm()\n const { code: locale } = useLocale()\n const { i18n, t } = useTranslation()\n\n const unPublishModalSlug = `confirm-un-publish-${id}`\n const revertModalSlug = `confirm-revert-${id}`\n\n let statusToRender: 'changed' | 'draft' | 'published'\n\n if (unpublishedVersions?.docs?.length > 0 && publishedDoc) {\n statusToRender = 'changed'\n } else if (!publishedDoc) {\n statusToRender = 'draft'\n } else if (publishedDoc && unpublishedVersions?.docs?.length <= 1) {\n statusToRender = 'published'\n }\n\n const performAction = useCallback(\n async (action: 'revert' | 'unpublish') => {\n let url\n let method\n let body\n\n setProcessing(true)\n\n if (action === 'unpublish') {\n body = {\n _status: 'draft',\n }\n }\n\n if (action === 'revert') {\n body = publishedDoc\n }\n\n if (collectionSlug) {\n url = `${serverURL}${api}/${collectionSlug}/${id}?locale=${locale}&fallback-locale=null`\n method = 'patch'\n }\n if (globalSlug) {\n url = `${serverURL}${api}/globals/${globalSlug}?locale=${locale}&fallback-locale=null`\n method = 'post'\n }\n\n const res = await requests[method](url, {\n body: JSON.stringify(body),\n headers: {\n 'Accept-Language': i18n.language,\n 'Content-Type': 'application/json',\n },\n })\n\n if (res.status === 200) {\n let data\n const json = await res.json()\n\n if (globalSlug) {\n data = json.result\n } else if (collectionSlug) {\n data = json.doc\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n resetForm(data)\n toast.success(json.message)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n getVersions()\n } else {\n toast.error(t('error:unPublishingDocument'))\n }\n\n setProcessing(false)\n if (action === 'revert') {\n toggleModal(revertModalSlug)\n }\n\n if (action === 'unpublish') {\n toggleModal(unPublishModalSlug)\n }\n },\n [\n api,\n collectionSlug,\n getVersions,\n globalSlug,\n i18n.language,\n id,\n locale,\n publishedDoc,\n resetForm,\n revertModalSlug,\n serverURL,\n t,\n toggleModal,\n unPublishModalSlug,\n ],\n )\n\n const canUpdate = docPermissions?.update?.permission\n\n if (statusToRender) {\n return (\n <div\n className={baseClass}\n title={`${t('version:status')}: ${t(`version:${statusToRender}`)}`}\n >\n <div className={`${baseClass}__value-wrap`}>\n <span className={`${baseClass}__label`}>{t('version:status')}: </span>\n <span className={`${baseClass}__value`}>{t(`version:${statusToRender}`)}</span>\n {canUpdate && statusToRender === 'published' && (\n <React.Fragment>\n — \n <Button\n buttonStyle=\"none\"\n className={`${baseClass}__action`}\n onClick={() => toggleModal(unPublishModalSlug)}\n >\n {t('version:unpublish')}\n </Button>\n <Modal className={`${baseClass}__modal`} slug={unPublishModalSlug}>\n <MinimalTemplate className={`${baseClass}__modal-template`}>\n <h1>{t('version:confirmUnpublish')}</h1>\n <p>{t('version:aboutToUnpublish')}</p>\n <Button\n buttonStyle=\"secondary\"\n onClick={processing ? undefined : () => toggleModal(unPublishModalSlug)}\n type=\"button\"\n >\n {t('general:cancel')}\n </Button>\n <Button onClick={processing ? undefined : () => performAction('unpublish')}>\n {t(processing ? 'version:unpublishing' : 'general:confirm')}\n </Button>\n </MinimalTemplate>\n </Modal>\n </React.Fragment>\n )}\n {canUpdate && statusToRender === 'changed' && (\n <React.Fragment>\n — \n <Button\n buttonStyle=\"none\"\n className={`${baseClass}__action`}\n id=\"action-revert-to-published\"\n onClick={() => toggleModal(revertModalSlug)}\n >\n {t('version:revertToPublished')}\n </Button>\n <Modal className={`${baseClass}__modal`} slug={revertModalSlug}>\n <MinimalTemplate className={`${baseClass}__modal-template`}>\n <h1>{t('version:confirmRevertToSaved')}</h1>\n <p>{t('version:aboutToRevertToPublished')}</p>\n <Button\n buttonStyle=\"secondary\"\n onClick={processing ? undefined : () => toggleModal(revertModalSlug)}\n type=\"button\"\n >\n {t('general:cancel')}\n </Button>\n <Button\n id=\"action-revert-to-published-confirm\"\n onClick={processing ? undefined : () => performAction('revert')}\n >\n {t(processing ? 'version:reverting' : 'general:confirm')}\n </Button>\n </MinimalTemplate>\n </Modal>\n </React.Fragment>\n )}\n </div>\n </div>\n )\n }\n\n return null\n}\n"],"names":["Modal","useModal","React","useCallback","useState","toast","useForm","useConfig","useDocumentInfo","useLocale","useTranslation","MinimalTemplate","requests","Button","baseClass","Status","id","collectionSlug","docPermissions","getVersions","globalSlug","publishedDoc","unpublishedVersions","toggleModal","routes","api","serverURL","processing","setProcessing","reset","resetForm","code","locale","i18n","t","unPublishModalSlug","revertModalSlug","statusToRender","docs","length","performAction","action","url","method","body","_status","res","JSON","stringify","headers","language","status","data","json","result","doc","success","message","error","canUpdate","update","permission","div","className","title","span","Fragment","buttonStyle","onClick","slug","h1","p","undefined","type"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AACA,SAASA,KAAK,EAAEC,QAAQ,QAAQ,qBAAoB;AACpD,OAAOC,SAASC,WAAW,EAAEC,QAAQ,QAAQ,QAAO;AACpD,SAASC,KAAK,QAAQ,iBAAgB;AAEtC,SAASC,OAAO,QAAQ,8BAA6B;AACrD,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,mCAAkC;AAClE,SAASC,QAAQ,QAAQ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sDAEL,KAACrB;4CACCG,IAAG;4CACHoD,SAASzC,aAAa6C,YAAY,IAAMhC,cAAc;sDAErDN,EAAEP,aAAa,sBAAsB;;;;;;;;;;IASxD;IAEA,OAAO;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/StayLoggedIn/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,cAAc,CAAA;AAIrB,eAAO,MAAM,qBAAqB,mBAAmB,CAAA;AAErD,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/StayLoggedIn/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,cAAc,CAAA;AAIrB,eAAO,MAAM,qBAAqB,mBAAmB,CAAA;AAErD,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EA4CrC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import { Modal, useModal } from '@faceless-ui/modal';
|
|
4
4
|
// TODO: abstract the `next/navigation` dependency out from this component
|
|
5
5
|
import { useRouter } from 'next/navigation.js';
|
|
6
6
|
import React from 'react';
|
|
@@ -11,7 +11,6 @@ import { useTranslation } from '../../providers/Translation/index.js';
|
|
|
11
11
|
const baseClass = 'stay-logged-in';
|
|
12
12
|
export const stayLoggedInModalSlug = 'stay-logged-in';
|
|
13
13
|
export const StayLoggedInModal = ()=>{
|
|
14
|
-
const { Modal, useModal } = facelessUIImport;
|
|
15
14
|
const { refreshCookie } = useAuth();
|
|
16
15
|
const router = useRouter();
|
|
17
16
|
const config = useConfig();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/elements/StayLoggedIn/index.tsx"],"sourcesContent":["'use client'\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/elements/StayLoggedIn/index.tsx"],"sourcesContent":["'use client'\nimport { Modal, useModal } from '@faceless-ui/modal'\n// TODO: abstract the `next/navigation` dependency out from this component\nimport { useRouter } from 'next/navigation.js'\nimport React from 'react'\n\nimport { Button } from '../../elements/Button/index.js'\nimport { useAuth } from '../../providers/Auth/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport './index.scss'\n\nconst baseClass = 'stay-logged-in'\n\nexport const stayLoggedInModalSlug = 'stay-logged-in'\n\nexport const StayLoggedInModal: React.FC = () => {\n const { refreshCookie } = useAuth()\n\n const router = useRouter()\n const config = useConfig()\n\n const {\n admin: {\n routes: { logout: logoutRoute },\n },\n routes: { admin },\n } = config\n const { toggleModal } = useModal()\n const { t } = useTranslation()\n\n return (\n <Modal className={baseClass} slug={stayLoggedInModalSlug}>\n <div className={`${baseClass}__wrapper`}>\n <div className={`${baseClass}__content`}>\n <h1>{t('authentication:stayLoggedIn')}</h1>\n <p>{t('authentication:youAreInactive')}</p>\n </div>\n <div className={`${baseClass}__controls`}>\n <Button\n buttonStyle=\"secondary\"\n onClick={() => {\n toggleModal(stayLoggedInModalSlug)\n router.push(`${admin}${logoutRoute}`)\n }}\n >\n {t('authentication:logOut')}\n </Button>\n <Button\n onClick={() => {\n refreshCookie()\n toggleModal(stayLoggedInModalSlug)\n }}\n >\n {t('authentication:stayLoggedIn')}\n </Button>\n </div>\n </div>\n </Modal>\n )\n}\n"],"names":["Modal","useModal","useRouter","React","Button","useAuth","useConfig","useTranslation","baseClass","stayLoggedInModalSlug","StayLoggedInModal","refreshCookie","router","config","admin","routes","logout","logoutRoute","toggleModal","t","className","slug","div","h1","p","buttonStyle","onClick","push"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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Root":"","sources":["../../../src/elements/TableColumns/buildColumnState.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,eAAe,CAAA;AAGvF,OAAO,KAAK,EAAE,QAAQ,EAAe,MAAM,yDAAyD,CAAA;AACpG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAW/C,KAAK,IAAI,GAAG;IACV,SAAS,EAAE,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAA;IACxC,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,OAAO,CAAC,EAAE,iBAAiB,CAAA;IAC3B,mBAAmB,EAAE,OAAO,CAAA;IAC5B,QAAQ,EAAE,QAAQ,CAAA;IAClB,UAAU,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAA;CAC7D,CAAA;AACD,eAAO,MAAM,gBAAgB,SAAU,IAAI,KAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"buildColumnState.d.ts","sourceRoot":"","sources":["../../../src/elements/TableColumns/buildColumnState.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,eAAe,CAAA;AAGvF,OAAO,KAAK,EAAE,QAAQ,EAAe,MAAM,yDAAyD,CAAA;AACpG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAW/C,KAAK,IAAI,GAAG;IACV,SAAS,EAAE,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAA;IACxC,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,OAAO,CAAC,EAAE,iBAAiB,CAAA;IAC3B,mBAAmB,EAAE,OAAO,CAAA;IAC5B,QAAQ,EAAE,QAAQ,CAAA;IAClB,UAAU,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAA;CAC7D,CAAA;AACD,eAAO,MAAM,gBAAgB,SAAU,IAAI,KAAG,MAAM,EAwJnD,CAAA"}
|
|
@@ -62,9 +62,10 @@ export const buildColumnState = (args)=>{
|
|
|
62
62
|
...field.fieldComponentProps?.labelProps || {},
|
|
63
63
|
unstyled: true
|
|
64
64
|
});
|
|
65
|
+
const fieldAffectsDataSubFields = field && field.type && (field.type === 'array' || field.type === 'group' || field.type === 'blocks');
|
|
65
66
|
const Heading = /*#__PURE__*/ _jsx(SortColumn, {
|
|
66
67
|
Label: Label,
|
|
67
|
-
disable:
|
|
68
|
+
disable: fieldAffectsDataSubFields || fieldIsPresentationalOnly(field) || undefined,
|
|
68
69
|
// eslint-disable-next-line react/jsx-no-duplicate-props
|
|
69
70
|
label: 'fieldComponentProps' in field && 'label' in field.fieldComponentProps ? field.fieldComponentProps.label : undefined,
|
|
70
71
|
name: 'name' in field ? field.name : undefined
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/elements/TableColumns/buildColumnState.tsx"],"sourcesContent":["'use client'\nimport { type CellComponentProps, type SanitizedCollectionConfig } from 'payload/types'\nimport React from 'react'\n\nimport type { FieldMap, MappedField } from '../../providers/ComponentMap/buildComponentMap/types.js'\nimport type { ColumnPreferences } from '../../providers/ListInfo/index.js'\nimport type { Column } from '../Table/index.js'\n\nimport { FieldLabel } from '../../forms/FieldLabel/index.js'\nimport { flattenFieldMap } from '../../utilities/flattenFieldMap.js'\nimport { SelectAll } from '../SelectAll/index.js'\nimport { SelectRow } from '../SelectRow/index.js'\nimport { SortColumn } from '../SortColumn/index.js'\nimport { DefaultCell } from '../Table/DefaultCell/index.js'\n\nconst fieldIsPresentationalOnly = (field: MappedField): boolean => field.type === 'ui'\n\ntype Args = {\n cellProps: Partial<CellComponentProps>[]\n columnPreferences: ColumnPreferences\n columns?: ColumnPreferences\n enableRowSelections: boolean\n fieldMap: FieldMap\n useAsTitle: SanitizedCollectionConfig['admin']['useAsTitle']\n}\nexport const buildColumnState = (args: Args): Column[] => {\n const { cellProps, columnPreferences, columns, enableRowSelections, fieldMap, useAsTitle } = args\n\n let sortedFieldMap = flattenFieldMap(fieldMap)\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) => 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) => 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 if (sortTo) {\n // sort the fields to the order of `defaultColumns` or `columnPreferences`\n sortedFieldMap = sortedFieldMap.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 if (aIndex === -1 && bIndex === -1) return 0\n if (aIndex === -1) return 1\n if (bIndex === -1) return -1\n return aIndex - bIndex\n })\n }\n\n const activeColumnsIndices = []\n\n const sorted = sortedFieldMap.reduce((acc, field, index) => {\n const columnPreference = columnPreferences?.find(\n (preference) => '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((column) => column.accessor === field.name)?.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 isFirstActiveColumn = activeColumnsIndices[0] === index\n\n const name = 'name' in field ? field.name : undefined\n\n const Cell =\n field.CustomCell !== undefined ? (\n field.CustomCell\n ) : (\n <DefaultCell {...field.cellComponentProps} />\n )\n\n const CustomLabelToRender =\n field &&\n 'fieldComponentProps' in field &&\n 'CustomLabel' in field.fieldComponentProps &&\n field.fieldComponentProps.CustomLabel !== undefined\n ? field.fieldComponentProps.CustomLabel\n : undefined\n\n const Label = (\n <FieldLabel\n CustomLabel={CustomLabelToRender}\n label={field.fieldComponentProps?.label}\n {...(field.fieldComponentProps?.labelProps || {})}\n unstyled\n />\n )\n\n const Heading = (\n <SortColumn\n Label={Label}\n disable={\n ('disableSort' in field && Boolean(field.disableSort)) ||\n fieldIsPresentationalOnly(field) ||\n undefined\n }\n // eslint-disable-next-line react/jsx-no-duplicate-props\n label={\n 'fieldComponentProps' in field && 'label' in field.fieldComponentProps\n ? field.fieldComponentProps.label\n : undefined\n }\n name={'name' in field ? field.name : undefined}\n />\n )\n\n if (field) {\n const column: Column = {\n name,\n type: field.type,\n Label,\n accessor: name,\n active,\n admin: {\n disableListColumn: field.disableListColumn,\n disableListFilter: field.disableListFilter,\n },\n cellProps: {\n ...field.cellComponentProps,\n ...cellProps?.[index],\n link: isFirstActiveColumn,\n relationTo:\n field.type === 'relationship' && 'relationTo' in field.fieldComponentProps\n ? field.fieldComponentProps.relationTo\n : undefined,\n },\n components: {\n Cell,\n Heading,\n },\n }\n\n acc.push(column)\n }\n\n return acc\n }, [])\n\n if (enableRowSelections) {\n sorted.unshift({\n name: '',\n accessor: '_select',\n active: true,\n components: {\n Cell: <SelectRow />,\n Heading: <SelectAll />,\n },\n label: null,\n })\n }\n\n return sorted\n}\n"],"names":["React","FieldLabel","flattenFieldMap","SelectAll","SelectRow","SortColumn","DefaultCell","fieldIsPresentationalOnly","field","type","buildColumnState","args","cellProps","columnPreferences","columns","enableRowSelections","fieldMap","useAsTitle","sortedFieldMap","idFieldIndex","findIndex","name","idField","splice","unshift","useAsTitleFieldIndex","useAsTitleField","sortTo","sort","a","b","aIndex","column","accessor","bIndex","activeColumnsIndices","sorted","reduce","acc","index","columnPreference","find","preference","active","Array","isArray","length","includes","push","isFirstActiveColumn","undefined","Cell","CustomCell","cellComponentProps","CustomLabelToRender","fieldComponentProps","CustomLabel","Label","label","labelProps","unstyled","Heading","disable","Boolean","disableSort","admin","disableListColumn","disableListFilter","link","relationTo","components"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAEA,OAAOA,WAAW,QAAO;AAMzB,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,WAAW,QAAQ,gCAA+B;AAE3D,MAAMC,4BAA4B,CAACC,QAAgCA,MAAMC,IAAI,KAAK;AAUlF,OAAO,MAAMC,mBAAmB,CAACC;IAC/B,MAAM,EAAEC,SAAS,EAAEC,iBAAiB,EAAEC,OAAO,EAAEC,mBAAmB,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGN;IAE7F,IAAIO,iBAAiBhB,gBAAgBc;IAErC,2CAA2C;IAC3C,6EAA6E;IAC7E,wFAAwF;IACxF,MAAMG,eAAeD,eAAeE,SAAS,CAAC,CAACZ,QAAUA,MAAMa,IAAI,KAAK;IAExE,IAAIF,eAAe,CAAC,GAAG;QACrB,MAAMG,UAAUJ,eAAeK,MAAM,CAACJ,cAAc,EAAE,CAAC,EAAE;QACzDD,eAAeM,OAAO,CAACF;IACzB;IAEA,MAAMG,uBAAuBR,aACzBC,eAAeE,SAAS,CAAC,CAACZ,QAAUA,MAAMa,IAAI,KAAKJ,cACnD,CAAC;IAEL,IAAIQ,uBAAuB,CAAC,GAAG;QAC7B,M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oBACVnB;oBACAU;gBACF;YACF;YAEAvB,IAAIU,IAAI,CAAChB;QACX;QAEA,OAAOM;IACT,GAAG,EAAE;IAEL,IAAIvB,qBAAqB;QACvBqB,OAAOZ,OAAO,CAAC;YACbH,MAAM;YACNY,UAAU;YACVU,QAAQ;YACR2B,YAAY;gBACVnB,oBAAM,KAAC/C;gBACPyD,uBAAS,KAAC1D;YACZ;YACAuD,OAAO;QACT;IACF;IAEA,OAAOtB;AACT,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/elements/TableColumns/buildColumnState.tsx"],"sourcesContent":["'use client'\nimport { type CellComponentProps, type SanitizedCollectionConfig } from 'payload/types'\nimport React from 'react'\n\nimport type { FieldMap, MappedField } from '../../providers/ComponentMap/buildComponentMap/types.js'\nimport type { ColumnPreferences } from '../../providers/ListInfo/index.js'\nimport type { Column } from '../Table/index.js'\n\nimport { FieldLabel } from '../../forms/FieldLabel/index.js'\nimport { flattenFieldMap } from '../../utilities/flattenFieldMap.js'\nimport { SelectAll } from '../SelectAll/index.js'\nimport { SelectRow } from '../SelectRow/index.js'\nimport { SortColumn } from '../SortColumn/index.js'\nimport { DefaultCell } from '../Table/DefaultCell/index.js'\n\nconst fieldIsPresentationalOnly = (field: MappedField): boolean => field.type === 'ui'\n\ntype Args = {\n cellProps: Partial<CellComponentProps>[]\n columnPreferences: ColumnPreferences\n columns?: ColumnPreferences\n enableRowSelections: boolean\n fieldMap: FieldMap\n useAsTitle: SanitizedCollectionConfig['admin']['useAsTitle']\n}\nexport const buildColumnState = (args: Args): Column[] => {\n const { cellProps, columnPreferences, columns, enableRowSelections, fieldMap, useAsTitle } = args\n\n let sortedFieldMap = flattenFieldMap(fieldMap)\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) => 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) => 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 if (sortTo) {\n // sort the fields to the order of `defaultColumns` or `columnPreferences`\n sortedFieldMap = sortedFieldMap.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 if (aIndex === -1 && bIndex === -1) return 0\n if (aIndex === -1) return 1\n if (bIndex === -1) return -1\n return aIndex - bIndex\n })\n }\n\n const activeColumnsIndices = []\n\n const sorted = sortedFieldMap.reduce((acc, field, index) => {\n const columnPreference = columnPreferences?.find(\n (preference) => '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((column) => column.accessor === field.name)?.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 isFirstActiveColumn = activeColumnsIndices[0] === index\n\n const name = 'name' in field ? field.name : undefined\n\n const Cell =\n field.CustomCell !== undefined ? (\n field.CustomCell\n ) : (\n <DefaultCell {...field.cellComponentProps} />\n )\n\n const CustomLabelToRender =\n field &&\n 'fieldComponentProps' in field &&\n 'CustomLabel' in field.fieldComponentProps &&\n field.fieldComponentProps.CustomLabel !== undefined\n ? field.fieldComponentProps.CustomLabel\n : undefined\n\n const Label = (\n <FieldLabel\n CustomLabel={CustomLabelToRender}\n label={field.fieldComponentProps?.label}\n {...(field.fieldComponentProps?.labelProps || {})}\n unstyled\n />\n )\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 Label={Label}\n disable={fieldAffectsDataSubFields || fieldIsPresentationalOnly(field) || undefined}\n // eslint-disable-next-line react/jsx-no-duplicate-props\n label={\n 'fieldComponentProps' in field && 'label' in field.fieldComponentProps\n ? field.fieldComponentProps.label\n : undefined\n }\n name={'name' in field ? field.name : undefined}\n />\n )\n\n if (field) {\n const column: Column = {\n name,\n type: field.type,\n Label,\n accessor: name,\n active,\n admin: {\n disableListColumn: field.disableListColumn,\n disableListFilter: field.disableListFilter,\n },\n cellProps: {\n ...field.cellComponentProps,\n ...cellProps?.[index],\n link: isFirstActiveColumn,\n relationTo:\n field.type === 'relationship' && 'relationTo' in field.fieldComponentProps\n ? field.fieldComponentProps.relationTo\n : undefined,\n },\n components: {\n Cell,\n Heading,\n },\n }\n\n acc.push(column)\n }\n\n return acc\n }, [])\n\n if (enableRowSelections) {\n sorted.unshift({\n name: '',\n accessor: '_select',\n active: true,\n components: {\n Cell: <SelectRow />,\n Heading: <SelectAll />,\n },\n label: null,\n })\n }\n\n return sorted\n}\n"],"names":["React","FieldLabel","flattenFieldMap","SelectAll","SelectRow","SortColumn","DefaultCell","fieldIsPresentationalOnly","field","type","buildColumnState","args","cellProps","columnPreferences","columns","enableRowSelections","fieldMap","useAsTitle","sortedFieldMap","idFieldIndex","findIndex","name","idField","splice","unshift","useAsTitleFieldIndex","useAsTitleField","sortTo","sort","a","b","aIndex","column","accessor","bIndex","activeColumnsIndices","sorted","reduce","acc","index","columnPreference","find","preference","active","Array","isArray","length","includes","push","isFirstActiveColumn","undefined","Cell","CustomCell","cellComponentProps","CustomLabelToRender","fieldComponentProps","CustomLabel","Label","label","labelProps","unstyled","fieldAffectsDataSubFields","Heading","disable","admin","disableListColumn","disableListFilter","link","relationTo","components"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C/C;gBACP0D,uBAAS,KAAC3D;YACZ;YACAuD,OAAO;QACT;IACF;IAEA,OAAOtB;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/UnpublishMany/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAgC,MAAM,OAAO,CAAA;AAapD,OAAO,cAAc,CAAA;AAIrB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAE3D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,sBAAsB,CAAA;CACnC,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/UnpublishMany/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAgC,MAAM,OAAO,CAAA;AAapD,OAAO,cAAc,CAAA;AAIrB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAE3D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,sBAAsB,CAAA;CACnC,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAkHtD,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import { Modal, useModal } from '@faceless-ui/modal';
|
|
4
4
|
import { getTranslation } from '@payloadcms/translations';
|
|
5
5
|
import { useRouter } from 'next/navigation.js';
|
|
6
6
|
import React, { useCallback, useState } from 'react';
|
|
@@ -18,7 +18,6 @@ import { Pill } from '../Pill/index.js';
|
|
|
18
18
|
const baseClass = 'unpublish-many';
|
|
19
19
|
export const UnpublishMany = (props)=>{
|
|
20
20
|
const { collection: { slug, labels: { plural }, versions } = {} } = props;
|
|
21
|
-
const { Modal, useModal } = facelessUIImport;
|
|
22
21
|
const { routes: { api }, serverURL } = useConfig();
|
|
23
22
|
const { permissions } = useAuth();
|
|
24
23
|
const { toggleModal } = useModal();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/elements/UnpublishMany/index.tsx"],"sourcesContent":["'use client'\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/elements/UnpublishMany/index.tsx"],"sourcesContent":["'use client'\nimport { Modal, useModal } from '@faceless-ui/modal'\nimport { getTranslation } from '@payloadcms/translations'\nimport { useRouter } from 'next/navigation.js'\nimport React, { useCallback, useState } from 'react'\nimport { toast } from 'react-toastify'\n\nimport { useAuth } from '../../providers/Auth/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useRouteCache } from '../../providers/RouteCache/index.js'\nimport { useSearchParams } from '../../providers/SearchParams/index.js'\nimport { SelectAllStatus, useSelection } from '../../providers/Selection/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { MinimalTemplate } from '../../templates/Minimal/index.js'\nimport { requests } from '../../utilities/api.js'\nimport { Button } from '../Button/index.js'\nimport { Pill } from '../Pill/index.js'\nimport './index.scss'\n\nconst baseClass = 'unpublish-many'\n\nimport type { ClientCollectionConfig } from 'payload/types'\n\nexport type UnpublishManyProps = {\n collection: ClientCollectionConfig\n}\n\nexport const UnpublishMany: React.FC<UnpublishManyProps> = (props) => {\n const { collection: { slug, labels: { plural }, versions } = {} } = props\n\n const {\n routes: { api },\n serverURL,\n } = useConfig()\n const { permissions } = useAuth()\n const { toggleModal } = useModal()\n const { i18n, t } = useTranslation()\n const { getQueryParams, selectAll } = useSelection()\n const [submitted, setSubmitted] = useState(false)\n const { stringifyParams } = useSearchParams()\n const router = useRouter()\n const { clearRouteCache } = useRouteCache()\n\n const collectionPermissions = permissions?.collections?.[slug]\n const hasPermission = collectionPermissions?.update?.permission\n\n const modalSlug = `unpublish-${slug}`\n\n const addDefaultError = useCallback(() => {\n toast.error(t('error:unknown'))\n }, [t])\n\n const handleUnpublish = useCallback(async () => {\n setSubmitted(true)\n await requests\n .patch(`${serverURL}${api}/${slug}${getQueryParams({ _status: { not_equals: 'draft' } })}`, {\n body: JSON.stringify({\n _status: 'draft',\n }),\n headers: {\n 'Accept-Language': i18n.language,\n 'Content-Type': 'application/json',\n },\n })\n .then(async (res) => {\n try {\n const json = await res.json()\n toggleModal(modalSlug)\n if (res.status < 400) {\n toast.success(t('general:updatedSuccessfully'))\n router.replace(\n stringifyParams({\n params: {\n page: selectAll ? '1' : undefined,\n },\n }),\n )\n clearRouteCache()\n return null\n }\n\n if (json.errors) {\n json.errors.forEach((error) => toast.error(error.message))\n } else {\n addDefaultError()\n }\n return false\n } catch (e) {\n return addDefaultError()\n }\n })\n }, [\n addDefaultError,\n api,\n getQueryParams,\n i18n.language,\n modalSlug,\n selectAll,\n serverURL,\n slug,\n t,\n toggleModal,\n router,\n clearRouteCache,\n stringifyParams,\n ])\n\n if (!versions?.drafts || selectAll === SelectAllStatus.None || !hasPermission) {\n return null\n }\n\n return (\n <React.Fragment>\n <Pill\n className={`${baseClass}__toggle`}\n onClick={() => {\n setSubmitted(false)\n toggleModal(modalSlug)\n }}\n >\n {t('version:unpublish')}\n </Pill>\n <Modal className={baseClass} slug={modalSlug}>\n <MinimalTemplate className={`${baseClass}__template`}>\n <h1>{t('version:confirmUnpublish')}</h1>\n <p>{t('version:aboutToUnpublishSelection', { label: getTranslation(plural, i18n) })}</p>\n <Button\n buttonStyle=\"secondary\"\n id=\"confirm-cancel\"\n onClick={submitted ? undefined : () => toggleModal(modalSlug)}\n type=\"button\"\n >\n {t('general:cancel')}\n </Button>\n <Button id=\"confirm-unpublish\" onClick={submitted ? undefined : handleUnpublish}>\n {submitted ? t('version:unpublishing') : t('general:confirm')}\n </Button>\n </MinimalTemplate>\n </Modal>\n </React.Fragment>\n )\n}\n"],"names":["Modal","useModal","getTranslation","useRouter","React","useCallback","useState","toast","useAuth","useConfig","useRouteCache","useSearchParams","SelectAllStatus","useSelection","useTranslation","MinimalTemplate","requests","Button","Pill","baseClass","UnpublishMany","props","collection","slug","labels","plural","versions","routes","api","serverURL","permissions","toggleModal","i18n","t","getQueryParams","selectAll","submitted","setSubmitted","stringifyParams","router","clearRouteCache","collectionPermissions","collections","hasPermission","update","permission","modalSlug","addDefaultError","error","handleUnpublish","patch","_status","not_equals","body","JSON","stringify","headers","language","then","res","json","status","success","replace","params","page","undefined","errors","forEach","message","e","drafts","None","Fragment","className","onClick","h1","p","label","buttonStyle","id","type"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AACA,SAASA,KAAK,EAAEC,QAAQ,QAAQ,qBAAoB;AACpD,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SAASC,SAAS,QAAQ,qBAAoB;AAC9C,OAAOC,SAASC,WAAW,EAAEC,QAAQ,QAAQ,QAAO;AACpD,SAASC,KAAK,QAAQ,iBAAgB;AAEtC,SAASC,OAAO,QAAQ,gCAA+B;AACvD,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,aAAa,QAAQ,sCAAqC;AACnE,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,eAAe,EAAEC,YAAY,QAAQ,qCAAoC;AAClF,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,mCAAkC;AAClE,SAASC,QAAQ,QAAQ,yBAAwB;AACjD,SAASC,MAAM,QAAQ,qBAAoB;AAC3C,SAASC,IAAI,QAAQ,mBAAkB;AAGvC,MAAMC,YAAY;AAQlB,OAAO,MAAMC,gBAA8C,CAACC;IAC1D,MAAM,EAAEC,YAAY,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,MAAM,EAAE,EAAEC,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less-ui/window-info/dist/WindowInfoProvider/index.js").WindowInfoProviderProps>;
|
|
3
|
-
declare const useWindowInfo: () => import("@faceless-ui/window-info/dist/WindowInfoProvider/context.js").IWindowInfoContext;
|
|
1
|
+
import { WindowInfoProvider, useWindowInfo } from '@faceless-ui/window-info';
|
|
4
2
|
export { WindowInfoProvider, useWindowInfo };
|
|
5
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/WindowInfo/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/WindowInfo/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC5E,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
const { WindowInfoProvider } = facelessUIImport && 'WindowInfoProvider' in facelessUIImport ? facelessUIImport : {
|
|
3
|
-
WindowInfoProvider: undefined
|
|
4
|
-
};
|
|
5
|
-
const { useWindowInfo } = facelessUIImport && 'useWindowInfo' in facelessUIImport ? facelessUIImport : {
|
|
6
|
-
useWindowInfo: undefined
|
|
7
|
-
};
|
|
1
|
+
import { WindowInfoProvider, useWindowInfo } from '@faceless-ui/window-info';
|
|
8
2
|
export { WindowInfoProvider, useWindowInfo };
|
|
9
3
|
|
|
10
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/elements/WindowInfo/index.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../src/elements/WindowInfo/index.tsx"],"sourcesContent":["import { WindowInfoProvider, useWindowInfo } from '@faceless-ui/window-info'\nexport { WindowInfoProvider, useWindowInfo }\n"],"names":["WindowInfoProvider","useWindowInfo"],"rangeMappings":";","mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,2BAA0B;AAC5E,SAASD,kBAAkB,EAAEC,aAAa,GAAE"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" resolution-mode="require"/>
|
|
2
1
|
export { Button } from '../elements/Button/index.js';
|
|
3
2
|
export { Card } from '../elements/Card/index.js';
|
|
4
3
|
export { Collapsible } from '../elements/Collapsible/index.js';
|
|
@@ -46,11 +45,7 @@ export { Tooltip } from '../elements/Tooltip/index.js';
|
|
|
46
45
|
export { Translation } from '../elements/Translation/index.js';
|
|
47
46
|
export { UnpublishMany } from '../elements/UnpublishMany/index.js';
|
|
48
47
|
export { Upload } from '../elements/Upload/index.js';
|
|
49
|
-
|
|
50
|
-
modal?: import("@faceless-ui/modal/dist/ModalProvider/context.js").IModalContext;
|
|
51
|
-
} & {
|
|
52
|
-
children?: import("react").ReactNode | import("@faceless-ui/modal/dist/Modal/index.js").ChildFunction;
|
|
53
|
-
}>;
|
|
48
|
+
import { Modal } from '@faceless-ui/modal';
|
|
54
49
|
export { Modal };
|
|
55
50
|
import * as reactToastifyImport from 'react-toastify';
|
|
56
51
|
declare const toast: typeof reactToastifyImport.toast;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../src/exports/elements.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../src/exports/elements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAC5D,OAAO,EAAE,gBAAgB,EAAE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
43
43
|
export { Translation } from '../elements/Translation/index.js';
|
|
44
44
|
export { UnpublishMany } from '../elements/UnpublishMany/index.js';
|
|
45
45
|
export { Upload } from '../elements/Upload/index.js';
|
|
46
|
-
import
|
|
47
|
-
const { Modal } = facelessUIImport && 'Modal' in facelessUIImport ? facelessUIImport : {
|
|
48
|
-
Modal: undefined
|
|
49
|
-
};
|
|
46
|
+
import { Modal } from '@faceless-ui/modal';
|
|
50
47
|
export { Modal };
|
|
51
48
|
import * as reactToastifyImport from 'react-toastify';
|
|
52
49
|
const { toast } = reactToastifyImport && 'toast' in reactToastifyImport ? reactToastifyImport : {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/elements.ts"],"sourcesContent":["export { Button } from '../elements/Button/index.js'\nexport { Card } from '../elements/Card/index.js'\nexport { Collapsible } from '../elements/Collapsible/index.js'\nexport { CopyToClipboard } from '../elements/CopyToClipboard/index.js'\nexport { DeleteMany } from '../elements/DeleteMany/index.js'\nexport { DocumentControls } from '../elements/DocumentControls/index.js'\nexport { useDocumentDrawer } from '../elements/DocumentDrawer/index.js'\nexport { DocumentFields } from '../elements/DocumentFields/index.js'\nexport { DocumentHeader } from '../elements/DocumentHeader/index.js'\nexport { Drawer, DrawerToggler, formatDrawerSlug } from '../elements/Drawer/index.js'\nexport { useDrawerSlug } from '../elements/Drawer/useDrawerSlug.js'\nexport { EditMany } from '../elements/EditMany/index.js'\nexport { ErrorPill } from '../elements/ErrorPill/index.js'\nexport { GenerateConfirmation } from '../elements/GenerateConfirmation/index.js'\nexport { Gutter } from '../elements/Gutter/index.js'\nexport { HydrateClientUser } from '../elements/HydrateClientUser/index.js'\nexport { ListControls } from '../elements/ListControls/index.js'\nexport { useListDrawer } from '../elements/ListDrawer/index.js'\nexport { ListSelection } from '../elements/ListSelection/index.js'\nexport { LoadingOverlayToggle } from '../elements/Loading/index.js'\nexport { FormLoadingOverlayToggle } from '../elements/Loading/index.js'\nexport { LoadingOverlay } from '../elements/Loading/index.js'\nexport { Pagination } from '../elements/Pagination/index.js'\nexport { PerPage } from '../elements/PerPage/index.js'\nexport { Pill } from '../elements/Pill/index.js'\nexport * as PopupList from '../elements/Popup/PopupButtonList/index.js'\nexport { Popup } from '../elements/Popup/index.js'\nexport { PublishMany } from '../elements/PublishMany/index.js'\nexport { ReactSelect } from '../elements/ReactSelect/index.js'\nexport type { Option } from '../elements/ReactSelect/types.js'\nexport { RenderCustomComponent } from '../elements/RenderCustomComponent/index.js'\nexport { ShimmerEffect } from '../elements/ShimmerEffect/index.js'\nexport { StaggeredShimmers } from '../elements/ShimmerEffect/index.js'\nexport { SortColumn } from '../elements/SortColumn/index.js'\nexport { SetStepNav } from '../elements/StepNav/SetStepNav.js'\nexport { useStepNav } from '../elements/StepNav/index.js'\nexport type { StepNavItem } from '../elements/StepNav/index.js'\nexport { RelationshipProvider } from '../elements/Table/RelationshipProvider/index.js'\nexport { TableCellProvider, useTableCell } from '../elements/Table/TableCellProvider/index.js'\nexport { Table } from '../elements/Table/index.js'\nexport type { Column } from '../elements/Table/index.js'\nexport { TableColumnsProvider } from '../elements/TableColumns/index.js'\nexport { Thumbnail } from '../elements/Thumbnail/index.js'\nexport { Tooltip } from '../elements/Tooltip/index.js'\n// export { useThumbnail } from '../elements/Upload/index.js'\nexport { Translation } from '../elements/Translation/index.js'\nexport { UnpublishMany } from '../elements/UnpublishMany/index.js'\nexport { Upload } from '../elements/Upload/index.js'\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/exports/elements.ts"],"sourcesContent":["export { Button } from '../elements/Button/index.js'\nexport { Card } from '../elements/Card/index.js'\nexport { Collapsible } from '../elements/Collapsible/index.js'\nexport { CopyToClipboard } from '../elements/CopyToClipboard/index.js'\nexport { DeleteMany } from '../elements/DeleteMany/index.js'\nexport { DocumentControls } from '../elements/DocumentControls/index.js'\nexport { useDocumentDrawer } from '../elements/DocumentDrawer/index.js'\nexport { DocumentFields } from '../elements/DocumentFields/index.js'\nexport { DocumentHeader } from '../elements/DocumentHeader/index.js'\nexport { Drawer, DrawerToggler, formatDrawerSlug } from '../elements/Drawer/index.js'\nexport { useDrawerSlug } from '../elements/Drawer/useDrawerSlug.js'\nexport { EditMany } from '../elements/EditMany/index.js'\nexport { ErrorPill } from '../elements/ErrorPill/index.js'\nexport { GenerateConfirmation } from '../elements/GenerateConfirmation/index.js'\nexport { Gutter } from '../elements/Gutter/index.js'\nexport { HydrateClientUser } from '../elements/HydrateClientUser/index.js'\nexport { ListControls } from '../elements/ListControls/index.js'\nexport { useListDrawer } from '../elements/ListDrawer/index.js'\nexport { ListSelection } from '../elements/ListSelection/index.js'\nexport { LoadingOverlayToggle } from '../elements/Loading/index.js'\nexport { FormLoadingOverlayToggle } from '../elements/Loading/index.js'\nexport { LoadingOverlay } from '../elements/Loading/index.js'\nexport { Pagination } from '../elements/Pagination/index.js'\nexport { PerPage } from '../elements/PerPage/index.js'\nexport { Pill } from '../elements/Pill/index.js'\nexport * as PopupList from '../elements/Popup/PopupButtonList/index.js'\nexport { Popup } from '../elements/Popup/index.js'\nexport { PublishMany } from '../elements/PublishMany/index.js'\nexport { ReactSelect } from '../elements/ReactSelect/index.js'\nexport type { Option } from '../elements/ReactSelect/types.js'\nexport { RenderCustomComponent } from '../elements/RenderCustomComponent/index.js'\nexport { ShimmerEffect } from '../elements/ShimmerEffect/index.js'\nexport { StaggeredShimmers } from '../elements/ShimmerEffect/index.js'\nexport { SortColumn } from '../elements/SortColumn/index.js'\nexport { SetStepNav } from '../elements/StepNav/SetStepNav.js'\nexport { useStepNav } from '../elements/StepNav/index.js'\nexport type { StepNavItem } from '../elements/StepNav/index.js'\nexport { RelationshipProvider } from '../elements/Table/RelationshipProvider/index.js'\nexport { TableCellProvider, useTableCell } from '../elements/Table/TableCellProvider/index.js'\nexport { Table } from '../elements/Table/index.js'\nexport type { Column } from '../elements/Table/index.js'\nexport { TableColumnsProvider } from '../elements/TableColumns/index.js'\nexport { Thumbnail } from '../elements/Thumbnail/index.js'\nexport { Tooltip } from '../elements/Tooltip/index.js'\n// export { useThumbnail } from '../elements/Upload/index.js'\nexport { Translation } from '../elements/Translation/index.js'\nexport { UnpublishMany } from '../elements/UnpublishMany/index.js'\nexport { Upload } from '../elements/Upload/index.js'\nimport { Modal } from '@faceless-ui/modal'\nexport { Modal }\nimport * as reactToastifyImport from 'react-toastify'\nconst { toast } =\n reactToastifyImport && 'toast' in reactToastifyImport ? reactToastifyImport : { toast: undefined }\nexport { toast }\n"],"names":["Button","Card","Collapsible","CopyToClipboard","DeleteMany","DocumentControls","useDocumentDrawer","DocumentFields","DocumentHeader","Drawer","DrawerToggler","formatDrawerSlug","useDrawerSlug","EditMany","ErrorPill","GenerateConfirmation","Gutter","HydrateClientUser","ListControls","useListDrawer","ListSelection","LoadingOverlayToggle","FormLoadingOverlayToggle","LoadingOverlay","Pagination","PerPage","Pill","PopupList","Popup","PublishMany","ReactSelect","RenderCustomComponent","ShimmerEffect","StaggeredShimmers","SortColumn","SetStepNav","useStepNav","RelationshipProvider","TableCellProvider","useTableCell","Table","TableColumnsProvider","Thumbnail","Tooltip","Translation","UnpublishMany","Upload","Modal","reactToastifyImport","toast","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,MAAM,QAAQ,8BAA6B;AACpD,SAASC,IAAI,QAAQ,4BAA2B;AAChD,SAASC,WAAW,QAAQ,mCAAkC;AAC9D,SAASC,eAAe,QAAQ,uCAAsC;AACtE,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,SAASC,gBAAgB,QAAQ,wCAAuC;AACxE,SAASC,iBAAiB,QAAQ,sCAAqC;AACvE,SAASC,cAAc,QAAQ,sCAAqC;AACpE,SAASC,cAAc,QAAQ,sCAAqC;AACpE,SAASC,MAAM,EAAEC,aAAa,EAAEC,gBAAgB,QAAQ,8BAA6B;AACrF,SAASC,aAAa,QAAQ,sCAAqC;AACnE,SAASC,QAAQ,QAA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C,yBAAyB,iBAAgB;AACrD,MAAM,EAAEC,KAAK,EAAE,GACbD,uBAAuB,WAAWA,sBAAsBA,sBAAsB;IAAEC,OAAOC;AAAU;AACnG,SAASD,KAAK,GAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fields/Blocks/BlocksDrawer/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAI3C,OAAO,KAA8B,MAAM,OAAO,CAAA;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4DAA4D,CAAA;AAO9F,OAAO,cAAc,CAAA;AAErB,MAAM,MAAM,KAAK,GAAG;IAClB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACnD,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,YAAY,EAAE,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAYD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fields/Blocks/BlocksDrawer/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAI3C,OAAO,KAA8B,MAAM,OAAO,CAAA;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4DAA4D,CAAA;AAO9F,OAAO,cAAc,CAAA;AAErB,MAAM,MAAM,KAAK,GAAG;IAClB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACnD,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,YAAY,EAAE,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAYD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA+DxC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import { useModal } from '@faceless-ui/modal';
|
|
4
4
|
import { getTranslation } from '@payloadcms/translations';
|
|
5
5
|
import React, { useEffect, useState } from 'react';
|
|
6
6
|
import { Drawer } from '../../../elements/Drawer/index.js';
|
|
@@ -18,7 +18,6 @@ const getBlockLabel = (block, i18n)=>{
|
|
|
18
18
|
};
|
|
19
19
|
export const BlocksDrawer = (props)=>{
|
|
20
20
|
const { addRow, addRowIndex, blocks, drawerSlug, labels } = props;
|
|
21
|
-
const { useModal } = facelessUIImport;
|
|
22
21
|
const [searchTerm, setSearchTerm] = useState('');
|
|
23
22
|
const [filteredBlocks, setFilteredBlocks] = useState(blocks);
|
|
24
23
|
const { closeModal, isModalOpen } = useModal();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/fields/Blocks/BlocksDrawer/index.tsx"],"sourcesContent":["'use client'\nimport type { I18nClient } from '@payloadcms/translations'\nimport type { Labels } from 'payload/types'\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../../../src/fields/Blocks/BlocksDrawer/index.tsx"],"sourcesContent":["'use client'\nimport type { I18nClient } from '@payloadcms/translations'\nimport type { Labels } from 'payload/types'\n\nimport { useModal } from '@faceless-ui/modal'\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useEffect, useState } from 'react'\n\nimport type { ReducedBlock } from '../../../providers/ComponentMap/buildComponentMap/types.js'\n\nimport { Drawer } from '../../../elements/Drawer/index.js'\nimport { ThumbnailCard } from '../../../elements/ThumbnailCard/index.js'\nimport { DefaultBlockImage } from '../../../graphics/DefaultBlockImage/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\nimport { BlockSearch } from './BlockSearch/index.js'\nimport './index.scss'\n\nexport type Props = {\n addRow: (index: number, blockType?: string) => void\n addRowIndex: number\n blocks: ReducedBlock[]\n drawerSlug: string\n labels: Labels\n}\n\nconst baseClass = 'blocks-drawer'\n\nconst getBlockLabel = (block: ReducedBlock, i18n: I18nClient) => {\n if (typeof block.labels.singular === 'string') return block.labels.singular.toLowerCase()\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\n useEffect(() => {\n if (!isModalOpen) {\n setSearchTerm('')\n }\n }, [isModalOpen])\n\n useEffect(() => {\n const searchTermToUse = searchTerm.toLowerCase()\n\n const matchingBlocks = blocks?.reduce((matchedBlocks, block) => {\n const blockLabel = getBlockLabel(block, i18n)\n if (blockLabel.includes(searchTermToUse)) matchedBlocks.push(block)\n return matchedBlocks\n }, [])\n\n setFilteredBlocks(matchingBlocks)\n }, [searchTerm, blocks, i18n])\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}__blocks`}>\n {filteredBlocks?.map((block, index) => {\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 addRow(addRowIndex, slug)\n closeModal(drawerSlug)\n }}\n thumbnail={\n imageURL ? (\n <img alt={imageAltText} src={imageURL} />\n ) : (\n <div className={`${baseClass}__default-image`}>\n <DefaultBlockImage />\n </div>\n )\n }\n />\n </li>\n )\n })}\n </ul>\n </div>\n </Drawer>\n )\n}\n"],"names":["useModal","getTranslation","React","useEffect","useState","Drawer","ThumbnailCard","DefaultBlockImage","useTranslation","BlockSearch","baseClass","getBlockLabel","block","i18n","labels","singular","toLowerCase","BlocksDrawer","props","addRow","addRowIndex","blocks","drawerSlug","searchTerm","setSearchTerm","filteredBlocks","setFilteredBlocks","closeModal","isModalOpen","t","searchTermToUse","matchingBlocks","reduce","matchedBlocks","blockLabel","includes","push","slug","title","label","div","className","ul","map","index","imageAltText","imageURL","blockLabels","li","alignLabel","onClick","thumbnail","img","alt","src"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAIA,SAASA,QAAQ,QAAQ,qBAAoB;AAC7C,SAASC,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAIlD,SAASC,MAAM,QAAQ,oCAAmC;AAC1D,SAASC,aAAa,QAAQ,2CAA0C;AACxE,SAASC,iBAAiB,QAAQ,+CAA8C;AAChF,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,WAAW,QAAQ,yBAAwB;AAWpD,MAAMC,YAAY;AAElB,MAAMC,gBAAgB,CAACC,OAAqBC;IAC1C,IAAI,OAAOD,MAAME,MAAM,CAACC,QAAQ,KAAK,UAAU,OAAOH,MAAME,MAAM,CAACC,QAAQ,CAACC,WAAW;IACvF,IAAI,OAAOJ,MAAME,MAAM,CAACC,QAAQ,KAAK,UAAU;QAC7C,OAAOd,eAAeW,MAAME,MAAM,CAACC,QAAQ,EAAEF,MAAMG,WAAW;IAChE;IACA,OAAO;AACT;AAEA,OAAO,MAAMC,eAAgC,CAACC;IAC5C,MAAM,EAAEC,MAAM,EAAEC,WAAW,EA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pBV,WAAWL;gCACb;gCACA6B,WACEL,yBACE,KAACM;oCAAIC,KAAKR;oCAAcS,KAAKR;mDAE7B,KAACN;oCAAIC,WAAW,CAAC,EAAE/B,UAAU,eAAe,CAAC;8CAC3C,cAAA,KAACH;;;2BAbgCqC;oBAoB/C;;;;;AAKV,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowActions.d.ts","sourceRoot":"","sources":["../../../src/fields/Blocks/RowActions.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAG3C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EACb,MAAM,yDAAyD,CAAA;AAMhE,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;IAChC,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;IACrD,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,YAAY,EAAE,CAAA;IACtB,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3D,QAAQ,EAAE,QAAQ,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACrD,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB,
|
|
1
|
+
{"version":3,"file":"RowActions.d.ts","sourceRoot":"","sources":["../../../src/fields/Blocks/RowActions.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAG3C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EACb,MAAM,yDAAyD,CAAA;AAMhE,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;IAChC,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;IACrD,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,YAAY,EAAE,CAAA;IACtB,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3D,QAAQ,EAAE,QAAQ,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACrD,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAiDA,CAAA"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import { useModal } from '@faceless-ui/modal';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { ArrayAction } from '../../elements/ArrayAction/index.js';
|
|
6
6
|
import { useDrawerSlug } from '../../elements/Drawer/useDrawerSlug.js';
|
|
7
7
|
import { BlocksDrawer } from './BlocksDrawer/index.js';
|
|
8
8
|
export const RowActions = (props)=>{
|
|
9
9
|
const { addRow, blockType, blocks, duplicateRow, hasMaxRows, isSortable, labels, moveRow, removeRow, rowCount, rowIndex } = props;
|
|
10
|
-
const { useModal } = facelessUIImport;
|
|
11
10
|
const { closeModal, openModal } = useModal();
|
|
12
11
|
const drawerSlug = useDrawerSlug('blocks-drawer');
|
|
13
12
|
const [indexToAdd, setIndexToAdd] = React.useState(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/Blocks/RowActions.tsx"],"sourcesContent":["'use client'\nimport type { Labels } from 'payload/types'\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/Blocks/RowActions.tsx"],"sourcesContent":["'use client'\nimport type { Labels } from 'payload/types'\n\nimport { useModal } from '@faceless-ui/modal'\nimport React from 'react'\n\nimport type {\n FieldMap,\n ReducedBlock,\n} from '../../providers/ComponentMap/buildComponentMap/types.js'\n\nimport { ArrayAction } from '../../elements/ArrayAction/index.js'\nimport { useDrawerSlug } from '../../elements/Drawer/useDrawerSlug.js'\nimport { BlocksDrawer } from './BlocksDrawer/index.js'\n\nexport const RowActions: React.FC<{\n addRow: (rowIndex: number, blockType: string) => void\n blockType: string\n blocks: ReducedBlock[]\n duplicateRow: (rowIndex: number, blockType: string) => void\n fieldMap: FieldMap\n hasMaxRows?: boolean\n isSortable?: boolean\n labels: Labels\n moveRow: (fromIndex: number, toIndex: number) => void\n removeRow: (rowIndex: number) => void\n rowCount: number\n rowIndex: number\n}> = (props) => {\n const {\n addRow,\n blockType,\n blocks,\n duplicateRow,\n hasMaxRows,\n isSortable,\n labels,\n moveRow,\n removeRow,\n rowCount,\n rowIndex,\n } = props\n\n const { closeModal, openModal } = useModal()\n const drawerSlug = useDrawerSlug('blocks-drawer')\n\n const [indexToAdd, setIndexToAdd] = React.useState<null | number>(null)\n\n return (\n <React.Fragment>\n <BlocksDrawer\n addRow={(_, rowBlockType) => {\n if (typeof addRow === 'function') {\n addRow(indexToAdd, rowBlockType)\n }\n closeModal(drawerSlug)\n }}\n addRowIndex={rowIndex}\n blocks={blocks}\n drawerSlug={drawerSlug}\n labels={labels}\n />\n <ArrayAction\n addRow={(index) => {\n setIndexToAdd(index)\n openModal(drawerSlug)\n }}\n duplicateRow={() => duplicateRow(rowIndex, blockType)}\n hasMaxRows={hasMaxRows}\n index={rowIndex}\n isSortable={isSortable}\n moveRow={moveRow}\n removeRow={removeRow}\n rowCount={rowCount}\n />\n </React.Fragment>\n )\n}\n"],"names":["useModal","React","ArrayAction","useDrawerSlug","BlocksDrawer","RowActions","props","addRow","blockType","blocks","duplicateRow","hasMaxRows","isSortable","labels","moveRow","removeRow","rowCount","rowIndex","closeModal","openModal","drawerSlug","indexToAdd","setIndexToAdd","useState","Fragment","_","rowBlockType","addRowIndex","index"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAGA,SAASA,QAAQ,QAAQ,qBAAoB;AAC7C,OAAOC,WAAW,QAAO;AAOzB,SAASC,WAAW,QAAQ,sCAAqC;AACjE,SAASC,aAAa,QAAQ,yCAAwC;AACtE,SAASC,YAAY,QAAQ,0BAAyB;AAEtD,OAAO,MAAMC,aAaR,CAACC;IACJ,MAAM,EACJC,MAAM,EACNC,SAAS,EACTC,MAAM,EACNC,YAAY,EACZC,UAAU,EACVC,UAAU,EACVC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACT,GAAGX;IAEJ,MAAM,EAAEY,UAAU,EAAEC,SAAS,EAAE,GAAGnB;IAClC,MAAMoB,aAAajB,cAAc;IAEjC,MAAM,CAACkB,YAAYC,cAAc,GAAGrB,MAAMsB,QAAQ,CAAgB;IAElE,qBACE,MAACtB,MAAMuB,QAAQ;;0BACb,KAACpB;gBACCG,QAAQ,CAACkB,GAAGC;oBACV,IAAI,OAAOnB,WAAW,YAAY;wBAChCA,OAAOc,YAAYK;oBACrB;oBACAR,WAAWE;gBACb;gBACAO,aAAaV;gBACbR,QAAQA;gBACRW,YAAYA;gBACZP,QAAQA;;0BAEV,KAACX;gBACCK,QAAQ,CAACqB;oBACPN,cAAcM;oBACdT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Root":"","sources":["../../../src/fields/Checkbox/Input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAEpE,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAA;IACnD,KAAK,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;IAC3B,UAAU,CAAC,EAAE,mBAAmB,CAAA;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAA;IAC9D,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,cAAc,mBAAmB,CAAA;AAE9C,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA2DtD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/Checkbox/Input.tsx"],"sourcesContent":["'use client'\nimport type { LabelProps, SanitizedLabelProps } from 'payload/types'\n\nimport React from 'react'\n\nimport { FieldLabel } from '../../forms/FieldLabel/index.js'\nimport { Check } from '../../icons/Check/index.js'\nimport { Line } from '../../icons/Line/index.js'\n\nexport type CheckboxInputProps = {\n AfterInput?: React.ReactNode\n BeforeInput?: React.ReactNode\n CustomLabel?: React.ReactNode\n checked?: boolean\n className?: string\n id?: string\n inputRef?: React.RefObject<HTMLInputElement | null>\n label?: LabelProps['label']\n labelProps?: SanitizedLabelProps\n name?: string\n onToggle: (event: React.ChangeEvent<HTMLInputElement>) => void\n partialChecked?: boolean\n readOnly?: boolean\n required?: boolean\n}\n\nexport const inputBaseClass = 'checkbox-input'\n\nexport const CheckboxInput: React.FC<CheckboxInputProps> = ({\n id,\n name,\n AfterInput,\n BeforeInput,\n CustomLabel,\n checked,\n className,\n inputRef,\n label,\n labelProps,\n onToggle,\n partialChecked,\n readOnly,\n required,\n}) => {\n return (\n <div\n className={[\n className,\n inputBaseClass,\n checked && `${inputBaseClass}--checked`,\n readOnly && `${inputBaseClass}--read-only`,\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <div className={`${inputBaseClass}__input`}>\n {BeforeInput}\n <input\n aria-label=\"\"\n defaultChecked={Boolean(checked)}\n disabled={readOnly}\n id={id}\n name={name}\n onInput={onToggle}\n ref={inputRef}\n required={required}\n type=\"checkbox\"\n />\n <span\n className={[`${inputBaseClass}__icon`, !checked && partialChecked ? 'check' : 'partial']\n .filter(Boolean)\n .join(' ')}\n >\n {checked && <Check />}\n {!checked && partialChecked && <Line />}\n </span>\n {AfterInput}\n </div>\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n </div>\n )\n}\n"],"names":["React","FieldLabel","Check","Line","inputBaseClass","CheckboxInput","id","name","AfterInput","BeforeInput","CustomLabel","checked","className","inputRef","label","labelProps","onToggle","partialChecked","readOnly","required","div","filter","Boolean","join","input","aria-label","defaultChecked","disabled","onInput","ref","type","span"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/Checkbox/Input.tsx"],"sourcesContent":["'use client'\nimport type { LabelProps, SanitizedLabelProps } from 'payload/types'\n\nimport React from 'react'\n\nimport { FieldLabel } from '../../forms/FieldLabel/index.js'\nimport { Check } from '../../icons/Check/index.js'\nimport { Line } from '../../icons/Line/index.js'\n\nexport type CheckboxInputProps = {\n AfterInput?: React.ReactNode\n BeforeInput?: React.ReactNode\n CustomLabel?: React.ReactNode\n checked?: boolean\n className?: string\n id?: string\n inputRef?: React.RefObject<HTMLInputElement | null>\n label?: LabelProps['label']\n labelProps?: SanitizedLabelProps\n name?: string\n onToggle: (event: React.ChangeEvent<HTMLInputElement>) => void\n partialChecked?: boolean\n readOnly?: boolean\n required?: boolean\n}\n\nexport const inputBaseClass = 'checkbox-input'\n\nexport const CheckboxInput: React.FC<CheckboxInputProps> = ({\n id,\n name,\n AfterInput,\n BeforeInput,\n CustomLabel,\n checked,\n className,\n inputRef,\n label,\n labelProps,\n onToggle,\n partialChecked,\n readOnly,\n required,\n}) => {\n return (\n <div\n className={[\n className,\n inputBaseClass,\n checked && `${inputBaseClass}--checked`,\n readOnly && `${inputBaseClass}--read-only`,\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <div className={`${inputBaseClass}__input`}>\n {BeforeInput}\n <input\n aria-label=\"\"\n defaultChecked={Boolean(checked)}\n disabled={readOnly}\n id={id}\n name={name}\n onInput={onToggle}\n ref={inputRef}\n required={required}\n type=\"checkbox\"\n />\n <span\n className={[`${inputBaseClass}__icon`, !checked && partialChecked ? 'check' : 'partial']\n .filter(Boolean)\n .join(' ')}\n >\n {checked && <Check />}\n {!checked && partialChecked && <Line />}\n </span>\n {AfterInput}\n </div>\n <FieldLabel\n CustomLabel={CustomLabel}\n htmlFor={id}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n </div>\n )\n}\n"],"names":["React","FieldLabel","Check","Line","inputBaseClass","CheckboxInput","id","name","AfterInput","BeforeInput","CustomLabel","checked","className","inputRef","label","labelProps","onToggle","partialChecked","readOnly","required","div","filter","Boolean","join","input","aria-label","defaultChecked","disabled","onInput","ref","type","span","htmlFor"],"rangeMappings":";;;;;;;;;;;;;;;;;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.ts","sourceRoot":"","sources":["../../../src/fields/Tabs/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAKpD,OAAO,KAA2C,MAAM,OAAO,CAAA;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yDAAyD,CAAA;AACxF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAYvD,OAAO,cAAc,CAAA;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAI5C,OAAO,EAAE,YAAY,EAAE,CAAA;AAEvB,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,gBAAgB,CAAA;IAC7B,IAAI,CAAC,EAAE,SAAS,EAAE,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Tabs/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAKpD,OAAO,KAA2C,MAAM,OAAO,CAAA;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yDAAyD,CAAA;AACxF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAYvD,OAAO,cAAc,CAAA;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAI5C,OAAO,EAAE,YAAY,EAAE,CAAA;AAEvB,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,gBAAgB,CAAA;IAC7B,IAAI,CAAC,EAAE,SAAS,EAAE,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAoKD,eAAO,MAAM,IAAI,0BAA2B,CAAA"}
|
|
@@ -75,6 +75,15 @@ const TabsField = (props)=>{
|
|
|
75
75
|
tabsPrefKey
|
|
76
76
|
]);
|
|
77
77
|
const activeTabConfig = tabs[activeTabIndex];
|
|
78
|
+
function generateTabPath() {
|
|
79
|
+
let tabPath = path;
|
|
80
|
+
if (path && activeTabConfig.name) {
|
|
81
|
+
tabPath = `${path}.${activeTabConfig.name}`;
|
|
82
|
+
} else if (!path && activeTabConfig.name) {
|
|
83
|
+
tabPath = activeTabConfig.name;
|
|
84
|
+
}
|
|
85
|
+
return tabPath;
|
|
86
|
+
}
|
|
78
87
|
return /*#__PURE__*/ _jsx("div", {
|
|
79
88
|
className: [
|
|
80
89
|
fieldBaseClass,
|
|
@@ -114,7 +123,7 @@ const TabsField = (props)=>{
|
|
|
114
123
|
fieldMap: activeTabConfig.fieldMap,
|
|
115
124
|
forceRender: forceRender,
|
|
116
125
|
margins: "small",
|
|
117
|
-
path:
|
|
126
|
+
path: generateTabPath(),
|
|
118
127
|
permissions: 'name' in activeTabConfig && permissions?.fields?.[activeTabConfig.name]?.fields ? permissions?.fields?.[activeTabConfig.name]?.fields : permissions?.fields,
|
|
119
128
|
readOnly: readOnly,
|
|
120
129
|
schemaPath: `${schemaPath ? `${schemaPath}` : ''}${activeTabConfig.name ? `.${activeTabConfig.name}` : ''}`
|