@payloadcms/next 3.20.0-canary.8eef7db → 3.20.0-canary.9f2bca1
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/Account/index.d.ts.map +1 -1
- package/dist/views/Account/index.js +1 -2
- package/dist/views/Account/index.js.map +1 -1
- package/dist/views/CreateFirstUser/index.client.d.ts.map +1 -1
- package/dist/views/CreateFirstUser/index.client.js +2 -4
- package/dist/views/CreateFirstUser/index.client.js.map +1 -1
- package/dist/views/CreateFirstUser/index.d.ts.map +1 -1
- package/dist/views/CreateFirstUser/index.js +1 -2
- package/dist/views/CreateFirstUser/index.js.map +1 -1
- package/dist/views/Document/getDocumentPermissions.js +2 -2
- package/dist/views/Document/getDocumentPermissions.js.map +1 -1
- package/dist/views/Document/index.d.ts.map +1 -1
- package/dist/views/Document/index.js +1 -2
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.d.ts.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +0 -2
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
- package/dist/views/LivePreview/index.client.d.ts.map +1 -1
- package/dist/views/LivePreview/index.client.js +2 -5
- package/dist/views/LivePreview/index.client.js.map +1 -1
- package/dist/views/Version/Default/index.d.ts.map +1 -1
- package/dist/views/Version/Default/index.js +159 -89
- package/dist/views/Version/Default/index.js.map +1 -1
- package/dist/views/Version/Default/types.d.ts +4 -4
- 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/fields/Iterable/index.d.ts +4 -3
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +63 -100
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.scss +12 -3
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.d.ts +6 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.d.ts.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js +43 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.scss +14 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.d.ts +5 -2
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +17 -18
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts +5 -2
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +28 -56
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.d.ts +5 -3
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +42 -146
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.d.ts +5 -2
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +37 -71
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/index.d.ts +22 -2
- package/dist/views/Version/RenderFieldsToDiff/fields/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js +9 -13
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/types.d.ts +22 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/types.d.ts.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/types.js +2 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/types.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/index.d.ts +5 -2
- package/dist/views/Version/RenderFieldsToDiff/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/index.js +113 -8
- package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/types.d.ts +21 -0
- package/dist/views/Version/RenderFieldsToDiff/types.d.ts.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/types.js +2 -0
- package/dist/views/Version/RenderFieldsToDiff/types.js.map +1 -0
- package/dist/views/Version/Restore/index.d.ts.map +1 -1
- package/dist/views/Version/Restore/index.js +2 -2
- package/dist/views/Version/Restore/index.js.map +1 -1
- package/dist/views/Version/SelectComparison/index.d.ts.map +1 -1
- package/dist/views/Version/SelectComparison/index.js +3 -7
- package/dist/views/Version/SelectComparison/index.js.map +1 -1
- package/dist/views/Version/index.d.ts.map +1 -1
- package/dist/views/Version/index.js +15 -117
- package/dist/views/Version/index.js.map +1 -1
- package/dist/views/Versions/getLatestVersion.d.ts +1 -4
- package/dist/views/Versions/getLatestVersion.d.ts.map +1 -1
- package/dist/views/Versions/getLatestVersion.js +0 -6
- package/dist/views/Versions/getLatestVersion.js.map +1 -1
- package/package.json +7 -7
- package/dist/views/Version/Default/SelectedLocalesContext.d.ts +0 -8
- package/dist/views/Version/Default/SelectedLocalesContext.d.ts.map +0 -1
- package/dist/views/Version/Default/SelectedLocalesContext.js +0 -10
- package/dist/views/Version/Default/SelectedLocalesContext.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.d.ts +0 -27
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.d.ts.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js +0 -76
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.scss +0 -46
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.d.ts +0 -6
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.d.ts.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js +0 -36
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.d.ts +0 -30
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.d.ts.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +0 -300
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.d.ts +0 -3
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.d.ts.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js +0 -64
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.d.ts +0 -4
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.d.ts.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js +0 -69
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.scss +0 -14
- package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.d.ts +0 -3
- package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.d.ts.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.js +0 -17
- package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.scss +0 -20
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.d.ts +0 -21
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.d.ts.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js +0 -194
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js +0 -860
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.d.ts +0 -2
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.d.ts.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.js +0 -4
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js +0 -46
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.d.ts +0 -27
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.d.ts.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.js +0 -30
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.d.ts +0 -18
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.d.ts.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js +0 -44
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js +0 -122
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js.map +0 -1
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import { fieldHasChanges } from './fieldHasChanges.js';
|
|
2
|
-
import { getFieldsForRowComparison } from './getFieldsForRowComparison.js';
|
|
3
|
-
/**
|
|
4
|
-
* Recursively counts the number of changed fields between comparison and
|
|
5
|
-
* version data for a given set of fields.
|
|
6
|
-
*/
|
|
7
|
-
export function countChangedFields({
|
|
8
|
-
comparison,
|
|
9
|
-
fields,
|
|
10
|
-
locales,
|
|
11
|
-
version
|
|
12
|
-
}) {
|
|
13
|
-
let count = 0;
|
|
14
|
-
fields.forEach(field => {
|
|
15
|
-
// Don't count the id field since it is not displayed in the UI
|
|
16
|
-
if ('name' in field && field.name === 'id') {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const fieldType = field.type;
|
|
20
|
-
switch (fieldType) {
|
|
21
|
-
// Iterable fields are arrays and blocks fields. We iterate over each row and
|
|
22
|
-
// count the number of changed fields in each.
|
|
23
|
-
case 'array':
|
|
24
|
-
case 'blocks':
|
|
25
|
-
{
|
|
26
|
-
if (locales && field.localized) {
|
|
27
|
-
locales.forEach(locale => {
|
|
28
|
-
const comparisonRows = comparison?.[field.name]?.[locale] ?? [];
|
|
29
|
-
const versionRows = version?.[field.name]?.[locale] ?? [];
|
|
30
|
-
count += countChangedFieldsInRows({
|
|
31
|
-
comparisonRows,
|
|
32
|
-
field,
|
|
33
|
-
locales,
|
|
34
|
-
versionRows
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
} else {
|
|
38
|
-
const comparisonRows = comparison?.[field.name] ?? [];
|
|
39
|
-
const versionRows = version?.[field.name] ?? [];
|
|
40
|
-
count += countChangedFieldsInRows({
|
|
41
|
-
comparisonRows,
|
|
42
|
-
field,
|
|
43
|
-
locales,
|
|
44
|
-
versionRows
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
// Regular fields without nested fields.
|
|
50
|
-
case 'checkbox':
|
|
51
|
-
case 'code':
|
|
52
|
-
case 'date':
|
|
53
|
-
case 'email':
|
|
54
|
-
case 'join':
|
|
55
|
-
case 'json':
|
|
56
|
-
case 'number':
|
|
57
|
-
case 'point':
|
|
58
|
-
case 'radio':
|
|
59
|
-
case 'relationship':
|
|
60
|
-
case 'richText':
|
|
61
|
-
case 'select':
|
|
62
|
-
case 'text':
|
|
63
|
-
case 'textarea':
|
|
64
|
-
case 'upload':
|
|
65
|
-
{
|
|
66
|
-
// Fields that have a name and contain data. We can just check if the data has changed.
|
|
67
|
-
if (locales && field.localized) {
|
|
68
|
-
locales.forEach(locale => {
|
|
69
|
-
if (fieldHasChanges(version?.[field.name]?.[locale], comparison?.[field.name]?.[locale])) {
|
|
70
|
-
count++;
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
} else if (fieldHasChanges(version?.[field.name], comparison?.[field.name])) {
|
|
74
|
-
count++;
|
|
75
|
-
}
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
// Fields that have nested fields, but don't nest their fields' data.
|
|
79
|
-
case 'collapsible':
|
|
80
|
-
case 'row':
|
|
81
|
-
{
|
|
82
|
-
count += countChangedFields({
|
|
83
|
-
comparison,
|
|
84
|
-
fields: field.fields,
|
|
85
|
-
locales,
|
|
86
|
-
version
|
|
87
|
-
});
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
// Fields that have nested fields and nest their fields' data.
|
|
91
|
-
case 'group':
|
|
92
|
-
{
|
|
93
|
-
if (locales && field.localized) {
|
|
94
|
-
locales.forEach(locale => {
|
|
95
|
-
count += countChangedFields({
|
|
96
|
-
comparison: comparison?.[field.name]?.[locale],
|
|
97
|
-
fields: field.fields,
|
|
98
|
-
locales,
|
|
99
|
-
version: version?.[field.name]?.[locale]
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
} else {
|
|
103
|
-
count += countChangedFields({
|
|
104
|
-
comparison: comparison?.[field.name],
|
|
105
|
-
fields: field.fields,
|
|
106
|
-
locales,
|
|
107
|
-
version: version?.[field.name]
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
// Each tab in a tabs field has nested fields. The fields data may be
|
|
113
|
-
// nested or not depending on the existence of a name property.
|
|
114
|
-
case 'tabs':
|
|
115
|
-
{
|
|
116
|
-
field.tabs.forEach(tab => {
|
|
117
|
-
if ('name' in tab && locales && tab.localized) {
|
|
118
|
-
// Named localized tab
|
|
119
|
-
locales.forEach(locale => {
|
|
120
|
-
count += countChangedFields({
|
|
121
|
-
comparison: comparison?.[tab.name]?.[locale],
|
|
122
|
-
fields: tab.fields,
|
|
123
|
-
locales,
|
|
124
|
-
version: version?.[tab.name]?.[locale]
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
} else if ('name' in tab) {
|
|
128
|
-
// Named tab
|
|
129
|
-
count += countChangedFields({
|
|
130
|
-
comparison: comparison?.[tab.name],
|
|
131
|
-
fields: tab.fields,
|
|
132
|
-
locales,
|
|
133
|
-
version: version?.[tab.name]
|
|
134
|
-
});
|
|
135
|
-
} else {
|
|
136
|
-
// Unnamed tab
|
|
137
|
-
count += countChangedFields({
|
|
138
|
-
comparison,
|
|
139
|
-
fields: tab.fields,
|
|
140
|
-
locales,
|
|
141
|
-
version
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
// UI fields don't have data and are not displayed in the version view
|
|
148
|
-
// so we can ignore them.
|
|
149
|
-
case 'ui':
|
|
150
|
-
{
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
153
|
-
default:
|
|
154
|
-
{
|
|
155
|
-
const _exhaustiveCheck = fieldType;
|
|
156
|
-
throw new Error(`Unexpected field.type in countChangedFields : ${String(fieldType)}`);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
return count;
|
|
161
|
-
}
|
|
162
|
-
export function countChangedFieldsInRows({
|
|
163
|
-
comparisonRows = [],
|
|
164
|
-
field,
|
|
165
|
-
locales,
|
|
166
|
-
versionRows = []
|
|
167
|
-
}) {
|
|
168
|
-
let count = 0;
|
|
169
|
-
let i = 0;
|
|
170
|
-
while (comparisonRows[i] || versionRows[i]) {
|
|
171
|
-
const comparisonRow = comparisonRows?.[i] || {};
|
|
172
|
-
const versionRow = versionRows?.[i] || {};
|
|
173
|
-
const {
|
|
174
|
-
fields: rowFields
|
|
175
|
-
} = getFieldsForRowComparison({
|
|
176
|
-
baseVersionField: {
|
|
177
|
-
fields: []
|
|
178
|
-
},
|
|
179
|
-
comparisonRow,
|
|
180
|
-
field,
|
|
181
|
-
row: i,
|
|
182
|
-
versionRow
|
|
183
|
-
});
|
|
184
|
-
count += countChangedFields({
|
|
185
|
-
comparison: comparisonRow,
|
|
186
|
-
fields: rowFields,
|
|
187
|
-
locales,
|
|
188
|
-
version: versionRow
|
|
189
|
-
});
|
|
190
|
-
i++;
|
|
191
|
-
}
|
|
192
|
-
return count;
|
|
193
|
-
}
|
|
194
|
-
//# sourceMappingURL=countChangedFields.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"countChangedFields.js","names":["fieldHasChanges","getFieldsForRowComparison","countChangedFields","comparison","fields","locales","version","count","forEach","field","name","fieldType","type","localized","locale","comparisonRows","versionRows","countChangedFieldsInRows","tabs","tab","_exhaustiveCheck","Error","String","i","comparisonRow","versionRow","rowFields","baseVersionField","row"],"sources":["../../../../../src/views/Version/RenderFieldsToDiff/utilities/countChangedFields.ts"],"sourcesContent":["import type { ArrayFieldClient, BlocksFieldClient, ClientField } from 'payload'\n\nimport { fieldHasChanges } from './fieldHasChanges.js'\nimport { getFieldsForRowComparison } from './getFieldsForRowComparison.js'\n\ntype Args = {\n comparison: unknown\n fields: ClientField[]\n locales: string[] | undefined\n version: unknown\n}\n\n/**\n * Recursively counts the number of changed fields between comparison and\n * version data for a given set of fields.\n */\nexport function countChangedFields({ comparison, fields, locales, version }: Args) {\n let count = 0\n\n fields.forEach((field) => {\n // Don't count the id field since it is not displayed in the UI\n if ('name' in field && field.name === 'id') {\n return\n }\n const fieldType = field.type\n switch (fieldType) {\n // Iterable fields are arrays and blocks fields. We iterate over each row and\n // count the number of changed fields in each.\n case 'array':\n case 'blocks': {\n if (locales && field.localized) {\n locales.forEach((locale) => {\n const comparisonRows = comparison?.[field.name]?.[locale] ?? []\n const versionRows = version?.[field.name]?.[locale] ?? []\n count += countChangedFieldsInRows({ comparisonRows, field, locales, versionRows })\n })\n } else {\n const comparisonRows = comparison?.[field.name] ?? []\n const versionRows = version?.[field.name] ?? []\n count += countChangedFieldsInRows({ comparisonRows, field, locales, versionRows })\n }\n break\n }\n\n // Regular fields without nested fields.\n case 'checkbox':\n case 'code':\n case 'date':\n case 'email':\n case 'join':\n case 'json':\n case 'number':\n case 'point':\n case 'radio':\n case 'relationship':\n case 'richText':\n case 'select':\n case 'text':\n case 'textarea':\n case 'upload': {\n // Fields that have a name and contain data. We can just check if the data has changed.\n if (locales && field.localized) {\n locales.forEach((locale) => {\n if (\n fieldHasChanges(version?.[field.name]?.[locale], comparison?.[field.name]?.[locale])\n ) {\n count++\n }\n })\n } else if (fieldHasChanges(version?.[field.name], comparison?.[field.name])) {\n count++\n }\n break\n }\n // Fields that have nested fields, but don't nest their fields' data.\n case 'collapsible':\n case 'row': {\n count += countChangedFields({\n comparison,\n fields: field.fields,\n locales,\n version,\n })\n\n break\n }\n\n // Fields that have nested fields and nest their fields' data.\n case 'group': {\n if (locales && field.localized) {\n locales.forEach((locale) => {\n count += countChangedFields({\n comparison: comparison?.[field.name]?.[locale],\n fields: field.fields,\n locales,\n version: version?.[field.name]?.[locale],\n })\n })\n } else {\n count += countChangedFields({\n comparison: comparison?.[field.name],\n fields: field.fields,\n locales,\n version: version?.[field.name],\n })\n }\n break\n }\n\n // Each tab in a tabs field has nested fields. The fields data may be\n // nested or not depending on the existence of a name property.\n case 'tabs': {\n field.tabs.forEach((tab) => {\n if ('name' in tab && locales && tab.localized) {\n // Named localized tab\n locales.forEach((locale) => {\n count += countChangedFields({\n comparison: comparison?.[tab.name]?.[locale],\n fields: tab.fields,\n locales,\n version: version?.[tab.name]?.[locale],\n })\n })\n } else if ('name' in tab) {\n // Named tab\n count += countChangedFields({\n comparison: comparison?.[tab.name],\n fields: tab.fields,\n locales,\n version: version?.[tab.name],\n })\n } else {\n // Unnamed tab\n count += countChangedFields({\n comparison,\n fields: tab.fields,\n locales,\n version,\n })\n }\n })\n break\n }\n\n // UI fields don't have data and are not displayed in the version view\n // so we can ignore them.\n case 'ui': {\n break\n }\n\n default: {\n const _exhaustiveCheck: never = fieldType\n throw new Error(`Unexpected field.type in countChangedFields : ${String(fieldType)}`)\n }\n }\n })\n\n return count\n}\n\ntype countChangedFieldsInRowsArgs = {\n comparisonRows: unknown[]\n field: ArrayFieldClient | BlocksFieldClient\n locales: string[] | undefined\n versionRows: unknown[]\n}\n\nexport function countChangedFieldsInRows({\n comparisonRows = [],\n field,\n locales,\n versionRows = [],\n}: countChangedFieldsInRowsArgs) {\n let count = 0\n let i = 0\n\n while (comparisonRows[i] || versionRows[i]) {\n const comparisonRow = comparisonRows?.[i] || {}\n const versionRow = versionRows?.[i] || {}\n\n const { fields: rowFields } = getFieldsForRowComparison({\n baseVersionField: { fields: [] },\n comparisonRow,\n field,\n row: i,\n versionRow,\n })\n\n count += countChangedFields({\n comparison: comparisonRow,\n fields: rowFields,\n locales,\n version: versionRow,\n })\n\n i++\n }\n return count\n}\n"],"mappings":"AAEA,SAASA,eAAe,QAAQ;AAChC,SAASC,yBAAyB,QAAQ;AAS1C;;;;AAIA,OAAO,SAASC,mBAAmB;EAAEC,UAAU;EAAEC,MAAM;EAAEC,OAAO;EAAEC;AAAO,CAAQ;EAC/E,IAAIC,KAAA,GAAQ;EAEZH,MAAA,CAAOI,OAAO,CAAEC,KAAA;IACd;IACA,IAAI,UA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