@payloadcms/next 3.24.0-canary.7d9fbaf → 3.24.0-canary.a62d86f
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/DocumentHeader/Tabs/Tab/index.d.ts +2 -2
- package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.js +2 -0
- package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
- package/dist/prod/styles.css +1 -1
- package/dist/views/API/index.d.ts +3 -2
- package/dist/views/API/index.d.ts.map +1 -1
- package/dist/views/API/index.js +2 -2
- package/dist/views/API/index.js.map +1 -1
- package/dist/views/Account/ResetPreferences/index.d.ts.map +1 -1
- package/dist/views/Account/ResetPreferences/index.js +19 -15
- package/dist/views/Account/ResetPreferences/index.js.map +1 -1
- package/dist/views/Account/index.d.ts +2 -2
- package/dist/views/Account/index.d.ts.map +1 -1
- package/dist/views/Account/index.js +4 -3
- package/dist/views/Account/index.js.map +1 -1
- package/dist/views/CreateFirstUser/index.d.ts +2 -2
- package/dist/views/CreateFirstUser/index.d.ts.map +1 -1
- package/dist/views/CreateFirstUser/index.js +3 -3
- package/dist/views/CreateFirstUser/index.js.map +1 -1
- package/dist/views/Dashboard/Default/index.d.ts +7 -5
- package/dist/views/Dashboard/Default/index.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/index.js +2 -2
- package/dist/views/Dashboard/Default/index.js.map +1 -1
- package/dist/views/Dashboard/index.d.ts +2 -2
- package/dist/views/Dashboard/index.d.ts.map +1 -1
- package/dist/views/Dashboard/index.js +3 -3
- package/dist/views/Dashboard/index.js.map +1 -1
- package/dist/views/Document/getViewsFromConfig.d.ts +4 -4
- package/dist/views/Document/getViewsFromConfig.d.ts.map +1 -1
- package/dist/views/Document/getViewsFromConfig.js.map +1 -1
- package/dist/views/Document/handleServerFunction.d.ts.map +1 -1
- package/dist/views/Document/handleServerFunction.js +2 -0
- package/dist/views/Document/handleServerFunction.js.map +1 -1
- package/dist/views/Document/index.d.ts +4 -3
- package/dist/views/Document/index.d.ts.map +1 -1
- package/dist/views/Document/index.js +7 -7
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/Document/renderDocumentSlots.d.ts.map +1 -1
- package/dist/views/Document/renderDocumentSlots.js +6 -5
- package/dist/views/Document/renderDocumentSlots.js.map +1 -1
- package/dist/views/Edit/index.d.ts +2 -2
- package/dist/views/Edit/index.js.map +1 -1
- package/dist/views/ForgotPassword/index.d.ts +2 -2
- package/dist/views/ForgotPassword/index.d.ts.map +1 -1
- package/dist/views/ForgotPassword/index.js +3 -3
- package/dist/views/ForgotPassword/index.js.map +1 -1
- package/dist/views/List/handleServerFunction.d.ts.map +1 -1
- package/dist/views/List/handleServerFunction.js +2 -0
- package/dist/views/List/handleServerFunction.js.map +1 -1
- package/dist/views/List/index.d.ts +6 -5
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js +30 -30
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/List/renderListViewSlots.d.ts +3 -4
- package/dist/views/List/renderListViewSlots.d.ts.map +1 -1
- package/dist/views/List/renderListViewSlots.js +20 -11
- package/dist/views/List/renderListViewSlots.js.map +1 -1
- package/dist/views/LivePreview/index.d.ts +3 -2
- package/dist/views/LivePreview/index.d.ts.map +1 -1
- package/dist/views/LivePreview/index.js +2 -2
- package/dist/views/LivePreview/index.js.map +1 -1
- package/dist/views/Login/index.d.ts +2 -2
- package/dist/views/Login/index.d.ts.map +1 -1
- package/dist/views/Login/index.js +3 -4
- package/dist/views/Login/index.js.map +1 -1
- package/dist/views/Logout/index.d.ts +3 -3
- package/dist/views/Logout/index.d.ts.map +1 -1
- package/dist/views/Logout/index.js +2 -2
- package/dist/views/Logout/index.js.map +1 -1
- package/dist/views/NotFound/index.d.ts +2 -2
- package/dist/views/NotFound/index.d.ts.map +1 -1
- package/dist/views/NotFound/index.js +2 -2
- package/dist/views/NotFound/index.js.map +1 -1
- package/dist/views/ResetPassword/index.d.ts +2 -2
- package/dist/views/ResetPassword/index.d.ts.map +1 -1
- package/dist/views/ResetPassword/index.js +3 -3
- package/dist/views/ResetPassword/index.js.map +1 -1
- package/dist/views/Root/getViewFromConfig.d.ts +3 -3
- package/dist/views/Root/getViewFromConfig.d.ts.map +1 -1
- package/dist/views/Root/getViewFromConfig.js.map +1 -1
- package/dist/views/Root/index.d.ts.map +1 -1
- package/dist/views/Root/index.js.map +1 -1
- package/dist/views/Unauthorized/index.d.ts +3 -2
- package/dist/views/Unauthorized/index.d.ts.map +1 -1
- package/dist/views/Unauthorized/index.js +3 -3
- package/dist/views/Unauthorized/index.js.map +1 -1
- package/dist/views/Verify/index.d.ts +2 -2
- package/dist/views/Verify/index.d.ts.map +1 -1
- package/dist/views/Verify/index.js +4 -4
- package/dist/views/Verify/index.js.map +1 -1
- package/dist/views/Version/Restore/index.d.ts.map +1 -1
- package/dist/views/Version/Restore/index.js +13 -30
- package/dist/views/Version/Restore/index.js.map +1 -1
- package/dist/views/Version/index.d.ts +3 -2
- package/dist/views/Version/index.d.ts.map +1 -1
- package/dist/views/Version/index.js +2 -2
- package/dist/views/Version/index.js.map +1 -1
- package/dist/views/Versions/buildColumns.d.ts +1 -2
- package/dist/views/Versions/buildColumns.d.ts.map +1 -1
- package/dist/views/Versions/buildColumns.js.map +1 -1
- package/dist/views/Versions/index.client.d.ts +1 -2
- package/dist/views/Versions/index.client.d.ts.map +1 -1
- package/dist/views/Versions/index.client.js.map +1 -1
- package/dist/views/Versions/index.d.ts +3 -2
- package/dist/views/Versions/index.d.ts.map +1 -1
- package/dist/views/Versions/index.js +2 -2
- package/dist/views/Versions/index.js.map +1 -1
- package/package.json +6 -6
- package/dist/views/Account/ResetPreferences/ConfirmResetModal/index.d.ts +0 -6
- package/dist/views/Account/ResetPreferences/ConfirmResetModal/index.d.ts.map +0 -1
- package/dist/views/Account/ResetPreferences/ConfirmResetModal/index.js +0 -83
- package/dist/views/Account/ResetPreferences/ConfirmResetModal/index.js.map +0 -1
- package/dist/views/Account/ResetPreferences/ConfirmResetModal/index.scss +0 -40
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { DocumentViewServerProps } from 'payload';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare function APIView(props: DocumentViewServerProps): React.JSX.Element;
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/API/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/API/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAEtD,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,wBAAgB,OAAO,CAAC,KAAK,EAAE,uBAAuB,qBAErD"}
|
package/dist/views/API/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { APIViewClient } from './index.client.js';
|
|
4
|
-
export
|
|
4
|
+
export function APIView(props) {
|
|
5
5
|
return /*#__PURE__*/_jsx(APIViewClient, {});
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","APIViewClient","APIView","_jsx"],"sources":["../../../src/views/API/index.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","APIViewClient","APIView","props","_jsx"],"sources":["../../../src/views/API/index.tsx"],"sourcesContent":["import type { DocumentViewServerProps } from 'payload'\n\nimport React from 'react'\n\nimport { APIViewClient } from './index.client.js'\n\nexport function APIView(props: DocumentViewServerProps) {\n return <APIViewClient />\n}\n"],"mappings":";AAEA,OAAOA,KAAA,MAAW;AAElB,SAASC,aAAa,QAAQ;AAE9B,OAAO,SAASC,QAAQC,KAA8B;EACpD,oBAAOC,IAAA,CAACH,aAAA;AACV","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Account/ResetPreferences/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Account/ResetPreferences/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAQnC,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAA;CACrB,CAqEA,CAAA"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { Button,
|
|
4
|
+
import { Button, ConfirmationModal, toast, useModal, useTranslation } from '@payloadcms/ui';
|
|
5
5
|
import * as qs from 'qs-esm';
|
|
6
|
-
import { Fragment, useCallback
|
|
7
|
-
import { ConfirmResetModal } from './ConfirmResetModal/index.js';
|
|
6
|
+
import { Fragment, useCallback } from 'react';
|
|
8
7
|
const confirmResetModalSlug = 'confirm-reset-modal';
|
|
9
8
|
export const ResetPreferences = ({
|
|
10
9
|
apiRoute,
|
|
@@ -16,12 +15,15 @@ export const ResetPreferences = ({
|
|
|
16
15
|
const {
|
|
17
16
|
t
|
|
18
17
|
} = useTranslation();
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const handleResetPreferences = useCallback(async ({
|
|
19
|
+
closeConfirmationModal,
|
|
20
|
+
setConfirming
|
|
21
|
+
}) => {
|
|
22
|
+
if (!user) {
|
|
23
|
+
setConfirming(false);
|
|
24
|
+
closeConfirmationModal();
|
|
22
25
|
return;
|
|
23
26
|
}
|
|
24
|
-
setLoading(true);
|
|
25
27
|
const stringifiedQuery = qs.stringify({
|
|
26
28
|
depth: 0,
|
|
27
29
|
where: {
|
|
@@ -49,12 +51,13 @@ export const ResetPreferences = ({
|
|
|
49
51
|
} else {
|
|
50
52
|
toast.error(message);
|
|
51
53
|
}
|
|
52
|
-
} catch (
|
|
54
|
+
} catch (_err) {
|
|
53
55
|
// swallow error
|
|
54
56
|
} finally {
|
|
55
|
-
|
|
57
|
+
setConfirming(false);
|
|
58
|
+
closeConfirmationModal();
|
|
56
59
|
}
|
|
57
|
-
}, [apiRoute,
|
|
60
|
+
}, [apiRoute, user]);
|
|
58
61
|
return /*#__PURE__*/_jsxs(Fragment, {
|
|
59
62
|
children: [/*#__PURE__*/_jsx("div", {
|
|
60
63
|
children: /*#__PURE__*/_jsx(Button, {
|
|
@@ -62,11 +65,12 @@ export const ResetPreferences = ({
|
|
|
62
65
|
onClick: () => openModal(confirmResetModalSlug),
|
|
63
66
|
children: t('general:resetPreferences')
|
|
64
67
|
})
|
|
65
|
-
}), /*#__PURE__*/_jsx(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
}), /*#__PURE__*/_jsx(ConfirmationModal, {
|
|
69
|
+
body: t('general:resetPreferencesDescription'),
|
|
70
|
+
confirmingLabel: t('general:resettingPreferences'),
|
|
71
|
+
heading: t('general:resetPreferences'),
|
|
72
|
+
modalSlug: confirmResetModalSlug,
|
|
73
|
+
onConfirm: handleResetPreferences
|
|
70
74
|
})]
|
|
71
75
|
});
|
|
72
76
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Button","
|
|
1
|
+
{"version":3,"file":"index.js","names":["Button","ConfirmationModal","toast","useModal","useTranslation","qs","Fragment","useCallback","confirmResetModalSlug","ResetPreferences","apiRoute","user","openModal","t","handleResetPreferences","closeConfirmationModal","setConfirming","stringifiedQuery","stringify","depth","where","id","equals","addQueryPrefix","res","fetch","credentials","headers","method","json","message","ok","success","error","_err","_jsxs","_jsx","buttonStyle","onClick","body","confirmingLabel","heading","modalSlug","onConfirm"],"sources":["../../../../src/views/Account/ResetPreferences/index.tsx"],"sourcesContent":["'use client'\nimport type { OnConfirm } from '@payloadcms/ui'\nimport type { User } from 'payload'\n\nimport { Button, ConfirmationModal, toast, useModal, useTranslation } from '@payloadcms/ui'\nimport * as qs from 'qs-esm'\nimport { Fragment, useCallback } from 'react'\n\nconst confirmResetModalSlug = 'confirm-reset-modal'\n\nexport const ResetPreferences: React.FC<{\n readonly apiRoute: string\n readonly user?: User\n}> = ({ apiRoute, user }) => {\n const { openModal } = useModal()\n const { t } = useTranslation()\n\n const handleResetPreferences: OnConfirm = useCallback(\n async ({ closeConfirmationModal, setConfirming }) => {\n if (!user) {\n setConfirming(false)\n closeConfirmationModal()\n return\n }\n\n const stringifiedQuery = qs.stringify(\n {\n depth: 0,\n where: {\n user: {\n id: {\n equals: user.id,\n },\n },\n },\n },\n { addQueryPrefix: true },\n )\n\n try {\n const res = await fetch(`${apiRoute}/payload-preferences${stringifiedQuery}`, {\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'DELETE',\n })\n\n const json = await res.json()\n const message = json.message\n\n if (res.ok) {\n toast.success(message)\n } else {\n toast.error(message)\n }\n } catch (_err) {\n // swallow error\n } finally {\n setConfirming(false)\n closeConfirmationModal()\n }\n },\n [apiRoute, user],\n )\n\n return (\n <Fragment>\n <div>\n <Button buttonStyle=\"secondary\" onClick={() => openModal(confirmResetModalSlug)}>\n {t('general:resetPreferences')}\n </Button>\n </div>\n <ConfirmationModal\n body={t('general:resetPreferencesDescription')}\n confirmingLabel={t('general:resettingPreferences')}\n heading={t('general:resetPreferences')}\n modalSlug={confirmResetModalSlug}\n onConfirm={handleResetPreferences}\n />\n </Fragment>\n )\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,MAAM,EAAEC,iBAAiB,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,cAAc,QAAQ;AAC3E,YAAYC,EAAA,MAAQ;AACpB,SAASC,QAAQ,EAAEC,WAAW,QAAQ;AAEtC,MAAMC,qBAAA,GAAwB;AAE9B,OAAO,MAAMC,gBAAA,GAGRA,CAAC;EAAEC,QAAQ;EAAEC;AAAI,CAAE;EACtB,MAAM;IAAEC;EAAS,CAAE,GAAGT,QAAA;EACtB,MAAM;IAAEU;EAAC,CAAE,GAAGT,cAAA;EAEd,MAAMU,sBAAA,GAAoCP,WAAA,CACxC,OAAO;IAAEQ,sBAAsB;IAAEC;EAAa,CAAE;IAC9C,IAAI,CAACL,IAAA,EAAM;MACTK,aAAA,CAAc;MACdD,sBAAA;MACA;IACF;IAEA,MAAME,gBAAA,GAAmBZ,EAAA,CAAGa,SAAS,CACnC;MACEC,KAAA,EAAO;MACPC,KAAA,EAAO;QACLT,IAAA,EAAM;UACJU,EAAA,EAAI;YACFC,MAAA,EAAQX,IAAA,CAAKU;UACf;QACF;MACF;IACF,GACA;MAAEE,cAAA,EAAgB;IAAK;IAGzB,IAAI;MACF,MAAMC,GAAA,GAAM,MAAMC,KAAA,CAAM,GAAGf,QAAA,uBAA+BO,gBAAA,EAAkB,EAAE;QAC5ES,WAAA,EAAa;QACbC,OAAA,EAAS;UACP,gBAAgB;QAClB;QACAC,MAAA,EAAQ;MACV;MAEA,MAAMC,IAAA,GAAO,MAAML,GAAA,CAAIK,IAAI;MAC3B,MAAMC,OAAA,GAAUD,IAAA,CAAKC,OAAO;MAE5B,IAAIN,GAAA,CAAIO,EAAE,EAAE;QACV7B,KAAA,CAAM8B,OAAO,CAACF,OAAA;MAChB,OAAO;QACL5B,KAAA,CAAM+B,KAAK,CAACH,OAAA;MACd;IACF,EAAE,OAAOI,IAAA,EAAM;MACb;IAAA,CACF,SAAU;MACRlB,aAAA,CAAc;MACdD,sBAAA;IACF;EACF,GACA,CAACL,QAAA,EAAUC,IAAA,CAAK;EAGlB,oBACEwB,KAAA,CAAC7B,QAAA;4BACC8B,IAAA,CAAC;gBACC,aAAAA,IAAA,CAACpC,MAAA;QAAOqC,WAAA,EAAY;QAAYC,OAAA,EAASA,CAAA,KAAM1B,SAAA,CAAUJ,qBAAA;kBACtDK,CAAA,CAAE;;qBAGPuB,IAAA,CAACnC,iBAAA;MACCsC,IAAA,EAAM1B,CAAA,CAAE;MACR2B,eAAA,EAAiB3B,CAAA,CAAE;MACnB4B,OAAA,EAAS5B,CAAA,CAAE;MACX6B,SAAA,EAAWlC,qBAAA;MACXmC,SAAA,EAAW7B;;;AAInB","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AdminViewServerProps } from 'payload';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export { generateAccountMetadata } from './meta.js';
|
|
4
|
-
export declare
|
|
4
|
+
export declare function Account({ initPageResult, params, searchParams }: AdminViewServerProps): Promise<React.JSX.Element>;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Account/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Account/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAA+B,MAAM,SAAS,CAAA;AAMhF,OAAO,KAAK,MAAM,OAAO,CAAA;AAYzB,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAA;AAEnD,wBAAsB,OAAO,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,oBAAoB,8BAsJ3F"}
|
|
@@ -14,11 +14,11 @@ import { EditView } from '../Edit/index.js';
|
|
|
14
14
|
import { AccountClient } from './index.client.js';
|
|
15
15
|
import { Settings } from './Settings/index.js';
|
|
16
16
|
export { generateAccountMetadata } from './meta.js';
|
|
17
|
-
export
|
|
17
|
+
export async function Account({
|
|
18
18
|
initPageResult,
|
|
19
19
|
params,
|
|
20
20
|
searchParams
|
|
21
|
-
})
|
|
21
|
+
}) {
|
|
22
22
|
const {
|
|
23
23
|
languageOptions,
|
|
24
24
|
locale,
|
|
@@ -155,6 +155,7 @@ export const Account = async ({
|
|
|
155
155
|
Fallback: EditView,
|
|
156
156
|
importMap: payload.importMap,
|
|
157
157
|
serverProps: {
|
|
158
|
+
doc: data,
|
|
158
159
|
i18n,
|
|
159
160
|
initPageResult,
|
|
160
161
|
locale,
|
|
@@ -170,5 +171,5 @@ export const Account = async ({
|
|
|
170
171
|
});
|
|
171
172
|
}
|
|
172
173
|
return notFound();
|
|
173
|
-
}
|
|
174
|
+
}
|
|
174
175
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DocumentInfoProvider","EditDepthProvider","HydrateAuthProvider","RenderServerComponent","buildFormState","notFound","React","DocumentHeader","getDocPreferences","getDocumentData","getDocumentPermissions","getIsLocked","getVersions","EditView","AccountClient","Settings","generateAccountMetadata","Account","initPageResult","params","searchParams","languageOptions","locale","permissions","req","i18n","payload","config","user","admin","theme","userSlug","routes","api","serverURL","collectionConfig","collections","id","data","collectionSlug","slug","Error","docPreferences","docPermissions","hasPublishPermission","hasSavePermission","state","formState","code","operation","renderAllFields","schemaPath","skipValidation","currentEditor","isLocked","lastUpdateTime","isEditing","hasPublishedDoc","mostRecentVersionIsAutosaved","unpublishedVersionCount","versionCount","doc","_jsx","AfterFields","apiURL","initialData","initialState","_jsxs","hideTabs","Component","components","views","account","Fallback","importMap","serverProps","routeSegments"],"sources":["../../../src/views/Account/index.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"index.js","names":["DocumentInfoProvider","EditDepthProvider","HydrateAuthProvider","RenderServerComponent","buildFormState","notFound","React","DocumentHeader","getDocPreferences","getDocumentData","getDocumentPermissions","getIsLocked","getVersions","EditView","AccountClient","Settings","generateAccountMetadata","Account","initPageResult","params","searchParams","languageOptions","locale","permissions","req","i18n","payload","config","user","admin","theme","userSlug","routes","api","serverURL","collectionConfig","collections","id","data","collectionSlug","slug","Error","docPreferences","docPermissions","hasPublishPermission","hasSavePermission","state","formState","code","operation","renderAllFields","schemaPath","skipValidation","currentEditor","isLocked","lastUpdateTime","isEditing","hasPublishedDoc","mostRecentVersionIsAutosaved","unpublishedVersionCount","versionCount","doc","_jsx","AfterFields","apiURL","initialData","initialState","_jsxs","hideTabs","Component","components","views","account","Fallback","importMap","serverProps","routeSegments"],"sources":["../../../src/views/Account/index.tsx"],"sourcesContent":["import type { AdminViewServerProps, DocumentViewServerPropsOnly } from 'payload'\n\nimport { DocumentInfoProvider, EditDepthProvider, HydrateAuthProvider } from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { buildFormState } from '@payloadcms/ui/utilities/buildFormState'\nimport { notFound } from 'next/navigation.js'\nimport React from 'react'\n\nimport { DocumentHeader } from '../../elements/DocumentHeader/index.js'\nimport { getDocPreferences } from '../Document/getDocPreferences.js'\nimport { getDocumentData } from '../Document/getDocumentData.js'\nimport { getDocumentPermissions } from '../Document/getDocumentPermissions.js'\nimport { getIsLocked } from '../Document/getIsLocked.js'\nimport { getVersions } from '../Document/getVersions.js'\nimport { EditView } from '../Edit/index.js'\nimport { AccountClient } from './index.client.js'\nimport { Settings } from './Settings/index.js'\n\nexport { generateAccountMetadata } from './meta.js'\n\nexport async function Account({ initPageResult, params, searchParams }: AdminViewServerProps) {\n const {\n languageOptions,\n locale,\n permissions,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n user,\n },\n } = initPageResult\n\n const {\n admin: { theme, user: userSlug },\n routes: { api },\n serverURL,\n } = config\n\n const collectionConfig = payload?.collections?.[userSlug]?.config\n\n if (collectionConfig && user?.id) {\n // Fetch the data required for the view\n const data = await getDocumentData({\n id: user.id,\n collectionSlug: collectionConfig.slug,\n locale,\n payload,\n req,\n user,\n })\n\n if (!data) {\n throw new Error('not-found')\n }\n\n // Get document preferences\n const docPreferences = await getDocPreferences({\n id: user.id,\n collectionSlug: collectionConfig.slug,\n payload,\n user,\n })\n\n // Get permissions\n const { docPermissions, hasPublishPermission, hasSavePermission } =\n await getDocumentPermissions({\n id: user.id,\n collectionConfig,\n data,\n req,\n })\n\n // Build initial form state from data\n const { state: formState } = await buildFormState({\n id: user.id,\n collectionSlug: collectionConfig.slug,\n data,\n docPermissions,\n docPreferences,\n locale: locale?.code,\n operation: 'update',\n renderAllFields: true,\n req,\n schemaPath: collectionConfig.slug,\n skipValidation: true,\n })\n\n // Fetch document lock state\n const { currentEditor, isLocked, lastUpdateTime } = await getIsLocked({\n id: user.id,\n collectionConfig,\n isEditing: true,\n req,\n })\n\n // Get all versions required for UI\n const { hasPublishedDoc, mostRecentVersionIsAutosaved, unpublishedVersionCount, versionCount } =\n await getVersions({\n id: user.id,\n collectionConfig,\n doc: data,\n docPermissions,\n locale: locale?.code,\n payload,\n user,\n })\n\n return (\n <DocumentInfoProvider\n AfterFields={\n <Settings\n i18n={i18n}\n languageOptions={languageOptions}\n payload={payload}\n theme={theme}\n user={user}\n />\n }\n apiURL={`${serverURL}${api}/${userSlug}${user?.id ? `/${user.id}` : ''}`}\n collectionSlug={userSlug}\n currentEditor={currentEditor}\n docPermissions={docPermissions}\n hasPublishedDoc={hasPublishedDoc}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n id={user?.id}\n initialData={data}\n initialState={formState}\n isEditing\n isLocked={isLocked}\n lastUpdateTime={lastUpdateTime}\n mostRecentVersionIsAutosaved={mostRecentVersionIsAutosaved}\n unpublishedVersionCount={unpublishedVersionCount}\n versionCount={versionCount}\n >\n <EditDepthProvider>\n <DocumentHeader\n collectionConfig={collectionConfig}\n hideTabs\n i18n={i18n}\n payload={payload}\n permissions={permissions}\n />\n <HydrateAuthProvider permissions={permissions} />\n {RenderServerComponent({\n Component: config.admin?.components?.views?.account?.Component,\n Fallback: EditView,\n importMap: payload.importMap,\n serverProps: {\n doc: data,\n i18n,\n initPageResult,\n locale,\n params,\n payload,\n permissions,\n routeSegments: [],\n searchParams,\n user,\n } satisfies DocumentViewServerPropsOnly,\n })}\n <AccountClient />\n </EditDepthProvider>\n </DocumentInfoProvider>\n )\n }\n\n return notFound()\n}\n"],"mappings":";AAEA,SAASA,oBAAoB,EAAEC,iBAAiB,EAAEC,mBAAmB,QAAQ;AAC7E,SAASC,qBAAqB,QAAQ;AACtC,SAASC,cAAc,QAAQ;AAC/B,SAASC,QAAQ,QAAQ;AACzB,OAAOC,KAAA,MAAW;AAElB,SAASC,cAAc,QAAQ;AAC/B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,eAAe,QAAQ;AAChC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,WAAW,QAAQ;AAC5B,SAASC,WAAW,QAAQ;AAC5B,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,QAAQ;AAC9B,SAASC,QAAQ,QAAQ;AAEzB,SAASC,uBAAuB,QAAQ;AAExC,OAAO,eAAeC,QAAQ;EAAEC,cAAc;EAAEC,MAAM;EAAEC;AAAY,CAAwB;EAC1F,MAAM;IACJC,eAAe;IACfC,MAAM;IACNC,WAAW;IACXC,GAAG;IACHA,GAAA,EAAK;MACHC,IAAI;MACJC,OAAO;MACPA,OAAA,EAAS;QAAEC;MAAM,CAAE;MACnBC;IAAI;EACL,CACF,GAAGV,cAAA;EAEJ,MAAM;IACJW,KAAA,EAAO;MAAEC,KAAK;MAAEF,IAAA,EAAMG;IAAQ,CAAE;IAChCC,MAAA,EAAQ;MAAEC;IAAG,CAAE;IACfC;EAAS,CACV,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H,WAAA,EAAaA;yBAEfuC,IAAA,CAAC5D,mBAAA;UAAoBqB,WAAA,EAAaA;YACjCpB,qBAAA,CAAsB;UACrBkE,SAAA,EAAW1C,MAAA,CAAOE,KAAK,EAAEyC,UAAA,EAAYC,KAAA,EAAOC,OAAA,EAASH,SAAA;UACrDI,QAAA,EAAU5D,QAAA;UACV6D,SAAA,EAAWhD,OAAA,CAAQgD,SAAS;UAC5BC,WAAA,EAAa;YACXd,GAAA,EAAKvB,IAAA;YACLb,IAAA;YACAP,cAAA;YACAI,MAAA;YACAH,MAAA;YACAO,OAAA;YACAH,WAAA;YACAqD,aAAA,EAAe,EAAE;YACjBxD,YAAA;YACAQ;UACF;QACF,I,aACAkC,IAAA,CAAChD,aAAA;;;EAIT;EAEA,OAAOT,QAAA;AACT","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AdminViewServerProps } from 'payload';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import './index.scss';
|
|
4
4
|
export { generateCreateFirstUserMetadata } from './meta.js';
|
|
5
|
-
export declare
|
|
5
|
+
export declare function CreateFirstUserView({ initPageResult }: AdminViewServerProps): Promise<React.JSX.Element>;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/CreateFirstUser/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/CreateFirstUser/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAGnD,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,cAAc,CAAA;AAErB,OAAO,EAAE,+BAA+B,EAAE,MAAM,WAAW,CAAA;AAE3D,wBAAsB,mBAAmB,CAAC,EAAE,cAAc,EAAE,EAAE,oBAAoB,8BAoEjF"}
|
|
@@ -6,9 +6,9 @@ import { getDocumentData } from '../Document/getDocumentData.js';
|
|
|
6
6
|
import { getDocumentPermissions } from '../Document/getDocumentPermissions.js';
|
|
7
7
|
import { CreateFirstUserClient } from './index.client.js';
|
|
8
8
|
export { generateCreateFirstUserMetadata } from './meta.js';
|
|
9
|
-
export
|
|
9
|
+
export async function CreateFirstUserView({
|
|
10
10
|
initPageResult
|
|
11
|
-
})
|
|
11
|
+
}) {
|
|
12
12
|
const {
|
|
13
13
|
locale,
|
|
14
14
|
req,
|
|
@@ -79,5 +79,5 @@ export const CreateFirstUserView = async ({
|
|
|
79
79
|
userSlug: userSlug
|
|
80
80
|
})]
|
|
81
81
|
});
|
|
82
|
-
}
|
|
82
|
+
}
|
|
83
83
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["buildFormState","React","getDocPreferences","getDocumentData","getDocumentPermissions","CreateFirstUserClient","generateCreateFirstUserMetadata","CreateFirstUserView","initPageResult","locale","req","payload","collections","config","admin","user","userSlug","collectionConfig","auth","authOptions","loginWithUsername","data","collectionSlug","slug","docPreferences","docPermissions","state","formState","code","operation","renderAllFields","schemaPath","skipValidation","_jsxs","className","_jsx","t","initialState"],"sources":["../../../src/views/CreateFirstUser/index.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"index.js","names":["buildFormState","React","getDocPreferences","getDocumentData","getDocumentPermissions","CreateFirstUserClient","generateCreateFirstUserMetadata","CreateFirstUserView","initPageResult","locale","req","payload","collections","config","admin","user","userSlug","collectionConfig","auth","authOptions","loginWithUsername","data","collectionSlug","slug","docPreferences","docPermissions","state","formState","code","operation","renderAllFields","schemaPath","skipValidation","_jsxs","className","_jsx","t","initialState"],"sources":["../../../src/views/CreateFirstUser/index.tsx"],"sourcesContent":["import type { AdminViewServerProps } from 'payload'\n\nimport { buildFormState } from '@payloadcms/ui/utilities/buildFormState'\nimport React from 'react'\n\nimport { getDocPreferences } from '../Document/getDocPreferences.js'\nimport { getDocumentData } from '../Document/getDocumentData.js'\nimport { getDocumentPermissions } from '../Document/getDocumentPermissions.js'\nimport { CreateFirstUserClient } from './index.client.js'\nimport './index.scss'\n\nexport { generateCreateFirstUserMetadata } from './meta.js'\n\nexport async function CreateFirstUserView({ initPageResult }: AdminViewServerProps) {\n const {\n locale,\n req,\n req: {\n payload: {\n collections,\n config: {\n admin: { user: userSlug },\n },\n },\n },\n } = initPageResult\n\n const collectionConfig = collections?.[userSlug]?.config\n const { auth: authOptions } = collectionConfig\n const loginWithUsername = authOptions.loginWithUsername\n\n // Fetch the data required for the view\n const data = await getDocumentData({\n collectionSlug: collectionConfig.slug,\n locale,\n payload: req.payload,\n req,\n user: req.user,\n })\n\n // Get document preferences\n const docPreferences = await getDocPreferences({\n collectionSlug: collectionConfig.slug,\n payload: req.payload,\n user: req.user,\n })\n\n // Get permissions\n const { docPermissions } = await getDocumentPermissions({\n collectionConfig,\n data,\n req,\n })\n\n // Build initial form state from data\n const { state: formState } = await buildFormState({\n collectionSlug: collectionConfig.slug,\n data,\n docPermissions,\n docPreferences,\n locale: locale?.code,\n operation: 'create',\n renderAllFields: true,\n req,\n schemaPath: collectionConfig.slug,\n skipValidation: true,\n })\n\n return (\n <div className=\"create-first-user\">\n <h1>{req.t('general:welcome')}</h1>\n <p>{req.t('authentication:beginCreateFirstUser')}</p>\n <CreateFirstUserClient\n docPermissions={docPermissions}\n docPreferences={docPreferences}\n initialState={formState}\n loginWithUsername={loginWithUsername}\n userSlug={userSlug}\n />\n </div>\n )\n}\n"],"mappings":";AAEA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAElB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,eAAe,QAAQ;AAChC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,qBAAqB,QAAQ;AAGtC,SAASC,+BAA+B,QAAQ;AAEhD,OAAO,eAAeC,oBAAoB;E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4BACbC,IAAA,CAAC;gBAAIzB,GAAA,CAAI0B,CAAC,CAAC;qBACXD,IAAA,CAAC;gBAAGzB,GAAA,CAAI0B,CAAC,CAAC;qBACVD,IAAA,CAAC9B,qBAAA;MACCoB,cAAA,EAAgBA,cAAA;MAChBD,cAAA,EAAgBA,cAAA;MAChBa,YAAA,EAAcV,SAAA;MACdP,iBAAA,EAAmBA,iBAAA;MACnBJ,QAAA,EAAUA;;;AAIlB","ignoreList":[]}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { groupNavItems } from '@payloadcms/ui/shared';
|
|
2
|
-
import type { ClientUser,
|
|
2
|
+
import type { ClientUser, Locale, ServerProps } from 'payload';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import './index.scss';
|
|
5
|
-
export type
|
|
5
|
+
export type DashboardViewClientProps = {
|
|
6
|
+
locale: Locale;
|
|
7
|
+
};
|
|
8
|
+
export type DashboardViewServerPropsOnly = {
|
|
6
9
|
globalData: Array<{
|
|
7
10
|
data: {
|
|
8
11
|
_isLocked: boolean;
|
|
@@ -19,8 +22,7 @@ export type DashboardProps = {
|
|
|
19
22
|
*/
|
|
20
23
|
Link?: React.ComponentType;
|
|
21
24
|
navGroups?: ReturnType<typeof groupNavItems>;
|
|
22
|
-
permissions: SanitizedPermissions;
|
|
23
|
-
visibleEntities: VisibleEntities;
|
|
24
25
|
} & ServerProps;
|
|
25
|
-
export
|
|
26
|
+
export type DashboardViewServerProps = DashboardViewClientProps & DashboardViewServerPropsOnly;
|
|
27
|
+
export declare function DefaultDashboard(props: DashboardViewServerProps): React.JSX.Element;
|
|
26
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Dashboard/Default/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Dashboard/Default/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAM9D,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,OAAO,cAAc,CAAA;AAIrB,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,UAAU,EAAE,KAAK,CAAC;QAChB,IAAI,EAAE;YAAE,SAAS,EAAE,OAAO,CAAC;YAAC,aAAa,EAAE,MAAM,CAAC;YAAC,YAAY,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;SAAE,CAAA;QAC/F,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,IAAI,EAAE,MAAM,CAAA;KACb,CAAC,CAAA;IACF;;;;OAIG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC1B,SAAS,CAAC,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA;CAC7C,GAAG,WAAW,CAAA;AAEf,MAAM,MAAM,wBAAwB,GAAG,wBAAwB,GAAG,4BAA4B,CAAA;AAE9F,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,wBAAwB,qBA+J/D"}
|
|
@@ -5,7 +5,7 @@ import { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerCompo
|
|
|
5
5
|
import { EntityType, formatAdminURL } from '@payloadcms/ui/shared';
|
|
6
6
|
import React, { Fragment } from 'react';
|
|
7
7
|
const baseClass = 'dashboard';
|
|
8
|
-
export
|
|
8
|
+
export function DefaultDashboard(props) {
|
|
9
9
|
const {
|
|
10
10
|
globalData,
|
|
11
11
|
i18n,
|
|
@@ -157,5 +157,5 @@ export const DefaultDashboard = props => {
|
|
|
157
157
|
})]
|
|
158
158
|
})
|
|
159
159
|
});
|
|
160
|
-
}
|
|
160
|
+
}
|
|
161
161
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getTranslation","Button","Card","Gutter","Locked","RenderServerComponent","EntityType","formatAdminURL","React","Fragment","baseClass","DefaultDashboard","props","globalData","i18n","t","locale","navGroups","params","payload","config","admin","components","afterDashboard","beforeDashboard","routes","adminRoute","permissions","searchParams","user","_jsx","className","_jsxs","Component","importMap","serverProps","length","map","entities","label","groupIndex","slug","type","entityIndex","title","buttonAriaLabel","createHREF","href","hasCreatePermission","isLocked","userEditing","collection","path","collections","create","global","globalLockData","find","data","_isLocked","_userEditing","lockDuration","lastEditedAt","Date","_lastEditedAt","getTime","lockDurationInMilliseconds","lockExpirationTime","actions","id","buttonStyle","el","icon","iconStyle","round","to","undefined","titleAs"],"sources":["../../../../src/views/Dashboard/Default/index.tsx"],"sourcesContent":["import type { groupNavItems } from '@payloadcms/ui/shared'\nimport type { ClientUser, SanitizedPermissions, ServerProps, VisibleEntities } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { Button, Card, Gutter, Locked } from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { EntityType, formatAdminURL } from '@payloadcms/ui/shared'\nimport React, { Fragment } from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'dashboard'\n\nexport type DashboardProps = {\n globalData: Array<{\n data: { _isLocked: boolean; _lastEditedAt: string; _userEditing: ClientUser | number | string }\n lockDuration?: number\n slug: string\n }>\n /**\n * @deprecated\n * This prop is deprecated and will be removed in the next major version.\n * Components now import their own `Link` directly from `next/link`.\n */\n Link?: React.ComponentType\n navGroups?: ReturnType<typeof groupNavItems>\n permissions: SanitizedPermissions\n visibleEntities: VisibleEntities\n} & ServerProps\n\nexport const DefaultDashboard: React.FC<DashboardProps> = (props) => {\n const {\n globalData,\n i18n,\n i18n: { t },\n locale,\n navGroups,\n params,\n payload: {\n config: {\n admin: {\n components: { afterDashboard, beforeDashboard },\n },\n routes: { admin: adminRoute },\n },\n },\n payload,\n permissions,\n searchParams,\n user,\n } = props\n\n return (\n <div className={baseClass}>\n <Gutter className={`${baseClass}__wrap`}>\n {beforeDashboard &&\n RenderServerComponent({\n Component: beforeDashboard,\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n },\n })}\n\n <Fragment>\n {!navGroups || navGroups?.length === 0 ? (\n <p>no nav groups....</p>\n ) : (\n navGroups.map(({ entities, label }, groupIndex) => {\n return (\n <div className={`${baseClass}__group`} key={groupIndex}>\n <h2 className={`${baseClass}__label`}>{label}</h2>\n <ul className={`${baseClass}__card-list`}>\n {entities.map(({ slug, type, label }, entityIndex) => {\n let title: string\n let buttonAriaLabel: string\n let createHREF: string\n let href: string\n let hasCreatePermission: boolean\n let isLocked = null\n let userEditing = null\n\n if (type === EntityType.collection) {\n title = getTranslation(label, i18n)\n\n buttonAriaLabel = t('general:showAllLabel', { label: title })\n\n href = formatAdminURL({ adminRoute, path: `/collections/${slug}` })\n\n createHREF = formatAdminURL({\n adminRoute,\n path: `/collections/${slug}/create`,\n })\n\n hasCreatePermission = permissions?.collections?.[slug]?.create\n }\n\n if (type === EntityType.global) {\n title = getTranslation(label, i18n)\n\n buttonAriaLabel = t('general:editLabel', {\n label: getTranslation(label, i18n),\n })\n\n href = formatAdminURL({\n adminRoute,\n path: `/globals/${slug}`,\n })\n\n // Find the lock status for the global\n const globalLockData = globalData.find((global) => global.slug === slug)\n if (globalLockData) {\n isLocked = globalLockData.data._isLocked\n userEditing = globalLockData.data._userEditing\n\n // Check if the lock is expired\n const lockDuration = globalLockData?.lockDuration\n const lastEditedAt = new Date(\n globalLockData.data?._lastEditedAt,\n ).getTime()\n\n const lockDurationInMilliseconds = lockDuration * 1000\n const lockExpirationTime = lastEditedAt + lockDurationInMilliseconds\n\n if (new Date().getTime() > lockExpirationTime) {\n isLocked = false\n userEditing = null\n }\n }\n }\n\n return (\n <li key={entityIndex}>\n <Card\n actions={\n isLocked && user?.id !== userEditing?.id ? (\n <Locked className={`${baseClass}__locked`} user={userEditing} />\n ) : hasCreatePermission && type === EntityType.collection ? (\n <Button\n aria-label={t('general:createNewLabel', {\n label,\n })}\n buttonStyle=\"icon-label\"\n el=\"link\"\n icon=\"plus\"\n iconStyle=\"with-border\"\n round\n to={createHREF}\n />\n ) : undefined\n }\n buttonAriaLabel={buttonAriaLabel}\n href={href}\n id={`card-${slug}`}\n title={getTranslation(label, i18n)}\n titleAs=\"h3\"\n />\n </li>\n )\n })}\n </ul>\n </div>\n )\n })\n )}\n </Fragment>\n {afterDashboard &&\n RenderServerComponent({\n Component: afterDashboard,\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n },\n })}\n </Gutter>\n </div>\n )\n}\n"],"mappings":";AAGA,SAASA,cAAc,QAAQ;AAC/B,SAASC,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAEC,MAAM,QAAQ;AAC7C,SAASC,qBAAqB,QAAQ;AACtC,SAASC,UAAU,EAAEC,cAAc,QAAQ;AAC3C,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAIhC,MAAMC,SAAA,GAAY;AAmBlB,OAAO,MAAMC,gBAAA,GAA8CC,KAAA;EACzD,MAAM;IACJC,UAAU;IACVC,IAAI;IACJA,IAAA,EAAM;MAAEC;IAAC,CAAE;IACXC,MAAM;IACNC,SAAS;IACTC,MAAM;IACNC,OAAA,EAAS;MACPC,MAAA,EAAQ;QACNC,KAAA,EAAO;UACLC,UAAA,EAAY;YAAEC,cAAc;YAAEC;UAAe;QAAE,CAChD;QACDC,MAAA,EAAQ;UAAEJ,KAAA,EAAOK;QAAU;MAAE;IAC9B,CACF;IACDP,OAAO;IACPQ,WAAW;IACXC,YAAY;IACZC;EAA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AC5B,IAAA;oBACCkE,OAAA,EACEnB,QAAA,IAAYpB,IAAA,EAAMwC,EAAA,KAAOnB,WAAA,EAAamB,EAAA,gBACpCvC,IAAA,CAAC1B,MAAA;sBAAO2B,SAAA,EAAW,GAAGrB,SAAA,UAAmB;sBAAEmB,IAAA,EAAMqB;yBAC/CF,mBAAA,IAAuBN,IAAA,KAASpC,UAAA,CAAW6C,UAAU,gBACvDrB,IAAA,CAAC7B,MAAA;sBACC,cAAYc,CAAA,CAAE,0BAA0B;wBACtCwB;sBACF;sBACA+B,WAAA,EAAY;sBACZC,EAAA,EAAG;sBACHC,IAAA,EAAK;sBACLC,SAAA,EAAU;sBACVC,KAAK;sBACLC,EAAA,EAAI7B;yBAEJ8B,SAAA;oBAEN/B,eAAA,EAAiBA,eAAA;oBACjBE,IAAA,EAAMA,IAAA;oBACNsB,EAAA,EAAI,QAAQ5B,IAAA,EAAM;oBAClBG,KAAA,EAAO5C,cAAA,CAAeuC,KAAA,EAAOzB,IAAA;oBAC7B+D,OAAA,EAAQ;;mBAvBHlC,WAAA;cA2Bb;;aAzFwCH,UAAA;QA6FhD;UAGHjB,cAAA,IACClB,qBAAA,CAAsB;QACpB4B,SAAA,EAAWV,cAAA;QACXW,SAAA,EAAWf,OAAA,CAAQe,SAAS;QAC5BC,WAAA,EAAa;UACXrB,IAAA;UACAE,MAAA;UACAE,MAAA;UACAC,OAAA;UACAQ,WAAA;UACAC,YAAA;UACAC;QACF;MACF;;;AAIV","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["getTranslation","Button","Card","Gutter","Locked","RenderServerComponent","EntityType","formatAdminURL","React","Fragment","baseClass","DefaultDashboard","props","globalData","i18n","t","locale","navGroups","params","payload","config","admin","components","afterDashboard","beforeDashboard","routes","adminRoute","permissions","searchParams","user","_jsx","className","_jsxs","Component","importMap","serverProps","length","map","entities","label","groupIndex","slug","type","entityIndex","title","buttonAriaLabel","createHREF","href","hasCreatePermission","isLocked","userEditing","collection","path","collections","create","global","globalLockData","find","data","_isLocked","_userEditing","lockDuration","lastEditedAt","Date","_lastEditedAt","getTime","lockDurationInMilliseconds","lockExpirationTime","actions","id","buttonStyle","el","icon","iconStyle","round","to","undefined","titleAs"],"sources":["../../../../src/views/Dashboard/Default/index.tsx"],"sourcesContent":["import type { groupNavItems } from '@payloadcms/ui/shared'\nimport type { ClientUser, Locale, ServerProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { Button, Card, Gutter, Locked } from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { EntityType, formatAdminURL } from '@payloadcms/ui/shared'\nimport React, { Fragment } from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'dashboard'\n\nexport type DashboardViewClientProps = {\n locale: Locale\n}\n\nexport type DashboardViewServerPropsOnly = {\n globalData: Array<{\n data: { _isLocked: boolean; _lastEditedAt: string; _userEditing: ClientUser | number | string }\n lockDuration?: number\n slug: string\n }>\n /**\n * @deprecated\n * This prop is deprecated and will be removed in the next major version.\n * Components now import their own `Link` directly from `next/link`.\n */\n Link?: React.ComponentType\n navGroups?: ReturnType<typeof groupNavItems>\n} & ServerProps\n\nexport type DashboardViewServerProps = DashboardViewClientProps & DashboardViewServerPropsOnly\n\nexport function DefaultDashboard(props: DashboardViewServerProps) {\n const {\n globalData,\n i18n,\n i18n: { t },\n locale,\n navGroups,\n params,\n payload: {\n config: {\n admin: {\n components: { afterDashboard, beforeDashboard },\n },\n routes: { admin: adminRoute },\n },\n },\n payload,\n permissions,\n searchParams,\n user,\n } = props\n\n return (\n <div className={baseClass}>\n <Gutter className={`${baseClass}__wrap`}>\n {beforeDashboard &&\n RenderServerComponent({\n Component: beforeDashboard,\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n } satisfies ServerProps,\n })}\n\n <Fragment>\n {!navGroups || navGroups?.length === 0 ? (\n <p>no nav groups....</p>\n ) : (\n navGroups.map(({ entities, label }, groupIndex) => {\n return (\n <div className={`${baseClass}__group`} key={groupIndex}>\n <h2 className={`${baseClass}__label`}>{label}</h2>\n <ul className={`${baseClass}__card-list`}>\n {entities.map(({ slug, type, label }, entityIndex) => {\n let title: string\n let buttonAriaLabel: string\n let createHREF: string\n let href: string\n let hasCreatePermission: boolean\n let isLocked = null\n let userEditing = null\n\n if (type === EntityType.collection) {\n title = getTranslation(label, i18n)\n\n buttonAriaLabel = t('general:showAllLabel', { label: title })\n\n href = formatAdminURL({ adminRoute, path: `/collections/${slug}` })\n\n createHREF = formatAdminURL({\n adminRoute,\n path: `/collections/${slug}/create`,\n })\n\n hasCreatePermission = permissions?.collections?.[slug]?.create\n }\n\n if (type === EntityType.global) {\n title = getTranslation(label, i18n)\n\n buttonAriaLabel = t('general:editLabel', {\n label: getTranslation(label, i18n),\n })\n\n href = formatAdminURL({\n adminRoute,\n path: `/globals/${slug}`,\n })\n\n // Find the lock status for the global\n const globalLockData = globalData.find((global) => global.slug === slug)\n if (globalLockData) {\n isLocked = globalLockData.data._isLocked\n userEditing = globalLockData.data._userEditing\n\n // Check if the lock is expired\n const lockDuration = globalLockData?.lockDuration\n const lastEditedAt = new Date(\n globalLockData.data?._lastEditedAt,\n ).getTime()\n\n const lockDurationInMilliseconds = lockDuration * 1000\n const lockExpirationTime = lastEditedAt + lockDurationInMilliseconds\n\n if (new Date().getTime() > lockExpirationTime) {\n isLocked = false\n userEditing = null\n }\n }\n }\n\n return (\n <li key={entityIndex}>\n <Card\n actions={\n isLocked && user?.id !== userEditing?.id ? (\n <Locked className={`${baseClass}__locked`} user={userEditing} />\n ) : hasCreatePermission && type === EntityType.collection ? (\n <Button\n aria-label={t('general:createNewLabel', {\n label,\n })}\n buttonStyle=\"icon-label\"\n el=\"link\"\n icon=\"plus\"\n iconStyle=\"with-border\"\n round\n to={createHREF}\n />\n ) : undefined\n }\n buttonAriaLabel={buttonAriaLabel}\n href={href}\n id={`card-${slug}`}\n title={getTranslation(label, i18n)}\n titleAs=\"h3\"\n />\n </li>\n )\n })}\n </ul>\n </div>\n )\n })\n )}\n </Fragment>\n {afterDashboard &&\n RenderServerComponent({\n Component: afterDashboard,\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n } satisfies ServerProps,\n })}\n </Gutter>\n </div>\n )\n}\n"],"mappings":";AAGA,SAASA,cAAc,QAAQ;AAC/B,SAASC,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAEC,MAAM,QAAQ;AAC7C,SAASC,qBAAqB,QAAQ;AACtC,SAASC,UAAU,EAAEC,cAAc,QAAQ;AAC3C,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAIhC,MAAMC,SAAA,GAAY;AAuBlB,OAAO,SAASC,iBAAiBC,KAA+B;EAC9D,MAAM;IACJC,UAAU;IACVC,IAAI;IACJA,IAAA,EAAM;MAAEC;IAAC,CAAE;IACXC,MAAM;IACNC,SAAS;IACTC,MAAM;IACNC,OAAA,EAAS;MACPC,MAAA,EAAQ;QACNC,KAAA,EAAO;UACLC,UAAA,EAAY;YAAEC,cAAc;YAAEC;UAAe;QAAE,CAChD;QACDC,MAAA,EAAQ;UAAEJ,KAAA,EAAOK;QAAU;MAAE;IAC9B,CACF;IACDP,OAAO;IACPQ,WAAW;IACXC,YAAY;IACZC;EAAI,CACL,GAAGjB,KAAA;EAEJ,oBACEkB,IAAA,CAAC;IAAIC,SAAA,EAAWrB,SAAA;cACd,aAAAsB,KAAA,CAAC7B,MAAA;MAAO4B,SAAA,EAAW,GAAGrB,SAAA,QAAiB;iBACpCc,eAAA,IACCnB,qBAAA,CAAsB;QACpB4B,SAAA,EAAWT,eAAA;QACXU,SAAA,EAAWf,OAAA,CAAQe,SAAS;QAC5BC,WAAA,EAAa;UACXrB,IAAA;UACAE,MAAA;UACAE,MAAA;UACAC,OAAA;UACAQ,WAAA;UACAC,YAAA;UACAC;QACF;MACF,I,aAEFC,IAAA,CAACrB,QA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sBACLC,SAAA,EAAU;sBACVC,KAAK;sBACLC,EAAA,EAAI7B;yBAEJ8B,SAAA;oBAEN/B,eAAA,EAAiBA,eAAA;oBACjBE,IAAA,EAAMA,IAAA;oBACNsB,EAAA,EAAI,QAAQ5B,IAAA,EAAM;oBAClBG,KAAA,EAAO5C,cAAA,CAAeuC,KAAA,EAAOzB,IAAA;oBAC7B+D,OAAA,EAAQ;;mBAvBHlC,WAAA;cA2Bb;;aAzFwCH,UAAA;QA6FhD;UAGHjB,cAAA,IACClB,qBAAA,CAAsB;QACpB4B,SAAA,EAAWV,cAAA;QACXW,SAAA,EAAWf,OAAA,CAAQe,SAAS;QAC5BC,WAAA,EAAa;UACXrB,IAAA;UACAE,MAAA;UACAE,MAAA;UACAC,OAAA;UACAQ,WAAA;UACAC,YAAA;UACAC;QACF;MACF;;;AAIV","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AdminViewServerProps } from 'payload';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export { generateDashboardMetadata } from './meta.js';
|
|
4
|
-
export declare
|
|
4
|
+
export declare function Dashboard({ initPageResult, params, searchParams }: AdminViewServerProps): Promise<React.JSX.Element>;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Dashboard/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Dashboard/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAKnD,OAAO,KAAmB,MAAM,OAAO,CAAA;AAMvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAA;AAErD,wBAAsB,SAAS,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,oBAAoB,8BAiH7F"}
|
|
@@ -5,11 +5,11 @@ import { EntityType, groupNavItems } from '@payloadcms/ui/shared';
|
|
|
5
5
|
import React, { Fragment } from 'react';
|
|
6
6
|
import { DefaultDashboard } from './Default/index.js';
|
|
7
7
|
export { generateDashboardMetadata } from './meta.js';
|
|
8
|
-
export
|
|
8
|
+
export async function Dashboard({
|
|
9
9
|
initPageResult,
|
|
10
10
|
params,
|
|
11
11
|
searchParams
|
|
12
|
-
})
|
|
12
|
+
}) {
|
|
13
13
|
const {
|
|
14
14
|
locale,
|
|
15
15
|
permissions,
|
|
@@ -96,5 +96,5 @@ export const Dashboard = async ({
|
|
|
96
96
|
}
|
|
97
97
|
})]
|
|
98
98
|
});
|
|
99
|
-
}
|
|
99
|
+
}
|
|
100
100
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["HydrateAuthProvider","SetStepNav","RenderServerComponent","EntityType","groupNavItems","React","Fragment","DefaultDashboard","generateDashboardMetadata","Dashboard","initPageResult","params","searchParams","locale","permissions","req","i18n","payload","config","user","visibleEntities","collections","filter","collection","slug","read","includes","globals","global","globalData","length","lockedDocuments","find","depth","overrideAccess","pagination","where","globalSlug","exists","map","lockDurationDefault","lockDuration","lockDocuments","duration","lockedDoc","docs","doc","data","_isLocked","_lastEditedAt","updatedAt","_userEditing","value","navGroups","entityToGroup","type","entity","_jsxs","_jsx","nav","clientProps","Component","admin","components","views","dashboard","Fallback","importMap","serverProps"],"sources":["../../../src/views/Dashboard/index.tsx"],"sourcesContent":["import type { EntityToGroup } from '@payloadcms/ui/shared'\nimport type {
|
|
1
|
+
{"version":3,"file":"index.js","names":["HydrateAuthProvider","SetStepNav","RenderServerComponent","EntityType","groupNavItems","React","Fragment","DefaultDashboard","generateDashboardMetadata","Dashboard","initPageResult","params","searchParams","locale","permissions","req","i18n","payload","config","user","visibleEntities","collections","filter","collection","slug","read","includes","globals","global","globalData","length","lockedDocuments","find","depth","overrideAccess","pagination","where","globalSlug","exists","map","lockDurationDefault","lockDuration","lockDocuments","duration","lockedDoc","docs","doc","data","_isLocked","_lastEditedAt","updatedAt","_userEditing","value","navGroups","entityToGroup","type","entity","_jsxs","_jsx","nav","clientProps","Component","admin","components","views","dashboard","Fallback","importMap","serverProps"],"sources":["../../../src/views/Dashboard/index.tsx"],"sourcesContent":["import type { EntityToGroup } from '@payloadcms/ui/shared'\nimport type { AdminViewServerProps } from 'payload'\n\nimport { HydrateAuthProvider, SetStepNav } from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { EntityType, groupNavItems } from '@payloadcms/ui/shared'\nimport React, { Fragment } from 'react'\n\nimport type { DashboardViewClientProps, DashboardViewServerPropsOnly } from './Default/index.js'\n\nimport { DefaultDashboard } from './Default/index.js'\n\nexport { generateDashboardMetadata } from './meta.js'\n\nexport async function Dashboard({ initPageResult, params, searchParams }: AdminViewServerProps) {\n const {\n locale,\n permissions,\n req: {\n i18n,\n payload: { config },\n payload,\n user,\n },\n req,\n visibleEntities,\n } = initPageResult\n\n const collections = config.collections.filter(\n (collection) =>\n permissions?.collections?.[collection.slug]?.read &&\n visibleEntities.collections.includes(collection.slug),\n )\n\n const globals = config.globals.filter(\n (global) =>\n permissions?.globals?.[global.slug]?.read && visibleEntities.globals.includes(global.slug),\n )\n\n // Query locked global documents only if there are globals in the config\n let globalData = []\n\n if (config.globals.length > 0) {\n const lockedDocuments = await payload.find({\n collection: 'payload-locked-documents',\n depth: 1,\n overrideAccess: false,\n pagination: false,\n req,\n where: {\n globalSlug: {\n exists: true,\n },\n },\n })\n\n // Map over globals to include `lockDuration` and lock data for each global slug\n globalData = config.globals.map((global) => {\n const lockDurationDefault = 300\n const lockDuration =\n typeof global.lockDocuments === 'object'\n ? global.lockDocuments.duration\n : lockDurationDefault\n\n const lockedDoc = lockedDocuments.docs.find((doc) => doc.globalSlug === global.slug)\n\n return {\n slug: global.slug,\n data: {\n _isLocked: !!lockedDoc,\n _lastEditedAt: lockedDoc?.updatedAt ?? null,\n _userEditing: lockedDoc?.user?.value ?? null,\n },\n lockDuration,\n }\n })\n }\n\n const navGroups = groupNavItems(\n [\n ...(collections.map((collection) => {\n const entityToGroup: EntityToGroup = {\n type: EntityType.collection,\n entity: collection,\n }\n\n return entityToGroup\n }) ?? []),\n ...(globals.map((global) => {\n const entityToGroup: EntityToGroup = {\n type: EntityType.global,\n entity: global,\n }\n\n return entityToGroup\n }) ?? []),\n ],\n permissions,\n i18n,\n )\n\n return (\n <Fragment>\n <HydrateAuthProvider permissions={permissions} />\n <SetStepNav nav={[]} />\n {RenderServerComponent({\n clientProps: {\n locale,\n } satisfies DashboardViewClientProps,\n Component: config.admin?.components?.views?.dashboard?.Component,\n Fallback: DefaultDashboard,\n importMap: payload.importMap,\n serverProps: {\n globalData,\n i18n,\n locale,\n navGroups,\n params,\n payload,\n permissions,\n searchParams,\n user,\n visibleEntities,\n } satisfies DashboardViewServerPropsOnly,\n })}\n </Fragment>\n )\n}\n"],"mappings":";AAGA,SAASA,mBAAmB,EAAEC,UAAU,QAAQ;AAChD,SAASC,qBAAqB,QAAQ;AACtC,SAASC,UAAU,EAAEC,aAAa,QAAQ;AAC1C,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAIhC,SAASC,gBAAgB,QAAQ;AAEjC,SAASC,yBAAyB,QAAQ;AAE1C,OAAO,eAAeC,UAAU;EAAEC,cAAc;EAAEC,MAAM;EAAEC;AAAY,CAAwB;EAC5F,MAAM;IACJC,MAAM;IACNC,WAAW;IACXC,GAAA,EAAK;MACHC,IAAI;MACJC,OAAA,EAAS;QAAEC;MAAM,CAAE;MACnBD,OAAO;MACPE;IAAI,CACL;IACDJ,GAAG;IACHK;EAAe,CAChB,GAAGV,cAAA;EAEJ,MAAMW,WAAA,GAAcH,MAAA,CAAOG,WAAW,CAACC,MAAM,CAC1CC,UAAA,IACCT,WAAA,EAAaO,WAAA,GAAcE,UAAA,C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AAYjD,aAAA,CAChB,C,IACMiB,WAAA,CAAYkB,GAAG,CAAEhB,UAAA;IACnB,MAAM+B,aAAA,GAA+B;MACnCC,IAAA,EAAMpD,UAAA,CAAWoB,UAAU;MAC3BiC,MAAA,EAAQjC;IACV;IAEA,OAAO+B,aAAA;EACT,MAAM,EAAE,G,IACJ3B,OAAA,CAAQY,GAAG,CAAEX,MAAA;IACf,MAAM0B,aAAA,GAA+B;MACnCC,IAAA,EAAMpD,UAAA,CAAWyB,MAAM;MACvB4B,MAAA,EAAQ5B;IACV;IAEA,OAAO0B,aAAA;EACT,MAAM,EAAE,EACT,EACDxC,WAAA,EACAE,IAAA;EAGF,oBACEyC,KAAA,CAACnD,QAAA;4BACCoD,IAAA,CAAC1D,mBAAA;MAAoBc,WAAA,EAAaA;qBAClC4C,IAAA,CAACzD,UAAA;MAAW0D,GAAA,EAAK;QAChBzD,qBAAA,CAAsB;MACrB0D,WAAA,EAAa;QACX/C;MACF;MACAgD,SAAA,EAAW3C,MAAA,CAAO4C,KAAK,EAAEC,UAAA,EAAYC,KAAA,EAAOC,SAAA,EAAWJ,SAAA;MACvDK,QAAA,EAAU3D,gBAAA;MACV4D,SAAA,EAAWlD,OAAA,CAAQkD,SAAS;MAC5BC,WAAA,EAAa;QACXvC,UAAA;QACAb,IAAA;QACAH,MAAA;QACAwC,SAAA;QACA1C,MAAA;QACAM,OAAA;QACAH,WAAA;QACAF,YAAA;QACAO,IAAA;QACAC;MACF;IACF;;AAGN","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AdminViewServerProps, DocumentViewServerProps, PayloadComponent, SanitizedCollectionConfig, SanitizedCollectionPermission, SanitizedConfig, SanitizedGlobalConfig, SanitizedGlobalPermission } from 'payload';
|
|
2
2
|
import type React from 'react';
|
|
3
3
|
export type ViewFromConfig<TProps extends object> = {
|
|
4
4
|
Component?: React.FC<TProps>;
|
|
@@ -16,12 +16,12 @@ export declare const getViewsFromConfig: ({ collectionConfig, config, docPermiss
|
|
|
16
16
|
docPermissions?: never;
|
|
17
17
|
overrideDocPermissions: true;
|
|
18
18
|
})) => {
|
|
19
|
-
CustomView: ViewFromConfig<
|
|
20
|
-
DefaultView: ViewFromConfig<
|
|
19
|
+
CustomView: ViewFromConfig<DocumentViewServerProps>;
|
|
20
|
+
DefaultView: ViewFromConfig<DocumentViewServerProps>;
|
|
21
21
|
/**
|
|
22
22
|
* The error view to display if CustomView or DefaultView do not exist (could be either due to not found, or unauthorized). Can be null
|
|
23
23
|
*/
|
|
24
|
-
ErrorView: ViewFromConfig<
|
|
24
|
+
ErrorView: ViewFromConfig<AdminViewServerProps>;
|
|
25
25
|
viewKey: string;
|
|
26
26
|
} | null;
|
|
27
27
|
//# sourceMappingURL=getViewsFromConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getViewsFromConfig.d.ts","sourceRoot":"","sources":["../../../src/views/Document/getViewsFromConfig.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"getViewsFromConfig.d.ts","sourceRoot":"","sources":["../../../src/views/Document/getViewsFromConfig.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,uBAAuB,EACvB,gBAAgB,EAChB,yBAAyB,EACzB,6BAA6B,EAC7B,eAAe,EACf,qBAAqB,EACrB,yBAAyB,EAC1B,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAW9B,MAAM,MAAM,cAAc,CAAC,MAAM,SAAS,MAAM,IAAI;IAClD,SAAS,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,CAAA;IAC5B,eAAe,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;CAC3C,CAAA;AAED,eAAO,MAAM,kBAAkB,uGAO5B;IACD,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C,MAAM,EAAE,eAAe,CAAA;IACvB,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,aAAa,EAAE,MAAM,EAAE,CAAA;CACxB,GAAG,CACA;IACE,cAAc,EAAE,6BAA6B,GAAG,yBAAyB,CAAA;IACzE,sBAAsB,CAAC,EAAE,KAAK,GAAG,SAAS,CAAA;CAC3C,GACD;IACE,cAAc,CAAC,EAAE,KAAK,CAAA;IACtB,sBAAsB,EAAE,IAAI,CAAA;CAC7B,CACJ,KAAG;IACF,UAAU,EAAE,cAAc,CAAC,uBAAuB,CAAC,CAAA;IACnD,WAAW,EAAE,cAAc,CAAC,uBAAuB,CAAC,CAAA;IACpD;;OAEG;IACH,SAAS,EAAE,cAAc,CAAC,oBAAoB,CAAC,CAAA;IAC/C,OAAO,EAAE,MAAM,CAAA;CAChB,GAAG,IAsXH,CAAA"}
|