@payloadcms/ui 4.0.0-canary.35 → 4.0.0-canary.36

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 (180) hide show
  1. package/dist/css/app.css +1 -0
  2. package/dist/css/preflight.css +1 -0
  3. package/dist/css/spacing.css +3 -0
  4. package/dist/elements/AppHeader/index.css +3 -0
  5. package/dist/elements/BulkUpload/ActionsBar/index.css +1 -0
  6. package/dist/elements/BulkUpload/AddingFilesView/index.css +2 -4
  7. package/dist/elements/BulkUpload/FileSidebar/index.css +1 -0
  8. package/dist/elements/BulkUpload/FormsManager/index.d.ts.map +1 -1
  9. package/dist/elements/BulkUpload/FormsManager/index.js +12 -7
  10. package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
  11. package/dist/elements/BulkUpload/index.css +2 -0
  12. package/dist/elements/Collapsible/index.css +1 -0
  13. package/dist/elements/DatePicker/index.css +2 -0
  14. package/dist/elements/Dialog/index.css +1 -0
  15. package/dist/elements/DocumentControls/index.css +1 -0
  16. package/dist/elements/DocumentFields/index.css +2 -0
  17. package/dist/elements/DocumentHeader/Tabs/index.css +1 -0
  18. package/dist/elements/DocumentHeader/index.css +1 -0
  19. package/dist/elements/EditUpload/index.css +1 -1
  20. package/dist/elements/FieldDiffContainer/index.css +1 -0
  21. package/dist/elements/FieldDiffLabel/index.css +1 -0
  22. package/dist/elements/FileDetails/StaticFileDetails/index.css +2 -0
  23. package/dist/elements/HTMLDiff/index.css +1 -0
  24. package/dist/elements/ItemsDrawer/index.css +3 -0
  25. package/dist/elements/ListControls/index.css +1 -0
  26. package/dist/elements/ListControls/index.d.ts.map +1 -1
  27. package/dist/elements/ListControls/index.js +7 -1
  28. package/dist/elements/ListControls/index.js.map +1 -1
  29. package/dist/elements/ListControls/types.d.ts +3 -1
  30. package/dist/elements/ListControls/types.d.ts.map +1 -1
  31. package/dist/elements/ListControls/types.js.map +1 -1
  32. package/dist/elements/ListControlsBar/index.css +1 -0
  33. package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.js +1 -1
  34. package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.js.map +1 -1
  35. package/dist/elements/LivePreview/Window/index.css +1 -0
  36. package/dist/elements/Nav/index.css +2 -0
  37. package/dist/elements/PageControls/index.css +1 -0
  38. package/dist/elements/PillSelector/index.css +1 -0
  39. package/dist/elements/PreviewSizes/index.css +2 -0
  40. package/dist/elements/PublishButton/index.css +1 -0
  41. package/dist/elements/QueryPresets/fields/Heading/index.css +1 -0
  42. package/dist/elements/RenderTitle/index.css +1 -0
  43. package/dist/elements/Table/index.css +1 -0
  44. package/dist/elements/TableSection/index.css +1 -0
  45. package/dist/elements/Tabs/index.css +1 -0
  46. package/dist/elements/Thumbnail/index.css +1 -0
  47. package/dist/elements/TimezonePicker/index.css +1 -0
  48. package/dist/elements/Tooltip/index.css +7 -0
  49. package/dist/elements/WhereBuilder/Condition/index.css +1 -0
  50. package/dist/elements/WhereBuilder/index.css +2 -0
  51. package/dist/fields/Array/index.css +1 -0
  52. package/dist/fields/Blocks/index.css +1 -0
  53. package/dist/fields/Group/index.css +1 -0
  54. package/dist/fields/Row/index.css +2 -0
  55. package/dist/fields/Tabs/index.css +1 -0
  56. package/dist/forms/RenderFields/index.css +1 -0
  57. package/dist/hooks/useControllableState.js +3 -3
  58. package/dist/hooks/useControllableState.js.map +1 -1
  59. package/dist/providers/DocumentInfo/index.d.ts.map +1 -1
  60. package/dist/providers/DocumentInfo/index.js +30 -19
  61. package/dist/providers/DocumentInfo/index.js.map +1 -1
  62. package/dist/providers/Locale/index.d.ts.map +1 -1
  63. package/dist/providers/Locale/index.js +6 -7
  64. package/dist/providers/Locale/index.js.map +1 -1
  65. package/dist/styles.css +5 -1
  66. package/dist/templates/Default/Wrapper/index.css +2 -0
  67. package/dist/templates/Default/index.css +1 -0
  68. package/dist/utilities/handleAuthRedirect.d.ts.map +1 -1
  69. package/dist/utilities/handleAuthRedirect.js +4 -1
  70. package/dist/utilities/handleAuthRedirect.js.map +1 -1
  71. package/dist/utilities/isPathMatchingRoute.d.ts.map +1 -1
  72. package/dist/utilities/isPathMatchingRoute.js +7 -5
  73. package/dist/utilities/isPathMatchingRoute.js.map +1 -1
  74. package/dist/views/API/index.css +1 -0
  75. package/dist/views/Dashboard/Default/ModularDashboard/index.css +2 -0
  76. package/dist/views/Edit/index.css +1 -0
  77. package/dist/views/HierarchyList/HierarchyTable/SlotTable.css +1 -0
  78. package/dist/views/HierarchyList/index.css +1 -0
  79. package/dist/views/List/ListHeader/index.css +1 -0
  80. package/dist/views/List/ListHeader/index.d.ts +0 -1
  81. package/dist/views/List/ListHeader/index.d.ts.map +1 -1
  82. package/dist/views/List/ListHeader/index.js +2 -6
  83. package/dist/views/List/ListHeader/index.js.map +1 -1
  84. package/dist/views/List/index.client.d.ts.map +1 -1
  85. package/dist/views/List/index.client.js +3 -2
  86. package/dist/views/List/index.client.js.map +1 -1
  87. package/dist/views/List/index.css +2 -0
  88. package/dist/views/Root/index.d.ts.map +1 -1
  89. package/dist/views/Root/index.js +26 -19
  90. package/dist/views/Root/index.js.map +1 -1
  91. package/dist/views/Version/Default/index.css +2 -0
  92. package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.css +8 -0
  93. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.css +1 -0
  94. package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.css +1 -0
  95. package/dist/views/Version/RenderFieldsToDiff/index.css +2 -0
  96. package/dist/views/Version/Restore/index.d.ts.map +1 -1
  97. package/dist/views/Version/Restore/index.js +9 -6
  98. package/dist/views/Version/Restore/index.js.map +1 -1
  99. package/dist/views/Versions/VersionPillLabel/index.css +1 -0
  100. package/dist/views/Versions/index.css +1 -0
  101. package/dist/widgets/CollectionCards/index.css +4 -0
  102. package/package.json +5 -5
  103. package/dist/elements/ClipboardAction/clipboardUtilities.spec.js +0 -120
  104. package/dist/elements/ClipboardAction/clipboardUtilities.spec.js.map +0 -1
  105. package/dist/elements/ClipboardAction/isClipboardDataValid.spec.js +0 -144
  106. package/dist/elements/ClipboardAction/isClipboardDataValid.spec.js.map +0 -1
  107. package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js +0 -885
  108. package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js.map +0 -1
  109. package/dist/elements/ColumnSelection/matchesColumnSearch.spec.js +0 -87
  110. package/dist/elements/ColumnSelection/matchesColumnSearch.spec.js.map +0 -1
  111. package/dist/elements/CommandPalette/buildActions.spec.js +0 -158
  112. package/dist/elements/CommandPalette/buildActions.spec.js.map +0 -1
  113. package/dist/elements/CommandPalette/highlightLabel.spec.js +0 -78
  114. package/dist/elements/CommandPalette/highlightLabel.spec.js.map +0 -1
  115. package/dist/elements/FieldSelect/reduceFieldOptions.spec.js +0 -143
  116. package/dist/elements/FieldSelect/reduceFieldOptions.spec.js.map +0 -1
  117. package/dist/elements/Toasts/fieldErrors.spec.js +0 -46
  118. package/dist/elements/Toasts/fieldErrors.spec.js.map +0 -1
  119. package/dist/elements/WhereBuilder/Condition/Relationship/optionsReducer.spec.js +0 -152
  120. package/dist/elements/WhereBuilder/Condition/Relationship/optionsReducer.spec.js.map +0 -1
  121. package/dist/elements/WhereBuilder/conditionValue.spec.js +0 -65
  122. package/dist/elements/WhereBuilder/conditionValue.spec.js.map +0 -1
  123. package/dist/fields/Upload/Input.spec.js +0 -242
  124. package/dist/fields/Upload/Input.spec.js.map +0 -1
  125. package/dist/forms/fieldSchemasToFormState/fieldSchemasToFormState.spec.d.ts +0 -2
  126. package/dist/forms/fieldSchemasToFormState/fieldSchemasToFormState.spec.d.ts.map +0 -1
  127. package/dist/forms/fieldSchemasToFormState/fieldSchemasToFormState.spec.js +0 -67
  128. package/dist/forms/fieldSchemasToFormState/fieldSchemasToFormState.spec.js.map +0 -1
  129. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.spec.js +0 -150
  130. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.spec.js.map +0 -1
  131. package/dist/layouts/Root/index.spec.js +0 -20
  132. package/dist/layouts/Root/index.spec.js.map +0 -1
  133. package/dist/providers/Auth/authSessionRequests.spec.js +0 -121
  134. package/dist/providers/Auth/authSessionRequests.spec.js.map +0 -1
  135. package/dist/providers/Auth/sessionActivity.spec.js +0 -44
  136. package/dist/providers/Auth/sessionActivity.spec.js.map +0 -1
  137. package/dist/providers/Auth/tabSessionSync/index.spec.js +0 -463
  138. package/dist/providers/Auth/tabSessionSync/index.spec.js.map +0 -1
  139. package/dist/providers/Auth/useAuthSessionTimers.spec.js +0 -311
  140. package/dist/providers/Auth/useAuthSessionTimers.spec.js.map +0 -1
  141. package/dist/providers/RouteTransition/ProgressBar/index.spec.js +0 -44
  142. package/dist/providers/RouteTransition/ProgressBar/index.spec.js.map +0 -1
  143. package/dist/providers/TableColumns/buildColumnState/index.spec.js +0 -40
  144. package/dist/providers/TableColumns/buildColumnState/index.spec.js.map +0 -1
  145. package/dist/utilities/appendCacheTag.spec.js +0 -34
  146. package/dist/utilities/appendCacheTag.spec.js.map +0 -1
  147. package/dist/utilities/formatAbsoluteURL.spec.js +0 -27
  148. package/dist/utilities/formatAbsoluteURL.spec.js.map +0 -1
  149. package/dist/utilities/formatMetadata.spec.js +0 -83
  150. package/dist/utilities/formatMetadata.spec.js.map +0 -1
  151. package/dist/utilities/fuzzyMatch.spec.js +0 -38
  152. package/dist/utilities/fuzzyMatch.spec.js.map +0 -1
  153. package/dist/utilities/initReq.spec.js +0 -226
  154. package/dist/utilities/initReq.spec.js.map +0 -1
  155. package/dist/utilities/isAbsoluteURL.spec.js +0 -11
  156. package/dist/utilities/isAbsoluteURL.spec.js.map +0 -1
  157. package/dist/utilities/isCustomAdminView.spec.js +0 -90
  158. package/dist/utilities/isCustomAdminView.spec.js.map +0 -1
  159. package/dist/utilities/isHttpURL.spec.js +0 -25
  160. package/dist/utilities/isHttpURL.spec.js.map +0 -1
  161. package/dist/utilities/isPathMatchingRoute.spec.js +0 -178
  162. package/dist/utilities/isPathMatchingRoute.spec.js.map +0 -1
  163. package/dist/utilities/isPublicAdminRoute.spec.js +0 -34
  164. package/dist/utilities/isPublicAdminRoute.spec.js.map +0 -1
  165. package/dist/utilities/normalizeRelationshipValue.spec.js +0 -373
  166. package/dist/utilities/normalizeRelationshipValue.spec.js.map +0 -1
  167. package/dist/utilities/recentlyViewed.spec.js +0 -92
  168. package/dist/utilities/recentlyViewed.spec.js.map +0 -1
  169. package/dist/views/Root/getCustomCollectionViewByRoute.spec.js +0 -168
  170. package/dist/views/Root/getCustomCollectionViewByRoute.spec.js.map +0 -1
  171. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.spec.js +0 -258
  172. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.spec.js.map +0 -1
  173. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js +0 -915
  174. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js.map +0 -1
  175. package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js +0 -47
  176. package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js.map +0 -1
  177. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js +0 -125
  178. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js.map +0 -1
  179. package/dist/widgets/CollectionQuery/getCollectionFieldPaths.spec.js +0 -100
  180. package/dist/widgets/CollectionQuery/getCollectionFieldPaths.spec.js.map +0 -1
