@payloadcms/next 3.0.0-beta.45 → 3.0.0-beta.46
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/views/List/index.js
CHANGED
|
@@ -52,7 +52,7 @@ export const ListView = async ({ initPageResult, params, searchParams })=>{
|
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
const limit = isNumber(query?.limit) ? Number(query.limit) : listPreferences?.limit || collectionConfig.admin.pagination.defaultLimit;
|
|
55
|
-
const sort = query?.sort && typeof query.sort === 'string' ? query.sort : listPreferences?.sort || undefined;
|
|
55
|
+
const sort = query?.sort && typeof query.sort === 'string' ? query.sort : listPreferences?.sort || collectionConfig.defaultSort || undefined;
|
|
56
56
|
const data = await payload.find({
|
|
57
57
|
collection: collectionSlug,
|
|
58
58
|
depth: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/views/List/index.tsx"],"sourcesContent":["import type { Where } from 'payload/types'\n\nimport { HydrateClientUser } from '@payloadcms/ui/elements/HydrateClientUser'\nimport { RenderCustomComponent } from '@payloadcms/ui/elements/RenderCustomComponent'\nimport { TableColumnsProvider } from '@payloadcms/ui/elements/TableColumns'\nimport { ListInfoProvider } from '@payloadcms/ui/providers/ListInfo'\nimport { ListQueryProvider } from '@payloadcms/ui/providers/ListQuery'\nimport { notFound } from 'next/navigation.js'\nimport { createClientCollectionConfig } from 'payload/config'\nimport { type AdminViewProps } from 'payload/types'\nimport { isNumber, isReactComponentOrFunction, mergeListSearchAndWhere } from 'payload/utilities'\nimport React, { Fragment } from 'react'\n\nimport type { DefaultListViewProps, ListPreferences } from './Default/types.js'\n\nimport { DefaultListView } from './Default/index.js'\n\nexport { generateListMetadata } from './meta.js'\n\nexport const ListView: React.FC<AdminViewProps> = async ({\n initPageResult,\n params,\n searchParams,\n}) => {\n const {\n collectionConfig,\n locale: fullLocale,\n permissions,\n req: {\n i18n,\n locale,\n payload,\n payload: { config },\n query,\n user,\n },\n visibleEntities,\n } = initPageResult\n\n const collectionSlug = collectionConfig?.slug\n\n if (!permissions?.collections?.[collectionSlug]?.read?.permission) {\n notFound()\n }\n\n let listPreferences: ListPreferences\n const preferenceKey = `${collectionSlug}-list`\n\n try {\n listPreferences = (await payload\n .find({\n collection: 'payload-preferences',\n depth: 0,\n limit: 1,\n user,\n where: {\n key: {\n equals: preferenceKey,\n },\n },\n })\n ?.then((res) => res?.docs?.[0]?.value)) as ListPreferences\n } catch (error) {} // eslint-disable-line no-empty\n\n const {\n routes: { admin },\n } = config\n\n if (collectionConfig) {\n const {\n admin: { components: { views: { List: CustomList } = {} } = {} },\n } = collectionConfig\n\n if (!visibleEntities.collections.includes(collectionSlug)) {\n return notFound()\n }\n\n let CustomListView = null\n\n if (CustomList && typeof CustomList === 'function') {\n CustomListView = CustomList\n } else if (typeof CustomList === 'object' && isReactComponentOrFunction(CustomList.Component)) {\n CustomListView = CustomList.Component\n }\n\n const page = isNumber(query?.page) ? Number(query.page) : 0\n const whereQuery = mergeListSearchAndWhere({\n collectionConfig,\n query: {\n search: typeof query?.search === 'string' ? query.search : undefined,\n where: (query?.where as Where) || undefined,\n },\n })\n const limit = isNumber(query?.limit)\n ? Number(query.limit)\n : listPreferences?.limit || collectionConfig.admin.pagination.defaultLimit\n const sort =\n query?.sort && typeof query.sort === 'string'\n ? query.sort\n : listPreferences?.sort || undefined\n\n const data = await payload.find({\n collection: collectionSlug,\n depth: 0,\n draft: true,\n fallbackLocale: null,\n limit,\n locale,\n overrideAccess: false,\n page,\n sort,\n user,\n where: whereQuery || {},\n })\n\n const viewComponentProps: DefaultListViewProps = {\n collectionSlug,\n listSearchableFields: collectionConfig.admin.listSearchableFields,\n }\n\n return (\n <Fragment>\n <HydrateClientUser permissions={permissions} user={user} />\n <ListInfoProvider\n collectionConfig={createClientCollectionConfig({\n collection: collectionConfig,\n t: initPageResult.req.i18n.t,\n })}\n collectionSlug={collectionSlug}\n hasCreatePermission={permissions?.collections?.[collectionSlug]?.create?.permission}\n newDocumentURL={`${admin}/collections/${collectionSlug}/create`}\n >\n <ListQueryProvider\n data={data}\n defaultLimit={limit || collectionConfig?.admin?.pagination?.defaultLimit}\n defaultSort={sort}\n modifySearchParams\n preferenceKey={preferenceKey}\n >\n <TableColumnsProvider\n collectionSlug={collectionSlug}\n enableRowSelections\n listPreferences={listPreferences}\n preferenceKey={preferenceKey}\n >\n <RenderCustomComponent\n CustomComponent={CustomListView}\n DefaultComponent={DefaultListView}\n componentProps={viewComponentProps}\n serverOnlyProps={{\n collectionConfig,\n data,\n hasCreatePermission:\n permissions?.collections?.[collectionSlug]?.create?.permission,\n i18n,\n limit,\n listPreferences,\n locale: fullLocale,\n newDocumentURL: `${admin}/collections/${collectionSlug}/create`,\n params,\n payload,\n permissions,\n searchParams,\n user,\n }}\n />\n </TableColumnsProvider>\n </ListQueryProvider>\n </ListInfoProvider>\n </Fragment>\n )\n }\n\n return notFound()\n}\n"],"names":["HydrateClientUser","RenderCustomComponent","TableColumnsProvider","ListInfoProvider","ListQueryProvider","notFound","createClientCollectionConfig","isNumber","isReactComponentOrFunction","mergeListSearchAndWhere","React","Fragment","DefaultListView","generateListMetadata","ListView","initPageResult","params","searchParams","collectionConfig","locale","fullLocale","permissions","req","i18n","payload","config","query","user","visibleEntities","collectionSlug","slug","collections","read","permission","listPreferences","preferenceKey","find","collection","depth","limit","where","key","equals","then","res","docs","value","error","routes","admin","components","views","List","CustomList","includes","CustomListView","Component","page","Number","whereQuery","search","undefined","pagination","defaultLimit","sort","data","draft","fallbackLocale","overrideAccess","viewComponentProps","listSearchableFields","t","hasCreatePermission","create","newDocumentURL","
|
|
1
|
+
{"version":3,"sources":["../../../src/views/List/index.tsx"],"sourcesContent":["import type { Where } from 'payload/types'\n\nimport { HydrateClientUser } from '@payloadcms/ui/elements/HydrateClientUser'\nimport { RenderCustomComponent } from '@payloadcms/ui/elements/RenderCustomComponent'\nimport { TableColumnsProvider } from '@payloadcms/ui/elements/TableColumns'\nimport { ListInfoProvider } from '@payloadcms/ui/providers/ListInfo'\nimport { ListQueryProvider } from '@payloadcms/ui/providers/ListQuery'\nimport { notFound } from 'next/navigation.js'\nimport { createClientCollectionConfig } from 'payload/config'\nimport { type AdminViewProps } from 'payload/types'\nimport { isNumber, isReactComponentOrFunction, mergeListSearchAndWhere } from 'payload/utilities'\nimport React, { Fragment } from 'react'\n\nimport type { DefaultListViewProps, ListPreferences } from './Default/types.js'\n\nimport { DefaultListView } from './Default/index.js'\n\nexport { generateListMetadata } from './meta.js'\n\nexport const ListView: React.FC<AdminViewProps> = async ({\n initPageResult,\n params,\n searchParams,\n}) => {\n const {\n collectionConfig,\n locale: fullLocale,\n permissions,\n req: {\n i18n,\n locale,\n payload,\n payload: { config },\n query,\n user,\n },\n visibleEntities,\n } = initPageResult\n\n const collectionSlug = collectionConfig?.slug\n\n if (!permissions?.collections?.[collectionSlug]?.read?.permission) {\n notFound()\n }\n\n let listPreferences: ListPreferences\n const preferenceKey = `${collectionSlug}-list`\n\n try {\n listPreferences = (await payload\n .find({\n collection: 'payload-preferences',\n depth: 0,\n limit: 1,\n user,\n where: {\n key: {\n equals: preferenceKey,\n },\n },\n })\n ?.then((res) => res?.docs?.[0]?.value)) as ListPreferences\n } catch (error) {} // eslint-disable-line no-empty\n\n const {\n routes: { admin },\n } = config\n\n if (collectionConfig) {\n const {\n admin: { components: { views: { List: CustomList } = {} } = {} },\n } = collectionConfig\n\n if (!visibleEntities.collections.includes(collectionSlug)) {\n return notFound()\n }\n\n let CustomListView = null\n\n if (CustomList && typeof CustomList === 'function') {\n CustomListView = CustomList\n } else if (typeof CustomList === 'object' && isReactComponentOrFunction(CustomList.Component)) {\n CustomListView = CustomList.Component\n }\n\n const page = isNumber(query?.page) ? Number(query.page) : 0\n const whereQuery = mergeListSearchAndWhere({\n collectionConfig,\n query: {\n search: typeof query?.search === 'string' ? query.search : undefined,\n where: (query?.where as Where) || undefined,\n },\n })\n const limit = isNumber(query?.limit)\n ? Number(query.limit)\n : listPreferences?.limit || collectionConfig.admin.pagination.defaultLimit\n const sort =\n query?.sort && typeof query.sort === 'string'\n ? query.sort\n : listPreferences?.sort || collectionConfig.defaultSort || undefined\n\n const data = await payload.find({\n collection: collectionSlug,\n depth: 0,\n draft: true,\n fallbackLocale: null,\n limit,\n locale,\n overrideAccess: false,\n page,\n sort,\n user,\n where: whereQuery || {},\n })\n\n const viewComponentProps: DefaultListViewProps = {\n collectionSlug,\n listSearchableFields: collectionConfig.admin.listSearchableFields,\n }\n\n return (\n <Fragment>\n <HydrateClientUser permissions={permissions} user={user} />\n <ListInfoProvider\n collectionConfig={createClientCollectionConfig({\n collection: collectionConfig,\n t: initPageResult.req.i18n.t,\n })}\n collectionSlug={collectionSlug}\n hasCreatePermission={permissions?.collections?.[collectionSlug]?.create?.permission}\n newDocumentURL={`${admin}/collections/${collectionSlug}/create`}\n >\n <ListQueryProvider\n data={data}\n defaultLimit={limit || collectionConfig?.admin?.pagination?.defaultLimit}\n defaultSort={sort}\n modifySearchParams\n preferenceKey={preferenceKey}\n >\n <TableColumnsProvider\n collectionSlug={collectionSlug}\n enableRowSelections\n listPreferences={listPreferences}\n preferenceKey={preferenceKey}\n >\n <RenderCustomComponent\n CustomComponent={CustomListView}\n DefaultComponent={DefaultListView}\n componentProps={viewComponentProps}\n serverOnlyProps={{\n collectionConfig,\n data,\n hasCreatePermission:\n permissions?.collections?.[collectionSlug]?.create?.permission,\n i18n,\n limit,\n listPreferences,\n locale: fullLocale,\n newDocumentURL: `${admin}/collections/${collectionSlug}/create`,\n params,\n payload,\n permissions,\n searchParams,\n user,\n }}\n />\n </TableColumnsProvider>\n </ListQueryProvider>\n </ListInfoProvider>\n </Fragment>\n )\n }\n\n return notFound()\n}\n"],"names":["HydrateClientUser","RenderCustomComponent","TableColumnsProvider","ListInfoProvider","ListQueryProvider","notFound","createClientCollectionConfig","isNumber","isReactComponentOrFunction","mergeListSearchAndWhere","React","Fragment","DefaultListView","generateListMetadata","ListView","initPageResult","params","searchParams","collectionConfig","locale","fullLocale","permissions","req","i18n","payload","config","query","user","visibleEntities","collectionSlug","slug","collections","read","permission","listPreferences","preferenceKey","find","collection","depth","limit","where","key","equals","then","res","docs","value","error","routes","admin","components","views","List","CustomList","includes","CustomListView","Component","page","Number","whereQuery","search","undefined","pagination","defaultLimit","sort","defaultSort","data","draft","fallbackLocale","overrideAccess","viewComponentProps","listSearchableFields","t","hasCreatePermission","create","newDocumentURL","modifySearchParams","enableRowSelections","CustomComponent","DefaultComponent","componentProps","serverOnlyProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAEA,SAASA,iBAAiB,QAAQ,4CAA2C;AAC7E,SAASC,qBAAqB,QAAQ,gDAA+C;AACrF,SAASC,oBAAoB,QAAQ,uCAAsC;AAC3E,SAASC,gBAAgB,QAAQ,oCAAmC;AACpE,SAASC,iBAAiB,QAAQ,qCAAoC;AACtE,SAASC,QAAQ,QAAQ,qBAAoB;AAC7C,SAASC,4BAA4B,QAAQ,iBAAgB;AAE7D,SAASC,QAAQ,EAAEC,0BAA0B,EAAEC,uBAAuB,QAAQ,oBAAmB;AACjG,OAAOC,SAASC,QAAQ,QAAQ,QAAO;AAIvC,SAASC,eAAe,QAAQ,qBAAoB;AAEpD,SAASC,oBAAoB,QAAQ,YAAW;AAEhD,OAAO,MAAMC,WAAqC,OAAO,EACvDC,cAAc,EACdC,MAAM,EACNC,YAAY,EACb;IACC,MAAM,EACJC,gBAAgB,EAChBC,QAAQC,UAAU,EAClBC,WAAW,EACXC,KAAK,EACHC,IAAI,EACJJ,MAAM,EACNK,OAAO,EACPA,SAAS,EAAEC,MAAM,EAAE,EACnBC,KAAK,EACLC,IAAI,EACL,EACDC,eAAe,EAChB,GAAGb;IAEJ,MAAMc,iBAAi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;oCACAf,QAAQC;oCACRuD,gBAAgB,CAAC,EAAE1B,MAAM,aAAa,EAAEpB,eAAe,OAAO,CAAC;oCAC/Db;oCACAQ;oCACAH;oCACAJ;oCACAU;gCACF;;;;;;;IAOd;IAEA,OAAOtB;AACT,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/next",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.46",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"sass": "1.77.4",
|
|
43
43
|
"sonner": "^1.5.0",
|
|
44
44
|
"ws": "^8.16.0",
|
|
45
|
-
"@payloadcms/graphql": "3.0.0-beta.
|
|
46
|
-
"@payloadcms/ui": "3.0.0-beta.
|
|
47
|
-
"@payloadcms/translations": "3.0.0-beta.
|
|
45
|
+
"@payloadcms/graphql": "3.0.0-beta.46",
|
|
46
|
+
"@payloadcms/ui": "3.0.0-beta.46",
|
|
47
|
+
"@payloadcms/translations": "3.0.0-beta.46"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@next/eslint-plugin-next": "^14.1.0",
|
|
@@ -63,13 +63,13 @@
|
|
|
63
63
|
"terser-webpack-plugin": "^5.3.10",
|
|
64
64
|
"webpack": "^5.78.0",
|
|
65
65
|
"webpack-cli": "^5.1.4",
|
|
66
|
-
"payload": "3.0.0-beta.
|
|
66
|
+
"payload": "3.0.0-beta.46",
|
|
67
67
|
"@payloadcms/eslint-config": "1.1.1"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"graphql": "^16.8.1",
|
|
71
71
|
"next": "^15.0.0-rc.0",
|
|
72
|
-
"payload": "3.0.0-beta.
|
|
72
|
+
"payload": "3.0.0-beta.46"
|
|
73
73
|
},
|
|
74
74
|
"engines": {
|
|
75
75
|
"node": "^18.20.2 || >=20.9.0"
|