@payloadcms/ui 3.69.0-internal.424436e → 3.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/elements/AppHeader/index.js +1 -2
- package/dist/elements/AppHeader/index.js.map +1 -1
- package/dist/elements/AppHeader/index.scss +0 -1
- package/dist/elements/ArrayAction/index.d.ts +6 -6
- package/dist/elements/ArrayAction/index.d.ts.map +1 -1
- package/dist/elements/ArrayAction/index.js +8 -8
- package/dist/elements/ArrayAction/index.js.map +1 -1
- package/dist/elements/Autosave/index.d.ts.map +1 -1
- package/dist/elements/Autosave/index.js +20 -5
- package/dist/elements/Autosave/index.js.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.js +10 -6
- package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
- package/dist/elements/CopyLocaleData/index.d.ts.map +1 -1
- package/dist/elements/CopyLocaleData/index.js +36 -39
- package/dist/elements/CopyLocaleData/index.js.map +1 -1
- package/dist/elements/DefaultListViewTabs/index.d.ts.map +1 -1
- package/dist/elements/DefaultListViewTabs/index.js +1 -2
- package/dist/elements/DefaultListViewTabs/index.js.map +1 -1
- package/dist/elements/DeleteDocument/index.d.ts.map +1 -1
- package/dist/elements/DeleteDocument/index.js +9 -7
- package/dist/elements/DeleteDocument/index.js.map +1 -1
- package/dist/elements/DeleteMany/index.d.ts.map +1 -1
- package/dist/elements/DeleteMany/index.js +19 -16
- package/dist/elements/DeleteMany/index.js.map +1 -1
- package/dist/elements/DocumentControls/index.d.ts.map +1 -1
- package/dist/elements/DocumentControls/index.js +2 -4
- package/dist/elements/DocumentControls/index.js.map +1 -1
- package/dist/elements/DuplicateDocument/index.d.ts.map +1 -1
- package/dist/elements/DuplicateDocument/index.js +4 -6
- package/dist/elements/DuplicateDocument/index.js.map +1 -1
- package/dist/elements/EditMany/DrawerContent.d.ts.map +1 -1
- package/dist/elements/EditMany/DrawerContent.js +8 -12
- package/dist/elements/EditMany/DrawerContent.js.map +1 -1
- package/dist/elements/FolderView/BrowseByFolderButton/index.d.ts.map +1 -1
- package/dist/elements/FolderView/BrowseByFolderButton/index.js +2 -4
- package/dist/elements/FolderView/BrowseByFolderButton/index.js.map +1 -1
- package/dist/elements/FolderView/Cell/index.client.d.ts.map +1 -1
- package/dist/elements/FolderView/Cell/index.client.js +9 -2
- package/dist/elements/FolderView/Cell/index.client.js.map +1 -1
- package/dist/elements/FolderView/CurrentFolderActions/index.d.ts.map +1 -1
- package/dist/elements/FolderView/CurrentFolderActions/index.js +7 -4
- package/dist/elements/FolderView/CurrentFolderActions/index.js.map +1 -1
- package/dist/elements/FolderView/MoveDocToFolder/index.d.ts +1 -1
- package/dist/elements/FolderView/MoveDocToFolder/index.d.ts.map +1 -1
- package/dist/elements/FolderView/MoveDocToFolder/index.js +5 -1
- package/dist/elements/FolderView/MoveDocToFolder/index.js.map +1 -1
- package/dist/elements/IDLabel/index.d.ts.map +1 -1
- package/dist/elements/IDLabel/index.js +11 -14
- package/dist/elements/IDLabel/index.js.map +1 -1
- package/dist/elements/ItemsDrawer/ItemSearch/index.d.ts +8 -0
- package/dist/elements/ItemsDrawer/ItemSearch/index.d.ts.map +1 -0
- package/dist/elements/ItemsDrawer/ItemSearch/index.js +56 -0
- package/dist/elements/ItemsDrawer/ItemSearch/index.js.map +1 -0
- package/dist/elements/ItemsDrawer/ItemSearch/index.scss +38 -0
- package/dist/elements/ItemsDrawer/index.d.ts +15 -0
- package/dist/elements/ItemsDrawer/index.d.ts.map +1 -0
- package/dist/elements/ItemsDrawer/index.js +195 -0
- package/dist/elements/ItemsDrawer/index.js.map +1 -0
- package/dist/elements/ItemsDrawer/index.scss +102 -0
- package/dist/elements/Link/index.d.ts.map +1 -1
- package/dist/elements/Link/index.js +5 -3
- package/dist/elements/Link/index.js.map +1 -1
- package/dist/elements/ListControls/index.d.ts.map +1 -1
- package/dist/elements/ListControls/index.js +6 -4
- package/dist/elements/ListControls/index.js.map +1 -1
- package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.d.ts.map +1 -1
- package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.js +9 -2
- package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.js.map +1 -1
- package/dist/elements/Logout/index.d.ts.map +1 -1
- package/dist/elements/Logout/index.js +8 -11
- package/dist/elements/Logout/index.js.map +1 -1
- package/dist/elements/PermanentlyDeleteButton/index.d.ts.map +1 -1
- package/dist/elements/PermanentlyDeleteButton/index.js +19 -14
- package/dist/elements/PermanentlyDeleteButton/index.js.map +1 -1
- package/dist/elements/Popup/PopupButtonList/index.scss +1 -0
- package/dist/elements/Popup/PopupTrigger/index.d.ts +1 -1
- package/dist/elements/Popup/PopupTrigger/index.d.ts.map +1 -1
- package/dist/elements/Popup/PopupTrigger/index.js +24 -92
- package/dist/elements/Popup/PopupTrigger/index.js.map +1 -1
- package/dist/elements/Popup/index.d.ts +32 -1
- package/dist/elements/Popup/index.d.ts.map +1 -1
- package/dist/elements/Popup/index.js +249 -122
- package/dist/elements/Popup/index.js.map +1 -1
- package/dist/elements/Popup/index.scss +49 -231
- package/dist/elements/PublishButton/ScheduleDrawer/index.d.ts.map +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/index.js +6 -2
- package/dist/elements/PublishButton/ScheduleDrawer/index.js.map +1 -1
- package/dist/elements/PublishButton/index.d.ts.map +1 -1
- package/dist/elements/PublishButton/index.js +14 -4
- package/dist/elements/PublishButton/index.js.map +1 -1
- package/dist/elements/PublishMany/DrawerContent.d.ts.map +1 -1
- package/dist/elements/PublishMany/DrawerContent.js +8 -5
- package/dist/elements/PublishMany/DrawerContent.js.map +1 -1
- package/dist/elements/QueryPresets/QueryPresetBar/index.d.ts.map +1 -1
- package/dist/elements/QueryPresets/QueryPresetBar/index.js +7 -9
- package/dist/elements/QueryPresets/QueryPresetBar/index.js.map +1 -1
- package/dist/elements/RestoreButton/index.d.ts.map +1 -1
- package/dist/elements/RestoreButton/index.js +19 -14
- package/dist/elements/RestoreButton/index.js.map +1 -1
- package/dist/elements/RestoreMany/index.d.ts.map +1 -1
- package/dist/elements/RestoreMany/index.js +17 -14
- package/dist/elements/RestoreMany/index.js.map +1 -1
- package/dist/elements/SaveDraftButton/index.d.ts.map +1 -1
- package/dist/elements/SaveDraftButton/index.js +11 -5
- package/dist/elements/SaveDraftButton/index.js.map +1 -1
- package/dist/elements/Status/index.d.ts.map +1 -1
- package/dist/elements/Status/index.js +11 -5
- package/dist/elements/Status/index.js.map +1 -1
- package/dist/elements/StayLoggedIn/index.d.ts.map +1 -1
- package/dist/elements/StayLoggedIn/index.js +17 -20
- package/dist/elements/StayLoggedIn/index.js.map +1 -1
- package/dist/elements/StepNav/context.d.ts.map +1 -1
- package/dist/elements/StepNav/context.js +9 -1
- package/dist/elements/StepNav/context.js.map +1 -1
- package/dist/elements/StepNav/index.scss +0 -1
- package/dist/elements/Table/DefaultCell/fields/Relationship/index.d.ts.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/Relationship/index.js +39 -41
- package/dist/elements/Table/DefaultCell/fields/Relationship/index.js.map +1 -1
- package/dist/elements/Table/DefaultCell/index.d.ts.map +1 -1
- package/dist/elements/Table/DefaultCell/index.js +9 -12
- package/dist/elements/Table/DefaultCell/index.js.map +1 -1
- package/dist/elements/Table/OrderableTable.d.ts.map +1 -1
- package/dist/elements/Table/OrderableTable.js +5 -1
- package/dist/elements/Table/OrderableTable.js.map +1 -1
- package/dist/elements/Table/RelationshipProvider/index.d.ts.map +1 -1
- package/dist/elements/Table/RelationshipProvider/index.js +25 -24
- package/dist/elements/Table/RelationshipProvider/index.js.map +1 -1
- package/dist/elements/UnpublishMany/DrawerContent.d.ts.map +1 -1
- package/dist/elements/UnpublishMany/DrawerContent.js +8 -5
- package/dist/elements/UnpublishMany/DrawerContent.js.map +1 -1
- package/dist/elements/Upload/index.d.ts.map +1 -1
- package/dist/elements/Upload/index.js +7 -5
- package/dist/elements/Upload/index.js.map +1 -1
- package/dist/elements/WhereBuilder/Condition/Relationship/index.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/Condition/Relationship/index.js +14 -8
- package/dist/elements/WhereBuilder/Condition/Relationship/index.js.map +1 -1
- package/dist/elements/withMergedProps/index.d.ts +1 -1
- package/dist/elements/withMergedProps/index.js +1 -1
- package/dist/elements/withMergedProps/index.js.map +1 -1
- package/dist/exports/client/index.d.ts +1 -2
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +12 -12
- package/dist/exports/client/index.js.map +4 -4
- package/dist/exports/rsc/index.d.ts +1 -0
- package/dist/exports/rsc/index.d.ts.map +1 -1
- package/dist/exports/rsc/index.js +1 -0
- package/dist/exports/rsc/index.js.map +1 -1
- package/dist/exports/shared/index.d.ts +3 -0
- package/dist/exports/shared/index.d.ts.map +1 -1
- package/dist/exports/shared/index.js +2 -2
- package/dist/exports/shared/index.js.map +4 -4
- package/dist/fields/Array/ArrayRow.d.ts +7 -18
- package/dist/fields/Array/ArrayRow.d.ts.map +1 -1
- package/dist/fields/Array/ArrayRow.js +133 -65
- package/dist/fields/Array/ArrayRow.js.map +1 -1
- package/dist/fields/Array/index.d.ts.map +1 -1
- package/dist/fields/Array/index.js +3 -10
- package/dist/fields/Array/index.js.map +1 -1
- package/dist/fields/Relationship/Input.d.ts.map +1 -1
- package/dist/fields/Relationship/Input.js +9 -3
- package/dist/fields/Relationship/Input.js.map +1 -1
- package/dist/fields/Upload/Input.d.ts.map +1 -1
- package/dist/fields/Upload/Input.js +7 -3
- package/dist/fields/Upload/Input.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/fieldSchemasToFormState.spec.js +8 -1
- package/dist/forms/fieldSchemasToFormState/fieldSchemasToFormState.spec.js.map +1 -1
- package/dist/graphics/Account/index.d.ts.map +1 -1
- package/dist/graphics/Account/index.js +2 -4
- package/dist/graphics/Account/index.js.map +1 -1
- package/dist/providers/Auth/index.d.ts.map +1 -1
- package/dist/providers/Auth/index.js +23 -26
- package/dist/providers/Auth/index.js.map +1 -1
- package/dist/providers/DocumentInfo/index.d.ts +1 -1
- package/dist/providers/DocumentInfo/index.d.ts.map +1 -1
- package/dist/providers/DocumentInfo/index.js +16 -15
- package/dist/providers/DocumentInfo/index.js.map +1 -1
- package/dist/providers/DocumentInfo/useGetDocPermissions.d.ts +1 -2
- package/dist/providers/DocumentInfo/useGetDocPermissions.d.ts.map +1 -1
- package/dist/providers/DocumentInfo/useGetDocPermissions.js +16 -6
- package/dist/providers/DocumentInfo/useGetDocPermissions.js.map +1 -1
- package/dist/providers/Folders/index.d.ts.map +1 -1
- package/dist/providers/Folders/index.js +14 -11
- package/dist/providers/Folders/index.js.map +1 -1
- package/dist/providers/Locale/index.d.ts.map +1 -1
- package/dist/providers/Locale/index.js +45 -34
- package/dist/providers/Locale/index.js.map +1 -1
- package/dist/providers/Preferences/index.d.ts.map +1 -1
- package/dist/providers/Preferences/index.js +16 -7
- package/dist/providers/Preferences/index.js.map +1 -1
- package/dist/providers/RouteTransition/index.d.ts.map +1 -1
- package/dist/providers/RouteTransition/index.js +6 -1
- package/dist/providers/RouteTransition/index.js.map +1 -1
- package/dist/providers/TableColumns/buildColumnState/renderCell.d.ts.map +1 -1
- package/dist/providers/TableColumns/buildColumnState/renderCell.js +1 -2
- package/dist/providers/TableColumns/buildColumnState/renderCell.js.map +1 -1
- package/dist/scss/app.scss +14 -1
- package/dist/styles.css +1 -1
- package/dist/utilities/getGlobalData.d.ts +11 -0
- package/dist/utilities/getGlobalData.d.ts.map +1 -0
- package/dist/utilities/getGlobalData.js +49 -0
- package/dist/utilities/getGlobalData.js.map +1 -0
- package/dist/utilities/getNavGroups.d.ts +5 -0
- package/dist/utilities/getNavGroups.d.ts.map +1 -0
- package/dist/utilities/getNavGroups.js +22 -0
- package/dist/utilities/getNavGroups.js.map +1 -0
- package/dist/utilities/getVisibleEntities.d.ts +5 -0
- package/dist/utilities/getVisibleEntities.d.ts.map +1 -0
- package/dist/utilities/getVisibleEntities.js +31 -0
- package/dist/utilities/getVisibleEntities.js.map +1 -0
- package/dist/utilities/groupNavItems.d.ts +3 -0
- package/dist/utilities/groupNavItems.d.ts.map +1 -1
- package/dist/utilities/groupNavItems.js +3 -0
- package/dist/utilities/groupNavItems.js.map +1 -1
- package/dist/utilities/handleBackToDashboard.js +1 -1
- package/dist/utilities/handleBackToDashboard.js.map +1 -1
- package/dist/utilities/handleGoBack.d.ts.map +1 -1
- package/dist/utilities/handleGoBack.js +1 -2
- package/dist/utilities/handleGoBack.js.map +1 -1
- package/dist/utilities/normalizeRelationshipValue.spec.js +1 -1
- package/dist/utilities/normalizeRelationshipValue.spec.js.map +1 -1
- package/dist/views/CollectionFolder/index.js +2 -4
- package/dist/views/CollectionFolder/index.js.map +1 -1
- package/dist/views/Edit/Auth/index.d.ts.map +1 -1
- package/dist/views/Edit/Auth/index.js +22 -21
- package/dist/views/Edit/Auth/index.js.map +1 -1
- package/dist/views/Edit/SetDocumentStepNav/index.d.ts.map +1 -1
- package/dist/views/Edit/SetDocumentStepNav/index.js +36 -22
- package/dist/views/Edit/SetDocumentStepNav/index.js.map +1 -1
- package/dist/views/Edit/index.d.ts.map +1 -1
- package/dist/views/Edit/index.js +2 -3
- package/dist/views/Edit/index.js.map +1 -1
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js +1 -2
- package/dist/views/List/index.js.map +1 -1
- package/dist/widgets/CollectionCards/index.d.ts +5 -0
- package/dist/widgets/CollectionCards/index.d.ts.map +1 -0
- package/dist/widgets/CollectionCards/index.js +135 -0
- package/dist/widgets/CollectionCards/index.js.map +1 -0
- package/dist/widgets/CollectionCards/index.scss +70 -0
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","useSearchParams","React","createContext","use","useEffect","useRef","useState","findLocaleFromCode","useAuth","useConfig","LocaleContext","LocaleLoadingContext","localeIsLoading","setLocaleIsLoading","_","undefined","fetchPreferences","key","baseURL","fetch","credentials","headers","method","then","res","json","LocaleProvider","t0","$","children","locale","initialLocaleFromPrefs","config","t1","localization","t2","routes","t3","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","useSearchParams","formatAdminURL","React","createContext","use","useEffect","useRef","useState","findLocaleFromCode","useAuth","useConfig","LocaleContext","LocaleLoadingContext","localeIsLoading","setLocaleIsLoading","_","undefined","fetchPreferences","key","baseURL","fetch","credentials","headers","method","then","res","json","LocaleProvider","t0","$","children","locale","initialLocaleFromPrefs","config","t1","localization","t2","routes","t3","api","apiRoute","user","defaultLocale","t4","t5","get","localeFromParams","t6","locales","length","code","setLocale","isLoading","prevLocale","t7","t8","current","t9","path","fetchURL","t10","id","resetLocale","localeToUse","_temp","newLocale","t11","t12","t13","_jsx","value","useLocaleLoading","useLocale"],"sources":["../../../src/providers/Locale/index.tsx"],"sourcesContent":["'use client'\n\nimport type { Locale } from 'payload'\n\nimport { useSearchParams } from 'next/navigation.js'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { createContext, use, useEffect, useRef, useState } from 'react'\n\nimport { findLocaleFromCode } from '../../utilities/findLocaleFromCode.js'\nimport { useAuth } from '../Auth/index.js'\nimport { useConfig } from '../Config/index.js'\n\nconst LocaleContext = createContext({} as Locale)\n\nexport const LocaleLoadingContext = createContext({\n localeIsLoading: false,\n setLocaleIsLoading: (_: boolean) => undefined,\n})\n\nconst fetchPreferences = async <T extends Record<string, unknown> | string>(\n key: string,\n baseURL: string,\n): Promise<{ id: string; value: T }> =>\n await fetch(`${baseURL}/payload-preferences/${key}`, {\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'GET',\n })?.then((res) => res.json() as Promise<{ id: string; value: T }>)\n\nexport const LocaleProvider: React.FC<{ children?: React.ReactNode; locale?: Locale['code'] }> = ({\n children,\n /**\n The `locale` prop originates from the root layout, which does not have access to search params\n This component uses the `useSearchParams` hook to get the locale from the URL as precedence over this prop\n This prop does not update as the user navigates the site, because the root layout does not re-render\n */\n locale: initialLocaleFromPrefs,\n}) => {\n const {\n config: {\n localization = false,\n routes: { api: apiRoute },\n },\n } = useConfig()\n\n const { user } = useAuth()\n\n const defaultLocale = localization ? localization.defaultLocale : 'en'\n\n const localeFromParams = useSearchParams().get('locale')\n\n const [locale, setLocale] = React.useState<Locale>(() => {\n if (!localization || (localization && !localization.locales.length)) {\n // TODO: return null V4\n return {} as Locale\n }\n\n return (\n findLocaleFromCode(localization, localeFromParams) ||\n findLocaleFromCode(localization, initialLocaleFromPrefs) ||\n findLocaleFromCode(localization, defaultLocale) ||\n findLocaleFromCode(localization, localization.locales[0].code)\n )\n })\n\n const [isLoading, setLocaleIsLoading] = useState(false)\n\n const prevLocale = useRef<Locale>(locale)\n\n useEffect(() => {\n /**\n * We need to set `isLoading` back to false once the locale is detected to be different\n * This happens when the user clicks an anchor link which appends the `?locale=` query param\n * This triggers a client-side navigation, which re-renders the page with the new locale\n * In Next.js, local state is persisted during this type of navigation because components are not unmounted\n */\n if (locale.code !== prevLocale.current.code) {\n setLocaleIsLoading(false)\n }\n\n prevLocale.current = locale\n }, [locale])\n\n const fetchURL = formatAdminURL({\n apiRoute,\n path: '',\n })\n\n useEffect(() => {\n /**\n * This effect should only run when `localeFromParams` changes, i.e. when the user clicks an anchor link\n * The root layout, which sends the initial locale from prefs, will not re-render as the user navigates the site\n * For this reason, we need to fetch the locale from prefs if the search params clears the `locale` query param\n */\n async function resetLocale() {\n if (localization && user?.id) {\n const localeToUse =\n localeFromParams ||\n (await fetchPreferences<Locale['code']>('locale', fetchURL)?.then((res) => res.value))\n\n const newLocale =\n findLocaleFromCode(localization, localeToUse) ||\n findLocaleFromCode(localization, defaultLocale) ||\n findLocaleFromCode(localization, localization?.locales?.[0]?.code)\n\n if (newLocale) {\n setLocale(newLocale)\n }\n }\n }\n\n void resetLocale()\n }, [defaultLocale, localization, fetchURL, localeFromParams, user?.id])\n\n return (\n <LocaleContext value={locale}>\n <LocaleLoadingContext value={{ localeIsLoading: isLoading, setLocaleIsLoading }}>\n {children}\n </LocaleLoadingContext>\n </LocaleContext>\n )\n}\n\nexport const useLocaleLoading = () => use(LocaleLoadingContext)\n\n/**\n * TODO: V4\n * The return type of the `useLocale` hook will change in v4. It will return `null | Locale` instead of `false | {} | Locale`.\n */\nexport const useLocale = (): Locale => use(LocaleContext)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAEvE,SAASC,kBAAkB,QAAQ;AACnC,SAASC,OAAO,QAAQ;AACxB,SAASC,SAAS,QAAQ;AAE1B,MAAMC,aAAA,gBAAgBR,aAAA,CAAc,CAAC;AAErC,OAAO,MAAMS,oBAAA,gBAAuBT,aAAA,CAAc;EAChDU,eAAA,EAAiB;EACjBC,kBAAA,EAAqBC,CAAA,IAAeC;AACtC;AAEA,MAAMC,gBAAA,GAAmB,MAAAA,CACvBC,GAAA,EACAC,OAAA,KAEA,MAAMC,KAAA,CAAM,GAAGD,OAAA,wBAA+BD,GAAA,EAAK,EAAE;EACnDG,WAAA,EAAa;EACbC,OAAA,EAAS;IACP,gBAAgB;EAClB;EACAC,MAAA,EAAQ;AACV,IAAIC,IAAA,CAAMC,GAAA,IAAQA,GAAA,CAAIC,IAAI;AAE5B,OAAO,MAAMC,cAAA,GAAoFC,EAAA;EAAA,MAAAC,CAAA,GAAA9B,EAAA;EAAC;IAAA+B,QAAA;IAAAC,MAAA,EAAAC;EAAA,IAAAJ,EAQjG;EACC;IAAAK,MAAA,EAAAC;EAAA,IAKIxB,SAAA;EAJM;IAAAyB,YAAA,EAAAC,EAAA;IAAAC,MAAA,EAAAC;EAAA,IAAAJ,EAGP;EAFC,MAAAC,YAAA,GAAAC,EAAoB,KAAApB,SAAA,WAApBoB,EAAo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uC,SAAA;UAAAtC;QAAA;QAAAgB;MAAA,C;;;;;;;;;SADlDsC,G;CAMJ;AAEA,OAAO,MAAMG,gBAAA,GAAmBA,CAAA,KAAMnE,GAAA,CAAIQ,oBAAA;AAE1C;;;;AAIA,OAAO,MAAM4D,SAAA,GAAYA,CAAA,KAAcpE,GAAA,CAAIO,aAAA;AApGsD,SAAAqD,MAAAvC,GAAA;EAAA,OAqEZA,GAAA,CAAA6C,KAAA;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/Preferences/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/Preferences/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA6D,MAAM,OAAO,CAAA;AAEjF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAQ5D,KAAK,kBAAkB,GAAG;IACxB,aAAa,EAAE,CAAC,CAAC,GAAG,WAAW,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;IAC3D;;;;OAIG;IACH,aAAa,EAAE,CAAC,CAAC,GAAG,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1F,CAAA;AAYD,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CA6IxE,CAAA;AAED,eAAO,MAAM,cAAc,QAAO,kBAAkC,CAAA"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
import { dequal } from 'dequal/lite'; // lite: no need for Map and Set support
|
|
5
|
+
import { formatAdminURL } from 'payload/shared';
|
|
5
6
|
import React, { createContext, use, useCallback, useEffect, useRef } from 'react';
|
|
6
7
|
import { useTranslation } from '../../providers/Translation/index.js';
|
|
7
8
|
import { requests } from '../../utilities/api.js';
|
|
@@ -36,8 +37,7 @@ export const PreferencesProvider = ({
|
|
|
36
37
|
const {
|
|
37
38
|
routes: {
|
|
38
39
|
api
|
|
39
|
-
}
|
|
40
|
-
serverURL
|
|
40
|
+
}
|
|
41
41
|
} = config;
|
|
42
42
|
useEffect(() => {
|
|
43
43
|
if (!user) {
|
|
@@ -52,7 +52,10 @@ export const PreferencesProvider = ({
|
|
|
52
52
|
}
|
|
53
53
|
const promise = new Promise(resolve => {
|
|
54
54
|
void (async () => {
|
|
55
|
-
const request = await requests.get(
|
|
55
|
+
const request = await requests.get(formatAdminURL({
|
|
56
|
+
apiRoute: api,
|
|
57
|
+
path: `/payload-preferences/${key}`
|
|
58
|
+
}), {
|
|
56
59
|
credentials: 'include',
|
|
57
60
|
headers: {
|
|
58
61
|
'Accept-Language': i18n.language
|
|
@@ -69,11 +72,14 @@ export const PreferencesProvider = ({
|
|
|
69
72
|
});
|
|
70
73
|
prefs[key] = promise;
|
|
71
74
|
return promise;
|
|
72
|
-
}, [i18n.language, api, preferencesRef
|
|
75
|
+
}, [i18n.language, api, preferencesRef]);
|
|
73
76
|
const setPreference = useCallback(async (key_0, value_0, merge = false) => {
|
|
74
77
|
if (merge === false) {
|
|
75
78
|
preferencesRef.current[key_0] = value_0;
|
|
76
|
-
await requests.post(
|
|
79
|
+
await requests.post(formatAdminURL({
|
|
80
|
+
apiRoute: api,
|
|
81
|
+
path: `/payload-preferences/${key_0}`
|
|
82
|
+
}), requestOptions(value_0, i18n.language));
|
|
77
83
|
return;
|
|
78
84
|
}
|
|
79
85
|
let newValue = value_0;
|
|
@@ -105,7 +111,10 @@ export const PreferencesProvider = ({
|
|
|
105
111
|
}
|
|
106
112
|
// preference set in context here to prevent other updatePreference at the same time
|
|
107
113
|
preferencesRef.current[key_0] = pendingUpdate.current[key_0];
|
|
108
|
-
await requests.post(
|
|
114
|
+
await requests.post(formatAdminURL({
|
|
115
|
+
apiRoute: api,
|
|
116
|
+
path: `/payload-preferences/${key_0}`
|
|
117
|
+
}), requestOptions(preferencesRef.current[key_0], i18n.language));
|
|
109
118
|
// reset any changes for this key after sending the request
|
|
110
119
|
delete pendingUpdate.current[key_0];
|
|
111
120
|
};
|
|
@@ -113,7 +122,7 @@ export const PreferencesProvider = ({
|
|
|
113
122
|
setTimeout(() => {
|
|
114
123
|
void updatePreference();
|
|
115
124
|
});
|
|
116
|
-
}, [api, getPreference, i18n.language, pendingUpdate
|
|
125
|
+
}, [api, getPreference, i18n.language, pendingUpdate]);
|
|
117
126
|
contextRef.current.getPreference = getPreference;
|
|
118
127
|
contextRef.current.setPreference = setPreference;
|
|
119
128
|
return /*#__PURE__*/_jsx(Context, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["dequal","React","createContext","use","useCallback","useEffect","useRef","useTranslation","requests","deepMergeSimple","useAuth","useConfig","Context","requestOptions","value","language","body","JSON","stringify","headers","PreferencesProvider","children","contextRef","preferencesRef","pendingUpdate","config","user","i18n","routes","api","
|
|
1
|
+
{"version":3,"file":"index.js","names":["dequal","formatAdminURL","React","createContext","use","useCallback","useEffect","useRef","useTranslation","requests","deepMergeSimple","useAuth","useConfig","Context","requestOptions","value","language","body","JSON","stringify","headers","PreferencesProvider","children","contextRef","preferencesRef","pendingUpdate","config","user","i18n","routes","api","current","getPreference","key","prefs","promise","Promise","resolve","request","get","apiRoute","path","credentials","status","preference","json","setPreference","merge","post","newValue","currentPreference","updatePreference","setTimeout","_jsx","usePreferences"],"sources":["../../../src/providers/Preferences/index.tsx"],"sourcesContent":["'use client'\nimport { dequal } from 'dequal/lite' // lite: no need for Map and Set support\nimport { formatAdminURL } from 'payload/shared'\nimport React, { createContext, use, useCallback, useEffect, useRef } from 'react'\n\nimport type { Preferences } from '../../forms/Form/types.js'\n\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { requests } from '../../utilities/api.js'\nimport { deepMergeSimple } from '../../utilities/deepMerge.js'\nimport { useAuth } from '../Auth/index.js'\nimport { useConfig } from '../Config/index.js'\n\ntype PreferencesContext = {\n getPreference: <T = Preferences>(key: string) => Promise<T>\n /**\n * @param key - a string identifier for the property being set\n * @param value - preference data to store\n * @param merge - when true will combine the existing preference object batch the change into one request for objects, default = false\n */\n setPreference: <T = Preferences>(key: string, value: T, merge?: boolean) => Promise<void>\n}\n\nconst Context = createContext({} as PreferencesContext)\n\nconst requestOptions = (value, language) => ({\n body: JSON.stringify({ value }),\n headers: {\n 'Accept-Language': language,\n 'Content-Type': 'application/json',\n },\n})\n\nexport const PreferencesProvider: React.FC<{ children?: React.ReactNode }> = ({ children }) => {\n const contextRef = useRef({} as PreferencesContext)\n const preferencesRef = useRef({})\n const pendingUpdate = useRef({})\n const { config } = useConfig()\n const { user } = useAuth()\n const { i18n } = useTranslation()\n\n const {\n routes: { api },\n } = config\n\n useEffect(() => {\n if (!user) {\n // clear preferences between users\n preferencesRef.current = {}\n }\n }, [user])\n\n const getPreference = useCallback(\n async <T = unknown,>(key: string): Promise<T> => {\n const prefs = preferencesRef.current\n\n if (typeof prefs[key] !== 'undefined') {\n return prefs[key]\n }\n\n const promise = new Promise((resolve: (value: T) => void) => {\n void (async () => {\n const request = await requests.get(\n formatAdminURL({\n apiRoute: api,\n path: `/payload-preferences/${key}`,\n }),\n {\n credentials: 'include',\n headers: {\n 'Accept-Language': i18n.language,\n },\n },\n )\n\n let value = null\n\n if (request.status === 200) {\n const preference = await request.json()\n value = preference.value\n }\n\n preferencesRef.current[key] = value\n\n resolve(value)\n })()\n })\n\n prefs[key] = promise\n\n return promise\n },\n [i18n.language, api, preferencesRef],\n )\n\n const setPreference = useCallback(\n async (key: string, value: unknown, merge = false): Promise<void> => {\n if (merge === false) {\n preferencesRef.current[key] = value\n\n await requests.post(\n formatAdminURL({\n apiRoute: api,\n path: `/payload-preferences/${key}`,\n }),\n requestOptions(value, i18n.language),\n )\n\n return\n }\n\n let newValue = value\n const currentPreference = await getPreference(key)\n\n // handle value objects where multiple values can be set under one key\n if (\n typeof value === 'object' &&\n typeof currentPreference === 'object' &&\n typeof newValue === 'object'\n ) {\n // merge the value with any existing preference for the key\n if (currentPreference) {\n newValue = deepMergeSimple(currentPreference, newValue)\n }\n\n if (dequal(newValue, currentPreference)) {\n return\n }\n\n // add the requested changes to a pendingUpdate batch for the key\n pendingUpdate.current[key] = {\n ...pendingUpdate.current[key],\n ...(newValue as Record<string, unknown>),\n }\n } else {\n if (newValue === currentPreference) {\n return\n }\n\n pendingUpdate.current[key] = newValue\n }\n\n const updatePreference = async () => {\n // compare the value stored in context before sending to eliminate duplicate requests\n if (dequal(pendingUpdate.current[key], preferencesRef.current[key])) {\n return\n }\n\n // preference set in context here to prevent other updatePreference at the same time\n preferencesRef.current[key] = pendingUpdate.current[key]\n\n await requests.post(\n formatAdminURL({\n apiRoute: api,\n path: `/payload-preferences/${key}`,\n }),\n requestOptions(preferencesRef.current[key], i18n.language),\n )\n\n // reset any changes for this key after sending the request\n delete pendingUpdate.current[key]\n }\n\n // use timeout to allow multiple changes of different values using the same key in one request\n setTimeout(() => {\n void updatePreference()\n })\n },\n [api, getPreference, i18n.language, pendingUpdate],\n )\n\n contextRef.current.getPreference = getPreference\n contextRef.current.setPreference = setPreference\n return <Context value={contextRef.current}>{children}</Context>\n}\n\nexport const usePreferences = (): PreferencesContext => use(Context)\n"],"mappings":"AAAA;;;AACA,SAASA,MAAM,QAAQ,cAAa,CAAC;AACrC,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ;AAI1E,SAASC,cAAc,QAAQ;AAC/B,SAASC,QAAQ,QAAQ;AACzB,SAASC,eAAe,QAAQ;AAChC,SAASC,OAAO,QAAQ;AACxB,SAASC,SAAS,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sources":["../../../src/providers/RouteTransition/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAyE,MAAM,OAAO,CAAA;AAE7F;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA6DlE,CAAA;AAED,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAA;AAED,KAAK,oBAAoB,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,KAAK,IAAI,CAAA;AAE3D,KAAK,2BAA2B,GAAG;IACjC,eAAe,EAAE,OAAO,CAAA;IACxB,oBAAoB,EAAE,oBAAoB,CAAA;IAC1C,kBAAkB,EAAE,MAAM,CAAA;CAC3B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/RouteTransition/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAyE,MAAM,OAAO,CAAA;AAE7F;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA6DlE,CAAA;AAED,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAA;AAED,KAAK,oBAAoB,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,KAAK,IAAI,CAAA;AAE3D,KAAK,2BAA2B,GAAG;IACjC,eAAe,EAAE,OAAO,CAAA;IACxB,oBAAoB,EAAE,oBAAoB,CAAA;IAC1C,kBAAkB,EAAE,MAAM,CAAA;CAC3B,CAAA;AAaD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,kBAAkB,mCAA0C,CAAA"}
|
|
@@ -103,7 +103,12 @@ export const RouteTransitionProvider = t0 => {
|
|
|
103
103
|
};
|
|
104
104
|
const RouteTransitionContext = /*#__PURE__*/React.createContext({
|
|
105
105
|
isTransitioning: false,
|
|
106
|
-
|
|
106
|
+
// Default implementation: just call the callback directly (no transition animation)
|
|
107
|
+
startRouteTransition: callback => {
|
|
108
|
+
if (typeof callback === 'function') {
|
|
109
|
+
callback();
|
|
110
|
+
}
|
|
111
|
+
},
|
|
107
112
|
transitionProgress: 0
|
|
108
113
|
});
|
|
109
114
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","React","startTransition","useCallback","useEffect","useOptimistic","useRef","RouteTransitionProvider","t0","$","children","isTransitioning","setIsTransitioning","transitionProgress","setTransitionProgress","useState","transitionProgressRef","timerID","t1","Symbol","for","current","setInterval","newProgress","Math","random","pow","log","initiateProgress","t2","t3","clearInterval","t4","callback","startRouteTransition","t5","_jsx","RouteTransitionContext","value","createContext","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","React","startTransition","useCallback","useEffect","useOptimistic","useRef","RouteTransitionProvider","t0","$","children","isTransitioning","setIsTransitioning","transitionProgress","setTransitionProgress","useState","transitionProgressRef","timerID","t1","Symbol","for","current","setInterval","newProgress","Math","random","pow","log","initiateProgress","t2","t3","clearInterval","t4","callback","startRouteTransition","t5","_jsx","RouteTransitionContext","value","createContext","useRouteTransition","use"],"sources":["../../../src/providers/RouteTransition/index.tsx"],"sourcesContent":["'use client'\nimport React, { startTransition, useCallback, useEffect, useOptimistic, useRef } from 'react'\n\n/**\n * Route transitions are useful in showing immediate visual feedback to the user when navigating between pages. This is especially useful on slow networks when navigating to data heavy or process intensive pages.\n * To use route transitions, place the `RouteTransitionProvider` at the root of your application, outside of the `ProgressBar` component.\n * To trigger a route transition, use the `Link` component from `@payloadcms/ui`,\n * or wrap a callback function with the `startRouteTransition` method.\n * To gain access to the `RouteTransitionContext`, call the `useRouteTransition` hook in your component.\n * @returns A context provider with methods and state for transitioning between routes, including `isTransitioning`, `startRouteTransition`, and `transitionProgress`.\n * @example\n * import { RouteTransitionProvider, ProgressBar, Link } from '@payloadcms/ui'\n * const App = () => (\n * <RouteTransitionProvider>\n * <ProgressBar />\n * <Link href=\"/somewhere\">Go Somewhere</Link>\n * </RouteTransitionProvider>\n * )\n */\nexport const RouteTransitionProvider: React.FC<RouteTransitionProps> = ({ children }) => {\n const [isTransitioning, setIsTransitioning] = useOptimistic(false)\n const [transitionProgress, setTransitionProgress] = React.useState<number>(0)\n\n const transitionProgressRef = useRef(transitionProgress)\n\n const timerID = useRef(null)\n\n const initiateProgress = useCallback(() => {\n timerID.current = setInterval(() => {\n // randomly update progress using an exponential curve\n // cap the progress to ensure it never fully reaches completion\n // accelerate quickly then decelerate slowly\n const maxProgress = 0.93\n const jumpFactor = 0.2 // lower to reduce jumps in progress\n const growthFactor = 0.75 // adjust to control acceleration\n const slowdownFactor = 0.75 // adjust to control deceleration\n\n const newProgress =\n transitionProgressRef.current +\n (maxProgress - transitionProgressRef.current) *\n Math.random() *\n jumpFactor *\n Math.pow(Math.log(1 + (1 - transitionProgressRef.current) * growthFactor), slowdownFactor)\n\n setTransitionProgress(newProgress)\n transitionProgressRef.current = newProgress\n }, 250) // every n ms, update progress\n }, [])\n\n useEffect(() => {\n setTransitionProgress(0)\n transitionProgressRef.current = 0\n\n if (isTransitioning) {\n initiateProgress()\n } else {\n if (timerID.current) {\n clearInterval(timerID.current)\n }\n }\n }, [isTransitioning, initiateProgress])\n\n const startRouteTransition: StartRouteTransition = useCallback(\n (callback?: () => void) => {\n startTransition(() => {\n setIsTransitioning(true)\n\n if (typeof callback === 'function') {\n callback()\n }\n })\n },\n [setIsTransitioning],\n )\n\n return (\n <RouteTransitionContext value={{ isTransitioning, startRouteTransition, transitionProgress }}>\n {children}\n </RouteTransitionContext>\n )\n}\n\ntype RouteTransitionProps = {\n children: React.ReactNode\n}\n\ntype StartRouteTransition = (callback?: () => void) => void\n\ntype RouteTransitionContextValue = {\n isTransitioning: boolean\n startRouteTransition: StartRouteTransition\n transitionProgress: number\n}\n\nconst RouteTransitionContext = React.createContext<RouteTransitionContextValue>({\n isTransitioning: false,\n // Default implementation: just call the callback directly (no transition animation)\n startRouteTransition: (callback) => {\n if (typeof callback === 'function') {\n callback()\n }\n },\n transitionProgress: 0,\n})\n\n/**\n * Use this hook to access the `RouteTransitionContext` provided by the `RouteTransitionProvider`.\n * To start a transition, fire the `startRouteTransition` method with a provided callback to run while the transition takes place.\n * @returns The `RouteTransitionContext` needed for transitioning between routes, including `isTransitioning`, `startRouteTransition`, and `transitionProgress`.\n * @example\n * 'use client'\n * import React, { useCallback } from 'react'\n * import { useTransition } from '@payloadcms/ui'\n * import { useRouter } from 'next/navigation'\n *\n * const MyComponent: React.FC = () => {\n * const router = useRouter()\n * const { startRouteTransition } = useRouteTransition()\n *\n * const redirectSomewhere = useCallback(() => {\n * startRouteTransition(() => router.push('/somewhere'))\n * }, [startRouteTransition, router])\n *\n * // ...\n * }\n */\nexport const useRouteTransition = () => React.use(RouteTransitionContext)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,IAASC,eAAe,EAAEC,WAAW,EAAEC,SAAS,EAAEC,aAAa,EAAEC,MAAM,QAAQ;AAEtF;;;;;;;;;;;;;;;;AAgBA,OAAO,MAAMC,uBAAA,GAA0DC,EAAA;EAAA,MAAAC,CAAA,GAAAT,EAAA;EAAC;IAAAU;EAAA,IAAAF,EAAY;EAClF,OAAAG,eAAA,EAAAC,kBAAA,IAA8CP,aAAA,MAAc;EAC5D,OAAAQ,kBAAA,EAAAC,qBAAA,IAAoDb,KAAA,CAAAc,QAAA,EAAuB;EAE3E,MAAAC,qBAAA,GAA8BV,MAAA,CAAOO,kBAAA;EAErC,MAAAI,OAAA,GAAgBX,MAAA,KAAO;EAAA,IAAAY,EAAA;EAAA,IAAAT,CAAA,QAAAU,MAAA,CAAAC,GAAA;IAEcF,EAAA,GAAAA,CAAA;MACnCD,OAAA,CAAAI,OAAA,GAAkBC,WAAA;QAShB,MAAAC,WAAA,GACEP,qBAAA,CAAAK,OAAA,GACA,C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,IAAA1B,CAAA,QAAAC,QAAA,IAAAD,CAAA,QAAAE,eAAA,IAAAF,CAAA,QAAAyB,oBAAA,IAAAzB,CAAA,QAAAI,kBAAA;IAIpBsB,EAAA,GAAAC,IAAA,CAAAC,sBAAA;MAAAC,KAAA;QAAA3B,eAAA;QAAAuB,oBAAA;QAAArB;MAAA;MAAAH;IAAA,C;;;;;;;;;SAAAyB,E;CAIJ;AAcA,MAAME,sBAAA,gBAAyBpC,KAAA,CAAMsC,aAAa,CAA8B;EAC9E5B,eAAA,EAAiB;EACjB;EACAuB,oBAAA,EAAuBD,QAAA;IACrB,IAAI,OAAOA,QAAA,KAAa,YAAY;MAClCA,QAAA;IACF;EACF;EACApB,kBAAA,EAAoB;AACtB;AAEA;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAO,MAAM2B,kBAAA,GAAqBA,CAAA,KAAMvC,KAAA,CAAMwC,GAAG,CAACJ,sBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderCell.d.ts","sourceRoot":"","sources":["../../../../src/providers/TableColumns/buildColumnState/renderCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EACV,WAAW,EACX,yBAAyB,EAEzB,QAAQ,EACR,KAAK,EACL,OAAO,EACP,cAAc,EACd,SAAS,EACV,MAAM,SAAS,CAAA;AAehB,KAAK,cAAc,GAAG;IACpB,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;IACjC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,eAAe,EAAE,yBAAyB,CAAC,iBAAiB,CAAC,CAAA;IACtE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAA;IACtB,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAA;IACrC,QAAQ,CAAC,IAAI,E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,QAAQ,CAAC,GAAG,CAAC,EAAE,cAAc,CAAA;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAA;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAC9B,CAAA;AACD,wBAAgB,UAAU,CAAC,EACzB,WAAW,EACX,cAAc,EACd,WAAW,EACX,eAAe,EACf,GAAG,EACH,mBAAmB,EACnB,IAAI,EACJ,cAAc,EACd,OAAO,EACP,GAAG,EACH,QAAQ,EACR,WAAW,EACX,QAAQ,GACT,EAAE,cAAc,+BAqLhB"}
|
|
@@ -41,8 +41,7 @@ export function renderCell({
|
|
|
41
41
|
const adminRoute = req.payload.config.routes?.admin || '/admin';
|
|
42
42
|
const defaultURL = formatAdminURL({
|
|
43
43
|
adminRoute,
|
|
44
|
-
path: `/collections/${collectionSlug}${viewType === 'trash' ? '/trash' : ''}/${encodeURIComponent(String(doc.id))}
|
|
45
|
-
serverURL: req.payload.config.serverURL
|
|
44
|
+
path: `/collections/${collectionSlug}${viewType === 'trash' ? '/trash' : ''}/${encodeURIComponent(String(doc.id))}`
|
|
46
45
|
});
|
|
47
46
|
const customURL = formatDocURL({
|
|
48
47
|
collectionSlug,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderCell.js","names":["MissingEditorProp","formatAdminURL","RenderCustomComponent","RenderServerComponent","DefaultCell","RenderDefaultCell","hasOptionLabelJSXElement","findValueFromPath","renderCell","clientField","collectionSlug","columnIndex","customCellProps","doc","enableRowSelections","i18n","isLinkedColumn","payload","req","rowIndex","serverField","viewType","baseCellClientProps","cellData","undefined","field","rowData","accessor","name","shouldLink","customLinkURL","collectionConfig","collections","config","formatDocURL","admin","adminRoute","routes","defaultURL","path","encodeURIComponent","String","id","serverURL","customURL","_displayStatus","enrichedClientField","type","hasChangedOption","options","some","opt","value","label","t","cellClientProps","link","linkURL","cellServerProps","className","onClick","CustomCell","editor","Error","components","clientProps","Component","CellComponent","importMap","serverProps","CustomCellComponent","Cell","_jsx","CustomComponent","Fallback"],"sources":["../../../../src/providers/TableColumns/buildColumnState/renderCell.tsx"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type {\n ClientField,\n DefaultCellComponentProps,\n DefaultServerCellComponentProps,\n Document,\n Field,\n Payload,\n PayloadRequest,\n ViewTypes,\n} from 'payload'\n\nimport { MissingEditorProp } from 'payload'\nimport { formatAdminURL } from 'payload/shared'\n\nimport { RenderCustomComponent } from '../../../elements/RenderCustomComponent/index.js'\nimport { RenderServerComponent } from '../../../elements/RenderServerComponent/index.js'\nimport {\n DefaultCell,\n RenderDefaultCell,\n // eslint-disable-next-line payload/no-imports-from-exports-dir -- MUST reference the exports dir: https://github.com/payloadcms/payload/issues/12002#issuecomment-2791493587\n} from '../../../exports/client/index.js'\nimport { hasOptionLabelJSXElement } from '../../../utilities/hasOptionLabelJSXElement.js'\nimport { findValueFromPath } from './findValueFromPath.js'\n\ntype RenderCellArgs = {\n readonly clientField: ClientField\n readonly collectionSlug: string\n readonly columnIndex: number\n readonly customCellProps: DefaultCellComponentProps['customCellProps']\n readonly doc: Document\n readonly enableRowSelections: boolean\n readonly i18n: I18nClient\n readonly isLinkedColumn: boolean\n readonly payload: Payload\n readonly req?: PayloadRequest\n readonly rowIndex: number\n readonly serverField: Field\n readonly viewType?: ViewTypes\n}\nexport function renderCell({\n clientField,\n collectionSlug,\n columnIndex,\n customCellProps,\n doc,\n enableRowSelections,\n i18n,\n isLinkedColumn,\n payload,\n req,\n rowIndex,\n serverField,\n viewType,\n}: RenderCellArgs) {\n const baseCellClientProps: DefaultCellComponentProps = {\n cellData: undefined,\n collectionSlug,\n customCellProps,\n field: clientField,\n rowData: undefined,\n viewType,\n }\n\n const accessor: string | undefined =\n ('accessor' in clientField ? (clientField.accessor as string) : undefined) ??\n ('name' in clientField ? clientField.name : undefined)\n\n // Check if there's a custom formatDocURL function for this linked column\n let shouldLink = isLinkedColumn\n let customLinkURL: string | undefined\n\n if (isLinkedColumn && req) {\n const collectionConfig = payload.collections[collectionSlug]?.config\n const formatDocURL = collectionConfig?.admin?.formatDocURL\n\n if (typeof formatDocURL === 'function') {\n // Generate the default URL that would normally be used\n const adminRoute = req.payload.config.routes?.admin || '/admin'\n const defaultURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}${viewType === 'trash' ? '/trash' : ''}/${encodeURIComponent(String(doc.id))}`,\n serverURL: req.payload.config.serverURL,\n })\n\n const customURL = formatDocURL({\n collectionSlug,\n defaultURL,\n doc,\n req,\n viewType,\n })\n\n if (customURL === null) {\n // formatDocURL returned null = disable linking entirely\n shouldLink = false\n } else if (typeof customURL === 'string') {\n // formatDocURL returned a string = use custom URL\n shouldLink = true\n customLinkURL = customURL\n } else {\n // formatDocURL returned unexpected type = disable linking for safety\n shouldLink = false\n }\n }\n }\n\n // For _status field, use _displayStatus if available (for showing \"changed\" status in list view)\n const cellData =\n 'name' in clientField && accessor === '_status' && '_displayStatus' in doc\n ? doc._displayStatus\n : 'name' in clientField\n ? findValueFromPath(doc, accessor)\n : undefined\n\n // For _status field, add 'changed' option for display purposes\n // The 'changed' status is computed at runtime\n let enrichedClientField = clientField\n if ('name' in clientField && accessor === '_status' && clientField.type === 'select') {\n const hasChangedOption = clientField.options?.some(\n (opt) => (typeof opt === 'object' ? opt.value : opt) === 'changed',\n )\n if (!hasChangedOption) {\n enrichedClientField = {\n ...clientField,\n options: [\n ...(clientField.options || []),\n {\n label: i18n.t('version:draftHasPublishedVersion'),\n value: 'changed',\n },\n ],\n }\n }\n }\n\n const cellClientProps: DefaultCellComponentProps = {\n ...baseCellClientProps,\n cellData,\n field: enrichedClientField,\n link: shouldLink,\n linkURL: customLinkURL,\n rowData: doc,\n }\n\n const cellServerProps: DefaultServerCellComponentProps = {\n cellData: cellClientProps.cellData,\n className: baseCellClientProps.className,\n collectionConfig: payload.collections[collectionSlug].config,\n collectionSlug,\n columnIndex,\n customCellProps: baseCellClientProps.customCellProps,\n field: serverField,\n i18n,\n link: shouldLink,\n linkURL: customLinkURL,\n onClick: baseCellClientProps.onClick,\n payload,\n rowData: doc,\n }\n\n let CustomCell = null\n\n if (serverField?.type === 'richText') {\n if (!serverField?.editor) {\n throw new MissingEditorProp(serverField) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n\n if (typeof serverField?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n if (!serverField.admin) {\n serverField.admin = {}\n }\n\n if (!serverField.admin.components) {\n serverField.admin.components = {}\n }\n\n CustomCell = RenderServerComponent({\n clientProps: cellClientProps,\n Component: serverField.editor.CellComponent,\n importMap: payload.importMap,\n serverProps: cellServerProps,\n })\n } else {\n const CustomCellComponent = serverField?.admin?.components?.Cell\n\n if (CustomCellComponent) {\n CustomCell = RenderServerComponent({\n clientProps: cellClientProps,\n Component: CustomCellComponent,\n importMap: payload.importMap,\n serverProps: cellServerProps,\n })\n } else if (\n cellClientProps.cellData &&\n cellClientProps.field &&\n hasOptionLabelJSXElement(cellClientProps)\n ) {\n CustomCell = RenderServerComponent({\n clientProps: cellClientProps,\n Component: DefaultCell,\n importMap: payload.importMap,\n })\n } else {\n const CustomCellComponent = serverField?.admin?.components?.Cell\n\n if (CustomCellComponent) {\n CustomCell = RenderServerComponent({\n clientProps: cellClientProps,\n Component: CustomCellComponent,\n importMap: payload.importMap,\n serverProps: cellServerProps,\n })\n } else {\n CustomCell = undefined\n }\n }\n }\n\n return (\n <RenderCustomComponent\n CustomComponent={CustomCell}\n Fallback={\n <RenderDefaultCell\n clientProps={cellClientProps}\n columnIndex={columnIndex}\n enableRowSelections={enableRowSelections}\n isLinkedColumn={isLinkedColumn}\n />\n }\n key={`${rowIndex}-${columnIndex}`}\n />\n )\n}\n"],"mappings":";AAYA,SAASA,iBAAiB,QAAQ;AAClC,SAASC,cAAc,QAAQ;AAE/B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,qB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,mBAAA;QACXF,SAAA,EAAWnD,OAAA,CAAQmD,SAAS;QAC5BC,WAAA,EAAaX;MACf;IACF,OAAO,IACLH,eAAA,CAAgBhC,QAAQ,IACxBgC,eAAA,CAAgB9B,KAAK,IACrBnB,wBAAA,CAAyBiD,eAAA,GACzB;MACAM,UAAA,GAAa1D,qBAAA,CAAsB;QACjC8D,WAAA,EAAaV,eAAA;QACbW,SAAA,EAAW9D,WAAA;QACXgE,SAAA,EAAWnD,OAAA,CAAQmD;MACrB;IACF,OAAO;MACL,MAAME,mBAAA,GAAsBlD,WAAA,EAAae,KAAA,EAAO6B,UAAA,EAAYO,IAAA;MAE5D,IAAID,mBAAA,EAAqB;QACvBT,UAAA,GAAa1D,qBAAA,CAAsB;UACjC8D,WAAA,EAAaV,eAAA;UACbW,SAAA,EAAWI,mBAAA;UACXF,SAAA,EAAWnD,OAAA,CAAQmD,SAAS;UAC5BC,WAAA,EAAaX;QACf;MACF,OAAO;QACLG,UAAA,GAAarC,SAAA;MACf;IACF;EACF;EAEA,oBACEgD,IAAA,CAACtE,qBAAA;IACCuE,eAAA,EAAiBZ,UAAA;IACjBa,QAAA,eACEF,IAAA,CAACnE,iBAAA;MACC4D,WAAA,EAAaV,eAAA;MACb5C,WAAA,EAAaA,WAAA;MACbG,mBAAA,EAAqBA,mBAAA;MACrBE,cAAA,EAAgBA;;KAGf,GAAGG,QAAA,IAAYR,WAAA,EAAa;AAGvC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"renderCell.js","names":["MissingEditorProp","formatAdminURL","RenderCustomComponent","RenderServerComponent","DefaultCell","RenderDefaultCell","hasOptionLabelJSXElement","findValueFromPath","renderCell","clientField","collectionSlug","columnIndex","customCellProps","doc","enableRowSelections","i18n","isLinkedColumn","payload","req","rowIndex","serverField","viewType","baseCellClientProps","cellData","undefined","field","rowData","accessor","name","shouldLink","customLinkURL","collectionConfig","collections","config","formatDocURL","admin","adminRoute","routes","defaultURL","path","encodeURIComponent","String","id","customURL","_displayStatus","enrichedClientField","type","hasChangedOption","options","some","opt","value","label","t","cellClientProps","link","linkURL","cellServerProps","className","onClick","CustomCell","editor","Error","components","clientProps","Component","CellComponent","importMap","serverProps","CustomCellComponent","Cell","_jsx","CustomComponent","Fallback"],"sources":["../../../../src/providers/TableColumns/buildColumnState/renderCell.tsx"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type {\n ClientField,\n DefaultCellComponentProps,\n DefaultServerCellComponentProps,\n Document,\n Field,\n Payload,\n PayloadRequest,\n ViewTypes,\n} from 'payload'\n\nimport { MissingEditorProp } from 'payload'\nimport { formatAdminURL } from 'payload/shared'\n\nimport { RenderCustomComponent } from '../../../elements/RenderCustomComponent/index.js'\nimport { RenderServerComponent } from '../../../elements/RenderServerComponent/index.js'\nimport {\n DefaultCell,\n RenderDefaultCell,\n // eslint-disable-next-line payload/no-imports-from-exports-dir -- MUST reference the exports dir: https://github.com/payloadcms/payload/issues/12002#issuecomment-2791493587\n} from '../../../exports/client/index.js'\nimport { hasOptionLabelJSXElement } from '../../../utilities/hasOptionLabelJSXElement.js'\nimport { findValueFromPath } from './findValueFromPath.js'\n\ntype RenderCellArgs = {\n readonly clientField: ClientField\n readonly collectionSlug: string\n readonly columnIndex: number\n readonly customCellProps: DefaultCellComponentProps['customCellProps']\n readonly doc: Document\n readonly enableRowSelections: boolean\n readonly i18n: I18nClient\n readonly isLinkedColumn: boolean\n readonly payload: Payload\n readonly req?: PayloadRequest\n readonly rowIndex: number\n readonly serverField: Field\n readonly viewType?: ViewTypes\n}\nexport function renderCell({\n clientField,\n collectionSlug,\n columnIndex,\n customCellProps,\n doc,\n enableRowSelections,\n i18n,\n isLinkedColumn,\n payload,\n req,\n rowIndex,\n serverField,\n viewType,\n}: RenderCellArgs) {\n const baseCellClientProps: DefaultCellComponentProps = {\n cellData: undefined,\n collectionSlug,\n customCellProps,\n field: clientField,\n rowData: undefined,\n viewType,\n }\n\n const accessor: string | undefined =\n ('accessor' in clientField ? (clientField.accessor as string) : undefined) ??\n ('name' in clientField ? clientField.name : undefined)\n\n // Check if there's a custom formatDocURL function for this linked column\n let shouldLink = isLinkedColumn\n let customLinkURL: string | undefined\n\n if (isLinkedColumn && req) {\n const collectionConfig = payload.collections[collectionSlug]?.config\n const formatDocURL = collectionConfig?.admin?.formatDocURL\n\n if (typeof formatDocURL === 'function') {\n // Generate the default URL that would normally be used\n const adminRoute = req.payload.config.routes?.admin || '/admin'\n const defaultURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}${viewType === 'trash' ? '/trash' : ''}/${encodeURIComponent(String(doc.id))}`,\n })\n\n const customURL = formatDocURL({\n collectionSlug,\n defaultURL,\n doc,\n req,\n viewType,\n })\n\n if (customURL === null) {\n // formatDocURL returned null = disable linking entirely\n shouldLink = false\n } else if (typeof customURL === 'string') {\n // formatDocURL returned a string = use custom URL\n shouldLink = true\n customLinkURL = customURL\n } else {\n // formatDocURL returned unexpected type = disable linking for safety\n shouldLink = false\n }\n }\n }\n\n // For _status field, use _displayStatus if available (for showing \"changed\" status in list view)\n const cellData =\n 'name' in clientField && accessor === '_status' && '_displayStatus' in doc\n ? doc._displayStatus\n : 'name' in clientField\n ? findValueFromPath(doc, accessor)\n : undefined\n\n // For _status field, add 'changed' option for display purposes\n // The 'changed' status is computed at runtime\n let enrichedClientField = clientField\n if ('name' in clientField && accessor === '_status' && clientField.type === 'select') {\n const hasChangedOption = clientField.options?.some(\n (opt) => (typeof opt === 'object' ? opt.value : opt) === 'changed',\n )\n if (!hasChangedOption) {\n enrichedClientField = {\n ...clientField,\n options: [\n ...(clientField.options || []),\n {\n label: i18n.t('version:draftHasPublishedVersion'),\n value: 'changed',\n },\n ],\n }\n }\n }\n\n const cellClientProps: DefaultCellComponentProps = {\n ...baseCellClientProps,\n cellData,\n field: enrichedClientField,\n link: shouldLink,\n linkURL: customLinkURL,\n rowData: doc,\n }\n\n const cellServerProps: DefaultServerCellComponentProps = {\n cellData: cellClientProps.cellData,\n className: baseCellClientProps.className,\n collectionConfig: payload.collections[collectionSlug].config,\n collectionSlug,\n columnIndex,\n customCellProps: baseCellClientProps.customCellProps,\n field: serverField,\n i18n,\n link: shouldLink,\n linkURL: customLinkURL,\n onClick: baseCellClientProps.onClick,\n payload,\n rowData: doc,\n }\n\n let CustomCell = null\n\n if (serverField?.type === 'richText') {\n if (!serverField?.editor) {\n throw new MissingEditorProp(serverField) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n\n if (typeof serverField?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n if (!serverField.admin) {\n serverField.admin = {}\n }\n\n if (!serverField.admin.components) {\n serverField.admin.components = {}\n }\n\n CustomCell = RenderServerComponent({\n clientProps: cellClientProps,\n Component: serverField.editor.CellComponent,\n importMap: payload.importMap,\n serverProps: cellServerProps,\n })\n } else {\n const CustomCellComponent = serverField?.admin?.components?.Cell\n\n if (CustomCellComponent) {\n CustomCell = RenderServerComponent({\n clientProps: cellClientProps,\n Component: CustomCellComponent,\n importMap: payload.importMap,\n serverProps: cellServerProps,\n })\n } else if (\n cellClientProps.cellData &&\n cellClientProps.field &&\n hasOptionLabelJSXElement(cellClientProps)\n ) {\n CustomCell = RenderServerComponent({\n clientProps: cellClientProps,\n Component: DefaultCell,\n importMap: payload.importMap,\n })\n } else {\n const CustomCellComponent = serverField?.admin?.components?.Cell\n\n if (CustomCellComponent) {\n CustomCell = RenderServerComponent({\n clientProps: cellClientProps,\n Component: CustomCellComponent,\n importMap: payload.importMap,\n serverProps: cellServerProps,\n })\n } else {\n CustomCell = undefined\n }\n }\n }\n\n return (\n <RenderCustomComponent\n CustomComponent={CustomCell}\n Fallback={\n <RenderDefaultCell\n clientProps={cellClientProps}\n columnIndex={columnIndex}\n enableRowSelections={enableRowSelections}\n isLinkedColumn={isLinkedColumn}\n />\n }\n key={`${rowIndex}-${columnIndex}`}\n />\n )\n}\n"],"mappings":";AAYA,SAASA,iBAAiB,QAAQ;AAClC,SAAS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F,SAAA,EAAWlD,OAAA,CAAQkD,SAAS;QAC5BC,WAAA,EAAaX;MACf;IACF,OAAO,IACLH,eAAA,CAAgB/B,QAAQ,IACxB+B,eAAA,CAAgB7B,KAAK,IACrBnB,wBAAA,CAAyBgD,eAAA,GACzB;MACAM,UAAA,GAAazD,qBAAA,CAAsB;QACjC6D,WAAA,EAAaV,eAAA;QACbW,SAAA,EAAW7D,WAAA;QACX+D,SAAA,EAAWlD,OAAA,CAAQkD;MACrB;IACF,OAAO;MACL,MAAME,mBAAA,GAAsBjD,WAAA,EAAae,KAAA,EAAO4B,UAAA,EAAYO,IAAA;MAE5D,IAAID,mBAAA,EAAqB;QACvBT,UAAA,GAAazD,qBAAA,CAAsB;UACjC6D,WAAA,EAAaV,eAAA;UACbW,SAAA,EAAWI,mBAAA;UACXF,SAAA,EAAWlD,OAAA,CAAQkD,SAAS;UAC5BC,WAAA,EAAaX;QACf;MACF,OAAO;QACLG,UAAA,GAAapC,SAAA;MACf;IACF;EACF;EAEA,oBACE+C,IAAA,CAACrE,qBAAA;IACCsE,eAAA,EAAiBZ,UAAA;IACjBa,QAAA,eACEF,IAAA,CAAClE,iBAAA;MACC2D,WAAA,EAAaV,eAAA;MACb3C,WAAA,EAAaA,WAAA;MACbG,mBAAA,EAAqBA,mBAAA;MACrBE,cAAA,EAAgBA;;KAGf,GAAGG,QAAA,IAAYR,WAAA,EAAa;AAGvC","ignoreList":[]}
|
package/dist/scss/app.scss
CHANGED
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
--style-radius-m: #{$style-radius-m};
|
|
32
32
|
--style-radius-l: #{$style-radius-l};
|
|
33
33
|
|
|
34
|
-
--z-popup
|
|
34
|
+
// --z-popup needs to be higher than --z-modal to ensure the popup is displayed when modal is open
|
|
35
|
+
--z-popup: 60;
|
|
35
36
|
--z-nav: 20;
|
|
36
37
|
--z-modal: 30;
|
|
37
38
|
--z-status: 40;
|
|
@@ -189,6 +190,18 @@
|
|
|
189
190
|
color: currentColor;
|
|
190
191
|
}
|
|
191
192
|
|
|
193
|
+
.sr-only {
|
|
194
|
+
position: absolute;
|
|
195
|
+
width: 1px;
|
|
196
|
+
height: 1px;
|
|
197
|
+
padding: 0;
|
|
198
|
+
margin: -1px;
|
|
199
|
+
overflow: hidden;
|
|
200
|
+
clip: rect(0, 0, 0, 0);
|
|
201
|
+
white-space: nowrap;
|
|
202
|
+
border-width: 0;
|
|
203
|
+
}
|
|
204
|
+
|
|
192
205
|
.payload__modal-item {
|
|
193
206
|
min-height: 100%;
|
|
194
207
|
background: transparent;
|