@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.
- package/dist/elements/BulkUpload/FileSidebar/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/FileSidebar/index.js +5 -3
- package/dist/elements/BulkUpload/FileSidebar/index.js.map +1 -1
- package/dist/elements/BulkUpload/FileSidebar/index.scss +4 -4
- package/dist/elements/ListControls/index.d.ts.map +1 -1
- package/dist/elements/ListControls/index.js +13 -18
- package/dist/elements/ListControls/index.js.map +1 -1
- package/dist/elements/ListDrawer/DrawerContent.d.ts.map +1 -1
- package/dist/elements/ListDrawer/DrawerContent.js +304 -226
- package/dist/elements/ListDrawer/DrawerContent.js.map +1 -1
- package/dist/elements/SearchFilter/index.d.ts.map +1 -1
- package/dist/elements/SearchFilter/index.js +30 -12
- package/dist/elements/SearchFilter/index.js.map +1 -1
- package/dist/elements/SortColumn/index.d.ts.map +1 -1
- package/dist/elements/SortColumn/index.js +3 -6
- package/dist/elements/SortColumn/index.js.map +1 -1
- package/dist/elements/Upload/index.scss +3 -0
- package/dist/elements/WhereBuilder/index.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/index.js +5 -8
- package/dist/elements/WhereBuilder/index.js.map +1 -1
- package/dist/exports/client/index.js +19 -19
- package/dist/exports/client/index.js.map +3 -3
- package/dist/fields/Array/index.d.ts +11 -3
- package/dist/fields/Array/index.d.ts.map +1 -1
- package/dist/fields/Array/index.js.map +1 -1
- package/dist/fields/Blocks/index.d.ts +8 -2
- package/dist/fields/Blocks/index.d.ts.map +1 -1
- package/dist/fields/Blocks/index.js +1 -1
- package/dist/fields/Blocks/index.js.map +1 -1
- package/dist/fields/Checkbox/index.d.ts +15 -3
- package/dist/fields/Checkbox/index.d.ts.map +1 -1
- package/dist/fields/Checkbox/index.js.map +1 -1
- package/dist/fields/Code/index.d.ts +9 -2
- package/dist/fields/Code/index.d.ts.map +1 -1
- package/dist/fields/Code/index.js.map +1 -1
- package/dist/fields/Collapsible/index.d.ts +6 -2
- package/dist/fields/Collapsible/index.d.ts.map +1 -1
- package/dist/fields/Collapsible/index.js.map +1 -1
- package/dist/fields/DateTime/index.d.ts +9 -2
- package/dist/fields/DateTime/index.d.ts.map +1 -1
- package/dist/fields/DateTime/index.js.map +1 -1
- package/dist/fields/Email/index.d.ts +10 -2
- package/dist/fields/Email/index.d.ts.map +1 -1
- package/dist/fields/Email/index.js.map +1 -1
- package/dist/fields/Group/index.d.ts +8 -3
- package/dist/fields/Group/index.d.ts.map +1 -1
- package/dist/fields/Group/index.js.map +1 -1
- package/dist/fields/JSON/index.d.ts +8 -2
- package/dist/fields/JSON/index.d.ts.map +1 -1
- package/dist/fields/JSON/index.js.map +1 -1
- package/dist/fields/Number/index.d.ts +9 -2
- package/dist/fields/Number/index.d.ts.map +1 -1
- package/dist/fields/Number/index.js.map +1 -1
- package/dist/fields/Point/index.d.ts +10 -3
- package/dist/fields/Point/index.d.ts.map +1 -1
- package/dist/fields/Point/index.js.map +1 -1
- package/dist/fields/RadioGroup/Radio/index.d.ts +2 -2
- package/dist/fields/RadioGroup/Radio/index.d.ts.map +1 -1
- package/dist/fields/RadioGroup/Radio/index.js.map +1 -1
- package/dist/fields/RadioGroup/index.d.ts +10 -2
- package/dist/fields/RadioGroup/index.d.ts.map +1 -1
- package/dist/fields/RadioGroup/index.js.map +1 -1
- package/dist/fields/Relationship/index.d.ts +8 -2
- package/dist/fields/Relationship/index.d.ts.map +1 -1
- package/dist/fields/Relationship/index.js.map +1 -1
- package/dist/fields/RichText/index.d.ts +2 -2
- package/dist/fields/RichText/index.d.ts.map +1 -1
- package/dist/fields/RichText/index.js.map +1 -1
- package/dist/fields/Row/index.d.ts +9 -2
- package/dist/fields/Row/index.d.ts.map +1 -1
- package/dist/fields/Row/index.js.map +1 -1
- package/dist/fields/Select/index.d.ts +10 -2
- package/dist/fields/Select/index.d.ts.map +1 -1
- package/dist/fields/Select/index.js.map +1 -1
- package/dist/fields/Tabs/index.d.ts +6 -2
- package/dist/fields/Tabs/index.d.ts.map +1 -1
- package/dist/fields/Tabs/index.js.map +1 -1
- package/dist/fields/Text/index.d.ts +10 -2
- package/dist/fields/Text/index.d.ts.map +1 -1
- package/dist/fields/Text/index.js.map +1 -1
- package/dist/fields/Textarea/index.d.ts +11 -2
- package/dist/fields/Textarea/index.d.ts.map +1 -1
- package/dist/fields/Textarea/index.js.map +1 -1
- package/dist/fields/Upload/HasMany/index.d.ts.map +1 -1
- package/dist/fields/Upload/HasMany/index.js +18 -11
- package/dist/fields/Upload/HasMany/index.js.map +1 -1
- package/dist/fields/Upload/HasOne/index.d.ts.map +1 -1
- package/dist/fields/Upload/HasOne/index.js +8 -1
- package/dist/fields/Upload/HasOne/index.js.map +1 -1
- package/dist/fields/Upload/index.d.ts +3 -3
- package/dist/fields/Upload/index.d.ts.map +1 -1
- package/dist/fields/Upload/index.js.map +1 -1
- package/dist/fields/Upload/index.scss +3 -0
- package/dist/hooks/useThrottledEffect.d.ts +7 -0
- package/dist/hooks/useThrottledEffect.d.ts.map +1 -1
- package/dist/hooks/useThrottledEffect.js +7 -0
- package/dist/hooks/useThrottledEffect.js.map +1 -1
- package/dist/providers/ListQuery/index.d.ts +6 -0
- package/dist/providers/ListQuery/index.d.ts.map +1 -1
- package/dist/providers/ListQuery/index.js +26 -18
- package/dist/providers/ListQuery/index.js.map +1 -1
- package/dist/providers/Selection/index.d.ts.map +1 -1
- package/dist/providers/Selection/index.js +9 -4
- package/dist/providers/Selection/index.js.map +1 -1
- package/dist/styles.css +1 -1
- 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(
|
|
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] !==
|
|
136
|
-
t6 =
|
|
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(
|
|
150
|
+
const selectedConfig = enabledCollectionConfigs.find(t7 => {
|
|
148
151
|
const {
|
|
149
152
|
slug: slug_1
|
|
150
|
-
} =
|
|
153
|
+
} = t7;
|
|
151
154
|
return slug_1 === selectedCollection;
|
|
152
155
|
}) || enabledCollectionConfigs?.[0];
|
|
153
156
|
setSelectedCollectionConfig(selectedConfig);
|
|
154
157
|
}
|
|
155
158
|
};
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
+
$[11] = selectedCollection;
|
|
160
|
+
$[12] = enabledCollectionConfigs;
|
|
161
|
+
$[13] = t6;
|
|
159
162
|
} else {
|
|
160
|
-
|
|
163
|
+
t6 = $[13];
|
|
161
164
|
}
|
|
162
|
-
let
|
|
163
|
-
if ($[
|
|
164
|
-
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
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
|
-
|
|
174
|
+
t7 = $[18];
|
|
172
175
|
}
|
|
173
|
-
useEffect(
|
|
174
|
-
const
|
|
175
|
-
let
|
|
176
|
-
if ($[
|
|
177
|
-
|
|
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
|
-
$[
|
|
181
|
-
$[
|
|
183
|
+
$[19] = selectedCollectionConfig.slug;
|
|
184
|
+
$[20] = t8;
|
|
182
185
|
} else {
|
|
183
|
-
|
|
186
|
+
t8 = $[20];
|
|
184
187
|
}
|
|
185
|
-
const [DocumentDrawer, DocumentDrawerToggler,
|
|
188
|
+
const [DocumentDrawer, DocumentDrawerToggler, t9] = useDocumentDrawer(t8);
|
|
186
189
|
const {
|
|
187
190
|
drawerSlug: documentDrawerSlug
|
|
188
|
-
} =
|
|
191
|
+
} = t9;
|
|
192
|
+
let t10;
|
|
189
193
|
let t11;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
t11 = () => {
|
|
194
|
+
if ($[21] !== selectedOption || $[22] !== enabledCollectionConfigs) {
|
|
195
|
+
t10 = () => {
|
|
193
196
|
if (selectedOption && !Array.isArray(selectedOption)) {
|
|
194
|
-
setSelectedCollectionConfig(enabledCollectionConfigs.find(
|
|
197
|
+
setSelectedCollectionConfig(enabledCollectionConfigs.find(t12 => {
|
|
195
198
|
const {
|
|
196
199
|
slug: slug_2
|
|
197
|
-
} =
|
|
200
|
+
} = t12;
|
|
198
201
|
return selectedOption.value === slug_2;
|
|
199
202
|
}));
|
|
200
203
|
}
|
|
201
204
|
};
|
|
202
|
-
|
|
203
|
-
$[
|
|
204
|
-
$[
|
|
205
|
-
$[
|
|
206
|
-
$[
|
|
205
|
+
t11 = [selectedOption, enabledCollectionConfigs];
|
|
206
|
+
$[21] = selectedOption;
|
|
207
|
+
$[22] = enabledCollectionConfigs;
|
|
208
|
+
$[23] = t10;
|
|
209
|
+
$[24] = t11;
|
|
207
210
|
} else {
|
|
208
|
-
|
|
209
|
-
|
|
211
|
+
t10 = $[23];
|
|
212
|
+
t11 = $[24];
|
|
210
213
|
}
|
|
211
|
-
useEffect(
|
|
214
|
+
useEffect(t10, t11);
|
|
212
215
|
const collectionPermissions = permissions?.collections?.[selectedCollectionConfig?.slug];
|
|
213
216
|
const hasCreatePermission = collectionPermissions?.create?.permission;
|
|
214
|
-
|
|
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(
|
|
228
|
+
const [cacheBust, dispatchCacheBust] = useReducer(_temp, 0);
|
|
217
229
|
let t13;
|
|
218
|
-
if ($[
|
|
230
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
219
231
|
t13 = {
|
|
220
232
|
initialParams: {
|
|
221
233
|
depth: 0
|
|
222
234
|
}
|
|
223
235
|
};
|
|
224
|
-
$[
|
|
236
|
+
$[28] = t13;
|
|
225
237
|
} else {
|
|
226
|
-
t13 = $[
|
|
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 ($[
|
|
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
|
|
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
|
-
|
|
286
|
+
params_0.page = page;
|
|
275
287
|
}
|
|
276
288
|
if (sort) {
|
|
277
|
-
|
|
289
|
+
params_0.sort = sort;
|
|
278
290
|
}
|
|
279
291
|
if (cacheBust) {
|
|
280
|
-
|
|
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
|
-
|
|
302
|
+
params_0.where = copyOfWhere;
|
|
284
303
|
}
|
|
285
304
|
if (versions?.drafts) {
|
|
286
|
-
|
|
305
|
+
params_0.draft = "true";
|
|
287
306
|
}
|
|
288
|
-
setParams(
|
|
307
|
+
setParams(params_0);
|
|
289
308
|
};
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
292
|
-
$[
|
|
293
|
-
$[
|
|
294
|
-
$[
|
|
295
|
-
$[
|
|
296
|
-
$[
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
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 = $[
|
|
320
|
+
t16 = $[38];
|
|
301
321
|
}
|
|
302
322
|
let t17;
|
|
303
|
-
if ($[
|
|
304
|
-
t17 = [page, sort, where, search, cacheBust, filterOptions, selectedCollectionConfig, t, setParams];
|
|
305
|
-
$[
|
|
306
|
-
$[
|
|
307
|
-
$[
|
|
308
|
-
$[
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
311
|
-
$[
|
|
312
|
-
$[
|
|
313
|
-
$[
|
|
314
|
-
$[
|
|
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 = $[
|
|
337
|
+
t17 = $[49];
|
|
317
338
|
}
|
|
318
339
|
useEffect(t16, t17);
|
|
319
340
|
let t18;
|
|
320
341
|
let t19;
|
|
321
|
-
if ($[
|
|
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
|
-
|
|
348
|
+
if (limit || sort) {
|
|
349
|
+
setPreference(preferencesKey, newPreferences, true);
|
|
350
|
+
}
|
|
328
351
|
};
|
|
329
|
-
t19 = [sort, limit, setPreference,
|
|
330
|
-
$[
|
|
331
|
-
$[
|
|
332
|
-
$[
|
|
333
|
-
$[
|
|
334
|
-
$[
|
|
335
|
-
$[
|
|
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 = $[
|
|
338
|
-
t19 = $[
|
|
360
|
+
t18 = $[54];
|
|
361
|
+
t19 = $[55];
|
|
339
362
|
}
|
|
340
363
|
useEffect(t18, t19);
|
|
341
364
|
let t20;
|
|
342
|
-
|
|
343
|
-
|
|
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
|
-
} =
|
|
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
|
-
$[
|
|
358
|
-
$[
|
|
359
|
-
$[
|
|
360
|
-
$[
|
|
361
|
-
$[
|
|
362
|
-
$[
|
|
463
|
+
$[72] = onSelect;
|
|
464
|
+
$[73] = selectedCollectionConfig.slug;
|
|
465
|
+
$[74] = closeModal;
|
|
466
|
+
$[75] = documentDrawerSlug;
|
|
467
|
+
$[76] = drawerSlug;
|
|
468
|
+
$[77] = t28;
|
|
363
469
|
} else {
|
|
364
|
-
|
|
470
|
+
t28 = $[77];
|
|
365
471
|
}
|
|
366
|
-
const onCreateNew =
|
|
472
|
+
const onCreateNew = t28;
|
|
367
473
|
if (!selectedCollectionConfig || isError) {
|
|
368
474
|
return null;
|
|
369
475
|
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
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
|
|
381
|
-
if ($[
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
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
|
-
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
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:
|
|
469
|
-
}),
|
|
571
|
+
children: t30
|
|
572
|
+
}), t31]
|
|
470
573
|
}), _jsx("button", {
|
|
471
574
|
"aria-label": t("general:close"),
|
|
472
575
|
className: `${baseClass}__header-close`,
|
|
473
|
-
onClick:
|
|
576
|
+
onClick: t32,
|
|
474
577
|
type: "button",
|
|
475
578
|
children: _jsx(XIcon, {})
|
|
476
579
|
})]
|
|
477
|
-
}),
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
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
|