@payloadcms/next 3.24.0-canary.4c8cafd → 3.24.0-canary.58e9eb5
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/elements/DocumentHeader/index.scss +0 -2
- 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/RenderFieldsToDiff/DiffCollapser/index.d.ts +2 -0
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js +26 -22
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.d.ts +2 -1
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +14 -2
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js +12 -8
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js +12 -8
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +11 -7
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +30 -21
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +13 -9
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.d.ts +4 -2
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js +24 -3
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.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 +3 -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,6 +1,6 @@
|
|
|
1
1
|
import { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent';
|
|
2
2
|
import { dequal } from 'dequal/lite';
|
|
3
|
-
import { fieldIsID, getUniqueListBy, tabHasName } from 'payload/shared';
|
|
3
|
+
import { fieldIsID, fieldShouldBeLocalized, getUniqueListBy, tabHasName } from 'payload/shared';
|
|
4
4
|
import { diffMethods } from './fields/diffMethods.js';
|
|
5
5
|
import { diffComponents } from './fields/index.js';
|
|
6
6
|
import { getFieldPathsModified } from './utilities/getFieldPathsModified.js';
|
|
@@ -21,6 +21,7 @@ export const buildVersionFields = ({
|
|
|
21
21
|
i18n,
|
|
22
22
|
modifiedOnly,
|
|
23
23
|
parentIndexPath,
|
|
24
|
+
parentIsLocalized,
|
|
24
25
|
parentPath,
|
|
25
26
|
parentSchemaPath,
|
|
26
27
|
req,
|
|
@@ -59,7 +60,10 @@ export const buildVersionFields = ({
|
|
|
59
60
|
throw new Error('No client field found for ' + entitySlug + '.' + schemaPath);
|
|
60
61
|
}
|
|
61
62
|
const versionField = {};
|
|
62
|
-
const isLocalized =
|
|
63
|
+
const isLocalized = fieldShouldBeLocalized({
|
|
64
|
+
field,
|
|
65
|
+
parentIsLocalized
|
|
66
|
+
});
|
|
63
67
|
const fieldName = 'name' in field ? field.name : null;
|
|
64
68
|
const versionValue = fieldName ? versionSiblingData?.[fieldName] : versionSiblingData;
|
|
65
69
|
const comparisonValue = fieldName ? comparisonSiblingData?.[fieldName] : comparisonSiblingData;
|
|
@@ -78,6 +82,7 @@ export const buildVersionFields = ({
|
|
|
78
82
|
indexPath,
|
|
79
83
|
locale,
|
|
80
84
|
modifiedOnly,
|
|
85
|
+
parentIsLocalized: true,
|
|
81
86
|
parentPath,
|
|
82
87
|
parentSchemaPath,
|
|
83
88
|
path,
|
|
@@ -102,6 +107,7 @@ export const buildVersionFields = ({
|
|
|
102
107
|
i18n,
|
|
103
108
|
indexPath,
|
|
104
109
|
modifiedOnly,
|
|
110
|
+
parentIsLocalized: parentIsLocalized || 'localized' in field && field.localized,
|
|
105
111
|
parentPath,
|
|
106
112
|
parentSchemaPath,
|
|
107
113
|
path,
|
|
@@ -132,6 +138,7 @@ const buildVersionField = ({
|
|
|
132
138
|
indexPath,
|
|
133
139
|
locale,
|
|
134
140
|
modifiedOnly,
|
|
141
|
+
parentIsLocalized,
|
|
135
142
|
parentPath,
|
|
136
143
|
parentSchemaPath,
|
|
137
144
|
path,
|
|
@@ -190,6 +197,7 @@ const buildVersionField = ({
|
|
|
190
197
|
i18n,
|
|
191
198
|
modifiedOnly,
|
|
192
199
|
parentIndexPath: isNamedTab ? '' : tabIndexPath,
|
|
200
|
+
parentIsLocalized: parentIsLocalized || tab.localized,
|
|
193
201
|
parentPath: tabPath,
|
|
194
202
|
parentSchemaPath: tabSchemaPath,
|
|
195
203
|
req,
|
|
@@ -216,6 +224,7 @@ const buildVersionField = ({
|
|
|
216
224
|
i18n,
|
|
217
225
|
modifiedOnly,
|
|
218
226
|
parentIndexPath: 'name' in field ? '' : indexPath,
|
|
227
|
+
parentIsLocalized: parentIsLocalized || field.localized,
|
|
219
228
|
parentPath: path + '.' + i,
|
|
220
229
|
parentSchemaPath: schemaPath,
|
|
221
230
|
req,
|
|
@@ -234,6 +243,7 @@ const buildVersionField = ({
|
|
|
234
243
|
i18n,
|
|
235
244
|
modifiedOnly,
|
|
236
245
|
parentIndexPath: 'name' in field ? '' : indexPath,
|
|
246
|
+
parentIsLocalized: parentIsLocalized || 'localized' in field && field.localized,
|
|
237
247
|
parentPath: path,
|
|
238
248
|
parentSchemaPath: schemaPath,
|
|
239
249
|
req,
|
|
@@ -271,6 +281,7 @@ const buildVersionField = ({
|
|
|
271
281
|
i18n,
|
|
272
282
|
modifiedOnly,
|
|
273
283
|
parentIndexPath: 'name' in field ? '' : indexPath,
|
|
284
|
+
parentIsLocalized: parentIsLocalized || 'localized' in field && field.localized,
|
|
274
285
|
parentPath: path + '.' + i,
|
|
275
286
|
parentSchemaPath: schemaPath + '.' + versionBlock.slug,
|
|
276
287
|
req,
|
|
@@ -288,6 +299,7 @@ const buildVersionField = ({
|
|
|
288
299
|
diffMethod,
|
|
289
300
|
field: clientField,
|
|
290
301
|
fieldPermissions: subFieldPermissions,
|
|
302
|
+
parentIsLocalized,
|
|
291
303
|
versionValue
|
|
292
304
|
};
|
|
293
305
|
const serverCellProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildVersionFields.js","names":["RenderServerComponent","dequal","fieldIsID","getUniqueListBy","tabHasName","diffMethods","diffComponents","getFieldPathsModified","buildVersionFields","clientSchemaMap","comparisonSiblingData","customDiffComponents","entitySlug","fieldPermissions","fields","i18n","modifiedOnly","parentIndexPath","parentPath","parentSchemaPath","req","selectedLocales","versionSiblingData","versionFields","fieldIndex","field","indexPath","path","schemaPath","index","clientField","get","payload","logger","error","clientFieldKey","clientSchemaMapKeys","Array","from","keys","msg","Error","versionField","isLocalized","localized","fieldName","name","versionValue","comparisonValue","fieldByLocale","locale","localizedVersionField","buildVersionField","baseVersionField","push","diffMethod","type","hasPermission","read","subFieldPermissions","CustomComponent","admin","components","Diff","DefaultComponent","tabs","tabIndex","tab","isNamedTab","tabIndexPath","tabPath","tabSchemaPath","label","arrayValue","isArray","rows","i","length","comparisonRow","versionRow","blocksValue","blockSlugToMatch","blockType","versionBlock","blocks","blockReferences","find","block","slug","comparisonBlockSlugToMatch","comparisonBlock","clientCellProps","undefined","serverCellProps","clientProps","Component","Fallback","importMap","key","serverProps"],"sources":["../../../../src/views/Version/RenderFieldsToDiff/buildVersionFields.tsx"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type {\n BaseVersionField,\n ClientField,\n ClientFieldSchemaMap,\n Field,\n FieldDiffClientProps,\n FieldDiffServerProps,\n FieldTypes,\n FlattenedBlock,\n PayloadComponent,\n PayloadRequest,\n SanitizedFieldPermissions,\n VersionField,\n} from 'payload'\nimport type { DiffMethod } from 'react-diff-viewer-continued'\n\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { dequal } from 'dequal/lite'\nimport { fieldIsID, getUniqueListBy, tabHasName } from 'payload/shared'\n\nimport { diffMethods } from './fields/diffMethods.js'\nimport { diffComponents } from './fields/index.js'\nimport { getFieldPathsModified } from './utilities/getFieldPathsModified.js'\n\nexport type BuildVersionFieldsArgs = {\n clientSchemaMap: ClientFieldSchemaMap\n comparisonSiblingData: object\n customDiffComponents: Partial<\n Record<FieldTypes, PayloadComponent<FieldDiffServerProps, FieldDiffClientProps>>\n >\n entitySlug: string\n fieldPermissions:\n | {\n [key: string]: SanitizedFieldPermissions\n }\n | true\n fields: Field[]\n i18n: I18nClient\n modifiedOnly: boolean\n parentIndexPath: string\n parentPath: string\n parentSchemaPath: string\n req: PayloadRequest\n selectedLocales: string[]\n versionSiblingData: object\n}\n\n/**\n * Build up an object that contains rendered diff components for each field.\n * This is then sent to the client to be rendered.\n *\n * Here, the server is responsible for traversing through the document data and building up this\n * version state object.\n */\nexport const buildVersionFields = ({\n clientSchemaMap,\n comparisonSiblingData,\n customDiffComponents,\n entitySlug,\n fieldPermissions,\n fields,\n i18n,\n modifiedOnly,\n parentIndexPath,\n parentPath,\n parentSchemaPath,\n req,\n selectedLocales,\n versionSiblingData,\n}: BuildVersionFieldsArgs): {\n versionFields: VersionField[]\n} => {\n const versionFields: VersionField[] = []\n let fieldIndex = -1\n for (const field of fields) {\n fieldIndex++\n if (fieldIsID(field)) {\n continue\n }\n\n const { indexPath, path, schemaPath } = getFieldPathsModified({\n field,\n index: fieldIndex,\n parentIndexPath: 'name' in field ? '' : parentIndexPath,\n parentPath,\n parentSchemaPath,\n })\n\n const clientField = clientSchemaMap.get(entitySlug + '.' + schemaPath)\n\n if (!clientField) {\n req.payload.logger.error({\n clientFieldKey: entitySlug + '.' + schemaPath,\n clientSchemaMapKeys: Array.from(clientSchemaMap.keys()),\n msg: 'No client field found for ' + entitySlug + '.' + schemaPath,\n parentPath,\n parentSchemaPath,\n path,\n schemaPath,\n })\n throw new Error('No client field found for ' + entitySlug + '.' + schemaPath)\n }\n\n const versionField: VersionField = {}\n const isLocalized = 'localized' in field && field.localized\n const fieldName: null | string = 'name' in field ? field.name : null\n\n const versionValue = fieldName ? versionSiblingData?.[fieldName] : versionSiblingData\n\n const comparisonValue = fieldName ? comparisonSiblingData?.[fieldName] : comparisonSiblingData\n\n if (isLocalized) {\n versionField.fieldByLocale = {}\n\n for (const locale of selectedLocales) {\n const localizedVersionField = buildVersionField({\n clientField: clientField as ClientField,\n clientSchemaMap,\n comparisonValue: comparisonValue?.[locale],\n customDiffComponents,\n entitySlug,\n field,\n fieldPermissions,\n i18n,\n indexPath,\n locale,\n modifiedOnly,\n parentPath,\n parentSchemaPath,\n path,\n req,\n schemaPath,\n selectedLocales,\n versionValue: versionValue?.[locale],\n })\n if (localizedVersionField) {\n versionField.fieldByLocale[locale] = localizedVersionField\n }\n }\n } else {\n const baseVersionField = buildVersionField({\n clientField: clientField as ClientField,\n clientSchemaMap,\n comparisonValue,\n customDiffComponents,\n entitySlug,\n field,\n fieldPermissions,\n i18n,\n indexPath,\n modifiedOnly,\n parentPath,\n parentSchemaPath,\n path,\n req,\n schemaPath,\n selectedLocales,\n versionValue,\n })\n\n if (baseVersionField) {\n versionField.field = baseVersionField\n }\n }\n\n versionFields.push(versionField)\n }\n\n return {\n versionFields,\n }\n}\n\nconst buildVersionField = ({\n clientField,\n clientSchemaMap,\n comparisonValue,\n customDiffComponents,\n entitySlug,\n field,\n fieldPermissions,\n i18n,\n indexPath,\n locale,\n modifiedOnly,\n parentPath,\n parentSchemaPath,\n path,\n req,\n schemaPath,\n selectedLocales,\n versionValue,\n}: {\n clientField: ClientField\n comparisonValue: unknown\n field: Field\n indexPath: string\n locale?: string\n modifiedOnly?: boolean\n path: string\n schemaPath: string\n versionValue: unknown\n} & Omit<\n BuildVersionFieldsArgs,\n 'comparisonSiblingData' | 'fields' | 'parentIndexPath' | 'versionSiblingData'\n>): BaseVersionField | null => {\n const fieldName: null | string = 'name' in field ? field.name : null\n\n const diffMethod: DiffMethod = diffMethods[field.type] || 'CHARS'\n\n const hasPermission =\n fieldPermissions === true ||\n !fieldName ||\n fieldPermissions?.[fieldName] === true ||\n fieldPermissions?.[fieldName]?.read\n\n const subFieldPermissions =\n fieldPermissions === true ||\n !fieldName ||\n fieldPermissions?.[fieldName] === true ||\n fieldPermissions?.[fieldName]?.fields\n\n if (!hasPermission) {\n return null\n }\n\n if (modifiedOnly && dequal(versionValue, comparisonValue)) {\n return null\n }\n\n const CustomComponent = field?.admin?.components?.Diff ?? customDiffComponents?.[field.type]\n const DefaultComponent = diffComponents?.[field.type]\n\n const baseVersionField: BaseVersionField = {\n type: field.type,\n fields: [],\n path,\n schemaPath,\n }\n\n if (field.type === 'tabs' && 'tabs' in field) {\n baseVersionField.tabs = []\n let tabIndex = -1\n for (const tab of field.tabs) {\n tabIndex++\n const isNamedTab = tabHasName(tab)\n\n const {\n indexPath: tabIndexPath,\n path: tabPath,\n schemaPath: tabSchemaPath,\n } = getFieldPathsModified({\n field: {\n ...tab,\n type: 'tab',\n },\n index: tabIndex,\n parentIndexPath: indexPath,\n parentPath,\n parentSchemaPath,\n })\n baseVersionField.tabs.push({\n name: 'name' in tab ? tab.name : null,\n fields: buildVersionFields({\n clientSchemaMap,\n comparisonSiblingData: 'name' in tab ? comparisonValue?.[tab.name] : comparisonValue,\n customDiffComponents,\n entitySlug,\n fieldPermissions,\n fields: tab.fields,\n i18n,\n modifiedOnly,\n parentIndexPath: isNamedTab ? '' : tabIndexPath,\n parentPath: tabPath,\n parentSchemaPath: tabSchemaPath,\n req,\n selectedLocales,\n versionSiblingData: 'name' in tab ? versionValue?.[tab.name] : versionValue,\n }).versionFields,\n label: tab.label,\n })\n }\n } // At this point, we are dealing with a `row`, etc\n else if ('fields' in field) {\n if (field.type === 'array' && versionValue) {\n const arrayValue = Array.isArray(versionValue) ? versionValue : []\n baseVersionField.rows = []\n\n for (let i = 0; i < arrayValue.length; i++) {\n const comparisonRow = comparisonValue?.[i] || {}\n const versionRow = arrayValue?.[i] || {}\n baseVersionField.rows[i] = buildVersionFields({\n clientSchemaMap,\n comparisonSiblingData: comparisonRow,\n customDiffComponents,\n entitySlug,\n fieldPermissions,\n fields: field.fields,\n i18n,\n modifiedOnly,\n parentIndexPath: 'name' in field ? '' : indexPath,\n parentPath: path + '.' + i,\n parentSchemaPath: schemaPath,\n req,\n selectedLocales,\n versionSiblingData: versionRow,\n }).versionFields\n }\n } else {\n baseVersionField.fields = buildVersionFields({\n clientSchemaMap,\n comparisonSiblingData: comparisonValue as object,\n customDiffComponents,\n entitySlug,\n fieldPermissions,\n fields: field.fields,\n i18n,\n modifiedOnly,\n parentIndexPath: 'name' in field ? '' : indexPath,\n parentPath: path,\n parentSchemaPath: schemaPath,\n req,\n selectedLocales,\n versionSiblingData: versionValue as object,\n }).versionFields\n }\n } else if (field.type === 'blocks') {\n baseVersionField.rows = []\n\n const blocksValue = Array.isArray(versionValue) ? versionValue : []\n\n for (let i = 0; i < blocksValue.length; i++) {\n const comparisonRow = comparisonValue?.[i] || {}\n const versionRow = blocksValue[i] || {}\n\n const blockSlugToMatch: string = versionRow.blockType\n const versionBlock =\n req.payload.blocks[blockSlugToMatch] ??\n ((field.blockReferences ?? field.blocks).find(\n (block) => typeof block !== 'string' && block.slug === blockSlugToMatch,\n ) as FlattenedBlock | undefined)\n\n let fields = []\n\n if (versionRow.blockType === comparisonRow.blockType) {\n fields = versionBlock.fields\n } else {\n const comparisonBlockSlugToMatch: string = versionRow.blockType\n\n const comparisonBlock =\n req.payload.blocks[comparisonBlockSlugToMatch] ??\n ((field.blockReferences ?? field.blocks).find(\n (block) => typeof block !== 'string' && block.slug === comparisonBlockSlugToMatch,\n ) as FlattenedBlock | undefined)\n\n if (comparisonBlock) {\n fields = getUniqueListBy<Field>(\n [...versionBlock.fields, ...comparisonBlock.fields],\n 'name',\n )\n } else {\n fields = versionBlock.fields\n }\n }\n\n baseVersionField.rows[i] = buildVersionFields({\n clientSchemaMap,\n comparisonSiblingData: comparisonRow,\n customDiffComponents,\n entitySlug,\n fieldPermissions,\n fields,\n i18n,\n modifiedOnly,\n parentIndexPath: 'name' in field ? '' : indexPath,\n parentPath: path + '.' + i,\n parentSchemaPath: schemaPath + '.' + versionBlock.slug,\n req,\n selectedLocales,\n versionSiblingData: versionRow,\n }).versionFields\n }\n }\n\n const clientCellProps: FieldDiffClientProps = {\n baseVersionField: {\n ...baseVersionField,\n CustomComponent: undefined,\n },\n comparisonValue,\n diffMethod,\n field: clientField,\n fieldPermissions: subFieldPermissions,\n versionValue,\n }\n\n const serverCellProps: FieldDiffServerProps = {\n ...clientCellProps,\n clientField,\n field,\n i18n,\n req,\n selectedLocales,\n }\n\n baseVersionField.CustomComponent = RenderServerComponent({\n clientProps: locale\n ? ({\n ...clientCellProps,\n locale,\n } as FieldDiffClientProps)\n : clientCellProps,\n Component: CustomComponent,\n Fallback: DefaultComponent,\n importMap: req.payload.importMap,\n key: 'diff component',\n serverProps: locale\n ? ({\n ...serverCellProps,\n locale,\n } as FieldDiffServerProps)\n : serverCellProps,\n })\n\n return baseVersionField\n}\n"],"mappings":"AAiBA,SAASA,qBAAqB,QAAQ;AACtC,SAASC,MAAM,QAAQ;AACvB,SAASC,SAAS,EAAEC,eAAe,EAAEC,UAAU,QAAQ;AAEvD,SAASC,WAAW,QAAQ;AAC5B,SAASC,cAAc,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ;AAyBtC;;;;;;;AAOA,OAA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,CAAarE,MAAM;QAC9B;MACF;MAEAuC,gBAAA,CAAiBsB,IAAI,CAACC,CAAA,CAAE,GAAGpE,kBAAA,CAAmB;QAC5CC,eAAA;QACAC,qBAAA,EAAuBoE,aAAA;QACvBnE,oBAAA;QACAC,UAAA;QACAC,gBAAA;QACAC,MAAA;QACAC,IAAA;QACAC,YAAA;QACAC,eAAA,EAAiB,UAAUQ,KAAA,GAAQ,KAAKC,SAAA;QACxCR,UAAA,EAAYS,IAAA,GAAO,MAAMiD,CAAA;QACzBzD,gBAAA,EAAkBS,UAAA,GAAa,MAAMuD,YAAA,CAAaK,IAAI;QACtDpE,GAAA;QACAC,eAAA;QACAC,kBAAA,EAAoByD;MACtB,GAAGxD,aAAa;IAClB;EACF;EAEA,MAAMoE,eAAA,GAAwC;IAC5CtC,gBAAA,EAAkB;MAChB,GAAGA,gBAAgB;MACnBO,eAAA,EAAiBgC;IACnB;IACA5C,eAAA;IACAO,UAAA;IACA9B,KAAA,EAAOK,WAAA;IACPjB,gBAAA,EAAkB8C,mBAAA;IAClBZ;EACF;EAEA,MAAM8C,eAAA,GAAwC;IAC5C,GAAGF,eAAe;IAClB7D,WAAA;IACAL,KAAA;IACAV,IAAA;IACAK,GAAA;IACAC;EACF;EAEAgC,gBAAA,CAAiBO,eAAe,GAAG5D,qBAAA,CAAsB;IACvD8F,WAAA,EAAa5C,MAAA,GACR;MACC,GAAGyC,eAAe;MAClBzC;IACF,IACAyC,eAAA;IACJI,SAAA,EAAWnC,eAAA;IACXoC,QAAA,EAAUhC,gBAAA;IACViC,SAAA,EAAW7E,GAAA,CAAIY,OAAO,CAACiE,SAAS;IAChCC,GAAA,EAAK;IACLC,WAAA,EAAajD,MAAA,GACR;MACC,GAAG2C,eAAe;MAClB3C;IACF,IACA2C;EACN;EAEA,OAAOxC,gBAAA;AACT","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"buildVersionFields.js","names":["RenderServerComponent","dequal","fieldIsID","fieldShouldBeLocalized","getUniqueListBy","tabHasName","diffMethods","diffComponents","getFieldPathsModified","buildVersionFields","clientSchemaMap","comparisonSiblingData","customDiffComponents","entitySlug","fieldPermissions","fields","i18n","modifiedOnly","parentIndexPath","parentIsLocalized","parentPath","parentSchemaPath","req","selectedLocales","versionSiblingData","versionFields","fieldIndex","field","indexPath","path","schemaPath","index","clientField","get","payload","logger","error","clientFieldKey","clientSchemaMapKeys","Array","from","keys","msg","Error","versionField","isLocalized","fieldName","name","versionValue","comparisonValue","fieldByLocale","locale","localizedVersionField","buildVersionField","baseVersionField","localized","push","diffMethod","type","hasPermission","read","subFieldPermissions","CustomComponent","admin","components","Diff","DefaultComponent","tabs","tabIndex","tab","isNamedTab","tabIndexPath","tabPath","tabSchemaPath","label","arrayValue","isArray","rows","i","length","comparisonRow","versionRow","blocksValue","blockSlugToMatch","blockType","versionBlock","blocks","blockReferences","find","block","slug","comparisonBlockSlugToMatch","comparisonBlock","clientCellProps","undefined","serverCellProps","clientProps","Component","Fallback","importMap","key","serverProps"],"sources":["../../../../src/views/Version/RenderFieldsToDiff/buildVersionFields.tsx"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type {\n BaseVersionField,\n ClientField,\n ClientFieldSchemaMap,\n Field,\n FieldDiffClientProps,\n FieldDiffServerProps,\n FieldTypes,\n FlattenedBlock,\n PayloadComponent,\n PayloadRequest,\n SanitizedFieldPermissions,\n VersionField,\n} from 'payload'\nimport type { DiffMethod } from 'react-diff-viewer-continued'\n\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { dequal } from 'dequal/lite'\nimport { fieldIsID, fieldShouldBeLocalized, getUniqueListBy, tabHasName } from 'payload/shared'\n\nimport { diffMethods } from './fields/diffMethods.js'\nimport { diffComponents } from './fields/index.js'\nimport { getFieldPathsModified } from './utilities/getFieldPathsModified.js'\n\nexport type BuildVersionFieldsArgs = {\n clientSchemaMap: ClientFieldSchemaMap\n comparisonSiblingData: object\n customDiffComponents: Partial<\n Record<FieldTypes, PayloadComponent<FieldDiffServerProps, FieldDiffClientProps>>\n >\n entitySlug: string\n fieldPermissions:\n | {\n [key: string]: SanitizedFieldPermissions\n }\n | true\n fields: Field[]\n i18n: I18nClient\n modifiedOnly: boolean\n parentIndexPath: string\n parentIsLocalized: boolean\n parentPath: string\n parentSchemaPath: string\n req: PayloadRequest\n selectedLocales: string[]\n versionSiblingData: object\n}\n\n/**\n * Build up an object that contains rendered diff components for each field.\n * This is then sent to the client to be rendered.\n *\n * Here, the server is responsible for traversing through the document data and building up this\n * version state object.\n */\nexport const buildVersionFields = ({\n clientSchemaMap,\n comparisonSiblingData,\n customDiffComponents,\n entitySlug,\n fieldPermissions,\n fields,\n i18n,\n modifiedOnly,\n parentIndexPath,\n parentIsLocalized,\n parentPath,\n parentSchemaPath,\n req,\n selectedLocales,\n versionSiblingData,\n}: BuildVersionFieldsArgs): {\n versionFields: VersionField[]\n} => {\n const versionFields: VersionField[] = []\n let fieldIndex = -1\n for (const field of fields) {\n fieldIndex++\n if (fieldIsID(field)) {\n continue\n }\n\n const { indexPath, path, schemaPath } = getFieldPathsModified({\n field,\n index: fieldIndex,\n parentIndexPath: 'name' in field ? '' : parentIndexPath,\n parentPath,\n parentSchemaPath,\n })\n\n const clientField = clientSchemaMap.get(entitySlug + '.' + schemaPath)\n\n if (!clientField) {\n req.payload.logger.error({\n clientFieldKey: entitySlug + '.' + schemaPath,\n clientSchemaMapKeys: Array.from(clientSchemaMap.keys()),\n msg: 'No client field found for ' + entitySlug + '.' + schemaPath,\n parentPath,\n parentSchemaPath,\n path,\n schemaPath,\n })\n throw new Error('No client field found for ' + entitySlug + '.' + schemaPath)\n }\n\n const versionField: VersionField = {}\n const isLocalized = fieldShouldBeLocalized({ field, parentIsLocalized })\n\n const fieldName: null | string = 'name' in field ? field.name : null\n\n const versionValue = fieldName ? versionSiblingData?.[fieldName] : versionSiblingData\n\n const comparisonValue = fieldName ? comparisonSiblingData?.[fieldName] : comparisonSiblingData\n\n if (isLocalized) {\n versionField.fieldByLocale = {}\n\n for (const locale of selectedLocales) {\n const localizedVersionField = buildVersionField({\n clientField: clientField as ClientField,\n clientSchemaMap,\n comparisonValue: comparisonValue?.[locale],\n customDiffComponents,\n entitySlug,\n field,\n fieldPermissions,\n i18n,\n indexPath,\n locale,\n modifiedOnly,\n parentIsLocalized: true,\n parentPath,\n parentSchemaPath,\n path,\n req,\n schemaPath,\n selectedLocales,\n versionValue: versionValue?.[locale],\n })\n if (localizedVersionField) {\n versionField.fieldByLocale[locale] = localizedVersionField\n }\n }\n } else {\n const baseVersionField = buildVersionField({\n clientField: clientField as ClientField,\n clientSchemaMap,\n comparisonValue,\n customDiffComponents,\n entitySlug,\n field,\n fieldPermissions,\n i18n,\n indexPath,\n modifiedOnly,\n parentIsLocalized: parentIsLocalized || ('localized' in field && field.localized),\n parentPath,\n parentSchemaPath,\n path,\n req,\n schemaPath,\n selectedLocales,\n versionValue,\n })\n\n if (baseVersionField) {\n versionField.field = baseVersionField\n }\n }\n\n versionFields.push(versionField)\n }\n\n return {\n versionFields,\n }\n}\n\nconst buildVersionField = ({\n clientField,\n clientSchemaMap,\n comparisonValue,\n customDiffComponents,\n entitySlug,\n field,\n fieldPermissions,\n i18n,\n indexPath,\n locale,\n modifiedOnly,\n parentIsLocalized,\n parentPath,\n parentSchemaPath,\n path,\n req,\n schemaPath,\n selectedLocales,\n versionValue,\n}: {\n clientField: ClientField\n comparisonValue: unknown\n field: Field\n indexPath: string\n locale?: string\n modifiedOnly?: boolean\n parentIsLocalized: boolean\n path: string\n schemaPath: string\n versionValue: unknown\n} & Omit<\n BuildVersionFieldsArgs,\n 'comparisonSiblingData' | 'fields' | 'parentIndexPath' | 'versionSiblingData'\n>): BaseVersionField | null => {\n const fieldName: null | string = 'name' in field ? field.name : null\n\n const diffMethod: DiffMethod = diffMethods[field.type] || 'CHARS'\n\n const hasPermission =\n fieldPermissions === true ||\n !fieldName ||\n fieldPermissions?.[fieldName] === true ||\n fieldPermissions?.[fieldName]?.read\n\n const subFieldPermissions =\n fieldPermissions === true ||\n !fieldName ||\n fieldPermissions?.[fieldName] === true ||\n fieldPermissions?.[fieldName]?.fields\n\n if (!hasPermission) {\n return null\n }\n\n if (modifiedOnly && dequal(versionValue, comparisonValue)) {\n return null\n }\n\n const CustomComponent = field?.admin?.components?.Diff ?? customDiffComponents?.[field.type]\n const DefaultComponent = diffComponents?.[field.type]\n\n const baseVersionField: BaseVersionField = {\n type: field.type,\n fields: [],\n path,\n schemaPath,\n }\n\n if (field.type === 'tabs' && 'tabs' in field) {\n baseVersionField.tabs = []\n let tabIndex = -1\n for (const tab of field.tabs) {\n tabIndex++\n const isNamedTab = tabHasName(tab)\n\n const {\n indexPath: tabIndexPath,\n path: tabPath,\n schemaPath: tabSchemaPath,\n } = getFieldPathsModified({\n field: {\n ...tab,\n type: 'tab',\n },\n index: tabIndex,\n parentIndexPath: indexPath,\n parentPath,\n parentSchemaPath,\n })\n baseVersionField.tabs.push({\n name: 'name' in tab ? tab.name : null,\n fields: buildVersionFields({\n clientSchemaMap,\n comparisonSiblingData: 'name' in tab ? comparisonValue?.[tab.name] : comparisonValue,\n customDiffComponents,\n entitySlug,\n fieldPermissions,\n fields: tab.fields,\n i18n,\n modifiedOnly,\n parentIndexPath: isNamedTab ? '' : tabIndexPath,\n parentIsLocalized: parentIsLocalized || tab.localized,\n parentPath: tabPath,\n parentSchemaPath: tabSchemaPath,\n req,\n selectedLocales,\n versionSiblingData: 'name' in tab ? versionValue?.[tab.name] : versionValue,\n }).versionFields,\n label: tab.label,\n })\n }\n } // At this point, we are dealing with a `row`, etc\n else if ('fields' in field) {\n if (field.type === 'array' && versionValue) {\n const arrayValue = Array.isArray(versionValue) ? versionValue : []\n baseVersionField.rows = []\n\n for (let i = 0; i < arrayValue.length; i++) {\n const comparisonRow = comparisonValue?.[i] || {}\n const versionRow = arrayValue?.[i] || {}\n baseVersionField.rows[i] = buildVersionFields({\n clientSchemaMap,\n comparisonSiblingData: comparisonRow,\n customDiffComponents,\n entitySlug,\n fieldPermissions,\n fields: field.fields,\n i18n,\n modifiedOnly,\n parentIndexPath: 'name' in field ? '' : indexPath,\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: path + '.' + i,\n parentSchemaPath: schemaPath,\n req,\n selectedLocales,\n versionSiblingData: versionRow,\n }).versionFields\n }\n } else {\n baseVersionField.fields = buildVersionFields({\n clientSchemaMap,\n comparisonSiblingData: comparisonValue as object,\n customDiffComponents,\n entitySlug,\n fieldPermissions,\n fields: field.fields,\n i18n,\n modifiedOnly,\n parentIndexPath: 'name' in field ? '' : indexPath,\n parentIsLocalized: parentIsLocalized || ('localized' in field && field.localized),\n parentPath: path,\n parentSchemaPath: schemaPath,\n req,\n selectedLocales,\n versionSiblingData: versionValue as object,\n }).versionFields\n }\n } else if (field.type === 'blocks') {\n baseVersionField.rows = []\n\n const blocksValue = Array.isArray(versionValue) ? versionValue : []\n\n for (let i = 0; i < blocksValue.length; i++) {\n const comparisonRow = comparisonValue?.[i] || {}\n const versionRow = blocksValue[i] || {}\n\n const blockSlugToMatch: string = versionRow.blockType\n const versionBlock =\n req.payload.blocks[blockSlugToMatch] ??\n ((field.blockReferences ?? field.blocks).find(\n (block) => typeof block !== 'string' && block.slug === blockSlugToMatch,\n ) as FlattenedBlock | undefined)\n\n let fields = []\n\n if (versionRow.blockType === comparisonRow.blockType) {\n fields = versionBlock.fields\n } else {\n const comparisonBlockSlugToMatch: string = versionRow.blockType\n\n const comparisonBlock =\n req.payload.blocks[comparisonBlockSlugToMatch] ??\n ((field.blockReferences ?? field.blocks).find(\n (block) => typeof block !== 'string' && block.slug === comparisonBlockSlugToMatch,\n ) as FlattenedBlock | undefined)\n\n if (comparisonBlock) {\n fields = getUniqueListBy<Field>(\n [...versionBlock.fields, ...comparisonBlock.fields],\n 'name',\n )\n } else {\n fields = versionBlock.fields\n }\n }\n\n baseVersionField.rows[i] = buildVersionFields({\n clientSchemaMap,\n comparisonSiblingData: comparisonRow,\n customDiffComponents,\n entitySlug,\n fieldPermissions,\n fields,\n i18n,\n modifiedOnly,\n parentIndexPath: 'name' in field ? '' : indexPath,\n parentIsLocalized: parentIsLocalized || ('localized' in field && field.localized),\n parentPath: path + '.' + i,\n parentSchemaPath: schemaPath + '.' + versionBlock.slug,\n req,\n selectedLocales,\n versionSiblingData: versionRow,\n }).versionFields\n }\n }\n\n const clientCellProps: FieldDiffClientProps = {\n baseVersionField: {\n ...baseVersionField,\n CustomComponent: undefined,\n },\n comparisonValue,\n diffMethod,\n field: clientField,\n fieldPermissions: subFieldPermissions,\n parentIsLocalized,\n versionValue,\n }\n\n const serverCellProps: FieldDiffServerProps = {\n ...clientCellProps,\n clientField,\n field,\n i18n,\n req,\n selectedLocales,\n }\n\n baseVersionField.CustomComponent = RenderServerComponent({\n clientProps: locale\n ? ({\n ...clientCellProps,\n locale,\n } as FieldDiffClientProps)\n : clientCellProps,\n Component: CustomComponent,\n Fallback: DefaultComponent,\n importMap: req.payload.importMap,\n key: 'diff component',\n serverProps: locale\n ? ({\n ...serverCellProps,\n locale,\n } as FieldDiffServerProps)\n : serverCellProps,\n })\n\n return baseVersionField\n}\n"],"mappings":"AAiBA,SAASA,qBAAqB,QAAQ;AACtC,SAASC,MAAM,QAAQ;AACvB,SAASC,SAAS,EAAEC,sBAAsB,EAAEC,eAAe,EAAEC,UAAU,QAAQ;AAE/E,SAASC,WAAW,QAAQ;AAC5B,SAASC,cAAc,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ;AA0BtC;;;;;;;AAOA,OAAO,MAAMC,kBAAA,GAAqBA,CAAC;EACjCC,eAAe;EACfC,qBAAqB;EACrBC,oBAAoB;EACpBC,UAAU;EACVC,gBAAgB;EAChBC,MAAM;EACNC,IAAI;EACJC,YAAY;EACZC,eAAe;EACfC,iBAAiB;EACjBC,UAAU;EACVC,gBAAgB;EAChBC,GAAG;EACHC,eAAe;EACfC;AAAkB,CACK;EAGvB,MAAMC,aAAA,GAAgC,EAAE;EACxC,IAAIC,UA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C;IACF,IACA4C;EACN;EAEA,OAAOzC,gBAAA;AACT","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Collapsible/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,SAAS,CAAA;AAYlE,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Collapsible/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,SAAS,CAAA;AAYlE,eAAO,MAAM,WAAW,EAAE,mCAgCzB,CAAA"}
|
|
@@ -10,11 +10,12 @@ 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,
|
|
17
17
|
field,
|
|
18
|
+
parentIsLocalized,
|
|
18
19
|
versionValue
|
|
19
20
|
} = t0;
|
|
20
21
|
const {
|
|
@@ -37,15 +38,17 @@ export const Collapsible = t0 => {
|
|
|
37
38
|
} else {
|
|
38
39
|
t1 = $[2];
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const t2 = parentIsLocalized || field.localized;
|
|
42
|
+
let t3;
|
|
43
|
+
if ($[3] !== baseVersionField.fields || $[4] !== comparisonValue || $[5] !== field.fields || $[6] !== selectedLocales || $[7] !== t1 || $[8] !== t2 || $[9] !== versionValue) {
|
|
44
|
+
t3 = _jsx("div", {
|
|
43
45
|
className: baseClass,
|
|
44
46
|
children: _jsx(DiffCollapser, {
|
|
45
47
|
comparison: comparisonValue,
|
|
46
48
|
fields: field.fields,
|
|
47
49
|
label: t1,
|
|
48
50
|
locales: selectedLocales,
|
|
51
|
+
parentIsLocalized: t2,
|
|
49
52
|
version: versionValue,
|
|
50
53
|
children: _jsx(RenderVersionFieldsToDiff, {
|
|
51
54
|
versionFields: baseVersionField.fields
|
|
@@ -57,11 +60,12 @@ export const Collapsible = t0 => {
|
|
|
57
60
|
$[5] = field.fields;
|
|
58
61
|
$[6] = selectedLocales;
|
|
59
62
|
$[7] = t1;
|
|
60
|
-
$[8] =
|
|
61
|
-
$[9] =
|
|
63
|
+
$[8] = t2;
|
|
64
|
+
$[9] = versionValue;
|
|
65
|
+
$[10] = t3;
|
|
62
66
|
} else {
|
|
63
|
-
|
|
67
|
+
t3 = $[10];
|
|
64
68
|
}
|
|
65
|
-
return
|
|
69
|
+
return t3;
|
|
66
70
|
};
|
|
67
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","field","versionValue","i18n","selectedLocales","fields","length","t1","label","_jsx","children","t2","className","comparison","version","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,\n field,\n versionValue,\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 comparison={comparisonValue}\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 version={versionValue}\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;IAAAC,KAAA;IAAAC;EAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","getTranslation","useTranslation","React","useSelectedLocales","DiffCollapser","RenderVersionFieldsToDiff","baseClass","Collapsible","t0","$","baseVersionField","comparisonValue","field","parentIsLocalized","versionValue","i18n","selectedLocales","fields","length","t1","label","_jsx","children","t2","localized","t3","className","comparison","version","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,\n field,\n parentIsLocalized,\n versionValue,\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 comparison={comparisonValue}\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 version={versionValue}\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;IAAAC,KAAA;IAAAC,iBAAA;IAAAC;EAAA,IAAAN,EAMhE;EACC;IAAAO;EAAA,IAAiBd,cAAA;EACjB;IAAAe;EAAA,IAA4Bb,kBAAA;EAAA,KAEvBO,gBAAA,CAAAO,MAAA,EAAAC,MAAA;IAAA;EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAV,CAAA,QAAAG,KAAA,IAAAH,CAAA,QAAAM,IAAA;IAUGI,EAAA,cAAWP,KAAA,IACXA,KAAA,CAAAQ,KAAW,IACX,OAAOR,KAAA,CAAAQ,KAAA,KAAgB,cAAcC,IAAA,CAAC;MAAAC,QAAA,EAAMtB,cAAA,CAAeY,KAAA,CAAAQ,KAAA,EAAaL,IAAA;IAAA,C;;;;;;;EAGvD,MAAAQ,EAAA,GAAAV,iBAAA,IAAqBD,KAAA,CAAAY,SAAe;EAAA,IAAAC,EAAA;EAAA,IAAAhB,CAAA,QAAAC,gBAAA,CAAAO,MAAA,IAAAR,CAAA,QAAAE,eAAA,IAAAF,CAAA,QAAAG,KAAA,CAAAK,MAAA,IAAAR,CAAA,QAAAO,eAAA,IAAAP,CAAA,QAAAU,EAAA,IAAAV,CAAA,QAAAc,EAAA,IAAAd,CAAA,QAAAK,YAAA;IAV3DW,EAAA,GAAAJ,IAAA,CAAC;MAAAK,SAAA,EAAApB,SAAA;MAAAgB,QAAA,EACCD,IAAA,CAAAjB,aAAA;QAAAuB,UAAA,EACchB,eAAA;QAAAM,MAAA,EACJL,KAAA,CAAAK,MAAA;QAAAG,KAAA,EAEND,E;iBAIOH,eAAA;QAAAH,iBAAA,EACUU,EAAoC;QAAAK,OAAA,EAC9Cd,YAAA;QAAAQ,QAAA,EAETD,IAAA,CAAAhB,yBAAA;UAAAwB,aAAA,EAA0CnB,gBAAA,CAAAO;QAAA,C;;;;;;;;;;;;;;SAb9CQ,E;CAiBJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Group/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAA;AAI5D,OAAO,cAAc,CAAA;AAWrB,eAAO,MAAM,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Group/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAA;AAI5D,OAAO,cAAc,CAAA;AAWrB,eAAO,MAAM,KAAK,EAAE,6BAkCnB,CAAA"}
|
|
@@ -10,12 +10,13 @@ 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,
|
|
17
17
|
field,
|
|
18
18
|
locale,
|
|
19
|
+
parentIsLocalized,
|
|
19
20
|
versionValue
|
|
20
21
|
} = t0;
|
|
21
22
|
const {
|
|
@@ -39,15 +40,17 @@ export const Group = t0 => {
|
|
|
39
40
|
} else {
|
|
40
41
|
t1 = $[3];
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const t2 = parentIsLocalized || field.localized;
|
|
44
|
+
let t3;
|
|
45
|
+
if ($[4] !== baseVersionField.fields || $[5] !== comparisonValue || $[6] !== field.fields || $[7] !== selectedLocales || $[8] !== t1 || $[9] !== t2 || $[10] !== versionValue) {
|
|
46
|
+
t3 = _jsx("div", {
|
|
45
47
|
className: baseClass,
|
|
46
48
|
children: _jsx(DiffCollapser, {
|
|
47
49
|
comparison: comparisonValue,
|
|
48
50
|
fields: field.fields,
|
|
49
51
|
label: t1,
|
|
50
52
|
locales: selectedLocales,
|
|
53
|
+
parentIsLocalized: t2,
|
|
51
54
|
version: versionValue,
|
|
52
55
|
children: _jsx(RenderVersionFieldsToDiff, {
|
|
53
56
|
versionFields: baseVersionField.fields
|
|
@@ -59,11 +62,12 @@ export const Group = t0 => {
|
|
|
59
62
|
$[6] = field.fields;
|
|
60
63
|
$[7] = selectedLocales;
|
|
61
64
|
$[8] = t1;
|
|
62
|
-
$[9] =
|
|
63
|
-
$[10] =
|
|
65
|
+
$[9] = t2;
|
|
66
|
+
$[10] = versionValue;
|
|
67
|
+
$[11] = t3;
|
|
64
68
|
} else {
|
|
65
|
-
|
|
69
|
+
t3 = $[11];
|
|
66
70
|
}
|
|
67
|
-
return
|
|
71
|
+
return t3;
|
|
68
72
|
};
|
|
69
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","field","locale","versionValue","i18n","selectedLocales","t1","label","_jsxs","children","_jsx","className","t2","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","getTranslation","useTranslation","React","useSelectedLocales","DiffCollapser","RenderVersionFieldsToDiff","baseClass","Group","t0","$","baseVersionField","comparisonValue","field","locale","parentIsLocalized","versionValue","i18n","selectedLocales","t1","label","_jsxs","children","_jsx","className","t2","localized","t3","fields","comparison","version","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,\n field,\n locale,\n parentIsLocalized,\n versionValue,\n}) => {\n const { i18n } = useTranslation()\n const { selectedLocales } = useSelectedLocales()\n\n return (\n <div className={baseClass}>\n <DiffCollapser\n comparison={comparisonValue}\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 version={versionValue}\n >\n <RenderVersionFieldsToDiff versionF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AAA;IAf3DW,EAAA,GAAAJ,IAAA,CAAC;MAAAC,SAAA,EAAAjB,SAAA;MAAAe,QAAA,EACCC,IAAA,CAAAlB,aAAA;QAAAwB,UAAA,EACcjB,eAAA;QAAAgB,MAAA,EACJf,KAAA,CAAAe,MAAA;QAAAR,KAAA,EAEND,E;iBASOD,eAAA;QAAAH,iBAAA,EACUU,EAAoC;QAAAK,OAAA,EAC9Cd,YAAA;QAAAM,QAAA,EAETC,IAAA,CAAAjB,yBAAA;UAAAyB,aAAA,EAA0CpB,gBAAA,CAAAiB;QAAA,C;;;;;;;;;;;;;;SAlB9CD,E;CAsBJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Iterable/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAKnD,OAAO,cAAc,CAAA;AAGrB,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Iterable/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAKnD,OAAO,cAAc,CAAA;AAGrB,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAwFnD,CAAA"}
|
|
@@ -12,12 +12,13 @@ import { RenderVersionFieldsToDiff } from '../../RenderVersionFieldsToDiff.js';
|
|
|
12
12
|
import { getFieldsForRowComparison } from '../../utilities/getFieldsForRowComparison.js';
|
|
13
13
|
const baseClass = 'iterable-diff';
|
|
14
14
|
export const Iterable = t0 => {
|
|
15
|
-
const $ = _c(
|
|
15
|
+
const $ = _c(15);
|
|
16
16
|
const {
|
|
17
17
|
baseVersionField,
|
|
18
18
|
comparisonValue,
|
|
19
19
|
field,
|
|
20
20
|
locale,
|
|
21
|
+
parentIsLocalized,
|
|
21
22
|
versionValue
|
|
22
23
|
} = t0;
|
|
23
24
|
const {
|
|
@@ -51,7 +52,7 @@ export const Iterable = t0 => {
|
|
|
51
52
|
t1 = $[3];
|
|
52
53
|
}
|
|
53
54
|
let t2;
|
|
54
|
-
if ($[4] !== baseVersionField || $[5] !== comparisonValue || $[6] !== config || $[7] !== field || $[8] !== i18n || $[9] !== maxRows || $[10] !==
|
|
55
|
+
if ($[4] !== baseVersionField || $[5] !== comparisonValue || $[6] !== config || $[7] !== field || $[8] !== i18n || $[9] !== maxRows || $[10] !== parentIsLocalized || $[11] !== selectedLocales || $[12] !== t1 || $[13] !== versionValue) {
|
|
55
56
|
t2 = _jsx("div", {
|
|
56
57
|
className: baseClass,
|
|
57
58
|
children: _jsxs(DiffCollapser, {
|
|
@@ -60,6 +61,7 @@ export const Iterable = t0 => {
|
|
|
60
61
|
isIterable: true,
|
|
61
62
|
label: t1,
|
|
62
63
|
locales: selectedLocales,
|
|
64
|
+
parentIsLocalized,
|
|
63
65
|
version: versionValue,
|
|
64
66
|
children: [maxRows > 0 && _jsx("div", {
|
|
65
67
|
className: `${baseClass}__rows`,
|
|
@@ -86,6 +88,7 @@ export const Iterable = t0 => {
|
|
|
86
88
|
fields,
|
|
87
89
|
label: rowLabel,
|
|
88
90
|
locales: selectedLocales,
|
|
91
|
+
parentIsLocalized: parentIsLocalized || field.localized,
|
|
89
92
|
version: versionRow,
|
|
90
93
|
children: _jsx(RenderVersionFieldsToDiff, {
|
|
91
94
|
versionFields
|
|
@@ -107,12 +110,13 @@ export const Iterable = t0 => {
|
|
|
107
110
|
$[7] = field;
|
|
108
111
|
$[8] = i18n;
|
|
109
112
|
$[9] = maxRows;
|
|
110
|
-
$[10] =
|
|
111
|
-
$[11] =
|
|
112
|
-
$[12] =
|
|
113
|
-
$[13] =
|
|
113
|
+
$[10] = parentIsLocalized;
|
|
114
|
+
$[11] = selectedLocales;
|
|
115
|
+
$[12] = t1;
|
|
116
|
+
$[13] = versionValue;
|
|
117
|
+
$[14] = t2;
|
|
114
118
|
} else {
|
|
115
|
-
t2 = $[
|
|
119
|
+
t2 = $[14];
|
|
116
120
|
}
|
|
117
121
|
return t2;
|
|
118
122
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","getTranslation","useConfig","useTranslation","fieldIsArrayType","fieldIsBlockType","React","useSelectedLocales","DiffCollapser","RenderVersionFieldsToDiff","getFieldsForRowComparison","baseClass","Iterable","t0","$","baseVersionField","comparisonValue","field","locale","versionValue","i18n","selectedLocales","config","versionRowCount","Array","isArray","length","comparisonRowCount","maxRows","Math","max","Error","type","t1","label","_jsxs","children","_jsx","className","t2","comparison","isIterable","version","from","keys","map","row","i","versionRow","comparisonRow","fields","versionFields","rowNumber","String","padStart","rowLabel","locales","t","labels","plural"],"sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Iterable/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldDiffClientProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { useConfig, useTranslation } from '@payloadcms/ui'\n\nimport './index.scss'\n\nimport { fieldIsArrayType, fieldIsBlockType } from 'payload/shared'\nimport React from 'react'\n\nimport { useSelectedLocales } from '../../../Default/SelectedLocalesContext.js'\nimport { DiffCollapser } from '../../DiffCollapser/index.js'\nimport { RenderVersionFieldsToDiff } from '../../RenderVersionFieldsToDiff.js'\nimport { getFieldsForRowComparison } from '../../utilities/getFieldsForRowComparison.js'\n\nconst baseClass = 'iterable-diff'\n\nexport const Iterable: React.FC<FieldDiffClientProps> = ({\n baseVersionField,\n comparisonValue,\n field,\n locale,\n versionValue,\n}) => {\n const { i18n } = useTranslation()\n const { selectedLocales } = useSelectedLocales()\n const { config } = useConfig()\n\n const versionRowCount = Array.isArray(versionValue) ? versionValue.length : 0\n const comparisonRowCount = Array.isArray(comparisonValue) ? comparisonValue.length : 0\n const maxRows = Math.max(versionRowCount, comparisonRowCount)\n\n if (!fieldIsArrayType(field) && !fieldIsBlockType(field)) {\n throw new Error(`Expected field to be an array or blocks type but got: ${field.type}`)\n }\n\n return (\n <div className={baseClass}>\n <DiffCollapser\n comparison={comparisonValue}\n field={field}\n isIterable\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 version={versionValue}\n >\n {maxRows > 0 && (\n <div className={`${baseClass}__rows`}>\n {Array.from(Array(maxRows).keys()).map((row, i) => {\n const versionRow = versionValue?.[i] || {}\n const comparisonRow = comparisonValue?.[i] || {}\n\n const { fields, versionFields } = getFieldsForRowComparison({\n baseVersionField,\n comparisonRow,\n config,\n field,\n row: i,\n versionRow,\n })\n\n const rowNumber = String(i + 1).padStart(2, '0')\n const rowLabel = fieldIsArrayType(field) ? `Item ${rowNumber}` : `Block ${rowNumber}`\n\n return (\n <div className={`${baseClass}__row`} key={i}>\n <DiffCollapser\n comparison={comparisonRow}\n fields={fields}\n label={rowLabel}\n locales={selectedLocales}\n version={versionRow}\n >\n <RenderVersionFieldsToDiff versionFields={versionFields} />\n </DiffCollapser>\n </div>\n )\n })}\n </div>\n )}\n {maxRows === 0 && (\n <div className={`${baseClass}__no-rows`}>\n {i18n.t('version:noRowsFound', {\n label:\n 'labels' in field && field.labels?.plural\n ? getTranslation(field.labels.plural, i18n)\n : i18n.t('general:rows'),\n })}\n </div>\n )}\n </DiffCollapser>\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,cAAc,QAAQ;AAC/B,SAASC,SAAS,EAAEC,cAAc,QAAQ;AAI1C,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ;AACnD,OAAOC,KAAA,MAAW;AAElB,SAASC,kBAAkB,QAAQ;AACnC,SAASC,aAAa,QAAQ;AAC9B,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,yBAAyB,QAAQ;AAE1C,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,QAAA,GAA2CC,EAAA;EAAA,MAAAC,CAAA,GAAAd,EAAA;EAAC;IAAAe,gBAAA;IAAAC,eAAA;IAAAC,KAAA;IAAAC,MAAA;IAAAC;EAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","getTranslation","useConfig","useTranslation","fieldIsArrayType","fieldIsBlockType","React","useSelectedLocales","DiffCollapser","RenderVersionFieldsToDiff","getFieldsForRowComparison","baseClass","Iterable","t0","$","baseVersionField","comparisonValue","field","locale","parentIsLocalized","versionValue","i18n","selectedLocales","config","versionRowCount","Array","isArray","length","comparisonRowCount","maxRows","Math","max","Error","type","t1","label","_jsxs","children","_jsx","className","t2","comparison","isIterable","version","from","keys","map","row","i","versionRow","comparisonRow","fields","versionFields","rowNumber","String","padStart","rowLabel","locales","localized","t","labels","plural"],"sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Iterable/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldDiffClientProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { useConfig, useTranslation } from '@payloadcms/ui'\n\nimport './index.scss'\n\nimport { fieldIsArrayType, fieldIsBlockType } from 'payload/shared'\nimport React from 'react'\n\nimport { useSelectedLocales } from '../../../Default/SelectedLocalesContext.js'\nimport { DiffCollapser } from '../../DiffCollapser/index.js'\nimport { RenderVersionFieldsToDiff } from '../../RenderVersionFieldsToDiff.js'\nimport { getFieldsForRowComparison } from '../../utilities/getFieldsForRowComparison.js'\n\nconst baseClass = 'iterable-diff'\n\nexport const Iterable: React.FC<FieldDiffClientProps> = ({\n baseVersionField,\n comparisonValue,\n field,\n locale,\n parentIsLocalized,\n versionValue,\n}) => {\n const { i18n } = useTranslation()\n const { selectedLocales } = useSelectedLocales()\n const { config } = useConfig()\n\n const versionRowCount = Array.isArray(versionValue) ? versionValue.length : 0\n const comparisonRowCount = Array.isArray(comparisonValue) ? comparisonValue.length : 0\n const maxRows = Math.max(versionRowCount, comparisonRowCount)\n\n if (!fieldIsArrayType(field) && !fieldIsBlockType(field)) {\n throw new Error(`Expected field to be an array or blocks type but got: ${field.type}`)\n }\n\n return (\n <div className={baseClass}>\n <DiffCollapser\n comparison={comparisonValue}\n field={field}\n isIterable\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}\n version={versionValue}\n >\n {maxRows > 0 && (\n <div className={`${baseClass}__rows`}>\n {Array.from(Array(maxRows).keys()).map((row, i) => {\n const versionRow = versionValue?.[i] || {}\n const comparisonRow = comparisonValue?.[i] || {}\n\n const { fields, versionFields } = getFieldsForRowComparison({\n baseVersionField,\n comparisonRow,\n config,\n field,\n row: i,\n versionRow,\n })\n\n const rowNumber = String(i + 1).padStart(2, '0')\n const rowLabel = fieldIsArrayType(field) ? `Item ${rowNumber}` : `Block ${rowNumber}`\n\n return (\n <div className={`${baseClass}__row`} key={i}>\n <DiffCollapser\n comparison={comparisonRow}\n fields={fields}\n label={rowLabel}\n locales={selectedLocales}\n parentIsLocalized={parentIsLocalized || field.localized}\n version={versionRow}\n >\n <RenderVersionFieldsToDiff versionFields={versionFields} />\n </DiffCollapser>\n </div>\n )\n })}\n </div>\n )}\n {maxRows === 0 && (\n <div className={`${baseClass}__no-rows`}>\n {i18n.t('version:noRowsFound', {\n label:\n 'labels' in field && field.labels?.plural\n ? getTranslation(field.labels.plural, i18n)\n : i18n.t('general:rows'),\n })}\n </div>\n )}\n </DiffCollapser>\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SA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AAAhB,KAAA,EAELqB,QAAA;gBAAAC,OAAA,EACEnC,eAAA;gBAAAH,iBAAA,EACUA,iBAAA,IAAqBF,KAAA,CAAAyC,SAAe;gBAAAf,OAAA,EAC9CM,UAAA;gBAAAZ,QAAA,EAETC,IAAA,CAAA7B,yBAAA;kBAAA2C;gBAAA,C;;eATsCJ,CAAA;UAAA,CAa9C;QAAA,C,GAGHnB,OAAA,MAAY,IACXS,IAAA,CAAC;UAAAC,SAAA,EAAe,GAAA5B,SAAA,WAAuB;UAAA0B,QAAA,EACpChB,IAAA,CAAAsC,CAAA,CAAO;YAAAxB,KAAA,EAEJ,YAAYlB,KAAA,IAASA,KAAA,CAAA2C,MAAA,EAAAC,MAAc,GAC/B5D,cAAA,CAAegB,KAAA,CAAA2C,MAAA,CAAAC,MAAA,EAAqBxC,IAAA,IACpCA,IAAA,CAAAsC,CAAA,CAAO;UAAA,CACf;QAAA,C;;;;;;;;;;;;;;;;;SA7DRnB,E;CAmEJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Relationship/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Relationship/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,oCAAoC,EACrC,MAAM,SAAS,CAAA;AAShB,OAAO,cAAc,CAAA;AAwFrB,eAAO,MAAM,YAAY,EAAE,oCAkF1B,CAAA"}
|
|
@@ -4,15 +4,15 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
4
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { getTranslation } from '@payloadcms/translations';
|
|
6
6
|
import { useConfig, useTranslation } from '@payloadcms/ui';
|
|
7
|
-
import { fieldAffectsData, fieldIsPresentationalOnly } from 'payload/shared';
|
|
7
|
+
import { fieldAffectsData, fieldIsPresentationalOnly, fieldShouldBeLocalized } from 'payload/shared';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import ReactDiffViewer from 'react-diff-viewer-continued';
|
|
10
10
|
import Label from '../../Label/index.js';
|
|
11
11
|
import { diffStyles } from '../styles.js';
|
|
12
12
|
const baseClass = 'relationship-diff';
|
|
13
|
-
const generateLabelFromValue = (collections, field, locale, value) => {
|
|
13
|
+
const generateLabelFromValue = (collections, field, locale, value, config, parentIsLocalized) => {
|
|
14
14
|
if (Array.isArray(value)) {
|
|
15
|
-
return value.map(v => generateLabelFromValue(collections, field, locale, v)).filter(Boolean) // Filters out any undefined or empty values
|
|
15
|
+
return value.map(v => generateLabelFromValue(collections, field, locale, v, config, parentIsLocalized)).filter(Boolean) // Filters out any undefined or empty values
|
|
16
16
|
.join(', ');
|
|
17
17
|
}
|
|
18
18
|
let relatedDoc;
|
|
@@ -34,7 +34,10 @@ const generateLabelFromValue = (collections, field, locale, value) => {
|
|
|
34
34
|
const useAsTitleField = relatedCollection.fields.find(f => fieldAffectsData(f) && !fieldIsPresentationalOnly(f) && f.name === useAsTitle);
|
|
35
35
|
let titleFieldIsLocalized = false;
|
|
36
36
|
if (useAsTitleField && fieldAffectsData(useAsTitleField)) {
|
|
37
|
-
titleFieldIsLocalized =
|
|
37
|
+
titleFieldIsLocalized = fieldShouldBeLocalized({
|
|
38
|
+
field: useAsTitleField,
|
|
39
|
+
parentIsLocalized
|
|
40
|
+
});
|
|
38
41
|
}
|
|
39
42
|
if (typeof relatedDoc?.[useAsTitle] !== 'undefined') {
|
|
40
43
|
valueToReturn = relatedDoc[useAsTitle];
|
|
@@ -60,16 +63,20 @@ const generateLabelFromValue = (collections, field, locale, value) => {
|
|
|
60
63
|
return valueToReturn;
|
|
61
64
|
};
|
|
62
65
|
export const Relationship = t0 => {
|
|
63
|
-
const $ = _c(
|
|
66
|
+
const $ = _c(12);
|
|
64
67
|
const {
|
|
65
68
|
comparisonValue,
|
|
66
69
|
field,
|
|
67
70
|
locale,
|
|
71
|
+
parentIsLocalized,
|
|
68
72
|
versionValue
|
|
69
73
|
} = t0;
|
|
70
74
|
const {
|
|
71
75
|
i18n
|
|
72
76
|
} = useTranslation();
|
|
77
|
+
const {
|
|
78
|
+
config
|
|
79
|
+
} = useConfig();
|
|
73
80
|
const placeholder = `[${i18n.t("general:noValue")}]`;
|
|
74
81
|
const {
|
|
75
82
|
config: t1
|
|
@@ -78,34 +85,34 @@ export const Relationship = t0 => {
|
|
|
78
85
|
collections
|
|
79
86
|
} = t1;
|
|
80
87
|
let t2;
|
|
81
|
-
if ($[0] !== collections || $[1] !== comparisonValue || $[2] !==
|
|
88
|
+
if ($[0] !== collections || $[1] !== comparisonValue || $[2] !== config || $[3] !== field || $[4] !== i18n || $[5] !== locale || $[6] !== parentIsLocalized || $[7] !== placeholder || $[8] !== versionValue) {
|
|
82
89
|
let versionToRender = placeholder;
|
|
83
90
|
let comparisonToRender = placeholder;
|
|
84
91
|
if (versionValue) {
|
|
85
92
|
if ("hasMany" in field && field.hasMany && Array.isArray(versionValue)) {
|
|
86
|
-
versionToRender = versionValue.map(val => generateLabelFromValue(collections, field, locale, val)).join(", ") || placeholder;
|
|
93
|
+
versionToRender = versionValue.map(val => generateLabelFromValue(collections, field, locale, val, config, parentIsLocalized)).join(", ") || placeholder;
|
|
87
94
|
} else {
|
|
88
|
-
versionToRender = generateLabelFromValue(collections, field, locale, versionValue) || placeholder;
|
|
95
|
+
versionToRender = generateLabelFromValue(collections, field, locale, versionValue, config, parentIsLocalized) || placeholder;
|
|
89
96
|
}
|
|
90
97
|
}
|
|
91
98
|
if (comparisonValue) {
|
|
92
99
|
if ("hasMany" in field && field.hasMany && Array.isArray(comparisonValue)) {
|
|
93
|
-
comparisonToRender = comparisonValue.map(val_0 => generateLabelFromValue(collections, field, locale, val_0)).join(", ") || placeholder;
|
|
100
|
+
comparisonToRender = comparisonValue.map(val_0 => generateLabelFromValue(collections, field, locale, val_0, config, parentIsLocalized)).join(", ") || placeholder;
|
|
94
101
|
} else {
|
|
95
|
-
comparisonToRender = generateLabelFromValue(collections, field, locale, comparisonValue) || placeholder;
|
|
102
|
+
comparisonToRender = generateLabelFromValue(collections, field, locale, comparisonValue, config, parentIsLocalized) || placeholder;
|
|
96
103
|
}
|
|
97
104
|
}
|
|
98
105
|
const label = "label" in field && typeof field.label !== "boolean" && typeof field.label !== "function" ? field.label : "";
|
|
99
106
|
let t3;
|
|
100
|
-
if ($[
|
|
107
|
+
if ($[10] !== locale) {
|
|
101
108
|
t3 = locale && _jsx("span", {
|
|
102
109
|
className: `${baseClass}__locale-label`,
|
|
103
110
|
children: locale
|
|
104
111
|
});
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
112
|
+
$[10] = locale;
|
|
113
|
+
$[11] = t3;
|
|
107
114
|
} else {
|
|
108
|
-
t3 = $[
|
|
115
|
+
t3 = $[11];
|
|
109
116
|
}
|
|
110
117
|
t2 = _jsxs("div", {
|
|
111
118
|
className: baseClass,
|
|
@@ -122,14 +129,16 @@ export const Relationship = t0 => {
|
|
|
122
129
|
});
|
|
123
130
|
$[0] = collections;
|
|
124
131
|
$[1] = comparisonValue;
|
|
125
|
-
$[2] =
|
|
126
|
-
$[3] =
|
|
127
|
-
$[4] =
|
|
128
|
-
$[5] =
|
|
129
|
-
$[6] =
|
|
130
|
-
$[7] =
|
|
132
|
+
$[2] = config;
|
|
133
|
+
$[3] = field;
|
|
134
|
+
$[4] = i18n;
|
|
135
|
+
$[5] = locale;
|
|
136
|
+
$[6] = parentIsLocalized;
|
|
137
|
+
$[7] = placeholder;
|
|
138
|
+
$[8] = versionValue;
|
|
139
|
+
$[9] = t2;
|
|
131
140
|
} else {
|
|
132
|
-
t2 = $[
|
|
141
|
+
t2 = $[9];
|
|
133
142
|
}
|
|
134
143
|
return t2;
|
|
135
144
|
};
|