@payloadcms/ui 3.0.0-beta.100 → 3.0.0-beta.102

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 (106) hide show
  1. package/dist/elements/BulkUpload/FileSidebar/index.d.ts.map +1 -1
  2. package/dist/elements/BulkUpload/FileSidebar/index.js +5 -3
  3. package/dist/elements/BulkUpload/FileSidebar/index.js.map +1 -1
  4. package/dist/elements/BulkUpload/FileSidebar/index.scss +4 -4
  5. package/dist/elements/ListControls/index.d.ts.map +1 -1
  6. package/dist/elements/ListControls/index.js +13 -18
  7. package/dist/elements/ListControls/index.js.map +1 -1
  8. package/dist/elements/ListDrawer/DrawerContent.d.ts.map +1 -1
  9. package/dist/elements/ListDrawer/DrawerContent.js +304 -226
  10. package/dist/elements/ListDrawer/DrawerContent.js.map +1 -1
  11. package/dist/elements/SearchFilter/index.d.ts.map +1 -1
  12. package/dist/elements/SearchFilter/index.js +30 -12
  13. package/dist/elements/SearchFilter/index.js.map +1 -1
  14. package/dist/elements/SortColumn/index.d.ts.map +1 -1
  15. package/dist/elements/SortColumn/index.js +3 -6
  16. package/dist/elements/SortColumn/index.js.map +1 -1
  17. package/dist/elements/Upload/index.scss +3 -0
  18. package/dist/elements/WhereBuilder/index.d.ts.map +1 -1
  19. package/dist/elements/WhereBuilder/index.js +5 -8
  20. package/dist/elements/WhereBuilder/index.js.map +1 -1
  21. package/dist/exports/client/index.js +19 -19
  22. package/dist/exports/client/index.js.map +3 -3
  23. package/dist/fields/Array/index.d.ts +11 -3
  24. package/dist/fields/Array/index.d.ts.map +1 -1
  25. package/dist/fields/Array/index.js.map +1 -1
  26. package/dist/fields/Blocks/index.d.ts +8 -2
  27. package/dist/fields/Blocks/index.d.ts.map +1 -1
  28. package/dist/fields/Blocks/index.js +1 -1
  29. package/dist/fields/Blocks/index.js.map +1 -1
  30. package/dist/fields/Checkbox/index.d.ts +15 -3
  31. package/dist/fields/Checkbox/index.d.ts.map +1 -1
  32. package/dist/fields/Checkbox/index.js.map +1 -1
  33. package/dist/fields/Code/index.d.ts +9 -2
  34. package/dist/fields/Code/index.d.ts.map +1 -1
  35. package/dist/fields/Code/index.js.map +1 -1
  36. package/dist/fields/Collapsible/index.d.ts +6 -2
  37. package/dist/fields/Collapsible/index.d.ts.map +1 -1
  38. package/dist/fields/Collapsible/index.js.map +1 -1
  39. package/dist/fields/DateTime/index.d.ts +9 -2
  40. package/dist/fields/DateTime/index.d.ts.map +1 -1
  41. package/dist/fields/DateTime/index.js.map +1 -1
  42. package/dist/fields/Email/index.d.ts +10 -2
  43. package/dist/fields/Email/index.d.ts.map +1 -1
  44. package/dist/fields/Email/index.js.map +1 -1
  45. package/dist/fields/Group/index.d.ts +8 -3
  46. package/dist/fields/Group/index.d.ts.map +1 -1
  47. package/dist/fields/Group/index.js.map +1 -1
  48. package/dist/fields/JSON/index.d.ts +8 -2
  49. package/dist/fields/JSON/index.d.ts.map +1 -1
  50. package/dist/fields/JSON/index.js.map +1 -1
  51. package/dist/fields/Number/index.d.ts +9 -2
  52. package/dist/fields/Number/index.d.ts.map +1 -1
  53. package/dist/fields/Number/index.js.map +1 -1
  54. package/dist/fields/Point/index.d.ts +10 -3
  55. package/dist/fields/Point/index.d.ts.map +1 -1
  56. package/dist/fields/Point/index.js.map +1 -1
  57. package/dist/fields/RadioGroup/Radio/index.d.ts +2 -2
  58. package/dist/fields/RadioGroup/Radio/index.d.ts.map +1 -1
  59. package/dist/fields/RadioGroup/Radio/index.js.map +1 -1
  60. package/dist/fields/RadioGroup/index.d.ts +10 -2
  61. package/dist/fields/RadioGroup/index.d.ts.map +1 -1
  62. package/dist/fields/RadioGroup/index.js.map +1 -1
  63. package/dist/fields/Relationship/index.d.ts +8 -2
  64. package/dist/fields/Relationship/index.d.ts.map +1 -1
  65. package/dist/fields/Relationship/index.js.map +1 -1
  66. package/dist/fields/RichText/index.d.ts +2 -2
  67. package/dist/fields/RichText/index.d.ts.map +1 -1
  68. package/dist/fields/RichText/index.js.map +1 -1
  69. package/dist/fields/Row/index.d.ts +9 -2
  70. package/dist/fields/Row/index.d.ts.map +1 -1
  71. package/dist/fields/Row/index.js.map +1 -1
  72. package/dist/fields/Select/index.d.ts +10 -2
  73. package/dist/fields/Select/index.d.ts.map +1 -1
  74. package/dist/fields/Select/index.js.map +1 -1
  75. package/dist/fields/Tabs/index.d.ts +6 -2
  76. package/dist/fields/Tabs/index.d.ts.map +1 -1
  77. package/dist/fields/Tabs/index.js.map +1 -1
  78. package/dist/fields/Text/index.d.ts +10 -2
  79. package/dist/fields/Text/index.d.ts.map +1 -1
  80. package/dist/fields/Text/index.js.map +1 -1
  81. package/dist/fields/Textarea/index.d.ts +11 -2
  82. package/dist/fields/Textarea/index.d.ts.map +1 -1
  83. package/dist/fields/Textarea/index.js.map +1 -1
  84. package/dist/fields/Upload/HasMany/index.d.ts.map +1 -1
  85. package/dist/fields/Upload/HasMany/index.js +18 -11
  86. package/dist/fields/Upload/HasMany/index.js.map +1 -1
  87. package/dist/fields/Upload/HasOne/index.d.ts.map +1 -1
  88. package/dist/fields/Upload/HasOne/index.js +8 -1
  89. package/dist/fields/Upload/HasOne/index.js.map +1 -1
  90. package/dist/fields/Upload/index.d.ts +3 -3
  91. package/dist/fields/Upload/index.d.ts.map +1 -1
  92. package/dist/fields/Upload/index.js.map +1 -1
  93. package/dist/fields/Upload/index.scss +3 -0
  94. package/dist/hooks/useThrottledEffect.d.ts +7 -0
  95. package/dist/hooks/useThrottledEffect.d.ts.map +1 -1
  96. package/dist/hooks/useThrottledEffect.js +7 -0
  97. package/dist/hooks/useThrottledEffect.js.map +1 -1
  98. package/dist/providers/ListQuery/index.d.ts +6 -0
  99. package/dist/providers/ListQuery/index.d.ts.map +1 -1
  100. package/dist/providers/ListQuery/index.js +26 -18
  101. package/dist/providers/ListQuery/index.js.map +1 -1
  102. package/dist/providers/Selection/index.d.ts.map +1 -1
  103. package/dist/providers/Selection/index.js +9 -4
  104. package/dist/providers/Selection/index.js.map +1 -1
  105. package/dist/styles.css +1 -1
  106. package/package.json +5 -5
