@payloadcms/next 3.68.0-internal-debug.591ab42 → 3.68.0-internal-debug.e9b66ee
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js +6 -21
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js +20 -44
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.js +41 -73
- package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js +1 -10
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js.map +1 -1
- package/dist/elements/DocumentHeader/index.js +7 -45
- package/dist/elements/DocumentHeader/index.js.map +1 -1
- package/dist/elements/FormHeader/index.js +4 -25
- package/dist/elements/FormHeader/index.js.map +1 -1
- package/dist/elements/Nav/NavHamburger/index.js +5 -21
- package/dist/elements/Nav/NavHamburger/index.js.map +1 -1
- package/dist/elements/Nav/NavWrapper/index.js +10 -24
- package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
- package/dist/elements/Nav/SettingsMenuButton/index.js +4 -27
- package/dist/elements/Nav/SettingsMenuButton/index.js.map +1 -1
- package/dist/elements/Nav/index.client.js +43 -91
- package/dist/elements/Nav/index.client.js.map +1 -1
- package/dist/elements/Nav/index.js +48 -100
- package/dist/elements/Nav/index.js.map +1 -1
- package/dist/layouts/Root/NestProviders.js +3 -12
- package/dist/layouts/Root/NestProviders.js.map +1 -1
- package/dist/layouts/Root/index.js +19 -84
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/prod/styles.css +5 -0
- package/dist/routes/rest/og/image.js +61 -97
- package/dist/routes/rest/og/image.js.map +1 -1
- package/dist/routes/rest/og/index.js +1 -15
- package/dist/routes/rest/og/index.js.map +1 -1
- package/dist/templates/Default/NavHamburger/index.js +1 -10
- package/dist/templates/Default/NavHamburger/index.js.map +1 -1
- package/dist/templates/Default/Wrapper/index.js +9 -16
- package/dist/templates/Default/Wrapper/index.js.map +1 -1
- package/dist/templates/Default/index.js +38 -106
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/templates/Minimal/index.js +3 -18
- package/dist/templates/Minimal/index.js.map +1 -1
- package/dist/views/API/LocaleSelector/index.js +5 -15
- package/dist/views/API/LocaleSelector/index.js.map +1 -1
- package/dist/views/API/RenderJSON/index.js +59 -156
- package/dist/views/API/RenderJSON/index.js.map +1 -1
- package/dist/views/API/index.client.js +71 -215
- package/dist/views/API/index.client.js.map +1 -1
- package/dist/views/API/index.js +1 -7
- package/dist/views/API/index.js.map +1 -1
- package/dist/views/Account/ResetPreferences/index.js +8 -35
- package/dist/views/Account/ResetPreferences/index.js.map +1 -1
- package/dist/views/Account/Settings/LanguageSelector.js +3 -15
- package/dist/views/Account/Settings/LanguageSelector.js.map +1 -1
- package/dist/views/Account/Settings/index.js +12 -58
- package/dist/views/Account/Settings/index.js.map +1 -1
- package/dist/views/Account/ToggleTheme/index.js +19 -30
- package/dist/views/Account/ToggleTheme/index.js.map +1 -1
- package/dist/views/Account/index.js +25 -83
- package/dist/views/Account/index.js.map +1 -1
- package/dist/views/BrowseByFolder/buildView.js +28 -38
- package/dist/views/BrowseByFolder/buildView.js.map +1 -1
- package/dist/views/CollectionFolders/buildView.js +35 -45
- package/dist/views/CollectionFolders/buildView.js.map +1 -1
- package/dist/views/CreateFirstUser/index.client.js +20 -75
- package/dist/views/CreateFirstUser/index.client.js.map +1 -1
- package/dist/views/CreateFirstUser/index.js +5 -36
- package/dist/views/CreateFirstUser/index.js.map +1 -1
- package/dist/views/Dashboard/Default/index.js +94 -169
- package/dist/views/Dashboard/Default/index.js.map +1 -1
- package/dist/views/Dashboard/index.js +24 -43
- package/dist/views/Dashboard/index.js.map +1 -1
- package/dist/views/Document/index.js +14 -76
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/Edit/index.js +1 -9
- package/dist/views/Edit/index.js.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +57 -104
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
- package/dist/views/ForgotPassword/index.js +23 -75
- package/dist/views/ForgotPassword/index.js.map +1 -1
- package/dist/views/List/index.js +31 -53
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/List/renderListViewSlots.js +9 -21
- package/dist/views/List/renderListViewSlots.js.map +1 -1
- package/dist/views/Login/LoginField/index.js +23 -49
- package/dist/views/Login/LoginField/index.js.map +1 -1
- package/dist/views/Login/LoginForm/index.js +20 -68
- package/dist/views/Login/LoginForm/index.js.map +1 -1
- package/dist/views/Login/index.js +33 -66
- package/dist/views/Login/index.js.map +1 -1
- package/dist/views/Logout/LogoutClient.js +7 -36
- package/dist/views/Logout/LogoutClient.js.map +1 -1
- package/dist/views/Logout/index.js +4 -26
- package/dist/views/Logout/index.js.map +1 -1
- package/dist/views/NotFound/index.client.js +15 -55
- package/dist/views/NotFound/index.client.js.map +1 -1
- package/dist/views/NotFound/index.js +5 -33
- package/dist/views/NotFound/index.js.map +1 -1
- package/dist/views/ResetPassword/ResetPasswordForm/index.js +12 -57
- package/dist/views/ResetPassword/ResetPasswordForm/index.js.map +1 -1
- package/dist/views/ResetPassword/index.js +23 -86
- package/dist/views/ResetPassword/index.js.map +1 -1
- package/dist/views/Root/index.js +12 -52
- package/dist/views/Root/index.js.map +1 -1
- package/dist/views/Unauthorized/index.js +15 -50
- package/dist/views/Unauthorized/index.js.map +1 -1
- package/dist/views/Verify/index.js +10 -47
- package/dist/views/Verify/index.js.map +1 -1
- package/dist/views/Version/Default/SelectedLocalesContext.js +1 -1
- package/dist/views/Version/Default/SelectedLocalesContext.js.map +1 -1
- package/dist/views/Version/Default/index.js +52 -258
- package/dist/views/Version/Default/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js +16 -65
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js +24 -66
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js +5 -34
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js +4 -17
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js +10 -55
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +43 -128
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +23 -151
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.js +3 -16
- package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +4 -17
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +51 -122
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +4 -17
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.js +27 -176
- package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/index.js +1 -9
- package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
- package/dist/views/Version/Restore/index.js +21 -61
- package/dist/views/Version/Restore/index.js.map +1 -1
- package/dist/views/Version/SelectComparison/VersionDrawer/CreatedAtCell.js +16 -24
- package/dist/views/Version/SelectComparison/VersionDrawer/CreatedAtCell.js.map +1 -1
- package/dist/views/Version/SelectComparison/VersionDrawer/index.js +6 -37
- package/dist/views/Version/SelectComparison/VersionDrawer/index.js.map +1 -1
- package/dist/views/Version/SelectComparison/index.js +10 -40
- package/dist/views/Version/SelectComparison/index.js.map +1 -1
- package/dist/views/Version/SelectLocales/index.js +17 -33
- package/dist/views/Version/SelectLocales/index.js.map +1 -1
- package/dist/views/Version/VersionPillLabel/VersionPillLabel.js +17 -84
- package/dist/views/Version/VersionPillLabel/VersionPillLabel.js.map +1 -1
- package/dist/views/Version/index.js +21 -63
- package/dist/views/Version/index.js.map +1 -1
- package/dist/views/Versions/buildColumns.js +9 -58
- package/dist/views/Versions/buildColumns.js.map +1 -1
- package/dist/views/Versions/cells/AutosaveCell/index.js +4 -31
- package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
- package/dist/views/Versions/cells/CreatedAt/index.js +7 -15
- package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
- package/dist/views/Versions/cells/ID/index.js +2 -9
- package/dist/views/Versions/cells/ID/index.js.map +1 -1
- package/dist/views/Versions/index.client.js +20 -98
- package/dist/views/Versions/index.client.js.map +1 -1
- package/dist/views/Versions/index.js +13 -59
- package/dist/views/Versions/index.js.map +1 -1
- package/package.json +10 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/views/Version/SelectComparison/VersionDrawer/CreatedAtCell.tsx"],"sourcesContent":["'use client'\nimport { useConfig, useModal, useRouteTransition, useTranslation } from '@payloadcms/ui'\nimport { formatDate } from '@payloadcms/ui/shared'\nimport { usePathname, useRouter, useSearchParams } from 'next/navigation.js'\n\nimport type { CreatedAtCellProps } from '../../../Versions/cells/CreatedAt/index.js'\n\nexport const VersionDrawerCreatedAtCell: React.FC<CreatedAtCellProps> = ({\n rowData: { id, updatedAt } = {},\n}) => {\n const {\n config: {\n admin: { dateFormat },\n },\n } = useConfig()\n const { closeAllModals } = useModal()\n const router = useRouter()\n const pathname = usePathname()\n const searchParams = useSearchParams()\n const { startRouteTransition } = useRouteTransition()\n\n const { i18n } = useTranslation()\n\n return (\n <button\n className=\"created-at-cell\"\n onClick={() => {\n closeAllModals()\n const current = new URLSearchParams(Array.from(searchParams.entries()))\n\n if (id) {\n current.set('versionFrom', String(id))\n }\n\n const search = current.toString()\n const query = search ? `?${search}` : ''\n\n startRouteTransition(() => router.push(`${pathname}${query}`))\n }}\n type=\"button\"\n >\n {formatDate({ date: updatedAt, i18n, pattern: dateFormat })}\n </button>\n )\n}\n"],"names":["useConfig","useModal","useRouteTransition","useTranslation","formatDate","usePathname","useRouter","useSearchParams","VersionDrawerCreatedAtCell","rowData","id","updatedAt","config","admin","dateFormat","closeAllModals","router","pathname","searchParams","startRouteTransition","i18n","button","className","onClick","current","URLSearchParams","Array","from","entries","set","String","search","toString","query","push","type","date","pattern"],"mappings":"AAAA
|
|
1
|
+
{"version":3,"sources":["../../../../../src/views/Version/SelectComparison/VersionDrawer/CreatedAtCell.tsx"],"sourcesContent":["'use client'\nimport { useConfig, useModal, useRouteTransition, useTranslation } from '@payloadcms/ui'\nimport { formatDate } from '@payloadcms/ui/shared'\nimport { usePathname, useRouter, useSearchParams } from 'next/navigation.js'\n\nimport type { CreatedAtCellProps } from '../../../Versions/cells/CreatedAt/index.js'\n\nexport const VersionDrawerCreatedAtCell: React.FC<CreatedAtCellProps> = ({\n rowData: { id, updatedAt } = {},\n}) => {\n const {\n config: {\n admin: { dateFormat },\n },\n } = useConfig()\n const { closeAllModals } = useModal()\n const router = useRouter()\n const pathname = usePathname()\n const searchParams = useSearchParams()\n const { startRouteTransition } = useRouteTransition()\n\n const { i18n } = useTranslation()\n\n return (\n <button\n className=\"created-at-cell\"\n onClick={() => {\n closeAllModals()\n const current = new URLSearchParams(Array.from(searchParams.entries()))\n\n if (id) {\n current.set('versionFrom', String(id))\n }\n\n const search = current.toString()\n const query = search ? `?${search}` : ''\n\n startRouteTransition(() => router.push(`${pathname}${query}`))\n }}\n type=\"button\"\n >\n {formatDate({ date: updatedAt, i18n, pattern: dateFormat })}\n </button>\n )\n}\n"],"names":["useConfig","useModal","useRouteTransition","useTranslation","formatDate","usePathname","useRouter","useSearchParams","VersionDrawerCreatedAtCell","rowData","id","updatedAt","config","admin","dateFormat","closeAllModals","router","pathname","searchParams","startRouteTransition","i18n","button","className","onClick","current","URLSearchParams","Array","from","entries","set","String","search","toString","query","push","type","date","pattern"],"mappings":"AAAA;AACA,SAASA,SAAS,EAAEC,QAAQ,EAAEC,kBAAkB,EAAEC,cAAc,QAAQ,iBAAgB;AACxF,SAASC,UAAU,QAAQ,wBAAuB;AAClD,SAASC,WAAW,EAAEC,SAAS,EAAEC,eAAe,QAAQ,qBAAoB;AAI5E,OAAO,MAAMC,6BAA2D,CAAC,EACvEC,SAAS,EAAEC,EAAE,EAAEC,SAAS,EAAE,GAAG,CAAC,CAAC,EAChC;IACC,MAAM,EACJC,QAAQ,EACNC,OAAO,EAAEC,UAAU,EAAE,EACtB,EACF,GAAGd;IACJ,MAAM,EAAEe,cAAc,EAAE,GAAGd;IAC3B,MAAMe,SAASV;IACf,MAAMW,WAAWZ;IACjB,MAAMa,eAAeX;IACrB,MAAM,EAAEY,oBAAoB,EAAE,GAAGjB;IAEjC,MAAM,EAAEkB,IAAI,EAAE,GAAGjB;IAEjB,QACGkB,OACCC,UAAU,kBACVC,SAAS;QACPR;QACA,MAAMS,UAAU,IAAIC,gBAAgBC,MAAMC,IAAI,CAACT,aAAaU,OAAO;QAEnE,IAAIlB,IAAI;YACNc,QAAQK,GAAG,CAAC,eAAeC,OAAOpB;QACpC;QAEA,MAAMqB,SAASP,QAAQQ,QAAQ;QAC/B,MAAMC,QAAQF,SAAS,CAAC,CAAC,EAAEA,QAAQ,GAAG;QAEtCZ,qBAAqB,IAAMH,OAAOkB,IAAI,CAAC,GAAGjB,WAAWgB,OAAO;IAC9D,GACAE,KAAK,SACN;MACC,CAAC/B,WAAW;QAAEgC,MAAMzB;QAAWS;QAAMiB,SAASvB;IAAW,GAAG;IAC9D,EAAEO;AAEN,EAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
3
2
|
import { Drawer, LoadingOverlay, toast, useDocumentInfo, useEditDepth, useModal, useServerFunctions, useTranslation } from '@payloadcms/ui';
|
|
4
3
|
import { useSearchParams } from 'next/navigation.js';
|
|
5
4
|
import './index.scss';
|
|
6
|
-
import
|
|
5
|
+
import { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react';
|
|
7
6
|
export const baseClass = 'version-drawer';
|
|
8
7
|
export const formatVersionDrawerSlug = ({ depth, uuid })=>// supply when creating a new document and no id is available
|
|
9
8
|
`version-drawer_${depth}_${uuid}`;
|
|
@@ -80,37 +79,16 @@ export const VersionDrawerContent = (props)=>{
|
|
|
80
79
|
searchParams
|
|
81
80
|
]);
|
|
82
81
|
if (isLoading) {
|
|
83
|
-
return
|
|
84
|
-
fileName: "src/views/Version/SelectComparison/VersionDrawer/index.tsx",
|
|
85
|
-
lineNumber: 111,
|
|
86
|
-
columnNumber: 12
|
|
87
|
-
}, this);
|
|
82
|
+
return <LoadingOverlay/>;
|
|
88
83
|
}
|
|
89
84
|
return DocumentView;
|
|
90
85
|
};
|
|
91
86
|
export const VersionDrawer = (props)=>{
|
|
92
87
|
const { collectionSlug, docID, drawerSlug, globalSlug } = props;
|
|
93
88
|
const { t } = useTranslation();
|
|
94
|
-
return
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
slug: drawerSlug,
|
|
98
|
-
title: t('version:selectVersionToCompare'),
|
|
99
|
-
children: /*#__PURE__*/ _jsxDEV(VersionDrawerContent, {
|
|
100
|
-
collectionSlug: collectionSlug,
|
|
101
|
-
docID: docID,
|
|
102
|
-
drawerSlug: drawerSlug,
|
|
103
|
-
globalSlug: globalSlug
|
|
104
|
-
}, void 0, false, {
|
|
105
|
-
fileName: "src/views/Version/SelectComparison/VersionDrawer/index.tsx",
|
|
106
|
-
lineNumber: 132,
|
|
107
|
-
columnNumber: 7
|
|
108
|
-
}, this)
|
|
109
|
-
}, void 0, false, {
|
|
110
|
-
fileName: "src/views/Version/SelectComparison/VersionDrawer/index.tsx",
|
|
111
|
-
lineNumber: 126,
|
|
112
|
-
columnNumber: 5
|
|
113
|
-
}, this);
|
|
89
|
+
return <Drawer className={baseClass} gutter={true} slug={drawerSlug} title={t('version:selectVersionToCompare')}>
|
|
90
|
+
<VersionDrawerContent collectionSlug={collectionSlug} docID={docID} drawerSlug={drawerSlug} globalSlug={globalSlug}/>
|
|
91
|
+
</Drawer>;
|
|
114
92
|
};
|
|
115
93
|
export const useVersionDrawer = ({ collectionSlug, docID, globalSlug })=>{
|
|
116
94
|
const drawerDepth = useEditDepth();
|
|
@@ -146,16 +124,7 @@ export const useVersionDrawer = ({ collectionSlug, docID, globalSlug })=>{
|
|
|
146
124
|
openModal
|
|
147
125
|
]);
|
|
148
126
|
const MemoizedDrawer = useMemo(()=>{
|
|
149
|
-
return ()
|
|
150
|
-
collectionSlug: collectionSlug,
|
|
151
|
-
docID: docID,
|
|
152
|
-
drawerSlug: drawerSlug,
|
|
153
|
-
globalSlug: globalSlug
|
|
154
|
-
}, void 0, false, {
|
|
155
|
-
fileName: "src/views/Version/SelectComparison/VersionDrawer/index.tsx",
|
|
156
|
-
lineNumber: 179,
|
|
157
|
-
columnNumber: 7
|
|
158
|
-
}, this);
|
|
127
|
+
return ()=><VersionDrawer collectionSlug={collectionSlug} docID={docID} drawerSlug={drawerSlug} globalSlug={globalSlug}/>;
|
|
159
128
|
}, [
|
|
160
129
|
collectionSlug,
|
|
161
130
|
docID,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/views/Version/SelectComparison/VersionDrawer/index.tsx"],"sourcesContent":["'use client'\nimport {\n Drawer,\n LoadingOverlay,\n toast,\n useDocumentInfo,\n useEditDepth,\n useModal,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { useSearchParams } from 'next/navigation.js'\n\nimport './index.scss'\n\nimport React, { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'\n\nexport const baseClass = 'version-drawer'\nexport const formatVersionDrawerSlug = ({\n depth,\n uuid,\n}: {\n depth: number\n uuid: string // supply when creating a new document and no id is available\n}) => `version-drawer_${depth}_${uuid}`\n\nexport const VersionDrawerContent: React.FC<{\n collectionSlug?: string\n docID?: number | string\n drawerSlug: string\n globalSlug?: string\n}> = (props) => {\n const { collectionSlug, docID, drawerSlug, globalSlug } = props\n const { isTrashed } = useDocumentInfo()\n const { closeModal } = useModal()\n const searchParams = useSearchParams()\n const prevSearchParams = useRef(searchParams)\n\n const { renderDocument } = useServerFunctions()\n\n const [DocumentView, setDocumentView] = useState<React.ReactNode>(undefined)\n const [isLoading, setIsLoading] = useState(true)\n const hasRenderedDocument = useRef(false)\n const { t } = useTranslation()\n\n const getDocumentView = useCallback(\n (docID?: number | string) => {\n const fetchDocumentView = async () => {\n setIsLoading(true)\n\n try {\n const isGlobal = Boolean(globalSlug)\n const entitySlug = collectionSlug ?? globalSlug\n\n const result = await renderDocument({\n collectionSlug: entitySlug,\n docID,\n drawerSlug,\n paramsOverride: {\n segments: [\n isGlobal ? 'globals' : 'collections',\n entitySlug,\n ...(isTrashed ? ['trash'] : []),\n isGlobal ? undefined : String(docID),\n 'versions',\n ].filter(Boolean),\n },\n redirectAfterDelete: false,\n redirectAfterDuplicate: false,\n searchParams: Object.fromEntries(searchParams.entries()),\n versions: {\n disableGutter: true,\n useVersionDrawerCreatedAtCell: true,\n },\n })\n\n if (result?.Document) {\n setDocumentView(result.Document)\n setIsLoading(false)\n }\n } catch (error) {\n toast.error(error?.message || t('error:unspecific'))\n closeModal(drawerSlug)\n // toast.error(data?.errors?.[0].message || t('error:unspecific'))\n }\n }\n\n void fetchDocumentView()\n },\n [\n closeModal,\n collectionSlug,\n drawerSlug,\n globalSlug,\n isTrashed,\n renderDocument,\n searchParams,\n t,\n ],\n )\n\n useEffect(() => {\n if (!hasRenderedDocument.current || prevSearchParams.current !== searchParams) {\n prevSearchParams.current = searchParams\n getDocumentView(docID)\n hasRenderedDocument.current = true\n }\n }, [docID, getDocumentView, searchParams])\n\n if (isLoading) {\n return <LoadingOverlay />\n }\n\n return DocumentView\n}\nexport const VersionDrawer: React.FC<{\n collectionSlug?: string\n docID?: number | string\n drawerSlug: string\n globalSlug?: string\n}> = (props) => {\n const { collectionSlug, docID, drawerSlug, globalSlug } = props\n const { t } = useTranslation()\n\n return (\n <Drawer\n className={baseClass}\n gutter={true}\n slug={drawerSlug}\n title={t('version:selectVersionToCompare')}\n >\n <VersionDrawerContent\n collectionSlug={collectionSlug}\n docID={docID}\n drawerSlug={drawerSlug}\n globalSlug={globalSlug}\n />\n </Drawer>\n )\n}\n\nexport const useVersionDrawer = ({\n collectionSlug,\n docID,\n globalSlug,\n}: {\n collectionSlug?: string\n docID?: number | string\n globalSlug?: string\n}) => {\n const drawerDepth = useEditDepth()\n const uuid = useId()\n const { closeModal, modalState, openModal, toggleModal } = useModal()\n const [isOpen, setIsOpen] = useState(false)\n\n const drawerSlug = formatVersionDrawerSlug({\n depth: drawerDepth,\n uuid,\n })\n\n useEffect(() => {\n setIsOpen(Boolean(modalState[drawerSlug]?.isOpen))\n }, [modalState, drawerSlug])\n\n const toggleDrawer = useCallback(() => {\n toggleModal(drawerSlug)\n }, [toggleModal, drawerSlug])\n\n const closeDrawer = useCallback(() => {\n closeModal(drawerSlug)\n }, [drawerSlug, closeModal])\n\n const openDrawer = useCallback(() => {\n openModal(drawerSlug)\n }, [drawerSlug, openModal])\n\n const MemoizedDrawer = useMemo(() => {\n return () => (\n <VersionDrawer\n collectionSlug={collectionSlug}\n docID={docID}\n drawerSlug={drawerSlug}\n globalSlug={globalSlug}\n />\n )\n }, [collectionSlug, docID, drawerSlug, globalSlug])\n\n return useMemo(\n () => ({\n closeDrawer,\n Drawer: MemoizedDrawer,\n drawerDepth,\n drawerSlug,\n isDrawerOpen: isOpen,\n openDrawer,\n toggleDrawer,\n }),\n [MemoizedDrawer, closeDrawer, drawerDepth, drawerSlug, isOpen, openDrawer, toggleDrawer],\n )\n}\n"],"names":["Drawer","LoadingOverlay","toast","useDocumentInfo","useEditDepth","useModal","useServerFunctions","useTranslation","useSearchParams","
|
|
1
|
+
{"version":3,"sources":["../../../../../src/views/Version/SelectComparison/VersionDrawer/index.tsx"],"sourcesContent":["'use client'\nimport {\n Drawer,\n LoadingOverlay,\n toast,\n useDocumentInfo,\n useEditDepth,\n useModal,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { useSearchParams } from 'next/navigation.js'\n\nimport './index.scss'\n\nimport React, { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'\n\nexport const baseClass = 'version-drawer'\nexport const formatVersionDrawerSlug = ({\n depth,\n uuid,\n}: {\n depth: number\n uuid: string // supply when creating a new document and no id is available\n}) => `version-drawer_${depth}_${uuid}`\n\nexport const VersionDrawerContent: React.FC<{\n collectionSlug?: string\n docID?: number | string\n drawerSlug: string\n globalSlug?: string\n}> = (props) => {\n const { collectionSlug, docID, drawerSlug, globalSlug } = props\n const { isTrashed } = useDocumentInfo()\n const { closeModal } = useModal()\n const searchParams = useSearchParams()\n const prevSearchParams = useRef(searchParams)\n\n const { renderDocument } = useServerFunctions()\n\n const [DocumentView, setDocumentView] = useState<React.ReactNode>(undefined)\n const [isLoading, setIsLoading] = useState(true)\n const hasRenderedDocument = useRef(false)\n const { t } = useTranslation()\n\n const getDocumentView = useCallback(\n (docID?: number | string) => {\n const fetchDocumentView = async () => {\n setIsLoading(true)\n\n try {\n const isGlobal = Boolean(globalSlug)\n const entitySlug = collectionSlug ?? globalSlug\n\n const result = await renderDocument({\n collectionSlug: entitySlug,\n docID,\n drawerSlug,\n paramsOverride: {\n segments: [\n isGlobal ? 'globals' : 'collections',\n entitySlug,\n ...(isTrashed ? ['trash'] : []),\n isGlobal ? undefined : String(docID),\n 'versions',\n ].filter(Boolean),\n },\n redirectAfterDelete: false,\n redirectAfterDuplicate: false,\n searchParams: Object.fromEntries(searchParams.entries()),\n versions: {\n disableGutter: true,\n useVersionDrawerCreatedAtCell: true,\n },\n })\n\n if (result?.Document) {\n setDocumentView(result.Document)\n setIsLoading(false)\n }\n } catch (error) {\n toast.error(error?.message || t('error:unspecific'))\n closeModal(drawerSlug)\n // toast.error(data?.errors?.[0].message || t('error:unspecific'))\n }\n }\n\n void fetchDocumentView()\n },\n [\n closeModal,\n collectionSlug,\n drawerSlug,\n globalSlug,\n isTrashed,\n renderDocument,\n searchParams,\n t,\n ],\n )\n\n useEffect(() => {\n if (!hasRenderedDocument.current || prevSearchParams.current !== searchParams) {\n prevSearchParams.current = searchParams\n getDocumentView(docID)\n hasRenderedDocument.current = true\n }\n }, [docID, getDocumentView, searchParams])\n\n if (isLoading) {\n return <LoadingOverlay />\n }\n\n return DocumentView\n}\nexport const VersionDrawer: React.FC<{\n collectionSlug?: string\n docID?: number | string\n drawerSlug: string\n globalSlug?: string\n}> = (props) => {\n const { collectionSlug, docID, drawerSlug, globalSlug } = props\n const { t } = useTranslation()\n\n return (\n <Drawer\n className={baseClass}\n gutter={true}\n slug={drawerSlug}\n title={t('version:selectVersionToCompare')}\n >\n <VersionDrawerContent\n collectionSlug={collectionSlug}\n docID={docID}\n drawerSlug={drawerSlug}\n globalSlug={globalSlug}\n />\n </Drawer>\n )\n}\n\nexport const useVersionDrawer = ({\n collectionSlug,\n docID,\n globalSlug,\n}: {\n collectionSlug?: string\n docID?: number | string\n globalSlug?: string\n}) => {\n const drawerDepth = useEditDepth()\n const uuid = useId()\n const { closeModal, modalState, openModal, toggleModal } = useModal()\n const [isOpen, setIsOpen] = useState(false)\n\n const drawerSlug = formatVersionDrawerSlug({\n depth: drawerDepth,\n uuid,\n })\n\n useEffect(() => {\n setIsOpen(Boolean(modalState[drawerSlug]?.isOpen))\n }, [modalState, drawerSlug])\n\n const toggleDrawer = useCallback(() => {\n toggleModal(drawerSlug)\n }, [toggleModal, drawerSlug])\n\n const closeDrawer = useCallback(() => {\n closeModal(drawerSlug)\n }, [drawerSlug, closeModal])\n\n const openDrawer = useCallback(() => {\n openModal(drawerSlug)\n }, [drawerSlug, openModal])\n\n const MemoizedDrawer = useMemo(() => {\n return () => (\n <VersionDrawer\n collectionSlug={collectionSlug}\n docID={docID}\n drawerSlug={drawerSlug}\n globalSlug={globalSlug}\n />\n )\n }, [collectionSlug, docID, drawerSlug, globalSlug])\n\n return useMemo(\n () => ({\n closeDrawer,\n Drawer: MemoizedDrawer,\n drawerDepth,\n drawerSlug,\n isDrawerOpen: isOpen,\n openDrawer,\n toggleDrawer,\n }),\n [MemoizedDrawer, closeDrawer, drawerDepth, drawerSlug, isOpen, openDrawer, toggleDrawer],\n )\n}\n"],"names":["Drawer","LoadingOverlay","toast","useDocumentInfo","useEditDepth","useModal","useServerFunctions","useTranslation","useSearchParams","useCallback","useEffect","useId","useMemo","useRef","useState","baseClass","formatVersionDrawerSlug","depth","uuid","VersionDrawerContent","props","collectionSlug","docID","drawerSlug","globalSlug","isTrashed","closeModal","searchParams","prevSearchParams","renderDocument","DocumentView","setDocumentView","undefined","isLoading","setIsLoading","hasRenderedDocument","t","getDocumentView","fetchDocumentView","isGlobal","Boolean","entitySlug","result","paramsOverride","segments","String","filter","redirectAfterDelete","redirectAfterDuplicate","Object","fromEntries","entries","versions","disableGutter","useVersionDrawerCreatedAtCell","Document","error","message","current","VersionDrawer","className","gutter","slug","title","useVersionDrawer","drawerDepth","modalState","openModal","toggleModal","isOpen","setIsOpen","toggleDrawer","closeDrawer","openDrawer","MemoizedDrawer","isDrawerOpen"],"mappings":"AAAA;AACA,SACEA,MAAM,EACNC,cAAc,EACdC,KAAK,EACLC,eAAe,EACfC,YAAY,EACZC,QAAQ,E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,MAAM,CAACgE,QAAQC,UAAU,GAAGxD,SAAS;IAErC,MAAMS,aAAaP,wBAAwB;QACzCC,OAAOgD;QACP/C;IACF;IAEAR,UAAU;QACR4D,UAAU9B,QAAQ0B,UAAU,CAAC3C,WAAW,EAAE8C;IAC5C,GAAG;QAACH;QAAY3C;KAAW;IAE3B,MAAMgD,eAAe9D,YAAY;QAC/B2D,YAAY7C;IACd,GAAG;QAAC6C;QAAa7C;KAAW;IAE5B,MAAMiD,cAAc/D,YAAY;QAC9BiB,WAAWH;IACb,GAAG;QAACA;QAAYG;KAAW;IAE3B,MAAM+C,aAAahE,YAAY;QAC7B0D,UAAU5C;IACZ,GAAG;QAACA;QAAY4C;KAAU;IAE1B,MAAMO,iBAAiB9D,QAAQ;QAC7B,OAAO,KACJ+C,cACCtC,gBAAgBA,gBAChBC,OAAOA,OACPC,YAAYA,YACZC,YAAYA;IAGlB,GAAG;QAACH;QAAgBC;QAAOC;QAAYC;KAAW;IAElD,OAAOZ,QACL,IAAO,CAAA;YACL4D;YACAxE,QAAQ0E;YACRT;YACA1C;YACAoD,cAAcN;YACdI;YACAF;QACF,CAAA,GACA;QAACG;QAAgBF;QAAaP;QAAa1C;QAAY8C;QAAQI;QAAYF;KAAa;AAE5F,EAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
3
2
|
import { fieldBaseClass, ReactSelect, useTranslation } from '@payloadcms/ui';
|
|
4
|
-
import
|
|
3
|
+
import { memo, useCallback, useMemo } from 'react';
|
|
5
4
|
import './index.scss';
|
|
6
5
|
import { useVersionDrawer } from './VersionDrawer/index.js';
|
|
7
6
|
const baseClass = 'compare-version';
|
|
8
|
-
export const SelectComparison =
|
|
7
|
+
export const SelectComparison = memo((props)=>{
|
|
9
8
|
const { collectionSlug, docID, globalSlug, onChange: onChangeFromProps, versionFromID, versionFromOptions } = props;
|
|
10
9
|
const { t } = useTranslation();
|
|
11
10
|
const { Drawer, openDrawer } = useVersionDrawer({
|
|
@@ -17,14 +16,7 @@ export const SelectComparison = /*#__PURE__*/ memo((props)=>{
|
|
|
17
16
|
return [
|
|
18
17
|
...versionFromOptions,
|
|
19
18
|
{
|
|
20
|
-
label:
|
|
21
|
-
className: `${baseClass}-moreVersions`,
|
|
22
|
-
children: t('version:moreVersions')
|
|
23
|
-
}, void 0, false, {
|
|
24
|
-
fileName: "src/views/Version/SelectComparison/index.tsx",
|
|
25
|
-
lineNumber: 33,
|
|
26
|
-
columnNumber: 16
|
|
27
|
-
}, this),
|
|
19
|
+
label: <span className={`${baseClass}-moreVersions`}>{t('version:moreVersions')}</span>,
|
|
28
20
|
value: 'more'
|
|
29
21
|
}
|
|
30
22
|
];
|
|
@@ -46,35 +38,13 @@ export const SelectComparison = /*#__PURE__*/ memo((props)=>{
|
|
|
46
38
|
onChangeFromProps,
|
|
47
39
|
openDrawer
|
|
48
40
|
]);
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
isClearable: false,
|
|
57
|
-
isSearchable: false,
|
|
58
|
-
onChange: onChange,
|
|
59
|
-
options: options,
|
|
60
|
-
placeholder: t('version:selectVersionToCompare'),
|
|
61
|
-
value: currentOption
|
|
62
|
-
}, void 0, false, {
|
|
63
|
-
fileName: "src/views/Version/SelectComparison/index.tsx",
|
|
64
|
-
lineNumber: 57,
|
|
65
|
-
columnNumber: 7
|
|
66
|
-
}, this),
|
|
67
|
-
/*#__PURE__*/ _jsxDEV(Drawer, {}, void 0, false, {
|
|
68
|
-
fileName: "src/views/Version/SelectComparison/index.tsx",
|
|
69
|
-
lineNumber: 65,
|
|
70
|
-
columnNumber: 7
|
|
71
|
-
}, this)
|
|
72
|
-
]
|
|
73
|
-
}, void 0, true, {
|
|
74
|
-
fileName: "src/views/Version/SelectComparison/index.tsx",
|
|
75
|
-
lineNumber: 56,
|
|
76
|
-
columnNumber: 5
|
|
77
|
-
}, this);
|
|
41
|
+
return <div className={[
|
|
42
|
+
fieldBaseClass,
|
|
43
|
+
baseClass
|
|
44
|
+
].filter(Boolean).join(' ')}>
|
|
45
|
+
<ReactSelect isClearable={false} isSearchable={false} onChange={onChange} options={options} placeholder={t('version:selectVersionToCompare')} value={currentOption}/>
|
|
46
|
+
<Drawer/>
|
|
47
|
+
</div>;
|
|
78
48
|
});
|
|
79
49
|
|
|
80
50
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/views/Version/SelectComparison/index.tsx"],"sourcesContent":["'use client'\n\nimport { fieldBaseClass, ReactSelect, useTranslation } from '@payloadcms/ui'\nimport React, { memo, useCallback, useMemo } from 'react'\n\nimport type { CompareOption } from '../Default/types.js'\n\nimport './index.scss'\n\nimport type { Props } from './types.js'\n\nimport { useVersionDrawer } from './VersionDrawer/index.js'\n\nconst baseClass = 'compare-version'\n\nexport const SelectComparison: React.FC<Props> = memo((props) => {\n const {\n collectionSlug,\n docID,\n globalSlug,\n onChange: onChangeFromProps,\n versionFromID,\n versionFromOptions,\n } = props\n const { t } = useTranslation()\n\n const { Drawer, openDrawer } = useVersionDrawer({ collectionSlug, docID, globalSlug })\n\n const options = useMemo(() => {\n return [\n ...versionFromOptions,\n {\n label: <span className={`${baseClass}-moreVersions`}>{t('version:moreVersions')}</span>,\n value: 'more',\n },\n ]\n }, [t, versionFromOptions])\n\n const currentOption = useMemo(\n () => versionFromOptions.find((option) => option.value === versionFromID),\n [versionFromOptions, versionFromID],\n )\n\n const onChange = useCallback(\n (val: CompareOption) => {\n if (val.value === 'more') {\n openDrawer()\n return\n }\n onChangeFromProps(val)\n },\n [onChangeFromProps, openDrawer],\n )\n\n return (\n <div className={[fieldBaseClass, baseClass].filter(Boolean).join(' ')}>\n <ReactSelect\n isClearable={false}\n isSearchable={false}\n onChange={onChange}\n options={options}\n placeholder={t('version:selectVersionToCompare')}\n value={currentOption}\n />\n <Drawer />\n </div>\n )\n})\n"],"names":["fieldBaseClass","ReactSelect","useTranslation","
|
|
1
|
+
{"version":3,"sources":["../../../../src/views/Version/SelectComparison/index.tsx"],"sourcesContent":["'use client'\n\nimport { fieldBaseClass, ReactSelect, useTranslation } from '@payloadcms/ui'\nimport React, { memo, useCallback, useMemo } from 'react'\n\nimport type { CompareOption } from '../Default/types.js'\n\nimport './index.scss'\n\nimport type { Props } from './types.js'\n\nimport { useVersionDrawer } from './VersionDrawer/index.js'\n\nconst baseClass = 'compare-version'\n\nexport const SelectComparison: React.FC<Props> = memo((props) => {\n const {\n collectionSlug,\n docID,\n globalSlug,\n onChange: onChangeFromProps,\n versionFromID,\n versionFromOptions,\n } = props\n const { t } = useTranslation()\n\n const { Drawer, openDrawer } = useVersionDrawer({ collectionSlug, docID, globalSlug })\n\n const options = useMemo(() => {\n return [\n ...versionFromOptions,\n {\n label: <span className={`${baseClass}-moreVersions`}>{t('version:moreVersions')}</span>,\n value: 'more',\n },\n ]\n }, [t, versionFromOptions])\n\n const currentOption = useMemo(\n () => versionFromOptions.find((option) => option.value === versionFromID),\n [versionFromOptions, versionFromID],\n )\n\n const onChange = useCallback(\n (val: CompareOption) => {\n if (val.value === 'more') {\n openDrawer()\n return\n }\n onChangeFromProps(val)\n },\n [onChangeFromProps, openDrawer],\n )\n\n return (\n <div className={[fieldBaseClass, baseClass].filter(Boolean).join(' ')}>\n <ReactSelect\n isClearable={false}\n isSearchable={false}\n onChange={onChange}\n options={options}\n placeholder={t('version:selectVersionToCompare')}\n value={currentOption}\n />\n <Drawer />\n </div>\n )\n})\n"],"names":["fieldBaseClass","ReactSelect","useTranslation","memo","useCallback","useMemo","useVersionDrawer","baseClass","SelectComparison","props","collectionSlug","docID","globalSlug","onChange","onChangeFromProps","versionFromID","versionFromOptions","t","Drawer","openDrawer","options","label","span","className","value","currentOption","find","option","val","div","filter","Boolean","join","isClearable","isSearchable","placeholder"],"mappings":"AAAA;AA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as _jsxDEV } from "react/jsx-dev-runtime";
|
|
3
2
|
import { AnimateHeight } from '@payloadcms/ui';
|
|
4
3
|
import { PillSelector } from '@payloadcms/ui';
|
|
5
|
-
import React from 'react';
|
|
6
4
|
const baseClass = 'select-version-locales';
|
|
7
5
|
export const SelectLocales = ({ locales, localeSelectorOpen, onChange })=>{
|
|
8
|
-
return
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
locales: newLocales
|
|
26
|
-
});
|
|
27
|
-
},
|
|
28
|
-
pills: locales
|
|
29
|
-
}, void 0, false, {
|
|
30
|
-
fileName: "src/views/Version/SelectLocales/index.tsx",
|
|
31
|
-
lineNumber: 23,
|
|
32
|
-
columnNumber: 7
|
|
33
|
-
}, this)
|
|
34
|
-
}, void 0, false, {
|
|
35
|
-
fileName: "src/views/Version/SelectLocales/index.tsx",
|
|
36
|
-
lineNumber: 18,
|
|
37
|
-
columnNumber: 5
|
|
38
|
-
}, this);
|
|
6
|
+
return <AnimateHeight className={baseClass} height={localeSelectorOpen ? 'auto' : 0} id={`${baseClass}-locales`}>
|
|
7
|
+
<PillSelector onClick={({ pill })=>{
|
|
8
|
+
const newLocales = locales.map((locale)=>{
|
|
9
|
+
if (locale.name === pill.name) {
|
|
10
|
+
return {
|
|
11
|
+
...locale,
|
|
12
|
+
selected: !pill.selected
|
|
13
|
+
};
|
|
14
|
+
} else {
|
|
15
|
+
return locale;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
onChange({
|
|
19
|
+
locales: newLocales
|
|
20
|
+
});
|
|
21
|
+
}} pills={locales}/>
|
|
22
|
+
</AnimateHeight>;
|
|
39
23
|
};
|
|
40
24
|
|
|
41
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/views/Version/SelectLocales/index.tsx"],"sourcesContent":["'use client'\n\nimport { AnimateHeight } from '@payloadcms/ui'\nimport { PillSelector, type SelectablePill } from '@payloadcms/ui'\nimport React from 'react'\n\nconst baseClass = 'select-version-locales'\n\nexport type SelectedLocaleOnChange = (args: { locales: SelectablePill[] }) => void\nexport type Props = {\n locales: SelectablePill[]\n localeSelectorOpen: boolean\n onChange: SelectedLocaleOnChange\n}\n\nexport const SelectLocales: React.FC<Props> = ({ locales, localeSelectorOpen, onChange }) => {\n return (\n <AnimateHeight\n className={baseClass}\n height={localeSelectorOpen ? 'auto' : 0}\n id={`${baseClass}-locales`}\n >\n <PillSelector\n onClick={({ pill }) => {\n const newLocales = locales.map((locale) => {\n if (locale.name === pill.name) {\n return {\n ...locale,\n selected: !pill.selected,\n }\n } else {\n return locale\n }\n })\n onChange({ locales: newLocales })\n }}\n pills={locales}\n />\n </AnimateHeight>\n )\n}\n"],"names":["AnimateHeight","PillSelector","
|
|
1
|
+
{"version":3,"sources":["../../../../src/views/Version/SelectLocales/index.tsx"],"sourcesContent":["'use client'\n\nimport { AnimateHeight } from '@payloadcms/ui'\nimport { PillSelector, type SelectablePill } from '@payloadcms/ui'\nimport React from 'react'\n\nconst baseClass = 'select-version-locales'\n\nexport type SelectedLocaleOnChange = (args: { locales: SelectablePill[] }) => void\nexport type Props = {\n locales: SelectablePill[]\n localeSelectorOpen: boolean\n onChange: SelectedLocaleOnChange\n}\n\nexport const SelectLocales: React.FC<Props> = ({ locales, localeSelectorOpen, onChange }) => {\n return (\n <AnimateHeight\n className={baseClass}\n height={localeSelectorOpen ? 'auto' : 0}\n id={`${baseClass}-locales`}\n >\n <PillSelector\n onClick={({ pill }) => {\n const newLocales = locales.map((locale) => {\n if (locale.name === pill.name) {\n return {\n ...locale,\n selected: !pill.selected,\n }\n } else {\n return locale\n }\n })\n onChange({ locales: newLocales })\n }}\n pills={locales}\n />\n </AnimateHeight>\n )\n}\n"],"names":["AnimateHeight","PillSelector","baseClass","SelectLocales","locales","localeSelectorOpen","onChange","className","height","id","onClick","pill","newLocales","map","locale","name","selected","pills"],"mappings":"AAAA;AAEA,SAASA,aAAa,QAAQ,iBAAgB;AAC9C,SAASC,YAAY,QAA6B,iBAAgB;AAGlE,MAAMC,YAAY;AASlB,OAAO,MAAMC,gBAAiC,CAAC,EAAEC,OAAO,EAAEC,kBAAkB,EAAEC,QAAQ,EAAE;IACtF,QACGN,cACCO,WAAWL,WACXM,QAAQH,qBAAqB,SAAS,GACtCI,IAAI,GAAGP,UAAU,QAAQ,CAAC,EAC3B;MACC,CAACD,aACCS,SAAS,CAAC,EAAEC,IAAI,EAAE;QAChB,MAAMC,aAAaR,QAAQS,GAAG,CAAC,CAACC;YAC9B,IAAIA,OAAOC,IAAI,KAAKJ,KAAKI,IAAI,EAAE;gBAC7B,OAAO;oBACL,GAAGD,MAAM;oBACTE,UAAU,CAACL,KAAKK,QAAQ;gBAC1B;YACF,OAAO;gBACL,OAAOF;YACT;QACF;QACAR,SAAS;YAAEF,SAASQ;QAAW;IACjC,GACAK,OAAOb,UACP;IACJ,EAAEJ;AAEN,EAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
3
2
|
import { Pill, useConfig, useTranslation } from '@payloadcms/ui';
|
|
4
3
|
import { formatDate } from '@payloadcms/ui/shared';
|
|
5
4
|
import React from 'react';
|
|
@@ -7,15 +6,9 @@ import './index.scss';
|
|
|
7
6
|
import { getVersionLabel } from './getVersionLabel.js';
|
|
8
7
|
const baseClass = 'version-pill-label';
|
|
9
8
|
const renderPill = (label, pillStyle)=>{
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
children: label
|
|
14
|
-
}, void 0, false, {
|
|
15
|
-
fileName: "src/views/Version/VersionPillLabel/VersionPillLabel.tsx",
|
|
16
|
-
lineNumber: 14,
|
|
17
|
-
columnNumber: 5
|
|
18
|
-
}, this);
|
|
9
|
+
return <Pill pillStyle={pillStyle} size="small">
|
|
10
|
+
{label}
|
|
11
|
+
</Pill>;
|
|
19
12
|
};
|
|
20
13
|
export const VersionPillLabel = /**
|
|
21
14
|
* By default, the date is displayed first, followed by the version label.
|
|
@@ -31,16 +24,10 @@ export const VersionPillLabel = /**
|
|
|
31
24
|
t,
|
|
32
25
|
version: doc
|
|
33
26
|
});
|
|
34
|
-
const labelText =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
]
|
|
39
|
-
}, void 0, true, {
|
|
40
|
-
fileName: "src/views/Version/VersionPillLabel/VersionPillLabel.tsx",
|
|
41
|
-
lineNumber: 77,
|
|
42
|
-
columnNumber: 5
|
|
43
|
-
}, this);
|
|
27
|
+
const labelText = <span>
|
|
28
|
+
{labelOverride || label}
|
|
29
|
+
{labelSuffix}
|
|
30
|
+
</span>;
|
|
44
31
|
const showDate = !disableDate && doc.updatedAt;
|
|
45
32
|
const formattedDate = showDate ? formatDate({
|
|
46
33
|
date: doc.updatedAt,
|
|
@@ -50,70 +37,16 @@ export const VersionPillLabel = /**
|
|
|
50
37
|
const localeCode = Array.isArray(doc.publishedLocale) ? doc.publishedLocale[0] : doc.publishedLocale;
|
|
51
38
|
const locale = localization && localization?.locales ? localization.locales.find((loc)=>loc.code === localeCode) : null;
|
|
52
39
|
const localeLabel = locale ? locale?.label?.[i18n?.language] || locale?.label : null;
|
|
53
|
-
return
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
lineNumber: 105,
|
|
64
|
-
columnNumber: 13
|
|
65
|
-
}, this),
|
|
66
|
-
showDate && /*#__PURE__*/ _jsxDEV("span", {
|
|
67
|
-
className: `${baseClass}-date`,
|
|
68
|
-
children: formattedDate
|
|
69
|
-
}, void 0, false, {
|
|
70
|
-
fileName: "src/views/Version/VersionPillLabel/VersionPillLabel.tsx",
|
|
71
|
-
lineNumber: 107,
|
|
72
|
-
columnNumber: 24
|
|
73
|
-
}, this)
|
|
74
|
-
]
|
|
75
|
-
}, void 0, true, {
|
|
76
|
-
fileName: "src/views/Version/VersionPillLabel/VersionPillLabel.tsx",
|
|
77
|
-
lineNumber: 101,
|
|
78
|
-
columnNumber: 9
|
|
79
|
-
}, this) : /*#__PURE__*/ _jsxDEV(React.Fragment, {
|
|
80
|
-
children: [
|
|
81
|
-
showDate && /*#__PURE__*/ _jsxDEV("span", {
|
|
82
|
-
className: `${baseClass}-date`,
|
|
83
|
-
children: formattedDate
|
|
84
|
-
}, void 0, false, {
|
|
85
|
-
fileName: "src/views/Version/VersionPillLabel/VersionPillLabel.tsx",
|
|
86
|
-
lineNumber: 111,
|
|
87
|
-
columnNumber: 24
|
|
88
|
-
}, this),
|
|
89
|
-
labelStyle === 'pill' ? renderPill(labelText, pillStyle) : /*#__PURE__*/ _jsxDEV("span", {
|
|
90
|
-
className: `${baseClass}-text`,
|
|
91
|
-
children: labelText
|
|
92
|
-
}, void 0, false, {
|
|
93
|
-
fileName: "src/views/Version/VersionPillLabel/VersionPillLabel.tsx",
|
|
94
|
-
lineNumber: 115,
|
|
95
|
-
columnNumber: 13
|
|
96
|
-
}, this)
|
|
97
|
-
]
|
|
98
|
-
}, void 0, true, {
|
|
99
|
-
fileName: "src/views/Version/VersionPillLabel/VersionPillLabel.tsx",
|
|
100
|
-
lineNumber: 110,
|
|
101
|
-
columnNumber: 9
|
|
102
|
-
}, this),
|
|
103
|
-
localeLabel && /*#__PURE__*/ _jsxDEV(Pill, {
|
|
104
|
-
size: "small",
|
|
105
|
-
children: localeLabel
|
|
106
|
-
}, void 0, false, {
|
|
107
|
-
fileName: "src/views/Version/VersionPillLabel/VersionPillLabel.tsx",
|
|
108
|
-
lineNumber: 119,
|
|
109
|
-
columnNumber: 23
|
|
110
|
-
}, this)
|
|
111
|
-
]
|
|
112
|
-
}, void 0, true, {
|
|
113
|
-
fileName: "src/views/Version/VersionPillLabel/VersionPillLabel.tsx",
|
|
114
|
-
lineNumber: 99,
|
|
115
|
-
columnNumber: 5
|
|
116
|
-
}, this);
|
|
40
|
+
return <div className={baseClass}>
|
|
41
|
+
{labelFirst ? <React.Fragment>
|
|
42
|
+
{labelStyle === 'pill' ? renderPill(labelText, pillStyle) : <span className={`${baseClass}-text`}>{labelText}</span>}
|
|
43
|
+
{showDate && <span className={`${baseClass}-date`}>{formattedDate}</span>}
|
|
44
|
+
</React.Fragment> : <React.Fragment>
|
|
45
|
+
{showDate && <span className={`${baseClass}-date`}>{formattedDate}</span>}
|
|
46
|
+
{labelStyle === 'pill' ? renderPill(labelText, pillStyle) : <span className={`${baseClass}-text`}>{labelText}</span>}
|
|
47
|
+
</React.Fragment>}
|
|
48
|
+
{localeLabel && <Pill size="small">{localeLabel}</Pill>}
|
|
49
|
+
</div>;
|
|
117
50
|
};
|
|
118
51
|
|
|
119
52
|
//# sourceMappingURL=VersionPillLabel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/views/Version/VersionPillLabel/VersionPillLabel.tsx"],"sourcesContent":["'use client'\n\nimport { Pill, useConfig, useTranslation } from '@payloadcms/ui'\nimport { formatDate } from '@payloadcms/ui/shared'\nimport React from 'react'\n\nimport './index.scss'\nimport { getVersionLabel } from './getVersionLabel.js'\n\nconst baseClass = 'version-pill-label'\n\nconst renderPill = (label: React.ReactNode, pillStyle: Parameters<typeof Pill>[0]['pillStyle']) => {\n return (\n <Pill pillStyle={pillStyle} size=\"small\">\n {label}\n </Pill>\n )\n}\n\nexport const VersionPillLabel: React.FC<{\n currentlyPublishedVersion?: {\n id: number | string\n updatedAt: string\n }\n disableDate?: boolean\n\n doc: {\n [key: string]: unknown\n id: number | string\n publishedLocale?: string\n updatedAt?: string\n version: {\n [key: string]: unknown\n _status: string\n }\n }\n /**\n * By default, the date is displayed first, followed by the version label.\n * @default false\n */\n labelFirst?: boolean\n labelOverride?: React.ReactNode\n /**\n * @default 'pill'\n */\n labelStyle?: 'pill' | 'text'\n labelSuffix?: React.ReactNode\n latestDraftVersion?: {\n id: number | string\n updatedAt: string\n }\n}> = ({\n currentlyPublishedVersion,\n disableDate = false,\n doc,\n labelFirst = false,\n labelOverride,\n labelStyle = 'pill',\n labelSuffix,\n latestDraftVersion,\n}) => {\n const {\n config: {\n admin: { dateFormat },\n localization,\n },\n } = useConfig()\n const { i18n, t } = useTranslation()\n\n const { label, pillStyle } = getVersionLabel({\n currentlyPublishedVersion,\n latestDraftVersion,\n t,\n version: doc,\n })\n const labelText: React.ReactNode = (\n <span>\n {labelOverride || label}\n {labelSuffix}\n </span>\n )\n\n const showDate = !disableDate && doc.updatedAt\n const formattedDate = showDate\n ? formatDate({ date: doc.updatedAt, i18n, pattern: dateFormat })\n : null\n\n const localeCode = Array.isArray(doc.publishedLocale)\n ? doc.publishedLocale[0]\n : doc.publishedLocale\n\n const locale =\n localization && localization?.locales\n ? localization.locales.find((loc) => loc.code === localeCode)\n : null\n const localeLabel = locale ? locale?.label?.[i18n?.language] || locale?.label : null\n\n return (\n <div className={baseClass}>\n {labelFirst ? (\n <React.Fragment>\n {labelStyle === 'pill' ? (\n renderPill(labelText, pillStyle)\n ) : (\n <span className={`${baseClass}-text`}>{labelText}</span>\n )}\n {showDate && <span className={`${baseClass}-date`}>{formattedDate}</span>}\n </React.Fragment>\n ) : (\n <React.Fragment>\n {showDate && <span className={`${baseClass}-date`}>{formattedDate}</span>}\n {labelStyle === 'pill' ? (\n renderPill(labelText, pillStyle)\n ) : (\n <span className={`${baseClass}-text`}>{labelText}</span>\n )}\n </React.Fragment>\n )}\n {localeLabel && <Pill size=\"small\">{localeLabel}</Pill>}\n </div>\n )\n}\n"],"names":["Pill","useConfig","useTranslation","formatDate","React","getVersionLabel","baseClass","renderPill","label","pillStyle","size","VersionPillLabel","currentlyPublishedVersion","disableDate","doc","labelFirst","labelOverride","labelStyle","labelSuffix","latestDraftVersion","config","admin","dateFormat","localization","i18n","t","version","labelText","span","showDate","updatedAt","formattedDate","date","pattern","localeCode","Array","isArray","publishedLocale","locale","locales","find","loc","code","localeLabel","language","div","className","Fragment"],"mappings":"AAAA
|
|
1
|
+
{"version":3,"sources":["../../../../src/views/Version/VersionPillLabel/VersionPillLabel.tsx"],"sourcesContent":["'use client'\n\nimport { Pill, useConfig, useTranslation } from '@payloadcms/ui'\nimport { formatDate } from '@payloadcms/ui/shared'\nimport React from 'react'\n\nimport './index.scss'\nimport { getVersionLabel } from './getVersionLabel.js'\n\nconst baseClass = 'version-pill-label'\n\nconst renderPill = (label: React.ReactNode, pillStyle: Parameters<typeof Pill>[0]['pillStyle']) => {\n return (\n <Pill pillStyle={pillStyle} size=\"small\">\n {label}\n </Pill>\n )\n}\n\nexport const VersionPillLabel: React.FC<{\n currentlyPublishedVersion?: {\n id: number | string\n updatedAt: string\n }\n disableDate?: boolean\n\n doc: {\n [key: string]: unknown\n id: number | string\n publishedLocale?: string\n updatedAt?: string\n version: {\n [key: string]: unknown\n _status: string\n }\n }\n /**\n * By default, the date is displayed first, followed by the version label.\n * @default false\n */\n labelFirst?: boolean\n labelOverride?: React.ReactNode\n /**\n * @default 'pill'\n */\n labelStyle?: 'pill' | 'text'\n labelSuffix?: React.ReactNode\n latestDraftVersion?: {\n id: number | string\n updatedAt: string\n }\n}> = ({\n currentlyPublishedVersion,\n disableDate = false,\n doc,\n labelFirst = false,\n labelOverride,\n labelStyle = 'pill',\n labelSuffix,\n latestDraftVersion,\n}) => {\n const {\n config: {\n admin: { dateFormat },\n localization,\n },\n } = useConfig()\n const { i18n, t } = useTranslation()\n\n const { label, pillStyle } = getVersionLabel({\n currentlyPublishedVersion,\n latestDraftVersion,\n t,\n version: doc,\n })\n const labelText: React.ReactNode = (\n <span>\n {labelOverride || label}\n {labelSuffix}\n </span>\n )\n\n const showDate = !disableDate && doc.updatedAt\n const formattedDate = showDate\n ? formatDate({ date: doc.updatedAt, i18n, pattern: dateFormat })\n : null\n\n const localeCode = Array.isArray(doc.publishedLocale)\n ? doc.publishedLocale[0]\n : doc.publishedLocale\n\n const locale =\n localization && localization?.locales\n ? localization.locales.find((loc) => loc.code === localeCode)\n : null\n const localeLabel = locale ? locale?.label?.[i18n?.language] || locale?.label : null\n\n return (\n <div className={baseClass}>\n {labelFirst ? (\n <React.Fragment>\n {labelStyle === 'pill' ? (\n renderPill(labelText, pillStyle)\n ) : (\n <span className={`${baseClass}-text`}>{labelText}</span>\n )}\n {showDate && <span className={`${baseClass}-date`}>{formattedDate}</span>}\n </React.Fragment>\n ) : (\n <React.Fragment>\n {showDate && <span className={`${baseClass}-date`}>{formattedDate}</span>}\n {labelStyle === 'pill' ? (\n renderPill(labelText, pillStyle)\n ) : (\n <span className={`${baseClass}-text`}>{labelText}</span>\n )}\n </React.Fragment>\n )}\n {localeLabel && <Pill size=\"small\">{localeLabel}</Pill>}\n </div>\n )\n}\n"],"names":["Pill","useConfig","useTranslation","formatDate","React","getVersionLabel","baseClass","renderPill","label","pillStyle","size","VersionPillLabel","currentlyPublishedVersion","disableDate","doc","labelFirst","labelOverride","labelStyle","labelSuffix","latestDraftVersion","config","admin","dateFormat","localization","i18n","t","version","labelText","span","showDate","updatedAt","formattedDate","date","pattern","localeCode","Array","isArray","publishedLocale","locale","locales","find","loc","code","localeLabel","language","div","className","Fragment"],"mappings":"AAAA;AAEA,SAASA,IAAI,EAAEC,SAAS,EAAEC,cAAc,QAAQ,iBAAgB;AAChE,SAASC,UAAU,QAAQ,wBAAuB;AAClD,OAAOC,WAAW,QAAO;AAEzB,OAAO,eAAc;AACrB,SAASC,eAAe,QAAQ,uBAAsB;AAEtD,MAAMC,YAAY;AAElB,MAAMC,aAAa,CAACC,OAAwBC;IAC1C,QACGT,KAAKS,WAAWA,WAAWC,KAAK,QAAQ;MACvC,CAACF,MAAM;IACT,EAAER;AAEN;AAEA,OAAO,MAAMW,mBAiBX;;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EAAExB,MAAM2C,aAEP3C,MAAM2C,SAAS;UACd,CAAClB,aAAaD,KAAKkB,WAAW,GAAGxC,UAAU,KAAK,CAAC,GAAGyB,gBAAgBH,MAAM;UAC1E,CAACX,eAAe,SACdV,WAAWoB,WAAWlB,cAErBmB,KAAKkB,WAAW,GAAGxC,UAAU,KAAK,CAAC,GAAGqB,YAAYC,MACnD;QACJ,EAAExB,MAAM2C,UACR;MACF,CAACJ,gBAAgB3C,KAAKU,KAAK,SAASiC,cAAc3C,MAAM;IAC1D,EAAE6C;AAEN,EAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
2
1
|
import { formatDate } from '@payloadcms/ui/shared';
|
|
3
2
|
import { getClientConfig } from '@payloadcms/ui/utilities/getClientConfig';
|
|
4
3
|
import { getClientSchemaMap } from '@payloadcms/ui/utilities/getClientSchemaMap';
|
|
@@ -201,19 +200,7 @@ export async function VersionView(props) {
|
|
|
201
200
|
pattern: config.admin.dateFormat
|
|
202
201
|
}) : '';
|
|
203
202
|
const formatPill = ({ doc, labelOverride, labelStyle, labelSuffix })=>{
|
|
204
|
-
return
|
|
205
|
-
currentlyPublishedVersion: currentlyPublishedVersion,
|
|
206
|
-
doc: doc,
|
|
207
|
-
labelFirst: true,
|
|
208
|
-
labelOverride: labelOverride,
|
|
209
|
-
labelStyle: labelStyle ?? 'text',
|
|
210
|
-
labelSuffix: labelSuffix,
|
|
211
|
-
latestDraftVersion: latestDraftVersion
|
|
212
|
-
}, doc.id, false, {
|
|
213
|
-
fileName: "src/views/Version/index.tsx",
|
|
214
|
-
lineNumber: 278,
|
|
215
|
-
columnNumber: 7
|
|
216
|
-
}, this);
|
|
203
|
+
return <VersionPillLabel currentlyPublishedVersion={currentlyPublishedVersion} doc={doc} key={doc.id} labelFirst={true} labelOverride={labelOverride} labelStyle={labelStyle ?? 'text'} labelSuffix={labelSuffix} latestDraftVersion={latestDraftVersion}/>;
|
|
217
204
|
};
|
|
218
205
|
// SelectComparison Options:
|
|
219
206
|
//
|
|
@@ -288,34 +275,22 @@ export async function VersionView(props) {
|
|
|
288
275
|
}
|
|
289
276
|
const otherOptionsWithSameID = versionFromOptions.filter((existingOption)=>existingOption.value === option.value && existingOption !== option);
|
|
290
277
|
// Merge options with same ID to the same option
|
|
291
|
-
const labelSuffix = otherOptionsWithSameID?.length ?
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
fileName: "src/views/Version/index.tsx",
|
|
308
|
-
lineNumber: 403,
|
|
309
|
-
columnNumber: 13
|
|
310
|
-
}, this);
|
|
311
|
-
}),
|
|
312
|
-
')'
|
|
313
|
-
]
|
|
314
|
-
}, `${option.value}-suffix`, true, {
|
|
315
|
-
fileName: "src/views/Version/index.tsx",
|
|
316
|
-
lineNumber: 390,
|
|
317
|
-
columnNumber: 7
|
|
318
|
-
}, this) : undefined;
|
|
278
|
+
const labelSuffix = otherOptionsWithSameID?.length ? <span key={`${option.value}-suffix`}>
|
|
279
|
+
{' ('}
|
|
280
|
+
{otherOptionsWithSameID.map((optionWithSameID, index)=>{
|
|
281
|
+
const label = optionWithSameID.labelOverride || getVersionLabel({
|
|
282
|
+
currentlyPublishedVersion,
|
|
283
|
+
latestDraftVersion,
|
|
284
|
+
t: i18n.t,
|
|
285
|
+
version: optionWithSameID.doc
|
|
286
|
+
}).label;
|
|
287
|
+
return <React.Fragment key={`${optionWithSameID.value}-${index}`}>
|
|
288
|
+
{index > 0 ? ', ' : ''}
|
|
289
|
+
{label}
|
|
290
|
+
</React.Fragment>;
|
|
291
|
+
})}
|
|
292
|
+
{')'}
|
|
293
|
+
</span> : undefined;
|
|
319
294
|
versionFromComparisonOptions.push({
|
|
320
295
|
label: formatPill({
|
|
321
296
|
doc: option.doc,
|
|
@@ -325,27 +300,10 @@ export async function VersionView(props) {
|
|
|
325
300
|
value: option.value
|
|
326
301
|
});
|
|
327
302
|
}
|
|
328
|
-
return
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
selectedLocales: selectedLocales,
|
|
333
|
-
versionFromCreatedAt: versionFrom?.createdAt,
|
|
334
|
-
versionFromID: versionFrom?.id,
|
|
335
|
-
versionFromOptions: versionFromComparisonOptions,
|
|
336
|
-
versionToCreatedAt: versionTo.createdAt,
|
|
337
|
-
versionToCreatedAtFormatted: versionToCreatedAtFormatted,
|
|
338
|
-
VersionToCreatedAtLabel: formatPill({
|
|
339
|
-
doc: versionTo,
|
|
340
|
-
labelStyle: 'pill'
|
|
341
|
-
}),
|
|
342
|
-
versionToID: versionTo.id,
|
|
343
|
-
versionToStatus: versionTo.version?._status
|
|
344
|
-
}, void 0, false, {
|
|
345
|
-
fileName: "src/views/Version/index.tsx",
|
|
346
|
-
lineNumber: 424,
|
|
347
|
-
columnNumber: 5
|
|
348
|
-
}, this);
|
|
303
|
+
return <DefaultVersionView canUpdate={docPermissions?.update} modifiedOnly={modifiedOnly} RenderedDiff={RenderedDiff} selectedLocales={selectedLocales} versionFromCreatedAt={versionFrom?.createdAt} versionFromID={versionFrom?.id} versionFromOptions={versionFromComparisonOptions} versionToCreatedAt={versionTo.createdAt} versionToCreatedAtFormatted={versionToCreatedAtFormatted} VersionToCreatedAtLabel={formatPill({
|
|
304
|
+
doc: versionTo,
|
|
305
|
+
labelStyle: 'pill'
|
|
306
|
+
})} versionToID={versionTo.id} versionToStatus={versionTo.version?._status}/>;
|
|
349
307
|
}
|
|
350
308
|
|
|
351
309
|
//# sourceMappingURL=index.js.map
|