@payloadcms/next 3.19.0 → 3.20.0-canary.0e01b65
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 +2 -1
- 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 +4 -2
- 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 +2 -1
- 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 +2 -1
- 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 +2 -0
- 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 +5 -2
- package/dist/views/LivePreview/index.client.js.map +1 -1
- package/dist/views/Version/Default/SelectedLocalesContext.d.ts +8 -0
- package/dist/views/Version/Default/SelectedLocalesContext.d.ts.map +1 -0
- package/dist/views/Version/Default/SelectedLocalesContext.js +10 -0
- package/dist/views/Version/Default/SelectedLocalesContext.js.map +1 -0
- package/dist/views/Version/Default/index.d.ts.map +1 -1
- package/dist/views/Version/Default/index.js +89 -159
- 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/DiffCollapser/index.d.ts +27 -0
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.d.ts.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js +76 -0
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.scss +46 -0
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.d.ts +6 -0
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.d.ts.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js +36 -0
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.d.ts +30 -0
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.d.ts.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +300 -0
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.d.ts +4 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.d.ts.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js +64 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.d.ts +5 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.d.ts.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js +69 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.scss +14 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts +3 -4
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +100 -63
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.scss +3 -12
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.d.ts +2 -4
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +18 -17
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.d.ts +4 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.d.ts.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.js +17 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts +2 -4
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +56 -28
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.d.ts +3 -4
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +146 -42
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.scss +20 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.d.ts +2 -4
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +71 -37
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/index.d.ts +2 -22
- package/dist/views/Version/RenderFieldsToDiff/fields/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js +13 -9
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/index.d.ts +2 -5
- package/dist/views/Version/RenderFieldsToDiff/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/index.js +8 -113
- package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/types.d.ts +2 -20
- package/dist/views/Version/RenderFieldsToDiff/types.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/types.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.d.ts +21 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.d.ts.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js +194 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js +860 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.d.ts +2 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.d.ts.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.js +4 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js +46 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.d.ts +27 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.d.ts.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.js +30 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.d.ts +18 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.d.ts.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js +44 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js.map +1 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js +122 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.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 +7 -3
- 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 +117 -15
- package/dist/views/Version/index.js.map +1 -1
- package/dist/views/Versions/getLatestVersion.d.ts +4 -1
- package/dist/views/Versions/getLatestVersion.d.ts.map +1 -1
- package/dist/views/Versions/getLatestVersion.js +6 -0
- package/dist/views/Versions/getLatestVersion.js.map +1 -1
- package/package.json +8 -8
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.d.ts +0 -6
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.d.ts.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js +0 -43
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.scss +0 -14
- package/dist/views/Version/RenderFieldsToDiff/fields/types.d.ts +0 -22
- package/dist/views/Version/RenderFieldsToDiff/fields/types.d.ts.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/types.js +0 -2
- package/dist/views/Version/RenderFieldsToDiff/fields/types.js.map +0 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { getTranslation } from '@payloadcms/translations';
|
|
6
|
+
import { useTranslation } from '@payloadcms/ui';
|
|
5
7
|
import React from 'react';
|
|
6
8
|
import Label from '../../Label/index.js';
|
|
7
9
|
import { diffStyles } from '../styles.js';
|
|
@@ -19,36 +21,62 @@ const getTranslatedOptions = (options, i18n) => {
|
|
|
19
21
|
}
|
|
20
22
|
return typeof options === 'string' ? options : getTranslation(options.label, i18n);
|
|
21
23
|
};
|
|
22
|
-
const Select =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
export const Select = t0 => {
|
|
25
|
+
const $ = _c(11);
|
|
26
|
+
const {
|
|
27
|
+
comparisonValue,
|
|
28
|
+
diffMethod,
|
|
29
|
+
field,
|
|
30
|
+
locale,
|
|
31
|
+
versionValue
|
|
32
|
+
} = t0;
|
|
33
|
+
const {
|
|
34
|
+
i18n
|
|
35
|
+
} = useTranslation();
|
|
36
|
+
let placeholder = "";
|
|
37
|
+
if (versionValue == comparisonValue) {
|
|
38
|
+
placeholder = `[${i18n.t("general:noValue")}]`;
|
|
33
39
|
}
|
|
34
|
-
const options =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
const options = "options" in field && field.options;
|
|
41
|
+
let t1;
|
|
42
|
+
if ($[0] !== comparisonValue || $[1] !== diffMethod || $[2] !== field || $[3] !== i18n || $[4] !== locale || $[5] !== options || $[6] !== placeholder || $[7] !== versionValue) {
|
|
43
|
+
const comparisonToRender = typeof comparisonValue !== "undefined" ? getTranslatedOptions(getOptionsToRender(typeof comparisonValue === "string" ? comparisonValue : JSON.stringify(comparisonValue), options, field.hasMany), i18n) : placeholder;
|
|
44
|
+
const versionToRender = typeof versionValue !== "undefined" ? getTranslatedOptions(getOptionsToRender(typeof versionValue === "string" ? versionValue : JSON.stringify(versionValue), options, field.hasMany), i18n) : placeholder;
|
|
45
|
+
let t2;
|
|
46
|
+
if ($[9] !== locale) {
|
|
47
|
+
t2 = locale && _jsx("span", {
|
|
41
48
|
className: `${baseClass}__locale-label`,
|
|
42
49
|
children: locale
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
});
|
|
51
|
+
$[9] = locale;
|
|
52
|
+
$[10] = t2;
|
|
53
|
+
} else {
|
|
54
|
+
t2 = $[10];
|
|
55
|
+
}
|
|
56
|
+
t1 = _jsxs("div", {
|
|
57
|
+
className: baseClass,
|
|
58
|
+
children: [_jsxs(Label, {
|
|
59
|
+
children: [t2, "label" in field && getTranslation(field.label || "", i18n)]
|
|
60
|
+
}), _jsx(DiffViewer, {
|
|
61
|
+
comparisonToRender,
|
|
62
|
+
diffMethod,
|
|
63
|
+
diffStyles,
|
|
64
|
+
placeholder,
|
|
65
|
+
versionToRender
|
|
66
|
+
})]
|
|
67
|
+
});
|
|
68
|
+
$[0] = comparisonValue;
|
|
69
|
+
$[1] = diffMethod;
|
|
70
|
+
$[2] = field;
|
|
71
|
+
$[3] = i18n;
|
|
72
|
+
$[4] = locale;
|
|
73
|
+
$[5] = options;
|
|
74
|
+
$[6] = placeholder;
|
|
75
|
+
$[7] = versionValue;
|
|
76
|
+
$[8] = t1;
|
|
77
|
+
} else {
|
|
78
|
+
t1 = $[8];
|
|
79
|
+
}
|
|
80
|
+
return t1;
|
|
52
81
|
};
|
|
53
|
-
export default Select;
|
|
54
82
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getTranslation","React","Label","diffStyles","DiffViewer","baseClass","getOptionsToRender","value","options","hasMany","Array","isArray","map","val","find","option","String","getTranslatedOptions","i18n","label","join","Select","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","getTranslation","useTranslation","React","Label","diffStyles","DiffViewer","baseClass","getOptionsToRender","value","options","hasMany","Array","isArray","map","val","find","option","String","getTranslatedOptions","i18n","label","join","Select","t0","$","comparisonValue","diffMethod","field","locale","versionValue","placeholder","t","t1","comparisonToRender","JSON","stringify","versionToRender","t2","_jsx","className","children","_jsxs"],"sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Select/index.tsx"],"sourcesContent":["'use client'\nimport type { I18nClient } from '@payloadcms/translations'\nimport type { DiffComponentProps, OptionObject, SelectField, SelectFieldClient } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { useTranslation } from '@payloadcms/ui'\nimport React from 'react'\n\nimport Label from '../../Label/index.js'\nimport './index.scss'\nimport { diffStyles } from '../styles.js'\nimport { DiffViewer } from './DiffViewer/index.js'\n\nconst baseClass = 'select-diff'\n\nconst getOptionsToRender = (\n value: string,\n options: SelectField['options'],\n hasMany: boolean,\n): (OptionObject | string)[] | OptionObject | string => {\n if (hasMany && Array.isArray(value)) {\n return value.map(\n (val) =>\n options.find((option) => (typeof option === 'string' ? option : option.value) === val) ||\n String(val),\n )\n }\n return (\n options.find((option) => (typeof option === 'string' ? option : option.value) === value) ||\n String(value)\n )\n}\n\nconst getTranslatedOptions = (\n options: (OptionObject | string)[] | OptionObject | string,\n i18n: I18nClient,\n): string => {\n if (Array.isArray(options)) {\n return options\n .map((option) => (typeof option === 'string' ? option : getTranslation(option.label, i18n)))\n .join(', ')\n }\n\n return typeof options === 'string' ? options : getTranslation(options.label, i18n)\n}\n\nexport const Select: React.FC<DiffComponentProps<SelectFieldClient>> = ({\n comparisonValue,\n diffMethod,\n field,\n locale,\n versionValue,\n}) => {\n const { i18n } = useTranslation()\n\n let placeholder = ''\n\n if (versionValue == comparisonValue) {\n placeholder = `[${i18n.t('general:noValue')}]`\n }\n\n const options = 'options' in field && field.options\n\n const comparisonToRender =\n typeof comparisonValue !== 'undefined'\n ? getTranslatedOptions(\n getOptionsToRender(\n typeof comparisonValue === 'string' ? comparisonValue : JSON.stringify(comparisonValue),\n options,\n field.hasMany,\n ),\n i18n,\n )\n : placeholder\n\n const versionToRender =\n typeof versionValue !== 'undefined'\n ? getTranslatedOptions(\n getOptionsToRender(\n typeof versionValue === 'string' ? versionValue : JSON.stringify(versionValue),\n options,\n field.hasMany,\n ),\n i18n,\n )\n : placeholder\n\n return (\n <div className={baseClass}>\n <Label>\n {locale && <span className={`${baseClass}__locale-label`}>{locale}</span>}\n {'label' in field && getTranslation(field.label || '', i18n)}\n </Label>\n <DiffViewer\n comparisonToRender={comparisonToRender}\n diffMethod={diffMethod}\n diffStyles={diffStyles}\n placeholder={placeholder}\n versionToRender={versionToRender}\n />\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAElB,OAAOC,KAAA,MAAW;AAElB,SAASC,UAAU,QAAQ;AAC3B,SAASC,UAAU,QAAQ;AAE3B,MAAMC,SAAA,GAAY;AAElB,MAAMC,kBAAA,GAAqBA,CACzBC,KAAA,EACAC,OAAA,EACAC,OAAA;EAEA,IAAIA,OAAA,IAAWC,KAAA,CAAMC,OAAO,CAACJ,KAAA,GAAQ;IACnC,OAAOA,KAAA,CAAMK,GAAG,CACbC,GAAA,IACCL,OAAA,CAAQM,IAAI,CAAEC,MAAA,IAAW,CAAC,OAAOA,MAAA,KAAW,WAAWA,MAAA,GAASA,MAAA,CAAOR,KAAK,MAAMM,GAAA,KAClFG,MAAA,CAAOH,GAAA;EAEb;EACA,OACEL,OAAA,CAAQM,IAAI,CAAEC,MAAA,IAAW,CAA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,eAAA,GAAkBS,IAAA,CAAAC,SAAA,CAAeV,eAAA,GACvEhB,OAAA,EACAkB,KAAA,CAAAjB,OAAa,GAEfS,IAAA,IAEFW,WAAA;IAEN,MAAAM,eAAA,GACE,OAAOP,YAAA,KAAiB,cACpBX,oBAAA,CACEX,kBAAA,CACE,OAAOsB,YAAA,KAAiB,WAAWA,YAAA,GAAeK,IAAA,CAAAC,SAAA,CAAeN,YAAA,GACjEpB,OAAA,EACAkB,KAAA,CAAAjB,OAAa,GAEfS,IAAA,IAEFW,WAAA;IAAA,IAAAO,EAAA;IAAA,IAAAb,CAAA,QAAAI,MAAA;MAKCS,EAAA,GAAAT,MAAA,IAAUU,IAAA,CAAC;QAAAC,SAAA,EAAgB,GAAAjC,SAAA,gBAA4B;QAAAkC,QAAA,EAAGZ;MAAA,C;;;;;;IAF/DI,EAAA,GAAAS,KAAA,CAAC;MAAAF,SAAA,EAAAjC,SAAA;MAAAkC,QAAA,GACCC,KAAA,CAAAtC,KAAA;QAAAqC,QAAA,GACGH,E,EACA,WAAWV,KAAA,IAAS3B,cAAA,CAAe2B,KAAA,CAAAP,KAAA,IAAe,IAAID,IAAA;MAAA,C,GAEzDmB,IAAA,CAAAjC,UAAA;QAAA4B,kBAAA;QAAAP,UAAA;QAAAtB,UAAA;QAAA0B,WAAA;QAAAM;MAAA,C;;;;;;;;;;;;;;SALFJ,E;CAcJ","ignoreList":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { TabsFieldClient } from 'payload';
|
|
1
|
+
import type { DiffComponentProps, TabsFieldClient } from 'payload';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import
|
|
4
|
-
declare const Tabs: React.FC<DiffComponentProps<TabsFieldClient>>;
|
|
5
|
-
export default Tabs;
|
|
3
|
+
import './index.scss';
|
|
4
|
+
export declare const Tabs: React.FC<DiffComponentProps<TabsFieldClient>>;
|
|
6
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Tabs/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Tabs/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,kBAAkB,EAAE,eAAe,EAAc,MAAM,SAAS,CAAA;AAIzF,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,cAAc,CAAA;AAOrB,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAmD9D,CAAA"}
|
|
@@ -1,50 +1,154 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { getTranslation } from '@payloadcms/translations';
|
|
6
|
+
import { useTranslation } from '@payloadcms/ui';
|
|
4
7
|
import React from 'react';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
8
|
+
import { useSelectedLocales } from '../../../Default/SelectedLocalesContext.js';
|
|
9
|
+
import { DiffCollapser } from '../../DiffCollapser/index.js';
|
|
10
|
+
import { RenderVersionFieldsToDiff } from '../../RenderVersionFieldsToDiff.js';
|
|
7
11
|
const baseClass = 'tabs-diff';
|
|
8
|
-
const Tabs =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
12
|
+
export const Tabs = props => {
|
|
13
|
+
const $ = _c(13);
|
|
14
|
+
const {
|
|
15
|
+
baseVersionField,
|
|
16
|
+
comparisonValue,
|
|
17
|
+
field,
|
|
18
|
+
versionValue
|
|
19
|
+
} = props;
|
|
20
|
+
const {
|
|
21
|
+
selectedLocales
|
|
22
|
+
} = useSelectedLocales();
|
|
23
|
+
let t0;
|
|
24
|
+
if ($[0] !== baseVersionField.tabs || $[1] !== comparisonValue || $[2] !== field.tabs || $[3] !== props || $[4] !== selectedLocales || $[5] !== versionValue) {
|
|
25
|
+
let t1;
|
|
26
|
+
if ($[7] !== comparisonValue || $[8] !== field.tabs || $[9] !== props || $[10] !== selectedLocales || $[11] !== versionValue) {
|
|
27
|
+
t1 = (tab, i) => {
|
|
28
|
+
const fieldTab = field.tabs?.[i];
|
|
29
|
+
return _jsx("div", {
|
|
30
|
+
className: `${baseClass}__tab`,
|
|
31
|
+
children: (() => {
|
|
32
|
+
if ("name" in fieldTab && selectedLocales && fieldTab.localized) {
|
|
33
|
+
return selectedLocales.map((locale, index) => {
|
|
34
|
+
const localizedTabProps = {
|
|
35
|
+
...props,
|
|
36
|
+
comparison: comparisonValue?.[tab.name]?.[locale],
|
|
37
|
+
version: versionValue?.[tab.name]?.[locale]
|
|
38
|
+
};
|
|
39
|
+
return _jsx("div", {
|
|
40
|
+
className: `${baseClass}__tab-locale`,
|
|
41
|
+
children: _jsx("div", {
|
|
42
|
+
className: `${baseClass}__tab-locale-value`,
|
|
43
|
+
children: _jsx(Tab, {
|
|
44
|
+
...localizedTabProps,
|
|
45
|
+
fieldTab,
|
|
46
|
+
locale,
|
|
47
|
+
tab
|
|
48
|
+
}, locale)
|
|
49
|
+
})
|
|
50
|
+
}, [locale, index].join("-"));
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
if ("name" in tab && tab.name) {
|
|
54
|
+
const namedTabProps = {
|
|
55
|
+
...props,
|
|
56
|
+
comparison: comparisonValue?.[tab.name],
|
|
57
|
+
version: versionValue?.[tab.name]
|
|
58
|
+
};
|
|
59
|
+
return _jsx(Tab, {
|
|
60
|
+
fieldTab,
|
|
61
|
+
...namedTabProps,
|
|
62
|
+
tab
|
|
63
|
+
}, i);
|
|
64
|
+
} else {
|
|
65
|
+
return _jsx(Tab, {
|
|
66
|
+
fieldTab,
|
|
67
|
+
...props,
|
|
68
|
+
tab
|
|
69
|
+
}, i);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
})()
|
|
44
73
|
}, i);
|
|
74
|
+
};
|
|
75
|
+
$[7] = comparisonValue;
|
|
76
|
+
$[8] = field.tabs;
|
|
77
|
+
$[9] = props;
|
|
78
|
+
$[10] = selectedLocales;
|
|
79
|
+
$[11] = versionValue;
|
|
80
|
+
$[12] = t1;
|
|
81
|
+
} else {
|
|
82
|
+
t1 = $[12];
|
|
83
|
+
}
|
|
84
|
+
t0 = _jsx("div", {
|
|
85
|
+
className: baseClass,
|
|
86
|
+
children: baseVersionField.tabs.map(t1)
|
|
87
|
+
});
|
|
88
|
+
$[0] = baseVersionField.tabs;
|
|
89
|
+
$[1] = comparisonValue;
|
|
90
|
+
$[2] = field.tabs;
|
|
91
|
+
$[3] = props;
|
|
92
|
+
$[4] = selectedLocales;
|
|
93
|
+
$[5] = versionValue;
|
|
94
|
+
$[6] = t0;
|
|
95
|
+
} else {
|
|
96
|
+
t0 = $[6];
|
|
97
|
+
}
|
|
98
|
+
return t0;
|
|
99
|
+
};
|
|
100
|
+
const Tab = t0 => {
|
|
101
|
+
const $ = _c(11);
|
|
102
|
+
const {
|
|
103
|
+
comparisonValue,
|
|
104
|
+
fieldTab,
|
|
105
|
+
locale,
|
|
106
|
+
tab,
|
|
107
|
+
versionValue
|
|
108
|
+
} = t0;
|
|
109
|
+
const {
|
|
110
|
+
i18n
|
|
111
|
+
} = useTranslation();
|
|
112
|
+
const {
|
|
113
|
+
selectedLocales
|
|
114
|
+
} = useSelectedLocales();
|
|
115
|
+
let t1;
|
|
116
|
+
if ($[0] !== i18n || $[1] !== locale || $[2] !== tab) {
|
|
117
|
+
t1 = "label" in tab && tab.label && typeof tab.label !== "function" && _jsxs("span", {
|
|
118
|
+
children: [locale && _jsx("span", {
|
|
119
|
+
className: `${baseClass}__locale-label`,
|
|
120
|
+
children: locale
|
|
121
|
+
}), getTranslation(tab.label, i18n)]
|
|
122
|
+
});
|
|
123
|
+
$[0] = i18n;
|
|
124
|
+
$[1] = locale;
|
|
125
|
+
$[2] = tab;
|
|
126
|
+
$[3] = t1;
|
|
127
|
+
} else {
|
|
128
|
+
t1 = $[3];
|
|
129
|
+
}
|
|
130
|
+
let t2;
|
|
131
|
+
if ($[4] !== comparisonValue || $[5] !== fieldTab.fields || $[6] !== selectedLocales || $[7] !== t1 || $[8] !== tab.fields || $[9] !== versionValue) {
|
|
132
|
+
t2 = _jsx(DiffCollapser, {
|
|
133
|
+
comparison: comparisonValue,
|
|
134
|
+
fields: fieldTab.fields,
|
|
135
|
+
label: t1,
|
|
136
|
+
locales: selectedLocales,
|
|
137
|
+
version: versionValue,
|
|
138
|
+
children: _jsx(RenderVersionFieldsToDiff, {
|
|
139
|
+
versionFields: tab.fields
|
|
45
140
|
})
|
|
46
|
-
})
|
|
47
|
-
|
|
141
|
+
});
|
|
142
|
+
$[4] = comparisonValue;
|
|
143
|
+
$[5] = fieldTab.fields;
|
|
144
|
+
$[6] = selectedLocales;
|
|
145
|
+
$[7] = t1;
|
|
146
|
+
$[8] = tab.fields;
|
|
147
|
+
$[9] = versionValue;
|
|
148
|
+
$[10] = t2;
|
|
149
|
+
} else {
|
|
150
|
+
t2 = $[10];
|
|
151
|
+
}
|
|
152
|
+
return t2;
|
|
48
153
|
};
|
|
49
|
-
export default Tabs;
|
|
50
154
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","getTranslation","useTranslation","React","useSelectedLocales","DiffCollapser","RenderVersionFieldsToDiff","baseClass","Tabs","props","$","baseVersionField","comparisonValue","field","versionValue","selectedLocales","t0","tabs","t1","tab","i","fieldTab","_jsx","className","children","localized","map","locale","index","localizedTabProps","comparison","name","version","Tab","join","namedTabProps","i18n","label","_jsxs","t2","fields","versionFields"],"sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Tabs/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientTab, DiffComponentProps, TabsFieldClient, VersionTab } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { useTranslation } from '@payloadcms/ui'\nimport React from 'react'\n\nimport './index.scss'\nimport { useSelectedLocales } from '../../../Default/SelectedLocalesContext.js'\nimport { DiffCollapser } from '../../DiffCollapser/index.js'\nimport { RenderVersionFieldsToDiff } from '../../RenderVersionFieldsToDiff.js'\n\nconst baseClass = 'tabs-diff'\n\nexport const Tabs: React.FC<DiffComponentProps<TabsFieldClient>> = (props) => {\n const { baseVersionField, comparisonValue, field, versionValue } = props\n const { selectedLocales } = useSelectedLocales()\n\n return (\n <div className={baseClass}>\n {baseVersionField.tabs.map((tab, i) => {\n const fieldTab = field.tabs?.[i]\n return (\n <div className={`${baseClass}__tab`} key={i}>\n {(() => {\n if ('name' in fieldTab && selectedLocales && fieldTab.localized) {\n // Named localized tab\n return selectedLocales.map((locale, index) => {\n const localizedTabProps = {\n ...props,\n comparison: comparisonValue?.[tab.name]?.[locale],\n version: versionValue?.[tab.name]?.[locale],\n }\n return (\n <div className={`${baseClass}__tab-locale`} key={[locale, index].join('-')}>\n <div className={`${baseClass}__tab-locale-value`}>\n <Tab\n key={locale}\n {...localizedTabProps}\n fieldTab={fieldTab}\n locale={locale}\n tab={tab}\n />\n </div>\n </div>\n )\n })\n } else if ('name' in tab && tab.name) {\n // Named tab\n const namedTabProps = {\n ...props,\n comparison: comparisonValue?.[tab.name],\n version: versionValue?.[tab.name],\n }\n return <Tab fieldTab={fieldTab} key={i} {...namedTabProps} tab={tab} />\n } else {\n // Unnamed tab\n return <Tab fieldTab={fieldTab} key={i} {...props} tab={tab} />\n }\n })()}\n </div>\n )\n })}\n </div>\n )\n}\n\ntype TabProps = {\n fieldTab: ClientTab\n tab: VersionTab\n} & DiffComponentProps<TabsFieldClient>\n\nconst Tab: React.FC<TabProps> = ({ comparisonValue, fieldTab, locale, tab, versionValue }) => {\n const { i18n } = useTranslation()\n const { selectedLocales } = useSelectedLocales()\n\n return (\n <DiffCollapser\n comparison={comparisonValue}\n fields={fieldTab.fields}\n label={\n 'label' in tab &&\n tab.label &&\n typeof tab.label !== 'function' && (\n <span>\n {locale && <span className={`${baseClass}__locale-label`}>{locale}</span>}\n {getTranslation(tab.label, i18n)}\n </span>\n )\n }\n locales={selectedLocales}\n version={versionValue}\n >\n <RenderVersionFieldsToDiff versionFields={tab.fields} />\n </DiffCollapser>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAGlB,SAASC,kBAAkB,QAAQ;AACnC,SAASC,aAAa,QAAQ;AAC9B,SAASC,yBAAyB,QAAQ;AAE1C,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,IAAA,GAAsDC,KAAA;EAAA,MAAAC,CAAA,GAAAV,EAAA;EACjE;IAAAW,gBAAA;IAAAC,eAAA;IAAAC,KAAA;IAAAC;EAAA,IAAmEL,KAAA;EACnE;IAAAM;EAAA,IAA4BX,kBAAA;EAAA,IAAAY,EAAA;EAAA,IAAAN,CAAA,QAAAC,gBAAA,CAAAM,IAAA,IAAAP,CAAA,QAAAE,eAAA,IAAAF,CAAA,QAAAG,KAAA,CAAAI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AAA,CAAC;QAAAC,SAAA,EAAgB,GAAAhB,SAAA,gBAA4B;QAAAiB,QAAA,EAAGG;MAAA,C,GAC1D1B,cAAA,CAAekB,GAAA,CAAAkB,KAAA,EAAWD,IAAA;IAAA,C;;;;;;;;;;IATnCG,EAAA,GAAAjB,IAAA,CAAAjB,aAAA;MAAAyB,UAAA,EACclB,eAAA;MAAA4B,MAAA,EACJnB,QAAA,CAAAmB,MAAA;MAAAH,KAAA,EAENnB,E;eASOH,eAAA;MAAAiB,OAAA,EACAlB,YAAA;MAAAU,QAAA,EAETF,IAAA,CAAAhB,yBAAA;QAAAmC,aAAA,EAA0CtB,GAAA,CAAAqB;MAAA,C;;;;;;;;;;;;SAhB5CD,E;CAmBJ","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@layer payload-default {
|
|
2
|
+
.tabs-diff {
|
|
3
|
+
// Space between each tab or tab locale
|
|
4
|
+
&__tab:not(:first-of-type),
|
|
5
|
+
&__tab-locale:not(:first-of-type) {
|
|
6
|
+
margin-top: var(--base);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
&__locale-label {
|
|
10
|
+
background: var(--theme-elevation-100);
|
|
11
|
+
padding: calc(var(--base) * 0.25);
|
|
12
|
+
[dir='ltr'] & {
|
|
13
|
+
margin-right: calc(var(--base) * 0.25);
|
|
14
|
+
}
|
|
15
|
+
[dir='rtl'] & {
|
|
16
|
+
margin-left: calc(var(--base) * 0.25);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type { TextFieldClient } from 'payload';
|
|
1
|
+
import type { DiffComponentProps, TextFieldClient } from 'payload';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { DiffComponentProps } from '../types.js';
|
|
4
3
|
import './index.scss';
|
|
5
|
-
declare const Text: React.FC<DiffComponentProps<TextFieldClient>>;
|
|
6
|
-
export default Text;
|
|
4
|
+
export declare const Text: React.FC<DiffComponentProps<TextFieldClient>>;
|
|
7
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Text/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Text/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAIlE,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,cAAc,CAAA;AAMrB,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAqC9D,CAAA"}
|
|
@@ -1,50 +1,84 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { getTranslation } from '@payloadcms/translations';
|
|
6
|
+
import { useTranslation } from '@payloadcms/ui';
|
|
5
7
|
import React from 'react';
|
|
6
8
|
import Label from '../../Label/index.js';
|
|
7
9
|
import { diffStyles } from '../styles.js';
|
|
8
10
|
import { DiffViewer } from './DiffViewer/index.js';
|
|
9
11
|
const baseClass = 'text-diff';
|
|
10
|
-
const Text =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
export const Text = t0 => {
|
|
13
|
+
const $ = _c(14);
|
|
14
|
+
const {
|
|
15
|
+
comparisonValue,
|
|
16
|
+
diffMethod,
|
|
17
|
+
field,
|
|
18
|
+
locale,
|
|
19
|
+
versionValue
|
|
20
|
+
} = t0;
|
|
21
|
+
const {
|
|
22
|
+
i18n
|
|
23
|
+
} = useTranslation();
|
|
24
|
+
let placeholder = "";
|
|
25
|
+
if (versionValue == comparisonValue) {
|
|
26
|
+
placeholder = `[${i18n.t("general:noValue")}]`;
|
|
22
27
|
}
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
comparisonToRender = JSON.stringify(comparison, null, 2);
|
|
31
|
-
}
|
|
28
|
+
let t1;
|
|
29
|
+
if ($[0] !== versionValue) {
|
|
30
|
+
t1 = typeof versionValue === "string" ? versionValue : JSON.stringify(versionValue, null, 2);
|
|
31
|
+
$[0] = versionValue;
|
|
32
|
+
$[1] = t1;
|
|
33
|
+
} else {
|
|
34
|
+
t1 = $[1];
|
|
32
35
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
const versionToRender = t1;
|
|
37
|
+
let t2;
|
|
38
|
+
if ($[2] !== comparisonValue) {
|
|
39
|
+
t2 = typeof comparisonValue === "string" ? comparisonValue : JSON.stringify(comparisonValue, null, 2);
|
|
40
|
+
$[2] = comparisonValue;
|
|
41
|
+
$[3] = t2;
|
|
42
|
+
} else {
|
|
43
|
+
t2 = $[3];
|
|
44
|
+
}
|
|
45
|
+
const comparisonToRender = t2;
|
|
46
|
+
let t3;
|
|
47
|
+
if ($[4] !== locale) {
|
|
48
|
+
t3 = locale && _jsx("span", {
|
|
49
|
+
className: `${baseClass}__locale-label`,
|
|
50
|
+
children: locale
|
|
51
|
+
});
|
|
52
|
+
$[4] = locale;
|
|
53
|
+
$[5] = t3;
|
|
54
|
+
} else {
|
|
55
|
+
t3 = $[5];
|
|
56
|
+
}
|
|
57
|
+
let t4;
|
|
58
|
+
if ($[6] !== comparisonToRender || $[7] !== diffMethod || $[8] !== field || $[9] !== i18n || $[10] !== placeholder || $[11] !== t3 || $[12] !== versionToRender) {
|
|
59
|
+
t4 = _jsxs("div", {
|
|
60
|
+
className: baseClass,
|
|
61
|
+
children: [_jsxs(Label, {
|
|
62
|
+
children: [t3, "label" in field && typeof field.label !== "function" && getTranslation(field.label || "", i18n)]
|
|
63
|
+
}), _jsx(DiffViewer, {
|
|
64
|
+
comparisonToRender,
|
|
65
|
+
diffMethod,
|
|
66
|
+
diffStyles,
|
|
67
|
+
placeholder,
|
|
68
|
+
versionToRender
|
|
69
|
+
})]
|
|
70
|
+
});
|
|
71
|
+
$[6] = comparisonToRender;
|
|
72
|
+
$[7] = diffMethod;
|
|
73
|
+
$[8] = field;
|
|
74
|
+
$[9] = i18n;
|
|
75
|
+
$[10] = placeholder;
|
|
76
|
+
$[11] = t3;
|
|
77
|
+
$[12] = versionToRender;
|
|
78
|
+
$[13] = t4;
|
|
79
|
+
} else {
|
|
80
|
+
t4 = $[13];
|
|
81
|
+
}
|
|
82
|
+
return t4;
|
|
48
83
|
};
|
|
49
|
-
export default Text;
|
|
50
84
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getTranslation","React","Label","diffStyles","DiffViewer","baseClass","Text","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","getTranslation","useTranslation","React","Label","diffStyles","DiffViewer","baseClass","Text","t0","$","comparisonValue","diffMethod","field","locale","versionValue","i18n","placeholder","t","t1","JSON","stringify","versionToRender","t2","comparisonToRender","t3","_jsx","className","children","t4","_jsxs","label"],"sources":["../../../../../../src/views/Version/RenderFieldsToDiff/fields/Text/index.tsx"],"sourcesContent":["'use client'\nimport type { DiffComponentProps, TextFieldClient } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { useTranslation } from '@payloadcms/ui'\nimport React from 'react'\n\nimport Label from '../../Label/index.js'\nimport './index.scss'\nimport { diffStyles } from '../styles.js'\nimport { DiffViewer } from './DiffViewer/index.js'\n\nconst baseClass = 'text-diff'\n\nexport const Text: React.FC<DiffComponentProps<TextFieldClient>> = ({\n comparisonValue,\n diffMethod,\n field,\n locale,\n versionValue,\n}) => {\n const { i18n } = useTranslation()\n\n let placeholder = ''\n\n if (versionValue == comparisonValue) {\n placeholder = `[${i18n.t('general:noValue')}]`\n }\n\n const versionToRender: string =\n typeof versionValue === 'string' ? versionValue : JSON.stringify(versionValue, null, 2)\n const comparisonToRender =\n typeof comparisonValue === 'string' ? comparisonValue : JSON.stringify(comparisonValue, null, 2)\n\n return (\n <div className={baseClass}>\n <Label>\n {locale && <span className={`${baseClass}__locale-label`}>{locale}</span>}\n {'label' in field &&\n typeof field.label !== 'function' &&\n getTranslation(field.label || '', i18n)}\n </Label>\n <DiffViewer\n comparisonToRender={comparisonToRender}\n diffMethod={diffMethod}\n diffStyles={diffStyles}\n placeholder={placeholder}\n versionToRender={versionToRender}\n />\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAElB,OAAOC,KAAA,MAAW;AAElB,SAASC,UAAU,QAAQ;AAC3B,SAASC,UAAU,QAAQ;AAE3B,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,IAAA,GAAsDC,EAAA;EAAA,MAAAC,CAAA,GAAAV,EAAA;EAAC;IAAAW,eAAA;IAAAC,UAAA;IAAAC,KAAA;IAAAC,MAAA;IAAAC;EAAA,IAAAN,EAMnE;EACC;IAAAO;EAAA,IAAiBd,cAAA;EAEjB,IAAAe,WAAA,GAAkB;EAAA,IAEdF,YAAA,IAAgBJ,eAAA;IAClBM,WAAA,CAAAA,CAAA,CAA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ocks: import("react").FC<import("./types.js").DiffComponentProps>;
|
|
4
|
-
checkbox: import("react").FC<import("./types.js").DiffComponentProps<import("payload").TextFieldClient>>;
|
|
5
|
-
code: import("react").FC<import("./types.js").DiffComponentProps<import("payload").TextFieldClient>>;
|
|
6
|
-
collapsible: import("react").FC<import("./types.js").DiffComponentProps>;
|
|
7
|
-
date: import("react").FC<import("./types.js").DiffComponentProps<import("payload").TextFieldClient>>;
|
|
8
|
-
email: import("react").FC<import("./types.js").DiffComponentProps<import("payload").TextFieldClient>>;
|
|
9
|
-
group: import("react").FC<import("./types.js").DiffComponentProps>;
|
|
10
|
-
json: import("react").FC<import("./types.js").DiffComponentProps<import("payload").TextFieldClient>>;
|
|
11
|
-
number: import("react").FC<import("./types.js").DiffComponentProps<import("payload").TextFieldClient>>;
|
|
12
|
-
point: import("react").FC<import("./types.js").DiffComponentProps<import("payload").TextFieldClient>>;
|
|
13
|
-
radio: import("react").FC<import("./types.js").DiffComponentProps<import("payload").SelectFieldClient>>;
|
|
14
|
-
relationship: import("react").FC<import("./types.js").DiffComponentProps<import("payload").RelationshipFieldClient>>;
|
|
15
|
-
richText: import("react").FC<import("./types.js").DiffComponentProps<import("payload").TextFieldClient>>;
|
|
16
|
-
row: import("react").FC<import("./types.js").DiffComponentProps>;
|
|
17
|
-
select: import("react").FC<import("./types.js").DiffComponentProps<import("payload").SelectFieldClient>>;
|
|
18
|
-
tabs: import("react").FC<import("./types.js").DiffComponentProps<import("payload").TabsFieldClient>>;
|
|
19
|
-
text: import("react").FC<import("./types.js").DiffComponentProps<import("payload").TextFieldClient>>;
|
|
20
|
-
textarea: import("react").FC<import("./types.js").DiffComponentProps<import("payload").TextFieldClient>>;
|
|
21
|
-
upload: import("react").FC<import("./types.js").DiffComponentProps<import("payload").RelationshipFieldClient>>;
|
|
22
|
-
};
|
|
1
|
+
import type { DiffComponentProps, FieldTypes } from 'payload';
|
|
2
|
+
export declare const diffComponents: Record<FieldTypes, React.FC<DiffComponentProps>>;
|
|
23
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/views/Version/RenderFieldsToDiff/fields/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/views/Version/RenderFieldsToDiff/fields/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAW7D,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAuB3E,CAAA"}
|