@@ -1,13 +1,14 @@
1
1
  'use client';
2
2
 
3
3
  import { c as _c } from "react/compiler-runtime";
4
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
5
5
  import { useModal } from '@faceless-ui/modal';
6
6
  import { getTranslation } from '@payloadcms/translations';
7
- import React, { useCallback, useEffect, useReducer, useState } from 'react';
7
+ import React, { useCallback, useEffect, useReducer, useRef, useState } from 'react';
8
8
  import { SelectMany } from '../../elements/SelectMany/index.js';
9
9
  import { FieldLabel } from '../../fields/FieldLabel/index.js';
10
10
  import { usePayloadAPI } from '../../hooks/usePayloadAPI.js';
11
+ import { useThrottledEffect } from '../../hooks/useThrottledEffect.js';
11
12
  import { XIcon } from '../../icons/X/index.js';
12
13
  import { useAuth } from '../../providers/Auth/index.js';
13
14
  import { useConfig } from '../../providers/Config/index.js';
@@ -38,7 +39,7 @@ const hoistQueryParamsToAnd = (where, queryParams) => {
38
39
  return where;
39
40
  };
40
41
  export const ListDrawerContent = t0 => {
41
- const $ = _c(97);
42
+ const $ = _c(95);
42
43
  const {
43
44
  collectionSlugs,
44
45
  customHeader,
@@ -57,6 +58,7 @@ export const ListDrawerContent = t0 => {
57
58
  permissions
58
59
  } = useAuth();
59
60
  const {
61
+ getPreference,
60
62
  setPreference
61
63
  } = usePreferences();
62
64
  const {
@@ -64,10 +66,20 @@ export const ListDrawerContent = t0 => {
64
66
  isModalOpen
65
67
  } = useModal();
66
68
  const [limit, setLimit] = useState();
69
+ const previousLimit = useRef(limit || null);
67
70
  const [sort, setSort] = useState(null);
68
71
  const [page, setPage] = useState(1);
69
72
  const [where, setWhere] = useState(null);
70
73
  const [search, setSearch] = useState("");
74
+ const [showLoadingOverlay, setShowLoadingOverlay] = useState(true);
75
+ const hasInitialised = useRef(false);
76
+ const params = {
77
+ limit,
78
+ page,
79
+ search,
80
+ sort,
81
+ where
82
+ };
71
83
  const {
72
84
  config: t1
73
85
  } = useConfig();
@@ -132,98 +144,98 @@ export const ListDrawerContent = t0 => {
132
144
  }
133
145
  const [selectedOption, setSelectedOption] = useState(t5);
134
146
  let t6;
135
- if ($[11] !== selectedCollectionConfig) {
136
- t6 = [selectedCollectionConfig];
137
- $[11] = selectedCollectionConfig;
138
- $[12] = t6;
139
- } else {
140
- t6 = $[12];
141
- }
142
- useEffect(_temp, t6);
143
- let t7;
144
- if ($[13] !== selectedCollection || $[14] !== enabledCollectionConfigs) {
145
- t7 = () => {
147
+ if ($[11] !== selectedCollection || $[12] !== enabledCollectionConfigs) {
148
+ t6 = () => {
146
149
  if (selectedCollection) {
147
- const selectedConfig = enabledCollectionConfigs.find(t8 => {
150
+ const selectedConfig = enabledCollectionConfigs.find(t7 => {
148
151
  const {
149
152
  slug: slug_1
150
- } = t8;
153
+ } = t7;
151
154
  return slug_1 === selectedCollection;
152
155
  }) || enabledCollectionConfigs?.[0];
153
156
  setSelectedCollectionConfig(selectedConfig);
154
157
  }
155
158
  };
156
- $[13] = selectedCollection;
157
- $[14] = enabledCollectionConfigs;
158
- $[15] = t7;
159
+ $[11] = selectedCollection;
160
+ $[12] = enabledCollectionConfigs;
161
+ $[13] = t6;
159
162
  } else {
160
- t7 = $[15];
163
+ t6 = $[13];
161
164
  }
162
- let t8;
163
- if ($[16] !== selectedCollection || $[17] !== enabledCollectionConfigs || $[18] !== onSelect || $[19] !== t) {
164
- t8 = [selectedCollection, enabledCollectionConfigs, onSelect, t];
165
- $[16] = selectedCollection;
166
- $[17] = enabledCollectionConfigs;
167
- $[18] = onSelect;
168
- $[19] = t;
169
- $[20] = t8;
165
+ let t7;
166
+ if ($[14] !== selectedCollection || $[15] !== enabledCollectionConfigs || $[16] !== onSelect || $[17] !== t) {
167
+ t7 = [selectedCollection, enabledCollectionConfigs, onSelect, t];
168
+ $[14] = selectedCollection;
169
+ $[15] = enabledCollectionConfigs;
170
+ $[16] = onSelect;
171
+ $[17] = t;
172
+ $[18] = t7;
170
173
  } else {
171
- t8 = $[20];
174
+ t7 = $[18];
172
175
  }
173
- useEffect(t7, t8);
174
- const preferenceKey = `${selectedCollectionConfig.slug}-list`;
175
- let t9;
176
- if ($[21] !== selectedCollectionConfig.slug) {
177
- t9 = {
176
+ useEffect(t6, t7);
177
+ const preferencesKey = `${selectedCollectionConfig.slug}-list`;
178
+ let t8;
179
+ if ($[19] !== selectedCollectionConfig.slug) {
180
+ t8 = {
178
181
  collectionSlug: selectedCollectionConfig.slug
179
182
  };
180
- $[21] = selectedCollectionConfig.slug;
181
- $[22] = t9;
183
+ $[19] = selectedCollectionConfig.slug;
184
+ $[20] = t8;
182
185
  } else {
183
- t9 = $[22];
186
+ t8 = $[20];
184
187
  }
185
- const [DocumentDrawer, DocumentDrawerToggler, t10] = useDocumentDrawer(t9);
188
+ const [DocumentDrawer, DocumentDrawerToggler, t9] = useDocumentDrawer(t8);
186
189
  const {
187
190
  drawerSlug: documentDrawerSlug
188
- } = t10;
191
+ } = t9;
192
+ let t10;
189
193
  let t11;
190
- let t12;
191
- if ($[23] !== selectedOption || $[24] !== enabledCollectionConfigs) {
192
- t11 = () => {
194
+ if ($[21] !== selectedOption || $[22] !== enabledCollectionConfigs) {
195
+ t10 = () => {
193
196
  if (selectedOption && !Array.isArray(selectedOption)) {
194
- setSelectedCollectionConfig(enabledCollectionConfigs.find(t13 => {
197
+ setSelectedCollectionConfig(enabledCollectionConfigs.find(t12 => {
195
198
  const {
196
199
  slug: slug_2
197
- } = t13;
200
+ } = t12;
198
201
  return selectedOption.value === slug_2;
199
202
  }));
200
203
  }
201
204
  };
202
- t12 = [selectedOption, enabledCollectionConfigs];
203
- $[23] = selectedOption;
204
- $[24] = enabledCollectionConfigs;
205
- $[25] = t11;
206
- $[26] = t12;
205
+ t11 = [selectedOption, enabledCollectionConfigs];
206
+ $[21] = selectedOption;
207
+ $[22] = enabledCollectionConfigs;
208
+ $[23] = t10;
209
+ $[24] = t11;
207
210
  } else {
208
- t11 = $[25];
209
- t12 = $[26];
211
+ t10 = $[23];
212
+ t11 = $[24];
210
213
  }
211
- useEffect(t11, t12);
214
+ useEffect(t10, t11);
212
215
  const collectionPermissions = permissions?.collections?.[selectedCollectionConfig?.slug];
213
216
  const hasCreatePermission = collectionPermissions?.create?.permission;
214
- const isOpen = isModalOpen(drawerSlug);
217
+ let t12;
218
+ if ($[25] !== isModalOpen || $[26] !== drawerSlug) {
219
+ t12 = isModalOpen(drawerSlug);
220
+ $[25] = isModalOpen;
221
+ $[26] = drawerSlug;
222
+ $[27] = t12;
223
+ } else {
224
+ t12 = $[27];
225
+ }
226
+ const isOpen = t12;
215
227
  const apiURL = isOpen ? `${serverURL}${api}/${selectedCollectionConfig.slug}` : null;
216
- const [cacheBust, dispatchCacheBust] = useReducer(_temp2, 0);
228
+ const [cacheBust, dispatchCacheBust] = useReducer(_temp, 0);
217
229
  let t13;
218
- if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
230
+ if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
219
231
  t13 = {
220
232
  initialParams: {
221
233
  depth: 0
222
234
  }
223
235
  };
224
- $[27] = t13;
236
+ $[28] = t13;
225
237
  } else {
226
- t13 = $[27];
238
+ t13 = $[28];
227
239
  }
228
240
  const [t14, t15] = usePayloadAPI(apiURL, t13);
229
241
  const {
@@ -236,7 +248,7 @@ export const ListDrawerContent = t0 => {
236
248
  } = t15;
237
249
  const moreThanOneAvailableCollection = enabledCollectionConfigs.length > 1;
238
250
  let t16;
239
- if ($[28] !== selectedCollectionConfig || $[29] !== where || $[30] !== filterOptions || $[31] !== search || $[32] !== page || $[33] !== sort || $[34] !== cacheBust || $[35] !== setParams) {
251
+ if ($[29] !== selectedCollectionConfig || $[30] !== where || $[31] !== filterOptions || $[32] !== search || $[33] !== page || $[34] !== sort || $[35] !== cacheBust || $[36] !== limit || $[37] !== setParams) {
240
252
  t16 = () => {
241
253
  const {
242
254
  slug: slug_3,
@@ -247,7 +259,7 @@ export const ListDrawerContent = t0 => {
247
259
  listSearchableFields,
248
260
  useAsTitle
249
261
  } = t17 === undefined ? {} : t17;
250
- const params = {
262
+ const params_0 = {
251
263
  depth: 0
252
264
  };
253
265
  let copyOfWhere = {
@@ -271,79 +283,173 @@ export const ListDrawerContent = t0 => {
271
283
  }
272
284
  }
273
285
  if (page) {
274
- params.page = page;
286
+ params_0.page = page;
275
287
  }
276
288
  if (sort) {
277
- params.sort = sort;
289
+ params_0.sort = sort;
278
290
  }
279
291
  if (cacheBust) {
280
- params.cacheBust = cacheBust;
292
+ params_0.cacheBust = cacheBust;
293
+ }
294
+ if (limit) {
295
+ params_0.limit = limit;
296
+ if (limit !== previousLimit.current) {
297
+ previousLimit.current = limit;
298
+ setPage(1);
299
+ }
281
300
  }
282
301
  if (copyOfWhere) {
283
- params.where = copyOfWhere;
302
+ params_0.where = copyOfWhere;
284
303
  }
285
304
  if (versions?.drafts) {
286
- params.draft = "true";
305
+ params_0.draft = "true";
287
306
  }
288
- setParams(params);
307
+ setParams(params_0);
289
308
  };
290
- $[28] = selectedCollectionConfig;
291
- $[29] = where;
292
- $[30] = filterOptions;
293
- $[31] = search;
294
- $[32] = page;
295
- $[33] = sort;
296
- $[34] = cacheBust;
297
- $[35] = setParams;
298
- $[36] = t16;
309
+ $[29] = selectedCollectionConfig;
310
+ $[30] = where;
311
+ $[31] = filterOptions;
312
+ $[32] = search;
313
+ $[33] = page;
314
+ $[34] = sort;
315
+ $[35] = cacheBust;
316
+ $[36] = limit;
317
+ $[37] = setParams;
318
+ $[38] = t16;
299
319
  } else {
300
- t16 = $[36];
320
+ t16 = $[38];
301
321
  }
302
322
  let t17;
303
- if ($[37] !== page || $[38] !== sort || $[39] !== where || $[40] !== search || $[41] !== cacheBust || $[42] !== filterOptions || $[43] !== selectedCollectionConfig || $[44] !== t || $[45] !== setParams) {
304
- t17 = [page, sort, where, search, cacheBust, filterOptions, selectedCollectionConfig, t, setParams];
305
- $[37] = page;
306
- $[38] = sort;
307
- $[39] = where;
308
- $[40] = search;
309
- $[41] = cacheBust;
310
- $[42] = filterOptions;
311
- $[43] = selectedCollectionConfig;
312
- $[44] = t;
313
- $[45] = setParams;
314
- $[46] = t17;
323
+ if ($[39] !== page || $[40] !== sort || $[41] !== where || $[42] !== search || $[43] !== limit || $[44] !== cacheBust || $[45] !== filterOptions || $[46] !== selectedCollectionConfig || $[47] !== t || $[48] !== setParams) {
324
+ t17 = [page, sort, where, search, limit, cacheBust, filterOptions, selectedCollectionConfig, t, setParams];
325
+ $[39] = page;
326
+ $[40] = sort;
327
+ $[41] = where;
328
+ $[42] = search;
329
+ $[43] = limit;
330
+ $[44] = cacheBust;
331
+ $[45] = filterOptions;
332
+ $[46] = selectedCollectionConfig;
333
+ $[47] = t;
334
+ $[48] = setParams;
335
+ $[49] = t17;
315
336
  } else {
316
- t17 = $[46];
337
+ t17 = $[49];
317
338
  }
318
339
  useEffect(t16, t17);
319
340
  let t18;
320
341
  let t19;
321
- if ($[47] !== limit || $[48] !== sort || $[49] !== setPreference || $[50] !== preferenceKey) {
342
+ if ($[50] !== limit || $[51] !== sort || $[52] !== setPreference || $[53] !== preferencesKey) {
322
343
  t18 = () => {
323
344
  const newPreferences = {
324
345
  limit,
325
346
  sort
326
347
  };
327
- setPreference(preferenceKey, newPreferences, true);
348
+ if (limit || sort) {
349
+ setPreference(preferencesKey, newPreferences, true);
350
+ }
328
351
  };
329
- t19 = [sort, limit, setPreference, preferenceKey];
330
- $[47] = limit;
331
- $[48] = sort;
332
- $[49] = setPreference;
333
- $[50] = preferenceKey;
334
- $[51] = t18;
335
- $[52] = t19;
352
+ t19 = [sort, limit, setPreference, preferencesKey];
353
+ $[50] = limit;
354
+ $[51] = sort;
355
+ $[52] = setPreference;
356
+ $[53] = preferencesKey;
357
+ $[54] = t18;
358
+ $[55] = t19;
336
359
  } else {
337
- t18 = $[51];
338
- t19 = $[52];
360
+ t18 = $[54];
361
+ t19 = $[55];
339
362
  }
340
363
  useEffect(t18, t19);
341
364
  let t20;
342
- if ($[53] !== onSelect || $[54] !== selectedCollectionConfig.slug || $[55] !== closeModal || $[56] !== documentDrawerSlug || $[57] !== drawerSlug) {
343
- t20 = t21 => {
365
+ let t21;
366
+ if ($[56] !== preferencesKey || $[57] !== limit || $[58] !== getPreference) {
367
+ t20 = () => {
368
+ if (preferencesKey && !limit) {
369
+ const getInitialPref = async () => {
370
+ const existingPreferences = await getPreference(preferencesKey);
371
+ if (existingPreferences?.limit) {
372
+ setLimit(existingPreferences?.limit);
373
+ }
374
+ };
375
+ getInitialPref();
376
+ }
377
+ };
378
+ t21 = [getPreference, limit, preferencesKey];
379
+ $[56] = preferencesKey;
380
+ $[57] = limit;
381
+ $[58] = getPreference;
382
+ $[59] = t20;
383
+ $[60] = t21;
384
+ } else {
385
+ t20 = $[59];
386
+ t21 = $[60];
387
+ }
388
+ useEffect(t20, t21);
389
+ let t22;
390
+ if ($[61] !== isLoadingList) {
391
+ t22 = () => {
392
+ if (isLoadingList) {
393
+ setShowLoadingOverlay(true);
394
+ }
395
+ };
396
+ $[61] = isLoadingList;
397
+ $[62] = t22;
398
+ } else {
399
+ t22 = $[62];
400
+ }
401
+ let t23;
402
+ if ($[63] !== isLoadingList) {
403
+ t23 = [isLoadingList, setShowLoadingOverlay];
404
+ $[63] = isLoadingList;
405
+ $[64] = t23;
406
+ } else {
407
+ t23 = $[64];
408
+ }
409
+ useThrottledEffect(t22, 1750, t23);
410
+ let t24;
411
+ let t25;
412
+ if ($[65] !== isOpen) {
413
+ t24 = () => {
414
+ if (isOpen) {
415
+ hasInitialised.current = true;
416
+ } else {
417
+ hasInitialised.current = false;
418
+ }
419
+ };
420
+ t25 = [isOpen];
421
+ $[65] = isOpen;
422
+ $[66] = t24;
423
+ $[67] = t25;
424
+ } else {
425
+ t24 = $[66];
426
+ t25 = $[67];
427
+ }
428
+ useEffect(t24, t25);
429
+ let t26;
430
+ let t27;
431
+ if ($[68] !== isLoadingList || $[69] !== showLoadingOverlay) {
432
+ t26 = () => {
433
+ if (!isLoadingList && showLoadingOverlay) {
434
+ setShowLoadingOverlay(false);
435
+ }
436
+ };
437
+ t27 = [isLoadingList, showLoadingOverlay];
438
+ $[68] = isLoadingList;
439
+ $[69] = showLoadingOverlay;
440
+ $[70] = t26;
441
+ $[71] = t27;
442
+ } else {
443
+ t26 = $[70];
444
+ t27 = $[71];
445
+ }
446
+ useEffect(t26, t27);
447
+ let t28;
448
+ if ($[72] !== onSelect || $[73] !== selectedCollectionConfig.slug || $[74] !== closeModal || $[75] !== documentDrawerSlug || $[76] !== drawerSlug) {
449
+ t28 = t29 => {
344
450
  const {
345
451
  doc
346
- } = t21;
452
+ } = t29;
347
453
  if (typeof onSelect === "function") {
348
454
  onSelect({
349
455
  collectionSlug: selectedCollectionConfig.slug,
@@ -354,101 +460,98 @@ export const ListDrawerContent = t0 => {
354
460
  closeModal(documentDrawerSlug);
355
461
  closeModal(drawerSlug);
356
462
  };
357
- $[53] = onSelect;
358
- $[54] = selectedCollectionConfig.slug;
359
- $[55] = closeModal;
360
- $[56] = documentDrawerSlug;
361
- $[57] = drawerSlug;
362
- $[58] = t20;
463
+ $[72] = onSelect;
464
+ $[73] = selectedCollectionConfig.slug;
465
+ $[74] = closeModal;
466
+ $[75] = documentDrawerSlug;
467
+ $[76] = drawerSlug;
468
+ $[77] = t28;
363
469
  } else {
364
- t20 = $[58];
470
+ t28 = $[77];
365
471
  }
366
- const onCreateNew = t20;
472
+ const onCreateNew = t28;
367
473
  if (!selectedCollectionConfig || isError) {
368
474
  return null;
369
475
  }
370
- if (isLoadingList) {
371
- let t21;
372
- if ($[59] === Symbol.for("react.memo_cache_sentinel")) {
373
- t21 = _jsx(LoadingOverlay, {});
374
- $[59] = t21;
375
- } else {
376
- t21 = $[59];
377
- }
378
- return t21;
476
+ let t29;
477
+ if ($[78] !== showLoadingOverlay) {
478
+ t29 = showLoadingOverlay && _jsx(LoadingOverlay, {});
479
+ $[78] = showLoadingOverlay;
480
+ $[79] = t29;
481
+ } else {
482
+ t29 = $[79];
379
483
  }
380
- let t21;
381
- if ($[60] !== enableRowSelections || $[61] !== onBulkSelect || $[62] !== customHeader || $[63] !== selectedCollectionConfig || $[64] !== i18n || $[65] !== hasCreatePermission || $[66] !== t || $[67] !== DocumentDrawerToggler || $[68] !== closeModal || $[69] !== drawerSlug || $[70] !== moreThanOneAvailableCollection || $[71] !== enabledCollectionConfigs || $[72] !== selectedOption || $[73] !== limit || $[74] !== onSelect || $[75] !== List || $[76] !== onCreateNew || $[77] !== DocumentDrawer || $[78] !== preferenceKey || $[79] !== data || $[80] !== sort) {
382
- let t22;
383
- if ($[82] !== customHeader || $[83] !== selectedCollectionConfig || $[84] !== i18n) {
384
- t22 = !customHeader ? getTranslation(selectedCollectionConfig?.labels?.plural, i18n) : customHeader;
385
- $[82] = customHeader;
386
- $[83] = selectedCollectionConfig;
387
- $[84] = i18n;
388
- $[85] = t22;
389
- } else {
390
- t22 = $[85];
391
- }
392
- let t23;
393
- if ($[86] !== hasCreatePermission || $[87] !== t || $[88] !== DocumentDrawerToggler) {
394
- t23 = hasCreatePermission && _jsx(DocumentDrawerToggler, {
395
- className: `${baseClass}__create-new-button`,
396
- children: _jsx(Pill, {
397
- children: t("general:createNew")
398
- })
399
- });
400
- $[86] = hasCreatePermission;
401
- $[87] = t;
402
- $[88] = DocumentDrawerToggler;
403
- $[89] = t23;
404
- } else {
405
- t23 = $[89];
406
- }
407
- let t24;
408
- if ($[90] !== closeModal || $[91] !== drawerSlug) {
409
- t24 = () => {
410
- closeModal(drawerSlug);
411
- };
412
- $[90] = closeModal;
413
- $[91] = drawerSlug;
414
- $[92] = t24;
415
- } else {
416
- t24 = $[92];
417
- }
418
- let t25;
419
- if ($[93] !== selectedCollectionConfig) {
420
- t25 = (selectedCollectionConfig?.admin?.description || selectedCollectionConfig?.admin?.components?.Description) && _jsx("div", {
421
- className: `${baseClass}__sub-header`,
422
- children: _jsx(ViewDescription, {
423
- Description: selectedCollectionConfig.admin?.components?.Description,
424
- description: selectedCollectionConfig.admin?.description
425
- })
426
- });
427
- $[93] = selectedCollectionConfig;
428
- $[94] = t25;
429
- } else {
430
- t25 = $[94];
431
- }
432
- let t26;
433
- if ($[95] !== onSelect) {
434
- t26 = t27 => {
435
- const {
484
+ let t30;
485
+ if ($[80] !== customHeader || $[81] !== selectedCollectionConfig || $[82] !== i18n) {
486
+ t30 = !customHeader ? getTranslation(selectedCollectionConfig?.labels?.plural, i18n) : customHeader;
487
+ $[80] = customHeader;
488
+ $[81] = selectedCollectionConfig;
489
+ $[82] = i18n;
490
+ $[83] = t30;
491
+ } else {
492
+ t30 = $[83];
493
+ }
494
+ let t31;
495
+ if ($[84] !== hasCreatePermission || $[85] !== t || $[86] !== DocumentDrawerToggler) {
496
+ t31 = hasCreatePermission && _jsx(DocumentDrawerToggler, {
497
+ className: `${baseClass}__create-new-button`,
498
+ children: _jsx(Pill, {
499
+ children: t("general:createNew")
500
+ })
501
+ });
502
+ $[84] = hasCreatePermission;
503
+ $[85] = t;
504
+ $[86] = DocumentDrawerToggler;
505
+ $[87] = t31;
506
+ } else {
507
+ t31 = $[87];
508
+ }
509
+ let t32;
510
+ if ($[88] !== closeModal || $[89] !== drawerSlug) {
511
+ t32 = () => {
512
+ closeModal(drawerSlug);
513
+ };
514
+ $[88] = closeModal;
515
+ $[89] = drawerSlug;
516
+ $[90] = t32;
517
+ } else {
518
+ t32 = $[90];
519
+ }
520
+ let t33;
521
+ if ($[91] !== selectedCollectionConfig) {
522
+ t33 = (selectedCollectionConfig?.admin?.description || selectedCollectionConfig?.admin?.components?.Description) && _jsx("div", {
523
+ className: `${baseClass}__sub-header`,
524
+ children: _jsx(ViewDescription, {
525
+ Description: selectedCollectionConfig.admin?.components?.Description,
526
+ description: selectedCollectionConfig.admin?.description
527
+ })
528
+ });
529
+ $[91] = selectedCollectionConfig;
530
+ $[92] = t33;
531
+ } else {
532
+ t33 = $[92];
533
+ }
534
+ let t34;
535
+ if ($[93] !== onSelect) {
536
+ t34 = t35 => {
537
+ const {
538
+ collectionSlug: rowColl,
539
+ rowData
540
+ } = t35;
541
+ if (typeof onSelect === "function") {
542
+ onSelect({
436
543
  collectionSlug: rowColl,
437
- rowData
438
- } = t27;
439
- if (typeof onSelect === "function") {
440
- onSelect({
441
- collectionSlug: rowColl,
442
- docID: rowData.id
443
- });
444
- }
445
- };
446
- $[95] = onSelect;
447
- $[96] = t26;
448
- } else {
449
- t26 = $[96];
450
- }
451
- t21 = _jsx(ListInfoProvider, {
544
+ docID: rowData.id
545
+ });
546
+ }
547
+ };
548
+ $[93] = onSelect;
549
+ $[94] = t34;
550
+ } else {
551
+ t34 = $[94];
552
+ }
553
+ return _jsxs(_Fragment, {
554
+ children: [t29, _jsx(ListInfoProvider, {
452
555
  beforeActions: enableRowSelections ? [_jsx(SelectMany, {
453
556
  onClick: onBulkSelect
454
557
  }, "select-many")] : undefined,
@@ -465,16 +568,16 @@ export const ListDrawerContent = t0 => {
465
568
  className: `${baseClass}__header-content`,
466
569
  children: [_jsx("h2", {
467
570
  className: `${baseClass}__header-text`,
468
- children: t22
469
- }), t23]
571
+ children: t30
572
+ }), t31]
470
573
  }), _jsx("button", {
471
574
  "aria-label": t("general:close"),
472
575
  className: `${baseClass}__header-close`,
473
- onClick: t24,
576
+ onClick: t32,
474
577
  type: "button",
475
578
  children: _jsx(XIcon, {})
476
579
  })]
477
- }), t25, moreThanOneAvailableCollection && _jsxs("div", {
580
+ }), t33, moreThanOneAvailableCollection && _jsxs("div", {
478
581
  className: `${baseClass}__select-collection-wrap`,
479
582
  children: [_jsx(FieldLabel, {
480
583
  field: null,
@@ -501,16 +604,17 @@ export const ListDrawerContent = t0 => {
501
604
  handleSortChange: setSort,
502
605
  handleWhereChange: setWhere,
503
606
  modifySearchParams: false,
504
- preferenceKey,
607
+ params,
608
+ preferenceKey: preferencesKey,
505
609
  children: _jsxs(TableColumnsProvider, {
506
610
  cellProps: [{
507
611
  className: `${baseClass}__first-cell`,
508
612
  link: false,
509
- onClick: t26
613
+ onClick: t34
510
614
  }],
511
615
  collectionSlug: selectedCollectionConfig.slug,
512
616
  enableRowSelections,
513
- preferenceKey,
617
+ preferenceKey: preferencesKey,
514
618
  children: [_jsx(RenderComponent, {
515
619
  mappedComponent: List
516
620
  }), _jsx(DocumentDrawer, {
@@ -518,36 +622,10 @@ export const ListDrawerContent = t0 => {
518
622
  })]
519
623
  })
520
624
  })
521
- });
522
- $[60] = enableRowSelections;
523
- $[61] = onBulkSelect;
524
- $[62] = customHeader;
525
- $[63] = selectedCollectionConfig;
526
- $[64] = i18n;
527
- $[65] = hasCreatePermission;
528
- $[66] = t;
529
- $[67] = DocumentDrawerToggler;
530
- $[68] = closeModal;
531
- $[69] = drawerSlug;
532
- $[70] = moreThanOneAvailableCollection;
533
- $[71] = enabledCollectionConfigs;
534
- $[72] = selectedOption;
535
- $[73] = limit;
536
- $[74] = onSelect;
537
- $[75] = List;
538
- $[76] = onCreateNew;
539
- $[77] = DocumentDrawer;
540
- $[78] = preferenceKey;
541
- $[79] = data;
542
- $[80] = sort;
543
- $[81] = t21;
544
- } else {
545
- t21 = $[81];
546
- }
547
- return t21;
625
+ })]
626
+ });
548
627
  };
549
- function _temp() {}
550
- function _temp2(state) {
628
+ function _temp(state) {
551
629
  return state + 1;
552
630
  }
553
631
  //# sourceMappingURL=DrawerContent.js.map