@payloadcms/next 3.35.0-internal.5e55452 → 3.35.0-internal.b3d367c
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/prod/styles.css +1 -1
- package/dist/views/Version/Default/SetStepNav.d.ts +2 -2
- package/dist/views/Version/Default/SetStepNav.d.ts.map +1 -1
- package/dist/views/Version/Default/SetStepNav.js +4 -5
- package/dist/views/Version/Default/SetStepNav.js.map +1 -1
- package/dist/views/Version/Default/index.d.ts.map +1 -1
- package/dist/views/Version/Default/index.js +332 -127
- package/dist/views/Version/Default/index.js.map +1 -1
- package/dist/views/Version/Default/index.scss +102 -32
- package/dist/views/Version/Default/types.d.ts +12 -8
- package/dist/views/Version/Default/types.d.ts.map +1 -1
- package/dist/views/Version/Default/types.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.d.ts +4 -4
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js +32 -33
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.scss +30 -3
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.d.ts +6 -1
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js +21 -17
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.d.ts +4 -3
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +80 -55
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js +11 -11
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.d.ts +4 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.d.ts.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js +78 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.scss +4 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js +11 -11
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.scss +0 -10
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +20 -20
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.scss +3 -5
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +49 -58
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.scss +0 -11
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +39 -45
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.scss +0 -11
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +37 -37
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.scss +0 -11
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +77 -60
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.scss +0 -11
- package/dist/views/Version/RenderFieldsToDiff/fields/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js +2 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/index.js +1 -0
- package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
- package/dist/views/Version/Restore/index.d.ts.map +1 -1
- package/dist/views/Version/Restore/index.js +1 -1
- package/dist/views/Version/Restore/index.js.map +1 -1
- package/dist/views/Version/Restore/index.scss +6 -1
- package/dist/views/Version/SelectComparison/VersionPillLabel.d.ts +6 -0
- package/dist/views/Version/SelectComparison/VersionPillLabel.d.ts.map +1 -0
- package/dist/views/Version/SelectComparison/VersionPillLabel.js +70 -0
- package/dist/views/Version/SelectComparison/VersionPillLabel.js.map +1 -0
- package/dist/views/Version/SelectComparison/formatVersionPill.d.ts +8 -0
- package/dist/views/Version/SelectComparison/formatVersionPill.d.ts.map +1 -0
- package/dist/views/Version/SelectComparison/formatVersionPill.js +24 -0
- package/dist/views/Version/SelectComparison/formatVersionPill.js.map +1 -0
- package/dist/views/Version/SelectComparison/index.d.ts.map +1 -1
- package/dist/views/Version/SelectComparison/index.js +26 -68
- package/dist/views/Version/SelectComparison/index.js.map +1 -1
- package/dist/views/Version/SelectComparison/index.scss +0 -4
- package/dist/views/Version/SelectComparison/types.d.ts +4 -4
- package/dist/views/Version/SelectComparison/types.d.ts.map +1 -1
- package/dist/views/Version/SelectComparison/types.js.map +1 -1
- package/dist/views/Version/SelectLocales/index.d.ts +9 -2
- package/dist/views/Version/SelectLocales/index.d.ts.map +1 -1
- package/dist/views/Version/SelectLocales/index.js +33 -60
- package/dist/views/Version/SelectLocales/index.js.map +1 -1
- package/dist/views/Version/index.d.ts.map +1 -1
- package/dist/views/Version/index.js +105 -56
- package/dist/views/Version/index.js.map +1 -1
- package/dist/views/Versions/cells/AutosaveCell/index.d.ts.map +1 -1
- package/dist/views/Versions/cells/AutosaveCell/index.js +4 -4
- package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
- package/dist/views/Versions/getLatestVersion.d.ts +2 -2
- package/dist/views/Versions/getLatestVersion.d.ts.map +1 -1
- package/dist/views/Versions/getLatestVersion.js.map +1 -1
- package/package.json +7 -8
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.d.ts +0 -9
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.d.ts.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js +0 -23
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.d.ts +0 -9
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.d.ts.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.js +0 -23
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.d.ts +0 -7
- package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.d.ts.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.js +0 -7
- package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/styles.d.ts +0 -3
- package/dist/views/Version/RenderFieldsToDiff/fields/styles.d.ts.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/styles.js +0 -37
- package/dist/views/Version/RenderFieldsToDiff/fields/styles.js.map +0 -1
- package/dist/views/Version/SelectLocales/index.scss +0 -9
- package/dist/views/Version/SelectLocales/types.d.ts +0 -7
- package/dist/views/Version/SelectLocales/types.d.ts.map +0 -1
- package/dist/views/Version/SelectLocales/types.js +0 -2
- package/dist/views/Version/SelectLocales/types.js.map +0 -1
|
@@ -6,29 +6,32 @@ const baseClass = 'render-field-diffs';
|
|
|
6
6
|
import { ShimmerEffect } from '@payloadcms/ui';
|
|
7
7
|
import React, { Fragment, useEffect } from 'react';
|
|
8
8
|
export const RenderVersionFieldsToDiff = t0 => {
|
|
9
|
-
const $ = _c(
|
|
9
|
+
const $ = _c(6);
|
|
10
10
|
const {
|
|
11
|
+
parent: t1,
|
|
11
12
|
versionFields
|
|
12
13
|
} = t0;
|
|
14
|
+
const parent = t1 === undefined ? false : t1;
|
|
13
15
|
const [hasMounted, setHasMounted] = React.useState(false);
|
|
14
|
-
let t1;
|
|
15
16
|
let t2;
|
|
17
|
+
let t3;
|
|
16
18
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
17
|
-
|
|
19
|
+
t2 = () => {
|
|
18
20
|
setHasMounted(true);
|
|
19
21
|
};
|
|
20
|
-
|
|
21
|
-
$[0] =
|
|
22
|
-
$[1] =
|
|
22
|
+
t3 = [];
|
|
23
|
+
$[0] = t2;
|
|
24
|
+
$[1] = t3;
|
|
23
25
|
} else {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
t2 = $[0];
|
|
27
|
+
t3 = $[1];
|
|
26
28
|
}
|
|
27
|
-
useEffect(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
useEffect(t2, t3);
|
|
30
|
+
const t4 = `${baseClass}${parent ? ` ${baseClass}--parent` : ""}`;
|
|
31
|
+
let t5;
|
|
32
|
+
if ($[2] !== hasMounted || $[3] !== t4 || $[4] !== versionFields) {
|
|
33
|
+
t5 = _jsx("div", {
|
|
34
|
+
className: t4,
|
|
32
35
|
children: !hasMounted ? _jsx(Fragment, {
|
|
33
36
|
children: _jsx(ShimmerEffect, {
|
|
34
37
|
height: "8rem",
|
|
@@ -37,12 +40,13 @@ export const RenderVersionFieldsToDiff = t0 => {
|
|
|
37
40
|
}) : versionFields?.map(_temp)
|
|
38
41
|
});
|
|
39
42
|
$[2] = hasMounted;
|
|
40
|
-
$[3] =
|
|
41
|
-
$[4] =
|
|
43
|
+
$[3] = t4;
|
|
44
|
+
$[4] = versionFields;
|
|
45
|
+
$[5] = t5;
|
|
42
46
|
} else {
|
|
43
|
-
|
|
47
|
+
t5 = $[5];
|
|
44
48
|
}
|
|
45
|
-
return
|
|
49
|
+
return t5;
|
|
46
50
|
};
|
|
47
51
|
function _temp(field, fieldIndex) {
|
|
48
52
|
if (field.fieldByLocale) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderVersionFieldsToDiff.js","names":["c","_c","baseClass","ShimmerEffect","React","Fragment","useEffect","RenderVersionFieldsToDiff","t0","$","versionFields","hasMounted","setHasMounted","useState","
|
|
1
|
+
{"version":3,"file":"RenderVersionFieldsToDiff.js","names":["c","_c","baseClass","ShimmerEffect","React","Fragment","useEffect","RenderVersionFieldsToDiff","t0","$","parent","t1","versionFields","undefined","hasMounted","setHasMounted","useState","t2","t3","Symbol","for","t4","t5","_jsx","className","children","height","width","map","_temp","field","fieldIndex","fieldByLocale","LocaleComponents","locale","baseField","Object","entries","push","path","CustomComponent","join","type"],"sources":["../../../../src/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.tsx"],"sourcesContent":["'use client'\nconst baseClass = 'render-field-diffs'\nimport type { VersionField } from 'payload'\n\nimport './index.scss'\n\nimport { ShimmerEffect } from '@payloadcms/ui'\nimport React, { Fragment, useEffect } from 'react'\n\nexport const RenderVersionFieldsToDiff = ({\n parent = false,\n versionFields,\n}: {\n /**\n * If true, this is the parent render version fields component, not one nested in\n * a field with children (e.g. group)\n */\n parent?: boolean\n versionFields: VersionField[]\n}): React.ReactNode => {\n const [hasMounted, setHasMounted] = React.useState(false)\n\n // defer rendering until after the first mount as the CSS is loaded with Emotion\n // this will ensure that the CSS is loaded before rendering the diffs and prevent CLS\n useEffect(() => {\n setHasMounted(true)\n }, [])\n\n return (\n <div className={`${baseClass}${parent ? ` ${baseClass}--parent` : ''}`}>\n {!hasMounted ? (\n <Fragment>\n <ShimmerEffect height=\"8rem\" width=\"100%\" />\n </Fragment>\n ) : (\n versionFields?.map((field, fieldIndex) => {\n if (field.fieldByLocale) {\n const LocaleComponents: React.ReactNode[] = []\n for (const [locale, baseField] of Object.entries(field.fieldByLocale)) {\n LocaleComponents.push(\n <div\n className={`${baseClass}__locale`}\n data-field-path={baseField.path}\n data-locale={locale}\n key={[locale, fieldIndex].join('-')}\n >\n <div className={`${baseClass}__locale-value`}>{baseField.CustomComponent}</div>\n </div>,\n )\n }\n return (\n <div className={`${baseClass}__field`} key={fieldIndex}>\n {LocaleComponents}\n </div>\n )\n } else if (field.field) {\n return (\n <div\n className={`${baseClass}__field field__${field.field.type}`}\n data-field-path={field.field.path}\n key={fieldIndex}\n >\n {field.field.CustomComponent}\n </div>\n )\n }\n\n return null\n })\n )}\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,MAAMC,SAAA,GAAY;AAKlB,SAASC,aAAa,QAAQ;AAC9B,OAAOC,KAAA,IAASC,QAAQ,EAAEC,SAAS,QAAQ;AAE3C,OAAO,MAAMC,yBAAA,GAA4BC,EAAA;EAAA,MAAAC,CAAA,GAAAR,EAAA;EAAC;IAAAS,MAAA,EAAAC,EAAA;IAAAC;EAAA,IAAAJ,EAUzC;EATC,MAAAE,MAAA,GAAAC,EAAc,KAAAE,SAAA,WAAdF,EAAc;EAUd,OAAAG,UAAA,EAAAC,aAAA,IAAoCX,KAAA,CAAAY,QAAA,MAAe;EAAA,IAAAC,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAT,CAAA,QAAAU,MAAA,CAAAC,GAAA;IAIzCH,EAAA,GAAAA,CAAA;MACRF,aAAA,KAAc;IAAA;IACbG,EAAA;IAAET,CAAA,MA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,GADyCF,UAAA;EAAA;IAAA,IAIrCD,KAAA,CAAAA,KAAA;MAAA,OAEPP,IAAA,CAAC;QAAAC,SAAA,EACY,GAAAtB,SAAA,kBAA8B4B,KAAA,CAAAA,KAAA,CAAAY,IAAA,EAAkB;QAAA,mBAC1CZ,KAAA,CAAAA,KAAA,CAAAS,IAAA;QAAAd,QAAA,EAGhBK,KAAA,CAAAA,KAAA,CAAAU;MAAA,GAFIT,UAAA;IAAA;EAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -2,7 +2,6 @@ import type { I18nClient } from '@payloadcms/translations';
|
|
|
2
2
|
import { type ClientFieldSchemaMap, type Field, type FieldDiffClientProps, type FieldDiffServerProps, type FieldTypes, type PayloadComponent, type PayloadRequest, type SanitizedFieldPermissions, type VersionField } from 'payload';
|
|
3
3
|
export type BuildVersionFieldsArgs = {
|
|
4
4
|
clientSchemaMap: ClientFieldSchemaMap;
|
|
5
|
-
comparisonSiblingData: object;
|
|
6
5
|
customDiffComponents: Partial<Record<FieldTypes, PayloadComponent<FieldDiffServerProps, FieldDiffClientProps>>>;
|
|
7
6
|
entitySlug: string;
|
|
8
7
|
fieldPermissions: {
|
|
@@ -11,13 +10,15 @@ export type BuildVersionFieldsArgs = {
|
|
|
11
10
|
fields: Field[];
|
|
12
11
|
i18n: I18nClient;
|
|
13
12
|
modifiedOnly: boolean;
|
|
13
|
+
nestingLevel?: number;
|
|
14
14
|
parentIndexPath: string;
|
|
15
15
|
parentIsLocalized: boolean;
|
|
16
16
|
parentPath: string;
|
|
17
17
|
parentSchemaPath: string;
|
|
18
18
|
req: PayloadRequest;
|
|
19
19
|
selectedLocales: string[];
|
|
20
|
-
|
|
20
|
+
versionFromSiblingData: object;
|
|
21
|
+
versionToSiblingData: object;
|
|
21
22
|
};
|
|
22
23
|
/**
|
|
23
24
|
* Build up an object that contains rendered diff components for each field.
|
|
@@ -26,7 +27,7 @@ export type BuildVersionFieldsArgs = {
|
|
|
26
27
|
* Here, the server is responsible for traversing through the document data and building up this
|
|
27
28
|
* version state object.
|
|
28
29
|
*/
|
|
29
|
-
export declare const buildVersionFields: ({ clientSchemaMap,
|
|
30
|
+
export declare const buildVersionFields: ({ clientSchemaMap, customDiffComponents, entitySlug, fieldPermissions, fields, i18n, modifiedOnly, nestingLevel, parentIndexPath, parentIsLocalized, parentPath, parentSchemaPath, req, selectedLocales, versionFromSiblingData, versionToSiblingData, }: BuildVersionFieldsArgs) => {
|
|
30
31
|
versionFields: VersionField[];
|
|
31
32
|
};
|
|
32
33
|
//# sourceMappingURL=buildVersionFields.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildVersionFields.d.ts","sourceRoot":"","sources":["../../../../src/views/Version/RenderFieldsToDiff/buildVersionFields.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"buildVersionFields.d.ts","sourceRoot":"","sources":["../../../../src/views/Version/RenderFieldsToDiff/buildVersionFields.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAI1D,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,KAAK,EACV,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,UAAU,EAGf,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,yBAAyB,EAC9B,KAAK,YAAY,EAClB,MAAM,SAAS,CAAA;AAMhB,MAAM,MAAM,sBAAsB,GAAG;IACnC,eAAe,EAAE,oBAAoB,CAAA;IACrC,oBAAoB,EAAE,OAAO,CAC3B,MAAM,CAAC,UAAU,EAAE,gBAAgB,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,CAAC,CACjF,CAAA;IACD,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EACZ;QACE,CAAC,GAAG,EAAE,MAAM,GAAG,yBAAyB,CAAA;KACzC,GACD,IAAI,CAAA;IACR,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,IAAI,EAAE,UAAU,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,CAAA;IACvB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,MAAM,CAAA;IACxB,GAAG,EAAE,cAAc,CAAA;IACnB,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,sBAAsB,EAAE,MAAM,CAAA;IAC9B,oBAAoB,EAAE,MAAM,CAAA;CAC7B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,6PAiB5B,sBAAsB,KAAG;IAC1B,aAAa,EAAE,YAAY,EAAE,CAAA;CAgH9B,CAAA"}
|
|
@@ -2,7 +2,6 @@ import { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerCompo
|
|
|
2
2
|
import { dequal } from 'dequal/lite';
|
|
3
3
|
import { MissingEditorProp } from 'payload';
|
|
4
4
|
import { fieldIsID, fieldShouldBeLocalized, getUniqueListBy, tabHasName } from 'payload/shared';
|
|
5
|
-
import { diffMethods } from './fields/diffMethods.js';
|
|
6
5
|
import { diffComponents } from './fields/index.js';
|
|
7
6
|
import { getFieldPathsModified } from './utilities/getFieldPathsModified.js';
|
|
8
7
|
/**
|
|
@@ -14,20 +13,21 @@ import { getFieldPathsModified } from './utilities/getFieldPathsModified.js';
|
|
|
14
13
|
*/
|
|
15
14
|
export const buildVersionFields = ({
|
|
16
15
|
clientSchemaMap,
|
|
17
|
-
comparisonSiblingData,
|
|
18
16
|
customDiffComponents,
|
|
19
17
|
entitySlug,
|
|
20
18
|
fieldPermissions,
|
|
21
19
|
fields,
|
|
22
20
|
i18n,
|
|
23
21
|
modifiedOnly,
|
|
22
|
+
nestingLevel = 0,
|
|
24
23
|
parentIndexPath,
|
|
25
24
|
parentIsLocalized,
|
|
26
25
|
parentPath,
|
|
27
26
|
parentSchemaPath,
|
|
28
27
|
req,
|
|
29
28
|
selectedLocales,
|
|
30
|
-
|
|
29
|
+
versionFromSiblingData,
|
|
30
|
+
versionToSiblingData
|
|
31
31
|
}) => {
|
|
32
32
|
const versionFields = [];
|
|
33
33
|
let fieldIndex = -1;
|
|
@@ -66,15 +66,14 @@ export const buildVersionFields = ({
|
|
|
66
66
|
parentIsLocalized
|
|
67
67
|
});
|
|
68
68
|
const fieldName = 'name' in field ? field.name : null;
|
|
69
|
-
const
|
|
70
|
-
const
|
|
69
|
+
const valueFrom = fieldName ? versionFromSiblingData?.[fieldName] : versionFromSiblingData;
|
|
70
|
+
const valueTo = fieldName ? versionToSiblingData?.[fieldName] : versionToSiblingData;
|
|
71
71
|
if (isLocalized) {
|
|
72
72
|
versionField.fieldByLocale = {};
|
|
73
73
|
for (const locale of selectedLocales) {
|
|
74
74
|
const localizedVersionField = buildVersionField({
|
|
75
75
|
clientField: clientField,
|
|
76
76
|
clientSchemaMap,
|
|
77
|
-
comparisonValue: comparisonValue?.[locale],
|
|
78
77
|
customDiffComponents,
|
|
79
78
|
entitySlug,
|
|
80
79
|
field,
|
|
@@ -83,6 +82,7 @@ export const buildVersionFields = ({
|
|
|
83
82
|
indexPath,
|
|
84
83
|
locale,
|
|
85
84
|
modifiedOnly,
|
|
85
|
+
nestingLevel,
|
|
86
86
|
parentIsLocalized: true,
|
|
87
87
|
parentPath,
|
|
88
88
|
parentSchemaPath,
|
|
@@ -90,7 +90,8 @@ export const buildVersionFields = ({
|
|
|
90
90
|
req,
|
|
91
91
|
schemaPath,
|
|
92
92
|
selectedLocales,
|
|
93
|
-
|
|
93
|
+
valueFrom: valueFrom?.[locale],
|
|
94
|
+
valueTo: valueTo?.[locale]
|
|
94
95
|
});
|
|
95
96
|
if (localizedVersionField) {
|
|
96
97
|
versionField.fieldByLocale[locale] = localizedVersionField;
|
|
@@ -100,7 +101,6 @@ export const buildVersionFields = ({
|
|
|
100
101
|
const baseVersionField = buildVersionField({
|
|
101
102
|
clientField: clientField,
|
|
102
103
|
clientSchemaMap,
|
|
103
|
-
comparisonValue,
|
|
104
104
|
customDiffComponents,
|
|
105
105
|
entitySlug,
|
|
106
106
|
field,
|
|
@@ -108,6 +108,7 @@ export const buildVersionFields = ({
|
|
|
108
108
|
i18n,
|
|
109
109
|
indexPath,
|
|
110
110
|
modifiedOnly,
|
|
111
|
+
nestingLevel,
|
|
111
112
|
parentIsLocalized: parentIsLocalized || 'localized' in field && field.localized,
|
|
112
113
|
parentPath,
|
|
113
114
|
parentSchemaPath,
|
|
@@ -115,13 +116,16 @@ export const buildVersionFields = ({
|
|
|
115
116
|
req,
|
|
116
117
|
schemaPath,
|
|
117
118
|
selectedLocales,
|
|
118
|
-
|
|
119
|
+
valueFrom,
|
|
120
|
+
valueTo
|
|
119
121
|
});
|
|
120
122
|
if (baseVersionField) {
|
|
121
123
|
versionField.field = baseVersionField;
|
|
122
124
|
}
|
|
123
125
|
}
|
|
124
|
-
|
|
126
|
+
if (versionField.field || versionField.fieldByLocale && Object.keys(versionField.fieldByLocale).length) {
|
|
127
|
+
versionFields.push(versionField);
|
|
128
|
+
}
|
|
125
129
|
}
|
|
126
130
|
return {
|
|
127
131
|
versionFields
|
|
@@ -130,7 +134,6 @@ export const buildVersionFields = ({
|
|
|
130
134
|
const buildVersionField = ({
|
|
131
135
|
clientField,
|
|
132
136
|
clientSchemaMap,
|
|
133
|
-
comparisonValue,
|
|
134
137
|
customDiffComponents,
|
|
135
138
|
entitySlug,
|
|
136
139
|
field,
|
|
@@ -139,6 +142,7 @@ const buildVersionField = ({
|
|
|
139
142
|
indexPath,
|
|
140
143
|
locale,
|
|
141
144
|
modifiedOnly,
|
|
145
|
+
nestingLevel,
|
|
142
146
|
parentIsLocalized,
|
|
143
147
|
parentPath,
|
|
144
148
|
parentSchemaPath,
|
|
@@ -146,16 +150,16 @@ const buildVersionField = ({
|
|
|
146
150
|
req,
|
|
147
151
|
schemaPath,
|
|
148
152
|
selectedLocales,
|
|
149
|
-
|
|
153
|
+
valueFrom,
|
|
154
|
+
valueTo
|
|
150
155
|
}) => {
|
|
151
156
|
const fieldName = 'name' in field ? field.name : null;
|
|
152
|
-
const diffMethod = diffMethods[field.type] || 'CHARS';
|
|
153
157
|
const hasPermission = fieldPermissions === true || !fieldName || fieldPermissions?.[fieldName] === true || fieldPermissions?.[fieldName]?.read;
|
|
154
158
|
const subFieldPermissions = fieldPermissions === true || !fieldName || fieldPermissions?.[fieldName] === true || fieldPermissions?.[fieldName]?.fields;
|
|
155
159
|
if (!hasPermission) {
|
|
156
160
|
return null;
|
|
157
161
|
}
|
|
158
|
-
if (modifiedOnly && dequal(
|
|
162
|
+
if (modifiedOnly && dequal(valueFrom, valueTo)) {
|
|
159
163
|
return null;
|
|
160
164
|
}
|
|
161
165
|
let CustomComponent = customDiffComponents?.[field.type];
|
|
@@ -202,125 +206,152 @@ const buildVersionField = ({
|
|
|
202
206
|
parentPath,
|
|
203
207
|
parentSchemaPath
|
|
204
208
|
});
|
|
205
|
-
|
|
209
|
+
const tabVersion = {
|
|
206
210
|
name: 'name' in tab ? tab.name : null,
|
|
207
211
|
fields: buildVersionFields({
|
|
208
212
|
clientSchemaMap,
|
|
209
|
-
comparisonSiblingData: 'name' in tab ? comparisonValue?.[tab.name] : comparisonValue,
|
|
210
213
|
customDiffComponents,
|
|
211
214
|
entitySlug,
|
|
212
215
|
fieldPermissions,
|
|
213
216
|
fields: tab.fields,
|
|
214
217
|
i18n,
|
|
215
218
|
modifiedOnly,
|
|
219
|
+
nestingLevel: nestingLevel + 1,
|
|
216
220
|
parentIndexPath: isNamedTab ? '' : tabIndexPath,
|
|
217
221
|
parentIsLocalized: parentIsLocalized || tab.localized,
|
|
218
222
|
parentPath: isNamedTab ? tabPath : path,
|
|
219
223
|
parentSchemaPath: isNamedTab ? tabSchemaPath : parentSchemaPath,
|
|
220
224
|
req,
|
|
221
225
|
selectedLocales,
|
|
222
|
-
|
|
226
|
+
versionFromSiblingData: 'name' in tab ? valueFrom?.[tab.name] : valueFrom,
|
|
227
|
+
versionToSiblingData: 'name' in tab ? valueTo?.[tab.name] : valueTo
|
|
223
228
|
}).versionFields,
|
|
224
229
|
label: tab.label
|
|
225
|
-
}
|
|
230
|
+
};
|
|
231
|
+
if (tabVersion?.fields?.length) {
|
|
232
|
+
baseVersionField.tabs.push(tabVersion);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (modifiedOnly && !baseVersionField.tabs.length) {
|
|
236
|
+
return null;
|
|
226
237
|
}
|
|
227
238
|
} else if ('fields' in field) {
|
|
228
|
-
if (field.type === 'array' &&
|
|
229
|
-
const arrayValue = Array.isArray(
|
|
239
|
+
if (field.type === 'array' && valueTo) {
|
|
240
|
+
const arrayValue = Array.isArray(valueTo) ? valueTo : [];
|
|
230
241
|
baseVersionField.rows = [];
|
|
231
242
|
for (let i = 0; i < arrayValue.length; i++) {
|
|
232
|
-
const
|
|
233
|
-
const
|
|
243
|
+
const fromRow = valueFrom?.[i] || {};
|
|
244
|
+
const toRow = arrayValue?.[i] || {};
|
|
234
245
|
baseVersionField.rows[i] = buildVersionFields({
|
|
235
246
|
clientSchemaMap,
|
|
236
|
-
comparisonSiblingData: comparisonRow,
|
|
237
247
|
customDiffComponents,
|
|
238
248
|
entitySlug,
|
|
239
249
|
fieldPermissions,
|
|
240
250
|
fields: field.fields,
|
|
241
251
|
i18n,
|
|
242
252
|
modifiedOnly,
|
|
253
|
+
nestingLevel: nestingLevel + 2,
|
|
243
254
|
parentIndexPath: 'name' in field ? '' : indexPath,
|
|
244
255
|
parentIsLocalized: parentIsLocalized || field.localized,
|
|
245
256
|
parentPath: path + '.' + i,
|
|
246
257
|
parentSchemaPath: schemaPath,
|
|
247
258
|
req,
|
|
248
259
|
selectedLocales,
|
|
249
|
-
|
|
260
|
+
versionFromSiblingData: fromRow,
|
|
261
|
+
versionToSiblingData: toRow
|
|
250
262
|
}).versionFields;
|
|
251
263
|
}
|
|
252
264
|
} else {
|
|
253
265
|
baseVersionField.fields = buildVersionFields({
|
|
254
266
|
clientSchemaMap,
|
|
255
|
-
comparisonSiblingData: comparisonValue,
|
|
256
267
|
customDiffComponents,
|
|
257
268
|
entitySlug,
|
|
258
269
|
fieldPermissions,
|
|
259
270
|
fields: field.fields,
|
|
260
271
|
i18n,
|
|
261
272
|
modifiedOnly,
|
|
273
|
+
nestingLevel: field.type !== 'row' ? nestingLevel + 1 : nestingLevel,
|
|
262
274
|
parentIndexPath: 'name' in field ? '' : indexPath,
|
|
263
275
|
parentIsLocalized: parentIsLocalized || 'localized' in field && field.localized,
|
|
264
276
|
parentPath: 'name' in field ? path : parentPath,
|
|
265
277
|
parentSchemaPath: 'name' in field ? schemaPath : parentSchemaPath,
|
|
266
278
|
req,
|
|
267
279
|
selectedLocales,
|
|
268
|
-
|
|
280
|
+
versionFromSiblingData: valueFrom,
|
|
281
|
+
versionToSiblingData: valueTo
|
|
269
282
|
}).versionFields;
|
|
283
|
+
if (modifiedOnly && !baseVersionField.fields?.length) {
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
270
286
|
}
|
|
271
287
|
} else if (field.type === 'blocks') {
|
|
272
288
|
baseVersionField.rows = [];
|
|
273
|
-
const blocksValue = Array.isArray(
|
|
289
|
+
const blocksValue = Array.isArray(valueTo) ? valueTo : [];
|
|
274
290
|
for (let i = 0; i < blocksValue.length; i++) {
|
|
275
|
-
const
|
|
276
|
-
const
|
|
277
|
-
const blockSlugToMatch =
|
|
278
|
-
const
|
|
291
|
+
const fromRow = valueFrom?.[i] || {};
|
|
292
|
+
const toRow = blocksValue[i] || {};
|
|
293
|
+
const blockSlugToMatch = toRow.blockType;
|
|
294
|
+
const toBlock = req.payload.blocks[blockSlugToMatch] ?? (field.blockReferences ?? field.blocks).find(block => typeof block !== 'string' && block.slug === blockSlugToMatch);
|
|
279
295
|
let fields = [];
|
|
280
|
-
if (
|
|
281
|
-
fields =
|
|
296
|
+
if (toRow.blockType === fromRow.blockType) {
|
|
297
|
+
fields = toBlock.fields;
|
|
282
298
|
} else {
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
299
|
+
const fromBlockSlugToMatch = toRow.blockType // TODO: Verify this is correct
|
|
300
|
+
;
|
|
301
|
+
const fromBlock = req.payload.blocks[fromBlockSlugToMatch] ?? (field.blockReferences ?? field.blocks).find(block => typeof block !== 'string' && block.slug === fromBlockSlugToMatch);
|
|
302
|
+
if (fromBlock) {
|
|
303
|
+
fields = getUniqueListBy([...toBlock.fields, ...fromBlock.fields], 'name');
|
|
287
304
|
} else {
|
|
288
|
-
fields =
|
|
305
|
+
fields = toBlock.fields;
|
|
289
306
|
}
|
|
290
307
|
}
|
|
291
308
|
baseVersionField.rows[i] = buildVersionFields({
|
|
292
309
|
clientSchemaMap,
|
|
293
|
-
comparisonSiblingData: comparisonRow,
|
|
294
310
|
customDiffComponents,
|
|
295
311
|
entitySlug,
|
|
296
312
|
fieldPermissions,
|
|
297
313
|
fields,
|
|
298
314
|
i18n,
|
|
299
315
|
modifiedOnly,
|
|
316
|
+
nestingLevel: nestingLevel + 2,
|
|
300
317
|
parentIndexPath: 'name' in field ? '' : indexPath,
|
|
301
318
|
parentIsLocalized: parentIsLocalized || 'localized' in field && field.localized,
|
|
302
319
|
parentPath: path + '.' + i,
|
|
303
|
-
parentSchemaPath: schemaPath + '.' +
|
|
320
|
+
parentSchemaPath: schemaPath + '.' + toBlock.slug,
|
|
304
321
|
req,
|
|
305
322
|
selectedLocales,
|
|
306
|
-
|
|
323
|
+
versionFromSiblingData: fromRow,
|
|
324
|
+
versionToSiblingData: toRow
|
|
307
325
|
}).versionFields;
|
|
308
326
|
}
|
|
309
327
|
}
|
|
310
|
-
const
|
|
328
|
+
const clientDiffProps = {
|
|
311
329
|
baseVersionField: {
|
|
312
330
|
...baseVersionField,
|
|
313
331
|
CustomComponent: undefined
|
|
314
332
|
},
|
|
315
|
-
|
|
316
|
-
|
|
333
|
+
/**
|
|
334
|
+
* TODO: Change to valueFrom in 4.0
|
|
335
|
+
*/
|
|
336
|
+
comparisonValue: valueFrom,
|
|
337
|
+
/**
|
|
338
|
+
* @deprecated remove in 4.0. Each field should handle its own diffing logic
|
|
339
|
+
*/
|
|
340
|
+
diffMethod: 'diffWordsWithSpace',
|
|
317
341
|
field: clientField,
|
|
318
342
|
fieldPermissions: subFieldPermissions,
|
|
319
343
|
parentIsLocalized,
|
|
320
|
-
|
|
344
|
+
nestingLevel: nestingLevel ? nestingLevel : undefined,
|
|
345
|
+
/**
|
|
346
|
+
* TODO: Change to valueTo in 4.0
|
|
347
|
+
*/
|
|
348
|
+
versionValue: valueTo
|
|
321
349
|
};
|
|
322
|
-
|
|
323
|
-
|
|
350
|
+
if (locale) {
|
|
351
|
+
clientDiffProps.locale = locale;
|
|
352
|
+
}
|
|
353
|
+
const serverDiffProps = {
|
|
354
|
+
...clientDiffProps,
|
|
324
355
|
clientField,
|
|
325
356
|
field,
|
|
326
357
|
i18n,
|
|
@@ -328,18 +359,12 @@ const buildVersionField = ({
|
|
|
328
359
|
selectedLocales
|
|
329
360
|
};
|
|
330
361
|
baseVersionField.CustomComponent = RenderServerComponent({
|
|
331
|
-
clientProps:
|
|
332
|
-
...clientCellProps,
|
|
333
|
-
locale
|
|
334
|
-
} : clientCellProps,
|
|
362
|
+
clientProps: clientDiffProps,
|
|
335
363
|
Component: CustomComponent,
|
|
336
364
|
Fallback: DefaultComponent,
|
|
337
365
|
importMap: req.payload.importMap,
|
|
338
366
|
key: 'diff component',
|
|
339
|
-
serverProps:
|
|
340
|
-
...serverCellProps,
|
|
341
|
-
locale
|
|
342
|
-
} : serverCellProps
|
|
367
|
+
serverProps: serverDiffProps
|
|
343
368
|
});
|
|
344
369
|
return baseVersionField;
|
|
345
370
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildVersionFields.js","names":["RenderServerComponent","dequal","MissingEditorProp","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","editor","CellComponent","DiffComponent","admin","components","Diff","DefaultComponent","tabs","tabIndex","tab","isNamedTab","tabAsField","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 { DiffMethod } from 'react-diff-viewer-continued'\n\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { dequal } from 'dequal/lite'\nimport {\n type BaseVersionField,\n type ClientField,\n type ClientFieldSchemaMap,\n type Field,\n type FieldDiffClientProps,\n type FieldDiffServerProps,\n type FieldTypes,\n type FlattenedBlock,\n MissingEditorProp,\n type PayloadComponent,\n type PayloadRequest,\n type SanitizedFieldPermissions,\n type VersionField,\n} from 'payload'\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\n for (const field of fields) {\n fieldIndex++\n\n if (fieldIsID(field)) {\n continue\n }\n\n const { indexPath, path, schemaPath } = getFieldPathsModified({\n field,\n index: fieldIndex,\n 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 let CustomComponent = customDiffComponents?.[field.type]\n if (field?.type === 'richText') {\n if (!field?.editor) {\n throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n\n if (typeof field?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n if (field.editor.CellComponent) {\n CustomComponent = field.editor.DiffComponent\n }\n }\n if (field?.admin?.components?.Diff) {\n CustomComponent = field.admin.components.Diff\n }\n\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 tabAsField = { ...tab, type: 'tab' }\n\n const {\n indexPath: tabIndexPath,\n path: tabPath,\n schemaPath: tabSchemaPath,\n } = getFieldPathsModified({\n field: tabAsField,\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: isNamedTab ? tabPath : path,\n parentSchemaPath: isNamedTab ? tabSchemaPath : parentSchemaPath,\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`, `collapsible`, 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: 'name' in field ? path : parentPath,\n parentSchemaPath: 'name' in field ? schemaPath : parentSchemaPath,\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":"AAGA,SAASA,qBAAqB,QAAQ;AACtC,SAASC,MAAM,QAAQ;AACvB,SASEC,iBAAiB,QAKZ;AACP,SAASC,SAAS,EAAEC,sBAAsB,EAAEC,eAAe,EAAEC,UAAU,QAAQ;AAE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ACAC,YAAA;QACAC,eAAA,EAAiB,UAAUS,KAAA,GAAQ,KAAKC,SAAA;QACxCT,iBAAA,EAAmBA,iBAAA,IAAsB,eAAeQ,KAAA,IAASA,KAAA,CAAM4B,SAAS;QAChFnC,UAAA,EAAYS,IAAA,GAAO,MAAMqD,CAAA;QACzB7D,gBAAA,EAAkBS,UAAA,GAAa,MAAM2D,YAAA,CAAaK,IAAI;QACtDxE,GAAA;QACAC,eAAA;QACAC,kBAAA,EAAoB6D;MACtB,GAAG5D,aAAa;IAClB;EACF;EAEA,MAAMwE,eAAA,GAAwC;IAC5C3C,gBAAA,EAAkB;MAChB,GAAGA,gBAAgB;MACnBQ,eAAA,EAAiBoC;IACnB;IACAjD,eAAA;IACAQ,UAAA;IACA9B,KAAA,EAAOK,WAAA;IACPlB,gBAAA,EAAkB+C,mBAAA;IAClB1C,iBAAA;IACA6B;EACF;EAEA,MAAMmD,eAAA,GAAwC;IAC5C,GAAGF,eAAe;IAClBjE,WAAA;IACAL,KAAA;IACAX,IAAA;IACAM,GAAA;IACAC;EACF;EAEA+B,gBAAA,CAAiBQ,eAAe,GAAG/D,qBAAA,CAAsB;IACvDqG,WAAA,EAAajD,MAAA,GACR;MACC,GAAG8C,eAAe;MAClB9C;IACF,IACA8C,eAAA;IACJI,SAAA,EAAWvC,eAAA;IACXwC,QAAA,EAAUjC,gBAAA;IACVkC,SAAA,EAAWjF,GAAA,CAAIY,OAAO,CAACqE,SAAS;IAChCC,GAAA,EAAK;IACLC,WAAA,EAAatD,MAAA,GACR;MACC,GAAGgD,eAAe;MAClBhD;IACF,IACAgD;EACN;EAEA,OAAO7C,gBAAA;AACT","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"buildVersionFields.js","names":["RenderServerComponent","dequal","MissingEditorProp","fieldIsID","fieldShouldBeLocalized","getUniqueListBy","tabHasName","diffComponents","getFieldPathsModified","buildVersionFields","clientSchemaMap","customDiffComponents","entitySlug","fieldPermissions","fields","i18n","modifiedOnly","nestingLevel","parentIndexPath","parentIsLocalized","parentPath","parentSchemaPath","req","selectedLocales","versionFromSiblingData","versionToSiblingData","versionFields","fieldIndex","field","indexPath","path","schemaPath","index","clientField","get","payload","logger","error","clientFieldKey","clientSchemaMapKeys","Array","from","keys","msg","Error","versionField","isLocalized","fieldName","name","valueFrom","valueTo","fieldByLocale","locale","localizedVersionField","buildVersionField","baseVersionField","localized","Object","length","push","hasPermission","read","subFieldPermissions","CustomComponent","type","editor","CellComponent","DiffComponent","admin","components","Diff","DefaultComponent","tabs","tabIndex","tab","isNamedTab","tabAsField","tabIndexPath","tabPath","tabSchemaPath","tabVersion","label","arrayValue","isArray","rows","i","fromRow","toRow","blocksValue","blockSlugToMatch","blockType","toBlock","blocks","blockReferences","find","block","slug","fromBlockSlugToMatch","fromBlock","clientDiffProps","undefined","comparisonValue","diffMethod","versionValue","serverDiffProps","clientProps","Component","Fallback","importMap","key","serverProps"],"sources":["../../../../src/views/Version/RenderFieldsToDiff/buildVersionFields.tsx"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\n\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { dequal } from 'dequal/lite'\nimport {\n type BaseVersionField,\n type ClientField,\n type ClientFieldSchemaMap,\n type Field,\n type FieldDiffClientProps,\n type FieldDiffServerProps,\n type FieldTypes,\n type FlattenedBlock,\n MissingEditorProp,\n type PayloadComponent,\n type PayloadRequest,\n type SanitizedFieldPermissions,\n type VersionField,\n} from 'payload'\nimport { fieldIsID, fieldShouldBeLocalized, getUniqueListBy, tabHasName } from 'payload/shared'\n\nimport { diffComponents } from './fields/index.js'\nimport { getFieldPathsModified } from './utilities/getFieldPathsModified.js'\n\nexport type BuildVersionFieldsArgs = {\n clientSchemaMap: ClientFieldSchemaMap\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 nestingLevel?: number\n parentIndexPath: string\n parentIsLocalized: boolean\n parentPath: string\n parentSchemaPath: string\n req: PayloadRequest\n selectedLocales: string[]\n versionFromSiblingData: object\n versionToSiblingData: 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 customDiffComponents,\n entitySlug,\n fieldPermissions,\n fields,\n i18n,\n modifiedOnly,\n nestingLevel = 0,\n parentIndexPath,\n parentIsLocalized,\n parentPath,\n parentSchemaPath,\n req,\n selectedLocales,\n versionFromSiblingData,\n versionToSiblingData,\n}: BuildVersionFieldsArgs): {\n versionFields: VersionField[]\n} => {\n const versionFields: VersionField[] = []\n let fieldIndex = -1\n\n for (const field of fields) {\n fieldIndex++\n\n if (fieldIsID(field)) {\n continue\n }\n\n const { indexPath, path, schemaPath } = getFieldPathsModified({\n field,\n index: fieldIndex,\n 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 valueFrom = fieldName ? versionFromSiblingData?.[fieldName] : versionFromSiblingData\n const valueTo = fieldName ? versionToSiblingData?.[fieldName] : versionToSiblingData\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 customDiffComponents,\n entitySlug,\n field,\n fieldPermissions,\n i18n,\n indexPath,\n locale,\n modifiedOnly,\n nestingLevel,\n parentIsLocalized: true,\n parentPath,\n parentSchemaPath,\n path,\n req,\n schemaPath,\n selectedLocales,\n valueFrom: valueFrom?.[locale],\n valueTo: valueTo?.[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 customDiffComponents,\n entitySlug,\n field,\n fieldPermissions,\n i18n,\n indexPath,\n modifiedOnly,\n nestingLevel,\n parentIsLocalized: parentIsLocalized || ('localized' in field && field.localized),\n parentPath,\n parentSchemaPath,\n path,\n req,\n schemaPath,\n selectedLocales,\n valueFrom,\n valueTo,\n })\n\n if (baseVersionField) {\n versionField.field = baseVersionField\n }\n }\n\n if (\n versionField.field ||\n (versionField.fieldByLocale && Object.keys(versionField.fieldByLocale).length)\n ) {\n versionFields.push(versionField)\n }\n }\n\n return {\n versionFields,\n }\n}\n\nconst buildVersionField = ({\n clientField,\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n field,\n fieldPermissions,\n i18n,\n indexPath,\n locale,\n modifiedOnly,\n nestingLevel,\n parentIsLocalized,\n parentPath,\n parentSchemaPath,\n path,\n req,\n schemaPath,\n selectedLocales,\n valueFrom,\n valueTo,\n}: {\n clientField: ClientField\n field: Field\n indexPath: string\n locale?: string\n modifiedOnly?: boolean\n nestingLevel: number\n parentIsLocalized: boolean\n path: string\n schemaPath: string\n valueFrom: unknown\n valueTo: unknown\n} & Omit<\n BuildVersionFieldsArgs,\n 'fields' | 'parentIndexPath' | 'versionFromSiblingData' | 'versionToSiblingData'\n>): BaseVersionField | null => {\n const fieldName: null | string = 'name' in field ? field.name : null\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(valueFrom, valueTo)) {\n return null\n }\n\n let CustomComponent = customDiffComponents?.[field.type]\n if (field?.type === 'richText') {\n if (!field?.editor) {\n throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n\n if (typeof field?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n if (field.editor.CellComponent) {\n CustomComponent = field.editor.DiffComponent\n }\n }\n if (field?.admin?.components?.Diff) {\n CustomComponent = field.admin.components.Diff\n }\n\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 tabAsField = { ...tab, type: 'tab' }\n\n const {\n indexPath: tabIndexPath,\n path: tabPath,\n schemaPath: tabSchemaPath,\n } = getFieldPathsModified({\n field: tabAsField,\n index: tabIndex,\n parentIndexPath: indexPath,\n parentPath,\n parentSchemaPath,\n })\n const tabVersion = {\n name: 'name' in tab ? tab.name : null,\n fields: buildVersionFields({\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n fieldPermissions,\n fields: tab.fields,\n i18n,\n modifiedOnly,\n nestingLevel: nestingLevel + 1,\n parentIndexPath: isNamedTab ? '' : tabIndexPath,\n parentIsLocalized: parentIsLocalized || tab.localized,\n parentPath: isNamedTab ? tabPath : path,\n parentSchemaPath: isNamedTab ? tabSchemaPath : parentSchemaPath,\n req,\n selectedLocales,\n versionFromSiblingData: 'name' in tab ? valueFrom?.[tab.name] : valueFrom,\n versionToSiblingData: 'name' in tab ? valueTo?.[tab.name] : valueTo,\n }).versionFields,\n label: tab.label,\n }\n if (tabVersion?.fields?.length) {\n baseVersionField.tabs.push(tabVersion)\n }\n }\n\n if (modifiedOnly && !baseVersionField.tabs.length) {\n return null\n }\n } // At this point, we are dealing with a `row`, `collapsible`, etc\n else if ('fields' in field) {\n if (field.type === 'array' && valueTo) {\n const arrayValue = Array.isArray(valueTo) ? valueTo : []\n baseVersionField.rows = []\n\n for (let i = 0; i < arrayValue.length; i++) {\n const fromRow = valueFrom?.[i] || {}\n const toRow = arrayValue?.[i] || {}\n baseVersionField.rows[i] = buildVersionFields({\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n fieldPermissions,\n fields: field.fields,\n i18n,\n modifiedOnly,\n nestingLevel: nestingLevel + 2,\n parentIndexPath: 'name' in field ? '' : indexPath,\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: path + '.' + i,\n parentSchemaPath: schemaPath,\n req,\n selectedLocales,\n versionFromSiblingData: fromRow,\n versionToSiblingData: toRow,\n }).versionFields\n }\n } else {\n baseVersionField.fields = buildVersionFields({\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n fieldPermissions,\n fields: field.fields,\n i18n,\n modifiedOnly,\n nestingLevel: field.type !== 'row' ? nestingLevel + 1 : nestingLevel,\n parentIndexPath: 'name' in field ? '' : indexPath,\n parentIsLocalized: parentIsLocalized || ('localized' in field && field.localized),\n parentPath: 'name' in field ? path : parentPath,\n parentSchemaPath: 'name' in field ? schemaPath : parentSchemaPath,\n req,\n selectedLocales,\n versionFromSiblingData: valueFrom as object,\n versionToSiblingData: valueTo as object,\n }).versionFields\n\n if (modifiedOnly && !baseVersionField.fields?.length) {\n return null\n }\n }\n } else if (field.type === 'blocks') {\n baseVersionField.rows = []\n\n const blocksValue = Array.isArray(valueTo) ? valueTo : []\n\n for (let i = 0; i < blocksValue.length; i++) {\n const fromRow = valueFrom?.[i] || {}\n const toRow = blocksValue[i] || {}\n\n const blockSlugToMatch: string = toRow.blockType\n const toBlock =\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 (toRow.blockType === fromRow.blockType) {\n fields = toBlock.fields\n } else {\n const fromBlockSlugToMatch: string = toRow.blockType // TODO: Verify this is correct\n\n const fromBlock =\n req.payload.blocks[fromBlockSlugToMatch] ??\n ((field.blockReferences ?? field.blocks).find(\n (block) => typeof block !== 'string' && block.slug === fromBlockSlugToMatch,\n ) as FlattenedBlock | undefined)\n\n if (fromBlock) {\n fields = getUniqueListBy<Field>([...toBlock.fields, ...fromBlock.fields], 'name')\n } else {\n fields = toBlock.fields\n }\n }\n\n baseVersionField.rows[i] = buildVersionFields({\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n fieldPermissions,\n fields,\n i18n,\n modifiedOnly,\n nestingLevel: nestingLevel + 2,\n parentIndexPath: 'name' in field ? '' : indexPath,\n parentIsLocalized: parentIsLocalized || ('localized' in field && field.localized),\n parentPath: path + '.' + i,\n parentSchemaPath: schemaPath + '.' + toBlock.slug,\n req,\n selectedLocales,\n versionFromSiblingData: fromRow,\n versionToSiblingData: toRow,\n }).versionFields\n }\n }\n\n const clientDiffProps: FieldDiffClientProps = {\n baseVersionField: {\n ...baseVersionField,\n CustomComponent: undefined,\n },\n /**\n * TODO: Change to valueFrom in 4.0\n */\n comparisonValue: valueFrom,\n /**\n * @deprecated remove in 4.0. Each field should handle its own diffing logic\n */\n diffMethod: 'diffWordsWithSpace',\n field: clientField,\n fieldPermissions: subFieldPermissions,\n parentIsLocalized,\n\n nestingLevel: nestingLevel ? nestingLevel : undefined,\n /**\n * TODO: Change to valueTo in 4.0\n */\n versionValue: valueTo,\n }\n if (locale) {\n clientDiffProps.locale = locale\n }\n\n const serverDiffProps: FieldDiffServerProps = {\n ...clientDiffProps,\n clientField,\n field,\n i18n,\n req,\n selectedLocales,\n }\n\n baseVersionField.CustomComponent = RenderServerComponent({\n clientProps: clientDiffProps,\n Component: CustomComponent,\n Fallback: DefaultComponent,\n importMap: req.payload.importMap,\n key: 'diff component',\n serverProps: serverDiffProps,\n })\n\n return baseVersionField\n}\n"],"mappings":"AAEA,SAASA,qBAAqB,QAAQ;AACtC,SAASC,MAAM,QAAQ;AACvB,SASEC,iBAAiB,QAKZ;AACP,SAASC,SAAS,EAAEC,sBAAsB,EAAEC,eAAe,EAAEC,UAAU,QAAQ;AAE/E,SAASC,cAAc,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ;AA2BtC;;;;;;;AAOA,OAAO,MAAMC,kBAAA,GAAqBA,CAAC;EACjCC,eAAe;EACfC,oBAAoB;EACpBC,UAAU;EACVC,gBAAgB;EAChBC,MAAM;EACNC,IAAI;EACJC,YAAY;EACZC,YAAA,GAAe,CAAC;EAChBC,eAAe;EACfC,iBAAiB;EACjBC,UAAU;EACVC,gBAAgB;EAChBC,GAAG;EACHC,eAAe;EACfC,sBAAsB;EACtBC;AAAoB,CACG;EAGvB,MAAMC,aAAA,GAAgC,EAAE;EACxC,IAAIC,UAAA,GAAa,CAAC;EAElB,KAAK,MAAMC,KAAA,IAASd,MAAA,EAAQ;IAC1Ba,UAAA;IAEA,IAAIxB,SAAA,CAAUyB,KAAA,GAAQ;MACpB;IACF;IAEA,MAAM;MAAEC,SAAS;MAAEC,IAAI;MAAEC;IAAU,CAAE,GAAGvB,qBAAA,CAAsB;MAC5DoB,KAAA;MACAI,KAAA,EAAOL,UAAA;MACPT,eAAA;MACAE,UAAA;MACAC;IACF;IAEA,MAAMY,WAAA,GAAcvB,eAAA,CAAgBwB,GAAG,CAACtB,UAAA,GAAa,MAAMmB,UAAA;IAE3D,IAAI,CAACE,WAAA,EAAa;MAChBX,GAAA,CAAIa,OAAO,CAACC,MAAM,CAACC,KAAK,CAAC;QACvBC,cAAA,EAAgB1B,UAAA,GAAa,MAAMmB,UAAA;QACnCQ,mBAAA,EAAqBC,KAAA,CAAMC,IAAI,CAAC/B,eAAA,CAAgBgC,IAAI;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BqC;IACnB;IACA;;;IAGAC,eAAA,EAAiBpD,SAAA;IACjB;;;IAGAqD,UAAA,EAAY;IACZ1E,KAAA,EAAOK,WAAA;IACPpB,gBAAA,EAAkBiD,mBAAA;IAClB3C,iBAAA;IAEAF,YAAA,EAAcA,YAAA,GAAeA,YAAA,GAAemF,SAAA;IAC5C;;;IAGAG,YAAA,EAAcrD;EAChB;EACA,IAAIE,MAAA,EAAQ;IACV+C,eAAA,CAAgB/C,MAAM,GAAGA,MAAA;EAC3B;EAEA,MAAMoD,eAAA,GAAwC;IAC5C,GAAGL,eAAe;IAClBlE,WAAA;IACAL,KAAA;IACAb,IAAA;IACAO,GAAA;IACAC;EACF;EAEAgC,gBAAA,CAAiBQ,eAAe,GAAG/D,qBAAA,CAAsB;IACvDyG,WAAA,EAAaN,eAAA;IACbO,SAAA,EAAW3C,eAAA;IACX4C,QAAA,EAAUpC,gBAAA;IACVqC,SAAA,EAAWtF,GAAA,CAAIa,OAAO,CAACyE,SAAS;IAChCC,GAAA,EAAK;IACLC,WAAA,EAAaN;EACf;EAEA,OAAOjD,gBAAA;AACT","ignoreList":[]}
|
|
@@ -13,10 +13,10 @@ export const Collapsible = t0 => {
|
|
|
13
13
|
const $ = _c(11);
|
|
14
14
|
const {
|
|
15
15
|
baseVersionField,
|
|
16
|
-
comparisonValue,
|
|
16
|
+
comparisonValue: valueFrom,
|
|
17
17
|
field,
|
|
18
18
|
parentIsLocalized,
|
|
19
|
-
versionValue
|
|
19
|
+
versionValue: valueTo
|
|
20
20
|
} = t0;
|
|
21
21
|
const {
|
|
22
22
|
i18n
|
|
@@ -40,28 +40,28 @@ export const Collapsible = t0 => {
|
|
|
40
40
|
}
|
|
41
41
|
const t2 = parentIsLocalized || field.localized;
|
|
42
42
|
let t3;
|
|
43
|
-
if ($[3] !== baseVersionField.fields || $[4] !==
|
|
43
|
+
if ($[3] !== baseVersionField.fields || $[4] !== field.fields || $[5] !== selectedLocales || $[6] !== t1 || $[7] !== t2 || $[8] !== valueFrom || $[9] !== valueTo) {
|
|
44
44
|
t3 = _jsx("div", {
|
|
45
45
|
className: baseClass,
|
|
46
46
|
children: _jsx(DiffCollapser, {
|
|
47
|
-
comparison: comparisonValue,
|
|
48
47
|
fields: field.fields,
|
|
49
48
|
label: t1,
|
|
50
49
|
locales: selectedLocales,
|
|
51
50
|
parentIsLocalized: t2,
|
|
52
|
-
|
|
51
|
+
valueFrom,
|
|
52
|
+
valueTo,
|
|
53
53
|
children: _jsx(RenderVersionFieldsToDiff, {
|
|
54
54
|
versionFields: baseVersionField.fields
|
|
55
55
|
})
|
|
56
56
|
})
|
|
57
57
|
});
|
|
58
58
|
$[3] = baseVersionField.fields;
|
|
59
|
-
$[4] =
|
|
60
|
-
$[5] =
|
|
61
|
-
$[6] =
|
|
62
|
-
$[7] =
|
|
63
|
-
$[8] =
|
|
64
|
-
$[9] =
|
|
59
|
+
$[4] = field.fields;
|
|
60
|
+
$[5] = selectedLocales;
|
|
61
|
+
$[6] = t1;
|
|
62
|
+
$[7] = t2;
|
|
63
|
+
$[8] = valueFrom;
|
|
64
|
+
$[9] = valueTo;
|
|
65
65
|
$[10] = t3;
|
|
66
66
|
} else {
|
|
67
67
|
t3 = $[10];
|