@payloadcms/next 3.35.0-internal.b3d367c → 3.35.0
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/auth/login.d.ts +22 -0
- package/dist/auth/login.d.ts.map +1 -0
- package/dist/auth/login.js +71 -0
- package/dist/auth/login.js.map +1 -0
- package/dist/auth/logout.d.ts +7 -0
- package/dist/auth/logout.d.ts.map +1 -0
- package/dist/auth/logout.js +37 -0
- package/dist/auth/logout.js.map +1 -0
- package/dist/auth/refresh.d.ts +9 -0
- package/dist/auth/refresh.d.ts.map +1 -0
- package/dist/auth/refresh.js +48 -0
- package/dist/auth/refresh.js.map +1 -0
- package/dist/exports/auth.d.ts +4 -0
- package/dist/exports/auth.d.ts.map +1 -0
- package/dist/exports/auth.js +4 -0
- package/dist/exports/auth.js.map +1 -0
- package/dist/prod/styles.css +1 -1
- package/dist/utilities/getExistingAuthToken.d.ts +7 -0
- package/dist/utilities/getExistingAuthToken.d.ts.map +1 -0
- package/dist/utilities/getExistingAuthToken.js +6 -0
- package/dist/utilities/getExistingAuthToken.js.map +1 -0
- package/dist/utilities/setPayloadAuthCookie.d.ts +9 -0
- package/dist/utilities/setPayloadAuthCookie.d.ts.map +1 -0
- package/dist/utilities/setPayloadAuthCookie.js +27 -0
- package/dist/utilities/setPayloadAuthCookie.js.map +1 -0
- package/dist/views/API/index.client.d.ts.map +1 -1
- package/dist/views/API/index.client.js +2 -1
- package/dist/views/API/index.client.js.map +1 -1
- package/dist/views/LivePreview/Toolbar/Controls/index.d.ts.map +1 -1
- package/dist/views/LivePreview/Toolbar/Controls/index.js +2 -2
- package/dist/views/LivePreview/Toolbar/Controls/index.js.map +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 +5 -4
- 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 +127 -332
- package/dist/views/Version/Default/index.js.map +1 -1
- package/dist/views/Version/Default/index.scss +32 -102
- package/dist/views/Version/Default/types.d.ts +8 -12
- 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 +33 -32
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.scss +3 -30
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.d.ts +1 -6
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js +17 -21
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.d.ts +3 -4
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +55 -80
- 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/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 +10 -0
- 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 +5 -3
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +58 -49
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.scss +11 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.d.ts +9 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.d.ts.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js +23 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +45 -39
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.scss +11 -0
- 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 +11 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.d.ts +9 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.d.ts.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.js +23 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +60 -77
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.scss +11 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.d.ts +7 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.d.ts.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.js +7 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js +1 -2
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/styles.d.ts +3 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/styles.d.ts.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/styles.js +37 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/styles.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/index.js +0 -1
- 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 +1 -6
- package/dist/views/Version/SelectComparison/index.d.ts.map +1 -1
- package/dist/views/Version/SelectComparison/index.js +68 -26
- package/dist/views/Version/SelectComparison/index.js.map +1 -1
- package/dist/views/Version/SelectComparison/index.scss +4 -0
- 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 +2 -9
- package/dist/views/Version/SelectLocales/index.d.ts.map +1 -1
- package/dist/views/Version/SelectLocales/index.js +60 -33
- package/dist/views/Version/SelectLocales/index.js.map +1 -1
- package/dist/views/Version/SelectLocales/index.scss +9 -0
- package/dist/views/Version/SelectLocales/types.d.ts +7 -0
- package/dist/views/Version/SelectLocales/types.d.ts.map +1 -0
- package/dist/views/Version/SelectLocales/types.js +2 -0
- package/dist/views/Version/SelectLocales/types.js.map +1 -0
- package/dist/views/Version/index.d.ts.map +1 -1
- package/dist/views/Version/index.js +56 -105
- 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 +8 -7
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.d.ts +0 -4
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.d.ts.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js +0 -78
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.scss +0 -4
- package/dist/views/Version/SelectComparison/VersionPillLabel.d.ts +0 -6
- package/dist/views/Version/SelectComparison/VersionPillLabel.d.ts.map +0 -1
- package/dist/views/Version/SelectComparison/VersionPillLabel.js +0 -70
- package/dist/views/Version/SelectComparison/VersionPillLabel.js.map +0 -1
- package/dist/views/Version/SelectComparison/formatVersionPill.d.ts +0 -8
- package/dist/views/Version/SelectComparison/formatVersionPill.d.ts.map +0 -1
- package/dist/views/Version/SelectComparison/formatVersionPill.js +0 -24
- package/dist/views/Version/SelectComparison/formatVersionPill.js.map +0 -1
|
@@ -5,142 +5,72 @@
|
|
|
5
5
|
width: 100%;
|
|
6
6
|
padding-bottom: var(--spacing-view-bottom);
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
&__wrap {
|
|
9
|
+
padding-top: calc(var(--base) * 1.5);
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: var(--base);
|
|
13
|
+
}
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
&__header-wrap {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
gap: calc(var(--base) / 4);
|
|
19
|
+
}
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
gap: var(--base);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
21
|
+
&__header {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
flex-wrap: wrap;
|
|
25
25
|
|
|
26
26
|
h2 {
|
|
27
|
-
|
|
27
|
+
margin: 0;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// Vertical separator line
|
|
37
|
-
&::after {
|
|
38
|
-
content: '';
|
|
39
|
-
position: absolute;
|
|
40
|
-
top: 0;
|
|
41
|
-
bottom: 0;
|
|
42
|
-
left: 50%;
|
|
43
|
-
width: 1px;
|
|
44
|
-
background-color: var(--theme-elevation-100);
|
|
45
|
-
transform: translateX(-50%); // Center the line
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
&__wrapper {
|
|
49
|
-
display: grid;
|
|
50
|
-
grid-template-columns: 1fr 1fr;
|
|
51
|
-
grid-gap: var(--base);
|
|
52
|
-
gap: var(--base);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
&__version-from {
|
|
56
|
-
}
|
|
31
|
+
&__created-at {
|
|
32
|
+
margin: 0;
|
|
33
|
+
color: var(--theme-elevation-500);
|
|
34
|
+
}
|
|
57
35
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
align-items: center;
|
|
62
|
-
justify-content: space-between;
|
|
63
|
-
gap: var(--base);
|
|
36
|
+
&__controls {
|
|
37
|
+
display: flex;
|
|
38
|
+
gap: var(--base);
|
|
64
39
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
font-weight: 400;
|
|
68
|
-
}
|
|
40
|
+
> * {
|
|
41
|
+
flex-basis: 100%;
|
|
69
42
|
}
|
|
70
43
|
}
|
|
71
44
|
|
|
72
45
|
&__restore {
|
|
73
46
|
margin: 0 0 0 var(--base);
|
|
74
|
-
div {
|
|
75
|
-
margin-block: 0;
|
|
76
|
-
}
|
|
77
47
|
}
|
|
78
48
|
|
|
79
49
|
&__modifiedCheckBox {
|
|
80
50
|
margin: 0 0 0 var(--base);
|
|
81
|
-
display: flex;
|
|
82
|
-
align-items: center;
|
|
83
51
|
}
|
|
84
52
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
gap: var(--base);
|
|
90
|
-
position: relative;
|
|
91
|
-
|
|
92
|
-
// Vertical separator line
|
|
93
|
-
&::after {
|
|
94
|
-
content: '';
|
|
95
|
-
position: absolute;
|
|
96
|
-
top: 0;
|
|
97
|
-
bottom: 0;
|
|
98
|
-
left: 50%;
|
|
99
|
-
width: 1px;
|
|
100
|
-
background-color: var(--theme-elevation-100);
|
|
101
|
-
transform: translateX(-50%); // Center the line
|
|
53
|
+
@include mid-break {
|
|
54
|
+
&__intro,
|
|
55
|
+
&__header {
|
|
56
|
+
display: block;
|
|
102
57
|
}
|
|
103
|
-
}
|
|
104
58
|
|
|
105
|
-
@include mid-break {
|
|
106
59
|
&__controls {
|
|
107
60
|
flex-direction: column;
|
|
108
61
|
gap: calc(var(--base) / 4);
|
|
109
62
|
}
|
|
110
63
|
|
|
64
|
+
|
|
111
65
|
&__restore {
|
|
112
66
|
margin: calc(var(--base) * 0.5) 0 0 0;
|
|
113
67
|
}
|
|
114
|
-
|
|
115
|
-
&-controls-top {
|
|
116
|
-
&__wrapper {
|
|
117
|
-
flex-direction: column;
|
|
118
|
-
align-items: flex-start;
|
|
119
|
-
|
|
120
|
-
.view-version__modifiedCheckBox {
|
|
121
|
-
margin-left: 0;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
&-controls-bottom {
|
|
127
|
-
&__version-from {
|
|
128
|
-
display: flex;
|
|
129
|
-
justify-content: flex-start;
|
|
130
|
-
align-items: center;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
&__version-to {
|
|
134
|
-
flex-direction: column;
|
|
135
|
-
align-items: flex-start;
|
|
136
|
-
gap: 0;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
68
|
}
|
|
140
69
|
|
|
141
70
|
@include small-break {
|
|
142
|
-
&
|
|
71
|
+
&__wrap {
|
|
143
72
|
padding-top: calc(var(--base) / 2);
|
|
73
|
+
gap: calc(var(--base) / 2);
|
|
144
74
|
}
|
|
145
75
|
}
|
|
146
76
|
}
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Document, OptionObject } from 'payload';
|
|
2
2
|
export type CompareOption = {
|
|
3
3
|
label: React.ReactNode | string;
|
|
4
|
+
options?: CompareOption[];
|
|
5
|
+
relationTo?: string;
|
|
4
6
|
value: string;
|
|
5
7
|
};
|
|
6
|
-
export type VersionPill = {
|
|
7
|
-
id: string;
|
|
8
|
-
Label: React.ReactNode;
|
|
9
|
-
};
|
|
10
8
|
export type DefaultVersionsViewProps = {
|
|
11
9
|
readonly canUpdate: boolean;
|
|
12
|
-
readonly
|
|
13
|
-
readonly
|
|
10
|
+
readonly doc: Document;
|
|
11
|
+
readonly latestDraftVersion?: string;
|
|
12
|
+
readonly latestPublishedVersion?: string;
|
|
14
13
|
modifiedOnly: boolean;
|
|
15
14
|
readonly RenderedDiff: React.ReactNode;
|
|
16
|
-
readonly selectedLocales:
|
|
17
|
-
readonly
|
|
18
|
-
readonly versionTo: TypeWithVersion<any>;
|
|
19
|
-
versionToCreatedAt: string;
|
|
20
|
-
VersionToCreatedAtLabel: React.ReactNode;
|
|
15
|
+
readonly selectedLocales: OptionObject[];
|
|
16
|
+
readonly versionID?: string;
|
|
21
17
|
};
|
|
22
18
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/views/Version/Default/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/views/Version/Default/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAErD,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAA;IAC/B,OAAO,CAAC,EAAE,aAAa,EAAE,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAA;IACtB,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IACpC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAA;IACxC,YAAY,EAAE,OAAO,CAAA;IACrB,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAA;IACtC,QAAQ,CAAC,eAAe,EAAE,YAAY,EAAE,CAAA;IACxC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/views/Version/Default/types.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/views/Version/Default/types.ts"],"sourcesContent":["import type { Document, OptionObject } from 'payload'\n\nexport type CompareOption = {\n label: React.ReactNode | string\n options?: CompareOption[]\n relationTo?: string\n value: string\n}\n\nexport type DefaultVersionsViewProps = {\n readonly canUpdate: boolean\n readonly doc: Document\n readonly latestDraftVersion?: string\n readonly latestPublishedVersion?: string\n modifiedOnly: boolean\n readonly RenderedDiff: React.ReactNode\n readonly selectedLocales: OptionObject[]\n readonly versionID?: string\n}\n"],"mappings":"AASA","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import './index.scss';
|
|
4
4
|
type Props = {
|
|
5
5
|
children: React.ReactNode;
|
|
6
|
+
comparison: unknown;
|
|
6
7
|
field?: never;
|
|
7
8
|
fields: ClientField[];
|
|
8
9
|
initCollapsed?: boolean;
|
|
@@ -10,10 +11,10 @@ type Props = {
|
|
|
10
11
|
label: React.ReactNode;
|
|
11
12
|
locales: string[] | undefined;
|
|
12
13
|
parentIsLocalized: boolean;
|
|
13
|
-
|
|
14
|
-
valueTo: unknown;
|
|
14
|
+
version: unknown;
|
|
15
15
|
} | {
|
|
16
16
|
children: React.ReactNode;
|
|
17
|
+
comparison?: unknown;
|
|
17
18
|
field: ClientField;
|
|
18
19
|
fields?: never;
|
|
19
20
|
initCollapsed?: boolean;
|
|
@@ -21,8 +22,7 @@ type Props = {
|
|
|
21
22
|
label: React.ReactNode;
|
|
22
23
|
locales: string[] | undefined;
|
|
23
24
|
parentIsLocalized: boolean;
|
|
24
|
-
|
|
25
|
-
valueTo: unknown;
|
|
25
|
+
version: unknown;
|
|
26
26
|
};
|
|
27
27
|
export declare const DiffCollapser: React.FC<Props>;
|
|
28
28
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/views/Version/RenderFieldsToDiff/DiffCollapser/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAI1C,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,OAAO,cAAc,CAAA;AAKrB,KAAK,KAAK,GACN;IAEE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,MAAM,EAAE,WAAW,EAAE,CAAA;IACrB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC7B,iBAAiB,EAAE,OAAO,CAAA;IAC1B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/views/Version/RenderFieldsToDiff/DiffCollapser/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAI1C,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,OAAO,cAAc,CAAA;AAKrB,KAAK,KAAK,GACN;IAEE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,MAAM,EAAE,WAAW,EAAE,CAAA;IACrB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC7B,iBAAiB,EAAE,OAAO,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;CACjB,GACD;IAEE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,KAAK,EAAE,WAAW,CAAA;IAClB,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,UAAU,EAAE,IAAI,CAAA;IAChB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC7B,iBAAiB,EAAE,OAAO,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAEL,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAgFzC,CAAA"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { ChevronIcon, FieldDiffLabel, useConfig, useTranslation } from '@payloadcms/ui';
|
|
5
|
+
import { ChevronIcon, FieldDiffLabel, Pill, useConfig, useTranslation } from '@payloadcms/ui';
|
|
6
6
|
import { fieldIsArrayType, fieldIsBlockType } from 'payload/shared';
|
|
7
7
|
import React, { useState } from 'react';
|
|
8
8
|
import { countChangedFields, countChangedFieldsInRows } from '../utilities/countChangedFields.js';
|
|
@@ -11,6 +11,7 @@ export const DiffCollapser = t0 => {
|
|
|
11
11
|
const $ = _c(21);
|
|
12
12
|
const {
|
|
13
13
|
children,
|
|
14
|
+
comparison,
|
|
14
15
|
field,
|
|
15
16
|
fields,
|
|
16
17
|
initCollapsed: t1,
|
|
@@ -18,8 +19,7 @@ export const DiffCollapser = t0 => {
|
|
|
18
19
|
label,
|
|
19
20
|
locales,
|
|
20
21
|
parentIsLocalized,
|
|
21
|
-
|
|
22
|
-
valueTo
|
|
22
|
+
version
|
|
23
23
|
} = t0;
|
|
24
24
|
const initCollapsed = t1 === undefined ? false : t1;
|
|
25
25
|
const isIterable = t2 === undefined ? false : t2;
|
|
@@ -31,25 +31,25 @@ export const DiffCollapser = t0 => {
|
|
|
31
31
|
config
|
|
32
32
|
} = useConfig();
|
|
33
33
|
let t3;
|
|
34
|
-
if ($[0] !== children || $[1] !==
|
|
34
|
+
if ($[0] !== children || $[1] !== comparison || $[2] !== config || $[3] !== field || $[4] !== fields || $[5] !== isCollapsed || $[6] !== isIterable || $[7] !== label || $[8] !== locales || $[9] !== parentIsLocalized || $[10] !== t || $[11] !== version) {
|
|
35
35
|
let changeCount;
|
|
36
36
|
if (isIterable) {
|
|
37
37
|
if (!fieldIsArrayType(field) && !fieldIsBlockType(field)) {
|
|
38
38
|
throw new Error("DiffCollapser: field must be an array or blocks field when isIterable is true");
|
|
39
39
|
}
|
|
40
40
|
let t4;
|
|
41
|
-
if ($[13] !==
|
|
42
|
-
t4 =
|
|
43
|
-
$[13] =
|
|
41
|
+
if ($[13] !== comparison) {
|
|
42
|
+
t4 = comparison ?? [];
|
|
43
|
+
$[13] = comparison;
|
|
44
44
|
$[14] = t4;
|
|
45
45
|
} else {
|
|
46
46
|
t4 = $[14];
|
|
47
47
|
}
|
|
48
48
|
const comparisonRows = t4;
|
|
49
49
|
let t5;
|
|
50
|
-
if ($[15] !==
|
|
51
|
-
t5 =
|
|
52
|
-
$[15] =
|
|
50
|
+
if ($[15] !== version) {
|
|
51
|
+
t5 = version ?? [];
|
|
52
|
+
$[15] = version;
|
|
53
53
|
$[16] = t5;
|
|
54
54
|
} else {
|
|
55
55
|
t5 = $[16];
|
|
@@ -68,12 +68,12 @@ export const DiffCollapser = t0 => {
|
|
|
68
68
|
});
|
|
69
69
|
} else {
|
|
70
70
|
changeCount = countChangedFields({
|
|
71
|
-
comparison
|
|
71
|
+
comparison,
|
|
72
72
|
config,
|
|
73
73
|
fields,
|
|
74
74
|
locales,
|
|
75
75
|
parentIsLocalized,
|
|
76
|
-
version
|
|
76
|
+
version
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
const t4 = isCollapsed && `${baseClass}__content--is-collapsed`;
|
|
@@ -97,20 +97,21 @@ export const DiffCollapser = t0 => {
|
|
|
97
97
|
t3 = _jsxs("div", {
|
|
98
98
|
className: baseClass,
|
|
99
99
|
children: [_jsxs(FieldDiffLabel, {
|
|
100
|
-
children: [
|
|
100
|
+
children: [_jsx("button", {
|
|
101
101
|
"aria-label": isCollapsed ? "Expand" : "Collapse",
|
|
102
102
|
className: `${baseClass}__toggle-button`,
|
|
103
103
|
onClick: t6,
|
|
104
104
|
type: "button",
|
|
105
|
-
children:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}), changeCount > 0 && isCollapsed && _jsx("span", {
|
|
105
|
+
children: _jsx(ChevronIcon, {
|
|
106
|
+
direction: isCollapsed ? "right" : "down"
|
|
107
|
+
})
|
|
108
|
+
}), _jsx("span", {
|
|
109
|
+
className: `${baseClass}__label`,
|
|
110
|
+
children: label
|
|
111
|
+
}), changeCount > 0 && _jsx(Pill, {
|
|
113
112
|
className: `${baseClass}__field-change-count`,
|
|
113
|
+
pillStyle: "light-gray",
|
|
114
|
+
size: "small",
|
|
114
115
|
children: t("version:changedFieldsCount", {
|
|
115
116
|
count: changeCount
|
|
116
117
|
})
|
|
@@ -121,17 +122,17 @@ export const DiffCollapser = t0 => {
|
|
|
121
122
|
})]
|
|
122
123
|
});
|
|
123
124
|
$[0] = children;
|
|
124
|
-
$[1] =
|
|
125
|
-
$[2] =
|
|
126
|
-
$[3] =
|
|
127
|
-
$[4] =
|
|
128
|
-
$[5] =
|
|
129
|
-
$[6] =
|
|
130
|
-
$[7] =
|
|
131
|
-
$[8] =
|
|
132
|
-
$[9] =
|
|
133
|
-
$[10] =
|
|
134
|
-
$[11] =
|
|
125
|
+
$[1] = comparison;
|
|
126
|
+
$[2] = config;
|
|
127
|
+
$[3] = field;
|
|
128
|
+
$[4] = fields;
|
|
129
|
+
$[5] = isCollapsed;
|
|
130
|
+
$[6] = isIterable;
|
|
131
|
+
$[7] = label;
|
|
132
|
+
$[8] = locales;
|
|
133
|
+
$[9] = parentIsLocalized;
|
|
134
|
+
$[10] = t;
|
|
135
|
+
$[11] = version;
|
|
135
136
|
$[12] = t3;
|
|
136
137
|
} else {
|
|
137
138
|
t3 = $[12];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","ChevronIcon","FieldDiffLabel","useConfig","useTranslation","fieldIsArrayType","fieldIsBlockType","React","useState","countChangedFields","countChangedFieldsInRows","baseClass","DiffCollapser","t0","$","children","field","fields","initCollapsed","t1","isIterable","t2","label","locales","parentIsLocalized","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","ChevronIcon","FieldDiffLabel","Pill","useConfig","useTranslation","fieldIsArrayType","fieldIsBlockType","React","useState","countChangedFields","countChangedFieldsInRows","baseClass","DiffCollapser","t0","$","children","comparison","field","fields","initCollapsed","t1","isIterable","t2","label","locales","parentIsLocalized","version","undefined","t","isCollapsed","setIsCollapsed","config","t3","changeCount","Error","t4","comparisonRows","t5","versionRows","Array","isArray","filter","Boolean","contentClassNames","join","t6","_jsxs","className","_jsx","onClick","type","direction","pillStyle","size","count"],"sources":["../../../../../src/views/Version/RenderFieldsToDiff/DiffCollapser/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientField } from 'payload'\n\nimport { ChevronIcon, FieldDiffLabel, Pill, useConfig, useTranslation } from '@payloadcms/ui'\nimport { fieldIsArrayType, fieldIsBlockType } from 'payload/shared'\nimport React, { useState } from 'react'\n\nimport './index.scss'\nimport { countChangedFields, countChangedFieldsInRows } from '../utilities/countChangedFields.js'\n\nconst baseClass = 'diff-collapser'\n\ntype Props =\n | {\n // fields collapser\n children: React.ReactNode\n comparison: unknown\n field?: never\n fields: ClientField[]\n initCollapsed?: boolean\n isIterable?: false\n label: React.ReactNode\n locales: string[] | undefined\n parentIsLocalized: boolean\n version: unknown\n }\n | {\n // iterable collapser\n children: React.ReactNode\n comparison?: unknown\n field: ClientField\n fields?: never\n initCollapsed?: boolean\n isIterable: true\n label: React.ReactNode\n locales: string[] | undefined\n parentIsLocalized: boolean\n version: unknown\n }\n\nexport const DiffCollapser: React.FC<Props> = ({\n children,\n comparison,\n field,\n fields,\n initCollapsed = false,\n isIterable = false,\n label,\n locales,\n parentIsLocalized,\n version,\n}) => {\n const { t } = useTranslation()\n const [isCollapsed, setIsCollapsed] = useState(initCollapsed)\n const { config } = useConfig()\n\n let changeCount = 0\n\n if (isIterable) {\n if (!fieldIsArrayType(field) && !fieldIsBlockType(field)) {\n throw new Error(\n 'DiffCollapser: field must be an array or blocks field when isIterable is true',\n )\n }\n const comparisonRows = comparison ?? []\n const versionRows = version ?? []\n\n if (!Array.isArray(comparisonRows) || !Array.isArray(versionRows)) {\n throw new Error(\n 'DiffCollapser: comparison and version must be arrays when isIterable is true',\n )\n }\n\n changeCount = countChangedFieldsInRows({\n comparisonRows,\n config,\n field,\n locales,\n parentIsLocalized,\n versionRows,\n })\n } else {\n changeCount = countChangedFields({\n comparison,\n config,\n fields,\n locales,\n parentIsLocalized,\n version,\n })\n }\n\n const contentClassNames = [\n `${baseClass}__content`,\n isCollapsed && `${baseClass}__content--is-collapsed`,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <div className={baseClass}>\n <FieldDiffLabel>\n <button\n aria-label={isCollapsed ? 'Expand' : 'Collapse'}\n className={`${baseClass}__toggle-button`}\n onClick={() => setIsCollapsed(!isCollapsed)}\n type=\"button\"\n >\n <ChevronIcon direction={isCollapsed ? 'right' : 'down'} />\n </button>\n <span className={`${baseClass}__label`}>{label}</span>\n {changeCount > 0 && (\n <Pill className={`${baseClass}__field-change-count`} pillStyle=\"light-gray\" size=\"small\">\n {t('version:changedFieldsCount', { count: changeCount })}\n </Pill>\n )}\n </FieldDiffLabel>\n <div className={contentClassNames}>{children}</div>\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,WAAW,EAAEC,cAAc,EAAEC,IAAI,EAAEC,SAAS,EAAEC,cAAc,QAAQ;AAC7E,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ;AACnD,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAGhC,SAASC,kBAAkB,EAAEC,wBAA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AAA;QAAAc,QAAA,GACEiC,IAAA,CAAC;UAAA,cACanB,WAAA,GAAc,WAAW;UAAAkB,SAAA,EAC1B,GAAApC,SAAA,iBAA6B;UAAAsC,OAAA,EAC/BJ,EAAsB;UAAAK,IAAA,EAC1B;UAAAnC,QAAA,EAELiC,IAAA,CAAAhD,WAAA;YAAAmD,SAAA,EAAwBtB,WAAA,GAAc,UAAU;UAAA,C;YAElDmB,IAAA,CAAC;UAAAD,SAAA,EAAgB,GAAApC,SAAA,SAAqB;UAAAI,QAAA,EAAGQ;QAAA,C,GACxCU,WAAA,IAAc,IACbe,IAAA,CAAA9C,IAAA;UAAA6C,SAAA,EAAiB,GAAApC,SAAA,sBAAkC;UAAAyC,SAAA,EAAY;UAAAC,IAAA,EAAkB;UAAAtC,QAAA,EAC9Ea,CAAA,CAAE;YAAA0B,KAAA,EAAuCrB;UAAA,CAAY;QAAA,C;UAI5De,IAAA,CAAC;QAAAD,SAAA,EAAeJ,iBAAA;QAAA5B;MAAA,C;;;;;;;;;;;;;;;;;;SAjBlBiB,E;CAoBJ","ignoreList":[]}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
@import '../../../../scss/styles.scss';
|
|
2
|
-
|
|
3
1
|
@layer payload-default {
|
|
4
2
|
.diff-collapser {
|
|
5
3
|
&__toggle-button {
|
|
@@ -7,47 +5,22 @@
|
|
|
7
5
|
cursor: pointer;
|
|
8
6
|
// Align the chevron visually with the label text
|
|
9
7
|
vertical-align: 1px;
|
|
10
|
-
position: relative;
|
|
11
|
-
z-index: 1;
|
|
12
|
-
|
|
13
|
-
.icon {
|
|
14
|
-
color: var(--theme-elevation-500);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
&:hover {
|
|
18
|
-
// Apply background color but with padding, thus we use after
|
|
19
|
-
&::before {
|
|
20
|
-
content: '';
|
|
21
|
-
position: absolute;
|
|
22
|
-
top: -(base(0.15));
|
|
23
|
-
left: -(base(0.15));
|
|
24
|
-
right: -(base(0.15));
|
|
25
|
-
bottom: -(base(0.15));
|
|
26
|
-
background-color: var(--theme-elevation-50);
|
|
27
|
-
border-radius: var(--style-radius-s);
|
|
28
|
-
z-index: -1;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
8
|
}
|
|
32
9
|
|
|
33
10
|
&__label {
|
|
34
11
|
// Add space between label, chevron, and change count
|
|
35
|
-
margin: 0 calc(var(--base) * 0.
|
|
12
|
+
margin: 0 calc(var(--base) * 0.25);
|
|
36
13
|
}
|
|
37
14
|
|
|
38
15
|
&__field-change-count {
|
|
39
16
|
// Reset the font weight of the change count to normal
|
|
40
17
|
font-weight: normal;
|
|
41
|
-
margin-left: calc(var(--base) * 0.3);
|
|
42
|
-
padding: calc(var(--base) * 0.2);
|
|
43
|
-
background: var(--theme-elevation-100);
|
|
44
|
-
border-radius: var(--style-radius-s);
|
|
45
18
|
}
|
|
46
19
|
|
|
47
20
|
&__content {
|
|
48
21
|
[dir='ltr'] & {
|
|
49
22
|
// Vertical gutter
|
|
50
|
-
border-left:
|
|
23
|
+
border-left: 3px solid var(--theme-elevation-50);
|
|
51
24
|
// Center-align the gutter with the chevron
|
|
52
25
|
margin-left: 3px;
|
|
53
26
|
// Content indentation
|
|
@@ -55,7 +28,7 @@
|
|
|
55
28
|
}
|
|
56
29
|
[dir='rtl'] & {
|
|
57
30
|
// Vertical gutter
|
|
58
|
-
border-right:
|
|
31
|
+
border-right: 3px solid var(--theme-elevation-50);
|
|
59
32
|
// Center-align the gutter with the chevron
|
|
60
33
|
margin-right: 3px;
|
|
61
34
|
// Content indentation
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import type { VersionField } from 'payload';
|
|
2
2
|
import './index.scss';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
export declare const RenderVersionFieldsToDiff: ({
|
|
5
|
-
/**
|
|
6
|
-
* If true, this is the parent render version fields component, not one nested in
|
|
7
|
-
* a field with children (e.g. group)
|
|
8
|
-
*/
|
|
9
|
-
parent?: boolean;
|
|
4
|
+
export declare const RenderVersionFieldsToDiff: ({ versionFields, }: {
|
|
10
5
|
versionFields: VersionField[];
|
|
11
6
|
}) => React.ReactNode;
|
|
12
7
|
//# sourceMappingURL=RenderVersionFieldsToDiff.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderVersionFieldsToDiff.d.ts","sourceRoot":"","sources":["../../../../src/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C,OAAO,cAAc,CAAA;AAGrB,OAAO,KAA8B,MAAM,OAAO,CAAA;AAElD,eAAO,MAAM,yBAAyB
|
|
1
|
+
{"version":3,"file":"RenderVersionFieldsToDiff.d.ts","sourceRoot":"","sources":["../../../../src/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C,OAAO,cAAc,CAAA;AAGrB,OAAO,KAA8B,MAAM,OAAO,CAAA;AAElD,eAAO,MAAM,yBAAyB,uBAEnC;IACD,aAAa,EAAE,YAAY,EAAE,CAAA;CAC9B,KAAG,KAAK,CAAC,SAqDT,CAAA"}
|
|
@@ -6,32 +6,29 @@ 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(5);
|
|
10
10
|
const {
|
|
11
|
-
parent: t1,
|
|
12
11
|
versionFields
|
|
13
12
|
} = t0;
|
|
14
|
-
const parent = t1 === undefined ? false : t1;
|
|
15
13
|
const [hasMounted, setHasMounted] = React.useState(false);
|
|
14
|
+
let t1;
|
|
16
15
|
let t2;
|
|
17
|
-
let t3;
|
|
18
16
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
19
|
-
|
|
17
|
+
t1 = () => {
|
|
20
18
|
setHasMounted(true);
|
|
21
19
|
};
|
|
22
|
-
|
|
23
|
-
$[0] =
|
|
24
|
-
$[1] =
|
|
20
|
+
t2 = [];
|
|
21
|
+
$[0] = t1;
|
|
22
|
+
$[1] = t2;
|
|
25
23
|
} else {
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
t1 = $[0];
|
|
25
|
+
t2 = $[1];
|
|
28
26
|
}
|
|
29
|
-
useEffect(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
className: t4,
|
|
27
|
+
useEffect(t1, t2);
|
|
28
|
+
let t3;
|
|
29
|
+
if ($[2] !== hasMounted || $[3] !== versionFields) {
|
|
30
|
+
t3 = _jsx("div", {
|
|
31
|
+
className: baseClass,
|
|
35
32
|
children: !hasMounted ? _jsx(Fragment, {
|
|
36
33
|
children: _jsx(ShimmerEffect, {
|
|
37
34
|
height: "8rem",
|
|
@@ -40,13 +37,12 @@ export const RenderVersionFieldsToDiff = t0 => {
|
|
|
40
37
|
}) : versionFields?.map(_temp)
|
|
41
38
|
});
|
|
42
39
|
$[2] = hasMounted;
|
|
43
|
-
$[3] =
|
|
44
|
-
$[4] =
|
|
45
|
-
$[5] = t5;
|
|
40
|
+
$[3] = versionFields;
|
|
41
|
+
$[4] = t3;
|
|
46
42
|
} else {
|
|
47
|
-
|
|
43
|
+
t3 = $[4];
|
|
48
44
|
}
|
|
49
|
-
return
|
|
45
|
+
return t3;
|
|
50
46
|
};
|
|
51
47
|
function _temp(field, fieldIndex) {
|
|
52
48
|
if (field.fieldByLocale) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderVersionFieldsToDiff.js","names":["c","_c","baseClass","ShimmerEffect","React","Fragment","useEffect","RenderVersionFieldsToDiff","t0","$","
|
|
1
|
+
{"version":3,"file":"RenderVersionFieldsToDiff.js","names":["c","_c","baseClass","ShimmerEffect","React","Fragment","useEffect","RenderVersionFieldsToDiff","t0","$","versionFields","hasMounted","setHasMounted","useState","t1","t2","Symbol","for","t3","_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 versionFields,\n}: {\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}>\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;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AAI,IAAA;QAAA,eACJL,MAAA;QAAAT,QAAA,EAGbF,IAAA,CAAC;UAAAC,SAAA,EAAe,GAAAlB,SAAA,gBAA4B;UAAAmB,QAAA,EAAGU,SAAA,CAAAK;QAAA,C;SAF1C,CAACN,MAAA,EAAQH,UAAA,EAAAU,IAAA,CAAiB;IAAA;IAAA,OAOnClB,IAAA,CAAC;MAAAC,SAAA,EAAe,GAAAlB,SAAA,SAAqB;MAAAmB,QAAA,EAClCQ;IAAA,GADyCF,UAAA;EAAA;IAAA,IAIrCD,KAAA,CAAAA,KAAA;MAAA,OAEPP,IAAA,CAAC;QAAAC,SAAA,EACY,GAAAlB,SAAA,kBAA8BwB,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,6 +2,7 @@ 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;
|
|
5
6
|
customDiffComponents: Partial<Record<FieldTypes, PayloadComponent<FieldDiffServerProps, FieldDiffClientProps>>>;
|
|
6
7
|
entitySlug: string;
|
|
7
8
|
fieldPermissions: {
|
|
@@ -10,15 +11,13 @@ export type BuildVersionFieldsArgs = {
|
|
|
10
11
|
fields: Field[];
|
|
11
12
|
i18n: I18nClient;
|
|
12
13
|
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
|
-
|
|
21
|
-
versionToSiblingData: object;
|
|
20
|
+
versionSiblingData: object;
|
|
22
21
|
};
|
|
23
22
|
/**
|
|
24
23
|
* Build up an object that contains rendered diff components for each field.
|
|
@@ -27,7 +26,7 @@ export type BuildVersionFieldsArgs = {
|
|
|
27
26
|
* Here, the server is responsible for traversing through the document data and building up this
|
|
28
27
|
* version state object.
|
|
29
28
|
*/
|
|
30
|
-
export declare const buildVersionFields: ({ clientSchemaMap, customDiffComponents, entitySlug, fieldPermissions, fields, i18n, modifiedOnly,
|
|
29
|
+
export declare const buildVersionFields: ({ clientSchemaMap, comparisonSiblingData, customDiffComponents, entitySlug, fieldPermissions, fields, i18n, modifiedOnly, parentIndexPath, parentIsLocalized, parentPath, parentSchemaPath, req, selectedLocales, versionSiblingData, }: BuildVersionFieldsArgs) => {
|
|
31
30
|
versionFields: VersionField[];
|
|
32
31
|
};
|
|
33
32
|
//# sourceMappingURL=buildVersionFields.d.ts.map
|