@payloadcms/next 3.68.0-internal-debug.e9b66ee → 3.68.0-internal.10bf491

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.
Files changed (398) hide show
  1. package/dist/auth/login.js +58 -52
  2. package/dist/auth/login.js.map +1 -1
  3. package/dist/auth/logout.js +44 -39
  4. package/dist/auth/logout.js.map +1 -1
  5. package/dist/auth/refresh.js +47 -45
  6. package/dist/auth/refresh.js.map +1 -1
  7. package/dist/cjs/withPayload.cjs +41 -65
  8. package/dist/cjs/withPayload.cjs.map +1 -1
  9. package/dist/config.js +0 -1
  10. package/dist/config.js.map +1 -1
  11. package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js +15 -9
  12. package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js.map +1 -1
  13. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js +72 -26
  14. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
  15. package/dist/elements/DocumentHeader/Tabs/Tab/index.js +54 -36
  16. package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
  17. package/dist/elements/DocumentHeader/Tabs/index.js +64 -42
  18. package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
  19. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js +24 -8
  20. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js.map +1 -1
  21. package/dist/elements/DocumentHeader/Tabs/tabs/index.js +69 -61
  22. package/dist/elements/DocumentHeader/Tabs/tabs/index.js.map +1 -1
  23. package/dist/elements/DocumentHeader/index.js +29 -11
  24. package/dist/elements/DocumentHeader/index.js.map +1 -1
  25. package/dist/elements/FormHeader/index.js +17 -10
  26. package/dist/elements/FormHeader/index.js.map +1 -1
  27. package/dist/elements/Logo/index.js +34 -19
  28. package/dist/elements/Logo/index.js.map +1 -1
  29. package/dist/elements/Nav/NavHamburger/index.js +45 -8
  30. package/dist/elements/Nav/NavHamburger/index.js.map +1 -1
  31. package/dist/elements/Nav/NavWrapper/index.js +55 -15
  32. package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
  33. package/dist/elements/Nav/SettingsMenuButton/index.js +40 -11
  34. package/dist/elements/Nav/SettingsMenuButton/index.js.map +1 -1
  35. package/dist/elements/Nav/getNavPrefs.js +22 -27
  36. package/dist/elements/Nav/getNavPrefs.js.map +1 -1
  37. package/dist/elements/Nav/index.client.js +111 -42
  38. package/dist/elements/Nav/index.client.js.map +1 -1
  39. package/dist/elements/Nav/index.js +121 -90
  40. package/dist/elements/Nav/index.js.map +1 -1
  41. package/dist/exports/auth.js +0 -1
  42. package/dist/exports/auth.js.map +1 -1
  43. package/dist/exports/client.js +1 -1
  44. package/dist/exports/client.js.map +1 -1
  45. package/dist/exports/layouts.js +0 -1
  46. package/dist/exports/layouts.js.map +1 -1
  47. package/dist/exports/routes.js +0 -1
  48. package/dist/exports/routes.js.map +1 -1
  49. package/dist/exports/rsc.js +0 -1
  50. package/dist/exports/rsc.js.map +1 -1
  51. package/dist/exports/templates.js +0 -1
  52. package/dist/exports/templates.js.map +1 -1
  53. package/dist/exports/utilities.js +12 -7
  54. package/dist/exports/utilities.js.map +1 -1
  55. package/dist/exports/views.js +0 -1
  56. package/dist/exports/views.js.map +1 -1
  57. package/dist/index.js +0 -1
  58. package/dist/index.js.map +1 -1
  59. package/dist/layouts/Root/NestProviders.js +21 -13
  60. package/dist/layouts/Root/NestProviders.js.map +1 -1
  61. package/dist/layouts/Root/checkDependencies.js +41 -49
  62. package/dist/layouts/Root/checkDependencies.js.map +1 -1
  63. package/dist/layouts/Root/index.js +104 -64
  64. package/dist/layouts/Root/index.js.map +1 -1
  65. package/dist/prod/styles.css +1 -5
  66. package/dist/routes/graphql/handler.js +122 -114
  67. package/dist/routes/graphql/handler.js.map +1 -1
  68. package/dist/routes/graphql/index.js +0 -1
  69. package/dist/routes/graphql/index.js.map +1 -1
  70. package/dist/routes/graphql/playground.js +23 -24
  71. package/dist/routes/graphql/playground.js.map +1 -1
  72. package/dist/routes/index.js +0 -1
  73. package/dist/routes/index.js.map +1 -1
  74. package/dist/routes/rest/index.js +19 -20
  75. package/dist/routes/rest/index.js.map +1 -1
  76. package/dist/routes/rest/og/image.js +72 -60
  77. package/dist/routes/rest/og/image.js.map +1 -1
  78. package/dist/routes/rest/og/index.js +55 -46
  79. package/dist/routes/rest/og/index.js.map +1 -1
  80. package/dist/templates/Default/NavHamburger/index.js +21 -4
  81. package/dist/templates/Default/NavHamburger/index.js.map +1 -1
  82. package/dist/templates/Default/Wrapper/index.js +45 -14
  83. package/dist/templates/Default/Wrapper/index.js.map +1 -1
  84. package/dist/templates/Default/index.js +133 -115
  85. package/dist/templates/Default/index.js.map +1 -1
  86. package/dist/templates/Minimal/index.js +18 -12
  87. package/dist/templates/Minimal/index.js.map +1 -1
  88. package/dist/utilities/getExistingAuthToken.js +2 -3
  89. package/dist/utilities/getExistingAuthToken.js.map +1 -1
  90. package/dist/utilities/getNextRequestI18n.js +13 -12
  91. package/dist/utilities/getNextRequestI18n.js.map +1 -1
  92. package/dist/utilities/getPayloadHMR.js +5 -5
  93. package/dist/utilities/getPayloadHMR.js.map +1 -1
  94. package/dist/utilities/getPreferences.js +22 -27
  95. package/dist/utilities/getPreferences.js.map +1 -1
  96. package/dist/utilities/getRequestLocale.js +14 -13
  97. package/dist/utilities/getRequestLocale.js.map +1 -1
  98. package/dist/utilities/getRequestTheme.js +19 -19
  99. package/dist/utilities/getRequestTheme.js.map +1 -1
  100. package/dist/utilities/getRouteWithoutAdmin.js +5 -3
  101. package/dist/utilities/getRouteWithoutAdmin.js.map +1 -1
  102. package/dist/utilities/getVisibleEntities.js +23 -12
  103. package/dist/utilities/getVisibleEntities.js.map +1 -1
  104. package/dist/utilities/handleAuthRedirect.js +36 -22
  105. package/dist/utilities/handleAuthRedirect.js.map +1 -1
  106. package/dist/utilities/handleServerFunctions.js +39 -32
  107. package/dist/utilities/handleServerFunctions.js.map +1 -1
  108. package/dist/utilities/initReq.js +96 -78
  109. package/dist/utilities/initReq.js.map +1 -1
  110. package/dist/utilities/isCustomAdminView.js +26 -22
  111. package/dist/utilities/isCustomAdminView.js.map +1 -1
  112. package/dist/utilities/isPublicAdminRoute.js +20 -26
  113. package/dist/utilities/isPublicAdminRoute.js.map +1 -1
  114. package/dist/utilities/meta.js +63 -68
  115. package/dist/utilities/meta.js.map +1 -1
  116. package/dist/utilities/selectiveCache.js +26 -25
  117. package/dist/utilities/selectiveCache.js.map +1 -1
  118. package/dist/utilities/setPayloadAuthCookie.js +22 -19
  119. package/dist/utilities/setPayloadAuthCookie.js.map +1 -1
  120. package/dist/utilities/slugify.js +33 -24
  121. package/dist/utilities/slugify.js.map +1 -1
  122. package/dist/utilities/timestamp.js +6 -7
  123. package/dist/utilities/timestamp.js.map +1 -1
  124. package/dist/views/API/LocaleSelector/index.js +39 -7
  125. package/dist/views/API/LocaleSelector/index.js.map +1 -1
  126. package/dist/views/API/RenderJSON/index.js +119 -67
  127. package/dist/views/API/RenderJSON/index.js.map +1 -1
  128. package/dist/views/API/index.client.js +184 -132
  129. package/dist/views/API/index.client.js.map +1 -1
  130. package/dist/views/API/index.js +3 -2
  131. package/dist/views/API/index.js.map +1 -1
  132. package/dist/views/API/metadata.js +23 -18
  133. package/dist/views/API/metadata.js.map +1 -1
  134. package/dist/views/Account/ResetPreferences/index.js +91 -47
  135. package/dist/views/Account/ResetPreferences/index.js.map +1 -1
  136. package/dist/views/Account/Settings/LanguageSelector.js +48 -7
  137. package/dist/views/Account/Settings/LanguageSelector.js.map +1 -1
  138. package/dist/views/Account/Settings/index.js +29 -17
  139. package/dist/views/Account/Settings/index.js.map +1 -1
  140. package/dist/views/Account/ToggleTheme/index.js +56 -28
  141. package/dist/views/Account/ToggleTheme/index.js.map +1 -1
  142. package/dist/views/Account/index.client.js +32 -16
  143. package/dist/views/Account/index.client.js.map +1 -1
  144. package/dist/views/Account/index.js +156 -87
  145. package/dist/views/Account/index.js.map +1 -1
  146. package/dist/views/Account/metadata.js +12 -8
  147. package/dist/views/Account/metadata.js.map +1 -1
  148. package/dist/views/BrowseByFolder/buildView.js +159 -130
  149. package/dist/views/BrowseByFolder/buildView.js.map +1 -1
  150. package/dist/views/BrowseByFolder/index.js +16 -16
  151. package/dist/views/BrowseByFolder/index.js.map +1 -1
  152. package/dist/views/BrowseByFolder/metadata.js +15 -13
  153. package/dist/views/BrowseByFolder/metadata.js.map +1 -1
  154. package/dist/views/CollectionFolders/buildView.js +144 -114
  155. package/dist/views/CollectionFolders/buildView.js.map +1 -1
  156. package/dist/views/CollectionFolders/index.js +16 -16
  157. package/dist/views/CollectionFolders/index.js.map +1 -1
  158. package/dist/views/CollectionFolders/metadata.js +21 -18
  159. package/dist/views/CollectionFolders/metadata.js.map +1 -1
  160. package/dist/views/CollectionFolders/renderFolderViewSlots.js +61 -58
  161. package/dist/views/CollectionFolders/renderFolderViewSlots.js.map +1 -1
  162. package/dist/views/CollectionTrash/index.js +17 -17
  163. package/dist/views/CollectionTrash/index.js.map +1 -1
  164. package/dist/views/CollectionTrash/metadata.js +21 -18
  165. package/dist/views/CollectionTrash/metadata.js.map +1 -1
  166. package/dist/views/CreateFirstUser/index.client.js +98 -56
  167. package/dist/views/CreateFirstUser/index.client.js.map +1 -1
  168. package/dist/views/CreateFirstUser/index.js +82 -57
  169. package/dist/views/CreateFirstUser/index.js.map +1 -1
  170. package/dist/views/CreateFirstUser/metadata.js +12 -8
  171. package/dist/views/CreateFirstUser/metadata.js.map +1 -1
  172. package/dist/views/Dashboard/Default/index.js +128 -77
  173. package/dist/views/Dashboard/Default/index.js.map +1 -1
  174. package/dist/views/Dashboard/index.js +90 -78
  175. package/dist/views/Dashboard/index.js.map +1 -1
  176. package/dist/views/Dashboard/metadata.js +14 -10
  177. package/dist/views/Dashboard/metadata.js.map +1 -1
  178. package/dist/views/Document/getCustomDocumentViewByKey.js +2 -3
  179. package/dist/views/Document/getCustomDocumentViewByKey.js.map +1 -1
  180. package/dist/views/Document/getCustomViewByRoute.js +30 -27
  181. package/dist/views/Document/getCustomViewByRoute.js.map +1 -1
  182. package/dist/views/Document/getDocPreferences.js +41 -40
  183. package/dist/views/Document/getDocPreferences.js.map +1 -1
  184. package/dist/views/Document/getDocumentData.js +55 -44
  185. package/dist/views/Document/getDocumentData.js.map +1 -1
  186. package/dist/views/Document/getDocumentPermissions.js +80 -77
  187. package/dist/views/Document/getDocumentPermissions.js.map +1 -1
  188. package/dist/views/Document/getDocumentView.js +283 -313
  189. package/dist/views/Document/getDocumentView.js.map +1 -1
  190. package/dist/views/Document/getIsLocked.js +66 -66
  191. package/dist/views/Document/getIsLocked.js.map +1 -1
  192. package/dist/views/Document/getMetaBySegment.js +136 -130
  193. package/dist/views/Document/getMetaBySegment.js.map +1 -1
  194. package/dist/views/Document/getVersions.js +194 -204
  195. package/dist/views/Document/getVersions.js.map +1 -1
  196. package/dist/views/Document/handleServerFunction.js +128 -103
  197. package/dist/views/Document/handleServerFunction.js.map +1 -1
  198. package/dist/views/Document/index.js +351 -250
  199. package/dist/views/Document/index.js.map +1 -1
  200. package/dist/views/Document/metadata.js +1 -2
  201. package/dist/views/Document/metadata.js.map +1 -1
  202. package/dist/views/Document/renderDocumentSlots.js +132 -121
  203. package/dist/views/Document/renderDocumentSlots.js.map +1 -1
  204. package/dist/views/Edit/index.js +7 -3
  205. package/dist/views/Edit/index.js.map +1 -1
  206. package/dist/views/Edit/metadata.js +46 -36
  207. package/dist/views/Edit/metadata.js.map +1 -1
  208. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +151 -70
  209. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
  210. package/dist/views/ForgotPassword/index.js +61 -26
  211. package/dist/views/ForgotPassword/index.js.map +1 -1
  212. package/dist/views/ForgotPassword/metadata.js +12 -8
  213. package/dist/views/ForgotPassword/metadata.js.map +1 -1
  214. package/dist/views/List/createSerializableValue.js +11 -12
  215. package/dist/views/List/createSerializableValue.js.map +1 -1
  216. package/dist/views/List/enrichDocsWithVersionStatus.js +86 -86
  217. package/dist/views/List/enrichDocsWithVersionStatus.js.map +1 -1
  218. package/dist/views/List/extractRelationshipDisplayValue.js +14 -15
  219. package/dist/views/List/extractRelationshipDisplayValue.js.map +1 -1
  220. package/dist/views/List/extractValueOrRelationshipID.js +15 -16
  221. package/dist/views/List/extractValueOrRelationshipID.js.map +1 -1
  222. package/dist/views/List/handleGroupBy.js +150 -133
  223. package/dist/views/List/handleGroupBy.js.map +1 -1
  224. package/dist/views/List/handleServerFunction.js +119 -96
  225. package/dist/views/List/handleServerFunction.js.map +1 -1
  226. package/dist/views/List/index.js +324 -284
  227. package/dist/views/List/index.js.map +1 -1
  228. package/dist/views/List/metadata.js +20 -17
  229. package/dist/views/List/metadata.js.map +1 -1
  230. package/dist/views/List/renderListViewSlots.js +75 -70
  231. package/dist/views/List/renderListViewSlots.js.map +1 -1
  232. package/dist/views/List/resolveAllFilterOptions.js +45 -43
  233. package/dist/views/List/resolveAllFilterOptions.js.map +1 -1
  234. package/dist/views/List/transformColumnsToSelect.js +8 -9
  235. package/dist/views/List/transformColumnsToSelect.js.map +1 -1
  236. package/dist/views/Login/LoginField/index.js +90 -32
  237. package/dist/views/Login/LoginField/index.js.map +1 -1
  238. package/dist/views/Login/LoginForm/index.js +156 -55
  239. package/dist/views/Login/LoginForm/index.js.map +1 -1
  240. package/dist/views/Login/index.js +86 -50
  241. package/dist/views/Login/index.js.map +1 -1
  242. package/dist/views/Login/metadata.js +12 -8
  243. package/dist/views/Login/metadata.js.map +1 -1
  244. package/dist/views/Logout/LogoutClient.js +119 -54
  245. package/dist/views/Logout/LogoutClient.js.map +1 -1
  246. package/dist/views/Logout/index.js +30 -8
  247. package/dist/views/Logout/index.js.map +1 -1
  248. package/dist/views/Logout/metadata.js +11 -7
  249. package/dist/views/Logout/metadata.js.map +1 -1
  250. package/dist/views/NotFound/index.client.js +83 -32
  251. package/dist/views/NotFound/index.client.js.map +1 -1
  252. package/dist/views/NotFound/index.js +73 -44
  253. package/dist/views/NotFound/index.js.map +1 -1
  254. package/dist/views/NotFound/metadata.js +9 -7
  255. package/dist/views/NotFound/metadata.js.map +1 -1
  256. package/dist/views/ResetPassword/ResetPasswordForm/index.js +107 -49
  257. package/dist/views/ResetPassword/ResetPasswordForm/index.js.map +1 -1
  258. package/dist/views/ResetPassword/index.js +72 -29
  259. package/dist/views/ResetPassword/index.js.map +1 -1
  260. package/dist/views/ResetPassword/metadata.js +12 -8
  261. package/dist/views/ResetPassword/metadata.js.map +1 -1
  262. package/dist/views/Root/attachViewActions.js +23 -18
  263. package/dist/views/Root/attachViewActions.js.map +1 -1
  264. package/dist/views/Root/generateCustomViewMetadata.js +21 -19
  265. package/dist/views/Root/generateCustomViewMetadata.js.map +1 -1
  266. package/dist/views/Root/getCustomViewByKey.js +14 -12
  267. package/dist/views/Root/getCustomViewByKey.js.map +1 -1
  268. package/dist/views/Root/getCustomViewByRoute.js +42 -31
  269. package/dist/views/Root/getCustomViewByRoute.js.map +1 -1
  270. package/dist/views/Root/getDocumentViewInfo.js +23 -24
  271. package/dist/views/Root/getDocumentViewInfo.js.map +1 -1
  272. package/dist/views/Root/getRouteData.js +325 -333
  273. package/dist/views/Root/getRouteData.js.map +1 -1
  274. package/dist/views/Root/index.js +265 -203
  275. package/dist/views/Root/index.js.map +1 -1
  276. package/dist/views/Root/isPathMatchingRoute.js +26 -21
  277. package/dist/views/Root/isPathMatchingRoute.js.map +1 -1
  278. package/dist/views/Root/metadata.js +181 -176
  279. package/dist/views/Root/metadata.js.map +1 -1
  280. package/dist/views/Unauthorized/index.js +45 -18
  281. package/dist/views/Unauthorized/index.js.map +1 -1
  282. package/dist/views/Unauthorized/metadata.js +12 -8
  283. package/dist/views/Unauthorized/metadata.js.map +1 -1
  284. package/dist/views/Verify/index.client.js +43 -25
  285. package/dist/views/Verify/index.client.js.map +1 -1
  286. package/dist/views/Verify/index.js +62 -31
  287. package/dist/views/Verify/index.js.map +1 -1
  288. package/dist/views/Verify/metadata.js +12 -8
  289. package/dist/views/Verify/metadata.js.map +1 -1
  290. package/dist/views/Version/Default/SelectedLocalesContext.js +4 -4
  291. package/dist/views/Version/Default/SelectedLocalesContext.js.map +1 -1
  292. package/dist/views/Version/Default/SetStepNav.js +127 -86
  293. package/dist/views/Version/Default/SetStepNav.js.map +1 -1
  294. package/dist/views/Version/Default/index.js +236 -174
  295. package/dist/views/Version/Default/index.js.map +1 -1
  296. package/dist/views/Version/Default/types.js +1 -2
  297. package/dist/views/Version/Default/types.js.map +1 -1
  298. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js +120 -54
  299. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js.map +1 -1
  300. package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js +74 -37
  301. package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js.map +1 -1
  302. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +408 -363
  303. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js.map +1 -1
  304. package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js +52 -12
  305. package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js.map +1 -1
  306. package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js +66 -21
  307. package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js.map +1 -1
  308. package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js +57 -15
  309. package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js.map +1 -1
  310. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +118 -55
  311. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
  312. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/generateLabelFromValue.js +41 -36
  313. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/generateLabelFromValue.js.map +1 -1
  314. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +179 -65
  315. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
  316. package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.js +12 -5
  317. package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.js.map +1 -1
  318. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +72 -34
  319. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
  320. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +139 -57
  321. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
  322. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +80 -42
  323. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
  324. package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.js +211 -103
  325. package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.js.map +1 -1
  326. package/dist/views/Version/RenderFieldsToDiff/fields/index.js +22 -23
  327. package/dist/views/Version/RenderFieldsToDiff/fields/index.js.map +1 -1
  328. package/dist/views/Version/RenderFieldsToDiff/index.js +9 -4
  329. package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
  330. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js +228 -213
  331. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js.map +1 -1
  332. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js +826 -1005
  333. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js.map +1 -1
  334. package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.js +1 -2
  335. package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.js.map +1 -1
  336. package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js +43 -44
  337. package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js.map +1 -1
  338. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.js +22 -25
  339. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.js.map +1 -1
  340. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js +36 -32
  341. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js.map +1 -1
  342. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js +129 -145
  343. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js.map +1 -1
  344. package/dist/views/Version/Restore/index.js +92 -77
  345. package/dist/views/Version/Restore/index.js.map +1 -1
  346. package/dist/views/Version/SelectComparison/VersionDrawer/CreatedAtCell.js +50 -25
  347. package/dist/views/Version/SelectComparison/VersionDrawer/CreatedAtCell.js.map +1 -1
  348. package/dist/views/Version/SelectComparison/VersionDrawer/index.js +227 -140
  349. package/dist/views/Version/SelectComparison/VersionDrawer/index.js.map +1 -1
  350. package/dist/views/Version/SelectComparison/index.js +51 -44
  351. package/dist/views/Version/SelectComparison/index.js.map +1 -1
  352. package/dist/views/Version/SelectComparison/types.js +1 -2
  353. package/dist/views/Version/SelectComparison/types.js.map +1 -1
  354. package/dist/views/Version/SelectLocales/index.js +30 -16
  355. package/dist/views/Version/SelectLocales/index.js.map +1 -1
  356. package/dist/views/Version/VersionPillLabel/VersionPillLabel.js +95 -37
  357. package/dist/views/Version/VersionPillLabel/VersionPillLabel.js.map +1 -1
  358. package/dist/views/Version/VersionPillLabel/getVersionLabel.js +27 -23
  359. package/dist/views/Version/VersionPillLabel/getVersionLabel.js.map +1 -1
  360. package/dist/views/Version/fetchVersions.js +138 -113
  361. package/dist/views/Version/fetchVersions.js.map +1 -1
  362. package/dist/views/Version/index.js +323 -283
  363. package/dist/views/Version/index.js.map +1 -1
  364. package/dist/views/Version/metadata.js +50 -43
  365. package/dist/views/Version/metadata.js.map +1 -1
  366. package/dist/views/Versions/buildColumns.js +80 -47
  367. package/dist/views/Versions/buildColumns.js.map +1 -1
  368. package/dist/views/Versions/cells/AutosaveCell/index.js +39 -8
  369. package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
  370. package/dist/views/Versions/cells/CreatedAt/index.js +54 -25
  371. package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
  372. package/dist/views/Versions/cells/ID/index.js +9 -4
  373. package/dist/views/Versions/cells/ID/index.js.map +1 -1
  374. package/dist/views/Versions/index.client.js +83 -28
  375. package/dist/views/Versions/index.client.js.map +1 -1
  376. package/dist/views/Versions/index.js +140 -94
  377. package/dist/views/Versions/index.js.map +1 -1
  378. package/dist/views/Versions/metadata.js +44 -37
  379. package/dist/views/Versions/metadata.js.map +1 -1
  380. package/dist/views/Versions/types.js +1 -2
  381. package/dist/views/Versions/types.js.map +1 -1
  382. package/dist/withPayload.d.ts +8 -2
  383. package/dist/withPayload.d.ts.map +1 -1
  384. package/dist/withPayload.js +145 -219
  385. package/dist/withPayload.js.map +1 -1
  386. package/dist/withPayload.utils.d.ts +58 -0
  387. package/dist/withPayload.utils.d.ts.map +1 -0
  388. package/dist/withPayload.utils.js +101 -0
  389. package/dist/withPayload.utils.js.map +1 -0
  390. package/dist/withPayloadLegacy.d.ts +6 -0
  391. package/dist/withPayloadLegacy.d.ts.map +1 -0
  392. package/dist/withPayloadLegacy.js +44 -0
  393. package/dist/withPayloadLegacy.js.map +1 -0
  394. package/package.json +15 -17
  395. package/dist/esbuildEntry.d.ts +0 -5
  396. package/dist/esbuildEntry.d.ts.map +0 -1
  397. package/dist/esbuildEntry.js +0 -6
  398. package/dist/esbuildEntry.js.map +0 -1
