@payloadcms/ui 3.69.0-internal.2883df2 → 3.69.0-internal.35bf893
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/AddNewRelation/index.js +1 -1
- package/dist/elements/AddNewRelation/index.js.map +1 -1
- package/dist/elements/AppHeader/index.d.ts.map +1 -1
- package/dist/elements/AppHeader/index.js +4 -2
- package/dist/elements/AppHeader/index.js.map +1 -1
- package/dist/elements/DeleteDocument/index.d.ts.map +1 -1
- package/dist/elements/DeleteDocument/index.js +2 -1
- package/dist/elements/DeleteDocument/index.js.map +1 -1
- package/dist/elements/DocumentControls/index.d.ts.map +1 -1
- package/dist/elements/DocumentControls/index.js +4 -2
- package/dist/elements/DocumentControls/index.js.map +1 -1
- package/dist/elements/DuplicateDocument/index.d.ts.map +1 -1
- package/dist/elements/DuplicateDocument/index.js +10 -5
- package/dist/elements/DuplicateDocument/index.js.map +1 -1
- package/dist/elements/EditMany/DrawerContent.d.ts.map +1 -1
- package/dist/elements/EditMany/DrawerContent.js +16 -4
- package/dist/elements/EditMany/DrawerContent.js.map +1 -1
- package/dist/elements/FolderView/BrowseByFolderButton/index.d.ts.map +1 -1
- package/dist/elements/FolderView/BrowseByFolderButton/index.js +4 -2
- package/dist/elements/FolderView/BrowseByFolderButton/index.js.map +1 -1
- package/dist/elements/IDLabel/index.d.ts.map +1 -1
- package/dist/elements/IDLabel/index.js +14 -11
- package/dist/elements/IDLabel/index.js.map +1 -1
- package/dist/elements/ListControls/index.d.ts.map +1 -1
- package/dist/elements/ListControls/index.js +6 -4
- package/dist/elements/ListControls/index.js.map +1 -1
- package/dist/elements/Logout/index.d.ts.map +1 -1
- package/dist/elements/Logout/index.js +11 -8
- package/dist/elements/Logout/index.js.map +1 -1
- package/dist/elements/PermanentlyDeleteButton/index.d.ts.map +1 -1
- package/dist/elements/PermanentlyDeleteButton/index.js +2 -1
- package/dist/elements/PermanentlyDeleteButton/index.js.map +1 -1
- package/dist/elements/Popup/PopupButtonList/index.scss +1 -0
- package/dist/elements/Popup/PopupTrigger/index.d.ts +1 -1
- package/dist/elements/Popup/PopupTrigger/index.d.ts.map +1 -1
- package/dist/elements/Popup/PopupTrigger/index.js +24 -92
- package/dist/elements/Popup/PopupTrigger/index.js.map +1 -1
- package/dist/elements/Popup/index.d.ts +32 -1
- package/dist/elements/Popup/index.d.ts.map +1 -1
- package/dist/elements/Popup/index.js +249 -122
- package/dist/elements/Popup/index.js.map +1 -1
- package/dist/elements/Popup/index.scss +49 -231
- package/dist/elements/PublishButton/index.d.ts.map +1 -1
- package/dist/elements/PublishButton/index.js +3 -1
- package/dist/elements/PublishButton/index.js.map +1 -1
- package/dist/elements/QueryPresets/QueryPresetBar/index.d.ts.map +1 -1
- package/dist/elements/QueryPresets/QueryPresetBar/index.js +15 -6
- package/dist/elements/QueryPresets/QueryPresetBar/index.js.map +1 -1
- package/dist/elements/RestoreButton/index.d.ts.map +1 -1
- package/dist/elements/RestoreButton/index.js +2 -1
- package/dist/elements/RestoreButton/index.js.map +1 -1
- package/dist/elements/StayLoggedIn/index.d.ts.map +1 -1
- package/dist/elements/StayLoggedIn/index.js +20 -17
- package/dist/elements/StayLoggedIn/index.js.map +1 -1
- package/dist/elements/Table/DefaultCell/index.d.ts.map +1 -1
- package/dist/elements/Table/DefaultCell/index.js +12 -9
- package/dist/elements/Table/DefaultCell/index.js.map +1 -1
- package/dist/exports/client/index.js +24 -24
- package/dist/exports/client/index.js.map +4 -4
- package/dist/exports/shared/index.js +1 -1
- package/dist/exports/shared/index.js.map +3 -3
- package/dist/fields/Relationship/Input.d.ts.map +1 -1
- package/dist/fields/Relationship/Input.js +3 -2
- package/dist/fields/Relationship/Input.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js +2 -2
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js.map +1 -1
- package/dist/graphics/Account/index.d.ts.map +1 -1
- package/dist/graphics/Account/index.js +4 -2
- package/dist/graphics/Account/index.js.map +1 -1
- package/dist/providers/Auth/index.d.ts.map +1 -1
- package/dist/providers/Auth/index.js +29 -8
- package/dist/providers/Auth/index.js.map +1 -1
- package/dist/providers/Folders/index.d.ts.map +1 -1
- package/dist/providers/Folders/index.js +3 -2
- package/dist/providers/Folders/index.js.map +1 -1
- package/dist/providers/TableColumns/buildColumnState/renderCell.d.ts.map +1 -1
- package/dist/providers/TableColumns/buildColumnState/renderCell.js +2 -1
- package/dist/providers/TableColumns/buildColumnState/renderCell.js.map +1 -1
- package/dist/scss/app.scss +2 -1
- package/dist/styles.css +1 -1
- package/dist/utilities/buildFormState.js +2 -2
- package/dist/utilities/buildFormState.js.map +1 -1
- package/dist/utilities/handleBackToDashboard.d.ts +2 -1
- package/dist/utilities/handleBackToDashboard.d.ts.map +1 -1
- package/dist/utilities/handleBackToDashboard.js +4 -2
- package/dist/utilities/handleBackToDashboard.js.map +1 -1
- package/dist/utilities/handleGoBack.d.ts +2 -1
- package/dist/utilities/handleGoBack.d.ts.map +1 -1
- package/dist/utilities/handleGoBack.js +4 -2
- package/dist/utilities/handleGoBack.js.map +1 -1
- package/dist/views/CollectionFolder/index.js +5 -3
- package/dist/views/CollectionFolder/index.js.map +1 -1
- package/dist/views/Edit/SetDocumentStepNav/index.d.ts.map +1 -1
- package/dist/views/Edit/SetDocumentStepNav/index.js +23 -17
- package/dist/views/Edit/SetDocumentStepNav/index.js.map +1 -1
- package/dist/views/Edit/index.d.ts.map +1 -1
- package/dist/views/Edit/index.js +9 -5
- package/dist/views/Edit/index.js.map +1 -1
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js +5 -3
- package/dist/views/List/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { canAccessAdmin, formatErrors } from 'payload';
|
|
1
|
+
import { canAccessAdmin, formatErrors, UnauthorizedError } from 'payload';
|
|
2
2
|
import { getSelectMode, reduceFieldsToValues } from 'payload/shared';
|
|
3
3
|
import { fieldSchemasToFormState } from '../forms/fieldSchemasToFormState/index.js';
|
|
4
4
|
import { renderField } from '../forms/fieldSchemasToFormState/renderField.js';
|
|
@@ -29,7 +29,7 @@ export const buildFormStateHandler = async args => {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
if (err.message === 'Unauthorized') {
|
|
32
|
-
throw new
|
|
32
|
+
throw new UnauthorizedError();
|
|
33
33
|
}
|
|
34
34
|
return formatErrors(err);
|
|
35
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildFormState.js","names":["canAccessAdmin","formatErrors","getSelectMode","reduceFieldsToValues","fieldSchemasToFormState","renderField","getClientConfig","getClientSchemaMap","getSchemaMap","handleFormStateLocking","handleLivePreview","handlePreview","buildFormStateHandler","args","req","res","buildFormState","err","payload","logger","error","msg","message","Error","id","idFromArgs","collectionSlug","data","incomingData","docPermissions","docPreferences","documentFormState","formState","globalSlug","initialBlockData","initialBlockFormState","mockRSCs","operation","readOnly","renderAllFields","i18n","config","returnLivePreviewURL","returnLockStatus","returnPreviewURL","schemaPath","select","skipClientConfigAuth","skipValidation","updateLastEdited","selectMode","undefined","schemaMap","clientSchemaMap","importMap","user","fieldOrEntityConfig","get","fields","length","type","documentData","blockData","Array","isArray","formStateResult","clientFieldSchemaMap","fieldSchemaMap","permissions","preferences","previousFormState","renderFieldFn","collections","upload","file","lockedStateResult","lockedState","state","livePreviewURL","previewURL"],"sources":["../../src/utilities/buildFormState.ts"],"sourcesContent":["import type {\n BuildFormStateArgs,\n ClientConfig,\n ClientUser,\n ErrorResult,\n FormState,\n ServerFunction,\n} from 'payload'\n\nimport { canAccessAdmin, formatErrors } from 'payload'\nimport { getSelectMode, reduceFieldsToValues } from 'payload/shared'\n\nimport { fieldSchemasToFormState } from '../forms/fieldSchemasToFormState/index.js'\nimport { renderField } from '../forms/fieldSchemasToFormState/renderField.js'\nimport { getClientConfig } from './getClientConfig.js'\nimport { getClientSchemaMap } from './getClientSchemaMap.js'\nimport { getSchemaMap } from './getSchemaMap.js'\nimport { handleFormStateLocking } from './handleFormStateLocking.js'\nimport { handleLivePreview } from './handleLivePreview.js'\nimport { handlePreview } from './handlePreview.js'\n\nexport type LockedState = {\n isLocked: boolean\n lastEditedAt: string\n user: ClientUser | number | string\n}\n\ntype BuildFormStateSuccessResult = {\n clientConfig?: ClientConfig\n errors?: never\n indexPath?: string\n livePreviewURL?: string\n lockedState?: LockedState\n previewURL?: string\n state: FormState\n}\n\ntype BuildFormStateErrorResult = {\n livePreviewURL?: never\n lockedState?: never\n previewURL?: never\n state?: never\n} & (\n | {\n message: string\n }\n | ErrorResult\n)\n\nexport type BuildFormStateResult = BuildFormStateErrorResult | BuildFormStateSuccessResult\n\nexport const buildFormStateHandler: ServerFunction<\n BuildFormStateArgs,\n Promise<BuildFormStateResult>\n> = async (args) => {\n const { req } = args\n\n try {\n await canAccessAdmin({ req })\n const res = await buildFormState(args)\n\n return res\n } catch (err) {\n req.payload.logger.error({ err, msg: `There was an error building form state` })\n\n if (err.message === 'Could not find field schema for given path') {\n return {\n message: err.message,\n }\n }\n\n if (err.message === 'Unauthorized') {\n throw new Error('Unauthorized')\n }\n\n return formatErrors(err)\n }\n}\n\nexport const buildFormState = async (\n args: BuildFormStateArgs,\n): Promise<BuildFormStateSuccessResult> => {\n const {\n id: idFromArgs,\n collectionSlug,\n data: incomingData,\n docPermissions,\n docPreferences,\n documentFormState,\n formState,\n globalSlug,\n initialBlockData,\n initialBlockFormState,\n mockRSCs,\n operation,\n readOnly,\n renderAllFields,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n },\n returnLivePreviewURL,\n returnLockStatus,\n returnPreviewURL,\n schemaPath = collectionSlug || globalSlug,\n select,\n skipClientConfigAuth,\n skipValidation,\n updateLastEdited,\n } = args\n\n const selectMode = select ? getSelectMode(select) : undefined\n\n if (!collectionSlug && !globalSlug) {\n throw new Error('Either collectionSlug or globalSlug must be provided')\n }\n\n const schemaMap = getSchemaMap({\n collectionSlug,\n config,\n globalSlug,\n i18n,\n })\n\n const clientSchemaMap = getClientSchemaMap({\n collectionSlug,\n config: getClientConfig({\n config,\n i18n,\n importMap: req.payload.importMap,\n user: skipClientConfigAuth ? true : req.user,\n }),\n globalSlug,\n i18n,\n payload,\n schemaMap,\n })\n\n const id = collectionSlug ? idFromArgs : undefined\n const fieldOrEntityConfig = schemaMap.get(schemaPath)\n\n if (!fieldOrEntityConfig) {\n throw new Error(`Could not find \"${schemaPath}\" in the fieldSchemaMap`)\n }\n\n if (\n (!('fields' in fieldOrEntityConfig) ||\n !fieldOrEntityConfig.fields ||\n !fieldOrEntityConfig.fields.length) &&\n 'type' in fieldOrEntityConfig &&\n fieldOrEntityConfig.type !== 'blocks'\n ) {\n throw new Error(\n `The field found in fieldSchemaMap for \"${schemaPath}\" does not contain any subfields.`,\n )\n }\n\n // If there is form state but no data, deduce data from that form state, e.g. on initial load\n // Otherwise, use the incoming data as the source of truth, e.g. on subsequent saves\n const data = incomingData || reduceFieldsToValues(formState, true)\n\n let documentData = undefined\n\n if (documentFormState) {\n documentData = reduceFieldsToValues(documentFormState, true)\n }\n\n let blockData = initialBlockData\n\n if (initialBlockFormState) {\n blockData = reduceFieldsToValues(initialBlockFormState, true)\n }\n\n /**\n * When building state for sub schemas we need to adjust:\n * - `fields`\n * - `parentSchemaPath`\n * - `parentPath`\n *\n * Type assertion is fine because we wrap sub schemas in an array\n * so we can safely map over them within `fieldSchemasToFormState`\n */\n const fields = Array.isArray(fieldOrEntityConfig)\n ? fieldOrEntityConfig\n : 'fields' in fieldOrEntityConfig\n ? fieldOrEntityConfig.fields\n : [fieldOrEntityConfig]\n\n // Ensure data.id is present during form state requests, where the data\n // is passed from the client as an argument, without the ID\n if (!data.id && id) {\n data.id = id\n }\n\n const formStateResult = await fieldSchemasToFormState({\n id,\n clientFieldSchemaMap: clientSchemaMap,\n collectionSlug,\n data,\n documentData,\n fields,\n fieldSchemaMap: schemaMap,\n initialBlockData: blockData,\n mockRSCs,\n operation,\n permissions: docPermissions?.fields || {},\n preferences: docPreferences || { fields: {} },\n previousFormState: formState,\n readOnly,\n renderAllFields,\n renderFieldFn: renderField,\n req,\n schemaPath,\n select,\n selectMode,\n skipValidation,\n })\n\n // Maintain form state of auth / upload fields\n if (collectionSlug && formState) {\n if (payload.collections[collectionSlug]?.config?.upload && formState.file) {\n formStateResult.file = formState.file\n }\n }\n\n let lockedStateResult\n\n if (returnLockStatus) {\n lockedStateResult = await handleFormStateLocking({\n id,\n collectionSlug,\n globalSlug,\n req,\n updateLastEdited,\n })\n }\n\n const res: BuildFormStateSuccessResult = {\n lockedState: lockedStateResult,\n state: formStateResult,\n }\n\n if (returnLivePreviewURL) {\n const { livePreviewURL } = await handleLivePreview({\n collectionSlug,\n config,\n data,\n globalSlug,\n req,\n })\n\n // Important: only set this when not undefined,\n // Otherwise it will travel through the network as `$undefined`\n if (livePreviewURL) {\n res.livePreviewURL = livePreviewURL\n }\n }\n\n if (returnPreviewURL) {\n const { previewURL } = await handlePreview({\n collectionSlug,\n config,\n data,\n globalSlug,\n req,\n })\n\n // Important: only set this when not undefined,\n // Otherwise it will travel through the network as `$undefined`\n if (previewURL) {\n res.previewURL = previewURL\n }\n }\n\n return res\n}\n"],"mappings":"AASA,SAASA,cAAc,EAAEC,YAAY,QAAQ;AAC7C,SAASC,aAAa,EAAEC,oBAAoB,QAAQ;AAEpD,SAASC,uBAAuB,QAAQ;AACxC,SAASC,WAAW,QAAQ;AAC5B,SAASC,eAAe,QAAQ;AAChC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,YAAY,QAAQ;AAC7B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,aAAa,QAAQ;AAgC9B,OAAO,MAAMC,qBAAA,GAGT,MAAOC,IAAA;EACT,MAAM;IAAEC;EAAG,C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iBAAA,CAAkB;MACjDgB,cAAA;MACAe,MAAA;MACAd,IAAA;MACAM,UAAA;MACAnB;IACF;IAEA;IACA;IACA,IAAIgE,cAAA,EAAgB;MAClB/D,GAAA,CAAI+D,cAAc,GAAGA,cAAA;IACvB;EACF;EAEA,IAAIlC,gBAAA,EAAkB;IACpB,MAAM;MAAEmC;IAAU,CAAE,GAAG,MAAMpE,aAAA,CAAc;MACzCe,cAAA;MACAe,MAAA;MACAd,IAAA;MACAM,UAAA;MACAnB;IACF;IAEA;IACA;IACA,IAAIiE,UAAA,EAAY;MACdhE,GAAA,CAAIgE,UAAU,GAAGA,UAAA;IACnB;EACF;EAEA,OAAOhE,GAAA;AACT","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"buildFormState.js","names":["canAccessAdmin","formatErrors","UnauthorizedError","getSelectMode","reduceFieldsToValues","fieldSchemasToFormState","renderField","getClientConfig","getClientSchemaMap","getSchemaMap","handleFormStateLocking","handleLivePreview","handlePreview","buildFormStateHandler","args","req","res","buildFormState","err","payload","logger","error","msg","message","id","idFromArgs","collectionSlug","data","incomingData","docPermissions","docPreferences","documentFormState","formState","globalSlug","initialBlockData","initialBlockFormState","mockRSCs","operation","readOnly","renderAllFields","i18n","config","returnLivePreviewURL","returnLockStatus","returnPreviewURL","schemaPath","select","skipClientConfigAuth","skipValidation","updateLastEdited","selectMode","undefined","Error","schemaMap","clientSchemaMap","importMap","user","fieldOrEntityConfig","get","fields","length","type","documentData","blockData","Array","isArray","formStateResult","clientFieldSchemaMap","fieldSchemaMap","permissions","preferences","previousFormState","renderFieldFn","collections","upload","file","lockedStateResult","lockedState","state","livePreviewURL","previewURL"],"sources":["../../src/utilities/buildFormState.ts"],"sourcesContent":["import type {\n BuildFormStateArgs,\n ClientConfig,\n ClientUser,\n ErrorResult,\n FormState,\n ServerFunction,\n} from 'payload'\n\nimport { canAccessAdmin, formatErrors, UnauthorizedError } from 'payload'\nimport { getSelectMode, reduceFieldsToValues } from 'payload/shared'\n\nimport { fieldSchemasToFormState } from '../forms/fieldSchemasToFormState/index.js'\nimport { renderField } from '../forms/fieldSchemasToFormState/renderField.js'\nimport { getClientConfig } from './getClientConfig.js'\nimport { getClientSchemaMap } from './getClientSchemaMap.js'\nimport { getSchemaMap } from './getSchemaMap.js'\nimport { handleFormStateLocking } from './handleFormStateLocking.js'\nimport { handleLivePreview } from './handleLivePreview.js'\nimport { handlePreview } from './handlePreview.js'\n\nexport type LockedState = {\n isLocked: boolean\n lastEditedAt: string\n user: ClientUser | number | string\n}\n\ntype BuildFormStateSuccessResult = {\n clientConfig?: ClientConfig\n errors?: never\n indexPath?: string\n livePreviewURL?: string\n lockedState?: LockedState\n previewURL?: string\n state: FormState\n}\n\ntype BuildFormStateErrorResult = {\n livePreviewURL?: never\n lockedState?: never\n previewURL?: never\n state?: never\n} & (\n | {\n message: string\n }\n | ErrorResult\n)\n\nexport type BuildFormStateResult = BuildFormStateErrorResult | BuildFormStateSuccessResult\n\nexport const buildFormStateHandler: ServerFunction<\n BuildFormStateArgs,\n Promise<BuildFormStateResult>\n> = async (args) => {\n const { req } = args\n\n try {\n await canAccessAdmin({ req })\n const res = await buildFormState(args)\n\n return res\n } catch (err) {\n req.payload.logger.error({ err, msg: `There was an error building form state` })\n\n if (err.message === 'Could not find field schema for given path') {\n return {\n message: err.message,\n }\n }\n\n if (err.message === 'Unauthorized') {\n throw new UnauthorizedError()\n }\n\n return formatErrors(err)\n }\n}\n\nexport const buildFormState = async (\n args: BuildFormStateArgs,\n): Promise<BuildFormStateSuccessResult> => {\n const {\n id: idFromArgs,\n collectionSlug,\n data: incomingData,\n docPermissions,\n docPreferences,\n documentFormState,\n formState,\n globalSlug,\n initialBlockData,\n initialBlockFormState,\n mockRSCs,\n operation,\n readOnly,\n renderAllFields,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n },\n returnLivePreviewURL,\n returnLockStatus,\n returnPreviewURL,\n schemaPath = collectionSlug || globalSlug,\n select,\n skipClientConfigAuth,\n skipValidation,\n updateLastEdited,\n } = args\n\n const selectMode = select ? getSelectMode(select) : undefined\n\n if (!collectionSlug && !globalSlug) {\n throw new Error('Either collectionSlug or globalSlug must be provided')\n }\n\n const schemaMap = getSchemaMap({\n collectionSlug,\n config,\n globalSlug,\n i18n,\n })\n\n const clientSchemaMap = getClientSchemaMap({\n collectionSlug,\n config: getClientConfig({\n config,\n i18n,\n importMap: req.payload.importMap,\n user: skipClientConfigAuth ? true : req.user,\n }),\n globalSlug,\n i18n,\n payload,\n schemaMap,\n })\n\n const id = collectionSlug ? idFromArgs : undefined\n const fieldOrEntityConfig = schemaMap.get(schemaPath)\n\n if (!fieldOrEntityConfig) {\n throw new Error(`Could not find \"${schemaPath}\" in the fieldSchemaMap`)\n }\n\n if (\n (!('fields' in fieldOrEntityConfig) ||\n !fieldOrEntityConfig.fields ||\n !fieldOrEntityConfig.fields.length) &&\n 'type' in fieldOrEntityConfig &&\n fieldOrEntityConfig.type !== 'blocks'\n ) {\n throw new Error(\n `The field found in fieldSchemaMap for \"${schemaPath}\" does not contain any subfields.`,\n )\n }\n\n // If there is form state but no data, deduce data from that form state, e.g. on initial load\n // Otherwise, use the incoming data as the source of truth, e.g. on subsequent saves\n const data = incomingData || reduceFieldsToValues(formState, true)\n\n let documentData = undefined\n\n if (documentFormState) {\n documentData = reduceFieldsToValues(documentFormState, true)\n }\n\n let blockData = initialBlockData\n\n if (initialBlockFormState) {\n blockData = reduceFieldsToValues(initialBlockFormState, true)\n }\n\n /**\n * When building state for sub schemas we need to adjust:\n * - `fields`\n * - `parentSchemaPath`\n * - `parentPath`\n *\n * Type assertion is fine because we wrap sub schemas in an array\n * so we can safely map over them within `fieldSchemasToFormState`\n */\n const fields = Array.isArray(fieldOrEntityConfig)\n ? fieldOrEntityConfig\n : 'fields' in fieldOrEntityConfig\n ? fieldOrEntityConfig.fields\n : [fieldOrEntityConfig]\n\n // Ensure data.id is present during form state requests, where the data\n // is passed from the client as an argument, without the ID\n if (!data.id && id) {\n data.id = id\n }\n\n const formStateResult = await fieldSchemasToFormState({\n id,\n clientFieldSchemaMap: clientSchemaMap,\n collectionSlug,\n data,\n documentData,\n fields,\n fieldSchemaMap: schemaMap,\n initialBlockData: blockData,\n mockRSCs,\n operation,\n permissions: docPermissions?.fields || {},\n preferences: docPreferences || { fields: {} },\n previousFormState: formState,\n readOnly,\n renderAllFields,\n renderFieldFn: renderField,\n req,\n schemaPath,\n select,\n selectMode,\n skipValidation,\n })\n\n // Maintain form state of auth / upload fields\n if (collectionSlug && formState) {\n if (payload.collections[collectionSlug]?.config?.upload && formState.file) {\n formStateResult.file = formState.file\n }\n }\n\n let lockedStateResult\n\n if (returnLockStatus) {\n lockedStateResult = await handleFormStateLocking({\n id,\n collectionSlug,\n globalSlug,\n req,\n updateLastEdited,\n })\n }\n\n const res: BuildFormStateSuccessResult = {\n lockedState: lockedStateResult,\n state: formStateResult,\n }\n\n if (returnLivePreviewURL) {\n const { livePreviewURL } = await handleLivePreview({\n collectionSlug,\n config,\n data,\n globalSlug,\n req,\n })\n\n // Important: only set this when not undefined,\n // Otherwise it will travel through the network as `$undefined`\n if (livePreviewURL) {\n res.livePreviewURL = livePreviewURL\n }\n }\n\n if (returnPreviewURL) {\n const { previewURL } = await handlePreview({\n collectionSlug,\n config,\n data,\n globalSlug,\n req,\n })\n\n // Important: only set this when not undefined,\n // Otherwise it will travel through the network as `$undefined`\n if (previewURL) {\n res.previewURL = previewURL\n }\n }\n\n return res\n}\n"],"mappings":"AASA,SAASA,cAAc,EAAEC,YAAY,EAAEC,iBAAiB,QAAQ;AAChE,SAASC,aAAa,EAAEC,oBAAoB,QAAQ;AAEpD,SAASC,uBAAuB,QAAQ;AACxC,SAASC,WAAW,QAAQ;AAC5B,SAASC,eAAe,QAAQ;AAChC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,YAAY,QAAQ;AAC7B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,aAAa,QAAQ;AAgC9B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AA,EAAsB;IACxB,MAAM;MAAEqC;IAAc,CAAE,GAAG,MAAMpE,iBAAA,CAAkB;MACjDe,cAAA;MACAe,MAAA;MACAd,IAAA;MACAM,UAAA;MACAlB;IACF;IAEA;IACA;IACA,IAAIgE,cAAA,EAAgB;MAClB/D,GAAA,CAAI+D,cAAc,GAAGA,cAAA;IACvB;EACF;EAEA,IAAInC,gBAAA,EAAkB;IACpB,MAAM;MAAEoC;IAAU,CAAE,GAAG,MAAMpE,aAAA,CAAc;MACzCc,cAAA;MACAe,MAAA;MACAd,IAAA;MACAM,UAAA;MACAlB;IACF;IAEA;IACA;IACA,IAAIiE,UAAA,EAAY;MACdhE,GAAA,CAAIgE,UAAU,GAAGA,UAAA;IACnB;EACF;EAEA,OAAOhE,GAAA;AACT","ignoreList":[]}
|
|
@@ -2,7 +2,8 @@ import type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.
|
|
|
2
2
|
type BackToDashboardProps = {
|
|
3
3
|
adminRoute: string;
|
|
4
4
|
router: AppRouterInstance;
|
|
5
|
+
serverURL?: string;
|
|
5
6
|
};
|
|
6
|
-
export declare const handleBackToDashboard: ({ adminRoute, router }: BackToDashboardProps) => void;
|
|
7
|
+
export declare const handleBackToDashboard: ({ adminRoute, router, serverURL }: BackToDashboardProps) => void;
|
|
7
8
|
export {};
|
|
8
9
|
//# sourceMappingURL=handleBackToDashboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleBackToDashboard.d.ts","sourceRoot":"","sources":["../../src/utilities/handleBackToDashboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2DAA2D,CAAA;AAIlG,KAAK,oBAAoB,GAAG;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"handleBackToDashboard.d.ts","sourceRoot":"","sources":["../../src/utilities/handleBackToDashboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2DAA2D,CAAA;AAIlG,KAAK,oBAAoB,GAAG;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,iBAAiB,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,qBAAqB,sCAAuC,oBAAoB,SAO5F,CAAA"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { formatAdminURL } from 'payload/shared';
|
|
2
2
|
export const handleBackToDashboard = ({
|
|
3
3
|
adminRoute,
|
|
4
|
-
router
|
|
4
|
+
router,
|
|
5
|
+
serverURL
|
|
5
6
|
}) => {
|
|
6
7
|
const redirectRoute = formatAdminURL({
|
|
7
8
|
adminRoute,
|
|
8
|
-
path: '/'
|
|
9
|
+
path: '/',
|
|
10
|
+
serverURL
|
|
9
11
|
});
|
|
10
12
|
router.push(redirectRoute);
|
|
11
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleBackToDashboard.js","names":["formatAdminURL","handleBackToDashboard","adminRoute","router","redirectRoute","path","push"],"sources":["../../src/utilities/handleBackToDashboard.tsx"],"sourcesContent":["import type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime.js'\n\nimport { formatAdminURL } from 'payload/shared'\n\ntype BackToDashboardProps = {\n adminRoute: string\n router: AppRouterInstance\n}\n\nexport const handleBackToDashboard = ({ adminRoute, router }: BackToDashboardProps) => {\n const redirectRoute = formatAdminURL({\n adminRoute,\n path: '/',\n })\n router.push(redirectRoute)\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;
|
|
1
|
+
{"version":3,"file":"handleBackToDashboard.js","names":["formatAdminURL","handleBackToDashboard","adminRoute","router","serverURL","redirectRoute","path","push"],"sources":["../../src/utilities/handleBackToDashboard.tsx"],"sourcesContent":["import type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime.js'\n\nimport { formatAdminURL } from 'payload/shared'\n\ntype BackToDashboardProps = {\n adminRoute: string\n router: AppRouterInstance\n serverURL?: string\n}\n\nexport const handleBackToDashboard = ({ adminRoute, router, serverURL }: BackToDashboardProps) => {\n const redirectRoute = formatAdminURL({\n adminRoute,\n path: '/',\n serverURL,\n })\n router.push(redirectRoute)\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAQ/B,OAAO,MAAMC,qBAAA,GAAwBA,CAAC;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAS,CAAwB;EAC3F,MAAMC,aAAA,GAAgBL,cAAA,CAAe;IACnCE,UAAA;IACAI,IAAA,EAAM;IACNF;EACF;EACAD,MAAA,CAAOI,IAAI,CAACF,aAAA;AACd","ignoreList":[]}
|
|
@@ -3,7 +3,8 @@ type GoBackProps = {
|
|
|
3
3
|
adminRoute: string;
|
|
4
4
|
collectionSlug: string;
|
|
5
5
|
router: AppRouterInstance;
|
|
6
|
+
serverURL?: string;
|
|
6
7
|
};
|
|
7
|
-
export declare const handleGoBack: ({ adminRoute, collectionSlug, router }: GoBackProps) => void;
|
|
8
|
+
export declare const handleGoBack: ({ adminRoute, collectionSlug, router, serverURL }: GoBackProps) => void;
|
|
8
9
|
export {};
|
|
9
10
|
//# sourceMappingURL=handleGoBack.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleGoBack.d.ts","sourceRoot":"","sources":["../../src/utilities/handleGoBack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2DAA2D,CAAA;AAIlG,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"handleGoBack.d.ts","sourceRoot":"","sources":["../../src/utilities/handleGoBack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2DAA2D,CAAA;AAIlG,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,iBAAiB,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,YAAY,sDAAuD,WAAW,SAO1F,CAAA"}
|
|
@@ -2,11 +2,13 @@ import { formatAdminURL } from 'payload/shared';
|
|
|
2
2
|
export const handleGoBack = ({
|
|
3
3
|
adminRoute,
|
|
4
4
|
collectionSlug,
|
|
5
|
-
router
|
|
5
|
+
router,
|
|
6
|
+
serverURL
|
|
6
7
|
}) => {
|
|
7
8
|
const redirectRoute = formatAdminURL({
|
|
8
9
|
adminRoute,
|
|
9
|
-
path: collectionSlug ? `/collections/${collectionSlug}` : '/'
|
|
10
|
+
path: collectionSlug ? `/collections/${collectionSlug}` : '/',
|
|
11
|
+
serverURL
|
|
10
12
|
});
|
|
11
13
|
router.push(redirectRoute);
|
|
12
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleGoBack.js","names":["formatAdminURL","handleGoBack","adminRoute","collectionSlug","router","redirectRoute","path","push"],"sources":["../../src/utilities/handleGoBack.tsx"],"sourcesContent":["import type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime.js'\n\nimport { formatAdminURL } from 'payload/shared'\n\ntype GoBackProps = {\n adminRoute: string\n collectionSlug: string\n router: AppRouterInstance\n}\n\nexport const handleGoBack = ({ adminRoute, collectionSlug, router }: GoBackProps) => {\n const redirectRoute = formatAdminURL({\n adminRoute,\n path: collectionSlug ? `/collections/${collectionSlug}` : '/',\n })\n router.push(redirectRoute)\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;
|
|
1
|
+
{"version":3,"file":"handleGoBack.js","names":["formatAdminURL","handleGoBack","adminRoute","collectionSlug","router","serverURL","redirectRoute","path","push"],"sources":["../../src/utilities/handleGoBack.tsx"],"sourcesContent":["import type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime.js'\n\nimport { formatAdminURL } from 'payload/shared'\n\ntype GoBackProps = {\n adminRoute: string\n collectionSlug: string\n router: AppRouterInstance\n serverURL?: string\n}\n\nexport const handleGoBack = ({ adminRoute, collectionSlug, router, serverURL }: GoBackProps) => {\n const redirectRoute = formatAdminURL({\n adminRoute,\n path: collectionSlug ? `/collections/${collectionSlug}` : '/',\n serverURL,\n })\n router.push(redirectRoute)\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAS/B,OAAO,MAAMC,YAAA,GAAeA,CAAC;EAAEC,UAAU;EAAEC,cAAc;EAAEC,MAAM;EAAEC;AAAS,CAAe;EACzF,MAAMC,aAAA,GAAgBN,cAAA,CAAe;IACnCE,UAAA;IACAK,IAAA,EAAMJ,cAAA,GAAiB,gBAAgBA,cAAA,EAAgB,GAAG;IAC1DE;EACF;EACAD,MAAA,CAAOI,IAAI,CAACF,aAAA;AACd","ignoreList":[]}
|
|
@@ -179,7 +179,8 @@ function CollectionFolderViewInContext(props) {
|
|
|
179
179
|
if (config.folders) {
|
|
180
180
|
router.push(formatAdminURL({
|
|
181
181
|
adminRoute: config.routes.admin,
|
|
182
|
-
path: `/collections/${collectionSlug}/${config.folders.slug}
|
|
182
|
+
path: `/collections/${collectionSlug}/${config.folders.slug}`,
|
|
183
|
+
serverURL: config.serverURL
|
|
183
184
|
}));
|
|
184
185
|
}
|
|
185
186
|
});
|
|
@@ -195,7 +196,8 @@ function CollectionFolderViewInContext(props) {
|
|
|
195
196
|
if (config.folders) {
|
|
196
197
|
router.push(formatAdminURL({
|
|
197
198
|
adminRoute: config.routes.admin,
|
|
198
|
-
path: `/collections/${collectionSlug}/${config.folders.slug}/${crumb.id}
|
|
199
|
+
path: `/collections/${collectionSlug}/${config.folders.slug}/${crumb.id}`,
|
|
200
|
+
serverURL: config.serverURL
|
|
199
201
|
}));
|
|
200
202
|
}
|
|
201
203
|
});
|
|
@@ -204,7 +206,7 @@ function CollectionFolderViewInContext(props) {
|
|
|
204
206
|
}, crumb.id)
|
|
205
207
|
}))]);
|
|
206
208
|
}
|
|
207
|
-
}, [breadcrumbs, collectionSlug, config.folders, config.routes.admin, drawerDepth, i18n, labels?.plural, router, setStepNav, startRouteTransition]);
|
|
209
|
+
}, [breadcrumbs, collectionSlug, config.folders, config.routes.admin, config.serverURL, drawerDepth, i18n, labels?.plural, router, setStepNav, startRouteTransition]);
|
|
208
210
|
const totalDocsAndSubfolders = documents.length + subfolders.length;
|
|
209
211
|
let t2;
|
|
210
212
|
if ($[4] !== refineFolderData) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","useDndMonitor","getTranslation","useRouter","formatAdminURL","React","Fragment","DefaultListViewTabs","DroppableBreadcrumb","ColoredFolderIcon","CurrentFolderActions","DragOverlaySelection","SortByPill","ToggleViewButtons","Gutter","ListHeader","ListBulkUploadButton","ListCreateNewDocInFolderButton","NoListResults","SearchBar","useStepNav","useConfig","useEditDepth","FolderProvider","useFolder","usePreferences","useRouteCache","useRouteTransition","useTranslation","useWindowInfo","ListSelection","baseClass","DefaultCollectionFolderView","allCollectionFolderSlugs","folderCollectionSlugs","allowCreateCollectionSlugs","baseFolderPath","breadcrumbs","documents","folderFieldName","folderID","FolderResultsComponent","search","sort","subfolders","restOfProps","_jsx","CollectionFolderViewInContext","props","$","AfterFolderList","AfterFolderListTable","BeforeFolderList","BeforeFolderListTable","collectionSlug","Description","disableBulkDelete","disableBulkEdit","viewPreference","config","getEntityConfig","i18n","t","drawerDepth","setStepNav","setPreference","dragOverlayItem","folderCollectionConfig","folderCollectionSlug","folderType","getSelectedItems","moveToFolder","refineFolderData","selectedItemKeys","setIsDragging","router","startRouteTransition","clearRouteCache","collectionConfig","labels","upload","isUploadCollection","Boolean","isBulkUploadEnabled","bulkUpload","breakpoints","t0","s","smallBreak","t1","event","over","data","current","type","itemsToMove","toFolderID","id","t2","error","console","onDragEnd","handleSetViewType","view","useEffect","length","label","_jsxs","className","children","plural","filter","join","onClick","folders","push","adminRoute","routes","admin","path","slug","map","crumb","crumbIndex","name","totalDocsAndSubfolders","search_0","query","updateURL","DndEventListener","Actions","folderAssignedCollections","Array","isArray","viewType","AfterListHeaderContent","title","TitleActions","buttonLabel","singular","toLowerCase","collectionSlugs","onCreateSuccess","slugPrefix","hasCreatePermission","includes","activeView","setActiveView","onSearchChange","searchQueryParam","Message","size","item","selectedCount","onDragCancel","onDragStart"],"sources":["../../../src/views/CollectionFolder/index.tsx"],"sourcesContent":["'use client'\n\nimport type { DragEndEvent } from '@dnd-kit/core'\nimport type { FolderListViewClientProps } from 'payload'\n\nimport { useDndMonitor } from '@dnd-kit/core'\nimport { getTranslation } from '@payloadcms/translations'\nimport { useRouter } from 'next/navigation.js'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { Fragment } from 'react'\n\nimport { DefaultListViewTabs } from '../../elements/DefaultListViewTabs/index.js'\nimport { DroppableBreadcrumb } from '../../elements/FolderView/Breadcrumbs/index.js'\nimport { ColoredFolderIcon } from '../../elements/FolderView/ColoredFolderIcon/index.js'\nimport { CurrentFolderActions } from '../../elements/FolderView/CurrentFolderActions/index.js'\nimport { DragOverlaySelection } from '../../elements/FolderView/DragOverlaySelection/index.js'\nimport { SortByPill } from '../../elements/FolderView/SortByPill/index.js'\nimport { ToggleViewButtons } from '../../elements/FolderView/ToggleViewButtons/index.js'\nimport { Gutter } from '../../elements/Gutter/index.js'\nimport { ListHeader } from '../../elements/ListHeader/index.js'\nimport {\n ListBulkUploadButton,\n ListCreateNewDocInFolderButton,\n} from '../../elements/ListHeader/TitleActions/index.js'\nimport { NoListResults } from '../../elements/NoListResults/index.js'\nimport { SearchBar } from '../../elements/SearchBar/index.js'\nimport { useStepNav } from '../../elements/StepNav/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useEditDepth } from '../../providers/EditDepth/index.js'\nimport { FolderProvider, useFolder } from '../../providers/Folders/index.js'\nimport { usePreferences } from '../../providers/Preferences/index.js'\nimport { useRouteCache } from '../../providers/RouteCache/index.js'\nimport './index.scss'\nimport { useRouteTransition } from '../../providers/RouteTransition/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { useWindowInfo } from '../../providers/WindowInfo/index.js'\nimport { ListSelection } from './ListSelection/index.js'\n\nconst baseClass = 'collection-folder-list'\n\nexport function DefaultCollectionFolderView({\n allCollectionFolderSlugs: folderCollectionSlugs,\n allowCreateCollectionSlugs,\n baseFolderPath,\n breadcrumbs,\n documents,\n folderFieldName,\n folderID,\n FolderResultsComponent,\n search,\n sort,\n subfolders,\n ...restOfProps\n}: FolderListViewClientProps) {\n return (\n <FolderProvider\n allCollectionFolderSlugs={folderCollectionSlugs}\n allowCreateCollectionSlugs={allowCreateCollectionSlugs}\n baseFolderPath={baseFolderPath}\n breadcrumbs={breadcrumbs}\n documents={documents}\n folderFieldName={folderFieldName}\n folderID={folderID}\n FolderResultsComponent={FolderResultsComponent}\n search={search}\n sort={sort}\n subfolders={subfolders}\n >\n <CollectionFolderViewInContext {...restOfProps} />\n </FolderProvider>\n )\n}\n\ntype CollectionFolderViewInContextProps = Omit<\n FolderListViewClientProps,\n | 'allCollectionFolderSlugs'\n | 'allowCreateCollectionSlugs'\n | 'baseFolderPath'\n | 'breadcrumbs'\n | 'documents'\n | 'folderFieldName'\n | 'folderID'\n | 'FolderResultsComponent'\n | 'subfolders'\n>\n\nfunction CollectionFolderViewInContext(props: CollectionFolderViewInContextProps) {\n const {\n AfterFolderList,\n AfterFolderListTable,\n BeforeFolderList,\n BeforeFolderListTable,\n collectionSlug,\n Description,\n disableBulkDelete,\n disableBulkEdit,\n search,\n viewPreference,\n } = props\n\n const { config, getEntityConfig } = useConfig()\n const { i18n, t } = useTranslation()\n const drawerDepth = useEditDepth()\n const { setStepNav } = useStepNav()\n const { setPreference } = usePreferences()\n const {\n allowCreateCollectionSlugs,\n breadcrumbs,\n documents,\n dragOverlayItem,\n folderCollectionConfig,\n folderCollectionSlug,\n FolderResultsComponent,\n folderType,\n getSelectedItems,\n moveToFolder,\n refineFolderData,\n selectedItemKeys,\n setIsDragging,\n subfolders,\n } = useFolder()\n\n const router = useRouter()\n const { startRouteTransition } = useRouteTransition()\n const { clearRouteCache } = useRouteCache()\n\n const collectionConfig = getEntityConfig({ collectionSlug })\n\n const { labels, upload } = collectionConfig\n const isUploadCollection = Boolean(upload)\n const isBulkUploadEnabled = isUploadCollection && collectionConfig.upload.bulkUpload\n\n const {\n breakpoints: { s: smallBreak },\n } = useWindowInfo()\n\n const onDragEnd = React.useCallback(\n async (event: DragEndEvent) => {\n if (!event.over) {\n return\n }\n\n if (event.over.data.current.type === 'folder' && 'id' in event.over.data.current) {\n try {\n await moveToFolder({\n itemsToMove: getSelectedItems(),\n toFolderID: event.over.data.current.id,\n })\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error moving items:', error)\n }\n\n clearRouteCache()\n }\n },\n [moveToFolder, getSelectedItems, clearRouteCache],\n )\n\n const handleSetViewType = React.useCallback(\n async (view: 'grid' | 'list') => {\n await setPreference(`${collectionSlug}-collection-folder`, {\n viewPreference: view,\n })\n clearRouteCache()\n },\n [collectionSlug, setPreference, clearRouteCache],\n )\n\n React.useEffect(() => {\n if (!drawerDepth) {\n setStepNav([\n !breadcrumbs.length\n ? {\n label: (\n <div className={`${baseClass}__step-nav-icon-label`} key=\"root\">\n <ColoredFolderIcon />\n {getTranslation(labels?.plural, i18n)}\n </div>\n ),\n }\n : {\n label: (\n <DroppableBreadcrumb\n className={[\n `${baseClass}__step-nav-droppable`,\n `${baseClass}__step-nav-icon-label`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={null}\n key=\"root\"\n onClick={() => {\n startRouteTransition(() => {\n if (config.folders) {\n router.push(\n formatAdminURL({\n adminRoute: config.routes.admin,\n path: `/collections/${collectionSlug}/${config.folders.slug}`,\n }),\n )\n }\n })\n }}\n >\n <ColoredFolderIcon />\n {getTranslation(labels?.plural, i18n)}\n </DroppableBreadcrumb>\n ),\n },\n ...breadcrumbs.map((crumb, crumbIndex) => {\n return {\n label:\n crumbIndex === breadcrumbs.length - 1 ? (\n crumb.name\n ) : (\n <DroppableBreadcrumb\n className={`${baseClass}__step-nav-droppable`}\n id={crumb.id}\n key={crumb.id}\n onClick={() => {\n startRouteTransition(() => {\n if (config.folders) {\n router.push(\n formatAdminURL({\n adminRoute: config.routes.admin,\n path: `/collections/${collectionSlug}/${config.folders.slug}/${crumb.id}`,\n }),\n )\n }\n })\n }}\n >\n {crumb.name}\n </DroppableBreadcrumb>\n ),\n }\n }),\n ])\n }\n }, [\n breadcrumbs,\n collectionSlug,\n config.folders,\n config.routes.admin,\n drawerDepth,\n i18n,\n labels?.plural,\n router,\n setStepNav,\n startRouteTransition,\n ])\n\n const totalDocsAndSubfolders = documents.length + subfolders.length\n\n return (\n <Fragment>\n <DndEventListener onDragEnd={onDragEnd} setIsDragging={setIsDragging} />\n\n <div className={`${baseClass} ${baseClass}--${collectionSlug}`}>\n {BeforeFolderList}\n <Gutter className={`${baseClass}__wrap`}>\n <ListHeader\n Actions={[\n !smallBreak && (\n <ListSelection\n disableBulkDelete={disableBulkDelete}\n disableBulkEdit={collectionConfig.disableBulkEdit ?? disableBulkEdit}\n folderAssignedCollections={\n Array.isArray(folderType) ? folderType : [collectionSlug]\n }\n key=\"list-selection\"\n />\n ),\n <DefaultListViewTabs\n collectionConfig={collectionConfig}\n config={config}\n key=\"default-list-actions\"\n viewType=\"folders\"\n />,\n ].filter(Boolean)}\n AfterListHeaderContent={Description}\n title={getTranslation(labels?.plural, i18n)}\n TitleActions={[\n allowCreateCollectionSlugs.length && (\n <ListCreateNewDocInFolderButton\n buttonLabel={\n allowCreateCollectionSlugs.length > 1\n ? t('general:createNew')\n : `${t('general:create')} ${getTranslation(folderCollectionConfig.labels?.singular, i18n).toLowerCase()}`\n }\n collectionSlugs={allowCreateCollectionSlugs}\n folderAssignedCollections={\n Array.isArray(folderType) ? folderType : [collectionSlug]\n }\n key=\"create-new-button\"\n onCreateSuccess={clearRouteCache}\n slugPrefix=\"create-document--header-pill\"\n />\n ),\n <ListBulkUploadButton\n collectionSlug={collectionSlug}\n hasCreatePermission={allowCreateCollectionSlugs.includes(collectionSlug)}\n isBulkUploadEnabled={isBulkUploadEnabled}\n key=\"bulk-upload-button\"\n />,\n ].filter(Boolean)}\n />\n <SearchBar\n Actions={[\n <SortByPill key=\"sort-by-pill\" />,\n <ToggleViewButtons\n activeView={viewPreference}\n key=\"toggle-view-buttons\"\n setActiveView={handleSetViewType}\n />,\n <CurrentFolderActions key=\"current-folder-actions\" />,\n ].filter(Boolean)}\n label={t('general:searchBy', {\n label: t('general:name'),\n })}\n onSearchChange={(search) => refineFolderData({ query: { search }, updateURL: true })}\n searchQueryParam={search}\n />\n {BeforeFolderListTable}\n {totalDocsAndSubfolders > 0 && FolderResultsComponent}\n {totalDocsAndSubfolders === 0 && (\n <NoListResults\n Actions={[\n allowCreateCollectionSlugs.includes(folderCollectionSlug) && (\n <ListCreateNewDocInFolderButton\n buttonLabel={`${t('general:create')} ${getTranslation(folderCollectionConfig.labels?.singular, i18n).toLowerCase()}`}\n collectionSlugs={[folderCollectionConfig.slug]}\n folderAssignedCollections={\n Array.isArray(folderType) ? folderType : [collectionSlug]\n }\n key=\"create-folder\"\n onCreateSuccess={clearRouteCache}\n slugPrefix=\"create-folder--no-results\"\n />\n ),\n allowCreateCollectionSlugs.includes(collectionSlug) && (\n <ListCreateNewDocInFolderButton\n buttonLabel={`${t('general:create')} ${t('general:document').toLowerCase()}`}\n collectionSlugs={[collectionSlug]}\n folderAssignedCollections={\n Array.isArray(folderType) ? folderType : [collectionSlug]\n }\n key=\"create-document\"\n onCreateSuccess={clearRouteCache}\n slugPrefix=\"create-document--no-results\"\n />\n ),\n ].filter(Boolean)}\n Message={\n <p>\n {i18n.t('general:noResults', {\n label: `${getTranslation(labels?.plural, i18n)} ${t('general:or').toLowerCase()} ${getTranslation(\n folderCollectionConfig.labels?.plural,\n i18n,\n )}`,\n })}\n </p>\n }\n />\n )}\n {AfterFolderListTable}\n </Gutter>\n {AfterFolderList}\n </div>\n {selectedItemKeys.size > 0 && dragOverlayItem && (\n <DragOverlaySelection item={dragOverlayItem} selectedCount={selectedItemKeys.size} />\n )}\n </Fragment>\n )\n}\n\nfunction DndEventListener({ onDragEnd, setIsDragging }) {\n useDndMonitor({\n onDragCancel() {\n setIsDragging(false)\n },\n onDragEnd(event) {\n setIsDragging(false)\n onDragEnd(event)\n },\n onDragStart() {\n setIsDragging(true)\n },\n })\n\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAKA,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAEhC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,UAAU,QAAQ;AAC3B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,MAAM,QAAQ;AACvB,SAASC,UAAU,QAAQ;AAC3B,SACEC,oBAAoB,EACpBC,8BAA8B,QACzB;AACP,SAASC,aAAa,QAAQ;AAC9B,SAASC,SAAS,QAAQ;AAC1B,SAASC,UAAU,QAAQ;AAC3B,SAASC,SAAS,QAAQ;AAC1B,SAASC,YAAY,QAAQ;AAC7B,SAASC,cAAc,EAAEC,SAAS,QAAQ;AAC1C,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,QAAQ;AAC9B,OAAO;AACP,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,QAAQ;AAC9B,SAASC,aAAa,QAAQ;AAE9B,MAAMC,SAAA,GAAY;AAEl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aultListViewTabs","DroppableBreadcrumb","ColoredFolderIcon","CurrentFolderActions","DragOverlaySelection","SortByPill","ToggleViewButtons","Gutter","ListHeader","ListBulkUploadButton","ListCreateNewDocInFolderButton","NoListResults","SearchBar","useStepNav","useConfig","useEditDepth","FolderProvider","useFolder","usePreferences","useRouteCache","useRouteTransition","useTranslation","useWindowInfo","ListSelection","baseClass","DefaultCollectionFolderView","allCollectionFolderSlugs","folderCollectionSlugs","allowCreateCollectionSlugs","baseFolderPath","breadcrumbs","documents","folderFieldName","folderID","FolderResultsComponent","search","sort","subfolders","restOfProps","_jsx","CollectionFolderViewInContext","props","$","AfterFolderList","AfterFolderListTable","BeforeFolderList","BeforeFolderListTable","collectionSlug","Description","disableBulkDelete","disableBulkEdit","viewPreference","config","getEntityConfig","i18n","t","drawerDepth","setStepNav","setPreference","dragOverlayItem","folderCollectionConfig","folderCollectionSlug","folderType","getSelectedItems","moveToFolder","refineFolderData","selectedItemKeys","setIsDragging","router","startRouteTransition","clearRouteCache","collectionConfig","labels","upload","isUploadCollection","Boolean","isBulkUploadEnabled","bulkUpload","breakpoints","t0","s","smallBreak","t1","event","over","data","current","type","itemsToMove","toFolderID","id","t2","error","console","onDragEnd","handleSetViewType","view","useEffect","length","label","_jsxs","className","children","plural","filter","join","onClick","folders","push","adminRoute","routes","admin","path","slug","serverURL","map","crumb","crumbIndex","name","totalDocsAndSubfolders","search_0","query","updateURL","DndEventListener","Actions","folderAssignedCollections","Array","isArray","viewType","AfterListHeaderContent","title","TitleActions","buttonLabel","singular","toLowerCase","collectionSlugs","onCreateSuccess","slugPrefix","hasCreatePermission","includes","activeView","setActiveView","onSearchChange","searchQueryParam","Message","size","item","selectedCount","onDragCancel","onDragStart"],"sources":["../../../src/views/CollectionFolder/index.tsx"],"sourcesContent":["'use client'\n\nimport type { DragEndEvent } from '@dnd-kit/core'\nimport type { FolderListViewClientProps } from 'payload'\n\nimport { useDndMonitor } from '@dnd-kit/core'\nimport { getTranslation } from '@payloadcms/translations'\nimport { useRouter } from 'next/navigation.js'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { Fragment } from 'react'\n\nimport { DefaultListViewTabs } from '../../elements/DefaultListViewTabs/index.js'\nimport { DroppableBreadcrumb } from '../../elements/FolderView/Breadcrumbs/index.js'\nimport { ColoredFolderIcon } from '../../elements/FolderView/ColoredFolderIcon/index.js'\nimport { CurrentFolderActions } from '../../elements/FolderView/CurrentFolderActions/index.js'\nimport { DragOverlaySelection } from '../../elements/FolderView/DragOverlaySelection/index.js'\nimport { SortByPill } from '../../elements/FolderView/SortByPill/index.js'\nimport { ToggleViewButtons } from '../../elements/FolderView/ToggleViewButtons/index.js'\nimport { Gutter } from '../../elements/Gutter/index.js'\nimport { ListHeader } from '../../elements/ListHeader/index.js'\nimport {\n ListBulkUploadButton,\n ListCreateNewDocInFolderButton,\n} from '../../elements/ListHeader/TitleActions/index.js'\nimport { NoListResults } from '../../elements/NoListResults/index.js'\nimport { SearchBar } from '../../elements/SearchBar/index.js'\nimport { useStepNav } from '../../elements/StepNav/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useEditDepth } from '../../providers/EditDepth/index.js'\nimport { FolderProvider, useFolder } from '../../providers/Folders/index.js'\nimport { usePreferences } from '../../providers/Preferences/index.js'\nimport { useRouteCache } from '../../providers/RouteCache/index.js'\nimport './index.scss'\nimport { useRouteTransition } from '../../providers/RouteTransition/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { useWindowInfo } from '../../providers/WindowInfo/index.js'\nimport { ListSelection } from './ListSelection/index.js'\n\nconst baseClass = 'collection-folder-list'\n\nexport function DefaultCollectionFolderView({\n allCollectionFolderSlugs: folderCollectionSlugs,\n allowCreateCollectionSlugs,\n baseFolderPath,\n breadcrumbs,\n documents,\n folderFieldName,\n folderID,\n FolderResultsComponent,\n search,\n sort,\n subfolders,\n ...restOfProps\n}: FolderListViewClientProps) {\n return (\n <FolderProvider\n allCollectionFolderSlugs={folderCollectionSlugs}\n allowCreateCollectionSlugs={allowCreateCollectionSlugs}\n baseFolderPath={baseFolderPath}\n breadcrumbs={breadcrumbs}\n documents={documents}\n folderFieldName={folderFieldName}\n folderID={folderID}\n FolderResultsComponent={FolderResultsComponent}\n search={search}\n sort={sort}\n subfolders={subfolders}\n >\n <CollectionFolderViewInContext {...restOfProps} />\n </FolderProvider>\n )\n}\n\ntype CollectionFolderViewInContextProps = Omit<\n FolderListViewClientProps,\n | 'allCollectionFolderSlugs'\n | 'allowCreateCollectionSlugs'\n | 'baseFolderPath'\n | 'breadcrumbs'\n | 'documents'\n | 'folderFieldName'\n | 'folderID'\n | 'FolderResultsComponent'\n | 'subfolders'\n>\n\nfunction CollectionFolderViewInContext(props: CollectionFolderViewInContextProps) {\n const {\n AfterFolderList,\n AfterFolderListTable,\n BeforeFolderList,\n BeforeFolderListTable,\n collectionSlug,\n Description,\n disableBulkDelete,\n disableBulkEdit,\n search,\n viewPreference,\n } = props\n\n const { config, getEntityConfig } = useConfig()\n const { i18n, t } = useTranslation()\n const drawerDepth = useEditDepth()\n const { setStepNav } = useStepNav()\n const { setPreference } = usePreferences()\n const {\n allowCreateCollectionSlugs,\n breadcrumbs,\n documents,\n dragOverlayItem,\n folderCollectionConfig,\n folderCollectionSlug,\n FolderResultsComponent,\n folderType,\n getSelectedItems,\n moveToFolder,\n refineFolderData,\n selectedItemKeys,\n setIsDragging,\n subfolders,\n } = useFolder()\n\n const router = useRouter()\n const { startRouteTransition } = useRouteTransition()\n const { clearRouteCache } = useRouteCache()\n\n const collectionConfig = getEntityConfig({ collectionSlug })\n\n const { labels, upload } = collectionConfig\n const isUploadCollection = Boolean(upload)\n const isBulkUploadEnabled = isUploadCollection && collectionConfig.upload.bulkUpload\n\n const {\n breakpoints: { s: smallBreak },\n } = useWindowInfo()\n\n const onDragEnd = React.useCallback(\n async (event: DragEndEvent) => {\n if (!event.over) {\n return\n }\n\n if (event.over.data.current.type === 'folder' && 'id' in event.over.data.current) {\n try {\n await moveToFolder({\n itemsToMove: getSelectedItems(),\n toFolderID: event.over.data.current.id,\n })\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error moving items:', error)\n }\n\n clearRouteCache()\n }\n },\n [moveToFolder, getSelectedItems, clearRouteCache],\n )\n\n const handleSetViewType = React.useCallback(\n async (view: 'grid' | 'list') => {\n await setPreference(`${collectionSlug}-collection-folder`, {\n viewPreference: view,\n })\n clearRouteCache()\n },\n [collectionSlug, setPreference, clearRouteCache],\n )\n\n React.useEffect(() => {\n if (!drawerDepth) {\n setStepNav([\n !breadcrumbs.length\n ? {\n label: (\n <div className={`${baseClass}__step-nav-icon-label`} key=\"root\">\n <ColoredFolderIcon />\n {getTranslation(labels?.plural, i18n)}\n </div>\n ),\n }\n : {\n label: (\n <DroppableBreadcrumb\n className={[\n `${baseClass}__step-nav-droppable`,\n `${baseClass}__step-nav-icon-label`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={null}\n key=\"root\"\n onClick={() => {\n startRouteTransition(() => {\n if (config.folders) {\n router.push(\n formatAdminURL({\n adminRoute: config.routes.admin,\n path: `/collections/${collectionSlug}/${config.folders.slug}`,\n serverURL: config.serverURL,\n }),\n )\n }\n })\n }}\n >\n <ColoredFolderIcon />\n {getTranslation(labels?.plural, i18n)}\n </DroppableBreadcrumb>\n ),\n },\n ...breadcrumbs.map((crumb, crumbIndex) => {\n return {\n label:\n crumbIndex === breadcrumbs.length - 1 ? (\n crumb.name\n ) : (\n <DroppableBreadcrumb\n className={`${baseClass}__step-nav-droppable`}\n id={crumb.id}\n key={crumb.id}\n onClick={() => {\n startRouteTransition(() => {\n if (config.folders) {\n router.push(\n formatAdminURL({\n adminRoute: config.routes.admin,\n path: `/collections/${collectionSlug}/${config.folders.slug}/${crumb.id}`,\n serverURL: config.serverURL,\n }),\n )\n }\n })\n }}\n >\n {crumb.name}\n </DroppableBreadcrumb>\n ),\n }\n }),\n ])\n }\n }, [\n breadcrumbs,\n collectionSlug,\n config.folders,\n config.routes.admin,\n config.serverURL,\n drawerDepth,\n i18n,\n labels?.plural,\n router,\n setStepNav,\n startRouteTransition,\n ])\n\n const totalDocsAndSubfolders = documents.length + subfolders.length\n\n return (\n <Fragment>\n <DndEventListener onDragEnd={onDragEnd} setIsDragging={setIsDragging} />\n\n <div className={`${baseClass} ${baseClass}--${collectionSlug}`}>\n {BeforeFolderList}\n <Gutter className={`${baseClass}__wrap`}>\n <ListHeader\n Actions={[\n !smallBreak && (\n <ListSelection\n disableBulkDelete={disableBulkDelete}\n disableBulkEdit={collectionConfig.disableBulkEdit ?? disableBulkEdit}\n folderAssignedCollections={\n Array.isArray(folderType) ? folderType : [collectionSlug]\n }\n key=\"list-selection\"\n />\n ),\n <DefaultListViewTabs\n collectionConfig={collectionConfig}\n config={config}\n key=\"default-list-actions\"\n viewType=\"folders\"\n />,\n ].filter(Boolean)}\n AfterListHeaderContent={Description}\n title={getTranslation(labels?.plural, i18n)}\n TitleActions={[\n allowCreateCollectionSlugs.length && (\n <ListCreateNewDocInFolderButton\n buttonLabel={\n allowCreateCollectionSlugs.length > 1\n ? t('general:createNew')\n : `${t('general:create')} ${getTranslation(folderCollectionConfig.labels?.singular, i18n).toLowerCase()}`\n }\n collectionSlugs={allowCreateCollectionSlugs}\n folderAssignedCollections={\n Array.isArray(folderType) ? folderType : [collectionSlug]\n }\n key=\"create-new-button\"\n onCreateSuccess={clearRouteCache}\n slugPrefix=\"create-document--header-pill\"\n />\n ),\n <ListBulkUploadButton\n collectionSlug={collectionSlug}\n hasCreatePermission={allowCreateCollectionSlugs.includes(collectionSlug)}\n isBulkUploadEnabled={isBulkUploadEnabled}\n key=\"bulk-upload-button\"\n />,\n ].filter(Boolean)}\n />\n <SearchBar\n Actions={[\n <SortByPill key=\"sort-by-pill\" />,\n <ToggleViewButtons\n activeView={viewPreference}\n key=\"toggle-view-buttons\"\n setActiveView={handleSetViewType}\n />,\n <CurrentFolderActions key=\"current-folder-actions\" />,\n ].filter(Boolean)}\n label={t('general:searchBy', {\n label: t('general:name'),\n })}\n onSearchChange={(search) => refineFolderData({ query: { search }, updateURL: true })}\n searchQueryParam={search}\n />\n {BeforeFolderListTable}\n {totalDocsAndSubfolders > 0 && FolderResultsComponent}\n {totalDocsAndSubfolders === 0 && (\n <NoListResults\n Actions={[\n allowCreateCollectionSlugs.includes(folderCollectionSlug) && (\n <ListCreateNewDocInFolderButton\n buttonLabel={`${t('general:create')} ${getTranslation(folderCollectionConfig.labels?.singular, i18n).toLowerCase()}`}\n collectionSlugs={[folderCollectionConfig.slug]}\n folderAssignedCollections={\n Array.isArray(folderType) ? folderType : [collectionSlug]\n }\n key=\"create-folder\"\n onCreateSuccess={clearRouteCache}\n slugPrefix=\"create-folder--no-results\"\n />\n ),\n allowCreateCollectionSlugs.includes(collectionSlug) && (\n <ListCreateNewDocInFolderButton\n buttonLabel={`${t('general:create')} ${t('general:document').toLowerCase()}`}\n collectionSlugs={[collectionSlug]}\n folderAssignedCollections={\n Array.isArray(folderType) ? folderType : [collectionSlug]\n }\n key=\"create-document\"\n onCreateSuccess={clearRouteCache}\n slugPrefix=\"create-document--no-results\"\n />\n ),\n ].filter(Boolean)}\n Message={\n <p>\n {i18n.t('general:noResults', {\n label: `${getTranslation(labels?.plural, i18n)} ${t('general:or').toLowerCase()} ${getTranslation(\n folderCollectionConfig.labels?.plural,\n i18n,\n )}`,\n })}\n </p>\n }\n />\n )}\n {AfterFolderListTable}\n </Gutter>\n {AfterFolderList}\n </div>\n {selectedItemKeys.size > 0 && dragOverlayItem && (\n <DragOverlaySelection item={dragOverlayItem} selectedCount={selectedItemKeys.size} />\n )}\n </Fragment>\n )\n}\n\nfunction DndEventListener({ onDragEnd, setIsDragging }) {\n useDndMonitor({\n onDragCancel() {\n setIsDragging(false)\n },\n onDragEnd(event) {\n setIsDragging(false)\n onDragEnd(event)\n },\n onDragStart() {\n setIsDragging(true)\n },\n })\n\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAKA,SAASC,aAAa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CAAC,CAAA;IAC1C,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,yBAAyB,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAA;IAC3D,UAAU,CAAC,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAA;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Edit/SetDocumentStepNav/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAe/E,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC;IACxC,cAAc,CAAC,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAA;IAClD,WAAW,CAAC,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAA;IAC5C,UAAU,CAAC,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAA;IAC1C,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,yBAAyB,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAA;IAC3D,UAAU,CAAC,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAA;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAkHA,CAAA"}
|
|
@@ -11,7 +11,7 @@ import { useDocumentTitle } from '../../../providers/DocumentTitle/index.js';
|
|
|
11
11
|
import { useEntityVisibility } from '../../../providers/EntityVisibility/index.js';
|
|
12
12
|
import { useTranslation } from '../../../providers/Translation/index.js';
|
|
13
13
|
export const SetDocumentStepNav = props => {
|
|
14
|
-
const $ = _c(
|
|
14
|
+
const $ = _c(22);
|
|
15
15
|
const {
|
|
16
16
|
id,
|
|
17
17
|
collectionSlug,
|
|
@@ -56,14 +56,15 @@ export const SetDocumentStepNav = props => {
|
|
|
56
56
|
config: t1
|
|
57
57
|
} = useConfig();
|
|
58
58
|
const {
|
|
59
|
-
routes: t2
|
|
59
|
+
routes: t2,
|
|
60
|
+
serverURL
|
|
60
61
|
} = t1;
|
|
61
62
|
const {
|
|
62
63
|
admin: adminRoute
|
|
63
64
|
} = t2;
|
|
64
65
|
let t3;
|
|
65
66
|
let t4;
|
|
66
|
-
if ($[4] !== adminRoute || $[5] !== collectionSlug || $[6] !== globalSlug || $[7] !== i18n || $[8] !== id || $[9] !== isEditing || $[10] !== isInitializing || $[11] !== isTrashed || $[12] !== isVisible || $[13] !== pluralLabel || $[14] !==
|
|
67
|
+
if ($[4] !== adminRoute || $[5] !== collectionSlug || $[6] !== globalSlug || $[7] !== i18n || $[8] !== id || $[9] !== isEditing || $[10] !== isInitializing || $[11] !== isTrashed || $[12] !== isVisible || $[13] !== pluralLabel || $[14] !== serverURL || $[15] !== setStepNav || $[16] !== t || $[17] !== title || $[18] !== useAsTitle || $[19] !== view) {
|
|
67
68
|
t3 = () => {
|
|
68
69
|
const nav = [];
|
|
69
70
|
if (!isInitializing) {
|
|
@@ -72,7 +73,8 @@ export const SetDocumentStepNav = props => {
|
|
|
72
73
|
label: getTranslation(pluralLabel, i18n),
|
|
73
74
|
url: isVisible ? formatAdminURL({
|
|
74
75
|
adminRoute,
|
|
75
|
-
path: `/collections/${collectionSlug}
|
|
76
|
+
path: `/collections/${collectionSlug}`,
|
|
77
|
+
serverURL
|
|
76
78
|
}) : undefined
|
|
77
79
|
});
|
|
78
80
|
if (isTrashed) {
|
|
@@ -80,7 +82,8 @@ export const SetDocumentStepNav = props => {
|
|
|
80
82
|
label: t("general:trash"),
|
|
81
83
|
url: isVisible ? formatAdminURL({
|
|
82
84
|
adminRoute,
|
|
83
|
-
path: `/collections/${collectionSlug}/trash
|
|
85
|
+
path: `/collections/${collectionSlug}/trash`,
|
|
86
|
+
serverURL
|
|
84
87
|
}) : undefined
|
|
85
88
|
});
|
|
86
89
|
}
|
|
@@ -89,7 +92,8 @@ export const SetDocumentStepNav = props => {
|
|
|
89
92
|
label: useAsTitle && useAsTitle !== "id" && title || `${id}`,
|
|
90
93
|
url: isVisible ? formatAdminURL({
|
|
91
94
|
adminRoute,
|
|
92
|
-
path: isTrashed ? `/collections/${collectionSlug}/trash/${id}` : `/collections/${collectionSlug}/${id}
|
|
95
|
+
path: isTrashed ? `/collections/${collectionSlug}/trash/${id}` : `/collections/${collectionSlug}/${id}`,
|
|
96
|
+
serverURL
|
|
93
97
|
}) : undefined
|
|
94
98
|
});
|
|
95
99
|
} else {
|
|
@@ -103,7 +107,8 @@ export const SetDocumentStepNav = props => {
|
|
|
103
107
|
label: title,
|
|
104
108
|
url: isVisible ? formatAdminURL({
|
|
105
109
|
adminRoute,
|
|
106
|
-
path: `/globals/${globalSlug}
|
|
110
|
+
path: `/globals/${globalSlug}`,
|
|
111
|
+
serverURL
|
|
107
112
|
}) : undefined
|
|
108
113
|
});
|
|
109
114
|
}
|
|
@@ -116,7 +121,7 @@ export const SetDocumentStepNav = props => {
|
|
|
116
121
|
setStepNav(nav);
|
|
117
122
|
}
|
|
118
123
|
};
|
|
119
|
-
t4 = [setStepNav, isInitializing, isEditing, pluralLabel, id, isTrashed, useAsTitle, adminRoute, t, i18n, title, collectionSlug, globalSlug, view, isVisible];
|
|
124
|
+
t4 = [setStepNav, isInitializing, isEditing, pluralLabel, id, isTrashed, useAsTitle, adminRoute, t, i18n, title, collectionSlug, globalSlug, serverURL, view, isVisible];
|
|
120
125
|
$[4] = adminRoute;
|
|
121
126
|
$[5] = collectionSlug;
|
|
122
127
|
$[6] = globalSlug;
|
|
@@ -127,16 +132,17 @@ export const SetDocumentStepNav = props => {
|
|
|
127
132
|
$[11] = isTrashed;
|
|
128
133
|
$[12] = isVisible;
|
|
129
134
|
$[13] = pluralLabel;
|
|
130
|
-
$[14] =
|
|
131
|
-
$[15] =
|
|
132
|
-
$[16] =
|
|
133
|
-
$[17] =
|
|
134
|
-
$[18] =
|
|
135
|
-
$[19] =
|
|
136
|
-
$[20] =
|
|
135
|
+
$[14] = serverURL;
|
|
136
|
+
$[15] = setStepNav;
|
|
137
|
+
$[16] = t;
|
|
138
|
+
$[17] = title;
|
|
139
|
+
$[18] = useAsTitle;
|
|
140
|
+
$[19] = view;
|
|
141
|
+
$[20] = t3;
|
|
142
|
+
$[21] = t4;
|
|
137
143
|
} else {
|
|
138
|
-
t3 = $[
|
|
139
|
-
t4 = $[
|
|
144
|
+
t3 = $[20];
|
|
145
|
+
t4 = $[21];
|
|
140
146
|
}
|
|
141
147
|
useEffect(t3, t4);
|
|
142
148
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","getTranslation","formatAdminURL","useEffect","useStepNav","useConfig","useDocumentInfo","useDocumentTitle","useEntityVisibility","useTranslation","SetDocumentStepNav","props","$","id","collectionSlug","globalSlug","isTrashed","pluralLabel","useAsTitle","view","undefined","isEditing","isInitializing","title","isEntityVisible","t0","isVisible","setStepNav","i18n","t","config","t1","routes","t2","admin","adminRoute","t3","t4","nav","push","label","url","path"],"sources":["../../../../src/views/Edit/SetDocumentStepNav/index.tsx"],"sourcesContent":["'use client'\nimport type { SanitizedCollectionConfig, SanitizedGlobalConfig } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { formatAdminURL } from 'payload/shared'\nimport { useEffect } from 'react'\n\nimport type { StepNavItem } from '../../../elements/StepNav/index.js'\n\nimport { useStepNav } from '../../../elements/StepNav/index.js'\nimport { useConfig } from '../../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../../providers/DocumentInfo/index.js'\nimport { useDocumentTitle } from '../../../providers/DocumentTitle/index.js'\nimport { useEntityVisibility } from '../../../providers/EntityVisibility/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\n\nexport const SetDocumentStepNav: React.FC<{\n collectionSlug?: SanitizedCollectionConfig['slug']\n globalLabel?: SanitizedGlobalConfig['label']\n globalSlug?: SanitizedGlobalConfig['slug']\n id?: number | string\n isTrashed?: boolean\n pluralLabel?: SanitizedCollectionConfig['labels']['plural']\n useAsTitle?: SanitizedCollectionConfig['admin']['useAsTitle']\n view?: string\n}> = (props) => {\n const { id, collectionSlug, globalSlug, isTrashed, pluralLabel, useAsTitle } = props\n\n const view: string | undefined = props?.view || undefined\n\n const { isEditing, isInitializing } = useDocumentInfo()\n const { title } = useDocumentTitle()\n\n const { isEntityVisible } = useEntityVisibility()\n const isVisible = isEntityVisible({ collectionSlug, globalSlug })\n\n const { setStepNav } = useStepNav()\n\n const { i18n, t } = useTranslation()\n\n const {\n config: {\n routes: { admin: adminRoute },\n },\n } = useConfig()\n\n useEffect(() => {\n const nav: StepNavItem[] = []\n\n if (!isInitializing) {\n if (collectionSlug) {\n // Collection label\n nav.push({\n label: getTranslation(pluralLabel, i18n),\n url: isVisible\n ? formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}`,\n })\n : undefined,\n })\n\n // Trash breadcrumb (if in trash view)\n if (isTrashed) {\n nav.push({\n label: t('general:trash'),\n url: isVisible\n ? formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/trash`,\n })\n : undefined,\n })\n }\n\n // Document label\n if (isEditing) {\n nav.push({\n label: (useAsTitle && useAsTitle !== 'id' && title) || `${id}`,\n url: isVisible\n ? formatAdminURL({\n adminRoute,\n path: isTrashed\n ? `/collections/${collectionSlug}/trash/${id}`\n : `/collections/${collectionSlug}/${id}`,\n })\n : undefined,\n })\n } else {\n nav.push({\n label: t('general:createNew'),\n })\n }\n } else if (globalSlug) {\n nav.push({\n label: title,\n url: isVisible\n ? formatAdminURL({\n adminRoute,\n path: `/globals/${globalSlug}`,\n })\n : undefined,\n })\n }\n\n // Fallback view (used for versions, previews, etc.)\n if (view) {\n nav.push({\n label: view,\n })\n }\n\n setStepNav(nav)\n }\n }, [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AqB,MAAA,EAAAC;EAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","getTranslation","formatAdminURL","useEffect","useStepNav","useConfig","useDocumentInfo","useDocumentTitle","useEntityVisibility","useTranslation","SetDocumentStepNav","props","$","id","collectionSlug","globalSlug","isTrashed","pluralLabel","useAsTitle","view","undefined","isEditing","isInitializing","title","isEntityVisible","t0","isVisible","setStepNav","i18n","t","config","t1","routes","t2","serverURL","admin","adminRoute","t3","t4","nav","push","label","url","path"],"sources":["../../../../src/views/Edit/SetDocumentStepNav/index.tsx"],"sourcesContent":["'use client'\nimport type { SanitizedCollectionConfig, SanitizedGlobalConfig } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { formatAdminURL } from 'payload/shared'\nimport { useEffect } from 'react'\n\nimport type { StepNavItem } from '../../../elements/StepNav/index.js'\n\nimport { useStepNav } from '../../../elements/StepNav/index.js'\nimport { useConfig } from '../../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../../providers/DocumentInfo/index.js'\nimport { useDocumentTitle } from '../../../providers/DocumentTitle/index.js'\nimport { useEntityVisibility } from '../../../providers/EntityVisibility/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\n\nexport const SetDocumentStepNav: React.FC<{\n collectionSlug?: SanitizedCollectionConfig['slug']\n globalLabel?: SanitizedGlobalConfig['label']\n globalSlug?: SanitizedGlobalConfig['slug']\n id?: number | string\n isTrashed?: boolean\n pluralLabel?: SanitizedCollectionConfig['labels']['plural']\n useAsTitle?: SanitizedCollectionConfig['admin']['useAsTitle']\n view?: string\n}> = (props) => {\n const { id, collectionSlug, globalSlug, isTrashed, pluralLabel, useAsTitle } = props\n\n const view: string | undefined = props?.view || undefined\n\n const { isEditing, isInitializing } = useDocumentInfo()\n const { title } = useDocumentTitle()\n\n const { isEntityVisible } = useEntityVisibility()\n const isVisible = isEntityVisible({ collectionSlug, globalSlug })\n\n const { setStepNav } = useStepNav()\n\n const { i18n, t } = useTranslation()\n\n const {\n config: {\n routes: { admin: adminRoute },\n serverURL,\n },\n } = useConfig()\n\n useEffect(() => {\n const nav: StepNavItem[] = []\n\n if (!isInitializing) {\n if (collectionSlug) {\n // Collection label\n nav.push({\n label: getTranslation(pluralLabel, i18n),\n url: isVisible\n ? formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}`,\n serverURL,\n })\n : undefined,\n })\n\n // Trash breadcrumb (if in trash view)\n if (isTrashed) {\n nav.push({\n label: t('general:trash'),\n url: isVisible\n ? formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/trash`,\n serverURL,\n })\n : undefined,\n })\n }\n\n // Document label\n if (isEditing) {\n nav.push({\n label: (useAsTitle && useAsTitle !== 'id' && title) || `${id}`,\n url: isVisible\n ? formatAdminURL({\n adminRoute,\n path: isTrashed\n ? `/collections/${collectionSlug}/trash/${id}`\n : `/collections/${collectionSlug}/${id}`,\n serverURL,\n })\n : undefined,\n })\n } else {\n nav.push({\n label: t('general:createNew'),\n })\n }\n } else if (globalSlug) {\n nav.push({\n label: title,\n url: isVisible\n ? formatAdminURL({\n adminRoute,\n path: `/globals/${globalSlug}`,\n serverURL,\n })\n : undefined,\n })\n }\n\n // Fallback view (used for versions, previews, etc.)\n if (view) {\n nav.push({\n label: view,\n })\n }\n\n setStepNav(nav)\n }\n }, [\n setStepNav,\n isInitializing,\n isEditing,\n pluralLabel,\n id,\n isTrashed,\n useAsTitle,\n adminRoute,\n t,\n i18n,\n title,\n collectionSlug,\n globalSlug,\n serverURL,\n view,\n isVisible,\n ])\n\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAGA,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,SAAS,QAAQ;AAI1B,SAASC,UAAU,QAAQ;AAC3B,SAASC,SAAS,QAAQ;AAC1B,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,mBAAmB,QAAQ;AACpC,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appings":"AAEA,OAAO,KAAK,EAAc,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAIlE,OAAO,KAAsE,MAAM,OAAO,CAAA;AAmC1F,OAAO,cAAc,CAAA;AAIrB,MAAM,MAAM,aAAa,GAAG;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAA;AAKD,wBAAgB,eAAe,CAAC,EAC9B,sBAAsB,EACtB,WAAW,EACX,aAAa,EACb,WAAW,EAAE,iBAAiB,EAC9B,aAAa,EACb,aAAa,EACb,UAAU,EACV,eAAe,EACf,MAAM,EAAE,YAAY,EACpB,cAAc,GACf,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Edit/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAc,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAIlE,OAAO,KAAsE,MAAM,OAAO,CAAA;AAmC1F,OAAO,cAAc,CAAA;AAIrB,MAAM,MAAM,aAAa,GAAG;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAA;AAKD,wBAAgB,eAAe,CAAC,EAC9B,sBAAsB,EACtB,WAAW,EACX,aAAa,EACb,WAAW,EAAE,iBAAiB,EAC9B,aAAa,EACb,aAAa,EACb,UAAU,EACV,eAAe,EACf,MAAM,EAAE,YAAY,EACpB,cAAc,GACf,EAAE,uBAAuB,qBAqqBzB"}
|
package/dist/views/Edit/index.js
CHANGED
|
@@ -110,7 +110,8 @@ export function DefaultEditView({
|
|
|
110
110
|
},
|
|
111
111
|
routes: {
|
|
112
112
|
admin: adminRoute
|
|
113
|
-
}
|
|
113
|
+
},
|
|
114
|
+
serverURL
|
|
114
115
|
},
|
|
115
116
|
getEntityConfig
|
|
116
117
|
} = useConfig();
|
|
@@ -258,7 +259,8 @@ export function DefaultEditView({
|
|
|
258
259
|
// Redirect to the same locale if it's been set
|
|
259
260
|
const redirectRoute = formatAdminURL({
|
|
260
261
|
adminRoute,
|
|
261
|
-
path: `/collections/${collectionSlug}/${document?.id}${locale ? `?locale=${locale}` : ''}
|
|
262
|
+
path: `/collections/${collectionSlug}/${document?.id}${locale ? `?locale=${locale}` : ''}`,
|
|
263
|
+
serverURL
|
|
262
264
|
});
|
|
263
265
|
startRouteTransition(() => router.push(redirectRoute));
|
|
264
266
|
} else {
|
|
@@ -325,7 +327,7 @@ export function DefaultEditView({
|
|
|
325
327
|
updatedAt
|
|
326
328
|
});
|
|
327
329
|
}
|
|
328
|
-
}, [
|
|
330
|
+
}, [user, collectionSlug, userSlug, id, setLastUpdateTime, setData, onSaveFromContext, isEditing, depth, redirectAfterCreate, globalSlug, refreshCookieAsync, incrementVersionCount, adminRoute, locale, serverURL, startRouteTransition, router, resetUploadEdits, getDocPermissions, getDocPreferences, getFormState, docPermissions, operation, isLivePreviewEnabled, typeofLivePreviewURL, isPreviewEnabled, schemaPathSegments, upload, isLockingEnabled, reportUpdate, drawerSlug, entitySlug, setDocumentIsLocked, setLivePreviewURL, setPreviewURL]);
|
|
329
331
|
const onChange = useCallback(async ({
|
|
330
332
|
formState: prevFormState,
|
|
331
333
|
submitted
|
|
@@ -406,7 +408,8 @@ export function DefaultEditView({
|
|
|
406
408
|
handleGoBack: () => handleGoBack({
|
|
407
409
|
adminRoute,
|
|
408
410
|
collectionSlug,
|
|
409
|
-
router
|
|
411
|
+
router,
|
|
412
|
+
serverURL
|
|
410
413
|
}),
|
|
411
414
|
isActive: shouldShowDocumentLockedModal,
|
|
412
415
|
onReadOnly: () => {
|
|
@@ -430,7 +433,8 @@ export function DefaultEditView({
|
|
|
430
433
|
}), isLockingEnabled && showTakeOverModal && /*#__PURE__*/_jsx(DocumentTakeOver, {
|
|
431
434
|
handleBackToDashboard: () => handleBackToDashboard({
|
|
432
435
|
adminRoute,
|
|
433
|
-
router
|
|
436
|
+
router,
|
|
437
|
+
serverURL
|
|
434
438
|
}),
|
|
435
439
|
isActive: showTakeOverModal,
|
|
436
440
|
onReadOnly: () => {
|