@@ -1,168 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { getCustomCollectionViewByRoute } from './getCustomCollectionViewByRoute.js';
3
- const gridView = {
4
- grid: {
5
- Component: '/components/views/GridView/index.js#GridView',
6
- exact: true,
7
- path: '/grid'
8
- }
9
- };
10
- const gridViewPrefixMatch = {
11
- grid: {
12
- Component: '/components/views/GridView/index.js#GridView',
13
- exact: false,
14
- path: '/grid'
15
- }
16
- };
17
- describe('getCustomCollectionViewByRoute', () => {
18
- describe('route matching with default /admin prefix', () => {
19
- it('should match a custom view at the correct path', () => {
20
- const result = getCustomCollectionViewByRoute({
21
- adminRoute: '/admin',
22
- baseRoute: '/collections/my-collection',
23
- currentRoute: '/admin/collections/my-collection/grid',
24
- views: gridView
25
- });
26
- expect(result.viewKey).toBe('grid');
27
- expect(result.view.payloadComponent).toBeDefined();
28
- });
29
- it('should not match when the path segment does not correspond to any custom view', () => {
30
- const result = getCustomCollectionViewByRoute({
31
- adminRoute: '/admin',
32
- baseRoute: '/collections/my-collection',
33
- currentRoute: '/admin/collections/my-collection/abc123',
34
- views: gridView
35
- });
36
- expect(result.viewKey).toBeNull();
37
- expect(result.view.payloadComponent).toBeUndefined();
38
- });
39
- });
40
- describe('route matching with custom adminRoute prefix', () => {
41
- it('should match when adminRoute is a non-default prefix', () => {
42
- const result = getCustomCollectionViewByRoute({
43
- adminRoute: '/cms',
44
- baseRoute: '/collections/my-collection',
45
- currentRoute: '/cms/collections/my-collection/grid',
46
- views: gridView
47
- });
48
- expect(result.viewKey).toBe('grid');
49
- expect(result.view.payloadComponent).toBeDefined();
50
- });
51
- it('should match when adminRoute is /', () => {
52
- const result = getCustomCollectionViewByRoute({
53
- adminRoute: '/',
54
- baseRoute: '/collections/my-collection',
55
- currentRoute: '/collections/my-collection/grid',
56
- views: gridView
57
- });
58
- expect(result.viewKey).toBe('grid');
59
- expect(result.view.payloadComponent).toBeDefined();
60
- });
61
- });
62
- describe('route matching with exact: false (prefix matching)', () => {
63
- it('should match a sub-path when exact is false', () => {
64
- const result = getCustomCollectionViewByRoute({
65
- adminRoute: '/admin',
66
- baseRoute: '/collections/my-collection',
67
- currentRoute: '/admin/collections/my-collection/grid/detail',
68
- views: gridViewPrefixMatch
69
- });
70
- expect(result.viewKey).toBe('grid');
71
- expect(result.view.payloadComponent).toBeDefined();
72
- });
73
- it('should match the exact path when exact is false', () => {
74
- const result = getCustomCollectionViewByRoute({
75
- adminRoute: '/admin',
76
- baseRoute: '/collections/my-collection',
77
- currentRoute: '/admin/collections/my-collection/grid',
78
- views: gridViewPrefixMatch
79
- });
80
- expect(result.viewKey).toBe('grid');
81
- expect(result.view.payloadComponent).toBeDefined();
82
- });
83
- it('should not match an unrelated path when exact is false', () => {
84
- const result = getCustomCollectionViewByRoute({
85
- adminRoute: '/admin',
86
- baseRoute: '/collections/my-collection',
87
- currentRoute: '/admin/collections/my-collection/map',
88
- views: gridViewPrefixMatch
89
- });
90
- expect(result.viewKey).toBeNull();
91
- expect(result.view.payloadComponent).toBeUndefined();
92
- });
93
- });
94
- describe('edge cases', () => {
95
- it('should return no match when views is undefined', () => {
96
- const result = getCustomCollectionViewByRoute({
97
- adminRoute: '/admin',
98
- baseRoute: '/collections/my-collection',
99
- currentRoute: '/admin/collections/my-collection/grid',
100
- views: undefined
101
- });
102
- expect(result.viewKey).toBeNull();
103
- expect(result.view.payloadComponent).toBeUndefined();
104
- });
105
- it('should not match built-in "edit" or "list" keys', () => {
106
- const viewsWithBuiltins = {
107
- edit: {
108
- default: {
109
- Component: '/components/views/Edit/index.js#EditView'
110
- }
111
- },
112
- list: {
113
- Component: '/components/views/List/index.js#ListView'
114
- }
115
- };
116
- const result = getCustomCollectionViewByRoute({
117
- adminRoute: '/admin',
118
- baseRoute: '/collections/my-collection',
119
- currentRoute: '/admin/collections/my-collection/edit',
120
- views: viewsWithBuiltins
121
- });
122
- expect(result.viewKey).toBeNull();
123
- });
124
- it('should not match a custom view that has no path defined', () => {
125
- const viewsWithNoPath = {
126
- grid: {
127
- Component: '/components/views/GridView/index.js#GridView'
128
- }
129
- };
130
- const result = getCustomCollectionViewByRoute({
131
- adminRoute: '/admin',
132
- baseRoute: '/collections/my-collection',
133
- currentRoute: '/admin/collections/my-collection/grid',
134
- views: viewsWithNoPath
135
- });
136
- expect(result.viewKey).toBeNull();
137
- });
138
- it('should match the correct view when multiple custom views are defined', () => {
139
- const multipleViews = {
140
- grid: {
141
- Component: '/components/views/GridView/index.js#GridView',
142
- exact: true,
143
- path: '/grid'
144
- },
145
- map: {
146
- Component: '/components/views/MapView/index.js#MapView',
147
- exact: true,
148
- path: '/map'
149
- }
150
- };
151
- const gridResult = getCustomCollectionViewByRoute({
152
- adminRoute: '/admin',
153
- baseRoute: '/collections/my-collection',
154
- currentRoute: '/admin/collections/my-collection/grid',
155
- views: multipleViews
156
- });
157
- expect(gridResult.viewKey).toBe('grid');
158
- const mapResult = getCustomCollectionViewByRoute({
159
- adminRoute: '/admin',
160
- baseRoute: '/collections/my-collection',
161
- currentRoute: '/admin/collections/my-collection/map',
162
- views: multipleViews
163
- });
164
- expect(mapResult.viewKey).toBe('map');
165
- });
166
- });
167
- });
168
- //# sourceMappingURL=getCustomCollectionViewByRoute.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getCustomCollectionViewByRoute.spec.js","names":["describe","expect","it","getCustomCollectionViewByRoute","gridView","grid","Component","exact","path","gridViewPrefixMatch","result","adminRoute","baseRoute","currentRoute","views","viewKey","toBe","view","payloadComponent","toBeDefined","toBeNull","toBeUndefined","undefined","viewsWithBuiltins","edit","default","list","viewsWithNoPath","multipleViews","map","gridResult","mapResult"],"sources":["../../../src/views/Root/getCustomCollectionViewByRoute.spec.ts"],"sourcesContent":["import type { AdminViewConfig, SanitizedCollectionConfig } from 'payload'\n\nimport { describe, expect, it } from 'vitest'\n\nimport { getCustomCollectionViewByRoute } from './getCustomCollectionViewByRoute.js'\n\ntype Views = SanitizedCollectionConfig['admin']['components']['views']\n\nconst gridView: Views = {\n grid: {\n Component: '/components/views/GridView/index.js#GridView',\n exact: true,\n path: '/grid',\n },\n}\n\nconst gridViewPrefixMatch: Views = {\n grid: {\n Component: '/components/views/GridView/index.js#GridView',\n exact: false,\n path: '/grid',\n },\n}\n\ndescribe('getCustomCollectionViewByRoute', () => {\n describe('route matching with default /admin prefix', () => {\n it('should match a custom view at the correct path', () => {\n const result = getCustomCollectionViewByRoute({\n adminRoute: '/admin',\n baseRoute: '/collections/my-collection',\n currentRoute: '/admin/collections/my-collection/grid',\n views: gridView,\n })\n\n expect(result.viewKey).toBe('grid')\n expect(result.view.payloadComponent).toBeDefined()\n })\n\n it('should not match when the path segment does not correspond to any custom view', () => {\n const result = getCustomCollectionViewByRoute({\n adminRoute: '/admin',\n baseRoute: '/collections/my-collection',\n currentRoute: '/admin/collections/my-collection/abc123',\n views: gridView,\n })\n\n expect(result.viewKey).toBeNull()\n expect(result.view.payloadComponent).toBeUndefined()\n })\n })\n\n describe('route matching with custom adminRoute prefix', () => {\n it('should match when adminRoute is a non-default prefix', () => {\n const result = getCustomCollectionViewByRoute({\n adminRoute: '/cms',\n baseRoute: '/collections/my-collection',\n currentRoute: '/cms/collections/my-collection/grid',\n views: gridView,\n })\n\n expect(result.viewKey).toBe('grid')\n expect(result.view.payloadComponent).toBeDefined()\n })\n\n it('should match when adminRoute is /', () => {\n const result = getCustomCollectionViewByRoute({\n adminRoute: '/',\n baseRoute: '/collections/my-collection',\n currentRoute: '/collections/my-collection/grid',\n views: gridView,\n })\n\n expect(result.viewKey).toBe('grid')\n expect(result.view.payloadComponent).toBeDefined()\n })\n })\n\n describe('route matching with exact: false (prefix matching)', () => {\n it('should match a sub-path when exact is false', () => {\n const result = getCustomCollectionViewByRoute({\n adminRoute: '/admin',\n baseRoute: '/collections/my-collection',\n currentRoute: '/admin/collections/my-collection/grid/detail',\n views: gridViewPrefixMatch,\n })\n\n expect(result.viewKey).toBe('grid')\n expect(result.view.payloadComponent).toBeDefined()\n })\n\n it('should match the exact path when exact is false', () => {\n const result = getCustomCollectionViewByRoute({\n adminRoute: '/admin',\n baseRoute: '/collections/my-collection',\n currentRoute: '/admin/collections/my-collection/grid',\n views: gridViewPrefixMatch,\n })\n\n expect(result.viewKey).toBe('grid')\n expect(result.view.payloadComponent).toBeDefined()\n })\n\n it('should not match an unrelated path when exact is false', () => {\n const result = getCustomCollectionViewByRoute({\n adminRoute: '/admin',\n baseRoute: '/collections/my-collection',\n currentRoute: '/admin/collections/my-collection/map',\n views: gridViewPrefixMatch,\n })\n\n expect(result.viewKey).toBeNull()\n expect(result.view.payloadComponent).toBeUndefined()\n })\n })\n\n describe('edge cases', () => {\n it('should return no match when views is undefined', () => {\n const result = getCustomCollectionViewByRoute({\n adminRoute: '/admin',\n baseRoute: '/collections/my-collection',\n currentRoute: '/admin/collections/my-collection/grid',\n views: undefined,\n })\n\n expect(result.viewKey).toBeNull()\n expect(result.view.payloadComponent).toBeUndefined()\n })\n\n it('should not match built-in \"edit\" or \"list\" keys', () => {\n const viewsWithBuiltins: Views = {\n edit: {\n default: { Component: '/components/views/Edit/index.js#EditView' },\n },\n list: {\n Component: '/components/views/List/index.js#ListView',\n },\n }\n\n const result = getCustomCollectionViewByRoute({\n adminRoute: '/admin',\n baseRoute: '/collections/my-collection',\n currentRoute: '/admin/collections/my-collection/edit',\n views: viewsWithBuiltins,\n })\n\n expect(result.viewKey).toBeNull()\n })\n\n it('should not match a custom view that has no path defined', () => {\n const viewsWithNoPath: Views = {\n grid: {\n Component: '/components/views/GridView/index.js#GridView',\n } as unknown as AdminViewConfig,\n }\n\n const result = getCustomCollectionViewByRoute({\n adminRoute: '/admin',\n baseRoute: '/collections/my-collection',\n currentRoute: '/admin/collections/my-collection/grid',\n views: viewsWithNoPath,\n })\n\n expect(result.viewKey).toBeNull()\n })\n\n it('should match the correct view when multiple custom views are defined', () => {\n const multipleViews: Views = {\n grid: {\n Component: '/components/views/GridView/index.js#GridView',\n exact: true,\n path: '/grid',\n },\n map: {\n Component: '/components/views/MapView/index.js#MapView',\n exact: true,\n path: '/map',\n },\n }\n\n const gridResult = getCustomCollectionViewByRoute({\n adminRoute: '/admin',\n baseRoute: '/collections/my-collection',\n currentRoute: '/admin/collections/my-collection/grid',\n views: multipleViews,\n })\n\n expect(gridResult.viewKey).toBe('grid')\n\n const mapResult = getCustomCollectionViewByRoute({\n adminRoute: '/admin',\n baseRoute: '/collections/my-collection',\n currentRoute: '/admin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UAAA,GAAa3B,8BAAA,CAA+B;QAChDQ,UAAA,EAAY;QACZC,SAAA,EAAW;QACXC,YAAA,EAAc;QACdC,KAAA,EAAOc;MACT;MAEA3B,MAAA,CAAO6B,UAAA,CAAWf,OAAO,EAAEC,IAAI,CAAC;MAEhC,MAAMe,SAAA,GAAY5B,8BAAA,CAA+B;QAC/CQ,UAAA,EAAY;QACZC,SAAA,EAAW;QACXC,YAAA,EAAc;QACdC,KAAA,EAAOc;MACT;MAEA3B,MAAA,CAAO8B,SAAA,CAAUhB,OAAO,EAAEC,IAAI,CAAC;IACjC;EACF;AACF","ignoreList":[]}
@@ -1,258 +0,0 @@
1
- import { getFieldPaths } from 'payload/shared';
2
- import { describe, expect, it, vi } from 'vitest';
3
- import { buildVersionFields } from './buildVersionFields.js';
4
- vi.mock('../../../elements/RenderServerComponent/index.js', () => ({
5
- RenderServerComponent: () => null
6
- }));
7
- describe('buildVersionFields', () => {
8
- it('should render version diffs when a block with unnamed row and collapsible fields is replaced', () => {
9
- const linkButtonBlock = {
10
- fields: [{
11
- fields: [{
12
- name: 'variant',
13
- type: 'text'
14
- }],
15
- name: 'appearance',
16
- type: 'group'
17
- }, {
18
- fields: [{
19
- name: 'label',
20
- type: 'text'
21
- }],
22
- type: 'row'
23
- }, {
24
- fields: [{
25
- name: 'eventTag',
26
- type: 'text'
27
- }],
28
- label: 'Tracking',
29
- type: 'collapsible'
30
- }],
31
- slug: 'link-button'
32
- };
33
- const signInButtonBlock = {
34
- fields: [{
35
- fields: [{
36
- name: 'variant',
37
- type: 'text'
38
- }],
39
- name: 'appearance',
40
- type: 'group'
41
- }, {
42
- fields: [{
43
- name: 'label',
44
- type: 'text'
45
- }],
46
- type: 'row'
47
- }, {
48
- name: 'isSignup',
49
- type: 'checkbox'
50
- }, {
51
- fields: [{
52
- name: 'eventTag',
53
- type: 'text'
54
- }],
55
- label: 'Tracking',
56
- type: 'collapsible'
57
- }],
58
- slug: 'sign-in-button'
59
- };
60
- const blocksField = {
61
- blocks: [linkButtonBlock, signInButtonBlock],
62
- name: 'ctas',
63
- type: 'blocks'
64
- };
65
- const clientSchemaMap = new Map([['pages.ctas', blocksField]]);
66
- addFieldsToClientSchemaMap({
67
- clientSchemaMap,
68
- entitySlug: 'pages',
69
- fields: linkButtonBlock.fields,
70
- parentSchemaPath: 'ctas.link-button'
71
- });
72
- addFieldsToClientSchemaMap({
73
- clientSchemaMap,
74
- entitySlug: 'pages',
75
- fields: signInButtonBlock.fields,
76
- parentSchemaPath: 'ctas.sign-in-button'
77
- });
78
- const {
79
- versionFields
80
- } = buildVersionFields({
81
- clientSchemaMap,
82
- customDiffComponents: {},
83
- entitySlug: 'pages',
84
- fields: [blocksField],
85
- fieldsPermissions: {
86
- ctas: true
87
- },
88
- i18n: {
89
- t: key => key
90
- },
91
- modifiedOnly: true,
92
- parentIndexPath: '',
93
- parentIsLocalized: false,
94
- parentPath: '',
95
- parentSchemaPath: '',
96
- req: {
97
- payload: {
98
- blocks: {},
99
- importMap: {},
100
- logger: {
101
- error: vi.fn()
102
- }
103
- }
104
- },
105
- selectedLocales: [],
106
- versionFromSiblingData: {
107
- ctas: [{
108
- appearance: {
109
- variant: 'primary'
110
- },
111
- blockType: 'sign-in-button',
112
- eventTag: 'sign-in tracking',
113
- isSignup: true,
114
- label: 'Sign in'
115
- }]
116
- },
117
- versionToSiblingData: {
118
- ctas: [{
119
- appearance: {
120
- variant: 'secondary'
121
- },
122
- blockType: 'link-button',
123
- eventTag: 'link tracking',
124
- label: 'Learn more'
125
- }]
126
- }
127
- });
128
- const rowFields = versionFields[0]?.field?.rows?.[0] ?? [];
129
- const schemaPaths = getSchemaPaths(rowFields);
130
- expect(schemaPaths).toEqual(expect.arrayContaining(['ctas.sign-in-button._index-1.label', 'ctas.sign-in-button._index-3.eventTag', 'ctas.link-button._index-1.label', 'ctas.link-button._index-2.eventTag']));
131
- });
132
- it('should use the source block permissions when a block is replaced', () => {
133
- const sourceBlock = {
134
- fields: [{
135
- name: 'shared',
136
- type: 'text'
137
- }],
138
- slug: 'source'
139
- };
140
- const replacementBlock = {
141
- fields: [{
142
- name: 'shared',
143
- type: 'text'
144
- }],
145
- slug: 'replacement'
146
- };
147
- const blocksField = {
148
- blocks: [sourceBlock, replacementBlock],
149
- name: 'blocks',
150
- type: 'blocks'
151
- };
152
- const clientSchemaMap = new Map([['pages.blocks', blocksField], ['pages.blocks.source.shared', sourceBlock.fields[0]], ['pages.blocks.replacement.shared', replacementBlock.fields[0]]]);
153
- const fieldsPermissions = {
154
- blocks: {
155
- blocks: {
156
- replacement: {
157
- fields: {}
158
- },
159
- source: {
160
- fields: {
161
- shared: true
162
- }
163
- }
164
- },
165
- read: true
166
- }
167
- };
168
- const {
169
- versionFields
170
- } = buildVersionFields({
171
- clientSchemaMap,
172
- customDiffComponents: {},
173
- entitySlug: 'pages',
174
- fields: [blocksField],
175
- fieldsPermissions,
176
- i18n: {
177
- t: key => key
178
- },
179
- modifiedOnly: true,
180
- parentIndexPath: '',
181
- parentIsLocalized: false,
182
- parentPath: '',
183
- parentSchemaPath: '',
184
- req: {
185
- payload: {
186
- blocks: {},
187
- importMap: {},
188
- logger: {
189
- error: vi.fn()
190
- }
191
- }
192
- },
193
- selectedLocales: [],
194
- versionFromSiblingData: {
195
- blocks: [{
196
- blockType: 'source',
197
- shared: 'readable source value'
198
- }]
199
- },
200
- versionToSiblingData: {
201
- blocks: [{
202
- blockType: 'replacement'
203
- }]
204
- }
205
- });
206
- const rowFields = versionFields[0]?.field?.rows?.[0];
207
- expect(rowFields).toHaveLength(1);
208
- expect(rowFields?.[0]?.field?.path).toBe('blocks.0.shared');
209
- expect(rowFields?.[0]?.field?.schemaPath).toBe('blocks.source.shared');
210
- });
211
- });
212
- function addFieldsToClientSchemaMap({
213
- clientSchemaMap,
214
- entitySlug,
215
- fields,
216
- parentIndexPath = '',
217
- parentSchemaPath
218
- }) {
219
- fields.forEach((field, index) => {
220
- const {
221
- indexPath,
222
- schemaPath
223
- } = getFieldPaths({
224
- field,
225
- index,
226
- parentIndexPath,
227
- parentSchemaPath
228
- });
229
- clientSchemaMap.set(`${entitySlug}.${schemaPath}`, field);
230
- if (field.type === 'collapsible' || field.type === 'row') {
231
- addFieldsToClientSchemaMap({
232
- clientSchemaMap,
233
- entitySlug,
234
- fields: field.fields,
235
- parentIndexPath: indexPath,
236
- parentSchemaPath: schemaPath
237
- });
238
- } else if (field.type === 'group') {
239
- addFieldsToClientSchemaMap({
240
- clientSchemaMap,
241
- entitySlug,
242
- fields: field.fields,
243
- parentIndexPath: 'name' in field ? '' : indexPath,
244
- parentSchemaPath: schemaPath
245
- });
246
- }
247
- });
248
- }
249
- function getSchemaPaths(versionFields) {
250
- return versionFields.flatMap(versionField => {
251
- const field = versionField.field;
252
- if (!field) {
253
- return [];
254
- }
255
- return [field.schemaPath, ...getSchemaPaths(field.fields), ...(field.rows?.flatMap(row => getSchemaPaths(row)) ?? []), ...(field.tabs?.flatMap(tab => getSchemaPaths(tab.fields)) ?? [])];
256
- });
257
- }
258
- //# sourceMappingURL=buildVersionFields.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildVersionFields.spec.js","names":["getFieldPaths","describe","expect","it","vi","buildVersionFields","mock","RenderServerComponent","linkButtonBlock","fields","name","type","label","slug","signInButtonBlock","blocksField","blocks","clientSchemaMap","Map","addFieldsToClientSchemaMap","entitySlug","parentSchemaPath","versionFields","customDiffComponents","fieldsPermissions","ctas","i18n","t","key","modifiedOnly","parentIndexPath","parentIsLocalized","parentPath","req","payload","importMap","logger","error","fn","selectedLocales","versionFromSiblingData","appearance","variant","blockType","eventTag","isSignup","versionToSiblingData","rowFields","field","rows","schemaPaths","getSchemaPaths","toEqual","arrayContaining","sourceBlock","replacementBlock","replacement","source","shared","read","toHaveLength","path","toBe","schemaPath","forEach","index","indexPath","set","flatMap","versionField","row","tabs","tab"],"sources":["../../../../src/views/Version/RenderFieldsToDiff/buildVersionFields.spec.ts"],"sourcesContent":["import type {\n ClientField,\n ClientFieldSchemaMap,\n Field,\n SanitizedFieldsPermissions,\n VersionField,\n} from 'payload'\n\nimport { getFieldPaths } from 'payload/shared'\nimport { describe, expect, it, vi } from 'vitest'\n\nimport { buildVersionFields, type BuildVersionFieldsArgs } from './buildVersionFields.js'\n\nvi.mock('../../../elements/RenderServerComponent/index.js', () => ({\n RenderServerComponent: () => null,\n}))\n\ndescribe('buildVersionFields', () => {\n it('should render version diffs when a block with unnamed row and collapsible fields is replaced', () => {\n const linkButtonBlock = {\n fields: [\n {\n fields: [{ name: 'variant', type: 'text' }],\n name: 'appearance',\n type: 'group',\n },\n {\n fields: [{ name: 'label', type: 'text' }],\n type: 'row',\n },\n {\n fields: [{ name: 'eventTag', type: 'text' }],\n label: 'Tracking',\n type: 'collapsible',\n },\n ],\n slug: 'link-button',\n } satisfies { fields: Field[]; slug: string }\n const signInButtonBlock = {\n fields: [\n {\n fields: [{ name: 'variant', type: 'text' }],\n name: 'appearance',\n type: 'group',\n },\n {\n fields: [{ name: 'label', type: 'text' }],\n type: 'row',\n },\n { name: 'isSignup', type: 'checkbox' },\n {\n fields: [{ name: 'eventTag', type: 'text' }],\n label: 'Tracking',\n type: 'collapsible',\n },\n ],\n slug: 'sign-in-button',\n } satisfies { fields: Field[]; slug: string }\n const blocksField = {\n blocks: [linkButtonBlock, signInButtonBlock],\n name: 'ctas',\n type: 'blocks',\n } satisfies Field\n const clientSchemaMap = new Map([['pages.ctas', blocksField]]) as ClientFieldSchemaMap\n\n addFieldsToClientSchemaMap({\n clientSchemaMap,\n entitySlug: 'pages',\n fields: linkButtonBlock.fields,\n parentSchemaPath: 'ctas.link-button',\n })\n addFieldsToClientSchemaMap({\n clientSchemaMap,\n entitySlug: 'pages',\n fields: signInButtonBlock.fields,\n parentSchemaPath: 'ctas.sign-in-button',\n })\n\n const { versionFields } = buildVersionFields({\n clientSchemaMap,\n customDiffComponents: {},\n entitySlug: 'pages',\n fields: [blocksField],\n fieldsPermissions: { ctas: true } as SanitizedFieldsPermissions,\n i18n: { t: (key: string) => key },\n modifiedOnly: true,\n parentIndexPath: '',\n parentIsLocalized: false,\n parentPath: '',\n parentSchemaPath: '',\n req: {\n payload: {\n blocks: {},\n importMap: {},\n logger: { error: vi.fn() },\n },\n },\n selectedLocales: [],\n versionFromSiblingData: {\n ctas: [\n {\n appearance: { variant: 'primary' },\n blockType: 'sign-in-button',\n eventTag: 'sign-in tracking',\n isSignup: true,\n label: 'Sign in',\n },\n ],\n },\n versionToSiblingData: {\n ctas: [\n {\n appearance: { variant: 'secondary' },\n blockType: 'link-button',\n eventTag: 'link tracking',\n label: 'Learn more',\n },\n ],\n },\n } as BuildVersionFieldsArgs)\n\n const rowFields = versionFields[0]?.field?.rows?.[0] ?? []\n const schemaPaths = getSchemaPaths(rowFields)\n\n expect(schemaPaths).toEqual(\n expect.arrayContaining([\n 'ctas.sign-in-button._index-1.label',\n 'ctas.sign-in-button._index-3.eventTag',\n 'ctas.link-button._index-1.label',\n 'ctas.link-button._index-2.eventTag',\n ]),\n )\n })\n\n it('should use the source block permissions when a block is replaced', () => {\n const sourceBlock = {\n fields: [{ name: 'shared', type: 'text' }],\n slug: 'source',\n } satisfies { fields: Field[]; slug: string }\n const replacementBlock = {\n fields: [{ name: 'shared', type: 'text' }],\n slug: 'replacement',\n } satisfies { fields: Field[]; slug: string }\n const blocksField = {\n blocks: [sourceBlock, replacementBlock],\n name: 'blocks',\n type: 'blocks',\n } satisfies Field\n const clientSchemaMap = new Map([\n ['pages.blocks', blocksField],\n ['pages.blocks.source.shared', sourceBlock.fields[0]],\n ['pages.blocks.replacement.shared', replacementBlock.fields[0]],\n ]) as ClientFieldSchemaMap\n const fieldsPermissions = {\n blocks: {\n blocks: {\n replacement: { fields: {} },\n source: { fields: { shared: true } },\n },\n read: true,\n },\n } as SanitizedFieldsPermissions\n\n const { versionFields } = buildVersionFields({\n clientSchemaMap,\n customDiffComponents: {},\n entitySlug: 'pages',\n fields: [blocksField],\n fieldsPermissions,\n i18n: { t: (key: string) => key },\n modifiedOnly: true,\n parentIndexPath: '',\n parentIsLocalized: false,\n parentPath: '',\n parentSchemaPath: '',\n req: {\n payload: {\n blocks: {},\n importMap: {},\n logger: { error: vi.fn() },\n },\n },\n selectedLocales: [],\n versionFromSiblingData: {\n blocks: [{ blockType: 'source', shared: 'readable source value' }],\n },\n versionToSiblingData: {\n blocks: [{ blockType: 'replacement' }],\n },\n } as BuildVersionFieldsArgs)\n\n const rowFields = versionFields[0]?.field?.rows?.[0]\n\n expect(rowFields).toHaveLength(1)\n expect(rowFields?.[0]?.field?.path).toBe('blocks.0.shared')\n expect(rowFields?.[0]?.field?.schemaPath).toBe('blocks.source.shared')\n })\n})\n\nfunction addFieldsToClientSchemaMap({\n clientSchemaMap,\n entitySlug,\n fields,\n parentIndexPath = '',\n parentSchemaPath,\n}: {\n clientSchemaMap: ClientFieldSchemaMap\n entitySlug: string\n fields: Field[]\n parentIndexPath?: string\n parentSchemaPath: string\n}): void {\n fields.forEach((field, index) => {\n const { indexPath, schemaPath } = getFieldPaths({\n field,\n index,\n parentIndexPath,\n parentSchemaPath,\n })\n\n clientSchemaMap.set(`${entitySlug}.${schemaPath}`, field as ClientField)\n\n if (field.type === 'collapsible' || field.type === 'row') {\n addFieldsToClientSchemaMap({\n clientSchemaMap,\n entitySlug,\n fields: field.fields,\n parentIndexPath: indexPath,\n parentSchemaPath: schemaPath,\n })\n } else if (field.type === 'group') {\n addFieldsToClientSchemaMap({\n clientSchemaMap,\n entitySlug,\n fields: field.fields,\n parentIndexPath: 'name' in field ? '' : indexPath,\n parentSchemaPath: schemaPath,\n })\n }\n })\n}\n\nfunction getSchemaPaths(versionFields: VersionField[]): string[] {\n return versionFields.flatMap((versionField) => {\n const field = versionField.field\n\n if (!field) {\n return []\n }\n\n return [\n field.schemaPath,\n ...getSchemaPaths(field.fields),\n ...(field.rows?.flatMap((row) => getSchemaPaths(row)) ?? []),\n ...(field.tabs?.flatMap((tab) => getSchemaPaths(tab.fields)) ?? []),\n ]\n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