@payloadcms/next 3.55.0-internal.ce8fe55 → 3.55.0-internal.df60e35
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/TabLink.js +41 -19
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
- package/dist/elements/Nav/index.client.js +48 -28
- package/dist/elements/Nav/index.client.js.map +1 -1
- package/dist/prod/styles.css +1 -1
- package/dist/utilities/handleServerFunctions.d.ts.map +1 -1
- package/dist/utilities/handleServerFunctions.js +3 -9
- package/dist/utilities/handleServerFunctions.js.map +1 -1
- package/dist/views/CreateFirstUser/index.d.ts.map +1 -1
- package/dist/views/CreateFirstUser/index.js +16 -11
- package/dist/views/CreateFirstUser/index.js.map +1 -1
- package/dist/views/Logout/LogoutClient.js +31 -29
- package/dist/views/Logout/LogoutClient.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js +28 -12
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js +27 -17
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js +31 -21
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +33 -23
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +30 -21
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
- package/dist/views/Version/SelectComparison/VersionDrawer/CreatedAtCell.js +50 -16
- package/dist/views/Version/SelectComparison/VersionDrawer/CreatedAtCell.js.map +1 -1
- package/dist/views/Version/SelectComparison/VersionDrawer/index.js +12 -8
- package/dist/views/Version/SelectComparison/VersionDrawer/index.js.map +1 -1
- package/dist/views/Versions/cells/AutosaveCell/index.d.ts +1 -0
- package/dist/views/Versions/cells/AutosaveCell/index.d.ts.map +1 -1
- package/dist/views/Versions/cells/AutosaveCell/index.js +23 -14
- package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
- package/dist/views/Versions/cells/CreatedAt/index.js +53 -27
- package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleServerFunctions.d.ts","sourceRoot":"","sources":["../../src/utilities/handleServerFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,qBAAqB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"handleServerFunctions.d.ts","sourceRoot":"","sources":["../../src/utilities/handleServerFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAwBpE,eAAO,MAAM,qBAAqB,EAAE,qBAsBnC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { copyDataFromLocaleHandler } from '@payloadcms/ui/rsc';
|
|
2
2
|
import { buildFormStateHandler } from '@payloadcms/ui/utilities/buildFormState';
|
|
3
3
|
import { buildTableStateHandler } from '@payloadcms/ui/utilities/buildTableState';
|
|
4
4
|
import { getFolderResultsComponentAndDataHandler } from '@payloadcms/ui/utilities/getFolderResultsComponentAndData';
|
|
@@ -7,13 +7,12 @@ import { renderDocumentHandler } from '../views/Document/handleServerFunction.js
|
|
|
7
7
|
import { renderDocumentSlotsHandler } from '../views/Document/renderDocumentSlots.js';
|
|
8
8
|
import { renderListHandler } from '../views/List/handleServerFunction.js';
|
|
9
9
|
import { initReq } from './initReq.js';
|
|
10
|
-
const
|
|
10
|
+
const serverFunctions = {
|
|
11
11
|
'copy-data-from-locale': copyDataFromLocaleHandler,
|
|
12
12
|
'form-state': buildFormStateHandler,
|
|
13
13
|
'get-folder-results-component-and-data': getFolderResultsComponentAndDataHandler,
|
|
14
14
|
'render-document': renderDocumentHandler,
|
|
15
15
|
'render-document-slots': renderDocumentSlotsHandler,
|
|
16
|
-
'render-field': _internal_renderFieldHandler,
|
|
17
16
|
'render-list': renderListHandler,
|
|
18
17
|
'schedule-publish': schedulePublishHandler,
|
|
19
18
|
'table-state': buildTableStateHandler
|
|
@@ -23,8 +22,7 @@ export const handleServerFunctions = async args => {
|
|
|
23
22
|
name: fnKey,
|
|
24
23
|
args: fnArgs,
|
|
25
24
|
config: configPromise,
|
|
26
|
-
importMap
|
|
27
|
-
serverFunctions: extraServerFunctions
|
|
25
|
+
importMap
|
|
28
26
|
} = args;
|
|
29
27
|
const {
|
|
30
28
|
req
|
|
@@ -38,10 +36,6 @@ export const handleServerFunctions = async args => {
|
|
|
38
36
|
importMap,
|
|
39
37
|
req
|
|
40
38
|
};
|
|
41
|
-
const serverFunctions = {
|
|
42
|
-
...baseServerFunctions,
|
|
43
|
-
...(extraServerFunctions || {})
|
|
44
|
-
};
|
|
45
39
|
const fn = serverFunctions[fnKey];
|
|
46
40
|
if (!fn) {
|
|
47
41
|
throw new Error(`Unknown Server Function: ${fnKey}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleServerFunctions.js","names":["
|
|
1
|
+
{"version":3,"file":"handleServerFunctions.js","names":["copyDataFromLocaleHandler","buildFormStateHandler","buildTableStateHandler","getFolderResultsComponentAndDataHandler","schedulePublishHandler","renderDocumentHandler","renderDocumentSlotsHandler","renderListHandler","initReq","serverFunctions","handleServerFunctions","args","name","fnKey","fnArgs","config","configPromise","importMap","req","key","augmentedArgs","fn","Error"],"sources":["../../src/utilities/handleServerFunctions.ts"],"sourcesContent":["import type { ServerFunction, ServerFunctionHandler } from 'payload'\n\nimport { copyDataFromLocaleHandler } from '@payloadcms/ui/rsc'\nimport { buildFormStateHandler } from '@payloadcms/ui/utilities/buildFormState'\nimport { buildTableStateHandler } from '@payloadcms/ui/utilities/buildTableState'\nimport { getFolderResultsComponentAndDataHandler } from '@payloadcms/ui/utilities/getFolderResultsComponentAndData'\nimport { schedulePublishHandler } from '@payloadcms/ui/utilities/schedulePublishHandler'\n\nimport { renderDocumentHandler } from '../views/Document/handleServerFunction.js'\nimport { renderDocumentSlotsHandler } from '../views/Document/renderDocumentSlots.js'\nimport { renderListHandler } from '../views/List/handleServerFunction.js'\nimport { initReq } from './initReq.js'\n\nconst serverFunctions: Record<string, ServerFunction> = {\n 'copy-data-from-locale': copyDataFromLocaleHandler,\n 'form-state': buildFormStateHandler,\n 'get-folder-results-component-and-data': getFolderResultsComponentAndDataHandler,\n 'render-document': renderDocumentHandler,\n 'render-document-slots': renderDocumentSlotsHandler,\n 'render-list': renderListHandler,\n 'schedule-publish': schedulePublishHandler,\n 'table-state': buildTableStateHandler,\n}\n\nexport const handleServerFunctions: ServerFunctionHandler = async (args) => {\n const { name: fnKey, args: fnArgs, config: configPromise, importMap } = args\n\n const { req } = await initReq({\n configPromise,\n importMap,\n key: 'RootLayout',\n })\n\n const augmentedArgs: Parameters<ServerFunction>[0] = {\n ...fnArgs,\n importMap,\n req,\n }\n\n const fn = serverFunctions[fnKey]\n\n if (!fn) {\n throw new Error(`Unknown Server Function: ${fnKey}`)\n }\n\n return fn(augmentedArgs)\n}\n"],"mappings":"AAEA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,qBAAqB,QAAQ;AACtC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,uCAAuC,QAAQ;AACxD,SAASC,sBAAsB,QAAQ;AAEvC,SAASC,qBAAqB,QAAQ;AACtC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,iBAAiB,QAAQ;AAClC,SAASC,OAAO,QAAQ;AAExB,MAAMC,eAAA,GAAkD;EACtD,yBAAyBT,yBAAA;EACzB,cAAcC,qBAAA;EACd,yCAAyCE,uCAAA;EACzC,mBAAmBE,qBAAA;EACnB,yBAAyBC,0BAAA;EACzB,eAAeC,iBAAA;EACf,oBAAoBH,sBAAA;EACpB,eAAeF;AACjB;AAEA,OAAO,MAAMQ,qBAAA,GAA+C,MAAOC,IAAA;EACjE,MAAM;IAAEC,IAAA,EAAMC,KAAK;IAAEF,IAAA,EAAMG,MAAM;IAAEC,MAAA,EAAQC,aAAa;IAAEC;EAAS,CAAE,GAAGN,IAAA;EAExE,MAAM;IAAEO;EAAG,CAAE,GAAG,MAAMV,OAAA,CAAQ;IAC5BQ,aAAA;IACAC,SAAA;IACAE,GAAA,EAAK;EACP;EAEA,MAAMC,aAAA,GAA+C;IACnD,GAAGN,MAAM;IACTG,SAAA;IACAC;EACF;EAEA,MAAMG,EAAA,GAAKZ,eAAe,CAACI,KAAA,CAAM;EAEjC,IAAI,CAACQ,EAAA,EAAI;IACP,MAAM,IAAIC,KAAA,CAAM,4BAA4BT,KAAA,EAAO;EACrD;EAEA,OAAOQ,EAAA,CAAGD,aAAA;AACZ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/CreateFirstUser/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/CreateFirstUser/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAGrB,MAAM,SAAS,CAAA;AAGhB,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,cAAc,CAAA;AAErB,wBAAsB,mBAAmB,CAAC,EAAE,cAAc,EAAE,EAAE,oBAAoB,8BA6EjF"}
|
|
@@ -3,7 +3,6 @@ import { buildFormState } from '@payloadcms/ui/utilities/buildFormState';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { getDocPreferences } from '../Document/getDocPreferences.js';
|
|
5
5
|
import { getDocumentData } from '../Document/getDocumentData.js';
|
|
6
|
-
import { getDocumentPermissions } from '../Document/getDocumentPermissions.js';
|
|
7
6
|
import { CreateFirstUserClient } from './index.client.js';
|
|
8
7
|
export async function CreateFirstUserView({
|
|
9
8
|
initPageResult
|
|
@@ -41,21 +40,27 @@ export async function CreateFirstUserView({
|
|
|
41
40
|
payload: req.payload,
|
|
42
41
|
user: req.user
|
|
43
42
|
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
const baseFields = Object.fromEntries(collectionConfig.fields.filter(f => 'name' in f && typeof f.name === 'string').map(f => [f.name, {
|
|
44
|
+
create: true,
|
|
45
|
+
read: true,
|
|
46
|
+
update: true
|
|
47
|
+
}]));
|
|
48
|
+
// In create-first-user we should always allow all fields
|
|
49
|
+
const docPermissionsForForm = {
|
|
50
|
+
create: true,
|
|
51
|
+
delete: true,
|
|
52
|
+
fields: baseFields,
|
|
53
|
+
read: true,
|
|
54
|
+
readVersions: true,
|
|
55
|
+
update: true
|
|
56
|
+
};
|
|
52
57
|
// Build initial form state from data
|
|
53
58
|
const {
|
|
54
59
|
state: formState
|
|
55
60
|
} = await buildFormState({
|
|
56
61
|
collectionSlug: collectionConfig.slug,
|
|
57
62
|
data,
|
|
58
|
-
docPermissions,
|
|
63
|
+
docPermissions: docPermissionsForForm,
|
|
59
64
|
docPreferences,
|
|
60
65
|
locale: locale?.code,
|
|
61
66
|
operation: 'create',
|
|
@@ -71,7 +76,7 @@ export async function CreateFirstUserView({
|
|
|
71
76
|
}), /*#__PURE__*/_jsx("p", {
|
|
72
77
|
children: req.t('authentication:beginCreateFirstUser')
|
|
73
78
|
}), /*#__PURE__*/_jsx(CreateFirstUserClient, {
|
|
74
|
-
docPermissions:
|
|
79
|
+
docPermissions: docPermissionsForForm,
|
|
75
80
|
docPreferences: docPreferences,
|
|
76
81
|
initialState: formState,
|
|
77
82
|
loginWithUsername: loginWithUsername,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["buildFormState","React","getDocPreferences","getDocumentData","
|
|
1
|
+
{"version":3,"file":"index.js","names":["buildFormState","React","getDocPreferences","getDocumentData","CreateFirstUserClient","CreateFirstUserView","initPageResult","locale","req","payload","collections","config","admin","user","userSlug","collectionConfig","auth","authOptions","loginWithUsername","data","collectionSlug","slug","docPreferences","baseFields","Object","fromEntries","fields","filter","f","name","map","create","read","update","docPermissionsForForm","delete","readVersions","state","formState","docPermissions","code","operation","renderAllFields","schemaPath","skipValidation","_jsxs","className","_jsx","t","initialState"],"sources":["../../../src/views/CreateFirstUser/index.tsx"],"sourcesContent":["import type {\n AdminViewServerProps,\n SanitizedDocumentPermissions,\n SanitizedFieldsPermissions,\n} 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 { CreateFirstUserClient } from './index.client.js'\nimport './index.scss'\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 const baseFields: SanitizedFieldsPermissions = Object.fromEntries(\n collectionConfig.fields\n .filter((f): f is { name: string } & typeof f => 'name' in f && typeof f.name === 'string')\n .map((f) => [f.name, { create: true, read: true, update: true }]),\n )\n\n // In create-first-user we should always allow all fields\n const docPermissionsForForm: SanitizedDocumentPermissions = {\n create: true,\n delete: true,\n fields: baseFields,\n read: true,\n readVersions: true,\n update: true,\n }\n\n // Build initial form state from data\n const { state: formState } = await buildFormState({\n collectionSlug: collectionConfig.slug,\n data,\n docPermissions: docPermissionsForForm,\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={docPermissionsForForm}\n docPreferences={docPreferences}\n initialState={formState}\n loginWithUsername={loginWithUsername}\n userSlug={userSlug}\n />\n </div>\n )\n}\n"],"mappings":";AAMA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAElB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,eAAe,QAAQ;AAChC,SAASC,qBAAqB,QAAQ;AAGtC,OAAO,eAAeC,oBAAoB;EAAEC;AAAc,CAAwB;EAChF,MAAM;IACJC,MAAM;IACNC,GAAG;IACHA,GAAA,EAAK;MACHC,OAAA,EAAS;QACPC,WAAW;QACXC,MAAA,EAAQ;UACNC,KAAA,EAAO;YAAEC,IAAA,EAAMC;UAAQ;QAAE;MAC1B;IACF;EACF,CACF,GAAGR,cAAA;EAEJ,MAAMS,gBAAA,GAAmBL,WAAA,GAAcI,QAAA,CAAS,EAAEH,MAAA;EAClD,MAAM;IAAEK,IAAA,EAAMC;EAAW,CAAE,GAAGF,gBAAA;EAC9B,MAAMG,iBAAA,GAAoBD,WAAA,CAAYC,iBAAiB;EAEvD;EACA,MAAMC,IAAA,GAAO,MAAMhB,eAAA,CAAgB;IACjCiB,cAAA,EAAgBL,gBAAA,CAAiBM,IAAI;IACrCd,MAAA;IACAE,OAAA,EAASD,GAAA,CAAIC,OAAO;IACpBD,GAAA;IACAK,IAAA,EAAML,GAAA,CAAIK;EACZ;EAEA;EACA,MAAMS,cAAA,GAAiB,MAAMpB,iBAAA,CAAkB;IAC7CkB,cAAA,EAAgBL,gB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List":[]}
|
|
@@ -32,29 +32,31 @@ export const LogoutClient = props => {
|
|
|
32
32
|
startRouteTransition
|
|
33
33
|
} = useRouteTransition();
|
|
34
34
|
user?.id;
|
|
35
|
-
const isLoggedIn = Boolean(user?.id);
|
|
36
|
-
const navigatingToLoginRef = React.useRef(false);
|
|
37
35
|
let t0;
|
|
36
|
+
t0 = Boolean(user?.id);
|
|
37
|
+
const isLoggedIn = t0;
|
|
38
|
+
const navigatingToLoginRef = React.useRef(false);
|
|
39
|
+
let t1;
|
|
38
40
|
if ($[0] !== adminRoute || $[1] !== inactivity || $[2] !== redirect) {
|
|
39
|
-
|
|
41
|
+
t1 = () => formatAdminURL({
|
|
40
42
|
adminRoute,
|
|
41
43
|
path: `/login${inactivity && redirect && redirect.length > 0 ? `?redirect=${encodeURIComponent(redirect)}` : ""}`
|
|
42
44
|
});
|
|
43
45
|
$[0] = adminRoute;
|
|
44
46
|
$[1] = inactivity;
|
|
45
47
|
$[2] = redirect;
|
|
46
|
-
$[3] =
|
|
48
|
+
$[3] = t1;
|
|
47
49
|
} else {
|
|
48
|
-
|
|
50
|
+
t1 = $[3];
|
|
49
51
|
}
|
|
50
|
-
const [loginRoute] = React.useState(
|
|
52
|
+
const [loginRoute] = React.useState(t1);
|
|
51
53
|
const {
|
|
52
54
|
t
|
|
53
55
|
} = useTranslation();
|
|
54
56
|
const router = useRouter();
|
|
55
|
-
let
|
|
57
|
+
let t2;
|
|
56
58
|
if ($[4] !== inactivity || $[5] !== logOut || $[6] !== loginRoute || $[7] !== router || $[8] !== startRouteTransition || $[9] !== t) {
|
|
57
|
-
|
|
59
|
+
t2 = async () => {
|
|
58
60
|
if (!inactivity && !navigatingToLoginRef.current) {
|
|
59
61
|
navigatingToLoginRef.current = true;
|
|
60
62
|
await logOut();
|
|
@@ -69,15 +71,15 @@ export const LogoutClient = props => {
|
|
|
69
71
|
$[7] = router;
|
|
70
72
|
$[8] = startRouteTransition;
|
|
71
73
|
$[9] = t;
|
|
72
|
-
$[10] =
|
|
74
|
+
$[10] = t2;
|
|
73
75
|
} else {
|
|
74
|
-
|
|
76
|
+
t2 = $[10];
|
|
75
77
|
}
|
|
76
|
-
const handleLogOut =
|
|
77
|
-
let t2;
|
|
78
|
+
const handleLogOut = t2;
|
|
78
79
|
let t3;
|
|
80
|
+
let t4;
|
|
79
81
|
if ($[11] !== handleLogOut || $[12] !== isLoggedIn || $[13] !== loginRoute || $[14] !== router || $[15] !== startRouteTransition) {
|
|
80
|
-
|
|
82
|
+
t3 = () => {
|
|
81
83
|
if (isLoggedIn) {
|
|
82
84
|
handleLogOut();
|
|
83
85
|
} else {
|
|
@@ -87,23 +89,23 @@ export const LogoutClient = props => {
|
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
91
|
};
|
|
90
|
-
|
|
92
|
+
t4 = [handleLogOut, isLoggedIn, loginRoute, router, startRouteTransition];
|
|
91
93
|
$[11] = handleLogOut;
|
|
92
94
|
$[12] = isLoggedIn;
|
|
93
95
|
$[13] = loginRoute;
|
|
94
96
|
$[14] = router;
|
|
95
97
|
$[15] = startRouteTransition;
|
|
96
|
-
$[16] =
|
|
97
|
-
$[17] =
|
|
98
|
+
$[16] = t3;
|
|
99
|
+
$[17] = t4;
|
|
98
100
|
} else {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
t3 = $[16];
|
|
102
|
+
t4 = $[17];
|
|
101
103
|
}
|
|
102
|
-
useEffect(
|
|
104
|
+
useEffect(t3, t4);
|
|
103
105
|
if (!isLoggedIn && inactivity) {
|
|
104
|
-
let
|
|
106
|
+
let t5;
|
|
105
107
|
if ($[18] !== loginRoute || $[19] !== t) {
|
|
106
|
-
|
|
108
|
+
t5 = _jsxs("div", {
|
|
107
109
|
className: `${baseClass}__wrap`,
|
|
108
110
|
children: [_jsx("h2", {
|
|
109
111
|
children: t("authentication:loggedOutInactivity")
|
|
@@ -117,23 +119,23 @@ export const LogoutClient = props => {
|
|
|
117
119
|
});
|
|
118
120
|
$[18] = loginRoute;
|
|
119
121
|
$[19] = t;
|
|
120
|
-
$[20] =
|
|
122
|
+
$[20] = t5;
|
|
121
123
|
} else {
|
|
122
|
-
|
|
124
|
+
t5 = $[20];
|
|
123
125
|
}
|
|
124
|
-
return
|
|
126
|
+
return t5;
|
|
125
127
|
}
|
|
126
|
-
let
|
|
128
|
+
let t5;
|
|
127
129
|
if ($[21] !== t) {
|
|
128
|
-
|
|
130
|
+
t5 = _jsx(LoadingOverlay, {
|
|
129
131
|
animationDuration: "0ms",
|
|
130
132
|
loadingText: t("authentication:loggingOut")
|
|
131
133
|
});
|
|
132
134
|
$[21] = t;
|
|
133
|
-
$[22] =
|
|
135
|
+
$[22] = t5;
|
|
134
136
|
} else {
|
|
135
|
-
|
|
137
|
+
t5 = $[22];
|
|
136
138
|
}
|
|
137
|
-
return
|
|
139
|
+
return t5;
|
|
138
140
|
};
|
|
139
141
|
//# sourceMappingURL=LogoutClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogoutClient.js","names":["c","_c","Button","LoadingOverlay","toast","useAuth","useRouteTransition","useTranslation","useRouter","formatAdminURL","React","useEffect","baseClass","LogoutClient","props","$","adminRoute","inactivity","redirect","logOut","user","startRouteTransition","id","
|
|
1
|
+
{"version":3,"file":"LogoutClient.js","names":["c","_c","Button","LoadingOverlay","toast","useAuth","useRouteTransition","useTranslation","useRouter","formatAdminURL","React","useEffect","baseClass","LogoutClient","props","$","adminRoute","inactivity","redirect","logOut","user","startRouteTransition","id","t0","Boolean","isLoggedIn","navigatingToLoginRef","useRef","t1","path","length","encodeURIComponent","loginRoute","useState","t","router","t2","current","success","push","handleLogOut","t3","t4","t5","_jsxs","className","children","_jsx","buttonStyle","el","size","url","animationDuration","loadingText"],"sources":["../../../src/views/Logout/LogoutClient.tsx"],"sourcesContent":["'use client'\nimport {\n Button,\n LoadingOverlay,\n toast,\n useAuth,\n useRouteTransition,\n useTranslation,\n} from '@payloadcms/ui'\nimport { useRouter } from 'next/navigation.js'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { useEffect } from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'logout'\n\n/**\n * This component should **just** be the inactivity route and do nothing with logging the user out.\n *\n * It currently handles too much, the auth provider should just log the user out and then\n * we could remove the useEffect in this file. So instead of the logout button\n * being an anchor link, it should be a button that calls `logOut` in the provider.\n *\n * This view is still useful if cookies attempt to refresh and fail, i.e. the user\n * is logged out due to inactivity.\n */\nexport const LogoutClient: React.FC<{\n adminRoute: string\n inactivity?: boolean\n redirect: string\n}> = (props) => {\n const { adminRoute, inactivity, redirect } = props\n\n const { logOut, user } = useAuth()\n\n const { startRouteTransition } = useRouteTransition()\n\n const isLoggedIn = React.useMemo(() => {\n return Boolean(user?.id)\n }, [user?.id])\n\n const navigatingToLoginRef = React.useRef(false)\n\n const [loginRoute] = React.useState(() =>\n formatAdminURL({\n adminRoute,\n path: `/login${\n inactivity && redirect && redirect.length > 0\n ? `?redirect=${encodeURIComponent(redirect)}`\n : ''\n }`,\n }),\n )\n\n const { t } = useTranslation()\n const router = useRouter()\n\n const handleLogOut = React.useCallback(async () => {\n if (!inactivity && !navigatingToLoginRef.current) {\n navigatingToLoginRef.current = true\n await logOut()\n toast.success(t('authentication:loggedOutSuccessfully'))\n startRouteTransition(() => router.push(loginRoute))\n return\n }\n }, [inactivity, logOut, loginRoute, router, startRouteTransition, t])\n\n useEffect(() => {\n if (isLoggedIn) {\n void handleLogOut()\n } else if (!navigatingToLoginRef.current) {\n navigatingToLoginRef.current = true\n startRouteTransition(() => router.push(loginRoute))\n }\n }, [handleLogOut, isLoggedIn, loginRoute, router, startRouteTransition])\n\n if (!isLoggedIn && inactivity) {\n return (\n <div className={`${baseClass}__wrap`}>\n <h2>{t('authentication:loggedOutInactivity')}</h2>\n <Button buttonStyle=\"secondary\" el=\"link\" size=\"large\" url={loginRoute}>\n {t('authentication:logBackIn')}\n </Button>\n </div>\n )\n }\n\n return <LoadingOverlay animationDuration={'0ms'} loadingText={t('auth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A,OAAAyB,YAAA;IAAAzB,CAAA,OAAAU,UAAA;IAAAV,CAAA,OAAAiB,UAAA;IAAAjB,CAAA,OAAAoB,MAAA;IAAApB,CAAA,OAAAM,oBAAA;IAAAN,CAAA,OAAA0B,EAAA;IAAA1B,CAAA,OAAA2B,EAAA;EAAA;IAAAD,EAAA,GAAA1B,CAAA;IAAA2B,EAAA,GAAA3B,CAAA;EAAA;EAPvEJ,SAAA,CAAU8B,EAOV,EAAGC,EAAoE;EAAA,IAEnE,CAACjB,UAAA,IAAcR,UAAA;IAAA,IAAA0B,EAAA;IAAA,IAAA5B,CAAA,SAAAiB,UAAA,IAAAjB,CAAA,SAAAmB,CAAA;MAEfS,EAAA,GAAAC,KAAA,CAAC;QAAAC,SAAA,EAAe,GAAAjC,SAAA,QAAoB;QAAAkC,QAAA,GAClCC,IAAA,CAAC;UAAAD,QAAA,EAAIZ,CAAA,CAAE;QAAA,C,GACPa,IAAA,CAAA7C,MAAA;UAAA8C,WAAA,EAAoB;UAAAC,EAAA,EAAe;UAAAC,IAAA,EAAY;UAAAC,GAAA,EAAanB,UAAA;UAAAc,QAAA,EACzDZ,CAAA,CAAE;QAAA,C;;;;;;;;WAHPS,E;;;;IASGA,EAAA,GAAAI,IAAA,CAAA5C,cAAA;MAAAiD,iBAAA,EAAmC;MAAAC,WAAA,EAAoBnB,CAAA,CAAE;IAAA,C;;;;;;SAAzDS,E;CACT","ignoreList":[]}
|
|
@@ -8,7 +8,7 @@ import React, { useState } from 'react';
|
|
|
8
8
|
import { countChangedFields, countChangedFieldsInRows } from '../utilities/countChangedFields.js';
|
|
9
9
|
const baseClass = 'diff-collapser';
|
|
10
10
|
export const DiffCollapser = t0 => {
|
|
11
|
-
const $ = _c(
|
|
11
|
+
const $ = _c(23);
|
|
12
12
|
const {
|
|
13
13
|
children,
|
|
14
14
|
field,
|
|
@@ -39,8 +39,24 @@ export const DiffCollapser = t0 => {
|
|
|
39
39
|
if (!fieldIsArrayType(field) && !fieldIsBlockType(field)) {
|
|
40
40
|
throw new Error("DiffCollapser: field must be an array or blocks field when isIterable is true");
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
let t5;
|
|
43
|
+
if ($[14] !== valueFrom) {
|
|
44
|
+
t5 = valueFrom ?? [];
|
|
45
|
+
$[14] = valueFrom;
|
|
46
|
+
$[15] = t5;
|
|
47
|
+
} else {
|
|
48
|
+
t5 = $[15];
|
|
49
|
+
}
|
|
50
|
+
const comparisonRows = t5;
|
|
51
|
+
let t6;
|
|
52
|
+
if ($[16] !== valueTo) {
|
|
53
|
+
t6 = valueTo ?? [];
|
|
54
|
+
$[16] = valueTo;
|
|
55
|
+
$[17] = t6;
|
|
56
|
+
} else {
|
|
57
|
+
t6 = $[17];
|
|
58
|
+
}
|
|
59
|
+
const versionRows = t6;
|
|
44
60
|
if (!Array.isArray(comparisonRows) || !Array.isArray(versionRows)) {
|
|
45
61
|
throw new Error("DiffCollapser: comparison and version must be arrays when isIterable is true");
|
|
46
62
|
}
|
|
@@ -65,22 +81,22 @@ export const DiffCollapser = t0 => {
|
|
|
65
81
|
const t5 = isCollapsed && `${baseClass}__content--is-collapsed`;
|
|
66
82
|
const t6 = hideGutter && `${baseClass}__content--hide-gutter`;
|
|
67
83
|
let t7;
|
|
68
|
-
if ($[
|
|
84
|
+
if ($[18] !== t5 || $[19] !== t6) {
|
|
69
85
|
t7 = [`${baseClass}__content`, t5, t6].filter(Boolean);
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
72
|
-
$[
|
|
86
|
+
$[18] = t5;
|
|
87
|
+
$[19] = t6;
|
|
88
|
+
$[20] = t7;
|
|
73
89
|
} else {
|
|
74
|
-
t7 = $[
|
|
90
|
+
t7 = $[20];
|
|
75
91
|
}
|
|
76
92
|
const contentClassNames = t7.join(" ");
|
|
77
93
|
let t8;
|
|
78
|
-
if ($[
|
|
94
|
+
if ($[21] !== isCollapsed) {
|
|
79
95
|
t8 = () => setIsCollapsed(!isCollapsed);
|
|
80
|
-
$[
|
|
81
|
-
$[
|
|
96
|
+
$[21] = isCollapsed;
|
|
97
|
+
$[22] = t8;
|
|
82
98
|
} else {
|
|
83
|
-
t8 = $[
|
|
99
|
+
t8 = $[22];
|
|
84
100
|
}
|
|
85
101
|
t4 = _jsxs("div", {
|
|
86
102
|
className: baseClass,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","ChevronIcon","FieldDiffLabel","useConfig","useTranslation","fieldIsArrayType","fieldIsBlockType","React","useState","countChangedFields","countChangedFieldsInRows","baseClass","DiffCollapser","t0","$","children","field","fields","hideGutter","t1","initCollapsed","t2","isIterable","t3","Label","locales","parentIsLocalized","valueFrom","valueTo","undefined","t","isCollapsed","setIsCollapsed","config","t4","changeCount","Error","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","ChevronIcon","FieldDiffLabel","useConfig","useTranslation","fieldIsArrayType","fieldIsBlockType","React","useState","countChangedFields","countChangedFieldsInRows","baseClass","DiffCollapser","t0","$","children","field","fields","hideGutter","t1","initCollapsed","t2","isIterable","t3","Label","locales","parentIsLocalized","valueFrom","valueTo","undefined","t","isCollapsed","setIsCollapsed","config","t4","changeCount","Error","t5","comparisonRows","t6","versionRows","Array","isArray","version","t7","filter","Boolean","contentClassNames","join","t8","_jsxs","className","onClick","type","_jsx","direction","size","count"],"sources":["../../../../../src/views/Version/RenderFieldsToDiff/DiffCollapser/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientField } from 'payload'\n\nimport { ChevronIcon, FieldDiffLabel, useConfig, useTranslation } from '@payloadcms/ui'\nimport { fieldIsArrayType, fieldIsBlockType } from 'payload/shared'\nimport React, { useState } from 'react'\n\nimport './index.scss'\nimport { countChangedFields, countChangedFieldsInRows } from '../utilities/countChangedFields.js'\n\nconst baseClass = 'diff-collapser'\n\ntype Props = {\n hideGutter?: boolean\n initCollapsed?: boolean\n Label: React.ReactNode\n locales: string[] | undefined\n parentIsLocalized: boolean\n valueTo: unknown\n} & (\n | {\n // fields collapser\n children: React.ReactNode\n field?: never\n fields: ClientField[]\n isIterable?: false\n valueFrom: unknown\n }\n | {\n // iterable collapser\n children: React.ReactNode\n field: ClientField\n fields?: never\n isIterable: true\n valueFrom?: unknown\n }\n)\n\nexport const DiffCollapser: React.FC<Props> = ({\n children,\n field,\n fields,\n hideGutter = false,\n initCollapsed = false,\n isIterable = false,\n Label,\n locales,\n parentIsLocalized,\n valueFrom,\n valueTo,\n}) => {\n const { t } = useTranslation()\n const [isCollapsed, setIsCollapsed] = useState(initCollapsed)\n const { config } = useConfig()\n\n let changeCount = 0\n\n if (isIterable) {\n if (!fieldIsArrayType(field) && !fieldIsBlockType(field)) {\n throw new Error(\n 'DiffCollapser: field must be an array or blocks field when isIterable is true',\n )\n }\n const comparisonRows = valueFrom ?? []\n const versionRows = valueTo ?? []\n\n if (!Array.isArray(comparisonRows) || !Array.isArray(versionRows)) {\n throw new Error(\n 'DiffCollapser: comparison and version must be arrays when isIterable is true',\n )\n }\n\n changeCount = countChangedFieldsInRows({\n comparisonRows,\n config,\n field,\n locales,\n parentIsLocalized,\n versionRows,\n })\n } else {\n changeCount = countChangedFields({\n comparison: valueFrom,\n config,\n fields,\n locales,\n parentIsLocalized,\n version: valueTo,\n })\n }\n\n const contentClassNames = [\n `${baseClass}__content`,\n isCollapsed && `${baseClass}__content--is-collapsed`,\n hideGutter && `${baseClass}__content--hide-gutter`,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <div className={baseClass}>\n <FieldDiffLabel>\n <button\n aria-label={isCollapsed ? 'Expand' : 'Collapse'}\n className={`${baseClass}__toggle-button`}\n onClick={() => setIsCollapsed(!isCollapsed)}\n type=\"button\"\n >\n <div className={`${baseClass}__label`}>{Label}</div>\n\n <ChevronIcon direction={isCollapsed ? 'right' : 'down'} size={'small'} />\n </button>\n {changeCount > 0 && isCollapsed && (\n <span className={`${baseClass}__field-change-count`}>\n {t('version:changedFieldsCount', { count: changeCount })}\n </span>\n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lBmB,E;CAqBJ","ignoreList":[]}
|
|
@@ -10,7 +10,7 @@ import { DiffCollapser } from '../../DiffCollapser/index.js';
|
|
|
10
10
|
import { RenderVersionFieldsToDiff } from '../../RenderVersionFieldsToDiff.js';
|
|
11
11
|
const baseClass = 'collapsible-diff';
|
|
12
12
|
export const Collapsible = t0 => {
|
|
13
|
-
const $ = _c(
|
|
13
|
+
const $ = _c(11);
|
|
14
14
|
const {
|
|
15
15
|
baseVersionField,
|
|
16
16
|
comparisonValue: valueFrom,
|
|
@@ -28,16 +28,26 @@ export const Collapsible = t0 => {
|
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
30
|
let t1;
|
|
31
|
-
if ($[0] !==
|
|
32
|
-
t1 = _jsx("
|
|
31
|
+
if ($[0] !== field || $[1] !== i18n) {
|
|
32
|
+
t1 = "label" in field && field.label && typeof field.label !== "function" && _jsx("span", {
|
|
33
|
+
children: getTranslation(field.label, i18n)
|
|
34
|
+
});
|
|
35
|
+
$[0] = field;
|
|
36
|
+
$[1] = i18n;
|
|
37
|
+
$[2] = t1;
|
|
38
|
+
} else {
|
|
39
|
+
t1 = $[2];
|
|
40
|
+
}
|
|
41
|
+
const t2 = parentIsLocalized || field.localized;
|
|
42
|
+
let t3;
|
|
43
|
+
if ($[3] !== baseVersionField.fields || $[4] !== field.fields || $[5] !== selectedLocales || $[6] !== t1 || $[7] !== t2 || $[8] !== valueFrom || $[9] !== valueTo) {
|
|
44
|
+
t3 = _jsx("div", {
|
|
33
45
|
className: baseClass,
|
|
34
46
|
children: _jsx(DiffCollapser, {
|
|
35
47
|
fields: field.fields,
|
|
36
|
-
Label:
|
|
37
|
-
children: getTranslation(field.label, i18n)
|
|
38
|
-
}),
|
|
48
|
+
Label: t1,
|
|
39
49
|
locales: selectedLocales,
|
|
40
|
-
parentIsLocalized:
|
|
50
|
+
parentIsLocalized: t2,
|
|
41
51
|
valueFrom,
|
|
42
52
|
valueTo,
|
|
43
53
|
children: _jsx(RenderVersionFieldsToDiff, {
|
|
@@ -45,17 +55,17 @@ export const Collapsible = t0 => {
|
|
|
45
55
|
})
|
|
46
56
|
})
|
|
47
57
|
});
|
|
48
|
-
$[
|
|
49
|
-
$[
|
|
50
|
-
$[
|
|
51
|
-
$[
|
|
52
|
-
$[
|
|
53
|
-
$[
|
|
54
|
-
$[
|
|
55
|
-
$[
|
|
58
|
+
$[3] = baseVersionField.fields;
|
|
59
|
+
$[4] = field.fields;
|
|
60
|
+
$[5] = selectedLocales;
|
|
61
|
+
$[6] = t1;
|
|
62
|
+
$[7] = t2;
|
|
63
|
+
$[8] = valueFrom;
|
|
64
|
+
$[9] = valueTo;
|
|
65
|
+
$[10] = t3;
|
|
56
66
|
} else {
|
|
57
|
-
|
|
67
|
+
t3 = $[10];
|
|
58
68
|
}
|
|
59
|
-
return
|
|
69
|
+
return t3;
|
|
60
70
|
};
|
|
61
71
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","getTranslation","useTranslation","React","useSelectedLocales","DiffCollapser","RenderVersionFieldsToDiff","baseClass","Collapsible","t0","$","baseVersionField","comparisonValue","valueFrom","field","parentIsLocalized","versionValue","valueTo","i18n","selectedLocales","fields","length","t1","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","getTranslation","useTranslation","React","useSelectedLocales","DiffCollapser","RenderVersionFieldsToDiff","baseClass","Collapsible","t0","$","baseVersionField","comparisonValue","valueFrom","field","parentIsLocalized","versionValue","valueTo","i18n","selectedLocales","fields","length","t1","label","_jsx","children","t2","localized","t3","className","Label","versionFields"],"sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Collapsible/index.tsx"],"sourcesContent":["'use client'\nimport type { CollapsibleFieldDiffClientComponent } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { useTranslation } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { useSelectedLocales } from '../../../Default/SelectedLocalesContext.js'\nimport { DiffCollapser } from '../../DiffCollapser/index.js'\nimport { RenderVersionFieldsToDiff } from '../../RenderVersionFieldsToDiff.js'\n\nconst baseClass = 'collapsible-diff'\n\nexport const Collapsible: CollapsibleFieldDiffClientComponent = ({\n baseVersionField,\n comparisonValue: valueFrom,\n field,\n parentIsLocalized,\n versionValue: valueTo,\n}) => {\n const { i18n } = useTranslation()\n const { selectedLocales } = useSelectedLocales()\n\n if (!baseVersionField.fields?.length) {\n return null\n }\n\n return (\n <div className={baseClass}>\n <DiffCollapser\n fields={field.fields}\n Label={\n 'label' in field &&\n field.label &&\n typeof field.label !== 'function' && <span>{getTranslation(field.label, i18n)}</span>\n }\n locales={selectedLocales}\n parentIsLocalized={parentIsLocalized || field.localized}\n valueFrom={valueFrom}\n valueTo={valueTo}\n >\n <RenderVersionFieldsToDiff versionFields={baseVersionField.fields} />\n </DiffCollapser>\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAElB,SAASC,kBAAkB,QAAQ;AACnC,SAASC,aAAa,QAAQ;AAC9B,SAASC,yBAAyB,QAAQ;AAE1C,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,WAAA,GAAmDC,EAAA;EAAA,MAAAC,CAAA,GAAAV,EAAA;EAAC;IAAAW,gBAAA;IAAAC,eAAA,EAAAC,SAAA;IAAAC,KAAA;IAAAC,iBAAA;IAAAC,YAAA,EAAAC;EAAA,IAAAR,EAMhE;EACC;IAAAS;EAAA,IAAiBhB,cAAA;EACjB;IAAAiB;EAAA,IAA4Bf,kBAAA;EAAA,KAEvBO,gBAAA,CAAAS,MAAA,EAAAC,MAAA;IAAA;EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAZ,CAAA,QAAAI,KAAA,IAAAJ,CAAA,QAAAQ,IAAA;IASGI,EAAA,cAAWR,KAAA,IACXA,KAAA,CAAAS,KAAW,IACX,OAAOT,KAAA,CAAAS,KAAA,KAAgB,cAAcC,IAAA,CAAC;MAAAC,QAAA,EAAMxB,cAAA,CAAea,KAAA,CAAAS,KAAA,EAAaL,IAAA;IAAA,C;;;;;;;EAGvD,MAAAQ,EAAA,GAAAX,iBAAA,IAAqBD,KAAA,CAAAa,SAAe;EAAA,IAAAC,EAAA;EAAA,IAAAlB,CAAA,QAAAC,gBAAA,CAAAS,MAAA,IAAAV,CAAA,QAAAI,KAAA,CAAAM,MAAA,IAAAV,CAAA,QAAAS,eAAA,IAAAT,CAAA,QAAAY,EAAA,IAAAZ,CAAA,QAAAgB,EAAA,IAAAhB,CAAA,QAAAG,SAAA,IAAAH,CAAA,QAAAO,OAAA;IAT3DW,EAAA,GAAAJ,IAAA,CAAC;MAAAK,SAAA,EAAAtB,SAAA;MAAAkB,QAAA,EACCD,IAAA,CAAAnB,aAAA;QAAAe,MAAA,EACUN,KAAA,CAAAM,MAAA;QAAAU,KAAA,EAENR,E;iBAIOH,eAAA;QAAAJ,iBAAA,EACUW,EAAoC;QAAAb,SAAA;QAAAI,OAAA;QAAAQ,QAAA,EAIvDD,IAAA,CAAAlB,yBAAA;UAAAyB,aAAA,EAA0CpB,gBAAA,CAAAS;QAAA,C;;;;;;;;;;;;;;SAb9CQ,E;CAiBJ","ignoreList":[]}
|
|
@@ -10,7 +10,7 @@ import { DiffCollapser } from '../../DiffCollapser/index.js';
|
|
|
10
10
|
import { RenderVersionFieldsToDiff } from '../../RenderVersionFieldsToDiff.js';
|
|
11
11
|
const baseClass = 'group-diff';
|
|
12
12
|
export const Group = t0 => {
|
|
13
|
-
const $ = _c(
|
|
13
|
+
const $ = _c(12);
|
|
14
14
|
const {
|
|
15
15
|
baseVersionField,
|
|
16
16
|
comparisonValue: valueFrom,
|
|
@@ -26,19 +26,30 @@ export const Group = t0 => {
|
|
|
26
26
|
selectedLocales
|
|
27
27
|
} = useSelectedLocales();
|
|
28
28
|
let t1;
|
|
29
|
-
if ($[0] !==
|
|
30
|
-
t1 =
|
|
29
|
+
if ($[0] !== field || $[1] !== i18n || $[2] !== locale) {
|
|
30
|
+
t1 = "label" in field && field.label && typeof field.label !== "function" && _jsxs("span", {
|
|
31
|
+
children: [locale && _jsx("span", {
|
|
32
|
+
className: `${baseClass}__locale-label`,
|
|
33
|
+
children: locale
|
|
34
|
+
}), getTranslation(field.label, i18n)]
|
|
35
|
+
});
|
|
36
|
+
$[0] = field;
|
|
37
|
+
$[1] = i18n;
|
|
38
|
+
$[2] = locale;
|
|
39
|
+
$[3] = t1;
|
|
40
|
+
} else {
|
|
41
|
+
t1 = $[3];
|
|
42
|
+
}
|
|
43
|
+
const t2 = parentIsLocalized || field.localized;
|
|
44
|
+
let t3;
|
|
45
|
+
if ($[4] !== baseVersionField.fields || $[5] !== field.fields || $[6] !== selectedLocales || $[7] !== t1 || $[8] !== t2 || $[9] !== valueFrom || $[10] !== valueTo) {
|
|
46
|
+
t3 = _jsx("div", {
|
|
31
47
|
className: baseClass,
|
|
32
48
|
children: _jsx(DiffCollapser, {
|
|
33
49
|
fields: field.fields,
|
|
34
|
-
Label:
|
|
35
|
-
children: [locale && _jsx("span", {
|
|
36
|
-
className: `${baseClass}__locale-label`,
|
|
37
|
-
children: locale
|
|
38
|
-
}), getTranslation(field.label, i18n)]
|
|
39
|
-
}),
|
|
50
|
+
Label: t1,
|
|
40
51
|
locales: selectedLocales,
|
|
41
|
-
parentIsLocalized:
|
|
52
|
+
parentIsLocalized: t2,
|
|
42
53
|
valueFrom,
|
|
43
54
|
valueTo,
|
|
44
55
|
children: _jsx(RenderVersionFieldsToDiff, {
|
|
@@ -46,18 +57,17 @@ export const Group = t0 => {
|
|
|
46
57
|
})
|
|
47
58
|
})
|
|
48
59
|
});
|
|
49
|
-
$[
|
|
50
|
-
$[
|
|
51
|
-
$[
|
|
52
|
-
$[
|
|
53
|
-
$[
|
|
54
|
-
$[
|
|
55
|
-
$[
|
|
56
|
-
$[
|
|
57
|
-
$[8] = t1;
|
|
60
|
+
$[4] = baseVersionField.fields;
|
|
61
|
+
$[5] = field.fields;
|
|
62
|
+
$[6] = selectedLocales;
|
|
63
|
+
$[7] = t1;
|
|
64
|
+
$[8] = t2;
|
|
65
|
+
$[9] = valueFrom;
|
|
66
|
+
$[10] = valueTo;
|
|
67
|
+
$[11] = t3;
|
|
58
68
|
} else {
|
|
59
|
-
|
|
69
|
+
t3 = $[11];
|
|
60
70
|
}
|
|
61
|
-
return
|
|
71
|
+
return t3;
|
|
62
72
|
};
|
|
63
73
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","getTranslation","useTranslation","React","useSelectedLocales","DiffCollapser","RenderVersionFieldsToDiff","baseClass","Group","t0","$","baseVersionField","comparisonValue","valueFrom","field","locale","parentIsLocalized","versionValue","valueTo","i18n","selectedLocales","t1","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","getTranslation","useTranslation","React","useSelectedLocales","DiffCollapser","RenderVersionFieldsToDiff","baseClass","Group","t0","$","baseVersionField","comparisonValue","valueFrom","field","locale","parentIsLocalized","versionValue","valueTo","i18n","selectedLocales","t1","label","_jsxs","children","_jsx","className","t2","localized","t3","fields","Label","versionFields"],"sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Group/index.tsx"],"sourcesContent":["'use client'\nimport type { GroupFieldDiffClientComponent } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport './index.scss'\n\nimport { useTranslation } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { useSelectedLocales } from '../../../Default/SelectedLocalesContext.js'\nimport { DiffCollapser } from '../../DiffCollapser/index.js'\nimport { RenderVersionFieldsToDiff } from '../../RenderVersionFieldsToDiff.js'\n\nconst baseClass = 'group-diff'\n\nexport const Group: GroupFieldDiffClientComponent = ({\n baseVersionField,\n comparisonValue: valueFrom,\n field,\n locale,\n parentIsLocalized,\n versionValue: valueTo,\n}) => {\n const { i18n } = useTranslation()\n const { selectedLocales } = useSelectedLocales()\n\n return (\n <div className={baseClass}>\n <DiffCollapser\n fields={field.fields}\n Label={\n 'label' in field &&\n field.label &&\n typeof field.label !== 'function' && (\n <span>\n {locale && <span className={`${baseClass}__locale-label`}>{locale}</span>}\n {getTranslation(field.label, i18n)}\n </span>\n )\n }\n locales={selectedLocales}\n parentIsLocalized={parentIsLocalized || field.localized}\n valueFrom={valueFrom}\n valueTo={valueTo}\n >\n <RenderVersionFieldsToDiff versionFields={baseVersionField.fields} />\n </DiffCollapser>\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,cAAc,QAAQ;AAI/B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAElB,SAASC,kBAAkB,QAAQ;AACnC,SAASC,aAAa,QAAQ;AAC9B,SAASC,yBAAyB,QAAQ;AAE1C,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,KAAA,GAAuCC,EAAA;EAAA,MAAAC,CAAA,GAAAV,EAAA;EAAC;IAAAW,gBAAA;IAAAC,eAAA,EAAAC,SAAA;IAAAC,KAAA;IAAAC,MAAA;IAAAC,iBAAA;IAAAC,YAAA,EAAAC;EAAA,IAAAT,EAOpD;EACC;IAAAU;EAAA,IAAiBjB,cAAA;EACjB;IAAAkB;EAAA,IAA4BhB,kBAAA;EAAA,IAAAiB,EAAA;EAAA,IAAAX,CAAA,QAAAI,KAAA,IAAAJ,CAAA,QAAAS,IAAA,IAAAT,CAAA,QAAAK,MAAA;IAOpBM,EAAA,cAAWP,KAAA,IACXA,KAAA,CAAAQ,KAAW,IACX,OAAOR,KAAA,CAAAQ,KAAA,KAAgB,cACrBC,KAAA,CAAC;MAAAC,QAAA,GACET,MAAA,IAAUU,IAAA,CAAC;QAAAC,SAAA,EAAgB,GAAAnB,SAAA,gBAA4B;QAAAiB,QAAA,EAAGT;MAAA,C,GAC1Dd,cAAA,CAAea,KAAA,CAA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