@@ -4,93 +4,93 @@
4
4
  * This function checks if draft documents also have a published version to determine "changed" status.
5
5
  *
6
6
  * Performance: Uses a single query to find all documents with "changed" status instead of N queries.
7
- */ export async function enrichDocsWithVersionStatus({ collectionConfig, data, req }) {
8
- const draftsEnabled = collectionConfig?.versions?.drafts;
9
- if (!draftsEnabled || !data?.docs?.length) {
10
- return data;
11
- }
12
- // Find all draft documents
13
- // When querying with draft:true, we get the latest draft if it exists
14
- // We need to check if these drafts have a published version
15
- const draftDocs = data.docs.filter((doc)=>doc._status === 'draft');
16
- if (draftDocs.length === 0) {
17
- return data;
18
- }
19
- const draftDocIds = draftDocs.map((doc)=>doc.id).filter(Boolean);
20
- if (draftDocIds.length === 0) {
21
- return data;
22
- }
23
- // OPTIMIZATION: Single query to find all document IDs that have BOTH:
24
- // 1. A draft version (latest=true, _status='draft')
25
- // 2. A published version (_status='published')
26
- // These are the documents with "changed" status
27
- try {
28
- // TODO: This could be more efficient with a findDistinctVersions() API:
29
- // const { values } = await req.payload.findDistinctVersions({
30
- // collection: collectionConfig.slug,
31
- // field: 'parent',
32
- // where: {
33
- // and: [
34
- // { parent: { in: draftDocIds } },
35
- // { 'version._status': { equals: 'published' } },
36
- // ],
37
- // },
38
- // })
39
- // const hasPublishedVersionSet = new Set(values)
40
- //
41
- // For now, we query all published versions but only select the 'parent' field
42
- // to minimize data transfer, then deduplicate with a Set
43
- const publishedVersions = await req.payload.findVersions({
44
- collection: collectionConfig.slug,
45
- depth: 0,
46
- limit: 0,
47
- pagination: false,
48
- select: {
49
- parent: true
50
- },
51
- where: {
52
- and: [
53
- {
54
- parent: {
55
- in: draftDocIds
56
- }
57
- },
58
- {
59
- 'version._status': {
60
- equals: 'published'
61
- }
62
- }
63
- ]
64
- }
65
- });
66
- // Create a Set of document IDs that have published versions
67
- const hasPublishedVersionSet = new Set(publishedVersions.docs.map((version)=>version.parent).filter(Boolean));
68
- // Enrich documents with display status
69
- const enrichedDocs = data.docs.map((doc)=>{
70
- // If it's a draft and has a published version, show "changed"
71
- if (doc._status === 'draft' && hasPublishedVersionSet.has(doc.id)) {
72
- return {
73
- ...doc,
74
- _displayStatus: 'changed'
75
- };
76
- }
77
- return {
78
- ...doc,
79
- _displayStatus: doc._status
80
- };
81
- });
7
+ */export async function enrichDocsWithVersionStatus({
8
+ collectionConfig,
9
+ data,
10
+ req
11
+ }) {
12
+ const draftsEnabled = collectionConfig?.versions?.drafts;
13
+ if (!draftsEnabled || !data?.docs?.length) {
14
+ return data;
15
+ }
16
+ // Find all draft documents
17
+ // When querying with draft:true, we get the latest draft if it exists
18
+ // We need to check if these drafts have a published version
19
+ const draftDocs = data.docs.filter(doc => doc._status === 'draft');
20
+ if (draftDocs.length === 0) {
21
+ return data;
22
+ }
23
+ const draftDocIds = draftDocs.map(doc => doc.id).filter(Boolean);
24
+ if (draftDocIds.length === 0) {
25
+ return data;
26
+ }
27
+ // OPTIMIZATION: Single query to find all document IDs that have BOTH:
28
+ // 1. A draft version (latest=true, _status='draft')
29
+ // 2. A published version (_status='published')
30
+ // These are the documents with "changed" status
31
+ try {
32
+ // TODO: This could be more efficient with a findDistinctVersions() API:
33
+ // const { values } = await req.payload.findDistinctVersions({
34
+ // collection: collectionConfig.slug,
35
+ // field: 'parent',
36
+ // where: {
37
+ // and: [
38
+ // { parent: { in: draftDocIds } },
39
+ // { 'version._status': { equals: 'published' } },
40
+ // ],
41
+ // },
42
+ // })
43
+ // const hasPublishedVersionSet = new Set(values)
44
+ //
45
+ // For now, we query all published versions but only select the 'parent' field
46
+ // to minimize data transfer, then deduplicate with a Set
47
+ const publishedVersions = await req.payload.findVersions({
48
+ collection: collectionConfig.slug,
49
+ depth: 0,
50
+ limit: 0,
51
+ pagination: false,
52
+ select: {
53
+ parent: true
54
+ },
55
+ where: {
56
+ and: [{
57
+ parent: {
58
+ in: draftDocIds
59
+ }
60
+ }, {
61
+ 'version._status': {
62
+ equals: 'published'
63
+ }
64
+ }]
65
+ }
66
+ });
67
+ // Create a Set of document IDs that have published versions
68
+ const hasPublishedVersionSet = new Set(publishedVersions.docs.map(version => version.parent).filter(Boolean));
69
+ // Enrich documents with display status
70
+ const enrichedDocs = data.docs.map(doc => {
71
+ // If it's a draft and has a published version, show "changed"
72
+ if (doc._status === 'draft' && hasPublishedVersionSet.has(doc.id)) {
82
73
  return {
83
- ...data,
84
- docs: enrichedDocs
74
+ ...doc,
75
+ _displayStatus: 'changed'
85
76
  };
86
- } catch (error) {
87
- // If there's an error querying versions, just return the original data
88
- req.payload.logger.error({
89
- err: error,
90
- msg: `Error checking version status for collection ${collectionConfig.slug}`
91
- });
92
- return data;
93
- }
77
+ }
78
+ return {
79
+ ...doc,
80
+ _displayStatus: doc._status
81
+ };
82
+ });
83
+ return {
84
+ ...data,
85
+ docs: enrichedDocs
86
+ };
87
+ } catch (error) {
88
+ // If there's an error querying versions, just return the original data
89
+ req.payload.logger.error({
90
+ err: error,
91
+ msg: `Error checking version status for collection ${collectionConfig.slug}`
92
+ });
93
+ return data;
94
+ }
94
95
  }
95
-
96
96
  //# sourceMappingURL=enrichDocsWithVersionStatus.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/views/List/enrichDocsWithVersionStatus.ts"],"sourcesContent":["import type { PaginatedDocs, PayloadRequest, SanitizedCollectionConfig } from 'payload'\n\n/**\n * Enriches list view documents with correct draft status display.\n * When draft=true is used in the query, Payload returns the latest draft version if it exists.\n * This function checks if draft documents also have a published version to determine \"changed\" status.\n *\n * Performance: Uses a single query to find all documents with \"changed\" status instead of N queries.\n */\nexport async function enrichDocsWithVersionStatus({\n collectionConfig,\n data,\n req,\n}: {\n collectionConfig: SanitizedCollectionConfig\n data: PaginatedDocs\n req: PayloadRequest\n}): Promise<PaginatedDocs> {\n const draftsEnabled = collectionConfig?.versions?.drafts\n\n if (!draftsEnabled || !data?.docs?.length) {\n return data\n }\n\n // Find all draft documents\n // When querying with draft:true, we get the latest draft if it exists\n // We need to check if these drafts have a published version\n const draftDocs = data.docs.filter((doc) => doc._status === 'draft')\n\n if (draftDocs.length === 0) {\n return data\n }\n\n const draftDocIds = draftDocs.map((doc) => doc.id).filter(Boolean)\n\n if (draftDocIds.length === 0) {\n return data\n }\n\n // OPTIMIZATION: Single query to find all document IDs that have BOTH:\n // 1. A draft version (latest=true, _status='draft')\n // 2. A published version (_status='published')\n // These are the documents with \"changed\" status\n try {\n // TODO: This could be more efficient with a findDistinctVersions() API:\n // const { values } = await req.payload.findDistinctVersions({\n // collection: collectionConfig.slug,\n // field: 'parent',\n // where: {\n // and: [\n // { parent: { in: draftDocIds } },\n // { 'version._status': { equals: 'published' } },\n // ],\n // },\n // })\n // const hasPublishedVersionSet = new Set(values)\n //\n // For now, we query all published versions but only select the 'parent' field\n // to minimize data transfer, then deduplicate with a Set\n const publishedVersions = await req.payload.findVersions({\n collection: collectionConfig.slug,\n depth: 0,\n limit: 0,\n pagination: false,\n select: {\n parent: true,\n },\n where: {\n and: [\n {\n parent: {\n in: draftDocIds,\n },\n },\n {\n 'version._status': {\n equals: 'published',\n },\n },\n ],\n },\n })\n\n // Create a Set of document IDs that have published versions\n const hasPublishedVersionSet = new Set(\n publishedVersions.docs.map((version) => version.parent).filter(Boolean),\n )\n\n // Enrich documents with display status\n const enrichedDocs = data.docs.map((doc) => {\n // If it's a draft and has a published version, show \"changed\"\n if (doc._status === 'draft' && hasPublishedVersionSet.has(doc.id)) {\n return {\n ...doc,\n _displayStatus: 'changed' as const,\n }\n }\n\n return {\n ...doc,\n _displayStatus: doc._status as 'draft' | 'published',\n }\n })\n\n return {\n ...data,\n docs: enrichedDocs,\n }\n } catch (error) {\n // If there's an error querying versions, just return the original data\n req.payload.logger.error({\n err: error,\n msg: `Error checking version status for collection ${collectionConfig.slug}`,\n })\n return data\n }\n}\n"],"names":["enrichDocsWithVersionStatus","collectionConfig","data","req","draftsEnabled","versions","drafts","docs","length","draftDocs","filter","doc","_status","draftDocIds","map","id","Boolean","publishedVersions","payload","findVersions","collection","slug","depth","limit","pagination","select","parent","where","and","in","equals","hasPublishedVersionSet","Set","version","enrichedDocs","has","_displayStatus","error","logger","err","msg"],"mappings":"AAEA;;;;;;CAMC,GACD,OAAO,eAAeA,4BAA4B,EAChDC,gBAAgB,EAChBC,IAAI,EACJC,GAAG,EAKJ;IACC,MAAMC,gBAAgBH,kBAAkBI,UAAUC;IAElD,IAAI,CAACF,iBAAiB,CAACF,MAAMK,MAAMC,QAAQ;QACzC,OAAON;IACT;IAEA,2BAA2B;IAC3B,sEAAsE;IACtE,4DAA4D;IAC5D,MAAMO,YAAYP,KAAKK,IAAI,CAACG,MAAM,CAAC,CAACC,MAAQA,IAAIC,OAAO,KAAK;IAE5D,IAAIH,UAAUD,MAAM,KAAK,GAAG;QAC1B,OAAON;IACT;IAEA,MAAMW,cAAcJ,UAAUK,GAAG,CAAC,CAACH,MAAQA,IAAII,EAAE,EAAEL,MAAM,CAACM;IAE1D,IAAIH,YAAYL,MAAM,KAAK,GAAG;QAC5B,OAAON;IACT;IAEA,sEAAsE;IACtE,oDAAoD;IACpD,+CAA+C;IAC/C,gDAAgD;IAChD,IAAI;QACF,wEAAwE;QACxE,8DAA8D;QAC9D,uCAAuC;QACvC,qBAAqB;QACrB,aAAa;QACb,aAAa;QACb,yCAAyC;QACzC,wDAAwD;QACxD,SAAS;QACT,OAAO;QACP,KAAK;QACL,iDAAiD;QACjD,EAAE;QACF,8EAA8E;QAC9E,yDAAyD;QACzD,MAAMe,oBAAoB,MAAMd,IAAIe,OAAO,CAACC,YAAY,CAAC;YACvDC,YAAYnB,iBAAiBoB,IAAI;YACjCC,OAAO;YACPC,OAAO;YACPC,YAAY;YACZC,QAAQ;gBACNC,QAAQ;YACV;YACAC,OAAO;gBACLC,KAAK;oBACH;wBACEF,QAAQ;4BACNG,IAAIhB;wBACN;oBACF;oBACA;wBACE,mBAAmB;4BACjBiB,QAAQ;wBACV;oBACF;iBACD;YACH;QACF;QAEA,4DAA4D;QAC5D,MAAMC,yBAAyB,IAAIC,IACjCf,kBAAkBV,IAAI,CAACO,GAAG,CAAC,CAACmB,UAAYA,QAAQP,MAAM,EAAEhB,MAAM,CAACM;QAGjE,uCAAuC;QACvC,MAAMkB,eAAehC,KAAKK,IAAI,CAACO,GAAG,CAAC,CAACH;YAClC,8DAA8D;YAC9D,IAAIA,IAAIC,OAAO,KAAK,WAAWmB,uBAAuBI,GAAG,CAACxB,IAAII,EAAE,GAAG;gBACjE,OAAO;oBACL,GAAGJ,GAAG;oBACNyB,gBAAgB;gBAClB;YACF;YAEA,OAAO;gBACL,GAAGzB,GAAG;gBACNyB,gBAAgBzB,IAAIC,OAAO;YAC7B;QACF;QAEA,OAAO;YACL,GAAGV,IAAI;YACPK,MAAM2B;QACR;IACF,EAAE,OAAOG,OAAO;QACd,uEAAuE;QACvElC,IAAIe,OAAO,CAACoB,MAAM,CAACD,KAAK,CAAC;YACvBE,KAAKF;YACLG,KAAK,CAAC,6CAA6C,EAAEvC,iBAAiBoB,IAAI,EAAE;QAC9E;QACA,OAAOnB;IACT;AACF"}
1
+ {"version":3,"file":"enrichDocsWithVersionStatus.js","names":["enrichDocsWithVersionStatus","collectionConfig","data","req","draftsEnabled","versions","drafts","docs","length","draftDocs","filter","doc","_status","draftDocIds","map","id","Boolean","publishedVersions","payload","findVersions","collection","slug","depth","limit","pagination","select","parent","where","and","in","equals","hasPublishedVersionSet","Set","version","enrichedDocs","has","_displayStatus","error","logger","err","msg"],"sources":["../../../src/views/List/enrichDocsWithVersionStatus.ts"],"sourcesContent":["import type { PaginatedDocs, PayloadRequest, SanitizedCollectionConfig } from 'payload'\n\n/**\n * Enriches list view documents with correct draft status display.\n * When draft=true is used in the query, Payload returns the latest draft version if it exists.\n * This function checks if draft documents also have a published version to determine \"changed\" status.\n *\n * Performance: Uses a single query to find all documents with \"changed\" status instead of N queries.\n */\nexport async function enrichDocsWithVersionStatus({\n collectionConfig,\n data,\n req,\n}: {\n collectionConfig: SanitizedCollectionConfig\n data: PaginatedDocs\n req: PayloadRequest\n}): Promise<PaginatedDocs> {\n const draftsEnabled = collectionConfig?.versions?.drafts\n\n if (!draftsEnabled || !data?.docs?.length) {\n return data\n }\n\n // Find all draft documents\n // When querying with draft:true, we get the latest draft if it exists\n // We need to check if these drafts have a published version\n const draftDocs = data.docs.filter((doc) => doc._status === 'draft')\n\n if (draftDocs.length === 0) {\n return data\n }\n\n const draftDocIds = draftDocs.map((doc) => doc.id).filter(Boolean)\n\n if (draftDocIds.length === 0) {\n return data\n }\n\n // OPTIMIZATION: Single query to find all document IDs that have BOTH:\n // 1. A draft version (latest=true, _status='draft')\n // 2. A published version (_status='published')\n // These are the documents with \"changed\" status\n try {\n // TODO: This could be more efficient with a findDistinctVersions() API:\n // const { values } = await req.payload.findDistinctVersions({\n // collection: collectionConfig.slug,\n // field: 'parent',\n // where: {\n // and: [\n // { parent: { in: draftDocIds } },\n // { 'version._status': { equals: 'published' } },\n // ],\n // },\n // })\n // const hasPublishedVersionSet = new Set(values)\n //\n // For now, we query all published versions but only select the 'parent' field\n // to minimize data transfer, then deduplicate with a Set\n const publishedVersions = await req.payload.findVersions({\n collection: collectionConfig.slug,\n depth: 0,\n limit: 0,\n pagination: false,\n select: {\n parent: true,\n },\n where: {\n and: [\n {\n parent: {\n in: draftDocIds,\n },\n },\n {\n 'version._status': {\n equals: 'published',\n },\n },\n ],\n },\n })\n\n // Create a Set of document IDs that have published versions\n const hasPublishedVersionSet = new Set(\n publishedVersions.docs.map((version) => version.parent).filter(Boolean),\n )\n\n // Enrich documents with display status\n const enrichedDocs = data.docs.map((doc) => {\n // If it's a draft and has a published version, show \"changed\"\n if (doc._status === 'draft' && hasPublishedVersionSet.has(doc.id)) {\n return {\n ...doc,\n _displayStatus: 'changed' as const,\n }\n }\n\n return {\n ...doc,\n _displayStatus: doc._status as 'draft' | 'published',\n }\n })\n\n return {\n ...data,\n docs: enrichedDocs,\n }\n } catch (error) {\n // If there's an error querying versions, just return the original data\n req.payload.logger.error({\n err: error,\n msg: `Error checking version status for collection ${collectionConfig.slug}`,\n })\n return data\n }\n}\n"],"mappings":"AAEA;;;;;;GAOA,OAAO,eAAeA,4BAA4B;EAChDC,gBAAgB;EAChBC,IAAI;EACJC;AAAG,CAKJ;EACC,MAAMC,aAAA,GAAgBH,gBAAA,EAAkBI,QAAA,EAAUC,MAAA;EAElD,IAAI,CAACF,aAAA,IAAiB,CAACF,IAAA,EAAMK,IAAA,EAAMC,MAAA,EAAQ;IACzC,OAAON,IAAA;EACT;EAEA;EACA;EACA;EACA,MAAMO,SAAA,GAAYP,IAAA,CAAKK,IAAI,CAACG,MAAM,CAAEC,GAAA,IAAQA,GAAA,CAAIC,OAAO,KAAK;EAE5D,IAAIH,SAAA,CAAUD,MAAM,KAAK,GAAG;IAC1B,OAAON,IAAA;EACT;EAEA,MAAMW,WAAA,GAAcJ,SAAA,CAAUK,GAAG,CAAEH,GAAA,IAAQA,GAAA,CAAII,EAAE,EAAEL,MAAM,CAACM,OAAA;EAE1D,IAAIH,WAAA,CAAYL,MAAM,KAAK,GAAG;IAC5B,OAAON,IAAA;EACT;EAEA;EACA;EACA;EACA;EACA,IAAI;IACF;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,MAAMe,iBAAA,GAAoB,MAAMd,GAAA,CAAIe,OAAO,CAACC,YAAY,CAAC;MACvDC,UAAA,EAAYnB,gBAAA,CAAiBoB,IAAI;MACjCC,KAAA,EAAO;MACPC,KAAA,EAAO;MACPC,UAAA,EAAY;MACZC,MAAA,EAAQ;QACNC,MAAA,EAAQ;MACV;MACAC,KAAA,EAAO;QACLC,GAAA,EAAK,CACH;UACEF,MAAA,EAAQ;YACNG,EAAA,EAAIhB;UACN;QACF,GACA;UACE,mBAAmB;YACjBiB,MAAA,EAAQ;UACV;QACF;MAEJ;IACF;IAEA;IACA,MAAMC,sBAAA,GAAyB,IAAIC,GAAA,CACjCf,iBAAA,CAAkBV,IAAI,CAACO,GAAG,CAAEmB,OAAA,IAAYA,OAAA,CAAQP,MAAM,EAAEhB,MAAM,CAACM,OAAA;IAGjE;IACA,MAAMkB,YAAA,GAAehC,IAAA,CAAKK,IAAI,CAACO,GAAG,CAAEH,GAAA;MAClC;MACA,IAAIA,GAAA,CAAIC,OAAO,KAAK,WAAWmB,sBAAA,CAAuBI,GAAG,CAACxB,GAAA,CAAII,EAAE,GAAG;QACjE,OAAO;UACL,GAAGJ,GAAG;UACNyB,cAAA,EAAgB;QAClB;MACF;MAEA,OAAO;QACL,GAAGzB,GAAG;QACNyB,cAAA,EAAgBzB,GAAA,CAAIC;MACtB;IACF;IAEA,OAAO;MACL,GAAGV,IAAI;MACPK,IAAA,EAAM2B;IACR;EACF,EAAE,OAAOG,KAAA,EAAO;IACd;IACAlC,GAAA,CAAIe,OAAO,CAACoB,MAAM,CAACD,KAAK,CAAC;MACvBE,GAAA,EAAKF,KAAA;MACLG,GAAA,EAAK,gDAAgDvC,gBAAA,CAAiBoB,IAAI;IAC5E;IACA,OAAOnB,IAAA;EACT;AACF","ignoreList":[]}
@@ -1,18 +1,17 @@
1
1
  // Helper function to extract display value from relationship
2
- export const extractRelationshipDisplayValue = (relationship, clientConfig, relationshipConfig)=>{
3
- if (!relationship) {
4
- return '';
5
- }
6
- // Handle polymorphic relationships
7
- if (typeof relationship === 'object' && relationship?.relationTo && relationship?.value) {
8
- const config = clientConfig.collections.find((c)=>c.slug === relationship.relationTo);
9
- return relationship.value?.[config?.admin?.useAsTitle || 'id'] || '';
10
- }
11
- // Handle regular relationships
12
- if (typeof relationship === 'object' && relationship?.id) {
13
- return relationship[relationshipConfig?.admin?.useAsTitle || 'id'] || '';
14
- }
15
- return String(relationship);
2
+ export const extractRelationshipDisplayValue = (relationship, clientConfig, relationshipConfig) => {
3
+ if (!relationship) {
4
+ return '';
5
+ }
6
+ // Handle polymorphic relationships
7
+ if (typeof relationship === 'object' && relationship?.relationTo && relationship?.value) {
8
+ const config = clientConfig.collections.find(c => c.slug === relationship.relationTo);
9
+ return relationship.value?.[config?.admin?.useAsTitle || 'id'] || '';
10
+ }
11
+ // Handle regular relationships
12
+ if (typeof relationship === 'object' && relationship?.id) {
13
+ return relationship[relationshipConfig?.admin?.useAsTitle || 'id'] || '';
14
+ }
15
+ return String(relationship);
16
16
  };
17
-
18
17
  //# sourceMappingURL=extractRelationshipDisplayValue.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/views/List/extractRelationshipDisplayValue.ts"],"sourcesContent":["import type { ClientCollectionConfig, ClientConfig } from 'payload'\n\n// Helper function to extract display value from relationship\nexport const extractRelationshipDisplayValue = (\n relationship: any,\n clientConfig: ClientConfig,\n relationshipConfig?: ClientCollectionConfig,\n): string => {\n if (!relationship) {\n return ''\n }\n\n // Handle polymorphic relationships\n if (typeof relationship === 'object' && relationship?.relationTo && relationship?.value) {\n const config = clientConfig.collections.find((c) => c.slug === relationship.relationTo)\n return relationship.value?.[config?.admin?.useAsTitle || 'id'] || ''\n }\n\n // Handle regular relationships\n if (typeof relationship === 'object' && relationship?.id) {\n return relationship[relationshipConfig?.admin?.useAsTitle || 'id'] || ''\n }\n\n return String(relationship)\n}\n"],"names":["extractRelationshipDisplayValue","relationship","clientConfig","relationshipConfig","relationTo","value","config","collections","find","c","slug","admin","useAsTitle","id","String"],"mappings":"AAEA,6DAA6D;AAC7D,OAAO,MAAMA,kCAAkC,CAC7CC,cACAC,cACAC;IAEA,IAAI,CAACF,cAAc;QACjB,OAAO;IACT;IAEA,mCAAmC;IACnC,IAAI,OAAOA,iBAAiB,YAAYA,cAAcG,cAAcH,cAAcI,OAAO;QACvF,MAAMC,SAASJ,aAAaK,WAAW,CAACC,IAAI,CAAC,CAACC,IAAMA,EAAEC,IAAI,KAAKT,aAAaG,UAAU;QACtF,OAAOH,aAAaI,KAAK,EAAE,CAACC,QAAQK,OAAOC,cAAc,KAAK,IAAI;IACpE;IAEA,+BAA+B;IAC/B,IAAI,OAAOX,iBAAiB,YAAYA,cAAcY,IAAI;QACxD,OAAOZ,YAAY,CAACE,oBAAoBQ,OAAOC,cAAc,KAAK,IAAI;IACxE;IAEA,OAAOE,OAAOb;AAChB,EAAC"}
1
+ {"version":3,"file":"extractRelationshipDisplayValue.js","names":["extractRelationshipDisplayValue","relationship","clientConfig","relationshipConfig","relationTo","value","config","collections","find","c","slug","admin","useAsTitle","id","String"],"sources":["../../../src/views/List/extractRelationshipDisplayValue.ts"],"sourcesContent":["import type { ClientCollectionConfig, ClientConfig } from 'payload'\n\n// Helper function to extract display value from relationship\nexport const extractRelationshipDisplayValue = (\n relationship: any,\n clientConfig: ClientConfig,\n relationshipConfig?: ClientCollectionConfig,\n): string => {\n if (!relationship) {\n return ''\n }\n\n // Handle polymorphic relationships\n if (typeof relationship === 'object' && relationship?.relationTo && relationship?.value) {\n const config = clientConfig.collections.find((c) => c.slug === relationship.relationTo)\n return relationship.value?.[config?.admin?.useAsTitle || 'id'] || ''\n }\n\n // Handle regular relationships\n if (typeof relationship === 'object' && relationship?.id) {\n return relationship[relationshipConfig?.admin?.useAsTitle || 'id'] || ''\n }\n\n return String(relationship)\n}\n"],"mappings":"AAEA;AACA,OAAO,MAAMA,+BAAA,GAAkCA,CAC7CC,YAAA,EACAC,YAAA,EACAC,kBAAA;EAEA,IAAI,CAACF,YAAA,EAAc;IACjB,OAAO;EACT;EAEA;EACA,IAAI,OAAOA,YAAA,KAAiB,YAAYA,YAAA,EAAcG,UAAA,IAAcH,YAAA,EAAcI,KAAA,EAAO;IACvF,MAAMC,MAAA,GAASJ,YAAA,CAAaK,WAAW,CAACC,IAAI,CAAEC,CAAA,IAAMA,CAAA,CAAEC,IAAI,KAAKT,YAAA,CAAaG,UAAU;IACtF,OAAOH,YAAA,CAAaI,KAAK,GAAGC,MAAA,EAAQK,KAAA,EAAOC,UAAA,IAAc,KAAK,IAAI;EACpE;EAEA;EACA,IAAI,OAAOX,YAAA,KAAiB,YAAYA,YAAA,EAAcY,EAAA,EAAI;IACxD,OAAOZ,YAAY,CAACE,kBAAA,EAAoBQ,KAAA,EAAOC,UAAA,IAAc,KAAK,IAAI;EACxE;EAEA,OAAOE,MAAA,CAAOb,YAAA;AAChB","ignoreList":[]}
@@ -1,20 +1,19 @@
1
1
  // Helper function to extract value or relationship ID for database queries
2
- export const extractValueOrRelationshipID = (relationship)=>{
3
- if (!relationship || typeof relationship !== 'object') {
4
- return relationship;
5
- }
6
- // For polymorphic relationships, preserve structure but ensure IDs are strings
7
- if (relationship?.relationTo && relationship?.value) {
8
- return {
9
- relationTo: relationship.relationTo,
10
- value: String(relationship.value?.id || relationship.value)
11
- };
12
- }
13
- // For regular relationships, extract ID
14
- if (relationship?.id) {
15
- return String(relationship.id);
16
- }
2
+ export const extractValueOrRelationshipID = relationship => {
3
+ if (!relationship || typeof relationship !== 'object') {
17
4
  return relationship;
5
+ }
6
+ // For polymorphic relationships, preserve structure but ensure IDs are strings
7
+ if (relationship?.relationTo && relationship?.value) {
8
+ return {
9
+ relationTo: relationship.relationTo,
10
+ value: String(relationship.value?.id || relationship.value)
11
+ };
12
+ }
13
+ // For regular relationships, extract ID
14
+ if (relationship?.id) {
15
+ return String(relationship.id);
16
+ }
17
+ return relationship;
18
18
  };
19
-
20
19
  //# sourceMappingURL=extractValueOrRelationshipID.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/views/List/extractValueOrRelationshipID.ts"],"sourcesContent":["// Helper function to extract value or relationship ID for database queries\nexport const extractValueOrRelationshipID = (relationship: any): any => {\n if (!relationship || typeof relationship !== 'object') {\n return relationship\n }\n\n // For polymorphic relationships, preserve structure but ensure IDs are strings\n if (relationship?.relationTo && relationship?.value) {\n return {\n relationTo: relationship.relationTo,\n value: String(relationship.value?.id || relationship.value),\n }\n }\n\n // For regular relationships, extract ID\n if (relationship?.id) {\n return String(relationship.id)\n }\n\n return relationship\n}\n"],"names":["extractValueOrRelationshipID","relationship","relationTo","value","String","id"],"mappings":"AAAA,2EAA2E;AAC3E,OAAO,MAAMA,+BAA+B,CAACC;IAC3C,IAAI,CAACA,gBAAgB,OAAOA,iBAAiB,UAAU;QACrD,OAAOA;IACT;IAEA,+EAA+E;IAC/E,IAAIA,cAAcC,cAAcD,cAAcE,OAAO;QACnD,OAAO;YACLD,YAAYD,aAAaC,UAAU;YACnCC,OAAOC,OAAOH,aAAaE,KAAK,EAAEE,MAAMJ,aAAaE,KAAK;QAC5D;IACF;IAEA,wCAAwC;IACxC,IAAIF,cAAcI,IAAI;QACpB,OAAOD,OAAOH,aAAaI,EAAE;IAC/B;IAEA,OAAOJ;AACT,EAAC"}
1
+ {"version":3,"file":"extractValueOrRelationshipID.js","names":["extractValueOrRelationshipID","relationship","relationTo","value","String","id"],"sources":["../../../src/views/List/extractValueOrRelationshipID.ts"],"sourcesContent":["// Helper function to extract value or relationship ID for database queries\nexport const extractValueOrRelationshipID = (relationship: any): any => {\n if (!relationship || typeof relationship !== 'object') {\n return relationship\n }\n\n // For polymorphic relationships, preserve structure but ensure IDs are strings\n if (relationship?.relationTo && relationship?.value) {\n return {\n relationTo: relationship.relationTo,\n value: String(relationship.value?.id || relationship.value),\n }\n }\n\n // For regular relationships, extract ID\n if (relationship?.id) {\n return String(relationship.id)\n }\n\n return relationship\n}\n"],"mappings":"AAAA;AACA,OAAO,MAAMA,4BAAA,GAAgCC,YAAA;EAC3C,IAAI,CAACA,YAAA,IAAgB,OAAOA,YAAA,KAAiB,UAAU;IACrD,OAAOA,YAAA;EACT;EAEA;EACA,IAAIA,YAAA,EAAcC,UAAA,IAAcD,YAAA,EAAcE,KAAA,EAAO;IACnD,OAAO;MACLD,UAAA,EAAYD,YAAA,CAAaC,UAAU;MACnCC,KAAA,EAAOC,MAAA,CAAOH,YAAA,CAAaE,KAAK,EAAEE,EAAA,IAAMJ,YAAA,CAAaE,KAAK;IAC5D;EACF;EAEA;EACA,IAAIF,YAAA,EAAcI,EAAA,EAAI;IACpB,OAAOD,MAAA,CAAOH,YAAA,CAAaI,EAAE;EAC/B;EAEA,OAAOJ,YAAA;AACT","ignoreList":[]}
@@ -4,140 +4,157 @@ import { flattenAllFields } from 'payload';
4
4
  import { createSerializableValue } from './createSerializableValue.js';
5
5
  import { extractRelationshipDisplayValue } from './extractRelationshipDisplayValue.js';
6
6
  import { extractValueOrRelationshipID } from './extractValueOrRelationshipID.js';
7
- export const handleGroupBy = async ({ clientCollectionConfig, clientConfig, collectionConfig, collectionSlug, columns, customCellProps, drawerSlug, enableRowSelections, fieldPermissions, query, req, select, trash = false, user, viewType, where: whereWithMergedSearch })=>{
8
- let Table = null;
9
- let columnState;
10
- const dataByGroup = {};
11
- // NOTE: is there a faster/better way to do this?
12
- const flattenedFields = flattenAllFields({
13
- fields: collectionConfig.fields
7
+ export const handleGroupBy = async ({
8
+ clientCollectionConfig,
9
+ clientConfig,
10
+ collectionConfig,
11
+ collectionSlug,
12
+ columns,
13
+ customCellProps,
14
+ drawerSlug,
15
+ enableRowSelections,
16
+ fieldPermissions,
17
+ query,
18
+ req,
19
+ select,
20
+ trash = false,
21
+ user,
22
+ viewType,
23
+ where: whereWithMergedSearch
24
+ }) => {
25
+ let Table = null;
26
+ let columnState;
27
+ const dataByGroup = {};
28
+ // NOTE: is there a faster/better way to do this?
29
+ const flattenedFields = flattenAllFields({
30
+ fields: collectionConfig.fields
31
+ });
32
+ const groupByFieldPath = query.groupBy.replace(/^-/, '');
33
+ const groupByField = flattenedFields.find(f => f.name === groupByFieldPath);
34
+ // Set up population for relationships
35
+ let populate;
36
+ if (groupByField?.type === 'relationship' && groupByField.relationTo) {
37
+ const relationTo = Array.isArray(groupByField.relationTo) ? groupByField.relationTo : [groupByField.relationTo];
38
+ populate = {};
39
+ relationTo.forEach(rel => {
40
+ const config = clientConfig.collections.find(c => c.slug === rel);
41
+ populate[rel] = {
42
+ [config?.admin?.useAsTitle || 'id']: true
43
+ };
14
44
  });
15
- const groupByFieldPath = query.groupBy.replace(/^-/, '');
16
- const groupByField = flattenedFields.find((f)=>f.name === groupByFieldPath);
17
- // Set up population for relationships
18
- let populate;
19
- if (groupByField?.type === 'relationship' && groupByField.relationTo) {
20
- const relationTo = Array.isArray(groupByField.relationTo) ? groupByField.relationTo : [
21
- groupByField.relationTo
22
- ];
23
- populate = {};
24
- relationTo.forEach((rel)=>{
25
- const config = clientConfig.collections.find((c)=>c.slug === rel);
26
- populate[rel] = {
27
- [config?.admin?.useAsTitle || 'id']: true
28
- };
29
- });
30
- }
31
- const distinct = await req.payload.findDistinct({
32
- collection: collectionSlug,
33
- depth: 1,
34
- field: groupByFieldPath,
35
- limit: query?.limit ? Number(query.limit) : undefined,
36
- locale: req.locale,
37
- overrideAccess: false,
38
- page: query?.page ? Number(query.page) : undefined,
39
- populate,
40
- req,
41
- sort: query?.groupBy,
42
- trash,
43
- where: whereWithMergedSearch
44
- });
45
- const data = {
46
- ...distinct,
47
- docs: distinct.values?.map(()=>({})) || [],
48
- values: undefined
49
- };
50
- await Promise.all((distinct.values || []).map(async (distinctValue, i)=>{
51
- const potentiallyPopulatedRelationship = distinctValue[groupByFieldPath];
52
- // Extract value or relationship ID for database query
53
- const valueOrRelationshipID = extractValueOrRelationshipID(potentiallyPopulatedRelationship);
54
- const groupData = await req.payload.find({
55
- collection: collectionSlug,
56
- depth: 0,
57
- draft: true,
58
- fallbackLocale: false,
59
- includeLockStatus: true,
60
- limit: query?.queryByGroup?.[valueOrRelationshipID]?.limit ? Number(query.queryByGroup[valueOrRelationshipID].limit) : undefined,
61
- locale: req.locale,
62
- overrideAccess: false,
63
- page: query?.queryByGroup?.[valueOrRelationshipID]?.page ? Number(query.queryByGroup[valueOrRelationshipID].page) : undefined,
64
- req,
65
- // Note: if we wanted to enable table-by-table sorting, we could use this:
66
- // sort: query?.queryByGroup?.[valueOrRelationshipID]?.sort,
67
- select,
68
- sort: query?.sort,
69
- trash,
70
- user,
71
- where: {
72
- ...whereWithMergedSearch || {},
73
- [groupByFieldPath]: {
74
- equals: valueOrRelationshipID
75
- }
76
- }
77
- });
78
- // Extract heading
79
- let heading;
80
- if (potentiallyPopulatedRelationship === null) {
81
- heading = req.i18n.t('general:noValue');
82
- } else if (groupByField?.type === 'relationship') {
83
- const relationshipConfig = Array.isArray(groupByField.relationTo) ? undefined : clientConfig.collections.find((c)=>c.slug === groupByField.relationTo);
84
- heading = extractRelationshipDisplayValue(potentiallyPopulatedRelationship, clientConfig, relationshipConfig);
85
- } else if (groupByField?.type === 'date') {
86
- heading = formatDate({
87
- date: String(valueOrRelationshipID),
88
- i18n: req.i18n,
89
- pattern: clientConfig.admin.dateFormat
90
- });
91
- } else if (groupByField?.type === 'checkbox') {
92
- if (valueOrRelationshipID === true) {
93
- heading = req.i18n.t('general:true');
94
- }
95
- if (valueOrRelationshipID === false) {
96
- heading = req.i18n.t('general:false');
97
- }
98
- } else {
99
- heading = String(valueOrRelationshipID);
100
- }
101
- // Create serializable value for client
102
- const serializableValue = createSerializableValue(valueOrRelationshipID);
103
- if (groupData.docs && groupData.docs.length > 0) {
104
- const { columnState: newColumnState, Table: NewTable } = renderTable({
105
- clientCollectionConfig,
106
- collectionConfig,
107
- columns,
108
- customCellProps,
109
- data: groupData,
110
- drawerSlug,
111
- enableRowSelections,
112
- fieldPermissions,
113
- groupByFieldPath,
114
- groupByValue: serializableValue,
115
- heading: heading || req.i18n.t('general:noValue'),
116
- i18n: req.i18n,
117
- key: `table-${serializableValue}`,
118
- orderableFieldName: collectionConfig.orderable === true ? '_order' : undefined,
119
- payload: req.payload,
120
- query,
121
- useAsTitle: collectionConfig.admin.useAsTitle,
122
- viewType
123
- });
124
- // Only need to set `columnState` once, using the first table's column state
125
- // This will avoid needing to generate column state explicitly for root context that wraps all tables
126
- if (!columnState) {
127
- columnState = newColumnState;
128
- }
129
- if (!Table) {
130
- Table = [];
131
- }
132
- dataByGroup[serializableValue] = groupData;
133
- Table[i] = NewTable;
45
+ }
46
+ const distinct = await req.payload.findDistinct({
47
+ collection: collectionSlug,
48
+ depth: 1,
49
+ field: groupByFieldPath,
50
+ limit: query?.limit ? Number(query.limit) : undefined,
51
+ locale: req.locale,
52
+ overrideAccess: false,
53
+ page: query?.page ? Number(query.page) : undefined,
54
+ populate,
55
+ req,
56
+ sort: query?.groupBy,
57
+ trash,
58
+ where: whereWithMergedSearch
59
+ });
60
+ const data = {
61
+ ...distinct,
62
+ docs: distinct.values?.map(() => ({})) || [],
63
+ values: undefined
64
+ };
65
+ await Promise.all((distinct.values || []).map(async (distinctValue, i) => {
66
+ const potentiallyPopulatedRelationship = distinctValue[groupByFieldPath];
67
+ // Extract value or relationship ID for database query
68
+ const valueOrRelationshipID = extractValueOrRelationshipID(potentiallyPopulatedRelationship);
69
+ const groupData = await req.payload.find({
70
+ collection: collectionSlug,
71
+ depth: 0,
72
+ draft: true,
73
+ fallbackLocale: false,
74
+ includeLockStatus: true,
75
+ limit: query?.queryByGroup?.[valueOrRelationshipID]?.limit ? Number(query.queryByGroup[valueOrRelationshipID].limit) : undefined,
76
+ locale: req.locale,
77
+ overrideAccess: false,
78
+ page: query?.queryByGroup?.[valueOrRelationshipID]?.page ? Number(query.queryByGroup[valueOrRelationshipID].page) : undefined,
79
+ req,
80
+ // Note: if we wanted to enable table-by-table sorting, we could use this:
81
+ // sort: query?.queryByGroup?.[valueOrRelationshipID]?.sort,
82
+ select,
83
+ sort: query?.sort,
84
+ trash,
85
+ user,
86
+ where: {
87
+ ...(whereWithMergedSearch || {}),
88
+ [groupByFieldPath]: {
89
+ equals: valueOrRelationshipID
134
90
  }
135
- }));
136
- return {
137
- columnState,
138
- data,
139
- Table
140
- };
91
+ }
92
+ });
93
+ // Extract heading
94
+ let heading;
95
+ if (potentiallyPopulatedRelationship === null) {
96
+ heading = req.i18n.t('general:noValue');
97
+ } else if (groupByField?.type === 'relationship') {
98
+ const relationshipConfig = Array.isArray(groupByField.relationTo) ? undefined : clientConfig.collections.find(c => c.slug === groupByField.relationTo);
99
+ heading = extractRelationshipDisplayValue(potentiallyPopulatedRelationship, clientConfig, relationshipConfig);
100
+ } else if (groupByField?.type === 'date') {
101
+ heading = formatDate({
102
+ date: String(valueOrRelationshipID),
103
+ i18n: req.i18n,
104
+ pattern: clientConfig.admin.dateFormat
105
+ });
106
+ } else if (groupByField?.type === 'checkbox') {
107
+ if (valueOrRelationshipID === true) {
108
+ heading = req.i18n.t('general:true');
109
+ }
110
+ if (valueOrRelationshipID === false) {
111
+ heading = req.i18n.t('general:false');
112
+ }
113
+ } else {
114
+ heading = String(valueOrRelationshipID);
115
+ }
116
+ // Create serializable value for client
117
+ const serializableValue = createSerializableValue(valueOrRelationshipID);
118
+ if (groupData.docs && groupData.docs.length > 0) {
119
+ const {
120
+ columnState: newColumnState,
121
+ Table: NewTable
122
+ } = renderTable({
123
+ clientCollectionConfig,
124
+ collectionConfig,
125
+ columns,
126
+ customCellProps,
127
+ data: groupData,
128
+ drawerSlug,
129
+ enableRowSelections,
130
+ fieldPermissions,
131
+ groupByFieldPath,
132
+ groupByValue: serializableValue,
133
+ heading: heading || req.i18n.t('general:noValue'),
134
+ i18n: req.i18n,
135
+ key: `table-${serializableValue}`,
136
+ orderableFieldName: collectionConfig.orderable === true ? '_order' : undefined,
137
+ payload: req.payload,
138
+ query,
139
+ useAsTitle: collectionConfig.admin.useAsTitle,
140
+ viewType
141
+ });
142
+ // Only need to set `columnState` once, using the first table's column state
143
+ // This will avoid needing to generate column state explicitly for root context that wraps all tables
144
+ if (!columnState) {
145
+ columnState = newColumnState;
146
+ }
147
+ if (!Table) {
148
+ Table = [];
149
+ }
150
+ dataByGroup[serializableValue] = groupData;
151
+ Table[i] = NewTable;
152
+ }
153
+ }));
154
+ return {
155
+ columnState,
156
+ data,
157
+ Table
158
+ };
141
159
  };
142
-
143
160
  //# sourceMappingURL=handleGroupBy.js.map